@rspack/core 1.0.0-beta.2 → 1.0.0-beta.3
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/Compilation.d.ts +20 -1
- package/dist/Compilation.js +109 -44
- package/dist/Compiler.d.ts +1 -0
- package/dist/Compiler.js +29 -24
- package/dist/MultiCompiler.js +10 -6
- package/dist/MultiStats.d.ts +1 -1
- package/dist/MultiStats.js +19 -16
- package/dist/NormalModule.js +3 -4
- package/dist/Stats.d.ts +1 -1
- package/dist/Template.d.ts +4 -4
- package/dist/Template.js +6 -4
- package/dist/Watching.js +3 -5
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +11 -10
- package/dist/builtin-plugin/DynamicEntryPlugin.js +26 -15
- package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +21 -4
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +29 -5
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +4 -6
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +16 -10
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +11 -9
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +10 -6
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +2 -2
- package/dist/builtin-plugin/css-extract/loader.js +1 -2
- package/dist/config/adapter.d.ts +2 -2
- package/dist/config/zod.d.ts +338 -62
- package/dist/config/zod.js +8 -5
- package/dist/exports.d.ts +4 -3
- package/dist/exports.js +5 -2
- package/dist/lib/Cache.js +6 -4
- package/dist/lib/CacheFacade.js +8 -9
- package/dist/lib/LoaderOptionsPlugin.d.ts +4 -2
- package/dist/lib/LoaderOptionsPlugin.js +0 -2
- package/dist/lib/cache/mergeEtags.d.ts +3 -3
- package/dist/lib/cache/mergeEtags.js +5 -3
- package/dist/loader-runner/index.js +4 -2
- package/dist/node/nodeConsole.js +5 -5
- package/dist/stats/DefaultStatsPresetPlugin.js +1 -3
- package/dist/stats/StatsFactory.js +3 -4
- package/dist/stats/StatsPrinter.js +3 -4
- package/dist/stats/statsFactoryUtils.d.ts +106 -19
- package/dist/util/assertNotNil.d.ts +1 -1
- package/dist/util/assetCondition.d.ts +2 -0
- package/dist/util/assetCondition.js +2 -0
- package/dist/util/cleverMerge.js +5 -4
- package/dist/util/createHash.js +10 -5
- package/dist/util/hash/wasm-hash.js +5 -4
- package/dist/util/identifier.d.ts +4 -4
- package/dist/util/identifier.js +10 -10
- package/dist/util/memoize.js +3 -2
- package/package.json +3 -3
- package/dist/builtin-plugin/css-extract/loader-options.json +0 -37
- package/dist/builtin-plugin/css-extract/plugin-options.json +0 -79
package/dist/config/zod.js
CHANGED
|
@@ -114,7 +114,10 @@ const entryDescription = zod_1.z.strictObject({
|
|
|
114
114
|
const entryUnnamed = entryItem;
|
|
115
115
|
const entryObject = zod_1.z.record(entryItem.or(entryDescription));
|
|
116
116
|
const entryStatic = entryObject.or(entryUnnamed);
|
|
117
|
-
const
|
|
117
|
+
const entryDynamic = zod_1.z
|
|
118
|
+
.function()
|
|
119
|
+
.returns(entryStatic.or(zod_1.z.promise(entryStatic)));
|
|
120
|
+
const entry = entryStatic.or(entryDynamic);
|
|
118
121
|
//#endregion
|
|
119
122
|
//#region Output
|
|
120
123
|
const path = zod_1.z.string();
|
|
@@ -467,8 +470,7 @@ const allowTarget = zod_1.z.union([
|
|
|
467
470
|
"es2019",
|
|
468
471
|
"es2020",
|
|
469
472
|
"es2021",
|
|
470
|
-
"es2022"
|
|
471
|
-
"browserslist"
|
|
473
|
+
"es2022"
|
|
472
474
|
]),
|
|
473
475
|
zod_1.z.literal("node"),
|
|
474
476
|
zod_1.z.literal("async-node"),
|
|
@@ -490,7 +492,9 @@ const allowTarget = zod_1.z.union([
|
|
|
490
492
|
zod_1.z.custom(value => typeof value === "string" && /^nwjs\d+\.\d+$/.test(value)),
|
|
491
493
|
zod_1.z.literal("node-webkit"),
|
|
492
494
|
zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+$/.test(value)),
|
|
493
|
-
zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+\.\d+$/.test(value))
|
|
495
|
+
zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+\.\d+$/.test(value)),
|
|
496
|
+
zod_1.z.literal("browserslist"),
|
|
497
|
+
zod_1.z.custom(value => typeof value === "string" && /^browserslist:(.+)$/.test(value))
|
|
494
498
|
]);
|
|
495
499
|
const target = zod_1.z.union([zod_1.z.literal(false), allowTarget, allowTarget.array()]);
|
|
496
500
|
//#endregion
|
|
@@ -739,7 +743,6 @@ const statsOptions = zod_1.z.strictObject({
|
|
|
739
743
|
});
|
|
740
744
|
const statsValue = zod_1.z.boolean().or(statsPresets).or(statsOptions);
|
|
741
745
|
const plugin = zod_1.z.union([
|
|
742
|
-
zod_1.z.custom(),
|
|
743
746
|
zod_1.z.custom(),
|
|
744
747
|
falsy
|
|
745
748
|
]);
|
package/dist/exports.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
declare const rspackVersion:
|
|
2
|
-
|
|
1
|
+
declare const rspackVersion: string;
|
|
2
|
+
declare const version: string;
|
|
3
|
+
export { rspackVersion, version };
|
|
3
4
|
export type { Asset, AssetInfo, Assets, CompilationParams, LogEntry } from "./Compilation";
|
|
4
5
|
export { Compilation } from "./Compilation";
|
|
5
6
|
export { Compiler } from "./Compiler";
|
|
@@ -14,7 +15,7 @@ export { MultiStats } from "./MultiStats";
|
|
|
14
15
|
export { NormalModule } from "./NormalModule";
|
|
15
16
|
export type { NormalModuleFactory } from "./NormalModuleFactory";
|
|
16
17
|
export { RuntimeGlobals } from "./RuntimeGlobals";
|
|
17
|
-
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule
|
|
18
|
+
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule } from "./Stats";
|
|
18
19
|
export { Stats } from "./Stats";
|
|
19
20
|
import * as ModuleFilenameHelpers from "./lib/ModuleFilenameHelpers";
|
|
20
21
|
export { ModuleFilenameHelpers };
|
package/dist/exports.js
CHANGED
|
@@ -28,9 +28,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.LightningCssMinimizerRspackPlugin = exports.SwcCssMinimizerRspackPlugin = exports.SwcJsMinimizerRspackPlugin = exports.HtmlRspackPlugin = exports.sharing = exports.container = exports.optimize = exports.webworker = exports.javascript = exports.wasm = exports.library = exports.electron = exports.node = exports.web = exports.NormalModuleReplacementPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.EnvironmentPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.DynamicEntryPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.IgnorePlugin = exports.BannerPlugin = exports.EntryOptionPlugin = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.Stats = exports.RuntimeGlobals = exports.NormalModule = exports.MultiStats = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compiler = exports.Compilation = exports.version = exports.rspackVersion = void 0;
|
|
30
30
|
exports.experiments = void 0;
|
|
31
|
-
const
|
|
31
|
+
const package_json_1 = require("../package.json");
|
|
32
|
+
// this is a hack to be compatible with plugin which detect webpack's version
|
|
33
|
+
const rspackVersion = package_json_1.version;
|
|
32
34
|
exports.rspackVersion = rspackVersion;
|
|
33
|
-
|
|
35
|
+
const version = package_json_1.webpackVersion;
|
|
36
|
+
exports.version = version;
|
|
34
37
|
var Compilation_1 = require("./Compilation");
|
|
35
38
|
Object.defineProperty(exports, "Compilation", { enumerable: true, get: function () { return Compilation_1.Compilation; } });
|
|
36
39
|
var Compiler_1 = require("./Compiler");
|
package/dist/lib/Cache.js
CHANGED
|
@@ -13,12 +13,13 @@ exports.Cache = void 0;
|
|
|
13
13
|
const lite_tapable_1 = require("@rspack/lite-tapable");
|
|
14
14
|
const HookWebpackError_1 = require("./HookWebpackError");
|
|
15
15
|
const needCalls = (times, callback) => {
|
|
16
|
+
let leftTimes = times;
|
|
16
17
|
return err => {
|
|
17
|
-
if (--
|
|
18
|
+
if (--leftTimes === 0) {
|
|
18
19
|
return callback();
|
|
19
20
|
}
|
|
20
|
-
if (err &&
|
|
21
|
-
|
|
21
|
+
if (err && leftTimes > 0) {
|
|
22
|
+
leftTimes = 0;
|
|
22
23
|
return callback();
|
|
23
24
|
}
|
|
24
25
|
};
|
|
@@ -42,11 +43,12 @@ class Cache {
|
|
|
42
43
|
*/
|
|
43
44
|
get(identifier, etag, callback) {
|
|
44
45
|
const gotHandlers = [];
|
|
45
|
-
this.hooks.get.callAsync(identifier, etag, gotHandlers, (err,
|
|
46
|
+
this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, res) => {
|
|
46
47
|
if (err) {
|
|
47
48
|
callback((0, HookWebpackError_1.makeWebpackError)(err, "Cache.hooks.get"));
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
51
|
+
let result = res;
|
|
50
52
|
if (result === null) {
|
|
51
53
|
result = undefined;
|
|
52
54
|
}
|
package/dist/lib/CacheFacade.js
CHANGED
|
@@ -63,15 +63,14 @@ class MultiItemCache {
|
|
|
63
63
|
/**
|
|
64
64
|
* @returns promise with the data
|
|
65
65
|
*/
|
|
66
|
-
getPromise() {
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return next(0);
|
|
66
|
+
async getPromise() {
|
|
67
|
+
for (let i = 0; i < this._items.length; i++) {
|
|
68
|
+
const result = await this._items[i].getPromise();
|
|
69
|
+
if (result !== undefined) {
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
75
74
|
}
|
|
76
75
|
/**
|
|
77
76
|
* @param data the value to store
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Compiler } from "../Compiler";
|
|
11
11
|
import type { MatchObject } from "./ModuleFilenameHelpers";
|
|
12
|
-
type LoaderOptionsPluginOptions =
|
|
12
|
+
type LoaderOptionsPluginOptions = MatchObject & {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
13
15
|
export declare class LoaderOptionsPlugin {
|
|
14
|
-
options:
|
|
16
|
+
options: LoaderOptionsPluginOptions;
|
|
15
17
|
/**
|
|
16
18
|
* @param options options object
|
|
17
19
|
*/
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Etag } from "../Cache";
|
|
11
11
|
/**
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
12
|
+
* @param first first
|
|
13
|
+
* @param second second
|
|
14
14
|
* @returns result
|
|
15
15
|
*/
|
|
16
|
-
export declare const mergeEtags: (
|
|
16
|
+
export declare const mergeEtags: (first: Etag, second: Etag) => Etag;
|
|
17
17
|
export default mergeEtags;
|
|
@@ -26,11 +26,13 @@ class MergedEtag {
|
|
|
26
26
|
const dualObjectMap = new WeakMap();
|
|
27
27
|
const objectStringMap = new WeakMap();
|
|
28
28
|
/**
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
29
|
+
* @param first first
|
|
30
|
+
* @param second second
|
|
31
31
|
* @returns result
|
|
32
32
|
*/
|
|
33
|
-
const mergeEtags = (
|
|
33
|
+
const mergeEtags = (first, second) => {
|
|
34
|
+
let a = first;
|
|
35
|
+
let b = second;
|
|
34
36
|
if (typeof a === "string") {
|
|
35
37
|
if (typeof b === "string") {
|
|
36
38
|
return `${a}|${b}`;
|
|
@@ -506,7 +506,8 @@ async function runLoaders(compiler, context) {
|
|
|
506
506
|
return compiler._lastCompilation.getLogger([name, resource].filter(Boolean).join("|"));
|
|
507
507
|
};
|
|
508
508
|
loaderContext.rootContext = compiler.context;
|
|
509
|
-
loaderContext.emitError = function emitError(
|
|
509
|
+
loaderContext.emitError = function emitError(err) {
|
|
510
|
+
let error = err;
|
|
510
511
|
if (!(error instanceof Error)) {
|
|
511
512
|
error = new RspackError_1.NonErrorEmittedError(error);
|
|
512
513
|
}
|
|
@@ -521,7 +522,8 @@ async function runLoaders(compiler, context) {
|
|
|
521
522
|
severity: binding_1.JsRspackSeverity.Error
|
|
522
523
|
});
|
|
523
524
|
};
|
|
524
|
-
loaderContext.emitWarning = function emitWarning(
|
|
525
|
+
loaderContext.emitWarning = function emitWarning(warn) {
|
|
526
|
+
let warning = warn;
|
|
525
527
|
if (!(warning instanceof Error)) {
|
|
526
528
|
warning = new RspackError_1.NonErrorEmittedError(warning);
|
|
527
529
|
}
|
package/dist/node/nodeConsole.js
CHANGED
|
@@ -42,14 +42,14 @@ function default_1({ colors, appendOnly, stream }) {
|
|
|
42
42
|
const indent = (str, prefix, colorPrefix, colorSuffix) => {
|
|
43
43
|
if (str === "")
|
|
44
44
|
return str;
|
|
45
|
-
|
|
45
|
+
const prefixWithIndent = currentIndent + prefix;
|
|
46
46
|
if (colors) {
|
|
47
|
-
return (
|
|
47
|
+
return (prefixWithIndent +
|
|
48
48
|
colorPrefix +
|
|
49
49
|
str.replace(/\n/g, `${colorSuffix}\n${prefix}${colorPrefix}`) +
|
|
50
50
|
colorSuffix);
|
|
51
51
|
}
|
|
52
|
-
return
|
|
52
|
+
return prefixWithIndent + str.replace(/\n/g, `\n${prefix}`);
|
|
53
53
|
};
|
|
54
54
|
const clearStatusMessage = () => {
|
|
55
55
|
if (hasStatusMessage) {
|
|
@@ -120,8 +120,8 @@ function default_1({ colors, appendOnly, stream }) {
|
|
|
120
120
|
})),
|
|
121
121
|
status: appendOnly
|
|
122
122
|
? writeColored("<s> ", "", "")
|
|
123
|
-
: (name, ...
|
|
124
|
-
args =
|
|
123
|
+
: (name, ...argsWithEmpty) => {
|
|
124
|
+
const args = argsWithEmpty.filter(Boolean);
|
|
125
125
|
if (name === undefined && args.length === 0) {
|
|
126
126
|
clearStatusMessage();
|
|
127
127
|
currentStatusMessage = undefined;
|
|
@@ -271,9 +271,7 @@ const NORMALIZER = {
|
|
|
271
271
|
});
|
|
272
272
|
},
|
|
273
273
|
logging: (value) => {
|
|
274
|
-
|
|
275
|
-
value = "log";
|
|
276
|
-
return value;
|
|
274
|
+
return value === true ? "log" : value;
|
|
277
275
|
},
|
|
278
276
|
loggingDebug: (value) => {
|
|
279
277
|
const array = !Array.isArray(value) ? (value ? [value] : []) : value;
|
|
@@ -71,10 +71,9 @@ class StatsFactory {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
_forEachLevelWaterfall(hookMap, cache, type, data, fn) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return data;
|
|
74
|
+
return this._getAllLevelHooks(hookMap, cache, type).reduce((data, hook) => {
|
|
75
|
+
return fn(hook, data);
|
|
76
|
+
}, data);
|
|
78
77
|
}
|
|
79
78
|
_forEachLevelFilter(hookMap, cache, type, items, fn, forceClone) {
|
|
80
79
|
const hooks = this._getAllLevelHooks(hookMap, cache, type);
|
|
@@ -71,10 +71,9 @@ class StatsPrinter {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
_forEachLevelWaterfall(hookMap, type, data, fn) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return data;
|
|
74
|
+
return this._getAllLevelHooks(hookMap, type).reduce((data, hook) => {
|
|
75
|
+
return fn(hook, data);
|
|
76
|
+
}, data);
|
|
78
77
|
}
|
|
79
78
|
print(type, object, baseContext) {
|
|
80
79
|
if (this._inPrint) {
|
|
@@ -3,14 +3,82 @@ import type * as binding from "@rspack/binding";
|
|
|
3
3
|
import type { Compilation, NormalizedStatsOptions } from "../Compilation";
|
|
4
4
|
import { type Comparator } from "../util/comparators";
|
|
5
5
|
import type { StatsFactory, StatsFactoryContext } from "./StatsFactory";
|
|
6
|
-
export type KnownStatsChunkGroup =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export type KnownStatsChunkGroup = {
|
|
7
|
+
name?: string;
|
|
8
|
+
chunks?: (string | number)[];
|
|
9
|
+
assets?: {
|
|
10
|
+
name: string;
|
|
11
|
+
size?: number;
|
|
12
|
+
}[];
|
|
13
|
+
filteredAssets?: number;
|
|
14
|
+
assetsSize?: number;
|
|
15
|
+
auxiliaryAssets?: {
|
|
16
|
+
name: string;
|
|
17
|
+
size?: number;
|
|
18
|
+
}[];
|
|
19
|
+
filteredAuxiliaryAssets?: number;
|
|
20
|
+
auxiliaryAssetsSize?: number;
|
|
21
|
+
children?: {
|
|
22
|
+
preload?: StatsChunkGroup[];
|
|
23
|
+
prefetch?: StatsChunkGroup[];
|
|
24
|
+
};
|
|
25
|
+
childAssets?: {
|
|
26
|
+
[index: string]: string[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type KnownStatsChunk = {
|
|
30
|
+
type: string;
|
|
31
|
+
rendered: boolean;
|
|
32
|
+
initial: boolean;
|
|
33
|
+
entry: boolean;
|
|
34
|
+
reason?: string;
|
|
35
|
+
size: number;
|
|
36
|
+
sizes?: Record<string, number>;
|
|
37
|
+
names?: string[];
|
|
38
|
+
idHints?: string[];
|
|
39
|
+
runtime?: string[];
|
|
40
|
+
files?: string[];
|
|
41
|
+
auxiliaryFiles?: string[];
|
|
42
|
+
hash?: string;
|
|
43
|
+
childrenByOrder?: Record<string, (string | number)[]>;
|
|
44
|
+
id?: string | number;
|
|
45
|
+
siblings?: (string | number)[];
|
|
46
|
+
parents?: (string | number)[];
|
|
47
|
+
children?: (string | number)[];
|
|
48
|
+
modules?: StatsModule[];
|
|
49
|
+
filteredModules?: number;
|
|
50
|
+
origins?: StatsChunkOrigin[];
|
|
51
|
+
};
|
|
52
|
+
export type KnownAssetInfo = {
|
|
53
|
+
immutable?: boolean;
|
|
54
|
+
minimized?: boolean;
|
|
55
|
+
fullhash?: string | string[];
|
|
56
|
+
chunkhash?: string | string[];
|
|
57
|
+
contenthash?: string | string[];
|
|
58
|
+
sourceFilename?: string;
|
|
59
|
+
size?: number;
|
|
60
|
+
development?: boolean;
|
|
61
|
+
hotModuleReplacement?: boolean;
|
|
62
|
+
javascriptModule?: boolean;
|
|
63
|
+
related?: Record<string, string | string[]>;
|
|
64
|
+
};
|
|
65
|
+
export type AssetInfo = KnownAssetInfo & Record<string, any>;
|
|
66
|
+
export type StatsChunkGroup = KnownStatsChunkGroup & Record<string, any>;
|
|
67
|
+
export type KnownStatsAsset = {
|
|
68
|
+
type: string;
|
|
69
|
+
name: string;
|
|
70
|
+
info: AssetInfo;
|
|
71
|
+
size: number;
|
|
72
|
+
emitted: boolean;
|
|
73
|
+
chunkNames?: (string | number)[];
|
|
74
|
+
chunkIdHints?: (string | number)[];
|
|
75
|
+
chunks?: (string | null | undefined)[];
|
|
76
|
+
auxiliaryChunkNames?: (string | number)[];
|
|
77
|
+
auxiliaryChunks?: (string | null | undefined)[];
|
|
78
|
+
auxiliaryChunkIdHints?: (string | number)[];
|
|
79
|
+
filteredRelated?: number;
|
|
80
|
+
isOverSizeLimit?: boolean;
|
|
10
81
|
};
|
|
11
|
-
export type KnownStatsAssetInfo = Omit<binding.JsStatsAssetInfo, "related">;
|
|
12
|
-
export type StatsChunkGroup = binding.JsStatsChunkGroup & Record<string, any>;
|
|
13
|
-
export type KnownStatsAsset = Omit<binding.JsStatsAsset, "info">;
|
|
14
82
|
export type StatsAsset = KnownStatsAsset & Record<string, any>;
|
|
15
83
|
export type StatsChunk = KnownStatsChunk & Record<string, any>;
|
|
16
84
|
export type KnownStatsModule = {
|
|
@@ -61,15 +129,28 @@ export type KnownStatsProfile = {
|
|
|
61
129
|
building: number;
|
|
62
130
|
};
|
|
63
131
|
export type StatsModule = KnownStatsModule & Record<string, any>;
|
|
64
|
-
export type
|
|
132
|
+
export type KnownStatsModuleIssuer = {
|
|
65
133
|
identifier?: string;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
export type
|
|
134
|
+
name?: string;
|
|
135
|
+
id?: string | number;
|
|
136
|
+
};
|
|
137
|
+
export type StatsModuleIssuer = KnownStatsModuleIssuer & Record<string, any>;
|
|
138
|
+
export type KnownStatsError = {
|
|
139
|
+
message: string;
|
|
140
|
+
chunkName?: string;
|
|
141
|
+
chunkEntry?: boolean;
|
|
142
|
+
chunkInitial?: boolean;
|
|
143
|
+
file?: string;
|
|
71
144
|
moduleIdentifier?: string;
|
|
72
|
-
|
|
145
|
+
moduleName?: string;
|
|
146
|
+
loc?: string;
|
|
147
|
+
chunkId?: string | number;
|
|
148
|
+
moduleId?: string | number;
|
|
149
|
+
moduleTrace?: StatsModuleTraceItem[];
|
|
150
|
+
details?: any;
|
|
151
|
+
stack?: string;
|
|
152
|
+
};
|
|
153
|
+
export type StatsError = KnownStatsError & Record<string, any>;
|
|
73
154
|
export type StatsModuleTraceItem = {
|
|
74
155
|
originIdentifier?: string;
|
|
75
156
|
originName?: string;
|
|
@@ -78,9 +159,15 @@ export type StatsModuleTraceItem = {
|
|
|
78
159
|
originId?: string;
|
|
79
160
|
moduleId?: string;
|
|
80
161
|
};
|
|
81
|
-
export type
|
|
162
|
+
export type KnownStatsModuleReason = {
|
|
82
163
|
moduleIdentifier?: string;
|
|
83
|
-
|
|
164
|
+
module?: string;
|
|
165
|
+
moduleName?: string;
|
|
166
|
+
type?: string;
|
|
167
|
+
userRequest?: string;
|
|
168
|
+
moduleId?: string | null;
|
|
169
|
+
};
|
|
170
|
+
export type StatsModuleReason = KnownStatsModuleReason & Record<string, any>;
|
|
84
171
|
export type KnownStatsChunkOrigin = {
|
|
85
172
|
module: string;
|
|
86
173
|
moduleIdentifier: string;
|
|
@@ -112,7 +199,7 @@ export type KnownStatsCompilation = {
|
|
|
112
199
|
namedChunkGroups?: Record<string, StatsChunkGroup>;
|
|
113
200
|
errors?: StatsError[];
|
|
114
201
|
errorsCount?: number;
|
|
115
|
-
warnings?:
|
|
202
|
+
warnings?: StatsError[];
|
|
116
203
|
warningsCount?: number;
|
|
117
204
|
filteredModules?: number;
|
|
118
205
|
children?: StatsCompilation[];
|
|
@@ -137,7 +224,7 @@ export type KnownStatsLoggingEntry = {
|
|
|
137
224
|
type ExtractorsByOption<T, O> = {
|
|
138
225
|
[x: string]: (object: O, data: T, context: StatsFactoryContext, options: any, factory: StatsFactory) => void;
|
|
139
226
|
};
|
|
140
|
-
export type PreprocessedAsset =
|
|
227
|
+
export type PreprocessedAsset = binding.JsStatsAsset & {
|
|
141
228
|
type: string;
|
|
142
229
|
related: PreprocessedAsset[];
|
|
143
230
|
info: binding.JsStatsAssetInfo;
|
|
@@ -157,7 +244,7 @@ export type SimpleExtractors = {
|
|
|
157
244
|
moduleReason: ExtractorsByOption<binding.JsStatsModuleReason, StatsModuleReason>;
|
|
158
245
|
chunk: ExtractorsByOption<binding.JsStatsChunk, KnownStatsChunk>;
|
|
159
246
|
error: ExtractorsByOption<binding.JsStatsError, StatsError>;
|
|
160
|
-
warning: ExtractorsByOption<binding.JsStatsWarning,
|
|
247
|
+
warning: ExtractorsByOption<binding.JsStatsWarning, StatsError>;
|
|
161
248
|
moduleTraceItem: ExtractorsByOption<binding.JsStatsModuleTrace, StatsModuleTraceItem>;
|
|
162
249
|
};
|
|
163
250
|
export declare const uniqueArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>) => I[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function assertNotNill(value:
|
|
1
|
+
export declare function assertNotNill(value: unknown): asserts value;
|
package/dist/util/cleverMerge.js
CHANGED
|
@@ -247,11 +247,12 @@ const _cleverMerge = (first, second, internalCaching = false) => {
|
|
|
247
247
|
: parseObject(first);
|
|
248
248
|
const { static: firstInfo, dynamic: firstDynamicInfo } = firstObject;
|
|
249
249
|
// If the first argument has a dynamic part we modify the dynamic part to merge the second argument
|
|
250
|
+
let secondObj = second;
|
|
250
251
|
if (firstDynamicInfo !== undefined) {
|
|
251
252
|
let { byProperty, fn } = firstDynamicInfo;
|
|
252
253
|
const fnInfo = fn[DYNAMIC_INFO];
|
|
253
254
|
if (fnInfo) {
|
|
254
|
-
|
|
255
|
+
secondObj = internalCaching
|
|
255
256
|
? (0, exports.cachedCleverMerge)(fnInfo[1], second)
|
|
256
257
|
: (0, exports.cleverMerge)(fnInfo[1], second);
|
|
257
258
|
fn = fnInfo[0];
|
|
@@ -259,10 +260,10 @@ const _cleverMerge = (first, second, internalCaching = false) => {
|
|
|
259
260
|
const newFn = (...args) => {
|
|
260
261
|
const fnResult = fn(...args);
|
|
261
262
|
return internalCaching
|
|
262
|
-
? (0, exports.cachedCleverMerge)(fnResult,
|
|
263
|
-
: (0, exports.cleverMerge)(fnResult,
|
|
263
|
+
? (0, exports.cachedCleverMerge)(fnResult, secondObj)
|
|
264
|
+
: (0, exports.cleverMerge)(fnResult, secondObj);
|
|
264
265
|
};
|
|
265
|
-
newFn[DYNAMIC_INFO] = [fn,
|
|
266
|
+
newFn[DYNAMIC_INFO] = [fn, secondObj];
|
|
266
267
|
return serializeObject(firstObject.static, { byProperty, fn: newFn });
|
|
267
268
|
}
|
|
268
269
|
// If the first part is static only, we merge the static parts and keep the dynamic part of the second argument
|
package/dist/util/createHash.js
CHANGED
|
@@ -113,12 +113,17 @@ class DebugHash extends hash_1.default {
|
|
|
113
113
|
* @returns updated hash
|
|
114
114
|
*/
|
|
115
115
|
update(data, _inputEncoding) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
data = Buffer.from(data.slice("debug-digest-".length), "hex").toString();
|
|
116
|
+
let normalizedData;
|
|
117
|
+
if (typeof data !== "string") {
|
|
118
|
+
normalizedData = data.toString("utf-8");
|
|
120
119
|
}
|
|
121
|
-
|
|
120
|
+
else {
|
|
121
|
+
normalizedData = data;
|
|
122
|
+
}
|
|
123
|
+
if (normalizedData.startsWith("debug-digest-")) {
|
|
124
|
+
normalizedData = Buffer.from(normalizedData.slice("debug-digest-".length), "hex").toString();
|
|
125
|
+
}
|
|
126
|
+
this.string += `[${normalizedData}](${new Error().stack?.split("\n", 3)[2]})\n`;
|
|
122
127
|
return this;
|
|
123
128
|
}
|
|
124
129
|
/**
|
|
@@ -43,11 +43,12 @@ class WasmHash {
|
|
|
43
43
|
*/
|
|
44
44
|
update(data, encoding) {
|
|
45
45
|
if (typeof data === "string") {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
let normalizedData = data;
|
|
47
|
+
while (normalizedData.length > exports.MAX_SHORT_STRING) {
|
|
48
|
+
this._updateWithShortString(normalizedData.slice(0, exports.MAX_SHORT_STRING), encoding);
|
|
49
|
+
normalizedData = normalizedData.slice(exports.MAX_SHORT_STRING);
|
|
49
50
|
}
|
|
50
|
-
this._updateWithShortString(
|
|
51
|
+
this._updateWithShortString(normalizedData, encoding);
|
|
51
52
|
return this;
|
|
52
53
|
}
|
|
53
54
|
this._updateWithBuffer(data);
|
|
@@ -70,10 +70,10 @@ export declare const parseResourceWithoutFragment: {
|
|
|
70
70
|
bindCache(associatedObjectForCache: object): (str: string) => ParsedResourceWithoutFragment;
|
|
71
71
|
};
|
|
72
72
|
/**
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
76
|
-
* @returns
|
|
73
|
+
* @param filename the filename which should be undone
|
|
74
|
+
* @param outputPath the output path that is restored (only relevant when filename contains "..")
|
|
75
|
+
* @param enforceRelative true returns ./ for empty paths
|
|
76
|
+
* @returns repeated ../ to leave the directory of the provided filename to be back on output dir
|
|
77
77
|
*/
|
|
78
78
|
export declare const getUndoPath: (filename: string, outputPath: string, enforceRelative: boolean) => string;
|
|
79
79
|
export {};
|
package/dist/util/identifier.js
CHANGED
|
@@ -293,28 +293,28 @@ const _parseResourceWithoutFragment = (str) => {
|
|
|
293
293
|
};
|
|
294
294
|
exports.parseResourceWithoutFragment = makeCacheable(_parseResourceWithoutFragment);
|
|
295
295
|
/**
|
|
296
|
-
* @param
|
|
297
|
-
* @param
|
|
298
|
-
* @param
|
|
299
|
-
* @returns
|
|
296
|
+
* @param filename the filename which should be undone
|
|
297
|
+
* @param outputPath the output path that is restored (only relevant when filename contains "..")
|
|
298
|
+
* @param enforceRelative true returns ./ for empty paths
|
|
299
|
+
* @returns repeated ../ to leave the directory of the provided filename to be back on output dir
|
|
300
300
|
*/
|
|
301
301
|
const getUndoPath = (filename, outputPath, enforceRelative) => {
|
|
302
302
|
let depth = -1;
|
|
303
303
|
let append = "";
|
|
304
|
-
|
|
304
|
+
let path = outputPath.replace(/[\\/]$/, "");
|
|
305
305
|
for (const part of filename.split(/[/\\]+/)) {
|
|
306
306
|
if (part === "..") {
|
|
307
307
|
if (depth > -1) {
|
|
308
308
|
depth--;
|
|
309
309
|
}
|
|
310
310
|
else {
|
|
311
|
-
const i =
|
|
312
|
-
const j =
|
|
311
|
+
const i = path.lastIndexOf("/");
|
|
312
|
+
const j = path.lastIndexOf("\\");
|
|
313
313
|
const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
|
|
314
314
|
if (pos < 0)
|
|
315
|
-
return `${
|
|
316
|
-
append = `${
|
|
317
|
-
|
|
315
|
+
return `${path}/`;
|
|
316
|
+
append = `${path.slice(pos + 1)}/${append}`;
|
|
317
|
+
path = path.slice(0, pos);
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
else if (part !== ".") {
|
package/dist/util/memoize.js
CHANGED
|
@@ -4,15 +4,16 @@ exports.memoizeValue = exports.memoizeFn = exports.memoize = void 0;
|
|
|
4
4
|
const memoize = (fn) => {
|
|
5
5
|
let cache = false;
|
|
6
6
|
let result;
|
|
7
|
+
let callback = fn;
|
|
7
8
|
return () => {
|
|
8
9
|
if (cache) {
|
|
9
10
|
return result;
|
|
10
11
|
}
|
|
11
|
-
result =
|
|
12
|
+
result = callback();
|
|
12
13
|
cache = true;
|
|
13
14
|
// Allow to clean up memory for fn
|
|
14
15
|
// and all dependent resources
|
|
15
|
-
|
|
16
|
+
callback = undefined;
|
|
16
17
|
return result;
|
|
17
18
|
};
|
|
18
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@module-federation/runtime-tools": "0.2.3",
|
|
61
61
|
"caniuse-lite": "^1.0.30001616",
|
|
62
|
-
"@rspack/
|
|
63
|
-
"@rspack/
|
|
62
|
+
"@rspack/binding": "1.0.0-beta.3",
|
|
63
|
+
"@rspack/lite-tapable": "1.0.0-beta.3"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@swc/helpers": ">=0.5.1"
|