ember-freestyle 0.23.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +3 -3
- package/lib/ast-transform.js +0 -54
- package/package.json +5 -10
- package/types/glimmer-tracking-cached.d.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,18 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
|
|
12
|
+
## v0.24.0 (2026-04-21)
|
|
13
|
+
|
|
14
|
+
#### :boom: Breaking Change
|
|
15
|
+
* [#1028](https://github.com/chrislopresto/ember-freestyle/pull/1028) Raise floor to Ember 4.4 / Node 20 and drop stale polyfills ([@lukemelia](https://github.com/lukemelia))
|
|
16
|
+
|
|
17
|
+
#### :memo: Documentation
|
|
18
|
+
* [#1028](https://github.com/chrislopresto/ember-freestyle/pull/1028) Raise floor to Ember 4.4 / Node 20 and drop stale polyfills ([@lukemelia](https://github.com/lukemelia))
|
|
19
|
+
|
|
20
|
+
#### Committers: 1
|
|
21
|
+
- Luke Melia ([@lukemelia](https://github.com/lukemelia))
|
|
22
|
+
|
|
11
23
|
## v0.23.1 (2026-04-21)
|
|
12
24
|
|
|
13
25
|
#### :house: Internal
|
package/README.md
CHANGED
|
@@ -23,9 +23,9 @@ To see Ember Freestyle in action, visit [https://chrislopresto.github.io/ember-f
|
|
|
23
23
|
|
|
24
24
|
## Compatibility
|
|
25
25
|
|
|
26
|
-
* Ember.js
|
|
27
|
-
* Ember CLI
|
|
28
|
-
* Node.js
|
|
26
|
+
* Ember.js v4.4 or above
|
|
27
|
+
* Ember CLI v4.4 or above
|
|
28
|
+
* Node.js v20 or above
|
|
29
29
|
* Ember Auto Import v2 or above
|
|
30
30
|
|
|
31
31
|
ember-freestyle includes TypeScript types, and provides a template registry that can be imported from `ember-freestyle/template-registry` for Glint usage.
|
package/lib/ast-transform.js
CHANGED
|
@@ -2,52 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const stripIndent = require('strip-indent');
|
|
4
4
|
|
|
5
|
-
function hasNamedBlocksPolyfillSyntax(node) {
|
|
6
|
-
return (
|
|
7
|
-
node.children.length === 1 &&
|
|
8
|
-
node.children[0].path &&
|
|
9
|
-
node.children[0].path.original === 'if' &&
|
|
10
|
-
node.children[0].params[0].path.original === '-is-named-block-invocation'
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function extractFromNamedBlocksPolyfillSyntax(node) {
|
|
15
|
-
if (node.children[0].params[0].params[1].value === 'example') {
|
|
16
|
-
return node.children[0].program;
|
|
17
|
-
} else if (
|
|
18
|
-
node.children[0].inverse.body[0].params[0].params[1].value === 'example'
|
|
19
|
-
) {
|
|
20
|
-
return node.children[0].inverse.body[0].program;
|
|
21
|
-
} else if (
|
|
22
|
-
node.children[0].inverse.body[0].inverse.body[0].params[0].params[1]
|
|
23
|
-
.value == 'example'
|
|
24
|
-
) {
|
|
25
|
-
return node.children[0].inverse.body[0].inverse.body[0].program;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function cleanupNamedBlocksPolyfillSyntax(sourceString) {
|
|
30
|
-
sourceString = sourceString.trim();
|
|
31
|
-
sourceString = sourceString.replace(
|
|
32
|
-
/({{#if \(-is-named-block-invocation __arg0 "(.+?)"\)}})(\s*)(.*?)(\s*){{\/if}}/gs,
|
|
33
|
-
'\n <:$2>$3$4$5</:$2>\n',
|
|
34
|
-
);
|
|
35
|
-
sourceString = sourceString.replace(
|
|
36
|
-
/ @namedBlocksInfo={{hash .+?=0}} as \|__arg0\|/,
|
|
37
|
-
'',
|
|
38
|
-
);
|
|
39
|
-
sourceString = sourceString.replace(/(\s\s+)/g, '\n$1');
|
|
40
|
-
sourceString = sourceString.replace(/ @(\w+)=/g, '\n @$1=');
|
|
41
|
-
sourceString =
|
|
42
|
-
sourceString +
|
|
43
|
-
`
|
|
44
|
-
|
|
45
|
-
<!-- Formatting lost due to named-blocks-polyfill. Fallback re-formatting applied.
|
|
46
|
-
Original source code formatting will be available once the polyfill is no longer needed. -->
|
|
47
|
-
`;
|
|
48
|
-
return sourceString;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
5
|
function escapeCurlyBraces(s) {
|
|
52
6
|
return s.replace(/\{/g, '{').replace(/\}/g, '}');
|
|
53
7
|
}
|
|
@@ -77,18 +31,10 @@ module.exports = function ({ contents, syntax }) {
|
|
|
77
31
|
node.attributes.push(b.attr('@source', b.text(sourceString)));
|
|
78
32
|
}
|
|
79
33
|
if (['Freestyle::Usage', 'FreestyleUsage'].includes(node.tag)) {
|
|
80
|
-
// Note: if the ember-named-blocks-polyfill polyfill AST transform executed before ours, our code will not work
|
|
81
|
-
// Due to a bug in ember, the current way to ensure this is to configure freestyle to run *after* named-blocks-polyfill
|
|
82
|
-
// via the ember-addon section of freestyle's package.json. ¯\_(ツ)_/¯
|
|
83
34
|
let exampleNode = node.children.find((n) => n.tag === ':example');
|
|
84
35
|
let sourceString;
|
|
85
36
|
if (exampleNode) {
|
|
86
37
|
sourceString = extractSource(exampleNode.children, contents);
|
|
87
|
-
} else if (hasNamedBlocksPolyfillSyntax(node)) {
|
|
88
|
-
// Unfortunately, we may still run after the named-blocks-polyfill when in an Ember Addon, so we do the best we can here.
|
|
89
|
-
exampleNode = extractFromNamedBlocksPolyfillSyntax(node);
|
|
90
|
-
sourceString = extractSource(exampleNode.body, contents);
|
|
91
|
-
sourceString = cleanupNamedBlocksPolyfillSyntax(sourceString);
|
|
92
38
|
} else {
|
|
93
39
|
exampleNode = node; // not using named blocks
|
|
94
40
|
sourceString = extractSource(exampleNode.children, contents);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-freestyle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Create a living styleguide for your Ember app.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -39,13 +39,11 @@
|
|
|
39
39
|
"@glimmer/component": "^1.1.2",
|
|
40
40
|
"@glimmer/tracking": "^1.1.2",
|
|
41
41
|
"ember-auto-import": "^2.4.3",
|
|
42
|
-
"ember-cached-decorator-polyfill": "^1.0.2",
|
|
43
42
|
"ember-cli-babel": "^8.2.0",
|
|
44
43
|
"ember-cli-htmlbars": "^6.3.0",
|
|
45
44
|
"ember-cli-typescript": "^5.1.1",
|
|
46
45
|
"ember-focus-trap": "^1.0.1",
|
|
47
46
|
"ember-modifier": "^3.2.7 || ^4.0.0",
|
|
48
|
-
"ember-named-blocks-polyfill": "^0.2.5",
|
|
49
47
|
"ember-truth-helpers": "^4.0.3",
|
|
50
48
|
"json-formatter-js": "^2.3.4",
|
|
51
49
|
"macro-decorators": "^0.1.2",
|
|
@@ -146,7 +144,7 @@
|
|
|
146
144
|
}
|
|
147
145
|
},
|
|
148
146
|
"engines": {
|
|
149
|
-
"node": ">=
|
|
147
|
+
"node": ">= 20"
|
|
150
148
|
},
|
|
151
149
|
"volta": {
|
|
152
150
|
"node": "20.14.0",
|
|
@@ -162,11 +160,8 @@
|
|
|
162
160
|
"configPath": "tests/dummy/config",
|
|
163
161
|
"demoURL": "https://chrislopresto.github.io/ember-freestyle/",
|
|
164
162
|
"versionCompatibility": {
|
|
165
|
-
"ember": ">=
|
|
166
|
-
}
|
|
167
|
-
"after": [
|
|
168
|
-
"ember-named-blocks-polyfill"
|
|
169
|
-
]
|
|
163
|
+
"ember": ">= 4.4.0"
|
|
164
|
+
}
|
|
170
165
|
},
|
|
171
166
|
"release-it": {
|
|
172
167
|
"plugins": {
|
|
@@ -183,7 +178,7 @@
|
|
|
183
178
|
"tokenRef": "GITHUB_AUTH"
|
|
184
179
|
},
|
|
185
180
|
"hooks": {
|
|
186
|
-
"after:release": "ember deploy production"
|
|
181
|
+
"after:release": "./node_modules/.bin/ember deploy production"
|
|
187
182
|
}
|
|
188
183
|
}
|
|
189
184
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// Type augmentation for @cached
|
|
1
|
+
// Type augmentation for @cached. Runtime is provided natively by @glimmer/tracking
|
|
2
|
+
// on Ember 4.4+, but the standalone @glimmer/tracking@1.1.2 types don't yet export it.
|
|
2
3
|
import '@glimmer/tracking';
|
|
3
4
|
|
|
4
5
|
declare module '@glimmer/tracking' {
|