@unpackjs/core 1.7.5 → 1.7.6

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 (122) 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/portfinder/index.js +37 -37
  5. package/compiled/postcss-loader/index.js +261 -256
  6. package/compiled/sass-loader/index.js +18 -18
  7. package/compiled/semver/index.js +188 -170
  8. package/compiled/semver/package.json +1 -1
  9. package/compiled/style-loader/index.js +13 -13
  10. package/compiled/webpack-bundle-analyzer/index.js +198 -198
  11. package/compiled/webpack-merge/index.js +29 -29
  12. package/dist/bundler-config/chunkSplit.cjs +169 -156
  13. package/dist/bundler-config/chunkSplit.d.ts +1 -1
  14. package/dist/bundler-config/chunkSplit.js +125 -134
  15. package/dist/bundler-config/css.cjs +181 -158
  16. package/dist/bundler-config/css.d.ts +1 -1
  17. package/dist/bundler-config/css.js +139 -151
  18. package/dist/bundler-config/experimentCss.cjs +203 -159
  19. package/dist/bundler-config/experimentCss.d.ts +1 -1
  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 +1 -1
  25. package/dist/bundler-config/index.d.ts.map +1 -1
  26. package/dist/bundler-config/index.js +209 -182
  27. package/dist/bundler-config/jsMinify.cjs +114 -95
  28. package/dist/bundler-config/jsMinify.js +70 -73
  29. package/dist/colors.cjs +83 -56
  30. package/dist/colors.js +38 -37
  31. package/dist/config.cjs +107 -93
  32. package/dist/config.d.ts +1 -1
  33. package/dist/config.d.ts.map +1 -1
  34. package/dist/config.js +64 -70
  35. package/dist/constants.cjs +62 -62
  36. package/dist/constants.js +20 -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/cache.cjs +40 -32
  48. package/dist/lightningcss/cache.js +10 -20
  49. package/dist/lightningcss/loader.cjs +56 -53
  50. package/dist/lightningcss/loader.d.ts +1 -1
  51. package/dist/lightningcss/loader.js +25 -34
  52. package/dist/lightningcss/minimizer.cjs +90 -109
  53. package/dist/lightningcss/minimizer.d.ts +1 -1
  54. package/dist/lightningcss/minimizer.js +59 -87
  55. package/dist/logger.cjs +104 -98
  56. package/dist/logger.d.ts +1 -1
  57. package/dist/logger.js +59 -76
  58. package/dist/openBrowser.cjs +104 -81
  59. package/dist/openBrowser.js +56 -52
  60. package/dist/plugin-progress/rspack.cjs +104 -79
  61. package/dist/plugin-progress/rspack.d.ts +1 -1
  62. package/dist/plugin-progress/rspack.js +59 -57
  63. package/dist/plugin-progress/webpack.cjs +111 -89
  64. package/dist/plugin-progress/webpack.d.ts +1 -1
  65. package/dist/plugin-progress/webpack.js +65 -67
  66. package/dist/plugin.cjs +38 -29
  67. package/dist/plugin.js +8 -17
  68. package/dist/prebundleDeps.cjs +327 -337
  69. package/dist/prebundleDeps.d.ts.map +1 -1
  70. package/dist/prebundleDeps.js +278 -324
  71. package/dist/progressBar.cjs +82 -65
  72. package/dist/progressBar.js +38 -43
  73. package/dist/reporter.cjs +135 -120
  74. package/dist/reporter.js +88 -98
  75. package/dist/run/build.cjs +68 -67
  76. package/dist/run/build.d.ts +1 -1
  77. package/dist/run/build.js +24 -45
  78. package/dist/run/dev.cjs +96 -83
  79. package/dist/run/dev.d.ts +1 -1
  80. package/dist/run/dev.d.ts.map +1 -1
  81. package/dist/run/dev.js +50 -61
  82. package/dist/run/index.cjs +74 -21
  83. package/dist/run/index.js +2 -9
  84. package/dist/typed-css-modules/loader.cjs +179 -188
  85. package/dist/typed-css-modules/loader.d.ts +1 -1
  86. package/dist/typed-css-modules/loader.js +118 -151
  87. package/dist/typed-css-modules/plugin.cjs +113 -88
  88. package/dist/typed-css-modules/plugin.d.ts +1 -1
  89. package/dist/typed-css-modules/plugin.js +68 -66
  90. package/dist/typed-css-modules/utils.cjs +43 -42
  91. package/dist/typed-css-modules/utils.d.ts +1 -1
  92. package/dist/typed-css-modules/utils.js +13 -30
  93. package/dist/types/chunkSplit.cjs +19 -15
  94. package/dist/types/chunkSplit.d.ts +2 -10
  95. package/dist/types/chunkSplit.d.ts.map +1 -1
  96. package/dist/types/chunkSplit.js +2 -9
  97. package/dist/types/config.cjs +19 -15
  98. package/dist/types/config.d.ts +1 -1
  99. package/dist/types/config.js +2 -9
  100. package/dist/types/index.cjs +101 -27
  101. package/dist/types/index.js +2 -9
  102. package/dist/types/lightningcss.cjs +19 -15
  103. package/dist/types/lightningcss.js +2 -9
  104. package/dist/types/logger.cjs +43 -34
  105. package/dist/types/logger.js +13 -22
  106. package/dist/types/plugin.cjs +19 -15
  107. package/dist/types/plugin.js +2 -9
  108. package/dist/utils.cjs +280 -304
  109. package/dist/utils.js +195 -241
  110. package/dist/watchFiles.cjs +73 -0
  111. package/dist/watchFiles.d.ts +3 -0
  112. package/dist/watchFiles.d.ts.map +1 -0
  113. package/dist/watchFiles.js +27 -0
  114. package/package.json +14 -17
  115. package/compiled/commander/index.d.ts +0 -1047
  116. package/compiled/commander/index.js +0 -2428
  117. package/compiled/commander/license +0 -22
  118. package/compiled/commander/package.json +0 -1
  119. package/dist/bundleRequire.cjs +0 -200
  120. package/dist/bundleRequire.d.ts +0 -5
  121. package/dist/bundleRequire.d.ts.map +0 -1
  122. package/dist/bundleRequire.js +0 -173
package/dist/config.js CHANGED
@@ -1,78 +1,72 @@
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 fs from "node:fs";
11
- import { isAbsolute, join } from "node:path";
12
- import { bundleRequire } from "./bundleRequire.js";
13
- import { logger } from "./logger.js";
14
- import { getNodeEnv, setDevServer, setNodeEnv, setValueByPath } from "./utils.js";
15
- async function loadConfig({
16
- cliOptions,
17
- command
18
- }) {
19
- if (command === "build") {
20
- setNodeEnv(cliOptions?.watch ? "development" : "production");
21
- } else {
22
- setNodeEnv("development");
23
- setDevServer(true);
24
- }
25
- const configPath = resolveConfigPath(process.cwd(), cliOptions?.config);
26
- let userConfig = {};
27
- if (configPath) {
28
- userConfig = await bundleRequire(configPath);
29
- if (typeof userConfig === "function") {
30
- const params = {
31
- env: getNodeEnv(),
32
- command: process.argv[2]
33
- };
34
- userConfig = await userConfig(params);
35
- if (userConfig === void 0) {
36
- throw new Error("Unpack config function must return a config object.");
37
- }
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
5
+ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
6
+ import * as __WEBPACK_EXTERNAL_MODULE_jiti__ from "jiti";
7
+ import * as __WEBPACK_EXTERNAL_MODULE__logger_js_c2be5186__ from "./logger.js";
8
+ import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
9
+ var config_rslib_entry_filename = __webpack_fileURLToPath__(import.meta.url);
10
+ async function loadConfig({ cliOptions, command }) {
11
+ if ('build' === command) (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.setNodeEnv)((null == cliOptions ? void 0 : cliOptions.watch) ? 'development' : 'production');
12
+ else {
13
+ (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.setNodeEnv)('development');
14
+ (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.setDevServer)(true);
38
15
  }
39
- }
40
- if (cliOptions?.port)
41
- setValueByPath(userConfig, ["server", "port"], cliOptions.port);
42
- if (cliOptions?.open)
43
- setValueByPath(userConfig, ["server", "open"], cliOptions.open);
44
- if (cliOptions?.analyze)
45
- setValueByPath(userConfig, ["performance", "bundleAnalyze"], cliOptions.analyze);
46
- return userConfig;
16
+ const configPath = resolveConfigPath(process.cwd(), null == cliOptions ? void 0 : cliOptions.config);
17
+ let userConfig = {};
18
+ if (configPath) {
19
+ const jiti = (0, __WEBPACK_EXTERNAL_MODULE_jiti__.createJiti)(config_rslib_entry_filename, {
20
+ moduleCache: false,
21
+ interopDefault: true
22
+ });
23
+ userConfig = await jiti.import(configPath, {
24
+ default: true
25
+ });
26
+ if ('function' == typeof userConfig) {
27
+ const params = {
28
+ env: (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.getNodeEnv)(),
29
+ command: process.argv[2]
30
+ };
31
+ userConfig = await userConfig(params);
32
+ if (void 0 === userConfig) throw new Error('Unpack config function must return a config object.');
33
+ }
34
+ }
35
+ if (null == cliOptions ? void 0 : cliOptions.port) (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.setValueByPath)(userConfig, [
36
+ 'server',
37
+ 'port'
38
+ ], cliOptions.port);
39
+ if (null == cliOptions ? void 0 : cliOptions.open) (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.setValueByPath)(userConfig, [
40
+ 'server',
41
+ 'open'
42
+ ], cliOptions.open);
43
+ if (null == cliOptions ? void 0 : cliOptions.analyze) (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.setValueByPath)(userConfig, [
44
+ 'performance',
45
+ 'bundleAnalyze'
46
+ ], cliOptions.analyze);
47
+ return userConfig;
47
48
  }
48
49
  function defineConfig(config) {
49
- return config;
50
+ return config;
50
51
  }
51
52
  function resolveConfigPath(root, customConfig) {
52
- if (customConfig) {
53
- const customConfigPath = isAbsolute(customConfig) ? customConfig : join(root, customConfig);
54
- if (fs.existsSync(customConfigPath)) {
55
- return customConfigPath;
53
+ if (customConfig) {
54
+ const customConfigPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(customConfig) ? customConfig : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, customConfig);
55
+ if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(customConfigPath)) return customConfigPath;
56
+ __WEBPACK_EXTERNAL_MODULE__logger_js_c2be5186__.logger.warn(`Could not find config file: ${customConfigPath}`);
56
57
  }
57
- logger.warn(`Could not find config file: ${customConfigPath}`);
58
- }
59
- const CONFIG_FILES = [
60
- "unpack.config.ts",
61
- "unpack.config.js",
62
- "unpack.config.mjs",
63
- "unpack.config.cjs",
64
- "unpack.config.mts",
65
- "unpack.config.cts"
66
- ];
67
- for (const file of CONFIG_FILES) {
68
- const configFile = join(root, file);
69
- if (fs.existsSync(configFile)) {
70
- return configFile;
58
+ const CONFIG_FILES = [
59
+ 'unpack.config.ts',
60
+ 'unpack.config.js',
61
+ 'unpack.config.mjs',
62
+ 'unpack.config.cjs',
63
+ 'unpack.config.mts',
64
+ 'unpack.config.cts'
65
+ ];
66
+ for (const file of CONFIG_FILES){
67
+ const configFile = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, file);
68
+ if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(configFile)) return configFile;
71
69
  }
72
- }
73
- return null;
70
+ return null;
74
71
  }
75
- export {
76
- defineConfig,
77
- loadConfig
78
- };
72
+ export { defineConfig, loadConfig };
@@ -1,59 +1,71 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var constants_exports = {};
19
- __export(constants_exports, {
20
- CSS_MODULES_LOCAL_IDENT_NAME: () => CSS_MODULES_LOCAL_IDENT_NAME,
21
- CSS_MODULES_REGEX: () => CSS_MODULES_REGEX,
22
- CSS_NAMED_EXPORT: () => CSS_NAMED_EXPORT,
23
- DEFAULT_BROWSERSLIST: () => DEFAULT_BROWSERSLIST,
24
- DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
25
- DEV_DEFAULT_FILENAME: () => DEV_DEFAULT_FILENAME,
26
- ESBUILD_TARGET: () => ESBUILD_TARGET,
27
- EXPORT_LOCALS_CONVENTION: () => EXPORT_LOCALS_CONVENTION,
28
- NODE_MODULES_REGEX: () => NODE_MODULES_REGEX,
29
- PROD_DEFAULT_FILENAME: () => PROD_DEFAULT_FILENAME,
30
- TEMPLATE_CONTENT: () => TEMPLATE_CONTENT,
31
- TEMP_DIR: () => TEMP_DIR,
32
- THREAD_OPTIONS: () => THREAD_OPTIONS
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = function(exports1, definition) {
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = function(obj, prop) {
13
+ return Object.prototype.hasOwnProperty.call(obj, prop);
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.r = function(exports1) {
18
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
19
+ value: 'Module'
20
+ });
21
+ Object.defineProperty(exports1, '__esModule', {
22
+ value: true
23
+ });
24
+ };
25
+ })();
26
+ var __webpack_exports__ = {};
27
+ __webpack_require__.r(__webpack_exports__);
28
+ __webpack_require__.d(__webpack_exports__, {
29
+ CSS_MODULES_LOCAL_IDENT_NAME: ()=>CSS_MODULES_LOCAL_IDENT_NAME,
30
+ CSS_MODULES_REGEX: ()=>CSS_MODULES_REGEX,
31
+ CSS_NAMED_EXPORT: ()=>CSS_NAMED_EXPORT,
32
+ DEFAULT_BROWSERSLIST: ()=>DEFAULT_BROWSERSLIST,
33
+ DEFAULT_DEV_HOST: ()=>DEFAULT_DEV_HOST,
34
+ DEV_DEFAULT_FILENAME: ()=>DEV_DEFAULT_FILENAME,
35
+ ESBUILD_TARGET: ()=>ESBUILD_TARGET,
36
+ EXPORT_LOCALS_CONVENTION: ()=>EXPORT_LOCALS_CONVENTION,
37
+ NODE_MODULES_REGEX: ()=>NODE_MODULES_REGEX,
38
+ PROD_DEFAULT_FILENAME: ()=>PROD_DEFAULT_FILENAME,
39
+ TEMPLATE_CONTENT: ()=>TEMPLATE_CONTENT,
40
+ TEMP_DIR: ()=>TEMP_DIR,
41
+ THREAD_OPTIONS: ()=>THREAD_OPTIONS
33
42
  });
34
- module.exports = __toCommonJS(constants_exports);
35
- const CSS_MODULES_LOCAL_IDENT_NAME = "[path][name]__[local]--[hash:5]";
43
+ const CSS_MODULES_LOCAL_IDENT_NAME = '[path][name]__[local]--[hash:5]';
36
44
  const CSS_MODULES_REGEX = /\.module\.\w+$/i;
37
45
  const DEV_DEFAULT_FILENAME = {
38
- js: "js/[name].js",
39
- css: "css/[name].css"
46
+ js: 'js/[name].js',
47
+ css: 'css/[name].css'
40
48
  };
41
49
  const PROD_DEFAULT_FILENAME = {
42
- js: "js/[name]_[contenthash:8].js",
43
- css: "css/[name]_[contenthash:8].css"
50
+ js: 'js/[name]_[contenthash:8].js',
51
+ css: 'css/[name]_[contenthash:8].css'
44
52
  };
45
- const EXPORT_LOCALS_CONVENTION = "camel-case-only";
46
- const TEMP_DIR = "node_modules/.unpack";
53
+ const EXPORT_LOCALS_CONVENTION = 'camel-case-only';
54
+ const TEMP_DIR = 'node_modules/.unpack';
47
55
  const NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/;
48
56
  const CSS_NAMED_EXPORT = false;
49
57
  const THREAD_OPTIONS = {
50
- workers: 2
58
+ workers: 2
51
59
  };
52
- const DEFAULT_DEV_HOST = "0.0.0.0";
53
- const DEFAULT_BROWSERSLIST = ["chrome 87", "edge 88", "firefox 78", "safari 14"];
54
- const ESBUILD_TARGET = DEFAULT_BROWSERSLIST.map((item) => item.replace(" ", ""));
55
- const TEMPLATE_CONTENT = ({ title = "", headTag = "", mountId }) => {
56
- return `<!DOCTYPE html>
60
+ const DEFAULT_DEV_HOST = '0.0.0.0';
61
+ const DEFAULT_BROWSERSLIST = [
62
+ 'chrome 87',
63
+ 'edge 88',
64
+ 'firefox 78',
65
+ 'safari 14'
66
+ ];
67
+ const ESBUILD_TARGET = DEFAULT_BROWSERSLIST.map((item)=>item.replace(' ', ''));
68
+ const TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId })=>`<!DOCTYPE html>
57
69
  <html lang="en">
58
70
 
59
71
  <head>
@@ -70,20 +82,8 @@ const TEMPLATE_CONTENT = ({ title = "", headTag = "", mountId }) => {
70
82
  </body>
71
83
 
72
84
  </html>`;
73
- };
74
- // Annotate the CommonJS export names for ESM import in node:
75
- 0 && (module.exports = {
76
- CSS_MODULES_LOCAL_IDENT_NAME,
77
- CSS_MODULES_REGEX,
78
- CSS_NAMED_EXPORT,
79
- DEFAULT_BROWSERSLIST,
80
- DEFAULT_DEV_HOST,
81
- DEV_DEFAULT_FILENAME,
82
- ESBUILD_TARGET,
83
- EXPORT_LOCALS_CONVENTION,
84
- NODE_MODULES_REGEX,
85
- PROD_DEFAULT_FILENAME,
86
- TEMPLATE_CONTENT,
87
- TEMP_DIR,
88
- THREAD_OPTIONS
85
+ var __webpack_export_target__ = exports;
86
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
87
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
88
+ value: true
89
89
  });
package/dist/constants.js CHANGED
@@ -1,34 +1,31 @@
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
- const CSS_MODULES_LOCAL_IDENT_NAME = "[path][name]__[local]--[hash:5]";
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ const CSS_MODULES_LOCAL_IDENT_NAME = '[path][name]__[local]--[hash:5]';
11
4
  const CSS_MODULES_REGEX = /\.module\.\w+$/i;
12
5
  const DEV_DEFAULT_FILENAME = {
13
- js: "js/[name].js",
14
- css: "css/[name].css"
6
+ js: 'js/[name].js',
7
+ css: 'css/[name].css'
15
8
  };
16
9
  const PROD_DEFAULT_FILENAME = {
17
- js: "js/[name]_[contenthash:8].js",
18
- css: "css/[name]_[contenthash:8].css"
10
+ js: 'js/[name]_[contenthash:8].js',
11
+ css: 'css/[name]_[contenthash:8].css'
19
12
  };
20
- const EXPORT_LOCALS_CONVENTION = "camel-case-only";
21
- const TEMP_DIR = "node_modules/.unpack";
13
+ const EXPORT_LOCALS_CONVENTION = 'camel-case-only';
14
+ const TEMP_DIR = 'node_modules/.unpack';
22
15
  const NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/;
23
16
  const CSS_NAMED_EXPORT = false;
24
17
  const THREAD_OPTIONS = {
25
- workers: 2
18
+ workers: 2
26
19
  };
27
- const DEFAULT_DEV_HOST = "0.0.0.0";
28
- const DEFAULT_BROWSERSLIST = ["chrome 87", "edge 88", "firefox 78", "safari 14"];
29
- const ESBUILD_TARGET = DEFAULT_BROWSERSLIST.map((item) => item.replace(" ", ""));
30
- const TEMPLATE_CONTENT = ({ title = "", headTag = "", mountId }) => {
31
- return `<!DOCTYPE html>
20
+ const DEFAULT_DEV_HOST = '0.0.0.0';
21
+ const DEFAULT_BROWSERSLIST = [
22
+ 'chrome 87',
23
+ 'edge 88',
24
+ 'firefox 78',
25
+ 'safari 14'
26
+ ];
27
+ const ESBUILD_TARGET = DEFAULT_BROWSERSLIST.map((item)=>item.replace(' ', ''));
28
+ const TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId })=>`<!DOCTYPE html>
32
29
  <html lang="en">
33
30
 
34
31
  <head>
@@ -45,19 +42,4 @@ const TEMPLATE_CONTENT = ({ title = "", headTag = "", mountId }) => {
45
42
  </body>
46
43
 
47
44
  </html>`;
48
- };
49
- export {
50
- CSS_MODULES_LOCAL_IDENT_NAME,
51
- CSS_MODULES_REGEX,
52
- CSS_NAMED_EXPORT,
53
- DEFAULT_BROWSERSLIST,
54
- DEFAULT_DEV_HOST,
55
- DEV_DEFAULT_FILENAME,
56
- ESBUILD_TARGET,
57
- EXPORT_LOCALS_CONVENTION,
58
- NODE_MODULES_REGEX,
59
- PROD_DEFAULT_FILENAME,
60
- TEMPLATE_CONTENT,
61
- TEMP_DIR,
62
- THREAD_OPTIONS
63
- };
45
+ export { CSS_MODULES_LOCAL_IDENT_NAME, CSS_MODULES_REGEX, CSS_NAMED_EXPORT, DEFAULT_BROWSERSLIST, DEFAULT_DEV_HOST, DEV_DEFAULT_FILENAME, ESBUILD_TARGET, EXPORT_LOCALS_CONVENTION, NODE_MODULES_REGEX, PROD_DEFAULT_FILENAME, TEMPLATE_CONTENT, TEMP_DIR, THREAD_OPTIONS };
@@ -1,111 +1,118 @@
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 createUnpack_exports = {};
29
- __export(createUnpack_exports, {
30
- createUnpack: () => createUnpack
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
+ createUnpack: ()=>createUnpack
31
43
  });
32
- module.exports = __toCommonJS(createUnpack_exports);
33
- var import_colors = __toESM(require("./colors.cjs"));
34
- var import_plugin = require("./plugin.cjs");
35
- var import_run = require("./run/index.cjs");
36
- var import_utils = require("./utils.cjs");
44
+ const external_colors_cjs_namespaceObject = require("./colors.cjs");
45
+ var external_colors_cjs_default = /*#__PURE__*/ __webpack_require__.n(external_colors_cjs_namespaceObject);
46
+ const external_plugin_cjs_namespaceObject = require("./plugin.cjs");
47
+ const index_cjs_namespaceObject = require("./run/index.cjs");
48
+ const external_utils_cjs_namespaceObject = require("./utils.cjs");
37
49
  function createUnpack() {
38
- const resolveConfig = async (unpackConfig) => {
39
- const defaultConfig = {
40
- bundler: "rspack",
41
- root: process.cwd(),
42
- build: {
43
- outDir: "dist",
44
- minify: (0, import_utils.isProd)(),
45
- sourceMap: (0, import_utils.isProd)() ? false : "cheap-module-source-map",
46
- parallel: !(0, import_utils.isDevServer)(),
47
- filenameHash: true,
48
- typeCheck: true
49
- },
50
- dev: {
51
- lazyCompilation: true
52
- },
53
- server: {
54
- port: 3e3
55
- },
56
- html: {
57
- mountId: "root"
58
- },
59
- css: {
60
- modules: true,
61
- transformer: "postcss",
62
- sourceMap: false
63
- },
64
- performance: {
65
- chunkSplit: {
66
- strategy: "split-by-experience"
67
- }
68
- }
50
+ const resolveConfig = async (unpackConfig)=>{
51
+ const defaultConfig = {
52
+ bundler: 'rspack',
53
+ root: process.cwd(),
54
+ build: {
55
+ outDir: 'dist',
56
+ minify: (0, external_utils_cjs_namespaceObject.isProd)(),
57
+ sourceMap: !(0, external_utils_cjs_namespaceObject.isProd)() && 'cheap-module-source-map',
58
+ parallel: !(0, external_utils_cjs_namespaceObject.isDevServer)(),
59
+ filenameHash: true,
60
+ typeCheck: true
61
+ },
62
+ dev: {
63
+ lazyCompilation: true
64
+ },
65
+ server: {
66
+ port: 3000
67
+ },
68
+ html: {
69
+ mountId: 'root'
70
+ },
71
+ css: {
72
+ modules: true,
73
+ transformer: 'postcss',
74
+ sourceMap: false
75
+ },
76
+ performance: {
77
+ chunkSplit: {
78
+ strategy: 'split-by-experience'
79
+ }
80
+ }
81
+ };
82
+ let { plugins, bundlerConfig, ...rest } = (0, external_utils_cjs_namespaceObject.mergeConfig)(defaultConfig, unpackConfig);
83
+ for (const plugin of (0, external_plugin_cjs_namespaceObject.getNormalizedPluginsByHook)('config', plugins))rest = await plugin.config(rest, {
84
+ mergeConfig: external_utils_cjs_namespaceObject.mergeConfig
85
+ });
86
+ return {
87
+ ...rest,
88
+ plugins,
89
+ bundlerConfig
90
+ };
69
91
  };
70
- let { plugins, bundlerConfig, ...rest } = (0, import_utils.mergeConfig)(defaultConfig, unpackConfig);
71
- for (const plugin of (0, import_plugin.getNormalizedPluginsByHook)("config", plugins)) {
72
- rest = await plugin.config(rest, { mergeConfig: import_utils.mergeConfig });
73
- }
74
92
  return {
75
- ...rest,
76
- plugins,
77
- bundlerConfig
93
+ build: async (unpackConfig)=>{
94
+ (0, external_utils_cjs_namespaceObject.setNodeEnv)('production');
95
+ console.log(external_colors_cjs_default().rainbow("unpack v1.7.6"), external_colors_cjs_default().green('building for production...'));
96
+ const config = await resolveConfig(unpackConfig);
97
+ (0, index_cjs_namespaceObject.bundlerBuild)(config);
98
+ },
99
+ serve: async (unpackConfig)=>{
100
+ global.__unpack_start_time = performance.now();
101
+ (0, external_utils_cjs_namespaceObject.setNodeEnv)('development');
102
+ (0, external_utils_cjs_namespaceObject.setDevServer)(true);
103
+ const config = await resolveConfig(unpackConfig);
104
+ (0, index_cjs_namespaceObject.bundlerDev)(config);
105
+ },
106
+ watch: async (unpackConfig)=>{
107
+ (0, external_utils_cjs_namespaceObject.setNodeEnv)('development');
108
+ console.log(external_colors_cjs_default().rainbow("unpack v1.7.6"), external_colors_cjs_default().green('building for development...'));
109
+ const config = await resolveConfig(unpackConfig);
110
+ (0, index_cjs_namespaceObject.bundlerBuild)(config);
111
+ }
78
112
  };
79
- };
80
- return {
81
- build: async (unpackConfig) => {
82
- (0, import_utils.setNodeEnv)("production");
83
- console.log(
84
- import_colors.default.rainbow(`unpack v${"1.7.5"}`),
85
- import_colors.default.green("building for production...")
86
- );
87
- const config = await resolveConfig(unpackConfig);
88
- (0, import_run.bundlerBuild)(config);
89
- },
90
- serve: async (unpackConfig) => {
91
- global.__unpack_start_time = performance.now();
92
- (0, import_utils.setNodeEnv)("development");
93
- (0, import_utils.setDevServer)(true);
94
- const config = await resolveConfig(unpackConfig);
95
- (0, import_run.bundlerDev)(config);
96
- },
97
- watch: async (unpackConfig) => {
98
- (0, import_utils.setNodeEnv)("development");
99
- console.log(
100
- import_colors.default.rainbow(`unpack v${"1.7.5"}`),
101
- import_colors.default.green("building for development...")
102
- );
103
- const config = await resolveConfig(unpackConfig);
104
- (0, import_run.bundlerBuild)(config);
105
- }
106
- };
107
113
  }
108
- // Annotate the CommonJS export names for ESM import in node:
109
- 0 && (module.exports = {
110
- createUnpack
114
+ var __webpack_export_target__ = exports;
115
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
116
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
117
+ value: true
111
118
  });