@nestia/migrate 11.2.1 → 12.0.0-dev.20260520.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/lib/NestiaMigrateApplication.d.ts +1 -12
- package/lib/NestiaMigrateApplication.js +22 -24873
- package/lib/NestiaMigrateApplication.js.map +1 -1
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -1
- package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.js +5 -5
- package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
- package/lib/bundles/SDK_TEMPLATE.js +4 -4
- package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
- package/lib/executable/NestiaMigrateCommander.js +14 -5
- package/lib/executable/NestiaMigrateCommander.js.map +1 -1
- package/lib/executable/NestiaMigrateInquirer.js.map +1 -1
- package/lib/factories/TypeLiteralFactory.d.ts +1 -1
- package/lib/factories/TypeLiteralFactory.js +49 -13
- package/lib/factories/TypeLiteralFactory.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +177 -24588
- package/lib/index.mjs.map +1 -1
- package/lib/internal/ts.d.ts +32 -0
- package/lib/internal/ts.js +37 -0
- package/lib/internal/ts.js.map +1 -0
- package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +1 -1
- package/lib/programmers/NestiaMigrateApiFileProgrammer.js +2 -5
- package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +1 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +87 -49
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +2 -2
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +80 -82
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.js +3 -2
- package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +2 -2
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +39 -37
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiStartProgrammer.js +33 -35
- package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +1 -1
- package/lib/programmers/NestiaMigrateDtoProgrammer.js +17 -19
- package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +1 -1
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +26 -23
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +1 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.js +11 -14
- package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +1 -1
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +16 -18
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +1 -1
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +128 -132
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +1 -1
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +10 -9
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestProgrammer.js +3 -2
- package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +2 -2
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js +114 -81
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
- package/lib/structures/INestiaMigrateConfig.d.ts +1 -1
- package/lib/utils/FilePrinter.d.ts +2 -2
- package/lib/utils/FilePrinter.js +8 -10
- package/lib/utils/FilePrinter.js.map +1 -1
- package/lib/utils/MapUtil.js.map +1 -1
- package/lib/utils/StringUtil.d.ts +0 -1
- package/lib/utils/StringUtil.js +0 -1
- package/lib/utils/StringUtil.js.map +1 -1
- package/package.json +9 -11
- package/src/NestiaMigrateApplication.ts +29 -30
- package/src/bundles/NEST_TEMPLATE.ts +5 -5
- package/src/bundles/SDK_TEMPLATE.ts +4 -4
- package/src/executable/NestiaMigrateCommander.ts +15 -4
- package/src/executable/bundle.js +237 -4
- package/src/factories/TypeLiteralFactory.ts +22 -16
- package/src/internal/ts.ts +94 -0
- package/src/programmers/NestiaMigrateApiFileProgrammer.ts +7 -4
- package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +88 -68
- package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +122 -111
- package/src/programmers/NestiaMigrateApiProgrammer.ts +6 -5
- package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +67 -61
- package/src/programmers/NestiaMigrateApiStartProgrammer.ts +46 -45
- package/src/programmers/NestiaMigrateDtoProgrammer.ts +4 -3
- package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +33 -30
- package/src/programmers/NestiaMigrateE2eProgrammer.ts +1 -1
- package/src/programmers/NestiaMigrateImportProgrammer.ts +20 -19
- package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +8 -7
- package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +82 -77
- package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +18 -17
- package/src/programmers/NestiaMigrateNestProgrammer.ts +6 -5
- package/src/programmers/NestiaMigrateSchemaProgrammer.ts +54 -42
- package/src/structures/INestiaMigrateConfig.ts +1 -1
- package/src/utils/FilePrinter.ts +9 -14
- package/src/utils/StringUtil.ts +0 -5
- package/lib/structures/INestiaMigrateDto.d.ts +0 -7
- package/lib/structures/INestiaMigrateDto.js +0 -3
- package/lib/structures/INestiaMigrateDto.js.map +0 -1
- package/lib/structures/INestiaMigrateProgram.d.ts +0 -9
- package/lib/structures/INestiaMigrateProgram.js +0 -3
- package/lib/structures/INestiaMigrateProgram.js.map +0 -1
- package/lib/structures/INestiaMigrateSchema.d.ts +0 -4
- package/lib/structures/INestiaMigrateSchema.js +0 -3
- package/lib/structures/INestiaMigrateSchema.js.map +0 -1
- package/lib/utils/SetupWizard.d.ts +0 -3
- package/lib/utils/SetupWizard.js +0 -18
- package/lib/utils/SetupWizard.js.map +0 -1
- package/lib/utils/openapi-down-convert/RefVisitor.d.ts +0 -52
- package/lib/utils/openapi-down-convert/RefVisitor.js +0 -102
- package/lib/utils/openapi-down-convert/RefVisitor.js.map +0 -1
- package/lib/utils/openapi-down-convert/converter.d.ts +0 -146
- package/lib/utils/openapi-down-convert/converter.js +0 -441
- package/lib/utils/openapi-down-convert/converter.js.map +0 -1
- package/src/structures/INestiaMigrateDto.ts +0 -8
- package/src/structures/INestiaMigrateProgram.ts +0 -11
- package/src/structures/INestiaMigrateSchema.ts +0 -4
- package/src/utils/SetupWizard.ts +0 -12
- package/src/utils/openapi-down-convert/RefVisitor.ts +0 -134
- package/src/utils/openapi-down-convert/converter.ts +0 -536
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { TypeScriptFactory } from "@nestia/factory";
|
|
1
2
|
import {
|
|
2
3
|
ExpressionFactory,
|
|
3
4
|
IdentifierFactory,
|
|
4
5
|
LiteralFactory,
|
|
5
6
|
TypeFactory,
|
|
6
|
-
} from "@
|
|
7
|
+
} from "@nestia/factory";
|
|
7
8
|
import { IHttpMigrateRoute } from "@typia/interface";
|
|
8
|
-
import ts from "
|
|
9
|
+
import ts from "../internal/ts";
|
|
9
10
|
import { OpenApi } from "typia";
|
|
10
11
|
|
|
11
12
|
import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
|
|
@@ -24,10 +25,10 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
24
25
|
|
|
25
26
|
export const write = (ctx: IContext): ts.ModuleDeclaration => {
|
|
26
27
|
const types: ts.TypeAliasDeclaration[] = writeTypes(ctx);
|
|
27
|
-
return
|
|
28
|
-
[
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
return TypeScriptFactory.createModuleDeclaration(
|
|
29
|
+
[TypeScriptFactory.createToken(ts.SyntaxKind.ExportKeyword)],
|
|
30
|
+
TypeScriptFactory.createIdentifier(ctx.route.accessor.at(-1)!),
|
|
31
|
+
TypeScriptFactory.createModuleBlock([
|
|
31
32
|
...types,
|
|
32
33
|
...(types.length ? [FilePrinter.newLine()] : []),
|
|
33
34
|
writeMetadata(ctx),
|
|
@@ -48,15 +49,15 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
48
49
|
config: INestiaMigrateConfig,
|
|
49
50
|
route: IHttpMigrateRoute,
|
|
50
51
|
) =>
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
TypeScriptFactory.createCallExpression(
|
|
53
|
+
TypeScriptFactory.createIdentifier(`${route.accessor.at(-1)!}.path`),
|
|
53
54
|
undefined,
|
|
54
55
|
route.parameters.length === 0 && route.query === null
|
|
55
56
|
? []
|
|
56
57
|
: config.keyword === true
|
|
57
|
-
? [
|
|
58
|
+
? [TypeScriptFactory.createIdentifier("props")]
|
|
58
59
|
: [...route.parameters, ...(route.query ? [route.query] : [])].map(
|
|
59
|
-
(p) =>
|
|
60
|
+
(p) => TypeScriptFactory.createIdentifier(p.key),
|
|
60
61
|
),
|
|
61
62
|
);
|
|
62
63
|
|
|
@@ -64,8 +65,8 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
64
65
|
const array: ts.TypeAliasDeclaration[] = [];
|
|
65
66
|
const declare = (name: string, type: ts.TypeNode) =>
|
|
66
67
|
array.push(
|
|
67
|
-
|
|
68
|
-
[
|
|
68
|
+
TypeScriptFactory.createTypeAliasDeclaration(
|
|
69
|
+
[TypeScriptFactory.createModifier(ts.SyntaxKind.ExportKeyword)],
|
|
69
70
|
name,
|
|
70
71
|
undefined,
|
|
71
72
|
type,
|
|
@@ -164,41 +165,43 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
164
165
|
const writeMetadata = (ctx: IContext): ts.VariableStatement =>
|
|
165
166
|
constant(
|
|
166
167
|
"METADATA",
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
TypeScriptFactory.createAsExpression(
|
|
169
|
+
TypeScriptFactory.createObjectLiteralExpression(
|
|
169
170
|
[
|
|
170
|
-
|
|
171
|
+
TypeScriptFactory.createPropertyAssignment(
|
|
171
172
|
"method",
|
|
172
|
-
|
|
173
|
+
TypeScriptFactory.createStringLiteral(
|
|
174
|
+
ctx.route.method.toUpperCase(),
|
|
175
|
+
),
|
|
173
176
|
),
|
|
174
|
-
|
|
177
|
+
TypeScriptFactory.createPropertyAssignment(
|
|
175
178
|
"path",
|
|
176
|
-
|
|
179
|
+
TypeScriptFactory.createStringLiteral(getPath(ctx.route)),
|
|
177
180
|
),
|
|
178
|
-
|
|
181
|
+
TypeScriptFactory.createPropertyAssignment(
|
|
179
182
|
"request",
|
|
180
183
|
ctx.route.body
|
|
181
184
|
? LiteralFactory.write({
|
|
182
185
|
type: ctx.route.body.type,
|
|
183
186
|
encrypted: !!ctx.route.body["x-nestia-encrypted"],
|
|
184
187
|
})
|
|
185
|
-
:
|
|
188
|
+
: TypeScriptFactory.createNull(),
|
|
186
189
|
),
|
|
187
|
-
|
|
190
|
+
TypeScriptFactory.createPropertyAssignment(
|
|
188
191
|
"response",
|
|
189
192
|
ctx.route.method.toUpperCase() !== "HEAD"
|
|
190
193
|
? LiteralFactory.write({
|
|
191
194
|
type: ctx.route.success?.type ?? "application/json",
|
|
192
195
|
encrypted: !!ctx.route.success?.["x-nestia-encrypted"],
|
|
193
196
|
})
|
|
194
|
-
:
|
|
197
|
+
: TypeScriptFactory.createNull(),
|
|
195
198
|
),
|
|
196
199
|
...(ctx.route.success?.type === "application/x-www-form-urlencoded"
|
|
197
200
|
? [
|
|
198
|
-
|
|
201
|
+
TypeScriptFactory.createPropertyAssignment(
|
|
199
202
|
"parseQuery",
|
|
200
|
-
|
|
201
|
-
|
|
203
|
+
TypeScriptFactory.createCallExpression(
|
|
204
|
+
TypeScriptFactory.createIdentifier(
|
|
202
205
|
`${ctx.importer.external({
|
|
203
206
|
type: "default",
|
|
204
207
|
library: "typia",
|
|
@@ -220,8 +223,8 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
220
223
|
],
|
|
221
224
|
true,
|
|
222
225
|
),
|
|
223
|
-
|
|
224
|
-
|
|
226
|
+
TypeScriptFactory.createTypeReferenceNode(
|
|
227
|
+
TypeScriptFactory.createIdentifier("const"),
|
|
225
228
|
),
|
|
226
229
|
),
|
|
227
230
|
);
|
|
@@ -231,12 +234,15 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
231
234
|
ctx.route.parameters.length === 0 && ctx.route.query === null;
|
|
232
235
|
const property = (key: string) =>
|
|
233
236
|
ctx.config.keyword === true
|
|
234
|
-
? IdentifierFactory.access(
|
|
235
|
-
|
|
237
|
+
? IdentifierFactory.access(
|
|
238
|
+
TypeScriptFactory.createIdentifier("props"),
|
|
239
|
+
key,
|
|
240
|
+
)
|
|
241
|
+
: TypeScriptFactory.createIdentifier(key);
|
|
236
242
|
const out = (body: ts.ConciseBody) =>
|
|
237
243
|
constant(
|
|
238
244
|
"path",
|
|
239
|
-
|
|
245
|
+
TypeScriptFactory.createArrowFunction(
|
|
240
246
|
[],
|
|
241
247
|
[],
|
|
242
248
|
empty
|
|
@@ -246,13 +252,15 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
246
252
|
IdentifierFactory.parameter(
|
|
247
253
|
"props",
|
|
248
254
|
ctx.route.body
|
|
249
|
-
?
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
255
|
+
? TypeScriptFactory.createTypeReferenceNode("Omit", [
|
|
256
|
+
TypeScriptFactory.createTypeReferenceNode("Props"),
|
|
257
|
+
TypeScriptFactory.createLiteralTypeNode(
|
|
258
|
+
TypeScriptFactory.createStringLiteral(
|
|
259
|
+
ctx.route.body.key,
|
|
260
|
+
),
|
|
253
261
|
),
|
|
254
262
|
])
|
|
255
|
-
:
|
|
263
|
+
: TypeScriptFactory.createTypeReferenceNode("Props"),
|
|
256
264
|
),
|
|
257
265
|
]
|
|
258
266
|
: [
|
|
@@ -270,7 +278,7 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
270
278
|
? [
|
|
271
279
|
IdentifierFactory.parameter(
|
|
272
280
|
ctx.route.query.key,
|
|
273
|
-
|
|
281
|
+
TypeScriptFactory.createTypeReferenceNode(
|
|
274
282
|
`${ctx.route.accessor.at(-1)!}.Query`,
|
|
275
283
|
),
|
|
276
284
|
),
|
|
@@ -285,28 +293,31 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
285
293
|
const template = () => {
|
|
286
294
|
const path: string = getPath(ctx.route);
|
|
287
295
|
const split: string[] = path.split(":");
|
|
288
|
-
if (split.length === 1)
|
|
289
|
-
|
|
290
|
-
|
|
296
|
+
if (split.length === 1)
|
|
297
|
+
return TypeScriptFactory.createStringLiteral(path);
|
|
298
|
+
return TypeScriptFactory.createTemplateExpression(
|
|
299
|
+
TypeScriptFactory.createTemplateHead(split[0]!),
|
|
291
300
|
split.slice(1).map((s, i, arr) => {
|
|
292
301
|
const name: string = s.split("/")[0]!;
|
|
293
|
-
return
|
|
294
|
-
|
|
295
|
-
|
|
302
|
+
return TypeScriptFactory.createTemplateSpan(
|
|
303
|
+
TypeScriptFactory.createCallExpression(
|
|
304
|
+
TypeScriptFactory.createIdentifier("encodeURIComponent"),
|
|
296
305
|
undefined,
|
|
297
306
|
[
|
|
298
|
-
|
|
307
|
+
TypeScriptFactory.createBinaryExpression(
|
|
299
308
|
property(
|
|
300
309
|
ctx.route.parameters.find((p) => p.name === name)!.key,
|
|
301
310
|
),
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
TypeScriptFactory.createToken(
|
|
312
|
+
ts.SyntaxKind.QuestionQuestionToken,
|
|
313
|
+
),
|
|
314
|
+
TypeScriptFactory.createStringLiteral("null"),
|
|
304
315
|
),
|
|
305
316
|
],
|
|
306
317
|
),
|
|
307
318
|
(i !== arr.length - 1
|
|
308
|
-
?
|
|
309
|
-
:
|
|
319
|
+
? TypeScriptFactory.createTemplateMiddle
|
|
320
|
+
: TypeScriptFactory.createTemplateTail)(s.substring(name.length)),
|
|
310
321
|
);
|
|
311
322
|
}),
|
|
312
323
|
);
|
|
@@ -319,33 +330,33 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
319
330
|
: str;
|
|
320
331
|
const variables: string = computeName("variables");
|
|
321
332
|
return out(
|
|
322
|
-
|
|
333
|
+
TypeScriptFactory.createBlock(
|
|
323
334
|
[
|
|
324
335
|
local({
|
|
325
336
|
name: variables,
|
|
326
337
|
type: "URLSearchParams",
|
|
327
|
-
expression:
|
|
328
|
-
|
|
338
|
+
expression: TypeScriptFactory.createNewExpression(
|
|
339
|
+
TypeScriptFactory.createIdentifier("URLSearchParams"),
|
|
329
340
|
[],
|
|
330
341
|
[],
|
|
331
342
|
),
|
|
332
343
|
}),
|
|
333
|
-
|
|
344
|
+
TypeScriptFactory.createForOfStatement(
|
|
334
345
|
undefined,
|
|
335
|
-
|
|
346
|
+
TypeScriptFactory.createVariableDeclarationList(
|
|
336
347
|
[
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
348
|
+
TypeScriptFactory.createVariableDeclaration(
|
|
349
|
+
TypeScriptFactory.createArrayBindingPattern([
|
|
350
|
+
TypeScriptFactory.createBindingElement(
|
|
340
351
|
undefined,
|
|
341
352
|
undefined,
|
|
342
|
-
|
|
353
|
+
TypeScriptFactory.createIdentifier("key"),
|
|
343
354
|
undefined,
|
|
344
355
|
),
|
|
345
|
-
|
|
356
|
+
TypeScriptFactory.createBindingElement(
|
|
346
357
|
undefined,
|
|
347
358
|
undefined,
|
|
348
|
-
|
|
359
|
+
TypeScriptFactory.createIdentifier("value"),
|
|
349
360
|
undefined,
|
|
350
361
|
),
|
|
351
362
|
]),
|
|
@@ -356,54 +367,54 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
356
367
|
],
|
|
357
368
|
ts.NodeFlags.Const,
|
|
358
369
|
),
|
|
359
|
-
|
|
360
|
-
|
|
370
|
+
TypeScriptFactory.createCallExpression(
|
|
371
|
+
TypeScriptFactory.createIdentifier("Object.entries"),
|
|
361
372
|
undefined,
|
|
362
373
|
[
|
|
363
|
-
|
|
374
|
+
TypeScriptFactory.createAsExpression(
|
|
364
375
|
property(ctx.route.query.key),
|
|
365
376
|
TypeFactory.keyword("any"),
|
|
366
377
|
),
|
|
367
378
|
],
|
|
368
379
|
),
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
380
|
+
TypeScriptFactory.createIfStatement(
|
|
381
|
+
TypeScriptFactory.createStrictEquality(
|
|
382
|
+
TypeScriptFactory.createIdentifier("undefined"),
|
|
383
|
+
TypeScriptFactory.createIdentifier("value"),
|
|
373
384
|
),
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
385
|
+
TypeScriptFactory.createContinueStatement(),
|
|
386
|
+
TypeScriptFactory.createIfStatement(
|
|
387
|
+
TypeScriptFactory.createCallExpression(
|
|
388
|
+
TypeScriptFactory.createIdentifier("Array.isArray"),
|
|
378
389
|
undefined,
|
|
379
|
-
[
|
|
390
|
+
[TypeScriptFactory.createIdentifier("value")],
|
|
380
391
|
),
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
392
|
+
TypeScriptFactory.createExpressionStatement(
|
|
393
|
+
TypeScriptFactory.createCallExpression(
|
|
394
|
+
TypeScriptFactory.createPropertyAccessExpression(
|
|
395
|
+
TypeScriptFactory.createIdentifier("value"),
|
|
396
|
+
TypeScriptFactory.createIdentifier("forEach"),
|
|
386
397
|
),
|
|
387
398
|
undefined,
|
|
388
399
|
[
|
|
389
|
-
|
|
400
|
+
TypeScriptFactory.createArrowFunction(
|
|
390
401
|
undefined,
|
|
391
402
|
undefined,
|
|
392
403
|
[IdentifierFactory.parameter("elem")],
|
|
393
404
|
undefined,
|
|
394
405
|
undefined,
|
|
395
|
-
|
|
406
|
+
TypeScriptFactory.createCallExpression(
|
|
396
407
|
IdentifierFactory.access(
|
|
397
|
-
|
|
408
|
+
TypeScriptFactory.createIdentifier(variables),
|
|
398
409
|
"append",
|
|
399
410
|
),
|
|
400
411
|
undefined,
|
|
401
412
|
[
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
413
|
+
TypeScriptFactory.createIdentifier("key"),
|
|
414
|
+
TypeScriptFactory.createCallExpression(
|
|
415
|
+
TypeScriptFactory.createIdentifier("String"),
|
|
405
416
|
undefined,
|
|
406
|
-
[
|
|
417
|
+
[TypeScriptFactory.createIdentifier("elem")],
|
|
407
418
|
),
|
|
408
419
|
],
|
|
409
420
|
),
|
|
@@ -411,19 +422,19 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
411
422
|
],
|
|
412
423
|
),
|
|
413
424
|
),
|
|
414
|
-
|
|
415
|
-
|
|
425
|
+
TypeScriptFactory.createExpressionStatement(
|
|
426
|
+
TypeScriptFactory.createCallExpression(
|
|
416
427
|
IdentifierFactory.access(
|
|
417
|
-
|
|
428
|
+
TypeScriptFactory.createIdentifier(variables),
|
|
418
429
|
"set",
|
|
419
430
|
),
|
|
420
431
|
undefined,
|
|
421
432
|
[
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
433
|
+
TypeScriptFactory.createIdentifier("key"),
|
|
434
|
+
TypeScriptFactory.createCallExpression(
|
|
435
|
+
TypeScriptFactory.createIdentifier("String"),
|
|
425
436
|
undefined,
|
|
426
|
-
[
|
|
437
|
+
[TypeScriptFactory.createIdentifier("value")],
|
|
427
438
|
),
|
|
428
439
|
],
|
|
429
440
|
),
|
|
@@ -436,35 +447,35 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
436
447
|
type: "string",
|
|
437
448
|
expression: template(),
|
|
438
449
|
}),
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
450
|
+
TypeScriptFactory.createReturnStatement(
|
|
451
|
+
TypeScriptFactory.createConditionalExpression(
|
|
452
|
+
TypeScriptFactory.createStrictEquality(
|
|
442
453
|
ExpressionFactory.number(0),
|
|
443
454
|
IdentifierFactory.access(
|
|
444
|
-
|
|
455
|
+
TypeScriptFactory.createIdentifier(variables),
|
|
445
456
|
"size",
|
|
446
457
|
),
|
|
447
458
|
),
|
|
448
459
|
undefined,
|
|
449
|
-
|
|
460
|
+
TypeScriptFactory.createIdentifier("location"),
|
|
450
461
|
undefined,
|
|
451
|
-
|
|
452
|
-
|
|
462
|
+
TypeScriptFactory.createTemplateExpression(
|
|
463
|
+
TypeScriptFactory.createTemplateHead(""),
|
|
453
464
|
[
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
465
|
+
TypeScriptFactory.createTemplateSpan(
|
|
466
|
+
TypeScriptFactory.createIdentifier("location"),
|
|
467
|
+
TypeScriptFactory.createTemplateMiddle("?"),
|
|
457
468
|
),
|
|
458
|
-
|
|
459
|
-
|
|
469
|
+
TypeScriptFactory.createTemplateSpan(
|
|
470
|
+
TypeScriptFactory.createCallExpression(
|
|
460
471
|
IdentifierFactory.access(
|
|
461
|
-
|
|
472
|
+
TypeScriptFactory.createIdentifier(variables),
|
|
462
473
|
"toString",
|
|
463
474
|
),
|
|
464
475
|
undefined,
|
|
465
476
|
undefined,
|
|
466
477
|
),
|
|
467
|
-
|
|
478
|
+
TypeScriptFactory.createTemplateTail(""),
|
|
468
479
|
),
|
|
469
480
|
],
|
|
470
481
|
),
|
|
@@ -478,11 +489,11 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
|
|
|
478
489
|
}
|
|
479
490
|
|
|
480
491
|
const constant = (name: string, expression: ts.Expression) =>
|
|
481
|
-
|
|
482
|
-
[
|
|
483
|
-
|
|
492
|
+
TypeScriptFactory.createVariableStatement(
|
|
493
|
+
[TypeScriptFactory.createModifier(ts.SyntaxKind.ExportKeyword)],
|
|
494
|
+
TypeScriptFactory.createVariableDeclarationList(
|
|
484
495
|
[
|
|
485
|
-
|
|
496
|
+
TypeScriptFactory.createVariableDeclaration(
|
|
486
497
|
name,
|
|
487
498
|
undefined,
|
|
488
499
|
undefined,
|
|
@@ -501,14 +512,14 @@ const local = (props: {
|
|
|
501
512
|
type: string;
|
|
502
513
|
expression: ts.Expression;
|
|
503
514
|
}) =>
|
|
504
|
-
|
|
515
|
+
TypeScriptFactory.createVariableStatement(
|
|
505
516
|
[],
|
|
506
|
-
|
|
517
|
+
TypeScriptFactory.createVariableDeclarationList(
|
|
507
518
|
[
|
|
508
|
-
|
|
519
|
+
TypeScriptFactory.createVariableDeclaration(
|
|
509
520
|
props.name,
|
|
510
521
|
undefined,
|
|
511
|
-
|
|
522
|
+
TypeScriptFactory.createTypeReferenceNode(props.type),
|
|
512
523
|
props.expression,
|
|
513
524
|
),
|
|
514
525
|
],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { TypeScriptFactory } from "@nestia/factory";
|
|
1
2
|
import { HashMap, hash } from "tstl";
|
|
2
|
-
import ts from "
|
|
3
|
+
import ts from "../internal/ts";
|
|
3
4
|
|
|
4
5
|
import { INestiaMigrateContext } from "../structures/INestiaMigrateContext";
|
|
5
6
|
import { FilePrinter } from "../utils/FilePrinter";
|
|
@@ -93,10 +94,10 @@ export namespace NestiaMigrateApiProgrammer {
|
|
|
93
94
|
for (const child of modulo.children.values())
|
|
94
95
|
internal.push(...iterate(importer, child));
|
|
95
96
|
output.push(
|
|
96
|
-
|
|
97
|
-
[
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
TypeScriptFactory.createModuleDeclaration(
|
|
98
|
+
[TypeScriptFactory.createModifier(ts.SyntaxKind.ExportKeyword)],
|
|
99
|
+
TypeScriptFactory.createIdentifier(modulo.name),
|
|
100
|
+
TypeScriptFactory.createModuleBlock(internal),
|
|
100
101
|
ts.NodeFlags.Namespace,
|
|
101
102
|
),
|
|
102
103
|
);
|