@rspack/core 1.4.7-alpha.0 → 1.4.7

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.
@@ -152,9 +152,12 @@ interface JsFormatOptions {
152
152
  * - `false`: removes all comments
153
153
  * - `'some'`: preserves some comments
154
154
  * - `'all'`: preserves all comments
155
+ * - `{ regex: string }`: preserves comments that match the regex
155
156
  * @default false
156
157
  */
157
- comments?: false | "some" | "all";
158
+ comments?: false | "some" | "all" | {
159
+ regex: string;
160
+ };
158
161
  /**
159
162
  * Currently noop.
160
163
  * @default 5
@@ -782,10 +785,6 @@ interface TransformConfig {
782
785
  * https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
783
786
  */
784
787
  verbatimModuleSyntax?: boolean;
785
- /**
786
- * Native class properties support
787
- */
788
- nativeClassProperties?: boolean;
789
788
  }
790
789
  interface ReactConfig {
791
790
  /**
@@ -1 +1 @@
1
- {"name":"@swc/types","author":"강동윤 <kdy1997.dev@gmail.com>","version":"0.1.22","license":"Apache-2.0","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"@swc/types","author":"강동윤 <kdy1997.dev@gmail.com>","version":"0.1.23","license":"Apache-2.0","types":"index.d.ts","type":"commonjs"}
@@ -0,0 +1,11 @@
1
+ declare function GlobToRegExp(glob: string, options?: GlobToRegExp.Options): RegExp;
2
+
3
+ declare namespace GlobToRegExp {
4
+ interface Options {
5
+ extended?: boolean | undefined;
6
+ globstar?: boolean | undefined;
7
+ flags?: string | undefined;
8
+ }
9
+ }
10
+
11
+ export { GlobToRegExp as default };
@@ -0,0 +1,187 @@
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ var __webpack_modules__ = ({
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
+
141
+ /******/ });
142
+ /************************************************************************/
143
+ /******/ // The module cache
144
+ /******/ var __webpack_module_cache__ = {};
145
+ /******/
146
+ /******/ // The require function
147
+ /******/ function __nccwpck_require__(moduleId) {
148
+ /******/ // Check if module is in cache
149
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
150
+ /******/ if (cachedModule !== undefined) {
151
+ /******/ return cachedModule.exports;
152
+ /******/ }
153
+ /******/ // Create a new module (and put it into the cache)
154
+ /******/ var module = __webpack_module_cache__[moduleId] = {
155
+ /******/ // no module.id needed
156
+ /******/ // no module.loaded needed
157
+ /******/ exports: {}
158
+ /******/ };
159
+ /******/
160
+ /******/ // Execute the module function
161
+ /******/ var threw = true;
162
+ /******/ try {
163
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
164
+ /******/ threw = false;
165
+ /******/ } finally {
166
+ /******/ if(threw) delete __webpack_module_cache__[moduleId];
167
+ /******/ }
168
+ /******/
169
+ /******/ // Return the exports of the module
170
+ /******/ return module.exports;
171
+ /******/ }
172
+ /******/
173
+ /************************************************************************/
174
+ /******/ /* webpack/runtime/compat */
175
+ /******/
176
+ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
177
+ /******/
178
+ /************************************************************************/
179
+ /******/
180
+ /******/ // startup
181
+ /******/ // Load entry module and return exports
182
+ /******/ // This entry module is referenced by other modules so it can't be inlined
183
+ /******/ var __webpack_exports__ = __nccwpck_require__(137);
184
+ /******/ module.exports = __webpack_exports__;
185
+ /******/
186
+ /******/ })()
187
+ ;
@@ -0,0 +1 @@
1
+ {"name":"glob-to-regexp","author":"Nick Fitzgerald <fitzgen@gmail.com>","version":"0.4.1","license":"BSD-2-Clause","types":"index.d.ts","type":"commonjs"}
@@ -1,147 +1,10 @@
1
1
  /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
2
3
  /******/ var __webpack_modules__ = ({
3
4
 
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
-
141
5
  /***/ 799:
142
6
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
143
7
 
144
- "use strict";
145
8
  /*
146
9
  MIT License http://www.opensource.org/licenses/mit-license.php
147
10
  Author Tobias Koppers @sokra
@@ -940,7 +803,6 @@ function ensureFsAccuracy(mtime) {
940
803
  /***/ 308:
941
804
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
942
805
 
943
- "use strict";
944
806
  /*
945
807
  MIT License http://www.opensource.org/licenses/mit-license.php
946
808
  Author Tobias Koppers @sokra
@@ -1055,7 +917,6 @@ module.exports = LinkResolver;
1055
917
  /***/ 847:
1056
918
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1057
919
 
1058
- "use strict";
1059
920
  /*
1060
921
  MIT License http://www.opensource.org/licenses/mit-license.php
1061
922
  Author Tobias Koppers @sokra
@@ -1115,7 +976,6 @@ module.exports.WatcherManager = WatcherManager;
1115
976
  /***/ 935:
1116
977
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1117
978
 
1118
- "use strict";
1119
979
  /*
1120
980
  MIT License http://www.opensource.org/licenses/mit-license.php
1121
981
  Author Tobias Koppers @sokra
@@ -1261,7 +1121,6 @@ module.exports = (plan, limit) => {
1261
1121
  /***/ 214:
1262
1122
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1263
1123
 
1264
- "use strict";
1265
1124
  /*
1266
1125
  MIT License http://www.opensource.org/licenses/mit-license.php
1267
1126
  Author Tobias Koppers @sokra
@@ -1640,7 +1499,6 @@ exports.watcherLimit = watcherLimit;
1640
1499
  /***/ 882:
1641
1500
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1642
1501
 
1643
- "use strict";
1644
1502
  /*
1645
1503
  MIT License http://www.opensource.org/licenses/mit-license.php
1646
1504
  Author Tobias Koppers @sokra
@@ -1650,7 +1508,7 @@ exports.watcherLimit = watcherLimit;
1650
1508
  const getWatcherManager = __nccwpck_require__(847);
1651
1509
  const LinkResolver = __nccwpck_require__(308);
1652
1510
  const EventEmitter = (__nccwpck_require__(434).EventEmitter);
1653
- const globToRegExp = __nccwpck_require__(137);
1511
+ const globToRegExp = __nccwpck_require__(686);
1654
1512
  const watchEventSource = __nccwpck_require__(214);
1655
1513
 
1656
1514
  const EMPTY_ARRAY = [];
@@ -2036,12 +1894,18 @@ class Watchpack extends EventEmitter {
2036
1894
  module.exports = Watchpack;
2037
1895
 
2038
1896
 
1897
+ /***/ }),
1898
+
1899
+ /***/ 686:
1900
+ /***/ ((module) => {
1901
+
1902
+ module.exports = require("../glob-to-regexp/index.js");
1903
+
2039
1904
  /***/ }),
2040
1905
 
2041
1906
  /***/ 923:
2042
1907
  /***/ ((module) => {
2043
1908
 
2044
- "use strict";
2045
1909
  module.exports = require("../graceful-fs/index.js");
2046
1910
 
2047
1911
  /***/ }),
@@ -2049,7 +1913,6 @@ module.exports = require("../graceful-fs/index.js");
2049
1913
  /***/ 434:
2050
1914
  /***/ ((module) => {
2051
1915
 
2052
- "use strict";
2053
1916
  module.exports = require("events");
2054
1917
 
2055
1918
  /***/ }),
@@ -2057,7 +1920,6 @@ module.exports = require("events");
2057
1920
  /***/ 896:
2058
1921
  /***/ ((module) => {
2059
1922
 
2060
- "use strict";
2061
1923
  module.exports = require("fs");
2062
1924
 
2063
1925
  /***/ }),
@@ -2065,7 +1927,6 @@ module.exports = require("fs");
2065
1927
  /***/ 857:
2066
1928
  /***/ ((module) => {
2067
1929
 
2068
- "use strict";
2069
1930
  module.exports = require("os");
2070
1931
 
2071
1932
  /***/ }),
@@ -2073,7 +1934,6 @@ module.exports = require("os");
2073
1934
  /***/ 928:
2074
1935
  /***/ ((module) => {
2075
1936
 
2076
- "use strict";
2077
1937
  module.exports = require("path");
2078
1938
 
2079
1939
  /***/ })
@@ -296,6 +296,12 @@ export declare class Compilation {
296
296
  add: (dep: string) => void;
297
297
  addAll: (deps: Iterable<string>) => void;
298
298
  };
299
+ get __internal__addedFileDependencies(): string[];
300
+ get __internal__removedFileDependencies(): string[];
301
+ get __internal__addedContextDependencies(): string[];
302
+ get __internal__removedContextDependencies(): string[];
303
+ get __internal__addedMissingDependencies(): string[];
304
+ get __internal__removedMissingDependencies(): string[];
299
305
  contextDependencies: {
300
306
  [Symbol.iterator](): Generator<string, void, unknown>;
301
307
  has(dep: string): boolean;
@@ -0,0 +1,17 @@
1
+ import * as binding from "@rspack/binding";
2
+ import type Watchpack from "../compiled/watchpack";
3
+ import type { FileSystemInfoEntry, WatchFileSystem, Watcher } from "./util/fs";
4
+ export default class NativeWatchFileSystem implements WatchFileSystem {
5
+ #private;
6
+ watch(files: Iterable<string> & {
7
+ added?: Iterable<string>;
8
+ removed?: Iterable<string>;
9
+ }, directories: Iterable<string> & {
10
+ added?: Iterable<string>;
11
+ removed?: Iterable<string>;
12
+ }, missing: Iterable<string> & {
13
+ added?: Iterable<string>;
14
+ removed?: Iterable<string>;
15
+ }, _startTime: number, options: Watchpack.WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
16
+ getNativeWatcher(options: Watchpack.WatchOptions): binding.NativeWatcher;
17
+ }
@@ -21,7 +21,16 @@ export declare class Watching {
21
21
  startTime?: number;
22
22
  suspended: boolean;
23
23
  constructor(compiler: Compiler, watchOptions: WatchOptions, handler: Callback<Error, Stats>);
24
- watch(files: Iterable<string>, dirs: Iterable<string>, missing: Iterable<string>): void;
24
+ watch(files: Iterable<string> & {
25
+ added?: Iterable<string>;
26
+ removed?: Iterable<string>;
27
+ }, dirs: Iterable<string> & {
28
+ added?: Iterable<string>;
29
+ removed?: Iterable<string>;
30
+ }, missing: Iterable<string> & {
31
+ added?: Iterable<string>;
32
+ removed?: Iterable<string>;
33
+ }): void;
25
34
  close(callback?: () => void): void;
26
35
  invalidate(callback?: Callback<Error, void>): void;
27
36
  /**
@@ -111,6 +111,7 @@ export interface ExperimentsNormalized {
111
111
  inlineConst?: boolean;
112
112
  inlineEnum?: boolean;
113
113
  typeReexportsPresence?: boolean;
114
+ nativeWatcher?: boolean;
114
115
  }
115
116
  export type IgnoreWarningsNormalized = ((warning: WebpackError, compilation: Compilation) => boolean)[];
116
117
  export type OptimizationRuntimeChunkNormalized = false | {
@@ -2042,6 +2042,11 @@ export type Experiments = {
2042
2042
  * @default false
2043
2043
  */
2044
2044
  inlineConst?: boolean;
2045
+ /**
2046
+ * Enable native watcher
2047
+ * @default false
2048
+ */
2049
+ nativeWatcher?: boolean;
2045
2050
  /**
2046
2051
  * Enable inline enum feature
2047
2052
  * @default false
@@ -82,66 +82,64 @@ let pitch = function(request, _, data) {
82
82
  let options = this.getOptions(), emit = void 0 === options.emit || options.emit, callback = this.async(), filepath = this.resourcePath, parseMeta = this.__internal__parseMeta;
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;
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 && (parseMeta[PLUGIN_NAME] = JSON.stringify(dependencies)), callback(null, resultSource, void 0, data);
137
- };
138
- 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, this.importModule(`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, {
139
86
  layer: options.layer,
140
87
  publicPath: publicPathForExtract,
141
88
  baseUri: `${BASE_URI}/`
142
89
  }, (error, exports1)=>{
143
90
  if (error) return void callback(error);
144
- handleExports(exports1);
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);
145
143
  });
146
144
  }, css_extract_loader = function(content) {
147
145
  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;