@po-ui/ng-schematics 6.13.0 → 14.0.0-next.0

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 (46) hide show
  1. package/README.md +5 -5
  2. package/build-component/build-component.d.ts +3 -3
  3. package/build-component/build-component.js +86 -86
  4. package/build-component/index.d.ts +2 -2
  5. package/build-component/index.js +18 -18
  6. package/build-component/schema.d.ts +34 -34
  7. package/build-component/schema.js +2 -2
  8. package/build-file/build-file.d.ts +3 -3
  9. package/build-file/build-file.js +33 -33
  10. package/build-file/file-options.interface.d.ts +16 -16
  11. package/build-file/file-options.interface.js +2 -2
  12. package/build-file/index.d.ts +2 -2
  13. package/build-file/index.js +18 -18
  14. package/build-target-options/asset-specification.interface.d.ts +21 -21
  15. package/build-target-options/asset-specification.interface.js +2 -2
  16. package/build-target-options/build-target-options.d.ts +7 -7
  17. package/build-target-options/build-target-options.js +37 -37
  18. package/build-target-options/index.d.ts +2 -2
  19. package/build-target-options/index.js +18 -18
  20. package/index.d.ts +7 -7
  21. package/index.js +23 -23
  22. package/module/index.d.ts +1 -1
  23. package/module/index.js +17 -17
  24. package/module/module.d.ts +15 -15
  25. package/module/module.js +128 -128
  26. package/package-config/index.d.ts +2 -2
  27. package/package-config/index.js +18 -18
  28. package/package-config/package-config.d.ts +12 -12
  29. package/package-config/package-config.js +70 -70
  30. package/package-config/update-dependencies.interface.d.ts +7 -7
  31. package/package-config/update-dependencies.interface.js +2 -2
  32. package/package.json +25 -25
  33. package/po-ui-ng-schematics-14.0.0-next.0.tgz +0 -0
  34. package/project/index.d.ts +1 -1
  35. package/project/index.js +17 -17
  36. package/project/project.d.ts +9 -9
  37. package/project/project.js +61 -61
  38. package/replace/index.d.ts +1 -1
  39. package/replace/index.js +17 -17
  40. package/replace/replace.d.ts +13 -13
  41. package/replace/replace.js +28 -28
  42. package/utils/index.d.ts +1 -1
  43. package/utils/index.js +17 -17
  44. package/utils/supported-css-extensions.d.ts +1 -1
  45. package/utils/supported-css-extensions.js +4 -4
  46. package/po-ui-ng-schematics-6.13.0.tgz +0 -0
@@ -1,19 +1,19 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./build-target-options"), exports);
18
- __exportStar(require("./asset-specification.interface"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./build-target-options"), exports);
18
+ __exportStar(require("./asset-specification.interface"), exports);
19
19
  //# sourceMappingURL=index.js.map
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export * from './build-component';
2
- export * from './build-target-options';
3
- export * from './build-file';
4
- export * from './module';
5
- export * from './project';
6
- export * from './package-config';
7
- export * from './utils';
1
+ export * from './build-component';
2
+ export * from './build-target-options';
3
+ export * from './build-file';
4
+ export * from './module';
5
+ export * from './project';
6
+ export * from './package-config';
7
+ export * from './utils';
package/index.js CHANGED
@@ -1,24 +1,24 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./build-component"), exports);
18
- __exportStar(require("./build-target-options"), exports);
19
- __exportStar(require("./build-file"), exports);
20
- __exportStar(require("./module"), exports);
21
- __exportStar(require("./project"), exports);
22
- __exportStar(require("./package-config"), exports);
23
- __exportStar(require("./utils"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./build-component"), exports);
18
+ __exportStar(require("./build-target-options"), exports);
19
+ __exportStar(require("./build-file"), exports);
20
+ __exportStar(require("./module"), exports);
21
+ __exportStar(require("./project"), exports);
22
+ __exportStar(require("./package-config"), exports);
23
+ __exportStar(require("./utils"), exports);
24
24
  //# sourceMappingURL=index.js.map
package/module/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './module';
1
+ export * from './module';
package/module/index.js CHANGED
@@ -1,18 +1,18 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./module"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./module"), exports);
18
18
  //# sourceMappingURL=index.js.map
@@ -1,15 +1,15 @@
1
- import { Tree } from '@angular-devkit/schematics';
2
- import * as ts from 'typescript';
3
- export declare function addModuleImportToRootModule(options: any, moduleName: string, modulePath: string): (host: Tree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
4
- /** Reads file given path and returns TypeScript source file. */
5
- export declare function getSourceFile(host: Tree, path: string): ts.SourceFile;
6
- /** */
7
- export declare function addModuleImportToModule(tree: Tree, modulePath: string, moduleName: string, importPath: string): void;
8
- /** */
9
- export declare function addDeclarationComponentToModule(tree: Tree, modulePath: string, moduleName: string, importPath: string): void;
10
- /** */
11
- export declare function addExportComponentToModule(tree: Tree, modulePath: string, moduleName: string, importPath: string): void;
12
- /**
13
- * Whether the Angular module in the given path imports the specified module class name.
14
- */
15
- export declare function hasNgModuleImport(tree: Tree, modulePath: string, className: string): boolean;
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ import * as ts from 'typescript';
3
+ export declare function addModuleImportToRootModule(options: any, moduleName: string, modulePath: string): (host: Tree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
4
+ /** Reads file given path and returns TypeScript source file. */
5
+ export declare function getSourceFile(host: Tree, path: string): ts.SourceFile;
6
+ /** */
7
+ export declare function addModuleImportToModule(tree: Tree, modulePath: string, moduleName: string, importPath: string): void;
8
+ /** */
9
+ export declare function addDeclarationComponentToModule(tree: Tree, modulePath: string, moduleName: string, importPath: string): void;
10
+ /** */
11
+ export declare function addExportComponentToModule(tree: Tree, modulePath: string, moduleName: string, importPath: string): void;
12
+ /**
13
+ * Whether the Angular module in the given path imports the specified module class name.
14
+ */
15
+ export declare function hasNgModuleImport(tree: Tree, modulePath: string, className: string): boolean;
package/module/module.js CHANGED
@@ -1,129 +1,129 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasNgModuleImport = exports.addExportComponentToModule = exports.addDeclarationComponentToModule = exports.addModuleImportToModule = exports.getSourceFile = exports.addModuleImportToRootModule = void 0;
4
- const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
5
- const ng_ast_utils_1 = require("@schematics/angular/utility/ng-ast-utils");
6
- const change_1 = require("@schematics/angular/utility/change");
7
- const schematics_1 = require("@angular-devkit/schematics");
8
- const ts = require("typescript");
9
- const project_1 = require("../project");
10
- function addModuleImportToRootModule(options, moduleName, modulePath) {
11
- return (host) => {
12
- var _a;
13
- const workspace = (_a = (0, project_1.getWorkspaceConfigGracefully)(host)) !== null && _a !== void 0 ? _a : {};
14
- const project = (0, project_1.getProjectFromWorkspace)(workspace, options.project);
15
- const appModulePath = (0, ng_ast_utils_1.getAppModulePath)(host, (0, project_1.getProjectMainFile)(project));
16
- if (!hasNgModuleImport(host, appModulePath, moduleName)) {
17
- // not add the module if the project already use
18
- addModuleImportToModule(host, appModulePath, moduleName, modulePath);
19
- }
20
- return host;
21
- };
22
- }
23
- exports.addModuleImportToRootModule = addModuleImportToRootModule;
24
- /** Reads file given path and returns TypeScript source file. */
25
- function getSourceFile(host, path) {
26
- const buffer = host.read(path);
27
- if (!buffer) {
28
- throw new schematics_1.SchematicsException(`Could not find file for path: ${path}`);
29
- }
30
- return ts.createSourceFile(path, buffer.toString(), ts.ScriptTarget.Latest, true);
31
- }
32
- exports.getSourceFile = getSourceFile;
33
- /** */
34
- function addModuleImportToModule(tree, modulePath, moduleName, importPath) {
35
- const moduleSource = getSourceFile(tree, modulePath);
36
- const changes = (0, ast_utils_1.addImportToModule)(moduleSource, modulePath, moduleName, importPath);
37
- return insertInModule(tree, changes, modulePath);
38
- }
39
- exports.addModuleImportToModule = addModuleImportToModule;
40
- /** */
41
- function addDeclarationComponentToModule(tree, modulePath, moduleName, importPath) {
42
- const moduleSource = getSourceFile(tree, modulePath);
43
- const changes = (0, ast_utils_1.addDeclarationToModule)(moduleSource, modulePath, moduleName, importPath);
44
- return insertInModule(tree, changes, modulePath);
45
- }
46
- exports.addDeclarationComponentToModule = addDeclarationComponentToModule;
47
- /** */
48
- function addExportComponentToModule(tree, modulePath, moduleName, importPath) {
49
- const moduleSource = getSourceFile(tree, modulePath);
50
- const changes = (0, ast_utils_1.addExportToModule)(moduleSource, modulePath, moduleName, importPath);
51
- return insertInModule(tree, changes, modulePath);
52
- }
53
- exports.addExportComponentToModule = addExportComponentToModule;
54
- /**
55
- * Whether the Angular module in the given path imports the specified module class name.
56
- */
57
- function hasNgModuleImport(tree, modulePath, className) {
58
- const moduleFileContent = tree.read(modulePath);
59
- if (!moduleFileContent) {
60
- throw new schematics_1.SchematicsException(`Could not read Angular module file: ${modulePath}`);
61
- }
62
- const parsedFile = ts.createSourceFile(modulePath, moduleFileContent.toString(), ts.ScriptTarget.Latest, true);
63
- const ngModuleMetadata = findNgModuleMetadata(parsedFile);
64
- if (!ngModuleMetadata) {
65
- throw new schematics_1.SchematicsException(`Could not find NgModule declaration inside: '${modulePath}'`);
66
- }
67
- for (const property of ngModuleMetadata.properties) {
68
- if (!ts.isPropertyAssignment(property) ||
69
- property.name.getText() !== 'imports' ||
70
- !ts.isArrayLiteralExpression(property.initializer)) {
71
- continue;
72
- }
73
- if (property.initializer.elements.some(element => element.getText() === className)) {
74
- return true;
75
- }
76
- }
77
- return false;
78
- }
79
- exports.hasNgModuleImport = hasNgModuleImport;
80
- /**
81
- * Finds a NgModule declaration within the specified TypeScript node and returns the
82
- * corresponding metadata for it. This function searches breadth first because
83
- * NgModule's are usually not nested within other expressions or declarations.
84
- */
85
- function findNgModuleMetadata(rootNode) {
86
- // Add immediate child nodes of the root node to the queue.
87
- const nodeQueue = [...rootNode.getChildren()];
88
- while (nodeQueue.length) {
89
- const node = nodeQueue.shift();
90
- if (ts.isDecorator(node) && ts.isCallExpression(node.expression) && isNgModuleCallExpression(node.expression)) {
91
- return node.expression.arguments[0];
92
- }
93
- else {
94
- nodeQueue.push(...node.getChildren());
95
- }
96
- }
97
- return null;
98
- }
99
- /** Whether the specified call expression is referring to a NgModule definition. */
100
- function isNgModuleCallExpression(callExpression) {
101
- if (!callExpression.arguments.length || !ts.isObjectLiteralExpression(callExpression.arguments[0])) {
102
- return false;
103
- }
104
- const decoratorIdentifier = resolveIdentifierOfExpression(callExpression.expression);
105
- return decoratorIdentifier ? decoratorIdentifier.text === 'NgModule' : false;
106
- }
107
- /**
108
- * Resolves the last identifier that is part of the given expression. This helps resolving
109
- * identifiers of nested property access expressions (e.g. myNamespace.core.NgModule).
110
- */
111
- function resolveIdentifierOfExpression(expression) {
112
- if (ts.isIdentifier(expression)) {
113
- return expression;
114
- }
115
- else if (ts.isPropertyAccessExpression(expression)) {
116
- return expression.name;
117
- }
118
- return null;
119
- }
120
- function insertInModule(tree, changes, modulePath) {
121
- const recorder = tree.beginUpdate(modulePath);
122
- changes.forEach(change => {
123
- if (change instanceof change_1.InsertChange) {
124
- recorder.insertLeft(change.pos, change.toAdd);
125
- }
126
- });
127
- tree.commitUpdate(recorder);
128
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasNgModuleImport = exports.addExportComponentToModule = exports.addDeclarationComponentToModule = exports.addModuleImportToModule = exports.getSourceFile = exports.addModuleImportToRootModule = void 0;
4
+ const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
5
+ const ng_ast_utils_1 = require("@schematics/angular/utility/ng-ast-utils");
6
+ const change_1 = require("@schematics/angular/utility/change");
7
+ const schematics_1 = require("@angular-devkit/schematics");
8
+ const ts = require("typescript");
9
+ const project_1 = require("../project");
10
+ function addModuleImportToRootModule(options, moduleName, modulePath) {
11
+ return (host) => {
12
+ var _a;
13
+ const workspace = (_a = (0, project_1.getWorkspaceConfigGracefully)(host)) !== null && _a !== void 0 ? _a : {};
14
+ const project = (0, project_1.getProjectFromWorkspace)(workspace, options.project);
15
+ const appModulePath = (0, ng_ast_utils_1.getAppModulePath)(host, (0, project_1.getProjectMainFile)(project));
16
+ if (!hasNgModuleImport(host, appModulePath, moduleName)) {
17
+ // not add the module if the project already use
18
+ addModuleImportToModule(host, appModulePath, moduleName, modulePath);
19
+ }
20
+ return host;
21
+ };
22
+ }
23
+ exports.addModuleImportToRootModule = addModuleImportToRootModule;
24
+ /** Reads file given path and returns TypeScript source file. */
25
+ function getSourceFile(host, path) {
26
+ const buffer = host.read(path);
27
+ if (!buffer) {
28
+ throw new schematics_1.SchematicsException(`Could not find file for path: ${path}`);
29
+ }
30
+ return ts.createSourceFile(path, buffer.toString(), ts.ScriptTarget.Latest, true);
31
+ }
32
+ exports.getSourceFile = getSourceFile;
33
+ /** */
34
+ function addModuleImportToModule(tree, modulePath, moduleName, importPath) {
35
+ const moduleSource = getSourceFile(tree, modulePath);
36
+ const changes = (0, ast_utils_1.addImportToModule)(moduleSource, modulePath, moduleName, importPath);
37
+ return insertInModule(tree, changes, modulePath);
38
+ }
39
+ exports.addModuleImportToModule = addModuleImportToModule;
40
+ /** */
41
+ function addDeclarationComponentToModule(tree, modulePath, moduleName, importPath) {
42
+ const moduleSource = getSourceFile(tree, modulePath);
43
+ const changes = (0, ast_utils_1.addDeclarationToModule)(moduleSource, modulePath, moduleName, importPath);
44
+ return insertInModule(tree, changes, modulePath);
45
+ }
46
+ exports.addDeclarationComponentToModule = addDeclarationComponentToModule;
47
+ /** */
48
+ function addExportComponentToModule(tree, modulePath, moduleName, importPath) {
49
+ const moduleSource = getSourceFile(tree, modulePath);
50
+ const changes = (0, ast_utils_1.addExportToModule)(moduleSource, modulePath, moduleName, importPath);
51
+ return insertInModule(tree, changes, modulePath);
52
+ }
53
+ exports.addExportComponentToModule = addExportComponentToModule;
54
+ /**
55
+ * Whether the Angular module in the given path imports the specified module class name.
56
+ */
57
+ function hasNgModuleImport(tree, modulePath, className) {
58
+ const moduleFileContent = tree.read(modulePath);
59
+ if (!moduleFileContent) {
60
+ throw new schematics_1.SchematicsException(`Could not read Angular module file: ${modulePath}`);
61
+ }
62
+ const parsedFile = ts.createSourceFile(modulePath, moduleFileContent.toString(), ts.ScriptTarget.Latest, true);
63
+ const ngModuleMetadata = findNgModuleMetadata(parsedFile);
64
+ if (!ngModuleMetadata) {
65
+ throw new schematics_1.SchematicsException(`Could not find NgModule declaration inside: '${modulePath}'`);
66
+ }
67
+ for (const property of ngModuleMetadata.properties) {
68
+ if (!ts.isPropertyAssignment(property) ||
69
+ property.name.getText() !== 'imports' ||
70
+ !ts.isArrayLiteralExpression(property.initializer)) {
71
+ continue;
72
+ }
73
+ if (property.initializer.elements.some(element => element.getText() === className)) {
74
+ return true;
75
+ }
76
+ }
77
+ return false;
78
+ }
79
+ exports.hasNgModuleImport = hasNgModuleImport;
80
+ /**
81
+ * Finds a NgModule declaration within the specified TypeScript node and returns the
82
+ * corresponding metadata for it. This function searches breadth first because
83
+ * NgModule's are usually not nested within other expressions or declarations.
84
+ */
85
+ function findNgModuleMetadata(rootNode) {
86
+ // Add immediate child nodes of the root node to the queue.
87
+ const nodeQueue = [...rootNode.getChildren()];
88
+ while (nodeQueue.length) {
89
+ const node = nodeQueue.shift();
90
+ if (ts.isDecorator(node) && ts.isCallExpression(node.expression) && isNgModuleCallExpression(node.expression)) {
91
+ return node.expression.arguments[0];
92
+ }
93
+ else {
94
+ nodeQueue.push(...node.getChildren());
95
+ }
96
+ }
97
+ return null;
98
+ }
99
+ /** Whether the specified call expression is referring to a NgModule definition. */
100
+ function isNgModuleCallExpression(callExpression) {
101
+ if (!callExpression.arguments.length || !ts.isObjectLiteralExpression(callExpression.arguments[0])) {
102
+ return false;
103
+ }
104
+ const decoratorIdentifier = resolveIdentifierOfExpression(callExpression.expression);
105
+ return decoratorIdentifier ? decoratorIdentifier.text === 'NgModule' : false;
106
+ }
107
+ /**
108
+ * Resolves the last identifier that is part of the given expression. This helps resolving
109
+ * identifiers of nested property access expressions (e.g. myNamespace.core.NgModule).
110
+ */
111
+ function resolveIdentifierOfExpression(expression) {
112
+ if (ts.isIdentifier(expression)) {
113
+ return expression;
114
+ }
115
+ else if (ts.isPropertyAccessExpression(expression)) {
116
+ return expression.name;
117
+ }
118
+ return null;
119
+ }
120
+ function insertInModule(tree, changes, modulePath) {
121
+ const recorder = tree.beginUpdate(modulePath);
122
+ changes.forEach(change => {
123
+ if (change instanceof change_1.InsertChange) {
124
+ recorder.insertLeft(change.pos, change.toAdd);
125
+ }
126
+ });
127
+ tree.commitUpdate(recorder);
128
+ }
129
129
  //# sourceMappingURL=module.js.map
@@ -1,2 +1,2 @@
1
- export * from './package-config';
2
- export * from './update-dependencies.interface';
1
+ export * from './package-config';
2
+ export * from './update-dependencies.interface';
@@ -1,19 +1,19 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./package-config"), exports);
18
- __exportStar(require("./update-dependencies.interface"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./package-config"), exports);
18
+ __exportStar(require("./update-dependencies.interface"), exports);
19
19
  //# sourceMappingURL=index.js.map
@@ -1,12 +1,12 @@
1
- import { Tree } from '@angular-devkit/schematics';
2
- import { UpdateDependencies } from './update-dependencies.interface';
3
- /** Adds a package to the package.json in the given host tree. */
4
- export declare function addPackageToPackageJson(host: Tree, pkg: string, version: string): Tree;
5
- export declare function updatePackageJson(version: string, { dependencies, devDependencies }: UpdateDependencies): (tree: Tree) => Tree;
6
- /** Gets the version of the specified package by looking at the package.json in the given tree. */
7
- export declare function getPackageVersionFromPackageJson(tree: Tree, name: string): string | null;
8
- /**
9
- * Sorts the keys of the given object.
10
- * @returns A new object instance with sorted keys
11
- */
12
- export declare function sortObjectByKeys(obj: any): any;
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ import { UpdateDependencies } from './update-dependencies.interface';
3
+ /** Adds a package to the package.json in the given host tree. */
4
+ export declare function addPackageToPackageJson(host: Tree, pkg: string, version: string): Tree;
5
+ export declare function updatePackageJson(version: string, { dependencies, devDependencies }: UpdateDependencies): (tree: Tree) => Tree;
6
+ /** Gets the version of the specified package by looking at the package.json in the given tree. */
7
+ export declare function getPackageVersionFromPackageJson(tree: Tree, name: string): string | null;
8
+ /**
9
+ * Sorts the keys of the given object.
10
+ * @returns A new object instance with sorted keys
11
+ */
12
+ export declare function sortObjectByKeys(obj: any): any;