@unpackjs/core 1.6.4 → 1.7.1
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/compiled/css-loader/index.js +48 -50
- package/compiled/less-loader/index.js +8 -8
- package/compiled/postcss-loader/index.js +11 -11
- package/compiled/sass-loader/index.js +8 -8
- package/dist/bundler-config/chunkSplit.cjs +3 -3
- package/dist/bundler-config/chunkSplit.d.ts +1 -1
- package/dist/bundler-config/chunkSplit.d.ts.map +1 -1
- package/dist/bundler-config/chunkSplit.js +2 -2
- package/dist/bundler-config/css.cjs +3 -3
- package/dist/bundler-config/css.d.ts +1 -1
- package/dist/bundler-config/css.d.ts.map +1 -1
- package/dist/bundler-config/css.js +2 -2
- package/dist/bundler-config/experimentCss.cjs +3 -3
- package/dist/bundler-config/experimentCss.d.ts +1 -1
- package/dist/bundler-config/experimentCss.d.ts.map +1 -1
- package/dist/bundler-config/experimentCss.js +2 -2
- package/dist/bundler-config/index.cjs +18 -14
- package/dist/bundler-config/index.d.ts.map +1 -1
- package/dist/bundler-config/index.js +22 -18
- package/dist/createUnpack.cjs +6 -3
- package/dist/createUnpack.d.ts.map +1 -1
- package/dist/createUnpack.js +7 -4
- package/dist/index.cjs +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/logger.cjs +5 -3
- package/dist/logger.js +5 -3
- package/dist/plugin-progress/rspack.cjs +11 -2
- package/dist/plugin-progress/rspack.d.ts.map +1 -1
- package/dist/plugin-progress/rspack.js +11 -2
- package/dist/plugin-progress/webpack.cjs +11 -2
- package/dist/plugin-progress/webpack.d.ts.map +1 -1
- package/dist/plugin-progress/webpack.js +11 -2
- package/dist/prebundleDeps.cjs +349 -0
- package/dist/prebundleDeps.d.ts +5 -0
- package/dist/prebundleDeps.d.ts.map +1 -0
- package/dist/prebundleDeps.js +334 -0
- package/dist/run/dev.cjs +22 -39
- package/dist/run/dev.d.ts +1 -1
- package/dist/run/dev.d.ts.map +1 -1
- package/dist/run/dev.js +23 -40
- package/dist/thread-loader/worker.js +1 -1
- package/dist/types/config.d.ts +30 -8
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/logger.cjs +1 -0
- package/dist/types/logger.d.ts +2 -1
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/logger.js +1 -0
- package/dist/utils.cjs +7 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +5 -0
- package/package.json +6 -9
- package/compiled/chokidar/index.d.ts +0 -327
- package/compiled/chokidar/index.js +0 -1773
- package/compiled/chokidar/license +0 -21
- package/compiled/chokidar/package.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimentCss.d.ts","sourceRoot":"","sources":["../../src/bundler-config/experimentCss.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAazE,wBAAgB,
|
|
1
|
+
{"version":3,"file":"experimentCss.d.ts","sourceRoot":"","sources":["../../src/bundler-config/experimentCss.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAazE,wBAAgB,wBAAwB,CAAC,EACvC,MAAM,EACN,YAAY,GACb,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;CAC3B,GAAG,oBAAoB,CA6HvB"}
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
setValueByPath
|
|
28
28
|
} from "../utils.js";
|
|
29
29
|
import { getOutputFilename } from "./helper.js";
|
|
30
|
-
function
|
|
30
|
+
function applyExperimentCssConfig({
|
|
31
31
|
config,
|
|
32
32
|
unpackConfig
|
|
33
33
|
}) {
|
|
@@ -153,5 +153,5 @@ function addExperimentCssSupport({
|
|
|
153
153
|
return config;
|
|
154
154
|
}
|
|
155
155
|
export {
|
|
156
|
-
|
|
156
|
+
applyExperimentCssConfig
|
|
157
157
|
};
|
|
@@ -54,6 +54,7 @@ const BundleAnalyzerPlugin = require("../../compiled/webpack-bundle-analyzer/ind
|
|
|
54
54
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
55
55
|
async function getBundlerConfig(unpackConfig) {
|
|
56
56
|
const isRspack = unpackConfig.bundler === "rspack";
|
|
57
|
+
const HtmlPlugin = isRspack ? import_core.rspack.HtmlRspackPlugin : import_html_webpack_plugin.default;
|
|
57
58
|
const definePlugin = (define) => isRspack ? new import_core.rspack.DefinePlugin(define) : new import_esbuild_loader.EsbuildPlugin({ define, implementation: import_esbuild.default });
|
|
58
59
|
const JS_FILENAME = (0, import_helper.getOutputFilename)({ type: "js", hash: unpackConfig.build?.filenameHash });
|
|
59
60
|
const IgnorePlugin = isRspack ? import_core.rspack.IgnorePlugin : import_webpack2.default.IgnorePlugin;
|
|
@@ -106,13 +107,14 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
106
107
|
},
|
|
107
108
|
plugins: [
|
|
108
109
|
unpackConfig.define && definePlugin(unpackConfig.define),
|
|
109
|
-
!unpackConfig.mpa && new
|
|
110
|
-
template: unpackConfig.html?.template || "",
|
|
111
|
-
|
|
110
|
+
!unpackConfig.mpa && new HtmlPlugin({
|
|
111
|
+
template: unpackConfig.html?.template || (isRspack ? void 0 : ""),
|
|
112
|
+
// @ts-expect-error
|
|
113
|
+
templateContent: unpackConfig.html?.templateContent || (!unpackConfig.html?.template ? import_constants.TEMPLATE_CONTENT : isRspack ? void 0 : false),
|
|
112
114
|
templateParameters: {
|
|
113
115
|
mountId: unpackConfig.html?.mountId,
|
|
114
|
-
title: (0, import_utils.isFunction)(unpackConfig.html?.title) ? unpackConfig.html?.title({ entryName: "index" }) : unpackConfig.html?.title,
|
|
115
|
-
headTag: unpackConfig.html?.headTag,
|
|
116
|
+
title: (0, import_utils.isFunction)(unpackConfig.html?.title) ? unpackConfig.html?.title({ entryName: "index" }) : unpackConfig.html?.title || "",
|
|
117
|
+
headTag: unpackConfig.html?.headTag || "",
|
|
116
118
|
...unpackConfig.html?.templateParameters
|
|
117
119
|
},
|
|
118
120
|
minify: false,
|
|
@@ -124,7 +126,7 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
124
126
|
contextRegExp: /moment$/
|
|
125
127
|
}),
|
|
126
128
|
unpackConfig.build?.copy && new CopyPlugin({ patterns: unpackConfig.build.copy }),
|
|
127
|
-
(0, import_utils.isDev)() && isTs && new ForkTsCheckerWebpackPlugin({
|
|
129
|
+
unpackConfig.build?.typeCheck && (0, import_utils.isDev)() && isTs && new ForkTsCheckerWebpackPlugin({
|
|
128
130
|
typescript: {
|
|
129
131
|
// set 'readonly' to avoid emitting tsbuildinfo, as the generated tsbuildinfo will break fork-ts-checker
|
|
130
132
|
mode: "readonly",
|
|
@@ -137,6 +139,10 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
137
139
|
paths: [unpackConfig.root]
|
|
138
140
|
})
|
|
139
141
|
},
|
|
142
|
+
issue: {
|
|
143
|
+
// ignore types errors from node_modules
|
|
144
|
+
exclude: [({ file = "" }) => import_constants.NODE_MODULES_REGEX.test(file)]
|
|
145
|
+
},
|
|
140
146
|
logger: {
|
|
141
147
|
log(message) {
|
|
142
148
|
if (message.includes("Found")) {
|
|
@@ -148,7 +154,7 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
148
154
|
}
|
|
149
155
|
}
|
|
150
156
|
}),
|
|
151
|
-
|
|
157
|
+
new PluginProgress()
|
|
152
158
|
].filter(Boolean),
|
|
153
159
|
externals: unpackConfig.externals,
|
|
154
160
|
resolve: {
|
|
@@ -160,9 +166,8 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
160
166
|
extensions: [".tsx", ".ts", ".jsx", ".js", ...unpackConfig.resolve?.extensions || []]
|
|
161
167
|
},
|
|
162
168
|
experiments: {
|
|
163
|
-
lazyCompilation: (0, import_utils.isDevServer)(),
|
|
164
|
-
css: false
|
|
165
|
-
...isRspack && (0, import_utils.isDev)() ? { incremental: true } : {}
|
|
169
|
+
lazyCompilation: unpackConfig.dev?.lazyCompilation && (0, import_utils.isDevServer)(),
|
|
170
|
+
css: false
|
|
166
171
|
},
|
|
167
172
|
optimization: {
|
|
168
173
|
moduleIds: (0, import_utils.isDev)() ? "named" : "deterministic",
|
|
@@ -181,19 +186,18 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
181
186
|
};
|
|
182
187
|
if (unpackConfig.experiments?.css)
|
|
183
188
|
import_logger.logger.warn("Experiments.css is not stable yet, please use with caution");
|
|
184
|
-
config = unpackConfig.experiments?.css ? (0, import_experimentCss.
|
|
185
|
-
config = (0, import_chunkSplit.
|
|
189
|
+
config = unpackConfig.experiments?.css ? (0, import_experimentCss.applyExperimentCssConfig)({ config, unpackConfig }) : (0, import_css.applyCssConfig)({ config, unpackConfig });
|
|
190
|
+
config = (0, import_chunkSplit.applyChunkSplitConfig)({ config, unpackConfig });
|
|
186
191
|
for (const plugin of (0, import_plugin.getNormalizedPluginsByHook)("bundlerConfig", unpackConfig.plugins)) {
|
|
187
192
|
config = await plugin.bundlerConfig(config, {
|
|
188
193
|
unpackConfig,
|
|
189
194
|
mergeConfig: import_utils.mergeConfig,
|
|
190
|
-
bundler: import_webpack2.default
|
|
195
|
+
bundler: isRspack ? import_core.rspack : import_webpack2.default
|
|
191
196
|
});
|
|
192
197
|
}
|
|
193
198
|
if (unpackConfig.bundlerConfig) {
|
|
194
199
|
if ((0, import_utils.isFunction)(unpackConfig.bundlerConfig)) {
|
|
195
200
|
config = await unpackConfig.bundlerConfig(config, {
|
|
196
|
-
bundler: unpackConfig.bundler,
|
|
197
201
|
mergeConfig: import_utils.mergeConfig
|
|
198
202
|
});
|
|
199
203
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler-config/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAqBzE,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler-config/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAqBzE,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA8KhG"}
|
|
@@ -18,19 +18,20 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
|
18
18
|
import esbuild from "esbuild";
|
|
19
19
|
import { EsbuildPlugin } from "esbuild-loader";
|
|
20
20
|
import json5 from "json5";
|
|
21
|
-
import { ESBUILD_TARGET, TEMPLATE_CONTENT } from "../constants.js";
|
|
21
|
+
import { ESBUILD_TARGET, NODE_MODULES_REGEX, TEMPLATE_CONTENT } from "../constants.js";
|
|
22
22
|
import { LightningcssMinifyPlugin } from "../lightningcss/minimizer.js";
|
|
23
23
|
import { logger } from "../logger.js";
|
|
24
24
|
import { getNormalizedPluginsByHook } from "../plugin.js";
|
|
25
25
|
import { RspackPluginProgress } from "../plugin-progress/rspack.js";
|
|
26
26
|
import { WebpackPluginProgress } from "../plugin-progress/webpack.js";
|
|
27
27
|
import webpack from "webpack";
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
28
|
+
import { applyChunkSplitConfig } from "./chunkSplit.js";
|
|
29
|
+
import { applyCssConfig } from "./css.js";
|
|
30
|
+
import { applyExperimentCssConfig } from "./experimentCss.js";
|
|
31
31
|
import { getEntry, getOutputFilename } from "./helper.js";
|
|
32
32
|
async function getBundlerConfig(unpackConfig) {
|
|
33
33
|
const isRspack = unpackConfig.bundler === "rspack";
|
|
34
|
+
const HtmlPlugin = isRspack ? rspack.HtmlRspackPlugin : HtmlWebpackPlugin;
|
|
34
35
|
const definePlugin = (define) => isRspack ? new rspack.DefinePlugin(define) : new EsbuildPlugin({ define, implementation: esbuild });
|
|
35
36
|
const JS_FILENAME = getOutputFilename({ type: "js", hash: unpackConfig.build?.filenameHash });
|
|
36
37
|
const IgnorePlugin = isRspack ? rspack.IgnorePlugin : webpack.IgnorePlugin;
|
|
@@ -83,13 +84,14 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
83
84
|
},
|
|
84
85
|
plugins: [
|
|
85
86
|
unpackConfig.define && definePlugin(unpackConfig.define),
|
|
86
|
-
!unpackConfig.mpa && new
|
|
87
|
-
template: unpackConfig.html?.template || "",
|
|
88
|
-
|
|
87
|
+
!unpackConfig.mpa && new HtmlPlugin({
|
|
88
|
+
template: unpackConfig.html?.template || (isRspack ? void 0 : ""),
|
|
89
|
+
// @ts-expect-error
|
|
90
|
+
templateContent: unpackConfig.html?.templateContent || (!unpackConfig.html?.template ? TEMPLATE_CONTENT : isRspack ? void 0 : false),
|
|
89
91
|
templateParameters: {
|
|
90
92
|
mountId: unpackConfig.html?.mountId,
|
|
91
|
-
title: isFunction(unpackConfig.html?.title) ? unpackConfig.html?.title({ entryName: "index" }) : unpackConfig.html?.title,
|
|
92
|
-
headTag: unpackConfig.html?.headTag,
|
|
93
|
+
title: isFunction(unpackConfig.html?.title) ? unpackConfig.html?.title({ entryName: "index" }) : unpackConfig.html?.title || "",
|
|
94
|
+
headTag: unpackConfig.html?.headTag || "",
|
|
93
95
|
...unpackConfig.html?.templateParameters
|
|
94
96
|
},
|
|
95
97
|
minify: false,
|
|
@@ -101,7 +103,7 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
101
103
|
contextRegExp: /moment$/
|
|
102
104
|
}),
|
|
103
105
|
unpackConfig.build?.copy && new CopyPlugin({ patterns: unpackConfig.build.copy }),
|
|
104
|
-
isDev() && isTs && new ForkTsCheckerWebpackPlugin({
|
|
106
|
+
unpackConfig.build?.typeCheck && isDev() && isTs && new ForkTsCheckerWebpackPlugin({
|
|
105
107
|
typescript: {
|
|
106
108
|
// set 'readonly' to avoid emitting tsbuildinfo, as the generated tsbuildinfo will break fork-ts-checker
|
|
107
109
|
mode: "readonly",
|
|
@@ -114,6 +116,10 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
114
116
|
paths: [unpackConfig.root]
|
|
115
117
|
})
|
|
116
118
|
},
|
|
119
|
+
issue: {
|
|
120
|
+
// ignore types errors from node_modules
|
|
121
|
+
exclude: [({ file = "" }) => NODE_MODULES_REGEX.test(file)]
|
|
122
|
+
},
|
|
117
123
|
logger: {
|
|
118
124
|
log(message) {
|
|
119
125
|
if (message.includes("Found")) {
|
|
@@ -125,7 +131,7 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
133
|
}),
|
|
128
|
-
|
|
134
|
+
new PluginProgress()
|
|
129
135
|
].filter(Boolean),
|
|
130
136
|
externals: unpackConfig.externals,
|
|
131
137
|
resolve: {
|
|
@@ -137,9 +143,8 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
137
143
|
extensions: [".tsx", ".ts", ".jsx", ".js", ...unpackConfig.resolve?.extensions || []]
|
|
138
144
|
},
|
|
139
145
|
experiments: {
|
|
140
|
-
lazyCompilation: isDevServer(),
|
|
141
|
-
css: false
|
|
142
|
-
...isRspack && isDev() ? { incremental: true } : {}
|
|
146
|
+
lazyCompilation: unpackConfig.dev?.lazyCompilation && isDevServer(),
|
|
147
|
+
css: false
|
|
143
148
|
},
|
|
144
149
|
optimization: {
|
|
145
150
|
moduleIds: isDev() ? "named" : "deterministic",
|
|
@@ -158,19 +163,18 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
158
163
|
};
|
|
159
164
|
if (unpackConfig.experiments?.css)
|
|
160
165
|
logger.warn("Experiments.css is not stable yet, please use with caution");
|
|
161
|
-
config = unpackConfig.experiments?.css ?
|
|
162
|
-
config =
|
|
166
|
+
config = unpackConfig.experiments?.css ? applyExperimentCssConfig({ config, unpackConfig }) : applyCssConfig({ config, unpackConfig });
|
|
167
|
+
config = applyChunkSplitConfig({ config, unpackConfig });
|
|
163
168
|
for (const plugin of getNormalizedPluginsByHook("bundlerConfig", unpackConfig.plugins)) {
|
|
164
169
|
config = await plugin.bundlerConfig(config, {
|
|
165
170
|
unpackConfig,
|
|
166
171
|
mergeConfig,
|
|
167
|
-
bundler: webpack
|
|
172
|
+
bundler: isRspack ? rspack : webpack
|
|
168
173
|
});
|
|
169
174
|
}
|
|
170
175
|
if (unpackConfig.bundlerConfig) {
|
|
171
176
|
if (isFunction(unpackConfig.bundlerConfig)) {
|
|
172
177
|
config = await unpackConfig.bundlerConfig(config, {
|
|
173
|
-
bundler: unpackConfig.bundler,
|
|
174
178
|
mergeConfig
|
|
175
179
|
});
|
|
176
180
|
} else {
|
package/dist/createUnpack.cjs
CHANGED
|
@@ -45,7 +45,10 @@ function createUnpack() {
|
|
|
45
45
|
sourceMap: (0, import_utils.isProd)() ? false : "cheap-module-source-map",
|
|
46
46
|
parallel: !(0, import_utils.isDevServer)(),
|
|
47
47
|
filenameHash: true,
|
|
48
|
-
|
|
48
|
+
typeCheck: true
|
|
49
|
+
},
|
|
50
|
+
dev: {
|
|
51
|
+
lazyCompilation: true
|
|
49
52
|
},
|
|
50
53
|
server: {
|
|
51
54
|
port: 3e3
|
|
@@ -73,7 +76,7 @@ function createUnpack() {
|
|
|
73
76
|
build: async (unpackConfig) => {
|
|
74
77
|
(0, import_utils.setNodeEnv)("production");
|
|
75
78
|
console.log(
|
|
76
|
-
import_colors.default.rainbow(`unpack v${"1.
|
|
79
|
+
import_colors.default.rainbow(`unpack v${"1.7.1"}`),
|
|
77
80
|
import_colors.default.green("building for production...")
|
|
78
81
|
);
|
|
79
82
|
const config = await resolveConfig(unpackConfig);
|
|
@@ -89,7 +92,7 @@ function createUnpack() {
|
|
|
89
92
|
watch: async (unpackConfig) => {
|
|
90
93
|
(0, import_utils.setNodeEnv)("development");
|
|
91
94
|
console.log(
|
|
92
|
-
import_colors.default.rainbow(`unpack v${"1.
|
|
95
|
+
import_colors.default.rainbow(`unpack v${"1.7.1"}`),
|
|
93
96
|
import_colors.default.green("building for development...")
|
|
94
97
|
);
|
|
95
98
|
const config = await resolveConfig(unpackConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createUnpack.d.ts","sourceRoot":"","sources":["../src/createUnpack.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAGjD,wBAAgB,YAAY;
|
|
1
|
+
{"version":3,"file":"createUnpack.d.ts","sourceRoot":"","sources":["../src/createUnpack.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAGjD,wBAAgB,YAAY;0BAuCI,YAAY;0BASZ,YAAY;0BAOZ,YAAY;EAU3C"}
|
package/dist/createUnpack.js
CHANGED
|
@@ -10,7 +10,7 @@ var __filename = /* @__PURE__ */ getFilename();
|
|
|
10
10
|
import colors from "./colors.js";
|
|
11
11
|
import { getNormalizedPluginsByHook } from "./plugin.js";
|
|
12
12
|
import { bundlerBuild, bundlerDev } from "./run/index.js";
|
|
13
|
-
import {
|
|
13
|
+
import { isDevServer, isProd, mergeConfig, setDevServer, setNodeEnv } from "./utils.js";
|
|
14
14
|
function createUnpack() {
|
|
15
15
|
const resolveConfig = async (unpackConfig) => {
|
|
16
16
|
const defaultConfig = {
|
|
@@ -22,7 +22,10 @@ function createUnpack() {
|
|
|
22
22
|
sourceMap: isProd() ? false : "cheap-module-source-map",
|
|
23
23
|
parallel: !isDevServer(),
|
|
24
24
|
filenameHash: true,
|
|
25
|
-
|
|
25
|
+
typeCheck: true
|
|
26
|
+
},
|
|
27
|
+
dev: {
|
|
28
|
+
lazyCompilation: true
|
|
26
29
|
},
|
|
27
30
|
server: {
|
|
28
31
|
port: 3e3
|
|
@@ -50,7 +53,7 @@ function createUnpack() {
|
|
|
50
53
|
build: async (unpackConfig) => {
|
|
51
54
|
setNodeEnv("production");
|
|
52
55
|
console.log(
|
|
53
|
-
colors.rainbow(`unpack v${"1.
|
|
56
|
+
colors.rainbow(`unpack v${"1.7.1"}`),
|
|
54
57
|
colors.green("building for production...")
|
|
55
58
|
);
|
|
56
59
|
const config = await resolveConfig(unpackConfig);
|
|
@@ -66,7 +69,7 @@ function createUnpack() {
|
|
|
66
69
|
watch: async (unpackConfig) => {
|
|
67
70
|
setNodeEnv("development");
|
|
68
71
|
console.log(
|
|
69
|
-
colors.rainbow(`unpack v${"1.
|
|
72
|
+
colors.rainbow(`unpack v${"1.7.1"}`),
|
|
70
73
|
colors.green("building for development...")
|
|
71
74
|
);
|
|
72
75
|
const config = await resolveConfig(unpackConfig);
|
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var src_exports = {};
|
|
30
30
|
__export(src_exports, {
|
|
31
|
+
HtmlWebpackPlugin: () => import_html_webpack_plugin.default,
|
|
31
32
|
colors: () => import_colors.default
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -38,8 +39,10 @@ __reExport(src_exports, require("./constants.cjs"), module.exports);
|
|
|
38
39
|
__reExport(src_exports, require("./createUnpack.cjs"), module.exports);
|
|
39
40
|
__reExport(src_exports, require("./config.cjs"), module.exports);
|
|
40
41
|
var import_colors = __toESM(require("./colors.cjs"));
|
|
42
|
+
var import_html_webpack_plugin = __toESM(require("html-webpack-plugin"));
|
|
41
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
44
|
0 && (module.exports = {
|
|
45
|
+
HtmlWebpackPlugin,
|
|
43
46
|
colors,
|
|
44
47
|
...require("./logger.cjs"),
|
|
45
48
|
...require("./types/index.cjs"),
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,8 @@ export * from "./constants.js";
|
|
|
14
14
|
export * from "./createUnpack.js";
|
|
15
15
|
export * from "./config.js";
|
|
16
16
|
import { default as default2 } from "./colors.js";
|
|
17
|
+
import { default as default3 } from "html-webpack-plugin";
|
|
17
18
|
export {
|
|
19
|
+
default3 as HtmlWebpackPlugin,
|
|
18
20
|
default2 as colors
|
|
19
21
|
};
|
package/dist/logger.cjs
CHANGED
|
@@ -39,7 +39,8 @@ const prefixes = {
|
|
|
39
39
|
warn: "⚠",
|
|
40
40
|
info: "ℹ",
|
|
41
41
|
ready: "✓",
|
|
42
|
-
event: "»"
|
|
42
|
+
event: "»",
|
|
43
|
+
debug: "⚙"
|
|
43
44
|
};
|
|
44
45
|
const createLogger = () => {
|
|
45
46
|
const log = (type, message, ...args) => {
|
|
@@ -70,9 +71,10 @@ ${import_colors.default.dim(rest.join("\n"))}`;
|
|
|
70
71
|
text = message;
|
|
71
72
|
break;
|
|
72
73
|
}
|
|
74
|
+
if (type === "debug" && process.env.DEBUG !== "unpack")
|
|
75
|
+
return;
|
|
73
76
|
console.log(`${label} ${text}`, ...args);
|
|
74
77
|
};
|
|
75
|
-
const logTypes = ["error", "warn", "info", "ready", "event", "wait"];
|
|
76
78
|
const logger2 = {
|
|
77
79
|
clear: () => {
|
|
78
80
|
const repeatCount = process.stdout.rows - 2;
|
|
@@ -89,7 +91,7 @@ ${import_colors.default.dim(rest.join("\n"))}`;
|
|
|
89
91
|
console.log(msg);
|
|
90
92
|
}
|
|
91
93
|
};
|
|
92
|
-
|
|
94
|
+
Object.keys(prefixes).forEach((type) => {
|
|
93
95
|
logger2[type] = (message, ...args) => {
|
|
94
96
|
log(type, message, ...args);
|
|
95
97
|
};
|
package/dist/logger.js
CHANGED
|
@@ -16,7 +16,8 @@ const prefixes = {
|
|
|
16
16
|
warn: "⚠",
|
|
17
17
|
info: "ℹ",
|
|
18
18
|
ready: "✓",
|
|
19
|
-
event: "»"
|
|
19
|
+
event: "»",
|
|
20
|
+
debug: "⚙"
|
|
20
21
|
};
|
|
21
22
|
const createLogger = () => {
|
|
22
23
|
const log = (type, message, ...args) => {
|
|
@@ -47,9 +48,10 @@ ${colors.dim(rest.join("\n"))}`;
|
|
|
47
48
|
text = message;
|
|
48
49
|
break;
|
|
49
50
|
}
|
|
51
|
+
if (type === "debug" && process.env.DEBUG !== "unpack")
|
|
52
|
+
return;
|
|
50
53
|
console.log(`${label} ${text}`, ...args);
|
|
51
54
|
};
|
|
52
|
-
const logTypes = ["error", "warn", "info", "ready", "event", "wait"];
|
|
53
55
|
const logger2 = {
|
|
54
56
|
clear: () => {
|
|
55
57
|
const repeatCount = process.stdout.rows - 2;
|
|
@@ -66,7 +68,7 @@ ${colors.dim(rest.join("\n"))}`;
|
|
|
66
68
|
console.log(msg);
|
|
67
69
|
}
|
|
68
70
|
};
|
|
69
|
-
|
|
71
|
+
Object.keys(prefixes).forEach((type) => {
|
|
70
72
|
logger2[type] = (message, ...args) => {
|
|
71
73
|
log(type, message, ...args);
|
|
72
74
|
};
|
|
@@ -30,6 +30,7 @@ __export(rspack_exports, {
|
|
|
30
30
|
RspackPluginProgress: () => RspackPluginProgress
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(rspack_exports);
|
|
33
|
+
var import_node_path = __toESM(require("node:path"));
|
|
33
34
|
var import_core = require("@rspack/core");
|
|
34
35
|
var import_colors = __toESM(require("../colors.cjs"));
|
|
35
36
|
var import_logger = require("../logger.cjs");
|
|
@@ -58,12 +59,20 @@ class RspackPluginProgress extends import_core.rspack.ProgressPlugin {
|
|
|
58
59
|
const hrtime = process.hrtime(this.startTime);
|
|
59
60
|
const compileTime = hrtime[0] + hrtime[1] / 1e9;
|
|
60
61
|
this.startTime = void 0;
|
|
62
|
+
const root = compiler.options.context;
|
|
61
63
|
if (!stats.hasErrors()) {
|
|
62
64
|
if ((0, import_utils.isProd)()) {
|
|
63
|
-
await (0, import_reporter.printFileSize)({ root
|
|
65
|
+
await (0, import_reporter.printFileSize)({ root, stats });
|
|
64
66
|
console.log(import_colors.default.green(`✓ built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`));
|
|
65
67
|
} else {
|
|
66
|
-
|
|
68
|
+
const modules = stats.compilation.modules;
|
|
69
|
+
modules.forEach((module2) => {
|
|
70
|
+
const { resource } = module2;
|
|
71
|
+
if (resource?.includes(import_node_path.default.resolve(root, "node_modules"))) {
|
|
72
|
+
import_logger.logger.debug(import_node_path.default.relative(root, resource));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
import_logger.logger.ready(`built in ${(0, import_utils.prettyTime)(compileTime)} (${modules.size} modules)`);
|
|
67
76
|
}
|
|
68
77
|
}
|
|
69
78
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../../src/plugin-progress/rspack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../../src/plugin-progress/rspack.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAK7C,qBAAa,oBAAqB,SAAQ,MAAM,CAAC,cAAc;IAC7D,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY;IACxC,WAAW,cAAoB;;IAO/B,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CA8BhC"}
|
|
@@ -7,6 +7,7 @@ var getFilename = () => fileURLToPath(import.meta.url);
|
|
|
7
7
|
var getDirname = () => path.dirname(getFilename());
|
|
8
8
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
9
9
|
var __filename = /* @__PURE__ */ getFilename();
|
|
10
|
+
import path2 from "node:path";
|
|
10
11
|
import { rspack } from "@rspack/core";
|
|
11
12
|
import colors from "../colors.js";
|
|
12
13
|
import { logger } from "../logger.js";
|
|
@@ -35,12 +36,20 @@ class RspackPluginProgress extends rspack.ProgressPlugin {
|
|
|
35
36
|
const hrtime = process.hrtime(this.startTime);
|
|
36
37
|
const compileTime = hrtime[0] + hrtime[1] / 1e9;
|
|
37
38
|
this.startTime = void 0;
|
|
39
|
+
const root = compiler.options.context;
|
|
38
40
|
if (!stats.hasErrors()) {
|
|
39
41
|
if (isProd()) {
|
|
40
|
-
await printFileSize({ root
|
|
42
|
+
await printFileSize({ root, stats });
|
|
41
43
|
console.log(colors.green(`✓ built in ${colors.bold(prettyTime(compileTime))}`));
|
|
42
44
|
} else {
|
|
43
|
-
|
|
45
|
+
const modules = stats.compilation.modules;
|
|
46
|
+
modules.forEach((module) => {
|
|
47
|
+
const { resource } = module;
|
|
48
|
+
if (resource?.includes(path2.resolve(root, "node_modules"))) {
|
|
49
|
+
logger.debug(path2.relative(root, resource));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
logger.ready(`built in ${prettyTime(compileTime)} (${modules.size} modules)`);
|
|
44
53
|
}
|
|
45
54
|
}
|
|
46
55
|
});
|
|
@@ -30,6 +30,7 @@ __export(webpack_exports, {
|
|
|
30
30
|
WebpackPluginProgress: () => WebpackPluginProgress
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(webpack_exports);
|
|
33
|
+
var import_node_path = __toESM(require("node:path"));
|
|
33
34
|
var import_colors = __toESM(require("../colors.cjs"));
|
|
34
35
|
var import_logger = require("../logger.cjs");
|
|
35
36
|
var import_progressBar = require("../progressBar.cjs");
|
|
@@ -68,12 +69,20 @@ class WebpackPluginProgress extends import_webpack.default.ProgressPlugin {
|
|
|
68
69
|
const hrtime = process.hrtime(this.startTime);
|
|
69
70
|
const compileTime = hrtime[0] + hrtime[1] / 1e9;
|
|
70
71
|
this.startTime = void 0;
|
|
72
|
+
const root = compiler.options.context;
|
|
71
73
|
if (!stats.hasErrors()) {
|
|
72
74
|
if ((0, import_utils.isProd)()) {
|
|
73
|
-
await (0, import_reporter.printFileSize)({ root
|
|
75
|
+
await (0, import_reporter.printFileSize)({ root, stats });
|
|
74
76
|
console.log(import_colors.default.green(`✓ built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`));
|
|
75
77
|
} else {
|
|
76
|
-
|
|
78
|
+
const modules = stats.compilation.modules;
|
|
79
|
+
modules.forEach((module2) => {
|
|
80
|
+
const { resource } = module2;
|
|
81
|
+
if (resource?.includes(import_node_path.default.resolve(root, "node_modules"))) {
|
|
82
|
+
import_logger.logger.debug(import_node_path.default.relative(root, resource));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
import_logger.logger.ready(`built in ${(0, import_utils.prettyTime)(compileTime)} (${modules.size} modules)`);
|
|
77
86
|
}
|
|
78
87
|
}
|
|
79
88
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/plugin-progress/webpack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/plugin-progress/webpack.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7C,OAAO,OAAO,MAAM,SAAS,CAAA;AAG7B,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,cAAc;IAC/D,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY;IACxC,WAAW,cAAoB;;IAiB/B,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI;CAgCxC"}
|
|
@@ -7,6 +7,7 @@ var getFilename = () => fileURLToPath(import.meta.url);
|
|
|
7
7
|
var getDirname = () => path.dirname(getFilename());
|
|
8
8
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
9
9
|
var __filename = /* @__PURE__ */ getFilename();
|
|
10
|
+
import path2 from "node:path";
|
|
10
11
|
import colors from "../colors.js";
|
|
11
12
|
import { logger } from "../logger.js";
|
|
12
13
|
import { ProgressBar } from "../progressBar.js";
|
|
@@ -45,12 +46,20 @@ class WebpackPluginProgress extends webpack.ProgressPlugin {
|
|
|
45
46
|
const hrtime = process.hrtime(this.startTime);
|
|
46
47
|
const compileTime = hrtime[0] + hrtime[1] / 1e9;
|
|
47
48
|
this.startTime = void 0;
|
|
49
|
+
const root = compiler.options.context;
|
|
48
50
|
if (!stats.hasErrors()) {
|
|
49
51
|
if (isProd()) {
|
|
50
|
-
await printFileSize({ root
|
|
52
|
+
await printFileSize({ root, stats });
|
|
51
53
|
console.log(colors.green(`✓ built in ${colors.bold(prettyTime(compileTime))}`));
|
|
52
54
|
} else {
|
|
53
|
-
|
|
55
|
+
const modules = stats.compilation.modules;
|
|
56
|
+
modules.forEach((module) => {
|
|
57
|
+
const { resource } = module;
|
|
58
|
+
if (resource?.includes(path2.resolve(root, "node_modules"))) {
|
|
59
|
+
logger.debug(path2.relative(root, resource));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
logger.ready(`built in ${prettyTime(compileTime)} (${modules.size} modules)`);
|
|
54
63
|
}
|
|
55
64
|
}
|
|
56
65
|
});
|