Skip to content

Commit e930ffb

Browse files
authored
feat: support ESM artifacts in all packages (#752)
Add ESM artifacts to all packages, so that all packages support CommonJS and ESM
1 parent 77bc5fb commit e930ffb

Some content is hidden

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

45 files changed

+172
-187
lines changed

packages/crc32/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"name": "@aws-crypto/crc32",
33
"version": "5.1.0",
44
"scripts": {
5-
"prepublishOnly": "tsc",
5+
"prepublishOnly": "tsc -p tsconfig.json && tsc -p tsconfig.module.json",
66
"pretest": "tsc -p tsconfig.test.json",
77
"test": "mocha --require ts-node/register test/**/*test.ts"
88
},
9-
"main": "./build/index.js",
10-
"types": "./build/index.d.ts",
9+
"main": "./build/main/index.js",
10+
"module": "./build/module/index.js",
11+
"types": "./build/main/index.d.ts",
1112
"repository": {
1213
"type": "git",
1314
"url": "git@github.com:aws/aws-sdk-js-crypto-helpers.git"

packages/crc32/tsconfig.json

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
{
2+
"extends": "../tsconfig.json",
23
"compilerOptions": {
3-
"target": "es5",
4-
"module": "commonjs",
5-
"declaration": true,
6-
"strict": true,
7-
"sourceMap": true,
8-
"downlevelIteration": true,
9-
"importHelpers": true,
10-
"noEmitHelpers": true,
11-
"lib": [
12-
"es5",
13-
"es2015.promise",
14-
"es2015.collection",
15-
"es2015.iterable",
16-
"es2015.symbol.wellknown"
17-
],
184
"rootDir": "./src",
19-
"outDir": "./build"
5+
"outDir": "./build/main",
206
},
217
"include": ["src/**/*.ts"],
228
"exclude": ["node_modules/**"]

packages/crc32/tsconfig.module.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"outDir": "build/module",
5+
"module": "esnext",
6+
}
7+
}

packages/crc32/tsconfig.test.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"sourceMap": false,
55
"inlineSourceMap": true,
66
"inlineSources": true,
7-
"rootDir": "./src",
8-
"outDir": "./build"
7+
98
}
109
}

packages/crc32c/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"name": "@aws-crypto/crc32c",
33
"version": "5.1.0",
44
"scripts": {
5-
"prepublishOnly": "tsc",
5+
"prepublishOnly": "tsc -p tsconfig.json && tsc -p tsconfig.module.json",
66
"pretest": "tsc -p tsconfig.test.json",
77
"test": "mocha --require ts-node/register test/**/*test.ts"
88
},
9-
"main": "./build/index.js",
10-
"types": "./build/index.d.ts",
9+
"main": "./build/main/index.js",
10+
"module": "./build/module/index.js",
11+
"types": "./build/main/index.d.ts",
1112
"repository": {
1213
"type": "git",
1314
"url": "git@github.com:aws/aws-sdk-js-crypto-helpers.git"

packages/crc32c/tsconfig.json

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
{
2+
"extends": "../tsconfig.json",
23
"compilerOptions": {
3-
"target": "es5",
4-
"module": "commonjs",
5-
"declaration": true,
6-
"strict": true,
7-
"sourceMap": true,
8-
"downlevelIteration": true,
9-
"importHelpers": true,
10-
"noEmitHelpers": true,
11-
"lib": [
12-
"es5",
13-
"es2015.promise",
14-
"es2015.collection",
15-
"es2015.iterable",
16-
"es2015.symbol.wellknown"
17-
],
184
"rootDir": "./src",
19-
"outDir": "./build"
5+
"outDir": "./build/main",
206
},
217
"include": ["src/**/*.ts"],
228
"exclude": ["node_modules/**"]

packages/crc32c/tsconfig.module.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"outDir": "build/module",
5+
"module": "esnext",
6+
}
7+
}

packages/crc32c/tsconfig.test.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"sourceMap": false,
55
"inlineSourceMap": true,
66
"inlineSources": true,
7-
"rootDir": "./src",
8-
"outDir": "./build"
7+
98
}
109
}

packages/random-source-browser/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@aws-crypto/random-source-browser",
33
"version": "5.1.0",
44
"scripts": {
5-
"prepublishOnly": "tsc",
5+
"prepublishOnly": "tsc -p tsconfig.json && tsc -p tsconfig.module.json",
66
"pretest": "tsc -p tsconfig.test.json",
77
"test": "mocha --require ts-node/register test/**/*test.ts"
88
},
@@ -22,6 +22,7 @@
2222
"@aws-sdk/util-locate-window": "^3.0.0",
2323
"tslib": "^2.6.2"
2424
},
25-
"main": "./build/index.js",
26-
"types": "./build/index.d.ts"
25+
"main": "./build/main/index.js",
26+
"module": "./build/module/index.js",
27+
"types": "./build/main/index.d.ts"
2728
}

packages/random-source-browser/tsconfig.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
{
2+
"extends": "../tsconfig.json",
23
"compilerOptions": {
3-
"target": "es5",
4-
"module": "commonjs",
5-
"lib": ["dom", "es5", "es2015.promise", "es2015.collection"],
6-
"declaration": true,
7-
"sourceMap": true,
8-
"strict": true,
94
"rootDir": "./src",
10-
"outDir": "./build",
11-
"importHelpers": true,
12-
"noEmitHelpers": true
5+
"outDir": "./build/main",
6+
"lib": ["dom"],
137
},
148
"include": ["src/**/*.ts"],
159
"exclude": ["node_modules/**"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"outDir": "build/module",
5+
"module": "esnext",
6+
}
7+
}

packages/random-source-browser/tsconfig.test.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
"sourceMap": false,
55
"inlineSourceMap": true,
66
"inlineSources": true,
7-
"rootDir": "./src",
8-
"outDir": "./build",
9-
"types": ["node"]
107
}
118
}

packages/random-source-node/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
"name": "@aws-crypto/random-source-node",
33
"version": "5.1.0",
44
"description": "A Node.JS implementation of the AWS SDK for JavaScript's `randomValues` interface",
5-
"main": "./build/index.js",
5+
"main": "./build/main/index.js",
6+
"module": "./build/module/index.js",
7+
"types": "./build/main/index.d.ts",
68
"scripts": {
9+
"prepublishOnly": "tsc -p tsconfig.json && tsc -p tsconfig.module.json",
710
"pretest": "tsc -p tsconfig.test.json",
811
"test": "mocha --require ts-node/register test/**/*test.ts"
912
},
@@ -22,7 +25,6 @@
2225
"@aws-sdk/types": "^3.222.0",
2326
"tslib": "^2.6.2"
2427
},
25-
"types": "./build/index.d.ts",
2628
"engines": {
2729
"node": ">=16.0.0"
2830
}

packages/random-source-node/tsconfig.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
{
2+
"extends": "../tsconfig.json",
23
"compilerOptions": {
3-
"target": "es5",
4-
"module": "commonjs",
5-
"lib": ["es5", "es2015.promise", "es2015.collection"],
6-
"declaration": true,
7-
"sourceMap": true,
8-
"strict": true,
94
"rootDir": "./src",
10-
"outDir": "./build",
11-
"importHelpers": true,
12-
"noEmitHelpers": true
5+
"outDir": "./build/main",
136
},
147
"include": ["src/**/*.ts"],
158
"exclude": ["node_modules/**"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"outDir": "build/module",
5+
"module": "esnext",
6+
}
7+
}

packages/random-source-node/tsconfig.test.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"sourceMap": false,
55
"inlineSourceMap": true,
66
"inlineSources": true,
7-
"rootDir": "./src",
8-
"outDir": "./build"
7+
98
}
109
}

packages/random-source-universal/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@aws-crypto/random-source-universal",
33
"version": "5.1.0",
44
"scripts": {
5-
"prepublishOnly": "tsc",
5+
"prepublishOnly": "tsc -p tsconfig.json && tsc -p tsconfig.module.json",
66
"pretest": "tsc -p tsconfig.test.json",
77
"test": "mocha --require ts-node/register test/**/*test.ts"
88
},
@@ -26,8 +26,9 @@
2626
"browser": {
2727
"@aws/crypto-random-source-node": false
2828
},
29-
"main": "./build/index.js",
30-
"types": "./build/index.d.ts",
29+
"main": "./build/main/index.js",
30+
"module": "./build/module/index.js",
31+
"types": "./build/main/index.d.ts",
3132
"engines": {
3233
"node": ">=16.0.0"
3334
}

packages/random-source-universal/tsconfig.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
{
2+
"extends": "../tsconfig.json",
23
"compilerOptions": {
3-
"target": "es5",
4-
"module": "commonjs",
5-
"lib": ["dom", "es5", "es2015.promise", "es2015.collection"],
6-
"declaration": true,
7-
"sourceMap": true,
8-
"strict": true,
94
"rootDir": "./src",
10-
"outDir": "./build",
11-
"importHelpers": true,
12-
"noEmitHelpers": true
5+
"outDir": "./build/main",
6+
"lib": ["dom"],
137
},
148
"include": ["src/**/*.ts"],
159
"exclude": ["node_modules/**"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"outDir": "build/module",
5+
"module": "esnext",
6+
}
7+
}

packages/random-source-universal/tsconfig.test.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"sourceMap": false,
55
"inlineSourceMap": true,
66
"inlineSources": true,
7-
"rootDir": "./src",
8-
"outDir": "./build"
7+
98
}
109
}

packages/sha1-browser/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@aws-crypto/sha1-browser",
33
"version": "5.1.0",
44
"scripts": {
5-
"prepublishOnly": "tsc",
5+
"prepublishOnly": "tsc -p tsconfig.json && tsc -p tsconfig.module.json",
66
"pretest": "tsc -p tsconfig.test.json",
77
"test": "mocha --require ts-node/register test/**/*test.ts"
88
},
@@ -25,8 +25,9 @@
2525
"@smithy/util-utf8": "^2.0.0",
2626
"tslib": "^2.6.2"
2727
},
28-
"main": "./build/index.js",
29-
"types": "./build/index.d.ts",
28+
"main": "./build/main/index.js",
29+
"module": "./build/module/index.js",
30+
"types": "./build/main/index.d.ts",
3031
"publishConfig": {
3132
"access": "public"
3233
}

packages/sha1-browser/tsconfig.json

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
{
2+
"extends": "../tsconfig.json",
23
"compilerOptions": {
3-
"target": "es5",
4-
"module": "commonjs",
5-
"lib": [
6-
"dom",
7-
"es5",
8-
"es2015.promise",
9-
"es2015.collection",
10-
"es2015.iterable"
11-
],
12-
"declaration": true,
13-
"sourceMap": true,
14-
"strict": true,
154
"rootDir": "./src",
16-
"outDir": "./build",
17-
"importHelpers": true,
18-
"noEmitHelpers": true
5+
"outDir": "./build/main",
6+
"lib": ["dom"],
197
},
208
"include": ["src/**/*.ts"],
219
"exclude": ["node_modules/**"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"outDir": "build/module",
5+
"module": "esnext",
6+
}
7+
}

packages/sha1-browser/tsconfig.test.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"sourceMap": false,
55
"inlineSourceMap": true,
66
"inlineSources": true,
7-
"rootDir": "./src",
8-
"outDir": "./build"
7+
98
}
109
}

packages/sha256-browser/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@aws-crypto/sha256-browser",
33
"version": "5.1.0",
44
"scripts": {
5-
"prepublishOnly": "tsc",
5+
"prepublishOnly": "tsc -p tsconfig.json && tsc -p tsconfig.module.json",
66
"pretest": "tsc -p tsconfig.test.json",
77
"test": "mocha --require ts-node/register test/**/*test.ts"
88
},
@@ -26,6 +26,7 @@
2626
"@smithy/util-utf8": "^2.0.0",
2727
"tslib": "^2.6.2"
2828
},
29-
"main": "./build/index.js",
30-
"types": "./build/index.d.ts"
29+
"main": "./build/main/index.js",
30+
"module": "./build/module/index.js",
31+
"types": "./build/main/index.d.ts"
3132
}

packages/sha256-browser/tsconfig.json

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
{
2+
"extends": "../tsconfig.json",
23
"compilerOptions": {
3-
"target": "es5",
4-
"module": "commonjs",
5-
"lib": [
6-
"dom",
7-
"es5",
8-
"es2015.promise",
9-
"es2015.collection",
10-
"es2015.iterable"
11-
],
12-
"declaration": true,
13-
"sourceMap": true,
14-
"strict": true,
154
"rootDir": "./src",
16-
"outDir": "./build",
17-
"importHelpers": true,
18-
"noEmitHelpers": true
5+
"outDir": "./build/main",
6+
"lib": ["dom"],
197
},
208
"include": ["src/**/*.ts"],
219
"exclude": ["node_modules/**"]

0 commit comments

Comments
 (0)