Skip to content

Commit 46de880

Browse files
authored
Merge pull request #428 from jeffijoe/chore/update-packages
Update packages
2 parents ae94bfd + d35803d commit 46de880

11 files changed

Lines changed: 2647 additions & 3023 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v13.0.4
2+
3+
- Update packages and simplify build ([#428](https://github.com/jeffijoe/awilix/pull/428)))
4+
15
# v13.0.3
26

37
- Fix CJS environments (e.g. Jest + esbuild) failing to `require()` the `.mjs` native loader by providing separate CJS and ESM versions of `load-module-native` ([#418](https://github.com/jeffijoe/awilix/issues/418), [#419](https://github.com/jeffijoe/awilix/pull/419))

package-lock.json

Lines changed: 2607 additions & 2961 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -76,31 +76,28 @@
7676
},
7777
"homepage": "https://github.com/jeffijoe/awilix#readme",
7878
"devDependencies": {
79-
"@babel/core": "^7.29.0",
80-
"@babel/plugin-transform-runtime": "^7.29.0",
81-
"@babel/preset-env": "^7.29.0",
82-
"@babel/runtime": "^7.28.6",
83-
"@rollup/plugin-commonjs": "^29.0.0",
84-
"@rollup/plugin-node-resolve": "^16.0.3",
79+
"@babel/core": "^7.29.7",
80+
"@babel/plugin-transform-runtime": "^7.29.7",
81+
"@babel/preset-env": "^7.29.7",
82+
"@babel/runtime": "^7.29.7",
8583
"@rollup/plugin-replace": "^6.0.3",
8684
"@types/jest": "^30.0.0",
87-
"@types/node": "^25.3.3",
88-
"babel-jest": "^30.2.0",
85+
"@types/node": "^25.9.3",
86+
"babel-jest": "^30.4.1",
8987
"eslint": "^9.22.0",
9088
"husky": "^9.1.7",
91-
"jest": "^30.2.0",
89+
"jest": "^30.4.2",
9290
"lint-staged": "^16.3.1",
93-
"prettier": "^3.8.1",
91+
"prettier": "^3.8.4",
9492
"rimraf": "^6.1.3",
95-
"rollup": "^4.59.0",
96-
"rollup-plugin-copy": "^3.5.0",
97-
"rollup-plugin-typescript2": "^0.36.0",
93+
"rollup": "^4.61.1",
94+
"rollup-plugin-typescript2": "^0.37.0",
9895
"smid": "^0.1.1",
99-
"tinybench": "^6.0.0",
100-
"ts-jest": "^29.4.6",
96+
"tinybench": "^6.0.2",
97+
"ts-jest": "^29.4.11",
10198
"tslib": "^2.8.1",
102-
"typescript": "^5.9.3",
103-
"typescript-eslint": "^8.56.1"
99+
"typescript": "^6.0.3",
100+
"typescript-eslint": "^8.61.0"
104101
},
105102
"dependencies": {
106103
"fast-glob": "^3.3.3"
@@ -147,15 +144,17 @@
147144
"/node_modules/",
148145
"__tests__",
149146
"lib",
150-
"src/load-module-native.mjs",
151-
"src/load-module-native.js",
147+
"src/load-module-native.ts",
152148
"src/awilix.ts"
153149
],
154150
"moduleFileExtensions": [
155151
"ts",
156152
"tsx",
157153
"js"
158154
],
155+
"moduleNameMapper": {
156+
"^(\\.{1,2}/.*)\\.js$": "$1"
157+
},
159158
"transform": {
160159
"^.+\\.tsx?$": [
161160
"ts-jest",

rollup.config.mjs

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import typescript from 'rollup-plugin-typescript2'
22
import typescriptCompiler from 'typescript'
33
import replace from '@rollup/plugin-replace'
4-
import commonjs from '@rollup/plugin-commonjs'
5-
import resolve from '@rollup/plugin-node-resolve'
6-
import copy from 'rollup-plugin-copy'
74

85
const comment = '/* removed in browser build */'
96
const ignoredWarnings = ['UNUSED_EXTERNAL_IMPORT']
@@ -17,6 +14,7 @@ const tsOpts = {
1714
// Don't emit declarations, that's done by the regular build.
1815
declaration: false,
1916
module: 'ESNext',
17+
moduleResolution: 'bundler',
2018
},
2119
},
2220
}
@@ -34,27 +32,7 @@ export default [
3432
format: 'es',
3533
},
3634
],
37-
plugins: [
38-
// The source imports ./load-module-native.js (the CJS version) so that
39-
// tsc emits require("./load-module-native.js") in the CJS build.
40-
// For this ESM bundle we remap it to the .mjs version.
41-
// Returning a relative id with external: true tells rollup to preserve
42-
// the path as-is in the output (see https://rollupjs.org/plugin-development/#resolveid).
43-
{
44-
name: 'rewrite-native-loader',
45-
resolveId(source) {
46-
if (source === './load-module-native.js') {
47-
return { id: './load-module-native.mjs', external: true }
48-
}
49-
return null
50-
},
51-
},
52-
// Copy the native module loaders and their type declarations to lib/
53-
copy({
54-
targets: [{ src: 'src/load-module-native.*', dest: 'lib' }],
55-
}),
56-
typescript(tsOpts),
57-
],
35+
plugins: [typescript(tsOpts)],
5836
},
5937
// Build 2: ES modules for browser builds.
6038
{
@@ -86,7 +64,7 @@ export default [
8664
'[util.inspect.custom]: inspect,': comment,
8765
'[util.inspect.custom]: toStringRepresentationFn,': comment,
8866
'case util.inspect.custom:': '',
89-
[`export {
67+
[`export {
9068
type GlobWithOptions,
9169
type ListModulesOptions,
9270
type ModuleDescriptor,
@@ -102,14 +80,11 @@ export default [
10280
declaration: false,
10381
noUnusedLocals: false,
10482
module: 'ESNext',
83+
moduleResolution: 'bundler',
10584
},
10685
},
10786
}),
10887
),
109-
resolve({
110-
preferBuiltins: true,
111-
}),
112-
commonjs(),
11388
],
11489
},
11590
]

src/load-module-native.d.mts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/load-module-native.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/load-module-native.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/load-module-native.mjs

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/load-module-native.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Kept in a separate module so it can be excluded from test coverage;
2+
// jest cannot execute a native dynamic import.
3+
export function importModule(path: string): Promise<any> {
4+
return import(path)
5+
}

tsconfig.build.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"exclude": ["__tests__", "**/__tests__/*", "node_modules/*", "examples", "benchmarks"],
44
"compilerOptions": {
55
"forceConsistentCasingInFileNames": false,
6-
"baseUrl": "src"
6+
"rootDir": "src",
7+
// The base config enables this for ts-jest, but the build keeps it off
8+
// so `const enum` values (e.g. TokenizerFlags) are inlined in the output.
9+
"isolatedModules": false
710
}
811
}

0 commit comments

Comments
 (0)