@nestia/core 12.0.0-dev.20260521.6 → 12.0.0-dev.20260601.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.
@@ -417,13 +417,20 @@ func readTypiaPluginOptions(cwd, tsconfigPath string) typiaadapter.PluginOptions
417
417
  }
418
418
  text := string(data)
419
419
  return typiaadapter.PluginOptions{
420
- Functional: regexp.MustCompile(`(?s)"functional"\s*:\s*true`).MatchString(text),
421
- Numeric: regexp.MustCompile(`(?s)"numeric"\s*:\s*true`).MatchString(text),
422
- Finite: regexp.MustCompile(`(?s)"finite"\s*:\s*true`).MatchString(text),
423
- Undefined: regexp.MustCompile(`(?s)"undefined"\s*:\s*true`).MatchString(text),
420
+ Functional: typiaOptionFunctionalPattern.MatchString(text),
421
+ Numeric: typiaOptionNumericPattern.MatchString(text),
422
+ Finite: typiaOptionFinitePattern.MatchString(text),
423
+ Undefined: typiaOptionUndefinedPattern.MatchString(text),
424
424
  }
425
425
  }
426
426
 
427
+ var (
428
+ typiaOptionFunctionalPattern = regexp.MustCompile(`(?s)"functional"\s*:\s*true`)
429
+ typiaOptionNumericPattern = regexp.MustCompile(`(?s)"numeric"\s*:\s*true`)
430
+ typiaOptionFinitePattern = regexp.MustCompile(`(?s)"finite"\s*:\s*true`)
431
+ typiaOptionUndefinedPattern = regexp.MustCompile(`(?s)"undefined"\s*:\s*true`)
432
+ )
433
+
427
434
  func resolveCWD(label string, cwdOverride string) (string, bool) {
428
435
  if cwdOverride != "" {
429
436
  return cwdOverride, true
@@ -300,17 +300,29 @@ func SourceFileText(target any) (string, bool) {
300
300
  return file.Text(), true
301
301
  }
302
302
 
303
+ // These patterns run once per transformed file in cleanupTypeScriptTransformText
304
+ // / normalizeParenthesizedTypeAnnotations. Compiling them at package scope keeps
305
+ // the per-file cost to a match instead of a recompile (the SDK `transform` path
306
+ // runs this for every emitted source file).
307
+ var (
308
+ cleanupImportTypeBlockPattern = regexp.MustCompile(`(?m)^import type \{([^{}\n]+)\} from`)
309
+ cleanupImportTypeLinePattern = regexp.MustCompile(`^import type \{\s*([^{}\n]+?)\s*\} from`)
310
+ cleanupImportBlankLinePattern = regexp.MustCompile(`(?m)(^import [^\n]+;\n)\n+(const |let |var |export )`)
311
+ cleanupInputIsParenPattern = regexp.MustCompile(`input is \(([A-Za-z_$][A-Za-z0-9_$.]*)\)`)
312
+ cleanupCollapseBlankCallPattern = regexp.MustCompile(`\n\n([A-Za-z_$][A-Za-z0-9_$]*\([^;\n]*\);?)`)
313
+ )
314
+
303
315
  func cleanupTypeScriptTransformText(text string) string {
304
316
  text = cleanupTransformedText(text)
305
317
  text = normalizeParenthesizedTypeAnnotations(text)
306
- text = regexp.MustCompile(`(?m)^import type \{([^{}\n]+)\} from`).ReplaceAllStringFunc(text, func(line string) string {
307
- return regexp.MustCompile(`^import type \{\s*([^{}\n]+?)\s*\} from`).ReplaceAllString(line, "import type { $1 } from")
318
+ text = cleanupImportTypeBlockPattern.ReplaceAllStringFunc(text, func(line string) string {
319
+ return cleanupImportTypeLinePattern.ReplaceAllString(line, "import type { $1 } from")
308
320
  })
309
- text = regexp.MustCompile(`(?m)(^import [^\n]+;\n)\n+(const |let |var |export )`).ReplaceAllString(text, "$1$2")
321
+ text = cleanupImportBlankLinePattern.ReplaceAllString(text, "$1$2")
310
322
  text = strings.ReplaceAll(text, "=(() =>", "= (() =>")
311
323
  text = strings.ReplaceAll(text, ": (any) =>", ": any =>")
312
324
  text = strings.ReplaceAll(text, ": (boolean) =>", ": boolean =>")
313
- text = regexp.MustCompile(`input is \(([A-Za-z_$][A-Za-z0-9_$.]*)\)`).ReplaceAllString(text, "input is $1")
325
+ text = cleanupInputIsParenPattern.ReplaceAllString(text, "input is $1")
314
326
  text = strings.ReplaceAll(text, "return (success ? ", "return success ? ")
315
327
  text = strings.ReplaceAll(text, "}) as any;", "} as any;")
316
328
  text = strings.ReplaceAll(text, "(() => {\n const ", "(() => { const ")
@@ -324,7 +336,7 @@ func cleanupTypeScriptTransformText(text string) string {
324
336
  text = strings.ReplaceAll(text, "\n }); let ", "\n}); let ")
325
337
  text = strings.ReplaceAll(text, ";\n})()", "; })()")
326
338
  text = strings.ReplaceAll(text, "\n ", "\n ")
327
- text = regexp.MustCompile(`\n\n([A-Za-z_$][A-Za-z0-9_$]*\([^;\n]*\);?)`).ReplaceAllString(text, "\n$1")
339
+ text = cleanupCollapseBlankCallPattern.ReplaceAllString(text, "\n$1")
328
340
  trimmed := strings.TrimRight(text, " \t\r\n")
329
341
  if strings.HasSuffix(trimmed, ")") && !strings.HasSuffix(trimmed, ";") {
330
342
  return trimmed + ";\n"
@@ -335,10 +347,14 @@ func cleanupTypeScriptTransformText(text string) string {
335
347
  return text
336
348
  }
337
349
 
350
+ var (
351
+ normalizeParenArrowTypePattern = regexp.MustCompile(`: \(([A-Za-z_$][A-Za-z0-9_$.]*(<[^()\n;{}]*>)?)\)(\s*=>)`)
352
+ normalizeParenNullishPattern = regexp.MustCompile(`\| \((null|undefined)\)`)
353
+ )
354
+
338
355
  func normalizeParenthesizedTypeAnnotations(text string) string {
339
- typeAtom := `([A-Za-z_$][A-Za-z0-9_$.]*(<[^()\n;{}]*>)?)`
340
- text = regexp.MustCompile(`: \(`+typeAtom+`\)(\s*=>)`).ReplaceAllString(text, ": $1$3")
341
- text = regexp.MustCompile(`\| \((null|undefined)\)`).ReplaceAllString(text, "| $1")
356
+ text = normalizeParenArrowTypePattern.ReplaceAllString(text, ": $1$3")
357
+ text = normalizeParenNullishPattern.ReplaceAllString(text, "| $1")
342
358
  return text
343
359
  }
344
360
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/core",
3
- "version": "12.0.0-dev.20260521.6",
3
+ "version": "12.0.0-dev.20260601.1",
4
4
  "description": "Super-fast validation decorators of NestJS",
5
5
  "types": "lib/index.d.ts",
6
6
  "main": "lib/index.js",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "homepage": "https://nestia.io",
48
48
  "dependencies": {
49
- "@typia/interface": "13.0.0-dev.20260521.1",
50
- "@typia/utils": "13.0.0-dev.20260521.1",
49
+ "@typia/interface": "13.0.0-dev.20260601.1",
50
+ "@typia/utils": "13.0.0-dev.20260601.1",
51
51
  "get-function-location": "^2.0.0",
52
52
  "glob": "^11.0.3",
53
53
  "path-parser": "^6.1.0",
@@ -55,17 +55,17 @@
55
55
  "reflect-metadata": ">=0.1.12",
56
56
  "rxjs": ">=6.0.3",
57
57
  "tgrid": "^1.1.0",
58
- "typia": "13.0.0-dev.20260521.1",
58
+ "typia": "13.0.0-dev.20260601.1",
59
59
  "ws": "^7.5.3",
60
- "@nestia/fetcher": "^12.0.0-dev.20260521.6"
60
+ "@nestia/fetcher": "^12.0.0-dev.20260601.1"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@nestjs/common": ">=7.0.1",
64
64
  "@nestjs/core": ">=7.0.1",
65
65
  "reflect-metadata": ">=0.1.12",
66
66
  "rxjs": ">=6.0.3",
67
- "typia": "13.0.0-dev.20260521.1",
68
- "@nestia/fetcher": "^12.0.0-dev.20260521.6"
67
+ "typia": "13.0.0-dev.20260601.1",
68
+ "@nestia/fetcher": "^12.0.0-dev.20260601.1"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@nestjs/common": "^11.1.6",
@@ -77,7 +77,7 @@
77
77
  "@types/ws": "^8.5.10",
78
78
  "fastify": "^4.28.1",
79
79
  "rimraf": "^6.1.3",
80
- "ttsc": "^0.12.3",
80
+ "ttsc": "^0.14.1",
81
81
  "tstl": "^3.0.0"
82
82
  },
83
83
  "files": [