Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
21
my-app/node_modules/@angular-devkit/architect/LICENSE
generated
vendored
Executable file
21
my-app/node_modules/@angular-devkit/architect/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2017 Google, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
3
my-app/node_modules/@angular-devkit/architect/README.md
generated
vendored
Executable file
3
my-app/node_modules/@angular-devkit/architect/README.md
generated
vendored
Executable file
|
@ -0,0 +1,3 @@
|
|||
# Angular Build Facade
|
||||
|
||||
WIP
|
11
my-app/node_modules/@angular-devkit/architect/builders/all-of.d.ts
generated
vendored
Executable file
11
my-app/node_modules/@angular-devkit/architect/builders/all-of.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { json } from '@angular-devkit/core';
|
||||
import { Schema as OperatorSchema } from './operator-schema';
|
||||
declare const _default: import("../src/internal").Builder<json.JsonObject & OperatorSchema>;
|
||||
export default _default;
|
47
my-app/node_modules/@angular-devkit/architect/builders/all-of.js
generated
vendored
Executable file
47
my-app/node_modules/@angular-devkit/architect/builders/all-of.js
generated
vendored
Executable file
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const rxjs_1 = require("rxjs");
|
||||
const src_1 = require("../src");
|
||||
exports.default = (0, src_1.createBuilder)((options, context) => {
|
||||
const allRuns = [];
|
||||
context.reportProgress(0, (options.targets ? options.targets.length : 0) +
|
||||
(options.builders ? options.builders.length : 0));
|
||||
if (options.targets) {
|
||||
allRuns.push(...options.targets.map(({ target: targetStr, overrides }, i) => {
|
||||
const [project, target, configuration] = targetStr.split(/:/g, 3);
|
||||
return context
|
||||
.scheduleTarget({ project, target, configuration }, overrides || {})
|
||||
.then((run) => [i, run]);
|
||||
}));
|
||||
}
|
||||
if (options.builders) {
|
||||
allRuns.push(...options.builders.map(({ builder, options }, i) => {
|
||||
return context
|
||||
.scheduleBuilder(builder, options || {})
|
||||
.then((run) => [i, run]);
|
||||
}));
|
||||
}
|
||||
const allResults = allRuns.map(() => null);
|
||||
let n = 0;
|
||||
context.reportProgress(n++, allRuns.length);
|
||||
return (0, rxjs_1.from)(allRuns).pipe((0, rxjs_1.mergeMap)((runPromise) => (0, rxjs_1.from)(runPromise)), (0, rxjs_1.mergeMap)(([i, run]) => run.output.pipe((0, rxjs_1.map)((output) => [i, output]))), (0, rxjs_1.mergeMap)(([i, output]) => {
|
||||
allResults[i] = output;
|
||||
context.reportProgress(n++, allRuns.length);
|
||||
if (allResults.some((x) => x === null)) {
|
||||
// Some builders aren't done running yet.
|
||||
return rxjs_1.EMPTY;
|
||||
}
|
||||
else {
|
||||
return (0, rxjs_1.of)({
|
||||
success: allResults.every((x) => (x ? x.success : false)),
|
||||
});
|
||||
}
|
||||
}));
|
||||
});
|
25
my-app/node_modules/@angular-devkit/architect/builders/builders.json
generated
vendored
Executable file
25
my-app/node_modules/@angular-devkit/architect/builders/builders.json
generated
vendored
Executable file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"$schema": "../src/builders-schema.json",
|
||||
"builders": {
|
||||
"true": {
|
||||
"implementation": "./true",
|
||||
"schema": "./noop-schema.json",
|
||||
"description": "Always succeed."
|
||||
},
|
||||
"false": {
|
||||
"implementation": "./false",
|
||||
"schema": "./noop-schema.json",
|
||||
"description": "Always fails."
|
||||
},
|
||||
"allOf": {
|
||||
"implementation": "./all-of",
|
||||
"schema": "./operator-schema.json",
|
||||
"description": "A builder that executes many builders in parallel, and succeed if both succeeds."
|
||||
},
|
||||
"concat": {
|
||||
"implementation": "./concat",
|
||||
"schema": "./operator-schema.json",
|
||||
"description": "A builder that executes many builders one after the other, and stops when one fail. It will succeed if all builders succeeds (and return the last output)"
|
||||
}
|
||||
}
|
||||
}
|
11
my-app/node_modules/@angular-devkit/architect/builders/concat.d.ts
generated
vendored
Executable file
11
my-app/node_modules/@angular-devkit/architect/builders/concat.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { json } from '@angular-devkit/core';
|
||||
import { Schema as OperatorSchema } from './operator-schema';
|
||||
declare const _default: import("../src/internal").Builder<json.JsonObject & OperatorSchema>;
|
||||
export default _default;
|
44
my-app/node_modules/@angular-devkit/architect/builders/concat.js
generated
vendored
Executable file
44
my-app/node_modules/@angular-devkit/architect/builders/concat.js
generated
vendored
Executable file
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const rxjs_1 = require("rxjs");
|
||||
const src_1 = require("../src");
|
||||
exports.default = (0, src_1.createBuilder)((options, context) => {
|
||||
const allRuns = [];
|
||||
context.reportProgress(0, (options.targets ? options.targets.length : 0) +
|
||||
(options.builders ? options.builders.length : 0));
|
||||
if (options.targets) {
|
||||
allRuns.push(...options.targets.map(({ target: targetStr, overrides }) => {
|
||||
const [project, target, configuration] = targetStr.split(/:/g, 3);
|
||||
return () => context.scheduleTarget({ project, target, configuration }, overrides || {});
|
||||
}));
|
||||
}
|
||||
if (options.builders) {
|
||||
allRuns.push(...options.builders.map(({ builder, options }) => {
|
||||
return () => context.scheduleBuilder(builder, options || {});
|
||||
}));
|
||||
}
|
||||
let stop = null;
|
||||
let i = 0;
|
||||
context.reportProgress(i++, allRuns.length);
|
||||
return (0, rxjs_1.from)(allRuns).pipe((0, rxjs_1.concatMap)((fn) => stop
|
||||
? (0, rxjs_1.of)(null)
|
||||
: (0, rxjs_1.from)(fn()).pipe((0, rxjs_1.switchMap)((run) => (run === null ? (0, rxjs_1.of)(null) : run.output.pipe((0, rxjs_1.first)()))))), (0, rxjs_1.map)((output) => {
|
||||
context.reportProgress(i++, allRuns.length);
|
||||
if (output === null || stop !== null) {
|
||||
return stop || { success: false };
|
||||
}
|
||||
else if (output.success === false) {
|
||||
return (stop = output);
|
||||
}
|
||||
else {
|
||||
return output;
|
||||
}
|
||||
}), (0, rxjs_1.last)());
|
||||
});
|
9
my-app/node_modules/@angular-devkit/architect/builders/false.d.ts
generated
vendored
Executable file
9
my-app/node_modules/@angular-devkit/architect/builders/false.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
declare const _default: import("../src/internal").Builder<import("../../core/src").JsonObject>;
|
||||
export default _default;
|
14
my-app/node_modules/@angular-devkit/architect/builders/false.js
generated
vendored
Executable file
14
my-app/node_modules/@angular-devkit/architect/builders/false.js
generated
vendored
Executable file
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const src_1 = require("../src");
|
||||
exports.default = (0, src_1.createBuilder)(() => ({
|
||||
success: false,
|
||||
error: 'False builder always errors.',
|
||||
}));
|
4
my-app/node_modules/@angular-devkit/architect/builders/noop-schema.json
generated
vendored
Executable file
4
my-app/node_modules/@angular-devkit/architect/builders/noop-schema.json
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"type": "object"
|
||||
}
|
22
my-app/node_modules/@angular-devkit/architect/builders/operator-schema.d.ts
generated
vendored
Executable file
22
my-app/node_modules/@angular-devkit/architect/builders/operator-schema.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* All input types of builders that perform operations on one or multiple sub-builders.
|
||||
*/
|
||||
export interface Schema {
|
||||
builders?: Builder[];
|
||||
targets?: Target[];
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface Builder {
|
||||
builder: string;
|
||||
options?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface Target {
|
||||
overrides?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
target: string;
|
||||
[property: string]: any;
|
||||
}
|
4
my-app/node_modules/@angular-devkit/architect/builders/operator-schema.js
generated
vendored
Executable file
4
my-app/node_modules/@angular-devkit/architect/builders/operator-schema.js
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
"use strict";
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
||||
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
41
my-app/node_modules/@angular-devkit/architect/builders/operator-schema.json
generated
vendored
Executable file
41
my-app/node_modules/@angular-devkit/architect/builders/operator-schema.json
generated
vendored
Executable file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"description": "All input types of builders that perform operations on one or multiple sub-builders.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"builders": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"builder": {
|
||||
"type": "string",
|
||||
"pattern": ".*:.*"
|
||||
},
|
||||
"options": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": ["builder"]
|
||||
},
|
||||
"minItems": 1
|
||||
},
|
||||
"targets": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"target": {
|
||||
"type": "string",
|
||||
"pattern": ".*:.*"
|
||||
},
|
||||
"overrides": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": ["target"]
|
||||
},
|
||||
"minItems": 1
|
||||
}
|
||||
}
|
||||
}
|
9
my-app/node_modules/@angular-devkit/architect/builders/true.d.ts
generated
vendored
Executable file
9
my-app/node_modules/@angular-devkit/architect/builders/true.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
declare const _default: import("../src/internal").Builder<import("../../core/src").JsonObject>;
|
||||
export default _default;
|
11
my-app/node_modules/@angular-devkit/architect/builders/true.js
generated
vendored
Executable file
11
my-app/node_modules/@angular-devkit/architect/builders/true.js
generated
vendored
Executable file
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const src_1 = require("../src");
|
||||
exports.default = (0, src_1.createBuilder)(() => ({ success: true }));
|
10
my-app/node_modules/@angular-devkit/architect/node/index.d.ts
generated
vendored
Executable file
10
my-app/node_modules/@angular-devkit/architect/node/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import * as jobs from './jobs/job-registry';
|
||||
export * from './node-modules-architect-host';
|
||||
export { jobs };
|
39
my-app/node_modules/@angular-devkit/architect/node/index.js
generated
vendored
Executable file
39
my-app/node_modules/@angular-devkit/architect/node/index.js
generated
vendored
Executable file
|
@ -0,0 +1,39 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jobs = void 0;
|
||||
const jobs = __importStar(require("./jobs/job-registry"));
|
||||
exports.jobs = jobs;
|
||||
__exportStar(require("./node-modules-architect-host"), exports);
|
20
my-app/node_modules/@angular-devkit/architect/node/jobs/job-registry.d.ts
generated
vendored
Executable file
20
my-app/node_modules/@angular-devkit/architect/node/jobs/job-registry.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { jobs } from '@angular-devkit/architect';
|
||||
import { JsonValue } from '@angular-devkit/core';
|
||||
import { Observable } from 'rxjs';
|
||||
export declare class NodeModuleJobRegistry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> implements jobs.Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> {
|
||||
protected _resolve(name: string): string | null;
|
||||
/**
|
||||
* Get a job description for a named job.
|
||||
*
|
||||
* @param name The name of the job.
|
||||
* @returns A description, or null if the job is not registered.
|
||||
*/
|
||||
get<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: jobs.JobName): Observable<jobs.JobHandler<A, I, O> | null>;
|
||||
}
|
59
my-app/node_modules/@angular-devkit/architect/node/jobs/job-registry.js
generated
vendored
Executable file
59
my-app/node_modules/@angular-devkit/architect/node/jobs/job-registry.js
generated
vendored
Executable file
|
@ -0,0 +1,59 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeModuleJobRegistry = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const rxjs_1 = require("rxjs");
|
||||
class NodeModuleJobRegistry {
|
||||
_resolve(name) {
|
||||
try {
|
||||
return require.resolve(name);
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code === 'MODULE_NOT_FOUND') {
|
||||
return null;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get a job description for a named job.
|
||||
*
|
||||
* @param name The name of the job.
|
||||
* @returns A description, or null if the job is not registered.
|
||||
*/
|
||||
get(name) {
|
||||
const [moduleName, exportName] = name.split(/#/, 2);
|
||||
const resolvedPath = this._resolve(moduleName);
|
||||
if (!resolvedPath) {
|
||||
return (0, rxjs_1.of)(null);
|
||||
}
|
||||
const pkg = require(resolvedPath);
|
||||
const handler = pkg[exportName || 'default'];
|
||||
if (!handler) {
|
||||
return (0, rxjs_1.of)(null);
|
||||
}
|
||||
function _getValue(...fields) {
|
||||
return fields.find((x) => core_1.schema.isJsonSchema(x)) || true;
|
||||
}
|
||||
const argument = _getValue(pkg.argument, handler.argument);
|
||||
const input = _getValue(pkg.input, handler.input);
|
||||
const output = _getValue(pkg.output, handler.output);
|
||||
const channels = _getValue(pkg.channels, handler.channels);
|
||||
return (0, rxjs_1.of)(Object.assign(handler.bind(undefined), {
|
||||
jobDescription: {
|
||||
argument,
|
||||
input,
|
||||
output,
|
||||
channels,
|
||||
},
|
||||
}));
|
||||
}
|
||||
}
|
||||
exports.NodeModuleJobRegistry = NodeModuleJobRegistry;
|
58
my-app/node_modules/@angular-devkit/architect/node/node-modules-architect-host.d.ts
generated
vendored
Executable file
58
my-app/node_modules/@angular-devkit/architect/node/node-modules-architect-host.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
/// <reference types="@types/node/url" />
|
||||
/// <reference types="@types/node/ts4.8/url" />
|
||||
import { json, workspaces } from '@angular-devkit/core';
|
||||
import { URL } from 'url';
|
||||
import { BuilderInfo } from '../src';
|
||||
import { Target } from '../src/input-schema';
|
||||
import { ArchitectHost, Builder } from '../src/internal';
|
||||
export type NodeModulesBuilderInfo = BuilderInfo & {
|
||||
import: string;
|
||||
};
|
||||
export interface WorkspaceHost {
|
||||
getBuilderName(project: string, target: string): Promise<string>;
|
||||
getMetadata(project: string): Promise<json.JsonObject>;
|
||||
getOptions(project: string, target: string, configuration?: string): Promise<json.JsonObject>;
|
||||
hasTarget(project: string, target: string): Promise<boolean>;
|
||||
getDefaultConfigurationName(project: string, target: string): Promise<string | undefined>;
|
||||
}
|
||||
export declare class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModulesBuilderInfo> {
|
||||
protected _root: string;
|
||||
private workspaceHost;
|
||||
constructor(workspaceHost: WorkspaceHost, _root: string);
|
||||
constructor(workspace: workspaces.WorkspaceDefinition, _root: string);
|
||||
getBuilderNameForTarget(target: Target): Promise<string>;
|
||||
/**
|
||||
* Resolve a builder. This needs to be a string which will be used in a dynamic `import()`
|
||||
* clause. This should throw if no builder can be found. The dynamic import will throw if
|
||||
* it is unsupported.
|
||||
* @param builderStr The name of the builder to be used.
|
||||
* @returns All the info needed for the builder itself.
|
||||
*/
|
||||
resolveBuilder(builderStr: string): Promise<NodeModulesBuilderInfo>;
|
||||
getCurrentDirectory(): Promise<string>;
|
||||
getWorkspaceRoot(): Promise<string>;
|
||||
getOptionsForTarget(target: Target): Promise<json.JsonObject | null>;
|
||||
getProjectMetadata(target: Target | string): Promise<json.JsonObject | null>;
|
||||
loadBuilder(info: NodeModulesBuilderInfo): Promise<Builder>;
|
||||
}
|
||||
/**
|
||||
* This uses a dynamic import to load a module which may be ESM.
|
||||
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
||||
* will currently, unconditionally downlevel dynamic import into a require call.
|
||||
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
||||
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
||||
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
||||
* be dropped.
|
||||
*
|
||||
* @param modulePath The path of the module to load.
|
||||
* @returns A Promise that resolves to the dynamically imported module.
|
||||
*/
|
||||
export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
|
232
my-app/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
generated
vendored
Executable file
232
my-app/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
generated
vendored
Executable file
|
@ -0,0 +1,232 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.loadEsmModule = exports.WorkspaceNodeModulesArchitectHost = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const url_1 = require("url");
|
||||
const v8_1 = require("v8");
|
||||
const internal_1 = require("../src/internal");
|
||||
function clone(obj) {
|
||||
try {
|
||||
return (0, v8_1.deserialize)((0, v8_1.serialize)(obj));
|
||||
}
|
||||
catch {
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
}
|
||||
}
|
||||
function findProjectTarget(workspace, project, target) {
|
||||
const projectDefinition = workspace.projects.get(project);
|
||||
if (!projectDefinition) {
|
||||
throw new Error(`Project "${project}" does not exist.`);
|
||||
}
|
||||
const targetDefinition = projectDefinition.targets.get(target);
|
||||
if (!targetDefinition) {
|
||||
throw new Error('Project target does not exist.');
|
||||
}
|
||||
return targetDefinition;
|
||||
}
|
||||
class WorkspaceNodeModulesArchitectHost {
|
||||
_root;
|
||||
workspaceHost;
|
||||
constructor(workspaceOrHost, _root) {
|
||||
this._root = _root;
|
||||
if ('getBuilderName' in workspaceOrHost) {
|
||||
this.workspaceHost = workspaceOrHost;
|
||||
}
|
||||
else {
|
||||
this.workspaceHost = {
|
||||
async getBuilderName(project, target) {
|
||||
const targetDefinition = findProjectTarget(workspaceOrHost, project, target);
|
||||
return targetDefinition.builder;
|
||||
},
|
||||
async getOptions(project, target, configuration) {
|
||||
const targetDefinition = findProjectTarget(workspaceOrHost, project, target);
|
||||
if (configuration === undefined) {
|
||||
return (targetDefinition.options ?? {});
|
||||
}
|
||||
if (!targetDefinition.configurations?.[configuration]) {
|
||||
throw new Error(`Configuration '${configuration}' is not set in the workspace.`);
|
||||
}
|
||||
return (targetDefinition.configurations?.[configuration] ?? {});
|
||||
},
|
||||
async getMetadata(project) {
|
||||
const projectDefinition = workspaceOrHost.projects.get(project);
|
||||
if (!projectDefinition) {
|
||||
throw new Error(`Project "${project}" does not exist.`);
|
||||
}
|
||||
return {
|
||||
root: projectDefinition.root,
|
||||
sourceRoot: projectDefinition.sourceRoot,
|
||||
prefix: projectDefinition.prefix,
|
||||
...clone(workspaceOrHost.extensions),
|
||||
...clone(projectDefinition.extensions),
|
||||
};
|
||||
},
|
||||
async hasTarget(project, target) {
|
||||
return !!workspaceOrHost.projects.get(project)?.targets.has(target);
|
||||
},
|
||||
async getDefaultConfigurationName(project, target) {
|
||||
return workspaceOrHost.projects.get(project)?.targets.get(target)?.defaultConfiguration;
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
async getBuilderNameForTarget(target) {
|
||||
return this.workspaceHost.getBuilderName(target.project, target.target);
|
||||
}
|
||||
/**
|
||||
* Resolve a builder. This needs to be a string which will be used in a dynamic `import()`
|
||||
* clause. This should throw if no builder can be found. The dynamic import will throw if
|
||||
* it is unsupported.
|
||||
* @param builderStr The name of the builder to be used.
|
||||
* @returns All the info needed for the builder itself.
|
||||
*/
|
||||
resolveBuilder(builderStr) {
|
||||
const [packageName, builderName] = builderStr.split(':', 2);
|
||||
if (!builderName) {
|
||||
throw new Error('No builder name specified.');
|
||||
}
|
||||
const packageJsonPath = require.resolve(packageName + '/package.json', {
|
||||
paths: [this._root],
|
||||
});
|
||||
const packageJson = require(packageJsonPath);
|
||||
if (!packageJson['builders']) {
|
||||
throw new Error(`Package ${JSON.stringify(packageName)} has no builders defined.`);
|
||||
}
|
||||
const builderJsonPath = path.resolve(path.dirname(packageJsonPath), packageJson['builders']);
|
||||
const builderJson = require(builderJsonPath);
|
||||
const builder = builderJson.builders && builderJson.builders[builderName];
|
||||
if (!builder) {
|
||||
throw new Error(`Cannot find builder ${JSON.stringify(builderStr)}.`);
|
||||
}
|
||||
const importPath = builder.implementation;
|
||||
if (!importPath) {
|
||||
throw new Error('Could not find the implementation for builder ' + builderStr);
|
||||
}
|
||||
return Promise.resolve({
|
||||
name: builderStr,
|
||||
builderName,
|
||||
description: builder['description'],
|
||||
optionSchema: require(path.resolve(path.dirname(builderJsonPath), builder.schema)),
|
||||
import: path.resolve(path.dirname(builderJsonPath), importPath),
|
||||
});
|
||||
}
|
||||
async getCurrentDirectory() {
|
||||
return process.cwd();
|
||||
}
|
||||
async getWorkspaceRoot() {
|
||||
return this._root;
|
||||
}
|
||||
async getOptionsForTarget(target) {
|
||||
if (!(await this.workspaceHost.hasTarget(target.project, target.target))) {
|
||||
return null;
|
||||
}
|
||||
let options = await this.workspaceHost.getOptions(target.project, target.target);
|
||||
const targetConfiguration = target.configuration ||
|
||||
(await this.workspaceHost.getDefaultConfigurationName(target.project, target.target));
|
||||
if (targetConfiguration) {
|
||||
const configurations = targetConfiguration.split(',').map((c) => c.trim());
|
||||
for (const configuration of configurations) {
|
||||
options = {
|
||||
...options,
|
||||
...(await this.workspaceHost.getOptions(target.project, target.target, configuration)),
|
||||
};
|
||||
}
|
||||
}
|
||||
return clone(options);
|
||||
}
|
||||
async getProjectMetadata(target) {
|
||||
const projectName = typeof target === 'string' ? target : target.project;
|
||||
const metadata = this.workspaceHost.getMetadata(projectName);
|
||||
return metadata;
|
||||
}
|
||||
async loadBuilder(info) {
|
||||
const builder = await getBuilder(info.import);
|
||||
if (builder[internal_1.BuilderSymbol]) {
|
||||
return builder;
|
||||
}
|
||||
// Default handling code is for old builders that incorrectly export `default` with non-ESM module
|
||||
if (builder?.default[internal_1.BuilderSymbol]) {
|
||||
return builder.default;
|
||||
}
|
||||
throw new Error('Builder is not a builder');
|
||||
}
|
||||
}
|
||||
exports.WorkspaceNodeModulesArchitectHost = WorkspaceNodeModulesArchitectHost;
|
||||
/**
|
||||
* Lazily compiled dynamic import loader function.
|
||||
*/
|
||||
let load;
|
||||
/**
|
||||
* This uses a dynamic import to load a module which may be ESM.
|
||||
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
||||
* will currently, unconditionally downlevel dynamic import into a require call.
|
||||
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
||||
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
||||
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
||||
* be dropped.
|
||||
*
|
||||
* @param modulePath The path of the module to load.
|
||||
* @returns A Promise that resolves to the dynamically imported module.
|
||||
*/
|
||||
function loadEsmModule(modulePath) {
|
||||
load ??= new Function('modulePath', `return import(modulePath);`);
|
||||
return load(modulePath);
|
||||
}
|
||||
exports.loadEsmModule = loadEsmModule;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async function getBuilder(builderPath) {
|
||||
switch (path.extname(builderPath)) {
|
||||
case '.mjs':
|
||||
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
||||
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
||||
// changed to a direct dynamic import.
|
||||
return (await loadEsmModule((0, url_1.pathToFileURL)(builderPath))).default;
|
||||
case '.cjs':
|
||||
return require(builderPath);
|
||||
default:
|
||||
// The file could be either CommonJS or ESM.
|
||||
// CommonJS is tried first then ESM if loading fails.
|
||||
try {
|
||||
return require(builderPath);
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code === 'ERR_REQUIRE_ESM') {
|
||||
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
||||
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
||||
// changed to a direct dynamic import.
|
||||
return (await loadEsmModule((0, url_1.pathToFileURL)(builderPath))).default;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
35
my-app/node_modules/@angular-devkit/architect/package.json
generated
vendored
Executable file
35
my-app/node_modules/@angular-devkit/architect/package.json
generated
vendored
Executable file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "@angular-devkit/architect",
|
||||
"version": "0.1701.3",
|
||||
"description": "Angular Build Facade",
|
||||
"experimental": true,
|
||||
"main": "src/index.js",
|
||||
"typings": "src/index.d.ts",
|
||||
"dependencies": {
|
||||
"@angular-devkit/core": "17.1.3",
|
||||
"rxjs": "7.8.1"
|
||||
},
|
||||
"builders": "./builders/builders.json",
|
||||
"keywords": [
|
||||
"Angular CLI",
|
||||
"Angular DevKit",
|
||||
"angular",
|
||||
"devkit",
|
||||
"sdk"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/angular/angular-cli.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.13.0 || >=20.9.0",
|
||||
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
|
||||
"yarn": ">= 1.13.0"
|
||||
},
|
||||
"author": "Angular Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular-cli/issues"
|
||||
},
|
||||
"homepage": "https://github.com/angular/angular-cli"
|
||||
}
|
268
my-app/node_modules/@angular-devkit/architect/src/api.d.ts
generated
vendored
Executable file
268
my-app/node_modules/@angular-devkit/architect/src/api.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,268 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { json, logging } from '@angular-devkit/core';
|
||||
import { Observable, ObservableInput } from 'rxjs';
|
||||
import { Schema as RealBuilderInput, Target as RealTarget } from './input-schema';
|
||||
import { Registry } from './jobs';
|
||||
import { Schema as RealBuilderOutput } from './output-schema';
|
||||
import { State as BuilderProgressState, Schema as RealBuilderProgress } from './progress-schema';
|
||||
export type Target = json.JsonObject & RealTarget;
|
||||
export { BuilderProgressState };
|
||||
export type BuilderRegistry = Registry<json.JsonObject, BuilderInput, BuilderOutput>;
|
||||
/**
|
||||
* An API typed BuilderProgress. The interface generated from the schema is too permissive,
|
||||
* so this API is the one we show in our API. Please note that not all fields are in there; this
|
||||
* is in addition to fields in the schema.
|
||||
*/
|
||||
export type TypedBuilderProgress = {
|
||||
state: BuilderProgressState.Stopped;
|
||||
} | {
|
||||
state: BuilderProgressState.Error;
|
||||
error: json.JsonValue;
|
||||
} | {
|
||||
state: BuilderProgressState.Waiting;
|
||||
status?: string;
|
||||
} | {
|
||||
state: BuilderProgressState.Running;
|
||||
status?: string;
|
||||
current: number;
|
||||
total?: number;
|
||||
};
|
||||
/**
|
||||
* Declaration of those types as JsonObject compatible. JsonObject is not compatible with
|
||||
* optional members, so those wouldn't be directly assignable to our internal Json typings.
|
||||
* Forcing the type to be both a JsonObject and the type from the Schema tells Typescript they
|
||||
* are compatible (which they are).
|
||||
* These types should be used everywhere.
|
||||
*/
|
||||
export type BuilderInput = json.JsonObject & RealBuilderInput;
|
||||
export type BuilderOutput = json.JsonObject & RealBuilderOutput;
|
||||
export type BuilderProgress = json.JsonObject & RealBuilderProgress & TypedBuilderProgress;
|
||||
/**
|
||||
* A progress report is what the tooling will receive. It contains the builder info and the target.
|
||||
* Although these are serializable, they are only exposed through the tooling interface, not the
|
||||
* builder interface. The watch dog sends BuilderProgress and the Builder has a set of functions
|
||||
* to manage the state.
|
||||
*/
|
||||
export type BuilderProgressReport = BuilderProgress & {
|
||||
target?: Target;
|
||||
builder: BuilderInfo;
|
||||
};
|
||||
/**
|
||||
* A Run, which is what is returned by scheduleBuilder or scheduleTarget functions. This should
|
||||
* be reconstructed across memory boundaries (it's not serializable but all internal information
|
||||
* are).
|
||||
*/
|
||||
export interface BuilderRun {
|
||||
/**
|
||||
* Unique amongst runs. This is the same ID as the context generated for the run. It can be
|
||||
* used to identify multiple unique runs. There is no guarantee that a run is a single output;
|
||||
* a builder can rebuild on its own and will generate multiple outputs.
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
* The builder information.
|
||||
*/
|
||||
info: BuilderInfo;
|
||||
/**
|
||||
* The next output from a builder. This is recommended when scheduling a builder and only being
|
||||
* interested in the result of that single run, not of a watch-mode builder.
|
||||
*/
|
||||
result: Promise<BuilderOutput>;
|
||||
/**
|
||||
* The last output from a builder. This is recommended when scheduling a builder and only being
|
||||
* interested in the result of that last run.
|
||||
*/
|
||||
lastOutput: Promise<BuilderOutput>;
|
||||
/**
|
||||
* The output(s) from the builder. A builder can have multiple outputs.
|
||||
* This always replay the last output when subscribed.
|
||||
*/
|
||||
output: Observable<BuilderOutput>;
|
||||
/**
|
||||
* The progress report. A progress also contains an ID, which can be different than this run's
|
||||
* ID (if the builder calls scheduleBuilder or scheduleTarget).
|
||||
* This will always replay the last progress on new subscriptions.
|
||||
*/
|
||||
progress: Observable<BuilderProgressReport>;
|
||||
/**
|
||||
* Stop the builder from running. Returns a promise that resolves when the builder is stopped.
|
||||
* Some builders might not handle stopping properly and should have a timeout here.
|
||||
*/
|
||||
stop(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Additional optional scheduling options.
|
||||
*/
|
||||
export interface ScheduleOptions {
|
||||
/**
|
||||
* Logger to pass to the builder. Note that messages will stop being forwarded, and if you want
|
||||
* to log a builder scheduled from your builder you should forward log events yourself.
|
||||
*/
|
||||
logger?: logging.Logger;
|
||||
/**
|
||||
* Target to pass to the builder.
|
||||
*/
|
||||
target?: Target;
|
||||
}
|
||||
/**
|
||||
* The context received as a second argument in your builder.
|
||||
*/
|
||||
export interface BuilderContext {
|
||||
/**
|
||||
* Unique amongst contexts. Contexts instances are not guaranteed to be the same (but it could
|
||||
* be the same context), and all the fields in a context could be the same, yet the builder's
|
||||
* context could be different. This is the same ID as the corresponding run.
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
* The builder info that called your function. Since the builder info is from the builder.json
|
||||
* (or the host), it could contain information that is different than expected.
|
||||
*/
|
||||
builder: BuilderInfo;
|
||||
/**
|
||||
* A logger that appends messages to a log. This could be a separate interface or completely
|
||||
* ignored. `console.log` could also be completely ignored.
|
||||
*/
|
||||
logger: logging.LoggerApi;
|
||||
/**
|
||||
* The absolute workspace root of this run. This is a system path and will not be normalized;
|
||||
* ie. on Windows it will starts with `C:\\` (or whatever drive).
|
||||
*/
|
||||
workspaceRoot: string;
|
||||
/**
|
||||
* The current directory the user is in. This could be outside the workspace root. This is a
|
||||
* system path and will not be normalized; ie. on Windows it will starts with `C:\\` (or
|
||||
* whatever drive).
|
||||
*/
|
||||
currentDirectory: string;
|
||||
/**
|
||||
* The target that was used to run this builder.
|
||||
* Target is optional if a builder was ran using `scheduleBuilder()`.
|
||||
*/
|
||||
target?: Target;
|
||||
/**
|
||||
* Schedule a target in the same workspace. This can be the same target that is being executed
|
||||
* right now, but targets of the same name are serialized.
|
||||
* Running the same target and waiting for it to end will result in a deadlocking scenario.
|
||||
* Targets are considered the same if the project, the target AND the configuration are the same.
|
||||
* @param target The target to schedule.
|
||||
* @param overrides A set of options to override the workspace set of options.
|
||||
* @param scheduleOptions Additional optional scheduling options.
|
||||
* @return A promise of a run. It will resolve when all the members of the run are available.
|
||||
*/
|
||||
scheduleTarget(target: Target, overrides?: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>;
|
||||
/**
|
||||
* Schedule a builder by its name. This can be the same builder that is being executed.
|
||||
* @param builderName The name of the builder, ie. its `packageName:builderName` tuple.
|
||||
* @param options All options to use for the builder (by default empty object). There is no
|
||||
* additional options added, e.g. from the workspace.
|
||||
* @param scheduleOptions Additional optional scheduling options.
|
||||
* @return A promise of a run. It will resolve when all the members of the run are available.
|
||||
*/
|
||||
scheduleBuilder(builderName: string, options?: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>;
|
||||
/**
|
||||
* Resolve and return options for a specified target. If the target isn't defined in the
|
||||
* workspace this will reject the promise. This object will be read directly from the workspace
|
||||
* but not validated against the builder of the target.
|
||||
* @param target The target to resolve the options of.
|
||||
* @return A non-validated object resolved from the workspace.
|
||||
*/
|
||||
getTargetOptions(target: Target): Promise<json.JsonObject>;
|
||||
getProjectMetadata(projectName: string): Promise<json.JsonObject>;
|
||||
getProjectMetadata(target: Target): Promise<json.JsonObject>;
|
||||
/**
|
||||
* Resolves and return a builder name. The exact format of the name is up to the host,
|
||||
* so it should not be parsed to gather information (it's free form). This string can be
|
||||
* used to validate options or schedule a builder directly.
|
||||
* @param target The target to resolve the builder name.
|
||||
*/
|
||||
getBuilderNameForTarget(target: Target): Promise<string>;
|
||||
/**
|
||||
* Validates the options against a builder schema. This uses the same methods as the
|
||||
* scheduleTarget and scheduleBrowser methods to validate and apply defaults to the options.
|
||||
* It can be generically typed, if you know which interface it is supposed to validate against.
|
||||
* @param options A generic option object to validate.
|
||||
* @param builderName The name of a builder to use. This can be gotten for a target by using the
|
||||
* getBuilderForTarget() method on the context.
|
||||
*/
|
||||
validateOptions<T extends json.JsonObject = json.JsonObject>(options: json.JsonObject, builderName: string): Promise<T>;
|
||||
/**
|
||||
* Set the builder to running. This should be used if an external event triggered a re-run,
|
||||
* e.g. a file watched was changed.
|
||||
*/
|
||||
reportRunning(): void;
|
||||
/**
|
||||
* Update the status string shown on the interface.
|
||||
* @param status The status to set it to. An empty string can be used to remove the status.
|
||||
*/
|
||||
reportStatus(status: string): void;
|
||||
/**
|
||||
* Update the progress for this builder run.
|
||||
* @param current The current progress. This will be between 0 and total.
|
||||
* @param total A new total to set. By default at the start of a run this is 1. If omitted it
|
||||
* will use the same value as the last total.
|
||||
* @param status Update the status string. If omitted the status string is not modified.
|
||||
*/
|
||||
reportProgress(current: number, total?: number, status?: string): void;
|
||||
/**
|
||||
* Add teardown logic to this Context, so that when it's being stopped it will execute teardown.
|
||||
*/
|
||||
addTeardown(teardown: () => Promise<void> | void): void;
|
||||
}
|
||||
/**
|
||||
* An accepted return value from a builder. Can be either an Observable, a Promise or a vector.
|
||||
*/
|
||||
export type BuilderOutputLike = ObservableInput<BuilderOutput> | BuilderOutput;
|
||||
export declare function isBuilderOutput(obj: any): obj is BuilderOutput;
|
||||
export declare function fromAsyncIterable<T>(iterable: AsyncIterable<T>): Observable<T>;
|
||||
/**
|
||||
* A builder handler function. The function signature passed to `createBuilder()`.
|
||||
*/
|
||||
export interface BuilderHandlerFn<A> {
|
||||
/**
|
||||
* Builders are defined by users to perform any kind of task, like building, testing or linting,
|
||||
* and should use this interface.
|
||||
* @param input The options (a JsonObject), validated by the schema and received by the
|
||||
* builder. This can include resolved options from the CLI or the workspace.
|
||||
* @param context A context that can be used to interact with the Architect framework.
|
||||
* @return One or many builder output.
|
||||
*/
|
||||
(input: A, context: BuilderContext): BuilderOutputLike;
|
||||
}
|
||||
/**
|
||||
* A Builder general information. This is generated by the host and is expanded by the host, but
|
||||
* the public API contains those fields.
|
||||
*/
|
||||
export type BuilderInfo = json.JsonObject & {
|
||||
builderName: string;
|
||||
description: string;
|
||||
optionSchema: json.schema.JsonSchema;
|
||||
};
|
||||
/**
|
||||
* Returns a string of "project:target[:configuration]" for the target object.
|
||||
*/
|
||||
export declare function targetStringFromTarget({ project, target, configuration }: Target): string;
|
||||
/**
|
||||
* Return a Target tuple from a string.
|
||||
*/
|
||||
export declare function targetFromTargetString(str: string): Target;
|
||||
/**
|
||||
* Schedule a target, and forget about its run. This will return an observable of outputs, that
|
||||
* as a teardown will stop the target from running. This means that the Run object this returns
|
||||
* should not be shared.
|
||||
*
|
||||
* The reason this is not part of the Context interface is to keep the Context as normal form as
|
||||
* possible. This is really an utility that people would implement in their project.
|
||||
*
|
||||
* @param context The context of your current execution.
|
||||
* @param target The target to schedule.
|
||||
* @param overrides Overrides that are used in the target.
|
||||
* @param scheduleOptions Additional scheduling options.
|
||||
*/
|
||||
export declare function scheduleTargetAndForget(context: BuilderContext, target: Target, overrides?: json.JsonObject, scheduleOptions?: ScheduleOptions): Observable<BuilderOutput>;
|
96
my-app/node_modules/@angular-devkit/architect/src/api.js
generated
vendored
Executable file
96
my-app/node_modules/@angular-devkit/architect/src/api.js
generated
vendored
Executable file
|
@ -0,0 +1,96 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.scheduleTargetAndForget = exports.targetFromTargetString = exports.targetStringFromTarget = exports.fromAsyncIterable = exports.isBuilderOutput = exports.BuilderProgressState = void 0;
|
||||
const rxjs_1 = require("rxjs");
|
||||
const progress_schema_1 = require("./progress-schema");
|
||||
Object.defineProperty(exports, "BuilderProgressState", { enumerable: true, get: function () { return progress_schema_1.State; } });
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function isBuilderOutput(obj) {
|
||||
if (!obj || typeof obj.then === 'function' || typeof obj.subscribe === 'function') {
|
||||
return false;
|
||||
}
|
||||
if (typeof obj[Symbol.asyncIterator] === 'function') {
|
||||
return false;
|
||||
}
|
||||
return typeof obj.success === 'boolean';
|
||||
}
|
||||
exports.isBuilderOutput = isBuilderOutput;
|
||||
function fromAsyncIterable(iterable) {
|
||||
return new rxjs_1.Observable((subscriber) => {
|
||||
handleAsyncIterator(subscriber, iterable[Symbol.asyncIterator]()).then(() => subscriber.complete(), (error) => subscriber.error(error));
|
||||
});
|
||||
}
|
||||
exports.fromAsyncIterable = fromAsyncIterable;
|
||||
async function handleAsyncIterator(subscriber, iterator) {
|
||||
const teardown = new Promise((resolve) => subscriber.add(() => resolve()));
|
||||
try {
|
||||
while (!subscriber.closed) {
|
||||
const result = await Promise.race([teardown, iterator.next()]);
|
||||
if (!result || result.done) {
|
||||
break;
|
||||
}
|
||||
subscriber.next(result.value);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
await iterator.return?.();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns a string of "project:target[:configuration]" for the target object.
|
||||
*/
|
||||
function targetStringFromTarget({ project, target, configuration }) {
|
||||
return `${project}:${target}${configuration !== undefined ? ':' + configuration : ''}`;
|
||||
}
|
||||
exports.targetStringFromTarget = targetStringFromTarget;
|
||||
/**
|
||||
* Return a Target tuple from a string.
|
||||
*/
|
||||
function targetFromTargetString(str) {
|
||||
const tuple = str.split(/:/, 3);
|
||||
if (tuple.length < 2) {
|
||||
throw new Error('Invalid target string: ' + JSON.stringify(str));
|
||||
}
|
||||
return {
|
||||
project: tuple[0],
|
||||
target: tuple[1],
|
||||
...(tuple[2] !== undefined && { configuration: tuple[2] }),
|
||||
};
|
||||
}
|
||||
exports.targetFromTargetString = targetFromTargetString;
|
||||
/**
|
||||
* Schedule a target, and forget about its run. This will return an observable of outputs, that
|
||||
* as a teardown will stop the target from running. This means that the Run object this returns
|
||||
* should not be shared.
|
||||
*
|
||||
* The reason this is not part of the Context interface is to keep the Context as normal form as
|
||||
* possible. This is really an utility that people would implement in their project.
|
||||
*
|
||||
* @param context The context of your current execution.
|
||||
* @param target The target to schedule.
|
||||
* @param overrides Overrides that are used in the target.
|
||||
* @param scheduleOptions Additional scheduling options.
|
||||
*/
|
||||
function scheduleTargetAndForget(context, target, overrides, scheduleOptions) {
|
||||
let resolve = null;
|
||||
const promise = new Promise((r) => (resolve = r));
|
||||
context.addTeardown(() => promise);
|
||||
return (0, rxjs_1.from)(context.scheduleTarget(target, overrides, scheduleOptions)).pipe((0, rxjs_1.switchMap)((run) => new rxjs_1.Observable((observer) => {
|
||||
const subscription = run.output.subscribe(observer);
|
||||
return () => {
|
||||
subscription.unsubscribe();
|
||||
// We can properly ignore the floating promise as it's a "reverse" promise; the teardown
|
||||
// is waiting for the resolve.
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
run.stop().then(resolve);
|
||||
};
|
||||
})));
|
||||
}
|
||||
exports.scheduleTargetAndForget = scheduleTargetAndForget;
|
25
my-app/node_modules/@angular-devkit/architect/src/architect.d.ts
generated
vendored
Executable file
25
my-app/node_modules/@angular-devkit/architect/src/architect.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { json, logging } from '@angular-devkit/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { BuilderRun, Target } from './api';
|
||||
import { ArchitectHost } from './internal';
|
||||
import { JobName, Registry } from './jobs';
|
||||
export interface ScheduleOptions {
|
||||
logger?: logging.Logger;
|
||||
}
|
||||
export declare class Architect {
|
||||
private _host;
|
||||
private readonly _scheduler;
|
||||
private readonly _jobCache;
|
||||
private readonly _infoCache;
|
||||
constructor(_host: ArchitectHost, registry?: json.schema.SchemaRegistry, additionalJobRegistry?: Registry);
|
||||
has(name: JobName): Observable<boolean>;
|
||||
scheduleBuilder(name: string, options: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>;
|
||||
scheduleTarget(target: Target, overrides?: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>;
|
||||
}
|
284
my-app/node_modules/@angular-devkit/architect/src/architect.js
generated
vendored
Executable file
284
my-app/node_modules/@angular-devkit/architect/src/architect.js
generated
vendored
Executable file
|
@ -0,0 +1,284 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Architect = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const api_1 = require("./api");
|
||||
const jobs_1 = require("./jobs");
|
||||
const schedule_by_name_1 = require("./schedule-by-name");
|
||||
const inputSchema = require('./input-schema.json');
|
||||
const outputSchema = require('./output-schema.json');
|
||||
function _createJobHandlerFromBuilderInfo(info, target, host, registry, baseOptions) {
|
||||
const jobDescription = {
|
||||
name: target ? `{${(0, api_1.targetStringFromTarget)(target)}}` : info.builderName,
|
||||
argument: { type: 'object' },
|
||||
input: inputSchema,
|
||||
output: outputSchema,
|
||||
info,
|
||||
};
|
||||
function handler(argument, context) {
|
||||
// Add input validation to the inbound bus.
|
||||
const inboundBusWithInputValidation = context.inboundBus.pipe((0, rxjs_1.concatMap)(async (message) => {
|
||||
if (message.kind === jobs_1.JobInboundMessageKind.Input) {
|
||||
const v = message.value;
|
||||
const options = {
|
||||
...baseOptions,
|
||||
...v.options,
|
||||
};
|
||||
// Validate v against the options schema.
|
||||
const validation = await registry.compile(info.optionSchema);
|
||||
const validationResult = await validation(options);
|
||||
const { data, success, errors } = validationResult;
|
||||
if (!success) {
|
||||
throw new core_1.json.schema.SchemaValidationException(errors);
|
||||
}
|
||||
return { ...message, value: { ...v, options: data } };
|
||||
}
|
||||
else {
|
||||
return message;
|
||||
}
|
||||
}),
|
||||
// Using a share replay because the job might be synchronously sending input, but
|
||||
// asynchronously listening to it.
|
||||
(0, rxjs_1.shareReplay)(1));
|
||||
// Make an inboundBus that completes instead of erroring out.
|
||||
// We'll merge the errors into the output instead.
|
||||
const inboundBus = (0, rxjs_1.onErrorResumeNext)(inboundBusWithInputValidation);
|
||||
const output = (0, rxjs_1.from)(host.loadBuilder(info)).pipe((0, rxjs_1.concatMap)((builder) => {
|
||||
if (builder === null) {
|
||||
throw new Error(`Cannot load builder for builderInfo ${JSON.stringify(info, null, 2)}`);
|
||||
}
|
||||
return builder.handler(argument, { ...context, inboundBus }).pipe((0, rxjs_1.map)((output) => {
|
||||
if (output.kind === jobs_1.JobOutboundMessageKind.Output) {
|
||||
// Add target to it.
|
||||
return {
|
||||
...output,
|
||||
value: {
|
||||
...output.value,
|
||||
...(target ? { target } : 0),
|
||||
},
|
||||
};
|
||||
}
|
||||
else {
|
||||
return output;
|
||||
}
|
||||
}));
|
||||
}),
|
||||
// Share subscriptions to the output, otherwise the handler will be re-run.
|
||||
(0, rxjs_1.shareReplay)());
|
||||
// Separate the errors from the inbound bus into their own observable that completes when the
|
||||
// builder output does.
|
||||
const inboundBusErrors = inboundBusWithInputValidation.pipe((0, rxjs_1.ignoreElements)(), (0, rxjs_1.takeUntil)((0, rxjs_1.onErrorResumeNext)(output.pipe((0, rxjs_1.last)()))));
|
||||
// Return the builder output plus any input errors.
|
||||
return (0, rxjs_1.merge)(inboundBusErrors, output);
|
||||
}
|
||||
return (0, rxjs_1.of)(Object.assign(handler, { jobDescription }));
|
||||
}
|
||||
/**
|
||||
* A JobRegistry that resolves builder targets from the host.
|
||||
*/
|
||||
class ArchitectBuilderJobRegistry {
|
||||
_host;
|
||||
_registry;
|
||||
_jobCache;
|
||||
_infoCache;
|
||||
constructor(_host, _registry, _jobCache, _infoCache) {
|
||||
this._host = _host;
|
||||
this._registry = _registry;
|
||||
this._jobCache = _jobCache;
|
||||
this._infoCache = _infoCache;
|
||||
}
|
||||
_resolveBuilder(name) {
|
||||
const cache = this._infoCache;
|
||||
if (cache) {
|
||||
const maybeCache = cache.get(name);
|
||||
if (maybeCache !== undefined) {
|
||||
return maybeCache;
|
||||
}
|
||||
const info = (0, rxjs_1.from)(this._host.resolveBuilder(name)).pipe((0, rxjs_1.shareReplay)(1));
|
||||
cache.set(name, info);
|
||||
return info;
|
||||
}
|
||||
return (0, rxjs_1.from)(this._host.resolveBuilder(name));
|
||||
}
|
||||
_createBuilder(info, target, options) {
|
||||
const cache = this._jobCache;
|
||||
if (target) {
|
||||
const maybeHit = cache && cache.get((0, api_1.targetStringFromTarget)(target));
|
||||
if (maybeHit) {
|
||||
return maybeHit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const maybeHit = cache && cache.get(info.builderName);
|
||||
if (maybeHit) {
|
||||
return maybeHit;
|
||||
}
|
||||
}
|
||||
const result = _createJobHandlerFromBuilderInfo(info, target, this._host, this._registry, options || {});
|
||||
if (cache) {
|
||||
if (target) {
|
||||
cache.set((0, api_1.targetStringFromTarget)(target), result.pipe((0, rxjs_1.shareReplay)(1)));
|
||||
}
|
||||
else {
|
||||
cache.set(info.builderName, result.pipe((0, rxjs_1.shareReplay)(1)));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
get(name) {
|
||||
const m = name.match(/^([^:]+):([^:]+)$/i);
|
||||
if (!m) {
|
||||
return (0, rxjs_1.of)(null);
|
||||
}
|
||||
return (0, rxjs_1.from)(this._resolveBuilder(name)).pipe((0, rxjs_1.concatMap)((builderInfo) => (builderInfo ? this._createBuilder(builderInfo) : (0, rxjs_1.of)(null))), (0, rxjs_1.first)(null, null));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A JobRegistry that resolves targets from the host.
|
||||
*/
|
||||
class ArchitectTargetJobRegistry extends ArchitectBuilderJobRegistry {
|
||||
get(name) {
|
||||
const m = name.match(/^{([^:]+):([^:]+)(?::([^:]*))?}$/i);
|
||||
if (!m) {
|
||||
return (0, rxjs_1.of)(null);
|
||||
}
|
||||
const target = {
|
||||
project: m[1],
|
||||
target: m[2],
|
||||
configuration: m[3],
|
||||
};
|
||||
return (0, rxjs_1.from)(Promise.all([
|
||||
this._host.getBuilderNameForTarget(target),
|
||||
this._host.getOptionsForTarget(target),
|
||||
])).pipe((0, rxjs_1.concatMap)(([builderStr, options]) => {
|
||||
if (builderStr === null || options === null) {
|
||||
return (0, rxjs_1.of)(null);
|
||||
}
|
||||
return this._resolveBuilder(builderStr).pipe((0, rxjs_1.concatMap)((builderInfo) => {
|
||||
if (builderInfo === null) {
|
||||
return (0, rxjs_1.of)(null);
|
||||
}
|
||||
return this._createBuilder(builderInfo, target, options);
|
||||
}));
|
||||
}), (0, rxjs_1.first)(null, null));
|
||||
}
|
||||
}
|
||||
function _getTargetOptionsFactory(host) {
|
||||
return (0, jobs_1.createJobHandler)((target) => {
|
||||
return host.getOptionsForTarget(target).then((options) => {
|
||||
if (options === null) {
|
||||
throw new Error(`Invalid target: ${JSON.stringify(target)}.`);
|
||||
}
|
||||
return options;
|
||||
});
|
||||
}, {
|
||||
name: '..getTargetOptions',
|
||||
output: { type: 'object' },
|
||||
argument: inputSchema.properties.target,
|
||||
});
|
||||
}
|
||||
function _getProjectMetadataFactory(host) {
|
||||
return (0, jobs_1.createJobHandler)((target) => {
|
||||
return host.getProjectMetadata(target).then((options) => {
|
||||
if (options === null) {
|
||||
throw new Error(`Invalid target: ${JSON.stringify(target)}.`);
|
||||
}
|
||||
return options;
|
||||
});
|
||||
}, {
|
||||
name: '..getProjectMetadata',
|
||||
output: { type: 'object' },
|
||||
argument: {
|
||||
oneOf: [{ type: 'string' }, inputSchema.properties.target],
|
||||
},
|
||||
});
|
||||
}
|
||||
function _getBuilderNameForTargetFactory(host) {
|
||||
return (0, jobs_1.createJobHandler)(async (target) => {
|
||||
const builderName = await host.getBuilderNameForTarget(target);
|
||||
if (!builderName) {
|
||||
throw new Error(`No builder were found for target ${(0, api_1.targetStringFromTarget)(target)}.`);
|
||||
}
|
||||
return builderName;
|
||||
}, {
|
||||
name: '..getBuilderNameForTarget',
|
||||
output: { type: 'string' },
|
||||
argument: inputSchema.properties.target,
|
||||
});
|
||||
}
|
||||
function _validateOptionsFactory(host, registry) {
|
||||
return (0, jobs_1.createJobHandler)(async ([builderName, options]) => {
|
||||
// Get option schema from the host.
|
||||
const builderInfo = await host.resolveBuilder(builderName);
|
||||
if (!builderInfo) {
|
||||
throw new Error(`No builder info were found for builder ${JSON.stringify(builderName)}.`);
|
||||
}
|
||||
const validation = await registry.compile(builderInfo.optionSchema);
|
||||
const { data, success, errors } = await validation(options);
|
||||
if (!success) {
|
||||
throw new core_1.json.schema.SchemaValidationException(errors);
|
||||
}
|
||||
return data;
|
||||
}, {
|
||||
name: '..validateOptions',
|
||||
output: { type: 'object' },
|
||||
argument: {
|
||||
type: 'array',
|
||||
items: [{ type: 'string' }, { type: 'object' }],
|
||||
},
|
||||
});
|
||||
}
|
||||
class Architect {
|
||||
_host;
|
||||
_scheduler;
|
||||
_jobCache = new Map();
|
||||
_infoCache = new Map();
|
||||
constructor(_host, registry = new core_1.json.schema.CoreSchemaRegistry(), additionalJobRegistry) {
|
||||
this._host = _host;
|
||||
const privateArchitectJobRegistry = new jobs_1.SimpleJobRegistry();
|
||||
// Create private jobs.
|
||||
privateArchitectJobRegistry.register(_getTargetOptionsFactory(_host));
|
||||
privateArchitectJobRegistry.register(_getBuilderNameForTargetFactory(_host));
|
||||
privateArchitectJobRegistry.register(_validateOptionsFactory(_host, registry));
|
||||
privateArchitectJobRegistry.register(_getProjectMetadataFactory(_host));
|
||||
const jobRegistry = new jobs_1.FallbackRegistry([
|
||||
new ArchitectTargetJobRegistry(_host, registry, this._jobCache, this._infoCache),
|
||||
new ArchitectBuilderJobRegistry(_host, registry, this._jobCache, this._infoCache),
|
||||
privateArchitectJobRegistry,
|
||||
...(additionalJobRegistry ? [additionalJobRegistry] : []),
|
||||
]);
|
||||
this._scheduler = new jobs_1.SimpleScheduler(jobRegistry, registry);
|
||||
}
|
||||
has(name) {
|
||||
return this._scheduler.has(name);
|
||||
}
|
||||
scheduleBuilder(name, options, scheduleOptions = {}) {
|
||||
// The below will match 'project:target:configuration'
|
||||
if (!/^[^:]+:[^:]+(:[^:]+)?$/.test(name)) {
|
||||
throw new Error('Invalid builder name: ' + JSON.stringify(name));
|
||||
}
|
||||
return (0, schedule_by_name_1.scheduleByName)(name, options, {
|
||||
scheduler: this._scheduler,
|
||||
logger: scheduleOptions.logger || new core_1.logging.NullLogger(),
|
||||
currentDirectory: this._host.getCurrentDirectory(),
|
||||
workspaceRoot: this._host.getWorkspaceRoot(),
|
||||
});
|
||||
}
|
||||
scheduleTarget(target, overrides = {}, scheduleOptions = {}) {
|
||||
return (0, schedule_by_name_1.scheduleByTarget)(target, overrides, {
|
||||
scheduler: this._scheduler,
|
||||
logger: scheduleOptions.logger || new core_1.logging.NullLogger(),
|
||||
currentDirectory: this._host.getCurrentDirectory(),
|
||||
workspaceRoot: this._host.getWorkspaceRoot(),
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Architect = Architect;
|
32
my-app/node_modules/@angular-devkit/architect/src/builders-schema.d.ts
generated
vendored
Executable file
32
my-app/node_modules/@angular-devkit/architect/src/builders-schema.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,32 @@
|
|||
export interface Schema {
|
||||
/**
|
||||
* Link to schema.
|
||||
*/
|
||||
$schema?: string;
|
||||
builders: {
|
||||
[key: string]: Builder;
|
||||
};
|
||||
[property: string]: any;
|
||||
}
|
||||
/**
|
||||
* Target options for Builders.
|
||||
*/
|
||||
export interface Builder {
|
||||
/**
|
||||
* The builder class module.
|
||||
*/
|
||||
class?: string;
|
||||
/**
|
||||
* Builder description.
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* The next generation builder module.
|
||||
*/
|
||||
implementation?: string;
|
||||
/**
|
||||
* Schema for builder option validation.
|
||||
*/
|
||||
schema: string;
|
||||
[property: string]: any;
|
||||
}
|
4
my-app/node_modules/@angular-devkit/architect/src/builders-schema.js
generated
vendored
Executable file
4
my-app/node_modules/@angular-devkit/architect/src/builders-schema.js
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
"use strict";
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
||||
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
62
my-app/node_modules/@angular-devkit/architect/src/builders-schema.json
generated
vendored
Executable file
62
my-app/node_modules/@angular-devkit/architect/src/builders-schema.json
generated
vendored
Executable file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"$id": "BuildersSchema",
|
||||
"title": "Builders schema for validating a list of builders.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"description": "Link to schema."
|
||||
},
|
||||
"builders": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/builder"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["builders"],
|
||||
"definitions": {
|
||||
"builder": {
|
||||
"type": "object",
|
||||
"description": "Target options for Builders.",
|
||||
"allOf": [
|
||||
{
|
||||
"properties": {
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"description": "Schema for builder option validation."
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Builder description."
|
||||
}
|
||||
},
|
||||
"required": ["schema", "description"]
|
||||
},
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"properties": {
|
||||
"implementation": {
|
||||
"type": "string",
|
||||
"description": "The next generation builder module."
|
||||
}
|
||||
},
|
||||
"required": ["implementation"]
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"class": {
|
||||
"type": "string",
|
||||
"description": "The builder class module."
|
||||
}
|
||||
},
|
||||
"required": ["class"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
11
my-app/node_modules/@angular-devkit/architect/src/create-builder.d.ts
generated
vendored
Executable file
11
my-app/node_modules/@angular-devkit/architect/src/create-builder.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { json } from '@angular-devkit/core';
|
||||
import { BuilderHandlerFn, BuilderOutput } from './api';
|
||||
import { Builder } from './internal';
|
||||
export declare function createBuilder<OptT = json.JsonObject, OutT extends BuilderOutput = BuilderOutput>(fn: BuilderHandlerFn<OptT>): Builder<OptT & json.JsonObject>;
|
181
my-app/node_modules/@angular-devkit/architect/src/create-builder.js
generated
vendored
Executable file
181
my-app/node_modules/@angular-devkit/architect/src/create-builder.js
generated
vendored
Executable file
|
@ -0,0 +1,181 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createBuilder = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const api_1 = require("./api");
|
||||
const internal_1 = require("./internal");
|
||||
const jobs_1 = require("./jobs");
|
||||
const schedule_by_name_1 = require("./schedule-by-name");
|
||||
// eslint-disable-next-line max-lines-per-function
|
||||
function createBuilder(fn) {
|
||||
const cjh = jobs_1.createJobHandler;
|
||||
// eslint-disable-next-line max-lines-per-function
|
||||
const handler = cjh((options, context) => {
|
||||
const scheduler = context.scheduler;
|
||||
const progressChannel = context.createChannel('progress');
|
||||
const logChannel = context.createChannel('log');
|
||||
const addTeardown = context.addTeardown.bind(context);
|
||||
let currentState = api_1.BuilderProgressState.Stopped;
|
||||
let current = 0;
|
||||
let status = '';
|
||||
let total = 1;
|
||||
function log(entry) {
|
||||
logChannel.next(entry);
|
||||
}
|
||||
function progress(progress, context) {
|
||||
currentState = progress.state;
|
||||
if (progress.state === api_1.BuilderProgressState.Running) {
|
||||
current = progress.current;
|
||||
total = progress.total !== undefined ? progress.total : total;
|
||||
if (progress.status === undefined) {
|
||||
progress.status = status;
|
||||
}
|
||||
else {
|
||||
status = progress.status;
|
||||
}
|
||||
}
|
||||
progressChannel.next({
|
||||
...progress,
|
||||
...(context.target && { target: context.target }),
|
||||
...(context.builder && { builder: context.builder }),
|
||||
id: context.id,
|
||||
});
|
||||
}
|
||||
return new rxjs_1.Observable((observer) => {
|
||||
const subscriptions = [];
|
||||
const inputSubscription = context.inboundBus.subscribe((i) => {
|
||||
switch (i.kind) {
|
||||
case jobs_1.JobInboundMessageKind.Input:
|
||||
onInput(i.value);
|
||||
break;
|
||||
}
|
||||
});
|
||||
function onInput(i) {
|
||||
const builder = i.info;
|
||||
const loggerName = i.target
|
||||
? (0, api_1.targetStringFromTarget)(i.target)
|
||||
: builder.builderName;
|
||||
const logger = new core_1.logging.Logger(loggerName);
|
||||
subscriptions.push(logger.subscribe((entry) => log(entry)));
|
||||
const context = {
|
||||
builder,
|
||||
workspaceRoot: i.workspaceRoot,
|
||||
currentDirectory: i.currentDirectory,
|
||||
target: i.target,
|
||||
logger: logger,
|
||||
id: i.id,
|
||||
async scheduleTarget(target, overrides = {}, scheduleOptions = {}) {
|
||||
const run = await (0, schedule_by_name_1.scheduleByTarget)(target, overrides, {
|
||||
scheduler,
|
||||
logger: scheduleOptions.logger || logger.createChild(''),
|
||||
workspaceRoot: i.workspaceRoot,
|
||||
currentDirectory: i.currentDirectory,
|
||||
});
|
||||
// We don't want to subscribe errors and complete.
|
||||
subscriptions.push(run.progress.subscribe((event) => progressChannel.next(event)));
|
||||
return run;
|
||||
},
|
||||
async scheduleBuilder(builderName, options = {}, scheduleOptions = {}) {
|
||||
const run = await (0, schedule_by_name_1.scheduleByName)(builderName, options, {
|
||||
scheduler,
|
||||
target: scheduleOptions.target,
|
||||
logger: scheduleOptions.logger || logger.createChild(''),
|
||||
workspaceRoot: i.workspaceRoot,
|
||||
currentDirectory: i.currentDirectory,
|
||||
});
|
||||
// We don't want to subscribe errors and complete.
|
||||
subscriptions.push(run.progress.subscribe((event) => progressChannel.next(event)));
|
||||
return run;
|
||||
},
|
||||
async getTargetOptions(target) {
|
||||
return (0, rxjs_1.firstValueFrom)(scheduler.schedule('..getTargetOptions', target).output);
|
||||
},
|
||||
async getProjectMetadata(target) {
|
||||
return (0, rxjs_1.firstValueFrom)(scheduler.schedule('..getProjectMetadata', target).output);
|
||||
},
|
||||
async getBuilderNameForTarget(target) {
|
||||
return (0, rxjs_1.firstValueFrom)(scheduler.schedule('..getBuilderNameForTarget', target).output);
|
||||
},
|
||||
async validateOptions(options, builderName) {
|
||||
return (0, rxjs_1.firstValueFrom)(scheduler.schedule('..validateOptions', [builderName, options]).output);
|
||||
},
|
||||
reportRunning() {
|
||||
switch (currentState) {
|
||||
case api_1.BuilderProgressState.Waiting:
|
||||
case api_1.BuilderProgressState.Stopped:
|
||||
progress({ state: api_1.BuilderProgressState.Running, current: 0, total }, context);
|
||||
break;
|
||||
}
|
||||
},
|
||||
reportStatus(status) {
|
||||
switch (currentState) {
|
||||
case api_1.BuilderProgressState.Running:
|
||||
progress({ state: currentState, status, current, total }, context);
|
||||
break;
|
||||
case api_1.BuilderProgressState.Waiting:
|
||||
progress({ state: currentState, status }, context);
|
||||
break;
|
||||
}
|
||||
},
|
||||
reportProgress(current, total, status) {
|
||||
switch (currentState) {
|
||||
case api_1.BuilderProgressState.Running:
|
||||
progress({ state: currentState, current, total, status }, context);
|
||||
}
|
||||
},
|
||||
addTeardown,
|
||||
};
|
||||
context.reportRunning();
|
||||
let result;
|
||||
try {
|
||||
result = fn(i.options, context);
|
||||
if ((0, api_1.isBuilderOutput)(result)) {
|
||||
result = (0, rxjs_1.of)(result);
|
||||
}
|
||||
else if (!(0, rxjs_1.isObservable)(result) && isAsyncIterable(result)) {
|
||||
result = (0, api_1.fromAsyncIterable)(result);
|
||||
}
|
||||
else {
|
||||
result = (0, rxjs_1.from)(result);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
result = (0, rxjs_1.throwError)(e);
|
||||
}
|
||||
// Manage some state automatically.
|
||||
progress({ state: api_1.BuilderProgressState.Running, current: 0, total: 1 }, context);
|
||||
subscriptions.push(result
|
||||
.pipe((0, rxjs_1.defaultIfEmpty)({ success: false }), (0, rxjs_1.tap)(() => {
|
||||
progress({ state: api_1.BuilderProgressState.Running, current: total }, context);
|
||||
progress({ state: api_1.BuilderProgressState.Stopped }, context);
|
||||
}), (0, rxjs_1.mergeMap)(async (value) => {
|
||||
// Allow the log queue to flush
|
||||
await new Promise(setImmediate);
|
||||
return value;
|
||||
}))
|
||||
.subscribe((message) => observer.next(message), (error) => observer.error(error), () => observer.complete()));
|
||||
}
|
||||
return () => {
|
||||
subscriptions.forEach((x) => x.unsubscribe());
|
||||
inputSubscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
});
|
||||
return {
|
||||
handler,
|
||||
[internal_1.BuilderSymbol]: true,
|
||||
[internal_1.BuilderVersionSymbol]: require('../package.json').version,
|
||||
};
|
||||
}
|
||||
exports.createBuilder = createBuilder;
|
||||
function isAsyncIterable(obj) {
|
||||
return !!obj && typeof obj[Symbol.asyncIterator] === 'function';
|
||||
}
|
12
my-app/node_modules/@angular-devkit/architect/src/index.d.ts
generated
vendored
Executable file
12
my-app/node_modules/@angular-devkit/architect/src/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import * as jobs from './jobs';
|
||||
export * from './api';
|
||||
export { Architect, ScheduleOptions } from './architect';
|
||||
export { createBuilder } from './create-builder';
|
||||
export { jobs };
|
43
my-app/node_modules/@angular-devkit/architect/src/index.js
generated
vendored
Executable file
43
my-app/node_modules/@angular-devkit/architect/src/index.js
generated
vendored
Executable file
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jobs = exports.createBuilder = exports.Architect = void 0;
|
||||
const jobs = __importStar(require("./jobs"));
|
||||
exports.jobs = jobs;
|
||||
__exportStar(require("./api"), exports);
|
||||
var architect_1 = require("./architect");
|
||||
Object.defineProperty(exports, "Architect", { enumerable: true, get: function () { return architect_1.Architect; } });
|
||||
var create_builder_1 = require("./create-builder");
|
||||
Object.defineProperty(exports, "createBuilder", { enumerable: true, get: function () { return create_builder_1.createBuilder; } });
|
19
my-app/node_modules/@angular-devkit/architect/src/input-schema.d.ts
generated
vendored
Executable file
19
my-app/node_modules/@angular-devkit/architect/src/input-schema.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,19 @@
|
|||
export interface Schema {
|
||||
currentDirectory: string;
|
||||
id: number;
|
||||
info: {
|
||||
[key: string]: any;
|
||||
};
|
||||
options?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
target?: Target;
|
||||
workspaceRoot: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface Target {
|
||||
configuration?: string;
|
||||
project: string;
|
||||
target: string;
|
||||
[property: string]: any;
|
||||
}
|
4
my-app/node_modules/@angular-devkit/architect/src/input-schema.js
generated
vendored
Executable file
4
my-app/node_modules/@angular-devkit/architect/src/input-schema.js
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
"use strict";
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
||||
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
39
my-app/node_modules/@angular-devkit/architect/src/input-schema.json
generated
vendored
Executable file
39
my-app/node_modules/@angular-devkit/architect/src/input-schema.json
generated
vendored
Executable file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"$id": "BuilderInputSchema",
|
||||
"title": "Input schema for builders.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"workspaceRoot": {
|
||||
"type": "string"
|
||||
},
|
||||
"currentDirectory": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"target": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"project": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
},
|
||||
"configuration": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["project", "target"]
|
||||
},
|
||||
"info": {
|
||||
"type": "object"
|
||||
},
|
||||
"options": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": ["currentDirectory", "id", "info", "workspaceRoot"]
|
||||
}
|
67
my-app/node_modules/@angular-devkit/architect/src/internal.d.ts
generated
vendored
Executable file
67
my-app/node_modules/@angular-devkit/architect/src/internal.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { json } from '@angular-devkit/core';
|
||||
import { BuilderInfo, BuilderInput, BuilderOutput, Target } from './api';
|
||||
import { JobDescription, JobHandler } from './jobs';
|
||||
/**
|
||||
* BuilderSymbol used for knowing if a function was created using createBuilder(). This is a
|
||||
* property set on the function that should be `true`.
|
||||
* Using Symbol.for() as it's a global registry that's the same for all installations of
|
||||
* Architect (if some libraries depends directly on architect instead of sharing the files).
|
||||
*/
|
||||
export declare const BuilderSymbol: unique symbol;
|
||||
/**
|
||||
* BuilderVersionSymbol used for knowing which version of the library createBuilder() came from.
|
||||
* This is to make sure we don't try to use an incompatible builder.
|
||||
* Using Symbol.for() as it's a global registry that's the same for all installations of
|
||||
* Architect (if some libraries depends directly on architect instead of sharing the files).
|
||||
*/
|
||||
export declare const BuilderVersionSymbol: unique symbol;
|
||||
/**
|
||||
* A Specialization of the JobHandler type. This exposes BuilderDescription as the job description
|
||||
* type.
|
||||
*/
|
||||
export type BuilderJobHandler<A extends json.JsonObject = json.JsonObject, I extends BuilderInput = BuilderInput, O extends BuilderOutput = BuilderOutput> = JobHandler<A, I, O> & {
|
||||
jobDescription: BuilderDescription;
|
||||
};
|
||||
/**
|
||||
* A Builder description, which is used internally. Adds the builder info which is the
|
||||
* metadata attached to a builder in Architect.
|
||||
*/
|
||||
export interface BuilderDescription extends JobDescription {
|
||||
info: BuilderInfo;
|
||||
}
|
||||
/**
|
||||
* A Builder instance. Use createBuilder() to create one of these.
|
||||
*/
|
||||
export interface Builder<OptionT extends json.JsonObject = json.JsonObject> {
|
||||
handler: JobHandler<json.JsonObject, BuilderInput, BuilderOutput>;
|
||||
[BuilderSymbol]: true;
|
||||
[BuilderVersionSymbol]: string;
|
||||
}
|
||||
export interface ArchitectHost<BuilderInfoT extends BuilderInfo = BuilderInfo> {
|
||||
/**
|
||||
* Get the builder name for a target.
|
||||
* @param target The target to inspect.
|
||||
*/
|
||||
getBuilderNameForTarget(target: Target): Promise<string | null>;
|
||||
/**
|
||||
* Resolve a builder. This needs to return a string which will be used in a dynamic `import()`
|
||||
* clause. This should throw if no builder can be found. The dynamic import will throw if
|
||||
* it is unsupported.
|
||||
* @param builderName The name of the builder to be used.
|
||||
* @returns All the info needed for the builder itself.
|
||||
*/
|
||||
resolveBuilder(builderName: string): Promise<BuilderInfoT | null>;
|
||||
loadBuilder(info: BuilderInfoT): Promise<Builder | null>;
|
||||
getCurrentDirectory(): Promise<string>;
|
||||
getWorkspaceRoot(): Promise<string>;
|
||||
getOptionsForTarget(target: Target): Promise<json.JsonObject | null>;
|
||||
getProjectMetadata(projectName: string): Promise<json.JsonObject | null>;
|
||||
getProjectMetadata(target: Target): Promise<json.JsonObject | null>;
|
||||
}
|
26
my-app/node_modules/@angular-devkit/architect/src/internal.js
generated
vendored
Executable file
26
my-app/node_modules/@angular-devkit/architect/src/internal.js
generated
vendored
Executable file
|
@ -0,0 +1,26 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BuilderVersionSymbol = exports.BuilderSymbol = void 0;
|
||||
// Internal types that should not be exported directly. These are used by the host and architect
|
||||
// itself. Host implementations should import the host.ts file.
|
||||
/**
|
||||
* BuilderSymbol used for knowing if a function was created using createBuilder(). This is a
|
||||
* property set on the function that should be `true`.
|
||||
* Using Symbol.for() as it's a global registry that's the same for all installations of
|
||||
* Architect (if some libraries depends directly on architect instead of sharing the files).
|
||||
*/
|
||||
exports.BuilderSymbol = Symbol.for('@angular-devkit/architect:builder');
|
||||
/**
|
||||
* BuilderVersionSymbol used for knowing which version of the library createBuilder() came from.
|
||||
* This is to make sure we don't try to use an incompatible builder.
|
||||
* Using Symbol.for() as it's a global registry that's the same for all installations of
|
||||
* Architect (if some libraries depends directly on architect instead of sharing the files).
|
||||
*/
|
||||
exports.BuilderVersionSymbol = Symbol.for('@angular-devkit/architect:version');
|
332
my-app/node_modules/@angular-devkit/architect/src/jobs/api.d.ts
generated
vendored
Executable file
332
my-app/node_modules/@angular-devkit/architect/src/jobs/api.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,332 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { JsonObject, JsonValue, schema } from '@angular-devkit/core';
|
||||
import { Observable, Observer } from 'rxjs';
|
||||
import { DeepReadonly } from './types';
|
||||
/**
|
||||
* A job name is just a string (needs to be serializable).
|
||||
*/
|
||||
export type JobName = string;
|
||||
/**
|
||||
* The job handler function, which is a method that's executed for the job.
|
||||
*/
|
||||
export interface JobHandler<ArgT extends JsonValue, InputT extends JsonValue, OutputT extends JsonValue> {
|
||||
(argument: ArgT, context: JobHandlerContext<ArgT, InputT, OutputT>): Observable<JobOutboundMessage<OutputT>>;
|
||||
jobDescription: Partial<JobDescription>;
|
||||
}
|
||||
/**
|
||||
* The context in which the job is run.
|
||||
*/
|
||||
export interface JobHandlerContext<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> {
|
||||
readonly description: JobDescription;
|
||||
readonly scheduler: Scheduler<JsonValue, JsonValue, JsonValue>;
|
||||
readonly dependencies: Job<JsonValue, JsonValue, JsonValue>[];
|
||||
readonly inboundBus: Observable<JobInboundMessage<MinimumInputValueT>>;
|
||||
}
|
||||
/**
|
||||
* Metadata associated with a job.
|
||||
*/
|
||||
export interface JobDescription extends JsonObject {
|
||||
readonly name: JobName;
|
||||
readonly argument: DeepReadonly<schema.JsonSchema>;
|
||||
readonly input: DeepReadonly<schema.JsonSchema>;
|
||||
readonly output: DeepReadonly<schema.JsonSchema>;
|
||||
}
|
||||
/**
|
||||
* Messages that can be sent TO a job. The job needs to listen to those.
|
||||
*/
|
||||
export declare enum JobInboundMessageKind {
|
||||
Ping = "ip",
|
||||
Stop = "is",
|
||||
Input = "in"
|
||||
}
|
||||
/** Base interface for the all job inbound messages. */
|
||||
export interface JobInboundMessageBase extends JsonObject {
|
||||
/**
|
||||
* The kind of message this is.
|
||||
*/
|
||||
readonly kind: JobInboundMessageKind;
|
||||
}
|
||||
/**
|
||||
* A ping to the job. The job should reply with a pong as soon as possible.
|
||||
*/
|
||||
export interface JobInboundMessagePing extends JobInboundMessageBase {
|
||||
readonly kind: JobInboundMessageKind.Ping;
|
||||
/**
|
||||
* An ID that should be returned in the corresponding Pong.
|
||||
*/
|
||||
readonly id: number;
|
||||
}
|
||||
/**
|
||||
* Stop the job. This is handled by the job itself and jobs might not handle it. It will also
|
||||
* unsubscribe from the Observable<>.
|
||||
* This is equivalent to SIGTERM.
|
||||
*/
|
||||
export interface JobInboundMessageStop extends JobInboundMessageBase {
|
||||
readonly kind: JobInboundMessageKind.Stop;
|
||||
}
|
||||
/**
|
||||
* A Job wants to send a message to a channel. This can be marshaled, and the Job object
|
||||
* has helpers to transform this into an observable. The context also can create RxJS subjects that
|
||||
* marshall messages through a channel.
|
||||
*/
|
||||
export interface JobInboundMessageInput<InputT extends JsonValue> extends JobInboundMessageBase {
|
||||
readonly kind: JobInboundMessageKind.Input;
|
||||
/**
|
||||
* The input being sent to the job.
|
||||
*/
|
||||
readonly value: InputT;
|
||||
}
|
||||
export type JobInboundMessage<InputT extends JsonValue> = JobInboundMessagePing | JobInboundMessageStop | JobInboundMessageInput<InputT>;
|
||||
/**
|
||||
* Kind of messages that can be outputted from a job.
|
||||
*/
|
||||
export declare enum JobOutboundMessageKind {
|
||||
OnReady = "c",
|
||||
Start = "s",
|
||||
End = "e",
|
||||
Pong = "p",
|
||||
Output = "o",
|
||||
ChannelCreate = "cn",
|
||||
ChannelMessage = "cm",
|
||||
ChannelError = "ce",
|
||||
ChannelComplete = "cc"
|
||||
}
|
||||
/** Base interface for the all job messages. */
|
||||
export interface JobOutboundMessageBase {
|
||||
/**
|
||||
* The job description.
|
||||
*/
|
||||
readonly description: JobDescription;
|
||||
/**
|
||||
* The kind of message this is.
|
||||
*/
|
||||
readonly kind: JobOutboundMessageKind;
|
||||
}
|
||||
/**
|
||||
* The job has been created and will validate its input.
|
||||
*/
|
||||
export interface JobOutboundMessageOnReady extends JobOutboundMessageBase {
|
||||
readonly kind: JobOutboundMessageKind.OnReady;
|
||||
}
|
||||
/**
|
||||
* The job started. This is done by the job itself.
|
||||
*/
|
||||
export interface JobOutboundMessageStart extends JobOutboundMessageBase {
|
||||
readonly kind: JobOutboundMessageKind.Start;
|
||||
}
|
||||
/**
|
||||
* An output value is available.
|
||||
*/
|
||||
export interface JobOutboundMessageOutput<OutputT extends JsonValue> extends JobOutboundMessageBase {
|
||||
readonly kind: JobOutboundMessageKind.Output;
|
||||
/**
|
||||
* The message being outputted from the job.
|
||||
*/
|
||||
readonly value: OutputT;
|
||||
}
|
||||
/**
|
||||
* Base interface for all job message related to channels.
|
||||
*/
|
||||
export interface JobOutboundMessageChannelBase extends JobOutboundMessageBase {
|
||||
/**
|
||||
* The name of the channel.
|
||||
*/
|
||||
readonly name: string;
|
||||
}
|
||||
/**
|
||||
* A job wants to send a message to a channel. This can be marshaled, and the Job object
|
||||
* has helpers to transform this into an observable. The context also can create RxJS subjects that
|
||||
* marshall messages through a channel.
|
||||
*/
|
||||
export interface JobOutboundMessageChannelMessage extends JobOutboundMessageChannelBase {
|
||||
readonly kind: JobOutboundMessageKind.ChannelMessage;
|
||||
/**
|
||||
* The message being sent to the channel.
|
||||
*/
|
||||
readonly message: JsonValue;
|
||||
}
|
||||
/**
|
||||
* A job wants to send an error to one of its channel. This is the equivalent of throwing through
|
||||
* an Observable. The side channel will not receive any more messages after this, and will not
|
||||
* complete.
|
||||
*/
|
||||
export interface JobOutboundMessageChannelError extends JobOutboundMessageChannelBase {
|
||||
readonly kind: JobOutboundMessageKind.ChannelError;
|
||||
/**
|
||||
* The error message being sent to the channel.
|
||||
*/
|
||||
readonly error: JsonValue;
|
||||
}
|
||||
/**
|
||||
* A job wants to create a new channel.
|
||||
*/
|
||||
export interface JobOutboundMessageChannelCreate extends JobOutboundMessageChannelBase {
|
||||
readonly kind: JobOutboundMessageKind.ChannelCreate;
|
||||
}
|
||||
/**
|
||||
* A job wants to close the channel, as completed. This is done automatically when the job ends,
|
||||
* or can be done from the job to close it. A closed channel might be reopened, but the user
|
||||
* need to recall getChannel().
|
||||
*/
|
||||
export interface JobOutboundMessageChannelComplete extends JobOutboundMessageChannelBase {
|
||||
readonly kind: JobOutboundMessageKind.ChannelComplete;
|
||||
}
|
||||
/**
|
||||
* OnEnd of the job run.
|
||||
*/
|
||||
export interface JobOutboundMessageEnd extends JobOutboundMessageBase {
|
||||
readonly kind: JobOutboundMessageKind.End;
|
||||
}
|
||||
/**
|
||||
* A pong response from a ping input. The id is the same as the one passed in.
|
||||
*/
|
||||
export interface JobOutboundMessagePong extends JobOutboundMessageBase {
|
||||
readonly kind: JobOutboundMessageKind.Pong;
|
||||
/**
|
||||
* The ID that was passed in the `Ping` messages.
|
||||
*/
|
||||
readonly id: number;
|
||||
}
|
||||
/**
|
||||
* Generic message type.
|
||||
*/
|
||||
export type JobOutboundMessage<OutputT extends JsonValue> = JobOutboundMessageOnReady | JobOutboundMessageStart | JobOutboundMessageOutput<OutputT> | JobOutboundMessageChannelCreate | JobOutboundMessageChannelMessage | JobOutboundMessageChannelError | JobOutboundMessageChannelComplete | JobOutboundMessageEnd | JobOutboundMessagePong;
|
||||
/**
|
||||
* The state of a job. These are changed as the job reports a new state through its messages.
|
||||
*/
|
||||
export declare enum JobState {
|
||||
/**
|
||||
* The job was queued and is waiting to start.
|
||||
*/
|
||||
Queued = "queued",
|
||||
/**
|
||||
* The job description was found, its dependencies (see "Synchronizing and Dependencies")
|
||||
* are done running, and the job's argument is validated and the job's code will be executed.
|
||||
*/
|
||||
Ready = "ready",
|
||||
/**
|
||||
* The job has been started. The job implementation is expected to send this as soon as its
|
||||
* work is starting.
|
||||
*/
|
||||
Started = "started",
|
||||
/**
|
||||
* The job has ended and is done running.
|
||||
*/
|
||||
Ended = "ended",
|
||||
/**
|
||||
* An error occured and the job stopped because of internal state.
|
||||
*/
|
||||
Errored = "errored"
|
||||
}
|
||||
/**
|
||||
* A Job instance, returned from scheduling a job. A Job instance is _not_ serializable.
|
||||
*/
|
||||
export interface Job<ArgumentT extends JsonValue = JsonValue, InputT extends JsonValue = JsonValue, OutputT extends JsonValue = JsonValue> {
|
||||
/**
|
||||
* Description of the job. Resolving the job's description can be done asynchronously, so this
|
||||
* is an observable that will resolve when it's ready.
|
||||
*/
|
||||
readonly description: Observable<JobDescription>;
|
||||
/**
|
||||
* Argument sent when scheduling the job. This is a copy of the argument.
|
||||
*/
|
||||
readonly argument: ArgumentT;
|
||||
/**
|
||||
* The input to the job. This goes through the input channel as messages.
|
||||
*/
|
||||
readonly input: Observer<InputT>;
|
||||
/**
|
||||
* Outputs of this job.
|
||||
*/
|
||||
readonly output: Observable<OutputT>;
|
||||
/**
|
||||
* The current state of the job.
|
||||
*/
|
||||
readonly state: JobState;
|
||||
/**
|
||||
* Get a channel that validates against the schema. Messages will be filtered by the schema.
|
||||
* @param name The name of the channel.
|
||||
* @param schema A schema to use to validate messages.
|
||||
*/
|
||||
getChannel<T extends JsonValue>(name: string, schema?: schema.JsonSchema): Observable<T>;
|
||||
/**
|
||||
* Pings the job and wait for the resulting Pong before completing.
|
||||
*/
|
||||
ping(): Observable<never>;
|
||||
/**
|
||||
* Stops the job from running. This is different than unsubscribing from the output as in it
|
||||
* sends the JobInboundMessageKind.Stop raw input to the job.
|
||||
*/
|
||||
stop(): void;
|
||||
/**
|
||||
* The JobInboundMessage messages TO the job.
|
||||
*/
|
||||
readonly inboundBus: Observer<JobInboundMessage<InputT>>;
|
||||
/**
|
||||
* The JobOutboundMessage FROM the job.
|
||||
*/
|
||||
readonly outboundBus: Observable<JobOutboundMessage<OutputT>>;
|
||||
}
|
||||
/**
|
||||
* Options for scheduling jobs.
|
||||
*/
|
||||
export interface ScheduleJobOptions {
|
||||
/**
|
||||
* Jobs that need to finish before scheduling this job. These dependencies will be passed
|
||||
* to the job itself in its context.
|
||||
*/
|
||||
dependencies?: Job | Job[];
|
||||
}
|
||||
export interface Registry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> {
|
||||
/**
|
||||
* Get a job handler.
|
||||
* @param name The name of the job to get a handler from.
|
||||
*/
|
||||
get<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: JobName): Observable<JobHandler<A, I, O> | null>;
|
||||
}
|
||||
/**
|
||||
* An interface that can schedule jobs.
|
||||
*/
|
||||
export interface Scheduler<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> {
|
||||
/**
|
||||
* Get a job description for a named job.
|
||||
*
|
||||
* @param name The name of the job.
|
||||
* @returns A description, or null if no description is available for this job.
|
||||
*/
|
||||
getDescription(name: JobName): Observable<JobDescription | null>;
|
||||
/**
|
||||
* Returns true if the job name has been registered.
|
||||
* @param name The name of the job.
|
||||
* @returns True if the job exists, false otherwise.
|
||||
*/
|
||||
has(name: JobName): Observable<boolean>;
|
||||
/**
|
||||
* Pause the scheduler, temporary queueing _new_ jobs. Returns a resume function that should be
|
||||
* used to resume execution. If multiple `pause()` were called, all their resume functions must
|
||||
* be called before the Scheduler actually starts new jobs. Additional calls to the same resume
|
||||
* function will have no effect.
|
||||
*
|
||||
* Jobs already running are NOT paused. This is pausing the scheduler only.
|
||||
*
|
||||
* @returns A function that can be run to resume the scheduler. If multiple `pause()` calls
|
||||
* were made, all their return function must be called (in any order) before the
|
||||
* scheduler can resume.
|
||||
*/
|
||||
pause(): () => void;
|
||||
/**
|
||||
* Schedule a job to be run, using its name.
|
||||
* @param name The name of job to be run.
|
||||
* @param argument The argument to send to the job when starting it.
|
||||
* @param options Scheduling options.
|
||||
* @returns The job being run.
|
||||
*/
|
||||
schedule<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: JobName, argument: A, options?: ScheduleJobOptions): Job<A, I, O>;
|
||||
}
|
||||
export declare function isJobHandler<A extends JsonValue, I extends JsonValue, O extends JsonValue>(value: unknown): value is JobHandler<A, I, O>;
|
73
my-app/node_modules/@angular-devkit/architect/src/jobs/api.js
generated
vendored
Executable file
73
my-app/node_modules/@angular-devkit/architect/src/jobs/api.js
generated
vendored
Executable file
|
@ -0,0 +1,73 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isJobHandler = exports.JobState = exports.JobOutboundMessageKind = exports.JobInboundMessageKind = void 0;
|
||||
/**
|
||||
* Messages that can be sent TO a job. The job needs to listen to those.
|
||||
*/
|
||||
var JobInboundMessageKind;
|
||||
(function (JobInboundMessageKind) {
|
||||
JobInboundMessageKind["Ping"] = "ip";
|
||||
JobInboundMessageKind["Stop"] = "is";
|
||||
// Channel specific messages.
|
||||
JobInboundMessageKind["Input"] = "in";
|
||||
// Input channel does not allow completion / error. Erroring this will just close the Subject
|
||||
// but not notify the job.
|
||||
})(JobInboundMessageKind || (exports.JobInboundMessageKind = JobInboundMessageKind = {}));
|
||||
/**
|
||||
* Kind of messages that can be outputted from a job.
|
||||
*/
|
||||
var JobOutboundMessageKind;
|
||||
(function (JobOutboundMessageKind) {
|
||||
// Lifecycle specific messages.
|
||||
JobOutboundMessageKind["OnReady"] = "c";
|
||||
JobOutboundMessageKind["Start"] = "s";
|
||||
JobOutboundMessageKind["End"] = "e";
|
||||
JobOutboundMessageKind["Pong"] = "p";
|
||||
// Feedback messages.
|
||||
JobOutboundMessageKind["Output"] = "o";
|
||||
// Channel specific messages.
|
||||
JobOutboundMessageKind["ChannelCreate"] = "cn";
|
||||
JobOutboundMessageKind["ChannelMessage"] = "cm";
|
||||
JobOutboundMessageKind["ChannelError"] = "ce";
|
||||
JobOutboundMessageKind["ChannelComplete"] = "cc";
|
||||
})(JobOutboundMessageKind || (exports.JobOutboundMessageKind = JobOutboundMessageKind = {}));
|
||||
/**
|
||||
* The state of a job. These are changed as the job reports a new state through its messages.
|
||||
*/
|
||||
var JobState;
|
||||
(function (JobState) {
|
||||
/**
|
||||
* The job was queued and is waiting to start.
|
||||
*/
|
||||
JobState["Queued"] = "queued";
|
||||
/**
|
||||
* The job description was found, its dependencies (see "Synchronizing and Dependencies")
|
||||
* are done running, and the job's argument is validated and the job's code will be executed.
|
||||
*/
|
||||
JobState["Ready"] = "ready";
|
||||
/**
|
||||
* The job has been started. The job implementation is expected to send this as soon as its
|
||||
* work is starting.
|
||||
*/
|
||||
JobState["Started"] = "started";
|
||||
/**
|
||||
* The job has ended and is done running.
|
||||
*/
|
||||
JobState["Ended"] = "ended";
|
||||
/**
|
||||
* An error occured and the job stopped because of internal state.
|
||||
*/
|
||||
JobState["Errored"] = "errored";
|
||||
})(JobState || (exports.JobState = JobState = {}));
|
||||
function isJobHandler(value) {
|
||||
const job = value;
|
||||
return (typeof job == 'function' && typeof job.jobDescription == 'object' && job.jobDescription !== null);
|
||||
}
|
||||
exports.isJobHandler = isJobHandler;
|
47
my-app/node_modules/@angular-devkit/architect/src/jobs/create-job-handler.d.ts
generated
vendored
Executable file
47
my-app/node_modules/@angular-devkit/architect/src/jobs/create-job-handler.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { BaseException, JsonValue, logging } from '@angular-devkit/core';
|
||||
import { Observable, Observer } from 'rxjs';
|
||||
import { JobDescription, JobHandler, JobHandlerContext } from './api';
|
||||
export declare class ChannelAlreadyExistException extends BaseException {
|
||||
constructor(name: string);
|
||||
}
|
||||
/**
|
||||
* Interface for the JobHandler context that is used when using `createJobHandler()`. It extends
|
||||
* the basic `JobHandlerContext` with additional functionality.
|
||||
*/
|
||||
export interface SimpleJobHandlerContext<A extends JsonValue, I extends JsonValue, O extends JsonValue> extends JobHandlerContext<A, I, O> {
|
||||
createChannel: (name: string) => Observer<JsonValue>;
|
||||
input: Observable<I>;
|
||||
addTeardown(teardown: () => Promise<void> | void): void;
|
||||
}
|
||||
/**
|
||||
* A simple version of the JobHandler. This simplifies a lot of the interaction with the job
|
||||
* scheduler and registry. For example, instead of returning a JobOutboundMessage observable, you
|
||||
* can directly return an output.
|
||||
*/
|
||||
export type SimpleJobHandlerFn<A extends JsonValue, I extends JsonValue, O extends JsonValue> = (input: A, context: SimpleJobHandlerContext<A, I, O>) => O | Promise<O> | Observable<O>;
|
||||
/**
|
||||
* Make a simple job handler that sets start and end from a function that's synchronous.
|
||||
*
|
||||
* @param fn The function to create a handler for.
|
||||
* @param options An optional set of properties to set on the handler. Some fields might be
|
||||
* required by registry or schedulers.
|
||||
*/
|
||||
export declare function createJobHandler<A extends JsonValue, I extends JsonValue, O extends JsonValue>(fn: SimpleJobHandlerFn<A, I, O>, options?: Partial<JobDescription>): JobHandler<A, I, O>;
|
||||
/**
|
||||
* Lazily create a job using a function.
|
||||
* @param loader A factory function that returns a promise/observable of a JobHandler.
|
||||
* @param options Same options as createJob.
|
||||
*/
|
||||
export declare function createJobFactory<A extends JsonValue, I extends JsonValue, O extends JsonValue>(loader: () => Promise<JobHandler<A, I, O>>, options?: Partial<JobDescription>): JobHandler<A, I, O>;
|
||||
/**
|
||||
* Creates a job that logs out input/output messages of another Job. The messages are still
|
||||
* propagated to the other job.
|
||||
*/
|
||||
export declare function createLoggerJob<A extends JsonValue, I extends JsonValue, O extends JsonValue>(job: JobHandler<A, I, O>, logger: logging.LoggerApi): JobHandler<A, I, O>;
|
145
my-app/node_modules/@angular-devkit/architect/src/jobs/create-job-handler.js
generated
vendored
Executable file
145
my-app/node_modules/@angular-devkit/architect/src/jobs/create-job-handler.js
generated
vendored
Executable file
|
@ -0,0 +1,145 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createLoggerJob = exports.createJobFactory = exports.createJobHandler = exports.ChannelAlreadyExistException = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const api_1 = require("./api");
|
||||
class ChannelAlreadyExistException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Channel ${JSON.stringify(name)} already exist.`);
|
||||
}
|
||||
}
|
||||
exports.ChannelAlreadyExistException = ChannelAlreadyExistException;
|
||||
/**
|
||||
* Make a simple job handler that sets start and end from a function that's synchronous.
|
||||
*
|
||||
* @param fn The function to create a handler for.
|
||||
* @param options An optional set of properties to set on the handler. Some fields might be
|
||||
* required by registry or schedulers.
|
||||
*/
|
||||
function createJobHandler(fn, options = {}) {
|
||||
const handler = (argument, context) => {
|
||||
const description = context.description;
|
||||
const inboundBus = context.inboundBus;
|
||||
const inputChannel = new rxjs_1.Subject();
|
||||
let subscription;
|
||||
const teardownLogics = [];
|
||||
let tearingDown = false;
|
||||
return new rxjs_1.Observable((subject) => {
|
||||
function complete() {
|
||||
if (subscription) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
subject.next({ kind: api_1.JobOutboundMessageKind.End, description });
|
||||
subject.complete();
|
||||
inputChannel.complete();
|
||||
}
|
||||
// Handle input.
|
||||
const inboundSub = inboundBus.subscribe((message) => {
|
||||
switch (message.kind) {
|
||||
case api_1.JobInboundMessageKind.Ping:
|
||||
subject.next({ kind: api_1.JobOutboundMessageKind.Pong, description, id: message.id });
|
||||
break;
|
||||
case api_1.JobInboundMessageKind.Stop:
|
||||
// Run teardown logic then complete.
|
||||
tearingDown = true;
|
||||
if (teardownLogics.length) {
|
||||
Promise.all(teardownLogics.map((fn) => fn())).then(() => complete(), () => complete());
|
||||
}
|
||||
else {
|
||||
complete();
|
||||
}
|
||||
break;
|
||||
case api_1.JobInboundMessageKind.Input:
|
||||
if (!tearingDown) {
|
||||
inputChannel.next(message.value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
// Execute the function with the additional context.
|
||||
const channels = new Map();
|
||||
const newContext = {
|
||||
...context,
|
||||
input: inputChannel.asObservable(),
|
||||
addTeardown(teardown) {
|
||||
teardownLogics.push(teardown);
|
||||
},
|
||||
createChannel(name) {
|
||||
if (channels.has(name)) {
|
||||
throw new ChannelAlreadyExistException(name);
|
||||
}
|
||||
const channelSubject = new rxjs_1.Subject();
|
||||
const channelSub = channelSubject.subscribe((message) => {
|
||||
subject.next({
|
||||
kind: api_1.JobOutboundMessageKind.ChannelMessage,
|
||||
description,
|
||||
name,
|
||||
message,
|
||||
});
|
||||
}, (error) => {
|
||||
subject.next({ kind: api_1.JobOutboundMessageKind.ChannelError, description, name, error });
|
||||
// This can be reopened.
|
||||
channels.delete(name);
|
||||
}, () => {
|
||||
subject.next({ kind: api_1.JobOutboundMessageKind.ChannelComplete, description, name });
|
||||
// This can be reopened.
|
||||
channels.delete(name);
|
||||
});
|
||||
channels.set(name, channelSubject);
|
||||
if (subscription) {
|
||||
subscription.add(channelSub);
|
||||
}
|
||||
return channelSubject;
|
||||
},
|
||||
};
|
||||
subject.next({ kind: api_1.JobOutboundMessageKind.Start, description });
|
||||
let result = fn(argument, newContext);
|
||||
// If the result is a promise, simply wait for it to complete before reporting the result.
|
||||
if ((0, core_1.isPromise)(result)) {
|
||||
result = (0, rxjs_1.from)(result);
|
||||
}
|
||||
else if (!(0, rxjs_1.isObservable)(result)) {
|
||||
result = (0, rxjs_1.of)(result);
|
||||
}
|
||||
subscription = result.subscribe((value) => subject.next({ kind: api_1.JobOutboundMessageKind.Output, description, value }), (error) => subject.error(error), () => complete());
|
||||
subscription.add(inboundSub);
|
||||
return subscription;
|
||||
});
|
||||
};
|
||||
return Object.assign(handler, { jobDescription: options });
|
||||
}
|
||||
exports.createJobHandler = createJobHandler;
|
||||
/**
|
||||
* Lazily create a job using a function.
|
||||
* @param loader A factory function that returns a promise/observable of a JobHandler.
|
||||
* @param options Same options as createJob.
|
||||
*/
|
||||
function createJobFactory(loader, options = {}) {
|
||||
const handler = (argument, context) => {
|
||||
return (0, rxjs_1.from)(loader()).pipe((0, rxjs_1.switchMap)((fn) => fn(argument, context)));
|
||||
};
|
||||
return Object.assign(handler, { jobDescription: options });
|
||||
}
|
||||
exports.createJobFactory = createJobFactory;
|
||||
/**
|
||||
* Creates a job that logs out input/output messages of another Job. The messages are still
|
||||
* propagated to the other job.
|
||||
*/
|
||||
function createLoggerJob(job, logger) {
|
||||
const handler = (argument, context) => {
|
||||
context.inboundBus
|
||||
.pipe((0, rxjs_1.tap)((message) => logger.info(`Input: ${JSON.stringify(message)}`)))
|
||||
.subscribe();
|
||||
return job(argument, context).pipe((0, rxjs_1.tap)((message) => logger.info(`Message: ${JSON.stringify(message)}`), (error) => logger.warn(`Error: ${JSON.stringify(error)}`), () => logger.info(`Completed`)));
|
||||
};
|
||||
return Object.assign(handler, job);
|
||||
}
|
||||
exports.createLoggerJob = createLoggerJob;
|
31
my-app/node_modules/@angular-devkit/architect/src/jobs/dispatcher.d.ts
generated
vendored
Executable file
31
my-app/node_modules/@angular-devkit/architect/src/jobs/dispatcher.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { JsonValue } from '@angular-devkit/core';
|
||||
import { JobDescription, JobHandler, JobName } from './api';
|
||||
import { Readwrite } from './types';
|
||||
/**
|
||||
* A JobDispatcher can be used to dispatch between multiple jobs.
|
||||
*/
|
||||
export interface JobDispatcher<A extends JsonValue, I extends JsonValue, O extends JsonValue> extends JobHandler<A, I, O> {
|
||||
/**
|
||||
* Set the default job if all conditionals failed.
|
||||
* @param name The default name if all conditions are false.
|
||||
*/
|
||||
setDefaultJob(name: JobName | null | JobHandler<JsonValue, JsonValue, JsonValue>): void;
|
||||
/**
|
||||
* Add a conditional job that will be selected if the input fits a predicate.
|
||||
* @param predicate
|
||||
* @param name
|
||||
*/
|
||||
addConditionalJob(predicate: (args: A) => boolean, name: string): void;
|
||||
}
|
||||
/**
|
||||
* OnReady a dispatcher that can dispatch to a sub job, depending on conditions.
|
||||
* @param options
|
||||
*/
|
||||
export declare function createDispatcher<A extends JsonValue, I extends JsonValue, O extends JsonValue>(options?: Partial<Readwrite<JobDescription>>): JobDispatcher<A, I, O>;
|
50
my-app/node_modules/@angular-devkit/architect/src/jobs/dispatcher.js
generated
vendored
Executable file
50
my-app/node_modules/@angular-devkit/architect/src/jobs/dispatcher.js
generated
vendored
Executable file
|
@ -0,0 +1,50 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createDispatcher = void 0;
|
||||
const api_1 = require("./api");
|
||||
const exception_1 = require("./exception");
|
||||
/**
|
||||
* OnReady a dispatcher that can dispatch to a sub job, depending on conditions.
|
||||
* @param options
|
||||
*/
|
||||
function createDispatcher(options = {}) {
|
||||
let defaultDelegate = null;
|
||||
const conditionalDelegateList = [];
|
||||
const job = Object.assign((argument, context) => {
|
||||
const maybeDelegate = conditionalDelegateList.find(([predicate]) => predicate(argument));
|
||||
let delegate = null;
|
||||
if (maybeDelegate) {
|
||||
delegate = context.scheduler.schedule(maybeDelegate[1], argument);
|
||||
}
|
||||
else if (defaultDelegate) {
|
||||
delegate = context.scheduler.schedule(defaultDelegate, argument);
|
||||
}
|
||||
else {
|
||||
throw new exception_1.JobDoesNotExistException('<null>');
|
||||
}
|
||||
context.inboundBus.subscribe(delegate.inboundBus);
|
||||
return delegate.outboundBus;
|
||||
}, {
|
||||
jobDescription: options,
|
||||
});
|
||||
return Object.assign(job, {
|
||||
setDefaultJob(name) {
|
||||
if ((0, api_1.isJobHandler)(name)) {
|
||||
name = name.jobDescription.name === undefined ? null : name.jobDescription.name;
|
||||
}
|
||||
defaultDelegate = name;
|
||||
},
|
||||
addConditionalJob(predicate, name) {
|
||||
conditionalDelegateList.push([predicate, name]);
|
||||
},
|
||||
// TODO: Remove return-only generic from createDispatcher() API.
|
||||
});
|
||||
}
|
||||
exports.createDispatcher = createDispatcher;
|
15
my-app/node_modules/@angular-devkit/architect/src/jobs/exception.d.ts
generated
vendored
Executable file
15
my-app/node_modules/@angular-devkit/architect/src/jobs/exception.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { BaseException } from '@angular-devkit/core';
|
||||
import { JobName } from './api';
|
||||
export declare class JobNameAlreadyRegisteredException extends BaseException {
|
||||
constructor(name: JobName);
|
||||
}
|
||||
export declare class JobDoesNotExistException extends BaseException {
|
||||
constructor(name: JobName);
|
||||
}
|
23
my-app/node_modules/@angular-devkit/architect/src/jobs/exception.js
generated
vendored
Executable file
23
my-app/node_modules/@angular-devkit/architect/src/jobs/exception.js
generated
vendored
Executable file
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.JobDoesNotExistException = exports.JobNameAlreadyRegisteredException = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
class JobNameAlreadyRegisteredException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Job named ${JSON.stringify(name)} already exists.`);
|
||||
}
|
||||
}
|
||||
exports.JobNameAlreadyRegisteredException = JobNameAlreadyRegisteredException;
|
||||
class JobDoesNotExistException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Job name ${JSON.stringify(name)} does not exist.`);
|
||||
}
|
||||
}
|
||||
exports.JobDoesNotExistException = JobDoesNotExistException;
|
19
my-app/node_modules/@angular-devkit/architect/src/jobs/fallback-registry.d.ts
generated
vendored
Executable file
19
my-app/node_modules/@angular-devkit/architect/src/jobs/fallback-registry.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { JsonValue } from '@angular-devkit/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { JobHandler, JobName, Registry } from './api';
|
||||
/**
|
||||
* A simple job registry that keep a map of JobName => JobHandler internally.
|
||||
*/
|
||||
export declare class FallbackRegistry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> implements Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> {
|
||||
protected _fallbacks: Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT>[];
|
||||
constructor(_fallbacks?: Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT>[]);
|
||||
addFallback(registry: Registry): void;
|
||||
get<A extends MinimumArgumentValueT = MinimumArgumentValueT, I extends MinimumInputValueT = MinimumInputValueT, O extends MinimumOutputValueT = MinimumOutputValueT>(name: JobName): Observable<JobHandler<A, I, O> | null>;
|
||||
}
|
27
my-app/node_modules/@angular-devkit/architect/src/jobs/fallback-registry.js
generated
vendored
Executable file
27
my-app/node_modules/@angular-devkit/architect/src/jobs/fallback-registry.js
generated
vendored
Executable file
|
@ -0,0 +1,27 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FallbackRegistry = void 0;
|
||||
const rxjs_1 = require("rxjs");
|
||||
/**
|
||||
* A simple job registry that keep a map of JobName => JobHandler internally.
|
||||
*/
|
||||
class FallbackRegistry {
|
||||
_fallbacks;
|
||||
constructor(_fallbacks = []) {
|
||||
this._fallbacks = _fallbacks;
|
||||
}
|
||||
addFallback(registry) {
|
||||
this._fallbacks.push(registry);
|
||||
}
|
||||
get(name) {
|
||||
return (0, rxjs_1.from)(this._fallbacks).pipe((0, rxjs_1.concatMap)((fb) => fb.get(name)), (0, rxjs_1.first)((x) => x !== null, null));
|
||||
}
|
||||
}
|
||||
exports.FallbackRegistry = FallbackRegistry;
|
15
my-app/node_modules/@angular-devkit/architect/src/jobs/index.d.ts
generated
vendored
Executable file
15
my-app/node_modules/@angular-devkit/architect/src/jobs/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
export * from './api';
|
||||
export * from './create-job-handler';
|
||||
export * from './exception';
|
||||
export * from './dispatcher';
|
||||
export * from './fallback-registry';
|
||||
export * from './simple-registry';
|
||||
export * from './simple-scheduler';
|
||||
export * from './strategy';
|
31
my-app/node_modules/@angular-devkit/architect/src/jobs/index.js
generated
vendored
Executable file
31
my-app/node_modules/@angular-devkit/architect/src/jobs/index.js
generated
vendored
Executable file
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./api"), exports);
|
||||
__exportStar(require("./create-job-handler"), exports);
|
||||
__exportStar(require("./exception"), exports);
|
||||
__exportStar(require("./dispatcher"), exports);
|
||||
__exportStar(require("./fallback-registry"), exports);
|
||||
__exportStar(require("./simple-registry"), exports);
|
||||
__exportStar(require("./simple-scheduler"), exports);
|
||||
__exportStar(require("./strategy"), exports);
|
44
my-app/node_modules/@angular-devkit/architect/src/jobs/simple-registry.d.ts
generated
vendored
Executable file
44
my-app/node_modules/@angular-devkit/architect/src/jobs/simple-registry.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { JsonValue } from '@angular-devkit/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { JobDescription, JobHandler, JobName, Registry } from './api';
|
||||
/**
|
||||
* SimpleJobRegistry job registration options.
|
||||
*/
|
||||
export interface RegisterJobOptions extends Partial<JobDescription> {
|
||||
}
|
||||
/**
|
||||
* A simple job registry that keep a map of JobName => JobHandler internally.
|
||||
*/
|
||||
export declare class SimpleJobRegistry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> implements Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> {
|
||||
private _jobNames;
|
||||
get<A extends MinimumArgumentValueT = MinimumArgumentValueT, I extends MinimumInputValueT = MinimumInputValueT, O extends MinimumOutputValueT = MinimumOutputValueT>(name: JobName): Observable<JobHandler<A, I, O> | null>;
|
||||
/**
|
||||
* Register a job handler. The name must be unique.
|
||||
*
|
||||
* @param name The name of the job.
|
||||
* @param handler The function that will be called for the job.
|
||||
* @param options An optional list of options to override the handler. {@see RegisterJobOptions}
|
||||
*/
|
||||
register<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: JobName, handler: JobHandler<A, I, O>, options?: RegisterJobOptions): void;
|
||||
/**
|
||||
* Register a job handler. The name must be unique.
|
||||
*
|
||||
* @param handler The function that will be called for the job.
|
||||
* @param options An optional list of options to override the handler. {@see RegisterJobOptions}
|
||||
*/
|
||||
register<ArgumentT extends JsonValue, InputT extends JsonValue, OutputT extends JsonValue>(handler: JobHandler<ArgumentT, InputT, OutputT>, options?: RegisterJobOptions & {
|
||||
name: string;
|
||||
}): void;
|
||||
protected _register<ArgumentT extends JsonValue, InputT extends JsonValue, OutputT extends JsonValue>(name: JobName, handler: JobHandler<ArgumentT, InputT, OutputT>, options: RegisterJobOptions): void;
|
||||
/**
|
||||
* Returns the job names of all jobs.
|
||||
*/
|
||||
getJobNames(): JobName[];
|
||||
}
|
75
my-app/node_modules/@angular-devkit/architect/src/jobs/simple-registry.js
generated
vendored
Executable file
75
my-app/node_modules/@angular-devkit/architect/src/jobs/simple-registry.js
generated
vendored
Executable file
|
@ -0,0 +1,75 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SimpleJobRegistry = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const api_1 = require("./api");
|
||||
const exception_1 = require("./exception");
|
||||
/**
|
||||
* A simple job registry that keep a map of JobName => JobHandler internally.
|
||||
*/
|
||||
class SimpleJobRegistry {
|
||||
_jobNames = new Map();
|
||||
get(name) {
|
||||
return (0, rxjs_1.of)(this._jobNames.get(name) || null);
|
||||
}
|
||||
register(nameOrHandler, handlerOrOptions = {}, options = {}) {
|
||||
// Switch on the arguments.
|
||||
if (typeof nameOrHandler == 'string') {
|
||||
if (!(0, api_1.isJobHandler)(handlerOrOptions)) {
|
||||
// This is an error.
|
||||
throw new TypeError('Expected a JobHandler as second argument.');
|
||||
}
|
||||
this._register(nameOrHandler, handlerOrOptions, options);
|
||||
}
|
||||
else if ((0, api_1.isJobHandler)(nameOrHandler)) {
|
||||
if (typeof handlerOrOptions !== 'object') {
|
||||
// This is an error.
|
||||
throw new TypeError('Expected an object options as second argument.');
|
||||
}
|
||||
const name = options.name || nameOrHandler.jobDescription.name || handlerOrOptions.name;
|
||||
if (name === undefined) {
|
||||
throw new TypeError('Expected name to be a string.');
|
||||
}
|
||||
this._register(name, nameOrHandler, options);
|
||||
}
|
||||
else {
|
||||
throw new TypeError('Unrecognized arguments.');
|
||||
}
|
||||
}
|
||||
_register(name, handler, options) {
|
||||
if (this._jobNames.has(name)) {
|
||||
// We shouldn't allow conflicts.
|
||||
throw new exception_1.JobNameAlreadyRegisteredException(name);
|
||||
}
|
||||
// Merge all fields with the ones in the handler (to make sure we respect the handler).
|
||||
const argument = core_1.schema.mergeSchemas(handler.jobDescription.argument, options.argument);
|
||||
const input = core_1.schema.mergeSchemas(handler.jobDescription.input, options.input);
|
||||
const output = core_1.schema.mergeSchemas(handler.jobDescription.output, options.output);
|
||||
// Create the job description.
|
||||
const jobDescription = {
|
||||
name,
|
||||
argument,
|
||||
output,
|
||||
input,
|
||||
};
|
||||
const jobHandler = Object.assign(handler.bind(undefined), {
|
||||
jobDescription,
|
||||
});
|
||||
this._jobNames.set(name, jobHandler);
|
||||
}
|
||||
/**
|
||||
* Returns the job names of all jobs.
|
||||
*/
|
||||
getJobNames() {
|
||||
return [...this._jobNames.keys()];
|
||||
}
|
||||
}
|
||||
exports.SimpleJobRegistry = SimpleJobRegistry;
|
77
my-app/node_modules/@angular-devkit/architect/src/jobs/simple-scheduler.d.ts
generated
vendored
Executable file
77
my-app/node_modules/@angular-devkit/architect/src/jobs/simple-scheduler.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { JsonValue, schema } from '@angular-devkit/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Job, JobDescription, JobName, Registry, ScheduleJobOptions, Scheduler } from './api';
|
||||
export declare class JobArgumentSchemaValidationError extends schema.SchemaValidationException {
|
||||
constructor(errors?: schema.SchemaValidatorError[]);
|
||||
}
|
||||
export declare class JobInboundMessageSchemaValidationError extends schema.SchemaValidationException {
|
||||
constructor(errors?: schema.SchemaValidatorError[]);
|
||||
}
|
||||
export declare class JobOutputSchemaValidationError extends schema.SchemaValidationException {
|
||||
constructor(errors?: schema.SchemaValidatorError[]);
|
||||
}
|
||||
/**
|
||||
* Simple scheduler. Should be the base of all registries and schedulers.
|
||||
*/
|
||||
export declare class SimpleScheduler<MinimumArgumentT extends JsonValue = JsonValue, MinimumInputT extends JsonValue = JsonValue, MinimumOutputT extends JsonValue = JsonValue> implements Scheduler<MinimumArgumentT, MinimumInputT, MinimumOutputT> {
|
||||
protected _jobRegistry: Registry<MinimumArgumentT, MinimumInputT, MinimumOutputT>;
|
||||
protected _schemaRegistry: schema.SchemaRegistry;
|
||||
private _internalJobDescriptionMap;
|
||||
private _queue;
|
||||
private _pauseCounter;
|
||||
constructor(_jobRegistry: Registry<MinimumArgumentT, MinimumInputT, MinimumOutputT>, _schemaRegistry?: schema.SchemaRegistry);
|
||||
private _getInternalDescription;
|
||||
/**
|
||||
* Get a job description for a named job.
|
||||
*
|
||||
* @param name The name of the job.
|
||||
* @returns A description, or null if the job is not registered.
|
||||
*/
|
||||
getDescription(name: JobName): Observable<JobDescription | null>;
|
||||
/**
|
||||
* Returns true if the job name has been registered.
|
||||
* @param name The name of the job.
|
||||
* @returns True if the job exists, false otherwise.
|
||||
*/
|
||||
has(name: JobName): Observable<boolean>;
|
||||
/**
|
||||
* Pause the scheduler, temporary queueing _new_ jobs. Returns a resume function that should be
|
||||
* used to resume execution. If multiple `pause()` were called, all their resume functions must
|
||||
* be called before the Scheduler actually starts new jobs. Additional calls to the same resume
|
||||
* function will have no effect.
|
||||
*
|
||||
* Jobs already running are NOT paused. This is pausing the scheduler only.
|
||||
*/
|
||||
pause(): () => void;
|
||||
/**
|
||||
* Schedule a job to be run, using its name.
|
||||
* @param name The name of job to be run.
|
||||
* @param argument The argument to send to the job when starting it.
|
||||
* @param options Scheduling options.
|
||||
* @returns The Job being run.
|
||||
*/
|
||||
schedule<A extends MinimumArgumentT, I extends MinimumInputT, O extends MinimumOutputT>(name: JobName, argument: A, options?: ScheduleJobOptions): Job<A, I, O>;
|
||||
/**
|
||||
* Filter messages.
|
||||
* @private
|
||||
*/
|
||||
private _filterJobOutboundMessages;
|
||||
/**
|
||||
* Return a new state. This is just to simplify the reading of the _createJob method.
|
||||
* @private
|
||||
*/
|
||||
private _updateState;
|
||||
/**
|
||||
* Create the job.
|
||||
* @private
|
||||
*/
|
||||
private _createJob;
|
||||
protected _scheduleJob<A extends MinimumArgumentT, I extends MinimumInputT, O extends MinimumOutputT>(name: JobName, argument: A, options: ScheduleJobOptions, waitable: Observable<never>): Job<A, I, O>;
|
||||
}
|
381
my-app/node_modules/@angular-devkit/architect/src/jobs/simple-scheduler.js
generated
vendored
Executable file
381
my-app/node_modules/@angular-devkit/architect/src/jobs/simple-scheduler.js
generated
vendored
Executable file
|
@ -0,0 +1,381 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SimpleScheduler = exports.JobOutputSchemaValidationError = exports.JobInboundMessageSchemaValidationError = exports.JobArgumentSchemaValidationError = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const api_1 = require("./api");
|
||||
const exception_1 = require("./exception");
|
||||
class JobArgumentSchemaValidationError extends core_1.schema.SchemaValidationException {
|
||||
constructor(errors) {
|
||||
super(errors, 'Job Argument failed to validate. Errors: ');
|
||||
}
|
||||
}
|
||||
exports.JobArgumentSchemaValidationError = JobArgumentSchemaValidationError;
|
||||
class JobInboundMessageSchemaValidationError extends core_1.schema.SchemaValidationException {
|
||||
constructor(errors) {
|
||||
super(errors, 'Job Inbound Message failed to validate. Errors: ');
|
||||
}
|
||||
}
|
||||
exports.JobInboundMessageSchemaValidationError = JobInboundMessageSchemaValidationError;
|
||||
class JobOutputSchemaValidationError extends core_1.schema.SchemaValidationException {
|
||||
constructor(errors) {
|
||||
super(errors, 'Job Output failed to validate. Errors: ');
|
||||
}
|
||||
}
|
||||
exports.JobOutputSchemaValidationError = JobOutputSchemaValidationError;
|
||||
function _jobShare() {
|
||||
// This is the same code as a `shareReplay()` operator, but uses a dumber Subject rather than a
|
||||
// ReplaySubject.
|
||||
return (source) => {
|
||||
let refCount = 0;
|
||||
let subject;
|
||||
let hasError = false;
|
||||
let isComplete = false;
|
||||
let subscription;
|
||||
return new rxjs_1.Observable((subscriber) => {
|
||||
let innerSub;
|
||||
refCount++;
|
||||
if (!subject) {
|
||||
subject = new rxjs_1.Subject();
|
||||
innerSub = subject.subscribe(subscriber);
|
||||
subscription = source.subscribe({
|
||||
next(value) {
|
||||
subject.next(value);
|
||||
},
|
||||
error(err) {
|
||||
hasError = true;
|
||||
subject.error(err);
|
||||
},
|
||||
complete() {
|
||||
isComplete = true;
|
||||
subject.complete();
|
||||
},
|
||||
});
|
||||
}
|
||||
else {
|
||||
innerSub = subject.subscribe(subscriber);
|
||||
}
|
||||
return () => {
|
||||
refCount--;
|
||||
innerSub.unsubscribe();
|
||||
if (subscription && refCount === 0 && (isComplete || hasError)) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Simple scheduler. Should be the base of all registries and schedulers.
|
||||
*/
|
||||
class SimpleScheduler {
|
||||
_jobRegistry;
|
||||
_schemaRegistry;
|
||||
_internalJobDescriptionMap = new Map();
|
||||
_queue = [];
|
||||
_pauseCounter = 0;
|
||||
constructor(_jobRegistry, _schemaRegistry = new core_1.schema.CoreSchemaRegistry()) {
|
||||
this._jobRegistry = _jobRegistry;
|
||||
this._schemaRegistry = _schemaRegistry;
|
||||
}
|
||||
_getInternalDescription(name) {
|
||||
const maybeHandler = this._internalJobDescriptionMap.get(name);
|
||||
if (maybeHandler !== undefined) {
|
||||
return (0, rxjs_1.of)(maybeHandler);
|
||||
}
|
||||
const handler = this._jobRegistry.get(name);
|
||||
return handler.pipe((0, rxjs_1.switchMap)((handler) => {
|
||||
if (handler === null) {
|
||||
return (0, rxjs_1.of)(null);
|
||||
}
|
||||
const description = {
|
||||
// Make a copy of it to be sure it's proper JSON.
|
||||
...JSON.parse(JSON.stringify(handler.jobDescription)),
|
||||
name: handler.jobDescription.name || name,
|
||||
argument: handler.jobDescription.argument || true,
|
||||
input: handler.jobDescription.input || true,
|
||||
output: handler.jobDescription.output || true,
|
||||
channels: handler.jobDescription.channels || {},
|
||||
};
|
||||
const handlerWithExtra = Object.assign(handler.bind(undefined), {
|
||||
jobDescription: description,
|
||||
argumentV: this._schemaRegistry.compile(description.argument),
|
||||
inputV: this._schemaRegistry.compile(description.input),
|
||||
outputV: this._schemaRegistry.compile(description.output),
|
||||
});
|
||||
this._internalJobDescriptionMap.set(name, handlerWithExtra);
|
||||
return (0, rxjs_1.of)(handlerWithExtra);
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Get a job description for a named job.
|
||||
*
|
||||
* @param name The name of the job.
|
||||
* @returns A description, or null if the job is not registered.
|
||||
*/
|
||||
getDescription(name) {
|
||||
return (0, rxjs_1.concat)(this._getInternalDescription(name).pipe((0, rxjs_1.map)((x) => x && x.jobDescription)), (0, rxjs_1.of)(null)).pipe((0, rxjs_1.first)());
|
||||
}
|
||||
/**
|
||||
* Returns true if the job name has been registered.
|
||||
* @param name The name of the job.
|
||||
* @returns True if the job exists, false otherwise.
|
||||
*/
|
||||
has(name) {
|
||||
return this.getDescription(name).pipe((0, rxjs_1.map)((x) => x !== null));
|
||||
}
|
||||
/**
|
||||
* Pause the scheduler, temporary queueing _new_ jobs. Returns a resume function that should be
|
||||
* used to resume execution. If multiple `pause()` were called, all their resume functions must
|
||||
* be called before the Scheduler actually starts new jobs. Additional calls to the same resume
|
||||
* function will have no effect.
|
||||
*
|
||||
* Jobs already running are NOT paused. This is pausing the scheduler only.
|
||||
*/
|
||||
pause() {
|
||||
let called = false;
|
||||
this._pauseCounter++;
|
||||
return () => {
|
||||
if (!called) {
|
||||
called = true;
|
||||
if (--this._pauseCounter == 0) {
|
||||
// Resume the queue.
|
||||
const q = this._queue;
|
||||
this._queue = [];
|
||||
q.forEach((fn) => fn());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Schedule a job to be run, using its name.
|
||||
* @param name The name of job to be run.
|
||||
* @param argument The argument to send to the job when starting it.
|
||||
* @param options Scheduling options.
|
||||
* @returns The Job being run.
|
||||
*/
|
||||
schedule(name, argument, options) {
|
||||
if (this._pauseCounter > 0) {
|
||||
const waitable = new rxjs_1.Subject();
|
||||
this._queue.push(() => waitable.complete());
|
||||
return this._scheduleJob(name, argument, options || {}, waitable);
|
||||
}
|
||||
return this._scheduleJob(name, argument, options || {}, rxjs_1.EMPTY);
|
||||
}
|
||||
/**
|
||||
* Filter messages.
|
||||
* @private
|
||||
*/
|
||||
_filterJobOutboundMessages(message, state) {
|
||||
switch (message.kind) {
|
||||
case api_1.JobOutboundMessageKind.OnReady:
|
||||
return state == api_1.JobState.Queued;
|
||||
case api_1.JobOutboundMessageKind.Start:
|
||||
return state == api_1.JobState.Ready;
|
||||
case api_1.JobOutboundMessageKind.End:
|
||||
return state == api_1.JobState.Started || state == api_1.JobState.Ready;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Return a new state. This is just to simplify the reading of the _createJob method.
|
||||
* @private
|
||||
*/
|
||||
_updateState(message, state) {
|
||||
switch (message.kind) {
|
||||
case api_1.JobOutboundMessageKind.OnReady:
|
||||
return api_1.JobState.Ready;
|
||||
case api_1.JobOutboundMessageKind.Start:
|
||||
return api_1.JobState.Started;
|
||||
case api_1.JobOutboundMessageKind.End:
|
||||
return api_1.JobState.Ended;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
/**
|
||||
* Create the job.
|
||||
* @private
|
||||
*/
|
||||
// eslint-disable-next-line max-lines-per-function
|
||||
_createJob(name, argument, handler, inboundBus, outboundBus) {
|
||||
const schemaRegistry = this._schemaRegistry;
|
||||
const channelsSubject = new Map();
|
||||
const channels = new Map();
|
||||
let state = api_1.JobState.Queued;
|
||||
let pingId = 0;
|
||||
// Create the input channel by having a filter.
|
||||
const input = new rxjs_1.Subject();
|
||||
input
|
||||
.pipe((0, rxjs_1.concatMap)((message) => handler.pipe((0, rxjs_1.switchMap)(async (handler) => {
|
||||
if (handler === null) {
|
||||
throw new exception_1.JobDoesNotExistException(name);
|
||||
}
|
||||
const validator = await handler.inputV;
|
||||
return validator(message);
|
||||
}))), (0, rxjs_1.filter)((result) => result.success), (0, rxjs_1.map)((result) => result.data))
|
||||
.subscribe((value) => inboundBus.next({ kind: api_1.JobInboundMessageKind.Input, value }));
|
||||
outboundBus = (0, rxjs_1.concat)(outboundBus,
|
||||
// Add an End message at completion. This will be filtered out if the job actually send an
|
||||
// End.
|
||||
handler.pipe((0, rxjs_1.switchMap)((handler) => {
|
||||
if (handler) {
|
||||
return (0, rxjs_1.of)({
|
||||
kind: api_1.JobOutboundMessageKind.End,
|
||||
description: handler.jobDescription,
|
||||
});
|
||||
}
|
||||
else {
|
||||
return rxjs_1.EMPTY;
|
||||
}
|
||||
}))).pipe((0, rxjs_1.filter)((message) => this._filterJobOutboundMessages(message, state)),
|
||||
// Update internal logic and Job<> members.
|
||||
(0, rxjs_1.tap)((message) => {
|
||||
// Update the state.
|
||||
state = this._updateState(message, state);
|
||||
switch (message.kind) {
|
||||
case api_1.JobOutboundMessageKind.ChannelCreate: {
|
||||
const maybeSubject = channelsSubject.get(message.name);
|
||||
// If it doesn't exist or it's closed on the other end.
|
||||
if (!maybeSubject) {
|
||||
const s = new rxjs_1.Subject();
|
||||
channelsSubject.set(message.name, s);
|
||||
channels.set(message.name, s.asObservable());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case api_1.JobOutboundMessageKind.ChannelMessage: {
|
||||
const maybeSubject = channelsSubject.get(message.name);
|
||||
if (maybeSubject) {
|
||||
maybeSubject.next(message.message);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case api_1.JobOutboundMessageKind.ChannelComplete: {
|
||||
const maybeSubject = channelsSubject.get(message.name);
|
||||
if (maybeSubject) {
|
||||
maybeSubject.complete();
|
||||
channelsSubject.delete(message.name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case api_1.JobOutboundMessageKind.ChannelError: {
|
||||
const maybeSubject = channelsSubject.get(message.name);
|
||||
if (maybeSubject) {
|
||||
maybeSubject.error(message.error);
|
||||
channelsSubject.delete(message.name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, () => {
|
||||
state = api_1.JobState.Errored;
|
||||
}),
|
||||
// Do output validation (might include default values so this might have side
|
||||
// effects). We keep all messages in order.
|
||||
(0, rxjs_1.concatMap)((message) => {
|
||||
if (message.kind !== api_1.JobOutboundMessageKind.Output) {
|
||||
return (0, rxjs_1.of)(message);
|
||||
}
|
||||
return handler.pipe((0, rxjs_1.switchMap)(async (handler) => {
|
||||
if (handler === null) {
|
||||
throw new exception_1.JobDoesNotExistException(name);
|
||||
}
|
||||
const validate = await handler.outputV;
|
||||
const output = await validate(message.value);
|
||||
if (!output.success) {
|
||||
throw new JobOutputSchemaValidationError(output.errors);
|
||||
}
|
||||
return {
|
||||
...message,
|
||||
output: output.data,
|
||||
};
|
||||
}));
|
||||
}), _jobShare());
|
||||
const output = outboundBus.pipe((0, rxjs_1.filter)((x) => x.kind == api_1.JobOutboundMessageKind.Output), (0, rxjs_1.map)((x) => x.value), (0, rxjs_1.shareReplay)(1));
|
||||
// Return the Job.
|
||||
return {
|
||||
get state() {
|
||||
return state;
|
||||
},
|
||||
argument,
|
||||
description: handler.pipe((0, rxjs_1.switchMap)((handler) => {
|
||||
if (handler === null) {
|
||||
throw new exception_1.JobDoesNotExistException(name);
|
||||
}
|
||||
else {
|
||||
return (0, rxjs_1.of)(handler.jobDescription);
|
||||
}
|
||||
})),
|
||||
output,
|
||||
getChannel(name, schema = true) {
|
||||
let maybeObservable = channels.get(name);
|
||||
if (!maybeObservable) {
|
||||
const s = new rxjs_1.Subject();
|
||||
channelsSubject.set(name, s);
|
||||
channels.set(name, s.asObservable());
|
||||
maybeObservable = s.asObservable();
|
||||
}
|
||||
return maybeObservable.pipe(
|
||||
// Keep the order of messages.
|
||||
(0, rxjs_1.concatMap)((message) => {
|
||||
return (0, rxjs_1.from)(schemaRegistry.compile(schema)).pipe((0, rxjs_1.switchMap)((validate) => validate(message)), (0, rxjs_1.filter)((x) => x.success), (0, rxjs_1.map)((x) => x.data));
|
||||
}));
|
||||
},
|
||||
ping() {
|
||||
const id = pingId++;
|
||||
inboundBus.next({ kind: api_1.JobInboundMessageKind.Ping, id });
|
||||
return outboundBus.pipe((0, rxjs_1.filter)((x) => x.kind === api_1.JobOutboundMessageKind.Pong && x.id == id), (0, rxjs_1.first)(), (0, rxjs_1.ignoreElements)());
|
||||
},
|
||||
stop() {
|
||||
inboundBus.next({ kind: api_1.JobInboundMessageKind.Stop });
|
||||
},
|
||||
input,
|
||||
inboundBus,
|
||||
outboundBus,
|
||||
};
|
||||
}
|
||||
_scheduleJob(name, argument, options, waitable) {
|
||||
// Get handler first, since this can error out if there's no handler for the job name.
|
||||
const handler = this._getInternalDescription(name);
|
||||
const optionsDeps = (options && options.dependencies) || [];
|
||||
const dependencies = Array.isArray(optionsDeps) ? optionsDeps : [optionsDeps];
|
||||
const inboundBus = new rxjs_1.Subject();
|
||||
const outboundBus = (0, rxjs_1.concat)(
|
||||
// Wait for dependencies, make sure to not report messages from dependencies. Subscribe to
|
||||
// all dependencies at the same time so they run concurrently.
|
||||
(0, rxjs_1.merge)(...dependencies.map((x) => x.outboundBus)).pipe((0, rxjs_1.ignoreElements)()),
|
||||
// Wait for pause() to clear (if necessary).
|
||||
waitable, (0, rxjs_1.from)(handler).pipe((0, rxjs_1.switchMap)((handler) => new rxjs_1.Observable((subscriber) => {
|
||||
if (!handler) {
|
||||
throw new exception_1.JobDoesNotExistException(name);
|
||||
}
|
||||
// Validate the argument.
|
||||
return (0, rxjs_1.from)(handler.argumentV)
|
||||
.pipe((0, rxjs_1.switchMap)((validate) => validate(argument)), (0, rxjs_1.switchMap)((output) => {
|
||||
if (!output.success) {
|
||||
throw new JobArgumentSchemaValidationError(output.errors);
|
||||
}
|
||||
const argument = output.data;
|
||||
const description = handler.jobDescription;
|
||||
subscriber.next({ kind: api_1.JobOutboundMessageKind.OnReady, description });
|
||||
const context = {
|
||||
description,
|
||||
dependencies: [...dependencies],
|
||||
inboundBus: inboundBus.asObservable(),
|
||||
scheduler: this,
|
||||
};
|
||||
return handler(argument, context);
|
||||
}))
|
||||
.subscribe(subscriber);
|
||||
}))));
|
||||
return this._createJob(name, argument, handler, inboundBus, outboundBus);
|
||||
}
|
||||
}
|
||||
exports.SimpleScheduler = SimpleScheduler;
|
28
my-app/node_modules/@angular-devkit/architect/src/jobs/strategy.d.ts
generated
vendored
Executable file
28
my-app/node_modules/@angular-devkit/architect/src/jobs/strategy.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { JsonValue } from '@angular-devkit/core';
|
||||
import { JobDescription, JobHandler } from './api';
|
||||
export declare namespace strategy {
|
||||
type JobStrategy<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue> = (handler: JobHandler<A, I, O>, options?: Partial<Readonly<JobDescription>>) => JobHandler<A, I, O>;
|
||||
/**
|
||||
* Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs.
|
||||
*/
|
||||
function serialize<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(): JobStrategy<A, I, O>;
|
||||
/**
|
||||
* Creates a JobStrategy that will always reuse a running job, and restart it if the job ended.
|
||||
* @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
|
||||
* is.
|
||||
*/
|
||||
function reuse<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(replayMessages?: boolean): JobStrategy<A, I, O>;
|
||||
/**
|
||||
* Creates a JobStrategy that will reuse a running job if the argument matches.
|
||||
* @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
|
||||
* is.
|
||||
*/
|
||||
function memoize<A extends JsonValue = JsonValue, I extends JsonValue = JsonValue, O extends JsonValue = JsonValue>(replayMessages?: boolean): JobStrategy<A, I, O>;
|
||||
}
|
98
my-app/node_modules/@angular-devkit/architect/src/jobs/strategy.js
generated
vendored
Executable file
98
my-app/node_modules/@angular-devkit/architect/src/jobs/strategy.js
generated
vendored
Executable file
|
@ -0,0 +1,98 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.strategy = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const api_1 = require("./api");
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
var strategy;
|
||||
(function (strategy) {
|
||||
/**
|
||||
* Creates a JobStrategy that serializes every call. This strategy can be mixed between jobs.
|
||||
*/
|
||||
function serialize() {
|
||||
let latest = (0, rxjs_1.of)();
|
||||
return (handler, options) => {
|
||||
const newHandler = (argument, context) => {
|
||||
const previous = latest;
|
||||
latest = (0, rxjs_1.concat)(previous.pipe((0, rxjs_1.ignoreElements)()), new rxjs_1.Observable((o) => handler(argument, context).subscribe(o))).pipe((0, rxjs_1.shareReplay)(0));
|
||||
return latest;
|
||||
};
|
||||
return Object.assign(newHandler, {
|
||||
jobDescription: Object.assign({}, handler.jobDescription, options),
|
||||
});
|
||||
};
|
||||
}
|
||||
strategy.serialize = serialize;
|
||||
/**
|
||||
* Creates a JobStrategy that will always reuse a running job, and restart it if the job ended.
|
||||
* @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
|
||||
* is.
|
||||
*/
|
||||
function reuse(replayMessages = false) {
|
||||
let inboundBus = new rxjs_1.Subject();
|
||||
let run = null;
|
||||
let state = null;
|
||||
return (handler, options) => {
|
||||
const newHandler = (argument, context) => {
|
||||
// Forward inputs.
|
||||
const subscription = context.inboundBus.subscribe(inboundBus);
|
||||
if (run) {
|
||||
return (0, rxjs_1.concat)(
|
||||
// Update state.
|
||||
(0, rxjs_1.of)(state), run).pipe((0, rxjs_1.finalize)(() => subscription.unsubscribe()));
|
||||
}
|
||||
run = handler(argument, { ...context, inboundBus: inboundBus.asObservable() }).pipe((0, rxjs_1.tap)((message) => {
|
||||
if (message.kind == api_1.JobOutboundMessageKind.Start ||
|
||||
message.kind == api_1.JobOutboundMessageKind.OnReady ||
|
||||
message.kind == api_1.JobOutboundMessageKind.End) {
|
||||
state = message;
|
||||
}
|
||||
}, undefined, () => {
|
||||
subscription.unsubscribe();
|
||||
inboundBus = new rxjs_1.Subject();
|
||||
run = null;
|
||||
}), replayMessages ? (0, rxjs_1.shareReplay)() : (0, rxjs_1.share)());
|
||||
return run;
|
||||
};
|
||||
return Object.assign(newHandler, handler, options || {});
|
||||
};
|
||||
}
|
||||
strategy.reuse = reuse;
|
||||
/**
|
||||
* Creates a JobStrategy that will reuse a running job if the argument matches.
|
||||
* @param replayMessages Replay ALL messages if a job is reused, otherwise just hook up where it
|
||||
* is.
|
||||
*/
|
||||
function memoize(replayMessages = false) {
|
||||
const runs = new Map();
|
||||
return (handler, options) => {
|
||||
const newHandler = (argument, context) => {
|
||||
const argumentJson = JSON.stringify((0, core_1.isJsonObject)(argument)
|
||||
? Object.keys(argument)
|
||||
.sort()
|
||||
.reduce((result, key) => {
|
||||
result[key] = argument[key];
|
||||
return result;
|
||||
}, {})
|
||||
: argument);
|
||||
const maybeJob = runs.get(argumentJson);
|
||||
if (maybeJob) {
|
||||
return maybeJob;
|
||||
}
|
||||
const run = handler(argument, context).pipe(replayMessages ? (0, rxjs_1.shareReplay)() : (0, rxjs_1.share)());
|
||||
runs.set(argumentJson, run);
|
||||
return run;
|
||||
};
|
||||
return Object.assign(newHandler, handler, options || {});
|
||||
};
|
||||
}
|
||||
strategy.memoize = memoize;
|
||||
})(strategy || (exports.strategy = strategy = {}));
|
15
my-app/node_modules/@angular-devkit/architect/src/jobs/types.d.ts
generated
vendored
Executable file
15
my-app/node_modules/@angular-devkit/architect/src/jobs/types.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
export type DeepReadonly<T> = T extends (infer R)[] ? DeepReadonlyArray<R> : T extends Function ? T : T extends object ? DeepReadonlyObject<T> : T;
|
||||
export type DeepReadonlyArray<T> = Array<DeepReadonly<T>>;
|
||||
export type DeepReadonlyObject<T> = {
|
||||
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
||||
};
|
||||
export type Readwrite<T> = {
|
||||
-readonly [P in keyof T]: T[P];
|
||||
};
|
9
my-app/node_modules/@angular-devkit/architect/src/jobs/types.js
generated
vendored
Executable file
9
my-app/node_modules/@angular-devkit/architect/src/jobs/types.js
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
15
my-app/node_modules/@angular-devkit/architect/src/output-schema.d.ts
generated
vendored
Executable file
15
my-app/node_modules/@angular-devkit/architect/src/output-schema.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,15 @@
|
|||
export interface Schema {
|
||||
error?: string;
|
||||
info?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
success: boolean;
|
||||
target?: Target;
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface Target {
|
||||
configuration?: string;
|
||||
project?: string;
|
||||
target?: string;
|
||||
[property: string]: any;
|
||||
}
|
4
my-app/node_modules/@angular-devkit/architect/src/output-schema.js
generated
vendored
Executable file
4
my-app/node_modules/@angular-devkit/architect/src/output-schema.js
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
"use strict";
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
||||
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
33
my-app/node_modules/@angular-devkit/architect/src/output-schema.json
generated
vendored
Executable file
33
my-app/node_modules/@angular-devkit/architect/src/output-schema.json
generated
vendored
Executable file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"$id": "BuilderOutputSchema",
|
||||
"title": "Output schema for builders.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"project": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
},
|
||||
"configuration": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"additionalProperties": true,
|
||||
"required": ["success"]
|
||||
}
|
21
my-app/node_modules/@angular-devkit/architect/src/progress-schema.d.ts
generated
vendored
Executable file
21
my-app/node_modules/@angular-devkit/architect/src/progress-schema.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
export interface Schema {
|
||||
builder: {
|
||||
[key: string]: any;
|
||||
};
|
||||
current?: number;
|
||||
error?: any;
|
||||
id: number;
|
||||
state: State;
|
||||
status?: string;
|
||||
target?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
total?: number;
|
||||
[property: string]: any;
|
||||
}
|
||||
export declare enum State {
|
||||
Error = "error",
|
||||
Running = "running",
|
||||
Stopped = "stopped",
|
||||
Waiting = "waiting"
|
||||
}
|
12
my-app/node_modules/@angular-devkit/architect/src/progress-schema.js
generated
vendored
Executable file
12
my-app/node_modules/@angular-devkit/architect/src/progress-schema.js
generated
vendored
Executable file
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
||||
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.State = void 0;
|
||||
var State;
|
||||
(function (State) {
|
||||
State["Error"] = "error";
|
||||
State["Running"] = "running";
|
||||
State["Stopped"] = "stopped";
|
||||
State["Waiting"] = "waiting";
|
||||
})(State || (exports.State = State = {}));
|
83
my-app/node_modules/@angular-devkit/architect/src/progress-schema.json
generated
vendored
Executable file
83
my-app/node_modules/@angular-devkit/architect/src/progress-schema.json
generated
vendored
Executable file
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"$id": "BuilderProgressSchema",
|
||||
"title": "Progress schema for builders.",
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": ["stopped"]
|
||||
}
|
||||
},
|
||||
"required": ["state"]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": ["waiting"]
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["state"]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": ["running"]
|
||||
},
|
||||
"current": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"total": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["state"]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": ["error"]
|
||||
},
|
||||
"error": true
|
||||
},
|
||||
"required": ["state"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"builder": {
|
||||
"type": "object"
|
||||
},
|
||||
"target": {
|
||||
"type": "object"
|
||||
},
|
||||
"id": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": ["builder", "id"]
|
||||
}
|
||||
]
|
||||
}
|
23
my-app/node_modules/@angular-devkit/architect/src/schedule-by-name.d.ts
generated
vendored
Executable file
23
my-app/node_modules/@angular-devkit/architect/src/schedule-by-name.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { json, logging } from '@angular-devkit/core';
|
||||
import { BuilderRun, Target } from './api';
|
||||
import { Scheduler } from './jobs';
|
||||
export declare function scheduleByName(name: string, buildOptions: json.JsonObject, options: {
|
||||
target?: Target;
|
||||
scheduler: Scheduler;
|
||||
logger: logging.LoggerApi;
|
||||
workspaceRoot: string | Promise<string>;
|
||||
currentDirectory: string | Promise<string>;
|
||||
}): Promise<BuilderRun>;
|
||||
export declare function scheduleByTarget(target: Target, overrides: json.JsonObject, options: {
|
||||
scheduler: Scheduler;
|
||||
logger: logging.LoggerApi;
|
||||
workspaceRoot: string | Promise<string>;
|
||||
currentDirectory: string | Promise<string>;
|
||||
}): Promise<BuilderRun>;
|
101
my-app/node_modules/@angular-devkit/architect/src/schedule-by-name.js
generated
vendored
Executable file
101
my-app/node_modules/@angular-devkit/architect/src/schedule-by-name.js
generated
vendored
Executable file
|
@ -0,0 +1,101 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.scheduleByTarget = exports.scheduleByName = void 0;
|
||||
const rxjs_1 = require("rxjs");
|
||||
const api_1 = require("./api");
|
||||
const jobs_1 = require("./jobs");
|
||||
const progressSchema = require('./progress-schema.json');
|
||||
let _uniqueId = 0;
|
||||
async function scheduleByName(name, buildOptions, options) {
|
||||
const childLoggerName = options.target ? `{${(0, api_1.targetStringFromTarget)(options.target)}}` : name;
|
||||
const logger = options.logger.createChild(childLoggerName);
|
||||
const job = options.scheduler.schedule(name, {});
|
||||
let stateSubscription;
|
||||
const workspaceRoot = await options.workspaceRoot;
|
||||
const currentDirectory = await options.currentDirectory;
|
||||
const description = await (0, rxjs_1.firstValueFrom)(job.description);
|
||||
const info = description.info;
|
||||
const id = ++_uniqueId;
|
||||
const message = {
|
||||
id,
|
||||
currentDirectory,
|
||||
workspaceRoot,
|
||||
info: info,
|
||||
options: buildOptions,
|
||||
...(options.target ? { target: options.target } : {}),
|
||||
};
|
||||
// Wait for the job to be ready.
|
||||
if (job.state !== jobs_1.JobState.Started) {
|
||||
stateSubscription = job.outboundBus.subscribe({
|
||||
next: (event) => {
|
||||
if (event.kind === jobs_1.JobOutboundMessageKind.Start) {
|
||||
job.input.next(message);
|
||||
}
|
||||
},
|
||||
error: () => { },
|
||||
});
|
||||
}
|
||||
else {
|
||||
job.input.next(message);
|
||||
}
|
||||
const logChannelSub = job.getChannel('log').subscribe({
|
||||
next: (entry) => {
|
||||
logger.next(entry);
|
||||
},
|
||||
error: () => { },
|
||||
});
|
||||
const outboundBusSub = job.outboundBus.subscribe({
|
||||
error() { },
|
||||
complete() {
|
||||
outboundBusSub.unsubscribe();
|
||||
logChannelSub.unsubscribe();
|
||||
stateSubscription.unsubscribe();
|
||||
},
|
||||
});
|
||||
const output = job.output.pipe((0, rxjs_1.map)((output) => ({
|
||||
...output,
|
||||
...(options.target ? { target: options.target } : 0),
|
||||
info,
|
||||
})), (0, rxjs_1.shareReplay)());
|
||||
// Start the builder.
|
||||
output.pipe((0, rxjs_1.first)()).subscribe({
|
||||
error: () => { },
|
||||
});
|
||||
return {
|
||||
id,
|
||||
info,
|
||||
// This is a getter so that it always returns the next output, and not the same one.
|
||||
get result() {
|
||||
return (0, rxjs_1.firstValueFrom)(output);
|
||||
},
|
||||
get lastOutput() {
|
||||
return (0, rxjs_1.lastValueFrom)(output);
|
||||
},
|
||||
output,
|
||||
progress: job
|
||||
.getChannel('progress', progressSchema)
|
||||
.pipe((0, rxjs_1.shareReplay)(1)),
|
||||
stop() {
|
||||
job.stop();
|
||||
return job.outboundBus
|
||||
.pipe((0, rxjs_1.ignoreElements)(), (0, rxjs_1.catchError)(() => rxjs_1.EMPTY))
|
||||
.toPromise();
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.scheduleByName = scheduleByName;
|
||||
async function scheduleByTarget(target, overrides, options) {
|
||||
return scheduleByName(`{${(0, api_1.targetStringFromTarget)(target)}}`, overrides, {
|
||||
...options,
|
||||
target,
|
||||
logger: options.logger,
|
||||
});
|
||||
}
|
||||
exports.scheduleByTarget = scheduleByTarget;
|
39
my-app/node_modules/@angular-devkit/architect/src/targets-schema.json
generated
vendored
Executable file
39
my-app/node_modules/@angular-devkit/architect/src/targets-schema.json
generated
vendored
Executable file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"$id": "ArchitectTargets",
|
||||
"title": "Targets schema for validating Architect targets configuration.",
|
||||
"type": "object",
|
||||
"description": "A map of available project targets.",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/target"
|
||||
},
|
||||
"required": [],
|
||||
"definitions": {
|
||||
"target": {
|
||||
"type": "object",
|
||||
"description": "Target options.",
|
||||
"properties": {
|
||||
"builder": {
|
||||
"type": "string",
|
||||
"description": "The builder used for this package."
|
||||
},
|
||||
"options": {
|
||||
"$ref": "#/definitions/options"
|
||||
},
|
||||
"configurations": {
|
||||
"type": "object",
|
||||
"description": "A map of alternative target options.",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/options"
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": ["builder", "options"]
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"description": "Target options."
|
||||
}
|
||||
}
|
||||
}
|
9
my-app/node_modules/@angular-devkit/architect/testing/index.d.ts
generated
vendored
Executable file
9
my-app/node_modules/@angular-devkit/architect/testing/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
export * from './testing-architect-host';
|
||||
export * from './test-project-host';
|
25
my-app/node_modules/@angular-devkit/architect/testing/index.js
generated
vendored
Executable file
25
my-app/node_modules/@angular-devkit/architect/testing/index.js
generated
vendored
Executable file
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./testing-architect-host"), exports);
|
||||
__exportStar(require("./test-project-host"), exports);
|
35
my-app/node_modules/@angular-devkit/architect/testing/test-project-host.d.ts
generated
vendored
Executable file
35
my-app/node_modules/@angular-devkit/architect/testing/test-project-host.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
/// <reference types="@types/node/fs" />
|
||||
/// <reference types="@types/node/ts4.8/fs" />
|
||||
import { Path, PathFragment, virtualFs } from '@angular-devkit/core';
|
||||
import { NodeJsSyncHost } from '@angular-devkit/core/node';
|
||||
import { Stats } from 'fs';
|
||||
import { Observable } from 'rxjs';
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export declare class TestProjectHost extends NodeJsSyncHost {
|
||||
protected _templateRoot: Path;
|
||||
private _currentRoot;
|
||||
private _scopedSyncHost;
|
||||
constructor(_templateRoot: Path);
|
||||
root(): Path;
|
||||
scopedSync(): virtualFs.SyncDelegateHost<Stats>;
|
||||
initialize(): Observable<void>;
|
||||
restore(): Observable<void>;
|
||||
writeMultipleFiles(files: {
|
||||
[path: string]: string | ArrayBufferLike | Buffer;
|
||||
}): void;
|
||||
replaceInFile(path: string, match: RegExp | string, replacement: string): void;
|
||||
appendToFile(path: string, str: string): void;
|
||||
fileMatchExists(dir: string, regex: RegExp): PathFragment | undefined;
|
||||
copyFile(from: string, to: string): void;
|
||||
private findUniqueFolderPath;
|
||||
}
|
109
my-app/node_modules/@angular-devkit/architect/testing/test-project-host.js
generated
vendored
Executable file
109
my-app/node_modules/@angular-devkit/architect/testing/test-project-host.js
generated
vendored
Executable file
|
@ -0,0 +1,109 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TestProjectHost = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const node_1 = require("@angular-devkit/core/node");
|
||||
const rxjs_1 = require("rxjs");
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
class TestProjectHost extends node_1.NodeJsSyncHost {
|
||||
_templateRoot;
|
||||
_currentRoot = null;
|
||||
_scopedSyncHost = null;
|
||||
constructor(_templateRoot) {
|
||||
super();
|
||||
this._templateRoot = _templateRoot;
|
||||
}
|
||||
root() {
|
||||
if (this._currentRoot === null) {
|
||||
throw new Error('TestProjectHost must be initialized before being used.');
|
||||
}
|
||||
return this._currentRoot;
|
||||
}
|
||||
scopedSync() {
|
||||
if (this._currentRoot === null || this._scopedSyncHost === null) {
|
||||
throw new Error('TestProjectHost must be initialized before being used.');
|
||||
}
|
||||
return this._scopedSyncHost;
|
||||
}
|
||||
initialize() {
|
||||
const recursiveList = (path) => this.list(path).pipe(
|
||||
// Emit each fragment individually.
|
||||
(0, rxjs_1.concatMap)((fragments) => (0, rxjs_1.from)(fragments)),
|
||||
// Join the path with fragment.
|
||||
(0, rxjs_1.map)((fragment) => (0, core_1.join)(path, fragment)),
|
||||
// Emit directory content paths instead of the directory path.
|
||||
(0, rxjs_1.mergeMap)((path) => this.isDirectory(path).pipe((0, rxjs_1.concatMap)((isDir) => (isDir ? recursiveList(path) : (0, rxjs_1.of)(path))))));
|
||||
// Find a unique folder that we can write to use as current root.
|
||||
return this.findUniqueFolderPath().pipe(
|
||||
// Save the path and create a scoped host for it.
|
||||
(0, rxjs_1.tap)((newFolderPath) => {
|
||||
this._currentRoot = newFolderPath;
|
||||
this._scopedSyncHost = new core_1.virtualFs.SyncDelegateHost(new core_1.virtualFs.ScopedHost(this, this.root()));
|
||||
}),
|
||||
// List all files in root.
|
||||
(0, rxjs_1.concatMap)(() => recursiveList(this._templateRoot)),
|
||||
// Copy them over to the current root.
|
||||
(0, rxjs_1.concatMap)((from) => {
|
||||
const to = (0, core_1.join)(this.root(), (0, core_1.relative)(this._templateRoot, from));
|
||||
return this.read(from).pipe((0, rxjs_1.concatMap)((buffer) => this.write(to, buffer)));
|
||||
}), (0, rxjs_1.map)(() => { }));
|
||||
}
|
||||
restore() {
|
||||
if (this._currentRoot === null) {
|
||||
return rxjs_1.EMPTY;
|
||||
}
|
||||
// Delete the current root and clear the variables.
|
||||
// Wait 50ms and retry up to 10 times, to give time for file locks to clear.
|
||||
return this.exists(this.root()).pipe((0, rxjs_1.delay)(50), (0, rxjs_1.concatMap)((exists) => (exists ? this.delete(this.root()) : rxjs_1.EMPTY)), (0, rxjs_1.retry)(10), (0, rxjs_1.finalize)(() => {
|
||||
this._currentRoot = null;
|
||||
this._scopedSyncHost = null;
|
||||
}));
|
||||
}
|
||||
writeMultipleFiles(files) {
|
||||
Object.keys(files).forEach((fileName) => {
|
||||
let content = files[fileName];
|
||||
if (typeof content == 'string') {
|
||||
content = core_1.virtualFs.stringToFileBuffer(content);
|
||||
}
|
||||
else if (content instanceof Buffer) {
|
||||
content = content.buffer.slice(content.byteOffset, content.byteOffset + content.byteLength);
|
||||
}
|
||||
this.scopedSync().write((0, core_1.normalize)(fileName), content);
|
||||
});
|
||||
}
|
||||
replaceInFile(path, match, replacement) {
|
||||
const content = core_1.virtualFs.fileBufferToString(this.scopedSync().read((0, core_1.normalize)(path)));
|
||||
this.scopedSync().write((0, core_1.normalize)(path), core_1.virtualFs.stringToFileBuffer(content.replace(match, replacement)));
|
||||
}
|
||||
appendToFile(path, str) {
|
||||
const content = core_1.virtualFs.fileBufferToString(this.scopedSync().read((0, core_1.normalize)(path)));
|
||||
this.scopedSync().write((0, core_1.normalize)(path), core_1.virtualFs.stringToFileBuffer(content.concat(str)));
|
||||
}
|
||||
fileMatchExists(dir, regex) {
|
||||
const [fileName] = this.scopedSync()
|
||||
.list((0, core_1.normalize)(dir))
|
||||
.filter((name) => name.match(regex));
|
||||
return fileName || undefined;
|
||||
}
|
||||
copyFile(from, to) {
|
||||
const content = this.scopedSync().read((0, core_1.normalize)(from));
|
||||
this.scopedSync().write((0, core_1.normalize)(to), content);
|
||||
}
|
||||
findUniqueFolderPath() {
|
||||
// 11 character alphanumeric string.
|
||||
const randomString = Math.random().toString(36).slice(2);
|
||||
const newFolderName = `test-project-host-${(0, core_1.basename)(this._templateRoot)}-${randomString}`;
|
||||
const newFolderPath = (0, core_1.join)((0, core_1.dirname)(this._templateRoot), newFolderName);
|
||||
return this.exists(newFolderPath).pipe((0, rxjs_1.concatMap)((exists) => (exists ? this.findUniqueFolderPath() : (0, rxjs_1.of)(newFolderPath))));
|
||||
}
|
||||
}
|
||||
exports.TestProjectHost = TestProjectHost;
|
42
my-app/node_modules/@angular-devkit/architect/testing/testing-architect-host.d.ts
generated
vendored
Executable file
42
my-app/node_modules/@angular-devkit/architect/testing/testing-architect-host.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { json } from '@angular-devkit/core';
|
||||
import { BuilderInfo, Target } from '../src';
|
||||
import { ArchitectHost, Builder } from '../src/internal';
|
||||
export declare class TestingArchitectHost implements ArchitectHost {
|
||||
workspaceRoot: string;
|
||||
currentDirectory: string;
|
||||
private _backendHost;
|
||||
private _builderImportMap;
|
||||
private _builderMap;
|
||||
private _targetMap;
|
||||
/**
|
||||
* Can provide a backend host, in case of integration tests.
|
||||
* @param workspaceRoot The workspace root to use.
|
||||
* @param currentDirectory The current directory to use.
|
||||
* @param _backendHost A host to defer calls that aren't resolved here.
|
||||
*/
|
||||
constructor(workspaceRoot?: string, currentDirectory?: string, _backendHost?: ArchitectHost | null);
|
||||
addBuilder(builderName: string, builder: Builder, description?: string, optionSchema?: json.schema.JsonSchema): void;
|
||||
addBuilderFromPackage(packageName: string): Promise<void>;
|
||||
addTarget(target: Target, builderName: string, options?: json.JsonObject): void;
|
||||
getBuilderNameForTarget(target: Target): Promise<string | null>;
|
||||
/**
|
||||
* Resolve a builder. This needs to return a string which will be used in a dynamic `import()`
|
||||
* clause. This should throw if no builder can be found. The dynamic import will throw if
|
||||
* it is unsupported.
|
||||
* @param builderName The name of the builder to be used.
|
||||
* @returns All the info needed for the builder itself.
|
||||
*/
|
||||
resolveBuilder(builderName: string): Promise<BuilderInfo | null>;
|
||||
getCurrentDirectory(): Promise<string>;
|
||||
getWorkspaceRoot(): Promise<string>;
|
||||
getOptionsForTarget(target: Target): Promise<json.JsonObject | null>;
|
||||
getProjectMetadata(target: Target | string): Promise<json.JsonObject | null>;
|
||||
loadBuilder(info: BuilderInfo): Promise<Builder | null>;
|
||||
}
|
126
my-app/node_modules/@angular-devkit/architect/testing/testing-architect-host.js
generated
vendored
Executable file
126
my-app/node_modules/@angular-devkit/architect/testing/testing-architect-host.js
generated
vendored
Executable file
|
@ -0,0 +1,126 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TestingArchitectHost = void 0;
|
||||
const src_1 = require("../src");
|
||||
class TestingArchitectHost {
|
||||
workspaceRoot;
|
||||
currentDirectory;
|
||||
_backendHost;
|
||||
_builderImportMap = new Map();
|
||||
_builderMap = new Map();
|
||||
_targetMap = new Map();
|
||||
/**
|
||||
* Can provide a backend host, in case of integration tests.
|
||||
* @param workspaceRoot The workspace root to use.
|
||||
* @param currentDirectory The current directory to use.
|
||||
* @param _backendHost A host to defer calls that aren't resolved here.
|
||||
*/
|
||||
constructor(workspaceRoot = '', currentDirectory = workspaceRoot, _backendHost = null) {
|
||||
this.workspaceRoot = workspaceRoot;
|
||||
this.currentDirectory = currentDirectory;
|
||||
this._backendHost = _backendHost;
|
||||
}
|
||||
addBuilder(builderName, builder, description = 'Testing only builder.', optionSchema = { type: 'object' }) {
|
||||
this._builderImportMap.set(builderName, builder);
|
||||
this._builderMap.set(builderName, { builderName, description, optionSchema });
|
||||
}
|
||||
async addBuilderFromPackage(packageName) {
|
||||
const packageJson = await Promise.resolve(`${packageName + '/package.json'}`).then(s => __importStar(require(s)));
|
||||
if (!('builders' in packageJson)) {
|
||||
throw new Error('Invalid package.json, builders key not found.');
|
||||
}
|
||||
if (!packageJson.name) {
|
||||
throw new Error('Invalid package name');
|
||||
}
|
||||
const builderJsonPath = packageName + '/' + packageJson['builders'];
|
||||
const builderJson = await Promise.resolve(`${builderJsonPath}`).then(s => __importStar(require(s)));
|
||||
const builders = builderJson['builders'];
|
||||
if (!builders) {
|
||||
throw new Error('Invalid builders.json, builders key not found.');
|
||||
}
|
||||
for (const builderName of Object.keys(builders)) {
|
||||
const b = builders[builderName];
|
||||
// TODO: remove this check as v1 is not supported anymore.
|
||||
if (!b.implementation) {
|
||||
continue;
|
||||
}
|
||||
const handler = (await Promise.resolve(`${builderJsonPath + '/../' + b.implementation}`).then(s => __importStar(require(s)))).default;
|
||||
const optionsSchema = await Promise.resolve(`${builderJsonPath + '/../' + b.schema}`).then(s => __importStar(require(s)));
|
||||
this.addBuilder(`${packageJson.name}:${builderName}`, handler, b.description, optionsSchema);
|
||||
}
|
||||
}
|
||||
addTarget(target, builderName, options = {}) {
|
||||
this._targetMap.set((0, src_1.targetStringFromTarget)(target), { builderName, options });
|
||||
}
|
||||
async getBuilderNameForTarget(target) {
|
||||
const name = (0, src_1.targetStringFromTarget)(target);
|
||||
const maybeTarget = this._targetMap.get(name);
|
||||
if (!maybeTarget) {
|
||||
return this._backendHost && this._backendHost.getBuilderNameForTarget(target);
|
||||
}
|
||||
return maybeTarget.builderName;
|
||||
}
|
||||
/**
|
||||
* Resolve a builder. This needs to return a string which will be used in a dynamic `import()`
|
||||
* clause. This should throw if no builder can be found. The dynamic import will throw if
|
||||
* it is unsupported.
|
||||
* @param builderName The name of the builder to be used.
|
||||
* @returns All the info needed for the builder itself.
|
||||
*/
|
||||
async resolveBuilder(builderName) {
|
||||
return (this._builderMap.get(builderName) ||
|
||||
(this._backendHost && this._backendHost.resolveBuilder(builderName)));
|
||||
}
|
||||
async getCurrentDirectory() {
|
||||
return this.currentDirectory;
|
||||
}
|
||||
async getWorkspaceRoot() {
|
||||
return this.workspaceRoot;
|
||||
}
|
||||
async getOptionsForTarget(target) {
|
||||
const name = (0, src_1.targetStringFromTarget)(target);
|
||||
const maybeTarget = this._targetMap.get(name);
|
||||
if (!maybeTarget) {
|
||||
return this._backendHost && this._backendHost.getOptionsForTarget(target);
|
||||
}
|
||||
return maybeTarget.options;
|
||||
}
|
||||
async getProjectMetadata(target) {
|
||||
return this._backendHost && this._backendHost.getProjectMetadata(target);
|
||||
}
|
||||
async loadBuilder(info) {
|
||||
return (this._builderImportMap.get(info.builderName) ||
|
||||
(this._backendHost && this._backendHost.loadBuilder(info)));
|
||||
}
|
||||
}
|
||||
exports.TestingArchitectHost = TestingArchitectHost;
|
21
my-app/node_modules/@angular-devkit/build-angular/LICENSE
generated
vendored
Executable file
21
my-app/node_modules/@angular-devkit/build-angular/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2017 Google, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
24
my-app/node_modules/@angular-devkit/build-angular/README.md
generated
vendored
Executable file
24
my-app/node_modules/@angular-devkit/build-angular/README.md
generated
vendored
Executable file
|
@ -0,0 +1,24 @@
|
|||
# @angular-devkit/build-angular
|
||||
|
||||
This package contains [Architect builders](/packages/angular_devkit/architect/README.md) used to build and test Angular applications and libraries.
|
||||
|
||||
## Builders
|
||||
|
||||
| Name | Description |
|
||||
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| application | Build an Angular application targeting a browser and server environment using [esbuild](https://esbuild.github.io). |
|
||||
| app-shell | Build an Angular [App shell](https://angular.io/guide/app-shell). |
|
||||
| browser | Build an Angular application targeting a browser environment using [Webpack](https://webpack.js.org). |
|
||||
| browser-esbuild | Build an Angular application targeting a browser environment using [esbuild](https://esbuild.github.io). |
|
||||
| dev-server | A development server that provides live reloading. |
|
||||
| extract-i18n | Extract i18n messages from an Angular application. |
|
||||
| karma | Execute unit tests using [Karma](https://github.com/karma-runner/karma) test runner. |
|
||||
| ng-packagr | Build and package an Angular library in [Angular Package Format (APF)](https://angular.io/guide/angular-package-format) format using [ng-packagr](https://github.com/ng-packagr/ng-packagr). |
|
||||
| prerender | [Prerender](https://angular.io/guide/prerendering) pages of your application. Prerendering is the process where a dynamic page is processed at build time generating static HTML. |
|
||||
| server | Build an Angular application targeting a [Node.js](https://nodejs.org) environment. |
|
||||
| ssr-dev-server | A development server which offers live reload during development, but uses server-side rendering. |
|
||||
| protractor | **Deprecated** - Run end-to-end tests using [Protractor](https://www.protractortest.org/) framework. |
|
||||
|
||||
## Disclaimer
|
||||
|
||||
While the builders when executed via the Angular CLI and their associated options are considered stable, the programmatic APIs are not considered officially supported and are not subject to the breaking change guarantees of SemVer.
|
75
my-app/node_modules/@angular-devkit/build-angular/builders.json
generated
vendored
Executable file
75
my-app/node_modules/@angular-devkit/build-angular/builders.json
generated
vendored
Executable file
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"$schema": "../architect/src/builders-schema.json",
|
||||
"builders": {
|
||||
"application": {
|
||||
"implementation": "./src/builders/application",
|
||||
"schema": "./src/builders/application/schema.json",
|
||||
"description": "Build an application."
|
||||
},
|
||||
"app-shell": {
|
||||
"implementation": "./src/builders/app-shell",
|
||||
"schema": "./src/builders/app-shell/schema.json",
|
||||
"description": "Build a server application and a browser application, then render the index.html and use it for the browser output."
|
||||
},
|
||||
"browser": {
|
||||
"implementation": "./src/builders/browser",
|
||||
"schema": "./src/builders/browser/schema.json",
|
||||
"description": "Build a browser application."
|
||||
},
|
||||
"browser-esbuild": {
|
||||
"implementation": "./src/builders/browser-esbuild",
|
||||
"schema": "./src/builders/browser-esbuild/schema.json",
|
||||
"description": "Build a browser application."
|
||||
},
|
||||
"dev-server": {
|
||||
"implementation": "./src/builders/dev-server",
|
||||
"schema": "./src/builders/dev-server/schema.json",
|
||||
"description": "Serve a browser application."
|
||||
},
|
||||
"extract-i18n": {
|
||||
"implementation": "./src/builders/extract-i18n",
|
||||
"schema": "./src/builders/extract-i18n/schema.json",
|
||||
"description": "Extract i18n strings from a browser application."
|
||||
},
|
||||
"jest": {
|
||||
"implementation": "./src/builders/jest",
|
||||
"schema": "./src/builders/jest/schema.json",
|
||||
"description": "Run unit tests using Jest."
|
||||
},
|
||||
"karma": {
|
||||
"implementation": "./src/builders/karma",
|
||||
"schema": "./src/builders/karma/schema.json",
|
||||
"description": "Run Karma unit tests."
|
||||
},
|
||||
"web-test-runner": {
|
||||
"implementation": "./src/builders/web-test-runner",
|
||||
"schema": "./src/builders/web-test-runner/schema.json",
|
||||
"description": "Run unit tests with Web Test Runner."
|
||||
},
|
||||
"protractor": {
|
||||
"implementation": "./src/builders/protractor",
|
||||
"schema": "./src/builders/protractor/schema.json",
|
||||
"description": "Run protractor over a dev server."
|
||||
},
|
||||
"server": {
|
||||
"implementation": "./src/builders/server",
|
||||
"schema": "./src/builders/server/schema.json",
|
||||
"description": "Build a server Angular application."
|
||||
},
|
||||
"ng-packagr": {
|
||||
"implementation": "./src/builders/ng-packagr",
|
||||
"schema": "./src/builders/ng-packagr/schema.json",
|
||||
"description": "Build a library with ng-packagr."
|
||||
},
|
||||
"ssr-dev-server": {
|
||||
"implementation": "./src/builders/ssr-dev-server",
|
||||
"schema": "./src/builders/ssr-dev-server/schema.json",
|
||||
"description": "Serve a universal application."
|
||||
},
|
||||
"prerender": {
|
||||
"implementation": "./src/builders/prerender",
|
||||
"schema": "./src/builders/prerender/schema.json",
|
||||
"description": "Perform build-time prerendering of chosen routes."
|
||||
}
|
||||
}
|
||||
}
|
149
my-app/node_modules/@angular-devkit/build-angular/package.json
generated
vendored
Executable file
149
my-app/node_modules/@angular-devkit/build-angular/package.json
generated
vendored
Executable file
|
@ -0,0 +1,149 @@
|
|||
{
|
||||
"name": "@angular-devkit/build-angular",
|
||||
"version": "17.1.3",
|
||||
"description": "Angular Webpack Build Facade",
|
||||
"main": "src/index.js",
|
||||
"typings": "src/index.d.ts",
|
||||
"builders": "builders.json",
|
||||
"dependencies": {
|
||||
"@ampproject/remapping": "2.2.1",
|
||||
"@angular-devkit/architect": "0.1701.3",
|
||||
"@angular-devkit/build-webpack": "0.1701.3",
|
||||
"@angular-devkit/core": "17.1.3",
|
||||
"@babel/core": "7.23.7",
|
||||
"@babel/generator": "7.23.6",
|
||||
"@babel/helper-annotate-as-pure": "7.22.5",
|
||||
"@babel/helper-split-export-declaration": "7.22.6",
|
||||
"@babel/plugin-transform-async-generator-functions": "7.23.7",
|
||||
"@babel/plugin-transform-async-to-generator": "7.23.3",
|
||||
"@babel/plugin-transform-runtime": "7.23.7",
|
||||
"@babel/preset-env": "7.23.7",
|
||||
"@babel/runtime": "7.23.7",
|
||||
"@discoveryjs/json-ext": "0.5.7",
|
||||
"@ngtools/webpack": "17.1.3",
|
||||
"@vitejs/plugin-basic-ssl": "1.0.2",
|
||||
"ansi-colors": "4.1.3",
|
||||
"autoprefixer": "10.4.16",
|
||||
"babel-loader": "9.1.3",
|
||||
"babel-plugin-istanbul": "6.1.1",
|
||||
"browserslist": "^4.21.5",
|
||||
"copy-webpack-plugin": "11.0.0",
|
||||
"critters": "0.0.20",
|
||||
"css-loader": "6.8.1",
|
||||
"esbuild-wasm": "0.19.11",
|
||||
"fast-glob": "3.3.2",
|
||||
"https-proxy-agent": "7.0.2",
|
||||
"http-proxy-middleware": "2.0.6",
|
||||
"inquirer": "9.2.12",
|
||||
"jsonc-parser": "3.2.0",
|
||||
"karma-source-map-support": "1.4.0",
|
||||
"less": "4.2.0",
|
||||
"less-loader": "11.1.0",
|
||||
"license-webpack-plugin": "4.0.2",
|
||||
"loader-utils": "3.2.1",
|
||||
"magic-string": "0.30.5",
|
||||
"mini-css-extract-plugin": "2.7.6",
|
||||
"mrmime": "2.0.0",
|
||||
"open": "8.4.2",
|
||||
"ora": "5.4.1",
|
||||
"parse5-html-rewriting-stream": "7.0.0",
|
||||
"picomatch": "3.0.1",
|
||||
"piscina": "4.2.1",
|
||||
"postcss": "8.4.33",
|
||||
"postcss-loader": "7.3.4",
|
||||
"resolve-url-loader": "5.0.0",
|
||||
"rxjs": "7.8.1",
|
||||
"sass": "1.69.7",
|
||||
"sass-loader": "13.3.3",
|
||||
"semver": "7.5.4",
|
||||
"source-map-loader": "5.0.0",
|
||||
"source-map-support": "0.5.21",
|
||||
"terser": "5.26.0",
|
||||
"text-table": "0.2.0",
|
||||
"tree-kill": "1.2.2",
|
||||
"tslib": "2.6.2",
|
||||
"undici": "6.2.1",
|
||||
"vite": "5.0.12",
|
||||
"watchpack": "2.4.0",
|
||||
"webpack": "5.89.0",
|
||||
"webpack-dev-middleware": "6.1.1",
|
||||
"webpack-dev-server": "4.15.1",
|
||||
"webpack-merge": "5.10.0",
|
||||
"webpack-subresource-integrity": "5.1.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"esbuild": "0.19.11"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/compiler-cli": "^17.0.0",
|
||||
"@angular/localize": "^17.0.0",
|
||||
"@angular/platform-server": "^17.0.0",
|
||||
"@angular/service-worker": "^17.0.0",
|
||||
"@web/test-runner": "^0.18.0",
|
||||
"browser-sync": "^3.0.2",
|
||||
"jest": "^29.5.0",
|
||||
"jest-environment-jsdom": "^29.5.0",
|
||||
"karma": "^6.3.0",
|
||||
"ng-packagr": "^17.0.0",
|
||||
"protractor": "^7.0.0",
|
||||
"tailwindcss": "^2.0.0 || ^3.0.0",
|
||||
"typescript": ">=5.2 <5.4"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@angular/localize": {
|
||||
"optional": true
|
||||
},
|
||||
"@angular/platform-server": {
|
||||
"optional": true
|
||||
},
|
||||
"@angular/service-worker": {
|
||||
"optional": true
|
||||
},
|
||||
"@web/test-runner": {
|
||||
"optional": true
|
||||
},
|
||||
"browser-sync": {
|
||||
"optional": true
|
||||
},
|
||||
"jest": {
|
||||
"optional": true
|
||||
},
|
||||
"jest-environment-jsdom": {
|
||||
"optional": true
|
||||
},
|
||||
"karma": {
|
||||
"optional": true
|
||||
},
|
||||
"ng-packagr": {
|
||||
"optional": true
|
||||
},
|
||||
"protractor": {
|
||||
"optional": true
|
||||
},
|
||||
"tailwindcss": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"Angular CLI",
|
||||
"Angular DevKit",
|
||||
"angular",
|
||||
"devkit",
|
||||
"sdk"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/angular/angular-cli.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.13.0 || >=20.9.0",
|
||||
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
|
||||
"yarn": ">= 1.13.0"
|
||||
},
|
||||
"author": "Angular Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular-cli/issues"
|
||||
},
|
||||
"homepage": "https://github.com/angular/angular-cli"
|
||||
}
|
7
my-app/node_modules/@angular-devkit/build-angular/plugins/karma.d.ts
generated
vendored
Executable file
7
my-app/node_modules/@angular-devkit/build-angular/plugins/karma.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
9
my-app/node_modules/@angular-devkit/build-angular/plugins/karma.js
generated
vendored
Executable file
9
my-app/node_modules/@angular-devkit/build-angular/plugins/karma.js
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
module.exports = require('../src/tools/webpack/plugins/karma/karma');
|
17
my-app/node_modules/@angular-devkit/build-angular/src/babel-bazel.d.ts
generated
vendored
Executable file
17
my-app/node_modules/@angular-devkit/build-angular/src/babel-bazel.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
// Workaround for https://github.com/bazelbuild/rules_nodejs/issues/1033
|
||||
// Alternative approach instead of https://github.com/angular/angular/pull/33226
|
||||
declare module '@babel/core' {
|
||||
export * from '@types/babel__core';
|
||||
}
|
||||
declare module '@babel/generator' {
|
||||
export { default } from '@types/babel__generator';
|
||||
}
|
11
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/index.d.ts
generated
vendored
Executable file
11
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { JsonObject } from '@angular-devkit/core';
|
||||
import { Schema as BuildWebpackAppShellSchema } from './schema';
|
||||
declare const _default: import("../../../../architect/src/internal").Builder<BuildWebpackAppShellSchema & JsonObject>;
|
||||
export default _default;
|
179
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/index.js
generated
vendored
Executable file
179
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/index.js
generated
vendored
Executable file
|
@ -0,0 +1,179 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const architect_1 = require("@angular-devkit/architect");
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const piscina_1 = __importDefault(require("piscina"));
|
||||
const utils_1 = require("../../utils");
|
||||
const error_1 = require("../../utils/error");
|
||||
const service_worker_1 = require("../../utils/service-worker");
|
||||
const spinner_1 = require("../../utils/spinner");
|
||||
async function _renderUniversal(options, context, browserResult, serverResult, spinner) {
|
||||
// Get browser target options.
|
||||
const browserTarget = (0, architect_1.targetFromTargetString)(options.browserTarget);
|
||||
const rawBrowserOptions = (await context.getTargetOptions(browserTarget));
|
||||
const browserBuilderName = await context.getBuilderNameForTarget(browserTarget);
|
||||
const browserOptions = await context.validateOptions(rawBrowserOptions, browserBuilderName);
|
||||
// Locate zone.js to load in the render worker
|
||||
const root = context.workspaceRoot;
|
||||
const zonePackage = require.resolve('zone.js', { paths: [root] });
|
||||
const projectName = context.target && context.target.project;
|
||||
if (!projectName) {
|
||||
throw new Error('The builder requires a target.');
|
||||
}
|
||||
const projectMetadata = await context.getProjectMetadata(projectName);
|
||||
const projectRoot = path.join(root, projectMetadata.root ?? '');
|
||||
const { styles } = (0, utils_1.normalizeOptimization)(browserOptions.optimization);
|
||||
let inlineCriticalCssProcessor;
|
||||
if (styles.inlineCritical) {
|
||||
const { InlineCriticalCssProcessor } = await Promise.resolve().then(() => __importStar(require('../../utils/index-file/inline-critical-css')));
|
||||
inlineCriticalCssProcessor = new InlineCriticalCssProcessor({
|
||||
minify: styles.minify,
|
||||
deployUrl: browserOptions.deployUrl,
|
||||
});
|
||||
}
|
||||
const renderWorker = new piscina_1.default({
|
||||
filename: require.resolve('./render-worker'),
|
||||
maxThreads: 1,
|
||||
workerData: { zonePackage },
|
||||
});
|
||||
try {
|
||||
for (const { path: outputPath, baseHref } of browserResult.outputs) {
|
||||
const localeDirectory = path.relative(browserResult.baseOutputPath, outputPath);
|
||||
const browserIndexOutputPath = path.join(outputPath, 'index.html');
|
||||
const indexHtml = await fs.promises.readFile(browserIndexOutputPath, 'utf8');
|
||||
const serverBundlePath = await _getServerModuleBundlePath(options, context, serverResult, localeDirectory);
|
||||
let html = await renderWorker.run({
|
||||
serverBundlePath,
|
||||
document: indexHtml,
|
||||
url: options.route,
|
||||
});
|
||||
// Overwrite the client index file.
|
||||
const outputIndexPath = options.outputIndexPath
|
||||
? path.join(root, options.outputIndexPath)
|
||||
: browserIndexOutputPath;
|
||||
if (inlineCriticalCssProcessor) {
|
||||
const { content, warnings, errors } = await inlineCriticalCssProcessor.process(html, {
|
||||
outputPath,
|
||||
});
|
||||
html = content;
|
||||
if (warnings.length || errors.length) {
|
||||
spinner.stop();
|
||||
warnings.forEach((m) => context.logger.warn(m));
|
||||
errors.forEach((m) => context.logger.error(m));
|
||||
spinner.start();
|
||||
}
|
||||
}
|
||||
await fs.promises.writeFile(outputIndexPath, html);
|
||||
if (browserOptions.serviceWorker) {
|
||||
await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, root, outputPath, baseHref ?? '/', browserOptions.ngswConfigPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
await renderWorker.destroy();
|
||||
}
|
||||
return browserResult;
|
||||
}
|
||||
async function _getServerModuleBundlePath(options, context, serverResult, browserLocaleDirectory) {
|
||||
if (options.appModuleBundle) {
|
||||
return path.join(context.workspaceRoot, options.appModuleBundle);
|
||||
}
|
||||
const { baseOutputPath = '' } = serverResult;
|
||||
const outputPath = path.join(baseOutputPath, browserLocaleDirectory);
|
||||
if (!fs.existsSync(outputPath)) {
|
||||
throw new Error(`Could not find server output directory: ${outputPath}.`);
|
||||
}
|
||||
const re = /^main\.(?:[a-zA-Z0-9]{16}\.)?js$/;
|
||||
const maybeMain = fs.readdirSync(outputPath).find((x) => re.test(x));
|
||||
if (!maybeMain) {
|
||||
throw new Error('Could not find the main bundle.');
|
||||
}
|
||||
return path.join(outputPath, maybeMain);
|
||||
}
|
||||
async function _appShellBuilder(options, context) {
|
||||
const browserTarget = (0, architect_1.targetFromTargetString)(options.browserTarget);
|
||||
const serverTarget = (0, architect_1.targetFromTargetString)(options.serverTarget);
|
||||
// Never run the browser target in watch mode.
|
||||
// If service worker is needed, it will be added in _renderUniversal();
|
||||
const browserOptions = (await context.getTargetOptions(browserTarget));
|
||||
const optimization = (0, utils_1.normalizeOptimization)(browserOptions.optimization);
|
||||
optimization.styles.inlineCritical = false;
|
||||
// Webpack based builders do not have the `removeSpecialComments` option.
|
||||
delete optimization.styles.removeSpecialComments;
|
||||
const browserTargetRun = await context.scheduleTarget(browserTarget, {
|
||||
watch: false,
|
||||
serviceWorker: false,
|
||||
optimization: optimization,
|
||||
});
|
||||
if (browserTargetRun.info.builderName === '@angular-devkit/build-angular:application') {
|
||||
return {
|
||||
success: false,
|
||||
error: '"@angular-devkit/build-angular:application" has built-in app-shell generation capabilities. ' +
|
||||
'The "appShell" option should be used instead.',
|
||||
};
|
||||
}
|
||||
const serverTargetRun = await context.scheduleTarget(serverTarget, {
|
||||
watch: false,
|
||||
});
|
||||
let spinner;
|
||||
try {
|
||||
const [browserResult, serverResult] = await Promise.all([
|
||||
browserTargetRun.result,
|
||||
serverTargetRun.result,
|
||||
]);
|
||||
if (browserResult.success === false || browserResult.baseOutputPath === undefined) {
|
||||
return browserResult;
|
||||
}
|
||||
else if (serverResult.success === false) {
|
||||
return serverResult;
|
||||
}
|
||||
spinner = new spinner_1.Spinner();
|
||||
spinner.start('Generating application shell...');
|
||||
const result = await _renderUniversal(options, context, browserResult, serverResult, spinner);
|
||||
spinner.succeed('Application shell generation complete.');
|
||||
return result;
|
||||
}
|
||||
catch (err) {
|
||||
spinner?.fail('Application shell generation failed.');
|
||||
(0, error_1.assertIsError)(err);
|
||||
return { success: false, error: err.message };
|
||||
}
|
||||
finally {
|
||||
await Promise.all([browserTargetRun.stop(), serverTargetRun.stop()]);
|
||||
}
|
||||
}
|
||||
exports.default = (0, architect_1.createBuilder)(_appShellBuilder);
|
36
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/render-worker.d.ts
generated
vendored
Executable file
36
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/render-worker.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
/**
|
||||
* A request to render a Server bundle generate by the universal server builder.
|
||||
*/
|
||||
interface RenderRequest {
|
||||
/**
|
||||
* The path to the server bundle that should be loaded and rendered.
|
||||
*/
|
||||
serverBundlePath: string;
|
||||
/**
|
||||
* The existing HTML document as a string that will be augmented with the rendered application.
|
||||
*/
|
||||
document: string;
|
||||
/**
|
||||
* An optional URL path that represents the Angular route that should be rendered.
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
/**
|
||||
* Renders an application based on a provided server bundle path, initial document, and optional URL route.
|
||||
* @param param0 A request to render a server bundle.
|
||||
* @returns A promise that resolves to the render HTML document for the application.
|
||||
*/
|
||||
declare function render({ serverBundlePath, document, url }: RenderRequest): Promise<string>;
|
||||
/**
|
||||
* The default export will be the promise returned by the initialize function.
|
||||
* This is awaited by piscina prior to using the Worker.
|
||||
*/
|
||||
declare const _default: Promise<typeof render>;
|
||||
export default _default;
|
102
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/render-worker.js
generated
vendored
Executable file
102
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/render-worker.js
generated
vendored
Executable file
|
@ -0,0 +1,102 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const node_assert_1 = __importDefault(require("node:assert"));
|
||||
const node_worker_threads_1 = require("node:worker_threads");
|
||||
/**
|
||||
* The fully resolved path to the zone.js package that will be loaded during worker initialization.
|
||||
* This is passed as workerData when setting up the worker via the `piscina` package.
|
||||
*/
|
||||
const { zonePackage } = node_worker_threads_1.workerData;
|
||||
/**
|
||||
* Renders an application based on a provided server bundle path, initial document, and optional URL route.
|
||||
* @param param0 A request to render a server bundle.
|
||||
* @returns A promise that resolves to the render HTML document for the application.
|
||||
*/
|
||||
async function render({ serverBundlePath, document, url }) {
|
||||
const { ɵSERVER_CONTEXT, AppServerModule, renderModule, renderApplication, default: bootstrapAppFn, } = (await Promise.resolve(`${serverBundlePath}`).then(s => __importStar(require(s))));
|
||||
(0, node_assert_1.default)(ɵSERVER_CONTEXT, `ɵSERVER_CONTEXT was not exported from: ${serverBundlePath}.`);
|
||||
const platformProviders = [
|
||||
{
|
||||
provide: ɵSERVER_CONTEXT,
|
||||
useValue: 'app-shell',
|
||||
},
|
||||
];
|
||||
let renderAppPromise;
|
||||
// Render platform server module
|
||||
if (isBootstrapFn(bootstrapAppFn)) {
|
||||
(0, node_assert_1.default)(renderApplication, `renderApplication was not exported from: ${serverBundlePath}.`);
|
||||
renderAppPromise = renderApplication(bootstrapAppFn, {
|
||||
document,
|
||||
url,
|
||||
platformProviders,
|
||||
});
|
||||
}
|
||||
else {
|
||||
(0, node_assert_1.default)(renderModule, `renderModule was not exported from: ${serverBundlePath}.`);
|
||||
const moduleClass = bootstrapAppFn || AppServerModule;
|
||||
(0, node_assert_1.default)(moduleClass, `Neither an AppServerModule nor a bootstrapping function was exported from: ${serverBundlePath}.`);
|
||||
renderAppPromise = renderModule(moduleClass, {
|
||||
document,
|
||||
url,
|
||||
extraProviders: platformProviders,
|
||||
});
|
||||
}
|
||||
// The below should really handled by the framework!!!.
|
||||
let timer;
|
||||
const renderingTimeout = new Promise((_, reject) => (timer = setTimeout(() => reject(new Error(`Page ${new URL(url, 'resolve://').pathname} did not render in 30 seconds.`)), 30000)));
|
||||
return Promise.race([renderAppPromise, renderingTimeout]).finally(() => clearTimeout(timer));
|
||||
}
|
||||
function isBootstrapFn(value) {
|
||||
// We can differentiate between a module and a bootstrap function by reading compiler-generated `ɵmod` static property:
|
||||
return typeof value === 'function' && !('ɵmod' in value);
|
||||
}
|
||||
/**
|
||||
* Initializes the worker when it is first created by loading the Zone.js package
|
||||
* into the worker instance.
|
||||
*
|
||||
* @returns A promise resolving to the render function of the worker.
|
||||
*/
|
||||
async function initialize() {
|
||||
// Setup Zone.js
|
||||
await Promise.resolve(`${zonePackage}`).then(s => __importStar(require(s)));
|
||||
// Return the render function for use
|
||||
return render;
|
||||
}
|
||||
/**
|
||||
* The default export will be the promise returned by the initialize function.
|
||||
* This is awaited by piscina prior to using the Worker.
|
||||
*/
|
||||
exports.default = initialize();
|
36
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/schema.d.ts
generated
vendored
Executable file
36
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/schema.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* App Shell target options for Build Facade.
|
||||
*/
|
||||
export interface Schema {
|
||||
/**
|
||||
* Script that exports the Server AppModule to render. This should be the main JavaScript
|
||||
* outputted by the server target. By default we will resolve the outputPath of the
|
||||
* serverTarget and find a bundle named 'main' in it (whether or not there's a hash tag).
|
||||
*/
|
||||
appModuleBundle?: string;
|
||||
/**
|
||||
* A browser builder target use for rendering the application shell in the format of
|
||||
* `project:target[:configuration]`. You can also pass in more than one configuration name
|
||||
* as a comma-separated list. Example: `project:target:production,staging`.
|
||||
*/
|
||||
browserTarget: string;
|
||||
/**
|
||||
* The input path for the index.html file. By default uses the output index.html of the
|
||||
* browser target.
|
||||
*/
|
||||
inputIndexPath?: string;
|
||||
/**
|
||||
* The output path of the index.html file. By default will overwrite the input file.
|
||||
*/
|
||||
outputIndexPath?: string;
|
||||
/**
|
||||
* The route to render.
|
||||
*/
|
||||
route?: string;
|
||||
/**
|
||||
* A server builder target use for rendering the application shell in the format of
|
||||
* `project:target[:configuration]`. You can also pass in more than one configuration name
|
||||
* as a comma-separated list. Example: `project:target:production,staging`.
|
||||
*/
|
||||
serverTarget: string;
|
||||
}
|
4
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/schema.js
generated
vendored
Executable file
4
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/schema.js
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
"use strict";
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
||||
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
37
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/schema.json
generated
vendored
Executable file
37
my-app/node_modules/@angular-devkit/build-angular/src/builders/app-shell/schema.json
generated
vendored
Executable file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"title": "App Shell Target",
|
||||
"description": "App Shell target options for Build Facade.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"browserTarget": {
|
||||
"type": "string",
|
||||
"description": "A browser builder target use for rendering the application shell in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
|
||||
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
|
||||
},
|
||||
"serverTarget": {
|
||||
"type": "string",
|
||||
"description": "A server builder target use for rendering the application shell in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
|
||||
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
|
||||
},
|
||||
"appModuleBundle": {
|
||||
"type": "string",
|
||||
"description": "Script that exports the Server AppModule to render. This should be the main JavaScript outputted by the server target. By default we will resolve the outputPath of the serverTarget and find a bundle named 'main' in it (whether or not there's a hash tag)."
|
||||
},
|
||||
"route": {
|
||||
"type": "string",
|
||||
"description": "The route to render.",
|
||||
"default": "/"
|
||||
},
|
||||
"inputIndexPath": {
|
||||
"type": "string",
|
||||
"description": "The input path for the index.html file. By default uses the output index.html of the browser target."
|
||||
},
|
||||
"outputIndexPath": {
|
||||
"type": "string",
|
||||
"description": "The output path of the index.html file. By default will overwrite the input file."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": ["browserTarget", "serverTarget"]
|
||||
}
|
29
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/build-action.d.ts
generated
vendored
Executable file
29
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/build-action.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { BuilderOutput } from '@angular-devkit/architect';
|
||||
import type { logging } from '@angular-devkit/core';
|
||||
import { BuildOutputFile } from '../../tools/esbuild/bundler-context';
|
||||
import { ExecutionResult, RebuildState } from '../../tools/esbuild/bundler-execution-result';
|
||||
import { NormalizedCachedOptions } from '../../utils/normalize-cache';
|
||||
import { NormalizedOutputOptions } from './options';
|
||||
export declare function runEsBuildBuildAction(action: (rebuildState?: RebuildState) => ExecutionResult | Promise<ExecutionResult>, options: {
|
||||
workspaceRoot: string;
|
||||
projectRoot: string;
|
||||
outputOptions: NormalizedOutputOptions;
|
||||
logger: logging.LoggerApi;
|
||||
cacheOptions: NormalizedCachedOptions;
|
||||
writeToFileSystem: boolean;
|
||||
writeToFileSystemFilter: ((file: BuildOutputFile) => boolean) | undefined;
|
||||
watch?: boolean;
|
||||
verbose?: boolean;
|
||||
progress?: boolean;
|
||||
deleteOutputPath?: boolean;
|
||||
poll?: number;
|
||||
signal?: AbortSignal;
|
||||
preserveSymlinks?: boolean;
|
||||
}): AsyncIterable<(ExecutionResult['outputWithFiles'] | ExecutionResult['output']) & BuilderOutput>;
|
185
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/build-action.js
generated
vendored
Executable file
185
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/build-action.js
generated
vendored
Executable file
|
@ -0,0 +1,185 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.runEsBuildBuildAction = void 0;
|
||||
const node_fs_1 = require("node:fs");
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const sass_language_1 = require("../../tools/esbuild/stylesheets/sass-language");
|
||||
const utils_1 = require("../../tools/esbuild/utils");
|
||||
const delete_output_dir_1 = require("../../utils/delete-output-dir");
|
||||
const environment_options_1 = require("../../utils/environment-options");
|
||||
async function* runEsBuildBuildAction(action, options) {
|
||||
const { writeToFileSystemFilter, writeToFileSystem, watch, poll, logger, deleteOutputPath, cacheOptions, outputOptions, verbose, projectRoot, workspaceRoot, progress, preserveSymlinks, } = options;
|
||||
if (deleteOutputPath && writeToFileSystem) {
|
||||
await (0, delete_output_dir_1.deleteOutputDir)(workspaceRoot, outputOptions.base, [
|
||||
outputOptions.browser,
|
||||
outputOptions.server,
|
||||
]);
|
||||
}
|
||||
const withProgress = progress ? utils_1.withSpinner : utils_1.withNoProgress;
|
||||
// Initial build
|
||||
let result;
|
||||
try {
|
||||
// Perform the build action
|
||||
result = await withProgress('Building...', () => action());
|
||||
// Log all diagnostic (error/warning) messages from the build
|
||||
await (0, utils_1.logMessages)(logger, result);
|
||||
}
|
||||
finally {
|
||||
// Ensure Sass workers are shutdown if not watching
|
||||
if (!watch) {
|
||||
(0, sass_language_1.shutdownSassWorkerPool)();
|
||||
}
|
||||
}
|
||||
// Setup watcher if watch mode enabled
|
||||
let watcher;
|
||||
if (watch) {
|
||||
if (progress) {
|
||||
logger.info('Watch mode enabled. Watching for file changes...');
|
||||
}
|
||||
const ignored = [
|
||||
// Ignore the output and cache paths to avoid infinite rebuild cycles
|
||||
outputOptions.base,
|
||||
cacheOptions.basePath,
|
||||
`${workspaceRoot.replace(/\\/g, '/')}/**/.*/**`,
|
||||
];
|
||||
if (!preserveSymlinks) {
|
||||
// Ignore all node modules directories to avoid excessive file watchers.
|
||||
// Package changes are handled below by watching manifest and lock files.
|
||||
// NOTE: this is not enable when preserveSymlinks is true as this would break `npm link` usages.
|
||||
ignored.push('**/node_modules/**');
|
||||
}
|
||||
// Setup a watcher
|
||||
const { createWatcher } = await Promise.resolve().then(() => __importStar(require('../../tools/esbuild/watcher')));
|
||||
watcher = createWatcher({
|
||||
polling: typeof poll === 'number',
|
||||
interval: poll,
|
||||
followSymlinks: preserveSymlinks,
|
||||
ignored,
|
||||
});
|
||||
// Setup abort support
|
||||
options.signal?.addEventListener('abort', () => void watcher?.close());
|
||||
// Watch the entire project root if 'NG_BUILD_WATCH_ROOT' environment variable is set
|
||||
if (environment_options_1.shouldWatchRoot) {
|
||||
watcher.add(projectRoot);
|
||||
}
|
||||
// Watch workspace for package manager changes
|
||||
const packageWatchFiles = [
|
||||
// manifest can affect module resolution
|
||||
'package.json',
|
||||
// npm lock file
|
||||
'package-lock.json',
|
||||
// pnpm lock file
|
||||
'pnpm-lock.yaml',
|
||||
// yarn lock file including Yarn PnP manifest files (https://yarnpkg.com/advanced/pnp-spec/)
|
||||
'yarn.lock',
|
||||
'.pnp.cjs',
|
||||
'.pnp.data.json',
|
||||
];
|
||||
watcher.add(packageWatchFiles
|
||||
.map((file) => node_path_1.default.join(workspaceRoot, file))
|
||||
.filter((file) => (0, node_fs_1.existsSync)(file)));
|
||||
// Watch locations provided by the initial build result
|
||||
watcher.add(result.watchFiles);
|
||||
}
|
||||
// Output the first build results after setting up the watcher to ensure that any code executed
|
||||
// higher in the iterator call stack will trigger the watcher. This is particularly relevant for
|
||||
// unit tests which execute the builder and modify the file system programmatically.
|
||||
if (writeToFileSystem) {
|
||||
// Write output files
|
||||
await (0, utils_1.writeResultFiles)(result.outputFiles, result.assetFiles, outputOptions);
|
||||
yield result.output;
|
||||
}
|
||||
else {
|
||||
// Requires casting due to unneeded `JsonObject` requirement. Remove once fixed.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
yield result.outputWithFiles;
|
||||
}
|
||||
// Finish if watch mode is not enabled
|
||||
if (!watcher) {
|
||||
return;
|
||||
}
|
||||
// Wait for changes and rebuild as needed
|
||||
const currentWatchFiles = new Set(result.watchFiles);
|
||||
try {
|
||||
for await (const changes of watcher) {
|
||||
if (options.signal?.aborted) {
|
||||
break;
|
||||
}
|
||||
if (verbose) {
|
||||
logger.info(changes.toDebugString());
|
||||
}
|
||||
result = await withProgress('Changes detected. Rebuilding...', () => action(result.createRebuildState(changes)));
|
||||
// Log all diagnostic (error/warning) messages from the rebuild
|
||||
await (0, utils_1.logMessages)(logger, result);
|
||||
// Update watched locations provided by the new build result.
|
||||
// Keep watching all previous files if there are any errors; otherwise consider all
|
||||
// files stale until confirmed present in the new result's watch files.
|
||||
const staleWatchFiles = result.errors.length > 0 ? undefined : new Set(currentWatchFiles);
|
||||
for (const watchFile of result.watchFiles) {
|
||||
if (!currentWatchFiles.has(watchFile)) {
|
||||
// Add new watch location
|
||||
watcher.add(watchFile);
|
||||
currentWatchFiles.add(watchFile);
|
||||
}
|
||||
// Present so remove from stale locations
|
||||
staleWatchFiles?.delete(watchFile);
|
||||
}
|
||||
// Remove any stale locations if the build was successful
|
||||
if (staleWatchFiles?.size) {
|
||||
watcher.remove([...staleWatchFiles]);
|
||||
}
|
||||
if (writeToFileSystem) {
|
||||
// Write output files
|
||||
const filesToWrite = writeToFileSystemFilter
|
||||
? result.outputFiles.filter(writeToFileSystemFilter)
|
||||
: result.outputFiles;
|
||||
await (0, utils_1.writeResultFiles)(filesToWrite, result.assetFiles, outputOptions);
|
||||
yield result.output;
|
||||
}
|
||||
else {
|
||||
// Requires casting due to unneeded `JsonObject` requirement. Remove once fixed.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
yield result.outputWithFiles;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
// Stop the watcher and cleanup incremental rebuild state
|
||||
await Promise.allSettled([watcher.close(), result.dispose()]);
|
||||
(0, sass_language_1.shutdownSassWorkerPool)();
|
||||
}
|
||||
}
|
||||
exports.runEsBuildBuildAction = runEsBuildBuildAction;
|
11
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/execute-build.d.ts
generated
vendored
Executable file
11
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/execute-build.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { BuilderContext } from '@angular-devkit/architect';
|
||||
import { ExecutionResult, RebuildState } from '../../tools/esbuild/bundler-execution-result';
|
||||
import { NormalizedApplicationBuildOptions } from './options';
|
||||
export declare function executeBuild(options: NormalizedApplicationBuildOptions, context: BuilderContext, rebuildState?: RebuildState): Promise<ExecutionResult>;
|
134
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/execute-build.js
generated
vendored
Executable file
134
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/execute-build.js
generated
vendored
Executable file
|
@ -0,0 +1,134 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.executeBuild = void 0;
|
||||
const source_file_cache_1 = require("../../tools/esbuild/angular/source-file-cache");
|
||||
const budget_stats_1 = require("../../tools/esbuild/budget-stats");
|
||||
const bundler_context_1 = require("../../tools/esbuild/bundler-context");
|
||||
const bundler_execution_result_1 = require("../../tools/esbuild/bundler-execution-result");
|
||||
const commonjs_checker_1 = require("../../tools/esbuild/commonjs-checker");
|
||||
const license_extractor_1 = require("../../tools/esbuild/license-extractor");
|
||||
const utils_1 = require("../../tools/esbuild/utils");
|
||||
const bundle_calculator_1 = require("../../utils/bundle-calculator");
|
||||
const color_1 = require("../../utils/color");
|
||||
const copy_assets_1 = require("../../utils/copy-assets");
|
||||
const supported_browsers_1 = require("../../utils/supported-browsers");
|
||||
const execute_post_bundle_1 = require("./execute-post-bundle");
|
||||
const i18n_1 = require("./i18n");
|
||||
const setup_bundling_1 = require("./setup-bundling");
|
||||
async function executeBuild(options, context, rebuildState) {
|
||||
const { projectRoot, workspaceRoot, i18nOptions, optimizationOptions, assets, cacheOptions, prerenderOptions, } = options;
|
||||
// TODO: Consider integrating into watch mode. Would require full rebuild on target changes.
|
||||
const browsers = (0, supported_browsers_1.getSupportedBrowsers)(projectRoot, context.logger);
|
||||
// Load active translations if inlining
|
||||
// TODO: Integrate into watch mode and only load changed translations
|
||||
if (i18nOptions.shouldInline) {
|
||||
await (0, i18n_1.loadActiveTranslations)(context, i18nOptions);
|
||||
}
|
||||
// Reuse rebuild state or create new bundle contexts for code and global stylesheets
|
||||
let bundlerContexts = rebuildState?.rebuildContexts;
|
||||
const codeBundleCache = rebuildState?.codeBundleCache ??
|
||||
new source_file_cache_1.SourceFileCache(cacheOptions.enabled ? cacheOptions.path : undefined);
|
||||
if (bundlerContexts === undefined) {
|
||||
bundlerContexts = (0, setup_bundling_1.setupBundlerContexts)(options, browsers, codeBundleCache);
|
||||
}
|
||||
const bundlingResult = await bundler_context_1.BundlerContext.bundleAll(bundlerContexts, rebuildState?.fileChanges.all);
|
||||
const executionResult = new bundler_execution_result_1.ExecutionResult(bundlerContexts, codeBundleCache);
|
||||
executionResult.addWarnings(bundlingResult.warnings);
|
||||
// Return if the bundling has errors
|
||||
if (bundlingResult.errors) {
|
||||
executionResult.addErrors(bundlingResult.errors);
|
||||
return executionResult;
|
||||
}
|
||||
// Analyze external imports if external options are enabled
|
||||
if (options.externalPackages || bundlingResult.externalConfiguration) {
|
||||
const { externalConfiguration, externalImports: { browser, server }, } = bundlingResult;
|
||||
const implicitBrowser = browser ? [...browser] : [];
|
||||
const implicitServer = server ? [...server] : [];
|
||||
// TODO: Implement wildcard externalConfiguration filtering
|
||||
executionResult.setExternalMetadata(externalConfiguration
|
||||
? implicitBrowser.filter((value) => !externalConfiguration.includes(value))
|
||||
: implicitBrowser, externalConfiguration
|
||||
? implicitServer.filter((value) => !externalConfiguration.includes(value))
|
||||
: implicitServer, externalConfiguration);
|
||||
}
|
||||
const { metafile, initialFiles, outputFiles } = bundlingResult;
|
||||
executionResult.outputFiles.push(...outputFiles);
|
||||
const changedFiles = rebuildState && executionResult.findChangedFiles(rebuildState.previousOutputHashes);
|
||||
// Analyze files for bundle budget failures if present
|
||||
let budgetFailures;
|
||||
if (options.budgets) {
|
||||
const compatStats = (0, budget_stats_1.generateBudgetStats)(metafile, initialFiles);
|
||||
budgetFailures = [...(0, bundle_calculator_1.checkBudgets)(options.budgets, compatStats, true)];
|
||||
for (const { message, severity } of budgetFailures) {
|
||||
if (severity === 'error') {
|
||||
executionResult.addError(message);
|
||||
}
|
||||
else {
|
||||
executionResult.addWarning(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Calculate estimated transfer size if scripts are optimized
|
||||
let estimatedTransferSizes;
|
||||
if (optimizationOptions.scripts || optimizationOptions.styles.minify) {
|
||||
estimatedTransferSizes = await (0, utils_1.calculateEstimatedTransferSizes)(executionResult.outputFiles);
|
||||
}
|
||||
// Check metafile for CommonJS module usage if optimizing scripts
|
||||
if (optimizationOptions.scripts) {
|
||||
const messages = (0, commonjs_checker_1.checkCommonJSModules)(metafile, options.allowedCommonJsDependencies);
|
||||
executionResult.addWarnings(messages);
|
||||
}
|
||||
// Copy assets
|
||||
if (assets) {
|
||||
// The webpack copy assets helper is used with no base paths defined. This prevents the helper
|
||||
// from directly writing to disk. This should eventually be replaced with a more optimized helper.
|
||||
executionResult.addAssets(await (0, copy_assets_1.copyAssets)(assets, [], workspaceRoot));
|
||||
}
|
||||
// Extract and write licenses for used packages
|
||||
if (options.extractLicenses) {
|
||||
executionResult.addOutputFile('3rdpartylicenses.txt', await (0, license_extractor_1.extractLicenses)(metafile, workspaceRoot), bundler_context_1.BuildOutputFileType.Root);
|
||||
}
|
||||
// Perform i18n translation inlining if enabled
|
||||
let prerenderedRoutes;
|
||||
if (i18nOptions.shouldInline) {
|
||||
const result = await (0, i18n_1.inlineI18n)(options, executionResult, initialFiles);
|
||||
executionResult.addErrors(result.errors);
|
||||
executionResult.addWarnings(result.warnings);
|
||||
prerenderedRoutes = result.prerenderedRoutes;
|
||||
}
|
||||
else {
|
||||
const result = await (0, execute_post_bundle_1.executePostBundleSteps)(options, executionResult.outputFiles, executionResult.assetFiles, initialFiles,
|
||||
// Set lang attribute to the defined source locale if present
|
||||
i18nOptions.hasDefinedSourceLocale ? i18nOptions.sourceLocale : undefined);
|
||||
executionResult.addErrors(result.errors);
|
||||
executionResult.addWarnings(result.warnings);
|
||||
prerenderedRoutes = result.prerenderedRoutes;
|
||||
executionResult.outputFiles.push(...result.additionalOutputFiles);
|
||||
executionResult.assetFiles.push(...result.additionalAssets);
|
||||
}
|
||||
if (prerenderOptions) {
|
||||
executionResult.addOutputFile('prerendered-routes.json', JSON.stringify({ routes: prerenderedRoutes.sort((a, b) => a.localeCompare(b)) }, null, 2), bundler_context_1.BuildOutputFileType.Root);
|
||||
let prerenderMsg = `Prerendered ${prerenderedRoutes.length} static route`;
|
||||
if (prerenderedRoutes.length > 1) {
|
||||
prerenderMsg += 's.';
|
||||
}
|
||||
else {
|
||||
prerenderMsg += '.';
|
||||
}
|
||||
context.logger.info(color_1.colors.magenta(prerenderMsg) + '\n');
|
||||
}
|
||||
(0, utils_1.logBuildStats)(context.logger, metafile, initialFiles, budgetFailures, changedFiles, estimatedTransferSizes);
|
||||
// Write metafile if stats option is enabled
|
||||
if (options.stats) {
|
||||
executionResult.addOutputFile('stats.json', JSON.stringify(metafile, null, 2), bundler_context_1.BuildOutputFileType.Root);
|
||||
}
|
||||
return executionResult;
|
||||
}
|
||||
exports.executeBuild = executeBuild;
|
25
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/execute-post-bundle.d.ts
generated
vendored
Executable file
25
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/execute-post-bundle.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { BuildOutputFile, InitialFileRecord } from '../../tools/esbuild/bundler-context';
|
||||
import { BuildOutputAsset } from '../../tools/esbuild/bundler-execution-result';
|
||||
import { NormalizedApplicationBuildOptions } from './options';
|
||||
/**
|
||||
* Run additional builds steps including SSG, AppShell, Index HTML file and Service worker generation.
|
||||
* @param options The normalized application builder options used to create the build.
|
||||
* @param outputFiles The output files of an executed build.
|
||||
* @param assetFiles The assets of an executed build.
|
||||
* @param initialFiles A map containing initial file information for the executed build.
|
||||
* @param locale A language locale to insert in the index.html.
|
||||
*/
|
||||
export declare function executePostBundleSteps(options: NormalizedApplicationBuildOptions, outputFiles: BuildOutputFile[], assetFiles: BuildOutputAsset[], initialFiles: Map<string, InitialFileRecord>, locale: string | undefined): Promise<{
|
||||
errors: string[];
|
||||
warnings: string[];
|
||||
additionalOutputFiles: BuildOutputFile[];
|
||||
additionalAssets: BuildOutputAsset[];
|
||||
prerenderedRoutes: string[];
|
||||
}>;
|
96
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/execute-post-bundle.js
generated
vendored
Executable file
96
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/execute-post-bundle.js
generated
vendored
Executable file
|
@ -0,0 +1,96 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.executePostBundleSteps = void 0;
|
||||
const node_assert_1 = __importDefault(require("node:assert"));
|
||||
const bundler_context_1 = require("../../tools/esbuild/bundler-context");
|
||||
const index_html_generator_1 = require("../../tools/esbuild/index-html-generator");
|
||||
const utils_1 = require("../../tools/esbuild/utils");
|
||||
const environment_options_1 = require("../../utils/environment-options");
|
||||
const prerender_1 = require("../../utils/server-rendering/prerender");
|
||||
const service_worker_1 = require("../../utils/service-worker");
|
||||
/**
|
||||
* Run additional builds steps including SSG, AppShell, Index HTML file and Service worker generation.
|
||||
* @param options The normalized application builder options used to create the build.
|
||||
* @param outputFiles The output files of an executed build.
|
||||
* @param assetFiles The assets of an executed build.
|
||||
* @param initialFiles A map containing initial file information for the executed build.
|
||||
* @param locale A language locale to insert in the index.html.
|
||||
*/
|
||||
async function executePostBundleSteps(options, outputFiles, assetFiles, initialFiles, locale) {
|
||||
const additionalAssets = [];
|
||||
const additionalOutputFiles = [];
|
||||
const allErrors = [];
|
||||
const allWarnings = [];
|
||||
const prerenderedRoutes = [];
|
||||
const { serviceWorker, indexHtmlOptions, optimizationOptions, sourcemapOptions, ssrOptions, prerenderOptions, appShellOptions, workspaceRoot, verbose, } = options;
|
||||
/**
|
||||
* Index HTML content without CSS inlining to be used for server rendering (AppShell, SSG and SSR).
|
||||
*
|
||||
* NOTE: we don't perform critical CSS inlining as this will be done during server rendering.
|
||||
*/
|
||||
let indexContentOutputNoCssInlining;
|
||||
// When using prerender/app-shell the index HTML file can be regenerated.
|
||||
// Thus, we use a Map so that we do not generate 2 files with the same filename.
|
||||
const additionalHtmlOutputFiles = new Map();
|
||||
// Generate index HTML file
|
||||
// If localization is enabled, index generation is handled in the inlining process.
|
||||
if (indexHtmlOptions) {
|
||||
const { content, contentWithoutCriticalCssInlined, errors, warnings } = await (0, index_html_generator_1.generateIndexHtml)(initialFiles, outputFiles, {
|
||||
...options,
|
||||
optimizationOptions,
|
||||
}, locale);
|
||||
indexContentOutputNoCssInlining = contentWithoutCriticalCssInlined;
|
||||
allErrors.push(...errors);
|
||||
allWarnings.push(...warnings);
|
||||
additionalHtmlOutputFiles.set(indexHtmlOptions.output, (0, utils_1.createOutputFileFromText)(indexHtmlOptions.output, content, bundler_context_1.BuildOutputFileType.Browser));
|
||||
if (ssrOptions) {
|
||||
const serverIndexHtmlFilename = 'index.server.html';
|
||||
additionalHtmlOutputFiles.set(serverIndexHtmlFilename, (0, utils_1.createOutputFileFromText)(serverIndexHtmlFilename, contentWithoutCriticalCssInlined, bundler_context_1.BuildOutputFileType.Server));
|
||||
}
|
||||
}
|
||||
// Pre-render (SSG) and App-shell
|
||||
// If localization is enabled, prerendering is handled in the inlining process.
|
||||
if (prerenderOptions || appShellOptions) {
|
||||
(0, node_assert_1.default)(indexContentOutputNoCssInlining, 'The "index" option is required when using the "ssg" or "appShell" options.');
|
||||
const { output, warnings, errors, prerenderedRoutes: generatedRoutes, } = await (0, prerender_1.prerenderPages)(workspaceRoot, appShellOptions, prerenderOptions, outputFiles, assetFiles, indexContentOutputNoCssInlining, sourcemapOptions.scripts, optimizationOptions.styles.inlineCritical, environment_options_1.maxWorkers, verbose);
|
||||
allErrors.push(...errors);
|
||||
allWarnings.push(...warnings);
|
||||
prerenderedRoutes.push(...Array.from(generatedRoutes));
|
||||
for (const [path, content] of Object.entries(output)) {
|
||||
additionalHtmlOutputFiles.set(path, (0, utils_1.createOutputFileFromText)(path, content, bundler_context_1.BuildOutputFileType.Browser));
|
||||
}
|
||||
}
|
||||
additionalOutputFiles.push(...additionalHtmlOutputFiles.values());
|
||||
// Augment the application with service worker support
|
||||
// If localization is enabled, service worker is handled in the inlining process.
|
||||
if (serviceWorker) {
|
||||
try {
|
||||
const serviceWorkerResult = await (0, service_worker_1.augmentAppWithServiceWorkerEsbuild)(workspaceRoot, serviceWorker, options.baseHref || '/',
|
||||
// Ensure additional files recently added are used
|
||||
[...outputFiles, ...additionalOutputFiles], assetFiles);
|
||||
additionalOutputFiles.push((0, utils_1.createOutputFileFromText)('ngsw.json', serviceWorkerResult.manifest, bundler_context_1.BuildOutputFileType.Browser));
|
||||
additionalAssets.push(...serviceWorkerResult.assetFiles);
|
||||
}
|
||||
catch (error) {
|
||||
allErrors.push(error instanceof Error ? error.message : `${error}`);
|
||||
}
|
||||
}
|
||||
return {
|
||||
errors: allErrors,
|
||||
warnings: allWarnings,
|
||||
additionalAssets,
|
||||
prerenderedRoutes,
|
||||
additionalOutputFiles,
|
||||
};
|
||||
}
|
||||
exports.executePostBundleSteps = executePostBundleSteps;
|
29
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/i18n.d.ts
generated
vendored
Executable file
29
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/i18n.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { BuilderContext } from '@angular-devkit/architect';
|
||||
import { InitialFileRecord } from '../../tools/esbuild/bundler-context';
|
||||
import { ExecutionResult } from '../../tools/esbuild/bundler-execution-result';
|
||||
import { NormalizedApplicationBuildOptions } from './options';
|
||||
/**
|
||||
* Inlines all active locales as specified by the application build options into all
|
||||
* application JavaScript files created during the build.
|
||||
* @param options The normalized application builder options used to create the build.
|
||||
* @param executionResult The result of an executed build.
|
||||
* @param initialFiles A map containing initial file information for the executed build.
|
||||
*/
|
||||
export declare function inlineI18n(options: NormalizedApplicationBuildOptions, executionResult: ExecutionResult, initialFiles: Map<string, InitialFileRecord>): Promise<{
|
||||
errors: string[];
|
||||
warnings: string[];
|
||||
prerenderedRoutes: string[];
|
||||
}>;
|
||||
/**
|
||||
* Loads all active translations using the translation loaders from the `@angular/localize` package.
|
||||
* @param context The architect builder context for the current build.
|
||||
* @param i18n The normalized i18n options to use.
|
||||
*/
|
||||
export declare function loadActiveTranslations(context: BuilderContext, i18n: NormalizedApplicationBuildOptions['i18nOptions']): Promise<void>;
|
128
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/i18n.js
generated
vendored
Executable file
128
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/i18n.js
generated
vendored
Executable file
|
@ -0,0 +1,128 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.loadActiveTranslations = exports.inlineI18n = void 0;
|
||||
const node_path_1 = require("node:path");
|
||||
const bundler_context_1 = require("../../tools/esbuild/bundler-context");
|
||||
const i18n_inliner_1 = require("../../tools/esbuild/i18n-inliner");
|
||||
const environment_options_1 = require("../../utils/environment-options");
|
||||
const i18n_options_1 = require("../../utils/i18n-options");
|
||||
const load_translations_1 = require("../../utils/load-translations");
|
||||
const url_1 = require("../../utils/url");
|
||||
const execute_post_bundle_1 = require("./execute-post-bundle");
|
||||
/**
|
||||
* Inlines all active locales as specified by the application build options into all
|
||||
* application JavaScript files created during the build.
|
||||
* @param options The normalized application builder options used to create the build.
|
||||
* @param executionResult The result of an executed build.
|
||||
* @param initialFiles A map containing initial file information for the executed build.
|
||||
*/
|
||||
async function inlineI18n(options, executionResult, initialFiles) {
|
||||
// Create the multi-threaded inliner with common options and the files generated from the build.
|
||||
const inliner = new i18n_inliner_1.I18nInliner({
|
||||
missingTranslation: options.i18nOptions.missingTranslationBehavior ?? 'warning',
|
||||
outputFiles: executionResult.outputFiles,
|
||||
shouldOptimize: options.optimizationOptions.scripts,
|
||||
}, environment_options_1.maxWorkers);
|
||||
const inlineResult = {
|
||||
errors: [],
|
||||
warnings: [],
|
||||
prerenderedRoutes: [],
|
||||
};
|
||||
// For each active locale, use the inliner to process the output files of the build.
|
||||
const updatedOutputFiles = [];
|
||||
const updatedAssetFiles = [];
|
||||
try {
|
||||
for (const locale of options.i18nOptions.inlineLocales) {
|
||||
// A locale specific set of files is returned from the inliner.
|
||||
const localeInlineResult = await inliner.inlineForLocale(locale, options.i18nOptions.locales[locale].translation);
|
||||
const localeOutputFiles = localeInlineResult.outputFiles;
|
||||
inlineResult.errors.push(...localeInlineResult.errors);
|
||||
inlineResult.warnings.push(...localeInlineResult.warnings);
|
||||
const baseHref = getLocaleBaseHref(options.baseHref, options.i18nOptions, locale) ?? options.baseHref;
|
||||
const { errors, warnings, additionalAssets, additionalOutputFiles, prerenderedRoutes: generatedRoutes, } = await (0, execute_post_bundle_1.executePostBundleSteps)({
|
||||
...options,
|
||||
baseHref,
|
||||
}, localeOutputFiles, executionResult.assetFiles, initialFiles, locale);
|
||||
localeOutputFiles.push(...additionalOutputFiles);
|
||||
inlineResult.errors.push(...errors);
|
||||
inlineResult.warnings.push(...warnings);
|
||||
// Update directory with locale base
|
||||
if (options.i18nOptions.flatOutput !== true) {
|
||||
localeOutputFiles.forEach((file) => {
|
||||
file.path = (0, node_path_1.join)(locale, file.path);
|
||||
});
|
||||
for (const assetFile of [...executionResult.assetFiles, ...additionalAssets]) {
|
||||
updatedAssetFiles.push({
|
||||
source: assetFile.source,
|
||||
destination: (0, node_path_1.join)(locale, assetFile.destination),
|
||||
});
|
||||
}
|
||||
inlineResult.prerenderedRoutes.push(...generatedRoutes.map((route) => node_path_1.posix.join('/', locale, route)));
|
||||
}
|
||||
else {
|
||||
inlineResult.prerenderedRoutes.push(...generatedRoutes);
|
||||
executionResult.assetFiles.push(...additionalAssets);
|
||||
}
|
||||
updatedOutputFiles.push(...localeOutputFiles);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
await inliner.close();
|
||||
}
|
||||
// Update the result with all localized files.
|
||||
executionResult.outputFiles = [
|
||||
// Root files are not modified.
|
||||
...executionResult.outputFiles.filter(({ type }) => type === bundler_context_1.BuildOutputFileType.Root),
|
||||
// Updated files for each locale.
|
||||
...updatedOutputFiles,
|
||||
];
|
||||
// Assets are only changed if not using the flat output option
|
||||
if (options.i18nOptions.flatOutput !== true) {
|
||||
executionResult.assetFiles = updatedAssetFiles;
|
||||
}
|
||||
return inlineResult;
|
||||
}
|
||||
exports.inlineI18n = inlineI18n;
|
||||
function getLocaleBaseHref(baseHref, i18n, locale) {
|
||||
if (i18n.flatOutput) {
|
||||
return undefined;
|
||||
}
|
||||
if (i18n.locales[locale] && i18n.locales[locale].baseHref !== '') {
|
||||
return (0, url_1.urlJoin)(baseHref || '', i18n.locales[locale].baseHref ?? `/${locale}/`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Loads all active translations using the translation loaders from the `@angular/localize` package.
|
||||
* @param context The architect builder context for the current build.
|
||||
* @param i18n The normalized i18n options to use.
|
||||
*/
|
||||
async function loadActiveTranslations(context, i18n) {
|
||||
// Load locale data and translations (if present)
|
||||
let loader;
|
||||
for (const [locale, desc] of Object.entries(i18n.locales)) {
|
||||
if (!i18n.inlineLocales.has(locale) && locale !== i18n.sourceLocale) {
|
||||
continue;
|
||||
}
|
||||
if (!desc.files.length) {
|
||||
continue;
|
||||
}
|
||||
loader ??= await (0, load_translations_1.createTranslationLoader)();
|
||||
(0, i18n_options_1.loadTranslations)(locale, desc, context.workspaceRoot, loader, {
|
||||
warn(message) {
|
||||
context.logger.warn(message);
|
||||
},
|
||||
error(message) {
|
||||
throw new Error(message);
|
||||
},
|
||||
}, undefined, i18n.duplicateTranslationBehavior);
|
||||
}
|
||||
}
|
||||
exports.loadActiveTranslations = loadActiveTranslations;
|
57
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/index.d.ts
generated
vendored
Executable file
57
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
|
||||
import type { Plugin } from 'esbuild';
|
||||
import { BuildOutputFile } from '../../tools/esbuild/bundler-context';
|
||||
import { ApplicationBuilderExtensions, ApplicationBuilderInternalOptions } from './options';
|
||||
import { Schema as ApplicationBuilderOptions } from './schema';
|
||||
export { ApplicationBuilderOptions };
|
||||
export declare function buildApplicationInternal(options: ApplicationBuilderInternalOptions, context: BuilderContext & {
|
||||
signal?: AbortSignal;
|
||||
}, infrastructureSettings?: {
|
||||
write?: boolean;
|
||||
}, extensions?: ApplicationBuilderExtensions): AsyncIterable<ApplicationBuilderOutput>;
|
||||
export interface ApplicationBuilderOutput extends BuilderOutput {
|
||||
outputFiles?: BuildOutputFile[];
|
||||
assetFiles?: {
|
||||
source: string;
|
||||
destination: string;
|
||||
}[];
|
||||
}
|
||||
/**
|
||||
* Builds an application using the `application` builder with the provided
|
||||
* options.
|
||||
*
|
||||
* Usage of the `plugins` parameter is NOT supported and may cause unexpected
|
||||
* build output or build failures.
|
||||
*
|
||||
* @experimental Direct usage of this function is considered experimental.
|
||||
*
|
||||
* @param options The options defined by the builder's schema to use.
|
||||
* @param context An Architect builder context instance.
|
||||
* @param plugins An array of plugins to apply to the main code bundling.
|
||||
* @returns The build output results of the build.
|
||||
*/
|
||||
export declare function buildApplication(options: ApplicationBuilderOptions, context: BuilderContext, plugins?: Plugin[]): AsyncIterable<ApplicationBuilderOutput>;
|
||||
/**
|
||||
* Builds an application using the `application` builder with the provided
|
||||
* options.
|
||||
*
|
||||
* Usage of the `extensions` parameter is NOT supported and may cause unexpected
|
||||
* build output or build failures.
|
||||
*
|
||||
* @experimental Direct usage of this function is considered experimental.
|
||||
*
|
||||
* @param options The options defined by the builder's schema to use.
|
||||
* @param context An Architect builder context instance.
|
||||
* @param extensions An object contain extension points for the build.
|
||||
* @returns The build output results of the build.
|
||||
*/
|
||||
export declare function buildApplication(options: ApplicationBuilderOptions, context: BuilderContext, extensions?: ApplicationBuilderExtensions): AsyncIterable<ApplicationBuilderOutput>;
|
||||
declare const _default: import("../../../../architect/src/internal").Builder<ApplicationBuilderOptions & import("../../../../core/src").JsonObject>;
|
||||
export default _default;
|
101
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/index.js
generated
vendored
Executable file
101
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/index.js
generated
vendored
Executable file
|
@ -0,0 +1,101 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildApplication = exports.buildApplicationInternal = void 0;
|
||||
const architect_1 = require("@angular-devkit/architect");
|
||||
const bundler_context_1 = require("../../tools/esbuild/bundler-context");
|
||||
const purge_cache_1 = require("../../utils/purge-cache");
|
||||
const version_1 = require("../../utils/version");
|
||||
const build_action_1 = require("./build-action");
|
||||
const execute_build_1 = require("./execute-build");
|
||||
const options_1 = require("./options");
|
||||
async function* buildApplicationInternal(options,
|
||||
// TODO: Integrate abort signal support into builder system
|
||||
context, infrastructureSettings, extensions) {
|
||||
const { workspaceRoot, logger, target } = context;
|
||||
// Check Angular version.
|
||||
(0, version_1.assertCompatibleAngularVersion)(workspaceRoot);
|
||||
// Purge old build disk cache.
|
||||
await (0, purge_cache_1.purgeStaleBuildCache)(context);
|
||||
// Determine project name from builder context target
|
||||
const projectName = target?.project;
|
||||
if (!projectName) {
|
||||
yield { success: false, error: `The 'application' builder requires a target to be specified.` };
|
||||
return;
|
||||
}
|
||||
const normalizedOptions = await (0, options_1.normalizeOptions)(context, projectName, options, extensions);
|
||||
const writeToFileSystem = infrastructureSettings?.write ?? true;
|
||||
const writeServerBundles = writeToFileSystem && !!(normalizedOptions.ssrOptions && normalizedOptions.serverEntryPoint);
|
||||
if (writeServerBundles) {
|
||||
const { browser, server } = normalizedOptions.outputOptions;
|
||||
if (browser === '') {
|
||||
yield {
|
||||
success: false,
|
||||
error: `'outputPath.browser' cannot be configured to an empty string when SSR is enabled.`,
|
||||
};
|
||||
return;
|
||||
}
|
||||
if (browser === server) {
|
||||
yield {
|
||||
success: false,
|
||||
error: `'outputPath.browser' and 'outputPath.server' cannot be configured to the same value.`,
|
||||
};
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Setup an abort controller with a builder teardown if no signal is present
|
||||
let signal = context.signal;
|
||||
if (!signal) {
|
||||
const controller = new AbortController();
|
||||
signal = controller.signal;
|
||||
context.addTeardown(() => controller.abort('builder-teardown'));
|
||||
}
|
||||
yield* (0, build_action_1.runEsBuildBuildAction)(async (rebuildState) => {
|
||||
const startTime = process.hrtime.bigint();
|
||||
const result = await (0, execute_build_1.executeBuild)(normalizedOptions, context, rebuildState);
|
||||
const buildTime = Number(process.hrtime.bigint() - startTime) / 10 ** 9;
|
||||
const status = result.errors.length > 0 ? 'failed' : 'complete';
|
||||
logger.info(`Application bundle generation ${status}. [${buildTime.toFixed(3)} seconds]`);
|
||||
return result;
|
||||
}, {
|
||||
watch: normalizedOptions.watch,
|
||||
preserveSymlinks: normalizedOptions.preserveSymlinks,
|
||||
poll: normalizedOptions.poll,
|
||||
deleteOutputPath: normalizedOptions.deleteOutputPath,
|
||||
cacheOptions: normalizedOptions.cacheOptions,
|
||||
outputOptions: normalizedOptions.outputOptions,
|
||||
verbose: normalizedOptions.verbose,
|
||||
projectRoot: normalizedOptions.projectRoot,
|
||||
workspaceRoot: normalizedOptions.workspaceRoot,
|
||||
progress: normalizedOptions.progress,
|
||||
writeToFileSystem,
|
||||
// For app-shell and SSG server files are not required by users.
|
||||
// Omit these when SSR is not enabled.
|
||||
writeToFileSystemFilter: writeServerBundles
|
||||
? undefined
|
||||
: (file) => file.type !== bundler_context_1.BuildOutputFileType.Server,
|
||||
logger,
|
||||
signal,
|
||||
});
|
||||
}
|
||||
exports.buildApplicationInternal = buildApplicationInternal;
|
||||
function buildApplication(options, context, pluginsOrExtensions) {
|
||||
let extensions;
|
||||
if (pluginsOrExtensions && Array.isArray(pluginsOrExtensions)) {
|
||||
extensions = {
|
||||
codePlugins: pluginsOrExtensions,
|
||||
};
|
||||
}
|
||||
else {
|
||||
extensions = pluginsOrExtensions;
|
||||
}
|
||||
return buildApplicationInternal(options, context, undefined, extensions);
|
||||
}
|
||||
exports.buildApplication = buildApplication;
|
||||
exports.default = (0, architect_1.createBuilder)(buildApplication);
|
140
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/options.d.ts
generated
vendored
Executable file
140
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/options.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,140 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { BuilderContext } from '@angular-devkit/architect';
|
||||
import type { Plugin } from 'esbuild';
|
||||
import { I18nOptions } from '../../utils/i18n-options';
|
||||
import { IndexHtmlTransform } from '../../utils/index-file/index-html-generator';
|
||||
import { Schema as ApplicationBuilderOptions, I18NTranslation, OutputPathClass } from './schema';
|
||||
export type NormalizedOutputOptions = Required<OutputPathClass>;
|
||||
export type NormalizedApplicationBuildOptions = Awaited<ReturnType<typeof normalizeOptions>>;
|
||||
export interface ApplicationBuilderExtensions {
|
||||
codePlugins?: Plugin[];
|
||||
indexHtmlTransformer?: IndexHtmlTransform;
|
||||
}
|
||||
/** Internal options hidden from builder schema but available when invoked programmatically. */
|
||||
interface InternalOptions {
|
||||
/**
|
||||
* Entry points to use for the compilation. Incompatible with `browser`, which must not be provided. May be relative or absolute paths.
|
||||
* If given a relative path, it is resolved relative to the current workspace and will generate an output at the same relative location
|
||||
* in the output directory. If given an absolute path, the output will be generated in the root of the output directory with the same base
|
||||
* name.
|
||||
*/
|
||||
entryPoints?: Set<string>;
|
||||
/** File extension to use for the generated output files. */
|
||||
outExtension?: 'js' | 'mjs';
|
||||
/**
|
||||
* Indicates whether all node packages should be marked as external.
|
||||
* Currently used by the dev-server to support prebundling.
|
||||
*/
|
||||
externalPackages?: boolean;
|
||||
/**
|
||||
* Forces the output from the localize post-processing to not create nested directories per locale output.
|
||||
* This is only used by the development server which currently only supports a single locale per build.
|
||||
*/
|
||||
forceI18nFlatOutput?: boolean;
|
||||
/**
|
||||
* Allows for usage of the deprecated `deployUrl` option with the compatibility builder `browser-esbuild`.
|
||||
*/
|
||||
deployUrl?: string;
|
||||
}
|
||||
/** Full set of options for `application` builder. */
|
||||
export type ApplicationBuilderInternalOptions = Omit<ApplicationBuilderOptions & InternalOptions, 'browser'> & {
|
||||
browser?: string;
|
||||
};
|
||||
/**
|
||||
* Normalize the user provided options by creating full paths for all path based options
|
||||
* and converting multi-form options into a single form that can be directly used
|
||||
* by the build process.
|
||||
*
|
||||
* @param context The context for current builder execution.
|
||||
* @param projectName The name of the project for the current execution.
|
||||
* @param options An object containing the options to use for the build.
|
||||
* @param plugins An optional array of programmatically supplied build plugins.
|
||||
* @returns An object containing normalized options required to perform the build.
|
||||
*/
|
||||
export declare function normalizeOptions(context: BuilderContext, projectName: string, options: ApplicationBuilderInternalOptions, extensions?: ApplicationBuilderExtensions): Promise<{
|
||||
advancedOptimizations: boolean;
|
||||
allowedCommonJsDependencies: string[] | undefined;
|
||||
baseHref: string | undefined;
|
||||
cacheOptions: import("../../utils/normalize-cache").NormalizedCachedOptions;
|
||||
crossOrigin: import("./schema").CrossOrigin | undefined;
|
||||
deleteOutputPath: boolean | undefined;
|
||||
externalDependencies: string[] | undefined;
|
||||
extractLicenses: boolean | undefined;
|
||||
inlineStyleLanguage: string;
|
||||
jit: boolean;
|
||||
stats: boolean;
|
||||
polyfills: string[] | undefined;
|
||||
poll: number | undefined;
|
||||
progress: boolean;
|
||||
externalPackages: boolean | undefined;
|
||||
preserveSymlinks: boolean;
|
||||
stylePreprocessorOptions: import("./schema").StylePreprocessorOptions | undefined;
|
||||
subresourceIntegrity: boolean | undefined;
|
||||
serverEntryPoint: string | undefined;
|
||||
prerenderOptions: {
|
||||
discoverRoutes: boolean;
|
||||
routesFile: string | undefined;
|
||||
} | undefined;
|
||||
appShellOptions: {
|
||||
route: string;
|
||||
} | undefined;
|
||||
ssrOptions: {
|
||||
entry?: undefined;
|
||||
} | {
|
||||
entry: string | undefined;
|
||||
} | undefined;
|
||||
verbose: boolean | undefined;
|
||||
watch: boolean | undefined;
|
||||
workspaceRoot: string;
|
||||
entryPoints: Record<string, string>;
|
||||
optimizationOptions: import("../../utils").NormalizedOptimizationOptions;
|
||||
outputOptions: Required<OutputPathClass>;
|
||||
outExtension: "js" | "mjs" | undefined;
|
||||
sourcemapOptions: import("../..").SourceMapObject;
|
||||
tsconfig: string;
|
||||
projectRoot: string;
|
||||
assets: import("../..").AssetPatternObject[] | undefined;
|
||||
outputNames: {
|
||||
bundles: string;
|
||||
media: string;
|
||||
};
|
||||
fileReplacements: Record<string, string> | undefined;
|
||||
globalStyles: {
|
||||
name: string;
|
||||
files: string[];
|
||||
initial: boolean;
|
||||
}[];
|
||||
globalScripts: {
|
||||
name: string;
|
||||
files: string[];
|
||||
initial: boolean;
|
||||
}[];
|
||||
serviceWorker: string | undefined;
|
||||
indexHtmlOptions: {
|
||||
input: string;
|
||||
output: string;
|
||||
insertionOrder: import("../../utils/package-chunk-sort").EntryPointsType[];
|
||||
transformer: IndexHtmlTransform | undefined;
|
||||
preloadInitial: boolean;
|
||||
} | undefined;
|
||||
tailwindConfiguration: {
|
||||
file: string;
|
||||
package: string;
|
||||
} | undefined;
|
||||
i18nOptions: I18nOptions & {
|
||||
duplicateTranslationBehavior?: I18NTranslation | undefined;
|
||||
missingTranslationBehavior?: I18NTranslation | undefined;
|
||||
};
|
||||
namedChunks: boolean | undefined;
|
||||
budgets: import("./schema").Budget[] | undefined;
|
||||
publicPath: string | undefined;
|
||||
plugins: Plugin[] | undefined;
|
||||
loaderExtensions: Record<string, "binary" | "file" | "text"> | undefined;
|
||||
}>;
|
||||
export {};
|
313
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/options.js
generated
vendored
Executable file
313
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/options.js
generated
vendored
Executable file
|
@ -0,0 +1,313 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.normalizeOptions = void 0;
|
||||
const node_fs_1 = require("node:fs");
|
||||
const promises_1 = require("node:fs/promises");
|
||||
const node_module_1 = require("node:module");
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const helpers_1 = require("../../tools/webpack/utils/helpers");
|
||||
const utils_1 = require("../../utils");
|
||||
const i18n_options_1 = require("../../utils/i18n-options");
|
||||
const normalize_cache_1 = require("../../utils/normalize-cache");
|
||||
const package_chunk_sort_1 = require("../../utils/package-chunk-sort");
|
||||
const tailwind_1 = require("../../utils/tailwind");
|
||||
const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
|
||||
const schema_1 = require("./schema");
|
||||
/**
|
||||
* Normalize the user provided options by creating full paths for all path based options
|
||||
* and converting multi-form options into a single form that can be directly used
|
||||
* by the build process.
|
||||
*
|
||||
* @param context The context for current builder execution.
|
||||
* @param projectName The name of the project for the current execution.
|
||||
* @param options An object containing the options to use for the build.
|
||||
* @param plugins An optional array of programmatically supplied build plugins.
|
||||
* @returns An object containing normalized options required to perform the build.
|
||||
*/
|
||||
// eslint-disable-next-line max-lines-per-function
|
||||
async function normalizeOptions(context, projectName, options, extensions) {
|
||||
// If not explicitly set, default to the Node.js process argument
|
||||
const preserveSymlinks = options.preserveSymlinks ?? process.execArgv.includes('--preserve-symlinks');
|
||||
// Setup base paths based on workspace root and project information
|
||||
const workspaceRoot = preserveSymlinks
|
||||
? context.workspaceRoot
|
||||
: // NOTE: promises.realpath should not be used here since it uses realpath.native which
|
||||
// can cause case conversion and other undesirable behavior on Windows systems.
|
||||
// ref: https://github.com/nodejs/node/issues/7726
|
||||
(0, node_fs_1.realpathSync)(context.workspaceRoot);
|
||||
const projectMetadata = await context.getProjectMetadata(projectName);
|
||||
const projectRoot = normalizeDirectoryPath(node_path_1.default.join(workspaceRoot, projectMetadata.root ?? ''));
|
||||
const projectSourceRoot = normalizeDirectoryPath(node_path_1.default.join(workspaceRoot, projectMetadata.sourceRoot ?? 'src'));
|
||||
// Gather persistent caching option and provide a project specific cache location
|
||||
const cacheOptions = (0, normalize_cache_1.normalizeCacheOptions)(projectMetadata, workspaceRoot);
|
||||
cacheOptions.path = node_path_1.default.join(cacheOptions.path, projectName);
|
||||
const i18nOptions = (0, i18n_options_1.createI18nOptions)(projectMetadata, options.localize);
|
||||
i18nOptions.duplicateTranslationBehavior = options.i18nDuplicateTranslation;
|
||||
i18nOptions.missingTranslationBehavior = options.i18nMissingTranslation;
|
||||
if (options.forceI18nFlatOutput) {
|
||||
i18nOptions.flatOutput = true;
|
||||
}
|
||||
const entryPoints = normalizeEntryPoints(workspaceRoot, options.browser, options.entryPoints);
|
||||
const tsconfig = node_path_1.default.join(workspaceRoot, options.tsConfig);
|
||||
const optimizationOptions = (0, utils_1.normalizeOptimization)(options.optimization);
|
||||
const sourcemapOptions = (0, utils_1.normalizeSourceMaps)(options.sourceMap ?? false);
|
||||
const assets = options.assets?.length
|
||||
? (0, utils_1.normalizeAssetPatterns)(options.assets, workspaceRoot, projectRoot, projectSourceRoot)
|
||||
: undefined;
|
||||
const outputPath = options.outputPath;
|
||||
const outputOptions = {
|
||||
browser: 'browser',
|
||||
server: 'server',
|
||||
media: 'media',
|
||||
...(typeof outputPath === 'string' ? undefined : outputPath),
|
||||
base: normalizeDirectoryPath(node_path_1.default.resolve(workspaceRoot, typeof outputPath === 'string' ? outputPath : outputPath.base)),
|
||||
};
|
||||
const outputNames = {
|
||||
bundles: options.outputHashing === schema_1.OutputHashing.All || options.outputHashing === schema_1.OutputHashing.Bundles
|
||||
? '[name]-[hash]'
|
||||
: '[name]',
|
||||
media: outputOptions.media +
|
||||
(options.outputHashing === schema_1.OutputHashing.All || options.outputHashing === schema_1.OutputHashing.Media
|
||||
? '/[name]-[hash]'
|
||||
: '/[name]'),
|
||||
};
|
||||
let fileReplacements;
|
||||
if (options.fileReplacements) {
|
||||
for (const replacement of options.fileReplacements) {
|
||||
const fileReplaceWith = node_path_1.default.join(workspaceRoot, replacement.with);
|
||||
try {
|
||||
await (0, promises_1.access)(fileReplaceWith, promises_1.constants.F_OK);
|
||||
}
|
||||
catch {
|
||||
throw new Error(`The ${fileReplaceWith} path in file replacements does not exist.`);
|
||||
}
|
||||
fileReplacements ??= {};
|
||||
fileReplacements[node_path_1.default.join(workspaceRoot, replacement.replace)] = fileReplaceWith;
|
||||
}
|
||||
}
|
||||
let loaderExtensions;
|
||||
if (options.loader) {
|
||||
for (const [extension, value] of Object.entries(options.loader)) {
|
||||
if (extension[0] !== '.' || /\.[cm]?[jt]sx?$/.test(extension)) {
|
||||
continue;
|
||||
}
|
||||
if (value !== 'text' && value !== 'binary' && value !== 'file' && value !== 'empty') {
|
||||
continue;
|
||||
}
|
||||
loaderExtensions ??= {};
|
||||
loaderExtensions[extension] = value;
|
||||
}
|
||||
}
|
||||
const globalStyles = [];
|
||||
if (options.styles?.length) {
|
||||
const { entryPoints: stylesheetEntrypoints, noInjectNames } = (0, helpers_1.normalizeGlobalStyles)(options.styles || []);
|
||||
for (const [name, files] of Object.entries(stylesheetEntrypoints)) {
|
||||
globalStyles.push({ name, files, initial: !noInjectNames.includes(name) });
|
||||
}
|
||||
}
|
||||
const globalScripts = [];
|
||||
if (options.scripts?.length) {
|
||||
for (const { bundleName, paths, inject } of (0, helpers_1.globalScriptsByBundleName)(options.scripts)) {
|
||||
globalScripts.push({ name: bundleName, files: paths, initial: inject });
|
||||
}
|
||||
}
|
||||
let indexHtmlOptions;
|
||||
// index can never have a value of `true` but in the schema it's of type `boolean`.
|
||||
if (typeof options.index !== 'boolean') {
|
||||
indexHtmlOptions = {
|
||||
input: node_path_1.default.join(workspaceRoot, (0, webpack_browser_config_1.getIndexInputFile)(options.index)),
|
||||
// The output file will be created within the configured output path
|
||||
output: (0, webpack_browser_config_1.getIndexOutputFile)(options.index),
|
||||
// TODO: Use existing information from above to create the insertion order
|
||||
insertionOrder: (0, package_chunk_sort_1.generateEntryPoints)({
|
||||
scripts: options.scripts ?? [],
|
||||
styles: options.styles ?? [],
|
||||
}),
|
||||
transformer: extensions?.indexHtmlTransformer,
|
||||
// Preload initial defaults to true
|
||||
preloadInitial: typeof options.index !== 'object' || (options.index.preloadInitial ?? true),
|
||||
};
|
||||
}
|
||||
let serverEntryPoint;
|
||||
if (options.server) {
|
||||
serverEntryPoint = node_path_1.default.join(workspaceRoot, options.server);
|
||||
}
|
||||
else if (options.server === '') {
|
||||
throw new Error('`server` option cannot be an empty string.');
|
||||
}
|
||||
let prerenderOptions;
|
||||
if (options.prerender) {
|
||||
const { discoverRoutes = true, routesFile = undefined } = options.prerender === true ? {} : options.prerender;
|
||||
prerenderOptions = {
|
||||
discoverRoutes,
|
||||
routesFile: routesFile && node_path_1.default.join(workspaceRoot, routesFile),
|
||||
};
|
||||
}
|
||||
let ssrOptions;
|
||||
if (options.ssr === true) {
|
||||
ssrOptions = {};
|
||||
}
|
||||
else if (typeof options.ssr === 'object') {
|
||||
const { entry } = options.ssr;
|
||||
ssrOptions = {
|
||||
entry: entry && node_path_1.default.join(workspaceRoot, entry),
|
||||
};
|
||||
}
|
||||
let appShellOptions;
|
||||
if (options.appShell) {
|
||||
appShellOptions = {
|
||||
route: 'shell',
|
||||
};
|
||||
}
|
||||
// Initial options to keep
|
||||
const { allowedCommonJsDependencies, aot, baseHref, crossOrigin, externalDependencies, extractLicenses, inlineStyleLanguage = 'css', outExtension, serviceWorker, poll, polyfills, statsJson, stylePreprocessorOptions, subresourceIntegrity, verbose, watch, progress = true, externalPackages, deleteOutputPath, namedChunks, budgets, deployUrl, } = options;
|
||||
// Return all the normalized options
|
||||
return {
|
||||
advancedOptimizations: !!aot && optimizationOptions.scripts,
|
||||
allowedCommonJsDependencies,
|
||||
baseHref,
|
||||
cacheOptions,
|
||||
crossOrigin,
|
||||
deleteOutputPath,
|
||||
externalDependencies,
|
||||
extractLicenses,
|
||||
inlineStyleLanguage,
|
||||
jit: !aot,
|
||||
stats: !!statsJson,
|
||||
polyfills: polyfills === undefined || Array.isArray(polyfills) ? polyfills : [polyfills],
|
||||
poll,
|
||||
progress,
|
||||
externalPackages,
|
||||
preserveSymlinks,
|
||||
stylePreprocessorOptions,
|
||||
subresourceIntegrity,
|
||||
serverEntryPoint,
|
||||
prerenderOptions,
|
||||
appShellOptions,
|
||||
ssrOptions,
|
||||
verbose,
|
||||
watch,
|
||||
workspaceRoot,
|
||||
entryPoints,
|
||||
optimizationOptions,
|
||||
outputOptions,
|
||||
outExtension,
|
||||
sourcemapOptions,
|
||||
tsconfig,
|
||||
projectRoot,
|
||||
assets,
|
||||
outputNames,
|
||||
fileReplacements,
|
||||
globalStyles,
|
||||
globalScripts,
|
||||
serviceWorker: typeof serviceWorker === 'string' ? node_path_1.default.join(workspaceRoot, serviceWorker) : undefined,
|
||||
indexHtmlOptions,
|
||||
tailwindConfiguration: await getTailwindConfig(workspaceRoot, projectRoot, context),
|
||||
i18nOptions,
|
||||
namedChunks,
|
||||
budgets: budgets?.length ? budgets : undefined,
|
||||
publicPath: deployUrl ? deployUrl : undefined,
|
||||
plugins: extensions?.codePlugins?.length ? extensions?.codePlugins : undefined,
|
||||
loaderExtensions,
|
||||
};
|
||||
}
|
||||
exports.normalizeOptions = normalizeOptions;
|
||||
async function getTailwindConfig(workspaceRoot, projectRoot, context) {
|
||||
const tailwindConfigurationPath = await (0, tailwind_1.findTailwindConfigurationFile)(workspaceRoot, projectRoot);
|
||||
if (!tailwindConfigurationPath) {
|
||||
return undefined;
|
||||
}
|
||||
// Create a node resolver at the project root as a directory
|
||||
const resolver = (0, node_module_1.createRequire)(projectRoot + '/');
|
||||
try {
|
||||
return {
|
||||
file: tailwindConfigurationPath,
|
||||
package: resolver.resolve('tailwindcss'),
|
||||
};
|
||||
}
|
||||
catch {
|
||||
const relativeTailwindConfigPath = node_path_1.default.relative(workspaceRoot, tailwindConfigurationPath);
|
||||
context.logger.warn(`Tailwind CSS configuration file found (${relativeTailwindConfigPath})` +
|
||||
` but the 'tailwindcss' package is not installed.` +
|
||||
` To enable Tailwind CSS, please install the 'tailwindcss' package.`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Normalize entry point options. To maintain compatibility with the legacy browser builder, we need a single `browser`
|
||||
* option which defines a single entry point. However, we also want to support multiple entry points as an internal option.
|
||||
* The two options are mutually exclusive and if `browser` is provided it will be used as the sole entry point.
|
||||
* If `entryPoints` are provided, they will be used as the set of entry points.
|
||||
*
|
||||
* @param workspaceRoot Path to the root of the Angular workspace.
|
||||
* @param browser The `browser` option pointing at the application entry point. While required per the schema file, it may be omitted by
|
||||
* programmatic usages of `browser-esbuild`.
|
||||
* @param entryPoints Set of entry points to use if provided.
|
||||
* @returns An object mapping entry point names to their file paths.
|
||||
*/
|
||||
function normalizeEntryPoints(workspaceRoot, browser, entryPoints = new Set()) {
|
||||
if (browser === '') {
|
||||
throw new Error('`browser` option cannot be an empty string.');
|
||||
}
|
||||
// `browser` and `entryPoints` are mutually exclusive.
|
||||
if (browser && entryPoints.size > 0) {
|
||||
throw new Error('Only one of `browser` or `entryPoints` may be provided.');
|
||||
}
|
||||
if (!browser && entryPoints.size === 0) {
|
||||
// Schema should normally reject this case, but programmatic usages of the builder might make this mistake.
|
||||
throw new Error('Either `browser` or at least one `entryPoints` value must be provided.');
|
||||
}
|
||||
// Schema types force `browser` to always be provided, but it may be omitted when the builder is invoked programmatically.
|
||||
if (browser) {
|
||||
// Use `browser` alone.
|
||||
return { 'main': node_path_1.default.join(workspaceRoot, browser) };
|
||||
}
|
||||
else {
|
||||
// Use `entryPoints` alone.
|
||||
const entryPointPaths = {};
|
||||
for (const entryPoint of entryPoints) {
|
||||
const parsedEntryPoint = node_path_1.default.parse(entryPoint);
|
||||
// Use the input file path without an extension as the "name" of the entry point dictating its output location.
|
||||
// Relative entry points are generated at the same relative path in the output directory.
|
||||
// Absolute entry points are always generated with the same file name in the root of the output directory. This includes absolute
|
||||
// paths pointing at files actually within the workspace root.
|
||||
const entryPointName = node_path_1.default.isAbsolute(entryPoint)
|
||||
? parsedEntryPoint.name
|
||||
: node_path_1.default.join(parsedEntryPoint.dir, parsedEntryPoint.name);
|
||||
// Get the full file path to a relative entry point input. Leave bare specifiers alone so they are resolved as modules.
|
||||
const isRelativePath = entryPoint.startsWith('.');
|
||||
const entryPointPath = isRelativePath ? node_path_1.default.join(workspaceRoot, entryPoint) : entryPoint;
|
||||
// Check for conflicts with previous entry points.
|
||||
const existingEntryPointPath = entryPointPaths[entryPointName];
|
||||
if (existingEntryPointPath) {
|
||||
throw new Error(`\`${existingEntryPointPath}\` and \`${entryPointPath}\` both output to the same location \`${entryPointName}\`.` +
|
||||
' Rename or move one of the files to fix the conflict.');
|
||||
}
|
||||
entryPointPaths[entryPointName] = entryPointPath;
|
||||
}
|
||||
return entryPointPaths;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Normalize a directory path string.
|
||||
* Currently only removes a trailing slash if present.
|
||||
* @param path A path string.
|
||||
* @returns A normalized path string.
|
||||
*/
|
||||
function normalizeDirectoryPath(path) {
|
||||
const last = path[path.length - 1];
|
||||
if (last === '/' || last === '\\') {
|
||||
return path.slice(0, -1);
|
||||
}
|
||||
return path;
|
||||
}
|
493
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/schema.d.ts
generated
vendored
Executable file
493
my-app/node_modules/@angular-devkit/build-angular/src/builders/application/schema.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,493 @@
|
|||
/**
|
||||
* Application builder target options
|
||||
*/
|
||||
export interface Schema {
|
||||
/**
|
||||
* A list of CommonJS or AMD packages that are allowed to be used without a build time
|
||||
* warning. Use `'*'` to allow all.
|
||||
*/
|
||||
allowedCommonJsDependencies?: string[];
|
||||
/**
|
||||
* Build using Ahead of Time compilation.
|
||||
*/
|
||||
aot?: boolean;
|
||||
/**
|
||||
* Generates an application shell during build time.
|
||||
*/
|
||||
appShell?: boolean;
|
||||
/**
|
||||
* List of static application assets.
|
||||
*/
|
||||
assets?: AssetPattern[];
|
||||
/**
|
||||
* Base url for the application being built.
|
||||
*/
|
||||
baseHref?: string;
|
||||
/**
|
||||
* The full path for the browser entry point to the application, relative to the current
|
||||
* workspace.
|
||||
*/
|
||||
browser: string;
|
||||
/**
|
||||
* Budget thresholds to ensure parts of your application stay within boundaries which you
|
||||
* set.
|
||||
*/
|
||||
budgets?: Budget[];
|
||||
/**
|
||||
* Define the crossorigin attribute setting of elements that provide CORS support.
|
||||
*/
|
||||
crossOrigin?: CrossOrigin;
|
||||
/**
|
||||
* Delete the output path before building.
|
||||
*/
|
||||
deleteOutputPath?: boolean;
|
||||
/**
|
||||
* Exclude the listed external dependencies from being bundled into the bundle. Instead, the
|
||||
* created bundle relies on these dependencies to be available during runtime.
|
||||
*/
|
||||
externalDependencies?: string[];
|
||||
/**
|
||||
* Extract all licenses in a separate file.
|
||||
*/
|
||||
extractLicenses?: boolean;
|
||||
/**
|
||||
* Replace compilation source files with other compilation source files in the build.
|
||||
*/
|
||||
fileReplacements?: FileReplacement[];
|
||||
/**
|
||||
* How to handle duplicate translations for i18n.
|
||||
*/
|
||||
i18nDuplicateTranslation?: I18NTranslation;
|
||||
/**
|
||||
* How to handle missing translations for i18n.
|
||||
*/
|
||||
i18nMissingTranslation?: I18NTranslation;
|
||||
/**
|
||||
* Configures the generation of the application's HTML index.
|
||||
*/
|
||||
index: IndexUnion;
|
||||
/**
|
||||
* The stylesheet language to use for the application's inline component styles.
|
||||
*/
|
||||
inlineStyleLanguage?: InlineStyleLanguage;
|
||||
/**
|
||||
* Defines the type of loader to use with a specified file extension when used with a
|
||||
* JavaScript `import`. `text` inlines the content as a string; `binary` inlines the content
|
||||
* as a Uint8Array; `file` emits the file and provides the runtime location of the file;
|
||||
* `empty` considers the content to be empty and not include it in bundles.
|
||||
*/
|
||||
loader?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
* Translate the bundles in one or more locales.
|
||||
*/
|
||||
localize?: Localize;
|
||||
/**
|
||||
* Use file name for lazy loaded chunks.
|
||||
*/
|
||||
namedChunks?: boolean;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
optimization?: OptimizationUnion;
|
||||
/**
|
||||
* Define the output filename cache-busting hashing mode.
|
||||
*/
|
||||
outputHashing?: OutputHashing;
|
||||
/**
|
||||
* Specify the output path relative to workspace root.
|
||||
*/
|
||||
outputPath: OutputPathUnion;
|
||||
/**
|
||||
* Enable and define the file watching poll time period in milliseconds.
|
||||
*/
|
||||
poll?: number;
|
||||
/**
|
||||
* 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'.
|
||||
*/
|
||||
polyfills?: string[];
|
||||
/**
|
||||
* Prerender (SSG) pages of your application during build time.
|
||||
*/
|
||||
prerender?: PrerenderUnion;
|
||||
/**
|
||||
* Do not use the real path when resolving modules. If unset then will default to `true` if
|
||||
* NodeJS option --preserve-symlinks is set.
|
||||
*/
|
||||
preserveSymlinks?: boolean;
|
||||
/**
|
||||
* Log progress to the console while building.
|
||||
*/
|
||||
progress?: boolean;
|
||||
/**
|
||||
* Global scripts to be included in the build.
|
||||
*/
|
||||
scripts?: ScriptElement[];
|
||||
/**
|
||||
* The full path for the server entry point to the application, relative to the current
|
||||
* workspace.
|
||||
*/
|
||||
server?: string;
|
||||
/**
|
||||
* Generates a service worker configuration.
|
||||
*/
|
||||
serviceWorker?: ServiceWorker;
|
||||
/**
|
||||
* Output source maps for scripts and styles. For more information, see
|
||||
* https://angular.io/guide/workspace-config#source-map-configuration.
|
||||
*/
|
||||
sourceMap?: SourceMapUnion;
|
||||
/**
|
||||
* Server side render (SSR) pages of your application during runtime.
|
||||
*/
|
||||
ssr?: SsrUnion;
|
||||
/**
|
||||
* Generates a 'stats.json' file which can be analyzed with
|
||||
* https://esbuild.github.io/analyze/.
|
||||
*/
|
||||
statsJson?: boolean;
|
||||
/**
|
||||
* Options to pass to style preprocessors.
|
||||
*/
|
||||
stylePreprocessorOptions?: StylePreprocessorOptions;
|
||||
/**
|
||||
* Global styles to be included in the build.
|
||||
*/
|
||||
styles?: StyleElement[];
|
||||
/**
|
||||
* Enables the use of subresource integrity validation.
|
||||
*/
|
||||
subresourceIntegrity?: boolean;
|
||||
/**
|
||||
* The full path for the TypeScript configuration file, relative to the current workspace.
|
||||
*/
|
||||
tsConfig: string;
|
||||
/**
|
||||
* Adds more details to output logging.
|
||||
*/
|
||||
verbose?: boolean;
|
||||
/**
|
||||
* Run build when files change.
|
||||
*/
|
||||
watch?: boolean;
|
||||
/**
|
||||
* TypeScript configuration for Web Worker modules.
|
||||
*/
|
||||
webWorkerTsConfig?: string;
|
||||
}
|
||||
export type AssetPattern = AssetPatternClass | string;
|
||||
export interface AssetPatternClass {
|
||||
/**
|
||||
* Allow glob patterns to follow symlink directories. This allows subdirectories of the
|
||||
* symlink to be searched.
|
||||
*/
|
||||
followSymlinks?: boolean;
|
||||
/**
|
||||
* The pattern to match.
|
||||
*/
|
||||
glob: string;
|
||||
/**
|
||||
* An array of globs to ignore.
|
||||
*/
|
||||
ignore?: string[];
|
||||
/**
|
||||
* The input directory path in which to apply 'glob'. Defaults to the project root.
|
||||
*/
|
||||
input: string;
|
||||
/**
|
||||
* Absolute path within the output.
|
||||
*/
|
||||
output: string;
|
||||
}
|
||||
export interface Budget {
|
||||
/**
|
||||
* The baseline size for comparison.
|
||||
*/
|
||||
baseline?: string;
|
||||
/**
|
||||
* The threshold for error relative to the baseline (min & max).
|
||||
*/
|
||||
error?: string;
|
||||
/**
|
||||
* The maximum threshold for error relative to the baseline.
|
||||
*/
|
||||
maximumError?: string;
|
||||
/**
|
||||
* The maximum threshold for warning relative to the baseline.
|
||||
*/
|
||||
maximumWarning?: string;
|
||||
/**
|
||||
* The minimum threshold for error relative to the baseline.
|
||||
*/
|
||||
minimumError?: string;
|
||||
/**
|
||||
* The minimum threshold for warning relative to the baseline.
|
||||
*/
|
||||
minimumWarning?: string;
|
||||
/**
|
||||
* The name of the bundle.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The type of budget.
|
||||
*/
|
||||
type: Type;
|
||||
/**
|
||||
* The threshold for warning relative to the baseline (min & max).
|
||||
*/
|
||||
warning?: string;
|
||||
}
|
||||
/**
|
||||
* The type of budget.
|
||||
*/
|
||||
export declare enum Type {
|
||||
All = "all",
|
||||
AllScript = "allScript",
|
||||
Any = "any",
|
||||
AnyComponentStyle = "anyComponentStyle",
|
||||
AnyScript = "anyScript",
|
||||
Bundle = "bundle",
|
||||
Initial = "initial"
|
||||
}
|
||||
/**
|
||||
* Define the crossorigin attribute setting of elements that provide CORS support.
|
||||
*/
|
||||
export declare enum CrossOrigin {
|
||||
Anonymous = "anonymous",
|
||||
None = "none",
|
||||
UseCredentials = "use-credentials"
|
||||
}
|
||||
export interface FileReplacement {
|
||||
replace: string;
|
||||
with: string;
|
||||
}
|
||||
/**
|
||||
* How to handle duplicate translations for i18n.
|
||||
*
|
||||
* How to handle missing translations for i18n.
|
||||
*/
|
||||
export declare enum I18NTranslation {
|
||||
Error = "error",
|
||||
Ignore = "ignore",
|
||||
Warning = "warning"
|
||||
}
|
||||
/**
|
||||
* Configures the generation of the application's HTML index.
|
||||
*/
|
||||
export type IndexUnion = boolean | IndexObject | string;
|
||||
export interface IndexObject {
|
||||
/**
|
||||
* The path of a file to use for the application's generated HTML index.
|
||||
*/
|
||||
input: string;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
output?: string;
|
||||
/**
|
||||
* Generates 'preload', 'modulepreload', and 'preconnect' link elements for initial
|
||||
* application files and resources.
|
||||
*/
|
||||
preloadInitial?: boolean;
|
||||
[property: string]: any;
|
||||
}
|
||||
/**
|
||||
* The stylesheet language to use for the application's inline component styles.
|
||||
*/
|
||||
export declare enum InlineStyleLanguage {
|
||||
Css = "css",
|
||||
Less = "less",
|
||||
Sass = "sass",
|
||||
Scss = "scss"
|
||||
}
|
||||
/**
|
||||
* Translate the bundles in one or more locales.
|
||||
*/
|
||||
export type Localize = string[] | boolean;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
export type OptimizationUnion = boolean | OptimizationClass;
|
||||
export interface OptimizationClass {
|
||||
/**
|
||||
* Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY`
|
||||
* environment variable can be used to specify a proxy server.
|
||||
*/
|
||||
fonts?: FontsUnion;
|
||||
/**
|
||||
* Enables optimization of the scripts output.
|
||||
*/
|
||||
scripts?: boolean;
|
||||
/**
|
||||
* Enables optimization of the styles output.
|
||||
*/
|
||||
styles?: StylesUnion;
|
||||
}
|
||||
/**
|
||||
* Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY`
|
||||
* environment variable can be used to specify a proxy server.
|
||||
*/
|
||||
export type FontsUnion = boolean | FontsClass;
|
||||
export interface FontsClass {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
inline?: boolean;
|
||||
}
|
||||
/**
|
||||
* Enables optimization of the styles output.
|
||||
*/
|
||||
export type StylesUnion = boolean | StylesClass;
|
||||
export interface StylesClass {
|
||||
/**
|
||||
* Extract and inline critical CSS definitions to improve first paint time.
|
||||
*/
|
||||
inlineCritical?: boolean;
|
||||
/**
|
||||
* Minify CSS definitions by removing extraneous whitespace and comments, merging
|
||||
* identifiers and minimizing values.
|
||||
*/
|
||||
minify?: boolean;
|
||||
/**
|
||||
* Remove comments in global CSS that contains '@license' or '@preserve' or that starts with
|
||||
* '//!' or '/*!'.
|
||||
*/
|
||||
removeSpecialComments?: boolean;
|
||||
}
|
||||
/**
|
||||
* Define the output filename cache-busting hashing mode.
|
||||
*/
|
||||
export declare enum OutputHashing {
|
||||
All = "all",
|
||||
Bundles = "bundles",
|
||||
Media = "media",
|
||||
None = "none"
|
||||
}
|
||||
/**
|
||||
* Specify the output path relative to workspace root.
|
||||
*/
|
||||
export type OutputPathUnion = OutputPathClass | string;
|
||||
export interface OutputPathClass {
|
||||
/**
|
||||
* Specify the output path relative to workspace root.
|
||||
*/
|
||||
base: string;
|
||||
/**
|
||||
* The output directory name of your browser build within the output path base. Defaults to
|
||||
* 'browser'.
|
||||
*/
|
||||
browser?: string;
|
||||
/**
|
||||
* The output directory name of your media files within the output browser directory.
|
||||
* Defaults to 'media'.
|
||||
*/
|
||||
media?: string;
|
||||
/**
|
||||
* The output directory name of your server build within the output path base. Defaults to
|
||||
* 'server'.
|
||||
*/
|
||||
server?: string;
|
||||
}
|
||||
/**
|
||||
* Prerender (SSG) pages of your application during build time.
|
||||
*/
|
||||
export type PrerenderUnion = boolean | PrerenderClass;
|
||||
export interface PrerenderClass {
|
||||
/**
|
||||
* Whether the builder should process the Angular Router configuration to find all
|
||||
* unparameterized routes and prerender them.
|
||||
*/
|
||||
discoverRoutes?: boolean;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
routesFile?: string;
|
||||
}
|
||||
export type ScriptElement = ScriptClass | string;
|
||||
export interface ScriptClass {
|
||||
/**
|
||||
* The bundle name for this extra entry point.
|
||||
*/
|
||||
bundleName?: string;
|
||||
/**
|
||||
* If the bundle will be referenced in the HTML file.
|
||||
*/
|
||||
inject?: boolean;
|
||||
/**
|
||||
* The file to include.
|
||||
*/
|
||||
input: string;
|
||||
}
|
||||
/**
|
||||
* Generates a service worker configuration.
|
||||
*/
|
||||
export type ServiceWorker = boolean | string;
|
||||
/**
|
||||
* Output source maps for scripts and styles. For more information, see
|
||||
* https://angular.io/guide/workspace-config#source-map-configuration.
|
||||
*/
|
||||
export type SourceMapUnion = boolean | SourceMapClass;
|
||||
export interface SourceMapClass {
|
||||
/**
|
||||
* Output source maps used for error reporting tools.
|
||||
*/
|
||||
hidden?: boolean;
|
||||
/**
|
||||
* Output source maps for all scripts.
|
||||
*/
|
||||
scripts?: boolean;
|
||||
/**
|
||||
* Output source maps for all styles.
|
||||
*/
|
||||
styles?: boolean;
|
||||
/**
|
||||
* Resolve vendor packages source maps.
|
||||
*/
|
||||
vendor?: boolean;
|
||||
}
|
||||
/**
|
||||
* Server side render (SSR) pages of your application during runtime.
|
||||
*/
|
||||
export type SsrUnion = boolean | SsrClass;
|
||||
export interface SsrClass {
|
||||
/**
|
||||
* The server entry-point that when executed will spawn the web server.
|
||||
*/
|
||||
entry?: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to style preprocessors.
|
||||
*/
|
||||
export interface StylePreprocessorOptions {
|
||||
/**
|
||||
* Paths to include. Paths will be resolved to workspace root.
|
||||
*/
|
||||
includePaths?: string[];
|
||||
}
|
||||
export type StyleElement = StyleClass | string;
|
||||
export interface StyleClass {
|
||||
/**
|
||||
* The bundle name for this extra entry point.
|
||||
*/
|
||||
bundleName?: string;
|
||||
/**
|
||||
* If the bundle will be referenced in the HTML file.
|
||||
*/
|
||||
inject?: boolean;
|
||||
/**
|
||||
* The file to include.
|
||||
*/
|
||||
input: string;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue