@rspack/core 0.6.3-canary-332b127-20240424004510 → 0.6.3-canary-0c04972-20240426004546
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/css-extract/index.js +1 -3
- package/dist/config/adapter.js +23 -2
- package/dist/config/defaults.js +23 -4
- package/dist/config/normalization.d.ts +1 -0
- package/dist/config/normalization.js +1 -0
- package/dist/config/zod.d.ts +668 -0
- package/dist/config/zod.js +11 -2
- package/package.json +4 -4
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;
|
|
@@ -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
|
}
|
package/dist/config/adapter.js
CHANGED
|
@@ -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) {
|
package/dist/config/defaults.js
CHANGED
|
@@ -67,6 +67,7 @@ const applyRspackOptionsDefaults = (options) => {
|
|
|
67
67
|
(Array.isArray(target) &&
|
|
68
68
|
target.some(target => target.startsWith("browserslist"))),
|
|
69
69
|
outputModule: options.experiments.outputModule,
|
|
70
|
+
development,
|
|
70
71
|
entry: options.entry,
|
|
71
72
|
futureDefaults
|
|
72
73
|
});
|
|
@@ -88,6 +89,7 @@ const applyRspackOptionsDefaults = (options) => {
|
|
|
88
89
|
css: options.experiments.css
|
|
89
90
|
});
|
|
90
91
|
options.resolve = (0, cleverMerge_1.cleverMerge)(getResolveDefaults({
|
|
92
|
+
context: options.context,
|
|
91
93
|
targetProperties,
|
|
92
94
|
mode: options.mode,
|
|
93
95
|
css: options.experiments.css
|
|
@@ -132,8 +134,14 @@ const applySnapshotDefaults = (snapshot, { production }) => {
|
|
|
132
134
|
? { timestamp: true, hash: true }
|
|
133
135
|
: { timestamp: true, hash: false });
|
|
134
136
|
};
|
|
135
|
-
const applyJavascriptParserOptionsDefaults = (parserOptions) => {
|
|
136
|
-
|
|
137
|
+
const applyJavascriptParserOptionsDefaults = (parserOptions, fallback) => {
|
|
138
|
+
var _a, _b, _c, _d, _e, _f;
|
|
139
|
+
D(parserOptions, "dynamicImportMode", (_a = fallback === null || fallback === void 0 ? void 0 : fallback.dynamicImportMode) !== null && _a !== void 0 ? _a : "lazy");
|
|
140
|
+
D(parserOptions, "dynamicImportPrefetch", (_b = fallback === null || fallback === void 0 ? void 0 : fallback.dynamicImportPrefetch) !== null && _b !== void 0 ? _b : false);
|
|
141
|
+
D(parserOptions, "dynamicImportPreload", (_c = fallback === null || fallback === void 0 ? void 0 : fallback.dynamicImportPreload) !== null && _c !== void 0 ? _c : false);
|
|
142
|
+
D(parserOptions, "url", (_d = fallback === null || fallback === void 0 ? void 0 : fallback.url) !== null && _d !== void 0 ? _d : true);
|
|
143
|
+
D(parserOptions, "exprContextCritical", (_e = fallback === null || fallback === void 0 ? void 0 : fallback.exprContextCritical) !== null && _e !== void 0 ? _e : true);
|
|
144
|
+
D(parserOptions, "wrappedContextCritical", (_f = fallback === null || fallback === void 0 ? void 0 : fallback.wrappedContextCritical) !== null && _f !== void 0 ? _f : false);
|
|
137
145
|
};
|
|
138
146
|
const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }) => {
|
|
139
147
|
(0, assertNotNil_1.assertNotNill)(module.parser);
|
|
@@ -147,6 +155,15 @@ const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }
|
|
|
147
155
|
F(module.parser, "javascript", () => ({}));
|
|
148
156
|
(0, assertNotNil_1.assertNotNill)(module.parser.javascript);
|
|
149
157
|
applyJavascriptParserOptionsDefaults(module.parser.javascript);
|
|
158
|
+
F(module.parser, "javascript/auto", () => ({}));
|
|
159
|
+
(0, assertNotNil_1.assertNotNill)(module.parser["javascript/auto"]);
|
|
160
|
+
applyJavascriptParserOptionsDefaults(module.parser["javascript/auto"], module.parser.javascript);
|
|
161
|
+
F(module.parser, "javascript/dynamic", () => ({}));
|
|
162
|
+
(0, assertNotNil_1.assertNotNill)(module.parser["javascript/dynamic"]);
|
|
163
|
+
applyJavascriptParserOptionsDefaults(module.parser["javascript/dynamic"], module.parser.javascript);
|
|
164
|
+
F(module.parser, "javascript/esm", () => ({}));
|
|
165
|
+
(0, assertNotNil_1.assertNotNill)(module.parser["javascript/esm"]);
|
|
166
|
+
applyJavascriptParserOptionsDefaults(module.parser["javascript/esm"], module.parser.javascript);
|
|
150
167
|
if (css) {
|
|
151
168
|
F(module.parser, "css", () => ({}));
|
|
152
169
|
(0, assertNotNil_1.assertNotNill)(module.parser.css);
|
|
@@ -287,7 +304,7 @@ const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }
|
|
|
287
304
|
return rules;
|
|
288
305
|
});
|
|
289
306
|
};
|
|
290
|
-
const applyOutputDefaults = (output, { context, outputModule, targetProperties: tp, isAffectedByBrowserslist, entry, futureDefaults }) => {
|
|
307
|
+
const applyOutputDefaults = (output, { context, outputModule, targetProperties: tp, isAffectedByBrowserslist, development, entry, futureDefaults }) => {
|
|
291
308
|
const getLibraryName = (library) => {
|
|
292
309
|
const libraryName = typeof library === "object" &&
|
|
293
310
|
library &&
|
|
@@ -371,6 +388,7 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
371
388
|
D(output, "assetModuleFilename", "[hash][ext][query]");
|
|
372
389
|
D(output, "webassemblyModuleFilename", "[hash].module.wasm");
|
|
373
390
|
F(output, "path", () => path_1.default.join(process.cwd(), "dist"));
|
|
391
|
+
F(output, "pathinfo", () => development);
|
|
374
392
|
D(output, "publicPath", tp && (tp.document || tp.importScripts) ? "auto" : "");
|
|
375
393
|
D(output, "hashFunction", futureDefaults ? "xxhash64" : "md4");
|
|
376
394
|
D(output, "hashDigest", "hex");
|
|
@@ -660,7 +678,7 @@ const getResolveLoaderDefaults = () => {
|
|
|
660
678
|
};
|
|
661
679
|
// The values are aligned with webpack
|
|
662
680
|
// https://github.com/webpack/webpack/blob/b9fb99c63ca433b24233e0bbc9ce336b47872c08/lib/config/defaults.js#L1431
|
|
663
|
-
const getResolveDefaults = ({ targetProperties, mode, css }) => {
|
|
681
|
+
const getResolveDefaults = ({ context, targetProperties, mode, css }) => {
|
|
664
682
|
const conditions = ["webpack"];
|
|
665
683
|
conditions.push(mode === "development" ? "development" : "production");
|
|
666
684
|
if (targetProperties) {
|
|
@@ -701,6 +719,7 @@ const getResolveDefaults = ({ targetProperties, mode, css }) => {
|
|
|
701
719
|
extensions: [],
|
|
702
720
|
aliasFields: [],
|
|
703
721
|
exportsFields: ["exports"],
|
|
722
|
+
roots: [context],
|
|
704
723
|
mainFields: ["main"],
|
|
705
724
|
byDependency: {
|
|
706
725
|
wasm: esmDeps(),
|