typia 13.0.0-dev.20260430 → 13.0.0-dev.20260501
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/executable/TypiaGenerateWizard.js +55 -8
- package/lib/executable/TypiaGenerateWizard.js.map +1 -1
- package/lib/executable/TypiaGenerateWizard2.mjs +55 -8
- package/lib/executable/TypiaGenerateWizard2.mjs.map +1 -1
- package/lib/transform.d.ts +2 -13
- package/lib/transform.js +4 -11
- package/lib/transform.js.map +1 -1
- package/lib/transform2.mjs +6 -14
- package/lib/transform2.mjs.map +1 -1
- package/native/adapter/cleanup.go +2 -19
- package/native/cmd/ttsc-typia/transform.go +163 -4
- package/native/core/factories/LiteralFactory.go +14 -1
- package/native/core/programmers/llm/LlmApplicationProgrammer.go +16 -4
- package/native/core/programmers/llm/LlmParametersProgrammer.go +10 -37
- package/native/core/programmers/llm/LlmSchemaProgrammer.go +510 -153
- package/package.json +4 -4
- package/src/executable/TypiaGenerateWizard.ts +78 -9
- package/src/transform.ts +6 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typia",
|
|
3
|
-
"version": "13.0.0-dev.
|
|
3
|
+
"version": "13.0.0-dev.20260501",
|
|
4
4
|
"description": "Superfast runtime validators with only one line",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"inquirer": "^8.2.5",
|
|
43
43
|
"package-manager-detector": "^0.2.0",
|
|
44
44
|
"randexp": "^0.5.3",
|
|
45
|
-
"@typia/interface": "^13.0.0-dev.
|
|
46
|
-
"@typia/utils": "^13.0.0-dev.
|
|
45
|
+
"@typia/interface": "^13.0.0-dev.20260501",
|
|
46
|
+
"@typia/utils": "^13.0.0-dev.20260501"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"rollup-plugin-node-externals": "^8.1.2",
|
|
62
62
|
"suppress-warnings": "^1.0.2",
|
|
63
63
|
"tinyglobby": "^0.2.12",
|
|
64
|
-
"ttsc": "^0.
|
|
64
|
+
"ttsc": "^0.7.2"
|
|
65
65
|
},
|
|
66
66
|
"sideEffects": [
|
|
67
67
|
"./lib/_virtual/*.mjs",
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import { createRequire } from "module";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
type ITtscCompilerDiagnostic,
|
|
6
|
+
type ITtscCompilerTransformation,
|
|
7
|
+
TtscCompiler,
|
|
8
|
+
} from "ttsc";
|
|
5
9
|
|
|
6
10
|
import { ArgumentParser } from "./setup/ArgumentParser";
|
|
7
11
|
import { PackageManager } from "./setup/PackageManager";
|
|
@@ -111,23 +115,51 @@ export namespace TypiaGenerateWizard {
|
|
|
111
115
|
to: location.output,
|
|
112
116
|
});
|
|
113
117
|
|
|
114
|
-
const cwd = path.dirname(location.project);
|
|
115
118
|
const binary = resolveTsgoBinary();
|
|
119
|
+
const cwd = path.dirname(location.project);
|
|
120
|
+
const transformed = transformProject({
|
|
121
|
+
binary,
|
|
122
|
+
cwd,
|
|
123
|
+
tsconfig: location.project,
|
|
124
|
+
});
|
|
116
125
|
for (const file of files) {
|
|
117
126
|
const relative = path.relative(location.input, file);
|
|
118
127
|
const target = path.join(location.output, relative);
|
|
119
|
-
const output =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
128
|
+
const output = transformed[projectKey(cwd, file)];
|
|
129
|
+
if (output === undefined) {
|
|
130
|
+
throw new URIError(
|
|
131
|
+
`Error on TypiaGenerateWizard.generate(): no transformed output for ${file}`,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
126
134
|
await fs.promises.mkdir(path.dirname(target), { recursive: true });
|
|
127
135
|
await fs.promises.writeFile(target, formatOutput(output), "utf8");
|
|
128
136
|
}
|
|
129
137
|
}
|
|
130
138
|
|
|
139
|
+
function transformProject(props: {
|
|
140
|
+
binary: string;
|
|
141
|
+
cwd: string;
|
|
142
|
+
tsconfig: string;
|
|
143
|
+
}): Record<string, string> {
|
|
144
|
+
const result: ITtscCompilerTransformation = new TtscCompiler({
|
|
145
|
+
binary: props.binary,
|
|
146
|
+
cwd: props.cwd,
|
|
147
|
+
plugins: [{ transform: "typia/lib/transform" }],
|
|
148
|
+
tsconfig: props.tsconfig,
|
|
149
|
+
}).transform();
|
|
150
|
+
if (result.type === "success") {
|
|
151
|
+
return result.typescript;
|
|
152
|
+
}
|
|
153
|
+
if (result.type === "failure") {
|
|
154
|
+
throw new URIError(
|
|
155
|
+
`Error on TypiaGenerateWizard.generate(): ${formatDiagnostics(result.diagnostics)}`,
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
throw new URIError(
|
|
159
|
+
`Error on TypiaGenerateWizard.generate(): ${formatUnknownError(result.error)}`,
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
131
163
|
function resolveTsgoBinary(): string {
|
|
132
164
|
const explicit: string | undefined = process.env.TTSC_TSGO_BINARY;
|
|
133
165
|
if (explicit !== undefined && explicit.length !== 0) {
|
|
@@ -256,6 +288,43 @@ export namespace TypiaGenerateWizard {
|
|
|
256
288
|
? output
|
|
257
289
|
: `// @ts-nocheck\n${output}`;
|
|
258
290
|
}
|
|
291
|
+
|
|
292
|
+
function projectKey(root: string, file: string): string {
|
|
293
|
+
return path.relative(root, file).replace(/\\/g, "/");
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function formatDiagnostics(diagnostics: ITtscCompilerDiagnostic[]): string {
|
|
297
|
+
return diagnostics.length === 0
|
|
298
|
+
? "transformation failed"
|
|
299
|
+
: diagnostics
|
|
300
|
+
.map((diag) =>
|
|
301
|
+
[
|
|
302
|
+
diag.file ?? "ttsc",
|
|
303
|
+
diag.line === undefined
|
|
304
|
+
? undefined
|
|
305
|
+
: `${diag.line}:${diag.character ?? 1}`,
|
|
306
|
+
diag.messageText,
|
|
307
|
+
]
|
|
308
|
+
.filter((part) => part !== undefined && part !== "")
|
|
309
|
+
.join(": "),
|
|
310
|
+
)
|
|
311
|
+
.join("\n");
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function formatUnknownError(error: unknown): string {
|
|
315
|
+
if (error instanceof Error) {
|
|
316
|
+
return error.message;
|
|
317
|
+
}
|
|
318
|
+
if (
|
|
319
|
+
typeof error === "object" &&
|
|
320
|
+
error !== null &&
|
|
321
|
+
"message" in error &&
|
|
322
|
+
typeof error.message === "string"
|
|
323
|
+
) {
|
|
324
|
+
return error.message;
|
|
325
|
+
}
|
|
326
|
+
return String(error);
|
|
327
|
+
}
|
|
259
328
|
}
|
|
260
329
|
|
|
261
330
|
const TS_PATTERN = /\.[cm]?tsx?$/;
|
package/src/transform.ts
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ITtscPlugin, ITtscPluginFactoryContext } from "ttsc";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
5
|
const filename: string = currentFilename();
|
|
6
6
|
const dirname: string = path.dirname(filename);
|
|
7
7
|
|
|
8
|
-
export default
|
|
8
|
+
export default function createTtscPlugin(
|
|
9
|
+
context: ITtscPluginFactoryContext,
|
|
10
|
+
): ITtscPlugin {
|
|
9
11
|
const root: string =
|
|
10
12
|
resolvePackageRoot(context.projectRoot) ?? inferPackageRoot();
|
|
11
13
|
return {
|
|
12
14
|
name: "typia",
|
|
13
|
-
|
|
14
|
-
source: {
|
|
15
|
-
dir: path.resolve(root, "native"),
|
|
16
|
-
entry: "./cmd/ttsc-typia",
|
|
17
|
-
},
|
|
18
|
-
contractVersion: 1,
|
|
19
|
-
mode: "typia",
|
|
20
|
-
},
|
|
15
|
+
source: path.resolve(root, "native", "cmd", "ttsc-typia"),
|
|
21
16
|
};
|
|
22
|
-
}
|
|
17
|
+
}
|
|
23
18
|
|
|
24
19
|
function resolvePackageRoot(projectRoot: string): string | null {
|
|
25
20
|
try {
|