@unpackjs/core 1.7.5 → 1.7.7
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 +180 -178
- package/compiled/less-loader/index.js +11 -11
- package/compiled/line-diff/index.js +4 -4
- package/compiled/line-diff/license +1 -1
- package/compiled/line-diff/package.json +1 -1
- package/compiled/portfinder/index.js +37 -37
- package/compiled/postcss-loader/index.js +261 -256
- package/compiled/sass-loader/index.js +24 -20
- package/compiled/sass-loader/package.json +1 -1
- package/compiled/semver/index.js +188 -170
- package/compiled/semver/package.json +1 -1
- package/compiled/style-loader/index.js +13 -13
- package/compiled/webpack-bundle-analyzer/index.js +198 -198
- package/compiled/webpack-merge/index.js +29 -29
- package/dist/bundler-config/chunkSplit.cjs +169 -156
- package/dist/bundler-config/chunkSplit.js +125 -134
- package/dist/bundler-config/css.cjs +181 -158
- package/dist/bundler-config/css.js +139 -151
- package/dist/bundler-config/experimentCss.cjs +203 -159
- package/dist/bundler-config/experimentCss.js +162 -152
- package/dist/bundler-config/helper.cjs +82 -78
- package/dist/bundler-config/helper.js +36 -55
- package/dist/bundler-config/index.cjs +260 -209
- package/dist/bundler-config/index.d.ts.map +1 -1
- package/dist/bundler-config/index.js +209 -182
- package/dist/bundler-config/jsMinify.cjs +114 -95
- package/dist/bundler-config/jsMinify.js +70 -73
- package/dist/colors.cjs +83 -56
- package/dist/colors.js +38 -37
- package/dist/config.cjs +107 -93
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +64 -70
- package/dist/constants.cjs +65 -62
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +22 -38
- package/dist/createUnpack.cjs +111 -104
- package/dist/createUnpack.js +67 -82
- package/dist/global.cjs +36 -0
- package/dist/global.d.ts +2 -0
- package/dist/global.d.ts.map +1 -0
- package/dist/global.js +4 -0
- package/dist/index.cjs +174 -51
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -15
- package/dist/lightningcss/loader.cjs +56 -53
- package/dist/lightningcss/loader.d.ts.map +1 -1
- package/dist/lightningcss/loader.js +25 -34
- package/dist/lightningcss/minimizer.cjs +90 -109
- package/dist/lightningcss/minimizer.d.ts.map +1 -1
- package/dist/lightningcss/minimizer.js +59 -87
- package/dist/logger.cjs +104 -98
- package/dist/logger.js +59 -76
- package/dist/openBrowser.cjs +104 -81
- package/dist/openBrowser.js +56 -52
- package/dist/plugin-progress/rspack.cjs +104 -79
- package/dist/plugin-progress/rspack.js +59 -57
- package/dist/plugin-progress/webpack.cjs +111 -89
- package/dist/plugin-progress/webpack.js +65 -67
- package/dist/plugin.cjs +38 -29
- package/dist/plugin.js +8 -17
- package/dist/prebundleDeps.cjs +327 -337
- package/dist/prebundleDeps.d.ts.map +1 -1
- package/dist/prebundleDeps.js +278 -324
- package/dist/progressBar.cjs +82 -65
- package/dist/progressBar.js +38 -43
- package/dist/reporter.cjs +149 -124
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +102 -102
- package/dist/run/build.cjs +68 -67
- package/dist/run/build.js +24 -45
- package/dist/run/dev.cjs +96 -83
- package/dist/run/dev.d.ts.map +1 -1
- package/dist/run/dev.js +50 -61
- package/dist/run/index.cjs +74 -21
- package/dist/run/index.js +2 -9
- package/dist/typed-css-modules/loader.cjs +179 -188
- package/dist/typed-css-modules/loader.js +118 -151
- package/dist/typed-css-modules/plugin.cjs +113 -88
- package/dist/typed-css-modules/plugin.js +68 -66
- package/dist/typed-css-modules/utils.cjs +43 -42
- package/dist/typed-css-modules/utils.js +13 -30
- package/dist/types/chunkSplit.cjs +19 -15
- package/dist/types/chunkSplit.d.ts +2 -10
- package/dist/types/chunkSplit.d.ts.map +1 -1
- package/dist/types/chunkSplit.js +2 -9
- package/dist/types/config.cjs +19 -15
- package/dist/types/config.js +2 -9
- package/dist/types/index.cjs +101 -27
- package/dist/types/index.js +2 -9
- package/dist/types/lightningcss.cjs +19 -15
- package/dist/types/lightningcss.js +2 -9
- package/dist/types/logger.cjs +43 -34
- package/dist/types/logger.js +13 -22
- package/dist/types/plugin.cjs +19 -15
- package/dist/types/plugin.js +2 -9
- package/dist/utils.cjs +280 -304
- package/dist/utils.js +195 -241
- package/dist/watchFiles.cjs +73 -0
- package/dist/watchFiles.d.ts +3 -0
- package/dist/watchFiles.d.ts.map +1 -0
- package/dist/watchFiles.js +27 -0
- package/package.json +18 -21
- package/compiled/commander/index.d.ts +0 -1047
- package/compiled/commander/index.js +0 -2428
- package/compiled/commander/license +0 -22
- package/compiled/commander/package.json +0 -1
- package/dist/bundleRequire.cjs +0 -200
- package/dist/bundleRequire.d.ts +0 -5
- package/dist/bundleRequire.d.ts.map +0 -1
- package/dist/bundleRequire.js +0 -173
- package/dist/lightningcss/cache.cjs +0 -36
- package/dist/lightningcss/cache.d.ts +0 -2
- package/dist/lightningcss/cache.d.ts.map +0 -1
- package/dist/lightningcss/cache.js +0 -22
package/dist/reporter.js
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var __filename = /* @__PURE__ */ getFilename();
|
|
10
|
-
import fs from "node:fs";
|
|
11
|
-
import path2 from "node:path";
|
|
12
|
-
import { promisify } from "node:util";
|
|
13
|
-
import zlib from "node:zlib";
|
|
14
|
-
import colors from "./colors.js";
|
|
15
|
-
const chunkGroups = [
|
|
16
|
-
{ type: "HTML", color: "green", chunks: [] },
|
|
17
|
-
{ type: "CSS", color: "magenta", chunks: [] },
|
|
18
|
-
{ type: "JS", color: "cyan", chunks: [] }
|
|
19
|
-
];
|
|
20
|
-
const chunkGroupMap = chunkGroups.reduce(
|
|
21
|
-
(acc, cur) => {
|
|
22
|
-
acc[cur.type] = cur;
|
|
23
|
-
return acc;
|
|
24
|
-
},
|
|
25
|
-
{}
|
|
26
|
-
);
|
|
1
|
+
import __rslib_shim_module__ from 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_zlib_a5bb16fc__ from "node:zlib";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__ from "./colors.js";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
|
|
27
9
|
const chunkSizeLimit = 500;
|
|
28
|
-
const gzip = promisify(
|
|
29
|
-
const numberFormatter = new Intl.NumberFormat(
|
|
30
|
-
|
|
31
|
-
|
|
10
|
+
const gzip = (0, __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__.promisify)(__WEBPACK_EXTERNAL_MODULE_node_zlib_a5bb16fc__["default"].gzip);
|
|
11
|
+
const numberFormatter = new Intl.NumberFormat('en', {
|
|
12
|
+
maximumFractionDigits: 2,
|
|
13
|
+
minimumFractionDigits: 2
|
|
32
14
|
});
|
|
33
|
-
const displaySize = (bytes)
|
|
34
|
-
return `${numberFormatter.format(bytes / 1e3)} kB`;
|
|
35
|
-
};
|
|
15
|
+
const displaySize = (bytes)=>`${numberFormatter.format(bytes / 1000)} kB`;
|
|
36
16
|
async function getCompressedSize(content) {
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
const data = await gzip(content);
|
|
18
|
+
return data.length;
|
|
39
19
|
}
|
|
40
20
|
async function printFileSize({ root, stats }) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
switch (ext) {
|
|
76
|
-
case ".html":
|
|
77
|
-
chunkGroupMap.HTML.chunks.push(chunk);
|
|
78
|
-
break;
|
|
79
|
-
case ".css":
|
|
80
|
-
chunkGroupMap.CSS.chunks.push(chunk);
|
|
81
|
-
break;
|
|
82
|
-
case ".js":
|
|
83
|
-
chunkGroupMap.JS.chunks.push(chunk);
|
|
84
|
-
break;
|
|
85
|
-
default:
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
);
|
|
90
|
-
const sizePad = displaySize(biggestSize).length;
|
|
91
|
-
const compressPad = displaySize(biggestCompressSize).length;
|
|
92
|
-
chunkGroups.forEach((group) => {
|
|
93
|
-
group.chunks.sort((a, b) => a.size - b.size).forEach((chunk) => {
|
|
94
|
-
const isLarge = group.type === "JS" && chunk.size / 1e3 > chunkSizeLimit;
|
|
95
|
-
const sizeColor = isLarge ? "yellow" : "dim";
|
|
96
|
-
const relativeOutDir = path2.dirname(chunk.path) + "/";
|
|
97
|
-
let log = colors.dim(relativeOutDir);
|
|
98
|
-
log += colors[group.color](chunk.name.padEnd(longest + 2 - relativeOutDir.length));
|
|
99
|
-
log += colors[sizeColor](colors.bold(displaySize(chunk.size).padStart(sizePad)));
|
|
100
|
-
if (chunk.compressedSize) {
|
|
101
|
-
log += colors.dim(` │ gzip: ${displaySize(chunk.compressedSize).padStart(compressPad)}`);
|
|
102
|
-
}
|
|
103
|
-
console.log(log);
|
|
21
|
+
const chunkGroups = [
|
|
22
|
+
{
|
|
23
|
+
type: 'HTML',
|
|
24
|
+
color: 'green',
|
|
25
|
+
chunks: []
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'CSS',
|
|
29
|
+
color: 'magenta',
|
|
30
|
+
chunks: []
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'JS',
|
|
34
|
+
color: 'cyan',
|
|
35
|
+
chunks: []
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
const chunkGroupMap = chunkGroups.reduce((acc, cur)=>{
|
|
39
|
+
acc[cur.type] = cur;
|
|
40
|
+
return acc;
|
|
41
|
+
}, {});
|
|
42
|
+
let compressedCount = 0;
|
|
43
|
+
(0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.logUpdate)('computing gzip size (0)...');
|
|
44
|
+
const distPath = stats.compilation.outputOptions.path;
|
|
45
|
+
const distFolder = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, distPath);
|
|
46
|
+
const origin = stats.toJson({
|
|
47
|
+
all: false,
|
|
48
|
+
assets: true,
|
|
49
|
+
cachedAssets: true,
|
|
50
|
+
groupAssetsByInfo: false,
|
|
51
|
+
groupAssetsByPath: false,
|
|
52
|
+
groupAssetsByChunk: false,
|
|
53
|
+
groupAssetsByExtension: false,
|
|
54
|
+
groupAssetsByEmitStatus: false
|
|
104
55
|
});
|
|
105
|
-
|
|
56
|
+
let longest = 0;
|
|
57
|
+
let totalSize = 0;
|
|
58
|
+
let totalCompressedSize = 0;
|
|
59
|
+
await Promise.all(origin.assets.map(async (asset)=>{
|
|
60
|
+
const content = await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].promises.readFile(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(distPath, asset.name));
|
|
61
|
+
const size = content.length;
|
|
62
|
+
const compressedSize = await getCompressedSize(content);
|
|
63
|
+
totalSize += size;
|
|
64
|
+
totalCompressedSize += compressedSize;
|
|
65
|
+
compressedCount++;
|
|
66
|
+
(0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.logUpdate)(`computing gzip size (${compressedCount})...`);
|
|
67
|
+
if (compressedCount === origin.assets.length) console.log();
|
|
68
|
+
const chunk = {
|
|
69
|
+
name: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(asset.name),
|
|
70
|
+
path: `${distFolder}/${asset.name}`,
|
|
71
|
+
size,
|
|
72
|
+
compressedSize
|
|
73
|
+
};
|
|
74
|
+
if (chunk.path.length > longest) longest = chunk.path.length;
|
|
75
|
+
const ext = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(asset.name);
|
|
76
|
+
switch(ext){
|
|
77
|
+
case '.html':
|
|
78
|
+
chunkGroupMap.HTML.chunks.push(chunk);
|
|
79
|
+
break;
|
|
80
|
+
case '.css':
|
|
81
|
+
chunkGroupMap.CSS.chunks.push(chunk);
|
|
82
|
+
break;
|
|
83
|
+
case '.js':
|
|
84
|
+
chunkGroupMap.JS.chunks.push(chunk);
|
|
85
|
+
break;
|
|
86
|
+
default:
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
const sizePad = displaySize(totalSize).length;
|
|
91
|
+
const compressPad = displaySize(totalCompressedSize).length;
|
|
92
|
+
chunkGroups.forEach((group)=>{
|
|
93
|
+
group.chunks.sort((a, b)=>a.size - b.size).forEach((chunk)=>{
|
|
94
|
+
const isLarge = 'JS' === group.type && chunk.size / 1000 > chunkSizeLimit;
|
|
95
|
+
const sizeColor = isLarge ? 'yellow' : 'dim';
|
|
96
|
+
const relativeOutDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(chunk.path) + '/';
|
|
97
|
+
let log = __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].dim(relativeOutDir);
|
|
98
|
+
log += __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"][group.color](chunk.name.padEnd(longest + 2 - relativeOutDir.length));
|
|
99
|
+
log += __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"][sizeColor](__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].bold(displaySize(chunk.size).padStart(sizePad)));
|
|
100
|
+
if (chunk.compressedSize) log += __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].dim(` │ gzip: ${displaySize(chunk.compressedSize).padStart(compressPad)}`);
|
|
101
|
+
console.log(log);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
let log = __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].blue(__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].bold('Total'.padEnd(longest + 2)));
|
|
105
|
+
log += __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].blue(__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].bold(displaySize(totalSize)));
|
|
106
|
+
log += __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].dim(` │ gzip: ${displaySize(totalCompressedSize)}`);
|
|
107
|
+
console.log(log);
|
|
106
108
|
}
|
|
107
|
-
export {
|
|
108
|
-
printFileSize
|
|
109
|
-
};
|
|
109
|
+
export { printFileSize };
|
package/dist/run/build.cjs
CHANGED
|
@@ -1,71 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = function(module) {
|
|
5
|
+
var getter = module && module.__esModule ? function() {
|
|
6
|
+
return module['default'];
|
|
7
|
+
} : function() {
|
|
8
|
+
return module;
|
|
9
|
+
};
|
|
10
|
+
__webpack_require__.d(getter, {
|
|
11
|
+
a: getter
|
|
12
|
+
});
|
|
13
|
+
return getter;
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
18
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: definition[key]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = function(obj, prop) {
|
|
26
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.r = function(exports1) {
|
|
31
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
32
|
+
value: 'Module'
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
var __webpack_exports__ = {};
|
|
40
|
+
__webpack_require__.r(__webpack_exports__);
|
|
41
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
42
|
+
bundlerBuild: ()=>bundlerBuild
|
|
31
43
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
|
|
44
|
+
const core_namespaceObject = require("@rspack/core");
|
|
45
|
+
const external_utils_cjs_namespaceObject = require("../utils.cjs");
|
|
46
|
+
const external_webpack_namespaceObject = require("webpack");
|
|
47
|
+
var external_webpack_default = /*#__PURE__*/ __webpack_require__.n(external_webpack_namespaceObject);
|
|
48
|
+
const index_cjs_namespaceObject = require("../bundler-config/index.cjs");
|
|
37
49
|
async function bundlerBuild(unpackConfig) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
if (!(0, import_utils.isWatch)()) {
|
|
58
|
-
compiler.close(() => {
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
if ((0, import_utils.isWatch)()) {
|
|
63
|
-
compiler.watch({}, handler);
|
|
64
|
-
} else {
|
|
65
|
-
compiler.run(handler);
|
|
66
|
-
}
|
|
50
|
+
const bundler = 'rspack' === unpackConfig.bundler ? core_namespaceObject.rspack : external_webpack_default();
|
|
51
|
+
const config = await (0, index_cjs_namespaceObject.getBundlerConfig)(unpackConfig);
|
|
52
|
+
const compiler = bundler(config);
|
|
53
|
+
const handler = (err, stats)=>{
|
|
54
|
+
if (err) {
|
|
55
|
+
console.error(err.stack || err);
|
|
56
|
+
if (err.details) console.error(err.details);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (null == stats ? void 0 : stats.hasErrors()) console.log(stats.toString({
|
|
60
|
+
colors: true,
|
|
61
|
+
preset: 'errors-only'
|
|
62
|
+
}));
|
|
63
|
+
if (!(0, external_utils_cjs_namespaceObject.isWatch)()) compiler.close(()=>{});
|
|
64
|
+
};
|
|
65
|
+
if ((0, external_utils_cjs_namespaceObject.isWatch)()) compiler.watch({}, handler);
|
|
66
|
+
else compiler.run(handler);
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
var __webpack_export_target__ = exports;
|
|
69
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
70
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
71
|
+
value: true
|
|
71
72
|
});
|
package/dist/run/build.js
CHANGED
|
@@ -1,47 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
var getDirname = () => path.dirname(getFilename());
|
|
8
|
-
var __dirname = /* @__PURE__ */ getDirname();
|
|
9
|
-
var __filename = /* @__PURE__ */ getFilename();
|
|
10
|
-
import { rspack } from "@rspack/core";
|
|
11
|
-
import { isWatch } from "../utils.js";
|
|
12
|
-
import webpack from "webpack";
|
|
13
|
-
import { getBundlerConfig } from "../bundler-config/index.js";
|
|
1
|
+
import __rslib_shim_module__ from 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__ from "@rspack/core";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__ from "../utils.js";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_webpack__ from "webpack";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__bundler_config_index_js_e76188c2__ from "../bundler-config/index.js";
|
|
14
7
|
async function bundlerBuild(unpackConfig) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
if (!isWatch()) {
|
|
35
|
-
compiler.close(() => {
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
if (isWatch()) {
|
|
40
|
-
compiler.watch({}, handler);
|
|
41
|
-
} else {
|
|
42
|
-
compiler.run(handler);
|
|
43
|
-
}
|
|
8
|
+
const bundler = 'rspack' === unpackConfig.bundler ? __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack : __WEBPACK_EXTERNAL_MODULE_webpack__["default"];
|
|
9
|
+
const config = await (0, __WEBPACK_EXTERNAL_MODULE__bundler_config_index_js_e76188c2__.getBundlerConfig)(unpackConfig);
|
|
10
|
+
const compiler = bundler(config);
|
|
11
|
+
const handler = (err, stats)=>{
|
|
12
|
+
if (err) {
|
|
13
|
+
console.error(err.stack || err);
|
|
14
|
+
if (err.details) console.error(err.details);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (null == stats ? void 0 : stats.hasErrors()) console.log(stats.toString({
|
|
18
|
+
colors: true,
|
|
19
|
+
preset: 'errors-only'
|
|
20
|
+
}));
|
|
21
|
+
if (!(0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.isWatch)()) compiler.close(()=>{});
|
|
22
|
+
};
|
|
23
|
+
if ((0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.isWatch)()) compiler.watch({}, handler);
|
|
24
|
+
else compiler.run(handler);
|
|
44
25
|
}
|
|
45
|
-
export {
|
|
46
|
-
bundlerBuild
|
|
47
|
-
};
|
|
26
|
+
export { bundlerBuild };
|
package/dist/run/dev.cjs
CHANGED
|
@@ -1,90 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = function(module) {
|
|
5
|
+
var getter = module && module.__esModule ? function() {
|
|
6
|
+
return module['default'];
|
|
7
|
+
} : function() {
|
|
8
|
+
return module;
|
|
9
|
+
};
|
|
10
|
+
__webpack_require__.d(getter, {
|
|
11
|
+
a: getter
|
|
12
|
+
});
|
|
13
|
+
return getter;
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
18
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: definition[key]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = function(obj, prop) {
|
|
26
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.r = function(exports1) {
|
|
31
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
32
|
+
value: 'Module'
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
var __webpack_exports__ = {};
|
|
40
|
+
__webpack_require__.r(__webpack_exports__);
|
|
41
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
42
|
+
bundlerDev: ()=>bundlerDev
|
|
31
43
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var
|
|
44
|
+
const core_namespaceObject = require("@rspack/core");
|
|
45
|
+
const external_colors_cjs_namespaceObject = require("../colors.cjs");
|
|
46
|
+
var external_colors_cjs_default = /*#__PURE__*/ __webpack_require__.n(external_colors_cjs_namespaceObject);
|
|
47
|
+
const external_global_cjs_namespaceObject = require("../global.cjs");
|
|
48
|
+
const external_logger_cjs_namespaceObject = require("../logger.cjs");
|
|
49
|
+
const external_openBrowser_cjs_namespaceObject = require("../openBrowser.cjs");
|
|
50
|
+
const external_prebundleDeps_cjs_namespaceObject = require("../prebundleDeps.cjs");
|
|
51
|
+
const external_utils_cjs_namespaceObject = require("../utils.cjs");
|
|
52
|
+
const external_webpack_namespaceObject = require("webpack");
|
|
53
|
+
var external_webpack_default = /*#__PURE__*/ __webpack_require__.n(external_webpack_namespaceObject);
|
|
54
|
+
const external_webpack_dev_server_namespaceObject = require("webpack-dev-server");
|
|
55
|
+
var external_webpack_dev_server_default = /*#__PURE__*/ __webpack_require__.n(external_webpack_dev_server_namespaceObject);
|
|
56
|
+
const index_cjs_namespaceObject = require("../bundler-config/index.cjs");
|
|
42
57
|
async function bundlerDev(originalUnpackConfig) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
unpackConfig = await (0,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
var _unpackConfig_dev, _unpackConfig_server, _unpackConfig_server1, _unpackConfig_dev1;
|
|
59
|
+
let unpackConfig = originalUnpackConfig;
|
|
60
|
+
const bundler = 'rspack' === unpackConfig.bundler ? core_namespaceObject.rspack : external_webpack_default();
|
|
61
|
+
if (null === (_unpackConfig_dev = unpackConfig.dev) || void 0 === _unpackConfig_dev ? void 0 : _unpackConfig_dev.prebundle) unpackConfig = await (0, external_prebundleDeps_cjs_namespaceObject.prebundleDeps)({
|
|
62
|
+
unpackConfig
|
|
63
|
+
});
|
|
64
|
+
const config = await (0, index_cjs_namespaceObject.getBundlerConfig)(unpackConfig);
|
|
65
|
+
const compiler = bundler(config);
|
|
66
|
+
const port = await (0, external_utils_cjs_namespaceObject.getPort)(null === (_unpackConfig_server = unpackConfig.server) || void 0 === _unpackConfig_server ? void 0 : _unpackConfig_server.port);
|
|
67
|
+
const devServerOptions = {
|
|
68
|
+
hot: true,
|
|
69
|
+
port,
|
|
70
|
+
open: false,
|
|
71
|
+
client: {
|
|
72
|
+
overlay: false
|
|
73
|
+
},
|
|
74
|
+
proxy: null === (_unpackConfig_server1 = unpackConfig.server) || void 0 === _unpackConfig_server1 ? void 0 : _unpackConfig_server1.proxy,
|
|
75
|
+
devMiddleware: {
|
|
76
|
+
writeToDisk: null === (_unpackConfig_dev1 = unpackConfig.dev) || void 0 === _unpackConfig_dev1 ? void 0 : _unpackConfig_dev1.writeToDisk
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const server = new (external_webpack_dev_server_default())(devServerOptions, compiler);
|
|
80
|
+
external_logger_cjs_namespaceObject.logger.greet(` ${external_colors_cjs_default().green(`${external_colors_cjs_default().bold('UNPACK')} v1.7.7`)} ${external_colors_cjs_default().dim(`ready in ${external_colors_cjs_default().reset(external_colors_cjs_default().bold(Math.ceil(performance.now() - global.__unpack_start_time)))}ms`)}\n`);
|
|
81
|
+
printAddressUrls(port);
|
|
82
|
+
await server.start();
|
|
83
|
+
external_global_cjs_namespaceObject.restartCleaners.push(async ()=>await server.stop(), ()=>new Promise((resolve)=>compiler.close(()=>resolve())));
|
|
84
|
+
const { open } = unpackConfig.server;
|
|
85
|
+
if (open) {
|
|
86
|
+
const url = (0, external_utils_cjs_namespaceObject.isString)(open) ? open : `http://localhost:${port}`;
|
|
87
|
+
await (0, external_openBrowser_cjs_namespaceObject.openBrowser)(url);
|
|
61
88
|
}
|
|
62
|
-
};
|
|
63
|
-
const server = new import_webpack_dev_server.default(devServerOptions, compiler);
|
|
64
|
-
import_logger.logger.greet(
|
|
65
|
-
` ${import_colors.default.green(`${import_colors.default.bold("UNPACK")} v${"1.7.5"}`)} ${import_colors.default.dim(
|
|
66
|
-
`ready in ${import_colors.default.reset(
|
|
67
|
-
import_colors.default.bold(Math.ceil(performance.now() - global.__unpack_start_time))
|
|
68
|
-
)}ms`
|
|
69
|
-
)}
|
|
70
|
-
`
|
|
71
|
-
);
|
|
72
|
-
printAddressUrls(port);
|
|
73
|
-
await server.start();
|
|
74
|
-
const { open } = unpackConfig.server;
|
|
75
|
-
if (open) {
|
|
76
|
-
const url = (0, import_utils.isString)(open) ? open : `http://localhost:${port}`;
|
|
77
|
-
await (0, import_openBrowser.openBrowser)(url);
|
|
78
|
-
}
|
|
79
89
|
}
|
|
80
90
|
function printAddressUrls(port) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
const addressUrls = (0, external_utils_cjs_namespaceObject.getAddressUrls)({
|
|
92
|
+
port
|
|
93
|
+
});
|
|
94
|
+
const colorUrl = (url)=>external_colors_cjs_default().cyan(url.replace(/:(\d+)\//, (_, port)=>`:${external_colors_cjs_default().bold(port)}/`));
|
|
95
|
+
addressUrls.forEach((addr)=>{
|
|
96
|
+
console.log(` ${external_colors_cjs_default().green('➜')} ${external_colors_cjs_default().bold(addr.label)}${colorUrl(addr.url)}`);
|
|
97
|
+
});
|
|
86
98
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
var __webpack_export_target__ = exports;
|
|
100
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
101
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
102
|
+
value: true
|
|
90
103
|
});
|
package/dist/run/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/run/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/run/dev.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAMnD,wBAAsB,UAAU,CAAC,oBAAoB,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAyClF"}
|