@nestia/core 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/MIGRATION.md +169 -0
- package/lib/adaptors/WebSocketAdaptor.js +7 -3
- package/lib/adaptors/WebSocketAdaptor.js.map +1 -1
- package/lib/decorators/DynamicModule.js.map +1 -1
- package/lib/decorators/EncryptedBody.js.map +1 -1
- package/lib/decorators/EncryptedController.js.map +1 -1
- package/lib/decorators/EncryptedModule.js.map +1 -1
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/HumanRoute.js.map +1 -1
- package/lib/decorators/NoTransformConfigurationError.js +5 -2
- package/lib/decorators/NoTransformConfigurationError.js.map +1 -1
- package/lib/decorators/PlainBody.js.map +1 -1
- package/lib/decorators/SwaggerCustomizer.js.map +1 -1
- package/lib/decorators/SwaggerExample.js.map +1 -1
- package/lib/decorators/TypedBody.js.map +1 -1
- package/lib/decorators/TypedException.js.map +1 -1
- package/lib/decorators/TypedFormData.js.map +1 -1
- package/lib/decorators/TypedHeaders.js.map +1 -1
- package/lib/decorators/TypedParam.js +5 -2
- package/lib/decorators/TypedParam.js.map +1 -1
- package/lib/decorators/TypedQuery.js.map +1 -1
- package/lib/decorators/TypedRoute.js.map +1 -1
- package/lib/decorators/WebSocketRoute.js.map +1 -1
- package/lib/decorators/doNotThrowTransformError.js.map +1 -1
- package/lib/decorators/internal/get_path_and_querify.js +5 -2
- package/lib/decorators/internal/get_path_and_querify.js.map +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +5 -2
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
- package/lib/decorators/internal/get_text_body.js.map +1 -1
- package/lib/decorators/internal/headers_to_object.js.map +1 -1
- package/lib/decorators/internal/is_request_body_undefined.js.map +1 -1
- package/lib/decorators/internal/load_controller.js +48 -16
- package/lib/decorators/internal/load_controller.js.map +1 -1
- package/lib/decorators/internal/route_error.js +3 -3
- package/lib/decorators/internal/route_error.js.map +1 -1
- package/lib/decorators/internal/validate_request_body.js +5 -2
- package/lib/decorators/internal/validate_request_body.js.map +1 -1
- package/lib/decorators/internal/validate_request_form_data.js +5 -2
- package/lib/decorators/internal/validate_request_form_data.js.map +1 -1
- package/lib/decorators/internal/validate_request_headers.js +5 -2
- package/lib/decorators/internal/validate_request_headers.js.map +1 -1
- package/lib/decorators/internal/validate_request_query.js +30 -4
- package/lib/decorators/internal/validate_request_query.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/transform.d.ts +2 -5
- package/lib/transform.js +48 -28
- package/lib/transform.js.map +1 -1
- package/lib/utils/ArrayUtil.js.map +1 -1
- package/lib/utils/ExceptionManager.js.map +1 -1
- package/lib/utils/Singleton.js.map +1 -1
- package/lib/utils/SourceFinder.js.map +1 -1
- package/lib/utils/VersioningStrategy.js.map +1 -1
- package/native/cmd/ttsc-nestia/build.go +434 -0
- package/native/cmd/ttsc-nestia/cleanup.go +408 -0
- package/native/cmd/ttsc-nestia/core_querify.go +227 -0
- package/native/cmd/ttsc-nestia/core_transform.go +1713 -0
- package/native/cmd/ttsc-nestia/core_websocket.go +115 -0
- package/native/cmd/ttsc-nestia/main.go +72 -0
- package/native/cmd/ttsc-nestia/path_rewrite.go +285 -0
- package/native/cmd/ttsc-nestia/printer.go +244 -0
- package/native/cmd/ttsc-nestia/rewrite.go +662 -0
- package/native/cmd/ttsc-nestia/sdk_metadata_json.go +327 -0
- package/native/cmd/ttsc-nestia/sdk_transform.go +1541 -0
- package/native/cmd/ttsc-nestia/transform.go +387 -0
- package/native/cmd/ttsc-nestia/typia_fast.go +326 -0
- package/native/cmd/ttsc-nestia/typia_replacement.go +24 -0
- package/native/go.mod +32 -0
- package/native/go.sum +54 -0
- package/native/plugin/plan.go +102 -0
- package/native/transform.cjs +21 -0
- package/package.json +27 -22
- package/src/decorators/NoTransformConfigurationError.ts +5 -2
- package/src/decorators/internal/load_controller.ts +50 -19
- package/src/decorators/internal/validate_request_query.ts +21 -2
- package/src/transform.ts +82 -35
- package/lib/decorators/internal/NoTransformConfigureError.d.ts +0 -1
- package/lib/decorators/internal/NoTransformConfigureError.js +0 -7
- package/lib/decorators/internal/NoTransformConfigureError.js.map +0 -1
- package/lib/options/INestiaTransformOptions.d.ts +0 -13
- package/lib/options/INestiaTransformOptions.js +0 -3
- package/lib/options/INestiaTransformOptions.js.map +0 -1
- package/lib/options/INestiaTransformProject.d.ts +0 -5
- package/lib/options/INestiaTransformProject.js +0 -3
- package/lib/options/INestiaTransformProject.js.map +0 -1
- package/lib/programmers/PlainBodyProgrammer.d.ts +0 -9
- package/lib/programmers/PlainBodyProgrammer.js +0 -58
- package/lib/programmers/PlainBodyProgrammer.js.map +0 -1
- package/lib/programmers/TypedBodyProgrammer.d.ts +0 -9
- package/lib/programmers/TypedBodyProgrammer.js +0 -94
- package/lib/programmers/TypedBodyProgrammer.js.map +0 -1
- package/lib/programmers/TypedFormDataBodyProgrammer.d.ts +0 -9
- package/lib/programmers/TypedFormDataBodyProgrammer.js +0 -65
- package/lib/programmers/TypedFormDataBodyProgrammer.js.map +0 -1
- package/lib/programmers/TypedHeadersProgrammer.d.ts +0 -9
- package/lib/programmers/TypedHeadersProgrammer.js +0 -38
- package/lib/programmers/TypedHeadersProgrammer.js.map +0 -1
- package/lib/programmers/TypedParamProgrammer.d.ts +0 -10
- package/lib/programmers/TypedParamProgrammer.js +0 -32
- package/lib/programmers/TypedParamProgrammer.js.map +0 -1
- package/lib/programmers/TypedQueryBodyProgrammer.d.ts +0 -9
- package/lib/programmers/TypedQueryBodyProgrammer.js +0 -74
- package/lib/programmers/TypedQueryBodyProgrammer.js.map +0 -1
- package/lib/programmers/TypedQueryProgrammer.d.ts +0 -9
- package/lib/programmers/TypedQueryProgrammer.js +0 -75
- package/lib/programmers/TypedQueryProgrammer.js.map +0 -1
- package/lib/programmers/TypedQueryRouteProgrammer.d.ts +0 -9
- package/lib/programmers/TypedQueryRouteProgrammer.js +0 -75
- package/lib/programmers/TypedQueryRouteProgrammer.js.map +0 -1
- package/lib/programmers/TypedRouteProgrammer.d.ts +0 -9
- package/lib/programmers/TypedRouteProgrammer.js +0 -79
- package/lib/programmers/TypedRouteProgrammer.js.map +0 -1
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.d.ts +0 -9
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js +0 -39
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js.map +0 -1
- package/lib/programmers/http/HttpIsQuerifyProgrammer.d.ts +0 -9
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js +0 -36
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js.map +0 -1
- package/lib/programmers/http/HttpQuerifyProgrammer.d.ts +0 -9
- package/lib/programmers/http/HttpQuerifyProgrammer.js +0 -50
- package/lib/programmers/http/HttpQuerifyProgrammer.js.map +0 -1
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.d.ts +0 -9
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js +0 -40
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js.map +0 -1
- package/lib/programmers/internal/CoreMetadataUtil.d.ts +0 -5
- package/lib/programmers/internal/CoreMetadataUtil.js +0 -19
- package/lib/programmers/internal/CoreMetadataUtil.js.map +0 -1
- package/lib/transformers/FileTransformer.d.ts +0 -5
- package/lib/transformers/FileTransformer.js +0 -80
- package/lib/transformers/FileTransformer.js.map +0 -1
- package/lib/transformers/MethodTransformer.d.ts +0 -8
- package/lib/transformers/MethodTransformer.js +0 -58
- package/lib/transformers/MethodTransformer.js.map +0 -1
- package/lib/transformers/NodeTransformer.d.ts +0 -8
- package/lib/transformers/NodeTransformer.js +0 -24
- package/lib/transformers/NodeTransformer.js.map +0 -1
- package/lib/transformers/ParameterDecoratorTransformer.d.ts +0 -9
- package/lib/transformers/ParameterDecoratorTransformer.js +0 -104
- package/lib/transformers/ParameterDecoratorTransformer.js.map +0 -1
- package/lib/transformers/ParameterTransformer.d.ts +0 -8
- package/lib/transformers/ParameterTransformer.js +0 -37
- package/lib/transformers/ParameterTransformer.js.map +0 -1
- package/lib/transformers/TypedRouteTransformer.d.ts +0 -9
- package/lib/transformers/TypedRouteTransformer.js +0 -68
- package/lib/transformers/TypedRouteTransformer.js.map +0 -1
- package/lib/transformers/WebSocketRouteTransformer.d.ts +0 -9
- package/lib/transformers/WebSocketRouteTransformer.js +0 -72
- package/lib/transformers/WebSocketRouteTransformer.js.map +0 -1
- package/src/decorators/internal/NoTransformConfigureError.ts +0 -2
- package/src/options/INestiaTransformOptions.ts +0 -34
- package/src/options/INestiaTransformProject.ts +0 -10
- package/src/programmers/PlainBodyProgrammer.ts +0 -72
- package/src/programmers/TypedBodyProgrammer.ts +0 -148
- package/src/programmers/TypedFormDataBodyProgrammer.ts +0 -118
- package/src/programmers/TypedHeadersProgrammer.ts +0 -65
- package/src/programmers/TypedParamProgrammer.ts +0 -33
- package/src/programmers/TypedQueryBodyProgrammer.ts +0 -113
- package/src/programmers/TypedQueryProgrammer.ts +0 -115
- package/src/programmers/TypedQueryRouteProgrammer.ts +0 -107
- package/src/programmers/TypedRouteProgrammer.ts +0 -103
- package/src/programmers/http/HttpAssertQuerifyProgrammer.ts +0 -74
- package/src/programmers/http/HttpIsQuerifyProgrammer.ts +0 -77
- package/src/programmers/http/HttpQuerifyProgrammer.ts +0 -110
- package/src/programmers/http/HttpValidateQuerifyProgrammer.ts +0 -78
- package/src/programmers/internal/CoreMetadataUtil.ts +0 -21
- package/src/transformers/FileTransformer.ts +0 -109
- package/src/transformers/MethodTransformer.ts +0 -103
- package/src/transformers/NodeTransformer.ts +0 -23
- package/src/transformers/ParameterDecoratorTransformer.ts +0 -143
- package/src/transformers/ParameterTransformer.ts +0 -57
- package/src/transformers/TypedRouteTransformer.ts +0 -85
- package/src/transformers/WebSocketRouteTransformer.ts +0 -120
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"strings"
|
|
5
|
+
|
|
6
|
+
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
7
|
+
typiaadapter "github.com/samchon/typia/packages/typia/native/adapter"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
func parenthesizeTypiaReplacement(
|
|
11
|
+
site typiaadapter.CallSite,
|
|
12
|
+
expr string,
|
|
13
|
+
) string {
|
|
14
|
+
text := strings.TrimSpace(expr)
|
|
15
|
+
if strings.HasPrefix(text, "{") == false {
|
|
16
|
+
return expr
|
|
17
|
+
}
|
|
18
|
+
node := site.Call.AsNode()
|
|
19
|
+
if node == nil || node.Parent == nil ||
|
|
20
|
+
node.Parent.Kind != shimast.KindExpressionStatement {
|
|
21
|
+
return expr
|
|
22
|
+
}
|
|
23
|
+
return "(" + expr + ")"
|
|
24
|
+
}
|
package/native/go.mod
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module github.com/samchon/nestia/packages/core/native
|
|
2
|
+
|
|
3
|
+
go 1.26
|
|
4
|
+
|
|
5
|
+
require (
|
|
6
|
+
github.com/microsoft/typescript-go/shim/ast v0.0.0
|
|
7
|
+
github.com/microsoft/typescript-go/shim/checker v0.0.0
|
|
8
|
+
github.com/microsoft/typescript-go/shim/compiler v0.0.0
|
|
9
|
+
github.com/microsoft/typescript-go/shim/printer v0.0.0
|
|
10
|
+
github.com/microsoft/typescript-go/shim/scanner v0.0.0
|
|
11
|
+
github.com/samchon/ttsc/packages/ttsc v0.0.0
|
|
12
|
+
github.com/samchon/typia/packages/typia/native v0.0.0-20260510181336-5a7ad21c4d6f
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
require (
|
|
16
|
+
github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433 // indirect
|
|
17
|
+
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
|
18
|
+
github.com/microsoft/typescript-go v0.0.0-20260429010842-56ab4af42157 // indirect
|
|
19
|
+
github.com/microsoft/typescript-go/shim/bundled v0.0.0 // indirect
|
|
20
|
+
github.com/microsoft/typescript-go/shim/core v0.0.0 // indirect
|
|
21
|
+
github.com/microsoft/typescript-go/shim/diagnosticwriter v0.0.0 // indirect
|
|
22
|
+
github.com/microsoft/typescript-go/shim/parser v0.0.0 // indirect
|
|
23
|
+
github.com/microsoft/typescript-go/shim/tsoptions v0.0.0 // indirect
|
|
24
|
+
github.com/microsoft/typescript-go/shim/tspath v0.0.0 // indirect
|
|
25
|
+
github.com/microsoft/typescript-go/shim/vfs v0.0.0 // indirect
|
|
26
|
+
github.com/microsoft/typescript-go/shim/vfs/cachedvfs v0.0.0 // indirect
|
|
27
|
+
github.com/microsoft/typescript-go/shim/vfs/osvfs v0.0.0 // indirect
|
|
28
|
+
github.com/zeebo/xxh3 v1.1.0 // indirect
|
|
29
|
+
golang.org/x/sync v0.20.0 // indirect
|
|
30
|
+
golang.org/x/sys v0.43.0 // indirect
|
|
31
|
+
golang.org/x/text v0.36.0 // indirect
|
|
32
|
+
)
|
package/native/go.sum
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433 h1:vymEbVwYFP/L05h5TKQxvkXoKxNvTpjxYKdF1Nlwuao=
|
|
2
|
+
github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
|
|
3
|
+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
|
4
|
+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
|
5
|
+
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
|
6
|
+
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
|
7
|
+
github.com/microsoft/typescript-go v0.0.0-20260429010842-56ab4af42157 h1:llOMPhKDiQ+UEJiAaQuuWaJOTg5V7tNNTEf9JPWoYSY=
|
|
8
|
+
github.com/microsoft/typescript-go v0.0.0-20260429010842-56ab4af42157/go.mod h1:m8YA0PMC7ti0GW0RI05D6fEcjQeu98XVS+FWF+VDW2k=
|
|
9
|
+
github.com/peter-evans/patience v0.3.0 h1:rX0JdJeepqdQl1Sk9c9uvorjYYzL2TfgLX1adqYm9cA=
|
|
10
|
+
github.com/peter-evans/patience v0.3.0/go.mod h1:Kmxu5sY1NmBLFSStvXjX1wS9mIv7wMcP/ubucyMOAu0=
|
|
11
|
+
github.com/samchon/ttsc/packages/ttsc v0.0.0-20260515042402-b1ffbb39cb71 h1:DCe46azidMHWqxewawIjF4x6iqmZGNL+J9zh+2HranQ=
|
|
12
|
+
github.com/samchon/ttsc/packages/ttsc v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:tNypbkbEMafGwwB+jL8faWHvRMIGjPB+GgJAu81fzEw=
|
|
13
|
+
github.com/samchon/ttsc/packages/ttsc/shim/ast v0.0.0-20260515042402-b1ffbb39cb71 h1:CxxjVG7TqXx/5IBb0sVe/fBiBjwSwo1kQc0qIKrQi4w=
|
|
14
|
+
github.com/samchon/ttsc/packages/ttsc/shim/ast v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:c+iJv7+oQiCPka/RE4sIxftTBRSzZqPXSqh5LTQwvFE=
|
|
15
|
+
github.com/samchon/ttsc/packages/ttsc/shim/bundled v0.0.0-20260515042402-b1ffbb39cb71 h1:s0l6p1iWpaY/NRuWQT++FwHbgjINkevklQY9LO6SmLk=
|
|
16
|
+
github.com/samchon/ttsc/packages/ttsc/shim/bundled v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:0tz+Y8szXmEpXWHWVrLrv11ga1z6tQJQErkUyIWJ9RQ=
|
|
17
|
+
github.com/samchon/ttsc/packages/ttsc/shim/checker v0.0.0-20260515042402-b1ffbb39cb71 h1:zRnTM8f8WDhZnZnWbhdlDKSLdbwq2bprkEbFq5hyEyo=
|
|
18
|
+
github.com/samchon/ttsc/packages/ttsc/shim/checker v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:4xfafgG/qosSp8f0tCf83assFoUKRdGHhvPD1EI9LKg=
|
|
19
|
+
github.com/samchon/ttsc/packages/ttsc/shim/compiler v0.0.0-20260515042402-b1ffbb39cb71 h1:ZTix2jm+SuZ0spjH47CYnVbJ0gI3lqOX4lsYXCZHqsI=
|
|
20
|
+
github.com/samchon/ttsc/packages/ttsc/shim/compiler v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:e9awlg1eXjc1Hzx9waw6UEV/2qYJbgo8zFPwQ0mpzig=
|
|
21
|
+
github.com/samchon/ttsc/packages/ttsc/shim/core v0.0.0-20260515042402-b1ffbb39cb71 h1:M5nY9yY2Bco5HcuHFJnKToKAi+leC6U5YJh+RXwkxes=
|
|
22
|
+
github.com/samchon/ttsc/packages/ttsc/shim/core v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:DUewcVNEdXyDveQholE4GAsiqqA3C2+SJYqia3nCf00=
|
|
23
|
+
github.com/samchon/ttsc/packages/ttsc/shim/diagnosticwriter v0.0.0-20260515042402-b1ffbb39cb71 h1:ijTjaHh9VMdE0OpDnI4QOxXYdRTwYDagkY8Q5Zu4/jE=
|
|
24
|
+
github.com/samchon/ttsc/packages/ttsc/shim/diagnosticwriter v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:v86GtrD7qALo6Xkgz1MDomPMSV2D9NdniQWB5t8eY6k=
|
|
25
|
+
github.com/samchon/ttsc/packages/ttsc/shim/parser v0.0.0-20260515042402-b1ffbb39cb71 h1:FAXhgDlxtelKxeVEwqkr3J2SstfsN+6ujyS6pFixS44=
|
|
26
|
+
github.com/samchon/ttsc/packages/ttsc/shim/parser v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:inUjC/bNlCkO0zIzHZRXlHR/WgLcK0vi2KLc7tpQ1ek=
|
|
27
|
+
github.com/samchon/ttsc/packages/ttsc/shim/printer v0.0.0-20260515042402-b1ffbb39cb71 h1:159trmIJVjMyZYc6iZi4p+l9RXu9pFcpKw4/GdOVr+0=
|
|
28
|
+
github.com/samchon/ttsc/packages/ttsc/shim/printer v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:ESjhY+UiPRspef4JcXcUPNgt4ySQQrlVIUCLKaKeyEQ=
|
|
29
|
+
github.com/samchon/ttsc/packages/ttsc/shim/scanner v0.0.0-20260515042402-b1ffbb39cb71 h1:gxlbAixdq3rzum3Kwey1lfCvwr817UJhG+YReS3iVpI=
|
|
30
|
+
github.com/samchon/ttsc/packages/ttsc/shim/scanner v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:abIC7C28cUA5IQKmLJulsl2qOvmimhkMNOfjJhRm5jM=
|
|
31
|
+
github.com/samchon/ttsc/packages/ttsc/shim/tsoptions v0.0.0-20260515042402-b1ffbb39cb71 h1:dLOJHfKx0hjK92ho/oa6q7kq4MDHQNXNMMng5KsPDXw=
|
|
32
|
+
github.com/samchon/ttsc/packages/ttsc/shim/tsoptions v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:EQwrCr3nY0U1SZBNyp6cQSogAiXsjFxTuT8NlMit1lc=
|
|
33
|
+
github.com/samchon/ttsc/packages/ttsc/shim/tspath v0.0.0-20260515042402-b1ffbb39cb71 h1:t4up6yGaVQM6pe9m2mbs1Koi63wOwAz99uhKeg9zyAs=
|
|
34
|
+
github.com/samchon/ttsc/packages/ttsc/shim/tspath v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:hsE2c1bZquSNlDLIkT3SfLH3MrDmMk1BLzWI/KomT1A=
|
|
35
|
+
github.com/samchon/ttsc/packages/ttsc/shim/vfs v0.0.0-20260515042402-b1ffbb39cb71 h1:URGZM8mKDMZwoGbIcQxlB9nkQ5MdS/VtMtmxu+arUHc=
|
|
36
|
+
github.com/samchon/ttsc/packages/ttsc/shim/vfs v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:HoQcoC0FEG3iMI6zvjg8r6j/ves+RVH6SRn48VSi5H0=
|
|
37
|
+
github.com/samchon/ttsc/packages/ttsc/shim/vfs/cachedvfs v0.0.0-20260515042402-b1ffbb39cb71 h1:ySZlL+F/G2kH8zR2qRfxr2Oo2x3VzseStmZi7xveAs8=
|
|
38
|
+
github.com/samchon/ttsc/packages/ttsc/shim/vfs/cachedvfs v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:XS3LhXkn5xadyRe3tW+9+suW/7gh7dPdL43Q+s/lUDo=
|
|
39
|
+
github.com/samchon/ttsc/packages/ttsc/shim/vfs/osvfs v0.0.0-20260515042402-b1ffbb39cb71 h1:8sQ6KlE7xUSlh8wPsnRdeHEBJop1qVBpdVqWyGWlj0U=
|
|
40
|
+
github.com/samchon/ttsc/packages/ttsc/shim/vfs/osvfs v0.0.0-20260515042402-b1ffbb39cb71/go.mod h1:otX+qw8aZLNCoBmCwMAn53Nw0RQTPzSoId3DxmE67So=
|
|
41
|
+
github.com/samchon/typia/packages/typia/native v0.0.0-20260510181336-5a7ad21c4d6f h1:0y1cQPDK53apdqBmhaoYY1ceQ6JDAgmKwTdb/V9Rf9E=
|
|
42
|
+
github.com/samchon/typia/packages/typia/native v0.0.0-20260510181336-5a7ad21c4d6f/go.mod h1:SJDrfiCEK5dtObhJeAl0iqelqmmFm/JIjfJ6z0kID60=
|
|
43
|
+
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
|
|
44
|
+
github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
|
|
45
|
+
github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
|
|
46
|
+
github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s=
|
|
47
|
+
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
|
48
|
+
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
|
49
|
+
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
|
|
50
|
+
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
|
51
|
+
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
|
|
52
|
+
golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
|
|
53
|
+
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
|
|
54
|
+
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
package plugin
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
"fmt"
|
|
6
|
+
"strings"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
const (
|
|
10
|
+
CoreNativeTransform = "@nestia/core/native/transform.cjs"
|
|
11
|
+
CoreTransform = "@nestia/core/lib/transform"
|
|
12
|
+
SDKNativeTransform = "@nestia/sdk/native/transform.cjs"
|
|
13
|
+
SDKTransform = "@nestia/sdk/lib/transform"
|
|
14
|
+
TypiaTransform = "typia/lib/transform"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
type Entry struct {
|
|
18
|
+
Name string
|
|
19
|
+
Stage string
|
|
20
|
+
Transform string
|
|
21
|
+
Config map[string]any
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type Plan struct {
|
|
25
|
+
Core bool
|
|
26
|
+
SDK bool
|
|
27
|
+
Typia bool
|
|
28
|
+
Entries []Entry
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
func (p Plan) UsesNestia() bool {
|
|
32
|
+
return p.Core || p.SDK
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
func ParsePlan(payload string) (Plan, error) {
|
|
36
|
+
payload = strings.TrimSpace(payload)
|
|
37
|
+
if payload == "" {
|
|
38
|
+
return Plan{}, nil
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var raws []struct {
|
|
42
|
+
Name string `json:"name"`
|
|
43
|
+
Stage string `json:"stage"`
|
|
44
|
+
Config map[string]any `json:"config"`
|
|
45
|
+
}
|
|
46
|
+
if err := json.Unmarshal([]byte(payload), &raws); err != nil {
|
|
47
|
+
return Plan{}, fmt.Errorf("parse plugins-json: %w", err)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
plan := Plan{
|
|
51
|
+
Entries: make([]Entry, 0, len(raws)),
|
|
52
|
+
}
|
|
53
|
+
for _, raw := range raws {
|
|
54
|
+
stage := raw.Stage
|
|
55
|
+
if stage == "" {
|
|
56
|
+
stage = "transform"
|
|
57
|
+
}
|
|
58
|
+
transform := stringConfig(raw.Config, "transform")
|
|
59
|
+
entry := Entry{
|
|
60
|
+
Name: raw.Name,
|
|
61
|
+
Stage: stage,
|
|
62
|
+
Transform: transform,
|
|
63
|
+
Config: raw.Config,
|
|
64
|
+
}
|
|
65
|
+
plan.Entries = append(plan.Entries, entry)
|
|
66
|
+
kind := classify(entry)
|
|
67
|
+
plan.Core = plan.Core || kind == "core"
|
|
68
|
+
plan.SDK = plan.SDK || kind == "sdk"
|
|
69
|
+
plan.Typia = plan.Typia || kind == "typia"
|
|
70
|
+
}
|
|
71
|
+
return plan, nil
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
func classify(entry Entry) string {
|
|
75
|
+
name := strings.TrimSpace(entry.Name)
|
|
76
|
+
transform := strings.TrimSpace(entry.Transform)
|
|
77
|
+
switch {
|
|
78
|
+
case name == "@nestia/core" || transform == CoreTransform || transform == CoreNativeTransform:
|
|
79
|
+
return "core"
|
|
80
|
+
case name == "@nestia/sdk" || transform == SDKTransform || transform == SDKNativeTransform:
|
|
81
|
+
return "sdk"
|
|
82
|
+
case name == "typia" || transform == TypiaTransform:
|
|
83
|
+
return "typia"
|
|
84
|
+
default:
|
|
85
|
+
return ""
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
func stringConfig(config map[string]any, key string) string {
|
|
90
|
+
if config == nil {
|
|
91
|
+
return ""
|
|
92
|
+
}
|
|
93
|
+
value, ok := config[key]
|
|
94
|
+
if !ok {
|
|
95
|
+
return ""
|
|
96
|
+
}
|
|
97
|
+
text, ok := value.(string)
|
|
98
|
+
if !ok {
|
|
99
|
+
return ""
|
|
100
|
+
}
|
|
101
|
+
return text
|
|
102
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
|
|
3
|
+
function createTtscPlugin(context) {
|
|
4
|
+
const transform = context?.plugin?.transform;
|
|
5
|
+
const name =
|
|
6
|
+
typeof transform === "string" && transform.includes("@nestia/sdk")
|
|
7
|
+
? "@nestia/sdk"
|
|
8
|
+
: "@nestia/core";
|
|
9
|
+
const peer =
|
|
10
|
+
name === "@nestia/sdk"
|
|
11
|
+
? ["@nestia/core/lib/transform"]
|
|
12
|
+
: ["@nestia/sdk/lib/transform"];
|
|
13
|
+
return {
|
|
14
|
+
name,
|
|
15
|
+
source: path.resolve(__dirname, "cmd", "ttsc-nestia"),
|
|
16
|
+
composes: ["typia/lib/transform", ...peer],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = createTtscPlugin;
|
|
21
|
+
module.exports.createTtscPlugin = createTtscPlugin;
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0-dev.20260520.1",
|
|
4
4
|
"description": "Super-fast validation decorators of NestJS",
|
|
5
|
+
"types": "lib/index.d.ts",
|
|
5
6
|
"main": "lib/index.js",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
"types": "./lib/transform.d.ts",
|
|
13
14
|
"default": "./lib/transform.js"
|
|
14
15
|
},
|
|
16
|
+
"./native/transform.cjs": "./native/transform.cjs",
|
|
15
17
|
"./package.json": "./package.json"
|
|
16
18
|
},
|
|
17
19
|
"tsp": {
|
|
@@ -19,6 +21,11 @@
|
|
|
19
21
|
"parseAllJsDoc": true
|
|
20
22
|
}
|
|
21
23
|
},
|
|
24
|
+
"ttsc": {
|
|
25
|
+
"plugin": {
|
|
26
|
+
"transform": "@nestia/core/native/transform.cjs"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
22
29
|
"repository": {
|
|
23
30
|
"type": "git",
|
|
24
31
|
"url": "https://github.com/samchon/nestia"
|
|
@@ -39,10 +46,8 @@
|
|
|
39
46
|
},
|
|
40
47
|
"homepage": "https://nestia.io",
|
|
41
48
|
"dependencies": {
|
|
42
|
-
"@typia/
|
|
43
|
-
"@typia/
|
|
44
|
-
"@typia/utils": "12.1.0",
|
|
45
|
-
"detect-ts-node": "^1.0.5",
|
|
49
|
+
"@typia/interface": "13.0.0-dev.20260520.2",
|
|
50
|
+
"@typia/utils": "13.0.0-dev.20260520.2",
|
|
46
51
|
"get-function-location": "^2.0.0",
|
|
47
52
|
"glob": "^11.0.3",
|
|
48
53
|
"path-parser": "^6.1.0",
|
|
@@ -50,50 +55,50 @@
|
|
|
50
55
|
"reflect-metadata": ">=0.1.12",
|
|
51
56
|
"rxjs": ">=6.0.3",
|
|
52
57
|
"tgrid": "^1.1.0",
|
|
53
|
-
"typia": "
|
|
58
|
+
"typia": "13.0.0-dev.20260520.2",
|
|
54
59
|
"ws": "^7.5.3",
|
|
55
|
-
"@nestia/fetcher": "^
|
|
60
|
+
"@nestia/fetcher": "^12.0.0-dev.20260520.1"
|
|
56
61
|
},
|
|
57
62
|
"peerDependencies": {
|
|
58
63
|
"@nestjs/common": ">=7.0.1",
|
|
59
64
|
"@nestjs/core": ">=7.0.1",
|
|
60
65
|
"reflect-metadata": ">=0.1.12",
|
|
61
66
|
"rxjs": ">=6.0.3",
|
|
62
|
-
"typia": "
|
|
63
|
-
"@nestia/fetcher": "^
|
|
67
|
+
"typia": "13.0.0-dev.20260520.2",
|
|
68
|
+
"@nestia/fetcher": "^12.0.0-dev.20260520.1"
|
|
64
69
|
},
|
|
65
70
|
"devDependencies": {
|
|
66
71
|
"@nestjs/common": "^11.1.6",
|
|
67
72
|
"@nestjs/core": "^11.1.6",
|
|
68
73
|
"@nestjs/platform-express": "^11.1.6",
|
|
74
|
+
"@typescript/native-preview": "7.0.0-dev.20260518.1",
|
|
69
75
|
"@types/express": "^4.17.15",
|
|
70
|
-
"@types/inquirer": "^9.0.3",
|
|
71
76
|
"@types/multer": "^1.4.12",
|
|
72
77
|
"@types/ws": "^8.5.10",
|
|
73
|
-
"commander": "^10.0.0",
|
|
74
|
-
"comment-json": "^4.2.3",
|
|
75
|
-
"eslint-plugin-deprecation": "^1.4.1",
|
|
76
78
|
"fastify": "^4.28.1",
|
|
77
|
-
"git-last-commit": "^1.0.1",
|
|
78
|
-
"inquirer": "^8.2.5",
|
|
79
79
|
"rimraf": "^6.1.3",
|
|
80
|
-
"
|
|
81
|
-
"tstl": "^3.0.0"
|
|
82
|
-
"typescript": "~6.0.3"
|
|
80
|
+
"ttsc": "^0.12.3",
|
|
81
|
+
"tstl": "^3.0.0"
|
|
83
82
|
},
|
|
84
83
|
"files": [
|
|
85
84
|
"README.md",
|
|
85
|
+
"MIGRATION.md",
|
|
86
86
|
"LICENSE",
|
|
87
87
|
"package.json",
|
|
88
88
|
"lib",
|
|
89
|
+
"native/cmd",
|
|
90
|
+
"native/go.mod",
|
|
91
|
+
"native/go.sum",
|
|
92
|
+
"native/plugin",
|
|
93
|
+
"native/transform.cjs",
|
|
89
94
|
"src"
|
|
90
95
|
],
|
|
91
96
|
"publishConfig": {
|
|
92
97
|
"access": "public"
|
|
93
98
|
},
|
|
94
99
|
"scripts": {
|
|
95
|
-
"build": "rimraf lib &&
|
|
96
|
-
"dev": "
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
"build": "rimraf lib && ttsc",
|
|
101
|
+
"dev": "ttsc --watch",
|
|
102
|
+
"test:go": "cd test && go test ./..."
|
|
103
|
+
}
|
|
99
104
|
}
|
|
@@ -4,8 +4,11 @@ export function NoTransformConfigurationError(method: string) {
|
|
|
4
4
|
throw new Error(
|
|
5
5
|
[
|
|
6
6
|
`Error on nestia.core.${method}(): no transform has been configured.`,
|
|
7
|
-
`
|
|
8
|
-
`
|
|
7
|
+
`Build the project with "ttsc" (not stock "tsc"); the Go-backed @nestia/core transform attaches automatically through ttsc plugin auto-discovery.`,
|
|
8
|
+
`If "ttsc" is missing, run "npx nestia setup" to install the toolchain and runtime packages.`,
|
|
9
|
+
`If you're using a non-standard TypeScript compiler like Babel or SWC, the @nestia/core transformer is not available.`,
|
|
10
|
+
`If you're running "npx nestia sdk/swagger" or similar, run "npx ttsc --noEmit" to surface the underlying compilation error.`,
|
|
11
|
+
`See https://nestia.io/docs/setup for the full setup (tsgo and legacy paths); migration notes are at node_modules/@nestia/core/MIGRATION.md.`,
|
|
9
12
|
].join(" "),
|
|
10
13
|
);
|
|
11
14
|
return undefined as never;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
2
3
|
|
|
3
4
|
import { Creator } from "../../typings/Creator";
|
|
4
5
|
import { SourceFinder } from "../../utils/SourceFinder";
|
|
@@ -7,24 +8,36 @@ export const load_controllers = async (
|
|
|
7
8
|
path: string | string[] | { include: string[]; exclude?: string[] },
|
|
8
9
|
isTsNode?: boolean,
|
|
9
10
|
): Promise<Creator<object>[]> => {
|
|
11
|
+
const include: string[] = Array.isArray(path)
|
|
12
|
+
? path
|
|
13
|
+
: typeof path === "object"
|
|
14
|
+
? path.include
|
|
15
|
+
: [path];
|
|
16
|
+
const exclude: string[] =
|
|
17
|
+
typeof path === "object" && !Array.isArray(path) ? (path.exclude ?? []) : [];
|
|
18
|
+
const filter =
|
|
19
|
+
isTsNode === true
|
|
20
|
+
? (file: string) =>
|
|
21
|
+
file.substring(file.length - 3) === ".ts" &&
|
|
22
|
+
file.substring(file.length - 5) !== ".d.ts"
|
|
23
|
+
: (file: string) => file.substring(file.length - 3) === ".js";
|
|
10
24
|
const sources: string[] = await SourceFinder.find({
|
|
11
|
-
include
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
? path.include
|
|
15
|
-
: [path],
|
|
16
|
-
exclude:
|
|
17
|
-
typeof path === "object" && !Array.isArray(path)
|
|
18
|
-
? (path.exclude ?? [])
|
|
19
|
-
: [],
|
|
20
|
-
filter:
|
|
21
|
-
isTsNode === true || EXTENSION === "ts"
|
|
22
|
-
? (file) =>
|
|
23
|
-
file.substring(file.length - 3) === ".ts" &&
|
|
24
|
-
file.substring(file.length - 5) !== ".d.ts"
|
|
25
|
-
: (flle) => flle.substring(flle.length - 3) === ".js",
|
|
25
|
+
include,
|
|
26
|
+
exclude,
|
|
27
|
+
filter,
|
|
26
28
|
});
|
|
27
|
-
|
|
29
|
+
const controllers: Creator<object>[] = await mount(sources);
|
|
30
|
+
if (controllers.length !== 0 || isTsNode === true) return controllers;
|
|
31
|
+
|
|
32
|
+
const runtimeRoot: string | null = findTtsxRuntimeRoot();
|
|
33
|
+
if (runtimeRoot === null) return controllers;
|
|
34
|
+
|
|
35
|
+
const fallback: string[] = await SourceFinder.find({
|
|
36
|
+
include: include.map((p) => resolveRuntimePattern(runtimeRoot, p)),
|
|
37
|
+
exclude: exclude.map((p) => resolveRuntimePattern(runtimeRoot, p)),
|
|
38
|
+
filter,
|
|
39
|
+
});
|
|
40
|
+
return fallback.length === 0 ? controllers : mount(fallback);
|
|
28
41
|
};
|
|
29
42
|
|
|
30
43
|
/** @internal */
|
|
@@ -41,5 +54,23 @@ async function mount(sources: string[]): Promise<any[]> {
|
|
|
41
54
|
return controllers;
|
|
42
55
|
}
|
|
43
56
|
|
|
44
|
-
|
|
45
|
-
const
|
|
57
|
+
function findTtsxRuntimeRoot(): string | null {
|
|
58
|
+
const entry: string | undefined = process.argv[1];
|
|
59
|
+
if (entry === undefined) return null;
|
|
60
|
+
|
|
61
|
+
let current: string = path.resolve(entry);
|
|
62
|
+
if (fs.existsSync(current) && fs.statSync(current).isFile())
|
|
63
|
+
current = path.dirname(current);
|
|
64
|
+
while (true) {
|
|
65
|
+
if (fs.existsSync(path.join(current, ".ttsx.tsconfig.json")))
|
|
66
|
+
return current;
|
|
67
|
+
const parent: string = path.dirname(current);
|
|
68
|
+
if (parent === current) return null;
|
|
69
|
+
current = parent;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function resolveRuntimePattern(runtimeRoot: string, pattern: string): string {
|
|
74
|
+
if (path.isAbsolute(pattern)) return pattern;
|
|
75
|
+
return path.resolve(runtimeRoot, pattern);
|
|
76
|
+
}
|
|
@@ -35,6 +35,7 @@ const assert =
|
|
|
35
35
|
message: MESSAGE,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
+
if (is_missing_query_property(exp)) return new BadRequestException(MESSAGE);
|
|
38
39
|
throw exp;
|
|
39
40
|
}
|
|
40
41
|
};
|
|
@@ -43,7 +44,14 @@ const assert =
|
|
|
43
44
|
const is =
|
|
44
45
|
<T>(closure: (input: URLSearchParams) => T | null) =>
|
|
45
46
|
(input: URLSearchParams): T | BadRequestException => {
|
|
46
|
-
const result: T | null =
|
|
47
|
+
const result: T | null = (() => {
|
|
48
|
+
try {
|
|
49
|
+
return closure(input);
|
|
50
|
+
} catch (exp) {
|
|
51
|
+
if (is_missing_query_property(exp)) return null;
|
|
52
|
+
throw exp;
|
|
53
|
+
}
|
|
54
|
+
})();
|
|
47
55
|
return result !== null ? result : new BadRequestException(MESSAGE);
|
|
48
56
|
};
|
|
49
57
|
|
|
@@ -51,7 +59,15 @@ const is =
|
|
|
51
59
|
const validate =
|
|
52
60
|
<T>(closure: (input: URLSearchParams) => IValidation<T>) =>
|
|
53
61
|
(input: URLSearchParams): T | BadRequestException => {
|
|
54
|
-
const result: IValidation<T> =
|
|
62
|
+
const result: IValidation<T> | null = (() => {
|
|
63
|
+
try {
|
|
64
|
+
return closure(input);
|
|
65
|
+
} catch (exp) {
|
|
66
|
+
if (is_missing_query_property(exp)) return null;
|
|
67
|
+
throw exp;
|
|
68
|
+
}
|
|
69
|
+
})();
|
|
70
|
+
if (result === null) return new BadRequestException(MESSAGE);
|
|
55
71
|
return result.success
|
|
56
72
|
? result.data
|
|
57
73
|
: new BadRequestException({
|
|
@@ -62,3 +78,6 @@ const validate =
|
|
|
62
78
|
|
|
63
79
|
/** @internal */
|
|
64
80
|
const MESSAGE = "Request query data is not following the promised type.";
|
|
81
|
+
|
|
82
|
+
const is_missing_query_property = (exp: unknown): exp is Error =>
|
|
83
|
+
exp instanceof Error && /^missing [^.\[\]\s]+$/.test(exp.message);
|
package/src/transform.ts
CHANGED
|
@@ -1,35 +1,82 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
|
|
4
|
+
/** @internal */
|
|
5
|
+
interface ITtscPluginFactoryContext {
|
|
6
|
+
projectRoot: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*
|
|
12
|
+
* The `composes` array order is load-bearing: `typia/lib/transform` first
|
|
13
|
+
* (host), then peers consumed by the Go binary's `plugin.ParsePlan`.
|
|
14
|
+
*/
|
|
15
|
+
interface ITtscPlugin {
|
|
16
|
+
name: string;
|
|
17
|
+
source: string;
|
|
18
|
+
composes: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const filename: string = currentFilename();
|
|
22
|
+
const dirname: string = path.dirname(filename);
|
|
23
|
+
|
|
24
|
+
export function createTtscPlugin(
|
|
25
|
+
context: ITtscPluginFactoryContext,
|
|
26
|
+
): ITtscPlugin {
|
|
27
|
+
const root: string =
|
|
28
|
+
resolvePackageRoot("@nestia/core/package.json", context.projectRoot) ??
|
|
29
|
+
inferPackageRoot();
|
|
30
|
+
return {
|
|
31
|
+
name: "@nestia/core",
|
|
32
|
+
source: path.resolve(root, "native", "cmd", "ttsc-nestia"),
|
|
33
|
+
composes: [
|
|
34
|
+
"typia/lib/transform",
|
|
35
|
+
"@nestia/sdk/lib/transform",
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export default createTtscPlugin;
|
|
40
|
+
|
|
41
|
+
function resolvePackageRoot(
|
|
42
|
+
packageJson: string,
|
|
43
|
+
projectRoot: string,
|
|
44
|
+
): string | null {
|
|
45
|
+
try {
|
|
46
|
+
return path.dirname(require.resolve(packageJson, { paths: [projectRoot] }));
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function inferPackageRoot(): string {
|
|
53
|
+
return path.resolve(dirname, "..");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function currentFilename(): string {
|
|
57
|
+
if (
|
|
58
|
+
typeof __filename === "string" &&
|
|
59
|
+
__filename !== "[stdin]" &&
|
|
60
|
+
__filename.length !== 0
|
|
61
|
+
)
|
|
62
|
+
return normalizeFilename(__filename);
|
|
63
|
+
|
|
64
|
+
const line: string | undefined = new Error().stack
|
|
65
|
+
?.split("\n")
|
|
66
|
+
.find(
|
|
67
|
+
(entry) =>
|
|
68
|
+
entry.includes("/src/transform.ts") ||
|
|
69
|
+
entry.includes("/lib/transform.js") ||
|
|
70
|
+
entry.includes("/lib/transform.mjs"),
|
|
71
|
+
);
|
|
72
|
+
const matched: RegExpMatchArray | null | undefined = line?.match(
|
|
73
|
+
/\(([^()]+):\d+:\d+\)|at ([^\s()]+):\d+:\d+/,
|
|
74
|
+
);
|
|
75
|
+
const fallback: string = typeof __filename === "string" ? __filename : "";
|
|
76
|
+
return normalizeFilename(matched?.[1] ?? matched?.[2] ?? fallback);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function normalizeFilename(value: string): string {
|
|
80
|
+
if (value.startsWith("file:")) return fileURLToPath(value);
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { NoTransformConfigurationError as NoTransformConfigureError } from "../NoTransformConfigurationError";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoTransformConfigureError = void 0;
|
|
4
|
-
// For very old legay versions
|
|
5
|
-
var NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
6
|
-
Object.defineProperty(exports, "NoTransformConfigureError", { enumerable: true, get: function () { return NoTransformConfigurationError_1.NoTransformConfigurationError; } });
|
|
7
|
-
//# sourceMappingURL=NoTransformConfigureError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NoTransformConfigureError.js","sourceRoot":"","sources":["../../../src/decorators/internal/NoTransformConfigureError.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kFAA8G;AAArG,0IAAA,6BAA6B,OAA6B"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface INestiaTransformOptions {
|
|
2
|
-
validate?: INestiaTransformOptions.Validate;
|
|
3
|
-
stringify?: INestiaTransformOptions.Stringify | null;
|
|
4
|
-
llm?: boolean | INestiaTransformOptions.ILlm;
|
|
5
|
-
throws?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare namespace INestiaTransformOptions {
|
|
8
|
-
type Validate = "assert" | "is" | "validate" | "assertEquals" | "equals" | "validateEquals" | "assertClone" | "validateClone" | "assertPrune" | "validatePrune";
|
|
9
|
-
type Stringify = "stringify" | "assert" | "is" | "validate" | "validate.log";
|
|
10
|
-
interface ILlm {
|
|
11
|
-
strict?: boolean;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"INestiaTransformOptions.js","sourceRoot":"","sources":["../../src/options/INestiaTransformOptions.ts"],"names":[],"mappings":""}
|