@nx/angular-rspack 0.0.0-pr-32490-e4fdfa9 → 0.0.0-pr-32868-a65a4a2
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 +1 -1
- package/README.md__tpl__ +1 -1
- package/dist/lib/plugins/angular-rspack-plugin.d.ts.map +1 -1
- package/dist/lib/plugins/angular-rspack-plugin.js +35 -8
- package/dist/lib/utils/postcss-cli-resources.d.ts.map +1 -1
- package/dist/lib/utils/postcss-cli-resources.js +1 -1
- package/dist/lib/utils/stats.d.ts.map +1 -1
- package/dist/lib/utils/stats.js +30 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
# Nx: Smart Repos · Fast Builds
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
|
|
26
26
|
|
|
27
27
|
## Build Angular with Rspack
|
|
28
28
|
|
package/README.md__tpl__
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
# Nx: Smart Repos · Fast Builds
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
|
|
15
15
|
|
|
16
16
|
## Build Angular with Rspack
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-rspack-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/angular-rspack-plugin.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,WAAW,EAGhB,KAAK,oCAAoC,EAC1C,MAAM,WAAW,CAAC;AAUnB,qBAAa,mBAAoB,YAAW,oBAAoB;;
|
|
1
|
+
{"version":3,"file":"angular-rspack-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/angular-rspack-plugin.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,WAAW,EAGhB,KAAK,oCAAoC,EAC1C,MAAM,WAAW,CAAC;AAUnB,qBAAa,mBAAoB,YAAW,oBAAoB;;gBAU5D,OAAO,EAAE,oCAAoC,EAC7C,WAAW,CAAC,EAAE,WAAW;IAuB3B,KAAK,CAAC,QAAQ,EAAE,QAAQ;YAqSV,gBAAgB;CAkC/B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _AngularRspackPlugin__options, _AngularRspackPlugin_i18n, _AngularRspackPlugin_sourceFileCache, _AngularRspackPlugin_javascriptTransformer, _AngularRspackPlugin_angularCompilation;
|
|
2
|
+
var _AngularRspackPlugin__options, _AngularRspackPlugin_i18n, _AngularRspackPlugin_sourceFileCache, _AngularRspackPlugin_javascriptTransformer, _AngularRspackPlugin_angularCompilation, _AngularRspackPlugin_collectedStylesheetAssets;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.AngularRspackPlugin = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
@@ -23,6 +23,7 @@ class AngularRspackPlugin {
|
|
|
23
23
|
_AngularRspackPlugin_javascriptTransformer.set(this, void 0);
|
|
24
24
|
// This will be defined in the apply method correctly
|
|
25
25
|
_AngularRspackPlugin_angularCompilation.set(this, void 0);
|
|
26
|
+
_AngularRspackPlugin_collectedStylesheetAssets.set(this, []);
|
|
26
27
|
tslib_1.__classPrivateFieldSet(this, _AngularRspackPlugin__options, options, "f");
|
|
27
28
|
tslib_1.__classPrivateFieldSet(this, _AngularRspackPlugin_i18n, i18nOptions, "f");
|
|
28
29
|
tslib_1.__classPrivateFieldSet(this, _AngularRspackPlugin_sourceFileCache, new angular_rspack_compiler_1.SourceFileCache(), "f");
|
|
@@ -79,6 +80,34 @@ class AngularRspackPlugin {
|
|
|
79
80
|
name: PLUGIN_NAME,
|
|
80
81
|
stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
|
|
81
82
|
}, (assets) => {
|
|
83
|
+
// Emit collected stylesheet assets
|
|
84
|
+
if (tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_collectedStylesheetAssets, "f").length > 0) {
|
|
85
|
+
const { RawSource } = compiler.rspack.sources;
|
|
86
|
+
for (const asset of tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_collectedStylesheetAssets, "f")) {
|
|
87
|
+
// Normalize the asset path to ensure correct output location
|
|
88
|
+
let assetPath = asset.path;
|
|
89
|
+
// Extract just the media/filename part from the path
|
|
90
|
+
const mediaMatch = assetPath.match(/media\/[^/]+$/);
|
|
91
|
+
if (mediaMatch) {
|
|
92
|
+
assetPath = mediaMatch[0];
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// If not a media path, try to make it relative to the project root
|
|
96
|
+
assetPath = assetPath.replace(/^\/+/, '');
|
|
97
|
+
// Remove absolute path prefix if present
|
|
98
|
+
const projectRootIndex = assetPath.lastIndexOf(tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin__options, "f").root);
|
|
99
|
+
if (projectRootIndex >= 0) {
|
|
100
|
+
assetPath = assetPath.substring(projectRootIndex + tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin__options, "f").root.length + 1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Create the asset source
|
|
104
|
+
const source = new RawSource(asset.text);
|
|
105
|
+
// Emit the asset
|
|
106
|
+
compilation.emitAsset(assetPath, source);
|
|
107
|
+
}
|
|
108
|
+
// Clear the collected assets after emission
|
|
109
|
+
tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_collectedStylesheetAssets, "f").length = 0;
|
|
110
|
+
}
|
|
82
111
|
for (const assetName in assets) {
|
|
83
112
|
const asset = compilation.getAsset(assetName);
|
|
84
113
|
if (!asset) {
|
|
@@ -113,8 +142,6 @@ class AngularRspackPlugin {
|
|
|
113
142
|
name: PLUGIN_NAME,
|
|
114
143
|
message: error.text || '',
|
|
115
144
|
file: error.location?.file,
|
|
116
|
-
loc: `${error.location?.line}:${error.location?.column}`,
|
|
117
|
-
moduleIdentifier: error.location?.file,
|
|
118
145
|
stack: error.text,
|
|
119
146
|
});
|
|
120
147
|
}
|
|
@@ -123,9 +150,7 @@ class AngularRspackPlugin {
|
|
|
123
150
|
name: PLUGIN_NAME,
|
|
124
151
|
message: warning.text || '',
|
|
125
152
|
file: warning.location?.file,
|
|
126
|
-
loc: `${warning.location?.line}:${warning.location?.column}`,
|
|
127
153
|
stack: warning.text,
|
|
128
|
-
moduleIdentifier: warning.location?.file,
|
|
129
154
|
});
|
|
130
155
|
}
|
|
131
156
|
}
|
|
@@ -217,7 +242,7 @@ class AngularRspackPlugin {
|
|
|
217
242
|
? tsConfig
|
|
218
243
|
: tsConfig.configFile
|
|
219
244
|
: tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin__options, "f").tsConfig;
|
|
220
|
-
|
|
245
|
+
const result = await (0, angular_rspack_compiler_1.setupCompilationWithAngularCompilation)({
|
|
221
246
|
source: {
|
|
222
247
|
tsconfigPath: tsconfigPath,
|
|
223
248
|
},
|
|
@@ -231,8 +256,10 @@ class AngularRspackPlugin {
|
|
|
231
256
|
hasServer: tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin__options, "f").hasServer,
|
|
232
257
|
includePaths: tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin__options, "f").stylePreprocessorOptions?.includePaths,
|
|
233
258
|
sass: tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin__options, "f").stylePreprocessorOptions?.sass,
|
|
234
|
-
}, tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_sourceFileCache, "f"), tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_angularCompilation, "f"), modifiedFiles)
|
|
259
|
+
}, tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_sourceFileCache, "f"), tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_angularCompilation, "f"), modifiedFiles);
|
|
260
|
+
tslib_1.__classPrivateFieldSet(this, _AngularRspackPlugin_angularCompilation, result.angularCompilation, "f");
|
|
261
|
+
tslib_1.__classPrivateFieldSet(this, _AngularRspackPlugin_collectedStylesheetAssets, result.collectedStylesheetAssets, "f");
|
|
235
262
|
}
|
|
236
263
|
}
|
|
237
264
|
exports.AngularRspackPlugin = AngularRspackPlugin;
|
|
238
|
-
_AngularRspackPlugin__options = new WeakMap(), _AngularRspackPlugin_i18n = new WeakMap(), _AngularRspackPlugin_sourceFileCache = new WeakMap(), _AngularRspackPlugin_javascriptTransformer = new WeakMap(), _AngularRspackPlugin_angularCompilation = new WeakMap();
|
|
265
|
+
_AngularRspackPlugin__options = new WeakMap(), _AngularRspackPlugin_i18n = new WeakMap(), _AngularRspackPlugin_sourceFileCache = new WeakMap(), _AngularRspackPlugin_javascriptTransformer = new WeakMap(), _AngularRspackPlugin_angularCompilation = new WeakMap(), _AngularRspackPlugin_collectedStylesheetAssets = new WeakMap();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postcss-cli-resources.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/postcss-cli-resources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"postcss-cli-resources.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/postcss-cli-resources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAe,MAAM,EAAE,MAAM,SAAS,CAAC;AAgBnD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,MAAM,EAAE,OAAO,cAAc,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACtD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAcD,eAAO,MAAM,OAAO,OAAO,CAAC;AAE5B,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC,EAAE,0BAA0B,GAAG,MAAM,CAyKrE"}
|
|
@@ -59,7 +59,7 @@ function default_1(options) {
|
|
|
59
59
|
if (inputUrl.startsWith('~')) {
|
|
60
60
|
inputUrl = inputUrl.slice(1);
|
|
61
61
|
}
|
|
62
|
-
const normalizedUrl = inputUrl.replace(/\\/g, '/');
|
|
62
|
+
const normalizedUrl = path.resolve(context, inputUrl.replace(/\\/g, '/'));
|
|
63
63
|
const parsedUrl = new URL(normalizedUrl, 'file:///');
|
|
64
64
|
const { pathname, hash, search } = parsedUrl;
|
|
65
65
|
const resolver = (file, base) => new Promise((resolve, reject) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/stats.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,sBAAsB,EAGvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,YAAY,EACb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oCAAoC,EACpC,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAMjD,MAAM,WAAW,qBAAqB;IACpC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,aAAa,CAAC,OAAO,CAAC,EACtB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W,eAAe;IAC9B,GAAG,EAAE,OAAO,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,oCAAoC,GAC5C,eAAe,CAoDjB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,YAAY,EACzB,cAAc,CAAC,EAAE,sBAAsB,EAAE,GACxC,IAAI,CAgBN"}
|
package/dist/lib/utils/stats.js
CHANGED
|
@@ -86,7 +86,36 @@ function statsToString(stats, json, statsConfig, budgetFailures) {
|
|
|
86
86
|
if (!isFirstRun && !chunk.rendered) {
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
89
|
-
const assets = json.assets?.filter((asset) =>
|
|
89
|
+
const assets = json.assets?.filter((asset) => {
|
|
90
|
+
// First try exact match with files array (for non-i18n builds)
|
|
91
|
+
if (chunk.files?.includes(asset.name)) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
// For i18n builds, chunk.files is often empty but we can match by chunk names
|
|
95
|
+
// Assets have locale prefixes (e.g., "fr/main.abc123.js")
|
|
96
|
+
if (!chunk.files?.length && chunk.names?.length) {
|
|
97
|
+
// Remove locale prefix and hash from asset name to get base name
|
|
98
|
+
const assetWithoutLocale = asset.name
|
|
99
|
+
.replace(/^[a-z]{2}(-[A-Z]{2})?\//, '') // Remove locale prefix
|
|
100
|
+
.replace(/\.[a-f0-9]{8,}\./, '.'); // Remove hash (e.g., main.abc123.js -> main.js)
|
|
101
|
+
// Check if any chunk name matches the base name of the asset
|
|
102
|
+
return chunk.names.some((chunkName) => {
|
|
103
|
+
// Match chunk name to asset base name (e.g., "main" matches "main.js")
|
|
104
|
+
return (assetWithoutLocale.startsWith(chunkName + '.') ||
|
|
105
|
+
assetWithoutLocale === chunkName);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// For i18n builds where chunk.files has values but without locale prefix
|
|
109
|
+
if (chunk.files?.length) {
|
|
110
|
+
// Check if any chunk file matches the asset name without locale prefix
|
|
111
|
+
return chunk.files.some((chunkFile) => {
|
|
112
|
+
// Remove potential locale prefix from asset name
|
|
113
|
+
const assetWithoutLocale = asset.name.replace(/^[a-z]{2}(-[A-Z]{2})?\//, '');
|
|
114
|
+
return chunkFile === assetWithoutLocale;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
});
|
|
90
119
|
let rawSize = 0;
|
|
91
120
|
let estimatedTransferSize;
|
|
92
121
|
if (assets) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular-rspack",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-32868-a65a4a2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@ampproject/remapping": "2.3.0",
|
|
49
|
-
"@babel/core": "7.
|
|
49
|
+
"@babel/core": "7.28.3",
|
|
50
50
|
"@discoveryjs/json-ext": "0.6.3",
|
|
51
|
-
"@nx/angular-rspack-compiler": "0.0.0-pr-
|
|
52
|
-
"@nx/devkit": "0.0.0-pr-
|
|
51
|
+
"@nx/angular-rspack-compiler": "0.0.0-pr-32868-a65a4a2",
|
|
52
|
+
"@nx/devkit": "0.0.0-pr-32868-a65a4a2",
|
|
53
53
|
"ansi-colors": "4.1.3",
|
|
54
54
|
"autoprefixer": "10.4.21",
|
|
55
55
|
"deepmerge": "^4.3.1",
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"@angular/build": ">=19.0.0 <21.0.0",
|
|
81
81
|
"@angular/localize": ">=19.0.0 <21.0.0",
|
|
82
82
|
"@angular/platform-server": ">=19.0.0 <21.0.0",
|
|
83
|
-
"zone.js": ">=0.14.0 <0.16.0",
|
|
84
83
|
"@angular/ssr": ">=19.0.0 <21.0.0",
|
|
85
84
|
"@rspack/core": ">=1.3.5 <2.0.0",
|
|
86
|
-
"tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0"
|
|
85
|
+
"tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0",
|
|
86
|
+
"zone.js": ">=0.14.0 <0.16.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"tailwindcss": {
|