diff options
author | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 21:54:41 +0100 |
---|---|---|
committer | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 21:54:41 +0100 |
commit | 6c8128f9fd5a5d0be115806c35a21b3d683df8d6 (patch) | |
tree | f46c2f6b3b9b294ff32bd75c08ccdc9e7a8cc4ef /sandbox/testAppNevena/Front/node_modules/@schematics/angular/directive/index.js | |
parent | 2400b84e95913665da6279114168148444b8f9ab (diff) | |
parent | 7d3640f824f46490b47bd95f1c5a16644f712068 (diff) |
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into logo
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@schematics/angular/directive/index.js')
-rw-r--r-- | sandbox/testAppNevena/Front/node_modules/@schematics/angular/directive/index.js | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/directive/index.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/directive/index.js new file mode 100644 index 00000000..ff8b78de --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/directive/index.js @@ -0,0 +1,122 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("@angular-devkit/core"); +const schematics_1 = require("@angular-devkit/schematics"); +const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript")); +const ast_utils_1 = require("../utility/ast-utils"); +const change_1 = require("../utility/change"); +const find_module_1 = require("../utility/find-module"); +const parse_name_1 = require("../utility/parse-name"); +const validation_1 = require("../utility/validation"); +const workspace_1 = require("../utility/workspace"); +function addDeclarationToNgModule(options) { + return (host) => { + if (options.skipImport || !options.module) { + return host; + } + const modulePath = options.module; + const text = host.read(modulePath); + if (text === null) { + throw new schematics_1.SchematicsException(`File ${modulePath} does not exist.`); + } + const sourceText = text.toString('utf-8'); + const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true); + const directivePath = `/${options.path}/` + + (options.flat ? '' : core_1.strings.dasherize(options.name) + '/') + + core_1.strings.dasherize(options.name) + + '.directive'; + const relativePath = (0, find_module_1.buildRelativePath)(modulePath, directivePath); + const classifiedName = core_1.strings.classify(`${options.name}Directive`); + const declarationChanges = (0, ast_utils_1.addDeclarationToModule)(source, modulePath, classifiedName, relativePath); + const declarationRecorder = host.beginUpdate(modulePath); + for (const change of declarationChanges) { + if (change instanceof change_1.InsertChange) { + declarationRecorder.insertLeft(change.pos, change.toAdd); + } + } + host.commitUpdate(declarationRecorder); + if (options.export) { + // Need to refresh the AST because we overwrote the file in the host. + const text = host.read(modulePath); + if (text === null) { + throw new schematics_1.SchematicsException(`File ${modulePath} does not exist.`); + } + const sourceText = text.toString('utf-8'); + const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true); + const exportRecorder = host.beginUpdate(modulePath); + const exportChanges = (0, ast_utils_1.addExportToModule)(source, modulePath, core_1.strings.classify(`${options.name}Directive`), relativePath); + for (const change of exportChanges) { + if (change instanceof change_1.InsertChange) { + exportRecorder.insertLeft(change.pos, change.toAdd); + } + } + host.commitUpdate(exportRecorder); + } + return host; + }; +} +function buildSelector(options, projectPrefix) { + let selector = options.name; + if (options.prefix) { + selector = `${options.prefix}-${selector}`; + } + else if (options.prefix === undefined && projectPrefix) { + selector = `${projectPrefix}-${selector}`; + } + return core_1.strings.camelize(selector); +} +function default_1(options) { + return async (host) => { + const workspace = await (0, workspace_1.getWorkspace)(host); + const project = workspace.projects.get(options.project); + if (!project) { + throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`); + } + if (options.path === undefined) { + options.path = (0, workspace_1.buildDefaultPath)(project); + } + options.module = (0, find_module_1.findModuleFromOptions)(host, options); + const parsedPath = (0, parse_name_1.parseName)(options.path, options.name); + options.name = parsedPath.name; + options.path = parsedPath.path; + options.selector = options.selector || buildSelector(options, project.prefix || ''); + (0, validation_1.validateHtmlSelector)(options.selector); + const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [ + options.skipTests ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(), + (0, schematics_1.applyTemplates)({ + ...core_1.strings, + 'if-flat': (s) => (options.flat ? '' : s), + ...options, + }), + (0, schematics_1.move)(parsedPath.path), + ]); + return (0, schematics_1.chain)([addDeclarationToNgModule(options), (0, schematics_1.mergeWith)(templateSource)]); + }; +} +exports.default = default_1; |