aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js
diff options
context:
space:
mode:
authorDanijel Andjelkovic <adanijel99@gmail.com>2022-03-01 20:21:29 +0000
committerDanijel Andjelkovic <adanijel99@gmail.com>2022-03-01 20:21:29 +0000
commit61cb1570a3410c85a4489b97c172e3a50715f36c (patch)
tree8fe4a5b77ea54bba80abc817ce2c9ef0e79e7e66 /sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js
parent21a53d349788c99d2007cba91a923db982353b31 (diff)
parenta9ee9e0a500a4a15bd0b5dcaf041f827228ed309 (diff)
Merge branch 'researchML' into 'dev'
Research ml See merge request igrannonica/neuronstellar!6
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js')
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js107
1 files changed, 107 insertions, 0 deletions
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;