Conexio amb la api

This commit is contained in:
janmaroto 2022-02-09 18:30:03 +01:00
commit b12369cb47
48513 changed files with 7391639 additions and 7 deletions

21
node_modules/@angular-devkit/architect/LICENSE generated vendored Executable file
View 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
node_modules/@angular-devkit/architect/README.md generated vendored Executable file
View file

@ -0,0 +1,3 @@
# Angular Build Facade
WIP

11
node_modules/@angular-devkit/architect/builders/all-of.d.ts generated vendored Executable file
View 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;

48
node_modules/@angular-devkit/architect/builders/all-of.js generated vendored Executable file
View file

@ -0,0 +1,48 @@
"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 operators_1 = require("rxjs/operators");
const src_1 = require("../src");
exports.default = 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 rxjs_1.from(allRuns).pipe(operators_1.mergeMap((runPromise) => rxjs_1.from(runPromise)), operators_1.mergeMap(([i, run]) => run.output.pipe(operators_1.map((output) => [i, output]))), operators_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 rxjs_1.of({
success: allResults.every((x) => (x ? x.success : false)),
});
}
}));
});

View 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
node_modules/@angular-devkit/architect/builders/concat.d.ts generated vendored Executable file
View 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;

45
node_modules/@angular-devkit/architect/builders/concat.js generated vendored Executable file
View file

@ -0,0 +1,45 @@
"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 operators_1 = require("rxjs/operators");
const src_1 = require("../src");
exports.default = 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 rxjs_1.from(allRuns).pipe(operators_1.concatMap((fn) => stop
? rxjs_1.of(null)
: rxjs_1.from(fn()).pipe(operators_1.switchMap((run) => (run === null ? rxjs_1.of(null) : run.output.pipe(operators_1.first()))))), operators_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;
}
}), operators_1.last());
});

9
node_modules/@angular-devkit/architect/builders/false.d.ts generated vendored Executable file
View 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
node_modules/@angular-devkit/architect/builders/false.js generated vendored Executable file
View 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 = src_1.createBuilder(() => ({
success: false,
error: 'False builder always errors.',
}));

View file

@ -0,0 +1,4 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object"
}

View file

@ -0,0 +1,19 @@
/**
* All input types of builders that perform operations on one or multiple sub-builders.
*/
export interface Schema {
builders?: Builder[];
targets?: Target[];
}
export interface Builder {
builder: string;
options?: {
[key: string]: any;
};
}
export interface Target {
overrides?: {
[key: string]: any;
};
target: string;
}

View 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 });

View 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
node_modules/@angular-devkit/architect/builders/true.d.ts generated vendored Executable file
View 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
node_modules/@angular-devkit/architect/builders/true.js generated vendored Executable file
View 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 = src_1.createBuilder(() => ({ success: true }));

28
node_modules/@angular-devkit/architect/node/BUILD.bazel generated vendored Executable file
View file

@ -0,0 +1,28 @@
# Copyright Google Inc. 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
load("//tools:defaults.bzl", "ts_library")
licenses(["notice"]) # MIT
package(default_visibility = ["//visibility:public"])
ts_library(
name = "node",
srcs = glob(
include = ["**/*.ts"],
exclude = ["**/*_spec.ts"],
),
module_name = "@angular-devkit/architect/node",
module_root = "index.d.ts",
# strict_checks = False,
deps = [
"//packages/angular_devkit/architect",
"//packages/angular_devkit/core",
"//packages/angular_devkit/core/node",
"@npm//@types/node",
"@npm//rxjs",
],
)

8
node_modules/@angular-devkit/architect/node/index.d.ts generated vendored Executable file
View file

@ -0,0 +1,8 @@
/**
* @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 './node-modules-architect-host';

20
node_modules/@angular-devkit/architect/node/index.js generated vendored Executable file
View file

@ -0,0 +1,20 @@
"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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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("./node-modules-architect-host"), exports);

View file

@ -0,0 +1,41 @@
/**
* @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, workspaces } from '@angular-devkit/core';
import { BuilderInfo } from '../src';
import { Target } from '../src/input-schema';
import { ArchitectHost, Builder } from '../src/internal';
export declare 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>;
}

View 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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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.WorkspaceNodeModulesArchitectHost = void 0;
const path = __importStar(require("path"));
const v8_1 = require("v8");
const internal_1 = require("../src/internal");
function clone(obj) {
try {
return v8_1.deserialize(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 {
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) {
var _a, _b, _c, _d;
const targetDefinition = findProjectTarget(workspaceOrHost, project, target);
if (configuration === undefined) {
return ((_a = targetDefinition.options) !== null && _a !== void 0 ? _a : {});
}
if (!((_b = targetDefinition.configurations) === null || _b === void 0 ? void 0 : _b[configuration])) {
throw new Error(`Configuration '${configuration}' is not set in the workspace.`);
}
return ((_d = (_c = targetDefinition.configurations) === null || _c === void 0 ? void 0 : _c[configuration]) !== null && _d !== void 0 ? _d : {});
},
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(projectDefinition.extensions),
};
},
async hasTarget(project, target) {
var _a;
return !!((_a = workspaceOrHost.projects.get(project)) === null || _a === void 0 ? void 0 : _a.targets.has(target));
},
async getDefaultConfigurationName(project, target) {
var _a, _b;
return (_b = (_a = workspaceOrHost.projects.get(project)) === null || _a === void 0 ? void 0 : _a.targets.get(target)) === null || _b === void 0 ? void 0 : _b.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 Promise.resolve().then(() => __importStar(require(info.import)))).default;
if (builder[internal_1.BuilderSymbol]) {
return builder;
}
// Default handling code is for old builders that incorrectly export `default` with non-ESM module
if (builder === null || builder === void 0 ? void 0 : builder.default[internal_1.BuilderSymbol]) {
return builder.default;
}
throw new Error('Builder is not a builder');
}
}
exports.WorkspaceNodeModulesArchitectHost = WorkspaceNodeModulesArchitectHost;

65
node_modules/@angular-devkit/architect/package.json generated vendored Executable file
View file

@ -0,0 +1,65 @@
{
"_from": "@angular-devkit/architect@0.1201.4",
"_id": "@angular-devkit/architect@0.1201.4",
"_inBundle": false,
"_integrity": "sha512-hGO5NrZxV8Z7sILwokt7H+1sMf+5tJS9PJszvYlIBSzG0LBkOwwLQDb4MD42ATXFru57SXNqMZDVKoi1kTgxAw==",
"_location": "/@angular-devkit/architect",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@angular-devkit/architect@0.1201.4",
"name": "@angular-devkit/architect",
"escapedName": "@angular-devkit%2farchitect",
"scope": "@angular-devkit",
"rawSpec": "0.1201.4",
"saveSpec": null,
"fetchSpec": "0.1201.4"
},
"_requiredBy": [
"/@angular-devkit/build-angular",
"/@angular-devkit/build-webpack",
"/@angular/cli"
],
"_resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1201.4.tgz",
"_shasum": "bdd4ed088845bc5412ac8ab9dd4355953f09ea70",
"_spec": "@angular-devkit/architect@0.1201.4",
"_where": "/home/jack/Documents/JDA/m14/projecte_janmaroto/node_modules/@angular-devkit/build-angular",
"author": {
"name": "Angular Authors"
},
"bugs": {
"url": "https://github.com/angular/angular-cli/issues"
},
"builders": "./builders/builders.json",
"bundleDependencies": false,
"dependencies": {
"@angular-devkit/core": "12.1.4",
"rxjs": "6.6.7"
},
"deprecated": false,
"description": "Angular Build Facade",
"engines": {
"node": "^12.14.1 || >=14.0.0",
"npm": "^6.11.0 || ^7.5.6",
"yarn": ">= 1.13.0"
},
"experimental": true,
"homepage": "https://github.com/angular/angular-cli",
"keywords": [
"angular",
"Angular CLI",
"devkit",
"sdk",
"Angular DevKit"
],
"license": "MIT",
"main": "src/index.js",
"name": "@angular-devkit/architect",
"repository": {
"type": "git",
"url": "git+https://github.com/angular/angular-cli.git"
},
"typings": "src/index.d.ts",
"version": "0.1201.4"
}

267
node_modules/@angular-devkit/architect/src/api.d.ts generated vendored Executable file
View file

@ -0,0 +1,267 @@
/**
* @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 { analytics, experimental, json, logging } from '@angular-devkit/core';
import { Observable, SubscribableOrPromise } from 'rxjs';
import { Schema as RealBuilderInput, Target as RealTarget } from './input-schema';
import { Schema as RealBuilderOutput } from './output-schema';
import { State as BuilderProgressState, Schema as RealBuilderProgress } from './progress-schema';
export declare type Target = json.JsonObject & RealTarget;
export { BuilderProgressState };
export declare type BuilderRegistry = experimental.jobs.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 declare 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 declare type BuilderInput = json.JsonObject & RealBuilderInput;
export declare type BuilderOutput = json.JsonObject & RealBuilderOutput;
export declare 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 declare 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 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;
/**
* API to report analytics. This might be undefined if the feature is unsupported. This might
* not be undefined, but the backend could also not report anything.
*/
readonly analytics: analytics.Analytics;
/**
* 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 declare type BuilderOutputLike = AsyncIterable<BuilderOutput> | SubscribableOrPromise<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 declare 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 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>;

98
node_modules/@angular-devkit/architect/src/api.js generated vendored Executable file
View 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.scheduleTargetAndForget = exports.targetFromTargetString = exports.targetStringFromTarget = exports.fromAsyncIterable = exports.isBuilderOutput = exports.BuilderProgressState = void 0;
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
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) {
var _a;
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 ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
}
}
/**
* 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 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 rxjs_1.from(context.scheduleTarget(target, overrides, scheduleOptions)).pipe(operators_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
node_modules/@angular-devkit/architect/src/architect.d.ts generated vendored Executable file
View 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 { analytics, experimental, json, logging } from '@angular-devkit/core';
import { Observable } from 'rxjs';
import { BuilderRun, Target } from './api';
import { ArchitectHost } from './internal';
export interface ScheduleOptions {
logger?: logging.Logger;
analytics?: analytics.Analytics;
}
export declare class Architect {
private _host;
private readonly _scheduler;
private readonly _jobCache;
private readonly _infoCache;
constructor(_host: ArchitectHost, registry?: json.schema.SchemaRegistry, additionalJobRegistry?: experimental.jobs.Registry);
has(name: experimental.jobs.JobName): Observable<boolean>;
scheduleBuilder(name: string, options: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>;
scheduleTarget(target: Target, overrides?: json.JsonObject, scheduleOptions?: ScheduleOptions): Promise<BuilderRun>;
}

283
node_modules/@angular-devkit/architect/src/architect.js generated vendored Executable file
View file

@ -0,0 +1,283 @@
"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 operators_1 = require("rxjs/operators");
const api_1 = require("./api");
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 ? `{${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(operators_1.concatMap((message) => {
if (message.kind === core_1.experimental.jobs.JobInboundMessageKind.Input) {
const v = message.value;
const options = {
...baseOptions,
...v.options,
};
// Validate v against the options schema.
return registry.compile(info.optionSchema).pipe(operators_1.concatMap((validation) => validation(options)), operators_1.map((validationResult) => {
const { data, success, errors } = validationResult;
if (success) {
return { ...v, options: data };
}
throw new core_1.json.schema.SchemaValidationException(errors);
}), operators_1.map((value) => ({ ...message, value })));
}
else {
return rxjs_1.of(message);
}
}),
// Using a share replay because the job might be synchronously sending input, but
// asynchronously listening to it.
operators_1.shareReplay(1));
// Make an inboundBus that completes instead of erroring out.
// We'll merge the errors into the output instead.
const inboundBus = rxjs_1.onErrorResumeNext(inboundBusWithInputValidation);
const output = rxjs_1.from(host.loadBuilder(info)).pipe(operators_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(operators_1.map((output) => {
if (output.kind === core_1.experimental.jobs.JobOutboundMessageKind.Output) {
// Add target to it.
return {
...output,
value: {
...output.value,
...(target ? { target } : 0),
},
};
}
else {
return output;
}
}));
}),
// Share subscriptions to the output, otherwise the the handler will be re-run.
operators_1.shareReplay());
// Separate the errors from the inbound bus into their own observable that completes when the
// builder output does.
const inboundBusErrors = inboundBusWithInputValidation.pipe(operators_1.ignoreElements(), operators_1.takeUntil(rxjs_1.onErrorResumeNext(output.pipe(operators_1.last()))));
// Return the builder output plus any input errors.
return rxjs_1.merge(inboundBusErrors, output);
}
return rxjs_1.of(Object.assign(handler, { jobDescription }));
}
/**
* A JobRegistry that resolves builder targets from the host.
*/
class ArchitectBuilderJobRegistry {
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 = rxjs_1.from(this._host.resolveBuilder(name)).pipe(operators_1.shareReplay(1));
cache.set(name, info);
return info;
}
return rxjs_1.from(this._host.resolveBuilder(name));
}
_createBuilder(info, target, options) {
const cache = this._jobCache;
if (target) {
const maybeHit = cache && cache.get(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(api_1.targetStringFromTarget(target), result.pipe(operators_1.shareReplay(1)));
}
else {
cache.set(info.builderName, result.pipe(operators_1.shareReplay(1)));
}
}
return result;
}
get(name) {
const m = name.match(/^([^:]+):([^:]+)$/i);
if (!m) {
return rxjs_1.of(null);
}
return rxjs_1.from(this._resolveBuilder(name)).pipe(operators_1.concatMap((builderInfo) => (builderInfo ? this._createBuilder(builderInfo) : rxjs_1.of(null))), operators_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 rxjs_1.of(null);
}
const target = {
project: m[1],
target: m[2],
configuration: m[3],
};
return rxjs_1.from(Promise.all([
this._host.getBuilderNameForTarget(target),
this._host.getOptionsForTarget(target),
])).pipe(operators_1.concatMap(([builderStr, options]) => {
if (builderStr === null || options === null) {
return rxjs_1.of(null);
}
return this._resolveBuilder(builderStr).pipe(operators_1.concatMap((builderInfo) => {
if (builderInfo === null) {
return rxjs_1.of(null);
}
return this._createBuilder(builderInfo, target, options);
}));
}), operators_1.first(null, null));
}
}
function _getTargetOptionsFactory(host) {
return core_1.experimental.jobs.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 core_1.experimental.jobs.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 core_1.experimental.jobs.createJobHandler(async (target) => {
const builderName = await host.getBuilderNameForTarget(target);
if (!builderName) {
throw new Error(`No builder were found for target ${api_1.targetStringFromTarget(target)}.`);
}
return builderName;
}, {
name: '..getBuilderNameForTarget',
output: { type: 'string' },
argument: inputSchema.properties.target,
});
}
function _validateOptionsFactory(host, registry) {
return core_1.experimental.jobs.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)}.`);
}
return registry
.compile(builderInfo.optionSchema)
.pipe(operators_1.concatMap((validation) => validation(options)), operators_1.switchMap(({ data, success, errors }) => {
if (success) {
return rxjs_1.of(data);
}
throw new core_1.json.schema.SchemaValidationException(errors);
}))
.toPromise();
}, {
name: '..validateOptions',
output: { type: 'object' },
argument: {
type: 'array',
items: [{ type: 'string' }, { type: 'object' }],
},
});
}
class Architect {
constructor(_host, registry = new core_1.json.schema.CoreSchemaRegistry(), additionalJobRegistry) {
this._host = _host;
this._jobCache = new Map();
this._infoCache = new Map();
const privateArchitectJobRegistry = new core_1.experimental.jobs.SimpleJobRegistry();
// Create private jobs.
privateArchitectJobRegistry.register(_getTargetOptionsFactory(_host));
privateArchitectJobRegistry.register(_getBuilderNameForTargetFactory(_host));
privateArchitectJobRegistry.register(_validateOptionsFactory(_host, registry));
privateArchitectJobRegistry.register(_getProjectMetadataFactory(_host));
const jobRegistry = new core_1.experimental.jobs.FallbackRegistry([
new ArchitectTargetJobRegistry(_host, registry, this._jobCache, this._infoCache),
new ArchitectBuilderJobRegistry(_host, registry, this._jobCache, this._infoCache),
privateArchitectJobRegistry,
...(additionalJobRegistry ? [additionalJobRegistry] : []),
]);
this._scheduler = new core_1.experimental.jobs.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 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(),
analytics: scheduleOptions.analytics,
});
}
scheduleTarget(target, overrides = {}, scheduleOptions = {}) {
return 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(),
analytics: scheduleOptions.analytics,
});
}
}
exports.Architect = Architect;

View file

@ -0,0 +1,30 @@
export interface Schema {
/**
* Link to schema.
*/
$schema?: string;
builders: {
[key: string]: Builder;
};
}
/**
* 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;
}

View 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 });

View 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"]
}
]
}
]
}
}
}

View 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>;

200
node_modules/@angular-devkit/architect/src/create-builder.js generated vendored Executable file
View file

@ -0,0 +1,200 @@
"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 operators_1 = require("rxjs/operators");
const api_1 = require("./api");
const internal_1 = require("./internal");
const schedule_by_name_1 = require("./schedule-by-name");
// eslint-disable-next-line max-lines-per-function
function createBuilder(fn) {
const cjh = core_1.experimental.jobs.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 analyticsChannel = context.createChannel('analytics');
let currentState = api_1.BuilderProgressState.Stopped;
const teardownLogics = [];
let tearingDown = false;
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 core_1.experimental.jobs.JobInboundMessageKind.Stop:
// Run teardown logic then complete.
tearingDown = true;
Promise.all(teardownLogics.map((fn) => fn() || Promise.resolve())).then(() => observer.complete(), (err) => observer.error(err));
break;
case core_1.experimental.jobs.JobInboundMessageKind.Input:
if (!tearingDown) {
onInput(i.value);
}
break;
}
});
function onInput(i) {
const builder = i.info;
const loggerName = i.target
? 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 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 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 scheduler
.schedule('..getTargetOptions', target)
.output.toPromise();
},
async getProjectMetadata(target) {
return scheduler
.schedule('..getProjectMetadata', target)
.output.toPromise();
},
async getBuilderNameForTarget(target) {
return scheduler
.schedule('..getBuilderNameForTarget', target)
.output.toPromise();
},
async validateOptions(options, builderName) {
return scheduler
.schedule('..validateOptions', [
builderName,
options,
])
.output.toPromise();
},
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);
}
},
analytics: new core_1.analytics.ForwardingAnalytics((report) => analyticsChannel.next(report)),
addTeardown(teardown) {
teardownLogics.push(teardown);
},
};
context.reportRunning();
let result;
try {
result = fn(i.options, context);
if (api_1.isBuilderOutput(result)) {
result = rxjs_1.of(result);
}
else if (!rxjs_1.isObservable(result) && isAsyncIterable(result)) {
result = api_1.fromAsyncIterable(result);
}
else {
result = rxjs_1.from(result);
}
}
catch (e) {
result = rxjs_1.throwError(e);
}
// Manage some state automatically.
progress({ state: api_1.BuilderProgressState.Running, current: 0, total: 1 }, context);
subscriptions.push(result
.pipe(operators_1.tap(() => {
progress({ state: api_1.BuilderProgressState.Running, current: total }, context);
progress({ state: api_1.BuilderProgressState.Stopped }, context);
}))
.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';
}

10
node_modules/@angular-devkit/architect/src/index.d.ts generated vendored Executable file
View 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
*/
export * from './api';
export { Architect, ScheduleOptions } from './architect';
export { createBuilder } from './create-builder';

25
node_modules/@angular-devkit/architect/src/index.js generated vendored Executable file
View 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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 });
exports.createBuilder = exports.Architect = void 0;
__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; } });

17
node_modules/@angular-devkit/architect/src/input-schema.d.ts generated vendored Executable file
View file

@ -0,0 +1,17 @@
export interface Schema {
currentDirectory: string;
id: number;
info: {
[key: string]: any;
};
options?: {
[key: string]: any;
};
target?: Target;
workspaceRoot: string;
}
export interface Target {
configuration?: string;
project: string;
target: string;
}

4
node_modules/@angular-devkit/architect/src/input-schema.js generated vendored Executable file
View 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
node_modules/@angular-devkit/architect/src/input-schema.json generated vendored Executable file
View 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"]
}

66
node_modules/@angular-devkit/architect/src/internal.d.ts generated vendored Executable file
View file

@ -0,0 +1,66 @@
/**
* @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 { experimental, json } from '@angular-devkit/core';
import { BuilderInfo, BuilderInput, BuilderOutput, Target } from './api';
/**
* 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 declare type BuilderJobHandler<A extends json.JsonObject = json.JsonObject, I extends BuilderInput = BuilderInput, O extends BuilderOutput = BuilderOutput> = experimental.jobs.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 experimental.jobs.JobDescription {
info: BuilderInfo;
}
/**
* A Builder instance. Use createBuilder() to create one of these.
*/
export interface Builder<OptionT extends json.JsonObject = json.JsonObject> {
handler: experimental.jobs.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
node_modules/@angular-devkit/architect/src/internal.js generated vendored Executable file
View 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');

View file

@ -0,0 +1,13 @@
export interface Schema {
error?: string;
info?: {
[key: string]: any;
};
success: boolean;
target?: Target;
}
export interface Target {
configuration?: string;
project?: string;
target?: string;
}

View 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 });

View 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"]
}

View file

@ -0,0 +1,20 @@
export interface Schema {
builder: {
[key: string]: any;
};
current?: number;
error?: any;
id: number;
state: State;
status?: string;
target?: {
[key: string]: any;
};
total?: number;
}
export declare enum State {
Error = "error",
Running = "running",
Stopped = "stopped",
Waiting = "waiting"
}

View 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 || (exports.State = {}));

View 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"]
}
]
}

View file

@ -0,0 +1,24 @@
/**
* @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 { analytics, experimental, json, logging } from '@angular-devkit/core';
import { BuilderRun, Target } from './api';
export declare function scheduleByName(name: string, buildOptions: json.JsonObject, options: {
target?: Target;
scheduler: experimental.jobs.Scheduler;
logger: logging.LoggerApi;
workspaceRoot: string | Promise<string>;
currentDirectory: string | Promise<string>;
analytics?: analytics.Analytics;
}): Promise<BuilderRun>;
export declare function scheduleByTarget(target: Target, overrides: json.JsonObject, options: {
scheduler: experimental.jobs.Scheduler;
logger: logging.LoggerApi;
workspaceRoot: string | Promise<string>;
currentDirectory: string | Promise<string>;
analytics?: analytics.Analytics;
}): Promise<BuilderRun>;

View 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
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.scheduleByTarget = exports.scheduleByName = void 0;
const core_1 = require("@angular-devkit/core");
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
const api_1 = require("./api");
const progressSchema = require('./progress-schema.json');
let _uniqueId = 0;
async function scheduleByName(name, buildOptions, options) {
const childLoggerName = options.target ? `{${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 job.description.toPromise();
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 !== core_1.experimental.jobs.JobState.Started) {
stateSubscription = job.outboundBus.subscribe((event) => {
if (event.kind === core_1.experimental.jobs.JobOutboundMessageKind.Start) {
job.input.next(message);
}
}, () => { });
}
else {
job.input.next(message);
}
const logChannelSub = job.getChannel('log').subscribe((entry) => {
logger.next(entry);
}, () => { });
const s = job.outboundBus.subscribe({
error() { },
complete() {
s.unsubscribe();
logChannelSub.unsubscribe();
if (stateSubscription) {
stateSubscription.unsubscribe();
}
},
});
const output = job.output.pipe(operators_1.map((output) => ({
...output,
...(options.target ? { target: options.target } : 0),
info,
})), operators_1.shareReplay());
// If there's an analytics object, take the job channel and report it to the analytics.
if (options.analytics) {
const reporter = new core_1.analytics.AnalyticsReporter(options.analytics);
job
.getChannel('analytics')
.subscribe((report) => reporter.report(report));
}
// Start the builder.
output.pipe(operators_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 output.pipe(operators_1.first()).toPromise();
},
output,
progress: job
.getChannel('progress', progressSchema)
.pipe(operators_1.shareReplay(1)),
stop() {
job.stop();
return job.outboundBus
.pipe(operators_1.ignoreElements(), operators_1.catchError(() => rxjs_1.EMPTY))
.toPromise();
},
};
}
exports.scheduleByName = scheduleByName;
async function scheduleByTarget(target, overrides, options) {
return scheduleByName(`{${api_1.targetStringFromTarget(target)}}`, overrides, {
...options,
target,
logger: options.logger,
});
}
exports.scheduleByTarget = scheduleByTarget;

View 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."
}
}
}

27
node_modules/@angular-devkit/architect/testing/BUILD.bazel generated vendored Executable file
View file

@ -0,0 +1,27 @@
# Copyright Google Inc. 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
load("//tools:defaults.bzl", "ts_library")
licenses(["notice"]) # MIT
package(default_visibility = ["//visibility:public"])
ts_library(
name = "testing",
srcs = glob(
include = ["**/*.ts"],
exclude = ["**/*_spec.ts"],
),
module_name = "@angular-devkit/architect/testing",
module_root = "index.d.ts",
deps = [
"//packages/angular_devkit/architect",
"//packages/angular_devkit/core",
"//packages/angular_devkit/core/node",
"@npm//@types/node",
"@npm//rxjs",
],
)

9
node_modules/@angular-devkit/architect/testing/index.d.ts generated vendored Executable file
View 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';

21
node_modules/@angular-devkit/architect/testing/index.js generated vendored Executable file
View file

@ -0,0 +1,21 @@
"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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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);

View file

@ -0,0 +1,33 @@
/**
* @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" />
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;
}

View 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");
const operators_1 = require("rxjs/operators");
/**
* @deprecated
*/
class TestProjectHost extends node_1.NodeJsSyncHost {
constructor(_templateRoot) {
super();
this._templateRoot = _templateRoot;
this._currentRoot = null;
this._scopedSyncHost = null;
}
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.
operators_1.concatMap((fragments) => rxjs_1.from(fragments)),
// Join the path with fragment.
operators_1.map((fragment) => core_1.join(path, fragment)),
// Emit directory content paths instead of the directory path.
operators_1.mergeMap((path) => this.isDirectory(path).pipe(operators_1.concatMap((isDir) => (isDir ? recursiveList(path) : rxjs_1.of(path))))));
// Find a unique folder that we can write to to use as current root.
return this.findUniqueFolderPath().pipe(
// Save the path and create a scoped host for it.
operators_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.
operators_1.concatMap(() => recursiveList(this._templateRoot)),
// Copy them over to the current root.
operators_1.concatMap((from) => {
const to = core_1.join(this.root(), core_1.relative(this._templateRoot, from));
return this.read(from).pipe(operators_1.concatMap((buffer) => this.write(to, buffer)));
}), operators_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(operators_1.delay(50), operators_1.concatMap((exists) => (exists ? this.delete(this.root()) : rxjs_1.EMPTY)), operators_1.retry(10), operators_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(core_1.normalize(fileName), content);
});
}
replaceInFile(path, match, replacement) {
const content = core_1.virtualFs.fileBufferToString(this.scopedSync().read(core_1.normalize(path)));
this.scopedSync().write(core_1.normalize(path), core_1.virtualFs.stringToFileBuffer(content.replace(match, replacement)));
}
appendToFile(path, str) {
const content = core_1.virtualFs.fileBufferToString(this.scopedSync().read(core_1.normalize(path)));
this.scopedSync().write(core_1.normalize(path), core_1.virtualFs.stringToFileBuffer(content.concat(str)));
}
fileMatchExists(dir, regex) {
const [fileName] = this.scopedSync()
.list(core_1.normalize(dir))
.filter((name) => name.match(regex));
return fileName || undefined;
}
copyFile(from, to) {
const content = this.scopedSync().read(core_1.normalize(from));
this.scopedSync().write(core_1.normalize(to), content);
}
findUniqueFolderPath() {
// 11 character alphanumeric string.
const randomString = Math.random().toString(36).slice(2);
const newFolderName = `test-project-host-${core_1.basename(this._templateRoot)}-${randomString}`;
const newFolderPath = core_1.join(core_1.dirname(this._templateRoot), newFolderName);
return this.exists(newFolderPath).pipe(operators_1.concatMap((exists) => (exists ? this.findUniqueFolderPath() : rxjs_1.of(newFolderPath))));
}
}
exports.TestProjectHost = TestProjectHost;

View 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>;
}

View file

@ -0,0 +1,119 @@
"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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 {
/**
* 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;
this._builderImportMap = new Map();
this._builderMap = new Map();
this._targetMap = new Map();
}
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().then(() => __importStar(require(packageName + '/package.json')));
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().then(() => __importStar(require(builderJsonPath)));
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().then(() => __importStar(require(builderJsonPath + '/../' + b.implementation)))).default;
const optionsSchema = await Promise.resolve().then(() => __importStar(require(builderJsonPath + '/../' + b.schema)));
this.addBuilder(`${packageJson.name}:${builderName}`, handler, b.description, optionsSchema);
}
}
addTarget(target, builderName, options = {}) {
this._targetMap.set(src_1.targetStringFromTarget(target), { builderName, options });
}
async getBuilderNameForTarget(target) {
const name = 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 = 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
node_modules/@angular-devkit/build-angular/LICENSE generated vendored Executable file
View 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.

21
node_modules/@angular-devkit/build-angular/README.md generated vendored Executable file
View file

@ -0,0 +1,21 @@
# @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 |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| app-shell | Build an Angular [App shell](https://angular.io/guide/app-shell). |
| browser | Build an Angular application targeting a browser environment. |
| 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://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview) format using [ng-packagr](https://github.com/ng-packagr/ng-packagr). |
| server | Build an Angular application targeting a [Node.js](https://nodejs.org) environment. |
| protractor | **Deprecated** - Run end-to-end tests using [Protractor](https://www.protractortest.org/) framework. |
| tslint | **Deprecated** - Statically analyze [TypeScript](https://www.typescriptlang.org/) files using [TSLint](https://palantir.github.io/tslint/). |
## 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.

50
node_modules/@angular-devkit/build-angular/builders.json generated vendored Executable file
View file

@ -0,0 +1,50 @@
{
"$schema": "../architect/src/builders-schema.json",
"builders": {
"app-shell": {
"implementation": "./src/app-shell",
"schema": "./src/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/browser",
"schema": "./src/browser/schema.json",
"description": "Build a browser application."
},
"dev-server": {
"implementation": "./src/dev-server",
"schema": "./src/dev-server/schema.json",
"description": "Serve a browser application."
},
"extract-i18n": {
"implementation": "./src/extract-i18n",
"schema": "./src/extract-i18n/schema.json",
"description": "Extract i18n strings from a browser application."
},
"karma": {
"implementation": "./src/karma",
"schema": "./src/karma/schema.json",
"description": "Run Karma unit tests."
},
"protractor": {
"implementation": "./src/protractor",
"schema": "./src/protractor/schema.json",
"description": "Run protractor over a dev server."
},
"tslint": {
"implementation": "./src/tslint",
"schema": "./src/tslint/schema.json",
"description": "Run tslint over a TypeScript project."
},
"server": {
"implementation": "./src/server",
"schema": "./src/server/schema.json",
"description": "Build a server Angular application."
},
"ng-packagr": {
"implementation": "./src/ng-packagr",
"schema": "./src/ng-packagr/schema.json",
"description": "Build a library with ng-packagr."
}
}
}

View file

@ -0,0 +1,15 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

View file

@ -0,0 +1,12 @@
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

View file

@ -0,0 +1,164 @@
# tslib
This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
This library is primarily used by the `--importHelpers` flag in TypeScript.
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
```ts
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
exports.x = {};
exports.y = __assign({}, exports.x);
```
will instead be emitted as something like the following:
```ts
var tslib_1 = require("tslib");
exports.x = {};
exports.y = tslib_1.__assign({}, exports.x);
```
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
# Installing
For the latest stable version, run:
## npm
```sh
# TypeScript 3.9.2 or later
npm install tslib
# TypeScript 3.8.4 or earlier
npm install tslib@^1
# TypeScript 2.3.2 or earlier
npm install tslib@1.6.1
```
## yarn
```sh
# TypeScript 3.9.2 or later
yarn add tslib
# TypeScript 3.8.4 or earlier
yarn add tslib@^1
# TypeScript 2.3.2 or earlier
yarn add tslib@1.6.1
```
## bower
```sh
# TypeScript 3.9.2 or later
bower install tslib
# TypeScript 3.8.4 or earlier
bower install tslib@^1
# TypeScript 2.3.2 or earlier
bower install tslib@1.6.1
```
## JSPM
```sh
# TypeScript 3.9.2 or later
jspm install tslib
# TypeScript 3.8.4 or earlier
jspm install tslib@^1
# TypeScript 2.3.2 or earlier
jspm install tslib@1.6.1
```
# Usage
Set the `importHelpers` compiler option on the command line:
```
tsc --importHelpers file.ts
```
or in your tsconfig.json:
```json
{
"compilerOptions": {
"importHelpers": true
}
}
```
#### For bower and JSPM users
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
```json
{
"compilerOptions": {
"module": "amd",
"importHelpers": true,
"baseUrl": "./",
"paths": {
"tslib" : ["bower_components/tslib/tslib.d.ts"]
}
}
}
```
For JSPM users:
```json
{
"compilerOptions": {
"module": "system",
"importHelpers": true,
"baseUrl": "./",
"paths": {
"tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"]
}
}
}
```
## Deployment
- Choose your new version number
- Set it in `package.json` and `bower.json`
- Create a tag: `git tag [version]`
- Push the tag: `git push --tags`
- Create a [release in GitHub](https://github.com/microsoft/tslib/releases)
- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow
Done.
# Contribute
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
# Documentation
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
* [Programming handbook](http://www.typescriptlang.org/Handbook)
* [Homepage](http://www.typescriptlang.org/)

View file

@ -0,0 +1,53 @@
import tslib from '../tslib.js';
const {
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
} = tslib;
export {
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
};

View file

@ -0,0 +1,3 @@
{
"type": "module"
}

View file

@ -0,0 +1,64 @@
{
"_from": "tslib@2.3.0",
"_id": "tslib@2.3.0",
"_inBundle": false,
"_integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==",
"_location": "/@angular-devkit/build-angular/tslib",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "tslib@2.3.0",
"name": "tslib",
"escapedName": "tslib",
"rawSpec": "2.3.0",
"saveSpec": null,
"fetchSpec": "2.3.0"
},
"_requiredBy": [
"/@angular-devkit/build-angular"
],
"_resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"_shasum": "803b8cdab3e12ba581a4ca41c8839bbb0dacb09e",
"_spec": "tslib@2.3.0",
"_where": "/home/jack/Documents/JDA/m14/projecte_janmaroto/node_modules/@angular-devkit/build-angular",
"author": {
"name": "Microsoft Corp."
},
"bugs": {
"url": "https://github.com/Microsoft/TypeScript/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Runtime library for TypeScript helper functions",
"exports": {
".": {
"module": "./tslib.es6.js",
"import": "./modules/index.js",
"default": "./tslib.js"
},
"./": "./"
},
"homepage": "https://www.typescriptlang.org/",
"jsnext:main": "tslib.es6.js",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript",
"tslib",
"runtime"
],
"license": "0BSD",
"main": "tslib.js",
"module": "tslib.es6.js",
"name": "tslib",
"repository": {
"type": "git",
"url": "git+https://github.com/Microsoft/tslib.git"
},
"sideEffects": false,
"typings": "tslib.d.ts",
"version": "2.3.0"
}

View file

@ -0,0 +1,130 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
export declare function __extends(d: Function, b: Function): void;
export declare function __assign(t: any, ...sources: any[]): any;
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
export declare function __param(paramIndex: number, decorator: Function): Function;
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
export declare function __generator(thisArg: any, body: Function): any;
export declare function __exportStar(m: any, o: any): void;
export declare function __values(o: any): any;
export declare function __read(o: any, n?: number): any[];
/** @deprecated since TypeScript 4.2 */
export declare function __spread(...args: any[][]): any[];
/** @deprecated since TypeScript 4.2 */
export declare function __spreadArrays(...args: any[][]): any[];
export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[];
export declare function __await(v: any): any;
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
export declare function __asyncDelegator(o: any): any;
export declare function __asyncValues(o: any): any;
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
export declare function __importStar<T>(mod: T): T;
export declare function __importDefault<T>(mod: T): T | { default: T };
/**
* Reading from a private instance field
*/
export declare function __classPrivateFieldGet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean, get(o: T): V | undefined },
kind?: "f"
): V;
/**
* Reading from a private static field
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
kind: "f",
f: { value: V }
): V;
/**
* Reading from a private instance get accessor
*/
export declare function __classPrivateFieldGet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean },
kind: "a",
f: () => V
): V;
/**
* Reading from a private static get accessor
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
kind: "a",
f: () => V
): V;
/**
* Reading from a private instance method
*/
export declare function __classPrivateFieldGet<T extends object, V extends (...args: any[]) => unknown>(
receiver: T,
state: { has(o: T): boolean },
kind: "m",
f: V
): V;
/**
* Reading from a private static method
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V extends (...args: any[]) => unknown>(
receiver: T,
state: T,
kind: "m",
f: V
): V;
/**
* Writing to a private instance field
*/
export declare function __classPrivateFieldSet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean, set(o: T, value: V): unknown },
value: V,
kind?: "f"
): V;
/**
* Writing to a private static field
*/
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
value: V,
kind: "f",
f: { value: V }
): V;
/**
* Writing to a private instance set accessor
*/
export declare function __classPrivateFieldSet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean },
value: V,
kind: "a",
f: (v: V) => void
): V;
/**
* Writing to a private static set accessor
*/
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
value: V,
kind: "a",
f: (v: V) => void
): V;
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;

View file

@ -0,0 +1 @@
<script src="tslib.es6.js"></script>

View file

@ -0,0 +1,239 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
export function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
export var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
export function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
export function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
export function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
export function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
export function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
export function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
export var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
export function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
export function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
export function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
export function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
export function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
export function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || from);
}
export function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
export function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
export function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
export function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
export function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
export function __importStar(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;
}
export function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
export function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}

View file

@ -0,0 +1 @@
<script src="tslib.js"></script>

View file

@ -0,0 +1,306 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global global, define, System, Reflect, Promise */
var __extends;
var __assign;
var __rest;
var __decorate;
var __param;
var __metadata;
var __awaiter;
var __generator;
var __exportStar;
var __values;
var __read;
var __spread;
var __spreadArrays;
var __spreadArray;
var __await;
var __asyncGenerator;
var __asyncDelegator;
var __asyncValues;
var __makeTemplateObject;
var __importStar;
var __importDefault;
var __classPrivateFieldGet;
var __classPrivateFieldSet;
var __createBinding;
(function (factory) {
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
if (typeof define === "function" && define.amd) {
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
}
else if (typeof module === "object" && typeof module.exports === "object") {
factory(createExporter(root, createExporter(module.exports)));
}
else {
factory(createExporter(root));
}
function createExporter(exports, previous) {
if (exports !== root) {
if (typeof Object.create === "function") {
Object.defineProperty(exports, "__esModule", { value: true });
}
else {
exports.__esModule = true;
}
}
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
}
})
(function (exporter) {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
__extends = function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
__assign = Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
__rest = function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
__decorate = function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param = function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
__metadata = function (metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
};
__awaiter = function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
__generator = function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
__exportStar = function(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
};
__createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
__values = function (o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
__read = function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
/** @deprecated */
__spread = function () {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
};
/** @deprecated */
__spreadArrays = function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
__spreadArray = function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || from);
};
__await = function (v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
};
__asyncGenerator = function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
__asyncDelegator = function (o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
};
__asyncValues = function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
__makeTemplateObject = function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
__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;
};
__importDefault = function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
__classPrivateFieldGet = function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
__classPrivateFieldSet = function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
exporter("__extends", __extends);
exporter("__assign", __assign);
exporter("__rest", __rest);
exporter("__decorate", __decorate);
exporter("__param", __param);
exporter("__metadata", __metadata);
exporter("__awaiter", __awaiter);
exporter("__generator", __generator);
exporter("__exportStar", __exportStar);
exporter("__createBinding", __createBinding);
exporter("__values", __values);
exporter("__read", __read);
exporter("__spread", __spread);
exporter("__spreadArrays", __spreadArrays);
exporter("__spreadArray", __spreadArray);
exporter("__await", __await);
exporter("__asyncGenerator", __asyncGenerator);
exporter("__asyncDelegator", __asyncDelegator);
exporter("__asyncValues", __asyncValues);
exporter("__makeTemplateObject", __makeTemplateObject);
exporter("__importStar", __importStar);
exporter("__importDefault", __importDefault);
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
});

163
node_modules/@angular-devkit/build-angular/package.json generated vendored Executable file
View file

@ -0,0 +1,163 @@
{
"_from": "@angular-devkit/build-angular@~12.1.1",
"_id": "@angular-devkit/build-angular@12.1.4",
"_inBundle": false,
"_integrity": "sha512-9kMdnaU2dr8o7gJpuBsEHLUpa6huF8uZQEd1+jhKfByEY/xTQo8qztvmbhFhrSfDvdYRygNHItpt3pYEoCEOig==",
"_location": "/@angular-devkit/build-angular",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@angular-devkit/build-angular@~12.1.1",
"name": "@angular-devkit/build-angular",
"escapedName": "@angular-devkit%2fbuild-angular",
"scope": "@angular-devkit",
"rawSpec": "~12.1.1",
"saveSpec": null,
"fetchSpec": "~12.1.1"
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-12.1.4.tgz",
"_shasum": "3af88acb0a7e2fadd418103f6b5bb0b40c60b670",
"_spec": "@angular-devkit/build-angular@~12.1.1",
"_where": "/home/jack/Documents/JDA/m14/projecte_janmaroto",
"author": {
"name": "Angular Authors"
},
"bugs": {
"url": "https://github.com/angular/angular-cli/issues"
},
"builders": "builders.json",
"bundleDependencies": false,
"dependencies": {
"@angular-devkit/architect": "0.1201.4",
"@angular-devkit/build-optimizer": "0.1201.4",
"@angular-devkit/build-webpack": "0.1201.4",
"@angular-devkit/core": "12.1.4",
"@babel/core": "7.14.6",
"@babel/generator": "7.14.5",
"@babel/helper-annotate-as-pure": "7.14.5",
"@babel/plugin-proposal-async-generator-functions": "7.14.7",
"@babel/plugin-transform-async-to-generator": "7.14.5",
"@babel/plugin-transform-runtime": "7.14.5",
"@babel/preset-env": "7.14.7",
"@babel/runtime": "7.14.6",
"@babel/template": "7.14.5",
"@discoveryjs/json-ext": "0.5.3",
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
"@ngtools/webpack": "12.1.4",
"ansi-colors": "4.1.1",
"babel-loader": "8.2.2",
"browserslist": "^4.9.1",
"cacache": "15.2.0",
"caniuse-lite": "^1.0.30001032",
"circular-dependency-plugin": "5.2.2",
"copy-webpack-plugin": "9.0.0",
"core-js": "3.15.1",
"critters": "0.0.10",
"css-loader": "5.2.6",
"css-minimizer-webpack-plugin": "3.0.1",
"find-cache-dir": "3.3.1",
"glob": "7.1.7",
"https-proxy-agent": "5.0.0",
"inquirer": "8.1.1",
"jest-worker": "27.0.2",
"karma-source-map-support": "1.4.0",
"less": "4.1.1",
"less-loader": "10.0.0",
"license-webpack-plugin": "2.3.20",
"loader-utils": "2.0.0",
"mini-css-extract-plugin": "1.6.2",
"minimatch": "3.0.4",
"open": "8.2.1",
"ora": "5.4.1",
"parse5-html-rewriting-stream": "6.0.1",
"postcss": "8.3.5",
"postcss-import": "14.0.2",
"postcss-loader": "6.1.0",
"postcss-preset-env": "6.7.0",
"raw-loader": "4.0.2",
"regenerator-runtime": "0.13.7",
"resolve-url-loader": "4.0.0",
"rxjs": "6.6.7",
"sass": "1.35.1",
"sass-loader": "12.1.0",
"semver": "7.3.5",
"source-map": "0.7.3",
"source-map-loader": "3.0.0",
"source-map-support": "0.5.19",
"style-loader": "2.0.0",
"stylus": "0.54.8",
"stylus-loader": "6.1.0",
"terser": "5.7.0",
"terser-webpack-plugin": "5.1.3",
"text-table": "0.2.0",
"tree-kill": "1.2.2",
"tslib": "2.3.0",
"webpack": "5.44.0",
"webpack-dev-middleware": "5.0.0",
"webpack-dev-server": "3.11.2",
"webpack-merge": "5.8.0",
"webpack-subresource-integrity": "1.5.2"
},
"deprecated": false,
"description": "Angular Webpack Build Facade",
"engines": {
"node": "^12.14.1 || >=14.0.0",
"npm": "^6.11.0 || ^7.5.6",
"yarn": ">= 1.13.0"
},
"homepage": "https://github.com/angular/angular-cli",
"keywords": [
"angular",
"Angular CLI",
"devkit",
"sdk",
"Angular DevKit"
],
"license": "MIT",
"main": "src/index.js",
"name": "@angular-devkit/build-angular",
"peerDependencies": {
"@angular/compiler-cli": "^12.0.0 || ^12.1.0-next",
"@angular/localize": "^12.0.0 || ^12.1.0-next",
"@angular/service-worker": "^12.0.0 || ^12.1.0-next",
"karma": "^6.3.0",
"ng-packagr": "^12.0.0 || ^12.1.0-next",
"protractor": "^7.0.0",
"tailwindcss": "^2.0.0",
"tslint": "^6.1.0",
"typescript": "~4.2.3 || ~4.3.2"
},
"peerDependenciesMeta": {
"@angular/localize": {
"optional": true
},
"@angular/service-worker": {
"optional": true
},
"karma": {
"optional": true
},
"ng-packagr": {
"optional": true
},
"protractor": {
"optional": true
},
"tailwindcss": {
"optional": true
},
"tslint": {
"optional": true
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/angular/angular-cli.git"
},
"typings": "src/index.d.ts",
"version": "12.1.4"
}

View 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
*/

View 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/webpack/plugins/karma/karma');

View 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("@angular-devkit/architect/src/internal").Builder<JsonObject & BuildWebpackAppShellSchema>;
export default _default;

View file

@ -0,0 +1,157 @@
"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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 });
const architect_1 = require("@angular-devkit/architect");
const core_1 = require("@angular-devkit/core");
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const utils_1 = require("../utils");
const inline_critical_css_1 = require("../utils/index-file/inline-critical-css");
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 = architect_1.targetFromTargetString(options.browserTarget);
const rawBrowserOptions = (await context.getTargetOptions(browserTarget));
const browserBuilderName = await context.getBuilderNameForTarget(browserTarget);
const browserOptions = await context.validateOptions(rawBrowserOptions, browserBuilderName);
// Initialize zone.js
const root = context.workspaceRoot;
const zonePackage = require.resolve('zone.js', { paths: [root] });
await Promise.resolve().then(() => __importStar(require(zonePackage)));
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 = core_1.resolve(core_1.normalize(root), core_1.normalize(projectMetadata.root || ''));
const { styles } = utils_1.normalizeOptimization(browserOptions.optimization);
const inlineCriticalCssProcessor = styles.inlineCritical
? new inline_critical_css_1.InlineCriticalCssProcessor({
minify: styles.minify,
deployUrl: browserOptions.deployUrl,
})
: undefined;
for (const outputPath of browserResult.outputPaths) {
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);
const { AppServerModule, renderModule } = await Promise.resolve().then(() => __importStar(require(serverBundlePath)));
const renderModuleFn = renderModule;
if (!(renderModuleFn && AppServerModule)) {
throw new Error(`renderModule method and/or AppServerModule were not exported from: ${serverBundlePath}.`);
}
// Load platform server module renderer
const renderOpts = {
document: indexHtml,
url: options.route,
};
let html = await renderModuleFn(AppServerModule, renderOpts);
// 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 service_worker_1.augmentAppWithServiceWorker(core_1.normalize(root), projectRoot, core_1.normalize(outputPath), browserOptions.baseHref || '/', browserOptions.ngswConfigPath);
}
}
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]{20}\.)?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 = architect_1.targetFromTargetString(options.browserTarget);
const serverTarget = 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 = utils_1.normalizeOptimization(browserOptions.optimization);
optimization.styles.inlineCritical = false;
const browserTargetRun = await context.scheduleTarget(browserTarget, {
watch: false,
serviceWorker: false,
optimization: optimization,
});
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 === null || spinner === void 0 ? void 0 : spinner.fail('Application shell generation failed.');
return { success: false, error: err.message };
}
finally {
await Promise.all([browserTargetRun.stop(), serverTargetRun.stop()]);
}
}
exports.default = architect_1.createBuilder(_appShellBuilder);

View 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 app 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 app 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;
}

View 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 });

View 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 app 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 app 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"]
}

View 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
*/
/* 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';
}
declare module '@babel/traverse' {
export { default } from '@types/babel__traverse';
}
declare module '@babel/template' {
export { default } from '@types/babel__template';
}

View 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
*/
declare module 'babel-loader' {
type BabelLoaderCustomizer<T> = (
babel: typeof import('@babel/core'),
) => {
customOptions?(
this: import('webpack').loader.LoaderContext,
loaderOptions: Record<string, unknown>,
loaderArguments: { source: string; map?: unknown },
): Promise<{ custom?: T; loader: Record<string, unknown> }>;
config?(
this: import('webpack').loader.LoaderContext,
configuration: import('@babel/core').PartialConfig,
loaderArguments: { source: string; map?: unknown; customOptions: T },
): import('@babel/core').TransformOptions;
};
function custom<T>(customizer: BabelLoaderCustomizer<T>): import('webpack').loader.Loader;
}

View 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 { PluginObj } from '@babel/core';
/**
* Provides one or more keywords that if found within the content of a source file indicate
* that this plugin should be used with a source file.
*
* @returns An a string iterable containing one or more keywords.
*/
export declare function getKeywords(): Iterable<string>;
/**
* A babel plugin factory function for adjusting classes; primarily with Angular metadata.
* The adjustments include wrapping classes with known safe or no side effects with pure
* annotations to support dead code removal of unused classes. Angular compiler generated
* metadata static fields not required in AOT mode are also elided to better support bundler-
* level treeshaking.
*
* @returns A babel plugin object instance.
*/
export default function (): PluginObj;

View file

@ -0,0 +1,272 @@
"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.getKeywords = void 0;
const core_1 = require("@babel/core");
const helper_annotate_as_pure_1 = __importDefault(require("@babel/helper-annotate-as-pure"));
/**
* The name of the Typescript decorator helper function created by the TypeScript compiler.
*/
const TSLIB_DECORATE_HELPER_NAME = '__decorate';
/**
* The set of Angular static fields that should always be wrapped.
* These fields may appear to have side effects but are safe to remove if the associated class
* is otherwise unused within the output.
*/
const angularStaticsToWrap = new Set([
'ɵcmp',
'ɵdir',
'ɵfac',
'ɵinj',
'ɵmod',
'ɵpipe',
'ɵprov',
'INJECTOR_KEY',
]);
/**
* An object map of static fields and related value checks for discovery of Angular generated
* JIT related static fields.
*/
const angularStaticsToElide = {
'ctorParameters'(path) {
return path.isFunctionExpression() || path.isArrowFunctionExpression();
},
'decorators'(path) {
return path.isArrayExpression();
},
'propDecorators'(path) {
return path.isObjectExpression();
},
};
/**
* Provides one or more keywords that if found within the content of a source file indicate
* that this plugin should be used with a source file.
*
* @returns An a string iterable containing one or more keywords.
*/
function getKeywords() {
return ['class'];
}
exports.getKeywords = getKeywords;
/**
* Determines whether a property and its initializer value can be safely wrapped in a pure
* annotated IIFE. Values that may cause side effects are not considered safe to wrap.
* Wrapping such values may cause runtime errors and/or incorrect runtime behavior.
*
* @param propertyName The name of the property to analyze.
* @param assignmentValue The initializer value that will be assigned to the property.
* @returns If the property can be safely wrapped, then true; otherwise, false.
*/
function canWrapProperty(propertyName, assignmentValue) {
if (angularStaticsToWrap.has(propertyName)) {
return true;
}
const { leadingComments } = assignmentValue.node;
if (leadingComments === null || leadingComments === void 0 ? void 0 : leadingComments.some(
// `@pureOrBreakMyCode` is used by closure and is present in Angular code
({ value }) => value.includes('#__PURE__') || value.includes('@pureOrBreakMyCode'))) {
return true;
}
return assignmentValue.isPure();
}
/**
* Analyze the sibling nodes of a class to determine if any downlevel elements should be
* wrapped in a pure annotated IIFE. Also determines if any elements have potential side
* effects.
*
* @param origin The starting NodePath location for analyzing siblings.
* @param classIdentifier The identifier node that represents the name of the class.
* @param allowWrappingDecorators Whether to allow decorators to be wrapped.
* @returns An object containing the results of the analysis.
*/
function analyzeClassSiblings(origin, classIdentifier, allowWrappingDecorators) {
var _a;
const wrapStatementPaths = [];
let hasPotentialSideEffects = false;
for (let i = 1;; ++i) {
const nextStatement = origin.getSibling(+origin.key + i);
if (!nextStatement.isExpressionStatement()) {
break;
}
// Valid sibling statements for class declarations are only assignment expressions
// and TypeScript decorator helper call expressions
const nextExpression = nextStatement.get('expression');
if (nextExpression.isCallExpression()) {
if (!core_1.types.isIdentifier(nextExpression.node.callee) ||
nextExpression.node.callee.name !== TSLIB_DECORATE_HELPER_NAME) {
break;
}
if (allowWrappingDecorators) {
wrapStatementPaths.push(nextStatement);
}
else {
// Statement cannot be safely wrapped which makes wrapping the class unneeded.
// The statement will prevent even a wrapped class from being optimized away.
hasPotentialSideEffects = true;
}
continue;
}
else if (!nextExpression.isAssignmentExpression()) {
break;
}
// Valid assignment expressions should be member access expressions using the class
// name as the object and an identifier as the property for static fields or only
// the class name for decorators.
const left = nextExpression.get('left');
if (left.isIdentifier()) {
if (!left.scope.bindingIdentifierEquals(left.node.name, classIdentifier) ||
!core_1.types.isCallExpression(nextExpression.node.right) ||
!core_1.types.isIdentifier(nextExpression.node.right.callee) ||
nextExpression.node.right.callee.name !== TSLIB_DECORATE_HELPER_NAME) {
break;
}
if (allowWrappingDecorators) {
wrapStatementPaths.push(nextStatement);
}
else {
// Statement cannot be safely wrapped which makes wrapping the class unneeded.
// The statement will prevent even a wrapped class from being optimized away.
hasPotentialSideEffects = true;
}
continue;
}
else if (!left.isMemberExpression() ||
!core_1.types.isIdentifier(left.node.object) ||
!left.scope.bindingIdentifierEquals(left.node.object.name, classIdentifier) ||
!core_1.types.isIdentifier(left.node.property)) {
break;
}
const propertyName = left.node.property.name;
const assignmentValue = nextExpression.get('right');
if ((_a = angularStaticsToElide[propertyName]) === null || _a === void 0 ? void 0 : _a.call(angularStaticsToElide, assignmentValue)) {
nextStatement.remove();
--i;
}
else if (canWrapProperty(propertyName, assignmentValue)) {
wrapStatementPaths.push(nextStatement);
}
else {
// Statement cannot be safely wrapped which makes wrapping the class unneeded.
// The statement will prevent even a wrapped class from being optimized away.
hasPotentialSideEffects = true;
}
}
return { hasPotentialSideEffects, wrapStatementPaths };
}
/**
* The set of classed already visited and analyzed during the plugin's execution.
* This is used to prevent adjusted classes from being repeatedly analyzed which can lead
* to an infinite loop.
*/
const visitedClasses = new WeakSet();
/**
* A babel plugin factory function for adjusting classes; primarily with Angular metadata.
* The adjustments include wrapping classes with known safe or no side effects with pure
* annotations to support dead code removal of unused classes. Angular compiler generated
* metadata static fields not required in AOT mode are also elided to better support bundler-
* level treeshaking.
*
* @returns A babel plugin object instance.
*/
function default_1() {
return {
visitor: {
ClassDeclaration(path, state) {
const { node: classNode, parentPath } = path;
const { wrapDecorators } = state.opts;
if (visitedClasses.has(classNode)) {
return;
}
// Analyze sibling statements for elements of the class that were downleveled
const hasExport = parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration();
const origin = hasExport ? parentPath : path;
const { wrapStatementPaths, hasPotentialSideEffects } = analyzeClassSiblings(origin, classNode.id, wrapDecorators);
visitedClasses.add(classNode);
if (hasPotentialSideEffects || wrapStatementPaths.length === 0) {
return;
}
const wrapStatementNodes = [];
for (const statementPath of wrapStatementPaths) {
wrapStatementNodes.push(statementPath.node);
statementPath.remove();
}
// Wrap class and safe static assignments in a pure annotated IIFE
const container = core_1.types.arrowFunctionExpression([], core_1.types.blockStatement([
classNode,
...wrapStatementNodes,
core_1.types.returnStatement(core_1.types.cloneNode(classNode.id)),
]));
const replacementInitializer = core_1.types.callExpression(core_1.types.parenthesizedExpression(container), []);
helper_annotate_as_pure_1.default(replacementInitializer);
// Replace class with IIFE wrapped class
const declaration = core_1.types.variableDeclaration('let', [
core_1.types.variableDeclarator(core_1.types.cloneNode(classNode.id), replacementInitializer),
]);
if (parentPath.isExportDefaultDeclaration()) {
// When converted to a variable declaration, the default export must be moved
// to a subsequent statement to prevent a JavaScript syntax error.
parentPath.replaceWithMultiple([
declaration,
core_1.types.exportNamedDeclaration(undefined, [
core_1.types.exportSpecifier(core_1.types.cloneNode(classNode.id), core_1.types.identifier('default')),
]),
]);
}
else {
path.replaceWith(declaration);
}
},
ClassExpression(path, state) {
const { node: classNode, parentPath } = path;
const { wrapDecorators } = state.opts;
// Class expressions are used by TypeScript to represent downlevel class/constructor decorators.
// If not wrapping decorators, they do not need to be processed.
if (!wrapDecorators || visitedClasses.has(classNode)) {
return;
}
if (!classNode.id ||
!parentPath.isVariableDeclarator() ||
!core_1.types.isIdentifier(parentPath.node.id) ||
parentPath.node.id.name !== classNode.id.name) {
return;
}
const origin = parentPath.parentPath;
if (!origin.isVariableDeclaration() || origin.node.declarations.length !== 1) {
return;
}
const { wrapStatementPaths, hasPotentialSideEffects } = analyzeClassSiblings(origin, parentPath.node.id, wrapDecorators);
visitedClasses.add(classNode);
if (hasPotentialSideEffects || wrapStatementPaths.length === 0) {
return;
}
const wrapStatementNodes = [];
for (const statementPath of wrapStatementPaths) {
wrapStatementNodes.push(statementPath.node);
statementPath.remove();
}
// Wrap class and safe static assignments in a pure annotated IIFE
const container = core_1.types.arrowFunctionExpression([], core_1.types.blockStatement([
core_1.types.variableDeclaration('let', [
core_1.types.variableDeclarator(core_1.types.cloneNode(classNode.id), classNode),
]),
...wrapStatementNodes,
core_1.types.returnStatement(core_1.types.cloneNode(classNode.id)),
]));
const replacementInitializer = core_1.types.callExpression(core_1.types.parenthesizedExpression(container), []);
helper_annotate_as_pure_1.default(replacementInitializer);
// Add the wrapped class directly to the variable declaration
parentPath.get('init').replaceWith(replacementInitializer);
},
},
};
}
exports.default = default_1;

View file

@ -0,0 +1,21 @@
/**
* @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 { PluginObj } from '@babel/core';
/**
* Provides one or more keywords that if found within the content of a source file indicate
* that this plugin should be used with a source file.
*
* @returns An a string iterable containing one or more keywords.
*/
export declare function getKeywords(): Iterable<string>;
/**
* A babel plugin factory function for adjusting TypeScript emitted enums.
*
* @returns A babel plugin object instance.
*/
export default function (): PluginObj;

View file

@ -0,0 +1,123 @@
"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.getKeywords = void 0;
const core_1 = require("@babel/core");
const helper_annotate_as_pure_1 = __importDefault(require("@babel/helper-annotate-as-pure"));
/**
* Provides one or more keywords that if found within the content of a source file indicate
* that this plugin should be used with a source file.
*
* @returns An a string iterable containing one or more keywords.
*/
function getKeywords() {
return ['var'];
}
exports.getKeywords = getKeywords;
/**
* A babel plugin factory function for adjusting TypeScript emitted enums.
*
* @returns A babel plugin object instance.
*/
function default_1() {
return {
visitor: {
VariableDeclaration(path, state) {
const { parentPath, node } = path;
const { loose } = state.opts;
if (node.kind !== 'var' || node.declarations.length !== 1) {
return;
}
const declaration = path.get('declarations')[0];
if (declaration.node.init) {
return;
}
const declarationId = declaration.node.id;
if (!core_1.types.isIdentifier(declarationId)) {
return;
}
const hasExport = parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration();
const origin = hasExport ? parentPath : path;
const nextStatement = origin.getSibling(+origin.key + 1);
if (!nextStatement.isExpressionStatement()) {
return;
}
const nextExpression = nextStatement.get('expression');
if (!nextExpression.isCallExpression() || nextExpression.node.arguments.length !== 1) {
return;
}
const enumCallArgument = nextExpression.node.arguments[0];
if (!core_1.types.isLogicalExpression(enumCallArgument, { operator: '||' })) {
return;
}
// Check if identifiers match var declaration
if (!core_1.types.isIdentifier(enumCallArgument.left) ||
!nextExpression.scope.bindingIdentifierEquals(enumCallArgument.left.name, declarationId)) {
return;
}
const enumCallee = nextExpression.get('callee');
if (!enumCallee.isFunctionExpression() || enumCallee.node.params.length !== 1) {
return;
}
// Loose mode rewrites the enum to a shorter but less TypeScript-like form
let enumAssignments;
if (loose) {
enumAssignments = [];
}
// Check if all enum member values are pure.
// If not, leave as-is due to potential side efects
let hasElements = false;
for (const enumStatement of enumCallee.get('body').get('body')) {
if (!enumStatement.isExpressionStatement()) {
return;
}
const enumValueAssignment = enumStatement.get('expression');
if (!enumValueAssignment.isAssignmentExpression() ||
!enumValueAssignment.get('right').isPure()) {
return;
}
hasElements = true;
enumAssignments === null || enumAssignments === void 0 ? void 0 : enumAssignments.push(enumStatement.node);
}
// If there are no enum elements then there is nothing to wrap
if (!hasElements) {
return;
}
// Remove existing enum initializer
const enumInitializer = nextExpression.node;
nextExpression.remove();
// Create IIFE block contents
let blockContents;
if (enumAssignments) {
// Loose mode
blockContents = [
core_1.types.expressionStatement(core_1.types.assignmentExpression('=', core_1.types.cloneNode(declarationId), core_1.types.logicalExpression('||', core_1.types.cloneNode(declarationId), core_1.types.objectExpression([])))),
...enumAssignments,
];
}
else {
blockContents = [core_1.types.expressionStatement(enumInitializer)];
}
// Wrap existing enum initializer in a pure annotated IIFE
const container = core_1.types.arrowFunctionExpression([], core_1.types.blockStatement([
...blockContents,
core_1.types.returnStatement(core_1.types.cloneNode(declarationId)),
]));
const replacementInitializer = core_1.types.callExpression(core_1.types.parenthesizedExpression(container), []);
helper_annotate_as_pure_1.default(replacementInitializer);
// Add the wrapped enum initializer directly to the variable declaration
declaration.get('init').replaceWith(replacementInitializer);
},
},
};
}
exports.default = default_1;

View file

@ -0,0 +1,21 @@
/**
* @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 { PluginObj } from '@babel/core';
/**
* Provides one or more keywords that if found within the content of a source file indicate
* that this plugin should be used with a source file.
*
* @returns An a string iterable containing one or more keywords.
*/
export declare function getKeywords(): Iterable<string>;
/**
* A babel plugin factory function for eliding the Angular class metadata function (`ɵsetClassMetadata`).
*
* @returns A babel plugin object instance.
*/
export default function (): PluginObj;

View file

@ -0,0 +1,68 @@
"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.getKeywords = void 0;
const core_1 = require("@babel/core");
/**
* The name of the Angular class metadata function created by the Angular compiler.
*/
const SET_CLASS_METADATA_NAME = 'ɵsetClassMetadata';
/**
* Provides one or more keywords that if found within the content of a source file indicate
* that this plugin should be used with a source file.
*
* @returns An a string iterable containing one or more keywords.
*/
function getKeywords() {
return [SET_CLASS_METADATA_NAME];
}
exports.getKeywords = getKeywords;
/**
* A babel plugin factory function for eliding the Angular class metadata function (`ɵsetClassMetadata`).
*
* @returns A babel plugin object instance.
*/
function default_1() {
return {
visitor: {
CallExpression(path) {
var _a;
const callee = path.node.callee;
// The function being called must be the metadata function name
let calleeName;
if (core_1.types.isMemberExpression(callee) && core_1.types.isIdentifier(callee.property)) {
calleeName = callee.property.name;
}
else if (core_1.types.isIdentifier(callee)) {
calleeName = callee.name;
}
if (calleeName !== SET_CLASS_METADATA_NAME) {
return;
}
// There must be four arguments that meet the following criteria:
// * First must be an identifier
// * Second must be an array literal
const callArguments = path.node.arguments;
if (callArguments.length !== 4 ||
!core_1.types.isIdentifier(callArguments[0]) ||
!core_1.types.isArrayExpression(callArguments[1])) {
return;
}
// The metadata function is always emitted inside a function expression
if (!((_a = path.getFunctionParent()) === null || _a === void 0 ? void 0 : _a.isFunctionExpression())) {
return;
}
// Replace the metadata function with `void 0` which is the equivalent return value
// of the metadata function.
path.replaceWith(path.scope.buildUndefinedNode());
},
},
};
}
exports.default = default_1;

View file

@ -0,0 +1,14 @@
/**
* @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 { PluginObj } from '@babel/core';
/**
* A babel plugin factory function for adding the PURE annotation to top-level new and call expressions.
*
* @returns A babel plugin object instance.
*/
export default function (): PluginObj;

View file

@ -0,0 +1,86 @@
"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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 core_1 = require("@babel/core");
const helper_annotate_as_pure_1 = __importDefault(require("@babel/helper-annotate-as-pure"));
const tslib = __importStar(require("tslib"));
/**
* A cached set of TypeScript helper function names used by the helper name matcher utility function.
*/
const tslibHelpers = new Set(Object.keys(tslib).filter((h) => h.startsWith('__')));
/**
* Determinates whether an identifier name matches one of the TypeScript helper function names.
*
* @param name The identifier name to check.
* @returns True, if the name matches a TypeScript helper name; otherwise, false.
*/
function isTslibHelperName(name) {
const nameParts = name.split('$');
const originalName = nameParts[0];
if (nameParts.length > 2 || (nameParts.length === 2 && isNaN(+nameParts[1]))) {
return false;
}
return tslibHelpers.has(originalName);
}
/**
* A babel plugin factory function for adding the PURE annotation to top-level new and call expressions.
*
* @returns A babel plugin object instance.
*/
function default_1() {
return {
visitor: {
CallExpression(path) {
// If the expression has a function parent, it is not top-level
if (path.getFunctionParent()) {
return;
}
const callee = path.node.callee;
if (core_1.types.isFunctionExpression(callee) && path.node.arguments.length !== 0) {
return;
}
// Do not annotate TypeScript helpers emitted by the TypeScript compiler.
// TypeScript helpers are intended to cause side effects.
if (core_1.types.isIdentifier(callee) && isTslibHelperName(callee.name)) {
return;
}
helper_annotate_as_pure_1.default(path);
},
NewExpression(path) {
// If the expression has a function parent, it is not top-level
if (!path.getFunctionParent()) {
helper_annotate_as_pure_1.default(path);
}
},
},
};
}
exports.default = default_1;

View file

@ -0,0 +1,26 @@
/**
* @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 declare type DiagnosticReporter = (type: 'error' | 'warning' | 'info', message: string) => void;
export interface ApplicationPresetOptions {
i18n?: {
locale: string;
missingTranslationBehavior?: 'error' | 'warning' | 'ignore';
translation?: unknown;
};
angularLinker?: {
shouldLink: boolean;
jitMode: boolean;
};
forceES5?: boolean;
forceAsyncTransformation?: boolean;
diagnosticReporter?: DiagnosticReporter;
}
export default function (api: unknown, options: ApplicationPresetOptions): {
presets: any[][];
plugins: any[];
};

View file

@ -0,0 +1,155 @@
"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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 });
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
function createI18nDiagnostics(reporter) {
// Babel currently is synchronous so import cannot be used
const diagnostics = new (require('@angular/localize/src/tools/src/diagnostics').Diagnostics)();
if (!reporter) {
return diagnostics;
}
const baseAdd = diagnostics.add;
diagnostics.add = function (type, message, ...args) {
if (type !== 'ignore') {
baseAdd.call(diagnostics, type, message, ...args);
reporter(type, message);
}
};
const baseError = diagnostics.error;
diagnostics.error = function (message, ...args) {
baseError.call(diagnostics, message, ...args);
reporter('error', message);
};
const baseWarn = diagnostics.warn;
diagnostics.warn = function (message, ...args) {
baseWarn.call(diagnostics, message, ...args);
reporter('warning', message);
};
const baseMerge = diagnostics.merge;
diagnostics.merge = function (other, ...args) {
baseMerge.call(diagnostics, other, ...args);
for (const diagnostic of other.messages) {
reporter(diagnostic.type, diagnostic.message);
}
};
return diagnostics;
}
function createI18nPlugins(locale, translation, missingTranslationBehavior, diagnosticReporter) {
const diagnostics = createI18nDiagnostics(diagnosticReporter);
const plugins = [];
if (translation) {
const { makeEs2015TranslatePlugin, } = require('@angular/localize/src/tools/src/translate/source_files/es2015_translate_plugin');
plugins.push(makeEs2015TranslatePlugin(diagnostics, translation, {
missingTranslation: missingTranslationBehavior,
}));
const { makeEs5TranslatePlugin, } = require('@angular/localize/src/tools/src/translate/source_files/es5_translate_plugin');
plugins.push(makeEs5TranslatePlugin(diagnostics, translation, {
missingTranslation: missingTranslationBehavior,
}));
}
const { makeLocalePlugin, } = require('@angular/localize/src/tools/src/translate/source_files/locale_plugin');
plugins.push(makeLocalePlugin(locale));
return plugins;
}
function createNgtscLogger(reporter) {
return {
level: 1,
debug(...args) { },
info(...args) {
reporter === null || reporter === void 0 ? void 0 : reporter('info', args.join());
},
warn(...args) {
reporter === null || reporter === void 0 ? void 0 : reporter('warning', args.join());
},
error(...args) {
reporter === null || reporter === void 0 ? void 0 : reporter('error', args.join());
},
};
}
function default_1(api, options) {
var _a;
const presets = [];
const plugins = [];
let needRuntimeTransform = false;
if ((_a = options.angularLinker) === null || _a === void 0 ? void 0 : _a.shouldLink) {
// Babel currently is synchronous so import cannot be used
const { createEs2015LinkerPlugin } = require('@angular/compiler-cli/linker/babel');
plugins.push(createEs2015LinkerPlugin({
linkerJitMode: options.angularLinker.jitMode,
// This is a workaround until https://github.com/angular/angular/issues/42769 is fixed.
sourceMapping: false,
logger: createNgtscLogger(options.diagnosticReporter),
fileSystem: {
resolve: path.resolve,
exists: fs.existsSync,
dirname: path.dirname,
relative: path.relative,
readFile: fs.readFileSync,
// Node.JS types don't overlap the Compiler types.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
},
}));
}
if (options.forceES5) {
presets.push([
require('@babel/preset-env').default,
{
bugfixes: true,
modules: false,
// Comparable behavior to tsconfig target of ES5
targets: { ie: 9 },
exclude: ['transform-typeof-symbol'],
},
]);
needRuntimeTransform = true;
}
if (options.i18n) {
const { locale, missingTranslationBehavior, translation } = options.i18n;
const i18nPlugins = createI18nPlugins(locale, translation, missingTranslationBehavior || 'ignore', options.diagnosticReporter);
plugins.push(...i18nPlugins);
}
if (options.forceAsyncTransformation) {
// Always transform async/await to support Zone.js
plugins.push(require('@babel/plugin-transform-async-to-generator').default, require('@babel/plugin-proposal-async-generator-functions').default);
needRuntimeTransform = true;
}
if (needRuntimeTransform) {
// Babel equivalent to TypeScript's `importHelpers` option
plugins.push([
require('@babel/plugin-transform-runtime').default,
{
useESModules: true,
version: require('@babel/runtime/package.json').version,
absoluteRuntime: path.dirname(require.resolve('@babel/runtime/package.json')),
},
]);
}
return { presets, plugins };
}
exports.default = default_1;

View 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: any;
export default _default;

View file

@ -0,0 +1,146 @@
"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 linker_1 = require("@angular/compiler-cli/linker");
const babel_loader_1 = require("babel-loader");
const typescript_1 = require("typescript");
function requiresLinking(path, source) {
// @angular/core and @angular/compiler will cause false positives
// Also, TypeScript files do not require linking
if (/[\\\/]@angular[\\\/](?:compiler|core)|\.tsx?$/.test(path)) {
return false;
}
return linker_1.needsLinking(path, source);
}
exports.default = babel_loader_1.custom(() => {
const baseOptions = Object.freeze({
babelrc: false,
configFile: false,
compact: false,
cacheCompression: false,
sourceType: 'unambiguous',
inputSourceMap: false,
});
return {
async customOptions({ i18n, scriptTarget, aot, optimize, ...rawOptions }, { source }) {
var _a, _b;
// Must process file if plugins are added
let shouldProcess = Array.isArray(rawOptions.plugins) && rawOptions.plugins.length > 0;
const customOptions = {
forceAsyncTransformation: false,
forceES5: false,
angularLinker: undefined,
i18n: undefined,
};
// Analyze file for linking
if (await requiresLinking(this.resourcePath, source)) {
customOptions.angularLinker = {
shouldLink: true,
jitMode: aot !== true,
};
shouldProcess = true;
}
// Analyze for ES target processing
const esTarget = scriptTarget;
if (esTarget !== undefined) {
if (esTarget < typescript_1.ScriptTarget.ES2015) {
// TypeScript files will have already been downlevelled
customOptions.forceES5 = !/\.tsx?$/.test(this.resourcePath);
}
else if (esTarget >= typescript_1.ScriptTarget.ES2017) {
customOptions.forceAsyncTransformation =
!/[\\\/][_f]?esm2015[\\\/]/.test(this.resourcePath) && source.includes('async');
}
shouldProcess || (shouldProcess = customOptions.forceAsyncTransformation || customOptions.forceES5);
}
// Analyze for i18n inlining
if (i18n &&
!/[\\\/]@angular[\\\/](?:compiler|localize)/.test(this.resourcePath) &&
source.includes('$localize')) {
customOptions.i18n = i18n;
shouldProcess = true;
}
if (optimize) {
const angularPackage = /[\\\/]node_modules[\\\/]@angular[\\\/]/.test(this.resourcePath);
customOptions.optimize = {
// Angular packages provide additional tested side effects guarantees and can use
// otherwise unsafe optimizations.
looseEnums: angularPackage,
pureTopLevel: angularPackage,
// JavaScript modules that are marked as side effect free are considered to have
// no decorators that contain non-local effects.
wrapDecorators: !!((_b = (_a = this._module) === null || _a === void 0 ? void 0 : _a.factoryMeta) === null || _b === void 0 ? void 0 : _b.sideEffectFree),
};
shouldProcess = true;
}
// Add provided loader options to default base options
const loaderOptions = {
...baseOptions,
...rawOptions,
cacheIdentifier: JSON.stringify({
buildAngular: require('../../package.json').version,
customOptions,
baseOptions,
rawOptions,
}),
};
// Skip babel processing if no actions are needed
if (!shouldProcess) {
// Force the current file to be ignored
loaderOptions.ignore = [() => true];
}
return { custom: customOptions, loader: loaderOptions };
},
config(configuration, { customOptions }) {
var _a;
const plugins = (_a = configuration.options.plugins) !== null && _a !== void 0 ? _a : [];
if (customOptions.optimize) {
if (customOptions.optimize.pureTopLevel) {
plugins.push(require('./plugins/pure-toplevel-functions').default);
}
plugins.push(require('./plugins/elide-angular-metadata').default, [
require('./plugins/adjust-typescript-enums').default,
{ loose: customOptions.optimize.looseEnums },
], [
require('./plugins/adjust-static-class-members').default,
{ wrapDecorators: customOptions.optimize.wrapDecorators },
]);
}
return {
...configuration.options,
// Workaround for https://github.com/babel/babel-loader/pull/896 is available
// Delete once the above PR is released
// eslint-disable-next-line @typescript-eslint/no-explicit-any
inputSourceMap: configuration.options.inputSourceMap || false,
plugins,
presets: [
...(configuration.options.presets || []),
[
require('./presets/application').default,
{
...customOptions,
diagnosticReporter: (type, message) => {
switch (type) {
case 'error':
this.emitError(message);
break;
case 'info':
// Webpack does not currently have an informational diagnostic
case 'warning':
this.emitWarning(message);
break;
}
},
},
],
],
};
},
};
});

View 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
*/
import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
import { WebpackLoggingCallback } from '@angular-devkit/build-webpack';
import { json } from '@angular-devkit/core';
import { Observable } from 'rxjs';
import webpack from 'webpack';
import { ExecutionTransformer } from '../transforms';
import { IndexHtmlTransform } from '../utils/index-file/index-html-generator';
import { Schema as BrowserBuilderSchema } from './schema';
/**
* @experimental Direct usage of this type is considered experimental.
*/
export declare type BrowserBuilderOutput = json.JsonObject & BuilderOutput & {
baseOutputPath: string;
outputPaths: string[];
/**
* @deprecated in version 9. Use 'outputPaths' instead.
*/
outputPath: string;
};
/**
* @experimental Direct usage of this function is considered experimental.
*/
export declare function buildWebpackBrowser(options: BrowserBuilderSchema, context: BuilderContext, transforms?: {
webpackConfiguration?: ExecutionTransformer<webpack.Configuration>;
logging?: WebpackLoggingCallback;
indexHtml?: IndexHtmlTransform;
}): Observable<BrowserBuilderOutput>;
declare const _default: import("@angular-devkit/architect/src/internal").Builder<json.JsonObject & BrowserBuilderSchema>;
export default _default;

View file

@ -0,0 +1,584 @@
"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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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.buildWebpackBrowser = void 0;
const architect_1 = require("@angular-devkit/architect");
const build_webpack_1 = require("@angular-devkit/build-webpack");
const core_1 = require("@angular-devkit/core");
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
const typescript_1 = require("typescript");
const utils_1 = require("../utils");
const action_executor_1 = require("../utils/action-executor");
const bundle_calculator_1 = require("../utils/bundle-calculator");
const cache_path_1 = require("../utils/cache-path");
const color_1 = require("../utils/color");
const copy_assets_1 = require("../utils/copy-assets");
const environment_options_1 = require("../utils/environment-options");
const i18n_inlining_1 = require("../utils/i18n-inlining");
const index_html_generator_1 = require("../utils/index-file/index-html-generator");
const output_paths_1 = require("../utils/output-paths");
const package_chunk_sort_1 = require("../utils/package-chunk-sort");
const read_tsconfig_1 = require("../utils/read-tsconfig");
const service_worker_1 = require("../utils/service-worker");
const spinner_1 = require("../utils/spinner");
const version_1 = require("../utils/version");
const webpack_browser_config_1 = require("../utils/webpack-browser-config");
const configs_1 = require("../webpack/configs");
const async_chunks_1 = require("../webpack/utils/async-chunks");
const helpers_1 = require("../webpack/utils/helpers");
const stats_1 = require("../webpack/utils/stats");
const cacheDownlevelPath = environment_options_1.cachingDisabled ? undefined : cache_path_1.findCachePath('angular-build-dl');
async function initialize(options, context, differentialLoadingNeeded, webpackConfigurationTransform) {
var _a, _b;
const originalOutputPath = options.outputPath;
// Assets are processed directly by the builder except when watching
const adjustedOptions = options.watch ? options : { ...options, assets: [] };
const { config, projectRoot, projectSourceRoot, i18n } = await webpack_browser_config_1.generateI18nBrowserWebpackConfigFromContext(adjustedOptions, context, (wco) => [
configs_1.getCommonConfig(wco),
configs_1.getBrowserConfig(wco),
configs_1.getStylesConfig(wco),
configs_1.getStatsConfig(wco),
configs_1.getAnalyticsConfig(wco, context),
configs_1.getTypeScriptConfig(wco),
wco.buildOptions.webWorkerTsConfig ? configs_1.getWorkerConfig(wco) : {},
], { differentialLoadingNeeded });
// Validate asset option values if processed directly
if (((_a = options.assets) === null || _a === void 0 ? void 0 : _a.length) && !((_b = adjustedOptions.assets) === null || _b === void 0 ? void 0 : _b.length)) {
utils_1.normalizeAssetPatterns(options.assets, core_1.normalize(context.workspaceRoot), core_1.normalize(projectRoot), projectSourceRoot === undefined ? undefined : core_1.normalize(projectSourceRoot)).forEach(({ output }) => {
if (output.startsWith('..')) {
throw new Error('An asset cannot be written to a location outside of the output path.');
}
});
}
let transformedConfig;
if (webpackConfigurationTransform) {
transformedConfig = await webpackConfigurationTransform(config);
}
if (options.deleteOutputPath) {
utils_1.deleteOutputDir(context.workspaceRoot, originalOutputPath);
}
return { config: transformedConfig || config, projectRoot, projectSourceRoot, i18n };
}
/**
* @experimental Direct usage of this function is considered experimental.
*/
// eslint-disable-next-line max-lines-per-function
function buildWebpackBrowser(options, context, transforms = {}) {
var _a;
const root = core_1.normalize(context.workspaceRoot);
const projectName = (_a = context.target) === null || _a === void 0 ? void 0 : _a.project;
if (!projectName) {
throw new Error('The builder requires a target.');
}
const baseOutputPath = path.resolve(context.workspaceRoot, options.outputPath);
let outputPaths;
// Check Angular version.
version_1.assertCompatibleAngularVersion(context.workspaceRoot);
return rxjs_1.from(context.getProjectMetadata(projectName)).pipe(operators_1.switchMap(async (projectMetadata) => {
var _a;
const sysProjectRoot = core_1.getSystemPath(core_1.resolve(core_1.normalize(context.workspaceRoot), core_1.normalize((_a = projectMetadata.root) !== null && _a !== void 0 ? _a : '')));
const { options: compilerOptions } = read_tsconfig_1.readTsconfig(options.tsConfig, context.workspaceRoot);
const target = compilerOptions.target || typescript_1.ScriptTarget.ES5;
const buildBrowserFeatures = new utils_1.BuildBrowserFeatures(sysProjectRoot);
const isDifferentialLoadingNeeded = buildBrowserFeatures.isDifferentialLoadingNeeded(target);
checkInternetExplorerSupport(buildBrowserFeatures.supportedBrowsers, context.logger);
return {
...(await initialize(options, context, isDifferentialLoadingNeeded, transforms.webpackConfiguration)),
buildBrowserFeatures,
isDifferentialLoadingNeeded,
target,
};
}), operators_1.switchMap(
// eslint-disable-next-line max-lines-per-function
({ config, projectRoot, projectSourceRoot, i18n, buildBrowserFeatures, isDifferentialLoadingNeeded, target, }) => {
const normalizedOptimization = utils_1.normalizeOptimization(options.optimization);
return build_webpack_1.runWebpack(config, context, {
webpackFactory: require('webpack'),
logging: transforms.logging ||
((stats, config) => {
if (options.verbose) {
context.logger.info(stats.toString(config.stats));
}
}),
}).pipe(
// eslint-disable-next-line max-lines-per-function
operators_1.concatMap(async (buildEvent) => {
var _a, _b, _c, _d, _e, _f, _g, _h;
const spinner = new spinner_1.Spinner();
spinner.enabled = options.progress !== false;
const { success, emittedFiles = [], outputPath: webpackOutputPath } = buildEvent;
const webpackRawStats = buildEvent.webpackStats;
if (!webpackRawStats) {
throw new Error('Webpack stats build result is required.');
}
// Fix incorrectly set `initial` value on chunks.
const extraEntryPoints = [
...helpers_1.normalizeExtraEntryPoints(options.styles || [], 'styles'),
...helpers_1.normalizeExtraEntryPoints(options.scripts || [], 'scripts'),
];
const webpackStats = {
...webpackRawStats,
chunks: async_chunks_1.markAsyncChunksNonInitial(webpackRawStats, extraEntryPoints),
};
if (!success) {
// If using bundle downleveling then there is only one build
// If it fails show any diagnostic messages and bail
if (stats_1.statsHasWarnings(webpackStats)) {
context.logger.warn(stats_1.statsWarningsToString(webpackStats, { colors: true }));
}
if (stats_1.statsHasErrors(webpackStats)) {
context.logger.error(stats_1.statsErrorsToString(webpackStats, { colors: true }));
}
return { success };
}
else {
const processResults = [];
const bundleInfoStats = [];
outputPaths = output_paths_1.ensureOutputPaths(baseOutputPath, i18n);
let noModuleFiles;
let moduleFiles;
let files;
const scriptsEntryPointName = helpers_1.normalizeExtraEntryPoints(options.scripts || [], 'scripts').map((x) => x.bundleName);
if (isDifferentialLoadingNeeded && options.watch) {
moduleFiles = emittedFiles;
files = moduleFiles.filter((x) => x.extension === '.css' || (x.name && scriptsEntryPointName.includes(x.name)));
if (i18n.shouldInline) {
const success = await i18n_inlining_1.i18nInlineEmittedFiles(context, emittedFiles, i18n, baseOutputPath, Array.from(outputPaths.values()), scriptsEntryPointName, webpackOutputPath, target <= typescript_1.ScriptTarget.ES5, options.i18nMissingTranslation);
if (!success) {
return { success: false };
}
}
}
else if (isDifferentialLoadingNeeded) {
moduleFiles = [];
noModuleFiles = [];
// Common options for all bundle process actions
const sourceMapOptions = utils_1.normalizeSourceMaps(options.sourceMap || false);
const actionOptions = {
optimize: normalizedOptimization.scripts,
sourceMaps: sourceMapOptions.scripts,
hiddenSourceMaps: sourceMapOptions.hidden,
vendorSourceMaps: sourceMapOptions.vendor,
integrityAlgorithm: options.subresourceIntegrity ? 'sha384' : undefined,
};
let mainChunkId;
const actions = [];
let workerReplacements;
const seen = new Set();
for (const file of emittedFiles) {
// Assets are not processed nor injected into the index
if (file.asset) {
// WorkerPlugin adds worker files to assets
if (file.file.endsWith('.worker.js')) {
if (!workerReplacements) {
workerReplacements = [];
}
workerReplacements.push([
file.file,
file.file.replace(/\-(es20\d{2}|esnext)/, '-es5'),
]);
}
else {
continue;
}
}
// Scripts and non-javascript files are not processed
if (file.extension !== '.js' ||
(file.name && scriptsEntryPointName.includes(file.name))) {
if (files === undefined) {
files = [];
}
files.push(file);
continue;
}
// Ignore already processed files; emittedFiles can contain duplicates
if (seen.has(file.file)) {
continue;
}
seen.add(file.file);
if (file.name === 'vendor' || (!mainChunkId && file.name === 'main')) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
mainChunkId = file.id.toString();
}
// All files at this point except ES5 polyfills are module scripts
const es5Polyfills = file.file.startsWith('polyfills-es5');
if (!es5Polyfills) {
moduleFiles.push(file);
}
// Retrieve the content/map for the file
// NOTE: Additional future optimizations will read directly from memory
let filename = path.join(webpackOutputPath, file.file);
const code = fs.readFileSync(filename, 'utf8');
let map;
if (actionOptions.sourceMaps) {
try {
map = fs.readFileSync(filename + '.map', 'utf8');
if (es5Polyfills) {
fs.unlinkSync(filename + '.map');
}
}
catch { }
}
if (es5Polyfills) {
fs.unlinkSync(filename);
filename = filename.replace(/\-es20\d{2}/, '');
}
const es2015Polyfills = file.file.startsWith('polyfills-es20');
// Record the bundle processing action
// The runtime chunk gets special processing for lazy loaded files
actions.push({
...actionOptions,
filename,
code,
map,
// id is always present for non-assets
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
name: file.id,
runtime: file.file.startsWith('runtime'),
ignoreOriginal: es5Polyfills,
optimizeOnly: es2015Polyfills,
});
// ES2015 polyfills are only optimized; optimization check was performed above
if (es2015Polyfills) {
continue;
}
// Add the newly created ES5 bundles to the index as nomodule scripts
const newFilename = es5Polyfills
? file.file.replace(/\-es20\d{2}/, '')
: file.file.replace(/\-(es20\d{2}|esnext)/, '-es5');
noModuleFiles.push({ ...file, file: newFilename });
}
const processActions = [];
let processRuntimeAction;
for (const action of actions) {
// If SRI is enabled always process the runtime bundle
// Lazy route integrity values are stored in the runtime bundle
if (action.integrityAlgorithm && action.runtime) {
processRuntimeAction = action;
}
else {
processActions.push({ replacements: workerReplacements, ...action });
}
}
const executor = new action_executor_1.BundleActionExecutor({ cachePath: cacheDownlevelPath, i18n }, options.subresourceIntegrity ? 'sha384' : undefined);
// Execute the bundle processing actions
try {
spinner.start('Generating ES5 bundles for differential loading...');
for await (const result of executor.processAll(processActions)) {
processResults.push(result);
}
// Runtime must be processed after all other files
if (processRuntimeAction) {
const runtimeOptions = {
...processRuntimeAction,
runtimeData: processResults,
supportedBrowsers: buildBrowserFeatures.supportedBrowsers,
};
processResults.push(await Promise.resolve().then(() => __importStar(require('../utils/process-bundle'))).then((m) => m.process(runtimeOptions)));
}
spinner.succeed('ES5 bundle generation complete.');
if (i18n.shouldInline) {
spinner.start('Generating localized bundles...');
const inlineActions = [];
const processedFiles = new Set();
for (const result of processResults) {
if (result.original) {
inlineActions.push({
filename: path.basename(result.original.filename),
code: fs.readFileSync(result.original.filename, 'utf8'),
map: result.original.map &&
fs.readFileSync(result.original.map.filename, 'utf8'),
outputPath: baseOutputPath,
es5: false,
missingTranslation: options.i18nMissingTranslation,
setLocale: result.name === mainChunkId,
});
processedFiles.add(result.original.filename);
if (result.original.map) {
processedFiles.add(result.original.map.filename);
}
}
if (result.downlevel) {
inlineActions.push({
filename: path.basename(result.downlevel.filename),
code: fs.readFileSync(result.downlevel.filename, 'utf8'),
map: result.downlevel.map &&
fs.readFileSync(result.downlevel.map.filename, 'utf8'),
outputPath: baseOutputPath,
es5: true,
missingTranslation: options.i18nMissingTranslation,
setLocale: result.name === mainChunkId,
});
processedFiles.add(result.downlevel.filename);
if (result.downlevel.map) {
processedFiles.add(result.downlevel.map.filename);
}
}
}
let hasErrors = false;
try {
for await (const result of executor.inlineAll(inlineActions)) {
if (options.verbose) {
context.logger.info(`Localized "${result.file}" [${result.count} translation(s)].`);
}
for (const diagnostic of result.diagnostics) {
spinner.stop();
if (diagnostic.type === 'error') {
hasErrors = true;
context.logger.error(diagnostic.message);
}
else {
context.logger.warn(diagnostic.message);
}
spinner.start();
}
}
// Copy any non-processed files into the output locations
await copy_assets_1.copyAssets([
{
glob: '**/*',
input: webpackOutputPath,
output: '',
ignore: [...processedFiles].map((f) => path.relative(webpackOutputPath, f)),
},
], Array.from(outputPaths.values()), '');
}
catch (err) {
spinner.fail('Localized bundle generation failed.');
return { success: false, error: mapErrorToMessage(err) };
}
if (hasErrors) {
spinner.fail('Localized bundle generation failed.');
}
else {
spinner.succeed('Localized bundle generation complete.');
}
if (hasErrors) {
return { success: false };
}
}
}
finally {
executor.stop();
}
for (const result of processResults) {
const chunk = (_a = webpackStats.chunks) === null || _a === void 0 ? void 0 : _a.find((chunk) => { var _a; return ((_a = chunk.id) === null || _a === void 0 ? void 0 : _a.toString()) === result.name; });
if (result.original) {
bundleInfoStats.push(generateBundleInfoStats(result.original, chunk, 'modern'));
}
if (result.downlevel) {
bundleInfoStats.push(generateBundleInfoStats(result.downlevel, chunk, 'legacy'));
}
}
const unprocessedChunks = ((_b = webpackStats.chunks) === null || _b === void 0 ? void 0 : _b.filter((chunk) => !processResults.find((result) => { var _a; return ((_a = chunk.id) === null || _a === void 0 ? void 0 : _a.toString()) === result.name; }))) || [];
for (const chunk of unprocessedChunks) {
const asset = (_c = webpackStats.assets) === null || _c === void 0 ? void 0 : _c.find((a) => { var _a; return a.name === ((_a = chunk.files) === null || _a === void 0 ? void 0 : _a[0]); });
bundleInfoStats.push(stats_1.generateBundleStats({ ...chunk, size: asset === null || asset === void 0 ? void 0 : asset.size }));
}
}
else {
files = emittedFiles.filter((x) => x.name !== 'polyfills-es5');
noModuleFiles = emittedFiles.filter((x) => x.name === 'polyfills-es5');
if (i18n.shouldInline) {
const success = await i18n_inlining_1.i18nInlineEmittedFiles(context, emittedFiles, i18n, baseOutputPath, Array.from(outputPaths.values()), scriptsEntryPointName, webpackOutputPath, target <= typescript_1.ScriptTarget.ES5, options.i18nMissingTranslation);
if (!success) {
return { success: false };
}
}
}
// Check for budget errors and display them to the user.
const budgets = options.budgets;
if (budgets === null || budgets === void 0 ? void 0 : budgets.length) {
const budgetFailures = bundle_calculator_1.checkBudgets(budgets, webpackStats, processResults);
for (const { severity, message } of budgetFailures) {
switch (severity) {
case bundle_calculator_1.ThresholdSeverity.Warning:
(_d = webpackStats.warnings) === null || _d === void 0 ? void 0 : _d.push({ message });
break;
case bundle_calculator_1.ThresholdSeverity.Error:
(_e = webpackStats.errors) === null || _e === void 0 ? void 0 : _e.push({ message });
break;
default:
assertNever(severity);
}
}
}
const buildSuccess = success && !stats_1.statsHasErrors(webpackStats);
if (buildSuccess) {
// Copy assets
if (!options.watch && ((_f = options.assets) === null || _f === void 0 ? void 0 : _f.length)) {
spinner.start('Copying assets...');
try {
await copy_assets_1.copyAssets(utils_1.normalizeAssetPatterns(options.assets, root, core_1.normalize(projectRoot), projectSourceRoot === undefined ? undefined : core_1.normalize(projectSourceRoot)), Array.from(outputPaths.values()), context.workspaceRoot);
spinner.succeed('Copying assets complete.');
}
catch (err) {
spinner.fail(color_1.colors.redBright('Copying of assets failed.'));
return { success: false, error: 'Unable to copy assets: ' + err.message };
}
}
if (options.index) {
spinner.start('Generating index html...');
const WOFFSupportNeeded = !buildBrowserFeatures.isFeatureSupported('woff2');
const entrypoints = package_chunk_sort_1.generateEntryPoints({
scripts: (_g = options.scripts) !== null && _g !== void 0 ? _g : [],
styles: (_h = options.styles) !== null && _h !== void 0 ? _h : [],
});
const indexHtmlGenerator = new index_html_generator_1.IndexHtmlGenerator({
indexPath: path.join(context.workspaceRoot, webpack_browser_config_1.getIndexInputFile(options.index)),
entrypoints,
deployUrl: options.deployUrl,
sri: options.subresourceIntegrity,
WOFFSupportNeeded,
optimization: normalizedOptimization,
crossOrigin: options.crossOrigin,
postTransform: transforms.indexHtml,
});
let hasErrors = false;
for (const [locale, outputPath] of outputPaths.entries()) {
try {
const { content, warnings, errors } = await indexHtmlGenerator.process({
baseHref: getLocaleBaseHref(i18n, locale) || options.baseHref,
// i18nLocale is used when Ivy is disabled
lang: locale || undefined,
outputPath,
files: mapEmittedFilesToFileInfo(files),
noModuleFiles: mapEmittedFilesToFileInfo(noModuleFiles),
moduleFiles: mapEmittedFilesToFileInfo(moduleFiles),
});
if (warnings.length || errors.length) {
spinner.stop();
warnings.forEach((m) => context.logger.warn(m));
errors.forEach((m) => {
context.logger.error(m);
hasErrors = true;
});
spinner.start();
}
const indexOutput = path.join(outputPath, webpack_browser_config_1.getIndexOutputFile(options.index));
await fs.promises.mkdir(path.dirname(indexOutput), { recursive: true });
await fs.promises.writeFile(indexOutput, content);
}
catch (error) {
spinner.fail('Index html generation failed.');
return { success: false, error: mapErrorToMessage(error) };
}
}
if (hasErrors) {
spinner.fail('Index html generation failed.');
return { success: false };
}
else {
spinner.succeed('Index html generation complete.');
}
}
if (options.serviceWorker) {
spinner.start('Generating service worker...');
for (const [locale, outputPath] of outputPaths.entries()) {
try {
await service_worker_1.augmentAppWithServiceWorker(root, core_1.normalize(projectRoot), core_1.normalize(outputPath), getLocaleBaseHref(i18n, locale) || options.baseHref || '/', options.ngswConfigPath);
}
catch (error) {
spinner.fail('Service worker generation failed.');
return { success: false, error: mapErrorToMessage(error) };
}
}
spinner.succeed('Service worker generation complete.');
}
}
stats_1.webpackStatsLogger(context.logger, webpackStats, config, bundleInfoStats);
return { success: buildSuccess };
}
}), operators_1.map((event) => ({
...event,
baseOutputPath,
outputPath: baseOutputPath,
outputPaths: (outputPaths && Array.from(outputPaths.values())) || [baseOutputPath],
})));
}));
function getLocaleBaseHref(i18n, locale) {
var _a, _b;
if (i18n.locales[locale] && ((_a = i18n.locales[locale]) === null || _a === void 0 ? void 0 : _a.baseHref) !== '') {
return utils_1.urlJoin(options.baseHref || '', (_b = i18n.locales[locale].baseHref) !== null && _b !== void 0 ? _b : `/${locale}/`);
}
return undefined;
}
}
exports.buildWebpackBrowser = buildWebpackBrowser;
function mapErrorToMessage(error) {
if (error instanceof Error) {
return error.message;
}
if (typeof error === 'string') {
return error;
}
return undefined;
}
function assertNever(input) {
throw new Error(`Unexpected call to assertNever() with input: ${JSON.stringify(input, null /* replacer */, 4 /* tabSize */)}`);
}
function generateBundleInfoStats(bundle, chunk, chunkType) {
return stats_1.generateBundleStats({
size: bundle.size,
files: bundle.map ? [bundle.filename, bundle.map.filename] : [bundle.filename],
names: chunk === null || chunk === void 0 ? void 0 : chunk.names,
initial: !!(chunk === null || chunk === void 0 ? void 0 : chunk.initial),
rendered: true,
chunkType,
});
}
function mapEmittedFilesToFileInfo(files = []) {
const filteredFiles = [];
for (const { file, name, extension, initial } of files) {
if (name && initial) {
filteredFiles.push({ file, extension, name });
}
}
return filteredFiles;
}
function checkInternetExplorerSupport(supportedBrowsers, logger) {
const hasIE9 = supportedBrowsers.includes('ie 9');
const hasIE10 = supportedBrowsers.includes('ie 10');
const hasIE11 = supportedBrowsers.includes('ie 11');
if (hasIE9 || hasIE10) {
const browsers = (hasIE9 ? 'IE 9' + (hasIE10 ? ' & ' : '') : '') + (hasIE10 ? 'IE 10' : '');
logger.warn(`Warning: Support was requested for ${browsers} in the project's browserslist configuration. ` +
(hasIE9 && hasIE10 ? 'These browsers are' : 'This browser is') +
' no longer officially supported with Angular v11 and higher.' +
'\nFor more information, see https://v10.angular.io/guide/deprecations#ie-9-10-and-mobile');
}
if (hasIE11) {
logger.warn(`Warning: Support was requested for IE 11 in the project's browserslist configuration. ` +
'IE 11 support is deprecated since Angular v12.' +
'\nFor more information, see https://angular.io/guide/browser-support');
}
}
exports.default = architect_1.createBuilder(buildWebpackBrowser);

View file

@ -0,0 +1,413 @@
/**
* Browser target options
*/
export interface Schema {
/**
* A list of CommonJS packages that are allowed to be used without a build time warning.
*/
allowedCommonJsDependencies?: string[];
/**
* Build using Ahead of Time compilation.
*/
aot?: boolean;
/**
* List of static application assets.
*/
assets?: AssetPattern[];
/**
* Base url for the application being built.
*/
baseHref?: string;
/**
* Budget thresholds to ensure parts of your application stay within boundaries which you
* set.
*/
budgets?: Budget[];
/**
* Enables '@angular-devkit/build-optimizer' optimizations when using the 'aot' option.
*/
buildOptimizer?: boolean;
/**
* Generate a seperate bundle containing code used across multiple bundles.
*/
commonChunk?: boolean;
/**
* Define the crossorigin attribute setting of elements that provide CORS support.
*/
crossOrigin?: CrossOrigin;
/**
* Delete the output path before building.
*/
deleteOutputPath?: boolean;
/**
* URL where files will be deployed.
*/
deployUrl?: string;
/**
* Extract CSS from global styles into '.css' files instead of '.js'.
* @deprecated Deprecated since version 11.0. No longer required to disable CSS extraction
* for HMR.
*/
extractCss?: boolean;
/**
* 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 missing translations for i18n.
*/
i18nMissingTranslation?: I18NMissingTranslation;
/**
* 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;
/**
* Translate the bundles in one or more locales.
*/
localize?: Localize;
/**
* The full path for the main entry point to the app, relative to the current workspace.
*/
main: string;
/**
* Use file name for lazy loaded chunks.
*/
namedChunks?: boolean;
/**
* Path to ngsw-config.json.
*/
ngswConfigPath?: string;
/**
* 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;
/**
* The full path for the new output directory, relative to the current workspace.
*
* By default, writes output to a folder named dist/ in the current project.
*/
outputPath: string;
/**
* Enable and define the file watching poll time period in milliseconds.
*/
poll?: number;
/**
* The full path for the polyfills file, relative to the current workspace.
*/
polyfills?: string;
/**
* 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;
/**
* The path where style resources will be placed, relative to outputPath.
*/
resourcesOutputPath?: string;
/**
* Global scripts to be included in the build.
*/
scripts?: ExtraEntryPoint[];
/**
* Generates a service worker config for production builds.
*/
serviceWorker?: boolean;
/**
* Show circular dependency warnings on builds.
* @deprecated The recommended method to detect circular dependencies in project code is to
* use either a lint rule or other external tooling.
*/
showCircularDependencies?: boolean;
/**
* Output source maps for scripts and styles. For more information, see
* https://angular.io/guide/workspace-config#source-map-configuration.
*/
sourceMap?: SourceMapUnion;
/**
* Generates a 'stats.json' file which can be analyzed using tools such as
* 'webpack-bundle-analyzer'.
*/
statsJson?: boolean;
/**
* Options to pass to style preprocessors.
*/
stylePreprocessorOptions?: StylePreprocessorOptions;
/**
* Global styles to be included in the build.
*/
styles?: ExtraEntryPoint[];
/**
* Enables the use of subresource integrity validation.
*/
subresourceIntegrity?: boolean;
/**
* The full path for the TypeScript configuration file, relative to the current workspace.
*/
tsConfig: string;
/**
* Generate a seperate bundle containing only vendor libraries. This option should only used
* for development.
*/
vendorChunk?: boolean;
/**
* Adds more details to output logging.
*/
verbose?: boolean;
/**
* Run build when files change.
*/
watch?: boolean;
/**
* TypeScript configuration for Web Worker modules.
*/
webWorkerTsConfig?: string;
}
export declare 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;
replaceWith?: string;
src?: string;
with?: string;
}
/**
* How to handle missing translations for i18n.
*/
export declare enum I18NMissingTranslation {
Error = "error",
Ignore = "ignore",
Warning = "warning"
}
/**
* Configures the generation of the application's HTML index.
*/
export declare type IndexUnion = 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;
}
/**
* 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 declare 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 declare 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 declare type FontsUnion = boolean | FontsClass;
export interface FontsClass {
/**
* Reduce render blocking requests by inlining external Google fonts and icons 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 declare 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;
}
/**
* Define the output filename cache-busting hashing mode.
*/
export declare enum OutputHashing {
All = "all",
Bundles = "bundles",
Media = "media",
None = "none"
}
export declare type ExtraEntryPoint = ExtraEntryPointClass | string;
export interface ExtraEntryPointClass {
/**
* 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;
}
/**
* Output source maps for scripts and styles. For more information, see
* https://angular.io/guide/workspace-config#source-map-configuration.
*/
export declare 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;
}
/**
* Options to pass to style preprocessors.
*/
export interface StylePreprocessorOptions {
/**
* Paths to include. Paths will be resolved to workspace root.
*/
includePaths?: string[];
}

View file

@ -0,0 +1,56 @@
"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.OutputHashing = exports.InlineStyleLanguage = exports.I18NMissingTranslation = exports.CrossOrigin = exports.Type = void 0;
/**
* The type of budget.
*/
var Type;
(function (Type) {
Type["All"] = "all";
Type["AllScript"] = "allScript";
Type["Any"] = "any";
Type["AnyComponentStyle"] = "anyComponentStyle";
Type["AnyScript"] = "anyScript";
Type["Bundle"] = "bundle";
Type["Initial"] = "initial";
})(Type = exports.Type || (exports.Type = {}));
/**
* Define the crossorigin attribute setting of elements that provide CORS support.
*/
var CrossOrigin;
(function (CrossOrigin) {
CrossOrigin["Anonymous"] = "anonymous";
CrossOrigin["None"] = "none";
CrossOrigin["UseCredentials"] = "use-credentials";
})(CrossOrigin = exports.CrossOrigin || (exports.CrossOrigin = {}));
/**
* How to handle missing translations for i18n.
*/
var I18NMissingTranslation;
(function (I18NMissingTranslation) {
I18NMissingTranslation["Error"] = "error";
I18NMissingTranslation["Ignore"] = "ignore";
I18NMissingTranslation["Warning"] = "warning";
})(I18NMissingTranslation = exports.I18NMissingTranslation || (exports.I18NMissingTranslation = {}));
/**
* The stylesheet language to use for the application's inline component styles.
*/
var InlineStyleLanguage;
(function (InlineStyleLanguage) {
InlineStyleLanguage["Css"] = "css";
InlineStyleLanguage["Less"] = "less";
InlineStyleLanguage["Sass"] = "sass";
InlineStyleLanguage["Scss"] = "scss";
})(InlineStyleLanguage = exports.InlineStyleLanguage || (exports.InlineStyleLanguage = {}));
/**
* Define the output filename cache-busting hashing mode.
*/
var OutputHashing;
(function (OutputHashing) {
OutputHashing["All"] = "all";
OutputHashing["Bundles"] = "bundles";
OutputHashing["Media"] = "media";
OutputHashing["None"] = "none";
})(OutputHashing = exports.OutputHashing || (exports.OutputHashing = {}));

View file

@ -0,0 +1,513 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "Webpack browser schema for Build Facade.",
"description": "Browser target options",
"type": "object",
"properties": {
"assets": {
"type": "array",
"description": "List of static application assets.",
"default": [],
"items": {
"$ref": "#/definitions/assetPattern"
}
},
"main": {
"type": "string",
"description": "The full path for the main entry point to the app, relative to the current workspace."
},
"polyfills": {
"type": "string",
"description": "The full path for the polyfills file, relative to the current workspace."
},
"tsConfig": {
"type": "string",
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
},
"scripts": {
"description": "Global scripts to be included in the build.",
"type": "array",
"default": [],
"items": {
"$ref": "#/definitions/extraEntryPoint"
}
},
"styles": {
"description": "Global styles to be included in the build.",
"type": "array",
"default": [],
"items": {
"$ref": "#/definitions/extraEntryPoint"
}
},
"inlineStyleLanguage": {
"description": "The stylesheet language to use for the application's inline component styles.",
"type": "string",
"default": "css",
"enum": ["css", "less", "sass", "scss"]
},
"stylePreprocessorOptions": {
"description": "Options to pass to style preprocessors.",
"type": "object",
"properties": {
"includePaths": {
"description": "Paths to include. Paths will be resolved to workspace root.",
"type": "array",
"items": {
"type": "string"
},
"default": []
}
},
"additionalProperties": false
},
"optimization": {
"description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.",
"x-user-analytics": 16,
"default": true,
"oneOf": [
{
"type": "object",
"properties": {
"scripts": {
"type": "boolean",
"description": "Enables optimization of the scripts output.",
"default": true
},
"styles": {
"description": "Enables optimization of the styles output.",
"default": true,
"oneOf": [
{
"type": "object",
"properties": {
"minify": {
"type": "boolean",
"description": "Minify CSS definitions by removing extraneous whitespace and comments, merging identifiers and minimizing values.",
"default": true
},
"inlineCritical": {
"type": "boolean",
"description": "Extract and inline critical CSS definitions to improve first paint time.",
"default": true
}
},
"additionalProperties": false
},
{
"type": "boolean"
}
]
},
"fonts": {
"description": "Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY` environment variable can be used to specify a proxy server.",
"default": true,
"oneOf": [
{
"type": "object",
"properties": {
"inline": {
"type": "boolean",
"description": "Reduce render blocking requests by inlining external Google fonts and icons 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.",
"default": true
}
},
"additionalProperties": false
},
{
"type": "boolean"
}
]
}
},
"additionalProperties": false
},
{
"type": "boolean"
}
]
},
"fileReplacements": {
"description": "Replace compilation source files with other compilation source files in the build.",
"type": "array",
"items": {
"$ref": "#/definitions/fileReplacement"
},
"default": []
},
"outputPath": {
"type": "string",
"description": "The full path for the new output directory, relative to the current workspace.\n\nBy default, writes output to a folder named dist/ in the current project."
},
"resourcesOutputPath": {
"type": "string",
"description": "The path where style resources will be placed, relative to outputPath.",
"default": ""
},
"aot": {
"type": "boolean",
"description": "Build using Ahead of Time compilation.",
"x-user-analytics": 13,
"default": true
},
"sourceMap": {
"description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
"default": false,
"oneOf": [
{
"type": "object",
"properties": {
"scripts": {
"type": "boolean",
"description": "Output source maps for all scripts.",
"default": true
},
"styles": {
"type": "boolean",
"description": "Output source maps for all styles.",
"default": true
},
"hidden": {
"type": "boolean",
"description": "Output source maps used for error reporting tools.",
"default": false
},
"vendor": {
"type": "boolean",
"description": "Resolve vendor packages source maps.",
"default": false
}
},
"additionalProperties": false
},
{
"type": "boolean"
}
]
},
"vendorChunk": {
"type": "boolean",
"description": "Generate a seperate bundle containing only vendor libraries. This option should only used for development.",
"default": false
},
"commonChunk": {
"type": "boolean",
"description": "Generate a seperate bundle containing code used across multiple bundles.",
"default": true
},
"baseHref": {
"type": "string",
"description": "Base url for the application being built."
},
"deployUrl": {
"type": "string",
"description": "URL where files will be deployed."
},
"verbose": {
"type": "boolean",
"description": "Adds more details to output logging.",
"default": false
},
"progress": {
"type": "boolean",
"description": "Log progress to the console while building.",
"default": true
},
"i18nMissingTranslation": {
"type": "string",
"description": "How to handle missing translations for i18n.",
"enum": ["warning", "error", "ignore"],
"default": "warning"
},
"localize": {
"description": "Translate the bundles in one or more locales.",
"oneOf": [
{
"type": "boolean",
"description": "Translate all locales."
},
{
"type": "array",
"description": "List of locales ID's to translate.",
"minItems": 1,
"items": {
"type": "string",
"pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{4})?(-([a-zA-Z]{2}|[0-9]{3}))?(-[a-zA-Z]{5,8})?(-x(-[a-zA-Z0-9]{1,8})+)?$"
}
}
]
},
"extractCss": {
"type": "boolean",
"description": "Extract CSS from global styles into '.css' files instead of '.js'.",
"default": true,
"x-deprecated": "Deprecated since version 11.0. No longer required to disable CSS extraction for HMR."
},
"watch": {
"type": "boolean",
"description": "Run build when files change.",
"default": false
},
"outputHashing": {
"type": "string",
"description": "Define the output filename cache-busting hashing mode.",
"default": "none",
"enum": ["none", "all", "media", "bundles"]
},
"poll": {
"type": "number",
"description": "Enable and define the file watching poll time period in milliseconds."
},
"deleteOutputPath": {
"type": "boolean",
"description": "Delete the output path before building.",
"default": true
},
"preserveSymlinks": {
"type": "boolean",
"description": "Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set."
},
"extractLicenses": {
"type": "boolean",
"description": "Extract all licenses in a separate file.",
"default": true
},
"showCircularDependencies": {
"type": "boolean",
"description": "Show circular dependency warnings on builds.",
"default": false,
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
},
"buildOptimizer": {
"type": "boolean",
"description": "Enables '@angular-devkit/build-optimizer' optimizations when using the 'aot' option.",
"default": true
},
"namedChunks": {
"type": "boolean",
"description": "Use file name for lazy loaded chunks.",
"default": false
},
"subresourceIntegrity": {
"type": "boolean",
"description": "Enables the use of subresource integrity validation.",
"default": false
},
"serviceWorker": {
"type": "boolean",
"description": "Generates a service worker config for production builds.",
"default": false
},
"ngswConfigPath": {
"type": "string",
"description": "Path to ngsw-config.json."
},
"index": {
"description": "Configures the generation of the application's HTML index.",
"oneOf": [
{
"type": "string",
"description": "The path of a file to use for the application's HTML index. The filename of the specified path will be used for the generated file and will be created in the root of the application's configured output path."
},
{
"type": "object",
"description": "",
"properties": {
"input": {
"type": "string",
"minLength": 1,
"description": "The path of a file to use for the application's generated HTML index."
},
"output": {
"type": "string",
"minLength": 1,
"default": "index.html",
"description": "The output path of the application's generated HTML index file. The full provided path will be used and will be considered relative to the application's configured output path."
}
},
"required": ["input"]
}
]
},
"statsJson": {
"type": "boolean",
"description": "Generates a 'stats.json' file which can be analyzed using tools such as 'webpack-bundle-analyzer'.",
"default": false
},
"budgets": {
"description": "Budget thresholds to ensure parts of your application stay within boundaries which you set.",
"type": "array",
"items": {
"$ref": "#/definitions/budget"
},
"default": []
},
"webWorkerTsConfig": {
"type": "string",
"description": "TypeScript configuration for Web Worker modules."
},
"crossOrigin": {
"type": "string",
"description": "Define the crossorigin attribute setting of elements that provide CORS support.",
"default": "none",
"enum": ["none", "anonymous", "use-credentials"]
},
"allowedCommonJsDependencies": {
"description": "A list of CommonJS packages that are allowed to be used without a build time warning.",
"type": "array",
"items": {
"type": "string"
},
"default": []
}
},
"additionalProperties": false,
"required": ["outputPath", "index", "main", "tsConfig"],
"definitions": {
"assetPattern": {
"oneOf": [
{
"type": "object",
"properties": {
"followSymlinks": {
"type": "boolean",
"default": false,
"description": "Allow glob patterns to follow symlink directories. This allows subdirectories of the symlink to be searched."
},
"glob": {
"type": "string",
"description": "The pattern to match."
},
"input": {
"type": "string",
"description": "The input directory path in which to apply 'glob'. Defaults to the project root."
},
"ignore": {
"description": "An array of globs to ignore.",
"type": "array",
"items": {
"type": "string"
}
},
"output": {
"type": "string",
"description": "Absolute path within the output."
}
},
"additionalProperties": false,
"required": ["glob", "input", "output"]
},
{
"type": "string"
}
]
},
"fileReplacement": {
"oneOf": [
{
"type": "object",
"properties": {
"src": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
},
"replaceWith": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
}
},
"additionalProperties": false,
"required": ["src", "replaceWith"]
},
{
"type": "object",
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
}
},
"additionalProperties": false,
"required": ["replace", "with"]
}
]
},
"extraEntryPoint": {
"oneOf": [
{
"type": "object",
"properties": {
"input": {
"type": "string",
"description": "The file to include."
},
"bundleName": {
"type": "string",
"pattern": "^[\\w\\-.]*$",
"description": "The bundle name for this extra entry point."
},
"inject": {
"type": "boolean",
"description": "If the bundle will be referenced in the HTML file.",
"default": true
}
},
"additionalProperties": false,
"required": ["input"]
},
{
"type": "string",
"description": "The file to include."
}
]
},
"budget": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "The type of budget.",
"enum": ["all", "allScript", "any", "anyScript", "anyComponentStyle", "bundle", "initial"]
},
"name": {
"type": "string",
"description": "The name of the bundle."
},
"baseline": {
"type": "string",
"description": "The baseline size for comparison."
},
"maximumWarning": {
"type": "string",
"description": "The maximum threshold for warning relative to the baseline."
},
"maximumError": {
"type": "string",
"description": "The maximum threshold for error relative to the baseline."
},
"minimumWarning": {
"type": "string",
"description": "The minimum threshold for warning relative to the baseline."
},
"minimumError": {
"type": "string",
"description": "The minimum threshold for error relative to the baseline."
},
"warning": {
"type": "string",
"description": "The threshold for warning relative to the baseline (min & max)."
},
"error": {
"type": "string",
"description": "The threshold for error relative to the baseline (min & max)."
}
},
"additionalProperties": false,
"required": ["type"]
}
}
}

View file

@ -0,0 +1,18 @@
/**
* @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 { Schema } from '../schema';
export { describeBuilder } from '../../testing';
export declare const BROWSER_BUILDER_INFO: Readonly<{
name: string;
schemaPath: string;
}>;
/**
* Contains all required browser builder fields.
* Also disables progress reporting to minimize logging output.
*/
export declare const BASE_OPTIONS: Readonly<Schema>;

View file

@ -0,0 +1,30 @@
"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.BASE_OPTIONS = exports.BROWSER_BUILDER_INFO = exports.describeBuilder = void 0;
var testing_1 = require("../../testing");
Object.defineProperty(exports, "describeBuilder", { enumerable: true, get: function () { return testing_1.describeBuilder; } });
exports.BROWSER_BUILDER_INFO = Object.freeze({
name: '@angular-devkit/build-angular:browser',
schemaPath: __dirname + '/../schema.json',
});
/**
* Contains all required browser builder fields.
* Also disables progress reporting to minimize logging output.
*/
exports.BASE_OPTIONS = Object.freeze({
index: 'src/index.html',
main: 'src/main.ts',
outputPath: 'dist',
tsConfig: 'src/tsconfig.app.json',
progress: false,
// Disable optimizations
optimization: false,
buildOptimizer: false,
});

View file

@ -0,0 +1,38 @@
/**
* @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 { DevServerBuildOutput, WebpackLoggingCallback } from '@angular-devkit/build-webpack';
import { json } from '@angular-devkit/core';
import { Observable } from 'rxjs';
import webpack from 'webpack';
import { ExecutionTransformer } from '../transforms';
import { IndexHtmlTransform } from '../utils/index-file/index-html-generator';
import { Schema } from './schema';
export declare type DevServerBuilderOptions = Schema & json.JsonObject;
/**
* @experimental Direct usage of this type is considered experimental.
*/
export declare type DevServerBuilderOutput = DevServerBuildOutput & {
baseUrl: string;
};
/**
* Reusable implementation of the Angular Webpack development server builder.
* @param options Dev Server options.
* @param context The build context.
* @param transforms A map of transforms that can be used to hook into some logic (such as
* transforming webpack configuration before passing it to webpack).
*
* @experimental Direct usage of this function is considered experimental.
*/
export declare function serveWebpackBrowser(options: DevServerBuilderOptions, context: BuilderContext, transforms?: {
webpackConfiguration?: ExecutionTransformer<webpack.Configuration>;
logging?: WebpackLoggingCallback;
indexHtml?: IndexHtmlTransform;
}): Observable<DevServerBuilderOutput>;
declare const _default: import("@angular-devkit/architect/src/internal").Builder<Schema & json.JsonObject>;
export default _default;

View file

@ -0,0 +1,338 @@
"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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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.serveWebpackBrowser = void 0;
const architect_1 = require("@angular-devkit/architect");
const build_webpack_1 = require("@angular-devkit/build-webpack");
const core_1 = require("@angular-devkit/core");
const path = __importStar(require("path"));
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
const ts = __importStar(require("typescript"));
const url = __importStar(require("url"));
const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
const schema_1 = require("../browser/schema");
const utils_1 = require("../utils");
const cache_path_1 = require("../utils/cache-path");
const check_port_1 = require("../utils/check-port");
const color_1 = require("../utils/color");
const package_chunk_sort_1 = require("../utils/package-chunk-sort");
const read_tsconfig_1 = require("../utils/read-tsconfig");
const version_1 = require("../utils/version");
const webpack_browser_config_1 = require("../utils/webpack-browser-config");
const configs_1 = require("../webpack/configs");
const index_html_webpack_plugin_1 = require("../webpack/plugins/index-html-webpack-plugin");
const stats_1 = require("../webpack/utils/stats");
const devServerBuildOverriddenKeys = [
'watch',
'optimization',
'aot',
'sourceMap',
'vendorChunk',
'commonChunk',
'baseHref',
'progress',
'poll',
'verbose',
'deployUrl',
];
/**
* Reusable implementation of the Angular Webpack development server builder.
* @param options Dev Server options.
* @param context The build context.
* @param transforms A map of transforms that can be used to hook into some logic (such as
* transforming webpack configuration before passing it to webpack).
*
* @experimental Direct usage of this function is considered experimental.
*/
// eslint-disable-next-line max-lines-per-function
function serveWebpackBrowser(options, context, transforms = {}) {
// Check Angular version.
const { logger, workspaceRoot } = context;
version_1.assertCompatibleAngularVersion(workspaceRoot);
const browserTarget = architect_1.targetFromTargetString(options.browserTarget);
async function setup() {
var _a, _b;
// Get the browser configuration from the target name.
const rawBrowserOptions = (await context.getTargetOptions(browserTarget));
options.port = await check_port_1.checkPort((_a = options.port) !== null && _a !== void 0 ? _a : 4200, options.host || 'localhost');
// Override options we need to override, if defined.
const overrides = Object.keys(options)
.filter((key) => options[key] !== undefined && devServerBuildOverriddenKeys.includes(key))
.reduce((previous, key) => ({
...previous,
[key]: options[key],
}), {});
const devServerOptions = Object.keys(options)
.filter((key) => !devServerBuildOverriddenKeys.includes(key) && key !== 'browserTarget')
.reduce((previous, key) => ({
...previous,
[key]: options[key],
}), {});
// In dev server we should not have budgets because of extra libs such as socks-js
overrides.budgets = undefined;
if (rawBrowserOptions.outputHashing && rawBrowserOptions.outputHashing !== schema_1.OutputHashing.None) {
// Disable output hashing for dev build as this can cause memory leaks
// See: https://github.com/webpack/webpack-dev-server/issues/377#issuecomment-241258405
overrides.outputHashing = schema_1.OutputHashing.None;
logger.warn(`Warning: 'outputHashing' option is disabled when using the dev-server.`);
}
if (options.hmr) {
logger.warn(core_1.tags.stripIndents `NOTICE: Hot Module Replacement (HMR) is enabled for the dev server.
See https://webpack.js.org/guides/hot-module-replacement for information on working with HMR for Webpack.`);
}
if (!options.disableHostCheck &&
options.host &&
!/^127\.\d+\.\d+\.\d+/g.test(options.host) &&
options.host !== 'localhost') {
logger.warn(core_1.tags.stripIndent `
Warning: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.
Binding this server to an open connection can result in compromising your application or
computer. Using a different host than the one passed to the "--host" flag might result in
websocket connection issues. You might need to use "--disable-host-check" if that's the
case.
`);
}
if (options.disableHostCheck) {
logger.warn(core_1.tags.oneLine `
Warning: Running a server with --disable-host-check is a security risk.
See https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
for more information.
`);
}
// Webpack's live reload functionality adds the `strip-ansi` package which is commonJS
(_b = rawBrowserOptions.allowedCommonJsDependencies) !== null && _b !== void 0 ? _b : (rawBrowserOptions.allowedCommonJsDependencies = []);
rawBrowserOptions.allowedCommonJsDependencies.push('strip-ansi');
const browserName = await context.getBuilderNameForTarget(browserTarget);
const browserOptions = (await context.validateOptions({ ...rawBrowserOptions, ...overrides }, browserName));
const { styles, scripts } = utils_1.normalizeOptimization(browserOptions.optimization);
if (scripts || styles.minify) {
logger.error(core_1.tags.stripIndents `
****************************************************************************************
This is a simple server for use in testing or debugging Angular applications locally.
It hasn't been reviewed for security issues.
DON'T USE IT FOR PRODUCTION!
****************************************************************************************
`);
}
const { config, projectRoot, i18n } = await webpack_browser_config_1.generateI18nBrowserWebpackConfigFromContext(browserOptions, context, (wco) => [
configs_1.getDevServerConfig(wco),
configs_1.getCommonConfig(wco),
configs_1.getBrowserConfig(wco),
configs_1.getStylesConfig(wco),
configs_1.getStatsConfig(wco),
configs_1.getAnalyticsConfig(wco, context),
configs_1.getTypeScriptConfig(wco),
browserOptions.webWorkerTsConfig ? configs_1.getWorkerConfig(wco) : {},
], devServerOptions);
if (!config.devServer) {
throw new Error('Webpack Dev Server configuration was not set.');
}
if (options.liveReload && !options.hmr) {
// This is needed because we cannot use the inline option directly in the config
// because of the SuppressExtractedTextChunksWebpackPlugin
// Consider not using SuppressExtractedTextChunksWebpackPlugin when liveReload is enable.
webpack_dev_server_1.default.addDevServerEntrypoints(config, {
...config.devServer,
inline: true,
});
// Remove live-reload code from all entrypoints but not main.
// Otherwise this will break SuppressExtractedTextChunksWebpackPlugin because
// 'addDevServerEntrypoints' adds addional entry-points to all entries.
if (config.entry &&
typeof config.entry === 'object' &&
!Array.isArray(config.entry) &&
config.entry.main) {
for (const [key, value] of Object.entries(config.entry)) {
if (key === 'main' || !Array.isArray(value)) {
continue;
}
const webpackClientScriptIndex = value.findIndex((x) => x.includes('webpack-dev-server/client/index.js'));
if (webpackClientScriptIndex >= 0) {
// Remove the webpack-dev-server/client script from array.
value.splice(webpackClientScriptIndex, 1);
}
}
}
}
let locale;
if (i18n.shouldInline) {
// Dev-server only supports one locale
locale = [...i18n.inlineLocales][0];
}
else if (i18n.hasDefinedSourceLocale) {
// use source locale if not localizing
locale = i18n.sourceLocale;
}
let webpackConfig = config;
// If a locale is defined, setup localization
if (locale) {
// Only supported with Ivy
const tsConfig = read_tsconfig_1.readTsconfig(browserOptions.tsConfig, workspaceRoot);
if (tsConfig.options.enableIvy !== false) {
if (i18n.inlineLocales.size > 1) {
throw new Error('The development server only supports localizing a single locale per build.');
}
await setupLocalize(locale, i18n, browserOptions, webpackConfig);
}
}
if (transforms.webpackConfiguration) {
webpackConfig = await transforms.webpackConfiguration(webpackConfig);
}
return {
browserOptions,
webpackConfig,
projectRoot,
locale,
};
}
return rxjs_1.from(setup()).pipe(operators_1.switchMap(({ browserOptions, webpackConfig, projectRoot, locale }) => {
if (browserOptions.index) {
const { scripts = [], styles = [], baseHref, tsConfig } = browserOptions;
const { options: compilerOptions } = read_tsconfig_1.readTsconfig(tsConfig, workspaceRoot);
const target = compilerOptions.target || ts.ScriptTarget.ES5;
const buildBrowserFeatures = new utils_1.BuildBrowserFeatures(projectRoot);
const entrypoints = package_chunk_sort_1.generateEntryPoints({ scripts, styles });
const moduleEntrypoints = buildBrowserFeatures.isDifferentialLoadingNeeded(target)
? package_chunk_sort_1.generateEntryPoints({ scripts: [], styles })
: [];
webpackConfig.plugins = [...(webpackConfig.plugins || [])];
webpackConfig.plugins.push(new index_html_webpack_plugin_1.IndexHtmlWebpackPlugin({
indexPath: path.resolve(workspaceRoot, webpack_browser_config_1.getIndexInputFile(browserOptions.index)),
outputPath: webpack_browser_config_1.getIndexOutputFile(browserOptions.index),
baseHref,
entrypoints,
moduleEntrypoints,
noModuleEntrypoints: ['polyfills-es5'],
deployUrl: browserOptions.deployUrl,
sri: browserOptions.subresourceIntegrity,
postTransform: transforms.indexHtml,
optimization: utils_1.normalizeOptimization(browserOptions.optimization),
WOFFSupportNeeded: !buildBrowserFeatures.isFeatureSupported('woff2'),
crossOrigin: browserOptions.crossOrigin,
lang: locale,
}));
}
return build_webpack_1.runWebpackDevServer(webpackConfig, context, {
logging: transforms.logging || stats_1.createWebpackLoggingCallback(browserOptions, logger),
webpackFactory: require('webpack'),
webpackDevServerFactory: require('webpack-dev-server'),
}).pipe(operators_1.concatMap(async (buildEvent, index) => {
var _a;
// Resolve serve address.
const serverAddress = url.format({
protocol: options.ssl ? 'https' : 'http',
hostname: options.host === '0.0.0.0' ? 'localhost' : options.host,
pathname: (_a = webpackConfig.devServer) === null || _a === void 0 ? void 0 : _a.publicPath,
port: buildEvent.port,
});
if (index === 0) {
logger.info('\n' +
core_1.tags.oneLine `
**
Angular Live Development Server is listening on ${options.host}:${buildEvent.port},
open your browser on ${serverAddress}
**
` +
'\n');
if (options.open) {
const open = (await Promise.resolve().then(() => __importStar(require('open')))).default;
await open(serverAddress);
}
}
if (buildEvent.success) {
logger.info(`\n${color_1.colors.greenBright(color_1.colors.symbols.check)} Compiled successfully.`);
}
return { ...buildEvent, baseUrl: serverAddress };
}));
}));
}
exports.serveWebpackBrowser = serveWebpackBrowser;
async function setupLocalize(locale, i18n, browserOptions, webpackConfig) {
var _a;
const localeDescription = i18n.locales[locale];
// Modify main entrypoint to include locale data
if ((localeDescription === null || localeDescription === void 0 ? void 0 : localeDescription.dataPath) &&
typeof webpackConfig.entry === 'object' &&
!Array.isArray(webpackConfig.entry) &&
webpackConfig.entry['main']) {
if (Array.isArray(webpackConfig.entry['main'])) {
webpackConfig.entry['main'].unshift(localeDescription.dataPath);
}
else {
webpackConfig.entry['main'] = [
localeDescription.dataPath,
webpackConfig.entry['main'],
];
}
}
let missingTranslationBehavior = browserOptions.i18nMissingTranslation || 'ignore';
let translation = (localeDescription === null || localeDescription === void 0 ? void 0 : localeDescription.translation) || {};
if (locale === i18n.sourceLocale) {
missingTranslationBehavior = 'ignore';
translation = {};
}
const i18nLoaderOptions = {
locale,
missingTranslationBehavior,
translation: i18n.shouldInline ? translation : undefined,
};
const i18nRule = {
test: /\.(?:[cm]?js|ts)$/,
enforce: 'post',
use: [
{
loader: require.resolve('../babel/webpack-loader'),
options: {
cacheDirectory: cache_path_1.findCachePath('babel-dev-server-i18n'),
cacheIdentifier: JSON.stringify({
locale,
translationIntegrity: localeDescription === null || localeDescription === void 0 ? void 0 : localeDescription.files.map((file) => file.integrity),
}),
i18n: i18nLoaderOptions,
},
},
],
};
// Get the rules and ensure the Webpack configuration is setup properly
const rules = ((_a = webpackConfig.module) === null || _a === void 0 ? void 0 : _a.rules) || [];
if (!webpackConfig.module) {
webpackConfig.module = { rules };
}
else if (!webpackConfig.module.rules) {
webpackConfig.module.rules = rules;
}
rules.push(i18nRule);
}
exports.default = architect_1.createBuilder(serveWebpackBrowser);

View file

@ -0,0 +1,179 @@
/**
* Dev Server target options for Build Facade.
*/
export interface Schema {
/**
* List of hosts that are allowed to access the dev server.
*/
allowedHosts?: string[];
/**
* Build using Ahead of Time compilation.
* @deprecated Use the "aot" option in the browser builder instead.
*/
aot?: boolean;
/**
* Base url for the application being built.
* @deprecated Use the "baseHref" option in the browser builder instead.
*/
baseHref?: string;
/**
* A browser builder target to serve 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;
/**
* Generate a seperate bundle containing code used across multiple bundles.
* @deprecated Use the "commonChunk" option in the browser builder instead.
*/
commonChunk?: boolean;
/**
* URL where files will be deployed.
* @deprecated Use the "deployUrl" option in the browser builder instead.
*/
deployUrl?: string;
/**
* Don't verify connected clients are part of allowed hosts.
*/
disableHostCheck?: boolean;
/**
* Custom HTTP headers to be added to all responses.
*/
headers?: {
[key: string]: string;
};
/**
* Enable hot module replacement.
*/
hmr?: boolean;
/**
* Show a warning when the --hmr option is enabled.
* @deprecated No longer has an effect.
*/
hmrWarning?: boolean;
/**
* Host to listen on.
*/
host?: string;
/**
* Whether to reload the page on change, using live-reload.
*/
liveReload?: boolean;
/**
* Opens the url in default browser.
*/
open?: boolean;
/**
* Enables optimization of the build output. Including minification of scripts and styles,
* tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more
* information, see https://angular.io/guide/workspace-config#optimization-configuration.
* @deprecated Use the "optimization" option in the browser builder instead.
*/
optimization?: OptimizationUnion;
/**
* Enable and define the file watching poll time period in milliseconds.
*/
poll?: number;
/**
* Port to listen on.
*/
port?: number;
/**
* Log progress to the console while building.
* @deprecated Use the "progress" option in the browser builder instead.
*/
progress?: boolean;
/**
* Proxy configuration file. For more information, see
* https://angular.io/guide/build#proxying-to-a-backend-server.
*/
proxyConfig?: string;
/**
* The URL that the browser client (or live-reload client, if enabled) should use to connect
* to the development server. Use for a complex dev server setup, such as one with reverse
* proxies.
*/
publicHost?: string;
/**
* The pathname where the app will be served.
*/
servePath?: string;
/**
* Show a warning when deploy-url/base-href use unsupported serve path values.
* @deprecated No longer has an effect.
*/
servePathDefaultWarning?: boolean;
/**
* Output source maps for scripts and styles. For more information, see
* https://angular.io/guide/workspace-config#source-map-configuration.
* @deprecated Use the "sourceMap" option in the browser builder instead.
*/
sourceMap?: SourceMapUnion;
/**
* Serve using HTTPS.
*/
ssl?: boolean;
/**
* SSL certificate to use for serving HTTPS.
*/
sslCert?: string;
/**
* SSL key to use for serving HTTPS.
*/
sslKey?: string;
/**
* Generate a seperate bundle containing only vendor libraries. This option should only used
* for development.
* @deprecated Use the "vendorChunk" option in the browser builder instead.
*/
vendorChunk?: boolean;
/**
* Adds more details to output logging.
*/
verbose?: boolean;
/**
* Rebuild on change.
*/
watch?: boolean;
}
/**
* Enables optimization of the build output. Including minification of scripts and styles,
* tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more
* information, see https://angular.io/guide/workspace-config#optimization-configuration.
* @deprecated Use the "optimization" option in the browser builder instead.
*/
export declare type OptimizationUnion = boolean | OptimizationClass;
export interface OptimizationClass {
/**
* Enables optimization of the scripts output.
*/
scripts?: boolean;
/**
* Enables optimization of the styles output.
*/
styles?: boolean;
}
/**
* Output source maps for scripts and styles. For more information, see
* https://angular.io/guide/workspace-config#source-map-configuration.
* @deprecated Use the "sourceMap" option in the browser builder instead.
*/
export declare 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;
}

View 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 });

Some files were not shown because too many files have changed in this diff Show more