@nx/angular 17.2.0-beta.11 → 17.2.0-beta.14
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/executors.d.ts +1 -0
- package/executors.js +1 -0
- package/executors.json +5 -0
- package/package.json +10 -10
- package/src/builders/dev-server/dev-server.impl.js +34 -5
- package/src/builders/webpack-browser/webpack-browser.impl.js +2 -1
- package/src/builders/webpack-server/webpack-server.impl.js +2 -1
- package/src/executors/application/application.impl.d.ts +9 -0
- package/src/executors/application/application.impl.js +28 -0
- package/src/executors/application/schema.d.ts +7 -0
- package/src/executors/application/schema.json +612 -0
- package/src/executors/browser-esbuild/browser-esbuild.impl.d.ts +2 -3
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +15 -6
- package/src/executors/browser-esbuild/schema.d.ts +3 -1
- package/src/executors/browser-esbuild/schema.json +30 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +3 -0
- package/src/executors/utilities/buildable-libs.d.ts +6 -0
- package/src/executors/{browser-esbuild/lib → utilities}/buildable-libs.js +3 -4
- package/src/executors/utilities/esbuild-extensions.d.ts +6 -0
- package/src/executors/utilities/esbuild-extensions.js +27 -0
- package/src/executors/utilities/module-loader.d.ts +15 -0
- package/src/executors/utilities/module-loader.js +52 -0
- package/src/executors/utilities/ng-compiler-cli.d.ts +0 -14
- package/src/executors/utilities/ng-compiler-cli.js +3 -23
- package/src/executors/browser-esbuild/lib/buildable-libs.d.ts +0 -9
package/executors.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './src/executors/delegate-build/delegate-build.impl';
|
|
|
6
6
|
export * from './src/executors/ng-packagr-lite/ng-packagr-lite.impl';
|
|
7
7
|
export * from './src/executors/package/package.impl';
|
|
8
8
|
export * from './src/executors/browser-esbuild/browser-esbuild.impl';
|
|
9
|
+
export * from './src/executors/application/application.impl';
|
|
9
10
|
import { executeDevServerBuilder } from './src/builders/dev-server/dev-server.impl';
|
|
10
11
|
export {
|
|
11
12
|
/**
|
package/executors.js
CHANGED
|
@@ -10,6 +10,7 @@ tslib_1.__exportStar(require("./src/executors/delegate-build/delegate-build.impl
|
|
|
10
10
|
tslib_1.__exportStar(require("./src/executors/ng-packagr-lite/ng-packagr-lite.impl"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./src/executors/package/package.impl"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./src/executors/browser-esbuild/browser-esbuild.impl"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./src/executors/application/application.impl"), exports);
|
|
13
14
|
const dev_server_impl_1 = require("./src/builders/dev-server/dev-server.impl");
|
|
14
15
|
Object.defineProperty(exports, "executeWebpackDevServerBuilder", { enumerable: true, get: function () { return dev_server_impl_1.executeDevServerBuilder; } });
|
|
15
16
|
Object.defineProperty(exports, "executeDevServerBuilder", { enumerable: true, get: function () { return dev_server_impl_1.executeDevServerBuilder; } });
|
package/executors.json
CHANGED
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"implementation": "./src/executors/module-federation-dev-server/module-federation-dev-server.impl",
|
|
25
25
|
"schema": "./src/executors/module-federation-dev-server/schema.json",
|
|
26
26
|
"description": "The module-federation-dev-server executor is reserved exclusively for use with host Module Federation applications. It allows the user to specify which remote applications should be served with the host."
|
|
27
|
+
},
|
|
28
|
+
"application": {
|
|
29
|
+
"implementation": "./src/executors/application/application.impl",
|
|
30
|
+
"schema": "./src/executors/application/schema.json",
|
|
31
|
+
"description": "Builds an application with esbuild with support for incremental builds. _Note: this is only supported in Angular versions >= 17.0.0_."
|
|
27
32
|
}
|
|
28
33
|
},
|
|
29
34
|
"builders": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "17.2.0-beta.
|
|
3
|
+
"version": "17.2.0-beta.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -78,15 +78,15 @@
|
|
|
78
78
|
"tslib": "^2.3.0",
|
|
79
79
|
"webpack": "^5.80.0",
|
|
80
80
|
"webpack-merge": "^5.8.0",
|
|
81
|
-
"@nx/devkit": "17.2.0-beta.
|
|
82
|
-
"@nx/cypress": "17.2.0-beta.
|
|
83
|
-
"@nx/jest": "17.2.0-beta.
|
|
84
|
-
"@nx/js": "17.2.0-beta.
|
|
85
|
-
"@nx/eslint": "17.2.0-beta.
|
|
86
|
-
"@nx/webpack": "17.2.0-beta.
|
|
87
|
-
"@nx/web": "17.2.0-beta.
|
|
88
|
-
"@nx/workspace": "17.2.0-beta.
|
|
89
|
-
"@nrwl/angular": "17.2.0-beta.
|
|
81
|
+
"@nx/devkit": "17.2.0-beta.14",
|
|
82
|
+
"@nx/cypress": "17.2.0-beta.14",
|
|
83
|
+
"@nx/jest": "17.2.0-beta.14",
|
|
84
|
+
"@nx/js": "17.2.0-beta.14",
|
|
85
|
+
"@nx/eslint": "17.2.0-beta.14",
|
|
86
|
+
"@nx/webpack": "17.2.0-beta.14",
|
|
87
|
+
"@nx/web": "17.2.0-beta.14",
|
|
88
|
+
"@nx/workspace": "17.2.0-beta.14",
|
|
89
|
+
"@nrwl/angular": "17.2.0-beta.14"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
|
|
@@ -7,9 +7,11 @@ const webpack_nx_build_coordination_plugin_1 = require("@nx/webpack/src/plugins/
|
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const operators_1 = require("nx/src/project-graph/operators");
|
|
9
9
|
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
10
|
+
const path_1 = require("path");
|
|
10
11
|
const rxjs_1 = require("rxjs");
|
|
11
12
|
const operators_2 = require("rxjs/operators");
|
|
12
13
|
const angular_version_utils_1 = require("../../executors/utilities/angular-version-utils");
|
|
14
|
+
const esbuild_extensions_1 = require("../../executors/utilities/esbuild-extensions");
|
|
13
15
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
14
16
|
const webpack_1 = require("../utilities/webpack");
|
|
15
17
|
const lib_1 = require("./lib");
|
|
@@ -56,6 +58,7 @@ function executeDevServerBuilder(rawOptions, context) {
|
|
|
56
58
|
target: parsedBuildTarget.target,
|
|
57
59
|
});
|
|
58
60
|
dependencies = foundDependencies;
|
|
61
|
+
const relativeTsConfigPath = (0, devkit_1.normalizePath)((0, path_1.relative)(context.workspaceRoot, tsConfigPath));
|
|
59
62
|
// We can't just pass the tsconfig path in memory to the angular builder
|
|
60
63
|
// function because we can't pass the build target options to it, the build
|
|
61
64
|
// targets options will be retrieved by the builder from the project
|
|
@@ -65,19 +68,20 @@ function executeDevServerBuilder(rawOptions, context) {
|
|
|
65
68
|
const originalGetTargetOptions = context.getTargetOptions;
|
|
66
69
|
context.getTargetOptions = async (target) => {
|
|
67
70
|
const options = await originalGetTargetOptions(target);
|
|
68
|
-
options.tsConfig =
|
|
71
|
+
options.tsConfig = relativeTsConfigPath;
|
|
69
72
|
return options;
|
|
70
73
|
};
|
|
71
74
|
// The buildTargetConfiguration also needs to use the generated tsconfig path
|
|
72
75
|
// otherwise the build will fail if customWebpack function/file is referencing
|
|
73
76
|
// local libs. This synchronize the behavior with webpack-browser and
|
|
74
77
|
// webpack-server implementation.
|
|
75
|
-
buildTargetOptions.tsConfig =
|
|
78
|
+
buildTargetOptions.tsConfig = relativeTsConfigPath;
|
|
76
79
|
}
|
|
77
80
|
const delegateBuilderOptions = getDelegateBuilderOptions(options);
|
|
78
81
|
const isUsingWebpackBuilder = ![
|
|
79
82
|
'@angular-devkit/build-angular:application',
|
|
80
83
|
'@angular-devkit/build-angular:browser-esbuild',
|
|
84
|
+
'@nx/angular:application',
|
|
81
85
|
'@nx/angular:browser-esbuild',
|
|
82
86
|
].includes(buildTarget.executor);
|
|
83
87
|
/**
|
|
@@ -86,8 +90,11 @@ function executeDevServerBuilder(rawOptions, context) {
|
|
|
86
90
|
* builders. Since we are using a custom builder, we patch the context to
|
|
87
91
|
* handle `@nx/angular:*` executors.
|
|
88
92
|
*/
|
|
89
|
-
patchBuilderContext(context);
|
|
90
|
-
return (0, rxjs_1.
|
|
93
|
+
patchBuilderContext(context, !isUsingWebpackBuilder, parsedBuildTarget);
|
|
94
|
+
return (0, rxjs_1.combineLatest)([
|
|
95
|
+
(0, rxjs_1.from)(Promise.resolve().then(() => require('@angular-devkit/build-angular'))),
|
|
96
|
+
(0, rxjs_1.from)((0, esbuild_extensions_1.loadPlugins)(buildTargetOptions.plugins, buildTargetOptions.tsConfig)),
|
|
97
|
+
]).pipe((0, operators_2.switchMap)(([{ executeDevServerBuilder }, plugins]) => executeDevServerBuilder(delegateBuilderOptions, context, {
|
|
91
98
|
webpackConfiguration: isUsingWebpackBuilder
|
|
92
99
|
? async (baseWebpackConfig) => {
|
|
93
100
|
if (!buildLibsFromSource) {
|
|
@@ -115,6 +122,8 @@ function executeDevServerBuilder(rawOptions, context) {
|
|
|
115
122
|
indexHtml: (0, webpack_1.resolveIndexHtmlTransformer)(pathToIndexFileTransformer, buildTargetOptions.tsConfig, context.target),
|
|
116
123
|
}
|
|
117
124
|
: {}),
|
|
125
|
+
}, {
|
|
126
|
+
buildPlugins: plugins,
|
|
118
127
|
})));
|
|
119
128
|
}
|
|
120
129
|
exports.executeDevServerBuilder = executeDevServerBuilder;
|
|
@@ -137,8 +146,9 @@ const executorToBuilderMap = new Map([
|
|
|
137
146
|
'@nx/angular:browser-esbuild',
|
|
138
147
|
'@angular-devkit/build-angular:browser-esbuild',
|
|
139
148
|
],
|
|
149
|
+
['@nx/angular:application', '@angular-devkit/build-angular:application'],
|
|
140
150
|
]);
|
|
141
|
-
function patchBuilderContext(context) {
|
|
151
|
+
function patchBuilderContext(context, isUsingEsbuildBuilder, buildTarget) {
|
|
142
152
|
const originalGetBuilderNameForTarget = context.getBuilderNameForTarget;
|
|
143
153
|
context.getBuilderNameForTarget = async (target) => {
|
|
144
154
|
const builderName = await originalGetBuilderNameForTarget(target);
|
|
@@ -147,4 +157,23 @@ function patchBuilderContext(context) {
|
|
|
147
157
|
}
|
|
148
158
|
return builderName;
|
|
149
159
|
};
|
|
160
|
+
if (isUsingEsbuildBuilder) {
|
|
161
|
+
const originalGetTargetOptions = context.getTargetOptions;
|
|
162
|
+
context.getTargetOptions = async (target) => {
|
|
163
|
+
const options = await originalGetTargetOptions(target);
|
|
164
|
+
if (target.project === buildTarget.project &&
|
|
165
|
+
target.target === buildTarget.target &&
|
|
166
|
+
target.configuration === buildTarget.configuration) {
|
|
167
|
+
cleanBuildTargetOptions(options);
|
|
168
|
+
}
|
|
169
|
+
return options;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function cleanBuildTargetOptions(options) {
|
|
174
|
+
delete options.buildLibsFromSource;
|
|
175
|
+
delete options.customWebpackConfig;
|
|
176
|
+
delete options.indexFileTransformer;
|
|
177
|
+
delete options.plugins;
|
|
178
|
+
return options;
|
|
150
179
|
}
|
|
@@ -7,6 +7,7 @@ const fs_1 = require("fs");
|
|
|
7
7
|
const configuration_1 = require("nx/src/config/configuration");
|
|
8
8
|
const operators_1 = require("nx/src/project-graph/operators");
|
|
9
9
|
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
10
|
+
const path_1 = require("path");
|
|
10
11
|
const rxjs_1 = require("rxjs");
|
|
11
12
|
const operators_2 = require("rxjs/operators");
|
|
12
13
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
@@ -40,7 +41,7 @@ function executeWebpackBrowserBuilder(options, context) {
|
|
|
40
41
|
projectGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
41
42
|
const { tsConfigPath, dependencies: foundDependencies } = (0, buildable_libs_1.createTmpTsConfigForBuildableLibs)(delegateBuilderOptions.tsConfig, context, { projectGraph });
|
|
42
43
|
dependencies = foundDependencies;
|
|
43
|
-
delegateBuilderOptions.tsConfig = tsConfigPath;
|
|
44
|
+
delegateBuilderOptions.tsConfig = (0, devkit_1.normalizePath)((0, path_1.relative)(context.workspaceRoot, tsConfigPath));
|
|
44
45
|
}
|
|
45
46
|
return (0, rxjs_1.from)(Promise.resolve().then(() => require('@angular-devkit/build-angular'))).pipe((0, operators_2.switchMap)(({ executeBrowserBuilder }) => executeBrowserBuilder(delegateBuilderOptions, context, {
|
|
46
47
|
webpackConfiguration: (baseWebpackConfig) => {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.executeWebpackServerBuilder = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
6
7
|
const rxjs_1 = require("rxjs");
|
|
7
8
|
const operators_1 = require("rxjs/operators");
|
|
8
9
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
@@ -50,7 +51,7 @@ function executeWebpackServerBuilder(options, context) {
|
|
|
50
51
|
options.buildLibsFromSource ??= true;
|
|
51
52
|
if (!options.buildLibsFromSource) {
|
|
52
53
|
const { tsConfigPath } = (0, buildable_libs_1.createTmpTsConfigForBuildableLibs)(options.tsConfig, context);
|
|
53
|
-
options.tsConfig = tsConfigPath;
|
|
54
|
+
options.tsConfig = (0, devkit_1.normalizePath)((0, path_1.relative)(context.workspaceRoot, tsConfigPath));
|
|
54
55
|
}
|
|
55
56
|
return buildServerApp(options, context);
|
|
56
57
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import type { ApplicationExecutorOptions } from './schema';
|
|
3
|
+
export default function applicationExecutor(options: ApplicationExecutorOptions, context: ExecutorContext): AsyncGenerator<import("@angular-devkit/core").JsonObject & import("@angular-devkit/architect/src/output-schema").Schema & {
|
|
4
|
+
outputFiles?: import("@angular-devkit/build-angular/src/tools/esbuild/bundler-context").BuildOutputFile[];
|
|
5
|
+
assetFiles?: {
|
|
6
|
+
source: string;
|
|
7
|
+
destination: string;
|
|
8
|
+
}[];
|
|
9
|
+
}, any, undefined>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
4
|
+
const angular_version_utils_1 = require("../utilities/angular-version-utils");
|
|
5
|
+
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
6
|
+
const esbuild_extensions_1 = require("../utilities/esbuild-extensions");
|
|
7
|
+
async function* applicationExecutor(options, context) {
|
|
8
|
+
const { major: angularMajorVersion, version: angularVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
|
|
9
|
+
if (angularMajorVersion < 17) {
|
|
10
|
+
throw new Error(`The "application" executor requires Angular version 17 or greater. You are currently using version ${angularVersion}.`);
|
|
11
|
+
}
|
|
12
|
+
const { buildLibsFromSource = true, plugins: pluginPaths, ...delegateExecutorOptions } = options;
|
|
13
|
+
let dependencies;
|
|
14
|
+
if (!buildLibsFromSource) {
|
|
15
|
+
const { tsConfigPath, dependencies: foundDependencies } = (0, buildable_libs_1.createTmpTsConfigForBuildableLibs)(delegateExecutorOptions.tsConfig, context);
|
|
16
|
+
dependencies = foundDependencies;
|
|
17
|
+
delegateExecutorOptions.tsConfig = tsConfigPath;
|
|
18
|
+
}
|
|
19
|
+
const plugins = await (0, esbuild_extensions_1.loadPlugins)(pluginPaths, options.tsConfig);
|
|
20
|
+
const { buildApplication } = await Promise.resolve().then(() => require('@angular-devkit/build-angular'));
|
|
21
|
+
const builderContext = await (0, ngcli_adapter_1.createBuilderContext)({
|
|
22
|
+
builderName: 'application',
|
|
23
|
+
description: 'Build an application.',
|
|
24
|
+
optionSchema: await Promise.resolve().then(() => require('./schema.json')),
|
|
25
|
+
}, context);
|
|
26
|
+
return yield* buildApplication(delegateExecutorOptions, builderContext, plugins);
|
|
27
|
+
}
|
|
28
|
+
exports.default = applicationExecutor;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApplicationBuilderOptions } from '@angular-devkit/build-angular';
|
|
2
|
+
import type { PluginSpec } from '../utilities/esbuild-extensions';
|
|
3
|
+
|
|
4
|
+
export interface ApplicationExecutorOptions extends ApplicationBuilderOptions {
|
|
5
|
+
buildLibsFromSource?: boolean;
|
|
6
|
+
plugins?: string[] | PluginSpec[];
|
|
7
|
+
}
|
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"title": "Schema for Nx Application Executor",
|
|
4
|
+
"description": "Builds an application with esbuild with support for incremental builds. _Note: this is only supported in Angular versions >= 17.0.0_.",
|
|
5
|
+
"examplesFile": "../../../docs/application-executor-examples.md",
|
|
6
|
+
"outputCapture": "direct-nodejs",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"assets": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"description": "List of static application assets.",
|
|
12
|
+
"default": [],
|
|
13
|
+
"items": {
|
|
14
|
+
"$ref": "#/definitions/assetPattern"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"browser": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The full path for the browser entry point to the application, relative to the current workspace."
|
|
20
|
+
},
|
|
21
|
+
"server": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The full path for the server entry point to the application, relative to the current workspace."
|
|
24
|
+
},
|
|
25
|
+
"polyfills": {
|
|
26
|
+
"description": "A list of polyfills to include in the build. Can be a full path for a file, relative to the current workspace or module specifier. Example: 'zone.js'.",
|
|
27
|
+
"type": "array",
|
|
28
|
+
"items": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"uniqueItems": true
|
|
31
|
+
},
|
|
32
|
+
"default": []
|
|
33
|
+
},
|
|
34
|
+
"tsConfig": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"description": "Global scripts to be included in the build.",
|
|
40
|
+
"type": "array",
|
|
41
|
+
"default": [],
|
|
42
|
+
"items": {
|
|
43
|
+
"oneOf": [
|
|
44
|
+
{
|
|
45
|
+
"type": "object",
|
|
46
|
+
"properties": {
|
|
47
|
+
"input": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"description": "The file to include.",
|
|
50
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
51
|
+
},
|
|
52
|
+
"bundleName": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"pattern": "^[\\w\\-.]*$",
|
|
55
|
+
"description": "The bundle name for this extra entry point."
|
|
56
|
+
},
|
|
57
|
+
"inject": {
|
|
58
|
+
"type": "boolean",
|
|
59
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
60
|
+
"default": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"additionalProperties": false,
|
|
64
|
+
"required": ["input"]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "The JavaScript/TypeScript file or package containing the file to include."
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"styles": {
|
|
74
|
+
"description": "Global styles to be included in the build.",
|
|
75
|
+
"type": "array",
|
|
76
|
+
"default": [],
|
|
77
|
+
"items": {
|
|
78
|
+
"oneOf": [
|
|
79
|
+
{
|
|
80
|
+
"type": "object",
|
|
81
|
+
"properties": {
|
|
82
|
+
"input": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"description": "The file to include.",
|
|
85
|
+
"pattern": "\\.(?:css|scss|sass|less)$"
|
|
86
|
+
},
|
|
87
|
+
"bundleName": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"pattern": "^[\\w\\-.]*$",
|
|
90
|
+
"description": "The bundle name for this extra entry point."
|
|
91
|
+
},
|
|
92
|
+
"inject": {
|
|
93
|
+
"type": "boolean",
|
|
94
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
95
|
+
"default": true
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"additionalProperties": false,
|
|
99
|
+
"required": ["input"]
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"type": "string",
|
|
103
|
+
"description": "The file to include.",
|
|
104
|
+
"pattern": "\\.(?:css|scss|sass|less)$"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"inlineStyleLanguage": {
|
|
110
|
+
"description": "The stylesheet language to use for the application's inline component styles.",
|
|
111
|
+
"type": "string",
|
|
112
|
+
"default": "css",
|
|
113
|
+
"enum": ["css", "less", "sass", "scss"]
|
|
114
|
+
},
|
|
115
|
+
"stylePreprocessorOptions": {
|
|
116
|
+
"description": "Options to pass to style preprocessors.",
|
|
117
|
+
"type": "object",
|
|
118
|
+
"properties": {
|
|
119
|
+
"includePaths": {
|
|
120
|
+
"description": "Paths to include. Paths will be resolved to workspace root.",
|
|
121
|
+
"type": "array",
|
|
122
|
+
"items": {
|
|
123
|
+
"type": "string"
|
|
124
|
+
},
|
|
125
|
+
"default": []
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"additionalProperties": false
|
|
129
|
+
},
|
|
130
|
+
"externalDependencies": {
|
|
131
|
+
"description": "Exclude the listed external dependencies from being bundled into the bundle. Instead, the created bundle relies on these dependencies to be available during runtime.",
|
|
132
|
+
"type": "array",
|
|
133
|
+
"items": {
|
|
134
|
+
"type": "string"
|
|
135
|
+
},
|
|
136
|
+
"default": []
|
|
137
|
+
},
|
|
138
|
+
"optimization": {
|
|
139
|
+
"description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.",
|
|
140
|
+
"default": true,
|
|
141
|
+
"x-user-analytics": "ep.ng_optimization",
|
|
142
|
+
"oneOf": [
|
|
143
|
+
{
|
|
144
|
+
"type": "object",
|
|
145
|
+
"properties": {
|
|
146
|
+
"scripts": {
|
|
147
|
+
"type": "boolean",
|
|
148
|
+
"description": "Enables optimization of the scripts output.",
|
|
149
|
+
"default": true
|
|
150
|
+
},
|
|
151
|
+
"styles": {
|
|
152
|
+
"description": "Enables optimization of the styles output.",
|
|
153
|
+
"default": true,
|
|
154
|
+
"oneOf": [
|
|
155
|
+
{
|
|
156
|
+
"type": "object",
|
|
157
|
+
"properties": {
|
|
158
|
+
"minify": {
|
|
159
|
+
"type": "boolean",
|
|
160
|
+
"description": "Minify CSS definitions by removing extraneous whitespace and comments, merging identifiers and minimizing values.",
|
|
161
|
+
"default": true
|
|
162
|
+
},
|
|
163
|
+
"inlineCritical": {
|
|
164
|
+
"type": "boolean",
|
|
165
|
+
"description": "Extract and inline critical CSS definitions to improve first paint time.",
|
|
166
|
+
"default": true
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"additionalProperties": false
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"type": "boolean"
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
"fonts": {
|
|
177
|
+
"description": "Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY` environment variable can be used to specify a proxy server.",
|
|
178
|
+
"default": true,
|
|
179
|
+
"oneOf": [
|
|
180
|
+
{
|
|
181
|
+
"type": "object",
|
|
182
|
+
"properties": {
|
|
183
|
+
"inline": {
|
|
184
|
+
"type": "boolean",
|
|
185
|
+
"description": "Reduce render blocking requests by inlining external Google Fonts and Adobe Fonts CSS definitions in the application's HTML index file. This option requires internet access. `HTTPS_PROXY` environment variable can be used to specify a proxy server.",
|
|
186
|
+
"default": true
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"additionalProperties": false
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"type": "boolean"
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"additionalProperties": false
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"type": "boolean"
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"fileReplacements": {
|
|
205
|
+
"description": "Replace compilation source files with other compilation source files in the build.",
|
|
206
|
+
"type": "array",
|
|
207
|
+
"items": {
|
|
208
|
+
"$ref": "#/definitions/fileReplacement"
|
|
209
|
+
},
|
|
210
|
+
"default": []
|
|
211
|
+
},
|
|
212
|
+
"outputPath": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"description": "The full path for the new output directory, relative to the current workspace."
|
|
215
|
+
},
|
|
216
|
+
"aot": {
|
|
217
|
+
"type": "boolean",
|
|
218
|
+
"description": "Build using Ahead of Time compilation.",
|
|
219
|
+
"x-user-analytics": "ep.ng_aot",
|
|
220
|
+
"default": true
|
|
221
|
+
},
|
|
222
|
+
"sourceMap": {
|
|
223
|
+
"description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
|
|
224
|
+
"default": false,
|
|
225
|
+
"oneOf": [
|
|
226
|
+
{
|
|
227
|
+
"type": "object",
|
|
228
|
+
"properties": {
|
|
229
|
+
"scripts": {
|
|
230
|
+
"type": "boolean",
|
|
231
|
+
"description": "Output source maps for all scripts.",
|
|
232
|
+
"default": true
|
|
233
|
+
},
|
|
234
|
+
"styles": {
|
|
235
|
+
"type": "boolean",
|
|
236
|
+
"description": "Output source maps for all styles.",
|
|
237
|
+
"default": true
|
|
238
|
+
},
|
|
239
|
+
"hidden": {
|
|
240
|
+
"type": "boolean",
|
|
241
|
+
"description": "Output source maps used for error reporting tools.",
|
|
242
|
+
"default": false
|
|
243
|
+
},
|
|
244
|
+
"vendor": {
|
|
245
|
+
"type": "boolean",
|
|
246
|
+
"description": "Resolve vendor packages source maps.",
|
|
247
|
+
"default": false
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"additionalProperties": false
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"type": "boolean"
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
"baseHref": {
|
|
258
|
+
"type": "string",
|
|
259
|
+
"description": "Base url for the application being built."
|
|
260
|
+
},
|
|
261
|
+
"verbose": {
|
|
262
|
+
"type": "boolean",
|
|
263
|
+
"description": "Adds more details to output logging.",
|
|
264
|
+
"default": false
|
|
265
|
+
},
|
|
266
|
+
"progress": {
|
|
267
|
+
"type": "boolean",
|
|
268
|
+
"description": "Log progress to the console while building.",
|
|
269
|
+
"default": true
|
|
270
|
+
},
|
|
271
|
+
"i18nMissingTranslation": {
|
|
272
|
+
"type": "string",
|
|
273
|
+
"description": "How to handle missing translations for i18n.",
|
|
274
|
+
"enum": ["warning", "error", "ignore"],
|
|
275
|
+
"default": "warning"
|
|
276
|
+
},
|
|
277
|
+
"i18nDuplicateTranslation": {
|
|
278
|
+
"type": "string",
|
|
279
|
+
"description": "How to handle duplicate translations for i18n.",
|
|
280
|
+
"enum": ["warning", "error", "ignore"],
|
|
281
|
+
"default": "warning"
|
|
282
|
+
},
|
|
283
|
+
"localize": {
|
|
284
|
+
"description": "Translate the bundles in one or more locales.",
|
|
285
|
+
"oneOf": [
|
|
286
|
+
{
|
|
287
|
+
"type": "boolean",
|
|
288
|
+
"description": "Translate all locales."
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"type": "array",
|
|
292
|
+
"description": "List of locales ID's to translate.",
|
|
293
|
+
"minItems": 1,
|
|
294
|
+
"items": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{4})?(-([a-zA-Z]{2}|[0-9]{3}))?(-[a-zA-Z]{5,8})?(-x(-[a-zA-Z0-9]{1,8})+)?$"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
"watch": {
|
|
302
|
+
"type": "boolean",
|
|
303
|
+
"description": "Run build when files change.",
|
|
304
|
+
"default": false
|
|
305
|
+
},
|
|
306
|
+
"outputHashing": {
|
|
307
|
+
"type": "string",
|
|
308
|
+
"description": "Define the output filename cache-busting hashing mode.",
|
|
309
|
+
"default": "none",
|
|
310
|
+
"enum": ["none", "all", "media", "bundles"]
|
|
311
|
+
},
|
|
312
|
+
"poll": {
|
|
313
|
+
"type": "number",
|
|
314
|
+
"description": "Enable and define the file watching poll time period in milliseconds."
|
|
315
|
+
},
|
|
316
|
+
"deleteOutputPath": {
|
|
317
|
+
"type": "boolean",
|
|
318
|
+
"description": "Delete the output path before building.",
|
|
319
|
+
"default": true
|
|
320
|
+
},
|
|
321
|
+
"preserveSymlinks": {
|
|
322
|
+
"type": "boolean",
|
|
323
|
+
"description": "Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set."
|
|
324
|
+
},
|
|
325
|
+
"extractLicenses": {
|
|
326
|
+
"type": "boolean",
|
|
327
|
+
"description": "Extract all licenses in a separate file.",
|
|
328
|
+
"default": true
|
|
329
|
+
},
|
|
330
|
+
"namedChunks": {
|
|
331
|
+
"type": "boolean",
|
|
332
|
+
"description": "Use file name for lazy loaded chunks.",
|
|
333
|
+
"default": false
|
|
334
|
+
},
|
|
335
|
+
"subresourceIntegrity": {
|
|
336
|
+
"type": "boolean",
|
|
337
|
+
"description": "Enables the use of subresource integrity validation.",
|
|
338
|
+
"default": false
|
|
339
|
+
},
|
|
340
|
+
"serviceWorker": {
|
|
341
|
+
"description": "Generates a service worker configuration.",
|
|
342
|
+
"default": false,
|
|
343
|
+
"oneOf": [
|
|
344
|
+
{
|
|
345
|
+
"type": "string",
|
|
346
|
+
"description": "Path to ngsw-config.json."
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"const": false,
|
|
350
|
+
"type": "boolean",
|
|
351
|
+
"description": "Does not generate a service worker configuration."
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
"index": {
|
|
356
|
+
"description": "Configures the generation of the application's HTML index.",
|
|
357
|
+
"oneOf": [
|
|
358
|
+
{
|
|
359
|
+
"type": "string",
|
|
360
|
+
"description": "The path of a file to use for the application's HTML index. The filename of the specified path will be used for the generated file and will be created in the root of the application's configured output path."
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"type": "object",
|
|
364
|
+
"description": "",
|
|
365
|
+
"properties": {
|
|
366
|
+
"input": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"minLength": 1,
|
|
369
|
+
"description": "The path of a file to use for the application's generated HTML index."
|
|
370
|
+
},
|
|
371
|
+
"output": {
|
|
372
|
+
"type": "string",
|
|
373
|
+
"minLength": 1,
|
|
374
|
+
"default": "index.html",
|
|
375
|
+
"description": "The output path of the application's generated HTML index file. The full provided path will be used and will be considered relative to the application's configured output path."
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
"required": ["input"]
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"const": false,
|
|
382
|
+
"type": "boolean",
|
|
383
|
+
"description": "Does not generate an `index.html` file."
|
|
384
|
+
}
|
|
385
|
+
]
|
|
386
|
+
},
|
|
387
|
+
"statsJson": {
|
|
388
|
+
"type": "boolean",
|
|
389
|
+
"description": "Generates a 'stats.json' file which can be analyzed with https://esbuild.github.io/analyze/.",
|
|
390
|
+
"default": false
|
|
391
|
+
},
|
|
392
|
+
"budgets": {
|
|
393
|
+
"description": "Budget thresholds to ensure parts of your application stay within boundaries which you set.",
|
|
394
|
+
"type": "array",
|
|
395
|
+
"items": {
|
|
396
|
+
"$ref": "#/definitions/budget"
|
|
397
|
+
},
|
|
398
|
+
"default": []
|
|
399
|
+
},
|
|
400
|
+
"webWorkerTsConfig": {
|
|
401
|
+
"type": "string",
|
|
402
|
+
"description": "TypeScript configuration for Web Worker modules."
|
|
403
|
+
},
|
|
404
|
+
"crossOrigin": {
|
|
405
|
+
"type": "string",
|
|
406
|
+
"description": "Define the crossorigin attribute setting of elements that provide CORS support.",
|
|
407
|
+
"default": "none",
|
|
408
|
+
"enum": ["none", "anonymous", "use-credentials"]
|
|
409
|
+
},
|
|
410
|
+
"allowedCommonJsDependencies": {
|
|
411
|
+
"description": "A list of CommonJS or AMD packages that are allowed to be used without a build time warning. Use `'*'` to allow all.",
|
|
412
|
+
"type": "array",
|
|
413
|
+
"items": {
|
|
414
|
+
"type": "string"
|
|
415
|
+
},
|
|
416
|
+
"default": []
|
|
417
|
+
},
|
|
418
|
+
"prerender": {
|
|
419
|
+
"description": "Prerender (SSG) pages of your application during build time.",
|
|
420
|
+
"default": false,
|
|
421
|
+
"oneOf": [
|
|
422
|
+
{
|
|
423
|
+
"type": "boolean",
|
|
424
|
+
"description": "Enable prerending of pages of your application during build time."
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"type": "object",
|
|
428
|
+
"properties": {
|
|
429
|
+
"routesFile": {
|
|
430
|
+
"type": "string",
|
|
431
|
+
"description": "The path to a file that contains a list of all routes to prerender, separated by newlines. This option is useful if you want to prerender routes with parameterized URLs."
|
|
432
|
+
},
|
|
433
|
+
"discoverRoutes": {
|
|
434
|
+
"type": "boolean",
|
|
435
|
+
"description": "Whether the builder should process the Angular Router configuration to find all unparameterized routes and prerender them.",
|
|
436
|
+
"default": true
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
"additionalProperties": false
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
},
|
|
443
|
+
"ssr": {
|
|
444
|
+
"description": "Server side render (SSR) pages of your application during runtime.",
|
|
445
|
+
"default": false,
|
|
446
|
+
"oneOf": [
|
|
447
|
+
{
|
|
448
|
+
"type": "boolean",
|
|
449
|
+
"description": "Enable the server bundles to be written to disk."
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"type": "object",
|
|
453
|
+
"properties": {
|
|
454
|
+
"entry": {
|
|
455
|
+
"type": "string",
|
|
456
|
+
"description": "The server entry-point that when executed will spawn the web server."
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
"additionalProperties": false
|
|
460
|
+
}
|
|
461
|
+
]
|
|
462
|
+
},
|
|
463
|
+
"appShell": {
|
|
464
|
+
"type": "boolean",
|
|
465
|
+
"description": "Generates an application shell during build time.",
|
|
466
|
+
"default": false
|
|
467
|
+
},
|
|
468
|
+
"buildLibsFromSource": {
|
|
469
|
+
"type": "boolean",
|
|
470
|
+
"description": "Read buildable libraries from source instead of building them separately.",
|
|
471
|
+
"default": true
|
|
472
|
+
},
|
|
473
|
+
"plugins": {
|
|
474
|
+
"description": "A list of ESBuild plugins.",
|
|
475
|
+
"type": "array",
|
|
476
|
+
"items": {
|
|
477
|
+
"oneOf": [
|
|
478
|
+
{
|
|
479
|
+
"type": "object",
|
|
480
|
+
"properties": {
|
|
481
|
+
"path": {
|
|
482
|
+
"type": "string",
|
|
483
|
+
"description": "The path to the plugin. Relative to the workspace root."
|
|
484
|
+
},
|
|
485
|
+
"options": {
|
|
486
|
+
"type": "object",
|
|
487
|
+
"description": "The options to provide to the plugin.",
|
|
488
|
+
"properties": {},
|
|
489
|
+
"additionalProperties": true
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
"additionalProperties": false,
|
|
493
|
+
"required": ["path"]
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
"type": "string",
|
|
497
|
+
"description": "The path to the plugin. Relative to the workspace root."
|
|
498
|
+
}
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
"additionalProperties": false,
|
|
504
|
+
"required": ["outputPath", "index", "browser", "tsConfig"],
|
|
505
|
+
"definitions": {
|
|
506
|
+
"assetPattern": {
|
|
507
|
+
"oneOf": [
|
|
508
|
+
{
|
|
509
|
+
"type": "object",
|
|
510
|
+
"properties": {
|
|
511
|
+
"followSymlinks": {
|
|
512
|
+
"type": "boolean",
|
|
513
|
+
"default": false,
|
|
514
|
+
"description": "Allow glob patterns to follow symlink directories. This allows subdirectories of the symlink to be searched."
|
|
515
|
+
},
|
|
516
|
+
"glob": {
|
|
517
|
+
"type": "string",
|
|
518
|
+
"description": "The pattern to match."
|
|
519
|
+
},
|
|
520
|
+
"input": {
|
|
521
|
+
"type": "string",
|
|
522
|
+
"description": "The input directory path in which to apply 'glob'. Defaults to the project root."
|
|
523
|
+
},
|
|
524
|
+
"ignore": {
|
|
525
|
+
"description": "An array of globs to ignore.",
|
|
526
|
+
"type": "array",
|
|
527
|
+
"items": {
|
|
528
|
+
"type": "string"
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
"output": {
|
|
532
|
+
"type": "string",
|
|
533
|
+
"description": "Absolute path within the output."
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
"additionalProperties": false,
|
|
537
|
+
"required": ["glob", "input", "output"]
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"type": "string"
|
|
541
|
+
}
|
|
542
|
+
]
|
|
543
|
+
},
|
|
544
|
+
"fileReplacement": {
|
|
545
|
+
"type": "object",
|
|
546
|
+
"properties": {
|
|
547
|
+
"replace": {
|
|
548
|
+
"type": "string",
|
|
549
|
+
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
|
550
|
+
},
|
|
551
|
+
"with": {
|
|
552
|
+
"type": "string",
|
|
553
|
+
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
"additionalProperties": false,
|
|
557
|
+
"required": ["replace", "with"]
|
|
558
|
+
},
|
|
559
|
+
"budget": {
|
|
560
|
+
"type": "object",
|
|
561
|
+
"properties": {
|
|
562
|
+
"type": {
|
|
563
|
+
"type": "string",
|
|
564
|
+
"description": "The type of budget.",
|
|
565
|
+
"enum": [
|
|
566
|
+
"all",
|
|
567
|
+
"allScript",
|
|
568
|
+
"any",
|
|
569
|
+
"anyScript",
|
|
570
|
+
"anyComponentStyle",
|
|
571
|
+
"bundle",
|
|
572
|
+
"initial"
|
|
573
|
+
]
|
|
574
|
+
},
|
|
575
|
+
"name": {
|
|
576
|
+
"type": "string",
|
|
577
|
+
"description": "The name of the bundle."
|
|
578
|
+
},
|
|
579
|
+
"baseline": {
|
|
580
|
+
"type": "string",
|
|
581
|
+
"description": "The baseline size for comparison."
|
|
582
|
+
},
|
|
583
|
+
"maximumWarning": {
|
|
584
|
+
"type": "string",
|
|
585
|
+
"description": "The maximum threshold for warning relative to the baseline."
|
|
586
|
+
},
|
|
587
|
+
"maximumError": {
|
|
588
|
+
"type": "string",
|
|
589
|
+
"description": "The maximum threshold for error relative to the baseline."
|
|
590
|
+
},
|
|
591
|
+
"minimumWarning": {
|
|
592
|
+
"type": "string",
|
|
593
|
+
"description": "The minimum threshold for warning relative to the baseline."
|
|
594
|
+
},
|
|
595
|
+
"minimumError": {
|
|
596
|
+
"type": "string",
|
|
597
|
+
"description": "The minimum threshold for error relative to the baseline."
|
|
598
|
+
},
|
|
599
|
+
"warning": {
|
|
600
|
+
"type": "string",
|
|
601
|
+
"description": "The threshold for warning relative to the baseline (min & max)."
|
|
602
|
+
},
|
|
603
|
+
"error": {
|
|
604
|
+
"type": "string",
|
|
605
|
+
"description": "The threshold for error relative to the baseline (min & max)."
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
"additionalProperties": false,
|
|
609
|
+
"required": ["type"]
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { type EsBuildSchema } from './schema';
|
|
2
1
|
import { type ExecutorContext } from '@nx/devkit';
|
|
3
|
-
import {
|
|
2
|
+
import type { EsBuildSchema } from './schema';
|
|
4
3
|
export default function esbuildExecutor(options: EsBuildSchema, context: ExecutorContext): AsyncGenerator<import("@angular-devkit/core").JsonObject & import("@angular-devkit/architect/src/output-schema").Schema & {
|
|
5
|
-
outputFiles?:
|
|
4
|
+
outputFiles?: import("@angular-devkit/build-angular/src/tools/esbuild/bundler-context").BuildOutputFile[];
|
|
6
5
|
assetFiles?: {
|
|
7
6
|
source: string;
|
|
8
7
|
destination: string;
|
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
const buildable_libs_1 = require("./lib/buildable-libs");
|
|
5
4
|
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
5
|
+
const angular_version_utils_1 = require("../utilities/angular-version-utils");
|
|
6
|
+
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
7
|
+
const esbuild_extensions_1 = require("../utilities/esbuild-extensions");
|
|
6
8
|
async function* esbuildExecutor(options, context) {
|
|
9
|
+
if (options.plugins) {
|
|
10
|
+
const { major: angularMajorVersion, version: angularVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
|
|
11
|
+
if (angularMajorVersion < 17) {
|
|
12
|
+
throw new Error((0, devkit_1.stripIndents) `The "plugins" option is only supported in Angular >= 17.0.0. You are currently using "${angularVersion}".
|
|
13
|
+
You can resolve this error by removing the "plugins" option or by migrating to Angular 17.0.0.`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
7
16
|
options.buildLibsFromSource ??= true;
|
|
8
|
-
const { buildLibsFromSource, ...delegateExecutorOptions } = options;
|
|
17
|
+
const { buildLibsFromSource, plugins: pluginPaths, ...delegateExecutorOptions } = options;
|
|
9
18
|
let dependencies;
|
|
10
|
-
let projectGraph = context.projectGraph;
|
|
11
19
|
if (!buildLibsFromSource) {
|
|
12
|
-
|
|
13
|
-
const { tsConfigPath, dependencies: foundDependencies } = (0, buildable_libs_1.createTmpTsConfigForBuildableLibs)(delegateExecutorOptions.tsConfig, context, { projectGraph });
|
|
20
|
+
const { tsConfigPath, dependencies: foundDependencies } = (0, buildable_libs_1.createTmpTsConfigForBuildableLibs)(delegateExecutorOptions.tsConfig, context);
|
|
14
21
|
dependencies = foundDependencies;
|
|
15
22
|
delegateExecutorOptions.tsConfig = tsConfigPath;
|
|
16
23
|
}
|
|
24
|
+
const plugins = await (0, esbuild_extensions_1.loadPlugins)(pluginPaths, options.tsConfig);
|
|
17
25
|
const { buildEsbuildBrowser } = await Promise.resolve().then(() => require('@angular-devkit/build-angular/src/builders/browser-esbuild/index'));
|
|
18
26
|
const builderContext = await (0, ngcli_adapter_1.createBuilderContext)({
|
|
19
27
|
builderName: 'browser-esbuild',
|
|
20
28
|
description: 'Build a browser application',
|
|
21
29
|
optionSchema: await Promise.resolve().then(() => require('@angular-devkit/build-angular/src/builders/browser-esbuild/schema.json')),
|
|
22
30
|
}, context);
|
|
23
|
-
return yield* buildEsbuildBrowser(delegateExecutorOptions, builderContext
|
|
31
|
+
return yield* buildEsbuildBrowser(delegateExecutorOptions, builderContext,
|
|
32
|
+
/* infrastructureSettings */ undefined, plugins);
|
|
24
33
|
}
|
|
25
34
|
exports.default = esbuildExecutor;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Schema } from '@angular-devkit/build-angular/src/builders/browser-esbuild/schema';
|
|
1
|
+
import type { Schema } from '@angular-devkit/build-angular/src/builders/browser-esbuild/schema';
|
|
2
|
+
import type { PluginSpec } from '../utilities/esbuild-extensions';
|
|
2
3
|
|
|
3
4
|
export interface EsBuildSchema extends Schema {
|
|
4
5
|
buildLibsFromSource?: boolean;
|
|
6
|
+
plugins?: string[] | PluginSpec[];
|
|
5
7
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"title": "Schema for Nx ESBuild Executor",
|
|
4
4
|
"description": "Nx ESBuild Executor supporting Incremental Builds.",
|
|
5
|
+
"examplesFile": "../../../docs/browser-esbuild-examples.md",
|
|
5
6
|
"outputCapture": "direct-nodejs",
|
|
6
7
|
"type": "object",
|
|
7
8
|
"properties": {
|
|
@@ -441,6 +442,35 @@
|
|
|
441
442
|
"type": "boolean",
|
|
442
443
|
"description": "Read buildable libraries from source instead of building them separately.",
|
|
443
444
|
"default": true
|
|
445
|
+
},
|
|
446
|
+
"plugins": {
|
|
447
|
+
"description": "A list of ESBuild plugins. _Note: this is only supported in Angular versions >= 17.0.0_.",
|
|
448
|
+
"type": "array",
|
|
449
|
+
"items": {
|
|
450
|
+
"oneOf": [
|
|
451
|
+
{
|
|
452
|
+
"type": "object",
|
|
453
|
+
"properties": {
|
|
454
|
+
"path": {
|
|
455
|
+
"type": "string",
|
|
456
|
+
"description": "The path to the plugin. Relative to the workspace root."
|
|
457
|
+
},
|
|
458
|
+
"options": {
|
|
459
|
+
"type": "object",
|
|
460
|
+
"description": "The options to provide to the plugin.",
|
|
461
|
+
"properties": {},
|
|
462
|
+
"additionalProperties": true
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
"additionalProperties": false,
|
|
466
|
+
"required": ["path"]
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"type": "string",
|
|
470
|
+
"description": "The path to the plugin. Relative to the workspace root."
|
|
471
|
+
}
|
|
472
|
+
]
|
|
473
|
+
}
|
|
444
474
|
}
|
|
445
475
|
},
|
|
446
476
|
"additionalProperties": false,
|
|
@@ -62,6 +62,9 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
|
62
62
|
if (remotePort >= portToUse) {
|
|
63
63
|
return remotePort + 1;
|
|
64
64
|
}
|
|
65
|
+
else {
|
|
66
|
+
return portToUse;
|
|
67
|
+
}
|
|
65
68
|
}, options.staticRemotesPort);
|
|
66
69
|
}
|
|
67
70
|
await (0, lib_1.buildStaticRemotes)(remotes, nxBin, context, options);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { type DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
|
|
3
|
+
export declare function createTmpTsConfigForBuildableLibs(tsConfigPath: string, context: ExecutorContext): {
|
|
4
|
+
tsConfigPath: string;
|
|
5
|
+
dependencies: DependentBuildableProjectNode[];
|
|
6
|
+
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createTmpTsConfigForBuildableLibs = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
5
6
|
const path_1 = require("path");
|
|
6
|
-
|
|
7
|
-
function createTmpTsConfigForBuildableLibs(tsConfigPath, context, options) {
|
|
7
|
+
function createTmpTsConfigForBuildableLibs(tsConfigPath, context) {
|
|
8
8
|
let dependencies;
|
|
9
|
-
const result = (0, buildable_libs_utils_1.calculateProjectDependencies)(
|
|
9
|
+
const result = (0, buildable_libs_utils_1.calculateProjectDependencies)(context.projectGraph ?? (0, devkit_1.readCachedProjectGraph)(), context.root, context.projectName, context.targetName, context.configurationName);
|
|
10
10
|
dependencies = result.dependencies;
|
|
11
11
|
const tmpTsConfigPath = (0, buildable_libs_utils_1.createTmpTsConfig)((0, path_1.join)(context.root, tsConfigPath), context.root, result.target.data.root, dependencies);
|
|
12
12
|
process.env.NX_TSCONFIG_PATH = tmpTsConfigPath;
|
|
13
|
-
// Angular EsBuild Builder appends the workspaceRoot to the config path, so remove it.
|
|
14
13
|
const tmpTsConfigPathWithoutWorkspaceRoot = tmpTsConfigPath.replace(context.root, '');
|
|
15
14
|
return { tsConfigPath: tmpTsConfigPathWithoutWorkspaceRoot, dependencies };
|
|
16
15
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadPlugins = void 0;
|
|
4
|
+
const internal_1 = require("@nx/js/src/internal");
|
|
5
|
+
const module_loader_1 = require("./module-loader");
|
|
6
|
+
async function loadPlugins(plugins, tsConfig) {
|
|
7
|
+
if (!plugins?.length) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
const cleanupTranspiler = (0, internal_1.registerTsProject)(tsConfig);
|
|
11
|
+
try {
|
|
12
|
+
return await Promise.all(plugins.map((plugin) => loadPlugin(plugin)));
|
|
13
|
+
}
|
|
14
|
+
finally {
|
|
15
|
+
cleanupTranspiler();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.loadPlugins = loadPlugins;
|
|
19
|
+
async function loadPlugin(pluginSpec) {
|
|
20
|
+
const pluginPath = typeof pluginSpec === 'string' ? pluginSpec : pluginSpec.path;
|
|
21
|
+
let plugin = await (0, module_loader_1.loadModule)(pluginPath);
|
|
22
|
+
if (typeof plugin === 'function') {
|
|
23
|
+
plugin =
|
|
24
|
+
typeof pluginSpec === 'object' ? plugin(pluginSpec.options) : plugin();
|
|
25
|
+
}
|
|
26
|
+
return plugin;
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare function loadModule<T = any>(path: string): Promise<T>;
|
|
3
|
+
/**
|
|
4
|
+
* This uses a dynamic import to load a module which may be ESM.
|
|
5
|
+
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
6
|
+
* will currently, unconditionally downlevel dynamic import into a require call.
|
|
7
|
+
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
|
8
|
+
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
|
9
|
+
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
|
10
|
+
* be dropped.
|
|
11
|
+
*
|
|
12
|
+
* @param modulePath The path of the module to load.
|
|
13
|
+
* @returns A Promise that resolves to the dynamically imported module.
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadEsmModule = exports.loadModule = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const node_url_1 = require("node:url");
|
|
6
|
+
async function loadModule(path) {
|
|
7
|
+
switch ((0, path_1.extname)(path)) {
|
|
8
|
+
case '.mjs': {
|
|
9
|
+
const result = await loadEsmModule((0, node_url_1.pathToFileURL)(path));
|
|
10
|
+
return result.default ?? result;
|
|
11
|
+
}
|
|
12
|
+
case '.cjs': {
|
|
13
|
+
const result = require(path);
|
|
14
|
+
return result.default ?? result;
|
|
15
|
+
}
|
|
16
|
+
default:
|
|
17
|
+
// it can be CommonJS or ESM, try both
|
|
18
|
+
try {
|
|
19
|
+
const result = require(path);
|
|
20
|
+
return result.default ?? result;
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
if (e.code === 'ERR_REQUIRE_ESM') {
|
|
24
|
+
const result = await loadEsmModule((0, node_url_1.pathToFileURL)(path));
|
|
25
|
+
return result.default ?? result;
|
|
26
|
+
}
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.loadModule = loadModule;
|
|
32
|
+
/**
|
|
33
|
+
* Lazily compiled dynamic import loader function.
|
|
34
|
+
*/
|
|
35
|
+
let load;
|
|
36
|
+
/**
|
|
37
|
+
* This uses a dynamic import to load a module which may be ESM.
|
|
38
|
+
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
39
|
+
* will currently, unconditionally downlevel dynamic import into a require call.
|
|
40
|
+
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
|
41
|
+
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
|
42
|
+
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
|
43
|
+
* be dropped.
|
|
44
|
+
*
|
|
45
|
+
* @param modulePath The path of the module to load.
|
|
46
|
+
* @returns A Promise that resolves to the dynamically imported module.
|
|
47
|
+
*/
|
|
48
|
+
function loadEsmModule(modulePath) {
|
|
49
|
+
load ??= new Function('modulePath', `return import(modulePath);`);
|
|
50
|
+
return load(modulePath);
|
|
51
|
+
}
|
|
52
|
+
exports.loadEsmModule = loadEsmModule;
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
export declare function ngCompilerCli(): Promise<typeof import('@angular/compiler-cli')>;
|
|
3
|
-
/**
|
|
4
|
-
* This uses a dynamic import to load a module which may be ESM.
|
|
5
|
-
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
6
|
-
* will currently, unconditionally downlevel dynamic import into a require call.
|
|
7
|
-
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
|
8
|
-
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
|
9
|
-
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
|
10
|
-
* be dropped.
|
|
11
|
-
*
|
|
12
|
-
* @param modulePath The path of the module to load.
|
|
13
|
-
* @returns A Promise that resolves to the dynamically imported module.
|
|
14
|
-
*/
|
|
15
|
-
export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
|
|
@@ -1,28 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ngCompilerCli = void 0;
|
|
4
|
+
const module_loader_1 = require("./module-loader");
|
|
4
5
|
function ngCompilerCli() {
|
|
5
|
-
return loadEsmModule('@angular/compiler-cli');
|
|
6
|
+
return (0, module_loader_1.loadEsmModule)('@angular/compiler-cli');
|
|
6
7
|
}
|
|
7
8
|
exports.ngCompilerCli = ngCompilerCli;
|
|
8
|
-
/**
|
|
9
|
-
* Lazily compiled dynamic import loader function.
|
|
10
|
-
*/
|
|
11
|
-
let load;
|
|
12
|
-
/**
|
|
13
|
-
* This uses a dynamic import to load a module which may be ESM.
|
|
14
|
-
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
15
|
-
* will currently, unconditionally downlevel dynamic import into a require call.
|
|
16
|
-
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
|
17
|
-
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
|
18
|
-
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
|
19
|
-
* be dropped.
|
|
20
|
-
*
|
|
21
|
-
* @param modulePath The path of the module to load.
|
|
22
|
-
* @returns A Promise that resolves to the dynamically imported module.
|
|
23
|
-
*/
|
|
24
|
-
function loadEsmModule(modulePath) {
|
|
25
|
-
load ??= new Function('modulePath', `return import(modulePath);`);
|
|
26
|
-
return load(modulePath);
|
|
27
|
-
}
|
|
28
|
-
exports.loadEsmModule = loadEsmModule;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
|
|
2
|
-
import { type ExecutorContext, type ProjectGraph } from '@nx/devkit';
|
|
3
|
-
export declare function createTmpTsConfigForBuildableLibs(tsConfigPath: string, context: ExecutorContext, options?: {
|
|
4
|
-
projectGraph?: ProjectGraph;
|
|
5
|
-
target?: string;
|
|
6
|
-
}): {
|
|
7
|
-
tsConfigPath: string;
|
|
8
|
-
dependencies: DependentBuildableProjectNode[];
|
|
9
|
-
};
|