data
data copied to clipboard
🛤️ tracking: EmberData Embroider Support
Embroider Support
While not originally in scope of 🌲 Project Trim (as embroider was but a twinkling in our eye when it began), to consider Project Trim (#6166) complete we should:
- be able to be included in an embroider app without any custom build adapters
- have embroider support and embroider+fastboot tests that catch regressions.
We intend to have this work complete before 5.0, and will add it to the 5.0 roadmap in #8086
Prior Art
- importSync https://github.com/emberjs/data/pull/7849
- resolves https://github.com/emberjs/data/issues/6051
- macros for macros https://discord.com/channels/480462759797063690/485447409296736276/1000513348145782904
The steps to complete this are:
Stage 1
- [x] move all non-package code (tests, scripts etc.) out of published packages
- [x] convert to pnpm
- [x] replace ember-fetch dynamic require with Fastboot.require / importSync (see note 1)
- [x] deprecation flags converted to macros (see note 2)
- [x] feature flags converted to macros (see note 2)
- [x] log instrumentation converted to macros
- [x] package presence checks converted to macros (see note 1)
- [x]
DEBUG
guards converted to macros - [x] convert
@ember-data/debug
(HAS_DEBUG_PACKAGE) package presence check to macros - [x]
@ember-data/store/-debug
filtering converted to macros (see note 2) - [x] add embroider test scenarios (legacy-compat)
Stage 2
- [ ] packages/-ember-data converted to v1-lite (see note 3)
- [x] packages/private-build-infra converted to v1-lite
- [x] packages/canary-features converted to v1-lite
- [x] packages/serializer converted to v1-lite
- [x] packages/adapter converted to v1-lite
- [x] packages/record-data converted to v1-lite
- [x] packages/model converted to v1-lite
- [x] packages/store converted to v1-lite
- [ ] packages/debug converted to v1-lite (see note 4)
Stage 3
- [ ] fix ember-auto-import to not include assets twice https://github.com/ef4/ember-auto-import/pull/512
- [ ] fix embroider to allow RFC'd config hooks https://github.com/embroider-build/embroider/issues/1303
- [ ] convert v1-prebuilt addons to v2-addons
- [ ] add embroider test scenario (full-compat)
- [-] ~add embroider+fastboot test scenario~ see #8475
- [x] remove embroider adapters for ember-data
notes: [1]
importSync
is unable to distinguish currently the presence of a package due to it being from the same monorepo vs it actually being in the dep tree. We may require converting to pnpm to resolve this issue (non-trivial, see #8087). It may also take doing some work to the macro to make it understand this situation.[2]
- we want to keep the DX of importing the boolean flags
- we want to keep the ability for runtime configuration of feature flags for canary only
- we want to keep the ability for consumers to configure their deprecation compatibility at build time
- we want to continue not exposing anything not exported from the index file of -private directories
[3] V2 Addons don't trigger consuming addon/app rebuilds currently. This is something the ergo will need to be improved for. Turborepo/vite may be options. Improving DX directly in embroider may be necesssary.
[4] The debug package has unique build-time requirements that may be tricky to convert to embroider.
@richgt has offered to take on this effort.
landed conversion to pnpm which was blocking this effort
Config behavior:
- https://api.emberjs.com/ember-data/release/modules/@ember-data%2Fdebug
when using macros:
// ember-cli-build.js let app = new EmberApp(defaults, { '@embroider/macros': { setConfig: { '@ember-data/debug': { includeDataAdapterInProduction: false }, }, }, });
- https://api.emberjs.com/ember-data/release/classes/DebugLogging
- https://api.emberjs.com/ember-data/release/modules/@ember-data%2Fdeprecations
- https://api.emberjs.com/ember-data/release/modules/ember-data-overview?show=inherited#randomuuid-polyfill
Macros demo: https://github.com/NullVoxPopuli/embroider-macros-demo
The ideas in this spike may allow us to finish the v2 conversion #9292 and close out this ticket
closing as we will be landing #9292