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

[FEATURE] Update Glimmer-VM to 0.45.0 #18621

Merged
merged 55 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ade8188
wip update glimmer
krisselden Nov 13, 2019
35a8644
Opaque -> unknown
Nov 13, 2019
864ea41
wip
Nov 13, 2019
ad16148
update simple dom imports
Nov 13, 2019
776d674
wip
Nov 15, 2019
3d6a698
wip
Nov 17, 2019
1238fd3
types working mostly
Nov 20, 2019
d217925
update imports
Nov 20, 2019
1b357f2
runtime -> interface, reference -> validator, other package moves
Nov 21, 2019
8c34ac9
update template compiler types
Nov 23, 2019
93e901c
various small type fixes
Nov 23, 2019
434a351
comment out macros
Nov 24, 2019
2d76275
interface renames
Nov 24, 2019
bc98ac1
template unwrapping
Nov 24, 2019
16b7e9f
wip
Nov 25, 2019
f868cce
it's working!
Nov 26, 2019
8e9a3d1
update toBool
Nov 26, 2019
4e254b3
use upstream tracking
Nov 28, 2019
f2495b2
update references, pull them upstream
Dec 4, 2019
3dda4d4
add back some basic macros
Dec 10, 2019
8d90403
all syntax tests passing!
Dec 10, 2019
6ff6b2d
wip
Dec 10, 2019
a37857c
wip
Dec 10, 2019
1ff52c7
wip
Dec 10, 2019
1abeb47
fix mount, remove old/unecessary registrations
Dec 11, 2019
4da8fed
fix owned template meta, add ownerId, map -> weakmap
Dec 11, 2019
d8e6fd9
fix debug tree and UPDATE
Dec 11, 2019
589f10a
order matters
Dec 11, 2019
4ea959b
fix binding tests and deprecation message
Dec 11, 2019
bc2b7d8
finish up fixing destroyables
Dec 12, 2019
e4ffcf6
hash -> -hash for link-to
Dec 12, 2019
5499190
deregister from view registry in willDestroy
Dec 12, 2019
7e7829b
fix mut
Dec 12, 2019
ad8d1a4
fix helper backtracking assertion tests and errors
Dec 12, 2019
e302cd0
fix get
Dec 12, 2019
889dfec
fix experimental macros test
Dec 12, 2019
7f6098d
various template transform fixes
Dec 12, 2019
076b482
fix macros
Dec 13, 2019
ff3f962
few small fixes
Dec 13, 2019
4ea3ba8
fix -in-element
Dec 13, 2019
4a4c12c
fix last tests
Dec 13, 2019
9b8d7f2
updates
Dec 17, 2019
a6b8b5d
update package.json
Dec 18, 2019
2c840b6
fix rebase
Dec 18, 2019
e004fd7
fix lint
Dec 18, 2019
cc60cf7
fix types
Dec 18, 2019
1ce6618
fix tslint
Dec 18, 2019
5b74f39
fix eslint
Dec 18, 2019
6334c9c
add back {{let}} documentation
Dec 18, 2019
bdfcdbe
use polyfill for WeakSet
Dec 18, 2019
f5e83eb
bump-deps-and-fix-memory-leak
Jan 7, 2020
9542281
bump Glimmer
Jan 7, 2020
21c8879
fix lint
Jan 7, 2020
73ad1f6
IE11 fixes
Jan 8, 2020
03e7132
fix lint, address comments
Jan 9, 2020
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
9 changes: 7 additions & 2 deletions broccoli/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function glimmerTrees(entries) {
}
seen.add(name);

if (!name.startsWith('@glimmer/')) {
if (!name.startsWith('@glimmer/') && !name.startsWith('@simple-dom/')) {
continue;
}

Expand Down Expand Up @@ -284,7 +284,12 @@ module.exports.glimmerCompilerES = () => {
};

module.exports.glimmerES = function glimmerES(environment) {
let glimmerEntries = ['@glimmer/node', '@glimmer/opcode-compiler', '@glimmer/runtime'];
let glimmerEntries = [
'@glimmer/node',
'@simple-dom/document',
'@glimmer/opcode-compiler',
'@glimmer/runtime',
];

if (environment === 'development') {
let hasGlimmerDebug = true;
Expand Down
2 changes: 2 additions & 0 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const rollupPackage = require('./broccoli/rollup-package');
const minify = require('./broccoli/minify');
const debugTree = require('broccoli-debug').buildDebugCallback('ember-source:ember-cli-build');

Error.stackTraceLimit = Infinity;

const {
routerES,
jquery,
Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@
},
"devDependencies": {
"@babel/preset-env": "^7.7.7",
"@glimmer/compiler": "0.38.5-alpha.3",
"@glimmer/compiler": "0.45.3",
"@glimmer/env": "^0.1.7",
"@glimmer/interfaces": "0.38.5-alpha.3",
"@glimmer/node": "0.38.5-alpha.3",
"@glimmer/opcode-compiler": "0.38.5-alpha.3",
"@glimmer/program": "0.38.5-alpha.3",
"@glimmer/reference": "0.38.5-alpha.3",
"@glimmer/runtime": "0.38.5-alpha.3",
"@glimmer/interfaces": "0.45.3",
"@glimmer/node": "0.45.3",
"@glimmer/opcode-compiler": "0.45.3",
"@glimmer/program": "0.45.3",
"@glimmer/reference": "0.45.3",
"@glimmer/runtime": "0.45.3",
"@glimmer/validator": "0.45.3",
"@simple-dom/document": "^1.4.0",
"@types/qunit": "^2.5.4",
"@types/rsvp": "^4.0.3",
"@typescript-eslint/parser": "^2.15.0",
Expand All @@ -98,7 +100,7 @@
"broccoli-rollup": "^2.1.1",
"broccoli-source": "^3.0.0",
"broccoli-string-replace": "^0.1.2",
"broccoli-typescript-compiler": "^4.1.0",
"broccoli-typescript-compiler": "^4.2.0",
"broccoli-uglify-sourcemap": "^3.1.1",
"common-tags": "^1.8.0",
"core-js": "^2.6.5",
Expand Down
5 changes: 2 additions & 3 deletions packages/@ember/-internals/glimmer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ export { default as TextArea } from './lib/components/textarea';
export { default as LinkComponent } from './lib/components/link-to';
export { default as Component } from './lib/component';
export { default as Helper, helper } from './lib/helper';
export { default as Environment } from './lib/environment';
export { SafeString, escapeExpression, htmlSafe, isHTMLSafe } from './lib/utils/string';
export {
Renderer,
Expand Down Expand Up @@ -380,9 +379,9 @@ export { default as AbstractComponentManager } from './lib/component-managers/ab
// TODO just test these through public API
// a lot of these are testing how a problem was solved
// rather than the problem was solved
export { UpdatableReference, INVOKE } from './lib/utils/references';
export { default as iterableFor } from './lib/utils/iterable';
export { INVOKE } from './lib/helpers/mut';
export { default as OutletView } from './lib/views/outlet';
export { OutletState } from './lib/utils/outlet';
export { capabilities } from './lib/component-managers/custom';
export { setComponentManager, getComponentManager } from './lib/utils/custom-component-manager';
export { setModifierManager, getModifierManager } from './lib/utils/custom-modifier-manager';
Expand Down
83 changes: 48 additions & 35 deletions packages/@ember/-internals/glimmer/lib/compile-time-lookup.ts
Original file line number Diff line number Diff line change
@@ -1,60 +1,73 @@
import { OwnedTemplateMeta } from '@ember/-internals/views';
import {
CompilableTemplate,
CompileTimeLookup as ICompileTimeLookup,
CompileTimeComponent,
CompileTimeResolverDelegate,
ComponentCapabilities,
ComponentDefinition,
ComponentManager,
Option,
ProgramSymbolTable,
WithJitStaticLayout,
} from '@glimmer/interfaces';
import { ComponentDefinition, ComponentManager, WithStaticLayout } from '@glimmer/runtime';
import RuntimeResolver from './resolver';

interface StaticComponentManager<DefinitionState>
extends WithStaticLayout<any, DefinitionState, OwnedTemplateMeta, RuntimeResolver>,
ComponentManager<any, DefinitionState> {}
interface StaticComponentManager
extends WithJitStaticLayout<unknown, unknown, RuntimeResolver>,
ComponentManager<unknown, unknown> {}

export default class CompileTimeLookup implements ICompileTimeLookup<OwnedTemplateMeta> {
function isStaticComponentManager(
_manager: ComponentManager,
capabilities: ComponentCapabilities
): _manager is StaticComponentManager {
return !capabilities.dynamicLayout;
}

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

getCapabilities(handle: number): ComponentCapabilities {
let definition = this.resolver.resolve<Option<ComponentDefinition>>(handle);
let { manager, state } = definition!;
return manager.getCapabilities(state);
lookupHelper(name: string, referrer: OwnedTemplateMeta): Option<number> {
return this.resolver.lookupHelper(name, referrer);
}

getLayout<DefinitionState>(handle: number): Option<CompilableTemplate<ProgramSymbolTable>> {
const { manager, state } = this.resolver.resolve<
ComponentDefinition<DefinitionState, StaticComponentManager<DefinitionState>>
>(handle);
const capabilities = manager.getCapabilities(state);
lookupModifier(name: string, referrer: OwnedTemplateMeta): Option<number> {
return this.resolver.lookupModifier(name, referrer);
}

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

if (capabilities.dynamicLayout) {
if (definitionHandle === null) {
return null;
}

const invocation = manager.getLayout(state, this.resolver);
return {
// TODO: this seems weird, it already is compiled
compile() {
return invocation.handle;
},
symbolTable: invocation.symbolTable,
};
}
const { manager, state } = this.resolver.resolve<ComponentDefinition<unknown, unknown>>(
definitionHandle
);
const capabilities = manager.getCapabilities(state);

lookupHelper(name: string, referrer: OwnedTemplateMeta): Option<number> {
return this.resolver.lookupHelper(name, referrer);
}
if (!isStaticComponentManager(manager, capabilities)) {
return {
handle: definitionHandle,
capabilities,
compilable: null,
};
}

lookupModifier(name: string, referrer: OwnedTemplateMeta): Option<number> {
return this.resolver.lookupModifier(name, referrer);
return {
handle: definitionHandle,
capabilities,
compilable: manager.getJitStaticLayout(state, this.resolver),
};
}

lookupComponentDefinition(name: string, referrer: OwnedTemplateMeta): Option<number> {
return this.resolver.lookupComponentHandle(name, referrer);
}
// lookupComponentDefinition(name: string, referrer: OwnedTemplateMeta): Option<number> {
pzuraq marked this conversation as resolved.
Show resolved Hide resolved
pzuraq marked this conversation as resolved.
Show resolved Hide resolved
// return this.resolver.lookupComponentHandle(name, referrer);
// }

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

resolve(handle: number): OwnedTemplateMeta {
return this.resolver.resolve(handle);
}
}
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
import { ComponentCapabilities, Simple } from '@glimmer/interfaces';
import { Tag, VersionedPathReference } from '@glimmer/reference';
import {
Arguments,
Bounds,
ComponentCapabilities,
ComponentManager,
Destroyable,
DynamicScope,
ElementOperations,
Environment,
Option,
PreparedArguments,
} from '@glimmer/runtime';
import { Destroyable, Opaque, Option } from '@glimmer/util';
VMArguments,
} from '@glimmer/interfaces';
import { VersionedPathReference } from '@glimmer/reference';
import { Tag } from '@glimmer/validator';
import { SimpleElement } from '@simple-dom/interface';
import { EmberVMEnvironment } from '../environment';

// implements the ComponentManager interface as defined in glimmer:
// tslint:disable-next-line:max-line-length
// https://github.com/glimmerjs/glimmer-vm/blob/v0.24.0-beta.4/packages/%40glimmer/runtime/lib/component/interfaces.ts#L21

export default abstract class AbstractManager<T, U> implements ComponentManager<T, U> {
prepareArgs(_state: U, _args: Arguments): Option<PreparedArguments> {
prepareArgs(_state: U, _args: VMArguments): Option<PreparedArguments> {
return null;
}

abstract create(
env: Environment,
env: EmberVMEnvironment,
definition: U,
args: Arguments,
args: VMArguments,
dynamicScope: DynamicScope,
caller: VersionedPathReference<void | {}>,
hasDefaultBlock: boolean
): T;

abstract getSelf(component: T): VersionedPathReference<Opaque>;
abstract getSelf(component: T): VersionedPathReference<unknown>;
abstract getCapabilities(state: U): ComponentCapabilities;

didCreateElement(_component: T, _element: Simple.Element, _operations: ElementOperations): void {
didCreateElement(_component: T, _element: SimpleElement, _operations: ElementOperations): void {
// noop
}

Expand Down
Loading