Skip to content

Commit

Permalink
Merge branch 'glimmerjs:main' into add-previous-element-to-in-element
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx authored Jun 12, 2024
2 parents e6ba8a7 + 72bd97c commit 33b496c
Show file tree
Hide file tree
Showing 68 changed files with 1,173 additions and 1,115 deletions.
70 changes: 70 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,76 @@









## v0.92.0 (2024-04-08)

#### :rocket: Enhancement
* `@glimmer-workspace/integration-tests`, `@glimmer/compiler`, `@glimmer/interfaces`, `@glimmer/syntax`
* [#1585](https://github.com/glimmerjs/glimmer-vm/pull/1585) Introduce `keywords` option for `precompile` ([@chancancode](https://github.com/chancancode))

#### Committers: 1
- Godfrey Chan ([@chancancode](https://github.com/chancancode))

## v0.91.2 (2024-04-05)

#### :bug: Bug Fix
* `@glimmer/syntax`
* [#1577](https://github.com/glimmerjs/glimmer-vm/pull/1577) fix extra spaces in block params ([@patricklx](https://github.com/patricklx))

#### Committers: 1
- Patrick Pircher ([@patricklx](https://github.com/patricklx))

## v0.91.1 (2024-03-28)

#### :bug: Bug Fix
* `@glimmer/syntax`
* [#1583](https://github.com/glimmerjs/glimmer-vm/pull/1583) [BUGFIX] Ensure legacy path.parts matches existing semantics ([@chancancode](https://github.com/chancancode))

#### Committers: 1
- Godfrey Chan ([@chancancode](https://github.com/chancancode))

## v0.91.0 (2024-03-25)

#### :rocket: Enhancement
* `@glimmer/syntax`
* [#1582](https://github.com/glimmerjs/glimmer-vm/pull/1582) Prevent use of ...attributes in invalid places ([@NullVoxPopuli](https://github.com/NullVoxPopuli))

#### Committers: 1
- [@NullVoxPopuli](https://github.com/NullVoxPopuli)

## v0.90.1 (2024-03-22)

#### :bug: Bug Fix
* `@glimmer/compiler`, `@glimmer/syntax`
* [#1581](https://github.com/glimmerjs/glimmer-vm/pull/1581) Remove index imports as they are not defined by package.json#exports ([@NullVoxPopuli](https://github.com/NullVoxPopuli))

#### Committers: 1
- [@NullVoxPopuli](https://github.com/NullVoxPopuli)

## v0.90.0 (2024-03-22)

#### :boom: Breaking Change
* `@glimmer-workspace/integration-tests`, `@glimmer/runtime`
* [#1580](https://github.com/glimmerjs/glimmer-vm/pull/1580) Remove deprecation for setting hash properties (from years ago) ([@NullVoxPopuli](https://github.com/NullVoxPopuli))

#### :rocket: Enhancement
* `@glimmer-workspace/integration-tests`, `@glimmer/runtime`
* [#1580](https://github.com/glimmerjs/glimmer-vm/pull/1580) Remove deprecation for setting hash properties (from years ago) ([@NullVoxPopuli](https://github.com/NullVoxPopuli))

#### :bug: Bug Fix
* `@glimmer/compiler`, `@glimmer/debug`, `@glimmer/encoder`, `@glimmer/global-context`, `@glimmer/interfaces`, `@glimmer/local-debug-flags`, `@glimmer/manager`, `@glimmer/node`, `@glimmer/opcode-compiler`, `@glimmer/program`, `@glimmer/syntax`, `@glimmer/vm`
* [#1579](https://github.com/glimmerjs/glimmer-vm/pull/1579) Add missing licenses ([@andreyfel](https://github.com/andreyfel))

#### Committers: 3
- Andrey Fel ([@andreyfel](https://github.com/andreyfel))
- Godfrey Chan ([@chancancode](https://github.com/chancancode))
- [@NullVoxPopuli](https://github.com/NullVoxPopuli)

## v0.89.0 (2024-03-09)

#### :rocket: Enhancement
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "glimmer-engine",
"version": "0.89.0",
"version": "0.92.0",
"private": true,
"license": "MIT",
"description": "Glimmer compiles Handlebars templates into document fragments rather than string buffers",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export default class JitCompileTimeLookup implements CompileTimeResolver {
return this.resolver.lookupComponent(name, owner);
}

lookupBuiltInHelper(_name: string): Nullable<HelperDefinitionState> {
return null;
lookupBuiltInHelper(name: string): Nullable<HelperDefinitionState> {
return this.resolver.lookupHelper(`$keyword.${name}`);
}

lookupBuiltInModifier(_name: string): Nullable<ModifierDefinitionState> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ export interface DefineComponentOptions {

// defaults to true when some scopeValues are passed and false otherwise
strictMode?: boolean;

// additional strict-mode keywords
keywords?: string[];
}

export function defineComponent(
Expand All @@ -110,8 +113,10 @@ export function defineComponent(
strictMode = scopeValues !== null;
}

let keywords = options.keywords ?? [];

let definition = options.definition ?? templateOnlyComponent();
let templateFactory = createTemplate(templateSource, { strictMode }, scopeValues ?? {});
let templateFactory = createTemplate(templateSource, { strictMode, keywords }, scopeValues ?? {});
setComponentTemplate(templateFactory, definition);
return definition;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,93 +185,6 @@ class HashTest extends RenderTest {
this.assertHTML('Godfrey');
this.assertStableRerender();
}

@test
'defined hash keys can be updated'(assert: Assert) {
class FooBar extends GlimmerishComponent {
constructor(owner: object, args: { hash: Record<string, unknown> }) {
super(owner, args);
args.hash['firstName'] = 'Chad';

assert.strictEqual(args.hash['firstName'], 'Chad', 'Name updated in JS');
}
}

this.registerComponent('Glimmer', 'FooBar', `{{yield @hash}}`, FooBar);

this.render(
`<FooBar @hash={{hash firstName="Godfrey" lastName="Hietala"}} as |values|>{{values.firstName}} {{values.lastName}}</FooBar>`
);

// Name will not be updated in templates because templates access the child
// reference on hashes directly
this.assertHTML('Godfrey Hietala');
this.assertStableRerender();

assert.validateDeprecations(
/You set the 'firstName' property on a \{\{hash\}\} object. Setting properties on objects generated by \{\{hash\}\} is deprecated. Please update to use an object created with a tracked property or getter, or with a custom helper./u
);
}

@test
'defined hash keys are reset whenever the upstream changes'(assert: Assert) {
class FooBar extends GlimmerishComponent {
constructor(owner: object, args: { hash: Record<string, unknown> }) {
super(owner, args);
args.hash['name'] = 'Chad';
}

get alias() {
return (this.args['hash'] as Record<string, unknown>)['name'];
}
}

this.registerComponent('Glimmer', 'FooBar', `{{yield @hash this.alias}}`, FooBar);

this.render(
`<FooBar @hash={{hash name=this.name}} as |values alias|>{{values.name}} {{alias}}</FooBar>`,
{
name: 'Godfrey',
}
);

// JS alias will be updated, version accessed lazily in templates will not
this.assertHTML('Godfrey Chad');
this.assertStableRerender();

this.rerender({ name: 'Tom' });

// Both will be updated to match the new value
this.assertHTML('Tom Tom');
this.assertStableRerender();

assert.validateDeprecations(
/You set the 'name' property on a \{\{hash\}\} object. Setting properties on objects generated by \{\{hash\}\} is deprecated. Please update to use an object created with a tracked property or getter, or with a custom helper./u
);
}

@test
'undefined hash keys can be updated'(assert: Assert) {
class FooBar extends GlimmerishComponent {
constructor(owner: object, args: { hash: Record<string, unknown> }) {
super(owner, args);
args.hash['lastName'] = 'Chan';
}
}

this.registerComponent('Glimmer', 'FooBar', `{{yield @hash}}`, FooBar);

this.render(
`<FooBar @hash={{hash firstName="Godfrey"}} as |values|>{{values.firstName}} {{values.lastName}}</FooBar>`
);

this.assertHTML('Godfrey Chan');
this.assertStableRerender();

assert.validateDeprecations(
/You set the 'lastName' property on a \{\{hash\}\} object. Setting properties on objects generated by \{\{hash\}\} is deprecated. Please update to use an object created with a tracked property or getter, or with a custom helper./u
);
}
}

jitSuite(HashTest);
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class DynamicModifiersResolutionModeTest extends RenderTest {
this.registerComponent('TemplateOnly', 'Bar', '<div {{x.foo}}></div>');
},
syntaxErrorFor(
'You attempted to invoke a path (`{{#x.foo}}`) as a modifier, but x was not in scope. Try adding `this` to the beginning of the path',
'You attempted to invoke a path (`{{x.foo}}`) as a modifier, but x was not in scope',
'{{x.foo}}',
'an unknown module',
1,
Expand Down
Loading

0 comments on commit 33b496c

Please sign in to comment.