Skip to content

Commit adf1aa9

Browse files
authored
feat: tsdown bundler, esm-sync, jest globals, docs update (#142)
* deps: bump package versions * build: use tsdown bundler * 2.2.4-beta.0 * fix: add back cjs export syntax * 2.2.4-beta.1 * deps: bump package versions + tsdown * chore: add tsdown.config.ts to tsconfig.json * chore: added type: module * chore(ci): use node v22.17.1 in pipelines Ref: - httptoolkit/esm#9 * 2.2.4-beta.2 * 2.2.4-beta.3 * 2.2.4-beta.4 * chore: tsdown remove array for format * feat: switch to esm-sync * 2.2.4-beta.5 * docs: fix version update * deps: bump esm-sync * docs: add alternative - jiti * chore: simplify tsconfig.json * chore: revert version change for esm-sync * deps: use official esm-sync v3.3.3 * deps: bump major package versions * test: use @jest/globals with explicit imports * chore: remove error clause * ci: pipeline 22.x
1 parent 07a2908 commit adf1aa9

18 files changed

Lines changed: 2140 additions & 2192 deletions

.deepsource.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ name = "javascript"
77
environment = [
88
"nodejs",
99
"jest"
10-
]
10+
]

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tests/**/* linguist-vendored
1+
tests/**/* linguist-vendored

.github/workflows/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
node-version: [20.x, 18.x]
20+
node-version: [22.x, 20.x, 18.x]
2121
fail-fast: true
2222

2323
steps:

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"printWidth": 100,
55
"singleQuote": true,
66
"bracketSameLine": false
7-
}
7+
}

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,18 @@ For further discussions about this issue, visit:
324324

325325
### 6.1. 2023-12-16
326326

327-
As of version 2.2.0, **import-sync** has switched from using the archived [esm](https://github.com/standard-things/esm) package to the fork [@httptoolkit/esm](https://github.com/httptoolkit/esm). For further details, please see
327+
As of version 2.2.0, **import-sync** has switched from using the archived [esm](https://github.com/standard-things/esm) package to the fork [@httptoolkit/esm](https://github.com/httptoolkit/esm). For further details, please see:
328328
- issue [#37](https://github.com/nktnet1/import-sync/issues/37)
329329
- merge request [#38](https://github.com/nktnet1/import-sync/pull/38)
330330

331+
### 6.2. 2026-04-20
332+
333+
As of version 3.0.0, **import-sync** has switched to the fork [esm-sync](https://github.com/nktnet1/esm-sync).
334+
335+
## 7. Alternative
336+
337+
Jiti (Runtime TypeScript and ESM support for Node.js):
338+
339+
- https://github.com/unjs/jiti
340+
341+
While synchronous import is deprecated in Jiti, it still works reliably for many use cases.

eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const eslintFlatConfig = [
2424
languageOptions: {
2525
globals: {
2626
...globals.node,
27-
...globals.jest,
2827
},
2928
},
3029
},

package.json

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
{
22
"name": "import-sync",
3+
"type": "module",
34
"repository": {
45
"type": "git",
56
"url": "https://github.com/nktnet1/import-sync"
67
},
7-
"version": "2.2.3",
8+
"version": "2.2.4-beta.5",
89
"files": [
910
"dist"
1011
],
11-
"main": "dist/cjs/index.js",
12-
"module": "dist/esm/index.js",
1312
"scripts": {
1413
"test": "jest",
1514
"tc": "jest --coverage",
1615
"lint": "eslint --fix './**/*.ts'",
1716
"tsc": "tsc --noEmit",
18-
"build": "rm -rf dist && npm run build:esm && npm run build:cjs",
19-
"build:esm": "tsc",
20-
"build:cjs": "tsc --module CommonJS --outDir dist/cjs",
17+
"build": "tsdown",
2118
"prepublishOnly": "npm run build",
2219
"prepare": "husky"
2320
},
@@ -42,33 +39,40 @@
4239
"license": "MIT",
4340
"description": "Synchronously import dynamic ECMAScript Modules similar to CommonJS require. Basic wrapper around esm for compatibility with both ESM and CJS projects in NodeJS.",
4441
"devDependencies": {
45-
"@commitlint/cli": "^20.0.0",
46-
"@commitlint/config-conventional": "^20.0.0",
47-
"@eslint/eslintrc": "^3.3.1",
48-
"@eslint/js": "^9.36.0",
49-
"@types/httptoolkit__esm": "^3.3.0",
42+
"@commitlint/cli": "^20.5.0",
43+
"@commitlint/config-conventional": "^20.5.0",
44+
"@eslint/eslintrc": "^3.3.5",
45+
"@eslint/js": "^10.0.1",
46+
"@jest/globals": "^30.3.0",
5047
"@types/jest": "^30.0.0",
51-
"@types/node": "^24.5.2",
52-
"@typescript-eslint/eslint-plugin": "^8.44.1",
53-
"@typescript-eslint/parser": "^8.44.1",
54-
"eslint": "^9.36.0",
48+
"@types/node": "^25.6.0",
49+
"@typescript-eslint/eslint-plugin": "^8.58.2",
50+
"@typescript-eslint/parser": "^8.58.2",
51+
"eslint": "^10.2.1",
5552
"eslint-config-prettier": "^10.1.8",
5653
"eslint-import-resolver-typescript": "^4.4.4",
5754
"eslint-plugin-import": "^2.32.0",
58-
"eslint-plugin-jest": "^29.0.1",
59-
"eslint-plugin-prettier": "^5.5.4",
60-
"eslint-plugin-react-refresh": "^0.4.22",
61-
"globals": "^16.4.0",
55+
"eslint-plugin-prettier": "^5.5.5",
56+
"eslint-plugin-react-refresh": "^0.5.2",
57+
"globals": "^17.5.0",
6258
"husky": "^9.1.7",
63-
"jest": "^30.1.3",
64-
"node-datachannel": "^0.29.0",
59+
"jest": "^30.3.0",
60+
"node-datachannel": "^0.32.2",
6561
"node-fetch": "^3.3.2",
66-
"ts-jest": "^29.4.4",
62+
"ts-jest": "^29.4.9",
6763
"ts-node": "^10.9.2",
68-
"typescript": "^5.9.2"
64+
"tsdown": "^0.21.9",
65+
"typescript": "^6.0.3"
6966
},
7067
"dependencies": {
71-
"@httptoolkit/esm": "^3.3.2"
68+
"esm-sync": "3.3.3"
7269
},
73-
"packageManager": "pnpm@10.17.1"
70+
"packageManager": "pnpm@10.33.0",
71+
"main": "./dist/index.cjs",
72+
"module": "./dist/index.mjs",
73+
"types": "./dist/index.d.cts",
74+
"exports": {
75+
".": "./dist/index.cjs",
76+
"./package.json": "./package.json"
77+
}
7478
}

0 commit comments

Comments
 (0)