@angular/build 18.1.1 → 18.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/builders/extract-i18n/builder.js +6 -0
- package/src/tools/esbuild/stylesheets/bundle-options.js +1 -1
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js +1 -1
- package/src/tools/sass/lexer.js +1 -1
- package/src/tools/vite/id-prefix-plugin.js +2 -2
- package/src/tools/vite/middlewares/assets-middleware.js +2 -1
- package/src/tools/vite/middlewares/index-html-middleware.js +4 -2
- package/src/utils/index-file/index-html-generator.js +1 -0
- package/src/utils/normalize-cache.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/build",
|
|
3
|
-
"version": "18.1.
|
|
3
|
+
"version": "18.1.3",
|
|
4
4
|
"description": "Official build system for Angular",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Angular CLI",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"builders": "builders.json",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ampproject/remapping": "2.3.0",
|
|
26
|
-
"@angular-devkit/architect": "0.1801.
|
|
26
|
+
"@angular-devkit/architect": "0.1801.3",
|
|
27
27
|
"@babel/core": "7.24.7",
|
|
28
28
|
"@babel/helper-annotate-as-pure": "7.24.7",
|
|
29
29
|
"@babel/helper-split-export-declaration": "7.24.7",
|
|
@@ -50,6 +50,12 @@ async function execute(options, context, extensions) {
|
|
|
50
50
|
context.logger.error(`The 'extract-i18n' builder requires a target to be specified.`);
|
|
51
51
|
return { success: false };
|
|
52
52
|
}
|
|
53
|
+
const { projectType } = (await context.getProjectMetadata(projectName));
|
|
54
|
+
if (projectType !== 'application') {
|
|
55
|
+
context.logger.error(`Tried to extract from ${projectName} with 'projectType' ${projectType}, which is not supported.` +
|
|
56
|
+
` The 'extract-i18n' builder can only extract from applications.`);
|
|
57
|
+
return { success: false };
|
|
58
|
+
}
|
|
53
59
|
// Check Angular version.
|
|
54
60
|
(0, version_1.assertCompatibleAngularVersion)(context.workspaceRoot);
|
|
55
61
|
// Load the Angular localize package.
|
|
@@ -35,7 +35,7 @@ function createStylesheetBundleOptions(options, cache, inlineComponentData) {
|
|
|
35
35
|
(0, css_resource_plugin_1.createCssResourcePlugin)(cache),
|
|
36
36
|
];
|
|
37
37
|
if (options.inlineFonts) {
|
|
38
|
-
plugins.
|
|
38
|
+
plugins.unshift((0, css_inline_fonts_plugin_1.createCssInlineFontsPlugin)({ cache, cacheOptions: options.cacheOptions }));
|
|
39
39
|
}
|
|
40
40
|
return {
|
|
41
41
|
absWorkingDir: options.workspaceRoot,
|
|
@@ -112,7 +112,7 @@ class StylesheetPluginFactory {
|
|
|
112
112
|
return processStylesheet(language, data, filename, format, options, build, postcssProcessor);
|
|
113
113
|
}));
|
|
114
114
|
// Add a load callback to support files from disk
|
|
115
|
-
build.onLoad({ filter: language.fileFilter }, (0, load_result_cache_1.createCachedLoad)(cache, async (args) => {
|
|
115
|
+
build.onLoad({ filter: language.fileFilter, namespace: 'file' }, (0, load_result_cache_1.createCachedLoad)(cache, async (args) => {
|
|
116
116
|
const data = await (0, promises_1.readFile)(args.path, 'utf-8');
|
|
117
117
|
return processStylesheet(language, data, args.path, (0, node_path_1.extname)(args.path).toLowerCase().slice(1), options, build, postcssProcessor);
|
|
118
118
|
}));
|
package/src/tools/sass/lexer.js
CHANGED
|
@@ -50,7 +50,7 @@ function* findUrls(contents) {
|
|
|
50
50
|
if (pos > 0) {
|
|
51
51
|
pos -= 2;
|
|
52
52
|
next();
|
|
53
|
-
if (!isWhitespace(current) && current !==
|
|
53
|
+
if (!isWhitespace(current) && current !== 0x002c && current !== 0x003a) {
|
|
54
54
|
// Skip - not a url token
|
|
55
55
|
pos += 3;
|
|
56
56
|
continue;
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.createRemoveIdPrefixPlugin = void 0;
|
|
11
11
|
// NOTE: the implementation for this Vite plugin is roughly based on:
|
|
12
12
|
// https://github.com/MilanKovacic/vite-plugin-externalize-dependencies
|
|
13
|
-
const VITE_ID_PREFIX = '
|
|
13
|
+
const VITE_ID_PREFIX = '@id/';
|
|
14
14
|
const escapeRegexSpecialChars = (inputString) => {
|
|
15
15
|
return inputString.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
16
16
|
};
|
|
@@ -23,7 +23,7 @@ const createRemoveIdPrefixPlugin = (externals) => ({
|
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
const escapedExternals = externals.map(escapeRegexSpecialChars);
|
|
26
|
-
const prefixedExternalRegex = new RegExp(`${VITE_ID_PREFIX}(${escapedExternals.join('|')})`, 'g');
|
|
26
|
+
const prefixedExternalRegex = new RegExp(`${resolvedConfig.base}${VITE_ID_PREFIX}(${escapedExternals.join('|')})`, 'g');
|
|
27
27
|
// @ts-expect-error: Property 'push' does not exist on type 'readonly Plugin<any>[]'
|
|
28
28
|
// Reasoning:
|
|
29
29
|
// since the /@id/ prefix is added by Vite's import-analysis plugin,
|
|
@@ -69,7 +69,8 @@ function createAngularAssetsMiddleware(server, assets, outputFiles) {
|
|
|
69
69
|
if (!pathnameHasTrailingSlash) {
|
|
70
70
|
for (const assetPath of assets.keys()) {
|
|
71
71
|
if (pathname === assetPath.substring(0, assetPath.lastIndexOf('/'))) {
|
|
72
|
-
const
|
|
72
|
+
const { pathname, search, hash } = new URL(req.url, 'http://localhost');
|
|
73
|
+
const location = [pathname, '/', search, hash].join('');
|
|
73
74
|
res.statusCode = 301;
|
|
74
75
|
res.setHeader('Content-Type', 'text/html');
|
|
75
76
|
res.setHeader('Location', location);
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.createAngularIndexHtmlMiddleware = createAngularIndexHtmlMiddleware;
|
|
11
|
+
const node_path_1 = require("node:path");
|
|
11
12
|
const utils_1 = require("../utils");
|
|
12
13
|
function createAngularIndexHtmlMiddleware(server, outputFiles, indexHtmlTransformer) {
|
|
13
14
|
return function (req, res, next) {
|
|
@@ -18,11 +19,12 @@ function createAngularIndexHtmlMiddleware(server, outputFiles, indexHtmlTransfor
|
|
|
18
19
|
// Parse the incoming request.
|
|
19
20
|
// The base of the URL is unused but required to parse the URL.
|
|
20
21
|
const pathname = (0, utils_1.pathnameWithoutBasePath)(req.url, server.config.base);
|
|
21
|
-
|
|
22
|
+
const extension = (0, node_path_1.extname)(pathname);
|
|
23
|
+
if (extension !== '.html') {
|
|
22
24
|
next();
|
|
23
25
|
return;
|
|
24
26
|
}
|
|
25
|
-
const rawHtml = outputFiles.get(
|
|
27
|
+
const rawHtml = outputFiles.get(pathname)?.contents;
|
|
26
28
|
if (!rawHtml) {
|
|
27
29
|
next();
|
|
28
30
|
return;
|
|
@@ -32,6 +32,7 @@ class IndexHtmlGenerator {
|
|
|
32
32
|
if (options?.optimization?.styles?.inlineCritical) {
|
|
33
33
|
this.csrPlugins.push(inlineCriticalCssPlugin(this));
|
|
34
34
|
}
|
|
35
|
+
this.csrPlugins.push(addNoncePlugin());
|
|
35
36
|
// SSR plugins
|
|
36
37
|
if (options.generateDedicatedSSRContent) {
|
|
37
38
|
this.ssrPlugins.push(addEventDispatchContractPlugin(), addNoncePlugin());
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.normalizeCacheOptions = normalizeCacheOptions;
|
|
11
11
|
const node_path_1 = require("node:path");
|
|
12
12
|
/** Version placeholder is replaced during the build process with actual package version */
|
|
13
|
-
const VERSION = '18.1.
|
|
13
|
+
const VERSION = '18.1.3';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|