typia 4.0.0-dev.20230519-2 → 4.0.0-dev.20230519-3

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.
@@ -1,3 +1,4 @@
1
1
  import type ts from "typescript/lib/tsclibrary";
2
- declare const transform: ts.CustomTransformersModuleFactory;
3
- export = transform;
2
+ import { ITransformOptions } from "./transformers/ITransformOptions";
3
+ declare const _default: ts.CustomTransformersModuleFactory | ((program: ts.Program, options?: ITransformOptions | undefined) => ts.TransformerFactory<ts.SourceFile>);
4
+ export = _default;
package/lib/transform.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  var FileTransformer_1 = require("./transformers/FileTransformer");
3
- var transform = function (_a) {
3
+ var regular = function (_a) {
4
4
  var typescript = _a.typescript;
5
5
  return ({
6
6
  create: function (info) { return ({
@@ -20,5 +20,19 @@ var transform = function (_a) {
20
20
  }); },
21
21
  });
22
22
  };
23
+ var patch = function (program, options) {
24
+ var tsc = require("ts");
25
+ return FileTransformer_1.FileTransformer.transform({
26
+ tsc: tsc,
27
+ program: program,
28
+ compilerOptions: program.getCompilerOptions(),
29
+ checker: program.getTypeChecker(),
30
+ printer: tsc.createPrinter(),
31
+ options: options || {},
32
+ });
33
+ };
34
+ var transform = function (x, y) {
35
+ return x.typescript ? regular(x) : patch(x, y);
36
+ };
23
37
  module.exports = transform;
24
38
  //# sourceMappingURL=transform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":";AAEA,kEAAiE;AAEjE,IAAM,SAAS,GAAuC,UAAC,EAAc;QAAZ,UAAU,gBAAA;IAAO,OAAA,CAAC;QACvE,MAAM,EAAE,UAAC,IAAI,IAAK,OAAA,CAAC;YACf,MAAM,EAAE;gBACJ,UAAC,OAAO,IAAK,OAAA,UAAC,IAAI;;oBACd,OAAA,iCAAe,CAAC,SAAS,CAAC;wBACtB,GAAG,EAAE,UAAU;w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IAC1B,OAAO,iCAAe,CAAC,SAAS,CAAC;QAC7B,GAAG,KAAA;QACH,OAAO,SAAA;QACP,eAAe,EAAE,OAAO,CAAC,kBAAkB,EAAE;QAC7C,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE;QACjC,OAAO,EAAE,GAAG,CAAC,aAAa,EAAE;QAC5B,OAAO,EAAE,OAAO,IAAI,EAAE;KACzB,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,IAAM,SAAS,GAAG,UAAC,CAAM,EAAE,CAAO;IAC9B,OAAA,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AAAvC,CAAuC,CAAC;AAC5C,iBAAS,SAA0C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typia",
3
- "version": "4.0.0-dev.20230519-2",
3
+ "version": "4.0.0-dev.20230519-3",
4
4
  "description": "Superfast runtime validators with only one line",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
package/src/transform.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import type ts from "typescript/lib/tsclibrary";
2
2
 
3
3
  import { FileTransformer } from "./transformers/FileTransformer";
4
+ import { ITransformOptions } from "./transformers/ITransformOptions";
4
5
 
5
- const transform: ts.CustomTransformersModuleFactory = ({ typescript }) => ({
6
+ const regular: ts.CustomTransformersModuleFactory = ({ typescript }) => ({
6
7
  create: (info) => ({
7
8
  before: [
8
9
  (context) => (file) =>
@@ -17,4 +18,22 @@ const transform: ts.CustomTransformersModuleFactory = ({ typescript }) => ({
17
18
  ],
18
19
  }),
19
20
  });
20
- export = transform;
21
+
22
+ const patch = (
23
+ program: ts.Program,
24
+ options?: ITransformOptions,
25
+ ): ts.TransformerFactory<ts.SourceFile> => {
26
+ const tsc = require("ts");
27
+ return FileTransformer.transform({
28
+ tsc,
29
+ program,
30
+ compilerOptions: program.getCompilerOptions(),
31
+ checker: program.getTypeChecker(),
32
+ printer: tsc.createPrinter(),
33
+ options: options || {},
34
+ });
35
+ };
36
+
37
+ const transform = (x: any, y?: any) =>
38
+ x.typescript ? regular(x) : patch(x, y);
39
+ export = transform as typeof regular | typeof patch;