Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Upgrade Glimmer VM to 0.63.5 #19258

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ npm-debug.log
*.tgz
*.tar.gz
*.log
/.vscode

4 changes: 2 additions & 2 deletions broccoli/glimmer-template-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ GlimmerTemplatePrecompiler.prototype.processString = function (content, relative
meta: { moduleName: relativePath },
});
return stripIndent`
import template from '../template';
export default template(${compiled});
import { templateFactory } from '@glimmer/opcode-compiler';
export default templateFactory(${compiled});
`;
};

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@
},
"devDependencies": {
"@babel/preset-env": "^7.9.5",
"@glimmer/compiler": "0.62.3",
"@glimmer/compiler": "0.63.5",
"@glimmer/env": "^0.1.7",
"@glimmer/global-context": "0.62.3",
"@glimmer/interfaces": "0.62.3",
"@glimmer/node": "0.62.3",
"@glimmer/opcode-compiler": "0.62.3",
"@glimmer/program": "0.62.3",
"@glimmer/reference": "0.62.3",
"@glimmer/runtime": "0.62.3",
"@glimmer/validator": "0.62.3",
"@glimmer/global-context": "0.63.5",
"@glimmer/interfaces": "0.63.5",
"@glimmer/node": "0.63.5",
"@glimmer/opcode-compiler": "0.63.5",
"@glimmer/program": "0.63.5",
"@glimmer/reference": "0.63.5",
"@glimmer/runtime": "0.63.5",
"@glimmer/validator": "0.63.5",
"@simple-dom/document": "^1.4.0",
"@types/qunit": "^2.9.1",
"@types/rsvp": "^4.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/@ember/-internals/container/tests/container_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OWNER } from '@ember/-internals/owner';
import { getOwner } from '@ember/-internals/owner';
import { assign } from '@ember/polyfills';
import Service from '@ember/service';
import { DEBUG } from '@glimmer/env';
Expand Down Expand Up @@ -498,7 +498,7 @@ moduleFor(

let result = container.ownerInjection();

assert.equal(result[OWNER], owner, 'owner is properly included');
assert.equal(getOwner(result), owner, 'owner is properly included');
}

['@test ownerInjection should be usable to create a service for testing'](assert) {
Expand Down
4 changes: 1 addition & 3 deletions packages/@ember/-internals/container/tests/owner_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OWNER, getOwner, setOwner } from '@ember/-internals/owner';
import { getOwner, setOwner } from '@ember/-internals/owner';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

moduleFor(
Expand All @@ -13,8 +13,6 @@ moduleFor(
setOwner(obj, owner);

assert.strictEqual(getOwner(obj), owner, 'owner has been set');

assert.strictEqual(obj[OWNER], owner, 'owner has been set to the OWNER symbol');
}

['@test getOwner deprecates using LEGACY_OWNER'](assert) {
Expand Down
10 changes: 3 additions & 7 deletions packages/@ember/-internals/glimmer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,10 @@
@public
*/

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 template,
counters as templateCacheCounters,
Factory as TemplateFactory,
OwnedTemplate,
} from './lib/template';
export { default as Checkbox } from './lib/components/checkbox';
export { default as TextField } from './lib/components/text-field';
export { default as TextArea } from './lib/components/textarea';
Expand Down Expand Up @@ -408,5 +405,4 @@ export { capabilities } from './lib/component-managers/custom';
export { capabilities as modifierCapabilities } from './lib/modifiers/custom';
export { helperCapabilities, HelperManager, invokeHelper } from './lib/helpers/custom';
export { isSerializationFirstNode } from './lib/utils/serialization-first-node-helpers';
export { setComponentTemplate, getComponentTemplate } from './lib/utils/component-template';
export { CapturedRenderNode } from './lib/utils/debug-render-tree';
26 changes: 13 additions & 13 deletions packages/@ember/-internals/glimmer/lib/compile-time-lookup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OwnedTemplateMeta } from '@ember/-internals/views';
import { Owner } from '@ember/-internals/owner';
import {
CompileTimeComponent,
CompileTimeResolver,
Expand All @@ -21,19 +21,19 @@ function isStaticComponentManager(
return !capabilities.dynamicLayout;
}

export default class CompileTimeResolverImpl implements CompileTimeResolver<OwnedTemplateMeta> {
export default class CompileTimeResolverImpl implements CompileTimeResolver<Owner> {
constructor(private resolver: RuntimeResolver) {}

lookupHelper(name: string, referrer: OwnedTemplateMeta): Option<number> {
return this.resolver.lookupHelper(name, referrer);
lookupHelper(name: string, owner: Owner): Option<number> {
return this.resolver.lookupHelper(name, owner);
}

lookupModifier(name: string, referrer: OwnedTemplateMeta): Option<number> {
return this.resolver.lookupModifier(name, referrer);
lookupModifier(name: string, owner: Owner): Option<number> {
return this.resolver.lookupModifier(name, owner);
}

lookupComponent(name: string, referrer: OwnedTemplateMeta): Option<CompileTimeComponent> {
let definitionHandle = this.resolver.lookupComponentHandle(name, referrer);
lookupComponent(name: string, owner: Owner): Option<CompileTimeComponent> {
let definitionHandle = this.resolver.lookupComponentHandle(name, owner);

if (definitionHandle === null) {
return null;
Expand All @@ -55,15 +55,15 @@ export default class CompileTimeResolverImpl implements CompileTimeResolver<Owne
return {
handle: definitionHandle,
capabilities,
compilable: manager.getStaticLayout(state, this.resolver),
compilable: manager.getStaticLayout(state),
};
}

lookupPartial(name: string, referrer: OwnedTemplateMeta): Option<number> {
return this.resolver.lookupPartial(name, referrer);
lookupPartial(name: string, owner: Owner): Option<number> {
return this.resolver.lookupPartial(name, owner);
}

resolve(handle: number): OwnedTemplateMeta {
return this.resolver.resolve(handle);
resolve(): null {
return null;
}
pzuraq marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ import { assign } from '@ember/polyfills';
import { DEBUG } from '@glimmer/env';
import {
Bounds,
CompilableProgram,
ComponentCapabilities,
ComponentDefinition,
Destroyable,
ElementOperations,
Option,
PreparedArguments,
Template,
TemplateFactory,
VMArguments,
WithDynamicLayout,
WithDynamicTagName,
Expand Down Expand Up @@ -44,7 +47,7 @@ import { BOUNDS, DIRTY_TAG, HAS_BLOCK, IS_DISPATCHING_ATTRS } from '../component
import { EmberVMEnvironment } from '../environment';
import { DynamicScope } from '../renderer';
import RuntimeResolver from '../resolver';
import { Factory as TemplateFactory, isTemplateFactory, OwnedTemplate } from '../template';
import { isTemplateFactory } from '../template';
import {
createClassNameBindingRef,
createSimpleClassNameBindingRef,
Expand Down Expand Up @@ -121,7 +124,7 @@ export default class CurlyComponentManager
WithStaticLayout<ComponentStateBucket, DefinitionState, RuntimeResolver>,
WithDynamicLayout<ComponentStateBucket, RuntimeResolver>,
WithDynamicTagName<ComponentStateBucket> {
protected templateFor(component: Component): OwnedTemplate {
protected templateFor(component: Component): Template {
let { layout, layoutName } = component;
let owner = getOwner(component);

Expand All @@ -145,11 +148,11 @@ export default class CurlyComponentManager
return factory(owner);
}

getStaticLayout(state: DefinitionState, _resolver: RuntimeResolver) {
getStaticLayout(state: DefinitionState): CompilableProgram {
return unwrapTemplate(state.template!).asLayout();
}

getDynamicLayout(bucket: ComponentStateBucket) {
getDynamicLayout(bucket: ComponentStateBucket): Template {
let component = bucket.component;
let template = this.templateFor(component);

Expand Down Expand Up @@ -636,7 +639,7 @@ export class CurlyComponentDefinition implements ComponentDefinition {
constructor(
public name: string,
public ComponentClass: any,
public template?: OwnedTemplate,
public template?: Template,
public args?: CurriedArgs
) {
this.state = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Destroyable,
Dict,
Option,
Template,
VMArguments,
WithStaticLayout,
} from '@glimmer/interfaces';
Expand All @@ -17,7 +18,6 @@ import { registerDestructor } from '@glimmer/runtime';
import { unwrapTemplate } from '@glimmer/util';
import { EmberVMEnvironment } from '../environment';
import RuntimeResolver from '../resolver';
import { OwnedTemplate } from '../template';
import { argsProxyFor } from '../utils/args-proxy';
import { buildCapabilities, InternalCapabilities } from '../utils/managers';
import AbstractComponentManager from './abstract';
Expand Down Expand Up @@ -81,7 +81,7 @@ export function capabilities<Version extends keyof OptionalCapabilities>(
export interface DefinitionState<ComponentInstance> {
name: string;
ComponentClass: Factory<ComponentInstance>;
template: OwnedTemplate;
template: Template;
}

export interface ManagerDelegate<ComponentInstance> {
Expand Down Expand Up @@ -302,7 +302,7 @@ export class CustomManagerDefinition<ComponentInstance> implements ComponentDefi
public name: string,
public ComponentClass: Factory<ComponentInstance>,
public delegate: ManagerDelegate<ComponentInstance>,
public template: OwnedTemplate
public template: Template
) {
this.state = {
name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Factory } from '@ember/-internals/owner';
import { ComponentCapabilities } from '@glimmer/interfaces';
import { OwnedTemplate } from '../template';
import { ComponentCapabilities, Template } from '@glimmer/interfaces';
import { Component } from '../utils/curly-component-state-bucket';

export default interface DefinitionState {
Expand All @@ -10,5 +9,5 @@ export default interface DefinitionState {
Component,
{ create(props?: any): Component; positionalParams: string | string[] | undefined | null }
>;
template?: OwnedTemplate;
template?: Template;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ComponentDefinition,
Destroyable,
DynamicScope,
Template,
VMArguments,
WithStaticLayout,
} from '@glimmer/interfaces';
Expand All @@ -16,7 +17,6 @@ import { _WeakSet, unwrapTemplate } from '@glimmer/util';
import InternalComponent from '../components/internal';
import { EmberVMEnvironment } from '../environment';
import RuntimeResolver from '../resolver';
import { OwnedTemplate } from '../template';
import AbstractComponentManager from './abstract';

const CAPABILITIES: ComponentCapabilities = {
Expand All @@ -36,7 +36,7 @@ const CAPABILITIES: ComponentCapabilities = {

export interface InternalDefinitionState {
ComponentClass: typeof InternalComponent;
layout: OwnedTemplate;
layout: Template;
}

export interface InternalComponentState {
Expand All @@ -51,7 +51,7 @@ export class InternalComponentDefinition
constructor(
public manager: InternalManager,
ComponentClass: typeof InternalComponent,
layout: OwnedTemplate
layout: Template
) {
this.state = { ComponentClass, layout };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
ComponentDefinition,
Destroyable,
Option,
TemplateFactory,
VMArguments,
WithDynamicLayout,
} from '@glimmer/interfaces';
import { createConstRef, Reference, valueForRef } from '@glimmer/reference';
import { registerDestructor } from '@glimmer/runtime';
import { TemplateFactory } from '../..';
import { EmberVMEnvironment } from '../environment';
import RuntimeResolver from '../resolver';
import AbstractManager from './abstract';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Destroyable,
ElementOperations,
Option,
Template,
VMArguments,
WithDynamicTagName,
WithStaticLayout,
Expand All @@ -23,7 +24,6 @@ import { SimpleElement } from '@simple-dom/interface';
import { EmberVMEnvironment } from '../environment';
import { DynamicScope } from '../renderer';
import RuntimeResolver from '../resolver';
import { OwnedTemplate } from '../template';
import { OutletState } from '../utils/outlet';
import OutletView from '../views/outlet';
import AbstractManager from './abstract';
Expand All @@ -44,7 +44,7 @@ export interface OutletDefinitionState {
ref: Reference<OutletState | undefined>;
name: string;
outlet: string;
template: OwnedTemplate;
template: Template;
controller: unknown;
model: unknown;
}
Expand Down Expand Up @@ -148,7 +148,7 @@ class OutletComponentManager
return name;
}

getStaticLayout({ template }: OutletDefinitionState, _resolver: RuntimeResolver) {
getStaticLayout({ template }: OutletDefinitionState) {
// The router has already resolved the template
return unwrapTemplate(template).asLayout();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ComponentCapabilities,
ComponentDefinition,
Option,
Template,
VMArguments,
WithStaticLayout,
} from '@glimmer/interfaces';
Expand All @@ -12,7 +13,6 @@ import { registerDestructor } from '@glimmer/runtime';
import { unwrapTemplate } from '@glimmer/util';
import { EmberVMEnvironment } from '../environment';
import RuntimeResolver from '../resolver';
import { OwnedTemplate } from '../template';
import AbstractManager from './abstract';

const CAPABILITIES: ComponentCapabilities = {
Expand Down Expand Up @@ -115,7 +115,7 @@ const MANAGER = new TemplateOnlyComponentManager();

export interface TemplateOnlyComponentDefinitionState {
name: string;
template: OwnedTemplate;
template: Template;
}

export class TemplateOnlyComponentDefinition
Expand All @@ -127,7 +127,7 @@ export class TemplateOnlyComponentDefinition
TemplateOnlyComponentManager
> {
manager = MANAGER;
constructor(public name: string, public template: OwnedTemplate) {}
constructor(public name: string, public template: Template) {}

get state(): TemplateOnlyComponentDefinitionState {
return this;
Expand Down
5 changes: 2 additions & 3 deletions packages/@ember/-internals/glimmer/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import { assert, deprecate, warn } from '@ember/debug';
import { backburner, schedule } from '@ember/runloop';
import { DEBUG } from '@glimmer/env';
import setGlobalContext from '@glimmer/global-context';
import { Environment } from '@glimmer/interfaces';
import { Environment, Template } from '@glimmer/interfaces';
import { EnvironmentDelegate } from '@glimmer/runtime';
import { setTrackingTransactionEnv } from '@glimmer/validator';
import { OwnedTemplate } from './template';
import DebugRenderTree from './utils/debug-render-tree';
import toIterator from './utils/iterator';
import { isHTMLSafe } from './utils/string';
Expand Down Expand Up @@ -87,7 +86,7 @@ if (DEBUG) {

export interface CompilerFactory {
id: string;
new (template: OwnedTemplate): any;
new (template: Template): any;
}

export class EmberEnvironmentExtra {
Expand Down
Loading