Skip to content

Commit 940210d

Browse files
aisamueduardomourar
authored andcommitted
feat: generate es-module distribution (smithy-lang#685)
ES Modules are now supported on Node and have a nicer packaging/consumption story. This follows the codegen shape with minor adaptations to avoid breaking changes. Co-authored-by: Eduardo de Moura Rodrigues <[email protected]>
1 parent a200f5f commit 940210d

File tree

6 files changed

+130
-8
lines changed

6 files changed

+130
-8
lines changed

smithy-typescript-ssdk-libs/server-common/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
"version": "1.0.0-alpha.7",
44
"description": "Base components for Smithy services",
55
"main": "./dist/cjs/index.js",
6+
"module": "./dist/es/index.js",
67
"types": "./dist/types/index.d.ts",
78
"scripts": {
89
"prepublishOnly": "yarn build",
910
"pretest": "yarn build",
10-
"build": "tsc -p tsconfig.json",
11+
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
12+
"build:cjs": "tsc -p tsconfig.cjs.json",
13+
"build:es": "tsc -p tsconfig.es.json",
14+
"build:types": "tsc -p tsconfig.types.json",
1115
"postbuild": "rimraf dist/types/ts3.4 && downlevel-dts dist/types dist/types/ts3.4",
1216
"test": "jest",
1317
"clean": "rimraf dist",
@@ -30,6 +34,7 @@
3034
"devDependencies": {
3135
"@types/jest": "^26.0.22",
3236
"@types/node": "^14.14.37",
37+
"concurrently": "^7.6.0",
3338
"downlevel-dts": "^0.7.0",
3439
"jest": "^26.6.3",
3540
"ts-jest": "^26.5.2",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"outDir": "dist/cjs"
5+
}
6+
}
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+
"module": "esnext",
5+
"outDir": "dist/es"
6+
}
7+
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
2+
"extends": "../tsconfig.json",
23
"compilerOptions": {
34
"stripInternal": true,
4-
"declarationDir": "./dist/types",
5-
"rootDir": "./src",
6-
"outDir": "./dist/cjs",
5+
"removeComments": true,
6+
"rootDir": "src",
77
"baseUrl": "."
88
},
9-
"extends": "../tsconfig.json",
109
"include": ["src/"]
1110
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"removeComments": false,
5+
"declaration": true,
6+
"declarationDir": "dist/types",
7+
"emitDeclarationOnly": true
8+
},
9+
"exclude": ["test/**/*", "dist/types/**/*"]
10+
}

smithy-typescript-ssdk-libs/yarn.lock

Lines changed: 98 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ chalk@^2.0.0:
11191119
escape-string-regexp "^1.0.5"
11201120
supports-color "^5.3.0"
11211121

1122-
chalk@^4.0.0:
1122+
chalk@^4.0.0, chalk@^4.1.0:
11231123
version "4.1.2"
11241124
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
11251125
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
@@ -1161,6 +1161,15 @@ cliui@^6.0.0:
11611161
strip-ansi "^6.0.0"
11621162
wrap-ansi "^6.2.0"
11631163

1164+
cliui@^8.0.1:
1165+
version "8.0.1"
1166+
resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"
1167+
integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==
1168+
dependencies:
1169+
string-width "^4.2.0"
1170+
strip-ansi "^6.0.1"
1171+
wrap-ansi "^7.0.0"
1172+
11641173
co@^4.6.0:
11651174
version "4.6.0"
11661175
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
@@ -1220,6 +1229,21 @@ [email protected]:
12201229
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
12211230
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
12221231

1232+
concurrently@^7.6.0:
1233+
version "7.6.0"
1234+
resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-7.6.0.tgz#531a6f5f30cf616f355a4afb8f8fcb2bba65a49a"
1235+
integrity sha512-BKtRgvcJGeZ4XttiDiNcFiRlxoAeZOseqUvyYRUp/Vtd+9p1ULmeoSqGsDA+2ivdeDFpqrJvGvmI+StKfKl5hw==
1236+
dependencies:
1237+
chalk "^4.1.0"
1238+
date-fns "^2.29.1"
1239+
lodash "^4.17.21"
1240+
rxjs "^7.0.0"
1241+
shell-quote "^1.7.3"
1242+
spawn-command "^0.0.2-1"
1243+
supports-color "^8.1.0"
1244+
tree-kill "^1.2.2"
1245+
yargs "^17.3.1"
1246+
12231247
convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0:
12241248
version "1.8.0"
12251249
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369"
@@ -1278,6 +1302,11 @@ data-urls@^2.0.0:
12781302
whatwg-mimetype "^2.3.0"
12791303
whatwg-url "^8.0.0"
12801304

1305+
date-fns@^2.29.1:
1306+
version "2.29.3"
1307+
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"
1308+
integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==
1309+
12811310
debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1:
12821311
version "4.3.2"
12831312
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
@@ -1818,7 +1847,7 @@ gensync@^1.0.0-beta.2:
18181847
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
18191848
integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==
18201849

1821-
get-caller-file@^2.0.1:
1850+
get-caller-file@^2.0.1, get-caller-file@^2.0.5:
18221851
version "2.0.5"
18231852
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
18241853
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
@@ -2807,7 +2836,7 @@ lodash.truncate@^4.4.2:
28072836
resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193"
28082837
integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=
28092838

2810-
[email protected], lodash@^4.7.0:
2839+
[email protected], lodash@^4.17.21, lodash@^4.7.0:
28112840
version "4.17.21"
28122841
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
28132842
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -3425,6 +3454,13 @@ run-parallel@^1.1.9:
34253454
dependencies:
34263455
queue-microtask "^1.2.2"
34273456

3457+
rxjs@^7.0.0:
3458+
version "7.8.0"
3459+
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4"
3460+
integrity sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==
3461+
dependencies:
3462+
tslib "^2.1.0"
3463+
34283464
safe-buffer@~5.1.1:
34293465
version "5.1.2"
34303466
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
@@ -3520,6 +3556,11 @@ shebang-regex@^3.0.0:
35203556
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
35213557
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
35223558

3559+
shell-quote@^1.7.3:
3560+
version "1.7.4"
3561+
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.4.tgz#33fe15dee71ab2a81fcbd3a52106c5cfb9fb75d8"
3562+
integrity sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw==
3563+
35233564
shelljs@^0.8.3:
35243565
version "0.8.5"
35253566
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c"
@@ -3627,6 +3668,11 @@ source-map@^0.7.3:
36273668
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
36283669
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
36293670

3671+
spawn-command@^0.0.2-1:
3672+
version "0.0.2-1"
3673+
resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0"
3674+
integrity sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==
3675+
36303676
spdx-correct@^3.0.0:
36313677
version "3.1.1"
36323678
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9"
@@ -3738,6 +3784,13 @@ supports-color@^7.0.0, supports-color@^7.1.0:
37383784
dependencies:
37393785
has-flag "^4.0.0"
37403786

3787+
supports-color@^8.1.0:
3788+
version "8.1.1"
3789+
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"
3790+
integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==
3791+
dependencies:
3792+
has-flag "^4.0.0"
3793+
37413794
supports-hyperlinks@^2.0.0:
37423795
version "2.2.0"
37433796
resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz#4f77b42488765891774b70c79babd87f9bd594bb"
@@ -3852,6 +3905,11 @@ tr46@^2.1.0:
38523905
dependencies:
38533906
punycode "^2.1.1"
38543907

3908+
tree-kill@^1.2.2:
3909+
version "1.2.2"
3910+
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
3911+
integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==
3912+
38553913
ts-jest@^26.4.1, ts-jest@^26.5.2:
38563914
version "26.5.6"
38573915
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.6.tgz#c32e0746425274e1dfe333f43cd3c800e014ec35"
@@ -3873,6 +3931,11 @@ tslib@^1.8.0, tslib@^1.8.1:
38733931
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
38743932
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
38753933

3934+
tslib@^2.1.0:
3935+
version "2.5.0"
3936+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
3937+
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==
3938+
38763939
tslib@^2.3.1:
38773940
version "2.4.0"
38783941
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
@@ -4171,6 +4234,15 @@ wrap-ansi@^6.2.0:
41714234
string-width "^4.1.0"
41724235
strip-ansi "^6.0.0"
41734236

4237+
wrap-ansi@^7.0.0:
4238+
version "7.0.0"
4239+
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
4240+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
4241+
dependencies:
4242+
ansi-styles "^4.0.0"
4243+
string-width "^4.1.0"
4244+
strip-ansi "^6.0.0"
4245+
41744246
wrappy@1:
41754247
version "1.0.2"
41764248
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
@@ -4206,6 +4278,11 @@ y18n@^4.0.0:
42064278
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"
42074279
integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==
42084280

4281+
y18n@^5.0.5:
4282+
version "5.0.8"
4283+
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
4284+
integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
4285+
42094286
yallist@^4.0.0:
42104287
version "4.0.0"
42114288
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
@@ -4224,6 +4301,11 @@ yargs-parser@^18.1.2:
42244301
camelcase "^5.0.0"
42254302
decamelize "^1.2.0"
42264303

4304+
yargs-parser@^21.1.1:
4305+
version "21.1.1"
4306+
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
4307+
integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
4308+
42274309
yargs@^15.4.1:
42284310
version "15.4.1"
42294311
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8"
@@ -4241,6 +4323,19 @@ yargs@^15.4.1:
42414323
y18n "^4.0.0"
42424324
yargs-parser "^18.1.2"
42434325

4326+
yargs@^17.3.1:
4327+
version "17.6.2"
4328+
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.2.tgz#2e23f2944e976339a1ee00f18c77fedee8332541"
4329+
integrity sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==
4330+
dependencies:
4331+
cliui "^8.0.1"
4332+
escalade "^3.1.1"
4333+
get-caller-file "^2.0.5"
4334+
require-directory "^2.1.1"
4335+
string-width "^4.2.3"
4336+
y18n "^5.0.5"
4337+
yargs-parser "^21.1.1"
4338+
42444339
42454340
version "1.22.10"
42464341
resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.22.10.tgz#c99daa06257c80f8fa2c3f1490724e394c26b18c"

0 commit comments

Comments
 (0)