Skip to content

Commit 1f71ded

Browse files
NullVoxPopuliclaude
andcommitted
Tighten sideEffects list; remove refactor-context comments
Two pieces of polish from the user's review: 1. The `sideEffects` field in package.json was over-broad — listing whole directories (`**/manager/**`, `**/validator/**`, etc.) when only a handful of files in those trees actually have top-level side effects. Replaced the directory globs with the explicit list of files that contain top-level calls (registrations, opcode `APPEND_OPCODES.add(...)`, `setGlobalContext`, `_backburner.on`, etc.). Hello-world stays at 134.12 KB / 42.92 KB. 2. Removed comments in the refactored files that explained the refactor itself ("extracted from X for tree-shaking", "kept separate so Y", "back-compat re-export"). That kind of context belongs in the PR description and commit messages, not the source tree. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent a0b1f09 commit 1f71ded

19 files changed

Lines changed: 26 additions & 156 deletions

File tree

package.json

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,29 @@
1818
},
1919
"sideEffects": [
2020
"./dist/dev/**",
21-
"**/setup-registry*",
22-
"**/register-routing-keywords*",
23-
"**/register-curly-component*",
24-
"**/debug-render-tree-register*",
25-
"**/-internals/glimmer/lib/environment*",
26-
"**/runtime/lib/environment*",
27-
"**/-internals/runtime/lib/ext/rsvp*",
28-
"**/runtime/lib/component/template-only*",
29-
"**/runtime/lib/vm/low-level*",
30-
"**/runtime/lib/compiled/opcodes/**",
31-
"**/runtime/lib/helpers/**",
32-
"**/runtime/lib/modifiers/**",
33-
"**/-internals/glimmer/lib/components/**",
34-
"**/-internals/views/lib/system/event_dispatcher*",
35-
"**/runloop/index*",
36-
"**/runloop/-private/**",
37-
"**/manager/**",
38-
"**/validator/**",
39-
"**/global-context/**",
40-
"**/destroyable/**",
41-
"**/canary-features/**",
42-
"**/-internals/environment/**"
21+
"**/@ember/-internals/glimmer/lib/setup-registry.js",
22+
"**/@ember/-internals/glimmer/lib/register-curly-component.js",
23+
"**/@ember/-internals/glimmer/lib/syntax/register-routing-keywords.js",
24+
"**/@ember/-internals/glimmer/lib/environment.js",
25+
"**/@ember/-internals/glimmer/lib/renderer.js",
26+
"**/@ember/-internals/glimmer/lib/helper.js",
27+
"**/@ember/-internals/glimmer/lib/helpers/element.js",
28+
"**/@ember/-internals/glimmer/lib/components/input.js",
29+
"**/@ember/-internals/glimmer/lib/components/textarea.js",
30+
"**/@ember/-internals/glimmer/lib/components/link-to.js",
31+
"**/@ember/-internals/runtime/lib/ext/rsvp.js",
32+
"**/@glimmer/runtime/lib/debug-render-tree-register.js",
33+
"**/@glimmer/runtime/lib/component/template-only.js",
34+
"**/@glimmer/runtime/lib/compiled/opcodes/expressions.js",
35+
"**/@glimmer/runtime/lib/compiled/opcodes/vm.js",
36+
"**/@glimmer/runtime/lib/compiled/opcodes/debugger.js",
37+
"**/@glimmer/runtime/lib/compiled/opcodes/content.js",
38+
"**/@glimmer/runtime/lib/compiled/opcodes/component.js",
39+
"**/@glimmer/runtime/lib/compiled/opcodes/dom.js",
40+
"**/@glimmer/runtime/lib/compiled/opcodes/lists.js",
41+
"**/@glimmer/runtime/lib/vm/low-level.js",
42+
"**/@glimmer/validator/index.js",
43+
"**/@glimmer/validator/lib/validators.js"
4344
],
4445
"homepage": "https://emberjs.com/",
4546
"bugs": {

packages/@ember/-internals/glimmer/lib/component-managers/curly-symbols.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// Symbols and the cheap brand-based `isCurlyManager` predicate, kept in
2-
// their own module so consumers (e.g. the resolver) can identify the
3-
// curly component manager without statically pulling in the full
4-
// `./curly` module — that file carries the entire classic component
5-
// lifecycle plus its transitive deps (~17 KB raw plus the @ember/object
6-
// graph). With this split, `renderComponent`-only bundles never load
7-
// `./curly` at all.
8-
91
export const DIRTY_TAG: unique symbol = Symbol('DIRTY_TAG');
102
export const IS_DISPATCHING_ATTRS: unique symbol = Symbol('IS_DISPATCHING_ATTRS');
113
export const BOUNDS: unique symbol = Symbol('BOUNDS');

packages/@ember/-internals/glimmer/lib/component-managers/curly.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ export function getComponentCapturedArgs(
7070
return COMPONENT_ARGS_MAP.get(component);
7171
}
7272

73-
// Re-exported from `./curly-symbols` to keep import sites unchanged.
74-
// The actual symbols live there so consumers that only need the symbols
75-
// (e.g. the renderer's resolver, classic-renderer's `getBounds`) don't
76-
// have to load the full curly component manager.
7773
export { BOUNDS, DIRTY_TAG, IS_DISPATCHING_ATTRS } from './curly-symbols';
7874

7975
const EMBER_VIEW_REF = createPrimitiveRef('ember-view');
@@ -565,7 +561,4 @@ const CURLY_CAPABILITIES: InternalComponentCapabilities = {
565561
export const CURLY_COMPONENT_MANAGER = new CurlyComponentManager();
566562
(CURLY_COMPONENT_MANAGER as unknown as Record<symbol, boolean>)[CURLY_COMPONENT_BRAND] = true;
567563

568-
// Re-exported for back-compat — `isCurlyManager` and the symbols now live
569-
// in `./curly-symbols` so that consumers who only need the brand check
570-
// don't pull in the rest of this module.
571564
export { CURLY_COMPONENT_BRAND, isCurlyManager } from './curly-symbols';

packages/@ember/-internals/glimmer/lib/component.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,13 +1680,4 @@ class Component<S = unknown>
16801680
}
16811681
}
16821682

1683-
// `Component.reopenClass({ positionalParams: [] })` and the curly component
1684-
// manager registration that used to live here now happen in
1685-
// `./register-curly-component`, imported as a side effect by classic-app
1686-
// setup (`./setup-registry`). Splitting the side effect out lets bundlers
1687-
// tree-shake the classic `Component` class out of bundles that don't
1688-
// otherwise need it — e.g. the hello-world app that only uses
1689-
// `setComponentManager` / `capabilities` from `@ember/component` via
1690-
// `@glimmer/component`.
1691-
16921683
export default Component;

packages/@ember/-internals/glimmer/lib/register-curly-component.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
// Side-effect-only file. Registers the classic curly component manager
2-
// for `Component` and seeds `positionalParams` on the base class.
3-
//
4-
// Kept separate from `./component` so that file's top-level evaluation
5-
// has no side effects — bundlers can then tree-shake the classic
6-
// `Component` class out of any bundle that doesn't otherwise need it
7-
// (e.g. the hello-world that only pulls `setComponentManager` /
8-
// `capabilities` from `@ember/component` via `@glimmer/component`).
9-
//
10-
// Classic apps opt back in to the registration via `./setup-registry`,
11-
// which imports this module for its side effect.
12-
131
import { setInternalComponentManager } from '@glimmer/manager/lib/internal/api';
142

153
import Component from './component';

packages/@ember/-internals/glimmer/lib/renderer.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ import ResolverImpl from './resolver';
3434

3535
export type IBuilder = (env: Environment, cursor: Cursor) => TreeBuilder;
3636

37-
/**
38-
* Common shape of root states tracked by `RendererState`. Both
39-
* `ComponentRootState` (defined here) and `ClassicRootState` (defined in
40-
* `./classic-renderer`) implement this so the renderer state can manage
41-
* either kind without statically depending on classic-only code.
42-
*/
4337
export interface RootState {
4438
readonly type: 'classic' | 'component';
4539
readonly destroyed: boolean;
@@ -670,7 +664,4 @@ export class BaseRenderer {
670664
}
671665
}
672666

673-
// Re-export classic-only types so existing import sites that did
674-
// `import { Renderer, DynamicScope, View } from '.../renderer'` keep working.
675-
// New code should import these directly from `./classic-renderer`.
676667
export type { DynamicScope, Renderer, View } from './classic-renderer';

packages/@ember/-internals/glimmer/lib/resolver.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ const BUILTIN_KEYWORD_HELPERS: Record<string, object> = {
9696
'-in-el-null': inElementNullCheckHelper,
9797
};
9898

99-
/**
100-
* Register an additional built-in keyword helper (e.g. `{{outlet}}`,
101-
* `{{mount}}`). Kept separate so the renderer doesn't statically depend on
102-
* routing/engine infrastructure — callers that need those helpers must opt
103-
* in by importing the registration module (`./syntax/register-routing-keywords`).
104-
*/
10599
export function registerBuiltInKeywordHelper(name: string, helper: object): void {
106100
BUILTIN_KEYWORD_HELPERS[name] = helper;
107101
BUILTIN_HELPERS[name] = helper;

packages/@ember/-internals/glimmer/lib/setup-registry.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@ import { Renderer } from './classic-renderer';
1010
import OutletTemplate from './templates/outlet';
1111
import RootTemplate from './templates/root';
1212
import OutletView from './views/outlet';
13-
// Side-effect imports. Each keeps classic-only infrastructure off the
14-
// `renderComponent`-only path:
15-
//
16-
// - `register-routing-keywords` registers `-mount` and `-outlet` as
17-
// built-in keyword helpers (pulls in routing/engine).
18-
// - `@glimmer/runtime/.../debug-render-tree-register` registers the
19-
// `DebugRenderTreeImpl` factory so `delegate.enableDebugTooling: true`
20-
// actually produces a render tree (used by Ember Inspector). Without
21-
// this import, `env.debugRenderTree` stays `undefined`.
22-
// - `register-curly-component` registers the classic component manager
23-
// for the `Component` base class and seeds `positionalParams`. Without
24-
// this import the classic `Component` class is dead code as far as
25-
// `setComponentManager`/`capabilities` consumers are concerned.
2613
import './syntax/register-routing-keywords';
2714
import '@glimmer/runtime/lib/debug-render-tree-register';
2815
import './register-curly-component';

packages/@ember/-internals/glimmer/lib/utils/to-bool.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ import { isEmberArray } from '@ember/array/-internals';
55
import { isProxy } from '@ember/-internals/utils/lib/is_proxy';
66
import { consumeTag } from '@glimmer/validator/lib/tracking';
77

8-
// Lightweight array predicate — covers native arrays plus anything branded
9-
// via `setEmberArray` (which is what `EmberArray.init` does, so any
10-
// instance of an EmberArray-mixed class is branded). Avoids the full
11-
// `@ember/array/index` graph (Mixin, Enumerable, Observable, computed)
12-
// just to test array-ness for `{{#if}}`.
138
function isArrayLike(obj: unknown): obj is ArrayLike<unknown> {
149
return Array.isArray(obj) || isEmberArray(obj);
1510
}

packages/@ember/-internals/meta/lib/meta.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,6 @@ export class Meta {
267267
return undefined;
268268
}
269269

270-
// The mixin-tracking helpers (`addMixin` / `hasMixin` / `forEachMixins`)
271-
// moved to `@ember/object/mixin` as standalone functions
272-
// (`metaAddMixin` / `metaHasMixin` / `metaForEachMixins`). They poke
273-
// directly at the public `_mixins` / `parent` fields here. Splitting
274-
// them out keeps the `Meta` class — which is reachable from the
275-
// renderer via the property accessor + tag chain — free of references
276-
// to the classic `Mixin` machinery, so bundles that don't actually use
277-
// mixins can tree-shake `@ember/object/mixin` away.
278-
279270
/** @internal */
280271
writeDescriptors(subkey: string, value: any) {
281272
assert(

0 commit comments

Comments
 (0)