Skip to content

Commit

Permalink
Update glimmer-vm to prevent errors for older inline precompilation
Browse files Browse the repository at this point in the history
This updates glimmer-vm to avoid emitting the `scope` property on
precompiled template blocks when not using strict mode (when using
strict mode `scope` will either be `null` or a function).

This is specifically to work around a bug in older versions of
babel-plugin-htmlbars-inline-precompile (versions from v2.0.0 through
v4.0.1) where they would (incorrectly) attempt to build an
`ObjectExpression` when a `null` value is found in the template
precompilation result (D'oh!).

Note: those versions of babel-plugin-htmlbars-inline-precompile should
still be migrated away from (they are quite old, and will definitely not
work for newer features like strict mode).

(cherry picked from commit 9bc0b49)
  • Loading branch information
rwjblue committed Feb 2, 2021
1 parent 2c9ebcc commit d08a6b1
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 146 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@babel/plugin-transform-block-scoping": "^7.8.3",
"@babel/plugin-transform-object-assign": "^7.8.3",
"@ember/edition-utils": "^1.2.0",
"@glimmer/vm-babel-plugins": "0.74.0",
"@glimmer/vm-babel-plugins": "0.74.2",
"babel-plugin-debug-macros": "^0.3.3",
"babel-plugin-filter-imports": "^4.0.0",
"broccoli-concat": "^4.2.4",
Expand All @@ -75,19 +75,19 @@
},
"devDependencies": {
"@babel/preset-env": "^7.9.5",
"@glimmer/compiler": "0.74.0",
"@glimmer/compiler": "0.74.2",
"@glimmer/env": "^0.1.7",
"@glimmer/global-context": "0.74.0",
"@glimmer/interfaces": "0.74.0",
"@glimmer/manager": "0.74.0",
"@glimmer/destroyable": "0.74.0",
"@glimmer/owner": "0.74.0",
"@glimmer/node": "0.74.0",
"@glimmer/opcode-compiler": "0.74.0",
"@glimmer/program": "0.74.0",
"@glimmer/reference": "0.74.0",
"@glimmer/runtime": "0.74.0",
"@glimmer/validator": "0.74.0",
"@glimmer/global-context": "0.74.2",
"@glimmer/interfaces": "0.74.2",
"@glimmer/manager": "0.74.2",
"@glimmer/destroyable": "0.74.2",
"@glimmer/owner": "0.74.2",
"@glimmer/node": "0.74.2",
"@glimmer/opcode-compiler": "0.74.2",
"@glimmer/program": "0.74.2",
"@glimmer/reference": "0.74.2",
"@glimmer/runtime": "0.74.2",
"@glimmer/validator": "0.74.2",
"@simple-dom/document": "^1.4.0",
"@types/qunit": "^2.9.1",
"@types/rsvp": "^4.0.3",
Expand Down
20 changes: 18 additions & 2 deletions packages/@ember/-internals/glimmer/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ setGlobalContext({

if (!override) throw new Error(`deprecation override for ${id} not found`);

deprecate(override.message ?? msg, Boolean(test), override);
// allow deprecations to be disabled in the VM_DEPRECATION_OVERRIDES array below
if (!override.disabled) {
deprecate(override.message ?? msg, Boolean(test), override);
}
}
},
});
Expand All @@ -91,7 +94,10 @@ if (DEBUG) {

// VM Assertion/Deprecation overrides

const VM_DEPRECATION_OVERRIDES: (DeprecationOptions & { message?: string })[] = [
const VM_DEPRECATION_OVERRIDES: (DeprecationOptions & {
disabled?: boolean;
message?: string;
})[] = [
{
id: 'autotracking.mutation-after-consumption',
until: '4.0.0',
Expand All @@ -100,6 +106,16 @@ const VM_DEPRECATION_OVERRIDES: (DeprecationOptions & { message?: string })[] =
enabled: '3.21.0',
},
},
{
id: 'this-property-fallback',
disabled: true,
url: 'https://deprecations.emberjs.com/v3.x#toc_this-property-fallback',
until: '4.0.0',
for: 'ember-source',
since: {
enabled: '3.26.0',
},
},
];

const VM_ASSERTION_OVERRIDES: { id: string; message: string }[] = [];
Expand Down
Loading

0 comments on commit d08a6b1

Please sign in to comment.