Skip to content

Commit 181d95d

Browse files
NullVoxPopulief4
andcommitted
Bring in @handlebars/parser
Add to workspace Add tests to ci-jobs' Lockfile fix: update hidden dependencies and add @handlebars/parser to package configuration - Added @handlebars/** to the list of exposed dependencies in rollup.config.mjs. - Updated the resolution path for @handlebars/parser in hiddenDependencies function. - Created a .gitignore file for the @handlebars/parser package to exclude dist/ and lib/parser.js. Simplify the handlebars/parser build and add it in to to the set of things we build in the root package.josn lint:fix Apply suggestion from @ef4 Co-authored-by: Edward Faulkner <edward@eaf4.com>
1 parent 2dea726 commit 181d95d

29 files changed

Lines changed: 4833 additions & 8 deletions

.github/workflows/ci-jobs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
run: pnpm build:types
3434
- name: Check internal types
3535
run: pnpm type-check:internals
36+
- name: Check @handlebars/parser types
37+
run: pnpm type-check:handlebars
3638
- name: Check published types
3739
run: pnpm type-check:types
3840

@@ -164,7 +166,7 @@ jobs:
164166
SHOULD_TRANSPILE_FOR_NODE: true
165167
run: pnpm build
166168
- name: test
167-
run: pnpm test:node
169+
run: pnpm test:node && pnpm --filter "@handlebars/parser" test
168170

169171
blueprint-test:
170172
name: Blueprint Tests

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ docs/
77
**/smoke-tests/
88
**/types/
99
**/type-tests/
10+
packages/@handlebars/**/*.l
11+
packages/@handlebars/**/*.yy
1012
CHANGELOG.md
1113
package.json
1214
pnpm-lock.yaml

eslint.config.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export default [
3333
'glimmer-vm/benchmark/**',
3434
'glimmer-vm/*.{js,ts}',
3535
'packages/@glimmer-workspace/**',
36+
'packages/@handlebars/parser/lib/parser.js',
37+
'packages/@handlebars/parser/src/**',
3638
'tracerbench-testing/',
3739
],
3840
},
@@ -180,6 +182,33 @@ export default [
180182
'ember-internal/no-const-outside-module-scope': 'error',
181183
},
182184
},
185+
{
186+
files: ['packages/@handlebars/**/*.js'],
187+
188+
languageOptions: {
189+
ecmaVersion: 2017,
190+
sourceType: 'module',
191+
},
192+
193+
rules: {
194+
'ember-internal/require-yuidoc-access': 'off',
195+
'ember-internal/no-const-outside-module-scope': 'off',
196+
'disable-features/disable-async-await': 'off',
197+
'disable-features/disable-generator-functions': 'off',
198+
'no-implicit-coercion': 'off',
199+
'no-unused-vars': 'off',
200+
'import/namespace': 'off',
201+
},
202+
},
203+
{
204+
files: ['packages/@handlebars/parser/spec/**/*.js'],
205+
206+
languageOptions: {
207+
globals: {
208+
...globals.mocha,
209+
},
210+
},
211+
},
183212
{
184213
files: [
185214
'packages/*/tests/**/*.[jt]s',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"test:browserstack": "node bin/run-browserstack-tests.js",
6161
"test:wip": "vite build --mode development --minify false && testem ci",
6262
"type-check:internals": "tsc --noEmit",
63+
"type-check:handlebars": "tsc --noEmit --project packages/@handlebars/parser/tsconfig.json",
6364
"type-check:types": "tsc --noEmit --project type-tests",
6465
"type-check": "npm-run-all type-check:*"
6566
},

packages/@glimmer/syntax/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@glimmer/interfaces": "workspace:*",
4343
"@glimmer/util": "workspace:*",
4444
"@glimmer/wire-format": "workspace:*",
45-
"@handlebars/parser": "~2.2.0",
45+
"@handlebars/parser": "workspace:*",
4646
"simple-html-tokenizer": "^0.5.11"
4747
},
4848
"devDependencies": {
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Changelog
2+
3+
## Release (2025-11-29)
4+
5+
* @handlebars/parser 2.2.2 (patch)
6+
7+
#### :bug: Bug Fix
8+
* `@handlebars/parser`
9+
* [#27](https://github.com/handlebars-lang/handlebars-parser/pull/27) Fix commonjs build ([@kaermorchen](https://github.com/kaermorchen))
10+
11+
#### Committers: 1
12+
- Stanislav Romanov ([@kaermorchen](https://github.com/kaermorchen))
13+
14+
## Release (2025-08-01)
15+
16+
* @handlebars/parser 2.2.1 (patch)
17+
18+
#### :bug: Bug Fix
19+
* `@handlebars/parser`
20+
* [#24](https://github.com/handlebars-lang/handlebars-parser/pull/24) fix node engine and create a test matrix in CI ([@mansona](https://github.com/mansona))
21+
22+
#### Committers: 1
23+
- Chris Manson ([@mansona](https://github.com/mansona))
24+
25+
## Release (2025-03-19)
26+
27+
* @handlebars/parser 2.2.0 (minor)
28+
29+
#### :rocket: Enhancement
30+
* `@handlebars/parser`
31+
* [#15](https://github.com/handlebars-lang/handlebars-parser/pull/15) Implement hash and array literal syntax ([@wycats](https://github.com/wycats))
32+
* [#14](https://github.com/handlebars-lang/handlebars-parser/pull/14) Add support for a `#` prefix in path segments ([@wycats](https://github.com/wycats))
33+
34+
#### :bug: Bug Fix
35+
* `@handlebars/parser`
36+
* [#6](https://github.com/handlebars-lang/handlebars-parser/pull/6) [bugfix] Don't emit `parts: [undefined]` for `{{this}}` ([@dfreeman](https://github.com/dfreeman))
37+
38+
#### :house: Internal
39+
* `@handlebars/parser`
40+
* [#17](https://github.com/handlebars-lang/handlebars-parser/pull/17) Add release plan, remove release-it ([@NullVoxPopuli](https://github.com/NullVoxPopuli))
41+
42+
#### Committers: 3
43+
- Dan Freeman ([@dfreeman](https://github.com/dfreeman))
44+
- Yehuda Katz ([@wycats](https://github.com/wycats))
45+
- [@NullVoxPopuli](https://github.com/NullVoxPopuli)
46+
47+
## v2.1.0 (2021-02-22)
48+
49+
#### :rocket: Enhancement
50+
* [#4](https://github.com/handlebars-lang/handlebars-parser/pull/4) [FEATURE] Allows SubExpressions to be PathExpression roots ([@pzuraq](https://github.com/pzuraq))
51+
52+
#### Committers: 1
53+
- Chris Garrett ([@pzuraq](https://github.com/pzuraq))
54+
55+
## v2.0.0 (2020-12-09)
56+
57+
#### :boom: Breaking Change
58+
* [#3](https://github.com/handlebars-lang/handlebars-parser/pull/3) Make sub-expressions callable ([@pzuraq](https://github.com/pzuraq))
59+
60+
#### Committers: 1
61+
- Chris Garrett ([@pzuraq](https://github.com/pzuraq))
62+
63+
## v1.1.0 (2020-09-18)
64+
65+
#### :rocket: Enhancement
66+
* [#2](https://github.com/handlebars-lang/handlebars-parser/pull/2) [FEAT] Adds types ([@pzuraq](https://github.com/pzuraq))
67+
68+
#### Committers: 1
69+
- Chris Garrett ([@pzuraq](https://github.com/pzuraq))
70+
71+
72+
## v1.0.0 (2020-09-14)
73+
74+
#### :rocket: Enhancement
75+
* [#1](https://github.com/handlebars-lang/handlebars-parser/pull/1) [FEAT] Adds initial setup, lint, ci ([@pzuraq](https://github.com/pzuraq))
76+
77+
#### Committers: 1
78+
- Chris Garrett ([@pzuraq](https://github.com/pzuraq))
79+
80+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Handlebars Parser
2+
3+
The official Handlebars.js parser. This package contains the definition for
4+
for the Handlebars language AST, and the parser for parsing into that AST.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
const errorProps = [
2+
'description',
3+
'fileName',
4+
'lineNumber',
5+
'endLineNumber',
6+
'message',
7+
'name',
8+
'number',
9+
'stack',
10+
];
11+
12+
function Exception(message, node) {
13+
let loc = node && node.loc,
14+
line,
15+
endLineNumber,
16+
column,
17+
endColumn;
18+
19+
if (loc) {
20+
line = loc.start.line;
21+
endLineNumber = loc.end.line;
22+
column = loc.start.column;
23+
endColumn = loc.end.column;
24+
25+
message += ' - ' + line + ':' + column;
26+
}
27+
28+
let tmp = Error.prototype.constructor.call(this, message);
29+
30+
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
31+
for (let idx = 0; idx < errorProps.length; idx++) {
32+
this[errorProps[idx]] = tmp[errorProps[idx]];
33+
}
34+
35+
/* istanbul ignore else */
36+
if (Error.captureStackTrace) {
37+
Error.captureStackTrace(this, Exception);
38+
}
39+
40+
try {
41+
if (loc) {
42+
this.lineNumber = line;
43+
this.endLineNumber = endLineNumber;
44+
45+
// Work around issue under safari where we can't directly set the column value
46+
/* istanbul ignore next */
47+
if (Object.defineProperty) {
48+
Object.defineProperty(this, 'column', {
49+
value: column,
50+
enumerable: true,
51+
});
52+
Object.defineProperty(this, 'endColumn', {
53+
value: endColumn,
54+
enumerable: true,
55+
});
56+
} else {
57+
this.column = column;
58+
this.endColumn = endColumn;
59+
}
60+
}
61+
} catch (nop) {
62+
/* Ignore if the browser is very particular */
63+
}
64+
}
65+
66+
Exception.prototype = new Error();
67+
68+
export default Exception;

0 commit comments

Comments
 (0)