@absolutejs/absolute 0.19.0-beta.782 → 0.19.0-beta.784
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/dist/angular/browser.js +57 -9801
- package/dist/angular/browser.js.map +4 -246
- package/dist/angular/index.js +61 -14880
- package/dist/angular/index.js.map +4 -282
- package/dist/angular/server.js +46 -5613
- package/dist/angular/server.js.map +3 -52
- package/dist/build.js +45 -17902
- package/dist/build.js.map +3 -100
- package/dist/chunk-102fp7xe.js +63 -0
- package/dist/chunk-102fp7xe.js.map +10 -0
- package/dist/chunk-11zpfqz6.js +19 -0
- package/dist/chunk-11zpfqz6.js.map +10 -0
- package/dist/chunk-1e9vsfyh.js +100 -0
- package/dist/chunk-1e9vsfyh.js.map +10 -0
- package/dist/chunk-25v9t56f.js +29 -0
- package/dist/chunk-25v9t56f.js.map +11 -0
- package/dist/chunk-2f21eenc.js +21 -0
- package/dist/chunk-2f21eenc.js.map +10 -0
- package/dist/chunk-2ga2znex.js +13 -0
- package/dist/chunk-2ga2znex.js.map +9 -0
- package/dist/chunk-30yrw0f6.js +33 -0
- package/dist/chunk-30yrw0f6.js.map +10 -0
- package/dist/chunk-3c7mpj3m.js +784 -0
- package/dist/chunk-3c7mpj3m.js.map +10 -0
- package/dist/chunk-3g91wb4f.js +358 -0
- package/dist/chunk-3g91wb4f.js.map +10 -0
- package/dist/chunk-3yjzpcne.js +34 -0
- package/dist/chunk-3yjzpcne.js.map +10 -0
- package/dist/chunk-4bq79t8v.js +136 -0
- package/dist/chunk-4bq79t8v.js.map +10 -0
- package/dist/chunk-4d39r92n.js +81 -0
- package/dist/chunk-4d39r92n.js.map +10 -0
- package/dist/chunk-4m75s5xf.js +184 -0
- package/dist/chunk-4m75s5xf.js.map +11 -0
- package/dist/chunk-5003emhv.js +17 -0
- package/dist/chunk-5003emhv.js.map +10 -0
- package/dist/chunk-5fhp1jap.js +9169 -0
- package/dist/chunk-5fhp1jap.js.map +236 -0
- package/dist/chunk-6fkgm9s5.js +569 -0
- package/dist/chunk-6fkgm9s5.js.map +10 -0
- package/dist/chunk-6pdj08z3.js +73 -0
- package/dist/chunk-6pdj08z3.js.map +12 -0
- package/dist/chunk-6qjbrt0k.js +13 -0
- package/dist/chunk-6qjbrt0k.js.map +9 -0
- package/dist/chunk-6sccb4jr.js +14 -0
- package/dist/chunk-6sccb4jr.js.map +9 -0
- package/dist/chunk-73brtyw5.js +16 -0
- package/dist/chunk-73brtyw5.js.map +9 -0
- package/dist/chunk-77cqkarb.js +25 -0
- package/dist/chunk-77cqkarb.js.map +9 -0
- package/dist/chunk-798spvzv.js +50 -0
- package/dist/chunk-798spvzv.js.map +10 -0
- package/dist/chunk-7fw6x3js.js +131 -0
- package/dist/chunk-7fw6x3js.js.map +11 -0
- package/dist/chunk-7kjj42xm.js +11 -0
- package/dist/chunk-7kjj42xm.js.map +10 -0
- package/dist/chunk-851whwc7.js +17 -0
- package/dist/chunk-851whwc7.js.map +10 -0
- package/dist/chunk-85n68sy6.js +103 -0
- package/dist/chunk-85n68sy6.js.map +10 -0
- package/dist/chunk-8feq2qek.js +17 -0
- package/dist/chunk-8feq2qek.js.map +9 -0
- package/dist/chunk-8kcfffry.js +35 -0
- package/dist/chunk-8kcfffry.js.map +10 -0
- package/dist/chunk-93sqk7be.js +139 -0
- package/dist/chunk-93sqk7be.js.map +12 -0
- package/dist/chunk-97572s32.js +262 -0
- package/dist/chunk-97572s32.js.map +12 -0
- package/dist/chunk-9a307ca6.js +1742 -0
- package/dist/chunk-9a307ca6.js.map +11 -0
- package/dist/chunk-9c5tj4k3.js +130 -0
- package/dist/chunk-9c5tj4k3.js.map +10 -0
- package/dist/chunk-9xrsjeem.js +12 -0
- package/dist/chunk-9xrsjeem.js.map +9 -0
- package/dist/chunk-a9mvyp04.js +87 -0
- package/dist/chunk-a9mvyp04.js.map +10 -0
- package/dist/chunk-b3gbnrwe.js +21 -0
- package/dist/chunk-b3gbnrwe.js.map +10 -0
- package/dist/chunk-bmgqm774.js +65 -0
- package/dist/chunk-bmgqm774.js.map +9 -0
- package/dist/chunk-bxfghpma.js +69 -0
- package/dist/chunk-bxfghpma.js.map +10 -0
- package/dist/chunk-c1jfjnka.js +74 -0
- package/dist/chunk-c1jfjnka.js.map +10 -0
- package/dist/chunk-cbkrwmvh.js +80 -0
- package/dist/chunk-cbkrwmvh.js.map +10 -0
- package/dist/chunk-cdxd7sy2.js +71 -0
- package/dist/chunk-cdxd7sy2.js.map +10 -0
- package/dist/chunk-cg95827x.js +21 -0
- package/dist/chunk-cg95827x.js.map +10 -0
- package/dist/chunk-d9c0am65.js +12 -0
- package/dist/chunk-d9c0am65.js.map +10 -0
- package/dist/chunk-daqghmg8.js +12 -0
- package/dist/chunk-daqghmg8.js.map +9 -0
- package/dist/chunk-dr9yqsdb.js +203 -0
- package/dist/chunk-dr9yqsdb.js.map +10 -0
- package/dist/chunk-e8eecyrq.js +244 -0
- package/dist/chunk-e8eecyrq.js.map +10 -0
- package/dist/chunk-ex2hxe0v.js +160 -0
- package/dist/chunk-ex2hxe0v.js.map +11 -0
- package/dist/chunk-ey5hs6x6.js +253 -0
- package/dist/chunk-ey5hs6x6.js.map +11 -0
- package/dist/chunk-fak944et.js +91 -0
- package/dist/chunk-fak944et.js.map +10 -0
- package/dist/chunk-fygx2ymm.js +118 -0
- package/dist/chunk-fygx2ymm.js.map +12 -0
- package/dist/chunk-g15qj669.js +271 -0
- package/dist/chunk-g15qj669.js.map +11 -0
- package/dist/chunk-g3j22qf6.js +51 -0
- package/dist/chunk-g3j22qf6.js.map +9 -0
- package/dist/chunk-gd6wmknh.js +121 -0
- package/dist/chunk-gd6wmknh.js.map +11 -0
- package/dist/chunk-gf0ygptk.js +85 -0
- package/dist/chunk-gf0ygptk.js.map +11 -0
- package/dist/chunk-gq0zxpm0.js +90 -0
- package/dist/chunk-gq0zxpm0.js.map +10 -0
- package/dist/chunk-gytkmthr.js +220 -0
- package/dist/chunk-gytkmthr.js.map +10 -0
- package/dist/chunk-h5bbfn3n.js +28 -0
- package/dist/chunk-h5bbfn3n.js.map +11 -0
- package/dist/chunk-h6mye9r3.js +93 -0
- package/dist/chunk-h6mye9r3.js.map +10 -0
- package/dist/chunk-hcsmxw1v.js +85 -0
- package/dist/chunk-hcsmxw1v.js.map +10 -0
- package/dist/chunk-hep68ja7.js +4444 -0
- package/dist/chunk-hep68ja7.js.map +29 -0
- package/dist/chunk-hhqh49fz.js +149 -0
- package/dist/chunk-hhqh49fz.js.map +10 -0
- package/dist/chunk-hyjs4bqs.js +8 -0
- package/dist/chunk-hyjs4bqs.js.map +10 -0
- package/dist/chunk-hza0n8qm.js +20 -0
- package/dist/chunk-hza0n8qm.js.map +9 -0
- package/dist/chunk-jn91vzkh.js +66 -0
- package/dist/chunk-jn91vzkh.js.map +10 -0
- package/dist/chunk-jwxt8gnp.js +13 -0
- package/dist/chunk-jwxt8gnp.js.map +9 -0
- package/dist/chunk-kk8w9rh5.js +195 -0
- package/dist/chunk-kk8w9rh5.js.map +10 -0
- package/dist/chunk-kndkjsya.js +261 -0
- package/dist/chunk-kndkjsya.js.map +10 -0
- package/dist/chunk-kvq01j35.js +36 -0
- package/dist/chunk-kvq01j35.js.map +10 -0
- package/dist/chunk-mbazhahf.js +60 -0
- package/dist/chunk-mbazhahf.js.map +10 -0
- package/dist/chunk-mgfwq18r.js +15 -0
- package/dist/chunk-mgfwq18r.js.map +9 -0
- package/dist/chunk-mtgf69xn.js +88 -0
- package/dist/chunk-mtgf69xn.js.map +10 -0
- package/dist/chunk-nehhtthw.js +225 -0
- package/dist/chunk-nehhtthw.js.map +10 -0
- package/dist/chunk-nhzf4az4.js +149 -0
- package/dist/chunk-nhzf4az4.js.map +10 -0
- package/dist/chunk-p5504p14.js +16 -0
- package/dist/chunk-p5504p14.js.map +10 -0
- package/dist/chunk-pnscgw95.js +90 -0
- package/dist/chunk-pnscgw95.js.map +10 -0
- package/dist/chunk-pvpp4pvs.js +17 -0
- package/dist/chunk-pvpp4pvs.js.map +10 -0
- package/dist/chunk-qh75agse.js +95 -0
- package/dist/chunk-qh75agse.js.map +10 -0
- package/dist/chunk-qk8kd3hr.js +526 -0
- package/dist/chunk-qk8kd3hr.js.map +12 -0
- package/dist/chunk-qxq2zcty.js +52 -0
- package/dist/chunk-qxq2zcty.js.map +10 -0
- package/dist/chunk-r7jmgqnw.js +114 -0
- package/dist/chunk-r7jmgqnw.js.map +10 -0
- package/dist/chunk-s6defjk2.js +116 -0
- package/dist/chunk-s6defjk2.js.map +10 -0
- package/dist/chunk-sd39p726.js +619 -0
- package/dist/chunk-sd39p726.js.map +10 -0
- package/dist/chunk-smgj0epn.js +18 -0
- package/dist/chunk-smgj0epn.js.map +9 -0
- package/dist/chunk-swrnzs4c.js +63 -0
- package/dist/chunk-swrnzs4c.js.map +10 -0
- package/dist/chunk-t81a331y.js +27 -0
- package/dist/chunk-t81a331y.js.map +10 -0
- package/dist/chunk-tfe3sb44.js +33 -0
- package/dist/chunk-tfe3sb44.js.map +10 -0
- package/dist/chunk-tx9edm1x.js +34 -0
- package/dist/chunk-tx9edm1x.js.map +10 -0
- package/dist/chunk-vkrpm7kc.js +247 -0
- package/dist/chunk-vkrpm7kc.js.map +12 -0
- package/dist/chunk-vvz7dcvq.js +434 -0
- package/dist/chunk-vvz7dcvq.js.map +13 -0
- package/dist/chunk-w3m4m5we.js +4925 -0
- package/dist/chunk-w3m4m5we.js.map +12 -0
- package/dist/chunk-wrxtn9ve.js +18 -0
- package/dist/chunk-wrxtn9ve.js.map +10 -0
- package/dist/chunk-xpkjbmd3.js +428 -0
- package/dist/chunk-xpkjbmd3.js.map +14 -0
- package/dist/chunk-xrmjy8kk.js +454 -0
- package/dist/chunk-xrmjy8kk.js.map +10 -0
- package/dist/chunk-xw0tx842.js +13 -0
- package/dist/chunk-xw0tx842.js.map +9 -0
- package/dist/chunk-xx5b6b9m.js +69 -0
- package/dist/chunk-xx5b6b9m.js.map +10 -0
- package/dist/chunk-xz1kdswj.js +21 -0
- package/dist/chunk-xz1kdswj.js.map +9 -0
- package/dist/chunk-xzvy9hr4.js +377 -0
- package/dist/chunk-xzvy9hr4.js.map +10 -0
- package/dist/chunk-yfqhr31t.js +39 -0
- package/dist/chunk-yfqhr31t.js.map +9 -0
- package/dist/chunk-ygzd5s4z.js +184 -0
- package/dist/chunk-ygzd5s4z.js.map +10 -0
- package/dist/chunk-ywjn0rad.js +14 -0
- package/dist/chunk-ywjn0rad.js.map +9 -0
- package/dist/chunk-z9nvhm6r.js +13 -0
- package/dist/chunk-z9nvhm6r.js.map +9 -0
- package/dist/chunk-zhmvdpk6.js +15 -0
- package/dist/chunk-zhmvdpk6.js.map +9 -0
- package/dist/cli/index.js +6 -3
- package/dist/client/index.js +32 -1112
- package/dist/client/index.js.map +4 -22
- package/dist/core/streamingSlotRegistrar.js +11 -108
- package/dist/core/streamingSlotRegistrar.js.map +3 -4
- package/dist/core/streamingSlotRegistry.js +7 -169
- package/dist/core/streamingSlotRegistry.js.map +3 -5
- package/dist/index.js +537 -19714
- package/dist/index.js.map +3 -117
- package/dist/islands/browser.js +9 -228
- package/dist/islands/browser.js.map +4 -9
- package/dist/islands/index.js +18 -1900
- package/dist/islands/index.js.map +3 -28
- package/dist/react/browser.js +12 -328
- package/dist/react/browser.js.map +4 -12
- package/dist/react/components/index.js +16 -167
- package/dist/react/components/index.js.map +3 -6
- package/dist/react/hooks/index.js +8 -183
- package/dist/react/hooks/index.js.map +3 -7
- package/dist/react/index.js +37 -3619
- package/dist/react/index.js.map +4 -46
- package/dist/react/jsxDevRuntimeCompat.js +2 -61
- package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
- package/dist/react/server.js +18 -1789
- package/dist/react/server.js.map +3 -21
- package/dist/src/build/stylePreprocessor.d.ts +3 -0
- package/dist/src/core/index.d.ts +0 -2
- package/dist/svelte/browser.js +12 -247
- package/dist/svelte/browser.js.map +3 -10
- package/dist/svelte/index.js +38 -3724
- package/dist/svelte/index.js.map +4 -48
- package/dist/svelte/server.js +22 -2701
- package/dist/svelte/server.js.map +3 -27
- package/dist/vue/browser.js +12 -348
- package/dist/vue/browser.js.map +4 -12
- package/dist/vue/components/Image.js +7 -240
- package/dist/vue/components/Image.js.map +3 -6
- package/dist/vue/components/index.js +11 -544
- package/dist/vue/components/index.js.map +3 -9
- package/dist/vue/index.js +53 -4204
- package/dist/vue/index.js.map +4 -51
- package/dist/vue/server.js +18 -1849
- package/dist/vue/server.js.map +3 -21
- package/package.json +7 -7
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/dev/moduleServer.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { BASE_36_RADIX, UNFOUND_INDEX } from '../constants';\nimport { existsSync, readFileSync, statSync } from 'node:fs';\nimport { basename, dirname, extname, resolve, relative } from 'node:path';\nimport { resolvePackageImport } from '../build/resolvePackageImport';\nimport { buildIslandMetadataExports } from '../islands/sourceMetadata';\nimport {\n\tcompileStyleSource,\n\tcreateSvelteStylePreprocessor\n} from '../build/stylePreprocessor';\nimport { lowerSvelteAwaitSlotSyntax } from '../svelte/lowerAwaitSlotSyntax';\nimport { lowerSvelteIslandSyntax } from '../svelte/lowerIslandSyntax';\nimport type { StylePreprocessorConfig } from '../../types/build';\nimport type { BindingMetadata, SFCDescriptor } from '@vue/compiler-sfc';\nimport {\n\tgetInvalidationVersion,\n\tgetTransformed,\n\tinvalidate,\n\tsetTransformed\n} from './transformCache';\n\nconst SRC_PREFIX = '/@src/';\n\nconst jsTranspiler = new Bun.Transpiler({\n\tloader: 'js',\n\ttrimUnusedImports: true\n});\n\n// Shared transpiler for TypeScript files — trimUnusedImports strips\n// type-only imports so the browser doesn't request unnecessary modules\n// Separate transpilers for .ts and .tsx — using 'tsx' for .ts files\n// causes parse errors on TypeScript generics like <T> (interpreted as JSX).\nconst tsTranspiler = new Bun.Transpiler({\n\tloader: 'ts',\n\ttrimUnusedImports: true\n});\n\nconst tsxTranspiler = new Bun.Transpiler({\n\tloader: 'tsx',\n\ttrimUnusedImports: true\n});\n\nconst TRANSPILABLE = new Set(['.ts', '.tsx', '.js', '.jsx', '.mjs']);\n\n// Regex to find all export names in original TypeScript source\nconst ALL_EXPORTS_RE =\n\t/export\\s+(?:type|interface|const|let|var|function|class|enum|abstract\\s+class)\\s+(\\w+)/g;\n\n// Strip string/template literal contents so regex doesn't match\n// export declarations inside code examples embedded as strings.\nconst STRING_CONTENTS_RE =\n\t/`(?:[^`\\\\]|\\\\.)*`|'(?:[^'\\\\]|\\\\.)*'|\"(?:[^\"\\\\]|\\\\.)*\"/gs;\n\n// After transpilation, type exports are stripped. Inject stubs so\n// importing modules can resolve the names (as undefined).\nconst preserveTypeExports = (\n\toriginalSource: string,\n\ttranspiled: string,\n\tvalueExports: string[]\n) => {\n\tconst codeOnly = originalSource.replace(STRING_CONTENTS_RE, '\"\"');\n\tconst allExports: string[] = [];\n\tlet match;\n\tALL_EXPORTS_RE.lastIndex = 0;\n\twhile ((match = ALL_EXPORTS_RE.exec(codeOnly)) !== null) {\n\t\tif (match[1]) allExports.push(match[1]);\n\t}\n\n\tconst valueSet = new Set(valueExports);\n\tconst typeExports = allExports.filter((exp) => !valueSet.has(exp));\n\n\tif (typeExports.length === 0) return transpiled;\n\n\tconst stubs = typeExports\n\t\t.map((name) => `export const ${name} = undefined;`)\n\t\t.join('\\n');\n\n\treturn `${transpiled}\\n${stubs}\\n`;\n};\n// Try known extensions to resolve an extensionless path. Returns\n// the original path if none match (existsSync-based probing).\nconst resolveRelativeExtension = (\n\tsrcPath: string,\n\tprojectRoot: string,\n\textensions: string[]\n) => {\n\tconst found = extensions.find((ext) =>\n\t\texistsSync(resolve(projectRoot, srcPath + ext))\n\t);\n\n\treturn found ? srcPath + found : srcPath;\n};\n\nconst IMPORT_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js', '.svelte', '.vue'];\nconst SIDE_EFFECT_EXTENSIONS = [\n\t'.tsx',\n\t'.ts',\n\t'.jsx',\n\t'.js',\n\t'.css',\n\t'.svelte',\n\t'.vue'\n];\nconst MODULE_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js', '.svelte', '.vue'];\nconst RESOLVED_MODULE_EXTENSIONS = new Set([\n\t...IMPORT_EXTENSIONS,\n\t...SIDE_EFFECT_EXTENSIONS,\n\t'.mjs',\n\t'.css'\n]);\n\nconst REACT_EXTENSIONS = new Set(['.tsx', '.jsx']);\n\ntype ModuleServerConfig = {\n\tprojectRoot: string;\n\tvendorPaths: Record<string, string>;\n\tframeworkDirs?: {\n\t\tangular?: string;\n\t\treact?: string;\n\t\tsvelte?: string;\n\t\tvue?: string;\n\t};\n\tstylePreprocessors?: StylePreprocessorConfig;\n};\n\nconst escapeRegex = (str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\nconst buildImportRewriter = (vendorPaths: Record<string, string>) => {\n\tconst entries = Object.entries(vendorPaths).sort(\n\t\t([a], [b]) => b.length - a.length\n\t);\n\tif (entries.length === 0) return null;\n\n\tconst alt = entries.map(([spec]) => escapeRegex(spec)).join('|');\n\tconst lookup = new Map(entries);\n\n\t// Single combined regex for all vendor import patterns:\n\t// from 'pkg', import 'pkg', import('pkg')\n\tconst vendorRegex = new RegExp(\n\t\t`((?:from|import)\\\\s*[\"']|import\\\\s*\\\\(\\\\s*[\"'])(${alt})([\"'](?:\\\\s*[;)]?)?)`,\n\t\t'g'\n\t);\n\n\treturn { lookup, vendorRegex };\n};\n\n// Mtime cache — avoids statSync on every import rewrite.\n// Invalidated by the file watcher via invalidateModule().\nconst mtimeCache = new Map<string, number>();\n\n// Append invalidation version if the file's transform cache was\n// cleared (e.g., a downstream import changed). This forces the\n// browser to re-fetch even though the file's own mtime is the same.\nconst buildVersion = (mtime: number, absPath: string) => {\n\tconst invalidationVersion = getInvalidationVersion(absPath);\n\n\treturn invalidationVersion > 0\n\t\t? `${mtime}.${invalidationVersion}`\n\t\t: `${mtime}`;\n};\n\n// Build a /@src/ URL with the file's mtime as a cache buster.\nconst srcUrl = (relPath: string, projectRoot: string) => {\n\tconst base = `${SRC_PREFIX}${relPath.replace(/\\\\/g, '/')}`;\n\tconst absPath = resolve(projectRoot, relPath);\n\n\tconst cached = mtimeCache.get(absPath);\n\tif (cached !== undefined)\n\t\treturn `${base}?v=${buildVersion(cached, absPath)}`;\n\n\ttry {\n\t\tconst mtime = Math.round(statSync(absPath).mtimeMs);\n\t\tmtimeCache.set(absPath, mtime);\n\n\t\treturn `${base}?v=${buildVersion(mtime, absPath)}`;\n\t} catch {\n\t\treturn base;\n\t}\n};\n\n// Resolve a relative import specifier to a /@src/ URL path.\n// Probes known extensions, resolves .svelte module files.\nconst resolveRelativeImport = (\n\trelPath: string,\n\tfileDir: string,\n\tprojectRoot: string,\n\textensions: string[]\n) => {\n\tconst absPath = resolve(fileDir, relPath);\n\tconst rel = relative(projectRoot, absPath);\n\tconst extension = extname(rel);\n\tlet srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension)\n\t\t? rel\n\t\t: resolveRelativeExtension(rel, projectRoot, extensions);\n\n\t// Resolve Svelte module files: .svelte → .svelte.ts / .svelte.js\n\tif (extname(srcPath) === '.svelte') {\n\t\tsrcPath = relative(\n\t\t\tprojectRoot,\n\t\t\tresolveSvelteModulePath(resolve(projectRoot, srcPath))\n\t\t);\n\t}\n\n\treturn srcUrl(srcPath, projectRoot);\n};\n\n// Resolve @absolutejs/* specifiers to project-relative paths.\n// Returns the relative path string on success, or undefined if resolution fails.\nconst resolveAbsoluteSpecifier = (specifier: string, projectRoot: string) => {\n\ttry {\n\t\tconst target =\n\t\t\tresolvePackageImport(specifier, ['browser', 'import']) ??\n\t\t\tBun.resolveSync(specifier, projectRoot);\n\n\t\treturn relative(projectRoot, target);\n\t} catch {\n\t\t// Resolution failed — caller falls through to stub\n\t\treturn undefined;\n\t}\n};\n\nconst rewriteImports = (\n\tcode: string,\n\tfilePath: string,\n\tprojectRoot: string,\n\trewriter: ReturnType<typeof buildImportRewriter>\n) => {\n\tlet result = code;\n\n\t// Step 1: Rewrite KNOWN vendor specifiers in a single pass.\n\tconst vendorReplace = (\n\t\t_match: string,\n\t\tprefix: string,\n\t\tspecifier: string,\n\t\tsuffix: string\n\t) => {\n\t\tconst webPath = rewriter?.lookup.get(specifier);\n\n\t\treturn webPath ? `${prefix}${webPath}${suffix}` : _match;\n\t};\n\n\tif (rewriter) {\n\t\trewriter.vendorRegex.lastIndex = 0;\n\t\tresult = result.replace(rewriter.vendorRegex, vendorReplace);\n\t}\n\n\t// Step 2: Rewrite remaining bare specifiers (unknown packages) to stubs.\n\t// Line-anchored to avoid matching inside string literals.\n\tconst stubReplace = (\n\t\t_match: string,\n\t\tprefix: string,\n\t\tspecifier: string,\n\t\tsuffix: string\n\t) => {\n\t\t// Skip if already rewritten to a path\n\t\tif (specifier.startsWith('/') || specifier.startsWith('.'))\n\t\t\treturn _match;\n\n\t\t// Serve client-safe split AbsoluteJS package exports as real modules\n\t\t// instead of stubbing them so package entrypoints hydrate correctly.\n\t\tif (!specifier.startsWith('@absolutejs/'))\n\t\t\treturn `${prefix}/@stub/${encodeURIComponent(specifier)}${suffix}`;\n\n\t\tconst resolved = resolveAbsoluteSpecifier(specifier, projectRoot);\n\t\tif (resolved) {\n\t\t\treturn `${prefix}${srcUrl(resolved, projectRoot)}${suffix}`;\n\t\t}\n\n\t\treturn `${prefix}/@stub/${encodeURIComponent(specifier)}${suffix}`;\n\t};\n\n\t// Combined: import/export from 'bare', import 'bare' (line-anchored)\n\t// Uses [\\s\\S]+? to match multi-line imports (e.g., import {\\n foo\\n} from 'pkg')\n\tresult = result.replace(\n\t\t/^((?:import\\s+[\\s\\S]+?\\s+from|export\\s+[\\s\\S]+?\\s+from|import)\\s*[\"'])([^\"'./][^\"']*)([\"'])/gm,\n\t\tstubReplace\n\t);\n\t// Dynamic: import('bare')\n\tresult = result.replace(\n\t\t/(import\\s*\\(\\s*[\"'])([^\"'./][^\"']*)([\"']\\s*\\))/g,\n\t\tstubReplace\n\t);\n\n\t// Rewrite relative imports to /@src/ absolute paths\n\tconst fileDir = dirname(filePath);\n\tresult = result.replace(\n\t\t/(from\\s*[\"'])(\\.\\.?\\/[^\"']+)([\"'])/g,\n\t\t(_match, prefix, relPath, suffix) =>\n\t\t\t`${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`\n\t);\n\n\t// Rewrite dynamic relative imports\n\tresult = result.replace(\n\t\t/(import\\s*\\(\\s*[\"'])(\\.\\.?\\/[^\"']+)([\"']\\s*\\))/g,\n\t\t(_match, prefix, relPath, suffix) =>\n\t\t\t`${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`\n\t);\n\n\t// Rewrite side-effect relative imports: import './foo'\n\tresult = result.replace(\n\t\t/(import\\s*[\"'])(\\.\\.?\\/[^\"']+)([\"']\\s*;?)/g,\n\t\t(_match, prefix, relPath, suffix) =>\n\t\t\t`${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`\n\t);\n\n\t// Rewrite absolute filesystem paths (from generated index files that\n\t// import hmrClient, refreshSetup, etc. via absolute paths)\n\tresult = result.replace(\n\t\t/((?:from|import)\\s*[\"'])(\\/[^\"']+\\.(tsx?|jsx?|ts))([\"'])/g,\n\t\t(_match, prefix, absPath, _ext, suffix) => {\n\t\t\tif (absPath.startsWith(projectRoot)) {\n\t\t\t\tconst rel = relative(projectRoot, absPath).replace(/\\\\/g, '/');\n\n\t\t\t\treturn `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;\n\t\t\t}\n\t\t\t// Path outside project root (for example, Bun-linked package files\n\t\t\t// whose realpath points at a sibling workspace). We still rewrite it\n\t\t\t// through /@src/ so the module server can serve it consistently.\n\t\t\tconst rel = relative(projectRoot, absPath).replace(/\\\\/g, '/');\n\n\t\t\treturn `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;\n\t\t}\n\t);\n\n\t// Rewrite new URL('./relative', import.meta.url) for web workers / assets\n\tresult = result.replace(\n\t\t/new\\s+URL\\(\\s*[\"'](\\.\\.?\\/[^\"']+)[\"']\\s*,\\s*import\\.meta\\.url\\s*\\)/g,\n\t\t(_match, relPath) => {\n\t\t\tconst absPath = resolve(fileDir, relPath);\n\t\t\tconst rel = relative(projectRoot, absPath);\n\n\t\t\treturn `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;\n\t\t}\n\t);\n\n\t// Rewrite import.meta.resolve('./relative') for asset/worker references\n\tresult = result.replace(\n\t\t/import\\.meta\\.resolve\\(\\s*[\"'](\\.\\.?\\/[^\"']+)[\"']\\s*\\)/g,\n\t\t(_match, relPath) => {\n\t\t\tconst absPath = resolve(fileDir, relPath);\n\t\t\tconst rel = relative(projectRoot, absPath);\n\n\t\t\treturn `'${srcUrl(rel, projectRoot)}'`;\n\t\t}\n\t);\n\n\treturn result;\n};\n\n// Use Bun.Transpiler (~0.1ms) instead of Bun.build (~2-150ms) for\n// React files. Manually inject $RefreshReg$/$RefreshSig$ calls\n// after transpilation.\n// Bun.Transpiler uses an auto-generated name for JSX (jsxDEV_XXXXXXXX)\n// but doesn't emit the import statement. We need to detect the generated\n// name and add the import ourselves.\nconst JSX_AUTO_RE = /\\b(jsxDEV_[a-z0-9]+)\\b/;\nconst JSXS_AUTO_RE = /\\b(jsxs_[a-z0-9]+)\\b/;\nconst JSX_PROD_RE = /\\b(jsx_[a-z0-9]+)\\b/;\nconst FRAGMENT_RE = /\\b(Fragment_[a-z0-9]+)\\b/;\n\nconst addJsxImport = (code: string) => {\n\tconst imports: string[] = [];\n\n\tconst jsxDevMatch = JSX_AUTO_RE.exec(code);\n\tif (jsxDevMatch) {\n\t\timports.push(\n\t\t\t`import { jsxDEV as ${jsxDevMatch[1]} } from \"react/jsx-dev-runtime\";`\n\t\t);\n\t}\n\n\tconst jsxsMatch = JSXS_AUTO_RE.exec(code);\n\tif (jsxsMatch && (!jsxDevMatch || jsxsMatch[1] !== jsxDevMatch[1])) {\n\t\timports.push(\n\t\t\t`import { jsxs as ${jsxsMatch[1]} } from \"react/jsx-runtime\";`\n\t\t);\n\t}\n\n\tconst jsxProdMatch = JSX_PROD_RE.exec(code);\n\tif (jsxProdMatch) {\n\t\timports.push(\n\t\t\t`import { jsx as ${jsxProdMatch[1]} } from \"react/jsx-runtime\";`\n\t\t);\n\t}\n\n\tconst fragmentMatch = FRAGMENT_RE.exec(code);\n\tif (fragmentMatch) {\n\t\timports.push(\n\t\t\t`import { Fragment as ${fragmentMatch[1]} } from \"react\";`\n\t\t);\n\t}\n\n\tif (imports.length === 0) return code;\n\n\treturn `${imports.join('\\n')}\\n${code}`;\n};\n\n// With the patched Bun.Transpiler (PR #28312), reactFastRefresh: true\n// injects $RefreshReg$/$RefreshSig$ natively — no manual injection needed.\n// Falls back to plain transpilation if reactFastRefresh isn't available.\n// reactFastRefresh is available via patched Bun (PR #28312) but not\n// yet in the upstream type definitions, so we extend the options type.\nconst reactTranspilerOptions: ConstructorParameters<\n\ttypeof Bun.Transpiler\n>[0] & {\n\treactFastRefresh?: boolean;\n} = {\n\tloader: 'tsx',\n\treactFastRefresh: true,\n\ttrimUnusedImports: true\n};\nconst reactTranspiler = new Bun.Transpiler(reactTranspilerOptions);\n\nconst transformReactFile = (\n\tfilePath: string,\n\tprojectRoot: string,\n\trewriter: ReturnType<typeof buildImportRewriter>\n) => {\n\tconst raw = readFileSync(filePath, 'utf-8');\n\tconst valueExports = tsxTranspiler.scan(raw).exports;\n\tlet transpiled = reactTranspiler.transformSync(raw);\n\ttranspiled = preserveTypeExports(raw, transpiled, valueExports);\n\n\t// Bun.Transpiler auto-generates JSX function names (jsxDEV_XXXXXXXX)\n\t// but doesn't emit the import — it expects the bundler to resolve it.\n\ttranspiled = addJsxImport(transpiled);\n\n\t// The patched transpiler imports register/createSignatureFunctionForTransform\n\t// from react-refresh/runtime, creating a separate module instance. But the\n\t// initial bundled index uses window.$RefreshReg$/$RefreshSig$ globals.\n\t// Replace the import with globals so registrations go to the same runtime.\n\ttranspiled = transpiled.replace(\n\t\t/import\\s*\\{[^}]*\\}\\s*from\\s*[\"']react-refresh\\/runtime[\"'];?\\n?/,\n\t\t''\n\t);\n\t// Map the aliased names to the window globals\n\ttranspiled = transpiled.replace(\n\t\t/\\$RefreshReg\\$_[a-z0-9]+/g,\n\t\t'$RefreshReg$'\n\t);\n\ttranspiled = transpiled.replace(\n\t\t/\\$RefreshSig\\$_[a-z0-9]+/g,\n\t\t'$RefreshSig$'\n\t);\n\t// Prepend window global stubs for ESM scope\n\ttranspiled =\n\t\t`var $RefreshReg$ = window.$RefreshReg$ || function(){};\\n` +\n\t\t`var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };\\n${\n\t\t\ttranspiled\n\t\t}`;\n\n\t// Bun.Transpiler uses \"input.tsx\" as the default filename in\n\t// $RefreshReg$ IDs. Replace with the real relative path so IDs\n\t// match the initial bundled registration.\n\tconst relPath = relative(projectRoot, filePath).replace(/\\\\/g, '/');\n\ttranspiled = transpiled.replace(/\\binput\\.tsx:/g, `${relPath}:`);\n\ttranspiled += buildIslandMetadataExports(raw);\n\n\treturn rewriteImports(transpiled, filePath, projectRoot, rewriter);\n};\n\n// Use Bun.Transpiler for non-React files (no refresh injection needed)\nconst transformPlainFile = (\n\tfilePath: string,\n\tprojectRoot: string,\n\trewriter: ReturnType<typeof buildImportRewriter>,\n\tvueDir?: string\n) => {\n\tconst raw = readFileSync(filePath, 'utf-8');\n\tconst ext = extname(filePath);\n\tconst isTS = ext === '.ts' || ext === '.tsx';\n\tconst isTSX = ext === '.tsx' || ext === '.jsx';\n\n\tlet transpiler = jsTranspiler;\n\tif (isTSX) transpiler = tsxTranspiler;\n\telse if (isTS) transpiler = tsTranspiler;\n\tconst valueExports = isTS ? transpiler.scan(raw).exports : [];\n\tlet transpiled = transpiler.transformSync(raw);\n\n\tif (isTS) {\n\t\ttranspiled = preserveTypeExports(raw, transpiled, valueExports);\n\t}\n\n\ttranspiled = rewriteImports(transpiled, filePath, projectRoot, rewriter);\n\n\t// Vue composable HMR state tracking: wrap exported use* functions\n\t// so ref values are captured and restored across HMR reloads.\n\tif (!vueDir || !filePath.startsWith(vueDir) || !isTS) return transpiled;\n\n\tconst useExports = valueExports.filter((e) => e.startsWith('use'));\n\tif (useExports.length === 0) return transpiled;\n\n\treturn injectComposableTracking(transpiled, filePath, useExports);\n};\n\n// Classify a character for brace-counting: returns the new string\n// context and whether to skip further processing.\nconst classifyChar = (\n\tchar: string,\n\tprevChar: string,\n\tinString: string | false\n): { nextString: string | false; skip: boolean } => {\n\tif (inString) {\n\t\tconst closed = char === inString && prevChar !== '\\\\';\n\n\t\treturn { nextString: closed ? false : inString, skip: true };\n\t}\n\tif (char === '\"' || char === \"'\" || char === '`')\n\t\treturn { nextString: char, skip: true };\n\n\treturn { nextString: false, skip: false };\n};\n\n// Find the end of a function expression by counting braces/parens,\n// skipping string literals. Returns the index of the trailing ';'.\nconst findFunctionEnd = (source: string, startPos: number) => {\n\tlet depth = 0;\n\tlet inString: string | false = false;\n\tfor (let idx = startPos; idx < source.length; idx++) {\n\t\tconst char = source[idx] ?? '';\n\t\tconst classified = classifyChar(char, source[idx - 1] ?? '', inString);\n\t\tinString = classified.nextString;\n\t\tif (classified.skip) continue;\n\n\t\tif (char === '{' || char === '(') depth++;\n\t\tif (char === '}' || char === ')') depth--;\n\t\tif (depth === 0 && char === ';') return idx;\n\t}\n\n\treturn startPos;\n};\n\n/** Inject HMR state tracking into Vue composable exports.\n * Wraps each use* export to capture/restore ref values across reloads. */\nconst injectComposableTracking = (\n\tcode: string,\n\tfilePath: string,\n\tuseExports: string[]\n) => {\n\tconst moduleId = JSON.stringify(filePath);\n\n\t// Inject the tracking runtime at the top\n\tconst runtime = [\n\t\t`var __hmr_cs = (globalThis.__HMR_COMPOSABLE_STATE__ ??= {});`,\n\t\t`var __hmr_mid = ${moduleId};`,\n\t\t`var __hmr_prev_refs = __hmr_cs[__hmr_mid];`,\n\t\t`var __hmr_idx = {};`,\n\t\t`__hmr_cs[__hmr_mid] = {};`,\n\t\t`function __hmr_wrap(name, fn) {`,\n\t\t` return function() {`,\n\t\t` var idx = (__hmr_idx[name] = (__hmr_idx[name] ?? -1) + 1);`,\n\t\t` var result = fn.apply(this, arguments);`,\n\t\t` if (result && typeof result === \"object\") {`,\n\t\t` var refs = {};`,\n\t\t` for (var k in result) {`,\n\t\t` var v = result[k];`,\n\t\t` if (v && typeof v === \"object\" && \"value\" in v && !v.effect && typeof v.value !== \"function\") {`,\n\t\t` refs[k] = v;`,\n\t\t` }`,\n\t\t` }`,\n\t\t` (__hmr_cs[__hmr_mid][name] ??= [])[idx] = refs;`,\n\t\t` if (__hmr_prev_refs && __hmr_prev_refs[name] && __hmr_prev_refs[name][idx]) {`,\n\t\t` var old = __hmr_prev_refs[name][idx];`,\n\t\t` for (var k in old) {`,\n\t\t` var nv = result[k];`,\n\t\t` var ov = old[k];`,\n\t\t` if (nv && ov && typeof nv === \"object\" && \"value\" in nv && !nv.effect && typeof nv.value === typeof ov.value) {`,\n\t\t` nv.value = ov.value;`,\n\t\t` }`,\n\t\t` }`,\n\t\t` }`,\n\t\t` }`,\n\t\t` return result;`,\n\t\t` };`,\n\t\t`}`\n\t].join('\\n');\n\n\tlet result = `${runtime}\\n${code}`;\n\n\t// Wrap each use* export with __hmr_wrap.\n\t// Find the export assignment, then use brace/paren counting to locate\n\t// the end of the function expression (handles nested braces in the body).\n\tfor (const name of useExports) {\n\t\tresult = wrapComposableExport(result, name);\n\t}\n\n\treturn result;\n};\n\n// Find and wrap a single use* export with __hmr_wrap().\nconst wrapComposableExport = (source: string, name: string) => {\n\tconst marker = new RegExp(\n\t\t`export\\\\s+(?:const|var|let)\\\\s+${name}\\\\s*=\\\\s*`\n\t);\n\tconst match = marker.exec(source);\n\tif (!match) return source;\n\n\tconst insertPos = match.index + match[0].length;\n\tconst endPos = findFunctionEnd(source, insertPos);\n\tconst funcBody = source.slice(insertPos, endPos);\n\n\treturn `${source.slice(0, insertPos)}__hmr_wrap(${JSON.stringify(name)}, ${funcBody})${source.slice(endPos)}`;\n};\n\n// Virtual CSS modules for Svelte's css:'external' mode.\n// Keyed by fake path (e.g., /path/to/Counter.svelte.css).\nconst svelteExternalCss = new Map<string, string>();\n\n// ─── Framework-specific transforms (Svelte, Vue) ────────────\n// Cached compiler references — avoid re-importing on every request.\n// Pre-set via warmCompilers() at startup to eliminate first-edit spike.\nlet svelteCompiler: typeof import('svelte/compiler') | null = null;\nlet vueCompiler: typeof import('@vue/compiler-sfc') | null = null;\n\nconst getLoadedSvelteCompiler = () => {\n\tif (!svelteCompiler) throw new Error('Svelte compiler is not loaded.');\n\n\treturn svelteCompiler;\n};\n\nconst getLoadedVueCompiler = () => {\n\tif (!vueCompiler) throw new Error('Vue compiler is not loaded.');\n\n\treturn vueCompiler;\n};\n\nexport const warmCompilers = async (frameworks: {\n\tsvelte?: boolean;\n\tvue?: boolean;\n}) => {\n\tconst [svelteModule, vueModule] = await Promise.all([\n\t\tframeworks.svelte ? import('svelte/compiler') : undefined,\n\t\tframeworks.vue ? import('@vue/compiler-sfc') : undefined\n\t]);\n\tif (svelteModule) {\n\t\tsvelteCompiler = svelteModule;\n\t\t// JIT-warm the compile function with a trivial component so\n\t\t// the first real HMR compile doesn't pay the JIT cost (~60ms).\n\t\tsvelteModule.compile('<script>let x=$state(0)</script>{x}', {\n\t\t\tcss: 'external',\n\t\t\tdev: true,\n\t\t\tfilename: '_warm.svelte',\n\t\t\tgenerate: 'client',\n\t\t\thmr: true\n\t\t});\n\t}\n\tif (!vueModule) return;\n\n\tvueCompiler = vueModule;\n\t// Same for Vue — warm compileScript + compileTemplate\n\tconst { descriptor } = vueModule.parse(\n\t\t'<script setup>const x=1</script><template>{{x}}</template>',\n\t\t{ filename: '_warm.vue' }\n\t);\n\tvueModule.compileScript(descriptor, { id: 'w', inlineTemplate: false });\n\tif (!descriptor.template) return;\n\n\tvueModule.compileTemplate({\n\t\tfilename: '_warm.vue',\n\t\tid: 'w',\n\t\tsource: descriptor.template.content\n\t});\n};\n\n// Compile a .svelte.ts module file — transpile TS, then compileModule.\nconst compileSvelteModule = (raw: string, filePath: string) => {\n\tconst compiler = getLoadedSvelteCompiler();\n\tconst source = tsTranspiler.transformSync(raw);\n\n\treturn compiler.compileModule(source, {\n\t\tdev: true,\n\t\tfilename: filePath\n\t}).js.code;\n};\n\n// Compile a .svelte component file — hmr: true, css: 'external'.\nconst compileSvelteComponent = (\n\traw: string,\n\tfilePath: string,\n\tprojectRoot: string,\n\tenableAsync = false\n) => {\n\tconst compiler = getLoadedSvelteCompiler();\n\tconst compiled = compiler.compile(raw, {\n\t\tcss: 'external',\n\t\tdev: true,\n\t\texperimental: {\n\t\t\tasync: enableAsync\n\t\t},\n\t\tfilename: filePath,\n\t\tgenerate: 'client',\n\t\thmr: true\n\t});\n\tlet { code } = compiled.js;\n\n\t// If the component has styles, inject them as a virtual CSS\n\t// import. The handleCssRequest handler serves it as a <style>.\n\tif (compiled.css?.code) {\n\t\tconst cssPath = `${filePath}.css`;\n\t\tsvelteExternalCss.set(cssPath, compiled.css.code);\n\t\tconst cssUrl = srcUrl(relative(projectRoot, cssPath), projectRoot);\n\t\tcode = `import \"${cssUrl}\";\\n${code}`;\n\t}\n\n\t// ── import.meta.hot → accept registry ──\n\tconst moduleUrl = `${SRC_PREFIX}${relative(projectRoot, filePath).replace(/\\\\/g, '/')}`;\n\tcode = code.replace(\n\t\t/if\\s*\\(import\\.meta\\.hot\\)\\s*\\{/,\n\t\t`if (typeof window !== \"undefined\") {\\n` +\n\t\t\t` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};\\n` +\n\t\t\t` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`\n\t);\n\n\treturn code.replace(/import\\.meta\\.hot\\.accept\\(/g, '__hmr_accept(');\n};\n\n// Compile .svelte files to client JS using svelte/compiler.\n// Keeps .svelte extensions in imports so the module server handles children.\nconst transformSvelteFile = async (\n\tfilePath: string,\n\tprojectRoot: string,\n\trewriter: ReturnType<typeof buildImportRewriter>,\n\tstylePreprocessors?: StylePreprocessorConfig\n) => {\n\tconst raw = readFileSync(filePath, 'utf-8');\n\n\tif (!svelteCompiler) {\n\t\tsvelteCompiler = await import('svelte/compiler');\n\t}\n\n\tconst isModule =\n\t\tfilePath.endsWith('.svelte.ts') || filePath.endsWith('.svelte.js');\n\tconst loweredAwaitSource = isModule\n\t\t? { code: raw, transformed: false }\n\t\t: lowerSvelteAwaitSlotSyntax(raw);\n\tconst loweredSource = isModule\n\t\t? loweredAwaitSource\n\t\t: lowerSvelteIslandSyntax(loweredAwaitSource.code, 'client');\n\tconst source = isModule\n\t\t? loweredSource.code\n\t\t: (\n\t\t\t\tawait svelteCompiler.preprocess(\n\t\t\t\t\tloweredSource.code,\n\t\t\t\t\tcreateSvelteStylePreprocessor(stylePreprocessors)\n\t\t\t\t)\n\t\t\t).code;\n\tconst enableAsync =\n\t\tloweredAwaitSource.transformed || loweredSource.transformed;\n\n\tconst code = isModule\n\t\t? compileSvelteModule(source, filePath)\n\t\t: compileSvelteComponent(source, filePath, projectRoot, enableAsync);\n\n\treturn rewriteImports(code, filePath, projectRoot, rewriter);\n};\n\ntype VueSFCDescriptor = SFCDescriptor;\n\ntype VueSFCCompiledScript = {\n\tbindings: BindingMetadata;\n\tcontent: string;\n};\n\n// Compile a Vue SFC template and attach the render function to the script.\nconst compileVueTemplate = (\n\tdescriptor: VueSFCDescriptor,\n\tcompiledScript: VueSFCCompiledScript,\n\tfilePath: string,\n\tcomponentId: string\n) => {\n\tconst compiler = getLoadedVueCompiler();\n\tconst scriptContent = compiledScript.content;\n\tif (!descriptor.template) return scriptContent;\n\n\tconst isScoped = descriptor.styles.some((style) => style.scoped);\n\tconst templateResult = compiler.compileTemplate({\n\t\tcompilerOptions: {\n\t\t\tbindingMetadata: compiledScript.bindings,\n\t\t\tprefixIdentifiers: true\n\t\t},\n\t\tfilename: filePath,\n\t\tid: componentId,\n\t\tscoped: isScoped,\n\t\tsource: descriptor.template.content\n\t});\n\n\tlet code = scriptContent.replace('export default', 'const __script__ =');\n\tcode += `\\n${templateResult.code}`;\n\tcode += '\\n__script__.render = render;';\n\tcode += '\\nexport default __script__;';\n\n\treturn code;\n};\n\n// Compile and inject scoped CSS as inline <style> for a Vue SFC.\nconst compileVueStyles = async (\n\tdescriptor: VueSFCDescriptor,\n\tfilePath: string,\n\tcomponentId: string,\n\tcode: string,\n\tstylePreprocessors?: StylePreprocessorConfig\n) => {\n\tif (descriptor.styles.length === 0) return code;\n\n\tconst compiler = getLoadedVueCompiler();\n\tconst cssCode = (\n\t\tawait Promise.all(\n\t\t\tdescriptor.styles.map(\n\t\t\t\tasync (style) =>\n\t\t\t\t\tcompiler.compileStyle({\n\t\t\t\t\t\tfilename: filePath,\n\t\t\t\t\t\tid: `data-v-${componentId}`,\n\t\t\t\t\t\tscoped: Boolean(style.scoped),\n\t\t\t\t\t\tsource: style.lang\n\t\t\t\t\t\t\t? await compileStyleSource(\n\t\t\t\t\t\t\t\t\tfilePath,\n\t\t\t\t\t\t\t\t\tstyle.content,\n\t\t\t\t\t\t\t\t\tstyle.lang,\n\t\t\t\t\t\t\t\t\tstylePreprocessors\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: style.content,\n\t\t\t\t\t\ttrim: true\n\t\t\t\t\t}).code\n\t\t\t)\n\t\t)\n\t).join('\\n');\n\n\tconst escaped = cssCode\n\t\t.replace(/\\\\/g, '\\\\\\\\')\n\t\t.replace(/`/g, '\\\\`')\n\t\t.replace(/\\$/g, '\\\\$');\n\tconst hmrId = JSON.stringify(filePath);\n\tconst cssInjection = [\n\t\t`var __style=document.createElement('style');`,\n\t\t`__style.textContent=\\`${escaped}\\`;`,\n\t\t`__style.dataset.hmrId=${hmrId};`,\n\t\t`var __prev=document.querySelector('style[data-hmr-id=\"${filePath}\"]');`,\n\t\t`if(__prev)__prev.remove();`,\n\t\t`document.head.appendChild(__style);`\n\t].join('');\n\n\treturn `${cssInjection}\\n${code}`;\n};\n\n// Compile .vue SFC files to client JS using @vue/compiler-sfc.\nconst transformVueFile = async (\n\tfilePath: string,\n\tprojectRoot: string,\n\trewriter: ReturnType<typeof buildImportRewriter>,\n\tvueDir?: string,\n\tstylePreprocessors?: StylePreprocessorConfig\n) => {\n\tconst raw = readFileSync(filePath, 'utf-8');\n\n\tif (!vueCompiler) {\n\t\tvueCompiler = await import('@vue/compiler-sfc');\n\t}\n\n\tconst fileName = basename(filePath, '.vue');\n\tconst componentId = fileName.toLowerCase();\n\tconst { descriptor } = vueCompiler.parse(raw, { filename: filePath });\n\n\tconst compiledScript = vueCompiler.compileScript(descriptor, {\n\t\tid: componentId,\n\t\tinlineTemplate: false\n\t});\n\tconst compiledSfcScript: VueSFCCompiledScript = {\n\t\tbindings: compiledScript.bindings ?? {},\n\t\tcontent: compiledScript.content\n\t};\n\n\tlet code = compileVueTemplate(\n\t\tdescriptor,\n\t\tcompiledSfcScript,\n\t\tfilePath,\n\t\tcomponentId\n\t);\n\tcode = await compileVueStyles(\n\t\tdescriptor,\n\t\tfilePath,\n\t\tcomponentId,\n\t\tcode,\n\t\tstylePreprocessors\n\t);\n\n\t// Vue's compileScript strips user TypeScript but the generated\n\t// wrapper code still has `: any` annotations (e.g. __props: any,\n\t// _ctx: any). Run through the TS transpiler to strip those.\n\tcode = tsTranspiler.transformSync(code);\n\n\t// Inject Vue HMR — use rerender() to preserve reactive state.\n\t// rerender() only swaps the render function (like React Fast Refresh).\n\t// reload() would reset state by re-running setup().\n\tcode = injectVueHmr(code, filePath, projectRoot, vueDir);\n\n\treturn rewriteImports(code, filePath, projectRoot, rewriter);\n};\n\n// Inject Vue HMR runtime registration and rerender call.\nconst injectVueHmr = (\n\tcode: string,\n\tfilePath: string,\n\tprojectRoot: string,\n\tvueDir?: string\n) => {\n\tconst hmrBase = vueDir ? resolve(vueDir) : projectRoot;\n\tconst hmrId = relative(hmrBase, filePath)\n\t\t.replace(/\\\\/g, '/')\n\t\t.replace(/\\.vue$/, '');\n\tlet result = code.replace(/export\\s+default\\s+/, 'var __hmr_comp__ = ');\n\tresult += [\n\t\t'',\n\t\t`__hmr_comp__.__hmrId = ${JSON.stringify(hmrId)};`,\n\t\t`if (typeof __VUE_HMR_RUNTIME__ !== \"undefined\") {`,\n\t\t` __VUE_HMR_RUNTIME__.createRecord(${JSON.stringify(hmrId)}, __hmr_comp__);`,\n\t\t` __VUE_HMR_RUNTIME__.rerender(${JSON.stringify(hmrId)}, __hmr_comp__.render);`,\n\t\t`}`,\n\t\t'export default __hmr_comp__;'\n\t].join('\\n');\n\n\treturn result;\n};\n\n// Resolve .svelte module files that may exist as .svelte.ts or .svelte.js\nconst resolveSvelteModulePath = (path: string) => {\n\tif (existsSync(path)) return path;\n\tif (existsSync(`${path}.ts`)) return `${path}.ts`;\n\tif (existsSync(`${path}.js`)) return `${path}.js`;\n\n\treturn path;\n};\n\n// Shared response builder for transformed modules\nconst jsResponse = (body: string) => {\n\tconst etag = `\"${Bun.hash(body).toString(BASE_36_RADIX)}\"`;\n\n\treturn new Response(body, {\n\t\theaders: {\n\t\t\t'Cache-Control': 'no-cache',\n\t\t\t'Content-Type': 'application/javascript',\n\t\t\tETag: etag\n\t\t}\n\t});\n};\n\nconst handleCssRequest = (filePath: string) => {\n\tconst raw = readFileSync(filePath, 'utf-8');\n\tconst escaped = raw\n\t\t.replace(/\\\\/g, '\\\\\\\\')\n\t\t.replace(/`/g, '\\\\`')\n\t\t.replace(/\\$/g, '\\\\$');\n\n\treturn [\n\t\t`const style = document.createElement('style');`,\n\t\t`style.textContent = \\`${escaped}\\`;`,\n\t\t`style.dataset.hmrId = ${JSON.stringify(filePath)};`,\n\t\t`const existing = document.querySelector(\\`style[data-hmr-id=\"${filePath}\"]\\`);`,\n\t\t`if (existing) existing.remove();`,\n\t\t`document.head.appendChild(style);`\n\t].join('\\n');\n};\n\n// Generate HMR bootstrap wrapper for Svelte.\n// Uses dynamic import() with a cache-busting timestamp so the\n// browser fetches the freshly compiled component every time.\nconst generateSvelteHmrBootstrap = (\n\tmoduleUrl: string,\n\tvendorPaths: Record<string, string>,\n\ttimestamp: string\n) => {\n\tconst sveltePath = vendorPaths['svelte'] || '/svelte/vendor/svelte.js';\n\n\treturn [\n\t\t`import { mount, unmount } from \"${sveltePath}\";`,\n\t\t`const { default: Component } = await import(\"${moduleUrl}?t=${timestamp}\");`,\n\t\t``,\n\t\t`// Extract count from DOM before unmount (survives across runtime instances)`,\n\t\t`var countBtn = document.querySelector(\"button\");`,\n\t\t`var countMatch = countBtn && countBtn.textContent && countBtn.textContent.match(/(\\\\d+)/);`,\n\t\t`var domCount = countMatch ? parseInt(countMatch[1], 10) : null;`,\n\t\t``,\n\t\t`var preservedState = window.__HMR_PRESERVED_STATE__ || {};`,\n\t\t`if (domCount !== null && preservedState.initialCount === undefined) {`,\n\t\t` preservedState.initialCount = domCount;`,\n\t\t`}`,\n\t\t`var initialProps = window.__INITIAL_PROPS__ || {};`,\n\t\t`var mergedProps = Object.assign({}, initialProps, preservedState);`,\n\t\t``,\n\t\t`// Update __INITIAL_PROPS__ so subsequent HMR cycles start with current state`,\n\t\t`if (domCount !== null) window.__INITIAL_PROPS__ = Object.assign({}, initialProps, { initialCount: domCount });`,\n\t\t``,\n\t\t`if (typeof window.__SVELTE_UNMOUNT__ === \"function\") {`,\n\t\t` try { window.__SVELTE_UNMOUNT__(); } catch (err) { /* ignore */ }`,\n\t\t`}`,\n\t\t``,\n\t\t`var target = document.getElementById(\"__absolute_svelte_root__\") || document.body;`,\n\t\t`var component = mount(Component, { target, props: mergedProps });`,\n\t\t`window.__SVELTE_COMPONENT__ = component;`,\n\t\t`window.__SVELTE_UNMOUNT__ = function() { unmount(component); };`,\n\t\t`window.__HMR_PRESERVED_STATE__ = undefined;`\n\t].join('\\n');\n};\n\n// Generate HMR bootstrap wrapper for Vue.\n// Same approach as Svelte — full remount via vendor Vue's createApp.\nconst generateVueHmrBootstrap = (\n\tmoduleUrl: string,\n\tvendorPaths: Record<string, string>,\n\ttimestamp: string\n) => {\n\tconst vuePath = vendorPaths['vue'] || '/vue/vendor/vue.js';\n\n\treturn [\n\t\t`import { createApp } from \"${vuePath}\";`,\n\t\t`const { default: Component } = await import(\"${moduleUrl}?t=${timestamp}\");`,\n\t\t``,\n\t\t`// Extract count from DOM before unmount (works across Vue instances)`,\n\t\t`var countBtn = document.querySelector(\"button\");`,\n\t\t`var countMatch = countBtn && countBtn.textContent && countBtn.textContent.match(/(\\\\d+)/);`,\n\t\t`var domCount = countMatch ? parseInt(countMatch[1], 10) : null;`,\n\t\t``,\n\t\t`var preservedState = window.__HMR_PRESERVED_STATE__ || {};`,\n\t\t`if (domCount !== null && preservedState.initialCount === undefined) {`,\n\t\t` preservedState.initialCount = domCount;`,\n\t\t`}`,\n\t\t`var initialProps = window.__INITIAL_PROPS__ || {};`,\n\t\t`var mergedProps = Object.assign({}, initialProps, preservedState);`,\n\t\t``,\n\t\t`// Update __INITIAL_PROPS__ so subsequent HMR cycles start with current state`,\n\t\t`if (domCount !== null) window.__INITIAL_PROPS__ = Object.assign({}, initialProps, { initialCount: domCount });`,\n\t\t``,\n\t\t`var root = document.getElementById(\"root\");`,\n\t\t`var savedHTML = root ? root.innerHTML : \"\";`,\n\t\t`if (window.__VUE_APP__) {`,\n\t\t` window.__VUE_APP__.unmount();`,\n\t\t` window.__VUE_APP__ = null;`,\n\t\t`}`,\n\t\t`if (root) root.innerHTML = savedHTML;`,\n\t\t``,\n\t\t`var app = createApp(Component, mergedProps);`,\n\t\t`app.mount(root);`,\n\t\t`window.__VUE_APP__ = app;`,\n\t\t`window.__HMR_PRESERVED_STATE__ = undefined;`\n\t].join('\\n');\n};\n\n// Generate a stub module for a server-only package so browser imports resolve.\nconst handleStubRequest = async (pathname: string) => {\n\tconst specifier = decodeURIComponent(pathname.slice('/@stub/'.length));\n\tconst stubCode = await buildStubCode(specifier);\n\n\treturn new Response(stubCode, {\n\t\theaders: {\n\t\t\t'Cache-Control': 'no-cache',\n\t\t\t'Content-Type': 'application/javascript'\n\t\t}\n\t});\n};\n\n// Introspect a module's exports and generate noop stubs for each.\nconst buildStubCode = async (specifier: string) => {\n\ttry {\n\t\tconst mod = await import(specifier);\n\t\tconst names = Object.keys(mod).filter(\n\t\t\t(key) => key !== 'default' && key !== '__esModule'\n\t\t);\n\t\tif (names.length === 0) return 'export default {};\\n';\n\n\t\tconst noops = names\n\t\t\t.map((n) => `export const ${n} = () => {};`)\n\t\t\t.join('\\n');\n\n\t\treturn `${noops}\\nexport default {};\\n`;\n\t} catch {\n\t\treturn 'export default {};\\n';\n\t}\n};\n\n// Handle HMR bootstrap wrappers for non-React frameworks.\nconst handleHmrBootstrap = (\n\tpathname: string,\n\tvendorPaths: Record<string, string>\n) => {\n\tconst rest = pathname.slice('/@hmr/'.length);\n\tconst slashIdx = rest.indexOf('/');\n\tif (slashIdx === UNFOUND_INDEX) return undefined;\n\n\tconst framework = rest.slice(0, slashIdx);\n\tconst componentRelPath = rest.slice(slashIdx + 1);\n\tconst url = `${SRC_PREFIX}${componentRelPath}`;\n\tconst timestamp = String(Date.now());\n\n\tconst generators: Record<string, typeof generateSvelteHmrBootstrap> = {\n\t\tsvelte: generateSvelteHmrBootstrap,\n\t\tvue: generateVueHmrBootstrap\n\t};\n\tconst generate = generators[framework];\n\tif (!generate) return undefined;\n\n\treturn jsResponse(generate(url, vendorPaths, timestamp));\n};\n\n// Serve a virtual Svelte CSS module (css:'external' output).\nconst handleVirtualSvelteCss = (cssCheckPath: string) => {\n\tconst virtualCss = svelteExternalCss.get(cssCheckPath);\n\tif (!virtualCss) return undefined;\n\n\tconst escaped = virtualCss\n\t\t.replace(/\\\\/g, '\\\\\\\\')\n\t\t.replace(/`/g, '\\\\`')\n\t\t.replace(/\\$/g, '\\\\$');\n\n\treturn jsResponse(\n\t\t`var s=document.createElement('style');` +\n\t\t\t`s.textContent=\\`${escaped}\\`;` +\n\t\t\t`s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};` +\n\t\t\t`var p=document.querySelector('style[data-svelte-hmr=\"${cssCheckPath}\"]');` +\n\t\t\t`if(p)p.remove();` +\n\t\t\t`document.head.appendChild(s);`\n\t);\n};\n\n// Resolve a /@src/ path to an absolute file path and extension,\n// probing known extensions if the path has none.\nconst resolveSourcePath = (relPath: string, projectRoot: string) => {\n\tconst filePath = resolve(projectRoot, relPath);\n\tconst ext = extname(filePath);\n\n\tif (ext === '.svelte')\n\t\treturn { ext, filePath: resolveSvelteModulePath(filePath) };\n\tif (ext) return { ext, filePath };\n\n\t// No extension — probe known extensions\n\tconst found = MODULE_EXTENSIONS.find((candidate) =>\n\t\texistsSync(filePath + candidate)\n\t);\n\tif (!found) return { ext, filePath };\n\n\tconst resolved = filePath + found;\n\tif (found === '.svelte')\n\t\treturn { ext: found, filePath: resolveSvelteModulePath(resolved) };\n\n\treturn { ext: found, filePath: resolved };\n};\n\n// Transform and cache a source file, returning a JS Response.\nconst transformAndCache = async (\n\tfilePath: string,\n\text: string,\n\tprojectRoot: string,\n\trewriter: ReturnType<typeof buildImportRewriter>,\n\tvueDir?: string,\n\tstylePreprocessors?: StylePreprocessorConfig\n) => {\n\tif (ext === '.css') return jsResponse(handleCssRequest(filePath));\n\n\tconst isSvelte =\n\t\text === '.svelte' ||\n\t\tfilePath.endsWith('.svelte.ts') ||\n\t\tfilePath.endsWith('.svelte.js');\n\n\tconst cached = getTransformed(filePath);\n\tif (cached) return jsResponse(cached);\n\n\tif (isSvelte)\n\t\treturn transformAndCacheSvelte(\n\t\t\tfilePath,\n\t\t\tprojectRoot,\n\t\t\trewriter,\n\t\t\tstylePreprocessors\n\t\t);\n\tif (ext === '.vue')\n\t\treturn transformAndCacheVue(\n\t\t\tfilePath,\n\t\t\tprojectRoot,\n\t\t\trewriter,\n\t\t\tvueDir,\n\t\t\tstylePreprocessors\n\t\t);\n\tif (!TRANSPILABLE.has(ext)) return undefined;\n\n\tconst stat = statSync(filePath);\n\tconst resolvedVueDir = vueDir ? resolve(vueDir) : undefined;\n\tconst content = REACT_EXTENSIONS.has(ext)\n\t\t? transformReactFile(filePath, projectRoot, rewriter)\n\t\t: transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);\n\n\tsetTransformed(\n\t\tfilePath,\n\t\tcontent,\n\t\tstat.mtimeMs,\n\t\textractImportedFiles(content, projectRoot)\n\t);\n\n\treturn jsResponse(content);\n};\n\nconst transformAndCacheSvelte = async (\n\tfilePath: string,\n\tprojectRoot: string,\n\trewriter: ReturnType<typeof buildImportRewriter>,\n\tstylePreprocessors?: StylePreprocessorConfig\n) => {\n\tconst stat = statSync(filePath);\n\tconst content = await transformSvelteFile(\n\t\tfilePath,\n\t\tprojectRoot,\n\t\trewriter,\n\t\tstylePreprocessors\n\t);\n\tsetTransformed(\n\t\tfilePath,\n\t\tcontent,\n\t\tstat.mtimeMs,\n\t\textractImportedFiles(content, projectRoot)\n\t);\n\n\treturn jsResponse(content);\n};\n\nconst transformAndCacheVue = async (\n\tfilePath: string,\n\tprojectRoot: string,\n\trewriter: ReturnType<typeof buildImportRewriter>,\n\tvueDir?: string,\n\tstylePreprocessors?: StylePreprocessorConfig\n) => {\n\tconst stat = statSync(filePath);\n\tconst content = await transformVueFile(\n\t\tfilePath,\n\t\tprojectRoot,\n\t\trewriter,\n\t\tvueDir,\n\t\tstylePreprocessors\n\t);\n\tsetTransformed(\n\t\tfilePath,\n\t\tcontent,\n\t\tstat.mtimeMs,\n\t\textractImportedFiles(content, projectRoot)\n\t);\n\n\treturn jsResponse(content);\n};\n\n// Build a transform-error response for the browser console.\nconst transformErrorResponse = (err: unknown) => {\n\tconst errMsg = err instanceof Error ? err.message : String(err);\n\n\treturn new Response(\n\t\t`console.error('[ModuleServer] Transform error:', ${JSON.stringify(errMsg)});`,\n\t\t{\n\t\t\theaders: { 'Content-Type': 'application/javascript' },\n\t\t\tstatus: 500\n\t\t}\n\t);\n};\n\nexport const createModuleServer = (config: ModuleServerConfig) => {\n\tconst { projectRoot, vendorPaths, frameworkDirs, stylePreprocessors } =\n\t\tconfig;\n\tconst rewriter = buildImportRewriter(vendorPaths);\n\n\treturn async (pathname: string) => {\n\t\tif (pathname.startsWith('/@stub/')) return handleStubRequest(pathname);\n\t\tif (pathname.startsWith('/@hmr/'))\n\t\t\treturn handleHmrBootstrap(pathname, vendorPaths);\n\t\tif (!pathname.startsWith(SRC_PREFIX)) return undefined;\n\n\t\tconst relPath = pathname.slice(SRC_PREFIX.length);\n\n\t\tconst virtualCssResponse = handleVirtualSvelteCss(\n\t\t\tresolve(projectRoot, relPath)\n\t\t);\n\t\tif (virtualCssResponse) return virtualCssResponse;\n\n\t\tconst { filePath, ext } = resolveSourcePath(relPath, projectRoot);\n\n\t\ttry {\n\t\t\treturn await transformAndCache(\n\t\t\t\tfilePath,\n\t\t\t\text,\n\t\t\t\tprojectRoot,\n\t\t\t\trewriter,\n\t\t\t\tframeworkDirs?.vue,\n\t\t\t\tstylePreprocessors\n\t\t\t);\n\t\t} catch (err) {\n\t\t\treturn transformErrorResponse(err);\n\t\t}\n\t};\n};\n\n// Extract absolute file paths from /@src/ imports in transformed code.\n// Used to build the runtime module graph for chain invalidation.\nconst SRC_IMPORT_RE = /\\/@src\\/([^\"'?\\s]+)/g;\nconst extractImportedFiles = (content: string, projectRoot: string) => {\n\tconst files: string[] = [];\n\tlet match;\n\tSRC_IMPORT_RE.lastIndex = 0;\n\twhile ((match = SRC_IMPORT_RE.exec(content)) !== null) {\n\t\tif (match[1]) files.push(resolve(projectRoot, match[1]));\n\t}\n\n\treturn files;\n};\n\nexport const invalidateModule = (filePath: string) => {\n\t// invalidate() cascades up the import chain — clearing transform\n\t// caches for all transitive importers so they get re-transpiled\n\t// with fresh ?v= params. Also clear mtime caches for the changed\n\t// file so srcUrl() re-reads its mtime from disk.\n\tconst resolved = resolve(filePath);\n\tinvalidate(filePath);\n\tif (resolved !== filePath) invalidate(resolved);\n\tmtimeCache.delete(filePath);\n\tmtimeCache.delete(resolved);\n\t// Note: we only clear mtime for the changed file. Importers'\n\t// mtimes haven't changed — their transform caches are cleared\n\t// by invalidate() so they get re-transpiled with new ?v= for\n\t// the changed file's updated mtime.\n};\n\n// Pre-transpile a /@src/ URL and cache the result so the browser\n// fetch is instant. Called before sending the WebSocket HMR message.\nexport const warmCache = (pathname: string) => {\n\tif (!pathname.startsWith(SRC_PREFIX)) return;\n\tif (!globalModuleServer) return;\n\t// Trigger the handler — the result is cached by setTransformed\n\tglobalModuleServer(pathname);\n};\n\n// Store the module server handler globally so warmCache can access it\nlet globalModuleServer:\n\t| ((\n\t\t\tpathname: string\n\t ) => Promise<Response | undefined> | Response | undefined)\n\t| null = null;\n\nexport const SRC_URL_PREFIX = SRC_PREFIX;\n\nexport const setGlobalModuleServer = (handler: typeof globalModuleServer) => {\n\tglobalModuleServer = handler;\n};\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AAkBA,IAAM,aAAa;AAEnB,IAAM,eAAe,IAAI,IAAI,WAAW;AAAA,EACvC,QAAQ;AAAA,EACR,mBAAmB;AACpB,CAAC;AAMD,IAAM,eAAe,IAAI,IAAI,WAAW;AAAA,EACvC,QAAQ;AAAA,EACR,mBAAmB;AACpB,CAAC;AAED,IAAM,gBAAgB,IAAI,IAAI,WAAW;AAAA,EACxC,QAAQ;AAAA,EACR,mBAAmB;AACpB,CAAC;AAED,IAAM,eAAe,IAAI,IAAI,CAAC,OAAO,QAAQ,OAAO,QAAQ,MAAM,CAAC;AAGnE,IAAM,iBACL;AAID,IAAM,qBACL;AAID,IAAM,sBAAsB,CAC3B,gBACA,YACA,iBACI;AAAA,EACJ,MAAM,WAAW,eAAe,QAAQ,oBAAoB,IAAI;AAAA,EAChE,MAAM,aAAuB,CAAC;AAAA,EAC9B,IAAI;AAAA,EACJ,eAAe,YA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;AAAA,EACjC,WAAW,QAAQ;AAAA,EACnB,IAAI,aAAa;AAAA,IAAU,WAAW,QAAQ;AAAA,EAC9C,WAAW,OAAO,QAAQ;AAAA,EAC1B,WAAW,OAAO,QAAQ;AAAA;AASpB,IAAM,YAAY,CAAC,aAAqB;AAAA,EAC9C,IAAI,CAAC,SAAS,WAAW,UAAU;AAAA,IAAG;AAAA,EACtC,IAAI,CAAC;AAAA,IAAoB;AAAA,EAEzB,mBAAmB,QAAQ;AAAA;AAI5B,IAAI,qBAIM;AAEH,IAAM,iBAAiB;AAEvB,IAAM,wBAAwB,CAAC,YAAuC;AAAA,EAC5E,qBAAqB;AAAA;",
|
|
8
|
+
"debugId": "518E604077F8CEC164756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
toPascal
|
|
4
|
+
} from "./chunk-p5504p14.js";
|
|
5
|
+
|
|
6
|
+
// src/build/generateReactIndexes.ts
|
|
7
|
+
import { existsSync, mkdirSync } from "fs";
|
|
8
|
+
import { readdir, rm, writeFile } from "fs/promises";
|
|
9
|
+
import { basename, join, relative, resolve, sep } from "path";
|
|
10
|
+
var {Glob } = globalThis.Bun;
|
|
11
|
+
var indexContentCache = new Map;
|
|
12
|
+
var resolveDevClientDir = () => {
|
|
13
|
+
const projectRoot = process.cwd();
|
|
14
|
+
const fromSource = resolve(import.meta.dir, "../dev/client");
|
|
15
|
+
if (existsSync(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
16
|
+
return fromSource;
|
|
17
|
+
}
|
|
18
|
+
const fromNodeModules = resolve(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
19
|
+
if (existsSync(fromNodeModules))
|
|
20
|
+
return fromNodeModules;
|
|
21
|
+
return resolve(import.meta.dir, "./dev/client");
|
|
22
|
+
};
|
|
23
|
+
var devClientDir = resolveDevClientDir();
|
|
24
|
+
var errorOverlayPath = join(devClientDir, "errorOverlay.ts").replace(/\\/g, "/");
|
|
25
|
+
var hmrClientPath = join(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
|
|
26
|
+
var refreshSetupPath = join(devClientDir, "reactRefreshSetup.ts").replace(/\\/g, "/");
|
|
27
|
+
var generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev = false) => {
|
|
28
|
+
if (!existsSync(reactIndexesDirectory)) {
|
|
29
|
+
mkdirSync(reactIndexesDirectory, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
const CONVENTION_RE = /^(?:(.+)\.)?(error|loading|not-found)\.[^.]+$/;
|
|
32
|
+
const pagesGlob = new Glob("*.{jsx,tsx}");
|
|
33
|
+
const files = [];
|
|
34
|
+
for await (const file of pagesGlob.scan({ cwd: reactPagesDirectory })) {
|
|
35
|
+
if (CONVENTION_RE.test(file))
|
|
36
|
+
continue;
|
|
37
|
+
files.push(file);
|
|
38
|
+
}
|
|
39
|
+
const currentPageNames = new Set(files.map((file) => basename(file).split(".")[0]));
|
|
40
|
+
const emptyStringArray = [];
|
|
41
|
+
const existingIndexes = await readdir(reactIndexesDirectory).catch(() => emptyStringArray);
|
|
42
|
+
const staleIndexes = existingIndexes.filter((indexFile) => {
|
|
43
|
+
const indexName = indexFile.replace(/\.tsx$/, "");
|
|
44
|
+
return indexName !== "_refresh" && !currentPageNames.has(indexName);
|
|
45
|
+
});
|
|
46
|
+
if (staleIndexes.length > 0) {
|
|
47
|
+
await Promise.all(staleIndexes.map((indexFile) => {
|
|
48
|
+
indexContentCache.delete(join(reactIndexesDirectory, indexFile));
|
|
49
|
+
return rm(join(reactIndexesDirectory, indexFile), {
|
|
50
|
+
force: true
|
|
51
|
+
});
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
const pagesRelPath = relative(resolve(reactIndexesDirectory), resolve(reactPagesDirectory)).split(sep).join("/");
|
|
55
|
+
const promises = files.map(async (file) => {
|
|
56
|
+
const fileName = basename(file);
|
|
57
|
+
const componentName = fileName.split(".")[0];
|
|
58
|
+
const pascalComponentName = toPascal(componentName);
|
|
59
|
+
const hmrPreamble = isDev ? [
|
|
60
|
+
`window.__HMR_FRAMEWORK__ = "react";`,
|
|
61
|
+
`window.__REACT_COMPONENT_KEY__ = "${componentName}Index";`,
|
|
62
|
+
`import '${refreshSetupPath}';`,
|
|
63
|
+
`import '${hmrClientPath}';`,
|
|
64
|
+
`import { showErrorOverlay, hideErrorOverlay } from '${errorOverlayPath}';
|
|
65
|
+
`
|
|
66
|
+
] : [];
|
|
67
|
+
const reactImports = isDev ? [
|
|
68
|
+
`import { hydrateRoot, createRoot } from 'react-dom/client';`,
|
|
69
|
+
`import { createElement, Component } from 'react';`
|
|
70
|
+
] : [
|
|
71
|
+
`import { hydrateRoot, createRoot } from 'react-dom/client';`,
|
|
72
|
+
`import { createElement } from 'react';`
|
|
73
|
+
];
|
|
74
|
+
const errorBoundaryDef = isDev ? [
|
|
75
|
+
`
|
|
76
|
+
// Dev-only Error Boundary to catch React render errors`,
|
|
77
|
+
`class ErrorBoundary extends Component {`,
|
|
78
|
+
` constructor(props) {`,
|
|
79
|
+
` super(props);`,
|
|
80
|
+
` this.state = { hasError: false };`,
|
|
81
|
+
` window.__ERROR_BOUNDARY__ = this;`,
|
|
82
|
+
` }`,
|
|
83
|
+
` static getDerivedStateFromError() {`,
|
|
84
|
+
` return { hasError: true };`,
|
|
85
|
+
` }`,
|
|
86
|
+
` componentDidCatch(error) {`,
|
|
87
|
+
` showErrorOverlay({`,
|
|
88
|
+
` framework: 'react',`,
|
|
89
|
+
` kind: 'runtime',`,
|
|
90
|
+
` message: error && error.stack ? error.stack : String(error)`,
|
|
91
|
+
` });`,
|
|
92
|
+
` }`,
|
|
93
|
+
` componentDidUpdate(prevProps, prevState) {`,
|
|
94
|
+
` if (prevState.hasError && !this.state.hasError) {`,
|
|
95
|
+
` hideErrorOverlay();`,
|
|
96
|
+
` }`,
|
|
97
|
+
` }`,
|
|
98
|
+
` reset() {`,
|
|
99
|
+
` this.setState({ hasError: false });`,
|
|
100
|
+
` }`,
|
|
101
|
+
` render() {`,
|
|
102
|
+
` if (this.state.hasError) return null;`,
|
|
103
|
+
``,
|
|
104
|
+
` return this.props.children;`,
|
|
105
|
+
` }`,
|
|
106
|
+
`}
|
|
107
|
+
`
|
|
108
|
+
] : [];
|
|
109
|
+
const content = [
|
|
110
|
+
...hmrPreamble,
|
|
111
|
+
...reactImports,
|
|
112
|
+
`import * as PageModule from '${pagesRelPath}/${componentName}';
|
|
113
|
+
`,
|
|
114
|
+
...errorBoundaryDef,
|
|
115
|
+
`// Hydration with error handling and fallback`,
|
|
116
|
+
`const isDev = ${isDev};`,
|
|
117
|
+
`const componentPath = '${pagesRelPath}/${componentName}';
|
|
118
|
+
`,
|
|
119
|
+
`function resolvePageComponent(module, candidateNames) {`,
|
|
120
|
+
` for (const name of candidateNames) {`,
|
|
121
|
+
` const value = module[name];`,
|
|
122
|
+
` if (typeof value === 'function' || (value && typeof value === 'object')) return value;`,
|
|
123
|
+
` }`,
|
|
124
|
+
` for (const [name, value] of Object.entries(module)) {`,
|
|
125
|
+
` if (!/^[A-Z]/.test(name)) continue;`,
|
|
126
|
+
` if (typeof value === 'function' || (value && typeof value === 'object')) return value;`,
|
|
127
|
+
` }`,
|
|
128
|
+
` throw new Error('React page module ' + componentPath + ' does not export a component. Expected default, ${pascalComponentName}, ${componentName}, or any PascalCase export.');`,
|
|
129
|
+
`}`,
|
|
130
|
+
`const PageComponent = resolvePageComponent(PageModule, ['default', '${pascalComponentName}', '${componentName}']);
|
|
131
|
+
`,
|
|
132
|
+
`function isHydrationError(error) {`,
|
|
133
|
+
` if (!error) return false;`,
|
|
134
|
+
` const errorMessage = error instanceof Error ? error.message : String(error);`,
|
|
135
|
+
` const errorString = String(error);`,
|
|
136
|
+
` const fullMessage = errorMessage + ' ' + errorString;`,
|
|
137
|
+
` const hydrationKeywords = ['hydration', 'Hydration', 'mismatch', 'Mismatch', 'did not match', 'server rendered HTML', 'server HTML', 'client HTML', 'Hydration failed'];`,
|
|
138
|
+
` const isHydration = hydrationKeywords.some(keyword => fullMessage.includes(keyword));`,
|
|
139
|
+
` `,
|
|
140
|
+
` // Ignore whitespace-only mismatches in <head> - these are harmless formatting differences`,
|
|
141
|
+
` // The error often shows: + <link...> vs - {"\\n "} which is just formatting`,
|
|
142
|
+
` if (isHydration) {`,
|
|
143
|
+
` // Check if this is a head/link/stylesheet related mismatch`,
|
|
144
|
+
` const isHeadRelated = fullMessage.includes('<head') || fullMessage.includes('</head>') || fullMessage.includes('head>') || fullMessage.includes('<link') || fullMessage.includes('link>') || fullMessage.includes('stylesheet') || fullMessage.includes('fonts.googleapis') || fullMessage.includes('rel="stylesheet"');`,
|
|
145
|
+
` `,
|
|
146
|
+
` // Check if the mismatch involves only whitespace/newlines`,
|
|
147
|
+
` // Pattern: looks for {"\\n"} or {"\\n "} or similar whitespace-only content`,
|
|
148
|
+
` // Also check for patterns like: - {"\\n "} or + <link...>`,
|
|
149
|
+
` const hasWhitespacePattern = /\\{\\s*["']\\\\n[^"']*["']\\s*\\}/.test(fullMessage) || /\\{\\s*["'][\\\\n\\\\r\\\\s]+["']\\s*\\}/.test(fullMessage) || /-\\s*\\{\\s*["'][\\\\n\\\\r\\\\s]+["']\\s*\\}/.test(fullMessage);`,
|
|
150
|
+
` const isWhitespaceOnly = /^[\\s\\n\\r]*$/.test(errorString) || /^[\\s\\n\\r]*$/.test(errorMessage);`,
|
|
151
|
+
` const hasNewlinePattern = fullMessage.includes('\\\\n') || fullMessage.includes('\\\\r') || fullMessage.includes('\\n') || fullMessage.includes('\\r');`,
|
|
152
|
+
` `,
|
|
153
|
+
` // If it's head-related and involves whitespace/newlines, ignore it`,
|
|
154
|
+
` if (isHeadRelated && (hasWhitespacePattern || isWhitespaceOnly || hasNewlinePattern)) {`,
|
|
155
|
+
` return false; // Don't treat whitespace-only head mismatches as errors`,
|
|
156
|
+
` }`,
|
|
157
|
+
` }`,
|
|
158
|
+
` return isHydration;`,
|
|
159
|
+
`}
|
|
160
|
+
`,
|
|
161
|
+
`function logHydrationError(error, componentName) {`,
|
|
162
|
+
` if (!isDev) return;`,
|
|
163
|
+
` if (window.__HMR_WS__ && window.__HMR_WS__.readyState === WebSocket.OPEN) {`,
|
|
164
|
+
` try {`,
|
|
165
|
+
` window.__HMR_WS__.send(JSON.stringify({`,
|
|
166
|
+
` type: 'hydration-error',`,
|
|
167
|
+
` data: {`,
|
|
168
|
+
` componentName: '${componentName}',`,
|
|
169
|
+
` componentPath: componentPath,`,
|
|
170
|
+
` error: error instanceof Error ? error.message : String(error),`,
|
|
171
|
+
` timestamp: Date.now()`,
|
|
172
|
+
` }`,
|
|
173
|
+
` }));`,
|
|
174
|
+
` } catch (err) {}`,
|
|
175
|
+
` }`,
|
|
176
|
+
`}
|
|
177
|
+
`,
|
|
178
|
+
`// Track if we've already switched to client-only mode`,
|
|
179
|
+
`let hasSwitchedToClientOnly = false;`,
|
|
180
|
+
`let hydrationErrorDetected = false;
|
|
181
|
+
`,
|
|
182
|
+
`function handleHydrationFallback(error) {`,
|
|
183
|
+
` if (hasSwitchedToClientOnly) return; // Already handled`,
|
|
184
|
+
` hasSwitchedToClientOnly = true;`,
|
|
185
|
+
` hydrationErrorDetected = true;
|
|
186
|
+
`,
|
|
187
|
+
` logHydrationError(error, '${componentName}');
|
|
188
|
+
`,
|
|
189
|
+
` // Fallback: client-only render (no hydration)`,
|
|
190
|
+
` try {`,
|
|
191
|
+
` // Unmount existing root if it exists`,
|
|
192
|
+
` if (window.__REACT_ROOT__ && typeof window.__REACT_ROOT__.unmount === 'function') {`,
|
|
193
|
+
` try {`,
|
|
194
|
+
` window.__REACT_ROOT__.unmount();`,
|
|
195
|
+
` } catch (e) {`,
|
|
196
|
+
` // Ignore unmount errors`,
|
|
197
|
+
` }`,
|
|
198
|
+
` }
|
|
199
|
+
`,
|
|
200
|
+
` // Render into the same root container when falling back to client-only`,
|
|
201
|
+
` const root = createRoot(container);`,
|
|
202
|
+
` root.render(${isDev ? `createElement(ErrorBoundary, null, createElement(PageComponent, mergedProps))` : `createElement(PageComponent, mergedProps)`});`,
|
|
203
|
+
` window.__REACT_ROOT__ = root;`,
|
|
204
|
+
` window.__HMR_CLIENT_ONLY_MODE__ = true;`,
|
|
205
|
+
` } catch (fallbackError) {`,
|
|
206
|
+
` window.location.reload();`,
|
|
207
|
+
` }`,
|
|
208
|
+
`}
|
|
209
|
+
`,
|
|
210
|
+
`// HMR State Preservation: Check for preserved state and merge with initial props`,
|
|
211
|
+
`// This allows state to be preserved across HMR updates without modifying component files`,
|
|
212
|
+
`let preservedState = (typeof window !== 'undefined' && window.__HMR_PRESERVED_STATE__) ? window.__HMR_PRESERVED_STATE__ : {};
|
|
213
|
+
`,
|
|
214
|
+
`// Also check sessionStorage for state that survived a page reload (for React HMR)`,
|
|
215
|
+
`if (typeof window !== 'undefined' && typeof sessionStorage !== 'undefined') {`,
|
|
216
|
+
` const hmrStateJson = sessionStorage.getItem('__REACT_HMR_STATE__');`,
|
|
217
|
+
` if (hmrStateJson) {`,
|
|
218
|
+
` try {`,
|
|
219
|
+
` const hmrState = JSON.parse(hmrStateJson);`,
|
|
220
|
+
` preservedState = { ...preservedState, ...hmrState };`,
|
|
221
|
+
` sessionStorage.removeItem('__REACT_HMR_STATE__');`,
|
|
222
|
+
` } catch (e) {}`,
|
|
223
|
+
` }`,
|
|
224
|
+
`}
|
|
225
|
+
`,
|
|
226
|
+
`const mergedProps = { ...(window.__INITIAL_PROPS__ || {}), ...preservedState };`,
|
|
227
|
+
`// Clear preserved state after using it (so it doesn't persist across multiple updates)`,
|
|
228
|
+
`if (typeof window !== 'undefined') {`,
|
|
229
|
+
` window.__HMR_PRESERVED_STATE__ = undefined;`,
|
|
230
|
+
`}
|
|
231
|
+
`,
|
|
232
|
+
`// Attempt hydration with error handling`,
|
|
233
|
+
`// Use document (not document.body) when the page renders <html><head><body>`,
|
|
234
|
+
`// to avoid "In HTML, <html> cannot be a child of <body>" hydration error`,
|
|
235
|
+
`const container = typeof document !== 'undefined' ? document : null;`,
|
|
236
|
+
`if (!container) {`,
|
|
237
|
+
` throw new Error('React root container not found: document is null');`,
|
|
238
|
+
`}
|
|
239
|
+
`,
|
|
240
|
+
`// Guard: only hydrate on first load. During HMR re-imports, skip hydration`,
|
|
241
|
+
`// so React Fast Refresh can swap components in-place and preserve state.`,
|
|
242
|
+
`if (!window.__REACT_ROOT__) {`,
|
|
243
|
+
` let root;`,
|
|
244
|
+
` // After HMR, SSR is skipped to avoid stale content flash \u2014 render client-only`,
|
|
245
|
+
` if (window.__SSR_DIRTY__) {`,
|
|
246
|
+
` root = createRoot(container);`,
|
|
247
|
+
` root.render(${isDev ? `createElement(ErrorBoundary, null, createElement(PageComponent, mergedProps))` : `createElement(PageComponent, mergedProps)`});`,
|
|
248
|
+
` window.__REACT_ROOT__ = root;`,
|
|
249
|
+
` } else {`,
|
|
250
|
+
` try {`,
|
|
251
|
+
` // Use onRecoverableError to catch hydration errors (React 19)`,
|
|
252
|
+
` root = hydrateRoot(`,
|
|
253
|
+
` container,`,
|
|
254
|
+
` ${isDev ? `createElement(ErrorBoundary, null, createElement(PageComponent, mergedProps))` : `createElement(PageComponent, mergedProps)`},`,
|
|
255
|
+
` {`,
|
|
256
|
+
` onRecoverableError: (error) => {`,
|
|
257
|
+
` // Check if this is a hydration error (isHydrationError filters out whitespace-only head mismatches)`,
|
|
258
|
+
` if (isDev && isHydrationError(error)) {`,
|
|
259
|
+
` // Real hydration error - handle it`,
|
|
260
|
+
` handleHydrationFallback(error);`,
|
|
261
|
+
` } else {`,
|
|
262
|
+
` // Not a hydration error, or it's a whitespace-only mismatch that was filtered out`,
|
|
263
|
+
` // Check if it's a whitespace-only head mismatch using the same logic as isHydrationError`,
|
|
264
|
+
` const errorMessage = error instanceof Error ? error.message : String(error);`,
|
|
265
|
+
` const errorString = String(error);`,
|
|
266
|
+
` const fullMessage = errorMessage + ' ' + errorString;`,
|
|
267
|
+
` const hydrationKeywords = ['hydration', 'Hydration', 'mismatch', 'Mismatch', 'did not match', 'server rendered HTML', 'server HTML', 'client HTML', 'Hydration failed'];`,
|
|
268
|
+
` const isHydration = hydrationKeywords.some(keyword => fullMessage.includes(keyword));`,
|
|
269
|
+
` if (isHydration) {`,
|
|
270
|
+
` // Check if this is a head/link/stylesheet related mismatch`,
|
|
271
|
+
` const isHeadRelated = fullMessage.includes('<head') || fullMessage.includes('</head>') || fullMessage.includes('head>') || fullMessage.includes('<link') || fullMessage.includes('link>') || fullMessage.includes('stylesheet') || fullMessage.includes('fonts.googleapis') || fullMessage.includes('rel="stylesheet"');`,
|
|
272
|
+
` // Check if the mismatch involves only whitespace/newlines`,
|
|
273
|
+
` const hasWhitespacePattern = /\\{\\s*["']\\\\n[^"']*["']\\s*\\}/.test(fullMessage) || /\\{\\s*["'][\\\\n\\\\r\\\\s]+["']\\s*\\}/.test(fullMessage) || /-\\s*\\{\\s*["'][\\\\n\\\\r\\\\s]+["']\\s*\\}/.test(fullMessage);`,
|
|
274
|
+
` const isWhitespaceOnly = /^[\\s\\n\\r]*$/.test(errorString) || /^[\\s\\n\\r]*$/.test(errorMessage);`,
|
|
275
|
+
` const hasNewlinePattern = fullMessage.includes('\\\\n') || fullMessage.includes('\\\\r') || fullMessage.includes('\\n') || fullMessage.includes('\\r');`,
|
|
276
|
+
` // If it's head-related and involves whitespace/newlines, silently ignore it`,
|
|
277
|
+
` if (isHeadRelated && (hasWhitespacePattern || isWhitespaceOnly || hasNewlinePattern)) {`,
|
|
278
|
+
` // Already logged by isHydrationError, just return silently`,
|
|
279
|
+
` return;`,
|
|
280
|
+
` }`,
|
|
281
|
+
` }`,
|
|
282
|
+
` // Log other recoverable errors`,
|
|
283
|
+
` console.error('React recoverable error:', error);`,
|
|
284
|
+
` }`,
|
|
285
|
+
` }`,
|
|
286
|
+
` }`,
|
|
287
|
+
` );`,
|
|
288
|
+
` window.__REACT_ROOT__ = root;`,
|
|
289
|
+
` } catch (error) {`,
|
|
290
|
+
` // Catch synchronous errors (shouldn't happen with hydrateRoot, but safety net)`,
|
|
291
|
+
` if (isDev && isHydrationError(error)) {`,
|
|
292
|
+
` handleHydrationFallback(error);`,
|
|
293
|
+
` } else {`,
|
|
294
|
+
` throw error;`,
|
|
295
|
+
` }`,
|
|
296
|
+
` }`,
|
|
297
|
+
` } // end else (normal hydration path)
|
|
298
|
+
`,
|
|
299
|
+
` // Also listen for hydration errors via console.error (React logs them there)`,
|
|
300
|
+
` if (isDev) {`,
|
|
301
|
+
` const originalError = console.error;`,
|
|
302
|
+
` console.error = function(...args) {`,
|
|
303
|
+
` const errorMessage = args.map(arg => {`,
|
|
304
|
+
` if (arg instanceof Error) return arg.message;`,
|
|
305
|
+
` return String(arg);`,
|
|
306
|
+
` }).join(' ');`,
|
|
307
|
+
` `,
|
|
308
|
+
` // Check if this is a hydration error`,
|
|
309
|
+
` if (isHydrationError({ message: errorMessage }) && !hydrationErrorDetected) {`,
|
|
310
|
+
` hydrationErrorDetected = true;`,
|
|
311
|
+
` // Create a synthetic error for fallback`,
|
|
312
|
+
` const syntheticError = new Error(errorMessage);`,
|
|
313
|
+
` // Use setTimeout to ensure this happens after React's error handling`,
|
|
314
|
+
` setTimeout(() => {`,
|
|
315
|
+
` handleHydrationFallback(syntheticError);`,
|
|
316
|
+
` }, 0);`,
|
|
317
|
+
` }`,
|
|
318
|
+
` `,
|
|
319
|
+
` // Call original console.error`,
|
|
320
|
+
` originalError.apply(console, args);`,
|
|
321
|
+
` };`,
|
|
322
|
+
` }`,
|
|
323
|
+
`}`,
|
|
324
|
+
...isDev ? [
|
|
325
|
+
`
|
|
326
|
+
// Pre-warm: import the page module from the module server`,
|
|
327
|
+
`// immediately so the browser caches all /@src/ URLs.`,
|
|
328
|
+
`import('/@src/${relative(process.cwd(), resolve(reactPagesDirectory, `${componentName}.tsx`)).replace(/\\/g, "/")}').catch(() => {});`
|
|
329
|
+
] : []
|
|
330
|
+
].join(`
|
|
331
|
+
`);
|
|
332
|
+
const indexPath = join(reactIndexesDirectory, `${componentName}.tsx`);
|
|
333
|
+
const hasher = new Bun.CryptoHasher("md5");
|
|
334
|
+
hasher.update(content);
|
|
335
|
+
const contentHash = hasher.digest("hex");
|
|
336
|
+
if (indexContentCache.get(indexPath) === contentHash && existsSync(indexPath)) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
indexContentCache.set(indexPath, contentHash);
|
|
340
|
+
await writeFile(indexPath, content);
|
|
341
|
+
});
|
|
342
|
+
await Promise.all(promises);
|
|
343
|
+
if (!isDev) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const refreshPath = join(reactIndexesDirectory, "_refresh.tsx");
|
|
347
|
+
if (!existsSync(refreshPath)) {
|
|
348
|
+
await writeFile(refreshPath, `import '${refreshSetupPath}';
|
|
349
|
+
import 'react';
|
|
350
|
+
import 'react-dom/client';
|
|
351
|
+
`);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
export { generateReactIndexFiles };
|
|
356
|
+
|
|
357
|
+
//# debugId=3CD4375ABE2D804864756E2164756E21
|
|
358
|
+
//# sourceMappingURL=chunk-3g91wb4f.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/build/generateReactIndexes.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { existsSync, mkdirSync } from 'fs';\nimport { readdir, rm, writeFile } from 'fs/promises';\nimport { basename, join, relative, resolve, sep } from 'path';\nimport { Glob } from 'bun';\nimport { toPascal } from '../utils/stringModifiers';\n\nconst indexContentCache = new Map<string, string>();\n\nconst resolveDevClientDir = () => {\n\tconst projectRoot = process.cwd();\n\tconst fromSource = resolve(import.meta.dir, '../dev/client');\n\n\t// Only use the source path if it exists AND is within the project root\n\t// (i.e., we're developing absolutejs itself, not using it as a dependency)\n\tif (existsSync(fromSource) && fromSource.startsWith(projectRoot)) {\n\t\treturn fromSource;\n\t}\n\n\t// When running from a published npm package, use the installed copy\n\tconst fromNodeModules = resolve(\n\t\tprojectRoot,\n\t\t'node_modules/@absolutejs/absolute/dist/dev/client'\n\t);\n\tif (existsSync(fromNodeModules)) return fromNodeModules;\n\n\treturn resolve(import.meta.dir, './dev/client');\n};\n\nconst devClientDir = resolveDevClientDir();\n\nconst errorOverlayPath = join(devClientDir, 'errorOverlay.ts').replace(\n\t/\\\\/g,\n\t'/'\n);\n\nconst hmrClientPath = join(devClientDir, 'hmrClient.ts').replace(/\\\\/g, '/');\n\nconst refreshSetupPath = join(devClientDir, 'reactRefreshSetup.ts').replace(\n\t/\\\\/g,\n\t'/'\n);\n\nexport const generateReactIndexFiles = async (\n\treactPagesDirectory: string,\n\treactIndexesDirectory: string,\n\tisDev = false\n) => {\n\tif (!existsSync(reactIndexesDirectory)) {\n\t\tmkdirSync(reactIndexesDirectory, { recursive: true });\n\t}\n\n\tconst CONVENTION_RE = /^(?:(.+)\\.)?(error|loading|not-found)\\.[^.]+$/;\n\tconst pagesGlob = new Glob('*.{jsx,tsx}');\n\tconst files: string[] = [];\n\tfor await (const file of pagesGlob.scan({ cwd: reactPagesDirectory })) {\n\t\tif (CONVENTION_RE.test(file)) continue;\n\t\tfiles.push(file);\n\t}\n\n\t// Remove stale indexes whose source pages no longer exist\n\tconst currentPageNames = new Set(\n\t\tfiles.map((file) => basename(file).split('.')[0])\n\t);\n\n\tconst emptyStringArray: string[] = [];\n\n\tconst existingIndexes = await readdir(reactIndexesDirectory).catch(\n\t\t() => emptyStringArray\n\t);\n\n\tconst staleIndexes = existingIndexes.filter((indexFile) => {\n\t\tconst indexName = indexFile.replace(/\\.tsx$/, '');\n\n\t\treturn indexName !== '_refresh' && !currentPageNames.has(indexName);\n\t});\n\n\tif (staleIndexes.length > 0) {\n\t\tawait Promise.all(\n\t\t\tstaleIndexes.map((indexFile) => {\n\t\t\t\tindexContentCache.delete(\n\t\t\t\t\tjoin(reactIndexesDirectory, indexFile)\n\t\t\t\t);\n\n\t\t\t\treturn rm(join(reactIndexesDirectory, indexFile), {\n\t\t\t\t\tforce: true\n\t\t\t\t});\n\t\t\t})\n\t\t);\n\t}\n\n\t// Compute relative path from indexes dir to pages dir for imports\n\tconst pagesRelPath = relative(\n\t\tresolve(reactIndexesDirectory),\n\t\tresolve(reactPagesDirectory)\n\t)\n\t\t.split(sep)\n\t\t.join('/');\n\n\tconst promises = files.map(async (file) => {\n\t\tconst fileName = basename(file);\n\t\tconst componentName = fileName.split('.')[0]!;\n\t\tconst pascalComponentName = toPascal(componentName);\n\n\t\tconst hmrPreamble = isDev\n\t\t\t? [\n\t\t\t\t\t`window.__HMR_FRAMEWORK__ = \"react\";`,\n\t\t\t\t\t`window.__REACT_COMPONENT_KEY__ = \"${componentName}Index\";`,\n\t\t\t\t\t`import '${refreshSetupPath}';`,\n\t\t\t\t\t`import '${hmrClientPath}';`,\n\t\t\t\t\t`import { showErrorOverlay, hideErrorOverlay } from '${errorOverlayPath}';\\n`\n\t\t\t\t]\n\t\t\t: [];\n\n\t\tconst reactImports = isDev\n\t\t\t? [\n\t\t\t\t\t`import { hydrateRoot, createRoot } from 'react-dom/client';`,\n\t\t\t\t\t`import { createElement, Component } from 'react';`\n\t\t\t\t]\n\t\t\t: [\n\t\t\t\t\t`import { hydrateRoot, createRoot } from 'react-dom/client';`,\n\t\t\t\t\t`import { createElement } from 'react';`\n\t\t\t\t];\n\n\t\tconst errorBoundaryDef = isDev\n\t\t\t? [\n\t\t\t\t\t`\\n// Dev-only Error Boundary to catch React render errors`,\n\t\t\t\t\t`class ErrorBoundary extends Component {`,\n\t\t\t\t\t`\\tconstructor(props) {`,\n\t\t\t\t\t`\\t\\tsuper(props);`,\n\t\t\t\t\t`\\t\\tthis.state = { hasError: false };`,\n\t\t\t\t\t`\\t\\twindow.__ERROR_BOUNDARY__ = this;`,\n\t\t\t\t\t`\\t}`,\n\t\t\t\t\t`\\tstatic getDerivedStateFromError() {`,\n\t\t\t\t\t`\\t\\treturn { hasError: true };`,\n\t\t\t\t\t`\\t}`,\n\t\t\t\t\t`\\tcomponentDidCatch(error) {`,\n\t\t\t\t\t`\\t\\tshowErrorOverlay({`,\n\t\t\t\t\t`\\t\\t\\tframework: 'react',`,\n\t\t\t\t\t`\\t\\t\\tkind: 'runtime',`,\n\t\t\t\t\t`\\t\\t\\tmessage: error && error.stack ? error.stack : String(error)`,\n\t\t\t\t\t`\\t\\t});`,\n\t\t\t\t\t`\\t}`,\n\t\t\t\t\t`\\tcomponentDidUpdate(prevProps, prevState) {`,\n\t\t\t\t\t`\\t\\tif (prevState.hasError && !this.state.hasError) {`,\n\t\t\t\t\t`\\t\\t\\thideErrorOverlay();`,\n\t\t\t\t\t`\\t\\t}`,\n\t\t\t\t\t`\\t}`,\n\t\t\t\t\t`\\treset() {`,\n\t\t\t\t\t`\\t\\tthis.setState({ hasError: false });`,\n\t\t\t\t\t`\\t}`,\n\t\t\t\t\t`\\trender() {`,\n\t\t\t\t\t`\\t\\tif (this.state.hasError) return null;`,\n\t\t\t\t\t``,\n\t\t\t\t\t`\\t\\treturn this.props.children;`,\n\t\t\t\t\t`\\t}`,\n\t\t\t\t\t`}\\n`\n\t\t\t\t]\n\t\t\t: [];\n\n\t\tconst content = [\n\t\t\t...hmrPreamble,\n\t\t\t...reactImports,\n\t\t\t`import * as PageModule from '${pagesRelPath}/${componentName}';\\n`,\n\t\t\t...errorBoundaryDef,\n\t\t\t`// Hydration with error handling and fallback`,\n\t\t\t`const isDev = ${isDev};`,\n\t\t\t`const componentPath = '${pagesRelPath}/${componentName}';\\n`,\n\t\t\t`function resolvePageComponent(module, candidateNames) {`,\n\t\t\t`\\tfor (const name of candidateNames) {`,\n\t\t\t`\\t\\tconst value = module[name];`,\n\t\t\t`\\t\\tif (typeof value === 'function' || (value && typeof value === 'object')) return value;`,\n\t\t\t`\\t}`,\n\t\t\t`\\tfor (const [name, value] of Object.entries(module)) {`,\n\t\t\t`\\t\\tif (!/^[A-Z]/.test(name)) continue;`,\n\t\t\t`\\t\\tif (typeof value === 'function' || (value && typeof value === 'object')) return value;`,\n\t\t\t`\\t}`,\n\t\t\t`\\tthrow new Error('React page module ' + componentPath + ' does not export a component. Expected default, ${pascalComponentName}, ${componentName}, or any PascalCase export.');`,\n\t\t\t`}`,\n\t\t\t`const PageComponent = resolvePageComponent(PageModule, ['default', '${pascalComponentName}', '${componentName}']);\\n`,\n\t\t\t`function isHydrationError(error) {`,\n\t\t\t`\\tif (!error) return false;`,\n\t\t\t`\\tconst errorMessage = error instanceof Error ? error.message : String(error);`,\n\t\t\t`\\tconst errorString = String(error);`,\n\t\t\t`\\tconst fullMessage = errorMessage + ' ' + errorString;`,\n\t\t\t`\\tconst hydrationKeywords = ['hydration', 'Hydration', 'mismatch', 'Mismatch', 'did not match', 'server rendered HTML', 'server HTML', 'client HTML', 'Hydration failed'];`,\n\t\t\t`\\tconst isHydration = hydrationKeywords.some(keyword => fullMessage.includes(keyword));`,\n\t\t\t`\\t`,\n\t\t\t`\\t// Ignore whitespace-only mismatches in <head> - these are harmless formatting differences`,\n\t\t\t`\\t// The error often shows: + <link...> vs - {\"\\\\n \"} which is just formatting`,\n\t\t\t`\\tif (isHydration) {`,\n\t\t\t`\\t\\t// Check if this is a head/link/stylesheet related mismatch`,\n\t\t\t`\\t\\tconst isHeadRelated = fullMessage.includes('<head') || fullMessage.includes('</head>') || fullMessage.includes('head>') || fullMessage.includes('<link') || fullMessage.includes('link>') || fullMessage.includes('stylesheet') || fullMessage.includes('fonts.googleapis') || fullMessage.includes('rel=\"stylesheet\"');`,\n\t\t\t`\\t\\t`,\n\t\t\t`\\t\\t// Check if the mismatch involves only whitespace/newlines`,\n\t\t\t`\\t\\t// Pattern: looks for {\"\\\\n\"} or {\"\\\\n \"} or similar whitespace-only content`,\n\t\t\t`\\t\\t// Also check for patterns like: - {\"\\\\n \"} or + <link...>`,\n\t\t\t`\\t\\tconst hasWhitespacePattern = /\\\\{\\\\s*[\"']\\\\\\\\n[^\"']*[\"']\\\\s*\\\\}/.test(fullMessage) || /\\\\{\\\\s*[\"'][\\\\\\\\n\\\\\\\\r\\\\\\\\s]+[\"']\\\\s*\\\\}/.test(fullMessage) || /-\\\\s*\\\\{\\\\s*[\"'][\\\\\\\\n\\\\\\\\r\\\\\\\\s]+[\"']\\\\s*\\\\}/.test(fullMessage);`,\n\t\t\t`\\t\\tconst isWhitespaceOnly = /^[\\\\s\\\\n\\\\r]*$/.test(errorString) || /^[\\\\s\\\\n\\\\r]*$/.test(errorMessage);`,\n\t\t\t`\\t\\tconst hasNewlinePattern = fullMessage.includes('\\\\\\\\n') || fullMessage.includes('\\\\\\\\r') || fullMessage.includes('\\\\n') || fullMessage.includes('\\\\r');`,\n\t\t\t`\\t\\t`,\n\t\t\t`\\t\\t// If it's head-related and involves whitespace/newlines, ignore it`,\n\t\t\t`\\t\\tif (isHeadRelated && (hasWhitespacePattern || isWhitespaceOnly || hasNewlinePattern)) {`,\n\t\t\t`\\t\\t\\treturn false; // Don't treat whitespace-only head mismatches as errors`,\n\t\t\t`\\t\\t}`,\n\t\t\t`\\t}`,\n\t\t\t`\\treturn isHydration;`,\n\t\t\t`}\\n`,\n\t\t\t`function logHydrationError(error, componentName) {`,\n\t\t\t`\\tif (!isDev) return;`,\n\t\t\t`\\tif (window.__HMR_WS__ && window.__HMR_WS__.readyState === WebSocket.OPEN) {`,\n\t\t\t`\\t\\ttry {`,\n\t\t\t`\\t\\t\\twindow.__HMR_WS__.send(JSON.stringify({`,\n\t\t\t`\\t\\t\\t\\ttype: 'hydration-error',`,\n\t\t\t`\\t\\t\\t\\tdata: {`,\n\t\t\t`\\t\\t\\t\\t\\tcomponentName: '${componentName}',`,\n\t\t\t`\\t\\t\\t\\t\\tcomponentPath: componentPath,`,\n\t\t\t`\\t\\t\\t\\t\\terror: error instanceof Error ? error.message : String(error),`,\n\t\t\t`\\t\\t\\t\\t\\ttimestamp: Date.now()`,\n\t\t\t`\\t\\t\\t\\t}`,\n\t\t\t`\\t\\t\\t}));`,\n\t\t\t`\\t\\t} catch (err) {}`,\n\t\t\t`\\t}`,\n\t\t\t`}\\n`,\n\t\t\t`// Track if we've already switched to client-only mode`,\n\t\t\t`let hasSwitchedToClientOnly = false;`,\n\t\t\t`let hydrationErrorDetected = false;\\n`,\n\t\t\t`function handleHydrationFallback(error) {`,\n\t\t\t`\\tif (hasSwitchedToClientOnly) return; // Already handled`,\n\t\t\t`\\thasSwitchedToClientOnly = true;`,\n\t\t\t`\\thydrationErrorDetected = true;\\n`,\n\t\t\t`\\tlogHydrationError(error, '${componentName}');\\n`,\n\t\t\t`\\t// Fallback: client-only render (no hydration)`,\n\t\t\t`\\ttry {`,\n\t\t\t`\\t\\t// Unmount existing root if it exists`,\n\t\t\t`\\t\\tif (window.__REACT_ROOT__ && typeof window.__REACT_ROOT__.unmount === 'function') {`,\n\t\t\t`\\t\\t\\ttry {`,\n\t\t\t`\\t\\t\\twindow.__REACT_ROOT__.unmount();`,\n\t\t\t`\\t\\t\\t} catch (e) {`,\n\t\t\t`\\t\\t\\t\\t// Ignore unmount errors`,\n\t\t\t`\\t\\t\\t}`,\n\t\t\t`\\t\\t}\\n`,\n\t\t\t`\\t\\t// Render into the same root container when falling back to client-only`,\n\t\t\t`\\t\\tconst root = createRoot(container);`,\n\t\t\t`\\t\\troot.render(${isDev ? `createElement(ErrorBoundary, null, createElement(PageComponent, mergedProps))` : `createElement(PageComponent, mergedProps)`});`,\n\t\t\t`\\t\\twindow.__REACT_ROOT__ = root;`,\n\t\t\t`\\t\\twindow.__HMR_CLIENT_ONLY_MODE__ = true;`,\n\t\t\t`\\t} catch (fallbackError) {`,\n\t\t\t`\\t\\twindow.location.reload();`,\n\t\t\t`\\t}`,\n\t\t\t`}\\n`,\n\t\t\t`// HMR State Preservation: Check for preserved state and merge with initial props`,\n\t\t\t`// This allows state to be preserved across HMR updates without modifying component files`,\n\t\t\t`let preservedState = (typeof window !== 'undefined' && window.__HMR_PRESERVED_STATE__) ? window.__HMR_PRESERVED_STATE__ : {};\\n`,\n\t\t\t`// Also check sessionStorage for state that survived a page reload (for React HMR)`,\n\t\t\t`if (typeof window !== 'undefined' && typeof sessionStorage !== 'undefined') {`,\n\t\t\t`\\tconst hmrStateJson = sessionStorage.getItem('__REACT_HMR_STATE__');`,\n\t\t\t`\\tif (hmrStateJson) {`,\n\t\t\t`\\t\\ttry {`,\n\t\t\t`\\t\\t\\tconst hmrState = JSON.parse(hmrStateJson);`,\n\t\t\t`\\t\\t\\tpreservedState = { ...preservedState, ...hmrState };`,\n\t\t\t`\\t\\t\\tsessionStorage.removeItem('__REACT_HMR_STATE__');`,\n\t\t\t`\\t\\t} catch (e) {}`,\n\t\t\t`\\t}`,\n\t\t\t`}\\n`,\n\t\t\t`const mergedProps = { ...(window.__INITIAL_PROPS__ || {}), ...preservedState };`,\n\t\t\t`// Clear preserved state after using it (so it doesn't persist across multiple updates)`,\n\t\t\t`if (typeof window !== 'undefined') {`,\n\t\t\t`\\twindow.__HMR_PRESERVED_STATE__ = undefined;`,\n\t\t\t`}\\n`,\n\t\t\t`// Attempt hydration with error handling`,\n\t\t\t`// Use document (not document.body) when the page renders <html><head><body>`,\n\t\t\t`// to avoid \"In HTML, <html> cannot be a child of <body>\" hydration error`,\n\t\t\t`const container = typeof document !== 'undefined' ? document : null;`,\n\t\t\t`if (!container) {`,\n\t\t\t`\\tthrow new Error('React root container not found: document is null');`,\n\t\t\t`}\\n`,\n\t\t\t`// Guard: only hydrate on first load. During HMR re-imports, skip hydration`,\n\t\t\t`// so React Fast Refresh can swap components in-place and preserve state.`,\n\t\t\t`if (!window.__REACT_ROOT__) {`,\n\t\t\t`\\tlet root;`,\n\t\t\t`\\t// After HMR, SSR is skipped to avoid stale content flash — render client-only`,\n\t\t\t`\\tif (window.__SSR_DIRTY__) {`,\n\t\t\t`\\t\\troot = createRoot(container);`,\n\t\t\t`\\t\\troot.render(${isDev ? `createElement(ErrorBoundary, null, createElement(PageComponent, mergedProps))` : `createElement(PageComponent, mergedProps)`});`,\n\t\t\t`\\t\\twindow.__REACT_ROOT__ = root;`,\n\t\t\t`\\t} else {`,\n\t\t\t`\\ttry {`,\n\t\t\t`\\t\\t// Use onRecoverableError to catch hydration errors (React 19)`,\n\t\t\t`\\t\\troot = hydrateRoot(`,\n\t\t\t`\\t\\t\\tcontainer,`,\n\t\t\t`\\t\\t\\t${isDev ? `createElement(ErrorBoundary, null, createElement(PageComponent, mergedProps))` : `createElement(PageComponent, mergedProps)`},`,\n\t\t\t`\\t\\t\\t{`,\n\t\t\t`\\t\\t\\t\\tonRecoverableError: (error) => {`,\n\t\t\t`\\t\\t\\t\\t\\t// Check if this is a hydration error (isHydrationError filters out whitespace-only head mismatches)`,\n\t\t\t`\\t\\t\\t\\t\\tif (isDev && isHydrationError(error)) {`,\n\t\t\t`\\t\\t\\t\\t\\t\\t// Real hydration error - handle it`,\n\t\t\t`\\t\\t\\t\\t\\t\\thandleHydrationFallback(error);`,\n\t\t\t`\\t\\t\\t\\t\\t} else {`,\n\t\t\t`\\t\\t\\t\\t\\t\\t// Not a hydration error, or it's a whitespace-only mismatch that was filtered out`,\n\t\t\t`\\t\\t\\t\\t\\t\\t// Check if it's a whitespace-only head mismatch using the same logic as isHydrationError`,\n\t\t\t`\\t\\t\\t\\t\\t\\tconst errorMessage = error instanceof Error ? error.message : String(error);`,\n\t\t\t`\\t\\t\\t\\t\\t\\tconst errorString = String(error);`,\n\t\t\t`\\t\\t\\t\\t\\t\\tconst fullMessage = errorMessage + ' ' + errorString;`,\n\t\t\t`\\t\\t\\t\\t\\t\\tconst hydrationKeywords = ['hydration', 'Hydration', 'mismatch', 'Mismatch', 'did not match', 'server rendered HTML', 'server HTML', 'client HTML', 'Hydration failed'];`,\n\t\t\t`\\t\\t\\t\\t\\t\\tconst isHydration = hydrationKeywords.some(keyword => fullMessage.includes(keyword));`,\n\t\t\t`\\t\\t\\t\\t\\t\\tif (isHydration) {`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\t// Check if this is a head/link/stylesheet related mismatch`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\tconst isHeadRelated = fullMessage.includes('<head') || fullMessage.includes('</head>') || fullMessage.includes('head>') || fullMessage.includes('<link') || fullMessage.includes('link>') || fullMessage.includes('stylesheet') || fullMessage.includes('fonts.googleapis') || fullMessage.includes('rel=\"stylesheet\"');`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\t// Check if the mismatch involves only whitespace/newlines`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\tconst hasWhitespacePattern = /\\\\{\\\\s*[\"']\\\\\\\\n[^\"']*[\"']\\\\s*\\\\}/.test(fullMessage) || /\\\\{\\\\s*[\"'][\\\\\\\\n\\\\\\\\r\\\\\\\\s]+[\"']\\\\s*\\\\}/.test(fullMessage) || /-\\\\s*\\\\{\\\\s*[\"'][\\\\\\\\n\\\\\\\\r\\\\\\\\s]+[\"']\\\\s*\\\\}/.test(fullMessage);`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\tconst isWhitespaceOnly = /^[\\\\s\\\\n\\\\r]*$/.test(errorString) || /^[\\\\s\\\\n\\\\r]*$/.test(errorMessage);`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\tconst hasNewlinePattern = fullMessage.includes('\\\\\\\\n') || fullMessage.includes('\\\\\\\\r') || fullMessage.includes('\\\\n') || fullMessage.includes('\\\\r');`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\t// If it's head-related and involves whitespace/newlines, silently ignore it`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\tif (isHeadRelated && (hasWhitespacePattern || isWhitespaceOnly || hasNewlinePattern)) {`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\t\\t// Already logged by isHydrationError, just return silently`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\t\\treturn;`,\n\t\t\t`\\t\\t\\t\\t\\t\\t\\t}`,\n\t\t\t`\\t\\t\\t\\t\\t\\t}`,\n\t\t\t`\\t\\t\\t\\t\\t\\t// Log other recoverable errors`,\n\t\t\t`\\t\\t\\t\\t\\t\\tconsole.error('React recoverable error:', error);`,\n\t\t\t`\\t\\t\\t\\t\\t}`,\n\t\t\t`\\t\\t\\t\\t}`,\n\t\t\t`\\t\\t\\t}`,\n\t\t\t`\\t\\t);`,\n\t\t\t`\\t\\twindow.__REACT_ROOT__ = root;`,\n\t\t\t`\\t} catch (error) {`,\n\t\t\t`\\t\\t// Catch synchronous errors (shouldn't happen with hydrateRoot, but safety net)`,\n\t\t\t`\\t\\tif (isDev && isHydrationError(error)) {`,\n\t\t\t`\\t\\t\\thandleHydrationFallback(error);`,\n\t\t\t`\\t\\t} else {`,\n\t\t\t`\\t\\t\\tthrow error;`,\n\t\t\t`\\t\\t}`,\n\t\t\t`\\t}`,\n\t\t\t`\\t} // end else (normal hydration path)\\n`,\n\t\t\t`\\t// Also listen for hydration errors via console.error (React logs them there)`,\n\t\t\t`\\tif (isDev) {`,\n\t\t\t`\\t\\tconst originalError = console.error;`,\n\t\t\t`\\t\\tconsole.error = function(...args) {`,\n\t\t\t`\\t\\t\\tconst errorMessage = args.map(arg => {`,\n\t\t\t`\\t\\t\\t\\tif (arg instanceof Error) return arg.message;`,\n\t\t\t`\\t\\t\\t\\treturn String(arg);`,\n\t\t\t`\\t\\t\\t}).join(' ');`,\n\t\t\t`\\t\\t\\t`,\n\t\t\t`\\t\\t\\t// Check if this is a hydration error`,\n\t\t\t`\\t\\t\\tif (isHydrationError({ message: errorMessage }) && !hydrationErrorDetected) {`,\n\t\t\t`\\t\\t\\t\\thydrationErrorDetected = true;`,\n\t\t\t`\\t\\t\\t\\t// Create a synthetic error for fallback`,\n\t\t\t`\\t\\t\\t\\tconst syntheticError = new Error(errorMessage);`,\n\t\t\t`\\t\\t\\t\\t// Use setTimeout to ensure this happens after React's error handling`,\n\t\t\t`\\t\\t\\t\\tsetTimeout(() => {`,\n\t\t\t`\\t\\t\\t\\t\\thandleHydrationFallback(syntheticError);`,\n\t\t\t`\\t\\t\\t\\t}, 0);`,\n\t\t\t`\\t\\t\\t}`,\n\t\t\t`\\t\\t\\t`,\n\t\t\t`\\t\\t\\t// Call original console.error`,\n\t\t\t`\\t\\t\\toriginalError.apply(console, args);`,\n\t\t\t`\\t\\t};`,\n\t\t\t`\\t}`,\n\t\t\t`}`,\n\t\t\t...(isDev\n\t\t\t\t? [\n\t\t\t\t\t\t`\\n// Pre-warm: import the page module from the module server`,\n\t\t\t\t\t\t`// immediately so the browser caches all /@src/ URLs.`,\n\t\t\t\t\t\t`import('/@src/${relative(process.cwd(), resolve(reactPagesDirectory, `${componentName}.tsx`)).replace(/\\\\/g, '/')}').catch(() => {});`\n\t\t\t\t\t]\n\t\t\t\t: [])\n\t\t].join('\\n');\n\n\t\tconst indexPath = join(reactIndexesDirectory, `${componentName}.tsx`);\n\t\tconst hasher = new Bun.CryptoHasher('md5');\n\t\thasher.update(content);\n\t\tconst contentHash = hasher.digest('hex');\n\n\t\tif (\n\t\t\tindexContentCache.get(indexPath) === contentHash &&\n\t\t\texistsSync(indexPath)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tindexContentCache.set(indexPath, contentHash);\n\t\tawait writeFile(indexPath, content);\n\t});\n\tawait Promise.all(promises);\n\n\t// Generate a dummy entry that imports React so code splitting extracts\n\t// React into a shared chunk. This lets HMR re-import component entries\n\t// without creating a duplicate React instance.\n\t// IMPORTANT: reactRefreshSetup MUST be imported BEFORE react so that\n\t// injectIntoGlobalHook patches window.__REACT_DEVTOOLS_GLOBAL_HOOK__\n\t// before React initializes and checks it. Without this, the Refresh\n\t// Runtime can't reach React's reconciler and performReactRefresh()\n\t// silently does nothing.\n\tif (!isDev) {\n\t\treturn;\n\t}\n\n\tconst refreshPath = join(reactIndexesDirectory, '_refresh.tsx');\n\n\tif (!existsSync(refreshPath)) {\n\t\tawait writeFile(\n\t\t\trefreshPath,\n\t\t\t`import '${refreshSetupPath}';\\nimport 'react';\\nimport 'react-dom/client';\\n`\n\t\t);\n\t}\n};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ACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAI,QACD;AAAA,QACA;AAAA;AAAA,QACA;AAAA,QACA,iBAAiB,SAAS,QAAQ,IAAI,GAAG,QAAQ,qBAAqB,GAAG,mBAAmB,CAAC,EAAE,QAAQ,OAAO,GAAG;AAAA,MAClH,IACC,CAAC;AAAA,IACL,EAAE,KAAK;AAAA,CAAI;AAAA,IAEX,MAAM,YAAY,KAAK,uBAAuB,GAAG,mBAAmB;AAAA,IACpE,MAAM,SAAS,IAAI,IAAI,aAAa,KAAK;AAAA,IACzC,OAAO,OAAO,OAAO;AAAA,IACrB,MAAM,cAAc,OAAO,OAAO,KAAK;AAAA,IAEvC,IACC,kBAAkB,IAAI,SAAS,MAAM,eACrC,WAAW,SAAS,GACnB;AAAA,MACD;AAAA,IACD;AAAA,IAEA,kBAAkB,IAAI,WAAW,WAAW;AAAA,IAC5C,MAAM,UAAU,WAAW,OAAO;AAAA,GAClC;AAAA,EACD,MAAM,QAAQ,IAAI,QAAQ;AAAA,EAU1B,IAAI,CAAC,OAAO;AAAA,IACX;AAAA,EACD;AAAA,EAEA,MAAM,cAAc,KAAK,uBAAuB,cAAc;AAAA,EAE9D,IAAI,CAAC,WAAW,WAAW,GAAG;AAAA,IAC7B,MAAM,UACL,aACA,WAAW;AAAA;AAAA;AAAA,CACZ;AAAA,EACD;AAAA;",
|
|
8
|
+
"debugId": "3CD4375ABE2D804864756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/core/islandManifest.ts
|
|
3
|
+
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1);
|
|
4
|
+
var collectFrameworkIslands = (manifest, prefix) => {
|
|
5
|
+
const entries = {};
|
|
6
|
+
let found = false;
|
|
7
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
8
|
+
if (!key.startsWith(prefix))
|
|
9
|
+
continue;
|
|
10
|
+
const component = key.slice(prefix.length);
|
|
11
|
+
if (!component)
|
|
12
|
+
continue;
|
|
13
|
+
entries[component] = value;
|
|
14
|
+
found = true;
|
|
15
|
+
}
|
|
16
|
+
return found ? entries : undefined;
|
|
17
|
+
};
|
|
18
|
+
var getIslandManifestEntries = (manifest) => {
|
|
19
|
+
const islands = {};
|
|
20
|
+
const frameworks = ["react", "svelte", "vue", "angular"];
|
|
21
|
+
for (const framework of frameworks) {
|
|
22
|
+
const prefix = `Island${toIslandFrameworkSegment(framework)}`;
|
|
23
|
+
const entries = collectFrameworkIslands(manifest, prefix);
|
|
24
|
+
if (entries)
|
|
25
|
+
islands[framework] = entries;
|
|
26
|
+
}
|
|
27
|
+
return islands;
|
|
28
|
+
};
|
|
29
|
+
var getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
|
|
30
|
+
|
|
31
|
+
export { getIslandManifestEntries, getIslandManifestKey };
|
|
32
|
+
|
|
33
|
+
//# debugId=A4777F528EEB5C9A64756E2164756E21
|
|
34
|
+
//# sourceMappingURL=chunk-3yjzpcne.js.map
|