@unpackjs/core 2.4.4 → 3.0.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.
Files changed (48) hide show
  1. package/compiled/css-loader/index.js +20 -20
  2. package/compiled/less-loader/index.js +8 -8
  3. package/compiled/postcss-loader/index.js +8 -8
  4. package/compiled/sass-loader/index.js +8 -8
  5. package/compiled/style-loader/index.js +10 -10
  6. package/dist/index.cjs +177 -232
  7. package/dist/index.js +173 -221
  8. package/dist/typedCssModulesLoader.mjs +4 -62
  9. package/dist-types/bundler-config/cache.d.ts.map +1 -1
  10. package/dist-types/bundler-config/css.d.ts.map +1 -1
  11. package/dist-types/bundler-config/experimentCss.d.ts.map +1 -1
  12. package/dist-types/bundler-config/index.d.ts.map +1 -1
  13. package/dist-types/bundler-config/plugins/jsMinify.d.ts +2 -2
  14. package/dist-types/bundler-config/plugins/jsMinify.d.ts.map +1 -1
  15. package/dist-types/bundler-config/plugins/progress/{rspack.d.ts → index.d.ts} +4 -1
  16. package/dist-types/bundler-config/plugins/progress/index.d.ts.map +1 -0
  17. package/dist-types/bundler-config/plugins/typedCssModules.d.ts +1 -1
  18. package/dist-types/bundler-config/plugins/typedCssModules.d.ts.map +1 -1
  19. package/dist-types/constants.d.ts +0 -1
  20. package/dist-types/constants.d.ts.map +1 -1
  21. package/dist-types/createUnpack.d.ts.map +1 -1
  22. package/dist-types/index.d.ts +0 -2
  23. package/dist-types/index.d.ts.map +1 -1
  24. package/dist-types/logger.d.ts.map +1 -1
  25. package/dist-types/openBrowser.d.ts.map +1 -1
  26. package/dist-types/prebundleDeps.d.ts.map +1 -1
  27. package/dist-types/progressBar.d.ts +0 -1
  28. package/dist-types/progressBar.d.ts.map +1 -1
  29. package/dist-types/reporter.d.ts +1 -2
  30. package/dist-types/reporter.d.ts.map +1 -1
  31. package/dist-types/run/build.d.ts.map +1 -1
  32. package/dist-types/run/dev.d.ts.map +1 -1
  33. package/dist-types/types/config.d.ts +8 -9
  34. package/dist-types/types/config.d.ts.map +1 -1
  35. package/dist-types/types/index.d.ts +0 -1
  36. package/dist-types/types/index.d.ts.map +1 -1
  37. package/dist-types/utils.d.ts.map +1 -1
  38. package/package.json +4 -10
  39. package/dist/lightningcssLoader.mjs +0 -18
  40. package/dist-types/bundler-config/loaders/lightningcssLoader.d.ts +0 -5
  41. package/dist-types/bundler-config/loaders/lightningcssLoader.d.ts.map +0 -1
  42. package/dist-types/bundler-config/plugins/lightningcssMinify.d.ts +0 -10
  43. package/dist-types/bundler-config/plugins/lightningcssMinify.d.ts.map +0 -1
  44. package/dist-types/bundler-config/plugins/progress/rspack.d.ts.map +0 -1
  45. package/dist-types/bundler-config/plugins/progress/webpack.d.ts +0 -9
  46. package/dist-types/bundler-config/plugins/progress/webpack.d.ts.map +0 -1
  47. package/dist-types/types/lightningcss.d.ts +0 -11
  48. package/dist-types/types/lightningcss.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -5,32 +5,25 @@ import { dirname as __webpack_dirname__ } from "node:path";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__compiled_webpack_bundle_analyzer_index_js_1177eada__ from "../compiled/webpack-bundle-analyzer/index.js";
6
6
  import * as __WEBPACK_EXTERNAL_MODULE__compiled_webpack_merge_index_js_efd91626__ from "../compiled/webpack-merge/index.js";
7
7
  import { experiments, rspack } from "@rspack/core";
8
- import html_webpack_plugin from "html-webpack-plugin";
9
- import webpack from "webpack";
10
8
  import picocolors from "picocolors";
11
9
  import node_fs from "node:fs";
12
- import node_path, { isAbsolute, join, sep } from "node:path";
10
+ import node_path, { join, sep } from "node:path";
13
11
  import { pathToFileURL } from "node:url";
14
12
  import { createJiti } from "jiti";
15
13
  import node_readline from "node:readline";
16
14
  import node_net from "node:net";
17
- import node_os from "node:os";
15
+ import node_os, { platform } from "node:os";
18
16
  import portfinder from "portfinder";
19
- import { browserslistToTargets, transform } from "lightningcss";
20
- import copy_webpack_plugin from "copy-webpack-plugin";
21
17
  import json5 from "json5";
22
18
  import { expand } from "dotenv-expand";
23
19
  import { TsCheckerRspackPlugin } from "ts-checker-rspack-plugin";
24
20
  import node_assert from "node:assert";
25
- import mini_css_extract_plugin from "mini-css-extract-plugin";
26
21
  import { glob, globSync } from "tinyglobby";
27
22
  import typed_css_modules from "typed-css-modules";
28
23
  import { minify } from "oxc-minify";
29
- import { Buffer as external_node_buffer_Buffer } from "node:buffer";
30
24
  import { exec, spawn } from "node:child_process";
31
25
  import { promisify } from "node:util";
32
26
  import node_zlib from "node:zlib";
33
- import open_0 from "open";
34
27
  import cors from "cors";
35
28
  import express from "express";
36
29
  import webpack_dev_server from "webpack-dev-server";
@@ -79,7 +72,7 @@ let CSS_MODULES_LOCAL_IDENT_NAME = '[path][name]__[local]--[hash:5]', CSS_MODULE
79
72
  'edge >= 107',
80
73
  'firefox >= 104',
81
74
  'safari >= 16'
82
- ], DEFAULT_ES_TARGET = 'es2022', DEFAULT_LIGHTNINGCSS_TARGET = browserslistToTargets(DEFAULT_BROWSERSLIST.map((item)=>item.replace(' >= ', ' '))), TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId = '' })=>`<!DOCTYPE html>
75
+ ], DEFAULT_ES_TARGET = 'es2022', TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId = '' })=>`<!DOCTYPE html>
83
76
  <html lang="en">
84
77
 
85
78
  <head>
@@ -196,7 +189,7 @@ let debounce = (fn, delay)=>{
196
189
  global[k] = performance.now();
197
190
  return;
198
191
  }
199
- msg && logger_logger.wait(`${msg} ${colors.dim('for')} ${colors.yellow(`${(performance.now() - global[k]).toFixed(2)}ms`)}`), global[k] = performance.now();
192
+ msg && console.log(` ${msg} ${colors.dim('in')} ${colors.yellow(`${(performance.now() - global[k]).toFixed(2)}ms`)}`), global[k] = performance.now();
200
193
  }, getPathInJs = (absPath)=>JSON.stringify(absPath).slice(1, -1), mergeConfig = merge, getUserDepVersion = (root, dep)=>{
201
194
  let depPath = getUserDepPath(root, dep);
202
195
  if (depPath) return JSON.parse(node_fs.readFileSync(node_path.resolve(depPath, 'package.json'), 'utf-8')).version;
@@ -249,10 +242,7 @@ let isCSSModules = ({ resourcePath, modules })=>{
249
242
  text = colors.yellow(message);
250
243
  break;
251
244
  case 'debug':
252
- text = `${colors.dim((()=>{
253
- let now = new Date(), hours = now.getHours().toString().padStart(2, '0'), minutes = now.getMinutes().toString().padStart(2, '0'), seconds = now.getSeconds().toString().padStart(2, '0');
254
- return `${hours}:${minutes}:${seconds}`;
255
- })())} ${colors.magenta('debug')} ${message}`;
245
+ text = `${colors.dim(getTime())} ${colors.magenta('debug')} ${message}`;
256
246
  break;
257
247
  default:
258
248
  text = message;
@@ -319,7 +309,7 @@ function defineConfig(config) {
319
309
  }
320
310
  function resolveConfigPath(root, customConfig) {
321
311
  if (customConfig) {
322
- let customConfigPath = isAbsolute(customConfig) ? customConfig : join(root, customConfig);
312
+ let customConfigPath = node_path.resolve(root, customConfig);
323
313
  if (node_fs.existsSync(customConfigPath)) return customConfigPath;
324
314
  logger_logger.warn(`could not find config file: ${customConfigPath}`);
325
315
  }
@@ -331,7 +321,7 @@ function resolveConfigPath(root, customConfig) {
331
321
  'unpack.config.mts',
332
322
  'unpack.config.cts'
333
323
  ]){
334
- let configFile = join(root, file);
324
+ let configFile = node_path.join(root, file);
335
325
  if (node_fs.existsSync(configFile)) return configFile;
336
326
  }
337
327
  return null;
@@ -348,7 +338,7 @@ let isFileSync = (filePath)=>{
348
338
  return null == (_fs_statSync = node_fs.statSync(filePath, {
349
339
  throwIfNoEntry: !1
350
340
  })) ? void 0 : _fs_statSync.isFile();
351
- } catch (_) {
341
+ } catch {
352
342
  return !1;
353
343
  }
354
344
  };
@@ -399,8 +389,8 @@ async function getBuildDependencies(root, userBuildDependencies, envFilePaths) {
399
389
  async function applyCacheConfig({ config, unpackConfig, envFilePaths }) {
400
390
  var _unpackConfig_build, _unpackConfig_dev;
401
391
  if (!(null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.cache) || utils_isDevServer() && (null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.lazyCompilation)) return config;
402
- let cacheConfig = isPlainObject(unpackConfig.build.cache) ? unpackConfig.build.cache : {}, isRspack = 'rspack' === unpackConfig.bundler, buildDependencies = await getBuildDependencies(unpackConfig.root, cacheConfig.buildDependencies || [], envFilePaths), cacheDirectory = cacheConfig.cacheDirectory;
403
- return cacheDirectory && (cacheDirectory = node_path.isAbsolute(cacheDirectory) ? cacheDirectory : node_path.join(unpackConfig.root, cacheDirectory)), logger_logger.info('persistent cache enabled'), config = isRspack ? mergeConfig(config, {
392
+ let cacheConfig = isPlainObject(unpackConfig.build.cache) ? unpackConfig.build.cache : {}, buildDependencies = await getBuildDependencies(unpackConfig.root, cacheConfig.buildDependencies || [], envFilePaths), cacheDirectory = cacheConfig.cacheDirectory;
393
+ return cacheDirectory && (cacheDirectory = node_path.resolve(unpackConfig.root, cacheDirectory)), logger_logger.info('persistent cache enabled'), config = mergeConfig(config, {
404
394
  cache: !0,
405
395
  experiments: {
406
396
  cache: {
@@ -412,12 +402,6 @@ async function applyCacheConfig({ config, unpackConfig, envFilePaths }) {
412
402
  }
413
403
  }
414
404
  }
415
- }) : mergeConfig(config, {
416
- cache: {
417
- type: 'filesystem',
418
- buildDependencies,
419
- cacheDirectory
420
- }
421
405
  });
422
406
  }
423
407
  let MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\/])?([^\\/]+)/, SPLIT_STRATEGY_DISPATCHER = {
@@ -448,7 +432,7 @@ let MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\
448
432
  return {
449
433
  ...defaultConfig,
450
434
  minSize: 0,
451
- maxInitialRequests: Number.POSITIVE_INFINITY,
435
+ maxInitialRequests: 1 / 0,
452
436
  cacheGroups: {
453
437
  ...defaultConfig.cacheGroups,
454
438
  ...forceSplittingGroups,
@@ -474,7 +458,7 @@ let MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\
474
458
  return node_assert('split-by-size' === chunkSplit.strategy), {
475
459
  ...defaultConfig,
476
460
  minSize: chunkSplit.minSize ?? 0,
477
- maxSize: chunkSplit.maxSize ?? Number.POSITIVE_INFINITY,
461
+ maxSize: chunkSplit.maxSize ?? 1 / 0,
478
462
  cacheGroups: {
479
463
  ...defaultConfig.cacheGroups,
480
464
  ...forceSplittingGroups
@@ -578,7 +562,6 @@ class TypedCssModulesPlugin {
578
562
  });
579
563
  }
580
564
  }
581
- var experimentCss_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
582
565
  function jsMinify_define_property(obj, key, value) {
583
566
  return key in obj ? Object.defineProperty(obj, key, {
584
567
  value: value,
@@ -587,19 +570,18 @@ function jsMinify_define_property(obj, key, value) {
587
570
  writable: !0
588
571
  }) : obj[key] = value, obj;
589
572
  }
590
- let { RawSource: jsMinify_RawSource, SourceMapSource: jsMinify_SourceMapSource } = webpack.sources, isJsFile = /\.[cm]?js(\?.*)?$/i, jsMinify_PLUGIN_NAME = 'JsMinifyPlugin';
573
+ let { RawSource, SourceMapSource } = rspack.sources, isJsFile = /\.[cm]?js(\?.*)?$/i, jsMinify_PLUGIN_NAME = 'JsMinifyPlugin';
591
574
  class JsMinifyPlugin {
592
575
  apply(compiler) {
593
576
  let meta = JSON.stringify({
594
577
  name: jsMinify_PLUGIN_NAME,
595
- version: "2.4.4",
578
+ version: "3.0.0",
596
579
  options: this.minifyOptions
597
580
  });
598
581
  compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
599
- compilation.hooks.chunkHash.tap(jsMinify_PLUGIN_NAME, (_, hash)=>hash.update(meta)), compilation.hooks.processAssets.tap({
582
+ compilation.hooks.chunkHash.tap(jsMinify_PLUGIN_NAME, (_, hash)=>hash.update(Buffer.from(meta))), compilation.hooks.processAssets.tap({
600
583
  name: jsMinify_PLUGIN_NAME,
601
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
602
- additionalAssets: !0
584
+ stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
603
585
  }, ()=>this.transformAssets(compilation)), compilation.hooks.statsPrinter.tap(jsMinify_PLUGIN_NAME, (stats)=>{
604
586
  stats.hooks.print.for('asset.info.minimized').tap(jsMinify_PLUGIN_NAME, (minimized, { green, formatFlag })=>minimized && green && formatFlag ? green(formatFlag('minimized')) : '');
605
587
  });
@@ -615,7 +597,7 @@ class JsMinifyPlugin {
615
597
  output.map && ((newMap = 'string' == typeof output.map ? JSON.parse(output.map) : output.map).sources = [
616
598
  asset.name
617
599
  ]);
618
- let newSource = sourceMap && newMap ? new jsMinify_SourceMapSource(output.code, asset.name, newMap, source, map, !0) : new jsMinify_RawSource(output.code), newInfo = {
600
+ let newSource = sourceMap && newMap ? new SourceMapSource(output.code, asset.name, newMap, source, map, !0) : new RawSource(output.code), newInfo = {
619
601
  ...asset.info,
620
602
  minimized: !0
621
603
  };
@@ -628,48 +610,6 @@ class JsMinifyPlugin {
628
610
  this.minify = (null == implementation ? void 0 : implementation.minify) ?? minify, this.minifyOptions = minifyOptions;
629
611
  }
630
612
  }
631
- function lightningcssMinify_define_property(obj, key, value) {
632
- return key in obj ? Object.defineProperty(obj, key, {
633
- value: value,
634
- enumerable: !0,
635
- configurable: !0,
636
- writable: !0
637
- }) : obj[key] = value, obj;
638
- }
639
- let lightningcssMinify_PLUGIN_NAME = 'LightningcssMinifyPlugin';
640
- class LightningcssMinifyPlugin {
641
- apply(compiler) {
642
- compiler.hooks.compilation.tap(lightningcssMinify_PLUGIN_NAME, (compilation)=>{
643
- compilation.hooks.processAssets.tap({
644
- name: lightningcssMinify_PLUGIN_NAME,
645
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
646
- }, ()=>this.transformAssets(compilation)), compilation.hooks.statsPrinter.tap(lightningcssMinify_PLUGIN_NAME, (statsPrinter)=>{
647
- statsPrinter.hooks.print.for('asset.info.minimized').tap(lightningcssMinify_PLUGIN_NAME, (minimized, { green, formatFlag })=>minimized && green && formatFlag ? green(formatFlag('minimized')) : '');
648
- });
649
- });
650
- }
651
- transformAssets(compilation) {
652
- let { options: { devtool }, webpack: { sources: { SourceMapSource, RawSource } } } = compilation.compiler, sourceMap = 'string' == typeof devtool && devtool.includes('source-map');
653
- compilation.getAssets().filter((asset)=>!asset.info.minimized && /\.css$/.test(asset.name)).map((asset)=>{
654
- let { source, map } = asset.source.sourceAndMap(), sourceAsString = source.toString(), code = 'string' == typeof source ? external_node_buffer_Buffer.from(source) : source, result = this.transform({
655
- filename: asset.name,
656
- code,
657
- minify: !0,
658
- sourceMap,
659
- ...this.transformOptions
660
- }), codeString = result.code.toString();
661
- compilation.updateAsset(asset.name, sourceMap ? new SourceMapSource(codeString, asset.name, JSON.parse(result.map.toString()), sourceAsString, map, !0) : new RawSource(codeString), {
662
- ...asset.info,
663
- minimized: !0
664
- });
665
- });
666
- }
667
- constructor(options = {}){
668
- lightningcssMinify_define_property(this, "transform", void 0), lightningcssMinify_define_property(this, "transformOptions", void 0);
669
- let { implementation, ...transformOptions } = options;
670
- this.transform = (null == implementation ? void 0 : implementation.transform) ?? transform, this.transformOptions = transformOptions;
671
- }
672
- }
673
613
  var oxlint_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
674
614
  function oxlint_define_property(obj, key, value) {
675
615
  return key in obj ? Object.defineProperty(obj, key, {
@@ -789,14 +729,10 @@ function progressBar_define_property(obj, key, value) {
789
729
  }
790
730
  class ProgressBar {
791
731
  update({ current: originalCurrent, message = '' }) {
792
- if (isCI()) return;
793
732
  let { columns: terminalWidth } = process.stdout, current = originalCurrent;
794
733
  originalCurrent >= 0.98 && (current = 1);
795
734
  let loadingChar = this.loadingAnimation.getCurrentChar(), messageWidth = terminalWidth - this.prefix.length - (1 === current ? 10 : 9);
796
- logUpdate(`${loadingChar} ${this.prefix} (${Math.floor(100 * current)}%) ${colors.dim(message.slice(0, messageWidth).padEnd(messageWidth, ' '))}`);
797
- }
798
- done() {
799
- console.log();
735
+ logUpdate(`${loadingChar} ${this.prefix} (${Math.floor(100 * current)}%) ${colors.dim(message.slice(0, messageWidth).padEnd(messageWidth, ' '))}`), 1 === current && clearLine();
800
736
  }
801
737
  constructor(){
802
738
  progressBar_define_property(this, "prefix", 'transforming'), progressBar_define_property(this, "loadingAnimation", new LoadingAnimation());
@@ -932,12 +868,23 @@ async function compileDone(compiler, stats) {
932
868
  logger_logger.ready(`built in ${prettyTime(compileTime)}${isDebug() ? ` (${stats.compilation.modules.size} modules)` : ''}`);
933
869
  }
934
870
  }
935
- let rspack_PLUGIN_NAME = 'ProgressPlugin';
871
+ let progress_PLUGIN_NAME = 'ProgressPlugin';
872
+ class ProgressLiteRspackPlugin {
873
+ apply(compiler) {
874
+ compiler.hooks.watchRun.tap(progress_PLUGIN_NAME, ()=>{
875
+ (!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
876
+ }), compiler.hooks.run.tap(progress_PLUGIN_NAME, ()=>{
877
+ logger_logger.info('build started...');
878
+ }), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
879
+ await compileDone(compiler, stats);
880
+ });
881
+ }
882
+ }
936
883
  class ProgressRspackPlugin extends rspack.ProgressPlugin {
937
884
  apply(compiler) {
938
- super.apply(compiler), compiler.hooks.watchRun.tap(rspack_PLUGIN_NAME, ()=>{
885
+ super.apply(compiler), compiler.hooks.watchRun.tap(progress_PLUGIN_NAME, ()=>{
939
886
  (!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
940
- }), compiler.hooks.afterDone.tap(rspack_PLUGIN_NAME, async (stats)=>{
887
+ }), compiler.hooks.afterDone.tap(progress_PLUGIN_NAME, async (stats)=>{
941
888
  await compileDone(compiler, stats);
942
889
  });
943
890
  }
@@ -956,41 +903,10 @@ class ProgressRspackPlugin extends rspack.ProgressPlugin {
956
903
  }) : this[key] = value;
957
904
  }
958
905
  }
959
- function webpack_define_property(obj, key, value) {
960
- return key in obj ? Object.defineProperty(obj, key, {
961
- value: value,
962
- enumerable: !0,
963
- configurable: !0,
964
- writable: !0
965
- }) : obj[key] = value, obj;
966
- }
967
- let webpack_PLUGIN_NAME = 'ProgressPlugin';
968
- class ProgressWebpackPlugin extends webpack.ProgressPlugin {
969
- apply(compiler) {
970
- super.apply(compiler), compiler.hooks.watchRun.tap(webpack_PLUGIN_NAME, ()=>{
971
- (!utils_isDevServer() || global.__unpack_dev_server_started) && printDevLog(compiler, compiler.options.context);
972
- }), compiler.hooks.afterDone.tap(webpack_PLUGIN_NAME, async (stats)=>{
973
- this.isCompleted = !0, await compileDone(compiler, stats);
974
- });
975
- }
976
- constructor(){
977
- super({
978
- entries: !1,
979
- dependencies: !1,
980
- activeModules: !0,
981
- handler: isProd() ? (percentage, msg, ...args)=>{
982
- this.isCompleted || this.progressBar.update({
983
- current: percentage,
984
- message: `${msg} ${args.join(' ').replace(/(\d+) active /, '')}`
985
- });
986
- } : void 0
987
- }), webpack_define_property(this, "progressBar", new ProgressBar()), webpack_define_property(this, "isCompleted", !1);
988
- }
989
- }
990
906
  let BundleAnalyzerPlugin = __webpack_require__("compiled/webpack-bundle-analyzer").BundleAnalyzerPlugin;
991
907
  async function getBundlerConfig(unpackConfig) {
992
- var _unpackConfig_build, _unpackConfig_build1, _minifyOptions_oxc, _unpackConfig_build2, _unpackConfig_build3, _unpackConfig_build4, _unpackConfig_build5, _unpackConfig_build6, _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_html8, _unpackConfig_performance, _unpackConfig_performance1, _unpackConfig_build7, _unpackConfig_resolve, _unpackConfig_resolve1, _unpackConfig_dev, _unpackConfig_build8, _unpackConfig_experiments;
993
- let define, isRspack = 'rspack' === unpackConfig.bundler, HtmlPlugin = isRspack ? rspack.HtmlRspackPlugin : html_webpack_plugin, IgnorePlugin = isRspack ? rspack.IgnorePlugin : webpack.IgnorePlugin, CopyPlugin = isRspack ? rspack.CopyRspackPlugin : copy_webpack_plugin, tsconfigPath = node_path.resolve(unpackConfig.root, 'tsconfig.json'), isTs = node_fs.existsSync(tsconfigPath), minifyOptions = isPlainObject(null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.minify) ? null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.minify : {}, oxcMinifyCompress = isPlainObject(null == (_minifyOptions_oxc = minifyOptions.oxc) ? void 0 : _minifyOptions_oxc.compress) ? minifyOptions.oxc.compress : {}, wasmFilename = 'js/[hash].module.wasm', { publicVars, filePaths: envFilePaths } = function({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
908
+ var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_build2, _unpackConfig_build3, _unpackConfig_build4, _unpackConfig_build5, _unpackConfig_build6, _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_performance, _unpackConfig_performance1, _unpackConfig_build7, _unpackConfig_resolve, _unpackConfig_resolve1, _unpackConfig_dev, _unpackConfig_build8, _unpackConfig_experiments;
909
+ let tsconfigPath = node_path.resolve(unpackConfig.root, 'tsconfig.json'), isTs = node_fs.existsSync(tsconfigPath), minifyOptions = isPlainObject(null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.minify) ? null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.minify : {}, ProgressPlugin = (null == (_unpackConfig_build2 = unpackConfig.build) ? void 0 : _unpackConfig_build2.progressBar) ? ProgressRspackPlugin : ProgressLiteRspackPlugin, wasmFilename = 'js/[hash].module.wasm', { publicVars, filePaths: envFilePaths } = function({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
994
910
  'PUBLIC_'
995
911
  ], processEnv = process.env } = {}) {
996
912
  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.`);
@@ -1045,7 +961,7 @@ async function getBundlerConfig(unpackConfig) {
1045
961
  stats: 'errors-only',
1046
962
  output: {
1047
963
  clean: !0,
1048
- path: node_path.resolve(unpackConfig.root, null == (_unpackConfig_build2 = unpackConfig.build) ? void 0 : _unpackConfig_build2.outDir),
964
+ path: node_path.resolve(unpackConfig.root, unpackConfig.build.outDir),
1049
965
  filename: getOutputFilename({
1050
966
  type: 'js',
1051
967
  hash: null == (_unpackConfig_build3 = unpackConfig.build) ? void 0 : _unpackConfig_build3.filenameHash
@@ -1086,23 +1002,23 @@ async function getBundlerConfig(unpackConfig) {
1086
1002
  ]
1087
1003
  },
1088
1004
  plugins: [
1089
- (define = {
1005
+ new rspack.DefinePlugin({
1090
1006
  'import.meta.env.MODE': JSON.stringify(getNodeEnv()),
1091
1007
  'import.meta.env.DEV': isDev(),
1092
1008
  'import.meta.env.PROD': isProd(),
1093
1009
  ...publicVars,
1094
1010
  ...unpackConfig.define
1095
- }, isRspack ? new rspack.DefinePlugin(define) : new webpack.DefinePlugin(define)),
1096
- !unpackConfig.mpa && new HtmlPlugin({
1097
- template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || (isRspack ? void 0 : ''),
1098
- templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? !!isRspack && void 0 : TEMPLATE_CONTENT),
1011
+ }),
1012
+ !unpackConfig.mpa && new rspack.HtmlRspackPlugin({
1013
+ template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || void 0,
1014
+ templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? void 0 : TEMPLATE_CONTENT),
1099
1015
  templateParameters: {
1100
- mountId: null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.mountId,
1101
- title: isFunction(null == (_unpackConfig_html4 = unpackConfig.html) ? void 0 : _unpackConfig_html4.title) ? null == (_unpackConfig_html5 = unpackConfig.html) ? void 0 : _unpackConfig_html5.title({
1016
+ mountId: unpackConfig.html.mountId,
1017
+ title: isFunction(null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.title) ? null == (_unpackConfig_html4 = unpackConfig.html) ? void 0 : _unpackConfig_html4.title({
1102
1018
  entryName: 'index'
1103
- }) : (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.title) || '',
1104
- headTag: (null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.headTag) || '',
1105
- ...null == (_unpackConfig_html8 = unpackConfig.html) ? void 0 : _unpackConfig_html8.templateParameters
1019
+ }) : (null == (_unpackConfig_html5 = unpackConfig.html) ? void 0 : _unpackConfig_html5.title) || '',
1020
+ headTag: (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.headTag) || '',
1021
+ ...null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.templateParameters
1106
1022
  },
1107
1023
  minify: !1,
1108
1024
  chunks: [
@@ -1112,11 +1028,11 @@ async function getBundlerConfig(unpackConfig) {
1112
1028
  (null == (_unpackConfig_performance = unpackConfig.performance) ? void 0 : _unpackConfig_performance.bundleAnalyze) && isProd() && new BundleAnalyzerPlugin({
1113
1029
  analyzerPort: 'auto'
1114
1030
  }),
1115
- (null == (_unpackConfig_performance1 = unpackConfig.performance) ? void 0 : _unpackConfig_performance1.removeMomentLocale) && new IgnorePlugin({
1031
+ (null == (_unpackConfig_performance1 = unpackConfig.performance) ? void 0 : _unpackConfig_performance1.removeMomentLocale) && new rspack.IgnorePlugin({
1116
1032
  resourceRegExp: /^\.\/locale$/,
1117
1033
  contextRegExp: /moment$/
1118
1034
  }),
1119
- (null == (_unpackConfig_build7 = unpackConfig.build) ? void 0 : _unpackConfig_build7.copy) && new CopyPlugin({
1035
+ (null == (_unpackConfig_build7 = unpackConfig.build) ? void 0 : _unpackConfig_build7.copy) && new rspack.CopyRspackPlugin({
1120
1036
  patterns: unpackConfig.build.copy
1121
1037
  }),
1122
1038
  unpackConfig.typeCheck && isDev() && isTs && new TsCheckerRspackPlugin({
@@ -1144,7 +1060,7 @@ async function getBundlerConfig(unpackConfig) {
1144
1060
  }
1145
1061
  }
1146
1062
  }),
1147
- new (isRspack ? ProgressRspackPlugin : ProgressWebpackPlugin)(),
1063
+ new ProgressPlugin(),
1148
1064
  unpackConfig.lint && new OxlintPlugin()
1149
1065
  ].filter(Boolean),
1150
1066
  externals: unpackConfig.externals,
@@ -1191,17 +1107,16 @@ async function getBundlerConfig(unpackConfig) {
1191
1107
  moduleIds: isDev() ? 'named' : 'deterministic',
1192
1108
  minimize: !!(null == (_unpackConfig_build8 = unpackConfig.build) ? void 0 : _unpackConfig_build8.minify),
1193
1109
  minimizer: [
1194
- new JsMinifyPlugin({
1195
- ...minifyOptions.oxc,
1110
+ new JsMinifyPlugin(mergeConfig({
1196
1111
  compress: {
1197
- target: DEFAULT_ES_TARGET,
1198
- ...oxcMinifyCompress
1112
+ target: DEFAULT_ES_TARGET
1199
1113
  }
1200
- }),
1201
- new LightningcssMinifyPlugin({
1202
- targets: DEFAULT_LIGHTNINGCSS_TARGET,
1203
- ...minifyOptions.lightningcss
1204
- })
1114
+ }, minifyOptions.oxc || {})),
1115
+ new rspack.LightningCssMinimizerRspackPlugin(mergeConfig({
1116
+ minimizerOptions: {
1117
+ targets: DEFAULT_BROWSERSLIST
1118
+ }
1119
+ }, minifyOptions.lightningcss || {}))
1205
1120
  ]
1206
1121
  },
1207
1122
  watchOptions: {
@@ -1239,7 +1154,7 @@ async function getBundlerConfig(unpackConfig) {
1239
1154
  return config;
1240
1155
  })({
1241
1156
  config: config = (null == (_unpackConfig_experiments = unpackConfig.experiments) ? void 0 : _unpackConfig_experiments.css) ? function({ config, unpackConfig }) {
1242
- var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_css, _unpackConfig_css1, _config_module_rules, _config_module, _config_module_rules1, _config_module1, _config_module_rules2, _config_module2;
1157
+ var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_css, _unpackConfig_css1;
1243
1158
  config.output.cssFilename = getOutputFilename({
1244
1159
  type: 'css',
1245
1160
  hash: null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.filenameHash
@@ -1292,33 +1207,14 @@ async function getBundlerConfig(unpackConfig) {
1292
1207
  sourceMap
1293
1208
  }
1294
1209
  };
1295
- };
1296
- null == (_config_module = config.module) || null == (_config_module_rules = _config_module.rules) || _config_module_rules.push({
1297
- test: /\.less$/i,
1298
- oneOf: [
1299
- withCssModules({
1300
- use: [
1301
- getThreadLoader(),
1302
- getLessLoader()
1303
- ].filter(Boolean)
1304
- }),
1305
- {
1306
- use: [
1307
- getThreadLoader(),
1308
- getLessLoader()
1309
- ].filter(Boolean),
1310
- type: 'css'
1311
- }
1312
- ].filter(Boolean)
1313
- });
1314
- let getCssLoader = ()=>{
1210
+ }, getCssLoader = ()=>{
1315
1211
  var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_css2;
1316
1212
  return (null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? {
1317
- loader: node_path.resolve(experimentCss_dirname, './lightningcssLoader.mjs'),
1318
- options: mergeConfig((null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.lightningcss) || {}, {
1319
- sourceMap,
1320
- targets: DEFAULT_LIGHTNINGCSS_TARGET
1321
- })
1213
+ loader: 'builtin:lightningcss-loader',
1214
+ options: {
1215
+ targets: DEFAULT_BROWSERSLIST,
1216
+ ...null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.lightningcss
1217
+ }
1322
1218
  } : {
1323
1219
  loader: getCompiledPkgPath('postcss-loader'),
1324
1220
  options: {
@@ -1326,8 +1222,22 @@ async function getBundlerConfig(unpackConfig) {
1326
1222
  sourceMap
1327
1223
  }
1328
1224
  };
1225
+ }, getSassLoader = ()=>{
1226
+ var _unpackConfig_css;
1227
+ return {
1228
+ loader: getCompiledPkgPath('sass-loader'),
1229
+ options: {
1230
+ api: 'modern-compiler',
1231
+ implementation: getUserDepPath(unpackConfig.root, [
1232
+ 'sass-embedded',
1233
+ 'sass'
1234
+ ]),
1235
+ sassOptions: null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.sass,
1236
+ sourceMap
1237
+ }
1238
+ };
1329
1239
  };
1330
- null == (_config_module1 = config.module) || null == (_config_module_rules1 = _config_module1.rules) || _config_module_rules1.push({
1240
+ return config.module.rules.push({
1331
1241
  test: /\.css$/i,
1332
1242
  oneOf: [
1333
1243
  withCssModules({
@@ -1342,32 +1252,37 @@ async function getBundlerConfig(unpackConfig) {
1342
1252
  type: 'css'
1343
1253
  }
1344
1254
  ].filter(Boolean)
1345
- });
1346
- let getSassLoader = ()=>{
1347
- var _unpackConfig_css;
1348
- return {
1349
- loader: getCompiledPkgPath('sass-loader'),
1350
- options: {
1351
- api: 'modern-compiler',
1352
- implementation: getUserDepPath(unpackConfig.root, [
1353
- 'sass-embedded',
1354
- 'sass'
1355
- ]),
1356
- sassOptions: null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.sass,
1357
- sourceMap
1255
+ }), config.module.rules.push({
1256
+ test: /\.less$/i,
1257
+ oneOf: [
1258
+ withCssModules({
1259
+ use: [
1260
+ getCssLoader(),
1261
+ getThreadLoader(),
1262
+ getLessLoader()
1263
+ ].filter(Boolean)
1264
+ }),
1265
+ {
1266
+ use: [
1267
+ getCssLoader(),
1268
+ getThreadLoader(),
1269
+ getLessLoader()
1270
+ ].filter(Boolean),
1271
+ type: 'css'
1358
1272
  }
1359
- };
1360
- };
1361
- return null == (_config_module2 = config.module) || null == (_config_module_rules2 = _config_module2.rules) || _config_module_rules2.push({
1273
+ ].filter(Boolean)
1274
+ }), config.module.rules.push({
1362
1275
  test: /\.s[ac]ss$/i,
1363
1276
  oneOf: [
1364
1277
  withCssModules({
1365
1278
  use: [
1279
+ getCssLoader(),
1366
1280
  getSassLoader()
1367
1281
  ]
1368
1282
  }),
1369
1283
  {
1370
1284
  use: [
1285
+ getCssLoader(),
1371
1286
  getSassLoader()
1372
1287
  ],
1373
1288
  type: 'css'
@@ -1380,14 +1295,14 @@ async function getBundlerConfig(unpackConfig) {
1380
1295
  config,
1381
1296
  unpackConfig
1382
1297
  }) : function({ config, unpackConfig }) {
1383
- var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_build, _unpackConfig_css2, _config_module_rules, _config_module, _config_module_rules1, _config_module1, _unpackConfig_css3, _config_module_rules2, _config_module2, _unpackConfig_build1, _unpackConfig_build2, _unpackConfig_css4, _unpackConfig_css5, _unpackConfig_css6;
1384
- let CssExtractPlugin = 'rspack' === unpackConfig.bundler ? rspack.CssExtractRspackPlugin : mini_css_extract_plugin, sourceMap = null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.sourceMap, modules = null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.modules;
1298
+ var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_build, _unpackConfig_css2, _unpackConfig_css3, _unpackConfig_build1, _unpackConfig_build2;
1299
+ let sourceMap = null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.sourceMap, modules = null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.modules;
1385
1300
  isPlainObject(modules) || !1 === modules || (modules = {});
1386
1301
  let getCommonRules = ({ importLoaders })=>[
1387
1302
  utils_isDevServer() ? {
1388
1303
  loader: getCompiledPkgPath('style-loader')
1389
1304
  } : {
1390
- loader: CssExtractPlugin.loader,
1305
+ loader: rspack.CssExtractRspackPlugin.loader,
1391
1306
  options: {
1392
1307
  defaultExport: !0
1393
1308
  }
@@ -1416,7 +1331,7 @@ async function getBundlerConfig(unpackConfig) {
1416
1331
  }
1417
1332
  }
1418
1333
  ].filter(Boolean);
1419
- return utils_isDevServer() || config.plugins.push(new CssExtractPlugin({
1334
+ utils_isDevServer() || config.plugins.push(new rspack.CssExtractRspackPlugin({
1420
1335
  filename: getOutputFilename({
1421
1336
  type: 'css',
1422
1337
  hash: null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.filenameHash
@@ -1426,12 +1341,30 @@ async function getBundlerConfig(unpackConfig) {
1426
1341
  hash: null == (_unpackConfig_build2 = unpackConfig.build) ? void 0 : _unpackConfig_build2.filenameHash,
1427
1342
  async: !0
1428
1343
  })
1429
- })), null == (_config_module = config.module) || null == (_config_module_rules = _config_module.rules) || _config_module_rules.push({
1344
+ }));
1345
+ let getCssLoader = ()=>{
1346
+ var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_css2;
1347
+ return (null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? {
1348
+ loader: 'builtin:lightningcss-loader',
1349
+ options: {
1350
+ targets: DEFAULT_BROWSERSLIST,
1351
+ ...null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.lightningcss
1352
+ }
1353
+ } : {
1354
+ loader: getCompiledPkgPath('postcss-loader'),
1355
+ options: {
1356
+ postcssOptions: null == (_unpackConfig_css2 = unpackConfig.css) ? void 0 : _unpackConfig_css2.postcss,
1357
+ sourceMap
1358
+ }
1359
+ };
1360
+ };
1361
+ return config.module.rules.push({
1430
1362
  test: /\.less$/i,
1431
1363
  use: [
1432
1364
  ...getCommonRules({
1433
- importLoaders: 1
1365
+ importLoaders: 2
1434
1366
  }),
1367
+ getCssLoader(),
1435
1368
  (null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.parallel) && isProd() && {
1436
1369
  loader: require.resolve('thread-loader'),
1437
1370
  options: THREAD_OPTIONS
@@ -1447,32 +1380,21 @@ async function getBundlerConfig(unpackConfig) {
1447
1380
  }
1448
1381
  }
1449
1382
  ].filter(Boolean)
1450
- }), null == (_config_module1 = config.module) || null == (_config_module_rules1 = _config_module1.rules) || _config_module_rules1.push({
1383
+ }), config.module.rules.push({
1451
1384
  test: /\.css$/i,
1452
1385
  use: [
1453
1386
  ...getCommonRules({
1454
1387
  importLoaders: 1
1455
1388
  }),
1456
- (null == (_unpackConfig_css4 = unpackConfig.css) ? void 0 : _unpackConfig_css4.transformer) === 'lightningcss' ? {
1457
- loader: node_path.resolve(css_dirname, './lightningcssLoader.mjs'),
1458
- options: mergeConfig((null == (_unpackConfig_css5 = unpackConfig.css) ? void 0 : _unpackConfig_css5.lightningcss) || {}, {
1459
- sourceMap,
1460
- targets: DEFAULT_LIGHTNINGCSS_TARGET
1461
- })
1462
- } : {
1463
- loader: getCompiledPkgPath('postcss-loader'),
1464
- options: {
1465
- postcssOptions: null == (_unpackConfig_css6 = unpackConfig.css) ? void 0 : _unpackConfig_css6.postcss,
1466
- sourceMap
1467
- }
1468
- }
1389
+ getCssLoader()
1469
1390
  ]
1470
- }), null == (_config_module2 = config.module) || null == (_config_module_rules2 = _config_module2.rules) || _config_module_rules2.push({
1391
+ }), config.module.rules.push({
1471
1392
  test: /\.s[ac]ss$/i,
1472
1393
  use: [
1473
1394
  ...getCommonRules({
1474
- importLoaders: 1
1395
+ importLoaders: 2
1475
1396
  }),
1397
+ getCssLoader(),
1476
1398
  {
1477
1399
  loader: getCompiledPkgPath('sass-loader'),
1478
1400
  options: {
@@ -1506,7 +1428,7 @@ async function getBundlerConfig(unpackConfig) {
1506
1428
  }) : mergeConfig(config, unpackConfig.bundlerConfig)), config;
1507
1429
  }
1508
1430
  async function unpackBuild(unpackConfig) {
1509
- let compiler = ('rspack' === unpackConfig.bundler ? rspack : webpack)(await getBundlerConfig(unpackConfig)), handler = (err, stats)=>{
1431
+ let compiler = rspack(await getBundlerConfig(unpackConfig)), handler = (err, stats)=>{
1510
1432
  if (err) {
1511
1433
  console.error(err.stack || err), err.details && console.error(err.details);
1512
1434
  return;
@@ -1539,7 +1461,38 @@ async function openBrowser(url) {
1539
1461
  logger_logger.error(err);
1540
1462
  }
1541
1463
  try {
1542
- return open_0(url).catch(()=>{}), !0;
1464
+ return new Promise((resolve, reject)=>{
1465
+ let command, args = [];
1466
+ switch(platform()){
1467
+ case 'darwin':
1468
+ command = 'open', args = [
1469
+ url
1470
+ ];
1471
+ break;
1472
+ case 'win32':
1473
+ command = 'cmd', args = [
1474
+ '/c',
1475
+ 'start',
1476
+ '',
1477
+ url
1478
+ ];
1479
+ break;
1480
+ default:
1481
+ command = 'xdg-open', args = [
1482
+ url
1483
+ ];
1484
+ }
1485
+ let child = spawn(command, args, {
1486
+ stdio: 'ignore',
1487
+ detached: !0,
1488
+ windowsHide: !0
1489
+ });
1490
+ child.on('error', (error)=>{
1491
+ reject(Error(`Failed to open URL: ${error.message}`));
1492
+ }), child.on('spawn', ()=>{
1493
+ resolve();
1494
+ }), child.unref();
1495
+ }).catch(()=>{}), !0;
1543
1496
  } catch (err) {
1544
1497
  return logger_logger.error(err), !1;
1545
1498
  }
@@ -1723,7 +1676,7 @@ let getExternalLibraryName = (pkgName)=>({
1723
1676
  let port = await getPort(), staticServer = app.listen(port, ()=>{});
1724
1677
  restartCleaners.push(()=>new Promise((resolve)=>staticServer.close(()=>resolve())));
1725
1678
  let externals = {}, jsAssets = [], cssAssets = [], preJsAssets = [];
1726
- bundledDeps.filter(Boolean).forEach((dep)=>{
1679
+ return bundledDeps.filter(Boolean).forEach((dep)=>{
1727
1680
  dep && (externals[dep.name] = getExternalValue(dep.name), dep.assets.forEach((absPath)=>{
1728
1681
  let relativePath = node_path.relative(cachePath, absPath), preDeps = [
1729
1682
  'react',
@@ -1747,16 +1700,14 @@ let getExternalLibraryName = (pkgName)=>({
1747
1700
  ] : {
1748
1701
  ...externals,
1749
1702
  ...unpackConfig.externals
1750
- };
1751
- let HtmlPlugin = 'rspack' === unpackConfig.bundler ? rspack.HtmlRspackPlugin : html_webpack_plugin;
1752
- return unpackConfig.plugins.push({
1703
+ }, unpackConfig.plugins.push({
1753
1704
  name: 'unpack:prebundle',
1754
1705
  bundlerConfig: (config)=>{
1755
1706
  let PLUGIN_NAME = 'PluginInjectAssets';
1756
1707
  return config.plugins.push({
1757
1708
  apply: (compiler)=>{
1758
1709
  compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
1759
- HtmlPlugin.getCompilationHooks(compilation).beforeAssetTagGeneration.tapPromise(PLUGIN_NAME, async (args)=>{
1710
+ rspack.HtmlRspackPlugin.getCompilationHooks(compilation).beforeAssetTagGeneration.tapPromise(PLUGIN_NAME, async (args)=>{
1760
1711
  let sortedPreJsAssets = preJsAssets.sort((a, b)=>a.order - b.order).map((item)=>item.path);
1761
1712
  return args.assets.js.unshift(...sortedPreJsAssets, ...jsAssets), args.assets.css.unshift(...cssAssets), args;
1762
1713
  });
@@ -1768,11 +1719,11 @@ let getExternalLibraryName = (pkgName)=>({
1768
1719
  };
1769
1720
  async function unpackDev(originalUnpackConfig) {
1770
1721
  var _unpackConfig_dev, _unpackConfig_server, _unpackConfig_server1, _unpackConfig_dev1, _unpackConfig_server2;
1771
- let unpackConfig = originalUnpackConfig, isRspack = 'rspack' === unpackConfig.bundler, bundler = isRspack ? rspack : webpack;
1722
+ let unpackConfig = originalUnpackConfig;
1772
1723
  (null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.prebundle) && (unpackConfig = await prebundleDeps({
1773
1724
  unpackConfig
1774
1725
  }));
1775
- let compiler = bundler(await getBundlerConfig(unpackConfig)), port = await getPort(null == (_unpackConfig_server = unpackConfig.server) ? void 0 : _unpackConfig_server.port), proxyConfig = null == (_unpackConfig_server1 = unpackConfig.server) ? void 0 : _unpackConfig_server1.proxy;
1726
+ let compiler = rspack(await getBundlerConfig(unpackConfig)), port = await getPort(null == (_unpackConfig_server = unpackConfig.server) ? void 0 : _unpackConfig_server.port), proxyConfig = null == (_unpackConfig_server1 = unpackConfig.server) ? void 0 : _unpackConfig_server1.proxy;
1776
1727
  isPlainObject(proxyConfig) && (proxyConfig = Object.entries(proxyConfig).map(([contextStr, target])=>({
1777
1728
  context: contextStr.split(','),
1778
1729
  target,
@@ -1793,9 +1744,9 @@ async function unpackDev(originalUnpackConfig) {
1793
1744
  devServerOptions.setupMiddlewares = (middlewares)=>(middlewares.unshift((req, _, next)=>{
1794
1745
  var _req_headers_accept;
1795
1746
  (null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('html')) && (req.url = '/index.html'), next();
1796
- }), isRspack && middlewares.unshift(experiments.lazyCompilationMiddleware(compiler)), middlewares);
1747
+ }), middlewares.unshift(experiments.lazyCompilationMiddleware(compiler)), middlewares);
1797
1748
  let server = new webpack_dev_server(devServerOptions, compiler);
1798
- await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v2.4.4`)} ${colors.dim(`ready in ${colors.reset(Math.ceil(performance.now() - global.__unpack_start_time))}ms`)}\n`), getAddressUrls({
1749
+ await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.0.0`)} ${colors.dim(`ready in ${colors.reset(Math.ceil(performance.now() - global.__unpack_start_time))}ms`)}\n`), getAddressUrls({
1799
1750
  port: port
1800
1751
  }).forEach((addr)=>{
1801
1752
  let url;
@@ -1812,7 +1763,6 @@ async function unpackDev(originalUnpackConfig) {
1812
1763
  function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
1813
1764
  let resolveConfig = async ()=>{
1814
1765
  let defaultConfig = {
1815
- bundler: 'rspack',
1816
1766
  root: cwd,
1817
1767
  build: {
1818
1768
  outDir: 'dist',
@@ -1846,7 +1796,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
1846
1796
  ]
1847
1797
  }, _context = {
1848
1798
  callerName,
1849
- version: "2.4.4"
1799
+ version: "3.0.0"
1850
1800
  }, { plugins, bundlerConfig, ...rest } = mergeConfig(defaultConfig, config);
1851
1801
  for (let plugin of getNormalizedPluginsByHook('config', plugins))rest = await plugin.config(rest, {
1852
1802
  ..._context,
@@ -1861,7 +1811,9 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
1861
1811
  };
1862
1812
  return {
1863
1813
  build: async ({ watch } = {})=>{
1864
- setNodeEnv(watch ? 'development' : 'production'), console.log(colors.rainbow(`${callerName} v2.4.4`), colors.green(`building for ${watch ? 'development' : 'production'}...`)), unpackBuild(await resolveConfig());
1814
+ setNodeEnv(watch ? 'development' : 'production');
1815
+ let config = await resolveConfig();
1816
+ console.log(colors.rainbow(`${callerName} v3.0.0`), colors.green(`building for ${getNodeEnv()}...`)), unpackBuild(config);
1865
1817
  },
1866
1818
  dev: async ()=>{
1867
1819
  global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0), unpackDev(await resolveConfig());
@@ -1881,4 +1833,4 @@ async function createChokidar(pathOrGlobs, root = process.cwd(), options) {
1881
1833
  ...options
1882
1834
  });
1883
1835
  }
1884
- export { CSS_MODULES_LOCAL_IDENT_NAME, CSS_MODULES_REGEX, CSS_NAMED_EXPORT, DEFAULT_BROWSERSLIST, DEFAULT_DEV_HOST, DEFAULT_ES_TARGET, DEFAULT_LIGHTNINGCSS_TARGET, DEV_DEFAULT_FILENAME, EXPORT_LOCALS_CONVENTION, html_webpack_plugin as HtmlWebpackPlugin, logger_LogColor as LogColor, NODE_MODULES_REGEX, PROD_DEFAULT_FILENAME, TEMPLATE_CONTENT, TEMP_DIR, THREAD_OPTIONS, clearLine, colors, createChokidar, createUnpack, debounce, defineConfig, 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, loadConfig, logUpdate, logger_logger as logger, mergeConfig, pathExists, prettyTime, removeDir, resolveConfigPath, restartCleaners, rspack, setDevServer, setNodeEnv, setValueByPath, trackPerformance, webpack };
1836
+ export { CSS_MODULES_LOCAL_IDENT_NAME, CSS_MODULES_REGEX, CSS_NAMED_EXPORT, DEFAULT_BROWSERSLIST, DEFAULT_DEV_HOST, DEFAULT_ES_TARGET, DEV_DEFAULT_FILENAME, EXPORT_LOCALS_CONVENTION, logger_LogColor as LogColor, NODE_MODULES_REGEX, PROD_DEFAULT_FILENAME, TEMPLATE_CONTENT, TEMP_DIR, THREAD_OPTIONS, clearLine, colors, createChokidar, createUnpack, debounce, defineConfig, 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, loadConfig, logUpdate, logger_logger as logger, mergeConfig, pathExists, prettyTime, removeDir, resolveConfigPath, restartCleaners, rspack, setDevServer, setNodeEnv, setValueByPath, trackPerformance };