Skip to content

Commit 716b94c

Browse files
committedMar 15, 2025
fix(internal): add mts file + crypto shim types (#58)
1 parent 23166e6 commit 716b94c

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed
 

‎scripts/build

+3-8
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,15 @@ node scripts/utils/make-dist-package-json.cjs > dist/package.json
2828

2929
# build to .js/.mjs/.d.ts files
3030
npm exec tsc-multi
31-
# we need to add exports = module.exports = Gitpod to index.js;
32-
# No way to get that from index.ts because it would cause compile errors
31+
# we need to patch index.js so that `new module.exports()` works for cjs backwards
32+
# compat. No way to get that from index.ts because it would cause compile errors
3333
# when building .mjs
3434
node scripts/utils/fix-index-exports.cjs
35-
# with "moduleResolution": "nodenext", if ESM resolves to index.d.ts,
36-
# it'll have TS errors on the default import. But if it resolves to
37-
# index.d.mts the default import will work (even though both files have
38-
# the same export default statement)
39-
cp dist/index.d.ts dist/index.d.mts
4035
cp tsconfig.dist-src.json dist/src/tsconfig.json
4136
cp src/internal/shim-types.d.ts dist/internal/shim-types.d.ts
4237
cp src/internal/shim-types.d.ts dist/internal/shim-types.d.mts
4338
mkdir -p dist/internal/shims
44-
cp src/internal/shims/*.{mjs,js,d.ts} dist/internal/shims
39+
cp src/internal/shims/*.{mjs,js,d.ts,d.mts} dist/internal/shims
4540

4641
node scripts/utils/postprocess-files.cjs
4742

‎src/internal/shims/crypto.node.d.mts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { crypto } from './crypto.node.js';

‎src/internal/shims/file.node.d.mts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { File } from './file.node.js';

0 commit comments

Comments
 (0)