@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.
Files changed (119) hide show
  1. package/lib/NestiaMigrateApplication.d.ts +1 -12
  2. package/lib/NestiaMigrateApplication.js +22 -24873
  3. package/lib/NestiaMigrateApplication.js.map +1 -1
  4. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -1
  5. package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
  6. package/lib/bundles/NEST_TEMPLATE.js +5 -5
  7. package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
  8. package/lib/bundles/SDK_TEMPLATE.js +4 -4
  9. package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
  10. package/lib/executable/NestiaMigrateCommander.js +14 -5
  11. package/lib/executable/NestiaMigrateCommander.js.map +1 -1
  12. package/lib/executable/NestiaMigrateInquirer.js.map +1 -1
  13. package/lib/factories/TypeLiteralFactory.d.ts +1 -1
  14. package/lib/factories/TypeLiteralFactory.js +49 -13
  15. package/lib/factories/TypeLiteralFactory.js.map +1 -1
  16. package/lib/index.js.map +1 -1
  17. package/lib/index.mjs +177 -24588
  18. package/lib/index.mjs.map +1 -1
  19. package/lib/internal/ts.d.ts +32 -0
  20. package/lib/internal/ts.js +37 -0
  21. package/lib/internal/ts.js.map +1 -0
  22. package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +1 -1
  23. package/lib/programmers/NestiaMigrateApiFileProgrammer.js +2 -5
  24. package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -1
  25. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +1 -1
  26. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +87 -49
  27. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
  28. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +2 -2
  29. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +80 -82
  30. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -1
  31. package/lib/programmers/NestiaMigrateApiProgrammer.js +3 -2
  32. package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
  33. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +2 -2
  34. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +39 -37
  35. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -1
  36. package/lib/programmers/NestiaMigrateApiStartProgrammer.js +33 -35
  37. package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -1
  38. package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +1 -1
  39. package/lib/programmers/NestiaMigrateDtoProgrammer.js +17 -19
  40. package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -1
  41. package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +1 -1
  42. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +26 -23
  43. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -1
  44. package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
  45. package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +1 -1
  46. package/lib/programmers/NestiaMigrateImportProgrammer.js +11 -14
  47. package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
  48. package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +1 -1
  49. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +16 -18
  50. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
  51. package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +1 -1
  52. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +128 -132
  53. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -1
  54. package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +1 -1
  55. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +10 -9
  56. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -1
  57. package/lib/programmers/NestiaMigrateNestProgrammer.js +3 -2
  58. package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
  59. package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +2 -2
  60. package/lib/programmers/NestiaMigrateSchemaProgrammer.js +114 -81
  61. package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
  62. package/lib/structures/INestiaMigrateConfig.d.ts +1 -1
  63. package/lib/utils/FilePrinter.d.ts +2 -2
  64. package/lib/utils/FilePrinter.js +8 -10
  65. package/lib/utils/FilePrinter.js.map +1 -1
  66. package/lib/utils/MapUtil.js.map +1 -1
  67. package/lib/utils/StringUtil.d.ts +0 -1
  68. package/lib/utils/StringUtil.js +0 -1
  69. package/lib/utils/StringUtil.js.map +1 -1
  70. package/package.json +9 -11
  71. package/src/NestiaMigrateApplication.ts +29 -30
  72. package/src/bundles/NEST_TEMPLATE.ts +5 -5
  73. package/src/bundles/SDK_TEMPLATE.ts +4 -4
  74. package/src/executable/NestiaMigrateCommander.ts +15 -4
  75. package/src/executable/bundle.js +237 -4
  76. package/src/factories/TypeLiteralFactory.ts +22 -16
  77. package/src/internal/ts.ts +94 -0
  78. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +7 -4
  79. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +88 -68
  80. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +122 -111
  81. package/src/programmers/NestiaMigrateApiProgrammer.ts +6 -5
  82. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +67 -61
  83. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +46 -45
  84. package/src/programmers/NestiaMigrateDtoProgrammer.ts +4 -3
  85. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +33 -30
  86. package/src/programmers/NestiaMigrateE2eProgrammer.ts +1 -1
  87. package/src/programmers/NestiaMigrateImportProgrammer.ts +20 -19
  88. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +8 -7
  89. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +82 -77
  90. package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +18 -17
  91. package/src/programmers/NestiaMigrateNestProgrammer.ts +6 -5
  92. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +54 -42
  93. package/src/structures/INestiaMigrateConfig.ts +1 -1
  94. package/src/utils/FilePrinter.ts +9 -14
  95. package/src/utils/StringUtil.ts +0 -5
  96. package/lib/structures/INestiaMigrateDto.d.ts +0 -7
  97. package/lib/structures/INestiaMigrateDto.js +0 -3
  98. package/lib/structures/INestiaMigrateDto.js.map +0 -1
  99. package/lib/structures/INestiaMigrateProgram.d.ts +0 -9
  100. package/lib/structures/INestiaMigrateProgram.js +0 -3
  101. package/lib/structures/INestiaMigrateProgram.js.map +0 -1
  102. package/lib/structures/INestiaMigrateSchema.d.ts +0 -4
  103. package/lib/structures/INestiaMigrateSchema.js +0 -3
  104. package/lib/structures/INestiaMigrateSchema.js.map +0 -1
  105. package/lib/utils/SetupWizard.d.ts +0 -3
  106. package/lib/utils/SetupWizard.js +0 -18
  107. package/lib/utils/SetupWizard.js.map +0 -1
  108. package/lib/utils/openapi-down-convert/RefVisitor.d.ts +0 -52
  109. package/lib/utils/openapi-down-convert/RefVisitor.js +0 -102
  110. package/lib/utils/openapi-down-convert/RefVisitor.js.map +0 -1
  111. package/lib/utils/openapi-down-convert/converter.d.ts +0 -146
  112. package/lib/utils/openapi-down-convert/converter.js +0 -441
  113. package/lib/utils/openapi-down-convert/converter.js.map +0 -1
  114. package/src/structures/INestiaMigrateDto.ts +0 -8
  115. package/src/structures/INestiaMigrateProgram.ts +0 -11
  116. package/src/structures/INestiaMigrateSchema.ts +0 -4
  117. package/src/utils/SetupWizard.ts +0 -12
  118. package/src/utils/openapi-down-convert/RefVisitor.ts +0 -134
  119. 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 "@typia/core";
7
+ } from "@nestia/factory";
7
8
  import { IHttpMigrateRoute } from "@typia/interface";
8
- import ts from "typescript";
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 ts.factory.createModuleDeclaration(
28
- [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
29
- ts.factory.createIdentifier(ctx.route.accessor.at(-1)!),
30
- ts.factory.createModuleBlock([
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
- ts.factory.createCallExpression(
52
- ts.factory.createIdentifier(`${route.accessor.at(-1)!}.path`),
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
- ? [ts.factory.createIdentifier("props")]
58
+ ? [TypeScriptFactory.createIdentifier("props")]
58
59
  : [...route.parameters, ...(route.query ? [route.query] : [])].map(
59
- (p) => ts.factory.createIdentifier(p.key),
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
- ts.factory.createTypeAliasDeclaration(
68
- [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)],
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
- ts.factory.createAsExpression(
168
- ts.factory.createObjectLiteralExpression(
168
+ TypeScriptFactory.createAsExpression(
169
+ TypeScriptFactory.createObjectLiteralExpression(
169
170
  [
170
- ts.factory.createPropertyAssignment(
171
+ TypeScriptFactory.createPropertyAssignment(
171
172
  "method",
172
- ts.factory.createStringLiteral(ctx.route.method.toUpperCase()),
173
+ TypeScriptFactory.createStringLiteral(
174
+ ctx.route.method.toUpperCase(),
175
+ ),
173
176
  ),
174
- ts.factory.createPropertyAssignment(
177
+ TypeScriptFactory.createPropertyAssignment(
175
178
  "path",
176
- ts.factory.createStringLiteral(getPath(ctx.route)),
179
+ TypeScriptFactory.createStringLiteral(getPath(ctx.route)),
177
180
  ),
178
- ts.factory.createPropertyAssignment(
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
- : ts.factory.createNull(),
188
+ : TypeScriptFactory.createNull(),
186
189
  ),
187
- ts.factory.createPropertyAssignment(
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
- : ts.factory.createNull(),
197
+ : TypeScriptFactory.createNull(),
195
198
  ),
196
199
  ...(ctx.route.success?.type === "application/x-www-form-urlencoded"
197
200
  ? [
198
- ts.factory.createPropertyAssignment(
201
+ TypeScriptFactory.createPropertyAssignment(
199
202
  "parseQuery",
200
- ts.factory.createCallExpression(
201
- ts.factory.createIdentifier(
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
- ts.factory.createTypeReferenceNode(
224
- ts.factory.createIdentifier("const"),
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(ts.factory.createIdentifier("props"), key)
235
- : ts.factory.createIdentifier(key);
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
- ts.factory.createArrowFunction(
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
- ? ts.factory.createTypeReferenceNode("Omit", [
250
- ts.factory.createTypeReferenceNode("Props"),
251
- ts.factory.createLiteralTypeNode(
252
- ts.factory.createStringLiteral(ctx.route.body.key),
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
- : ts.factory.createTypeReferenceNode("Props"),
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
- ts.factory.createTypeReferenceNode(
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) return ts.factory.createStringLiteral(path);
289
- return ts.factory.createTemplateExpression(
290
- ts.factory.createTemplateHead(split[0]!),
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 ts.factory.createTemplateSpan(
294
- ts.factory.createCallExpression(
295
- ts.factory.createIdentifier("encodeURIComponent"),
302
+ return TypeScriptFactory.createTemplateSpan(
303
+ TypeScriptFactory.createCallExpression(
304
+ TypeScriptFactory.createIdentifier("encodeURIComponent"),
296
305
  undefined,
297
306
  [
298
- ts.factory.createBinaryExpression(
307
+ TypeScriptFactory.createBinaryExpression(
299
308
  property(
300
309
  ctx.route.parameters.find((p) => p.name === name)!.key,
301
310
  ),
302
- ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
303
- ts.factory.createStringLiteral("null"),
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
- ? ts.factory.createTemplateMiddle
309
- : ts.factory.createTemplateTail)(s.substring(name.length)),
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
- ts.factory.createBlock(
333
+ TypeScriptFactory.createBlock(
323
334
  [
324
335
  local({
325
336
  name: variables,
326
337
  type: "URLSearchParams",
327
- expression: ts.factory.createNewExpression(
328
- ts.factory.createIdentifier("URLSearchParams"),
338
+ expression: TypeScriptFactory.createNewExpression(
339
+ TypeScriptFactory.createIdentifier("URLSearchParams"),
329
340
  [],
330
341
  [],
331
342
  ),
332
343
  }),
333
- ts.factory.createForOfStatement(
344
+ TypeScriptFactory.createForOfStatement(
334
345
  undefined,
335
- ts.factory.createVariableDeclarationList(
346
+ TypeScriptFactory.createVariableDeclarationList(
336
347
  [
337
- ts.factory.createVariableDeclaration(
338
- ts.factory.createArrayBindingPattern([
339
- ts.factory.createBindingElement(
348
+ TypeScriptFactory.createVariableDeclaration(
349
+ TypeScriptFactory.createArrayBindingPattern([
350
+ TypeScriptFactory.createBindingElement(
340
351
  undefined,
341
352
  undefined,
342
- ts.factory.createIdentifier("key"),
353
+ TypeScriptFactory.createIdentifier("key"),
343
354
  undefined,
344
355
  ),
345
- ts.factory.createBindingElement(
356
+ TypeScriptFactory.createBindingElement(
346
357
  undefined,
347
358
  undefined,
348
- ts.factory.createIdentifier("value"),
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
- ts.factory.createCallExpression(
360
- ts.factory.createIdentifier("Object.entries"),
370
+ TypeScriptFactory.createCallExpression(
371
+ TypeScriptFactory.createIdentifier("Object.entries"),
361
372
  undefined,
362
373
  [
363
- ts.factory.createAsExpression(
374
+ TypeScriptFactory.createAsExpression(
364
375
  property(ctx.route.query.key),
365
376
  TypeFactory.keyword("any"),
366
377
  ),
367
378
  ],
368
379
  ),
369
- ts.factory.createIfStatement(
370
- ts.factory.createStrictEquality(
371
- ts.factory.createIdentifier("undefined"),
372
- ts.factory.createIdentifier("value"),
380
+ TypeScriptFactory.createIfStatement(
381
+ TypeScriptFactory.createStrictEquality(
382
+ TypeScriptFactory.createIdentifier("undefined"),
383
+ TypeScriptFactory.createIdentifier("value"),
373
384
  ),
374
- ts.factory.createContinueStatement(),
375
- ts.factory.createIfStatement(
376
- ts.factory.createCallExpression(
377
- ts.factory.createIdentifier("Array.isArray"),
385
+ TypeScriptFactory.createContinueStatement(),
386
+ TypeScriptFactory.createIfStatement(
387
+ TypeScriptFactory.createCallExpression(
388
+ TypeScriptFactory.createIdentifier("Array.isArray"),
378
389
  undefined,
379
- [ts.factory.createIdentifier("value")],
390
+ [TypeScriptFactory.createIdentifier("value")],
380
391
  ),
381
- ts.factory.createExpressionStatement(
382
- ts.factory.createCallExpression(
383
- ts.factory.createPropertyAccessExpression(
384
- ts.factory.createIdentifier("value"),
385
- ts.factory.createIdentifier("forEach"),
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
- ts.factory.createArrowFunction(
400
+ TypeScriptFactory.createArrowFunction(
390
401
  undefined,
391
402
  undefined,
392
403
  [IdentifierFactory.parameter("elem")],
393
404
  undefined,
394
405
  undefined,
395
- ts.factory.createCallExpression(
406
+ TypeScriptFactory.createCallExpression(
396
407
  IdentifierFactory.access(
397
- ts.factory.createIdentifier(variables),
408
+ TypeScriptFactory.createIdentifier(variables),
398
409
  "append",
399
410
  ),
400
411
  undefined,
401
412
  [
402
- ts.factory.createIdentifier("key"),
403
- ts.factory.createCallExpression(
404
- ts.factory.createIdentifier("String"),
413
+ TypeScriptFactory.createIdentifier("key"),
414
+ TypeScriptFactory.createCallExpression(
415
+ TypeScriptFactory.createIdentifier("String"),
405
416
  undefined,
406
- [ts.factory.createIdentifier("elem")],
417
+ [TypeScriptFactory.createIdentifier("elem")],
407
418
  ),
408
419
  ],
409
420
  ),
@@ -411,19 +422,19 @@ export namespace NestiaMigrateApiNamespaceProgrammer {
411
422
  ],
412
423
  ),
413
424
  ),
414
- ts.factory.createExpressionStatement(
415
- ts.factory.createCallExpression(
425
+ TypeScriptFactory.createExpressionStatement(
426
+ TypeScriptFactory.createCallExpression(
416
427
  IdentifierFactory.access(
417
- ts.factory.createIdentifier(variables),
428
+ TypeScriptFactory.createIdentifier(variables),
418
429
  "set",
419
430
  ),
420
431
  undefined,
421
432
  [
422
- ts.factory.createIdentifier("key"),
423
- ts.factory.createCallExpression(
424
- ts.factory.createIdentifier("String"),
433
+ TypeScriptFactory.createIdentifier("key"),
434
+ TypeScriptFactory.createCallExpression(
435
+ TypeScriptFactory.createIdentifier("String"),
425
436
  undefined,
426
- [ts.factory.createIdentifier("value")],
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
- ts.factory.createReturnStatement(
440
- ts.factory.createConditionalExpression(
441
- ts.factory.createStrictEquality(
450
+ TypeScriptFactory.createReturnStatement(
451
+ TypeScriptFactory.createConditionalExpression(
452
+ TypeScriptFactory.createStrictEquality(
442
453
  ExpressionFactory.number(0),
443
454
  IdentifierFactory.access(
444
- ts.factory.createIdentifier(variables),
455
+ TypeScriptFactory.createIdentifier(variables),
445
456
  "size",
446
457
  ),
447
458
  ),
448
459
  undefined,
449
- ts.factory.createIdentifier("location"),
460
+ TypeScriptFactory.createIdentifier("location"),
450
461
  undefined,
451
- ts.factory.createTemplateExpression(
452
- ts.factory.createTemplateHead(""),
462
+ TypeScriptFactory.createTemplateExpression(
463
+ TypeScriptFactory.createTemplateHead(""),
453
464
  [
454
- ts.factory.createTemplateSpan(
455
- ts.factory.createIdentifier("location"),
456
- ts.factory.createTemplateMiddle("?"),
465
+ TypeScriptFactory.createTemplateSpan(
466
+ TypeScriptFactory.createIdentifier("location"),
467
+ TypeScriptFactory.createTemplateMiddle("?"),
457
468
  ),
458
- ts.factory.createTemplateSpan(
459
- ts.factory.createCallExpression(
469
+ TypeScriptFactory.createTemplateSpan(
470
+ TypeScriptFactory.createCallExpression(
460
471
  IdentifierFactory.access(
461
- ts.factory.createIdentifier(variables),
472
+ TypeScriptFactory.createIdentifier(variables),
462
473
  "toString",
463
474
  ),
464
475
  undefined,
465
476
  undefined,
466
477
  ),
467
- ts.factory.createTemplateTail(""),
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
- ts.factory.createVariableStatement(
482
- [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)],
483
- ts.factory.createVariableDeclarationList(
492
+ TypeScriptFactory.createVariableStatement(
493
+ [TypeScriptFactory.createModifier(ts.SyntaxKind.ExportKeyword)],
494
+ TypeScriptFactory.createVariableDeclarationList(
484
495
  [
485
- ts.factory.createVariableDeclaration(
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
- ts.factory.createVariableStatement(
515
+ TypeScriptFactory.createVariableStatement(
505
516
  [],
506
- ts.factory.createVariableDeclarationList(
517
+ TypeScriptFactory.createVariableDeclarationList(
507
518
  [
508
- ts.factory.createVariableDeclaration(
519
+ TypeScriptFactory.createVariableDeclaration(
509
520
  props.name,
510
521
  undefined,
511
- ts.factory.createTypeReferenceNode(props.type),
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 "typescript";
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
- ts.factory.createModuleDeclaration(
97
- [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)],
98
- ts.factory.createIdentifier(modulo.name),
99
- ts.factory.createModuleBlock(internal),
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
  );