Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ember-template-recast to ^6.1.4 #505

Merged
merged 2 commits into from
Nov 27, 2023
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"codemod-cli": "^3.1.2",
"debug": "^4.3.1",
"ember-codemods-telemetry-helpers": "^3.0.0",
"ember-template-recast": "^5.0.1",
"ember-template-recast": "^6.1.4",
"winston": "^3.3.3"
},
"devDependencies": {
Expand Down
19 changes: 15 additions & 4 deletions transforms/angle-brackets/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ function shouldSkipFile(fileInfo, config) {
return false;
}

function transformAttrs(tagName, attrs, config) {
return attrs.map((a) => {
function transformAttrs(tagName, attrs, nodeParams, config) {
const newAttrs = attrs.map((a) => {
let _key = a.key;
let _valueType = a.value.type;
let _value;
Expand Down Expand Up @@ -174,6 +174,17 @@ function transformAttrs(tagName, attrs, config) {
}
return b.attr(_key, _value);
});

const newValuelessAttrs = nodeParams
.filter((param) => !!param.parts)
.filter((param) => isAttribute(param.parts[0]))
.map((param) => {
const attr = b.attr(param.parts[0], b.text(''));
attr.isValueless = true;
return attr;
});

return [...newAttrs, ...newValuelessAttrs];
}

function isQueryParam(param) {
Expand Down Expand Up @@ -299,7 +310,7 @@ function shouldSkipDataTestParams(params, includeValuelessDataTestAttributes) {
}

function transformNodeAttributes(tagName, node, config) {
let attributes = transformAttrs(tagName, node.hash.pairs, config);
let attributes = transformAttrs(tagName, node.hash.pairs, node.params, config);
return node.params.concat(attributes);
}

Expand Down Expand Up @@ -389,7 +400,7 @@ function transformNode(node, fileInfo, config) {
attributes = transformLinkToAttrs(node.params);
}

let namesParams = transformAttrs(tagName, node.hash.pairs, config);
let namesParams = transformAttrs(tagName, node.hash.pairs, node.params, config);
attributes = attributes.concat(namesParams);
} else {
if (nodeHasPositionalParameters(node)) {
Expand Down
25 changes: 20 additions & 5 deletions transforms/angle-brackets/transform.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ test('data-test-attributes', () => {
<XFoo @data-test-selector={{true}} />
<XFoo @data-test-selector={{post.id}} />
<XFoo @label=\\"hi\\" @data-test-selector={{true}} />
<XFoo data-test-foo />
<XFoo data-test-foo />
<XFoo @data-foo={{true}}>
block
</XFoo>
Expand All @@ -210,16 +210,16 @@ test('data-test-attributes', () => {
<XFoo @data-test-selector={{post.id}}>
block
</XFoo>
<Common::AccordionComponent data-test-accordion as |accordion|>
<Common::AccordionComponent data-test-accordion as |accordion|>
block
</Common::AccordionComponent>
<LinkTo @route=\\"posts\\" data-test-foo>
<LinkTo @route=\\"posts\\" data-test-foo >
Recent Posts
</LinkTo>
<LinkTo @route={{this.dynamicPath}} @query={{hash direction=\\"desc\\" showArchived=false}} data-test-foo>
<LinkTo @route={{this.dynamicPath}} @query={{hash direction=\\"desc\\" showArchived=false}} data-test-foo >
Recent Posts
</LinkTo>
<LinkTo @route={{this.dynamicPath}} @query={{hash direction=\\"desc\\" showArchived=false}} data-test-foo data-foo>
<LinkTo @route={{this.dynamicPath}} @query={{hash direction=\\"desc\\" showArchived=false}} data-test-foo data-foo >
Recent Posts
</LinkTo>

Expand All @@ -243,6 +243,21 @@ test('data-test-attributes', () => {
`);
});

test('data-test-empty-attributes', () => {
let options = {
includeValuelessDataTestAttributes: true,
};
let input = `
{{x-foo data-test-foo }}
`;

expect(runTest('data-test-empty-attributes.hbs', input, options)).toMatchInlineSnapshot(`
"
<XFoo data-test-foo />
"
`);
});

test('deeply-nested-sub', () => {
let input = `
{{#some-component class=(concat foo (some-helper ted (some-dude bar (a b c)))) }}
Expand Down
149 changes: 103 additions & 46 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -744,10 +744,10 @@
dependencies:
"@glimmer/env" "^0.1.7"

"@glimmer/global-context@0.65.2":
version "0.65.2"
resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.65.2.tgz#6c522dbe0996de2ea308c257492a3782620ed2ee"
integrity sha512-BUWgPmPoWb6ILnJxvG0WgASJ9RVjhd3wSZwEpUIVGdOc9CHfD+4WhpYJNjPPoYMbq2NS5B6QXT1MP66hyGqq8Q==
"@glimmer/global-context@0.84.3":
version "0.84.3"
resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.84.3.tgz#f8bf2cda9562716f2ddf3f96837e7559600635c4"
integrity sha512-8Oy9Wg5IZxMEeAnVmzD2NkObf89BeHoFSzJgJROE/deutd3rxg83mvlOez4zBBGYwnTb+VGU2LYRpet92egJjA==
dependencies:
"@glimmer/env" "^0.1.7"

Expand All @@ -758,10 +758,10 @@
dependencies:
"@simple-dom/interface" "^1.4.0"

"@glimmer/interfaces@0.65.2":
version "0.65.2"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.65.2.tgz#9630e39c0f66ad166e7c617579cee8d858bf3653"
integrity sha512-/YdkmFFB4c7TAF71fhsQCLM1HUOuYp19bnKv+gAdlK3R2TooOpfg+ijoaAzI9WXgTK9V6zA5SE42ncLREBRGdQ==
"@glimmer/interfaces@0.84.3":
version "0.84.3"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.84.3.tgz#629777a4abe373b0785656f6c8d08989f5784805"
integrity sha512-dk32ykoNojt0mvEaIW6Vli5MGTbQo58uy3Epj7ahCgTHmWOKuw/0G83f2UmFprRwFx689YTXG38I/vbpltEjzg==
dependencies:
"@simple-dom/interface" "^1.4.0"

Expand All @@ -776,16 +776,16 @@
"@glimmer/util" "0.62.4"
"@glimmer/validator" "0.62.4"

"@glimmer/reference@^0.65.0":
version "0.65.2"
resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.65.2.tgz#9dae205ee48d7eb08042f7bf805cda4e0303c0f8"
integrity sha512-koGW9mGyFhVKykDrINdiqD9l/Q8TFv2okmrTvCFleS9+2kJ56x3V3wa5xQU2cRIAewkbXCWNiNbyDz5EVq9alw==
"@glimmer/reference@^0.84.3":
version "0.84.3"
resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.84.3.tgz#6420ad9c102633ac83939fd1b2457269d21fb632"
integrity sha512-lV+p/aWPVC8vUjmlvYVU7WQJsLh319SdXuAWoX/SE3pq340BJlAJiEcAc6q52y9JNhT57gMwtjMX96W5Xcx/qw==
dependencies:
"@glimmer/env" "^0.1.7"
"@glimmer/global-context" "0.65.2"
"@glimmer/interfaces" "0.65.2"
"@glimmer/util" "0.65.2"
"@glimmer/validator" "0.65.2"
"@glimmer/global-context" "0.84.3"
"@glimmer/interfaces" "0.84.3"
"@glimmer/util" "0.84.3"
"@glimmer/validator" "0.84.3"

"@glimmer/syntax@^0.62.4":
version "0.62.4"
Expand All @@ -797,15 +797,15 @@
"@handlebars/parser" "^1.1.0"
simple-html-tokenizer "^0.5.10"

"@glimmer/syntax@^0.65.0":
version "0.65.2"
resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.65.2.tgz#7aa66e5da0d48f0d67f9841201e8ca91d350674a"
integrity sha512-cfAqRgka8EVhDgDJKu3d1WMOZLJu1H+tuOb4J4LutcbYRswLYkvPYED2UA8Bw6oekpN34GYFRzwb/JODAWNBpA==
"@glimmer/syntax@^0.84.3":
version "0.84.3"
resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.84.3.tgz#4045a1708cef7fd810cff42fe6deeba40c7286d0"
integrity sha512-ioVbTic6ZisLxqTgRBL2PCjYZTFIwobifCustrozRU2xGDiYvVIL0vt25h2c1ioDsX59UgVlDkIK4YTAQQSd2A==
dependencies:
"@glimmer/interfaces" "0.65.2"
"@glimmer/util" "0.65.2"
"@handlebars/parser" "^1.1.0"
simple-html-tokenizer "^0.5.10"
"@glimmer/interfaces" "0.84.3"
"@glimmer/util" "0.84.3"
"@handlebars/parser" "~2.0.0"
simple-html-tokenizer "^0.5.11"

"@glimmer/[email protected]":
version "0.62.4"
Expand All @@ -816,13 +816,13 @@
"@glimmer/interfaces" "0.62.4"
"@simple-dom/interface" "^1.4.0"

"@glimmer/util@0.65.2":
version "0.65.2"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.65.2.tgz#da9c6fa68a117ac1cb74fc79dad3eaa40d9cd4cb"
integrity sha512-xLjmGBSCTfDhi4tskVzg1M/Ii90wPL711O3TNLZF//ztv8SFRGNzh73oVbBzdYmEWR1OdED73ZTYL5MGzqBWLw==
"@glimmer/util@0.84.3":
version "0.84.3"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.84.3.tgz#9ae0166982c0b48aa94b02d6ba8c2c81976ade4b"
integrity sha512-qFkh6s16ZSRuu2rfz3T4Wp0fylFj3HBsONGXQcrAdZjdUaIS6v3pNj6mecJ71qRgcym9Hbaq/7/fefIwECUiKw==
dependencies:
"@glimmer/env" "0.1.7"
"@glimmer/interfaces" "0.65.2"
"@glimmer/interfaces" "0.84.3"
"@simple-dom/interface" "^1.4.0"

"@glimmer/[email protected]", "@glimmer/validator@^0.62.4":
Expand All @@ -833,19 +833,24 @@
"@glimmer/env" "^0.1.7"
"@glimmer/global-context" "0.62.4"

"@glimmer/validator@0.65.2", "@glimmer/validator@^0.65.0":
version "0.65.2"
resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.65.2.tgz#a3e0dc737b0ff73e23f0444d9e45c5bb202c3454"
integrity sha512-IQxvCueyORlwa5kDd0AwFvVLYAaIKvT4EeMvOCqOp/jJ32dGGSXG++V37UY0cYUc9Ir3gTPE7bE9/0piTXSdag==
"@glimmer/validator@0.84.3", "@glimmer/validator@^0.84.3":
version "0.84.3"
resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.84.3.tgz#cd83b7f9ab78953f23cc11a32d83d7f729c54df2"
integrity sha512-RTBV4TokUB0vI31UC7ikpV7lOYpWUlyqaKV//pRC4pexYMlmqnVhkFrdiimB/R1XyNdUOQUmnIAcdic39NkbhQ==
dependencies:
"@glimmer/env" "^0.1.7"
"@glimmer/global-context" "0.65.2"
"@glimmer/global-context" "0.84.3"

"@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.10.4":
version "0.10.4"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.10.4.tgz#01e7366e57d2ad104feea63e72248f22015c520c"
Expand Down Expand Up @@ -1877,6 +1882,15 @@ bl@^4.0.3:
inherits "^2.0.4"
readable-stream "^3.4.0"

bl@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a"
integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==
dependencies:
buffer "^5.5.0"
inherits "^2.0.4"
readable-stream "^3.4.0"

bl@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/bl/-/bl-5.0.0.tgz#6928804a41e9da9034868e1c50ca88f21f57aea2"
Expand Down Expand Up @@ -2329,6 +2343,11 @@ commander@^6.2.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.0.tgz#b990bfb8ac030aedc6d11bc04d1488ffef56db75"
integrity sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==

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

common-tags@^1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.0.tgz#8e3153e542d4a39e9b10554434afaaf98956a937"
Expand Down Expand Up @@ -2707,22 +2726,22 @@ ember-template-recast@^4.1.4:
tmp "^0.2.1"
workerpool "^6.0.3"

ember-template-recast@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/ember-template-recast/-/ember-template-recast-5.0.1.tgz#c5d9e7208bf629ee368a3792328f245f3c651003"
integrity sha512-MtjyYtr5jnE72i/jVkI3m2QOdozglLwXS3HN74Ge9cm7dz5GoDszVvUksyj/9xqpIP31LMXjs2bZetRGvinU1Q==
ember-template-recast@^6.1.4:
version "6.1.4"
resolved "https://registry.yarnpkg.com/ember-template-recast/-/ember-template-recast-6.1.4.tgz#e964c184adfd876878009f8aa0b84c95633fce20"
integrity sha512-fCh+rOK6z+/tsdkTbOE+e7f84P6ObnIRQrCCrnu21E4X05hPeradikIkRMhJdxn4NWrxitfZskQDd37TR/lsNQ==
dependencies:
"@glimmer/reference" "^0.65.0"
"@glimmer/syntax" "^0.65.0"
"@glimmer/validator" "^0.65.0"
"@glimmer/reference" "^0.84.3"
"@glimmer/syntax" "^0.84.3"
"@glimmer/validator" "^0.84.3"
async-promise-queue "^1.0.5"
colors "^1.4.0"
commander "^6.2.0"
globby "^11.0.1"
ora "^5.1.0"
commander "^8.3.0"
globby "^11.0.3"
ora "^5.4.0"
slash "^3.0.0"
tmp "^0.2.1"
workerpool "^6.0.3"
workerpool "^6.4.0"

emittery@^0.10.2:
version "0.10.2"
Expand Down Expand Up @@ -3614,7 +3633,7 @@ globby@^11.0.1, globby@^11.0.2:
merge2 "^1.3.0"
slash "^3.0.0"

globby@^11.1.0:
globby@^11.0.3, globby@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
Expand Down Expand Up @@ -4319,6 +4338,11 @@ is-typedarray@^1.0.0, is-typedarray@~1.0.0:
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=

is-unicode-supported@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7"
integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==

is-unicode-supported@^1.1.0, is-unicode-supported@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-1.2.0.tgz#f4f54f34d8ebc84a46b93559a036763b6d3e1014"
Expand Down Expand Up @@ -5112,6 +5136,14 @@ log-symbols@^4.0.0:
dependencies:
chalk "^4.0.0"

log-symbols@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503"
integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==
dependencies:
chalk "^4.1.0"
is-unicode-supported "^0.1.0"

log-symbols@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-5.1.0.tgz#a20e3b9a5f53fac6aeb8e2bb22c07cf2c8f16d93"
Expand Down Expand Up @@ -5976,6 +6008,21 @@ ora@^5.1.0:
strip-ansi "^6.0.0"
wcwidth "^1.0.1"

ora@^5.4.0:
version "5.4.1"
resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18"
integrity sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==
dependencies:
bl "^4.1.0"
chalk "^4.1.0"
cli-cursor "^3.1.0"
cli-spinners "^2.5.0"
is-interactive "^1.0.0"
is-unicode-supported "^0.1.0"
log-symbols "^4.1.0"
strip-ansi "^6.0.0"
wcwidth "^1.0.1"

[email protected]:
version "5.0.1"
resolved "https://registry.yarnpkg.com/os-name/-/os-name-5.0.1.tgz#acb4f996ec5bd86c41755fef9d6d31905c47172e"
Expand Down Expand Up @@ -6939,6 +6986,11 @@ simple-html-tokenizer@^0.5.10:
resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.5.10.tgz#0843e4f00c9677f1c81e3dfeefcee0a4aca8e5d0"
integrity sha512-1DHMUmvUOGuUZ9/+cX/+hOhWhRD5dEw6lodn8WuV+T+cQ31hhBcCu1dcDsNotowi4mMaNhrLyKoS+DtB81HdDA==

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==

simple-swizzle@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
Expand Down Expand Up @@ -7849,6 +7901,11 @@ workerpool@^6.0.3:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.0.3.tgz#3f80ba4d914fe7bb8d933628c26e5d7ff820c703"
integrity sha512-meU8ZzO+ipcx/njxtKUcbu2K95085q5WYDo8fR6PMW3hCY4driteIsNsEowYV7dzOtvq0HotUKsReJkK8gKXgg==

workerpool@^6.4.0:
version "6.5.1"
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544"
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==

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
Loading