@rspack/core 1.0.8 → 1.0.10
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 +2 -1
- package/dist/Chunk.js +8 -0
- package/dist/Compilation.d.ts +20 -5
- package/dist/Compilation.js +24 -4
- package/dist/Compiler.js +10 -5
- package/dist/DependenciesBlock.js +1 -1
- package/dist/Dependency.d.ts +7 -6
- package/dist/Dependency.js +35 -24
- package/dist/Module.d.ts +19 -17
- package/dist/Module.js +132 -49
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +3 -58
- package/dist/config/adapter.js +5 -1
- package/dist/config/defaults.js +4 -0
- package/dist/config/types.d.ts +529 -0
- package/dist/config/types.js +3 -0
- package/dist/config/zod.d.ts +1183 -3011
- package/dist/config/zod.js +51 -13
- package/dist/container/ContainerPlugin.d.ts +2 -18
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/loader-runner/index.js +1 -1
- package/package.json +2 -2
package/dist/Chunk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type JsChunk, type JsCompilation } from "@rspack/binding";
|
|
1
|
+
import { type JsChunk, type JsChunkPathData, type JsCompilation } from "@rspack/binding";
|
|
2
2
|
import { Compilation } from ".";
|
|
3
3
|
import { ChunkGroup } from "./ChunkGroup";
|
|
4
4
|
export declare class Chunk {
|
|
@@ -37,4 +37,5 @@ export declare class Chunk {
|
|
|
37
37
|
* @internal
|
|
38
38
|
*/
|
|
39
39
|
__internal__innerUkey(): number;
|
|
40
|
+
__internal_to_path_data_chunk(): JsChunkPathData;
|
|
40
41
|
}
|
package/dist/Chunk.js
CHANGED
|
@@ -105,6 +105,14 @@ class Chunk {
|
|
|
105
105
|
__internal__innerUkey() {
|
|
106
106
|
return __classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey;
|
|
107
107
|
}
|
|
108
|
+
__internal_to_path_data_chunk() {
|
|
109
|
+
return {
|
|
110
|
+
id: this.id,
|
|
111
|
+
name: this.name,
|
|
112
|
+
hash: this.hash,
|
|
113
|
+
contentHash: this.contentHash
|
|
114
|
+
};
|
|
115
|
+
}
|
|
108
116
|
}
|
|
109
117
|
exports.Chunk = Chunk;
|
|
110
118
|
_Chunk_inner = new WeakMap(), _Chunk_innerCompilation = new WeakMap();
|
package/dist/Compilation.d.ts
CHANGED
|
@@ -37,7 +37,9 @@ export interface Asset {
|
|
|
37
37
|
source: Source;
|
|
38
38
|
info: AssetInfo;
|
|
39
39
|
}
|
|
40
|
-
export type PathData = JsPathData
|
|
40
|
+
export type PathData = Omit<JsPathData, "chunk"> & {
|
|
41
|
+
chunk?: Chunk | binding.JsChunkPathData;
|
|
42
|
+
};
|
|
41
43
|
export interface LogEntry {
|
|
42
44
|
type: string;
|
|
43
45
|
args: any[];
|
|
@@ -375,19 +377,32 @@ export declare class Compilation {
|
|
|
375
377
|
static PROCESS_ASSETS_STAGE_REPORT: number;
|
|
376
378
|
}
|
|
377
379
|
export type EntryData = binding.JsEntryData;
|
|
380
|
+
/**
|
|
381
|
+
* Copied from `lib.es2015.iterable.d.ts` in TS 5.6 for compatibility
|
|
382
|
+
* 1. In 5.6 and after, `IterableIterator` cannot be assigned to 'MapIterator'
|
|
383
|
+
* 2. Before 5.6, Cannot find name 'MapIterator'
|
|
384
|
+
* @see https://devblogs.microsoft.com/typescript/announcing-typescript-5-6/#iterator-helper-methods
|
|
385
|
+
*/
|
|
386
|
+
interface IteratorObject<T, TReturn = unknown, TNext = unknown> extends Iterator<T, TReturn, TNext> {
|
|
387
|
+
[Symbol.iterator](): IteratorObject<T, TReturn, TNext>;
|
|
388
|
+
}
|
|
389
|
+
type BuiltinIteratorReturn = any;
|
|
390
|
+
interface MapIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
|
|
391
|
+
[Symbol.iterator](): MapIterator<T>;
|
|
392
|
+
}
|
|
378
393
|
export declare class Entries implements Map<string, EntryData> {
|
|
379
394
|
#private;
|
|
380
395
|
constructor(data: binding.JsEntries);
|
|
381
396
|
clear(): void;
|
|
382
397
|
forEach(callback: (value: binding.JsEntryData, key: string, map: Map<string, binding.JsEntryData>) => void, thisArg?: any): void;
|
|
383
398
|
get size(): number;
|
|
384
|
-
entries():
|
|
385
|
-
values():
|
|
386
|
-
[Symbol.iterator]():
|
|
399
|
+
entries(): MapIterator<[string, binding.JsEntryData]>;
|
|
400
|
+
values(): MapIterator<binding.JsEntryData>;
|
|
401
|
+
[Symbol.iterator](): MapIterator<[string, binding.JsEntryData]>;
|
|
387
402
|
get [Symbol.toStringTag](): string;
|
|
388
403
|
has(key: string): boolean;
|
|
389
404
|
set(key: string, value: EntryData): this;
|
|
390
405
|
delete(key: string): boolean;
|
|
391
406
|
get(key: string): EntryData | undefined;
|
|
392
|
-
keys():
|
|
407
|
+
keys(): MapIterator<string>;
|
|
393
408
|
}
|
package/dist/Compilation.js
CHANGED
|
@@ -522,16 +522,36 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
522
522
|
return warnings;
|
|
523
523
|
}
|
|
524
524
|
getPath(filename, data = {}) {
|
|
525
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPath(filename,
|
|
525
|
+
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPath(filename, {
|
|
526
|
+
...data,
|
|
527
|
+
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
528
|
+
? data.chunk.__internal_to_path_data_chunk()
|
|
529
|
+
: data.chunk
|
|
530
|
+
});
|
|
526
531
|
}
|
|
527
532
|
getPathWithInfo(filename, data = {}) {
|
|
528
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPathWithInfo(filename,
|
|
533
|
+
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPathWithInfo(filename, {
|
|
534
|
+
...data,
|
|
535
|
+
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
536
|
+
? data.chunk.__internal_to_path_data_chunk()
|
|
537
|
+
: data.chunk
|
|
538
|
+
});
|
|
529
539
|
}
|
|
530
540
|
getAssetPath(filename, data = {}) {
|
|
531
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetPath(filename,
|
|
541
|
+
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetPath(filename, {
|
|
542
|
+
...data,
|
|
543
|
+
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
544
|
+
? data.chunk.__internal_to_path_data_chunk()
|
|
545
|
+
: data.chunk
|
|
546
|
+
});
|
|
532
547
|
}
|
|
533
548
|
getAssetPathWithInfo(filename, data = {}) {
|
|
534
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetPathWithInfo(filename,
|
|
549
|
+
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetPathWithInfo(filename, {
|
|
550
|
+
...data,
|
|
551
|
+
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
552
|
+
? data.chunk.__internal_to_path_data_chunk()
|
|
553
|
+
: data.chunk
|
|
554
|
+
});
|
|
535
555
|
}
|
|
536
556
|
getLogger(name) {
|
|
537
557
|
if (!name) {
|
package/dist/Compiler.js
CHANGED
|
@@ -754,17 +754,22 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
754
754
|
await queried.promise(data, {});
|
|
755
755
|
}),
|
|
756
756
|
registerContextModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryBeforeResolve, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").contextModuleFactory.hooks.beforeResolve, queried => async (bindingData) => {
|
|
757
|
-
|
|
757
|
+
const data = bindingData
|
|
758
|
+
? Module_1.ContextModuleFactoryBeforeResolveData.__from_binding(bindingData)
|
|
759
|
+
: false;
|
|
760
|
+
const result = await queried.promise(data);
|
|
761
|
+
return result
|
|
762
|
+
? Module_1.ContextModuleFactoryBeforeResolveData.__to_binding(result)
|
|
763
|
+
: false;
|
|
758
764
|
}),
|
|
759
765
|
registerContextModuleFactoryAfterResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryAfterResolve, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").contextModuleFactory.hooks.afterResolve, queried => async (bindingData) => {
|
|
760
766
|
const data = bindingData
|
|
761
767
|
? Module_1.ContextModuleFactoryAfterResolveData.__from_binding(bindingData)
|
|
762
768
|
: false;
|
|
763
|
-
const
|
|
764
|
-
|
|
765
|
-
? Module_1.ContextModuleFactoryAfterResolveData.__to_binding(
|
|
769
|
+
const result = await queried.promise(data);
|
|
770
|
+
return result
|
|
771
|
+
? Module_1.ContextModuleFactoryAfterResolveData.__to_binding(result)
|
|
766
772
|
: false;
|
|
767
|
-
return result;
|
|
768
773
|
}),
|
|
769
774
|
registerJavascriptModulesChunkHashTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.JavascriptModulesChunkHash, () => builtin_plugin_1.JavascriptModulesPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f"))
|
|
770
775
|
.chunkHash, queried => (chunk) => {
|
|
@@ -20,7 +20,7 @@ class DependenciesBlock {
|
|
|
20
20
|
__classPrivateFieldSet(this, _DependenciesBlock_binding, binding, "f");
|
|
21
21
|
}
|
|
22
22
|
get dependencies() {
|
|
23
|
-
return __classPrivateFieldGet(this, _DependenciesBlock_binding, "f").dependencies.map(d =>
|
|
23
|
+
return __classPrivateFieldGet(this, _DependenciesBlock_binding, "f").dependencies.map(d => Dependency_1.Dependency.__from_binding(d));
|
|
24
24
|
}
|
|
25
25
|
get blocks() {
|
|
26
26
|
return __classPrivateFieldGet(this, _DependenciesBlock_binding, "f").blocks.map(b => new DependenciesBlock(b));
|
package/dist/Dependency.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type JsDependency, JsDependencyMut } from "@rspack/binding";
|
|
2
2
|
export declare class Dependency {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
readonly type: string;
|
|
4
|
+
readonly category: string;
|
|
5
|
+
readonly request: string | undefined;
|
|
6
|
+
critical: boolean;
|
|
7
|
+
static __from_binding(binding: JsDependencyMut | JsDependency): Dependency;
|
|
8
|
+
private constructor();
|
|
8
9
|
}
|
package/dist/Dependency.js
CHANGED
|
@@ -1,32 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _Dependency_binding;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.Dependency = void 0;
|
|
4
|
+
const binding_1 = require("@rspack/binding");
|
|
16
5
|
class Dependency {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
__classPrivateFieldSet(this, _Dependency_binding, binding, "f");
|
|
20
|
-
}
|
|
21
|
-
get type() {
|
|
22
|
-
return __classPrivateFieldGet(this, _Dependency_binding, "f").type;
|
|
6
|
+
static __from_binding(binding) {
|
|
7
|
+
return new Dependency(binding);
|
|
23
8
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
constructor(binding) {
|
|
10
|
+
Object.defineProperties(this, {
|
|
11
|
+
type: {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get() {
|
|
14
|
+
return binding.type;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
category: {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get() {
|
|
20
|
+
return binding.category;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
request: {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get() {
|
|
26
|
+
return binding.request;
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
critical: {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get() {
|
|
32
|
+
return binding.critical;
|
|
33
|
+
},
|
|
34
|
+
set(val) {
|
|
35
|
+
if (binding instanceof binding_1.JsDependencyMut) {
|
|
36
|
+
binding.critical = val;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
29
41
|
}
|
|
30
42
|
}
|
|
31
43
|
exports.Dependency = Dependency;
|
|
32
|
-
_Dependency_binding = new WeakMap();
|
package/dist/Module.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { JsCodegenerationResult, JsContextModuleFactoryAfterResolveData, JsCreateData, JsFactoryMeta, JsModule, ModuleDTO } from "@rspack/binding";
|
|
1
|
+
import type { JsCodegenerationResult, JsContextModuleFactoryAfterResolveData, JsContextModuleFactoryBeforeResolveData, JsCreateData, JsFactoryMeta, JsModule, ModuleDTO } from "@rspack/binding";
|
|
2
2
|
import type { Source } from "../compiled/webpack-sources";
|
|
3
3
|
import type { Compilation } from "./Compilation";
|
|
4
4
|
import { DependenciesBlock } from "./DependenciesBlock";
|
|
5
|
-
import
|
|
5
|
+
import { Dependency } from "./Dependency";
|
|
6
6
|
export type ResourceData = {
|
|
7
7
|
resource: string;
|
|
8
8
|
path: string;
|
|
@@ -25,26 +25,28 @@ export type ResolveData = {
|
|
|
25
25
|
contextDependencies: string[];
|
|
26
26
|
createData?: CreateData;
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export declare class ContextModuleFactoryBeforeResolveData {
|
|
29
|
+
#private;
|
|
29
30
|
context: string;
|
|
30
|
-
request
|
|
31
|
-
|
|
31
|
+
request: string;
|
|
32
|
+
regExp: RegExp | undefined;
|
|
33
|
+
recursive: boolean;
|
|
34
|
+
static __from_binding(binding: JsContextModuleFactoryBeforeResolveData): ContextModuleFactoryBeforeResolveData;
|
|
35
|
+
static __to_binding(data: ContextModuleFactoryBeforeResolveData): JsContextModuleFactoryBeforeResolveData;
|
|
36
|
+
private constructor();
|
|
37
|
+
}
|
|
38
|
+
export type ContextModuleFactoryBeforeResolveResult = false | ContextModuleFactoryBeforeResolveData;
|
|
32
39
|
export declare class ContextModuleFactoryAfterResolveData {
|
|
33
40
|
#private;
|
|
41
|
+
resource: number;
|
|
42
|
+
context: string;
|
|
43
|
+
request: string;
|
|
44
|
+
regExp: RegExp | undefined;
|
|
45
|
+
recursive: boolean;
|
|
46
|
+
readonly dependencies: Dependency[];
|
|
34
47
|
static __from_binding(binding: JsContextModuleFactoryAfterResolveData): ContextModuleFactoryAfterResolveData;
|
|
35
48
|
static __to_binding(data: ContextModuleFactoryAfterResolveData): JsContextModuleFactoryAfterResolveData;
|
|
36
|
-
constructor(
|
|
37
|
-
get resource(): string;
|
|
38
|
-
set resource(val: string);
|
|
39
|
-
get context(): string;
|
|
40
|
-
set context(val: string);
|
|
41
|
-
get request(): string;
|
|
42
|
-
set request(val: string);
|
|
43
|
-
get regExp(): RegExp | undefined;
|
|
44
|
-
set regExp(val: RegExp | undefined);
|
|
45
|
-
get recursive(): boolean;
|
|
46
|
-
set recursive(val: boolean);
|
|
47
|
-
get dependencies(): Dependency[];
|
|
49
|
+
private constructor();
|
|
48
50
|
}
|
|
49
51
|
export type ContextModuleFactoryAfterResolveResult = false | ContextModuleFactoryAfterResolveData;
|
|
50
52
|
export declare class Module {
|
package/dist/Module.js
CHANGED
|
@@ -10,11 +10,75 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
11
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
12
|
};
|
|
13
|
-
var _ContextModuleFactoryAfterResolveData_inner, _Module_inner, _Module_originalSource, _CodeGenerationResult_inner;
|
|
13
|
+
var _ContextModuleFactoryBeforeResolveData_inner, _ContextModuleFactoryAfterResolveData_inner, _Module_inner, _Module_originalSource, _CodeGenerationResult_inner;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.CodeGenerationResults = exports.CodeGenerationResult = exports.Module = exports.ContextModuleFactoryAfterResolveData = void 0;
|
|
15
|
+
exports.CodeGenerationResults = exports.CodeGenerationResult = exports.Module = exports.ContextModuleFactoryAfterResolveData = exports.ContextModuleFactoryBeforeResolveData = void 0;
|
|
16
16
|
const DependenciesBlock_1 = require("./DependenciesBlock");
|
|
17
|
+
const Dependency_1 = require("./Dependency");
|
|
17
18
|
const source_1 = require("./util/source");
|
|
19
|
+
class ContextModuleFactoryBeforeResolveData {
|
|
20
|
+
static __from_binding(binding) {
|
|
21
|
+
return new ContextModuleFactoryBeforeResolveData(binding);
|
|
22
|
+
}
|
|
23
|
+
static __to_binding(data) {
|
|
24
|
+
return __classPrivateFieldGet(data, _ContextModuleFactoryBeforeResolveData_inner, "f");
|
|
25
|
+
}
|
|
26
|
+
constructor(binding) {
|
|
27
|
+
_ContextModuleFactoryBeforeResolveData_inner.set(this, void 0);
|
|
28
|
+
__classPrivateFieldSet(this, _ContextModuleFactoryBeforeResolveData_inner, binding, "f");
|
|
29
|
+
Object.defineProperties(this, {
|
|
30
|
+
context: {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get() {
|
|
33
|
+
return binding.context;
|
|
34
|
+
},
|
|
35
|
+
set(val) {
|
|
36
|
+
binding.context = val;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
request: {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get() {
|
|
42
|
+
return binding.request;
|
|
43
|
+
},
|
|
44
|
+
set(val) {
|
|
45
|
+
binding.request = val;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
regExp: {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get() {
|
|
51
|
+
if (!binding.regExp) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const { source, flags } = binding.regExp;
|
|
55
|
+
return new RegExp(source, flags);
|
|
56
|
+
},
|
|
57
|
+
set(val) {
|
|
58
|
+
if (!val) {
|
|
59
|
+
binding.regExp = undefined;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
binding.regExp = {
|
|
63
|
+
source: val.source,
|
|
64
|
+
flags: val.flags
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
recursive: {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get() {
|
|
71
|
+
return binding.recursive;
|
|
72
|
+
},
|
|
73
|
+
set(val) {
|
|
74
|
+
binding.recursive = val;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.ContextModuleFactoryBeforeResolveData = ContextModuleFactoryBeforeResolveData;
|
|
81
|
+
_ContextModuleFactoryBeforeResolveData_inner = new WeakMap();
|
|
18
82
|
class ContextModuleFactoryAfterResolveData {
|
|
19
83
|
static __from_binding(binding) {
|
|
20
84
|
return new ContextModuleFactoryAfterResolveData(binding);
|
|
@@ -22,54 +86,73 @@ class ContextModuleFactoryAfterResolveData {
|
|
|
22
86
|
static __to_binding(data) {
|
|
23
87
|
return __classPrivateFieldGet(data, _ContextModuleFactoryAfterResolveData_inner, "f");
|
|
24
88
|
}
|
|
25
|
-
constructor(
|
|
89
|
+
constructor(binding) {
|
|
26
90
|
_ContextModuleFactoryAfterResolveData_inner.set(this, void 0);
|
|
27
|
-
__classPrivateFieldSet(this, _ContextModuleFactoryAfterResolveData_inner,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
91
|
+
__classPrivateFieldSet(this, _ContextModuleFactoryAfterResolveData_inner, binding, "f");
|
|
92
|
+
Object.defineProperties(this, {
|
|
93
|
+
resource: {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get() {
|
|
96
|
+
return binding.resource;
|
|
97
|
+
},
|
|
98
|
+
set(val) {
|
|
99
|
+
binding.resource = val;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
context: {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get() {
|
|
105
|
+
return binding.context;
|
|
106
|
+
},
|
|
107
|
+
set(val) {
|
|
108
|
+
binding.context = val;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
request: {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get() {
|
|
114
|
+
return binding.request;
|
|
115
|
+
},
|
|
116
|
+
set(val) {
|
|
117
|
+
binding.request = val;
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
regExp: {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get() {
|
|
123
|
+
if (!binding.regExp) {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
const { source, flags } = binding.regExp;
|
|
127
|
+
return new RegExp(source, flags);
|
|
128
|
+
},
|
|
129
|
+
set(val) {
|
|
130
|
+
if (!val) {
|
|
131
|
+
binding.regExp = undefined;
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
binding.regExp = {
|
|
135
|
+
source: val.source,
|
|
136
|
+
flags: val.flags
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
recursive: {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
get() {
|
|
143
|
+
return binding.recursive;
|
|
144
|
+
},
|
|
145
|
+
set(val) {
|
|
146
|
+
binding.recursive = val;
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
dependencies: {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get() {
|
|
152
|
+
return binding.dependencies.map(dep => Dependency_1.Dependency.__from_binding(dep));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
73
156
|
}
|
|
74
157
|
}
|
|
75
158
|
exports.ContextModuleFactoryAfterResolveData = ContextModuleFactoryAfterResolveData;
|
|
@@ -1,64 +1,9 @@
|
|
|
1
1
|
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Externals } from "..";
|
|
2
3
|
export declare const ExternalsPlugin: {
|
|
3
|
-
new (type: string, externals:
|
|
4
|
-
context?: string | undefined;
|
|
5
|
-
dependencyType?: string | undefined;
|
|
6
|
-
request?: string | undefined;
|
|
7
|
-
contextInfo?: {
|
|
8
|
-
issuer: string;
|
|
9
|
-
} | undefined;
|
|
10
|
-
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "global" | "system" | "promise" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "module-import" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
11
|
-
context?: string | undefined;
|
|
12
|
-
dependencyType?: string | undefined;
|
|
13
|
-
request?: string | undefined;
|
|
14
|
-
contextInfo?: {
|
|
15
|
-
issuer: string;
|
|
16
|
-
} | undefined;
|
|
17
|
-
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>) | (string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
|
|
18
|
-
context?: string | undefined;
|
|
19
|
-
dependencyType?: string | undefined;
|
|
20
|
-
request?: string | undefined;
|
|
21
|
-
contextInfo?: {
|
|
22
|
-
issuer: string;
|
|
23
|
-
} | undefined;
|
|
24
|
-
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "global" | "system" | "promise" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "module-import" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
25
|
-
context?: string | undefined;
|
|
26
|
-
dependencyType?: string | undefined;
|
|
27
|
-
request?: string | undefined;
|
|
28
|
-
contextInfo?: {
|
|
29
|
-
issuer: string;
|
|
30
|
-
} | undefined;
|
|
31
|
-
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>))[]): {
|
|
4
|
+
new (type: string, externals: Externals): {
|
|
32
5
|
name: BuiltinPluginName;
|
|
33
|
-
_args: [type: string, externals:
|
|
34
|
-
context?: string | undefined;
|
|
35
|
-
dependencyType?: string | undefined;
|
|
36
|
-
request?: string | undefined;
|
|
37
|
-
contextInfo?: {
|
|
38
|
-
issuer: string;
|
|
39
|
-
} | undefined;
|
|
40
|
-
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "global" | "system" | "promise" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "module-import" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
41
|
-
context?: string | undefined;
|
|
42
|
-
dependencyType?: string | undefined;
|
|
43
|
-
request?: string | undefined;
|
|
44
|
-
contextInfo?: {
|
|
45
|
-
issuer: string;
|
|
46
|
-
} | undefined;
|
|
47
|
-
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>) | (string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
|
|
48
|
-
context?: string | undefined;
|
|
49
|
-
dependencyType?: string | undefined;
|
|
50
|
-
request?: string | undefined;
|
|
51
|
-
contextInfo?: {
|
|
52
|
-
issuer: string;
|
|
53
|
-
} | undefined;
|
|
54
|
-
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "global" | "system" | "promise" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "module-import" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
55
|
-
context?: string | undefined;
|
|
56
|
-
dependencyType?: string | undefined;
|
|
57
|
-
request?: string | undefined;
|
|
58
|
-
contextInfo?: {
|
|
59
|
-
issuer: string;
|
|
60
|
-
} | undefined;
|
|
61
|
-
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>))[]];
|
|
6
|
+
_args: [type: string, externals: Externals];
|
|
62
7
|
affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
63
8
|
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
64
9
|
apply(compiler: import("../Compiler").Compiler): void;
|
package/dist/config/adapter.js
CHANGED
|
@@ -489,7 +489,11 @@ function getRawJavascriptParserOptions(parser) {
|
|
|
489
489
|
? ["..."]
|
|
490
490
|
: []
|
|
491
491
|
: parser.worker,
|
|
492
|
-
overrideStrict: parser.overrideStrict
|
|
492
|
+
overrideStrict: parser.overrideStrict,
|
|
493
|
+
requireAsExpression: parser.requireAsExpression,
|
|
494
|
+
requireDynamic: parser.requireDynamic,
|
|
495
|
+
requireResolve: parser.requireResolve,
|
|
496
|
+
importDynamic: parser.importDynamic
|
|
493
497
|
};
|
|
494
498
|
}
|
|
495
499
|
function getRawAssetParserOptions(parser) {
|
package/dist/config/defaults.js
CHANGED
|
@@ -168,6 +168,10 @@ const applyJavascriptParserOptionsDefaults = (parserOptions) => {
|
|
|
168
168
|
D(parserOptions, "exprContextCritical", true);
|
|
169
169
|
D(parserOptions, "wrappedContextCritical", false);
|
|
170
170
|
D(parserOptions, "strictExportPresence", false);
|
|
171
|
+
D(parserOptions, "requireAsExpression", true);
|
|
172
|
+
D(parserOptions, "requireDynamic", true);
|
|
173
|
+
D(parserOptions, "requireResolve", true);
|
|
174
|
+
D(parserOptions, "importDynamic", true);
|
|
171
175
|
D(parserOptions, "worker", ["..."]);
|
|
172
176
|
D(parserOptions, "importMeta", true);
|
|
173
177
|
};
|