@elliots/unplugin-typical 0.1.8 → 0.1.10

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-cR_y1bPs.mjs";
1
+ import { t as Typical } from "./index-DDxe82RX.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-DfYOX15z.mjs";
1
+ import { t as Typical } from "./src-D0Juym-h.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-cR_y1bPs.mjs";
1
+ import { t as Typical } from "./index-DDxe82RX.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-DfYOX15z.mjs";
1
+ import { t as Typical } from "./src-D0Juym-h.mjs";
2
2
 
3
3
  //#region src/farm.ts
4
4
  /**
@@ -5,6 +5,23 @@ import ts from "typescript";
5
5
  interface TypicalDebugConfig {
6
6
  writeIntermediateFiles?: boolean;
7
7
  }
8
+ /**
9
+ * Configuration options for source map generation.
10
+ */
11
+ interface TypicalSourceMapConfig {
12
+ /**
13
+ * Generate source maps. Default: true
14
+ */
15
+ enabled?: boolean;
16
+ /**
17
+ * Include original source content in the map. Default: true
18
+ */
19
+ includeContent?: boolean;
20
+ /**
21
+ * Use inline source maps (data URL) instead of external files. Default: false
22
+ */
23
+ inline?: boolean;
24
+ }
8
25
  interface TypicalConfig {
9
26
  include?: string[];
10
27
  exclude?: string[];
@@ -30,6 +47,11 @@ interface TypicalConfig {
30
47
  * Default: true
31
48
  */
32
49
  validateFunctions?: boolean;
50
+ /**
51
+ * Source map generation settings.
52
+ * Controls whether and how source maps are generated for transformed code.
53
+ */
54
+ sourceMap?: TypicalSourceMapConfig;
33
55
  }
34
56
  //#endregion
35
57
  //#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-cR_y1bPs.mjs";
1
+ import { n as Options, t as Typical } from "./index-DDxe82RX.mjs";
2
2
  export { Options, Typical };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as Typical } from "./src-DfYOX15z.mjs";
1
+ import { t as Typical } from "./src-D0Juym-h.mjs";
2
2
 
3
3
  export { Typical };
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./index-cR_y1bPs.mjs";
1
+ import { t as Typical } from "./index-DDxe82RX.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-DfYOX15z.mjs";
1
+ import { t as Typical } from "./src-D0Juym-h.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-cR_y1bPs.mjs";
1
+ import { t as Typical } from "./index-DDxe82RX.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-DfYOX15z.mjs";
1
+ import { t as Typical } from "./src-D0Juym-h.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-cR_y1bPs.mjs";
1
+ import { t as Typical } from "./index-DDxe82RX.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-DfYOX15z.mjs";
1
+ import { t as Typical } from "./src-D0Juym-h.mjs";
2
2
 
3
3
  //#region src/rspack.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { createUnplugin } from "unplugin";
2
- import { TypicalTransformer, loadConfig } from "@elliots/typical";
2
+ import { TypicalTransformer, loadConfig, validateConfig } from "@elliots/typical";
3
3
  import { dirname, extname, resolve } from "path";
4
4
  import ts from "typescript";
5
5
 
@@ -90,8 +90,9 @@ const TRANSFORM_EXTENSIONS = new Set([
90
90
  * Transform a TypeScript file with Typical.
91
91
  *
92
92
  * Uses a shared ProgramManager for incremental compilation across files.
93
+ * Returns both code and source map for use with Vite/Rollup/Webpack.
93
94
  */
94
- function transformTypia(id, source, config, programManager) {
95
+ function transformTypia(id, source, config, programManager, options = {}) {
95
96
  buildTimer.start("total-transform");
96
97
  const ext = extname(id).toLowerCase();
97
98
  if (!TRANSFORM_EXTENSIONS.has(ext)) {
@@ -111,14 +112,18 @@ function transformTypia(id, source, config, programManager) {
111
112
  return;
112
113
  }
113
114
  buildTimer.start("create-transformer");
114
- const transformer = new TypicalTransformer(config, program);
115
+ const transformer = new TypicalTransformer(validateConfig(config), program);
115
116
  buildTimer.end("create-transformer");
117
+ const generateSourceMap = options.sourceMap ?? config.sourceMap?.enabled ?? true;
116
118
  buildTimer.start("transform");
117
- const result = transformer.transform(sourceFile, "js");
119
+ const result = transformer.transform(sourceFile, "js", { sourceMap: generateSourceMap });
118
120
  buildTimer.end("transform");
119
121
  buildTimer.end("total-transform");
120
- if (process.env.DEBUG) console.log("[unplugin-typical] Transform output (first 1000 chars):", result.substring(0, 1e3));
121
- return result;
122
+ if (process.env.DEBUG) console.log("[unplugin-typical] Transform output (first 1000 chars):", result.code.substring(0, 1e3));
123
+ return {
124
+ code: result.code,
125
+ map: result.map
126
+ };
122
127
  }
123
128
 
124
129
  //#endregion
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./index-cR_y1bPs.mjs";
1
+ import { t as Typical } from "./index-DDxe82RX.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-DfYOX15z.mjs";
1
+ import { t as Typical } from "./src-D0Juym-h.mjs";
2
2
 
3
3
  //#region src/vite.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as Typical } from "./index-cR_y1bPs.mjs";
1
+ import { t as Typical } from "./index-DDxe82RX.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-DfYOX15z.mjs";
1
+ import { t as Typical } from "./src-D0Juym-h.mjs";
2
2
 
3
3
  //#region src/webpack.ts
4
4
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elliots/unplugin-typical",
3
3
  "type": "module",
4
- "version": "0.1.8",
4
+ "version": "0.1.10",
5
5
  "description": "Unplugin for typical - runtime safe TypeScript transformer",
6
6
  "author": "Elliot Shepherd <elliot@jarofworms.com>",
7
7
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  "access": "public"
58
58
  },
59
59
  "dependencies": {
60
- "@elliots/typical": "0.1.8",
60
+ "@elliots/typical": "0.1.10",
61
61
  "unplugin": "^2.3.11"
62
62
  },
63
63
  "devDependencies": {