nestia 2.0.6 → 2.0.7-dev.20220414
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/{src/IConfiguration.ts → bin/IConfiguration.d.ts} +5 -8
- package/bin/IConfiguration.d.ts.map +1 -0
- package/bin/IConfiguration.js +3 -0
- package/bin/NestiaApplication.d.ts +10 -0
- package/bin/NestiaApplication.d.ts.map +1 -0
- package/bin/NestiaApplication.js +281 -0
- package/bin/analyses/ControllerAnalyzer.d.ts +7 -0
- package/bin/analyses/ControllerAnalyzer.d.ts.map +1 -0
- package/bin/analyses/ControllerAnalyzer.js +186 -0
- package/bin/analyses/GenericAnalyzer.d.ts +6 -0
- package/bin/analyses/GenericAnalyzer.d.ts.map +1 -0
- package/bin/analyses/GenericAnalyzer.js +100 -0
- package/bin/analyses/ImportAnalyzer.d.ts +13 -0
- package/bin/analyses/ImportAnalyzer.d.ts.map +1 -0
- package/bin/analyses/ImportAnalyzer.js +82 -0
- package/bin/analyses/ReflectAnalyzer.d.ts +5 -0
- package/bin/analyses/ReflectAnalyzer.d.ts.map +1 -0
- package/bin/analyses/ReflectAnalyzer.js +307 -0
- package/bin/analyses/SourceFinder.d.ts +5 -0
- package/bin/analyses/SourceFinder.d.ts.map +1 -0
- package/bin/analyses/SourceFinder.js +260 -0
- package/bin/bundle/HttpError.d.ts +2 -0
- package/bin/bundle/HttpError.d.ts.map +1 -0
- package/bin/bundle/HttpError.js +6 -0
- package/bin/bundle/IConnection.d.ts +2 -0
- package/bin/bundle/IConnection.d.ts.map +1 -0
- package/bin/bundle/IConnection.js +3 -0
- package/bin/bundle/Primitive.d.ts +2 -0
- package/bin/bundle/Primitive.d.ts.map +1 -0
- package/bin/bundle/Primitive.js +6 -0
- package/bin/bundle/__internal/AesPkcs5.d.ts +2 -0
- package/bin/bundle/__internal/AesPkcs5.d.ts.map +1 -0
- package/bin/bundle/__internal/AesPkcs5.js +6 -0
- package/bin/bundle/__internal/Fetcher.d.ts +2 -0
- package/bin/bundle/__internal/Fetcher.d.ts.map +1 -0
- package/bin/bundle/__internal/Fetcher.js +6 -0
- package/bin/executable/internal/CompilerOptions.d.ts +13 -0
- package/bin/executable/internal/CompilerOptions.d.ts.map +1 -0
- package/bin/executable/internal/CompilerOptions.js +132 -0
- package/bin/executable/internal/NestiaConfig.d.ts +5 -0
- package/bin/executable/internal/NestiaConfig.d.ts.map +1 -0
- package/bin/executable/internal/NestiaConfig.js +196 -0
- package/bin/executable/internal/nestia.config.getter.d.ts +2 -0
- package/bin/executable/internal/nestia.config.getter.d.ts.map +1 -0
- package/bin/executable/internal/nestia.config.getter.js +60 -0
- package/bin/executable/nestia.d.ts +3 -0
- package/bin/executable/nestia.d.ts.map +1 -0
- package/bin/executable/nestia.js +136 -0
- package/bin/executable/sdk.d.ts +2 -0
- package/bin/executable/sdk.d.ts.map +1 -0
- package/bin/executable/sdk.js +206 -0
- package/bin/generates/FileGenerator.d.ts +6 -0
- package/bin/generates/FileGenerator.d.ts.map +1 -0
- package/bin/generates/FileGenerator.js +302 -0
- package/bin/generates/FunctionGenerator.d.ts +5 -0
- package/bin/generates/FunctionGenerator.d.ts.map +1 -0
- package/bin/generates/FunctionGenerator.js +207 -0
- package/bin/generates/SdkGenerator.d.ts +6 -0
- package/bin/generates/SdkGenerator.d.ts.map +1 -0
- package/bin/generates/SdkGenerator.js +147 -0
- package/bin/index.d.ts +3 -0
- package/bin/index.d.ts.map +1 -0
- package/bin/index.js +28 -0
- package/bin/module.d.ts +3 -0
- package/bin/module.d.ts.map +1 -0
- package/bin/module.js +19 -0
- package/{src/structures/IController.ts → bin/structures/IController.d.ts} +6 -13
- package/bin/structures/IController.d.ts.map +1 -0
- package/bin/structures/IController.js +3 -0
- package/{src/structures/IRoute.ts → bin/structures/IRoute.d.ts} +5 -11
- package/bin/structures/IRoute.d.ts.map +1 -0
- package/bin/structures/IRoute.js +3 -0
- package/bin/structures/MethodType.d.ts +5 -0
- package/bin/structures/MethodType.d.ts.map +1 -0
- package/bin/structures/MethodType.js +8 -0
- package/bin/structures/ParamCategory.d.ts +2 -0
- package/bin/structures/ParamCategory.d.ts.map +1 -0
- package/bin/structures/ParamCategory.js +3 -0
- package/bin/utils/ArrayUtil.d.ts +6 -0
- package/bin/utils/ArrayUtil.d.ts.map +1 -0
- package/bin/utils/ArrayUtil.js +144 -0
- package/bin/utils/DirectoryUtil.d.ts +6 -0
- package/bin/utils/DirectoryUtil.d.ts.map +1 -0
- package/bin/utils/DirectoryUtil.js +190 -0
- package/bin/utils/ImportDictionary.d.ts +7 -0
- package/bin/utils/ImportDictionary.d.ts.map +1 -0
- package/bin/utils/ImportDictionary.js +85 -0
- package/bin/utils/StringUtil.d.ts +4 -0
- package/bin/utils/StringUtil.d.ts.map +1 -0
- package/bin/utils/StringUtil.js +13 -0
- package/bin/utils/stripJsonComments.d.ts +4 -0
- package/bin/utils/stripJsonComments.d.ts.map +1 -0
- package/bin/utils/stripJsonComments.js +76 -0
- package/package.json +14 -10
- package/tsconfig.json +8 -7
- package/src/NestiaApplication.ts +0 -96
- package/src/analyses/ControllerAnalyzer.ts +0 -154
- package/src/analyses/GenericAnalyzer.ts +0 -52
- package/src/analyses/ImportAnalyzer.ts +0 -93
- package/src/analyses/ReflectAnalyzer.ts +0 -221
- package/src/analyses/SourceFinder.ts +0 -73
- package/src/bin/nestia.ts +0 -59
- package/src/bundle/HttpError.ts +0 -1
- package/src/bundle/IConnection.ts +0 -1
- package/src/bundle/Primitive.ts +0 -1
- package/src/bundle/__internal/AesPkcs5.ts +0 -1
- package/src/bundle/__internal/Fetcher.ts +0 -1
- package/src/executable/sdk.ts +0 -84
- package/src/generates/FileGenerator.ts +0 -150
- package/src/generates/FunctionGenerator.ts +0 -201
- package/src/generates/SdkGenerator.ts +0 -39
- package/src/internal/NestiaConfig.ts +0 -36
- package/src/internal/TsConfig.ts +0 -123
- package/src/internal/tsconfig.default.json +0 -81
- package/src/structures/MethodType.ts +0 -6
- package/src/structures/ParamCategory.ts +0 -1
- package/src/utils/ArrayUtil.ts +0 -26
- package/src/utils/DirectoryUtil.ts +0 -48
- package/src/utils/ImportDictionary.ts +0 -44
- package/src/utils/StringUtil.ts +0 -10
- package/src/utils/stripJsonComments.ts +0 -79
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import * as tsc from "typescript";
|
|
2
|
-
|
|
3
|
-
export interface IConfiguration
|
|
4
|
-
{
|
|
2
|
+
export interface IConfiguration {
|
|
5
3
|
input: string | string[] | IConfiguration.IInput;
|
|
6
4
|
output: string;
|
|
7
5
|
compilerOptions?: tsc.CompilerOptions;
|
|
8
6
|
assert?: boolean;
|
|
9
7
|
}
|
|
10
|
-
export namespace IConfiguration
|
|
11
|
-
{
|
|
12
|
-
export interface IInput
|
|
13
|
-
{
|
|
8
|
+
export declare namespace IConfiguration {
|
|
9
|
+
interface IInput {
|
|
14
10
|
include: string[];
|
|
15
11
|
exclude?: string[];
|
|
16
12
|
}
|
|
17
|
-
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=IConfiguration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IConfiguration.d.ts","sourceRoot":"","sources":["../src/IConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC,MAAM,WAAW,cAAc;IAE3B,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,yBAAiB,cAAc,CAC/B;IACI,UAAiB,MAAM;QAEnB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACtB;CACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IConfiguration } from "./IConfiguration";
|
|
2
|
+
export declare class NestiaApplication {
|
|
3
|
+
private readonly config_;
|
|
4
|
+
private readonly bundle_checker_;
|
|
5
|
+
constructor(config: IConfiguration);
|
|
6
|
+
generate(): Promise<void>;
|
|
7
|
+
private prepare;
|
|
8
|
+
private is_not_excluded;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=NestiaApplication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NestiaApplication.d.ts","sourceRoot":"","sources":["../src/NestiaApplication.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA+C;gBAE5D,MAAM,EAAE,cAAc;IA0B5B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA8CtC,OAAO,CAAC,OAAO;YAyBD,eAAe;CAKhC"}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (_) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __values = (this && this.__values) || function(o) {
|
|
62
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
63
|
+
if (m) return m.call(o);
|
|
64
|
+
if (o && typeof o.length === "number") return {
|
|
65
|
+
next: function () {
|
|
66
|
+
if (o && i >= o.length) o = void 0;
|
|
67
|
+
return { value: o && o[i++], done: !o };
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
71
|
+
};
|
|
72
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
73
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
74
|
+
if (!m) return o;
|
|
75
|
+
var i = m.call(o), r, ar = [], e;
|
|
76
|
+
try {
|
|
77
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
78
|
+
}
|
|
79
|
+
catch (error) { e = { error: error }; }
|
|
80
|
+
finally {
|
|
81
|
+
try {
|
|
82
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
83
|
+
}
|
|
84
|
+
finally { if (e) throw e.error; }
|
|
85
|
+
}
|
|
86
|
+
return ar;
|
|
87
|
+
};
|
|
88
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
89
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
90
|
+
if (ar || !(i in from)) {
|
|
91
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
92
|
+
ar[i] = from[i];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
96
|
+
};
|
|
97
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
98
|
+
exports.NestiaApplication = void 0;
|
|
99
|
+
var fs = __importStar(require("fs"));
|
|
100
|
+
var path = __importStar(require("path"));
|
|
101
|
+
var runner = __importStar(require("ts-node"));
|
|
102
|
+
var tsc = __importStar(require("typescript"));
|
|
103
|
+
var Pair_1 = require("tstl/utility/Pair");
|
|
104
|
+
var Singleton_1 = require("tstl/thread/Singleton");
|
|
105
|
+
var ControllerAnalyzer_1 = require("./analyses/ControllerAnalyzer");
|
|
106
|
+
var ReflectAnalyzer_1 = require("./analyses/ReflectAnalyzer");
|
|
107
|
+
var SourceFinder_1 = require("./analyses/SourceFinder");
|
|
108
|
+
var SdkGenerator_1 = require("./generates/SdkGenerator");
|
|
109
|
+
var ArrayUtil_1 = require("./utils/ArrayUtil");
|
|
110
|
+
var CompilerOptions_1 = require("./executable/internal/CompilerOptions");
|
|
111
|
+
var NestiaApplication = /** @class */ (function () {
|
|
112
|
+
function NestiaApplication(config) {
|
|
113
|
+
var _this = this;
|
|
114
|
+
this.config_ = config;
|
|
115
|
+
this.bundle_checker_ = new Singleton_1.Singleton(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
116
|
+
var bundles, tuples;
|
|
117
|
+
var _this = this;
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
120
|
+
case 0: return [4 /*yield*/, fs.promises.readdir("".concat(__dirname).concat(path.sep, "bundle"))];
|
|
121
|
+
case 1:
|
|
122
|
+
bundles = _a.sent();
|
|
123
|
+
return [4 /*yield*/, ArrayUtil_1.ArrayUtil.asyncMap(bundles, function (file) { return __awaiter(_this, void 0, void 0, function () {
|
|
124
|
+
var relative, stats;
|
|
125
|
+
return __generator(this, function (_a) {
|
|
126
|
+
switch (_a.label) {
|
|
127
|
+
case 0:
|
|
128
|
+
relative = "".concat(this.config_.output).concat(path.sep).concat(file);
|
|
129
|
+
return [4 /*yield*/, fs.promises.stat("".concat(__dirname).concat(path.sep, "bundle").concat(path.sep).concat(file))];
|
|
130
|
+
case 1:
|
|
131
|
+
stats = _a.sent();
|
|
132
|
+
return [2 /*return*/, new Pair_1.Pair(relative, stats.isDirectory())];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}); })];
|
|
136
|
+
case 2:
|
|
137
|
+
tuples = _a.sent();
|
|
138
|
+
return [2 /*return*/, function (file) {
|
|
139
|
+
var e_1, _a;
|
|
140
|
+
try {
|
|
141
|
+
for (var tuples_1 = __values(tuples), tuples_1_1 = tuples_1.next(); !tuples_1_1.done; tuples_1_1 = tuples_1.next()) {
|
|
142
|
+
var it = tuples_1_1.value;
|
|
143
|
+
if (it.second === false && file === it.first)
|
|
144
|
+
return true;
|
|
145
|
+
else if (it.second === true && file.indexOf(it.first) === 0)
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
150
|
+
finally {
|
|
151
|
+
try {
|
|
152
|
+
if (tuples_1_1 && !tuples_1_1.done && (_a = tuples_1.return)) _a.call(tuples_1);
|
|
153
|
+
}
|
|
154
|
+
finally { if (e_1) throw e_1.error; }
|
|
155
|
+
}
|
|
156
|
+
return false;
|
|
157
|
+
}];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}); });
|
|
161
|
+
}
|
|
162
|
+
NestiaApplication.prototype.generate = function () {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
164
|
+
var input, fileList, _a, _b, unique, controllerList, fileList_1, fileList_1_1, file, _c, _d, _e, _f, e_2_1, program, checker, routeList, controllerList_1, controllerList_1_1, controller, sourceFile;
|
|
165
|
+
var e_2, _g, e_3, _h;
|
|
166
|
+
var _this = this;
|
|
167
|
+
return __generator(this, function (_j) {
|
|
168
|
+
switch (_j.label) {
|
|
169
|
+
case 0:
|
|
170
|
+
// MOUNT TS-NODE
|
|
171
|
+
this.prepare();
|
|
172
|
+
input = this.config_.input instanceof Array
|
|
173
|
+
? { include: this.config_.input }
|
|
174
|
+
: typeof this.config_.input === "string"
|
|
175
|
+
? { include: [this.config_.input] }
|
|
176
|
+
: this.config_.input;
|
|
177
|
+
_b = (_a = ArrayUtil_1.ArrayUtil).asyncFilter;
|
|
178
|
+
return [4 /*yield*/, SourceFinder_1.SourceFinder.find(input)];
|
|
179
|
+
case 1: return [4 /*yield*/, _b.apply(_a, [_j.sent(), function (file) { return _this.is_not_excluded(file); }])];
|
|
180
|
+
case 2:
|
|
181
|
+
fileList = _j.sent();
|
|
182
|
+
unique = new WeakSet();
|
|
183
|
+
controllerList = [];
|
|
184
|
+
_j.label = 3;
|
|
185
|
+
case 3:
|
|
186
|
+
_j.trys.push([3, 8, 9, 10]);
|
|
187
|
+
fileList_1 = __values(fileList), fileList_1_1 = fileList_1.next();
|
|
188
|
+
_j.label = 4;
|
|
189
|
+
case 4:
|
|
190
|
+
if (!!fileList_1_1.done) return [3 /*break*/, 7];
|
|
191
|
+
file = fileList_1_1.value;
|
|
192
|
+
_d = (_c = controllerList.push).apply;
|
|
193
|
+
_e = [controllerList];
|
|
194
|
+
_f = [[]];
|
|
195
|
+
return [4 /*yield*/, ReflectAnalyzer_1.ReflectAnalyzer.analyze(unique, file)];
|
|
196
|
+
case 5:
|
|
197
|
+
_d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [_j.sent()]), false]))]));
|
|
198
|
+
_j.label = 6;
|
|
199
|
+
case 6:
|
|
200
|
+
fileList_1_1 = fileList_1.next();
|
|
201
|
+
return [3 /*break*/, 4];
|
|
202
|
+
case 7: return [3 /*break*/, 10];
|
|
203
|
+
case 8:
|
|
204
|
+
e_2_1 = _j.sent();
|
|
205
|
+
e_2 = { error: e_2_1 };
|
|
206
|
+
return [3 /*break*/, 10];
|
|
207
|
+
case 9:
|
|
208
|
+
try {
|
|
209
|
+
if (fileList_1_1 && !fileList_1_1.done && (_g = fileList_1.return)) _g.call(fileList_1);
|
|
210
|
+
}
|
|
211
|
+
finally { if (e_2) throw e_2.error; }
|
|
212
|
+
return [7 /*endfinally*/];
|
|
213
|
+
case 10:
|
|
214
|
+
program = tsc.createProgram(controllerList.map(function (c) { return c.file; }), this.config_.compilerOptions || {});
|
|
215
|
+
checker = program.getTypeChecker();
|
|
216
|
+
routeList = [];
|
|
217
|
+
try {
|
|
218
|
+
for (controllerList_1 = __values(controllerList), controllerList_1_1 = controllerList_1.next(); !controllerList_1_1.done; controllerList_1_1 = controllerList_1.next()) {
|
|
219
|
+
controller = controllerList_1_1.value;
|
|
220
|
+
sourceFile = program.getSourceFile(controller.file);
|
|
221
|
+
if (sourceFile === undefined)
|
|
222
|
+
continue;
|
|
223
|
+
routeList.push.apply(routeList, __spreadArray([], __read(ControllerAnalyzer_1.ControllerAnalyzer.analyze(checker, sourceFile, controller)), false));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
227
|
+
finally {
|
|
228
|
+
try {
|
|
229
|
+
if (controllerList_1_1 && !controllerList_1_1.done && (_h = controllerList_1.return)) _h.call(controllerList_1);
|
|
230
|
+
}
|
|
231
|
+
finally { if (e_3) throw e_3.error; }
|
|
232
|
+
}
|
|
233
|
+
// DO GENERATE
|
|
234
|
+
return [4 /*yield*/, SdkGenerator_1.SdkGenerator.generate(this.config_, routeList)];
|
|
235
|
+
case 11:
|
|
236
|
+
// DO GENERATE
|
|
237
|
+
_j.sent();
|
|
238
|
+
return [2 /*return*/];
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
NestiaApplication.prototype.prepare = function () {
|
|
244
|
+
var _a;
|
|
245
|
+
// CONSTRUCT OPTIONS
|
|
246
|
+
var transformed = false;
|
|
247
|
+
var aliased = false;
|
|
248
|
+
if (!this.config_.compilerOptions)
|
|
249
|
+
this.config_.compilerOptions = CompilerOptions_1.CompilerOptions.DEFAULT_OPTIONS;
|
|
250
|
+
else
|
|
251
|
+
_a = __read(CompilerOptions_1.CompilerOptions.emend(this.config_.compilerOptions, !!this.config_.assert), 2), transformed = _a[0], aliased = _a[1];
|
|
252
|
+
// MOUNT TS-NODE
|
|
253
|
+
runner.register({
|
|
254
|
+
compiler: transformed ? "ttypescript" : "typescript",
|
|
255
|
+
compilerOptions: this.config_.compilerOptions,
|
|
256
|
+
require: aliased
|
|
257
|
+
? ["tsconfig-paths/register"]
|
|
258
|
+
: undefined
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
NestiaApplication.prototype.is_not_excluded = function (file) {
|
|
262
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
263
|
+
var _a;
|
|
264
|
+
return __generator(this, function (_b) {
|
|
265
|
+
switch (_b.label) {
|
|
266
|
+
case 0:
|
|
267
|
+
_a = file.indexOf("".concat(this.config_.output).concat(path.sep, "functional")) === -1;
|
|
268
|
+
if (!_a) return [3 /*break*/, 2];
|
|
269
|
+
return [4 /*yield*/, this.bundle_checker_.get()];
|
|
270
|
+
case 1:
|
|
271
|
+
_a = (_b.sent())(file) === false;
|
|
272
|
+
_b.label = 2;
|
|
273
|
+
case 2: return [2 /*return*/, _a];
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
return NestiaApplication;
|
|
279
|
+
}());
|
|
280
|
+
exports.NestiaApplication = NestiaApplication;
|
|
281
|
+
//# sourceMappingURL=NestiaApplication.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as tsc from "typescript";
|
|
2
|
+
import { IController } from "../structures/IController";
|
|
3
|
+
import { IRoute } from "../structures/IRoute";
|
|
4
|
+
export declare namespace ControllerAnalyzer {
|
|
5
|
+
function analyze(checker: tsc.TypeChecker, sourceFile: tsc.SourceFile, controller: IController): IRoute[];
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=ControllerAnalyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ControllerAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/ControllerAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAK9C,yBAAiB,kBAAkB,CACnC;IACI,SAAgB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,GAAG,MAAM,EAAE,CAc/G;CA+HJ"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
37
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
38
|
+
if (!m) return o;
|
|
39
|
+
var i = m.call(o), r, ar = [], e;
|
|
40
|
+
try {
|
|
41
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
42
|
+
}
|
|
43
|
+
catch (error) { e = { error: error }; }
|
|
44
|
+
finally {
|
|
45
|
+
try {
|
|
46
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
47
|
+
}
|
|
48
|
+
finally { if (e) throw e.error; }
|
|
49
|
+
}
|
|
50
|
+
return ar;
|
|
51
|
+
};
|
|
52
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
53
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
54
|
+
if (ar || !(i in from)) {
|
|
55
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
56
|
+
ar[i] = from[i];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
60
|
+
};
|
|
61
|
+
var __values = (this && this.__values) || function(o) {
|
|
62
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
63
|
+
if (m) return m.call(o);
|
|
64
|
+
if (o && typeof o.length === "number") return {
|
|
65
|
+
next: function () {
|
|
66
|
+
if (o && i >= o.length) o = void 0;
|
|
67
|
+
return { value: o && o[i++], done: !o };
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
71
|
+
};
|
|
72
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
|
+
exports.ControllerAnalyzer = void 0;
|
|
74
|
+
var NodePath = __importStar(require("path"));
|
|
75
|
+
var tsc = __importStar(require("typescript"));
|
|
76
|
+
var HashMap_1 = require("tstl/container/HashMap");
|
|
77
|
+
var GenericAnalyzer_1 = require("./GenericAnalyzer");
|
|
78
|
+
var ImportAnalyzer_1 = require("./ImportAnalyzer");
|
|
79
|
+
var ControllerAnalyzer;
|
|
80
|
+
(function (ControllerAnalyzer) {
|
|
81
|
+
function analyze(checker, sourceFile, controller) {
|
|
82
|
+
// FIND CONTROLLER CLASS
|
|
83
|
+
var ret = [];
|
|
84
|
+
tsc.forEachChild(sourceFile, function (node) {
|
|
85
|
+
var _a;
|
|
86
|
+
if (tsc.isClassDeclaration(node) && ((_a = node.name) === null || _a === void 0 ? void 0 : _a.escapedText) === controller.name) {
|
|
87
|
+
// ANALYZE THE CONTROLLER
|
|
88
|
+
ret.push.apply(ret, __spreadArray([], __read(_Analyze_controller(checker, controller, node)), false));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return ret;
|
|
93
|
+
}
|
|
94
|
+
ControllerAnalyzer.analyze = analyze;
|
|
95
|
+
/* ---------------------------------------------------------
|
|
96
|
+
CLASS
|
|
97
|
+
--------------------------------------------------------- */
|
|
98
|
+
function _Analyze_controller(checker, controller, classNode) {
|
|
99
|
+
var e_1, _a, e_2, _b;
|
|
100
|
+
var ret = [];
|
|
101
|
+
var classType = checker.getTypeAtLocation(classNode);
|
|
102
|
+
var genericDict = GenericAnalyzer_1.GenericAnalyzer.analyze(checker, classNode);
|
|
103
|
+
try {
|
|
104
|
+
for (var _c = __values(classType.getProperties()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
105
|
+
var property = _d.value;
|
|
106
|
+
if (property.declarations) {
|
|
107
|
+
var _loop_1 = function (declaration) {
|
|
108
|
+
// TARGET ONLY METHOD
|
|
109
|
+
if (!tsc.isMethodDeclaration(declaration))
|
|
110
|
+
return "continue";
|
|
111
|
+
// IT MUST BE
|
|
112
|
+
var identifier = declaration.name;
|
|
113
|
+
if (!tsc.isIdentifier(identifier))
|
|
114
|
+
return "continue";
|
|
115
|
+
// ANALYZED WITH THE REFLECTED-FUNCTION
|
|
116
|
+
var func = controller.functions.find(function (f) { return f.name === identifier.escapedText; });
|
|
117
|
+
if (func !== undefined)
|
|
118
|
+
ret.push(_Analyze_function(checker, controller, genericDict, func, declaration));
|
|
119
|
+
};
|
|
120
|
+
try {
|
|
121
|
+
for (var _e = (e_2 = void 0, __values(property.declarations)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
122
|
+
var declaration = _f.value;
|
|
123
|
+
_loop_1(declaration);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
127
|
+
finally {
|
|
128
|
+
try {
|
|
129
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
130
|
+
}
|
|
131
|
+
finally { if (e_2) throw e_2.error; }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
137
|
+
finally {
|
|
138
|
+
try {
|
|
139
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
140
|
+
}
|
|
141
|
+
finally { if (e_1) throw e_1.error; }
|
|
142
|
+
}
|
|
143
|
+
return ret;
|
|
144
|
+
}
|
|
145
|
+
/* ---------------------------------------------------------
|
|
146
|
+
FUNCTION
|
|
147
|
+
--------------------------------------------------------- */
|
|
148
|
+
function _Analyze_function(checker, controller, genericDict, func, declaration) {
|
|
149
|
+
// PREPARE ASSETS
|
|
150
|
+
var signature = checker.getSignatureFromDeclaration(declaration);
|
|
151
|
+
if (signature === undefined)
|
|
152
|
+
throw new Error("Error on ControllerAnalyzer._Analyze_function(): unable to get the ignature from the ".concat(controller.name, ".").concat(func.name, "()."));
|
|
153
|
+
var importDict = new HashMap_1.HashMap();
|
|
154
|
+
// EXPLORE CHILDREN TYPES
|
|
155
|
+
var parameters = func.parameters.map(function (param) { return _Analyze_parameter(checker, genericDict, importDict, controller, func.name, param, declaration.parameters[param.index]); });
|
|
156
|
+
var output = ImportAnalyzer_1.ImportAnalyzer.analyze(checker, genericDict, importDict, checker.getReturnTypeOfSignature(signature));
|
|
157
|
+
var imports = importDict.toJSON().map(function (pair) { return [pair.first, pair.second.toJSON()]; });
|
|
158
|
+
// CONFIGURE PATH
|
|
159
|
+
var path = NodePath.join(controller.path, func.path).split("\\").join("/");
|
|
160
|
+
if (path[0] !== "/")
|
|
161
|
+
path = "/" + path;
|
|
162
|
+
if (path[path.length - 1] === "/" && path !== "/")
|
|
163
|
+
path = path.substr(0, path.length - 1);
|
|
164
|
+
// RETURNS
|
|
165
|
+
return __assign(__assign({}, func), { path: path, parameters: parameters, output: output, imports: imports, symbol: "".concat(controller.name, ".").concat(func.name, "()"), comments: signature.getDocumentationComment(undefined), tags: signature.getJsDocTags() });
|
|
166
|
+
}
|
|
167
|
+
/* ---------------------------------------------------------
|
|
168
|
+
PARAMETER
|
|
169
|
+
--------------------------------------------------------- */
|
|
170
|
+
function _Analyze_parameter(checker, genericDict, importDict, controller, funcName, param, declaration) {
|
|
171
|
+
var symbol = checker.getSymbolAtLocation(declaration.name);
|
|
172
|
+
var type = checker.getTypeOfSymbolAtLocation(symbol, declaration);
|
|
173
|
+
var name = symbol.getEscapedName().toString();
|
|
174
|
+
// VALIDATE PARAMETERS
|
|
175
|
+
if ((param.category === "query" || param.category === "body") && param.field !== undefined)
|
|
176
|
+
throw new Error("Error on ".concat(controller.name, ".").concat(funcName, "(): parameter ").concat(name, " is specifying a field ").concat(param.field, " of the request ").concat(param.category, " message, however, Nestia does not support the field specialization for the request ").concat(param.category, " message. Erase the ").concat(controller.name, ".").concat(funcName, "()#").concat(name, " parameter and re-define a new decorator accepting full structured message."));
|
|
177
|
+
return {
|
|
178
|
+
name: name,
|
|
179
|
+
category: param.category,
|
|
180
|
+
field: param.field,
|
|
181
|
+
encrypted: param.encrypted,
|
|
182
|
+
type: ImportAnalyzer_1.ImportAnalyzer.analyze(checker, genericDict, importDict, type)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
})(ControllerAnalyzer = exports.ControllerAnalyzer || (exports.ControllerAnalyzer = {}));
|
|
186
|
+
//# sourceMappingURL=ControllerAnalyzer.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as tsc from "typescript";
|
|
2
|
+
export declare namespace GenericAnalyzer {
|
|
3
|
+
type Dictionary = WeakMap<tsc.Type, tsc.Type>;
|
|
4
|
+
function analyze(checker: tsc.TypeChecker, classNode: tsc.ClassDeclaration): Dictionary;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=GenericAnalyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/GenericAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC,yBAAiB,eAAe,CAChC;IACI,KAAY,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAErD,SAAgB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,CAAC,gBAAgB,GAAG,UAAU,CAK7F;CAwCJ"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __values = (this && this.__values) || function(o) {
|
|
26
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
27
|
+
if (m) return m.call(o);
|
|
28
|
+
if (o && typeof o.length === "number") return {
|
|
29
|
+
next: function () {
|
|
30
|
+
if (o && i >= o.length) o = void 0;
|
|
31
|
+
return { value: o && o[i++], done: !o };
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.GenericAnalyzer = void 0;
|
|
38
|
+
var tsc = __importStar(require("typescript"));
|
|
39
|
+
var GenericAnalyzer;
|
|
40
|
+
(function (GenericAnalyzer) {
|
|
41
|
+
function analyze(checker, classNode) {
|
|
42
|
+
var dict = new WeakMap();
|
|
43
|
+
explore(checker, dict, classNode);
|
|
44
|
+
return dict;
|
|
45
|
+
}
|
|
46
|
+
GenericAnalyzer.analyze = analyze;
|
|
47
|
+
function explore(checker, dict, classNode) {
|
|
48
|
+
var e_1, _a, e_2, _b;
|
|
49
|
+
if (classNode.heritageClauses === undefined)
|
|
50
|
+
return;
|
|
51
|
+
try {
|
|
52
|
+
for (var _c = __values(classNode.heritageClauses), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
53
|
+
var heritage = _d.value;
|
|
54
|
+
var _loop_1 = function (hType) {
|
|
55
|
+
// MUST BE CLASS
|
|
56
|
+
var expression = checker.getTypeAtLocation(hType.expression);
|
|
57
|
+
var superNode = expression.symbol.getDeclarations()[0];
|
|
58
|
+
if (!tsc.isClassDeclaration(superNode))
|
|
59
|
+
return "continue";
|
|
60
|
+
// SPECIFY GENERICS
|
|
61
|
+
var usages = if_undefined_array(hType.typeArguments);
|
|
62
|
+
var parameters = if_undefined_array(superNode.typeParameters);
|
|
63
|
+
parameters.forEach(function (param, index) {
|
|
64
|
+
var paramType = checker.getTypeAtLocation(param);
|
|
65
|
+
var usageType = (usages[index] !== undefined)
|
|
66
|
+
? checker.getTypeAtLocation(usages[index])
|
|
67
|
+
: checker.getTypeAtLocation(param.default);
|
|
68
|
+
dict.set(paramType, usageType);
|
|
69
|
+
});
|
|
70
|
+
// RECUSRIVE EXPLORATION
|
|
71
|
+
explore(checker, dict, superNode);
|
|
72
|
+
};
|
|
73
|
+
try {
|
|
74
|
+
for (var _e = (e_2 = void 0, __values(heritage.types)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
75
|
+
var hType = _f.value;
|
|
76
|
+
_loop_1(hType);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
80
|
+
finally {
|
|
81
|
+
try {
|
|
82
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
83
|
+
}
|
|
84
|
+
finally { if (e_2) throw e_2.error; }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
89
|
+
finally {
|
|
90
|
+
try {
|
|
91
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
92
|
+
}
|
|
93
|
+
finally { if (e_1) throw e_1.error; }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function if_undefined_array(array) {
|
|
97
|
+
return array !== undefined ? array : [];
|
|
98
|
+
}
|
|
99
|
+
})(GenericAnalyzer = exports.GenericAnalyzer || (exports.GenericAnalyzer = {}));
|
|
100
|
+
//# sourceMappingURL=GenericAnalyzer.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as tsc from "typescript";
|
|
2
|
+
import { HashMap } from "tstl/container/HashMap";
|
|
3
|
+
import { HashSet } from "tstl/container/HashSet";
|
|
4
|
+
import { GenericAnalyzer } from "./GenericAnalyzer";
|
|
5
|
+
export declare namespace ImportAnalyzer {
|
|
6
|
+
interface IOutput {
|
|
7
|
+
features: [string, string[]][];
|
|
8
|
+
alias: string;
|
|
9
|
+
}
|
|
10
|
+
type Dictionary = HashMap<string, HashSet<string>>;
|
|
11
|
+
function analyze(checker: tsc.TypeChecker, genericDict: GenericAnalyzer.Dictionary, importDict: Dictionary, type: tsc.Type): string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ImportAnalyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/ImportAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,yBAAiB,cAAc,CAC/B;IACI,UAAiB,OAAO;QAEpB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAC/B,KAAK,EAAE,MAAM,CAAC;KACjB;IAED,KAAY,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1D,SAAgB,OAAO,CAEf,OAAO,EAAE,GAAG,CAAC,WAAW,EACxB,WAAW,EAAE,eAAe,CAAC,UAAU,EACvC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,GAAG,CAAC,IAAI,GACf,MAAM,CAGZ;CAmEJ"}
|