@unpackjs/core 3.3.7 → 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.7",
738
+ version: "3.4.0",
727
739
  options: this.minifyOptions
728
740
  });
729
741
  compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
@@ -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(getCompileTime(stats))} (${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';
@@ -1908,7 +1920,7 @@ for(var __webpack_i__ in (()=>{
1908
1920
  req.headers.accept?.includes('html') && (req.url = '/index.html'), next();
1909
1921
  }), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
1910
1922
  let server = new dev_server_namespaceObject.RspackDevServer(devServerOptions, compiler);
1911
- await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.3.7`)} ${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())));
1912
1924
  let open = unpackConfig.server?.open, url = isString(open) ? open : `http://localhost:${port}`;
1913
1925
  open && openBrowser(url), setupCliShortcuts({
1914
1926
  openPage: async ()=>{
@@ -1931,7 +1943,7 @@ for(var __webpack_i__ in (()=>{
1931
1943
  function printAddressUrls(port, host) {
1932
1944
  let addressUrls = getAddressUrls({
1933
1945
  port
1934
- }), colorPrefix = colors.green('➜');
1946
+ }), colorPrefix = colors.brand('➜');
1935
1947
  addressUrls.forEach((addr, index)=>{
1936
1948
  let url;
1937
1949
  if (!host && 0 !== index) {
@@ -1981,7 +1993,7 @@ for(var __webpack_i__ in (()=>{
1981
1993
  ...mergeConfig(defaultConfig, config),
1982
1994
  _context: {
1983
1995
  callerName,
1984
- version: "3.3.7"
1996
+ version: "3.4.0"
1985
1997
  }
1986
1998
  };
1987
1999
  };
@@ -1989,7 +2001,7 @@ for(var __webpack_i__ in (()=>{
1989
2001
  build: async ({ watch } = {})=>{
1990
2002
  setNodeEnv(watch ? 'development' : 'production');
1991
2003
  let config = resolveConfig();
1992
- console.log(colors.rainbow(`${callerName} v3.3.7`), 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);
1993
2005
  },
1994
2006
  dev: async ()=>{
1995
2007
  global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
@@ -2016,7 +2028,7 @@ for(var __webpack_i__ in (()=>{
2016
2028
  ...options
2017
2029
  });
2018
2030
  }
2019
- })(), 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 === [
2020
2032
  "CSS_MODULES_LOCAL_IDENT_NAME",
2021
2033
  "CSS_MODULES_REGEX",
2022
2034
  "CSS_NAMED_EXPORT",
@@ -2050,6 +2062,7 @@ for(var __webpack_i__ in (()=>{
2050
2062
  "getUserDepPath",
2051
2063
  "getUserDepVersion",
2052
2064
  "getValueByPath",
2065
+ "hexColor",
2053
2066
  "isBoolean",
2054
2067
  "isCI",
2055
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.7",
652
+ version: "3.4.0",
643
653
  options: this.minifyOptions
644
654
  });
645
655
  compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
@@ -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(getCompileTime(stats))} (${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';
@@ -1818,7 +1828,7 @@ async function unpackDev(originalUnpackConfig) {
1818
1828
  req.headers.accept?.includes('html') && (req.url = '/index.html'), next();
1819
1829
  }), middlewares.unshift(experiments.lazyCompilationMiddleware(compiler)), middlewares);
1820
1830
  let server = new RspackDevServer(devServerOptions, compiler);
1821
- await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.3.7`)} ${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())));
1822
1832
  let open = unpackConfig.server?.open, url = isString(open) ? open : `http://localhost:${port}`;
1823
1833
  open && openBrowser(url), setupCliShortcuts({
1824
1834
  openPage: async ()=>{
@@ -1841,7 +1851,7 @@ async function unpackDev(originalUnpackConfig) {
1841
1851
  function printAddressUrls(port, host) {
1842
1852
  let addressUrls = getAddressUrls({
1843
1853
  port
1844
- }), colorPrefix = colors.green('➜');
1854
+ }), colorPrefix = colors.brand('➜');
1845
1855
  addressUrls.forEach((addr, index)=>{
1846
1856
  let url;
1847
1857
  if (!host && 0 !== index) {
@@ -1891,7 +1901,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
1891
1901
  ...mergeConfig(defaultConfig, config),
1892
1902
  _context: {
1893
1903
  callerName,
1894
- version: "3.3.7"
1904
+ version: "3.4.0"
1895
1905
  }
1896
1906
  };
1897
1907
  };
@@ -1899,7 +1909,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
1899
1909
  build: async ({ watch } = {})=>{
1900
1910
  setNodeEnv(watch ? 'development' : 'production');
1901
1911
  let config = resolveConfig();
1902
- console.log(colors.rainbow(`${callerName} v3.3.7`), 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);
1903
1913
  },
1904
1914
  dev: async ()=>{
1905
1915
  global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
@@ -1924,4 +1934,4 @@ async function createChokidar(pathOrGlobs, root = process.cwd(), options) {
1924
1934
  var __webpack_exports__CSS_NAMED_EXPORT = !1;
1925
1935
  import { fileURLToPath as __webpack_fileURLToPath__, pathToFileURL } from "node:url";
1926
1936
  import node_path, { dirname as __webpack_dirname__, join, sep } from "node:path";
1927
- 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,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.7",
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",