Skip to content

RC #291#292

Merged
jason-capsule42 merged 3 commits into
mainfrom
rc/291
May 11, 2026
Merged

RC #291#292
jason-capsule42 merged 3 commits into
mainfrom
rc/291

Conversation

@rmenner

@rmenner rmenner commented May 11, 2026

Copy link
Copy Markdown
Collaborator

Alaska Airlines Pull Request

Release candidate pull request. See issue #291 for details.

Checklist:

  • My update follows the CONTRIBUTING guidelines of this project
  • I have performed a self-review of my own update

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!

-- Auro Design System Team

Summary by Sourcery

Adjust demo bundling and module resolution to ensure each demo entry produces a self-contained bundle and improve reliability of workspace builds.

Enhancements:

  • Resolve Rollup modules using absolute workspace/hoisted module paths so demo builds can find dependencies when run from varying working directories.
  • Change demo Rollup configuration to generate one config per entry file with inline dynamic imports, ensuring each demo .min.js is self-contained and eliminating extra shared chunk files.
  • Update combined bundle and watch-mode build flows to iterate over multiple demo configs so main and demo bundles are built and watched consistently.
  • Tighten Rollup demo build warnings to fail on unresolved imports, surfacing missing or unbuilt workspace dependencies early in the build process.
  • Improve TypeScript typing in GitHub label utilities by explicitly typing label objects when mapping names.

Build:

  • Bump @actions/github and @rollup/plugin-terser dependency versions in package.json and lockfile to keep build tooling up to date.

rmenner added 3 commits May 11, 2026 06:53
Demo entries that imported common modules caused Rollup to emit shared
chunks like index2.min.js, breaking demo HTML which only loads
<name>.min.js. Each demo entry now builds as its own Rollup pass with
inlineDynamicImports so shared imports duplicate into each
<name>.min.js instead of spilling into a separate chunk.

Also bumps @actions/github to ^9.1.1 and @rollup/plugin-terser to
^1.0.0, and updates github-labels.ts to the new namespace import shape.
Demo entries importing workspace packages (e.g. @aurodesignsystem/auro-datepicker)
were sometimes left as bare specifiers in the output, causing the browser
to throw "Failed to resolve module specifier" at runtime. nodeResolve's
auto-walkup didn't reach the hoist root in some monorepo / symlinked
workspace setups.

Pass MODULE_DIRS as absolute modulePaths to nodeResolve so it falls
back to the same parent node_modules chain the SCSS importer already
uses, ensuring hoisted deps get inlined into each <name>.min.js.
Convert Rollup's UNRESOLVED_IMPORT warning into a hard build error.
Previously a missing workspace dep (e.g. a sibling component not yet
built) was silently externalized, leaving a bare specifier in the
demo .min.js that the browser rejected at runtime. Now the build
fails loudly with a pointer to fix the build order.
@rmenner
rmenner requested a review from a team as a code owner May 11, 2026 16:23
@sourcery-ai

sourcery-ai Bot commented May 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

Refactors the demo Rollup build pipeline to emit one bundle per demo entry with inline dynamic imports, tightens unresolved import handling, adjusts watch/combined build wiring to match, introduces absolute module resolution fallbacks, and bumps a couple of build-related dependencies plus a small TypeScript typing fix.

Sequence diagram for updated demo Rollup build and unresolved import handling

sequenceDiagram
  actor Dev
  participant index as runProductionBuild
  participant demo as buildDemoBundle
  participant config as getDemoConfig
  participant rb as rollup
  participant handler as runBuildStep
  participant cfg as demo_entry_config
  participant defaultHandler

  Dev->>index: runProductionBuild(options)
  index->>config: getDemoConfig(options)
  config-->>index: { name, configs }

  index->>demo: buildDemoBundle({ configs })
  demo->>handler: runBuildStep("Bundling demo JS...")

  loop for each cfg in configs
    handler->>rb: rollup(cfg)
    rb-->>handler: bundle
    handler->>rb: write(cfg.output)
    handler->>rb: close()
  end

  alt [warning.code === UNRESOLVED_IMPORT]
    rb->>cfg: onwarn(warning, defaultHandler)
    cfg->>cfg: throw Error
  else [other warnings]
    rb->>cfg: onwarn(warning, defaultHandler)
    cfg->>defaultHandler: defaultHandler(warning)
  end
Loading

File-Level Changes

Change Details Files
Refine Node/Rollup module resolution with absolute modulePaths for workspace/hoisted packages.
  • Derive current working directory and compute absolute module paths from configured module directories.
  • Pass computed absolute module paths into the nodeResolve plugin configuration so Rollup can resolve hoisted/workspace dependencies reliably.
src/scripts/build/configUtils.js
Restructure demo Rollup configs to build each demo entry as its own bundle with inline dynamic imports and stricter unresolved-import handling.
  • Change getDemoConfig to discover demo entry files, generate a Rollup config per entry, and return { name, configs } instead of a single config object.
  • Enable inlineDynamicImports on demo outputs so shared imports are duplicated into each entry’s .min.js instead of separate numbered chunks.
  • Introduce a custom onwarn handler that throws on UNRESOLVED_IMPORT warnings to fail the build when demo imports can’t be resolved, with guidance about building workspace deps first.
  • Reuse shared plugins and watcher config across per-entry configs for efficiency.
src/scripts/build/configUtils.js
Update combined and demo-only bundle handlers to iterate over per-entry demo configs instead of a single demo config.
  • Modify buildCombinedBundle to accept an array of demo configs and roll them sequentially, updating log messaging accordingly.
  • Update buildDemoBundle to consume the new { configs } shape from getDemoConfig and loop over each config when invoking rollup.
src/scripts/build/bundleHandlers.js
Adjust production build and watch-mode wiring to use the new per-entry demo configs.
  • Change runProductionBuild to pass demoConfig.configs into buildCombinedBundle.
  • Update setupWatchMode to register all demo configs with rollup.watch instead of a single aggregated demo config, documenting why this preserves per-entry bundling.
src/scripts/build/index.js
Align GitHub-related and Rollup plugin dependencies with newer versions and fix a minor typing issue in label handling.
  • Bump @actions/github from 6.0.1 to 9.1.1 and @rollup/plugin-terser from 0.4.4 to 1.0.0 in package.json, with corresponding lockfile updates.
  • Tighten typing in getExistingLabels by annotating the label shape in the map callback to satisfy TypeScript.
package.json
package-lock.json
src/scripts/check-commits/github-labels.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • In getPluginsConfig, allModulePaths is now completely unused; consider either wiring it into nodeResolve alongside absoluteModulePaths or removing it to avoid dead code and confusion about which module path sources are honored.
  • The logic that iterates over demo Rollup configs and builds them one-by-one is duplicated in buildCombinedBundle and buildDemoBundle; consider extracting this into a shared helper to keep behavior consistent and reduce future drift.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `getPluginsConfig`, `allModulePaths` is now completely unused; consider either wiring it into `nodeResolve` alongside `absoluteModulePaths` or removing it to avoid dead code and confusion about which module path sources are honored.
- The logic that iterates over demo Rollup configs and builds them one-by-one is duplicated in `buildCombinedBundle` and `buildDemoBundle`; consider extracting this into a shared helper to keep behavior consistent and reduce future drift.

## Individual Comments

### Comment 1
<location path="src/scripts/build/configUtils.js" line_range="36-43" />
<code_context>
+  // when the importer's auto-walkup chain doesn't reach the hoist root
+  // (e.g. CLI invoked from a sibling repo, symlinked workspaces).
+  const cwd = process.cwd();
+  const absoluteModulePaths = MODULE_DIRS.map((dir) => resolve(cwd, dir));
+
   return [
     nodeResolve({
       dedupe,
       preferBuiltins: false,
       moduleDirectories: DEFAULTS.moduleDirectories,
+      modulePaths: absoluteModulePaths,
     }),
     commonjs(),
</code_context>
<issue_to_address>
**issue (bug_risk):** User-provided module paths and DEFAULTS.modulePaths appear to be ignored by nodeResolve now.

`allModulePaths = [...DEFAULTS.modulePaths, ...modulePaths]` is still computed but unused, and `nodeResolve` now only receives `absoluteModulePaths` from `MODULE_DIRS`. As a result, any `modulePaths` passed into `getPluginsConfig` (and possibly `DEFAULTS.modulePaths`) are ignored. If the goal is to add absolute fallbacks rather than change behavior, please ensure these paths are included, e.g. by merging them into `modulePaths: [...absoluteModulePaths, ...allModulePaths]` (with deduping as needed) or folding `allModulePaths` into `absoluteModulePaths`.
</issue_to_address>

### Comment 2
<location path="src/scripts/build/configUtils.js" line_range="136-144" />
<code_context>
+      // Rollup silently externalize it — a bare specifier in a demo .min.js
+      // breaks at runtime in the browser. Most common cause: a workspace
+      // dep wasn't built yet (fix the build order, e.g. turbo `^build`).
+      onwarn(warning, defaultHandler) {
+        if (warning.code === "UNRESOLVED_IMPORT") {
+          throw new Error(
+            `Unresolved import "${warning.exporter ?? warning.source}" in ${warning.id ?? file}. ` +
+              "Make sure workspace dependencies are built before bundling demos.",
+          );
+        }
+        defaultHandler(warning);
+      },
+      watch: watcher,
</code_context>
<issue_to_address>
**suggestion:** Consider preserving the original Rollup warning message in the thrown error for better diagnostics.

The thrown `Error` currently only includes `warning.exporter ?? warning.source` and `warning.id ?? file`, but not `warning.message`. This reduces the diagnostic detail Rollup provides (e.g., exact specifier and search paths) and can make UNRESOLVED_IMPORT issues harder to debug. Consider including `warning.message` in the error (or serializing the full `warning` via `JSON.stringify`) so consumers have the full context while still failing the build.

```suggestion
      onwarn(warning, defaultHandler) {
        if (warning.code === "UNRESOLVED_IMPORT") {
          throw new Error(
            `Unresolved import "${warning.exporter ?? warning.source}" in ${warning.id ?? file}. ` +
              "Make sure workspace dependencies are built before bundling demos. " +
              `(Rollup: ${warning.message})`,
          );
        }
        defaultHandler(warning);
      },
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/scripts/build/configUtils.js
Comment thread src/scripts/build/configUtils.js
@jason-capsule42
jason-capsule42 merged commit 40a82d7 into main May 11, 2026
14 checks passed
@jason-capsule42
jason-capsule42 deleted the rc/291 branch May 11, 2026 16:26
@jason-capsule42

Copy link
Copy Markdown
Member

🎉 This PR is included in version 3.7.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jason-capsule42 jason-capsule42 added the released Completed work has been released label May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Completed work has been released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants