@modern-js/node-bundle-require 2.25.0 → 2.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/cjs/bundle.js +9 -2
- package/dist/esm/bundle.js +10 -3
- package/dist/types/bundle.d.ts +4 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @modern-js/node-bundle-require
|
|
2
2
|
|
|
3
|
+
## 2.25.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [63d8247]
|
|
8
|
+
- Updated dependencies [6651684]
|
|
9
|
+
- Updated dependencies [272646c]
|
|
10
|
+
- Updated dependencies [358ed24]
|
|
11
|
+
- @modern-js/utils@2.25.2
|
|
12
|
+
|
|
13
|
+
## 2.25.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 85366bc: chore(deps): bump esbuild from v15/v16 to v17
|
|
18
|
+
|
|
19
|
+
chore(deps): 将 esbuild 从 v15/v16 升级到 v17
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [9f78d0c]
|
|
22
|
+
- @modern-js/utils@2.25.1
|
|
23
|
+
|
|
3
24
|
## 2.25.0
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/cjs/bundle.js
CHANGED
|
@@ -54,7 +54,7 @@ async function bundle(filepath, options) {
|
|
|
54
54
|
debug("bundle", filepath, options);
|
|
55
55
|
const getOutputFile = (options === null || options === void 0 ? void 0 : options.getOutputFile) || defaultGetOutputFile;
|
|
56
56
|
const outfile = await getOutputFile(_path.default.basename(filepath));
|
|
57
|
-
|
|
57
|
+
const esbuildOptions = {
|
|
58
58
|
entryPoints: [
|
|
59
59
|
filepath
|
|
60
60
|
],
|
|
@@ -152,6 +152,13 @@ async function bundle(filepath, options) {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
]
|
|
155
|
-
}
|
|
155
|
+
};
|
|
156
|
+
if (options === null || options === void 0 ? void 0 : options.watch) {
|
|
157
|
+
const ctx = await (0, _esbuild.context)(esbuildOptions);
|
|
158
|
+
await ctx.rebuild();
|
|
159
|
+
await ctx.watch();
|
|
160
|
+
} else {
|
|
161
|
+
await (0, _esbuild.build)(esbuildOptions);
|
|
162
|
+
}
|
|
156
163
|
return outfile;
|
|
157
164
|
}
|
package/dist/esm/bundle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { fs, pkgUp, nanoid, CONFIG_CACHE_DIR, createDebugger } from "@modern-js/utils";
|
|
3
|
-
import { build } from "esbuild";
|
|
3
|
+
import { build, context } from "esbuild";
|
|
4
4
|
const debug = createDebugger("node-bundle");
|
|
5
5
|
const JS_EXT_RE = /\.(mjs|cjs|ts|js|tsx|jsx)$/;
|
|
6
6
|
const BUNDLED_EXT_RE = /\.(ts|mts|cts|tsx|mjs)$/;
|
|
@@ -31,7 +31,7 @@ export async function bundle(filepath, options) {
|
|
|
31
31
|
debug("bundle", filepath, options);
|
|
32
32
|
const getOutputFile = (options === null || options === void 0 ? void 0 : options.getOutputFile) || defaultGetOutputFile;
|
|
33
33
|
const outfile = await getOutputFile(path.basename(filepath));
|
|
34
|
-
|
|
34
|
+
const esbuildOptions = {
|
|
35
35
|
entryPoints: [
|
|
36
36
|
filepath
|
|
37
37
|
],
|
|
@@ -129,6 +129,13 @@ export async function bundle(filepath, options) {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
]
|
|
132
|
-
}
|
|
132
|
+
};
|
|
133
|
+
if (options === null || options === void 0 ? void 0 : options.watch) {
|
|
134
|
+
const ctx = await context(esbuildOptions);
|
|
135
|
+
await ctx.rebuild();
|
|
136
|
+
await ctx.watch();
|
|
137
|
+
} else {
|
|
138
|
+
await build(esbuildOptions);
|
|
139
|
+
}
|
|
133
140
|
return outfile;
|
|
134
141
|
}
|
package/dist/types/bundle.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ export interface Options {
|
|
|
24
24
|
* auto clear bundle file
|
|
25
25
|
*/
|
|
26
26
|
autoClear?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to enable watch mode
|
|
29
|
+
*/
|
|
30
|
+
watch?: boolean;
|
|
27
31
|
}
|
|
28
32
|
export declare const defaultGetOutputFile: (filepath: string) => Promise<string>;
|
|
29
33
|
export declare function bundle(filepath: string, options?: Options): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/node-bundle-require",
|
|
3
|
-
"version": "2.25.
|
|
3
|
+
"version": "2.25.2",
|
|
4
4
|
"description": "A Progressive React Framework for modern web development.",
|
|
5
5
|
"homepage": "https://modernjs.dev",
|
|
6
6
|
"bugs": "https://github.com/web-infra-dev/modern.js/issues",
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"esbuild": "0.
|
|
48
|
+
"esbuild": "0.17.19",
|
|
49
49
|
"@swc/helpers": "0.5.1",
|
|
50
|
-
"@modern-js/utils": "2.25.
|
|
50
|
+
"@modern-js/utils": "2.25.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/jest": "^29",
|
|
54
54
|
"@types/node": "^14",
|
|
55
55
|
"jest": "^29",
|
|
56
56
|
"typescript": "^5",
|
|
57
|
-
"@scripts/build": "2.25.
|
|
58
|
-
"@scripts/jest-config": "2.25.
|
|
57
|
+
"@scripts/build": "2.25.2",
|
|
58
|
+
"@scripts/jest-config": "2.25.2"
|
|
59
59
|
},
|
|
60
60
|
"sideEffects": false,
|
|
61
61
|
"publishConfig": {
|