@unpackjs/core 3.7.7 → 3.8.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 (52) hide show
  1. package/compiled/css-loader/index.js +22 -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/dist/index.js +843 -576
  6. package/dist/rslib-runtime.js +15 -0
  7. package/dist/transformLoader.js +11 -0
  8. package/dist/{typedCssModulesLoader.mjs → typedCssModulesLoader.js} +5 -13
  9. package/dist-types/bundler-config/cache.d.ts +1 -1
  10. package/dist-types/bundler-config/cache.d.ts.map +1 -1
  11. package/dist-types/bundler-config/html.d.ts +6 -0
  12. package/dist-types/bundler-config/html.d.ts.map +1 -0
  13. package/dist-types/bundler-config/index.d.ts.map +1 -1
  14. package/dist-types/bundler-config/loaders/transformLoader.d.ts +5 -0
  15. package/dist-types/bundler-config/loaders/transformLoader.d.ts.map +1 -0
  16. package/dist-types/bundler-config/plugins/progress/helpers.d.ts.map +1 -1
  17. package/dist-types/bundler-config/plugins/progress/index.d.ts +2 -2
  18. package/dist-types/bundler-config/plugins/progress/index.d.ts.map +1 -1
  19. package/dist-types/bundler-config/plugins/registerHooks.d.ts +6 -0
  20. package/dist-types/bundler-config/plugins/registerHooks.d.ts.map +1 -0
  21. package/dist-types/constants.d.ts +3 -0
  22. package/dist-types/constants.d.ts.map +1 -1
  23. package/dist-types/createUnpack.d.ts +4 -1
  24. package/dist-types/createUnpack.d.ts.map +1 -1
  25. package/dist-types/global.d.ts +4 -2
  26. package/dist-types/global.d.ts.map +1 -1
  27. package/dist-types/index.d.ts +1 -0
  28. package/dist-types/index.d.ts.map +1 -1
  29. package/dist-types/plugin.d.ts +4 -1
  30. package/dist-types/plugin.d.ts.map +1 -1
  31. package/dist-types/plugins/browserLogs.d.ts +3 -0
  32. package/dist-types/plugins/browserLogs.d.ts.map +1 -0
  33. package/dist-types/plugins/fileSize.d.ts +3 -0
  34. package/dist-types/plugins/fileSize.d.ts.map +1 -0
  35. package/dist-types/plugins/prebundle.d.ts +3 -0
  36. package/dist-types/plugins/prebundle.d.ts.map +1 -0
  37. package/dist-types/run/dev.d.ts +4 -1
  38. package/dist-types/run/dev.d.ts.map +1 -1
  39. package/dist-types/types/config.d.ts +24 -26
  40. package/dist-types/types/config.d.ts.map +1 -1
  41. package/dist-types/types/plugin.d.ts +22 -2
  42. package/dist-types/types/plugin.d.ts.map +1 -1
  43. package/dist-types/utils.d.ts +13 -1
  44. package/dist-types/utils.d.ts.map +1 -1
  45. package/package.json +9 -7
  46. package/dist/transformDeepImportLoader.mjs +0 -82
  47. package/dist-types/bundler-config/loaders/transformDeepImportLoader.d.ts +0 -5
  48. package/dist-types/bundler-config/loaders/transformDeepImportLoader.d.ts.map +0 -1
  49. package/dist-types/prebundleDeps.d.ts +0 -5
  50. package/dist-types/prebundleDeps.d.ts.map +0 -1
  51. package/dist-types/reporter.d.ts +0 -8
  52. package/dist-types/reporter.d.ts.map +0 -1
@@ -1,82 +0,0 @@
1
- import * as __rspack_external__compiled_launch_editor_index_js_29002383 from "../compiled/launch-editor/index.js";
2
- import * as __rspack_external__compiled_webpack_merge_index_js_efd91626 from "../compiled/webpack-merge/index.js";
3
- import "node:fs";
4
- import "node:net";
5
- import "node:os";
6
- import "node:path";
7
- import "portfinder";
8
- var __webpack_modules__ = {
9
- "compiled/launch-editor" (module) {
10
- module.exports = __rspack_external__compiled_launch_editor_index_js_29002383;
11
- },
12
- "compiled/webpack-merge" (module) {
13
- module.exports = __rspack_external__compiled_webpack_merge_index_js_efd91626;
14
- }
15
- }, __webpack_module_cache__ = {};
16
- function __webpack_require__(moduleId) {
17
- var cachedModule = __webpack_module_cache__[moduleId];
18
- if (void 0 !== cachedModule) return cachedModule.exports;
19
- var module = __webpack_module_cache__[moduleId] = {
20
- exports: {}
21
- };
22
- return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
23
- }
24
- let isCI = !!process.env.CI, isTTY = !!process.stdout?.isTTY, noColor = !!process.env.NO_COLOR, forceColor = !!process.env.FORCE_COLOR, disableColor = !1;
25
- disableColor = !!noColor || !forceColor && (isCI || !isTTY);
26
- let COLOR_HEX = {
27
- brand: '#B39AFF',
28
- red: '#F38BA8',
29
- green: '#A6E3A1',
30
- yellow: '#F9E2AF',
31
- blue: '#89B4FA',
32
- magenta: '#EE90DB',
33
- cyan: '#89DCEB',
34
- gray: '#6C7086'
35
- }, COLOR_HEX_TO_OPEN = Object.fromEntries(Object.values(COLOR_HEX).map((hex)=>[
36
- hex,
37
- ((hex)=>{
38
- let r, g, b, value = (hex || '').trim().replace(/^#/, '');
39
- if (/^[0-9a-fA-F]{3}$/.test(value)) r = Number.parseInt(value[0] + value[0], 16), g = Number.parseInt(value[1] + value[1], 16), b = Number.parseInt(value[2] + value[2], 16);
40
- else {
41
- if (!/^[0-9a-fA-F]{6}$/.test(value)) return '';
42
- r = Number.parseInt(value.slice(0, 2), 16), g = Number.parseInt(value.slice(2, 4), 16), b = Number.parseInt(value.slice(4, 6), 16);
43
- }
44
- return `\x1b[38;2;${r};${g};${b}m`;
45
- })(hex)
46
- ])), hexColor = (hex)=>{
47
- if (disableColor) return (input)=>String(input);
48
- let open = COLOR_HEX_TO_OPEN[hex];
49
- return open ? (input)=>`${open}${input}\x1b[39m` : (input)=>String(input);
50
- }, ansi = (open, close)=>(input)=>disableColor ? String(input) : `${open}${input}${close}`;
51
- hexColor(COLOR_HEX.brand), hexColor(COLOR_HEX.red), hexColor(COLOR_HEX.green), hexColor(COLOR_HEX.yellow), hexColor(COLOR_HEX.blue), hexColor(COLOR_HEX.magenta), hexColor(COLOR_HEX.cyan), hexColor(COLOR_HEX.gray), ansi('\x1b[1m', '\x1b[22m'), ansi('\x1b[2m', '\x1b[22m'), Object.fromEntries(Object.entries({
52
- 31: COLOR_HEX.red,
53
- 32: COLOR_HEX.green,
54
- 33: COLOR_HEX.yellow,
55
- 34: COLOR_HEX.blue,
56
- 35: COLOR_HEX.magenta,
57
- 36: COLOR_HEX.cyan,
58
- 90: COLOR_HEX.gray,
59
- 91: COLOR_HEX.red,
60
- 92: COLOR_HEX.green,
61
- 93: COLOR_HEX.yellow,
62
- 94: COLOR_HEX.blue,
63
- 95: COLOR_HEX.magenta,
64
- 96: COLOR_HEX.cyan
65
- }).map(([code, hex])=>[
66
- code,
67
- COLOR_HEX_TO_OPEN[hex]
68
- ]));
69
- let { merge: mergeConfig } = __webpack_require__("compiled/webpack-merge"), { default: launchEditor } = __webpack_require__("compiled/launch-editor"), escapeRegExp = (string)=>string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
70
- function transformDeepImportLoader(content) {
71
- if (this.cacheable && this.cacheable(!0), !content.includes('import')) return content;
72
- let packages = this.getOptions().packages || [];
73
- if (0 === packages.length || !packages.some((pkg)=>content.includes(pkg))) return content;
74
- let packagesPattern = [
75
- ...packages
76
- ].sort((a, b)=>b.length - a.length).map(escapeRegExp).join('|'), regex = RegExp(`import\\s+([a-zA-Z0-9_$]+)\\s+from\\s+['"]((${packagesPattern})/[^'"]+)['"]`, 'g');
77
- return content.replace(regex, (_, localName, importPath, pkgName)=>{
78
- let name, exportName = ((!(name = (name = importPath.slice(pkgName.length + 1).replace(/[^a-zA-Z0-9_$]+([a-zA-Z0-9_$])/g, (_, char)=>char.toUpperCase()).replace(/[^a-zA-Z0-9_$]/g, '')).charAt(0).toUpperCase() + name.slice(1)) || /^[^a-zA-Z_$]/.test(name)) && (name = `_${name}`), name);
79
- return `import { ${exportName} as ${localName} } from '${pkgName}'`;
80
- });
81
- }
82
- export { transformDeepImportLoader as default };
@@ -1,5 +0,0 @@
1
- import type { Rspack } from '../../types';
2
- export default function (this: Rspack.LoaderContext<{
3
- packages: string[];
4
- }>, content: string): string;
5
- //# sourceMappingURL=transformDeepImportLoader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformDeepImportLoader.d.ts","sourceRoot":"","sources":["../../../src/bundler-config/loaders/transformDeepImportLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAOvC,MAAM,CAAC,OAAO,WACZ,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,EAClD,OAAO,EAAE,MAAM,GACd,MAAM,CAmCR"}
@@ -1,5 +0,0 @@
1
- import type { UnpackConfig } from './types';
2
- export declare const prebundleDeps: ({ unpackConfig, }: {
3
- unpackConfig: UnpackConfig;
4
- }) => Promise<UnpackConfig>;
5
- //# sourceMappingURL=prebundleDeps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prebundleDeps.d.ts","sourceRoot":"","sources":["../src/prebundleDeps.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,SAAS,CAAA;AAiHnD,eAAO,MAAM,aAAa,GAAU,mBAEjC;IACD,YAAY,EAAE,YAAY,CAAA;CAC3B,KAAG,OAAO,CAAC,YAAY,CAiXvB,CAAA"}
@@ -1,8 +0,0 @@
1
- import type { Rspack } from './types';
2
- type Options = {
3
- root: string;
4
- stats: Rspack.Stats;
5
- };
6
- export declare function printFileSize({ root, stats }: Options): Promise<void>;
7
- export {};
8
- //# sourceMappingURL=reporter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAC,KAAK,CAAA;CACpB,CAAA;AA6BD,wBAAsB,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,OAAO,iBAkG3D"}