@unpackjs/core 3.3.6 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -52,6 +52,7 @@ for(var __webpack_i__ in (()=>{
52
52
  isWatch: ()=>isWatch,
53
53
  DEFAULT_DEV_HOST: ()=>DEFAULT_DEV_HOST,
54
54
  isDev: ()=>isDev,
55
+ hexColor: ()=>hexColor,
55
56
  isRegExp: ()=>isRegExp,
56
57
  cleanUpBeforeRestart: ()=>cleanUpBeforeRestart,
57
58
  currentDevUnpackConfig: ()=>currentDevUnpackConfig,
@@ -106,15 +107,26 @@ for(var __webpack_i__ in (()=>{
106
107
  getUserDepPath: ()=>getUserDepPath,
107
108
  isString: ()=>isString
108
109
  });
109
- let core_namespaceObject = require("@rspack/core"), external_picocolors_namespaceObject = require("picocolors"), colors = {
110
- ...__webpack_require__.n(external_picocolors_namespaceObject)(),
111
- rainbow: (input)=>{
112
- let isWord = (char)=>!/[\s\n]/.test(char), chars = [
113
- ...input
114
- ], steps = chars.filter(isWord).length, r = 97, g = 193, b = 198, rStep = -49 / steps, gStep = -81 / steps, bStep = 0 / steps, output = '';
115
- for (let char of chars)isWord(char) && (r += rStep, g += gStep, b += bStep), output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
116
- return output;
110
+ let core_namespaceObject = require("@rspack/core"), hexColor = (hex)=>{
111
+ let r, g, b, value = (hex || '').trim().replace(/^#/, '');
112
+ if (/^[0-9a-fA-F]{3}$/.test(value)) r = Number.parseInt(value[0] + value[0], 16), g = Number.parseInt(value[1] + value[1], 16), b = Number.parseInt(value[2] + value[2], 16);
113
+ else {
114
+ if (!/^[0-9a-fA-F]{6}$/.test(value)) return (input)=>String(input);
115
+ r = Number.parseInt(value.slice(0, 2), 16), g = Number.parseInt(value.slice(2, 4), 16), b = Number.parseInt(value.slice(4, 6), 16);
117
116
  }
117
+ let prefix = `\x1b[38;2;${r};${g};${b}m`;
118
+ return (input)=>`${prefix}${input}\x1b[39m`;
119
+ }, colors = {
120
+ brand: hexColor('#b39aff'),
121
+ red: hexColor('#F38BA8'),
122
+ green: hexColor('#A6E3A1'),
123
+ yellow: hexColor('#F9E2AF'),
124
+ blue: hexColor('#89B4FA'),
125
+ magenta: hexColor('#CBA6F7'),
126
+ cyan: hexColor('#89DCEB'),
127
+ gray: hexColor('#6C7086'),
128
+ bold: (input)=>`\x1b[1m${input}\x1b[22m`,
129
+ dim: (input)=>`\x1b[2m${input}\x1b[22m`
118
130
  }, restartCleaners = [], addRestartCleaner = (...cleaners)=>{
119
131
  restartCleaners.push(...cleaners);
120
132
  }, cleanUpBeforeRestart = async ()=>{
@@ -378,7 +390,7 @@ for(var __webpack_i__ in (()=>{
378
390
  }
379
391
  }
380
392
  }
381
- ].filter(Boolean), colorPrefix = colors.green(colors.dim('➜'));
393
+ ].filter(Boolean), colorPrefix = colors.brand(colors.dim('➜'));
382
394
  help && console.log(!0 === help ? ` ${colorPrefix} ${colors.dim('press')} ${colors.bold('h + enter')} ${colors.dim('to show help')}` : ` ${colorPrefix} ${help}`);
383
395
  let { createInterface } = await import("node:readline"), rl = createInterface({
384
396
  input: process.stdin
@@ -723,7 +735,7 @@ for(var __webpack_i__ in (()=>{
723
735
  apply(compiler) {
724
736
  let meta = JSON.stringify({
725
737
  name: jsMinify_PLUGIN_NAME,
726
- version: "3.3.6",
738
+ version: "3.4.0",
727
739
  options: this.minifyOptions
728
740
  });
729
741
  compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
@@ -944,16 +956,16 @@ for(var __webpack_i__ in (()=>{
944
956
  }).join(', ');
945
957
  return files.length > 1 ? `${fileInfo} and ${files.length - 1} more` : fileInfo;
946
958
  }
947
- let sameCount = 0;
948
- async function compileDone(compiler, stats) {
949
- let compileTime = stats.toJson({
959
+ let getCompileTime = (stats)=>stats.toJson({
950
960
  preset: 'errors-only',
951
961
  timings: !0
952
- }).time / 1000, root = compiler.options.context;
962
+ }).time / 1000, sameCount = 0;
963
+ async function compileDone(compiler, stats) {
964
+ let root = compiler.options.context;
953
965
  if (!stats.hasErrors()) if (isProd()) isCI() || await printFileSize({
954
966
  root,
955
967
  stats
956
- }), logger_logger.ready(colors.green(`built in ${prettyTime(compileTime)}`));
968
+ }), logger_logger.ready(colors.green(`built in ${prettyTime(getCompileTime(stats))}`));
957
969
  else {
958
970
  let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null, fileInfo = function(changedFiles, removedFiles, root) {
959
971
  if (!changedFiles?.length && !removedFiles?.length) return null;
@@ -977,7 +989,7 @@ for(var __webpack_i__ in (()=>{
977
989
  logger_logger.debug(`${colors.cyan(packageName)}: ${colors.yellow(count)} modules`);
978
990
  });
979
991
  }
980
- isDebug() || logger_logger.clear(), console.log(colors.dim(getTime()), colors.cyan(colors.bold(`[${global.__unpack_caller_name}]`)), colors.green(utils_isDevServer() ? 'hmr update' : 'build'), `${colors.dim(fileInfo)}${sameCount > 1 ? ` ${colors.yellow(`(x${sameCount})`)}` : ''}`, isDebug() ? colors.dim(`| ${prettyTime(compileTime)} (${stats.compilation.modules.size} modules)`) : '');
992
+ isDebug() || logger_logger.clear(), console.log(colors.dim(getTime()), colors.cyan(`[${global.__unpack_caller_name}]`), colors.brand(utils_isDevServer() ? 'hmr update' : 'build'), `${colors.dim(fileInfo)}${sameCount > 1 ? ` ${colors.yellow(`(x${sameCount})`)}` : ''}`, isDebug() ? colors.dim(`| ${prettyTime(getCompileTime(stats))} (${stats.compilation.modules.size} modules)`) : '');
981
993
  }
982
994
  }
983
995
  let progress_PLUGIN_NAME = 'ProgressPlugin';
@@ -1234,7 +1246,10 @@ for(var __webpack_i__ in (()=>{
1234
1246
  ]
1235
1247
  },
1236
1248
  watchOptions: {
1237
- ignored: /[\\/](?:\.git|node_modules)[\\/]/
1249
+ aggregateTimeout: 0
1250
+ },
1251
+ performance: {
1252
+ hints: !1
1238
1253
  }
1239
1254
  };
1240
1255
  for (let plugin of (config = (({ config, unpackConfig })=>{
@@ -1905,7 +1920,7 @@ for(var __webpack_i__ in (()=>{
1905
1920
  req.headers.accept?.includes('html') && (req.url = '/index.html'), next();
1906
1921
  }), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
1907
1922
  let server = new dev_server_namespaceObject.RspackDevServer(devServerOptions, compiler);
1908
- await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.3.6`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - global.__unpack_start_time))} ms\n`), printAddressUrls(port, unpackConfig.server?.host), addRestartCleaner(()=>server.stop(), ()=>new Promise((resolve)=>compiler.close(()=>resolve())));
1923
+ await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.4.0`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - global.__unpack_start_time))} ${colors.dim('ms')}\n`), printAddressUrls(port, unpackConfig.server?.host), addRestartCleaner(()=>server.stop(), ()=>new Promise((resolve)=>compiler.close(()=>resolve())));
1909
1924
  let open = unpackConfig.server?.open, url = isString(open) ? open : `http://localhost:${port}`;
1910
1925
  open && openBrowser(url), setupCliShortcuts({
1911
1926
  openPage: async ()=>{
@@ -1928,7 +1943,7 @@ for(var __webpack_i__ in (()=>{
1928
1943
  function printAddressUrls(port, host) {
1929
1944
  let addressUrls = getAddressUrls({
1930
1945
  port
1931
- }), colorPrefix = colors.green('➜');
1946
+ }), colorPrefix = colors.brand('➜');
1932
1947
  addressUrls.forEach((addr, index)=>{
1933
1948
  let url;
1934
1949
  if (!host && 0 !== index) {
@@ -1978,7 +1993,7 @@ for(var __webpack_i__ in (()=>{
1978
1993
  ...mergeConfig(defaultConfig, config),
1979
1994
  _context: {
1980
1995
  callerName,
1981
- version: "3.3.6"
1996
+ version: "3.4.0"
1982
1997
  }
1983
1998
  };
1984
1999
  };
@@ -1986,7 +2001,7 @@ for(var __webpack_i__ in (()=>{
1986
2001
  build: async ({ watch } = {})=>{
1987
2002
  setNodeEnv(watch ? 'development' : 'production');
1988
2003
  let config = resolveConfig();
1989
- console.log(colors.rainbow(`${callerName} v3.3.6`), colors.green(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
2004
+ console.log(colors.brand(`${callerName} v3.4.0`), colors.cyan(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
1990
2005
  },
1991
2006
  dev: async ()=>{
1992
2007
  global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
@@ -2013,7 +2028,7 @@ for(var __webpack_i__ in (()=>{
2013
2028
  ...options
2014
2029
  });
2015
2030
  }
2016
- })(), exports.CSS_MODULES_LOCAL_IDENT_NAME = __webpack_exports__.CSS_MODULES_LOCAL_IDENT_NAME, exports.CSS_MODULES_REGEX = __webpack_exports__.CSS_MODULES_REGEX, exports.CSS_NAMED_EXPORT = __webpack_exports__.CSS_NAMED_EXPORT, exports.DEFAULT_DEV_HOST = __webpack_exports__.DEFAULT_DEV_HOST, exports.DEV_DEFAULT_FILENAME = __webpack_exports__.DEV_DEFAULT_FILENAME, exports.EXPORT_LOCALS_CONVENTION = __webpack_exports__.EXPORT_LOCALS_CONVENTION, exports.LogColor = __webpack_exports__.LogColor, exports.NODE_MODULES_REGEX = __webpack_exports__.NODE_MODULES_REGEX, exports.PROD_DEFAULT_FILENAME = __webpack_exports__.PROD_DEFAULT_FILENAME, exports.TEMPLATE_CONTENT = __webpack_exports__.TEMPLATE_CONTENT, exports.TEMP_DIR = __webpack_exports__.TEMP_DIR, exports.THREAD_OPTIONS = __webpack_exports__.THREAD_OPTIONS, exports.addRestartCleaner = __webpack_exports__.addRestartCleaner, exports.cleanUpBeforeRestart = __webpack_exports__.cleanUpBeforeRestart, exports.clearLine = __webpack_exports__.clearLine, exports.colors = __webpack_exports__.colors, exports.createChokidar = __webpack_exports__.createChokidar, exports.createUnpack = __webpack_exports__.createUnpack, exports.currentDevUnpackConfig = __webpack_exports__.currentDevUnpackConfig, exports.debounce = __webpack_exports__.debounce, exports.defineConfig = __webpack_exports__.defineConfig, exports.esVersionToBrowserslist = __webpack_exports__.esVersionToBrowserslist, exports.findExists = __webpack_exports__.findExists, exports.getAddressUrls = __webpack_exports__.getAddressUrls, exports.getCompiledPkgPath = __webpack_exports__.getCompiledPkgPath, exports.getIpv4Interfaces = __webpack_exports__.getIpv4Interfaces, exports.getNodeEnv = __webpack_exports__.getNodeEnv, exports.getPathInJs = __webpack_exports__.getPathInJs, exports.getPort = __webpack_exports__.getPort, exports.getTime = __webpack_exports__.getTime, exports.getUserDepPath = __webpack_exports__.getUserDepPath, exports.getUserDepVersion = __webpack_exports__.getUserDepVersion, exports.getValueByPath = __webpack_exports__.getValueByPath, exports.isBoolean = __webpack_exports__.isBoolean, exports.isCI = __webpack_exports__.isCI, exports.isCSSModules = __webpack_exports__.isCSSModules, exports.isDebug = __webpack_exports__.isDebug, exports.isDev = __webpack_exports__.isDev, exports.isDevServer = __webpack_exports__.isDevServer, exports.isEmptyDir = __webpack_exports__.isEmptyDir, exports.isFileExists = __webpack_exports__.isFileExists, exports.isFileSync = __webpack_exports__.isFileSync, exports.isFunction = __webpack_exports__.isFunction, exports.isNodeVersionAtLeast = __webpack_exports__.isNodeVersionAtLeast, exports.isObject = __webpack_exports__.isObject, exports.isPlainObject = __webpack_exports__.isPlainObject, exports.isProd = __webpack_exports__.isProd, exports.isRegExp = __webpack_exports__.isRegExp, exports.isString = __webpack_exports__.isString, exports.isUndefined = __webpack_exports__.isUndefined, exports.isWatch = __webpack_exports__.isWatch, exports.isWin = __webpack_exports__.isWin, exports.launchEditor = __webpack_exports__.launchEditor, exports.loadConfig = __webpack_exports__.loadConfig, exports.logUpdate = __webpack_exports__.logUpdate, exports.logger = __webpack_exports__.logger, exports.mergeConfig = __webpack_exports__.mergeConfig, exports.pathExists = __webpack_exports__.pathExists, exports.prettyTime = __webpack_exports__.prettyTime, exports.removeDir = __webpack_exports__.removeDir, exports.resolveConfigPath = __webpack_exports__.resolveConfigPath, exports.rspack = __webpack_exports__.rspack, exports.setCurrentDevUnpackConfig = __webpack_exports__.setCurrentDevUnpackConfig, exports.setDevServer = __webpack_exports__.setDevServer, exports.setNodeEnv = __webpack_exports__.setNodeEnv, exports.setValueByPath = __webpack_exports__.setValueByPath, exports.setupCliShortcuts = __webpack_exports__.setupCliShortcuts, exports.trackPerformance = __webpack_exports__.trackPerformance, __webpack_exports__)-1 === [
2031
+ })(), exports.CSS_MODULES_LOCAL_IDENT_NAME = __webpack_exports__.CSS_MODULES_LOCAL_IDENT_NAME, exports.CSS_MODULES_REGEX = __webpack_exports__.CSS_MODULES_REGEX, exports.CSS_NAMED_EXPORT = __webpack_exports__.CSS_NAMED_EXPORT, exports.DEFAULT_DEV_HOST = __webpack_exports__.DEFAULT_DEV_HOST, exports.DEV_DEFAULT_FILENAME = __webpack_exports__.DEV_DEFAULT_FILENAME, exports.EXPORT_LOCALS_CONVENTION = __webpack_exports__.EXPORT_LOCALS_CONVENTION, exports.LogColor = __webpack_exports__.LogColor, exports.NODE_MODULES_REGEX = __webpack_exports__.NODE_MODULES_REGEX, exports.PROD_DEFAULT_FILENAME = __webpack_exports__.PROD_DEFAULT_FILENAME, exports.TEMPLATE_CONTENT = __webpack_exports__.TEMPLATE_CONTENT, exports.TEMP_DIR = __webpack_exports__.TEMP_DIR, exports.THREAD_OPTIONS = __webpack_exports__.THREAD_OPTIONS, exports.addRestartCleaner = __webpack_exports__.addRestartCleaner, exports.cleanUpBeforeRestart = __webpack_exports__.cleanUpBeforeRestart, exports.clearLine = __webpack_exports__.clearLine, exports.colors = __webpack_exports__.colors, exports.createChokidar = __webpack_exports__.createChokidar, exports.createUnpack = __webpack_exports__.createUnpack, exports.currentDevUnpackConfig = __webpack_exports__.currentDevUnpackConfig, exports.debounce = __webpack_exports__.debounce, exports.defineConfig = __webpack_exports__.defineConfig, exports.esVersionToBrowserslist = __webpack_exports__.esVersionToBrowserslist, exports.findExists = __webpack_exports__.findExists, exports.getAddressUrls = __webpack_exports__.getAddressUrls, exports.getCompiledPkgPath = __webpack_exports__.getCompiledPkgPath, exports.getIpv4Interfaces = __webpack_exports__.getIpv4Interfaces, exports.getNodeEnv = __webpack_exports__.getNodeEnv, exports.getPathInJs = __webpack_exports__.getPathInJs, exports.getPort = __webpack_exports__.getPort, exports.getTime = __webpack_exports__.getTime, exports.getUserDepPath = __webpack_exports__.getUserDepPath, exports.getUserDepVersion = __webpack_exports__.getUserDepVersion, exports.getValueByPath = __webpack_exports__.getValueByPath, exports.hexColor = __webpack_exports__.hexColor, exports.isBoolean = __webpack_exports__.isBoolean, exports.isCI = __webpack_exports__.isCI, exports.isCSSModules = __webpack_exports__.isCSSModules, exports.isDebug = __webpack_exports__.isDebug, exports.isDev = __webpack_exports__.isDev, exports.isDevServer = __webpack_exports__.isDevServer, exports.isEmptyDir = __webpack_exports__.isEmptyDir, exports.isFileExists = __webpack_exports__.isFileExists, exports.isFileSync = __webpack_exports__.isFileSync, exports.isFunction = __webpack_exports__.isFunction, exports.isNodeVersionAtLeast = __webpack_exports__.isNodeVersionAtLeast, exports.isObject = __webpack_exports__.isObject, exports.isPlainObject = __webpack_exports__.isPlainObject, exports.isProd = __webpack_exports__.isProd, exports.isRegExp = __webpack_exports__.isRegExp, exports.isString = __webpack_exports__.isString, exports.isUndefined = __webpack_exports__.isUndefined, exports.isWatch = __webpack_exports__.isWatch, exports.isWin = __webpack_exports__.isWin, exports.launchEditor = __webpack_exports__.launchEditor, exports.loadConfig = __webpack_exports__.loadConfig, exports.logUpdate = __webpack_exports__.logUpdate, exports.logger = __webpack_exports__.logger, exports.mergeConfig = __webpack_exports__.mergeConfig, exports.pathExists = __webpack_exports__.pathExists, exports.prettyTime = __webpack_exports__.prettyTime, exports.removeDir = __webpack_exports__.removeDir, exports.resolveConfigPath = __webpack_exports__.resolveConfigPath, exports.rspack = __webpack_exports__.rspack, exports.setCurrentDevUnpackConfig = __webpack_exports__.setCurrentDevUnpackConfig, exports.setDevServer = __webpack_exports__.setDevServer, exports.setNodeEnv = __webpack_exports__.setNodeEnv, exports.setValueByPath = __webpack_exports__.setValueByPath, exports.setupCliShortcuts = __webpack_exports__.setupCliShortcuts, exports.trackPerformance = __webpack_exports__.trackPerformance, __webpack_exports__)-1 === [
2017
2032
  "CSS_MODULES_LOCAL_IDENT_NAME",
2018
2033
  "CSS_MODULES_REGEX",
2019
2034
  "CSS_NAMED_EXPORT",
@@ -2047,6 +2062,7 @@ for(var __webpack_i__ in (()=>{
2047
2062
  "getUserDepPath",
2048
2063
  "getUserDepVersion",
2049
2064
  "getValueByPath",
2065
+ "hexColor",
2050
2066
  "isBoolean",
2051
2067
  "isCI",
2052
2068
  "isCSSModules",
package/dist/index.js CHANGED
@@ -4,7 +4,6 @@ let require = __rslib_shim_module__.createRequire(import.meta.url);
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__compiled_launch_editor_index_js_29002383__ from "../compiled/launch-editor/index.js";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__compiled_webpack_merge_index_js_efd91626__ from "../compiled/webpack-merge/index.js";
6
6
  import { experiments, rspack } from "@rspack/core";
7
- import picocolors from "picocolors";
8
7
  import node_readline from "node:readline";
9
8
  import node_fs from "node:fs";
10
9
  import node_net from "node:net";
@@ -35,15 +34,26 @@ function __webpack_require__(moduleId) {
35
34
  };
36
35
  return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
37
36
  }
38
- let colors = {
39
- ...picocolors,
40
- rainbow: (input)=>{
41
- let isWord = (char)=>!/[\s\n]/.test(char), chars = [
42
- ...input
43
- ], steps = chars.filter(isWord).length, r = 97, g = 193, b = 198, rStep = -49 / steps, gStep = -81 / steps, bStep = 0 / steps, output = '';
44
- for (let char of chars)isWord(char) && (r += rStep, g += gStep, b += bStep), output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
45
- return output;
37
+ let hexColor = (hex)=>{
38
+ let r, g, b, value = (hex || '').trim().replace(/^#/, '');
39
+ if (/^[0-9a-fA-F]{3}$/.test(value)) r = Number.parseInt(value[0] + value[0], 16), g = Number.parseInt(value[1] + value[1], 16), b = Number.parseInt(value[2] + value[2], 16);
40
+ else {
41
+ if (!/^[0-9a-fA-F]{6}$/.test(value)) return (input)=>String(input);
42
+ r = Number.parseInt(value.slice(0, 2), 16), g = Number.parseInt(value.slice(2, 4), 16), b = Number.parseInt(value.slice(4, 6), 16);
46
43
  }
44
+ let prefix = `\x1b[38;2;${r};${g};${b}m`;
45
+ return (input)=>`${prefix}${input}\x1b[39m`;
46
+ }, colors = {
47
+ brand: hexColor('#b39aff'),
48
+ red: hexColor('#F38BA8'),
49
+ green: hexColor('#A6E3A1'),
50
+ yellow: hexColor('#F9E2AF'),
51
+ blue: hexColor('#89B4FA'),
52
+ magenta: hexColor('#CBA6F7'),
53
+ cyan: hexColor('#89DCEB'),
54
+ gray: hexColor('#6C7086'),
55
+ bold: (input)=>`\x1b[1m${input}\x1b[22m`,
56
+ dim: (input)=>`\x1b[2m${input}\x1b[22m`
47
57
  }, restartCleaners = [], addRestartCleaner = (...cleaners)=>{
48
58
  restartCleaners.push(...cleaners);
49
59
  }, cleanUpBeforeRestart = async ()=>{
@@ -296,7 +306,7 @@ async function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls,
296
306
  }
297
307
  }
298
308
  }
299
- ].filter(Boolean), colorPrefix = colors.green(colors.dim('➜'));
309
+ ].filter(Boolean), colorPrefix = colors.brand(colors.dim('➜'));
300
310
  help && console.log(!0 === help ? ` ${colorPrefix} ${colors.dim('press')} ${colors.bold('h + enter')} ${colors.dim('to show help')}` : ` ${colorPrefix} ${help}`);
301
311
  let { createInterface } = await import("node:readline"), rl = createInterface({
302
312
  input: process.stdin
@@ -639,7 +649,7 @@ class JsMinifyPlugin {
639
649
  apply(compiler) {
640
650
  let meta = JSON.stringify({
641
651
  name: jsMinify_PLUGIN_NAME,
642
- version: "3.3.6",
652
+ version: "3.4.0",
643
653
  options: this.minifyOptions
644
654
  });
645
655
  compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
@@ -857,16 +867,16 @@ function formatFileList(paths, rootPath) {
857
867
  }).join(', ');
858
868
  return files.length > 1 ? `${fileInfo} and ${files.length - 1} more` : fileInfo;
859
869
  }
860
- let sameCount = 0;
861
- async function compileDone(compiler, stats) {
862
- let compileTime = stats.toJson({
870
+ let getCompileTime = (stats)=>stats.toJson({
863
871
  preset: 'errors-only',
864
872
  timings: !0
865
- }).time / 1000, root = compiler.options.context;
873
+ }).time / 1000, sameCount = 0;
874
+ async function compileDone(compiler, stats) {
875
+ let root = compiler.options.context;
866
876
  if (!stats.hasErrors()) if (isProd()) isCI() || await printFileSize({
867
877
  root,
868
878
  stats
869
- }), logger_logger.ready(colors.green(`built in ${prettyTime(compileTime)}`));
879
+ }), logger_logger.ready(colors.green(`built in ${prettyTime(getCompileTime(stats))}`));
870
880
  else {
871
881
  let fileInfo = function(changedFiles, removedFiles, root) {
872
882
  if (!changedFiles?.length && !removedFiles?.length) return null;
@@ -890,7 +900,7 @@ async function compileDone(compiler, stats) {
890
900
  logger_logger.debug(`${colors.cyan(packageName)}: ${colors.yellow(count)} modules`);
891
901
  });
892
902
  }
893
- isDebug() || logger_logger.clear(), console.log(colors.dim(getTime()), colors.cyan(colors.bold(`[${global.__unpack_caller_name}]`)), colors.green(utils_isDevServer() ? 'hmr update' : 'build'), `${colors.dim(fileInfo)}${sameCount > 1 ? ` ${colors.yellow(`(x${sameCount})`)}` : ''}`, isDebug() ? colors.dim(`| ${prettyTime(compileTime)} (${stats.compilation.modules.size} modules)`) : '');
903
+ isDebug() || logger_logger.clear(), console.log(colors.dim(getTime()), colors.cyan(`[${global.__unpack_caller_name}]`), colors.brand(utils_isDevServer() ? 'hmr update' : 'build'), `${colors.dim(fileInfo)}${sameCount > 1 ? ` ${colors.yellow(`(x${sameCount})`)}` : ''}`, isDebug() ? colors.dim(`| ${prettyTime(getCompileTime(stats))} (${stats.compilation.modules.size} modules)`) : '');
894
904
  }
895
905
  }
896
906
  let progress_PLUGIN_NAME = 'ProgressPlugin';
@@ -1146,7 +1156,10 @@ async function getBundlerConfig(originalUnpackConfig) {
1146
1156
  ]
1147
1157
  },
1148
1158
  watchOptions: {
1149
- ignored: /[\\/](?:\.git|node_modules)[\\/]/
1159
+ aggregateTimeout: 0
1160
+ },
1161
+ performance: {
1162
+ hints: !1
1150
1163
  }
1151
1164
  };
1152
1165
  for (let plugin of (config = (({ config, unpackConfig })=>{
@@ -1815,7 +1828,7 @@ async function unpackDev(originalUnpackConfig) {
1815
1828
  req.headers.accept?.includes('html') && (req.url = '/index.html'), next();
1816
1829
  }), middlewares.unshift(experiments.lazyCompilationMiddleware(compiler)), middlewares);
1817
1830
  let server = new RspackDevServer(devServerOptions, compiler);
1818
- await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.3.6`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - global.__unpack_start_time))} ms\n`), printAddressUrls(port, unpackConfig.server?.host), addRestartCleaner(()=>server.stop(), ()=>new Promise((resolve)=>compiler.close(()=>resolve())));
1831
+ await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.4.0`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - global.__unpack_start_time))} ${colors.dim('ms')}\n`), printAddressUrls(port, unpackConfig.server?.host), addRestartCleaner(()=>server.stop(), ()=>new Promise((resolve)=>compiler.close(()=>resolve())));
1819
1832
  let open = unpackConfig.server?.open, url = isString(open) ? open : `http://localhost:${port}`;
1820
1833
  open && openBrowser(url), setupCliShortcuts({
1821
1834
  openPage: async ()=>{
@@ -1838,7 +1851,7 @@ async function unpackDev(originalUnpackConfig) {
1838
1851
  function printAddressUrls(port, host) {
1839
1852
  let addressUrls = getAddressUrls({
1840
1853
  port
1841
- }), colorPrefix = colors.green('➜');
1854
+ }), colorPrefix = colors.brand('➜');
1842
1855
  addressUrls.forEach((addr, index)=>{
1843
1856
  let url;
1844
1857
  if (!host && 0 !== index) {
@@ -1888,7 +1901,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
1888
1901
  ...mergeConfig(defaultConfig, config),
1889
1902
  _context: {
1890
1903
  callerName,
1891
- version: "3.3.6"
1904
+ version: "3.4.0"
1892
1905
  }
1893
1906
  };
1894
1907
  };
@@ -1896,7 +1909,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
1896
1909
  build: async ({ watch } = {})=>{
1897
1910
  setNodeEnv(watch ? 'development' : 'production');
1898
1911
  let config = resolveConfig();
1899
- console.log(colors.rainbow(`${callerName} v3.3.6`), colors.green(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
1912
+ console.log(colors.brand(`${callerName} v3.4.0`), colors.cyan(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
1900
1913
  },
1901
1914
  dev: async ()=>{
1902
1915
  global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
@@ -1921,4 +1934,4 @@ async function createChokidar(pathOrGlobs, root = process.cwd(), options) {
1921
1934
  var __webpack_exports__CSS_NAMED_EXPORT = !1;
1922
1935
  import { fileURLToPath as __webpack_fileURLToPath__, pathToFileURL } from "node:url";
1923
1936
  import node_path, { dirname as __webpack_dirname__, join, sep } from "node:path";
1924
- export { CSS_MODULES_LOCAL_IDENT_NAME, CSS_MODULES_REGEX, DEFAULT_DEV_HOST, DEV_DEFAULT_FILENAME, EXPORT_LOCALS_CONVENTION, logger_LogColor as LogColor, NODE_MODULES_REGEX, PROD_DEFAULT_FILENAME, TEMPLATE_CONTENT, TEMP_DIR, THREAD_OPTIONS, addRestartCleaner, cleanUpBeforeRestart, clearLine, colors, createChokidar, createUnpack, currentDevUnpackConfig, debounce, defineConfig, esVersionToBrowserslist, findExists, getAddressUrls, getCompiledPkgPath, getIpv4Interfaces, getNodeEnv, getPathInJs, getPort, getTime, getUserDepPath, getUserDepVersion, getValueByPath, isBoolean, isCI, isCSSModules, isDebug, isDev, utils_isDevServer as isDevServer, isEmptyDir, isFileExists, isFileSync, isFunction, isNodeVersionAtLeast, isObject, isPlainObject, isProd, isRegExp, isString, isUndefined, isWatch, isWin, launchEditor, loadConfig, logUpdate, logger_logger as logger, mergeConfig, pathExists, prettyTime, removeDir, resolveConfigPath, rspack, setCurrentDevUnpackConfig, setDevServer, setNodeEnv, setValueByPath, setupCliShortcuts, trackPerformance, __webpack_exports__CSS_NAMED_EXPORT as CSS_NAMED_EXPORT };
1937
+ export { CSS_MODULES_LOCAL_IDENT_NAME, CSS_MODULES_REGEX, DEFAULT_DEV_HOST, DEV_DEFAULT_FILENAME, EXPORT_LOCALS_CONVENTION, logger_LogColor as LogColor, NODE_MODULES_REGEX, PROD_DEFAULT_FILENAME, TEMPLATE_CONTENT, TEMP_DIR, THREAD_OPTIONS, addRestartCleaner, cleanUpBeforeRestart, clearLine, colors, createChokidar, createUnpack, currentDevUnpackConfig, debounce, defineConfig, esVersionToBrowserslist, findExists, getAddressUrls, getCompiledPkgPath, getIpv4Interfaces, getNodeEnv, getPathInJs, getPort, getTime, getUserDepPath, getUserDepVersion, getValueByPath, hexColor, isBoolean, isCI, isCSSModules, isDebug, isDev, utils_isDevServer as isDevServer, isEmptyDir, isFileExists, isFileSync, isFunction, isNodeVersionAtLeast, isObject, isPlainObject, isProd, isRegExp, isString, isUndefined, isWatch, isWin, launchEditor, loadConfig, logUpdate, logger_logger as logger, mergeConfig, pathExists, prettyTime, removeDir, resolveConfigPath, rspack, setCurrentDevUnpackConfig, setDevServer, setNodeEnv, setValueByPath, setupCliShortcuts, trackPerformance, __webpack_exports__CSS_NAMED_EXPORT as CSS_NAMED_EXPORT };
@@ -5,7 +5,6 @@ import node_path from "node:path";
5
5
  import "node:net";
6
6
  import "node:os";
7
7
  import "portfinder";
8
- import picocolors from "picocolors";
9
8
  var __webpack_modules__ = {
10
9
  "compiled/launch-editor": function(module) {
11
10
  module.exports = __WEBPACK_EXTERNAL_MODULE__compiled_launch_editor_index_js_29002383__;
@@ -22,17 +21,17 @@ function __webpack_require__(moduleId) {
22
21
  };
23
22
  return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
24
23
  }
25
- let CSS_MODULES_REGEX = /\.module\.\w+$/i, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/;
26
- ({
27
- ...picocolors,
28
- rainbow: (input)=>{
29
- let isWord = (char)=>!/[\s\n]/.test(char), chars = [
30
- ...input
31
- ], steps = chars.filter(isWord).length, r = 97, g = 193, b = 198, rStep = -49 / steps, gStep = -81 / steps, bStep = 0 / steps, output = '';
32
- for (let char of chars)isWord(char) && (r += rStep, g += gStep, b += bStep), output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
33
- return output;
24
+ let CSS_MODULES_REGEX = /\.module\.\w+$/i, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, hexColor = (hex)=>{
25
+ let r, g, b, value = (hex || '').trim().replace(/^#/, '');
26
+ if (/^[0-9a-fA-F]{3}$/.test(value)) r = Number.parseInt(value[0] + value[0], 16), g = Number.parseInt(value[1] + value[1], 16), b = Number.parseInt(value[2] + value[2], 16);
27
+ else {
28
+ if (!/^[0-9a-fA-F]{6}$/.test(value)) return (input)=>String(input);
29
+ r = Number.parseInt(value.slice(0, 2), 16), g = Number.parseInt(value.slice(2, 4), 16), b = Number.parseInt(value.slice(4, 6), 16);
34
30
  }
35
- });
31
+ let prefix = `\x1b[38;2;${r};${g};${b}m`;
32
+ return (input)=>`${prefix}${input}\x1b[39m`;
33
+ };
34
+ hexColor('#b39aff'), hexColor('#F38BA8'), hexColor('#A6E3A1'), hexColor('#F9E2AF'), hexColor('#89B4FA'), hexColor('#CBA6F7'), hexColor('#89DCEB'), hexColor('#6C7086');
36
35
  let { merge } = __webpack_require__("compiled/webpack-merge");
37
36
  __webpack_require__("compiled/launch-editor");
38
37
  let enforceLFLineSeparators = (text)=>text ? text.replace(/\r\n/g, '\n') : text;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler-config/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAuBnE,wBAAsB,gBAAgB,CACpC,oBAAoB,EAAE,YAAY,GACjC,OAAO,CAAC,oBAAoB,CAAC,CAuM/B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler-config/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAuBnE,wBAAsB,gBAAgB,CACpC,oBAAoB,EAAE,YAAY,GACjC,OAAO,CAAC,oBAAoB,CAAC,CA0M/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/bundler-config/plugins/progress/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAqHvC,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,iBA2C/E"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/bundler-config/plugins/progress/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AA8HvC,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,iBAsC/E"}
@@ -1,6 +1,18 @@
1
- import type { Colors } from 'picocolors/types';
2
- export declare const colors: Colors & {
3
- rainbow: (input: string) => string;
4
- [key: string]: any;
1
+ type Input = string | number;
2
+ type Formatter = (input: Input) => string;
3
+ type Colors = {
4
+ red: Formatter;
5
+ green: Formatter;
6
+ yellow: Formatter;
7
+ blue: Formatter;
8
+ magenta: Formatter;
9
+ cyan: Formatter;
10
+ gray: Formatter;
11
+ brand: Formatter;
12
+ bold: Formatter;
13
+ dim: Formatter;
5
14
  };
15
+ export declare const hexColor: (hex: string) => Formatter;
16
+ export declare const colors: Colors;
17
+ export {};
6
18
  //# sourceMappingURL=colors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,eAAO,MAAM,MAAM,EAAE,MAAM,GAAG;IAC5B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CA0BnB,CAAA"}
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG,MAAM,GAAG,MAAM,CAAA;AAC5B,KAAK,SAAS,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAA;AACzC,KAAK,MAAM,GAAG;IACZ,GAAG,EAAE,SAAS,CAAA;IACd,KAAK,EAAE,SAAS,CAAA;IAChB,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,SAAS,CAAA;IAClB,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,SAAS,CAAA;IAChB,IAAI,EAAE,SAAS,CAAA;IACf,GAAG,EAAE,SAAS,CAAA;CACf,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,KAAG,SAmBtC,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,MAWpB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unpackjs/core",
3
- "version": "3.3.6",
3
+ "version": "3.4.0",
4
4
  "description": "An Rspack-based build tool",
5
5
  "type": "module",
6
6
  "exports": {
@@ -49,7 +49,6 @@
49
49
  "express": "5.1.0",
50
50
  "jiti": "2.6.1",
51
51
  "oxc-minify": "0.96.0",
52
- "picocolors": "1.1.1",
53
52
  "portfinder": "1.0.38",
54
53
  "postcss": "8.5.6",
55
54
  "thread-loader": "4.0.4",