diff options
author | Nevena Bojovic <nenabojov@gmail.com> | 2022-03-01 20:05:50 +0100 |
---|---|---|
committer | Nevena Bojovic <nenabojov@gmail.com> | 2022-03-01 20:05:50 +0100 |
commit | 291803c31f829fe0d32bb3207bc11def95a7408c (patch) | |
tree | c7d43107d79291b19d8c9eceefbe91c9f9a52acf /sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules | |
parent | 1fa69862057db4db53cfda5be9c24b4228ef63f7 (diff) |
Urađena test aplikacija. Povezan front i back.
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules')
16 files changed, 750 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.d.ts new file mode 100644 index 00000000..f78b3895 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.d.ts @@ -0,0 +1,38 @@ +/** + * @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 { FileOperator, Rule, Source } from '../engine/interface'; +import { FilePredicate, MergeStrategy, Tree } from '../tree/interface'; +/** + * A Source that returns an tree as its single value. + */ +export declare function source(tree: Tree): Source; +/** + * A source that returns an empty tree. + */ +export declare function empty(): Source; +/** + * Chain multiple rules into a single rule. + */ +export declare function chain(rules: Rule[]): Rule; +/** + * Apply multiple rules to a source, and returns the source transformed. + */ +export declare function apply(source: Source, rules: Rule[]): Source; +/** + * Merge an input tree with the source passed in. + */ +export declare function mergeWith(source: Source, strategy?: MergeStrategy): Rule; +export declare function noop(): Rule; +export declare function filter(predicate: FilePredicate<boolean>): Rule; +export declare function asSource(rule: Rule): Source; +export declare function branchAndMerge(rule: Rule, strategy?: MergeStrategy): Rule; +export declare function when(predicate: FilePredicate<boolean>, operator: FileOperator): FileOperator; +export declare function partitionApplyMerge(predicate: FilePredicate<boolean>, ruleYes: Rule, ruleNo?: Rule): Rule; +export declare function forEach(operator: FileOperator): Rule; +export declare function composeFileOperators(operators: FileOperator[]): FileOperator; +export declare function applyToSubtree(path: string, rules: Rule[]): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.js new file mode 100644 index 00000000..fdcae77a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/base.js @@ -0,0 +1,155 @@ +"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.applyToSubtree = exports.composeFileOperators = exports.forEach = exports.partitionApplyMerge = exports.when = exports.branchAndMerge = exports.asSource = exports.filter = exports.noop = exports.mergeWith = exports.apply = exports.chain = exports.empty = exports.source = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const exception_1 = require("../exception/exception"); +const host_tree_1 = require("../tree/host-tree"); +const interface_1 = require("../tree/interface"); +const scoped_1 = require("../tree/scoped"); +const static_1 = require("../tree/static"); +const call_1 = require("./call"); +/** + * A Source that returns an tree as its single value. + */ +function source(tree) { + return () => tree; +} +exports.source = source; +/** + * A source that returns an empty tree. + */ +function empty() { + return () => (0, static_1.empty)(); +} +exports.empty = empty; +/** + * Chain multiple rules into a single rule. + */ +function chain(rules) { + return (tree, context) => { + return rules.reduce((acc, curr) => (0, call_1.callRule)(curr, acc, context), tree); + }; +} +exports.chain = chain; +/** + * Apply multiple rules to a source, and returns the source transformed. + */ +function apply(source, rules) { + return (context) => (0, call_1.callRule)(chain(rules), (0, call_1.callSource)(source, context), context); +} +exports.apply = apply; +/** + * Merge an input tree with the source passed in. + */ +function mergeWith(source, strategy = interface_1.MergeStrategy.Default) { + return (tree, context) => { + return (0, call_1.callSource)(source, context).pipe((0, operators_1.map)((sourceTree) => tree.merge(sourceTree, strategy || context.strategy)), (0, operators_1.mapTo)(tree)); + }; +} +exports.mergeWith = mergeWith; +function noop() { + return () => { }; +} +exports.noop = noop; +function filter(predicate) { + return (tree) => { + if (host_tree_1.HostTree.isHostTree(tree)) { + return new host_tree_1.FilterHostTree(tree, predicate); + } + else { + throw new exception_1.SchematicsException('Tree type is not supported.'); + } + }; +} +exports.filter = filter; +function asSource(rule) { + return (context) => (0, call_1.callRule)(rule, (0, static_1.empty)(), context); +} +exports.asSource = asSource; +function branchAndMerge(rule, strategy = interface_1.MergeStrategy.Default) { + return (tree, context) => { + return (0, call_1.callRule)(rule, tree.branch(), context).pipe((0, operators_1.map)((branch) => tree.merge(branch, strategy || context.strategy)), (0, operators_1.mapTo)(tree)); + }; +} +exports.branchAndMerge = branchAndMerge; +function when(predicate, operator) { + return (entry) => { + if (predicate(entry.path, entry)) { + return operator(entry); + } + else { + return entry; + } + }; +} +exports.when = when; +function partitionApplyMerge(predicate, ruleYes, ruleNo) { + return (tree, context) => { + const [yes, no] = (0, static_1.partition)(tree, predicate); + return (0, rxjs_1.concat)((0, call_1.callRule)(ruleYes, yes, context), (0, call_1.callRule)(ruleNo || noop(), no, context)).pipe((0, operators_1.toArray)(), (0, operators_1.map)(([yesTree, noTree]) => { + yesTree.merge(noTree, context.strategy); + return yesTree; + })); + }; +} +exports.partitionApplyMerge = partitionApplyMerge; +function forEach(operator) { + return (tree) => { + tree.visit((path, entry) => { + if (!entry) { + return; + } + const newEntry = operator(entry); + if (newEntry === entry) { + return; + } + if (newEntry === null) { + tree.delete(path); + return; + } + if (newEntry.path != path) { + tree.rename(path, newEntry.path); + } + if (!newEntry.content.equals(entry.content)) { + tree.overwrite(newEntry.path, newEntry.content); + } + }); + }; +} +exports.forEach = forEach; +function composeFileOperators(operators) { + return (entry) => { + let current = entry; + for (const op of operators) { + current = op(current); + if (current === null) { + // Deleted, just return. + return null; + } + } + return current; + }; +} +exports.composeFileOperators = composeFileOperators; +function applyToSubtree(path, rules) { + return (tree, context) => { + const scoped = new scoped_1.ScopedTree(tree, path); + return (0, call_1.callRule)(chain(rules), scoped, context).pipe((0, operators_1.map)((result) => { + if (result === scoped) { + return tree; + } + else { + throw new exception_1.SchematicsException('Original tree must be returned from all rules when using "applyToSubtree".'); + } + })); + }; +} +exports.applyToSubtree = applyToSubtree; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.d.ts new file mode 100644 index 00000000..b978109a --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { BaseException } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { Rule, SchematicContext, Source } from '../engine/interface'; +import { Tree } from '../tree/interface'; +/** + * When a rule or source returns an invalid value. + */ +export declare class InvalidRuleResultException extends BaseException { + constructor(value?: {}); +} +export declare class InvalidSourceResultException extends BaseException { + constructor(value?: {}); +} +export declare function callSource(source: Source, context: SchematicContext): Observable<Tree>; +export declare function callRule(rule: Rule, input: Tree | Observable<Tree>, context: SchematicContext): Observable<Tree>; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.js new file mode 100644 index 00000000..caeb25ad --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/call.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.callRule = exports.callSource = exports.InvalidSourceResultException = exports.InvalidRuleResultException = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const interface_1 = require("../tree/interface"); +function _getTypeOfResult(value) { + if (value === undefined) { + return 'undefined'; + } + else if (value === null) { + return 'null'; + } + else if (typeof value == 'function') { + return `Function()`; + } + else if (typeof value != 'object') { + return `${typeof value}(${JSON.stringify(value)})`; + } + else { + if (Object.getPrototypeOf(value) == Object) { + return `Object(${JSON.stringify(value)})`; + } + else if (value.constructor) { + return `Instance of class ${value.constructor.name}`; + } + else { + return 'Unknown Object'; + } + } +} +/** + * When a rule or source returns an invalid value. + */ +class InvalidRuleResultException extends core_1.BaseException { + constructor(value) { + super(`Invalid rule result: ${_getTypeOfResult(value)}.`); + } +} +exports.InvalidRuleResultException = InvalidRuleResultException; +class InvalidSourceResultException extends core_1.BaseException { + constructor(value) { + super(`Invalid source result: ${_getTypeOfResult(value)}.`); + } +} +exports.InvalidSourceResultException = InvalidSourceResultException; +function callSource(source, context) { + const result = source(context); + if ((0, rxjs_1.isObservable)(result)) { + // Only return the last Tree, and make sure it's a Tree. + return result.pipe((0, operators_1.defaultIfEmpty)(), (0, operators_1.last)(), (0, operators_1.tap)((inner) => { + if (!inner || !(interface_1.TreeSymbol in inner)) { + throw new InvalidSourceResultException(inner); + } + })); + } + else if (result && interface_1.TreeSymbol in result) { + return (0, rxjs_1.of)(result); + } + else { + return (0, rxjs_1.throwError)(new InvalidSourceResultException(result)); + } +} +exports.callSource = callSource; +function callRule(rule, input, context) { + return ((0, rxjs_1.isObservable)(input) ? input : (0, rxjs_1.of)(input)).pipe((0, operators_1.mergeMap)((inputTree) => { + const result = rule(inputTree, context); + if (!result) { + return (0, rxjs_1.of)(inputTree); + } + else if (typeof result == 'function') { + // This is considered a Rule, chain the rule and return its output. + return callRule(result, inputTree, context); + } + else if ((0, rxjs_1.isObservable)(result)) { + // Only return the last Tree, and make sure it's a Tree. + return result.pipe((0, operators_1.defaultIfEmpty)(), (0, operators_1.last)(), (0, operators_1.tap)((inner) => { + if (!inner || !(interface_1.TreeSymbol in inner)) { + throw new InvalidRuleResultException(inner); + } + })); + } + else if ((0, core_1.isPromise)(result)) { + return (0, rxjs_1.from)(result).pipe((0, operators_1.mergeMap)((inner) => { + if (typeof inner === 'function') { + // This is considered a Rule, chain the rule and return its output. + return callRule(inner, inputTree, context); + } + else { + return (0, rxjs_1.of)(inputTree); + } + })); + } + else if (interface_1.TreeSymbol in result) { + return (0, rxjs_1.of)(result); + } + else { + return (0, rxjs_1.throwError)(new InvalidRuleResultException(result)); + } + })); +} +exports.callRule = callRule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.d.ts new file mode 100644 index 00000000..16687aa6 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.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 { Rule } from '../engine/interface'; +export declare function move(from: string, to?: string): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.js new file mode 100644 index 00000000..6a2f7f08 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/move.js @@ -0,0 +1,37 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.move = void 0; +const core_1 = require("@angular-devkit/core"); +const base_1 = require("./base"); +function move(from, to) { + if (to === undefined) { + to = from; + from = '/'; + } + const fromPath = (0, core_1.normalize)('/' + from); + const toPath = (0, core_1.normalize)('/' + to); + if (fromPath === toPath) { + return base_1.noop; + } + return (tree) => { + if (tree.exists(fromPath)) { + // fromPath is a file + tree.rename(fromPath, toPath); + } + else { + // fromPath is a directory + tree.getDir(fromPath).visit((path) => { + tree.rename(path, (0, core_1.join)(toPath, path.substr(fromPath.length))); + }); + } + return tree; + }; +} +exports.move = move; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.d.ts new file mode 100644 index 00000000..0abc730f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.d.ts @@ -0,0 +1,14 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { Source } from '../engine/interface'; +export interface RandomOptions { + root?: string; + multi?: boolean | number; + multiFiles?: boolean | number; +} +export default function (options: RandomOptions): Source; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.js new file mode 100644 index 00000000..b0ec3fb7 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/random.js @@ -0,0 +1,40 @@ +"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 }); +const host_tree_1 = require("../tree/host-tree"); +function generateStringOfLength(l) { + return new Array(l) + .fill(0) + .map((_x) => { + return 'abcdefghijklmnopqrstuvwxyz'[Math.floor(Math.random() * 26)]; + }) + .join(''); +} +function random(from, to) { + return Math.floor(Math.random() * (to - from)) + from; +} +function default_1(options) { + return () => { + const root = 'root' in options ? options.root : '/'; + const map = new host_tree_1.HostTree(); + const nbFiles = 'multiFiles' in options + ? typeof options.multiFiles == 'number' + ? options.multiFiles + : random(2, 12) + : 1; + for (let i = 0; i < nbFiles; i++) { + const path = 'a/b/c/d/e/f'.slice(Math.random() * 10); + const fileName = generateStringOfLength(20); + const content = generateStringOfLength(100); + map.create(root + '/' + path + '/' + fileName, content); + } + return map; + }; +} +exports.default = default_1; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.d.ts new file mode 100644 index 00000000..75e8e42e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.d.ts @@ -0,0 +1,10 @@ +/** + * @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 '../engine/interface'; +import { FilePredicate } from '../tree/interface'; +export declare function rename(match: FilePredicate<boolean>, to: FilePredicate<string>): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.js new file mode 100644 index 00000000..a02a96d1 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/rename.js @@ -0,0 +1,26 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.rename = void 0; +const core_1 = require("@angular-devkit/core"); +const base_1 = require("./base"); +function rename(match, to) { + return (0, base_1.forEach)((entry) => { + if (match(entry.path, entry)) { + return { + content: entry.content, + path: (0, core_1.normalize)(to(entry.path, entry)), + }; + } + else { + return entry; + } + }); +} +exports.rename = rename; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.d.ts new file mode 100644 index 00000000..c840fb9c --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.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 { ExecutionOptions, Rule } from '../engine/interface'; +/** + * Run a schematic from a separate collection. + * + * @param collectionName The name of the collection that contains the schematic to run. + * @param schematicName The name of the schematic to run. + * @param options The options to pass as input to the RuleFactory. + */ +export declare function externalSchematic<OptionT extends object>(collectionName: string, schematicName: string, options: OptionT, executionOptions?: Partial<ExecutionOptions>): Rule; +/** + * Run a schematic from the same collection. + * + * @param schematicName The name of the schematic to run. + * @param options The options to pass as input to the RuleFactory. + */ +export declare function schematic<OptionT extends object>(schematicName: string, options: OptionT, executionOptions?: Partial<ExecutionOptions>): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.js new file mode 100644 index 00000000..01f69a4e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/schematic.js @@ -0,0 +1,51 @@ +"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.schematic = exports.externalSchematic = void 0; +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const interface_1 = require("../tree/interface"); +const static_1 = require("../tree/static"); +/** + * Run a schematic from a separate collection. + * + * @param collectionName The name of the collection that contains the schematic to run. + * @param schematicName The name of the schematic to run. + * @param options The options to pass as input to the RuleFactory. + */ +function externalSchematic(collectionName, schematicName, options, executionOptions) { + return (input, context) => { + const collection = context.engine.createCollection(collectionName, context.schematic.collection); + const schematic = collection.createSchematic(schematicName); + return schematic.call(options, (0, rxjs_1.of)((0, static_1.branch)(input)), context, executionOptions).pipe((0, operators_1.last)(), (0, operators_1.map)((x) => { + input.merge(x, interface_1.MergeStrategy.AllowOverwriteConflict); + return input; + })); + }; +} +exports.externalSchematic = externalSchematic; +/** + * Run a schematic from the same collection. + * + * @param schematicName The name of the schematic to run. + * @param options The options to pass as input to the RuleFactory. + */ +function schematic(schematicName, options, executionOptions) { + return (input, context) => { + const collection = context.schematic.collection; + const schematic = collection.createSchematic(schematicName, true); + return schematic.call(options, (0, rxjs_1.of)((0, static_1.branch)(input)), context, executionOptions).pipe((0, operators_1.last)(), (0, operators_1.map)((x) => { + // We allow overwrite conflict here because they're the only merge conflict we particularly + // don't want to deal with; the input tree might have an OVERWRITE which the sub + input.merge(x, interface_1.MergeStrategy.AllowOverwriteConflict); + return input; + })); + }; +} +exports.schematic = schematic; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.d.ts new file mode 100644 index 00000000..45335160 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.d.ts @@ -0,0 +1,39 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { BaseException } from '@angular-devkit/core'; +import { FileOperator, Rule } from '../engine/interface'; +export declare const TEMPLATE_FILENAME_RE: RegExp; +export declare class OptionIsNotDefinedException extends BaseException { + constructor(name: string); +} +export declare class UnknownPipeException extends BaseException { + constructor(name: string); +} +export declare class InvalidPipeException extends BaseException { + constructor(name: string); +} +export declare type PathTemplateValue = boolean | string | number | undefined; +export declare type PathTemplatePipeFunction = (x: string) => PathTemplateValue; +export declare type PathTemplateData = { + [key: string]: PathTemplateValue | PathTemplateData | PathTemplatePipeFunction; +}; +export interface PathTemplateOptions { + interpolationStart: string; + interpolationEnd: string; + pipeSeparator?: string; +} +export declare function applyContentTemplate<T>(options: T): FileOperator; +export declare function contentTemplate<T>(options: T): Rule; +export declare function applyPathTemplate<T extends PathTemplateData>(data: T, options?: PathTemplateOptions): FileOperator; +export declare function pathTemplate<T extends PathTemplateData>(options: T): Rule; +/** + * Remove every `.template` suffix from file names. + */ +export declare function renameTemplateFiles(): Rule; +export declare function template<T>(options: T): Rule; +export declare function applyTemplates<T>(options: T): Rule; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.js new file mode 100644 index 00000000..8fc87bc2 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/template.js @@ -0,0 +1,151 @@ +"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.applyTemplates = exports.template = exports.renameTemplateFiles = exports.pathTemplate = exports.applyPathTemplate = exports.contentTemplate = exports.applyContentTemplate = exports.InvalidPipeException = exports.UnknownPipeException = exports.OptionIsNotDefinedException = exports.TEMPLATE_FILENAME_RE = void 0; +const core_1 = require("@angular-devkit/core"); +const util_1 = require("util"); +const base_1 = require("./base"); +const rename_1 = require("./rename"); +exports.TEMPLATE_FILENAME_RE = /\.template$/; +class OptionIsNotDefinedException extends core_1.BaseException { + constructor(name) { + super(`Option "${name}" is not defined.`); + } +} +exports.OptionIsNotDefinedException = OptionIsNotDefinedException; +class UnknownPipeException extends core_1.BaseException { + constructor(name) { + super(`Pipe "${name}" is not defined.`); + } +} +exports.UnknownPipeException = UnknownPipeException; +class InvalidPipeException extends core_1.BaseException { + constructor(name) { + super(`Pipe "${name}" is invalid.`); + } +} +exports.InvalidPipeException = InvalidPipeException; +const decoder = new util_1.TextDecoder('utf-8', { fatal: true }); +function applyContentTemplate(options) { + return (entry) => { + const { path, content } = entry; + try { + const decodedContent = decoder.decode(content); + return { + path, + content: Buffer.from((0, core_1.template)(decodedContent, {})(options)), + }; + } + catch (e) { + if (e.code === 'ERR_ENCODING_INVALID_ENCODED_DATA') { + return entry; + } + throw e; + } + }; +} +exports.applyContentTemplate = applyContentTemplate; +function contentTemplate(options) { + return (0, base_1.forEach)(applyContentTemplate(options)); +} +exports.contentTemplate = contentTemplate; +function applyPathTemplate(data, options = { + interpolationStart: '__', + interpolationEnd: '__', + pipeSeparator: '@', +}) { + const is = options.interpolationStart; + const ie = options.interpolationEnd; + const isL = is.length; + const ieL = ie.length; + return (entry) => { + let path = entry.path; + const content = entry.content; + const original = path; + let start = path.indexOf(is); + // + 1 to have at least a length 1 name. `____` is not valid. + let end = path.indexOf(ie, start + isL + 1); + while (start != -1 && end != -1) { + const match = path.substring(start + isL, end); + let replacement = data[match]; + if (!options.pipeSeparator) { + if (typeof replacement == 'function') { + replacement = replacement.call(data, original); + } + if (replacement === undefined) { + throw new OptionIsNotDefinedException(match); + } + } + else { + const [name, ...pipes] = match.split(options.pipeSeparator); + replacement = data[name]; + if (typeof replacement == 'function') { + replacement = replacement.call(data, original); + } + if (replacement === undefined) { + throw new OptionIsNotDefinedException(name); + } + replacement = pipes.reduce((acc, pipe) => { + if (!pipe) { + return acc; + } + if (!(pipe in data)) { + throw new UnknownPipeException(pipe); + } + if (typeof data[pipe] != 'function') { + throw new InvalidPipeException(pipe); + } + // Coerce to string. + return '' + data[pipe](acc); + }, '' + replacement); + } + path = path.substring(0, start) + replacement + path.substring(end + ieL); + start = path.indexOf(options.interpolationStart); + // See above. + end = path.indexOf(options.interpolationEnd, start + isL + 1); + } + return { path: (0, core_1.normalize)(path), content }; + }; +} +exports.applyPathTemplate = applyPathTemplate; +function pathTemplate(options) { + return (0, base_1.forEach)(applyPathTemplate(options)); +} +exports.pathTemplate = pathTemplate; +/** + * Remove every `.template` suffix from file names. + */ +function renameTemplateFiles() { + return (0, rename_1.rename)((path) => !!path.match(exports.TEMPLATE_FILENAME_RE), (path) => path.replace(exports.TEMPLATE_FILENAME_RE, '')); +} +exports.renameTemplateFiles = renameTemplateFiles; +function template(options) { + return (0, base_1.chain)([ + contentTemplate(options), + // Force cast to PathTemplateData. We need the type for the actual pathTemplate() call, + // but in this case we cannot do anything as contentTemplate are more permissive. + // Since values are coerced to strings in PathTemplates it will be fine in the end. + pathTemplate(options), + ]); +} +exports.template = template; +function applyTemplates(options) { + return (0, base_1.forEach)((0, base_1.when)((path) => path.endsWith('.template'), (0, base_1.composeFileOperators)([ + applyContentTemplate(options), + // See above for this weird cast. + applyPathTemplate(options), + (entry) => { + return { + content: entry.content, + path: entry.path.replace(exports.TEMPLATE_FILENAME_RE, ''), + }; + }, + ]))); +} +exports.applyTemplates = applyTemplates; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.d.ts new file mode 100644 index 00000000..d56462f3 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.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 { Source } from '../engine/interface'; +export declare function url(urlString: string): Source; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.js new file mode 100644 index 00000000..4328f74e --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/src/rules/url.js @@ -0,0 +1,16 @@ +"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.url = void 0; +const url_1 = require("url"); +function url(urlString) { + const url = (0, url_1.parse)(urlString); + return (context) => context.engine.createSourceFromUrl(url, context)(context); +} +exports.url = url; |