@nestia/sdk 12.0.0-dev.20260612.2 → 12.0.0-dev.20260619.1
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/assets/bundle/distribute/package.json +1 -1
- package/lib/factories/ExpressionFactory.d.ts +9 -0
- package/lib/factories/ExpressionFactory.js +16 -0
- package/lib/factories/ExpressionFactory.js.map +1 -0
- package/lib/factories/IdentifierFactory.d.ts +22 -0
- package/lib/factories/IdentifierFactory.js +50 -0
- package/lib/factories/IdentifierFactory.js.map +1 -0
- package/lib/factories/LiteralFactory.d.ts +9 -0
- package/lib/factories/LiteralFactory.js +48 -0
- package/lib/factories/LiteralFactory.js.map +1 -0
- package/lib/factories/StatementFactory.d.ts +14 -0
- package/lib/factories/StatementFactory.js +20 -0
- package/lib/factories/StatementFactory.js.map +1 -0
- package/lib/factories/TypeFactory.d.ts +24 -0
- package/lib/factories/TypeFactory.js +27 -0
- package/lib/factories/TypeFactory.js.map +1 -0
- package/lib/generates/CloneGenerator.js +2 -2
- package/lib/generates/CloneGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.js +30 -29
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/FilePrinter.d.ts +2 -2
- package/lib/generates/internal/FilePrinter.js +14 -25
- package/lib/generates/internal/FilePrinter.js.map +1 -1
- package/lib/generates/internal/ImportDictionary.d.ts +1 -1
- package/lib/generates/internal/ImportDictionary.js +10 -9
- package/lib/generates/internal/ImportDictionary.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +12 -12
- package/lib/generates/internal/SdkAliasCollection.js +23 -25
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.js +2 -2
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.js +3 -3
- package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js +45 -48
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +61 -60
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkHttpParameterProgrammer.js +11 -13
- package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +50 -48
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkMcpRouteProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkMcpRouteProgrammer.js +54 -53
- package/lib/generates/internal/SdkMcpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeProgrammer.d.ts +3 -3
- package/lib/generates/internal/SdkTypeProgrammer.js +42 -43
- package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +2 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.js +7 -9
- package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +45 -47
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +3 -3
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +9 -9
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +34 -40
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
- package/lib/transform.d.ts +5 -9
- package/lib/transform.js +8 -31
- package/lib/transform.js.map +1 -1
- package/package.json +11 -11
- package/src/factories/ExpressionFactory.ts +23 -0
- package/src/factories/IdentifierFactory.ts +84 -0
- package/src/factories/LiteralFactory.ts +54 -0
- package/src/factories/StatementFactory.ts +56 -0
- package/src/factories/TypeFactory.ts +27 -0
- package/src/generates/CloneGenerator.ts +8 -7
- package/src/generates/internal/E2eFileProgrammer.ts +59 -53
- package/src/generates/internal/FilePrinter.ts +28 -36
- package/src/generates/internal/ImportDictionary.ts +19 -21
- package/src/generates/internal/SdkAliasCollection.ts +55 -49
- package/src/generates/internal/SdkFileProgrammer.ts +4 -7
- package/src/generates/internal/SdkHttpCloneProgrammer.ts +11 -13
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +90 -101
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +153 -166
- package/src/generates/internal/SdkHttpParameterProgrammer.ts +15 -17
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +1 -1
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +121 -130
- package/src/generates/internal/SdkMcpRouteProgrammer.ts +135 -140
- package/src/generates/internal/SdkTypeProgrammer.ts +389 -382
- package/src/generates/internal/SdkTypeTagProgrammer.ts +13 -17
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +124 -130
- package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +17 -15
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +112 -139
- package/src/transform.ts +14 -45
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type NumericLiteral, type PrefixUnaryExpression } from "@ttsc/factory";
|
|
2
|
+
/**
|
|
3
|
+
* Numeric-literal helper that handles negative values via a leading
|
|
4
|
+
* `MinusToken` prefix unary, matching how the TypeScript factory itself emits
|
|
5
|
+
* negative numeric literals.
|
|
6
|
+
*/
|
|
7
|
+
export declare namespace ExpressionFactory {
|
|
8
|
+
const number: (value: number) => NumericLiteral | PrefixUnaryExpression;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpressionFactory = void 0;
|
|
4
|
+
const factory_1 = require("@ttsc/factory");
|
|
5
|
+
/**
|
|
6
|
+
* Numeric-literal helper that handles negative values via a leading
|
|
7
|
+
* `MinusToken` prefix unary, matching how the TypeScript factory itself emits
|
|
8
|
+
* negative numeric literals.
|
|
9
|
+
*/
|
|
10
|
+
var ExpressionFactory;
|
|
11
|
+
(function (ExpressionFactory) {
|
|
12
|
+
ExpressionFactory.number = (value) => value < 0
|
|
13
|
+
? factory_1.factory.createPrefixUnaryExpression(factory_1.SyntaxKind.MinusToken, factory_1.factory.createNumericLiteral(Math.abs(value)))
|
|
14
|
+
: factory_1.factory.createNumericLiteral(value);
|
|
15
|
+
})(ExpressionFactory || (exports.ExpressionFactory = ExpressionFactory = {}));
|
|
16
|
+
//# sourceMappingURL=ExpressionFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpressionFactory.js","sourceRoot":"","sources":["../../src/factories/ExpressionFactory.ts"],"names":[],"mappings":";;;AAAA,2CAKuB;AAEvB;;;;GAIG;AACH,IAAiB,iBAAiB,CAUjC;AAVD,WAAiB,iBAAiB;IACnB,wBAAM,GAAG,CACpB,KAAa,EAC2B,EAAE,CAC1C,KAAK,GAAG,CAAC;QACP,CAAC,CAAC,iBAAO,CAAC,2BAA2B,CACjC,oBAAU,CAAC,UAAU,EACrB,iBAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAC9C;QACH,CAAC,CAAC,iBAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,EAVgB,iBAAiB,aAAjB,iBAAiB,GAAjB,iBAAiB,QAUjC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Expression, type Identifier, type ParameterDeclaration, type StringLiteral, type Token, type TypeNode } from "@ttsc/factory";
|
|
2
|
+
/**
|
|
3
|
+
* Identifier and member-access helpers. The surface kept here is the subset
|
|
4
|
+
* nestia generators actually call (`identifier`, `access`, `parameter`).
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace IdentifierFactory {
|
|
7
|
+
/**
|
|
8
|
+
* Build an identifier or string literal depending on whether `name` is a
|
|
9
|
+
* valid JavaScript identifier.
|
|
10
|
+
*/
|
|
11
|
+
const identifier: (name: string) => Identifier | StringLiteral;
|
|
12
|
+
/**
|
|
13
|
+
* Member access on `input` by `key`. Falls back to element access when the
|
|
14
|
+
* key is not a valid identifier.
|
|
15
|
+
*/
|
|
16
|
+
const access: (input: Expression, key: string, chain?: boolean) => Expression;
|
|
17
|
+
/**
|
|
18
|
+
* Parameter declaration with default `any` type when the caller omits one.
|
|
19
|
+
* Passing a `QuestionToken` as `init` marks the parameter optional.
|
|
20
|
+
*/
|
|
21
|
+
const parameter: (name: string | Identifier, type?: TypeNode, init?: Expression | Token) => ParameterDeclaration;
|
|
22
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdentifierFactory = void 0;
|
|
4
|
+
const factory_1 = require("@ttsc/factory");
|
|
5
|
+
const TypeFactory_1 = require("./TypeFactory");
|
|
6
|
+
// Conservative "is this string a syntactically valid JavaScript variable
|
|
7
|
+
// name?" test, inlined to avoid pulling in @typia/utils' full namespace.
|
|
8
|
+
const VARIABLE_REGEX = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
9
|
+
const isVariableName = (str) => VARIABLE_REGEX.test(str);
|
|
10
|
+
/**
|
|
11
|
+
* Identifier and member-access helpers. The surface kept here is the subset
|
|
12
|
+
* nestia generators actually call (`identifier`, `access`, `parameter`).
|
|
13
|
+
*/
|
|
14
|
+
var IdentifierFactory;
|
|
15
|
+
(function (IdentifierFactory) {
|
|
16
|
+
/**
|
|
17
|
+
* Build an identifier or string literal depending on whether `name` is a
|
|
18
|
+
* valid JavaScript identifier.
|
|
19
|
+
*/
|
|
20
|
+
IdentifierFactory.identifier = (name) => isVariableName(name)
|
|
21
|
+
? factory_1.factory.createIdentifier(name)
|
|
22
|
+
: factory_1.factory.createStringLiteral(name);
|
|
23
|
+
/**
|
|
24
|
+
* Member access on `input` by `key`. Falls back to element access when the
|
|
25
|
+
* key is not a valid identifier.
|
|
26
|
+
*/
|
|
27
|
+
IdentifierFactory.access = (input, key, chain) => {
|
|
28
|
+
const postfix = IdentifierFactory.identifier(key);
|
|
29
|
+
if (postfix.kind === "StringLiteral")
|
|
30
|
+
return chain === true
|
|
31
|
+
? factory_1.factory.createElementAccessChain(input, factory_1.factory.createToken(factory_1.SyntaxKind.QuestionDotToken), postfix)
|
|
32
|
+
: factory_1.factory.createElementAccessExpression(input, postfix);
|
|
33
|
+
return chain === true
|
|
34
|
+
? factory_1.factory.createPropertyAccessChain(input, factory_1.factory.createToken(factory_1.SyntaxKind.QuestionDotToken), postfix)
|
|
35
|
+
: factory_1.factory.createPropertyAccessExpression(input, postfix);
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Parameter declaration with default `any` type when the caller omits one.
|
|
39
|
+
* Passing a `QuestionToken` as `init` marks the parameter optional.
|
|
40
|
+
*/
|
|
41
|
+
IdentifierFactory.parameter = (name, type, init) => {
|
|
42
|
+
const isQuestionToken = !!init &&
|
|
43
|
+
init.kind === "Token" &&
|
|
44
|
+
init.token === factory_1.SyntaxKind.QuestionToken;
|
|
45
|
+
return factory_1.factory.createParameterDeclaration(undefined, undefined, name, isQuestionToken
|
|
46
|
+
? factory_1.factory.createToken(factory_1.SyntaxKind.QuestionToken)
|
|
47
|
+
: undefined, type !== null && type !== void 0 ? type : TypeFactory_1.TypeFactory.keyword("any"), isQuestionToken ? undefined : init);
|
|
48
|
+
};
|
|
49
|
+
})(IdentifierFactory || (exports.IdentifierFactory = IdentifierFactory = {}));
|
|
50
|
+
//# sourceMappingURL=IdentifierFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdentifierFactory.js","sourceRoot":"","sources":["../../src/factories/IdentifierFactory.ts"],"names":[],"mappings":";;;AAAA,2CASuB;AAEvB,+CAA4C;AAE5C,yEAAyE;AACzE,yEAAyE;AACzE,MAAM,cAAc,GAAG,4BAA4B,CAAC;AACpD,MAAM,cAAc,GAAG,CAAC,GAAW,EAAW,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE1E;;;GAGG;AACH,IAAiB,iBAAiB,CA6DjC;AA7DD,WAAiB,iBAAiB;IAChC;;;OAGG;IACU,4BAAU,GAAG,CAAC,IAAY,EAA8B,EAAE,CACrE,cAAc,CAAC,IAAI,CAAC;QAClB,CAAC,CAAC,iBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC;QAChC,CAAC,CAAC,iBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAExC;;;OAGG;IACU,wBAAM,GAAG,CACpB,KAAiB,EACjB,GAAW,EACX,KAAe,EACH,EAAE;QACd,MAAM,OAAO,GAAG,4BAAU,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,OAAO,CAAC,IAAI,KAAK,eAAe;YAClC,OAAO,KAAK,KAAK,IAAI;gBACnB,CAAC,CAAC,iBAAO,CAAC,wBAAwB,CAC9B,KAAK,EACL,iBAAO,CAAC,WAAW,CAAC,oBAAU,CAAC,gBAAgB,CAAC,EAChD,OAAO,CACR;gBACH,CAAC,CAAC,iBAAO,CAAC,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC5D,OAAO,KAAK,KAAK,IAAI;YACnB,CAAC,CAAC,iBAAO,CAAC,yBAAyB,CAC/B,KAAK,EACL,iBAAO,CAAC,WAAW,CAAC,oBAAU,CAAC,gBAAgB,CAAC,EAChD,OAAO,CACR;YACH,CAAC,CAAC,iBAAO,CAAC,8BAA8B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC,CAAC;IAEF;;;OAGG;IACU,2BAAS,GAAG,CACvB,IAAyB,EACzB,IAAe,EACf,IAAyB,EACH,EAAE;QACxB,MAAM,eAAe,GACnB,CAAC,CAAC,IAAI;YACN,IAAI,CAAC,IAAI,KAAK,OAAO;YACpB,IAAc,CAAC,KAAK,KAAK,oBAAU,CAAC,aAAa,CAAC;QACrD,OAAO,iBAAO,CAAC,0BAA0B,CACvC,SAAS,EACT,SAAS,EACT,IAAI,EACJ,eAAe;YACb,CAAC,CAAC,iBAAO,CAAC,WAAW,CAAC,oBAAU,CAAC,aAAa,CAAC;YAC/C,CAAC,CAAC,SAAS,EACb,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,yBAAW,CAAC,OAAO,CAAC,KAAK,CAAC,EAClC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAE,IAA+B,CAC/D,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,EA7DgB,iBAAiB,aAAjB,iBAAiB,GAAjB,iBAAiB,QA6DjC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Expression } from "@ttsc/factory";
|
|
2
|
+
/**
|
|
3
|
+
* Recursive value-to-AST-literal builder. Hands back already-AST inputs
|
|
4
|
+
* unchanged (so callers can mix factory output with raw JS values inside the
|
|
5
|
+
* same object/array), and emits the appropriate literal node otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare namespace LiteralFactory {
|
|
8
|
+
const write: (input: any) => Expression;
|
|
9
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LiteralFactory = void 0;
|
|
4
|
+
const factory_1 = require("@ttsc/factory");
|
|
5
|
+
const ExpressionFactory_1 = require("./ExpressionFactory");
|
|
6
|
+
const IdentifierFactory_1 = require("./IdentifierFactory");
|
|
7
|
+
const PASSTHROUGH_KINDS = new Set([
|
|
8
|
+
"ArrowFunction",
|
|
9
|
+
"CallExpression",
|
|
10
|
+
"Identifier",
|
|
11
|
+
]);
|
|
12
|
+
const isNode = (value) => typeof value === "object" &&
|
|
13
|
+
value !== null &&
|
|
14
|
+
typeof value.kind === "string";
|
|
15
|
+
/**
|
|
16
|
+
* Recursive value-to-AST-literal builder. Hands back already-AST inputs
|
|
17
|
+
* unchanged (so callers can mix factory output with raw JS values inside the
|
|
18
|
+
* same object/array), and emits the appropriate literal node otherwise.
|
|
19
|
+
*/
|
|
20
|
+
var LiteralFactory;
|
|
21
|
+
(function (LiteralFactory) {
|
|
22
|
+
LiteralFactory.write = (input) => {
|
|
23
|
+
if (input === null)
|
|
24
|
+
return factory_1.factory.createNull();
|
|
25
|
+
if (isNode(input) && PASSTHROUGH_KINDS.has(input.kind))
|
|
26
|
+
return input;
|
|
27
|
+
if (Array.isArray(input))
|
|
28
|
+
return writeArray(input);
|
|
29
|
+
if (typeof input === "object")
|
|
30
|
+
return writeObject(input);
|
|
31
|
+
if (typeof input === "boolean")
|
|
32
|
+
return input ? factory_1.factory.createTrue() : factory_1.factory.createFalse();
|
|
33
|
+
if (typeof input === "number")
|
|
34
|
+
return ExpressionFactory_1.ExpressionFactory.number(input);
|
|
35
|
+
if (typeof input === "string")
|
|
36
|
+
return factory_1.factory.createStringLiteral(input);
|
|
37
|
+
if (typeof input === "bigint")
|
|
38
|
+
return factory_1.factory.createStringLiteral(input.toString());
|
|
39
|
+
if (typeof input === "function")
|
|
40
|
+
return factory_1.factory.createIdentifier("undefined");
|
|
41
|
+
throw new TypeError("LiteralFactory.write: unsupported input type.");
|
|
42
|
+
};
|
|
43
|
+
const writeObject = (obj) => factory_1.factory.createObjectLiteralExpression(Object.entries(obj)
|
|
44
|
+
.filter(([, value]) => value !== undefined)
|
|
45
|
+
.map(([key, value]) => factory_1.factory.createPropertyAssignment(IdentifierFactory_1.IdentifierFactory.identifier(key), LiteralFactory.write(value))), true);
|
|
46
|
+
const writeArray = (array) => factory_1.factory.createArrayLiteralExpression(array.map(LiteralFactory.write), true);
|
|
47
|
+
})(LiteralFactory || (exports.LiteralFactory = LiteralFactory = {}));
|
|
48
|
+
//# sourceMappingURL=LiteralFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiteralFactory.js","sourceRoot":"","sources":["../../src/factories/LiteralFactory.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AAEzD,2DAAwD;AACxD,2DAAwD;AAExD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS;IACxC,eAAe;IACf,gBAAgB;IAChB,YAAY;CACb,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,CAAC,KAAc,EAAuB,EAAE,CACrD,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ,CAAC;AAEzD;;;;GAIG;AACH,IAAiB,cAAc,CAgC9B;AAhCD,WAAiB,cAAc;IAChB,oBAAK,GAAG,CAAC,KAAU,EAAc,EAAE;QAC9C,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,iBAAO,CAAC,UAAU,EAAE,CAAC;QAChD,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QACrE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;QACnD,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,WAAW,CAAC,KA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AAd,cAAc,QAgC9B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Expression, type TypeNode, type VariableStatement } from "@ttsc/factory";
|
|
2
|
+
/** Variable-statement helpers. `constant` emits `const`, `mut` emits `let`. */
|
|
3
|
+
export declare namespace StatementFactory {
|
|
4
|
+
const mut: (props: {
|
|
5
|
+
name: string;
|
|
6
|
+
type?: TypeNode | undefined;
|
|
7
|
+
initializer?: Expression | undefined;
|
|
8
|
+
}) => VariableStatement;
|
|
9
|
+
const constant: (props: {
|
|
10
|
+
name: string;
|
|
11
|
+
type?: TypeNode | undefined;
|
|
12
|
+
value?: Expression | undefined;
|
|
13
|
+
}) => VariableStatement;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatementFactory = void 0;
|
|
4
|
+
const factory_1 = require("@ttsc/factory");
|
|
5
|
+
const TypeFactory_1 = require("./TypeFactory");
|
|
6
|
+
/** Variable-statement helpers. `constant` emits `const`, `mut` emits `let`. */
|
|
7
|
+
var StatementFactory;
|
|
8
|
+
(function (StatementFactory) {
|
|
9
|
+
StatementFactory.mut = (props) => factory_1.factory.createVariableStatement(undefined, factory_1.factory.createVariableDeclarationList([
|
|
10
|
+
factory_1.factory.createVariableDeclaration(props.name, undefined, props.type !== undefined
|
|
11
|
+
? props.type
|
|
12
|
+
: props.initializer === undefined
|
|
13
|
+
? TypeFactory_1.TypeFactory.keyword("any")
|
|
14
|
+
: undefined, props.initializer),
|
|
15
|
+
], factory_1.NodeFlags.Let));
|
|
16
|
+
StatementFactory.constant = (props) => factory_1.factory.createVariableStatement(undefined, factory_1.factory.createVariableDeclarationList([
|
|
17
|
+
factory_1.factory.createVariableDeclaration(props.name, undefined, props.type, props.value),
|
|
18
|
+
], factory_1.NodeFlags.Const));
|
|
19
|
+
})(StatementFactory || (exports.StatementFactory = StatementFactory = {}));
|
|
20
|
+
//# sourceMappingURL=StatementFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatementFactory.js","sourceRoot":"","sources":["../../src/factories/StatementFactory.ts"],"names":[],"mappings":";;;AAAA,2CAMuB;AAEvB,+CAA4C;AAE5C,+EAA+E;AAC/E,IAAiB,gBAAgB,CA4ChC;AA5CD,WAAiB,gBAAgB;IAClB,oBAAG,GAAG,CAAC,KAInB,EAAqB,EAAE,CACtB,iBAAO,CAAC,uBAAuB,CAC7B,SAAS,EACT,iBAAO,CAAC,6BAA6B,CACnC;QACE,iBAAO,CAAC,yBAAyB,CAC/B,KAAK,CAAC,IAAI,EACV,SAAS,EACT,KAAK,CAAC,IAAI,KAAK,SAAS;YACtB,CAAC,CAAC,KAAK,CAAC,IAAI;YACZ,CAAC,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS;gBAC/B,CAAC,CAAC,yBAAW,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC5B,CAAC,CAAC,SAAS,EACf,KAAK,CAAC,WAAW,CAClB;KACF,EACD,mBAAS,CAAC,GAAG,CACd,CACF,CAAC;IAES,yBAAQ,GAAG,CAAC,KAIxB,EAAqB,EAAE,CACtB,iBAAO,CAAC,uBAAuB,CAC7B,SAAS,EACT,iBAAO,CAAC,6BAA6B,CACnC;QACE,iBAAO,CAAC,yBAAyB,CAC/B,KAAK,CAAC,IAAI,EACV,SAAS,EACT,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,KAAK,CACZ;KACF,EACD,mBAAS,CAAC,KAAK,CAChB,CACF,CAAC;AACN,CAAC,EA5CgB,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QA4ChC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type KeywordTypeNode, SyntaxKind } from "@ttsc/factory";
|
|
2
|
+
/**
|
|
3
|
+
* Higher-level type-keyword factory.
|
|
4
|
+
*
|
|
5
|
+
* Wraps {@link factory.createKeywordTypeNode} with a name-based interface so
|
|
6
|
+
* generator code reads as `TypeFactory.keyword("any")` instead of selecting the
|
|
7
|
+
* `SyntaxKind.AnyKeyword` token by hand.
|
|
8
|
+
*/
|
|
9
|
+
export declare namespace TypeFactory {
|
|
10
|
+
const KEYWORDS: {
|
|
11
|
+
readonly void: SyntaxKind.VoidKeyword;
|
|
12
|
+
readonly any: SyntaxKind.AnyKeyword;
|
|
13
|
+
readonly unknown: SyntaxKind.UnknownKeyword;
|
|
14
|
+
readonly boolean: SyntaxKind.BooleanKeyword;
|
|
15
|
+
readonly number: SyntaxKind.NumberKeyword;
|
|
16
|
+
readonly bigint: SyntaxKind.BigIntKeyword;
|
|
17
|
+
readonly string: SyntaxKind.StringKeyword;
|
|
18
|
+
readonly never: SyntaxKind.NeverKeyword;
|
|
19
|
+
readonly undefined: SyntaxKind.UndefinedKeyword;
|
|
20
|
+
};
|
|
21
|
+
export type Keyword = keyof typeof KEYWORDS;
|
|
22
|
+
export const keyword: (type: Keyword) => KeywordTypeNode;
|
|
23
|
+
export {};
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeFactory = void 0;
|
|
4
|
+
const factory_1 = require("@ttsc/factory");
|
|
5
|
+
/**
|
|
6
|
+
* Higher-level type-keyword factory.
|
|
7
|
+
*
|
|
8
|
+
* Wraps {@link factory.createKeywordTypeNode} with a name-based interface so
|
|
9
|
+
* generator code reads as `TypeFactory.keyword("any")` instead of selecting the
|
|
10
|
+
* `SyntaxKind.AnyKeyword` token by hand.
|
|
11
|
+
*/
|
|
12
|
+
var TypeFactory;
|
|
13
|
+
(function (TypeFactory) {
|
|
14
|
+
const KEYWORDS = {
|
|
15
|
+
void: factory_1.SyntaxKind.VoidKeyword,
|
|
16
|
+
any: factory_1.SyntaxKind.AnyKeyword,
|
|
17
|
+
unknown: factory_1.SyntaxKind.UnknownKeyword,
|
|
18
|
+
boolean: factory_1.SyntaxKind.BooleanKeyword,
|
|
19
|
+
number: factory_1.SyntaxKind.NumberKeyword,
|
|
20
|
+
bigint: factory_1.SyntaxKind.BigIntKeyword,
|
|
21
|
+
string: factory_1.SyntaxKind.StringKeyword,
|
|
22
|
+
never: factory_1.SyntaxKind.NeverKeyword,
|
|
23
|
+
undefined: factory_1.SyntaxKind.UndefinedKeyword,
|
|
24
|
+
};
|
|
25
|
+
TypeFactory.keyword = (type) => factory_1.factory.createKeywordTypeNode(KEYWORDS[type]);
|
|
26
|
+
})(TypeFactory || (exports.TypeFactory = TypeFactory = {}));
|
|
27
|
+
//# sourceMappingURL=TypeFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeFactory.js","sourceRoot":"","sources":["../../src/factories/TypeFactory.ts"],"names":[],"mappings":";;;AAAA,2CAA0E;AAE1E;;;;;;GAMG;AACH,IAAiB,WAAW,CAiB3B;AAjBD,WAAiB,WAAW;IAC1B,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,oBAAU,CAAC,WAAW;QAC5B,GAAG,EAAE,oBAAU,CAAC,UAAU;QAC1B,OAAO,EAAE,oBAAU,CAAC,cAAc;QAClC,OAAO,EAAE,oBAAU,CAAC,cAAc;QAClC,MAAM,EAAE,oBAAU,CAAC,aAAa;QAChC,MAAM,EAAE,oBAAU,CAAC,aAAa;QAChC,MAAM,EAAE,oBAAU,CAAC,aAAa;QAChC,KAAK,EAAE,oBAAU,CAAC,YAAY;QAC9B,SAAS,EAAE,oBAAU,CAAC,gBAAgB;KAC9B,CAAC;IAIE,mBAAO,GAAG,CAAC,IAAa,EAAmB,EAAE,CACxD,iBAAO,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC,EAjBgB,WAAW,aAAX,WAAW,GAAX,WAAW,QAiB3B"}
|
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CloneGenerator = void 0;
|
|
16
|
-
const factory_1 = require("@
|
|
16
|
+
const factory_1 = require("@ttsc/factory");
|
|
17
17
|
const fs_1 = __importDefault(require("fs"));
|
|
18
18
|
const FilePrinter_1 = require("./internal/FilePrinter");
|
|
19
19
|
const ImportDictionary_1 = require("./internal/ImportDictionary");
|
|
@@ -58,7 +58,7 @@ var CloneGenerator;
|
|
|
58
58
|
const internal = [];
|
|
59
59
|
for (const child of modulo.children.values())
|
|
60
60
|
internal.push(...iterate(importer)(child));
|
|
61
|
-
output.push(factory_1.
|
|
61
|
+
output.push(factory_1.factory.createModuleDeclaration([factory_1.factory.createModifier(factory_1.SyntaxKind.ExportKeyword)], factory_1.factory.createIdentifier(modulo.name), factory_1.factory.createModuleBlock(internal), factory_1.NodeFlags.Namespace));
|
|
62
62
|
}
|
|
63
63
|
return output;
|
|
64
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloneGenerator.js","sourceRoot":"","sources":["../../src/generates/CloneGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"CloneGenerator.js","sourceRoot":"","sources":["../../src/generates/CloneGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAMuB;AACvB,4CAAoB;AAIpB,wDAAqD;AACrD,kEAA+D;AAC/D,8EAA2E;AAC3E,8EAA2E;AAC3E,wFAAqF;AAErF,IAAiB,cAAc,CAwD9B;AAxDD,WAAiB,cAAc;IAChB,oBAAK,GAAG,CAAO,GAAsB,EAAiB,EAAE;QACnE,MAAM,IAAI,GACR,+CAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,SAAS,GAAgB,MAAM,yDAA2B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5E,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,SAAS,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U,EAAE;QACjD,MAAM,MAAM,GAAW,EAAE,CAAC;QAC1B,IAAI,MAAM,CAAC,UAAU,KAAK,IAAI;YAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;QACzE,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAW,EAAE,CAAC;YAC5B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;gBAC1C,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7C,MAAM,CAAC,IAAI,CACT,iBAAO,CAAC,uBAAuB,CAC7B,CAAC,iBAAO,CAAC,cAAc,CAAC,oBAAU,CAAC,aAAa,CAAC,CAAC,EAClD,iBAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,EACrC,iBAAO,CAAC,iBAAiB,CAAC,QAAuB,CAAC,EAClD,mBAAS,CAAC,SAAS,CACpB,CACF,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACN,CAAC,EAxDgB,cAAc,aAAd,cAAc,GAAd,cAAc,QAwD9B"}
|
|
@@ -10,8 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.E2eFileProgrammer = void 0;
|
|
13
|
-
const factory_1 = require("@
|
|
14
|
-
const
|
|
13
|
+
const factory_1 = require("@ttsc/factory");
|
|
14
|
+
const IdentifierFactory_1 = require("../../factories/IdentifierFactory");
|
|
15
|
+
const LiteralFactory_1 = require("../../factories/LiteralFactory");
|
|
15
16
|
const FilePrinter_1 = require("./FilePrinter");
|
|
16
17
|
const ImportDictionary_1 = require("./ImportDictionary");
|
|
17
18
|
const SdkAliasCollection_1 = require("./SdkAliasCollection");
|
|
@@ -39,24 +40,24 @@ var E2eFileProgrammer;
|
|
|
39
40
|
],
|
|
40
41
|
});
|
|
41
42
|
});
|
|
42
|
-
const generateFunctor = (project) => (importer) => (route) => factory_1.
|
|
43
|
-
factory_1.
|
|
43
|
+
const generateFunctor = (project) => (importer) => (route) => factory_1.factory.createVariableStatement([factory_1.factory.createModifier(factory_1.SyntaxKind.ExportKeyword)], factory_1.factory.createVariableDeclarationList([
|
|
44
|
+
factory_1.factory.createVariableDeclaration(factory_1.factory.createIdentifier(getFunctionName(route)), undefined, undefined, generateArrow(project)(importer)(route)),
|
|
44
45
|
], factory_1.NodeFlags.Const));
|
|
45
46
|
const generateArrow = (project) => (importer) => (route) => {
|
|
46
|
-
const random =
|
|
47
|
+
const random = IdentifierFactory_1.IdentifierFactory.access(factory_1.factory.createIdentifier(SdkImportWizard_1.SdkImportWizard.typia(importer)), "random");
|
|
47
48
|
const connection = route.headerObject
|
|
48
|
-
? factory_1.
|
|
49
|
-
factory_1.
|
|
50
|
-
factory_1.
|
|
51
|
-
factory_1.
|
|
52
|
-
factory_1.
|
|
53
|
-
project.config.clone === true
|
|
49
|
+
? factory_1.factory.createObjectLiteralExpression([
|
|
50
|
+
factory_1.factory.createSpreadAssignment(factory_1.factory.createIdentifier("connection")),
|
|
51
|
+
factory_1.factory.createPropertyAssignment("headers", factory_1.factory.createObjectLiteralExpression([
|
|
52
|
+
factory_1.factory.createSpreadAssignment(IdentifierFactory_1.IdentifierFactory.access(factory_1.factory.createIdentifier("connection"), "headers")),
|
|
53
|
+
factory_1.factory.createSpreadAssignment(factory_1.factory.createCallExpression(random, [
|
|
54
|
+
(project.config.clone === true
|
|
54
55
|
? SdkAliasCollection_1.SdkAliasCollection.from(project)(importer)(route.headerObject.metadata)
|
|
55
|
-
: SdkAliasCollection_1.SdkAliasCollection.name(route.headerObject),
|
|
56
|
+
: SdkAliasCollection_1.SdkAliasCollection.name(route.headerObject)),
|
|
56
57
|
], undefined)),
|
|
57
58
|
], true)),
|
|
58
59
|
], true)
|
|
59
|
-
: factory_1.
|
|
60
|
+
: factory_1.factory.createIdentifier("connection");
|
|
60
61
|
const entries = SdkHttpParameterProgrammer_1.SdkHttpParameterProgrammer.getEntries({
|
|
61
62
|
project,
|
|
62
63
|
importer,
|
|
@@ -65,45 +66,45 @@ var E2eFileProgrammer;
|
|
|
65
66
|
e2e: true,
|
|
66
67
|
prefix: ["api", "functional", ...route.accessor].join(".") + ".",
|
|
67
68
|
});
|
|
68
|
-
const fetch = factory_1.
|
|
69
|
+
const fetch = factory_1.factory.createCallExpression(factory_1.factory.createIdentifier(["api", "functional", ...route.accessor].join(".")), undefined, [
|
|
69
70
|
connection,
|
|
70
71
|
...(project.config.keyword === true && entries.length !== 0
|
|
71
72
|
? [
|
|
72
|
-
|
|
73
|
+
LiteralFactory_1.LiteralFactory.write(Object.fromEntries(entries.map((e) => [
|
|
73
74
|
e.key,
|
|
74
|
-
factory_1.
|
|
75
|
+
factory_1.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(factory_1.factory.createIdentifier(SdkImportWizard_1.SdkImportWizard.typia(importer)), "random"), [getRandomType(importer)(e)], undefined),
|
|
75
76
|
]))),
|
|
76
77
|
]
|
|
77
|
-
: entries.map((e) => factory_1.
|
|
78
|
+
: entries.map((e) => factory_1.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(factory_1.factory.createIdentifier(SdkImportWizard_1.SdkImportWizard.typia(importer)), "random"), [getRandomType(importer)(e)], undefined))),
|
|
78
79
|
]);
|
|
79
|
-
const assert = factory_1.
|
|
80
|
-
return factory_1.
|
|
81
|
-
|
|
82
|
-
], undefined, undefined, factory_1.
|
|
83
|
-
factory_1.
|
|
84
|
-
factory_1.
|
|
80
|
+
const assert = factory_1.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(factory_1.factory.createIdentifier(SdkImportWizard_1.SdkImportWizard.typia(importer)), "assert"), undefined, [factory_1.factory.createIdentifier("output")]);
|
|
81
|
+
return factory_1.factory.createArrowFunction([factory_1.factory.createModifier(factory_1.SyntaxKind.AsyncKeyword)], undefined, [
|
|
82
|
+
IdentifierFactory_1.IdentifierFactory.parameter("connection", factory_1.factory.createTypeReferenceNode("api.IConnection")),
|
|
83
|
+
], undefined, undefined, factory_1.factory.createBlock([
|
|
84
|
+
factory_1.factory.createVariableStatement([], factory_1.factory.createVariableDeclarationList([
|
|
85
|
+
factory_1.factory.createVariableDeclaration("output", undefined, project.config.propagate !== true &&
|
|
85
86
|
route.success.type.name === "void"
|
|
86
87
|
? undefined
|
|
87
|
-
: SdkAliasCollection_1.SdkAliasCollection.response(project)(importer)(route), factory_1.
|
|
88
|
+
: SdkAliasCollection_1.SdkAliasCollection.response(project)(importer)(route), factory_1.factory.createAwaitExpression(fetch)),
|
|
88
89
|
], factory_1.NodeFlags.Const)),
|
|
89
90
|
...(route.success.binary === true
|
|
90
91
|
? []
|
|
91
|
-
: [factory_1.
|
|
92
|
+
: [factory_1.factory.createExpressionStatement(assert)]),
|
|
92
93
|
]));
|
|
93
94
|
};
|
|
94
95
|
})(E2eFileProgrammer || (exports.E2eFileProgrammer = E2eFileProgrammer = {}));
|
|
95
96
|
const getRandomType = (importer) => (entry) => {
|
|
96
97
|
if (isPlainStringPathParameter(entry) === false)
|
|
97
98
|
return entry.type;
|
|
98
|
-
return factory_1.
|
|
99
|
+
return factory_1.factory.createIntersectionTypeNode([
|
|
99
100
|
entry.type,
|
|
100
|
-
factory_1.
|
|
101
|
+
factory_1.factory.createTypeReferenceNode(factory_1.factory.createQualifiedName(factory_1.factory.createIdentifier(importer.external({
|
|
101
102
|
declaration: true,
|
|
102
103
|
file: "typia",
|
|
103
104
|
type: "element",
|
|
104
105
|
name: "tags",
|
|
105
|
-
})), factory_1.
|
|
106
|
-
factory_1.
|
|
106
|
+
})), factory_1.factory.createIdentifier("MinLength")), [
|
|
107
|
+
factory_1.factory.createLiteralTypeNode(LiteralFactory_1.LiteralFactory.write(1)),
|
|
107
108
|
]),
|
|
108
109
|
]);
|
|
109
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2eFileProgrammer.js","sourceRoot":"","sources":["../../../src/generates/internal/E2eFileProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"E2eFileProgrammer.js","sourceRoot":"","sources":["../../../src/generates/internal/E2eFileProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAOuB;AAEvB,yEAAsE;AACtE,mEAAgE;AAGhE,+CAA4C;AAC5C,yDAAsD;AACtD,6DAA0D;AAC1D,6EAA0E;AAC1E,uDAAoD;AAEpD,IAAiB,iBAAiB,CAyLjC;AAzLD,WAAiB,iBAAiB;IACnB,0BAAQ,GACnB,CAAC,OAAuB,EAAE,EAAE,CAC5B,CAAC,KAAuC,EAAE,EAAE,CAC5C,CAAO,KAAsB,EAAiB,EAAE;QAC9C,MAAM,QAAQ,GAAqB,IAAI,mCAAgB,CACrD,GAAG,KAAK,CAAC,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,KAAK,CAChD,CAAC;QACF,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI;YAAE,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxE,QAAQ,CAAC,QAAQ,CAAC;YAChB,IAAI,EAAE,KAAK,CAAC,GAAG;YACf,WAAW,EAAE,KAAK;YAClB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QACH,MAAM,OAAO,GAAS,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC;QAChE,MAAM,yBAAW,CAAC,KAAK,CAAC;YACtB,QAAQ,EAAE,QAAQ,CAAC,IAAI;YACvB,UAAU,EAAE;gBACV,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;g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AAO;IACpC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;IAC7C,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,IAAI,KAAK,QAAQ;IACtD,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CACtD,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,CAC7C,CAAC;AAEJ,MAAM,eAAe,GAAG,CAAC,KAAsB,EAAU,EAAE,CACzD,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Node } from "@
|
|
1
|
+
import { type Node } from "@ttsc/factory";
|
|
2
2
|
export declare namespace FilePrinter {
|
|
3
3
|
const description: <T extends Node>(node: T, comment: string) => T;
|
|
4
|
-
const enter: () =>
|
|
4
|
+
const enter: () => import("@ttsc/factory").ExpressionStatement;
|
|
5
5
|
const write: (props: {
|
|
6
6
|
location: string;
|
|
7
7
|
statements: Node[];
|
|
@@ -13,40 +13,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.FilePrinter = void 0;
|
|
16
|
-
const factory_1 = require("@
|
|
16
|
+
const factory_1 = require("@ttsc/factory");
|
|
17
17
|
const fs_1 = __importDefault(require("fs"));
|
|
18
18
|
const prettier_1 = require("prettier");
|
|
19
19
|
var FilePrinter;
|
|
20
20
|
(function (FilePrinter) {
|
|
21
21
|
FilePrinter.description = (node, comment) => {
|
|
22
|
-
var _a, _b;
|
|
23
22
|
if (comment.length === 0)
|
|
24
23
|
return node;
|
|
25
|
-
(
|
|
26
|
-
|
|
27
|
-
...
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.join("\n")
|
|
35
|
-
.split("\n")
|
|
36
|
-
.map((str) => ` * ${str.split("*/").join("*\\\\/").split("*\\/").join("*\\\\/")}`),
|
|
37
|
-
"",
|
|
38
|
-
].join("\n"),
|
|
39
|
-
hasTrailingNewLine: true,
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
return node;
|
|
24
|
+
return (0, factory_1.addSyntheticLeadingComment)(node, factory_1.SyntaxKind.MultiLineCommentTrivia, [
|
|
25
|
+
"*",
|
|
26
|
+
...comment
|
|
27
|
+
.split("\r\n")
|
|
28
|
+
.join("\n")
|
|
29
|
+
.split("\n")
|
|
30
|
+
.map((str) => ` * ${str.split("*/").join("*\\\\/").split("*\\/").join("*\\\\/")}`),
|
|
31
|
+
"",
|
|
32
|
+
].join("\n"), true);
|
|
43
33
|
};
|
|
44
|
-
FilePrinter.enter = () => factory_1.
|
|
34
|
+
FilePrinter.enter = () => factory_1.factory.createExpressionStatement(factory_1.factory.createIdentifier("\n"));
|
|
45
35
|
FilePrinter.write = (props) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
36
|
+
var _a;
|
|
37
|
+
const script = ((_a = props.top) !== null && _a !== void 0 ? _a : "") +
|
|
38
|
+
new factory_1.TsPrinter().printFile(undefined, props.statements);
|
|
50
39
|
yield fs_1.default.promises.writeFile(props.location, yield beautify(script), "utf8");
|
|
51
40
|
});
|
|
52
41
|
const beautify = (script) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePrinter.js","sourceRoot":"","sources":["../../../src/generates/internal/FilePrinter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
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AC;IAC9E,CAAC,CAAA,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAO,MAAc,EAAmB,EAAE;QACzD,IAAI,CAAC;YACH,OAAO,MAAM,IAAA,iBAAM,EAAC,MAAM,EAAE;gBAC1B,MAAM,EAAE,YAAY;aACrB,CAAC,CAAC;QACL,CAAC;mBAAO,CAAC;YACP,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA7CgB,WAAW,aAAX,WAAW,GAAX,WAAW,QA6C3B"}
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ImportDictionary = void 0;
|
|
7
|
-
const factory_1 = require("@
|
|
7
|
+
const factory_1 = require("@ttsc/factory");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const tstl_1 = require("tstl");
|
|
10
10
|
const ImportAnalyzer_1 = require("../../analyses/ImportAnalyzer");
|
|
@@ -90,7 +90,7 @@ class ImportDictionary {
|
|
|
90
90
|
.map((e) => (Object.assign(Object.assign({}, e.second), { file: locator(e.second.file) })))
|
|
91
91
|
.sort((a, b) => a.file.localeCompare(b.file));
|
|
92
92
|
for (const c of compositions)
|
|
93
|
-
container.push(factory_1.
|
|
93
|
+
container.push(factory_1.factory.createImportDeclaration(undefined, this.toImportClaude(c), factory_1.factory.createStringLiteral(c.file)));
|
|
94
94
|
};
|
|
95
95
|
enroll((str) => str.indexOf(NODE_MODULES) !== -1)(external);
|
|
96
96
|
enroll((str) => str.indexOf(NODE_MODULES) === -1)(internal);
|
|
@@ -101,14 +101,15 @@ class ImportDictionary {
|
|
|
101
101
|
];
|
|
102
102
|
}
|
|
103
103
|
toImportClaude(c) {
|
|
104
|
+
// A namespace import cannot carry a per-binding `type` modifier, so the
|
|
105
|
+
// type-only flag stays off here (a value namespace import resolves type
|
|
106
|
+
// members fine), matching the legacy printer output `import * as X`.
|
|
104
107
|
if (c.asterisk !== null)
|
|
105
|
-
return factory_1.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
? factory_1.
|
|
110
|
-
? factory_1.TypeScriptFactory.createIdentifier(name)
|
|
111
|
-
: undefined, factory_1.TypeScriptFactory.createIdentifier(alias !== null && alias !== void 0 ? alias : name))))
|
|
108
|
+
return factory_1.factory.createImportClause(false, undefined, factory_1.factory.createNamespaceImport(factory_1.factory.createIdentifier(c.asterisk)));
|
|
109
|
+
// `c.declaration` (type-only) belongs on the import clause, not on each
|
|
110
|
+
// specifier — emitting both produces the invalid `import type { type X }`.
|
|
111
|
+
return factory_1.factory.createImportClause(c.declaration, c.default !== null ? factory_1.factory.createIdentifier(c.default) : undefined, c.elements.size() !== 0
|
|
112
|
+
? factory_1.factory.createNamedImports(Array.from(c.elements).map(({ first: name, second: alias }) => factory_1.factory.createImportSpecifier(false, alias !== null ? factory_1.factory.createIdentifier(name) : undefined, factory_1.factory.createIdentifier(alias !== null && alias !== void 0 ? alias : name))))
|
|
112
113
|
: undefined);
|
|
113
114
|
}
|
|
114
115
|
}
|