kea-typegen 1.2.2 → 1.4.2
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 +77 -33
- package/dist/package.json +18 -17
- package/dist/src/__tests__/e2e/actions.js +4 -4
- package/dist/src/__tests__/e2e/actions.js.map +1 -1
- package/dist/src/__tests__/e2e/connect.js +6 -6
- package/dist/src/__tests__/e2e/connect.js.map +1 -1
- package/dist/src/__tests__/e2e/loaders.js +3 -3
- package/dist/src/__tests__/e2e/loaders.js.map +1 -1
- package/dist/src/__tests__/e2e/reducers.js +4 -4
- package/dist/src/__tests__/e2e/reducers.js.map +1 -1
- package/dist/src/__tests__/e2e/selectors.js +3 -3
- package/dist/src/__tests__/e2e/selectors.js.map +1 -1
- package/dist/src/__tests__/utils.js +7 -7
- package/dist/src/__tests__/utils.js.map +1 -1
- package/dist/src/cli/typegen.js +35 -9
- package/dist/src/cli/typegen.js.map +1 -1
- package/dist/src/print/print.d.ts +5 -5
- package/dist/src/print/print.js +68 -44
- package/dist/src/print/print.js.map +1 -1
- package/dist/src/print/printActionCreators.d.ts +1 -2
- package/dist/src/print/printActionCreators.js +7 -7
- package/dist/src/print/printActionCreators.js.map +1 -1
- package/dist/src/print/printActionKeys.d.ts +1 -2
- package/dist/src/print/printActionKeys.js +4 -4
- package/dist/src/print/printActionKeys.js.map +1 -1
- package/dist/src/print/printActionTypes.d.ts +1 -2
- package/dist/src/print/printActionTypes.js +4 -4
- package/dist/src/print/printActionTypes.js.map +1 -1
- package/dist/src/print/printActions.d.ts +1 -2
- package/dist/src/print/printActions.js +4 -4
- package/dist/src/print/printActions.js.map +1 -1
- package/dist/src/print/printConstants.d.ts +1 -2
- package/dist/src/print/printConstants.js +2 -2
- package/dist/src/print/printConstants.js.map +1 -1
- package/dist/src/print/printDefaults.d.ts +1 -2
- package/dist/src/print/printDefaults.js +3 -3
- package/dist/src/print/printDefaults.js.map +1 -1
- package/dist/src/print/printEvents.d.ts +1 -2
- package/dist/src/print/printEvents.js +3 -3
- package/dist/src/print/printEvents.js.map +1 -1
- package/dist/src/print/printInternalExtraInput.d.ts +1 -2
- package/dist/src/print/printInternalExtraInput.js +8 -8
- package/dist/src/print/printInternalExtraInput.js.map +1 -1
- package/dist/src/print/printInternalReducerActions.d.ts +1 -2
- package/dist/src/print/printInternalReducerActions.js +3 -4
- package/dist/src/print/printInternalReducerActions.js.map +1 -1
- package/dist/src/print/printInternalSelectorTypes.d.ts +1 -2
- package/dist/src/print/printInternalSelectorTypes.js +3 -3
- package/dist/src/print/printInternalSelectorTypes.js.map +1 -1
- package/dist/src/print/printKey.d.ts +1 -2
- package/dist/src/print/printKey.js +2 -2
- package/dist/src/print/printKey.js.map +1 -1
- package/dist/src/print/printListeners.d.ts +1 -2
- package/dist/src/print/printListeners.js +9 -9
- package/dist/src/print/printListeners.js.map +1 -1
- package/dist/src/print/printProps.d.ts +1 -2
- package/dist/src/print/printProps.js +6 -5
- package/dist/src/print/printProps.js.map +1 -1
- package/dist/src/print/printReducer.d.ts +1 -2
- package/dist/src/print/printReducer.js +6 -6
- package/dist/src/print/printReducer.js.map +1 -1
- package/dist/src/print/printReducerOptions.d.ts +1 -2
- package/dist/src/print/printReducerOptions.js +3 -3
- package/dist/src/print/printReducerOptions.js.map +1 -1
- package/dist/src/print/printReducers.d.ts +1 -2
- package/dist/src/print/printReducers.js +7 -7
- package/dist/src/print/printReducers.js.map +1 -1
- package/dist/src/print/printSelector.d.ts +1 -2
- package/dist/src/print/printSelector.js +4 -4
- package/dist/src/print/printSelector.js.map +1 -1
- package/dist/src/print/printSelectors.d.ts +1 -2
- package/dist/src/print/printSelectors.js +6 -6
- package/dist/src/print/printSelectors.js.map +1 -1
- package/dist/src/print/printSharedListeners.d.ts +1 -2
- package/dist/src/print/printSharedListeners.js +11 -11
- package/dist/src/print/printSharedListeners.js.map +1 -1
- package/dist/src/print/printValues.d.ts +1 -2
- package/dist/src/print/printValues.js +3 -3
- package/dist/src/print/printValues.js.map +1 -1
- package/dist/src/typegen.js +5 -5
- package/dist/src/typegen.js.map +1 -1
- package/dist/src/types.d.ts +6 -0
- package/dist/src/utils.js +21 -18
- package/dist/src/utils.js.map +1 -1
- package/dist/src/visit/__tests__/visit.js +2 -2
- package/dist/src/visit/__tests__/visit.js.map +1 -1
- package/dist/src/visit/visit.js +22 -14
- package/dist/src/visit/visit.js.map +1 -1
- package/dist/src/visit/visitActions.d.ts +2 -2
- package/dist/src/visit/visitActions.js +13 -11
- package/dist/src/visit/visitActions.js.map +1 -1
- package/dist/src/visit/visitConnect.js +4 -4
- package/dist/src/visit/visitConnect.js.map +1 -1
- package/dist/src/visit/visitDefaults.js +1 -1
- package/dist/src/visit/visitDefaults.js.map +1 -1
- package/dist/src/visit/visitKey.js +2 -2
- package/dist/src/visit/visitKey.js.map +1 -1
- package/dist/src/visit/visitListeners.js +5 -5
- package/dist/src/visit/visitListeners.js.map +1 -1
- package/dist/src/visit/visitLoaders.d.ts +2 -2
- package/dist/src/visit/visitLoaders.js +27 -27
- package/dist/src/visit/visitLoaders.js.map +1 -1
- package/dist/src/visit/visitProps.js +1 -1
- package/dist/src/visit/visitProps.js.map +1 -1
- package/dist/src/visit/visitReducers.js +4 -4
- package/dist/src/visit/visitReducers.js.map +1 -1
- package/dist/src/visit/visitSelectors.js +8 -8
- package/dist/src/visit/visitSelectors.js.map +1 -1
- package/dist/src/visit/visitSharedListeners.js +5 -5
- package/dist/src/visit/visitSharedListeners.js.map +1 -1
- package/dist/src/visit/visitWindowValues.js +1 -1
- package/dist/src/visit/visitWindowValues.js.map +1 -1
- package/dist/src/write/write.d.ts +4 -0
- package/dist/src/{import/writeLogicTypeImports.js → write/write.js} +56 -11
- package/dist/src/write/write.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/form-plugin/lib/form-plugin/src/typegen.js +16 -15
- package/form-plugin/lib/src/types.d.ts +4 -1
- package/form-plugin/package.json +1 -1
- package/form-plugin/src/typegen.ts +25 -25
- package/form-plugin/tsconfig.json +0 -1
- package/form-plugin/yarn.lock +10 -10
- package/package.json +18 -17
- package/samples/.kearc +3 -0
- package/samples/autoImportLogic.ts +12 -3
- package/samples/autoImportLogicType.ts +7 -2
- package/samples/complexLogic.ts +4 -3
- package/samples/donotimport.ts +1 -0
- package/samples/githubConnectLogic.ts +1 -0
- package/samples/githubImportLogic.ts +1 -0
- package/samples/githubLogic.ts +1 -0
- package/samples/loadersLogic.ts +1 -0
- package/samples/pluginLogic.ts +2 -0
- package/samples/propsLogic.ts +1 -0
- package/samples/propsLogicType.ts +9 -9
- package/samples/windowValuesLogic.ts +1 -0
- package/src/__tests__/utils.ts +5 -5
- package/src/cli/typegen.ts +33 -7
- package/src/print/print.ts +95 -37
- package/src/print/printActionCreators.ts +12 -15
- package/src/print/printActionKeys.ts +5 -6
- package/src/print/printActionTypes.ts +6 -7
- package/src/print/printActions.ts +6 -13
- package/src/print/printConstants.ts +5 -6
- package/src/print/printDefaults.ts +5 -6
- package/src/print/printEvents.ts +8 -6
- package/src/print/printInternalExtraInput.ts +12 -13
- package/src/print/printInternalReducerActions.ts +5 -12
- package/src/print/printInternalSelectorTypes.ts +7 -8
- package/src/print/printKey.ts +2 -2
- package/src/print/printListeners.ts +16 -17
- package/src/print/printProps.ts +7 -7
- package/src/print/printReducer.ts +14 -15
- package/src/print/printReducerOptions.ts +4 -5
- package/src/print/printReducers.ts +13 -14
- package/src/print/printSelector.ts +8 -9
- package/src/print/printSelectors.ts +12 -13
- package/src/print/printSharedListeners.ts +20 -21
- package/src/print/printValues.ts +5 -6
- package/src/typegen.ts +4 -4
- package/src/types.ts +11 -1
- package/src/utils.ts +17 -17
- package/src/visit/visit.ts +11 -3
- package/src/visit/visitActions.ts +12 -10
- package/src/visit/visitListeners.ts +8 -8
- package/src/visit/visitLoaders.ts +49 -43
- package/src/visit/visitReducers.ts +1 -1
- package/src/visit/visitSelectors.ts +3 -3
- package/src/visit/visitSharedListeners.ts +8 -10
- package/src/{import/writeLogicTypeImports.ts → write/write.ts} +115 -16
- package/dist/src/import/writeLogicTypeImports.d.ts +0 -3
- package/dist/src/import/writeLogicTypeImports.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,82 +1,126 @@
|
|
|
1
|
+
## 1.4.2 - 2021-12-13
|
|
2
|
+
|
|
3
|
+
- Fix bug introduced with 1.4.1 if your `tsconfig.json` file does not contain a `types` array.
|
|
4
|
+
|
|
5
|
+
## 1.4.1 - 2021-12-12
|
|
6
|
+
|
|
7
|
+
- Adds new option, `ignoreImportPaths`, to specify a list of files or folders that typegen will never import from, when adding imports inside `logicType.ts` files.
|
|
8
|
+
- Automatically skips adding imports for global types, as specified via the `types` array in `tsconfig.json`. Each entry in the array (e.g. `node`) will add an import ignore path for `./node_modules/@types/node`. To revert this, set `"importGlobalTypes": true` inside `.kearc` or via the CLI.
|
|
9
|
+
|
|
10
|
+
## 1.4.0 - 2021-12-12
|
|
11
|
+
|
|
12
|
+
- Support TypeScript 4.5+.
|
|
13
|
+
- Now adds new type imports with `type`, such as: `import type { logicType } from './logicType`.
|
|
14
|
+
- Refactor internals to create nodes newer `ts.factory` methods.
|
|
15
|
+
|
|
16
|
+
## 1.3.0 - 2021-11-08
|
|
17
|
+
|
|
18
|
+
- Write paths into logics with `--write-paths`. Can be configured in `.kearc` with `writePaths: true`
|
|
19
|
+
|
|
1
20
|
## 1.2.2 - 2021-10-14
|
|
2
|
-
|
|
21
|
+
|
|
22
|
+
- Loaders: Make the `payload` parameter on the `Success` action optional.
|
|
3
23
|
|
|
4
24
|
## 1.2.1 - 2021-10-14
|
|
5
|
-
|
|
25
|
+
|
|
26
|
+
- Improve `kea-loaders` 0.5.0 support
|
|
6
27
|
|
|
7
28
|
## 1.2.0 - 2021-10-14
|
|
8
|
-
|
|
29
|
+
|
|
30
|
+
- Support `kea-loaders` 0.5.0, add `payload` to the success action and `errorObject` to the failure action.
|
|
9
31
|
|
|
10
32
|
## 1.1.6 - 2021-10-07
|
|
11
|
-
|
|
33
|
+
|
|
34
|
+
- Support reducers with actions like `[otherLogic().actionTypes.bla]`
|
|
12
35
|
|
|
13
36
|
## 1.1.5 - 2021-07-14
|
|
14
|
-
|
|
37
|
+
|
|
38
|
+
- [Fix bug](https://github.com/keajs/kea-typegen/issues/28) with string constant types in action properties when connected with `connect`.
|
|
15
39
|
|
|
16
40
|
## 1.1.4 - 2021-07-13
|
|
17
|
-
|
|
41
|
+
|
|
42
|
+
- Support declaring `props: {} as SomeInterface`
|
|
18
43
|
|
|
19
44
|
## 1.1.3 - 2021-07-13
|
|
20
|
-
|
|
45
|
+
|
|
46
|
+
- Bugfixes
|
|
21
47
|
|
|
22
48
|
## 1.1.2 - 2021-07-12
|
|
23
|
-
|
|
49
|
+
|
|
50
|
+
- Export types and `runTypeGen` function
|
|
24
51
|
|
|
25
52
|
## 1.1.1 - 2021-07-12
|
|
26
|
-
|
|
53
|
+
|
|
54
|
+
- Fix main field in package.json
|
|
27
55
|
|
|
28
56
|
## 1.1.0 - 2021-07-12
|
|
29
|
-
|
|
57
|
+
|
|
58
|
+
- Experimental support for typegen plugins
|
|
30
59
|
|
|
31
60
|
## 1.0.4 - 2021-06-27
|
|
32
|
-
|
|
61
|
+
|
|
62
|
+
- Fix regression
|
|
33
63
|
|
|
34
64
|
## 1.0.3 - 2021-06-27
|
|
35
|
-
|
|
65
|
+
|
|
66
|
+
- Fix regression
|
|
36
67
|
|
|
37
68
|
## 1.0.2 - 2021-06-27
|
|
38
|
-
|
|
39
|
-
-
|
|
69
|
+
|
|
70
|
+
- Use explicitly specified function return types if present for actions and selectors (vs detection via compiler api).
|
|
71
|
+
- This helps with namespaced types like `This.That`, as the namespace information is lost in detected types.
|
|
40
72
|
|
|
41
73
|
## 1.0.1 - 2021-06-27
|
|
42
|
-
|
|
43
|
-
-
|
|
74
|
+
|
|
75
|
+
- Republish as 1.0.0 on npm is actually 0.7.2
|
|
76
|
+
- Only import `A` when encountering complex types like `A.B`
|
|
44
77
|
|
|
45
78
|
## 1.0.0 - 2021-06-26
|
|
46
|
-
|
|
79
|
+
|
|
80
|
+
- Support auto-importing referenced types into logic types
|
|
47
81
|
|
|
48
82
|
## 0.7.2 - 2021-05-30
|
|
49
|
-
|
|
83
|
+
|
|
84
|
+
- Support actions that return payloads with over 16 properties (fix ".. 4 more .." in the generated type).
|
|
50
85
|
|
|
51
86
|
## 0.7.1 - 2021-04-30
|
|
52
|
-
|
|
87
|
+
|
|
88
|
+
- Improve error display, condense logs
|
|
53
89
|
|
|
54
90
|
## 0.7.0 - 2021-04-26
|
|
55
|
-
|
|
56
|
-
-
|
|
91
|
+
|
|
92
|
+
- Fix various bugs from last version.
|
|
93
|
+
- Run with `--no-import` to skip automatically adding imports to logic types.
|
|
57
94
|
|
|
58
95
|
## 0.6.2 - 2021-04-25
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
96
|
+
|
|
97
|
+
- Automatically add `import { logicType } from './logicType'` statements
|
|
98
|
+
- Automatically add the type to `kea<logicType>()`
|
|
99
|
+
- 0.6.0 and 0.6.1 had some bugs, don't use.
|
|
62
100
|
|
|
63
101
|
## 0.5.4 - 2021-03-30
|
|
64
|
-
|
|
102
|
+
|
|
103
|
+
- Support reducers with selectors as defaults
|
|
65
104
|
|
|
66
105
|
## 0.5.3 - 2021-02-23
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
106
|
+
|
|
107
|
+
- Fix type bug with selectors
|
|
108
|
+
- Skip first comment line in generated types when comparing for overwrites
|
|
109
|
+
- Update deps
|
|
70
110
|
|
|
71
111
|
## 0.5.2 - 2021-02-23
|
|
72
|
-
|
|
112
|
+
|
|
113
|
+
- Update and clean up copy
|
|
73
114
|
|
|
74
115
|
## 0.5.1 - 2021-01-22
|
|
75
|
-
|
|
116
|
+
|
|
117
|
+
- Fix `kea-typegen write` recursive updates
|
|
76
118
|
|
|
77
119
|
## 0.5.0 - 2021-01-22
|
|
78
|
-
|
|
79
|
-
-
|
|
120
|
+
|
|
121
|
+
- Fix "Record<...>" style shortened types in selectors
|
|
122
|
+
- Add names to selectors
|
|
80
123
|
|
|
81
124
|
## 0.4.0 - 2020-12-29
|
|
82
|
-
|
|
125
|
+
|
|
126
|
+
- Fixed support for TypeScript 4.1
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kea-typegen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "Generate type definitions for kea logic",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "ts-node ./src/cli/typegen.ts",
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
"prepublishOnly": "npm run test && npm run clean && npm run build",
|
|
10
10
|
"run-built-cli": "node dist/src/cli/typegen.js",
|
|
11
11
|
"test": "jest",
|
|
12
|
-
"samples:check": "ts-node ./src/cli/typegen.ts check -
|
|
13
|
-
"samples:write": "ts-node ./src/cli/typegen.ts write -
|
|
14
|
-
"samples:
|
|
12
|
+
"samples:check": "ts-node ./src/cli/typegen.ts check -r ./samples",
|
|
13
|
+
"samples:write": "ts-node ./src/cli/typegen.ts write -r ./samples --write-paths",
|
|
14
|
+
"samples:write:paths": "ts-node ./src/cli/typegen.ts write -r ./samples --write-paths",
|
|
15
|
+
"samples:watch": "ts-node ./src/cli/typegen.ts watch -r ./samples",
|
|
15
16
|
"samples:write:posthog": "ts-node ./src/cli/typegen.ts write -c ../../PostHog/posthog/tsconfig.json",
|
|
16
|
-
"form-plugin:build": "cd form-plugin && yarn build && cd ..",
|
|
17
|
+
"form-plugin:build": "cd form-plugin && yarn && yarn build && cd ..",
|
|
17
18
|
"form-plugin:rebuild": "yarn form-plugin:build && rm -rf node_modules && yarn"
|
|
18
19
|
},
|
|
19
20
|
"main": "dist/src/index.js",
|
|
@@ -25,13 +26,13 @@
|
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@wessberg/ts-clone-node": "0.3.19",
|
|
27
28
|
"diff": "^5.0.0",
|
|
28
|
-
"prettier": "^2.
|
|
29
|
+
"prettier": "^2.5.1",
|
|
29
30
|
"yargs": "^16.2.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@babel/core": "^7.
|
|
33
|
-
"@babel/preset-env": "^7.
|
|
34
|
-
"@babel/preset-typescript": "^7.
|
|
33
|
+
"@babel/core": "^7.16.0",
|
|
34
|
+
"@babel/preset-env": "^7.16.4",
|
|
35
|
+
"@babel/preset-typescript": "^7.16.0",
|
|
35
36
|
"@types/jest": "^26.0.20",
|
|
36
37
|
"@types/node": "^14.14.31",
|
|
37
38
|
"@types/yargs": "^16.0.0",
|
|
@@ -40,19 +41,19 @@
|
|
|
40
41
|
"form-plugin": "file:./form-plugin",
|
|
41
42
|
"husky": ">=4",
|
|
42
43
|
"jest": "^27.0.5",
|
|
43
|
-
"kea": "^2.
|
|
44
|
-
"lint-staged": ">=
|
|
44
|
+
"kea": "^2.5.6",
|
|
45
|
+
"lint-staged": ">=12.1.2",
|
|
45
46
|
"react": "^16.13.1",
|
|
46
|
-
"react-redux": "^7.2.
|
|
47
|
-
"redux": "^4.1.
|
|
48
|
-
"reselect": "^4.
|
|
47
|
+
"react-redux": "^7.2.6",
|
|
48
|
+
"redux": "^4.1.2",
|
|
49
|
+
"reselect": "^4.1.5",
|
|
49
50
|
"rimraf": "^3.0.2",
|
|
50
51
|
"ts-jest": "^27.0.3",
|
|
51
|
-
"ts-node": "^10.
|
|
52
|
-
"typescript": "^4.3
|
|
52
|
+
"ts-node": "^10.4.0",
|
|
53
|
+
"typescript": "^4.5.3"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
55
|
-
"typescript": "
|
|
56
|
+
"typescript": ">=4.5.3"
|
|
56
57
|
},
|
|
57
58
|
"jest": {
|
|
58
59
|
"testPathIgnorePatterns": [
|
|
@@ -12,7 +12,7 @@ test('actions - with a function', () => {
|
|
|
12
12
|
})
|
|
13
13
|
})
|
|
14
14
|
`;
|
|
15
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
15
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
16
16
|
});
|
|
17
17
|
test('actions - as an object', () => {
|
|
18
18
|
const logicSource = `
|
|
@@ -25,7 +25,7 @@ test('actions - as an object', () => {
|
|
|
25
25
|
}
|
|
26
26
|
})
|
|
27
27
|
`;
|
|
28
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
28
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
29
29
|
});
|
|
30
30
|
test('actions - as a function returning a object', () => {
|
|
31
31
|
const logicSource = `
|
|
@@ -40,7 +40,7 @@ test('actions - as a function returning a object', () => {
|
|
|
40
40
|
}
|
|
41
41
|
})
|
|
42
42
|
`;
|
|
43
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
43
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
44
44
|
});
|
|
45
45
|
test('actions - with random values instead of functions', () => {
|
|
46
46
|
const logicSource = `
|
|
@@ -56,6 +56,6 @@ test('actions - with random values instead of functions', () => {
|
|
|
56
56
|
}
|
|
57
57
|
})
|
|
58
58
|
`;
|
|
59
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
59
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
60
60
|
});
|
|
61
61
|
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/actions.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACnC,MAAM,WAAW,GAAG;;;;;;;;;KASnB,CAAA;IACD,MAAM,CAAC,8BAAsB,
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/actions.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACnC,MAAM,WAAW,GAAG;;;;;;;;;KASnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE;IAChC,MAAM,WAAW,GAAG;;;;;;;;;KASnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACpD,MAAM,WAAW,GAAG;;;;;;;;;;;KAWnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;IAC3D,MAAM,WAAW,GAAG;;;;;;;;;;;;KAYnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -44,7 +44,7 @@ test('connect actions from another logic', () => {
|
|
|
44
44
|
}
|
|
45
45
|
})
|
|
46
46
|
`;
|
|
47
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
47
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
48
48
|
});
|
|
49
49
|
test('connect actions from multiple other logics', () => {
|
|
50
50
|
const logicSource = `
|
|
@@ -91,7 +91,7 @@ test('connect actions from multiple other logics', () => {
|
|
|
91
91
|
}
|
|
92
92
|
})
|
|
93
93
|
`;
|
|
94
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
94
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
95
95
|
});
|
|
96
96
|
test('connect actions and rename', () => {
|
|
97
97
|
const logicSource = `
|
|
@@ -138,7 +138,7 @@ test('connect actions and rename', () => {
|
|
|
138
138
|
}
|
|
139
139
|
})
|
|
140
140
|
`;
|
|
141
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
141
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
142
142
|
});
|
|
143
143
|
test('connect values from another logic', () => {
|
|
144
144
|
const logicSource = `
|
|
@@ -187,7 +187,7 @@ test('connect values from another logic', () => {
|
|
|
187
187
|
}
|
|
188
188
|
})
|
|
189
189
|
`;
|
|
190
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
190
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
191
191
|
});
|
|
192
192
|
test('connect props from another logic', () => {
|
|
193
193
|
const logicSource = `
|
|
@@ -236,7 +236,7 @@ test('connect props from another logic', () => {
|
|
|
236
236
|
}
|
|
237
237
|
})
|
|
238
238
|
`;
|
|
239
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
239
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
240
240
|
});
|
|
241
241
|
test('connect values and rename', () => {
|
|
242
242
|
const logicSource = `
|
|
@@ -285,6 +285,6 @@ test('connect values and rename', () => {
|
|
|
285
285
|
}
|
|
286
286
|
})
|
|
287
287
|
`;
|
|
288
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
288
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
289
289
|
});
|
|
290
290
|
//# sourceMappingURL=connect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/connect.ts"],"names":[],"mappings":";;AAAA,uCAAmD;AAEnD,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAC5C,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCnB,CAAA;IACD,MAAM,CAAC,8BAAsB,
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/connect.ts"],"names":[],"mappings":";;AAAA,uCAAmD;AAEnD,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAC5C,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAGF,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACpD,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2CnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;IACpC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2CnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE;IAC3C,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6CnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAC1C,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6CnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACnC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6CnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -23,7 +23,7 @@ test('loaders - with a function', () => {
|
|
|
23
23
|
})
|
|
24
24
|
})
|
|
25
25
|
`;
|
|
26
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
26
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
27
27
|
});
|
|
28
28
|
test('loaders - with an array and default', () => {
|
|
29
29
|
const logicSource = `
|
|
@@ -49,7 +49,7 @@ test('loaders - with an array and default', () => {
|
|
|
49
49
|
})
|
|
50
50
|
})
|
|
51
51
|
`;
|
|
52
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
52
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
53
53
|
});
|
|
54
54
|
test('loaders - with no param', () => {
|
|
55
55
|
const logicSource = `
|
|
@@ -68,6 +68,6 @@ test('loaders - with no param', () => {
|
|
|
68
68
|
})
|
|
69
69
|
})
|
|
70
70
|
`;
|
|
71
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
71
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
72
72
|
});
|
|
73
73
|
//# sourceMappingURL=loaders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/loaders.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACnC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;KAoBnB,CAAA;IACD,MAAM,CAAC,8BAAsB,
|
|
1
|
+
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/loaders.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACnC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;KAoBnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAGF,IAAI,CAAC,qCAAqC,EAAE,GAAG,EAAE;IAC7C,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;KAsBnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;KAenB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -30,7 +30,7 @@ test('reducers - with a function', () => {
|
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
32
|
`;
|
|
33
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
33
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
34
34
|
});
|
|
35
35
|
test('reducers - as an object', () => {
|
|
36
36
|
const logicSource = `
|
|
@@ -60,7 +60,7 @@ test('reducers - as an object', () => {
|
|
|
60
60
|
}
|
|
61
61
|
})
|
|
62
62
|
`;
|
|
63
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
63
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
64
64
|
});
|
|
65
65
|
test('reducers - as a function returning a object', () => {
|
|
66
66
|
const logicSource = `
|
|
@@ -93,7 +93,7 @@ test('reducers - as a function returning a object', () => {
|
|
|
93
93
|
}
|
|
94
94
|
})
|
|
95
95
|
`;
|
|
96
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
96
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
97
97
|
});
|
|
98
98
|
test('reducers - with bool default', () => {
|
|
99
99
|
const logicSource = `
|
|
@@ -115,6 +115,6 @@ test('reducers - with bool default', () => {
|
|
|
115
115
|
}
|
|
116
116
|
})
|
|
117
117
|
`;
|
|
118
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
118
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
119
119
|
});
|
|
120
120
|
//# sourceMappingURL=reducers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducers.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/reducers.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;IACpC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BnB,CAAA;IACD,MAAM,CAAC,8BAAsB,
|
|
1
|
+
{"version":3,"file":"reducers.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/reducers.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;IACpC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;KA0BnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,6CAA6C,EAAE,GAAG,EAAE;IACrD,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,8BAA8B,EAAE,GAAG,EAAE;IACtC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;KAkBnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -33,7 +33,7 @@ test('selectors - with a function', () => {
|
|
|
33
33
|
})
|
|
34
34
|
})
|
|
35
35
|
`;
|
|
36
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
36
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
37
37
|
});
|
|
38
38
|
test('selectors - as an object', () => {
|
|
39
39
|
const logicSource = `
|
|
@@ -67,7 +67,7 @@ test('selectors - as an object', () => {
|
|
|
67
67
|
}
|
|
68
68
|
})
|
|
69
69
|
`;
|
|
70
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
70
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
71
71
|
});
|
|
72
72
|
test('selectors - as a function returning a object', () => {
|
|
73
73
|
const logicSource = `
|
|
@@ -103,6 +103,6 @@ test('selectors - as a function returning a object', () => {
|
|
|
103
103
|
}
|
|
104
104
|
})
|
|
105
105
|
`;
|
|
106
|
-
expect(utils_1.logicSourceToLogicType(logicSource)).toMatchSnapshot();
|
|
106
|
+
expect((0, utils_1.logicSourceToLogicType)(logicSource)).toMatchSnapshot();
|
|
107
107
|
});
|
|
108
108
|
//# sourceMappingURL=selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/selectors.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACrC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BnB,CAAA;IACD,MAAM,CAAC,8BAAsB,
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/__tests__/e2e/selectors.ts"],"names":[],"mappings":";;AAAA,uCAAoD;AAEpD,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACrC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IAClC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,8CAA8C,EAAE,GAAG,EAAE;IACtD,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCnB,CAAA;IACD,MAAM,CAAC,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;AACjE,CAAC,CAAC,CAAA"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
-
const
|
|
4
|
+
const typescript_1 = require("typescript");
|
|
5
5
|
test('sourceToSourceFile', () => {
|
|
6
6
|
const source = 'var foo = 5;';
|
|
7
|
-
const sourceFile1 = utils_1.sourceToSourceFile(source);
|
|
8
|
-
const sourceFile2 = utils_1.sourceToSourceFile(source, 'otherLogic.ts');
|
|
7
|
+
const sourceFile1 = (0, utils_1.sourceToSourceFile)(source);
|
|
8
|
+
const sourceFile2 = (0, utils_1.sourceToSourceFile)(source, 'otherLogic.ts');
|
|
9
9
|
expect(sourceFile1.text).toEqual(source);
|
|
10
10
|
expect(sourceFile2.text).toEqual(source);
|
|
11
11
|
expect(sourceFile1.fileName).toEqual('logic.ts');
|
|
12
12
|
expect(sourceFile2.fileName).toEqual('otherLogic.ts');
|
|
13
|
-
expect(
|
|
14
|
-
expect(
|
|
13
|
+
expect(typescript_1.SyntaxKind[sourceFile1.kind]).toEqual('SourceFile');
|
|
14
|
+
expect(typescript_1.SyntaxKind[sourceFile2.kind]).toEqual('SourceFile');
|
|
15
15
|
});
|
|
16
16
|
test('programFromSource', () => {
|
|
17
17
|
const source = 'var foo = 5;';
|
|
18
|
-
const program = utils_1.programFromSource(source);
|
|
18
|
+
const program = (0, utils_1.programFromSource)(source);
|
|
19
19
|
expect(program).toBeDefined;
|
|
20
20
|
expect(typeof program.getSourceFile).toBe('function');
|
|
21
21
|
});
|
|
@@ -30,7 +30,7 @@ test('logicSourceToLogicType', () => {
|
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
32
|
`;
|
|
33
|
-
const string = utils_1.logicSourceToLogicType(logicSource);
|
|
33
|
+
const string = (0, utils_1.logicSourceToLogicType)(logicSource);
|
|
34
34
|
expect(string).toContain('export interface myRandomLogicType extends Logic {');
|
|
35
35
|
});
|
|
36
36
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/__tests__/utils.ts"],"names":[],"mappings":";;AAAA,oCAAwF;AACxF,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/__tests__/utils.ts"],"names":[],"mappings":";;AAAA,oCAAwF;AACxF,2CAAuC;AAEvC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAC5B,MAAM,MAAM,GAAG,cAAc,CAAA;IAC7B,MAAM,WAAW,GAAG,IAAA,0BAAkB,EAAC,MAAM,CAAC,CAAA;IAC9C,MAAM,WAAW,GAAG,IAAA,0BAAkB,EAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC/D,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACxC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACxC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAChD,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;IACrD,MAAM,CAAC,uBAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;IAC1D,MAAM,CAAC,uBAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;AAC9D,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC3B,MAAM,MAAM,GAAG,cAAc,CAAA;IAC7B,MAAM,OAAO,GAAG,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAA;IACzC,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAA;IAC3B,MAAM,CAAC,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AACzD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE;IAChC,MAAM,WAAW,GAAG;;;;;;;;;KASnB,CAAA;IACD,MAAM,MAAM,GAAG,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAA;IAElD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,oDAAoD,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA"}
|
package/dist/src/cli/typegen.js
CHANGED
|
@@ -8,13 +8,13 @@ const fs = require("fs");
|
|
|
8
8
|
const typegen_1 = require("../typegen");
|
|
9
9
|
yargs
|
|
10
10
|
.command('check', '- check what should be done', (yargs) => { }, (argv) => {
|
|
11
|
-
typegen_1.runTypeGen(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: false, watch: false }));
|
|
11
|
+
(0, typegen_1.runTypeGen)(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: false, watch: false }));
|
|
12
12
|
})
|
|
13
13
|
.command('write', '- write logicType.ts files', (yargs) => { }, (argv) => {
|
|
14
|
-
typegen_1.runTypeGen(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: true, watch: false }));
|
|
14
|
+
(0, typegen_1.runTypeGen)(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: true, watch: false }));
|
|
15
15
|
})
|
|
16
16
|
.command('watch', '- watch for changes and write logicType.ts files', (yargs) => { }, (argv) => {
|
|
17
|
-
typegen_1.runTypeGen(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: true, watch: true }));
|
|
17
|
+
(0, typegen_1.runTypeGen)(Object.assign(Object.assign({}, includeKeaConfig(parsedToAppOptions(argv))), { write: true, watch: true }));
|
|
18
18
|
})
|
|
19
19
|
.option('config', { alias: 'c', describe: 'Path to tsconfig.json (otherwise auto-detected)', type: 'string' })
|
|
20
20
|
.option('file', { alias: 'f', describe: "Single file to evaluate (can't be used with --config)", type: 'string' })
|
|
@@ -30,6 +30,15 @@ yargs
|
|
|
30
30
|
})
|
|
31
31
|
.option('quiet', { alias: 'q', describe: 'Write nothing to stdout', type: 'boolean' })
|
|
32
32
|
.option('no-import', { describe: 'Do not automatically import generated types in logic files', type: 'boolean' })
|
|
33
|
+
.option('write-paths', { describe: 'Write paths into logic files that have none', type: 'boolean' })
|
|
34
|
+
.option('import-global-types', {
|
|
35
|
+
describe: 'Add import statements in logicType.ts files for global types (e.g. @types/node)',
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
})
|
|
38
|
+
.option('ignore-import-paths', {
|
|
39
|
+
describe: 'List of paths we will never import from inside logicType.ts files',
|
|
40
|
+
type: 'array',
|
|
41
|
+
})
|
|
33
42
|
.option('verbose', { describe: 'Slightly more verbose output log', type: 'boolean' })
|
|
34
43
|
.demandCommand()
|
|
35
44
|
.help()
|
|
@@ -43,15 +52,18 @@ function parsedToAppOptions(parsedOptions) {
|
|
|
43
52
|
quiet: parsedOptions.quiet,
|
|
44
53
|
verbose: parsedOptions.verbose,
|
|
45
54
|
noImport: parsedOptions.noImport,
|
|
55
|
+
writePaths: parsedOptions.writePaths,
|
|
56
|
+
importGlobalTypes: parsedOptions.importGlobalTypes,
|
|
57
|
+
ignoreImportPaths: parsedOptions.ignoreImportPaths,
|
|
46
58
|
log: parsedOptions.quiet ? () => null : console.log.bind(console),
|
|
47
59
|
};
|
|
48
60
|
return appOptions;
|
|
49
61
|
}
|
|
50
|
-
function findKeaConfig() {
|
|
51
|
-
return ts.findConfigFile(
|
|
62
|
+
function findKeaConfig(searchPath) {
|
|
63
|
+
return ts.findConfigFile(searchPath, ts.sys.fileExists, '.kearc');
|
|
52
64
|
}
|
|
53
65
|
function includeKeaConfig(appOptions) {
|
|
54
|
-
const configFilePath = findKeaConfig();
|
|
66
|
+
const configFilePath = findKeaConfig(appOptions.rootPath);
|
|
55
67
|
const newOptions = Object.assign({}, appOptions);
|
|
56
68
|
let rawData, keaConfig;
|
|
57
69
|
for (const key of Object.keys(appOptions)) {
|
|
@@ -81,20 +93,34 @@ function includeKeaConfig(appOptions) {
|
|
|
81
93
|
if (key.endsWith('Path')) {
|
|
82
94
|
newOptions[key] = path.resolve(process.cwd(), configDirPath, keaConfig[key]);
|
|
83
95
|
}
|
|
96
|
+
else if (key.endsWith('Paths')) {
|
|
97
|
+
if (!Array.isArray(keaConfig[key])) {
|
|
98
|
+
console.error(`Config "${key}" in ".kearc" is not an array`);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
newOptions[key] = keaConfig[key].map((value) => path.resolve(process.cwd(), configDirPath, value));
|
|
102
|
+
}
|
|
84
103
|
else {
|
|
85
104
|
newOptions[key] = keaConfig[key];
|
|
86
105
|
}
|
|
87
106
|
});
|
|
88
107
|
}
|
|
89
|
-
if (!newOptions.tsConfigPath) {
|
|
90
|
-
newOptions.tsConfigPath = ts.findConfigFile('./', ts.sys.fileExists, 'tsconfig.json');
|
|
91
|
-
}
|
|
92
108
|
if (!newOptions.rootPath) {
|
|
93
109
|
newOptions.rootPath = newOptions.tsConfigPath ? path.dirname(newOptions.tsConfigPath) : process.cwd();
|
|
94
110
|
}
|
|
95
111
|
if (!newOptions.typesPath) {
|
|
96
112
|
newOptions.typesPath = newOptions.rootPath;
|
|
97
113
|
}
|
|
114
|
+
if (!newOptions.tsConfigPath) {
|
|
115
|
+
newOptions.tsConfigPath =
|
|
116
|
+
ts.findConfigFile(newOptions.rootPath, ts.sys.fileExists, 'tsconfig.json') ||
|
|
117
|
+
ts.findConfigFile('./', ts.sys.fileExists, 'tsconfig.json');
|
|
118
|
+
}
|
|
119
|
+
if (!newOptions.packageJsonPath) {
|
|
120
|
+
newOptions.packageJsonPath =
|
|
121
|
+
ts.findConfigFile(newOptions.rootPath, ts.sys.fileExists, 'package.json') ||
|
|
122
|
+
ts.findConfigFile('./', ts.sys.fileExists, 'package.json');
|
|
123
|
+
}
|
|
98
124
|
return newOptions;
|
|
99
125
|
}
|
|
100
126
|
//# sourceMappingURL=typegen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typegen.js","sourceRoot":"","sources":["../../../src/cli/typegen.ts"],"names":[],"mappings":";;;AAEA,iCAAgC;AAChC,+BAA8B;AAC9B,6BAA4B;AAC5B,yBAAwB;AAExB,wCAAuC;AAEvC,KAAK;KACA,OAAO,CACJ,OAAO,EACP,6BAA6B,EAC7B,CAAC,KAAK,EAAE,EAAE,GAAE,CAAC,EACb,CAAC,IAAI,EAAE,EAAE;IACL,oBAAU,
|
|
1
|
+
{"version":3,"file":"typegen.js","sourceRoot":"","sources":["../../../src/cli/typegen.ts"],"names":[],"mappings":";;;AAEA,iCAAgC;AAChC,+BAA8B;AAC9B,6BAA4B;AAC5B,yBAAwB;AAExB,wCAAuC;AAEvC,KAAK;KACA,OAAO,CACJ,OAAO,EACP,6BAA6B,EAC7B,CAAC,KAAK,EAAE,EAAE,GAAE,CAAC,EACb,CAAC,IAAI,EAAE,EAAE;IACL,IAAA,oBAAU,kCAAM,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,KAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,IAAG,CAAA;AAC7F,CAAC,CACJ;KACA,OAAO,CACJ,OAAO,EACP,4BAA4B,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,eAAe,CAAC,CAAA;KAClE;IAED,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE;QAC7B,UAAU,CAAC,eAAe;YACtB,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC;gBACzE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA;KACjE;IAED,OAAO,UAAU,CAAA;AACrB,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Node, Program, TypeParameterDeclaration } from 'typescript';
|
|
2
2
|
import { AppOptions, ParsedLogic } from '../types';
|
|
3
3
|
export declare function runThroughPrettier(sourceText: string, filePath: string): string;
|
|
4
|
-
export declare function printToFiles(program:
|
|
4
|
+
export declare function printToFiles(program: Program, appOptions: AppOptions, parsedLogics: ParsedLogic[]): {
|
|
5
5
|
filesToWrite: number;
|
|
6
6
|
writtenFiles: number;
|
|
7
|
-
|
|
7
|
+
filesToModify: number;
|
|
8
8
|
};
|
|
9
|
-
export declare function nodeToString(node:
|
|
9
|
+
export declare function nodeToString(node: Node): string;
|
|
10
10
|
export declare function parsedLogicToTypeString(parsedLogic: ParsedLogic, appOptions?: AppOptions): string;
|
|
11
|
-
export declare function getLogicTypeArguments(parsedLogic: ParsedLogic):
|
|
11
|
+
export declare function getLogicTypeArguments(parsedLogic: ParsedLogic): TypeParameterDeclaration[];
|
|
12
12
|
export declare function printLogicType(parsedLogic: ParsedLogic, appOptions?: AppOptions): void;
|