Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
run: pnpm build:types
- name: Check internal types
run: pnpm type-check:internals
- name: Check @handlebars/parser types
run: pnpm type-check:handlebars
- name: Check published types
run: pnpm type-check:types

Expand Down Expand Up @@ -164,7 +166,7 @@ jobs:
SHOULD_TRANSPILE_FOR_NODE: true
run: pnpm build
- name: test
run: pnpm test:node
run: pnpm test:node && pnpm --filter "@handlebars/parser" test

blueprint-test:
name: Blueprint Tests
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ docs/
**/smoke-tests/
**/types/
**/type-tests/
packages/@handlebars/**/*.l
packages/@handlebars/**/*.yy
CHANGELOG.md
package.json
pnpm-lock.yaml
Expand Down
29 changes: 29 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default [
'glimmer-vm/benchmark/**',
'glimmer-vm/*.{js,ts}',
'packages/@glimmer-workspace/**',
'packages/@handlebars/parser/lib/parser.js',
'packages/@handlebars/parser/src/**',
'tracerbench-testing/',
],
},
Expand Down Expand Up @@ -180,6 +182,33 @@ export default [
'ember-internal/no-const-outside-module-scope': 'error',
},
},
{
files: ['packages/@handlebars/**/*.js'],

languageOptions: {
ecmaVersion: 2017,
sourceType: 'module',
},

rules: {
'ember-internal/require-yuidoc-access': 'off',
'ember-internal/no-const-outside-module-scope': 'off',
'disable-features/disable-async-await': 'off',
'disable-features/disable-generator-functions': 'off',
'no-implicit-coercion': 'off',
'no-unused-vars': 'off',
'import/namespace': 'off',
},
},
{
files: ['packages/@handlebars/parser/spec/**/*.js'],

languageOptions: {
globals: {
...globals.mocha,
},
},
},
{
files: [
'packages/*/tests/**/*.[jt]s',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"test:browserstack": "node bin/run-browserstack-tests.js",
"test:wip": "vite build --mode development --minify false && testem ci",
"type-check:internals": "tsc --noEmit",
"type-check:handlebars": "tsc --noEmit --project packages/@handlebars/parser/tsconfig.json",
"type-check:types": "tsc --noEmit --project type-tests",
"type-check": "npm-run-all type-check:*"
},
Expand Down Expand Up @@ -343,7 +344,6 @@
"@simple-dom/document/index.js": "ember-source/@simple-dom/document/index.js",
"backburner.js/index.js": "ember-source/backburner.js/index.js",
"dag-map/index.js": "ember-source/dag-map/index.js",
"ember-template-compiler/index.js": "ember-source/ember-template-compiler/index.js",
"ember-testing/index.js": "ember-source/ember-testing/index.js",
"ember-testing/lib/adapters/adapter.js": "ember-source/ember-testing/lib/adapters/adapter.js",
"ember-testing/lib/adapters/qunit.js": "ember-source/ember-testing/lib/adapters/qunit.js",
Expand Down Expand Up @@ -387,4 +387,4 @@
}
},
"packageManager": "pnpm@10.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/@glimmer/syntax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@glimmer/interfaces": "workspace:*",
"@glimmer/util": "workspace:*",
"@glimmer/wire-format": "workspace:*",
"@handlebars/parser": "~2.2.0",
"@handlebars/parser": "workspace:*",
"simple-html-tokenizer": "^0.5.11"
},
"devDependencies": {
Expand Down
80 changes: 80 additions & 0 deletions packages/@handlebars/parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Changelog

## Release (2025-11-29)

* @handlebars/parser 2.2.2 (patch)

#### :bug: Bug Fix
* `@handlebars/parser`
* [#27](https://github.com/handlebars-lang/handlebars-parser/pull/27) Fix commonjs build ([@kaermorchen](https://github.com/kaermorchen))

#### Committers: 1
- Stanislav Romanov ([@kaermorchen](https://github.com/kaermorchen))

## Release (2025-08-01)

* @handlebars/parser 2.2.1 (patch)

#### :bug: Bug Fix
* `@handlebars/parser`
* [#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))

#### Committers: 1
- Chris Manson ([@mansona](https://github.com/mansona))

## Release (2025-03-19)

* @handlebars/parser 2.2.0 (minor)

#### :rocket: Enhancement
* `@handlebars/parser`
* [#15](https://github.com/handlebars-lang/handlebars-parser/pull/15) Implement hash and array literal syntax ([@wycats](https://github.com/wycats))
* [#14](https://github.com/handlebars-lang/handlebars-parser/pull/14) Add support for a `#` prefix in path segments ([@wycats](https://github.com/wycats))

#### :bug: Bug Fix
* `@handlebars/parser`
* [#6](https://github.com/handlebars-lang/handlebars-parser/pull/6) [bugfix] Don't emit `parts: [undefined]` for `{{this}}` ([@dfreeman](https://github.com/dfreeman))

#### :house: Internal
* `@handlebars/parser`
* [#17](https://github.com/handlebars-lang/handlebars-parser/pull/17) Add release plan, remove release-it ([@NullVoxPopuli](https://github.com/NullVoxPopuli))

#### Committers: 3
- Dan Freeman ([@dfreeman](https://github.com/dfreeman))
- Yehuda Katz ([@wycats](https://github.com/wycats))
- [@NullVoxPopuli](https://github.com/NullVoxPopuli)

## v2.1.0 (2021-02-22)

#### :rocket: Enhancement
* [#4](https://github.com/handlebars-lang/handlebars-parser/pull/4) [FEATURE] Allows SubExpressions to be PathExpression roots ([@pzuraq](https://github.com/pzuraq))

#### Committers: 1
- Chris Garrett ([@pzuraq](https://github.com/pzuraq))

## v2.0.0 (2020-12-09)

#### :boom: Breaking Change
* [#3](https://github.com/handlebars-lang/handlebars-parser/pull/3) Make sub-expressions callable ([@pzuraq](https://github.com/pzuraq))

#### Committers: 1
- Chris Garrett ([@pzuraq](https://github.com/pzuraq))

## v1.1.0 (2020-09-18)

#### :rocket: Enhancement
* [#2](https://github.com/handlebars-lang/handlebars-parser/pull/2) [FEAT] Adds types ([@pzuraq](https://github.com/pzuraq))

#### Committers: 1
- Chris Garrett ([@pzuraq](https://github.com/pzuraq))


## v1.0.0 (2020-09-14)

#### :rocket: Enhancement
* [#1](https://github.com/handlebars-lang/handlebars-parser/pull/1) [FEAT] Adds initial setup, lint, ci ([@pzuraq](https://github.com/pzuraq))

#### Committers: 1
- Chris Garrett ([@pzuraq](https://github.com/pzuraq))


4 changes: 4 additions & 0 deletions packages/@handlebars/parser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Handlebars Parser

The official Handlebars.js parser. This package contains the definition for
for the Handlebars language AST, and the parser for parsing into that AST.
68 changes: 68 additions & 0 deletions packages/@handlebars/parser/lib/exception.js
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from the handlebars repo

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const errorProps = [
'description',
'fileName',
'lineNumber',
'endLineNumber',
'message',
'name',
'number',
'stack',
];

function Exception(message, node) {
let loc = node && node.loc,
line,
endLineNumber,
column,
endColumn;

if (loc) {
line = loc.start.line;
endLineNumber = loc.end.line;
column = loc.start.column;
endColumn = loc.end.column;

message += ' - ' + line + ':' + column;
}

let tmp = Error.prototype.constructor.call(this, message);

// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
for (let idx = 0; idx < errorProps.length; idx++) {
this[errorProps[idx]] = tmp[errorProps[idx]];
}

/* istanbul ignore else */
if (Error.captureStackTrace) {
Error.captureStackTrace(this, Exception);
}

try {
if (loc) {
this.lineNumber = line;
this.endLineNumber = endLineNumber;

// Work around issue under safari where we can't directly set the column value
/* istanbul ignore next */
if (Object.defineProperty) {
Object.defineProperty(this, 'column', {
value: column,
enumerable: true,
});
Object.defineProperty(this, 'endColumn', {
value: endColumn,
enumerable: true,
});
} else {
this.column = column;
this.endColumn = endColumn;
}
}
} catch (nop) {
/* Ignore if the browser is very particular */
}
}

Exception.prototype = new Error();

export default Exception;
Loading