language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
emberjs
ember.js
f2be19507f0742a9471fa4fe0ce22ccf3104967d.json
Add v3.25.0-beta.3 to CHANGELOG (cherry picked from commit 25e17f0ea31c01239fc8b4fd8bdb52f003f2dea0)
CHANGELOG.md
@@ -1,6 +1,10 @@ # Ember Changelog -### v3.25.0-beta.2 (January 19, 2020) +### v3.25.0-beta.3 (January 25, 2021) + +- [#19351](https://github.com/emberjs/ember.js/pull/19351) [BUGFIX] Ensure locals do not clobber components of the same name + +### v3.25.0-beta.2 (January 19, 2021) - [#19339](https://github.com/emberjs/ember.js/pull/19339) [DEPRECATION] Deprecate importing `htmlSafe` and `isHTMLSafe` from `@ember/string` per the [Deprecate Ember String RFC](https://github.com/emberjs/rfcs/blob/master/text/0236-deprecation-ember-string.md). - [#19336](https://github.com/emberjs/ember.js/pull/19336) [BUGFIX] Ensure Component Lookup Is Well Formed
false
Other
emberjs
ember.js
ce0b37a81fb7eb0b4f43f8728a8ea4288ff5be57.json
Add v3.25.0-beta.2 to CHANGELOG (cherry picked from commit 761580686c2c2b6e812f5fc0893c305bcf9b95d2)
CHANGELOG.md
@@ -1,5 +1,13 @@ # Ember Changelog +### v3.25.0-beta.2 (January 19, 2020) + +- [#19339](https://github.com/emberjs/ember.js/pull/19339) [DEPRECATION] Deprecate importing `htmlSafe` and `isHTMLSafe` from `@ember/string` per the [Deprecate Ember String RFC](https://github.com/emberjs/rfcs/blob/master/text/0236-deprecation-ember-string.md). +- [#19336](https://github.com/emberjs/ember.js/pull/19336) [BUGFIX] Ensure Component Lookup Is Well Formed +- [#19337](https://github.com/emberjs/ember.js/pull/19337) [BUGFIX] Ensure query param only <LinkTo /> are properly scoped in engines. +- [#19338](https://github.com/emberjs/ember.js/pull/19338) [BUGFIX] Add missing `deprecate` options (`for` + `since`) +- [#19342](https://github.com/emberjs/ember.js/pull/19342) [BUGFIX] Fix misleading LinkTo error message + ### v3.25.0-beta.1 (December 28, 2020) - [#19302](https://github.com/emberjs/ember.js/pull/19302) / [#19306](https://github.com/emberjs/ember.js/pull/19306) / [#19319](https://github.com/emberjs/ember.js/pull/19319) [FEATURE] Implement the [Handlebars Strict Mode RFC](https://github.com/emberjs/rfcs/blob/master/text/0496-handlebars-strict-mode.md).
false
Other
emberjs
ember.js
b18f67eb526108f328df624f1f8c51994ef556d3.json
Add v3.24.1 to CHANGELOG.md.
CHANGELOG.md
@@ -7,6 +7,10 @@ - [#18148](https://github.com/emberjs/ember.js/pull/18148) [BUGFIX] Fix empty `htmlSafe` string to be treated as falsy - [#19320](https://github.com/emberjs/ember.js/pull/19320) / [#19317](https://github.com/emberjs/ember.js/pull/19317) / [#19297](https://github.com/emberjs/ember.js/pull/19297) / [#19293](https://github.com/emberjs/ember.js/pull/19293) / [#19278](https://github.com/emberjs/ember.js/pull/19278) / [#19275](https://github.com/emberjs/ember.js/pull/19275) Update rendering engine to `@glimmer/*` 0.73.1 for various features and bugfixes including ensuring `{{component.name}}` works with implicit this fallback +### v3.24.1 (January 14, 2021) + +- [#19337](https://github.com/emberjs/ember.js/pull/19337) [BUGFIX] Ensure query param only `<LinkTo />` are properly scoped in engines + ### v3.24.0 (December 28, 2020) - [#19224](https://github.com/emberjs/ember.js/pull/19224) [FEATURE] Add `{{page-title}}` helper to route template blueprints to implement [RFC #0654](https://github.com/emberjs/rfcs/blob/master/text/0645-add-ember-page-title-addon.md).
false
Other
emberjs
ember.js
2bb644532d407d4b4700a81f510c5aed4caf5d84.json
Add v3.25.0-beta.1 to CHANGELOG (cherry picked from commit 54830f5c35364a3001d469e9bf741725342d9f3d)
CHANGELOG.md
@@ -1,5 +1,12 @@ # Ember Changelog +### v3.25.0-beta.1 (December 28, 2020) + +- [#19302](https://github.com/emberjs/ember.js/pull/19302) / [#19306](https://github.com/emberjs/ember.js/pull/19306) / [#19319](https://github.com/emberjs/ember.js/pull/19319) [FEATURE] Implement the [Handlebars Strict Mode RFC](https://github.com/emberjs/rfcs/blob/master/text/0496-handlebars-strict-mode.md). +- [#19318](https://github.com/emberjs/ember.js/pull/19318) [FEATURE] Implement the [Named Blocks RFC](https://github.com/emberjs/rfcs/blob/master/text/0460-yieldable-named-blocks.md). +- [#18148](https://github.com/emberjs/ember.js/pull/18148) [BUGFIX] Fix empty `htmlSafe` string to be treated as falsy +- [#19320](https://github.com/emberjs/ember.js/pull/19320) / [#19317](https://github.com/emberjs/ember.js/pull/19317) / [#19297](https://github.com/emberjs/ember.js/pull/19297) / [#19293](https://github.com/emberjs/ember.js/pull/19293) / [#19278](https://github.com/emberjs/ember.js/pull/19278) / [#19275](https://github.com/emberjs/ember.js/pull/19275) Update rendering engine to `@glimmer/*` 0.73.1 for various features and bugfixes including ensuring `{{component.name}}` works with implicit this fallback + ### v3.24.0 (December 28, 2020) - [#19224](https://github.com/emberjs/ember.js/pull/19224) [FEATURE] Add `{{page-title}}` helper to route template blueprints to implement [RFC #0654](https://github.com/emberjs/rfcs/blob/master/text/0645-add-ember-page-title-addon.md).
false
Other
emberjs
ember.js
df3c7a65d14822155c9876f50849fa123edc1219.json
Add v3.24.0 to CHANGELOG (cherry picked from commit 5f70d5518b3a8b9107abfaf38408c0c51e7f998d)
CHANGELOG.md
@@ -1,14 +1,6 @@ # Ember Changelog -### v3.24.0-beta.3 (December 21, 2020) - -- [#19280](https://github.com/emberjs/ember.js/pull/19280) [BUGFIX] Ensure aliases cause recompute of a computed property when used with `@each` in the dependent keys of that property - -### v3.24.0-beta.2 (November 24, 2020) - -- [#19282](https://github.com/emberjs/ember.js/pull/19282) [BUGFIX] Issue deprecations (instead of assertions) for tracked mutation in constructor during rendering - -### v3.24.0-beta.1 (November 16, 2020) +### v3.24.0 (December 28, 2020) - [#19224](https://github.com/emberjs/ember.js/pull/19224) [FEATURE] Add `{{page-title}}` helper to route template blueprints to implement [RFC #0654](https://github.com/emberjs/rfcs/blob/master/text/0645-add-ember-page-title-addon.md). - [#19133](https://github.com/emberjs/ember.js/pull/19133) [FEATURE / DEPRECATION] Add new options to `deprecate()` for `for` and `since` and deprecate using `deprecate()` without those options per the [Deprecation Staging RFC](https://github.com/emberjs/rfcs/blob/master/text/0649-deprecation-staging.md). @@ -18,6 +10,7 @@ - [#19080](https://github.com/emberjs/ember.js/pull/19080) [BUGFIX] Lazily setup the router in non-application tests - [#19253](https://github.com/emberjs/ember.js/pull/19253) [BUGFIX] Correct return of getComponentTemplate from null to undefined to align with original RFC (#481) - [#19223](https://github.com/emberjs/ember.js/pull/19223) [BUGFIX] `<LinkTo>` should link within the engine when used inside one +- [#19280](https://github.com/emberjs/ember.js/pull/19280) [BUGFIX] Ensure aliases cause recompute of a computed property when used with `@each` in the dependent keys of that property - [#19196](https://github.com/emberjs/ember.js/pull/19196) [CLEANUP] Remove EMBER_GLIMMER_IN_ELEMENT feature flag - [#19204](https://github.com/emberjs/ember.js/pull/19204) [CLEANUP] Remove EMBER_CACHE_API feature flag - [#19206](https://github.com/emberjs/ember.js/pull/19206) [CLEANUP] Remove EMBER_ROUTING_MODEL_ARG feature flag
false
Other
emberjs
ember.js
5364bed35d44777a9c671906619f0cda1d5b75cd.json
Add v3.24.0-beta.3 to CHANGELOG (cherry picked from commit f803ecabd09786f6035c13f49695686c78495153)
CHANGELOG.md
@@ -1,5 +1,9 @@ # Ember Changelog +### v3.24.0-beta.3 (December 21, 2020) + +- [#19280](https://github.com/emberjs/ember.js/pull/19280) [BUGFIX] Ensure aliases cause recompute of a computed property when used with `@each` in the dependent keys of that property + ### v3.24.0-beta.2 (November 24, 2020) - [#19282](https://github.com/emberjs/ember.js/pull/19282) [BUGFIX] Issue deprecations (instead of assertions) for tracked mutation in constructor during rendering
false
Other
emberjs
ember.js
6bd1e1025afc3ab944961e868485f557649e5a31.json
Add option to specify a boolean default value
packages/@ember/-internals/routing/lib/ext/controller.ts
@@ -19,7 +19,8 @@ ControllerMixin.reopen({ may cause unexpected behavior if a query parameter is used with `toggleProperty`, because the initial value set for `param=false` will be the string `"false"`, which is truthy. - To avoid this, you may specify that the query parameter should be parsed as a boolean + To avoid this, you may specify a boolean default value for the parameter, or + specify that the query parameter should be parsed as a boolean by using the following verbose form with a `type` property: ```javascript queryParams: [{
false
Other
emberjs
ember.js
f4bd2ef61b00f36e486892a58fa8d219a8eac1fd.json
Remove unnecessary words
packages/@ember/-internals/routing/lib/ext/controller.ts
@@ -15,7 +15,7 @@ ControllerMixin.reopen({ the values of these query parameters to the variables `this.category` and `this.page`. - By default, query parameters are parsed and treated as strings. This + By default, query parameters are parsed as strings. This may cause unexpected behavior if a query parameter is used with `toggleProperty`, because the initial value set for `param=false` will be the string `"false"`, which is truthy.
false
Other
emberjs
ember.js
f7888670d31ad69df2f7fb50947e4c76896c4e89.json
Fix description of issue around toggleProperty The original description was unclear, but implied a totally different problem was at hand.
packages/@ember/-internals/routing/lib/ext/controller.ts
@@ -14,20 +14,23 @@ ControllerMixin.reopen({ If you give the names `['category','page']` it will bind the values of these query parameters to the variables `this.category` and `this.page`. - By default, Ember coerces query parameter values using `toggleProperty`. - This behavior may lead to unexpected results. - Available queryParam types: `boolean`, `number`, `array`. - If query param type not specified, it will be `string`. - To explicitly configure a query parameter property so it coerces as expected, you must define a type property: + By default, query parameters are parsed and treated as strings. This + may cause unexpected behavior if a query parameter is used with `toggleProperty`, + because the initial value set for `param=false` will be the string `"false"`, which is truthy. + + To avoid this, you may explicitly set how a query parameter by using the following verbose + form with a `type` property: ```javascript queryParams: [{ category: { type: 'boolean' } }] ``` - + Available values for the `type` parameter are `boolean`, `number`, `array`, and `string`. + If query param type is not specified, it will default to `string`. + @for Ember.ControllerMixin @property queryParams @public
false
Other
emberjs
ember.js
49d4a4bb396ac9ef3c7ecd8a597a468c12f17322.json
update deprecation target to 3.25
packages/@ember/-internals/routing/lib/utils.ts
@@ -252,7 +252,7 @@ export function deprecateTransitionMethods(frameworkClass: string, methodName: s id: 'routing.transition-methods', for: 'ember-source', since: { - enabled: '3.24.0', + enabled: '3.25.0', }, until: '4.0.0', url: 'https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods',
false
Other
emberjs
ember.js
047ae62ae79963962a5f80a6d0f581bfdd18defe.json
enable Ember.String.loc deprecation
packages/@ember/string/index.ts
@@ -122,7 +122,7 @@ export function loc(str: string, formats: any[]): string { for: 'ember-source', url: 'https://deprecations.emberjs.com/v3.x#toc_ember-string-loc', since: { - available: '3.24', + enabled: '3.24', }, } );
false
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
broccoli/packages.js
@@ -273,6 +273,9 @@ module.exports.glimmerES = function glimmerES(environment) { let glimmerEntries = [ '@glimmer/node', '@simple-dom/document', + '@glimmer/manager', + '@glimmer/destroyable', + '@glimmer/owner', '@glimmer/opcode-compiler', '@glimmer/runtime', ];
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
package.json
@@ -74,16 +74,19 @@ }, "devDependencies": { "@babel/preset-env": "^7.9.5", - "@glimmer/compiler": "0.67.0", + "@glimmer/compiler": "0.68.0", "@glimmer/env": "^0.1.7", - "@glimmer/global-context": "0.67.0", - "@glimmer/interfaces": "0.67.0", - "@glimmer/node": "0.67.0", - "@glimmer/opcode-compiler": "0.67.0", - "@glimmer/program": "0.67.0", - "@glimmer/reference": "0.67.0", - "@glimmer/runtime": "0.67.0", - "@glimmer/validator": "0.67.0", + "@glimmer/global-context": "0.68.0", + "@glimmer/interfaces": "0.68.0", + "@glimmer/manager": "0.68.0", + "@glimmer/destroyable": "0.68.0", + "@glimmer/owner": "0.68.0", + "@glimmer/node": "0.68.0", + "@glimmer/opcode-compiler": "0.68.0", + "@glimmer/program": "0.68.0", + "@glimmer/reference": "0.68.0", + "@glimmer/runtime": "0.68.0", + "@glimmer/validator": "0.68.0", "@simple-dom/document": "^1.4.0", "@types/qunit": "^2.9.1", "@types/rsvp": "^4.0.3",
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/index.ts
@@ -361,7 +361,6 @@ */ export { templateFactory as template, templateCacheCounters } from '@glimmer/opcode-compiler'; -export { setComponentTemplate, getComponentTemplate } from '@glimmer/runtime'; export { default as RootTemplate } from './lib/templates/root'; export { default as Checkbox } from './lib/components/checkbox'; @@ -393,10 +392,8 @@ export { DOMChanges, NodeDOMTreeConstruction, DOMTreeConstruction } from './lib/ // a lot of these are testing how a problem was solved // rather than the problem was solved export { INVOKE } from './lib/helpers/action'; +export { default as on } from './lib/modifiers/on'; export { default as OutletView } from './lib/views/outlet'; export { OutletState } from './lib/utils/outlet'; export { setComponentManager } from './lib/utils/managers'; -export { capabilities } from './lib/component-managers/custom'; -export { capabilities as modifierCapabilities } from './lib/modifiers/custom'; -export { helperCapabilities, invokeHelper } from './lib/helpers/custom'; export { isSerializationFirstNode } from './lib/utils/serialization-first-node-helpers';
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/compile-time-lookup.ts
@@ -1,73 +0,0 @@ -import { Owner } from '@ember/-internals/owner'; -import { - CompileTimeComponent, - CompileTimeResolver, - ComponentDefinition, - InternalComponentCapabilities, - InternalComponentManager, - Option, - WithStaticLayout, -} from '@glimmer/interfaces'; -import { unwrapTemplate } from '@glimmer/util'; -import RuntimeResolver from './resolver'; - -interface StaticComponentManager - extends WithStaticLayout<unknown, unknown>, - InternalComponentManager<unknown, unknown> {} - -function isStaticComponentManager( - _manager: InternalComponentManager, - capabilities: InternalComponentCapabilities -): _manager is StaticComponentManager { - return !capabilities.dynamicLayout; -} - -export default class CompileTimeResolverImpl implements CompileTimeResolver<Owner> { - constructor(private resolver: RuntimeResolver) {} - - lookupHelper(name: string, owner: Owner): Option<number> { - return this.resolver.lookupHelper(name, owner); - } - - lookupModifier(name: string, owner: Owner): Option<number> { - return this.resolver.lookupModifier(name, owner); - } - - lookupComponent(name: string, owner: Owner): Option<CompileTimeComponent> { - let definitionHandle = this.resolver.lookupComponentHandle(name, owner); - - if (definitionHandle === null) { - return null; - } - - const { manager, state } = this.resolver.resolve<ComponentDefinition<unknown, unknown>>( - definitionHandle - ); - const capabilities = manager.getCapabilities(state); - - if (!isStaticComponentManager(manager, capabilities)) { - return { - handle: definitionHandle, - capabilities, - compilable: null, - }; - } - - let template = unwrapTemplate(manager.getStaticLayout(state)); - let layout = capabilities.wrapped ? template.asWrappedLayout() : template.asLayout(); - - return { - handle: definitionHandle, - capabilities, - compilable: layout, - }; - } - - lookupPartial(name: string, owner: Owner): Option<number> { - return this.resolver.lookupPartial(name, owner); - } - - resolve(): null { - return null; - } -}
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/component-managers/curly.ts
@@ -1,6 +1,5 @@ -import { privatize as P } from '@ember/-internals/container'; -import { getOwner } from '@ember/-internals/owner'; -import { guidFor } from '@ember/-internals/utils'; +import { Factory, getOwner } from '@ember/-internals/owner'; +import { enumerableSymbol, guidFor, symbol } from '@ember/-internals/utils'; import { addChildView, setElementView, setViewElement } from '@ember/-internals/views'; import { assert, debugFreeze } from '@ember/debug'; import { EMBER_COMPONENT_IS_VISIBLE } from '@ember/deprecated-features'; @@ -9,16 +8,16 @@ import { assign } from '@ember/polyfills'; import { DEBUG } from '@glimmer/env'; import { Bounds, - ComponentDefinition, + CompilableProgram, Destroyable, ElementOperations, Environment, InternalComponentCapabilities, Option, PreparedArguments, - Template, TemplateFactory, VMArguments, + WithCreateInstance, WithDynamicLayout, WithDynamicTagName, } from '@glimmer/interfaces'; @@ -29,8 +28,8 @@ import { Reference, valueForRef, } from '@glimmer/reference'; -import { BaseInternalComponentManager, reifyPositional } from '@glimmer/runtime'; -import { EMPTY_ARRAY } from '@glimmer/util'; +import { reifyPositional } from '@glimmer/runtime'; +import { EMPTY_ARRAY, unwrapTemplate } from '@glimmer/util'; import { beginTrackFrame, beginUntrackFrame, @@ -41,7 +40,6 @@ import { valueForTag, } from '@glimmer/validator'; import { SimpleElement } from '@simple-dom/interface'; -import { BOUNDS, DIRTY_TAG, HAS_BLOCK, IS_DISPATCHING_ATTRS } from '../component'; import { DynamicScope } from '../renderer'; import RuntimeResolver from '../resolver'; import { isTemplateFactory } from '../template'; @@ -55,7 +53,13 @@ import { import ComponentStateBucket, { Component } from '../utils/curly-component-state-bucket'; import { processComponentArgs } from '../utils/process-args'; -import DefinitionState from './definition-state'; + +export const ARGS = enumerableSymbol('ARGS'); +export const HAS_BLOCK = enumerableSymbol('HAS_BLOCK'); + +export const DIRTY_TAG = symbol('DIRTY_TAG'); +export const IS_DISPATCHING_ATTRS = symbol('IS_DISPATCHING_ATTRS'); +export const BOUNDS = symbol('BOUNDS'); const EMBER_VIEW_REF = createPrimitiveRef('ember-view'); @@ -109,17 +113,25 @@ function applyAttributeBindings( } } -const DEFAULT_LAYOUT = P`template:components/-default`; const EMPTY_POSITIONAL_ARGS: Reference[] = []; debugFreeze(EMPTY_POSITIONAL_ARGS); +type ComponentFactory = Factory< + Component, + { + create(props?: any): Component; + positionalParams: string | string[] | undefined | null; + name: string; + } +>; + export default class CurlyComponentManager - extends BaseInternalComponentManager<ComponentStateBucket, DefinitionState> implements + WithCreateInstance<ComponentStateBucket, Environment>, WithDynamicLayout<ComponentStateBucket, RuntimeResolver>, WithDynamicTagName<ComponentStateBucket> { - protected templateFor(component: Component): Template { + protected templateFor(component: Component): CompilableProgram | null { let { layout, layoutName } = component; let owner = getOwner(component); @@ -129,21 +141,21 @@ export default class CurlyComponentManager if (layoutName !== undefined) { let _factory = owner.lookup<TemplateFactory>(`template:${layoutName}`); assert(`Layout \`${layoutName}\` not found!`, _factory !== undefined); - factory = _factory!; + factory = _factory; } else { - factory = owner.lookup<TemplateFactory>(DEFAULT_LAYOUT)!; + return null; } } else if (isTemplateFactory(layout)) { factory = layout; } else { - // we were provided an instance already - return layout; + // no layout was found, use the default layout + return null; } - return factory(owner); + return unwrapTemplate(factory(owner)).asWrappedLayout(); } - getDynamicLayout(bucket: ComponentStateBucket): Template { + getDynamicLayout(bucket: ComponentStateBucket): CompilableProgram | null { return this.templateFor(bucket.component); } @@ -157,11 +169,11 @@ export default class CurlyComponentManager return (component && component.tagName) || 'div'; } - getCapabilities(state: DefinitionState): InternalComponentCapabilities { - return state.capabilities; + getCapabilities(): InternalComponentCapabilities { + return CURLY_CAPABILITIES; } - prepareArgs(state: DefinitionState, args: VMArguments): Option<PreparedArguments> { + prepareArgs(ComponentClass: ComponentFactory, args: VMArguments): Option<PreparedArguments> { if (args.named.has('__ARGS__')) { let { __ARGS__, ...rest } = args.named.capture(); @@ -176,7 +188,7 @@ export default class CurlyComponentManager return prepared; } - const { positionalParams } = state.ComponentClass.class!; + const { positionalParams } = ComponentClass.class!; // early exits if ( @@ -236,7 +248,7 @@ export default class CurlyComponentManager */ create( environment: Environment, - state: DefinitionState, + ComponentClass: ComponentFactory, args: VMArguments, dynamicScope: DynamicScope, callerSelfRef: Reference, @@ -246,9 +258,6 @@ export default class CurlyComponentManager // components will be skipped. let parentView = dynamicScope.view; - // Get the Ember.Component subclass to instantiate for this component. - let factory = state.ComponentClass; - // Capture the arguments, which tells Glimmer to give us our own, stable // copy of the Arguments object that is safe to hold on to between renders. let capturedArgs = args.named.capture(); @@ -273,11 +282,6 @@ export default class CurlyComponentManager // `_target`, so bubbled actions are routed to the right place. props._target = valueForRef(callerSelfRef); - // static layout asserts CurriedDefinition - if (state.template) { - props.layout = state.template; - } - // caller: // <FaIcon @name="bug" /> // @@ -287,7 +291,7 @@ export default class CurlyComponentManager // Now that we've built up all of the properties to set on the component instance, // actually create it. beginUntrackFrame(); - let component = factory.create(props); + let component = ComponentClass.create(props); let finalizer = _instrumentStart('render.component', initialRenderInstrumentDetails, component); @@ -350,8 +354,8 @@ export default class CurlyComponentManager return bucket; } - getDebugName({ name }: DefinitionState): string { - return name; + getDebugName(definition: ComponentFactory): string { + return definition.fullName || definition.normalizedName || definition.class!.name; } getSelf({ rootRef }: ComponentStateBucket): Reference { @@ -471,42 +475,7 @@ export default class CurlyComponentManager } } -export function validatePositionalParameters( - named: { has(name: string): boolean }, - positional: { length: number }, - positionalParamsDefinition: any -) { - if (DEBUG) { - if (!named || !positional || !positional.length) { - return; - } - - let paramType = typeof positionalParamsDefinition; - - if (paramType === 'string') { - // tslint:disable-next-line:max-line-length - assert( - `You cannot specify positional parameters and the hash argument \`${positionalParamsDefinition}\`.`, - !named.has(positionalParamsDefinition) - ); - } else { - if (positional.length < positionalParamsDefinition.length) { - positionalParamsDefinition = positionalParamsDefinition.slice(0, positional.length); - } - - for (let i = 0; i < positionalParamsDefinition.length; i++) { - let name = positionalParamsDefinition[i]; - - assert( - `You cannot specify both a positional param (at position ${i}) and the hash argument \`${name}\`.`, - !named.has(name) - ); - } - } - } -} - -export function processComponentInitializationAssertions(component: Component, props: any) { +export function processComponentInitializationAssertions(component: Component, props: any): void { assert( `classNameBindings must be non-empty strings: ${component}`, (() => { @@ -566,14 +535,6 @@ export function rerenderInstrumentDetails(component: any): any { return component.instrumentDetails({ initialRender: false }); } -// This is not any of glimmer-vm's proper Argument types because we -// don't have sufficient public constructors to conveniently -// reassemble one after we mangle the various arguments. -interface CurriedArgs { - positional: any[]; - named: any; -} - export const CURLY_CAPABILITIES: InternalComponentCapabilities = { dynamicLayout: true, dynamicTag: true, @@ -589,22 +550,4 @@ export const CURLY_CAPABILITIES: InternalComponentCapabilities = { willDestroy: true, }; -const CURLY_COMPONENT_MANAGER = new CurlyComponentManager(); -export class CurlyComponentDefinition implements ComponentDefinition { - public state: DefinitionState; - public manager: CurlyComponentManager = CURLY_COMPONENT_MANAGER; - - constructor( - public name: string, - public ComponentClass: any, - public template?: Template, - public args?: CurriedArgs - ) { - this.state = { - name, - ComponentClass, - template, - capabilities: CURLY_CAPABILITIES, - }; - } -} +export const CURLY_COMPONENT_MANAGER = new CurlyComponentManager();
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/component-managers/custom.ts
@@ -1,242 +0,0 @@ -import { Factory } from '@ember/-internals/owner'; -import { assert } from '@ember/debug'; -import { DEBUG } from '@glimmer/env'; -import { - Arguments, - ComponentCapabilities, - ComponentCapabilitiesVersions, - ComponentDefinition, - ComponentManager, - ComponentManagerWithAsyncLifeCycleCallbacks, - ComponentManagerWithAsyncUpdateHook, - ComponentManagerWithDestructors, - ComponentManagerWithUpdateHook, - Destroyable, - Environment, - InternalComponentCapabilities, - Option, - Template, - VMArguments, - WithStaticLayout, -} from '@glimmer/interfaces'; -import { createConstRef, Reference } from '@glimmer/reference'; -import { - BaseInternalComponentManager, - buildCapabilities, - registerDestructor, -} from '@glimmer/runtime'; -import { deprecateMutationsInTrackingTransaction } from '@glimmer/validator'; -import { argsProxyFor } from '../utils/args-proxy'; - -const CAPABILITIES = { - dynamicLayout: false, - dynamicTag: false, - prepareArgs: false, - createArgs: true, - attributeHook: false, - elementHook: false, - createCaller: false, - dynamicScope: true, - updateHook: true, - createInstance: true, - wrapped: false, - willDestroy: false, -}; - -export function capabilities<Version extends keyof ComponentCapabilitiesVersions>( - managerAPI: Version, - options: ComponentCapabilitiesVersions[Version] = {} -): ComponentCapabilities { - assert( - 'Invalid component manager compatibility specified', - managerAPI === '3.4' || managerAPI === '3.13' - ); - - let updateHook = true; - - if (managerAPI === '3.13') { - updateHook = Boolean((options as ComponentCapabilitiesVersions['3.13']).updateHook); - } - - return buildCapabilities({ - asyncLifeCycleCallbacks: Boolean(options.asyncLifecycleCallbacks), - destructor: Boolean(options.destructor), - updateHook, - }); -} - -export interface DefinitionState<ComponentInstance> { - name: string; - ComponentClass: Factory<ComponentInstance>; - template: Template; -} - -export function hasAsyncLifeCycleCallbacks<ComponentInstance>( - delegate: ComponentManager<ComponentInstance> -): delegate is ComponentManagerWithAsyncLifeCycleCallbacks<ComponentInstance> { - return delegate.capabilities.asyncLifeCycleCallbacks; -} - -export function hasUpdateHook<ComponentInstance>( - delegate: ComponentManager<ComponentInstance> -): delegate is ComponentManagerWithUpdateHook<ComponentInstance> { - return delegate.capabilities.updateHook; -} - -export function hasAsyncUpdateHook<ComponentInstance>( - delegate: ComponentManager<ComponentInstance> -): delegate is ComponentManagerWithAsyncUpdateHook<ComponentInstance> { - return hasAsyncLifeCycleCallbacks(delegate) && hasUpdateHook(delegate); -} - -export function hasDestructors<ComponentInstance>( - delegate: ComponentManager<ComponentInstance> -): delegate is ComponentManagerWithDestructors<ComponentInstance> { - return delegate.capabilities.destructor; -} - -/** - The CustomComponentManager allows addons to provide custom component - implementations that integrate seamlessly into Ember. This is accomplished - through a delegate, registered with the custom component manager, which - implements a set of hooks that determine component behavior. - - To create a custom component manager, instantiate a new CustomComponentManager - class and pass the delegate as the first argument: - - ```js - let manager = new CustomComponentManager({ - // ...delegate implementation... - }); - ``` - - ## Delegate Hooks - - Throughout the lifecycle of a component, the component manager will invoke - delegate hooks that are responsible for surfacing those lifecycle changes to - the end developer. - - * `create()` - invoked when a new instance of a component should be created - * `update()` - invoked when the arguments passed to a component change - * `getContext()` - returns the object that should be -*/ -export default class CustomComponentManager<ComponentInstance> - extends BaseInternalComponentManager< - CustomComponentState<ComponentInstance>, - CustomComponentDefinitionState<ComponentInstance> - > - implements - WithStaticLayout< - CustomComponentState<ComponentInstance>, - CustomComponentDefinitionState<ComponentInstance> - > { - create( - env: Environment, - definition: CustomComponentDefinitionState<ComponentInstance>, - vmArgs: VMArguments - ): CustomComponentState<ComponentInstance> { - let { delegate } = definition; - let args = argsProxyFor(vmArgs.capture(), 'component'); - - let component; - - if (DEBUG && deprecateMutationsInTrackingTransaction !== undefined) { - deprecateMutationsInTrackingTransaction(() => { - component = delegate.createComponent(definition.ComponentClass.class!, args); - }); - } else { - component = delegate.createComponent(definition.ComponentClass.class!, args); - } - - let bucket = new CustomComponentState(delegate, component, args, env); - - return bucket as CustomComponentState<ComponentInstance>; - } - - getDebugName({ name }: CustomComponentDefinitionState<ComponentInstance>): string { - return name; - } - - update(bucket: CustomComponentState<ComponentInstance>): void { - if (hasUpdateHook(bucket.delegate)) { - let { delegate, component, args } = bucket; - - delegate.updateComponent(component, args); - } - } - - didCreate({ delegate, component }: CustomComponentState<ComponentInstance>): void { - if (hasAsyncLifeCycleCallbacks(delegate)) { - delegate.didCreateComponent(component); - } - } - - didUpdate({ delegate, component }: CustomComponentState<ComponentInstance>): void { - if (hasAsyncUpdateHook(delegate)) { - delegate.didUpdateComponent(component); - } - } - - didRenderLayout(): void {} - - didUpdateLayout(): void {} - - getSelf({ delegate, component }: CustomComponentState<ComponentInstance>): Reference { - return createConstRef(delegate.getContext(component), 'this'); - } - - getDestroyable(bucket: CustomComponentState<ComponentInstance>): Option<Destroyable> { - return bucket; - } - - getCapabilities(): InternalComponentCapabilities { - return CAPABILITIES; - } - - getStaticLayout(state: DefinitionState<ComponentInstance>): Template { - return state.template; - } -} -const CUSTOM_COMPONENT_MANAGER = new CustomComponentManager(); - -/** - * Stores internal state about a component instance after it's been created. - */ -export class CustomComponentState<ComponentInstance> { - constructor( - public delegate: ComponentManager<ComponentInstance>, - public component: ComponentInstance, - public args: Arguments, - public env: Environment - ) { - if (hasDestructors(delegate)) { - registerDestructor(this, () => delegate.destroyComponent(component)); - } - } -} - -export interface CustomComponentDefinitionState<ComponentInstance> - extends DefinitionState<ComponentInstance> { - delegate: ComponentManager<ComponentInstance>; -} - -export class CustomManagerDefinition<ComponentInstance> implements ComponentDefinition { - public state: CustomComponentDefinitionState<ComponentInstance>; - public manager: CustomComponentManager< - ComponentInstance - > = CUSTOM_COMPONENT_MANAGER as CustomComponentManager<ComponentInstance>; - - constructor( - public name: string, - public ComponentClass: Factory<ComponentInstance>, - public delegate: ComponentManager<ComponentInstance>, - public template: Template - ) { - this.state = { - name, - ComponentClass, - template, - delegate, - }; - } -}
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/component-managers/definition-state.ts
@@ -1,13 +0,0 @@ -import { Factory } from '@ember/-internals/owner'; -import { InternalComponentCapabilities, Template } from '@glimmer/interfaces'; -import { Component } from '../utils/curly-component-state-bucket'; - -export default interface DefinitionState { - capabilities: InternalComponentCapabilities; - name: string; - ComponentClass: Factory< - Component, - { create(props?: any): Component; positionalParams: string | string[] | undefined | null } - >; - template?: Template; -}
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/component-managers/internal.ts
@@ -1,19 +1,16 @@ import { Owner } from '@ember/-internals/owner'; import { assert } from '@ember/debug'; import { - ComponentDefinition, + CapturedNamedArguments, Destroyable, DynamicScope, Environment, InternalComponentCapabilities, InternalComponentManager, - Template, VMArguments, - WithStaticLayout, + WithCreateInstance, } from '@glimmer/interfaces'; import { createConstRef, isConstRef, Reference, valueForRef } from '@glimmer/reference'; -import { BaseInternalComponentManager } from '@glimmer/runtime'; -import InternalComponent from '../components/internal'; const CAPABILITIES: InternalComponentCapabilities = { dynamicLayout: false, @@ -30,48 +27,32 @@ const CAPABILITIES: InternalComponentCapabilities = { willDestroy: false, }; -export interface InternalDefinitionState { - ComponentClass: typeof InternalComponent; - layout: Template; -} - export interface InternalComponentState { env: Environment; instance: Destroyable; } -export class InternalComponentDefinition - implements - ComponentDefinition<InternalDefinitionState, InternalComponentState, InternalComponentManager> { - public state: InternalDefinitionState; - - constructor( - public manager: InternalComponentManager, - ComponentClass: typeof InternalComponent, - layout: Template - ) { - this.state = { ComponentClass, layout }; - } +export interface EmberInternalComponentConstructor { + new (owner: Owner, args: CapturedNamedArguments, caller: unknown): Destroyable; } export default class InternalManager - extends BaseInternalComponentManager<InternalComponentState, InternalDefinitionState> - implements WithStaticLayout<InternalComponentState, InternalDefinitionState> { + implements + InternalComponentManager<InternalComponentState, EmberInternalComponentConstructor>, + WithCreateInstance { static for(name: string): (owner: Owner) => InternalManager { return (owner: Owner) => new InternalManager(owner, name); } - constructor(private owner: Owner, private name: string) { - super(); - } + constructor(private owner: Owner, private name: string) {} getCapabilities(): InternalComponentCapabilities { return CAPABILITIES; } create( env: Environment, - { ComponentClass }: InternalDefinitionState, + ComponentClass: EmberInternalComponentConstructor, args: VMArguments, _dynamicScope: DynamicScope, caller: Reference @@ -90,6 +71,12 @@ export default class InternalManager return state; } + didCreate(): void {} + didUpdate(): void {} + + didRenderLayout(): void {} + didUpdateLayout(): void {} + getDebugName(): string { return this.name; } @@ -101,8 +88,4 @@ export default class InternalManager getDestroyable(state: InternalComponentState): Destroyable { return state.instance; } - - getStaticLayout({ layout: template }: InternalDefinitionState): Template { - return template; - } }
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/component-managers/mount.ts
@@ -1,6 +1,7 @@ import { Owner } from '@ember/-internals/owner'; import { generateControllerFactory } from '@ember/-internals/routing'; import EngineInstance from '@ember/engine/instance'; +import { associateDestroyableChild } from '@glimmer/destroyable'; import { CapturedArguments, ComponentDefinition, @@ -9,14 +10,15 @@ import { Environment, InternalComponentCapabilities, Option, - Template, TemplateFactory, VMArguments, + WithCreateInstance, WithCustomDebugRenderTree, WithDynamicLayout, } from '@glimmer/interfaces'; +import { capabilityFlagsFrom } from '@glimmer/manager'; import { createConstRef, Reference, valueForRef } from '@glimmer/reference'; -import { associateDestroyableChild, BaseInternalComponentManager } from '@glimmer/runtime'; +import { unwrapTemplate } from '@glimmer/util'; import RuntimeResolver from '../resolver'; interface EngineState { @@ -46,13 +48,13 @@ const CAPABILITIES = { }; class MountManager - extends BaseInternalComponentManager<EngineState, EngineDefinitionState> implements + WithCreateInstance<EngineState, Environment>, WithDynamicLayout<EngineState, RuntimeResolver>, WithCustomDebugRenderTree<EngineState, EngineDefinitionState> { getDynamicLayout(state: EngineState) { let templateFactory = state.engine.lookup('template:application') as TemplateFactory; - return templateFactory(state.engine); + return unwrapTemplate(templateFactory(state.engine)).asLayout(); } getCapabilities(): InternalComponentCapabilities { @@ -106,7 +108,7 @@ class MountManager definition: EngineDefinitionState, state: EngineState, args: CapturedArguments, - template?: Template + templateModuleName?: string ): CustomRenderNode[] { return [ { @@ -122,7 +124,7 @@ class MountManager type: 'route-template', name: 'application', args, - template, + template: templateModuleName, }, ]; } @@ -135,7 +137,11 @@ class MountManager return bucket.engine; } + didCreate() {} + didUpdate() {} + didRenderLayout(): void {} + didUpdateLayout(): void {} update(bucket: EngineState): void { let { controller, modelRef } = bucket; @@ -144,17 +150,20 @@ class MountManager controller.set('model', valueForRef(modelRef!)); } } - - didUpdateLayout(): void {} } const MOUNT_MANAGER = new MountManager(); export class MountDefinition implements ComponentDefinition { + // handle is not used by this custom definition + public handle = -1; + public state: EngineDefinitionState; public manager = MOUNT_MANAGER; + public compilable = null; + public capabilities = capabilityFlagsFrom(CAPABILITIES); - constructor(name: string) { - this.state = { name }; + constructor(public resolvedName: string) { + this.state = { name: resolvedName }; } }
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts
@@ -6,20 +6,24 @@ import { _instrumentStart } from '@ember/instrumentation'; import { assign } from '@ember/polyfills'; import { CapturedArguments, + CompilableProgram, ComponentDefinition, CustomRenderNode, Destroyable, Environment, InternalComponentCapabilities, + InternalComponentCapability, Option, Template, VMArguments, + WithCreateInstance, WithCustomDebugRenderTree, WithDynamicTagName, - WithStaticLayout, } from '@glimmer/interfaces'; +import { capabilityFlagsFrom } from '@glimmer/manager'; import { createConstRef, Reference, valueForRef } from '@glimmer/reference'; -import { BaseInternalComponentManager, EMPTY_ARGS } from '@glimmer/runtime'; +import { EMPTY_ARGS } from '@glimmer/runtime'; +import { unwrapTemplate } from '@glimmer/util'; import { SimpleElement } from '@simple-dom/interface'; import { DynamicScope } from '../renderer'; @@ -63,9 +67,8 @@ const CAPABILITIES: InternalComponentCapabilities = { }; class OutletComponentManager - extends BaseInternalComponentManager<OutletInstanceState, OutletDefinitionState> implements - WithStaticLayout<OutletInstanceState, OutletDefinitionState>, + WithCreateInstance<OutletInstanceState, Environment>, WithCustomDebugRenderTree<OutletInstanceState, OutletDefinitionState> { create( env: Environment, @@ -144,17 +147,12 @@ class OutletComponentManager name: definition.name, args: args, instance: definition.controller, - template: definition.template, + template: unwrapTemplate(definition.template).moduleName, }); return nodes; } - getStaticLayout({ template }: OutletDefinitionState) { - // The router has already resolved the template - return template; - } - getCapabilities(): InternalComponentCapabilities { return CAPABILITIES; } @@ -163,10 +161,15 @@ class OutletComponentManager return self; } + didCreate() {} + didUpdate() {} + didRenderLayout(state: OutletInstanceState): void { state.finalize(); } + didUpdateLayout() {} + getDestroyable(): Option<Destroyable> { return null; } @@ -177,10 +180,24 @@ const OUTLET_MANAGER = new OutletComponentManager(); export class OutletComponentDefinition implements ComponentDefinition<OutletDefinitionState, OutletInstanceState, OutletComponentManager> { + // handle is not used by this custom definition + public handle = -1; + + public resolvedName: string; + public compilable: CompilableProgram; + public capabilities: InternalComponentCapability; + constructor( public state: OutletDefinitionState, public manager: OutletComponentManager = OUTLET_MANAGER - ) {} + ) { + let capabilities = manager.getCapabilities(); + this.capabilities = capabilityFlagsFrom(capabilities); + this.compilable = capabilities.wrapped + ? unwrapTemplate(state.template).asWrappedLayout() + : unwrapTemplate(state.template).asLayout(); + this.resolvedName = state.name; + } } export function createRootOutlet(outletView: OutletView): OutletComponentDefinition { @@ -198,11 +215,6 @@ export function createRootOutlet(outletView: OutletView): OutletComponentDefinit return 'div'; } - getStaticLayout({ template }: OutletDefinitionState) { - // The router has already resolved the template - return template; - } - getCapabilities(): InternalComponentCapabilities { return WRAPPED_CAPABILITIES; }
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/component-managers/root.ts
@@ -1,24 +1,22 @@ import { getFactoryFor } from '@ember/-internals/container'; -import { Factory } from '@ember/-internals/owner'; import { _instrumentStart } from '@ember/instrumentation'; import { DEBUG } from '@glimmer/env'; import { ComponentDefinition, Environment, InternalComponentCapabilities, Option, - Template, VMArguments, } from '@glimmer/interfaces'; +import { capabilityFlagsFrom } from '@glimmer/manager'; import { CONSTANT_TAG, consumeTag } from '@glimmer/validator'; -import { DIRTY_TAG } from '../component'; import { DynamicScope } from '../renderer'; import ComponentStateBucket, { Component } from '../utils/curly-component-state-bucket'; import CurlyComponentManager, { + DIRTY_TAG, initialRenderInstrumentDetails, processComponentInitializationAssertions, } from './curly'; -import DefinitionState from './definition-state'; class RootComponentManager extends CurlyComponentManager { component: Component; @@ -28,13 +26,9 @@ class RootComponentManager extends CurlyComponentManager { this.component = component; } - getStaticLayout(): Template { - return this.templateFor(this.component); - } - create( environment: Environment, - _state: DefinitionState, + _state: unknown, _args: Option<VMArguments>, dynamicScope: DynamicScope ) { @@ -81,7 +75,7 @@ class RootComponentManager extends CurlyComponentManager { // ROOT is the top-level template it has nothing but one yield. // it is supposed to have a dummy element export const ROOT_CAPABILITIES: InternalComponentCapabilities = { - dynamicLayout: false, + dynamicLayout: true, dynamicTag: true, prepareArgs: false, createArgs: false, @@ -96,17 +90,17 @@ export const ROOT_CAPABILITIES: InternalComponentCapabilities = { }; export class RootComponentDefinition implements ComponentDefinition { - state: DefinitionState; + // handle is not used by this custom definition + handle = -1; + + resolvedName = '-top-level'; + state: object; manager: RootComponentManager; + capabilities = capabilityFlagsFrom(ROOT_CAPABILITIES); + compilable = null; - constructor(public component: Component) { - let manager = new RootComponentManager(component); - this.manager = manager; - let factory = getFactoryFor(component); - this.state = { - name: factory!.fullName.slice(10), - capabilities: ROOT_CAPABILITIES, - ComponentClass: factory as Factory<any, any>, - }; + constructor(component: Component) { + this.manager = new RootComponentManager(component); + this.state = getFactoryFor(component); } }
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/component-managers/template-only.ts
@@ -1,74 +0,0 @@ -import { - ComponentDefinition, - Environment, - InternalComponentCapabilities, - Option, - Template, - WithStaticLayout, -} from '@glimmer/interfaces'; -import { NULL_REFERENCE, Reference } from '@glimmer/reference'; - -const CAPABILITIES: InternalComponentCapabilities = { - dynamicLayout: false, - dynamicTag: false, - prepareArgs: false, - createArgs: false, - attributeHook: false, - elementHook: false, - createCaller: false, - dynamicScope: false, - updateHook: false, - createInstance: false, - wrapped: false, - willDestroy: false, -}; - -export interface DebugStateBucket { - environment: Environment; -} - -export default class TemplateOnlyComponentManager - implements WithStaticLayout<Option<DebugStateBucket>, TemplateOnlyComponentDefinitionState> { - getStaticLayout({ template }: TemplateOnlyComponentDefinitionState): Template { - return template; - } - - getCapabilities(): InternalComponentCapabilities { - return CAPABILITIES; - } - - getDebugName({ name }: TemplateOnlyComponentDefinitionState): string { - return name; - } - - getSelf(): Reference { - return NULL_REFERENCE; - } - - getDestroyable(): null { - return null; - } -} - -const MANAGER = new TemplateOnlyComponentManager(); - -export interface TemplateOnlyComponentDefinitionState { - name: string; - template: Template; -} - -export class TemplateOnlyComponentDefinition - implements - TemplateOnlyComponentDefinitionState, - ComponentDefinition< - TemplateOnlyComponentDefinitionState, - Option<DebugStateBucket>, - TemplateOnlyComponentManager - > { - manager = MANAGER; - constructor(public name: string, public template: Template) {} - - get state(): TemplateOnlyComponentDefinitionState { - return this; - } -}
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/component.ts
@@ -1,7 +1,6 @@ import { get, PROPERTY_DID_CHANGE } from '@ember/-internals/metal'; import { getOwner } from '@ember/-internals/owner'; import { TargetActionSupport } from '@ember/-internals/runtime'; -import { enumerableSymbol, symbol } from '@ember/-internals/utils'; import { ActionSupport, ChildViewsSupport, @@ -13,17 +12,18 @@ import { } from '@ember/-internals/views'; import { assert, deprecate } from '@ember/debug'; import { DEBUG } from '@glimmer/env'; +import { setInternalComponentManager } from '@glimmer/manager'; import { isUpdatableRef, updateRef } from '@glimmer/reference'; import { normalizeProperty } from '@glimmer/runtime'; import { createTag, dirtyTag } from '@glimmer/validator'; import { Namespace } from '@simple-dom/interface'; - -export const ARGS = enumerableSymbol('ARGS'); -export const HAS_BLOCK = enumerableSymbol('HAS_BLOCK'); - -export const DIRTY_TAG = symbol('DIRTY_TAG'); -export const IS_DISPATCHING_ATTRS = symbol('IS_DISPATCHING_ATTRS'); -export const BOUNDS = symbol('BOUNDS'); +import { + ARGS, + BOUNDS, + CURLY_COMPONENT_MANAGER, + DIRTY_TAG, + IS_DISPATCHING_ATTRS, +} from './component-managers/curly'; /** @module @ember/component @@ -1128,4 +1128,6 @@ Component.reopenClass({ positionalParams: [], }); +setInternalComponentManager(() => CURLY_COMPONENT_MANAGER, Component); + export default Component;
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/components/input.ts
@@ -1,7 +1,7 @@ /** @module @ember/component */ -import { setComponentManager } from '@glimmer/runtime'; +import { setInternalComponentManager } from '@glimmer/manager'; import InternalManager from '../component-managers/internal'; import InternalComponent from './internal'; @@ -117,6 +117,6 @@ export default class Input extends InternalComponent { } } -setComponentManager(InternalManager.for('input'), Input); +setInternalComponentManager(InternalManager.for('input'), Input); Input.toString = () => '@ember/component/input';
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/components/link-to.ts
@@ -11,7 +11,8 @@ import { EngineInstance, getEngineParent } from '@ember/engine'; import { flaggedInstrument } from '@ember/instrumentation'; import { inject as injectService } from '@ember/service'; import { DEBUG } from '@glimmer/env'; -import EmberComponent, { HAS_BLOCK } from '../component'; +import EmberComponent from '../component'; +import { HAS_BLOCK } from '../component-managers/curly'; import layout from '../templates/link-to'; /**
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helper.ts
@@ -8,15 +8,13 @@ import { getDebugName, symbol } from '@ember/-internals/utils'; import { join } from '@ember/runloop'; import { DEBUG } from '@glimmer/env'; import { Arguments, Dict, HelperManager } from '@glimmer/interfaces'; -import { setHelperManager } from '@glimmer/runtime'; -import { _WeakSet as WeakSet } from '@glimmer/util'; +import { helperCapabilities, setHelperManager } from '@glimmer/manager'; import { consumeTag, createTag, deprecateMutationsInTrackingTransaction, dirtyTag, } from '@glimmer/validator'; -import { helperCapabilities } from './helpers/custom'; export const RECOMPUTE_TAG = symbol('RECOMPUTE_TAG'); @@ -39,12 +37,6 @@ export interface SimpleHelper<T = unknown> { compute: HelperFunction<T>; } -const CLASSIC_HELPER_MANAGERS = new WeakSet(); - -export function isClassicHelperManager(obj: object) { - return CLASSIC_HELPER_MANAGERS.has(obj); -} - /** Ember Helpers are functions that can compute values, and are used in templates. For example, this code calls a helper named `format-currency`: @@ -139,7 +131,14 @@ let Helper = FrameworkObject.extend({ */ }); +const IS_CLASSIC_HELPER = symbol('IS_CLASSIC_HELPER'); + Helper.isHelperFactory = true; +Helper[IS_CLASSIC_HELPER] = true; + +export function isClassicHelper(obj: object): boolean { + return obj[IS_CLASSIC_HELPER] === true; +} interface ClassicHelperStateBucket { instance: HelperInstance; @@ -155,13 +154,12 @@ class ClassicHelperManager implements HelperManager<ClassicHelperStateBucket> { private ownerInjection: object; constructor(owner: Owner | undefined) { - CLASSIC_HELPER_MANAGERS.add(this); let ownerInjection = {}; setOwner(ownerInjection, owner!); this.ownerInjection = ownerInjection; } - createHelper(definition: ClassHelperFactory | typeof Helper, args: Arguments) { + createHelper(definition: typeof Helper, args: Arguments) { let instance = definition.class === undefined ? definition.create(this.ownerInjection) : definition.create(); @@ -197,7 +195,11 @@ class ClassicHelperManager implements HelperManager<ClassicHelperStateBucket> { } } -setHelperManager((owner: Owner | undefined) => new ClassicHelperManager(owner), Helper); +export const CLASSIC_HELPER_MANAGER_FACTORY = (owner: Owner | undefined): ClassicHelperManager => { + return new ClassicHelperManager(owner); +}; + +setHelperManager(CLASSIC_HELPER_MANAGER_FACTORY, Helper); ///////////
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/-assert-implicit-component-helper-argument.ts
@@ -2,6 +2,7 @@ import { assert } from '@ember/debug'; import { DEBUG } from '@glimmer/env'; import { Helper, VMArguments } from '@glimmer/interfaces'; import { createComputeRef, valueForRef } from '@glimmer/reference'; +import { internalHelper } from './internal-helper'; let helper: Helper; @@ -22,4 +23,4 @@ if (DEBUG) { helper = (args: VMArguments) => args.positional.at(0); } -export default helper; +export default internalHelper(helper);
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/-in-element-null-check.ts
@@ -2,6 +2,7 @@ import { assert } from '@ember/debug'; import { DEBUG } from '@glimmer/env'; import { Helper, VMArguments } from '@glimmer/interfaces'; import { createComputeRef, valueForRef } from '@glimmer/reference'; +import { internalHelper } from './internal-helper'; let helper: Helper; @@ -24,4 +25,4 @@ if (DEBUG) { helper = (args: VMArguments) => args.positional.at(0); } -export default helper; +export default internalHelper(helper);
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/-normalize-class.ts
@@ -1,8 +1,9 @@ import { dasherize } from '@ember/string'; import { VMArguments } from '@glimmer/interfaces'; import { createComputeRef, valueForRef } from '@glimmer/reference'; +import { internalHelper } from './internal-helper'; -export default function (args: VMArguments) { +export default internalHelper((args: VMArguments) => { let positional = args.positional.capture(); return createComputeRef(() => { @@ -18,4 +19,4 @@ export default function (args: VMArguments) { return String(value); } }); -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/-track-array.ts
@@ -6,13 +6,14 @@ import { isObject } from '@ember/-internals/utils'; import { VMArguments } from '@glimmer/interfaces'; import { createComputeRef, valueForRef } from '@glimmer/reference'; import { consumeTag } from '@glimmer/validator'; +import { internalHelper } from './internal-helper'; /** This reference is used to get the `[]` tag of iterables, so we can trigger updates to `{{each}}` when it changes. It is put into place by a template transform at build time, similar to the (-each-in) helper */ -export default function trackArray(args: VMArguments) { +export default internalHelper((args: VMArguments) => { let inner = args.positional.at(0); return createComputeRef(() => { @@ -24,4 +25,4 @@ export default function trackArray(args: VMArguments) { return iterable; }); -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/action.ts
@@ -16,6 +16,7 @@ import { valueForRef, } from '@glimmer/reference'; import { _WeakSet } from '@glimmer/util'; +import { internalHelper } from './internal-helper'; export const ACTIONS = new _WeakSet(); export const INVOKE: unique symbol = symbol('INVOKE') as any; @@ -283,40 +284,48 @@ export const INVOKE: unique symbol = symbol('INVOKE') as any; @for Ember.Templates.helpers @public */ -export default function (args: VMArguments): Reference<Function> { - let { named, positional } = args; +export default internalHelper( + (args: VMArguments): Reference<Function> => { + let { named, positional } = args; - let capturedArgs = positional.capture(); + let capturedArgs = positional.capture(); - // The first two argument slots are reserved. - // pos[0] is the context (or `this`) - // pos[1] is the action name or function - // Anything else is an action argument. - let [context, action, ...restArgs] = capturedArgs; + // The first two argument slots are reserved. + // pos[0] is the context (or `this`) + // pos[1] is the action name or function + // Anything else is an action argument. + let [context, action, ...restArgs] = capturedArgs; - let debugKey: string = action.debugLabel!; + let debugKey: string = action.debugLabel!; - let target = named.has('target') ? named.get('target') : context; - let processArgs = makeArgsProcessor(named.has('value') && named.get('value'), restArgs); + let target = named.has('target') ? named.get('target') : context; + let processArgs = makeArgsProcessor(named.has('value') && named.get('value'), restArgs); - let fn: Function; + let fn: Function; - if (isInvokableRef(action)) { - fn = makeClosureAction(action, action as MaybeActionHandler, invokeRef, processArgs, debugKey); - } else { - fn = makeDynamicClosureAction( - valueForRef(context) as object, - target, - action, - processArgs, - debugKey - ); - } + if (isInvokableRef(action)) { + fn = makeClosureAction( + action, + action as MaybeActionHandler, + invokeRef, + processArgs, + debugKey + ); + } else { + fn = makeDynamicClosureAction( + valueForRef(context) as object, + target, + action, + processArgs, + debugKey + ); + } - ACTIONS.add(fn); + ACTIONS.add(fn); - return createUnboundRef(fn, '(result of an `action` helper)'); -} + return createUnboundRef(fn, '(result of an `action` helper)'); + } +); function NOOP(args: unknown[]) { return args;
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/array.ts
@@ -1,6 +1,7 @@ import { VMArguments } from '@glimmer/interfaces'; import { createComputeRef, Reference } from '@glimmer/reference'; import { reifyPositional } from '@glimmer/runtime'; +import { internalHelper } from './internal-helper'; /** @module ember @@ -42,8 +43,10 @@ import { reifyPositional } from '@glimmer/runtime'; @public */ -export default function (args: VMArguments): Reference<unknown[]> { - let captured = args.positional.capture(); +export default internalHelper( + (args: VMArguments): Reference<unknown[]> => { + let captured = args.positional.capture(); - return createComputeRef(() => reifyPositional(captured), null, 'array'); -} + return createComputeRef(() => reifyPositional(captured), null, 'array'); + } +);
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/concat.ts
@@ -1,12 +1,13 @@ import { VMArguments } from '@glimmer/interfaces'; import { createComputeRef } from '@glimmer/reference'; import { reifyPositional } from '@glimmer/runtime'; +import { internalHelper } from './internal-helper'; -const isEmpty = (value: any): boolean => { - return value === null || value === undefined || typeof value.toString !== 'function'; +const isEmpty = (value: unknown): boolean => { + return value === null || value === undefined || typeof (value as object).toString !== 'function'; }; -const normalizeTextValue = (value: any): string => { +const normalizeTextValue = (value: unknown): string => { if (isEmpty(value)) { return ''; } @@ -39,12 +40,12 @@ const normalizeTextValue = (value: any): string => { @for Ember.Templates.helpers @since 1.13.0 */ -export default function (args: VMArguments) { +export default internalHelper((args: VMArguments) => { let captured = args.positional.capture(); return createComputeRef( () => reifyPositional(captured).map(normalizeTextValue).join(''), null, 'concat' ); -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/each-in.ts
@@ -7,6 +7,7 @@ import { isProxy } from '@ember/-internals/utils'; import { VMArguments } from '@glimmer/interfaces'; import { createComputeRef, valueForRef } from '@glimmer/reference'; import { consumeTag } from '@glimmer/validator'; +import { internalHelper } from './internal-helper'; /** The `{{#each}}` helper loops over elements in a collection. It is an extension @@ -158,7 +159,7 @@ export class EachInWrapper { constructor(public inner: unknown) {} } -export default function (args: VMArguments) { +export default internalHelper((args: VMArguments) => { let inner = args.positional.at(0); return createComputeRef(() => { @@ -174,4 +175,4 @@ export default function (args: VMArguments) { return new EachInWrapper(iterable); }); -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/fn.ts
@@ -10,6 +10,7 @@ import { } from '@glimmer/reference'; import { reifyPositional } from '@glimmer/runtime'; import buildUntouchableThis from '../utils/untouchable-this'; +import { internalHelper } from './internal-helper'; const context = buildUntouchableThis('`fn` helper'); @@ -84,7 +85,7 @@ const context = buildUntouchableThis('`fn` helper'); @public @since 3.11.0 */ -export default function (args: VMArguments) { +export default internalHelper((args: VMArguments) => { let positional = args.positional.capture(); let callbackRef = positional[0]; @@ -108,7 +109,7 @@ export default function (args: VMArguments) { null, 'fn' ); -} +}); function assertCallbackIsFn(callbackRef: Reference) { assert(
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/get.ts
@@ -9,6 +9,7 @@ import { NULL_REFERENCE, valueForRef, } from '@glimmer/reference'; +import { internalHelper } from './internal-helper'; /** @module ember @@ -94,7 +95,7 @@ import { @for Ember.Templates.helpers @since 2.1.0 */ -export default function (args: VMArguments) { +export default internalHelper((args: VMArguments) => { let sourceRef = args.positional.at(0); let pathRef = args.positional.at(1); @@ -130,4 +131,4 @@ export default function (args: VMArguments) { 'get' ); } -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/hash.ts
@@ -1,6 +1,7 @@ import { Dict, VMArguments } from '@glimmer/interfaces'; import { createComputeRef, Reference } from '@glimmer/reference'; import { reifyNamed } from '@glimmer/runtime'; +import { internalHelper } from './internal-helper'; /** @module ember @@ -44,8 +45,10 @@ import { reifyNamed } from '@glimmer/runtime'; @since 2.3.0 @public */ -export default function (args: VMArguments): Reference<Dict<unknown>> { - let positional = args.named.capture(); +export default internalHelper( + (args: VMArguments): Reference<Dict<unknown>> => { + let positional = args.named.capture(); - return createComputeRef(() => reifyNamed(positional), null, 'hash'); -} + return createComputeRef(() => reifyNamed(positional), null, 'hash'); + } +);
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/if-unless.ts
@@ -6,6 +6,7 @@ import { assert } from '@ember/debug'; import { toBool } from '@glimmer/global-context'; import { VMArguments } from '@glimmer/interfaces'; import { createComputeRef, valueForRef } from '@glimmer/reference'; +import { internalHelper } from './internal-helper'; /** The `if` helper allows you to conditionally render one of two branches, @@ -98,7 +99,7 @@ import { createComputeRef, valueForRef } from '@glimmer/reference'; @for Ember.Templates.helpers @public */ -export function inlineIf(args: VMArguments) { +export const inlineIf = internalHelper((args: VMArguments) => { let positional = args.positional.capture(); return createComputeRef( @@ -119,7 +120,7 @@ export function inlineIf(args: VMArguments) { null, 'if' ); -} +}); /** The `unless` helper is the inverse of the `if` helper. It displays if a value @@ -206,7 +207,7 @@ export function inlineIf(args: VMArguments) { @for Ember.Templates.helpers @public */ -export function inlineUnless(args: VMArguments) { +export const inlineUnless = internalHelper((args: VMArguments) => { let positional = args.positional.capture(); return createComputeRef( @@ -227,4 +228,4 @@ export function inlineUnless(args: VMArguments) { null, 'unless' ); -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/internal-helper.ts
@@ -0,0 +1,6 @@ +import { Helper, HelperDefinitionState } from '@glimmer/interfaces'; +import { setInternalHelperManager } from '@glimmer/manager'; + +export function internalHelper(helper: Helper): HelperDefinitionState { + return setInternalHelperManager(() => helper, {}); +}
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/log.ts
@@ -1,6 +1,7 @@ import { VMArguments } from '@glimmer/interfaces'; import { createComputeRef } from '@glimmer/reference'; import { reifyPositional } from '@glimmer/runtime'; +import { internalHelper } from './internal-helper'; /** @module ember @@ -19,12 +20,12 @@ import { reifyPositional } from '@glimmer/runtime'; @param {Array} params @public */ -export default function (args: VMArguments) { +export default internalHelper((args: VMArguments) => { let positional = args.positional.capture(); return createComputeRef(() => { /* eslint-disable no-console */ console.log(...reifyPositional(positional)); /* eslint-enable no-console */ }); -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/mut.ts
@@ -4,6 +4,7 @@ import { assert } from '@ember/debug'; import { VMArguments } from '@glimmer/interfaces'; import { createInvokableRef, isUpdatableRef } from '@glimmer/reference'; +import { internalHelper } from './internal-helper'; /** The `mut` helper lets you __clearly specify__ that a child `Component` can update the @@ -79,7 +80,7 @@ import { createInvokableRef, isUpdatableRef } from '@glimmer/reference'; @public */ -export default function (args: VMArguments) { +export default internalHelper((args: VMArguments) => { let ref = args.positional.at(0); // TODO: Improve this error message. This covers at least two distinct @@ -97,4 +98,4 @@ export default function (args: VMArguments) { assert('You can only pass a path to mut', isUpdatableRef(ref)); return createInvokableRef(ref); -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/query-param.ts
@@ -7,6 +7,7 @@ import { assign } from '@ember/polyfills'; import { VMArguments } from '@glimmer/interfaces'; import { createComputeRef } from '@glimmer/reference'; import { reifyNamed } from '@glimmer/runtime'; +import { internalHelper } from './internal-helper'; /** This is a helper to be used in conjunction with the link-to helper. @@ -29,7 +30,7 @@ import { reifyNamed } from '@glimmer/runtime'; @return {Object} A `QueryParams` object for `{{link-to}}` @public */ -export default function (args: VMArguments) { +export default internalHelper((args: VMArguments) => { let { positional, named } = args.capture(); return createComputeRef(() => { @@ -40,4 +41,4 @@ export default function (args: VMArguments) { return new QueryParams(assign({}, reifyNamed(named) as any)); }); -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/readonly.ts
@@ -3,6 +3,7 @@ */ import { VMArguments } from '@glimmer/interfaces'; import { createReadOnlyRef } from '@glimmer/reference'; +import { internalHelper } from './internal-helper'; /** The `readonly` helper let's you specify that a binding is one-way only, @@ -119,6 +120,6 @@ import { createReadOnlyRef } from '@glimmer/reference'; @for Ember.Templates.helpers @private */ -export default function (args: VMArguments) { +export default internalHelper((args: VMArguments) => { return createReadOnlyRef(args.positional.at(0)); -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/helpers/unbound.ts
@@ -5,6 +5,7 @@ import { assert } from '@ember/debug'; import { VMArguments } from '@glimmer/interfaces'; import { createUnboundRef, valueForRef } from '@glimmer/reference'; +import { internalHelper } from './internal-helper'; /** The `{{unbound}}` helper disconnects the one-way binding of a property, @@ -34,11 +35,11 @@ import { createUnboundRef, valueForRef } from '@glimmer/reference'; @public */ -export default function (args: VMArguments) { +export default internalHelper((args: VMArguments) => { assert( 'unbound helper cannot be called with multiple params or hash params', args.positional.length === 1 && args.named.length === 0 ); return createUnboundRef(valueForRef(args.positional.at(0)), '(resurt of an `unbound` helper)'); -} +});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/modifiers/action.ts
@@ -3,6 +3,7 @@ import { ActionManager, isSimpleClick } from '@ember/-internals/views'; import { assert, deprecate } from '@ember/debug'; import { flaggedInstrument } from '@ember/instrumentation'; import { join } from '@ember/runloop'; +import { registerDestructor } from '@glimmer/destroyable'; import { DEBUG } from '@glimmer/env'; import { CapturedNamedArguments, @@ -12,8 +13,8 @@ import { InternalModifierManager, VMArguments, } from '@glimmer/interfaces'; +import { setInternalModifierManager } from '@glimmer/manager'; import { isInvokableRef, updateRef, valueForRef } from '@glimmer/reference'; -import { registerDestructor } from '@glimmer/runtime'; import { createUpdatableTag, UpdatableTag } from '@glimmer/validator'; import { SimpleElement } from '@simple-dom/interface'; import { INVOKE } from '../helpers/action'; @@ -201,12 +202,10 @@ export class ActionState { } } -// implements ModifierManager<Action> -export default class ActionModifierManager - implements InternalModifierManager<ActionState, unknown> { +class ActionModifierManager implements InternalModifierManager<ActionState, object> { create( element: SimpleElement, - _state: unknown, + _state: object, args: VMArguments, _dynamicScope: DynamicScope, dom: GlimmerTreeChanges @@ -310,3 +309,7 @@ export default class ActionModifierManager return actionState; } } + +const ACTION_MODIFIER_MANAGER = new ActionModifierManager(); + +export default setInternalModifierManager(() => ACTION_MODIFIER_MANAGER, {});
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/modifiers/custom.ts
@@ -1,227 +0,0 @@ -import { Factory } from '@ember/-internals/owner'; -import { assert } from '@ember/debug'; -import { DEBUG } from '@glimmer/env'; -import { - Arguments, - InternalModifierManager, - ModifierCapabilities, - ModifierCapabilitiesVersions, - ModifierManager, - VMArguments, -} from '@glimmer/interfaces'; -import { buildCapabilities, registerDestructor, reifyArgs } from '@glimmer/runtime'; -import { - createUpdatableTag, - deprecateMutationsInTrackingTransaction, - untrack, - UpdatableTag, -} from '@glimmer/validator'; -import { SimpleElement } from '@simple-dom/interface'; -import { argsProxyFor } from '../utils/args-proxy'; - -export interface CustomModifierDefinitionState<ModifierInstance> { - ModifierClass: Factory<ModifierInstance>; - name: string; - delegate: ModifierManager<ModifierInstance>; -} - -export function capabilities<Version extends keyof ModifierCapabilitiesVersions>( - managerAPI: Version, - optionalFeatures: ModifierCapabilitiesVersions[Version] = {} -): ModifierCapabilities { - assert( - 'Invalid modifier manager compatibility specified', - managerAPI === '3.13' || managerAPI === '3.22' - ); - - return buildCapabilities({ - disableAutoTracking: Boolean(optionalFeatures.disableAutoTracking), - useArgsProxy: managerAPI === '3.13' ? false : true, - passFactoryToCreate: managerAPI === '3.13', - }); -} - -export class CustomModifierDefinition<ModifierInstance> { - public state: CustomModifierDefinitionState<ModifierInstance>; - public manager: InternalModifierManager< - unknown | null, - CustomModifierDefinitionState<ModifierInstance> - >; - - constructor( - public name: string, - public ModifierClass: Factory<ModifierInstance>, - public delegate: ModifierManager<ModifierInstance>, - isInteractive: boolean - ) { - this.state = { - ModifierClass, - name, - delegate, - }; - - this.manager = isInteractive - ? CUSTOM_INTERACTIVE_MODIFIER_MANAGER - : CUSTOM_NON_INTERACTIVE_MODIFIER_MANAGER; - } -} - -export interface CustomModifierState<ModifierInstance> { - tag: UpdatableTag; - element: SimpleElement; - delegate: ModifierManager<ModifierInstance>; - modifier: ModifierInstance; - args: Arguments; - debugName?: string; -} - -/** - The CustomModifierManager allows addons to provide custom modifier - implementations that integrate seamlessly into Ember. This is accomplished - through a delegate, registered with the custom modifier manager, which - implements a set of hooks that determine modifier behavior. - To create a custom modifier manager, instantiate a new CustomModifierManager - class and pass the delegate as the first argument: - - ```js - let manager = new CustomModifierManager({ - // ...delegate implementation... - }); - ``` - - ## Delegate Hooks - - Throughout the lifecycle of a modifier, the modifier manager will invoke - delegate hooks that are responsible for surfacing those lifecycle changes to - the end developer. - * `createModifier()` - invoked when a new instance of a modifier should be created - * `installModifier()` - invoked when the modifier is installed on the element - * `updateModifier()` - invoked when the arguments passed to a modifier change - * `destroyModifier()` - invoked when the modifier is about to be destroyed -*/ -class InteractiveCustomModifierManager<ModifierInstance> - implements - InternalModifierManager< - CustomModifierState<ModifierInstance>, - CustomModifierDefinitionState<ModifierInstance> - > { - create( - element: SimpleElement, - definition: CustomModifierDefinitionState<ModifierInstance>, - vmArgs: VMArguments - ) { - let { delegate, ModifierClass } = definition; - let capturedArgs = vmArgs.capture(); - - let { useArgsProxy, passFactoryToCreate } = delegate.capabilities; - - let args = useArgsProxy ? argsProxyFor(capturedArgs, 'modifier') : reifyArgs(capturedArgs); - - let instance: ModifierInstance; - - if (DEBUG && deprecateMutationsInTrackingTransaction !== undefined) { - deprecateMutationsInTrackingTransaction(() => { - instance = delegate.createModifier( - passFactoryToCreate ? ModifierClass : ModifierClass.class, - args - ); - }); - } else { - instance = delegate.createModifier( - passFactoryToCreate ? ModifierClass : ModifierClass.class, - args - ); - } - - let tag = createUpdatableTag(); - let state: CustomModifierState<ModifierInstance>; - if (useArgsProxy) { - state = { - tag, - element, - delegate, - args, - modifier: instance!, - }; - } else { - state = { - tag, - element, - delegate, - modifier: instance!, - get args() { - return reifyArgs(capturedArgs); - }, - }; - } - - if (DEBUG) { - state.debugName = definition.name; - } - - registerDestructor(state, () => delegate.destroyModifier(instance, state.args)); - - return state; - } - - getDebugName({ debugName }: CustomModifierState<ModifierInstance>) { - return debugName!; - } - - getTag({ tag }: CustomModifierState<ModifierInstance>) { - return tag; - } - - install(state: CustomModifierState<ModifierInstance>) { - let { element, args, delegate, modifier } = state; - - let { capabilities } = delegate; - - if (capabilities.disableAutoTracking === true) { - untrack(() => delegate.installModifier(modifier, element, args)); - } else { - delegate.installModifier(modifier, element, args); - } - } - - update(state: CustomModifierState<ModifierInstance>) { - let { args, delegate, modifier } = state; - let { capabilities } = delegate; - - if (capabilities.disableAutoTracking === true) { - untrack(() => delegate.updateModifier(modifier, args)); - } else { - delegate.updateModifier(modifier, args); - } - } - - getDestroyable(state: CustomModifierState<ModifierInstance>) { - return state; - } -} - -class NonInteractiveCustomModifierManager<ModifierInstance> - implements InternalModifierManager<null, CustomModifierDefinitionState<ModifierInstance>> { - create() { - return null; - } - - getDebugName() { - return ''; - } - - getTag() { - return null; - } - - install() {} - - update() {} - - getDestroyable() { - return null; - } -} - -const CUSTOM_INTERACTIVE_MODIFIER_MANAGER = new InteractiveCustomModifierManager(); -const CUSTOM_NON_INTERACTIVE_MODIFIER_MANAGER = new NonInteractiveCustomModifierManager();
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/modifiers/internal.ts
@@ -1,14 +1,15 @@ import { Owner, setOwner } from '@ember/-internals/owner'; import { guidFor } from '@ember/-internals/utils'; import { assert } from '@ember/debug'; +import { registerDestructor } from '@glimmer/destroyable'; import { CapturedArguments, Destroyable, InternalModifierManager as ModifierManager, VMArguments, } from '@glimmer/interfaces'; +import { setInternalModifierManager } from '@glimmer/manager'; import { valueForRef } from '@glimmer/reference'; -import { registerDestructor, setModifierManager } from '@glimmer/runtime'; import { SimpleElement } from '@simple-dom/interface'; export default class InternalModifier { @@ -86,7 +87,7 @@ class InternalModifierManager return null; } - getDebugName({ name }: InternalModifierState): string { + getDebugName({ name }: typeof InternalModifier): string { return name; } @@ -104,4 +105,4 @@ class InternalModifierManager } } -setModifierManager((owner: Owner) => new InternalModifierManager(owner), InternalModifier); +setInternalModifierManager((owner: Owner) => new InternalModifierManager(owner), InternalModifier);
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/modifiers/on.ts
@@ -1,9 +1,10 @@ -import { Owner } from '@ember/-internals/owner'; import { assert } from '@ember/debug'; +import { registerDestructor } from '@glimmer/destroyable'; import { DEBUG } from '@glimmer/env'; import { CapturedArguments, InternalModifierManager, VMArguments } from '@glimmer/interfaces'; +import { setInternalModifierManager } from '@glimmer/manager'; import { valueForRef } from '@glimmer/reference'; -import { registerDestructor, reifyNamed } from '@glimmer/runtime'; +import { reifyNamed } from '@glimmer/runtime'; import { createUpdatableTag, UpdatableTag } from '@glimmer/validator'; import { SimpleElement } from '@simple-dom/interface'; import buildUntouchableThis from '../utils/untouchable-this'; @@ -51,7 +52,6 @@ const SUPPORTS_EVENT_OPTIONS = (() => { export class OnModifierState { public tag = createUpdatableTag(); - public owner: Owner; public element: Element; public args: CapturedArguments; public eventName!: string; @@ -63,8 +63,7 @@ export class OnModifierState { public options?: AddEventListenerOptions; public shouldUpdate = true; - constructor(owner: Owner, element: Element, args: CapturedArguments) { - this.owner = owner; + constructor(element: Element, args: CapturedArguments) { this.element = element; this.args = args; } @@ -311,16 +310,8 @@ function addEventListener( @public @since 3.11.0 */ -export default class OnModifierManager - implements InternalModifierManager<OnModifierState | null, unknown> { +class OnModifierManager implements InternalModifierManager<OnModifierState | null, object> { public SUPPORTS_EVENT_OPTIONS: boolean = SUPPORTS_EVENT_OPTIONS; - public isInteractive: boolean; - private owner: Owner; - - constructor(owner: Owner, isInteractive: boolean) { - this.isInteractive = isInteractive; - this.owner = owner; - } getDebugName(): string { return 'on'; @@ -332,16 +323,12 @@ export default class OnModifierManager create( element: SimpleElement | Element, - _state: unknown, + _state: object, args: VMArguments ): OnModifierState | null { - if (!this.isInteractive) { - return null; - } - const capturedArgs = args.capture(); - return new OnModifierState(this.owner, <Element>element, capturedArgs); + return new OnModifierState(<Element>element, capturedArgs); } getTag(state: OnModifierState | null): UpdatableTag | null { @@ -395,3 +382,11 @@ export default class OnModifierManager return state; } } + +const ON_MODIFIER_MANAGER = new OnModifierManager(); + +const on = {}; + +setInternalModifierManager(() => ON_MODIFIER_MANAGER, on); + +export default on;
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/renderer.ts
@@ -3,6 +3,7 @@ import { getOwner, Owner } from '@ember/-internals/owner'; import { getViewElement, getViewId } from '@ember/-internals/views'; import { assert } from '@ember/debug'; import { backburner, getCurrentRunLoop } from '@ember/runloop'; +import { destroy } from '@glimmer/destroyable'; import { DEBUG } from '@glimmer/env'; import { Bounds, @@ -25,7 +26,6 @@ import { clientBuilder, CurriedComponentDefinition, curry, - destroy, DOMChanges, DOMTreeConstruction, inTransaction, @@ -36,13 +36,12 @@ import { unwrapTemplate } from '@glimmer/util'; import { CURRENT_TAG, validateTag, valueForTag } from '@glimmer/validator'; import { SimpleDocument, SimpleElement, SimpleNode } from '@simple-dom/interface'; import RSVP from 'rsvp'; -import CompileTimeResolverImpl from './compile-time-lookup'; -import { BOUNDS } from './component'; +import { BOUNDS } from './component-managers/curly'; import { createRootOutlet } from './component-managers/outlet'; import { RootComponentDefinition } from './component-managers/root'; import { NodeDOMTreeConstruction } from './dom'; import { EmberEnvironmentDelegate } from './environment'; -import RuntimeResolver from './resolver'; +import ResolverImpl from './resolver'; import { Component } from './utils/curly-component-state-bucket'; import { OutletState } from './utils/outlet'; import OutletView from './views/outlet'; @@ -285,7 +284,7 @@ export abstract class Renderer { private _lastRevision = -1; private _destroyed = false; - readonly _runtimeResolver: RuntimeResolver; + readonly _runtimeResolver: ResolverImpl; constructor( owner: Owner, @@ -304,12 +303,11 @@ export abstract class Renderer { this._builder = builder; // resolver is exposed for tests - let runtimeResolver = (this._runtimeResolver = new RuntimeResolver(owner, env.isInteractive)); - let compileTimeResolver = new CompileTimeResolverImpl(runtimeResolver); + let resolver = (this._runtimeResolver = new ResolverImpl()); let sharedArtifacts = artifacts(); - this._context = programCompilationContext(sharedArtifacts, compileTimeResolver); + this._context = programCompilationContext(sharedArtifacts, resolver); let runtimeEnvironmentDelegate = new EmberEnvironmentDelegate(owner, env.isInteractive); this._runtime = runtimeContext( @@ -321,7 +319,7 @@ export abstract class Renderer { }, runtimeEnvironmentDelegate, sharedArtifacts, - runtimeResolver + resolver ); } @@ -333,19 +331,19 @@ export abstract class Renderer { debugRenderTree ); - return debugRenderTree!; + return debugRenderTree; } // renderer HOOKS - appendOutletView(view: OutletView, target: SimpleElement) { + appendOutletView(view: OutletView, target: SimpleElement): void { let definition = createRootOutlet(view); - this._appendDefinition(view, curry(definition), target); + this._appendDefinition(view, curry(definition, null), target); } - appendTo(view: Component, target: SimpleElement) { + appendTo(view: Component, target: SimpleElement): void { let definition = new RootComponentDefinition(view); - this._appendDefinition(view, curry(definition), target); + this._appendDefinition(view, curry(definition, null), target); } _appendDefinition(
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/resolver.ts
@@ -1,43 +1,40 @@ import { privatize as P } from '@ember/-internals/container'; import { ENV } from '@ember/-internals/environment'; import { Factory, FactoryClass, LookupOptions, Owner } from '@ember/-internals/owner'; -import { EMBER_GLIMMER_HELPER_MANAGER } from '@ember/canary-features'; -import { isTemplateOnlyComponent } from '@ember/component/template-only'; import { assert, deprecate } from '@ember/debug'; import { PARTIALS } from '@ember/deprecated-features'; import EmberError from '@ember/error'; import { _instrumentStart } from '@ember/instrumentation'; +import { DEBUG } from '@glimmer/env'; import { - ComponentDefinition, - Helper, + CompileTimeResolver, + HelperDefinitionState, + ModifierDefinitionState, Option, PartialDefinition, + ResolvedComponentDefinition, RuntimeResolver, Template, TemplateFactory, } from '@glimmer/interfaces'; -import { PartialDefinitionImpl } from '@glimmer/opcode-compiler'; import { - getComponentManager, getComponentTemplate, + getInternalComponentManager, + setInternalHelperManager, +} from '@glimmer/manager'; +import { PartialDefinitionImpl } from '@glimmer/opcode-compiler'; +import { getDynamicVar, - getHelperManager, - getModifierManager, - isInternalComponentManager, - isInternalHelper, - isInternalModifierManager, - ModifierDefinition, + TEMPLATE_ONLY_COMPONENT_MANAGER, + templateOnlyComponent, } from '@glimmer/runtime'; -import { CurlyComponentDefinition } from './component-managers/curly'; -import { CustomManagerDefinition } from './component-managers/custom'; -import { InternalComponentDefinition } from './component-managers/internal'; -import { TemplateOnlyComponentDefinition } from './component-managers/template-only'; -import InternalComponent from './components/internal'; +import { _WeakSet } from '@glimmer/util'; +import { CURLY_COMPONENT_MANAGER } from './component-managers/curly'; import { + CLASSIC_HELPER_MANAGER_FACTORY, HelperFactory, HelperInstance, - isClassicHelperManager, - SIMPLE_CLASSIC_HELPER_MANAGER, + isClassicHelper, SimpleHelper, } from './helper'; import { default as componentAssertionHelper } from './helpers/-assert-implicit-component-helper-argument'; @@ -47,20 +44,19 @@ import { default as trackArray } from './helpers/-track-array'; import { default as action } from './helpers/action'; import { default as array } from './helpers/array'; import { default as concat } from './helpers/concat'; -import customHelper from './helpers/custom'; import { default as eachIn } from './helpers/each-in'; import { default as fn } from './helpers/fn'; import { default as get } from './helpers/get'; import { default as hash } from './helpers/hash'; import { inlineIf, inlineUnless } from './helpers/if-unless'; +import { internalHelper } from './helpers/internal-helper'; import { default as log } from './helpers/log'; import { default as mut } from './helpers/mut'; import { default as queryParams } from './helpers/query-param'; import { default as readonly } from './helpers/readonly'; import { default as unbound } from './helpers/unbound'; -import ActionModifierManager from './modifiers/action'; -import { CustomModifierDefinition } from './modifiers/custom'; -import OnModifierManager from './modifiers/on'; +import actionModifier from './modifiers/action'; +import onModifier from './modifiers/on'; import { mountHelper } from './syntax/mount'; import { outletHelper } from './syntax/outlet'; @@ -181,11 +177,7 @@ if (PARTIALS) { }; } -interface IBuiltInHelpers { - [name: string]: Helper | undefined; -} - -const BUILTINS_HELPERS: IBuiltInHelpers = { +const BUILTINS_HELPERS = { if: inlineIf, action, array, @@ -203,226 +195,114 @@ const BUILTINS_HELPERS: IBuiltInHelpers = { '-each-in': eachIn, '-normalize-class': normalizeClassHelper, '-track-array': trackArray, - '-get-dynamic-var': getDynamicVar, + '-get-dynamic-var': internalHelper(getDynamicVar), '-mount': mountHelper, '-outlet': outletHelper, '-assert-implicit-component-helper-argument': componentAssertionHelper, '-in-el-null': inElementNullCheckHelper, }; -interface IBuiltInModifiers { - [name: string]: ModifierDefinition | undefined; -} - -export default class RuntimeResolverImpl implements RuntimeResolver<Owner> { - public isInteractive: boolean; - - private handles: any[] = [ - undefined, // ensure no falsy handle - ]; - private objToHandle = new WeakMap<any, number>(); - - private builtInHelpers: IBuiltInHelpers = BUILTINS_HELPERS; - - private builtInModifiers: IBuiltInModifiers; - - private componentDefinitionCache: Map<object, ComponentDefinition | null> = new Map(); - - public componentDefinitionCount = 0; - public helperDefinitionCount = 0; - - constructor(owner: Owner, isInteractive: boolean) { - this.isInteractive = isInteractive; - - this.builtInModifiers = { - action: { manager: new ActionModifierManager(), state: null }, - on: { manager: new OnModifierManager(owner, isInteractive), state: null }, - }; - } - - /*** IRuntimeResolver ***/ - - /** - * public componentDefHandleCount = 0; - * Called while executing Append Op.PushDynamicComponentManager if string - */ - lookupComponent(name: string, owner: Owner): Option<ComponentDefinition> { - let handle = this.lookupComponentHandle(name, owner); - if (handle === null) { - assert( - `Could not find component named "${name}" (no component or template with that name was found)` - ); - return null; - } - return this.resolve(handle); - } - - lookupComponentHandle(name: string, owner: Owner) { - let nextHandle = this.handles.length; - let handle = this.handle(this._lookupComponentDefinition(name, owner)); - - assert( - 'Could not find component `<TextArea />` (did you mean `<Textarea />`?)', - !(name === 'text-area' && handle === null) - ); - - if (nextHandle === handle) { - this.componentDefinitionCount++; - } - return handle; - } +const BUILTINS_MODIFIERS = { + action: actionModifier, + on: onModifier, +}; - /** - * Called by RuntimeConstants to lookup unresolved handles. - */ - resolve<U>(handle: number): U { - return this.handles[handle]; - } - // End IRuntimeResolver - - /** - * Called by CompileTimeLookup compiling Unknown or Helper OpCode - */ - lookupHelper(name: string, owner: Owner): Option<number> { - let nextHandle = this.handles.length; - let helper = this._lookupHelper(name, owner); - if (helper !== null) { - let handle = this.handle(helper); - - if (nextHandle === handle) { - this.helperDefinitionCount++; - } - return handle; - } - return null; - } +const CLASSIC_HELPER_MANAGER_ASSOCIATED = new _WeakSet(); - /** - * Called by CompileTimeLookup compiling the - */ - lookupModifier(name: string, owner: Owner): Option<number> { - return this.handle(this._lookupModifier(name, owner)); - } +export default class ResolverImpl implements RuntimeResolver<Owner>, CompileTimeResolver<Owner> { + private componentDefinitionCache: Map<object, ResolvedComponentDefinition | null> = new Map(); - /** - * Called by CompileTimeLookup to lookup partial - */ - lookupPartial(name: string, owner: Owner): Option<number> { + lookupPartial(name: string, owner: Owner): Option<PartialDefinition> { if (PARTIALS) { - let partial = this._lookupPartial(name, owner); - return this.handle(partial); - } else { - return null; - } - } - - // TODO: This isn't necessary in all embedding environments, we should likely - // make it optional within Glimmer-VM - compilable(): any {} + let templateFactory = lookupPartial(name, owner); + let template = templateFactory(owner); - // end CompileTimeLookup - - // needed for lazy compile time lookup - private handle(obj: unknown) { - if (obj === undefined || obj === null) { + return new PartialDefinitionImpl(name, template); + } else { return null; } - let handle: number | undefined = this.objToHandle.get(obj); - if (handle === undefined) { - handle = this.handles.push(obj) - 1; - this.objToHandle.set(obj, handle); - } - return handle; } - private _lookupHelper(_name: string, owner: Owner): Option<Helper> { + lookupHelper(name: string, owner: Owner): Option<HelperDefinitionState> { assert( - `You attempted to overwrite the built-in helper "${_name}" which is not allowed. Please rename the helper.`, - !(this.builtInHelpers[_name] && owner.hasRegistration(`helper:${_name}`)) + `You attempted to overwrite the built-in helper "${name}" which is not allowed. Please rename the helper.`, + !(BUILTINS_HELPERS[name] && owner.hasRegistration(`helper:${name}`)) ); - const helper = this.builtInHelpers[_name]; + const helper = BUILTINS_HELPERS[name]; if (helper !== undefined) { return helper; } - let name = _name; - - const factory = - owner.factoryFor<SimpleHelper | HelperInstance, HelperFactory<SimpleHelper | HelperInstance>>( - `helper:${name}` - ) || owner.factoryFor(`helper:${name}`); + const factory = owner.factoryFor< + SimpleHelper | HelperInstance, + HelperFactory<SimpleHelper | HelperInstance> + >(`helper:${name}`); - if (factory === undefined || factory.class === undefined) { + if (factory === undefined) { return null; } - const manager = getHelperManager(owner, factory.class); + let definition = factory.class; - if (manager === undefined) { + if (definition === undefined) { return null; } - assert( - 'helper managers have not been enabled yet, you must use classic helpers', - EMBER_GLIMMER_HELPER_MANAGER || - isClassicHelperManager(manager) || - manager === SIMPLE_CLASSIC_HELPER_MANAGER - ); - - assert( - `internal helpers are not supported via \`getHelperManager\` yet, found an internal manager for ${name}`, - !isInternalHelper(manager) - ); - - // For classic class based helpers, we need to pass the factoryFor result itself rather - // than the raw value (`factoryFor(...).class`). This is because injections are already - // bound in the factoryFor result, including type-based injections - return customHelper(manager, isClassicHelperManager(manager) ? factory : factory.class); - } + if (typeof definition === 'function' && isClassicHelper(definition)) { + // For classic class based helpers, we need to pass the factoryFor result itself rather + // than the raw value (`factoryFor(...).class`). This is because injections are already + // bound in the factoryFor result, including type-based injections + + if (DEBUG) { + // In DEBUG we need to only set the associated value once, otherwise + // we'll trigger an assertion + if (!CLASSIC_HELPER_MANAGER_ASSOCIATED.has(factory)) { + CLASSIC_HELPER_MANAGER_ASSOCIATED.add(factory); + setInternalHelperManager(CLASSIC_HELPER_MANAGER_FACTORY, factory); + } + } else { + setInternalHelperManager(CLASSIC_HELPER_MANAGER_FACTORY, factory); + } - private _lookupPartial(name: string, owner: Owner): PartialDefinition { - let templateFactory = lookupPartial(name, owner); - let template = templateFactory(owner); + return factory; + } - return new PartialDefinitionImpl(name, template); + return definition; } - private _lookupModifier(name: string, owner: Owner) { - let builtin = this.builtInModifiers[name]; + lookupModifier(name: string, owner: Owner): Option<ModifierDefinitionState> { + let builtin = BUILTINS_MODIFIERS[name]; - if (builtin === undefined) { - let modifier = owner.factoryFor<unknown, FactoryClass>(`modifier:${name}`); - if (modifier !== undefined) { - let manager = getModifierManager(owner, modifier.class!); + if (builtin !== undefined) { + return builtin; + } - assert(`Expected a modifier manager to exist, but did not find one for ${name}`, manager); + let modifier = owner.factoryFor<unknown, FactoryClass>(`modifier:${name}`); - assert( - `Internal modifier managers are not supported via \`getModifierManager\` yet, found an internal manager for ${name}`, - !isInternalModifierManager(manager) - ); - - return new CustomModifierDefinition(name, modifier, manager, this.isInteractive); - } + if (modifier === undefined) { + return null; } - return builtin; + return modifier.class || null; } - private _lookupComponentDefinition(_name: string, owner: Owner): Option<ComponentDefinition> { - let name = _name; - + lookupComponent(name: string, owner: Owner): ResolvedComponentDefinition | null { let pair = lookupComponentPair(owner, name); + if (pair === null) { + assert( + 'Could not find component `<TextArea />` (did you mean `<Textarea />`?)', + name !== 'text-area' + ); return null; } - let layout: Template | undefined; + let template: Template | null = null; let key: object; if (pair.component === null) { - key = layout = pair.layout!(owner); + key = template = pair.layout!(owner); } else { key = pair.component; } @@ -432,60 +312,50 @@ export default class RuntimeResolverImpl implements RuntimeResolver<Owner> { return cachedComponentDefinition; } - if (layout === undefined && pair.layout !== null) { - layout = pair.layout(owner); + if (template === null && pair.layout !== null) { + template = pair.layout(owner); } let finalizer = _instrumentStart('render.getComponentDefinition', instrumentationPayload, name); - let definition: Option<ComponentDefinition> = null; + let definition: Option<ResolvedComponentDefinition> = null; if (pair.component === null) { if (ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS) { - definition = new TemplateOnlyComponentDefinition(name, layout!); + definition = { + state: templateOnlyComponent(undefined, name), + manager: TEMPLATE_ONLY_COMPONENT_MANAGER, + template, + }; + } else { + definition = { + state: owner.factoryFor(P`component:-default`)!, + manager: CURLY_COMPONENT_MANAGER, + template, + }; } - } else if (isTemplateOnlyComponent(pair.component.class)) { - definition = new TemplateOnlyComponentDefinition(name, layout!); - } - - if (pair.component !== null) { + } else { assert(`missing component class ${name}`, pair.component.class !== undefined); - let ComponentClass = pair.component.class!; - let manager = getComponentManager(owner, ComponentClass); - - if (manager !== undefined) { - if (isInternalComponentManager(manager)) { - assert(`missing layout for internal component ${name}`, pair.layout !== null); - - definition = new InternalComponentDefinition( - manager, - ComponentClass as typeof InternalComponent, - layout! - ); - } else { - definition = new CustomManagerDefinition( - name, - pair.component, - manager, - layout !== undefined - ? layout - : owner.lookup<TemplateFactory>(P`template:components/-default`)!(owner) - ); - } - } - } + let factory = pair.component; + let ComponentClass = factory.class!; + let manager = getInternalComponentManager(owner, ComponentClass); - if (definition === null) { - definition = new CurlyComponentDefinition( - name, - pair.component || owner.factoryFor(P`component:-default`), - layout - ); + definition = { + state: manager === CURLY_COMPONENT_MANAGER ? factory : ComponentClass, + manager, + template, + }; } finalizer(); this.componentDefinitionCache.set(key, definition); + + assert( + 'Could not find component `<TextArea />` (did you mean `<Textarea />`?)', + !(definition === null && name === 'text-area') + ); + return definition; } }
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/setup-registry.ts
@@ -9,7 +9,6 @@ import TextArea from './components/textarea'; import { clientBuilder, rehydrationBuilder, serializeBuilder } from './dom'; import loc from './helpers/loc'; import { InertRenderer, InteractiveRenderer } from './renderer'; -import ComponentTemplate from './templates/component'; import InputTemplate from './templates/input'; import OutletTemplate from './templates/outlet'; import RootTemplate from './templates/root'; @@ -54,8 +53,6 @@ export function setupEngineRegistry(registry: Registry) { registry.register('template:-outlet', OutletTemplate as any); registry.injection('view:-outlet', 'template', 'template:-outlet'); - registry.register(P`template:components/-default`, ComponentTemplate as any); - registry.optionsForType('helper', { instantiate: false }); registry.register('helper:loc', loc);
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/syntax/mount.ts
@@ -13,6 +13,7 @@ import { EMPTY_POSITIONAL, } from '@glimmer/runtime'; import { MountDefinition } from '../component-managers/mount'; +import { internalHelper } from '../helpers/internal-helper'; /** The `{{mount}}` helper lets you embed a routeless engine in a template. @@ -54,73 +55,75 @@ import { MountDefinition } from '../component-managers/mount'; @for Ember.Templates.helpers @public */ -export function mountHelper( - args: VMArguments, - vm: VM -): Reference<CurriedComponentDefinition | null> { - let env = vm.env as Environment<Owner>; - let nameRef = args.positional.at(0) as Reference<Option<string>>; - let captured: Option<CapturedArguments> = null; - - assert( - 'You can only pass a single positional argument to the {{mount}} helper, e.g. {{mount "chat-engine"}}.', - args.positional.length === 1 - ); - - if (DEBUG && args.named) { - let keys = args.named.names; - let extra = keys.filter((k) => k !== 'model'); +export const mountHelper = internalHelper( + (args: VMArguments, vm: VM): Reference<CurriedComponentDefinition | null> => { + let env = vm.env as Environment<Owner>; + let nameRef = args.positional.at(0) as Reference<Option<string>>; + let captured: Option<CapturedArguments> = null; assert( - 'You can only pass a `model` argument to the {{mount}} helper, ' + - 'e.g. {{mount "profile-engine" model=this.profile}}. ' + - `You passed ${extra.join(',')}.`, - extra.length === 0 + 'You can only pass a single positional argument to the {{mount}} helper, e.g. {{mount "chat-engine"}}.', + args.positional.length === 1 ); - } - // TODO: the functionality to create a proper CapturedArgument should be - // exported by glimmer, or that it should provide an overload for `curry` - // that takes `PreparedArguments` - if (args.named.has('model')) { - assert('[BUG] this should already be checked by the macro', args.named.length === 1); + if (DEBUG && args.named) { + let keys = args.named.names; + let extra = keys.filter((k) => k !== 'model'); - let named = args.named.capture(); + assert( + 'You can only pass a `model` argument to the {{mount}} helper, ' + + 'e.g. {{mount "profile-engine" model=this.profile}}. ' + + `You passed ${extra.join(',')}.`, + extra.length === 0 + ); + } - captured = createCapturedArgs(named, EMPTY_POSITIONAL); - } + // TODO: the functionality to create a proper CapturedArgument should be + // exported by glimmer, or that it should provide an overload for `curry` + // that takes `PreparedArguments` + if (args.named.has('model')) { + assert( + '[BUG] this should already be checked by the template transform', + args.named.length === 1 + ); - let lastName: Option<string>, lastDef: Option<CurriedComponentDefinition>; + let named = args.named.capture(); - return createComputeRef(() => { - let name = valueForRef(nameRef); + captured = createCapturedArgs(named, EMPTY_POSITIONAL); + } - if (typeof name === 'string') { - if (lastName === name) { - return lastDef; - } + let lastName: Option<string>, lastDef: Option<CurriedComponentDefinition>; - assert( - `You used \`{{mount '${name}'}}\`, but the engine '${name}' can not be found.`, - env.owner.hasRegistration(`engine:${name}`) - ); + return createComputeRef(() => { + let name = valueForRef(nameRef); - if (!env.owner.hasRegistration(`engine:${name}`)) { - return null; - } + if (typeof name === 'string') { + if (lastName === name) { + return lastDef; + } - lastName = name; - lastDef = curry(new MountDefinition(name), captured); + assert( + `You used \`{{mount '${name}'}}\`, but the engine '${name}' can not be found.`, + env.owner.hasRegistration(`engine:${name}`) + ); - return lastDef; - } else { - assert( - `Invalid engine name '${name}' specified, engine name must be either a string, null or undefined.`, - name === null || name === undefined - ); - lastDef = null; - lastName = null; - return null; - } - }); -} + if (!env.owner.hasRegistration(`engine:${name}`)) { + return null; + } + + lastName = name; + lastDef = curry(new MountDefinition(name), captured); + + return lastDef; + } else { + assert( + `Invalid engine name '${name}' specified, engine name must be either a string, null or undefined.`, + name === null || name === undefined + ); + lastDef = null; + lastName = null; + return null; + } + }); + } +);
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/syntax/outlet.ts
@@ -16,6 +16,7 @@ import { } from '@glimmer/runtime'; import { dict } from '@glimmer/util'; import { OutletComponentDefinition, OutletDefinitionState } from '../component-managers/outlet'; +import { internalHelper } from '../helpers/internal-helper'; import { DynamicScope } from '../renderer'; import { isTemplateFactory } from '../template'; import { OutletState } from '../utils/outlet'; @@ -67,7 +68,7 @@ import { OutletState } from '../utils/outlet'; @for Ember.Templates.helpers @public */ -export function outletHelper(args: VMArguments, vm: VM) { +export const outletHelper = internalHelper((args: VMArguments, vm: VM) => { let scope = vm.dynamicScope() as DynamicScope; let nameRef: Reference<string>; @@ -110,7 +111,7 @@ export function outletHelper(args: VMArguments, vm: VM) { return definition; }); -} +}); function stateFor(ref: Reference<OutletState | undefined>): OutletDefinitionState | null { let outlet = valueForRef(ref);
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/templates/component.d.ts
@@ -1,3 +0,0 @@ -import { TemplateFactory } from '@glimmer/interfaces'; -declare const TEMPLATE: TemplateFactory; -export default TEMPLATE;
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/templates/component.hbs
@@ -1 +0,0 @@ -{{yield}} \ No newline at end of file
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/utils/args-proxy.ts
@@ -1,210 +0,0 @@ -import { CUSTOM_TAG_FOR } from '@ember/-internals/metal'; -import { HAS_NATIVE_PROXY } from '@ember/-internals/utils'; -import { assert } from '@ember/debug'; -import { DEBUG } from '@glimmer/env'; -import { - Arguments, - CapturedArguments, - CapturedNamedArguments, - CapturedPositionalArguments, -} from '@glimmer/interfaces'; -import { Reference, valueForRef } from '@glimmer/reference'; -import { Tag, track } from '@glimmer/validator'; - -function convertToInt(prop: number | string | symbol): number | null { - if (typeof prop === 'symbol') return null; - - const num = Number(prop); - - if (isNaN(num)) return null; - - return num % 1 === 0 ? num : null; -} - -function tagForNamedArg(namedArgs: CapturedNamedArguments, key: string): Tag { - return track(() => { - if (key in namedArgs) { - valueForRef(namedArgs[key]); - } - }); -} - -function tagForPositionalArg(positionalArgs: CapturedPositionalArguments, key: string): Tag { - return track(() => { - if (key === '[]') { - // consume all of the tags in the positional array - positionalArgs.forEach(valueForRef); - } - - const parsed = convertToInt(key); - - if (parsed !== null && parsed < positionalArgs.length) { - // consume the tag of the referenced index - valueForRef(positionalArgs[parsed]); - } - }); -} - -export let argsProxyFor: ( - capturedArgs: CapturedArguments, - type: 'component' | 'helper' | 'modifier' -) => Arguments; - -if (HAS_NATIVE_PROXY) { - argsProxyFor = (capturedArgs, type) => { - const { named, positional } = capturedArgs; - - let getNamedTag = (key: string) => tagForNamedArg(named, key); - let getPositionalTag = (key: string) => tagForPositionalArg(positional, key); - - const namedHandler: ProxyHandler<{}> = { - get(_target, prop) { - const ref = named[prop as string]; - - if (ref !== undefined) { - return valueForRef(ref); - } else if (prop === CUSTOM_TAG_FOR) { - return getNamedTag; - } - }, - - has(_target, prop) { - return prop in named; - }, - - ownKeys(_target) { - return Object.keys(named); - }, - - isExtensible() { - return false; - }, - - getOwnPropertyDescriptor(_target, prop) { - assert( - 'args proxies do not have real property descriptors, so you should never need to call getOwnPropertyDescriptor yourself. This code exists for enumerability, such as in for-in loops and Object.keys()', - prop in named - ); - - return { - enumerable: true, - configurable: true, - }; - }, - }; - - const positionalHandler: ProxyHandler<[]> = { - get(target, prop) { - if (prop === 'length') { - return positional.length; - } - - const parsed = convertToInt(prop); - - if (parsed !== null && parsed < positional.length) { - return valueForRef(positional[parsed]); - } - - if (prop === CUSTOM_TAG_FOR) { - return getPositionalTag; - } - - return (target as any)[prop]; - }, - - isExtensible() { - return false; - }, - - has(_target, prop) { - const parsed = convertToInt(prop); - - return parsed !== null && parsed < positional.length; - }, - }; - - const namedTarget = Object.create(null); - const positionalTarget: unknown[] = []; - - if (DEBUG) { - const setHandler = function (_target: unknown, prop: symbol | string | number): never { - throw new Error( - `You attempted to set ${String( - prop - )} on the arguments of a component, helper, or modifier. Arguments are immutable and cannot be updated directly, they always represent the values that is passed down. If you want to set default values, you should use a getter and local tracked state instead.` - ); - }; - - const forInDebugHandler = (): never => { - throw new Error( - `Object.keys() was called on the positional arguments array for a ${type}, which is not supported. This function is a low-level function that should not need to be called for positional argument arrays. You may be attempting to iterate over the array using for...in instead of for...of.` - ); - }; - - namedHandler.set = setHandler; - positionalHandler.set = setHandler; - positionalHandler.ownKeys = forInDebugHandler; - } - - return { - named: new Proxy(namedTarget, namedHandler), - positional: new Proxy(positionalTarget, positionalHandler), - }; - }; -} else { - argsProxyFor = (capturedArgs, _type) => { - const { named, positional } = capturedArgs; - - let getNamedTag = (key: string) => tagForNamedArg(named, key); - let getPositionalTag = (key: string) => tagForPositionalArg(positional, key); - - let namedProxy = {}; - - Object.defineProperty(namedProxy, CUSTOM_TAG_FOR, { - configurable: false, - enumerable: false, - value: getNamedTag, - }); - - Object.keys(named).forEach((name) => { - Object.defineProperty(namedProxy, name, { - enumerable: true, - configurable: true, - get() { - return valueForRef(named[name]); - }, - }); - }); - - let positionalProxy: unknown[] = []; - - Object.defineProperty(positionalProxy, CUSTOM_TAG_FOR, { - configurable: false, - enumerable: false, - value: getPositionalTag, - }); - - positional.forEach((ref: Reference, index: number) => { - Object.defineProperty(positionalProxy, index, { - enumerable: true, - configurable: true, - get() { - return valueForRef(ref); - }, - }); - }); - - if (DEBUG) { - // Prevent mutations in development mode. This will not prevent the - // proxy from updating, but will prevent assigning new values or pushing - // for instance. - Object.freeze(namedProxy); - Object.freeze(positionalProxy); - } - - return { - named: namedProxy, - positional: positionalProxy, - }; - }; -}
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/utils/curly-component-state-bucket.ts
@@ -1,12 +1,12 @@ import { clearElementView, clearViewElement, getViewElement } from '@ember/-internals/views'; +import { registerDestructor } from '@glimmer/destroyable'; import { CapturedNamedArguments, Environment, Template, TemplateFactory, } from '@glimmer/interfaces'; import { createConstRef, Reference } from '@glimmer/reference'; -import { registerDestructor } from '@glimmer/runtime'; import { beginUntrackFrame, endUntrackFrame, Revision, Tag, valueForTag } from '@glimmer/validator'; import { Renderer } from '../renderer';
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/utils/managers.ts
@@ -2,7 +2,7 @@ import { Owner } from '@ember/-internals/owner'; import { deprecate } from '@ember/debug'; import { COMPONENT_MANAGER_STRING_LOOKUP } from '@ember/deprecated-features'; import { ComponentManager } from '@glimmer/interfaces'; -import { setComponentManager as glimmerSetComponentManager } from '@glimmer/runtime'; +import { setComponentManager as glimmerSetComponentManager } from '@glimmer/manager'; export function setComponentManager( stringOrFunction: string | ((owner: Owner) => ComponentManager<unknown>),
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/lib/utils/process-args.ts
@@ -2,7 +2,7 @@ import { symbol } from '@ember/-internals/utils'; import { MUTABLE_CELL } from '@ember/-internals/views'; import { CapturedNamedArguments } from '@glimmer/interfaces'; import { isUpdatableRef, updateRef, valueForRef } from '@glimmer/reference'; -import { ARGS } from '../component'; +import { ARGS } from '../component-managers/curly'; import { ACTIONS } from '../helpers/action'; // ComponentArgs takes EvaluatedNamedArgs and converts them into the
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts
@@ -6,20 +6,16 @@ import { } from 'internal-test-helpers'; import { ENV } from '@ember/-internals/environment'; -import { - capabilities, - Component, - setComponentManager, - setComponentTemplate, -} from '@ember/-internals/glimmer'; +import { Component, setComponentManager } from '@ember/-internals/glimmer'; import { EngineInstanceOptions, Owner } from '@ember/-internals/owner'; import { Route } from '@ember/-internals/routing'; -import templateOnly from '@ember/component/template-only'; import Controller from '@ember/controller'; import { captureRenderTree } from '@ember/debug'; import Engine from '@ember/engine'; import EngineInstance from '@ember/engine/instance'; import { CapturedRenderNode } from '@glimmer/interfaces'; +import { componentCapabilities, setComponentTemplate } from '@glimmer/manager'; +import { templateOnlyComponent } from '@glimmer/runtime'; import { expect } from '@glimmer/util'; import { SimpleElement, SimpleNode } from '@simple-dom/interface'; import { compile } from 'ember-template-compiler'; @@ -957,7 +953,7 @@ if (ENV._DEBUG_RENDER_TREE) { ); this.addComponent('hello-world', { - ComponentClass: templateOnly(), + ComponentClass: templateOnlyComponent(), template: '{{@name}}', }); @@ -1032,7 +1028,7 @@ if (ENV._DEBUG_RENDER_TREE) { this.addComponent('hello-world', { ComponentClass: setComponentTemplate( compile('{{@name}}', { moduleName: 'my-app/components/hello-world.hbs' }), - templateOnly() + templateOnlyComponent() ), }); @@ -1180,7 +1176,7 @@ if (ENV._DEBUG_RENDER_TREE) { this.addComponent('hello-world', { ComponentClass: setComponentManager((_owner) => { return { - capabilities: capabilities('3.13', {}), + capabilities: componentCapabilities('3.13', {}), createComponent(_, { named: { name } }) { return { name };
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/components/angle-bracket-invocation-test.js
@@ -1,7 +1,6 @@ import { moduleFor, RenderingTestCase, strip, classes, runTask } from 'internal-test-helpers'; -import { setModifierManager } from '@glimmer/runtime'; +import { setModifierManager, modifierCapabilities } from '@glimmer/manager'; import { ENV } from '@ember/-internals/environment'; -import { modifierCapabilities } from '@ember/-internals/glimmer'; import { Object as EmberObject } from '@ember/-internals/runtime'; import { set, setProperties } from '@ember/-internals/metal';
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/components/component-template-test.js
@@ -3,8 +3,8 @@ import { moduleFor, RenderingTestCase, runTask } from 'internal-test-helpers'; import { HAS_NATIVE_SYMBOL } from '@ember/-internals/utils'; +import { setComponentTemplate, getComponentTemplate } from '@glimmer/manager'; import { Component, compile } from '../../utils/helpers'; -import { setComponentTemplate, getComponentTemplate } from '../../..'; moduleFor( 'Components test: setComponentTemplate',
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/components/contextual-components-test.js
@@ -1,3 +1,4 @@ +import { DEBUG } from '@glimmer/env'; import { moduleFor, RenderingTestCase, applyMixins, strip, runTask } from 'internal-test-helpers'; import { assign } from '@ember/polyfills'; @@ -584,14 +585,24 @@ moduleFor( this.assertText('hello Alex'); } - ['@test raises an assertion when component path is not a component name (static)']() { - expectAssertion(() => { + ['@test raises an assertion when component path is not a component name (static)'](assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { this.render('{{component (component "not-a-component")}}'); }, 'Could not find component named "not-a-component" (no component or template with that name was found)'); } - ['@test raises an assertion when component path is not a component name (dynamic)']() { - expectAssertion(() => { + ['@test raises an assertion when component path is not a component name (dynamic)'](assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { this.render('{{component (component compName)}}', { compName: 'not-a-component', });
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/components/dynamic-components-test.js
@@ -1,3 +1,4 @@ +import { DEBUG } from '@glimmer/env'; import { moduleFor, RenderingTestCase, strip, runTask } from 'internal-test-helpers'; import { set, computed } from '@ember/-internals/metal'; @@ -517,18 +518,28 @@ moduleFor( this.assertText('yippie! Caracas yummy Caracas arepas!'); } - ['@test component with dynamic name argument resolving to non-existent component']() { - expectAssertion(() => { + ['@test component with dynamic name argument resolving to non-existent component'](assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { this.render('{{component componentName}}', { componentName: 'does-not-exist', }); - }, /Could not find component named "does-not-exist"/); + }, /Attempted to resolve `does-not-exist`, which was expected to be a component, but nothing was found./); } - ['@test component with static name argument for non-existent component']() { - expectAssertion(() => { + ['@test component with static name argument for non-existent component'](assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { this.render('{{component "does-not-exist"}}'); - }, /Could not find component named "does-not-exist"/); + }, /Attempted to resolve `does-not-exist`, which was expected to be a component, but nothing was found./); } ['@test component with dynamic component name resolving to a component, then non-existent component']() {
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/components/template-only-components-test.js
@@ -1,7 +1,7 @@ import { moduleFor, RenderingTestCase, classes, runTask } from 'internal-test-helpers'; import { ENV } from '@ember/-internals/environment'; -import { setComponentTemplate } from '@ember/-internals/glimmer'; -import templateOnly from '@ember/component/template-only'; +import { setComponentTemplate } from '@glimmer/manager'; +import { templateOnlyComponent } from '@glimmer/runtime'; import { compile } from 'ember-template-compiler'; import { Object as EmberObject } from '@ember/-internals/runtime'; import { Component } from '../../utils/helpers'; @@ -268,7 +268,10 @@ moduleFor( 'Components test: template-only components (using `templateOnlyComponent()`)', class extends RenderingTestCase { ['@test it can render a component']() { - this.registerComponent('foo-bar', { ComponentClass: templateOnly(), template: 'hello' }); + this.registerComponent('foo-bar', { + ComponentClass: templateOnlyComponent(), + template: 'hello', + }); this.render('{{foo-bar}}'); @@ -278,7 +281,7 @@ moduleFor( } ['@test it can render a component when template was not registered']() { - let ComponentClass = templateOnly(); + let ComponentClass = templateOnlyComponent(); setComponentTemplate(compile('hello'), ComponentClass); this.registerComponent('foo-bar', { ComponentClass }); @@ -291,7 +294,7 @@ moduleFor( } ['@test setComponentTemplate takes precedence over registered layout']() { - let ComponentClass = templateOnly(); + let ComponentClass = templateOnlyComponent(); setComponentTemplate(compile('hello'), ComponentClass); this.registerComponent('foo-bar', { @@ -309,7 +312,7 @@ moduleFor( ['@test templateOnly accepts a moduleName to be used for debugging / toString purposes']( assert ) { - let ComponentClass = templateOnly('my-app/components/foo'); + let ComponentClass = templateOnlyComponent('my-app/components/foo'); assert.equal(`${ComponentClass}`, 'my-app/components/foo'); }
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/custom-component-manager-test.js
@@ -1,12 +1,13 @@ import { DEBUG } from '@glimmer/env'; import { moduleFor, RenderingTestCase, runTask, strip } from 'internal-test-helpers'; +import { componentCapabilities } from '@glimmer/manager'; import { Object as EmberObject } from '@ember/-internals/runtime'; import { set, setProperties, computed, tracked } from '@ember/-internals/metal'; -import { setComponentManager, capabilities } from '@ember/-internals/glimmer'; +import { setComponentManager } from '@ember/-internals/glimmer'; const BasicComponentManager = EmberObject.extend({ - capabilities: capabilities('3.4'), + capabilities: componentCapabilities('3.4'), createComponent(factory, args) { return factory.create({ args }); @@ -38,7 +39,7 @@ class ComponentManagerTest extends RenderingTestCase { super(...arguments); InstrumentedComponentManager = EmberObject.extend({ - capabilities: capabilities('3.4', { + capabilities: componentCapabilities('3.4', { destructor: true, asyncLifecycleCallbacks: true, }), @@ -129,7 +130,7 @@ moduleFor( ['@test it can have no template context']() { let ComponentClass = setComponentManager(() => { return EmberObject.create({ - capabilities: capabilities('3.4'), + capabilities: componentCapabilities('3.4'), createComponent() { return null; @@ -157,7 +158,7 @@ moduleFor( class Base {} setComponentManager(() => { return EmberObject.create({ - capabilities: capabilities('3.4'), + capabilities: componentCapabilities('3.4'), createComponent(Factory, args) { return new Factory(args); @@ -216,7 +217,7 @@ moduleFor( let ComponentClass = setComponentManager( () => { return EmberObject.create({ - capabilities: capabilities('3.4'), + capabilities: componentCapabilities('3.4'), createComponent(factory) { return factory.create(); @@ -421,7 +422,7 @@ moduleFor( let ComponentClass = setComponentManager( () => { return EmberObject.create({ - capabilities: capabilities('3.4', { + capabilities: componentCapabilities('3.4', { destructor: true, }), @@ -471,7 +472,7 @@ moduleFor( let ComponentClass = setComponentManager( () => { return EmberObject.create({ - capabilities: capabilities('3.4', { + capabilities: componentCapabilities('3.4', { asyncLifecycleCallbacks: true, }), @@ -675,7 +676,7 @@ moduleFor( ['@test updating attributes triggers updateComponent and didUpdateComponent'](assert) { let TestManager = EmberObject.extend({ - capabilities: capabilities('3.4', { + capabilities: componentCapabilities('3.4', { destructor: true, asyncLifecycleCallbacks: true, }), @@ -742,7 +743,7 @@ moduleFor( return new TestManager(); } - capabilities = capabilities('3.13', { + capabilities = componentCapabilities('3.13', { updateHook: true, }); @@ -798,7 +799,7 @@ moduleFor( assert ) { class TestManager { - capabilities = capabilities('3.13', { + capabilities = componentCapabilities('3.13', { /* implied: updateHook: false */ });
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/custom-modifier-manager-test.js
@@ -1,9 +1,8 @@ import { DEBUG } from '@glimmer/env'; import { moduleFor, RenderingTestCase, runTask } from 'internal-test-helpers'; -import { setModifierManager } from '@glimmer/runtime'; +import { setModifierManager, modifierCapabilities } from '@glimmer/manager'; import { Object as EmberObject } from '@ember/-internals/runtime'; -import { modifierCapabilities } from '@ember/-internals/glimmer'; import { set, tracked } from '@ember/-internals/metal'; import { backtrackingMessageFor } from '../utils/debug-stack';
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/helpers/helper-manager-test.js
@@ -1,12 +1,12 @@ import { DEBUG } from '@glimmer/env'; +import { helperCapabilities, setHelperManager, setModifierManager } from '@glimmer/manager'; import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers'; -import { helperCapabilities } from '@ember/-internals/glimmer'; import { tracked, set } from '@ember/-internals/metal'; import { setOwner } from '@ember/-internals/owner'; import { EMBER_GLIMMER_HELPER_MANAGER } from '@ember/canary-features'; import Service, { inject as service } from '@ember/service'; +import { registerDestructor } from '@glimmer/destroyable'; import { backtrackingMessageFor } from '../../utils/debug-stack'; -import { registerDestructor, setHelperManager, setModifierManager } from '@glimmer/runtime'; class TestHelperManager { capabilities = helperCapabilities('3.23', { @@ -235,31 +235,51 @@ if (EMBER_GLIMMER_HELPER_MANAGER) { }, expectedMessage); } - ['@test asserts against using both `hasValue` and `hasScheduledEffect`']() { - expectAssertion(() => { + ['@test asserts against using both `hasValue` and `hasScheduledEffect`'](assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { helperCapabilities('3.23', { hasValue: true, hasScheduledEffect: true, }); }, /You must pass either the `hasValue` OR the `hasScheduledEffect` capability when defining a helper manager. Passing neither, or both, is not permitted./); } - ['@test asserts requiring either `hasValue` or `hasScheduledEffect`']() { - expectAssertion(() => { + ['@test asserts requiring either `hasValue` or `hasScheduledEffect`'](assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { helperCapabilities('3.23', {}); }, /You must pass either the `hasValue` OR the `hasScheduledEffect` capability when defining a helper manager. Passing neither, or both, is not permitted./); } - ['@test asserts against using `hasScheduledEffect`']() { - expectAssertion(() => { + ['@test asserts against using `hasScheduledEffect`'](assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { helperCapabilities('3.23', { hasScheduledEffect: true, }); }, /The `hasScheduledEffect` capability has not yet been implemented for helper managers. Please pass `hasValue` instead/); } - ['@test asserts against using incorrect version for capabilities']() { - expectAssertion(() => { + ['@test asserts against using incorrect version for capabilities'](assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { helperCapabilities('aoeu', { hasScheduledEffect: true, });
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/helpers/invoke-helper-test.js
@@ -1,18 +1,14 @@ import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers'; -import { - invokeHelper, - Helper, - helper, - Component as EmberComponent, - helperCapabilities, -} from '@ember/-internals/glimmer'; +import { helperCapabilities, setHelperManager } from '@glimmer/manager'; +import { Helper, helper, Component as EmberComponent } from '@ember/-internals/glimmer'; import { tracked, set } from '@ember/-internals/metal'; import { getOwner } from '@ember/-internals/owner'; import { EMBER_GLIMMER_INVOKE_HELPER, EMBER_GLIMMER_HELPER_MANAGER } from '@ember/canary-features'; import Service, { inject as service } from '@ember/service'; import { DEBUG } from '@glimmer/env'; import { getValue } from '@glimmer/validator'; -import { destroy, isDestroyed, registerDestructor, setHelperManager } from '@glimmer/runtime'; +import { destroy, isDestroyed, registerDestructor } from '@glimmer/destroyable'; +import { invokeHelper } from '@glimmer/runtime'; if (EMBER_GLIMMER_INVOKE_HELPER) { moduleFor( @@ -413,8 +409,13 @@ if (EMBER_GLIMMER_INVOKE_HELPER) { assert.verifySteps(['cache', 'context'], 'destructors ran in correct order'); } - '@test throws an error if value is accessed after it is destroyed'() { - expectAssertion(() => { + '@test throws an error if value is accessed after it is destroyed'(assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { let helper = invokeHelper({}, class extends Helper {}); runTask(() => destroy(helper)); @@ -423,16 +424,26 @@ if (EMBER_GLIMMER_INVOKE_HELPER) { }, /You attempted to get the value of a helper after the helper was destroyed, which is not allowed/); } - '@test asserts if no context object is passed'() { - expectAssertion(() => { + '@test asserts if no context object is passed'(assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { invokeHelper(undefined, class extends Helper {}); }, /Expected a context object to be passed as the first parameter to invokeHelper, got undefined/); } - '@test asserts if no manager exists for the helper definition'() { - expectAssertion(() => { + '@test asserts if no manager exists for the helper definition'(assert) { + if (!DEBUG) { + assert.expect(0); + return; + } + + assert.throws(() => { invokeHelper({}, class {}); - }, /Expected a helper definition to be passed as the second parameter to invokeHelper, but no helper manager was found. The definition value that was passed was `.*`. Did you use setHelperManager to associate a helper manager with this value?/); + }, /Attempted to load a helper, but there wasn't a manager associated with the definition. The definition was:/); } } );
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/integration/modifiers/on-test.js
@@ -1,6 +1,8 @@ import { moduleFor, RenderingTestCase, runTask } from 'internal-test-helpers'; import { isChrome, isFirefox } from '@ember/-internals/browser-environment'; import { HAS_NATIVE_PROXY } from '@ember/-internals/utils'; +import { getInternalModifierManager } from '@glimmer/manager'; +import { on } from '@ember/-internals/glimmer'; import { Component } from '../../utils/helpers'; @@ -17,7 +19,7 @@ moduleFor( getOnManagerInstance() { // leveraging private APIs, this can be deleted if these APIs change // but it has been useful to verify some internal details - return this.renderer._runtimeResolver.builtInModifiers.on.manager; + return getInternalModifierManager(this.owner, on); } assertCounts(expected) { @@ -388,7 +390,7 @@ moduleFor( getOnManagerInstance() { // leveraging private APIs, this can be deleted if these APIs change // but it has been useful to verify some internal details - return this.renderer._runtimeResolver.builtInModifiers.on.manager; + return getInternalModifierManager(this.owner, on); } assertCounts(expected) {
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/unit/runtime-resolver-cache-test.js
@@ -224,7 +224,7 @@ moduleFor( } getCacheCounters() { - let { componentDefinitionCount, helperDefinitionCount } = this.renderer._runtimeResolver; + let { componentDefinitionCount, helperDefinitionCount } = this.renderer._context.constants; return (this._counters = { templateCacheHits: templateCacheCounters.cacheHit || 0,
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/glimmer/tests/utils/glimmerish-component.js
@@ -1,9 +1,10 @@ -import { setComponentManager, capabilities } from '@ember/-internals/glimmer'; +import { componentCapabilities } from '@glimmer/manager'; +import { setComponentManager } from '@ember/-internals/glimmer'; import { setOwner } from '@ember/-internals/owner'; class GlimmerishComponentManager { constructor(owner) { - this.capabilities = capabilities('3.13', { updateHook: false }); + this.capabilities = componentCapabilities('3.13', { updateHook: false }); this.owner = owner; }
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/meta/lib/meta.ts
@@ -1,7 +1,7 @@ import { symbol, toString } from '@ember/-internals/utils'; import { assert, deprecate } from '@ember/debug'; +import { isDestroyed, isDestroying } from '@glimmer/destroyable'; import { DEBUG } from '@glimmer/env'; -import { isDestroyed, isDestroying } from '@glimmer/runtime'; import { Revision, UpdatableTag } from '@glimmer/validator'; type ObjMap<T> = { [key: string]: T };
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/metal/index.ts
@@ -58,7 +58,7 @@ export { } from './lib/observer'; export { Mixin, aliasMethod, mixin, observer, applyMixin } from './lib/mixin'; export { default as inject, DEBUG_INJECTION_FUNCTIONS } from './lib/injected_property'; -export { tagForProperty, tagForObject, markObjectAsDirty, CUSTOM_TAG_FOR } from './lib/tags'; +export { tagForProperty, tagForObject, markObjectAsDirty } from './lib/tags'; export { tracked } from './lib/tracked'; export { createCache, getValue, isConst } from './lib/cache';
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/metal/lib/computed.ts
@@ -2,8 +2,8 @@ import { Meta, meta as metaFor } from '@ember/-internals/meta'; import { inspect, toString } from '@ember/-internals/utils'; import { assert, deprecate, warn } from '@ember/debug'; import EmberError from '@ember/error'; +import { isDestroyed } from '@glimmer/destroyable'; import { DEBUG } from '@glimmer/env'; -import { isDestroyed } from '@glimmer/runtime'; import { ALLOW_CYCLES, consumeTag,
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/metal/lib/observer.ts
@@ -1,7 +1,7 @@ import { ENV } from '@ember/-internals/environment'; import { peekMeta } from '@ember/-internals/meta'; import { schedule } from '@ember/runloop'; -import { registerDestructor } from '@glimmer/runtime'; +import { registerDestructor } from '@glimmer/destroyable'; import { CURRENT_TAG, Tag, tagMetaFor, validateTag, valueForTag } from '@glimmer/validator'; import { getChainTagsForKey } from './chain-tags'; import changeEvent from './change_event';
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/metal/lib/tags.ts
@@ -1,19 +1,12 @@ -import { - enumerableSymbol, - isObject, - setupMandatorySetter, - symbol, - toString, -} from '@ember/-internals/utils'; +import { isObject, setupMandatorySetter, symbol, toString } from '@ember/-internals/utils'; import { assert } from '@ember/debug'; +import { isDestroyed } from '@glimmer/destroyable'; import { DEBUG } from '@glimmer/env'; -import { isDestroyed } from '@glimmer/runtime'; +import { CUSTOM_TAG_FOR } from '@glimmer/manager'; import { CONSTANT_TAG, dirtyTagFor, Tag, tagFor, TagMeta } from '@glimmer/validator'; ///////// -export const CUSTOM_TAG_FOR = enumerableSymbol('CUSTOM_TAG_FOR'); - // This is exported for `@tracked`, but should otherwise be avoided. Use `tagForObject`. export const SELF_TAG: string | symbol = symbol('SELF_TAG');
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/metal/tests/accessors/get_test.js
@@ -3,7 +3,7 @@ import { Object as EmberObject } from '@ember/-internals/runtime'; import { get, set, getWithDefault, Mixin, observer, computed } from '../..'; import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; import { run } from '@ember/runloop'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; import { track } from '@glimmer/validator'; function aget(x, y) {
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/metal/tests/alias_test.js
@@ -10,7 +10,7 @@ import { } from '..'; import { Object as EmberObject } from '@ember/-internals/runtime'; import { moduleFor, AbstractTestCase, runLoopSettled } from 'internal-test-helpers'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; import { valueForTag, validateTag } from '@glimmer/validator'; let obj, count;
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/metal/tests/computed_test.js
@@ -11,7 +11,7 @@ import { } from '..'; import { run } from '@ember/runloop'; import { moduleFor, AbstractTestCase, runLoopSettled } from 'internal-test-helpers'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; let obj, objA, objB, count, func;
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/metal/tests/mixin/observer_test.js
@@ -1,6 +1,6 @@ import { set, get, observer, mixin, Mixin } from '../..'; import { moduleFor, AbstractTestCase, runLoopSettled } from 'internal-test-helpers'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; let obj;
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/metal/tests/observer_test.js
@@ -16,7 +16,7 @@ import { } from '..'; import { moduleFor, AbstractTestCase, runLoopSettled } from 'internal-test-helpers'; import { FUNCTION_PROTOTYPE_EXTENSIONS } from '@ember/deprecated-features'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; import { meta as metaFor } from '@ember/-internals/meta'; function K() {}
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/metal/tests/performance_test.js
@@ -9,7 +9,7 @@ import { addObserver, } from '..'; import { moduleFor, AbstractTestCase, runLoopSettled } from 'internal-test-helpers'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; let obj;
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/owner/index.ts
@@ -1,4 +1,4 @@ -import { getOwner as glimmerGetOwner, setOwner as glimmerSetOwner } from '@glimmer/runtime'; +import { getOwner as glimmerGetOwner, setOwner as glimmerSetOwner } from '@glimmer/owner'; /** @module @ember/application
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/routing/tests/location/auto_location_test.js
@@ -2,7 +2,7 @@ import { assign } from '@ember/polyfills'; import { window } from '@ember/-internals/browser-environment'; import { run } from '@ember/runloop'; import { get } from '@ember/-internals/metal'; -import { setOwner } from '@glimmer/runtime'; +import { setOwner } from '@glimmer/owner'; import AutoLocation from '../../lib/location/auto_location'; import { getHistoryPath, getHashPath } from '../../lib/location/auto_location'; import HistoryLocation from '../../lib/location/history_location';
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/runtime/lib/mixins/-proxy.js
@@ -10,12 +10,12 @@ import { Mixin, tagForObject, computed, - CUSTOM_TAG_FOR, tagForProperty, } from '@ember/-internals/metal'; import { setProxy, setupMandatorySetter, isObject } from '@ember/-internals/utils'; import { assert } from '@ember/debug'; import { DEBUG } from '@glimmer/env'; +import { CUSTOM_TAG_FOR } from '@glimmer/manager'; import { combine, updateTag, tagFor, tagMetaFor } from '@glimmer/validator'; export function contentFor(proxy) {
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/runtime/lib/system/array_proxy.js
@@ -10,14 +10,14 @@ import { addArrayObserver, removeArrayObserver, replace, - CUSTOM_TAG_FOR, arrayContentDidChange, tagForProperty, } from '@ember/-internals/metal'; import { isObject } from '@ember/-internals/utils'; import EmberObject from './object'; import { isArray, MutableArray } from '../mixins/array'; import { assert } from '@ember/debug'; +import { CUSTOM_TAG_FOR } from '@glimmer/manager'; import { combine, consumeTag, validateTag, valueForTag, tagFor } from '@glimmer/validator'; const ARRAY_OBSERVER_MAPPING = {
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/runtime/lib/system/core_object.js
@@ -31,7 +31,8 @@ import ActionHandler from '../mixins/action_handler'; import { assert } from '@ember/debug'; import { DEBUG } from '@glimmer/env'; import { _WeakSet as WeakSet } from '@glimmer/util'; -import { destroy, isDestroying, isDestroyed, registerDestructor, OWNER } from '@glimmer/runtime'; +import { destroy, isDestroying, isDestroyed, registerDestructor } from '@glimmer/destroyable'; +import { OWNER } from '@glimmer/owner'; const reopen = Mixin.prototype.reopen;
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/runtime/tests/ext/function_test.js
@@ -4,7 +4,7 @@ import EmberObject from '../../lib/system/object'; import Evented from '../../lib/mixins/evented'; import { moduleFor, AbstractTestCase, runLoopSettled } from 'internal-test-helpers'; import { FUNCTION_PROTOTYPE_EXTENSIONS } from '@ember/deprecated-features'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; moduleFor( 'Function.prototype.observes() helper',
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/runtime/tests/mixins/container_proxy_test.js
@@ -4,7 +4,7 @@ import ContainerProxy from '../../lib/mixins/container_proxy'; import EmberObject from '../../lib/system/object'; import { run, schedule } from '@ember/runloop'; import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; moduleFor( '@ember/-internals/runtime/mixins/container_proxy',
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/runtime/tests/mutable-array/removeObjects-test.js
@@ -2,7 +2,7 @@ import { get } from '@ember/-internals/metal'; import { AbstractTestCase, runLoopSettled } from 'internal-test-helpers'; import { runArrayTests, newFixture, newObjectsFixture } from '../helpers/array'; import { A as emberA } from '../../lib/mixins/array'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; class RemoveObjectsTests extends AbstractTestCase { '@test should return receiver'() {
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/runtime/tests/system/core_object_test.js
@@ -3,7 +3,7 @@ import { get, set, observer } from '@ember/-internals/metal'; import CoreObject from '../../lib/system/core_object'; import { moduleFor, AbstractTestCase, buildOwner, runLoopSettled } from 'internal-test-helpers'; import { track } from '@glimmer/validator'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; import { run } from '@ember/runloop'; moduleFor(
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/-internals/runtime/tests/system/object/create_test.js
@@ -4,7 +4,7 @@ import { computed, Mixin, observer, addObserver, alias } from '@ember/-internals import { DEBUG } from '@glimmer/env'; import EmberObject from '../../../lib/system/object'; import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; -import { destroy } from '@glimmer/runtime'; +import { destroy } from '@glimmer/destroyable'; moduleFor( 'EmberObject.create',
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/application/tests/application_test.js
@@ -180,7 +180,6 @@ moduleFor( verifyRegistration(assert, application, 'view:-outlet'); verifyRegistration(assert, application, 'renderer:-dom'); verifyRegistration(assert, application, 'renderer:-inert'); - verifyRegistration(assert, application, P`template:components/-default`); verifyRegistration(assert, application, 'template:-outlet'); verifyInjection(assert, application, 'view:-outlet', 'template', 'template:-outlet');
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/component/template-only.ts
@@ -1,12 +1,3 @@ -// This is only exported for types, don't use this class directly -export class TemplateOnlyComponent { - constructor(public moduleName = '@ember/component/template-only') {} - - toString(): string { - return this.moduleName; - } -} - /** @module @ember/component/template-only @public @@ -36,10 +27,4 @@ export class TemplateOnlyComponent { @param {String} moduleName the module name that the template only component represents, this will be used for debugging purposes @category EMBER_GLIMMER_SET_COMPONENT_TEMPLATE */ -export default function templateOnlyComponent(moduleName?: string): TemplateOnlyComponent { - return new TemplateOnlyComponent(moduleName); -} - -export function isTemplateOnlyComponent(component: unknown): component is TemplateOnlyComponent { - return component instanceof TemplateOnlyComponent; -} +export { templateOnlyComponent as default } from '@glimmer/runtime';
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/destroyable/index.ts
@@ -5,12 +5,12 @@ export { enableDestroyableTracking, isDestroying, isDestroyed, -} from '@glimmer/runtime'; +} from '@glimmer/destroyable'; import { registerDestructor as _registerDestructor, unregisterDestructor as _unregisterDestructor, -} from '@glimmer/runtime'; +} from '@glimmer/destroyable'; /** Ember manages the lifecycles and lifetimes of many built in constructs, such
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/engine/tests/engine_test.js
@@ -103,7 +103,6 @@ moduleFor( verifyRegistration(assert, engine, 'component-lookup:main'); verifyRegistration(assert, engine, 'view:-outlet'); - verifyRegistration(assert, engine, P`template:components/-default`); verifyRegistration(assert, engine, 'template:-outlet'); verifyInjection(assert, engine, 'view:-outlet', 'template', 'template:-outlet'); assert.deepEqual(
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/helper/index.ts
@@ -1,30 +1,3 @@ -import { getOwner } from '@ember/-internals/owner'; -import { getDebugName } from '@ember/-internals/utils'; -import { assert } from '@ember/debug'; -import { DEBUG } from '@glimmer/env'; -import { - Arguments, - Helper as GlimmerHelper, - HelperCapabilities, - HelperManager, - HelperManagerWithDestroyable, - HelperManagerWithValue, -} from '@glimmer/interfaces'; -import { createComputeRef, UNDEFINED_REFERENCE } from '@glimmer/reference'; -import { - associateDestroyableChild, - buildCapabilities, - EMPTY_ARGS, - EMPTY_NAMED, - EMPTY_POSITIONAL, - getHelperManager, - isDestroyed, - isDestroying, - isInternalHelper, -} from '@glimmer/runtime'; -import { Cache, createCache, getValue } from '@glimmer/validator'; -import { argsProxyFor } from '../utils/args-proxy'; - /** @module @ember/helper */ @@ -81,29 +54,6 @@ import { argsProxyFor } from '../utils/args-proxy'; @return {Capabilities} The capabilities object instance @public */ -export function helperCapabilities( - managerAPI: string, - options: Partial<HelperCapabilities> = {} -): HelperCapabilities { - assert('Invalid helper manager compatibility specified', managerAPI === '3.23'); - - assert( - 'You must pass either the `hasValue` OR the `hasScheduledEffect` capability when defining a helper manager. Passing neither, or both, is not permitted.', - (options.hasValue || options.hasScheduledEffect) && - !(options.hasValue && options.hasScheduledEffect) - ); - - assert( - 'The `hasScheduledEffect` capability has not yet been implemented for helper managers. Please pass `hasValue` instead', - !options.hasScheduledEffect - ); - - return buildCapabilities({ - hasValue: Boolean(options.hasValue), - hasDestroyable: Boolean(options.hasDestroyable), - hasScheduledEffect: Boolean(options.hasScheduledEffect), - }); -} /** Sets the helper manager for an object or function. @@ -297,47 +247,6 @@ export function helperCapabilities( @return {object} The definition passed into setHelperManager @public */ -function hasValue(manager: HelperManager<unknown>): manager is HelperManagerWithValue<unknown> { - return manager.capabilities.hasValue; -} - -function hasDestroyable( - manager: HelperManager<unknown> -): manager is HelperManagerWithDestroyable<unknown> { - return manager.capabilities.hasDestroyable; -} - -let ARGS_CACHES = DEBUG ? new WeakMap<SimpleArgsProxy, Cache<Partial<Arguments>>>() : undefined; - -function getArgs(proxy: SimpleArgsProxy): Partial<Arguments> { - return getValue(DEBUG ? ARGS_CACHES!.get(proxy)! : proxy.argsCache!)!; -} - -class SimpleArgsProxy { - argsCache?: Cache<Partial<Arguments>>; - - constructor( - context: object, - computeArgs: (context: object) => Partial<Arguments> = () => EMPTY_ARGS - ) { - let argsCache = createCache(() => computeArgs(context)); - - if (DEBUG) { - ARGS_CACHES!.set(this, argsCache); - Object.freeze(this); - } else { - this.argsCache = argsCache; - } - } - - get named() { - return getArgs(this).named || EMPTY_NAMED; - } - - get positional() { - return getArgs(this).positional || EMPTY_POSITIONAL; - } -} /** The `invokeHelper` function can be used to create a helper instance in @@ -394,78 +303,6 @@ class SimpleArgsProxy { @returns @public */ -export function invokeHelper( - context: object, - definition: object, - computeArgs?: (context: object) => Partial<Arguments> -): Cache<unknown> { - assert( - `Expected a context object to be passed as the first parameter to invokeHelper, got ${context}`, - context !== null && typeof context === 'object' - ); - - const owner = getOwner(context); - const manager = getHelperManager(owner, definition)!; - - // TODO: figure out why assert isn't using the TS assert thing - assert( - `Expected a helper definition to be passed as the second parameter to invokeHelper, but no helper manager was found. The definition value that was passed was \`${getDebugName!( - definition - )}\`. Did you use setHelperManager to associate a helper manager with this value?`, - manager - ); - - assert('Invoke helper does not support internal helpers yet', !isInternalHelper(manager)); - - let args = new SimpleArgsProxy(context, computeArgs); - let bucket = manager.createHelper(definition, args); - - let cache: Cache<unknown>; - - if (hasValue(manager)) { - cache = createCache(() => { - assert( - `You attempted to get the value of a helper after the helper was destroyed, which is not allowed`, - !isDestroying(cache) && !isDestroyed(cache) - ); - - return manager.getValue(bucket); - }); - associateDestroyableChild(context, cache); - } else { - throw new Error('TODO: unreachable, to be implemented with hasScheduledEffect'); - } - - if (hasDestroyable(manager)) { - let destroyable = manager.getDestroyable(bucket); - - associateDestroyableChild(cache, destroyable); - } - - return cache; -} - -export default function customHelper( - manager: HelperManager<unknown>, - definition: object -): GlimmerHelper { - return (vmArgs, vm) => { - const args = argsProxyFor(vmArgs.capture(), 'helper'); - const bucket = manager.createHelper(definition, args); - - if (hasDestroyable(manager)) { - vm.associateDestroyable(manager.getDestroyable(bucket)); - } - - if (hasValue(manager)) { - return createComputeRef( - () => manager.getValue(bucket), - null, - DEBUG && manager.getDebugName && manager.getDebugName(definition) - ); - } else { - return UNDEFINED_REFERENCE; - } - }; -} +export { setHelperManager, helperCapabilities as capabilties } from '@glimmer/manager'; +export { invokeHelper } from '@glimmer/runtime';
true
Other
emberjs
ember.js
49d5291600a0b6d70ff9913e10ff9f2f23e2eb7b.json
Update Glimmer VM Updates the VM to the latest version, which includes a number of major changes: - Refactors the resolver to not cache values, as this is unnecessary - Refactors the resolver to return helper/modifier definitions directly - Refactors the resolver to return ResolvedComponentDefinitions - Updates various component definitions - Removes custom helper, modifier, and component managers - Updates built-in helpers to be based on objects with associated helpers/helper managers.
packages/@ember/modifier/index.ts
@@ -1,2 +1 @@ -export { setModifierManager } from '@glimmer/runtime'; -export { modifierCapabilities as capabilties } from '@ember/-internals/glimmer'; +export { setModifierManager, modifierCapabilities as capabilties } from '@glimmer/manager';
true