Skip to content

Commit

Permalink
Merge pull request #986 from rwjblue/update-handlebars
Browse files Browse the repository at this point in the history
Update to handlebars@4.5.1.
  • Loading branch information
rwjblue authored Oct 29, 2019
2 parents e91a297 + de81bb1 commit 0fd6681
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 27 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@simple-dom/serializer": "^1.4.0",
"@simple-dom/void-map": "^1.4.0",
"babel-plugin-debug-macros": "^0.1.11",
"handlebars": "^4.0.13",
"handlebars": "^4.5.1",
"simple-html-tokenizer": "^0.5.8"
},
"devDependencies": {
Expand Down Expand Up @@ -95,4 +95,4 @@
"node": "10.16.3",
"yarn": "1.17.3"
}
}
}
2 changes: 1 addition & 1 deletion packages/@glimmer/syntax/handlebars-shim.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { parse, parser as Parser } from './handlebars/compiler/base';
export { parse, parseWithoutProcessing } from './handlebars/compiler/base';
12 changes: 1 addition & 11 deletions packages/@glimmer/syntax/lib/parser/tokenizer-event-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,24 +379,14 @@ const syntax: Syntax = {
Walker,
};

// emulate parseWithoutProcessing (from https://github.com/wycats/handlebars.js/pull/1584)
// can be removed when we update to Handlebars 4.5.0
function codemodParse(html: string, parseOptions?: HandlebarsParseOptions) {
// this sets up parser.yy and parser.yy.locInfo
handlebars.parse(html, parseOptions);

// casting to any here, because Parser is not listed in the types
return (handlebars as any).Parser.parse(html);
}

export function preprocess(html: string, options: PreprocessOptions = {}): AST.Template {
let mode = options.mode || 'precompile';

let ast: HBS.Program;
if (typeof html === 'object') {
ast = html;
} else if (mode === 'codemod') {
ast = codemodParse(html, options.parseOptions);
ast = handlebars.parseWithoutProcessing(html, options.parseOptions) as HBS.Program;
} else {
ast = handlebars.parse(html, options.parseOptions) as HBS.Program;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@glimmer/syntax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.43.0",
"repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/syntax",
"dependencies": {
"handlebars": "^4.0.13",
"handlebars": "^4.5.1",
"@glimmer/interfaces": "^0.43.0",
"@glimmer/util": "^0.43.0",
"simple-html-tokenizer": "^0.5.8"
Expand All @@ -13,4 +13,4 @@
"@types/qunit": "^2.0.31",
"typescript": "^2.8.3"
}
}
}
27 changes: 16 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4743,17 +4743,6 @@ handlebars@^4.0.11:
optionalDependencies:
uglify-js "^3.1.4"

handlebars@^4.0.13:
version "4.1.0"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.0.tgz#0d6a6f34ff1f63cecec8423aa4169827bf787c3a"
integrity sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==
dependencies:
async "^2.5.0"
optimist "^0.6.1"
source-map "^0.6.1"
optionalDependencies:
uglify-js "^3.1.4"

handlebars@^4.0.4:
version "4.0.6"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.6.tgz#2ce4484850537f9c97a8026d5399b935c4ed4ed7"
Expand All @@ -4765,6 +4754,17 @@ handlebars@^4.0.4:
optionalDependencies:
uglify-js "^2.6"

handlebars@^4.5.1:
version "4.5.1"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.5.1.tgz#8a01c382c180272260d07f2d1aa3ae745715c7ba"
integrity sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==
dependencies:
neo-async "^2.6.0"
optimist "^0.6.1"
source-map "^0.6.1"
optionalDependencies:
uglify-js "^3.1.4"

har-schema@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92"
Expand Down Expand Up @@ -7058,6 +7058,11 @@ negotiator@0.6.1:
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
integrity sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=

neo-async@^2.6.0:
version "2.6.1"
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c"
integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==

next-tick@1:
version "1.0.0"
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
Expand Down

0 comments on commit 0fd6681

Please sign in to comment.