@rxap/schematics-ts-morph 12.3.0 → 13.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/package.json +4 -4
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/add-component-input.js +55 -52
- package/src/lib/add-component-input.js.map +1 -1
- package/src/lib/coerce-property-key.d.ts +1 -0
- package/src/lib/coerce-property-key.js +17 -0
- package/src/lib/coerce-property-key.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,54 @@
|
|
|
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.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
|
+
|
|
8
|
+
|
|
9
|
+
### Build System
|
|
10
|
+
|
|
11
|
+
* upgrade to nrwl 13.x.x ([5cd07c1](https://gitlab.com/rxap/packages/commit/5cd07c19645528c787ef01a121a4a4367db78902))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* update the core nrwl packages to 13.x.x
|
|
17
|
+
|
|
18
|
+
Signed-off-by: Merzough Münker <mmuenker@digitaix.com>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [12.3.2](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@12.3.2-next.0...@rxap/schematics-ts-morph@12.3.2) (2021-10-07)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @rxap/schematics-ts-morph
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## [12.3.2-next.0](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@12.3.1...@rxap/schematics-ts-morph@12.3.2-next.0) (2021-09-16)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* check if constructor exists ([851e29d](https://gitlab.com/rxap/packages/commit/851e29d502836e4575c206bbfec9fb7b842ecbb0))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [12.3.1](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@12.3.0...@rxap/schematics-ts-morph@12.3.1) (2021-08-02)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
* add coerce-property-key.ts method ([81896bd](https://gitlab.com/rxap/packages/commit/81896bd06602eb77d088e8231eaeff3b3ffffc32))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
6
54
|
# [12.3.0](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@12.3.0-next.1...@rxap/schematics-ts-morph@12.3.0) (2021-07-22)
|
|
7
55
|
|
|
8
56
|
**Note:** Version bump only for package @rxap/schematics-ts-morph
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxap/schematics-ts-morph",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0-next.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@rxap/utilities": "^12.2.
|
|
6
|
-
"tslib": "^2.
|
|
5
|
+
"@rxap/utilities": "^12.2.2",
|
|
6
|
+
"tslib": "^2.3.1"
|
|
7
7
|
},
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"directory": "../../dist/libs/ts-morph",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"migrations": "./migration.json"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"ts-morph": "^
|
|
38
|
+
"ts-morph": "^13.0.3"
|
|
39
39
|
},
|
|
40
40
|
"typings": "./src/index.d.ts"
|
|
41
41
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export * from './lib/coerce-class-constructor';
|
|
|
40
40
|
export * from './lib/add-dependency-injection';
|
|
41
41
|
export * from './lib/coerce-class-method';
|
|
42
42
|
export * from './lib/merge-ts-morph-project';
|
|
43
|
+
export * from './lib/coerce-property-key';
|
|
43
44
|
export * from './lib/nestjs/add-nest-controller';
|
|
44
45
|
export * from './lib/nestjs/add-nest-module-controller';
|
|
45
46
|
export * from './lib/nestjs/add-nest-module-import';
|
package/src/index.js
CHANGED
|
@@ -43,6 +43,7 @@ tslib_1.__exportStar(require("./lib/coerce-class-constructor"), exports);
|
|
|
43
43
|
tslib_1.__exportStar(require("./lib/add-dependency-injection"), exports);
|
|
44
44
|
tslib_1.__exportStar(require("./lib/coerce-class-method"), exports);
|
|
45
45
|
tslib_1.__exportStar(require("./lib/merge-ts-morph-project"), exports);
|
|
46
|
+
tslib_1.__exportStar(require("./lib/coerce-property-key"), exports);
|
|
46
47
|
// region nestjs
|
|
47
48
|
tslib_1.__exportStar(require("./lib/nestjs/add-nest-controller"), exports);
|
|
48
49
|
tslib_1.__exportStar(require("./lib/nestjs/add-nest-module-controller"), exports);
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/ts-morph/src/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,6DAAmC;AACnC,+EAAqD;AACrD,oEAA0C;AAC1C,mEAAyC;AACzC,wDAA8B;AAC9B,uEAA6C;AAC7C,4DAAkC;AAClC,oEAA0C;AAC1C,sEAA4C;AAC5C,sEAA4C;AAC5C,4EAAkD;AAClD,yEAA+C;AAC/C,uEAA6C;AAC7C,iEAAuC;AACvC,oEAA0C;AAC1C,oEAA0C;AAC1C,4EAAkD;AAClD,iEAAuC;AACvC,oEAA0C;AAC1C,mEAAyC;AACzC,kEAAwC;AACxC,2EAAiD;AACjD,6DAAmC;AACnC,gEAAsC;AACtC,iEAAuC;AACvC,yEAA+C;AAC/C,qEAA2C;AAC3C,uEAA6C;AAC7C,kFAAwD;AACxD,2EAAiD;AACjD,oEAA0C;AAC1C,6FAAmE;AACnE,6EAAmD;AACnD,6EAAmD;AACnD,iEAAuC;AACvC,wEAA8C;AAC9C,8EAAoD;AACpD,yEAA+C;AAC/C,yEAA+C;AAC/C,oEAA0C;AAC1C,uEAA6C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/ts-morph/src/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,6DAAmC;AACnC,+EAAqD;AACrD,oEAA0C;AAC1C,mEAAyC;AACzC,wDAA8B;AAC9B,uEAA6C;AAC7C,4DAAkC;AAClC,oEAA0C;AAC1C,sEAA4C;AAC5C,sEAA4C;AAC5C,4EAAkD;AAClD,yEAA+C;AAC/C,uEAA6C;AAC7C,iEAAuC;AACvC,oEAA0C;AAC1C,oEAA0C;AAC1C,4EAAkD;AAClD,iEAAuC;AACvC,oEAA0C;AAC1C,mEAAyC;AACzC,kEAAwC;AACxC,2EAAiD;AACjD,6DAAmC;AACnC,gEAAsC;AACtC,iEAAuC;AACvC,yEAA+C;AAC/C,qEAA2C;AAC3C,uEAA6C;AAC7C,kFAAwD;AACxD,2EAAiD;AACjD,oEAA0C;AAC1C,6FAAmE;AACnE,6EAAmD;AACnD,6EAAmD;AACnD,iEAAuC;AACvC,wEAA8C;AAC9C,8EAAoD;AACpD,yEAA+C;AAC/C,yEAA+C;AAC/C,oEAA0C;AAC1C,uEAA6C;AAC7C,oEAA0C;AAE1C,gBAAgB;AAEhB,2EAAiD;AACjD,kFAAwD;AACxD,8EAAoD;AACpD,gFAAsD;AACtD,kFAAwD;AACxD,oFAA0D;AAC1D,oFAA0D;AAC1D,gFAAsD;AACtD,6EAAmD;AACnD,4EAAkD;AAClD,4EAAkD;AAElD,YAAY"}
|
|
@@ -5,65 +5,68 @@ const ts_morph_1 = require("ts-morph");
|
|
|
5
5
|
const get_component_class_1 = require("./get-component-class");
|
|
6
6
|
function AddComponentInput(sourceFile, componentInputDefinition, structures = []) {
|
|
7
7
|
const componentClass = get_component_class_1.GetComponentClass(sourceFile);
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
8
|
+
if (!componentClass.getConstructors().some(cotr => cotr.getParameters()
|
|
9
|
+
.some(param => !!param.getScope() && param.getName() === componentInputDefinition.name))) {
|
|
10
|
+
if (componentInputDefinition.setAccessor) {
|
|
11
|
+
if (!componentClass.getSetAccessor(componentInputDefinition.name)) {
|
|
12
|
+
componentClass.addSetAccessor({
|
|
13
|
+
name: componentInputDefinition.name,
|
|
14
|
+
scope: ts_morph_1.Scope.Public,
|
|
15
|
+
parameters: [
|
|
16
|
+
{
|
|
17
|
+
name: componentInputDefinition.name,
|
|
18
|
+
type: componentInputDefinition.type,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
docs: componentInputDefinition.docs,
|
|
22
|
+
statements: [
|
|
23
|
+
`this._${componentInputDefinition.name} = ${componentInputDefinition.name};`,
|
|
24
|
+
],
|
|
25
|
+
decorators: [
|
|
26
|
+
{
|
|
27
|
+
name: 'Input',
|
|
28
|
+
arguments: componentInputDefinition.selector ? [componentInputDefinition.selector] : [],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
if (!componentClass.getProperty('_' + componentInputDefinition.name)) {
|
|
33
|
+
componentClass.addProperty({
|
|
34
|
+
name: '_' + componentInputDefinition.name,
|
|
35
|
+
scope: ts_morph_1.Scope.Private,
|
|
36
|
+
type: componentInputDefinition.type,
|
|
37
|
+
initializer: componentInputDefinition.initializer,
|
|
38
|
+
hasQuestionToken: !componentInputDefinition.initializer && !componentInputDefinition.required,
|
|
39
|
+
hasExclamationToken: !componentInputDefinition.initializer && componentInputDefinition.required,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
sourceFile.addImportDeclaration({
|
|
43
|
+
namedImports: ['Input'],
|
|
44
|
+
moduleSpecifier: '@angular/core',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
if (!componentClass.getProperty(componentInputDefinition.name)) {
|
|
31
50
|
componentClass.addProperty({
|
|
32
|
-
name:
|
|
33
|
-
scope: ts_morph_1.Scope.
|
|
51
|
+
name: componentInputDefinition.name,
|
|
52
|
+
scope: ts_morph_1.Scope.Public,
|
|
34
53
|
type: componentInputDefinition.type,
|
|
35
54
|
initializer: componentInputDefinition.initializer,
|
|
36
55
|
hasQuestionToken: !componentInputDefinition.initializer && !componentInputDefinition.required,
|
|
37
56
|
hasExclamationToken: !componentInputDefinition.initializer && componentInputDefinition.required,
|
|
57
|
+
docs: componentInputDefinition.docs,
|
|
58
|
+
decorators: [
|
|
59
|
+
{
|
|
60
|
+
name: 'Input',
|
|
61
|
+
arguments: componentInputDefinition.selector ? [componentInputDefinition.selector] : [],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
});
|
|
65
|
+
sourceFile.addImportDeclaration({
|
|
66
|
+
namedImports: ['Input'],
|
|
67
|
+
moduleSpecifier: '@angular/core',
|
|
38
68
|
});
|
|
39
69
|
}
|
|
40
|
-
sourceFile.addImportDeclaration({
|
|
41
|
-
namedImports: ['Input'],
|
|
42
|
-
moduleSpecifier: '@angular/core'
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
if (!componentClass.getProperty(componentInputDefinition.name)) {
|
|
48
|
-
componentClass.addProperty({
|
|
49
|
-
name: componentInputDefinition.name,
|
|
50
|
-
scope: ts_morph_1.Scope.Public,
|
|
51
|
-
type: componentInputDefinition.type,
|
|
52
|
-
initializer: componentInputDefinition.initializer,
|
|
53
|
-
hasQuestionToken: !componentInputDefinition.initializer && !componentInputDefinition.required,
|
|
54
|
-
hasExclamationToken: !componentInputDefinition.initializer && componentInputDefinition.required,
|
|
55
|
-
docs: componentInputDefinition.docs,
|
|
56
|
-
decorators: [
|
|
57
|
-
{
|
|
58
|
-
name: 'Input',
|
|
59
|
-
arguments: componentInputDefinition.selector ? [componentInputDefinition.selector] : []
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
});
|
|
63
|
-
sourceFile.addImportDeclaration({
|
|
64
|
-
namedImports: ['Input'],
|
|
65
|
-
moduleSpecifier: '@angular/core'
|
|
66
|
-
});
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
sourceFile.addImportDeclarations(structures);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-component-input.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-component-input.ts"],"names":[],"mappings":";;;AAAA,uCAAuH;AACvH,+DAA0D;AAY1D,SAAgB,iBAAiB,CAC/B,UAAsB,EACtB,wBAAkD,EAClD,aAAsE,EAAE;IAGxE,MAAM,cAAc,GAAG,uCAAiB,CAAC,UAAU,CAAC,CAAC;IAErD,IAAI,wBAAwB,CAAC,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"add-component-input.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/add-component-input.ts"],"names":[],"mappings":";;;AAAA,uCAAuH;AACvH,+DAA0D;AAY1D,SAAgB,iBAAiB,CAC/B,UAAsB,EACtB,wBAAkD,EAClD,aAAsE,EAAE;IAGxE,MAAM,cAAc,GAAG,uCAAiB,CAAC,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|
|
1
|
+
export declare function CoercePropertyKey(key: string, drop?: boolean): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoercePropertyKey = void 0;
|
|
4
|
+
function CoercePropertyKey(key, drop = false) {
|
|
5
|
+
if (key.match(/(^[0-9]+|-|#|\.|@|\/|:|\*)/) &&
|
|
6
|
+
!key.match(/\[\w+:\s?\w+\]/)) {
|
|
7
|
+
if (drop) {
|
|
8
|
+
return key.replace(/(^[0-9]+|-|#|\.|@|\/|:|\*)/g, '');
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return `'${key}'`;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return key;
|
|
15
|
+
}
|
|
16
|
+
exports.CoercePropertyKey = CoercePropertyKey;
|
|
17
|
+
//# sourceMappingURL=coerce-property-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coerce-property-key.js","sourceRoot":"","sources":["../../../../../libs/ts-morph/src/lib/coerce-property-key.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,CAAC,GAAW,EAAE,OAAgB,KAAK;IAClE,IACE,GAAG,CAAC,KAAK,CAAC,4BAA4B,CAAC;QACvC,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAC5B;QACA,IAAI,IAAI,EAAE;YACR,OAAO,GAAG,CAAC,OAAO,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;SACvD;aAAM;YACL,OAAO,IAAI,GAAG,GAAG,CAAC;SACnB;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAZD,8CAYC"}
|