@rspack-debug/core 1.4.8 → 1.4.11

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 (36) hide show
  1. package/compiled/watchpack/index.js +149 -9
  2. package/dist/BuildInfo.d.ts +1 -1
  3. package/dist/Chunk.d.ts +1 -0
  4. package/dist/ChunkGraph.d.ts +1 -1
  5. package/dist/Compilation.d.ts +1 -1
  6. package/dist/Compiler.d.ts +1 -1
  7. package/dist/Module.d.ts +1 -1
  8. package/dist/MultiCompiler.d.ts +1 -1
  9. package/dist/NativeWatchFileSystem.d.ts +1 -1
  10. package/dist/NormalModuleFactory.d.ts +1 -1
  11. package/dist/Resolver.d.ts +8 -3
  12. package/dist/ResolverFactory.d.ts +1 -1
  13. package/dist/RspackError.d.ts +1 -1
  14. package/dist/builtin-loader/swc/collectTypeScriptInfo.d.ts +13 -0
  15. package/dist/builtin-loader/swc/types.d.ts +4 -0
  16. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
  17. package/dist/builtin-plugin/ExternalsPlugin.d.ts +3 -2
  18. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +4 -0
  19. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  20. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -0
  21. package/dist/builtin-plugin/base.d.ts +1 -1
  22. package/dist/config/adapterRuleUse.d.ts +1 -1
  23. package/dist/config/types.d.ts +4 -1
  24. package/dist/container/ModuleFederationRuntimePlugin.d.ts +5 -2
  25. package/dist/container/index.d.ts +4 -0
  26. package/dist/cssExtractLoader.js +56 -54
  27. package/dist/index.js +3787 -3796
  28. package/dist/loader-runner/service.d.ts +1 -1
  29. package/dist/schema/plugins.d.ts +4 -0
  30. package/dist/stats/statsFactoryUtils.d.ts +1 -1
  31. package/dist/taps/compilation.d.ts +1 -1
  32. package/dist/taps/types.d.ts +1 -1
  33. package/package.json +6 -7
  34. package/compiled/glob-to-regexp/index.d.ts +0 -11
  35. package/compiled/glob-to-regexp/index.js +0 -187
  36. package/compiled/glob-to-regexp/package.json +0 -1
@@ -1,10 +1,147 @@
1
1
  /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
2
  /******/ var __webpack_modules__ = ({
4
3
 
4
+ /***/ 137:
5
+ /***/ ((module) => {
6
+
7
+ module.exports = function (glob, opts) {
8
+ if (typeof glob !== 'string') {
9
+ throw new TypeError('Expected a string');
10
+ }
11
+
12
+ var str = String(glob);
13
+
14
+ // The regexp we are building, as a string.
15
+ var reStr = "";
16
+
17
+ // Whether we are matching so called "extended" globs (like bash) and should
18
+ // support single character matching, matching ranges of characters, group
19
+ // matching, etc.
20
+ var extended = opts ? !!opts.extended : false;
21
+
22
+ // When globstar is _false_ (default), '/foo/*' is translated a regexp like
23
+ // '^\/foo\/.*$' which will match any string beginning with '/foo/'
24
+ // When globstar is _true_, '/foo/*' is translated to regexp like
25
+ // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT
26
+ // which does not have a '/' to the right of it.
27
+ // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but
28
+ // these will not '/foo/bar/baz', '/foo/bar/baz.txt'
29
+ // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when
30
+ // globstar is _false_
31
+ var globstar = opts ? !!opts.globstar : false;
32
+
33
+ // If we are doing extended matching, this boolean is true when we are inside
34
+ // a group (eg {*.html,*.js}), and false otherwise.
35
+ var inGroup = false;
36
+
37
+ // RegExp flags (eg "i" ) to pass in to RegExp constructor.
38
+ var flags = opts && typeof( opts.flags ) === "string" ? opts.flags : "";
39
+
40
+ var c;
41
+ for (var i = 0, len = str.length; i < len; i++) {
42
+ c = str[i];
43
+
44
+ switch (c) {
45
+ case "/":
46
+ case "$":
47
+ case "^":
48
+ case "+":
49
+ case ".":
50
+ case "(":
51
+ case ")":
52
+ case "=":
53
+ case "!":
54
+ case "|":
55
+ reStr += "\\" + c;
56
+ break;
57
+
58
+ case "?":
59
+ if (extended) {
60
+ reStr += ".";
61
+ break;
62
+ }
63
+
64
+ case "[":
65
+ case "]":
66
+ if (extended) {
67
+ reStr += c;
68
+ break;
69
+ }
70
+
71
+ case "{":
72
+ if (extended) {
73
+ inGroup = true;
74
+ reStr += "(";
75
+ break;
76
+ }
77
+
78
+ case "}":
79
+ if (extended) {
80
+ inGroup = false;
81
+ reStr += ")";
82
+ break;
83
+ }
84
+
85
+ case ",":
86
+ if (inGroup) {
87
+ reStr += "|";
88
+ break;
89
+ }
90
+ reStr += "\\" + c;
91
+ break;
92
+
93
+ case "*":
94
+ // Move over all consecutive "*"'s.
95
+ // Also store the previous and next characters
96
+ var prevChar = str[i - 1];
97
+ var starCount = 1;
98
+ while(str[i + 1] === "*") {
99
+ starCount++;
100
+ i++;
101
+ }
102
+ var nextChar = str[i + 1];
103
+
104
+ if (!globstar) {
105
+ // globstar is disabled, so treat any number of "*" as one
106
+ reStr += ".*";
107
+ } else {
108
+ // globstar is enabled, so determine if this is a globstar segment
109
+ var isGlobstar = starCount > 1 // multiple "*"'s
110
+ && (prevChar === "/" || prevChar === undefined) // from the start of the segment
111
+ && (nextChar === "/" || nextChar === undefined) // to the end of the segment
112
+
113
+ if (isGlobstar) {
114
+ // it's a globstar, so match zero or more path segments
115
+ reStr += "((?:[^/]*(?:\/|$))*)";
116
+ i++; // move over the "/"
117
+ } else {
118
+ // it's not a globstar, so only match one path segment
119
+ reStr += "([^/]*)";
120
+ }
121
+ }
122
+ break;
123
+
124
+ default:
125
+ reStr += c;
126
+ }
127
+ }
128
+
129
+ // When regexp 'g' flag is specified don't
130
+ // constrain the regular expression with ^ & $
131
+ if (!flags || !~flags.indexOf('g')) {
132
+ reStr = "^" + reStr + "$";
133
+ }
134
+
135
+ return new RegExp(reStr, flags);
136
+ };
137
+
138
+
139
+ /***/ }),
140
+
5
141
  /***/ 799:
6
142
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
7
143
 
144
+ "use strict";
8
145
  /*
9
146
  MIT License http://www.opensource.org/licenses/mit-license.php
10
147
  Author Tobias Koppers @sokra
@@ -803,6 +940,7 @@ function ensureFsAccuracy(mtime) {
803
940
  /***/ 308:
804
941
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
805
942
 
943
+ "use strict";
806
944
  /*
807
945
  MIT License http://www.opensource.org/licenses/mit-license.php
808
946
  Author Tobias Koppers @sokra
@@ -917,6 +1055,7 @@ module.exports = LinkResolver;
917
1055
  /***/ 847:
918
1056
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
919
1057
 
1058
+ "use strict";
920
1059
  /*
921
1060
  MIT License http://www.opensource.org/licenses/mit-license.php
922
1061
  Author Tobias Koppers @sokra
@@ -976,6 +1115,7 @@ module.exports.WatcherManager = WatcherManager;
976
1115
  /***/ 935:
977
1116
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
978
1117
 
1118
+ "use strict";
979
1119
  /*
980
1120
  MIT License http://www.opensource.org/licenses/mit-license.php
981
1121
  Author Tobias Koppers @sokra
@@ -1121,6 +1261,7 @@ module.exports = (plan, limit) => {
1121
1261
  /***/ 214:
1122
1262
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1123
1263
 
1264
+ "use strict";
1124
1265
  /*
1125
1266
  MIT License http://www.opensource.org/licenses/mit-license.php
1126
1267
  Author Tobias Koppers @sokra
@@ -1499,6 +1640,7 @@ exports.watcherLimit = watcherLimit;
1499
1640
  /***/ 882:
1500
1641
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1501
1642
 
1643
+ "use strict";
1502
1644
  /*
1503
1645
  MIT License http://www.opensource.org/licenses/mit-license.php
1504
1646
  Author Tobias Koppers @sokra
@@ -1508,7 +1650,7 @@ exports.watcherLimit = watcherLimit;
1508
1650
  const getWatcherManager = __nccwpck_require__(847);
1509
1651
  const LinkResolver = __nccwpck_require__(308);
1510
1652
  const EventEmitter = (__nccwpck_require__(434).EventEmitter);
1511
- const globToRegExp = __nccwpck_require__(686);
1653
+ const globToRegExp = __nccwpck_require__(137);
1512
1654
  const watchEventSource = __nccwpck_require__(214);
1513
1655
 
1514
1656
  const EMPTY_ARRAY = [];
@@ -1894,18 +2036,12 @@ class Watchpack extends EventEmitter {
1894
2036
  module.exports = Watchpack;
1895
2037
 
1896
2038
 
1897
- /***/ }),
1898
-
1899
- /***/ 686:
1900
- /***/ ((module) => {
1901
-
1902
- module.exports = require("../glob-to-regexp/index.js");
1903
-
1904
2039
  /***/ }),
1905
2040
 
1906
2041
  /***/ 923:
1907
2042
  /***/ ((module) => {
1908
2043
 
2044
+ "use strict";
1909
2045
  module.exports = require("../graceful-fs/index.js");
1910
2046
 
1911
2047
  /***/ }),
@@ -1913,6 +2049,7 @@ module.exports = require("../graceful-fs/index.js");
1913
2049
  /***/ 434:
1914
2050
  /***/ ((module) => {
1915
2051
 
2052
+ "use strict";
1916
2053
  module.exports = require("events");
1917
2054
 
1918
2055
  /***/ }),
@@ -1920,6 +2057,7 @@ module.exports = require("events");
1920
2057
  /***/ 896:
1921
2058
  /***/ ((module) => {
1922
2059
 
2060
+ "use strict";
1923
2061
  module.exports = require("fs");
1924
2062
 
1925
2063
  /***/ }),
@@ -1927,6 +2065,7 @@ module.exports = require("fs");
1927
2065
  /***/ 857:
1928
2066
  /***/ ((module) => {
1929
2067
 
2068
+ "use strict";
1930
2069
  module.exports = require("os");
1931
2070
 
1932
2071
  /***/ }),
@@ -1934,6 +2073,7 @@ module.exports = require("os");
1934
2073
  /***/ 928:
1935
2074
  /***/ ((module) => {
1936
2075
 
2076
+ "use strict";
1937
2077
  module.exports = require("path");
1938
2078
 
1939
2079
  /***/ })
@@ -1,4 +1,4 @@
1
- import * as binding from "@rspack/binding";
1
+ import binding from "@rspack/binding";
2
2
  import type { Source } from "../compiled/webpack-sources";
3
3
  declare const $assets: unique symbol;
4
4
  declare module "@rspack/binding" {
package/dist/Chunk.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type ChunkGroup } from "@rspack/binding";
1
2
  interface ChunkMaps {
2
3
  hash: Record<string | number, string>;
3
4
  contentHash: Record<string | number, Record<string, string>>;
@@ -1,6 +1,6 @@
1
1
  import type { RuntimeSpec } from "./util/runtime";
2
2
  declare module "@rspack/binding" {
3
- interface Chunk {
3
+ interface ChunkGraph {
4
4
  getModuleChunksIterable(module: Module): Iterable<Chunk>;
5
5
  getOrderedChunkModulesIterable(chunk: Chunk, compareFn: (a: Module, b: Module) => number): Iterable<Module>;
6
6
  getModuleHash(module: Module, runtime: RuntimeSpec): string | null;
@@ -8,7 +8,7 @@
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
10
  import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation, JsRuntimeModule } from "@rspack/binding";
11
- import * as binding from "@rspack/binding";
11
+ import binding from "@rspack/binding";
12
12
  export type { AssetInfo } from "@rspack/binding";
13
13
  import * as liteTapable from "@rspack/lite-tapable";
14
14
  import type { Source } from "../compiled/webpack-sources";
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type * as binding from "@rspack/binding";
10
+ import type binding from "@rspack/binding";
11
11
  import * as liteTapable from "@rspack/lite-tapable";
12
12
  import type Watchpack from "../compiled/watchpack";
13
13
  import type { Source } from "../compiled/webpack-sources";
package/dist/Module.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as binding from "@rspack/binding";
1
+ import binding, { type AssetInfo } from "@rspack/binding";
2
2
  import type { Source } from "../compiled/webpack-sources";
3
3
  import type { ResourceData } from "./Resolver";
4
4
  import "./BuildInfo";
@@ -64,7 +64,7 @@ export declare class MultiCompiler {
64
64
  * @param handler - signals when the call finishes
65
65
  * @returns a compiler watcher
66
66
  */
67
- watch(watchOptions: WatchOptions, handler: liteTapable.Callback<Error, MultiStats>): MultiWatching;
67
+ watch(watchOptions: WatchOptions | WatchOptions[], handler: liteTapable.Callback<Error, MultiStats>): MultiWatching;
68
68
  /**
69
69
  * @param callback - signals when the call finishes
70
70
  * @param options - additional data like modifiedFiles, removedFiles
@@ -1,4 +1,4 @@
1
- import * as binding from "@rspack/binding";
1
+ import binding from "@rspack/binding";
2
2
  import type Watchpack from "../compiled/watchpack";
3
3
  import type { FileSystemInfoEntry, Watcher, WatchFileSystem } from "./util/fs";
4
4
  export default class NativeWatchFileSystem implements WatchFileSystem {
@@ -1,4 +1,4 @@
1
- import type * as binding from "@rspack/binding";
1
+ import type binding from "@rspack/binding";
2
2
  import * as liteTapable from "@rspack/lite-tapable";
3
3
  import type { ResolveData, ResourceDataWithData } from "./Module";
4
4
  import type { ResolverFactory } from "./ResolverFactory";
@@ -1,4 +1,4 @@
1
- import type * as binding from "@rspack/binding";
1
+ import type binding from "@rspack/binding";
2
2
  import { type Resolve } from "./config";
3
3
  import type { ResolveCallback } from "./config/adapterRuleUse";
4
4
  type ResolveContext = {};
@@ -7,10 +7,15 @@ type ResolveOptionsWithDependencyType = Resolve & {
7
7
  resolveToContext?: boolean;
8
8
  };
9
9
  export type ResourceData = binding.JsResourceData;
10
- export type ResolveRequest = ResourceData;
10
+ export interface ResolveRequest {
11
+ path: string;
12
+ query: string;
13
+ fragment: string;
14
+ descriptionFileData?: string;
15
+ descriptionFilePath?: string;
16
+ }
11
17
  export declare class Resolver {
12
18
  #private;
13
- binding: binding.JsResolver;
14
19
  constructor(binding: binding.JsResolver);
15
20
  resolveSync(context: object, path: string, request: string): string | false;
16
21
  resolve(context: object, path: string, request: string, resolveContext: ResolveContext, callback: ResolveCallback): void;
@@ -1,4 +1,4 @@
1
- import * as binding from "@rspack/binding";
1
+ import binding from "@rspack/binding";
2
2
  import { type Resolve } from "./config";
3
3
  import { Resolver } from "./Resolver";
4
4
  type ResolveOptionsWithDependencyType = Resolve & {
@@ -1,4 +1,4 @@
1
- import type * as binding from "@rspack/binding";
1
+ import type binding from "@rspack/binding";
2
2
  export type { RspackError } from "@rspack/binding";
3
3
  export type RspackSeverity = binding.JsRspackSeverity;
4
4
  export declare class NonErrorEmittedError extends Error {
@@ -1,5 +1,18 @@
1
1
  export type CollectTypeScriptInfoOptions = {
2
+ /**
3
+ * Whether to collect type exports information for `typeReexportsPresence`.
4
+ * This is used to check type exports of submodules when running in `'tolerant'` mode.
5
+ * @default false
6
+ */
2
7
  typeExports?: boolean;
8
+ /**
9
+ * Whether to collect information about exported `enum`s.
10
+ * - `true` will collect all `enum` information, including `const enum`s and regular `enum`s.
11
+ * - `false` will not collect any `enum` information.
12
+ * - `'const-only'` will gather only `const enum`s, enabling Rspack to perform cross-module
13
+ * inlining optimizations for them.
14
+ * @default false
15
+ */
3
16
  exportedEnum?: boolean | "const-only";
4
17
  };
5
18
  export declare function resolveCollectTypeScriptInfo(options: CollectTypeScriptInfoOptions): {
@@ -16,6 +16,10 @@ export type SwcLoaderOptions = Config & {
16
16
  */
17
17
  rspackExperiments?: {
18
18
  import?: PluginImportOptions;
19
+ /**
20
+ * Collects information from TypeScript's AST for consumption by subsequent Rspack processes,
21
+ * providing better TypeScript development experience and smaller output bundle size.
22
+ */
19
23
  collectTypeScriptInfo?: CollectTypeScriptInfoOptions;
20
24
  };
21
25
  };
@@ -1,4 +1,4 @@
1
- import * as binding from "@rspack/binding";
1
+ import binding from "@rspack/binding";
2
2
  export interface CssChunkingPluginOptions {
3
3
  strict?: boolean;
4
4
  minSize?: number;
@@ -1,10 +1,11 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
- import type { Compiler, Externals } from "..";
2
+ import type { Externals } from "..";
3
3
  import { RspackBuiltinPlugin } from "./base";
4
4
  export declare class ExternalsPlugin extends RspackBuiltinPlugin {
5
+ #private;
5
6
  private type;
6
7
  private externals;
7
8
  name: BuiltinPluginName;
8
9
  constructor(type: string, externals: Externals);
9
- raw(compiler: Compiler): BuiltinPlugin | undefined;
10
+ raw(): BuiltinPlugin | undefined;
10
11
  }
@@ -9,6 +9,10 @@ export declare namespace RsdoctorPluginData {
9
9
  export type RsdoctorPluginOptions = {
10
10
  moduleGraphFeatures?: boolean | Array<"graph" | "ids" | "sources">;
11
11
  chunkGraphFeatures?: boolean | Array<"graph" | "assets">;
12
+ sourceMapFeatures?: {
13
+ module?: boolean;
14
+ cheap?: boolean;
15
+ };
12
16
  };
13
17
  declare const RsdoctorPluginImpl: {
14
18
  new (c?: RsdoctorPluginOptions | undefined): {
@@ -1,4 +1,4 @@
1
- import * as binding from "@rspack/binding";
1
+ import binding from "@rspack/binding";
2
2
  import * as liteTapable from "@rspack/lite-tapable";
3
3
  import type { Chunk } from "../Chunk";
4
4
  import { type Compilation } from "../Compilation";
@@ -13,6 +13,7 @@ export type SwcJsMinimizerRspackPluginOptions = {
13
13
  extractComments?: ExtractCommentsOptions | undefined;
14
14
  minimizerOptions?: {
15
15
  minify?: boolean;
16
+ ecma?: TerserEcmaVersion;
16
17
  compress?: TerserCompressOptions | boolean;
17
18
  mangle?: TerserMangleOptions | boolean;
18
19
  format?: JsFormatOptions & ToSnakeCaseProperties<JsFormatOptions>;
@@ -1,4 +1,4 @@
1
- import * as binding from "@rspack/binding";
1
+ import binding from "@rspack/binding";
2
2
  import type { Compiler, RspackPluginInstance } from "..";
3
3
  type AffectedHooks = keyof Compiler["hooks"];
4
4
  export declare function canInherentFromParent(affectedHooks?: AffectedHooks): boolean;
@@ -320,7 +320,7 @@ export interface LoaderContext<OptionsType = {}> {
320
320
  *
321
321
  * @internal
322
322
  */
323
- __internal__parseMeta: Record<string, string>;
323
+ __internal__setParseMeta: (key: string, value: string) => void;
324
324
  }
325
325
  export type LoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, content: string, sourceMap?: string | SourceMap, additionalData?: AdditionalData) => string | void | Buffer | Promise<string | Buffer>;
326
326
  export type PitchLoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, remainingRequest: string, previousRequest: string, data: object) => string | void | Buffer | Promise<string | Buffer>;
@@ -495,7 +495,10 @@ export type ResolveTsConfig = string | {
495
495
  export type ResolveOptions = {
496
496
  /** Path alias */
497
497
  alias?: ResolveAlias;
498
- /** Same as node's [conditionNames](https://nodejs.org/api/packages.html#conditional-exports) for the exports and imports fields in package.json. */
498
+ /**
499
+ * Specifies the condition names used to match entry points in the `exports` field of a package.
500
+ * @link https://nodejs.org/api/packages.html#packages_exports
501
+ */
499
502
  conditionNames?: string[];
500
503
  /**
501
504
  * Parse modules in order.
@@ -1,7 +1,10 @@
1
+ export interface ModuleFederationRuntimeOptions {
2
+ entryRuntime?: string;
3
+ }
1
4
  export declare const ModuleFederationRuntimePlugin: {
2
- new (): {
5
+ new (options?: ModuleFederationRuntimeOptions | undefined): {
3
6
  name: string;
4
- _args: [];
7
+ _args: [options?: ModuleFederationRuntimeOptions | undefined];
5
8
  affectedHooks: "done" | "compilation" | "afterDone" | "thisCompilation" | "invalid" | "compile" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "emit" | "assetEmitted" | "afterEmit" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "make" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
6
9
  raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
7
10
  apply(compiler: import("..").Compiler): void;
@@ -0,0 +1,4 @@
1
+ export * from "./ContainerPlugin";
2
+ export * from "./ContainerReferencePlugin";
3
+ export * from "./ModuleFederationPlugin";
4
+ export * from "./ModuleFederationPluginV1";
@@ -79,67 +79,69 @@ let pitch = function(request, _, data) {
79
79
  e.stack = void 0, this.emitWarning(e);
80
80
  return;
81
81
  }
82
- let options = this.getOptions(), emit = void 0 === options.emit || options.emit, callback = this.async(), filepath = this.resourcePath, parseMeta = this.__internal__parseMeta;
82
+ let options = this.getOptions(), emit = void 0 === options.emit || options.emit, callback = this.async(), filepath = this.resourcePath;
83
83
  this.addDependency(filepath);
84
84
  let { publicPath } = this._compilation.outputOptions;
85
- "string" == typeof options.publicPath ? publicPath = options.publicPath : "function" == typeof options.publicPath && (publicPath = options.publicPath(this.resourcePath, this.rootContext)), "auto" === publicPath && (publicPath = AUTO_PUBLIC_PATH), publicPathForExtract = "string" == typeof publicPath ? /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath) ? publicPath : `${ABSOLUTE_PUBLIC_PATH}${publicPath.replace(/\./g, SINGLE_DOT_PATH_SEGMENT)}` : publicPath, this.importModule(`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, {
85
+ "string" == typeof options.publicPath ? publicPath = options.publicPath : "function" == typeof options.publicPath && (publicPath = options.publicPath(this.resourcePath, this.rootContext)), "auto" === publicPath && (publicPath = AUTO_PUBLIC_PATH), publicPathForExtract = "string" == typeof publicPath ? /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath) ? publicPath : `${ABSOLUTE_PUBLIC_PATH}${publicPath.replace(/\./g, SINGLE_DOT_PATH_SEGMENT)}` : publicPath;
86
+ let handleExports = (originalExports)=>{
87
+ let locals, namedExport, esModule = void 0 === options.esModule || options.esModule, dependencies = [];
88
+ try {
89
+ let exports1 = originalExports.__esModule ? originalExports.default : originalExports;
90
+ if (namedExport = originalExports.__esModule && (!originalExports.default || !("locals" in originalExports.default))) for (let key of Object.keys(originalExports))"default" !== key && (locals || (locals = {}), locals[key] = originalExports[key]);
91
+ else locals = exports1?.locals;
92
+ if (Array.isArray(exports1) && emit) {
93
+ let identifierCountMap = new Map();
94
+ dependencies = exports1.map(([id, content, media, sourceMap, supports, layer])=>{
95
+ let context = this.rootContext, count = identifierCountMap.get(id) || 0;
96
+ return identifierCountMap.set(id, count + 1), {
97
+ identifier: id,
98
+ context,
99
+ content,
100
+ media,
101
+ supports,
102
+ layer,
103
+ identifierIndex: count,
104
+ sourceMap: sourceMap ? JSON.stringify(sourceMap) : void 0,
105
+ filepath
106
+ };
107
+ }).filter((item)=>null !== item);
108
+ }
109
+ } catch (e) {
110
+ callback(e);
111
+ return;
112
+ }
113
+ let result = function() {
114
+ if (locals) {
115
+ if (namedExport) {
116
+ let identifiers = Array.from(function*() {
117
+ let identifierId = 0;
118
+ for (let key of Object.keys(locals))identifierId += 1, yield [
119
+ `_${identifierId.toString(16)}`,
120
+ key
121
+ ];
122
+ }()), localsString = identifiers.map(([id, key])=>{
123
+ var value;
124
+ return `\nvar ${id} = ${"function" == typeof (value = locals[key]) ? value.toString() : JSON.stringify(value)};`;
125
+ }).join(""), exportsString = `export { ${identifiers.map(([id, key])=>`${id} as ${JSON.stringify(key)}`).join(", ")} }`;
126
+ return void 0 !== options.defaultExport && options.defaultExport ? `${localsString}\n${exportsString}\nexport default { ${identifiers.map(([id, key])=>`${JSON.stringify(key)}: ${id}`).join(", ")} }\n` : `${localsString}\n${exportsString}\n`;
127
+ }
128
+ return `\n${esModule ? "export default" : "module.exports = "} ${JSON.stringify(locals)};`;
129
+ }
130
+ return esModule ? "\nexport {};" : "";
131
+ }(), resultSource = `// extracted by ${PLUGIN_NAME}`;
132
+ resultSource += this.hot && emit ? hotLoader(result, {
133
+ loaderContext: this,
134
+ options,
135
+ locals: locals
136
+ }) : result, dependencies.length > 0 && this.__internal__setParseMeta(PLUGIN_NAME, JSON.stringify(dependencies)), callback(null, resultSource, void 0, data);
137
+ };
138
+ this.importModule(`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, {
86
139
  layer: options.layer,
87
140
  publicPath: publicPathForExtract,
88
141
  baseUri: `${BASE_URI}/`
89
142
  }, (error, exports1)=>{
90
143
  if (error) return void callback(error);
91
- ((originalExports)=>{
92
- let locals, namedExport, esModule = void 0 === options.esModule || options.esModule, dependencies = [];
93
- try {
94
- let exports1 = originalExports.__esModule ? originalExports.default : originalExports;
95
- if (namedExport = originalExports.__esModule && (!originalExports.default || !("locals" in originalExports.default))) for (let key of Object.keys(originalExports))"default" !== key && (locals || (locals = {}), locals[key] = originalExports[key]);
96
- else locals = exports1?.locals;
97
- if (Array.isArray(exports1) && emit) {
98
- let identifierCountMap = new Map();
99
- dependencies = exports1.map(([id, content, media, sourceMap, supports, layer])=>{
100
- let context = this.rootContext, count = identifierCountMap.get(id) || 0;
101
- return identifierCountMap.set(id, count + 1), {
102
- identifier: id,
103
- context,
104
- content,
105
- media,
106
- supports,
107
- layer,
108
- identifierIndex: count,
109
- sourceMap: sourceMap ? JSON.stringify(sourceMap) : void 0,
110
- filepath
111
- };
112
- }).filter((item)=>null !== item);
113
- }
114
- } catch (e) {
115
- callback(e);
116
- return;
117
- }
118
- let result = function() {
119
- if (locals) {
120
- if (namedExport) {
121
- let identifiers = Array.from(function*() {
122
- let identifierId = 0;
123
- for (let key of Object.keys(locals))identifierId += 1, yield [
124
- `_${identifierId.toString(16)}`,
125
- key
126
- ];
127
- }()), localsString = identifiers.map(([id, key])=>{
128
- var value;
129
- return `\nvar ${id} = ${"function" == typeof (value = locals[key]) ? value.toString() : JSON.stringify(value)};`;
130
- }).join(""), exportsString = `export { ${identifiers.map(([id, key])=>`${id} as ${JSON.stringify(key)}`).join(", ")} }`;
131
- return void 0 !== options.defaultExport && options.defaultExport ? `${localsString}\n${exportsString}\nexport default { ${identifiers.map(([id, key])=>`${JSON.stringify(key)}: ${id}`).join(", ")} }\n` : `${localsString}\n${exportsString}\n`;
132
- }
133
- return `\n${esModule ? "export default" : "module.exports = "} ${JSON.stringify(locals)};`;
134
- }
135
- return esModule ? "\nexport {};" : "";
136
- }(), resultSource = `// extracted by ${PLUGIN_NAME}`;
137
- resultSource += this.hot && emit ? hotLoader(result, {
138
- loaderContext: this,
139
- options,
140
- locals: locals
141
- }) : result, dependencies.length > 0 && (parseMeta[PLUGIN_NAME] = JSON.stringify(dependencies)), callback(null, resultSource, void 0, data);
142
- })(exports1);
144
+ handleExports(exports1);
143
145
  });
144
146
  }, css_extract_loader = function(content) {
145
147
  if (this._compiler?.options?.experiments?.css && this._module && ("css" === this._module.type || "css/auto" === this._module.type || "css/global" === this._module.type || "css/module" === this._module.type)) return content;