almostnode 0.2.5 → 0.2.7
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.
- package/LICENSE +1 -1
- package/dist/__sw__.js +25 -16
- package/dist/frameworks/code-transforms.d.ts +53 -0
- package/dist/frameworks/code-transforms.d.ts.map +1 -0
- package/dist/frameworks/next-dev-server.d.ts +80 -8
- package/dist/frameworks/next-dev-server.d.ts.map +1 -1
- package/dist/frameworks/tailwind-config-loader.d.ts +32 -0
- package/dist/frameworks/tailwind-config-loader.d.ts.map +1 -0
- package/dist/frameworks/vite-dev-server.d.ts +0 -4
- package/dist/frameworks/vite-dev-server.d.ts.map +1 -1
- package/dist/index.cjs +21775 -502
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +19949 -1058
- package/dist/index.mjs.map +1 -1
- package/dist/macaly-demo.d.ts +42 -0
- package/dist/macaly-demo.d.ts.map +1 -0
- package/package.json +6 -1
- package/src/convex-app-demo-entry.ts +2 -0
- package/src/frameworks/code-transforms.ts +577 -0
- package/src/frameworks/next-dev-server.ts +1583 -185
- package/src/frameworks/tailwind-config-loader.ts +206 -0
- package/src/frameworks/vite-dev-server.ts +2 -61
- package/src/macaly-demo.ts +172 -0
package/LICENSE
CHANGED
package/dist/__sw__.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Service Worker for Mini WebContainers
|
|
3
3
|
* Intercepts fetch requests and routes them to virtual servers
|
|
4
|
-
* Version:
|
|
4
|
+
* Version: 14 - forward ALL requests from virtual context (images, scripts, navigation) to virtual server
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
// Communication port with main thread
|
|
@@ -212,26 +212,35 @@ self.addEventListener('fetch', (event) => {
|
|
|
212
212
|
const match = url.pathname.match(/^\/__virtual__\/(\d+)(\/.*)?$/);
|
|
213
213
|
|
|
214
214
|
if (!match) {
|
|
215
|
-
// Not a virtual request - but check if it's
|
|
216
|
-
// This handles plain <a href="/about"> links
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
215
|
+
// Not a virtual request - but check if it's from a virtual context
|
|
216
|
+
// This handles plain <a href="/about"> links and asset requests (images, scripts)
|
|
217
|
+
// that should stay within the virtual server
|
|
218
|
+
const referer = event.request.referrer;
|
|
219
|
+
if (referer) {
|
|
220
|
+
try {
|
|
221
|
+
const refererUrl = new URL(referer);
|
|
222
|
+
const refererMatch = refererUrl.pathname.match(/^\/__virtual__\/(\d+)/);
|
|
223
|
+
if (refererMatch) {
|
|
224
|
+
// Request from within a virtual server context
|
|
225
|
+
const virtualPrefix = refererMatch[0];
|
|
226
|
+
const virtualPort = parseInt(refererMatch[1], 10);
|
|
227
|
+
const targetPath = url.pathname + url.search;
|
|
228
|
+
|
|
229
|
+
if (event.request.mode === 'navigate') {
|
|
230
|
+
// Navigation requests: redirect to include the virtual prefix
|
|
231
|
+
const redirectUrl = url.origin + virtualPrefix + targetPath;
|
|
228
232
|
console.log('[SW] Redirecting navigation from virtual context:', url.pathname, '->', redirectUrl);
|
|
229
233
|
event.respondWith(Response.redirect(redirectUrl, 302));
|
|
230
234
|
return;
|
|
235
|
+
} else {
|
|
236
|
+
// Non-navigation requests (images, scripts, etc.): forward to virtual server
|
|
237
|
+
console.log('[SW] Forwarding resource from virtual context:', url.pathname);
|
|
238
|
+
event.respondWith(handleVirtualRequest(event.request, virtualPort, targetPath));
|
|
239
|
+
return;
|
|
231
240
|
}
|
|
232
|
-
} catch (e) {
|
|
233
|
-
// Invalid referer URL, ignore
|
|
234
241
|
}
|
|
242
|
+
} catch (e) {
|
|
243
|
+
// Invalid referer URL, ignore
|
|
235
244
|
}
|
|
236
245
|
}
|
|
237
246
|
// Not a virtual request, let it pass through
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared code transformation utilities.
|
|
3
|
+
* Extracted from next-dev-server.ts and vite-dev-server.ts to avoid duplication
|
|
4
|
+
* and enable AST-based replacements.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Interface for file system operations needed by CSS module transforms.
|
|
8
|
+
*/
|
|
9
|
+
export interface CssModuleContext {
|
|
10
|
+
readFile: (path: string) => string;
|
|
11
|
+
exists: (path: string) => boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolve a relative path from a directory.
|
|
15
|
+
* Pure function — no dependencies.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveRelativePath(dir: string, relativePath: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a CSS module path relative to the current file context.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveCssModulePath(cssPath: string, currentFile: string | undefined, ctx: CssModuleContext): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Generate replacement code for a CSS Module import.
|
|
24
|
+
* Parses the CSS file, extracts class names, generates scoped names,
|
|
25
|
+
* and injects the scoped CSS via a style tag.
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateCssModuleReplacement(varName: string, cssPath: string, currentFile: string | undefined, ctx: CssModuleContext): string;
|
|
28
|
+
/**
|
|
29
|
+
* Strip CSS imports from code (they are loaded via <link> tags instead).
|
|
30
|
+
* CSS Module imports (*.module.css) are converted to inline objects with class name mappings.
|
|
31
|
+
* Regular CSS imports are stripped entirely.
|
|
32
|
+
*/
|
|
33
|
+
export declare function stripCssImports(code: string, currentFile: string | undefined, ctx: CssModuleContext): string;
|
|
34
|
+
/**
|
|
35
|
+
* Redirect bare npm package imports to esm.sh CDN.
|
|
36
|
+
* Uses acorn AST to precisely target import/export source strings,
|
|
37
|
+
* avoiding false matches inside comments or string literals.
|
|
38
|
+
* Falls back to regex if acorn fails.
|
|
39
|
+
*/
|
|
40
|
+
export declare function redirectNpmImports(code: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* ESM to CJS transform using acorn AST parsing.
|
|
43
|
+
* Used in non-browser (test) environments where esbuild is unavailable.
|
|
44
|
+
* Falls back to regex if acorn fails to parse.
|
|
45
|
+
*/
|
|
46
|
+
export declare function transformEsmToCjsSimple(code: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Add React Refresh registration to transformed code.
|
|
49
|
+
* This enables true HMR (state-preserving) for React components.
|
|
50
|
+
* Shared between NextDevServer and ViteDevServer.
|
|
51
|
+
*/
|
|
52
|
+
export declare function addReactRefresh(code: string, filename: string): string;
|
|
53
|
+
//# sourceMappingURL=code-transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-transforms.d.ts","sourceRoot":"","sources":["../../src/frameworks/code-transforms.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAa7E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,GAAG,EAAE,gBAAgB,GACpB,MAAM,GAAG,IAAI,CAgBf;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,GAAG,EAAE,gBAAgB,GACpB,MAAM,CA+DR;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,GAAG,EAAE,gBAAgB,GACpB,MAAM,CA4BR;AA0CD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMvD;AAgDD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM5D;AA0JD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAmCtE"}
|
|
@@ -16,6 +16,10 @@ export interface NextDevServerOptions extends DevServerOptions {
|
|
|
16
16
|
preferAppRouter?: boolean;
|
|
17
17
|
/** Environment variables (NEXT_PUBLIC_* are available in browser code via process.env) */
|
|
18
18
|
env?: Record<string, string>;
|
|
19
|
+
/** Asset prefix for static files (e.g., '/marketing'). Auto-detected from next.config if not specified. */
|
|
20
|
+
assetPrefix?: string;
|
|
21
|
+
/** Base path for the app (e.g., '/docs'). Auto-detected from next.config if not specified. */
|
|
22
|
+
basePath?: string;
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* NextDevServer - A lightweight Next.js-compatible development server
|
|
@@ -57,7 +61,38 @@ export declare class NextDevServer extends DevServer {
|
|
|
57
61
|
private options;
|
|
58
62
|
/** Transform result cache for performance */
|
|
59
63
|
private transformCache;
|
|
64
|
+
/** Path aliases from tsconfig.json (e.g., @/* -> ./*) */
|
|
65
|
+
private pathAliases;
|
|
66
|
+
/** Cached Tailwind config script (injected before CDN) */
|
|
67
|
+
private tailwindConfigScript;
|
|
68
|
+
/** Whether Tailwind config has been loaded */
|
|
69
|
+
private tailwindConfigLoaded;
|
|
70
|
+
/** Asset prefix for static files (e.g., '/marketing') */
|
|
71
|
+
private assetPrefix;
|
|
72
|
+
/** Base path for the app (e.g., '/docs') */
|
|
73
|
+
private basePath;
|
|
60
74
|
constructor(vfs: VirtualFS, options: NextDevServerOptions);
|
|
75
|
+
/**
|
|
76
|
+
* Load path aliases from tsconfig.json
|
|
77
|
+
* Supports common patterns like @/* -> ./*
|
|
78
|
+
*/
|
|
79
|
+
private loadPathAliases;
|
|
80
|
+
/**
|
|
81
|
+
* Load assetPrefix from options or auto-detect from next.config.ts/js
|
|
82
|
+
* The assetPrefix is used to prefix static asset URLs (e.g., '/marketing')
|
|
83
|
+
*/
|
|
84
|
+
private loadAssetPrefix;
|
|
85
|
+
/**
|
|
86
|
+
* Load basePath from options or auto-detect from next.config.ts/js
|
|
87
|
+
* The basePath is used to prefix all routes (e.g., '/docs' means / -> /docs)
|
|
88
|
+
*/
|
|
89
|
+
private loadBasePath;
|
|
90
|
+
/**
|
|
91
|
+
* Resolve path aliases in transformed code
|
|
92
|
+
* Converts imports like "@/components/foo" to "/__virtual__/PORT/components/foo"
|
|
93
|
+
* This ensures imports go through the virtual server instead of the main server
|
|
94
|
+
*/
|
|
95
|
+
private resolvePathAliases;
|
|
61
96
|
/**
|
|
62
97
|
* Set an environment variable at runtime
|
|
63
98
|
* NEXT_PUBLIC_* variables will be available via process.env in browser code
|
|
@@ -75,8 +110,14 @@ export declare class NextDevServer extends DevServer {
|
|
|
75
110
|
/**
|
|
76
111
|
* Generate a script tag that defines process.env with NEXT_PUBLIC_* variables
|
|
77
112
|
* This makes environment variables available to browser code via process.env.NEXT_PUBLIC_*
|
|
113
|
+
* Also includes all env variables for Server Component compatibility
|
|
78
114
|
*/
|
|
79
115
|
private generateEnvScript;
|
|
116
|
+
/**
|
|
117
|
+
* Load Tailwind config from tailwind.config.ts and generate a script
|
|
118
|
+
* that configures the Tailwind CDN at runtime
|
|
119
|
+
*/
|
|
120
|
+
private loadTailwindConfigIfNeeded;
|
|
80
121
|
/**
|
|
81
122
|
* Check if App Router is available
|
|
82
123
|
*/
|
|
@@ -89,6 +130,11 @@ export declare class NextDevServer extends DevServer {
|
|
|
89
130
|
* Serve Next.js shims (link, router, head, navigation)
|
|
90
131
|
*/
|
|
91
132
|
private serveNextShim;
|
|
133
|
+
/**
|
|
134
|
+
* Serve route info for client-side navigation
|
|
135
|
+
* Returns params extracted from dynamic route segments
|
|
136
|
+
*/
|
|
137
|
+
private serveRouteInfo;
|
|
92
138
|
/**
|
|
93
139
|
* Serve static assets from /_next/static/
|
|
94
140
|
*/
|
|
@@ -107,6 +153,20 @@ export declare class NextDevServer extends DevServer {
|
|
|
107
153
|
* Handle API route requests
|
|
108
154
|
*/
|
|
109
155
|
private handleApiRoute;
|
|
156
|
+
/**
|
|
157
|
+
* Resolve an App Router route handler (route.ts/route.js)
|
|
158
|
+
* Returns the file path if found, null otherwise
|
|
159
|
+
*/
|
|
160
|
+
private resolveAppRouteHandler;
|
|
161
|
+
/**
|
|
162
|
+
* Resolve dynamic App Router route handlers with route group support
|
|
163
|
+
*/
|
|
164
|
+
private resolveAppRouteHandlerDynamic;
|
|
165
|
+
/**
|
|
166
|
+
* Handle App Router route handler (route.ts) requests
|
|
167
|
+
* These use the Web Request/Response API pattern
|
|
168
|
+
*/
|
|
169
|
+
private handleAppRouteHandler;
|
|
110
170
|
/**
|
|
111
171
|
* Handle streaming API route requests
|
|
112
172
|
* This is called by the server bridge for requests that need streaming support
|
|
@@ -149,7 +209,9 @@ export declare class NextDevServer extends DevServer {
|
|
|
149
209
|
*/
|
|
150
210
|
private resolveAppRoute;
|
|
151
211
|
/**
|
|
152
|
-
* Resolve
|
|
212
|
+
* Resolve App Router routes including static, dynamic, and route groups.
|
|
213
|
+
* Route groups are folders wrapped in parentheses like (marketing) that
|
|
214
|
+
* don't affect the URL path but can have their own layouts.
|
|
153
215
|
*/
|
|
154
216
|
private resolveAppDynamicRoute;
|
|
155
217
|
/**
|
|
@@ -172,6 +234,12 @@ export declare class NextDevServer extends DevServer {
|
|
|
172
234
|
* Serve a basic 404 page
|
|
173
235
|
*/
|
|
174
236
|
private serve404Page;
|
|
237
|
+
/**
|
|
238
|
+
* Try to resolve a file path by adding common extensions
|
|
239
|
+
* e.g., /components/faq -> /components/faq.tsx
|
|
240
|
+
* Also handles index files in directories
|
|
241
|
+
*/
|
|
242
|
+
private resolveFileWithExtension;
|
|
175
243
|
/**
|
|
176
244
|
* Check if a file needs transformation
|
|
177
245
|
*/
|
|
@@ -184,18 +252,13 @@ export declare class NextDevServer extends DevServer {
|
|
|
184
252
|
* Transform JSX/TS code to browser-compatible JavaScript (ESM for browser)
|
|
185
253
|
*/
|
|
186
254
|
private transformCode;
|
|
187
|
-
|
|
188
|
-
* Strip CSS imports from code (they are loaded via <link> tags instead)
|
|
189
|
-
* Handles: import './styles.css', import '../globals.css', etc.
|
|
190
|
-
*/
|
|
255
|
+
private redirectNpmImports;
|
|
191
256
|
private stripCssImports;
|
|
257
|
+
private getCssModuleContext;
|
|
192
258
|
/**
|
|
193
259
|
* Transform API handler code to CommonJS for eval execution
|
|
194
260
|
*/
|
|
195
261
|
private transformApiHandler;
|
|
196
|
-
/**
|
|
197
|
-
* Add React Refresh registration to transformed code
|
|
198
|
-
*/
|
|
199
262
|
private addReactRefresh;
|
|
200
263
|
/**
|
|
201
264
|
* Start file watching for HMR
|
|
@@ -205,6 +268,15 @@ export declare class NextDevServer extends DevServer {
|
|
|
205
268
|
* Handle file change event
|
|
206
269
|
*/
|
|
207
270
|
private handleFileChange;
|
|
271
|
+
/**
|
|
272
|
+
* Override serveFile to wrap JSON files as ES modules
|
|
273
|
+
* This is needed because browsers can't dynamically import raw JSON files
|
|
274
|
+
*/
|
|
275
|
+
protected serveFile(filePath: string): ResponseData;
|
|
276
|
+
/**
|
|
277
|
+
* Resolve a path (helper to access protected method from parent)
|
|
278
|
+
*/
|
|
279
|
+
protected resolvePath(urlPath: string): string;
|
|
208
280
|
/**
|
|
209
281
|
* Stop the server
|
|
210
282
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-dev-server.d.ts","sourceRoot":"","sources":["../../src/frameworks/next-dev-server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAa,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,eA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AAC,mBAAmB;IAO3B;;OAEG;YACW,mBAAmB;IAgCjC,OAAO,CAAC,eAAe;IAIvB;;OAEG;IACH,aAAa,IAAI,IAAI;IAgDrB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAuBxB;;;OAGG;IACH,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY;IA8CnD;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAiB9C;;OAEG;IACH,IAAI,IAAI,IAAI;CAUb;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tailwind Config Loader
|
|
3
|
+
*
|
|
4
|
+
* Parses tailwind.config.ts files and generates JavaScript to configure
|
|
5
|
+
* the Tailwind CDN at runtime via window.tailwind.config.
|
|
6
|
+
*/
|
|
7
|
+
import type { VirtualFS } from '../virtual-fs';
|
|
8
|
+
export interface TailwindConfigResult {
|
|
9
|
+
/** JavaScript code to set window.tailwind.config (empty string if no config) */
|
|
10
|
+
configScript: string;
|
|
11
|
+
/** Whether config was successfully loaded */
|
|
12
|
+
success: boolean;
|
|
13
|
+
/** Error message if loading failed */
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Load and parse a Tailwind config file from VirtualFS
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadTailwindConfig(vfs: VirtualFS, root?: string): Promise<TailwindConfigResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Strip TypeScript-specific syntax from config content
|
|
22
|
+
*/
|
|
23
|
+
export declare function stripTypescriptSyntax(content: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Extract the config object from the processed content
|
|
26
|
+
*/
|
|
27
|
+
export declare function extractConfigObject(content: string): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Generate the script to inject the Tailwind config
|
|
30
|
+
*/
|
|
31
|
+
export declare function generateConfigScript(configObject: string): string;
|
|
32
|
+
//# sourceMappingURL=tailwind-config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind-config-loader.d.ts","sourceRoot":"","sources":["../../src/frameworks/tailwind-config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,WAAW,oBAAoB;IACnC,gFAAgF;IAChF,YAAY,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AASD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,SAAS,EACd,IAAI,GAAE,MAAY,GACjB,OAAO,CAAC,oBAAoB,CAAC,CAyD/B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAwB7D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAuElE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAOjE"}
|
|
@@ -62,10 +62,6 @@ export declare class ViteDevServer extends DevServer {
|
|
|
62
62
|
* Transform JSX/TS code to browser-compatible JavaScript
|
|
63
63
|
*/
|
|
64
64
|
private transformCode;
|
|
65
|
-
/**
|
|
66
|
-
* Add React Refresh registration to transformed code
|
|
67
|
-
* This enables true HMR (state-preserving) for React components
|
|
68
|
-
*/
|
|
69
65
|
private addReactRefresh;
|
|
70
66
|
/**
|
|
71
67
|
* Serve CSS file as a JavaScript module that injects styles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-dev-server.d.ts","sourceRoot":"","sources":["../../src/frameworks/vite-dev-server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA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