nestia 3.0.15 → 3.0.16-dev.20220930
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/lib/IConfiguration.d.ts +110 -110
- package/lib/IConfiguration.js +2 -2
- package/lib/NestiaApplication.d.ts +11 -11
- package/lib/NestiaApplication.js +155 -155
- package/lib/analyses/ControllerAnalyzer.d.ts +6 -6
- package/lib/analyses/ControllerAnalyzer.js +105 -105
- package/lib/analyses/GenericAnalyzer.d.ts +5 -5
- package/lib/analyses/GenericAnalyzer.js +40 -40
- package/lib/analyses/ImportAnalyzer.d.ts +13 -13
- package/lib/analyses/ImportAnalyzer.js +83 -83
- package/lib/analyses/PathAnalyzer.d.ts +5 -5
- package/lib/analyses/PathAnalyzer.js +50 -50
- package/lib/analyses/ReflectAnalyzer.d.ts +4 -4
- package/lib/analyses/ReflectAnalyzer.js +229 -229
- package/lib/analyses/SourceFinder.d.ts +4 -4
- package/lib/analyses/SourceFinder.js +69 -69
- package/lib/executable/internal/CompilerOptions.d.ts +11 -11
- package/lib/executable/internal/CompilerOptions.js +17 -17
- package/lib/executable/internal/NestiaCommand.d.ts +4 -4
- package/lib/executable/internal/NestiaCommand.js +127 -127
- package/lib/executable/internal/NestiaConfig.d.ts +4 -4
- package/lib/executable/internal/NestiaConfig.js +521 -521
- package/lib/executable/internal/nestia.config.getter.d.ts +1 -1
- package/lib/executable/internal/nestia.config.getter.js +23 -23
- package/lib/executable/nestia.d.ts +2 -2
- package/lib/executable/nestia.js +54 -54
- package/lib/generates/FileGenerator.d.ts +5 -5
- package/lib/generates/FileGenerator.js +136 -136
- package/lib/generates/FunctionGenerator.d.ts +5 -5
- package/lib/generates/FunctionGenerator.js +203 -203
- package/lib/generates/SdkGenerator.d.ts +7 -7
- package/lib/generates/SdkGenerator.js +46 -46
- package/lib/generates/SwaggerGenerator.d.ts +6 -6
- package/lib/generates/SwaggerGenerator.js +235 -235
- package/lib/index.d.ts +2 -2
- package/lib/index.js +27 -27
- package/lib/module.d.ts +2 -2
- package/lib/module.js +18 -18
- package/lib/structures/IController.d.ts +23 -23
- package/lib/structures/IController.js +2 -2
- package/lib/structures/IRoute.d.ts +24 -24
- package/lib/structures/IRoute.js +2 -2
- package/lib/structures/ISwagger.d.ts +48 -48
- package/lib/structures/ISwagger.js +2 -2
- package/lib/structures/ITypeTuple.d.ts +5 -5
- package/lib/structures/ITypeTuple.js +2 -2
- package/lib/structures/MethodType.d.ts +4 -4
- package/lib/structures/MethodType.js +13 -13
- package/lib/structures/ParamCategory.d.ts +1 -1
- package/lib/structures/ParamCategory.js +2 -2
- package/lib/structures/TypeEntry.d.ts +9 -9
- package/lib/structures/TypeEntry.js +20 -20
- package/lib/utils/ArrayUtil.d.ts +5 -5
- package/lib/utils/ArrayUtil.js +38 -38
- package/lib/utils/DirectoryUtil.d.ts +5 -5
- package/lib/utils/DirectoryUtil.js +61 -61
- package/lib/utils/ImportDictionary.d.ts +6 -6
- package/lib/utils/ImportDictionary.js +49 -49
- package/lib/utils/MapUtil.d.ts +3 -3
- package/lib/utils/MapUtil.js +15 -15
- package/lib/utils/StripEnums.d.ts +3 -3
- package/lib/utils/StripEnums.js +2 -2
- package/package.json +1 -1
- package/preliminaries/nestia.config.ts +70 -70
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { ITypeTuple } from "./ITypeTuple";
|
|
3
|
-
import { ParamCategory } from "./ParamCategory";
|
|
4
|
-
export interface IRoute {
|
|
5
|
-
name: string;
|
|
6
|
-
method: string;
|
|
7
|
-
path: string;
|
|
8
|
-
encrypted: boolean;
|
|
9
|
-
parameters: IRoute.IParameter[];
|
|
10
|
-
imports: [string, string[]][];
|
|
11
|
-
output: ITypeTuple;
|
|
12
|
-
symbol: string;
|
|
13
|
-
comments: ts.SymbolDisplayPart[];
|
|
14
|
-
tags: ts.JSDocTagInfo[];
|
|
15
|
-
}
|
|
16
|
-
export declare namespace IRoute {
|
|
17
|
-
interface IParameter {
|
|
18
|
-
name: string;
|
|
19
|
-
field: string | undefined;
|
|
20
|
-
category: ParamCategory;
|
|
21
|
-
encrypted: boolean;
|
|
22
|
-
type: ITypeTuple;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { ITypeTuple } from "./ITypeTuple";
|
|
3
|
+
import { ParamCategory } from "./ParamCategory";
|
|
4
|
+
export interface IRoute {
|
|
5
|
+
name: string;
|
|
6
|
+
method: string;
|
|
7
|
+
path: string;
|
|
8
|
+
encrypted: boolean;
|
|
9
|
+
parameters: IRoute.IParameter[];
|
|
10
|
+
imports: [string, string[]][];
|
|
11
|
+
output: ITypeTuple;
|
|
12
|
+
symbol: string;
|
|
13
|
+
comments: ts.SymbolDisplayPart[];
|
|
14
|
+
tags: ts.JSDocTagInfo[];
|
|
15
|
+
}
|
|
16
|
+
export declare namespace IRoute {
|
|
17
|
+
interface IParameter {
|
|
18
|
+
name: string;
|
|
19
|
+
field: string | undefined;
|
|
20
|
+
category: ParamCategory;
|
|
21
|
+
encrypted: boolean;
|
|
22
|
+
type: ITypeTuple;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/lib/structures/IRoute.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=IRoute.js.map
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { IJsonComponents, IJsonSchema } from "typescript-json";
|
|
2
|
-
export interface ISwagger {
|
|
3
|
-
openapi: "3.0";
|
|
4
|
-
servers: ISwagger.IServer[];
|
|
5
|
-
info: ISwagger.IInfo;
|
|
6
|
-
paths: Record<string, ISwagger.IPath>;
|
|
7
|
-
components: IJsonComponents;
|
|
8
|
-
}
|
|
9
|
-
export declare namespace ISwagger {
|
|
10
|
-
type IPath = Record<string, IRoute>;
|
|
11
|
-
interface IRoute {
|
|
12
|
-
description: string;
|
|
13
|
-
tags: string[];
|
|
14
|
-
parameters: IParameter[];
|
|
15
|
-
responses: IResponseBody;
|
|
16
|
-
requestBody?: IRequestBody;
|
|
17
|
-
summary?: string;
|
|
18
|
-
}
|
|
19
|
-
interface IInfo {
|
|
20
|
-
version: string;
|
|
21
|
-
title: string;
|
|
22
|
-
}
|
|
23
|
-
interface IParameter {
|
|
24
|
-
name: string;
|
|
25
|
-
in: string;
|
|
26
|
-
schema: IJsonSchema;
|
|
27
|
-
required: true;
|
|
28
|
-
description: string;
|
|
29
|
-
}
|
|
30
|
-
interface IRequestBody {
|
|
31
|
-
description: string;
|
|
32
|
-
content: IJsonContent;
|
|
33
|
-
required: true;
|
|
34
|
-
}
|
|
35
|
-
type IResponseBody = Record<string, {
|
|
36
|
-
description: string;
|
|
37
|
-
content?: IJsonContent;
|
|
38
|
-
}>;
|
|
39
|
-
interface IServer {
|
|
40
|
-
url: string;
|
|
41
|
-
description?: string;
|
|
42
|
-
}
|
|
43
|
-
interface IJsonContent {
|
|
44
|
-
"application/json": {
|
|
45
|
-
schema: IJsonSchema;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
import { IJsonComponents, IJsonSchema } from "typescript-json";
|
|
2
|
+
export interface ISwagger {
|
|
3
|
+
openapi: "3.0";
|
|
4
|
+
servers: ISwagger.IServer[];
|
|
5
|
+
info: ISwagger.IInfo;
|
|
6
|
+
paths: Record<string, ISwagger.IPath>;
|
|
7
|
+
components: IJsonComponents;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace ISwagger {
|
|
10
|
+
type IPath = Record<string, IRoute>;
|
|
11
|
+
interface IRoute {
|
|
12
|
+
description: string;
|
|
13
|
+
tags: string[];
|
|
14
|
+
parameters: IParameter[];
|
|
15
|
+
responses: IResponseBody;
|
|
16
|
+
requestBody?: IRequestBody;
|
|
17
|
+
summary?: string;
|
|
18
|
+
}
|
|
19
|
+
interface IInfo {
|
|
20
|
+
version: string;
|
|
21
|
+
title: string;
|
|
22
|
+
}
|
|
23
|
+
interface IParameter {
|
|
24
|
+
name: string;
|
|
25
|
+
in: string;
|
|
26
|
+
schema: IJsonSchema;
|
|
27
|
+
required: true;
|
|
28
|
+
description: string;
|
|
29
|
+
}
|
|
30
|
+
interface IRequestBody {
|
|
31
|
+
description: string;
|
|
32
|
+
content: IJsonContent;
|
|
33
|
+
required: true;
|
|
34
|
+
}
|
|
35
|
+
type IResponseBody = Record<string, {
|
|
36
|
+
description: string;
|
|
37
|
+
content?: IJsonContent;
|
|
38
|
+
}>;
|
|
39
|
+
interface IServer {
|
|
40
|
+
url: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
}
|
|
43
|
+
interface IJsonContent {
|
|
44
|
+
"application/json": {
|
|
45
|
+
schema: IJsonSchema;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=ISwagger.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
export interface ITypeTuple {
|
|
3
|
-
type: ts.Type;
|
|
4
|
-
name: string;
|
|
5
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
export interface ITypeTuple {
|
|
3
|
+
type: ts.Type;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=ITypeTuple.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare type MethodType = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
2
|
-
export declare namespace MethodType {
|
|
3
|
-
const VALUES: MethodType[];
|
|
4
|
-
}
|
|
1
|
+
export declare type MethodType = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
2
|
+
export declare namespace MethodType {
|
|
3
|
+
const VALUES: MethodType[];
|
|
4
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MethodType = void 0;
|
|
4
|
-
var MethodType;
|
|
5
|
-
(function (MethodType) {
|
|
6
|
-
MethodType.VALUES = [
|
|
7
|
-
"GET",
|
|
8
|
-
"POST",
|
|
9
|
-
"PUT",
|
|
10
|
-
"PATCH",
|
|
11
|
-
"DELETE",
|
|
12
|
-
];
|
|
13
|
-
})(MethodType = exports.MethodType || (exports.MethodType = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MethodType = void 0;
|
|
4
|
+
var MethodType;
|
|
5
|
+
(function (MethodType) {
|
|
6
|
+
MethodType.VALUES = [
|
|
7
|
+
"GET",
|
|
8
|
+
"POST",
|
|
9
|
+
"PUT",
|
|
10
|
+
"PATCH",
|
|
11
|
+
"DELETE",
|
|
12
|
+
];
|
|
13
|
+
})(MethodType = exports.MethodType || (exports.MethodType = {}));
|
|
14
14
|
//# sourceMappingURL=MethodType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare type ParamCategory = "param" | "query" | "body";
|
|
1
|
+
export declare type ParamCategory = "param" | "query" | "body";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=ParamCategory.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
export declare class TypeEntry {
|
|
3
|
-
readonly type: ts.Type;
|
|
4
|
-
readonly nullable: boolean;
|
|
5
|
-
readonly required: boolean;
|
|
6
|
-
constructor(type: ts.Type, nullable: boolean, required: boolean);
|
|
7
|
-
equals(obj: TypeEntry): boolean;
|
|
8
|
-
hashCode(): number;
|
|
9
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
export declare class TypeEntry {
|
|
3
|
+
readonly type: ts.Type;
|
|
4
|
+
readonly nullable: boolean;
|
|
5
|
+
readonly required: boolean;
|
|
6
|
+
constructor(type: ts.Type, nullable: boolean, required: boolean);
|
|
7
|
+
equals(obj: TypeEntry): boolean;
|
|
8
|
+
hashCode(): number;
|
|
9
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TypeEntry = void 0;
|
|
4
|
-
const hash_1 = require("tstl/functional/hash");
|
|
5
|
-
class TypeEntry {
|
|
6
|
-
constructor(type, nullable, required) {
|
|
7
|
-
this.type = type;
|
|
8
|
-
this.nullable = nullable;
|
|
9
|
-
this.required = required;
|
|
10
|
-
}
|
|
11
|
-
equals(obj) {
|
|
12
|
-
return (this.type === obj.type &&
|
|
13
|
-
this.nullable === obj.nullable &&
|
|
14
|
-
this.required === obj.required);
|
|
15
|
-
}
|
|
16
|
-
hashCode() {
|
|
17
|
-
return (0, hash_1.hash)(this.type, this.nullable, this.required);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.TypeEntry = TypeEntry;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeEntry = void 0;
|
|
4
|
+
const hash_1 = require("tstl/functional/hash");
|
|
5
|
+
class TypeEntry {
|
|
6
|
+
constructor(type, nullable, required) {
|
|
7
|
+
this.type = type;
|
|
8
|
+
this.nullable = nullable;
|
|
9
|
+
this.required = required;
|
|
10
|
+
}
|
|
11
|
+
equals(obj) {
|
|
12
|
+
return (this.type === obj.type &&
|
|
13
|
+
this.nullable === obj.nullable &&
|
|
14
|
+
this.required === obj.required);
|
|
15
|
+
}
|
|
16
|
+
hashCode() {
|
|
17
|
+
return (0, hash_1.hash)(this.type, this.nullable, this.required);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.TypeEntry = TypeEntry;
|
|
21
21
|
//# sourceMappingURL=TypeEntry.js.map
|
package/lib/utils/ArrayUtil.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare namespace ArrayUtil {
|
|
2
|
-
function has<T>(array: T[], ...items: T[]): boolean;
|
|
3
|
-
function asyncMap<Input, Output>(array: Input[], closure: (input: Input) => Promise<Output>): Promise<Output[]>;
|
|
4
|
-
function asyncFilter<Input>(array: Input[], closure: (input: Input) => Promise<boolean>): Promise<Input[]>;
|
|
5
|
-
}
|
|
1
|
+
export declare namespace ArrayUtil {
|
|
2
|
+
function has<T>(array: T[], ...items: T[]): boolean;
|
|
3
|
+
function asyncMap<Input, Output>(array: Input[], closure: (input: Input) => Promise<Output>): Promise<Output[]>;
|
|
4
|
+
function asyncFilter<Input>(array: Input[], closure: (input: Input) => Promise<boolean>): Promise<Input[]>;
|
|
5
|
+
}
|
package/lib/utils/ArrayUtil.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ArrayUtil = void 0;
|
|
13
|
-
var ArrayUtil;
|
|
14
|
-
(function (ArrayUtil) {
|
|
15
|
-
function has(array, ...items) {
|
|
16
|
-
return items.every((elem) => array.find((org) => org === elem) !== undefined);
|
|
17
|
-
}
|
|
18
|
-
ArrayUtil.has = has;
|
|
19
|
-
function asyncMap(array, closure) {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const ret = [];
|
|
22
|
-
for (const elem of array)
|
|
23
|
-
ret.push(yield closure(elem));
|
|
24
|
-
return ret;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
ArrayUtil.asyncMap = asyncMap;
|
|
28
|
-
function asyncFilter(array, closure) {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const ret = [];
|
|
31
|
-
for (const elem of array)
|
|
32
|
-
if ((yield closure(elem)) === true)
|
|
33
|
-
ret.push(elem);
|
|
34
|
-
return ret;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
ArrayUtil.asyncFilter = asyncFilter;
|
|
38
|
-
})(ArrayUtil = exports.ArrayUtil || (exports.ArrayUtil = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ArrayUtil = void 0;
|
|
13
|
+
var ArrayUtil;
|
|
14
|
+
(function (ArrayUtil) {
|
|
15
|
+
function has(array, ...items) {
|
|
16
|
+
return items.every((elem) => array.find((org) => org === elem) !== undefined);
|
|
17
|
+
}
|
|
18
|
+
ArrayUtil.has = has;
|
|
19
|
+
function asyncMap(array, closure) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const ret = [];
|
|
22
|
+
for (const elem of array)
|
|
23
|
+
ret.push(yield closure(elem));
|
|
24
|
+
return ret;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
ArrayUtil.asyncMap = asyncMap;
|
|
28
|
+
function asyncFilter(array, closure) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const ret = [];
|
|
31
|
+
for (const elem of array)
|
|
32
|
+
if ((yield closure(elem)) === true)
|
|
33
|
+
ret.push(elem);
|
|
34
|
+
return ret;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
ArrayUtil.asyncFilter = asyncFilter;
|
|
38
|
+
})(ArrayUtil = exports.ArrayUtil || (exports.ArrayUtil = {}));
|
|
39
39
|
//# sourceMappingURL=ArrayUtil.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare namespace DirectoryUtil {
|
|
2
|
-
function remove(path: string): Promise<void>;
|
|
3
|
-
function remake(path: string): Promise<void>;
|
|
4
|
-
function copy(from: string, to: string): Promise<void>;
|
|
5
|
-
}
|
|
1
|
+
export declare namespace DirectoryUtil {
|
|
2
|
+
function remove(path: string): Promise<void>;
|
|
3
|
+
function remake(path: string): Promise<void>;
|
|
4
|
+
function copy(from: string, to: string): Promise<void>;
|
|
5
|
+
}
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.DirectoryUtil = void 0;
|
|
16
|
-
const del_1 = __importDefault(require("del"));
|
|
17
|
-
const fs_1 = __importDefault(require("fs"));
|
|
18
|
-
var DirectoryUtil;
|
|
19
|
-
(function (DirectoryUtil) {
|
|
20
|
-
function remove(path) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
try {
|
|
23
|
-
yield (0, del_1.default)(path);
|
|
24
|
-
}
|
|
25
|
-
catch (_a) { }
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
DirectoryUtil.remove = remove;
|
|
29
|
-
function remake(path) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
yield remove(path);
|
|
32
|
-
yield fs_1.default.promises.mkdir(path);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
DirectoryUtil.remake = remake;
|
|
36
|
-
function copy(from, to) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
yield remake(to);
|
|
39
|
-
yield _Copy(from, to);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
DirectoryUtil.copy = copy;
|
|
43
|
-
function _Copy(from, to) {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const directory = yield fs_1.default.promises.readdir(from);
|
|
46
|
-
for (const file of directory) {
|
|
47
|
-
const fromPath = `${from}/${file}`;
|
|
48
|
-
const toPath = `${to}/${file}`;
|
|
49
|
-
const stats = yield fs_1.default.promises.stat(fromPath);
|
|
50
|
-
if (stats.isDirectory() === true) {
|
|
51
|
-
yield fs_1.default.promises.mkdir(toPath);
|
|
52
|
-
yield _Copy(fromPath, toPath);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
const content = yield fs_1.default.promises.readFile(fromPath, "utf8");
|
|
56
|
-
yield fs_1.default.promises.writeFile(toPath, content.split("\r\n").join("\n"), "utf8");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
})(DirectoryUtil = exports.DirectoryUtil || (exports.DirectoryUtil = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DirectoryUtil = void 0;
|
|
16
|
+
const del_1 = __importDefault(require("del"));
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
var DirectoryUtil;
|
|
19
|
+
(function (DirectoryUtil) {
|
|
20
|
+
function remove(path) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
try {
|
|
23
|
+
yield (0, del_1.default)(path);
|
|
24
|
+
}
|
|
25
|
+
catch (_a) { }
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
DirectoryUtil.remove = remove;
|
|
29
|
+
function remake(path) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
yield remove(path);
|
|
32
|
+
yield fs_1.default.promises.mkdir(path);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
DirectoryUtil.remake = remake;
|
|
36
|
+
function copy(from, to) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
yield remake(to);
|
|
39
|
+
yield _Copy(from, to);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
DirectoryUtil.copy = copy;
|
|
43
|
+
function _Copy(from, to) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const directory = yield fs_1.default.promises.readdir(from);
|
|
46
|
+
for (const file of directory) {
|
|
47
|
+
const fromPath = `${from}/${file}`;
|
|
48
|
+
const toPath = `${to}/${file}`;
|
|
49
|
+
const stats = yield fs_1.default.promises.stat(fromPath);
|
|
50
|
+
if (stats.isDirectory() === true) {
|
|
51
|
+
yield fs_1.default.promises.mkdir(toPath);
|
|
52
|
+
yield _Copy(fromPath, toPath);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const content = yield fs_1.default.promises.readFile(fromPath, "utf8");
|
|
56
|
+
yield fs_1.default.promises.writeFile(toPath, content.split("\r\n").join("\n"), "utf8");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
})(DirectoryUtil = exports.DirectoryUtil || (exports.DirectoryUtil = {}));
|
|
62
62
|
//# sourceMappingURL=DirectoryUtil.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare class ImportDictionary {
|
|
2
|
-
private readonly dict_;
|
|
3
|
-
empty(): boolean;
|
|
4
|
-
emplace(file: string, realistic: boolean, instance: string): void;
|
|
5
|
-
toScript(outDir: string): string;
|
|
6
|
-
}
|
|
1
|
+
export declare class ImportDictionary {
|
|
2
|
+
private readonly dict_;
|
|
3
|
+
empty(): boolean;
|
|
4
|
+
emplace(file: string, realistic: boolean, instance: string): void;
|
|
5
|
+
toScript(outDir: string): string;
|
|
6
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ImportDictionary = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const HashMap_1 = require("tstl/container/HashMap");
|
|
9
|
-
const HashSet_1 = require("tstl/container/HashSet");
|
|
10
|
-
const Pair_1 = require("tstl/utility/Pair");
|
|
11
|
-
class ImportDictionary {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.dict_ = new HashMap_1.HashMap();
|
|
14
|
-
}
|
|
15
|
-
empty() {
|
|
16
|
-
return this.dict_.empty();
|
|
17
|
-
}
|
|
18
|
-
emplace(file, realistic, instance) {
|
|
19
|
-
if (file.substr(-5) === ".d.ts")
|
|
20
|
-
file = file.substr(0, file.length - 5);
|
|
21
|
-
else if (file.substr(-3) === ".ts")
|
|
22
|
-
file = file.substr(0, file.length - 3);
|
|
23
|
-
else
|
|
24
|
-
throw new Error(`Error on ImportDictionary.emplace(): extension of the target file "${file}" is not "ts".`);
|
|
25
|
-
const pair = this.dict_.take(file, () => new Pair_1.Pair(realistic, new HashSet_1.HashSet()));
|
|
26
|
-
pair.second.insert(instance);
|
|
27
|
-
}
|
|
28
|
-
toScript(outDir) {
|
|
29
|
-
const statements = [];
|
|
30
|
-
for (const it of this.dict_) {
|
|
31
|
-
const file = (() => {
|
|
32
|
-
const location = path_1.default
|
|
33
|
-
.relative(outDir, it.first)
|
|
34
|
-
.split("\\")
|
|
35
|
-
.join("/");
|
|
36
|
-
const index = location.lastIndexOf(NODE_MODULES);
|
|
37
|
-
return index === -1
|
|
38
|
-
? `./${location}`
|
|
39
|
-
: location.substring(index + NODE_MODULES.length);
|
|
40
|
-
})();
|
|
41
|
-
const realistic = it.second.first;
|
|
42
|
-
const instances = it.second.second.toJSON();
|
|
43
|
-
statements.push(`import ${!realistic ? "type " : ""}{ ${instances.join(", ")} } from "${file}";`);
|
|
44
|
-
}
|
|
45
|
-
return statements.join("\n");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.ImportDictionary = ImportDictionary;
|
|
49
|
-
const NODE_MODULES = "node_modules/";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ImportDictionary = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const HashMap_1 = require("tstl/container/HashMap");
|
|
9
|
+
const HashSet_1 = require("tstl/container/HashSet");
|
|
10
|
+
const Pair_1 = require("tstl/utility/Pair");
|
|
11
|
+
class ImportDictionary {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.dict_ = new HashMap_1.HashMap();
|
|
14
|
+
}
|
|
15
|
+
empty() {
|
|
16
|
+
return this.dict_.empty();
|
|
17
|
+
}
|
|
18
|
+
emplace(file, realistic, instance) {
|
|
19
|
+
if (file.substr(-5) === ".d.ts")
|
|
20
|
+
file = file.substr(0, file.length - 5);
|
|
21
|
+
else if (file.substr(-3) === ".ts")
|
|
22
|
+
file = file.substr(0, file.length - 3);
|
|
23
|
+
else
|
|
24
|
+
throw new Error(`Error on ImportDictionary.emplace(): extension of the target file "${file}" is not "ts".`);
|
|
25
|
+
const pair = this.dict_.take(file, () => new Pair_1.Pair(realistic, new HashSet_1.HashSet()));
|
|
26
|
+
pair.second.insert(instance);
|
|
27
|
+
}
|
|
28
|
+
toScript(outDir) {
|
|
29
|
+
const statements = [];
|
|
30
|
+
for (const it of this.dict_) {
|
|
31
|
+
const file = (() => {
|
|
32
|
+
const location = path_1.default
|
|
33
|
+
.relative(outDir, it.first)
|
|
34
|
+
.split("\\")
|
|
35
|
+
.join("/");
|
|
36
|
+
const index = location.lastIndexOf(NODE_MODULES);
|
|
37
|
+
return index === -1
|
|
38
|
+
? `./${location}`
|
|
39
|
+
: location.substring(index + NODE_MODULES.length);
|
|
40
|
+
})();
|
|
41
|
+
const realistic = it.second.first;
|
|
42
|
+
const instances = it.second.second.toJSON();
|
|
43
|
+
statements.push(`import ${!realistic ? "type " : ""}{ ${instances.join(", ")} } from "${file}";`);
|
|
44
|
+
}
|
|
45
|
+
return statements.join("\n");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.ImportDictionary = ImportDictionary;
|
|
49
|
+
const NODE_MODULES = "node_modules/";
|
|
50
50
|
//# sourceMappingURL=ImportDictionary.js.map
|
package/lib/utils/MapUtil.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare namespace MapUtil {
|
|
2
|
-
function take<Key, T>(dict: Map<Key, T>, key: Key, generator: () => T): T;
|
|
3
|
-
}
|
|
1
|
+
export declare namespace MapUtil {
|
|
2
|
+
function take<Key, T>(dict: Map<Key, T>, key: Key, generator: () => T): T;
|
|
3
|
+
}
|