Skip to content

fix(internal): add mts file + crypto shim types #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,15 @@ node scripts/utils/make-dist-package-json.cjs > dist/package.json

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

node scripts/utils/postprocess-files.cjs

Expand Down
1 change: 1 addition & 0 deletions src/internal/shims/crypto.node.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { crypto } from './crypto.node.js';
1 change: 1 addition & 0 deletions src/internal/shims/file.node.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { File } from './file.node.js';