Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #333 from glimmerjs/update-glimmer-vm-0.77.1
Browse files Browse the repository at this point in the history
Update Glimmer VM to 0.77.1
  • Loading branch information
Chris Garrett authored Mar 17, 2021
2 parents 63f257c + 1cd2f36 commit 364140c
Show file tree
Hide file tree
Showing 27 changed files with 312 additions and 222 deletions.
11 changes: 11 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
'plugin:prettier/recommended',
],
plugins: ['@typescript-eslint', 'prettier'],

overrides: [
// node files
{
Expand Down Expand Up @@ -76,6 +77,16 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],

'@typescript-eslint/ban-types': ['error', {
types: {
// we currently use `object` as "valid WeakMap key" in a lot of APIs
object: false,

// this is a great one to ban, will do in a followup PR
'{}': false,
}
}],

// disabling this one because of DEBUG APIs, if we ever find a better
// way to suport those we should re-enable it
'@typescript-eslint/no-non-null-assertion': 'off',
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### :boom: Breaking Change
* `@glimmer/component`, `@glimmer/core`, `@glimmer/helper`, `@glimmer/modifier`, `@glimmer/ssr`, `@glimmer/tracking`, `babel-plugins`
* [#324](https://github.com/glimmerjs/glimmer.js/pull/324) Updating glimmer-vm to 0.73.0 ([@chiragpat](https://github.com/chiragpat))
* [#324](https://github.com/glimmerjs/glimmer.js/pull/324) Updating glimmer-vm to 0.77.3 ([@chiragpat](https://github.com/chiragpat))

#### :house: Internal
* `@glimmer/component`, `@glimmer/core`, `@glimmer/helper`, `@glimmer/modifier`, `@glimmer/ssr`, `@glimmer/tracking`, `babel-plugins`
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"@babel/preset-env": "^7.9.0",
"@babel/preset-typescript": "^7.9.0",
"@types/qunit": "^2.9.1",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"babel-loader": "^8.1.0",
"dtslint": "^3.4.1",
"eslint": "^6.8.0",
Expand All @@ -71,7 +71,7 @@
"ts-loader": "^6.2.2",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"tslib": "^1.11.1",
"typescript": "~3.8.3",
"typescript": "~4.2.3",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ComponentManager, ComponentCapabilities, TemplateArgs } from '@glimmer/
import BaseComponent, { ARGS_SET } from './component';

export interface Constructor<T> {
new (owner: unknown, args: {}): T;
new (owner: unknown, args: Record<string, unknown>): T;
}

export default abstract class BaseComponentManager<GlimmerComponent extends BaseComponent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ import { gte } from 'ember-compatibility-helpers';
import BaseComponentManager from './base-component-manager';

import GlimmerComponent, { setDestroyed, setDestroying } from './component';
import { ComponentCapabilities, CapturedArgs } from '@glimmer/core';
import { ComponentCapabilities } from '@glimmer/core';
import { Arguments } from '@glimmer/interfaces';

const CAPABILITIES = gte('3.13.0-beta.1')
? capabilities('3.13', {
destructor: true,
asyncLifecycleCallbacks: false,
asyncLifeCycleCallbacks: false,
updateHook: false,
})
: capabilities('3.4', {
destructor: true,
asyncLifecycleCallbacks: false,
asyncLifeCycleCallbacks: false,
});

function scheduledDestroyComponent(component: GlimmerComponent, meta: EmberMeta): void {
Expand Down Expand Up @@ -56,7 +57,7 @@ class EmberGlimmerComponentManager extends BaseComponentManager<GlimmerComponent
}

interface EmberGlimmerComponentManager {
updateComponent?: (component: GlimmerComponent, args: CapturedArgs) => void;
updateComponent?: (component: GlimmerComponent, args: Arguments) => void;
}

// In Ember 3.12 and earlier, the updateComponent hook was mandatory.
Expand All @@ -68,7 +69,7 @@ interface EmberGlimmerComponentManager {
if (!gte('3.13.0-beta.1')) {
EmberGlimmerComponentManager.prototype.updateComponent = function updateComponent(
component: GlimmerComponent,
args: CapturedArgs
args: Arguments
): void {
let argSnapshot = args.named;

Expand Down
9 changes: 9 additions & 0 deletions packages/@glimmer/component/addon/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { DEBUG } from '@glimmer/env';
import ApplicationInstance from '@ember/application/instance';

// Hax because Ember does not have types for `setComponentManager`
declare module '@ember/component' {
export function setComponentManager<T extends object>(
factory: (owner: ApplicationInstance) => GlimmerComponentManager,
T
): T;
}

import { setComponentManager } from '@ember/component';

import GlimmerComponentManager from './-private/ember-component-manager';
Expand Down
8 changes: 4 additions & 4 deletions packages/@glimmer/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"dependencies": {
"@glimmer/env": "^0.1.7",
"@glimmer/util": "0.73.0",
"@glimmer/util": "0.77.3",
"@glimmer/core": "2.0.0-beta.12",
"broccoli-file-creator": "^2.1.1",
"broccoli-merge-trees": "^3.0.2",
Expand All @@ -43,11 +43,11 @@
"devDependencies": {
"@ember/optional-features": "^0.6.1",
"@glimmer/application-test-helpers": "^1.0.0",
"@glimmer/compiler": "0.73.0",
"@glimmer/interfaces": "0.73.0",
"@glimmer/compiler": "0.77.3",
"@glimmer/interfaces": "0.77.3",
"@glimmer/resolver": "^0.3.0",
"@glimmer/tracking": "2.0.0-beta.12",
"@glimmer/wire-format": "0.73.0",
"@glimmer/wire-format": "0.77.3",
"@types/ember": "~3.0.29",
"@types/ember-qunit": "~3.4.3",
"@types/ember-test-helpers": "~1.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/@glimmer/component/test/interactive/args-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ QUnit.module('[@glimmer/component] Component Arguments', () => {
@tracked firstName = 'Tom';
@tracked status = 'is dope';

constructor(owner: unknown, args: {}) {
constructor(owner: object, args: {}) {
super(owner, args);
parent = this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ QUnit.module('[@glimmer/component] Lifecycle Hooks', () => {
let component1: Component1;

abstract class HookLoggerComponent extends Component<{ name: string }> {
constructor(owner: unknown, args: { name: string }) {
constructor(owner: object, args: { name: string }) {
super(owner, args);
invocations.push([this.args.name, 'constructor']);
}
Expand All @@ -26,7 +26,7 @@ QUnit.module('[@glimmer/component] Lifecycle Hooks', () => {
@tracked firstName = 'Chirag';
@tracked showChildren = true;

constructor(owner: unknown, args: { name: string }) {
constructor(owner: object, args: { name: string }) {
super(owner, args);
component1 = this;
}
Expand Down
18 changes: 9 additions & 9 deletions packages/@glimmer/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
},
"dependencies": {
"@glimmer/env": "^0.1.7",
"@glimmer/global-context": "0.73.0",
"@glimmer/interfaces": "0.73.0",
"@glimmer/manager": "0.73.0",
"@glimmer/opcode-compiler": "0.73.0",
"@glimmer/owner": "0.73.0",
"@glimmer/program": "0.73.0",
"@glimmer/runtime": "0.73.0",
"@glimmer/validator": "0.73.0",
"@glimmer/global-context": "0.77.3",
"@glimmer/interfaces": "0.77.3",
"@glimmer/manager": "0.77.3",
"@glimmer/opcode-compiler": "0.77.3",
"@glimmer/owner": "0.77.3",
"@glimmer/program": "0.77.3",
"@glimmer/runtime": "0.77.3",
"@glimmer/validator": "0.77.3",
"@simple-dom/interface": "^1.4.0"
},
"devDependencies": {
"@glimmer/compiler": "0.73.0",
"@glimmer/compiler": "0.77.3",
"@glimmer/component": "2.0.0-beta.12",
"@glimmer/tracking": "2.0.0-beta.12"
},
Expand Down
12 changes: 12 additions & 0 deletions packages/@glimmer/core/src/environment/delegates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ setGlobalContext({
warnIfStyleNotTrusted() {
// Do nothing
},

assert(test: unknown, msg: string) {
if (!test) {
throw new Error(msg);
}
},

deprecate(msg: string, test: unknown) {
if (!test) {
console.warn(msg);
}
},
});

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@glimmer/core/test/non-interactive/render-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ QUnit.module(`[@glimmer/core] non-interactive rendering tests`, () => {

class MyComponent extends Component {
get myLocale(): string {
return getOwner<Owner>(this).services.locale.currentLocale;
return getOwner<Owner>(this)!.services.locale.currentLocale;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/@glimmer/helper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@glimmer/component": "2.0.0-beta.12",
"@glimmer/core": "2.0.0-beta.12",
"@glimmer/runtime": "0.73.0"
"@glimmer/runtime": "0.77.3"
},
"volta": {
"node": "12.16.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/@glimmer/modifier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build": "webpack"
},
"dependencies": {
"@glimmer/runtime": "0.73.0"
"@glimmer/runtime": "0.77.3"
},
"volta": {
"node": "12.16.1",
Expand Down
1 change: 1 addition & 0 deletions packages/@glimmer/modifier/src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export function action(_target: {}, _key: string, desc?: PropertyDescriptor): Pr
enumerable: desc!.enumerable,
configurable: desc!.configurable,

// eslint-disable-next-line @typescript-eslint/ban-types
get(): Function {
let bindings = BINDINGS_MAP.get(this);
if (bindings === undefined) {
Expand Down
8 changes: 4 additions & 4 deletions packages/@glimmer/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"module": "dist/modules/index.js",
"dependencies": {
"@glimmer/core": "2.0.0-beta.12",
"@glimmer/node": "0.73.0",
"@glimmer/reference": "0.73.0",
"@glimmer/runtime": "0.73.0",
"@glimmer/util": "0.73.0",
"@glimmer/node": "0.77.3",
"@glimmer/reference": "0.77.3",
"@glimmer/runtime": "0.77.3",
"@glimmer/util": "0.77.3",
"@simple-dom/document": "^1.4.0",
"@simple-dom/serializer": "^1.4.0",
"@simple-dom/void-map": "^1.4.0"
Expand Down
8 changes: 4 additions & 4 deletions packages/@glimmer/tracking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
],
"dependencies": {
"@glimmer/env": "^0.1.7",
"@glimmer/validator": "0.73.0"
"@glimmer/validator": "0.77.3"
},
"devDependencies": {
"@glimmer/application-test-helpers": "^1.0.0",
"@glimmer/compiler": "0.73.0",
"@glimmer/interfaces": "0.73.0",
"@glimmer/compiler": "0.77.3",
"@glimmer/interfaces": "0.77.3",
"@glimmer/resolver": "^0.3.0",
"@glimmer/wire-format": "0.73.0"
"@glimmer/wire-format": "0.77.3"
},
"ember-addon": {
"main": "ember-addon-main.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/@glimmer/tracking/test/tracked-decorator-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DEBUG } from '@glimmer/env';
import { track, valueForTag, validateTag } from '@glimmer/validator';

import * as TSFixtures from './fixtures/typescript';
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import * as BabelFixtures from './fixtures/babel';
import { assertValidAfterUnrelatedBump } from './helpers/tags';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@babel/helper-module-imports": "^7.0.0",
"@babel/parser": "^7.9.4",
"@babel/types": "^7.9.0",
"@glimmer/compiler": "0.73.0"
"@glimmer/compiler": "0.77.3"
},
"devDependencies": {
"@babel/preset-env": "^7.8.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
({
"id": "iQBI6eOx",
"id": null,
"block": "[[[10,\"h1\"],[12],[1,\"Hello world\"],[13]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from './component';
({
"id": "zK8QcLjf",
"id": null,
"block": "[[[8,[32,0],null,null,null]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": () => [Component],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
({
"id": "gPHf663l",
"id": null,
"block": "[[[10,\"h1\"],[12],[1,\"Hello World\"],[13]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
"isStrictMode": true
});
({
"id": "gPHf663l",
"id": null,
"block": "[[[10,\"h1\"],[12],[1,\"Hello World\"],[13]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from './component';
({
"id": "zK8QcLjf",
"id": null,
"block": "[[[8,[32,0],null,null,null]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": () => [Component],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Component from './component';
({
"id": "zK8QcLjf",
"id": null,
"block": "[[[8,[32,0],null,null,null]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": () => [Component],
"isStrictMode": true
});
({
"id": "zK8QcLjf",
"id": null,
"block": "[[[8,[32,0],null,null,null]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": () => [Component],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('precompileTemplate', () => {
let precompiled = precompileTemplate(`<h1>Hello World</h1>`);

expect(precompiled).to.equal(`({
"id": "gPHf663l",
"id": null,
"block": "[[[10,\\"h1\\"],[12],[1,\\"Hello World\\"],[13]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
Expand All @@ -46,7 +46,7 @@ describe('precompileTemplate', () => {
let precompiled = precompileTemplate(`<Component/>`, ['Component']);

expect(precompiled).to.equal(`({
"id": "zK8QcLjf",
"id": null,
"block": "[[[8,[32,0],null,null,null]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": () => [Component],
Expand All @@ -62,7 +62,7 @@ describe('precompileTemplate', () => {
);

expect(precompiled).to.equal(`({
"id": "iQBI6eOx",
"id": null,
"block": "[[[10,\\"h1\\"],[12],[1,\\"Hello world\\"],[13]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
Expand Down
Loading

0 comments on commit 364140c

Please sign in to comment.