Skip to content

RFC#1234 & RFC#1247: Drop the computed exports with EMBER_DROP_CLASSIC_FEATURES - #21744

Draft
NullVoxPopuli-ai-agent wants to merge 3 commits into
emberjs:mainfrom
NullVoxPopuli-ai-agent:nvp/drop-computed
Draft

NullVoxPopuli-ai-agent wants to merge 3 commits into
emberjs:mainfrom
NullVoxPopuli-ai-agent:nvp/drop-computed

Conversation

@NullVoxPopuli-ai-agent

@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Merge #21726 and #21740 first. This PR sits on top of both. Review only the last commit, 2898b872d1.

With EMBER_DROP_CLASSIC_FEATURES=true, the rest of the computed property API exports undefined. #21740 already does this for the 15 macros of deprecate-computed-macros.

export const computed = (
  import.meta.env?.EMBER_DROP_CLASSIC_FEATURES ? undefined : internalComputed
) as typeof internalComputed;

Behind the flag

Module Exports
@ember/object computed
@ember/object/compat dependentKeyCompat
@ember/object/computed the default export (ComputedProperty), expandProperties
@ember/object/computed empty, notEmpty, none
@ember/object/computed sum, max, min, map, mapBy, filter, filterBy, uniq, uniqBy, union, intersect, setDiff, collect, sort
  • A cast keeps the published types without | undefined.
  • A type alias keeps the type half of the default export, so import ComputedProperty still gives the class type.
  • Ember code keeps the implementation. Internal code already imported computed from @ember/-internals/metal.
  • dependentKeyCompat moves to the private @ember/object/lib/dependent-key-compat.ts, which Route and RouterService import. The file is in the rollup ignore list, so it goes into a shared chunk and does not become a module path. pnpm build does not change package.json.

Not behind the flag

Export Why
defineProperty, notifyPropertyChange from @ember/object They work with any property, not only computed properties
cacheFor from @ember/object/internals Same as above
observer, addObserver, removeObserver Observers are a separate classic feature
get, set, getProperties, setProperties Same as above

Tests

Change Why
107 tests get testUnless(import.meta.env?.EMBER_DROP_CLASSIC_FEATURES), and 35 tests with a testUnless get the flag in their condition They use computed, the macros or dependentKeyCompat
reduce_computed_macros_test.js registers its modules only without the flag All of them test array macros. The file was already under one if
each-test.js: the module "with array proxies, arrangedContent depends on external content" registers only without the flag Its arrangedContent is computed. The tests come from a shared base class, so they cannot skip one by one
hash-test.gjs: "works with computeds" uses test.skip with the flag It is a plain QUnit test
The shared array test helpers (runtime/tests/helpers/array.js) use the internal computed They use it at module scope. Without this, the flag test page does not load
drop_classic_features_test.js checks that the new exports are undefined Registers only with the flag
New ember/tests/without-EMBER_DROP_CLASSIC_FEATURES/computed_test.js Checks computed, ComputedProperty, dependentKeyCompat, expandProperties, empty and sum in builds without the flag

Checks

Mode Result
Default 9240 tests, 0 failures
ALL_DEPRECATIONS_ENABLED=true 9240 tests, 0 failures
OVERRIDE_DEPRECATION_VERSION=15.0.0 8263 tests, 0 failures
Production build 9077 tests, 0 failures
EMBER_DROP_CLASSIC_FEATURES=true 9087 tests, 0 failures

The flag mode has fewer tests, because the array macro modules and one {{#each}} module do not register with the flag.

The type checks of the internals and of the published types (with and without stable decorators), eslint, prettier and the docs check pass.

🤖 Generated with Claude Code

NullVoxPopuli and others added 3 commits October 17, 2026 16:06
`import.meta.env?.EMBER_DROP_CLASSIC_FEATURES` is a build-time flag for
RFC 1247. Later changes read it where a classic feature is defined, and
remove that feature from builds that set the flag.

- `ImportMetaEnv` declares the flag for the type checks.
- `EMBER_DROP_` is in the Vite `envPrefix`, so
  `EMBER_DROP_CLASSIC_FEATURES=true pnpm vite build` sets it for the tests.
- CI has a "Classic features dropped" variant that builds and tests with
  the flag.
- The hello-world smoke test sets the flag with a Vite `define` entry, so
  the package-size workflow measures an app without the classic features.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the flag, `@ember/object/computed` exports `undefined` for the 15
macros of the `deprecate-computed-macros` deprecation: `alias`, `and`,
`bool`, `deprecatingAlias`, `equal`, `gt`, `gte`, `lt`, `lte`, `match`,
`not`, `oneWay`, `or`, `readOnly` and `reads`. A cast keeps the published
types.

Tests of these macros skip with the flag, as they skip when the
deprecation is removed. A new test checks that the exports are `undefined`
in a build with the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the flag, the rest of the computed property API exports `undefined`:

- `computed` from `@ember/object`
- `dependentKeyCompat` from `@ember/object/compat`
- from `@ember/object/computed`: the default export (`ComputedProperty`),
  `expandProperties`, `empty`, `notEmpty`, `none`, and the array macros
  `sum`, `max`, `min`, `map`, `mapBy`, `filter`, `filterBy`, `uniq`,
  `uniqBy`, `union`, `intersect`, `setDiff`, `collect` and `sort`

A cast keeps the published types, and a type alias keeps the type half of
the default export.

Ember code keeps the implementation. The code of `dependentKeyCompat` moves
to the private `@ember/object/lib/dependent-key-compat.ts`, which `Route`
and `RouterService` import. Rollup bundles that file into a shared chunk,
so it does not become a module path.

Tests:
- Tests that use these APIs skip with the flag. The array macro tests and
  one `{{#each}}` module with a computed `arrangedContent` register only
  without the flag.
- The shared array test helpers use the internal `computed`, because the
  flag test page must load.
- The flag-only module checks that the exports are `undefined`.
- `packages/ember/tests/without-EMBER_DROP_CLASSIC_FEATURES/computed_test.js`
  checks the API in builds without the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants