Skip to content

Incorporate asset-map service/helper duo adapter - #716

Open
phndiaye wants to merge 10 commits into
masterfrom
pn/asset-map-service-adapter
Open

phndiaye wants to merge 10 commits into
masterfrom
pn/asset-map-service-adapter

Conversation

@phndiaye

@phndiaye phndiaye commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

In order to deprecate ember-cli-ifa, which does too many things at build-time while being an addon (which doesn't fit very well w/ migration to Vite), this PR introduces a:

  • an asset-map service/helper duo
  • a build-time function allowing consumer apps to intentionally opt-in to the behaviour ember-cli-ifa brought

ember-cli-ifa was used to make our lives easier when using assets with dynamically built paths (e.g: @upfluence/oss-components/assets/${someVariable}.svg).

We use the exact same helper/service names as exported by ember-cli-ifa (asset-map) so we have drop-in replacement inside our runtime code, and we just have to update the apps' ember-cli-build.js file.

What are the observable changes?

Warning

This is a transition tooling
In an ideal and modern world, we would just do import mySvgFile from './my-svg-file.svg and > use it in components.
And in case of dynamic asset, we would import them all, then in the code handle the conditions to return the right ones, opening the door for tree-shaking to avoid publishing unused assets to consumers.

Until we reach that stage, this PR unlocks some improvements while allowing to work as usual.

Good PR checklist

  • Title makes sense
  • Is against the correct branch
  • Only addresses one issue
  • Properly assigned
  • Added/updated tests
  • Added/updated documentation with Figma design link. Don't forget to replace "design" by "file" in the URL. For example https://www.figma.com/file/example
  • Migrated touched components to Glimmer Components
  • Properly labeled

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This has been spotted by a Vite migration attempt. The addon files don't export faIconStyle, same for fa-icon-value and redirect-to helpers.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Node compatibility, SSR initialization, and the documented consumer migration path remain unresolved.

3 open findings
What changed in this PR

Introduces an ember-cli-ifa replacement that injects asset manifests at build time and resolves assets through an Ember service/helper.

Changes:

  • Adds asset-map build injection and runtime resolution.
  • Adds unit, integration, and build tests.
  • Removes ember-cli-ifa and updates CI/dependencies.
File Description
.github/​workflows/​ci.yml Runs asset-map build tests.
addon/​helpers/​asset-map.ts Adds the asset-map helper.
addon/​services/​asset-map.ts Adds manifest validation and URL resolution.
app/​helpers/​asset-map.js Exposes the helper to consumers.
app/​helpers/​fa-icon-style.js Removes obsolete named export.
app/​helpers/​fa-icon-value.js Removes obsolete named export.
app/​helpers/​redirect-to.js Removes obsolete named export.
app/​services/​asset-map.js Exposes the service to consumers.
build/​classic-asset-map.cjs Implements build-time manifest injection.
ember-cli-build.js Enables the adapter in the dummy app.
package.json Updates dependencies and test scripts.
pnpm-lock.yaml Locks dependency changes.
tests/​build/​asset-map-test.cjs Tests build-time behavior and failures.
tests/​dummy/​app/​index.html Adds the manifest placeholder.
tests/​index.html Adds the test manifest placeholder.
tests/​integration/​helpers/​asset-map-test.ts Tests helper behavior and reactivity.
tests/​unit/​services/​asset-map-test.ts Tests service validation and resolution.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread addon/services/asset-map.ts
Comment thread build/classic-asset-map.cjs
Comment thread build/classic-asset-map.cjs
Co-authored-by: phndiaye <4022350+phndiaye@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The resolver can bypass valid fingerprint mappings when logical paths overlap the configured base path.

1 open finding
2 resolved since last review
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Previously missed (1)

In code that hasn't changed since last review

Medium severity Leading-slash paths bypass fingerprint manifest mappings

addon/​services/​asset-map.ts:53

This shortcut skips a valid fingerprint mapping when a logical path overlaps the consumer's base path. With rootURL: '/assets/' and assets/logo.svg → assets/logo-123.svg, resolving /assets/logo.svg returns the unhashed input, while assets/logo.svg resolves to /assets/assets/logo-123.svg. This breaks leading-slash normalization and can request a file removed by fingerprinting. Only apply this shortcut when the normalized name is not a manifest key, and add a regression test for this overlap.

🧠 Review effort: Balanced

@linear-code

linear-code Bot commented Oct 23, 2026

Copy link
Copy Markdown

VEL-8567

@JulienVannier66 JulienVannier66 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@import (inline) '@fortawesome/fontawesome-pro/css/all.min.css';
@import (inline) '@fortawesome/fontawesome-pro/css/duotone-regular.min.css';
@import (inline) '@fortawesome/fontawesome-pro/css/v4-shims.min.css';
@import (inline) '@fortawesome/fontawesome-pro/css/duotone-regular.min.css';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not used at all?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks like a duplicate from line 4

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants