@coolon/angular-ui-powerups 14.36.0 → 14.37.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.
- package/assets/interaction/editor/inline-string-editor.scss +6 -0
- package/esm2020/lib/components/forms/multiple-select-input/multiple-select-input.component.mjs +10 -2
- package/esm2020/lib/components/forms/select-input/select-input.component.mjs +10 -2
- package/esm2020/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.mjs +15 -9
- package/fesm2015/coolon-angular-ui-powerups.mjs +30 -8
- package/fesm2015/coolon-angular-ui-powerups.mjs.map +1 -1
- package/fesm2020/coolon-angular-ui-powerups.mjs +30 -8
- package/fesm2020/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.d.ts +3 -2
- package/package.json +1 -1
- package/schematics/activity/index.d.ts +3 -0
- package/schematics/activity/index.js +32 -0
- package/schematics/activity/index.js.map +1 -0
- package/schematics/activity/index.spec.d.ts +1 -0
- package/schematics/activity/index.spec.js +364 -0
- package/schematics/activity/index.spec.js.map +1 -0
- package/schematics/activity/schema.d.ts +4 -0
- package/schematics/activity/schema.js +3 -0
- package/schematics/activity/schema.js.map +1 -0
- package/schematics/activity/schema.json +27 -0
- package/schematics/activity/templates/component/__name@dasherize__.component.html.template +5 -0
- package/schematics/activity/templates/component/__name@dasherize__.component.scss.template +4 -0
- package/schematics/activity/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
- package/schematics/activity/templates/component/__name@dasherize__.component.ts.template +40 -0
- package/schematics/activity/templates/component/__name@dasherize__.i18n.yml.template +9 -0
- package/schematics/aup-i18n/index.d.ts +4 -0
- package/schematics/aup-i18n/index.js +86 -0
- package/schematics/aup-i18n/index.js.map +1 -0
- package/schematics/aup-i18n/schema.d.ts +3 -0
- package/schematics/aup-i18n/schema.js +3 -0
- package/schematics/aup-i18n/schema.js.map +1 -0
- package/schematics/aup-i18n/schema.json +18 -0
- package/schematics/aup-i18n/templates/app/aup.i18n.yml.template +80 -0
- package/schematics/bootstrap-app/index.d.ts +4 -0
- package/schematics/bootstrap-app/index.js +109 -0
- package/schematics/bootstrap-app/index.js.map +1 -0
- package/schematics/bootstrap-app/schema.d.ts +3 -0
- package/schematics/bootstrap-app/schema.js +3 -0
- package/schematics/bootstrap-app/schema.js.map +1 -0
- package/schematics/bootstrap-app/schema.json +18 -0
- package/schematics/bootstrap-app/templates/i18n.config.json.template +11 -0
- package/schematics/bootstrap-app/templates/src/app/app-routing.module.ts.template +23 -0
- package/schematics/bootstrap-app/templates/src/app/app.component.html.template +7 -0
- package/schematics/bootstrap-app/templates/src/app/app.component.scss.template +12 -0
- package/schematics/bootstrap-app/templates/src/app/app.component.ts.template +19 -0
- package/schematics/bootstrap-app/templates/src/app/app.module.ts.template +74 -0
- package/schematics/bootstrap-app/templates/src/app/components/components.module.ts.template +16 -0
- package/schematics/bootstrap-app/templates/src/app/i18n.ts.template +9 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.eot +0 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.ijmap +1 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.svg +2373 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.ttf +0 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.woff +0 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/MaterialIcons-Regular.woff2 +0 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/codepoints +932 -0
- package/schematics/bootstrap-app/templates/src/assets/fonts/material-design-icons/material-icons.css +36 -0
- package/schematics/bootstrap-app/templates/src/index.html.template +13 -0
- package/schematics/bootstrap-app/templates/src/styles/global-variables.scss.template +13 -0
- package/schematics/bootstrap-app/templates/src/styles.scss.template +85 -0
- package/schematics/collection.json +48 -0
- package/schematics/component/index.d.ts +3 -0
- package/schematics/component/index.js +32 -0
- package/schematics/component/index.js.map +1 -0
- package/schematics/component/index.spec.d.ts +1 -0
- package/schematics/component/index.spec.js +364 -0
- package/schematics/component/index.spec.js.map +1 -0
- package/schematics/component/schema.d.ts +4 -0
- package/schematics/component/schema.js +3 -0
- package/schematics/component/schema.js.map +1 -0
- package/schematics/component/schema.json +27 -0
- package/schematics/component/templates/component/__name@dasherize__.component.html.template +1 -0
- package/schematics/component/templates/component/__name@dasherize__.component.scss.template +4 -0
- package/schematics/component/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
- package/schematics/component/templates/component/__name@dasherize__.component.ts.template +23 -0
- package/schematics/component/templates/component/__name@dasherize__.i18n.yml.template +1 -0
- package/schematics/ng-add/index.d.ts +3 -0
- package/schematics/ng-add/index.js +37 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/package-util.d.ts +13 -0
- package/schematics/package-util.js +61 -0
- package/schematics/package-util.js.map +1 -0
- package/schematics/place-add/index.d.ts +3 -0
- package/schematics/place-add/index.js +37 -0
- package/schematics/place-add/index.js.map +1 -0
- package/schematics/place-add/index.spec.d.ts +1 -0
- package/schematics/place-add/index.spec.js +364 -0
- package/schematics/place-add/index.spec.js.map +1 -0
- package/schematics/place-add/schema.d.ts +4 -0
- package/schematics/place-add/schema.js +3 -0
- package/schematics/place-add/schema.js.map +1 -0
- package/schematics/place-add/schema.json +27 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.html.template +1 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.scss.template +5 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.ts.template +33 -0
- package/schematics/place-add/templates/component/__name@dasherize__.i18n.yml.template +5 -0
- package/schematics/place-bootstrap/index.d.ts +3 -0
- package/schematics/place-bootstrap/index.js +21 -0
- package/schematics/place-bootstrap/index.js.map +1 -0
- package/schematics/place-bootstrap/schema.d.ts +4 -0
- package/schematics/place-bootstrap/schema.js +3 -0
- package/schematics/place-bootstrap/schema.js.map +1 -0
- package/schematics/place-bootstrap/schema.json +28 -0
- package/schematics/place-bootstrap/templates/__name@dasherize__/place-routes.ts.template +3 -0
- package/schematics/place-bootstrap/templates/__name@dasherize__/places.module.ts.template +16 -0
- package/schematics/place-routes/index.d.ts +3 -0
- package/schematics/place-routes/index.js +24 -0
- package/schematics/place-routes/index.js.map +1 -0
- package/schematics/place-routes/place-builder.d.ts +18 -0
- package/schematics/place-routes/place-builder.js +123 -0
- package/schematics/place-routes/place-builder.js.map +1 -0
- package/schematics/place-routes/place-class-scanner.d.ts +47 -0
- package/schematics/place-routes/place-class-scanner.js +223 -0
- package/schematics/place-routes/place-class-scanner.js.map +1 -0
- package/schematics/place-routes/place-def.d.ts +62 -0
- package/schematics/place-routes/place-def.js +195 -0
- package/schematics/place-routes/place-def.js.map +1 -0
- package/schematics/place-routes/schema.d.ts +4 -0
- package/schematics/place-routes/schema.js +3 -0
- package/schematics/place-routes/schema.js.map +1 -0
- package/schematics/place-routes/schema.json +25 -0
- package/schematics/place-routes/templates/place-routes.ts.template +14 -0
- package/schematics/utils/build-context.d.ts +73 -0
- package/schematics/utils/build-context.js +184 -0
- package/schematics/utils/build-context.js.map +1 -0
- package/schematics/utils/decorators/decorated-class.d.ts +13 -0
- package/schematics/utils/decorators/decorated-class.js +28 -0
- package/schematics/utils/decorators/decorated-class.js.map +1 -0
- package/schematics/utils/decorators/decorated-source-file.d.ts +15 -0
- package/schematics/utils/decorators/decorated-source-file.js +27 -0
- package/schematics/utils/decorators/decorated-source-file.js.map +1 -0
- package/schematics/utils/import-def.d.ts +30 -0
- package/schematics/utils/import-def.js +97 -0
- package/schematics/utils/import-def.js.map +1 -0
- package/schematics/utils/method-scanner.d.ts +16 -0
- package/schematics/utils/method-scanner.js +70 -0
- package/schematics/utils/method-scanner.js.map +1 -0
- package/schematics/utils/mixin.d.ts +11 -0
- package/schematics/utils/mixin.js +27 -0
- package/schematics/utils/mixin.js.map +1 -0
- package/schematics/utils/parameter-def.d.ts +5 -0
- package/schematics/utils/parameter-def.js +3 -0
- package/schematics/utils/parameter-def.js.map +1 -0
- package/schematics/utils/path-helper.d.ts +14 -0
- package/schematics/utils/path-helper.js +30 -0
- package/schematics/utils/path-helper.js.map +1 -0
- package/schematics/utils/schematic-tree-file-system.d.ts +30 -0
- package/schematics/utils/schematic-tree-file-system.js +113 -0
- package/schematics/utils/schematic-tree-file-system.js.map +1 -0
- package/schematics/utils/source-file-scanner.d.ts +14 -0
- package/schematics/utils/source-file-scanner.js +89 -0
- package/schematics/utils/source-file-scanner.js.map +1 -0
- package/schematics/utils/source-file-utilities.d.ts +6 -0
- package/schematics/utils/source-file-utilities.js +35 -0
- package/schematics/utils/source-file-utilities.js.map +1 -0
- package/schematics/utils/stringy.d.ts +15 -0
- package/schematics/utils/stringy.js +50 -0
- package/schematics/utils/stringy.js.map +1 -0
- package/schematics/utils/template-utilities.d.ts +2 -0
- package/schematics/utils/template-utilities.js +24 -0
- package/schematics/utils/template-utilities.js.map +1 -0
- package/schematics/utils/workspace.d.ts +15 -0
- package/schematics/utils/workspace.js +59 -0
- package/schematics/utils/workspace.js.map +1 -0
|
@@ -0,0 +1,223 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PlaceClassScanner = void 0;
|
|
13
|
+
const fast_memoize_decorator_1 = require("@typescript-plus/fast-memoize-decorator");
|
|
14
|
+
const lodash_1 = require("lodash");
|
|
15
|
+
const ts_morph_1 = require("ts-morph");
|
|
16
|
+
const import_def_1 = require("../utils/import-def");
|
|
17
|
+
const place_def_1 = require("./place-def");
|
|
18
|
+
function isDecoratorNode(node, name) {
|
|
19
|
+
return node.getKind() === ts_morph_1.SyntaxKind.Decorator && node.getText().startsWith(`${name}(`); // NOTE: I'm only supporting the @Decorator(...) style of usage (i.e. decorator factories).
|
|
20
|
+
}
|
|
21
|
+
const ROUTE_PROPERTY_REGEX = /.*(ListModel|ValueModel)<(.*)>/;
|
|
22
|
+
// @See https://astexplorer.net/
|
|
23
|
+
class PlaceClassScanner {
|
|
24
|
+
constructor(sourceFile, classDecl, context) {
|
|
25
|
+
this.sourceFile = sourceFile;
|
|
26
|
+
this.classDecl = classDecl;
|
|
27
|
+
this.context = context;
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
classDecl.forEachChild((node) => {
|
|
30
|
+
if (isDecoratorNode(node, '@Place')) {
|
|
31
|
+
this.placeAnnotation = node;
|
|
32
|
+
// stop iterating when the node is a class declaration
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
isPlace() {
|
|
38
|
+
return !!this.placeAnnotation;
|
|
39
|
+
}
|
|
40
|
+
onMatch(callback) {
|
|
41
|
+
if (this.isPlace()) {
|
|
42
|
+
callback(this);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
createDefinition(moduleImportPath) {
|
|
46
|
+
return new place_def_1.PlaceDef(this.sourceFile.getFilePath(), moduleImportPath, this.classDecl.getName(), this.getPlaceOptions(), this.getRouteIdParameter(), this.getRouteParameters(), this.getChildren(), this.getDefaultChild(), this.getRedirectToFirstChild());
|
|
47
|
+
}
|
|
48
|
+
getPlaceOptions() {
|
|
49
|
+
// const args = this.placeAnnotation.getArguments();
|
|
50
|
+
// if (args.length !== 1) {
|
|
51
|
+
// console.error('@Place() accepts a single Options argument. got', args);
|
|
52
|
+
// }
|
|
53
|
+
return PlaceClassScanner.getOptionsArg(this.placeAnnotation, {
|
|
54
|
+
title: '',
|
|
55
|
+
path: '',
|
|
56
|
+
data: null,
|
|
57
|
+
authenticate: 'true',
|
|
58
|
+
roles: [],
|
|
59
|
+
redirectToFirstChild: false
|
|
60
|
+
}, {
|
|
61
|
+
position: 0,
|
|
62
|
+
required: true
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
getChildren() {
|
|
66
|
+
const literal = PlaceClassScanner.getObjectLiteralArgument(this.placeAnnotation, 0);
|
|
67
|
+
const children = literal.getProperty('children');
|
|
68
|
+
if (children) {
|
|
69
|
+
const initialiser = children.getStructure().initializer;
|
|
70
|
+
const componentClassNames = this.extractChildComponentClassNames(initialiser);
|
|
71
|
+
// FIXME: Check for duplicates
|
|
72
|
+
return componentClassNames.map(componentClassName => this.getChildRefFor(componentClassName));
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
getDefaultChild() {
|
|
79
|
+
const literal = PlaceClassScanner.getObjectLiteralArgument(this.placeAnnotation, 0);
|
|
80
|
+
const defaultChild = literal.getProperty('defaultChild');
|
|
81
|
+
return defaultChild ? defaultChild.getStructure().initializer : null;
|
|
82
|
+
}
|
|
83
|
+
getRedirectToFirstChild() {
|
|
84
|
+
const literal = PlaceClassScanner.getObjectLiteralArgument(this.placeAnnotation, 0);
|
|
85
|
+
const redirect = literal.getProperty('redirectToFirstChild');
|
|
86
|
+
return redirect ? redirect.getStructure().initializer === 'true' : false;
|
|
87
|
+
}
|
|
88
|
+
getChildRefFor(componentClassName) {
|
|
89
|
+
const importDecl = this.sourceFile.getImportDeclarations().find(d => {
|
|
90
|
+
return d.getNamedImports().map(i => i.getText()).includes(componentClassName);
|
|
91
|
+
});
|
|
92
|
+
return new place_def_1.PlaceDef.ChildRef(importDecl.getModuleSpecifierSourceFile().getFilePath(), componentClassName);
|
|
93
|
+
}
|
|
94
|
+
extractChildComponentClassNames(initialiser) {
|
|
95
|
+
return initialiser.replace('[', '')
|
|
96
|
+
.replace(']', '')
|
|
97
|
+
.trim()
|
|
98
|
+
.split(',')
|
|
99
|
+
.map(s => s.trim())
|
|
100
|
+
.filter(s => !(0, lodash_1.isEmpty)(s)); // trailing commas on the last place in the list give us an empty string.
|
|
101
|
+
}
|
|
102
|
+
getRouteIdParameter() {
|
|
103
|
+
const routeProperties = this.getDecoratedProperties('@RouteId');
|
|
104
|
+
if (routeProperties.length === 1) {
|
|
105
|
+
const route = routeProperties[0];
|
|
106
|
+
const routeOptions = PlaceClassScanner.getOptionsArg(route.decorator, { as: '', optional: false }, {
|
|
107
|
+
position: 1,
|
|
108
|
+
required: false
|
|
109
|
+
});
|
|
110
|
+
return new PlaceClassScanner.RouteParameterInfo(routeOptions.as, routeOptions.optional, route.property, this.sourceFile);
|
|
111
|
+
}
|
|
112
|
+
else if (routeProperties.length > 1) {
|
|
113
|
+
this.context.logger.error(`There an only be one @RouteId(), got ${routeProperties.length}`);
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
getRouteParameters() {
|
|
118
|
+
return this.getVisitValueParameters().concat(this.getVisitListParameters());
|
|
119
|
+
}
|
|
120
|
+
getVisitValueParameters() {
|
|
121
|
+
return this.getDecoratedProperties('@VisitParameter')
|
|
122
|
+
.map(p => {
|
|
123
|
+
const routeOptions = PlaceClassScanner.getOptionsArg(p.decorator, { as: p.property.getName() }, {
|
|
124
|
+
position: 0,
|
|
125
|
+
required: false
|
|
126
|
+
});
|
|
127
|
+
return new PlaceClassScanner.RouteParameterInfo(routeOptions.as, true, p.property, this.sourceFile);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
getVisitListParameters() {
|
|
131
|
+
return this.getDecoratedProperties('@VisitParameterList')
|
|
132
|
+
.map(p => {
|
|
133
|
+
const routeOptions = PlaceClassScanner.getOptionsArg(p.decorator, { as: p.property.getName() }, {
|
|
134
|
+
position: 0,
|
|
135
|
+
required: false
|
|
136
|
+
});
|
|
137
|
+
return new PlaceClassScanner.RouteParameterInfo(routeOptions.as, true, p.property, this.sourceFile);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
getDecoratedProperties(annotation) {
|
|
141
|
+
return this.classDecl.getProperties().map(p => {
|
|
142
|
+
let result = null;
|
|
143
|
+
// @ts-ignore
|
|
144
|
+
p.forEachChild((child) => {
|
|
145
|
+
if (isDecoratorNode(child, annotation)) {
|
|
146
|
+
result = {
|
|
147
|
+
decorator: child,
|
|
148
|
+
property: p
|
|
149
|
+
};
|
|
150
|
+
// stop traversal
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return result;
|
|
155
|
+
}).filter(r => !!r);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.PlaceClassScanner = PlaceClassScanner;
|
|
159
|
+
(function (PlaceClassScanner) {
|
|
160
|
+
function getObjectLiteralArgument(annotation, position) {
|
|
161
|
+
const args = annotation.getArguments();
|
|
162
|
+
if (args.length > position && args[position] instanceof ts_morph_1.ObjectLiteralExpression) {
|
|
163
|
+
return args[position];
|
|
164
|
+
}
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
PlaceClassScanner.getObjectLiteralArgument = getObjectLiteralArgument;
|
|
168
|
+
function getOptionsArg(annotation, defaults, options = {
|
|
169
|
+
position: 0,
|
|
170
|
+
required: true
|
|
171
|
+
}) {
|
|
172
|
+
const objectLiteralArgument = getObjectLiteralArgument(annotation, options.position);
|
|
173
|
+
if (!objectLiteralArgument) {
|
|
174
|
+
if (options.required) {
|
|
175
|
+
console.error(`expected object literal arg at position ${options.position}`, { expectedType: defaults });
|
|
176
|
+
}
|
|
177
|
+
return defaults;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
return objectLiteralArgument.getProperties().reduce((result, p) => {
|
|
181
|
+
const structure = p.getStructure();
|
|
182
|
+
return Object.assign(Object.assign({}, result), { [structure.name]: structure.initializer });
|
|
183
|
+
}, Object.assign({}, defaults));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
PlaceClassScanner.getOptionsArg = getOptionsArg;
|
|
187
|
+
class RouteParameterInfo {
|
|
188
|
+
constructor(as, optional, property, sourceFile) {
|
|
189
|
+
this.as = as;
|
|
190
|
+
this.optional = optional;
|
|
191
|
+
this.property = property;
|
|
192
|
+
const type = property.getStructure().type;
|
|
193
|
+
const match = ROUTE_PROPERTY_REGEX.exec(type);
|
|
194
|
+
if (!match) {
|
|
195
|
+
throw new Error(`expected ${property.getName()} to be a ListModel or ValueModel, got: ${type}`);
|
|
196
|
+
}
|
|
197
|
+
this.array = match[1] === 'ListModel';
|
|
198
|
+
this.parameterType = match[2];
|
|
199
|
+
const importDec = sourceFile.getImportDeclarations().find(d => {
|
|
200
|
+
return d.getNamedImports().map(i => i.getText()).includes(this.parameterType);
|
|
201
|
+
});
|
|
202
|
+
this.importDef = importDec ? import_def_1.ImportDef.create(this.parameterType, importDec) : undefined;
|
|
203
|
+
}
|
|
204
|
+
get parameterName() {
|
|
205
|
+
return this.as.length > 0 ? place_def_1.PlaceDef.stripEnclosingQuotes(this.as) : this.modelName;
|
|
206
|
+
}
|
|
207
|
+
get modelName() {
|
|
208
|
+
return place_def_1.PlaceDef.stripEnclosingQuotes(this.property.getName());
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
__decorate([
|
|
212
|
+
(0, fast_memoize_decorator_1.Memoize)(),
|
|
213
|
+
__metadata("design:type", String),
|
|
214
|
+
__metadata("design:paramtypes", [])
|
|
215
|
+
], RouteParameterInfo.prototype, "parameterName", null);
|
|
216
|
+
__decorate([
|
|
217
|
+
(0, fast_memoize_decorator_1.Memoize)(),
|
|
218
|
+
__metadata("design:type", String),
|
|
219
|
+
__metadata("design:paramtypes", [])
|
|
220
|
+
], RouteParameterInfo.prototype, "modelName", null);
|
|
221
|
+
PlaceClassScanner.RouteParameterInfo = RouteParameterInfo;
|
|
222
|
+
})(PlaceClassScanner = exports.PlaceClassScanner || (exports.PlaceClassScanner = {}));
|
|
223
|
+
//# sourceMappingURL=place-class-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place-class-scanner.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/place-routes/place-class-scanner.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oFAAgE;AAChE,mCAA+B;AAC/B,uCAQkB;AAElB,oDAA8C;AAC9C,2CAAqC;AAGrC,SAAS,eAAe,CAAC,IAAU,EAAE,IAAY;IAC/C,OAAO,IAAI,CAAC,OAAO,EAAE,KAAK,qBAAU,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,2FAA2F;AACtL,CAAC;AAED,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAE9D,gCAAgC;AAChC,MAAa,iBAAiB;IAI5B,YAA6B,UAA+B,EAAmB,SAA2B,EAAW,OAAyB;QAAjH,eAAU,GAAV,UAAU,CAAqB;QAAmB,cAAS,GAAT,SAAS,CAAkB;QAAW,YAAO,GAAP,OAAO,CAAkB;QAC5I,aAAa;QACb,SAAS,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE;YAC9B,IAAI,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE;gBACnC,IAAI,CAAC,eAAe,GAAG,IAAiB,CAAC;gBACzC,sDAAsD;gBACtD,OAAO,IAAI,CAAC;aACb;QACH,CAAC,CAAC,CAAC;IACL,CAA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AC,CAAC,CAAC,CAAC,oBAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;QACtF,CAAC;QAED,IACI,SAAS;YACX,OAAO,oBAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QAChE,CAAC;KAEF;IAVC;QAAC,IAAA,gCAAO,GAAE;;;2DAGT;IAED;QAAC,IAAA,gCAAO,GAAE;;;uDAGT;IA5BU,oCAAkB,qBA8B9B,CAAA;AACH,CAAC,EA3DgB,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QA2DjC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { SchematicContext } from '@angular-devkit/schematics';
|
|
2
|
+
import { ClassDeclaration } from 'ts-morph';
|
|
3
|
+
import { DecoratedSourceFile } from '../utils/decorators/decorated-source-file';
|
|
4
|
+
import { ImportDef } from "../utils/import-def";
|
|
5
|
+
import { PlaceClassScanner } from './place-class-scanner';
|
|
6
|
+
export declare class PlaceDef {
|
|
7
|
+
readonly sourceFilePath: string;
|
|
8
|
+
readonly importPath: string;
|
|
9
|
+
readonly componentClass: string;
|
|
10
|
+
readonly properties: PlaceDef.Options;
|
|
11
|
+
readonly routeDef: PlaceDef.Parameter;
|
|
12
|
+
readonly routeParameters: PlaceDef.Parameter[];
|
|
13
|
+
readonly childRefs: PlaceDef.ChildRef[];
|
|
14
|
+
readonly defaultChildComponentClass: string;
|
|
15
|
+
readonly redirectToFirstChild: boolean;
|
|
16
|
+
private parent;
|
|
17
|
+
constructor(sourceFilePath: string, importPath: string, componentClass: string, properties: PlaceDef.Options, routeDef: PlaceDef.Parameter, routeParameters: PlaceDef.Parameter[], childRefs: PlaceDef.ChildRef[], defaultChildComponentClass: string, redirectToFirstChild: boolean);
|
|
18
|
+
get path(): string;
|
|
19
|
+
get routeIdentifier(): PlaceDef.Parameter;
|
|
20
|
+
get fullPath(): string;
|
|
21
|
+
getVisitParameterImports(): ImportDef[];
|
|
22
|
+
getPlaceDestinationParameterArg(name: string): string;
|
|
23
|
+
getPlaceDestinationCreateVisitMethod(): string;
|
|
24
|
+
getPlaceDestinationVisitConstructor(): string;
|
|
25
|
+
get placeName(): string;
|
|
26
|
+
setParent(placeDef: PlaceDef): void;
|
|
27
|
+
isChild(): boolean;
|
|
28
|
+
private requiresRouteGuard;
|
|
29
|
+
get routeModelName(): string;
|
|
30
|
+
get authenticate(): boolean;
|
|
31
|
+
get children(): PlaceDef[];
|
|
32
|
+
getRouteTemplate(): string;
|
|
33
|
+
getChildRouteTemplates(): string[];
|
|
34
|
+
get defaultChildRef(): PlaceDef;
|
|
35
|
+
}
|
|
36
|
+
export declare namespace PlaceDef {
|
|
37
|
+
interface Options {
|
|
38
|
+
path: string;
|
|
39
|
+
data: object;
|
|
40
|
+
authenticate: string;
|
|
41
|
+
roles: string[];
|
|
42
|
+
redirectToFirstChild: boolean;
|
|
43
|
+
}
|
|
44
|
+
interface Parameter {
|
|
45
|
+
parameterName: string;
|
|
46
|
+
modelName: string;
|
|
47
|
+
parameterType: string;
|
|
48
|
+
optional: boolean;
|
|
49
|
+
array: boolean;
|
|
50
|
+
importDef: ImportDef | undefined;
|
|
51
|
+
}
|
|
52
|
+
function scan(sourceFile: DecoratedSourceFile, classDecl: ClassDeclaration, context: SchematicContext): PlaceClassScanner;
|
|
53
|
+
function stripEnclosingQuotes(value: string): string;
|
|
54
|
+
class ChildRef {
|
|
55
|
+
readonly filePath: string;
|
|
56
|
+
readonly componentClass: string;
|
|
57
|
+
private _placeDef;
|
|
58
|
+
constructor(filePath: string, componentClass: string);
|
|
59
|
+
get placeDef(): PlaceDef;
|
|
60
|
+
resolve(placeDefs: PlaceDef[]): PlaceDef;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PlaceDef = void 0;
|
|
13
|
+
const fast_memoize_decorator_1 = require("@typescript-plus/fast-memoize-decorator");
|
|
14
|
+
const place_class_scanner_1 = require("./place-class-scanner");
|
|
15
|
+
const _ = require("lodash");
|
|
16
|
+
class PlaceDef {
|
|
17
|
+
constructor(sourceFilePath, importPath, componentClass, properties, routeDef, routeParameters, childRefs, defaultChildComponentClass, redirectToFirstChild) {
|
|
18
|
+
this.sourceFilePath = sourceFilePath;
|
|
19
|
+
this.importPath = importPath;
|
|
20
|
+
this.componentClass = componentClass;
|
|
21
|
+
this.properties = properties;
|
|
22
|
+
this.routeDef = routeDef;
|
|
23
|
+
this.routeParameters = routeParameters;
|
|
24
|
+
this.childRefs = childRefs;
|
|
25
|
+
this.defaultChildComponentClass = defaultChildComponentClass;
|
|
26
|
+
this.redirectToFirstChild = redirectToFirstChild;
|
|
27
|
+
}
|
|
28
|
+
get path() {
|
|
29
|
+
return PlaceDef.stripEnclosingQuotes(this.properties.path);
|
|
30
|
+
}
|
|
31
|
+
get routeIdentifier() {
|
|
32
|
+
return this.routeDef;
|
|
33
|
+
}
|
|
34
|
+
get fullPath() {
|
|
35
|
+
return !!this.routeIdentifier ?
|
|
36
|
+
`${this.path}/:${this.routeIdentifier.parameterName}` :
|
|
37
|
+
this.path;
|
|
38
|
+
}
|
|
39
|
+
getVisitParameterImports() {
|
|
40
|
+
return _.uniq([this.routeIdentifier, ...this.routeParameters].filter(p => !!p && !_.isEmpty(p.importDef))).map(p => p.importDef);
|
|
41
|
+
}
|
|
42
|
+
getPlaceDestinationParameterArg(name) {
|
|
43
|
+
const bits = [];
|
|
44
|
+
if (this.routeIdentifier) {
|
|
45
|
+
const optional = this.routeIdentifier.optional ? "?" : "";
|
|
46
|
+
bits.push(`${this.routeIdentifier.parameterName}${optional}:${this.routeIdentifier.parameterType}${this.routeIdentifier.array ? '[]' : ''}`);
|
|
47
|
+
}
|
|
48
|
+
if (this.routeParameters && this.routeParameters.length > 0) {
|
|
49
|
+
const properties = this.routeParameters.map(p => `${p.parameterName}?: ${p.parameterType}${p.array ? '[]' : ''}`);
|
|
50
|
+
bits.push(`${name}?: { ${properties.join(', ')} }`);
|
|
51
|
+
}
|
|
52
|
+
return bits.join(', ');
|
|
53
|
+
}
|
|
54
|
+
getPlaceDestinationCreateVisitMethod() {
|
|
55
|
+
const parameterNames = [];
|
|
56
|
+
if (this.routeIdentifier) {
|
|
57
|
+
parameterNames.push(this.routeIdentifier.parameterName);
|
|
58
|
+
}
|
|
59
|
+
if (this.routeParameters && this.routeParameters.length > 0) {
|
|
60
|
+
parameterNames.push('visitParams');
|
|
61
|
+
}
|
|
62
|
+
return `createVisit(${this.getPlaceDestinationParameterArg('visitParams')}): Visit {
|
|
63
|
+
return new ${this.componentClass}Visit(${parameterNames.join(', ')});
|
|
64
|
+
}`;
|
|
65
|
+
}
|
|
66
|
+
getPlaceDestinationVisitConstructor() {
|
|
67
|
+
const parameterNames = [];
|
|
68
|
+
if (this.routeIdentifier) {
|
|
69
|
+
parameterNames.push(this.routeIdentifier.parameterName);
|
|
70
|
+
}
|
|
71
|
+
if (this.routeParameters && this.routeParameters.length > 0) {
|
|
72
|
+
parameterNames.push('...visitParams');
|
|
73
|
+
}
|
|
74
|
+
return `constructor(${this.getPlaceDestinationParameterArg('visitParams')}) {
|
|
75
|
+
super(PlaceComponent.getDefinition(${this.componentClass}), {${parameterNames.join(', ')}});
|
|
76
|
+
}`;
|
|
77
|
+
}
|
|
78
|
+
get placeName() {
|
|
79
|
+
const s = this.componentClass.replace(/Component$/, '');
|
|
80
|
+
return s.charAt(0).toLowerCase() + s.slice(1);
|
|
81
|
+
}
|
|
82
|
+
setParent(placeDef) {
|
|
83
|
+
this.parent = placeDef;
|
|
84
|
+
}
|
|
85
|
+
isChild() {
|
|
86
|
+
return !!this.parent;
|
|
87
|
+
}
|
|
88
|
+
requiresRouteGuard() {
|
|
89
|
+
return this.routeIdentifier || this.routeParameters.length > 0;
|
|
90
|
+
}
|
|
91
|
+
get routeModelName() {
|
|
92
|
+
return this.routeDef ? this.routeDef.modelName : null;
|
|
93
|
+
}
|
|
94
|
+
get authenticate() {
|
|
95
|
+
return this.properties.authenticate === 'true';
|
|
96
|
+
}
|
|
97
|
+
get children() {
|
|
98
|
+
return this.childRefs.map(cr => cr.placeDef);
|
|
99
|
+
}
|
|
100
|
+
getRouteTemplate() {
|
|
101
|
+
const bits = [];
|
|
102
|
+
if (this.routeIdentifier) {
|
|
103
|
+
bits.push(`{path: "${this.path}", redirectTo: "${this.path}/"},`);
|
|
104
|
+
}
|
|
105
|
+
bits.push(`{
|
|
106
|
+
path: "${this.fullPath}",
|
|
107
|
+
component: ${this.componentClass},
|
|
108
|
+
canActivate: [PlaceGuard],
|
|
109
|
+
canDeactivate: [PlaceGuard],
|
|
110
|
+
runGuardsAndResolvers: ${this.redirectToFirstChild ? `"always", // if we don't do this the guards don't get called when navigating from a child to the parent` : `"paramsOrQueryParamsChange",`}
|
|
111
|
+
children:[
|
|
112
|
+
${this.getChildRouteTemplates().join(', ')}
|
|
113
|
+
]
|
|
114
|
+
}`);
|
|
115
|
+
return bits.join('\n');
|
|
116
|
+
}
|
|
117
|
+
getChildRouteTemplates() {
|
|
118
|
+
if (this.defaultChildRef) {
|
|
119
|
+
const redirectTo = this.defaultChildRef.routeIdentifier ? `${this.defaultChildRef.path}/` : this.defaultChildRef.path;
|
|
120
|
+
return [
|
|
121
|
+
`{path:"", redirectTo:"${redirectTo}", pathMatch:"full"}`,
|
|
122
|
+
...this.children.map(c => c.getRouteTemplate())
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
return this.children.map(c => c.getRouteTemplate());
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
get defaultChildRef() {
|
|
130
|
+
if (this.defaultChildComponentClass) {
|
|
131
|
+
const placeDef = this.children.find(c => c.componentClass === this.defaultChildComponentClass);
|
|
132
|
+
if (!placeDef) {
|
|
133
|
+
throw new Error(`defaultChild is not a known child of this place, should be one of ${this.children.map(c => c.componentClass)}, got ${this.defaultChildComponentClass}`);
|
|
134
|
+
}
|
|
135
|
+
return placeDef;
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
__decorate([
|
|
141
|
+
(0, fast_memoize_decorator_1.Memoize)()
|
|
142
|
+
// @ts-ignore keeps compaining about experimental decorators not being enabled... but they are.
|
|
143
|
+
,
|
|
144
|
+
__metadata("design:type", Object),
|
|
145
|
+
__metadata("design:paramtypes", [])
|
|
146
|
+
], PlaceDef.prototype, "path", null);
|
|
147
|
+
__decorate([
|
|
148
|
+
(0, fast_memoize_decorator_1.Memoize)()
|
|
149
|
+
// @ts-ignore keeps compaining about experimental decorators not being enabled... but they are.
|
|
150
|
+
,
|
|
151
|
+
__metadata("design:type", Object),
|
|
152
|
+
__metadata("design:paramtypes", [])
|
|
153
|
+
], PlaceDef.prototype, "placeName", null);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, fast_memoize_decorator_1.Memoize)()
|
|
156
|
+
// @ts-ignore keeps compaining about experimental decorators not being enabled... but they are.
|
|
157
|
+
,
|
|
158
|
+
__metadata("design:type", Object),
|
|
159
|
+
__metadata("design:paramtypes", [])
|
|
160
|
+
], PlaceDef.prototype, "routeModelName", null);
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, fast_memoize_decorator_1.Memoize)()
|
|
163
|
+
// @ts-ignore keeps compaining about experimental decorators not being enabled... but they are.
|
|
164
|
+
,
|
|
165
|
+
__metadata("design:type", PlaceDef),
|
|
166
|
+
__metadata("design:paramtypes", [])
|
|
167
|
+
], PlaceDef.prototype, "defaultChildRef", null);
|
|
168
|
+
exports.PlaceDef = PlaceDef;
|
|
169
|
+
(function (PlaceDef) {
|
|
170
|
+
function scan(sourceFile, classDecl, context) {
|
|
171
|
+
return new place_class_scanner_1.PlaceClassScanner(sourceFile, classDecl, context);
|
|
172
|
+
}
|
|
173
|
+
PlaceDef.scan = scan;
|
|
174
|
+
function stripEnclosingQuotes(value) {
|
|
175
|
+
const cooked = value.replace(/(^["'])|(["']$)/g, '');
|
|
176
|
+
// console.log({ raw: value, cooked: cooked });
|
|
177
|
+
return cooked;
|
|
178
|
+
}
|
|
179
|
+
PlaceDef.stripEnclosingQuotes = stripEnclosingQuotes;
|
|
180
|
+
class ChildRef {
|
|
181
|
+
constructor(filePath, componentClass) {
|
|
182
|
+
this.filePath = filePath;
|
|
183
|
+
this.componentClass = componentClass;
|
|
184
|
+
}
|
|
185
|
+
get placeDef() {
|
|
186
|
+
return this._placeDef;
|
|
187
|
+
}
|
|
188
|
+
resolve(placeDefs) {
|
|
189
|
+
this._placeDef = placeDefs.find(d => d.sourceFilePath === this.filePath && d.componentClass === this.componentClass);
|
|
190
|
+
return this._placeDef;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
PlaceDef.ChildRef = ChildRef;
|
|
194
|
+
})(PlaceDef = exports.PlaceDef || (exports.PlaceDef = {}));
|
|
195
|
+
//# sourceMappingURL=place-def.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place-def.js","sourceRoot":"","sources":["../../../../../libs/ang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Q;YAAW,mBAAc,GAAd,cAAc,CAAQ;QACtE,CAAC;QAED,IAAI,QAAQ;YACV,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;QAED,OAAO,CAAC,SAAqB;YAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,KAAK,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC;YACrH,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;KACF;IAdY,iBAAQ,WAcpB,CAAA;AAGH,CAAC,EA/CgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA+CxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/place-routes/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "place-routes",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"project": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The name of the project.",
|
|
9
|
+
"$default": {
|
|
10
|
+
"$source": "projectName"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"dir": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The directory to scan for place components",
|
|
16
|
+
"$default": {
|
|
17
|
+
"$source": "argv",
|
|
18
|
+
"index": 0
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": [
|
|
23
|
+
"project", "dir"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// DO NOT EDIT!!!
|
|
2
|
+
// This file is automatically generated using:
|
|
3
|
+
// ng generate @coolon/angular-ui-powerups:place-routes --project=powerup-demo --dir=app/places
|
|
4
|
+
|
|
5
|
+
import { Routes } from '@angular/router';
|
|
6
|
+
import { PlaceGuard } from '@coolon/angular-ui-powerups';
|
|
7
|
+
|
|
8
|
+
<% placeDefs.forEach(def => { %>import {<%= def.componentClass %>} from "<%= def.importPath %>";
|
|
9
|
+
<% }); %>
|
|
10
|
+
|
|
11
|
+
export const placeRoutes:Routes = [<% placeDefs.filter(def=> !def.isChild()).forEach(def => { %>
|
|
12
|
+
<%= def.getRouteTemplate() %>,
|
|
13
|
+
<% }) %>
|
|
14
|
+
];
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
readonly sourceCodeRootDir: BuildContext.RootDir;
|
|
11
|
+
readonly appCodeRootDir: BuildContext.RootDir;
|
|
12
|
+
constructor(tree: Tree, projectName: string, settings: BuildContext.Settings, context: SchematicContext);
|
|
13
|
+
get logger(): {
|
|
14
|
+
info(message: string): void;
|
|
15
|
+
error(message: string): void;
|
|
16
|
+
fatal(message: string): void;
|
|
17
|
+
};
|
|
18
|
+
get tsConfigPath(): string;
|
|
19
|
+
get sourceCodeRoot(): string;
|
|
20
|
+
get sourceRoot(): any;
|
|
21
|
+
get rootDir(): any;
|
|
22
|
+
get selectorPrefix(): any;
|
|
23
|
+
private loadTypeScriptProject;
|
|
24
|
+
scanClassesInTree(tree: Tree, scanRootDirectory: string, scanClass: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, path: string) => void): void;
|
|
25
|
+
findFileInAncestorPath(pathToSourceRoot: string[], fileName: string): string;
|
|
26
|
+
getSourceFile(pathFromSrcRoot: string): DecoratedSourceFile;
|
|
27
|
+
}
|
|
28
|
+
export declare namespace BuildContext {
|
|
29
|
+
interface Settings {
|
|
30
|
+
readonly workspaceProject: any;
|
|
31
|
+
readonly projectType: string;
|
|
32
|
+
readonly tsConfigPath: string;
|
|
33
|
+
}
|
|
34
|
+
class App extends BuildContext {
|
|
35
|
+
}
|
|
36
|
+
class Lib extends BuildContext {
|
|
37
|
+
}
|
|
38
|
+
abstract class Dir {
|
|
39
|
+
private readonly pathToRoot;
|
|
40
|
+
protected abstract getPath(): string;
|
|
41
|
+
protected abstract getAbsPath(): string;
|
|
42
|
+
protected abstract getTreePath(): string;
|
|
43
|
+
abstract getRoot(): BuildContext.Dir;
|
|
44
|
+
constructor();
|
|
45
|
+
get path(): string;
|
|
46
|
+
get treePath(): string;
|
|
47
|
+
get absPath(): string;
|
|
48
|
+
relativeDir(path: string): Dir;
|
|
49
|
+
getDotPathToRoot(): string;
|
|
50
|
+
private clean;
|
|
51
|
+
getRelativePathTo(path: string): string;
|
|
52
|
+
private resolveAgainstRoot;
|
|
53
|
+
}
|
|
54
|
+
class RootDir extends Dir {
|
|
55
|
+
private readonly treeAbsRoot;
|
|
56
|
+
readonly _treePath: string;
|
|
57
|
+
constructor(treeAbsRoot: string, _treePath: string);
|
|
58
|
+
protected getTreePath(): string;
|
|
59
|
+
protected getPath(): string;
|
|
60
|
+
getRoot(): BuildContext.Dir;
|
|
61
|
+
protected getAbsPath(): string;
|
|
62
|
+
relativeDir(path: string): BuildContext.Dir;
|
|
63
|
+
}
|
|
64
|
+
class RelativeDir extends Dir {
|
|
65
|
+
private readonly parent;
|
|
66
|
+
private readonly _relativePath;
|
|
67
|
+
constructor(parent: Dir, _relativePath: string);
|
|
68
|
+
getRoot(): BuildContext.Dir;
|
|
69
|
+
protected getPath(): string;
|
|
70
|
+
protected getTreePath(): string;
|
|
71
|
+
protected getAbsPath(): string;
|
|
72
|
+
}
|
|
73
|
+
}
|