@ms-cloudpack/bundler-rspack 0.1.1
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/README.md +23 -0
- package/lib/getPathsOfModules.d.ts +8 -0
- package/lib/getPathsOfModules.d.ts.map +1 -0
- package/lib/getPathsOfModules.js +28 -0
- package/lib/getPathsOfModules.js.map +1 -0
- package/lib/getRspackConfiguration.d.ts +591 -0
- package/lib/getRspackConfiguration.d.ts.map +1 -0
- package/lib/getRspackConfiguration.js +179 -0
- package/lib/getRspackConfiguration.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/normalizeRspackOutput.d.ts +13 -0
- package/lib/normalizeRspackOutput.d.ts.map +1 -0
- package/lib/normalizeRspackOutput.js +86 -0
- package/lib/normalizeRspackOutput.js.map +1 -0
- package/lib/rspack.d.ts +3 -0
- package/lib/rspack.d.ts.map +1 -0
- package/lib/rspack.js +48 -0
- package/lib/rspack.js.map +1 -0
- package/lib/rspackCapabilities.d.ts +4 -0
- package/lib/rspackCapabilities.d.ts.map +1 -0
- package/lib/rspackCapabilities.js +27 -0
- package/lib/rspackCapabilities.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @ms-cloudpack/bundler-rspack
|
|
2
|
+
|
|
3
|
+
Provides a Cloudpack bundler abstraction around the Rspack bundler.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### `async function bundlePackage(options)`
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { bundlePackage } from '@ms-cloudpack/bundler';
|
|
11
|
+
|
|
12
|
+
async function start() {
|
|
13
|
+
const result = await bundlePackage({
|
|
14
|
+
packagePath: process.cwd(),
|
|
15
|
+
outputPath: path.join(process.cwd(), 'dist'),
|
|
16
|
+
outputType: 'library',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
console.log(result);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
start();
|
|
23
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the paths of the provided modules relative to the bundler-webpack package,
|
|
3
|
+
* and returns a list of unique containing folders which webpack can use as module search paths.
|
|
4
|
+
* @param modules - The modules to resolve. Must be dependencies of this package.
|
|
5
|
+
* @returns - Containing folders of the modules. (ie: /path/to/node_modules/)
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPathsOfModules(modules: string[]): string[];
|
|
8
|
+
//# sourceMappingURL=getPathsOfModules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPathsOfModules.d.ts","sourceRoot":"","sources":["../src/getPathsOfModules.ts"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAc7D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// temporarily duplicated from bundler-webpck
|
|
2
|
+
import { makeUrl } from '@ms-cloudpack/path-string-parsing';
|
|
3
|
+
import { findPackageRoot } from '@ms-cloudpack/path-utilities';
|
|
4
|
+
import { moduleResolve } from 'import-meta-resolve';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
const conditions = new Set(['node', 'require', 'import', 'default']);
|
|
8
|
+
const resolveFrom = makeUrl(import.meta.url);
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the paths of the provided modules relative to the bundler-webpack package,
|
|
11
|
+
* and returns a list of unique containing folders which webpack can use as module search paths.
|
|
12
|
+
* @param modules - The modules to resolve. Must be dependencies of this package.
|
|
13
|
+
* @returns - Containing folders of the modules. (ie: /path/to/node_modules/)
|
|
14
|
+
*/
|
|
15
|
+
export function getPathsOfModules(modules) {
|
|
16
|
+
const paths = new Set();
|
|
17
|
+
for (const moduleName of modules) {
|
|
18
|
+
// Resolve the module path and find the package root from there.
|
|
19
|
+
// preserveSymlinks ensures we get the path where it's installed as a dependency, not from the store.
|
|
20
|
+
const modulePath = moduleResolve(moduleName, resolveFrom, conditions, true /*preserveSymlinks*/);
|
|
21
|
+
const packageRoot = findPackageRoot(fileURLToPath(modulePath));
|
|
22
|
+
if (packageRoot) {
|
|
23
|
+
paths.add(path.dirname(packageRoot));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return Array.from(paths);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=getPathsOfModules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPathsOfModules.js","sourceRoot":"","sources":["../src/getPathsOfModules.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AACrE,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAiB;IACjD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAEhC,KAAK,MAAM,UAAU,IAAI,OAAO,EAAE,CAAC;QACjC,gEAAgE;QAChE,qGAAqG;QACrG,MAAM,UAAU,GAAG,aAAa,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACjG,MAAM,WAAW,GAAG,eAAe,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;QAC/D,IAAI,WAAW,EAAE,CAAC;YAChB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// temporarily duplicated from bundler-webpck\nimport { makeUrl } from '@ms-cloudpack/path-string-parsing';\nimport { findPackageRoot } from '@ms-cloudpack/path-utilities';\nimport { moduleResolve } from 'import-meta-resolve';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst conditions = new Set(['node', 'require', 'import', 'default']);\nconst resolveFrom = makeUrl(import.meta.url);\n\n/**\n * Resolves the paths of the provided modules relative to the bundler-webpack package,\n * and returns a list of unique containing folders which webpack can use as module search paths.\n * @param modules - The modules to resolve. Must be dependencies of this package.\n * @returns - Containing folders of the modules. (ie: /path/to/node_modules/)\n */\nexport function getPathsOfModules(modules: string[]): string[] {\n const paths = new Set<string>();\n\n for (const moduleName of modules) {\n // Resolve the module path and find the package root from there.\n // preserveSymlinks ensures we get the path where it's installed as a dependency, not from the store.\n const modulePath = moduleResolve(moduleName, resolveFrom, conditions, true /*preserveSymlinks*/);\n const packageRoot = findPackageRoot(fileURLToPath(modulePath));\n if (packageRoot) {\n paths.add(path.dirname(packageRoot));\n }\n }\n\n return Array.from(paths);\n}\n"]}
|
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
import type { BundleContext, BundleOptions } from '@ms-cloudpack/common-types';
|
|
2
|
+
import type { WriteESMStubsResult } from '@ms-cloudpack/esm-stub-utilities';
|
|
3
|
+
export declare function getRspackConfiguration(params: {
|
|
4
|
+
options: Omit<BundleOptions, 'entries' | 'outputPath'>;
|
|
5
|
+
outputPath: string;
|
|
6
|
+
} & Pick<WriteESMStubsResult, 'newEntries'>, context: BundleContext): {
|
|
7
|
+
[x: string]: unknown;
|
|
8
|
+
} | {
|
|
9
|
+
module?: {
|
|
10
|
+
parser?: {
|
|
11
|
+
javascript?: {
|
|
12
|
+
dynamicImportMode?: "eager" | "lazy" | "weak" | "lazy-once" | undefined;
|
|
13
|
+
dynamicImportPreload?: number | boolean | undefined;
|
|
14
|
+
dynamicImportPrefetch?: number | boolean | undefined;
|
|
15
|
+
dynamicImportFetchPriority?: "auto" | "low" | "high" | undefined;
|
|
16
|
+
importMeta?: boolean | undefined;
|
|
17
|
+
url?: boolean | "relative" | undefined;
|
|
18
|
+
exprContextCritical?: boolean | undefined;
|
|
19
|
+
wrappedContextCritical?: boolean | undefined;
|
|
20
|
+
exportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
21
|
+
importExportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
22
|
+
reexportExportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
23
|
+
strictExportPresence?: boolean | undefined;
|
|
24
|
+
worker?: boolean | string[] | undefined;
|
|
25
|
+
overrideStrict?: "strict" | "non-strict" | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
css?: {
|
|
28
|
+
namedExports?: boolean | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
"css/auto"?: {
|
|
31
|
+
namedExports?: boolean | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
"css/module"?: {
|
|
34
|
+
namedExports?: boolean | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
asset?: {
|
|
37
|
+
dataUrlCondition?: {
|
|
38
|
+
maxSize?: number | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
"javascript/auto"?: {
|
|
42
|
+
dynamicImportMode?: "eager" | "lazy" | "weak" | "lazy-once" | undefined;
|
|
43
|
+
dynamicImportPreload?: number | boolean | undefined;
|
|
44
|
+
dynamicImportPrefetch?: number | boolean | undefined;
|
|
45
|
+
dynamicImportFetchPriority?: "auto" | "low" | "high" | undefined;
|
|
46
|
+
importMeta?: boolean | undefined;
|
|
47
|
+
url?: boolean | "relative" | undefined;
|
|
48
|
+
exprContextCritical?: boolean | undefined;
|
|
49
|
+
wrappedContextCritical?: boolean | undefined;
|
|
50
|
+
exportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
51
|
+
importExportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
52
|
+
reexportExportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
53
|
+
strictExportPresence?: boolean | undefined;
|
|
54
|
+
worker?: boolean | string[] | undefined;
|
|
55
|
+
overrideStrict?: "strict" | "non-strict" | undefined;
|
|
56
|
+
} | undefined;
|
|
57
|
+
"javascript/dynamic"?: {
|
|
58
|
+
dynamicImportMode?: "eager" | "lazy" | "weak" | "lazy-once" | undefined;
|
|
59
|
+
dynamicImportPreload?: number | boolean | undefined;
|
|
60
|
+
dynamicImportPrefetch?: number | boolean | undefined;
|
|
61
|
+
dynamicImportFetchPriority?: "auto" | "low" | "high" | undefined;
|
|
62
|
+
importMeta?: boolean | undefined;
|
|
63
|
+
url?: boolean | "relative" | undefined;
|
|
64
|
+
exprContextCritical?: boolean | undefined;
|
|
65
|
+
wrappedContextCritical?: boolean | undefined;
|
|
66
|
+
exportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
67
|
+
importExportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
68
|
+
reexportExportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
69
|
+
strictExportPresence?: boolean | undefined;
|
|
70
|
+
worker?: boolean | string[] | undefined;
|
|
71
|
+
overrideStrict?: "strict" | "non-strict" | undefined;
|
|
72
|
+
} | undefined;
|
|
73
|
+
"javascript/esm"?: {
|
|
74
|
+
dynamicImportMode?: "eager" | "lazy" | "weak" | "lazy-once" | undefined;
|
|
75
|
+
dynamicImportPreload?: number | boolean | undefined;
|
|
76
|
+
dynamicImportPrefetch?: number | boolean | undefined;
|
|
77
|
+
dynamicImportFetchPriority?: "auto" | "low" | "high" | undefined;
|
|
78
|
+
importMeta?: boolean | undefined;
|
|
79
|
+
url?: boolean | "relative" | undefined;
|
|
80
|
+
exprContextCritical?: boolean | undefined;
|
|
81
|
+
wrappedContextCritical?: boolean | undefined;
|
|
82
|
+
exportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
83
|
+
importExportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
84
|
+
reexportExportsPresence?: false | "auto" | "error" | "warn" | undefined;
|
|
85
|
+
strictExportPresence?: boolean | undefined;
|
|
86
|
+
worker?: boolean | string[] | undefined;
|
|
87
|
+
overrideStrict?: "strict" | "non-strict" | undefined;
|
|
88
|
+
} | undefined;
|
|
89
|
+
} | Record<string, Record<string, any>> | undefined;
|
|
90
|
+
generator?: Record<string, Record<string, any>> | {
|
|
91
|
+
css?: {
|
|
92
|
+
exportsOnly?: boolean | undefined;
|
|
93
|
+
esModule?: boolean | undefined;
|
|
94
|
+
} | undefined;
|
|
95
|
+
"css/auto"?: {
|
|
96
|
+
exportsOnly?: boolean | undefined;
|
|
97
|
+
esModule?: boolean | undefined;
|
|
98
|
+
exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined;
|
|
99
|
+
localIdentName?: string | undefined;
|
|
100
|
+
} | undefined;
|
|
101
|
+
"css/module"?: {
|
|
102
|
+
exportsOnly?: boolean | undefined;
|
|
103
|
+
esModule?: boolean | undefined;
|
|
104
|
+
exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only" | undefined;
|
|
105
|
+
localIdentName?: string | undefined;
|
|
106
|
+
} | undefined;
|
|
107
|
+
asset?: {
|
|
108
|
+
filename?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
109
|
+
publicPath?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
110
|
+
emit?: boolean | undefined;
|
|
111
|
+
dataUrl?: {
|
|
112
|
+
mimetype?: string | undefined;
|
|
113
|
+
encoding?: false | "base64" | undefined;
|
|
114
|
+
} | ((args_0: {
|
|
115
|
+
filename: string;
|
|
116
|
+
content: string;
|
|
117
|
+
}, ...args_1: unknown[]) => string) | undefined;
|
|
118
|
+
} | undefined;
|
|
119
|
+
"asset/inline"?: {
|
|
120
|
+
dataUrl?: {
|
|
121
|
+
mimetype?: string | undefined;
|
|
122
|
+
encoding?: false | "base64" | undefined;
|
|
123
|
+
} | ((args_0: {
|
|
124
|
+
filename: string;
|
|
125
|
+
content: string;
|
|
126
|
+
}, ...args_1: unknown[]) => string) | undefined;
|
|
127
|
+
} | undefined;
|
|
128
|
+
"asset/resource"?: {
|
|
129
|
+
filename?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
130
|
+
publicPath?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
131
|
+
emit?: boolean | undefined;
|
|
132
|
+
} | undefined;
|
|
133
|
+
} | undefined;
|
|
134
|
+
rules?: (false | "" | 0 | "..." | import("@rspack/core").RuleSetRule | null | undefined)[] | undefined;
|
|
135
|
+
defaultRules?: (false | "" | 0 | "..." | import("@rspack/core").RuleSetRule | null | undefined)[] | undefined;
|
|
136
|
+
noParse?: string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined;
|
|
137
|
+
} | undefined;
|
|
138
|
+
dependencies?: string[] | undefined;
|
|
139
|
+
name?: string | undefined;
|
|
140
|
+
context?: string | undefined;
|
|
141
|
+
performance?: false | {
|
|
142
|
+
assetFilter?: ((args_0: string, ...args_1: unknown[]) => boolean) | undefined;
|
|
143
|
+
hints?: false | "error" | "warning" | undefined;
|
|
144
|
+
maxAssetSize?: number | undefined;
|
|
145
|
+
maxEntrypointSize?: number | undefined;
|
|
146
|
+
} | undefined;
|
|
147
|
+
entry?: string | string[] | Record<string, string | string[] | {
|
|
148
|
+
import: string | string[];
|
|
149
|
+
filename?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
150
|
+
publicPath?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
151
|
+
layer?: string | null | undefined;
|
|
152
|
+
runtime?: string | false | undefined;
|
|
153
|
+
baseUri?: string | undefined;
|
|
154
|
+
chunkLoading?: string | false | undefined;
|
|
155
|
+
asyncChunks?: boolean | undefined;
|
|
156
|
+
wasmLoading?: string | false | undefined;
|
|
157
|
+
library?: {
|
|
158
|
+
type: string;
|
|
159
|
+
name?: string | string[] | {
|
|
160
|
+
commonjs?: string | undefined;
|
|
161
|
+
amd?: string | undefined;
|
|
162
|
+
root?: string | string[] | undefined;
|
|
163
|
+
} | undefined;
|
|
164
|
+
amdContainer?: string | undefined;
|
|
165
|
+
auxiliaryComment?: string | {
|
|
166
|
+
commonjs?: string | undefined;
|
|
167
|
+
amd?: string | undefined;
|
|
168
|
+
root?: string | undefined;
|
|
169
|
+
commonjs2?: string | undefined;
|
|
170
|
+
} | undefined;
|
|
171
|
+
export?: string | string[] | undefined;
|
|
172
|
+
umdNamedDefine?: boolean | undefined;
|
|
173
|
+
} | undefined;
|
|
174
|
+
dependOn?: string | string[] | undefined;
|
|
175
|
+
}> | ((...args: unknown[]) => string | string[] | Record<string, string | string[] | {
|
|
176
|
+
import: string | string[];
|
|
177
|
+
filename?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
178
|
+
publicPath?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
179
|
+
layer?: string | null | undefined;
|
|
180
|
+
runtime?: string | false | undefined;
|
|
181
|
+
baseUri?: string | undefined;
|
|
182
|
+
chunkLoading?: string | false | undefined;
|
|
183
|
+
asyncChunks?: boolean | undefined;
|
|
184
|
+
wasmLoading?: string | false | undefined;
|
|
185
|
+
library?: {
|
|
186
|
+
type: string;
|
|
187
|
+
name?: string | string[] | {
|
|
188
|
+
commonjs?: string | undefined;
|
|
189
|
+
amd?: string | undefined;
|
|
190
|
+
root?: string | string[] | undefined;
|
|
191
|
+
} | undefined;
|
|
192
|
+
amdContainer?: string | undefined;
|
|
193
|
+
auxiliaryComment?: string | {
|
|
194
|
+
commonjs?: string | undefined;
|
|
195
|
+
amd?: string | undefined;
|
|
196
|
+
root?: string | undefined;
|
|
197
|
+
commonjs2?: string | undefined;
|
|
198
|
+
} | undefined;
|
|
199
|
+
export?: string | string[] | undefined;
|
|
200
|
+
umdNamedDefine?: boolean | undefined;
|
|
201
|
+
} | undefined;
|
|
202
|
+
dependOn?: string | string[] | undefined;
|
|
203
|
+
}> | Promise<string | string[] | Record<string, string | string[] | {
|
|
204
|
+
import: string | string[];
|
|
205
|
+
filename?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
206
|
+
publicPath?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
207
|
+
layer?: string | null | undefined;
|
|
208
|
+
runtime?: string | false | undefined;
|
|
209
|
+
baseUri?: string | undefined;
|
|
210
|
+
chunkLoading?: string | false | undefined;
|
|
211
|
+
asyncChunks?: boolean | undefined;
|
|
212
|
+
wasmLoading?: string | false | undefined;
|
|
213
|
+
library?: {
|
|
214
|
+
type: string;
|
|
215
|
+
name?: string | string[] | {
|
|
216
|
+
commonjs?: string | undefined;
|
|
217
|
+
amd?: string | undefined;
|
|
218
|
+
root?: string | string[] | undefined;
|
|
219
|
+
} | undefined;
|
|
220
|
+
amdContainer?: string | undefined;
|
|
221
|
+
auxiliaryComment?: string | {
|
|
222
|
+
commonjs?: string | undefined;
|
|
223
|
+
amd?: string | undefined;
|
|
224
|
+
root?: string | undefined;
|
|
225
|
+
commonjs2?: string | undefined;
|
|
226
|
+
} | undefined;
|
|
227
|
+
export?: string | string[] | undefined;
|
|
228
|
+
umdNamedDefine?: boolean | undefined;
|
|
229
|
+
} | undefined;
|
|
230
|
+
dependOn?: string | string[] | undefined;
|
|
231
|
+
}>>) | undefined;
|
|
232
|
+
node?: false | {
|
|
233
|
+
global?: boolean | "warn" | undefined;
|
|
234
|
+
__dirname?: boolean | "warn-mock" | "mock" | "eval-only" | "node-module" | undefined;
|
|
235
|
+
__filename?: boolean | "warn-mock" | "mock" | "eval-only" | "node-module" | undefined;
|
|
236
|
+
} | undefined;
|
|
237
|
+
profile?: boolean | undefined;
|
|
238
|
+
cache?: boolean | undefined;
|
|
239
|
+
loader?: Record<string, any> | undefined;
|
|
240
|
+
resolve?: import("@rspack/core").ResolveOptions | undefined;
|
|
241
|
+
output?: {
|
|
242
|
+
module?: boolean | undefined;
|
|
243
|
+
filename?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
244
|
+
publicPath?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
245
|
+
environment?: {
|
|
246
|
+
module?: boolean | undefined;
|
|
247
|
+
arrowFunction?: boolean | undefined;
|
|
248
|
+
asyncFunction?: boolean | undefined;
|
|
249
|
+
bigIntLiteral?: boolean | undefined;
|
|
250
|
+
const?: boolean | undefined;
|
|
251
|
+
destructuring?: boolean | undefined;
|
|
252
|
+
document?: boolean | undefined;
|
|
253
|
+
dynamicImport?: boolean | undefined;
|
|
254
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
255
|
+
forOf?: boolean | undefined;
|
|
256
|
+
globalThis?: boolean | undefined;
|
|
257
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
258
|
+
optionalChaining?: boolean | undefined;
|
|
259
|
+
templateLiteral?: boolean | undefined;
|
|
260
|
+
} | undefined;
|
|
261
|
+
path?: string | undefined;
|
|
262
|
+
chunkFilename?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
263
|
+
auxiliaryComment?: string | {
|
|
264
|
+
commonjs?: string | undefined;
|
|
265
|
+
amd?: string | undefined;
|
|
266
|
+
root?: string | undefined;
|
|
267
|
+
commonjs2?: string | undefined;
|
|
268
|
+
} | undefined;
|
|
269
|
+
umdNamedDefine?: boolean | undefined;
|
|
270
|
+
chunkLoading?: string | false | undefined;
|
|
271
|
+
asyncChunks?: boolean | undefined;
|
|
272
|
+
wasmLoading?: string | false | undefined;
|
|
273
|
+
library?: string | string[] | {
|
|
274
|
+
commonjs?: string | undefined;
|
|
275
|
+
amd?: string | undefined;
|
|
276
|
+
root?: string | string[] | undefined;
|
|
277
|
+
} | {
|
|
278
|
+
type: string;
|
|
279
|
+
name?: string | string[] | {
|
|
280
|
+
commonjs?: string | undefined;
|
|
281
|
+
amd?: string | undefined;
|
|
282
|
+
root?: string | string[] | undefined;
|
|
283
|
+
} | undefined;
|
|
284
|
+
amdContainer?: string | undefined;
|
|
285
|
+
auxiliaryComment?: string | {
|
|
286
|
+
commonjs?: string | undefined;
|
|
287
|
+
amd?: string | undefined;
|
|
288
|
+
root?: string | undefined;
|
|
289
|
+
commonjs2?: string | undefined;
|
|
290
|
+
} | undefined;
|
|
291
|
+
export?: string | string[] | undefined;
|
|
292
|
+
umdNamedDefine?: boolean | undefined;
|
|
293
|
+
} | undefined;
|
|
294
|
+
pathinfo?: boolean | "verbose" | undefined;
|
|
295
|
+
clean?: boolean | undefined;
|
|
296
|
+
crossOriginLoading?: false | "anonymous" | "use-credentials" | undefined;
|
|
297
|
+
cssFilename?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
298
|
+
cssHeadDataCompression?: boolean | undefined;
|
|
299
|
+
cssChunkFilename?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
300
|
+
hotUpdateMainFilename?: string | undefined;
|
|
301
|
+
hotUpdateChunkFilename?: string | undefined;
|
|
302
|
+
hotUpdateGlobal?: string | undefined;
|
|
303
|
+
assetModuleFilename?: string | ((args_0: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsPathData, args_1: import(".store/@rspack-binding-npm-1.0.8-eb8cb06a64/package").JsAssetInfo | undefined, ...args_2: unknown[]) => string) | undefined;
|
|
304
|
+
uniqueName?: string | undefined;
|
|
305
|
+
chunkLoadingGlobal?: string | undefined;
|
|
306
|
+
enabledLibraryTypes?: string[] | undefined;
|
|
307
|
+
libraryExport?: string | string[] | undefined;
|
|
308
|
+
libraryTarget?: string | undefined;
|
|
309
|
+
strictModuleExceptionHandling?: boolean | undefined;
|
|
310
|
+
strictModuleErrorHandling?: boolean | undefined;
|
|
311
|
+
globalObject?: string | undefined;
|
|
312
|
+
importFunctionName?: string | undefined;
|
|
313
|
+
importMetaName?: string | undefined;
|
|
314
|
+
iife?: boolean | undefined;
|
|
315
|
+
enabledWasmLoadingTypes?: string[] | undefined;
|
|
316
|
+
webassemblyModuleFilename?: string | undefined;
|
|
317
|
+
chunkFormat?: string | false | undefined;
|
|
318
|
+
enabledChunkLoadingTypes?: string[] | undefined;
|
|
319
|
+
trustedTypes?: string | true | {
|
|
320
|
+
policyName?: string | undefined;
|
|
321
|
+
} | undefined;
|
|
322
|
+
sourceMapFilename?: string | undefined;
|
|
323
|
+
hashDigest?: string | undefined;
|
|
324
|
+
hashDigestLength?: number | undefined;
|
|
325
|
+
hashFunction?: "xxhash64" | "md4" | undefined;
|
|
326
|
+
hashSalt?: string | undefined;
|
|
327
|
+
workerChunkLoading?: string | false | undefined;
|
|
328
|
+
workerWasmLoading?: string | false | undefined;
|
|
329
|
+
workerPublicPath?: string | undefined;
|
|
330
|
+
scriptType?: false | "module" | "text/javascript" | undefined;
|
|
331
|
+
devtoolNamespace?: string | undefined;
|
|
332
|
+
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
333
|
+
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
334
|
+
chunkLoadTimeout?: number | undefined;
|
|
335
|
+
charset?: boolean | undefined;
|
|
336
|
+
} | undefined;
|
|
337
|
+
target?: false | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "node" | "async-node" | "web" | "webworker" | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | "electron-main" | `electron${number}-main` | `electron${number}.${number}-main` | "electron-renderer" | `electron${number}-renderer` | `electron${number}.${number}-renderer` | "electron-preload" | `electron${number}-preload` | `electron${number}.${number}-preload` | "nwjs" | `nwjs${number}` | `nwjs${number}.${number}` | "node-webkit" | `node-webkit${number}` | `node-webkit${number}.${number}` | "browserslist" | `browserslist:${string}` | ("es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "node" | "async-node" | "web" | "webworker" | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | "electron-main" | `electron${number}-main` | `electron${number}.${number}-main` | "electron-renderer" | `electron${number}-renderer` | `electron${number}.${number}-renderer` | "electron-preload" | `electron${number}-preload` | `electron${number}.${number}-preload` | "nwjs" | `nwjs${number}` | `nwjs${number}.${number}` | "node-webkit" | `node-webkit${number}` | `node-webkit${number}.${number}` | "browserslist" | `browserslist:${string}`)[] | undefined;
|
|
338
|
+
mode?: "none" | "development" | "production" | undefined;
|
|
339
|
+
experiments?: {
|
|
340
|
+
css?: boolean | undefined;
|
|
341
|
+
lazyCompilation?: boolean | {
|
|
342
|
+
entries?: boolean | undefined;
|
|
343
|
+
test?: RegExp | ((args_0: import("@rspack/core").Module, ...args_1: unknown[]) => boolean) | undefined;
|
|
344
|
+
backend?: {
|
|
345
|
+
client?: string | undefined;
|
|
346
|
+
listen?: number | {
|
|
347
|
+
path?: string | undefined;
|
|
348
|
+
port?: number | undefined;
|
|
349
|
+
host?: string | undefined;
|
|
350
|
+
backlog?: number | undefined;
|
|
351
|
+
exclusive?: boolean | undefined;
|
|
352
|
+
readableAll?: boolean | undefined;
|
|
353
|
+
writableAll?: boolean | undefined;
|
|
354
|
+
ipv6Only?: boolean | undefined;
|
|
355
|
+
} | undefined;
|
|
356
|
+
protocol?: "http" | "https" | undefined;
|
|
357
|
+
} | undefined;
|
|
358
|
+
imports?: boolean | undefined;
|
|
359
|
+
} | undefined;
|
|
360
|
+
asyncWebAssembly?: boolean | undefined;
|
|
361
|
+
outputModule?: boolean | undefined;
|
|
362
|
+
topLevelAwait?: boolean | undefined;
|
|
363
|
+
layers?: boolean | undefined;
|
|
364
|
+
incremental?: boolean | {
|
|
365
|
+
make?: boolean | undefined;
|
|
366
|
+
providedExports?: boolean | undefined;
|
|
367
|
+
emitAssets?: boolean | undefined;
|
|
368
|
+
inferAsyncModules?: boolean | undefined;
|
|
369
|
+
moduleHashes?: boolean | undefined;
|
|
370
|
+
moduleCodegen?: boolean | undefined;
|
|
371
|
+
moduleRuntimeRequirements?: boolean | undefined;
|
|
372
|
+
} | undefined;
|
|
373
|
+
futureDefaults?: boolean | undefined;
|
|
374
|
+
rspackFuture?: {
|
|
375
|
+
bundlerInfo?: {
|
|
376
|
+
force?: boolean | ("version" | "uniqueId")[] | undefined;
|
|
377
|
+
version?: string | undefined;
|
|
378
|
+
bundler?: string | undefined;
|
|
379
|
+
} | undefined;
|
|
380
|
+
} | undefined;
|
|
381
|
+
} | undefined;
|
|
382
|
+
externals?: string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
|
|
383
|
+
context?: string | undefined;
|
|
384
|
+
dependencyType?: string | undefined;
|
|
385
|
+
request?: string | undefined;
|
|
386
|
+
contextInfo?: {
|
|
387
|
+
issuer: string;
|
|
388
|
+
} | undefined;
|
|
389
|
+
}, 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: {
|
|
390
|
+
context?: string | undefined;
|
|
391
|
+
dependencyType?: string | undefined;
|
|
392
|
+
request?: string | undefined;
|
|
393
|
+
contextInfo?: {
|
|
394
|
+
issuer: string;
|
|
395
|
+
} | undefined;
|
|
396
|
+
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>) | (string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
|
|
397
|
+
context?: string | undefined;
|
|
398
|
+
dependencyType?: string | undefined;
|
|
399
|
+
request?: string | undefined;
|
|
400
|
+
contextInfo?: {
|
|
401
|
+
issuer: string;
|
|
402
|
+
} | undefined;
|
|
403
|
+
}, 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: {
|
|
404
|
+
context?: string | undefined;
|
|
405
|
+
dependencyType?: string | undefined;
|
|
406
|
+
request?: string | undefined;
|
|
407
|
+
contextInfo?: {
|
|
408
|
+
issuer: string;
|
|
409
|
+
} | undefined;
|
|
410
|
+
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>))[] | undefined;
|
|
411
|
+
externalsType?: "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;
|
|
412
|
+
externalsPresets?: {
|
|
413
|
+
node?: boolean | undefined;
|
|
414
|
+
web?: boolean | undefined;
|
|
415
|
+
nwjs?: boolean | undefined;
|
|
416
|
+
webAsync?: boolean | undefined;
|
|
417
|
+
electron?: boolean | undefined;
|
|
418
|
+
electronMain?: boolean | undefined;
|
|
419
|
+
electronPreload?: boolean | undefined;
|
|
420
|
+
electronRenderer?: boolean | undefined;
|
|
421
|
+
} | undefined;
|
|
422
|
+
infrastructureLogging?: {
|
|
423
|
+
debug?: string | boolean | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined;
|
|
424
|
+
colors?: boolean | undefined;
|
|
425
|
+
appendOnly?: boolean | undefined;
|
|
426
|
+
console?: Console | undefined;
|
|
427
|
+
level?: "log" | "info" | "verbose" | "none" | "error" | "warn" | undefined;
|
|
428
|
+
stream?: NodeJS.WritableStream | undefined;
|
|
429
|
+
} | undefined;
|
|
430
|
+
devtool?: false | "eval" | "cheap-source-map" | "cheap-module-source-map" | "source-map" | "inline-cheap-source-map" | "inline-cheap-module-source-map" | "inline-source-map" | "inline-nosources-cheap-source-map" | "inline-nosources-cheap-module-source-map" | "inline-nosources-source-map" | "nosources-cheap-source-map" | "nosources-cheap-module-source-map" | "nosources-source-map" | "hidden-nosources-cheap-source-map" | "hidden-nosources-cheap-module-source-map" | "hidden-nosources-source-map" | "hidden-cheap-source-map" | "hidden-cheap-module-source-map" | "hidden-source-map" | "eval-cheap-source-map" | "eval-cheap-module-source-map" | "eval-source-map" | "eval-nosources-cheap-source-map" | "eval-nosources-cheap-module-source-map" | "eval-nosources-source-map" | undefined;
|
|
431
|
+
ignoreWarnings?: (RegExp | ((args_0: Error, args_1: import("@rspack/core").Compilation, ...args_2: unknown[]) => boolean))[] | undefined;
|
|
432
|
+
watchOptions?: {
|
|
433
|
+
aggregateTimeout?: number | undefined;
|
|
434
|
+
followSymlinks?: boolean | undefined;
|
|
435
|
+
ignored?: string | RegExp | string[] | undefined;
|
|
436
|
+
poll?: number | boolean | undefined;
|
|
437
|
+
stdin?: boolean | undefined;
|
|
438
|
+
} | undefined;
|
|
439
|
+
watch?: boolean | undefined;
|
|
440
|
+
stats?: boolean | "verbose" | "normal" | "none" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary" | {
|
|
441
|
+
source?: boolean | undefined;
|
|
442
|
+
publicPath?: boolean | undefined;
|
|
443
|
+
all?: boolean | undefined;
|
|
444
|
+
chunks?: boolean | undefined;
|
|
445
|
+
usedExports?: boolean | undefined;
|
|
446
|
+
providedExports?: boolean | undefined;
|
|
447
|
+
preset?: boolean | "verbose" | "normal" | "none" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary" | undefined;
|
|
448
|
+
assets?: boolean | undefined;
|
|
449
|
+
modules?: boolean | undefined;
|
|
450
|
+
entrypoints?: boolean | "auto" | undefined;
|
|
451
|
+
chunkGroups?: boolean | undefined;
|
|
452
|
+
warnings?: boolean | undefined;
|
|
453
|
+
warningsCount?: boolean | undefined;
|
|
454
|
+
errors?: boolean | undefined;
|
|
455
|
+
errorsCount?: boolean | undefined;
|
|
456
|
+
colors?: boolean | undefined;
|
|
457
|
+
hash?: boolean | undefined;
|
|
458
|
+
version?: boolean | undefined;
|
|
459
|
+
reasons?: boolean | undefined;
|
|
460
|
+
outputPath?: boolean | undefined;
|
|
461
|
+
chunkModules?: boolean | undefined;
|
|
462
|
+
chunkRelations?: boolean | undefined;
|
|
463
|
+
ids?: boolean | undefined;
|
|
464
|
+
timings?: boolean | undefined;
|
|
465
|
+
builtAt?: boolean | undefined;
|
|
466
|
+
moduleAssets?: boolean | undefined;
|
|
467
|
+
nestedModules?: boolean | undefined;
|
|
468
|
+
logging?: boolean | "log" | "info" | "verbose" | "none" | "error" | "warn" | undefined;
|
|
469
|
+
loggingDebug?: string | boolean | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args_1: unknown[]) => boolean))[] | undefined;
|
|
470
|
+
loggingTrace?: boolean | undefined;
|
|
471
|
+
runtimeModules?: boolean | undefined;
|
|
472
|
+
children?: boolean | undefined;
|
|
473
|
+
optimizationBailout?: boolean | undefined;
|
|
474
|
+
groupModulesByType?: boolean | undefined;
|
|
475
|
+
groupModulesByCacheStatus?: boolean | undefined;
|
|
476
|
+
groupModulesByLayer?: boolean | undefined;
|
|
477
|
+
groupModulesByAttributes?: boolean | undefined;
|
|
478
|
+
groupModulesByPath?: boolean | undefined;
|
|
479
|
+
groupModulesByExtension?: boolean | undefined;
|
|
480
|
+
modulesSpace?: number | undefined;
|
|
481
|
+
chunkModulesSpace?: number | undefined;
|
|
482
|
+
nestedModulesSpace?: number | undefined;
|
|
483
|
+
relatedAssets?: boolean | undefined;
|
|
484
|
+
groupAssetsByEmitStatus?: boolean | undefined;
|
|
485
|
+
groupAssetsByInfo?: boolean | undefined;
|
|
486
|
+
groupAssetsByPath?: boolean | undefined;
|
|
487
|
+
groupAssetsByExtension?: boolean | undefined;
|
|
488
|
+
groupAssetsByChunk?: boolean | undefined;
|
|
489
|
+
assetsSpace?: number | undefined;
|
|
490
|
+
orphanModules?: boolean | undefined;
|
|
491
|
+
excludeModules?: string | boolean | RegExp | ((args_0: string, args_1: any, args_2: any) => boolean) | (string | RegExp | ((args_0: string, args_1: any, args_2: any) => boolean))[] | undefined;
|
|
492
|
+
excludeAssets?: string | RegExp | ((args_0: string, args_1: any) => boolean) | (string | RegExp | ((args_0: string, args_1: any) => boolean))[] | undefined;
|
|
493
|
+
modulesSort?: string | undefined;
|
|
494
|
+
chunkModulesSort?: string | undefined;
|
|
495
|
+
nestedModulesSort?: string | undefined;
|
|
496
|
+
chunksSort?: string | undefined;
|
|
497
|
+
assetsSort?: string | undefined;
|
|
498
|
+
performance?: boolean | undefined;
|
|
499
|
+
env?: boolean | undefined;
|
|
500
|
+
chunkGroupAuxiliary?: boolean | undefined;
|
|
501
|
+
chunkGroupChildren?: boolean | undefined;
|
|
502
|
+
chunkGroupMaxAssets?: number | undefined;
|
|
503
|
+
dependentModules?: boolean | undefined;
|
|
504
|
+
chunkOrigins?: boolean | undefined;
|
|
505
|
+
runtime?: boolean | undefined;
|
|
506
|
+
depth?: boolean | undefined;
|
|
507
|
+
reasonsSpace?: number | undefined;
|
|
508
|
+
groupReasonsByOrigin?: boolean | undefined;
|
|
509
|
+
errorDetails?: boolean | undefined;
|
|
510
|
+
errorStack?: boolean | undefined;
|
|
511
|
+
moduleTrace?: boolean | undefined;
|
|
512
|
+
cachedModules?: boolean | undefined;
|
|
513
|
+
cachedAssets?: boolean | undefined;
|
|
514
|
+
cached?: boolean | undefined;
|
|
515
|
+
errorsSpace?: number | undefined;
|
|
516
|
+
warningsSpace?: number | undefined;
|
|
517
|
+
} | undefined;
|
|
518
|
+
snapshot?: {} | undefined;
|
|
519
|
+
optimization?: {
|
|
520
|
+
moduleIds?: "named" | "natural" | "deterministic" | undefined;
|
|
521
|
+
chunkIds?: "named" | "natural" | "deterministic" | undefined;
|
|
522
|
+
minimize?: boolean | undefined;
|
|
523
|
+
minimizer?: (false | "" | 0 | import("@rspack/core").RspackPluginInstance | "..." | import("@rspack/core").RspackPluginFunction | import("@rspack/core").WebpackPluginInstance | import("@rspack/core").WebpackPluginFunction | null | undefined)[] | undefined;
|
|
524
|
+
mergeDuplicateChunks?: boolean | undefined;
|
|
525
|
+
usedExports?: boolean | "global" | undefined;
|
|
526
|
+
splitChunks?: false | {
|
|
527
|
+
name?: string | false | ((args_0: import("@rspack/core").Module | undefined, ...args_1: unknown[]) => unknown) | undefined;
|
|
528
|
+
chunks?: RegExp | "async" | "initial" | "all" | ((args_0: import("@rspack/core").Chunk, ...args_1: unknown[]) => boolean) | undefined;
|
|
529
|
+
defaultSizeTypes?: string[] | undefined;
|
|
530
|
+
minChunks?: number | undefined;
|
|
531
|
+
usedExports?: boolean | undefined;
|
|
532
|
+
minSize?: number | Record<string, number> | undefined;
|
|
533
|
+
maxSize?: number | Record<string, number> | undefined;
|
|
534
|
+
maxAsyncSize?: number | Record<string, number> | undefined;
|
|
535
|
+
maxInitialSize?: number | Record<string, number> | undefined;
|
|
536
|
+
maxAsyncRequests?: number | undefined;
|
|
537
|
+
maxInitialRequests?: number | undefined;
|
|
538
|
+
automaticNameDelimiter?: string | undefined;
|
|
539
|
+
cacheGroups?: Record<string, false | {
|
|
540
|
+
filename?: string | undefined;
|
|
541
|
+
name?: string | false | ((args_0: import("@rspack/core").Module | undefined, ...args_1: unknown[]) => unknown) | undefined;
|
|
542
|
+
priority?: number | undefined;
|
|
543
|
+
type?: string | RegExp | undefined;
|
|
544
|
+
test?: string | RegExp | ((args_0: import("@rspack/core").Module, ...args_1: unknown[]) => unknown) | undefined;
|
|
545
|
+
enforce?: boolean | undefined;
|
|
546
|
+
reuseExistingChunk?: boolean | undefined;
|
|
547
|
+
idHint?: string | undefined;
|
|
548
|
+
chunks?: RegExp | "async" | "initial" | "all" | ((args_0: import("@rspack/core").Chunk, ...args_1: unknown[]) => boolean) | undefined;
|
|
549
|
+
defaultSizeTypes?: string[] | undefined;
|
|
550
|
+
minChunks?: number | undefined;
|
|
551
|
+
usedExports?: boolean | undefined;
|
|
552
|
+
minSize?: number | Record<string, number> | undefined;
|
|
553
|
+
maxSize?: number | Record<string, number> | undefined;
|
|
554
|
+
maxAsyncSize?: number | Record<string, number> | undefined;
|
|
555
|
+
maxInitialSize?: number | Record<string, number> | undefined;
|
|
556
|
+
maxAsyncRequests?: number | undefined;
|
|
557
|
+
maxInitialRequests?: number | undefined;
|
|
558
|
+
automaticNameDelimiter?: string | undefined;
|
|
559
|
+
}> | undefined;
|
|
560
|
+
fallbackCacheGroup?: {
|
|
561
|
+
chunks?: RegExp | "async" | "initial" | "all" | ((args_0: import("@rspack/core").Chunk, ...args_1: unknown[]) => boolean) | undefined;
|
|
562
|
+
minSize?: number | undefined;
|
|
563
|
+
maxSize?: number | undefined;
|
|
564
|
+
maxAsyncSize?: number | undefined;
|
|
565
|
+
maxInitialSize?: number | undefined;
|
|
566
|
+
automaticNameDelimiter?: string | undefined;
|
|
567
|
+
} | undefined;
|
|
568
|
+
hidePathInfo?: boolean | undefined;
|
|
569
|
+
} | undefined;
|
|
570
|
+
runtimeChunk?: boolean | "single" | "multiple" | {
|
|
571
|
+
name?: string | ((args_0: {
|
|
572
|
+
name: string;
|
|
573
|
+
}, ...args_1: unknown[]) => string) | undefined;
|
|
574
|
+
} | undefined;
|
|
575
|
+
removeAvailableModules?: boolean | undefined;
|
|
576
|
+
removeEmptyChunks?: boolean | undefined;
|
|
577
|
+
realContentHash?: boolean | undefined;
|
|
578
|
+
sideEffects?: boolean | "flag" | undefined;
|
|
579
|
+
providedExports?: boolean | undefined;
|
|
580
|
+
concatenateModules?: boolean | undefined;
|
|
581
|
+
innerGraph?: boolean | undefined;
|
|
582
|
+
mangleExports?: boolean | "size" | "deterministic" | undefined;
|
|
583
|
+
nodeEnv?: string | false | undefined;
|
|
584
|
+
emitOnErrors?: boolean | undefined;
|
|
585
|
+
} | undefined;
|
|
586
|
+
resolveLoader?: import("@rspack/core").ResolveOptions | undefined;
|
|
587
|
+
plugins?: (false | "" | 0 | import("@rspack/core").RspackPluginInstance | import("@rspack/core").RspackPluginFunction | import("@rspack/core").WebpackPluginInstance | import("@rspack/core").WebpackPluginFunction | null | undefined)[] | undefined;
|
|
588
|
+
devServer?: import("@rspack/core").DevServer | undefined;
|
|
589
|
+
bail?: boolean | undefined;
|
|
590
|
+
};
|
|
591
|
+
//# sourceMappingURL=getRspackConfiguration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRspackConfiguration.d.ts","sourceRoot":"","sources":["../src/getRspackConfiguration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAK5E,wBAAgB,s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A4E,CAAC;yBAAiD,CAAC;2BAAiD,CAAC;uBAA8C,CAAC;uBAAsE,CAAC;4BAA2E,CAAC;8BAA6E,CAAC;gCAA+E,CAAC;kCAAwD,CAAC;sCAA4D,CAAC;;8BAAgF,CAAC;sBAA0B,CAAC,iFAAyD,GAAI;uBAAmE,CAAC;uBAA6C,CAAC;4BAAkD,CAAC;8BAAoD,CAAC;sCAA4D,CAAC;;wBAAyE,CAAC;;oBAAkE,CAAC;gBAAsD,CAAC;;eAAmE,GAAI;;8BAAgG,CAAC;yBAAgD,CAAC;uBAA8C,CAAC;mBAA0C,CAAC;uBAAuD,CAAC;0BAAiD,CAAC;kBAAyC,CAAC;qBAA4C,CAAC;eAAiE,CAAC;oBAAkD,CAAC;;;;;;EADnr/gB"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { shouldExternalizePackage, getSwcConfig } from '@ms-cloudpack/bundler-utilities';
|
|
2
|
+
import { merge } from 'webpack-merge';
|
|
3
|
+
import { getPathsOfModules } from './getPathsOfModules.js';
|
|
4
|
+
export function getRspackConfiguration(params, context) {
|
|
5
|
+
const { options, outputPath, newEntries } = params;
|
|
6
|
+
const { unsafeDisableInlineSvg: _, ...bundlerOptions } = options.bundlerOptions || {};
|
|
7
|
+
const isLibraryMode = context.config.mode === 'library';
|
|
8
|
+
const swcConfig = getSwcConfig({ packagePath: options.inputPath, sourcemap: options.sourcemap });
|
|
9
|
+
const config = {
|
|
10
|
+
mode: options.minify ? 'production' : 'development',
|
|
11
|
+
// For Rspack, it looks like this following is still needed as unit tests fail without removing the './'.
|
|
12
|
+
// Webpack (at least older versions) expects entry keys without a leading `./`.
|
|
13
|
+
// (The leading `./` seems to be okay with the latest version, but in older versions, it appears
|
|
14
|
+
// to cause the runtime chunk runtime.js to be generated with an incorrect relative path?)
|
|
15
|
+
entry: Object.fromEntries(Object.entries(newEntries).map(([key, value]) => [key.replace(/^\.\//, ''), value])),
|
|
16
|
+
context: options.inputPath,
|
|
17
|
+
resolve: {
|
|
18
|
+
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json'],
|
|
19
|
+
extensionAlias: {
|
|
20
|
+
'.js': ['.ts', '.js', '.tsx', '.jsx'],
|
|
21
|
+
'.mjs': ['.mts', '.mjs'],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
resolveLoader: {
|
|
25
|
+
modules: [
|
|
26
|
+
// Resolve loaders from the package's node_modules
|
|
27
|
+
'node_modules',
|
|
28
|
+
// Cloudpack provided loaders
|
|
29
|
+
...getPathsOfModules(['css-loader', 'style-loader', 'sass-loader']),
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
externals: isLibraryMode
|
|
33
|
+
? // These types can't be inferred due to use of zod types (which may be slightly incorrect too,
|
|
34
|
+
// since they don't allow returning undefined from the async version).
|
|
35
|
+
// Issue: https://github.com/web-infra-dev/rspack/issues/7979
|
|
36
|
+
// There's discussion here of moving away from zod types: https://github.com/web-infra-dev/rspack/issues/4241
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- API signature uses a promise
|
|
38
|
+
async (ctx) => {
|
|
39
|
+
if (ctx.request &&
|
|
40
|
+
!ctx.request.includes('!') && // webpack loader
|
|
41
|
+
shouldExternalizePackage({
|
|
42
|
+
id: ctx.request,
|
|
43
|
+
inlined: options.inlined,
|
|
44
|
+
external: options.external,
|
|
45
|
+
shouldInlineNodeBuiltins: false,
|
|
46
|
+
})) {
|
|
47
|
+
return ctx.request;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
: [],
|
|
51
|
+
target: ['web', 'es2020'],
|
|
52
|
+
//plugins: [new rspack.CssExtractRspackPlugin({})],
|
|
53
|
+
module: {
|
|
54
|
+
rules: [
|
|
55
|
+
{
|
|
56
|
+
oneOf: [
|
|
57
|
+
// Rule for global CSS files
|
|
58
|
+
{
|
|
59
|
+
test: /\.global\.css$/,
|
|
60
|
+
use: [
|
|
61
|
+
'style-loader',
|
|
62
|
+
{
|
|
63
|
+
loader: 'css-loader',
|
|
64
|
+
options: {
|
|
65
|
+
modules: {
|
|
66
|
+
localIdentName: '[local]', // Use the local name for global CSS
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
// Rule for CSS Modules files
|
|
73
|
+
{
|
|
74
|
+
test: /\.module\.css$/,
|
|
75
|
+
use: [
|
|
76
|
+
'style-loader',
|
|
77
|
+
{
|
|
78
|
+
loader: 'css-loader',
|
|
79
|
+
options: {
|
|
80
|
+
modules: true, // Enable CSS Modules
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
// Rule for regular CSS files
|
|
86
|
+
{
|
|
87
|
+
test: /\.css$/,
|
|
88
|
+
exclude: /\.module\.css$/, // Exclude CSS Modules files
|
|
89
|
+
use: [
|
|
90
|
+
'style-loader',
|
|
91
|
+
'css-loader', // Use css-loader without CSS Modules for regular CSS
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
test: /\.json$/,
|
|
98
|
+
type: 'json',
|
|
99
|
+
sideEffects: false,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
test: /\.ejs$/,
|
|
103
|
+
loader: 'ejs-loader',
|
|
104
|
+
options: {
|
|
105
|
+
variable: 'data',
|
|
106
|
+
esModule: true,
|
|
107
|
+
},
|
|
108
|
+
resolve: {
|
|
109
|
+
fullySpecified: false,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
// transform internal jsx files
|
|
114
|
+
test: /\.[cm]?jsx$/,
|
|
115
|
+
loader: 'builtin:swc-loader',
|
|
116
|
+
exclude: [/node_modules/],
|
|
117
|
+
options: swcConfig.js,
|
|
118
|
+
type: 'javascript/auto',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
// transform internal ts files
|
|
122
|
+
test: /\.[cm]?tsx?$/,
|
|
123
|
+
loader: 'builtin:swc-loader',
|
|
124
|
+
exclude: [/node_modules/],
|
|
125
|
+
options: swcConfig.ts,
|
|
126
|
+
type: 'javascript/auto',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
test: /\.s[ac]ss$/i,
|
|
130
|
+
use: ['style-loader', 'css-loader', 'sass-loader'],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
test: /\.worker\.js$/,
|
|
134
|
+
use: { loader: 'worker-rspack-loader' },
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
output: {
|
|
139
|
+
library: {
|
|
140
|
+
type: 'module',
|
|
141
|
+
},
|
|
142
|
+
chunkFormat: 'module',
|
|
143
|
+
chunkLoading: 'import',
|
|
144
|
+
path: outputPath,
|
|
145
|
+
module: true,
|
|
146
|
+
filename: '[name].js',
|
|
147
|
+
chunkFilename: '[id].chunk.js',
|
|
148
|
+
},
|
|
149
|
+
experiments: {
|
|
150
|
+
outputModule: true,
|
|
151
|
+
css: false,
|
|
152
|
+
},
|
|
153
|
+
devtool: options.sourcemap ? (isLibraryMode ? 'cheap-module-source-map' : 'source-map') : false,
|
|
154
|
+
optimization: {
|
|
155
|
+
runtimeChunk: 'single',
|
|
156
|
+
minimize: options.minify,
|
|
157
|
+
mangleExports: false,
|
|
158
|
+
splitChunks: {
|
|
159
|
+
// Prevents exposing path info when creating names for parts splitted by maxSize.
|
|
160
|
+
hidePathInfo: true,
|
|
161
|
+
// Figure out which exports are used by modules to mangle export names, omit unused
|
|
162
|
+
// exports and generate more efficient code.
|
|
163
|
+
usedExports: !isLibraryMode,
|
|
164
|
+
chunks: 'all',
|
|
165
|
+
//name: '[id].chunk', //TODO: is this needed?
|
|
166
|
+
// Production chunks should be at least 1000 bytes to prevent large numbers of file requests
|
|
167
|
+
minSize: isLibraryMode ? 0 : 1000,
|
|
168
|
+
cacheGroups: {
|
|
169
|
+
defaultVendors: false,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
if (Object.keys(bundlerOptions).length) {
|
|
175
|
+
return merge(config, bundlerOptions);
|
|
176
|
+
}
|
|
177
|
+
return config;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=getRspackConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRspackConfiguration.js","sourceRoot":"","sources":["../src/getRspackConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIzF,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,UAAU,sBAAsB,CACpC,MAG2C,EAC3C,OAAsB;IAEtB,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACnD,MAAM,EAAE,sBAAsB,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;IAEtF,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC;IAExD,MAAM,SAAS,GAAG,YAAY,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAEjG,MAAM,MAAM,GAAkB;QAC5B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa;QACnD,yGAAyG;QACzG,+EAA+E;QAC/E,gGAAgG;QAChG,0FAA0F;QAC1F,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CA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alizePackage, getSwcConfig } from '@ms-cloudpack/bundler-utilities';\nimport type { BundleContext, BundleOptions } from '@ms-cloudpack/common-types';\nimport type { WriteESMStubsResult } from '@ms-cloudpack/esm-stub-utilities';\nimport type { Configuration, ExternalItemFunctionData, ExternalItemValue } from '@rspack/core';\nimport { merge } from 'webpack-merge';\nimport { getPathsOfModules } from './getPathsOfModules.js';\n\nexport function getRspackConfiguration(\n params: {\n options: Omit<BundleOptions, 'entries' | 'outputPath'>;\n outputPath: string;\n } & Pick<WriteESMStubsResult, 'newEntries'>,\n context: BundleContext,\n) {\n const { options, outputPath, newEntries } = params;\n const { unsafeDisableInlineSvg: _, ...bundlerOptions } = options.bundlerOptions || {};\n\n const isLibraryMode = context.config.mode === 'library';\n\n const swcConfig = getSwcConfig({ packagePath: options.inputPath, sourcemap: options.sourcemap });\n\n const config: Configuration = {\n mode: options.minify ? 'production' : 'development',\n // For Rspack, it looks like this following is still needed as unit tests fail without removing the './'.\n // Webpack (at least older versions) expects entry keys without a leading `./`.\n // (The leading `./` seems to be okay with the latest version, but in older versions, it appears\n // to cause the runtime chunk runtime.js to be generated with an incorrect relative path?)\n entry: Object.fromEntries(Object.entries(newEntries).map(([key, value]) => [key.replace(/^\\.\\//, ''), value])),\n context: options.inputPath,\n resolve: {\n extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json'],\n extensionAlias: {\n '.js': ['.ts', '.js', '.tsx', '.jsx'],\n '.mjs': ['.mts', '.mjs'],\n },\n },\n resolveLoader: {\n modules: [\n // Resolve loaders from the package's node_modules\n 'node_modules',\n\n // Cloudpack provided loaders\n ...getPathsOfModules(['css-loader', 'style-loader', 'sass-loader']),\n ],\n },\n externals: isLibraryMode\n ? // These types can't be inferred due to use of zod types (which may be slightly incorrect too,\n // since they don't allow returning undefined from the async version).\n // Issue: https://github.com/web-infra-dev/rspack/issues/7979\n // There's discussion here of moving away from zod types: https://github.com/web-infra-dev/rspack/issues/4241\n // eslint-disable-next-line @typescript-eslint/require-await -- API signature uses a promise\n async (ctx: ExternalItemFunctionData): Promise<ExternalItemValue | undefined> => {\n if (\n ctx.request &&\n !ctx.request.includes('!') && // webpack loader\n shouldExternalizePackage({\n id: ctx.request,\n inlined: options.inlined,\n external: options.external,\n shouldInlineNodeBuiltins: false,\n })\n ) {\n return ctx.request;\n }\n }\n : [],\n target: ['web', 'es2020'],\n //plugins: [new rspack.CssExtractRspackPlugin({})],\n module: {\n rules: [\n {\n oneOf: [\n // Rule for global CSS files\n {\n test: /\\.global\\.css$/,\n use: [\n 'style-loader',\n {\n loader: 'css-loader',\n options: {\n modules: {\n localIdentName: '[local]', // Use the local name for global CSS\n },\n },\n },\n ],\n },\n // Rule for CSS Modules files\n {\n test: /\\.module\\.css$/,\n use: [\n 'style-loader',\n {\n loader: 'css-loader',\n options: {\n modules: true, // Enable CSS Modules\n },\n },\n ],\n },\n // Rule for regular CSS files\n {\n test: /\\.css$/,\n exclude: /\\.module\\.css$/, // Exclude CSS Modules files\n use: [\n 'style-loader',\n 'css-loader', // Use css-loader without CSS Modules for regular CSS\n ],\n },\n ],\n },\n {\n test: /\\.json$/,\n type: 'json',\n sideEffects: false,\n },\n {\n test: /\\.ejs$/,\n loader: 'ejs-loader',\n options: {\n variable: 'data',\n esModule: true,\n },\n resolve: {\n fullySpecified: false,\n },\n },\n {\n // transform internal jsx files\n test: /\\.[cm]?jsx$/,\n loader: 'builtin:swc-loader',\n exclude: [/node_modules/],\n options: swcConfig.js,\n type: 'javascript/auto',\n },\n {\n // transform internal ts files\n test: /\\.[cm]?tsx?$/,\n loader: 'builtin:swc-loader',\n exclude: [/node_modules/],\n options: swcConfig.ts,\n type: 'javascript/auto',\n },\n {\n test: /\\.s[ac]ss$/i,\n use: ['style-loader', 'css-loader', 'sass-loader'],\n },\n {\n test: /\\.worker\\.js$/,\n use: { loader: 'worker-rspack-loader' },\n },\n ],\n },\n output: {\n library: {\n type: 'module',\n },\n chunkFormat: 'module',\n chunkLoading: 'import',\n path: outputPath,\n module: true,\n filename: '[name].js',\n chunkFilename: '[id].chunk.js',\n },\n experiments: {\n outputModule: true,\n css: false,\n },\n devtool: options.sourcemap ? (isLibraryMode ? 'cheap-module-source-map' : 'source-map') : false,\n optimization: {\n runtimeChunk: 'single',\n minimize: options.minify,\n mangleExports: false,\n splitChunks: {\n // Prevents exposing path info when creating names for parts splitted by maxSize.\n hidePathInfo: true,\n\n // Figure out which exports are used by modules to mangle export names, omit unused\n // exports and generate more efficient code.\n usedExports: !isLibraryMode,\n\n chunks: 'all',\n\n //name: '[id].chunk', //TODO: is this needed?\n\n // Production chunks should be at least 1000 bytes to prevent large numbers of file requests\n minSize: isLibraryMode ? 0 : 1000,\n\n cacheGroups: {\n defaultVendors: false,\n },\n },\n },\n };\n\n if (Object.keys(bundlerOptions).length) {\n return merge(config, bundlerOptions);\n }\n\n return config;\n}\n"]}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { rspack as default } from './rspack.js';\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BundleOptions, BundlerResult } from '@ms-cloudpack/common-types';
|
|
2
|
+
import type { Configuration, Stats } from '@rspack/core';
|
|
3
|
+
export declare function normalizeRspackOutput(params: {
|
|
4
|
+
/** Rspack config */
|
|
5
|
+
config: Configuration;
|
|
6
|
+
/** Original options */
|
|
7
|
+
options: Pick<BundleOptions, 'entries' | 'inputPath'>;
|
|
8
|
+
/** Absolute output path */
|
|
9
|
+
outputPath: string;
|
|
10
|
+
/** Stats from rspack callback */
|
|
11
|
+
stats: Stats | undefined;
|
|
12
|
+
}): BundlerResult;
|
|
13
|
+
//# sourceMappingURL=normalizeRspackOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeRspackOutput.d.ts","sourceRoot":"","sources":["../src/normalizeRspackOutput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,aAAa,EAAoB,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhH,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAc,MAAM,cAAc,CAAC;AAErE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,oBAAoB;IACpB,MAAM,EAAE,aAAa,CAAC;IACtB,uBAAuB;IACvB,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC;IACtD,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B,GAAG,aAAa,CA8ChB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';
|
|
2
|
+
import { normalizedPathRelativeTo } from '@ms-cloudpack/path-utilities';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
export function normalizeRspackOutput(params) {
|
|
5
|
+
const { config, options: { entries, inputPath }, outputPath, stats, } = params;
|
|
6
|
+
// Process the errors and warnings from the stats json.
|
|
7
|
+
// This provides more straightforward access to file paths.
|
|
8
|
+
const statsJson = stats?.toJson();
|
|
9
|
+
return {
|
|
10
|
+
outputPath,
|
|
11
|
+
outputFiles: Object.keys(stats?.compilation?.assets || {}).map((asset) => {
|
|
12
|
+
const outFile = {
|
|
13
|
+
outputPath: normalizeRelativePath(asset),
|
|
14
|
+
};
|
|
15
|
+
// Webpack doesn't include entry point info in the output, so add manually if applicable
|
|
16
|
+
if (outFile.outputPath.endsWith('.js')) {
|
|
17
|
+
const entryPoint = entries[outFile.outputPath.replace(/\.js$/, '')];
|
|
18
|
+
if (entryPoint) {
|
|
19
|
+
outFile.entryPoint = entryPoint;
|
|
20
|
+
}
|
|
21
|
+
for (const chunk of statsJson?.chunks || []) {
|
|
22
|
+
// We don't have enough info to determine if a file is a worker
|
|
23
|
+
if (!chunk.files || !chunk.modules || !chunk.files.includes(asset)) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
// Check if the chunk has a worker
|
|
27
|
+
if (chunk.modules.some(({ reasons = [] }) => reasons.some((reason) => reason.type === 'new Worker()'))) {
|
|
28
|
+
// It is a worker!
|
|
29
|
+
outFile.isWorker = true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return outFile;
|
|
34
|
+
}),
|
|
35
|
+
errors: createBundleMessages(statsJson?.errors, inputPath),
|
|
36
|
+
warnings: createBundleMessages(statsJson?.warnings, inputPath),
|
|
37
|
+
rawInput: config,
|
|
38
|
+
rawOutput: statsJson,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Create BundleMessages from rspackErrors */
|
|
42
|
+
function createBundleMessages(rspackErrors, inputPath) {
|
|
43
|
+
return (rspackErrors || []).map((error) => {
|
|
44
|
+
const bundleMessage = {
|
|
45
|
+
text: error.message,
|
|
46
|
+
source: 'rspack',
|
|
47
|
+
};
|
|
48
|
+
const filePath = error.file || error.moduleName;
|
|
49
|
+
if (filePath) {
|
|
50
|
+
let [, line, col] = error?.loc?.match(/^(\d+):(\d+)/) || [];
|
|
51
|
+
if (!line) {
|
|
52
|
+
// look for something like '[<file path>:<line>:<col>]'
|
|
53
|
+
[, line, col] = error.message.match(/:(\d+):(\d+)\]/) || [];
|
|
54
|
+
}
|
|
55
|
+
if (!line) {
|
|
56
|
+
// rspack errors can look like this:
|
|
57
|
+
// × HarmonyLinkingError: export 'foo' (reexported as 'foo') was not found in './bar.js' (possible exports: bar)
|
|
58
|
+
// ╭────
|
|
59
|
+
// 1 │ export { foo } from './bar.js';
|
|
60
|
+
// · ───────────────────────────────
|
|
61
|
+
// ╰────
|
|
62
|
+
// × Module parse failed:
|
|
63
|
+
// ╰─▶ × JavaScript parsing error: Expression expected
|
|
64
|
+
// ╭────
|
|
65
|
+
// 1 │ }export default function() { console.log('oops leading closing bracket'); }
|
|
66
|
+
// · ─
|
|
67
|
+
// ╰────
|
|
68
|
+
// group 1: line number; group 2: length = column number (0-indexed)
|
|
69
|
+
const errorMatch = error.message.match(/(\d+) │ .*\n +· ( *)─/);
|
|
70
|
+
if (errorMatch) {
|
|
71
|
+
line = errorMatch[1];
|
|
72
|
+
col = `${errorMatch[2].length}`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
bundleMessage.location = {
|
|
76
|
+
file: path.isAbsolute(filePath)
|
|
77
|
+
? normalizedPathRelativeTo(inputPath, filePath)
|
|
78
|
+
: normalizeRelativePath(filePath),
|
|
79
|
+
line: typeof line === 'string' ? Number(line) : undefined,
|
|
80
|
+
column: typeof col === 'string' ? Number(col) : undefined,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return bundleMessage;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=normalizeRspackOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeRspackOutput.js","sourceRoot":"","sources":["../src/normalizeRspackOutput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,UAAU,qBAAqB,CAAC,MASrC;IACC,MAAM,EACJ,MAAM,EACN,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAC/B,UAAU,EACV,KAAK,GACN,GAAG,MA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UAAU,CAAC,CAAC,CAAC,CAAC;oBACrB,GAAG,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;gBAClC,CAAC;YACH,CAAC;YAED,aAAa,CAAC,QAAQ,GAAG;gBACvB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;oBAC7B,CAAC,CAAC,wBAAwB,CAAC,SAAS,EAAE,QAAQ,CAAC;oBAC/C,CAAC,CAAC,qBAAqB,CAAC,QAAQ,CAAC;gBACnC,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;gBACzD,MAAM,EAAE,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;aAC1D,CAAC;QACJ,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { BundleMessage, BundleOptions, BundleOutputFile, BundlerResult } from '@ms-cloudpack/common-types';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport { normalizedPathRelativeTo } from '@ms-cloudpack/path-utilities';\nimport path from 'path';\nimport type { Configuration, Stats, StatsError } from '@rspack/core';\n\nexport function normalizeRspackOutput(params: {\n /** Rspack config */\n config: Configuration;\n /** Original options */\n options: Pick<BundleOptions, 'entries' | 'inputPath'>;\n /** Absolute output path */\n outputPath: string;\n /** Stats from rspack callback */\n stats: Stats | undefined;\n}): BundlerResult {\n const {\n config,\n options: { entries, inputPath },\n outputPath,\n stats,\n } = params;\n\n // Process the errors and warnings from the stats json.\n // This provides more straightforward access to file paths.\n const statsJson = stats?.toJson();\n\n return {\n outputPath,\n outputFiles: Object.keys(stats?.compilation?.assets || {}).map((asset): BundleOutputFile => {\n const outFile: BundleOutputFile = {\n outputPath: normalizeRelativePath(asset),\n };\n\n // Webpack doesn't include entry point info in the output, so add manually if applicable\n if (outFile.outputPath.endsWith('.js')) {\n const entryPoint = entries[outFile.outputPath.replace(/\\.js$/, '')];\n if (entryPoint) {\n outFile.entryPoint = entryPoint;\n }\n for (const chunk of statsJson?.chunks || []) {\n // We don't have enough info to determine if a file is a worker\n if (!chunk.files || !chunk.modules || !chunk.files.includes(asset)) {\n continue;\n }\n\n // Check if the chunk has a worker\n if (chunk.modules.some(({ reasons = [] }) => reasons.some((reason) => reason.type === 'new Worker()'))) {\n // It is a worker!\n outFile.isWorker = true;\n }\n }\n }\n\n return outFile;\n }),\n errors: createBundleMessages(statsJson?.errors, inputPath),\n warnings: createBundleMessages(statsJson?.warnings, inputPath),\n rawInput: config as unknown as Record<string, unknown>,\n rawOutput: statsJson,\n };\n}\n\n/** Create BundleMessages from rspackErrors */\nfunction createBundleMessages(rspackErrors: StatsError[] | undefined, inputPath: string): BundleMessage[] {\n return (rspackErrors || []).map((error) => {\n const bundleMessage: BundleMessage = {\n text: error.message,\n source: 'rspack',\n };\n\n const filePath = error.file || error.moduleName;\n\n if (filePath) {\n let [, line, col] = error?.loc?.match(/^(\\d+):(\\d+)/) || [];\n if (!line) {\n // look for something like '[<file path>:<line>:<col>]'\n [, line, col] = error.message.match(/:(\\d+):(\\d+)\\]/) || [];\n }\n if (!line) {\n // rspack errors can look like this:\n // × HarmonyLinkingError: export 'foo' (reexported as 'foo') was not found in './bar.js' (possible exports: bar)\n // ╭────\n // 1 │ export { foo } from './bar.js';\n // · ───────────────────────────────\n // ╰────\n\n // × Module parse failed:\n // ╰─▶ × JavaScript parsing error: Expression expected\n // ╭────\n // 1 │ }export default function() { console.log('oops leading closing bracket'); }\n // · ─\n // ╰────\n // group 1: line number; group 2: length = column number (0-indexed)\n const errorMatch = error.message.match(/(\\d+) │ .*\\n +· ( *)─/);\n if (errorMatch) {\n line = errorMatch[1];\n col = `${errorMatch[2].length}`;\n }\n }\n\n bundleMessage.location = {\n file: path.isAbsolute(filePath)\n ? normalizedPathRelativeTo(inputPath, filePath)\n : normalizeRelativePath(filePath),\n line: typeof line === 'string' ? Number(line) : undefined,\n column: typeof col === 'string' ? Number(col) : undefined,\n };\n }\n\n return bundleMessage;\n });\n}\n"]}
|
package/lib/rspack.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../src/rspack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6C,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAWrG,eAAO,MAAM,MAAM,EAAE,OA0CpB,CAAC"}
|
package/lib/rspack.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { processCapabilities } from '@ms-cloudpack/bundler-capabilities';
|
|
2
|
+
import { rspack as runRspack } from '@rspack/core';
|
|
3
|
+
import { rspackCapabilities } from './rspackCapabilities.js';
|
|
4
|
+
import { getRspackConfiguration } from './getRspackConfiguration.js';
|
|
5
|
+
import { writeESMStubsInWorker } from '@ms-cloudpack/esm-stub-utilities';
|
|
6
|
+
import { normalizeRspackOutput } from './normalizeRspackOutput.js';
|
|
7
|
+
const bundlerName = 'rspack';
|
|
8
|
+
const defaultExtensionsToInline = ['png', 'jpg', 'jpeg', 'gif', 'svg'];
|
|
9
|
+
export const rspack = {
|
|
10
|
+
name: bundlerName,
|
|
11
|
+
bundle: async function (options, context) {
|
|
12
|
+
const { errors, newEntries } = await writeESMStubsInWorker(options);
|
|
13
|
+
if (errors?.length) {
|
|
14
|
+
return { errors };
|
|
15
|
+
}
|
|
16
|
+
const outputPath = options.outputPath ?? options.inputPath;
|
|
17
|
+
const bundlerCapabilitiesOptions = {
|
|
18
|
+
// Enable asset-inline by default for common image types
|
|
19
|
+
'asset-inline': { extensions: defaultExtensionsToInline },
|
|
20
|
+
...(options.bundlerCapabilities || {}),
|
|
21
|
+
};
|
|
22
|
+
const config = await processCapabilities({
|
|
23
|
+
bundlerName,
|
|
24
|
+
baseConfig: getRspackConfiguration({ options, outputPath, newEntries }, context),
|
|
25
|
+
bundlerCapabilitiesOptions,
|
|
26
|
+
internalCapabilities: rspackCapabilities,
|
|
27
|
+
});
|
|
28
|
+
try {
|
|
29
|
+
const stats = await new Promise((resolve, reject) => {
|
|
30
|
+
runRspack(config, (err, statsResult) => (err ? reject(err) : resolve(statsResult)));
|
|
31
|
+
});
|
|
32
|
+
// Normalize the output outside the callback, so if there's an exception it's not swallowed
|
|
33
|
+
return normalizeRspackOutput({ stats, config, outputPath, options });
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
const errorMessage = { text: err.message || String(err), source: bundlerName };
|
|
37
|
+
if (err instanceof Error && err.stack) {
|
|
38
|
+
// remove the message from the stack
|
|
39
|
+
errorMessage.notes = [{ text: err.stack.includes(err.message) ? err.stack.split(err.message)[1] : err.stack }];
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
errors: [errorMessage],
|
|
43
|
+
rawInput: config,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=rspack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.js","sourceRoot":"","sources":["../src/rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,MAAM,IAAI,SAAS,EAAc,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,WAAW,GAAG,QAAQ,CAAC;AAE7B,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,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GAAkB,EAAE,IAAI,EAAG,GAAa,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;YACzG,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;gBACtC,oCAAoC;gBACpC,YAAY,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;YACjH,CAAC;YACD,OAAO;gBACL,MAAM,EAAE,CAAC,YAAY,CAAC;gBACtB,QAAQ,EAAE,MAAiC;aAC5C,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { processCapabilities } from '@ms-cloudpack/bundler-capabilities';\nimport type { BundleMessage, BundlerCapabilitiesOptions, Bundler } from '@ms-cloudpack/common-types';\nimport { rspack as runRspack, type Stats } from '@rspack/core';\nimport { rspackCapabilities } from './rspackCapabilities.js';\nimport { getRspackConfiguration } from './getRspackConfiguration.js';\nimport { writeESMStubsInWorker } from '@ms-cloudpack/esm-stub-utilities';\nimport { normalizeRspackOutput } from './normalizeRspackOutput.js';\n\nconst bundlerName = 'rspack';\n\nconst defaultExtensionsToInline = ['png', 'jpg', 'jpeg', 'gif', 'svg'];\n\nexport const rspack: Bundler = {\n name: bundlerName,\n bundle: async function (options, context) {\n const { errors, newEntries } = await writeESMStubsInWorker(options);\n if (errors?.length) {\n return { errors };\n }\n\n const outputPath = options.outputPath ?? options.inputPath;\n\n const bundlerCapabilitiesOptions: BundlerCapabilitiesOptions = {\n // Enable asset-inline by default for common image types\n 'asset-inline': { extensions: defaultExtensionsToInline },\n ...(options.bundlerCapabilities || {}),\n };\n\n const config = await processCapabilities({\n bundlerName,\n baseConfig: getRspackConfiguration({ options, outputPath, newEntries }, context),\n bundlerCapabilitiesOptions,\n internalCapabilities: rspackCapabilities,\n });\n\n try {\n const stats = await new Promise<Stats | undefined>((resolve, reject) => {\n runRspack(config, (err, statsResult) => (err ? reject(err) : resolve(statsResult)));\n });\n\n // Normalize the output outside the callback, so if there's an exception it's not swallowed\n return normalizeRspackOutput({ stats, config, outputPath, options });\n } catch (err) {\n const errorMessage: BundleMessage = { text: (err as Error).message || String(err), source: bundlerName };\n if (err instanceof Error && err.stack) {\n // remove the message from the stack\n errorMessage.notes = [{ text: err.stack.includes(err.message) ? err.stack.split(err.message)[1] : err.stack }];\n }\n return {\n errors: [errorMessage],\n rawInput: config as Record<string, unknown>,\n };\n }\n },\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InternalBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';
|
|
2
|
+
import type { Configuration } from '@rspack/core';
|
|
3
|
+
export declare const rspackCapabilities: InternalBundlerCapabilityImplementations<Configuration>;
|
|
4
|
+
//# sourceMappingURL=rspackCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspackCapabilities.d.ts","sourceRoot":"","sources":["../src/rspackCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,kBAAkB,EAAE,wCAAwC,CAAC,aAAa,CAwBtF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const rspackCapabilities = {
|
|
2
|
+
'asset-inline': (config, options) => {
|
|
3
|
+
// Remove the leading dot from the extensions
|
|
4
|
+
const extensions = options.extensions.map((ext) => (ext.startsWith('.') ? ext.slice(1) : ext));
|
|
5
|
+
config.module ??= {};
|
|
6
|
+
config.module.rules ??= [];
|
|
7
|
+
config.module.rules.push({
|
|
8
|
+
test: new RegExp(`\\.(${extensions.join('|')})$`, 'i'),
|
|
9
|
+
type: 'asset/inline',
|
|
10
|
+
});
|
|
11
|
+
return config;
|
|
12
|
+
},
|
|
13
|
+
alias: (config, options) => {
|
|
14
|
+
// Add aliases for externalized packages to the webpack configuration
|
|
15
|
+
if (!config.externals) {
|
|
16
|
+
config.externals = [];
|
|
17
|
+
}
|
|
18
|
+
else if (!Array.isArray(config.externals)) {
|
|
19
|
+
config.externals = [config.externals];
|
|
20
|
+
}
|
|
21
|
+
// The aliased packaged must be the first element in the array,
|
|
22
|
+
// so that it is resolved before all other packages are externalized.
|
|
23
|
+
config.externals.unshift(options);
|
|
24
|
+
return config;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=rspackCapabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspackCapabilities.js","sourceRoot":"","sources":["../src/rspackCapabilities.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,kBAAkB,GAA4D;IACzF,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QAClC,6CAA6C;QAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/F,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC;QACrB,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACvB,IAAI,EAAE,IAAI,MAAM,CAAC,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC;YACtD,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QACzB,qEAAqE;QACrE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACtB,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;QACxB,CAAC;aAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5C,MAAM,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;QACD,+DAA+D;QAC/D,qEAAqE;QACrE,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAClC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC","sourcesContent":["import type { InternalBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';\nimport type { Configuration } from '@rspack/core';\n\nexport const rspackCapabilities: InternalBundlerCapabilityImplementations<Configuration> = {\n 'asset-inline': (config, options) => {\n // Remove the leading dot from the extensions\n const extensions = options.extensions.map((ext) => (ext.startsWith('.') ? ext.slice(1) : ext));\n config.module ??= {};\n config.module.rules ??= [];\n config.module.rules.push({\n test: new RegExp(`\\\\.(${extensions.join('|')})$`, 'i'),\n type: 'asset/inline',\n });\n return config;\n },\n alias: (config, options) => {\n // Add aliases for externalized packages to the webpack configuration\n if (!config.externals) {\n config.externals = [];\n } else if (!Array.isArray(config.externals)) {\n config.externals = [config.externals];\n }\n // The aliased packaged must be the first element in the array,\n // so that it is resolved before all other packages are externalized.\n config.externals.unshift(options);\n return config;\n },\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.47.9"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ms-cloudpack/bundler-rspack",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "A cloudpack plugin for abstracting rspack.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"source": "./src/index.ts",
|
|
12
|
+
"types": "./lib/index.d.ts",
|
|
13
|
+
"import": "./lib/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@ms-cloudpack/bundler-capabilities": "^0.1.25",
|
|
18
|
+
"@ms-cloudpack/bundler-utilities": "^0.1.3",
|
|
19
|
+
"@ms-cloudpack/common-types": "^0.22.0",
|
|
20
|
+
"@ms-cloudpack/esm-stub-utilities": "^0.13.6",
|
|
21
|
+
"@ms-cloudpack/path-string-parsing": "^1.2.4",
|
|
22
|
+
"@ms-cloudpack/path-utilities": "^2.7.48",
|
|
23
|
+
"@rspack/core": "^1.0.0 || ^1.0.0-0",
|
|
24
|
+
"@swc/core": "^1.3.0",
|
|
25
|
+
"css-loader": "^6.0.0",
|
|
26
|
+
"ejs-loader": "^0.5.0",
|
|
27
|
+
"import-meta-resolve": "^4.0.0",
|
|
28
|
+
"sass": "^1.0.0",
|
|
29
|
+
"sass-loader": "^14.0.0",
|
|
30
|
+
"style-loader": "^3.0.0",
|
|
31
|
+
"webpack": "^5.0.0",
|
|
32
|
+
"webpack-merge": "^6.0.0",
|
|
33
|
+
"worker-rspack-loader": "^3.1.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@ms-cloudpack/bundler-tests": "^0.1.0",
|
|
37
|
+
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
|
|
38
|
+
"@ms-cloudpack/scripts": "^0.0.1",
|
|
39
|
+
"@ms-cloudpack/test-utilities": "^0.5.0"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"api": "cloudpack-scripts api",
|
|
43
|
+
"build:watch": "cloudpack-scripts build-watch",
|
|
44
|
+
"build": "cloudpack-scripts build",
|
|
45
|
+
"lint:update": "cloudpack-scripts lint-update",
|
|
46
|
+
"lint": "cloudpack-scripts lint",
|
|
47
|
+
"test:update": "cloudpack-scripts test-update",
|
|
48
|
+
"test:watch": "cloudpack-scripts test-watch",
|
|
49
|
+
"test": "cloudpack-scripts test"
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"lib/**/!(*.test.*)"
|
|
53
|
+
]
|
|
54
|
+
}
|