From 291803c31f829fe0d32bb3207bc11def95a7408c Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 20:05:50 +0100 Subject: Urađena test aplikacija. Povezan front i back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../@angular-devkit/schematics/tools/BUILD.bazel | 67 ++++++ .../schematics/tools/description.d.ts | 41 ++++ .../schematics/tools/description.js | 9 + .../schematics/tools/export-ref.d.ts | 16 ++ .../@angular-devkit/schematics/tools/export-ref.js | 35 +++ .../schematics/tools/fallback-engine-host.d.ts | 36 +++ .../schematics/tools/fallback-engine-host.js | 86 +++++++ .../tools/file-system-engine-host-base.d.ts | 75 ++++++ .../tools/file-system-engine-host-base.js | 261 +++++++++++++++++++++ .../schematics/tools/file-system-engine-host.d.ts | 28 +++ .../schematics/tools/file-system-engine-host.js | 113 +++++++++ .../schematics/tools/file-system-utility.d.ts | 9 + .../schematics/tools/file-system-utility.js | 26 ++ .../@angular-devkit/schematics/tools/index.d.ts | 15 ++ .../@angular-devkit/schematics/tools/index.js | 33 +++ .../schematics/tools/node-module-engine-host.d.ts | 29 +++ .../schematics/tools/node-module-engine-host.js | 107 +++++++++ .../tools/node-modules-test-engine-host.d.ts | 23 ++ .../tools/node-modules-test-engine-host.js | 47 ++++ .../@angular-devkit/schematics/tools/package.json | 5 + .../schematics/tools/schema-option-transform.d.ts | 14 ++ .../schematics/tools/schema-option-transform.js | 38 +++ .../schematics/tools/workflow/node-workflow.d.ts | 35 +++ .../schematics/tools/workflow/node-workflow.js | 69 ++++++ 24 files changed, 1217 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/BUILD.bazel create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/package.json create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.js (limited to 'sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools') diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/BUILD.bazel b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/BUILD.bazel new file mode 100644 index 00000000..c7514fb5 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/BUILD.bazel @@ -0,0 +1,67 @@ +load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test") +load("//tools:defaults.bzl", "ts_library") + +# 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 +licenses(["notice"]) + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "tools", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*_spec.ts", + "**/*_benchmark.ts", + "test/**/*.ts", + ], + ), + data = ["package.json"], + module_name = "@angular-devkit/schematics/tools", + module_root = "index.d.ts", + # The attribute below is needed in g3 to turn off strict typechecking + # strict_checks = False, + deps = [ + "//packages/angular_devkit/core", + "//packages/angular_devkit/core/node", + "//packages/angular_devkit/schematics", + "//packages/angular_devkit/schematics/tasks", + "//packages/angular_devkit/schematics/tasks/node", + "@npm//@types/node", + "@npm//jsonc-parser", + "@npm//rxjs", + ], +) + +ts_library( + name = "tools_test_lib", + testonly = True, + srcs = glob( + include = [ + "**/*_spec.ts", + "test/**/*.ts", + ], + ), + deps = [ + ":tools", + "//packages/angular_devkit/core", + "//packages/angular_devkit/core/node", + "//packages/angular_devkit/schematics", + "//packages/angular_devkit/schematics/tasks", + "//packages/angular_devkit/schematics/testing", + "//tests/angular_devkit/schematics/tools/file-system-engine-host:file_system_engine_host_test_lib", + "@npm//rxjs", + ], +) + +jasmine_node_test( + name = "tools_test", + srcs = [":tools_test_lib"], + deps = [ + "@npm//jasmine", + "@npm//source-map", + ], +) diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.d.ts new file mode 100644 index 00000000..5390481d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.d.ts @@ -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 { 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; + }; +} +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; +export declare type FileSystemEngineHost = EngineHost; +export declare type FileSystemCollection = Collection; +export declare type FileSystemSchematic = Schematic; +export declare type FileSystemCollectionDesc = CollectionDescription; +export declare type FileSystemSchematicDesc = SchematicDescription; +export declare type FileSystemSchematicContext = TypedSchematicContext; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.js new file mode 100644 index 00000000..b599b96d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/description.js @@ -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 }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.d.ts new file mode 100644 index 00000000..06428cea --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.d.ts @@ -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 { + private _ref?; + private _module; + private _path; + constructor(ref: string, parentPath?: string, inner?: boolean); + get ref(): T | undefined; + get module(): string; + get path(): string; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.js new file mode 100644 index 00000000..1c88d8ee --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/export-ref.js @@ -0,0 +1,35 @@ +"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 { + 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; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.d.ts new file mode 100644 index 00000000..8a915a5e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.d.ts @@ -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 { Observable } from 'rxjs'; +import { Url } from 'url'; +import { CollectionDescription, EngineHost, RuleFactory, SchematicDescription, Source, TaskExecutor, TypedSchematicContext } from '../src'; +export declare type FallbackCollectionDescription = { + host: EngineHost<{}, {}>; + description: CollectionDescription<{}>; +}; +export declare type FallbackSchematicDescription = { + description: SchematicDescription<{}, {}>; +}; +export declare type FallbackContext = TypedSchematicContext; +/** + * 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(host: EngineHost): void; + createCollectionDescription(name: string, requester?: CollectionDescription<{}>): CollectionDescription; + createSchematicDescription(name: string, collection: CollectionDescription): SchematicDescription | null; + getSchematicRuleFactory(schematic: SchematicDescription, collection: CollectionDescription): RuleFactory; + createSourceFromUrl(url: Url, context: FallbackContext): Source | null; + transformOptions(schematic: SchematicDescription, options: OptionT, context?: FallbackContext): Observable; + transformContext(context: FallbackContext): FallbackContext; + listSchematicNames(collection: CollectionDescription): string[]; + createTaskExecutor(name: string): Observable; + hasTaskExecutor(name: string): boolean; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.js new file mode 100644 index 00000000..bf2f5a98 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/fallback-engine-host.js @@ -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 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FallbackEngineHost = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +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 { + constructor() { + this._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, operators_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) { + const allNames = new Set(); + this._hosts.forEach((host) => { + try { + host.listSchematicNames(collection.description).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; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.d.ts new file mode 100644 index 00000000..7c76aef6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.d.ts @@ -0,0 +1,75 @@ +/** + * @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 { 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 = (schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext) => Observable | PromiseLike | 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): { + ref: RuleFactory<{}>; + path: string; + } | null; + protected abstract _transformCollectionDescription(name: string, desc: Partial): FileSystemCollectionDesc; + protected abstract _transformSchematicDescription(name: string, collection: FileSystemCollectionDesc, desc: Partial): FileSystemSchematicDesc; + private _transforms; + private _contextTransforms; + private _taskFactories; + listSchematicNames(collection: FileSystemCollectionDesc): string[]; + registerOptionsTransform(t: OptionTransform): 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(schematic: FileSystemSchematicDesc, options: OptionT, context?: FileSystemSchematicContext): Observable; + transformContext(context: FileSystemSchematicContext): FileSystemSchematicContext; + getSchematicRuleFactory(schematic: FileSystemSchematicDesc, _collection: FileSystemCollectionDesc): RuleFactory; + registerTaskExecutor(factory: TaskExecutorFactory, options?: T): void; + createTaskExecutor(name: string): Observable; + hasTaskExecutor(name: string): boolean; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js new file mode 100644 index 00000000..84ab178a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js @@ -0,0 +1,261 @@ +"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 { + constructor() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._transforms = []; + this._contextTransforms = []; + this._taskFactories = new Map(); + } + listSchematicNames(collection) { + const schematics = []; + for (const key of Object.keys(collection.schematics)) { + const schematic = collection.schematics[key]; + if (schematic.hidden || 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 === null || requester === void 0 ? void 0 : 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.substr(0, index) : null; + const schematicName = index === -1 ? partialDesc.extends : partialDesc.extends.substr(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); + 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) + ? transformerResult.toPromise() + : 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; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.d.ts new file mode 100644 index 00000000..a99cde93 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.d.ts @@ -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; + protected _transformSchematicDescription(name: string, _collection: FileSystemCollectionDesc, desc: Partial): FileSystemSchematicDesc; + hasTaskExecutor(name: string): boolean; + createTaskExecutor(name: string): Observable; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.js new file mode 100644 index 00000000..2b3a4cc9 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-engine-host.js @@ -0,0 +1,113 @@ +"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.FileSystemEngineHost = void 0; +const fs_1 = require("fs"); +const path_1 = require("path"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +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 { + 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().then(() => __importStar(require(path))).then((mod) => { var _a; return (((_a = mod.default) === null || _a === void 0 ? void 0 : _a.default) || mod.default)(); })).pipe((0, operators_1.catchError)(() => (0, rxjs_1.throwError)(new src_1.UnregisteredTaskException(name)))); + } + catch { } + } + return super.createTaskExecutor(name); + } +} +exports.FileSystemEngineHost = FileSystemEngineHost; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.d.ts new file mode 100644 index 00000000..2586150f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.d.ts @@ -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; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.js new file mode 100644 index 00000000..e8499727 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/file-system-utility.js @@ -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; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.d.ts new file mode 100644 index 00000000..5f2672b0 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.d.ts @@ -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'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.js new file mode 100644 index 00000000..8efe0672 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/index.js @@ -0,0 +1,33 @@ +"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.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; } }); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.d.ts new file mode 100644 index 00000000..e1122fd7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.d.ts @@ -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): { + ref: RuleFactory<{}>; + path: string; + } | null; + protected _transformCollectionDescription(name: string, desc: Partial): FileSystemCollectionDesc; + protected _transformSchematicDescription(name: string, _collection: FileSystemCollectionDesc, desc: Partial): FileSystemSchematicDesc; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js new file mode 100644 index 00000000..23b4a332 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js @@ -0,0 +1,107 @@ +"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 { + constructor(paths) { + super(); + this.paths = paths; + } + resolve(name, requester, references = new Set()) { + 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); + } + 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) { + 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; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.d.ts new file mode 100644 index 00000000..60ac61ac --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.d.ts @@ -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; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.js new file mode 100644 index 00000000..abaab377 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-modules-test-engine-host.js @@ -0,0 +1,47 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +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 { + constructor() { + super(...arguments); + this._collections = new Map(); + this._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; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/package.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/package.json new file mode 100644 index 00000000..e82f12c2 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/package.json @@ -0,0 +1,5 @@ +{ + "name": "@angular-devkit/schematics/tools", + "main": "index.js", + "typings": "index.d.ts" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.d.ts new file mode 100644 index 00000000..a7de1dcc --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.d.ts @@ -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 extends schema.SchemaValidationException { + constructor(options: T, errors: schema.SchemaValidatorError[]); +} +export declare function validateOptionsWithSchema(registry: schema.SchemaRegistry): (schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext | undefined) => Observable; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.js new file mode 100644 index 00000000..9d665a85 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/schema-option-transform.js @@ -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 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; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.d.ts new file mode 100644 index 00000000..cbbcaba3 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.d.ts @@ -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[]; + 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; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.js new file mode 100644 index 00000000..41a69c28 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.js @@ -0,0 +1,69 @@ +"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) { + var _a; + 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 = ((_a = options.engineHostCreator) === null || _a === void 0 ? void 0 : _a.call(options, 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; -- cgit v1.2.3