@tamagui/static 1.135.7 → 1.136.1-1762547287708

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.
Files changed (42) hide show
  1. package/dist/async-wrapper.js +94 -0
  2. package/dist/async-wrapper.js.map +6 -0
  3. package/dist/async-wrapper.mjs +113 -0
  4. package/dist/async-wrapper.mjs.map +1 -0
  5. package/dist/exports.js +17 -5
  6. package/dist/exports.js.map +2 -2
  7. package/dist/exports.mjs +23 -6
  8. package/dist/exports.mjs.map +1 -1
  9. package/dist/extractor/bundleConfig.js +1 -1
  10. package/dist/extractor/bundleConfig.js.map +1 -1
  11. package/dist/extractor/bundleConfig.mjs +4 -4
  12. package/dist/extractor/bundleConfig.mjs.map +1 -1
  13. package/dist/extractor/watchTamaguiConfig.js +3 -3
  14. package/dist/extractor/watchTamaguiConfig.js.map +1 -1
  15. package/dist/extractor/watchTamaguiConfig.mjs +4 -3
  16. package/dist/extractor/watchTamaguiConfig.mjs.map +1 -1
  17. package/dist/sync-wrapper.js +55 -0
  18. package/dist/sync-wrapper.js.map +6 -0
  19. package/dist/sync-wrapper.mjs +62 -0
  20. package/dist/sync-wrapper.mjs.map +1 -0
  21. package/dist/worker.js +65 -0
  22. package/dist/worker.js.map +6 -0
  23. package/dist/worker.mjs +84 -0
  24. package/dist/worker.mjs.map +1 -0
  25. package/package.json +18 -16
  26. package/src/async-wrapper.ts +149 -0
  27. package/src/exports.ts +30 -4
  28. package/src/extractor/bundleConfig.ts +4 -9
  29. package/src/extractor/watchTamaguiConfig.ts +3 -0
  30. package/src/sync-wrapper.ts +97 -0
  31. package/src/worker.ts +128 -0
  32. package/types/async-wrapper.d.ts +43 -0
  33. package/types/async-wrapper.d.ts.map +1 -0
  34. package/types/exports.d.ts +8 -4
  35. package/types/exports.d.ts.map +1 -1
  36. package/types/extractor/bundleConfig.d.ts +1 -1
  37. package/types/extractor/bundleConfig.d.ts.map +1 -1
  38. package/types/extractor/watchTamaguiConfig.d.ts.map +1 -1
  39. package/types/sync-wrapper.d.ts +23 -0
  40. package/types/sync-wrapper.d.ts.map +1 -0
  41. package/types/worker.d.ts +46 -0
  42. package/types/worker.d.ts.map +1 -0
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Synckit-based sync wrapper for Babel plugin
3
+ * Allows synchronous calls to the async worker for Babel compatibility
4
+ */
5
+
6
+ import { createSyncFn } from 'synckit'
7
+ import { resolve, dirname } from 'node:path'
8
+ import { fileURLToPath } from 'node:url'
9
+ import type { BabelFileResult } from '@babel/core'
10
+ import type { ExtractedResponse } from './extractor/extractToClassNames'
11
+ import type { TamaguiOptions } from './types'
12
+ import type { WorkerTask, WorkerResult } from './worker'
13
+
14
+ // Resolve worker path - works for both CJS and ESM
15
+ const getWorkerPath = () => {
16
+ // In CJS, __filename is available
17
+ if (typeof __filename !== 'undefined') {
18
+ return resolve(__dirname, 'worker.js')
19
+ }
20
+ // In ESM, use import.meta.url
21
+ if (typeof import.meta !== 'undefined' && import.meta.url) {
22
+ return resolve(dirname(fileURLToPath(import.meta.url)), 'worker.js')
23
+ }
24
+ // Fallback
25
+ return resolve(__dirname, 'worker.js')
26
+ }
27
+
28
+ // Create the sync function that calls the worker
29
+ // synckit will automatically handle worker thread management
30
+ const runTaskSync = createSyncFn<(task: WorkerTask) => Promise<WorkerResult>>(
31
+ getWorkerPath()
32
+ )
33
+
34
+ /**
35
+ * Synchronous version of extractToClassNames for Babel plugin
36
+ * Uses synckit to call the async worker synchronously
37
+ */
38
+ export function extractToClassNamesSync({
39
+ source,
40
+ sourcePath = '',
41
+ options,
42
+ shouldPrintDebug = false,
43
+ }: {
44
+ source: string | Buffer
45
+ sourcePath?: string
46
+ options: TamaguiOptions
47
+ shouldPrintDebug?: boolean | 'verbose'
48
+ }): ExtractedResponse | null {
49
+ if (typeof source !== 'string') {
50
+ throw new Error('`source` must be a string of javascript')
51
+ }
52
+
53
+ const task: WorkerTask = {
54
+ type: 'extractToClassNames',
55
+ source,
56
+ sourcePath,
57
+ options,
58
+ shouldPrintDebug,
59
+ }
60
+
61
+ const result = runTaskSync(task)
62
+
63
+ if (!result.success) {
64
+ throw new Error(
65
+ `Worker error: ${result.error}${result.stack ? `\n${result.stack}` : ''}`
66
+ )
67
+ }
68
+
69
+ return result.data as ExtractedResponse | null
70
+ }
71
+
72
+ /**
73
+ * Synchronous version of extractToNative for Babel plugin
74
+ * Uses synckit to call the async worker synchronously
75
+ */
76
+ export function extractToNativeSync(
77
+ sourceFileName: string,
78
+ sourceCode: string,
79
+ options: TamaguiOptions
80
+ ): BabelFileResult {
81
+ const task: WorkerTask = {
82
+ type: 'extractToNative',
83
+ sourceFileName,
84
+ sourceCode,
85
+ options,
86
+ }
87
+
88
+ const result = runTaskSync(task)
89
+
90
+ if (!result.success) {
91
+ throw new Error(
92
+ `Worker error: ${result.error}${result.stack ? `\n${result.stack}` : ''}`
93
+ )
94
+ }
95
+
96
+ return result.data as BabelFileResult
97
+ }
package/src/worker.ts ADDED
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Worker thread implementation for Tamagui extraction
3
+ * Used by both piscina (async) and synckit (sync for babel)
4
+ */
5
+
6
+ import type { BabelFileResult } from '@babel/core'
7
+ import { createExtractor } from './extractor/createExtractor'
8
+ import type {
9
+ ExtractedResponse,
10
+ ExtractToClassNamesProps,
11
+ } from './extractor/extractToClassNames'
12
+ import { extractToClassNames as extractToClassNamesImpl } from './extractor/extractToClassNames'
13
+ import { extractToNative as extractToNativeImpl } from './extractor/extractToNative'
14
+ import type { TamaguiOptions } from './types'
15
+
16
+ // Create extractors for web and native in worker
17
+ const webExtractor = createExtractor({ platform: 'web' })
18
+ const nativeExtractor = createExtractor({ platform: 'native' })
19
+
20
+ // Cache config loading to avoid reloading
21
+ const configCache: Map<string, Promise<any>> = new Map()
22
+
23
+ export interface ExtractToClassNamesTask {
24
+ type: 'extractToClassNames'
25
+ source: string
26
+ sourcePath: string
27
+ options: TamaguiOptions
28
+ shouldPrintDebug: boolean | 'verbose'
29
+ }
30
+
31
+ export interface ExtractToNativeTask {
32
+ type: 'extractToNative'
33
+ sourceFileName: string
34
+ sourceCode: string
35
+ options: TamaguiOptions
36
+ }
37
+
38
+ export interface ClearCacheTask {
39
+ type: 'clearCache'
40
+ }
41
+
42
+ export type WorkerTask = ExtractToClassNamesTask | ExtractToNativeTask | ClearCacheTask
43
+
44
+ export type WorkerResult =
45
+ | { success: true; data: ExtractedResponse | null }
46
+ | { success: true; data: BabelFileResult }
47
+ | { success: false; error: string; stack?: string }
48
+
49
+ /**
50
+ * Main worker function that handles both extraction types
51
+ * This is called by piscina for async usage
52
+ */
53
+ export async function runTask(task: WorkerTask): Promise<WorkerResult> {
54
+ try {
55
+ if (task.type === 'extractToClassNames') {
56
+ // Load web config if needed (with caching)
57
+ if (!task.options.disableExtraction && !task.options['_disableLoadTamagui']) {
58
+ const cacheKey = JSON.stringify({
59
+ config: task.options.config,
60
+ components: task.options.components,
61
+ })
62
+
63
+ if (!configCache.has(cacheKey)) {
64
+ configCache.set(cacheKey, webExtractor.loadTamagui(task.options))
65
+ }
66
+
67
+ await configCache.get(cacheKey)
68
+ }
69
+
70
+ const result = await extractToClassNamesImpl({
71
+ extractor: webExtractor,
72
+ source: task.source,
73
+ sourcePath: task.sourcePath,
74
+ options: task.options,
75
+ shouldPrintDebug: task.shouldPrintDebug,
76
+ })
77
+
78
+ return { success: true, data: result }
79
+ }
80
+
81
+ if (task.type === 'extractToNative') {
82
+ // Load native config if needed (with caching)
83
+ const cacheKey = JSON.stringify({
84
+ config: task.options.config,
85
+ components: task.options.components,
86
+ })
87
+
88
+ if (!configCache.has(cacheKey)) {
89
+ configCache.set(cacheKey, nativeExtractor.loadTamagui(task.options))
90
+ }
91
+
92
+ await configCache.get(cacheKey)
93
+
94
+ // extractToNative uses its own module-level extractor
95
+ // This is for babel plugin which uses visitor pattern
96
+ const result = extractToNativeImpl(
97
+ task.sourceFileName,
98
+ task.sourceCode,
99
+ task.options
100
+ )
101
+
102
+ return { success: true, data: result }
103
+ }
104
+
105
+ if (task.type === 'clearCache') {
106
+ // Clear config caches when files change
107
+ configCache.clear()
108
+ return { success: true, data: null }
109
+ }
110
+
111
+ return {
112
+ success: false,
113
+ error: `Unknown task type: ${(task as any).type}`,
114
+ }
115
+ } catch (error) {
116
+ return {
117
+ success: false,
118
+ error: error instanceof Error ? error.message : String(error),
119
+ stack: error instanceof Error ? error.stack : undefined,
120
+ }
121
+ }
122
+ }
123
+
124
+ /**
125
+ * For synckit compatibility - exports the runTask as default
126
+ * Synckit will call this function synchronously using worker threads
127
+ */
128
+ export default runTask
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Piscina-based async wrapper for bundlers (Webpack, Vite, Metro)
3
+ * Provides worker thread pooling for better performance
4
+ */
5
+ import type { BabelFileResult } from '@babel/core';
6
+ import type { ExtractedResponse } from './extractor/extractToClassNames';
7
+ import type { TamaguiOptions } from './types';
8
+ /**
9
+ * Extract Tamagui components to className-based CSS for web
10
+ * Used by Webpack, Vite, and Metro plugins
11
+ */
12
+ export declare function extractToClassNames({ source, sourcePath, options, shouldPrintDebug, }: {
13
+ source: string | Buffer;
14
+ sourcePath?: string;
15
+ options: TamaguiOptions;
16
+ shouldPrintDebug?: boolean | 'verbose';
17
+ }): Promise<ExtractedResponse | null>;
18
+ /**
19
+ * Extract Tamagui components to React Native StyleSheet format
20
+ * Used by native compilation (less common now)
21
+ */
22
+ export declare function extractToNative(sourceFileName: string, sourceCode: string, options: TamaguiOptions): Promise<BabelFileResult>;
23
+ /**
24
+ * Clear the worker's config cache
25
+ * Called when config files change (via watch)
26
+ */
27
+ export declare function clearWorkerCache(): Promise<void>;
28
+ /**
29
+ * Clean up the worker pool on exit
30
+ * Should be called when the build process completes
31
+ */
32
+ export declare function destroyPool(): Promise<void>;
33
+ /**
34
+ * Get pool statistics for debugging
35
+ */
36
+ export declare function getPoolStats(): {
37
+ threads: number;
38
+ queueSize: number;
39
+ completed: number;
40
+ duration: number;
41
+ utilization: number;
42
+ } | null;
43
+ //# sourceMappingURL=async-wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-wrapper.d.ts","sourceRoot":"","sources":["../src/async-wrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAmC7C;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,MAAM,EACN,UAAe,EACf,OAAO,EACP,gBAAwB,GACzB,EAAE;IACD,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACvC,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAqBpC;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC,CAgB1B;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKtD;AAED;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAKjD;AAED;;GAEG;AACH,wBAAgB,YAAY;;;;;;SAW3B"}
@@ -1,15 +1,19 @@
1
1
  export * from './checkDeps';
2
2
  export * from './types';
3
- export { createExtractor } from './extractor/createExtractor';
4
3
  export { literalToAst } from './extractor/literalToAst';
5
4
  export * from './constants';
6
- export * from './extractor/extractToClassNames';
7
5
  export * from './extractor/concatClassName';
8
- export * from './extractor/extractToNative';
9
6
  export * from './extractor/extractHelpers';
10
- export * from './extractor/loadTamagui';
11
7
  export * from './extractor/watchTamaguiConfig';
12
8
  export * from './extractor/createLogger';
13
9
  export * from './registerRequire';
14
10
  export * from './getPragmaOptions';
11
+ export { extractToClassNames, extractToNative, clearWorkerCache, destroyPool, getPoolStats, } from './async-wrapper';
12
+ export { getBabelPlugin } from './extractor/extractToNative';
13
+ export { generateThemesAndLog, esbuildWatchFiles, getOptions, loadTamaguiBuildConfigSync, } from './extractor/loadTamagui';
14
+ export type { TamaguiProjectInfo } from './extractor/loadTamagui';
15
+ export { createExtractor } from './extractor/createExtractor';
16
+ export { extractToClassNames as extractToClassNamesLegacy } from './extractor/extractToClassNames';
17
+ export { extractToNative as extractToNativeLegacy } from './extractor/extractToNative';
18
+ export { loadTamagui, loadTamaguiSync } from './extractor/loadTamagui';
15
19
  //# sourceMappingURL=exports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAIlC,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,YAAY,GACb,MAAM,iBAAiB,CAAA;AAKxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAG5D,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,EACV,0BAA0B,GAC3B,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,mBAAmB,IAAI,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAClG,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACtF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { type StaticConfig, type TamaguiInternalConfig } from '@tamagui/web';
1
+ import type { StaticConfig, TamaguiInternalConfig } from '@tamagui/web';
2
2
  import type { TamaguiOptions } from '../types';
3
3
  type NameToPaths = {
4
4
  [key: string]: Set<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"bundleConfig.d.ts","sourceRoot":"","sources":["../../src/extractor/bundleConfig.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAA;AAKrB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAM9C,KAAK,WAAW,GAAG;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAA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kDtE"}
1
+ {"version":3,"file":"watchTamaguiConfig.d.ts","sourceRoot":"","sources":["../../src/extractor/watchTamaguiConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAOpD,wBAAsB,kBAAkB,CAAC,cAAc,EAAE,cAAc;;eAoDtE"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Synckit-based sync wrapper for Babel plugin
3
+ * Allows synchronous calls to the async worker for Babel compatibility
4
+ */
5
+ import type { BabelFileResult } from '@babel/core';
6
+ import type { ExtractedResponse } from './extractor/extractToClassNames';
7
+ import type { TamaguiOptions } from './types';
8
+ /**
9
+ * Synchronous version of extractToClassNames for Babel plugin
10
+ * Uses synckit to call the async worker synchronously
11
+ */
12
+ export declare function extractToClassNamesSync({ source, sourcePath, options, shouldPrintDebug, }: {
13
+ source: string | Buffer;
14
+ sourcePath?: string;
15
+ options: TamaguiOptions;
16
+ shouldPrintDebug?: boolean | 'verbose';
17
+ }): ExtractedResponse | null;
18
+ /**
19
+ * Synchronous version of extractToNative for Babel plugin
20
+ * Uses synckit to call the async worker synchronously
21
+ */
22
+ export declare function extractToNativeSync(sourceFileName: string, sourceCode: string, options: TamaguiOptions): BabelFileResult;
23
+ //# sourceMappingURL=sync-wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-wrapper.d.ts","sourceRoot":"","sources":["../src/sync-wrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAqB7C;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,UAAe,EACf,OAAO,EACP,gBAAwB,GACzB,EAAE;IACD,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACvC,GAAG,iBAAiB,GAAG,IAAI,CAoB3B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,eAAe,CAejB"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Worker thread implementation for Tamagui extraction
3
+ * Used by both piscina (async) and synckit (sync for babel)
4
+ */
5
+ import type { BabelFileResult } from '@babel/core';
6
+ import type { ExtractedResponse } from './extractor/extractToClassNames';
7
+ import type { TamaguiOptions } from './types';
8
+ export interface ExtractToClassNamesTask {
9
+ type: 'extractToClassNames';
10
+ source: string;
11
+ sourcePath: string;
12
+ options: TamaguiOptions;
13
+ shouldPrintDebug: boolean | 'verbose';
14
+ }
15
+ export interface ExtractToNativeTask {
16
+ type: 'extractToNative';
17
+ sourceFileName: string;
18
+ sourceCode: string;
19
+ options: TamaguiOptions;
20
+ }
21
+ export interface ClearCacheTask {
22
+ type: 'clearCache';
23
+ }
24
+ export type WorkerTask = ExtractToClassNamesTask | ExtractToNativeTask | ClearCacheTask;
25
+ export type WorkerResult = {
26
+ success: true;
27
+ data: ExtractedResponse | null;
28
+ } | {
29
+ success: true;
30
+ data: BabelFileResult;
31
+ } | {
32
+ success: false;
33
+ error: string;
34
+ stack?: string;
35
+ };
36
+ /**
37
+ * Main worker function that handles both extraction types
38
+ * This is called by piscina for async usage
39
+ */
40
+ export declare function runTask(task: WorkerTask): Promise<WorkerResult>;
41
+ /**
42
+ * For synckit compatibility - exports the runTask as default
43
+ * Synckit will call this function synchronously using worker threads
44
+ */
45
+ export default runTask;
46
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,iCAAiC,CAAA;AAGxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAS7C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,iBAAiB,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAA;CACnB;AAED,MAAM,MAAM,UAAU,GAAG,uBAAuB,GAAG,mBAAmB,GAAG,cAAc,CAAA;AAEvF,MAAM,MAAM,YAAY,GACpB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,GACjD;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,eAAe,CAAA;CAAE,GACxC;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD;;;GAGG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAqErE;AAED;;;GAGG;AACH,eAAe,OAAO,CAAA"}