@rspack/core 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ResolverFactory.d.ts +49 -0
- package/dist/ResolverFactory.d.ts.map +1 -0
- package/dist/ResolverFactory.js +117 -0
- package/dist/ResolverFactory.js.map +1 -0
- package/dist/compilation.d.ts +7 -3
- package/dist/compilation.d.ts.map +1 -1
- package/dist/compilation.js +18 -12
- package/dist/compilation.js.map +1 -1
- package/dist/compiler.d.ts +3 -0
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +3 -0
- package/dist/compiler.js.map +1 -1
- package/dist/config/cache.d.ts.map +1 -1
- package/dist/config/cache.js +3 -4
- package/dist/config/cache.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +105 -4
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/devtool.d.ts +1 -0
- package/dist/config/devtool.d.ts.map +1 -1
- package/dist/config/devtool.js +5 -1
- package/dist/config/devtool.js.map +1 -1
- package/dist/config/index.d.ts +10 -7
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +10 -3
- package/dist/config/index.js.map +1 -1
- package/dist/config/module.d.ts +38 -3
- package/dist/config/module.d.ts.map +1 -1
- package/dist/config/module.js +209 -47
- package/dist/config/module.js.map +1 -1
- package/dist/config/node.d.ts +9 -0
- package/dist/config/node.d.ts.map +1 -0
- package/dist/config/node.js +15 -0
- package/dist/config/node.js.map +1 -0
- package/dist/config/optimization.d.ts +5 -0
- package/dist/config/optimization.d.ts.map +1 -1
- package/dist/config/optimization.js +3 -1
- package/dist/config/optimization.js.map +1 -1
- package/dist/config/plugin.d.ts +1 -1
- package/dist/config/plugin.d.ts.map +1 -1
- package/dist/config/target.js +1 -1
- package/dist/config/target.js.map +1 -1
- package/dist/node/NodeEnvironmentPlugin.d.ts +27 -0
- package/dist/node/NodeEnvironmentPlugin.d.ts.map +1 -0
- package/dist/node/NodeEnvironmentPlugin.js +54 -0
- package/dist/node/NodeEnvironmentPlugin.js.map +1 -0
- package/dist/rspack.d.ts.map +1 -1
- package/dist/rspack.js +6 -15
- package/dist/rspack.js.map +1 -1
- package/dist/rspackOptionsApply.d.ts.map +1 -1
- package/dist/rspackOptionsApply.js +29 -0
- package/dist/rspackOptionsApply.js.map +1 -1
- package/dist/stats.d.ts +1 -0
- package/dist/stats.d.ts.map +1 -1
- package/dist/stats.js +3 -0
- package/dist/stats.js.map +1 -1
- package/dist/util/cleverMerge.d.ts +79 -0
- package/dist/util/cleverMerge.d.ts.map +1 -0
- package/dist/util/cleverMerge.js +531 -0
- package/dist/util/cleverMerge.js.map +1 -0
- package/dist/util/createHash.d.ts +7 -0
- package/dist/util/createHash.d.ts.map +1 -0
- package/dist/util/createHash.js +166 -0
- package/dist/util/createHash.js.map +1 -0
- package/dist/util/createSource.d.ts +6 -0
- package/dist/util/createSource.d.ts.map +1 -0
- package/dist/util/createSource.js +48 -0
- package/dist/util/createSource.js.map +1 -0
- package/dist/util/hash/BatchedHash.d.ts +16 -0
- package/dist/util/hash/BatchedHash.d.ts.map +1 -0
- package/dist/util/hash/BatchedHash.js +61 -0
- package/dist/util/hash/BatchedHash.js.map +1 -0
- package/dist/util/hash/index.d.ts +19 -0
- package/dist/util/hash/index.d.ts.map +1 -0
- package/dist/util/hash/index.js +28 -0
- package/dist/util/hash/index.js.map +1 -0
- package/dist/util/hash/md4.d.ts +3 -0
- package/dist/util/hash/md4.d.ts.map +1 -0
- package/dist/util/hash/md4.js +13 -0
- package/dist/util/hash/md4.js.map +1 -0
- package/dist/util/hash/wasm-hash.d.ts +7 -0
- package/dist/util/hash/wasm-hash.d.ts.map +1 -0
- package/dist/util/hash/wasm-hash.js +162 -0
- package/dist/util/hash/wasm-hash.js.map +1 -0
- package/dist/util/hash/xxhash64.d.ts +3 -0
- package/dist/util/hash/xxhash64.d.ts.map +1 -0
- package/dist/util/hash/xxhash64.js +13 -0
- package/dist/util/hash/xxhash64.js.map +1 -0
- package/dist/util/identifier.d.ts +77 -0
- package/dist/util/identifier.d.ts.map +1 -0
- package/dist/util/identifier.js +345 -0
- package/dist/util/identifier.js.map +1 -0
- package/dist/util/index.d.ts +6 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +18 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/memoize.d.ts +2 -0
- package/dist/util/memoize.d.ts.map +1 -0
- package/dist/util/memoize.js +22 -0
- package/dist/util/memoize.js.map +1 -0
- package/package.json +25 -13
- package/dist/bundle.js +0 -1
- package/dist/dd.js +0 -1
- package/dist/dynamic_js.xxxx.js +0 -1
- package/dist/main.js +0 -1
- package/dist/main.xxxx.js +0 -1
- package/dist/runtime.js +0 -1
- package/dist/web/polyfillBuiltins.d.ts +0 -5
- package/dist/web/polyfillBuiltins.d.ts.map +0 -1
- package/dist/web/polyfillBuiltins.js +0 -43
- package/dist/web/polyfillBuiltins.js.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} context context used to create relative path
|
|
3
|
+
* @param {string} identifier identifier used to create relative path
|
|
4
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
5
|
+
* @returns {string} the returned relative path
|
|
6
|
+
*/
|
|
7
|
+
export function makePathsRelative(context: string, identifier: string, associatedObjectForCache?: any | undefined): string;
|
|
8
|
+
export namespace makePathsRelative {
|
|
9
|
+
/**
|
|
10
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
11
|
+
* @returns {function(string, string): string} cached function
|
|
12
|
+
*/
|
|
13
|
+
function bindCache(associatedObjectForCache?: any): (arg0: string, arg1: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} context context used to create relative path
|
|
16
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
17
|
+
* @returns {function(string): string} cached function
|
|
18
|
+
*/
|
|
19
|
+
function bindContextCache(context: string, associatedObjectForCache?: any): (arg0: string) => string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} context context used to create relative path
|
|
23
|
+
* @param {string} identifier identifier used to create relative path
|
|
24
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
25
|
+
* @returns {string} the returned relative path
|
|
26
|
+
*/
|
|
27
|
+
export function makePathsAbsolute(context: string, identifier: string, associatedObjectForCache?: any | undefined): string;
|
|
28
|
+
export namespace makePathsAbsolute { }
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} str the path with query and fragment
|
|
31
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
32
|
+
* @returns {ParsedResource} parsed parts
|
|
33
|
+
*/
|
|
34
|
+
export function parseResource(str: string, associatedObjectForCache?: any | undefined): ParsedResource;
|
|
35
|
+
export namespace parseResource {
|
|
36
|
+
function bindCache(associatedObjectForCache: any): (str: any) => any;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @param {string} str the path with query and fragment
|
|
40
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
41
|
+
* @returns {ParsedResource} parsed parts
|
|
42
|
+
*/
|
|
43
|
+
export function parseResourceWithoutFragment(str: string, associatedObjectForCache?: any | undefined): ParsedResource;
|
|
44
|
+
export namespace parseResourceWithoutFragment { }
|
|
45
|
+
export function getUndoPath(filename: string, outputPath: string, enforceRelative: boolean): string;
|
|
46
|
+
export type MakeRelativePathsCache = {
|
|
47
|
+
relativePaths?: Map<string, Map<string, string>> | undefined;
|
|
48
|
+
};
|
|
49
|
+
export type ParsedResource = {
|
|
50
|
+
resource: string;
|
|
51
|
+
path: string;
|
|
52
|
+
query: string;
|
|
53
|
+
fragment: string;
|
|
54
|
+
};
|
|
55
|
+
export type ParsedResourceWithoutFragment = {
|
|
56
|
+
resource: string;
|
|
57
|
+
path: string;
|
|
58
|
+
query: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* @param {string} context context used to create relative path
|
|
62
|
+
* @param {string} identifier identifier used to create relative path
|
|
63
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
64
|
+
* @returns {string} the returned relative path
|
|
65
|
+
*/
|
|
66
|
+
export function contextify(context: string, identifier: string, associatedObjectForCache?: any | undefined): string;
|
|
67
|
+
export namespace contextify { }
|
|
68
|
+
/**
|
|
69
|
+
* @param {string} context context used to create relative path
|
|
70
|
+
* @param {string} identifier identifier used to create relative path
|
|
71
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
72
|
+
* @returns {string} the returned relative path
|
|
73
|
+
*/
|
|
74
|
+
export function absolutify(context: string, identifier: string, associatedObjectForCache?: any | undefined): string;
|
|
75
|
+
export namespace absolutify { }
|
|
76
|
+
import path = require("path");
|
|
77
|
+
//# sourceMappingURL=identifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../src/util/identifier.js"],"names":[],"mappings":"AAiIC;;;;;GAKG;AACH,2CALW,MAAM,cACN,MAAM,+CAEJ,MAAM,CA0BlB;;IAED;;;OAGG;IACH,2FAoCC;IAED;;;;OAIG;IACH,qGAiCC;;AAhHD;;;;;GAKG;AACH,2CALW,MAAM,cACN,MAAM,+CAEJ,MAAM,CA0BlB;;AA/DD;;;;GAIG;AACH,mCAJW,MAAM,+CAEJ,cAAc,CAU1B;;IAED,qEASC;;AAxBD;;;;GAIG;AACH,kDAJW,MAAM,+CAEJ,cAAc,CAU1B;;AAkPoB,sCALX,MAAM,cACN,MAAM,mBACN,OAAO,GACL,MAAM,CA2BlB;;oBA1Wa,IAAI,MAAM,EAAE,IAAI,MAAM,EAAE,MAAM,CAAC,CAAC;;6BAwShC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;4CACnE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAtL9D;;;;;GAKG;AACH,oCALW,MAAM,cACN,MAAM,+CAEJ,MAAM,CA0BlB;;AA9BD;;;;;GAKG;AACH,oCALW,MAAM,cACN,MAAM,+CAEJ,MAAM,CA0BlB"}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
*/
|
|
4
|
+
"use strict";
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/;
|
|
7
|
+
const SEGMENTS_SPLIT_REGEXP = /([|!])/;
|
|
8
|
+
const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g;
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} MakeRelativePathsCache
|
|
11
|
+
* @property {Map<string, Map<string, string>>=} relativePaths
|
|
12
|
+
*/
|
|
13
|
+
const relativePathToRequest = relativePath => {
|
|
14
|
+
if (relativePath === "")
|
|
15
|
+
return "./.";
|
|
16
|
+
if (relativePath === "..")
|
|
17
|
+
return "../.";
|
|
18
|
+
if (relativePath.startsWith("../"))
|
|
19
|
+
return relativePath;
|
|
20
|
+
return `./${relativePath}`;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @param {string} context context for relative path
|
|
24
|
+
* @param {string} maybeAbsolutePath path to make relative
|
|
25
|
+
* @returns {string} relative path in request style
|
|
26
|
+
*/
|
|
27
|
+
const absoluteToRequest = (context, maybeAbsolutePath) => {
|
|
28
|
+
if (maybeAbsolutePath[0] === "/") {
|
|
29
|
+
if (maybeAbsolutePath.length > 1 &&
|
|
30
|
+
maybeAbsolutePath[maybeAbsolutePath.length - 1] === "/") {
|
|
31
|
+
// this 'path' is actually a regexp generated by dynamic requires.
|
|
32
|
+
// Don't treat it as an absolute path.
|
|
33
|
+
return maybeAbsolutePath;
|
|
34
|
+
}
|
|
35
|
+
const querySplitPos = maybeAbsolutePath.indexOf("?");
|
|
36
|
+
let resource = querySplitPos === -1
|
|
37
|
+
? maybeAbsolutePath
|
|
38
|
+
: maybeAbsolutePath.slice(0, querySplitPos);
|
|
39
|
+
resource = relativePathToRequest(path.posix.relative(context, resource));
|
|
40
|
+
return querySplitPos === -1
|
|
41
|
+
? resource
|
|
42
|
+
: resource + maybeAbsolutePath.slice(querySplitPos);
|
|
43
|
+
}
|
|
44
|
+
if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) {
|
|
45
|
+
const querySplitPos = maybeAbsolutePath.indexOf("?");
|
|
46
|
+
let resource = querySplitPos === -1
|
|
47
|
+
? maybeAbsolutePath
|
|
48
|
+
: maybeAbsolutePath.slice(0, querySplitPos);
|
|
49
|
+
resource = path.win32.relative(context, resource);
|
|
50
|
+
if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) {
|
|
51
|
+
resource = relativePathToRequest(resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, "/"));
|
|
52
|
+
}
|
|
53
|
+
return querySplitPos === -1
|
|
54
|
+
? resource
|
|
55
|
+
: resource + maybeAbsolutePath.slice(querySplitPos);
|
|
56
|
+
}
|
|
57
|
+
// not an absolute path
|
|
58
|
+
return maybeAbsolutePath;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* @param {string} context context for relative path
|
|
62
|
+
* @param {string} relativePath path
|
|
63
|
+
* @returns {string} absolute path
|
|
64
|
+
*/
|
|
65
|
+
const requestToAbsolute = (context, relativePath) => {
|
|
66
|
+
if (relativePath.startsWith("./") || relativePath.startsWith("../"))
|
|
67
|
+
return path.join(context, relativePath);
|
|
68
|
+
return relativePath;
|
|
69
|
+
};
|
|
70
|
+
const makeCacheable = realFn => {
|
|
71
|
+
/** @type {WeakMap<object, Map<string, ParsedResource>>} */
|
|
72
|
+
const cache = new WeakMap();
|
|
73
|
+
const getCache = associatedObjectForCache => {
|
|
74
|
+
const entry = cache.get(associatedObjectForCache);
|
|
75
|
+
if (entry !== undefined)
|
|
76
|
+
return entry;
|
|
77
|
+
/** @type {Map<string, ParsedResource>} */
|
|
78
|
+
const map = new Map();
|
|
79
|
+
cache.set(associatedObjectForCache, map);
|
|
80
|
+
return map;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* @param {string} str the path with query and fragment
|
|
84
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
85
|
+
* @returns {ParsedResource} parsed parts
|
|
86
|
+
*/
|
|
87
|
+
const fn = (str, associatedObjectForCache) => {
|
|
88
|
+
if (!associatedObjectForCache)
|
|
89
|
+
return realFn(str);
|
|
90
|
+
const cache = getCache(associatedObjectForCache);
|
|
91
|
+
const entry = cache.get(str);
|
|
92
|
+
if (entry !== undefined)
|
|
93
|
+
return entry;
|
|
94
|
+
const result = realFn(str);
|
|
95
|
+
cache.set(str, result);
|
|
96
|
+
return result;
|
|
97
|
+
};
|
|
98
|
+
fn.bindCache = associatedObjectForCache => {
|
|
99
|
+
const cache = getCache(associatedObjectForCache);
|
|
100
|
+
return str => {
|
|
101
|
+
const entry = cache.get(str);
|
|
102
|
+
if (entry !== undefined)
|
|
103
|
+
return entry;
|
|
104
|
+
const result = realFn(str);
|
|
105
|
+
cache.set(str, result);
|
|
106
|
+
return result;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
return fn;
|
|
110
|
+
};
|
|
111
|
+
const makeCacheableWithContext = fn => {
|
|
112
|
+
/** @type {WeakMap<object, Map<string, Map<string, string>>>} */
|
|
113
|
+
const cache = new WeakMap();
|
|
114
|
+
/**
|
|
115
|
+
* @param {string} context context used to create relative path
|
|
116
|
+
* @param {string} identifier identifier used to create relative path
|
|
117
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
118
|
+
* @returns {string} the returned relative path
|
|
119
|
+
*/
|
|
120
|
+
const cachedFn = (context, identifier, associatedObjectForCache) => {
|
|
121
|
+
if (!associatedObjectForCache)
|
|
122
|
+
return fn(context, identifier);
|
|
123
|
+
let innerCache = cache.get(associatedObjectForCache);
|
|
124
|
+
if (innerCache === undefined) {
|
|
125
|
+
innerCache = new Map();
|
|
126
|
+
cache.set(associatedObjectForCache, innerCache);
|
|
127
|
+
}
|
|
128
|
+
let cachedResult;
|
|
129
|
+
let innerSubCache = innerCache.get(context);
|
|
130
|
+
if (innerSubCache === undefined) {
|
|
131
|
+
innerCache.set(context, (innerSubCache = new Map()));
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
cachedResult = innerSubCache.get(identifier);
|
|
135
|
+
}
|
|
136
|
+
if (cachedResult !== undefined) {
|
|
137
|
+
return cachedResult;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
const result = fn(context, identifier);
|
|
141
|
+
innerSubCache.set(identifier, result);
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
147
|
+
* @returns {function(string, string): string} cached function
|
|
148
|
+
*/
|
|
149
|
+
cachedFn.bindCache = associatedObjectForCache => {
|
|
150
|
+
let innerCache;
|
|
151
|
+
if (associatedObjectForCache) {
|
|
152
|
+
innerCache = cache.get(associatedObjectForCache);
|
|
153
|
+
if (innerCache === undefined) {
|
|
154
|
+
innerCache = new Map();
|
|
155
|
+
cache.set(associatedObjectForCache, innerCache);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
innerCache = new Map();
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @param {string} context context used to create relative path
|
|
163
|
+
* @param {string} identifier identifier used to create relative path
|
|
164
|
+
* @returns {string} the returned relative path
|
|
165
|
+
*/
|
|
166
|
+
const boundFn = (context, identifier) => {
|
|
167
|
+
let cachedResult;
|
|
168
|
+
let innerSubCache = innerCache.get(context);
|
|
169
|
+
if (innerSubCache === undefined) {
|
|
170
|
+
innerCache.set(context, (innerSubCache = new Map()));
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
cachedResult = innerSubCache.get(identifier);
|
|
174
|
+
}
|
|
175
|
+
if (cachedResult !== undefined) {
|
|
176
|
+
return cachedResult;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
const result = fn(context, identifier);
|
|
180
|
+
innerSubCache.set(identifier, result);
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
return boundFn;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* @param {string} context context used to create relative path
|
|
188
|
+
* @param {Object=} associatedObjectForCache an object to which the cache will be attached
|
|
189
|
+
* @returns {function(string): string} cached function
|
|
190
|
+
*/
|
|
191
|
+
cachedFn.bindContextCache = (context, associatedObjectForCache) => {
|
|
192
|
+
let innerSubCache;
|
|
193
|
+
if (associatedObjectForCache) {
|
|
194
|
+
let innerCache = cache.get(associatedObjectForCache);
|
|
195
|
+
if (innerCache === undefined) {
|
|
196
|
+
innerCache = new Map();
|
|
197
|
+
cache.set(associatedObjectForCache, innerCache);
|
|
198
|
+
}
|
|
199
|
+
innerSubCache = innerCache.get(context);
|
|
200
|
+
if (innerSubCache === undefined) {
|
|
201
|
+
innerCache.set(context, (innerSubCache = new Map()));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
innerSubCache = new Map();
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* @param {string} identifier identifier used to create relative path
|
|
209
|
+
* @returns {string} the returned relative path
|
|
210
|
+
*/
|
|
211
|
+
const boundFn = identifier => {
|
|
212
|
+
const cachedResult = innerSubCache.get(identifier);
|
|
213
|
+
if (cachedResult !== undefined) {
|
|
214
|
+
return cachedResult;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
const result = fn(context, identifier);
|
|
218
|
+
innerSubCache.set(identifier, result);
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
return boundFn;
|
|
223
|
+
};
|
|
224
|
+
return cachedFn;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
*
|
|
228
|
+
* @param {string} context context for relative path
|
|
229
|
+
* @param {string} identifier identifier for path
|
|
230
|
+
* @returns {string} a converted relative path
|
|
231
|
+
*/
|
|
232
|
+
const _makePathsRelative = (context, identifier) => {
|
|
233
|
+
return identifier
|
|
234
|
+
.split(SEGMENTS_SPLIT_REGEXP)
|
|
235
|
+
.map(str => absoluteToRequest(context, str))
|
|
236
|
+
.join("");
|
|
237
|
+
};
|
|
238
|
+
exports.makePathsRelative = makeCacheableWithContext(_makePathsRelative);
|
|
239
|
+
/**
|
|
240
|
+
*
|
|
241
|
+
* @param {string} context context for relative path
|
|
242
|
+
* @param {string} identifier identifier for path
|
|
243
|
+
* @returns {string} a converted relative path
|
|
244
|
+
*/
|
|
245
|
+
const _makePathsAbsolute = (context, identifier) => {
|
|
246
|
+
return identifier
|
|
247
|
+
.split(SEGMENTS_SPLIT_REGEXP)
|
|
248
|
+
.map(str => requestToAbsolute(context, str))
|
|
249
|
+
.join("");
|
|
250
|
+
};
|
|
251
|
+
exports.makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute);
|
|
252
|
+
/**
|
|
253
|
+
* @param {string} context absolute context path
|
|
254
|
+
* @param {string} request any request string may containing absolute paths, query string, etc.
|
|
255
|
+
* @returns {string} a new request string avoiding absolute paths when possible
|
|
256
|
+
*/
|
|
257
|
+
const _contextify = (context, request) => {
|
|
258
|
+
return request
|
|
259
|
+
.split("!")
|
|
260
|
+
.map(r => absoluteToRequest(context, r))
|
|
261
|
+
.join("!");
|
|
262
|
+
};
|
|
263
|
+
const contextify = makeCacheableWithContext(_contextify);
|
|
264
|
+
exports.contextify = contextify;
|
|
265
|
+
/**
|
|
266
|
+
* @param {string} context absolute context path
|
|
267
|
+
* @param {string} request any request string
|
|
268
|
+
* @returns {string} a new request string using absolute paths when possible
|
|
269
|
+
*/
|
|
270
|
+
const _absolutify = (context, request) => {
|
|
271
|
+
return request
|
|
272
|
+
.split("!")
|
|
273
|
+
.map(r => requestToAbsolute(context, r))
|
|
274
|
+
.join("!");
|
|
275
|
+
};
|
|
276
|
+
const absolutify = makeCacheableWithContext(_absolutify);
|
|
277
|
+
exports.absolutify = absolutify;
|
|
278
|
+
const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/;
|
|
279
|
+
const PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/;
|
|
280
|
+
/** @typedef {{ resource: string, path: string, query: string, fragment: string }} ParsedResource */
|
|
281
|
+
/** @typedef {{ resource: string, path: string, query: string }} ParsedResourceWithoutFragment */
|
|
282
|
+
/**
|
|
283
|
+
* @param {string} str the path with query and fragment
|
|
284
|
+
* @returns {ParsedResource} parsed parts
|
|
285
|
+
*/
|
|
286
|
+
const _parseResource = str => {
|
|
287
|
+
const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
|
|
288
|
+
return {
|
|
289
|
+
resource: str,
|
|
290
|
+
path: match[1].replace(/\0(.)/g, "$1"),
|
|
291
|
+
query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "",
|
|
292
|
+
fragment: match[3] || ""
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
exports.parseResource = makeCacheable(_parseResource);
|
|
296
|
+
/**
|
|
297
|
+
* Parse resource, skips fragment part
|
|
298
|
+
* @param {string} str the path with query and fragment
|
|
299
|
+
* @returns {ParsedResourceWithoutFragment} parsed parts
|
|
300
|
+
*/
|
|
301
|
+
const _parseResourceWithoutFragment = str => {
|
|
302
|
+
const match = PATH_QUERY_REGEXP.exec(str);
|
|
303
|
+
return {
|
|
304
|
+
resource: str,
|
|
305
|
+
path: match[1].replace(/\0(.)/g, "$1"),
|
|
306
|
+
query: match[2] ? match[2].replace(/\0(.)/g, "$1") : ""
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
exports.parseResourceWithoutFragment = makeCacheable(_parseResourceWithoutFragment);
|
|
310
|
+
/**
|
|
311
|
+
* @param {string} filename the filename which should be undone
|
|
312
|
+
* @param {string} outputPath the output path that is restored (only relevant when filename contains "..")
|
|
313
|
+
* @param {boolean} enforceRelative true returns ./ for empty paths
|
|
314
|
+
* @returns {string} repeated ../ to leave the directory of the provided filename to be back on output dir
|
|
315
|
+
*/
|
|
316
|
+
exports.getUndoPath = (filename, outputPath, enforceRelative) => {
|
|
317
|
+
let depth = -1;
|
|
318
|
+
let append = "";
|
|
319
|
+
outputPath = outputPath.replace(/[\\/]$/, "");
|
|
320
|
+
for (const part of filename.split(/[/\\]+/)) {
|
|
321
|
+
if (part === "..") {
|
|
322
|
+
if (depth > -1) {
|
|
323
|
+
depth--;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
const i = outputPath.lastIndexOf("/");
|
|
327
|
+
const j = outputPath.lastIndexOf("\\");
|
|
328
|
+
const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
|
|
329
|
+
if (pos < 0)
|
|
330
|
+
return outputPath + "/";
|
|
331
|
+
append = outputPath.slice(pos + 1) + "/" + append;
|
|
332
|
+
outputPath = outputPath.slice(0, pos);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
else if (part !== ".") {
|
|
336
|
+
depth++;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return depth > 0
|
|
340
|
+
? `${"../".repeat(depth)}${append}`
|
|
341
|
+
: enforceRelative
|
|
342
|
+
? `./${append}`
|
|
343
|
+
: append;
|
|
344
|
+
};
|
|
345
|
+
//# sourceMappingURL=identifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../src/util/identifier.js"],"names":[],"mappings":"AAAA;;EAEE;AAEF,YAAY,CAAC;AAEb,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM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C;gBACtC,MAAM,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBACvC,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACnD,IAAI,GAAG,GAAG,CAAC;oBAAE,OAAO,UAAU,GAAG,GAAG,CAAC;gBACrC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC;gBAClD,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;aACtC;SACD;aAAM,IAAI,IAAI,KAAK,GAAG,EAAE;YACxB,KAAK,EAAE,CAAC;SACR;KACD;IACD,OAAO,KAAK,GAAG,CAAC;QACf,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE;QACnC,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,KAAK,MAAM,EAAE;YACf,CAAC,CAAC,MAAM,CAAC;AACX,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function mapValues(record: Record<string, string>, fn: (key: string) => string): {
|
|
2
|
+
[k: string]: string;
|
|
3
|
+
};
|
|
4
|
+
export declare function isNil(value: unknown): value is null | undefined;
|
|
5
|
+
export declare function isPromiseLike(value: unknown): value is Promise<any>;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM;;EAK3B;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,SAAS,CAE/D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,CAMnE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPromiseLike = exports.isNil = exports.mapValues = void 0;
|
|
4
|
+
function mapValues(record, fn) {
|
|
5
|
+
return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, fn(value)]));
|
|
6
|
+
}
|
|
7
|
+
exports.mapValues = mapValues;
|
|
8
|
+
function isNil(value) {
|
|
9
|
+
return value === null || value === undefined;
|
|
10
|
+
}
|
|
11
|
+
exports.isNil = isNil;
|
|
12
|
+
function isPromiseLike(value) {
|
|
13
|
+
return (typeof value === "object" &&
|
|
14
|
+
value !== null &&
|
|
15
|
+
typeof value.then === "function");
|
|
16
|
+
}
|
|
17
|
+
exports.isPromiseLike = isPromiseLike;
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;AAAA,SAAgB,SAAS,CACxB,MAA8B,EAC9B,EAA2B;IAE3B,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAC9D,CAAC;AACH,CAAC;AAPD,8BAOC;AAED,SAAgB,KAAK,CAAC,KAAc;IACnC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC9C,CAAC;AAFD,sBAEC;AAED,SAAgB,aAAa,CAAC,KAAc;IAC3C,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAAa,CAAC,IAAI,KAAK,UAAU,CACzC,CAAC;AACH,CAAC;AAND,sCAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["../../src/util/memoize.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,6BAenB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.memoize = void 0;
|
|
4
|
+
const memoize = (fn) => {
|
|
5
|
+
let cache = false;
|
|
6
|
+
let result = undefined;
|
|
7
|
+
return () => {
|
|
8
|
+
if (cache) {
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
result = fn();
|
|
13
|
+
cache = true;
|
|
14
|
+
// Allow to clean up memory for fn
|
|
15
|
+
// and all dependent resources
|
|
16
|
+
fn = undefined;
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.memoize = memoize;
|
|
22
|
+
//# sourceMappingURL=memoize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoize.js","sourceRoot":"","sources":["../../src/util/memoize.ts"],"names":[],"mappings":";;;AAAO,MAAM,OAAO,GAAG,CAAI,EAAW,EAAa,EAAE;IACpD,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,MAAM,GAAG,SAAS,CAAC;IACvB,OAAO,GAAG,EAAE;QACX,IAAI,KAAK,EAAE;YACV,OAAO,MAAM,CAAC;SACd;aAAM;YACN,MAAM,GAAG,EAAE,EAAE,CAAC;YACd,KAAK,GAAG,IAAI,CAAC;YACb,kCAAkC;YAClC,8BAA8B;YAC9B,EAAE,GAAG,SAAS,CAAC;YACf,OAAO,MAAM,CAAC;SACd;IACF,CAAC,CAAC;AACH,CAAC,CAAC;AAfW,QAAA,OAAO,WAelB"}
|
package/package.json
CHANGED
|
@@ -1,44 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"devDependencies": {
|
|
10
|
+
"@rspack/core": "0.0.16",
|
|
11
|
+
"@rspack/less-loader": "^0.0.16",
|
|
12
|
+
"@rspack/plugin-node-polyfill": "^0.0.16",
|
|
13
|
+
"@rspack/postcss-loader": "^0.0.16",
|
|
14
|
+
"@rspack/plugin-minify": "^0.0.16",
|
|
10
15
|
"@swc/helpers": "^0.4.12",
|
|
11
16
|
"@types/jest": "29.0.2",
|
|
12
17
|
"@types/node": "^18.6.3",
|
|
18
|
+
"@types/rimraf": "3.0.2",
|
|
13
19
|
"@types/sinon": "10.0.13",
|
|
14
20
|
"@types/webpack-sources": "3.2.0",
|
|
15
21
|
"@types/ws": "8.5.3",
|
|
22
|
+
"babel-loader": "^9.1.0",
|
|
23
|
+
"babel-plugin-import": "^1.13.5",
|
|
24
|
+
"file-loader": "^6.2.0",
|
|
16
25
|
"jest-serializer-path": "^0.1.15",
|
|
26
|
+
"less": "4.1.3",
|
|
27
|
+
"less-loader": "^11.1.0",
|
|
28
|
+
"postcss-loader": "^7.0.2",
|
|
29
|
+
"postcss-pxtorem": "^6.0.0",
|
|
30
|
+
"rimraf": "3.0.2",
|
|
31
|
+
"sass": "^1.56.2",
|
|
32
|
+
"sass-loader": "^13.2.0",
|
|
17
33
|
"sinon": "14.0.0",
|
|
18
34
|
"source-map": "^0.7.4",
|
|
19
35
|
"ts-node": "10.9.1",
|
|
20
36
|
"tsm": "^2.2.2",
|
|
21
37
|
"typescript": "4.7.3",
|
|
22
|
-
"uvu": "0.5.6",
|
|
23
38
|
"util": "0.12.5",
|
|
24
|
-
"
|
|
25
|
-
"@types/rimraf": "3.0.2",
|
|
26
|
-
"@rspack/core": "0.0.15",
|
|
27
|
-
"@rspack/less-loader": "^0.0.15",
|
|
28
|
-
"@rspack/postcss-loader": "^0.0.15",
|
|
29
|
-
"@rspack/plugin-node-polyfill": "^0.0.15"
|
|
39
|
+
"uvu": "0.5.6"
|
|
30
40
|
},
|
|
31
41
|
"dependencies": {
|
|
42
|
+
"@rspack/binding": "0.0.16",
|
|
43
|
+
"@rspack/dev-client": "0.0.16",
|
|
44
|
+
"@swc/helpers": "0.4.13",
|
|
32
45
|
"browserslist": "^4.21.3",
|
|
33
46
|
"chokidar": "3.5.3",
|
|
34
|
-
"
|
|
35
|
-
"webpack-sources": "3.2.3",
|
|
47
|
+
"enhanced-resolve": "5.10.0",
|
|
36
48
|
"graceful-fs": "4.2.10",
|
|
37
49
|
"neo-async": "2.6.2",
|
|
38
50
|
"react-refresh": "0.14.0",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
51
|
+
"schema-utils": "^4.0.0",
|
|
52
|
+
"tapable": "2.2.1",
|
|
53
|
+
"webpack-sources": "3.2.3"
|
|
42
54
|
},
|
|
43
55
|
"optionalDependencies": {
|
|
44
56
|
"@tmp-sass-embedded/darwin-arm64": "1.54.4",
|
package/dist/bundle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(){var e,r,n,t,o,i,c,d,a,u={847:function(e,r,n){"use strict";e.exports=function(){return"This is a"}}},s={};function l(e){var r=s[e];if(void 0!==r)return r.exports;var n=s[e]={exports:{}},t={id:e,module:n,factory:u[e],require:l};return l.i.forEach(function(e){e(t)}),n=t.module,t.factory.call(n.exports,n,n.exports,t.require),n.exports}l.m=u,l.c=s,l.i=[],!function(){var e,r,n,t={},o=l.c,i=[],c=[],d="idle",a=0,u=[];l.hmrD=t,l.i.push(function(u){var v=u.module,m=function(r,n){var t=o[n];if(!t)return r;var c=function(c){if(t.hot.active){if(o[c]){var d=o[c].parents;-1===d.indexOf(n)&&d.push(n)}else i=[n],e=c;-1===t.children.indexOf(c)&&t.children.push(c)}else console.log("[HMR] unexpected require("+c+") from disposed module "+n),i=[];return r(c)},u=function(e){return{configurable:!0,enumerable:!0,get:function(){return r[e]},set:function(n){r[e]=n}}};for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&"e"!==l&&Object.defineProperty(c,l,u(l));return c.e=function(e){return function(e){switch(d){case"ready":s("prepare");case"prepare":return a++,e.then(f,f),e;default:return e}}(r.e(e))},c}(u.require,u.id);v.hot=function(o,a){var u=e!==o,f={_acceptedDependencies:{},_acceptedErrorHandlers:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_selfInvalidated:!1,_disposeHandlers:[],_main:u,_requireSelf:function(){i=a.parents.slice(),e=u?void 0:o,l(o)},active:!0,accept:function(e,r,n){if(void 0===e)f._selfAccepted=!0;else if("function"==typeof e)f._selfAccepted=e;else if("object"==typeof e&&null!==e)for(var t=0;t<e.length;t++)f._acceptedDependencies[e[t]]=r||function(){},f._acceptedErrorHandlers[e[t]]=n;else f._acceptedDependencies[e]=r||function(){},f._acceptedErrorHandlers[e]=n},decline:function(e){if(void 0===e)f._selfDeclined=!0;else if("object"==typeof e&&null!==e)for(var r=0;r<e.length;r++)f._declinedDependencies[e[r]]=!0;else f._declinedDependencies[e]=!0},dispose:function(e){f._disposeHandlers.push(e)},addDisposeHandler:function(e){f._disposeHandlers.push(e)},removeDisposeHandler:function(e){var r=f._disposeHandlers.indexOf(e);r>0&&f._disposeHandlers.splice(r,1)},invalidate:function(){switch(this._selfInvalidated=!0,d){case"idle":r=[],Object.keys(l.hmrI).forEach(function(e){l.hmrI[e](o,r)}),s("ready");break;case"ready":Object.keys(l.hmrI).forEach(function(e){l.hmrI[e](o,r)});break;case"prepare":case"check":case"dispose":case"apply":(n=n||[]).push(o)}},check:p,apply:h,status:function(e){if(!e)return d;c.push(e)},addStatusHandler:function(e){c.push(e)},removeStatusHandler:function(e){var r=c.indexOf(e);r>=0&&c.splice(r,1)},data:t[o]};return e=void 0,f}(u.id,v),v.parents=i,v.children=[],i=[],u.require=m}),l.hmrC={},l.hmrI={};function s(e){d=e;for(var r=[],n=0;n<c.length;n++)r[n]=c[n].call(null,e);return Promise.all(r)}function f(){0==--a&&s("ready").then(function(){if(0===a){var e=u;u=[];for(var r=0;r<e.length;r++)e[r]()}})}function p(e){if("idle"!==d)throw Error("check() is only allowed in idle status");return s("check").then(l.hmrM).then(function(n){return n?s("prepare").then(function(){var t=[];return r=[],Promise.all(Object.keys(l.hmrC).reduce(function(e,o){return l.hmrC[o](n.c,n.r,n.m,e,r,t),e},[])).then(function(){var r;return r=function(){return e?v(e):s("ready").then(function(){return t})},0===a?r():new Promise(function(e){u.push(function(){e(r())})})})}):s(m()?"ready":"idle").then(function(){return null})})}function h(e){return"ready"!==d?Promise.resolve().then(function(){throw Error("apply() is only allowed in ready status (state: "+d+")")}):v(e)}function v(e){e=e||{},m();var t,o=r.map(function(r){return r(e)});r=void 0;var i=o.map(function(e){return e.error}).filter(Boolean);if(i.length>0)return s("abort").then(function(){throw i[0]});var c=s("dispose");o.forEach(function(e){e.dispose&&e.dispose()});var d=s("apply"),a=function(e){!t&&(t=e)},u=[];return o.forEach(function(e){if(e.apply){var r=e.apply(a);if(r)for(var n=0;n<r.length;n++)u.push(r[n])}}),Promise.all([c,d]).then(function(){return t?s("fail").then(function(){throw t}):n?v(e).then(function(e){return u.forEach(function(r){0>e.indexOf(r)&&e.push(r)}),e}):s("idle").then(function(){return u})})}function m(){if(n)return!r&&(r=[]),Object.keys(l.hmrI).forEach(function(e){n.forEach(function(n){l.hmrI[e](n,r)})}),n=void 0,!0}}(),e="webpack",r="data-webpack-loading",n=(n,t,o,i)=>{var c,d,a="chunk-"+n;if(!i){for(var u=document.getElementsByTagName("link"),s=0;s<u.length;s++){var l=u[s];if("stylesheet"==l.rel&&(l.href.startsWith(t)||l.getAttribute("href").startsWith(t)||l.getAttribute("data-webpack")==e+":"+a)){c=l;break}}if(!o)return c}!c&&(d=!0,(c=document.createElement("link")).setAttribute("data-webpack",e+":"+a),c.setAttribute(r,1),c.rel="stylesheet",c.href=t);var f=(e,n)=>{if(c.onerror=c.onload=null,c.removeAttribute(r),clearTimeout(p),n&&"load"!=n.type&&c.parentNode.removeChild(c),o(n),e)return e(n)};if(c.getAttribute(r)){var p=setTimeout(f.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload)}else f(void 0,{type:"load",target:c});return i?document.head.insertBefore(c,i):d&&document.head.appendChild(c),c},t=[],o=[],i=function(e){return{dispose:function(){},apply:function(){for(o.forEach(function(e){e[1].sheet.disabled=!1});t.length;){var e=t.pop();e.parentNode&&e.parentNode.removeChild(e)}for(;o.length;)o.pop();return[]}}},c=function(e){return Array.from(e.sheet.cssRules,function(e){return e.cssText.join()})},l.hmrC.css=function(e,r,d,a,u,s){u.push(i),e.forEach(function(e){var r=l.k(e),i=l.p+r,d=n(e,i);d&&a.push(new Promise(function(r,a){var u=n(e,i+(0>i.indexOf("?")?"?":"&")+"hmr="+Date.now(),function(n){if("load"!==n.type){var l=n&&n.type,f=n&&n.target&&n.target.src;error.message="Loading css hot update chunk "+e+" failed.\n("+l+": "+f+")",error.name="ChunkLoadError",error.type=l,error.request=f,a(error)}else{try{if(c(d)==c(u))return u.parentNode&&u.parentNode.removeChild(u),r()}catch(p){}s.push(i),u.sheet.disabled=!0,t.push(d),o.push([e,u]),r()}},d)}))})},!function(){var e,r,n,t,o,i={main:0},c={};function d(r,n){return e=n,new Promise(function(e,n){var t=l.p+l.hu(r);c[r]=e;var o=Error();l.l(t,function(e){if(c[r]){c[r]=void 0;var t=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;o.message="Loading hot update chunk "+r+" failed.\n("+t+": "+i+")",o.name="ChunkLoadError",o.type=t,o.request=i,n(o)}})})}function a(e){l.f&&delete l.f.jsonpHmr,r=void 0;function c(e,r){for(var n=0;n<r.length;n++){var t=r[n];-1===e.indexOf(t)&&e.push(t)}}var d,a={},u=[],s={},f=function(e){console.warn("[HMR] unexpected require("+e.id+") to disposed module")};for(var p in n)if(l.o(n,p)){var h,v=n[p];h=v?function(e){for(var r=[e],n={},t=r.map(function(e){return{chain:[e],id:e}});t.length>0;){var o=t.pop(),i=o.id,d=o.chain,a=l.c[i];if(!!a&&(!a.hot._selfAccepted||!!a.hot._selfInvalidated)){if(a.hot._selfDeclined)return{type:"self-declined",chain:d,moduleId:i};if(a.hot._main)return{type:"unaccepted",chain:d,moduleId:i};for(var u=0;u<a.parents.length;u++){var s=a.parents[u],f=l.c[s];if(!f)continue;if(f.hot._declinedDependencies[i])return{type:"declined",chain:d.concat([s]),moduleId:i,parentId:s};if(-1===r.indexOf(s)){if(f.hot._acceptedDependencies[i]){!n[s]&&(n[s]=[]),c(n[s],[i]);continue}delete n[s],r.push(s),t.push({chain:d.concat([s]),id:s})}}}}return{type:"accepted",moduleId:e,outdatedModules:r,outdatedDependencies:n}}(p):{type:"disposed",moduleId:p};var m=!1,y=!1,g=!1,b="";switch(h.chain&&(b="\nUpdate propagation: "+h.chain.join(" -> ")),h.type){case"self-declined":e.onDeclined&&e.onDeclined(h),!e.ignoreDeclined&&(m=Error("Aborted because of self decline: "+h.moduleId+b));break;case"declined":e.onDeclined&&e.onDeclined(h),!e.ignoreDeclined&&(m=Error("Aborted because of declined dependency: "+h.moduleId+" in "+h.parentId+b));break;case"unaccepted":e.onUnaccepted&&e.onUnaccepted(h),!e.ignoreUnaccepted&&(m=Error("Aborted because "+p+" is not accepted"+b));break;case"accepted":e.onAccepted&&e.onAccepted(h),y=!0;break;case"disposed":e.onDisposed&&e.onDisposed(h),g=!0;break;default:throw Error("Unexception type "+h.type)}if(m)return{error:m};if(y)for(p in s[p]=v,c(u,h.outdatedModules),h.outdatedDependencies)l.o(h.outdatedDependencies,p)&&(!a[p]&&(a[p]=[]),c(a[p],h.outdatedDependencies[p]));g&&(c(u,[h.moduleId]),s[p]=f)}n=void 0;for(var E=[],_=0;_<u.length;_++){var k=u[_],I=l.c[k];I&&(I.hot._selfAccepted||I.hot._main)&&s[k]!==f&&!I.hot._selfInvalidated&&E.push({module:k,require:I.hot._requireSelf,errorHandler:I.hot._selfAccepted})}return{dispose:function(){t.forEach(function(e){delete i[e]}),t=void 0;for(var e,r,n=u.slice();n.length>0;){var o=n.pop(),c=l.c[o];if(!!c){var s={},f=c.hot._disposeHandlers;for(_=0;_<f.length;_++)f[_].call(null,s);for(l.hmrD[o]=s,c.hot.active=!1,delete l.c[o],delete a[o],_=0;_<c.children.length;_++){var p=l.c[c.children[_]];p&&(e=p.parents.indexOf(o))>=0&&p.parents.splice(e,1)}}}for(var h in a)if(l.o(a,h)&&(c=l.c[h]))for(_=0,d=a[h];_<d.length;_++)r=d[_],(e=c.children.indexOf(r))>=0&&c.children.splice(e,1)},apply:function(r){for(var n in s)l.o(s,n)&&(l.m[n]=s[n]);for(var t=0;t<o.length;t++)o[t](l);for(var i in a)if(l.o(a,i)){var c=l.c[i];if(c){d=a[i];for(var f=[],p=[],h=[],v=0;v<d.length;v++){var m=d[v],y=c.hot._acceptedDependencies[m],g=c.hot._acceptedErrorHandlers[m];if(y){if(-1!==f.indexOf(y))continue;f.push(y),p.push(g),h.push(m)}}for(var b=0;b<f.length;b++)try{f[b].call(null,d)}catch(k){if("function"==typeof p[b])try{p[b](k,{moduleId:i,dependencyId:h[b]})}catch(_){e.onErrored&&e.onErrored({type:"accept-error-handler-errored",moduleId:i,dependencyId:h[b],error:_,originalError:k}),!e.ignoreErrored&&(r(_),r(k))}else e.onErrored&&e.onErrored({type:"accept-errored",moduleId:i,dependencyId:h[b],error:k}),!e.ignoreErrored&&r(k)}}}for(var I=0;I<E.length;I++){var D=E[I],w=D.module;try{D.require(w)}catch(A){if("function"==typeof D.errorHandler)try{D.errorHandler(A,{moduleId:w,module:l.c[w]})}catch(x){e.onErrored&&e.onErrored({type:"self-accept-error-handler-errored",moduleId:w,error:x,originalError:A}),!e.ignoreErrored&&(r(x),r(A))}else e.onErrored&&e.onErrored({type:"self-accept-errored",moduleId:w,error:A}),!e.ignoreErrored&&r(A)}}return u}}}self.hotUpdate=function(r,t,i){for(var d in t)l.o(t,d)&&(n[d]=t[d],e&&e.push(d));i&&o.push(i),c[r]&&(c[r](),c[r]=void 0)},l.hmrI.jsonp=function(e,r){!n&&(n={},o=[],t=[],r.push(a)),!l.o(n,e)&&(n[e]=l.m[e])},l.hmrC.jsonp=function(e,c,u,s,f,p){f.push(a),r={},t=c,n=u.reduce(function(e,r){return e[r]=!1,e},{}),o=[],e.forEach(function(e){l.o(i,e)&&void 0!==i[e]?(s.push(d(e,p)),r[e]=!0):r[e]=!1}),l.f&&(l.f.jsonpHmr=function(e,n){r&&l.o(r,e)&&!r[e]&&(n.push(d(e)),r[e]=!0)})},l.hmrM=function(){if("undefined"==typeof fetch)throw Error("No browser support: need fetch API");return fetch(l.p+l.hmrF()).then(function(e){if(404!==e.status){if(!e.ok)throw Error("Failed to fetch update manifest "+e.statusText);return e.json()}})}}(),l.hmrF=function(){return"main.hot-update.json"},l.hu=function(e){return""+e+".hot-update.js"},l.k=function(e){return""+e+".css"},d={},a="webpack:",l.l=function(e,r,n,t){if(void 0!==n){for(var o,i,c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var s=c[u];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==a+n){o=s;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,o.setAttribute("data-webpack",a+n),o.src=e),d[e]=[r];var l=function(r,n){o.onerror=o.onload=null,clearTimeout(f);var t=d[e];if(delete d[e],o.parentNode&&o.parentNode.removeChild(o),t&&t.forEach(function(e){return e(n)}),r)return r(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l("847")}();
|
package/dist/dd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports="This is dd";
|
package/dist/dynamic_js.xxxx.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunkwebpack=self.webpackChunkwebpack||[]).push([["dynamic_js"],{426:function(e,n,c){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"value",{enumerable:!0,get:function(){return t}});let t="dynamic"}}]);
|
package/dist/main.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports="I'm the right main.js";
|
package/dist/main.xxxx.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(){var e={10:function(e,n,r){"use strict";r.e(["dynamic_js"]).then(r.bind(r,"426")).then(console.log)}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var c=n[t]={exports:{}},o={id:t,module:c,factory:e[t],require:r};return r.i.forEach(function(e){e(o)}),c=o.module,o.factory.call(c.exports,c,c.exports,o.require),c.exports}r.c=n,r.i=[],r.f={},r.e=function(e){return Promise.all(Object.keys(r.f).reduce(function(n,t){return r.f[t](e,n),n},[]))},!function(){var e,n,t,i={},c=r.c,o=[],u=[],a="idle",f=0,s=[];r.hmrD=i,r.i.push(function(s){var v=s.module,m=function(n,r){var t=c[r];if(!t)return n;var i=function(i){if(t.hot.active){if(c[i]){var u=c[i].parents;-1===u.indexOf(r)&&u.push(r)}else o=[r],e=i;-1===t.children.indexOf(i)&&t.children.push(i)}else console.log("[HMR] unexpected require("+i+") from disposed module "+r),o=[];return n(i)},u=function(e){return{configurable:!0,enumerable:!0,get:function(){return n[e]},set:function(r){n[e]=r}}};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&"e"!==s&&Object.defineProperty(i,s,u(s));return i.e=function(e){return function(e){switch(a){case"ready":d("prepare");case"prepare":return f++,e.then(l,l),e;default:return e}}(n.e(e))},i}(s.require,s.id);v.hot=function(c,f){var s=e!==c,l={_acceptedDependencies:{},_acceptedErrorHandlers:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_selfInvalidated:!1,_disposeHandlers:[],_main:s,_requireSelf:function(){o=f.parents.slice(),e=s?void 0:c,r(c)},active:!0,accept:function(e,n,r){if(void 0===e)l._selfAccepted=!0;else if("function"==typeof e)l._selfAccepted=e;else if("object"==typeof e&&null!==e)for(var t=0;t<e.length;t++)l._acceptedDependencies[e[t]]=n||function(){},l._acceptedErrorHandlers[e[t]]=r;else l._acceptedDependencies[e]=n||function(){},l._acceptedErrorHandlers[e]=r},decline:function(e){if(void 0===e)l._selfDeclined=!0;else if("object"==typeof e&&null!==e)for(var n=0;n<e.length;n++)l._declinedDependencies[e[n]]=!0;else l._declinedDependencies[e]=!0},dispose:function(e){l._disposeHandlers.push(e)},addDisposeHandler:function(e){l._disposeHandlers.push(e)},removeDisposeHandler:function(e){var n=l._disposeHandlers.indexOf(e);n>0&&l._disposeHandlers.splice(n,1)},invalidate:function(){switch(this._selfInvalidated=!0,a){case"idle":n=[],Object.keys(r.hmrI).forEach(function(e){r.hmrI[e](c,n)}),d("ready");break;case"ready":Object.keys(r.hmrI).forEach(function(e){r.hmrI[e](c,n)});break;case"prepare":case"check":case"dispose":case"apply":(t=t||[]).push(c)}},check:p,apply:h,status:function(e){if(!e)return a;u.push(e)},addStatusHandler:function(e){u.push(e)},removeStatusHandler:function(e){var n=u.indexOf(e);n>=0&&u.splice(n,1)},data:i[c]};return e=void 0,l}(s.id,v),v.parents=o,v.children=[],o=[],s.require=m}),r.hmrC={},r.hmrI={};function d(e){a=e;for(var n=[],r=0;r<u.length;r++)n[r]=u[r].call(null,e);return Promise.all(n)}function l(){0==--f&&d("ready").then(function(){if(0===f){var e=s;s=[];for(var n=0;n<e.length;n++)e[n]()}})}function p(e){if("idle"!==a)throw Error("check() is only allowed in idle status");return d("check").then(r.hmrM).then(function(t){return t?d("prepare").then(function(){var i=[];return n=[],Promise.all(Object.keys(r.hmrC).reduce(function(e,c){return r.hmrC[c](t.c,t.r,t.m,e,n,i),e},[])).then(function(){var n;return n=function(){return e?v(e):d("ready").then(function(){return i})},0===f?n():new Promise(function(e){s.push(function(){e(n())})})})}):d(m()?"ready":"idle").then(function(){return null})})}function h(e){return"ready"!==a?Promise.resolve().then(function(){throw Error("apply() is only allowed in ready status (state: "+a+")")}):v(e)}function v(e){e=e||{},m();var r,i=n.map(function(n){return n(e)});n=void 0;var c=i.map(function(e){return e.error}).filter(Boolean);if(c.length>0)return d("abort").then(function(){throw c[0]});var o=d("dispose");i.forEach(function(e){e.dispose&&e.dispose()});var u=d("apply"),a=function(e){!r&&(r=e)},f=[];return i.forEach(function(e){if(e.apply){var n=e.apply(a);if(n)for(var r=0;r<n.length;r++)f.push(n[r])}}),Promise.all([o,u]).then(function(){return r?d("fail").then(function(){throw r}):t?v(e).then(function(e){return f.forEach(function(n){0>e.indexOf(n)&&e.push(n)}),e}):d("idle").then(function(){return f})})}function m(){if(t)return!n&&(n=[]),Object.keys(r.hmrI).forEach(function(e){t.forEach(function(t){r.hmrI[e](t,n)})}),t=void 0,!0}}(),r("10")}();
|