@coolon/angular-ui-powerups 3.1.2 → 3.3.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 (68) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.json +1 -1
  3. package/schematics/bootstrap-app/index.js +9 -3
  4. package/schematics/bootstrap-app/index.js.map +1 -1
  5. package/schematics/bootstrap-app/schema.d.ts +1 -0
  6. package/schematics/bootstrap-app/schema.json +5 -0
  7. package/schematics/bootstrap-app/templates/app/auth/auth.guard.ts.template +8 -8
  8. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.eot +0 -0
  9. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.ijmap +1 -0
  10. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.svg +2373 -0
  11. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.ttf +0 -0
  12. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.woff +0 -0
  13. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/MaterialIcons-Regular.woff2 +0 -0
  14. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/README.md +9 -0
  15. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/codepoints +932 -0
  16. package/schematics/bootstrap-app/templates/assets/fonts/material-design-icons/material-icons.css +36 -0
  17. package/schematics/bootstrap-app/templates/index.html.template +13 -0
  18. package/schematics/bootstrap-app/templates/styles.scss.template +27 -0
  19. package/schematics/collection.json +5 -0
  20. package/schematics/place-add/index.js +30 -19
  21. package/schematics/place-add/index.js.map +1 -1
  22. package/schematics/place-add/index.spec.d.ts +1 -0
  23. package/schematics/place-add/index.spec.js +364 -0
  24. package/schematics/place-add/index.spec.js.map +1 -0
  25. package/schematics/place-add/schema.d.ts +2 -0
  26. package/schematics/place-add/schema.json +20 -1
  27. package/schematics/place-add/templates/component/__name@dasherize__.component.html.template +1 -0
  28. package/schematics/place-add/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
  29. package/schematics/place-add/templates/component/__name@dasherize__.component.ts.template +29 -0
  30. package/schematics/place-add/templates/files/i18n/places/__name@dasherize__.yml.template +7 -0
  31. package/schematics/utils/build-context.d.ts +34 -0
  32. package/schematics/utils/build-context.js +133 -0
  33. package/schematics/utils/build-context.js.map +1 -0
  34. package/schematics/utils/decorators/decorated-class.d.ts +13 -0
  35. package/schematics/utils/decorators/decorated-class.js +28 -0
  36. package/schematics/utils/decorators/decorated-class.js.map +1 -0
  37. package/schematics/utils/decorators/decorated-source-file.d.ts +15 -0
  38. package/schematics/utils/decorators/decorated-source-file.js +27 -0
  39. package/schematics/utils/decorators/decorated-source-file.js.map +1 -0
  40. package/schematics/utils/import-def.d.ts +30 -0
  41. package/schematics/utils/import-def.js +89 -0
  42. package/schematics/utils/import-def.js.map +1 -0
  43. package/schematics/utils/method-scanner.d.ts +16 -0
  44. package/schematics/utils/method-scanner.js +61 -0
  45. package/schematics/utils/method-scanner.js.map +1 -0
  46. package/schematics/utils/parameter-def.d.ts +5 -0
  47. package/schematics/utils/parameter-def.js +3 -0
  48. package/schematics/utils/parameter-def.js.map +1 -0
  49. package/schematics/utils/path-helper.d.ts +18 -0
  50. package/schematics/utils/path-helper.js +56 -0
  51. package/schematics/utils/path-helper.js.map +1 -0
  52. package/schematics/utils/schematic-tree-file-system.d.ts +28 -0
  53. package/schematics/utils/schematic-tree-file-system.js +101 -0
  54. package/schematics/utils/schematic-tree-file-system.js.map +1 -0
  55. package/schematics/utils/source-file-scanner.d.ts +14 -0
  56. package/schematics/utils/source-file-scanner.js +89 -0
  57. package/schematics/utils/source-file-scanner.js.map +1 -0
  58. package/schematics/utils/source-file-utilities.d.ts +6 -0
  59. package/schematics/utils/source-file-utilities.js +35 -0
  60. package/schematics/utils/source-file-utilities.js.map +1 -0
  61. package/schematics/utils/template-utilities.d.ts +2 -0
  62. package/schematics/utils/template-utilities.js +24 -0
  63. package/schematics/utils/template-utilities.js.map +1 -0
  64. package/schematics/bootstrap-app/templates/app/places/home/home.component.html.template +0 -1
  65. package/schematics/bootstrap-app/templates/app/places/home/home.component.spec.ts.template +0 -25
  66. package/schematics/bootstrap-app/templates/app/places/home/home.component.ts.template +0 -25
  67. package/schematics/bootstrap-app/templates/i18n/places/home.yml.template +0 -6
  68. /package/schematics/{bootstrap-app/templates/app/places/home/home.component.scss.template → place-add/templates/component/__name@dasherize__.component.scss.template} +0 -0
@@ -0,0 +1,7 @@
1
+ places:
2
+ <%=camelize(name)%>:
3
+ nav(NavItem):
4
+ title: "<%=capitalize(camelize(name))%>"
5
+ icon: "mat:build"
6
+ tooltip: "<%=capitalize(camelize(name))%> tooltip"
7
+
@@ -0,0 +1,34 @@
1
+ import { SchematicContext, Tree } from '@angular-devkit/schematics';
2
+ import { ClassDeclaration, SourceFile } from 'ts-morph';
3
+ import { DecoratedSourceFile } from './decorators/decorated-source-file';
4
+ export declare abstract class BuildContext {
5
+ readonly tree: Tree;
6
+ readonly projectName: string;
7
+ protected readonly settings: BuildContext.Settings;
8
+ readonly context: SchematicContext;
9
+ private typescriptProject;
10
+ constructor(tree: Tree, projectName: string, settings: BuildContext.Settings, context: SchematicContext);
11
+ get logger(): import("@angular-devkit/core/src/logger").LoggerApi;
12
+ get tsConfigPath(): string;
13
+ get sourceRoot(): string;
14
+ get appRoot(): any;
15
+ private loadTypeScriptProject;
16
+ scanClassesInTree(tree: Tree, scanRootDirectory: string, scanClass: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, path: string) => void): void;
17
+ findFileInAncestorPath(pathToSourceRoot: string[], fileName: string): string;
18
+ getSourceFile(path: string): DecoratedSourceFile;
19
+ }
20
+ export declare namespace BuildContext {
21
+ interface Settings {
22
+ readonly workspaceProject: any;
23
+ readonly projectType: string;
24
+ readonly tsConfigPath: string;
25
+ readonly appRoot: string;
26
+ }
27
+ class App extends BuildContext {
28
+ get selectorPrefix(): any;
29
+ }
30
+ class Lib extends BuildContext {
31
+ }
32
+ function forLib(projectName: string, tree: Tree, context: SchematicContext): Lib;
33
+ function forApp(projectName: string, tree: Tree, context: SchematicContext): App;
34
+ }
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildContext = void 0;
4
+ const ts_morph_1 = require("ts-morph");
5
+ const decorated_source_file_1 = require("./decorators/decorated-source-file");
6
+ const schematic_tree_file_system_1 = require("./schematic-tree-file-system");
7
+ class BuildContext {
8
+ constructor(tree, projectName, settings, context) {
9
+ this.tree = tree;
10
+ this.projectName = projectName;
11
+ this.settings = settings;
12
+ this.context = context;
13
+ this.typescriptProject = this.loadTypeScriptProject();
14
+ }
15
+ get logger() {
16
+ return this.context.logger;
17
+ }
18
+ get tsConfigPath() {
19
+ return this.settings.tsConfigPath;
20
+ }
21
+ get sourceRoot() {
22
+ return this.settings.appRoot;
23
+ }
24
+ get appRoot() {
25
+ return this.settings.workspaceProject['sourceRoot'];
26
+ }
27
+ loadTypeScriptProject() {
28
+ // TODO: this barfs if you're not running it from teh project root directory
29
+ this.logger.info(`loading tsConfig from -> ${this.tsConfigPath}`);
30
+ try {
31
+ return new ts_morph_1.Project({
32
+ tsConfigFilePath: this.tsConfigPath,
33
+ fileSystem: new schematic_tree_file_system_1.SchematicTreeFileSystem(this.tree)
34
+ });
35
+ }
36
+ catch (error) {
37
+ this.logger.error(error.toString());
38
+ this.logger.fatal(`Failed to load typescript project from: ${this.tsConfigPath} You probably need to specify the --project option?`);
39
+ throw error;
40
+ }
41
+ }
42
+ scanClassesInTree(tree, scanRootDirectory, scanClass) {
43
+ const importPrefix = `./${scanRootDirectory}`;
44
+ this.context.logger.info(`Scanning sources in -> ${scanRootDirectory}`);
45
+ tree.getDir(scanRootDirectory).visit(filePath => {
46
+ if (!filePath.endsWith('.ts') || filePath.endsWith('.spec.ts')) {
47
+ return;
48
+ }
49
+ const content = tree.read(filePath);
50
+ if (!content) {
51
+ return;
52
+ }
53
+ const sourceFile = this.typescriptProject.getSourceFileOrThrow(`./${filePath}`);
54
+ const imports = sourceFile.getImportDeclarations();
55
+ sourceFile.getClasses().forEach((classDecl) => {
56
+ scanClass(sourceFile, classDecl, filePath);
57
+ });
58
+ });
59
+ }
60
+ findFileInAncestorPath(pathToSourceRoot, fileName) {
61
+ for (let i = pathToSourceRoot.length; i > 0; i--) {
62
+ const possibleModulePath = pathToSourceRoot.slice(0, i).join('/') + `/${fileName}`;
63
+ if (this.tree.exists(possibleModulePath)) {
64
+ return possibleModulePath;
65
+ }
66
+ }
67
+ }
68
+ getSourceFile(path) {
69
+ // Weirdness with out tree based file system, `getSourceFile(..)` returns undefined.
70
+ // const f = this.typescriptProject.getSourceFile(path);
71
+ // to work around it we
72
+ const fileEntry = this.tree.get(path);
73
+ const sourceFile = this.typescriptProject.createSourceFile(path, fileEntry.content.toString("UTF-8"), {
74
+ overwrite: true
75
+ });
76
+ return decorated_source_file_1.DecoratedSourceFile.create(sourceFile, path);
77
+ }
78
+ }
79
+ exports.BuildContext = BuildContext;
80
+ (function (BuildContext) {
81
+ class App extends BuildContext {
82
+ get selectorPrefix() {
83
+ return this.settings.workspaceProject['prefix'];
84
+ }
85
+ }
86
+ BuildContext.App = App;
87
+ class Lib extends BuildContext {
88
+ }
89
+ BuildContext.Lib = Lib;
90
+ function forLib(projectName, tree, context) {
91
+ const settings = loadSettings(projectName, tree);
92
+ if (settings.projectType !== 'lib') {
93
+ throw new Error(`Requested app context, but '${projectName}' is a library`);
94
+ }
95
+ return new BuildContext.Lib(tree, projectName, settings, context);
96
+ }
97
+ BuildContext.forLib = forLib;
98
+ function forApp(projectName, tree, context) {
99
+ const settings = loadSettings(projectName, tree);
100
+ if (settings.projectType !== 'app') {
101
+ throw new Error(`Requested app context, but '${projectName}' is a library`);
102
+ }
103
+ return new BuildContext.App(tree, projectName, settings, context);
104
+ }
105
+ BuildContext.forApp = forApp;
106
+ function loadSettings(project, tree) {
107
+ const workspaceConfig = tree.read('/angular.json');
108
+ if (workspaceConfig) {
109
+ // convert workspace to string
110
+ const workspaceContent = workspaceConfig.toString();
111
+ // parse workspace string into JSON object
112
+ const workspace = JSON.parse(workspaceContent);
113
+ const workspaceProject = workspace.projects[project || workspace.defaultProject];
114
+ const projectType = workspaceProject.projectType === 'application' ? 'app' : 'lib';
115
+ const appRoot = `${workspaceProject.sourceRoot}/${projectType}`;
116
+ const tsConfigPath = workspaceProject.architect.build.options.tsConfig;
117
+ // return new BuildContext.App(project, typescriptConfig, sourceRoot, context);
118
+ return {
119
+ workspaceProject,
120
+ projectType,
121
+ tsConfigPath,
122
+ appRoot
123
+ };
124
+ }
125
+ else {
126
+ throw new Error('Could not find Angular workspace configuration');
127
+ // console.log(tree.root.path);
128
+ // const tsConfig = `${tree.getDir(project).path}/tsconfig.json`;
129
+ // return new BuildContext(project, tsConfig, tree.getDir(project).path, context);
130
+ }
131
+ }
132
+ })(BuildContext = exports.BuildContext || (exports.BuildContext = {}));
133
+ //# sourceMappingURL=build-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-context.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/utils/build-context.ts"],"names":[],"mappings":";;;AAEA,uCAAiE;AACjE,8EAAyE;AACzE,6EAAuE;AAEvE,MAAsB,YAAY;IAGhC,YAAqB,IAAU,EAAW,WAAmB,EAAqB,QAA+B,EAAW,OAAyB;QAAhI,SAAI,GAAJ,IAAI,CAAM;QAAW,gBAAW,GAAX,WAAW,CAAQ;QAAqB,aAAQ,GAAR,QAAQ,CAAuB;QAAW,YAAO,GAAP,OAAO,CAAkB;QACnJ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACxD,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,QAAQ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,CAAC,CAAC;YAEvF,MAAM,gBAAgB,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,IAAI,SAAS,CAAC,cAAc,CAAC,CAAC;YACjF,MAAM,WAAW,GAAG,gBAAgB,CAAC,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;YACnF,MAAM,OAAO,GAAG,GAAG,gBAAgB,CAAC,UAAU,IAAI,WAAW,EAAE,CAAC;YAChE,MAAM,YAAY,GAAG,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YACvE,+EAA+E;YAC/E,OAAO;gBACL,gBAAgB;gBAChB,WAAW;gBACX,YAAY;gBACZ,OAAO;aACR,CAAC;SACH;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;YAClE,+BAA+B;YAC/B,iEAAiE;YACjE,kFAAkF;SACnF;IAEH,CAAC;AAEH,CAAC,EAhEgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAgE5B"}
@@ -0,0 +1,13 @@
1
+ import { Mixin } from '@coolon/typescript-utilities';
2
+ import { ClassDeclaration, Decorator } from 'ts-morph';
3
+ export interface DecoratedClass extends ClassDeclaration, ClassDecoratorMixin {
4
+ }
5
+ export declare class ClassDecoratorMixin extends Mixin<ClassDeclaration> {
6
+ private readonly target;
7
+ constructor(target: ClassDeclaration);
8
+ hasClassDecorator(name: string): boolean;
9
+ getClassDecoratorNode(name: string): Decorator;
10
+ }
11
+ export declare namespace DecoratedClass {
12
+ function create(classDeclaration: ClassDeclaration): DecoratedClass;
13
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecoratedClass = exports.ClassDecoratorMixin = void 0;
4
+ const typescript_utilities_1 = require("@coolon/typescript-utilities");
5
+ const source_file_utilities_1 = require("../source-file-utilities");
6
+ class ClassDecoratorMixin extends typescript_utilities_1.Mixin {
7
+ constructor(target) {
8
+ super();
9
+ this.target = target;
10
+ }
11
+ hasClassDecorator(name) {
12
+ return !!this.getClassDecoratorNode(name);
13
+ }
14
+ getClassDecoratorNode(name) {
15
+ return this.target.forEachChildAsArray().find((node) => {
16
+ return source_file_utilities_1.isDecoratorNode(node, name);
17
+ });
18
+ }
19
+ }
20
+ exports.ClassDecoratorMixin = ClassDecoratorMixin;
21
+ var DecoratedClass;
22
+ (function (DecoratedClass) {
23
+ function create(classDeclaration) {
24
+ return typescript_utilities_1.Mixin.createProxy(classDeclaration, new ClassDecoratorMixin(classDeclaration));
25
+ }
26
+ DecoratedClass.create = create;
27
+ })(DecoratedClass = exports.DecoratedClass || (exports.DecoratedClass = {}));
28
+ //# sourceMappingURL=decorated-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorated-class.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/schematics/utils/decorators/decorated-class.ts"],"names":[],"mappings":";;;AAAA,uEAAqD;AAGrD,oEAA2D;AAM3D,MAAa,mBAAoB,SAAQ,4BAAuB;IAC9D,YAA6B,MAAwB;QACnD,KAAK,EAAE,CAAC;QADmB,WAAM,GAAN,MAAM,CAAkB;IAErD,CAAC;IAED,iBAAiB,CAAC,IAAW;QAC3B,OAAO,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,qBAAqB,CAAC,IAAY;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACrD,OAAO,uCAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACpC,CAAC,CAAc,CAAC;IAClB,CAAC;CACF;AAdD,kDAcC;AAED,IAAiB,cAAc,CAI9B;AAJD,WAAiB,cAAc;IAC7B,SAAgB,MAAM,CAAC,gBAAkC;QACvD,OAAO,4BAAK,CAAC,WAAW,CAAC,gBAAgB,EAAE,IAAI,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACxF,CAAC;IAFe,qBAAM,SAErB,CAAA;AACH,CAAC,EAJgB,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAI9B"}
@@ -0,0 +1,15 @@
1
+ import { Mixin } from '@coolon/typescript-utilities';
2
+ import { SourceFile } from 'ts-morph';
3
+ import { DecoratedClass } from './decorated-class';
4
+ export interface DecoratedSourceFile extends Omit<SourceFile, 'getClasses'>, SourceFileDecoratorMixin {
5
+ }
6
+ export declare class SourceFileDecoratorMixin extends Mixin<SourceFile> {
7
+ private readonly target;
8
+ readonly path: string;
9
+ constructor(target: SourceFile, path: string);
10
+ findClassWithDecorator(name: string): DecoratedClass;
11
+ getClasses(): DecoratedClass[];
12
+ }
13
+ export declare namespace DecoratedSourceFile {
14
+ function create(sourceFile: SourceFile, path: string): DecoratedSourceFile;
15
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecoratedSourceFile = exports.SourceFileDecoratorMixin = void 0;
4
+ const typescript_utilities_1 = require("@coolon/typescript-utilities");
5
+ const decorated_class_1 = require("./decorated-class");
6
+ class SourceFileDecoratorMixin extends typescript_utilities_1.Mixin {
7
+ constructor(target, path) {
8
+ super();
9
+ this.target = target;
10
+ this.path = path;
11
+ }
12
+ findClassWithDecorator(name) {
13
+ return this.getClasses().find(c => c.hasClassDecorator(name));
14
+ }
15
+ getClasses() {
16
+ return this.target.getClasses().map(c => decorated_class_1.DecoratedClass.create(c));
17
+ }
18
+ }
19
+ exports.SourceFileDecoratorMixin = SourceFileDecoratorMixin;
20
+ var DecoratedSourceFile;
21
+ (function (DecoratedSourceFile) {
22
+ function create(sourceFile, path) {
23
+ return typescript_utilities_1.Mixin.createProxy(sourceFile, new SourceFileDecoratorMixin(sourceFile, path));
24
+ }
25
+ DecoratedSourceFile.create = create;
26
+ })(DecoratedSourceFile = exports.DecoratedSourceFile || (exports.DecoratedSourceFile = {}));
27
+ //# sourceMappingURL=decorated-source-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorated-source-file.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/schematics/utils/decorators/decorated-source-file.ts"],"names":[],"mappings":";;;AAAA,uEAAqD;AAErD,uDAAmD;AAKnD,MAAa,wBAAyB,SAAQ,4BAAiB;IAC7D,YAA6B,MAAkB,EAAW,IAAY;QACpE,KAAK,EAAE,CAAC;QADmB,WAAM,GAAN,MAAM,CAAY;QAAW,SAAI,GAAJ,IAAI,CAAQ;IAEtE,CAAC;IAED,sBAAsB,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,gCAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AAZD,4DAYC;AAED,IAAiB,mBAAmB,CAInC;AAJD,WAAiB,mBAAmB;IAClC,SAAgB,MAAM,CAAC,UAAsB,EAAE,IAAY;QACzD,OAAO,4BAAK,CAAC,WAAW,CAAC,UAAU,EAAE,IAAI,wBAAwB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;IACvF,CAAC;IAFe,0BAAM,SAErB,CAAA;AACH,CAAC,EAJgB,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAInC"}
@@ -0,0 +1,30 @@
1
+ import { ImportDeclaration, SourceFile } from 'ts-morph';
2
+ import { PathHelper } from './path-helper';
3
+ export declare abstract class ImportDef {
4
+ readonly typeName: string;
5
+ static create(typeName: string, importDeclarationOrSourceFile: ImportDeclaration | SourceFile | string): ImportDef;
6
+ constructor(typeName: string);
7
+ importPathFor(outDir: PathHelper.Dir): string;
8
+ protected abstract getModuleSpecifierFor(outDir: PathHelper.Dir): string;
9
+ }
10
+ export declare namespace ImportDef {
11
+ class SourceFileImport extends ImportDef {
12
+ private readonly sourceFile;
13
+ constructor(typeName: string, sourceFile: SourceFile);
14
+ get id(): string;
15
+ getModuleSpecifierFor(outDir: PathHelper.Dir): string;
16
+ }
17
+ class ImportDeclarationImport extends ImportDef {
18
+ private readonly importDeclaration;
19
+ constructor(typeName: string, importDeclaration: ImportDeclaration);
20
+ get moduleSpecifier(): string;
21
+ get id(): string;
22
+ getModuleSpecifierFor(outDir: PathHelper.Dir): string;
23
+ }
24
+ class ExternalImport extends ImportDef {
25
+ readonly moduleSpecifier: string;
26
+ constructor(typeName: string, moduleSpecifier: string);
27
+ get id(): string;
28
+ getModuleSpecifierFor(outDir: PathHelper.Dir): string;
29
+ }
30
+ }
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ImportDef = void 0;
10
+ const typescript_utilities_1 = require("@coolon/typescript-utilities");
11
+ const src_1 = require("@typescript-plus/fast-memoize-decorator/dist/src");
12
+ const ts_morph_1 = require("ts-morph");
13
+ class ImportDef {
14
+ constructor(typeName) {
15
+ this.typeName = typeName;
16
+ }
17
+ static create(typeName, importDeclarationOrSourceFile) {
18
+ return importDeclarationOrSourceFile instanceof ts_morph_1.SourceFile ?
19
+ new ImportDef.SourceFileImport(typeName, importDeclarationOrSourceFile) :
20
+ importDeclarationOrSourceFile instanceof ts_morph_1.ImportDeclaration ?
21
+ new ImportDef.ImportDeclarationImport(typeName, importDeclarationOrSourceFile) :
22
+ new ImportDef.ExternalImport(typeName, importDeclarationOrSourceFile);
23
+ }
24
+ importPathFor(outDir) {
25
+ const specifier = this.getModuleSpecifierFor(outDir);
26
+ return specifier.endsWith('.ts') ? specifier.substr(0, specifier.length - '.ts'.length) : specifier;
27
+ }
28
+ }
29
+ exports.ImportDef = ImportDef;
30
+ (function (ImportDef) {
31
+ class SourceFileImport extends ImportDef {
32
+ constructor(typeName, sourceFile) {
33
+ super(typeName);
34
+ this.sourceFile = sourceFile;
35
+ }
36
+ get id() {
37
+ return `${this.typeName} -> ${this.sourceFile.getFilePath()}`;
38
+ }
39
+ getModuleSpecifierFor(outDir) {
40
+ const relativePath = outDir.relativePath(this.sourceFile.getFilePath());
41
+ return relativePath.substr(0, relativePath.length - '.ts'.length);
42
+ }
43
+ }
44
+ __decorate([
45
+ src_1.Memoize()
46
+ ], SourceFileImport.prototype, "id", null);
47
+ ImportDef.SourceFileImport = SourceFileImport;
48
+ class ImportDeclarationImport extends ImportDef {
49
+ constructor(typeName, importDeclaration) {
50
+ super(typeName);
51
+ this.importDeclaration = importDeclaration;
52
+ }
53
+ get moduleSpecifier() {
54
+ return this.importDeclaration.getModuleSpecifierValue();
55
+ }
56
+ get id() {
57
+ return `${this.typeName} -> ${this.moduleSpecifier}`;
58
+ }
59
+ getModuleSpecifierFor(outDir) {
60
+ return this.importDeclaration.isModuleSpecifierRelative() ?
61
+ outDir.relativePath(this.importDeclaration.getModuleSpecifierSourceFile().getFilePath()) :
62
+ this.moduleSpecifier;
63
+ }
64
+ }
65
+ __decorate([
66
+ src_1.Memoize()
67
+ ], ImportDeclarationImport.prototype, "id", null);
68
+ ImportDef.ImportDeclarationImport = ImportDeclarationImport;
69
+ class ExternalImport extends ImportDef {
70
+ constructor(typeName, moduleSpecifier) {
71
+ super(typeName);
72
+ this.moduleSpecifier = moduleSpecifier;
73
+ if (moduleSpecifier.startsWith(".")) {
74
+ typescript_utilities_1.lang.illegalState(`External imports must not be relative. Got ${moduleSpecifier}`);
75
+ }
76
+ }
77
+ get id() {
78
+ return `${this.typeName} -> ${this.moduleSpecifier}`;
79
+ }
80
+ getModuleSpecifierFor(outDir) {
81
+ return this.moduleSpecifier;
82
+ }
83
+ }
84
+ __decorate([
85
+ src_1.Memoize()
86
+ ], ExternalImport.prototype, "id", null);
87
+ ImportDef.ExternalImport = ExternalImport;
88
+ })(ImportDef = exports.ImportDef || (exports.ImportDef = {}));
89
+ //# sourceMappingURL=import-def.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-def.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/utils/import-def.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uEAAoD;AACpD,0EAA2E;AAC3E,uCAAyD;AAGzD,MAAsB,SAAS;IAU7B,YAAqB,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IACrC,CAAC;IATD,MAAM,CAAC,MAAM,CAAC,QAAgB,EAAE,6BAAsE;QACpG,OAAO,6BAA6B,YAAY,qBAAU,CAAC,CAAC;YAC1D,IAAI,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,6BAA6B,CAAC,CAAC,CAAC;YACzE,6BAA6B,YAAY,4BAAiB,CAAC,CAAC;gBAC1D,IAAI,SAAS,CAAC,uBAAuB,CAAC,QAAQ,EAAE,6BAA6B,CAAC,CAAC,CAAC;gBAChF,IAAI,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,6BAA6B,CAAC,CAAC;IAC5E,CAAC;IAKD,aAAa,CAAC,MAAsB;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACrD,OAAO,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,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,CAAC,CAAC;gBAC1F,IAAI,CAAC,eAAe,CAAC;QACzB,CAAC;KACF;IATC;QADC,aAAO,EAAE;qDAGT;IAbU,iCAAuB,0BAoBnC,CAAA;IAED,MAAa,cAAe,SAAQ,SAAS;QAE3C,YAAY,QAAgB,EAAW,eAAuB;YAC5D,KAAK,CAAC,QAAQ,CAAC,CAAC;YADqB,oBAAe,GAAf,eAAe,CAAQ;YAE5D,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;gBACnC,2BAAI,CAAC,YAAY,CAAC,8CAA8C,eAAe,EAAE,CAAC,CAAA;aACnF;QACH,CAAC;QAGD,IAAI,EAAE;YACJ,OAAO,GAAG,IAAI,CAAC,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;QACvD,CAAC;QAED,qBAAqB,CAAC,MAAsB;YAC1C,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;KACF;IAPC;QADC,aAAO,EAAE;4CAGT;IAZU,wBAAc,iBAiB1B,CAAA;AACH,CAAC,EA3DgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QA2DzB"}
@@ -0,0 +1,16 @@
1
+ import { ClassDeclaration, MethodDeclaration, SourceFile, TypeNode } from 'ts-morph';
2
+ import { BuildContext } from './build-context';
3
+ import { ImportDef } from './import-def';
4
+ import { ParameterDef } from './parameter-def';
5
+ import { SourceFileScanner } from './source-file-scanner';
6
+ export declare class MethodScanner extends SourceFileScanner {
7
+ readonly method: MethodDeclaration;
8
+ readonly classDecl: ClassDeclaration;
9
+ readonly parameterWrapperTypes: RegExp[];
10
+ constructor(method: MethodDeclaration, sourceFile: SourceFile, classDecl: ClassDeclaration, context: BuildContext);
11
+ getImportDefs(): ImportDef[];
12
+ getParameters(): ParameterDef[];
13
+ getReturnTypeText(): string;
14
+ getReturnTypeNode(): TypeNode | undefined;
15
+ stripPartialWrapperTypes(typeName: string): string;
16
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.MethodScanner = void 0;
10
+ const src_1 = require("@typescript-plus/fast-memoize-decorator/dist/src");
11
+ const _ = require("lodash");
12
+ const source_file_scanner_1 = require("./source-file-scanner");
13
+ class MethodScanner extends source_file_scanner_1.SourceFileScanner {
14
+ constructor(method, sourceFile, classDecl, context) {
15
+ super(sourceFile);
16
+ this.method = method;
17
+ this.classDecl = classDecl;
18
+ // TODO: make this configurable
19
+ this.parameterWrapperTypes = [
20
+ /DeepPartial<(.+)>(\[\])?/,
21
+ /Partial<(.+)(\[\])?>/
22
+ ];
23
+ }
24
+ getImportDefs() {
25
+ const parameterImports = _.flatten(this.method.getParameters()
26
+ .map(p => this.extractImports(p.getTypeNode())));
27
+ const returnTypeImports = this.extractImports(this.method.getReturnTypeNode());
28
+ return _.uniqBy(returnTypeImports.concat(parameterImports), 'id');
29
+ }
30
+ getParameters() {
31
+ return this.method.getParameters().map(p => {
32
+ const typeName = p.getTypeNode();
33
+ return {
34
+ name: p.getName(),
35
+ typeName: this.stripPartialWrapperTypes(typeName.getFullText()).trim(),
36
+ optional: p.hasQuestionToken()
37
+ };
38
+ });
39
+ }
40
+ getReturnTypeText() {
41
+ const returnTypeNode = this.getReturnTypeNode();
42
+ return returnTypeNode ? returnTypeNode.getFullText() : null;
43
+ }
44
+ getReturnTypeNode() {
45
+ return this.method.getReturnTypeNode();
46
+ }
47
+ stripPartialWrapperTypes(typeName) {
48
+ const match = this.parameterWrapperTypes
49
+ .map(regex => regex.exec(typeName.trim()))
50
+ .find(result => result && result.length > 0);
51
+ return match ? `${match[1]}${match[2] || ''}` : typeName;
52
+ }
53
+ }
54
+ __decorate([
55
+ src_1.Memoize()
56
+ ], MethodScanner.prototype, "getImportDefs", null);
57
+ __decorate([
58
+ src_1.Memoize()
59
+ ], MethodScanner.prototype, "getParameters", null);
60
+ exports.MethodScanner = MethodScanner;
61
+ //# sourceMappingURL=method-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method-scanner.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/utils/method-scanner.ts"],"names":[],"mappings":";;;;;;;;;AAAA,0EAA2E;AAC3E,4BAA4B;AAK5B,+DAA0D;AAE1D,MAAa,aAAc,SAAQ,uCAAiB;IAQlD,YAAqB,MAAyB,EAAE,UAAsB,EAAW,SAA2B,EAAE,OAAqB;QACjI,KAAK,CAAC,UAAU,CAAC,CAAC;QADC,WAAM,GAAN,MAAM,CAAmB;QAAmC,cAAS,GAAT,SAAS,CAAkB;QAN5G,+BAA+B;QACtB,0BAAqB,GAAG;YAC/B,0BAA0B;YAC1B,sBAAsB;SACvB,CAAC;IAIF,CAAC;IAGD,aAAa;QACX,MAAM,gBAAgB,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;aAC3D,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;QAEnD,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAC/E,OAAO,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAGD,aAAa;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,aA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 Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=parameter-def.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameter-def.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/utils/parameter-def.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ export declare class PathHelper {
2
+ private readonly sourceRootDir;
3
+ private readonly relativeResourceDir;
4
+ private readonly relativeOutDir;
5
+ constructor(sourceRootDir: string, relativeResourceDir: string, relativeOutDir: string);
6
+ sourceRoot(): PathHelper.Dir;
7
+ resourceDir(): PathHelper.Dir;
8
+ outDir(): PathHelper.Dir;
9
+ }
10
+ export declare namespace PathHelper {
11
+ class Dir {
12
+ private readonly root;
13
+ private readonly dir;
14
+ private readonly pathToRoot;
15
+ constructor(root: string, dir: string);
16
+ relativePath(absPath: string): string;
17
+ }
18
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PathHelper = void 0;
10
+ const typescript_utilities_1 = require("@coolon/typescript-utilities");
11
+ const src_1 = require("@typescript-plus/fast-memoize-decorator/dist/src");
12
+ class PathHelper {
13
+ constructor(sourceRootDir, relativeResourceDir, relativeOutDir) {
14
+ this.sourceRootDir = sourceRootDir;
15
+ this.relativeResourceDir = relativeResourceDir;
16
+ this.relativeOutDir = relativeOutDir;
17
+ }
18
+ sourceRoot() {
19
+ return new PathHelper.Dir(this.sourceRootDir, null);
20
+ }
21
+ resourceDir() {
22
+ return new PathHelper.Dir(this.sourceRootDir, this.relativeResourceDir);
23
+ }
24
+ outDir() {
25
+ return new PathHelper.Dir(this.sourceRootDir, this.relativeOutDir);
26
+ }
27
+ }
28
+ __decorate([
29
+ src_1.Memoize()
30
+ ], PathHelper.prototype, "sourceRoot", null);
31
+ __decorate([
32
+ src_1.Memoize()
33
+ ], PathHelper.prototype, "resourceDir", null);
34
+ __decorate([
35
+ src_1.Memoize()
36
+ ], PathHelper.prototype, "outDir", null);
37
+ exports.PathHelper = PathHelper;
38
+ (function (PathHelper) {
39
+ class Dir {
40
+ constructor(root, dir) {
41
+ // const sourcePrefix = 1 + this.sourceRoot.length;
42
+ // const resourcePath = filePath.substr(1 + sourcePrefix, filePath.length - 1 - sourcePrefix - '.ts'.length);
43
+ // const relativePath = this.outDir.substr(sourcePrefix).split('/').map(v => '..').join('/');
44
+ // const absolutResourceClassPath = `${relativePath}/${resourcePath}`;
45
+ this.root = root;
46
+ this.dir = dir;
47
+ this.pathToRoot = dir ? `${dir.split('/').map(d => '..').join('/')}/` : '';
48
+ }
49
+ relativePath(absPath) {
50
+ typescript_utilities_1.assert.isTruthy(absPath.startsWith(this.root), `expected ${absPath} to start with ${this.root}`);
51
+ return this.pathToRoot + absPath.substr(1 + this.root.length);
52
+ }
53
+ }
54
+ PathHelper.Dir = Dir;
55
+ })(PathHelper = exports.PathHelper || (exports.PathHelper = {}));
56
+ //# sourceMappingURL=path-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-helper.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/utils/path-helper.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uEAAsD;AACtD,0EAA2E;AAE3E,MAAa,UAAU;IACrB,YAA6B,aAAqB,EACrB,mBAA2B,EAC3B,cAAsB;QAFtB,kBAAa,GAAb,aAAa,CAAQ;QACrB,wBAAmB,GAAnB,mBAAmB,CAAQ;QAC3B,mBAAc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MAgBf,CAAA;AACH,CAAC,EAlBgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAkB1B"}
@@ -0,0 +1,28 @@
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ import { FileSystemHost } from 'ts-morph';
3
+ export declare class SchematicTreeFileSystem implements FileSystemHost {
4
+ private readonly tree;
5
+ constructor(tree: Tree);
6
+ copy(srcPath: string, destPath: string): Promise<void>;
7
+ copySync(srcPath: string, destPath: string): void;
8
+ delete(path: string): Promise<void>;
9
+ deleteSync(path: string): void;
10
+ directoryExists(dirPath: string): Promise<boolean>;
11
+ directoryExistsSync(dirPath: string): boolean;
12
+ fileExists(filePath: string): Promise<boolean>;
13
+ fileExistsSync(filePath: string): boolean;
14
+ getCurrentDirectory(): string;
15
+ glob(patterns: ReadonlyArray<string>): Promise<string[]>;
16
+ globSync(patterns: ReadonlyArray<string>): string[];
17
+ isCaseSensitive(): boolean;
18
+ mkdir(dirPath: string): Promise<void>;
19
+ mkdirSync(dirPath: string): void;
20
+ move(srcPath: string, destPath: string): Promise<void>;
21
+ moveSync(srcPath: string, destPath: string): void;
22
+ readDirSync(dirPath: string): string[];
23
+ readFile(filePath: string, encoding?: string): Promise<string>;
24
+ readFileSync(filePath: string, encoding?: string): string;
25
+ realpathSync(path: string): string;
26
+ writeFile(filePath: string, fileText: string): Promise<void>;
27
+ writeFileSync(filePath: string, fileText: string): void;
28
+ }