@unpackjs/core 3.4.1 → 3.4.2
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 +58 -38
- package/dist/index.js +58 -38
- package/dist/typedCssModulesLoader.mjs +41 -21
- package/dist-types/colors.d.ts +6 -0
- package/dist-types/colors.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -77,7 +77,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
77
77
|
getIpv4Interfaces: ()=>getIpv4Interfaces,
|
|
78
78
|
getNodeEnv: ()=>getNodeEnv,
|
|
79
79
|
getPort: ()=>getPort,
|
|
80
|
-
isCI: ()=>
|
|
80
|
+
isCI: ()=>utils_isCI,
|
|
81
81
|
logger: ()=>logger_logger,
|
|
82
82
|
addRestartCleaner: ()=>addRestartCleaner,
|
|
83
83
|
colors: ()=>colors,
|
|
@@ -107,41 +107,61 @@ for(var __webpack_i__ in (()=>{
|
|
|
107
107
|
getUserDepPath: ()=>getUserDepPath,
|
|
108
108
|
isString: ()=>isString
|
|
109
109
|
});
|
|
110
|
-
let core_namespaceObject = require("@rspack/core"),
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
let core_namespaceObject = require("@rspack/core"), isCI = !!process.env.CI, isTTY = !!process.stdout?.isTTY, noColor = !!process.env.NO_COLOR, forceColor = !!process.env.FORCE_COLOR, disableColor = !1;
|
|
111
|
+
disableColor = !!noColor || !forceColor && (isCI || !isTTY);
|
|
112
|
+
let ANSI_SGR_RE = /\x1b\[[0-9;]*m/g, ANSI_OPEN_RE = /\x1b\[([0-9;]+)m/g, COLOR_HEX = {
|
|
113
|
+
brand: '#b39aff',
|
|
114
|
+
red: '#F38BA8',
|
|
115
|
+
green: '#A6E3A1',
|
|
116
|
+
yellow: '#F9E2AF',
|
|
117
|
+
blue: '#89B4FA',
|
|
118
|
+
magenta: '#CBA6F7',
|
|
119
|
+
cyan: '#89DCEB',
|
|
120
|
+
gray: '#6C7086'
|
|
121
|
+
}, COLOR_HEX_TO_OPEN = Object.fromEntries(Object.values(COLOR_HEX).map((hex)=>[
|
|
122
|
+
hex,
|
|
123
|
+
((hex)=>{
|
|
124
|
+
let r, g, b, value = (hex || '').trim().replace(/^#/, '');
|
|
125
|
+
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);
|
|
126
|
+
else {
|
|
127
|
+
if (!/^[0-9a-fA-F]{6}$/.test(value)) return '';
|
|
128
|
+
r = Number.parseInt(value.slice(0, 2), 16), g = Number.parseInt(value.slice(2, 4), 16), b = Number.parseInt(value.slice(4, 6), 16);
|
|
129
|
+
}
|
|
130
|
+
return `\x1b[38;2;${r};${g};${b}m`;
|
|
131
|
+
})(hex)
|
|
132
|
+
])), hexColor = (hex)=>{
|
|
119
133
|
if (disableColor) return (input)=>String(input);
|
|
120
|
-
let open =
|
|
134
|
+
let open = COLOR_HEX_TO_OPEN[hex];
|
|
121
135
|
return open ? (input)=>`${open}${input}\x1b[39m` : (input)=>String(input);
|
|
122
|
-
}, ansi = (open, close)=>(input)=>disableColor ? String(input) : `${open}${input}${close}`,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
code,
|
|
132
|
-
hexToAnsiOpen(hex)
|
|
133
|
-
])), colors = {
|
|
134
|
-
brand: hexColor(COLOR_HEX_brand),
|
|
135
|
-
red: hexColor(COLOR_HEX_red),
|
|
136
|
-
green: hexColor(COLOR_HEX_green),
|
|
137
|
-
yellow: hexColor(COLOR_HEX_yellow),
|
|
138
|
-
blue: hexColor(COLOR_HEX_blue),
|
|
139
|
-
magenta: hexColor(COLOR_HEX_magenta),
|
|
140
|
-
cyan: hexColor(COLOR_HEX_cyan),
|
|
141
|
-
gray: hexColor(COLOR_HEX_gray),
|
|
136
|
+
}, ansi = (open, close)=>(input)=>disableColor ? String(input) : `${open}${input}${close}`, colors = {
|
|
137
|
+
brand: hexColor(COLOR_HEX.brand),
|
|
138
|
+
red: hexColor(COLOR_HEX.red),
|
|
139
|
+
green: hexColor(COLOR_HEX.green),
|
|
140
|
+
yellow: hexColor(COLOR_HEX.yellow),
|
|
141
|
+
blue: hexColor(COLOR_HEX.blue),
|
|
142
|
+
magenta: hexColor(COLOR_HEX.magenta),
|
|
143
|
+
cyan: hexColor(COLOR_HEX.cyan),
|
|
144
|
+
gray: hexColor(COLOR_HEX.gray),
|
|
142
145
|
bold: ansi('\x1b[1m', '\x1b[22m'),
|
|
143
146
|
dim: ansi('\x1b[2m', '\x1b[22m')
|
|
144
|
-
}
|
|
147
|
+
}, CODE_TO_OPEN = Object.fromEntries(Object.entries({
|
|
148
|
+
31: COLOR_HEX.red,
|
|
149
|
+
32: COLOR_HEX.green,
|
|
150
|
+
33: COLOR_HEX.yellow,
|
|
151
|
+
34: COLOR_HEX.blue,
|
|
152
|
+
35: COLOR_HEX.magenta,
|
|
153
|
+
36: COLOR_HEX.cyan,
|
|
154
|
+
90: COLOR_HEX.gray,
|
|
155
|
+
91: COLOR_HEX.red,
|
|
156
|
+
92: COLOR_HEX.green,
|
|
157
|
+
93: COLOR_HEX.yellow,
|
|
158
|
+
94: COLOR_HEX.blue,
|
|
159
|
+
95: COLOR_HEX.magenta,
|
|
160
|
+
96: COLOR_HEX.cyan
|
|
161
|
+
}).map(([code, hex])=>[
|
|
162
|
+
code,
|
|
163
|
+
COLOR_HEX_TO_OPEN[hex]
|
|
164
|
+
]));
|
|
145
165
|
function convertBasicAnsiColors(input) {
|
|
146
166
|
let text = String(input ?? '');
|
|
147
167
|
return text ? disableColor ? text.replace(ANSI_SGR_RE, '') : text.replace(ANSI_OPEN_RE, (substring, params)=>{
|
|
@@ -308,7 +328,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
308
328
|
process.stdout.isTTY && (process.stdout.clearLine(0), process.stdout.cursorTo(0));
|
|
309
329
|
}, logUpdate = (output)=>{
|
|
310
330
|
clearLine(), process.stdout.write(output);
|
|
311
|
-
}, isDebug = ()=>'unpack' === process.env.DEBUG,
|
|
331
|
+
}, isDebug = ()=>'unpack' === process.env.DEBUG, utils_isCI = ()=>!!process.env.CI;
|
|
312
332
|
function isNodeVersionAtLeast(major, minor) {
|
|
313
333
|
let [currMajor, currMinor] = process.versions.node.split('.').map(Number);
|
|
314
334
|
return currMajor > major || currMajor === major && currMinor >= minor;
|
|
@@ -761,7 +781,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
761
781
|
apply(compiler) {
|
|
762
782
|
let meta = JSON.stringify({
|
|
763
783
|
name: jsMinify_PLUGIN_NAME,
|
|
764
|
-
version: "3.4.
|
|
784
|
+
version: "3.4.2",
|
|
765
785
|
options: this.minifyOptions
|
|
766
786
|
});
|
|
767
787
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
@@ -988,7 +1008,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
988
1008
|
}).time / 1000, sameCount = 0;
|
|
989
1009
|
async function compileDone(compiler, stats) {
|
|
990
1010
|
let root = compiler.options.context;
|
|
991
|
-
if (!stats.hasErrors()) if (isProd())
|
|
1011
|
+
if (!stats.hasErrors()) if (isProd()) utils_isCI() || await printFileSize({
|
|
992
1012
|
root,
|
|
993
1013
|
stats
|
|
994
1014
|
}), logger_logger.ready(colors.green(`built in ${prettyTime(getCompileTime(stats))}`));
|
|
@@ -1946,7 +1966,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1946
1966
|
req.headers.accept?.includes('html') && (req.url = '/index.html'), next();
|
|
1947
1967
|
}), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
|
|
1948
1968
|
let server = new dev_server_namespaceObject.RspackDevServer(devServerOptions, compiler);
|
|
1949
|
-
await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.4.
|
|
1969
|
+
await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.4.2`)} ${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())));
|
|
1950
1970
|
let open = unpackConfig.server?.open, url = isString(open) ? open : `http://localhost:${port}`;
|
|
1951
1971
|
open && openBrowser(url), setupCliShortcuts({
|
|
1952
1972
|
openPage: async ()=>{
|
|
@@ -2019,7 +2039,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2019
2039
|
...mergeConfig(defaultConfig, config),
|
|
2020
2040
|
_context: {
|
|
2021
2041
|
callerName,
|
|
2022
|
-
version: "3.4.
|
|
2042
|
+
version: "3.4.2"
|
|
2023
2043
|
}
|
|
2024
2044
|
};
|
|
2025
2045
|
};
|
|
@@ -2027,7 +2047,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2027
2047
|
build: async ({ watch } = {})=>{
|
|
2028
2048
|
setNodeEnv(watch ? 'development' : 'production');
|
|
2029
2049
|
let config = resolveConfig();
|
|
2030
|
-
console.log(colors.brand(`${callerName} v3.4.
|
|
2050
|
+
console.log(colors.brand(`${callerName} v3.4.2`), colors.cyan(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
|
|
2031
2051
|
},
|
|
2032
2052
|
dev: async ()=>{
|
|
2033
2053
|
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
|
package/dist/index.js
CHANGED
|
@@ -34,41 +34,61 @@ function __webpack_require__(moduleId) {
|
|
|
34
34
|
};
|
|
35
35
|
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
|
|
36
36
|
}
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
let isCI = !!process.env.CI, isTTY = !!process.stdout?.isTTY, noColor = !!process.env.NO_COLOR, forceColor = !!process.env.FORCE_COLOR, disableColor = !1;
|
|
38
|
+
disableColor = !!noColor || !forceColor && (isCI || !isTTY);
|
|
39
|
+
let ANSI_SGR_RE = /\x1b\[[0-9;]*m/g, ANSI_OPEN_RE = /\x1b\[([0-9;]+)m/g, COLOR_HEX = {
|
|
40
|
+
brand: '#b39aff',
|
|
41
|
+
red: '#F38BA8',
|
|
42
|
+
green: '#A6E3A1',
|
|
43
|
+
yellow: '#F9E2AF',
|
|
44
|
+
blue: '#89B4FA',
|
|
45
|
+
magenta: '#CBA6F7',
|
|
46
|
+
cyan: '#89DCEB',
|
|
47
|
+
gray: '#6C7086'
|
|
48
|
+
}, COLOR_HEX_TO_OPEN = Object.fromEntries(Object.values(COLOR_HEX).map((hex)=>[
|
|
49
|
+
hex,
|
|
50
|
+
((hex)=>{
|
|
51
|
+
let r, g, b, value = (hex || '').trim().replace(/^#/, '');
|
|
52
|
+
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);
|
|
53
|
+
else {
|
|
54
|
+
if (!/^[0-9a-fA-F]{6}$/.test(value)) return '';
|
|
55
|
+
r = Number.parseInt(value.slice(0, 2), 16), g = Number.parseInt(value.slice(2, 4), 16), b = Number.parseInt(value.slice(4, 6), 16);
|
|
56
|
+
}
|
|
57
|
+
return `\x1b[38;2;${r};${g};${b}m`;
|
|
58
|
+
})(hex)
|
|
59
|
+
])), hexColor = (hex)=>{
|
|
46
60
|
if (disableColor) return (input)=>String(input);
|
|
47
|
-
let open =
|
|
61
|
+
let open = COLOR_HEX_TO_OPEN[hex];
|
|
48
62
|
return open ? (input)=>`${open}${input}\x1b[39m` : (input)=>String(input);
|
|
49
|
-
}, ansi = (open, close)=>(input)=>disableColor ? String(input) : `${open}${input}${close}`,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
code,
|
|
59
|
-
hexToAnsiOpen(hex)
|
|
60
|
-
])), colors = {
|
|
61
|
-
brand: hexColor('#b39aff'),
|
|
62
|
-
red: hexColor(COLOR_HEX_red),
|
|
63
|
-
green: hexColor(COLOR_HEX_green),
|
|
64
|
-
yellow: hexColor(COLOR_HEX_yellow),
|
|
65
|
-
blue: hexColor(COLOR_HEX_blue),
|
|
66
|
-
magenta: hexColor(COLOR_HEX_magenta),
|
|
67
|
-
cyan: hexColor(COLOR_HEX_cyan),
|
|
68
|
-
gray: hexColor(COLOR_HEX_gray),
|
|
63
|
+
}, ansi = (open, close)=>(input)=>disableColor ? String(input) : `${open}${input}${close}`, colors = {
|
|
64
|
+
brand: hexColor(COLOR_HEX.brand),
|
|
65
|
+
red: hexColor(COLOR_HEX.red),
|
|
66
|
+
green: hexColor(COLOR_HEX.green),
|
|
67
|
+
yellow: hexColor(COLOR_HEX.yellow),
|
|
68
|
+
blue: hexColor(COLOR_HEX.blue),
|
|
69
|
+
magenta: hexColor(COLOR_HEX.magenta),
|
|
70
|
+
cyan: hexColor(COLOR_HEX.cyan),
|
|
71
|
+
gray: hexColor(COLOR_HEX.gray),
|
|
69
72
|
bold: ansi('\x1b[1m', '\x1b[22m'),
|
|
70
73
|
dim: ansi('\x1b[2m', '\x1b[22m')
|
|
71
|
-
}
|
|
74
|
+
}, CODE_TO_OPEN = Object.fromEntries(Object.entries({
|
|
75
|
+
31: COLOR_HEX.red,
|
|
76
|
+
32: COLOR_HEX.green,
|
|
77
|
+
33: COLOR_HEX.yellow,
|
|
78
|
+
34: COLOR_HEX.blue,
|
|
79
|
+
35: COLOR_HEX.magenta,
|
|
80
|
+
36: COLOR_HEX.cyan,
|
|
81
|
+
90: COLOR_HEX.gray,
|
|
82
|
+
91: COLOR_HEX.red,
|
|
83
|
+
92: COLOR_HEX.green,
|
|
84
|
+
93: COLOR_HEX.yellow,
|
|
85
|
+
94: COLOR_HEX.blue,
|
|
86
|
+
95: COLOR_HEX.magenta,
|
|
87
|
+
96: COLOR_HEX.cyan
|
|
88
|
+
}).map(([code, hex])=>[
|
|
89
|
+
code,
|
|
90
|
+
COLOR_HEX_TO_OPEN[hex]
|
|
91
|
+
]));
|
|
72
92
|
function convertBasicAnsiColors(input) {
|
|
73
93
|
let text = String(input ?? '');
|
|
74
94
|
return text ? disableColor ? text.replace(ANSI_SGR_RE, '') : text.replace(ANSI_OPEN_RE, (substring, params)=>{
|
|
@@ -224,7 +244,7 @@ let debounce = (fn, delay)=>{
|
|
|
224
244
|
process.stdout.isTTY && (process.stdout.clearLine(0), process.stdout.cursorTo(0));
|
|
225
245
|
}, logUpdate = (output)=>{
|
|
226
246
|
clearLine(), process.stdout.write(output);
|
|
227
|
-
}, isDebug = ()=>'unpack' === process.env.DEBUG,
|
|
247
|
+
}, isDebug = ()=>'unpack' === process.env.DEBUG, utils_isCI = ()=>!!process.env.CI;
|
|
228
248
|
function isNodeVersionAtLeast(major, minor) {
|
|
229
249
|
let [currMajor, currMinor] = process.versions.node.split('.').map(Number);
|
|
230
250
|
return currMajor > major || currMajor === major && currMinor >= minor;
|
|
@@ -675,7 +695,7 @@ class JsMinifyPlugin {
|
|
|
675
695
|
apply(compiler) {
|
|
676
696
|
let meta = JSON.stringify({
|
|
677
697
|
name: jsMinify_PLUGIN_NAME,
|
|
678
|
-
version: "3.4.
|
|
698
|
+
version: "3.4.2",
|
|
679
699
|
options: this.minifyOptions
|
|
680
700
|
});
|
|
681
701
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
@@ -899,7 +919,7 @@ let getCompileTime = (stats)=>stats.toJson({
|
|
|
899
919
|
}).time / 1000, sameCount = 0;
|
|
900
920
|
async function compileDone(compiler, stats) {
|
|
901
921
|
let root = compiler.options.context;
|
|
902
|
-
if (!stats.hasErrors()) if (isProd())
|
|
922
|
+
if (!stats.hasErrors()) if (isProd()) utils_isCI() || await printFileSize({
|
|
903
923
|
root,
|
|
904
924
|
stats
|
|
905
925
|
}), logger_logger.ready(colors.green(`built in ${prettyTime(getCompileTime(stats))}`));
|
|
@@ -1854,7 +1874,7 @@ async function unpackDev(originalUnpackConfig) {
|
|
|
1854
1874
|
req.headers.accept?.includes('html') && (req.url = '/index.html'), next();
|
|
1855
1875
|
}), middlewares.unshift(experiments.lazyCompilationMiddleware(compiler)), middlewares);
|
|
1856
1876
|
let server = new RspackDevServer(devServerOptions, compiler);
|
|
1857
|
-
await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.4.
|
|
1877
|
+
await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.4.2`)} ${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())));
|
|
1858
1878
|
let open = unpackConfig.server?.open, url = isString(open) ? open : `http://localhost:${port}`;
|
|
1859
1879
|
open && openBrowser(url), setupCliShortcuts({
|
|
1860
1880
|
openPage: async ()=>{
|
|
@@ -1927,7 +1947,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
|
1927
1947
|
...mergeConfig(defaultConfig, config),
|
|
1928
1948
|
_context: {
|
|
1929
1949
|
callerName,
|
|
1930
|
-
version: "3.4.
|
|
1950
|
+
version: "3.4.2"
|
|
1931
1951
|
}
|
|
1932
1952
|
};
|
|
1933
1953
|
};
|
|
@@ -1935,7 +1955,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
|
1935
1955
|
build: async ({ watch } = {})=>{
|
|
1936
1956
|
setNodeEnv(watch ? 'development' : 'production');
|
|
1937
1957
|
let config = resolveConfig();
|
|
1938
|
-
console.log(colors.brand(`${callerName} v3.4.
|
|
1958
|
+
console.log(colors.brand(`${callerName} v3.4.2`), colors.cyan(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
|
|
1939
1959
|
},
|
|
1940
1960
|
dev: async ()=>{
|
|
1941
1961
|
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
|
|
@@ -1960,4 +1980,4 @@ async function createChokidar(pathOrGlobs, root = process.cwd(), options) {
|
|
|
1960
1980
|
var __webpack_exports__CSS_NAMED_EXPORT = !1;
|
|
1961
1981
|
import { fileURLToPath as __webpack_fileURLToPath__, pathToFileURL } from "node:url";
|
|
1962
1982
|
import node_path, { dirname as __webpack_dirname__, join, sep } from "node:path";
|
|
1963
|
-
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, convertBasicAnsiColors, 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 };
|
|
1983
|
+
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, convertBasicAnsiColors, createChokidar, createUnpack, currentDevUnpackConfig, debounce, defineConfig, esVersionToBrowserslist, findExists, getAddressUrls, getCompiledPkgPath, getIpv4Interfaces, getNodeEnv, getPathInJs, getPort, getTime, getUserDepPath, getUserDepVersion, getValueByPath, isBoolean, utils_isCI as 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 };
|
|
@@ -21,31 +21,51 @@ function __webpack_require__(moduleId) {
|
|
|
21
21
|
};
|
|
22
22
|
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
|
|
23
23
|
}
|
|
24
|
-
let CSS_MODULES_REGEX = /\.module\.\w+$/i, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
let CSS_MODULES_REGEX = /\.module\.\w+$/i, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, isCI = !!process.env.CI, isTTY = !!process.stdout?.isTTY, noColor = !!process.env.NO_COLOR, forceColor = !!process.env.FORCE_COLOR, disableColor = !1;
|
|
25
|
+
disableColor = !!noColor || !forceColor && (isCI || !isTTY);
|
|
26
|
+
let COLOR_HEX = {
|
|
27
|
+
brand: '#b39aff',
|
|
28
|
+
red: '#F38BA8',
|
|
29
|
+
green: '#A6E3A1',
|
|
30
|
+
yellow: '#F9E2AF',
|
|
31
|
+
blue: '#89B4FA',
|
|
32
|
+
magenta: '#CBA6F7',
|
|
33
|
+
cyan: '#89DCEB',
|
|
34
|
+
gray: '#6C7086'
|
|
35
|
+
}, COLOR_HEX_TO_OPEN = Object.fromEntries(Object.values(COLOR_HEX).map((hex)=>[
|
|
36
|
+
hex,
|
|
37
|
+
((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 '';
|
|
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);
|
|
43
|
+
}
|
|
44
|
+
return `\x1b[38;2;${r};${g};${b}m`;
|
|
45
|
+
})(hex)
|
|
46
|
+
])), hexColor = (hex)=>{
|
|
33
47
|
if (disableColor) return (input)=>String(input);
|
|
34
|
-
let open =
|
|
48
|
+
let open = COLOR_HEX_TO_OPEN[hex];
|
|
35
49
|
return open ? (input)=>`${open}${input}\x1b[39m` : (input)=>String(input);
|
|
36
|
-
}, ansi = (open, close)=>(input)=>disableColor ? String(input) : `${open}${input}${close}
|
|
37
|
-
Object.fromEntries(Object.entries({
|
|
38
|
-
31:
|
|
39
|
-
32:
|
|
40
|
-
33:
|
|
41
|
-
34:
|
|
42
|
-
35:
|
|
43
|
-
36:
|
|
44
|
-
90:
|
|
50
|
+
}, ansi = (open, close)=>(input)=>disableColor ? String(input) : `${open}${input}${close}`;
|
|
51
|
+
hexColor(COLOR_HEX.brand), hexColor(COLOR_HEX.red), hexColor(COLOR_HEX.green), hexColor(COLOR_HEX.yellow), hexColor(COLOR_HEX.blue), hexColor(COLOR_HEX.magenta), hexColor(COLOR_HEX.cyan), hexColor(COLOR_HEX.gray), ansi('\x1b[1m', '\x1b[22m'), ansi('\x1b[2m', '\x1b[22m'), Object.fromEntries(Object.entries({
|
|
52
|
+
31: COLOR_HEX.red,
|
|
53
|
+
32: COLOR_HEX.green,
|
|
54
|
+
33: COLOR_HEX.yellow,
|
|
55
|
+
34: COLOR_HEX.blue,
|
|
56
|
+
35: COLOR_HEX.magenta,
|
|
57
|
+
36: COLOR_HEX.cyan,
|
|
58
|
+
90: COLOR_HEX.gray,
|
|
59
|
+
91: COLOR_HEX.red,
|
|
60
|
+
92: COLOR_HEX.green,
|
|
61
|
+
93: COLOR_HEX.yellow,
|
|
62
|
+
94: COLOR_HEX.blue,
|
|
63
|
+
95: COLOR_HEX.magenta,
|
|
64
|
+
96: COLOR_HEX.cyan
|
|
45
65
|
}).map(([code, hex])=>[
|
|
46
66
|
code,
|
|
47
|
-
|
|
48
|
-
]))
|
|
67
|
+
COLOR_HEX_TO_OPEN[hex]
|
|
68
|
+
]));
|
|
49
69
|
let { merge } = __webpack_require__("compiled/webpack-merge");
|
|
50
70
|
__webpack_require__("compiled/launch-editor");
|
|
51
71
|
let enforceLFLineSeparators = (text)=>text ? text.replace(/\r\n/g, '\n') : text;
|
package/dist-types/colors.d.ts
CHANGED
|
@@ -25,6 +25,12 @@ export declare const colors: Colors;
|
|
|
25
25
|
* - 35 magenta
|
|
26
26
|
* - 36 cyan
|
|
27
27
|
* - 90 gray
|
|
28
|
+
* - 91 bright-red
|
|
29
|
+
* - 92 bright-green
|
|
30
|
+
* - 93 bright-yellow
|
|
31
|
+
* - 94 bright-blue
|
|
32
|
+
* - 95 bright-magenta
|
|
33
|
+
* - 96 bright-cyan
|
|
28
34
|
*/
|
|
29
35
|
export declare function convertBasicAnsiColors(input: string): string;
|
|
30
36
|
export {};
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AA6ED,eAAO,MAAM,MAAM,EAAE,MAWpB,CAAA;AAuBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAoB5D"}
|