@absolutejs/absolute 0.19.0-beta.1043 → 0.19.0-beta.1044

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (523) hide show
  1. package/dist/angular/browser.js +10358 -0
  2. package/dist/angular/browser.js.map +260 -0
  3. package/dist/angular/components/constants.js +101 -0
  4. package/dist/angular/components/core/streamingSlotRegistrar.js +58 -0
  5. package/dist/angular/components/core/streamingSlotRegistry.js +114 -0
  6. package/dist/angular/components/defer-slot-payload.js +6 -0
  7. package/dist/angular/components/defer-slot-templates.directive.js +44 -0
  8. package/dist/angular/components/defer-slot.component.js +152 -0
  9. package/dist/angular/components/image.component.js +202 -0
  10. package/dist/angular/components/index.js +4 -0
  11. package/dist/angular/components/stream-slot.component.js +102 -0
  12. package/dist/angular/hmrPreserveCore.ts +188 -0
  13. package/dist/angular/index.js +15793 -0
  14. package/dist/angular/index.js.map +299 -0
  15. package/dist/angular/server.js +6357 -0
  16. package/dist/angular/server.js.map +61 -0
  17. package/dist/build.js +27484 -0
  18. package/dist/build.js.map +146 -0
  19. package/dist/cli/config/client.js +527 -0
  20. package/dist/cli/config/server.js +37130 -0
  21. package/dist/cli/htmx/htmx.min.js +1 -0
  22. package/dist/cli/index.js +180130 -0
  23. package/dist/client/index.js +1267 -0
  24. package/dist/client/index.js.map +31 -0
  25. package/dist/core/streamingSlotRegistrar.js +138 -0
  26. package/dist/core/streamingSlotRegistrar.js.map +10 -0
  27. package/dist/core/streamingSlotRegistry.js +194 -0
  28. package/dist/core/streamingSlotRegistry.js.map +11 -0
  29. package/dist/dev/client/constants.ts +26 -0
  30. package/dist/dev/client/cssUtils.ts +311 -0
  31. package/dist/dev/client/domDiff.ts +226 -0
  32. package/dist/dev/client/domState.ts +423 -0
  33. package/dist/dev/client/domTracker.ts +61 -0
  34. package/dist/dev/client/errorOverlay.ts +445 -0
  35. package/dist/dev/client/frameworkDetect.ts +63 -0
  36. package/dist/dev/client/handlers/angularHmrShim.ts +88 -0
  37. package/dist/dev/client/handlers/angularRemount.ts +362 -0
  38. package/dist/dev/client/handlers/angularRemountWiring.ts +52 -0
  39. package/dist/dev/client/handlers/html.ts +364 -0
  40. package/dist/dev/client/handlers/htmx.ts +278 -0
  41. package/dist/dev/client/handlers/react.ts +108 -0
  42. package/dist/dev/client/handlers/rebuild.ts +153 -0
  43. package/dist/dev/client/handlers/svelte.ts +334 -0
  44. package/dist/dev/client/handlers/vue.ts +292 -0
  45. package/dist/dev/client/headPatch.ts +233 -0
  46. package/dist/dev/client/hmrClient.ts +352 -0
  47. package/dist/dev/client/hmrState.ts +14 -0
  48. package/dist/dev/client/hmrToast.ts +150 -0
  49. package/dist/dev/client/moduleVersions.ts +62 -0
  50. package/dist/dev/client/reactRefreshSetup.ts +31 -0
  51. package/dist/dev/client/vendor/lview/lViewOps.ts +196 -0
  52. package/dist/dev/client/vendor/lview/slotConstants.ts +44 -0
  53. package/dist/dev/client/vendor/reactRefreshRuntime.d.ts +12 -0
  54. package/dist/dev/client/vendor/reactRefreshRuntime.js +313 -0
  55. package/dist/image-client/imageClient.js +69 -0
  56. package/dist/index.js +36383 -0
  57. package/dist/index.js.map +320 -0
  58. package/dist/islands/browser.js +259 -0
  59. package/dist/islands/browser.js.map +15 -0
  60. package/dist/islands/index.js +2415 -0
  61. package/dist/islands/index.js.map +37 -0
  62. package/dist/react/browser.js +374 -0
  63. package/dist/react/browser.js.map +19 -0
  64. package/dist/react/components/browser/index.js +467 -0
  65. package/dist/react/components/index.js +684 -0
  66. package/dist/react/components/index.js.map +18 -0
  67. package/dist/react/hooks/index.js +285 -0
  68. package/dist/react/hooks/index.js.map +14 -0
  69. package/dist/react/index.js +4258 -0
  70. package/dist/react/index.js.map +56 -0
  71. package/dist/react/jsxDevRuntimeCompat.js +90 -0
  72. package/dist/react/jsxDevRuntimeCompat.js.map +10 -0
  73. package/dist/react/router/browser.js +95 -0
  74. package/dist/react/router/browser.js.map +10 -0
  75. package/dist/react/router/index.js +95 -0
  76. package/dist/react/router/index.js.map +10 -0
  77. package/dist/react/server.js +1895 -0
  78. package/dist/react/server.js.map +26 -0
  79. package/dist/src/angular/Island.browser.d.ts +34 -0
  80. package/dist/src/angular/Island.d.ts +29 -0
  81. package/dist/src/angular/angularDeps.d.ts +2 -0
  82. package/dist/src/angular/angularPatch.d.ts +1 -0
  83. package/dist/src/angular/animationProviders.d.ts +2 -0
  84. package/dist/src/angular/browser.d.ts +14 -0
  85. package/dist/src/angular/components/constants.d.ts +96 -0
  86. package/dist/src/angular/components/defer-slot-payload.d.ts +7 -0
  87. package/dist/src/angular/components/defer-slot-templates.directive.d.ts +21 -0
  88. package/dist/src/angular/components/defer-slot.component.d.ts +29 -0
  89. package/dist/src/angular/components/image.component.d.ts +42 -0
  90. package/dist/src/angular/components/index.d.ts +4 -0
  91. package/dist/src/angular/components/stream-slot.component.d.ts +20 -0
  92. package/dist/src/angular/composables/index.d.ts +6 -0
  93. package/dist/src/angular/composables/usePageContext.d.ts +16 -0
  94. package/dist/src/angular/composables/useResource.d.ts +57 -0
  95. package/dist/src/angular/composables/useSubscription.d.ts +33 -0
  96. package/dist/src/angular/composables/useTimers.d.ts +18 -0
  97. package/dist/src/angular/createIsland.browser.d.ts +2 -0
  98. package/dist/src/angular/createIsland.d.ts +2 -0
  99. package/dist/src/angular/deterministicEnv.d.ts +26 -0
  100. package/dist/src/angular/hmrPreserveCore.d.ts +21 -0
  101. package/dist/src/angular/httpTransferCache.d.ts +12 -0
  102. package/dist/src/angular/index.d.ts +14 -0
  103. package/dist/src/angular/injectorPatch.d.ts +1 -0
  104. package/dist/src/angular/islandStore.d.ts +9 -0
  105. package/dist/src/angular/islands.d.ts +4 -0
  106. package/dist/src/angular/lowerDeferSyntax.d.ts +18 -0
  107. package/dist/src/angular/lowerServerIslands.d.ts +1 -0
  108. package/dist/src/angular/pageHandler.d.ts +48 -0
  109. package/dist/src/angular/pendingTask.d.ts +1 -0
  110. package/dist/src/angular/preserveAcrossHmr.d.ts +12 -0
  111. package/dist/src/angular/renderIsland.d.ts +2 -0
  112. package/dist/src/angular/requestProviders.d.ts +5 -0
  113. package/dist/src/angular/resolveAngularPackage.d.ts +19 -0
  114. package/dist/src/angular/routerRedirectProviders.d.ts +6 -0
  115. package/dist/src/angular/server.d.ts +4 -0
  116. package/dist/src/angular/ssrRender.d.ts +13 -0
  117. package/dist/src/angular/ssrSanitizer.d.ts +3 -0
  118. package/dist/src/angular/staticAnalyzeSpaRoutes.d.ts +7 -0
  119. package/dist/src/build/angularLinkerPlugin.d.ts +29 -0
  120. package/dist/src/build/buildAngularVendor.d.ts +40 -0
  121. package/dist/src/build/buildDepVendor.d.ts +2 -0
  122. package/dist/src/build/buildEmberVendor.d.ts +24 -0
  123. package/dist/src/build/buildReactVendor.d.ts +8 -0
  124. package/dist/src/build/buildSvelteVendor.d.ts +6 -0
  125. package/dist/src/build/buildVueVendor.d.ts +6 -0
  126. package/dist/src/build/chainInlineSourcemaps.d.ts +13 -0
  127. package/dist/src/build/compileAngular.d.ts +40 -0
  128. package/dist/src/build/compileEmber.d.ts +43 -0
  129. package/dist/src/build/compileSvelte.d.ts +14 -0
  130. package/dist/src/build/compileTailwind.d.ts +5 -0
  131. package/dist/src/build/compileVue.d.ts +22 -0
  132. package/dist/src/build/externalAssetPlugin.d.ts +2 -0
  133. package/dist/src/build/generateManifest.d.ts +2 -0
  134. package/dist/src/build/generateReactIndexes.d.ts +2 -0
  135. package/dist/src/build/htmlScriptHMRPlugin.d.ts +13 -0
  136. package/dist/src/build/index.d.ts +2 -0
  137. package/dist/src/build/islandEntries.d.ts +32 -0
  138. package/dist/src/build/islandRegistryTransform.d.ts +17 -0
  139. package/dist/src/build/nativeRewrite.d.ts +5 -0
  140. package/dist/src/build/optimizeHtmlImages.d.ts +2 -0
  141. package/dist/src/build/outputLogs.d.ts +1 -0
  142. package/dist/src/build/parseAngularConfigImports.d.ts +9 -0
  143. package/dist/src/build/parseVueSpaRoutes.d.ts +20 -0
  144. package/dist/src/build/resolvePackageImport.d.ts +9 -0
  145. package/dist/src/build/rewriteImports.d.ts +8 -0
  146. package/dist/src/build/rewriteImportsPlugin.d.ts +48 -0
  147. package/dist/src/build/rewriteReactImports.d.ts +7 -0
  148. package/dist/src/build/runAngularHandlerScan.d.ts +7 -0
  149. package/dist/src/build/scanAngularHandlerCalls.d.ts +13 -0
  150. package/dist/src/build/scanAngularPageRoutes.d.ts +10 -0
  151. package/dist/src/build/scanConventions.d.ts +5 -0
  152. package/dist/src/build/scanCssEntryPoints.d.ts +1 -0
  153. package/dist/src/build/scanEntryPoints.d.ts +1 -0
  154. package/dist/src/build/scanRouteRegistrations.d.ts +23 -0
  155. package/dist/src/build/scanVueSsrOnlyPages.d.ts +6 -0
  156. package/dist/src/build/staticIslandPages.d.ts +9 -0
  157. package/dist/src/build/stylePreprocessor.d.ts +26 -0
  158. package/dist/src/build/tailwindCompiler.d.ts +8 -0
  159. package/dist/src/build/updateAssetPaths.d.ts +1 -0
  160. package/dist/src/build/vendorEntrySource.d.ts +1 -0
  161. package/dist/src/build/verifyAngularCoreUniqueness.d.ts +2 -0
  162. package/dist/src/build/vueAutoRouterTransform.d.ts +1 -0
  163. package/dist/src/build/wrapHTMLScript.d.ts +17 -0
  164. package/dist/src/build.d.ts +2 -0
  165. package/dist/src/cli/add/dependencies.d.ts +12 -0
  166. package/dist/src/cli/cache.d.ts +15 -0
  167. package/dist/src/cli/config/absolute/AbsoluteConfigPanel.d.ts +6 -0
  168. package/dist/src/cli/config/absolute/editAbsoluteConfig.d.ts +5 -0
  169. package/dist/src/cli/config/absolute/resolveAbsoluteConfig.d.ts +14 -0
  170. package/dist/src/cli/config/client.d.ts +1 -0
  171. package/dist/src/cli/config/configCert.d.ts +12 -0
  172. package/dist/src/cli/config/eslint/EslintPanel.d.ts +6 -0
  173. package/dist/src/cli/config/eslint/configAst.d.ts +18 -0
  174. package/dist/src/cli/config/eslint/editConfigRule.d.ts +6 -0
  175. package/dist/src/cli/config/eslint/eslintStyles.d.ts +1 -0
  176. package/dist/src/cli/config/eslint/resolveConfig.d.ts +3 -0
  177. package/dist/src/cli/config/eslint/serializeValue.d.ts +9 -0
  178. package/dist/src/cli/config/guards.d.ts +4 -0
  179. package/dist/src/cli/config/packageJson/PackageJsonPanel.d.ts +6 -0
  180. package/dist/src/cli/config/packageJson/editPackageJson.d.ts +9 -0
  181. package/dist/src/cli/config/packageJson/resolvePackageJson.d.ts +9 -0
  182. package/dist/src/cli/config/page/ConfigShell.d.ts +6 -0
  183. package/dist/src/cli/config/page/FieldEditor.d.ts +9 -0
  184. package/dist/src/cli/config/page/PanelHost.d.ts +6 -0
  185. package/dist/src/cli/config/page/configStyles.d.ts +1 -0
  186. package/dist/src/cli/config/panels.d.ts +7 -0
  187. package/dist/src/cli/config/prettier/PrettierPanel.d.ts +6 -0
  188. package/dist/src/cli/config/prettier/editPrettier.d.ts +5 -0
  189. package/dist/src/cli/config/prettier/resolvePrettier.d.ts +11 -0
  190. package/dist/src/cli/config/schema/fromJsonSchema.d.ts +3 -0
  191. package/dist/src/cli/config/schema/fromType.d.ts +2 -0
  192. package/dist/src/cli/config/schema/serialize.d.ts +1 -0
  193. package/dist/src/cli/config/server.d.ts +298 -0
  194. package/dist/src/cli/config/tsconfig/TsconfigPanel.d.ts +6 -0
  195. package/dist/src/cli/config/tsconfig/editTsconfig.d.ts +5 -0
  196. package/dist/src/cli/config/tsconfig/resolveTsconfig.d.ts +8 -0
  197. package/dist/src/cli/config/tsconfig/tsconfigStyles.d.ts +1 -0
  198. package/dist/src/cli/discoverInstances.d.ts +5 -0
  199. package/dist/src/cli/generate/componentTemplates.d.ts +7 -0
  200. package/dist/src/cli/generate/context.d.ts +30 -0
  201. package/dist/src/cli/generate/cssStrategy.d.ts +20 -0
  202. package/dist/src/cli/generate/frameworkKey.d.ts +3 -0
  203. package/dist/src/cli/generate/frameworks.d.ts +40 -0
  204. package/dist/src/cli/generate/generateApi.d.ts +3 -0
  205. package/dist/src/cli/generate/generateComponent.d.ts +4 -0
  206. package/dist/src/cli/generate/generatePage.d.ts +4 -0
  207. package/dist/src/cli/generate/naming.d.ts +5 -0
  208. package/dist/src/cli/generate/navData.d.ts +10 -0
  209. package/dist/src/cli/generate/outcome.d.ts +17 -0
  210. package/dist/src/cli/generate/pageTemplates.d.ts +11 -0
  211. package/dist/src/cli/generate/routeWiring.d.ts +40 -0
  212. package/dist/src/cli/generate/staticNav.d.ts +5 -0
  213. package/dist/src/cli/heapDiff.d.ts +1 -0
  214. package/dist/src/cli/htmx/install.d.ts +6 -0
  215. package/dist/src/cli/index.d.ts +2 -0
  216. package/dist/src/cli/inspectData.d.ts +12 -0
  217. package/dist/src/cli/inspectTui.d.ts +1 -0
  218. package/dist/src/cli/instanceStatus.d.ts +22 -0
  219. package/dist/src/cli/interactive.d.ts +2 -0
  220. package/dist/src/cli/psTui.d.ts +1 -0
  221. package/dist/src/cli/scripts/add.d.ts +1 -0
  222. package/dist/src/cli/scripts/analyze.d.ts +1 -0
  223. package/dist/src/cli/scripts/api.d.ts +1 -0
  224. package/dist/src/cli/scripts/build.d.ts +1 -0
  225. package/dist/src/cli/scripts/compile.d.ts +2 -0
  226. package/dist/src/cli/scripts/dev.d.ts +1 -0
  227. package/dist/src/cli/scripts/doctor.d.ts +1 -0
  228. package/dist/src/cli/scripts/env.d.ts +7 -0
  229. package/dist/src/cli/scripts/eslint.d.ts +16 -0
  230. package/dist/src/cli/scripts/generate.d.ts +1 -0
  231. package/dist/src/cli/scripts/htmx.d.ts +1 -0
  232. package/dist/src/cli/scripts/info.d.ts +1 -0
  233. package/dist/src/cli/scripts/inspect.d.ts +1 -0
  234. package/dist/src/cli/scripts/islands.d.ts +1 -0
  235. package/dist/src/cli/scripts/logs.d.ts +1 -0
  236. package/dist/src/cli/scripts/ls.d.ts +1 -0
  237. package/dist/src/cli/scripts/mem.d.ts +1 -0
  238. package/dist/src/cli/scripts/prettier.d.ts +3 -0
  239. package/dist/src/cli/scripts/ps.d.ts +1 -0
  240. package/dist/src/cli/scripts/remove.d.ts +1 -0
  241. package/dist/src/cli/scripts/routes.d.ts +1 -0
  242. package/dist/src/cli/scripts/start.d.ts +1 -0
  243. package/dist/src/cli/scripts/telemetry.d.ts +5 -0
  244. package/dist/src/cli/scripts/tunnelRelay.d.ts +9 -0
  245. package/dist/src/cli/scripts/typecheck.d.ts +1 -0
  246. package/dist/src/cli/scripts/workspace.d.ts +11 -0
  247. package/dist/src/cli/telemetryEvent.d.ts +1 -0
  248. package/dist/src/cli/tuiPrimitives.d.ts +14 -0
  249. package/dist/src/cli/utils.d.ts +15 -0
  250. package/dist/src/cli/workspaceTui.d.ts +44 -0
  251. package/dist/src/client/hydrators/react.d.ts +3 -0
  252. package/dist/src/client/hydrators/svelte.d.ts +2 -0
  253. package/dist/src/client/hydrators/vue.d.ts +2 -0
  254. package/dist/src/client/index.d.ts +4 -0
  255. package/dist/src/client/islandResolver.d.ts +2 -0
  256. package/dist/src/client/islandRuntime.d.ts +9 -0
  257. package/dist/src/client/islandStore.d.ts +22 -0
  258. package/dist/src/client/preserveIslandMarkup.d.ts +16 -0
  259. package/dist/src/client/streamSwap.d.ts +1 -0
  260. package/dist/src/constants.d.ts +96 -0
  261. package/dist/src/core/angularServerModule.d.ts +1 -0
  262. package/dist/src/core/build.d.ts +14 -0
  263. package/dist/src/core/currentIslandRegistry.d.ts +7 -0
  264. package/dist/src/core/devBuild.d.ts +23 -0
  265. package/dist/src/core/devRouteRegistrationCallsite.d.ts +4 -0
  266. package/dist/src/core/devVendorPaths.d.ts +17 -0
  267. package/dist/src/core/index.d.ts +7 -0
  268. package/dist/src/core/islandManifest.d.ts +3 -0
  269. package/dist/src/core/islandMarkupAttributes.d.ts +12 -0
  270. package/dist/src/core/islandPageContext.d.ts +12 -0
  271. package/dist/src/core/islandSsr.d.ts +6 -0
  272. package/dist/src/core/islands.d.ts +16 -0
  273. package/dist/src/core/loadIslandRegistry.d.ts +1 -0
  274. package/dist/src/core/lookup.d.ts +1 -0
  275. package/dist/src/core/normalizeIslandProps.d.ts +15 -0
  276. package/dist/src/core/pageHandlers.d.ts +5 -0
  277. package/dist/src/core/prepare.d.ts +417 -0
  278. package/dist/src/core/prerender.d.ts +31 -0
  279. package/dist/src/core/renderIslandMarkup.d.ts +13 -0
  280. package/dist/src/core/responseEnhancers.d.ts +10 -0
  281. package/dist/src/core/staticStreaming.d.ts +25 -0
  282. package/dist/src/core/streamingSlotRegistrar.d.ts +16 -0
  283. package/dist/src/core/streamingSlotRegistry.d.ts +2 -0
  284. package/dist/src/core/streamingSlotWarningScope.d.ts +4 -0
  285. package/dist/src/core/svelteServerModule.d.ts +1 -0
  286. package/dist/src/core/vueServerModule.d.ts +1 -0
  287. package/dist/src/core/wrapPageHandlerWithStreamingSlots.d.ts +2 -0
  288. package/dist/src/dev/angular/fastHmrCompiler.d.ts +58 -0
  289. package/dist/src/dev/angular/hmrCompiler.d.ts +2 -0
  290. package/dist/src/dev/angular/hmrImportGenerator.d.ts +3 -0
  291. package/dist/src/dev/angular/hmrInjectionPlugin.d.ts +8 -0
  292. package/dist/src/dev/angular/resolveOwningComponents.d.ts +16 -0
  293. package/dist/src/dev/angular/vendor/translator/api/ast_factory.d.ts +363 -0
  294. package/dist/src/dev/angular/vendor/translator/api/import_generator.d.ts +49 -0
  295. package/dist/src/dev/angular/vendor/translator/context.d.ts +18 -0
  296. package/dist/src/dev/angular/vendor/translator/translator.d.ts +75 -0
  297. package/dist/src/dev/angular/vendor/translator/ts_util.d.ts +12 -0
  298. package/dist/src/dev/angular/vendor/translator/typescript_ast_factory.d.ts +66 -0
  299. package/dist/src/dev/angular/vendor/translator/typescript_translator.d.ts +13 -0
  300. package/dist/src/dev/assetStore.d.ts +8 -0
  301. package/dist/src/dev/buildHMRClient.d.ts +1 -0
  302. package/dist/src/dev/clientManager.d.ts +33 -0
  303. package/dist/src/dev/configResolver.d.ts +16 -0
  304. package/dist/src/dev/dependencyGraph.d.ts +10 -0
  305. package/dist/src/dev/devCert.d.ts +11 -0
  306. package/dist/src/dev/fileHashTracker.d.ts +2 -0
  307. package/dist/src/dev/fileWatcher.d.ts +4 -0
  308. package/dist/src/dev/moduleMapper.d.ts +27 -0
  309. package/dist/src/dev/moduleServer.d.ts +24 -0
  310. package/dist/src/dev/moduleVersionTracker.d.ts +7 -0
  311. package/dist/src/dev/pathUtils.d.ts +8 -0
  312. package/dist/src/dev/reactComponentClassifier.d.ts +2 -0
  313. package/dist/src/dev/rebuildTrigger.d.ts +11 -0
  314. package/dist/src/dev/requestInspector.d.ts +43 -0
  315. package/dist/src/dev/serverEntryWatcher.d.ts +5 -0
  316. package/dist/src/dev/simpleHTMLHMR.d.ts +4 -0
  317. package/dist/src/dev/simpleHTMXHMR.d.ts +4 -0
  318. package/dist/src/dev/transformCache.d.ts +22 -0
  319. package/dist/src/dev/tunnel/client.d.ts +20 -0
  320. package/dist/src/dev/tunnel/protocol.d.ts +85 -0
  321. package/dist/src/dev/tunnel/relay.d.ts +28 -0
  322. package/dist/src/dev/webSocket.d.ts +9 -0
  323. package/dist/src/ember/browser.d.ts +24 -0
  324. package/dist/src/ember/index.d.ts +2 -0
  325. package/dist/src/ember/pageHandler.d.ts +35 -0
  326. package/dist/src/ember/server.d.ts +2 -0
  327. package/dist/src/index.d.ts +7 -0
  328. package/dist/src/islands/browser.d.ts +3 -0
  329. package/dist/src/islands/index.d.ts +3 -0
  330. package/dist/src/islands/pageMetadata.d.ts +13 -0
  331. package/dist/src/islands/sourceMetadata.d.ts +10 -0
  332. package/dist/src/plugins/devtoolsJson.d.ts +58 -0
  333. package/dist/src/plugins/hmr.d.ts +163 -0
  334. package/dist/src/plugins/imageOptimizer.d.ts +67 -0
  335. package/dist/src/plugins/index.d.ts +3 -0
  336. package/dist/src/plugins/networking.d.ts +2 -0
  337. package/dist/src/plugins/pageRouter.d.ts +1 -0
  338. package/dist/src/react/Island.browser.d.ts +2 -0
  339. package/dist/src/react/Island.d.ts +2 -0
  340. package/dist/src/react/bridgeInternals.d.ts +1 -0
  341. package/dist/src/react/browser.d.ts +3 -0
  342. package/dist/src/react/components/Head.d.ts +2 -0
  343. package/dist/src/react/components/Image.d.ts +2 -0
  344. package/dist/src/react/components/JsonLd.d.ts +4 -0
  345. package/dist/src/react/components/StreamSlot.browser.d.ts +10 -0
  346. package/dist/src/react/components/StreamSlot.d.ts +10 -0
  347. package/dist/src/react/components/SuspenseSlot.browser.d.ts +22 -0
  348. package/dist/src/react/components/SuspenseSlot.d.ts +37 -0
  349. package/dist/src/react/components/browser/index.d.ts +5 -0
  350. package/dist/src/react/components/index.d.ts +5 -0
  351. package/dist/src/react/createIsland.browser.d.ts +2 -0
  352. package/dist/src/react/createIsland.d.ts +2 -0
  353. package/dist/src/react/hooks/index.d.ts +3 -0
  354. package/dist/src/react/hooks/useIslandStore.d.ts +3 -0
  355. package/dist/src/react/hooks/useMediaQuery.d.ts +7 -0
  356. package/dist/src/react/index.d.ts +4 -0
  357. package/dist/src/react/jsxDevRuntimeCompat.d.ts +8 -0
  358. package/dist/src/react/pageHandler.d.ts +25 -0
  359. package/dist/src/react/router/UniversalRouter.d.ts +43 -0
  360. package/dist/src/react/router/browser.d.ts +2 -0
  361. package/dist/src/react/router/index.d.ts +2 -0
  362. package/dist/src/react/server.d.ts +1 -0
  363. package/dist/src/react/staticAnalyzeSpaRoutes.d.ts +7 -0
  364. package/dist/src/svelte/browser.d.ts +4 -0
  365. package/dist/src/svelte/createIsland.browser.d.ts +2 -0
  366. package/dist/src/svelte/createIsland.d.ts +2 -0
  367. package/dist/src/svelte/index.d.ts +6 -0
  368. package/dist/src/svelte/islandStore.d.ts +5 -0
  369. package/dist/src/svelte/lowerAwaitSlotSyntax.d.ts +4 -0
  370. package/dist/src/svelte/lowerIslandSyntax.d.ts +4 -0
  371. package/dist/src/svelte/pageHandler.d.ts +28 -0
  372. package/dist/src/svelte/renderIsland.d.ts +2 -0
  373. package/dist/src/svelte/renderToPipeableStream.d.ts +12 -0
  374. package/dist/src/svelte/renderToReadableStream.d.ts +14 -0
  375. package/dist/src/svelte/renderToString.d.ts +9 -0
  376. package/dist/src/svelte/resolveIslandHtml.browser.d.ts +2 -0
  377. package/dist/src/svelte/resolveIslandHtml.d.ts +2 -0
  378. package/dist/src/svelte/router/browser.d.ts +4 -0
  379. package/dist/src/svelte/router/goto.d.ts +15 -0
  380. package/dist/src/svelte/router/hashMode.d.ts +16 -0
  381. package/dist/src/svelte/router/index.d.ts +4 -0
  382. package/dist/src/svelte/router/matchPath.d.ts +30 -0
  383. package/dist/src/svelte/router/page.svelte.d.ts +15 -0
  384. package/dist/src/svelte/router/prefetchCache.d.ts +17 -0
  385. package/dist/src/svelte/router/pushState.d.ts +13 -0
  386. package/dist/src/svelte/router/viewTransitions.d.ts +6 -0
  387. package/dist/src/svelte/server.d.ts +1 -0
  388. package/dist/src/svelte/staticAnalyzeSpaRoutes.d.ts +7 -0
  389. package/dist/src/utils/buildDirectoryLock.d.ts +28 -0
  390. package/dist/src/utils/cleanStaleOutputs.d.ts +1 -0
  391. package/dist/src/utils/cleanup.d.ts +9 -0
  392. package/dist/src/utils/commonAncestor.d.ts +1 -0
  393. package/dist/src/utils/defineConfig.d.ts +39 -0
  394. package/dist/src/utils/defineConvention.d.ts +3 -0
  395. package/dist/src/utils/defineEnv.d.ts +10 -0
  396. package/dist/src/utils/escapeScriptContent.d.ts +1 -0
  397. package/dist/src/utils/formatBytes.d.ts +2 -0
  398. package/dist/src/utils/generateHeadElement.d.ts +4 -0
  399. package/dist/src/utils/generateSitemap.d.ts +21 -0
  400. package/dist/src/utils/generatedDir.d.ts +3 -0
  401. package/dist/src/utils/getDurationString.d.ts +1 -0
  402. package/dist/src/utils/getEnv.d.ts +1 -0
  403. package/dist/src/utils/imageClient.d.ts +13 -0
  404. package/dist/src/utils/imageProcessing.d.ts +33 -0
  405. package/dist/src/utils/index.d.ts +11 -0
  406. package/dist/src/utils/inlinePageCss.d.ts +2 -0
  407. package/dist/src/utils/instanceRegistry.d.ts +13 -0
  408. package/dist/src/utils/jsonLd.d.ts +3 -0
  409. package/dist/src/utils/loadConfig.d.ts +55 -0
  410. package/dist/src/utils/logger.d.ts +56 -0
  411. package/dist/src/utils/networking.d.ts +2 -0
  412. package/dist/src/utils/normalizePath.d.ts +9 -0
  413. package/dist/src/utils/portScan.d.ts +22 -0
  414. package/dist/src/utils/projectRoot.d.ts +17 -0
  415. package/dist/src/utils/registerClientScript.d.ts +36 -0
  416. package/dist/src/utils/resolveConvention.d.ts +10 -0
  417. package/dist/src/utils/resolveDevPort.d.ts +24 -0
  418. package/dist/src/utils/runtimeMode.d.ts +3 -0
  419. package/dist/src/utils/spaRouteCss.d.ts +4 -0
  420. package/dist/src/utils/spaRouteTypes.d.ts +25 -0
  421. package/dist/src/utils/ssrErrorPage.d.ts +1 -0
  422. package/dist/src/utils/startupBanner.d.ts +10 -0
  423. package/dist/src/utils/startupTimings.d.ts +7 -0
  424. package/dist/src/utils/streamingSlotMetricSink.d.ts +18 -0
  425. package/dist/src/utils/streamingSlots.d.ts +76 -0
  426. package/dist/src/utils/stringModifiers.d.ts +3 -0
  427. package/dist/src/utils/userAgentFunctions.d.ts +1 -0
  428. package/dist/src/utils/validateSafePath.d.ts +1 -0
  429. package/dist/src/vue/Island.browser.d.ts +37 -0
  430. package/dist/src/vue/Island.d.ts +36 -0
  431. package/dist/src/vue/browser.d.ts +6 -0
  432. package/dist/src/vue/components/Image.d.ts +74 -0
  433. package/dist/src/vue/components/StreamSlot.d.ts +22 -0
  434. package/dist/src/vue/components/SuspenseSlot.d.ts +26 -0
  435. package/dist/src/vue/components/index.d.ts +3 -0
  436. package/dist/src/vue/createIsland.browser.d.ts +13 -0
  437. package/dist/src/vue/createIsland.d.ts +13 -0
  438. package/dist/src/vue/defineVuePage.d.ts +6 -0
  439. package/dist/src/vue/index.d.ts +9 -0
  440. package/dist/src/vue/pageHandler.d.ts +45 -0
  441. package/dist/src/vue/routerRedirectProviders.d.ts +45 -0
  442. package/dist/src/vue/server.d.ts +2 -0
  443. package/dist/src/vue/staticAnalyzeSpaRoutes.d.ts +7 -0
  444. package/dist/src/vue/useIslandStore.d.ts +3 -0
  445. package/dist/svelte/browser.js +309 -0
  446. package/dist/svelte/browser.js.map +19 -0
  447. package/dist/svelte/components/AwaitSlot.svelte +39 -0
  448. package/dist/svelte/components/AwaitSlot.svelte.d.ts +2 -0
  449. package/dist/svelte/components/Head.svelte +144 -0
  450. package/dist/svelte/components/Head.svelte.d.ts +2 -0
  451. package/dist/svelte/components/Image.svelte +164 -0
  452. package/dist/svelte/components/Image.svelte.d.ts +5 -0
  453. package/dist/svelte/components/Island.svelte +71 -0
  454. package/dist/svelte/components/Island.svelte.d.ts +5 -0
  455. package/dist/svelte/components/JsonLd.svelte +21 -0
  456. package/dist/svelte/components/JsonLd.svelte.d.ts +2 -0
  457. package/dist/svelte/components/StreamSlot.svelte +41 -0
  458. package/dist/svelte/components/StreamSlot.svelte.d.ts +2 -0
  459. package/dist/svelte/index.js +4371 -0
  460. package/dist/svelte/index.js.map +60 -0
  461. package/dist/svelte/router/Link.svelte +124 -0
  462. package/dist/svelte/router/Link.svelte.d.ts +21 -0
  463. package/dist/svelte/router/Route.svelte +54 -0
  464. package/dist/svelte/router/Route.svelte.d.ts +13 -0
  465. package/dist/svelte/router/Router.svelte +189 -0
  466. package/dist/svelte/router/Router.svelte.d.ts +16 -0
  467. package/dist/svelte/router/browser.ts +14 -0
  468. package/dist/svelte/router/goto.ts +89 -0
  469. package/dist/svelte/router/hashMode.ts +31 -0
  470. package/dist/svelte/router/index.ts +23 -0
  471. package/dist/svelte/router/matchPath.ts +136 -0
  472. package/dist/svelte/router/page.d.ts +15 -0
  473. package/dist/svelte/router/page.js +27 -0
  474. package/dist/svelte/router/prefetchCache.ts +85 -0
  475. package/dist/svelte/router/pushState.ts +35 -0
  476. package/dist/svelte/router/viewTransitions.ts +35 -0
  477. package/dist/svelte/server.js +2996 -0
  478. package/dist/svelte/server.js.map +33 -0
  479. package/dist/types/absoluteConfig.d.ts +22 -0
  480. package/dist/types/angular.d.ts +43 -0
  481. package/dist/types/build.d.ts +245 -0
  482. package/dist/types/cli.d.ts +74 -0
  483. package/dist/types/client.d.ts +70 -0
  484. package/dist/types/config.d.ts +50 -0
  485. package/dist/types/conventions.d.ts +26 -0
  486. package/dist/types/ember.d.ts +39 -0
  487. package/dist/types/env.d.ts +2 -0
  488. package/dist/types/eslintConfig.d.ts +68 -0
  489. package/dist/types/globals.d.ts +163 -0
  490. package/dist/types/image.d.ts +77 -0
  491. package/dist/types/index.d.ts +17 -0
  492. package/dist/types/island.d.ts +52 -0
  493. package/dist/types/jsonLd.d.ts +300 -0
  494. package/dist/types/mediaQuery.d.ts +9 -0
  495. package/dist/types/messages.d.ts +152 -0
  496. package/dist/types/metadata.d.ts +51 -0
  497. package/dist/types/packageJson.d.ts +74 -0
  498. package/dist/types/packageJsonPanel.d.ts +29 -0
  499. package/dist/types/prettier.d.ts +26 -0
  500. package/dist/types/react.d.ts +2 -0
  501. package/dist/types/sitemap.d.ts +24 -0
  502. package/dist/types/style-module-shim.d.ts +29 -0
  503. package/dist/types/svelte.d.ts +2 -0
  504. package/dist/types/svelteRouter.d.ts +65 -0
  505. package/dist/types/svelteRouter.ts +91 -0
  506. package/dist/types/telemetry.d.ts +15 -0
  507. package/dist/types/tool.d.ts +11 -0
  508. package/dist/types/tsconfig.d.ts +31 -0
  509. package/dist/types/typeGuards.d.ts +2 -0
  510. package/dist/types/userAgentTypes.d.ts +2 -0
  511. package/dist/types/vue.d.ts +56 -0
  512. package/dist/types/websocket.d.ts +6 -0
  513. package/dist/vue/browser.js +512 -0
  514. package/dist/vue/browser.js.map +22 -0
  515. package/dist/vue/components/Image.js +264 -0
  516. package/dist/vue/components/Image.js.map +12 -0
  517. package/dist/vue/components/index.js +571 -0
  518. package/dist/vue/components/index.js.map +15 -0
  519. package/dist/vue/index.js +5238 -0
  520. package/dist/vue/index.js.map +69 -0
  521. package/dist/vue/server.js +2251 -0
  522. package/dist/vue/server.js.map +32 -0
  523. package/package.json +1 -1
@@ -0,0 +1,2415 @@
1
+ // @bun
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
13
+ var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
21
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
22
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
+ for (let key of __getOwnPropNames(mod))
24
+ if (!__hasOwnProp.call(to, key))
25
+ __defProp(to, key, {
26
+ get: __accessProp.bind(mod, key),
27
+ enumerable: true
28
+ });
29
+ if (canCache)
30
+ cache.set(mod, to);
31
+ return to;
32
+ };
33
+ var __toCommonJS = (from) => {
34
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
35
+ if (entry)
36
+ return entry;
37
+ entry = __defProp({}, "__esModule", { value: true });
38
+ if (from && typeof from === "object" || typeof from === "function") {
39
+ for (var key of __getOwnPropNames(from))
40
+ if (!__hasOwnProp.call(entry, key))
41
+ __defProp(entry, key, {
42
+ get: __accessProp.bind(from, key),
43
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
+ });
45
+ }
46
+ __moduleCache.set(from, entry);
47
+ return entry;
48
+ };
49
+ var __moduleCache;
50
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
51
+ var __returnValue = (v) => v;
52
+ function __exportSetter(name, newValue) {
53
+ this[name] = __returnValue.bind(null, newValue);
54
+ }
55
+ var __export = (target, all) => {
56
+ for (var name in all)
57
+ __defProp(target, name, {
58
+ get: all[name],
59
+ enumerable: true,
60
+ configurable: true,
61
+ set: __exportSetter.bind(all, name)
62
+ });
63
+ };
64
+ var __legacyDecorateClassTS = function(decorators, target, key, desc) {
65
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
66
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
67
+ r = Reflect.decorate(decorators, target, key, desc);
68
+ else
69
+ for (var i = decorators.length - 1;i >= 0; i--)
70
+ if (d = decorators[i])
71
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
72
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
73
+ };
74
+ var __legacyMetadataTS = (k, v) => {
75
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
76
+ return Reflect.metadata(k, v);
77
+ };
78
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
79
+ var __require = import.meta.require;
80
+
81
+ // src/core/islandManifest.ts
82
+ var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1), collectFrameworkIslands = (manifest, prefix) => {
83
+ const entries = {};
84
+ let found = false;
85
+ for (const [key, value] of Object.entries(manifest)) {
86
+ if (!key.startsWith(prefix))
87
+ continue;
88
+ const component = key.slice(prefix.length);
89
+ if (!component)
90
+ continue;
91
+ entries[component] = value;
92
+ found = true;
93
+ }
94
+ return found ? entries : undefined;
95
+ }, getIslandManifestEntries = (manifest) => {
96
+ const islands = {};
97
+ const frameworks = ["react", "svelte", "vue", "angular"];
98
+ for (const framework of frameworks) {
99
+ const prefix = `Island${toIslandFrameworkSegment(framework)}`;
100
+ const entries = collectFrameworkIslands(manifest, prefix);
101
+ if (entries)
102
+ islands[framework] = entries;
103
+ }
104
+ return islands;
105
+ }, getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
106
+
107
+ // src/core/islands.ts
108
+ function getIslandComponent(component) {
109
+ if (isIslandComponentDefinition(component)) {
110
+ return component.component;
111
+ }
112
+ return component;
113
+ }
114
+ var defineIslandComponent = (component, options) => ({
115
+ component,
116
+ export: options.export,
117
+ source: options.source
118
+ }), defineIslandRegistry = (registry) => registry, isRecord = (value) => typeof value === "object" && value !== null, getIslandBuildReference = (component) => {
119
+ if (!isIslandComponentDefinition(component))
120
+ return null;
121
+ return {
122
+ export: component.export,
123
+ source: component.source
124
+ };
125
+ }, isIslandComponentDefinition = (value) => isRecord(value) && ("component" in value) && ("source" in value) && typeof value.source === "string", parseIslandProps = (rawProps) => {
126
+ if (!rawProps)
127
+ return {};
128
+ return JSON.parse(rawProps);
129
+ }, serializeIslandProps = (props) => JSON.stringify(props ?? {});
130
+ var init_islands = () => {};
131
+
132
+ // src/angular/resolveAngularPackage.ts
133
+ import { existsSync, readFileSync } from "fs";
134
+ import { join, resolve } from "path";
135
+ var resolveAngularPackageDir = (specifier) => {
136
+ const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ? resolve(process.env.ABSOLUTE_BUILD_DIR, "node_modules", specifier) : null;
137
+ if (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {
138
+ return fromCompiledRuntime;
139
+ }
140
+ const fromProject = resolve(process.cwd(), "node_modules", specifier);
141
+ if (existsSync(fromProject)) {
142
+ return fromProject;
143
+ }
144
+ return null;
145
+ }, resolvePackageEntry = (packageDir) => {
146
+ try {
147
+ const pkg = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8"));
148
+ const rootExport = pkg.exports?.["."];
149
+ const entry = (typeof rootExport === "string" ? rootExport : rootExport?.default) ?? pkg.module ?? pkg.main ?? "index.js";
150
+ return join(packageDir, entry);
151
+ } catch {
152
+ return packageDir;
153
+ }
154
+ }, resolveAngularPackage = (specifier) => {
155
+ const packageDir = resolveAngularPackageDir(specifier);
156
+ if (packageDir)
157
+ return resolvePackageEntry(packageDir);
158
+ return specifier;
159
+ }, toSafeVendorName = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), resolveAngularRuntimePath = (specifier) => {
160
+ const buildDirs = [
161
+ process.env.ABSOLUTE_BUILD_DIR,
162
+ resolve(process.cwd(), "build")
163
+ ].filter((value) => Boolean(value));
164
+ for (const buildDir of buildDirs) {
165
+ const vendorPath = join(buildDir, "angular", "vendor", "server", `${toSafeVendorName(specifier)}.js`);
166
+ if (existsSync(vendorPath))
167
+ return vendorPath;
168
+ }
169
+ return resolveAngularPackage(specifier);
170
+ };
171
+ var init_resolveAngularPackage = () => {};
172
+
173
+ // src/utils/runtimeMode.ts
174
+ var ENV_VAR = "NODE_ENV", isDevelopmentRuntime = () => process.env[ENV_VAR] === "development", isProductionRuntime = () => process.env[ENV_VAR] === "production";
175
+
176
+ // src/angular/angularPatch.ts
177
+ var exports_angularPatch = {};
178
+ __export(exports_angularPatch, {
179
+ applyPatches: () => applyPatches
180
+ });
181
+ var ensureHead = (doc) => {
182
+ if (!doc || doc.head || !doc.documentElement) {
183
+ return;
184
+ }
185
+ const head = doc.createElement("head");
186
+ doc.documentElement.insertBefore(head, doc.documentElement.firstChild);
187
+ }, SSR_LAYOUT_RECT, layoutPatchApplied = false, collectPrototypeChain = (instance) => {
188
+ const protos = [];
189
+ let current = instance ? Object.getPrototypeOf(instance) : null;
190
+ while (current && current !== Object.prototype) {
191
+ protos.push(current);
192
+ current = Object.getPrototypeOf(current);
193
+ }
194
+ return protos;
195
+ }, patchElementLayout = (doc) => {
196
+ if (layoutPatchApplied || !doc) {
197
+ return;
198
+ }
199
+ let element;
200
+ try {
201
+ element = doc.createElement("div");
202
+ } catch {
203
+ return;
204
+ }
205
+ const protos = collectPrototypeChain(element);
206
+ if (protos.length === 0)
207
+ return;
208
+ const copyLayoutRect = (rect) => ({ ...rect });
209
+ const createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);
210
+ const getClientRects = () => [];
211
+ const noop = () => {
212
+ return;
213
+ };
214
+ const numericProps = [
215
+ "clientWidth",
216
+ "clientHeight",
217
+ "clientLeft",
218
+ "clientTop",
219
+ "offsetWidth",
220
+ "offsetHeight",
221
+ "offsetLeft",
222
+ "offsetTop",
223
+ "scrollWidth",
224
+ "scrollHeight",
225
+ "scrollLeft",
226
+ "scrollTop"
227
+ ];
228
+ for (const proto of protos) {
229
+ const define = (name, value) => {
230
+ const descriptor = Object.getOwnPropertyDescriptor(proto, name);
231
+ if (typeof descriptor?.value === "function")
232
+ return;
233
+ Object.defineProperty(proto, name, {
234
+ configurable: true,
235
+ value,
236
+ writable: true
237
+ });
238
+ };
239
+ define("getBoundingClientRect", createLayoutRect);
240
+ define("getClientRects", getClientRects);
241
+ define("scrollTo", noop);
242
+ define("scrollBy", noop);
243
+ define("scrollIntoView", noop);
244
+ define("focus", noop);
245
+ define("blur", noop);
246
+ for (const prop of numericProps) {
247
+ const desc = Object.getOwnPropertyDescriptor(proto, prop);
248
+ if (desc)
249
+ continue;
250
+ Object.defineProperty(proto, prop, {
251
+ configurable: true,
252
+ get: () => 0
253
+ });
254
+ }
255
+ }
256
+ layoutPatchApplied = true;
257
+ }, applyPatches = async () => {
258
+ const spec = isProductionRuntime() ? resolveAngularRuntimePath("@angular/platform-server") : "@angular/platform-server";
259
+ const { \u{275}DominoAdapter } = await import(spec);
260
+ if (!\u{275}DominoAdapter?.prototype) {
261
+ console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
262
+ return false;
263
+ }
264
+ try {
265
+ const adapter = new \u{275}DominoAdapter;
266
+ const resolveSeedDoc = () => {
267
+ if (typeof adapter.createHtmlDocument === "function")
268
+ return adapter.createHtmlDocument();
269
+ if (typeof adapter.getDefaultDocument === "function")
270
+ return adapter.getDefaultDocument();
271
+ return null;
272
+ };
273
+ const seedDoc = resolveSeedDoc();
274
+ if (seedDoc) {
275
+ patchElementLayout(seedDoc);
276
+ const probe = seedDoc.createElement("div");
277
+ if (typeof probe.getBoundingClientRect !== "function") {
278
+ console.warn("[Angular Patch] Layout shim did not stick on probe element prototype chain");
279
+ }
280
+ }
281
+ } catch (error) {
282
+ console.warn("[Angular Patch] Could not eagerly patch Element prototypes:", error);
283
+ }
284
+ const proto = \u{275}DominoAdapter.prototype;
285
+ const origGetBaseHref = proto.getBaseHref;
286
+ proto.getBaseHref = function(doc) {
287
+ if (!doc || !doc.head || typeof doc.head.children === "undefined") {
288
+ return "";
289
+ }
290
+ return origGetBaseHref.call(this, doc);
291
+ };
292
+ const origCreateHtmlDocument = proto.createHtmlDocument;
293
+ proto.createHtmlDocument = function() {
294
+ const doc = origCreateHtmlDocument.call(this);
295
+ ensureHead(doc);
296
+ patchElementLayout(doc);
297
+ return doc;
298
+ };
299
+ const origGetDefaultDocument = proto.getDefaultDocument;
300
+ proto.getDefaultDocument = function() {
301
+ const doc = origGetDefaultDocument.call(this);
302
+ ensureHead(doc);
303
+ patchElementLayout(doc);
304
+ return doc;
305
+ };
306
+ return true;
307
+ };
308
+ var init_angularPatch = __esm(() => {
309
+ init_resolveAngularPackage();
310
+ SSR_LAYOUT_RECT = Object.freeze({
311
+ bottom: 0,
312
+ height: 0,
313
+ left: 0,
314
+ right: 0,
315
+ top: 0,
316
+ width: 0,
317
+ x: 0,
318
+ y: 0,
319
+ toJSON() {
320
+ return this;
321
+ }
322
+ });
323
+ });
324
+
325
+ // src/angular/angularDeps.ts
326
+ var initDominoAdapter = (platformServer) => {
327
+ try {
328
+ platformServer.\u{275}DominoAdapter?.makeCurrent?.();
329
+ } catch (err) {
330
+ console.error("Failed to initialize DominoAdapter:", err);
331
+ }
332
+ }, loadAngularDeps = async () => {
333
+ if (!isProductionRuntime()) {
334
+ await import("@angular/compiler");
335
+ }
336
+ const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
337
+ await applyPatches2();
338
+ const useBareSpecifiers = !isProductionRuntime();
339
+ const [platformBrowser, platformServer, common, core] = await Promise.all([
340
+ useBareSpecifiers ? import("@angular/platform-browser") : import(resolveAngularRuntimePath("@angular/platform-browser")),
341
+ useBareSpecifiers ? import("@angular/platform-server") : import(resolveAngularRuntimePath("@angular/platform-server")),
342
+ useBareSpecifiers ? import("@angular/common") : import(resolveAngularRuntimePath("@angular/common")),
343
+ useBareSpecifiers ? import("@angular/core") : import(resolveAngularRuntimePath("@angular/core"))
344
+ ]);
345
+ if (!isDevelopmentRuntime()) {
346
+ core.enableProdMode();
347
+ }
348
+ initDominoAdapter(platformServer);
349
+ return {
350
+ APP_BASE_HREF: common.APP_BASE_HREF,
351
+ bootstrapApplication: platformBrowser.bootstrapApplication,
352
+ Component: core.Component,
353
+ DomSanitizer: platformBrowser.DomSanitizer,
354
+ ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
355
+ inject: core.inject,
356
+ InjectionToken: core.InjectionToken,
357
+ NgComponentOutlet: common.NgComponentOutlet,
358
+ provideClientHydration: platformBrowser.provideClientHydration,
359
+ provideServerRendering: platformServer.provideServerRendering,
360
+ provideZonelessChangeDetection: core.provideZonelessChangeDetection,
361
+ reflectComponentType: core.reflectComponentType,
362
+ renderApplication: platformServer.renderApplication,
363
+ REQUEST: core.REQUEST,
364
+ REQUEST_CONTEXT: core.REQUEST_CONTEXT,
365
+ RESPONSE_INIT: core.RESPONSE_INIT,
366
+ Sanitizer: core.Sanitizer,
367
+ SecurityContext: core.SecurityContext,
368
+ withHttpTransferCacheOptions: platformBrowser.withHttpTransferCacheOptions
369
+ };
370
+ }, angularDeps = null, getAngularDeps = () => {
371
+ if (!angularDeps) {
372
+ angularDeps = loadAngularDeps();
373
+ }
374
+ return angularDeps;
375
+ };
376
+ var init_angularDeps = __esm(() => {
377
+ init_resolveAngularPackage();
378
+ });
379
+
380
+ // src/utils/registerClientScript.ts
381
+ var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, getSsrContextId = () => ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value, registerClientScript = (script, requestId) => {
382
+ const id = requestId || getSsrContextId() || getRequestId();
383
+ if (!scriptRegistry.has(id)) {
384
+ scriptRegistry.set(id, new Set);
385
+ }
386
+ scriptRegistry.get(id)?.add(script);
387
+ return id;
388
+ }, setSsrContextGetter = (getter) => {
389
+ ssrContextGetter = getter;
390
+ }, clearAllClientScripts = () => {
391
+ scriptRegistry.clear();
392
+ }, generateClientScriptCode = (scripts) => {
393
+ if (scripts.length === 0) {
394
+ return "";
395
+ }
396
+ const scriptCode = scripts.map((script, index) => {
397
+ const funcString = script.toString();
398
+ const bodyMatch = funcString.match(/\{([\s\S]*)\}/);
399
+ if (!bodyMatch || !bodyMatch[1]) {
400
+ return "";
401
+ }
402
+ const body = bodyMatch[1].trim();
403
+ return `
404
+ (function() {
405
+ var executed = false;
406
+ function executeScript_${index}() {
407
+ if (executed) return;
408
+ executed = true;
409
+ ${body}
410
+ }
411
+
412
+ if (document.readyState === 'complete' || document.readyState === 'interactive') {
413
+ executeScript_${index}();
414
+ } else {
415
+ document.addEventListener('DOMContentLoaded', executeScript_${index});
416
+ }
417
+
418
+ // Watch for hydration-added elements
419
+ var observer = new MutationObserver(function() {
420
+ executeScript_${index}();
421
+ if (executed) observer.disconnect();
422
+ });
423
+ if (!executed) {
424
+ observer.observe(document.body || document.documentElement, { childList: true, subtree: true });
425
+ }
426
+
427
+ // Single fallback timeout
428
+ setTimeout(function() {
429
+ executeScript_${index}();
430
+ observer.disconnect();
431
+ }, 1000);
432
+ })();`;
433
+ }).join(`
434
+ `);
435
+ return `<script>
436
+ (function() {
437
+ ${scriptCode}
438
+ })();
439
+ </script>`;
440
+ }, getAndClearClientScripts = (requestId) => {
441
+ const id = requestId || ssrContextGetter?.();
442
+ if (!id)
443
+ return [];
444
+ const scripts = scriptRegistry.get(id);
445
+ if (!scripts) {
446
+ return [];
447
+ }
448
+ const scriptArray = Array.from(scripts);
449
+ scriptRegistry.delete(id);
450
+ return scriptArray;
451
+ };
452
+ var init_registerClientScript = __esm(() => {
453
+ scriptRegistry = new Map;
454
+ if (typeof globalThis !== "undefined") {
455
+ Object.assign(globalThis, { registerClientScript });
456
+ }
457
+ });
458
+
459
+ // src/angular/httpTransferCache.ts
460
+ var ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = "x-skip-transfer-cache", buildAbsoluteHttpTransferCacheOptions = (options = {}) => {
461
+ const {
462
+ filter: userFilter,
463
+ skipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,
464
+ ...angularOptions
465
+ } = options;
466
+ return {
467
+ includePostRequests: false,
468
+ includeRequestsWithAuthHeaders: false,
469
+ ...angularOptions,
470
+ filter: (request) => !request.headers.has(skipHeader) && (userFilter?.(request) ?? true)
471
+ };
472
+ };
473
+
474
+ // src/angular/requestProviders.ts
475
+ var buildRequestProviders = (deps, request, requestContext, responseInit) => [
476
+ { provide: deps.REQUEST, useValue: request ?? null },
477
+ { provide: deps.REQUEST_CONTEXT, useValue: requestContext ?? null },
478
+ { provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }
479
+ ];
480
+
481
+ // src/angular/ssrRender.ts
482
+ var routeContextCache, cacheRouteData = (pagePath, data) => {
483
+ const cacheKey = pagePath.split("?")[0] ?? pagePath;
484
+ routeContextCache.set(cacheKey, data);
485
+ }, getCachedRouteData = (pagePath) => routeContextCache.get(pagePath), selectorCache, buildProviders = (deps, sanitizer, request, requestContext, responseInit, userProviders = []) => [
486
+ deps.provideServerRendering(),
487
+ deps.provideClientHydration(deps.withHttpTransferCacheOptions(buildAbsoluteHttpTransferCacheOptions())),
488
+ deps.provideZonelessChangeDetection(),
489
+ { provide: deps.APP_BASE_HREF, useValue: "/" },
490
+ { provide: deps.DomSanitizer, useValue: sanitizer },
491
+ { provide: deps.Sanitizer, useValue: sanitizer },
492
+ ...buildRequestProviders(deps, request, requestContext, responseInit),
493
+ ...userProviders
494
+ ], resolveSelector = (deps, pagePath, PageComponent) => {
495
+ const cached = selectorCache.get(pagePath);
496
+ if (cached) {
497
+ return cached;
498
+ }
499
+ const selector = deps.reflectComponentType(PageComponent)?.selector ?? "ng-app";
500
+ selectorCache.set(pagePath, selector);
501
+ return selector;
502
+ }, injectBeforeClose = (html, snippet) => {
503
+ if (html.includes("</body>")) {
504
+ return html.replace("</body>", `${snippet}</body>`);
505
+ }
506
+ if (html.includes("</html>")) {
507
+ return html.replace("</html>", `${snippet}</html>`);
508
+ }
509
+ return html + snippet;
510
+ }, injectSsrScripts = (html, requestId, indexPath, requestContext) => {
511
+ let result = html;
512
+ const registeredScripts = getAndClearClientScripts(requestId);
513
+ if (registeredScripts.length > 0) {
514
+ result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
515
+ }
516
+ if (requestContext !== undefined) {
517
+ result = injectBeforeClose(result, `<script>window.__ABS_ANGULAR_REQUEST_CONTEXT__ = ${JSON.stringify(requestContext)};</script>`);
518
+ }
519
+ if (indexPath) {
520
+ const escapedIndexPath = JSON.stringify(indexPath);
521
+ result = injectBeforeClose(result, `<script>import(${escapedIndexPath});</script>`);
522
+ }
523
+ return result;
524
+ }, renderAngularApp = async (deps, PageComponent, providers, document, url = "/") => {
525
+ const bootstrap = (context) => deps.bootstrapApplication(PageComponent, { providers }, context);
526
+ return withSuppressedAngularDevLogs(() => deps.renderApplication(bootstrap, {
527
+ document,
528
+ platformProviders: [],
529
+ url
530
+ }));
531
+ }, withSuppressedAngularDevLogs = async (render) => {
532
+ const origLog = console.log;
533
+ console.log = (...args) => {
534
+ if (typeof args[0] === "string" && args[0].includes("development mode")) {
535
+ return;
536
+ }
537
+ origLog.apply(console, args);
538
+ };
539
+ try {
540
+ return await render();
541
+ } finally {
542
+ console.log = origLog;
543
+ }
544
+ };
545
+ var init_ssrRender = __esm(() => {
546
+ init_registerClientScript();
547
+ routeContextCache = new Map;
548
+ selectorCache = new Map;
549
+ });
550
+
551
+ // src/angular/islands.ts
552
+ var exports_islands = {};
553
+ __export(exports_islands, {
554
+ renderAngularIslandToHtml: () => renderAngularIslandToHtml,
555
+ mountAngularIsland: () => mountAngularIsland,
556
+ isAngularComponent: () => isAngularComponent,
557
+ getAngularIslandSelector: () => getAngularIslandSelector
558
+ });
559
+ var angularIslandSelector = "abs-angular-island", getAngularIslandSelector = (_islandId) => angularIslandSelector, isAngularComponent = (value) => typeof value === "function", getSelectorFromRenderedIsland = (rootElement) => {
560
+ const firstChild = rootElement.firstElementChild;
561
+ if (!(firstChild instanceof HTMLElement)) {
562
+ return null;
563
+ }
564
+ const selector = firstChild.tagName.toLowerCase();
565
+ return selector.length > 0 ? selector : null;
566
+ }, getClientAngularComponentSelector = (component) => {
567
+ const maybeDef = Reflect.get(component, "\u0275cmp");
568
+ if (typeof maybeDef !== "object" || maybeDef === null) {
569
+ return null;
570
+ }
571
+ const maybeSelectors = Reflect.get(maybeDef, "selectors");
572
+ if (!Array.isArray(maybeSelectors)) {
573
+ return null;
574
+ }
575
+ const [firstSelectorGroup] = maybeSelectors;
576
+ if (!Array.isArray(firstSelectorGroup)) {
577
+ return null;
578
+ }
579
+ const [selector] = firstSelectorGroup;
580
+ return typeof selector === "string" && selector.length > 0 ? selector : null;
581
+ }, createAngularIslandApp = async () => {
582
+ const { EnvironmentInjector, provideZonelessChangeDetection } = await import("@angular/core");
583
+ const { createApplication } = await import("@angular/platform-browser");
584
+ const app = await createApplication({
585
+ providers: [provideZonelessChangeDetection()]
586
+ });
587
+ const environmentInjector = app.injector.get(EnvironmentInjector);
588
+ return { app, environmentInjector };
589
+ }, angularIslandAppPromise = null, getAngularIslandApp = async () => {
590
+ if (!angularIslandAppPromise) {
591
+ angularIslandAppPromise = createAngularIslandApp();
592
+ }
593
+ return angularIslandAppPromise;
594
+ }, wrapperMetadataCache, requestRenderCache, getRequestRenderCache = () => {
595
+ const requestId = getSsrContextId();
596
+ if (!requestId) {
597
+ return null;
598
+ }
599
+ const cached = requestRenderCache.get(requestId);
600
+ if (cached) {
601
+ return cached;
602
+ }
603
+ const renderCache = new Map;
604
+ requestRenderCache.set(requestId, renderCache);
605
+ return renderCache;
606
+ }, getAngularIslandWrapperKey = (component, _islandId) => {
607
+ const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
608
+ return `${componentName}:${angularIslandSelector}`;
609
+ }, getIslandRenderCacheKey = (component, props) => {
610
+ const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
611
+ return `${componentName}:${JSON.stringify(props)}`;
612
+ }, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
613
+ const deps = await getAngularDeps();
614
+ const { Component, InjectionToken, NgComponentOutlet, inject } = deps;
615
+ const selector = getAngularIslandSelector(islandId);
616
+ const propsToken = new InjectionToken(`${wrapperKey}:props`);
617
+
618
+ class AngularIslandWrapperComponent {
619
+ component = component;
620
+ props = inject(propsToken);
621
+ }
622
+ return {
623
+ deps,
624
+ propsToken,
625
+ selector,
626
+ WrapperComponent: Component({
627
+ imports: [NgComponentOutlet, component],
628
+ selector,
629
+ standalone: true,
630
+ template: '<ng-container *ngComponentOutlet="component; inputs: props"></ng-container>'
631
+ })(AngularIslandWrapperComponent)
632
+ };
633
+ }, createAngularIslandWrapper = async (component, islandId) => {
634
+ const wrapperKey = getAngularIslandWrapperKey(component, islandId);
635
+ const cached = wrapperMetadataCache.get(wrapperKey);
636
+ if (cached) {
637
+ return cached;
638
+ }
639
+ const metadataPromise = buildAngularIslandWrapperMetadata(component, islandId, wrapperKey);
640
+ wrapperMetadataCache.set(wrapperKey, metadataPromise);
641
+ return metadataPromise;
642
+ }, extractAngularIslandRoot = (html, selector) => {
643
+ const openTag = `<${selector}`;
644
+ const start = html.indexOf(openTag);
645
+ if (start < 0) {
646
+ throw new Error(`Could not find Angular island root "${selector}".`);
647
+ }
648
+ const endTag = `</${selector}>`;
649
+ const end = html.indexOf(endTag, start);
650
+ if (end < 0) {
651
+ throw new Error(`Could not close Angular island root "${selector}".`);
652
+ }
653
+ return html.slice(start, end + endTag.length);
654
+ }, mountAngularIsland = async (component, element, props, islandId) => {
655
+ await import("@angular/compiler");
656
+ const { createComponent, inputBinding } = await import("@angular/core");
657
+ const selector = getAngularIslandSelector(islandId);
658
+ const { app, environmentInjector } = await getAngularIslandApp();
659
+ let rootElement = element.querySelector(selector);
660
+ if (!(rootElement instanceof HTMLElement)) {
661
+ element.innerHTML = `<${selector}></${selector}>`;
662
+ rootElement = element.querySelector(selector);
663
+ }
664
+ if (!(rootElement instanceof HTMLElement))
665
+ return app;
666
+ const componentSelector = getClientAngularComponentSelector(component) ?? getSelectorFromRenderedIsland(rootElement);
667
+ if (!componentSelector)
668
+ return app;
669
+ rootElement.innerHTML = `<${componentSelector}></${componentSelector}>`;
670
+ const hostElement = rootElement.querySelector(componentSelector);
671
+ if (!(hostElement instanceof HTMLElement))
672
+ return app;
673
+ const bindings = Object.entries(props).map(([key, value]) => inputBinding(key, () => value));
674
+ const componentRef = createComponent(component, {
675
+ bindings,
676
+ environmentInjector,
677
+ hostElement
678
+ });
679
+ app.attachView(componentRef.hostView);
680
+ componentRef.changeDetectorRef.detectChanges();
681
+ window.__ABS_ANGULAR_ISLAND_APPS__ ??= [];
682
+ window.__ABS_ANGULAR_ISLAND_APPS__.push(app);
683
+ return app;
684
+ }, renderAngularIslandToHtml = async (component, props, islandId) => {
685
+ const requestCache = getRequestRenderCache();
686
+ const renderCacheKey = getIslandRenderCacheKey(component, props);
687
+ const cachedHtml = requestCache?.get(renderCacheKey);
688
+ if (cachedHtml) {
689
+ return cachedHtml;
690
+ }
691
+ const { deps, propsToken, selector, WrapperComponent } = await createAngularIslandWrapper(component, islandId);
692
+ const providers = [
693
+ deps.provideServerRendering(),
694
+ deps.provideZonelessChangeDetection(),
695
+ { provide: deps.APP_BASE_HREF, useValue: "/" },
696
+ { provide: propsToken, useValue: props }
697
+ ];
698
+ const document = `<!DOCTYPE html><html><body><${selector}></${selector}></body></html>`;
699
+ const html = await withSuppressedAngularDevLogs(() => deps.renderApplication((context) => deps.bootstrapApplication(WrapperComponent, { providers }, context), {
700
+ document,
701
+ platformProviders: [],
702
+ url: "/"
703
+ }));
704
+ const islandHtml = extractAngularIslandRoot(html, selector);
705
+ requestCache?.set(renderCacheKey, islandHtml);
706
+ return islandHtml;
707
+ };
708
+ var init_islands2 = __esm(() => {
709
+ init_angularDeps();
710
+ init_ssrRender();
711
+ init_registerClientScript();
712
+ wrapperMetadataCache = new Map;
713
+ requestRenderCache = new Map;
714
+ });
715
+
716
+ // src/core/islandSsr.ts
717
+ var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
718
+ const { renderAngularIslandToHtml: renderAngularIslandToHtml2 } = await Promise.resolve().then(() => (init_islands2(), exports_islands));
719
+ return renderAngularIslandToHtml2(component, props, islandId);
720
+ }, renderAngularIslandToHtml2, LEADING_HOISTED_RESOURCE_RE, stripLeadingHoistedResources = (html) => {
721
+ let result = html;
722
+ let match = LEADING_HOISTED_RESOURCE_RE.exec(result);
723
+ while (match) {
724
+ result = result.slice(match[0].length);
725
+ match = LEADING_HOISTED_RESOURCE_RE.exec(result);
726
+ }
727
+ return result.trimStart();
728
+ }, renderReactIslandToHtml = (component, props) => import("react").then(({ createElement }) => import("react-dom/server").then(({ renderToString }) => stripLeadingHoistedResources(renderToString(createElement(component, props))))), renderSvelteIslandToHtml = (component, props) => import("svelte/server").then(({ render }) => {
729
+ const { body } = render(component, { props });
730
+ return body;
731
+ }), renderVueIslandToHtml = (component, props) => import("vue").then(({ createSSRApp, h: createVueVNode }) => {
732
+ const app = createSSRApp({
733
+ render: () => createVueVNode(component, props)
734
+ });
735
+ return import("vue/server-renderer").then(({ renderToString }) => renderToString(app));
736
+ });
737
+ var init_islandSsr = __esm(() => {
738
+ renderAngularIslandToHtml2 = renderAngularIslandToHtmlInternal;
739
+ LEADING_HOISTED_RESOURCE_RE = /^\s*(?:<link\b[^>]*\/?>|<meta\b[^>]*\/?>|<title\b[^>]*>[\s\S]*?<\/title>|<style\b[^>]*>[\s\S]*?<\/style>|<script\b[^>]*>[\s\S]*?<\/script>)/i;
740
+ });
741
+
742
+ // src/build/nativeRewrite.ts
743
+ import { dlopen, FFIType, ptr } from "bun:ffi";
744
+ import { platform, arch } from "os";
745
+ import { resolve as resolve2 } from "path";
746
+ var ffiDefinition, nativeLib = null, loadNative = () => {
747
+ if (nativeLib !== null)
748
+ return nativeLib;
749
+ const osPlatform = platform();
750
+ const cpu = arch();
751
+ const platformMap = {
752
+ "darwin-arm64": "darwin-arm64/fast_ops.dylib",
753
+ "darwin-x64": "darwin-x64/fast_ops.dylib",
754
+ "linux-arm64": "linux-arm64/fast_ops.so",
755
+ "linux-x64": "linux-x64/fast_ops.so",
756
+ "win32-arm64": "windows-arm64/fast_ops.dll",
757
+ "win32-x64": "windows-x64/fast_ops.dll"
758
+ };
759
+ const libPath = platformMap[`${osPlatform}-${cpu}`];
760
+ if (!libPath)
761
+ return null;
762
+ try {
763
+ const fullPath = resolve2(import.meta.dir, "../../native/packages", libPath);
764
+ const lib = dlopen(fullPath, ffiDefinition);
765
+ nativeLib = lib.symbols;
766
+ return nativeLib;
767
+ } catch {
768
+ return null;
769
+ }
770
+ }, nativeRewriteImports = (content, replacements) => {
771
+ const lib = loadNative();
772
+ if (!lib)
773
+ return null;
774
+ const jsonStr = JSON.stringify(replacements);
775
+ const contentBuf = Buffer.from(content);
776
+ const jsonBuf = Buffer.from(jsonStr);
777
+ const outBuf = Buffer.alloc(content.length * 2);
778
+ const outLenBuf = new BigUint64Array([BigInt(outBuf.length)]);
779
+ const result = lib.rewrite_imports(ptr(contentBuf), contentBuf.length, ptr(jsonBuf), jsonBuf.length, ptr(outBuf), ptr(new Uint8Array(outLenBuf.buffer)));
780
+ if (result < 0)
781
+ return null;
782
+ if (result === 0)
783
+ return content;
784
+ const outLen = Number(outLenBuf[0]);
785
+ return outBuf.subarray(0, outLen).toString("utf-8");
786
+ };
787
+ var init_nativeRewrite = __esm(() => {
788
+ ffiDefinition = {
789
+ rewrite_imports: {
790
+ args: [
791
+ FFIType.ptr,
792
+ FFIType.u64,
793
+ FFIType.ptr,
794
+ FFIType.u64,
795
+ FFIType.ptr,
796
+ FFIType.ptr
797
+ ],
798
+ returns: FFIType.i32
799
+ }
800
+ };
801
+ });
802
+
803
+ // src/build/rewriteImportsPlugin.ts
804
+ var exports_rewriteImportsPlugin = {};
805
+ __export(exports_rewriteImportsPlugin, {
806
+ rewriteVendorDirectories: () => rewriteVendorDirectories,
807
+ rewriteImportsInContent: () => rewriteImportsInContent,
808
+ rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
809
+ rewriteBuildOutputs: () => rewriteBuildOutputs,
810
+ jsRewriteImports: () => jsRewriteImports,
811
+ fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
812
+ buildWithImportRewrite: () => buildWithImportRewrite
813
+ });
814
+ import { readdir } from "fs/promises";
815
+ import { join as join2 } from "path";
816
+ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
817
+ let result = content;
818
+ for (const [specifier, webPath] of replacements) {
819
+ const escaped = escapeRegex(specifier);
820
+ const fromRegex = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
821
+ const sideEffectRegex = new RegExp(`(import\\s*["'])${escaped}(["'])`, "g");
822
+ const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])${escaped}(["']\\s*\\))`, "g");
823
+ result = result.replace(fromRegex, `$1${webPath}$2`);
824
+ result = result.replace(sideEffectRegex, `$1${webPath}$2`);
825
+ result = result.replace(dynamicRegex, `$1${webPath}$2`);
826
+ }
827
+ return result;
828
+ }, rewriteImportsInContent = (content, vendorPaths) => {
829
+ if (Object.keys(vendorPaths).length === 0)
830
+ return content;
831
+ const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
832
+ const native = nativeRewriteImports(content, replacements);
833
+ return native ?? jsRewriteImports(content, replacements);
834
+ }, fixMissingReExportNamespacesInContent = (content) => {
835
+ const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
836
+ REEXPORT_PATTERN.lastIndex = 0;
837
+ const missing = [];
838
+ let match;
839
+ while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
840
+ const ident = match[1];
841
+ if (!ident)
842
+ continue;
843
+ const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
844
+ if (nsImportRe.test(content))
845
+ continue;
846
+ const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
847
+ if (declRe.test(content))
848
+ continue;
849
+ const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
850
+ if (namedImportRe.test(content))
851
+ continue;
852
+ const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
853
+ let pathMatch;
854
+ let sourcePath;
855
+ while ((pathMatch = importPathRe.exec(content)) !== null) {
856
+ const p = pathMatch[1];
857
+ if (!p)
858
+ continue;
859
+ const base = p.split("/").pop()?.replace(/\.[mc]?js$/, "");
860
+ if (!base)
861
+ continue;
862
+ const normalized = base.startsWith("_") ? base.slice(1) : base;
863
+ if (normalized === ident || normalized.endsWith(`_${ident}`)) {
864
+ sourcePath = p;
865
+ break;
866
+ }
867
+ }
868
+ if (sourcePath)
869
+ missing.push({ ident, path: sourcePath });
870
+ }
871
+ if (missing.length === 0)
872
+ return content;
873
+ const seen = new Set;
874
+ const unique = missing.filter((entry) => {
875
+ if (seen.has(entry.ident))
876
+ return false;
877
+ seen.add(entry.ident);
878
+ return true;
879
+ });
880
+ const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
881
+ `);
882
+ return `${inserts}
883
+ ${content}`;
884
+ }, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
885
+ if (Object.keys(vendorPaths).length === 0)
886
+ return;
887
+ await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
888
+ let original;
889
+ try {
890
+ original = await artifact.text();
891
+ } catch (err) {
892
+ const code = err.code;
893
+ if (code === "ENOENT")
894
+ return;
895
+ throw err;
896
+ }
897
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
898
+ if (rewritten === original)
899
+ return;
900
+ try {
901
+ await Bun.write(artifact.path, rewritten);
902
+ } catch (err) {
903
+ const code = err.code;
904
+ if (code === "ENOENT")
905
+ return;
906
+ throw err;
907
+ }
908
+ }));
909
+ }, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
910
+ await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
911
+ const vendorPaths = resolveVendorPaths(artifact);
912
+ if (Object.keys(vendorPaths).length === 0)
913
+ return;
914
+ let original;
915
+ try {
916
+ original = await artifact.text();
917
+ } catch (err) {
918
+ const code = err.code;
919
+ if (code === "ENOENT")
920
+ return;
921
+ throw err;
922
+ }
923
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
924
+ if (rewritten === original)
925
+ return;
926
+ try {
927
+ await Bun.write(artifact.path, rewritten);
928
+ } catch (err) {
929
+ const code = err.code;
930
+ if (code === "ENOENT")
931
+ return;
932
+ throw err;
933
+ }
934
+ }));
935
+ }, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
936
+ if (Object.keys(vendorPaths).length === 0)
937
+ return;
938
+ const allFiles = [];
939
+ for (const dir of vendorDirs) {
940
+ try {
941
+ const entries = await readdir(dir);
942
+ for (const entry of entries) {
943
+ if (entry.endsWith(".js"))
944
+ allFiles.push(join2(dir, entry));
945
+ }
946
+ } catch {}
947
+ }
948
+ await Promise.all(allFiles.map(async (filePath) => {
949
+ let original;
950
+ try {
951
+ original = await Bun.file(filePath).text();
952
+ } catch (err) {
953
+ const code = err.code;
954
+ if (code === "ENOENT")
955
+ return;
956
+ throw err;
957
+ }
958
+ let next = rewriteImportsInContent(original, vendorPaths);
959
+ next = fixMissingReExportNamespacesInContent(next);
960
+ if (next === original)
961
+ return;
962
+ try {
963
+ await Bun.write(filePath, next);
964
+ } catch (err) {
965
+ const code = err.code;
966
+ if (code === "ENOENT")
967
+ return;
968
+ throw err;
969
+ }
970
+ }));
971
+ }, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
972
+ const result = await pendingBuild;
973
+ if (result.outputs.length > 0) {
974
+ await rewriteBuildOutputs(result.outputs, vendorPaths);
975
+ }
976
+ return result;
977
+ };
978
+ var init_rewriteImportsPlugin = __esm(() => {
979
+ init_nativeRewrite();
980
+ });
981
+
982
+ // src/core/angularServerModule.ts
983
+ import { mkdir } from "fs/promises";
984
+ import { dirname, join as join3, relative } from "path";
985
+ var serverCacheRoot, compiledModuleCache, ANGULAR_SPECIFIER_RE, getCachedModulePath = (sourcePath) => {
986
+ const relativeSourcePath = relative(process.cwd(), sourcePath).replace(/\\/g, "/");
987
+ const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
988
+ return join3(serverCacheRoot, `${normalizedSourcePath}.server.js`);
989
+ }, collectVendorPaths = (code) => {
990
+ const vendorPaths = {};
991
+ if (!isProductionRuntime()) {
992
+ return vendorPaths;
993
+ }
994
+ const specifiers = new Set([...code.matchAll(ANGULAR_SPECIFIER_RE)].map((match) => match[1]));
995
+ specifiers.forEach((specifier) => {
996
+ if (!specifier)
997
+ return;
998
+ const resolved = resolveAngularRuntimePath(specifier);
999
+ if (resolved === specifier)
1000
+ return;
1001
+ vendorPaths[specifier] = resolved;
1002
+ });
1003
+ return vendorPaths;
1004
+ }, buildAngularServerModule = async (sourcePath) => {
1005
+ const result = await Bun.build({
1006
+ entrypoints: [sourcePath],
1007
+ format: "esm",
1008
+ packages: "external",
1009
+ target: "bun",
1010
+ throw: false
1011
+ });
1012
+ const entry = result.outputs.find((output) => output.kind === "entry-point");
1013
+ if (!result.success || !entry) {
1014
+ const message = result.logs.map((log) => String(log)).join(`
1015
+ `);
1016
+ throw new Error(`Failed to compile Angular island server module for "${sourcePath}":
1017
+ ${message}`);
1018
+ }
1019
+ const code = await entry.text();
1020
+ const rewritten = rewriteImportsInContent(code, collectVendorPaths(code));
1021
+ const modulePath = getCachedModulePath(sourcePath);
1022
+ await mkdir(dirname(modulePath), { recursive: true });
1023
+ await Bun.write(modulePath, rewritten);
1024
+ return modulePath;
1025
+ }, compileAngularServerModule = (sourcePath) => {
1026
+ const cached = compiledModuleCache.get(sourcePath);
1027
+ if (cached) {
1028
+ return cached;
1029
+ }
1030
+ const compiledModulePromise = buildAngularServerModule(sourcePath);
1031
+ compiledModuleCache.set(sourcePath, compiledModulePromise);
1032
+ return compiledModulePromise;
1033
+ };
1034
+ var init_angularServerModule = __esm(() => {
1035
+ init_resolveAngularPackage();
1036
+ init_rewriteImportsPlugin();
1037
+ serverCacheRoot = join3(process.cwd(), ".absolutejs", "islands", "angular");
1038
+ compiledModuleCache = new Map;
1039
+ ANGULAR_SPECIFIER_RE = /["'](@angular\/[^"']+)["']/g;
1040
+ });
1041
+
1042
+ // src/build/resolvePackageImport.ts
1043
+ import { resolve as resolve3, join as join4 } from "path";
1044
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
1045
+ var resolveExportPath = (entry, conditions) => {
1046
+ if (typeof entry === "string")
1047
+ return entry;
1048
+ if (!entry || typeof entry !== "object")
1049
+ return null;
1050
+ for (const condition of conditions) {
1051
+ const target = Reflect.get(entry, condition);
1052
+ if (typeof target === "string") {
1053
+ return target;
1054
+ }
1055
+ }
1056
+ return null;
1057
+ }, resolvePackageImport = (specifier, conditions = ["import"]) => {
1058
+ if (specifier.startsWith(".") || specifier.startsWith("/"))
1059
+ return null;
1060
+ const parts = specifier.split("/");
1061
+ const isScoped = specifier.startsWith("@");
1062
+ const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
1063
+ const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
1064
+ const exportKey = subpath ? `./${subpath}` : ".";
1065
+ const currentPackageJsonPath = resolve3(process.cwd(), "package.json");
1066
+ const currentPackageJson = existsSync2(currentPackageJsonPath) ? JSON.parse(readFileSync2(currentPackageJsonPath, "utf-8")) : null;
1067
+ const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
1068
+ const packageDir = currentPackageDir ?? resolve3(process.cwd(), "node_modules", packageName ?? "");
1069
+ const packageJsonPath = join4(packageDir, "package.json");
1070
+ if (!existsSync2(packageJsonPath))
1071
+ return null;
1072
+ try {
1073
+ const packageJson = currentPackageDir && currentPackageJson ? currentPackageJson : JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
1074
+ const { exports } = packageJson;
1075
+ if (!exports)
1076
+ return null;
1077
+ const entry = exports[exportKey];
1078
+ if (!entry)
1079
+ return null;
1080
+ const importPath = resolveExportPath(entry, conditions);
1081
+ if (!importPath)
1082
+ return null;
1083
+ if (currentPackageDir && importPath.startsWith("./dist/")) {
1084
+ const sourceCandidate = resolve3(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
1085
+ if (existsSync2(sourceCandidate)) {
1086
+ return sourceCandidate;
1087
+ }
1088
+ }
1089
+ const resolved = resolve3(packageDir, importPath);
1090
+ return existsSync2(resolved) ? resolved : null;
1091
+ } catch {
1092
+ return null;
1093
+ }
1094
+ };
1095
+ var init_resolvePackageImport = () => {};
1096
+
1097
+ // src/constants.ts
1098
+ var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_CODE = 27, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, ESLINT_STUDIO_DEFAULT_HOST = "eslint.absolute.localhost", ESLINT_STUDIO_DEFAULT_PORT = 4099, CONFIG_DEFAULT_HOST = "config.absolute.localhost", CONFIG_DEFAULT_PORT = 4099, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HTTP_STATUS_OK = 200, HTTP_STATUS_BAD_REQUEST = 400, HTTP_STATUS_NOT_FOUND = 404, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, IMAGE_DEFAULT_DEVICE_SIZES, IMAGE_DEFAULT_IMAGE_SIZES, IMAGE_DEFAULT_QUALITY = 75, IMAGE_GLOB_SUFFIX_LENGTH = 2, INSTANCE_PROBE_TIMEOUT_MS = 250, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, LIST_LOG_TAIL_MAX_BYTES = 65536, LIST_TUI_COLUMN_GAP = 2, LIST_TUI_DEFAULT_HEIGHT = 28, LIST_TUI_DEFAULT_WIDTH = 100, LIST_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, LIST_TUI_FOOTER_LINE_COUNT = 2, LIST_TUI_MARKER_WIDTH = 2, LIST_TUI_MIN_LOG_HEIGHT = 3, LIST_TUI_MIN_URL_WIDTH = 16, LIST_TUI_RENDER_DEBOUNCE_MS = 16, LIST_TUI_STATUS_MESSAGE_TIMEOUT_MS = 4000, LIST_WATCH_REFRESH_MS = 1000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, REACT_STREAM_SLOT_FAST_DELAY_MS = 5, REACT_STREAM_SLOT_SLOW_DELAY_MS = 20, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000, WORKSPACE_COMMAND_ARGS_OFFSET = 3, WORKSPACE_FAILURE_LOG_PRINT_LIMIT = 30, WORKSPACE_FAILURE_RECENT_LOG_LIMIT = 60, WORKSPACE_READY_ATTEMPT_TIMEOUT_MS = 5000, WORKSPACE_READY_PROBE_INTERVAL_MS = 250, WORKSPACE_READY_TIMEOUT_MS = 30000, WORKSPACE_SHUTDOWN_TIMEOUT_MS = 1e4, WORKSPACE_TUI_DEFAULT_HEIGHT = 28, WORKSPACE_TUI_DEFAULT_WIDTH = 100, WORKSPACE_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, WORKSPACE_TUI_FOOTER_LINE_COUNT = 3, WORKSPACE_TUI_MIN_LOG_HEIGHT = 3, WORKSPACE_TUI_MIN_SERVICE_NAME_WIDTH = 7, WORKSPACE_TUI_MIN_TARGET_WIDTH = 8, WORKSPACE_TUI_MIN_WRAP_WIDTH = 12, WORKSPACE_TUI_PROMPT_CURSOR_OFFSET = 3, WORKSPACE_TUI_RECENT_LOG_LIMIT = 40, WORKSPACE_TUI_RENDER_DEBOUNCE_MS = 16, WORKSPACE_TUI_STATUS_WIDTH = 10, WORKSPACE_TUI_TARGET_PADDING_WIDTH = 6, WORKSPACE_TUI_VISIBILITY_WIDTH = 8;
1099
+ var init_constants = __esm(() => {
1100
+ IMAGE_DEFAULT_DEVICE_SIZES = [
1101
+ 640,
1102
+ 750,
1103
+ 828,
1104
+ 1080,
1105
+ 1200,
1106
+ 1920,
1107
+ 2048,
1108
+ 3840
1109
+ ];
1110
+ IMAGE_DEFAULT_IMAGE_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
1111
+ MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
1112
+ MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_DAY;
1113
+ TWO_THIRDS = 2 / 3;
1114
+ });
1115
+
1116
+ // src/svelte/lowerIslandSyntax.ts
1117
+ var ISLAND_TAG_RE, extractBracedExpression = (text, braceStart) => {
1118
+ let depth = 0;
1119
+ for (let index = braceStart;index < text.length; index += 1) {
1120
+ const char = text[index];
1121
+ if (char === "{")
1122
+ depth += 1;
1123
+ if (char === "}")
1124
+ depth -= 1;
1125
+ if (depth === 0) {
1126
+ return text.slice(braceStart + 1, index).trim();
1127
+ }
1128
+ }
1129
+ return null;
1130
+ }, extractIslandAttribute = (attributeString, name) => {
1131
+ const quotedMatch = attributeString.match(new RegExp(`\\b${name}\\s*=\\s*["']([^"']+)["']`));
1132
+ if (quotedMatch?.[1]) {
1133
+ return { expression: JSON.stringify(quotedMatch[1]), found: true };
1134
+ }
1135
+ const attributeIndex = attributeString.search(new RegExp(`\\b${name}\\s*=\\s*\\{`));
1136
+ if (attributeIndex < 0) {
1137
+ return { expression: "", found: false };
1138
+ }
1139
+ const braceStart = attributeString.indexOf("{", attributeIndex);
1140
+ if (braceStart < 0) {
1141
+ return { expression: "", found: false };
1142
+ }
1143
+ const expression = extractBracedExpression(attributeString, braceStart);
1144
+ if (expression === null) {
1145
+ return { expression: "", found: false };
1146
+ }
1147
+ return { expression, found: true };
1148
+ }, lowerSvelteIslandSyntax = (source, _mode = "server") => {
1149
+ if (!source.includes("<Island")) {
1150
+ return { code: source, transformed: false };
1151
+ }
1152
+ let islandIndex = 0;
1153
+ const transformedMarkup = source.replace(ISLAND_TAG_RE, (fullMatch, attributeString) => {
1154
+ const framework = extractIslandAttribute(attributeString, "framework");
1155
+ const component = extractIslandAttribute(attributeString, "component");
1156
+ if (!framework.found || !component.found) {
1157
+ return fullMatch;
1158
+ }
1159
+ const hydrate = extractIslandAttribute(attributeString, "hydrate");
1160
+ const props = extractIslandAttribute(attributeString, "props");
1161
+ const slotId = `absolute-svelte-island-${islandIndex.toString(BASE_36_RADIX)}`;
1162
+ islandIndex += 1;
1163
+ const resolveExpression = `await __absoluteResolveIslandHtml(${JSON.stringify(slotId)}, { component: ${component.expression}, framework: ${framework.expression}, hydrate: ${hydrate.found ? hydrate.expression : JSON.stringify("load")}, props: ${props.found ? props.expression : "{}"} })`;
1164
+ return `<div data-absolute-island-slot="${slotId}" style="display: contents">{@html ${resolveExpression}}</div>`;
1165
+ });
1166
+ const importLine = 'import { resolveIslandHtml as __absoluteResolveIslandHtml } from "@absolutejs/absolute/svelte";';
1167
+ if (transformedMarkup.includes("<script")) {
1168
+ return {
1169
+ code: transformedMarkup.replace(/<script(\s[^>]*)?>/, (match) => `${match}
1170
+ ${importLine}
1171
+ `),
1172
+ transformed: true
1173
+ };
1174
+ }
1175
+ return {
1176
+ code: `<script lang="ts">
1177
+ ${importLine}
1178
+ </script>
1179
+ ${transformedMarkup}`,
1180
+ transformed: true
1181
+ };
1182
+ };
1183
+ var init_lowerIslandSyntax = __esm(() => {
1184
+ init_constants();
1185
+ ISLAND_TAG_RE = /<Island\b([\s\S]*?)\/>/g;
1186
+ });
1187
+
1188
+ // src/svelte/lowerAwaitSlotSyntax.ts
1189
+ var AWAIT_BLOCK_RE, escapeTemplateLiteral = (value) => value.replaceAll("\\", "\\\\").replaceAll("`", "\\`").replaceAll("${", "\\${"), markupToTemplateLiteral = (markup) => {
1190
+ const escaped = escapeTemplateLiteral(markup.trim());
1191
+ const withExpressions = escaped.replace(/\{([^{}]+)\}/g, (_, expression) => `\${${String(expression).trim()}}`);
1192
+ return `\`${withExpressions}\``;
1193
+ }, lowerSvelteAwaitSlotSyntax = (source) => {
1194
+ if (!source.includes("{#await")) {
1195
+ return { code: source, transformed: false };
1196
+ }
1197
+ let awaitIndex = 0;
1198
+ let transformed = false;
1199
+ const lowered = source.replace(AWAIT_BLOCK_RE, (fullMatch, awaitExpression, pendingMarkup, thenIdentifier, thenMarkup, catchIdentifier, catchMarkup) => {
1200
+ const trimmedAwaitExpression = awaitExpression.trim();
1201
+ if (!trimmedAwaitExpression) {
1202
+ return fullMatch;
1203
+ }
1204
+ const slotId = `absolute-svelte-await-${awaitIndex.toString(BASE_36_RADIX)}`;
1205
+ awaitIndex += 1;
1206
+ transformed = true;
1207
+ const thenValueIdentifier = thenIdentifier?.trim() || "__awaitValue";
1208
+ const catchValueIdentifier = catchIdentifier?.trim() || "__awaitError";
1209
+ const fallbackHtml = markupToTemplateLiteral(pendingMarkup);
1210
+ const resolvedHtml = markupToTemplateLiteral(thenMarkup);
1211
+ const rejectedHtml = typeof catchMarkup === "string" ? markupToTemplateLiteral(catchMarkup) : null;
1212
+ const catchBranch = rejectedHtml ? `catch (${catchValueIdentifier}) { return ${rejectedHtml}; }` : "catch (_absoluteAwaitError) { throw _absoluteAwaitError; }";
1213
+ return `<AbsoluteAwaitSlot id="${slotId}" fallbackHtml={${fallbackHtml}} resolve={async () => { try { const ${thenValueIdentifier} = await (${trimmedAwaitExpression}); return ${resolvedHtml}; } ${catchBranch} }} />`;
1214
+ });
1215
+ if (!transformed) {
1216
+ return { code: source, transformed: false };
1217
+ }
1218
+ const importLine = 'import AbsoluteAwaitSlot from "@absolutejs/absolute/svelte/components/AwaitSlot.svelte";';
1219
+ if (lowered.includes("<script")) {
1220
+ return {
1221
+ code: lowered.replace(/<script(\s[^>]*)?>/, (match) => `${match}
1222
+ ${importLine}
1223
+ `),
1224
+ transformed: true
1225
+ };
1226
+ }
1227
+ return {
1228
+ code: `<script lang="ts">
1229
+ ${importLine}
1230
+ </script>
1231
+ ${lowered}`,
1232
+ transformed: true
1233
+ };
1234
+ };
1235
+ var init_lowerAwaitSlotSyntax = __esm(() => {
1236
+ init_constants();
1237
+ AWAIT_BLOCK_RE = /\{#await\s+([^}]+)\}([\s\S]*?)\{:then(?:\s+([A-Za-z_$][\w$]*))?\}([\s\S]*?)(?:\{:catch(?:\s+([A-Za-z_$][\w$]*))?\}([\s\S]*?))?\{\/await\}/g;
1238
+ });
1239
+
1240
+ // src/build/stylePreprocessor.ts
1241
+ var exports_stylePreprocessor = {};
1242
+ __export(exports_stylePreprocessor, {
1243
+ stylePreprocessorPlugin: () => stylePreprocessorPlugin,
1244
+ recordStyleOutput: () => recordStyleOutput,
1245
+ isStylePath: () => isStylePath,
1246
+ isStyleModulePath: () => isStyleModulePath,
1247
+ isPreprocessableStylePath: () => isPreprocessableStylePath,
1248
+ getStyleBaseName: () => getStyleBaseName,
1249
+ getCssOutputExtension: () => getCssOutputExtension,
1250
+ forgetStyleEntry: () => forgetStyleEntry,
1251
+ findStyleEntriesImporting: () => findStyleEntriesImporting,
1252
+ createSvelteStylePreprocessor: () => createSvelteStylePreprocessor,
1253
+ createStyleTransformConfig: () => createStyleTransformConfig,
1254
+ createStylePreprocessorPlugin: () => createStylePreprocessorPlugin,
1255
+ compileStyleSource: () => compileStyleSource,
1256
+ compileStyleFileIfNeededSync: () => compileStyleFileIfNeededSync,
1257
+ compileStyleFileIfNeeded: () => compileStyleFileIfNeeded,
1258
+ addStyleImporter: () => addStyleImporter
1259
+ });
1260
+ import { createHash } from "crypto";
1261
+ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
1262
+ import { readFile } from "fs/promises";
1263
+ import { createRequire } from "module";
1264
+ import {
1265
+ dirname as dirname2,
1266
+ extname,
1267
+ isAbsolute,
1268
+ join as join5,
1269
+ relative as relative2,
1270
+ resolve as resolve4
1271
+ } from "path";
1272
+ import { fileURLToPath, pathToFileURL } from "url";
1273
+ var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
1274
+ const normalized = filePathOrLanguage.toLowerCase();
1275
+ if (normalized === "scss" || normalized.endsWith(".scss"))
1276
+ return "scss";
1277
+ if (normalized === "sass" || normalized.endsWith(".sass"))
1278
+ return "sass";
1279
+ if (normalized === "less" || normalized.endsWith(".less"))
1280
+ return "less";
1281
+ if (normalized === "styl" || normalized === "stylus" || normalized.endsWith(".styl") || normalized.endsWith(".stylus"))
1282
+ return "stylus";
1283
+ return null;
1284
+ }, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), throwPreprocessorError = (error, filePath, language) => {
1285
+ if (!(error instanceof Error)) {
1286
+ throw new Error(`${language} compile failed in ${filePath}: ${String(error)}`);
1287
+ }
1288
+ const detail = error;
1289
+ const sassLine = detail.span?.start?.line;
1290
+ const sassCol = detail.span?.start?.column;
1291
+ const line = detail.line ?? sassLine;
1292
+ const column = detail.column ?? sassCol;
1293
+ const location = typeof line === "number" ? `:${line}${typeof column === "number" ? `:${column}` : ""}` : "";
1294
+ const message = detail.formatted ?? detail.message;
1295
+ const wrapped = new Error(`${language} compile failed in ${filePath}${location}
1296
+ ${message}`);
1297
+ wrapped.cause = error;
1298
+ throw wrapped;
1299
+ }, requireOptionalPeerSync = (specifier) => {
1300
+ try {
1301
+ return requireFromCwd(specifier);
1302
+ } catch {
1303
+ return requireOptionalPeer(specifier);
1304
+ }
1305
+ }, normalizeLoadPaths = (filePath, paths = []) => [
1306
+ dirname2(filePath),
1307
+ process.cwd(),
1308
+ ...paths.map((path) => resolve4(process.cwd(), path))
1309
+ ], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
1310
+ pattern,
1311
+ replacements: Array.isArray(value) ? value : [value]
1312
+ })), readTsconfigAliases = () => {
1313
+ const cwd = process.cwd();
1314
+ if (tsconfigAliasCache?.cwd === cwd)
1315
+ return tsconfigAliasCache;
1316
+ const tsconfigPath = resolve4(cwd, "tsconfig.json");
1317
+ const empty = { aliases: [], baseUrl: cwd, cwd };
1318
+ if (!existsSync3(tsconfigPath)) {
1319
+ tsconfigAliasCache = empty;
1320
+ return empty;
1321
+ }
1322
+ try {
1323
+ const parsed = JSON.parse(stripJsonComments(readFileSync3(tsconfigPath, "utf-8")));
1324
+ const compilerOptions = parsed.compilerOptions ?? {};
1325
+ const baseUrl = resolve4(cwd, compilerOptions.baseUrl ?? ".");
1326
+ tsconfigAliasCache = {
1327
+ aliases: normalizeAliasEntries(compilerOptions.paths),
1328
+ baseUrl,
1329
+ cwd
1330
+ };
1331
+ } catch {
1332
+ tsconfigAliasCache = empty;
1333
+ }
1334
+ return tsconfigAliasCache;
1335
+ }, getAliasEntries = (config) => {
1336
+ const tsconfig = readTsconfigAliases();
1337
+ return {
1338
+ aliases: [
1339
+ ...normalizeAliasEntries(config?.aliases),
1340
+ ...tsconfig.aliases
1341
+ ],
1342
+ baseUrl: tsconfig.baseUrl
1343
+ };
1344
+ }, aliasPatternToRegExp = (pattern) => new RegExp(`^${pattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("(.+)")}$`), resolveAliasTargets = (specifier, config) => {
1345
+ const { aliases, baseUrl } = getAliasEntries(config);
1346
+ const targets = [];
1347
+ for (const alias of aliases) {
1348
+ const match = specifier.match(aliasPatternToRegExp(alias.pattern));
1349
+ if (!match)
1350
+ continue;
1351
+ const wildcard = match[1] ?? "";
1352
+ for (const replacement of alias.replacements) {
1353
+ targets.push(resolve4(baseUrl, replacement.replace("*", wildcard)));
1354
+ }
1355
+ }
1356
+ return targets;
1357
+ }, getLanguageExtensions = (language) => {
1358
+ if (language === "less")
1359
+ return [".less", ".css"];
1360
+ if (language === "stylus")
1361
+ return [".styl", ".stylus", ".css"];
1362
+ return [".scss", ".sass", ".css"];
1363
+ }, getCandidatePaths = (basePath, language) => {
1364
+ const ext = extname(basePath);
1365
+ const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
1366
+ `${basePath}${extension}`,
1367
+ join5(basePath, `index${extension}`)
1368
+ ]);
1369
+ if (language === "scss" || language === "sass") {
1370
+ return paths.flatMap((path) => {
1371
+ const dir = dirname2(path);
1372
+ const base = path.slice(dir.length + 1);
1373
+ return [path, join5(dir, `_${base}`)];
1374
+ });
1375
+ }
1376
+ return paths;
1377
+ }, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
1378
+ const rawCandidates = [
1379
+ ...resolveAliasTargets(specifier, config),
1380
+ isAbsolute(specifier) ? specifier : resolve4(fromDirectory, specifier),
1381
+ ...loadPaths.map((path) => resolve4(path, specifier))
1382
+ ];
1383
+ for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
1384
+ if (existsSync3(candidate))
1385
+ return candidate;
1386
+ }
1387
+ return null;
1388
+ }, isExternalCssUrl = (url) => /^(?:[a-z][a-z0-9+.-]*:|\/\/|#|\/)/i.test(url), splitCssUrl = (url) => {
1389
+ const markerIndex = url.search(/[?#]/);
1390
+ if (markerIndex === -1)
1391
+ return { marker: "", path: url };
1392
+ return {
1393
+ marker: url.slice(markerIndex),
1394
+ path: url.slice(0, markerIndex)
1395
+ };
1396
+ }, rebaseCssUrls = (contents, sourceFile, entryFile) => {
1397
+ const sourceDir = dirname2(sourceFile);
1398
+ const entryDir = dirname2(entryFile);
1399
+ if (sourceDir === entryDir)
1400
+ return contents;
1401
+ return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
1402
+ const trimmedUrl = rawUrl.trim();
1403
+ if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
1404
+ return match;
1405
+ const { marker, path } = splitCssUrl(trimmedUrl);
1406
+ const rebased = relative2(entryDir, resolve4(sourceDir, path)).replace(/\\/g, "/");
1407
+ const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
1408
+ const nextQuote = quote || '"';
1409
+ return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
1410
+ });
1411
+ }, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
1412
+ if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
1413
+ return match;
1414
+ const resolved = resolveImportPath(specifier, dirname2(sourceFile), loadPaths, language, config);
1415
+ return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
1416
+ }), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
1417
+ const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
1418
+ return language ? rewriteAliasedStyleImports(rebased, sourceFile, loadPaths, language, config) : rebased;
1419
+ }, extractCssModuleExports = (css) => {
1420
+ const exports = {};
1421
+ const nextCss = css.replace(/:export\s*\{([^}]*)\}/g, (_, body) => {
1422
+ for (const declaration of body.split(";")) {
1423
+ const separator = declaration.indexOf(":");
1424
+ if (separator === -1)
1425
+ continue;
1426
+ const key = declaration.slice(0, separator).trim();
1427
+ const value = declaration.slice(separator + 1).trim();
1428
+ if (key && value)
1429
+ exports[key] = value;
1430
+ }
1431
+ return "";
1432
+ });
1433
+ return { css: nextCss, exports };
1434
+ }, getSassOptions = (config, language) => ({
1435
+ ...config?.sass ?? {},
1436
+ ...language === "scss" ? config?.scss ?? {} : {}
1437
+ }), getLessOptions = (config) => config?.less ?? {}, getStylusOptions = (config) => config?.stylus ?? {}, createStyleTransformConfig = (stylePreprocessors, postcss) => postcss === undefined ? stylePreprocessors : { ...stylePreprocessors ?? {}, postcss }, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
1438
+ ${contents}` : contents, normalizePostcssModule = (mod) => {
1439
+ if (mod && typeof mod === "object" && "default" in mod) {
1440
+ return mod.default ?? mod;
1441
+ }
1442
+ return mod;
1443
+ }, loadPostcssConfigFile = async (configPath) => {
1444
+ const resolved = resolve4(process.cwd(), configPath);
1445
+ const loaded = resolved.endsWith(".cjs") || resolved.endsWith(".cts") ? requireOptionalPeerSync(resolved) : await importOptionalPeer(`${new URL(`file://${resolved}`).href}?t=${Date.now()}`);
1446
+ const config = normalizePostcssModule(loaded);
1447
+ const value = typeof config === "function" ? await config({
1448
+ cwd: process.cwd(),
1449
+ env: "development"
1450
+ }) : config;
1451
+ return normalizePostcssModule(value) ?? {};
1452
+ }, normalizePostcssPlugins = (plugins) => {
1453
+ if (!plugins)
1454
+ return [];
1455
+ if (Array.isArray(plugins))
1456
+ return plugins.filter(Boolean);
1457
+ const resolved = [];
1458
+ for (const [specifier, options] of Object.entries(plugins)) {
1459
+ if (options === false)
1460
+ continue;
1461
+ const mod = normalizePostcssModule(requireOptionalPeerSync(specifier));
1462
+ const plugin = typeof mod === "function" ? mod(options === true ? undefined : options) : mod;
1463
+ if (plugin)
1464
+ resolved.push(plugin);
1465
+ }
1466
+ return resolved;
1467
+ }, resolvePostcssConfig = async (config) => {
1468
+ const inlineConfig = config?.postcss;
1469
+ if (!inlineConfig)
1470
+ return null;
1471
+ const fileConfig = inlineConfig.config ? await loadPostcssConfigFile(inlineConfig.config) : {};
1472
+ const plugins = [
1473
+ ...normalizePostcssPlugins(fileConfig.plugins),
1474
+ ...normalizePostcssPlugins(inlineConfig.plugins)
1475
+ ];
1476
+ if (plugins.length === 0)
1477
+ return null;
1478
+ return {
1479
+ options: {
1480
+ ...fileConfig.options ?? {},
1481
+ ...inlineConfig.options ?? {}
1482
+ },
1483
+ plugins
1484
+ };
1485
+ }, runPostcss = async (css, filePath, config) => {
1486
+ const postcssConfig = await resolvePostcssConfig(config);
1487
+ if (!postcssConfig)
1488
+ return css;
1489
+ let postcssModule;
1490
+ try {
1491
+ postcssModule = await importOptionalPeer("postcss");
1492
+ } catch {
1493
+ throw missingDependencyError("postcss", filePath);
1494
+ }
1495
+ const postcss = postcssModule.default ?? postcssModule;
1496
+ const result = await postcss(postcssConfig.plugins).process(css, {
1497
+ from: filePath,
1498
+ map: false,
1499
+ ...postcssConfig.options
1500
+ });
1501
+ return result.css;
1502
+ }, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
1503
+ canonicalize(specifier, options) {
1504
+ const fromDirectory = options.containingUrl ? dirname2(fileURLToPath(options.containingUrl)) : dirname2(entryFile);
1505
+ const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
1506
+ return resolved ? new URL(pathToFileURL(resolve4(resolved)).href) : null;
1507
+ },
1508
+ load(canonicalUrl) {
1509
+ const filePath = fileURLToPath(canonicalUrl);
1510
+ deps?.add(filePath);
1511
+ const fileLanguage = getStyleLanguage(filePath);
1512
+ if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
1513
+ return null;
1514
+ return {
1515
+ contents: preprocessLoadedStyle(readFileSync3(filePath, "utf-8"), filePath, entryFile, loadPaths, language, config),
1516
+ syntax: filePath.endsWith(".sass") ? "indented" : "scss"
1517
+ };
1518
+ }
1519
+ }), createLessFileManager = (entryFile, loadPaths, config, deps) => ({
1520
+ install(less, pluginManager) {
1521
+ const baseManager = new less.FileManager;
1522
+ const manager = Object.create(baseManager);
1523
+ manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config));
1524
+ manager.loadFile = async (filename, currentDirectory) => {
1525
+ const resolved = resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config);
1526
+ if (!resolved) {
1527
+ throw new Error(`Unable to resolve Less import "${filename}"`);
1528
+ }
1529
+ deps?.add(resolved);
1530
+ return {
1531
+ contents: preprocessLoadedStyle(await readFile(resolved, "utf-8"), resolved, entryFile, loadPaths, "less", config),
1532
+ filename: resolved
1533
+ };
1534
+ };
1535
+ pluginManager.addFileManager(manager);
1536
+ }
1537
+ }), renderStylus = async (contents, filePath, loadPaths, options, deps) => {
1538
+ let stylus;
1539
+ try {
1540
+ const stylusModule = await importOptionalPeer("stylus");
1541
+ stylus = stylusModule.default ?? stylusModule;
1542
+ } catch {
1543
+ throw missingDependencyError("stylus", filePath);
1544
+ }
1545
+ return new Promise((resolveCss, reject) => {
1546
+ const renderer = stylus(contents);
1547
+ renderer.set("filename", filePath);
1548
+ for (const [key, value] of Object.entries(options.options ?? {})) {
1549
+ renderer.set(key, value);
1550
+ }
1551
+ for (const path of loadPaths)
1552
+ renderer.include(path);
1553
+ renderer.render((error, css) => {
1554
+ if (error) {
1555
+ reject(error);
1556
+ return;
1557
+ }
1558
+ if (deps) {
1559
+ const stylusDeps = renderer.deps?.();
1560
+ if (Array.isArray(stylusDeps)) {
1561
+ for (const dep of stylusDeps)
1562
+ deps.add(resolve4(dep));
1563
+ }
1564
+ }
1565
+ resolveCss(css ?? "");
1566
+ });
1567
+ });
1568
+ }, styleDependencyGraph, styleOutputHashes, recordStyleDeps = (entry, deps) => {
1569
+ const key = resolve4(entry);
1570
+ const stripped = new Set;
1571
+ for (const dep of deps) {
1572
+ const resolved = resolve4(dep);
1573
+ if (resolved !== key)
1574
+ stripped.add(resolved);
1575
+ }
1576
+ styleDependencyGraph.set(key, stripped);
1577
+ }, addStyleImporter = (importerPath, stylePath) => {
1578
+ const key = resolve4(importerPath);
1579
+ const target = resolve4(stylePath);
1580
+ const deps = styleDependencyGraph.get(key) ?? new Set;
1581
+ deps.add(target);
1582
+ styleDependencyGraph.set(key, deps);
1583
+ }, findStyleEntriesImporting = (changedPath) => {
1584
+ const target = resolve4(changedPath);
1585
+ const importers = [];
1586
+ for (const [entry, deps] of styleDependencyGraph) {
1587
+ if (deps.has(target))
1588
+ importers.push(entry);
1589
+ }
1590
+ return importers;
1591
+ }, recordStyleOutput = (entry, css) => {
1592
+ const key = resolve4(entry);
1593
+ const hash = createHash("sha1").update(css).digest("hex");
1594
+ const previous = styleOutputHashes.get(key);
1595
+ styleOutputHashes.set(key, hash);
1596
+ return previous !== hash;
1597
+ }, forgetStyleEntry = (entry) => {
1598
+ const key = resolve4(entry);
1599
+ styleDependencyGraph.delete(key);
1600
+ styleOutputHashes.delete(key);
1601
+ }, compileStyleSource = async (filePath, source, languageHint, config) => {
1602
+ const language = getStyleLanguage(languageHint ?? filePath);
1603
+ const rawContents = source ?? await readFile(filePath, "utf-8");
1604
+ const deps = new Set;
1605
+ if (language === "scss" || language === "sass") {
1606
+ const options = getSassOptions(config, language);
1607
+ const packageName = options.implementation ?? "sass";
1608
+ let sass;
1609
+ try {
1610
+ sass = await importOptionalPeer(packageName);
1611
+ } catch {
1612
+ throw missingDependencyError(packageName, filePath);
1613
+ }
1614
+ const contents = withAdditionalData(rawContents, options.additionalData);
1615
+ const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
1616
+ try {
1617
+ const result = sass.compileString(contents, {
1618
+ importers: [
1619
+ createSassImporter(filePath, loadPaths, language, config, deps)
1620
+ ],
1621
+ loadPaths,
1622
+ style: "expanded",
1623
+ syntax: language === "sass" ? "indented" : "scss",
1624
+ url: new URL(pathToFileURL(resolve4(filePath)).href)
1625
+ });
1626
+ const css = await runPostcss(result.css, filePath, config);
1627
+ const loadedUrls = result.loadedUrls ?? [];
1628
+ for (const url of loadedUrls) {
1629
+ if (url.protocol !== "file:")
1630
+ continue;
1631
+ const dep = fileURLToPath(url);
1632
+ if (resolve4(dep) === resolve4(filePath))
1633
+ continue;
1634
+ deps.add(dep);
1635
+ }
1636
+ recordStyleDeps(filePath, deps);
1637
+ return css;
1638
+ } catch (error) {
1639
+ throwPreprocessorError(error, filePath, language);
1640
+ }
1641
+ }
1642
+ if (language === "less") {
1643
+ const options = getLessOptions(config);
1644
+ let lessModule;
1645
+ try {
1646
+ lessModule = await importOptionalPeer("less");
1647
+ } catch {
1648
+ throw missingDependencyError("less", filePath);
1649
+ }
1650
+ const less = lessModule.render ? lessModule : lessModule.default;
1651
+ const render = less?.render;
1652
+ if (!render)
1653
+ throw missingDependencyError("less", filePath);
1654
+ const contents = withAdditionalData(rawContents, options.additionalData);
1655
+ const loadPaths = normalizeLoadPaths(filePath, options.paths);
1656
+ try {
1657
+ const result = await render(contents, {
1658
+ ...options.options ?? {},
1659
+ filename: filePath,
1660
+ paths: loadPaths,
1661
+ plugins: [
1662
+ ...options.options?.plugins ?? [],
1663
+ createLessFileManager(filePath, loadPaths, config, deps)
1664
+ ]
1665
+ });
1666
+ const css = await runPostcss(result.css, filePath, config);
1667
+ recordStyleDeps(filePath, deps);
1668
+ return css;
1669
+ } catch (error) {
1670
+ throwPreprocessorError(error, filePath, "less");
1671
+ }
1672
+ }
1673
+ if (language === "stylus") {
1674
+ const options = getStylusOptions(config);
1675
+ const loadPaths = normalizeLoadPaths(filePath, options.paths);
1676
+ const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
1677
+ try {
1678
+ const css = await runPostcss(await renderStylus(contents, filePath, loadPaths, options, deps), filePath, config);
1679
+ recordStyleDeps(filePath, deps);
1680
+ return css;
1681
+ } catch (error) {
1682
+ throwPreprocessorError(error, filePath, "stylus");
1683
+ }
1684
+ }
1685
+ return runPostcss(rawContents, filePath, config);
1686
+ }, createStylePreprocessorPlugin = (config) => ({
1687
+ name: "absolute-style-preprocessor",
1688
+ setup(build) {
1689
+ const cssModuleSources = new Map;
1690
+ build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
1691
+ namespace: "absolute-style-module",
1692
+ path: path.slice("absolute-style-module:".length)
1693
+ }));
1694
+ build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
1695
+ const source = cssModuleSources.get(path);
1696
+ if (!source) {
1697
+ throw new Error(`Unable to resolve CSS module source for ${path}`);
1698
+ }
1699
+ return {
1700
+ contents: source.css,
1701
+ loader: "css"
1702
+ };
1703
+ });
1704
+ build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
1705
+ if (isStyleModulePath(path)) {
1706
+ const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
1707
+ const compiled = await compileStyleSource(path, undefined, undefined, config);
1708
+ const { css, exports } = extractCssModuleExports(compiled);
1709
+ cssModuleSources.set(cssModulePath, { css, exports });
1710
+ const exportSource = Object.keys(exports).length > 0 ? `import styles from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)}; export default Object.assign({}, styles, ${JSON.stringify(exports)});` : `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`;
1711
+ return {
1712
+ contents: exportSource,
1713
+ loader: "js"
1714
+ };
1715
+ }
1716
+ return {
1717
+ contents: await compileStyleSource(path, undefined, undefined, config),
1718
+ loader: "css"
1719
+ };
1720
+ });
1721
+ build.onLoad({ filter: CSS_EXTENSION_PATTERN }, async ({ path }) => ({
1722
+ contents: await compileStyleSource(path, undefined, undefined, config),
1723
+ loader: "css"
1724
+ }));
1725
+ }
1726
+ }), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
1727
+ style: async ({
1728
+ attributes,
1729
+ content,
1730
+ filename
1731
+ }) => {
1732
+ const language = typeof attributes.lang === "string" ? attributes.lang : typeof attributes.type === "string" ? attributes.type.replace(/^text\//, "") : null;
1733
+ if (!language || !STYLE_LANGUAGE_PATTERN.test(language))
1734
+ return;
1735
+ const path = filename ?? `style.${language}`;
1736
+ return {
1737
+ code: await compileStyleSource(path, content, language, config)
1738
+ };
1739
+ }
1740
+ }), CSS_IMPORT_PATTERN, resolveCssImportsAsync = async (content, baseDir, visited) => {
1741
+ const matches = Array.from(content.matchAll(CSS_IMPORT_PATTERN));
1742
+ if (matches.length === 0)
1743
+ return content;
1744
+ let cursor = 0;
1745
+ const parts = [];
1746
+ for (const match of matches) {
1747
+ const importPath = match[1];
1748
+ if (importPath === undefined)
1749
+ continue;
1750
+ const start = match.index ?? 0;
1751
+ const end = start + match[0].length;
1752
+ parts.push(content.slice(cursor, start));
1753
+ const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
1754
+ if (visited.has(fullPath) || !existsSync3(fullPath)) {
1755
+ parts.push(visited.has(fullPath) ? "" : match[0]);
1756
+ cursor = end;
1757
+ continue;
1758
+ }
1759
+ const nextVisited = new Set(visited);
1760
+ nextVisited.add(fullPath);
1761
+ const imported = await readFile(fullPath, "utf-8");
1762
+ parts.push(await resolveCssImportsAsync(imported, dirname2(fullPath), nextVisited));
1763
+ cursor = end;
1764
+ }
1765
+ parts.push(content.slice(cursor));
1766
+ return parts.join("");
1767
+ }, compileStyleFileIfNeeded = async (filePath, config) => {
1768
+ if (!isPreprocessableStylePath(filePath)) {
1769
+ const raw = await readFile(filePath, "utf-8");
1770
+ const processed = await runPostcss(raw, filePath, config);
1771
+ return resolveCssImportsAsync(processed, dirname2(filePath), new Set([filePath]));
1772
+ }
1773
+ const compiled = await compileStyleSource(filePath, undefined, undefined, config);
1774
+ return resolveCssImportsAsync(compiled, dirname2(filePath), new Set([filePath]));
1775
+ }, resolveCssImportsSync = (content, baseDir, visited) => {
1776
+ return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
1777
+ const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
1778
+ if (visited.has(fullPath))
1779
+ return "";
1780
+ if (!existsSync3(fullPath))
1781
+ return match;
1782
+ const nextVisited = new Set(visited);
1783
+ nextVisited.add(fullPath);
1784
+ const imported = readFileSync3(fullPath, "utf-8");
1785
+ return resolveCssImportsSync(imported, dirname2(fullPath), nextVisited);
1786
+ });
1787
+ }, compileStyleFileIfNeededSync = (filePath, config) => {
1788
+ const rawContents = readFileSync3(filePath, "utf-8");
1789
+ const language = getStyleLanguage(filePath);
1790
+ if (config?.postcss) {
1791
+ throw new Error(`Unable to compile ${filePath}: PostCSS preprocessing is async-only.`);
1792
+ }
1793
+ if (language === "scss" || language === "sass") {
1794
+ const options = getSassOptions(config, language);
1795
+ const packageName = options.implementation ?? "sass";
1796
+ let sass;
1797
+ try {
1798
+ sass = requireOptionalPeerSync(packageName);
1799
+ } catch {
1800
+ throw missingDependencyError(packageName, filePath);
1801
+ }
1802
+ const contents = withAdditionalData(rawContents, options.additionalData);
1803
+ const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
1804
+ const result = sass.compileString(contents, {
1805
+ importers: [
1806
+ createSassImporter(filePath, loadPaths, language, config)
1807
+ ],
1808
+ loadPaths,
1809
+ style: "expanded",
1810
+ syntax: language === "sass" ? "indented" : "scss",
1811
+ url: new URL(pathToFileURL(resolve4(filePath)).href)
1812
+ });
1813
+ const loadedUrls = result.loadedUrls ?? [];
1814
+ for (const url of loadedUrls) {
1815
+ if (url.protocol !== "file:")
1816
+ continue;
1817
+ const dep = fileURLToPath(url);
1818
+ if (resolve4(dep) === resolve4(filePath))
1819
+ continue;
1820
+ addStyleImporter(filePath, dep);
1821
+ }
1822
+ return resolveCssImportsSync(result.css, dirname2(filePath), new Set([filePath]));
1823
+ }
1824
+ if (language === "less") {
1825
+ throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
1826
+ }
1827
+ if (language === "stylus") {
1828
+ throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
1829
+ }
1830
+ return resolveCssImportsSync(rawContents, dirname2(filePath), new Set([filePath]));
1831
+ }, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
1832
+ var init_stylePreprocessor = __esm(() => {
1833
+ CSS_EXTENSION_PATTERN = /\.css$/i;
1834
+ STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less|styl(?:us)?)$/i;
1835
+ STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less|styl(?:us)?)$/i;
1836
+ STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
1837
+ importOptionalPeer = new Function("specifier", "return import(specifier)");
1838
+ requireOptionalPeer = new Function("specifier", "return require(specifier)");
1839
+ requireFromCwd = createRequire(join5(process.cwd(), "package.json"));
1840
+ styleDependencyGraph = new Map;
1841
+ styleOutputHashes = new Map;
1842
+ stylePreprocessorPlugin = createStylePreprocessorPlugin();
1843
+ CSS_IMPORT_PATTERN = /@import\s+["']([^"']+)["']\s*;?/g;
1844
+ });
1845
+
1846
+ // src/core/svelteServerModule.ts
1847
+ import { mkdir as mkdir2, readdir as readdir2 } from "fs/promises";
1848
+ import { basename, dirname as dirname3, extname as extname2, join as join6, relative as relative3, resolve as resolve5 } from "path";
1849
+ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
1850
+ const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
1851
+ return importPath.startsWith(".") ? importPath : `./${importPath}`;
1852
+ }, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
1853
+ for (const entry of entries) {
1854
+ const entryPath = join6(dir, entry.name);
1855
+ if (entry.isDirectory())
1856
+ stack.push(entryPath);
1857
+ if (entry.isFile() && entry.name === targetFileName) {
1858
+ return entryPath;
1859
+ }
1860
+ }
1861
+ return null;
1862
+ }, searchDirectoryLevel = async (dirs, targetFileName) => {
1863
+ if (dirs.length === 0)
1864
+ return null;
1865
+ const nextStack = [];
1866
+ const dirEntries = await Promise.all(dirs.map(async (dir) => ({
1867
+ dir,
1868
+ entries: await readdir2(dir, {
1869
+ encoding: "utf-8",
1870
+ withFileTypes: true
1871
+ })
1872
+ })));
1873
+ for (const { dir, entries } of dirEntries) {
1874
+ const found = processDirectoryEntries(entries, dir, targetFileName, nextStack);
1875
+ if (found)
1876
+ return found;
1877
+ }
1878
+ return searchDirectoryLevel(nextStack, targetFileName);
1879
+ }, findSourceFileByBasename = async (searchRoot, targetFileName) => searchDirectoryLevel([searchRoot], targetFileName), normalizeBuiltSvelteFileName = (sourcePath) => basename(sourcePath).replace(/-[a-z0-9]{6,}(?=\.svelte$)/i, ""), resolveOriginalSourcePath = async (sourcePath) => {
1880
+ const cachedPath = originalSourcePathCache.get(sourcePath);
1881
+ if (cachedPath !== undefined) {
1882
+ return cachedPath;
1883
+ }
1884
+ if (!sourcePath.includes(`${join6(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
1885
+ originalSourcePathCache.set(sourcePath, sourcePath);
1886
+ return sourcePath;
1887
+ }
1888
+ const resolvedSourcePath = await findSourceFileByBasename(join6(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
1889
+ const nextPath = resolvedSourcePath ?? sourcePath;
1890
+ originalSourcePathCache.set(sourcePath, nextPath);
1891
+ return nextPath;
1892
+ }, resolveRelativeModule = async (spec, from) => {
1893
+ if (!spec.startsWith(".")) {
1894
+ return null;
1895
+ }
1896
+ const basePath = resolve5(dirname3(from), spec);
1897
+ const candidates = [
1898
+ basePath,
1899
+ `${basePath}.ts`,
1900
+ `${basePath}.js`,
1901
+ `${basePath}.mjs`,
1902
+ `${basePath}.cjs`,
1903
+ `${basePath}.json`,
1904
+ join6(basePath, "index.ts"),
1905
+ join6(basePath, "index.js"),
1906
+ join6(basePath, "index.mjs"),
1907
+ join6(basePath, "index.cjs"),
1908
+ join6(basePath, "index.json")
1909
+ ];
1910
+ const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
1911
+ const foundIndex = existResults.indexOf(true);
1912
+ return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
1913
+ }, getCachedModulePath2 = (sourcePath) => {
1914
+ const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
1915
+ const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
1916
+ return join6(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
1917
+ }, resolveSvelteImport = async (spec, from) => {
1918
+ if (!spec.startsWith(".") && !spec.startsWith("/")) {
1919
+ const resolved = resolvePackageImport(spec);
1920
+ return resolved && resolved.endsWith(".svelte") ? resolved : null;
1921
+ }
1922
+ if (spec.startsWith("/")) {
1923
+ return spec;
1924
+ }
1925
+ if (!spec.startsWith(".")) {
1926
+ return null;
1927
+ }
1928
+ const explicitPath = resolve5(dirname3(from), spec);
1929
+ if (extname2(explicitPath) === ".svelte") {
1930
+ return explicitPath;
1931
+ }
1932
+ const candidate = `${explicitPath}.svelte`;
1933
+ if (await Bun.file(candidate).exists() === true) {
1934
+ return candidate;
1935
+ }
1936
+ return null;
1937
+ }, writeIfChanged = async (path, content) => {
1938
+ const targetFile = Bun.file(path);
1939
+ const exists = await targetFile.exists();
1940
+ if (exists) {
1941
+ const currentContent = await targetFile.text();
1942
+ if (currentContent === content) {
1943
+ return;
1944
+ }
1945
+ }
1946
+ await Bun.write(path, content);
1947
+ }, compileSvelteServerModule = async (sourcePath) => {
1948
+ const cachedModulePath = compiledModuleCache2.get(sourcePath);
1949
+ if (cachedModulePath) {
1950
+ return cachedModulePath;
1951
+ }
1952
+ const resolutionSourcePath = await resolveOriginalSourcePath(sourcePath);
1953
+ const source = await Bun.file(sourcePath).text();
1954
+ const { compile, preprocess } = await import("svelte/compiler");
1955
+ const loweredAwaitSource = lowerSvelteAwaitSlotSyntax(source);
1956
+ const loweredSource = lowerSvelteIslandSyntax(loweredAwaitSource.code, "server");
1957
+ const preprocessed = await preprocess(loweredSource.code, createSvelteStylePreprocessor());
1958
+ let transpiled = sourcePath.endsWith(".ts") || sourcePath.endsWith(".svelte.ts") ? transpiler.transformSync(preprocessed.code) : preprocessed.code;
1959
+ const childImportSpecs = Array.from(transpiled.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((value) => value !== undefined);
1960
+ const resolvedChildModules = await Promise.all(childImportSpecs.map((spec) => resolveSvelteImport(spec, resolutionSourcePath)));
1961
+ const resolvedModuleImports = await Promise.all(childImportSpecs.map((spec) => resolveRelativeModule(spec, resolutionSourcePath)));
1962
+ const childModulePaths = new Map;
1963
+ const rewrittenModulePaths = new Map;
1964
+ const compiledChildren = await Promise.all(childImportSpecs.map(async (spec, index) => {
1965
+ const resolvedChild = resolvedChildModules[index];
1966
+ if (!spec || !resolvedChild)
1967
+ return null;
1968
+ return {
1969
+ compiledPath: await compileSvelteServerModule(resolvedChild),
1970
+ resolvedChild,
1971
+ spec
1972
+ };
1973
+ }));
1974
+ for (const result of compiledChildren) {
1975
+ if (!result)
1976
+ continue;
1977
+ childModulePaths.set(result.spec, result.compiledPath);
1978
+ childModulePaths.set(result.resolvedChild, result.compiledPath);
1979
+ }
1980
+ for (let index = 0;index < childImportSpecs.length; index += 1) {
1981
+ const spec = childImportSpecs[index];
1982
+ const resolvedModuleImport = resolvedModuleImports[index];
1983
+ if (!spec || !resolvedModuleImport)
1984
+ continue;
1985
+ if (resolvedChildModules[index])
1986
+ continue;
1987
+ rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), resolvedModuleImport));
1988
+ }
1989
+ for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
1990
+ transpiled = transpiled.replaceAll(spec, resolvedModuleImport);
1991
+ }
1992
+ let compiledCode = compile(transpiled, {
1993
+ css: "injected",
1994
+ experimental: {
1995
+ async: loweredAwaitSource.transformed || loweredSource.transformed
1996
+ },
1997
+ filename: resolutionSourcePath,
1998
+ generate: "server"
1999
+ }).js.code;
2000
+ for (const [spec, compiledChildPath] of childModulePaths) {
2001
+ compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), compiledChildPath));
2002
+ }
2003
+ for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
2004
+ compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
2005
+ }
2006
+ const compiledModulePath = getCachedModulePath2(sourcePath);
2007
+ await mkdir2(dirname3(compiledModulePath), { recursive: true });
2008
+ await writeIfChanged(compiledModulePath, compiledCode);
2009
+ compiledModuleCache2.set(sourcePath, compiledModulePath);
2010
+ return compiledModulePath;
2011
+ };
2012
+ var init_svelteServerModule = __esm(() => {
2013
+ init_resolvePackageImport();
2014
+ init_lowerIslandSyntax();
2015
+ init_lowerAwaitSlotSyntax();
2016
+ init_stylePreprocessor();
2017
+ serverCacheRoot2 = join6(process.cwd(), ".absolutejs", "islands", "svelte");
2018
+ compiledModuleCache2 = new Map;
2019
+ originalSourcePathCache = new Map;
2020
+ transpiler = new Bun.Transpiler({
2021
+ loader: "ts",
2022
+ target: "browser"
2023
+ });
2024
+ });
2025
+
2026
+ // src/core/vueServerModule.ts
2027
+ import { existsSync as existsSync4, readFileSync as readFileSync4, realpathSync } from "fs";
2028
+ import { mkdir as mkdir3 } from "fs/promises";
2029
+ import { dirname as dirname4, join as join7, relative as relative4, resolve as resolve6 } from "path";
2030
+ var {Transpiler } = globalThis.Bun;
2031
+ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, transpiler2, ensureRelativeImportPath2 = (from, target) => {
2032
+ const importPath = relative4(dirname4(from), target).replace(/\\/g, "/");
2033
+ return importPath.startsWith(".") ? importPath : `./${importPath}`;
2034
+ }, getCachedModulePath3 = (sourcePath) => {
2035
+ const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
2036
+ const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
2037
+ return join7(serverCacheRoot3, `${normalizedSourcePath}.server.js`);
2038
+ }, writeIfChanged2 = async (path, content) => {
2039
+ const targetFile = Bun.file(path);
2040
+ if (await targetFile.exists()) {
2041
+ const currentContent = await targetFile.text();
2042
+ if (currentContent === content)
2043
+ return;
2044
+ }
2045
+ await Bun.write(path, content);
2046
+ }, stripExports = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports = (code) => {
2047
+ const lines = code.split(`
2048
+ `);
2049
+ const specifierSet = new Set;
2050
+ const vueImportRegex = /^import\s+{([^}]+)}\s+from\s+['"]vue['"];?$/;
2051
+ lines.forEach((line) => {
2052
+ const match = line.match(vueImportRegex);
2053
+ if (match?.[1])
2054
+ match[1].split(",").forEach((importSpecifier) => specifierSet.add(importSpecifier.trim()));
2055
+ });
2056
+ const nonVueLines = lines.filter((line) => !vueImportRegex.test(line));
2057
+ return specifierSet.size ? [
2058
+ `import { ${[...specifierSet].join(", ")} } from "vue";`,
2059
+ ...nonVueLines
2060
+ ].join(`
2061
+ `) : nonVueLines.join(`
2062
+ `);
2063
+ }, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
2064
+ const cachedModulePath = compiledModuleCache3.get(sourcePath);
2065
+ if (cachedModulePath)
2066
+ return cachedModulePath;
2067
+ const compiler = await import("@vue/compiler-sfc");
2068
+ const source = await Bun.file(sourcePath).text();
2069
+ const { descriptor } = compiler.parse(source, { filename: sourcePath });
2070
+ const componentId = Bun.hash(sourcePath).toString(BASE_36_RADIX).slice(0, ISLAND_COMPONENT_ID_LENGTH);
2071
+ const hasScript = descriptor.script || descriptor.scriptSetup;
2072
+ const compiledScript = hasScript ? compiler.compileScript(descriptor, {
2073
+ fs: {
2074
+ fileExists: existsSync4,
2075
+ realpath: realpathSync,
2076
+ readFile: (file) => existsSync4(file) ? readFileSync4(file, "utf-8") : undefined
2077
+ },
2078
+ id: componentId,
2079
+ inlineTemplate: false
2080
+ }) : { bindings: {}, content: "export default {};" };
2081
+ const renderCode = descriptor.template ? compiler.compileTemplate({
2082
+ compilerOptions: {
2083
+ bindingMetadata: compiledScript.bindings,
2084
+ expressionPlugins: ["typescript"],
2085
+ prefixIdentifiers: true,
2086
+ isCustomElement: (tag) => tag === "absolute-island"
2087
+ },
2088
+ filename: sourcePath,
2089
+ id: componentId,
2090
+ scoped: descriptor.styles.some((styleBlock) => styleBlock.scoped),
2091
+ source: descriptor.template.content,
2092
+ ssr: true,
2093
+ ssrCssVars: descriptor.cssVars
2094
+ }).code : "const ssrRender = () => {};";
2095
+ const childImportPaths = extractRelativeVueImports(compiledScript.content);
2096
+ const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
2097
+ compiledPath: await compileVueServerModule(resolve6(dirname4(sourcePath), relativeImport)),
2098
+ spec: relativeImport
2099
+ })));
2100
+ const strippedScript = stripExports(compiledScript.content);
2101
+ const transpiledScript = transpiler2.transformSync(strippedScript);
2102
+ const assembled = mergeVueImports([
2103
+ transpiledScript,
2104
+ renderCode,
2105
+ "script.ssrRender = ssrRender;",
2106
+ "export default script;"
2107
+ ].join(`
2108
+ `));
2109
+ const compiledModulePath = getCachedModulePath3(sourcePath);
2110
+ let rewritten = assembled;
2111
+ for (const child of compiledChildren) {
2112
+ rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
2113
+ }
2114
+ await mkdir3(dirname4(compiledModulePath), { recursive: true });
2115
+ await writeIfChanged2(compiledModulePath, rewritten);
2116
+ compiledModuleCache3.set(sourcePath, compiledModulePath);
2117
+ return compiledModulePath;
2118
+ };
2119
+ var init_vueServerModule = __esm(() => {
2120
+ init_constants();
2121
+ serverCacheRoot3 = join7(process.cwd(), ".absolutejs", "islands", "vue");
2122
+ compiledModuleCache3 = new Map;
2123
+ transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
2124
+ });
2125
+
2126
+ // src/core/islandMarkupAttributes.ts
2127
+ var getIslandMarkerAttributes = (props, islandId) => ({
2128
+ "data-component": props.component,
2129
+ "data-framework": props.framework,
2130
+ "data-hydrate": props.hydrate ?? "load",
2131
+ "data-island": "true",
2132
+ ...islandId ? { "data-island-id": islandId } : {},
2133
+ "data-props": serializeIslandProps(props.props)
2134
+ }), escapeHtmlAttribute = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;"), serializeIslandAttributes = (attributes) => Object.entries(attributes).map(([key, value]) => `${key}="${escapeHtmlAttribute(value)}"`).join(" ");
2135
+ var init_islandMarkupAttributes = __esm(() => {
2136
+ init_islands();
2137
+ });
2138
+
2139
+ // src/core/renderIslandMarkup.ts
2140
+ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
2141
+ islandSequence += 1;
2142
+ return `island-${islandSequence}`;
2143
+ }, isRecord2 = (value) => typeof value === "object" && value !== null, isReactServerIslandComponent = (value) => typeof value === "function", isSvelteServerIslandComponent = (value) => typeof value === "function", isVueServerIslandComponent = (value) => typeof value === "function" || isRecord2(value), isAngularServerIslandComponent = (value) => typeof value === "function", resolveBuildReferencePath = (source, registryPath) => {
2144
+ if (source.startsWith("file://"))
2145
+ return new URL(source).pathname;
2146
+ if (source.startsWith("."))
2147
+ return new URL(source, registryPath).pathname;
2148
+ return source;
2149
+ }, loadAndCompileServerBuildComponent = async (buildReferencePath) => {
2150
+ const compiledModulePath = await compileSvelteServerModule(buildReferencePath);
2151
+ const loadedModule = await import(compiledModulePath);
2152
+ return "default" in loadedModule ? loadedModule.default : loadedModule;
2153
+ }, loadServerBuildComponent = async (buildReferencePath) => {
2154
+ const cachedBuildComponent = resolvedServerBuildComponentCache.get(buildReferencePath);
2155
+ if (cachedBuildComponent) {
2156
+ return cachedBuildComponent;
2157
+ }
2158
+ const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
2159
+ resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
2160
+ return loadPromise;
2161
+ }, resolveRuntimeImportTarget = async (resolvedModulePath) => {
2162
+ if (resolvedModulePath.endsWith(".svelte")) {
2163
+ return compileSvelteServerModule(resolvedModulePath);
2164
+ }
2165
+ if (resolvedModulePath.endsWith(".vue")) {
2166
+ return compileVueServerModule(resolvedModulePath);
2167
+ }
2168
+ return resolvedModulePath;
2169
+ }, loadServerImportComponent = async (resolvedComponent, exportName) => {
2170
+ const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
2171
+ const importTarget = await resolveRuntimeImportTarget(resolvedModulePath);
2172
+ const loadedModule = await import(importTarget);
2173
+ if (exportName && exportName !== "default" && exportName in loadedModule) {
2174
+ return loadedModule[exportName];
2175
+ }
2176
+ return "default" in loadedModule ? loadedModule.default : loadedModule;
2177
+ }, resolveIslandComponent = async (component) => {
2178
+ const buildReference = getIslandBuildReference(component);
2179
+ const buildReferencePath = buildReference?.source ? resolveBuildReferencePath(buildReference.source, import.meta.url) : null;
2180
+ if (buildReferencePath?.endsWith(".svelte")) {
2181
+ return loadServerBuildComponent(buildReferencePath);
2182
+ }
2183
+ if (buildReferencePath) {
2184
+ return loadServerImportComponent(buildReferencePath, buildReference?.export);
2185
+ }
2186
+ const resolvedComponent = getIslandComponent(component);
2187
+ if (typeof resolvedComponent !== "string") {
2188
+ return resolvedComponent;
2189
+ }
2190
+ return loadServerImportComponent(resolvedComponent);
2191
+ }, resolveServerIslandComponent = async (component) => {
2192
+ const cachedResolvedComponent = resolvedServerComponentCache.get(component);
2193
+ if (cachedResolvedComponent) {
2194
+ return cachedResolvedComponent;
2195
+ }
2196
+ const resolutionPromise = resolveIslandComponent(component);
2197
+ resolvedServerComponentCache.set(component, resolutionPromise);
2198
+ return resolutionPromise;
2199
+ }, resolveReactServerIslandComponent = async (component) => {
2200
+ const resolvedComponent = await resolveServerIslandComponent(component);
2201
+ if (!isReactServerIslandComponent(resolvedComponent)) {
2202
+ throw new Error("Resolved React island is not a valid React component.");
2203
+ }
2204
+ return resolvedComponent;
2205
+ }, resolveSvelteServerIslandComponent = async (component) => {
2206
+ const resolvedComponent = await resolveServerIslandComponent(component);
2207
+ if (!isSvelteServerIslandComponent(resolvedComponent)) {
2208
+ throw new Error("Resolved Svelte island is not a valid Svelte component.");
2209
+ }
2210
+ return resolvedComponent;
2211
+ }, resolveVueServerIslandComponent = async (component) => {
2212
+ const resolvedComponent = await resolveServerIslandComponent(component);
2213
+ if (!isVueServerIslandComponent(resolvedComponent)) {
2214
+ throw new Error("Resolved Vue island is not a valid Vue component.");
2215
+ }
2216
+ return resolvedComponent;
2217
+ }, loadAngularServerBuildComponent = async (buildReferencePath, exportName) => {
2218
+ const serverModulePath = await compileAngularServerModule(buildReferencePath);
2219
+ const loadedModule = await import(serverModulePath);
2220
+ if (exportName && exportName !== "default" && exportName in loadedModule) {
2221
+ return loadedModule[exportName];
2222
+ }
2223
+ return "default" in loadedModule ? loadedModule.default : loadedModule;
2224
+ }, resolveAngularServerIslandComponent = async (component) => {
2225
+ const buildReference = getIslandBuildReference(component);
2226
+ const buildReferencePath = buildReference?.source ? resolveBuildReferencePath(buildReference.source, import.meta.url) : null;
2227
+ const resolvedComponent = buildReferencePath ? await loadAngularServerBuildComponent(buildReferencePath, buildReference?.export) : await resolveServerIslandComponent(component);
2228
+ if (!isAngularServerIslandComponent(resolvedComponent)) {
2229
+ throw new Error("Resolved Angular island is not a valid Angular component.");
2230
+ }
2231
+ return resolvedComponent;
2232
+ }, renderIslandMarkup = async (registry, props) => {
2233
+ const result = await renderIslandResult(registry, props);
2234
+ return `<div ${serializeIslandAttributes(result.attributes)}>${result.html}</div>`;
2235
+ }, renderIslandResult = async (registry, props) => {
2236
+ const islandId = nextIslandId();
2237
+ const attributes = getIslandMarkerAttributes(props);
2238
+ if (props.framework === "react") {
2239
+ const entry = registry.react?.[props.component];
2240
+ if (!entry) {
2241
+ throw new Error(`Island component "${props.component}" is not registered for framework "react".`);
2242
+ }
2243
+ const component = await resolveReactServerIslandComponent(entry);
2244
+ const html = await renderReactIslandToHtml(component, props.props);
2245
+ return { attributes, html };
2246
+ }
2247
+ if (props.framework === "svelte") {
2248
+ const entry = registry.svelte?.[props.component];
2249
+ if (!entry) {
2250
+ throw new Error(`Island component "${props.component}" is not registered for framework "svelte".`);
2251
+ }
2252
+ const component = await resolveSvelteServerIslandComponent(entry);
2253
+ const html = await renderSvelteIslandToHtml(component, props.props);
2254
+ return { attributes, html };
2255
+ }
2256
+ if (props.framework === "vue") {
2257
+ const entry = registry.vue?.[props.component];
2258
+ if (!entry) {
2259
+ throw new Error(`Island component "${props.component}" is not registered for framework "vue".`);
2260
+ }
2261
+ const component = await resolveVueServerIslandComponent(entry);
2262
+ const html = await renderVueIslandToHtml(component, props.props);
2263
+ return { attributes, html };
2264
+ }
2265
+ if (props.framework === "angular") {
2266
+ const entry = registry.angular?.[props.component];
2267
+ if (!entry) {
2268
+ throw new Error(`Island component "${props.component}" is not registered for framework "angular".`);
2269
+ }
2270
+ const component = await resolveAngularServerIslandComponent(entry);
2271
+ const html = await renderAngularIslandToHtml2(component, props.props, islandId);
2272
+ return {
2273
+ attributes: {
2274
+ ...getIslandMarkerAttributes(props, islandId)
2275
+ },
2276
+ html
2277
+ };
2278
+ }
2279
+ throw new Error(`Framework "${props.framework}" is not implemented in this prototype.`);
2280
+ };
2281
+ var init_renderIslandMarkup = __esm(() => {
2282
+ init_islandSsr();
2283
+ init_angularServerModule();
2284
+ init_svelteServerModule();
2285
+ init_vueServerModule();
2286
+ init_islandMarkupAttributes();
2287
+ init_islands();
2288
+ resolvedServerComponentCache = new Map;
2289
+ resolvedServerBuildComponentCache = new Map;
2290
+ });
2291
+
2292
+ // src/islands/index.ts
2293
+ init_islands();
2294
+ init_renderIslandMarkup();
2295
+
2296
+ // node_modules/zustand/esm/vanilla.mjs
2297
+ var createStoreImpl = (createState) => {
2298
+ let state;
2299
+ const listeners = /* @__PURE__ */ new Set;
2300
+ const setState = (partial, replace) => {
2301
+ const nextState = typeof partial === "function" ? partial(state) : partial;
2302
+ if (!Object.is(nextState, state)) {
2303
+ const previousState = state;
2304
+ state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
2305
+ listeners.forEach((listener) => listener(state, previousState));
2306
+ }
2307
+ };
2308
+ const getState = () => state;
2309
+ const getInitialState = () => initialState;
2310
+ const subscribe = (listener) => {
2311
+ listeners.add(listener);
2312
+ return () => listeners.delete(listener);
2313
+ };
2314
+ const api = { setState, getState, getInitialState, subscribe };
2315
+ const initialState = state = createState(setState, getState, api);
2316
+ return api;
2317
+ };
2318
+ var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
2319
+
2320
+ // node_modules/zustand/esm/middleware.mjs
2321
+ function combine(initialState, create) {
2322
+ return (...args) => Object.assign({}, initialState, create(...args));
2323
+ }
2324
+
2325
+ // src/client/islandStore.ts
2326
+ var getIslandStoreSnapshot = () => {
2327
+ globalThis.__ABS_ISLAND_STATE__ ??= {};
2328
+ return globalThis.__ABS_ISLAND_STATE__;
2329
+ };
2330
+ var getIslandStores = () => {
2331
+ globalThis.__ABS_ISLAND_STORES__ ??= new Map;
2332
+ return globalThis.__ABS_ISLAND_STORES__;
2333
+ };
2334
+ var isSerializableValue = (value) => typeof value !== "function" && value !== undefined;
2335
+ var toSerializableState = (state) => Object.fromEntries(Object.entries(state).filter(([, value]) => isSerializableValue(value)));
2336
+ var applySnapshot = (store, snapshot) => {
2337
+ if (!snapshot) {
2338
+ return;
2339
+ }
2340
+ store.setState({
2341
+ ...store.getState(),
2342
+ ...snapshot
2343
+ });
2344
+ };
2345
+ var getPeerStores = (storeInstances, ownerStore) => [...storeInstances].filter((peer) => peer.store !== ownerStore);
2346
+ var syncIslandSnapshot = (storeId, state, storeInstances, ownerStore) => {
2347
+ const nextSnapshot = toSerializableState(state);
2348
+ getIslandStoreSnapshot()[storeId] = nextSnapshot;
2349
+ for (const peerStore of getPeerStores(storeInstances, ownerStore)) {
2350
+ peerStore.applyExternalSnapshot(nextSnapshot);
2351
+ }
2352
+ };
2353
+ var createIslandStore = (storeId, initialState, createState) => {
2354
+ const store = createStore(combine(initialState, createState));
2355
+ const stores = getIslandStores();
2356
+ const storeInstances = stores.get(storeId) ?? new Set;
2357
+ const initialSnapshot = getIslandStoreSnapshot()[storeId];
2358
+ applySnapshot(store, initialSnapshot);
2359
+ let isApplyingExternalSnapshot = false;
2360
+ const applyExternalSnapshot = (snapshot) => {
2361
+ isApplyingExternalSnapshot = true;
2362
+ applySnapshot(store, snapshot);
2363
+ };
2364
+ storeInstances.add({
2365
+ applyExternalSnapshot,
2366
+ store
2367
+ });
2368
+ stores.set(storeId, storeInstances);
2369
+ syncIslandSnapshot(storeId, store.getState(), storeInstances, store);
2370
+ store.subscribe((state) => {
2371
+ if (isApplyingExternalSnapshot) {
2372
+ isApplyingExternalSnapshot = false;
2373
+ return;
2374
+ }
2375
+ syncIslandSnapshot(storeId, state, storeInstances, store);
2376
+ });
2377
+ return store;
2378
+ };
2379
+ var getIslandStoreServerSnapshot = (store, selector) => selector(store.getInitialState());
2380
+ var applySnapshotToStoreInstances = (storeId, instances, snapshot) => {
2381
+ for (const instance of instances) {
2382
+ instance.applyExternalSnapshot(snapshot[storeId] ?? {});
2383
+ }
2384
+ };
2385
+ var initializeIslandStores = (state) => {
2386
+ const currentSnapshot = getIslandStoreSnapshot();
2387
+ const nextSnapshot = {
2388
+ ...state,
2389
+ ...currentSnapshot
2390
+ };
2391
+ globalThis.__ABS_ISLAND_STATE__ = nextSnapshot;
2392
+ for (const [storeId, store] of getIslandStores()) {
2393
+ applySnapshotToStoreInstances(storeId, store, nextSnapshot);
2394
+ }
2395
+ };
2396
+ var readIslandStore = (store, selector) => selector(store.getState());
2397
+ var subscribeIslandStore = (store, selector, listener) => {
2398
+ let currentSelection = selector(store.getState());
2399
+ return store.subscribe((state) => {
2400
+ const nextSelection = selector(state);
2401
+ if (Object.is(nextSelection, currentSelection)) {
2402
+ return;
2403
+ }
2404
+ currentSelection = nextSelection;
2405
+ listener(nextSelection);
2406
+ });
2407
+ };
2408
+ export {
2409
+ renderIslandMarkup,
2410
+ defineIslandRegistry,
2411
+ createIslandStore
2412
+ };
2413
+
2414
+ //# debugId=EB7E69D336832B3A64756E2164756E21
2415
+ //# sourceMappingURL=index.js.map