diff options
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility')
35 files changed, 1877 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ast-utils.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ast-utils.d.ts new file mode 100644 index 00000000..4e45c946 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ast-utils.d.ts @@ -0,0 +1,102 @@ +/** + * @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 * as ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescript'; +import { Change } from './change'; +/** + * Add Import `import { symbolName } from fileName` if the import doesn't exit + * already. Assumes fileToEdit can be resolved and accessed. + * @param fileToEdit (file we want to add import to) + * @param symbolName (item to import) + * @param fileName (path to the file) + * @param isDefault (if true, import follows style for importing default exports) + * @return Change + */ +export declare function insertImport(source: ts.SourceFile, fileToEdit: string, symbolName: string, fileName: string, isDefault?: boolean): Change; +/** + * Find all nodes from the AST in the subtree of node of SyntaxKind kind. + * @param node + * @param kind + * @param max The maximum number of items to return. + * @param recursive Continue looking for nodes of kind recursive until end + * the last child even when node of kind has been found. + * @return all nodes of kind, or [] if none is found + */ +export declare function findNodes(node: ts.Node, kind: ts.SyntaxKind, max?: number, recursive?: boolean): ts.Node[]; +/** + * Find all nodes from the AST in the subtree that satisfy a type guard. + * @param node + * @param guard + * @param max The maximum number of items to return. + * @param recursive Continue looking for nodes of kind recursive until end + * the last child even when node of kind has been found. + * @return all nodes that satisfy the type guard, or [] if none is found + */ +export declare function findNodes<T extends ts.Node>(node: ts.Node, guard: (node: ts.Node) => node is T, max?: number, recursive?: boolean): T[]; +/** + * Get all the nodes from a source. + * @param sourceFile The source file object. + * @returns {Array<ts.Node>} An array of all the nodes in the source. + */ +export declare function getSourceNodes(sourceFile: ts.SourceFile): ts.Node[]; +export declare function findNode(node: ts.Node, kind: ts.SyntaxKind, text: string): ts.Node | null; +/** + * Insert `toInsert` after the last occurence of `ts.SyntaxKind[nodes[i].kind]` + * or after the last of occurence of `syntaxKind` if the last occurence is a sub child + * of ts.SyntaxKind[nodes[i].kind] and save the changes in file. + * + * @param nodes insert after the last occurence of nodes + * @param toInsert string to insert + * @param file file to insert changes into + * @param fallbackPos position to insert if toInsert happens to be the first occurence + * @param syntaxKind the ts.SyntaxKind of the subchildren to insert after + * @return Change instance + * @throw Error if toInsert is first occurence but fall back is not set + */ +export declare function insertAfterLastOccurrence(nodes: ts.Node[], toInsert: string, file: string, fallbackPos: number, syntaxKind?: ts.SyntaxKind): Change; +export declare function getDecoratorMetadata(source: ts.SourceFile, identifier: string, module: string): ts.Node[]; +export declare function getMetadataField(node: ts.ObjectLiteralExpression, metadataField: string): ts.ObjectLiteralElement[]; +export declare function addSymbolToNgModuleMetadata(source: ts.SourceFile, ngModulePath: string, metadataField: string, symbolName: string, importPath?: string | null): Change[]; +/** + * Custom function to insert a declaration (component, pipe, directive) + * into NgModule declarations. It also imports the component. + */ +export declare function addDeclarationToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[]; +/** + * Custom function to insert an NgModule into NgModule imports. It also imports the module. + */ +export declare function addImportToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[]; +/** + * Custom function to insert a provider into NgModule. It also imports it. + */ +export declare function addProviderToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[]; +/** + * Custom function to insert an export into NgModule. It also imports it. + */ +export declare function addExportToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[]; +/** + * Custom function to insert an export into NgModule. It also imports it. + */ +export declare function addBootstrapToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[]; +/** + * Determine if an import already exists. + */ +export declare function isImported(source: ts.SourceFile, classifiedName: string, importPath: string): boolean; +/** + * This function returns the name of the environment export + * whether this export is aliased or not. If the environment file + * is not imported, then it will return `null`. + */ +export declare function getEnvironmentExportName(source: ts.SourceFile): string | null; +/** + * Returns the RouterModule declaration from NgModule metadata, if any. + */ +export declare function getRouterModuleDeclaration(source: ts.SourceFile): ts.Expression | undefined; +/** + * Adds a new route declaration to a router module (i.e. has a RouterModule declaration) + */ +export declare function addRouteDeclarationToModule(source: ts.SourceFile, fileToAdd: string, routeLiteral: string): Change; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ast-utils.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ast-utils.js new file mode 100644 index 00000000..d18e77e8 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ast-utils.js @@ -0,0 +1,545 @@ +"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.addRouteDeclarationToModule = exports.getRouterModuleDeclaration = exports.getEnvironmentExportName = exports.isImported = exports.addBootstrapToModule = exports.addExportToModule = exports.addProviderToModule = exports.addImportToModule = exports.addDeclarationToModule = exports.addSymbolToNgModuleMetadata = exports.getMetadataField = exports.getDecoratorMetadata = exports.insertAfterLastOccurrence = exports.findNode = exports.getSourceNodes = exports.findNodes = exports.insertImport = void 0; +const core_1 = require("@angular-devkit/core"); +const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript")); +const change_1 = require("./change"); +/** + * Add Import `import { symbolName } from fileName` if the import doesn't exit + * already. Assumes fileToEdit can be resolved and accessed. + * @param fileToEdit (file we want to add import to) + * @param symbolName (item to import) + * @param fileName (path to the file) + * @param isDefault (if true, import follows style for importing default exports) + * @return Change + */ +function insertImport(source, fileToEdit, symbolName, fileName, isDefault = false) { + const rootNode = source; + const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration); + // get nodes that map to import statements from the file fileName + const relevantImports = allImports.filter((node) => { + // StringLiteral of the ImportDeclaration is the import file (fileName in this case). + const importFiles = node + .getChildren() + .filter(ts.isStringLiteral) + .map((n) => n.text); + return importFiles.filter((file) => file === fileName).length === 1; + }); + if (relevantImports.length > 0) { + let importsAsterisk = false; + // imports from import file + const imports = []; + relevantImports.forEach((n) => { + Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier)); + if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) { + importsAsterisk = true; + } + }); + // if imports * from fileName, don't add symbolName + if (importsAsterisk) { + return new change_1.NoopChange(); + } + const importTextNodes = imports.filter((n) => n.text === symbolName); + // insert import if it's not there + if (importTextNodes.length === 0) { + const fallbackPos = findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() || + findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart(); + return insertAfterLastOccurrence(imports, `, ${symbolName}`, fileToEdit, fallbackPos); + } + return new change_1.NoopChange(); + } + // no such import declaration exists + const useStrict = findNodes(rootNode, ts.isStringLiteral).filter((n) => n.text === 'use strict'); + let fallbackPos = 0; + if (useStrict.length > 0) { + fallbackPos = useStrict[0].end; + } + const open = isDefault ? '' : '{ '; + const close = isDefault ? '' : ' }'; + // if there are no imports or 'use strict' statement, insert import at beginning of file + const insertAtBeginning = allImports.length === 0 && useStrict.length === 0; + const separator = insertAtBeginning ? '' : ';\n'; + const toInsert = `${separator}import ${open}${symbolName}${close}` + + ` from '${fileName}'${insertAtBeginning ? ';\n' : ''}`; + return insertAfterLastOccurrence(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral); +} +exports.insertImport = insertImport; +function findNodes(node, kindOrGuard, max = Infinity, recursive = false) { + if (!node || max == 0) { + return []; + } + const test = typeof kindOrGuard === 'function' + ? kindOrGuard + : (node) => node.kind === kindOrGuard; + const arr = []; + if (test(node)) { + arr.push(node); + max--; + } + if (max > 0 && (recursive || !test(node))) { + for (const child of node.getChildren()) { + findNodes(child, test, max, recursive).forEach((node) => { + if (max > 0) { + arr.push(node); + } + max--; + }); + if (max <= 0) { + break; + } + } + } + return arr; +} +exports.findNodes = findNodes; +/** + * Get all the nodes from a source. + * @param sourceFile The source file object. + * @returns {Array<ts.Node>} An array of all the nodes in the source. + */ +function getSourceNodes(sourceFile) { + const nodes = [sourceFile]; + const result = []; + while (nodes.length > 0) { + const node = nodes.shift(); + if (node) { + result.push(node); + if (node.getChildCount(sourceFile) >= 0) { + nodes.unshift(...node.getChildren()); + } + } + } + return result; +} +exports.getSourceNodes = getSourceNodes; +function findNode(node, kind, text) { + if (node.kind === kind && node.getText() === text) { + // throw new Error(node.getText()); + return node; + } + let foundNode = null; + ts.forEachChild(node, (childNode) => { + foundNode = foundNode || findNode(childNode, kind, text); + }); + return foundNode; +} +exports.findNode = findNode; +/** + * Helper for sorting nodes. + * @return function to sort nodes in increasing order of position in sourceFile + */ +function nodesByPosition(first, second) { + return first.getStart() - second.getStart(); +} +/** + * Insert `toInsert` after the last occurence of `ts.SyntaxKind[nodes[i].kind]` + * or after the last of occurence of `syntaxKind` if the last occurence is a sub child + * of ts.SyntaxKind[nodes[i].kind] and save the changes in file. + * + * @param nodes insert after the last occurence of nodes + * @param toInsert string to insert + * @param file file to insert changes into + * @param fallbackPos position to insert if toInsert happens to be the first occurence + * @param syntaxKind the ts.SyntaxKind of the subchildren to insert after + * @return Change instance + * @throw Error if toInsert is first occurence but fall back is not set + */ +function insertAfterLastOccurrence(nodes, toInsert, file, fallbackPos, syntaxKind) { + let lastItem; + for (const node of nodes) { + if (!lastItem || lastItem.getStart() < node.getStart()) { + lastItem = node; + } + } + if (syntaxKind && lastItem) { + lastItem = findNodes(lastItem, syntaxKind).sort(nodesByPosition).pop(); + } + if (!lastItem && fallbackPos == undefined) { + throw new Error(`tried to insert ${toInsert} as first occurence with no fallback position`); + } + const lastItemPosition = lastItem ? lastItem.getEnd() : fallbackPos; + return new change_1.InsertChange(file, lastItemPosition, toInsert); +} +exports.insertAfterLastOccurrence = insertAfterLastOccurrence; +function _angularImportsFromNode(node) { + const ms = node.moduleSpecifier; + let modulePath; + switch (ms.kind) { + case ts.SyntaxKind.StringLiteral: + modulePath = ms.text; + break; + default: + return {}; + } + if (!modulePath.startsWith('@angular/')) { + return {}; + } + if (node.importClause) { + if (node.importClause.name) { + // This is of the form `import Name from 'path'`. Ignore. + return {}; + } + else if (node.importClause.namedBindings) { + const nb = node.importClause.namedBindings; + if (nb.kind == ts.SyntaxKind.NamespaceImport) { + // This is of the form `import * as name from 'path'`. Return `name.`. + return { + [nb.name.text + '.']: modulePath, + }; + } + else { + // This is of the form `import {a,b,c} from 'path'` + const namedImports = nb; + return namedImports.elements + .map((is) => (is.propertyName ? is.propertyName.text : is.name.text)) + .reduce((acc, curr) => { + acc[curr] = modulePath; + return acc; + }, {}); + } + } + return {}; + } + else { + // This is of the form `import 'path';`. Nothing to do. + return {}; + } +} +function getDecoratorMetadata(source, identifier, module) { + const angularImports = findNodes(source, ts.isImportDeclaration) + .map((node) => _angularImportsFromNode(node)) + .reduce((acc, current) => { + for (const key of Object.keys(current)) { + acc[key] = current[key]; + } + return acc; + }, {}); + return getSourceNodes(source) + .filter((node) => { + return (node.kind == ts.SyntaxKind.Decorator && + node.expression.kind == ts.SyntaxKind.CallExpression); + }) + .map((node) => node.expression) + .filter((expr) => { + if (expr.expression.kind == ts.SyntaxKind.Identifier) { + const id = expr.expression; + return id.text == identifier && angularImports[id.text] === module; + } + else if (expr.expression.kind == ts.SyntaxKind.PropertyAccessExpression) { + // This covers foo.NgModule when importing * as foo. + const paExpr = expr.expression; + // If the left expression is not an identifier, just give up at that point. + if (paExpr.expression.kind !== ts.SyntaxKind.Identifier) { + return false; + } + const id = paExpr.name.text; + const moduleId = paExpr.expression.text; + return id === identifier && angularImports[moduleId + '.'] === module; + } + return false; + }) + .filter((expr) => expr.arguments[0] && expr.arguments[0].kind == ts.SyntaxKind.ObjectLiteralExpression) + .map((expr) => expr.arguments[0]); +} +exports.getDecoratorMetadata = getDecoratorMetadata; +function getMetadataField(node, metadataField) { + return (node.properties + .filter(ts.isPropertyAssignment) + // Filter out every fields that's not "metadataField". Also handles string literals + // (but not expressions). + .filter(({ name }) => { + return (ts.isIdentifier(name) || ts.isStringLiteral(name)) && name.text === metadataField; + })); +} +exports.getMetadataField = getMetadataField; +function addSymbolToNgModuleMetadata(source, ngModulePath, metadataField, symbolName, importPath = null) { + const nodes = getDecoratorMetadata(source, 'NgModule', '@angular/core'); + let node = nodes[0]; // eslint-disable-line @typescript-eslint/no-explicit-any + // Find the decorator declaration. + if (!node) { + return []; + } + // Get all the children property assignment of object literals. + const matchingProperties = getMetadataField(node, metadataField); + if (matchingProperties.length == 0) { + // We haven't found the field in the metadata declaration. Insert a new field. + const expr = node; + let position; + let toInsert; + if (expr.properties.length == 0) { + position = expr.getEnd() - 1; + toInsert = `\n ${metadataField}: [\n${core_1.tags.indentBy(4) `${symbolName}`}\n ]\n`; + } + else { + node = expr.properties[expr.properties.length - 1]; + position = node.getEnd(); + // Get the indentation of the last element, if any. + const text = node.getFullText(source); + const matches = text.match(/^(\r?\n)(\s*)/); + if (matches) { + toInsert = + `,${matches[0]}${metadataField}: [${matches[1]}` + + `${core_1.tags.indentBy(matches[2].length + 2) `${symbolName}`}${matches[0]}]`; + } + else { + toInsert = `, ${metadataField}: [${symbolName}]`; + } + } + if (importPath !== null) { + return [ + new change_1.InsertChange(ngModulePath, position, toInsert), + insertImport(source, ngModulePath, symbolName.replace(/\..*$/, ''), importPath), + ]; + } + else { + return [new change_1.InsertChange(ngModulePath, position, toInsert)]; + } + } + const assignment = matchingProperties[0]; + // If it's not an array, nothing we can do really. + if (assignment.initializer.kind !== ts.SyntaxKind.ArrayLiteralExpression) { + return []; + } + const arrLiteral = assignment.initializer; + if (arrLiteral.elements.length == 0) { + // Forward the property. + node = arrLiteral; + } + else { + node = arrLiteral.elements; + } + if (Array.isArray(node)) { + const nodeArray = node; + const symbolsArray = nodeArray.map((node) => core_1.tags.oneLine `${node.getText()}`); + if (symbolsArray.includes(core_1.tags.oneLine `${symbolName}`)) { + return []; + } + node = node[node.length - 1]; + } + let toInsert; + let position = node.getEnd(); + if (node.kind == ts.SyntaxKind.ArrayLiteralExpression) { + // We found the field but it's empty. Insert it just before the `]`. + position--; + toInsert = `\n${core_1.tags.indentBy(4) `${symbolName}`}\n `; + } + else { + // Get the indentation of the last element, if any. + const text = node.getFullText(source); + const matches = text.match(/^(\r?\n)(\s*)/); + if (matches) { + toInsert = `,${matches[1]}${core_1.tags.indentBy(matches[2].length) `${symbolName}`}`; + } + else { + toInsert = `, ${symbolName}`; + } + } + if (importPath !== null) { + return [ + new change_1.InsertChange(ngModulePath, position, toInsert), + insertImport(source, ngModulePath, symbolName.replace(/\..*$/, ''), importPath), + ]; + } + return [new change_1.InsertChange(ngModulePath, position, toInsert)]; +} +exports.addSymbolToNgModuleMetadata = addSymbolToNgModuleMetadata; +/** + * Custom function to insert a declaration (component, pipe, directive) + * into NgModule declarations. It also imports the component. + */ +function addDeclarationToModule(source, modulePath, classifiedName, importPath) { + return addSymbolToNgModuleMetadata(source, modulePath, 'declarations', classifiedName, importPath); +} +exports.addDeclarationToModule = addDeclarationToModule; +/** + * Custom function to insert an NgModule into NgModule imports. It also imports the module. + */ +function addImportToModule(source, modulePath, classifiedName, importPath) { + return addSymbolToNgModuleMetadata(source, modulePath, 'imports', classifiedName, importPath); +} +exports.addImportToModule = addImportToModule; +/** + * Custom function to insert a provider into NgModule. It also imports it. + */ +function addProviderToModule(source, modulePath, classifiedName, importPath) { + return addSymbolToNgModuleMetadata(source, modulePath, 'providers', classifiedName, importPath); +} +exports.addProviderToModule = addProviderToModule; +/** + * Custom function to insert an export into NgModule. It also imports it. + */ +function addExportToModule(source, modulePath, classifiedName, importPath) { + return addSymbolToNgModuleMetadata(source, modulePath, 'exports', classifiedName, importPath); +} +exports.addExportToModule = addExportToModule; +/** + * Custom function to insert an export into NgModule. It also imports it. + */ +function addBootstrapToModule(source, modulePath, classifiedName, importPath) { + return addSymbolToNgModuleMetadata(source, modulePath, 'bootstrap', classifiedName, importPath); +} +exports.addBootstrapToModule = addBootstrapToModule; +/** + * Determine if an import already exists. + */ +function isImported(source, classifiedName, importPath) { + const allNodes = getSourceNodes(source); + const matchingNodes = allNodes + .filter(ts.isImportDeclaration) + .filter((imp) => ts.isStringLiteral(imp.moduleSpecifier) && imp.moduleSpecifier.text === importPath) + .filter((imp) => { + if (!imp.importClause) { + return false; + } + const nodes = findNodes(imp.importClause, ts.isImportSpecifier).filter((n) => n.getText() === classifiedName); + return nodes.length > 0; + }); + return matchingNodes.length > 0; +} +exports.isImported = isImported; +/** + * This function returns the name of the environment export + * whether this export is aliased or not. If the environment file + * is not imported, then it will return `null`. + */ +function getEnvironmentExportName(source) { + // Initial value is `null` as we don't know yet if the user + // has imported `environment` into the root module or not. + let environmentExportName = null; + const allNodes = getSourceNodes(source); + allNodes + .filter(ts.isImportDeclaration) + .filter((declaration) => declaration.moduleSpecifier.kind === ts.SyntaxKind.StringLiteral && + declaration.importClause !== undefined) + .map((declaration) => + // If `importClause` property is defined then the first + // child will be `NamedImports` object (or `namedBindings`). + declaration.importClause.getChildAt(0)) + // Find those `NamedImports` object that contains `environment` keyword + // in its text. E.g. `{ environment as env }`. + .filter(ts.isNamedImports) + .filter((namedImports) => namedImports.getText().includes('environment')) + .forEach((namedImports) => { + for (const specifier of namedImports.elements) { + // `propertyName` is defined if the specifier + // has an aliased import. + const name = specifier.propertyName || specifier.name; + // Find specifier that contains `environment` keyword in its text. + // Whether it's `environment` or `environment as env`. + if (name.text.includes('environment')) { + environmentExportName = specifier.name.text; + } + } + }); + return environmentExportName; +} +exports.getEnvironmentExportName = getEnvironmentExportName; +/** + * Returns the RouterModule declaration from NgModule metadata, if any. + */ +function getRouterModuleDeclaration(source) { + const result = getDecoratorMetadata(source, 'NgModule', '@angular/core'); + const node = result[0]; + const matchingProperties = getMetadataField(node, 'imports'); + if (!matchingProperties) { + return; + } + const assignment = matchingProperties[0]; + if (assignment.initializer.kind !== ts.SyntaxKind.ArrayLiteralExpression) { + return; + } + const arrLiteral = assignment.initializer; + return arrLiteral.elements + .filter((el) => el.kind === ts.SyntaxKind.CallExpression) + .find((el) => el.getText().startsWith('RouterModule')); +} +exports.getRouterModuleDeclaration = getRouterModuleDeclaration; +/** + * Adds a new route declaration to a router module (i.e. has a RouterModule declaration) + */ +function addRouteDeclarationToModule(source, fileToAdd, routeLiteral) { + const routerModuleExpr = getRouterModuleDeclaration(source); + if (!routerModuleExpr) { + throw new Error(`Couldn't find a route declaration in ${fileToAdd}.`); + } + const scopeConfigMethodArgs = routerModuleExpr.arguments; + if (!scopeConfigMethodArgs.length) { + const { line } = source.getLineAndCharacterOfPosition(routerModuleExpr.getStart()); + throw new Error(`The router module method doesn't have arguments ` + `at line ${line} in ${fileToAdd}`); + } + let routesArr; + const routesArg = scopeConfigMethodArgs[0]; + // Check if the route declarations array is + // an inlined argument of RouterModule or a standalone variable + if (ts.isArrayLiteralExpression(routesArg)) { + routesArr = routesArg; + } + else { + const routesVarName = routesArg.getText(); + let routesVar; + if (routesArg.kind === ts.SyntaxKind.Identifier) { + routesVar = source.statements.filter(ts.isVariableStatement).find((v) => { + return v.declarationList.declarations[0].name.getText() === routesVarName; + }); + } + if (!routesVar) { + const { line } = source.getLineAndCharacterOfPosition(routesArg.getStart()); + throw new Error(`No route declaration array was found that corresponds ` + + `to router module at line ${line} in ${fileToAdd}`); + } + routesArr = findNodes(routesVar, ts.SyntaxKind.ArrayLiteralExpression, 1)[0]; + } + const occurrencesCount = routesArr.elements.length; + const text = routesArr.getFullText(source); + let route = routeLiteral; + let insertPos = routesArr.elements.pos; + if (occurrencesCount > 0) { + const lastRouteLiteral = [...routesArr.elements].pop(); + const lastRouteIsWildcard = ts.isObjectLiteralExpression(lastRouteLiteral) && + lastRouteLiteral.properties.some((n) => ts.isPropertyAssignment(n) && + ts.isIdentifier(n.name) && + n.name.text === 'path' && + ts.isStringLiteral(n.initializer) && + n.initializer.text === '**'); + const indentation = text.match(/\r?\n(\r?)\s*/) || []; + const routeText = `${indentation[0] || ' '}${routeLiteral}`; + // Add the new route before the wildcard route + // otherwise we'll always redirect to the wildcard route + if (lastRouteIsWildcard) { + insertPos = lastRouteLiteral.pos; + route = `${routeText},`; + } + else { + insertPos = lastRouteLiteral.end; + route = `,${routeText}`; + } + } + return new change_1.InsertChange(fileToAdd, insertPos, route); +} +exports.addRouteDeclarationToModule = addRouteDeclarationToModule; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.d.ts new file mode 100644 index 00000000..5ee5968e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.d.ts @@ -0,0 +1,68 @@ +/** + * @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 { UpdateRecorder } from '@angular-devkit/schematics'; +export interface Host { + write(path: string, content: string): Promise<void>; + read(path: string): Promise<string>; +} +export interface Change { + apply(host: Host): Promise<void>; + readonly path: string | null; + readonly order: number; + readonly description: string; +} +/** + * An operation that does nothing. + */ +export declare class NoopChange implements Change { + description: string; + order: number; + path: null; + apply(): Promise<void>; +} +/** + * Will add text to the source code. + */ +export declare class InsertChange implements Change { + path: string; + pos: number; + toAdd: string; + order: number; + description: string; + constructor(path: string, pos: number, toAdd: string); + /** + * This method does not insert spaces if there is none in the original string. + */ + apply(host: Host): Promise<void>; +} +/** + * Will remove text from the source code. + */ +export declare class RemoveChange implements Change { + path: string; + private pos; + toRemove: string; + order: number; + description: string; + constructor(path: string, pos: number, toRemove: string); + apply(host: Host): Promise<void>; +} +/** + * Will replace text from the source code. + */ +export declare class ReplaceChange implements Change { + path: string; + private pos; + oldText: string; + newText: string; + order: number; + description: string; + constructor(path: string, pos: number, oldText: string, newText: string); + apply(host: Host): Promise<void>; +} +export declare function applyToUpdateRecorder(recorder: UpdateRecorder, changes: Change[]): void; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.js new file mode 100644 index 00000000..a1fbdde7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.js @@ -0,0 +1,121 @@ +"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.applyToUpdateRecorder = exports.ReplaceChange = exports.RemoveChange = exports.InsertChange = exports.NoopChange = void 0; +/** + * An operation that does nothing. + */ +class NoopChange { + constructor() { + this.description = 'No operation.'; + this.order = Infinity; + this.path = null; + } + apply() { + return Promise.resolve(); + } +} +exports.NoopChange = NoopChange; +/** + * Will add text to the source code. + */ +class InsertChange { + constructor(path, pos, toAdd) { + this.path = path; + this.pos = pos; + this.toAdd = toAdd; + if (pos < 0) { + throw new Error('Negative positions are invalid'); + } + this.description = `Inserted ${toAdd} into position ${pos} of ${path}`; + this.order = pos; + } + /** + * This method does not insert spaces if there is none in the original string. + */ + apply(host) { + return host.read(this.path).then((content) => { + const prefix = content.substring(0, this.pos); + const suffix = content.substring(this.pos); + return host.write(this.path, `${prefix}${this.toAdd}${suffix}`); + }); + } +} +exports.InsertChange = InsertChange; +/** + * Will remove text from the source code. + */ +class RemoveChange { + constructor(path, pos, toRemove) { + this.path = path; + this.pos = pos; + this.toRemove = toRemove; + if (pos < 0) { + throw new Error('Negative positions are invalid'); + } + this.description = `Removed ${toRemove} into position ${pos} of ${path}`; + this.order = pos; + } + apply(host) { + return host.read(this.path).then((content) => { + const prefix = content.substring(0, this.pos); + const suffix = content.substring(this.pos + this.toRemove.length); + // TODO: throw error if toRemove doesn't match removed string. + return host.write(this.path, `${prefix}${suffix}`); + }); + } +} +exports.RemoveChange = RemoveChange; +/** + * Will replace text from the source code. + */ +class ReplaceChange { + constructor(path, pos, oldText, newText) { + this.path = path; + this.pos = pos; + this.oldText = oldText; + this.newText = newText; + if (pos < 0) { + throw new Error('Negative positions are invalid'); + } + this.description = `Replaced ${oldText} into position ${pos} of ${path} with ${newText}`; + this.order = pos; + } + apply(host) { + return host.read(this.path).then((content) => { + const prefix = content.substring(0, this.pos); + const suffix = content.substring(this.pos + this.oldText.length); + const text = content.substring(this.pos, this.pos + this.oldText.length); + if (text !== this.oldText) { + return Promise.reject(new Error(`Invalid replace: "${text}" != "${this.oldText}".`)); + } + // TODO: throw error if oldText doesn't match removed string. + return host.write(this.path, `${prefix}${this.newText}${suffix}`); + }); + } +} +exports.ReplaceChange = ReplaceChange; +function applyToUpdateRecorder(recorder, changes) { + for (const change of changes) { + if (change instanceof InsertChange) { + recorder.insertLeft(change.pos, change.toAdd); + } + else if (change instanceof RemoveChange) { + recorder.remove(change.order, change.toRemove.length); + } + else if (change instanceof ReplaceChange) { + recorder.remove(change.order, change.oldText.length); + recorder.insertLeft(change.order, change.newText); + } + else if (!(change instanceof NoopChange)) { + throw new Error('Unknown Change type encountered when updating a recorder.'); + } + } +} +exports.applyToUpdateRecorder = applyToUpdateRecorder; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/dependencies.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/dependencies.d.ts new file mode 100644 index 00000000..e311a2ba --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/dependencies.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 { Tree } from '@angular-devkit/schematics'; +export declare enum NodeDependencyType { + Default = "dependencies", + Dev = "devDependencies", + Peer = "peerDependencies", + Optional = "optionalDependencies" +} +export interface NodeDependency { + type: NodeDependencyType; + name: string; + version: string; + overwrite?: boolean; +} +export declare function addPackageJsonDependency(tree: Tree, dependency: NodeDependency, pkgJsonPath?: string): void; +export declare function removePackageJsonDependency(tree: Tree, name: string, pkgJsonPath?: string): void; +export declare function getPackageJsonDependency(tree: Tree, name: string, pkgJsonPath?: string): NodeDependency | null; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/dependencies.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/dependencies.js new file mode 100644 index 00000000..94bda579 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/dependencies.js @@ -0,0 +1,56 @@ +"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.getPackageJsonDependency = exports.removePackageJsonDependency = exports.addPackageJsonDependency = exports.NodeDependencyType = void 0; +const json_file_1 = require("./json-file"); +const PKG_JSON_PATH = '/package.json'; +var NodeDependencyType; +(function (NodeDependencyType) { + NodeDependencyType["Default"] = "dependencies"; + NodeDependencyType["Dev"] = "devDependencies"; + NodeDependencyType["Peer"] = "peerDependencies"; + NodeDependencyType["Optional"] = "optionalDependencies"; +})(NodeDependencyType = exports.NodeDependencyType || (exports.NodeDependencyType = {})); +const ALL_DEPENDENCY_TYPE = [ + NodeDependencyType.Default, + NodeDependencyType.Dev, + NodeDependencyType.Optional, + NodeDependencyType.Peer, +]; +function addPackageJsonDependency(tree, dependency, pkgJsonPath = PKG_JSON_PATH) { + const json = new json_file_1.JSONFile(tree, pkgJsonPath); + const { overwrite, type, name, version } = dependency; + const path = [type, name]; + if (overwrite || !json.get(path)) { + json.modify(path, version); + } +} +exports.addPackageJsonDependency = addPackageJsonDependency; +function removePackageJsonDependency(tree, name, pkgJsonPath = PKG_JSON_PATH) { + const json = new json_file_1.JSONFile(tree, pkgJsonPath); + for (const depType of ALL_DEPENDENCY_TYPE) { + json.remove([depType, name]); + } +} +exports.removePackageJsonDependency = removePackageJsonDependency; +function getPackageJsonDependency(tree, name, pkgJsonPath = PKG_JSON_PATH) { + const json = new json_file_1.JSONFile(tree, pkgJsonPath); + for (const depType of ALL_DEPENDENCY_TYPE) { + const version = json.get([depType, name]); + if (typeof version === 'string') { + return { + type: depType, + name: name, + version, + }; + } + } + return null; +} +exports.getPackageJsonDependency = getPackageJsonDependency; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/find-module.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/find-module.d.ts new file mode 100644 index 00000000..6a303141 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/find-module.d.ts @@ -0,0 +1,32 @@ +/** + * @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 } from '@angular-devkit/core'; +import { Tree } from '@angular-devkit/schematics'; +export interface ModuleOptions { + module?: string; + name: string; + flat?: boolean; + path?: string; + skipImport?: boolean; + moduleExt?: string; + routingModuleExt?: string; +} +export declare const MODULE_EXT = ".module.ts"; +export declare const ROUTING_MODULE_EXT = "-routing.module.ts"; +/** + * Find the module referred by a set of options passed to the schematics. + */ +export declare function findModuleFromOptions(host: Tree, options: ModuleOptions): Path | undefined; +/** + * Function to find the "closest" module to a generated file's path. + */ +export declare function findModule(host: Tree, generateDir: string, moduleExt?: string, routingModuleExt?: string): Path; +/** + * Build a relative path from one file path to another file path. + */ +export declare function buildRelativePath(from: string, to: string): string; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/find-module.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/find-module.js new file mode 100644 index 00000000..6b3a6c9a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/find-module.js @@ -0,0 +1,110 @@ +"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.buildRelativePath = exports.findModule = exports.findModuleFromOptions = exports.ROUTING_MODULE_EXT = exports.MODULE_EXT = void 0; +const core_1 = require("@angular-devkit/core"); +exports.MODULE_EXT = '.module.ts'; +exports.ROUTING_MODULE_EXT = '-routing.module.ts'; +/** + * Find the module referred by a set of options passed to the schematics. + */ +function findModuleFromOptions(host, options) { + // eslint-disable-next-line no-prototype-builtins + if (options.hasOwnProperty('skipImport') && options.skipImport) { + return undefined; + } + const moduleExt = options.moduleExt || exports.MODULE_EXT; + const routingModuleExt = options.routingModuleExt || exports.ROUTING_MODULE_EXT; + if (!options.module) { + const pathToCheck = (options.path || '') + '/' + options.name; + return (0, core_1.normalize)(findModule(host, pathToCheck, moduleExt, routingModuleExt)); + } + else { + const modulePath = (0, core_1.normalize)(`/${options.path}/${options.module}`); + const componentPath = (0, core_1.normalize)(`/${options.path}/${options.name}`); + const moduleBaseName = (0, core_1.normalize)(modulePath).split('/').pop(); + const candidateSet = new Set([(0, core_1.normalize)(options.path || '/')]); + for (let dir = modulePath; dir != core_1.NormalizedRoot; dir = (0, core_1.dirname)(dir)) { + candidateSet.add(dir); + } + for (let dir = componentPath; dir != core_1.NormalizedRoot; dir = (0, core_1.dirname)(dir)) { + candidateSet.add(dir); + } + const candidatesDirs = [...candidateSet].sort((a, b) => b.length - a.length); + for (const c of candidatesDirs) { + const candidateFiles = [ + '', + `${moduleBaseName}.ts`, + `${moduleBaseName}${moduleExt}`, + ].map((x) => (0, core_1.join)(c, x)); + for (const sc of candidateFiles) { + if (host.exists(sc)) { + return (0, core_1.normalize)(sc); + } + } + } + throw new Error(`Specified module '${options.module}' does not exist.\n` + + `Looked in the following directories:\n ${candidatesDirs.join('\n ')}`); + } +} +exports.findModuleFromOptions = findModuleFromOptions; +/** + * Function to find the "closest" module to a generated file's path. + */ +function findModule(host, generateDir, moduleExt = exports.MODULE_EXT, routingModuleExt = exports.ROUTING_MODULE_EXT) { + let dir = host.getDir('/' + generateDir); + let foundRoutingModule = false; + while (dir) { + const allMatches = dir.subfiles.filter((p) => p.endsWith(moduleExt)); + const filteredMatches = allMatches.filter((p) => !p.endsWith(routingModuleExt)); + foundRoutingModule = foundRoutingModule || allMatches.length !== filteredMatches.length; + if (filteredMatches.length == 1) { + return (0, core_1.join)(dir.path, filteredMatches[0]); + } + else if (filteredMatches.length > 1) { + throw new Error('More than one module matches. Use the skip-import option to skip importing ' + + 'the component into the closest module or use the module option to specify a module.'); + } + dir = dir.parent; + } + const errorMsg = foundRoutingModule + ? 'Could not find a non Routing NgModule.' + + `\nModules with suffix '${routingModuleExt}' are strictly reserved for routing.` + + '\nUse the skip-import option to skip importing in NgModule.' + : 'Could not find an NgModule. Use the skip-import option to skip importing in NgModule.'; + throw new Error(errorMsg); +} +exports.findModule = findModule; +/** + * Build a relative path from one file path to another file path. + */ +function buildRelativePath(from, to) { + from = (0, core_1.normalize)(from); + to = (0, core_1.normalize)(to); + // Convert to arrays. + const fromParts = from.split('/'); + const toParts = to.split('/'); + // Remove file names (preserving destination) + fromParts.pop(); + const toFileName = toParts.pop(); + const relativePath = (0, core_1.relative)((0, core_1.normalize)(fromParts.join('/') || '/'), (0, core_1.normalize)(toParts.join('/') || '/')); + let pathPrefix = ''; + // Set the path prefix for same dir or child dir, parent dir starts with `..` + if (!relativePath) { + pathPrefix = '.'; + } + else if (!relativePath.startsWith('.')) { + pathPrefix = `./`; + } + if (pathPrefix && !pathPrefix.endsWith('/')) { + pathPrefix += '/'; + } + return pathPrefix + (relativePath ? relativePath + '/' : '') + toFileName; +} +exports.buildRelativePath = buildRelativePath; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/generate-from-files.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/generate-from-files.d.ts new file mode 100644 index 00000000..61c0aac1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/generate-from-files.d.ts @@ -0,0 +1,17 @@ +/** + * @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 { Rule } from '@angular-devkit/schematics'; +export interface GenerateFromFilesOptions { + flat?: boolean; + name: string; + path?: string; + prefix?: string; + project?: string; + skipTests?: boolean; +} +export declare function generateFromFiles(options: GenerateFromFilesOptions, extraTemplateValues?: Record<string, string | ((v: string) => string)>): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/generate-from-files.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/generate-from-files.js new file mode 100644 index 00000000..73ae8518 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/generate-from-files.js @@ -0,0 +1,36 @@ +"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.generateFromFiles = void 0; +const core_1 = require("@angular-devkit/core"); +const schematics_1 = require("@angular-devkit/schematics"); +const parse_name_1 = require("./parse-name"); +const workspace_1 = require("./workspace"); +function generateFromFiles(options, extraTemplateValues = {}) { + return async (host) => { + var _a, _b, _c; + (_a = options.path) !== null && _a !== void 0 ? _a : (options.path = await (0, workspace_1.createDefaultPath)(host, options.project)); + (_b = options.prefix) !== null && _b !== void 0 ? _b : (options.prefix = ''); + (_c = options.flat) !== null && _c !== void 0 ? _c : (options.flat = true); + const parsedPath = (0, parse_name_1.parseName)(options.path, options.name); + options.name = parsedPath.name; + options.path = parsedPath.path; + 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, + ...options, + ...extraTemplateValues, + }), + (0, schematics_1.move)(parsedPath.path + (options.flat ? '' : '/' + core_1.strings.dasherize(options.name))), + ]); + return (0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]); + }; +} +exports.generateFromFiles = generateFromFiles; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/json-file.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/json-file.d.ts new file mode 100644 index 00000000..6d85bf4a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/json-file.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 { JsonValue } from '@angular-devkit/core'; +import { Tree } from '@angular-devkit/schematics'; +export declare type InsertionIndex = (properties: string[]) => number; +export declare type JSONPath = (string | number)[]; +/** @internal */ +export declare class JSONFile { + private readonly host; + private readonly path; + content: string; + constructor(host: Tree, path: string); + private _jsonAst; + private get JsonAst(); + get(jsonPath: JSONPath): unknown; + modify(jsonPath: JSONPath, value: JsonValue | undefined, insertInOrder?: InsertionIndex | false): void; + remove(jsonPath: JSONPath): void; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/json-file.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/json-file.js new file mode 100644 index 00000000..4fc5525d --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/json-file.js @@ -0,0 +1,74 @@ +"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.JSONFile = void 0; +const jsonc_parser_1 = require("jsonc-parser"); +/** @internal */ +class JSONFile { + constructor(host, path) { + this.host = host; + this.path = path; + const buffer = this.host.read(this.path); + if (buffer) { + this.content = buffer.toString(); + } + else { + throw new Error(`Could not read '${path}'.`); + } + } + get JsonAst() { + if (this._jsonAst) { + return this._jsonAst; + } + const errors = []; + this._jsonAst = (0, jsonc_parser_1.parseTree)(this.content, errors, { allowTrailingComma: true }); + if (errors.length) { + const { error, offset } = errors[0]; + throw new Error(`Failed to parse "${this.path}" as JSON AST Object. ${(0, jsonc_parser_1.printParseErrorCode)(error)} at location: ${offset}.`); + } + return this._jsonAst; + } + get(jsonPath) { + const jsonAstNode = this.JsonAst; + if (!jsonAstNode) { + return undefined; + } + if (jsonPath.length === 0) { + return (0, jsonc_parser_1.getNodeValue)(jsonAstNode); + } + const node = (0, jsonc_parser_1.findNodeAtLocation)(jsonAstNode, jsonPath); + return node === undefined ? undefined : (0, jsonc_parser_1.getNodeValue)(node); + } + modify(jsonPath, value, insertInOrder) { + let getInsertionIndex; + if (insertInOrder === undefined) { + const property = jsonPath.slice(-1)[0]; + getInsertionIndex = (properties) => [...properties, property].sort().findIndex((p) => p === property); + } + else if (insertInOrder !== false) { + getInsertionIndex = insertInOrder; + } + const edits = (0, jsonc_parser_1.modify)(this.content, jsonPath, value, { + getInsertionIndex, + formattingOptions: { + insertSpaces: true, + tabSize: 2, + }, + }); + this.content = (0, jsonc_parser_1.applyEdits)(this.content, edits); + this.host.overwrite(this.path, this.content); + this._jsonAst = undefined; + } + remove(jsonPath) { + if (this.get(jsonPath) !== undefined) { + this.modify(jsonPath, undefined); + } + } +} +exports.JSONFile = JSONFile; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/latest-versions.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/latest-versions.d.ts new file mode 100644 index 00000000..ff4c5f87 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/latest-versions.d.ts @@ -0,0 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +export declare const latestVersions: Record<string, string> & { + Angular: string; + DevkitBuildAngular: string; +}; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/latest-versions.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/latest-versions.js new file mode 100644 index 00000000..34c084bf --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/latest-versions.js @@ -0,0 +1,21 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.latestVersions = void 0; +exports.latestVersions = { + // We could have used TypeScripts' `resolveJsonModule` to make the `latestVersion` object typesafe, + // but ts_library doesn't support JSON inputs. + ...require('./latest-versions/package.json')['dependencies'], + // As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current + Angular: '~13.2.0', + // Since @angular-devkit/build-angular and @schematics/angular are always + // published together from the same monorepo, and they are both + // non-experimental, they will always have the same version. + DevkitBuildAngular: '~' + require('../package.json')['version'], +}; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/latest-versions/package.json b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/latest-versions/package.json new file mode 100644 index 00000000..c5add1c2 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/latest-versions/package.json @@ -0,0 +1,20 @@ +{ + "description": "Package versions used by schematics in @schematics/angular.", + "comment": "This file is needed so that depedencies are synced by Renovate.", + "private": true, + "dependencies": { + "@types/jasmine": "~3.10.0", + "@types/node": "^12.11.1", + "jasmine-core": "~4.0.0", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage": "~2.1.0", + "karma-jasmine-html-reporter": "~1.7.0", + "karma-jasmine": "~4.0.0", + "karma": "~6.3.0", + "ng-packagr": "^13.0.0", + "rxjs": "~7.5.0", + "tslib": "^2.3.0", + "typescript": "~4.5.2", + "zone.js": "~0.11.4" + } +} diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ng-ast-utils.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ng-ast-utils.d.ts new file mode 100644 index 00000000..c58abbdc --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ng-ast-utils.d.ts @@ -0,0 +1,12 @@ +/** + * @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 { Tree } from '@angular-devkit/schematics'; +import * as ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescript'; +export declare function findBootstrapModuleCall(host: Tree, mainPath: string): ts.CallExpression | null; +export declare function findBootstrapModulePath(host: Tree, mainPath: string): string; +export declare function getAppModulePath(host: Tree, mainPath: string): string; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ng-ast-utils.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ng-ast-utils.js new file mode 100644 index 00000000..687a3254 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/ng-ast-utils.js @@ -0,0 +1,94 @@ +"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.getAppModulePath = exports.findBootstrapModulePath = exports.findBootstrapModuleCall = void 0; +const core_1 = require("@angular-devkit/core"); +const schematics_1 = require("@angular-devkit/schematics"); +const path_1 = require("path"); +const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript")); +const ast_utils_1 = require("../utility/ast-utils"); +function findBootstrapModuleCall(host, mainPath) { + const mainBuffer = host.read(mainPath); + if (!mainBuffer) { + throw new schematics_1.SchematicsException(`Main file (${mainPath}) not found`); + } + const mainText = mainBuffer.toString('utf-8'); + const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true); + const allNodes = (0, ast_utils_1.getSourceNodes)(source); + let bootstrapCall = null; + for (const node of allNodes) { + let bootstrapCallNode = null; + bootstrapCallNode = (0, ast_utils_1.findNode)(node, ts.SyntaxKind.Identifier, 'bootstrapModule'); + // Walk up the parent until CallExpression is found. + while (bootstrapCallNode && + bootstrapCallNode.parent && + bootstrapCallNode.parent.kind !== ts.SyntaxKind.CallExpression) { + bootstrapCallNode = bootstrapCallNode.parent; + } + if (bootstrapCallNode !== null && + bootstrapCallNode.parent !== undefined && + bootstrapCallNode.parent.kind === ts.SyntaxKind.CallExpression) { + bootstrapCall = bootstrapCallNode.parent; + break; + } + } + return bootstrapCall; +} +exports.findBootstrapModuleCall = findBootstrapModuleCall; +function findBootstrapModulePath(host, mainPath) { + const bootstrapCall = findBootstrapModuleCall(host, mainPath); + if (!bootstrapCall) { + throw new schematics_1.SchematicsException('Bootstrap call not found'); + } + const bootstrapModule = bootstrapCall.arguments[0]; + const mainBuffer = host.read(mainPath); + if (!mainBuffer) { + throw new schematics_1.SchematicsException(`Client app main file (${mainPath}) not found`); + } + const mainText = mainBuffer.toString('utf-8'); + const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true); + const allNodes = (0, ast_utils_1.getSourceNodes)(source); + const bootstrapModuleRelativePath = allNodes + .filter(ts.isImportDeclaration) + .filter((imp) => { + return (0, ast_utils_1.findNode)(imp, ts.SyntaxKind.Identifier, bootstrapModule.getText()); + }) + .map((imp) => { + const modulePathStringLiteral = imp.moduleSpecifier; + return modulePathStringLiteral.text; + })[0]; + return bootstrapModuleRelativePath; +} +exports.findBootstrapModulePath = findBootstrapModulePath; +function getAppModulePath(host, mainPath) { + const moduleRelativePath = findBootstrapModulePath(host, mainPath); + const mainDir = (0, path_1.dirname)(mainPath); + const modulePath = (0, core_1.normalize)(`/${mainDir}/${moduleRelativePath}.ts`); + return modulePath; +} +exports.getAppModulePath = getAppModulePath; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/parse-name.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/parse-name.d.ts new file mode 100644 index 00000000..259df90f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/parse-name.d.ts @@ -0,0 +1,13 @@ +/** + * @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 } from '@angular-devkit/core'; +export interface Location { + name: string; + path: Path; +} +export declare function parseName(path: string, name: string): Location; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/parse-name.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/parse-name.js new file mode 100644 index 00000000..9dcbf007 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/parse-name.js @@ -0,0 +1,21 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseName = void 0; +// import { relative, Path } from "../../../angular_devkit/core/src/virtual-fs"; +const core_1 = require("@angular-devkit/core"); +function parseName(path, name) { + const nameWithoutPath = (0, core_1.basename)((0, core_1.normalize)(name)); + const namePath = (0, core_1.dirname)((0, core_1.join)((0, core_1.normalize)(path), name)); + return { + name: nameWithoutPath, + path: (0, core_1.normalize)('/' + namePath), + }; +} +exports.parseName = parseName; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/paths.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/paths.d.ts new file mode 100644 index 00000000..af72a15b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/paths.d.ts @@ -0,0 +1,8 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +export declare function relativePathToWorkspaceRoot(projectRoot: string | undefined): string; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/paths.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/paths.js new file mode 100644 index 00000000..cb2c9a77 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/paths.js @@ -0,0 +1,21 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.relativePathToWorkspaceRoot = void 0; +const core_1 = require("@angular-devkit/core"); +function relativePathToWorkspaceRoot(projectRoot) { + const normalizedPath = (0, core_1.split)((0, core_1.normalize)(projectRoot || '')); + if (normalizedPath.length === 0 || !normalizedPath[0]) { + return '.'; + } + else { + return normalizedPath.map(() => '..').join('/'); + } +} +exports.relativePathToWorkspaceRoot = relativePathToWorkspaceRoot; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/project-targets.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/project-targets.d.ts new file mode 100644 index 00000000..96b88225 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/project-targets.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 { SchematicsException } from '@angular-devkit/schematics'; +export declare function targetBuildNotFoundError(): SchematicsException; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/project-targets.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/project-targets.js new file mode 100644 index 00000000..cd3308c6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/project-targets.js @@ -0,0 +1,15 @@ +"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.targetBuildNotFoundError = void 0; +const schematics_1 = require("@angular-devkit/schematics"); +function targetBuildNotFoundError() { + return new schematics_1.SchematicsException(`Project target "build" not found.`); +} +exports.targetBuildNotFoundError = targetBuildNotFoundError; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/create-app-module.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/create-app-module.d.ts new file mode 100644 index 00000000..212c0d42 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/create-app-module.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 { UnitTestTree } from '@angular-devkit/schematics/testing'; +export declare function createAppModule(tree: UnitTestTree, path?: string): UnitTestTree; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/create-app-module.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/create-app-module.js new file mode 100644 index 00000000..c74a6a7c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/create-app-module.js @@ -0,0 +1,31 @@ +"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.createAppModule = void 0; +function createAppModule(tree, path) { + tree.create(path || '/src/app/app.module.ts', ` + import { BrowserModule } from '@angular/platform-browser'; + import { NgModule } from '@angular/core'; + import { AppComponent } from './app.component'; + + @NgModule({ + declarations: [ + AppComponent + ], + imports: [ + BrowserModule + ], + providers: [], + bootstrap: [AppComponent] + }) + export class AppModule { } + `); + return tree; +} +exports.createAppModule = createAppModule; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/get-file-content.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/get-file-content.d.ts new file mode 100644 index 00000000..467f4379 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/get-file-content.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 { Tree } from '@angular-devkit/schematics'; +export declare function getFileContent(tree: Tree, path: string): string; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/get-file-content.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/get-file-content.js new file mode 100644 index 00000000..11e14d8c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/get-file-content.js @@ -0,0 +1,18 @@ +"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.getFileContent = void 0; +function getFileContent(tree, path) { + const fileEntry = tree.get(path); + if (!fileEntry) { + throw new Error(`The file (${path}) does not exist.`); + } + return fileEntry.content.toString(); +} +exports.getFileContent = getFileContent; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/index.d.ts new file mode 100644 index 00000000..a05d72b6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/index.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 + */ +export * from './create-app-module'; +export * from './get-file-content'; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/index.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/index.js new file mode 100644 index 00000000..13c15ace --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/test/index.js @@ -0,0 +1,21 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./create-app-module"), exports); +__exportStar(require("./get-file-content"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/validation.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/validation.d.ts new file mode 100644 index 00000000..140a2b3c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/validation.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 + */ +export declare const htmlSelectorRe: RegExp; +export declare function validateHtmlSelector(selector: string): void; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/validation.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/validation.js new file mode 100644 index 00000000..e6cfbccd --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/validation.js @@ -0,0 +1,22 @@ +"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.validateHtmlSelector = exports.htmlSelectorRe = void 0; +const core_1 = require("@angular-devkit/core"); +const schematics_1 = require("@angular-devkit/schematics"); +// Must start with a letter, and must contain only alphanumeric characters or dashes. +// When adding a dash the segment after the dash must also start with a letter. +exports.htmlSelectorRe = /^[a-zA-Z][.0-9a-zA-Z]*(:?-[a-zA-Z][.0-9a-zA-Z]*)*$/; +function validateHtmlSelector(selector) { + if (selector && !exports.htmlSelectorRe.test(selector)) { + throw new schematics_1.SchematicsException(core_1.tags.oneLine `Selector (${selector}) + is invalid.`); + } +} +exports.validateHtmlSelector = validateHtmlSelector; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace-models.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace-models.d.ts new file mode 100644 index 00000000..ea48702f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace-models.d.ts @@ -0,0 +1,152 @@ +/** + * @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 enum ProjectType { + Application = "application", + Library = "library" +} +export declare enum Builders { + AppShell = "@angular-devkit/build-angular:app-shell", + Server = "@angular-devkit/build-angular:server", + Browser = "@angular-devkit/build-angular:browser", + Karma = "@angular-devkit/build-angular:karma", + TsLint = "@angular-devkit/build-angular:tslint", + DeprecatedNgPackagr = "@angular-devkit/build-ng-packagr:build", + NgPackagr = "@angular-devkit/build-angular:ng-packagr", + DevServer = "@angular-devkit/build-angular:dev-server", + ExtractI18n = "@angular-devkit/build-angular:extract-i18n", + Protractor = "@angular-devkit/build-angular:protractor" +} +export interface FileReplacements { + replace: string; + with: string; +} +export interface BrowserBuilderBaseOptions { + main: string; + tsConfig: string; + fileReplacements?: FileReplacements[]; + outputPath?: string; + index?: string; + polyfills: string; + assets?: (object | string)[]; + styles?: (object | string)[]; + scripts?: (object | string)[]; + sourceMap?: boolean; +} +export declare type OutputHashing = 'all' | 'media' | 'none' | 'bundles'; +export interface BrowserBuilderOptions extends BrowserBuilderBaseOptions { + serviceWorker?: boolean; + optimization?: boolean; + outputHashing?: OutputHashing; + resourcesOutputPath?: string; + namedChunks?: boolean; + aot?: boolean; + extractLicenses?: boolean; + vendorChunk?: boolean; + buildOptimizer?: boolean; + ngswConfigPath?: string; + budgets?: { + type: string; + maximumWarning?: string; + maximumError?: string; + }[]; + webWorkerTsConfig?: string; +} +export interface ServeBuilderOptions { + browserTarget: string; +} +export interface LibraryBuilderOptions { + tsConfig: string; + project: string; +} +export interface ServerBuilderOptions { + outputPath: string; + tsConfig: string; + main: string; + fileReplacements?: FileReplacements[]; + optimization?: boolean | { + scripts?: boolean; + styles?: boolean; + }; + sourceMap?: boolean | { + scripts?: boolean; + styles?: boolean; + hidden?: boolean; + vendor?: boolean; + }; +} +export interface AppShellBuilderOptions { + browserTarget: string; + serverTarget: string; + route: string; +} +export interface TestBuilderOptions extends Partial<BrowserBuilderBaseOptions> { + karmaConfig: string; +} +export interface ExtractI18nOptions { + browserTarget: string; +} +export interface E2EOptions { + protractorConfig: string; + devServerTarget: string; +} +export interface BuilderTarget<TBuilder extends Builders, TOptions> { + builder: TBuilder; + options: TOptions; + configurations?: { + production: Partial<TOptions>; + [key: string]: Partial<TOptions>; + }; +} +export declare type LibraryBuilderTarget = BuilderTarget<Builders.NgPackagr, LibraryBuilderOptions>; +export declare type BrowserBuilderTarget = BuilderTarget<Builders.Browser, BrowserBuilderOptions>; +export declare type ServerBuilderTarget = BuilderTarget<Builders.Server, ServerBuilderOptions>; +export declare type AppShellBuilderTarget = BuilderTarget<Builders.AppShell, AppShellBuilderOptions>; +export declare type TestBuilderTarget = BuilderTarget<Builders.Karma, TestBuilderOptions>; +export declare type ServeBuilderTarget = BuilderTarget<Builders.DevServer, ServeBuilderOptions>; +export declare type ExtractI18nBuilderTarget = BuilderTarget<Builders.ExtractI18n, ExtractI18nOptions>; +export declare type E2EBuilderTarget = BuilderTarget<Builders.Protractor, E2EOptions>; +export interface WorkspaceSchema { + version: 1; + defaultProject?: string; + cli?: { + warnings?: Record<string, boolean>; + }; + projects: { + [key: string]: WorkspaceProject<ProjectType.Application | ProjectType.Library>; + }; +} +export interface WorkspaceProject<TProjectType extends ProjectType = ProjectType.Application> { + /** + * Project type. + */ + projectType: ProjectType; + root: string; + sourceRoot: string; + prefix: string; + cli?: { + warnings?: Record<string, boolean>; + }; + /** + * Tool options. + */ + architect?: WorkspaceTargets<TProjectType>; + /** + * Tool options. + */ + targets?: WorkspaceTargets<TProjectType>; +} +export interface WorkspaceTargets<TProjectType extends ProjectType = ProjectType.Application> { + build?: TProjectType extends ProjectType.Library ? LibraryBuilderTarget : BrowserBuilderTarget; + server?: ServerBuilderTarget; + test?: TestBuilderTarget; + serve?: ServeBuilderTarget; + e2e?: E2EBuilderTarget; + 'app-shell'?: AppShellBuilderTarget; + 'extract-i18n'?: ExtractI18nBuilderTarget; + [key: string]: any; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace-models.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace-models.js new file mode 100644 index 00000000..1a04acd6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace-models.js @@ -0,0 +1,28 @@ +"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.Builders = exports.ProjectType = void 0; +var ProjectType; +(function (ProjectType) { + ProjectType["Application"] = "application"; + ProjectType["Library"] = "library"; +})(ProjectType = exports.ProjectType || (exports.ProjectType = {})); +var Builders; +(function (Builders) { + Builders["AppShell"] = "@angular-devkit/build-angular:app-shell"; + Builders["Server"] = "@angular-devkit/build-angular:server"; + Builders["Browser"] = "@angular-devkit/build-angular:browser"; + Builders["Karma"] = "@angular-devkit/build-angular:karma"; + Builders["TsLint"] = "@angular-devkit/build-angular:tslint"; + Builders["DeprecatedNgPackagr"] = "@angular-devkit/build-ng-packagr:build"; + Builders["NgPackagr"] = "@angular-devkit/build-angular:ng-packagr"; + Builders["DevServer"] = "@angular-devkit/build-angular:dev-server"; + Builders["ExtractI18n"] = "@angular-devkit/build-angular:extract-i18n"; + Builders["Protractor"] = "@angular-devkit/build-angular:protractor"; +})(Builders = exports.Builders || (exports.Builders = {})); diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace.d.ts b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace.d.ts new file mode 100644 index 00000000..5154a189 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace.d.ts @@ -0,0 +1,20 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { json, workspaces } from '@angular-devkit/core'; +import { Rule, Tree } from '@angular-devkit/schematics'; +export declare function updateWorkspace(updater: (workspace: workspaces.WorkspaceDefinition) => void | Rule | PromiseLike<void | Rule>): Rule; +export declare function updateWorkspace(workspace: workspaces.WorkspaceDefinition): Rule; +export declare function getWorkspace(tree: Tree, path?: string): Promise<workspaces.WorkspaceDefinition>; +/** + * Build a default project path for generating. + * @param project The project which will have its default path generated. + */ +export declare function buildDefaultPath(project: workspaces.ProjectDefinition): string; +export declare function createDefaultPath(tree: Tree, projectName: string): Promise<string>; +export declare function allWorkspaceTargets(workspace: workspaces.WorkspaceDefinition): Iterable<[string, workspaces.TargetDefinition, string, workspaces.ProjectDefinition]>; +export declare function allTargetOptions(target: workspaces.TargetDefinition, skipBaseOptions?: boolean): Iterable<[string | undefined, Record<string, json.JsonValue | undefined>]>; diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace.js new file mode 100644 index 00000000..9a124f35 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/workspace.js @@ -0,0 +1,97 @@ +"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.allTargetOptions = exports.allWorkspaceTargets = exports.createDefaultPath = exports.buildDefaultPath = exports.getWorkspace = exports.updateWorkspace = void 0; +const core_1 = require("@angular-devkit/core"); +const schematics_1 = require("@angular-devkit/schematics"); +const workspace_models_1 = require("./workspace-models"); +function createHost(tree) { + return { + async readFile(path) { + const data = tree.read(path); + if (!data) { + throw new Error('File not found.'); + } + return core_1.virtualFs.fileBufferToString(data); + }, + async writeFile(path, data) { + return tree.overwrite(path, data); + }, + async isDirectory(path) { + // approximate a directory check + return !tree.exists(path) && tree.getDir(path).subfiles.length > 0; + }, + async isFile(path) { + return tree.exists(path); + }, + }; +} +function updateWorkspace(updaterOrWorkspace) { + return async (tree) => { + const host = createHost(tree); + if (typeof updaterOrWorkspace === 'function') { + const { workspace } = await core_1.workspaces.readWorkspace('/', host); + const result = await updaterOrWorkspace(workspace); + await core_1.workspaces.writeWorkspace(workspace, host); + return result || schematics_1.noop; + } + else { + await core_1.workspaces.writeWorkspace(updaterOrWorkspace, host); + return schematics_1.noop; + } + }; +} +exports.updateWorkspace = updateWorkspace; +async function getWorkspace(tree, path = '/') { + const host = createHost(tree); + const { workspace } = await core_1.workspaces.readWorkspace(path, host); + return workspace; +} +exports.getWorkspace = getWorkspace; +/** + * Build a default project path for generating. + * @param project The project which will have its default path generated. + */ +function buildDefaultPath(project) { + const root = project.sourceRoot ? `/${project.sourceRoot}/` : `/${project.root}/src/`; + const projectDirName = project.extensions['projectType'] === workspace_models_1.ProjectType.Application ? 'app' : 'lib'; + return `${root}${projectDirName}`; +} +exports.buildDefaultPath = buildDefaultPath; +async function createDefaultPath(tree, projectName) { + const workspace = await getWorkspace(tree); + const project = workspace.projects.get(projectName); + if (!project) { + throw new Error(`Project "${projectName}" does not exist.`); + } + return buildDefaultPath(project); +} +exports.createDefaultPath = createDefaultPath; +function* allWorkspaceTargets(workspace) { + for (const [projectName, project] of workspace.projects) { + for (const [targetName, target] of project.targets) { + yield [targetName, target, projectName, project]; + } + } +} +exports.allWorkspaceTargets = allWorkspaceTargets; +function* allTargetOptions(target, skipBaseOptions = false) { + if (!skipBaseOptions && target.options) { + yield [undefined, target.options]; + } + if (!target.configurations) { + return; + } + for (const [name, options] of Object.entries(target.configurations)) { + if (options !== undefined) { + yield [name, options]; + } + } +} +exports.allTargetOptions = allTargetOptions; |