1600 Commits

Author SHA1 Message Date
Jan Krems
2c9904ec7a fix(@angular-devkit/build-angular): handle basename collisions 2024-11-06 07:19:43 -08:00
Alan Agius
8f6ee1ac83 fix(@angular/build): skip wildcard routes from being listed as prerendered routes
This fix ensures that the wildcard routes are not included in the prerendered list, improving the accuracy of prerendered route generation.
2024-11-06 13:39:28 +01:00
Charles Lyding
a2f5ca9908 refactor(@angular/build): use structured component stylesheet tracking for hot replacement
When using the development server with the application builder, the internal state of
any external component stylesheets is now more comprehensively tracked. This allows
for more flexibility in both debugging potential problems as well as supporting additional
stylesheet preprocessing steps including deferred component stylesheet processing.
2024-11-06 10:26:56 +01:00
Alan Agius
e16cbb9ad5 refactor(@angular/ssr): remove duplicate code and streamline functionality
This commit cleans up duplicate code left from the previous implementations of process, serve, and render. Additionally, prerender serve now exclusively handles HEAD and GET requests, aligning with updated handling requirements. The private `renderStatic` method has been removed in favor of the `handle` method for improved maintainability.
2024-11-06 10:14:07 +01:00
Alan Agius
18b6aea397 refactor(@angular/ssr): Add RequestHandlerFunction and NodeRequestHandlerFunction to public API
These additions are necessary to ensure their inclusion in adev.
2024-11-05 19:39:13 +01:00
Alan Agius
27315d1acc docs(@angular/ssr): add missing @developerPreview annotations
Added `@developerPreview` annotations to the relevant API functions and properties within the `@angular/ssr` package. This change ensures that the documentation accurately reflects the preview status of these elements, clarifying their intended use and stability level for developers.
2024-11-05 19:39:02 +01:00
Alan Agius
7c6b9e5b3d docs: enhance documentation by adding @see references
Improve the documentation `adev` API reference by incorporating `@see` references. This addition enhances cross-referencing within the documentation, making it easier for users to navigate related content and gain better context.
2024-11-05 19:39:02 +01:00
Alan Agius
58a648aadc fix(@angular/ssr): add validation to prevent use of provideServerRoutesConfig in browser context
Introduced an error check to ensure that 'provideServerRoutesConfig' is not utilized in the browser part of the application. This helps avoid unintended behavior.
2024-11-05 19:38:39 +01:00
Charles Lyding
e6ff801ba0 fix(@angular/build): workaround Vite CSS ShadowDOM hot replacement
When using the development server with the application builder (default for new projects),
Angular components using ShadowDOM view encapsulation will now cause a full page reload.
This ensures that these components styles are correctly updated during watch mode. Vite's
CSS hot replacement client code currently does not support searching and replacing `<link>`
elements inside shadow roots. When support is available within Vite, an HMR based update
for ShadowDOM components can be supported as other view encapsulation modes are now.
2024-11-05 17:27:50 +01:00
Alan Agius
a1fa483633 fix(@angular/build): handle APP_BASE_HREF correctly in prerendered routes
This commit resolves path stripping issues when `APP_BASE_HREF` does not align with the expected value.

Closes #28775
2024-11-05 17:19:38 +01:00
Alan Agius
daea0ab685 docs: replace @note with @remarks
Updated TSDoc comments by replacing @note with @remarks across the codebase. This aligns with TSDoc's preferred conventions, where @remarks is used for supplementary explanations and additional context.
2024-11-05 15:00:05 +01:00
Charles Lyding
46335625eb fix(@angular/build): disable dev-server websocket when live reload is disabled
When live reload is disabled (`"liveReload": false`/`no-live-reload`) within
the development server, the Vite websocket server will no longer be initialized.
Additionally, the client code will not be loaded by the browser. This allows the
development server to be used in test scenarios that would prefer to more fully
represent the production fielded configuration such as E2E testing or other forms
of browser-based testing.
2024-11-05 10:59:24 +01:00
Charles Lyding
9f5b5eb46e fix(@angular/build): correctly use dev-server hmr option to control stylesheet hot replacement
The development server's `hmr` option will now disable both global and component
stylesheet hot replacement if explicitly disabled. These features are enabled by
default for all projects.
2024-11-05 10:59:24 +01:00
Charles Lyding
ae9dfddbe5 refactor(@angular/build): integrate template update function generation with builder results
When using the development server with the application builder (default for new projects),
experimental support for component template hot replacement is now available for use. To
enable support, the `NG_HMR_TEMPLATES=1` environment variable must present when executing
the development server (for example, `NG_HMR_TEMPLATES=1 ng serve`). Once support has become
stable, template hot replacement will be enabled by default.
2024-11-05 10:30:58 +01:00
Charles Lyding
99192a791b fix(@angular/build): always clear dev-server error overlay on non-error result
Now that additional result object types can be returned from the build
system, the error overlay must be cleared on all non-error results. The
introduction of component update results and eventual incremental results
will now properly clear the error overlay after a successful build.
2024-11-05 08:23:17 +01:00
Alan Agius
71b3de8364 fix(@angular/build): ensure accurate content size in server asset metadata
Updated the calculation to use `Buffer.byteLength()` for determining the length of escaped file content. This change ensures that the `size` property in server asset metadata accurately represents the length of the escaped content.
2024-11-04 20:31:03 +01:00
Alan Agius
d21e511b6b refactor(@angular/build): split SSR server assets into separate chunks
This commit refactors the build process for server-side rendering (SSR) by dividing server assets into separate, importable chunks rather than bundling them into a single output file.
2024-11-04 20:31:03 +01:00
Angular Robot
316df8fbba build: update all non-major dependencies 2024-11-04 16:44:14 +01:00
Charles Lyding
d16a9aa437 fix(@angular/build): check referenced files against native file paths
When checking for bundler context invalidation for any referenced files,
the native path format is now used to ensure that the watch files can
be correctly matched. This is particularly important for Windows due to
the differing path segment separator.
2024-11-02 15:57:50 -04:00
Charles Lyding
aaaa4bc5f4 refactor(@angular/build): allow in-memory caching of server main code bundling during rebuilds
In addition to the other main code bundling steps, the server main code will
also be cached and invalidated based on file changes in watch mode.
2024-11-02 08:26:57 -04:00
Charles Lyding
7eabe7d4b3 refactor(@angular/build): avoid need to pre-import angular compiler package in dev server
Within the development server, the external stylesheet encapsulation logic has been
adjusted to avoid needing to asynchronously import the `@angular/compiler` package within
the request execution. This removes the need to pre-import the package at the start of the
development server which was previously used to avoid a delay in stylesheet response on
first use. The external stylesheet response execution is also now fully synchronous.
2024-11-01 18:42:00 -04:00
Charles Lyding
5efcf88a35 refactor(@angular/build): send error status code on invalid external style component ID
If an invalid component identifier is provided to the development server for an external
stylesheet requiring encapsulation, both a console message and a 400 status response will
now be sent. This removes the potential for invalid styles to be sent to the browser.
2024-11-01 18:42:00 -04:00
Alan Agius
505521e546 perf(@angular/ssr): integrate ETags for prerendered pages
When using the new developer preview API to serve prerendered pages, ETags are added automatically, enabling efficient caching and content validation for improved performance.
2024-11-01 19:52:03 +01:00
Charles Lyding
7c6cb9593a fix(@angular/cli): recommend optional application update migration during v19 update
The optional application builder migration will now default to enabled and
recommended during the update process (`ng update`) for v19. The migration
is still optional and can be unselected if preferred when updating.
2024-11-01 11:29:14 -04:00
Angular Robot
227f303e38 build: update angular 2024-11-01 11:28:53 -04:00
Charles Lyding
fba2799154 refactor(@angular/build): allow caching of TypeScript build contexts for rebuilds
Now that the TypeScript bundler contexts perform additional checks for validity,
they can now be cached in memory during watch modes. This allows the TypeScript
bundler contexts to skip rebundling when not affected by a file changed. This is
particularly beneficial for style related file changes where no code processing
is otherwise required.
2024-11-01 10:13:13 -04:00
Charles Lyding
2aa25a73a8 fix(@angular/build): ensure SVG template URLs are considered templates with external stylesheets
When using the development server with the application builder (default for new projects),
the external stylesheet functionality for component style hot replacement was incorrectly
considering SVG files as stylesheet resources. This resulted in a build error when using
SVG files as a template source. The file extension based checks have now been improved to
account for this usage.
2024-11-01 10:12:44 -04:00
Charles Lyding
abde078233 refactor(@angular/build): improve typescript bundling context rebuild checking
The TypeScript-based bundling contexts have now been separated from the other
bundling contexts that may be present in an application build. The later of which
include global styles, scripts, and non-TypeScript polyfills. This allows for
the TypeScript bundling contexts to perform additional checks during a rebuild to
determine if they actually need to be rebundled. The bundling context caching for
the TypeScript contexts has not yet been enabled but these changes prepare for the
switch to allow conditional rebundling on file changes.
2024-11-01 09:30:09 -04:00
Angular Robot
69768bdaa4 build: update all non-major dependencies 2024-11-01 08:25:17 -04:00
Charles Lyding
5c2aa2f4b1 refactor(@angular/build): allow experimental template update generation via environment variable
The experimental Angular component template hot replacement capabilities
will be initially controlled via an environment variable. Setting `NG_HMR_TEMPLATES=1`
with the development server that is using the application builder will generate the
runtime event code to support hot replacement of an individual component template.
The build system itself does not yet generate the component update build results needed
to trigger the runtime events. The environment variable is currently intended to support
integration of the remaining code to fully implement the feature.
2024-11-01 07:17:29 -04:00
Alan Agius
481ccdbc5a fix(@angular/ssr): enable serving of prerendered pages in the App Engine
This commit implements the capability for the App Engine to serve prerendered pages directly. Previously, we relied on frameworks like Express for this functionality, which resulted in inconsistent redirects for directories where in some cases a trailing slash was added to the route.

**Note:** This change applies only when using the new SSR APIs. When using the `CommonEngine`, a 3rd party static serve middleware is still required.
2024-11-01 10:45:05 +01:00
Alan Agius
d6dfce105a refactor(@angular/ssr): add route configs to public API
These interfaces needs to be exported to be included in adev.
2024-10-31 16:55:05 +01:00
Alan Agius
3371f5b9ab fix(@angular/build): Exclude known --import from execArgv when spawning workers
This change prevents Bazel compilation issues in the ADEV build process.
2024-10-31 12:42:53 +01:00
Alan Agius
a3e2bcd6b4 refactor(@angular/build): remove experimental buildApplication overload
An experimental overload of `buildApplication` has been removed.
2024-10-30 19:47:40 -04:00
Charles Lyding
7172df1243 refactor(@angular/build): allow forcing bundler context rebundle
A bundle call for a `BundlerContext` can now force a rebundling in cases
where the cached version should not be used. This is currently not leveraged
within the code but will be used for improvements to typescript based context
rebuilds in the future.
2024-10-30 18:21:43 -04:00
Alan Agius
c242d2933a fix(@angular/build): set ngServerMode during vite prebundling
This commit sets the `ngServerMode` in the prebundled deps.
2024-10-30 23:19:10 +01:00
Charles Lyding
bc43f9567c build: add return types for component stylesheet bundler 2024-10-30 14:26:19 -04:00
Angular Robot
170bb19074 build: update all non-major dependencies 2024-10-30 12:27:43 -04:00
Charles Lyding
a9772068d5 refactor(@angular/build): directly bundle external component file-based style changes
When using the development server with the application builder, file-based component
styles will now be bundled during the main builder execution instead of within the
application code bundling step. This allows for these styles to be processed independently
from any code bundling steps and will support future changes that will allow the
builder to completely skip code bundling if only file-based component stylesheets are changed.
2024-10-30 11:07:53 -04:00
Charles Lyding
bc771ae2d0 fix(@angular/build): always record component style usage for HMR updates
When using the development server with the application builder, external
component stylesheet usage must always be record to ensure that any hot
replacement actions correctly reference the relevant components. Previously,
browser cached styles would return a 304 status prior to recording the usage.
This resulted in the development server not knowing that the component needed
a potential update in the future.
2024-10-29 13:14:00 -04:00
Alan Agius
8e2829c851 refactor(@angular/build): add handling for ngServerMode
Configure esbuild to add `ngServerMode` as define.
2024-10-29 07:44:55 +01:00
Alan Agius
0af41e2380 build: remove debug code
This was left over by mistake
2024-10-28 17:00:24 -04:00
Angular Robot
afec9297dc build: update all non-major dependencies 2024-10-28 14:36:59 -04:00
Charles Lyding
4df44dcfb6 refactor(@angular/build): use ETags for dev-server resource requests
When using the development server with the application build system,
resource files managed by the build system will now using ETag headers
to avoid resending content that has not changed since the last request.
This includes such content as global stylesheet files, image/font files
referenced in stylesheets, and other files managed by the bundler.
2024-10-28 14:16:16 -04:00
Alan Agius
b3fe50fcde refactor(@angular/ssr): switch from esbuild to rollup for bundling critters/beasties
Esbuild exhibits issues when handling code that is generated and then reprocessed by itself, creating challenges when using it to bundle libraries or library components.

To remove these issues, we've replaced Esbuild with Rollup for bundling `beasties`.

See:  https://github.com/evanw/esbuild/issues/3723
2024-10-28 18:57:05 +01:00
Alan Agius
15677d0cb7 refactor: replace critters with beasties
The Critters project has been transferred to the Nuxt team, who will now manage its development and has been renamed to Beasties.

See: https://github.com/danielroe/beasties
2024-10-28 18:57:05 +01:00
Alan Agius
1fc8fdea2c refactor(@angular/ssr): remove custom Platform Server creation Logic
Replaced the custom logic for creating the platform server with the standard `platformServer` method.
2024-10-28 17:54:52 +01:00
Charles Lyding
b73b98de65 refactor(@angular/build): use ETag headers for development external component styles
When using the development server, Angular component stylesheet requests that
use hot replacement (default for v19) will now use the `ETag` header to remove
the need to reprocess and resend encapsulated component styles if the styles
have not changed since last usage. The ETag value used is a combination of the
style content and the encapsulation component identifier.
2024-10-28 12:29:01 -04:00
Alan Agius
63722c309c fix(@angular/ssr): ensure wildcard RenderMode is applied when no Angular routes are defined
This fix addresses a bug where, in the absence of defined Angular routes, the RenderMode was not correctly applied based on the wildcard setting.
2024-10-28 16:43:16 +01:00
Alan Agius
d8f926fa7f fix(@angular/build): simplify disabling server features with --no-server via command line
When `outputMode` is configured, `--prerender` and `--app-shell` become no-ops, making server feature disabling difficult without modifying the configuration.

This commit introduces the `--no-server` option, which can be used with `--output-mode static` to fully disable all server features.

```
ng build --output-mode static --no-server
```
2024-10-28 16:08:06 +01:00