@unpackjs/core 4.2.0 → 4.2.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/compiled/css-loader/index.js +20 -20
- package/compiled/less-loader/index.js +8 -8
- package/compiled/postcss-loader/index.js +8 -8
- package/compiled/sass-loader/index.js +8 -8
- package/dist/index.js +283 -189
- package/dist/rslib-runtime.js +0 -1
- package/dist-types/bundler-config/index.d.ts.map +1 -1
- package/dist-types/bundler-config/plugins/registerHooks.d.ts +4 -1
- package/dist-types/bundler-config/plugins/registerHooks.d.ts.map +1 -1
- package/dist-types/config.d.ts.map +1 -1
- package/dist-types/fs.d.ts +2 -0
- package/dist-types/fs.d.ts.map +1 -1
- package/dist-types/plugins/glob.d.ts.map +1 -1
- package/dist-types/plugins/unocss.d.ts +3 -2
- package/dist-types/plugins/unocss.d.ts.map +1 -1
- package/dist-types/types/config.d.ts +5 -5
- package/dist-types/types/config.d.ts.map +1 -1
- package/dist-types/types/plugin.d.ts +2 -2
- package/dist-types/types/plugin.d.ts.map +1 -1
- package/dist-types/utils.d.ts +2 -1
- package/dist-types/utils.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Compilation, rspack } from "@rspack/core";
|
|
|
10
10
|
import cac from "cac";
|
|
11
11
|
import node_fs from "node:fs";
|
|
12
12
|
import node_readline from "node:readline";
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
13
14
|
import node_os, { platform } from "node:os";
|
|
14
15
|
import portfinder from "portfinder";
|
|
15
16
|
import { glob as external_tinyglobby_glob, globSync } from "tinyglobby";
|
|
@@ -17,7 +18,6 @@ import { format, promisify } from "node:util";
|
|
|
17
18
|
import { TraceMap, originalPositionFor } from "@jridgewell/trace-mapping";
|
|
18
19
|
import { parse } from "stacktrace-parser";
|
|
19
20
|
import node_zlib from "node:zlib";
|
|
20
|
-
import { createHash } from "node:crypto";
|
|
21
21
|
import magic_string from "magic-string";
|
|
22
22
|
import { expand } from "dotenv-expand";
|
|
23
23
|
import node_assert from "node:assert";
|
|
@@ -122,11 +122,11 @@ let CSS_MODULES_LOCAL_IDENT_NAME = '[path][name]__[local]--[hash:5]', CSS_MODULE
|
|
|
122
122
|
</body>
|
|
123
123
|
</html>`, JS_REGEX = /\.[jt]s$/, JSX_REGEX = /\.[jt]sx$/, SCRIPT_REGEX = /\.[jt]sx?$/;
|
|
124
124
|
var utils_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
125
|
-
let { merge:
|
|
125
|
+
let { merge: mergeConfig } = __webpack_require__("compiled/webpack-merge"), { default: launchEditor } = __webpack_require__("compiled/launch-editor"), getNodeEnv = ()=>process.env.NODE_ENV, setNodeEnv = (env)=>{
|
|
126
126
|
process.env.NODE_ENV = env;
|
|
127
127
|
}, setDevServer = (isDevServer)=>{
|
|
128
128
|
process.env.DEV_SERVER = isDevServer ? 'true' : 'false';
|
|
129
|
-
}, isDev = ()=>'development' === getNodeEnv(), utils_isDevServer = ()=>'true' === process.env.DEV_SERVER,
|
|
129
|
+
}, isDev = ()=>'development' === getNodeEnv(), utils_isDevServer = ()=>'true' === process.env.DEV_SERVER, utils_isProd = ()=>'production' === getNodeEnv(), isWin = ()=>'win32' === process.platform, isString = (str)=>'string' == typeof str, isBoolean = (bool)=>'boolean' == typeof bool, isUndefined = (obj)=>void 0 === obj, isFunction = (func)=>'function' == typeof func, isObject = (obj)=>null !== obj && 'object' == typeof obj, isPlainObject = (obj)=>isObject(obj) && '[object Object]' === Object.prototype.toString.call(obj), isRegExp = (obj)=>'[object RegExp]' === Object.prototype.toString.call(obj), prettyTime = (seconds)=>{
|
|
130
130
|
let toFixed = (num, len)=>{
|
|
131
131
|
let factor = 10 ** len;
|
|
132
132
|
return Math.floor(num * factor) / factor;
|
|
@@ -169,7 +169,16 @@ function getTime() {
|
|
|
169
169
|
let now = new Date(), hours = String(now.getHours()).padStart(2, '0'), minutes = String(now.getMinutes()).padStart(2, '0'), seconds = String(now.getSeconds()).padStart(2, '0');
|
|
170
170
|
return `${hours}:${minutes}:${seconds}`;
|
|
171
171
|
}
|
|
172
|
-
let
|
|
172
|
+
let getFilesContentHash = (filePaths)=>{
|
|
173
|
+
let normalizedPaths = [
|
|
174
|
+
...filePaths
|
|
175
|
+
].filter(Boolean).map((filePath)=>node_path.resolve(filePath)).sort(), hash = createHash('sha256');
|
|
176
|
+
for (let filePath of normalizedPaths.filter((filePath)=>node_fs.existsSync(filePath))){
|
|
177
|
+
let content = node_fs.readFileSync(filePath);
|
|
178
|
+
hash.update(content);
|
|
179
|
+
}
|
|
180
|
+
return hash.digest('hex');
|
|
181
|
+
}, debounce = (fn, delay)=>{
|
|
173
182
|
let timer = null;
|
|
174
183
|
return (...args)=>{
|
|
175
184
|
clearTimeout(timer), timer = setTimeout(()=>{
|
|
@@ -329,7 +338,25 @@ function getHtmlTemplateOrContent(rawTemplate, root) {
|
|
|
329
338
|
templateContent
|
|
330
339
|
};
|
|
331
340
|
}
|
|
332
|
-
let injectToHead = (html, script)=>html.replace(/<head(\s*[^>]*)>/i, (match)=>`${match}${script}`),
|
|
341
|
+
let injectToHead = (html, script)=>html.replace(/<head(\s*[^>]*)>/i, (match)=>`${match}${script}`), loadConfigFile = async (configFilePath)=>{
|
|
342
|
+
if (isNodeVersionAtLeast(22, 18) || /\.(?:js|mjs|cjs)$/.test(configFilePath)) {
|
|
343
|
+
logger_logger.debug('loading config file with native loader:', colors.dim(configFilePath));
|
|
344
|
+
let configFileURL = pathToFileURL(configFilePath).href, exportModule = await import(`${configFileURL}?t=${Date.now()}`);
|
|
345
|
+
return exportModule.default ? exportModule.default : exportModule;
|
|
346
|
+
}
|
|
347
|
+
logger_logger.debug('loading config file with jiti:', colors.dim(configFilePath));
|
|
348
|
+
let { createJiti } = await import("jiti"), jiti = createJiti(import.meta.url, {
|
|
349
|
+
moduleCache: !1,
|
|
350
|
+
interopDefault: !0,
|
|
351
|
+
nativeModules: [
|
|
352
|
+
'@rspack/core',
|
|
353
|
+
"typescript"
|
|
354
|
+
]
|
|
355
|
+
});
|
|
356
|
+
return await jiti.import(configFilePath, {
|
|
357
|
+
default: !0
|
|
358
|
+
});
|
|
359
|
+
}, logger_prefixes = {
|
|
333
360
|
wait: '○',
|
|
334
361
|
error: '⨯',
|
|
335
362
|
warn: '⚠',
|
|
@@ -370,36 +397,15 @@ let injectToHead = (html, script)=>html.replace(/<head(\s*[^>]*)>/i, (match)=>`$
|
|
|
370
397
|
})(type, message, ...args);
|
|
371
398
|
};
|
|
372
399
|
}), logger);
|
|
373
|
-
var config_filename = __rspack_fileURLToPath(import.meta.url);
|
|
374
400
|
async function loadConfig({ cliOptions, command }) {
|
|
375
401
|
'build' === command ? setNodeEnv(cliOptions?.watch ? 'development' : 'production') : (setNodeEnv('development'), setDevServer(!0));
|
|
376
402
|
let root = cliOptions?.root ? node_path.resolve(cliOptions.root) : process.cwd(), configFilePath = resolveConfigPath(root, cliOptions?.config), configExport = {};
|
|
377
|
-
if (configFilePath) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
logger_logger.debug('loading config file with jiti:', colors.dim(configFilePath));
|
|
384
|
-
let { createJiti } = await import("jiti"), jiti = createJiti(config_filename, {
|
|
385
|
-
moduleCache: !1,
|
|
386
|
-
interopDefault: !0,
|
|
387
|
-
nativeModules: [
|
|
388
|
-
'@rspack/core',
|
|
389
|
-
"typescript"
|
|
390
|
-
]
|
|
391
|
-
});
|
|
392
|
-
configExport = await jiti.import(configFilePath, {
|
|
393
|
-
default: !0
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
if ('function' == typeof configExport) {
|
|
397
|
-
let params = {
|
|
398
|
-
env: getNodeEnv(),
|
|
399
|
-
command: process.argv[2]
|
|
400
|
-
};
|
|
401
|
-
if (void 0 === (configExport = await configExport(params))) throw Error('unpack config function must return a config object.');
|
|
402
|
-
}
|
|
403
|
+
if (configFilePath && 'function' == typeof (configExport = await loadConfigFile(configFilePath))) {
|
|
404
|
+
let params = {
|
|
405
|
+
env: getNodeEnv(),
|
|
406
|
+
command: process.argv[2]
|
|
407
|
+
};
|
|
408
|
+
if (void 0 === (configExport = await configExport(params))) throw Error('unpack config function must return a config object.');
|
|
403
409
|
}
|
|
404
410
|
let applyOption = (path, value)=>{
|
|
405
411
|
void 0 !== value && set(configExport, path, value);
|
|
@@ -470,6 +476,18 @@ let removeDir = (dir)=>{
|
|
|
470
476
|
recursive: !0,
|
|
471
477
|
force: !0
|
|
472
478
|
});
|
|
479
|
+
}, emptyDir = (dir)=>{
|
|
480
|
+
if (!node_fs.existsSync(dir)) return void node_fs.mkdirSync(dir, {
|
|
481
|
+
recursive: !0
|
|
482
|
+
});
|
|
483
|
+
for (let file of node_fs.readdirSync(dir))node_fs.rmSync(node_path.join(dir, file), {
|
|
484
|
+
recursive: !0,
|
|
485
|
+
force: !0
|
|
486
|
+
});
|
|
487
|
+
}, ensureDir = (dir)=>{
|
|
488
|
+
node_fs.existsSync(dir) || node_fs.mkdirSync(dir, {
|
|
489
|
+
recursive: !0
|
|
490
|
+
});
|
|
473
491
|
}, restartCleaners = [], addRestartCleaner = (...cleaners)=>{
|
|
474
492
|
restartCleaners.push(...cleaners);
|
|
475
493
|
}, cleanUpBeforeRestart = async ()=>{
|
|
@@ -493,26 +511,69 @@ async function getCompressedSize(content) {
|
|
|
493
511
|
let COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|md)$/i, GLOB_MAGIC_RE = /[*?[\]{}()!@+|]/, normalizeBaseDir = (raw)=>{
|
|
494
512
|
let normalized = raw.replace(/\\/g, '/');
|
|
495
513
|
return normalized && '.' !== normalized ? (normalized.startsWith('/') ? normalized = normalized.replace(/\/{2,}/g, '/') : normalized.startsWith('.') || (normalized = `./${normalized}`), (normalized = normalized.replace(/\/{2,}/g, '/')).endsWith('/') && (normalized = normalized.slice(0, -1)), '.' === normalized ? './' : normalized) : './';
|
|
496
|
-
}, toRegexLiteral = (source)=>`/${source.replace(/\\?\//g, (value)=>'/' === value ? '\\/' : value)}/`,
|
|
514
|
+
}, toRegexLiteral = (source)=>`/${source.replace(/\\?\//g, (value)=>'/' === value ? '\\/' : value)}/`, buildInnerRegExpSource = (glob)=>{
|
|
515
|
+
let source = glob.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
516
|
+
return (source = (source = source.replace(/\\\*\\\*/g, '.*')).replace(/\\\*/g, '[^/]*')).replace(/\\\?/g, '[^/]');
|
|
517
|
+
}, parseGlob = (pattern)=>{
|
|
497
518
|
let normalized = pattern.replace(/\\/g, '/'), isAbs = normalized.startsWith('/'), normalizedForParse = isAbs ? `.${normalized}` : normalized, globIndex = normalizedForParse.search(GLOB_MAGIC_RE), slashIndex = -1 === globIndex ? normalizedForParse.lastIndexOf('/') : normalizedForParse.lastIndexOf('/', globIndex), baseDirRaw = slashIndex >= 0 ? normalizedForParse.slice(0, slashIndex) : '.', globPart = slashIndex >= 0 ? normalizedForParse.slice(slashIndex + 1) : normalizedForParse, recursive = normalizedForParse.includes('**'), baseDir = isAbs ? normalizeBaseDir(`/${baseDirRaw.replace(/^\.\//, '')}`) : normalizeBaseDir(baseDirRaw);
|
|
498
519
|
return {
|
|
499
520
|
baseDir,
|
|
500
521
|
regExpSource: ((glob)=>{
|
|
501
522
|
let expansions;
|
|
502
523
|
if (!glob) return '^\\.\\/.*$';
|
|
503
|
-
let { replaced,
|
|
504
|
-
|
|
524
|
+
let { replaced: replacedExtGlob, negations } = ((glob)=>{
|
|
525
|
+
let negations = [], out = '';
|
|
526
|
+
for(let i = 0; i < glob.length; i++){
|
|
527
|
+
let ch = glob[i];
|
|
528
|
+
if ('!' !== ch || '(' !== glob[i + 1]) {
|
|
529
|
+
out += ch;
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
let j = i + 2, depth = 1;
|
|
533
|
+
for(; j < glob.length; j++){
|
|
534
|
+
let cj = glob[j];
|
|
535
|
+
if ('(' === cj) depth++;
|
|
536
|
+
else if (')' === cj && 0 == --depth) break;
|
|
537
|
+
}
|
|
538
|
+
if (0 !== depth) {
|
|
539
|
+
out += ch;
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
let inner = glob.slice(i + 2, j);
|
|
543
|
+
negations.push(inner), out += `__EXT_NEG_${negations.length - 1}__`, i = j;
|
|
544
|
+
}
|
|
545
|
+
return {
|
|
546
|
+
replaced: out,
|
|
547
|
+
negations
|
|
548
|
+
};
|
|
549
|
+
})(glob), { replaced, expansions: expansions1 } = (expansions = [], {
|
|
550
|
+
replaced: replacedExtGlob.replace(/\{([^}]+)\}/g, (_, inner)=>(expansions.push(inner), `__BRACE_${expansions.length - 1}__`)),
|
|
505
551
|
expansions
|
|
506
552
|
}), source = replaced.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
507
|
-
return source = (source = (source = (source = (source = (source = source.replace(/__BRACE_(\d+)__/g, (_, index)=>{
|
|
553
|
+
return source = (source = (source = (source = (source = (source = (source = source.replace(/__BRACE_(\d+)__/g, (_, index)=>{
|
|
508
554
|
let parts = (expansions1[Number(index)] || '').split(',').map((part)=>part.trim().replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
|
|
509
555
|
return `(${parts.join('|')})`;
|
|
556
|
+
})).replace(/__EXT_NEG_(\d+)__/g, (_, index)=>{
|
|
557
|
+
let parts = (negations[Number(index)] || '').split('|').map((part)=>part.trim()).filter(Boolean).map(buildInnerRegExpSource);
|
|
558
|
+
return parts.length ? `(?!(?:${parts.join('|')}))[^/]*` : '[^/]*';
|
|
510
559
|
})).replace(/\\\(([^)]+)\\\)\\\?/g, (_, inner)=>`(?:${inner})?`)).replace(/\\\*\\\*\\\//g, '(?:.*\\/)?')).replace(/\\\*\\\*/g, '.*')).replace(/\\\*/g, '[^/]*')).replace(/\\\?/g, '[^/]'), `^(?:\\.\\/)?${source}$`;
|
|
511
560
|
})(globPart),
|
|
512
561
|
recursive,
|
|
513
562
|
publicPrefix: './' === baseDir ? './' : baseDir
|
|
514
563
|
};
|
|
515
|
-
}, hasEager = (rawOptions)=>!!rawOptions && /eager\s*:\s*true/.test(rawOptions),
|
|
564
|
+
}, hasEager = (rawOptions)=>!!rawOptions && /eager\s*:\s*true/.test(rawOptions), normalizeGlobByAliases = (pattern, options)=>{
|
|
565
|
+
let trimmed = pattern.trim();
|
|
566
|
+
if (!trimmed || trimmed.startsWith('/') || trimmed.startsWith('.')) return trimmed;
|
|
567
|
+
for (let [rawKey, rawTarget] of Object.entries(options.alias).filter(([key])=>key && '/' !== key).sort((a, b)=>b[0].length - a[0].length)){
|
|
568
|
+
let key = rawKey.endsWith('/') ? rawKey.slice(0, -1) : rawKey;
|
|
569
|
+
if (!key || !trimmed.startsWith(`${key}/`)) continue;
|
|
570
|
+
let targetAbs = node_path.isAbsolute(rawTarget) ? rawTarget : node_path.resolve(options.root, rawTarget), rel = node_path.relative(options.root, targetAbs).replace(/\\/g, '/');
|
|
571
|
+
if (rel.startsWith('..')) continue;
|
|
572
|
+
let publicBase = `/${rel}`.replace(/\/{2,}/g, '/').replace(/\/$/, ''), rest = trimmed.slice(key.length);
|
|
573
|
+
return `${publicBase}${rest}`.replace(/\/{2,}/g, '/');
|
|
574
|
+
}
|
|
575
|
+
return trimmed;
|
|
576
|
+
}, SPECIAL_NO_ENTRY_DEPS = [
|
|
516
577
|
'@iconify-icons/material-symbols'
|
|
517
578
|
], FRAMEWORKS = [
|
|
518
579
|
'react',
|
|
@@ -555,23 +616,7 @@ let COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|
|
|
|
555
616
|
'uno.config.ts',
|
|
556
617
|
'uno.config.js',
|
|
557
618
|
'uno.config.mts'
|
|
558
|
-
],
|
|
559
|
-
if (/\.(?:js|mjs)$/.test(configFilePath)) {
|
|
560
|
-
let configFileURL = pathToFileURL(configFilePath).href, exportModule = await import(`${configFileURL}?t=${Date.now()}`);
|
|
561
|
-
return exportModule.default ? exportModule.default : exportModule;
|
|
562
|
-
}
|
|
563
|
-
let { createJiti } = await import("jiti"), jiti = createJiti(import.meta.url, {
|
|
564
|
-
moduleCache: !1,
|
|
565
|
-
interopDefault: !0,
|
|
566
|
-
nativeModules: [
|
|
567
|
-
'@rspack/core',
|
|
568
|
-
"typescript"
|
|
569
|
-
]
|
|
570
|
-
});
|
|
571
|
-
return await jiti.import(configFilePath, {
|
|
572
|
-
default: !0
|
|
573
|
-
});
|
|
574
|
-
}, LAYER_MARK_ALL = '__ALL__', HASH_PLACEHOLDER_RE = /#--unocss-hash--\s*\{\s*content\s*:\s*\\*"([^\\"]+)\\*";?\s*\}/g, LAYER_PLACEHOLDER_RE = /#--unocss--\s*\{\s*layer\s*:\s*(.+?)\s*(?:;\s*escape-view\s*:\s*(.+?)\s*)?;?\s*\}/g, SKIP_START_COMMENT = '@unocss-skip-start', SKIP_END_COMMENT = '@unocss-skip-end', SKIP_COMMENT_RE = RegExp(`(?://\\s*?${SKIP_START_COMMENT}\\s*?|/\\*\\s*?${SKIP_START_COMMENT}\\s*?\\*/|<!--\\s*?${SKIP_START_COMMENT}\\s*?-->)[\\s\\S]*?(?://\\s*?${SKIP_END_COMMENT}\\s*?|/\\*\\s*?${SKIP_END_COMMENT}\\s*?\\*/|<!--\\s*?${SKIP_END_COMMENT}\\s*?-->)`, 'g'), getCssEscaperForJsContent = (view)=>{
|
|
619
|
+
], LAYER_MARK_ALL = '__ALL__', HASH_PLACEHOLDER_RE = /#--unocss-hash--\s*\{\s*content\s*:\s*\\*"([^\\"]+)\\*";?\s*\}/g, LAYER_PLACEHOLDER_RE = /#--unocss--\s*\{\s*layer\s*:\s*(.+?)\s*(?:;\s*escape-view\s*:\s*(.+?)\s*)?;?\s*\}/g, SKIP_START_COMMENT = '@unocss-skip-start', SKIP_END_COMMENT = '@unocss-skip-end', SKIP_COMMENT_RE = RegExp(`(?://\\s*?${SKIP_START_COMMENT}\\s*?|/\\*\\s*?${SKIP_START_COMMENT}\\s*?\\*/|<!--\\s*?${SKIP_START_COMMENT}\\s*?-->)[\\s\\S]*?(?://\\s*?${SKIP_END_COMMENT}\\s*?|/\\*\\s*?${SKIP_END_COMMENT}\\s*?\\*/|<!--\\s*?${SKIP_END_COMMENT}\\s*?-->)`, 'g'), LAYER_IMPORT_RE = /(['"])uno:([^'"]+?)\.css\1/g, getCssEscaperForJsContent = (view)=>{
|
|
575
620
|
if (!view) return (css)=>css;
|
|
576
621
|
let prefix = {};
|
|
577
622
|
return view.trim().replace(/(\\*)\\(["'`\\])/g, (_, bs, char)=>(prefix[char] = bs.replace(/\\\\/g, '\\'), '')), (css)=>css.replace(/["'`\\]/g, (v)=>(prefix[v] || '') + v);
|
|
@@ -687,7 +732,7 @@ async function applyCacheConfig({ config, unpackConfig, envFilePaths }) {
|
|
|
687
732
|
let cacheConfig = isPlainObject(unpackConfig.performance.cache) ? unpackConfig.performance.cache : {}, buildDependencies = await getBuildDependencies(unpackConfig.root);
|
|
688
733
|
buildDependencies.userBuildDependencies = cacheConfig.buildDependencies || [], buildDependencies.envFilePaths = envFilePaths;
|
|
689
734
|
let cacheDirectory = node_path.resolve(unpackConfig.root, cacheConfig.cacheDirectory || `${unpackConfig._context.cachePath}/cache`, utils_isDevServer() ? 'dev' : 'build');
|
|
690
|
-
return
|
|
735
|
+
return mergeConfig(config, {
|
|
691
736
|
cache: !0,
|
|
692
737
|
experiments: {
|
|
693
738
|
cache: {
|
|
@@ -788,7 +833,7 @@ let MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\
|
|
|
788
833
|
};
|
|
789
834
|
async function getEntry(root, customEntry) {
|
|
790
835
|
let entry;
|
|
791
|
-
if (entry = customEntry ? node_path.resolve(root, customEntry) : (await external_tinyglobby_glob('(index|
|
|
836
|
+
if (entry = customEntry ? node_path.resolve(root, customEntry) : (await external_tinyglobby_glob('(index|main).{js,ts,jsx,tsx}', {
|
|
792
837
|
cwd: node_path.join(root, 'src'),
|
|
793
838
|
absolute: !0
|
|
794
839
|
}))[0], !node_fs.existsSync(entry)) throw Error('could not find entry file');
|
|
@@ -830,7 +875,7 @@ class JsMinifyPlugin {
|
|
|
830
875
|
apply(compiler) {
|
|
831
876
|
let meta = JSON.stringify({
|
|
832
877
|
name: jsMinify_PLUGIN_NAME,
|
|
833
|
-
version: "4.2.
|
|
878
|
+
version: "4.2.2",
|
|
834
879
|
options: this.minifyOptions
|
|
835
880
|
});
|
|
836
881
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
@@ -974,46 +1019,29 @@ class ProgressPlugin extends rspack.ProgressPlugin {
|
|
|
974
1019
|
let registerHooks_PLUGIN_NAME = 'RegisterHooksPlugin';
|
|
975
1020
|
class RegisterHooksPlugin {
|
|
976
1021
|
isFirstCompile = !0;
|
|
1022
|
+
lastVirtualModules = new Map();
|
|
1023
|
+
isCompiling = !1;
|
|
1024
|
+
idleTimer = void 0;
|
|
977
1025
|
apply(compiler) {
|
|
978
1026
|
let virtualModulesPlugin = new rspack.experiments.VirtualModulesPlugin();
|
|
979
|
-
virtualModulesPlugin.apply(compiler), compiler.hooks.
|
|
980
|
-
|
|
981
|
-
|
|
1027
|
+
virtualModulesPlugin.apply(compiler), compiler.hooks.compile.tap(registerHooks_PLUGIN_NAME, ()=>{
|
|
1028
|
+
this.isCompiling = !0, applyPluginsByHookSync('buildStart', (impl)=>{
|
|
1029
|
+
impl({
|
|
982
1030
|
compiler,
|
|
983
1031
|
isFirstCompile: this.isFirstCompile,
|
|
984
|
-
isWatch:
|
|
1032
|
+
isWatch: isDev()
|
|
985
1033
|
});
|
|
986
1034
|
});
|
|
987
|
-
})
|
|
988
|
-
|
|
989
|
-
await applyPluginsByHook('buildEnd', async (impl)=>{
|
|
990
|
-
await impl({
|
|
991
|
-
compiler,
|
|
992
|
-
isFirstCompile: this.isFirstCompile,
|
|
993
|
-
isWatch: isWatch(),
|
|
994
|
-
stats
|
|
995
|
-
});
|
|
996
|
-
});
|
|
997
|
-
} finally{
|
|
998
|
-
stats?.compilation && ((compilation)=>{
|
|
999
|
-
let pluginMap = transformTimingMap.get(compilation);
|
|
1000
|
-
if (pluginMap) {
|
|
1001
|
-
for (let [pluginName, total] of pluginMap)logger_logger.debug(`${colors.magenta('[plugin]')} ${colors.cyan(pluginName)} ${colors.blue('transform')} ${colors.dim('in')} ${colors.yellow(`${total.toFixed(2)}ms`)}`);
|
|
1002
|
-
transformTimingMap.delete(compilation);
|
|
1003
|
-
}
|
|
1004
|
-
})(stats.compilation);
|
|
1005
|
-
}
|
|
1006
|
-
this.isFirstCompile = !1;
|
|
1007
|
-
}), compiler.hooks.compilation.tap(registerHooks_PLUGIN_NAME, (compilation)=>{
|
|
1008
|
-
rspack.HtmlRspackPlugin.getCompilationHooks(compilation).beforeEmit.tapPromise(registerHooks_PLUGIN_NAME, async (data)=>(await applyPluginsByHook('transformHtml', async (impl)=>{
|
|
1009
|
-
data.html = await impl(data.html);
|
|
1010
|
-
}), data));
|
|
1011
|
-
}), compiler.hooks.thisCompilation.tap(registerHooks_PLUGIN_NAME, (compilation)=>{
|
|
1035
|
+
});
|
|
1036
|
+
let updateVirtualModules = ()=>{
|
|
1012
1037
|
applyPluginsByHookSync('virtualModules', (impl)=>{
|
|
1013
1038
|
Object.entries(impl()).forEach(([path, content])=>{
|
|
1014
|
-
virtualModulesPlugin.writeModule(path, content);
|
|
1039
|
+
this.lastVirtualModules.get(path) !== content && (this.lastVirtualModules.set(path, content), virtualModulesPlugin.writeModule(path, content));
|
|
1015
1040
|
});
|
|
1016
|
-
})
|
|
1041
|
+
});
|
|
1042
|
+
};
|
|
1043
|
+
compiler.hooks.thisCompilation.tap(registerHooks_PLUGIN_NAME, (compilation)=>{
|
|
1044
|
+
updateVirtualModules(), applyPluginsByHook('processAssets', (impl, plugin)=>{
|
|
1017
1045
|
let { stage, handler } = impl;
|
|
1018
1046
|
compilation.hooks.processAssets.tapPromise({
|
|
1019
1047
|
name: registerHooks_PLUGIN_NAME,
|
|
@@ -1033,6 +1061,29 @@ class RegisterHooksPlugin {
|
|
|
1033
1061
|
}
|
|
1034
1062
|
});
|
|
1035
1063
|
});
|
|
1064
|
+
}), compiler.hooks.compilation.tap(registerHooks_PLUGIN_NAME, (compilation)=>{
|
|
1065
|
+
rspack.HtmlRspackPlugin.getCompilationHooks(compilation).beforeEmit.tapPromise(registerHooks_PLUGIN_NAME, async (data)=>(await applyPluginsByHook('transformHtml', async (impl)=>{
|
|
1066
|
+
data.html = await impl(data.html);
|
|
1067
|
+
}), data));
|
|
1068
|
+
}), compiler.hooks.finishMake.tap(registerHooks_PLUGIN_NAME, (compilation)=>{
|
|
1069
|
+
let pluginMap = transformTimingMap.get(compilation);
|
|
1070
|
+
if (pluginMap) {
|
|
1071
|
+
for (let [pluginName, total] of pluginMap)logger_logger.debug(`${colors.magenta('[plugin]')} ${colors.cyan(pluginName)} ${colors.blue('transform')} ${colors.dim('in')} ${colors.yellow(`${total.toFixed(2)}ms`)}`);
|
|
1072
|
+
transformTimingMap.delete(compilation);
|
|
1073
|
+
}
|
|
1074
|
+
}), compiler.hooks.done.tapPromise(registerHooks_PLUGIN_NAME, async (stats)=>{
|
|
1075
|
+
await applyPluginsByHook('buildEnd', async (impl)=>{
|
|
1076
|
+
await impl({
|
|
1077
|
+
compiler,
|
|
1078
|
+
isFirstCompile: this.isFirstCompile,
|
|
1079
|
+
isWatch: isDev(),
|
|
1080
|
+
stats
|
|
1081
|
+
});
|
|
1082
|
+
}), this.isFirstCompile = !1;
|
|
1083
|
+
}), compiler.hooks.afterDone.tap(registerHooks_PLUGIN_NAME, ()=>{
|
|
1084
|
+
this.isCompiling = !1, isDev() && (clearTimeout(this.idleTimer), this.idleTimer = setTimeout(()=>{
|
|
1085
|
+
this.isCompiling || updateVirtualModules();
|
|
1086
|
+
}, 50));
|
|
1036
1087
|
});
|
|
1037
1088
|
}
|
|
1038
1089
|
}
|
|
@@ -1072,7 +1123,7 @@ async function getBundlerConfig(originalUnpackConfig) {
|
|
|
1072
1123
|
await applyPluginsByHook('config', async (impl)=>{
|
|
1073
1124
|
rest = await impl(rest, {
|
|
1074
1125
|
...originalUnpackConfig._context,
|
|
1075
|
-
mergeConfig:
|
|
1126
|
+
mergeConfig: mergeConfig
|
|
1076
1127
|
});
|
|
1077
1128
|
});
|
|
1078
1129
|
let unpackConfig = {
|
|
@@ -1081,9 +1132,9 @@ async function getBundlerConfig(originalUnpackConfig) {
|
|
|
1081
1132
|
bundlerConfig
|
|
1082
1133
|
};
|
|
1083
1134
|
setCurrentUnpackConfig(unpackConfig), await applyPluginsByHook('configResolved', async (impl)=>{
|
|
1084
|
-
await impl(unpackConfig);
|
|
1135
|
+
await impl(unpackConfig, originalUnpackConfig._context);
|
|
1085
1136
|
});
|
|
1086
|
-
let tsconfigPath = node_path.resolve(unpackConfig.root, 'tsconfig.json'),
|
|
1137
|
+
let tsconfigPath = node_path.resolve(unpackConfig.root, 'tsconfig.json'), isTS = node_fs.existsSync(tsconfigPath), minifyOptions = isPlainObject(unpackConfig.build?.minify) ? unpackConfig.build?.minify : {}, { publicVars, filePaths: envFilePaths } = function({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
1087
1138
|
'PUBLIC_'
|
|
1088
1139
|
], processEnv = process.env } = {}) {
|
|
1089
1140
|
if ('local' === mode) throw Error(`${colors.yellow('local')} cannot be used as a value for env mode, because ${colors.yellow('.env.local')} represents a temporary local file. Please use another value.`);
|
|
@@ -1200,11 +1251,11 @@ async function getBundlerConfig(originalUnpackConfig) {
|
|
|
1200
1251
|
].filter(Boolean),
|
|
1201
1252
|
externals: unpackConfig.externals,
|
|
1202
1253
|
resolve: {
|
|
1203
|
-
tsConfig:
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1254
|
+
tsConfig: isTS ? {
|
|
1255
|
+
configFile: tsconfigPath,
|
|
1256
|
+
references: 'auto'
|
|
1257
|
+
} : void 0,
|
|
1258
|
+
alias: unpackConfig.resolve?.alias,
|
|
1208
1259
|
extensionAlias: {
|
|
1209
1260
|
'.js': [
|
|
1210
1261
|
'.js',
|
|
@@ -1239,12 +1290,12 @@ async function getBundlerConfig(originalUnpackConfig) {
|
|
|
1239
1290
|
moduleIds: isDev() ? 'named' : 'deterministic',
|
|
1240
1291
|
minimize: !!unpackConfig.build?.minify && utils_isProd(),
|
|
1241
1292
|
minimizer: [
|
|
1242
|
-
new JsMinifyPlugin(
|
|
1293
|
+
new JsMinifyPlugin(mergeConfig({
|
|
1243
1294
|
compress: {
|
|
1244
1295
|
target: unpackConfig.build.target
|
|
1245
1296
|
}
|
|
1246
1297
|
}, minifyOptions.oxc || {})),
|
|
1247
|
-
new rspack.LightningCssMinimizerRspackPlugin(
|
|
1298
|
+
new rspack.LightningCssMinimizerRspackPlugin(mergeConfig({
|
|
1248
1299
|
minimizerOptions: {
|
|
1249
1300
|
targets: esVersionToBrowserslist(unpackConfig.build.target)
|
|
1250
1301
|
}
|
|
@@ -1342,7 +1393,7 @@ async function getBundlerConfig(originalUnpackConfig) {
|
|
|
1342
1393
|
type: 'css/module'
|
|
1343
1394
|
}), getLessLoader = ()=>({
|
|
1344
1395
|
loader: getCompiledPkgPath('less-loader'),
|
|
1345
|
-
options:
|
|
1396
|
+
options: mergeConfig({
|
|
1346
1397
|
lessOptions: {
|
|
1347
1398
|
javascriptEnabled: !0
|
|
1348
1399
|
},
|
|
@@ -1487,7 +1538,7 @@ async function getBundlerConfig(originalUnpackConfig) {
|
|
|
1487
1538
|
getCssLoader(),
|
|
1488
1539
|
{
|
|
1489
1540
|
loader: getCompiledPkgPath('less-loader'),
|
|
1490
|
-
options:
|
|
1541
|
+
options: mergeConfig({
|
|
1491
1542
|
lessOptions: {
|
|
1492
1543
|
javascriptEnabled: !0
|
|
1493
1544
|
},
|
|
@@ -1540,7 +1591,7 @@ async function getBundlerConfig(originalUnpackConfig) {
|
|
|
1540
1591
|
})), unpackConfig.performance?.buildAnalyze && utils_isProd() && (config = await applyBuildAnalyzeConfig({
|
|
1541
1592
|
config,
|
|
1542
1593
|
unpackConfig
|
|
1543
|
-
})), unpackConfig.typeCheck && isDev() &&
|
|
1594
|
+
})), unpackConfig.typeCheck && isDev() && isTS && (config = await applyTypeCheckConfig({
|
|
1544
1595
|
config,
|
|
1545
1596
|
unpackConfig
|
|
1546
1597
|
})), unpackConfig.detectCircular && (config = function({ config, unpackConfig }) {
|
|
@@ -1578,13 +1629,13 @@ async function getBundlerConfig(originalUnpackConfig) {
|
|
|
1578
1629
|
unpackConfig
|
|
1579
1630
|
})), await applyPluginsByHook('bundlerConfig', async (impl)=>{
|
|
1580
1631
|
config = await impl(config, {
|
|
1581
|
-
...
|
|
1632
|
+
...originalUnpackConfig._context,
|
|
1582
1633
|
unpackConfig,
|
|
1583
|
-
mergeConfig:
|
|
1634
|
+
mergeConfig: mergeConfig
|
|
1584
1635
|
});
|
|
1585
1636
|
}), unpackConfig.bundlerConfig && (config = isFunction(unpackConfig.bundlerConfig) ? await unpackConfig.bundlerConfig(config, {
|
|
1586
|
-
mergeConfig:
|
|
1587
|
-
}) :
|
|
1637
|
+
mergeConfig: mergeConfig
|
|
1638
|
+
}) : mergeConfig(config, unpackConfig.bundlerConfig)), config;
|
|
1588
1639
|
}
|
|
1589
1640
|
async function unpackBuild(unpackConfig) {
|
|
1590
1641
|
let compiler = rspack(await getBundlerConfig(unpackConfig)), handler = (err, stats)=>{
|
|
@@ -1595,9 +1646,9 @@ async function unpackBuild(unpackConfig) {
|
|
|
1595
1646
|
stats?.hasErrors() && console.log(stats.toString({
|
|
1596
1647
|
colors: !0,
|
|
1597
1648
|
preset: 'errors-only'
|
|
1598
|
-
})),
|
|
1649
|
+
})), utils_isProd() && compiler.close(()=>{});
|
|
1599
1650
|
};
|
|
1600
|
-
|
|
1651
|
+
utils_isProd() ? compiler.run(handler) : compiler.watch({}, handler);
|
|
1601
1652
|
}
|
|
1602
1653
|
var openBrowser_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
1603
1654
|
async function openBrowser(url) {
|
|
@@ -1705,7 +1756,7 @@ async function unpackDev(unpackConfig) {
|
|
|
1705
1756
|
...middlewares
|
|
1706
1757
|
]);
|
|
1707
1758
|
let server = new RspackDevServer(devServerOptions, compiler);
|
|
1708
|
-
await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v4.2.
|
|
1759
|
+
await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v4.2.2`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - getUnpackStartTime()))} ${colors.dim('ms')}\n`), printServerUrls({
|
|
1709
1760
|
port,
|
|
1710
1761
|
host: unpackConfig.server.host,
|
|
1711
1762
|
base: unpackConfig.base
|
|
@@ -1719,10 +1770,10 @@ async function unpackDev(unpackConfig) {
|
|
|
1719
1770
|
function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'unpack' }) {
|
|
1720
1771
|
let _context = {
|
|
1721
1772
|
callerName,
|
|
1722
|
-
version: "4.2.
|
|
1773
|
+
version: "4.2.2",
|
|
1723
1774
|
cachePath: 'node_modules/.unpack'
|
|
1724
1775
|
}, resolveConfig = (mode)=>{
|
|
1725
|
-
let rootPath, outputPath, basePath, cachedTraceMap, fs, isValidMethodName, parseFrame, formatOriginalLocation, formatFullStack, resolveErrorLocationAndStack, shouldTransformDeepImport, preJsAssets, jsAssets, cssAssets, bundledDepsCachePath, deepImportPkgPattern, deepImportRegex, plugin,
|
|
1776
|
+
let rootPath, outputPath, basePath, cachedTraceMap, fs, isValidMethodName, parseFrame, formatOriginalLocation, formatFullStack, resolveErrorLocationAndStack, root, alias, shouldTransformDeepImport, preJsAssets, jsAssets, cssAssets, bundledDepsCachePath, deepImportPkgPattern, deepImportRegex, plugin, root1, uno, generated, configOrPathFromUnpackConfig, defaultsFromUnpackConfig, VIRTUAL_UNO_CSS_ID, rootDir, isMpa, unoConfig, configFilePath, unpackConfigPath, tokens, requestedLayers, tasks, unocssCacheDir, tokensCachePath, layersCachePath, timeCachePath, configHashCachePath, generatedCachePath, bundlerCacheDir, cachedTokensLength, cachedLayersLength, isCompiling, resolveUnocssConfig, flushTasks, getLayersKey, getVirtualModuleContent, hash, restoreSkipCode, applyUnoTransformers, getCustomLayers, optionsFromUnpackConfig, rootPath1, registerCode, namesCode, defaultConfig = {
|
|
1726
1777
|
root: cwd,
|
|
1727
1778
|
base: '/',
|
|
1728
1779
|
sourceMap: 'production' !== mode && 'cheap-module-source-map',
|
|
@@ -1866,7 +1917,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
1866
1917
|
}, {
|
|
1867
1918
|
name: 'unpack:browser-logs',
|
|
1868
1919
|
apply: (config, { command })=>'dev' === command && config.dev?.browserLogs,
|
|
1869
|
-
buildStart:
|
|
1920
|
+
buildStart: ({ isFirstCompile, compiler })=>{
|
|
1870
1921
|
isFirstCompile && (fs = compiler.outputFileSystem);
|
|
1871
1922
|
},
|
|
1872
1923
|
configResolved: (config)=>{
|
|
@@ -2025,8 +2076,11 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2025
2076
|
...middlewares
|
|
2026
2077
|
]
|
|
2027
2078
|
}),
|
|
2028
|
-
{
|
|
2079
|
+
(root = '', alias = {}, {
|
|
2029
2080
|
name: 'unpack:glob',
|
|
2081
|
+
configResolved: (config)=>{
|
|
2082
|
+
root = config.root, alias = config.resolve?.alias || {};
|
|
2083
|
+
},
|
|
2030
2084
|
transform: {
|
|
2031
2085
|
filter: {
|
|
2032
2086
|
test: JS_REGEX
|
|
@@ -2045,10 +2099,10 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2045
2099
|
excludes
|
|
2046
2100
|
});
|
|
2047
2101
|
return includes1.length ? (({ includes, excludes, eager })=>{
|
|
2048
|
-
let excludeMatchers = excludes.map((item)=>toRegexLiteral(item.regExpSource)).join(', '), includeItems = includes.map((item)=>{
|
|
2102
|
+
let excludeMatchers = excludes.map((item)=>toRegexLiteral(item.regExpSource)).join(', '), modeExpr = eager ? 'sync' : 'lazy', includeItems = includes.map((item)=>{
|
|
2049
2103
|
let prefix = './' === item.publicPrefix ? '' : `${item.publicPrefix}/`, mapKeyExpr = './' === item.publicPrefix ? "key.startsWith('./') ? key : './' + key" : `${JSON.stringify(prefix)} + (key.startsWith('./') ? key.slice(2) : key)`;
|
|
2050
2104
|
return `{
|
|
2051
|
-
context: import.meta.webpackContext(${JSON.stringify(item.baseDir)}, { recursive: ${item.recursive}, regExp: ${toRegexLiteral(item.regExpSource)} }),
|
|
2105
|
+
context: import.meta.webpackContext(${JSON.stringify(item.baseDir)}, { recursive: ${item.recursive}, regExp: ${toRegexLiteral(item.regExpSource)}, mode: ${JSON.stringify(modeExpr)} }),
|
|
2052
2106
|
mapKey: (key) => ${mapKeyExpr}
|
|
2053
2107
|
}`;
|
|
2054
2108
|
}).join(', '), excludeList = excludeMatchers ? `[${excludeMatchers}]` : '[]';
|
|
@@ -2062,27 +2116,36 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2062
2116
|
const path = mapKey(key)
|
|
2063
2117
|
if (isExcluded(path)) continue
|
|
2064
2118
|
if (!modules[path]) {
|
|
2065
|
-
modules[path] = ${eager ? 'context(key)' : '() =>
|
|
2119
|
+
modules[path] = ${eager ? 'context(key)' : '() => context(key)'}
|
|
2066
2120
|
}
|
|
2067
2121
|
}
|
|
2068
2122
|
}
|
|
2069
2123
|
return modules
|
|
2070
2124
|
})()`;
|
|
2071
2125
|
})({
|
|
2072
|
-
includes: includes1.map(
|
|
2073
|
-
|
|
2126
|
+
includes: includes1.map((p)=>normalizeGlobByAliases(p, {
|
|
2127
|
+
root,
|
|
2128
|
+
alias
|
|
2129
|
+
})).map(parseGlob),
|
|
2130
|
+
excludes: excludes1.map((p)=>normalizeGlobByAliases(p, {
|
|
2131
|
+
root,
|
|
2132
|
+
alias
|
|
2133
|
+
})).map(parseGlob),
|
|
2074
2134
|
eager: hasEager(rawOptions)
|
|
2075
2135
|
}) : '({})';
|
|
2076
2136
|
}
|
|
2077
|
-
let { baseDir, regExpSource, recursive, publicPrefix } = parseGlob(pattern
|
|
2137
|
+
let { baseDir, regExpSource, recursive, publicPrefix } = parseGlob(normalizeGlobByAliases(pattern, {
|
|
2138
|
+
root,
|
|
2139
|
+
alias
|
|
2140
|
+
}));
|
|
2078
2141
|
return (({ baseDir, regExpSource, recursive, eager, publicPrefix })=>{
|
|
2079
2142
|
let prefix = './' === publicPrefix ? '' : `${publicPrefix}/`, mapKeyExpr = './' === publicPrefix ? "key.startsWith('./') ? key : './' + key" : `${JSON.stringify(prefix)} + (key.startsWith('./') ? key.slice(2) : key)`;
|
|
2080
2143
|
return `(() => {
|
|
2081
|
-
const context = import.meta.webpackContext(${JSON.stringify(baseDir)}, { recursive: ${recursive}, regExp: ${toRegexLiteral(regExpSource)} })
|
|
2144
|
+
const context = import.meta.webpackContext(${JSON.stringify(baseDir)}, { recursive: ${recursive}, regExp: ${toRegexLiteral(regExpSource)}, mode: ${JSON.stringify(eager ? 'sync' : 'lazy')} })
|
|
2082
2145
|
const modules = {}
|
|
2083
2146
|
for (const key of context.keys()) {
|
|
2084
2147
|
const path = ${mapKeyExpr}
|
|
2085
|
-
modules[path] = ${eager ? 'context(key)' : '() =>
|
|
2148
|
+
modules[path] = ${eager ? 'context(key)' : '() => context(key)'}
|
|
2086
2149
|
}
|
|
2087
2150
|
return modules
|
|
2088
2151
|
})()`;
|
|
@@ -2095,7 +2158,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2095
2158
|
});
|
|
2096
2159
|
}) : null
|
|
2097
2160
|
}
|
|
2098
|
-
},
|
|
2161
|
+
}),
|
|
2099
2162
|
(shouldTransformDeepImport = !1, preJsAssets = [], jsAssets = [], cssAssets = [], bundledDepsCachePath = '', deepImportPkgPattern = [
|
|
2100
2163
|
...SPECIAL_NO_ENTRY_DEPS
|
|
2101
2164
|
].sort((a, b)=>b.length - a.length).map((name)=>name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), deepImportRegex = RegExp(`import\\s+([a-zA-Z0-9_$]+)\\s+from\\s+['"]((${deepImportPkgPattern})/[^'"]+)['"]`, 'g'), plugin = {
|
|
@@ -2373,11 +2436,11 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2373
2436
|
}), config;
|
|
2374
2437
|
}
|
|
2375
2438
|
}),
|
|
2376
|
-
(
|
|
2439
|
+
(root1 = '', {
|
|
2377
2440
|
name: 'unpack:file-size',
|
|
2378
2441
|
apply: (config, { mode })=>'production' === mode && config.performance?.printFileSize,
|
|
2379
2442
|
configResolved (config) {
|
|
2380
|
-
|
|
2443
|
+
root1 = config.root;
|
|
2381
2444
|
},
|
|
2382
2445
|
buildEnd: async (options)=>{
|
|
2383
2446
|
let { stats } = options;
|
|
@@ -2403,7 +2466,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2403
2466
|
color: 'cyan',
|
|
2404
2467
|
chunks: []
|
|
2405
2468
|
}
|
|
2406
|
-
], chunkGroupMap = chunkGroups.reduce((acc, cur)=>(acc[cur.type] = cur, acc), {}), distPath = stats.compilation.outputOptions.path, distFolder = node_path.relative(
|
|
2469
|
+
], chunkGroupMap = chunkGroups.reduce((acc, cur)=>(acc[cur.type] = cur, acc), {}), distPath = stats.compilation.outputOptions.path, distFolder = node_path.relative(root1, distPath), assets = Object.entries(stats.compilation.assets), longest = 0, totalSize = 0, totalCompressedSize = 0;
|
|
2407
2470
|
logUpdate('computing gzip size...'), await Promise.all(assets.map(async ([assetName, value])=>{
|
|
2408
2471
|
let content, compressedSize, filePath = assetName.split('?')[0];
|
|
2409
2472
|
try {
|
|
@@ -2445,41 +2508,27 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2445
2508
|
log += colors.blue(displaySize(totalSize)), console.log(log += colors.dim(` │ gzip: ${displaySize(totalCompressedSize)}`));
|
|
2446
2509
|
}
|
|
2447
2510
|
}),
|
|
2448
|
-
(VIRTUAL_UNO_CSS_ID = 'uno.css', rootDir = process.cwd(), unoConfig = {}, tokens = new Set(),
|
|
2511
|
+
(VIRTUAL_UNO_CSS_ID = 'uno.css', rootDir = process.cwd(), isMpa = !1, unoConfig = {}, configFilePath = '', unpackConfigPath = '', tokens = new Set(), requestedLayers = new Set([
|
|
2449
2512
|
LAYER_MARK_ALL
|
|
2450
|
-
]),
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2513
|
+
]), tasks = [], unocssCacheDir = '', tokensCachePath = '', layersCachePath = '', timeCachePath = '', configHashCachePath = '', generatedCachePath = '', bundlerCacheDir = '', cachedTokensLength = 0, cachedLayersLength = 0, isCompiling = !0, resolveUnocssConfig = async ()=>{
|
|
2514
|
+
let resolvedConfigOrPath = (void 0) ?? configOrPathFromUnpackConfig, resolvedDefaults = (void 0) ?? defaultsFromUnpackConfig, configFromOption = {};
|
|
2515
|
+
return isPlainObject(resolvedConfigOrPath) ? configFromOption = resolvedConfigOrPath : isString(resolvedConfigOrPath) && (configFilePath = node_path.isAbsolute(resolvedConfigOrPath) ? resolvedConfigOrPath : node_path.resolve(rootDir, resolvedConfigOrPath)), configFilePath = ((root, customConfig)=>{
|
|
2516
|
+
if (customConfig) {
|
|
2517
|
+
let absPath = node_path.isAbsolute(customConfig) ? customConfig : node_path.resolve(root, customConfig);
|
|
2518
|
+
if (node_fs.existsSync(absPath)) return absPath;
|
|
2519
|
+
}
|
|
2454
2520
|
for (let file of UNOCSS_CONFIG_FILES){
|
|
2455
2521
|
let configFile = node_path.join(root, file);
|
|
2456
2522
|
if (node_fs.existsSync(configFile)) return configFile;
|
|
2457
2523
|
}
|
|
2458
|
-
})(rootDir)
|
|
2459
|
-
let loaded = await loadConfigFile(configFilePath);
|
|
2460
|
-
if (isFunction(loaded)) {
|
|
2461
|
-
let result = await loaded({
|
|
2462
|
-
env: isDev() ? 'development' : 'production',
|
|
2463
|
-
command: isDev() ? 'dev' : 'build'
|
|
2464
|
-
});
|
|
2465
|
-
result && (configFromOption = utils_mergeConfig(configFromOption, result));
|
|
2466
|
-
} else loaded && (configFromOption = utils_mergeConfig(configFromOption, loaded));
|
|
2467
|
-
}
|
|
2468
|
-
resolvedDefaults && (configFromOption = utils_mergeConfig(resolvedDefaults, configFromOption)), unoConfig = configFromOption;
|
|
2469
|
-
let createGenerator = core.createGenerator;
|
|
2470
|
-
if (!createGenerator) throw Error('Failed to load "createGenerator" from "@unocss/core".');
|
|
2471
|
-
uno = await createGenerator(unoConfig), tokens = new Set();
|
|
2472
|
-
}, invalidate = ()=>{
|
|
2473
|
-
setTimeout(()=>{
|
|
2474
|
-
compilerRef.watching.invalidate(), logger_logger.debug(colors.yellow('[unocss] Invalidation triggered.'));
|
|
2475
|
-
}, 0);
|
|
2524
|
+
})(rootDir, configFilePath), configFromOption = mergeConfig(configFromOption, await loadConfigFile(configFilePath)), resolvedDefaults && (configFromOption = mergeConfig(resolvedDefaults, configFromOption)), configFromOption;
|
|
2476
2525
|
}, flushTasks = async ()=>{
|
|
2477
2526
|
if (!tasks.length) return;
|
|
2478
2527
|
let pending = tasks.map((t)=>t());
|
|
2479
2528
|
tasks = [], await Promise.all(pending);
|
|
2480
|
-
},
|
|
2481
|
-
let code,
|
|
2482
|
-
return `#--unocss-hash--{content:"${hash}"}
|
|
2529
|
+
}, getLayersKey = ()=>Array.from(requestedLayers).sort().join(','), getVirtualModuleContent = (layer)=>{
|
|
2530
|
+
let code, hash = (code = `${tokens.size}|${layer}|${getLayersKey()}`, createHash('sha256').update(code).digest('hex').slice(0, 8));
|
|
2531
|
+
return `#--unocss-hash--{content:"${hash}"}#--unocss--{layer:${layer};escape-view:\\"\\'\\\`\\\\}`;
|
|
2483
2532
|
}, hash = (str)=>{
|
|
2484
2533
|
let i, l, hVal = 0x811c9dc5;
|
|
2485
2534
|
for(i = 0, l = str.length; i < l; i++)hVal ^= str.charCodeAt(i), hVal += (hVal << 1) + (hVal << 4) + (hVal << 7) + (hVal << 8) + (hVal << 24);
|
|
@@ -2489,7 +2538,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2489
2538
|
for (let [withHashKey, matched] of map.entries())next = next.replaceAll(withHashKey, matched);
|
|
2490
2539
|
return next;
|
|
2491
2540
|
}, applyUnoTransformers = async (original, id, enforce = 'default')=>{
|
|
2492
|
-
if (
|
|
2541
|
+
if (original.includes('@unocss-ignore')) return null;
|
|
2493
2542
|
let transformers = (uno.config.transformers || []).filter((i)=>(i.enforce || 'default') === enforce);
|
|
2494
2543
|
if (!transformers.length) return null;
|
|
2495
2544
|
let skipMap = new Map(), code = original, s = new magic_string(((code, map, rules, keyFlag)=>{
|
|
@@ -2503,69 +2552,114 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2503
2552
|
for (let t of transformers)(!t.idFilter || t.idFilter(id)) && (await t.transform(s, id, {
|
|
2504
2553
|
uno,
|
|
2505
2554
|
tokens,
|
|
2506
|
-
invalidate
|
|
2555
|
+
invalidate: ()=>{}
|
|
2507
2556
|
}), s.hasChanged() && (s = new magic_string(code = restoreSkipCode(s.toString(), skipMap))));
|
|
2508
2557
|
return code !== original ? code : null;
|
|
2509
|
-
},
|
|
2558
|
+
}, getCustomLayers = ()=>Array.from(requestedLayers).filter((layer)=>layer !== LAYER_MARK_ALL), {
|
|
2510
2559
|
name: 'unpack:unocss',
|
|
2511
|
-
apply: (config)=>!!config.unocss,
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
}
|
|
2516
|
-
}),
|
|
2517
|
-
configResolved: async (config)=>{
|
|
2518
|
-
if (rootDir = config.root || process.cwd(), Array.isArray(config.unocss)) {
|
|
2519
|
-
let [configOrPathValue, defaultsValue] = config.unocss;
|
|
2560
|
+
apply: (config)=>!!config.css?.unocss,
|
|
2561
|
+
configResolved: async (config, { cachePath })=>{
|
|
2562
|
+
if (rootDir = config.root, isMpa = !!config.mpa, unpackConfigPath = resolveConfigPath(rootDir), bundlerCacheDir = node_path.resolve(rootDir, cachePath, 'cache'), unocssCacheDir = node_path.resolve(rootDir, cachePath, 'unocss'), tokensCachePath = node_path.resolve(unocssCacheDir, 'tokens'), layersCachePath = node_path.resolve(unocssCacheDir, 'layers'), timeCachePath = node_path.resolve(unocssCacheDir, 'created_at'), configHashCachePath = node_path.resolve(unocssCacheDir, 'config_hash'), generatedCachePath = node_path.resolve(unocssCacheDir, 'generated'), Array.isArray(config.css?.unocss)) {
|
|
2563
|
+
let [configOrPathValue, defaultsValue] = config.css.unocss;
|
|
2520
2564
|
configOrPathFromUnpackConfig = configOrPathValue, defaultsFromUnpackConfig = defaultsValue;
|
|
2521
2565
|
}
|
|
2522
|
-
await
|
|
2566
|
+
unoConfig = await resolveUnocssConfig();
|
|
2567
|
+
let core = await import("@unocss/core");
|
|
2568
|
+
uno = await core.createGenerator(unoConfig), (()=>{
|
|
2569
|
+
let now = Date.now(), nextHash = getFilesContentHash([
|
|
2570
|
+
configFilePath,
|
|
2571
|
+
unpackConfigPath
|
|
2572
|
+
]);
|
|
2573
|
+
if (!node_fs.existsSync(unocssCacheDir)) {
|
|
2574
|
+
ensureDir(unocssCacheDir), node_fs.writeFileSync(timeCachePath, String(now), 'utf-8'), node_fs.writeFileSync(configHashCachePath, nextHash, 'utf-8'), removeDir(bundlerCacheDir);
|
|
2575
|
+
return;
|
|
2576
|
+
}
|
|
2577
|
+
let cachedTime = Number(node_fs.readFileSync(timeCachePath, 'utf-8').trim()), cachedHash = node_fs.readFileSync(configHashCachePath, 'utf-8').trim(), isExpired = now - cachedTime >= 604800000, isHashChanged = cachedHash !== nextHash;
|
|
2578
|
+
(isExpired || isHashChanged) && (isExpired && logger_logger.debug(colors.yellow('[unocss] Cache expired, clear cache.')), isHashChanged && logger_logger.debug(colors.yellow('[unocss] Config hash changed, clear cache.')), removeDir(unocssCacheDir), removeDir(bundlerCacheDir), ensureDir(unocssCacheDir), node_fs.writeFileSync(timeCachePath, String(now), 'utf-8'), node_fs.writeFileSync(configHashCachePath, nextHash, 'utf-8'));
|
|
2579
|
+
})(), (()=>{
|
|
2580
|
+
if (node_fs.existsSync(tokensCachePath)) {
|
|
2581
|
+
let cached = JSON.parse(node_fs.readFileSync(tokensCachePath, 'utf-8'));
|
|
2582
|
+
Array.isArray(cached) && (cachedTokensLength = (tokens = new Set(cached)).size, logger_logger.debug(colors.yellow(`[unocss] Load ${tokens.size} token from cache.`)));
|
|
2583
|
+
}
|
|
2584
|
+
if (node_fs.existsSync(layersCachePath)) {
|
|
2585
|
+
let cached = JSON.parse(node_fs.readFileSync(layersCachePath, 'utf-8'));
|
|
2586
|
+
Array.isArray(cached) && (cachedLayersLength = (requestedLayers = new Set(cached)).size, logger_logger.debug(colors.yellow(`[unocss] Load ${requestedLayers.size} layer from cache.`)));
|
|
2587
|
+
}
|
|
2588
|
+
if (node_fs.existsSync(generatedCachePath)) {
|
|
2589
|
+
let cached = JSON.parse(node_fs.readFileSync(generatedCachePath, 'utf-8'));
|
|
2590
|
+
if (cached && cached.meta?.tokensLength === tokens.size && cached.meta?.layersKey === getLayersKey()) {
|
|
2591
|
+
let list, index, runChunk, timer;
|
|
2592
|
+
generated = cached, isDev() && (list = Array.from(tokens), index = 0, timer = setTimeout(runChunk = ()=>{
|
|
2593
|
+
if (isCompiling) {
|
|
2594
|
+
let timer = setTimeout(runChunk, 100);
|
|
2595
|
+
timer.unref?.();
|
|
2596
|
+
return;
|
|
2597
|
+
}
|
|
2598
|
+
let end = Math.min(index + 200, list.length);
|
|
2599
|
+
for(; index < end; index++)uno.parseToken(list[index]);
|
|
2600
|
+
if (logger_logger.debug(colors.yellow(`[unocss] Warmup tokens ${index}/${list.length}.`)), index < list.length) {
|
|
2601
|
+
let timer = setTimeout(runChunk, 0);
|
|
2602
|
+
timer.unref?.();
|
|
2603
|
+
}
|
|
2604
|
+
}, 0), timer.unref?.()), logger_logger.debug(colors.yellow('[unocss] Load generated css from cache.'));
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
})();
|
|
2523
2608
|
},
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2609
|
+
buildStart () {
|
|
2610
|
+
isCompiling = !0;
|
|
2611
|
+
},
|
|
2612
|
+
buildEnd () {
|
|
2613
|
+
isCompiling = !1, tokens.size !== cachedTokensLength && (node_fs.writeFileSync(tokensCachePath, JSON.stringify(Array.from(tokens)), 'utf-8'), logger_logger.debug(colors.yellow(`[unocss] Add ${tokens.size - cachedTokensLength} token to cache.`)), cachedTokensLength = tokens.size), requestedLayers.size !== cachedLayersLength && (node_fs.writeFileSync(layersCachePath, JSON.stringify(Array.from(requestedLayers)), 'utf-8'), logger_logger.debug(colors.yellow(`[unocss] Add ${requestedLayers.size - cachedLayersLength} layer to cache.`)), cachedLayersLength = requestedLayers.size);
|
|
2527
2614
|
},
|
|
2528
2615
|
transform: {
|
|
2529
2616
|
filter: {
|
|
2530
|
-
test: /\.(vue|svelte|[jt]sx?|vine\.ts|mdx?|astro|elm|php|phtml|marko)($|\?)/
|
|
2617
|
+
test: /\.(vue|svelte|[jt]sx?|vine\.ts|mdx?|astro|elm|php|phtml|marko|css|scss|sass|less)($|\?)/
|
|
2531
2618
|
},
|
|
2532
2619
|
handler: async (code, id)=>{
|
|
2533
2620
|
var task;
|
|
2621
|
+
if (id.endsWith(VIRTUAL_UNO_CSS_ID) || /uno:[^?]+\.css(?:\?|$)/.test(id)) return null;
|
|
2622
|
+
if (code.includes('uno:')) for (let match of code.matchAll(LAYER_IMPORT_RE)){
|
|
2623
|
+
let layer = match[2];
|
|
2624
|
+
layer && requestedLayers.add(layer);
|
|
2625
|
+
}
|
|
2534
2626
|
if (JS_REGEX.test(id) && !code.includes('@unocss-include')) return null;
|
|
2535
2627
|
let transformedCode = code, preTransformed = await applyUnoTransformers(transformedCode, id, 'pre');
|
|
2536
2628
|
null != preTransformed && (transformedCode = preTransformed);
|
|
2537
2629
|
let defaultTransformed = await applyUnoTransformers(transformedCode, id, 'default');
|
|
2538
2630
|
null != defaultTransformed && (transformedCode = defaultTransformed);
|
|
2539
2631
|
let postTransformed = await applyUnoTransformers(transformedCode, id, 'post');
|
|
2540
|
-
return null != postTransformed && (transformedCode = postTransformed),
|
|
2541
|
-
|
|
2542
|
-
try {
|
|
2543
|
-
return decodeURIComponent(layer);
|
|
2544
|
-
} catch {
|
|
2545
|
-
return layer;
|
|
2546
|
-
}
|
|
2547
|
-
})(layer);
|
|
2548
|
-
return requestedLayers.add(decodedLayer), `${quote}${getVirtualLayerId(decodedLayer)}${quote}`;
|
|
2549
|
-
})), task = async ()=>{
|
|
2550
|
-
await uno.applyExtractors(code.replace(SKIP_COMMENT_RE, ''), id, tokens);
|
|
2632
|
+
return null != postTransformed && (transformedCode = postTransformed), task = async ()=>{
|
|
2633
|
+
await uno.applyExtractors(transformedCode.replace(SKIP_COMMENT_RE, ''), id, tokens);
|
|
2551
2634
|
}, tasks.push(task), transformedCode === code ? null : transformedCode;
|
|
2552
2635
|
}
|
|
2553
2636
|
},
|
|
2554
2637
|
processAssets: {
|
|
2555
2638
|
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
|
|
2556
2639
|
handler: async ({ compilation, sources })=>{
|
|
2557
|
-
|
|
2558
|
-
let
|
|
2559
|
-
|
|
2560
|
-
|
|
2640
|
+
await flushTasks();
|
|
2641
|
+
let layersKey = getLayersKey();
|
|
2642
|
+
if (!generated || generated.meta.tokensLength !== tokens.size || generated.meta.layersKey !== layersKey) {
|
|
2643
|
+
let result = await uno.generate(tokens, {
|
|
2644
|
+
minify: !0
|
|
2645
|
+
}), customLayers = getCustomLayers();
|
|
2646
|
+
generated = {
|
|
2647
|
+
meta: {
|
|
2648
|
+
tokensLength: tokens.size,
|
|
2649
|
+
layersKey
|
|
2650
|
+
},
|
|
2651
|
+
allCSS: result.getLayers(void 0, customLayers),
|
|
2652
|
+
layerCSS: customLayers.reduce((acc, layer)=>(acc[layer] = result.getLayer(layer) || '', acc), {})
|
|
2653
|
+
}, node_fs.writeFileSync(generatedCachePath, JSON.stringify(generated), 'utf-8');
|
|
2654
|
+
}
|
|
2561
2655
|
for (let file of Object.keys(compilation.assets)){
|
|
2562
|
-
if (
|
|
2656
|
+
if (!isMpa && !file.includes('main')) continue;
|
|
2563
2657
|
let code = compilation.assets[file].source().toString();
|
|
2564
2658
|
if (!code.includes('#--unocss')) continue;
|
|
2565
2659
|
let isJsAsset = /\.(?:[cm]?js|[cm]?jsx)$/.test(file), replaced = !1;
|
|
2566
2660
|
code = (code = code.replace(HASH_PLACEHOLDER_RE, '')).replace(LAYER_PLACEHOLDER_RE, (_, layer, escapeView)=>{
|
|
2567
2661
|
replaced = !0;
|
|
2568
|
-
let css = layer.trim() === LAYER_MARK_ALL ?
|
|
2662
|
+
let css = layer.trim() === LAYER_MARK_ALL ? generated.allCSS : generated.layerCSS[layer] || '';
|
|
2569
2663
|
return isJsAsset ? getCssEscaperForJsContent(escapeView)(css) : css;
|
|
2570
2664
|
}), replaced && compilation.updateAsset(file, new sources.RawSource(code));
|
|
2571
2665
|
}
|
|
@@ -2573,7 +2667,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2573
2667
|
},
|
|
2574
2668
|
virtualModules: ()=>({
|
|
2575
2669
|
[VIRTUAL_UNO_CSS_ID]: getVirtualModuleContent(LAYER_MARK_ALL),
|
|
2576
|
-
...
|
|
2670
|
+
...getCustomLayers().reduce((acc, layer)=>(acc[`uno:${layer}.css`] = getVirtualModuleContent(layer), acc), {})
|
|
2577
2671
|
})
|
|
2578
2672
|
}),
|
|
2579
2673
|
(rootPath1 = '', registerCode = '', namesCode = '', {
|
|
@@ -2609,7 +2703,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2609
2703
|
]
|
|
2610
2704
|
};
|
|
2611
2705
|
return {
|
|
2612
|
-
...
|
|
2706
|
+
...mergeConfig(defaultConfig, userConfig),
|
|
2613
2707
|
_context
|
|
2614
2708
|
};
|
|
2615
2709
|
};
|
|
@@ -2618,7 +2712,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2618
2712
|
let mode = watch ? 'development' : 'production';
|
|
2619
2713
|
setNodeEnv(mode);
|
|
2620
2714
|
let config = resolveConfig(mode);
|
|
2621
|
-
console.log(colors.brand(`${callerName} v4.2.
|
|
2715
|
+
console.log(colors.brand(`${callerName} v4.2.2`), colors.cyan(`building for ${mode}...`)), await unpackBuild(config);
|
|
2622
2716
|
},
|
|
2623
2717
|
dev: async ()=>{
|
|
2624
2718
|
setUnpackStartTime(performance.now());
|
|
@@ -2767,7 +2861,7 @@ function runCLI() {
|
|
|
2767
2861
|
logger_logger.clear(), logger_logger.info(`${node_path.basename(file)} changed, restarting server...`), await watcher.close(), await cleanUpBeforeRestart(), startServer(options);
|
|
2768
2862
|
});
|
|
2769
2863
|
});
|
|
2770
|
-
devCommand.option('-o, --open [url]', 'Open browser on startup').option('--port <port>', 'Specify port').option('--host', 'Expose hostname').action(startServer), cli.help(), cli.version("4.2.
|
|
2864
|
+
devCommand.option('-o, --open [url]', 'Open browser on startup').option('--port <port>', 'Specify port').option('--host', 'Expose hostname').action(startServer), cli.help(), cli.version("4.2.2"), cli.parse();
|
|
2771
2865
|
}
|
|
2772
2866
|
var src_CSS_MODULES_NAMED_EXPORT = !1;
|
|
2773
|
-
export { ALL_INTERFACES_IPV4, CSS_MODULES_EXPORTS_CONVENTION, CSS_MODULES_LOCAL_IDENT_NAME, DEV_DEFAULT_FILENAME, JSX_REGEX, JS_REGEX, LOCALHOST, NODE_MODULES_REGEX, PROD_DEFAULT_FILENAME, SCRIPT_REGEX, TEMPLATE_CONTENT, addRestartCleaner, cleanUpBeforeRestart, clearLine, colors, convertBasicAnsiColors, createChokidar, createUnpack, debounce, defineConfig, esVersionToBrowserslist, external_tinyglobby_glob as glob, findExists, getAddressUrls, getCompiledPkgPath, getCurrentUnpackConfig, getHtmlTemplateOrContent, getIpv4Interfaces, getNodeEnv, getOrSetDefault, getPathInJs, getPort, getTime, getUnpackStartTime, getUserDepPath, getUserDepVersion, globSync, injectToHead, isBoolean, isDebug, isDev, isEmptyDir, isFileExists, isFileSync, isFunction, isNodeVersionAtLeast, isObject, isPlainObject, isRegExp, isString, isUndefined,
|
|
2867
|
+
export { ALL_INTERFACES_IPV4, CSS_MODULES_EXPORTS_CONVENTION, CSS_MODULES_LOCAL_IDENT_NAME, DEV_DEFAULT_FILENAME, JSX_REGEX, JS_REGEX, LOCALHOST, NODE_MODULES_REGEX, PROD_DEFAULT_FILENAME, SCRIPT_REGEX, TEMPLATE_CONTENT, addRestartCleaner, cleanUpBeforeRestart, clearLine, colors, convertBasicAnsiColors, createChokidar, createUnpack, debounce, defineConfig, emptyDir, ensureDir, esVersionToBrowserslist, external_tinyglobby_glob as glob, findExists, getAddressUrls, getCompiledPkgPath, getCurrentUnpackConfig, getFilesContentHash, getHtmlTemplateOrContent, getIpv4Interfaces, getNodeEnv, getOrSetDefault, getPathInJs, getPort, getTime, getUnpackStartTime, getUserDepPath, getUserDepVersion, globSync, injectToHead, isBoolean, isDebug, isDev, isEmptyDir, isFileExists, isFileSync, isFunction, isNodeVersionAtLeast, isObject, isPlainObject, isRegExp, isString, isUndefined, isWin, launchEditor, loadConfig, loadConfigFile, logUpdate, logger_LogColor as LogColor, logger_logger as logger, mergeConfig, normalizePublicPath, openBrowser, pLimit, pathExists, pathToExportIdentifier, prettyTime, printServerUrls, removeDir, resolveConfigPath, rspack, runCLI, set, setCurrentUnpackConfig, setDevServer, setNodeEnv, setUnpackStartTime, src_CSS_MODULES_NAMED_EXPORT as CSS_MODULES_NAMED_EXPORT, trackPerformance, utils_isDevServer as isDevServer, utils_isProd as isProd };
|