@happyvertical/translator 0.74.8

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepl.d.ts","sourceRoot":"","sources":["../../src/providers/deepl.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EACV,YAAY,EACZ,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAUzB;;GAEG;AACH,qBAAa,aAAc,YAAW,mBAAmB;IACvD,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAA6B;gBAE9B,OAAO,EAAE,YAAY;IAUjC;;OAEG;YACW,SAAS;IAgBvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACG,SAAS,CACb,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,iBAAiB,CAAC;IA8C7B;;;;OAIG;IACG,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAuCpE;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAiD3D;;OAEG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EAAE,EACf,cAAc,EAAE,MAAM,EACtB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA8B/B;;OAEG;IACH,OAAO,CAAC,QAAQ;CA6BjB"}
@@ -0,0 +1,39 @@
1
+ import { GoogleTranslateOptions, LanguageDetectionResult, SupportedLanguage, TranslationProvider, TranslationResult } from '../shared/types';
2
+ /**
3
+ * Google Translate provider implementation with in-memory caching
4
+ */
5
+ export declare class GoogleTranslateProvider implements TranslationProvider {
6
+ private client;
7
+ private timeout;
8
+ private cache;
9
+ constructor(options: GoogleTranslateOptions);
10
+ /**
11
+ * Initializes the memory cache for translation results
12
+ */
13
+ private initCache;
14
+ /**
15
+ * Generates a cache key for translation requests
16
+ */
17
+ private getCacheKey;
18
+ /**
19
+ * Translates text from source language to target language
20
+ */
21
+ translate(text: string, targetLanguage: string, sourceLanguage?: string): Promise<TranslationResult>;
22
+ /**
23
+ * Detects the language of the provided text
24
+ */
25
+ detectLanguage(text: string): Promise<LanguageDetectionResult>;
26
+ /**
27
+ * Gets the list of languages supported by this provider
28
+ */
29
+ getSupportedLanguages(): Promise<SupportedLanguage[]>;
30
+ /**
31
+ * Translates multiple texts in a single batch operation
32
+ */
33
+ translateBatch(texts: string[], targetLanguage: string, sourceLanguage?: string): Promise<TranslationResult[]>;
34
+ /**
35
+ * Maps Google Translate errors to standardized error types
36
+ */
37
+ private mapError;
38
+ }
39
+ //# sourceMappingURL=google.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../src/providers/google.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAgBzB;;GAEG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IACjE,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAA6B;gBAE9B,OAAO,EAAE,sBAAsB;IAW3C;;OAEG;YACW,SAAS;IAgBvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACG,SAAS,CACb,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,iBAAiB,CAAC;IAyD7B;;OAEG;IACG,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAsDpE;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA6B3D;;OAEG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EAAE,EACf,cAAc,EAAE,MAAM,EACtB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAuC/B;;OAEG;IACH,OAAO,CAAC,QAAQ;CAwBjB"}
@@ -0,0 +1,37 @@
1
+ import { LanguageDetectionResult, LibreTranslateOptions, SupportedLanguage, TranslationProvider, TranslationResult } from '../shared/types';
2
+ /**
3
+ * LibreTranslate provider implementation
4
+ */
5
+ export declare class LibreTranslateProvider implements TranslationProvider {
6
+ private baseUrl;
7
+ private apiKey?;
8
+ private timeout;
9
+ constructor(options: LibreTranslateOptions);
10
+ /**
11
+ * Translates text from source language to target language
12
+ */
13
+ translate(text: string, targetLanguage: string, sourceLanguage?: string): Promise<TranslationResult>;
14
+ /**
15
+ * Detects the language of the provided text
16
+ */
17
+ detectLanguage(text: string): Promise<LanguageDetectionResult>;
18
+ /**
19
+ * Gets the list of languages supported by this provider
20
+ */
21
+ getSupportedLanguages(): Promise<SupportedLanguage[]>;
22
+ /**
23
+ * Translates multiple texts in a single batch operation
24
+ * Note: LibreTranslate doesn't have native batch support,
25
+ * so we translate texts sequentially
26
+ */
27
+ translateBatch(texts: string[], targetLanguage: string, sourceLanguage?: string): Promise<TranslationResult[]>;
28
+ /**
29
+ * Makes an HTTP request to LibreTranslate API
30
+ */
31
+ private fetchLibreTranslate;
32
+ /**
33
+ * Maps LibreTranslate errors to standardized error types
34
+ */
35
+ private mapError;
36
+ }
37
+ //# sourceMappingURL=libretranslate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libretranslate.d.ts","sourceRoot":"","sources":["../../src/providers/libretranslate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AA8BzB;;GAEG;AACH,qBAAa,sBAAuB,YAAW,mBAAmB;IAChE,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,qBAAqB;IAM1C;;OAEG;IACG,SAAS,CACb,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,iBAAiB,CAAC;IAyC7B;;OAEG;IACG,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAmDpE;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA6B3D;;;;OAIG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EAAE,EACf,cAAc,EAAE,MAAM,EACtB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAe/B;;OAEG;YACW,mBAAmB;IAqEjC;;OAEG;IACH,OAAO,CAAC,QAAQ;CAYjB"}
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Core types and interfaces for the Translator library
3
+ */
4
+ /**
5
+ * Standardized translation result
6
+ */
7
+ export interface TranslationResult {
8
+ /**
9
+ * The translated text
10
+ */
11
+ translatedText: string;
12
+ /**
13
+ * The original source text
14
+ */
15
+ sourceText: string;
16
+ /**
17
+ * The detected or specified source language (ISO 639-1 code)
18
+ */
19
+ sourceLanguage: string;
20
+ /**
21
+ * The target language (ISO 639-1 code)
22
+ */
23
+ targetLanguage: string;
24
+ /**
25
+ * Confidence score for the translation (0-1), if available
26
+ */
27
+ confidence?: number;
28
+ /**
29
+ * Alternative translations, if available
30
+ */
31
+ alternatives?: string[];
32
+ /**
33
+ * Whether the source language was automatically detected
34
+ */
35
+ detectedSourceLanguage: boolean;
36
+ /**
37
+ * The original, raw response from the provider
38
+ */
39
+ raw: any;
40
+ }
41
+ /**
42
+ * Language detection result
43
+ */
44
+ export interface LanguageDetectionResult {
45
+ /**
46
+ * The detected language (ISO 639-1 code)
47
+ */
48
+ language: string;
49
+ /**
50
+ * Confidence score for the detection (0-1)
51
+ */
52
+ confidence: number;
53
+ /**
54
+ * Alternative detected languages with confidence scores, if available
55
+ */
56
+ alternatives?: Array<{
57
+ language: string;
58
+ confidence: number;
59
+ }>;
60
+ /**
61
+ * The original, raw response from the provider
62
+ */
63
+ raw: any;
64
+ }
65
+ /**
66
+ * Supported language information
67
+ */
68
+ export interface SupportedLanguage {
69
+ /**
70
+ * ISO 639-1 language code (e.g., 'en', 'es', 'fr')
71
+ */
72
+ code: string;
73
+ /**
74
+ * Human-readable language name in English
75
+ */
76
+ name: string;
77
+ /**
78
+ * Native name of the language (optional)
79
+ */
80
+ nativeName?: string;
81
+ }
82
+ /**
83
+ * Translation provider interface - all providers must implement this
84
+ */
85
+ export interface TranslationProvider {
86
+ /**
87
+ * Translates text from source language to target language
88
+ * @param text The text to translate
89
+ * @param targetLanguage The target language code (ISO 639-1)
90
+ * @param sourceLanguage Optional source language code. If not provided, auto-detect
91
+ * @returns A promise that resolves to a TranslationResult object
92
+ */
93
+ translate(text: string, targetLanguage: string, sourceLanguage?: string): Promise<TranslationResult>;
94
+ /**
95
+ * Detects the language of the provided text
96
+ * @param text The text to analyze
97
+ * @returns A promise that resolves to a LanguageDetectionResult object
98
+ */
99
+ detectLanguage(text: string): Promise<LanguageDetectionResult>;
100
+ /**
101
+ * Gets the list of languages supported by this provider
102
+ * @returns A promise that resolves to an array of SupportedLanguage objects
103
+ */
104
+ getSupportedLanguages(): Promise<SupportedLanguage[]>;
105
+ /**
106
+ * Translates multiple texts in a single batch operation
107
+ * @param texts Array of texts to translate
108
+ * @param targetLanguage The target language code (ISO 639-1)
109
+ * @param sourceLanguage Optional source language code. If not provided, auto-detect
110
+ * @returns A promise that resolves to an array of TranslationResult objects
111
+ */
112
+ translateBatch(texts: string[], targetLanguage: string, sourceLanguage?: string): Promise<TranslationResult[]>;
113
+ }
114
+ /**
115
+ * Translator interface - extends provider interface with convenience methods
116
+ */
117
+ export interface Translator extends TranslationProvider {
118
+ /**
119
+ * Creates a pre-configured translation function for repeated translations
120
+ * @param sourceLanguage Optional source language code (ISO 639-1). If undefined, auto-detects
121
+ * @param targetLanguage Optional target language code (ISO 639-1). Defaults to 'en'
122
+ * @returns A function that translates text with the pre-configured languages
123
+ */
124
+ templateFunction(sourceLanguage?: string, targetLanguage?: string): (text: string) => Promise<string>;
125
+ }
126
+ /**
127
+ * Base configuration options for all providers
128
+ */
129
+ export interface BaseTranslatorOptions {
130
+ /**
131
+ * Request timeout in milliseconds
132
+ */
133
+ timeout?: number;
134
+ /**
135
+ * Maximum number of retries for failed requests
136
+ */
137
+ maxRetries?: number;
138
+ }
139
+ /**
140
+ * Google Translate provider options
141
+ */
142
+ export interface GoogleTranslateOptions extends BaseTranslatorOptions {
143
+ provider: 'google';
144
+ /**
145
+ * Google Cloud API key or credentials
146
+ */
147
+ apiKey: string;
148
+ /**
149
+ * Optional Google Cloud project ID
150
+ */
151
+ projectId?: string;
152
+ }
153
+ /**
154
+ * DeepL provider options
155
+ */
156
+ export interface DeepLOptions extends BaseTranslatorOptions {
157
+ provider: 'deepl';
158
+ /**
159
+ * DeepL API key
160
+ */
161
+ apiKey: string;
162
+ /**
163
+ * Whether to use free or pro API endpoint (default: false = pro)
164
+ */
165
+ freeApi?: boolean;
166
+ }
167
+ /**
168
+ * LibreTranslate provider options
169
+ */
170
+ export interface LibreTranslateOptions extends BaseTranslatorOptions {
171
+ provider: 'libretranslate';
172
+ /**
173
+ * Custom instance URL (default: https://libretranslate.com)
174
+ */
175
+ apiUrl?: string;
176
+ /**
177
+ * Optional API key for some instances
178
+ */
179
+ apiKey?: string;
180
+ }
181
+ /**
182
+ * Union type for all provider options
183
+ */
184
+ export type TranslatorOptions = GoogleTranslateOptions | DeepLOptions | LibreTranslateOptions;
185
+ /**
186
+ * Base error class for translation operations
187
+ *
188
+ * @param message - Human-readable error description
189
+ * @param code - Machine-readable error code (e.g., 'QUOTA_EXCEEDED', 'AUTH_ERROR', 'TIMEOUT')
190
+ * @param provider - The provider that produced the error (e.g., 'google', 'deepl', 'libretranslate')
191
+ */
192
+ export declare class TranslationError extends Error {
193
+ code: string;
194
+ provider?: string | undefined;
195
+ constructor(message: string, code: string, provider?: string | undefined);
196
+ }
197
+ /**
198
+ * Thrown when a requested language code is not supported by the provider
199
+ *
200
+ * @param language - The unsupported ISO 639-1 language code
201
+ * @param provider - The provider that rejected the language
202
+ */
203
+ export declare class UnsupportedLanguageError extends TranslationError {
204
+ constructor(language: string, provider?: string);
205
+ }
206
+ /**
207
+ * Thrown when the provider's translation quota or rate limit has been exceeded
208
+ *
209
+ * @param provider - The provider that reported the quota limit
210
+ */
211
+ export declare class QuotaExceededError extends TranslationError {
212
+ constructor(provider?: string);
213
+ }
214
+ /**
215
+ * Thrown when the provider rejects the API key or credentials
216
+ *
217
+ * @param provider - The provider that rejected authentication
218
+ */
219
+ export declare class AuthenticationError extends TranslationError {
220
+ constructor(provider?: string);
221
+ }
222
+ /**
223
+ * Thrown when the input text is empty or otherwise invalid for translation
224
+ *
225
+ * @param reason - Description of why the text is invalid
226
+ * @param provider - The provider that rejected the text
227
+ */
228
+ export declare class InvalidTextError extends TranslationError {
229
+ constructor(reason: string, provider?: string);
230
+ }
231
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,cAAc,EAAE,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,QAAQ,CAAC,EAAE,MAAM;CAQhD;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,gBAAgB;gBAC1C,QAAQ,CAAC,EAAE,MAAM;CAI9B;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,gBAAgB;gBAC3C,QAAQ,CAAC,EAAE,MAAM;CAI9B;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,gBAAgB;gBACxC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAI9C"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Utility functions for translation operations
3
+ */
4
+ /**
5
+ * Common ISO 639-1 language codes and their names
6
+ */
7
+ export declare const LANGUAGE_NAMES: Record<string, string>;
8
+ /**
9
+ * Validates an ISO 639-1 language code
10
+ * @param code Language code to validate
11
+ * @returns True if valid
12
+ */
13
+ export declare function isValidLanguageCode(code: string): boolean;
14
+ /**
15
+ * Gets the language name from a language code
16
+ * @param code ISO 639-1 language code
17
+ * @returns Language name or the code if not found
18
+ */
19
+ export declare function getLanguageName(code: string): string;
20
+ /**
21
+ * Normalizes a confidence score to 0-1 range
22
+ * @param score Confidence score (may be 0-1 or 0-100)
23
+ * @returns Normalized score between 0 and 1
24
+ */
25
+ export declare function normalizeConfidence(score: number): number;
26
+ /**
27
+ * Validates that text is not empty
28
+ * @param text Text to validate
29
+ * @returns True if text is valid
30
+ */
31
+ export declare function isValidText(text: string): boolean;
32
+ /**
33
+ * Truncates text to a maximum length
34
+ * @param text Text to truncate
35
+ * @param maxLength Maximum length
36
+ * @returns Truncated text
37
+ */
38
+ export declare function truncateText(text: string, maxLength: number): string;
39
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/shared/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyGjD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAKpE"}
package/metadata.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@happyvertical/translator",
3
+ "path": "packages/translator",
4
+ "position": {
5
+ "index": 27,
6
+ "count": 30
7
+ },
8
+ "description": "Standardized translation interface supporting Google Translate, DeepL, and LibreTranslate",
9
+ "provides": [
10
+ "Standardized translation interface supporting Google Translate, DeepL, and LibreTranslate"
11
+ ],
12
+ "implements": [],
13
+ "requires": {
14
+ "workspace": [
15
+ "@happyvertical/cache",
16
+ "@happyvertical/utils"
17
+ ],
18
+ "externalHappyVertical": [],
19
+ "external": [
20
+ "@google-cloud/translate",
21
+ "deepl-node"
22
+ ]
23
+ },
24
+ "dependents": [],
25
+ "stability": {
26
+ "level": "stable",
27
+ "reason": "Primary package surface is described as implemented and production-oriented."
28
+ },
29
+ "keywords": [
30
+ "translator"
31
+ ]
32
+ }
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@happyvertical/translator",
3
+ "version": "0.74.8",
4
+ "description": "Standardized translation interface supporting Google Translate, DeepL, and LibreTranslate",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "bin": {
15
+ "have-translator-context": "./dist/cli/claude-context.js"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md",
20
+ "LICENSE",
21
+ "AGENT.md",
22
+ "metadata.json"
23
+ ],
24
+ "publishConfig": {
25
+ "registry": "https://registry.npmjs.org",
26
+ "access": "public"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/happyvertical/sdk.git",
31
+ "directory": "packages/translator"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/happyvertical/sdk/issues"
35
+ },
36
+ "homepage": "https://github.com/happyvertical/sdk/tree/main/packages/translator#readme",
37
+ "keywords": [
38
+ "translation",
39
+ "i18n",
40
+ "google-translate",
41
+ "deepl",
42
+ "libretranslate",
43
+ "language-detection"
44
+ ],
45
+ "author": "willgriffin@gmail.com",
46
+ "license": "ISC",
47
+ "dependencies": {
48
+ "@google-cloud/translate": "^9.3.0",
49
+ "deepl-node": "^1.26.0",
50
+ "@happyvertical/cache": "0.74.8",
51
+ "@happyvertical/utils": "0.74.8"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "25.0.10",
55
+ "typescript": "^5.9.3",
56
+ "vite": "7.3.2",
57
+ "vite-plugin-dts": "4.5.4",
58
+ "vitest": "^4.1.5"
59
+ },
60
+ "scripts": {
61
+ "test": "npx vitest run",
62
+ "test:watch": "npx vitest",
63
+ "build": "vite build",
64
+ "build:watch": "vite build --watch",
65
+ "docs": "typedoc --plugin typedoc-plugin-markdown --out docs --entryPoints ./src/index.ts --tsconfig ./tsconfig.json --excludePrivate --excludeInternal --hideGenerator --fileExtension .md --readme none --categorizeByGroup false --includeVersion false --hidePageHeader --hidePageTitle false --outputFileStrategy modules",
66
+ "docs:watch": "typedoc --plugin typedoc-plugin-markdown --out docs --entryPoints ./src/index.ts --tsconfig ./tsconfig.json --excludePrivate --excludeInternal --hideGenerator --fileExtension .md --readme none --categorizeByGroup false --includeVersion false --hidePageHeader --hidePageTitle false --outputFileStrategy modules --watch",
67
+ "clean": "rm -rf dist docs *.tsbuildinfo",
68
+ "dev": "npm run build:watch & npm run test:watch"
69
+ }
70
+ }