@rxap/schematics-ts-morph 13.0.0-next.0 → 13.0.0-next.3
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/CHANGELOG.md +30 -0
- package/package.json +6 -4
- package/src/index.js +54 -57
- package/src/index.js.map +1 -1
- package/src/lib/add-component-animations.js +5 -9
- package/src/lib/add-component-animations.js.map +1 -1
- package/src/lib/add-component-fake-provider.js +5 -9
- package/src/lib/add-component-fake-provider.js.map +1 -1
- package/src/lib/add-component-input.js +7 -11
- package/src/lib/add-component-input.js.map +1 -1
- package/src/lib/add-component-provider.js +7 -11
- package/src/lib/add-component-provider.js.map +1 -1
- package/src/lib/add-control-validator.js +5 -10
- package/src/lib/add-control-validator.js.map +1 -1
- package/src/lib/add-dependency-injection.js +8 -12
- package/src/lib/add-dependency-injection.js.map +1 -1
- package/src/lib/add-dir.js +4 -8
- package/src/lib/add-dir.js.map +1 -1
- package/src/lib/add-fake-provider.js +12 -16
- package/src/lib/add-fake-provider.js.map +1 -1
- package/src/lib/add-method-class.js +7 -11
- package/src/lib/add-method-class.js.map +1 -1
- package/src/lib/add-ng-module-import.js +5 -9
- package/src/lib/add-ng-module-import.js.map +1 -1
- package/src/lib/add-ng-module-provider.js +7 -11
- package/src/lib/add-ng-module-provider.js.map +1 -1
- package/src/lib/add-provider-to-array.js +6 -10
- package/src/lib/add-provider-to-array.js.map +1 -1
- package/src/lib/add-to-array.js +5 -9
- package/src/lib/add-to-array.js.map +1 -1
- package/src/lib/add-variable-fake-provider.js +5 -9
- package/src/lib/add-variable-fake-provider.js.map +1 -1
- package/src/lib/add-variable-provider.js +7 -11
- package/src/lib/add-variable-provider.js.map +1 -1
- package/src/lib/apply-ts-morph-project.js +3 -7
- package/src/lib/apply-ts-morph-project.js.map +1 -1
- package/src/lib/auto-import.js +7 -11
- package/src/lib/auto-import.js.map +1 -1
- package/src/lib/coerce-class-constructor.js +1 -5
- package/src/lib/coerce-class-constructor.js.map +1 -1
- package/src/lib/coerce-class-method.js +1 -5
- package/src/lib/coerce-class-method.js.map +1 -1
- package/src/lib/coerce-class.js +1 -5
- package/src/lib/coerce-class.js.map +1 -1
- package/src/lib/coerce-method-class.js +5 -9
- package/src/lib/coerce-method-class.js.map +1 -1
- package/src/lib/coerce-property-key.js +1 -5
- package/src/lib/coerce-property-key.js.map +1 -1
- package/src/lib/coerce-source-file.js +1 -5
- package/src/lib/coerce-source-file.js.map +1 -1
- package/src/lib/coerce-variable-declaration.js +3 -7
- package/src/lib/coerce-variable-declaration.js.map +1 -1
- package/src/lib/find-component-module-source-file.js +3 -7
- package/src/lib/find-component-module-source-file.js.map +1 -1
- package/src/lib/find-component-source-file.js +3 -7
- package/src/lib/find-component-source-file.js.map +1 -1
- package/src/lib/find-routing-module.js +3 -7
- package/src/lib/find-routing-module.js.map +1 -1
- package/src/lib/fix-missing-imports.js +7 -11
- package/src/lib/fix-missing-imports.js.map +1 -1
- package/src/lib/get-array-declaration.js +5 -9
- package/src/lib/get-array-declaration.js.map +1 -1
- package/src/lib/get-class-decorator-arguments.js +1 -5
- package/src/lib/get-class-decorator-arguments.js.map +1 -1
- package/src/lib/get-coerce-array-literal-form-object-literal.js +4 -8
- package/src/lib/get-coerce-array-literal-form-object-literal.js.map +1 -1
- package/src/lib/get-component-class.js +1 -5
- package/src/lib/get-component-class.js.map +1 -1
- package/src/lib/get-component-options-object.js +4 -8
- package/src/lib/get-component-options-object.js.map +1 -1
- package/src/lib/get-form-providers-source-file.js +4 -9
- package/src/lib/get-form-providers-source-file.js.map +1 -1
- package/src/lib/get-ng-module-options-object.js +4 -8
- package/src/lib/get-ng-module-options-object.js.map +1 -1
- package/src/lib/get-variable-declaration.js +1 -5
- package/src/lib/get-variable-declaration.js.map +1 -1
- package/src/lib/handle-component-module.js +1 -2
- package/src/lib/handle-component.js +1 -2
- package/src/lib/is-array-literal-expression.js +4 -9
- package/src/lib/is-array-literal-expression.js.map +1 -1
- package/src/lib/merge-ts-morph-project.js +3 -7
- package/src/lib/merge-ts-morph-project.js.map +1 -1
- package/src/lib/nestjs/add-nest-controller.js +12 -16
- package/src/lib/nestjs/add-nest-controller.js.map +1 -1
- package/src/lib/nestjs/add-nest-module-controller.js +7 -11
- package/src/lib/nestjs/add-nest-module-controller.js.map +1 -1
- package/src/lib/nestjs/add-nest-module-import.js +5 -9
- package/src/lib/nestjs/add-nest-module-import.js.map +1 -1
- package/src/lib/nestjs/add-nest-module-provider.js +7 -11
- package/src/lib/nestjs/add-nest-module-provider.js.map +1 -1
- package/src/lib/nestjs/add-nest-provider-to-array.js +6 -10
- package/src/lib/nestjs/add-nest-provider-to-array.js.map +1 -1
- package/src/lib/nestjs/find-nest-module-declaration.js +5 -9
- package/src/lib/nestjs/find-nest-module-declaration.js.map +1 -1
- package/src/lib/nestjs/find-nest-module-source-file.js +3 -7
- package/src/lib/nestjs/find-nest-module-source-file.js.map +1 -1
- package/src/lib/nestjs/get-nest-module-metadata.js +7 -11
- package/src/lib/nestjs/get-nest-module-metadata.js.map +1 -1
- package/src/lib/nestjs/has-nest-module-class.js +3 -7
- package/src/lib/nestjs/has-nest-module-class.js.map +1 -1
- package/src/lib/nestjs/is-nest-module-class.js +1 -5
- package/src/lib/nestjs/is-nest-module-class.js.map +1 -1
- package/src/lib/nestjs/nest-provider-object.js +1 -2
- package/src/lib/organize-imports.js +5 -9
- package/src/lib/organize-imports.js.map +1 -1
- package/src/lib/overwrite-decorator.js +1 -5
- package/src/lib/overwrite-decorator.js.map +1 -1
- package/src/lib/overwrite-property.js +1 -5
- package/src/lib/overwrite-property.js.map +1 -1
- package/src/lib/provider-object.js +1 -2
- package/src/lib/to-value-context.js +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [13.0.0-next.3](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@13.0.0-next.2...@rxap/schematics-ts-morph@13.0.0-next.3) (2022-08-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* support node16 module resolution ([f8975a1](https://gitlab.com/rxap/packages/commit/f8975a160b07276e72db3f6745c207ac4b4632f4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [13.0.0-next.2](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@13.0.0-next.1...@rxap/schematics-ts-morph@13.0.0-next.2) (2022-05-09)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @rxap/schematics-ts-morph
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [13.0.0-next.1](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@13.0.0-next.0...@rxap/schematics-ts-morph@13.0.0-next.1) (2022-03-23)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* remove rxap/utilities dependency ([d8dfe16](https://gitlab.com/rxap/packages/commit/d8dfe168f5d3afd5cd88d4fd143bd2c7b2c687b7))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
# [13.0.0-next.0](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@12.3.2...@rxap/schematics-ts-morph@13.0.0-next.0) (2022-02-19)
|
|
7
37
|
|
|
8
38
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxap/schematics-ts-morph",
|
|
3
|
-
"version": "13.0.0-next.
|
|
3
|
+
"version": "13.0.0-next.3",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"tslib": "^2.3.1",
|
|
6
|
+
"semver": "^7.3.5"
|
|
7
7
|
},
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"directory": "../../dist/libs/ts-morph",
|
|
@@ -30,11 +30,13 @@
|
|
|
30
30
|
},
|
|
31
31
|
"ng-update": {
|
|
32
32
|
"packageGroup": [
|
|
33
|
-
"@rxap/schematics-ts-morph"
|
|
33
|
+
"@rxap/schematics-ts-morph",
|
|
34
|
+
"@rxap/schematics-utilities"
|
|
34
35
|
],
|
|
35
36
|
"migrations": "./migration.json"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
39
|
+
"@rxap/schematics-utilities": "^13.0.0-next.2",
|
|
38
40
|
"ts-morph": "^13.0.3"
|
|
39
41
|
},
|
|
40
42
|
"typings": "./src/index.d.ts"
|
package/src/index.js
CHANGED
|
@@ -1,60 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
tslib_1.__exportStar(require("./lib/coerce-class-method"), exports);
|
|
45
|
-
tslib_1.__exportStar(require("./lib/merge-ts-morph-project"), exports);
|
|
46
|
-
tslib_1.__exportStar(require("./lib/coerce-property-key"), exports);
|
|
1
|
+
export * from './lib/add-control-validator';
|
|
2
|
+
export * from './lib/add-to-array';
|
|
3
|
+
export * from './lib/get-form-providers-source-file';
|
|
4
|
+
export * from './lib/overwrite-decorator';
|
|
5
|
+
export * from './lib/overwrite-property';
|
|
6
|
+
export * from './lib/add-dir';
|
|
7
|
+
export * from './lib/apply-ts-morph-project';
|
|
8
|
+
export * from './lib/auto-import';
|
|
9
|
+
export * from './lib/fix-missing-imports';
|
|
10
|
+
export * from './lib/add-provider-to-array';
|
|
11
|
+
export * from './lib/add-variable-provider';
|
|
12
|
+
export * from './lib/coerce-variable-declaration';
|
|
13
|
+
export * from './lib/get-variable-declaration';
|
|
14
|
+
export * from './lib/add-component-provider';
|
|
15
|
+
export * from './lib/organize-imports';
|
|
16
|
+
export * from './lib/get-component-class';
|
|
17
|
+
export * from './lib/add-component-input';
|
|
18
|
+
export * from './lib/add-component-fake-provider';
|
|
19
|
+
export * from './lib/add-method-class';
|
|
20
|
+
export * from './lib/coerce-method-class';
|
|
21
|
+
export * from './lib/coerce-source-file';
|
|
22
|
+
export * from './lib/add-fake-provider';
|
|
23
|
+
export * from './lib/add-variable-fake-provider';
|
|
24
|
+
export * from './lib/coerce-class';
|
|
25
|
+
export * from './lib/provider-object';
|
|
26
|
+
export * from './lib/to-value-context';
|
|
27
|
+
export * from './lib/add-component-animations';
|
|
28
|
+
export * from './lib/add-ng-module-import';
|
|
29
|
+
export * from './lib/add-ng-module-provider';
|
|
30
|
+
export * from './lib/find-component-module-source-file';
|
|
31
|
+
export * from './lib/find-component-source-file';
|
|
32
|
+
export * from './lib/find-routing-module';
|
|
33
|
+
export * from './lib/get-coerce-array-literal-form-object-literal';
|
|
34
|
+
export * from './lib/get-component-options-object';
|
|
35
|
+
export * from './lib/get-ng-module-options-object';
|
|
36
|
+
export * from './lib/handle-component';
|
|
37
|
+
export * from './lib/handle-component-module';
|
|
38
|
+
export * from './lib/get-class-decorator-arguments';
|
|
39
|
+
export * from './lib/coerce-class-constructor';
|
|
40
|
+
export * from './lib/add-dependency-injection';
|
|
41
|
+
export * from './lib/coerce-class-method';
|
|
42
|
+
export * from './lib/merge-ts-morph-project';
|
|
43
|
+
export * from './lib/coerce-property-key';
|
|
47
44
|
// region nestjs
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
export * from './lib/nestjs/add-nest-controller';
|
|
46
|
+
export * from './lib/nestjs/add-nest-module-controller';
|
|
47
|
+
export * from './lib/nestjs/add-nest-module-import';
|
|
48
|
+
export * from './lib/nestjs/add-nest-module-provider';
|
|
49
|
+
export * from './lib/nestjs/add-nest-provider-to-array';
|
|
50
|
+
export * from './lib/nestjs/find-nest-module-declaration';
|
|
51
|
+
export * from './lib/nestjs/find-nest-module-source-file';
|
|
52
|
+
export * from './lib/nestjs/get-nest-module-metadata';
|
|
53
|
+
export * from './lib/nestjs/has-nest-module-class';
|
|
54
|
+
export * from './lib/nestjs/is-nest-module-class';
|
|
55
|
+
export * from './lib/nestjs/nest-provider-object';
|
|
59
56
|
// endregion
|
|
60
57
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/ts-morph/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/ts-morph/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC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|
-
|
|
3
|
-
|
|
4
|
-
const get_component_options_object_1 = require("./get-component-options-object");
|
|
5
|
-
const get_coerce_array_literal_form_object_literal_1 = require("./get-coerce-array-literal-form-object-literal");
|
|
6
|
-
function AddComponentAnimations(sourceFile, namedImport, moduleSpecifier) {
|
|
1
|
+
import { GetComponentOptionsObject } from './get-component-options-object';
|
|
2
|
+
import { GetCoerceArrayLiteralFromObjectLiteral } from './get-coerce-array-literal-form-object-literal';
|
|
3
|
+
export function AddComponentAnimations(sourceFile, namedImport, moduleSpecifier) {
|
|
7
4
|
sourceFile.addImportDeclaration({
|
|
8
5
|
moduleSpecifier,
|
|
9
6
|
namedImports: [namedImport]
|
|
10
7
|
});
|
|
11
|
-
const componentOptions =
|
|
12
|
-
const importsArray =
|
|
8
|
+
const componentOptions = GetComponentOptionsObject(sourceFile);
|
|
9
|
+
const importsArray = GetCoerceArrayLiteralFromObjectLiteral(componentOptions, 'animations');
|
|
13
10
|
if (!importsArray.getElements().some(element => element.getFullText().trim() === namedImport)) {
|
|
14
11
|
importsArray.addElement(namedImport);
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
|
-
exports.AddComponentAnimations = AddComponentAnimations;
|
|
18
14
|
//# sourceMappingURL=add-component-animations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-component-animations.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-component-animations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-component-animations.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-component-animations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;AAExG,MAAM,UAAU,sBAAsB,CAAC,UAAsB,EAAE,WAAmB,EAAE,eAAuB;IAEzG,UAAU,CAAC,oBAAoB,CAAC;QAC9B,eAAe;QACf,YAAY,EAAE,CAAE,WAAW,CAAE;KAC9B,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAE/D,MAAM,YAAY,GAAG,sCAAsC,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;IAE5F,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC,EAAE;QAC7F,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;KACtC;AAEH,CAAC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function AddComponentFakeProvider(sourceFile, fakeProviderObject, realProviderObject, fakeName, structures = [], overwrite = false) {
|
|
7
|
-
add_component_provider_1.AddComponentProvider(sourceFile, 'FAKE_PROVIDER_FACTORY', structures, overwrite);
|
|
8
|
-
add_fake_provider_1.AddFakeProvider(sourceFile, fakeProviderObject, realProviderObject, fakeName, overwrite);
|
|
1
|
+
import { AddComponentProvider } from './add-component-provider';
|
|
2
|
+
import { AddFakeProvider } from './add-fake-provider';
|
|
3
|
+
export function AddComponentFakeProvider(sourceFile, fakeProviderObject, realProviderObject, fakeName, structures = [], overwrite = false) {
|
|
4
|
+
AddComponentProvider(sourceFile, 'FAKE_PROVIDER_FACTORY', structures, overwrite);
|
|
5
|
+
AddFakeProvider(sourceFile, fakeProviderObject, realProviderObject, fakeName, overwrite);
|
|
9
6
|
}
|
|
10
|
-
exports.AddComponentFakeProvider = AddComponentFakeProvider;
|
|
11
7
|
/*
|
|
12
8
|
|
|
13
9
|
const FAKE_PROVIDERS = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-component-fake-provider.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-component-fake-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-component-fake-provider.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-component-fake-provider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,UAAU,wBAAwB,CACtC,UAAsB,EACtB,kBAAuD,EACvD,kBAAuD,EACvD,QAAgB,EAChB,aAAsE,EAAE,EACxE,YAAsE,KAAK;IAG3E,oBAAoB,CAClB,UAAU,EACV,uBAAuB,EACvB,UAAU,EACV,SAAS,CACV,CAAC;IAEF,eAAe,CACb,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,SAAS,CACV,CAAC;AAEJ,CAAC;AAED;;;;;;;;;;;;GAYG"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const get_component_class_1 = require("./get-component-class");
|
|
6
|
-
function AddComponentInput(sourceFile, componentInputDefinition, structures = []) {
|
|
7
|
-
const componentClass = get_component_class_1.GetComponentClass(sourceFile);
|
|
1
|
+
import { Scope } from 'ts-morph';
|
|
2
|
+
import { GetComponentClass } from './get-component-class';
|
|
3
|
+
export function AddComponentInput(sourceFile, componentInputDefinition, structures = []) {
|
|
4
|
+
const componentClass = GetComponentClass(sourceFile);
|
|
8
5
|
if (!componentClass.getConstructors().some(cotr => cotr.getParameters()
|
|
9
6
|
.some(param => !!param.getScope() && param.getName() === componentInputDefinition.name))) {
|
|
10
7
|
if (componentInputDefinition.setAccessor) {
|
|
11
8
|
if (!componentClass.getSetAccessor(componentInputDefinition.name)) {
|
|
12
9
|
componentClass.addSetAccessor({
|
|
13
10
|
name: componentInputDefinition.name,
|
|
14
|
-
scope:
|
|
11
|
+
scope: Scope.Public,
|
|
15
12
|
parameters: [
|
|
16
13
|
{
|
|
17
14
|
name: componentInputDefinition.name,
|
|
@@ -32,7 +29,7 @@ function AddComponentInput(sourceFile, componentInputDefinition, structures = []
|
|
|
32
29
|
if (!componentClass.getProperty('_' + componentInputDefinition.name)) {
|
|
33
30
|
componentClass.addProperty({
|
|
34
31
|
name: '_' + componentInputDefinition.name,
|
|
35
|
-
scope:
|
|
32
|
+
scope: Scope.Private,
|
|
36
33
|
type: componentInputDefinition.type,
|
|
37
34
|
initializer: componentInputDefinition.initializer,
|
|
38
35
|
hasQuestionToken: !componentInputDefinition.initializer && !componentInputDefinition.required,
|
|
@@ -49,7 +46,7 @@ function AddComponentInput(sourceFile, componentInputDefinition, structures = []
|
|
|
49
46
|
if (!componentClass.getProperty(componentInputDefinition.name)) {
|
|
50
47
|
componentClass.addProperty({
|
|
51
48
|
name: componentInputDefinition.name,
|
|
52
|
-
scope:
|
|
49
|
+
scope: Scope.Public,
|
|
53
50
|
type: componentInputDefinition.type,
|
|
54
51
|
initializer: componentInputDefinition.initializer,
|
|
55
52
|
hasQuestionToken: !componentInputDefinition.initializer && !componentInputDefinition.required,
|
|
@@ -71,5 +68,4 @@ function AddComponentInput(sourceFile, componentInputDefinition, structures = []
|
|
|
71
68
|
}
|
|
72
69
|
sourceFile.addImportDeclarations(structures);
|
|
73
70
|
}
|
|
74
|
-
exports.AddComponentInput = AddComponentInput;
|
|
75
71
|
//# sourceMappingURL=add-component-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-component-input.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-component-input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-component-input.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-component-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4D,KAAK,EAA8B,MAAM,UAAU,CAAC;AACvH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAY1D,MAAM,UAAU,iBAAiB,CAC/B,UAAsB,EACtB,wBA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AAC;AAE/C,CAAC"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const get_coerce_array_literal_form_object_literal_1 = require("./get-coerce-array-literal-form-object-literal");
|
|
6
|
-
const add_provider_to_array_1 = require("./add-provider-to-array");
|
|
7
|
-
function AddComponentProvider(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
1
|
+
import { GetComponentOptionsObject } from './get-component-options-object';
|
|
2
|
+
import { GetCoerceArrayLiteralFromObjectLiteral } from './get-coerce-array-literal-form-object-literal';
|
|
3
|
+
import { AddProviderToArray } from './add-provider-to-array';
|
|
4
|
+
export function AddComponentProvider(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
8
5
|
sourceFile.addImportDeclarations(structures);
|
|
9
|
-
const componentOptions =
|
|
10
|
-
const providersArray =
|
|
11
|
-
|
|
6
|
+
const componentOptions = GetComponentOptionsObject(sourceFile);
|
|
7
|
+
const providersArray = GetCoerceArrayLiteralFromObjectLiteral(componentOptions, 'providers');
|
|
8
|
+
AddProviderToArray(providerObject, providersArray, overwrite);
|
|
12
9
|
}
|
|
13
|
-
exports.AddComponentProvider = AddComponentProvider;
|
|
14
10
|
//# sourceMappingURL=add-component-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-component-provider.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-component-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-component-provider.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-component-provider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;AAExG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,UAAU,oBAAoB,CAClC,UAAsB,EACtB,cAAuC,EACvC,aAAsE,EAAE,EACxE,YAAsE,KAAK;IAG3E,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAE7C,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAE/D,MAAM,cAAc,GAAG,sCAAsC,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;IAE7F,kBAAkB,CAAC,cAAc,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;AAEhE,CAAC"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.AddControlValidator = exports.DefaultAddControlValidatorCompare = void 0;
|
|
4
|
-
const ts_morph_1 = require("ts-morph");
|
|
5
|
-
function DefaultAddControlValidatorCompare(a, b) {
|
|
1
|
+
import { ArrayLiteralExpression, PropertyAssignment } from 'ts-morph';
|
|
2
|
+
export function DefaultAddControlValidatorCompare(a, b) {
|
|
6
3
|
return a.trim().replace(/[\r\n\t]/g, '') === b.trim().replace(/[\r\n\t]/g, '');
|
|
7
4
|
}
|
|
8
|
-
|
|
9
|
-
function AddControlValidator(validator, controlOptions, compareFn = DefaultAddControlValidatorCompare) {
|
|
5
|
+
export function AddControlValidator(validator, controlOptions, compareFn = DefaultAddControlValidatorCompare) {
|
|
10
6
|
let validatorPropertyAssignment = controlOptions.getProperty('validators');
|
|
11
7
|
if (!validatorPropertyAssignment) {
|
|
12
8
|
validatorPropertyAssignment = controlOptions.addPropertyAssignment({
|
|
@@ -14,11 +10,11 @@ function AddControlValidator(validator, controlOptions, compareFn = DefaultAddCo
|
|
|
14
10
|
initializer: '[]'
|
|
15
11
|
});
|
|
16
12
|
}
|
|
17
|
-
if (!(validatorPropertyAssignment instanceof
|
|
13
|
+
if (!(validatorPropertyAssignment instanceof PropertyAssignment)) {
|
|
18
14
|
throw new Error('The validator property is not a assignment type!');
|
|
19
15
|
}
|
|
20
16
|
const validatorProperty = validatorPropertyAssignment.getInitializer();
|
|
21
|
-
if (validatorProperty instanceof
|
|
17
|
+
if (validatorProperty instanceof ArrayLiteralExpression) {
|
|
22
18
|
const index = validatorProperty
|
|
23
19
|
.getElements()
|
|
24
20
|
.findIndex(element => compareFn(element.getFullText(), validator));
|
|
@@ -31,5 +27,4 @@ function AddControlValidator(validator, controlOptions, compareFn = DefaultAddCo
|
|
|
31
27
|
}
|
|
32
28
|
}
|
|
33
29
|
}
|
|
34
|
-
exports.AddControlValidator = AddControlValidator;
|
|
35
30
|
//# sourceMappingURL=add-control-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-control-validator.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-control-validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-control-validator.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-control-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAA2B,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE/F,MAAM,UAAU,iCAAiC,CAAC,CAAS,EAAE,CAAS;IACpE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,SAAiB,EACjB,cAAuC,EACvC,YAA+C,iCAAiC;IAGhF,IAAI,2BAA2B,GAAG,cAAc,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAE3E,IAAI,CAAC,2BAA2B,EAAE;QAChC,2BAA2B,GAAG,cAAc,CAAC,qBAAqB,CAAC;YACjE,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;KACJ;IAED,IAAI,CAAC,CAAC,2BAA2B,YAAY,kBAAkB,CAAC,EAAE;QAChE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;KACrE;IAED,MAAM,iBAAiB,GAAG,2BAA2B,CAAC,cAAc,EAAE,CAAC;IAEvE,IAAI,iBAAiB,YAAY,sBAAsB,EAAE;QACvD,MAAM,KAAK,GAAG,iBAAiB;aAC5B,WAAW,EAAE;aACb,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;QACrE,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YAChB,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;SACzC;aAAM;YACL,iBAAiB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACvC,iBAAiB,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;SACnD;KACF;AAEH,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ts_morph_1 = require("ts-morph");
|
|
5
|
-
const coerce_class_constructor_1 = require("./coerce-class-constructor");
|
|
6
|
-
var Module;
|
|
1
|
+
import { Scope, Writers } from 'ts-morph';
|
|
2
|
+
import { CoerceClassConstructor } from './coerce-class-constructor';
|
|
3
|
+
export var Module;
|
|
7
4
|
(function (Module) {
|
|
8
5
|
Module["ANGULAR"] = "@angular/core";
|
|
9
6
|
Module["NEST"] = "@nestjs/common";
|
|
10
|
-
})(Module
|
|
11
|
-
function AddDependencyInjection(sourceFile, definition, structures = []) {
|
|
7
|
+
})(Module || (Module = {}));
|
|
8
|
+
export function AddDependencyInjection(sourceFile, definition, structures = []) {
|
|
12
9
|
var _a, _b, _c, _d;
|
|
13
10
|
if (!definition.module) {
|
|
14
11
|
definition.module = Module.ANGULAR;
|
|
@@ -17,7 +14,7 @@ function AddDependencyInjection(sourceFile, definition, structures = []) {
|
|
|
17
14
|
if (!classDeclaration) {
|
|
18
15
|
throw new Error('Could not find class declaration');
|
|
19
16
|
}
|
|
20
|
-
const constructorDeclarations =
|
|
17
|
+
const constructorDeclarations = CoerceClassConstructor(classDeclaration);
|
|
21
18
|
const constructorDeclaration = constructorDeclarations[0];
|
|
22
19
|
if (constructorDeclaration.getParameter(definition.parameterName)) {
|
|
23
20
|
return;
|
|
@@ -25,7 +22,7 @@ function AddDependencyInjection(sourceFile, definition, structures = []) {
|
|
|
25
22
|
const constructorParameter = {
|
|
26
23
|
name: definition.parameterName,
|
|
27
24
|
type: (_a = definition.type) !== null && _a !== void 0 ? _a : definition.injectionToken,
|
|
28
|
-
scope: (_b = definition.scope) !== null && _b !== void 0 ? _b :
|
|
25
|
+
scope: (_b = definition.scope) !== null && _b !== void 0 ? _b : Scope.Public,
|
|
29
26
|
isReadonly: true,
|
|
30
27
|
decorators: [
|
|
31
28
|
{
|
|
@@ -39,7 +36,7 @@ function AddDependencyInjection(sourceFile, definition, structures = []) {
|
|
|
39
36
|
name: 'Optional',
|
|
40
37
|
arguments: [],
|
|
41
38
|
});
|
|
42
|
-
constructorParameter.type =
|
|
39
|
+
constructorParameter.type = Writers.intersectionType((_d = definition.type) !== null && _d !== void 0 ? _d : definition.injectionToken, 'null');
|
|
43
40
|
sourceFile.addImportDeclaration({
|
|
44
41
|
namedImports: ['Optional'],
|
|
45
42
|
moduleSpecifier: definition.module,
|
|
@@ -52,5 +49,4 @@ function AddDependencyInjection(sourceFile, definition, structures = []) {
|
|
|
52
49
|
});
|
|
53
50
|
sourceFile.addImportDeclarations(structures);
|
|
54
51
|
}
|
|
55
|
-
exports.AddDependencyInjection = AddDependencyInjection;
|
|
56
52
|
//# sourceMappingURL=add-dependency-injection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-dependency-injection.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-dependency-injection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-dependency-injection.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-dependency-injection.ts"],"names":[],"mappings":"AAAA,O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,UAAU;YAChB,SAAS,EAAE,EAAE;SACd,CAAC,CAAC;QACH,oBAAoB,CAAC,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAClD,MAAA,UAAU,CAAC,IAAI,mCAAI,UAAU,CAAC,cAAc,EAC5C,MAAM,CACP,CAAC;QACF,UAAU,CAAC,oBAAoB,CAAC;YAC9B,YAAY,EAAE,CAAE,UAAU,CAAE;YAC5B,eAAe,EAAE,UAAU,CAAC,MAAM;SACnC,CAAC,CAAC;KACJ;IAED,sBAAsB,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAE1D,UAAU,CAAC,oBAAoB,CAAC;QAC9B,YAAY,EAAE,CAAE,QAAQ,CAAE;QAC1B,eAAe,EAAE,UAAU,CAAC,MAAM;KACnC,CAAC,CAAC;IAEH,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;AAC/C,CAAC"}
|
package/src/lib/add-dir.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AddDir = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
1
|
+
import { join } from 'path';
|
|
5
2
|
/**
|
|
6
3
|
* Adds all files recursively from a specify DirEntry to the project.
|
|
7
4
|
* @param dir A schematic DirEntry instance
|
|
@@ -9,11 +6,11 @@ const path_1 = require("path");
|
|
|
9
6
|
* @param parentPath The base dir for the sourceFiles in the ts-morph Project
|
|
10
7
|
* @param filter A filter function base on the pathFragment and dirEntry
|
|
11
8
|
*/
|
|
12
|
-
function AddDir(dir, project, parentPath = '', filter = pathFragment => !!pathFragment.match(/\.ts$/)) {
|
|
9
|
+
export function AddDir(dir, project, parentPath = '', filter = pathFragment => !!pathFragment.match(/\.ts$/)) {
|
|
13
10
|
for (const pathFragment of dir.subfiles.filter(pf => filter(pf, dir))) {
|
|
14
11
|
const fileEntry = dir.file(pathFragment);
|
|
15
12
|
if (fileEntry) {
|
|
16
|
-
const filePath =
|
|
13
|
+
const filePath = join(parentPath, pathFragment);
|
|
17
14
|
if (!project.getSourceFile(filePath)) {
|
|
18
15
|
project.createSourceFile(filePath, fileEntry.content.toString('utf-8'));
|
|
19
16
|
}
|
|
@@ -25,12 +22,11 @@ function AddDir(dir, project, parentPath = '', filter = pathFragment => !!pathFr
|
|
|
25
22
|
for (const pathFragment of dir.subdirs) {
|
|
26
23
|
const dirEntry = dir.dir(pathFragment);
|
|
27
24
|
if (dirEntry) {
|
|
28
|
-
AddDir(dirEntry, project,
|
|
25
|
+
AddDir(dirEntry, project, join(parentPath, pathFragment), filter);
|
|
29
26
|
}
|
|
30
27
|
else {
|
|
31
28
|
throw new Error('The path fragment does not point to a dir entry');
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
|
-
exports.AddDir = AddDir;
|
|
36
32
|
//# sourceMappingURL=add-dir.js.map
|
package/src/lib/add-dir.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-dir.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-dir.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-dir.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-dir.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,GAAa,EAAE,OAAgB,EAAE,aAAqB,EAAE,EAAE,SAAkE,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9L,KAAK,MAAM,YAAY,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE;QACrE,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzC,IAAI,SAAS,EAAE;YACb,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;YAChD,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;gBACpC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;aACzE;SACF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACrE;KACF;IACD,KAAK,MAAM,YAAY,IAAI,GAAG,CAAC,OAAO,EAAE;QACtC,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACvC,IAAI,QAAQ,EAAE;YACZ,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;SACnE;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACpE;KACF;AACH,CAAC"}
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const coerce_variable_declaration_1 = require("./coerce-variable-declaration");
|
|
7
|
-
const add_provider_to_array_1 = require("./add-provider-to-array");
|
|
8
|
-
function AddFakeProvider(sourceFile, fakeProviderObject, realProviderObject, fakeName, overwrite = false) {
|
|
1
|
+
import { GetArrayDeclaration } from './get-array-declaration';
|
|
2
|
+
import { AssertArrayLiteralExpression } from './is-array-literal-expression';
|
|
3
|
+
import { CoerceVariableDeclaration } from './coerce-variable-declaration';
|
|
4
|
+
import { AddProviderToArray } from './add-provider-to-array';
|
|
5
|
+
export function AddFakeProvider(sourceFile, fakeProviderObject, realProviderObject, fakeName, overwrite = false) {
|
|
9
6
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10
7
|
const hasFakeProviderFactory = !!sourceFile.getVariableStatement('FAKE_PROVIDER_FACTORY');
|
|
11
|
-
|
|
8
|
+
CoerceVariableDeclaration(sourceFile, 'FAKE_PROVIDER_FACTORY', {
|
|
12
9
|
initializer: `IsFaked('${fakeName}') ? FAKE_PROVIDERS : REAL_PROVIDERS`
|
|
13
10
|
});
|
|
14
|
-
const fakeArrayDeclaration =
|
|
15
|
-
const realArrayDeclaration =
|
|
11
|
+
const fakeArrayDeclaration = GetArrayDeclaration(sourceFile, 'FAKE_PROVIDERS', 'Provider[]');
|
|
12
|
+
const realArrayDeclaration = GetArrayDeclaration(sourceFile, 'REAL_PROVIDERS', 'Provider[]');
|
|
16
13
|
const fakeArrayInitializer = fakeArrayDeclaration.getInitializer();
|
|
17
|
-
|
|
14
|
+
AssertArrayLiteralExpression(fakeArrayInitializer, 'FAKE_PROVIDERS');
|
|
18
15
|
if (fakeProviderObject) {
|
|
19
|
-
|
|
16
|
+
AddProviderToArray(fakeProviderObject, fakeArrayInitializer, overwrite);
|
|
20
17
|
}
|
|
21
18
|
const realArrayInitializer = realArrayDeclaration.getInitializer();
|
|
22
|
-
|
|
19
|
+
AssertArrayLiteralExpression(realArrayInitializer, 'REAL_PROVIDERS');
|
|
23
20
|
if (realProviderObject) {
|
|
24
|
-
|
|
21
|
+
AddProviderToArray(realProviderObject, realArrayInitializer, overwrite);
|
|
25
22
|
}
|
|
26
23
|
sourceFile.addImportDeclaration({
|
|
27
24
|
moduleSpecifier: '@angular/core',
|
|
@@ -41,5 +38,4 @@ function AddFakeProvider(sourceFile, fakeProviderObject, realProviderObject, fak
|
|
|
41
38
|
}
|
|
42
39
|
// endregion
|
|
43
40
|
}
|
|
44
|
-
exports.AddFakeProvider = AddFakeProvider;
|
|
45
41
|
//# sourceMappingURL=add-fake-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-fake-provider.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-fake-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-fake-provider.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-fake-provider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,UAAU,eAAe,CAC7B,UAAsB,EACtB,kBAAuD,EACvD,kBAAuD,EACvD,QAAgB,EAChB,YAAqB,KAAK;;IAG1B,MAAM,sBAAsB,GAAG,CAAC,CAAC,UAAU,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;IAE1F,yBAAyB,CACvB,UAAU,EACV,uBAAuB,EACvB;QACE,WAAW,EAAE,YAAY,QAAQ,sCAAsC;KACxE,CACF,CAAC;IAEF,MAAM,oBAAoB,GAAG,mBAAmB,CAC9C,UAAU,EACV,gBAAgB,EAChB,YAAY,CACb,CAAC;IAEF,MAAM,oBAAoB,GAAG,mBAAmB,CAC9C,UAAU,EACV,gBAAgB,EAChB,YAAY,CACb,CAAC;IAEF,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,cAAc,EAAE,CAAC;IAEnE,4BAA4B,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC;IAErE,IAAI,kBAAkB,EAAE;QACtB,kBAAkB,CAChB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,CACV,CAAC;KACH;IAED,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,cAAc,EAAE,CAAC;IAEnE,4BAA4B,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC;IAErE,IAAI,kBAAkB,EAAE;QACtB,kBAAkB,CAChB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,CACV,CAAC;KACH;IAED,UAAU,CAAC,oBAAoB,CAAC;QAC9B,eAAe,EAAE,eAAe;QAChC,YAAY,EAAK,CAAE,UAAU,CAAE;KAChC,CAAC,CAAC;IACH,UAAU,CAAC,oBAAoB,CAAC;QAC9B,eAAe,EAAE,YAAY;QAC7B,YAAY,EAAK,CAAE,SAAS,CAAE;KAC/B,CAAC,CAAC;IAEH,mCAAmC;IAEnC,0EAA0E;IAC1E,IAAI,CAAC,sBAAsB,EAAE;QAC3B,wDAAwD;QACxD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CACzB,MAAA,MAAA,UAAU,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,0CAAE,aAAa,EAAE,mCAAI,CAAC,EAC9E,MAAA,MAAA,UAAU,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,0CAAE,aAAa,EAAE,mCAAI,CAAC,EACvE,MAAA,MAAA,UAAU,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,0CAAE,aAAa,EAAE,mCAAI,CAAC,CACxE,CAAC;QACF,MAAA,UAAU,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,0CAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC/E,MAAA,UAAU,CAAC,UAAU,EAAE,CAAE,CAAC,CAAE,0CAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;KACpD;IAED,YAAY;AAEd,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ts_morph_1 = require("ts-morph");
|
|
5
|
-
const utilities_1 = require("@rxap/utilities");
|
|
6
|
-
exports.DEFAULT_ADD_METHOD_CLASS_OPTIONS = {
|
|
1
|
+
import { Scope } from 'ts-morph';
|
|
2
|
+
import { CoerceSuffix } from '@rxap/schematics-utilities';
|
|
3
|
+
export const DEFAULT_ADD_METHOD_CLASS_OPTIONS = {
|
|
7
4
|
structures: [],
|
|
8
5
|
returnType: 'any',
|
|
9
6
|
parameterType: 'any',
|
|
@@ -14,10 +11,10 @@ exports.DEFAULT_ADD_METHOD_CLASS_OPTIONS = {
|
|
|
14
11
|
decorators: [],
|
|
15
12
|
ctors: [],
|
|
16
13
|
};
|
|
17
|
-
function AddMethodClass(sourceFile, name, options = {}) {
|
|
14
|
+
export function AddMethodClass(sourceFile, name, options = {}) {
|
|
18
15
|
var _a, _b;
|
|
19
|
-
const parameters = Object.assign({},
|
|
20
|
-
name =
|
|
16
|
+
const parameters = Object.assign({}, DEFAULT_ADD_METHOD_CLASS_OPTIONS, options);
|
|
17
|
+
name = CoerceSuffix(name, 'Method');
|
|
21
18
|
const decorators = (_a = options.decorators) !== null && _a !== void 0 ? _a : [];
|
|
22
19
|
if (!decorators.some(d => d.name === 'Injectable')) {
|
|
23
20
|
decorators.push({
|
|
@@ -39,7 +36,7 @@ function AddMethodClass(sourceFile, name, options = {}) {
|
|
|
39
36
|
{
|
|
40
37
|
name: 'call',
|
|
41
38
|
isAsync: parameters.isAsync,
|
|
42
|
-
scope:
|
|
39
|
+
scope: Scope.Public,
|
|
43
40
|
parameters: [{ name: 'parameters', type: parameters.parameterType }],
|
|
44
41
|
returnType: parameters.isAsync ? `Promise<${parameters.returnType}>` : parameters.returnType,
|
|
45
42
|
statements: (_b = parameters.statements) !== null && _b !== void 0 ? _b : []
|
|
@@ -58,5 +55,4 @@ function AddMethodClass(sourceFile, name, options = {}) {
|
|
|
58
55
|
]);
|
|
59
56
|
sourceFile.addImportDeclarations(parameters.structures);
|
|
60
57
|
}
|
|
61
|
-
exports.AddMethodClass = AddMethodClass;
|
|
62
58
|
//# sourceMappingURL=add-method-class.js.map
|