@angular/build 19.0.0-next.1 → 19.0.0-next.11

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 (129) hide show
  1. package/LICENSE +5 -5
  2. package/package.json +26 -22
  3. package/src/builders/application/build-action.js +9 -9
  4. package/src/builders/application/chunk-optimizer.js +1 -4
  5. package/src/builders/application/execute-build.js +19 -2
  6. package/src/builders/application/execute-post-bundle.d.ts +2 -2
  7. package/src/builders/application/execute-post-bundle.js +58 -20
  8. package/src/builders/application/i18n.d.ts +2 -2
  9. package/src/builders/application/i18n.js +6 -16
  10. package/src/builders/application/index.js +8 -5
  11. package/src/builders/application/options.d.ts +38 -1
  12. package/src/builders/application/options.js +62 -4
  13. package/src/builders/application/results.d.ts +5 -3
  14. package/src/builders/application/schema.d.ts +72 -0
  15. package/src/builders/application/schema.js +29 -1
  16. package/src/builders/application/schema.json +38 -0
  17. package/src/builders/application/setup-bundling.js +12 -9
  18. package/src/builders/dev-server/internal.d.ts +0 -1
  19. package/src/builders/dev-server/internal.js +1 -3
  20. package/src/builders/dev-server/vite-server.d.ts +8 -2
  21. package/src/builders/dev-server/vite-server.js +132 -58
  22. package/src/builders/extract-i18n/application-extraction.js +3 -3
  23. package/src/tools/angular/angular-host.d.ts +2 -1
  24. package/src/tools/angular/angular-host.js +17 -1
  25. package/src/tools/angular/compilation/angular-compilation.d.ts +1 -0
  26. package/src/tools/angular/compilation/aot-compilation.d.ts +1 -0
  27. package/src/tools/angular/compilation/aot-compilation.js +9 -1
  28. package/src/tools/angular/compilation/parallel-compilation.d.ts +2 -1
  29. package/src/tools/angular/compilation/parallel-compilation.js +4 -12
  30. package/src/tools/angular/compilation/parallel-worker.d.ts +1 -0
  31. package/src/tools/angular/compilation/parallel-worker.js +5 -2
  32. package/src/tools/babel/plugins/add-code-coverage.d.ts +14 -0
  33. package/src/tools/babel/plugins/add-code-coverage.js +44 -0
  34. package/src/tools/babel/plugins/types.d.ts +20 -0
  35. package/src/tools/esbuild/angular/compiler-plugin.d.ts +2 -0
  36. package/src/tools/esbuild/angular/compiler-plugin.js +69 -10
  37. package/src/tools/esbuild/angular/component-stylesheets.d.ts +10 -4
  38. package/src/tools/esbuild/angular/component-stylesheets.js +49 -12
  39. package/src/tools/esbuild/angular/file-reference-tracker.d.ts +1 -1
  40. package/src/tools/esbuild/angular/jit-plugin-callbacks.d.ts +1 -1
  41. package/src/tools/esbuild/angular/jit-plugin-callbacks.js +2 -2
  42. package/src/tools/esbuild/application-code-bundle.d.ts +2 -6
  43. package/src/tools/esbuild/application-code-bundle.js +233 -71
  44. package/src/tools/esbuild/budget-stats.js +1 -1
  45. package/src/tools/esbuild/bundler-context.d.ts +4 -3
  46. package/src/tools/esbuild/bundler-context.js +24 -19
  47. package/src/tools/esbuild/bundler-execution-result.d.ts +5 -2
  48. package/src/tools/esbuild/bundler-execution-result.js +7 -3
  49. package/src/tools/esbuild/cache.d.ts +6 -1
  50. package/src/tools/esbuild/cache.js +7 -0
  51. package/src/tools/esbuild/compiler-plugin-options.js +6 -1
  52. package/src/tools/esbuild/global-scripts.js +1 -1
  53. package/src/tools/esbuild/global-styles.js +3 -0
  54. package/src/tools/esbuild/i18n-inliner.js +4 -4
  55. package/src/tools/esbuild/javascript-transformer-worker.d.ts +1 -0
  56. package/src/tools/esbuild/javascript-transformer-worker.js +5 -1
  57. package/src/tools/esbuild/javascript-transformer.d.ts +2 -2
  58. package/src/tools/esbuild/javascript-transformer.js +7 -12
  59. package/src/tools/esbuild/server-bundle-metadata-plugin.d.ts +22 -0
  60. package/src/tools/esbuild/server-bundle-metadata-plugin.js +36 -0
  61. package/src/tools/esbuild/stylesheets/bundle-options.d.ts +2 -0
  62. package/src/tools/esbuild/stylesheets/bundle-options.js +2 -1
  63. package/src/tools/esbuild/stylesheets/sass-language.js +4 -0
  64. package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.d.ts +9 -0
  65. package/src/tools/esbuild/utils.d.ts +9 -0
  66. package/src/tools/esbuild/utils.js +33 -4
  67. package/src/tools/sass/sass-service.js +11 -13
  68. package/src/tools/sass/worker.d.ts +13 -32
  69. package/src/tools/sass/worker.js +20 -0
  70. package/src/tools/vite/middlewares/assets-middleware.d.ts +1 -1
  71. package/src/tools/vite/middlewares/assets-middleware.js +43 -4
  72. package/src/tools/vite/middlewares/component-middleware.d.ts +9 -0
  73. package/src/tools/vite/middlewares/component-middleware.js +33 -0
  74. package/src/tools/vite/middlewares/headers-middleware.d.ts +19 -0
  75. package/src/tools/vite/middlewares/headers-middleware.js +34 -0
  76. package/src/tools/vite/middlewares/html-fallback-middleware.d.ts +1 -1
  77. package/src/tools/vite/middlewares/html-fallback-middleware.js +23 -7
  78. package/src/tools/vite/middlewares/index-html-middleware.js +1 -2
  79. package/src/tools/vite/middlewares/index.d.ts +3 -1
  80. package/src/tools/vite/middlewares/index.js +7 -2
  81. package/src/tools/vite/middlewares/ssr-middleware.d.ts +2 -4
  82. package/src/tools/vite/middlewares/ssr-middleware.js +75 -43
  83. package/src/tools/vite/plugins/angular-memory-plugin.d.ts +16 -0
  84. package/src/tools/vite/{angular-memory-plugin.js → plugins/angular-memory-plugin.js} +19 -40
  85. package/src/tools/vite/{i18n-locale-plugin.d.ts → plugins/i18n-locale-plugin.d.ts} +0 -4
  86. package/src/tools/vite/{i18n-locale-plugin.js → plugins/i18n-locale-plugin.js} +2 -3
  87. package/src/tools/vite/plugins/index.d.ts +12 -0
  88. package/src/tools/vite/plugins/index.js +21 -0
  89. package/src/tools/vite/plugins/setup-middlewares-plugin.d.ts +42 -0
  90. package/src/tools/vite/plugins/setup-middlewares-plugin.js +63 -0
  91. package/src/{utils/server-rendering/main-bundle-exports.js → tools/vite/plugins/ssr-transform-plugin.d.ts} +2 -2
  92. package/src/tools/vite/plugins/ssr-transform-plugin.js +38 -0
  93. package/src/tools/vite/utils.d.ts +0 -3
  94. package/src/tools/vite/utils.js +0 -12
  95. package/src/typings.d.ts +26 -0
  96. package/src/utils/environment-options.d.ts +2 -0
  97. package/src/utils/environment-options.js +5 -1
  98. package/src/utils/index-file/index-html-generator.js +5 -0
  99. package/src/utils/index-file/inline-critical-css.js +43 -33
  100. package/src/utils/index-file/ngcm-attribute.d.ts +15 -0
  101. package/src/utils/index-file/ngcm-attribute.js +37 -0
  102. package/src/utils/index-file/valid-self-closing-tags.js +28 -0
  103. package/src/utils/normalize-cache.js +1 -1
  104. package/src/utils/server-rendering/fetch-patch.d.ts +1 -1
  105. package/src/utils/server-rendering/fetch-patch.js +5 -6
  106. package/src/utils/server-rendering/launch-server.d.ts +14 -0
  107. package/src/utils/server-rendering/launch-server.js +63 -0
  108. package/src/utils/server-rendering/load-esm-from-memory.d.ts +18 -2
  109. package/src/utils/server-rendering/manifest.d.ts +50 -0
  110. package/src/utils/server-rendering/manifest.js +126 -0
  111. package/src/utils/server-rendering/models.d.ts +27 -0
  112. package/src/utils/server-rendering/models.js +22 -0
  113. package/src/utils/server-rendering/prerender.d.ts +26 -10
  114. package/src/utils/server-rendering/prerender.js +122 -75
  115. package/src/utils/server-rendering/render-worker.d.ts +9 -8
  116. package/src/utils/server-rendering/render-worker.js +19 -14
  117. package/src/utils/server-rendering/routes-extractor-worker.d.ts +6 -10
  118. package/src/utils/server-rendering/routes-extractor-worker.js +16 -33
  119. package/src/utils/server-rendering/utils.d.ts +11 -0
  120. package/src/utils/server-rendering/utils.js +17 -0
  121. package/src/utils/supported-browsers.js +1 -0
  122. package/src/utils/worker-pool.d.ts +12 -0
  123. package/src/utils/worker-pool.js +43 -0
  124. package/src/tools/vite/angular-memory-plugin.d.ts +0 -21
  125. package/src/utils/server-rendering/main-bundle-exports.d.ts +0 -27
  126. package/src/utils/server-rendering/render-page.d.ts +0 -26
  127. package/src/utils/server-rendering/render-page.js +0 -114
  128. /package/src/tools/vite/{id-prefix-plugin.d.ts → plugins/id-prefix-plugin.d.ts} +0 -0
  129. /package/src/tools/vite/{id-prefix-plugin.js → plugins/id-prefix-plugin.js} +0 -0
@@ -10,7 +10,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  return (mod && mod.__esModule) ? mod : { "default": mod };
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.INDEX_HTML_SERVER = exports.INDEX_HTML_CSR = void 0;
13
14
  exports.normalizeOptions = normalizeOptions;
15
+ exports.getLocaleBaseHref = getLocaleBaseHref;
14
16
  const node_fs_1 = require("node:fs");
15
17
  const promises_1 = require("node:fs/promises");
16
18
  const node_module_1 = require("node:module");
@@ -21,7 +23,18 @@ const environment_options_1 = require("../../utils/environment-options");
21
23
  const i18n_options_1 = require("../../utils/i18n-options");
22
24
  const normalize_cache_1 = require("../../utils/normalize-cache");
23
25
  const postcss_configuration_1 = require("../../utils/postcss-configuration");
26
+ const url_1 = require("../../utils/url");
24
27
  const schema_1 = require("./schema");
28
+ /**
29
+ * The filename for the client-side rendered HTML template.
30
+ * This template is used for client-side rendering (CSR) in a web application.
31
+ */
32
+ exports.INDEX_HTML_CSR = 'index.csr.html';
33
+ /**
34
+ * The filename for the server-side rendered HTML template.
35
+ * This template is used for server-side rendering (SSR) in a web application.
36
+ */
37
+ exports.INDEX_HTML_SERVER = 'index.server.html';
25
38
  /**
26
39
  * Normalize the user provided options by creating full paths for all path based options
27
40
  * and converting multi-form options into a single form that can be directly used
@@ -90,6 +103,29 @@ async function normalizeOptions(context, projectName, options, extensions) {
90
103
  loaderExtensions[extension] = value;
91
104
  }
92
105
  }
106
+ // Validate prerender and ssr options when using the outputMode
107
+ if (options.outputMode === schema_1.OutputMode.Server) {
108
+ if (!options.server) {
109
+ throw new Error('The "server" option is required when "outputMode" is set to "server".');
110
+ }
111
+ if (typeof options.ssr === 'boolean' || !options.ssr?.entry) {
112
+ throw new Error('The "ssr.entry" option is required when "outputMode" is set to "server".');
113
+ }
114
+ }
115
+ if (options.outputMode) {
116
+ if (!options.server) {
117
+ options.ssr = false;
118
+ }
119
+ if (options.prerender) {
120
+ context.logger.warn('The "prerender" option is no longer needed when "outputMode" is specified.');
121
+ }
122
+ else {
123
+ options.prerender = !!options.server;
124
+ }
125
+ if (options.appShell) {
126
+ context.logger.warn('The "appShell" option is no longer needed when "outputMode" is specified.');
127
+ }
128
+ }
93
129
  // A configuration file can exist in the project or workspace root
94
130
  const searchDirectories = await (0, postcss_configuration_1.generateSearchDirectories)([projectRoot, workspaceRoot]);
95
131
  const postcssConfiguration = await (0, postcss_configuration_1.loadPostcssConfiguration)(searchDirectories);
@@ -117,9 +153,10 @@ async function normalizeOptions(context, projectName, options, extensions) {
117
153
  ssrOptions = {};
118
154
  }
119
155
  else if (typeof options.ssr === 'object') {
120
- const { entry } = options.ssr;
156
+ const { entry, experimentalPlatform = schema_1.ExperimentalPlatform.Node } = options.ssr;
121
157
  ssrOptions = {
122
158
  entry: entry && node_path_1.default.join(workspaceRoot, entry),
159
+ platform: experimentalPlatform,
123
160
  };
124
161
  }
125
162
  let appShellOptions;
@@ -138,7 +175,9 @@ async function normalizeOptions(context, projectName, options, extensions) {
138
175
  clean: options.deleteOutputPath ?? true,
139
176
  // For app-shell and SSG server files are not required by users.
140
177
  // Omit these when SSR is not enabled.
141
- ignoreServer: ssrOptions === undefined || serverEntryPoint === undefined,
178
+ ignoreServer: ((ssrOptions === undefined || serverEntryPoint === undefined) &&
179
+ options.outputMode === undefined) ||
180
+ options.outputMode === schema_1.OutputMode.Static,
142
181
  };
143
182
  const outputNames = {
144
183
  bundles: options.outputHashing === schema_1.OutputHashing.All || options.outputHashing === schema_1.OutputHashing.Bundles
@@ -161,10 +200,16 @@ async function normalizeOptions(context, projectName, options, extensions) {
161
200
  * If SSR is activated, create a distinct entry file for the `index.html`.
162
201
  * This is necessary because numerous server/cloud providers automatically serve the `index.html` as a static file
163
202
  * if it exists (handling SSG).
203
+ *
164
204
  * For instance, accessing `foo.com/` would lead to `foo.com/index.html` being served instead of hitting the server.
205
+ *
206
+ * This approach can also be applied to service workers, where the `index.csr.html` is served instead of the prerendered `index.html`.
165
207
  */
166
208
  const indexBaseName = node_path_1.default.basename(options.index);
167
- indexOutput = ssrOptions && indexBaseName === 'index.html' ? 'index.csr.html' : indexBaseName;
209
+ indexOutput =
210
+ (ssrOptions || prerenderOptions) && indexBaseName === 'index.html'
211
+ ? exports.INDEX_HTML_CSR
212
+ : indexBaseName;
168
213
  }
169
214
  else {
170
215
  indexOutput = options.index.output || 'index.html';
@@ -193,7 +238,7 @@ async function normalizeOptions(context, projectName, options, extensions) {
193
238
  }
194
239
  }
195
240
  // Initial options to keep
196
- const { allowedCommonJsDependencies, aot, baseHref, crossOrigin, externalDependencies, extractLicenses, inlineStyleLanguage = 'css', outExtension, serviceWorker, poll, polyfills, statsJson, stylePreprocessorOptions, subresourceIntegrity, verbose, watch, progress = true, externalPackages, namedChunks, budgets, deployUrl, clearScreen, define, } = options;
241
+ const { allowedCommonJsDependencies, aot, baseHref, crossOrigin, externalDependencies, extractLicenses, inlineStyleLanguage = 'css', outExtension, serviceWorker, poll, polyfills, statsJson, outputMode, stylePreprocessorOptions, subresourceIntegrity, verbose, watch, progress = true, externalPackages, namedChunks, budgets, deployUrl, clearScreen, define, partialSSRBuild = false, externalRuntimeStyles, instrumentForCoverage, } = options;
197
242
  // Return all the normalized options
198
243
  return {
199
244
  advancedOptimizations: !!aot && optimizationOptions.scripts,
@@ -216,6 +261,7 @@ async function normalizeOptions(context, projectName, options, extensions) {
216
261
  serverEntryPoint,
217
262
  prerenderOptions,
218
263
  appShellOptions,
264
+ outputMode,
219
265
  ssrOptions,
220
266
  verbose,
221
267
  watch,
@@ -248,6 +294,9 @@ async function normalizeOptions(context, projectName, options, extensions) {
248
294
  colors: (0, color_1.supportColor)(),
249
295
  clearScreen,
250
296
  define,
297
+ partialSSRBuild: environment_options_1.usePartialSsrBuild || partialSSRBuild,
298
+ externalRuntimeStyles,
299
+ instrumentForCoverage,
251
300
  };
252
301
  }
253
302
  async function getTailwindConfig(searchDirectories, workspaceRoot, context) {
@@ -369,3 +418,12 @@ function normalizeGlobalEntries(rawEntries, defaultName) {
369
418
  }
370
419
  return [...bundles.values()];
371
420
  }
421
+ function getLocaleBaseHref(baseHref, i18n, locale) {
422
+ if (i18n.flatOutput) {
423
+ return undefined;
424
+ }
425
+ if (i18n.locales[locale] && i18n.locales[locale].baseHref !== '') {
426
+ return (0, url_1.urlJoin)(baseHref || '', i18n.locales[locale].baseHref ?? `/${locale}/`);
427
+ }
428
+ return undefined;
429
+ }
@@ -61,7 +61,9 @@ export interface ResultMessage {
61
61
  }
62
62
  export interface ComponentUpdateResult extends BaseResult {
63
63
  kind: ResultKind.ComponentUpdate;
64
- id: string;
65
- type: 'style' | 'template';
66
- content: string;
64
+ updates: {
65
+ id: string;
66
+ type: 'style' | 'template';
67
+ content: string;
68
+ }[];
67
69
  }
@@ -117,6 +117,12 @@ export interface Schema {
117
117
  * Define the output filename cache-busting hashing mode.
118
118
  */
119
119
  outputHashing?: OutputHashing;
120
+ /**
121
+ * Defines the build output target. 'static': Generates a static site for deployment on any
122
+ * static hosting service. 'server': Produces an application designed for deployment on a
123
+ * server that supports server-side rendering (SSR).
124
+ */
125
+ outputMode?: OutputMode;
120
126
  /**
121
127
  * Specify the output path relative to workspace root.
122
128
  */
@@ -393,6 +399,15 @@ export declare enum OutputHashing {
393
399
  Media = "media",
394
400
  None = "none"
395
401
  }
402
+ /**
403
+ * Defines the build output target. 'static': Generates a static site for deployment on any
404
+ * static hosting service. 'server': Produces an application designed for deployment on a
405
+ * server that supports server-side rendering (SSR).
406
+ */
407
+ export declare enum OutputMode {
408
+ Server = "server",
409
+ Static = "static"
410
+ }
396
411
  /**
397
412
  * Specify the output path relative to workspace root.
398
413
  */
@@ -485,6 +500,37 @@ export interface SsrClass {
485
500
  * The server entry-point that when executed will spawn the web server.
486
501
  */
487
502
  entry?: string;
503
+ /**
504
+ * Specifies the platform for which the server bundle is generated. This affects the APIs
505
+ * and modules available in the server-side code.
506
+ *
507
+ * - `node`: (Default) Generates a bundle optimized for Node.js environments.
508
+ * - `neutral`: Generates a platform-neutral bundle suitable for environments like edge
509
+ * workers, and other serverless platforms. This option avoids using Node.js-specific APIs,
510
+ * making the bundle more portable.
511
+ *
512
+ * Please note that this feature does not provide polyfills for Node.js modules.
513
+ * Additionally, it is experimental, and the schematics may undergo changes in future
514
+ * versions.
515
+ */
516
+ experimentalPlatform?: ExperimentalPlatform;
517
+ }
518
+ /**
519
+ * Specifies the platform for which the server bundle is generated. This affects the APIs
520
+ * and modules available in the server-side code.
521
+ *
522
+ * - `node`: (Default) Generates a bundle optimized for Node.js environments.
523
+ * - `neutral`: Generates a platform-neutral bundle suitable for environments like edge
524
+ * workers, and other serverless platforms. This option avoids using Node.js-specific APIs,
525
+ * making the bundle more portable.
526
+ *
527
+ * Please note that this feature does not provide polyfills for Node.js modules.
528
+ * Additionally, it is experimental, and the schematics may undergo changes in future
529
+ * versions.
530
+ */
531
+ export declare enum ExperimentalPlatform {
532
+ Neutral = "neutral",
533
+ Node = "node"
488
534
  }
489
535
  /**
490
536
  * Options to pass to style preprocessors.
@@ -494,6 +540,32 @@ export interface StylePreprocessorOptions {
494
540
  * Paths to include. Paths will be resolved to workspace root.
495
541
  */
496
542
  includePaths?: string[];
543
+ /**
544
+ * Options to pass to the sass preprocessor.
545
+ */
546
+ sass?: Sass;
547
+ }
548
+ /**
549
+ * Options to pass to the sass preprocessor.
550
+ */
551
+ export interface Sass {
552
+ /**
553
+ * A set of deprecations to treat as fatal. If a deprecation warning of any provided type is
554
+ * encountered during compilation, the compiler will error instead. If a Version is
555
+ * provided, then all deprecations that were active in that compiler version will be treated
556
+ * as fatal.
557
+ */
558
+ fatalDeprecations?: string[];
559
+ /**
560
+ * A set of future deprecations to opt into early. Future deprecations passed here will be
561
+ * treated as active by the compiler, emitting warnings as necessary.
562
+ */
563
+ futureDeprecations?: string[];
564
+ /**
565
+ * A set of active deprecations to ignore. If a deprecation warning of any provided type is
566
+ * encountered during compilation, the compiler will ignore it instead.
567
+ */
568
+ silenceDeprecations?: string[];
497
569
  }
498
570
  export type StyleElement = StyleClass | string;
499
571
  export interface StyleClass {
@@ -2,7 +2,7 @@
2
2
  // THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
3
3
  // CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.OutputHashing = exports.InlineStyleLanguage = exports.I18NTranslation = exports.CrossOrigin = exports.Type = void 0;
5
+ exports.ExperimentalPlatform = exports.OutputMode = exports.OutputHashing = exports.InlineStyleLanguage = exports.I18NTranslation = exports.CrossOrigin = exports.Type = void 0;
6
6
  /**
7
7
  * The type of budget.
8
8
  */
@@ -56,3 +56,31 @@ var OutputHashing;
56
56
  OutputHashing["Media"] = "media";
57
57
  OutputHashing["None"] = "none";
58
58
  })(OutputHashing || (exports.OutputHashing = OutputHashing = {}));
59
+ /**
60
+ * Defines the build output target. 'static': Generates a static site for deployment on any
61
+ * static hosting service. 'server': Produces an application designed for deployment on a
62
+ * server that supports server-side rendering (SSR).
63
+ */
64
+ var OutputMode;
65
+ (function (OutputMode) {
66
+ OutputMode["Server"] = "server";
67
+ OutputMode["Static"] = "static";
68
+ })(OutputMode || (exports.OutputMode = OutputMode = {}));
69
+ /**
70
+ * Specifies the platform for which the server bundle is generated. This affects the APIs
71
+ * and modules available in the server-side code.
72
+ *
73
+ * - `node`: (Default) Generates a bundle optimized for Node.js environments.
74
+ * - `neutral`: Generates a platform-neutral bundle suitable for environments like edge
75
+ * workers, and other serverless platforms. This option avoids using Node.js-specific APIs,
76
+ * making the bundle more portable.
77
+ *
78
+ * Please note that this feature does not provide polyfills for Node.js modules.
79
+ * Additionally, it is experimental, and the schematics may undergo changes in future
80
+ * versions.
81
+ */
82
+ var ExperimentalPlatform;
83
+ (function (ExperimentalPlatform) {
84
+ ExperimentalPlatform["Neutral"] = "neutral";
85
+ ExperimentalPlatform["Node"] = "node";
86
+ })(ExperimentalPlatform || (exports.ExperimentalPlatform = ExperimentalPlatform = {}));
@@ -125,6 +125,34 @@
125
125
  "type": "string"
126
126
  },
127
127
  "default": []
128
+ },
129
+ "sass": {
130
+ "description": "Options to pass to the sass preprocessor.",
131
+ "type": "object",
132
+ "properties": {
133
+ "fatalDeprecations": {
134
+ "description": "A set of deprecations to treat as fatal. If a deprecation warning of any provided type is encountered during compilation, the compiler will error instead. If a Version is provided, then all deprecations that were active in that compiler version will be treated as fatal.",
135
+ "type": "array",
136
+ "items": {
137
+ "type": "string"
138
+ }
139
+ },
140
+ "silenceDeprecations": {
141
+ "description": " A set of active deprecations to ignore. If a deprecation warning of any provided type is encountered during compilation, the compiler will ignore it instead.",
142
+ "type": "array",
143
+ "items": {
144
+ "type": "string"
145
+ }
146
+ },
147
+ "futureDeprecations": {
148
+ "description": "A set of future deprecations to opt into early. Future deprecations passed here will be treated as active by the compiler, emitting warnings as necessary.",
149
+ "type": "array",
150
+ "items": {
151
+ "type": "string"
152
+ }
153
+ }
154
+ },
155
+ "additionalProperties": false
128
156
  }
129
157
  },
130
158
  "additionalProperties": false
@@ -518,6 +546,11 @@
518
546
  "entry": {
519
547
  "type": "string",
520
548
  "description": "The server entry-point that when executed will spawn the web server."
549
+ },
550
+ "experimentalPlatform": {
551
+ "description": "Specifies the platform for which the server bundle is generated. This affects the APIs and modules available in the server-side code. \n\n- `node`: (Default) Generates a bundle optimized for Node.js environments. \n- `neutral`: Generates a platform-neutral bundle suitable for environments like edge workers, and other serverless platforms. This option avoids using Node.js-specific APIs, making the bundle more portable. \n\nPlease note that this feature does not provide polyfills for Node.js modules. Additionally, it is experimental, and the schematics may undergo changes in future versions.",
552
+ "default": "node",
553
+ "enum": ["node", "neutral"]
521
554
  }
522
555
  },
523
556
  "additionalProperties": false
@@ -528,6 +561,11 @@
528
561
  "type": "boolean",
529
562
  "description": "Generates an application shell during build time.",
530
563
  "default": false
564
+ },
565
+ "outputMode": {
566
+ "type": "string",
567
+ "description": "Defines the build output target. 'static': Generates a static site for deployment on any static hosting service. 'server': Produces an application designed for deployment on a server that supports server-side rendering (SSR).",
568
+ "enum": ["static", "server"]
531
569
  }
532
570
  },
533
571
  "additionalProperties": false,
@@ -22,22 +22,22 @@ const utils_1 = require("../../tools/esbuild/utils");
22
22
  * @returns An array of BundlerContext objects.
23
23
  */
24
24
  function setupBundlerContexts(options, browsers, codeBundleCache) {
25
- const { appShellOptions, prerenderOptions, serverEntryPoint, ssrOptions, workspaceRoot } = options;
25
+ const { outputMode, serverEntryPoint, appShellOptions, prerenderOptions, ssrOptions, workspaceRoot, watch = false, } = options;
26
26
  const target = (0, utils_1.transformSupportedBrowsersToTargets)(browsers);
27
27
  const bundlerContexts = [];
28
28
  // Browser application code
29
- bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, !!options.watch, (0, application_code_bundle_1.createBrowserCodeBundleOptions)(options, target, codeBundleCache)));
29
+ bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, (0, application_code_bundle_1.createBrowserCodeBundleOptions)(options, target, codeBundleCache)));
30
30
  // Browser polyfills code
31
31
  const browserPolyfillBundleOptions = (0, application_code_bundle_1.createBrowserPolyfillBundleOptions)(options, target, codeBundleCache);
32
32
  if (browserPolyfillBundleOptions) {
33
- bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, !!options.watch, browserPolyfillBundleOptions));
33
+ bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, browserPolyfillBundleOptions));
34
34
  }
35
35
  // Global Stylesheets
36
36
  if (options.globalStyles.length > 0) {
37
37
  for (const initial of [true, false]) {
38
38
  const bundleOptions = (0, global_styles_1.createGlobalStylesBundleOptions)(options, target, initial);
39
39
  if (bundleOptions) {
40
- bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, !!options.watch, bundleOptions, () => initial));
40
+ bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, bundleOptions, () => initial));
41
41
  }
42
42
  }
43
43
  }
@@ -46,19 +46,22 @@ function setupBundlerContexts(options, browsers, codeBundleCache) {
46
46
  for (const initial of [true, false]) {
47
47
  const bundleOptions = (0, global_scripts_1.createGlobalScriptsBundleOptions)(options, target, initial);
48
48
  if (bundleOptions) {
49
- bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, !!options.watch, bundleOptions, () => initial));
49
+ bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, bundleOptions, () => initial));
50
50
  }
51
51
  }
52
52
  }
53
53
  // Skip server build when none of the features are enabled.
54
- if (serverEntryPoint && (prerenderOptions || appShellOptions || ssrOptions)) {
54
+ if (serverEntryPoint && (outputMode || prerenderOptions || appShellOptions || ssrOptions)) {
55
55
  const nodeTargets = [...target, ...(0, utils_1.getSupportedNodeTargets)()];
56
- // Server application code
57
- bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, !!options.watch, (0, application_code_bundle_1.createServerCodeBundleOptions)(options, nodeTargets, codeBundleCache)));
56
+ bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, (0, application_code_bundle_1.createServerMainCodeBundleOptions)(options, nodeTargets, codeBundleCache)));
57
+ if (outputMode && ssrOptions?.entry) {
58
+ // New behavior introduced: 'server.ts' is now bundled separately from 'main.server.ts'.
59
+ bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, (0, application_code_bundle_1.createSsrEntryCodeBundleOptions)(options, nodeTargets, codeBundleCache)));
60
+ }
58
61
  // Server polyfills code
59
62
  const serverPolyfillBundleOptions = (0, application_code_bundle_1.createServerPolyfillBundleOptions)(options, nodeTargets, codeBundleCache);
60
63
  if (serverPolyfillBundleOptions) {
61
- bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, !!options.watch, serverPolyfillBundleOptions));
64
+ bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, serverPolyfillBundleOptions));
62
65
  }
63
66
  }
64
67
  return bundlerContexts;
@@ -9,7 +9,6 @@ export { type BuildOutputFile, BuildOutputFileType } from '@angular/build';
9
9
  export { createRxjsEsmResolutionPlugin } from '../../tools/esbuild/rxjs-esm-resolution-plugin';
10
10
  export { JavaScriptTransformer } from '../../tools/esbuild/javascript-transformer';
11
11
  export { getFeatureSupport, isZonelessApp } from '../../tools/esbuild/utils';
12
- export { renderPage } from '../../utils/server-rendering/render-page';
13
12
  export { type IndexHtmlTransform } from '../../utils/index-file/index-html-generator';
14
13
  export { purgeStaleBuildCache } from '../../utils/purge-cache';
15
14
  export { getSupportedBrowsers } from '../../utils/supported-browsers';
@@ -7,7 +7,7 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.buildApplicationInternal = exports.transformSupportedBrowsersToTargets = exports.getSupportedBrowsers = exports.purgeStaleBuildCache = exports.renderPage = exports.isZonelessApp = exports.getFeatureSupport = exports.JavaScriptTransformer = exports.createRxjsEsmResolutionPlugin = exports.BuildOutputFileType = void 0;
10
+ exports.buildApplicationInternal = exports.transformSupportedBrowsersToTargets = exports.getSupportedBrowsers = exports.purgeStaleBuildCache = exports.isZonelessApp = exports.getFeatureSupport = exports.JavaScriptTransformer = exports.createRxjsEsmResolutionPlugin = exports.BuildOutputFileType = void 0;
11
11
  var build_1 = require("@angular/build");
12
12
  Object.defineProperty(exports, "BuildOutputFileType", { enumerable: true, get: function () { return build_1.BuildOutputFileType; } });
13
13
  var rxjs_esm_resolution_plugin_1 = require("../../tools/esbuild/rxjs-esm-resolution-plugin");
@@ -17,8 +17,6 @@ Object.defineProperty(exports, "JavaScriptTransformer", { enumerable: true, get:
17
17
  var utils_1 = require("../../tools/esbuild/utils");
18
18
  Object.defineProperty(exports, "getFeatureSupport", { enumerable: true, get: function () { return utils_1.getFeatureSupport; } });
19
19
  Object.defineProperty(exports, "isZonelessApp", { enumerable: true, get: function () { return utils_1.isZonelessApp; } });
20
- var render_page_1 = require("../../utils/server-rendering/render-page");
21
- Object.defineProperty(exports, "renderPage", { enumerable: true, get: function () { return render_page_1.renderPage; } });
22
20
  var purge_cache_1 = require("../../utils/purge-cache");
23
21
  Object.defineProperty(exports, "purgeStaleBuildCache", { enumerable: true, get: function () { return purge_cache_1.purgeStaleBuildCache; } });
24
22
  var supported_browsers_1 = require("../../utils/supported-browsers");
@@ -8,8 +8,9 @@
8
8
  import type { BuilderContext } from '@angular-devkit/architect';
9
9
  import type { Plugin } from 'esbuild';
10
10
  import type { Connect, DepOptimizationConfig, InlineConfig } from 'vite';
11
+ import { ServerSsrMode } from '../../tools/vite/plugins';
11
12
  import { Result } from '../application/results';
12
- import { type ApplicationBuilderInternalOptions, type ExternalResultMetadata, JavaScriptTransformer } from './internal';
13
+ import { type ApplicationBuilderInternalOptions, BuildOutputFileType, type ExternalResultMetadata, JavaScriptTransformer } from './internal';
13
14
  import type { NormalizedDevServerOptions } from './options';
14
15
  import type { DevServerBuilderOutput } from './output';
15
16
  interface OutputFileRecord {
@@ -18,6 +19,11 @@ interface OutputFileRecord {
18
19
  hash?: string;
19
20
  updated: boolean;
20
21
  servable: boolean;
22
+ type: BuildOutputFileType;
23
+ }
24
+ interface DevServerExternalResultMetadata extends Omit<ExternalResultMetadata, 'explicit'> {
25
+ explicitBrowser: string[];
26
+ explicitServer: string[];
21
27
  }
22
28
  export type BuilderAction = (options: ApplicationBuilderInternalOptions, context: BuilderContext, plugins?: Plugin[]) => AsyncIterable<Result>;
23
29
  export declare function serveWithVite(serverOptions: NormalizedDevServerOptions, builderName: string, builderAction: BuilderAction, context: BuilderContext, transformers?: {
@@ -26,6 +32,6 @@ export declare function serveWithVite(serverOptions: NormalizedDevServerOptions,
26
32
  middleware?: Connect.NextHandleFunction[];
27
33
  buildPlugins?: Plugin[];
28
34
  }): AsyncIterableIterator<DevServerBuilderOutput>;
29
- export declare function setupServer(serverOptions: NormalizedDevServerOptions, outputFiles: Map<string, OutputFileRecord>, assets: Map<string, string>, preserveSymlinks: boolean | undefined, externalMetadata: ExternalResultMetadata, ssr: boolean, prebundleTransformer: JavaScriptTransformer, target: string[], zoneless: boolean, prebundleLoaderExtensions: EsbuildLoaderOption | undefined, extensionMiddleware?: Connect.NextHandleFunction[], indexHtmlTransformer?: (content: string) => Promise<string>, thirdPartySourcemaps?: boolean): Promise<InlineConfig>;
35
+ export declare function setupServer(serverOptions: NormalizedDevServerOptions, outputFiles: Map<string, OutputFileRecord>, assets: Map<string, string>, preserveSymlinks: boolean | undefined, externalMetadata: DevServerExternalResultMetadata, ssrMode: ServerSsrMode, prebundleTransformer: JavaScriptTransformer, target: string[], zoneless: boolean, usedComponentStyles: Map<string, Set<string>>, templateUpdates: Map<string, string>, prebundleLoaderExtensions: EsbuildLoaderOption | undefined, extensionMiddleware?: Connect.NextHandleFunction[], indexHtmlTransformer?: (content: string) => Promise<string>, thirdPartySourcemaps?: boolean): Promise<InlineConfig>;
30
36
  type EsbuildLoaderOption = Exclude<DepOptimizationConfig['esbuildOptions'], undefined>['loader'];
31
37
  export {};