Skip to content

Commit

Permalink
Merge pull request #220 from pzuraq/update-glimmer-vm
Browse files Browse the repository at this point in the history
[UPDATE] Updates Glimmer-VM and Typescript
  • Loading branch information
tomdale authored Nov 9, 2019
2 parents 2f84030 + 25eac66 commit dc9f630
Show file tree
Hide file tree
Showing 20 changed files with 754 additions and 224 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
script: yarn test
- name: Lint
script: yarn tslint
- name: Type Lint
script:
- yarn build
- yarn dtslint --installAll
- yarn test:types

- stage: Ember Tests
name: Node
Expand Down
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,50 @@ the user's browser.

[`@glimmer/application-pipeline`]: https://github.com/glimmerjs/glimmer-application-pipeline
[`@glimmer/resolution-map-builder`]: https://github.com/glimmerjs/resolution-map-builder

## Tests

### Type Tests

The following packages are committed to maintaining stable Typescript types in
addition to their JavaScript API:

* `@glimmer/component`

Any changes to their types, _including_ changes caused by upgrading the
Typescript compiler, are covered under SemVer for these packages (e.g. breaking
changes to types will require a new major version).

In order to ensure we aren't making changes to types unintentionally, we have a
set of tests for their public APIs in `/test/types`. These can be run with:

```sh
yarn build
yarn test:types
```

In general, any new additions to the public types should be a new _minor version_,
and removals of public APIs or changes to the versions of TS that are supported
should be a _major version_. Corrections to existing types that are
_not breaking_ (e.g. strictly equal to or wider than the current type) can be
released in _patch versions_.

To add a new API:

1. Add it to any `hasExactKeys` statements that assert on the keys of a public
value/type
2. Add an `$ExpectType` test for the new API to ensure it has the correct type.

To remove an API:

1. Remove it from any `hasExactKeys` statements
2. Remove any `$ExpectType` tests related to it

#### Symbols

Symbols are often used for internal state that is only accessible within a
framework. We use a few symbols internally in these packages, and because of
this they appear in the public type signatures, and assertions. However, unless
the symbol itself is part of the public JS API of the package, these properties
are _inacessible_ to users, and thus they are not part of public API, and any
changes can be made and released in a patch release.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"test:node": "bin/run-node-tests.js",
"test:ember": "yarn workspace @glimmer/component ember try:one",
"test:ember:node": "yarn workspace @glimmer/component test:node",
"test:types": "dtslint test/types",
"tslint": "tslint --project tsconfig.json",
"problems": "tsc -p tsconfig.json --noEmit"
},
Expand All @@ -32,7 +33,7 @@
"broccoli-merge-trees": "^2.0.0",
"broccoli-persistent-filter": "^1.2.13",
"broccoli-rollup": "^1.3.0",
"broccoli-typescript-compiler": "^4.1.0",
"broccoli-typescript-compiler": "^4.2.0",
"child_process": "^1.0.2",
"dag-map": "^2.0.2",
"ember-build-utilities": "^0.4.0",
Expand All @@ -57,9 +58,10 @@
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"tslint-plugin-prettier": "^2.0.1",
"typescript": "~3.2.2"
"typescript": "~3.5.3"
},
"dependencies": {
"dtslint": "^1.0.3",
"tslib": "^1.8.0"
},
"resolutions": {
Expand All @@ -76,4 +78,4 @@
"deprecation": ":warning: Deprecation"
}
}
}
}
8 changes: 4 additions & 4 deletions packages/@glimmer/app-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"dependencies": {
"@glimmer/application": "^1.0.0-beta.1",
"@glimmer/compiler-delegates": "^1.0.0-beta.1",
"@glimmer/bundle-compiler": "^0.42.0",
"@glimmer/interfaces": "^0.42.0",
"@glimmer/opcode-compiler": "^0.42.0",
"@glimmer/bundle-compiler": "^0.43.0",
"@glimmer/interfaces": "^0.43.0",
"@glimmer/opcode-compiler": "^0.43.0",
"broccoli-plugin": "^1.3.0",
"debug": "^3.1.0",
"walk-sync": "^0.3.2"
Expand All @@ -24,4 +24,4 @@
"broccoli-stew": "^1.5.0",
"broccoli-test-helper": "^1.2.0"
}
}
}
14 changes: 7 additions & 7 deletions packages/@glimmer/application-test-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"module": "dist/modules/es2017/index.js",
"types": "dist/types/index.d.ts",
"dependencies": {
"@glimmer/compiler": "^0.42.0",
"@glimmer/compiler": "^0.43.0",
"@glimmer/di": "^0.1.9",
"@glimmer/env": "^0.1.7",
"@glimmer/interfaces": "^0.42.0",
"@glimmer/reference": "^0.42.0",
"@glimmer/interfaces": "^0.43.0",
"@glimmer/reference": "^0.43.0",
"@glimmer/resolver": "^0.3.0",
"@glimmer/runtime": "^0.42.0",
"@glimmer/util": "^0.42.0",
"@glimmer/wire-format": "^0.42.0"
"@glimmer/runtime": "^0.43.0",
"@glimmer/util": "^0.43.0",
"@glimmer/wire-format": "^0.43.0"
}
}
}
18 changes: 9 additions & 9 deletions packages/@glimmer/application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@
"dist"
],
"dependencies": {
"@glimmer/compiler": "^0.42.0",
"@glimmer/compiler": "^0.43.0",
"@glimmer/component": "^1.0.0-beta.1",
"@glimmer/di": "^0.1.9",
"@glimmer/env": "^0.1.7",
"@glimmer/interfaces": "^0.42.0",
"@glimmer/opcode-compiler": "^0.42.0",
"@glimmer/reference": "^0.42.0",
"@glimmer/interfaces": "^0.43.0",
"@glimmer/opcode-compiler": "^0.43.0",
"@glimmer/reference": "^0.43.0",
"@glimmer/resolver": "^0.3.0",
"@glimmer/runtime": "^0.42.0",
"@glimmer/util": "^0.42.0",
"@glimmer/runtime": "^0.43.0",
"@glimmer/util": "^0.43.0",
"@simple-dom/interface": "^1.4.0"
},
"devDependencies": {
"@glimmer/application-test-helpers": "^1.0.0-beta.1",
"@glimmer/bundle-compiler": "^0.42.0",
"@glimmer/bundle-compiler": "^0.43.0",
"@glimmer/component": "^1.0.0-beta.1",
"@glimmer/wire-format": "^0.42.0",
"@glimmer/wire-format": "^0.43.0",
"@simple-dom/document": "^1.4.0",
"@simple-dom/serializer": "^1.4.0",
"@simple-dom/void-map": "^1.4.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
JitRuntimeResolver,
WithJitStaticLayout,
Template,
TemplateOk,
Environment,
Invocation,
CompilableProgram,
Expand All @@ -24,6 +25,7 @@ import { Capabilities } from '../capabilities';
import { RootReference } from '../../references';
import Bounds from '../bounds';
import { JitComponentDefinition, AotComponentDefinition } from '../component-definition';
import { unwrapTemplate } from '@glimmer/opcode-compiler';

export const CAPABILITIES: ComponentCapabilities = {
createInstance: true,
Expand Down Expand Up @@ -345,7 +347,7 @@ export class CustomComponentDefinition<ComponentInstance> implements AotComponen
public manager = CUSTOM_COMPONENT_MANAGER as CustomComponentManager<ComponentInstance>;
public handle: number;
public symbolTable: ProgramSymbolTable;
public template: Template;
public template: TemplateOk;

constructor(
name: string,
Expand All @@ -358,7 +360,7 @@ export class CustomComponentDefinition<ComponentInstance> implements AotComponen
this.handle = templateOrHandle;
this.symbolTable = symbolTable;
} else {
this.template = templateOrHandle;
this.template = unwrapTemplate(templateOrHandle);
}

this.state = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
AotRuntimeResolver,
CompilableProgram,
Template,
TemplateOk,
WithJitStaticLayout,
ProgramSymbolTable,
} from '@glimmer/interfaces';
Expand All @@ -25,6 +26,7 @@ import {
AotComponentDefinition,
JitComponentDefinition,
} from '../component-definition';
import { unwrapTemplate } from '@glimmer/opcode-compiler';

export const CAPABILITIES: ComponentCapabilities = {
attributeHook: false,
Expand Down Expand Up @@ -149,14 +151,14 @@ export class TemplateOnlyComponentDefinition
public manager = TEMPLATE_ONLY_MANAGER;
public handle: number;
public symbolTable: ProgramSymbolTable;
public template: Template;
public template: TemplateOk;

constructor(name: string, templateOrHandle: Template | number, symbolTable?: ProgramSymbolTable) {
constructor(name?: string, templateOrHandle?: Template | number, symbolTable?: ProgramSymbolTable) {
if (typeof templateOrHandle === 'number') {
this.handle = templateOrHandle;
this.symbolTable = symbolTable;
} else {
this.template = templateOrHandle;
} else if (templateOrHandle !== undefined) {
this.template = unwrapTemplate(templateOrHandle);
}

this.state = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RenderComponentArgs, CustomJitRuntime, renderJitMain, renderJitComponent, getDynamicVar } from '@glimmer/runtime';
import { templateFactory, JitContext } from '@glimmer/opcode-compiler';
import { templateFactory, JitContext, unwrapTemplate, unwrapHandle } from '@glimmer/opcode-compiler';
import { PathReference } from '@glimmer/reference';
import { Environment, ElementBuilder, DynamicScope, TemplateIterator } from '@glimmer/interfaces';

Expand Down Expand Up @@ -36,15 +36,16 @@ export default class RuntimeCompilerLoader implements Loader {
let context = this.getContext(resolver);
let runtime = CustomJitRuntime(resolver, context, app.env);

let mainLayout = templateFactory(mainTemplate).create();
let mainLayout = unwrapTemplate(templateFactory(mainTemplate).create());
let handle = unwrapHandle(mainLayout.asLayout().compile(context));

return Promise.resolve(
renderJitMain(
runtime,
context,
self,
builder,
mainLayout.asLayout().compile(context),
handle,
dynamicScope
)
);
Expand Down
4 changes: 2 additions & 2 deletions packages/@glimmer/blueprint/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
"ember-template-lint": "^1.0.0-beta.6",
"ember-cli-uglify": "^2.0.0-beta.1",
"qunitjs": "^2.3.3",
"typescript": "~3.2.1"
"typescript": "~3.5.3"
},
"engines": {
"node": ">= 4.0"
},
"private": true
}
}
14 changes: 7 additions & 7 deletions packages/@glimmer/compiler-delegates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"types": "dist/types/index.d.ts",
"dependencies": {
"@glimmer/application": "^1.0.0-beta.1",
"@glimmer/bundle-compiler": "^0.42.0",
"@glimmer/bundle-compiler": "^0.43.0",
"@glimmer/component": "^1.0.0-beta.1",
"@glimmer/interfaces": "^0.42.0",
"@glimmer/opcode-compiler": "^0.42.0",
"@glimmer/program": "^0.42.0",
"@glimmer/syntax": "^0.42.0",
"@glimmer/util": "^0.42.0",
"@glimmer/interfaces": "^0.43.0",
"@glimmer/opcode-compiler": "^0.43.0",
"@glimmer/program": "^0.43.0",
"@glimmer/syntax": "^0.43.0",
"@glimmer/util": "^0.43.0",
"@types/node": "^8.0.46",
"debug": "^3.1.0",
"glimmer-analyzer": "^0.3.3",
Expand All @@ -36,4 +36,4 @@
"rollup": "^0.51.5",
"rollup-plugin-virtual": "^1.0.1"
}
}
}
14 changes: 7 additions & 7 deletions packages/@glimmer/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@glimmer/di": "^0.1.9",
"@glimmer/env": "^0.1.7",
"@glimmer/util": "^0.42.0",
"@glimmer/util": "^0.43.0",
"broccoli-file-creator": "^2.1.1",
"broccoli-merge-trees": "^3.0.2",
"ember-cli-babel": "^7.7.3",
Expand All @@ -39,17 +39,17 @@
"ember-cli-normalize-entity-name": "^1.0.0",
"ember-cli-path-utils": "^1.0.0",
"ember-cli-string-utils": "^1.1.0",
"ember-cli-typescript": "^2.0.0-rc.1",
"ember-cli-typescript": "3.0.0",
"ember-compatibility-helpers": "^1.1.2"
},
"devDependencies": {
"@ember/optional-features": "^0.6.1",
"@glimmer/application-test-helpers": "^1.0.0-beta.1",
"@glimmer/compiler": "^0.42.0",
"@glimmer/interfaces": "^0.42.0",
"@glimmer/compiler": "^0.43.0",
"@glimmer/interfaces": "^0.43.0",
"@glimmer/resolver": "^0.3.0",
"@glimmer/tracking": "^1.0.0-beta.1",
"@glimmer/wire-format": "^0.42.0",
"@glimmer/wire-format": "^0.43.0",
"@types/ember": "~3.0.29",
"@types/ember-qunit": "~3.4.3",
"@types/ember-test-helpers": "~1.0.4",
Expand Down Expand Up @@ -85,7 +85,7 @@
"loader.js": "^4.2.3",
"mocha": "^5.0.0",
"qunit-dom": "^0.7.1",
"typescript": "^2.9.2"
"typescript": "~3.5.3"
},
"engines": {
"node": "6.* || 8.* || >= 10.*"
Expand All @@ -95,4 +95,4 @@
"defaultBlueprint": "install-glimmer-component",
"main": "ember-addon-main.js"
}
}
}
10 changes: 5 additions & 5 deletions packages/@glimmer/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"@glimmer/application": "^1.0.0-beta.1",
"@glimmer/component": "^1.0.0-beta.1",
"@glimmer/di": "^0.1.9",
"@glimmer/node": "^0.42.0",
"@glimmer/reference": "^0.42.0",
"@glimmer/runtime": "^0.42.0",
"@glimmer/util": "^0.42.0",
"@glimmer/node": "^0.43.0",
"@glimmer/reference": "^0.43.0",
"@glimmer/runtime": "^0.43.0",
"@glimmer/util": "^0.43.0",
"@simple-dom/document": "^1.4.0",
"@simple-dom/serializer": "^1.4.0",
"@simple-dom/void-map": "^1.4.0"
}
}
}
Loading

0 comments on commit dc9f630

Please sign in to comment.