@nestjs/schematics 11.0.9 → 12.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/lib/application/files/js/package.json +10 -10
  2. package/dist/lib/application/files/ts/package.json +3 -3
  3. package/dist/lib/application/files/ts/tsconfig.json +0 -1
  4. package/dist/lib/application/files/ts-esm/.prettierrc +4 -0
  5. package/dist/lib/application/files/ts-esm/README.md +98 -0
  6. package/dist/lib/application/files/ts-esm/eslint.config.mjs +34 -0
  7. package/dist/lib/application/files/ts-esm/nest-cli.json +8 -0
  8. package/dist/lib/application/files/ts-esm/package.json +50 -0
  9. package/dist/lib/application/files/ts-esm/src/app.controller.__specFileSuffix__.ts +22 -0
  10. package/dist/lib/application/files/ts-esm/src/app.controller.ts +12 -0
  11. package/dist/lib/application/files/ts-esm/src/app.module.ts +10 -0
  12. package/dist/lib/application/files/ts-esm/src/app.service.ts +8 -0
  13. package/dist/lib/application/files/ts-esm/src/main.ts +8 -0
  14. package/dist/lib/application/files/ts-esm/test/app.e2e-__specFileSuffix__.ts +25 -0
  15. package/dist/lib/application/files/ts-esm/tsconfig.build.json +4 -0
  16. package/dist/lib/application/files/ts-esm/tsconfig.json +24 -0
  17. package/dist/lib/application/files/ts-esm/vitest.config.e2e.ts +10 -0
  18. package/dist/lib/application/files/ts-esm/vitest.config.ts +10 -0
  19. package/dist/lib/application/schema.json +14 -0
  20. package/dist/lib/library/files/ts/tsconfig.lib.json +1 -0
  21. package/dist/lib/sub-app/files/ts/tsconfig.app.json +1 -0
  22. package/dist/lib/sub-app/workspace/ts/tsconfig.app.json +1 -0
  23. package/package.json +21 -49
  24. package/dist/index.d.ts +0 -2
  25. package/dist/index.js +0 -18
  26. package/dist/lib/application/application.factory.d.ts +0 -3
  27. package/dist/lib/application/application.factory.js +0 -63
  28. package/dist/lib/class/class.factory.d.ts +0 -3
  29. package/dist/lib/class/class.factory.js +0 -51
  30. package/dist/lib/client-app/angular/angular.factory.d.ts +0 -3
  31. package/dist/lib/client-app/angular/angular.factory.js +0 -103
  32. package/dist/lib/configuration/configuration.factory.d.ts +0 -3
  33. package/dist/lib/configuration/configuration.factory.js +0 -27
  34. package/dist/lib/controller/controller.factory.d.ts +0 -3
  35. package/dist/lib/controller/controller.factory.js +0 -72
  36. package/dist/lib/decorator/decorator.factory.d.ts +0 -3
  37. package/dist/lib/decorator/decorator.factory.js +0 -35
  38. package/dist/lib/defaults.d.ts +0 -14
  39. package/dist/lib/defaults.js +0 -17
  40. package/dist/lib/filter/filter.factory.d.ts +0 -3
  41. package/dist/lib/filter/filter.factory.js +0 -43
  42. package/dist/lib/gateway/gateway.factory.d.ts +0 -3
  43. package/dist/lib/gateway/gateway.factory.js +0 -72
  44. package/dist/lib/guard/guard.factory.d.ts +0 -3
  45. package/dist/lib/guard/guard.factory.js +0 -43
  46. package/dist/lib/interceptor/interceptor.factory.d.ts +0 -3
  47. package/dist/lib/interceptor/interceptor.factory.js +0 -44
  48. package/dist/lib/interface/interface.factory.d.ts +0 -3
  49. package/dist/lib/interface/interface.factory.js +0 -34
  50. package/dist/lib/library/library.factory.d.ts +0 -3
  51. package/dist/lib/library/library.factory.js +0 -216
  52. package/dist/lib/middleware/middleware.factory.d.ts +0 -3
  53. package/dist/lib/middleware/middleware.factory.js +0 -43
  54. package/dist/lib/module/module.factory.d.ts +0 -3
  55. package/dist/lib/module/module.factory.js +0 -60
  56. package/dist/lib/pipe/pipe.factory.d.ts +0 -3
  57. package/dist/lib/pipe/pipe.factory.js +0 -44
  58. package/dist/lib/provider/provider.factory.d.ts +0 -3
  59. package/dist/lib/provider/provider.factory.js +0 -76
  60. package/dist/lib/readers/file-system.reader.d.ts +0 -10
  61. package/dist/lib/readers/file-system.reader.js +0 -45
  62. package/dist/lib/readers/index.d.ts +0 -2
  63. package/dist/lib/readers/index.js +0 -18
  64. package/dist/lib/readers/reader.d.ts +0 -7
  65. package/dist/lib/readers/reader.js +0 -2
  66. package/dist/lib/resolver/resolver.factory.d.ts +0 -3
  67. package/dist/lib/resolver/resolver.factory.js +0 -71
  68. package/dist/lib/resource/resource.factory.d.ts +0 -3
  69. package/dist/lib/resource/resource.factory.js +0 -145
  70. package/dist/lib/service/service.factory.d.ts +0 -3
  71. package/dist/lib/service/service.factory.js +0 -74
  72. package/dist/lib/sub-app/sub-app.factory.d.ts +0 -3
  73. package/dist/lib/sub-app/sub-app.factory.js +0 -271
  74. package/dist/utils/dependencies.utils.d.ts +0 -15
  75. package/dist/utils/dependencies.utils.js +0 -42
  76. package/dist/utils/formatting.d.ts +0 -1
  77. package/dist/utils/formatting.js +0 -12
  78. package/dist/utils/index.d.ts +0 -11
  79. package/dist/utils/index.js +0 -27
  80. package/dist/utils/jest-module-mapper.d.ts +0 -1
  81. package/dist/utils/jest-module-mapper.js +0 -9
  82. package/dist/utils/json-file.util.d.ts +0 -15
  83. package/dist/utils/json-file.util.js +0 -72
  84. package/dist/utils/metadata.manager.d.ts +0 -13
  85. package/dist/utils/metadata.manager.js +0 -175
  86. package/dist/utils/module-import.declarator.d.ts +0 -10
  87. package/dist/utils/module-import.declarator.js +0 -40
  88. package/dist/utils/module-metadata.declarator.d.ts +0 -4
  89. package/dist/utils/module-metadata.declarator.js +0 -12
  90. package/dist/utils/module.declarator.d.ts +0 -23
  91. package/dist/utils/module.declarator.js +0 -34
  92. package/dist/utils/module.finder.d.ts +0 -13
  93. package/dist/utils/module.finder.js +0 -25
  94. package/dist/utils/name.parser.d.ts +0 -12
  95. package/dist/utils/name.parser.js +0 -17
  96. package/dist/utils/object-sorting.d.ts +0 -1
  97. package/dist/utils/object-sorting.js +0 -13
  98. package/dist/utils/path.solver.d.ts +0 -4
  99. package/dist/utils/path.solver.js +0 -12
  100. package/dist/utils/source-root.helpers.d.ts +0 -6
  101. package/dist/utils/source-root.helpers.js +0 -24
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JSONFile = void 0;
4
- const jsonc_parser_1 = require("jsonc-parser");
5
- class JSONFile {
6
- host;
7
- path;
8
- content;
9
- constructor(host, path) {
10
- this.host = host;
11
- this.path = path;
12
- const buffer = this.host.read(this.path);
13
- if (buffer) {
14
- this.content = buffer.toString();
15
- }
16
- else {
17
- throw new Error(`Could not read '${path}'.`);
18
- }
19
- }
20
- _jsonAst;
21
- get JsonAst() {
22
- if (this._jsonAst) {
23
- return this._jsonAst;
24
- }
25
- const errors = [];
26
- this._jsonAst = (0, jsonc_parser_1.parseTree)(this.content, errors, {
27
- allowTrailingComma: true,
28
- });
29
- if (errors.length) {
30
- const { error, offset } = errors[0];
31
- throw new Error(`Failed to parse "${this.path}" as JSON AST Object. ${(0, jsonc_parser_1.printParseErrorCode)(error)} at location: ${offset}.`);
32
- }
33
- return this._jsonAst;
34
- }
35
- get(jsonPath) {
36
- const jsonAstNode = this.JsonAst;
37
- if (!jsonAstNode) {
38
- return undefined;
39
- }
40
- if (jsonPath.length === 0) {
41
- return (0, jsonc_parser_1.getNodeValue)(jsonAstNode);
42
- }
43
- const node = (0, jsonc_parser_1.findNodeAtLocation)(jsonAstNode, jsonPath);
44
- return node === undefined ? undefined : (0, jsonc_parser_1.getNodeValue)(node);
45
- }
46
- modify(jsonPath, value, insertInOrder) {
47
- let getInsertionIndex;
48
- if (insertInOrder === undefined) {
49
- const property = jsonPath.slice(-1)[0];
50
- getInsertionIndex = (properties) => [...properties, property].sort().findIndex((p) => p === property);
51
- }
52
- else if (insertInOrder !== false) {
53
- getInsertionIndex = insertInOrder;
54
- }
55
- const edits = (0, jsonc_parser_1.modify)(this.content, jsonPath, value, {
56
- getInsertionIndex,
57
- formattingOptions: {
58
- insertSpaces: true,
59
- tabSize: 2,
60
- },
61
- });
62
- this.content = (0, jsonc_parser_1.applyEdits)(this.content, edits);
63
- this.host.overwrite(this.path, this.content);
64
- this._jsonAst = undefined;
65
- }
66
- remove(jsonPath) {
67
- if (this.get(jsonPath) !== undefined) {
68
- this.modify(jsonPath, undefined);
69
- }
70
- }
71
- }
72
- exports.JSONFile = JSONFile;
@@ -1,13 +0,0 @@
1
- import { DeclarationOptions } from './module.declarator';
2
- export declare class MetadataManager {
3
- private content;
4
- constructor(content: string);
5
- insert(metadata: string, symbol: string, staticOptions?: DeclarationOptions['staticOptions']): string | undefined;
6
- private findFirstDecoratorMetadata;
7
- private getSourceNodes;
8
- private insertMetadataToEmptyModuleDecorator;
9
- private insertNewMetadataToDecorator;
10
- private insertSymbolToMetadata;
11
- private mergeSymbolAndExpr;
12
- private addBlankLines;
13
- }
@@ -1,175 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MetadataManager = void 0;
4
- const typescript_1 = require("typescript");
5
- class MetadataManager {
6
- content;
7
- constructor(content) {
8
- this.content = content;
9
- }
10
- insert(metadata, symbol, staticOptions) {
11
- const source = (0, typescript_1.createSourceFile)('filename.ts', this.content, typescript_1.ScriptTarget.ES2017);
12
- const moduleDecoratorNode = this.findFirstDecoratorMetadata(source, 'Module');
13
- if (!moduleDecoratorNode) {
14
- return;
15
- }
16
- const matchingProperties = moduleDecoratorNode.properties
17
- .filter((prop) => prop.kind === typescript_1.SyntaxKind.PropertyAssignment)
18
- .filter((prop) => {
19
- const name = prop.name;
20
- switch (name.kind) {
21
- case typescript_1.SyntaxKind.Identifier:
22
- return name.getText(source) === metadata;
23
- case typescript_1.SyntaxKind.StringLiteral:
24
- return name.text === metadata;
25
- default:
26
- return false;
27
- }
28
- });
29
- symbol = this.mergeSymbolAndExpr(symbol, staticOptions);
30
- const addBlankLinesIfDynamic = () => {
31
- symbol = staticOptions ? this.addBlankLines(symbol) : symbol;
32
- };
33
- if (matchingProperties.length === 0) {
34
- const expr = moduleDecoratorNode;
35
- if (expr.properties.length === 0) {
36
- addBlankLinesIfDynamic();
37
- return this.insertMetadataToEmptyModuleDecorator(expr, metadata, symbol);
38
- }
39
- else {
40
- addBlankLinesIfDynamic();
41
- return this.insertNewMetadataToDecorator(expr, source, metadata, symbol);
42
- }
43
- }
44
- else {
45
- return this.insertSymbolToMetadata(source, matchingProperties, symbol, staticOptions);
46
- }
47
- }
48
- findFirstDecoratorMetadata(source, identifier) {
49
- for (const node of this.getSourceNodes(source)) {
50
- const isDecoratorFactoryNode = node.kind === typescript_1.SyntaxKind.Decorator &&
51
- node.expression.kind === typescript_1.SyntaxKind.CallExpression;
52
- if (!isDecoratorFactoryNode)
53
- continue;
54
- const expr = node.expression;
55
- const isExpectedExpression = expr.arguments[0]?.kind === typescript_1.SyntaxKind.ObjectLiteralExpression;
56
- if (!isExpectedExpression)
57
- continue;
58
- if (expr.expression.kind === typescript_1.SyntaxKind.Identifier) {
59
- const escapedText = expr.expression.escapedText;
60
- const isTargetIdentifier = escapedText
61
- ? escapedText.toLowerCase() === identifier.toLowerCase()
62
- : true;
63
- if (isTargetIdentifier) {
64
- return expr.arguments[0];
65
- }
66
- }
67
- }
68
- }
69
- getSourceNodes(sourceFile) {
70
- const nodes = [sourceFile];
71
- const result = [];
72
- while (nodes.length > 0) {
73
- const node = nodes.shift();
74
- if (node) {
75
- result.push(node);
76
- if (node.getChildCount(sourceFile) >= 0) {
77
- nodes.unshift(...node.getChildren(sourceFile));
78
- }
79
- }
80
- }
81
- return result;
82
- }
83
- insertMetadataToEmptyModuleDecorator(expr, metadata, symbol) {
84
- const position = expr.getEnd() - 1;
85
- const toInsert = ` ${metadata}: [${symbol}]`;
86
- return this.content.split('').reduce((content, char, index) => {
87
- if (index === position) {
88
- return `${content}\n${toInsert}\n${char}`;
89
- }
90
- else {
91
- return `${content}${char}`;
92
- }
93
- }, '');
94
- }
95
- insertNewMetadataToDecorator(expr, source, metadata, symbol) {
96
- const node = expr.properties[expr.properties.length - 1];
97
- const position = node.getEnd();
98
- const text = node.getFullText(source);
99
- const matches = text.match(/^\r?\n\s*/);
100
- let toInsert;
101
- if (matches) {
102
- toInsert = `,${matches[0]}${metadata}: [${symbol}]`;
103
- }
104
- else {
105
- toInsert = `, ${metadata}: [${symbol}]`;
106
- }
107
- return this.content.split('').reduce((content, char, index) => {
108
- if (index === position) {
109
- return `${content}${toInsert}${char}`;
110
- }
111
- else {
112
- return `${content}${char}`;
113
- }
114
- }, '');
115
- }
116
- insertSymbolToMetadata(source, matchingProperties, symbol, staticOptions) {
117
- const assignment = matchingProperties[0];
118
- let node;
119
- const arrLiteral = assignment.initializer;
120
- if (!arrLiteral.elements) {
121
- return this.content;
122
- }
123
- if (arrLiteral.elements.length === 0) {
124
- node = arrLiteral;
125
- }
126
- else {
127
- node = arrLiteral.elements;
128
- }
129
- if (Array.isArray(node)) {
130
- const nodeArray = node;
131
- const symbolsArray = nodeArray.map((childNode) => childNode.getText(source));
132
- if (symbolsArray.includes(symbol)) {
133
- return this.content;
134
- }
135
- node = node[node.length - 1];
136
- }
137
- let toInsert;
138
- let position = node.getEnd();
139
- if (node.kind === typescript_1.SyntaxKind.ArrayLiteralExpression) {
140
- position--;
141
- toInsert = staticOptions ? this.addBlankLines(symbol) : `${symbol}`;
142
- }
143
- else {
144
- const text = node.getFullText(source);
145
- const itemSeparator = (text.match(/^\r?\n(\r?)\s+/) ||
146
- text.match(/^\r?\n/) ||
147
- ' ')[0];
148
- toInsert = `,${itemSeparator}${symbol}`;
149
- }
150
- return this.content.split('').reduce((content, char, index) => {
151
- if (index === position) {
152
- return `${content}${toInsert}${char}`;
153
- }
154
- else {
155
- return `${content}${char}`;
156
- }
157
- }, '');
158
- }
159
- mergeSymbolAndExpr(symbol, staticOptions) {
160
- if (!staticOptions) {
161
- return symbol;
162
- }
163
- const spacing = 6;
164
- let options = JSON.stringify(staticOptions.value, null, spacing);
165
- options = options.replace(/"([^(")"]+)":/g, '$1:');
166
- options = options.replace(/"/g, `'`);
167
- options = options.slice(0, options.length - 1) + ' }';
168
- symbol += `.${staticOptions.name}(${options})`;
169
- return symbol;
170
- }
171
- addBlankLines(expr) {
172
- return `\n ${expr}\n `;
173
- }
174
- }
175
- exports.MetadataManager = MetadataManager;
@@ -1,10 +0,0 @@
1
- import { DeclarationOptions } from './module.declarator';
2
- import { PathSolver } from './path.solver';
3
- export declare class ModuleImportDeclarator {
4
- private solver;
5
- constructor(solver?: PathSolver);
6
- declare(content: string, options: DeclarationOptions): string;
7
- private findImportsEndpoint;
8
- private buildLineToInsert;
9
- private computeRelativePath;
10
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModuleImportDeclarator = void 0;
4
- const core_1 = require("@angular-devkit/core");
5
- const path_solver_1 = require("./path.solver");
6
- class ModuleImportDeclarator {
7
- solver;
8
- constructor(solver = new path_solver_1.PathSolver()) {
9
- this.solver = solver;
10
- }
11
- declare(content, options) {
12
- const toInsert = this.buildLineToInsert(options);
13
- const contentLines = content.split('\n');
14
- const finalImportIndex = this.findImportsEndpoint(contentLines);
15
- contentLines.splice(finalImportIndex + 1, 0, toInsert);
16
- return contentLines.join('\n');
17
- }
18
- findImportsEndpoint(contentLines) {
19
- const reversedContent = Array.from(contentLines).reverse();
20
- const reverseImports = reversedContent.filter((line) => line.match(/\} from ('|")/));
21
- if (reverseImports.length <= 0) {
22
- return 0;
23
- }
24
- return contentLines.indexOf(reverseImports[0]);
25
- }
26
- buildLineToInsert(options) {
27
- return `import { ${options.symbol} } from '${this.computeRelativePath(options)}';`;
28
- }
29
- computeRelativePath(options) {
30
- let importModulePath;
31
- if (options.type !== undefined) {
32
- importModulePath = (0, core_1.normalize)(`/${options.path}/${options.name}.${options.type}`);
33
- }
34
- else {
35
- importModulePath = (0, core_1.normalize)(`/${options.path}/${options.name}`);
36
- }
37
- return this.solver.relative(options.module, importModulePath);
38
- }
39
- }
40
- exports.ModuleImportDeclarator = ModuleImportDeclarator;
@@ -1,4 +0,0 @@
1
- import { DeclarationOptions } from './module.declarator';
2
- export declare class ModuleMetadataDeclarator {
3
- declare(content: string, options: DeclarationOptions): string;
4
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModuleMetadataDeclarator = void 0;
4
- const metadata_manager_1 = require("./metadata.manager");
5
- class ModuleMetadataDeclarator {
6
- declare(content, options) {
7
- const manager = new metadata_manager_1.MetadataManager(content);
8
- const inserted = manager.insert(options.metadata, options.symbol, options.staticOptions);
9
- return inserted ?? content;
10
- }
11
- }
12
- exports.ModuleMetadataDeclarator = ModuleMetadataDeclarator;
@@ -1,23 +0,0 @@
1
- import { Path } from '@angular-devkit/core';
2
- import { ModuleImportDeclarator } from './module-import.declarator';
3
- import { ModuleMetadataDeclarator } from './module-metadata.declarator';
4
- export interface DeclarationOptions {
5
- metadata: string;
6
- type?: string;
7
- name: string;
8
- className?: string;
9
- path: Path;
10
- module: Path;
11
- symbol?: string;
12
- staticOptions?: {
13
- name: string;
14
- value: Record<string, any>;
15
- };
16
- }
17
- export declare class ModuleDeclarator {
18
- private imports;
19
- private metadata;
20
- constructor(imports?: ModuleImportDeclarator, metadata?: ModuleMetadataDeclarator);
21
- declare(content: string, options: DeclarationOptions): string;
22
- private computeSymbol;
23
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModuleDeclarator = void 0;
4
- const strings_1 = require("@angular-devkit/core/src/utils/strings");
5
- const module_import_declarator_1 = require("./module-import.declarator");
6
- const module_metadata_declarator_1 = require("./module-metadata.declarator");
7
- class ModuleDeclarator {
8
- imports;
9
- metadata;
10
- constructor(imports = new module_import_declarator_1.ModuleImportDeclarator(), metadata = new module_metadata_declarator_1.ModuleMetadataDeclarator()) {
11
- this.imports = imports;
12
- this.metadata = metadata;
13
- }
14
- declare(content, options) {
15
- options = this.computeSymbol(options);
16
- content = this.imports.declare(content, options);
17
- content = this.metadata.declare(content, options);
18
- return content;
19
- }
20
- computeSymbol(options) {
21
- const target = Object.assign({}, options);
22
- if (options.className) {
23
- target.symbol = options.className;
24
- }
25
- else if (options.type !== undefined) {
26
- target.symbol = (0, strings_1.classify)(options.name).concat((0, strings_1.capitalize)(options.type));
27
- }
28
- else {
29
- target.symbol = (0, strings_1.classify)(options.name);
30
- }
31
- return target;
32
- }
33
- }
34
- exports.ModuleDeclarator = ModuleDeclarator;
@@ -1,13 +0,0 @@
1
- import { Path } from '@angular-devkit/core';
2
- import { Tree } from '@angular-devkit/schematics';
3
- export interface FindOptions {
4
- name?: string;
5
- path: Path;
6
- kind?: string;
7
- }
8
- export declare class ModuleFinder {
9
- private tree;
10
- constructor(tree: Tree);
11
- find(options: FindOptions): Path | null;
12
- private findIn;
13
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModuleFinder = void 0;
4
- const core_1 = require("@angular-devkit/core");
5
- class ModuleFinder {
6
- tree;
7
- constructor(tree) {
8
- this.tree = tree;
9
- }
10
- find(options) {
11
- const generatedDirectoryPath = options.path;
12
- const generatedDirectory = this.tree.getDir(generatedDirectoryPath);
13
- return this.findIn(generatedDirectory);
14
- }
15
- findIn(directory) {
16
- if (!directory) {
17
- return null;
18
- }
19
- const moduleFilename = directory.subfiles.find((filename) => /\.module\.(t|j)s$/.test(filename));
20
- return moduleFilename !== undefined
21
- ? (0, core_1.join)(directory.path, moduleFilename.valueOf())
22
- : this.findIn(directory.parent);
23
- }
24
- }
25
- exports.ModuleFinder = ModuleFinder;
@@ -1,12 +0,0 @@
1
- import { Path } from '@angular-devkit/core';
2
- export interface ParseOptions {
3
- name: string;
4
- path?: string;
5
- }
6
- export interface Location {
7
- name: string;
8
- path: Path;
9
- }
10
- export declare class NameParser {
11
- parse(options: ParseOptions): Location;
12
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NameParser = void 0;
4
- const core_1 = require("@angular-devkit/core");
5
- class NameParser {
6
- parse(options) {
7
- const nameWithoutPath = (0, core_1.basename)(options.name);
8
- const namePath = (0, core_1.dirname)((options.path === undefined ? '' : options.path)
9
- .concat('/')
10
- .concat(options.name));
11
- return {
12
- name: nameWithoutPath,
13
- path: (0, core_1.normalize)('/'.concat(namePath)),
14
- };
15
- }
16
- }
17
- exports.NameParser = NameParser;
@@ -1 +0,0 @@
1
- export declare function inPlaceSortByKeys(object: Record<string, any>): Record<string, any>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inPlaceSortByKeys = inPlaceSortByKeys;
4
- function inPlaceSortByKeys(object) {
5
- const sorted = {};
6
- const keys = Object.keys(object);
7
- keys.sort();
8
- for (const key of keys) {
9
- sorted[key] = object[key];
10
- delete object[key];
11
- }
12
- return Object.assign(object, sorted);
13
- }
@@ -1,4 +0,0 @@
1
- import { Path } from '@angular-devkit/core';
2
- export declare class PathSolver {
3
- relative(from: Path, to: Path): string;
4
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PathSolver = void 0;
4
- const core_1 = require("@angular-devkit/core");
5
- class PathSolver {
6
- relative(from, to) {
7
- const placeholder = '/placeholder';
8
- const relativeDir = (0, core_1.relative)((0, core_1.dirname)((placeholder + from)), (0, core_1.dirname)((placeholder + to)));
9
- return (relativeDir.startsWith('.') ? relativeDir : './' + relativeDir).concat(relativeDir.length === 0 ? (0, core_1.basename)(to) : '/' + (0, core_1.basename)(to));
10
- }
11
- }
12
- exports.PathSolver = PathSolver;
@@ -1,6 +0,0 @@
1
- import { Rule, Tree } from '@angular-devkit/schematics';
2
- export declare function isInRootDirectory(host: Tree, extraFiles?: string[]): boolean;
3
- export declare function mergeSourceRoot<T extends {
4
- sourceRoot?: string;
5
- path?: string;
6
- } = any>(options: T): Rule;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isInRootDirectory = isInRootDirectory;
4
- exports.mergeSourceRoot = mergeSourceRoot;
5
- const core_1 = require("@angular-devkit/core");
6
- const defaults_1 = require("../lib/defaults");
7
- function isInRootDirectory(host, extraFiles = []) {
8
- const files = ['nest-cli.json', 'nest.json'].concat(extraFiles || []);
9
- return files.map((file) => host.exists(file)).some((isPresent) => isPresent);
10
- }
11
- function mergeSourceRoot(options) {
12
- return (host) => {
13
- const isInRoot = isInRootDirectory(host, ['tsconfig.json', 'package.json']);
14
- if (!isInRoot) {
15
- return host;
16
- }
17
- const defaultSourceRoot = options.sourceRoot !== undefined ? options.sourceRoot : defaults_1.DEFAULT_PATH_NAME;
18
- options.path =
19
- options.path !== undefined
20
- ? (0, core_1.join)((0, core_1.normalize)(defaultSourceRoot), options.path)
21
- : (0, core_1.normalize)(defaultSourceRoot);
22
- return host;
23
- };
24
- }