@nx/rspack 22.4.0-canary.20251229-0da6921 → 22.4.0-canary.20260101-80cde6a
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/package.json +7 -7
- package/src/executors/rspack/schema.d.ts +8 -1
- package/src/executors/rspack/schema.json +32 -1
- package/src/plugins/utils/apply-base-config.js +31 -9
- package/src/plugins/utils/models.d.ts +22 -0
- package/src/plugins/utils/models.d.ts.map +1 -1
- package/src/plugins/utils/plugins/generate-package-json-plugin.d.ts +2 -0
- package/src/plugins/utils/plugins/generate-package-json-plugin.d.ts.map +1 -1
- package/src/plugins/utils/plugins/generate-package-json-plugin.js +20 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/rspack",
|
|
3
3
|
"description": "The Nx Plugin for Rspack contains executors and generators that support building applications using Rspack.",
|
|
4
|
-
"version": "22.4.0-canary.
|
|
4
|
+
"version": "22.4.0-canary.20260101-80cde6a",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"generators": "./generators.json",
|
|
25
25
|
"executors": "./executors.json",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@nx/devkit": "22.4.0-canary.
|
|
28
|
-
"@nx/js": "22.4.0-canary.
|
|
29
|
-
"@nx/module-federation": "22.4.0-canary.
|
|
30
|
-
"@nx/web": "22.4.0-canary.
|
|
27
|
+
"@nx/devkit": "22.4.0-canary.20260101-80cde6a",
|
|
28
|
+
"@nx/js": "22.4.0-canary.20260101-80cde6a",
|
|
29
|
+
"@nx/module-federation": "22.4.0-canary.20260101-80cde6a",
|
|
30
|
+
"@nx/web": "22.4.0-canary.20260101-80cde6a",
|
|
31
31
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
32
32
|
"@rspack/core": "^1.5.2",
|
|
33
33
|
"@rspack/dev-server": "^1.1.4",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"webpack-node-externals": "^3.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"nx": "22.4.0-canary.
|
|
61
|
-
"@nx/nest": "22.4.0-canary.
|
|
60
|
+
"nx": "22.4.0-canary.20260101-80cde6a",
|
|
61
|
+
"@nx/nest": "22.4.0-canary.20260101-80cde6a"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@module-federation/enhanced": "^0.21.2",
|
|
@@ -12,6 +12,7 @@ export interface RspackExecutorSchema {
|
|
|
12
12
|
fileReplacements?: FileReplacement[];
|
|
13
13
|
generateIndexHtml?: boolean;
|
|
14
14
|
generatePackageJson?: boolean;
|
|
15
|
+
runtimeDependencies?: string[];
|
|
15
16
|
index?: string;
|
|
16
17
|
indexHtml?: string;
|
|
17
18
|
main?: string;
|
|
@@ -31,7 +32,9 @@ export interface RspackExecutorSchema {
|
|
|
31
32
|
rspackConfig?: string;
|
|
32
33
|
runtimeChunk?: boolean;
|
|
33
34
|
scripts?: Array<ExtraEntryPointClass | string>;
|
|
35
|
+
/** @deprecated Use `typeCheckOptions` option instead. */
|
|
34
36
|
skipTypeChecking?: boolean;
|
|
37
|
+
typeCheckOptions?: boolean | TypeCheckOptions;
|
|
35
38
|
sourceMap?: boolean | DevTool;
|
|
36
39
|
standardRspackConfigFunction?: boolean;
|
|
37
40
|
statsJson?: boolean;
|
|
@@ -44,10 +47,10 @@ export interface RspackExecutorSchema {
|
|
|
44
47
|
target?: 'web' | 'node';
|
|
45
48
|
transformers?: TransformerEntry[];
|
|
46
49
|
tsConfig?: string;
|
|
47
|
-
typeCheck?: boolean;
|
|
48
50
|
verbose?: boolean;
|
|
49
51
|
vendorChunk?: boolean;
|
|
50
52
|
watch?: boolean;
|
|
53
|
+
cache?: boolean;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
export interface AssetGlobPattern {
|
|
@@ -67,6 +70,10 @@ export interface OptimizationOptions {
|
|
|
67
70
|
styles: boolean;
|
|
68
71
|
}
|
|
69
72
|
|
|
73
|
+
export interface TypeCheckOptions {
|
|
74
|
+
async: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
70
77
|
export interface NormalizedRspackExecutorSchema extends RspackExecutorSchema {
|
|
71
78
|
outputFileName: string;
|
|
72
79
|
assets: AssetGlobPattern[];
|
|
@@ -29,7 +29,27 @@
|
|
|
29
29
|
"skipTypeChecking": {
|
|
30
30
|
"alias": "typeCheck",
|
|
31
31
|
"type": "boolean",
|
|
32
|
-
"description": "Skip the type checking. Default is `false`."
|
|
32
|
+
"description": "Skip the type checking. Default is `false`.",
|
|
33
|
+
"x-deprecated": "Use `typeCheckOptions` instead. This option will be removed in Nx 24."
|
|
34
|
+
},
|
|
35
|
+
"typeCheckOptions": {
|
|
36
|
+
"description": "Configure type checking during the build. Set to `true` to enable with defaults (async: true). Set to `false` to disable type checking entirely. Use `{ async: true }` to run type checking in a separate process without blocking the build. Default is `{ async: true }`.",
|
|
37
|
+
"oneOf": [
|
|
38
|
+
{
|
|
39
|
+
"type": "boolean"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"async": {
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"description": "Run type checking in a separate process without blocking the build.",
|
|
47
|
+
"default": true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"additionalProperties": false
|
|
51
|
+
}
|
|
52
|
+
]
|
|
33
53
|
},
|
|
34
54
|
"index": {
|
|
35
55
|
"alias": "indexHtml",
|
|
@@ -130,6 +150,13 @@
|
|
|
130
150
|
"type": "boolean",
|
|
131
151
|
"description": "Generates a `package.json` and pruned lock file with the project's `node_module` dependencies populated for installing in a container. If a `package.json` exists in the project's directory, it will be reused with dependencies populated."
|
|
132
152
|
},
|
|
153
|
+
"runtimeDependencies": {
|
|
154
|
+
"type": "array",
|
|
155
|
+
"items": {
|
|
156
|
+
"type": "string"
|
|
157
|
+
},
|
|
158
|
+
"description": "Add runtime dependencies to the generated `package.json` file. Useful for Docker installs. Only works in conjunction with `generatePackageJson` option."
|
|
159
|
+
},
|
|
133
160
|
"additionalEntryPoints": {
|
|
134
161
|
"type": "array",
|
|
135
162
|
"items": {
|
|
@@ -275,6 +302,10 @@
|
|
|
275
302
|
"vendorChunk": {
|
|
276
303
|
"type": "boolean",
|
|
277
304
|
"description": "Use a separate bundle containing only vendor libraries."
|
|
305
|
+
},
|
|
306
|
+
"cache": {
|
|
307
|
+
"type": "boolean",
|
|
308
|
+
"description": "Configure rspack caching behavior. When not specified, defaults to `true` for Node targets in watch mode, and `undefined` otherwise."
|
|
278
309
|
}
|
|
279
310
|
},
|
|
280
311
|
"required": ["rspackConfig"],
|
|
@@ -67,10 +67,12 @@ function applyNxIndependentConfig(options, config) {
|
|
|
67
67
|
// When target is Node, the Webpack mode will be set to 'none' which disables in memory caching and causes a full rebuild on every change.
|
|
68
68
|
// So to mitigate this we enable in memory caching when target is Node and in watch mode.
|
|
69
69
|
config.cache =
|
|
70
|
-
|
|
71
|
-
options.
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
'cache' in options
|
|
71
|
+
? options.cache
|
|
72
|
+
: (options.target === 'node' || options.target === 'async-node') &&
|
|
73
|
+
options.watch
|
|
74
|
+
? true
|
|
75
|
+
: undefined;
|
|
74
76
|
config.devtool =
|
|
75
77
|
options.sourceMap === true ? 'source-map' : options.sourceMap;
|
|
76
78
|
config.output = {
|
|
@@ -212,13 +214,33 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
|
212
214
|
if (options.useTsconfigPaths) {
|
|
213
215
|
plugins.push(new nx_tsconfig_paths_rspack_plugin_1.NxTsconfigPathsRspackPlugin({ ...options, tsConfig }));
|
|
214
216
|
}
|
|
217
|
+
// Normalize typeCheckOptions from deprecated skipTypeChecking for backward compatibility
|
|
218
|
+
const defaultTypeCheckOptions = { async: true };
|
|
219
|
+
let typeCheckOptions;
|
|
220
|
+
if (options.typeCheckOptions !== undefined) {
|
|
221
|
+
if (options.typeCheckOptions === true) {
|
|
222
|
+
typeCheckOptions = defaultTypeCheckOptions;
|
|
223
|
+
}
|
|
224
|
+
else if (options.typeCheckOptions === false) {
|
|
225
|
+
typeCheckOptions = false;
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
typeCheckOptions = options.typeCheckOptions;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else if (options.skipTypeChecking) {
|
|
232
|
+
typeCheckOptions = false;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
typeCheckOptions = defaultTypeCheckOptions;
|
|
236
|
+
}
|
|
215
237
|
// New TS Solution already has a typecheck target but allow it to run during serve
|
|
216
|
-
|
|
217
|
-
(isUsingTsSolution
|
|
218
|
-
|
|
219
|
-
process.env['WEBPACK_SERVE'])) {
|
|
238
|
+
const shouldTypeCheck = typeCheckOptions !== false &&
|
|
239
|
+
(!isUsingTsSolution || process.env['WEBPACK_SERVE']);
|
|
240
|
+
if (shouldTypeCheck) {
|
|
220
241
|
const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
|
|
221
242
|
const pluginConfig = {
|
|
243
|
+
...typeCheckOptions,
|
|
222
244
|
typescript: {
|
|
223
245
|
configFile: path.isAbsolute(tsConfig)
|
|
224
246
|
? tsConfig
|
|
@@ -352,7 +374,7 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
|
352
374
|
};
|
|
353
375
|
config.externals = externals;
|
|
354
376
|
// Enabled for performance
|
|
355
|
-
config.cache = true;
|
|
377
|
+
config.cache = 'cache' in options ? options.cache : true;
|
|
356
378
|
config.module = {
|
|
357
379
|
...config.module,
|
|
358
380
|
rules: [
|
|
@@ -39,6 +39,9 @@ export interface OptimizationOptions {
|
|
|
39
39
|
scripts: boolean;
|
|
40
40
|
styles: boolean;
|
|
41
41
|
}
|
|
42
|
+
export interface TypeCheckOptions {
|
|
43
|
+
async: boolean;
|
|
44
|
+
}
|
|
42
45
|
export interface NxAppRspackPluginOptions {
|
|
43
46
|
/**
|
|
44
47
|
* The tsconfig file for the project. e.g. `tsconfig.json`
|
|
@@ -96,6 +99,10 @@ export interface NxAppRspackPluginOptions {
|
|
|
96
99
|
* Generate a `package.json` file for the bundle. Useful for Node applications.
|
|
97
100
|
*/
|
|
98
101
|
generatePackageJson?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Add runtime dependencies to the generated `package.json` file. Useful for Docker installs. Only works in conjunction with `generatePackageJson` option.
|
|
104
|
+
*/
|
|
105
|
+
runtimeDependencies?: string[];
|
|
99
106
|
/**
|
|
100
107
|
* Path to the `index.html`.
|
|
101
108
|
*/
|
|
@@ -162,12 +169,23 @@ export interface NxAppRspackPluginOptions {
|
|
|
162
169
|
skipPackageManager?: boolean;
|
|
163
170
|
/**
|
|
164
171
|
* Skip type checking. Default is `false`.
|
|
172
|
+
* @deprecated Use `typeCheckOptions` option instead. This option will be removed in Nx 24.
|
|
165
173
|
*/
|
|
166
174
|
skipTypeChecking?: boolean;
|
|
167
175
|
/**
|
|
168
176
|
* Skip type checking. Default is `false`.
|
|
177
|
+
* @deprecated Use `typeCheckOptions` option instead. This option will be removed in Nx 24.
|
|
169
178
|
*/
|
|
170
179
|
typeCheck?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Configure type checking during the build.
|
|
182
|
+
* - Set to `true` to enable type checking with default options (async: true).
|
|
183
|
+
* - Set to `false` to disable type checking entirely.
|
|
184
|
+
* - Use `{ async: true }` to run type checking in a separate process without blocking the build.
|
|
185
|
+
* - Use `{ async: false }` to run type checking synchronously.
|
|
186
|
+
* Default is `{ async: true }`.
|
|
187
|
+
*/
|
|
188
|
+
typeCheckOptions?: boolean | TypeCheckOptions;
|
|
171
189
|
/**
|
|
172
190
|
* Generate source maps.
|
|
173
191
|
*/
|
|
@@ -224,6 +242,10 @@ export interface NxAppRspackPluginOptions {
|
|
|
224
242
|
* Watch for file changes.
|
|
225
243
|
*/
|
|
226
244
|
watch?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Configure rspack caching behavior. When not specified, defaults to `true` for Node targets in watch mode, and `undefined` otherwise.
|
|
247
|
+
*/
|
|
248
|
+
cache?: boolean;
|
|
227
249
|
/**
|
|
228
250
|
* Set a public path for assets resources with absolute paths.
|
|
229
251
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../../packages/rspack/src/plugins/utils/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,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AC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,mBAAmB,CAAC;IAC7C;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,oBAAoB,GAAG,MAAM,CAAC,CAAC;IAC/C;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../../packages/rspack/src/plugins/utils/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,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;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,kCACf,SAAQ,wBAAwB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;CAC9B"}
|
|
@@ -10,7 +10,9 @@ export declare class GeneratePackageJsonPlugin implements RspackPluginInstance {
|
|
|
10
10
|
projectName: string;
|
|
11
11
|
targetName: string;
|
|
12
12
|
projectGraph: ProjectGraph;
|
|
13
|
+
runtimeDependencies?: string[];
|
|
13
14
|
});
|
|
15
|
+
private resolveRuntimeDependencies;
|
|
14
16
|
apply(compiler: Compiler): void;
|
|
15
17
|
}
|
|
16
18
|
//# sourceMappingURL=generate-package-json-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-package-json-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/rspack/src/plugins/utils/plugins/generate-package-json-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-package-json-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/rspack/src/plugins/utils/plugins/generate-package-json-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAStB,OAAO,EAEL,KAAK,YAAY,EAGlB,MAAM,YAAY,CAAC;AAIpB,qBAAa,yBAA0B,YAAW,oBAAoB;IAElE,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE;QACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,YAAY,CAAC;QAC3B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;KAChC;IAGH,OAAO,CAAC,0BAA0B;IAalC,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CA8EhC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GeneratePackageJsonPlugin = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
4
6
|
const core_1 = require("@rspack/core");
|
|
5
7
|
const js_1 = require("@nx/js");
|
|
6
8
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -9,6 +11,19 @@ class GeneratePackageJsonPlugin {
|
|
|
9
11
|
constructor(options) {
|
|
10
12
|
this.options = options;
|
|
11
13
|
}
|
|
14
|
+
resolveRuntimeDependencies() {
|
|
15
|
+
const runtimeDependencies = {};
|
|
16
|
+
if (this.options.runtimeDependencies) {
|
|
17
|
+
for (const dep of this.options.runtimeDependencies) {
|
|
18
|
+
const depPkgJson = require.resolve(`${dep}/package.json`);
|
|
19
|
+
if (!fs.existsSync(depPkgJson))
|
|
20
|
+
continue;
|
|
21
|
+
const { name, version } = (0, devkit_1.readJsonFile)(depPkgJson);
|
|
22
|
+
runtimeDependencies[name] = version;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return runtimeDependencies;
|
|
26
|
+
}
|
|
12
27
|
apply(compiler) {
|
|
13
28
|
compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
|
|
14
29
|
compilation.hooks.processAssets.tap({
|
|
@@ -27,6 +42,7 @@ class GeneratePackageJsonPlugin {
|
|
|
27
42
|
target: js_1.HelperDependency.tsc,
|
|
28
43
|
});
|
|
29
44
|
}
|
|
45
|
+
const runtimeDependencies = this.resolveRuntimeDependencies();
|
|
30
46
|
const packageJson = (0, js_1.createPackageJson)(this.options.projectName, this.options.projectGraph, {
|
|
31
47
|
target: this.options.targetName,
|
|
32
48
|
root: this.options.root,
|
|
@@ -35,6 +51,10 @@ class GeneratePackageJsonPlugin {
|
|
|
35
51
|
skipPackageManager: this.options.skipPackageManager,
|
|
36
52
|
});
|
|
37
53
|
packageJson.main = packageJson.main ?? this.options.outputFileName;
|
|
54
|
+
packageJson.dependencies = {
|
|
55
|
+
...packageJson.dependencies,
|
|
56
|
+
...runtimeDependencies,
|
|
57
|
+
};
|
|
38
58
|
compilation.emitAsset('package.json', new core_1.sources.RawSource((0, devkit_1.serializeJson)(packageJson)));
|
|
39
59
|
const packageManager = (0, devkit_1.detectPackageManager)(this.options.root);
|
|
40
60
|
if (packageManager === 'bun') {
|