Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
42
my-app/node_modules/@angular-devkit/schematics/tools/description.d.ts
generated
vendored
Executable file
42
my-app/node_modules/@angular-devkit/schematics/tools/description.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { JsonObject } from '@angular-devkit/core';
|
||||
import { Collection, CollectionDescription, Engine, EngineHost, RuleFactory, Schematic, SchematicDescription, TypedSchematicContext } from '../src';
|
||||
export interface FileSystemCollectionDescription {
|
||||
readonly name: string;
|
||||
readonly path: string;
|
||||
readonly version?: string;
|
||||
readonly schematics: {
|
||||
[name: string]: FileSystemSchematicDesc;
|
||||
};
|
||||
readonly encapsulation?: boolean;
|
||||
}
|
||||
export interface FileSystemSchematicJsonDescription {
|
||||
readonly aliases?: string[];
|
||||
readonly factory: string;
|
||||
readonly name: string;
|
||||
readonly collection: FileSystemCollectionDescription;
|
||||
readonly description: string;
|
||||
readonly schema?: string;
|
||||
readonly extends?: string;
|
||||
}
|
||||
export interface FileSystemSchematicDescription extends FileSystemSchematicJsonDescription {
|
||||
readonly path: string;
|
||||
readonly schemaJson?: JsonObject;
|
||||
readonly factoryFn: RuleFactory<{}>;
|
||||
}
|
||||
/**
|
||||
* Used to simplify typings.
|
||||
*/
|
||||
export declare type FileSystemEngine = Engine<FileSystemCollectionDescription, FileSystemSchematicDescription>;
|
||||
export declare type FileSystemEngineHost = EngineHost<FileSystemCollectionDescription, FileSystemSchematicDescription>;
|
||||
export declare type FileSystemCollection = Collection<FileSystemCollectionDescription, FileSystemSchematicDescription>;
|
||||
export declare type FileSystemSchematic = Schematic<FileSystemCollectionDescription, FileSystemSchematicDescription>;
|
||||
export declare type FileSystemCollectionDesc = CollectionDescription<FileSystemCollectionDescription>;
|
||||
export declare type FileSystemSchematicDesc = SchematicDescription<FileSystemCollectionDescription, FileSystemSchematicDescription>;
|
||||
export declare type FileSystemSchematicContext = TypedSchematicContext<FileSystemCollectionDescription, FileSystemSchematicDescription>;
|
9
my-app/node_modules/@angular-devkit/schematics/tools/description.js
generated
vendored
Executable file
9
my-app/node_modules/@angular-devkit/schematics/tools/description.js
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
16
my-app/node_modules/@angular-devkit/schematics/tools/export-ref.d.ts
generated
vendored
Executable file
16
my-app/node_modules/@angular-devkit/schematics/tools/export-ref.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @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 class ExportStringRef<T> {
|
||||
private _ref?;
|
||||
private _module;
|
||||
private _path;
|
||||
constructor(ref: string, parentPath?: string, inner?: boolean);
|
||||
get ref(): T | undefined;
|
||||
get module(): string;
|
||||
get path(): string;
|
||||
}
|
38
my-app/node_modules/@angular-devkit/schematics/tools/export-ref.js
generated
vendored
Executable file
38
my-app/node_modules/@angular-devkit/schematics/tools/export-ref.js
generated
vendored
Executable file
|
@ -0,0 +1,38 @@
|
|||
"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.ExportStringRef = void 0;
|
||||
const path_1 = require("path");
|
||||
class ExportStringRef {
|
||||
_ref;
|
||||
_module;
|
||||
_path;
|
||||
constructor(ref, parentPath = process.cwd(), inner = true) {
|
||||
const [path, name] = ref.split('#', 2);
|
||||
this._module = path[0] == '.' ? (0, path_1.resolve)(parentPath, path) : path;
|
||||
this._module = require.resolve(this._module);
|
||||
this._path = (0, path_1.dirname)(this._module);
|
||||
if (inner) {
|
||||
this._ref = require(this._module)[name || 'default'];
|
||||
}
|
||||
else {
|
||||
this._ref = require(this._module);
|
||||
}
|
||||
}
|
||||
get ref() {
|
||||
return this._ref;
|
||||
}
|
||||
get module() {
|
||||
return this._module;
|
||||
}
|
||||
get path() {
|
||||
return this._path;
|
||||
}
|
||||
}
|
||||
exports.ExportStringRef = ExportStringRef;
|
37
my-app/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.d.ts
generated
vendored
Executable file
37
my-app/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* @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="@types/node/url" />
|
||||
/// <reference types="@types/node/ts4.8/url" />
|
||||
import { Observable } from 'rxjs';
|
||||
import { Url } from 'url';
|
||||
import { CollectionDescription, EngineHost, RuleFactory, SchematicDescription, Source, TaskExecutor, TypedSchematicContext } from '../src';
|
||||
export type FallbackCollectionDescription = {
|
||||
host: EngineHost<{}, {}>;
|
||||
description: CollectionDescription<{}>;
|
||||
};
|
||||
export type FallbackSchematicDescription = {
|
||||
description: SchematicDescription<{}, {}>;
|
||||
};
|
||||
export type FallbackContext = TypedSchematicContext<FallbackCollectionDescription, FallbackSchematicDescription>;
|
||||
/**
|
||||
* An EngineHost that support multiple hosts in a fallback configuration. If a host does not
|
||||
* have a collection/schematics, use the following host before giving up.
|
||||
*/
|
||||
export declare class FallbackEngineHost implements EngineHost<{}, {}> {
|
||||
private _hosts;
|
||||
addHost<CollectionT extends object, SchematicT extends object>(host: EngineHost<CollectionT, SchematicT>): void;
|
||||
createCollectionDescription(name: string, requester?: CollectionDescription<{}>): CollectionDescription<FallbackCollectionDescription>;
|
||||
createSchematicDescription(name: string, collection: CollectionDescription<FallbackCollectionDescription>): SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription> | null;
|
||||
getSchematicRuleFactory<OptionT extends object>(schematic: SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription>, collection: CollectionDescription<FallbackCollectionDescription>): RuleFactory<OptionT>;
|
||||
createSourceFromUrl(url: Url, context: FallbackContext): Source | null;
|
||||
transformOptions<OptionT extends object, ResultT extends object>(schematic: SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription>, options: OptionT, context?: FallbackContext): Observable<ResultT>;
|
||||
transformContext(context: FallbackContext): FallbackContext;
|
||||
listSchematicNames(collection: CollectionDescription<FallbackCollectionDescription>, includeHidden?: boolean): string[];
|
||||
createTaskExecutor(name: string): Observable<TaskExecutor>;
|
||||
hasTaskExecutor(name: string): boolean;
|
||||
}
|
85
my-app/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.js
generated
vendored
Executable file
85
my-app/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.js
generated
vendored
Executable file
|
@ -0,0 +1,85 @@
|
|||
"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.FallbackEngineHost = void 0;
|
||||
const rxjs_1 = require("rxjs");
|
||||
const src_1 = require("../src");
|
||||
/**
|
||||
* An EngineHost that support multiple hosts in a fallback configuration. If a host does not
|
||||
* have a collection/schematics, use the following host before giving up.
|
||||
*/
|
||||
class FallbackEngineHost {
|
||||
_hosts = [];
|
||||
addHost(host) {
|
||||
this._hosts.push(host);
|
||||
}
|
||||
createCollectionDescription(name, requester) {
|
||||
for (const host of this._hosts) {
|
||||
try {
|
||||
const description = host.createCollectionDescription(name, requester);
|
||||
return { name, host, description };
|
||||
}
|
||||
catch (_) { }
|
||||
}
|
||||
throw new src_1.UnknownCollectionException(name);
|
||||
}
|
||||
createSchematicDescription(name, collection) {
|
||||
const description = collection.host.createSchematicDescription(name, collection.description);
|
||||
if (!description) {
|
||||
return null;
|
||||
}
|
||||
return { name, collection, description };
|
||||
}
|
||||
getSchematicRuleFactory(schematic, collection) {
|
||||
return collection.host.getSchematicRuleFactory(schematic.description, collection.description);
|
||||
}
|
||||
createSourceFromUrl(url, context) {
|
||||
return context.schematic.collection.description.host.createSourceFromUrl(url, context);
|
||||
}
|
||||
transformOptions(schematic, options, context) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return (0, rxjs_1.of)(options).pipe(...this._hosts.map((host) => (0, rxjs_1.mergeMap)((opt) => host.transformOptions(schematic, opt, context))));
|
||||
}
|
||||
transformContext(context) {
|
||||
let result = context;
|
||||
this._hosts.forEach((host) => {
|
||||
result = (host.transformContext(result) || result);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
listSchematicNames(collection, includeHidden) {
|
||||
const allNames = new Set();
|
||||
this._hosts.forEach((host) => {
|
||||
try {
|
||||
host
|
||||
.listSchematicNames(collection.description, includeHidden)
|
||||
.forEach((name) => allNames.add(name));
|
||||
}
|
||||
catch (_) { }
|
||||
});
|
||||
return [...allNames];
|
||||
}
|
||||
createTaskExecutor(name) {
|
||||
for (const host of this._hosts) {
|
||||
if (host.hasTaskExecutor(name)) {
|
||||
return host.createTaskExecutor(name);
|
||||
}
|
||||
}
|
||||
return (0, rxjs_1.throwError)(new src_1.UnregisteredTaskException(name));
|
||||
}
|
||||
hasTaskExecutor(name) {
|
||||
for (const host of this._hosts) {
|
||||
if (host.hasTaskExecutor(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.FallbackEngineHost = FallbackEngineHost;
|
76
my-app/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.d.ts
generated
vendored
Executable file
76
my-app/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* @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="@types/node/url" />
|
||||
/// <reference types="@types/node/ts4.8/url" />
|
||||
import { BaseException } from '@angular-devkit/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Url } from 'url';
|
||||
import { RuleFactory, Source, TaskExecutor, TaskExecutorFactory } from '../src';
|
||||
import { FileSystemCollectionDesc, FileSystemEngineHost, FileSystemSchematicContext, FileSystemSchematicDesc, FileSystemSchematicDescription } from './description';
|
||||
export declare type OptionTransform<T extends object | null, R extends object> = (schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext) => Observable<R> | PromiseLike<R> | R;
|
||||
export declare type ContextTransform = (context: FileSystemSchematicContext) => FileSystemSchematicContext;
|
||||
export declare class CollectionCannotBeResolvedException extends BaseException {
|
||||
constructor(name: string);
|
||||
}
|
||||
export declare class InvalidCollectionJsonException extends BaseException {
|
||||
constructor(_name: string, path: string, jsonException?: Error);
|
||||
}
|
||||
export declare class SchematicMissingFactoryException extends BaseException {
|
||||
constructor(name: string);
|
||||
}
|
||||
export declare class FactoryCannotBeResolvedException extends BaseException {
|
||||
constructor(name: string);
|
||||
}
|
||||
export declare class CollectionMissingSchematicsMapException extends BaseException {
|
||||
constructor(name: string);
|
||||
}
|
||||
export declare class CollectionMissingFieldsException extends BaseException {
|
||||
constructor(name: string);
|
||||
}
|
||||
export declare class SchematicMissingFieldsException extends BaseException {
|
||||
constructor(name: string);
|
||||
}
|
||||
export declare class SchematicMissingDescriptionException extends BaseException {
|
||||
constructor(name: string);
|
||||
}
|
||||
export declare class SchematicNameCollisionException extends BaseException {
|
||||
constructor(name: string);
|
||||
}
|
||||
/**
|
||||
* A EngineHost base class that uses the file system to resolve collections. This is the base of
|
||||
* all other EngineHost provided by the tooling part of the Schematics library.
|
||||
*/
|
||||
export declare abstract class FileSystemEngineHostBase implements FileSystemEngineHost {
|
||||
protected abstract _resolveCollectionPath(name: string, requester?: string): string;
|
||||
protected abstract _resolveReferenceString(name: string, parentPath: string, collectionDescription: FileSystemCollectionDesc): {
|
||||
ref: RuleFactory<{}>;
|
||||
path: string;
|
||||
} | null;
|
||||
protected abstract _transformCollectionDescription(name: string, desc: Partial<FileSystemCollectionDesc>): FileSystemCollectionDesc;
|
||||
protected abstract _transformSchematicDescription(name: string, collection: FileSystemCollectionDesc, desc: Partial<FileSystemSchematicDesc>): FileSystemSchematicDesc;
|
||||
private _transforms;
|
||||
private _contextTransforms;
|
||||
private _taskFactories;
|
||||
listSchematicNames(collection: FileSystemCollectionDesc, includeHidden?: boolean): string[];
|
||||
registerOptionsTransform<T extends object | null, R extends object>(t: OptionTransform<T, R>): void;
|
||||
registerContextTransform(t: ContextTransform): void;
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @return {{path: string}}
|
||||
*/
|
||||
createCollectionDescription(name: string, requester?: FileSystemCollectionDesc): FileSystemCollectionDesc;
|
||||
createSchematicDescription(name: string, collection: FileSystemCollectionDesc): FileSystemSchematicDesc | null;
|
||||
createSourceFromUrl(url: Url): Source | null;
|
||||
transformOptions<OptionT extends object, ResultT extends object>(schematic: FileSystemSchematicDesc, options: OptionT, context?: FileSystemSchematicContext): Observable<ResultT>;
|
||||
transformContext(context: FileSystemSchematicContext): FileSystemSchematicContext;
|
||||
getSchematicRuleFactory<OptionT extends object>(schematic: FileSystemSchematicDesc, _collection: FileSystemCollectionDesc): RuleFactory<OptionT>;
|
||||
registerTaskExecutor<T>(factory: TaskExecutorFactory<T>, options?: T): void;
|
||||
createTaskExecutor(name: string): Observable<TaskExecutor>;
|
||||
hasTaskExecutor(name: string): boolean;
|
||||
}
|
259
my-app/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js
generated
vendored
Executable file
259
my-app/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js
generated
vendored
Executable file
|
@ -0,0 +1,259 @@
|
|||
"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.FileSystemEngineHostBase = exports.SchematicNameCollisionException = exports.SchematicMissingDescriptionException = exports.SchematicMissingFieldsException = exports.CollectionMissingFieldsException = exports.CollectionMissingSchematicsMapException = exports.FactoryCannotBeResolvedException = exports.SchematicMissingFactoryException = exports.InvalidCollectionJsonException = exports.CollectionCannotBeResolvedException = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const node_1 = require("@angular-devkit/core/node");
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = require("path");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const src_1 = require("../src");
|
||||
const file_system_utility_1 = require("./file-system-utility");
|
||||
class CollectionCannotBeResolvedException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Collection ${JSON.stringify(name)} cannot be resolved.`);
|
||||
}
|
||||
}
|
||||
exports.CollectionCannotBeResolvedException = CollectionCannotBeResolvedException;
|
||||
class InvalidCollectionJsonException extends core_1.BaseException {
|
||||
constructor(_name, path, jsonException) {
|
||||
let msg = `Collection JSON at path ${JSON.stringify(path)} is invalid.`;
|
||||
if (jsonException) {
|
||||
msg = `${msg} ${jsonException.message}`;
|
||||
}
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
exports.InvalidCollectionJsonException = InvalidCollectionJsonException;
|
||||
class SchematicMissingFactoryException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Schematic ${JSON.stringify(name)} is missing a factory.`);
|
||||
}
|
||||
}
|
||||
exports.SchematicMissingFactoryException = SchematicMissingFactoryException;
|
||||
class FactoryCannotBeResolvedException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Schematic ${JSON.stringify(name)} cannot resolve the factory.`);
|
||||
}
|
||||
}
|
||||
exports.FactoryCannotBeResolvedException = FactoryCannotBeResolvedException;
|
||||
class CollectionMissingSchematicsMapException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Collection "${name}" does not have a schematics map.`);
|
||||
}
|
||||
}
|
||||
exports.CollectionMissingSchematicsMapException = CollectionMissingSchematicsMapException;
|
||||
class CollectionMissingFieldsException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Collection "${name}" is missing fields.`);
|
||||
}
|
||||
}
|
||||
exports.CollectionMissingFieldsException = CollectionMissingFieldsException;
|
||||
class SchematicMissingFieldsException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Schematic "${name}" is missing fields.`);
|
||||
}
|
||||
}
|
||||
exports.SchematicMissingFieldsException = SchematicMissingFieldsException;
|
||||
class SchematicMissingDescriptionException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Schematics "${name}" does not have a description.`);
|
||||
}
|
||||
}
|
||||
exports.SchematicMissingDescriptionException = SchematicMissingDescriptionException;
|
||||
class SchematicNameCollisionException extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Schematics/alias ${JSON.stringify(name)} collides with another alias or schematic` +
|
||||
' name.');
|
||||
}
|
||||
}
|
||||
exports.SchematicNameCollisionException = SchematicNameCollisionException;
|
||||
/**
|
||||
* A EngineHost base class that uses the file system to resolve collections. This is the base of
|
||||
* all other EngineHost provided by the tooling part of the Schematics library.
|
||||
*/
|
||||
class FileSystemEngineHostBase {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
_transforms = [];
|
||||
_contextTransforms = [];
|
||||
_taskFactories = new Map();
|
||||
listSchematicNames(collection, includeHidden) {
|
||||
const schematics = [];
|
||||
for (const key of Object.keys(collection.schematics)) {
|
||||
const schematic = collection.schematics[key];
|
||||
if ((schematic.hidden && !includeHidden) || schematic.private) {
|
||||
continue;
|
||||
}
|
||||
// If extends is present without a factory it is an alias, do not return it
|
||||
// unless it is from another collection.
|
||||
if (!schematic.extends || schematic.factory) {
|
||||
schematics.push(key);
|
||||
}
|
||||
else if (schematic.extends && schematic.extends.indexOf(':') !== -1) {
|
||||
schematics.push(key);
|
||||
}
|
||||
}
|
||||
return schematics;
|
||||
}
|
||||
registerOptionsTransform(t) {
|
||||
this._transforms.push(t);
|
||||
}
|
||||
registerContextTransform(t) {
|
||||
this._contextTransforms.push(t);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @return {{path: string}}
|
||||
*/
|
||||
createCollectionDescription(name, requester) {
|
||||
const path = this._resolveCollectionPath(name, requester?.path);
|
||||
const jsonValue = (0, file_system_utility_1.readJsonFile)(path);
|
||||
if (!jsonValue || typeof jsonValue != 'object' || Array.isArray(jsonValue)) {
|
||||
throw new InvalidCollectionJsonException(name, path);
|
||||
}
|
||||
// normalize extends property to an array
|
||||
if (typeof jsonValue['extends'] === 'string') {
|
||||
jsonValue['extends'] = [jsonValue['extends']];
|
||||
}
|
||||
const description = this._transformCollectionDescription(name, {
|
||||
...jsonValue,
|
||||
path,
|
||||
});
|
||||
if (!description || !description.name) {
|
||||
throw new InvalidCollectionJsonException(name, path);
|
||||
}
|
||||
// Validate aliases.
|
||||
const allNames = Object.keys(description.schematics);
|
||||
for (const schematicName of Object.keys(description.schematics)) {
|
||||
const aliases = description.schematics[schematicName].aliases || [];
|
||||
for (const alias of aliases) {
|
||||
if (allNames.indexOf(alias) != -1) {
|
||||
throw new SchematicNameCollisionException(alias);
|
||||
}
|
||||
}
|
||||
allNames.push(...aliases);
|
||||
}
|
||||
return description;
|
||||
}
|
||||
createSchematicDescription(name, collection) {
|
||||
// Resolve aliases first.
|
||||
for (const schematicName of Object.keys(collection.schematics)) {
|
||||
const schematicDescription = collection.schematics[schematicName];
|
||||
if (schematicDescription.aliases && schematicDescription.aliases.indexOf(name) != -1) {
|
||||
name = schematicName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!(name in collection.schematics)) {
|
||||
return null;
|
||||
}
|
||||
const collectionPath = (0, path_1.dirname)(collection.path);
|
||||
const partialDesc = collection.schematics[name];
|
||||
if (!partialDesc) {
|
||||
return null;
|
||||
}
|
||||
if (partialDesc.extends) {
|
||||
const index = partialDesc.extends.indexOf(':');
|
||||
const collectionName = index !== -1 ? partialDesc.extends.slice(0, index) : null;
|
||||
const schematicName = index === -1 ? partialDesc.extends : partialDesc.extends.slice(index + 1);
|
||||
if (collectionName !== null) {
|
||||
const extendCollection = this.createCollectionDescription(collectionName);
|
||||
return this.createSchematicDescription(schematicName, extendCollection);
|
||||
}
|
||||
else {
|
||||
return this.createSchematicDescription(schematicName, collection);
|
||||
}
|
||||
}
|
||||
// Use any on this ref as we don't have the OptionT here, but we don't need it (we only need
|
||||
// the path).
|
||||
if (!partialDesc.factory) {
|
||||
throw new SchematicMissingFactoryException(name);
|
||||
}
|
||||
const resolvedRef = this._resolveReferenceString(partialDesc.factory, collectionPath, collection);
|
||||
if (!resolvedRef) {
|
||||
throw new FactoryCannotBeResolvedException(name);
|
||||
}
|
||||
let schema = partialDesc.schema;
|
||||
let schemaJson = undefined;
|
||||
if (schema) {
|
||||
if (!(0, path_1.isAbsolute)(schema)) {
|
||||
schema = (0, path_1.join)(collectionPath, schema);
|
||||
}
|
||||
schemaJson = (0, file_system_utility_1.readJsonFile)(schema);
|
||||
}
|
||||
// The schematic path is used to resolve URLs.
|
||||
// We should be able to just do `dirname(resolvedRef.path)` but for compatibility with
|
||||
// Bazel under Windows this directory needs to be resolved from the collection instead.
|
||||
// This is needed because on Bazel under Windows the data files (such as the collection or
|
||||
// url files) are not in the same place as the compiled JS.
|
||||
const maybePath = (0, path_1.join)(collectionPath, partialDesc.factory);
|
||||
const path = (0, fs_1.existsSync)(maybePath) && (0, fs_1.statSync)(maybePath).isDirectory() ? maybePath : (0, path_1.dirname)(maybePath);
|
||||
return this._transformSchematicDescription(name, collection, {
|
||||
...partialDesc,
|
||||
schema,
|
||||
schemaJson,
|
||||
name,
|
||||
path,
|
||||
factoryFn: resolvedRef.ref,
|
||||
collection,
|
||||
});
|
||||
}
|
||||
createSourceFromUrl(url) {
|
||||
switch (url.protocol) {
|
||||
case null:
|
||||
case 'file:':
|
||||
return (context) => {
|
||||
// Check if context has necessary FileSystemSchematicContext path property
|
||||
const fileDescription = context.schematic.description;
|
||||
if (fileDescription.path === undefined) {
|
||||
throw new Error('Unsupported schematic context. Expected a FileSystemSchematicContext.');
|
||||
}
|
||||
// Resolve all file:///a/b/c/d from the schematic's own path, and not the current
|
||||
// path.
|
||||
const root = (0, core_1.normalize)((0, path_1.resolve)(fileDescription.path, url.path || ''));
|
||||
return new src_1.HostCreateTree(new core_1.virtualFs.ScopedHost(new node_1.NodeJsSyncHost(), root));
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
transformOptions(schematic, options, context) {
|
||||
const transform = async () => {
|
||||
let transformedOptions = options;
|
||||
for (const transformer of this._transforms) {
|
||||
const transformerResult = transformer(schematic, transformedOptions, context);
|
||||
transformedOptions = await ((0, rxjs_1.isObservable)(transformerResult)
|
||||
? (0, rxjs_1.lastValueFrom)(transformerResult)
|
||||
: transformerResult);
|
||||
}
|
||||
return transformedOptions;
|
||||
};
|
||||
return (0, rxjs_1.from)(transform());
|
||||
}
|
||||
transformContext(context) {
|
||||
return this._contextTransforms.reduce((acc, curr) => curr(acc), context);
|
||||
}
|
||||
getSchematicRuleFactory(schematic, _collection) {
|
||||
return schematic.factoryFn;
|
||||
}
|
||||
registerTaskExecutor(factory, options) {
|
||||
this._taskFactories.set(factory.name, () => (0, rxjs_1.from)(factory.create(options)));
|
||||
}
|
||||
createTaskExecutor(name) {
|
||||
const factory = this._taskFactories.get(name);
|
||||
if (factory) {
|
||||
return factory();
|
||||
}
|
||||
return (0, rxjs_1.throwError)(new src_1.UnregisteredTaskException(name));
|
||||
}
|
||||
hasTaskExecutor(name) {
|
||||
return this._taskFactories.has(name);
|
||||
}
|
||||
}
|
||||
exports.FileSystemEngineHostBase = FileSystemEngineHostBase;
|
28
my-app/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.d.ts
generated
vendored
Executable file
28
my-app/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { Observable } from 'rxjs';
|
||||
import { RuleFactory, TaskExecutor } from '../src';
|
||||
import { FileSystemCollectionDesc, FileSystemSchematicDesc } from './description';
|
||||
import { FileSystemEngineHostBase } from './file-system-engine-host-base';
|
||||
/**
|
||||
* A simple EngineHost that uses a root with one directory per collection inside of it. The
|
||||
* collection declaration follows the same rules as the regular FileSystemEngineHostBase.
|
||||
*/
|
||||
export declare class FileSystemEngineHost extends FileSystemEngineHostBase {
|
||||
protected _root: string;
|
||||
constructor(_root: string);
|
||||
protected _resolveCollectionPath(name: string): string;
|
||||
protected _resolveReferenceString(refString: string, parentPath: string): {
|
||||
ref: RuleFactory<{}>;
|
||||
path: string;
|
||||
} | null;
|
||||
protected _transformCollectionDescription(name: string, desc: Partial<FileSystemCollectionDesc>): FileSystemCollectionDesc;
|
||||
protected _transformSchematicDescription(name: string, _collection: FileSystemCollectionDesc, desc: Partial<FileSystemSchematicDesc>): FileSystemSchematicDesc;
|
||||
hasTaskExecutor(name: string): boolean;
|
||||
createTaskExecutor(name: string): Observable<TaskExecutor>;
|
||||
}
|
117
my-app/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.js
generated
vendored
Executable file
117
my-app/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.js
generated
vendored
Executable file
|
@ -0,0 +1,117 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FileSystemEngineHost = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = require("path");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const src_1 = require("../src");
|
||||
const export_ref_1 = require("./export-ref");
|
||||
const file_system_engine_host_base_1 = require("./file-system-engine-host-base");
|
||||
/**
|
||||
* A simple EngineHost that uses a root with one directory per collection inside of it. The
|
||||
* collection declaration follows the same rules as the regular FileSystemEngineHostBase.
|
||||
*/
|
||||
class FileSystemEngineHost extends file_system_engine_host_base_1.FileSystemEngineHostBase {
|
||||
_root;
|
||||
constructor(_root) {
|
||||
super();
|
||||
this._root = _root;
|
||||
}
|
||||
_resolveCollectionPath(name) {
|
||||
try {
|
||||
// Allow `${_root}/${name}.json` as a collection.
|
||||
const maybePath = require.resolve((0, path_1.join)(this._root, name + '.json'));
|
||||
if ((0, fs_1.existsSync)(maybePath)) {
|
||||
return maybePath;
|
||||
}
|
||||
}
|
||||
catch (error) { }
|
||||
try {
|
||||
// Allow `${_root}/${name}/collection.json.
|
||||
const maybePath = require.resolve((0, path_1.join)(this._root, name, 'collection.json'));
|
||||
if ((0, fs_1.existsSync)(maybePath)) {
|
||||
return maybePath;
|
||||
}
|
||||
}
|
||||
catch (error) { }
|
||||
throw new file_system_engine_host_base_1.CollectionCannotBeResolvedException(name);
|
||||
}
|
||||
_resolveReferenceString(refString, parentPath) {
|
||||
// Use the same kind of export strings as NodeModule.
|
||||
const ref = new export_ref_1.ExportStringRef(refString, parentPath);
|
||||
if (!ref.ref) {
|
||||
return null;
|
||||
}
|
||||
return { ref: ref.ref, path: ref.module };
|
||||
}
|
||||
_transformCollectionDescription(name, desc) {
|
||||
if (!desc.schematics || typeof desc.schematics != 'object') {
|
||||
throw new file_system_engine_host_base_1.CollectionMissingSchematicsMapException(name);
|
||||
}
|
||||
return {
|
||||
...desc,
|
||||
name,
|
||||
};
|
||||
}
|
||||
_transformSchematicDescription(name, _collection, desc) {
|
||||
if (!desc.factoryFn || !desc.path || !desc.description) {
|
||||
throw new file_system_engine_host_base_1.SchematicMissingFieldsException(name);
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
hasTaskExecutor(name) {
|
||||
if (super.hasTaskExecutor(name)) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
const maybePath = require.resolve((0, path_1.join)(this._root, name));
|
||||
if ((0, fs_1.existsSync)(maybePath)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return false;
|
||||
}
|
||||
createTaskExecutor(name) {
|
||||
if (!super.hasTaskExecutor(name)) {
|
||||
try {
|
||||
const path = require.resolve((0, path_1.join)(this._root, name));
|
||||
// Default handling code is for old tasks that incorrectly export `default` with non-ESM module
|
||||
return (0, rxjs_1.from)(Promise.resolve(`${path}`).then(s => __importStar(require(s))).then((mod) => (mod.default?.default || mod.default)())).pipe((0, rxjs_1.catchError)(() => (0, rxjs_1.throwError)(new src_1.UnregisteredTaskException(name))));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
return super.createTaskExecutor(name);
|
||||
}
|
||||
}
|
||||
exports.FileSystemEngineHost = FileSystemEngineHost;
|
9
my-app/node_modules/@angular-devkit/schematics/tools/file-system-utility.d.ts
generated
vendored
Executable file
9
my-app/node_modules/@angular-devkit/schematics/tools/file-system-utility.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { JsonValue } from '@angular-devkit/core';
|
||||
export declare function readJsonFile(path: string): JsonValue;
|
26
my-app/node_modules/@angular-devkit/schematics/tools/file-system-utility.js
generated
vendored
Executable file
26
my-app/node_modules/@angular-devkit/schematics/tools/file-system-utility.js
generated
vendored
Executable file
|
@ -0,0 +1,26 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.readJsonFile = void 0;
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
const fs_1 = require("fs");
|
||||
const jsonc_parser_1 = require("jsonc-parser");
|
||||
function readJsonFile(path) {
|
||||
if (!(0, fs_1.existsSync)(path)) {
|
||||
throw new schematics_1.FileDoesNotExistException(path);
|
||||
}
|
||||
const errors = [];
|
||||
const content = (0, jsonc_parser_1.parse)((0, fs_1.readFileSync)(path, 'utf-8'), errors, { allowTrailingComma: true });
|
||||
if (errors.length) {
|
||||
const { error, offset } = errors[0];
|
||||
throw new Error(`Failed to parse "${path}" as JSON AST Object. ${(0, jsonc_parser_1.printParseErrorCode)(error)} at location: ${offset}.`);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
exports.readJsonFile = readJsonFile;
|
15
my-app/node_modules/@angular-devkit/schematics/tools/index.d.ts
generated
vendored
Executable file
15
my-app/node_modules/@angular-devkit/schematics/tools/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
export * from './description';
|
||||
export * from './export-ref';
|
||||
export * from './file-system-engine-host-base';
|
||||
export * from './workflow/node-workflow';
|
||||
export { FileSystemEngineHost } from './file-system-engine-host';
|
||||
export { NodeModulesEngineHost, NodePackageDoesNotSupportSchematics, } from './node-module-engine-host';
|
||||
export { NodeModulesTestEngineHost } from './node-modules-test-engine-host';
|
||||
export { validateOptionsWithSchema } from './schema-option-transform';
|
37
my-app/node_modules/@angular-devkit/schematics/tools/index.js
generated
vendored
Executable file
37
my-app/node_modules/@angular-devkit/schematics/tools/index.js
generated
vendored
Executable file
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validateOptionsWithSchema = exports.NodeModulesTestEngineHost = exports.NodePackageDoesNotSupportSchematics = exports.NodeModulesEngineHost = exports.FileSystemEngineHost = void 0;
|
||||
__exportStar(require("./description"), exports);
|
||||
__exportStar(require("./export-ref"), exports);
|
||||
__exportStar(require("./file-system-engine-host-base"), exports);
|
||||
__exportStar(require("./workflow/node-workflow"), exports);
|
||||
var file_system_engine_host_1 = require("./file-system-engine-host");
|
||||
Object.defineProperty(exports, "FileSystemEngineHost", { enumerable: true, get: function () { return file_system_engine_host_1.FileSystemEngineHost; } });
|
||||
var node_module_engine_host_1 = require("./node-module-engine-host");
|
||||
Object.defineProperty(exports, "NodeModulesEngineHost", { enumerable: true, get: function () { return node_module_engine_host_1.NodeModulesEngineHost; } });
|
||||
Object.defineProperty(exports, "NodePackageDoesNotSupportSchematics", { enumerable: true, get: function () { return node_module_engine_host_1.NodePackageDoesNotSupportSchematics; } });
|
||||
var node_modules_test_engine_host_1 = require("./node-modules-test-engine-host");
|
||||
Object.defineProperty(exports, "NodeModulesTestEngineHost", { enumerable: true, get: function () { return node_modules_test_engine_host_1.NodeModulesTestEngineHost; } });
|
||||
var schema_option_transform_1 = require("./schema-option-transform");
|
||||
Object.defineProperty(exports, "validateOptionsWithSchema", { enumerable: true, get: function () { return schema_option_transform_1.validateOptionsWithSchema; } });
|
29
my-app/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.d.ts
generated
vendored
Executable file
29
my-app/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { BaseException } from '@angular-devkit/core';
|
||||
import { RuleFactory } from '../src';
|
||||
import { FileSystemCollectionDesc, FileSystemSchematicDesc } from './description';
|
||||
import { FileSystemEngineHostBase } from './file-system-engine-host-base';
|
||||
export declare class NodePackageDoesNotSupportSchematics extends BaseException {
|
||||
constructor(name: string);
|
||||
}
|
||||
/**
|
||||
* A simple EngineHost that uses NodeModules to resolve collections.
|
||||
*/
|
||||
export declare class NodeModulesEngineHost extends FileSystemEngineHostBase {
|
||||
private readonly paths?;
|
||||
constructor(paths?: string[] | undefined);
|
||||
private resolve;
|
||||
protected _resolveCollectionPath(name: string, requester?: string): string;
|
||||
protected _resolveReferenceString(refString: string, parentPath: string, collectionDescription?: FileSystemCollectionDesc): {
|
||||
ref: RuleFactory<{}>;
|
||||
path: string;
|
||||
} | null;
|
||||
protected _transformCollectionDescription(name: string, desc: Partial<FileSystemCollectionDesc>): FileSystemCollectionDesc;
|
||||
protected _transformSchematicDescription(name: string, _collection: FileSystemCollectionDesc, desc: Partial<FileSystemSchematicDesc>): FileSystemSchematicDesc;
|
||||
}
|
118
my-app/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js
generated
vendored
Executable file
118
my-app/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js
generated
vendored
Executable file
|
@ -0,0 +1,118 @@
|
|||
"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.NodeModulesEngineHost = exports.NodePackageDoesNotSupportSchematics = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const path_1 = require("path");
|
||||
const export_ref_1 = require("./export-ref");
|
||||
const file_system_engine_host_base_1 = require("./file-system-engine-host-base");
|
||||
const file_system_utility_1 = require("./file-system-utility");
|
||||
class NodePackageDoesNotSupportSchematics extends core_1.BaseException {
|
||||
constructor(name) {
|
||||
super(`Package ${JSON.stringify(name)} was found but does not support schematics.`);
|
||||
}
|
||||
}
|
||||
exports.NodePackageDoesNotSupportSchematics = NodePackageDoesNotSupportSchematics;
|
||||
/**
|
||||
* A simple EngineHost that uses NodeModules to resolve collections.
|
||||
*/
|
||||
class NodeModulesEngineHost extends file_system_engine_host_base_1.FileSystemEngineHostBase {
|
||||
paths;
|
||||
constructor(paths) {
|
||||
super();
|
||||
this.paths = paths;
|
||||
}
|
||||
resolve(name, requester, references = new Set()) {
|
||||
// Keep track of the package requesting the schematic, in order to avoid infinite recursion
|
||||
if (requester) {
|
||||
if (references.has(requester)) {
|
||||
references.add(requester);
|
||||
throw new Error('Circular schematic reference detected: ' + JSON.stringify(Array.from(references)));
|
||||
}
|
||||
else {
|
||||
references.add(requester);
|
||||
}
|
||||
}
|
||||
const relativeBase = requester ? (0, path_1.dirname)(requester) : process.cwd();
|
||||
let collectionPath = undefined;
|
||||
if (name.startsWith('.')) {
|
||||
name = (0, path_1.resolve)(relativeBase, name);
|
||||
}
|
||||
const resolveOptions = {
|
||||
paths: requester ? [(0, path_1.dirname)(requester), ...(this.paths || [])] : this.paths,
|
||||
};
|
||||
// Try to resolve as a package
|
||||
try {
|
||||
const packageJsonPath = require.resolve((0, path_1.join)(name, 'package.json'), resolveOptions);
|
||||
const { schematics } = require(packageJsonPath);
|
||||
if (!schematics || typeof schematics !== 'string') {
|
||||
throw new NodePackageDoesNotSupportSchematics(name);
|
||||
}
|
||||
// If this is a relative path to the collection, then create the collection
|
||||
// path in relation to the package path
|
||||
if (schematics.startsWith('.')) {
|
||||
const packageDirectory = (0, path_1.dirname)(packageJsonPath);
|
||||
collectionPath = (0, path_1.resolve)(packageDirectory, schematics);
|
||||
}
|
||||
// Otherwise treat this as a package, and recurse to find the collection path
|
||||
else {
|
||||
collectionPath = this.resolve(schematics, packageJsonPath, references);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
// If not a package, try to resolve as a file
|
||||
if (!collectionPath) {
|
||||
try {
|
||||
collectionPath = require.resolve(name, resolveOptions);
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If not a package or a file, error
|
||||
if (!collectionPath) {
|
||||
throw new file_system_engine_host_base_1.CollectionCannotBeResolvedException(name);
|
||||
}
|
||||
return collectionPath;
|
||||
}
|
||||
_resolveCollectionPath(name, requester) {
|
||||
const collectionPath = this.resolve(name, requester);
|
||||
(0, file_system_utility_1.readJsonFile)(collectionPath);
|
||||
return collectionPath;
|
||||
}
|
||||
_resolveReferenceString(refString, parentPath, collectionDescription) {
|
||||
const ref = new export_ref_1.ExportStringRef(refString, parentPath);
|
||||
if (!ref.ref) {
|
||||
return null;
|
||||
}
|
||||
return { ref: ref.ref, path: ref.module };
|
||||
}
|
||||
_transformCollectionDescription(name, desc) {
|
||||
if (!desc.schematics || typeof desc.schematics != 'object') {
|
||||
throw new file_system_engine_host_base_1.CollectionMissingSchematicsMapException(name);
|
||||
}
|
||||
return {
|
||||
...desc,
|
||||
name,
|
||||
};
|
||||
}
|
||||
_transformSchematicDescription(name, _collection, desc) {
|
||||
if (!desc.factoryFn || !desc.path || !desc.description) {
|
||||
throw new file_system_engine_host_base_1.SchematicMissingFieldsException(name);
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
exports.NodeModulesEngineHost = NodeModulesEngineHost;
|
23
my-app/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.d.ts
generated
vendored
Executable file
23
my-app/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { TaskConfiguration } from '../src/engine';
|
||||
import { FileSystemSchematicContext } from './description';
|
||||
import { NodeModulesEngineHost } from './node-module-engine-host';
|
||||
/**
|
||||
* An EngineHost that uses a registry to super seed locations of collection.json files, but
|
||||
* revert back to using node modules resolution. This is done for testing.
|
||||
*/
|
||||
export declare class NodeModulesTestEngineHost extends NodeModulesEngineHost {
|
||||
private _collections;
|
||||
private _tasks;
|
||||
get tasks(): TaskConfiguration<{}>[];
|
||||
clearTasks(): void;
|
||||
registerCollection(name: string, path: string): void;
|
||||
transformContext(context: FileSystemSchematicContext): FileSystemSchematicContext;
|
||||
protected _resolveCollectionPath(name: string, requester?: string): string;
|
||||
}
|
44
my-app/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.js
generated
vendored
Executable file
44
my-app/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.js
generated
vendored
Executable file
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeModulesTestEngineHost = void 0;
|
||||
const node_module_engine_host_1 = require("./node-module-engine-host");
|
||||
/**
|
||||
* An EngineHost that uses a registry to super seed locations of collection.json files, but
|
||||
* revert back to using node modules resolution. This is done for testing.
|
||||
*/
|
||||
class NodeModulesTestEngineHost extends node_module_engine_host_1.NodeModulesEngineHost {
|
||||
_collections = new Map();
|
||||
_tasks = [];
|
||||
get tasks() {
|
||||
return this._tasks;
|
||||
}
|
||||
clearTasks() {
|
||||
this._tasks = [];
|
||||
}
|
||||
registerCollection(name, path) {
|
||||
this._collections.set(name, path);
|
||||
}
|
||||
transformContext(context) {
|
||||
const oldAddTask = context.addTask;
|
||||
context.addTask = (task, dependencies) => {
|
||||
this._tasks.push(task.toConfiguration());
|
||||
return oldAddTask.call(context, task, dependencies);
|
||||
};
|
||||
return context;
|
||||
}
|
||||
_resolveCollectionPath(name, requester) {
|
||||
const maybePath = this._collections.get(name);
|
||||
if (maybePath) {
|
||||
return maybePath;
|
||||
}
|
||||
return super._resolveCollectionPath(name, requester);
|
||||
}
|
||||
}
|
||||
exports.NodeModulesTestEngineHost = NodeModulesTestEngineHost;
|
5
my-app/node_modules/@angular-devkit/schematics/tools/package.json
generated
vendored
Executable file
5
my-app/node_modules/@angular-devkit/schematics/tools/package.json
generated
vendored
Executable file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "@angular-devkit/schematics/tools",
|
||||
"main": "index.js",
|
||||
"typings": "index.d.ts"
|
||||
}
|
14
my-app/node_modules/@angular-devkit/schematics/tools/schema-option-transform.d.ts
generated
vendored
Executable file
14
my-app/node_modules/@angular-devkit/schematics/tools/schema-option-transform.d.ts
generated
vendored
Executable 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 { schema } from '@angular-devkit/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { FileSystemSchematicContext, FileSystemSchematicDescription } from './description';
|
||||
export declare class InvalidInputOptions<T = {}> extends schema.SchemaValidationException {
|
||||
constructor(options: T, errors: schema.SchemaValidatorError[]);
|
||||
}
|
||||
export declare function validateOptionsWithSchema(registry: schema.SchemaRegistry): <T extends {} | null>(schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext) => Observable<T>;
|
38
my-app/node_modules/@angular-devkit/schematics/tools/schema-option-transform.js
generated
vendored
Executable file
38
my-app/node_modules/@angular-devkit/schematics/tools/schema-option-transform.js
generated
vendored
Executable file
|
@ -0,0 +1,38 @@
|
|||
"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.validateOptionsWithSchema = exports.InvalidInputOptions = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const operators_1 = require("rxjs/operators");
|
||||
class InvalidInputOptions extends core_1.schema.SchemaValidationException {
|
||||
constructor(options, errors) {
|
||||
super(errors, `Schematic input does not validate against the Schema: ${JSON.stringify(options)}\nErrors:\n`);
|
||||
}
|
||||
}
|
||||
exports.InvalidInputOptions = InvalidInputOptions;
|
||||
// This can only be used in NodeJS.
|
||||
function validateOptionsWithSchema(registry) {
|
||||
return (schematic, options, context) => {
|
||||
// Prevent a schematic from changing the options object by making a copy of it.
|
||||
options = (0, core_1.deepCopy)(options);
|
||||
const withPrompts = context ? context.interactive : true;
|
||||
if (schematic.schema && schematic.schemaJson) {
|
||||
// Make a deep copy of options.
|
||||
return (0, rxjs_1.from)(registry.compile(schematic.schemaJson)).pipe((0, operators_1.mergeMap)((validator) => validator(options, { withPrompts })), (0, operators_1.first)(), (0, operators_1.map)((result) => {
|
||||
if (!result.success) {
|
||||
throw new InvalidInputOptions(options, result.errors || []);
|
||||
}
|
||||
return options;
|
||||
}));
|
||||
}
|
||||
return (0, rxjs_1.of)(options);
|
||||
};
|
||||
}
|
||||
exports.validateOptionsWithSchema = validateOptionsWithSchema;
|
35
my-app/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.d.ts
generated
vendored
Executable file
35
my-app/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { Path, schema, virtualFs } from '@angular-devkit/core';
|
||||
import { workflow } from '@angular-devkit/schematics';
|
||||
import { FileSystemEngine } from '../description';
|
||||
import { OptionTransform } from '../file-system-engine-host-base';
|
||||
import { NodeModulesEngineHost } from '../node-module-engine-host';
|
||||
export interface NodeWorkflowOptions {
|
||||
force?: boolean;
|
||||
dryRun?: boolean;
|
||||
packageManager?: string;
|
||||
packageManagerForce?: boolean;
|
||||
packageRegistry?: string;
|
||||
registry?: schema.CoreSchemaRegistry;
|
||||
resolvePaths?: string[];
|
||||
schemaValidation?: boolean;
|
||||
optionTransforms?: OptionTransform<Record<string, unknown> | null, object>[];
|
||||
engineHostCreator?: (options: NodeWorkflowOptions) => NodeModulesEngineHost;
|
||||
}
|
||||
/**
|
||||
* A workflow specifically for Node tools.
|
||||
*/
|
||||
export declare class NodeWorkflow extends workflow.BaseWorkflow {
|
||||
constructor(root: string, options: NodeWorkflowOptions);
|
||||
constructor(host: virtualFs.Host, options: NodeWorkflowOptions & {
|
||||
root?: Path;
|
||||
});
|
||||
get engine(): FileSystemEngine;
|
||||
get engineHost(): NodeModulesEngineHost;
|
||||
}
|
68
my-app/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.js
generated
vendored
Executable file
68
my-app/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.js
generated
vendored
Executable 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.NodeWorkflow = void 0;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const node_1 = require("@angular-devkit/core/node");
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
const node_2 = require("../../tasks/node");
|
||||
const node_module_engine_host_1 = require("../node-module-engine-host");
|
||||
const schema_option_transform_1 = require("../schema-option-transform");
|
||||
/**
|
||||
* A workflow specifically for Node tools.
|
||||
*/
|
||||
class NodeWorkflow extends schematics_1.workflow.BaseWorkflow {
|
||||
constructor(hostOrRoot, options) {
|
||||
let host;
|
||||
let root;
|
||||
if (typeof hostOrRoot === 'string') {
|
||||
root = (0, core_1.normalize)(hostOrRoot);
|
||||
host = new core_1.virtualFs.ScopedHost(new node_1.NodeJsSyncHost(), root);
|
||||
}
|
||||
else {
|
||||
host = hostOrRoot;
|
||||
root = options.root;
|
||||
}
|
||||
const engineHost = options.engineHostCreator?.(options) || new node_module_engine_host_1.NodeModulesEngineHost(options.resolvePaths);
|
||||
super({
|
||||
host,
|
||||
engineHost,
|
||||
force: options.force,
|
||||
dryRun: options.dryRun,
|
||||
registry: options.registry,
|
||||
});
|
||||
engineHost.registerTaskExecutor(node_2.BuiltinTaskExecutor.NodePackage, {
|
||||
allowPackageManagerOverride: true,
|
||||
packageManager: options.packageManager,
|
||||
force: options.packageManagerForce,
|
||||
rootDirectory: root && (0, core_1.getSystemPath)(root),
|
||||
registry: options.packageRegistry,
|
||||
});
|
||||
engineHost.registerTaskExecutor(node_2.BuiltinTaskExecutor.RepositoryInitializer, {
|
||||
rootDirectory: root && (0, core_1.getSystemPath)(root),
|
||||
});
|
||||
engineHost.registerTaskExecutor(node_2.BuiltinTaskExecutor.RunSchematic);
|
||||
if (options.optionTransforms) {
|
||||
for (const transform of options.optionTransforms) {
|
||||
engineHost.registerOptionsTransform(transform);
|
||||
}
|
||||
}
|
||||
if (options.schemaValidation) {
|
||||
engineHost.registerOptionsTransform((0, schema_option_transform_1.validateOptionsWithSchema)(this.registry));
|
||||
}
|
||||
this._context = [];
|
||||
}
|
||||
get engine() {
|
||||
return this._engine;
|
||||
}
|
||||
get engineHost() {
|
||||
return this._engineHost;
|
||||
}
|
||||
}
|
||||
exports.NodeWorkflow = NodeWorkflow;
|
Loading…
Add table
Add a link
Reference in a new issue