Skip to content

Commit ab0730f

Browse files
authored
chore: switch codebase to default esm (#3959)
1 parent c020bbb commit ab0730f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+306
-205
lines changed

.github/scripts/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "commonjs"
3+
}

layers/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
},
77
"private": true,
88
"description": "This CDK app is meant to be used to publish Powertools for AWS Lambda (TypeScript) Lambda Layer. It is composed of a single stack deploying the Layer into the target account.",
9+
"type": "module",
910
"scripts": {
1011
"test": "vitest --run tests/unit",
1112
"test:unit": "vitest --run tests/unit",

layers/tests/e2e/layerPublisher.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { TestNodejsFunction } from '@aws-lambda-powertools/testing-utils/resourc
99
import { App } from 'aws-cdk-lib';
1010
import { LayerVersion } from 'aws-cdk-lib/aws-lambda';
1111
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
12-
import packageJson from '../../package.json';
12+
import packageJson from '../../package.json' with { type: 'json' };
1313
import { LayerPublisherStack } from '../../src/layer-publisher-stack.js';
1414
import { RESOURCE_NAME_PREFIX } from './constants.js';
1515

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"packages/event-handler",
2020
"packages/validation"
2121
],
22+
"type": "module",
2223
"scripts": {
2324
"test": "npm t -ws",
2425
"test:parallel": "lerna exec --no-bail --no-sort --stream --concurrency 8 -- npm run test",

packages/batch/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"test:e2e:nodejs20x": "echo 'Not Implemented'",
1919
"test:e2e:nodejs22x": "echo 'Not Implemented'",
2020
"test:e2e": "echo 'Not Implemented'",
21-
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
22-
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
21+
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
22+
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
2323
"build": "npm run build:esm & npm run build:cjs",
2424
"lint": "biome lint .",
2525
"lint:fix": "biome check --write .",

packages/batch/tsconfig.cjs.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../tsconfig.cjs.json",
3+
"compilerOptions": {
4+
"composite": true,
5+
"declaration": true,
6+
"outDir": "./lib/cjs/",
7+
"rootDir": "./src",
8+
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
9+
},
10+
"include": [
11+
"./src/**/*"
12+
]
13+
}

packages/batch/tsconfig.esm.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/batch/tsconfig.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "./lib/cjs/",
4+
"baseUrl": ".",
5+
"outDir": "./lib/esm",
56
"rootDir": "./src",
6-
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
7+
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
8+
"composite": true,
9+
"declaration": true
710
},
8-
"include": ["./src/**/*"]
9-
}
11+
"include": [
12+
"./src/**/*"
13+
]
14+
}

packages/commons/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"test:unit:types": "vitest --run tests/types --typecheck",
1717
"test:e2e": "echo 'Not Applicable'",
1818
"generateVersionFile": "echo \"// this file is auto generated, do not modify\nexport const PT_VERSION = '$(jq -r '.version' package.json)';\" > src/version.ts",
19-
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
20-
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
19+
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
20+
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
2121
"build": "npm run build:esm & npm run build:cjs",
2222
"lint": "biome lint .",
2323
"lint:fix": "biome check --write .",

packages/commons/tsconfig.cjs.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../tsconfig.cjs.json",
3+
"compilerOptions": {
4+
"composite": true,
5+
"declaration": true,
6+
"outDir": "./lib/cjs/",
7+
"rootDir": "./src",
8+
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
9+
},
10+
"include": [
11+
"./src/**/*"
12+
]
13+
}

packages/commons/tsconfig.esm.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/commons/tsconfig.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "./lib/cjs/",
4+
"baseUrl": ".",
5+
"outDir": "./lib/esm",
56
"rootDir": "./src",
6-
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
7+
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
8+
"composite": true,
9+
"declaration": true
710
},
8-
"include": ["./src/**/*"]
9-
}
11+
"include": [
12+
"./src/**/*"
13+
]
14+
}

packages/event-handler/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"test:e2e:nodejs20x": "echo \"Not implemented\"",
1919
"test:e2e:nodejs22x": "echo \"Not implemented\"",
2020
"test:e2e": "echo \"Not implemented\"",
21-
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
22-
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
21+
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
22+
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
2323
"build": "npm run build:esm & npm run build:cjs",
2424
"lint": "biome lint .",
2525
"lint:fix": "biome check --write .",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../tsconfig.cjs.json",
3+
"compilerOptions": {
4+
"composite": true,
5+
"declaration": true,
6+
"outDir": "./lib/cjs/",
7+
"rootDir": "./src",
8+
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
9+
},
10+
"include": [
11+
"./src/**/*"
12+
]
13+
}

packages/event-handler/tsconfig.esm.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/event-handler/tsconfig.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "./lib/cjs/",
4+
"baseUrl": ".",
5+
"outDir": "./lib/esm",
56
"rootDir": "./src",
6-
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
7+
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
8+
"composite": true,
9+
"declaration": true
710
},
8-
"include": ["./src/**/*"]
9-
}
11+
"include": [
12+
"./src/**/*"
13+
]
14+
}

packages/idempotency/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"test:e2e:nodejs20x": "RUNTIME=nodejs20x vitest --run tests/e2e",
2020
"test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e",
2121
"test:e2e": "vitest --run tests/e2e",
22-
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
23-
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
22+
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
23+
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
2424
"build": "npm run build:esm & npm run build:cjs",
2525
"lint": "biome lint .",
2626
"lint:fix": "biome check --write .",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../tsconfig.cjs.json",
3+
"compilerOptions": {
4+
"outDir": "./lib/cjs",
5+
"rootDir": "./src",
6+
"tsBuildInfoFile": ".tsbuildinfo/cjs.json",
7+
"composite": true,
8+
"declaration": true
9+
},
10+
"include": [
11+
"./src/**/*"
12+
]
13+
}

packages/idempotency/tsconfig.esm.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/idempotency/tsconfig.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
2-
"extends": "../../tsconfig.json",
3-
"compilerOptions": {
4-
"outDir": "./lib/cjs",
5-
"rootDir": "./src",
6-
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
7-
},
8-
"include": [
9-
"./src/**/*"
10-
],
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"outDir": "./lib/esm",
6+
"rootDir": "./src",
7+
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
8+
"composite": true,
9+
"declaration": true
10+
},
11+
"include": [
12+
"./src/**/*"
13+
]
1114
}

packages/jmespath/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"test:unit:coverage": "vitest --run tests/unit --coverage.enabled --coverage.thresholds.100 --coverage.include='src/**'",
1616
"test:unit:types": "echo 'Not applicable for this package'",
1717
"test:e2e": "echo 'Not applicable for this package'",
18-
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
19-
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
18+
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
19+
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
2020
"build": "npm run build:esm & npm run build:cjs",
2121
"lint": "biome lint .",
2222
"lint:fix": "biome check --write .",

packages/jmespath/tsconfig.cjs.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../tsconfig.cjs.json",
3+
"compilerOptions": {
4+
"composite": true,
5+
"declaration": true,
6+
"outDir": "./lib/cjs/",
7+
"rootDir": "./src",
8+
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
9+
},
10+
"include": [
11+
"./src/**/*"
12+
]
13+
}

packages/jmespath/tsconfig.esm.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/jmespath/tsconfig.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "./lib/cjs/",
4+
"baseUrl": ".",
5+
"outDir": "./lib/esm",
56
"rootDir": "./src",
6-
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
7+
"tsBuildInfoFile": ".tsbuildinfo/esm.json"
78
},
8-
"include": ["./src/**/*"]
9-
}
9+
"include": [
10+
"./src/**/*"
11+
]
12+
}

packages/logger/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"test:e2e:nodejs20x": "RUNTIME=nodejs20x vitest --run tests/e2e",
2020
"test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e",
2121
"test:e2e": "vitest --run tests/e2e",
22-
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
23-
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
22+
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
23+
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
2424
"build": "npm run build:esm & npm run build:cjs",
2525
"lint": "biome lint .",
2626
"lint:fix": "biome check --write .",

packages/logger/tsconfig.cjs.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../tsconfig.cjs.json",
3+
"compilerOptions": {
4+
"composite": true,
5+
"declaration": true,
6+
"outDir": "./lib/cjs/",
7+
"rootDir": "./src",
8+
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
9+
},
10+
"include": [
11+
"./src/**/*"
12+
]
13+
}

packages/logger/tsconfig.esm.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/logger/tsconfig.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "./lib/cjs/",
4+
"baseUrl": ".",
5+
"outDir": "./lib/esm",
56
"rootDir": "./src",
6-
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
7+
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
8+
"composite": true,
9+
"declaration": true
710
},
8-
"include": ["./src/**/*"]
9-
}
11+
"include": [
12+
"./src/**/*"
13+
]
14+
}

packages/metrics/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"test:e2e:nodejs20x": "RUNTIME=nodejs20x vitest --run tests/e2e",
2020
"test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e",
2121
"test:e2e": "vitest --run tests/e2e",
22-
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
23-
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
22+
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
23+
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
2424
"build": "npm run build:esm & npm run build:cjs",
2525
"lint": "biome lint .",
2626
"lint:fix": "biome check --write .",

0 commit comments

Comments
 (0)