@angular-devkit/build-angular 14.1.0 → 14.1.1
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 +5 -5
- package/src/builders/browser-esbuild/index.js +7 -2
- package/src/builders/browser-esbuild/stylesheets.js +2 -2
- package/src/utils/error.js +4 -1
- package/src/webpack/configs/dev-server.js +17 -0
- package/src/webpack/configs/styles.d.ts +1 -1
- package/src/webpack/configs/styles.js +13 -10
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "14.1.
|
|
3
|
+
"version": "14.1.1",
|
|
4
4
|
"description": "Angular Webpack Build Facade",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
7
7
|
"builders": "builders.json",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@ampproject/remapping": "2.2.0",
|
|
10
|
-
"@angular-devkit/architect": "0.1401.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.1401.
|
|
12
|
-
"@angular-devkit/core": "14.1.
|
|
10
|
+
"@angular-devkit/architect": "0.1401.1",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1401.1",
|
|
12
|
+
"@angular-devkit/core": "14.1.1",
|
|
13
13
|
"@babel/core": "7.18.6",
|
|
14
14
|
"@babel/generator": "7.18.7",
|
|
15
15
|
"@babel/helper-annotate-as-pure": "7.18.6",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@babel/runtime": "7.18.6",
|
|
21
21
|
"@babel/template": "7.18.6",
|
|
22
22
|
"@discoveryjs/json-ext": "0.5.7",
|
|
23
|
-
"@ngtools/webpack": "14.1.
|
|
23
|
+
"@ngtools/webpack": "14.1.1",
|
|
24
24
|
"ansi-colors": "4.1.3",
|
|
25
25
|
"babel-loader": "8.2.5",
|
|
26
26
|
"babel-plugin-istanbul": "6.1.1",
|
|
@@ -124,7 +124,11 @@ async function buildEsbuildBrowser(options, context) {
|
|
|
124
124
|
// Process global stylesheets
|
|
125
125
|
if (options.styles) {
|
|
126
126
|
// resolveGlobalStyles is temporarily reused from the Webpack builder code
|
|
127
|
-
const { entryPoints: stylesheetEntrypoints, noInjectNames } = (0, configs_1.resolveGlobalStyles)(options.styles, workspaceRoot,
|
|
127
|
+
const { entryPoints: stylesheetEntrypoints, noInjectNames } = (0, configs_1.resolveGlobalStyles)(options.styles, workspaceRoot,
|
|
128
|
+
// preserveSymlinks is always true here to allow the bundler to handle the option
|
|
129
|
+
true,
|
|
130
|
+
// skipResolution to leverage the bundler's more comprehensive resolution
|
|
131
|
+
true);
|
|
128
132
|
for (const [name, files] of Object.entries(stylesheetEntrypoints)) {
|
|
129
133
|
const virtualEntryData = files
|
|
130
134
|
.map((file) => `@import '${file.replace(/\\/g, '/')}';`)
|
|
@@ -135,6 +139,7 @@ async function buildEsbuildBrowser(options, context) {
|
|
|
135
139
|
sourcemap: !!sourcemapOptions.styles && (sourcemapOptions.hidden ? 'external' : true),
|
|
136
140
|
outputNames: noInjectNames.includes(name) ? { media: outputNames.media } : outputNames,
|
|
137
141
|
includePaths: (_e = options.stylePreprocessorOptions) === null || _e === void 0 ? void 0 : _e.includePaths,
|
|
142
|
+
preserveSymlinks: options.preserveSymlinks,
|
|
138
143
|
});
|
|
139
144
|
await (0, esbuild_1.logMessages)(context, sheetResult);
|
|
140
145
|
if (!sheetResult.path) {
|
|
@@ -277,7 +282,7 @@ async function bundleCode(workspaceRoot, entryPoints, outputNames, options, opti
|
|
|
277
282
|
}),
|
|
278
283
|
],
|
|
279
284
|
define: {
|
|
280
|
-
|
|
285
|
+
...(optimizationOptions.scripts ? { 'ngDevMode': 'false' } : undefined),
|
|
281
286
|
'ngJitMode': 'false',
|
|
282
287
|
},
|
|
283
288
|
});
|
|
@@ -50,8 +50,8 @@ async function bundleStylesheet(entry, options) {
|
|
|
50
50
|
write: false,
|
|
51
51
|
platform: 'browser',
|
|
52
52
|
preserveSymlinks: options.preserveSymlinks,
|
|
53
|
-
conditions: ['style'],
|
|
54
|
-
mainFields: ['style'],
|
|
53
|
+
conditions: ['style', 'sass'],
|
|
54
|
+
mainFields: ['style', 'sass'],
|
|
55
55
|
plugins: [
|
|
56
56
|
(0, sass_plugin_1.createSassPlugin)({ sourcemap: !!options.sourcemap, includePaths: options.includePaths }),
|
|
57
57
|
],
|
package/src/utils/error.js
CHANGED
|
@@ -13,6 +13,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.assertIsError = void 0;
|
|
14
14
|
const assert_1 = __importDefault(require("assert"));
|
|
15
15
|
function assertIsError(value) {
|
|
16
|
-
|
|
16
|
+
const isError = value instanceof Error ||
|
|
17
|
+
// The following is needing to identify errors coming from RxJs.
|
|
18
|
+
(typeof value === 'object' && value && 'name' in value && 'message' in value);
|
|
19
|
+
(0, assert_1.default)(isError, 'catch clause variable is not an Error instance');
|
|
17
20
|
}
|
|
18
21
|
exports.assertIsError = assertIsError;
|
|
@@ -98,6 +98,23 @@ async function getDevServerConfig(wco) {
|
|
|
98
98
|
publicPath: servePath,
|
|
99
99
|
stats: false,
|
|
100
100
|
},
|
|
101
|
+
setupMiddlewares: (middlewares, _devServer) => {
|
|
102
|
+
// Temporary workaround for https://github.com/webpack/webpack-dev-server/issues/4180
|
|
103
|
+
middlewares.push({
|
|
104
|
+
name: 'options-request-response',
|
|
105
|
+
path: '*',
|
|
106
|
+
middleware: (req, res, next) => {
|
|
107
|
+
if (req.method === 'OPTIONS') {
|
|
108
|
+
res.statusCode = 204;
|
|
109
|
+
res.setHeader('Content-Length', 0);
|
|
110
|
+
res.end();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
next();
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
return middlewares;
|
|
117
|
+
},
|
|
101
118
|
liveReload,
|
|
102
119
|
hot: hmr && !liveReload ? 'only' : hmr,
|
|
103
120
|
proxy: await addProxyConfig(root, proxyConfig),
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { Configuration } from 'webpack';
|
|
9
9
|
import { StyleElement } from '../../builders/browser/schema';
|
|
10
10
|
import { WebpackConfigOptions } from '../../utils/build-options';
|
|
11
|
-
export declare function resolveGlobalStyles(styleEntrypoints: StyleElement[], root: string, preserveSymlinks: boolean): {
|
|
11
|
+
export declare function resolveGlobalStyles(styleEntrypoints: StyleElement[], root: string, preserveSymlinks: boolean, skipResolution?: boolean): {
|
|
12
12
|
entryPoints: Record<string, string[]>;
|
|
13
13
|
noInjectNames: string[];
|
|
14
14
|
paths: string[];
|
|
@@ -41,7 +41,7 @@ const sass_service_1 = require("../../sass/sass-service");
|
|
|
41
41
|
const plugins_1 = require("../plugins");
|
|
42
42
|
const css_optimizer_plugin_1 = require("../plugins/css-optimizer-plugin");
|
|
43
43
|
const helpers_1 = require("../utils/helpers");
|
|
44
|
-
function resolveGlobalStyles(styleEntrypoints, root, preserveSymlinks) {
|
|
44
|
+
function resolveGlobalStyles(styleEntrypoints, root, preserveSymlinks, skipResolution = false) {
|
|
45
45
|
const entryPoints = {};
|
|
46
46
|
const noInjectNames = [];
|
|
47
47
|
const paths = [];
|
|
@@ -49,29 +49,32 @@ function resolveGlobalStyles(styleEntrypoints, root, preserveSymlinks) {
|
|
|
49
49
|
return { entryPoints, noInjectNames, paths };
|
|
50
50
|
}
|
|
51
51
|
for (const style of (0, helpers_1.normalizeExtraEntryPoints)(styleEntrypoints, 'styles')) {
|
|
52
|
-
let
|
|
53
|
-
if (!
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
let stylesheetPath = style.input;
|
|
53
|
+
if (!skipResolution) {
|
|
54
|
+
stylesheetPath = path.resolve(root, stylesheetPath);
|
|
55
|
+
if (!fs.existsSync(stylesheetPath)) {
|
|
56
|
+
try {
|
|
57
|
+
stylesheetPath = require.resolve(style.input, { paths: [root] });
|
|
58
|
+
}
|
|
59
|
+
catch { }
|
|
56
60
|
}
|
|
57
|
-
catch { }
|
|
58
61
|
}
|
|
59
62
|
if (!preserveSymlinks) {
|
|
60
|
-
|
|
63
|
+
stylesheetPath = fs.realpathSync(stylesheetPath);
|
|
61
64
|
}
|
|
62
65
|
// Add style entry points.
|
|
63
66
|
if (entryPoints[style.bundleName]) {
|
|
64
|
-
entryPoints[style.bundleName].push(
|
|
67
|
+
entryPoints[style.bundleName].push(stylesheetPath);
|
|
65
68
|
}
|
|
66
69
|
else {
|
|
67
|
-
entryPoints[style.bundleName] = [
|
|
70
|
+
entryPoints[style.bundleName] = [stylesheetPath];
|
|
68
71
|
}
|
|
69
72
|
// Add non injected styles to the list.
|
|
70
73
|
if (!style.inject) {
|
|
71
74
|
noInjectNames.push(style.bundleName);
|
|
72
75
|
}
|
|
73
76
|
// Add global css paths.
|
|
74
|
-
paths.push(
|
|
77
|
+
paths.push(stylesheetPath);
|
|
75
78
|
}
|
|
76
79
|
return { entryPoints, noInjectNames, paths };
|
|
77
80
|
}
|