@rohal12/twee-ts 1.10.0 → 1.12.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.
@@ -1,4 +1,4 @@
1
- import { C as CompileOptions } from '../types-BbEu2Szm.js';
1
+ import { C as CompileOptions } from '../types-FHZ3rZD6.js';
2
2
 
3
3
  /**
4
4
  * Ready-made Rollup plugin for twee-ts.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  compile
3
- } from "../chunk-FSZ5FD3P.js";
3
+ } from "../chunk-TYLUAJTM.js";
4
4
 
5
5
  // src/plugins/rollup.ts
6
6
  function tweeTsPlugin(options) {
@@ -1,4 +1,4 @@
1
- import { C as CompileOptions } from '../types-BbEu2Szm.js';
1
+ import { C as CompileOptions } from '../types-FHZ3rZD6.js';
2
2
 
3
3
  /**
4
4
  * Ready-made Vite plugin for twee-ts.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  compileIncremental
3
- } from "../chunk-FSZ5FD3P.js";
3
+ } from "../chunk-TYLUAJTM.js";
4
4
 
5
5
  // src/plugins/vite.ts
6
6
  function isTweeFile(file) {
@@ -2,6 +2,7 @@
2
2
  * All public interfaces for twee-ts.
3
3
  */
4
4
  type OutputMode = 'html' | 'twee3' | 'twee1' | 'twine2-archive' | 'twine1-archive' | 'json';
5
+ type WordCountMethod = 'tweego' | 'whitespace';
5
6
  type InlineSource = {
6
7
  filename: string;
7
8
  content: string | Buffer;
@@ -40,6 +41,8 @@ interface CompileOptions {
40
41
  tagAliases?: Record<string, string>;
41
42
  /** Emit source file and line as data- attributes on passage elements. Default: false. */
42
43
  sourceInfo?: boolean;
44
+ /** Word counting method. Default: 'tweego'. */
45
+ wordCountMethod?: WordCountMethod;
43
46
  }
44
47
 
45
48
  export type { CompileOptions as C };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rohal12/twee-ts",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "TypeScript Twee-to-HTML compiler — a complete reimplementation of Tweego",
5
5
  "type": "module",
6
6
  "license": "Unlicense",
@@ -66,6 +66,7 @@
66
66
  "devDependencies": {
67
67
  "@types/node": "^25.3.3",
68
68
  "@vitest/coverage-v8": "^4.0.18",
69
+ "htmlparser2": "^10.1.0",
69
70
  "prettier": "^3.8.1",
70
71
  "tsup": "^8.4.0",
71
72
  "tsx": "^4.21.0",
@@ -92,6 +92,12 @@
92
92
  "type": "boolean",
93
93
  "default": false,
94
94
  "description": "Emit source file and line as data- attributes on passage elements."
95
+ },
96
+ "wordCountMethod": {
97
+ "type": "string",
98
+ "enum": ["tweego", "whitespace"],
99
+ "default": "tweego",
100
+ "description": "Word counting method. 'tweego': NFKD normalize, divide chars by 5 (matches Tweego). 'whitespace': split on whitespace after stripping comments and markup."
95
101
  }
96
102
  }
97
103
  }