Skip to content

Commit

Permalink
[CLEANUP beta] Update GlimmerVM to 0.83.1 (remove deprecated renderin…
Browse files Browse the repository at this point in the history
…g features)

* Remove usages of `deprecateMutationsInTrackingTransaction`
* Remove manager-capabilities deprecations
* Remove mutation after consumption deprecations id: `autotracking.mutation-after-consumption`
* Remove `this.` property fallback deprecations id: `this-property-fallback`

Co-Authored-By: Scott Newcomer <snewcomer24@gmail.com>
Co-Authored-By: Nathaniel Furniss <nlfurniss@gmail.com>
  • Loading branch information
3 people committed Nov 8, 2021
1 parent 9d0ed5b commit 5a59337
Show file tree
Hide file tree
Showing 20 changed files with 204 additions and 780 deletions.
26 changes: 13 additions & 13 deletions package.json
Expand Up @@ -48,7 +48,7 @@
"@babel/helper-module-imports": "^7.16.0",
"@babel/plugin-transform-block-scoping": "^7.16.0",
"@ember/edition-utils": "^1.2.0",
"@glimmer/vm-babel-plugins": "0.80.2",
"@glimmer/vm-babel-plugins": "0.83.1",
"babel-plugin-debug-macros": "^0.3.4",
"babel-plugin-filter-imports": "^4.0.0",
"broccoli-concat": "^4.2.5",
Expand All @@ -73,19 +73,19 @@
},
"devDependencies": {
"@babel/preset-env": "^7.9.5",
"@glimmer/compiler": "0.80.2",
"@glimmer/destroyable": "0.80.2",
"@glimmer/compiler": "0.83.1",
"@glimmer/destroyable": "0.83.1",
"@glimmer/env": "^0.1.7",
"@glimmer/global-context": "0.80.2",
"@glimmer/interfaces": "0.80.2",
"@glimmer/manager": "0.80.2",
"@glimmer/node": "0.80.2",
"@glimmer/opcode-compiler": "0.80.2",
"@glimmer/owner": "0.80.2",
"@glimmer/program": "0.80.2",
"@glimmer/reference": "0.80.2",
"@glimmer/runtime": "0.80.2",
"@glimmer/validator": "0.80.2",
"@glimmer/global-context": "0.83.1",
"@glimmer/interfaces": "0.83.1",
"@glimmer/manager": "0.83.1",
"@glimmer/node": "0.83.1",
"@glimmer/opcode-compiler": "0.83.1",
"@glimmer/owner": "0.83.1",
"@glimmer/program": "0.83.1",
"@glimmer/reference": "0.83.1",
"@glimmer/runtime": "0.83.1",
"@glimmer/validator": "0.83.1",
"@simple-dom/document": "^1.4.0",
"@types/qunit": "^2.11.1",
"@types/rsvp": "^4.0.4",
Expand Down
17 changes: 0 additions & 17 deletions packages/@ember/-internals/environment/lib/env.ts
Expand Up @@ -155,23 +155,6 @@ export const ENV = {
*/
_RERENDER_LOOP_LIMIT: 1000,

/**
Allows disabling the implicit this property fallback deprecation. This could be useful
as a way to control the volume of deprecations that are issued by temporarily disabling
the implicit this fallback deprecations, which would allow the other deprecations to be more easily
identified in the console).
NOTE: The fallback behavior **will be removed** in Ember 4.0.0, disabling **_IS NOT_**
a viable strategy for handling this deprecation.
@property _DISABLE_PROPERTY_FALLBACK_DEPRECATION
@for EmberENV
@type boolean
@default false
@private
*/
_DISABLE_PROPERTY_FALLBACK_DEPRECATION: false,

EMBER_LOAD_HOOKS: {} as {
[hook: string]: Function[];
},
Expand Down
18 changes: 0 additions & 18 deletions packages/@ember/-internals/glimmer/lib/environment.ts
Expand Up @@ -98,24 +98,6 @@ const VM_DEPRECATION_OVERRIDES: (DeprecationOptions & {
disabled?: boolean;
message?: string;
})[] = [
{
id: 'autotracking.mutation-after-consumption',
until: '4.0.0',
for: 'ember-source',
since: {
enabled: '3.21.0',
},
},
{
id: 'this-property-fallback',
disabled: ENV._DISABLE_PROPERTY_FALLBACK_DEPRECATION,
url: 'https://deprecations.emberjs.com/v3.x#toc_this-property-fallback',
until: '4.0.0',
for: 'ember-source',
since: {
enabled: '3.26.0',
},
},
{
id: 'argument-less-helper-paren-less-invocation',
url: 'https://deprecations.emberjs.com/v3.x#toc_argument-less-helper-paren-less-invocation',
Expand Down
29 changes: 2 additions & 27 deletions packages/@ember/-internals/glimmer/lib/helper.ts
Expand Up @@ -6,15 +6,9 @@ import { Factory, Owner, setOwner } from '@ember/-internals/owner';
import { FrameworkObject } from '@ember/-internals/runtime';
import { getDebugName, symbol } from '@ember/-internals/utils';
import { join } from '@ember/runloop';
import { DEBUG } from '@glimmer/env';
import { Arguments, Dict, HelperManager } from '@glimmer/interfaces';
import { getInternalHelperManager, helperCapabilities, setHelperManager } from '@glimmer/manager';
import {
consumeTag,
createTag,
deprecateMutationsInTrackingTransaction,
dirtyTag,
} from '@glimmer/validator';
import { consumeTag, createTag, dirtyTag } from '@glimmer/validator';

export const RECOMPUTE_TAG = symbol('RECOMPUTE_TAG');

Expand Down Expand Up @@ -175,16 +169,9 @@ class ClassicHelperManager implements HelperManager<ClassicHelperStateBucket> {
}

getValue({ instance, args }: ClassicHelperStateBucket) {
let ret;
let { positional, named } = args;

if (DEBUG) {
deprecateMutationsInTrackingTransaction!(() => {
ret = instance.compute(positional as unknown[], named);
});
} else {
ret = instance.compute(positional as unknown[], named);
}
let ret = instance.compute(positional as unknown[], named);

consumeTag(instance[RECOMPUTE_TAG]);

Expand Down Expand Up @@ -225,18 +212,6 @@ class SimpleClassicHelperManager implements HelperManager<() => unknown> {
createHelper(definition: Wrapper, args: Arguments) {
let { compute } = definition;

if (DEBUG) {
return () => {
let ret;

deprecateMutationsInTrackingTransaction!(() => {
ret = compute.call(null, args.positional as unknown[], args.named);
});

return ret;
};
}

return () => compute.call(null, args.positional as unknown[], args.named);
}

Expand Down
40 changes: 0 additions & 40 deletions packages/@ember/-internals/glimmer/lib/utils/managers.ts
@@ -1,6 +1,4 @@
import { Owner } from '@ember/-internals/owner';
import { deprecate } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
import { ComponentManager } from '@glimmer/interfaces';
import {
componentCapabilities as glimmerComponentCapabilities,
Expand All @@ -17,41 +15,3 @@ export function setComponentManager(

export let componentCapabilities = glimmerComponentCapabilities;
export let modifierCapabilities = glimmerModifierCapabilities;

if (DEBUG) {
componentCapabilities = (version, options) => {
deprecate(
'Versions of component manager capabilities prior to 3.13 have been deprecated. You must update to the 3.13 capabilities.',
version === '3.13',
{
id: 'manager-capabilities.components-3-4',
url: 'https://deprecations.emberjs.com/v3.x#toc_manager-capabilities-components-3-4',
until: '4.0.0',
for: 'ember-source',
since: {
enabled: '3.26.0',
},
}
);

return glimmerComponentCapabilities(version, options);
};

modifierCapabilities = (version, options) => {
deprecate(
'Versions of modifier manager capabilities prior to 3.22 have been deprecated. You must update to the 3.22 capabilities.',
version === '3.22',
{
id: 'manager-capabilities.modifiers-3-13',
url: 'https://deprecations.emberjs.com/v3.x#toc_manager-capabilities-modifiers-3-13',
until: '4.0.0',
for: 'ember-source',
since: {
enabled: '3.26.0',
},
}
);

return glimmerModifierCapabilities(version, options);
};
}
Expand Up @@ -178,7 +178,7 @@ moduleFor(
}

['@test sharing a template between engine and application has separate refinements']() {
this.assert.expect(2);
this.assert.expect(1);

let sharedTemplate = compile(strip`
<h1>{{this.contextType}}</h1>
Expand All @@ -187,10 +187,6 @@ moduleFor(
{{outlet}}
`);

expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.add('template:application', sharedTemplate);
this.add(
'controller:application',
Expand Down Expand Up @@ -231,16 +227,12 @@ moduleFor(
);

return this.visit('/blog').then(() => {
this.assertText('ApplicationController Data!EngineComponent!');
this.assertText('ApplicationEngineComponent!');
});
}

['@test sharing a layout between engine and application has separate refinements']() {
this.assert.expect(2);

expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);
this.assert.expect(1);

let sharedLayout = compile(strip`
{{ambiguous-curlies}}
Expand Down Expand Up @@ -293,7 +285,7 @@ moduleFor(
);

return this.visit('/blog').then(() => {
this.assertText('ApplicationLocal Data!EngineComponent!');
this.assertText('ApplicationEngineComponent!');
});
}

Expand Down
Expand Up @@ -105,47 +105,7 @@ moduleFor(
});
}

['@test it can access the model provided by the route via implicit this fallback']() {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.add(
'route:application',
Route.extend({
model() {
return ['red', 'yellow', 'blue'];
},
})
);

this.addTemplate(
'application',
strip`
<ul>
{{#each model as |item|}}
<li>{{item}}</li>
{{/each}}
</ul>
`
);

return this.visit('/').then(() => {
this.assertInnerHTML(strip`
<ul>
<li>red</li>
<li>yellow</li>
<li>blue</li>
</ul>
`);
});
}

async ['@test interior mutations on the model with set'](assert) {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.router.map(function () {
this.route('color', { path: '/:color' });
});
Expand All @@ -164,7 +124,7 @@ moduleFor(
strip`
[@model: {{@model.color}}]
[this.model: {{this.model.color}}]
[model: {{model.color}}]
[model: {{this.model.color}}]
`
);

Expand Down Expand Up @@ -203,10 +163,6 @@ moduleFor(
}

async ['@test interior mutations on the model with tracked properties'](assert) {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

class Model {
@tracked color;

Expand All @@ -233,7 +189,7 @@ moduleFor(
strip`
[@model: {{@model.color}}]
[this.model: {{this.model.color}}]
[model: {{model.color}}]
[model: {{this.model.color}}]
`
);

Expand Down Expand Up @@ -271,10 +227,6 @@ moduleFor(
}

async ['@test exterior mutations on the model with set'](assert) {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.router.map(function () {
this.route('color', { path: '/:color' });
});
Expand All @@ -293,7 +245,7 @@ moduleFor(
strip`
[@model: {{@model}}]
[this.model: {{this.model}}]
[model: {{model}}]
[model: {{this.model}}]
`
);

Expand Down Expand Up @@ -332,10 +284,6 @@ moduleFor(
}

async ['@test exterior mutations on the model with tracked properties'](assert) {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.router.map(function () {
this.route('color', { path: '/:color' });
});
Expand All @@ -361,7 +309,7 @@ moduleFor(
strip`
[@model: {{@model}}]
[this.model: {{this.model}}]
[model: {{model}}]
[model: {{this.model}}]
`
);

Expand Down
Expand Up @@ -9,7 +9,7 @@ import { Component } from '../../utils/helpers';

class CustomModifierManager {
constructor(owner) {
this.capabilities = modifierCapabilities('3.13');
this.capabilities = modifierCapabilities('3.22');
this.owner = owner;
}

Expand Down
Expand Up @@ -3515,24 +3515,6 @@ moduleFor(
this.assertComponentElement(this.firstChild, { content: 'hello' });
}

['@test can use `{{component.foo}}` in a template GH#19313']() {
expectDeprecation(
/The `[^`]+` property(?: path)? was used in the `[^`]+` template without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);

this.registerComponent('foo-bar', {
template: '{{component.foo}}',
});

this.render('{{foo-bar component=(hash foo="bar")}}');

this.assertComponentElement(this.firstChild, { content: 'bar' });

runTask(() => this.rerender());

this.assertComponentElement(this.firstChild, { content: 'bar' });
}

['@test can use `{{@component.foo}}` in a template GH#19313']() {
this.registerComponent('foo-bar', {
template: '{{@component.foo}}',
Expand Down

0 comments on commit 5a59337

Please sign in to comment.