@elliots/typical 0.1.0

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 (42) hide show
  1. package/README.md +82 -0
  2. package/bin/ttsc +12 -0
  3. package/bin/ttsx +3 -0
  4. package/dist/src/cli.d.ts +2 -0
  5. package/dist/src/cli.js +89 -0
  6. package/dist/src/cli.js.map +1 -0
  7. package/dist/src/config.d.ts +7 -0
  8. package/dist/src/config.js +26 -0
  9. package/dist/src/config.js.map +1 -0
  10. package/dist/src/esm-loader-register.d.ts +1 -0
  11. package/dist/src/esm-loader-register.js +3 -0
  12. package/dist/src/esm-loader-register.js.map +1 -0
  13. package/dist/src/esm-loader.d.ts +4 -0
  14. package/dist/src/esm-loader.js +25 -0
  15. package/dist/src/esm-loader.js.map +1 -0
  16. package/dist/src/file-filter.d.ts +13 -0
  17. package/dist/src/file-filter.js +38 -0
  18. package/dist/src/file-filter.js.map +1 -0
  19. package/dist/src/index.d.ts +2 -0
  20. package/dist/src/index.js +3 -0
  21. package/dist/src/index.js.map +1 -0
  22. package/dist/src/setup.d.ts +2 -0
  23. package/dist/src/setup.js +14 -0
  24. package/dist/src/setup.js.map +1 -0
  25. package/dist/src/transformer.d.ts +29 -0
  26. package/dist/src/transformer.js +472 -0
  27. package/dist/src/transformer.js.map +1 -0
  28. package/dist/src/tsc-plugin.d.ts +3 -0
  29. package/dist/src/tsc-plugin.js +9 -0
  30. package/dist/src/tsc-plugin.js.map +1 -0
  31. package/package.json +71 -0
  32. package/src/cli.ts +111 -0
  33. package/src/config.ts +35 -0
  34. package/src/esm-loader-register.ts +2 -0
  35. package/src/esm-loader.ts +26 -0
  36. package/src/file-filter.ts +44 -0
  37. package/src/index.ts +2 -0
  38. package/src/patch-fs.cjs +25 -0
  39. package/src/patch-tsconfig.cjs +52 -0
  40. package/src/setup.ts +29 -0
  41. package/src/transformer.ts +831 -0
  42. package/src/tsc-plugin.ts +12 -0
@@ -0,0 +1,472 @@
1
+ import ts from "typescript";
2
+ import { loadConfig } from "./config.js";
3
+ import { shouldTransformFile } from "./file-filter.js";
4
+ import { transform as typiaTransform } from "typia/lib/transform.js";
5
+ import { setupTsProgram } from "./setup.js";
6
+ export class TypicalTransformer {
7
+ config;
8
+ program;
9
+ ts;
10
+ typeValidators = new Map(); // type -> { validator variable name, type node }
11
+ typeStringifiers = new Map(); // type -> { stringifier variable name, type node }
12
+ typeParsers = new Map(); // type -> { parser variable name, type node }
13
+ constructor(config, program, tsInstance) {
14
+ this.config = config ?? loadConfig();
15
+ this.ts = tsInstance ?? ts;
16
+ this.program = program ?? setupTsProgram(this.ts);
17
+ }
18
+ createSourceFile(fileName, content) {
19
+ return this.ts.createSourceFile(fileName, content, this.ts.ScriptTarget.ES2020, true);
20
+ }
21
+ transform(sourceFile, mode) {
22
+ if (typeof sourceFile === "string") {
23
+ const file = this.program.getSourceFile(sourceFile);
24
+ if (!file) {
25
+ throw new Error(`Source file not found in program: ${sourceFile}`);
26
+ }
27
+ sourceFile = file;
28
+ }
29
+ const transformer = this.getTransformer(mode !== "basic");
30
+ const result = this.ts.transform(sourceFile, [transformer]);
31
+ const printer = this.ts.createPrinter();
32
+ const transformedCode = printer.printFile(result.transformed[0]);
33
+ result.dispose();
34
+ if (mode === "typia" || mode === 'basic') {
35
+ return transformedCode;
36
+ }
37
+ const compileResult = ts.transpileModule(transformedCode, {
38
+ compilerOptions: this.program.getCompilerOptions(),
39
+ });
40
+ return compileResult.outputText;
41
+ }
42
+ getTransformer(withTypia) {
43
+ return (context) => {
44
+ const factory = context.factory;
45
+ const typeChecker = this.program.getTypeChecker();
46
+ const transformContext = {
47
+ ts: this.ts,
48
+ factory,
49
+ context,
50
+ };
51
+ return (sourceFile) => {
52
+ if (process.env.DEBUG) {
53
+ console.log("TYPICAL: processing ", sourceFile.fileName);
54
+ }
55
+ // First apply our transformation
56
+ let transformedSourceFile = this.transformSourceFile(sourceFile, transformContext, typeChecker);
57
+ if (!withTypia) {
58
+ return transformedSourceFile;
59
+ }
60
+ // Then apply typia if we added typia calls
61
+ const printer = this.ts.createPrinter();
62
+ const transformedCode = printer.printFile(transformedSourceFile);
63
+ if (transformedCode.includes("typia.")) {
64
+ try {
65
+ // Apply typia transformation to files with typia calls
66
+ // Create a new source file with the transformed code, preserving original filename
67
+ const newSourceFile = this.ts.createSourceFile(sourceFile.fileName, // Use original filename to maintain source map references
68
+ transformedCode, sourceFile.languageVersion, true);
69
+ // Create a new program with the transformed source file so typia's type checker works
70
+ const compilerOptions = this.program.getCompilerOptions();
71
+ const originalSourceFiles = new Map();
72
+ for (const sf of this.program.getSourceFiles()) {
73
+ originalSourceFiles.set(sf.fileName, sf);
74
+ }
75
+ // Replace the original source file with the transformed one
76
+ originalSourceFiles.set(sourceFile.fileName, newSourceFile);
77
+ const customHost = {
78
+ getSourceFile: (fileName, languageVersion) => {
79
+ if (originalSourceFiles.has(fileName)) {
80
+ return originalSourceFiles.get(fileName);
81
+ }
82
+ return this.ts.createSourceFile(fileName, this.ts.sys.readFile(fileName) || "", languageVersion, true);
83
+ },
84
+ getDefaultLibFileName: () => this.ts.getDefaultLibFilePath(compilerOptions),
85
+ writeFile: () => { },
86
+ getCurrentDirectory: () => this.ts.sys.getCurrentDirectory(),
87
+ getCanonicalFileName: (fileName) => this.ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(),
88
+ useCaseSensitiveFileNames: () => this.ts.sys.useCaseSensitiveFileNames,
89
+ getNewLine: () => this.ts.sys.newLine,
90
+ fileExists: (fileName) => originalSourceFiles.has(fileName) || this.ts.sys.fileExists(fileName),
91
+ readFile: (fileName) => this.ts.sys.readFile(fileName),
92
+ };
93
+ const newProgram = this.ts.createProgram(Array.from(originalSourceFiles.keys()), compilerOptions, customHost);
94
+ // Create typia transformer with the NEW program that has the transformed source
95
+ const typiaTransformer = typiaTransform(newProgram, {}, {
96
+ addDiagnostic(diag) {
97
+ console.warn("Typia diagnostic:", diag);
98
+ return 0;
99
+ },
100
+ });
101
+ // Apply the transformer with source map preservation
102
+ const transformationResult = this.ts.transform(newSourceFile, [typiaTransformer], { ...compilerOptions, sourceMap: true });
103
+ if (transformationResult.transformed.length > 0) {
104
+ const finalTransformed = transformationResult.transformed[0];
105
+ transformedSourceFile = finalTransformed;
106
+ // Typia transformation completed successfully
107
+ }
108
+ transformationResult.dispose();
109
+ }
110
+ catch (error) {
111
+ console.warn("Failed to apply typia transformer:", sourceFile.fileName, error);
112
+ }
113
+ }
114
+ return transformedSourceFile;
115
+ };
116
+ };
117
+ }
118
+ /**
119
+ * Transform a single source file with TypeScript AST
120
+ */
121
+ transformSourceFile(sourceFile, ctx, typeChecker) {
122
+ const { ts } = ctx;
123
+ // Check if this file should be transformed
124
+ if (!this.shouldTransformFile(sourceFile.fileName)) {
125
+ return sourceFile; // Return unchanged for excluded files
126
+ }
127
+ // Check if this file has already been transformed by us
128
+ const sourceText = sourceFile.getFullText();
129
+ if (sourceText.includes('__typical_assert_') || sourceText.includes('__typical_stringify_') || sourceText.includes('__typical_parse_')) {
130
+ throw new Error(`File ${sourceFile.fileName} has already been transformed by Typical! Double transformation detected.`);
131
+ }
132
+ // Reset caches for each file
133
+ this.typeValidators.clear();
134
+ this.typeStringifiers.clear();
135
+ this.typeParsers.clear();
136
+ let needsTypiaImport = false;
137
+ const visit = (node) => {
138
+ // Transform JSON calls first (before they get wrapped in functions)
139
+ if (ts.isCallExpression(node) &&
140
+ ts.isPropertyAccessExpression(node.expression)) {
141
+ const propertyAccess = node.expression;
142
+ if (ts.isIdentifier(propertyAccess.expression) &&
143
+ propertyAccess.expression.text === "JSON") {
144
+ needsTypiaImport = true;
145
+ if (propertyAccess.name.text === "stringify") {
146
+ // For stringify, we need to infer the type from the argument
147
+ if (this.config.reusableValidators) {
148
+ // For JSON.stringify, try to infer the type from the argument
149
+ let typeText = "unknown";
150
+ let typeNodeForCache;
151
+ if (node.arguments.length > 0) {
152
+ const arg = node.arguments[0];
153
+ // Check if it's a type assertion
154
+ if (ts.isAsExpression(arg)) {
155
+ // For type assertions, use the asserted type directly
156
+ const assertedType = arg.type;
157
+ const objectType = typeChecker.getTypeFromTypeNode(assertedType);
158
+ const typeNode = assertedType;
159
+ if (typeNode) {
160
+ const typeString = typeChecker.typeToString(objectType);
161
+ typeText = `Asserted_${typeString.replace(/[^a-zA-Z0-9_]/g, "_")}`;
162
+ typeNodeForCache = typeNode;
163
+ }
164
+ else {
165
+ typeText = "unknown";
166
+ typeNodeForCache = ctx.factory.createKeywordTypeNode(ctx.ts.SyntaxKind.UnknownKeyword);
167
+ }
168
+ }
169
+ else if (ts.isObjectLiteralExpression(arg)) {
170
+ // For object literals, use the type checker to get the actual type
171
+ const objectType = typeChecker.getTypeAtLocation(arg);
172
+ const typeNode = typeChecker.typeToTypeNode(objectType, arg, ts.NodeBuilderFlags.InTypeAlias);
173
+ if (typeNode) {
174
+ const propNames = arg.properties
175
+ .map((prop) => {
176
+ if (ts.isShorthandPropertyAssignment(prop)) {
177
+ return prop.name.text;
178
+ }
179
+ else if (ts.isPropertyAssignment(prop) &&
180
+ ts.isIdentifier(prop.name)) {
181
+ return prop.name.text;
182
+ }
183
+ return "unknown";
184
+ })
185
+ .sort()
186
+ .join("_");
187
+ typeText = `ObjectLiteral_${propNames}`;
188
+ typeNodeForCache = typeNode;
189
+ }
190
+ else {
191
+ // typeText = "unknown";
192
+ // typeNodeForCache = ctx.factory.createKeywordTypeNode(
193
+ // ctx.ts.SyntaxKind.UnknownKeyword
194
+ // );
195
+ throw new Error('unknown type node for object literal: ' + arg.getText());
196
+ }
197
+ }
198
+ else {
199
+ // For other expressions, try to get the type from the type checker
200
+ const argType = typeChecker.getTypeAtLocation(arg);
201
+ const typeNode = typeChecker.typeToTypeNode(argType, arg, ts.NodeBuilderFlags.InTypeAlias);
202
+ if (typeNode) {
203
+ const typeString = typeChecker.typeToString(argType);
204
+ typeText = `Expression_${typeString.replace(/[^a-zA-Z0-9_]/g, "_")}`;
205
+ typeNodeForCache = typeNode;
206
+ }
207
+ else {
208
+ typeText = "unknown";
209
+ typeNodeForCache = ctx.factory.createKeywordTypeNode(ctx.ts.SyntaxKind.UnknownKeyword);
210
+ }
211
+ }
212
+ }
213
+ const stringifierName = this.getOrCreateStringifier(typeText, typeNodeForCache);
214
+ const newCall = ctx.factory.createCallExpression(ctx.factory.createIdentifier(stringifierName), undefined, node.arguments);
215
+ return newCall;
216
+ }
217
+ else {
218
+ // Use inline typia.json.stringify
219
+ return ctx.factory.updateCallExpression(node, ctx.factory.createPropertyAccessExpression(ctx.factory.createPropertyAccessExpression(ctx.factory.createIdentifier("typia"), "json"), "stringify"), node.typeArguments, node.arguments);
220
+ }
221
+ }
222
+ else if (propertyAccess.name.text === "parse") {
223
+ // For JSON.parse, we need to infer the expected type from context
224
+ // Check if this is part of a variable declaration or type assertion
225
+ let targetType;
226
+ // Look for type annotations in parent nodes
227
+ let parent = node.parent;
228
+ while (parent) {
229
+ if (ts.isVariableDeclaration(parent) && parent.type) {
230
+ targetType = parent.type;
231
+ break;
232
+ }
233
+ else if (ts.isAsExpression(parent)) {
234
+ targetType = parent.type;
235
+ break;
236
+ }
237
+ else if (ts.isReturnStatement(parent)) {
238
+ // Look for function return type
239
+ let funcParent = parent.parent;
240
+ while (funcParent) {
241
+ if ((ts.isFunctionDeclaration(funcParent) ||
242
+ ts.isArrowFunction(funcParent) ||
243
+ ts.isMethodDeclaration(funcParent)) &&
244
+ funcParent.type) {
245
+ targetType = funcParent.type;
246
+ break;
247
+ }
248
+ funcParent = funcParent.parent;
249
+ }
250
+ break;
251
+ }
252
+ parent = parent.parent;
253
+ }
254
+ if (this.config.reusableValidators && targetType) {
255
+ // Use reusable parser - use typeToString
256
+ const targetTypeObj = typeChecker.getTypeFromTypeNode(targetType);
257
+ const typeText = typeChecker.typeToString(targetTypeObj);
258
+ const parserName = this.getOrCreateParser(typeText, targetType);
259
+ const newCall = ctx.factory.createCallExpression(ctx.factory.createIdentifier(parserName), undefined, node.arguments);
260
+ return newCall;
261
+ }
262
+ else {
263
+ // Use inline typia.json.assertParse
264
+ const typeArguments = targetType
265
+ ? [targetType]
266
+ : node.typeArguments;
267
+ return ctx.factory.updateCallExpression(node, ctx.factory.createPropertyAccessExpression(ctx.factory.createPropertyAccessExpression(ctx.factory.createIdentifier("typia"), "json"), "assertParse"), typeArguments, node.arguments);
268
+ }
269
+ }
270
+ }
271
+ }
272
+ // Transform function declarations
273
+ if (ts.isFunctionDeclaration(node)) {
274
+ needsTypiaImport = true;
275
+ return transformFunction(node);
276
+ }
277
+ // Transform arrow functions
278
+ if (ts.isArrowFunction(node)) {
279
+ needsTypiaImport = true;
280
+ return transformFunction(node);
281
+ }
282
+ // Transform method declarations
283
+ if (ts.isMethodDeclaration(node)) {
284
+ needsTypiaImport = true;
285
+ return transformFunction(node);
286
+ }
287
+ return ctx.ts.visitEachChild(node, visit, ctx.context);
288
+ };
289
+ const transformFunction = (func) => {
290
+ const body = func.body;
291
+ if (!body || !ts.isBlock(body))
292
+ return func;
293
+ // Add parameter validation
294
+ const validationStatements = [];
295
+ func.parameters.forEach((param) => {
296
+ if (param.type) {
297
+ const paramName = ts.isIdentifier(param.name)
298
+ ? param.name.text
299
+ : "param";
300
+ const paramIdentifier = ctx.factory.createIdentifier(paramName);
301
+ if (this.config.reusableValidators) {
302
+ // Use reusable validators - use typeToString
303
+ const paramType = typeChecker.getTypeFromTypeNode(param.type);
304
+ const typeText = typeChecker.typeToString(paramType);
305
+ const validatorName = this.getOrCreateValidator(typeText, param.type);
306
+ const validatorCall = ctx.factory.createCallExpression(ctx.factory.createIdentifier(validatorName), undefined, [paramIdentifier]);
307
+ const assertCall = ctx.factory.createExpressionStatement(validatorCall);
308
+ validationStatements.push(assertCall);
309
+ }
310
+ else {
311
+ // Use inline typia.assert calls
312
+ const typiaIdentifier = ctx.factory.createIdentifier("typia");
313
+ const assertIdentifier = ctx.factory.createIdentifier("assert");
314
+ const propertyAccess = ctx.factory.createPropertyAccessExpression(typiaIdentifier, assertIdentifier);
315
+ const callExpression = ctx.factory.createCallExpression(propertyAccess, [param.type], [paramIdentifier]);
316
+ const assertCall = ctx.factory.createExpressionStatement(callExpression);
317
+ validationStatements.push(assertCall);
318
+ }
319
+ }
320
+ });
321
+ // First visit all child nodes (including JSON calls) before adding validation
322
+ const visitedBody = ctx.ts.visitNode(body, visit);
323
+ // Transform return statements - use explicit type or infer from type checker
324
+ let transformedStatements = visitedBody.statements;
325
+ let returnType = func.type;
326
+ // If no explicit return type, try to infer it from the type checker
327
+ let returnTypeForString;
328
+ if (!returnType) {
329
+ const signature = typeChecker.getSignatureFromDeclaration(func);
330
+ if (signature) {
331
+ const inferredReturnType = typeChecker.getReturnTypeOfSignature(signature);
332
+ returnType = typeChecker.typeToTypeNode(inferredReturnType, func, ts.NodeBuilderFlags.InTypeAlias);
333
+ returnTypeForString = inferredReturnType;
334
+ }
335
+ }
336
+ else {
337
+ // For explicit return types, get the Type from the TypeNode
338
+ returnTypeForString = typeChecker.getTypeFromTypeNode(returnType);
339
+ }
340
+ if (returnType && returnTypeForString) {
341
+ const returnTransformer = (node) => {
342
+ if (ts.isReturnStatement(node) && node.expression) {
343
+ if (this.config.reusableValidators) {
344
+ // Use reusable validators - always use typeToString
345
+ const returnTypeText = typeChecker.typeToString(returnTypeForString);
346
+ const validatorName = this.getOrCreateValidator(returnTypeText, returnType);
347
+ const validatorCall = ctx.factory.createCallExpression(ctx.factory.createIdentifier(validatorName), undefined, [node.expression]);
348
+ return ctx.factory.updateReturnStatement(node, validatorCall);
349
+ }
350
+ else {
351
+ // Use inline typia.assert calls
352
+ const typiaIdentifier = ctx.factory.createIdentifier("typia");
353
+ const assertIdentifier = ctx.factory.createIdentifier("assert");
354
+ const propertyAccess = ctx.factory.createPropertyAccessExpression(typiaIdentifier, assertIdentifier);
355
+ const callExpression = ctx.factory.createCallExpression(propertyAccess, [returnType], [node.expression]);
356
+ return ctx.factory.updateReturnStatement(node, callExpression);
357
+ }
358
+ }
359
+ return ctx.ts.visitEachChild(node, returnTransformer, ctx.context);
360
+ };
361
+ transformedStatements = ctx.ts.visitNodes(visitedBody.statements, returnTransformer);
362
+ }
363
+ // Insert validation statements at the beginning
364
+ const newStatements = ctx.factory.createNodeArray([
365
+ ...validationStatements,
366
+ ...transformedStatements,
367
+ ]);
368
+ const newBody = ctx.factory.updateBlock(visitedBody, newStatements);
369
+ if (ts.isFunctionDeclaration(func)) {
370
+ return ctx.factory.updateFunctionDeclaration(func, func.modifiers, func.asteriskToken, func.name, func.typeParameters, func.parameters, func.type, newBody);
371
+ }
372
+ else if (ts.isArrowFunction(func)) {
373
+ return ctx.factory.updateArrowFunction(func, func.modifiers, func.typeParameters, func.parameters, func.type, func.equalsGreaterThanToken, newBody);
374
+ }
375
+ else if (ts.isMethodDeclaration(func)) {
376
+ return ctx.factory.updateMethodDeclaration(func, func.modifiers, func.asteriskToken, func.name, func.questionToken, func.typeParameters, func.parameters, func.type, newBody);
377
+ }
378
+ return func;
379
+ };
380
+ let transformedSourceFile = ctx.ts.visitNode(sourceFile, visit);
381
+ // Add typia import and validator statements if needed
382
+ if (needsTypiaImport) {
383
+ transformedSourceFile = this.addTypiaImport(transformedSourceFile, ctx);
384
+ // Add validator statements after imports (only if using reusable validators)
385
+ if (this.config.reusableValidators) {
386
+ const validatorStmts = this.createValidatorStatements(ctx);
387
+ if (validatorStmts.length > 0) {
388
+ const importStatements = transformedSourceFile.statements.filter(ctx.ts.isImportDeclaration);
389
+ const otherStatements = transformedSourceFile.statements.filter((stmt) => !ctx.ts.isImportDeclaration(stmt));
390
+ const newStatements = ctx.factory.createNodeArray([
391
+ ...importStatements,
392
+ ...validatorStmts,
393
+ ...otherStatements,
394
+ ]);
395
+ transformedSourceFile = ctx.factory.updateSourceFile(transformedSourceFile, newStatements);
396
+ }
397
+ }
398
+ }
399
+ return transformedSourceFile;
400
+ }
401
+ shouldTransformFile(fileName) {
402
+ return shouldTransformFile(fileName, this.config);
403
+ }
404
+ addTypiaImport(sourceFile, ctx) {
405
+ const { factory } = ctx;
406
+ const existingImports = sourceFile.statements.filter(ctx.ts.isImportDeclaration);
407
+ const hasTypiaImport = existingImports.some((imp) => imp.moduleSpecifier &&
408
+ ctx.ts.isStringLiteral(imp.moduleSpecifier) &&
409
+ imp.moduleSpecifier.text === "typia");
410
+ if (!hasTypiaImport) {
411
+ const typiaImport = factory.createImportDeclaration(undefined, factory.createImportClause(false, factory.createIdentifier("typia"), undefined), factory.createStringLiteral("typia"));
412
+ const newSourceFile = factory.updateSourceFile(sourceFile, factory.createNodeArray([typiaImport, ...sourceFile.statements]));
413
+ return newSourceFile;
414
+ }
415
+ return sourceFile;
416
+ }
417
+ getOrCreateValidator(typeText, typeNode) {
418
+ if (this.typeValidators.has(typeText)) {
419
+ return this.typeValidators.get(typeText).name;
420
+ }
421
+ const validatorName = `__typical_assert_${this.typeValidators.size}`;
422
+ this.typeValidators.set(typeText, { name: validatorName, typeNode });
423
+ return validatorName;
424
+ }
425
+ getOrCreateStringifier(typeText, typeNode) {
426
+ if (this.typeStringifiers.has(typeText)) {
427
+ return this.typeStringifiers.get(typeText).name;
428
+ }
429
+ const stringifierName = `__typical_stringify_${this.typeStringifiers.size}`;
430
+ this.typeStringifiers.set(typeText, { name: stringifierName, typeNode });
431
+ return stringifierName;
432
+ }
433
+ getOrCreateParser(typeText, typeNode) {
434
+ if (this.typeParsers.has(typeText)) {
435
+ return this.typeParsers.get(typeText).name;
436
+ }
437
+ const parserName = `__typical_parse_${this.typeParsers.size}`;
438
+ this.typeParsers.set(typeText, { name: parserName, typeNode });
439
+ return parserName;
440
+ }
441
+ createValidatorStatements(ctx) {
442
+ const { factory } = ctx;
443
+ const statements = [];
444
+ // Create assert validators
445
+ for (const [, { name: validatorName, typeNode }] of this.typeValidators) {
446
+ const createAssertCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("typia"), "createAssert"), [typeNode], []);
447
+ const validatorDeclaration = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
448
+ factory.createVariableDeclaration(validatorName, undefined, undefined, createAssertCall),
449
+ ], ctx.ts.NodeFlags.Const));
450
+ statements.push(validatorDeclaration);
451
+ }
452
+ // Create stringifiers
453
+ for (const [, { name: stringifierName, typeNode }] of this
454
+ .typeStringifiers) {
455
+ const createStringifyCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(factory.createIdentifier("typia"), "json"), "createStringify"), [typeNode], []);
456
+ const stringifierDeclaration = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
457
+ factory.createVariableDeclaration(stringifierName, undefined, undefined, createStringifyCall),
458
+ ], ctx.ts.NodeFlags.Const));
459
+ statements.push(stringifierDeclaration);
460
+ }
461
+ // Create parsers
462
+ for (const [, { name: parserName, typeNode }] of this.typeParsers) {
463
+ const createParseCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(factory.createIdentifier("typia"), "json"), "createAssertParse"), [typeNode], []);
464
+ const parserDeclaration = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
465
+ factory.createVariableDeclaration(parserName, undefined, undefined, createParseCall),
466
+ ], ctx.ts.NodeFlags.Const));
467
+ statements.push(parserDeclaration);
468
+ }
469
+ return statements;
470
+ }
471
+ }
472
+ //# sourceMappingURL=transformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformer.js","sourceRoot":"","sources":["../../src/transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAiB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ5C,MAAM,OAAO,kBAAkB;IACtB,MAAM,CAAgB;IACrB,OAAO,CAAa;IACpB,EAAE,CAAY;IACd,cAAc,GAAG,IAAI,GAA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AS,EACT,OAAO,CAAC,6BAA6B,CACnC;gBACE,OAAO,CAAC,yBAAyB,CAC/B,eAAe,EACf,SAAS,EACT,SAAS,EACT,mBAAmB,CACpB;aACF,EACD,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CACvB,CACF,CAAC;YACF,UAAU,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC1C,CAAC;QAED,iBAAiB;QACjB,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAClE,MAAM,eAAe,GAAG,OAAO,CAAC,oBAAoB,CAClD,OAAO,CAAC,8BAA8B,CACpC,OAAO,CAAC,8BAA8B,CACpC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EACjC,MAAM,CACP,EACD,mBAAmB,CACpB,EACD,CAAC,QAAQ,CAAC,EACV,EAAE,CACH,CAAC;YAEF,MAAM,iBAAiB,GAAG,OAAO,CAAC,uBAAuB,CACvD,SAAS,EACT,OAAO,CAAC,6BAA6B,CACnC;gBACE,OAAO,CAAC,yBAAyB,CAC/B,UAAU,EACV,SAAS,EACT,SAAS,EACT,eAAe,CAChB;aACF,EACD,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CACvB,CACF,CAAC;YACF,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import type ts from 'typescript';
2
+ import type { TransformerExtras, PluginConfig } from 'ts-patch';
3
+ export default function (program: ts.Program, pluginConfig: PluginConfig, { ts: tsInstance }: TransformerExtras): ts.TransformerFactory<ts.SourceFile>;
@@ -0,0 +1,9 @@
1
+ import { TypicalTransformer } from './transformer.js';
2
+ import { loadConfig } from './config.js';
3
+ export default function (program, pluginConfig, { ts: tsInstance }) {
4
+ const config = loadConfig();
5
+ const transformer = new TypicalTransformer(config, program, tsInstance);
6
+ // Create the typical transformer with typia integration
7
+ return transformer.getTransformer(true);
8
+ }
9
+ //# sourceMappingURL=tsc-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsc-plugin.js","sourceRoot":"","sources":["../../src/tsc-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,OAAO,WAAW,OAAmB,EAAE,YAA0B,EAAE,EAAE,EAAE,EAAE,UAAU,EAAqB;IAC7G,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,WAAW,GAAG,IAAI,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAExE,wDAAwD;IACxD,OAAO,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@elliots/typical",
3
+ "version": "0.1.0",
4
+ "description": "Runtime safe TypeScript transformer using typia",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "typical": "dist/cli.js",
9
+ "ttsx": "bin/ttsx",
10
+ "ttsc": "bin/ttsc"
11
+ },
12
+ "exports": {
13
+ ".": "./dist/index.js",
14
+ "./tsc-plugin": "./dist/src/tsc-plugin.js",
15
+ "./esm": "./dist/src/esm-loader-register.js",
16
+ "./loader": "./dist/src/esm-loader.js"
17
+ },
18
+ "files": [
19
+ "dist/src",
20
+ "bin",
21
+ "src"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsc",
25
+ "dev": "tsc --watch",
26
+ "test": "rm -f test/test.temp.ts && tsc && node --import ./dist/src/esm-loader-register.js --test dist/test/*.test.js",
27
+ "prepublishOnly": "npm run build && npm test",
28
+ "sample:esm": "cd samples/esm && npm install && npm run start",
29
+ "sample:ttsx": "cd samples/ttsx && npm install && npm run start",
30
+ "sample:tsc": "cd samples/tsc && npm install && npm run build && npm run start",
31
+ "sample:ttsc": "cd samples/ttsc && npm install && npm run build && npm run start",
32
+ "samples": "npm run sample:esm && npm run sample:ttsx && npm run sample:tsc && npm run sample:ttsc"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/elliots/typical.git"
37
+ },
38
+ "bugs": {
39
+ "url": "https://github.com/elliots/typical/issues"
40
+ },
41
+ "homepage": "https://github.com/elliots/typical#readme",
42
+ "keywords": [
43
+ "typescript",
44
+ "runtime",
45
+ "validation",
46
+ "typia",
47
+ "transformer"
48
+ ],
49
+ "author": "Elliot Shepherd <elliot@jarofworms.com>",
50
+ "license": "MIT",
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "dependencies": {
55
+ "commander": "14.0.2",
56
+ "glob": "13.0.0",
57
+ "minimatch": "10.0.1",
58
+ "strip-json-comments": "5.0.3",
59
+ "ts-patch": "3.3.0",
60
+ "tsx": "4.21.0",
61
+ "typia": "11.0.0",
62
+ "unplugin": "2.3.11",
63
+ "typescript": "^5.0.0"
64
+ },
65
+ "devDependencies": {
66
+ "@types/node": "22"
67
+ },
68
+ "peerDependencies": {
69
+ "typescript": "^5.0.0"
70
+ }
71
+ }