@elliots/unplugin-typical 0.2.0 → 0.2.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.
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./index-DrHjl95P.mjs";
1
+ import { t as Typical } from "./index-BQdMWxHU.mjs";
2
2
 
3
3
  //#region src/esbuild.d.ts
4
4
 
package/dist/esbuild.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./src-DKwWaQcb.mjs";
1
+ import { t as Typical } from "./src-DjSuKGi4.mjs";
2
2
 
3
3
  //#region src/esbuild.ts
4
4
  /**
package/dist/farm.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./index-DrHjl95P.mjs";
1
+ import { t as Typical } from "./index-BQdMWxHU.mjs";
2
2
 
3
3
  //#region src/farm.d.ts
4
4
 
package/dist/farm.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./src-DKwWaQcb.mjs";
1
+ import { t as Typical } from "./src-DjSuKGi4.mjs";
2
2
 
3
3
  //#region src/farm.ts
4
4
  /**
@@ -34,12 +34,6 @@ interface TypicalConfig {
34
34
  * Example: ["React.*", "Express.Request", "*.Event"]
35
35
  */
36
36
  ignoreTypes?: string[];
37
- /**
38
- * Skip validation for DOM types (Document, Element, Node, etc.) and their subclasses.
39
- * These types have complex Window intersections that typia cannot process.
40
- * Default: true
41
- */
42
- ignoreDOMTypes?: boolean;
43
37
  /**
44
38
  * Validate function parameters and return types at runtime.
45
39
  * When enabled, typed function parameters get runtime validation calls injected.
@@ -63,6 +57,14 @@ interface TypicalConfig {
63
57
  * Controls whether and how source maps are generated for transformed code.
64
58
  */
65
59
  sourceMap?: TypicalSourceMapConfig;
60
+ /**
61
+ * Maximum number of helper functions (_io0, _io1, etc.) that can be generated
62
+ * for a single type before erroring. Complex DOM types or library types can
63
+ * generate hundreds of functions which indicates a type that should be excluded.
64
+ * Set to 0 to disable the limit.
65
+ * Default: 50
66
+ */
67
+ maxGeneratedFunctions?: number;
66
68
  }
67
69
  //#endregion
68
70
  //#region src/core/options.d.ts
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as Options, t as Typical } from "./index-DrHjl95P.mjs";
1
+ import { n as Options, t as Typical } from "./index-BQdMWxHU.mjs";
2
2
  export { Options, Typical };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as Typical } from "./src-DKwWaQcb.mjs";
1
+ import { t as Typical } from "./src-DjSuKGi4.mjs";
2
2
 
3
3
  export { Typical };
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./index-DrHjl95P.mjs";
1
+ import { t as Typical } from "./index-BQdMWxHU.mjs";
2
2
 
3
3
  //#region src/rolldown.d.ts
4
4
 
package/dist/rolldown.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./src-DKwWaQcb.mjs";
1
+ import { t as Typical } from "./src-DjSuKGi4.mjs";
2
2
 
3
3
  //#region src/rolldown.ts
4
4
  /**
package/dist/rollup.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./index-DrHjl95P.mjs";
1
+ import { t as Typical } from "./index-BQdMWxHU.mjs";
2
2
 
3
3
  //#region src/rollup.d.ts
4
4
 
package/dist/rollup.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./src-DKwWaQcb.mjs";
1
+ import { t as Typical } from "./src-DjSuKGi4.mjs";
2
2
 
3
3
  //#region src/rollup.ts
4
4
  /**
package/dist/rspack.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./index-DrHjl95P.mjs";
1
+ import { t as Typical } from "./index-BQdMWxHU.mjs";
2
2
 
3
3
  //#region src/rspack.d.ts
4
4
 
package/dist/rspack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./src-DKwWaQcb.mjs";
1
+ import { t as Typical } from "./src-DjSuKGi4.mjs";
2
2
 
3
3
  //#region src/rspack.ts
4
4
  /**
@@ -20,6 +20,7 @@ const TRANSFORM_EXTENSIONS = new Set([
20
20
  ".mts",
21
21
  ".cts"
22
22
  ]);
23
+ const SKIP_ERROR_PATTERNS = ["source file not found"];
23
24
  let transformer = null;
24
25
  /**
25
26
  * Transform a TypeScript file with Typical.
@@ -41,7 +42,19 @@ async function transformTypia(id, _source, config) {
41
42
  buildTimer.end("init-transformer");
42
43
  }
43
44
  buildTimer.start("transform");
44
- const result = await transformer.transform(resolvedId, "ts");
45
+ let result;
46
+ try {
47
+ result = await transformer.transform(resolvedId, "ts");
48
+ } catch (error) {
49
+ buildTimer.end("transform");
50
+ buildTimer.end("total-transform");
51
+ const errorMessage = error instanceof Error ? error.message : String(error);
52
+ if (SKIP_ERROR_PATTERNS.some((pattern) => errorMessage.includes(pattern))) {
53
+ if (process.env.DEBUG) console.log(`[unplugin-typical] Skipping file (not in project): ${resolvedId}`);
54
+ return;
55
+ }
56
+ throw error;
57
+ }
45
58
  buildTimer.end("transform");
46
59
  buildTimer.end("total-transform");
47
60
  if (process.env.DEBUG) console.log("[unplugin-typical] Transform output (first 1000 chars):", result.code.substring(0, 1e3));
@@ -84,8 +97,15 @@ const Typical = createUnplugin((rawOptions = {}) => {
84
97
  include: options.include,
85
98
  exclude: options.exclude
86
99
  } },
87
- handler(code, id) {
88
- return transformTypia(id, code, typicalConfig);
100
+ async handler(code, id) {
101
+ const result = await transformTypia(id, code, typicalConfig);
102
+ if (process.env.DEBUG && result) {
103
+ console.log(`[unplugin-typical] Transformed ${id}:`);
104
+ console.log(` - Input length: ${code.length}`);
105
+ console.log(` - Output length: ${result.code.length}`);
106
+ console.log(` - Changed: ${code !== result.code}`);
107
+ }
108
+ return result;
89
109
  }
90
110
  }
91
111
  };
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./index-DrHjl95P.mjs";
1
+ import { t as Typical } from "./index-BQdMWxHU.mjs";
2
2
 
3
3
  //#region src/vite.d.ts
4
4
 
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./src-DKwWaQcb.mjs";
1
+ import { t as Typical } from "./src-DjSuKGi4.mjs";
2
2
 
3
3
  //#region src/vite.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./index-DrHjl95P.mjs";
1
+ import { t as Typical } from "./index-BQdMWxHU.mjs";
2
2
 
3
3
  //#region src/webpack.d.ts
4
4
 
package/dist/webpack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./src-DKwWaQcb.mjs";
1
+ import { t as Typical } from "./src-DjSuKGi4.mjs";
2
2
 
3
3
  //#region src/webpack.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliots/unplugin-typical",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Unplugin for typical - runtime safe TypeScript transformer",
5
5
  "keywords": [
6
6
  "esbuild",
@@ -57,7 +57,7 @@
57
57
  "access": "public"
58
58
  },
59
59
  "dependencies": {
60
- "@elliots/typical": "0.2.0",
60
+ "@elliots/typical": "0.2.1",
61
61
  "unplugin": "^2.3.11"
62
62
  },
63
63
  "devDependencies": {