@elliots/unplugin-typical 0.2.4 → 0.2.5

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,18 +1,7 @@
1
- import { t as Typical } from "./index-qgC-Uqjp.mjs";
1
+ import { n as Options, t as Typical } from "./index-BAQO9wYA.mjs";
2
+ import * as unplugin1 from "unplugin";
2
3
 
3
4
  //#region src/esbuild.d.ts
4
-
5
- /**
6
- * Esbuild plugin
7
- *
8
- * @example
9
- * ```ts
10
- * import { build } from 'esbuild'
11
- * import Typical from '@elliots/unplugin-typical/esbuild'
12
- *
13
- * build({ plugins: [Typical()] })
14
- * ```
15
- */
16
- declare const esbuild: typeof Typical.esbuild;
5
+ declare const _default: (options?: Options | undefined) => unplugin1.EsbuildPlugin;
17
6
  //#endregion
18
- export { esbuild as default, esbuild as "module.exports" };
7
+ export { Typical, _default as default };
package/dist/esbuild.mjs CHANGED
@@ -1,24 +1,7 @@
1
- import { t as Typical } from "./src-DjSuKGi4.mjs";
1
+ import { t as Typical } from "./src-VKzfwAoo.mjs";
2
2
 
3
3
  //#region src/esbuild.ts
4
- /**
5
- * This entry file is for esbuild plugin.
6
- *
7
- * @module
8
- */
9
- /**
10
- * Esbuild plugin
11
- *
12
- * @example
13
- * ```ts
14
- * import { build } from 'esbuild'
15
- * import Typical from '@elliots/unplugin-typical/esbuild'
16
- *
17
- * build({ plugins: [Typical()] })
18
- * ```
19
- */
20
- const esbuild = Typical.esbuild;
21
- var esbuild_default = esbuild;
4
+ var esbuild_default = Typical.esbuild;
22
5
 
23
6
  //#endregion
24
- export { esbuild_default as default, esbuild as "module.exports" };
7
+ export { Typical, esbuild_default as default };
package/dist/farm.d.mts CHANGED
@@ -1,20 +1,6 @@
1
- import { t as Typical } from "./index-qgC-Uqjp.mjs";
1
+ import { n as Options, t as Typical } from "./index-BAQO9wYA.mjs";
2
2
 
3
3
  //#region src/farm.d.ts
4
-
5
- /**
6
- * Farm plugin
7
- *
8
- * @example
9
- * ```ts
10
- * // farm.config.ts
11
- * import Typical from '@elliots/unplugin-typical/farm'
12
- *
13
- * export default {
14
- * plugins: [Typical()],
15
- * }
16
- * ```
17
- */
18
- declare const farm: typeof Typical.farm;
4
+ declare const _default: (options?: Options | undefined) => JsPlugin;
19
5
  //#endregion
20
- export { farm as default, farm as "module.exports" };
6
+ export { Typical, _default as default };
package/dist/farm.mjs CHANGED
@@ -1,26 +1,7 @@
1
- import { t as Typical } from "./src-DjSuKGi4.mjs";
1
+ import { t as Typical } from "./src-VKzfwAoo.mjs";
2
2
 
3
3
  //#region src/farm.ts
4
- /**
5
- * This entry file is for Farm plugin.
6
- *
7
- * @module
8
- */
9
- /**
10
- * Farm plugin
11
- *
12
- * @example
13
- * ```ts
14
- * // farm.config.ts
15
- * import Typical from '@elliots/unplugin-typical/farm'
16
- *
17
- * export default {
18
- * plugins: [Typical()],
19
- * }
20
- * ```
21
- */
22
- const farm = Typical.farm;
23
- var farm_default = farm;
4
+ var farm_default = Typical.farm;
24
5
 
25
6
  //#endregion
26
- export { farm_default as default, farm as "module.exports" };
7
+ export { Typical, farm_default as default };
@@ -0,0 +1,30 @@
1
+ import { UnpluginInstance } from "unplugin";
2
+ import { TypicalConfig } from "@elliots/typical";
3
+
4
+ //#region src/core/options.d.ts
5
+ interface Options {
6
+ /**
7
+ * Patterns to include for transformation.
8
+ * Uses unplugin's filter format.
9
+ */
10
+ include?: (string | RegExp)[];
11
+ /**
12
+ * Patterns to exclude from transformation.
13
+ * Uses unplugin's filter format.
14
+ */
15
+ exclude?: (string | RegExp)[];
16
+ /**
17
+ * Plugin enforcement order.
18
+ * @default undefined
19
+ */
20
+ enforce?: "pre" | "post";
21
+ /**
22
+ * Typical configuration overrides.
23
+ */
24
+ typical?: Partial<TypicalConfig>;
25
+ }
26
+ //#endregion
27
+ //#region src/index.d.ts
28
+ declare const Typical: UnpluginInstance<Options | undefined, false>;
29
+ //#endregion
30
+ export { Options as n, Typical as t };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as Options, t as Typical } from "./index-qgC-Uqjp.mjs";
2
- export { Options, Typical };
1
+ import { n as Options, t as Typical } from "./index-BAQO9wYA.mjs";
2
+ export { Options, Typical, Typical as default };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as Typical } from "./src-DjSuKGi4.mjs";
1
+ import { n as src_default, t as Typical } from "./src-VKzfwAoo.mjs";
2
2
 
3
- export { Typical };
3
+ export { Typical, src_default as default };
@@ -1,20 +1,7 @@
1
- import { t as Typical } from "./index-qgC-Uqjp.mjs";
1
+ import { n as Options, t as Typical } from "./index-BAQO9wYA.mjs";
2
+ import * as unplugin0 from "unplugin";
2
3
 
3
4
  //#region src/rolldown.d.ts
4
-
5
- /**
6
- * Rolldown plugin
7
- *
8
- * @example
9
- * ```ts
10
- * // rolldown.config.js
11
- * import Typical from '@elliots/unplugin-typical/rolldown'
12
- *
13
- * export default {
14
- * plugins: [Typical()],
15
- * }
16
- * ```
17
- */
18
- declare const rolldown: typeof Typical.rolldown;
5
+ declare const _default: (options?: Options | undefined) => unplugin0.RolldownPlugin<any>;
19
6
  //#endregion
20
- export { rolldown as default, rolldown as "module.exports" };
7
+ export { Typical, _default as default };
package/dist/rolldown.mjs CHANGED
@@ -1,26 +1,7 @@
1
- import { t as Typical } from "./src-DjSuKGi4.mjs";
1
+ import { t as Typical } from "./src-VKzfwAoo.mjs";
2
2
 
3
3
  //#region src/rolldown.ts
4
- /**
5
- * This entry file is for Rolldown plugin.
6
- *
7
- * @module
8
- */
9
- /**
10
- * Rolldown plugin
11
- *
12
- * @example
13
- * ```ts
14
- * // rolldown.config.js
15
- * import Typical from '@elliots/unplugin-typical/rolldown'
16
- *
17
- * export default {
18
- * plugins: [Typical()],
19
- * }
20
- * ```
21
- */
22
- const rolldown = Typical.rolldown;
23
- var rolldown_default = rolldown;
4
+ var rolldown_default = Typical.rolldown;
24
5
 
25
6
  //#endregion
26
- export { rolldown_default as default, rolldown as "module.exports" };
7
+ export { Typical, rolldown_default as default };
package/dist/rollup.d.mts CHANGED
@@ -1,20 +1,7 @@
1
- import { t as Typical } from "./index-qgC-Uqjp.mjs";
1
+ import { n as Options, t as Typical } from "./index-BAQO9wYA.mjs";
2
+ import * as rollup0 from "rollup";
2
3
 
3
4
  //#region src/rollup.d.ts
4
-
5
- /**
6
- * Rollup plugin
7
- *
8
- * @example
9
- * ```ts
10
- * // rollup.config.js
11
- * import Typical from '@elliots/unplugin-typical/rollup'
12
- *
13
- * export default {
14
- * plugins: [Typical()],
15
- * }
16
- * ```
17
- */
18
- declare const rollup: typeof Typical.rollup;
5
+ declare const _default: (options?: Options | undefined) => rollup0.Plugin<any>;
19
6
  //#endregion
20
- export { rollup as default, rollup as "module.exports" };
7
+ export { Typical, _default as default };
package/dist/rollup.mjs CHANGED
@@ -1,26 +1,7 @@
1
- import { t as Typical } from "./src-DjSuKGi4.mjs";
1
+ import { t as Typical } from "./src-VKzfwAoo.mjs";
2
2
 
3
3
  //#region src/rollup.ts
4
- /**
5
- * This entry file is for Rollup plugin.
6
- *
7
- * @module
8
- */
9
- /**
10
- * Rollup plugin
11
- *
12
- * @example
13
- * ```ts
14
- * // rollup.config.js
15
- * import Typical from '@elliots/unplugin-typical/rollup'
16
- *
17
- * export default {
18
- * plugins: [Typical()],
19
- * }
20
- * ```
21
- */
22
- const rollup = Typical.rollup;
23
- var rollup_default = rollup;
4
+ var rollup_default = Typical.rollup;
24
5
 
25
6
  //#endregion
26
- export { rollup_default as default, rollup as "module.exports" };
7
+ export { Typical, rollup_default as default };
package/dist/rspack.d.mts CHANGED
@@ -1,20 +1,6 @@
1
- import { t as Typical } from "./index-qgC-Uqjp.mjs";
1
+ import { n as Options, t as Typical } from "./index-BAQO9wYA.mjs";
2
2
 
3
3
  //#region src/rspack.d.ts
4
-
5
- /**
6
- * Rspack plugin
7
- *
8
- * @example
9
- * ```js
10
- * // rspack.config.js
11
- * import Typical from '@elliots/unplugin-typical/rspack'
12
- *
13
- * export default {
14
- * plugins: [Typical()],
15
- * }
16
- * ```
17
- */
18
- declare const rspack: typeof Typical.rspack;
4
+ declare const _default: (options?: Options | undefined) => RspackPluginInstance;
19
5
  //#endregion
20
- export { rspack as default, rspack as "module.exports" };
6
+ export { Typical, _default as default };
package/dist/rspack.mjs CHANGED
@@ -1,26 +1,7 @@
1
- import { t as Typical } from "./src-DjSuKGi4.mjs";
1
+ import { t as Typical } from "./src-VKzfwAoo.mjs";
2
2
 
3
3
  //#region src/rspack.ts
4
- /**
5
- * This entry file is for Rspack plugin.
6
- *
7
- * @module
8
- */
9
- /**
10
- * Rspack plugin
11
- *
12
- * @example
13
- * ```js
14
- * // rspack.config.js
15
- * import Typical from '@elliots/unplugin-typical/rspack'
16
- *
17
- * export default {
18
- * plugins: [Typical()],
19
- * }
20
- * ```
21
- */
22
- const rspack = Typical.rspack;
23
- var rspack_default = rspack;
4
+ var rspack_default = Typical.rspack;
24
5
 
25
6
  //#endregion
26
- export { rspack_default as default, rspack as "module.exports" };
7
+ export { Typical, rspack_default as default };
@@ -3,12 +3,15 @@ import { TypicalTransformer, buildTimer, loadConfig } from "@elliots/typical";
3
3
  import { extname, resolve } from "path";
4
4
 
5
5
  //#region src/core/options.ts
6
- function resolveOptions(options) {
6
+ /**
7
+ * Resolve plugin options with defaults.
8
+ */
9
+ function resolveOptions(options = {}) {
7
10
  return {
8
- include: options.include || [/\.[cm]?[jt]sx?$/],
9
- exclude: options.exclude || [/node_modules/],
10
- enforce: "enforce" in options ? options.enforce : "pre",
11
- typical: options.typical
11
+ include: options.include ?? [/\.[cm]?tsx?$/],
12
+ exclude: options.exclude ?? [/node_modules/],
13
+ enforce: options.enforce,
14
+ typical: options.typical ?? {}
12
15
  };
13
16
  }
14
17
 
@@ -110,6 +113,7 @@ const Typical = createUnplugin((rawOptions = {}) => {
110
113
  }
111
114
  };
112
115
  });
116
+ var src_default = Typical;
113
117
 
114
118
  //#endregion
115
- export { Typical as t };
119
+ export { src_default as n, Typical as t };
package/dist/vite.d.mts CHANGED
@@ -1,20 +1,7 @@
1
- import { t as Typical } from "./index-qgC-Uqjp.mjs";
1
+ import { n as Options, t as Typical } from "./index-BAQO9wYA.mjs";
2
+ import * as unplugin0 from "unplugin";
2
3
 
3
4
  //#region src/vite.d.ts
4
-
5
- /**
6
- * Vite plugin
7
- *
8
- * @example
9
- * ```ts
10
- * // vite.config.ts
11
- * import Typical from '@elliots/unplugin-typical/vite'
12
- *
13
- * export default defineConfig({
14
- * plugins: [Typical()],
15
- * })
16
- * ```
17
- */
18
- declare const vite: typeof Typical.vite;
5
+ declare const _default: (options?: Options | undefined) => unplugin0.VitePlugin<any>;
19
6
  //#endregion
20
- export { vite as default, vite as "module.exports" };
7
+ export { Typical, _default as default };
package/dist/vite.mjs CHANGED
@@ -1,26 +1,7 @@
1
- import { t as Typical } from "./src-DjSuKGi4.mjs";
1
+ import { t as Typical } from "./src-VKzfwAoo.mjs";
2
2
 
3
3
  //#region src/vite.ts
4
- /**
5
- * This entry file is for Vite plugin.
6
- *
7
- * @module
8
- */
9
- /**
10
- * Vite plugin
11
- *
12
- * @example
13
- * ```ts
14
- * // vite.config.ts
15
- * import Typical from '@elliots/unplugin-typical/vite'
16
- *
17
- * export default defineConfig({
18
- * plugins: [Typical()],
19
- * })
20
- * ```
21
- */
22
- const vite = Typical.vite;
23
- var vite_default = vite;
4
+ var vite_default = Typical.vite;
24
5
 
25
6
  //#endregion
26
- export { vite_default as default, vite as "module.exports" };
7
+ export { Typical, vite_default as default };
@@ -1,20 +1,6 @@
1
- import { t as Typical } from "./index-qgC-Uqjp.mjs";
1
+ import { n as Options, t as Typical } from "./index-BAQO9wYA.mjs";
2
2
 
3
3
  //#region src/webpack.d.ts
4
-
5
- /**
6
- * Webpack plugin
7
- *
8
- * @example
9
- * ```js
10
- * // webpack.config.js
11
- * import Typical from '@elliots/unplugin-typical/webpack'
12
- *
13
- * export default {
14
- * plugins: [Typical()],
15
- * }
16
- * ```
17
- */
18
- declare const webpack: typeof Typical.webpack;
4
+ declare const _default: (options?: Options | undefined) => WebpackPluginInstance;
19
5
  //#endregion
20
- export { webpack as default, webpack as "module.exports" };
6
+ export { Typical, _default as default };
package/dist/webpack.mjs CHANGED
@@ -1,26 +1,7 @@
1
- import { t as Typical } from "./src-DjSuKGi4.mjs";
1
+ import { t as Typical } from "./src-VKzfwAoo.mjs";
2
2
 
3
3
  //#region src/webpack.ts
4
- /**
5
- * This entry file is for webpack plugin.
6
- *
7
- * @module
8
- */
9
- /**
10
- * Webpack plugin
11
- *
12
- * @example
13
- * ```js
14
- * // webpack.config.js
15
- * import Typical from '@elliots/unplugin-typical/webpack'
16
- *
17
- * export default {
18
- * plugins: [Typical()],
19
- * }
20
- * ```
21
- */
22
- const webpack = Typical.webpack;
23
- var webpack_default = webpack;
4
+ var webpack_default = Typical.webpack;
24
5
 
25
6
  //#endregion
26
- export { webpack_default as default, webpack as "module.exports" };
7
+ export { Typical, webpack_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliots/unplugin-typical",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
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.4",
60
+ "@elliots/typical": "0.2.5",
61
61
  "unplugin": "^2.3.11"
62
62
  },
63
63
  "devDependencies": {
@@ -1,80 +0,0 @@
1
- import { FilterPattern, UnpluginInstance } from "unplugin";
2
-
3
- //#region ../../dist/src/config.d.ts
4
- interface TypicalDebugConfig {
5
- writeIntermediateFiles?: boolean;
6
- }
7
- /**
8
- * Configuration options for source map generation.
9
- */
10
- interface TypicalSourceMapConfig {
11
- /**
12
- * Generate source maps. Default: true
13
- */
14
- enabled?: boolean;
15
- /**
16
- * Include original source content in the map. Default: true
17
- */
18
- includeContent?: boolean;
19
- /**
20
- * Use inline source maps (data URL) instead of external files. Default: false
21
- */
22
- inline?: boolean;
23
- }
24
- interface TypicalConfig {
25
- include?: string[];
26
- exclude?: string[];
27
- validateCasts?: boolean;
28
- hoistRegex?: boolean;
29
- debug?: TypicalDebugConfig;
30
- /**
31
- * Type patterns to skip validation for (supports wildcards).
32
- * Use this for types that typia cannot process (e.g., React event types).
33
- * Example: ["React.*", "Express.Request", "*.Event"]
34
- */
35
- ignoreTypes?: string[];
36
- /**
37
- * Validate function parameters and return types at runtime.
38
- * When enabled, typed function parameters get runtime validation calls injected.
39
- * Default: true
40
- */
41
- validateFunctions?: boolean;
42
- /**
43
- * Transform JSON.parse<T>() calls to validate and filter the parsed result
44
- * to only include properties defined in type T.
45
- * Default: true
46
- */
47
- transformJSONParse?: boolean;
48
- /**
49
- * Transform JSON.stringify<T>() calls to only stringify properties defined
50
- * in type T, preventing accidental data leaks.
51
- * Default: true
52
- */
53
- transformJSONStringify?: boolean;
54
- /**
55
- * Source map generation settings.
56
- * Controls whether and how source maps are generated for transformed code.
57
- */
58
- sourceMap?: TypicalSourceMapConfig;
59
- /**
60
- * Maximum number of helper functions (_io0, _io1, etc.) that can be generated
61
- * for a single type before erroring. Complex DOM types or library types can
62
- * generate hundreds of functions which indicates a type that should be excluded.
63
- * Set to 0 to disable the limit.
64
- * Default: 50
65
- */
66
- maxGeneratedFunctions?: number;
67
- }
68
- //#endregion
69
- //#region src/core/options.d.ts
70
- interface Options {
71
- include?: FilterPattern;
72
- exclude?: FilterPattern;
73
- enforce?: "pre" | "post" | undefined;
74
- typical?: Partial<TypicalConfig>;
75
- }
76
- //#endregion
77
- //#region src/index.d.ts
78
- declare const Typical: UnpluginInstance<Options | undefined, false>;
79
- //#endregion
80
- export { Options as n, Typical as t };