@rspack/core 0.7.5-canary-0d03907-20240624125011 → 0.7.5
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/Chunk.d.ts +14 -19
- package/dist/Chunk.js +17 -22
- package/dist/ChunkGraph.d.ts +1 -1
- package/dist/ChunkGraph.js +5 -5
- package/dist/ChunkGroup.d.ts +7 -17
- package/dist/ChunkGroup.js +2 -12
- package/dist/Compilation.d.ts +22 -18
- package/dist/Compilation.js +43 -20
- package/dist/Compiler.js +2 -18
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/Entrypoint.js +2 -2
- package/dist/Module.d.ts +6 -7
- package/dist/Module.js +0 -1
- package/dist/NormalModule.d.ts +1 -0
- package/dist/NormalModule.js +7 -0
- package/dist/NormalModuleFactory.js +22 -0
- package/dist/Stats.d.ts +2 -2
- package/dist/builtin-loader/swc/emotion.d.ts +17 -0
- package/dist/builtin-loader/swc/emotion.js +22 -0
- package/dist/builtin-loader/swc/index.d.ts +4 -0
- package/dist/builtin-loader/swc/index.js +5 -1
- package/dist/builtin-loader/swc/preact.d.ts +4 -3
- package/dist/builtin-loader/swc/relay.d.ts +5 -0
- package/dist/builtin-loader/swc/relay.js +48 -0
- package/dist/builtin-loader/swc/types.d.ts +17 -2
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +9 -15
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +1 -50
- package/dist/builtin-plugin/css-extract/index.d.ts +2 -2
- package/dist/config/adapter.js +10 -23
- package/dist/config/adapterRuleUse.js +11 -0
- package/dist/config/defaults.js +0 -1
- package/dist/config/normalization.js +2 -12
- package/dist/config/zod.d.ts +10 -114
- package/dist/config/zod.js +6 -8
- package/dist/exports.d.ts +1 -2
- package/dist/exports.js +1 -4
- package/dist/loader-runner/index.js +6 -27
- package/dist/stats/DefaultStatsFactoryPlugin.js +2 -19
- package/dist/stats/DefaultStatsPrinterPlugin.js +2 -2
- package/dist/stats/statsFactoryUtils.d.ts +2 -4
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.js +3 -4
- package/dist/util/memoize.js +1 -5
- package/package.json +4 -8
- package/dist/RspackError.d.ts +0 -8
- package/dist/RspackError.js +0 -21
package/dist/config/zod.js
CHANGED
|
@@ -230,11 +230,10 @@ const resolveAlias = zod_1.z.record(zod_1.z
|
|
|
230
230
|
.literal(false)
|
|
231
231
|
.or(zod_1.z.string())
|
|
232
232
|
.or(zod_1.z.array(zod_1.z.string().or(zod_1.z.literal(false)))));
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
configFile: resolveTsConfigFile,
|
|
233
|
+
const resolveTsconfig = zod_1.z.strictObject({
|
|
234
|
+
configFile: zod_1.z.string(),
|
|
236
235
|
references: zod_1.z.array(zod_1.z.string()).or(zod_1.z.literal("auto")).optional()
|
|
237
|
-
})
|
|
236
|
+
});
|
|
238
237
|
const baseResolveOptions = zod_1.z.strictObject({
|
|
239
238
|
alias: resolveAlias.optional(),
|
|
240
239
|
conditionNames: zod_1.z.array(zod_1.z.string()).optional(),
|
|
@@ -249,7 +248,8 @@ const baseResolveOptions = zod_1.z.strictObject({
|
|
|
249
248
|
enforceExtension: zod_1.z.boolean().optional(),
|
|
250
249
|
importsFields: zod_1.z.array(zod_1.z.string()).optional(),
|
|
251
250
|
descriptionFiles: zod_1.z.array(zod_1.z.string()).optional(),
|
|
252
|
-
|
|
251
|
+
tsConfigPath: zod_1.z.string().optional(),
|
|
252
|
+
tsConfig: resolveTsconfig.optional(),
|
|
253
253
|
fullySpecified: zod_1.z.boolean().optional(),
|
|
254
254
|
exportsFields: zod_1.z.array(zod_1.z.string()).optional(),
|
|
255
255
|
extensionAlias: zod_1.z.record(zod_1.z.string().or(zod_1.z.array(zod_1.z.string()))).optional(),
|
|
@@ -345,7 +345,6 @@ const reexportExportsPresence = zod_1.z
|
|
|
345
345
|
.enum(["error", "warn", "auto"])
|
|
346
346
|
.or(zod_1.z.literal(false));
|
|
347
347
|
const strictExportPresence = zod_1.z.boolean();
|
|
348
|
-
const worker = zod_1.z.array(zod_1.z.string()).or(zod_1.z.boolean());
|
|
349
348
|
const javascriptParserOptions = zod_1.z.strictObject({
|
|
350
349
|
dynamicImportMode: dynamicImportMode.optional(),
|
|
351
350
|
dynamicImportPreload: dynamicImportPreload.optional(),
|
|
@@ -356,8 +355,7 @@ const javascriptParserOptions = zod_1.z.strictObject({
|
|
|
356
355
|
exportsPresence: exportsPresence.optional(),
|
|
357
356
|
importExportsPresence: importExportsPresence.optional(),
|
|
358
357
|
reexportExportsPresence: reexportExportsPresence.optional(),
|
|
359
|
-
strictExportPresence: strictExportPresence.optional()
|
|
360
|
-
worker: worker.optional()
|
|
358
|
+
strictExportPresence: strictExportPresence.optional()
|
|
361
359
|
});
|
|
362
360
|
const parserOptionsByModuleTypeKnown = zod_1.z.strictObject({
|
|
363
361
|
asset: assetParserOptions.optional(),
|
package/dist/exports.d.ts
CHANGED
|
@@ -87,10 +87,9 @@ interface Wasm {
|
|
|
87
87
|
EnableWasmLoadingPlugin: typeof EnableWasmLoadingPlugin;
|
|
88
88
|
}
|
|
89
89
|
export declare const wasm: Wasm;
|
|
90
|
-
import { EnableChunkLoadingPlugin
|
|
90
|
+
import { EnableChunkLoadingPlugin } from "./builtin-plugin";
|
|
91
91
|
interface JavaScript {
|
|
92
92
|
EnableChunkLoadingPlugin: typeof EnableChunkLoadingPlugin;
|
|
93
|
-
JavascriptModulesPlugin: typeof JavascriptModulesPlugin;
|
|
94
93
|
}
|
|
95
94
|
export declare const javascript: JavaScript;
|
|
96
95
|
import { WebWorkerTemplatePlugin } from "./builtin-plugin";
|
package/dist/exports.js
CHANGED
|
@@ -117,10 +117,7 @@ exports.library = { EnableLibraryPlugin: builtin_plugin_13.EnableLibraryPlugin }
|
|
|
117
117
|
const builtin_plugin_14 = require("./builtin-plugin");
|
|
118
118
|
exports.wasm = { EnableWasmLoadingPlugin: builtin_plugin_14.EnableWasmLoadingPlugin };
|
|
119
119
|
const builtin_plugin_15 = require("./builtin-plugin");
|
|
120
|
-
exports.javascript = {
|
|
121
|
-
EnableChunkLoadingPlugin: builtin_plugin_15.EnableChunkLoadingPlugin,
|
|
122
|
-
JavascriptModulesPlugin: builtin_plugin_15.JavascriptModulesPlugin
|
|
123
|
-
};
|
|
120
|
+
exports.javascript = { EnableChunkLoadingPlugin: builtin_plugin_15.EnableChunkLoadingPlugin };
|
|
124
121
|
const builtin_plugin_16 = require("./builtin-plugin");
|
|
125
122
|
exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_16.WebWorkerTemplatePlugin };
|
|
126
123
|
const builtin_plugin_17 = require("./builtin-plugin");
|
|
@@ -32,7 +32,6 @@ const binding_1 = require("@rspack/binding");
|
|
|
32
32
|
const webpack_sources_1 = require("webpack-sources");
|
|
33
33
|
const Module_1 = require("../Module");
|
|
34
34
|
const NormalModule_1 = require("../NormalModule");
|
|
35
|
-
const RspackError_1 = require("../RspackError");
|
|
36
35
|
const adapterRuleUse_1 = require("../config/adapterRuleUse");
|
|
37
36
|
const util_2 = require("../util");
|
|
38
37
|
const createHash_1 = require("../util/createHash");
|
|
@@ -518,34 +517,14 @@ async function runLoaders(compiler, context) {
|
|
|
518
517
|
};
|
|
519
518
|
loaderContext.rootContext = compiler.context;
|
|
520
519
|
loaderContext.emitError = function emitError(error) {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
}
|
|
524
|
-
let hasStack = !!error.stack;
|
|
525
|
-
error.name = "ModuleError";
|
|
526
|
-
error.message = `${error.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
|
|
527
|
-
hasStack && Error.captureStackTrace(error);
|
|
528
|
-
error = (0, util_2.concatErrorMsgAndStack)(error);
|
|
529
|
-
error.moduleIdentifier = this._module.identifier();
|
|
530
|
-
compiler._lastCompilation.__internal__pushDiagnostic({
|
|
531
|
-
error,
|
|
532
|
-
severity: binding_1.JsRspackSeverity.Error
|
|
533
|
-
});
|
|
520
|
+
const title = "Module Error";
|
|
521
|
+
const message = error instanceof Error ? (0, util_2.concatErrorMsgAndStack)(error) : error;
|
|
522
|
+
compiler._lastCompilation.__internal__pushDiagnostic("error", title, `${message}\n(from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`);
|
|
534
523
|
};
|
|
535
524
|
loaderContext.emitWarning = function emitWarning(warning) {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}
|
|
539
|
-
let hasStack = !!warning.stack;
|
|
540
|
-
warning.name = "ModuleWarning";
|
|
541
|
-
warning.message = `${warning.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
|
|
542
|
-
hasStack && Error.captureStackTrace(warning);
|
|
543
|
-
warning = (0, util_2.concatErrorMsgAndStack)(warning);
|
|
544
|
-
warning.moduleIdentifier = this._module.identifier();
|
|
545
|
-
compiler._lastCompilation.__internal__pushDiagnostic({
|
|
546
|
-
error: warning,
|
|
547
|
-
severity: binding_1.JsRspackSeverity.Warn
|
|
548
|
-
});
|
|
525
|
+
const title = "Module Warning";
|
|
526
|
+
const message = warning instanceof Error ? (0, util_2.concatErrorMsgAndStack)(warning) : warning;
|
|
527
|
+
compiler._lastCompilation.__internal__pushDiagnostic("warning", title, `${message}\n(from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`);
|
|
549
528
|
};
|
|
550
529
|
loaderContext.emitFile = function emitFile(name, content, sourceMap, assetInfo) {
|
|
551
530
|
let source;
|
|
@@ -277,23 +277,13 @@ const SORTERS = {
|
|
|
277
277
|
_: comparators => {
|
|
278
278
|
comparators.push((0, comparators_1.compareSelect)((c) => c.id, compareIds));
|
|
279
279
|
}
|
|
280
|
-
}
|
|
280
|
+
}
|
|
281
281
|
// "compilation.modules": MODULES_SORTER,
|
|
282
282
|
// "chunk.rootModules": MODULES_SORTER,
|
|
283
283
|
// "chunk.modules": MODULES_SORTER,
|
|
284
284
|
// "module.modules": MODULES_SORTER,
|
|
285
285
|
// not support module.reasons (missing Module.identifier())
|
|
286
|
-
|
|
287
|
-
_: comparators => {
|
|
288
|
-
comparators.push(
|
|
289
|
-
// compareSelect(
|
|
290
|
-
// origin =>
|
|
291
|
-
// origin.module ? chunkGraph.getModuleId(origin.module) : undefined,
|
|
292
|
-
// compareIds
|
|
293
|
-
// ),
|
|
294
|
-
(0, comparators_1.compareSelect)((origin) => origin.loc, compareIds), (0, comparators_1.compareSelect)((origin) => origin.request, compareIds));
|
|
295
|
-
}
|
|
296
|
-
}
|
|
286
|
+
// not support chunk.origins (missing compilation.chunkGraph)
|
|
297
287
|
};
|
|
298
288
|
const SIMPLE_EXTRACTORS = {
|
|
299
289
|
compilation: {
|
|
@@ -718,10 +708,6 @@ const SIMPLE_EXTRACTORS = {
|
|
|
718
708
|
object.files = chunk.files;
|
|
719
709
|
object.auxiliaryFiles = chunk.auxiliaryFiles;
|
|
720
710
|
object.childrenByOrder = chunk.childrenByOrder;
|
|
721
|
-
object.runtime = chunk.runtime;
|
|
722
|
-
object.sizes = Object.fromEntries(chunk.sizes.map(({ sourceType, size }) => [sourceType, size]));
|
|
723
|
-
object.reason = chunk.reason;
|
|
724
|
-
object.rendered = chunk.rendered;
|
|
725
711
|
},
|
|
726
712
|
ids: (object, chunk) => {
|
|
727
713
|
object.id = chunk.id;
|
|
@@ -734,9 +720,6 @@ const SIMPLE_EXTRACTORS = {
|
|
|
734
720
|
chunkModules: (object, chunk, context, options, factory) => {
|
|
735
721
|
const { type } = context;
|
|
736
722
|
object.modules = factory.create(`${type}.modules`, chunk.modules, context);
|
|
737
|
-
},
|
|
738
|
-
chunkOrigins: (object, chunk, context, options, factory) => {
|
|
739
|
-
object.origins = chunk.origins;
|
|
740
723
|
}
|
|
741
724
|
}
|
|
742
725
|
};
|
|
@@ -357,13 +357,13 @@ const SIMPLE_PRINTERS = {
|
|
|
357
357
|
// chunkEntry ? formatFlag("entry") : undefined,
|
|
358
358
|
// "error.chunkInitial": (chunkInitial, { formatFlag }) =>
|
|
359
359
|
// chunkInitial ? formatFlag("initial") : undefined,
|
|
360
|
-
"error.file": (file, { bold }) => bold(file),
|
|
360
|
+
// "error.file": (file, { bold }) => bold(file),
|
|
361
361
|
"error.moduleName": (moduleName, { bold }) => {
|
|
362
362
|
return moduleName.includes("!")
|
|
363
363
|
? `${bold(moduleName.replace(/^(\s|\S)*!/, ""))} (${moduleName})`
|
|
364
364
|
: `${bold(moduleName)}`;
|
|
365
365
|
},
|
|
366
|
-
"error.loc": (loc, { green }) => green(loc),
|
|
366
|
+
// "error.loc": (loc, { green }) => green(loc),
|
|
367
367
|
"error.message": (message, { bold, formatError }) => message.includes("\u001b[") ? message : bold(formatError(message)),
|
|
368
368
|
// "error.details": (details, { formatError }) => formatError(details),
|
|
369
369
|
// "error.stack": stack => stack,
|
|
@@ -3,9 +3,7 @@ import type { Compilation, NormalizedStatsOptions } from "../Compilation";
|
|
|
3
3
|
import { type Comparator } from "../util/comparators";
|
|
4
4
|
import type { StatsFactory, StatsFactoryContext } from "./StatsFactory";
|
|
5
5
|
export type KnownStatsChunkGroup = binding.JsStatsChunkGroup;
|
|
6
|
-
export type KnownStatsChunk =
|
|
7
|
-
sizes: Record<string, number>;
|
|
8
|
-
};
|
|
6
|
+
export type KnownStatsChunk = binding.JsStatsChunk;
|
|
9
7
|
export type StatsChunkGroup = binding.JsStatsChunkGroup & Record<string, any>;
|
|
10
8
|
export type KnownStatsAsset = binding.JsStatsAsset;
|
|
11
9
|
export type StatsAsset = KnownStatsAsset & Record<string, any>;
|
|
@@ -97,7 +95,7 @@ export type SimpleExtractors = {
|
|
|
97
95
|
moduleIssuer: ExtractorsByOption<binding.JsStatsModuleIssuer, StatsModuleIssuer>;
|
|
98
96
|
profile: ExtractorsByOption<binding.JsStatsModuleProfile, StatsProfile>;
|
|
99
97
|
moduleReason: ExtractorsByOption<binding.JsStatsModuleReason, StatsModuleReason>;
|
|
100
|
-
chunk: ExtractorsByOption<
|
|
98
|
+
chunk: ExtractorsByOption<StatsChunk, KnownStatsChunk>;
|
|
101
99
|
};
|
|
102
100
|
export declare const uniqueArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>) => I[];
|
|
103
101
|
export declare const uniqueOrderedArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>, comparator: Comparator) => I[];
|
package/dist/util/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { JsStatsError } from "@rspack/binding";
|
|
3
3
|
import { LoaderObject } from "../loader-runner";
|
|
4
4
|
export declare function mapValues(record: Record<string, string>, fn: (key: string) => string): {
|
|
5
5
|
[k: string]: string;
|
|
@@ -10,7 +10,7 @@ export declare const toObject: (input: string | Buffer | object) => object;
|
|
|
10
10
|
export declare function serializeObject(map: string | object | undefined | null): Buffer | undefined;
|
|
11
11
|
export declare function isPromiseLike(value: unknown): value is Promise<any>;
|
|
12
12
|
export declare function isJsStatsError(err: any): err is JsStatsError;
|
|
13
|
-
export declare function concatErrorMsgAndStack(err: Error |
|
|
13
|
+
export declare function concatErrorMsgAndStack(err: Error | JsStatsError | string): string;
|
|
14
14
|
export declare function indent(str: string, prefix: string): string;
|
|
15
15
|
export declare function stringifyLoaderObject(o: LoaderObject): string;
|
|
16
16
|
export declare function asArray<T>(item: T[]): T[];
|
package/dist/util/index.js
CHANGED
|
@@ -61,13 +61,12 @@ function isJsStatsError(err) {
|
|
|
61
61
|
exports.isJsStatsError = isJsStatsError;
|
|
62
62
|
function concatErrorMsgAndStack(err) {
|
|
63
63
|
if (typeof err === "string") {
|
|
64
|
-
return
|
|
64
|
+
return err;
|
|
65
65
|
}
|
|
66
66
|
if ("stack" in err) {
|
|
67
|
-
|
|
68
|
-
return err;
|
|
67
|
+
return err.stack || err.message;
|
|
69
68
|
}
|
|
70
|
-
return err;
|
|
69
|
+
return err.message;
|
|
71
70
|
}
|
|
72
71
|
exports.concatErrorMsgAndStack = concatErrorMsgAndStack;
|
|
73
72
|
function indent(str, prefix) {
|
package/dist/util/memoize.js
CHANGED
|
@@ -37,11 +37,7 @@ function memoizeValue(fn) {
|
|
|
37
37
|
const getValue = (0, exports.memoize)(fn);
|
|
38
38
|
return new Proxy({}, {
|
|
39
39
|
get(_, property) {
|
|
40
|
-
|
|
41
|
-
if (typeof res === "function") {
|
|
42
|
-
res = res.bind(getValue());
|
|
43
|
-
}
|
|
44
|
-
return res;
|
|
40
|
+
return getValue()[property];
|
|
45
41
|
},
|
|
46
42
|
set(_, property, newValue) {
|
|
47
43
|
getValue()[property] = newValue;
|
package/package.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.7.5
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"publishConfig": {
|
|
10
|
-
"access": "public",
|
|
11
|
-
"provenance": true
|
|
12
|
-
},
|
|
13
9
|
"exports": {
|
|
14
10
|
".": {
|
|
15
11
|
"default": "./dist/index.js"
|
|
@@ -78,15 +74,15 @@
|
|
|
78
74
|
"watchpack": "^2.4.0",
|
|
79
75
|
"zod": "^3.21.4",
|
|
80
76
|
"zod-validation-error": "1.3.1",
|
|
81
|
-
"@rspack/
|
|
82
|
-
"@rspack/
|
|
77
|
+
"@rspack/core": "0.7.5",
|
|
78
|
+
"@rspack/plugin-minify": "^0.7.5"
|
|
83
79
|
},
|
|
84
80
|
"dependencies": {
|
|
85
81
|
"@module-federation/runtime-tools": "0.1.6",
|
|
86
82
|
"caniuse-lite": "^1.0.30001616",
|
|
87
83
|
"tapable": "2.2.1",
|
|
88
84
|
"webpack-sources": "3.2.3",
|
|
89
|
-
"@rspack/binding": "0.7.5
|
|
85
|
+
"@rspack/binding": "0.7.5"
|
|
90
86
|
},
|
|
91
87
|
"peerDependencies": {
|
|
92
88
|
"@swc/helpers": ">=0.5.1"
|
package/dist/RspackError.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as binding from "@rspack/binding";
|
|
2
|
-
export type RspackError = binding.JsRspackError;
|
|
3
|
-
export declare class JsDiagnostic {
|
|
4
|
-
static __to_binding(error: Error | RspackError, severity: binding.JsRspackSeverity): binding.JsDiagnostic;
|
|
5
|
-
}
|
|
6
|
-
export declare class NonErrorEmittedError extends Error {
|
|
7
|
-
constructor(error: Error);
|
|
8
|
-
}
|
package/dist/RspackError.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NonErrorEmittedError = exports.JsDiagnostic = void 0;
|
|
4
|
-
const util_1 = require("./util");
|
|
5
|
-
class JsDiagnostic {
|
|
6
|
-
static __to_binding(error, severity) {
|
|
7
|
-
return {
|
|
8
|
-
error: (0, util_1.concatErrorMsgAndStack)(error),
|
|
9
|
-
severity
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.JsDiagnostic = JsDiagnostic;
|
|
14
|
-
class NonErrorEmittedError extends Error {
|
|
15
|
-
constructor(error) {
|
|
16
|
-
super();
|
|
17
|
-
this.name = "NonErrorEmittedError";
|
|
18
|
-
this.message = "(Emitted value instead of an instance of Error) " + error;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.NonErrorEmittedError = NonErrorEmittedError;
|