Skip to content

Commit

Permalink
feat(require): Replace import assertion with import attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy351 committed Jun 10, 2024
1 parent aec2e26 commit 407890e
Show file tree
Hide file tree
Showing 25 changed files with 50 additions and 24 deletions.
26 changes: 26 additions & 0 deletions .changeset/shaggy-turkeys-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
"@kosko/template-deployed-service": minor
"@kosko/template-environment": minor
"@kosko/common-utils": minor
"create-kosko": minor
"@kosko/jest-preset": minor
"@kosko/plugin-set-metadata": minor
"@kosko/exec-utils": minor
"@kosko/cli-utils": minor
"@kosko/kustomize": minor
"@kosko/generate": minor
"@kosko/template": minor
"@kosko/migrate": minor
"@kosko/require": minor
"@kosko/config": minor
"@kosko/plugin": minor
"kosko": minor
"@kosko/helm": minor
"@kosko/yaml": minor
"@kosko/cli": minor
"@kosko/env": minor
"@kosko/log": minor
"@kosko/plugin-lint": minor
---

The minimal supported Node.js version is 18.20.0, 20.10.0, 21 and above because import assertion is replaced by [import attributes](https://nodejs.org/docs/latest-v22.x/api/esm.html#import-attributes) now.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"*.{js,ts,jsx,tsx,cjs,mjs,cts,mts}": "eslint --fix"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/log": "workspace:^"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/cli-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/common-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"devDependencies": {
"@kosko/build-scripts": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@iarna/toml": "^2.2.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-kosko/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/cli-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/common-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/exec-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"cross-spawn": "^7.0.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/generate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/common-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/helm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/common-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/kosko/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/cli": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/kustomize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/common-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/log/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/common-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"camelcase": "^6.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/generate": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/require/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/common-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/require/src/import.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function importPath(path: string) {
return requireModule(path);
}

return import(url, { assert: { type: "json" }, with: { type: "json" } });
return import(url, { with: { type: "json" } });
}

try {
Expand Down
2 changes: 1 addition & 1 deletion packages/require/src/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function importPath(path: string) {
const url = pathToFileURL(path).toString();

if (path.endsWith(".json")) {
return import(url, { assert: { type: "json" } });
return import(url, { with: { type: "json" } });
}

return import(url);
Expand Down
2 changes: 1 addition & 1 deletion packages/template-deployed-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/template": "workspace:^"
Expand Down
2 changes: 1 addition & 1 deletion packages/template-environment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/template": "workspace:^"
Expand Down
2 changes: 1 addition & 1 deletion packages/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/log": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/yaml/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/common-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion plugins/lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/common-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion plugins/set-metadata/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"access": "public"
},
"engines": {
"node": ">=18"
"node": "^18.20.0 || ^20.10.0 || >= 21"
},
"dependencies": {
"@kosko/common-utils": "workspace:^",
Expand Down

0 comments on commit 407890e

Please sign in to comment.