@unpackjs/core 1.6.2 → 1.6.4

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 (56) hide show
  1. package/compiled/css-loader/index.js +20 -20
  2. package/compiled/less-loader/index.js +8 -8
  3. package/compiled/postcss-loader/index.js +34 -34
  4. package/compiled/sass-loader/index.js +10 -8
  5. package/compiled/sass-loader/package.json +1 -1
  6. package/compiled/style-loader/index.js +10 -10
  7. package/dist/bundler-config/chunkSplit.cjs +39 -3
  8. package/dist/bundler-config/chunkSplit.d.ts.map +1 -1
  9. package/dist/bundler-config/chunkSplit.js +39 -3
  10. package/dist/bundler-config/experimentCss.cjs +2 -2
  11. package/dist/bundler-config/experimentCss.js +1 -1
  12. package/dist/bundler-config/helper.cjs +2 -2
  13. package/dist/bundler-config/helper.js +1 -1
  14. package/dist/bundler-config/index.cjs +8 -4
  15. package/dist/bundler-config/index.d.ts.map +1 -1
  16. package/dist/bundler-config/index.js +8 -4
  17. package/dist/constants.cjs +4 -1
  18. package/dist/constants.d.ts +1 -0
  19. package/dist/constants.d.ts.map +1 -1
  20. package/dist/constants.js +3 -1
  21. package/dist/createUnpack.cjs +3 -3
  22. package/dist/createUnpack.js +4 -4
  23. package/dist/plugin-progress/rspack.cjs +12 -11
  24. package/dist/plugin-progress/rspack.js +12 -11
  25. package/dist/plugin-progress/webpack.cjs +12 -11
  26. package/dist/plugin-progress/webpack.js +12 -11
  27. package/dist/progressBar.cjs +5 -5
  28. package/dist/progressBar.js +4 -4
  29. package/dist/run/dev.cjs +1 -1
  30. package/dist/run/dev.js +1 -1
  31. package/dist/thread-loader/worker.js +1 -1
  32. package/dist/typed-css-modules/plugin.cjs +2 -2
  33. package/dist/typed-css-modules/plugin.d.ts.map +1 -1
  34. package/dist/typed-css-modules/plugin.js +1 -1
  35. package/dist/types/chunkSplit.d.ts +1 -1
  36. package/dist/types/chunkSplit.d.ts.map +1 -1
  37. package/dist/utils.cjs +17 -10
  38. package/dist/utils.d.ts +2 -1
  39. package/dist/utils.d.ts.map +1 -1
  40. package/dist/utils.js +14 -8
  41. package/package.json +8 -17
  42. package/compiled/fast-glob/index.d.ts +0 -237
  43. package/compiled/fast-glob/index.js +0 -5726
  44. package/compiled/fast-glob/license +0 -21
  45. package/compiled/fast-glob/package.json +0 -1
  46. package/compiled/log-update/index.d.ts +0 -1
  47. package/compiled/log-update/index.js +0 -1970
  48. package/compiled/log-update/package.json +0 -1
  49. package/dist/lightningcss/index.cjs +0 -21
  50. package/dist/lightningcss/index.d.ts +0 -2
  51. package/dist/lightningcss/index.d.ts.map +0 -1
  52. package/dist/lightningcss/index.js +0 -10
  53. package/dist/typed-css-modules/index.cjs +0 -21
  54. package/dist/typed-css-modules/index.d.ts +0 -2
  55. package/dist/typed-css-modules/index.d.ts.map +0 -1
  56. package/dist/typed-css-modules/index.js +0 -10
@@ -29,9 +29,9 @@ function splitByExperience(ctx) {
29
29
  const { defaultConfig, forceSplittingGroups } = ctx;
30
30
  const experienceCacheGroup = {};
31
31
  const packageRegExps = {
32
- axios: /node_modules[\\/]axios(-.+)?[\\/]/
32
+ axios: /node_modules[\\/]axios(-.+)?[\\/]/,
33
+ polyfill: /node_modules[\\/](?:tslib|core-js|@swc[\\/]helpers)[\\/]/
33
34
  };
34
- packageRegExps.polyfill = /node_modules[\\/](?:tslib|core-js|@swc[\\/]helpers)[\\/]/;
35
35
  for (const [name, test] of Object.entries(packageRegExps)) {
36
36
  const key = `lib-${name}`;
37
37
  experienceCacheGroup[key] = {
@@ -64,6 +64,35 @@ function splitBySize(ctx) {
64
64
  }
65
65
  };
66
66
  }
67
+ const MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\/])?([^\\/]+)/;
68
+ function getPackageNameFromModulePath(modulePath) {
69
+ const handleModuleContext = modulePath?.match(MODULE_PATH_REGEX);
70
+ if (!handleModuleContext) {
71
+ return void 0;
72
+ }
73
+ const [, scope, name] = handleModuleContext;
74
+ const packageName = ["npm", (scope ?? "").replace("@", ""), name].filter(Boolean).join(".");
75
+ return packageName;
76
+ }
77
+ function splitByModule(ctx) {
78
+ const { forceSplittingGroups, defaultConfig } = ctx;
79
+ return {
80
+ ...defaultConfig,
81
+ minSize: 0,
82
+ maxInitialRequests: Number.POSITIVE_INFINITY,
83
+ cacheGroups: {
84
+ ...defaultConfig.cacheGroups,
85
+ ...forceSplittingGroups,
86
+ vendors: {
87
+ priority: -9,
88
+ test: NODE_MODULES_REGEX,
89
+ name(module) {
90
+ return module ? getPackageNameFromModulePath(module.context) : void 0;
91
+ }
92
+ }
93
+ }
94
+ };
95
+ }
67
96
  function splitCustom(ctx) {
68
97
  const { forceSplittingGroups, defaultConfig } = ctx;
69
98
  return {
@@ -75,6 +104,9 @@ function splitCustom(ctx) {
75
104
  }
76
105
  };
77
106
  }
107
+ function allInOne(_ctx) {
108
+ return false;
109
+ }
78
110
  function singleVendor(ctx) {
79
111
  const { defaultConfig, forceSplittingGroups } = ctx;
80
112
  const singleVendorCacheGroup = {
@@ -98,21 +130,25 @@ function singleVendor(ctx) {
98
130
  }
99
131
  const SPLIT_STRATEGY_DISPATCHER = {
100
132
  "split-by-experience": splitByExperience,
133
+ "split-by-module": splitByModule,
101
134
  "split-by-size": splitBySize,
102
135
  custom: splitCustom,
136
+ "all-in-one": allInOne,
103
137
  "single-vendor": singleVendor
104
138
  };
105
139
  const addChunkSplitSupport = ({
106
140
  config,
107
141
  unpackConfig
108
142
  }) => {
109
- const defaultConfig = {};
110
143
  const { chunkSplit } = unpackConfig.performance || {};
111
144
  if (chunkSplit?.strategy) {
112
145
  let forceSplittingGroups = {};
113
146
  if (chunkSplit?.forceSplitting) {
114
147
  forceSplittingGroups = getForceSplittingGroups(chunkSplit.forceSplitting);
115
148
  }
149
+ const defaultConfig = {
150
+ chunks: "all"
151
+ };
116
152
  const splitChunksOptions = SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy]({
117
153
  defaultConfig,
118
154
  forceSplittingGroups,
@@ -32,7 +32,7 @@ __export(experimentCss_exports, {
32
32
  module.exports = __toCommonJS(experimentCss_exports);
33
33
  var import_node_path = __toESM(require("node:path"));
34
34
  var import_constants = require("../constants.cjs");
35
- var import_typed_css_modules = require("../typed-css-modules/index.cjs");
35
+ var import_plugin = require("../typed-css-modules/plugin.cjs");
36
36
  var import_utils = require("../utils.cjs");
37
37
  var import_helper = require("./helper.cjs");
38
38
  function addExperimentCssSupport({
@@ -157,7 +157,7 @@ function addExperimentCssSupport({
157
157
  }
158
158
  ].filter(Boolean)
159
159
  });
160
- (0, import_utils.isDev)() && config.plugins.push(new import_typed_css_modules.PluginTypedCssModules({ modules }));
160
+ (0, import_utils.isDev)() && config.plugins.push(new import_plugin.PluginTypedCssModules({ modules }));
161
161
  return config;
162
162
  }
163
163
  // Annotate the CommonJS export names for ESM import in node:
@@ -15,7 +15,7 @@ import {
15
15
  EXPORT_LOCALS_CONVENTION,
16
16
  THREAD_OPTIONS
17
17
  } from "../constants.js";
18
- import { PluginTypedCssModules } from "../typed-css-modules/index.js";
18
+ import { PluginTypedCssModules } from "../typed-css-modules/plugin.js";
19
19
  import {
20
20
  getCompiledPkgPath,
21
21
  getUserDepPath,
@@ -34,13 +34,13 @@ module.exports = __toCommonJS(helper_exports);
34
34
  var import_node_fs = __toESM(require("node:fs"));
35
35
  var import_node_path = __toESM(require("node:path"));
36
36
  var import_utils = require("../utils.cjs");
37
+ var import_tinyglobby = require("tinyglobby");
37
38
  var import_constants = require("../constants.cjs");
38
39
  var import_logger = require("../logger.cjs");
39
- const glob = require("../../compiled/fast-glob/index.js");
40
40
  async function getEntry(root, customEntry) {
41
41
  let entry = void 0;
42
42
  if (!customEntry) {
43
- const files = await glob("(index|Index).{js,ts,jsx,tsx}", {
43
+ const files = await (0, import_tinyglobby.glob)("(index|Index).{js,ts,jsx,tsx}", {
44
44
  cwd: import_node_path.default.join(root, "src"),
45
45
  absolute: true
46
46
  });
@@ -7,10 +7,10 @@ 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
- const glob = require("../../compiled/fast-glob/index.js");
11
10
  import fs from "node:fs";
12
11
  import path2 from "node:path";
13
12
  import { isDev } from "../utils.js";
13
+ import { glob } from "tinyglobby";
14
14
  import { DEV_DEFAULT_FILENAME, PROD_DEFAULT_FILENAME } from "../constants.js";
15
15
  import { logger } from "../logger.js";
16
16
  async function getEntry(root, customEntry) {
@@ -39,7 +39,7 @@ var import_esbuild = __toESM(require("esbuild"));
39
39
  var import_esbuild_loader = require("esbuild-loader");
40
40
  var import_json5 = __toESM(require("json5"));
41
41
  var import_constants = require("../constants.cjs");
42
- var import_lightningcss = require("../lightningcss/index.cjs");
42
+ var import_minimizer = require("../lightningcss/minimizer.cjs");
43
43
  var import_logger = require("../logger.cjs");
44
44
  var import_plugin = require("../plugin.cjs");
45
45
  var import_rspack = require("../plugin-progress/rspack.cjs");
@@ -161,14 +161,18 @@ async function getBundlerConfig(unpackConfig) {
161
161
  },
162
162
  experiments: {
163
163
  lazyCompilation: (0, import_utils.isDevServer)(),
164
- css: false
164
+ css: false,
165
+ ...isRspack && (0, import_utils.isDev)() ? { incremental: true } : {}
165
166
  },
166
167
  optimization: {
167
168
  moduleIds: (0, import_utils.isDev)() ? "named" : "deterministic",
168
169
  minimize: Boolean(unpackConfig.build?.minify),
169
170
  minimizer: [
170
- new import_esbuild_loader.EsbuildPlugin({ implementation: import_esbuild.default }),
171
- new import_lightningcss.LightningcssMinifyPlugin(minifyOptions.lightningcss)
171
+ new import_esbuild_loader.EsbuildPlugin({
172
+ implementation: import_esbuild.default,
173
+ target: import_constants.ESBUILD_TARGET
174
+ }),
175
+ new import_minimizer.LightningcssMinifyPlugin(minifyOptions.lightningcss)
172
176
  ]
173
177
  },
174
178
  cache: unpackConfig.build?.cache && unpackConfig.bundler === "webpack" ? {
@@ -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,CAmKhG"}
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,CAuKhG"}
@@ -18,8 +18,8 @@ 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 { TEMPLATE_CONTENT } from "../constants.js";
22
- import { LightningcssMinifyPlugin } from "../lightningcss/index.js";
21
+ import { ESBUILD_TARGET, TEMPLATE_CONTENT } from "../constants.js";
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";
@@ -138,13 +138,17 @@ async function getBundlerConfig(unpackConfig) {
138
138
  },
139
139
  experiments: {
140
140
  lazyCompilation: isDevServer(),
141
- css: false
141
+ css: false,
142
+ ...isRspack && isDev() ? { incremental: true } : {}
142
143
  },
143
144
  optimization: {
144
145
  moduleIds: isDev() ? "named" : "deterministic",
145
146
  minimize: Boolean(unpackConfig.build?.minify),
146
147
  minimizer: [
147
- new EsbuildPlugin({ implementation: esbuild }),
148
+ new EsbuildPlugin({
149
+ implementation: esbuild,
150
+ target: ESBUILD_TARGET
151
+ }),
148
152
  new LightningcssMinifyPlugin(minifyOptions.lightningcss)
149
153
  ]
150
154
  },
@@ -23,6 +23,7 @@ __export(constants_exports, {
23
23
  DEFAULT_BROWSERSLIST: () => DEFAULT_BROWSERSLIST,
24
24
  DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
25
25
  DEV_DEFAULT_FILENAME: () => DEV_DEFAULT_FILENAME,
26
+ ESBUILD_TARGET: () => ESBUILD_TARGET,
26
27
  EXPORT_LOCALS_CONVENTION: () => EXPORT_LOCALS_CONVENTION,
27
28
  NODE_MODULES_REGEX: () => NODE_MODULES_REGEX,
28
29
  PROD_DEFAULT_FILENAME: () => PROD_DEFAULT_FILENAME,
@@ -43,13 +44,14 @@ const PROD_DEFAULT_FILENAME = {
43
44
  };
44
45
  const EXPORT_LOCALS_CONVENTION = "camel-case-only";
45
46
  const TEMP_DIR = "node_modules/.unpack";
46
- const NODE_MODULES_REGEX = /node_modules[\\/]/;
47
+ const NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/;
47
48
  const CSS_NAMED_EXPORT = false;
48
49
  const THREAD_OPTIONS = {
49
50
  workers: 2
50
51
  };
51
52
  const DEFAULT_DEV_HOST = "0.0.0.0";
52
53
  const DEFAULT_BROWSERSLIST = ["chrome 87", "edge 88", "firefox 78", "safari 14"];
54
+ const ESBUILD_TARGET = DEFAULT_BROWSERSLIST.map((item) => item.replace(" ", ""));
53
55
  const TEMPLATE_CONTENT = ({ title = "", headTag = "", mountId }) => {
54
56
  return `<!DOCTYPE html>
55
57
  <html lang="en">
@@ -77,6 +79,7 @@ const TEMPLATE_CONTENT = ({ title = "", headTag = "", mountId }) => {
77
79
  DEFAULT_BROWSERSLIST,
78
80
  DEFAULT_DEV_HOST,
79
81
  DEV_DEFAULT_FILENAME,
82
+ ESBUILD_TARGET,
80
83
  EXPORT_LOCALS_CONVENTION,
81
84
  NODE_MODULES_REGEX,
82
85
  PROD_DEFAULT_FILENAME,
@@ -17,6 +17,7 @@ export declare const THREAD_OPTIONS: {
17
17
  };
18
18
  export declare const DEFAULT_DEV_HOST = "0.0.0.0";
19
19
  export declare const DEFAULT_BROWSERSLIST: string[];
20
+ export declare const ESBUILD_TARGET: string[];
20
21
  export declare const TEMPLATE_CONTENT: ({ title, headTag, mountId }: {
21
22
  title?: string;
22
23
  headTag?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,oCAAoC,CAAA;AAC7E,eAAO,MAAM,iBAAiB,QAAoB,CAAA;AAClD,eAAO,MAAM,oBAAoB;;;CAGhC,CAAA;AACD,eAAO,MAAM,qBAAqB;;;CAGjC,CAAA;AACD,eAAO,MAAM,wBAAwB,oBAAoB,CAAA;AACzD,eAAO,MAAM,QAAQ,yBAAyB,CAAA;AAC9C,eAAO,MAAM,kBAAkB,QAAsB,CAAA;AACrD,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AACrC,eAAO,MAAM,cAAc;;CAE1B,CAAA;AACD,eAAO,MAAM,gBAAgB,YAAY,CAAA;AACzC,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAAwD,CAAA;AACjG,eAAO,MAAM,gBAAgB;;;;YAkB5B,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,oCAAoC,CAAA;AAC7E,eAAO,MAAM,iBAAiB,QAAoB,CAAA;AAClD,eAAO,MAAM,oBAAoB;;;CAGhC,CAAA;AACD,eAAO,MAAM,qBAAqB;;;CAGjC,CAAA;AACD,eAAO,MAAM,wBAAwB,oBAAoB,CAAA;AACzD,eAAO,MAAM,QAAQ,yBAAyB,CAAA;AAC9C,eAAO,MAAM,kBAAkB,QAA2B,CAAA;AAC1D,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AACrC,eAAO,MAAM,cAAc;;CAE1B,CAAA;AACD,eAAO,MAAM,gBAAgB,YAAY,CAAA;AACzC,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAAwD,CAAA;AACjG,eAAO,MAAM,cAAc,EAAE,MAAM,EAA8D,CAAA;AACjG,eAAO,MAAM,gBAAgB;;;;YAkB5B,CAAA"}
package/dist/constants.js CHANGED
@@ -19,13 +19,14 @@ const PROD_DEFAULT_FILENAME = {
19
19
  };
20
20
  const EXPORT_LOCALS_CONVENTION = "camel-case-only";
21
21
  const TEMP_DIR = "node_modules/.unpack";
22
- const NODE_MODULES_REGEX = /node_modules[\\/]/;
22
+ const NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/;
23
23
  const CSS_NAMED_EXPORT = false;
24
24
  const THREAD_OPTIONS = {
25
25
  workers: 2
26
26
  };
27
27
  const DEFAULT_DEV_HOST = "0.0.0.0";
28
28
  const DEFAULT_BROWSERSLIST = ["chrome 87", "edge 88", "firefox 78", "safari 14"];
29
+ const ESBUILD_TARGET = DEFAULT_BROWSERSLIST.map((item) => item.replace(" ", ""));
29
30
  const TEMPLATE_CONTENT = ({ title = "", headTag = "", mountId }) => {
30
31
  return `<!DOCTYPE html>
31
32
  <html lang="en">
@@ -52,6 +53,7 @@ export {
52
53
  DEFAULT_BROWSERSLIST,
53
54
  DEFAULT_DEV_HOST,
54
55
  DEV_DEFAULT_FILENAME,
56
+ ESBUILD_TARGET,
55
57
  EXPORT_LOCALS_CONVENTION,
56
58
  NODE_MODULES_REGEX,
57
59
  PROD_DEFAULT_FILENAME,
@@ -43,7 +43,7 @@ function createUnpack() {
43
43
  outDir: "dist",
44
44
  minify: (0, import_utils.isProd)(),
45
45
  sourceMap: (0, import_utils.isProd)() ? false : "cheap-module-source-map",
46
- parallel: true,
46
+ parallel: !(0, import_utils.isDevServer)(),
47
47
  filenameHash: true,
48
48
  cache: (0, import_utils.isDev)()
49
49
  },
@@ -73,7 +73,7 @@ function createUnpack() {
73
73
  build: async (unpackConfig) => {
74
74
  (0, import_utils.setNodeEnv)("production");
75
75
  console.log(
76
- import_colors.default.rainbow(`unpack v${"1.6.2"}`),
76
+ import_colors.default.rainbow(`unpack v${"1.6.4"}`),
77
77
  import_colors.default.green("building for production...")
78
78
  );
79
79
  const config = await resolveConfig(unpackConfig);
@@ -89,7 +89,7 @@ function createUnpack() {
89
89
  watch: async (unpackConfig) => {
90
90
  (0, import_utils.setNodeEnv)("development");
91
91
  console.log(
92
- import_colors.default.rainbow(`unpack v${"1.6.2"}`),
92
+ import_colors.default.rainbow(`unpack v${"1.6.4"}`),
93
93
  import_colors.default.green("building for development...")
94
94
  );
95
95
  const config = await resolveConfig(unpackConfig);
@@ -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 { isDev, isProd, mergeConfig, setDevServer, setNodeEnv } from "./utils.js";
13
+ import { isDev, isDevServer, isProd, mergeConfig, setDevServer, setNodeEnv } from "./utils.js";
14
14
  function createUnpack() {
15
15
  const resolveConfig = async (unpackConfig) => {
16
16
  const defaultConfig = {
@@ -20,7 +20,7 @@ function createUnpack() {
20
20
  outDir: "dist",
21
21
  minify: isProd(),
22
22
  sourceMap: isProd() ? false : "cheap-module-source-map",
23
- parallel: true,
23
+ parallel: !isDevServer(),
24
24
  filenameHash: true,
25
25
  cache: isDev()
26
26
  },
@@ -50,7 +50,7 @@ function createUnpack() {
50
50
  build: async (unpackConfig) => {
51
51
  setNodeEnv("production");
52
52
  console.log(
53
- colors.rainbow(`unpack v${"1.6.2"}`),
53
+ colors.rainbow(`unpack v${"1.6.4"}`),
54
54
  colors.green("building for production...")
55
55
  );
56
56
  const config = await resolveConfig(unpackConfig);
@@ -66,7 +66,7 @@ function createUnpack() {
66
66
  watch: async (unpackConfig) => {
67
67
  setNodeEnv("development");
68
68
  console.log(
69
- colors.rainbow(`unpack v${"1.6.2"}`),
69
+ colors.rainbow(`unpack v${"1.6.4"}`),
70
70
  colors.green("building for development...")
71
71
  );
72
72
  const config = await resolveConfig(unpackConfig);
@@ -52,17 +52,18 @@ class RspackPluginProgress extends import_core.rspack.ProgressPlugin {
52
52
  !(0, import_utils.isProd)() && import_logger.logger.wait("building...");
53
53
  });
54
54
  compiler.hooks.done.tap(PLUGIN_NAME, async (stats) => {
55
- if (this.startTime) {
56
- const hrtime = process.hrtime(this.startTime);
57
- const compileTime = hrtime[0] + hrtime[1] / 1e9;
58
- this.startTime = void 0;
59
- if (!stats.hasErrors()) {
60
- if ((0, import_utils.isProd)()) {
61
- await (0, import_reporter.printFileSize)({ root: compiler.options.context, stats });
62
- console.log(import_colors.default.green(`✓ built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`));
63
- } else {
64
- import_logger.logger.ready(`built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`);
65
- }
55
+ if (!this.startTime)
56
+ return;
57
+ (0, import_utils.isProd)() && this.progressBar.done();
58
+ const hrtime = process.hrtime(this.startTime);
59
+ const compileTime = hrtime[0] + hrtime[1] / 1e9;
60
+ this.startTime = void 0;
61
+ if (!stats.hasErrors()) {
62
+ if ((0, import_utils.isProd)()) {
63
+ await (0, import_reporter.printFileSize)({ root: compiler.options.context, stats });
64
+ console.log(import_colors.default.green(`✓ built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`));
65
+ } else {
66
+ import_logger.logger.ready(`built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`);
66
67
  }
67
68
  }
68
69
  });
@@ -29,17 +29,18 @@ class RspackPluginProgress extends rspack.ProgressPlugin {
29
29
  !isProd() && logger.wait("building...");
30
30
  });
31
31
  compiler.hooks.done.tap(PLUGIN_NAME, async (stats) => {
32
- if (this.startTime) {
33
- const hrtime = process.hrtime(this.startTime);
34
- const compileTime = hrtime[0] + hrtime[1] / 1e9;
35
- this.startTime = void 0;
36
- if (!stats.hasErrors()) {
37
- if (isProd()) {
38
- await printFileSize({ root: compiler.options.context, stats });
39
- console.log(colors.green(`✓ built in ${colors.bold(prettyTime(compileTime))}`));
40
- } else {
41
- logger.ready(`built in ${colors.bold(prettyTime(compileTime))}`);
42
- }
32
+ if (!this.startTime)
33
+ return;
34
+ isProd() && this.progressBar.done();
35
+ const hrtime = process.hrtime(this.startTime);
36
+ const compileTime = hrtime[0] + hrtime[1] / 1e9;
37
+ this.startTime = void 0;
38
+ if (!stats.hasErrors()) {
39
+ if (isProd()) {
40
+ await printFileSize({ root: compiler.options.context, stats });
41
+ console.log(colors.green(`✓ built in ${colors.bold(prettyTime(compileTime))}`));
42
+ } else {
43
+ logger.ready(`built in ${colors.bold(prettyTime(compileTime))}`);
43
44
  }
44
45
  }
45
46
  });
@@ -62,17 +62,18 @@ class WebpackPluginProgress extends import_webpack.default.ProgressPlugin {
62
62
  !(0, import_utils.isProd)() && import_logger.logger.wait("building...");
63
63
  });
64
64
  compiler.hooks.done.tap(PLUGIN_NAME, async (stats) => {
65
- if (this.startTime) {
66
- const hrtime = process.hrtime(this.startTime);
67
- const compileTime = hrtime[0] + hrtime[1] / 1e9;
68
- this.startTime = void 0;
69
- if (!stats.hasErrors()) {
70
- if ((0, import_utils.isProd)()) {
71
- await (0, import_reporter.printFileSize)({ root: compiler.options.context, stats });
72
- console.log(import_colors.default.green(`✓ built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`));
73
- } else {
74
- import_logger.logger.ready(`built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`);
75
- }
65
+ if (!this.startTime)
66
+ return;
67
+ (0, import_utils.isProd)() && this.progressBar.done();
68
+ const hrtime = process.hrtime(this.startTime);
69
+ const compileTime = hrtime[0] + hrtime[1] / 1e9;
70
+ this.startTime = void 0;
71
+ if (!stats.hasErrors()) {
72
+ if ((0, import_utils.isProd)()) {
73
+ await (0, import_reporter.printFileSize)({ root: compiler.options.context, stats });
74
+ console.log(import_colors.default.green(`✓ built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`));
75
+ } else {
76
+ import_logger.logger.ready(`built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`);
76
77
  }
77
78
  }
78
79
  });
@@ -39,17 +39,18 @@ class WebpackPluginProgress extends webpack.ProgressPlugin {
39
39
  !isProd() && logger.wait("building...");
40
40
  });
41
41
  compiler.hooks.done.tap(PLUGIN_NAME, async (stats) => {
42
- if (this.startTime) {
43
- const hrtime = process.hrtime(this.startTime);
44
- const compileTime = hrtime[0] + hrtime[1] / 1e9;
45
- this.startTime = void 0;
46
- if (!stats.hasErrors()) {
47
- if (isProd()) {
48
- await printFileSize({ root: compiler.options.context, stats });
49
- console.log(colors.green(`✓ built in ${colors.bold(prettyTime(compileTime))}`));
50
- } else {
51
- logger.ready(`built in ${colors.bold(prettyTime(compileTime))}`);
52
- }
42
+ if (!this.startTime)
43
+ return;
44
+ isProd() && this.progressBar.done();
45
+ const hrtime = process.hrtime(this.startTime);
46
+ const compileTime = hrtime[0] + hrtime[1] / 1e9;
47
+ this.startTime = void 0;
48
+ if (!stats.hasErrors()) {
49
+ if (isProd()) {
50
+ await printFileSize({ root: compiler.options.context, stats });
51
+ console.log(colors.green(`✓ built in ${colors.bold(prettyTime(compileTime))}`));
52
+ } else {
53
+ logger.ready(`built in ${colors.bold(prettyTime(compileTime))}`);
53
54
  }
54
55
  }
55
56
  });
@@ -31,7 +31,7 @@ __export(progressBar_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(progressBar_exports);
33
33
  var import_colors = __toESM(require("./colors.cjs"));
34
- const logUpdate = require("../compiled/log-update/index.js");
34
+ var import_utils = require("./utils.cjs");
35
35
  class ProgressBar {
36
36
  constructor() {
37
37
  this.options = {
@@ -43,7 +43,7 @@ class ProgressBar {
43
43
  }
44
44
  update({ current: originalCurrent, message = "" }) {
45
45
  const { columns: terminalWidth } = process.stdout;
46
- const messageWidth = terminalWidth - this.options.width - this.options.prefix.length - 7;
46
+ const messageWidth = terminalWidth - this.options.width - this.options.prefix.length - 8;
47
47
  let current = originalCurrent;
48
48
  if (originalCurrent >= 0.98) {
49
49
  current = 1;
@@ -54,14 +54,14 @@ class ProgressBar {
54
54
  const undone = import_colors.default.dim(this.options.char).repeat(undoneWidth);
55
55
  const bar = `${done}${undone}`;
56
56
  const prefix = this.options.prefix ? `${import_colors.default.bold(this.options.prefix)} ` : "";
57
- logUpdate(
57
+ (0, import_utils.logUpdate)(
58
58
  `${prefix}${bar} (${Math.floor(
59
59
  current * 100
60
- )}%) ${import_colors.default.dim(message.slice(0, messageWidth))}`
60
+ )}%) ${import_colors.default.dim(message.slice(0, messageWidth).padEnd(messageWidth, " "))}`
61
61
  );
62
62
  }
63
63
  done() {
64
- logUpdate.done();
64
+ console.log();
65
65
  }
66
66
  }
67
67
  // Annotate the CommonJS export names for ESM import in node:
@@ -8,7 +8,7 @@ var getDirname = () => path.dirname(getFilename());
8
8
  var __dirname = /* @__PURE__ */ getDirname();
9
9
  var __filename = /* @__PURE__ */ getFilename();
10
10
  import colors from "./colors.js";
11
- const logUpdate = require("../compiled/log-update/index.js");
11
+ import { logUpdate } from "./utils.js";
12
12
  class ProgressBar {
13
13
  constructor() {
14
14
  this.options = {
@@ -20,7 +20,7 @@ class ProgressBar {
20
20
  }
21
21
  update({ current: originalCurrent, message = "" }) {
22
22
  const { columns: terminalWidth } = process.stdout;
23
- const messageWidth = terminalWidth - this.options.width - this.options.prefix.length - 7;
23
+ const messageWidth = terminalWidth - this.options.width - this.options.prefix.length - 8;
24
24
  let current = originalCurrent;
25
25
  if (originalCurrent >= 0.98) {
26
26
  current = 1;
@@ -34,11 +34,11 @@ class ProgressBar {
34
34
  logUpdate(
35
35
  `${prefix}${bar} (${Math.floor(
36
36
  current * 100
37
- )}%) ${colors.dim(message.slice(0, messageWidth))}`
37
+ )}%) ${colors.dim(message.slice(0, messageWidth).padEnd(messageWidth, " "))}`
38
38
  );
39
39
  }
40
40
  done() {
41
- logUpdate.done();
41
+ console.log();
42
42
  }
43
43
  }
44
44
  export {
package/dist/run/dev.cjs CHANGED
@@ -55,7 +55,7 @@ async function bundlerDev(unpackConfig) {
55
55
  const server = new import_webpack_dev_server.default(devServerOptions, compiler);
56
56
  await server.start();
57
57
  import_logger.logger.greet(
58
- ` ${import_colors.default.green(`${import_colors.default.bold("UNPACK")} v${"1.6.2"}`)} ${import_colors.default.dim(
58
+ ` ${import_colors.default.green(`${import_colors.default.bold("UNPACK")} v${"1.6.4"}`)} ${import_colors.default.dim(
59
59
  `ready in ${import_colors.default.reset(
60
60
  import_colors.default.bold(Math.ceil(performance.now() - global.__unpack_start_time))
61
61
  )} ms`
package/dist/run/dev.js CHANGED
@@ -32,7 +32,7 @@ async function bundlerDev(unpackConfig) {
32
32
  const server = new WebpackDevServer(devServerOptions, compiler);
33
33
  await server.start();
34
34
  logger.greet(
35
- ` ${colors.green(`${colors.bold("UNPACK")} v${"1.6.2"}`)} ${colors.dim(
35
+ ` ${colors.green(`${colors.bold("UNPACK")} v${"1.6.4"}`)} ${colors.dim(
36
36
  `ready in ${colors.reset(
37
37
  colors.bold(Math.ceil(performance.now() - global.__unpack_start_time))
38
38
  )} ms`
@@ -12,7 +12,7 @@ import path from "path";
12
12
  import { fileURLToPath } from "url";
13
13
  var getFilename, getDirname, __dirname, __filename;
14
14
  var init_esm = __esm({
15
- "../../node_modules/.pnpm/@modern-js+module-tools@2.60.5_typescript@5.5.4/node_modules/@modern-js/module-tools/shims/esm.js"() {
15
+ "../../node_modules/.pnpm/@modern-js+module-tools@2.61.0_typescript@5.6.3/node_modules/@modern-js/module-tools/shims/esm.js"() {
16
16
  getFilename = () => fileURLToPath(import.meta.url);
17
17
  getDirname = () => path.dirname(getFilename());
18
18
  __dirname = /* @__PURE__ */ getDirname();
@@ -33,9 +33,9 @@ module.exports = __toCommonJS(plugin_exports);
33
33
  var import_node_fs = __toESM(require("node:fs"));
34
34
  var import_constants = require("../constants.cjs");
35
35
  var import_logger = require("../logger.cjs");
36
+ var import_tinyglobby = require("tinyglobby");
36
37
  var import_typed_css_modules = __toESM(require("typed-css-modules"));
37
38
  var import_utils = require("./utils.cjs");
38
- const glob = require("../../compiled/fast-glob/index.js");
39
39
  const statPromise = import_node_fs.default.promises.stat;
40
40
  async function writeFile(dtsCreator, cssFile) {
41
41
  const content = await dtsCreator.create(cssFile, void 0, true);
@@ -82,7 +82,7 @@ class PluginTypedCssModules {
82
82
  });
83
83
  }
84
84
  async generateCssTypings(incremental) {
85
- const files = await glob(this.globPattern);
85
+ const files = await (0, import_tinyglobby.glob)(this.globPattern);
86
86
  const cssModulesFiles = files.filter((file) => {
87
87
  return (0, import_utils.isCSSModules)({ resourcePath: file, modules: this.userOptions?.modules });
88
88
  });
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/typed-css-modules/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AA2BvC,KAAK,4BAA4B,GAAG;IAClC,OAAO,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAA;CACzC,CAAA;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,WAAW,CAA6B;IAChD,WAAW,EAAE,4BAA4B,CAAA;gBAE7B,OAAO,EAAE,4BAA4B;IAQjD,KAAK,CAAC,QAAQ,EAAE,QAAQ;YAmBV,kBAAkB;CAQjC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/typed-css-modules/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAGnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AA2BvC,KAAK,4BAA4B,GAAG;IAClC,OAAO,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAA;CACzC,CAAA;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,WAAW,CAA6B;IAChD,WAAW,EAAE,4BAA4B,CAAA;gBAE7B,OAAO,EAAE,4BAA4B;IAQjD,KAAK,CAAC,QAAQ,EAAE,QAAQ;YAmBV,kBAAkB;CAQjC"}
@@ -8,9 +8,9 @@ var getDirname = () => path.dirname(getFilename());
8
8
  var __dirname = /* @__PURE__ */ getDirname();
9
9
  var __filename = /* @__PURE__ */ getFilename();
10
10
  import fs from "node:fs";
11
- const glob = require("../../compiled/fast-glob/index.js");
12
11
  import { CSS_NAMED_EXPORT } from "../constants.js";
13
12
  import { logger } from "../logger.js";
13
+ import { glob } from "tinyglobby";
14
14
  import DtsCreator from "typed-css-modules";
15
15
  import { isCSSModules } from "./utils.js";
16
16
  const statPromise = fs.promises.stat;
@@ -20,7 +20,7 @@ export interface BaseSplitRules {
20
20
  forceSplitting?: ForceSplitting;
21
21
  }
22
22
  export interface BaseChunkSplit extends BaseSplitRules {
23
- strategy?: 'split-by-experience' | 'single-vendor';
23
+ strategy?: 'split-by-module' | 'split-by-experience' | 'all-in-one' | 'single-vendor';
24
24
  }
25
25
  export interface SplitBySize extends BaseSplitRules {
26
26
  strategy: 'split-by-size';
@@ -1 +1 @@
1
- {"version":3,"file":"chunkSplit.d.ts","sourceRoot":"","sources":["../../src/types/chunkSplit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG,oBAAoB,SAAS;IACrD,YAAY,CAAC,EAAE;QACb,WAAW,CAAC,EAAE,MAAM,CAAC,CAAA;KACtB,CAAA;CACF,GACG,CAAC,GACD,KAAK,CAAA;AAET,MAAM,MAAM,WAAW,GAAG,oBAAoB,SAAS;IACrD,YAAY,CAAC,EAAE;QACb,WAAW,CAAC,EACR;YACE,WAAW,CAAC,EAAE,MAAM,CAAC,CAAA;SACtB,GACD,KAAK,CAAA;KACV,CAAA;CACF,GACG,CAAC,GACD,KAAK,CAAA;AAET,MAAM,MAAM,UAAU,GAAG,WAAW,SAAS;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;CACvB,GACG,CAAC,GACD,IAAI,CAAA;AAER,MAAM,MAAM,cAAc,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE9D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,cAAc,CAAA;CAChC;AAED,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,QAAQ,CAAC,EAAE,qBAAqB,GAAG,eAAe,CAAA;CACnD;AAED,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,QAAQ,EAAE,QAAQ,CAAA;IAClB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,WAAW,GAAG,WAAW,CAAA"}
1
+ {"version":3,"file":"chunkSplit.d.ts","sourceRoot":"","sources":["../../src/types/chunkSplit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG,oBAAoB,SAAS;IACrD,YAAY,CAAC,EAAE;QACb,WAAW,CAAC,EAAE,MAAM,CAAC,CAAA;KACtB,CAAA;CACF,GACG,CAAC,GACD,KAAK,CAAA;AAET,MAAM,MAAM,WAAW,GAAG,oBAAoB,SAAS;IACrD,YAAY,CAAC,EAAE;QACb,WAAW,CAAC,EACR;YACE,WAAW,CAAC,EAAE,MAAM,CAAC,CAAA;SACtB,GACD,KAAK,CAAA;KACV,CAAA;CACF,GACG,CAAC,GACD,KAAK,CAAA;AAET,MAAM,MAAM,UAAU,GAAG,WAAW,SAAS;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;CACvB,GACG,CAAC,GACD,IAAI,CAAA;AAER,MAAM,MAAM,cAAc,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE9D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,cAAc,CAAA;CAChC;AAED,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,QAAQ,CAAC,EAAE,iBAAiB,GAAG,qBAAqB,GAAG,YAAY,GAAG,eAAe,CAAA;CACtF;AAED,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,QAAQ,EAAE,QAAQ,CAAA;IAClB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,WAAW,GAAG,WAAW,CAAA"}