Skip to content

Commit

Permalink
feat: add esm-register for node>20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
yeliex committed Jan 12, 2024
1 parent df125c8 commit 313b553
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ dist
#/target
Cargo.lock

# idea
.idea/

*.node
lib
artifacts
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@types/babel__core": "^7.20.1",
"@types/benchmark": "^2.1.2",
"@types/lodash": "^4.14.197",
"@types/node": "^20.5.0",
"@types/node": "^20.11.0",
"@types/sinon": "^10.0.16",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/register/esm-register.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { register } from 'node:module'
import { pathToFileURL } from 'node:url'

register('@swc-node/register/esm', pathToFileURL('./').toString())
3 changes: 3 additions & 0 deletions packages/register/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
},
"./esm": {
"import": "./esm/esm.mjs"
},
"./esm-register": {
"import": "./esm/esm-register.mjs"
}
}
}
2 changes: 1 addition & 1 deletion packages/register/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"outDir": "esm"
},
"include": [],
"files": ["./esm.mts", "register.d.ts", "./read-default-tsconfig.d.ts"]
"files": ["./esm.mts", "./esm-register.mts", "register.d.ts", "./read-default-tsconfig.d.ts"]
}
68 changes: 37 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 313b553

Please sign in to comment.