@nx/angular 0.0.0-pr-22179-271588f → 0.0.0-pr-26482-ebe2dba
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/LICENSE +1 -1
- package/README.md +1 -1
- package/executors.d.ts +1 -1
- package/executors.json +9 -9
- package/migrations.json +209 -0
- package/package.json +18 -17
- package/plugins/component-testing.d.ts +2 -2
- package/plugins/component-testing.js +1 -1
- package/src/builders/dev-server/dev-server.impl.js +1 -1
- package/src/builders/dev-server/lib/validate-options.js +1 -1
- package/src/builders/dev-server/schema.json +3 -3
- package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +9 -6
- package/src/builders/module-federation-dev-ssr/schema.json +1 -1
- package/src/builders/utilities/module-federation.d.ts +7 -2
- package/src/builders/utilities/module-federation.js +20 -4
- package/src/builders/webpack-browser/schema.d.ts +2 -2
- package/src/builders/webpack-browser/schema.json +10 -10
- package/src/builders/webpack-browser/webpack-browser.impl.js +2 -8
- package/src/builders/webpack-server/schema.json +13 -13
- package/src/builders/webpack-server/webpack-server.impl.js +3 -5
- package/src/executors/application/application.impl.d.ts +2 -1
- package/src/executors/application/application.impl.js +2 -2
- package/src/executors/application/schema.json +11 -6
- package/src/executors/application/utils/validate-options.js +5 -0
- package/src/executors/browser-esbuild/browser-esbuild.impl.d.ts +2 -7
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +2 -2
- package/src/executors/browser-esbuild/schema.json +8 -8
- package/src/executors/extract-i18n/extract-i18n.impl.js +2 -2
- package/src/executors/module-federation-dev-server/lib/build-static-remotes.js +11 -3
- package/src/executors/module-federation-dev-server/lib/normalize-options.js +1 -0
- package/src/executors/module-federation-dev-server/lib/start-dev-remotes.d.ts +1 -5
- package/src/executors/module-federation-dev-server/lib/start-dev-remotes.js +16 -15
- package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.js +2 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +16 -8
- package/src/executors/module-federation-dev-server/schema.d.ts +4 -1
- package/src/executors/module-federation-dev-server/schema.json +22 -5
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.js +6 -6
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.transform.js +3 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.transform.js +2 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.js +3 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.d.ts +1 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.js +5 -4
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.js +12 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-package.transform.js +2 -1
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +1 -1
- package/src/executors/ng-packagr-lite/schema.json +1 -1
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +5 -4
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +3 -2
- package/src/executors/package/ng-packagr-adjustments/ng-packagr.js +4 -4
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.d.ts +1 -2
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +5 -4
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +12 -12
- package/src/executors/package/package.impl.js +1 -1
- package/src/executors/package/schema.json +1 -1
- package/src/executors/utilities/esbuild-extensions.d.ts +2 -4
- package/src/executors/utilities/module-loader.d.ts +1 -2
- package/src/executors/utilities/ng-packagr/stylesheet-processor.d.ts +22 -0
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.d.ts +1 -1
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +7 -1
- package/src/executors/utilities/ng-packagr/stylesheet-processor.js +100 -7
- package/src/executors/utilities/typescript.d.ts +1 -2
- package/src/executors/utilities/typescript.js +4 -3
- package/src/generators/add-linting/add-linting.d.ts +1 -1
- package/src/generators/add-linting/add-linting.js +7 -11
- package/src/generators/add-linting/lib/add-angular-eslint-dependencies.d.ts +2 -2
- package/src/generators/add-linting/lib/add-angular-eslint-dependencies.js +15 -6
- package/src/generators/add-linting/lib/buildable-project.d.ts +2 -0
- package/src/generators/add-linting/lib/buildable-project.js +9 -0
- package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
- package/src/generators/add-linting/schema.json +1 -1
- package/src/generators/application/application.js +4 -1
- package/src/generators/application/files/base-pre18/src/favicon.ico +0 -0
- package/src/generators/application/files/ng-module/src/main.ts__tpl__ +3 -1
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +2 -2
- package/src/generators/application/lib/add-e2e.js +9 -6
- package/src/generators/application/lib/add-linting.js +2 -1
- package/src/generators/application/lib/create-files.js +7 -0
- package/src/generators/application/lib/create-project.js +12 -5
- package/src/generators/application/lib/normalize-options.js +15 -1
- package/src/generators/application/lib/normalized-schema.d.ts +3 -0
- package/src/generators/application/schema.json +2 -2
- package/src/generators/component/schema.d.ts +3 -3
- package/src/generators/component/schema.json +2 -2
- package/src/generators/component-test/component-test.js +1 -1
- package/src/generators/convert-to-application-executor/convert-to-application-executor.js +6 -4
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -3
- package/src/generators/directive/schema.d.ts +3 -3
- package/src/generators/directive/schema.json +2 -2
- package/src/generators/federate-module/lib/add-remote.js +2 -1
- package/src/generators/host/host.js +14 -2
- package/src/generators/host/lib/update-ssr-setup.js +9 -7
- package/src/generators/host/schema.json +2 -2
- package/src/generators/library/files/base/package.json__tpl__ +0 -3
- package/src/generators/library/library.js +17 -8
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +3 -2
- package/src/generators/ng-add/migrators/migrator.d.ts +1 -1
- package/src/generators/ng-add/migrators/migrator.js +7 -7
- package/src/generators/ng-add/migrators/projects/app.migrator.js +2 -2
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +1 -1
- package/src/generators/ng-add/utilities/validation-logging.js +2 -1
- package/src/generators/ngrx-root-store/ngrx-root-store.js +2 -1
- package/src/generators/pipe/schema.d.ts +3 -3
- package/src/generators/pipe/schema.json +2 -2
- package/src/generators/remote/lib/update-ssr-setup.d.ts +2 -1
- package/src/generators/remote/lib/update-ssr-setup.js +10 -8
- package/src/generators/remote/remote.js +8 -4
- package/src/generators/remote/schema.json +2 -2
- package/src/generators/scam/schema.d.ts +3 -3
- package/src/generators/scam/schema.json +2 -2
- package/src/generators/scam-directive/schema.d.ts +3 -3
- package/src/generators/scam-directive/schema.json +2 -2
- package/src/generators/scam-pipe/schema.d.ts +3 -3
- package/src/generators/scam-pipe/schema.json +2 -2
- package/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +1 -1
- package/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +1 -1
- package/src/generators/setup-mf/lib/add-remote-to-host.d.ts +7 -2
- package/src/generators/setup-mf/lib/add-remote-to-host.js +15 -19
- package/src/generators/setup-mf/lib/fix-bootstrap.d.ts +1 -1
- package/src/generators/setup-mf/lib/fix-bootstrap.js +12 -5
- package/src/generators/setup-mf/lib/generate-config.js +1 -0
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +5 -1
- package/src/generators/setup-mf/lib/update-host-app-routes.js +1 -4
- package/src/generators/setup-mf/setup-mf.js +21 -4
- package/src/generators/setup-ssr/files/server/application-builder/__serverFileName__ +4 -3
- package/src/generators/setup-ssr/files/server/server-builder/v17+/__serverFileName__ +4 -3
- package/src/generators/setup-ssr/lib/add-dependencies.js +2 -1
- package/src/generators/setup-ssr/lib/generate-files.js +1 -7
- package/src/generators/setup-ssr/lib/index.d.ts +0 -1
- package/src/generators/setup-ssr/lib/index.js +0 -1
- package/src/generators/setup-ssr/lib/validate-options.js +0 -13
- package/src/generators/setup-ssr/schema.d.ts +1 -0
- package/src/generators/setup-ssr/schema.json +10 -3
- package/src/generators/setup-ssr/setup-ssr.js +3 -4
- package/src/generators/stories/stories.js +3 -2
- package/src/generators/storybook-configuration/lib/generate-stories.js +1 -1
- package/src/generators/storybook-configuration/schema.json +3 -3
- package/src/generators/utils/add-jest.js +1 -2
- package/src/generators/utils/add-mf-env-to-inputs.js +4 -1
- package/src/generators/utils/ensure-angular-dependencies.d.ts +1 -1
- package/src/generators/utils/ensure-angular-dependencies.js +44 -27
- package/src/generators/utils/storybook-ast/tree-utilities.js +2 -1
- package/src/generators/utils/testing.js +0 -17
- package/src/generators/utils/version-utils.d.ts +1 -2
- package/src/generators/utils/version-utils.js +5 -16
- package/src/migrations/update-15-2-0/remove-browserlist-config.d.ts +1 -0
- package/src/migrations/update-15-2-0/remove-browserlist-config.js +2 -1
- package/src/migrations/update-15-2-0/remove-platform-server-exports.js +2 -1
- package/src/migrations/update-15-2-0/update-karma-main-file.js +2 -1
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +2 -1
- package/src/migrations/update-16-1-0/update-server-executor-config.js +2 -2
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.d.ts +2 -0
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +53 -0
- package/src/migrations/update-18-2-0/update-angular-cli.d.ts +3 -0
- package/src/migrations/update-18-2-0/update-angular-cli.js +23 -0
- package/src/migrations/update-19-1-0/update-angular-cli.d.ts +3 -0
- package/src/migrations/update-19-1-0/update-angular-cli.js +23 -0
- package/src/migrations/update-19-2-1/add-typescript-eslint-utils.d.ts +3 -0
- package/src/migrations/update-19-2-1/add-typescript-eslint-utils.js +19 -0
- package/src/utils/backward-compatible-versions.d.ts +10 -5
- package/src/utils/backward-compatible-versions.js +18 -19
- package/src/utils/file-change-recorder.js +2 -1
- package/src/utils/{public-api.d.ts → index.d.ts} +5 -0
- package/src/utils/{public-api.js → index.js} +5 -0
- package/src/utils/mf/utils.js +1 -0
- package/src/utils/mf/with-module-federation-ssr.js +3 -0
- package/src/utils/mf/with-module-federation.js +6 -2
- package/src/utils/version-utils.d.ts +2 -2
- package/src/utils/version-utils.js +2 -1
- package/src/utils/versions.d.ts +6 -5
- package/src/utils/versions.js +7 -6
- package/index.js +0 -8
- package/mf/index.js +0 -7
- package/mf/mf.js +0 -53
- package/src/builders/webpack-server/validate-options.d.ts +0 -2
- package/src/builders/webpack-server/validate-options.js +0 -33
- package/src/executors/utilities/ng-compiler-cli.d.ts +0 -1
- package/src/executors/utilities/ng-compiler-cli.js +0 -8
- package/src/generators/setup-ssr/files/ngmodule/pre-v15-2/src/main.ts__tpl__ +0 -14
- package/src/generators/setup-ssr/lib/update-app-module.d.ts +0 -3
- package/src/generators/setup-ssr/lib/update-app-module.js +0 -27
- package/src/runtime/nx/data-persistence.js +0 -350
- package/testing/index.js +0 -6
- package/testing/src/testing-utils.js +0 -40
- /package/src/generators/application/files/{base/src → base-18+/public}/favicon.ico +0 -0
- /package/src/generators/application/files/{base → base-pre18}/src/assets/.gitkeep__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/ngmodule/{base/src → src}/__main__ +0 -0
- /package/src/generators/setup-ssr/files/ngmodule/{base/src → src}/app/__rootModuleFileName__ +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.moduleFederationDevServerExecutor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const lib_1 = require("./lib");
|
|
6
7
|
const rxjs_for_await_1 = require("@nx/devkit/src/utils/rxjs-for-await");
|
|
7
8
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
8
9
|
const module_federation_1 = require("@nx/webpack/src/utils/module-federation");
|
|
9
10
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
10
|
-
const file_server_impl_1 = require("@nx/web/src/executors/file-server/file-server.impl");
|
|
11
|
+
const file_server_impl_1 = tslib_1.__importDefault(require("@nx/web/src/executors/file-server/file-server.impl"));
|
|
11
12
|
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
12
13
|
const dev_server_impl_1 = require("../../builders/dev-server/dev-server.impl");
|
|
13
14
|
const module_federation_2 = require("../../builders/utilities/module-federation");
|
|
@@ -34,13 +35,16 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
|
34
35
|
: (0, rxjs_for_await_1.eachValueFrom)((0, dev_server_impl_1.executeDevServerBuilder)(options, await (0, ngcli_adapter_1.createBuilderContext)({
|
|
35
36
|
builderName: '@nx/angular:webpack-browser',
|
|
36
37
|
description: 'Build a browser application',
|
|
37
|
-
optionSchema:
|
|
38
|
+
optionSchema: require('../../builders/webpack-browser/schema.json'),
|
|
38
39
|
}, context)));
|
|
39
40
|
if (options.isInitialHost === false) {
|
|
40
41
|
return yield* currIter;
|
|
41
42
|
}
|
|
42
|
-
let pathToManifestFile
|
|
43
|
-
if (options.pathToManifestFile) {
|
|
43
|
+
let pathToManifestFile;
|
|
44
|
+
if (!options.pathToManifestFile) {
|
|
45
|
+
pathToManifestFile = (0, module_federation_2.getDynamicMfManifestFile)(project, context.root);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
44
48
|
const userPathToManifestFile = (0, path_1.join)(context.root, options.pathToManifestFile);
|
|
45
49
|
if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
|
|
46
50
|
throw new Error(`The provided Module Federation manifest file path does not exist. Please check the file exists at "${userPathToManifestFile}".`);
|
|
@@ -52,14 +56,17 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
|
52
56
|
}
|
|
53
57
|
(0, module_federation_2.validateDevRemotes)(options, workspaceProjects);
|
|
54
58
|
const moduleFederationConfig = (0, module_federation_1.getModuleFederationConfig)(project.targets.build.options.tsConfig, context.root, project.root, 'angular');
|
|
55
|
-
const
|
|
59
|
+
const remoteNames = options.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName);
|
|
60
|
+
const remotes = (0, module_federation_1.getRemotes)(remoteNames, options.skipRemotes, moduleFederationConfig, {
|
|
56
61
|
projectName: project.name,
|
|
57
62
|
projectGraph: context.projectGraph,
|
|
58
63
|
root: context.root,
|
|
59
64
|
}, pathToManifestFile);
|
|
60
65
|
if (remotes.devRemotes.length > 0 && !schema.staticRemotesPort) {
|
|
61
66
|
options.staticRemotesPort = options.devRemotes.reduce((portToUse, r) => {
|
|
62
|
-
const
|
|
67
|
+
const remoteName = typeof r === 'string' ? r : r.remoteName;
|
|
68
|
+
const remotePort = context.projectGraph.nodes[remoteName].data.targets['serve'].options
|
|
69
|
+
.port;
|
|
63
70
|
if (remotePort >= portToUse) {
|
|
64
71
|
return remotePort + 1;
|
|
65
72
|
}
|
|
@@ -70,7 +77,8 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
|
70
77
|
}
|
|
71
78
|
const staticRemotesConfig = (0, lib_1.parseStaticRemotesConfig)(remotes.staticRemotes, context);
|
|
72
79
|
await (0, lib_1.buildStaticRemotes)(staticRemotesConfig, nxBin, context, options);
|
|
73
|
-
const devRemoteIters = await (0, lib_1.
|
|
80
|
+
const devRemoteIters = await (0, lib_1.startRemotes)(remotes.devRemotes, workspaceProjects, options, context, 'serve');
|
|
81
|
+
const dynamicRemoteIters = await (0, lib_1.startRemotes)(remotes.dynamicRemotes, workspaceProjects, options, context, 'serve-static');
|
|
74
82
|
const staticRemotesIter = remotes.staticRemotes.length > 0
|
|
75
83
|
? (0, lib_1.startStaticRemotesFileServer)(staticRemotesConfig, context, options)
|
|
76
84
|
: undefined;
|
|
@@ -78,7 +86,7 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
|
78
86
|
...v,
|
|
79
87
|
baseUrl: undefined,
|
|
80
88
|
}));
|
|
81
|
-
return yield* (0, async_iterable_1.combineAsyncIterables)(removeBaseUrlEmission(currIter), ...devRemoteIters.map(removeBaseUrlEmission), ...(staticRemotesIter ? [removeBaseUrlEmission(staticRemotesIter)] : []), (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
|
|
89
|
+
return yield* (0, async_iterable_1.combineAsyncIterables)(removeBaseUrlEmission(currIter), ...devRemoteIters.map(removeBaseUrlEmission), ...dynamicRemoteIters.map(removeBaseUrlEmission), ...(staticRemotesIter ? [removeBaseUrlEmission(staticRemotesIter)] : []), (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
|
|
82
90
|
if (!options.isInitialHost) {
|
|
83
91
|
done();
|
|
84
92
|
return;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { DevRemoteDefinition } from '../../builders/utilities/module-federation';
|
|
2
|
+
|
|
1
3
|
interface BaseSchema {
|
|
2
4
|
port?: number;
|
|
3
5
|
host?: string;
|
|
@@ -16,7 +18,7 @@ interface BaseSchema {
|
|
|
16
18
|
hmr?: boolean;
|
|
17
19
|
watch?: boolean;
|
|
18
20
|
poll?: number;
|
|
19
|
-
devRemotes?:
|
|
21
|
+
devRemotes?: DevRemoteDefinition[];
|
|
20
22
|
skipRemotes?: string[];
|
|
21
23
|
pathToManifestFile?: string;
|
|
22
24
|
static?: boolean;
|
|
@@ -37,6 +39,7 @@ export type SchemaWithBuildTarget = BaseSchema & {
|
|
|
37
39
|
export type Schema = SchemaWithBrowserTarget | SchemaWithBuildTarget;
|
|
38
40
|
|
|
39
41
|
export type NormalizedSchema = SchemaWithBuildTarget & {
|
|
42
|
+
devRemotes: DevRemoteDefinition[];
|
|
40
43
|
liveReload: boolean;
|
|
41
44
|
open: boolean;
|
|
42
45
|
ssl: boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"title": "Schema for Module Federation Dev Server",
|
|
4
4
|
"outputCapture": "direct-nodejs",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Serves host [Module Federation](https://module-federation.io/) applications ([webpack](https://webpack.js.org/)-based) allowing to specify which remote applications should be served with the host.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"presets": [
|
|
8
8
|
{
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"type": "string",
|
|
16
16
|
"description": "A browser builder target to serve in the format of `project:target[:configuration]`.",
|
|
17
17
|
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$",
|
|
18
|
-
"x-deprecated": "Use 'buildTarget' instead. It will be removed in Nx
|
|
18
|
+
"x-deprecated": "Use 'buildTarget' instead. It will be removed in Nx v20."
|
|
19
19
|
},
|
|
20
20
|
"buildTarget": {
|
|
21
21
|
"type": "string",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"proxyConfig": {
|
|
36
36
|
"type": "string",
|
|
37
|
-
"description": "Proxy configuration file. For more information, see https://angular.
|
|
37
|
+
"description": "Proxy configuration file. For more information, see https://angular.dev/tools/cli/serve#proxying-to-a-backend-server."
|
|
38
38
|
},
|
|
39
39
|
"ssl": {
|
|
40
40
|
"type": "boolean",
|
|
@@ -112,7 +112,24 @@
|
|
|
112
112
|
"devRemotes": {
|
|
113
113
|
"type": "array",
|
|
114
114
|
"items": {
|
|
115
|
-
"
|
|
115
|
+
"oneOf": [
|
|
116
|
+
{
|
|
117
|
+
"type": "string"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"type": "object",
|
|
121
|
+
"properties": {
|
|
122
|
+
"remoteName": {
|
|
123
|
+
"type": "string"
|
|
124
|
+
},
|
|
125
|
+
"configuration": {
|
|
126
|
+
"type": "string"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"required": ["remoteName"],
|
|
130
|
+
"additionalProperties": false
|
|
131
|
+
}
|
|
132
|
+
]
|
|
116
133
|
},
|
|
117
134
|
"description": "List of remote applications to run in development mode (i.e. using serve target).",
|
|
118
135
|
"x-priority": "important"
|
|
@@ -122,7 +139,7 @@
|
|
|
122
139
|
"items": {
|
|
123
140
|
"type": "string"
|
|
124
141
|
},
|
|
125
|
-
"description": "List of remote applications to not automatically serve, either statically or in development mode. This will not remove the remotes from the `module-federation.config` file, and therefore the application may still try to fetch these remotes.\nThis option is useful
|
|
142
|
+
"description": "List of remote applications to not automatically serve, either statically or in development mode. This will not remove the remotes from the `module-federation.config` file, and therefore the application may still try to fetch these remotes.\nThis option is useful if you have other means for serving the `remote` application(s).\n**NOTE:** Remotes that are not in the workspace will be skipped automatically."
|
|
126
143
|
},
|
|
127
144
|
"pathToManifestFile": {
|
|
128
145
|
"type": "string",
|
|
@@ -6,9 +6,9 @@ const angular_version_utils_1 = require("../../utilities/angular-version-utils")
|
|
|
6
6
|
async function getNgPackagrInstance(options) {
|
|
7
7
|
const { major: angularMajorVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
|
|
8
8
|
if (angularMajorVersion >= 17) {
|
|
9
|
-
const { WRITE_BUNDLES_TRANSFORM } = await
|
|
10
|
-
const { WRITE_PACKAGE_TRANSFORM } = await
|
|
11
|
-
const { STYLESHEET_PROCESSOR } = await
|
|
9
|
+
const { WRITE_BUNDLES_TRANSFORM } = await import('./v17+/ng-package/entry-point/write-bundles.di.js');
|
|
10
|
+
const { WRITE_PACKAGE_TRANSFORM } = await import('./v17+/ng-package/entry-point/write-package.di.js');
|
|
11
|
+
const { STYLESHEET_PROCESSOR } = await import('../../utilities/ng-packagr/stylesheet-processor.di.js');
|
|
12
12
|
const packagr = (0, ng_packagr_1.ngPackagr)();
|
|
13
13
|
packagr.withProviders([
|
|
14
14
|
WRITE_BUNDLES_TRANSFORM,
|
|
@@ -17,9 +17,9 @@ async function getNgPackagrInstance(options) {
|
|
|
17
17
|
]);
|
|
18
18
|
return packagr;
|
|
19
19
|
}
|
|
20
|
-
const { NX_ENTRY_POINT_PROVIDERS } = await
|
|
21
|
-
const { nxProvideOptions } = await
|
|
22
|
-
const { NX_PACKAGE_PROVIDERS, NX_PACKAGE_TRANSFORM } = await
|
|
20
|
+
const { NX_ENTRY_POINT_PROVIDERS } = await import('./pre-v17/ng-package/entry-point/entry-point.di.js');
|
|
21
|
+
const { nxProvideOptions } = await import('./pre-v17/ng-package/options.di.js');
|
|
22
|
+
const { NX_PACKAGE_PROVIDERS, NX_PACKAGE_TRANSFORM } = await import('./pre-v17/ng-package/package.di.js');
|
|
23
23
|
const packagr = new ng_packagr_1.NgPackagr([
|
|
24
24
|
...NX_PACKAGE_PROVIDERS,
|
|
25
25
|
...NX_ENTRY_POINT_PROVIDERS,
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.nxCompileNgcTransformFactory = void 0;
|
|
12
|
+
const tslib_1 = require("tslib");
|
|
12
13
|
const transform_1 = require("ng-packagr/lib/graph/transform");
|
|
13
14
|
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
14
15
|
const tsconfig_1 = require("ng-packagr/lib/ts/tsconfig");
|
|
15
|
-
const path = require("path");
|
|
16
|
-
const ts = require("typescript");
|
|
16
|
+
const path = tslib_1.__importStar(require("path"));
|
|
17
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
17
18
|
const angular_version_utils_1 = require("../../../../../utilities/angular-version-utils");
|
|
18
19
|
const compile_source_files_1 = require("../../ngc/compile-source-files");
|
|
19
20
|
const nxCompileNgcTransformFactory = (StylesheetProcessor, options) => {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.nxWritePackageTransform = void 0;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
11
12
|
const devkit_1 = require("@nx/devkit");
|
|
12
13
|
const node_1 = require("ng-packagr/lib/graph/node");
|
|
13
14
|
const transform_1 = require("ng-packagr/lib/graph/transform");
|
|
@@ -15,7 +16,7 @@ const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
|
15
16
|
const fs_1 = require("ng-packagr/lib/utils/fs");
|
|
16
17
|
const glob_1 = require("ng-packagr/lib/utils/glob");
|
|
17
18
|
const path_1 = require("ng-packagr/lib/utils/path");
|
|
18
|
-
const path = require("path");
|
|
19
|
+
const path = tslib_1.__importStar(require("path"));
|
|
19
20
|
const angular_version_utils_1 = require("../../../../../utilities/angular-version-utils");
|
|
20
21
|
const nxWritePackageTransform = (options) => (0, transform_1.transformFromPromise)(async (graph) => {
|
|
21
22
|
const entryPoint = graph.find((0, nodes_1.isEntryPointInProgress)());
|
package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.NX_DEFAULT_OPTIONS_PROVIDER = exports.nxProvideOptions = exports.NX_OPTIONS_TOKEN = void 0;
|
|
10
|
-
const
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const find_cache_dir_1 = tslib_1.__importDefault(require("find-cache-dir"));
|
|
11
12
|
const injection_js_1 = require("injection-js");
|
|
12
13
|
const os_1 = require("os");
|
|
13
14
|
const path_1 = require("path");
|
|
@@ -30,5 +31,5 @@ function normalizeOptions(options = {}) {
|
|
|
30
31
|
}
|
|
31
32
|
function findCachePath() {
|
|
32
33
|
const name = 'ng-packagr';
|
|
33
|
-
return
|
|
34
|
+
return (0, find_cache_dir_1.default)({ name }) || (0, path_1.resolve)((0, os_1.tmpdir)(), name);
|
|
34
35
|
}
|
package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.d.ts
CHANGED
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
* - Use custom StylesheetProcessor instead of the one provided by ng-packagr.
|
|
6
6
|
* - Support Angular Compiler `incrementalDriver` for Angular < 16.
|
|
7
7
|
*/
|
|
8
|
-
import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';
|
|
9
8
|
import { BuildGraph } from 'ng-packagr/lib/graph/build-graph';
|
|
10
9
|
import * as ts from 'typescript';
|
|
11
10
|
import { NgPackagrOptions } from '../ng-package/options.di';
|
|
12
11
|
import { StylesheetProcessor } from '../styles/stylesheet-processor';
|
|
13
|
-
export declare function compileSourceFiles(graph: BuildGraph, tsConfig:
|
|
12
|
+
export declare function compileSourceFiles(graph: BuildGraph, tsConfig: any, moduleResolutionCache: ts.ModuleResolutionCache, options: NgPackagrOptions, extraOptions?: Partial<ts.CompilerOptions>, stylesheetProcessor?: StylesheetProcessor): Promise<void>;
|
package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.js
CHANGED
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.compileSourceFiles = void 0;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
11
12
|
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
12
13
|
const cache_compiler_host_1 = require("ng-packagr/lib/ts/cache-compiler-host");
|
|
13
|
-
const log = require("ng-packagr/lib/utils/log");
|
|
14
|
+
const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
|
|
14
15
|
const node_path_1 = require("node:path");
|
|
15
|
-
const ts = require("typescript");
|
|
16
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
16
17
|
const angular_version_utils_1 = require("../../../../utilities/angular-version-utils");
|
|
17
|
-
const
|
|
18
|
+
const module_loader_1 = require("../../../../utilities/module-loader");
|
|
18
19
|
async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, options, extraOptions, stylesheetProcessor) {
|
|
19
|
-
const { NgtscProgram, formatDiagnostics } = await (0,
|
|
20
|
+
const { NgtscProgram, formatDiagnostics } = await (0, module_loader_1.loadEsmModule)('@angular/compiler-cli');
|
|
20
21
|
const { cacheDirectory, watch, cacheEnabled } = options;
|
|
21
22
|
const tsConfigOptions = {
|
|
22
23
|
...tsConfig.options,
|
package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.StylesheetProcessor = exports.InlineStyleLanguage = exports.CssUrl = void 0;
|
|
11
|
-
const
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
|
|
12
13
|
const fs_1 = require("fs");
|
|
13
|
-
const esbuild_executor_1 = require("ng-packagr/lib/esbuild/esbuild-executor");
|
|
14
14
|
const cache_1 = require("ng-packagr/lib/utils/cache");
|
|
15
|
-
const log = require("ng-packagr/lib/utils/log");
|
|
15
|
+
const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
|
|
16
16
|
const path_1 = require("path");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const autoprefixer_1 = tslib_1.__importDefault(require("autoprefixer"));
|
|
18
|
+
const postcss_url_1 = tslib_1.__importDefault(require("postcss-url"));
|
|
19
19
|
const node_url_1 = require("node:url");
|
|
20
20
|
const tailwindcss_1 = require("../../../../utilities/ng-packagr/tailwindcss");
|
|
21
21
|
const postcss = require('postcss');
|
|
@@ -39,12 +39,12 @@ class StylesheetProcessor {
|
|
|
39
39
|
this.includePaths = includePaths;
|
|
40
40
|
this.cacheDirectory = cacheDirectory;
|
|
41
41
|
this.tailwindConfig = tailwindConfig;
|
|
42
|
-
this.esbuild = new
|
|
42
|
+
this.esbuild = new (require('ng-packagr/lib/esbuild/esbuild-executor').EsbuildExecutor)();
|
|
43
43
|
// By default, browserslist defaults are too inclusive
|
|
44
44
|
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
|
45
45
|
// We change the default query to browsers that Angular support.
|
|
46
46
|
// https://angular.io/guide/browser-support
|
|
47
|
-
|
|
47
|
+
browserslist_1.default.defaults = [
|
|
48
48
|
'last 2 Chrome versions',
|
|
49
49
|
'last 1 Firefox version',
|
|
50
50
|
'last 2 Edge major versions',
|
|
@@ -63,7 +63,7 @@ class StylesheetProcessor {
|
|
|
63
63
|
prevDir = currentDir;
|
|
64
64
|
currentDir = (0, path_1.dirname)(prevDir);
|
|
65
65
|
}
|
|
66
|
-
this.browserslistData =
|
|
66
|
+
this.browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
|
|
67
67
|
this.targets = transformSupportedBrowsersToTargets(this.browserslistData);
|
|
68
68
|
const tailwindSetup = (0, tailwindcss_1.getTailwindSetup)(this.projectBasePath, this.tailwindConfig);
|
|
69
69
|
if (tailwindSetup) {
|
|
@@ -135,9 +135,9 @@ class StylesheetProcessor {
|
|
|
135
135
|
postCssPlugins.push((0, tailwindcss_1.getTailwindPostCssPlugin)(tailwindSetup));
|
|
136
136
|
}
|
|
137
137
|
if (this.cssUrl !== CssUrl.none) {
|
|
138
|
-
postCssPlugins.push(
|
|
138
|
+
postCssPlugins.push((0, postcss_url_1.default)({ url: this.cssUrl }));
|
|
139
139
|
}
|
|
140
|
-
postCssPlugins.push(
|
|
140
|
+
postCssPlugins.push((0, autoprefixer_1.default)({
|
|
141
141
|
ignoreUnknownVersions: true,
|
|
142
142
|
overrideBrowserslist: this.browserslistData,
|
|
143
143
|
}));
|
|
@@ -148,14 +148,14 @@ class StylesheetProcessor {
|
|
|
148
148
|
switch (ext) {
|
|
149
149
|
case '.sass':
|
|
150
150
|
case '.scss': {
|
|
151
|
-
return (await
|
|
151
|
+
return (await import('sass')).compileString(css, {
|
|
152
152
|
url: (0, node_url_1.pathToFileURL)(filePath),
|
|
153
153
|
syntax: '.sass' === ext ? 'indented' : 'scss',
|
|
154
154
|
loadPaths: this.styleIncludePaths,
|
|
155
155
|
}).css;
|
|
156
156
|
}
|
|
157
157
|
case '.less': {
|
|
158
|
-
const { css: content } = await (await
|
|
158
|
+
const { css: content } = await (await import('less')).render(css, {
|
|
159
159
|
filename: filePath,
|
|
160
160
|
javascriptEnabled: true,
|
|
161
161
|
paths: this.styleIncludePaths,
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.nxWritePackageTransform = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
10
11
|
const devkit_1 = require("@nx/devkit");
|
|
11
12
|
const node_1 = require("ng-packagr/lib/graph/node");
|
|
12
13
|
const transform_1 = require("ng-packagr/lib/graph/transform");
|
|
@@ -14,7 +15,7 @@ const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
|
14
15
|
const fs_1 = require("ng-packagr/lib/utils/fs");
|
|
15
16
|
const glob_1 = require("ng-packagr/lib/utils/glob");
|
|
16
17
|
const path_1 = require("ng-packagr/lib/utils/path");
|
|
17
|
-
const path = require("path");
|
|
18
|
+
const path = tslib_1.__importStar(require("path"));
|
|
18
19
|
const nxWritePackageTransform = (options) => (0, transform_1.transformFromPromise)(async (graph) => {
|
|
19
20
|
const entryPoint = graph.find((0, nodes_1.isEntryPointInProgress)());
|
|
20
21
|
const ngEntryPoint = entryPoint.data.entryPoint;
|
|
@@ -10,7 +10,7 @@ async function initializeNgPackgrLite(options, context, projectDependencies) {
|
|
|
10
10
|
const ngPackagr = await (0, ng_packagr_1.getNgPackagrInstance)(options);
|
|
11
11
|
ngPackagr.forProject((0, path_1.resolve)(context.root, options.project));
|
|
12
12
|
if (options.tsConfig) {
|
|
13
|
-
const remappedTsConfigFilePath = (0, buildable_libs_utils_1.createTmpTsConfig)(options.tsConfig, context.root, context.projectsConfigurations.projects[context.projectName].root, projectDependencies);
|
|
13
|
+
const remappedTsConfigFilePath = (0, buildable_libs_utils_1.createTmpTsConfig)((0, path_1.join)(context.root, options.tsConfig), context.root, context.projectsConfigurations.projects[context.projectName].root, projectDependencies);
|
|
14
14
|
const tsConfig = await (0, typescript_1.parseRemappedTsConfigAndMergeDefaults)(context.root, options.tsConfig, remappedTsConfigFilePath);
|
|
15
15
|
ngPackagr.withTsConfig(tsConfig);
|
|
16
16
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"outputCapture": "direct-nodejs",
|
|
4
4
|
"$schema": "https://json-schema.org/schema",
|
|
5
5
|
"title": "ng-packagr Target",
|
|
6
|
-
"description": "Builds
|
|
6
|
+
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but it only produces ESM2022 bundles.",
|
|
7
7
|
"cli": "nx",
|
|
8
8
|
"type": "object",
|
|
9
9
|
"presets": [
|
package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js
CHANGED
|
@@ -9,18 +9,19 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.compileNgcTransformFactory = void 0;
|
|
12
|
+
const tslib_1 = require("tslib");
|
|
12
13
|
const transform_1 = require("ng-packagr/lib/graph/transform");
|
|
13
14
|
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
14
15
|
const tsconfig_1 = require("ng-packagr/lib/ts/tsconfig");
|
|
15
|
-
const
|
|
16
|
-
const path = require("path");
|
|
17
|
-
const ts = require("typescript");
|
|
16
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
17
|
+
const path = tslib_1.__importStar(require("path"));
|
|
18
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
18
19
|
const angular_version_utils_1 = require("../../../../utilities/angular-version-utils");
|
|
19
20
|
const compile_source_files_1 = require("../../ngc/compile-source-files");
|
|
20
21
|
const ng_compiler_cli_1 = require("../../utils/ng-compiler-cli");
|
|
21
22
|
const compileNgcTransformFactory = (StylesheetProcessor, options) => {
|
|
22
23
|
return (0, transform_1.transformFromPromise)(async (graph) => {
|
|
23
|
-
const spinner =
|
|
24
|
+
const spinner = (0, ora_1.default)({
|
|
24
25
|
hideCursor: false,
|
|
25
26
|
discardStdin: false,
|
|
26
27
|
});
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.NX_DEFAULT_OPTIONS_PROVIDER = exports.nxProvideOptions = exports.NX_OPTIONS_TOKEN = void 0;
|
|
10
|
-
const
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const find_cache_dir_1 = tslib_1.__importDefault(require("find-cache-dir"));
|
|
11
12
|
const injection_js_1 = require("injection-js");
|
|
12
13
|
const os_1 = require("os");
|
|
13
14
|
const path_1 = require("path");
|
|
@@ -30,5 +31,5 @@ function normalizeOptions(options = {}) {
|
|
|
30
31
|
}
|
|
31
32
|
function findCachePath() {
|
|
32
33
|
const name = 'ng-packagr';
|
|
33
|
-
return
|
|
34
|
+
return (0, find_cache_dir_1.default)({ name }) || (0, path_1.resolve)((0, os_1.tmpdir)(), name);
|
|
34
35
|
}
|
|
@@ -6,14 +6,14 @@ const angular_version_utils_1 = require("../../utilities/angular-version-utils")
|
|
|
6
6
|
async function getNgPackagrInstance(options) {
|
|
7
7
|
const { major: angularMajorVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
|
|
8
8
|
if (angularMajorVersion >= 17) {
|
|
9
|
-
const { STYLESHEET_PROCESSOR } = await
|
|
9
|
+
const { STYLESHEET_PROCESSOR } = await import('../../utilities/ng-packagr/stylesheet-processor.di.js');
|
|
10
10
|
const packagr = (0, ng_packagr_1.ngPackagr)();
|
|
11
11
|
packagr.withProviders([STYLESHEET_PROCESSOR]);
|
|
12
12
|
return packagr;
|
|
13
13
|
}
|
|
14
|
-
const { NX_ENTRY_POINT_PROVIDERS } = await
|
|
15
|
-
const { nxProvideOptions } = await
|
|
16
|
-
const { NX_PACKAGE_PROVIDERS, NX_PACKAGE_TRANSFORM } = await
|
|
14
|
+
const { NX_ENTRY_POINT_PROVIDERS } = await import('./ng-package/entry-point/entry-point.di.js');
|
|
15
|
+
const { nxProvideOptions } = await import('./ng-package/options.di.js');
|
|
16
|
+
const { NX_PACKAGE_PROVIDERS, NX_PACKAGE_TRANSFORM } = await import('./ng-package/package.di.js');
|
|
17
17
|
const packagr = new ng_packagr_1.NgPackagr([
|
|
18
18
|
...NX_PACKAGE_PROVIDERS,
|
|
19
19
|
...NX_ENTRY_POINT_PROVIDERS,
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* - Support ngcc for Angular < 16.
|
|
7
7
|
* - Support Angular Compiler `incrementalDriver` for Angular < 16.
|
|
8
8
|
*/
|
|
9
|
-
import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';
|
|
10
9
|
import { BuildGraph } from 'ng-packagr/lib/graph/build-graph';
|
|
11
10
|
import * as ts from 'typescript';
|
|
12
11
|
import { NgPackagrOptions } from '../ng-package/options.di';
|
|
13
12
|
import { StylesheetProcessor } from '../styles/stylesheet-processor';
|
|
14
|
-
export declare function compileSourceFiles(graph: BuildGraph, tsConfig:
|
|
13
|
+
export declare function compileSourceFiles(graph: BuildGraph, tsConfig: any, moduleResolutionCache: ts.ModuleResolutionCache, options: NgPackagrOptions, extraOptions?: Partial<ts.CompilerOptions>, stylesheetProcessor?: StylesheetProcessor, ngccProcessor?: any): Promise<void>;
|
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.compileSourceFiles = void 0;
|
|
12
|
+
const tslib_1 = require("tslib");
|
|
12
13
|
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
13
|
-
const log = require("ng-packagr/lib/utils/log");
|
|
14
|
+
const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
|
|
14
15
|
const cache_compiler_host_1 = require("ng-packagr/lib/ts/cache-compiler-host");
|
|
15
16
|
const node_path_1 = require("node:path");
|
|
16
|
-
const ts = require("typescript");
|
|
17
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
17
18
|
const angular_version_utils_1 = require("../../../utilities/angular-version-utils");
|
|
18
|
-
const
|
|
19
|
+
const module_loader_1 = require("../../../utilities/module-loader");
|
|
19
20
|
async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, options, extraOptions, stylesheetProcessor, ngccProcessor) {
|
|
20
|
-
const { NgtscProgram, formatDiagnostics } = await (0,
|
|
21
|
+
const { NgtscProgram, formatDiagnostics } = await (0, module_loader_1.loadEsmModule)('@angular/compiler-cli');
|
|
21
22
|
const { cacheDirectory, watch, cacheEnabled } = options;
|
|
22
23
|
const tsConfigOptions = {
|
|
23
24
|
...tsConfig.options,
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.StylesheetProcessor = exports.CssUrl = void 0;
|
|
11
|
-
const
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
|
|
12
13
|
const fs_1 = require("fs");
|
|
13
|
-
const esbuild_executor_1 = require("ng-packagr/lib/esbuild/esbuild-executor");
|
|
14
14
|
const cache_1 = require("ng-packagr/lib/utils/cache");
|
|
15
|
-
const log = require("ng-packagr/lib/utils/log");
|
|
15
|
+
const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
|
|
16
16
|
const path_1 = require("path");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const autoprefixer_1 = tslib_1.__importDefault(require("autoprefixer"));
|
|
18
|
+
const postcss_url_1 = tslib_1.__importDefault(require("postcss-url"));
|
|
19
19
|
const node_url_1 = require("node:url");
|
|
20
20
|
const tailwindcss_1 = require("../../../utilities/ng-packagr/tailwindcss");
|
|
21
21
|
const postcss = require('postcss');
|
|
@@ -32,12 +32,12 @@ class StylesheetProcessor {
|
|
|
32
32
|
this.includePaths = includePaths;
|
|
33
33
|
this.cacheDirectory = cacheDirectory;
|
|
34
34
|
this.tailwindConfig = tailwindConfig;
|
|
35
|
-
this.esbuild = new
|
|
35
|
+
this.esbuild = new (require('ng-packagr/lib/esbuild/esbuild-executor').EsbuildExecutor)();
|
|
36
36
|
// By default, browserslist defaults are too inclusive
|
|
37
37
|
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
|
38
38
|
// We change the default query to browsers that Angular support.
|
|
39
39
|
// https://angular.io/guide/browser-support
|
|
40
|
-
|
|
40
|
+
browserslist_1.default.defaults = [
|
|
41
41
|
'last 2 Chrome versions',
|
|
42
42
|
'last 1 Firefox version',
|
|
43
43
|
'last 2 Edge major versions',
|
|
@@ -56,7 +56,7 @@ class StylesheetProcessor {
|
|
|
56
56
|
prevDir = currentDir;
|
|
57
57
|
currentDir = (0, path_1.dirname)(prevDir);
|
|
58
58
|
}
|
|
59
|
-
this.browserslistData =
|
|
59
|
+
this.browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
|
|
60
60
|
this.targets = transformSupportedBrowsersToTargets(this.browserslistData);
|
|
61
61
|
const tailwindSetup = (0, tailwindcss_1.getTailwindSetup)(this.projectBasePath, this.tailwindConfig);
|
|
62
62
|
if (tailwindSetup) {
|
|
@@ -128,9 +128,9 @@ class StylesheetProcessor {
|
|
|
128
128
|
postCssPlugins.push((0, tailwindcss_1.getTailwindPostCssPlugin)(tailwindSetup));
|
|
129
129
|
}
|
|
130
130
|
if (this.cssUrl !== CssUrl.none) {
|
|
131
|
-
postCssPlugins.push(
|
|
131
|
+
postCssPlugins.push((0, postcss_url_1.default)({ url: this.cssUrl }));
|
|
132
132
|
}
|
|
133
|
-
postCssPlugins.push(
|
|
133
|
+
postCssPlugins.push((0, autoprefixer_1.default)({
|
|
134
134
|
ignoreUnknownVersions: true,
|
|
135
135
|
overrideBrowserslist: this.browserslistData,
|
|
136
136
|
}));
|
|
@@ -141,14 +141,14 @@ class StylesheetProcessor {
|
|
|
141
141
|
switch (ext) {
|
|
142
142
|
case '.sass':
|
|
143
143
|
case '.scss': {
|
|
144
|
-
return (await
|
|
144
|
+
return (await import('sass')).compileString(css, {
|
|
145
145
|
url: (0, node_url_1.pathToFileURL)(filePath),
|
|
146
146
|
syntax: '.sass' === ext ? 'indented' : 'scss',
|
|
147
147
|
loadPaths: this.styleIncludePaths,
|
|
148
148
|
}).css;
|
|
149
149
|
}
|
|
150
150
|
case '.less': {
|
|
151
|
-
const { css: content } = await (await
|
|
151
|
+
const { css: content } = await (await import('less')).render(css, {
|
|
152
152
|
filename: filePath,
|
|
153
153
|
javascriptEnabled: true,
|
|
154
154
|
paths: this.styleIncludePaths,
|
|
@@ -12,7 +12,7 @@ async function initializeNgPackagr(options, context, projectDependencies) {
|
|
|
12
12
|
const ngPackagr = await (0, ng_packagr_1.getNgPackagrInstance)(options);
|
|
13
13
|
ngPackagr.forProject((0, path_1.resolve)(context.root, options.project));
|
|
14
14
|
if (options.tsConfig) {
|
|
15
|
-
const remappedTsConfigFilePath = (0, buildable_libs_utils_1.createTmpTsConfig)(options.tsConfig, context.root, context.projectsConfigurations.projects[context.projectName].root, projectDependencies);
|
|
15
|
+
const remappedTsConfigFilePath = (0, buildable_libs_utils_1.createTmpTsConfig)((0, path_1.join)(context.root, options.tsConfig), context.root, context.projectsConfigurations.projects[context.projectName].root, projectDependencies);
|
|
16
16
|
const tsConfig = await (0, typescript_1.parseRemappedTsConfigAndMergeDefaults)(context.root, options.tsConfig, remappedTsConfigFilePath);
|
|
17
17
|
ngPackagr.withTsConfig(tsConfig);
|
|
18
18
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"outputCapture": "direct-nodejs",
|
|
4
4
|
"$schema": "https://json-schema.org/schema",
|
|
5
5
|
"title": "ng-packagr Target",
|
|
6
|
-
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is
|
|
6
|
+
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` with additional support for incremental builds.",
|
|
7
7
|
"cli": "nx",
|
|
8
8
|
"type": "object",
|
|
9
9
|
"presets": [
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { IndexHtmlTransform } from '@angular-devkit/build-angular/src/utils/index-file/index-html-generator';
|
|
2
1
|
import type { Plugin } from 'esbuild';
|
|
3
|
-
import type { Connect } from 'vite';
|
|
4
2
|
export type PluginSpec = {
|
|
5
3
|
path: string;
|
|
6
4
|
options: any;
|
|
7
5
|
};
|
|
8
6
|
export declare function loadPlugins(plugins: string[] | PluginSpec[] | undefined, tsConfig: string): Promise<Plugin[]>;
|
|
9
|
-
export declare function loadMiddleware(middlewareFns: string[] | undefined, tsConfig: string): Promise<
|
|
10
|
-
export declare function loadIndexHtmlTransformer(indexHtmlTransformerPath: string, tsConfig: string): Promise<
|
|
7
|
+
export declare function loadMiddleware(middlewareFns: string[] | undefined, tsConfig: string): Promise<any[]>;
|
|
8
|
+
export declare function loadIndexHtmlTransformer(indexHtmlTransformerPath: string, tsConfig: string): Promise<any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
export declare function loadModule<T = any>(path: string): Promise<T>;
|
|
3
2
|
/**
|
|
4
3
|
* This uses a dynamic import to load a module which may be ESM.
|
|
@@ -12,4 +11,4 @@ export declare function loadModule<T = any>(path: string): Promise<T>;
|
|
|
12
11
|
* @param modulePath The path of the module to load.
|
|
13
12
|
* @returns A Promise that resolves to the dynamically imported module.
|
|
14
13
|
*/
|
|
15
|
-
export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
|
|
14
|
+
export declare function loadEsmModule<T = any>(modulePath: string | URL): Promise<T>;
|