Skip to content

Commit

Permalink
Merge pull request #81 from soxhub/SOX-18095-fix-syntax-error
Browse files Browse the repository at this point in the history
Fix syntax error when helpers are run with extra () surrounding them
  • Loading branch information
mansona authored Sep 14, 2022
2 parents 0677bd4 + 08f0ece commit 8a04ccf
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 58 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "ISC",
"dependencies": {
"@babel/parser": "^7.16.4",
"ember-template-recast": "^5.0.3",
"ember-template-recast": "^6.1.3",
"find-up": "^6.3.0",
"glob": "^7.2.0",
"jscodeshift": "^0.7.0",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/helperArguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Helper Arguments', function () {
input: `<span title="{{fn this.testFunction 2.2 '{3}'}} website {4}">
test
</span>`,
output: `<span title={{format-message "{fnTestFunction3} website '{4'}" fnTestFunction3=(fn this.testFunction 2.2 "{3}")}}>
output: `<span title={{format-message "{fnTestFunction3} website '{4'}" fnTestFunction3=(fn this.testFunction 2.2 '{3}')}}>
{{format-message "test"}}
</span>`,
});
Expand Down
31 changes: 31 additions & 0 deletions test/unit/helperBrackets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const testCase = require('../helpers/test-case');

describe('explicit helper syntax', function () {
testCase({
name: 'helpers work when wrapped with ()',
input: `<div @disabled={{(or
(this.oneThing) (not this.otherThing)
)}}>
Some content
</div>`,
output: `<div @disabled={{(or
(this.oneThing) (not this.otherThing)
)}}>
{{format-message "Some content"}}
</div>`,
});

testCase({
name: 'helpers work when not wrapped with ()',
input: `<div @disabled={{or
(this.oneThing) (not this.otherThing)
}}>
Some content
</div>`,
output: `<div @disabled={{or
(this.oneThing) (not this.otherThing)
}}>
{{format-message "Some content"}}
</div>`,
});
});
117 changes: 61 additions & 56 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -967,62 +967,62 @@
resolved "https://registry.yarnpkg.com/@glimmer/env/-/env-0.1.7.tgz#fd2d2b55a9029c6b37a6c935e8c8871ae70dfa07"
integrity sha1-/S0rVakCnGs3psk16MiHGucN+gc=

"@glimmer/global-context@0.65.4":
version "0.65.4"
resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.65.4.tgz#1da1d59dd4260ce912c40e474cd39c2e82de51b8"
integrity sha512-RSYCPG/uVR5XCDcPREBclncU7R0zkjACbADP+n3FWAH1TfWbXRMDIkvO/ZlwHkjHoCZf6tIM6p5S/MoFzfJEJA==
"@glimmer/global-context@0.83.1":
version "0.83.1"
resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.83.1.tgz#3e2d97f10ff623bcfb5b7dc29a858d546a6c6d66"
integrity sha512-OwlgqpbOJU73EjZOZdftab0fKbtdJ4x/QQeJseL9cvaAUiK3+w52M5ONFxD1T/yPBp2Mf7NCYqA/uL8tRbzY2A==
dependencies:
"@glimmer/env" "^0.1.7"

"@glimmer/interfaces@0.65.4":
version "0.65.4"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.65.4.tgz#d298cc2b12b8ebcf269f39246ca7ab92816f6680"
integrity sha512-R0kby79tGNKZOojVJa/7y0JH9Eq4SV+L1s6GcZy30QUZ1g1AAGS5XwCIXc9Sc09coGcv//q+6NLeSw7nlx1y4A==
"@glimmer/interfaces@0.83.1":
version "0.83.1"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.83.1.tgz#fb16f5f683ddc55f130887b6141f58c0751350fe"
integrity sha512-rjAztghzX97v8I4rk3+NguM3XGYcFjc/GbJ8qrEj19KF2lUDoDBW1sB7f0tov3BD5HlrGXei/vOh4+DHfjeB5w==
dependencies:
"@simple-dom/interface" "^1.4.0"

"@glimmer/reference@^0.65.0":
version "0.65.4"
resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.65.4.tgz#bbc8becd6a1bf01fc189b6489e27446437194711"
integrity sha512-yuRVE4qyqrlCndDMrHKDWUbDmGDCjPzsFtlTmxxnhDMJAdQsnr2cRLITHvQRDm1tXfigVvyKnomeuYhRRbBqYQ==
"@glimmer/reference@^0.83.1":
version "0.83.1"
resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.83.1.tgz#0345b95431b5bb19843b308e6311d1ef81e36192"
integrity sha512-BThEwDlMkJB1WBPWDrww+VxgGyDbwxh5FFPvGhkovvCZnCb7fAMUCt9pi6CUZtviugkWOBFtE9P4eZZbOLkXeg==
dependencies:
"@glimmer/env" "^0.1.7"
"@glimmer/global-context" "0.65.4"
"@glimmer/interfaces" "0.65.4"
"@glimmer/util" "0.65.4"
"@glimmer/validator" "0.65.4"

"@glimmer/syntax@^0.65.0":
version "0.65.4"
resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.65.4.tgz#49164de5dc9e8b67084ec009bdd865e379d8a971"
integrity sha512-y+/C3e8w96efk3a/Z5If9o4ztKJwrr8RtDpbhV2J8X+DUsn5ic2N3IIdlThbt/Zn6tkP1K3dY6uaFUx3pGTvVQ==
dependencies:
"@glimmer/interfaces" "0.65.4"
"@glimmer/util" "0.65.4"
"@handlebars/parser" "^1.1.0"
simple-html-tokenizer "^0.5.10"

"@glimmer/util@0.65.4":
version "0.65.4"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.65.4.tgz#e464145078f3f40da9013ff2590a6016515455d2"
integrity sha512-aofe+rdBhkREKP2GZta6jy1UcbRRMfWx7M18zxGxspPoeD08NscD04Kx+WiOKXmC1TcrfITr8jvqMfrKrMzYWQ==
"@glimmer/global-context" "0.83.1"
"@glimmer/interfaces" "0.83.1"
"@glimmer/util" "0.83.1"
"@glimmer/validator" "0.83.1"

"@glimmer/syntax@^0.83.1":
version "0.83.1"
resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.83.1.tgz#7e18dd445871c157ba0281f12a4fbf316fa49b41"
integrity sha512-n3vEd0GtjtgkOsd2gqkSimp8ecqq5KrHyana/s1XJZvVAPD5rMWT9WvAVWG8XAktns8BxjwLIUoj/vkOfA+eHg==
dependencies:
"@glimmer/interfaces" "0.83.1"
"@glimmer/util" "0.83.1"
"@handlebars/parser" "~2.0.0"
simple-html-tokenizer "^0.5.11"

"@glimmer/util@0.83.1":
version "0.83.1"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.83.1.tgz#cc7511b03164d658cf6e3262fce5a0fcb82edceb"
integrity sha512-amvjtl9dvrkxsoitXAly9W5NUaLIE3A2J2tWhBWIL1Z6DOFotfX7ytIosOIcPhJLZCtiXPHzMutQRv0G/MSMsA==
dependencies:
"@glimmer/env" "0.1.7"
"@glimmer/interfaces" "0.65.4"
"@glimmer/interfaces" "0.83.1"
"@simple-dom/interface" "^1.4.0"

"@glimmer/validator@0.65.4", "@glimmer/validator@^0.65.0":
version "0.65.4"
resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.65.4.tgz#12c27a9a63706c60e6499fd687940e9d1affb32c"
integrity sha512-0YUjAyo45DF5JkQxdv5kHn96nMNhvZiEwsAD4Jme0kk5Q9MQcPOUtN76pQAS4f+C6GdF9DeUr2yGXZLFMmb+LA==
"@glimmer/validator@0.83.1", "@glimmer/validator@^0.83.0":
version "0.83.1"
resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.83.1.tgz#7578cb2284f728c8e9302c51fc6e7660b570ac54"
integrity sha512-LaILSNnQgDHZpaUsfjVndbS1JfVn0xdTlJdFJblPbhoVklOBSReZVekens3EQ6xOr3BC612sRm1hBnEPixOY6A==
dependencies:
"@glimmer/env" "^0.1.7"
"@glimmer/global-context" "0.65.4"
"@glimmer/global-context" "0.83.1"

"@handlebars/parser@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@handlebars/parser/-/parser-1.1.0.tgz#d6dbc7574774b238114582410e8fee0dc3532bdf"
integrity sha512-rR7tJoSwJ2eooOpYGxGGW95sLq6GXUaS1UtWvN7pei6n2/okYvCGld9vsUTvkl2migxbkszsycwtMf/GEc1k1A==
"@handlebars/parser@~2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@handlebars/parser/-/parser-2.0.0.tgz#5e8b7298f31ff8f7b260e6b7363c7e9ceed7d9c5"
integrity sha512-EP9uEDZv/L5Qh9IWuMUGJRfwhXJ4h1dqKTT4/3+tY0eu7sPis7xh23j61SYUnNF4vqCQvvUXpDo9Bh/+q1zASA==

"@humanwhocodes/config-array@^0.9.2":
version "0.9.2"
Expand Down Expand Up @@ -1520,10 +1520,10 @@ colors@^1.1.2, colors@^1.4.0:
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==

commander@^6.2.1:
version "6.2.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"
integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==
commander@^8.3.0:
version "8.3.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==

commondir@^1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -1693,22 +1693,22 @@ electron-to-chromium@^1.4.17:
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.23.tgz#c8fa28db6354062bbd388e24d95c4a263fff5cac"
integrity sha512-q3tB59Api3+DMbLnDPkW/UBHBO7KTGcF+rDCeb0GAGyqFj562s6y+c/2tDKTS/y5lbC+JOvT4MSUALJLPqlcSA==

ember-template-recast@^5.0.3:
version "5.0.3"
resolved "https://registry.yarnpkg.com/ember-template-recast/-/ember-template-recast-5.0.3.tgz#79df27a70bdce7be17f14db13886afde1e9d02d6"
integrity sha512-qsJYQhf29Dk6QMfviXhUPE+byMOs6iRQxUDHgkj8yqjeppvjHaFG96hZi/NAXJTm/M7o3PpfF5YlmeaKtI9UeQ==
ember-template-recast@^6.1.3:
version "6.1.3"
resolved "https://registry.yarnpkg.com/ember-template-recast/-/ember-template-recast-6.1.3.tgz#1e9b256ee9da24bcaa7c213088d01f32afc88001"
integrity sha512-45lkfjrWlrMPlOd5rLFeQeePZwAvcS//x1x15kaiQTlqQdYWiYNXwbpWHqV+p9fXY6bEjl6EbyPhG/zBkgh8MA==
dependencies:
"@glimmer/reference" "^0.65.0"
"@glimmer/syntax" "^0.65.0"
"@glimmer/validator" "^0.65.0"
"@glimmer/reference" "^0.83.1"
"@glimmer/syntax" "^0.83.1"
"@glimmer/validator" "^0.83.0"
async-promise-queue "^1.0.5"
colors "^1.4.0"
commander "^6.2.1"
commander "^8.3.0"
globby "^11.0.3"
ora "^5.4.0"
slash "^3.0.0"
tmp "^0.2.1"
workerpool "^6.1.4"
workerpool "^6.1.5"

emoji-regex@^8.0.0:
version "8.0.0"
Expand Down Expand Up @@ -3389,7 +3389,7 @@ signal-exit@^3.0.2, signal-exit@^3.0.3:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.6.tgz#24e630c4b0f03fea446a2bd299e62b4a6ca8d0af"
integrity sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==

simple-html-tokenizer@^0.5.10:
simple-html-tokenizer@^0.5.11:
version "0.5.11"
resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.5.11.tgz#4c5186083c164ba22a7b477b7687ac056ad6b1d9"
integrity sha512-C2WEK/Z3HoSFbYq8tI7ni3eOo/NneSPRoPpcM7WdLjFOArFuyXEjAoCdOC3DgMfRyziZQ1hCNR4mrNdWEvD0og==
Expand Down Expand Up @@ -3705,11 +3705,16 @@ word-wrap@^1.2.3:
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==

[email protected], workerpool@^6.1.4:
[email protected]:
version "6.1.5"
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.5.tgz#0f7cf076b6215fd7e1da903ff6f22ddd1886b581"
integrity sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==

workerpool@^6.1.5:
version "6.2.1"
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
Expand Down

0 comments on commit 8a04ccf

Please sign in to comment.