@nx/angular-rspack 20.6.2 → 20.7.0

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.
Files changed (40) hide show
  1. package/README.md +41 -0
  2. package/dist/lib/config/create-config.d.ts.map +1 -1
  3. package/dist/lib/config/create-config.js +51 -10
  4. package/dist/lib/config/dev-server-config-utils.d.ts +1 -0
  5. package/dist/lib/config/dev-server-config-utils.d.ts.map +1 -1
  6. package/dist/lib/config/dev-server-config-utils.js +10 -0
  7. package/dist/lib/config/helpers.d.ts +11 -0
  8. package/dist/lib/config/helpers.d.ts.map +1 -1
  9. package/dist/lib/config/helpers.js +36 -0
  10. package/dist/lib/config/i18n/create-i18n-options.d.ts +6 -0
  11. package/dist/lib/config/i18n/create-i18n-options.d.ts.map +1 -0
  12. package/dist/lib/config/i18n/create-i18n-options.js +122 -0
  13. package/dist/lib/models/angular-rspack-plugin-options.d.ts +46 -0
  14. package/dist/lib/models/angular-rspack-plugin-options.d.ts.map +1 -1
  15. package/dist/lib/models/augmented-compilation.d.ts +2 -0
  16. package/dist/lib/models/augmented-compilation.d.ts.map +1 -1
  17. package/dist/lib/models/i18n.d.ts +33 -0
  18. package/dist/lib/models/i18n.d.ts.map +1 -0
  19. package/dist/lib/models/i18n.js +39 -0
  20. package/dist/lib/models/index.d.ts +1 -0
  21. package/dist/lib/models/index.d.ts.map +1 -1
  22. package/dist/lib/models/index.js +1 -0
  23. package/dist/lib/models/normalize-options.d.ts.map +1 -1
  24. package/dist/lib/models/normalize-options.js +9 -1
  25. package/dist/lib/models/unsupported-options.d.ts +0 -8
  26. package/dist/lib/models/unsupported-options.d.ts.map +1 -1
  27. package/dist/lib/models/unsupported-options.js +0 -8
  28. package/dist/lib/plugins/angular-rspack-plugin.d.ts +2 -2
  29. package/dist/lib/plugins/angular-rspack-plugin.d.ts.map +1 -1
  30. package/dist/lib/plugins/angular-rspack-plugin.js +41 -1
  31. package/dist/lib/plugins/i18n-inline-plugin.d.ts +8 -0
  32. package/dist/lib/plugins/i18n-inline-plugin.d.ts.map +1 -0
  33. package/dist/lib/plugins/i18n-inline-plugin.js +226 -0
  34. package/dist/lib/plugins/ng-rspack.d.ts +3 -2
  35. package/dist/lib/plugins/ng-rspack.d.ts.map +1 -1
  36. package/dist/lib/plugins/ng-rspack.js +9 -2
  37. package/dist/lib/utils/find-project-for-path.d.ts +16 -0
  38. package/dist/lib/utils/find-project-for-path.d.ts.map +1 -0
  39. package/dist/lib/utils/find-project-for-path.js +44 -0
  40. package/package.json +7 -3
package/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ ![Nx](https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg)
1
2
  <div style="text-align: center;">
2
3
 
3
4
  # @nx/angular-rspack
@@ -13,3 +14,43 @@
13
14
  # Build Angular with Rspack
14
15
 
15
16
  The goal of `@nx/angular-rspack` is to make easy and straightforward to build Angular applications with [rspack](https://rspack.dev).
17
+
18
+ ## Getting Started
19
+
20
+ ### Step 1: Create a new Nx Workspace with Angular Rspack Application
21
+
22
+ ```bash
23
+ npx create-nx-workspace myorg
24
+
25
+ NX Let's create a new workspace [[https://nx.dev/getting-started/intro](https://nx.dev/getting-started/intro)]
26
+ ✔ Which stack do you want to use? · angular
27
+ ✔ Integrated monorepo, or standalone project? · integrated
28
+ ✔ Application name · myorg
29
+ ✔ Which bundler would you like to use? · rspack
30
+ ✔ Default stylesheet format · css
31
+ ✔ Do you want to enable Server-Side Rendering (SSR)? · No
32
+ ✔ Which unit test runner would you like to use? · vitest
33
+ ✔ Test runner to use for end to end (E2E) tests · playwright
34
+ ✔ Which CI provider would you like to use? · skip
35
+ ✔ Would you like remote caching to make your build faster? · skip
36
+ NX Creating your v20.8.0 workspace.
37
+ ```
38
+
39
+ ### Step 2: Run Build and Serve commands
40
+
41
+ ```bash
42
+ npx nx build myorg
43
+ npx nx serve myorg
44
+ ```
45
+
46
+
47
+ ## Documentation and Resources
48
+
49
+ - [Read the Angular Rspack Documentation](https://nx.dev/recipes/angular/rspack/introduction)
50
+ - [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
51
+ - [Intro to Nx](https://nx.dev/getting-started/intro)
52
+ - [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
53
+ - [Blog Posts About Nx](https://nx.dev/blog)
54
+
55
+ <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
56
+ width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
@@ -1 +1 @@
1
- {"version":3,"file":"create-config.d.ts","sourceRoot":"","sources":["../../../src/lib/config/create-config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAOd,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,0BAA0B,EAG3B,MAAM,WAAW,CAAC;AAkEnB,wBAAsB,aAAa,CACjC,OAAO,EAAE,0BAA0B,EACnC,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC7C,OAAO,CAAC,aAAa,EAAE,CAAC,CAuX1B;AAED,wBAAsB,YAAY,CAChC,cAAc,EAAE;IACd,OAAO,EAAE,0BAA0B,CAAC;IACpC,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,EACD,cAAc,GAAE,MAAM,CACpB,MAAM,EACN;IACE,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC7C,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,CACG,EACN,YAAY,SAAgB,GAC3B,OAAO,CAAC,aAAa,EAAE,CAAC,CAyB1B"}
1
+ {"version":3,"file":"create-config.d.ts","sourceRoot":"","sources":["../../../src/lib/config/create-config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAQd,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,0BAA0B,EAG3B,MAAM,WAAW,CAAC;AAsEnB,wBAAsB,aAAa,CACjC,OAAO,EAAE,0BAA0B,EACnC,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC7C,OAAO,CAAC,aAAa,EAAE,CAAC,CAyb1B;AAED,wBAAsB,YAAY,CAChC,cAAc,EAAE;IACd,OAAO,EAAE,0BAA0B,CAAC;IACpC,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,EACD,cAAc,GAAE,MAAM,CACpB,MAAM,EACN;IACE,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC7C,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,CACG,EACN,YAAY,SAAgB,GAC3B,OAAO,CAAC,aAAa,EAAE,CAAC,CAyB1B"}
@@ -12,6 +12,7 @@ const style_config_utils_1 = require("./style-config-utils");
12
12
  const helpers_1 = require("./helpers");
13
13
  const dev_server_config_utils_1 = require("./dev-server-config-utils");
14
14
  const dev_tools_ignore_plugin_1 = require("../plugins/tools/dev-tools-ignore-plugin");
15
+ const create_i18n_options_1 = require("./i18n/create-i18n-options");
15
16
  function configureSourceMap(sourceMap) {
16
17
  const { scripts, styles, hidden, vendor } = sourceMap;
17
18
  const sourceMapRules = [];
@@ -57,11 +58,21 @@ function configureSourceMap(sourceMap) {
57
58
  }
58
59
  const VENDORS_TEST = /[\\/]node_modules[\\/]/;
59
60
  async function _createConfig(options, rspackConfigOverrides) {
60
- const normalizedOptions = (0, models_1.normalizeOptions)(options);
61
+ const { options: _options, i18n } = await (0, create_i18n_options_1.configureI18n)(options.root ?? process.cwd(), options);
62
+ // Update file hashes to include translation file content
63
+ const i18nHash = i18n.shouldInline
64
+ ? Object.values(i18n.locales).reduce((data, locale) => data + locale.files.map((file) => file.integrity || '').join('|'), '')
65
+ : () => {
66
+ // no-op as i18n is not inlined
67
+ };
68
+ const normalizedOptions = (0, models_1.normalizeOptions)(_options);
61
69
  const isProduction = process.env['NODE_ENV'] === 'production';
62
70
  const isDevServer = process.env['WEBPACK_SERVE'];
63
71
  const hashFormat = (0, helpers_1.getOutputHashFormat)(normalizedOptions.outputHashing);
64
72
  const { root } = normalizedOptions;
73
+ if (options.deleteOutputPath) {
74
+ await (0, helpers_1.deleteOutputDir)(root, normalizedOptions.outputPath.base);
75
+ }
65
76
  const { sourceMapRules, sourceMapPlugins } = configureSourceMap(normalizedOptions.sourceMap);
66
77
  const defaultConfig = {
67
78
  context: root,
@@ -70,7 +81,7 @@ async function _createConfig(options, rspackConfigOverrides) {
70
81
  output: {
71
82
  uniqueName: 'rspack-angular',
72
83
  publicPath: 'auto',
73
- clean: true,
84
+ clean: normalizedOptions.deleteOutputPath,
74
85
  crossOriginLoading: false,
75
86
  trustedTypes: { policyName: 'angular#bundler' },
76
87
  sourceMapFilename: normalizedOptions.sourceMap.scripts
@@ -79,12 +90,22 @@ async function _createConfig(options, rspackConfigOverrides) {
79
90
  },
80
91
  resolve: {
81
92
  extensions: ['.ts', '.tsx', '.mjs', '.js'],
93
+ symlinks: !normalizedOptions.preserveSymlinks,
82
94
  modules: ['node_modules'],
83
95
  mainFields: ['es2020', 'es2015', 'browser', 'module', 'main'],
84
96
  conditionNames: ['es2020', 'es2015', '...'],
85
97
  tsConfig: {
86
98
  configFile: normalizedOptions.tsConfig,
87
99
  },
100
+ ...(i18n.shouldInline && normalizedOptions.aot
101
+ ? { alias: { '@angular/localize/init': false } }
102
+ : {}),
103
+ },
104
+ resolveLoader: {
105
+ symlinks: !normalizedOptions.preserveSymlinks,
106
+ },
107
+ watchOptions: {
108
+ followSymlinks: normalizedOptions.preserveSymlinks,
88
109
  },
89
110
  module: {
90
111
  parser: {
@@ -128,6 +149,19 @@ async function _createConfig(options, rspackConfigOverrides) {
128
149
  },
129
150
  plugins: [
130
151
  ...sourceMapPlugins,
152
+ ...(i18n.shouldInline
153
+ ? [
154
+ {
155
+ apply(compiler) {
156
+ compiler.hooks.compilation.tap('AngularRspackPlugin', (compilation) => {
157
+ core_1.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation).chunkHash.tap('AngularRspackPlugin', (_, hash) => {
158
+ hash.update('$localize' + i18nHash);
159
+ });
160
+ });
161
+ },
162
+ },
163
+ ]
164
+ : []),
131
165
  new core_1.CssExtractRspackPlugin({
132
166
  filename: `[name]${hashFormat.extract}.css`,
133
167
  }),
@@ -141,13 +175,16 @@ async function _createConfig(options, rspackConfigOverrides) {
141
175
  target: 'node',
142
176
  entry: {
143
177
  server: {
144
- import: [normalizedOptions.ssr.entry],
178
+ import: [
179
+ normalizedOptions.ssr.entry,
180
+ ...(i18n.shouldInline ? ['@angular/localize/init'] : []),
181
+ ],
145
182
  },
146
183
  },
147
184
  output: {
148
185
  ...defaultConfig.output,
149
186
  publicPath: '/',
150
- clean: true,
187
+ clean: normalizedOptions.deleteOutputPath,
151
188
  path: normalizedOptions.outputPath.server,
152
189
  filename: '[name].js',
153
190
  chunkFilename: '[name].js',
@@ -156,7 +193,7 @@ async function _createConfig(options, rspackConfigOverrides) {
156
193
  headers: {
157
194
  'Access-Control-Allow-Origin': '*',
158
195
  },
159
- allowedHosts: 'auto',
196
+ allowedHosts: (0, dev_server_config_utils_1.getAllowedHostsConfig)(normalizedOptions.devServer.allowedHosts, normalizedOptions.devServer.disableHostCheck),
160
197
  client: {
161
198
  webSocketURL: {
162
199
  hostname: normalizedOptions.devServer.host,
@@ -193,6 +230,7 @@ async function _createConfig(options, rspackConfigOverrides) {
193
230
  },
194
231
  proxy: await (0, dev_server_config_utils_1.getProxyConfig)(root, normalizedOptions.devServer.proxyConfig),
195
232
  },
233
+ externals: normalizedOptions.externalDependencies,
196
234
  optimization: {
197
235
  chunkIds: normalizedOptions.namedChunks ? 'named' : 'deterministic',
198
236
  moduleIds: 'deterministic',
@@ -252,7 +290,7 @@ async function _createConfig(options, rspackConfigOverrides) {
252
290
  new ng_rspack_1.NgRspackPlugin({
253
291
  ...normalizedOptions,
254
292
  polyfills: ['zone.js/node'],
255
- }),
293
+ }, i18n),
256
294
  ],
257
295
  };
258
296
  const mergedConfig = (0, webpack_merge_1.merge)(serverConfig, rspackConfigOverrides ?? {});
@@ -267,7 +305,10 @@ async function _createConfig(options, rspackConfigOverrides) {
267
305
  target: 'web',
268
306
  entry: {
269
307
  main: {
270
- import: [normalizedOptions.browser],
308
+ import: [
309
+ normalizedOptions.browser,
310
+ ...(i18n.shouldInline ? ['@angular/localize/init'] : []),
311
+ ],
271
312
  },
272
313
  styles: {
273
314
  import: (0, style_config_utils_1.getStylesEntry)(normalizedOptions),
@@ -277,7 +318,7 @@ async function _createConfig(options, rspackConfigOverrides) {
277
318
  headers: {
278
319
  'Access-Control-Allow-Origin': '*',
279
320
  },
280
- allowedHosts: 'auto',
321
+ allowedHosts: (0, dev_server_config_utils_1.getAllowedHostsConfig)(normalizedOptions.devServer.allowedHosts, normalizedOptions.devServer.disableHostCheck),
281
322
  client: {
282
323
  webSocketURL: {
283
324
  hostname: normalizedOptions.devServer.host,
@@ -326,7 +367,7 @@ async function _createConfig(options, rspackConfigOverrides) {
326
367
  ...defaultConfig.output,
327
368
  hashFunction: isProduction ? 'xxhash64' : undefined,
328
369
  publicPath: 'auto',
329
- clean: true,
370
+ clean: normalizedOptions.deleteOutputPath,
330
371
  path: normalizedOptions.outputPath.browser,
331
372
  cssFilename: `[name]${hashFormat.file}.css`,
332
373
  filename: `[name]${hashFormat.chunk}.js`,
@@ -395,7 +436,7 @@ async function _createConfig(options, rspackConfigOverrides) {
395
436
  ...normalizedOptions,
396
437
  polyfills: ['zone.js'],
397
438
  hasServer: false,
398
- }),
439
+ }, i18n),
399
440
  ],
400
441
  };
401
442
  const mergedConfig = (0, webpack_merge_1.merge)(browserConfig, rspackConfigOverrides ?? {});
@@ -1,3 +1,4 @@
1
1
  import type { DevServer } from '@rspack/core';
2
+ export declare function getAllowedHostsConfig(allowedHosts: string[] | boolean | undefined, disableHostCheck: boolean | undefined): "all" | string[] | undefined;
2
3
  export declare function getProxyConfig(root: string, proxyConfig: string | undefined): Promise<DevServer['proxy'] | undefined>;
3
4
  //# sourceMappingURL=dev-server-config-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server-config-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/config/dev-server-config-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAM9C,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,CA2EzC"}
1
+ {"version":3,"file":"dev-server-config-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/config/dev-server-config-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAM9C,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS,EAC5C,gBAAgB,EAAE,OAAO,GAAG,SAAS,gCAUtC;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,CA2EzC"}
@@ -1,11 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllowedHostsConfig = getAllowedHostsConfig;
3
4
  exports.getProxyConfig = getProxyConfig;
4
5
  const tslib_1 = require("tslib");
5
6
  const node_assert_1 = tslib_1.__importDefault(require("node:assert"));
6
7
  const node_fs_1 = require("node:fs");
7
8
  const node_path_1 = require("node:path");
8
9
  const node_url_1 = require("node:url");
10
+ function getAllowedHostsConfig(allowedHosts, disableHostCheck) {
11
+ if (disableHostCheck || allowedHosts === true) {
12
+ return 'all';
13
+ }
14
+ if (Array.isArray(allowedHosts) && allowedHosts.length > 0) {
15
+ return allowedHosts;
16
+ }
17
+ return undefined;
18
+ }
9
19
  async function getProxyConfig(root, proxyConfig) {
10
20
  if (!proxyConfig) {
11
21
  return undefined;
@@ -1,3 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
1
8
  import { OutputHashing, HashFormat } from '../models';
9
+ /**
10
+ * Delete an output directory, but error out if it's the root of the project.
11
+ */
12
+ export declare function deleteOutputDir(root: string, outputPath: string, emptyOnlyDirectories?: string[]): Promise<void>;
2
13
  export declare function getOutputHashFormat(outputHashing?: OutputHashing, length?: number): HashFormat;
3
14
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/config/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEtD,wBAAgB,mBAAmB,CACjC,aAAa,GAAE,aAAsB,EACrC,MAAM,SAAI,GACT,UAAU,CAkCZ"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/config/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAItD;;GAEG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAC9B,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED,wBAAgB,mBAAmB,CACjC,aAAa,GAAE,aAAsB,EACrC,MAAM,SAAI,GACT,UAAU,CAkCZ"}
@@ -1,6 +1,42 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteOutputDir = deleteOutputDir;
3
4
  exports.getOutputHashFormat = getOutputHashFormat;
5
+ const promises_1 = require("node:fs/promises");
6
+ const node_path_1 = require("node:path");
7
+ /**
8
+ * Delete an output directory, but error out if it's the root of the project.
9
+ */
10
+ async function deleteOutputDir(root, outputPath, emptyOnlyDirectories) {
11
+ const resolvedOutputPath = (0, node_path_1.resolve)(root, outputPath);
12
+ if (resolvedOutputPath === root) {
13
+ throw new Error('Output path MUST not be project root directory!');
14
+ }
15
+ const directoriesToEmpty = emptyOnlyDirectories
16
+ ? new Set(emptyOnlyDirectories.map((directory) => (0, node_path_1.join)(resolvedOutputPath, directory)))
17
+ : undefined;
18
+ // Avoid removing the actual directory to avoid errors in cases where the output
19
+ // directory is mounted or symlinked. Instead the contents are removed.
20
+ let entries;
21
+ try {
22
+ entries = await (0, promises_1.readdir)(resolvedOutputPath);
23
+ }
24
+ catch (error) {
25
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
26
+ return;
27
+ }
28
+ throw error;
29
+ }
30
+ for (const entry of entries) {
31
+ const fullEntry = (0, node_path_1.join)(resolvedOutputPath, entry);
32
+ // Leave requested directories. This allows symlinks to continue to function.
33
+ if (directoriesToEmpty?.has(fullEntry)) {
34
+ await deleteOutputDir(resolvedOutputPath, fullEntry);
35
+ continue;
36
+ }
37
+ await (0, promises_1.rm)(fullEntry, { force: true, recursive: true, maxRetries: 3 });
38
+ }
39
+ }
4
40
  function getOutputHashFormat(outputHashing = 'none', length = 8) {
5
41
  const hashTemplate = `.[contenthash:${length}]`;
6
42
  switch (outputHashing) {
@@ -0,0 +1,6 @@
1
+ import { AngularRspackPluginOptions } from '../../models';
2
+ export declare function configureI18n(projectRoot: string, options: AngularRspackPluginOptions): Promise<{
3
+ options: AngularRspackPluginOptions;
4
+ i18n: import("@angular/build/private").I18nOptions;
5
+ }>;
6
+ //# sourceMappingURL=create-i18n-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-i18n-options.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/i18n/create-i18n-options.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AA4E1D,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,0BAA0B;;;GAmFpC"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureI18n = configureI18n;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const private_1 = require("@angular/build/private");
7
+ const path = tslib_1.__importStar(require("node:path"));
8
+ const node_module_1 = require("node:module");
9
+ const find_project_for_path_1 = require("../../utils/find-project-for-path");
10
+ const node_path_1 = require("node:path");
11
+ /**
12
+ * The base module location used to search for locale specific data.
13
+ */
14
+ const LOCALE_DATA_BASE_MODULE = '@angular/common/locales/global';
15
+ function findLocaleDataPath(locale, resolver) {
16
+ // Remove private use subtags
17
+ const scrubbedLocale = locale.replace(/-x(-[a-zA-Z0-9]{1,8})+$/, '');
18
+ try {
19
+ return resolver(scrubbedLocale);
20
+ }
21
+ catch {
22
+ // fallback to known existing en-US locale data as of 14.0
23
+ return scrubbedLocale === 'en-US'
24
+ ? findLocaleDataPath('en', resolver)
25
+ : null;
26
+ }
27
+ }
28
+ async function getI18nMetadata(projectRoot, i18nMetadata) {
29
+ if (i18nMetadata === undefined) {
30
+ return await tryGetI18nMetadataFromProject(projectRoot);
31
+ }
32
+ return i18nMetadata;
33
+ }
34
+ async function tryGetI18nMetadataFromProject(projectRoot) {
35
+ try {
36
+ const graph = await (0, devkit_1.createProjectGraphAsync)();
37
+ const projectRootMappings = (0, find_project_for_path_1.createProjectRootMappings)(graph.nodes);
38
+ const root = projectRoot.startsWith(devkit_1.workspaceRoot)
39
+ ? (0, node_path_1.relative)(devkit_1.workspaceRoot, projectRoot)
40
+ : projectRoot;
41
+ const projectName = (0, find_project_for_path_1.findProjectForPath)(root, projectRootMappings);
42
+ if (!projectName) {
43
+ // Could not find a project the given root
44
+ return undefined;
45
+ }
46
+ const project = graph.nodes[projectName];
47
+ // Need to cast to any as Nx is not aware of the i18n metadata that exists in angular projects
48
+ const projectData = project.data;
49
+ if (projectData.i18n && typeof projectData.i18n === 'object') {
50
+ return projectData.i18n;
51
+ }
52
+ }
53
+ catch {
54
+ // Issue attempting to use the Nx project graph to determine the project to get the i18n metadata.
55
+ return undefined;
56
+ }
57
+ }
58
+ async function createI18nOptions(projectRoot, options, inline, ssrEnabled) {
59
+ const i18nMetadata = await getI18nMetadata(projectRoot, options.i18nMetadata);
60
+ return (0, private_1.createI18nOptions)({ i18n: i18nMetadata }, inline, devkit_1.logger, ssrEnabled);
61
+ }
62
+ async function configureI18n(projectRoot, options) {
63
+ if (global.NX_GRAPH_CREATION) {
64
+ return {
65
+ options,
66
+ i18n: {
67
+ inlineLocales: new Set(),
68
+ // en-US is the default locale added to Angular applications (https://angular.dev/guide/i18n/format-data-locale)
69
+ sourceLocale: 'en-US',
70
+ locales: {},
71
+ get shouldInline() {
72
+ return this.inlineLocales.size > 0;
73
+ },
74
+ },
75
+ };
76
+ }
77
+ const i18n = await createI18nOptions(projectRoot, options, options.localize);
78
+ // No additional processing needed if no inlining requested and no source locale defined.
79
+ if (!i18n.shouldInline && !i18n.hasDefinedSourceLocale) {
80
+ return { options, i18n };
81
+ }
82
+ // The trailing slash is required to signal that the path is a directory and not a file.
83
+ const projectRequire = (0, node_module_1.createRequire)(projectRoot + '/');
84
+ const localeResolver = (locale) => projectRequire.resolve(path.join(LOCALE_DATA_BASE_MODULE, locale));
85
+ // Load locale data and translations (if present)
86
+ let loader;
87
+ const usedFormats = new Set();
88
+ for (const [locale, desc] of Object.entries(i18n.locales)) {
89
+ if (!i18n.inlineLocales.has(locale) && locale !== i18n.sourceLocale) {
90
+ continue;
91
+ }
92
+ let localeDataPath = findLocaleDataPath(locale, localeResolver);
93
+ if (!localeDataPath) {
94
+ const [first] = locale.split('-');
95
+ if (first) {
96
+ localeDataPath = findLocaleDataPath(first.toLowerCase(), localeResolver);
97
+ if (localeDataPath) {
98
+ devkit_1.logger.warn(`Locale data for '${locale}' cannot be found. Using locale data for '${first}'.`);
99
+ }
100
+ }
101
+ }
102
+ if (!localeDataPath) {
103
+ devkit_1.logger.warn(`Locale data for '${locale}' cannot be found. No locale data will be included for this locale.`);
104
+ }
105
+ else {
106
+ desc.dataPath = localeDataPath;
107
+ }
108
+ if (!desc.files.length) {
109
+ continue;
110
+ }
111
+ loader ??= await (0, private_1.createTranslationLoader)();
112
+ (0, private_1.loadTranslations)(locale, desc, devkit_1.workspaceRoot, loader, {
113
+ warn(message) {
114
+ devkit_1.logger.warn(message);
115
+ },
116
+ error(message) {
117
+ throw new Error(message);
118
+ },
119
+ }, usedFormats, options.i18nDuplicateTranslation);
120
+ }
121
+ return { options, i18n };
122
+ }
@@ -1,6 +1,15 @@
1
1
  import type { FileReplacement, InlineStyleLanguage, StylePreprocessorOptions } from '@nx/angular-rspack-compiler';
2
2
  import type { DevServerUnsupportedOptions, PluginUnsupportedOptions } from './unsupported-options';
3
+ import { I18nProjectMetadata } from './i18n';
3
4
  export interface DevServerOptions extends DevServerUnsupportedOptions {
5
+ /**
6
+ * The hosts that the development server will respond to.
7
+ */
8
+ allowedHosts?: string[] | boolean;
9
+ /**
10
+ * Don't verify connected clients are part of allowed hosts.
11
+ */
12
+ disableHostCheck?: boolean;
4
13
  host?: string;
5
14
  port?: number;
6
15
  proxyConfig?: string;
@@ -9,6 +18,7 @@ export interface DevServerOptions extends DevServerUnsupportedOptions {
9
18
  sslKey?: string;
10
19
  }
11
20
  export interface NormalizedDevServerOptions extends DevServerOptions {
21
+ allowedHosts: string[] | boolean;
12
22
  host: string;
13
23
  port: number;
14
24
  }
@@ -72,16 +82,50 @@ export interface AngularRspackPluginOptions extends PluginUnsupportedOptions {
72
82
  assets?: AssetElement[];
73
83
  browser?: string;
74
84
  commonChunk?: boolean;
85
+ /**
86
+ * Defines global identifiers that will be replaced with a specified constant value when found in any JavaScript or TypeScript code including libraries.
87
+ * The value will be used directly.
88
+ * String values must be put in quotes.
89
+ */
90
+ define?: Record<string, string>;
91
+ /**
92
+ * Delete the output path before building.
93
+ */
94
+ deleteOutputPath?: boolean;
75
95
  devServer?: DevServerOptions;
96
+ /**
97
+ * Exclude the listed external dependencies from being bundled into the bundle. Instead, the created bundle relies on these dependencies to be available during runtime.
98
+ */
99
+ externalDependencies?: string[];
76
100
  extractLicenses?: boolean;
77
101
  fileReplacements?: FileReplacement[];
78
102
  index?: IndexElement;
79
103
  inlineStyleLanguage?: InlineStyleLanguage;
104
+ /**
105
+ * Project metadata for i18n.
106
+ */
107
+ i18nMetadata?: I18nProjectMetadata;
108
+ /**
109
+ * How to handle missing translations for i18n.
110
+ */
111
+ i18nMissingTranslation?: 'warning' | 'error' | 'ignore';
112
+ /**
113
+ * How to handle duplicate translations for i18n.
114
+ */
115
+ i18nDuplicateTranslation?: 'warning' | 'error' | 'ignore';
116
+ /**
117
+ * Translate the bundles in one or more locales.
118
+ */
119
+ localize?: boolean | string[];
80
120
  namedChunks?: boolean;
81
121
  optimization?: boolean | OptimizationOptions;
82
122
  outputHashing?: OutputHashing;
83
123
  outputPath?: string | (Required<Pick<OutputPath, 'base'>> & Partial<OutputPath>);
84
124
  polyfills?: string[];
125
+ /**
126
+ * Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set.
127
+ */
128
+ preserveSymlinks?: boolean;
85
129
  root?: string;
86
130
  scripts?: ScriptOrStyleEntry[];
87
131
  server?: string;
@@ -103,7 +147,9 @@ export interface NormalizedAngularRspackPluginOptions extends Omit<AngularRspack
103
147
  assets: NormalizedAssetElement[];
104
148
  browser: string;
105
149
  commonChunk: boolean;
150
+ deleteOutputPath: boolean;
106
151
  devServer: NormalizedDevServerOptions;
152
+ externalDependencies: string[];
107
153
  extractLicenses: boolean;
108
154
  fileReplacements: FileReplacement[];
109
155
  globalScripts: GlobalEntry[];
@@ -1 +1 @@
1
- {"version":3,"file":"angular-rspack-plugin-options.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AS,GAAG,QAAQ,CAAC;IACxE,qBAAqB,EAAE,OAAO,CAAC;IAC/B,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,sBAAsB,EAAE,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,0BAA0B,CAAC;IACtC,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,aAAa,EAAE,WAAW,EAAE,CAAC;IAC7B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,KAAK,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC1C,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,GAAG,mBAAmB,CAAC;IAC5C,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB"}
1
+ {"version":3,"file":"angular-rspack-plugin-options.d.ts","sourceRoot":"","sources":["../../../src/lib/models/angular-rspack-plugin-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACV,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,MAAM,WAAW,gBAAiB,SAAQ,2BAA2B;IACnE;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OA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spack-compiler';
3
+ import { I18nOptions } from './i18n';
3
4
  export declare const NG_RSPACK_SYMBOL_NAME = "NG_RSPACK_BUILD";
4
5
  export type NG_RSPACK_COMPILATION_STATE = {
5
6
  javascriptTransformer: JavaScriptTransformer;
6
7
  typescriptFileCache: Map<string, string | Buffer>;
8
+ i18n?: I18nOptions;
7
9
  };
8
10
  export type NgRspackCompilation = Compilation & {
9
11
  [NG_RSPACK_SYMBOL_NAME]: () => NG_RSPACK_COMPILATION_STATE;
@@ -1 +1 @@
1
- {"version":3,"file":"augmented-compilation.d.ts","sourceRoot":"","sources":["../../../src/lib/models/augmented-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,MAAM,MAAM,2BAA2B,GAAG;IACxC,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CACnD,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,CAAC,qBAAqB,CAAC,EAAE,MAAM,2BAA2B,CAAC;CAC5D,CAAC"}
1
+ {"version":3,"file":"augmented-compilation.d.ts","sourceRoot":"","sources":["../../../src/lib/models/augmented-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,MAAM,MAAM,2BAA2B,GAAG;IACxC,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAClD,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,CAAC,qBAAqB,CAAC,EAAE,MAAM,2BAA2B,CAAC;CAC5D,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { I18nOptions as _I18nOptions } from '@angular/build/private';
2
+ export type I18nOptions = _I18nOptions;
3
+ export interface SourceLocale {
4
+ code?: string;
5
+ baseHref?: string;
6
+ subPath?: string;
7
+ }
8
+ export interface LocaleMetadata {
9
+ translation?: string | string[];
10
+ baseHref?: string;
11
+ subPath?: string;
12
+ }
13
+ export interface I18nProjectMetadata {
14
+ sourceLocale?: string | SourceLocale;
15
+ locales?: Record<string, string | string[] | LocaleMetadata>;
16
+ }
17
+ /**
18
+ * How to handle potential diagnostics.
19
+ */
20
+ export type DiagnosticHandlingStrategy = 'error' | 'warning' | 'ignore';
21
+ export declare class Diagnostics {
22
+ readonly messages: {
23
+ type: 'warning' | 'error';
24
+ message: string;
25
+ }[];
26
+ get hasErrors(): boolean;
27
+ add(type: DiagnosticHandlingStrategy, message: string): void;
28
+ warn(message: string): void;
29
+ error(message: string): void;
30
+ merge(other: Diagnostics): void;
31
+ formatDiagnostics(message: string): string;
32
+ }
33
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/lib/models/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAErE,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC;AAEvC,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAExE,qBAAa,WAAW;IACtB,QAAQ,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAM;IACzE,IAAI,SAAS,YAEZ;IACD,GAAG,CAAC,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM;IAKrD,IAAI,CAAC,OAAO,EAAE,MAAM;IAGpB,KAAK,CAAC,OAAO,EAAE,MAAM;IAGrB,KAAK,CAAC,KAAK,EAAE,WAAW;IAGxB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAe3C"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Diagnostics = void 0;
4
+ class Diagnostics {
5
+ messages = [];
6
+ get hasErrors() {
7
+ return this.messages.some((m) => m.type === 'error');
8
+ }
9
+ add(type, message) {
10
+ if (type !== 'ignore') {
11
+ this.messages.push({ type, message });
12
+ }
13
+ }
14
+ warn(message) {
15
+ this.messages.push({ type: 'warning', message });
16
+ }
17
+ error(message) {
18
+ this.messages.push({ type: 'error', message });
19
+ }
20
+ merge(other) {
21
+ this.messages.push(...other.messages);
22
+ }
23
+ formatDiagnostics(message) {
24
+ const errors = this.messages
25
+ .filter((d) => d.type === 'error')
26
+ .map((d) => ' - ' + d.message);
27
+ const warnings = this.messages
28
+ .filter((d) => d.type === 'warning')
29
+ .map((d) => ' - ' + d.message);
30
+ if (errors.length) {
31
+ message += '\nERRORS:\n' + errors.join('\n');
32
+ }
33
+ if (warnings.length) {
34
+ message += '\nWARNINGS:\n' + warnings.join('\n');
35
+ }
36
+ return message;
37
+ }
38
+ }
39
+ exports.Diagnostics = Diagnostics;