@rspack/core 0.6.3 → 0.6.4-canary-010ffa6-20240507093348
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 +3 -26
- package/dist/Compilation.js +165 -52
- package/dist/Compiler.js +15 -13
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +11 -0
- package/dist/builtin-plugin/DynamicEntryPlugin.js +25 -0
- package/dist/builtin-plugin/EntryPlugin.d.ts +2 -1
- package/dist/builtin-plugin/EntryPlugin.js +3 -2
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +11 -0
- package/dist/builtin-plugin/RuntimeChunkPlugin.js +6 -0
- package/dist/builtin-plugin/css-extract/index.js +1 -3
- package/dist/builtin-plugin/index.d.ts +2 -0
- package/dist/builtin-plugin/index.js +2 -0
- package/dist/config/adapter.d.ts +1 -2
- package/dist/config/adapter.js +24 -7
- package/dist/config/defaults.js +44 -10
- package/dist/config/normalization.d.ts +6 -2
- package/dist/config/normalization.js +12 -8
- package/dist/config/zod.d.ts +725 -15
- package/dist/config/zod.js +15 -3
- package/dist/container/ContainerPlugin.js +1 -2
- package/dist/container/ModuleFederationPluginV1.js +2 -0
- package/dist/exports.d.ts +5 -0
- package/dist/exports.js +24 -21
- package/dist/lib/EntryOptionPlugin.js +1 -3
- package/dist/rspackOptionsApply.js +1 -5
- package/hot/emitter.js +20 -1
- package/package.json +4 -6
package/dist/Compilation.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as tapable from "tapable";
|
|
12
12
|
import { Source } from "webpack-sources";
|
|
13
|
-
import type { ExternalObject, JsAssetInfo, JsCompilation, JsModule, JsRuntimeModule, JsStatsChunk,
|
|
13
|
+
import type { ExternalObject, JsAssetInfo, JsCompilation, JsModule, JsRuntimeModule, JsStatsChunk, JsPathData, JsStatsWarning } from "@rspack/binding";
|
|
14
14
|
import { RspackOptionsNormalized, StatsOptions, OutputNormalized, StatsValue, RspackPluginInstance, Filename } from "./config";
|
|
15
15
|
import * as liteTapable from "./lite-tapable";
|
|
16
16
|
import { ContextModuleFactory } from "./ContextModuleFactory";
|
|
@@ -162,31 +162,8 @@ export declare class Compilation {
|
|
|
162
162
|
getAsset(name: string): Asset | void;
|
|
163
163
|
pushDiagnostic(severity: "error" | "warning", title: string, message: string): void;
|
|
164
164
|
__internal__pushNativeDiagnostics(diagnostics: ExternalObject<any>): void;
|
|
165
|
-
get errors():
|
|
166
|
-
|
|
167
|
-
readonly length: number;
|
|
168
|
-
[Symbol.iterator](): {
|
|
169
|
-
next(): {
|
|
170
|
-
done: boolean;
|
|
171
|
-
value?: undefined;
|
|
172
|
-
} | {
|
|
173
|
-
value: JsStatsError;
|
|
174
|
-
done: boolean;
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
get warnings(): {
|
|
179
|
-
push: (...warns: (Error | JsStatsError)[]) => void;
|
|
180
|
-
[Symbol.iterator](): {
|
|
181
|
-
next(): {
|
|
182
|
-
done: boolean;
|
|
183
|
-
value?: undefined;
|
|
184
|
-
} | {
|
|
185
|
-
value: import("@rspack/binding").JsStatsWarning[];
|
|
186
|
-
done: boolean;
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
};
|
|
165
|
+
get errors(): any;
|
|
166
|
+
get warnings(): JsStatsWarning[];
|
|
190
167
|
getPath(filename: Filename, data?: PathData): string;
|
|
191
168
|
getPathWithInfo(filename: Filename, data?: PathData): import("@rspack/binding").PathWithInfo;
|
|
192
169
|
getAssetPath(filename: Filename, data?: PathData): string;
|
package/dist/Compilation.js
CHANGED
|
@@ -362,72 +362,185 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
362
362
|
}
|
|
363
363
|
get errors() {
|
|
364
364
|
const inner = __classPrivateFieldGet(this, _Compilation_inner, "f");
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
365
|
+
const errors = inner.getStats().getErrors();
|
|
366
|
+
const proxyMethod = [
|
|
367
|
+
{
|
|
368
|
+
method: "push",
|
|
369
|
+
handler(target, thisArg, errs) {
|
|
370
|
+
for (let i = 0; i < errs.length; i++) {
|
|
371
|
+
const error = errs[i];
|
|
372
|
+
if ((0, util_1.isJsStatsError)(error)) {
|
|
373
|
+
inner.pushDiagnostic("error", "Error", (0, util_1.concatErrorMsgAndStack)(error));
|
|
374
|
+
}
|
|
375
|
+
else if (typeof error === "string") {
|
|
376
|
+
inner.pushDiagnostic("error", "Error", error);
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
inner.pushDiagnostic("error", error.name, (0, util_1.concatErrorMsgAndStack)(error));
|
|
380
|
+
}
|
|
378
381
|
}
|
|
382
|
+
return Reflect.apply(target, thisArg, errs);
|
|
379
383
|
}
|
|
380
384
|
},
|
|
381
|
-
|
|
382
|
-
|
|
385
|
+
{
|
|
386
|
+
method: "pop",
|
|
387
|
+
handler(target, thisArg) {
|
|
388
|
+
inner.spliceDiagnostic(errors.length - 1, errors.length, []);
|
|
389
|
+
return Reflect.apply(target, thisArg, []);
|
|
390
|
+
}
|
|
383
391
|
},
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
+
{
|
|
393
|
+
method: "shift",
|
|
394
|
+
handler(target, thisArg) {
|
|
395
|
+
inner.spliceDiagnostic(0, 1, []);
|
|
396
|
+
return Reflect.apply(target, thisArg, []);
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
method: "unshift",
|
|
401
|
+
handler(target, thisArg, errs) {
|
|
402
|
+
const errList = errs.map(error => {
|
|
403
|
+
if ((0, util_1.isJsStatsError)(error)) {
|
|
404
|
+
return {
|
|
405
|
+
severity: "error",
|
|
406
|
+
title: "Error",
|
|
407
|
+
message: (0, util_1.concatErrorMsgAndStack)(error)
|
|
408
|
+
};
|
|
392
409
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
410
|
+
else if (typeof error === "string") {
|
|
411
|
+
return {
|
|
412
|
+
severity: "error",
|
|
413
|
+
title: "Error",
|
|
414
|
+
message: error
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
return {
|
|
419
|
+
severity: "error",
|
|
420
|
+
title: error.name,
|
|
421
|
+
message: (0, util_1.concatErrorMsgAndStack)(error)
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
inner.spliceDiagnostic(0, 0, errList);
|
|
426
|
+
return Reflect.apply(target, thisArg, errs);
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
method: "splice",
|
|
431
|
+
handler(target, thisArg, [startIdx, delCount, ...errors]) {
|
|
432
|
+
const errList = errors.map(error => {
|
|
433
|
+
if ((0, util_1.isJsStatsError)(error)) {
|
|
434
|
+
return {
|
|
435
|
+
severity: "error",
|
|
436
|
+
title: "Error",
|
|
437
|
+
message: (0, util_1.concatErrorMsgAndStack)(error)
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
else if (typeof error === "string") {
|
|
441
|
+
return {
|
|
442
|
+
severity: "error",
|
|
443
|
+
title: "Error",
|
|
444
|
+
message: error
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
return {
|
|
449
|
+
severity: "error",
|
|
450
|
+
title: error.name,
|
|
451
|
+
message: (0, util_1.concatErrorMsgAndStack)(error)
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
inner.spliceDiagnostic(startIdx, startIdx + delCount, errList);
|
|
456
|
+
return Reflect.apply(target, thisArg, [
|
|
457
|
+
startIdx,
|
|
458
|
+
delCount,
|
|
459
|
+
...errors
|
|
460
|
+
]);
|
|
461
|
+
}
|
|
399
462
|
}
|
|
400
|
-
|
|
463
|
+
];
|
|
464
|
+
proxyMethod.forEach(item => {
|
|
465
|
+
const proxyedMethod = new Proxy(errors[item.method], {
|
|
466
|
+
apply: item.handler
|
|
467
|
+
});
|
|
468
|
+
errors[item.method] = proxyedMethod;
|
|
469
|
+
});
|
|
470
|
+
return errors;
|
|
401
471
|
}
|
|
402
472
|
get warnings() {
|
|
403
473
|
const inner = __classPrivateFieldGet(this, _Compilation_inner, "f");
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
474
|
+
const processWarningsHook = this.hooks.processWarnings;
|
|
475
|
+
const warnings = inner.getStats().getWarnings();
|
|
476
|
+
const proxyMethod = [
|
|
477
|
+
{
|
|
478
|
+
method: "push",
|
|
479
|
+
handler(target, thisArg, warns) {
|
|
480
|
+
warns = processWarningsHook.call(warns);
|
|
481
|
+
for (let i = 0; i < warns.length; i++) {
|
|
482
|
+
const warn = warns[i];
|
|
483
|
+
inner.pushDiagnostic("warning", (0, util_1.isJsStatsError)(warn) ? "Warning" : warn.name, (0, util_1.concatErrorMsgAndStack)(warn));
|
|
484
|
+
}
|
|
485
|
+
return Reflect.apply(target, thisArg, warns);
|
|
412
486
|
}
|
|
413
487
|
},
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
488
|
+
{
|
|
489
|
+
method: "pop",
|
|
490
|
+
handler(target, thisArg) {
|
|
491
|
+
inner.spliceDiagnostic(warnings.length - 1, warnings.length, []);
|
|
492
|
+
return Reflect.apply(target, thisArg, []);
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
method: "shift",
|
|
497
|
+
handler(target, thisArg) {
|
|
498
|
+
inner.spliceDiagnostic(0, 1, []);
|
|
499
|
+
return Reflect.apply(target, thisArg, []);
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
method: "unshift",
|
|
504
|
+
handler(target, thisArg, warns) {
|
|
505
|
+
warns = processWarningsHook.call(warns);
|
|
506
|
+
const warnList = warns.map(warn => {
|
|
423
507
|
return {
|
|
424
|
-
|
|
425
|
-
|
|
508
|
+
severity: "warning",
|
|
509
|
+
title: (0, util_1.isJsStatsError)(warn) ? "Warning" : warn.name,
|
|
510
|
+
message: (0, util_1.concatErrorMsgAndStack)(warn)
|
|
426
511
|
};
|
|
427
|
-
}
|
|
428
|
-
|
|
512
|
+
});
|
|
513
|
+
inner.spliceDiagnostic(0, 0, warnList);
|
|
514
|
+
return Reflect.apply(target, thisArg, warns);
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
method: "splice",
|
|
519
|
+
handler(target, thisArg, [startIdx, delCount, ...warns]) {
|
|
520
|
+
warns = processWarningsHook.call(warns);
|
|
521
|
+
const warnList = warns.map(warn => {
|
|
522
|
+
return {
|
|
523
|
+
severity: "warning",
|
|
524
|
+
title: (0, util_1.isJsStatsError)(warn) ? "Warning" : warn.name,
|
|
525
|
+
message: (0, util_1.concatErrorMsgAndStack)(warn)
|
|
526
|
+
};
|
|
527
|
+
});
|
|
528
|
+
inner.spliceDiagnostic(startIdx, startIdx + delCount, warnList);
|
|
529
|
+
return Reflect.apply(target, thisArg, [
|
|
530
|
+
startIdx,
|
|
531
|
+
delCount,
|
|
532
|
+
...warnList
|
|
533
|
+
]);
|
|
534
|
+
}
|
|
429
535
|
}
|
|
430
|
-
|
|
536
|
+
];
|
|
537
|
+
proxyMethod.forEach(item => {
|
|
538
|
+
const proxyedMethod = new Proxy(warnings[item.method], {
|
|
539
|
+
apply: item.handler
|
|
540
|
+
});
|
|
541
|
+
warnings[item.method] = proxyedMethod;
|
|
542
|
+
});
|
|
543
|
+
return warnings;
|
|
431
544
|
}
|
|
432
545
|
getPath(filename, data = {}) {
|
|
433
546
|
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPath(filename, data);
|
package/dist/Compiler.js
CHANGED
|
@@ -496,19 +496,21 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
496
496
|
registerCompilerShouldEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerShouldEmit, () => this.hooks.shouldEmit, queried => () => queried.call(this.compilation)),
|
|
497
497
|
registerCompilerEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerEmit, () => this.hooks.emit, queried => async () => await queried.promise(this.compilation)),
|
|
498
498
|
registerCompilerAfterEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerAfterEmit, () => this.hooks.afterEmit, queried => async () => await queried.promise(this.compilation)),
|
|
499
|
-
registerCompilerAssetEmittedTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerAssetEmitted, () => this.hooks.assetEmitted, queried => async ({ filename, targetPath, outputPath }) =>
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
499
|
+
registerCompilerAssetEmittedTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerAssetEmitted, () => this.hooks.assetEmitted, queried => async ({ filename, targetPath, outputPath }) => {
|
|
500
|
+
return queried.promise(filename, {
|
|
501
|
+
compilation: this.compilation,
|
|
502
|
+
targetPath,
|
|
503
|
+
outputPath,
|
|
504
|
+
get source() {
|
|
505
|
+
var _a;
|
|
506
|
+
return (_a = this.compilation.getAsset(filename)) === null || _a === void 0 ? void 0 : _a.source;
|
|
507
|
+
},
|
|
508
|
+
get content() {
|
|
509
|
+
var _a;
|
|
510
|
+
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.buffer();
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
}),
|
|
512
514
|
registerCompilationRuntimeModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationRuntimeModule, () => this.compilation.hooks.runtimeModule, queried => ({ module, chunk }) => {
|
|
513
515
|
var _a, _b;
|
|
514
516
|
const originSource = (_a = module.source) === null || _a === void 0 ? void 0 : _a.source;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BuiltinPluginName, RawDynamicEntryPluginOptions } from "@rspack/binding";
|
|
2
|
+
import { EntryDynamicNormalized } from "../config";
|
|
3
|
+
export declare const DynamicEntryPlugin: {
|
|
4
|
+
new (context: string, entry: EntryDynamicNormalized): {
|
|
5
|
+
name: BuiltinPluginName;
|
|
6
|
+
_options: RawDynamicEntryPluginOptions;
|
|
7
|
+
affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
8
|
+
raw(): import("@rspack/binding").BuiltinPlugin;
|
|
9
|
+
apply(compiler: import("../Compiler").Compiler): void;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DynamicEntryPlugin = void 0;
|
|
7
|
+
const binding_1 = require("@rspack/binding");
|
|
8
|
+
const base_1 = require("./base");
|
|
9
|
+
const EntryOptionPlugin_1 = __importDefault(require("../lib/EntryOptionPlugin"));
|
|
10
|
+
const EntryPlugin_1 = require("./EntryPlugin");
|
|
11
|
+
exports.DynamicEntryPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.DynamicEntryPlugin, (context, entry) => {
|
|
12
|
+
return {
|
|
13
|
+
context,
|
|
14
|
+
entry: async () => {
|
|
15
|
+
const result = await entry();
|
|
16
|
+
return Object.entries(result).map(([name, desc]) => {
|
|
17
|
+
const options = EntryOptionPlugin_1.default.entryDescriptionToOptions({}, name, desc);
|
|
18
|
+
return {
|
|
19
|
+
import: desc.import,
|
|
20
|
+
options: (0, EntryPlugin_1.getRawEntryOptions)(options)
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}, "make");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuiltinPluginName, RawEntryPluginOptions } from "@rspack/binding";
|
|
1
|
+
import { BuiltinPluginName, RawEntryOptions, RawEntryPluginOptions } from "@rspack/binding";
|
|
2
2
|
import { ChunkLoading, EntryRuntime, FilenameTemplate, LibraryOptions, PublicPath } from "../config";
|
|
3
3
|
export type EntryOptions = {
|
|
4
4
|
name?: string;
|
|
@@ -20,3 +20,4 @@ export declare const EntryPlugin: {
|
|
|
20
20
|
apply(compiler: import("../Compiler").Compiler): void;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
+
export declare function getRawEntryOptions(entry: EntryOptions): RawEntryOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EntryPlugin = void 0;
|
|
3
|
+
exports.getRawEntryOptions = exports.EntryPlugin = void 0;
|
|
4
4
|
const binding_1 = require("@rspack/binding");
|
|
5
5
|
const base_1 = require("./base");
|
|
6
6
|
const config_1 = require("../config");
|
|
@@ -20,7 +20,7 @@ function getRawEntryOptions(entry) {
|
|
|
20
20
|
name: entry.name,
|
|
21
21
|
publicPath: entry.publicPath,
|
|
22
22
|
baseUri: entry.baseUri,
|
|
23
|
-
runtime
|
|
23
|
+
runtime,
|
|
24
24
|
chunkLoading: !(0, util_1.isNil)(chunkLoading)
|
|
25
25
|
? (0, config_1.getRawChunkLoading)(chunkLoading)
|
|
26
26
|
: undefined,
|
|
@@ -30,3 +30,4 @@ function getRawEntryOptions(entry) {
|
|
|
30
30
|
dependOn: entry.dependOn
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
+
exports.getRawEntryOptions = getRawEntryOptions;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BuiltinPluginName, RawRuntimeChunkOptions } from "@rspack/binding";
|
|
2
|
+
export type RuntimeChunkPluginOptions = RawRuntimeChunkOptions;
|
|
3
|
+
export declare const RuntimeChunkPlugin: {
|
|
4
|
+
new (options: RawRuntimeChunkOptions): {
|
|
5
|
+
name: BuiltinPluginName;
|
|
6
|
+
_options: RawRuntimeChunkOptions;
|
|
7
|
+
affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
8
|
+
raw(): import("@rspack/binding").BuiltinPlugin;
|
|
9
|
+
apply(compiler: import("../Compiler").Compiler): void;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuntimeChunkPlugin = void 0;
|
|
4
|
+
const binding_1 = require("@rspack/binding");
|
|
5
|
+
const base_1 = require("./base");
|
|
6
|
+
exports.RuntimeChunkPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.RuntimeChunkPlugin, (options) => options, "thisCompilation");
|
|
@@ -32,9 +32,7 @@ class CssExtractRspackPlugin {
|
|
|
32
32
|
splitChunks.defaultSizeTypes.push(loader_1.MODULE_TYPE);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
if (
|
|
36
|
-
// @ts-expect-error rspack don't support pathinfo for now
|
|
37
|
-
compiler.options.output.pathinfo &&
|
|
35
|
+
if (compiler.options.output.pathinfo &&
|
|
38
36
|
this.options.pathinfo === undefined) {
|
|
39
37
|
this.options.pathinfo = true;
|
|
40
38
|
}
|
|
@@ -5,6 +5,7 @@ export * from "./BannerPlugin";
|
|
|
5
5
|
export * from "./IgnorePlugin";
|
|
6
6
|
export * from "./ProgressPlugin";
|
|
7
7
|
export * from "./EntryPlugin";
|
|
8
|
+
export * from "./DynamicEntryPlugin";
|
|
8
9
|
export * from "./ExternalsPlugin";
|
|
9
10
|
export * from "./NodeTargetPlugin";
|
|
10
11
|
export * from "./ElectronTargetPlugin";
|
|
@@ -49,6 +50,7 @@ export * from "./BundlerInfoRspackPlugin";
|
|
|
49
50
|
export * from "./ModuleConcatenationPlugin";
|
|
50
51
|
export * from "./CssModulesPlugin";
|
|
51
52
|
export * from "./APIPlugin";
|
|
53
|
+
export * from "./RuntimeChunkPlugin";
|
|
52
54
|
export * from "./HtmlRspackPlugin";
|
|
53
55
|
export * from "./CopyRspackPlugin";
|
|
54
56
|
export * from "./SwcJsMinimizerPlugin";
|
|
@@ -23,6 +23,7 @@ __exportStar(require("./BannerPlugin"), exports);
|
|
|
23
23
|
__exportStar(require("./IgnorePlugin"), exports);
|
|
24
24
|
__exportStar(require("./ProgressPlugin"), exports);
|
|
25
25
|
__exportStar(require("./EntryPlugin"), exports);
|
|
26
|
+
__exportStar(require("./DynamicEntryPlugin"), exports);
|
|
26
27
|
__exportStar(require("./ExternalsPlugin"), exports);
|
|
27
28
|
__exportStar(require("./NodeTargetPlugin"), exports);
|
|
28
29
|
__exportStar(require("./ElectronTargetPlugin"), exports);
|
|
@@ -67,6 +68,7 @@ __exportStar(require("./BundlerInfoRspackPlugin"), exports);
|
|
|
67
68
|
__exportStar(require("./ModuleConcatenationPlugin"), exports);
|
|
68
69
|
__exportStar(require("./CssModulesPlugin"), exports);
|
|
69
70
|
__exportStar(require("./APIPlugin"), exports);
|
|
71
|
+
__exportStar(require("./RuntimeChunkPlugin"), exports);
|
|
70
72
|
__exportStar(require("./HtmlRspackPlugin"), exports);
|
|
71
73
|
__exportStar(require("./CopyRspackPlugin"), exports);
|
|
72
74
|
__exportStar(require("./SwcJsMinimizerPlugin"), exports);
|
package/dist/config/adapter.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { RawOptions, RawLibraryOptions } from "@rspack/binding";
|
|
2
2
|
import { Compiler } from "../Compiler";
|
|
3
3
|
import { LoaderContext, LoaderDefinition, LoaderDefinitionFunction } from "./adapterRuleUse";
|
|
4
|
-
import { LibraryOptions,
|
|
4
|
+
import { LibraryOptions, ChunkLoading } from "./zod";
|
|
5
5
|
import { RspackOptionsNormalized } from "./normalization";
|
|
6
6
|
export type { LoaderContext, LoaderDefinition, LoaderDefinitionFunction };
|
|
7
7
|
export declare const getRawOptions: (options: RspackOptionsNormalized, compiler: Compiler) => RawOptions;
|
|
8
8
|
export declare function getRawLibrary(library: LibraryOptions): RawLibraryOptions;
|
|
9
|
-
export declare function getRawEntryRuntime(runtime: EntryRuntime): string | undefined;
|
|
10
9
|
export declare function getRawChunkLoading(chunkLoading: ChunkLoading): string;
|
package/dist/config/adapter.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getRawChunkLoading = exports.
|
|
6
|
+
exports.getRawChunkLoading = exports.getRawLibrary = exports.getRawOptions = void 0;
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
8
|
const Stats_1 = require("../Stats");
|
|
9
9
|
const util_1 = require("../util");
|
|
@@ -118,6 +118,7 @@ function getRawOutput(output) {
|
|
|
118
118
|
const workerWasmLoading = output.workerWasmLoading;
|
|
119
119
|
return {
|
|
120
120
|
path: output.path,
|
|
121
|
+
pathinfo: output.pathinfo,
|
|
121
122
|
publicPath: output.publicPath,
|
|
122
123
|
clean: output.clean,
|
|
123
124
|
assetModuleFilename: output.assetModuleFilename,
|
|
@@ -409,6 +410,24 @@ function getRawParserOptions(parser, type) {
|
|
|
409
410
|
javascript: getRawJavascriptParserOptions(parser)
|
|
410
411
|
};
|
|
411
412
|
}
|
|
413
|
+
else if (type === "javascript/auto") {
|
|
414
|
+
return {
|
|
415
|
+
type: "javascript/auto",
|
|
416
|
+
javascript: getRawJavascriptParserOptions(parser)
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
else if (type === "javascript/dynamic") {
|
|
420
|
+
return {
|
|
421
|
+
type: "javascript/dynamic",
|
|
422
|
+
javascript: getRawJavascriptParserOptions(parser)
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
else if (type === "javascript/esm") {
|
|
426
|
+
return {
|
|
427
|
+
type: "javascript/esm",
|
|
428
|
+
javascript: getRawJavascriptParserOptions(parser)
|
|
429
|
+
};
|
|
430
|
+
}
|
|
412
431
|
else if (type === "css") {
|
|
413
432
|
return {
|
|
414
433
|
type: "css",
|
|
@@ -431,7 +450,7 @@ function getRawParserOptions(parser, type) {
|
|
|
431
450
|
throw new Error(`unreachable: unknow module type: ${type}`);
|
|
432
451
|
}
|
|
433
452
|
function getRawJavascriptParserOptions(parser) {
|
|
434
|
-
var _a, _b, _c, _d, _e;
|
|
453
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
435
454
|
return {
|
|
436
455
|
dynamicImportMode: (_a = parser.dynamicImportMode) !== null && _a !== void 0 ? _a : "lazy",
|
|
437
456
|
dynamicImportPreload: (_c = (_b = parser.dynamicImportPreload) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "false",
|
|
@@ -440,7 +459,9 @@ function getRawJavascriptParserOptions(parser) {
|
|
|
440
459
|
? "false"
|
|
441
460
|
: parser.url === "relative"
|
|
442
461
|
? parser.url
|
|
443
|
-
: "true"
|
|
462
|
+
: "true",
|
|
463
|
+
exprContextCritical: (_f = parser.exprContextCritical) !== null && _f !== void 0 ? _f : true,
|
|
464
|
+
wrappedContextCritical: (_g = parser.wrappedContextCritical) !== null && _g !== void 0 ? _g : false
|
|
444
465
|
};
|
|
445
466
|
}
|
|
446
467
|
function getRawAssetParserOptions(parser) {
|
|
@@ -626,10 +647,6 @@ function getRawStats(stats) {
|
|
|
626
647
|
colors: (_a = statsOptions.colors) !== null && _a !== void 0 ? _a : false
|
|
627
648
|
};
|
|
628
649
|
}
|
|
629
|
-
function getRawEntryRuntime(runtime) {
|
|
630
|
-
return runtime === false ? undefined : runtime;
|
|
631
|
-
}
|
|
632
|
-
exports.getRawEntryRuntime = getRawEntryRuntime;
|
|
633
650
|
function getRawChunkLoading(chunkLoading) {
|
|
634
651
|
return chunkLoading === false ? "false" : chunkLoading;
|
|
635
652
|
}
|