Skip to content

Commit 7f9549f

Browse files
RajdeepcRajdeep Chandrarubencarvalho
authored
chore: preview docs import attribute fix for node 22 (#5805)
* chore: preview docs import attribute fix for node 22 * chore: update node to v 20.10.0 to support next gen import attributes --------- Co-authored-by: Rajdeep Chandra <[email protected]> Co-authored-by: Rúben Carvalho <[email protected]>
1 parent ad84aaf commit 7f9549f

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
"lit-html"
218218
],
219219
"engines": {
220-
"node": ">=20",
220+
"node": ">=20.10.0",
221221
"yarn": ">=4.6.0"
222222
},
223223
"wireit": {

projects/documentation/.eleventy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ const packageVersion = async function (packageName) {
1919
packageJSON = await import(
2020
`../../packages/${packageName}/package.json`,
2121
{
22-
assert: { type: 'json' },
22+
with: { type: 'json' },
2323
}
2424
).then((packageDefault) => packageDefault.default);
2525
} catch (e) {
2626
try {
2727
packageJSON = await import(
2828
`../../tools/${packageName}/package.json`,
2929
{
30-
assert: { type: 'json' },
30+
with: { type: 'json' },
3131
}
3232
).then((packageDefault) => packageDefault.default);
3333
} catch (e) {}

projects/documentation/scripts/copy-component-docs.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ const findDeprecationNotice = async function (filePath) {
6363
for await (const mdPath of globby.stream(filePath)) {
6464
const hasDeprecation = fs.existsSync(mdPath);
6565
if (hasDeprecation) {
66+
// Using 'with' syntax for import attributes (required in Node.js 20.10+).
67+
// The 'assert' keyword was deprecated and replaced with 'with' per TC39 proposal.
68+
// See: https://github.com/tc39/proposal-import-attributes
6669
const packageJSON = await import(mdPath, {
67-
assert: { type: 'json' },
70+
with: { type: 'json' },
6871
}).then((packageDefault) => packageDefault.default);
6972
return packageJSON.deprecationNotice;
7073
}

test/benchmark/cli.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ $ node test/benchmark/cli -n 20
235235
'package.json'
236236
),
237237
{
238-
assert: { type: 'json' },
238+
with: { type: 'json' },
239239
}
240240
);
241241
if (pjson.version === '0.0.1' && opts.compare !== 'none') {
@@ -245,7 +245,9 @@ $ node test/benchmark/cli -n 20
245245
);
246246
return;
247247
}
248-
if (!config.benchmarks) return;
248+
if (!config.benchmarks) {
249+
return;
250+
}
249251
if (opts.compare !== 'none') {
250252
config.benchmarks.push({
251253
name: `${packageName}:${benchmark}`,

0 commit comments

Comments
 (0)