@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.
Files changed (116) hide show
  1. package/compiled/css-loader/index.js +180 -178
  2. package/compiled/less-loader/index.js +11 -11
  3. package/compiled/line-diff/index.js +4 -4
  4. package/compiled/line-diff/license +1 -1
  5. package/compiled/line-diff/package.json +1 -1
  6. package/compiled/portfinder/index.js +37 -37
  7. package/compiled/postcss-loader/index.js +261 -256
  8. package/compiled/sass-loader/index.js +24 -20
  9. package/compiled/sass-loader/package.json +1 -1
  10. package/compiled/semver/index.js +188 -170
  11. package/compiled/semver/package.json +1 -1
  12. package/compiled/style-loader/index.js +13 -13
  13. package/compiled/webpack-bundle-analyzer/index.js +198 -198
  14. package/compiled/webpack-merge/index.js +29 -29
  15. package/dist/bundler-config/chunkSplit.cjs +169 -156
  16. package/dist/bundler-config/chunkSplit.js +125 -134
  17. package/dist/bundler-config/css.cjs +181 -158
  18. package/dist/bundler-config/css.js +139 -151
  19. package/dist/bundler-config/experimentCss.cjs +203 -159
  20. package/dist/bundler-config/experimentCss.js +162 -152
  21. package/dist/bundler-config/helper.cjs +82 -78
  22. package/dist/bundler-config/helper.js +36 -55
  23. package/dist/bundler-config/index.cjs +260 -209
  24. package/dist/bundler-config/index.d.ts.map +1 -1
  25. package/dist/bundler-config/index.js +209 -182
  26. package/dist/bundler-config/jsMinify.cjs +114 -95
  27. package/dist/bundler-config/jsMinify.js +70 -73
  28. package/dist/colors.cjs +83 -56
  29. package/dist/colors.js +38 -37
  30. package/dist/config.cjs +107 -93
  31. package/dist/config.d.ts.map +1 -1
  32. package/dist/config.js +64 -70
  33. package/dist/constants.cjs +65 -62
  34. package/dist/constants.d.ts +1 -0
  35. package/dist/constants.d.ts.map +1 -1
  36. package/dist/constants.js +22 -38
  37. package/dist/createUnpack.cjs +111 -104
  38. package/dist/createUnpack.js +67 -82
  39. package/dist/global.cjs +36 -0
  40. package/dist/global.d.ts +2 -0
  41. package/dist/global.d.ts.map +1 -0
  42. package/dist/global.js +4 -0
  43. package/dist/index.cjs +174 -51
  44. package/dist/index.d.ts +2 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +33 -15
  47. package/dist/lightningcss/loader.cjs +56 -53
  48. package/dist/lightningcss/loader.d.ts.map +1 -1
  49. package/dist/lightningcss/loader.js +25 -34
  50. package/dist/lightningcss/minimizer.cjs +90 -109
  51. package/dist/lightningcss/minimizer.d.ts.map +1 -1
  52. package/dist/lightningcss/minimizer.js +59 -87
  53. package/dist/logger.cjs +104 -98
  54. package/dist/logger.js +59 -76
  55. package/dist/openBrowser.cjs +104 -81
  56. package/dist/openBrowser.js +56 -52
  57. package/dist/plugin-progress/rspack.cjs +104 -79
  58. package/dist/plugin-progress/rspack.js +59 -57
  59. package/dist/plugin-progress/webpack.cjs +111 -89
  60. package/dist/plugin-progress/webpack.js +65 -67
  61. package/dist/plugin.cjs +38 -29
  62. package/dist/plugin.js +8 -17
  63. package/dist/prebundleDeps.cjs +327 -337
  64. package/dist/prebundleDeps.d.ts.map +1 -1
  65. package/dist/prebundleDeps.js +278 -324
  66. package/dist/progressBar.cjs +82 -65
  67. package/dist/progressBar.js +38 -43
  68. package/dist/reporter.cjs +149 -124
  69. package/dist/reporter.d.ts.map +1 -1
  70. package/dist/reporter.js +102 -102
  71. package/dist/run/build.cjs +68 -67
  72. package/dist/run/build.js +24 -45
  73. package/dist/run/dev.cjs +96 -83
  74. package/dist/run/dev.d.ts.map +1 -1
  75. package/dist/run/dev.js +50 -61
  76. package/dist/run/index.cjs +74 -21
  77. package/dist/run/index.js +2 -9
  78. package/dist/typed-css-modules/loader.cjs +179 -188
  79. package/dist/typed-css-modules/loader.js +118 -151
  80. package/dist/typed-css-modules/plugin.cjs +113 -88
  81. package/dist/typed-css-modules/plugin.js +68 -66
  82. package/dist/typed-css-modules/utils.cjs +43 -42
  83. package/dist/typed-css-modules/utils.js +13 -30
  84. package/dist/types/chunkSplit.cjs +19 -15
  85. package/dist/types/chunkSplit.d.ts +2 -10
  86. package/dist/types/chunkSplit.d.ts.map +1 -1
  87. package/dist/types/chunkSplit.js +2 -9
  88. package/dist/types/config.cjs +19 -15
  89. package/dist/types/config.js +2 -9
  90. package/dist/types/index.cjs +101 -27
  91. package/dist/types/index.js +2 -9
  92. package/dist/types/lightningcss.cjs +19 -15
  93. package/dist/types/lightningcss.js +2 -9
  94. package/dist/types/logger.cjs +43 -34
  95. package/dist/types/logger.js +13 -22
  96. package/dist/types/plugin.cjs +19 -15
  97. package/dist/types/plugin.js +2 -9
  98. package/dist/utils.cjs +280 -304
  99. package/dist/utils.js +195 -241
  100. package/dist/watchFiles.cjs +73 -0
  101. package/dist/watchFiles.d.ts +3 -0
  102. package/dist/watchFiles.d.ts.map +1 -0
  103. package/dist/watchFiles.js +27 -0
  104. package/package.json +18 -21
  105. package/compiled/commander/index.d.ts +0 -1047
  106. package/compiled/commander/index.js +0 -2428
  107. package/compiled/commander/license +0 -22
  108. package/compiled/commander/package.json +0 -1
  109. package/dist/bundleRequire.cjs +0 -200
  110. package/dist/bundleRequire.d.ts +0 -5
  111. package/dist/bundleRequire.d.ts.map +0 -1
  112. package/dist/bundleRequire.js +0 -173
  113. package/dist/lightningcss/cache.cjs +0 -36
  114. package/dist/lightningcss/cache.d.ts +0 -2
  115. package/dist/lightningcss/cache.d.ts.map +0 -1
  116. package/dist/lightningcss/cache.js +0 -22
@@ -1,77 +1,74 @@
1
- import { createRequire } from 'node:module';
2
- var require = createRequire(import.meta['url']);
3
-
4
- import path from "path";
5
- import { fileURLToPath } from "url";
6
- var getFilename = () => fileURLToPath(import.meta.url);
7
- var getDirname = () => path.dirname(getFilename());
8
- var __dirname = /* @__PURE__ */ getDirname();
9
- var __filename = /* @__PURE__ */ getFilename();
10
- import { transform } from "esbuild";
11
- import webpack from "webpack";
12
- const { RawSource, SourceMapSource } = webpack.sources;
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import * as __WEBPACK_EXTERNAL_MODULE_esbuild__ from "esbuild";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_webpack__ from "webpack";
5
+ function _define_property(obj, key, value) {
6
+ if (key in obj) Object.defineProperty(obj, key, {
7
+ value: value,
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true
11
+ });
12
+ else obj[key] = value;
13
+ return obj;
14
+ }
15
+ const { RawSource, SourceMapSource } = __WEBPACK_EXTERNAL_MODULE_webpack__["default"].sources;
13
16
  const isJsFile = /\.[cm]?js(\?.*)?$/i;
14
- const PLUGIN_NAME = "JsMinifyPlugin";
17
+ const PLUGIN_NAME = 'JsMinifyPlugin';
15
18
  class JsMinifyPlugin {
16
- constructor(options = {}) {
17
- this.options = {};
18
- const { implementation } = options;
19
- this.transform = implementation?.transform ?? transform;
20
- this.options = options;
21
- }
22
- apply(compiler) {
23
- const { implementation, ...transformOptions } = this.options;
24
- const meta = JSON.stringify({
25
- name: PLUGIN_NAME,
26
- version: "1.7.5",
27
- options: transformOptions
28
- });
29
- compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
30
- compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash) => hash.update(meta));
31
- compilation.hooks.processAssets.tapPromise(
32
- {
33
- name: PLUGIN_NAME,
34
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
35
- additionalAssets: true
36
- },
37
- () => this.transformAssets(compilation)
38
- );
39
- compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (stats) => {
40
- stats.hooks.print.for("asset.info.minimized").tap(
41
- PLUGIN_NAME,
42
- (minimized, { green, formatFlag }) => minimized && green && formatFlag ? green(formatFlag("minimized")) : ""
43
- );
44
- });
45
- });
46
- }
47
- async transformAssets(compilation) {
48
- const {
49
- options: { devtool }
50
- } = compilation.compiler;
51
- const sourceMap = !!devtool && devtool.includes("source-map");
52
- const assets = compilation.getAssets().filter((asset) => !asset.info.minimized && isJsFile.test(asset.name));
53
- const { implementation, ...transformOptions } = this.options;
54
- await Promise.all(
55
- assets.map(async (asset) => {
56
- const { source, map } = asset.source.sourceAndMap();
57
- const output = await this.transform(Buffer.isBuffer(source) ? source.toString() : source, {
58
- ...transformOptions,
59
- minify: true,
60
- sourcemap: sourceMap,
61
- sourcefile: asset.name
19
+ apply(compiler) {
20
+ const { implementation, ...transformOptions } = this.options;
21
+ const meta = JSON.stringify({
22
+ name: PLUGIN_NAME,
23
+ version: "1.7.7",
24
+ options: transformOptions
25
+ });
26
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
27
+ compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash)=>hash.update(meta));
28
+ compilation.hooks.processAssets.tapPromise({
29
+ name: PLUGIN_NAME,
30
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
31
+ additionalAssets: true
32
+ }, ()=>this.transformAssets(compilation));
33
+ compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (stats)=>{
34
+ stats.hooks.print.for('asset.info.minimized').tap(PLUGIN_NAME, (minimized, { green, formatFlag })=>minimized && green && formatFlag ? green(formatFlag('minimized')) : '');
35
+ });
62
36
  });
63
- let newMap = void 0;
64
- if (output.map) {
65
- newMap = JSON.parse(output.map);
66
- newMap.sources = [asset.name];
67
- }
68
- const newSource = sourceMap && newMap ? new SourceMapSource(output.code, asset.name, newMap, source, map, true) : new RawSource(output.code);
69
- const newInfo = { ...asset.info, minimized: true };
70
- compilation.updateAsset(asset.name, newSource, newInfo);
71
- })
72
- );
73
- }
37
+ }
38
+ async transformAssets(compilation) {
39
+ const { options: { devtool } } = compilation.compiler;
40
+ const sourceMap = !!devtool && devtool.includes('source-map');
41
+ const assets = compilation.getAssets().filter((asset)=>!asset.info.minimized && isJsFile.test(asset.name));
42
+ const { implementation, ...transformOptions } = this.options;
43
+ await Promise.all(assets.map(async (asset)=>{
44
+ const { source, map } = asset.source.sourceAndMap();
45
+ const output = await this.transform(Buffer.isBuffer(source) ? source.toString() : source, {
46
+ ...transformOptions,
47
+ minify: true,
48
+ sourcemap: sourceMap,
49
+ sourcefile: asset.name
50
+ });
51
+ let newMap;
52
+ if (output.map) {
53
+ newMap = JSON.parse(output.map);
54
+ newMap.sources = [
55
+ asset.name
56
+ ];
57
+ }
58
+ const newSource = sourceMap && newMap ? new SourceMapSource(output.code, asset.name, newMap, source, map, true) : new RawSource(output.code);
59
+ const newInfo = {
60
+ ...asset.info,
61
+ minimized: true
62
+ };
63
+ compilation.updateAsset(asset.name, newSource, newInfo);
64
+ }));
65
+ }
66
+ constructor(options = {}){
67
+ _define_property(this, "options", {});
68
+ _define_property(this, "transform", void 0);
69
+ const { implementation } = options;
70
+ this.transform = (null == implementation ? void 0 : implementation.transform) ?? __WEBPACK_EXTERNAL_MODULE_esbuild__.transform;
71
+ this.options = options;
72
+ }
74
73
  }
75
- export {
76
- JsMinifyPlugin
77
- };
74
+ export { JsMinifyPlugin };
package/dist/colors.cjs CHANGED
@@ -1,60 +1,87 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var colors_exports = {};
29
- __export(colors_exports, {
30
- default: () => colors_default
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
+ default: ()=>colors_rslib_entry_
31
43
  });
32
- module.exports = __toCommonJS(colors_exports);
33
- var import_picocolors = __toESM(require("picocolors"));
44
+ const external_picocolors_namespaceObject = require("picocolors");
45
+ var external_picocolors_default = /*#__PURE__*/ __webpack_require__.n(external_picocolors_namespaceObject);
34
46
  const colors = {
35
- ...import_picocolors.default,
36
- rainbow: (input) => {
37
- const startColor = [48, 112, 198];
38
- const endColor = [97, 193, 198];
39
- const isWord = (char) => !/[\s\n]/.test(char);
40
- const chars = [...input];
41
- const steps = chars.filter(isWord).length;
42
- let r = startColor[0];
43
- let g = startColor[1];
44
- let b = startColor[2];
45
- const rStep = (endColor[0] - r) / steps;
46
- const gStep = (endColor[1] - g) / steps;
47
- const bStep = (endColor[2] - b) / steps;
48
- let output = "";
49
- for (const char of chars) {
50
- if (isWord(char)) {
51
- r += rStep;
52
- g += gStep;
53
- b += bStep;
54
- }
55
- output += `\x1B[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1B[39m`;
47
+ ...external_picocolors_default(),
48
+ rainbow: (input)=>{
49
+ const startColor = [
50
+ 48,
51
+ 112,
52
+ 198
53
+ ];
54
+ const endColor = [
55
+ 97,
56
+ 193,
57
+ 198
58
+ ];
59
+ const isWord = (char)=>!/[\s\n]/.test(char);
60
+ const chars = [
61
+ ...input
62
+ ];
63
+ const steps = chars.filter(isWord).length;
64
+ let r = startColor[0];
65
+ let g = startColor[1];
66
+ let b = startColor[2];
67
+ const rStep = (endColor[0] - r) / steps;
68
+ const gStep = (endColor[1] - g) / steps;
69
+ const bStep = (endColor[2] - b) / steps;
70
+ let output = '';
71
+ for (const char of chars){
72
+ if (isWord(char)) {
73
+ r += rStep;
74
+ g += gStep;
75
+ b += bStep;
76
+ }
77
+ output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
78
+ }
79
+ return output;
56
80
  }
57
- return output;
58
- }
59
81
  };
60
- var colors_default = colors;
82
+ const colors_rslib_entry_ = colors;
83
+ var __webpack_export_target__ = exports;
84
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
85
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
86
+ value: true
87
+ });
package/dist/colors.js CHANGED
@@ -1,40 +1,41 @@
1
- import { createRequire } from 'node:module';
2
- var require = createRequire(import.meta['url']);
3
-
4
- import path from "path";
5
- import { fileURLToPath } from "url";
6
- var getFilename = () => fileURLToPath(import.meta.url);
7
- var getDirname = () => path.dirname(getFilename());
8
- var __dirname = /* @__PURE__ */ getDirname();
9
- var __filename = /* @__PURE__ */ getFilename();
10
- import picocolors from "picocolors";
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
11
4
  const colors = {
12
- ...picocolors,
13
- rainbow: (input) => {
14
- const startColor = [48, 112, 198];
15
- const endColor = [97, 193, 198];
16
- const isWord = (char) => !/[\s\n]/.test(char);
17
- const chars = [...input];
18
- const steps = chars.filter(isWord).length;
19
- let r = startColor[0];
20
- let g = startColor[1];
21
- let b = startColor[2];
22
- const rStep = (endColor[0] - r) / steps;
23
- const gStep = (endColor[1] - g) / steps;
24
- const bStep = (endColor[2] - b) / steps;
25
- let output = "";
26
- for (const char of chars) {
27
- if (isWord(char)) {
28
- r += rStep;
29
- g += gStep;
30
- b += bStep;
31
- }
32
- output += `\x1B[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1B[39m`;
5
+ ...__WEBPACK_EXTERNAL_MODULE_picocolors__["default"],
6
+ rainbow: (input)=>{
7
+ const startColor = [
8
+ 48,
9
+ 112,
10
+ 198
11
+ ];
12
+ const endColor = [
13
+ 97,
14
+ 193,
15
+ 198
16
+ ];
17
+ const isWord = (char)=>!/[\s\n]/.test(char);
18
+ const chars = [
19
+ ...input
20
+ ];
21
+ const steps = chars.filter(isWord).length;
22
+ let r = startColor[0];
23
+ let g = startColor[1];
24
+ let b = startColor[2];
25
+ const rStep = (endColor[0] - r) / steps;
26
+ const gStep = (endColor[1] - g) / steps;
27
+ const bStep = (endColor[2] - b) / steps;
28
+ let output = '';
29
+ for (const char of chars){
30
+ if (isWord(char)) {
31
+ r += rStep;
32
+ g += gStep;
33
+ b += bStep;
34
+ }
35
+ output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
36
+ }
37
+ return output;
33
38
  }
34
- return output;
35
- }
36
- };
37
- var colors_default = colors;
38
- export {
39
- colors_default as default
40
39
  };
40
+ const colors_rslib_entry_ = colors;
41
+ export { colors_rslib_entry_ as default };
package/dist/config.cjs CHANGED
@@ -1,103 +1,117 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var config_exports = {};
29
- __export(config_exports, {
30
- defineConfig: () => defineConfig,
31
- loadConfig: () => loadConfig
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
+ defineConfig: ()=>defineConfig,
43
+ loadConfig: ()=>loadConfig
32
44
  });
33
- module.exports = __toCommonJS(config_exports);
34
- var import_node_fs = __toESM(require("node:fs"));
35
- var import_node_path = require("node:path");
36
- var import_bundleRequire = require("./bundleRequire.cjs");
37
- var import_logger = require("./logger.cjs");
38
- var import_utils = require("./utils.cjs");
39
- async function loadConfig({
40
- cliOptions,
41
- command
42
- }) {
43
- if (command === "build") {
44
- (0, import_utils.setNodeEnv)(cliOptions?.watch ? "development" : "production");
45
- } else {
46
- (0, import_utils.setNodeEnv)("development");
47
- (0, import_utils.setDevServer)(true);
48
- }
49
- const configPath = resolveConfigPath(process.cwd(), cliOptions?.config);
50
- let userConfig = {};
51
- if (configPath) {
52
- userConfig = await (0, import_bundleRequire.bundleRequire)(configPath);
53
- if (typeof userConfig === "function") {
54
- const params = {
55
- env: (0, import_utils.getNodeEnv)(),
56
- command: process.argv[2]
57
- };
58
- userConfig = await userConfig(params);
59
- if (userConfig === void 0) {
60
- throw new Error("Unpack config function must return a config object.");
61
- }
45
+ const external_node_fs_namespaceObject = require("node:fs");
46
+ var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
47
+ const external_node_path_namespaceObject = require("node:path");
48
+ const external_jiti_namespaceObject = require("jiti");
49
+ const external_logger_cjs_namespaceObject = require("./logger.cjs");
50
+ const external_utils_cjs_namespaceObject = require("./utils.cjs");
51
+ async function loadConfig({ cliOptions, command }) {
52
+ if ('build' === command) (0, external_utils_cjs_namespaceObject.setNodeEnv)((null == cliOptions ? void 0 : cliOptions.watch) ? 'development' : 'production');
53
+ else {
54
+ (0, external_utils_cjs_namespaceObject.setNodeEnv)('development');
55
+ (0, external_utils_cjs_namespaceObject.setDevServer)(true);
62
56
  }
63
- }
64
- if (cliOptions?.port)
65
- (0, import_utils.setValueByPath)(userConfig, ["server", "port"], cliOptions.port);
66
- if (cliOptions?.open)
67
- (0, import_utils.setValueByPath)(userConfig, ["server", "open"], cliOptions.open);
68
- if (cliOptions?.analyze)
69
- (0, import_utils.setValueByPath)(userConfig, ["performance", "bundleAnalyze"], cliOptions.analyze);
70
- return userConfig;
57
+ const configPath = resolveConfigPath(process.cwd(), null == cliOptions ? void 0 : cliOptions.config);
58
+ let userConfig = {};
59
+ if (configPath) {
60
+ const jiti = (0, external_jiti_namespaceObject.createJiti)(__filename, {
61
+ moduleCache: false,
62
+ interopDefault: true
63
+ });
64
+ userConfig = await jiti.import(configPath, {
65
+ default: true
66
+ });
67
+ if ('function' == typeof userConfig) {
68
+ const params = {
69
+ env: (0, external_utils_cjs_namespaceObject.getNodeEnv)(),
70
+ command: process.argv[2]
71
+ };
72
+ userConfig = await userConfig(params);
73
+ if (void 0 === userConfig) throw new Error('Unpack config function must return a config object.');
74
+ }
75
+ }
76
+ if (null == cliOptions ? void 0 : cliOptions.port) (0, external_utils_cjs_namespaceObject.setValueByPath)(userConfig, [
77
+ 'server',
78
+ 'port'
79
+ ], cliOptions.port);
80
+ if (null == cliOptions ? void 0 : cliOptions.open) (0, external_utils_cjs_namespaceObject.setValueByPath)(userConfig, [
81
+ 'server',
82
+ 'open'
83
+ ], cliOptions.open);
84
+ if (null == cliOptions ? void 0 : cliOptions.analyze) (0, external_utils_cjs_namespaceObject.setValueByPath)(userConfig, [
85
+ 'performance',
86
+ 'bundleAnalyze'
87
+ ], cliOptions.analyze);
88
+ return userConfig;
71
89
  }
72
90
  function defineConfig(config) {
73
- return config;
91
+ return config;
74
92
  }
75
93
  function resolveConfigPath(root, customConfig) {
76
- if (customConfig) {
77
- const customConfigPath = (0, import_node_path.isAbsolute)(customConfig) ? customConfig : (0, import_node_path.join)(root, customConfig);
78
- if (import_node_fs.default.existsSync(customConfigPath)) {
79
- return customConfigPath;
94
+ if (customConfig) {
95
+ const customConfigPath = (0, external_node_path_namespaceObject.isAbsolute)(customConfig) ? customConfig : (0, external_node_path_namespaceObject.join)(root, customConfig);
96
+ if (external_node_fs_default().existsSync(customConfigPath)) return customConfigPath;
97
+ external_logger_cjs_namespaceObject.logger.warn(`Could not find config file: ${customConfigPath}`);
80
98
  }
81
- import_logger.logger.warn(`Could not find config file: ${customConfigPath}`);
82
- }
83
- const CONFIG_FILES = [
84
- "unpack.config.ts",
85
- "unpack.config.js",
86
- "unpack.config.mjs",
87
- "unpack.config.cjs",
88
- "unpack.config.mts",
89
- "unpack.config.cts"
90
- ];
91
- for (const file of CONFIG_FILES) {
92
- const configFile = (0, import_node_path.join)(root, file);
93
- if (import_node_fs.default.existsSync(configFile)) {
94
- return configFile;
99
+ const CONFIG_FILES = [
100
+ 'unpack.config.ts',
101
+ 'unpack.config.js',
102
+ 'unpack.config.mjs',
103
+ 'unpack.config.cjs',
104
+ 'unpack.config.mts',
105
+ 'unpack.config.cts'
106
+ ];
107
+ for (const file of CONFIG_FILES){
108
+ const configFile = (0, external_node_path_namespaceObject.join)(root, file);
109
+ if (external_node_fs_default().existsSync(configFile)) return configFile;
95
110
  }
96
- }
97
- return null;
111
+ return null;
98
112
  }
99
- // Annotate the CommonJS export names for ESM import in node:
100
- 0 && (module.exports = {
101
- defineConfig,
102
- loadConfig
113
+ var __webpack_export_target__ = exports;
114
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
115
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
116
+ value: true
103
117
  });
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAKjF,wBAAsB,UAAU,CAAC,EAC/B,UAAU,EACV,OAAO,GACR,EAAE;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,YAAY,CAAC,CA2BxB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AACjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,YAAY,CAAA;AACvE,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,CAAA;AACxF,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAAA;AAChE,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA;AAC5E,wBAAgB,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAAA;AAC9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAIjF,wBAAsB,UAAU,CAAC,EAC/B,UAAU,EACV,OAAO,GACR,EAAE;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,YAAY,CAAC,CAiCxB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AACjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,YAAY,CAAA;AACvE,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,CAAA;AACxF,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAAA;AAChE,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA;AAC5E,wBAAgB,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAAA;AAC9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA"}