tungsten 0.6.2 → 0.7.0

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 (486) hide show
  1. package/dist/.build-complete +1 -1
  2. package/dist/Brands.d.ts +16 -0
  3. package/dist/Brands.d.ts.map +1 -0
  4. package/dist/Brands.js +22 -0
  5. package/dist/Components.d.ts +4 -1
  6. package/dist/Components.d.ts.map +1 -1
  7. package/dist/Components.js +24 -6
  8. package/dist/ContentNode.d.ts +3 -2
  9. package/dist/ContentNode.d.ts.map +1 -1
  10. package/dist/ContentNode.js +11 -0
  11. package/dist/Framework.d.ts.map +1 -1
  12. package/dist/Framework.js +23 -4
  13. package/dist/FrameworkConfig.d.ts +7 -1
  14. package/dist/FrameworkConfig.d.ts.map +1 -1
  15. package/dist/FunctionComponent.d.ts +1 -0
  16. package/dist/FunctionComponent.d.ts.map +1 -1
  17. package/dist/FunctionComponentStandIn.d.ts.map +1 -1
  18. package/dist/Instance/Instance.d.ts +29 -12
  19. package/dist/Instance/Instance.d.ts.map +1 -1
  20. package/dist/Instance/Instance.js +59 -21
  21. package/dist/Instance/InstanceConfig.d.ts +2 -1
  22. package/dist/Instance/InstanceConfig.d.ts.map +1 -1
  23. package/dist/RenderedContentNode.d.ts.map +1 -1
  24. package/dist/RenderingNode.d.ts.map +1 -1
  25. package/dist/Servers/DevServer.d.ts +4 -2
  26. package/dist/Servers/DevServer.d.ts.map +1 -1
  27. package/dist/Servers/DevServer.js +62 -20
  28. package/dist/Servers/ProdServer.d.ts +4 -2
  29. package/dist/Servers/ProdServer.d.ts.map +1 -1
  30. package/dist/Servers/ProdServer.js +77 -18
  31. package/dist/Servers/StaticSiteServer.d.ts +1 -1
  32. package/dist/Servers/StaticSiteServer.d.ts.map +1 -1
  33. package/dist/Servers/TungstenServer.d.ts +2 -1
  34. package/dist/Servers/TungstenServer.d.ts.map +1 -1
  35. package/dist/Servers/TungstenServer.js +7 -0
  36. package/dist/Servers/cacheVersioned.d.ts +3 -0
  37. package/dist/Servers/cacheVersioned.d.ts.map +1 -0
  38. package/dist/Servers/cacheVersioned.js +23 -0
  39. package/dist/Servers/devErrorPageAutoRetry.d.ts.map +1 -1
  40. package/dist/Servers/devErrorPageAutoRetry.js +1 -0
  41. package/dist/Servers/initStores.d.ts +4 -4
  42. package/dist/Servers/initStores.d.ts.map +1 -1
  43. package/dist/Servers/initStores.js +2 -2
  44. package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
  45. package/dist/Servers/loadEnvsDev.js +7 -6
  46. package/dist/Servers/resetRegistrations.d.ts +2 -0
  47. package/dist/Servers/resetRegistrations.d.ts.map +1 -0
  48. package/dist/Servers/resetRegistrations.js +13 -0
  49. package/dist/Servers/routing.d.ts +3 -2
  50. package/dist/Servers/routing.d.ts.map +1 -1
  51. package/dist/Servers/routing.js +3 -2
  52. package/dist/Store/InternalStoreSchema.d.ts +1 -1
  53. package/dist/Store/Store.js +2 -1
  54. package/dist/Store/StoreSchemaClass.d.ts +6 -3
  55. package/dist/Store/StoreSchemaClass.d.ts.map +1 -1
  56. package/dist/Store/StoreSchemaClass.js +8 -1
  57. package/dist/Store/TypeSafeStore.js +2 -1
  58. package/dist/Store/createStores.d.ts +3 -3
  59. package/dist/Store/createStores.d.ts.map +1 -1
  60. package/dist/Store/createStores.js +7 -2
  61. package/dist/Store/getInternalStore.d.ts.map +1 -1
  62. package/dist/Store/registerStore.d.ts.map +1 -1
  63. package/dist/Store/registerStore.js +2 -2
  64. package/dist/Store/storeCreators.d.ts +2 -2
  65. package/dist/Store/storeCreators.d.ts.map +1 -1
  66. package/dist/TungstenApp.d.ts +3 -3
  67. package/dist/TungstenApp.d.ts.map +1 -1
  68. package/dist/_client/cjsHelpers.d.ts.map +1 -1
  69. package/dist/_client/cjsHelpers.js +5 -3
  70. package/dist/_client/client.d.ts +2 -0
  71. package/dist/_client/client.d.ts.map +1 -1
  72. package/dist/_client/client.js +10 -3
  73. package/dist/api/getApiRoutes.d.ts.map +1 -1
  74. package/dist/api/getExport.d.ts +1 -1
  75. package/dist/api/getExport.d.ts.map +1 -1
  76. package/dist/api/getExport.js +2 -1
  77. package/dist/api/getExportDev.d.ts +1 -1
  78. package/dist/api/getExportDev.d.ts.map +1 -1
  79. package/dist/appBuilder.d.ts +69 -0
  80. package/dist/appBuilder.d.ts.map +1 -0
  81. package/dist/appBuilder.js +98 -0
  82. package/dist/appBuilder.types.test.d.ts +110 -0
  83. package/dist/appBuilder.types.test.d.ts.map +1 -0
  84. package/dist/appBuilder.types.test.js +240 -0
  85. package/dist/babelPlugins/BabelTransformBindDirect.js +7 -7
  86. package/dist/babelPlugins/BabelTransformBindVar.js +7 -7
  87. package/dist/babelPlugins/BabelTransformComponentState.d.ts.map +1 -1
  88. package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
  89. package/dist/babelPlugins/BabelTransformComponentStyles.js +5 -5
  90. package/dist/babelPlugins/BabelTransformCssImports.d.ts.map +1 -1
  91. package/dist/babelPlugins/BabelTransformCssImports.js +2 -2
  92. package/dist/babelPlugins/BabelTransformDeproxyState.d.ts.map +1 -1
  93. package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
  94. package/dist/babelPlugins/BabelTransformPackageImports.js +11 -6
  95. package/dist/babelPlugins/BabelTransformRemoveDevBlocks.d.ts.map +1 -1
  96. package/dist/babelPlugins/BabelTransformRemoveServerBlocks.d.ts.map +1 -1
  97. package/dist/babelPlugins/BabelTypes.d.ts.map +1 -1
  98. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.d.ts.map +1 -1
  99. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.js +1 -1
  100. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.d.ts.map +1 -1
  101. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.js +2 -2
  102. package/dist/bin/commands/compile.d.ts.map +1 -1
  103. package/dist/bin/commands/compile.js +2 -1
  104. package/dist/build/CompilationInfo.d.ts +3 -0
  105. package/dist/build/CompilationInfo.d.ts.map +1 -1
  106. package/dist/build/assetVersions.d.ts +9 -0
  107. package/dist/build/assetVersions.d.ts.map +1 -0
  108. package/dist/build/assetVersions.js +39 -0
  109. package/dist/build/babel.user.common.config.d.ts.map +1 -1
  110. package/dist/build/bundle.d.ts.map +1 -1
  111. package/dist/build/bundle.js +2 -1
  112. package/dist/build/bundleBabelOptions.d.ts.map +1 -1
  113. package/dist/build/clientRoutesFile.d.ts +2 -0
  114. package/dist/build/clientRoutesFile.d.ts.map +1 -0
  115. package/dist/build/clientRoutesFile.js +13 -0
  116. package/dist/build/compileJavascript.d.ts.map +1 -1
  117. package/dist/build/compileJavascript.js +4 -3
  118. package/dist/build/compileStyles.d.ts +2 -1
  119. package/dist/build/compileStyles.d.ts.map +1 -1
  120. package/dist/build/compileStyles.js +38 -83
  121. package/dist/build/compileUserApp.d.ts.map +1 -1
  122. package/dist/build/componentStylesCache.d.ts.map +1 -1
  123. package/dist/build/componentStylesCache.js +3 -2
  124. package/dist/build/copyAssets.d.ts.map +1 -1
  125. package/dist/build/copyAssets.js +2 -1
  126. package/dist/build/copyPackageModulesToPackagesFolder.d.ts.map +1 -1
  127. package/dist/build/copyPackageModulesToPackagesFolder.js +1 -1
  128. package/dist/build/copyPublicFiles.d.ts.map +1 -1
  129. package/dist/build/copyPublicFiles.js +2 -1
  130. package/dist/build/createClientFiles.d.ts.map +1 -1
  131. package/dist/build/createClientFiles.js +9 -5
  132. package/dist/build/createInstanceConfigFile.d.ts +1 -1
  133. package/dist/build/createInstanceConfigFile.d.ts.map +1 -1
  134. package/dist/build/createInstanceConfigFile.js +9 -3
  135. package/dist/build/frameworkDestLocation.d.ts.map +1 -1
  136. package/dist/build/frameworkDestLocation.js +5 -6
  137. package/dist/build/frameworkStylesheets.d.ts.map +1 -1
  138. package/dist/build/frameworkStylesheets.js +1 -1
  139. package/dist/build/makeBabelRawConfig.d.ts.map +1 -1
  140. package/dist/build/makeBabelUserDevConfig.d.ts +2 -2
  141. package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
  142. package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
  143. package/dist/build/rollup.user.prod.config.d.ts.map +1 -1
  144. package/dist/build/rollup.user.prod.config.js +5 -3
  145. package/dist/build/rollupProdConstants.d.ts +5 -0
  146. package/dist/build/rollupProdConstants.d.ts.map +1 -0
  147. package/dist/build/rollupProdConstants.js +21 -0
  148. package/dist/cacheControl.d.ts +13 -0
  149. package/dist/cacheControl.d.ts.map +1 -0
  150. package/dist/cacheControl.js +22 -0
  151. package/dist/compat/types.d.ts +1 -1
  152. package/dist/compat/types.d.ts.map +1 -1
  153. package/dist/componentHelpers.d.ts +18 -0
  154. package/dist/componentHelpers.d.ts.map +1 -0
  155. package/dist/componentHelpers.js +28 -0
  156. package/dist/componentProxyHandlers.d.ts.map +1 -1
  157. package/dist/components/Fragment.d.ts +8 -0
  158. package/dist/components/Fragment.d.ts.map +1 -0
  159. package/dist/components/Fragment.js +10 -0
  160. package/dist/components/Link.d.ts +4 -3
  161. package/dist/components/Link.d.ts.map +1 -1
  162. package/dist/components/Link.js +1 -0
  163. package/dist/components/NoEscape.d.ts +8 -0
  164. package/dist/components/NoEscape.d.ts.map +1 -0
  165. package/dist/components/NoEscape.js +6 -0
  166. package/dist/components/RouteRedirectComponent.d.ts.map +1 -1
  167. package/dist/components/RouteRedirectComponent.js +1 -1
  168. package/dist/components/WebRedirectComponent.d.ts.map +1 -1
  169. package/dist/components/WebRedirectComponent.js +1 -1
  170. package/dist/components/bindable/BindVariable.d.ts +1 -0
  171. package/dist/components/bindable/BindVariable.d.ts.map +1 -1
  172. package/dist/components/bindable/BindableCheckbox.d.ts +7 -7
  173. package/dist/components/bindable/BindableCheckbox.d.ts.map +1 -1
  174. package/dist/components/bindable/BindableInput.d.ts +7 -7
  175. package/dist/components/bindable/BindableInput.d.ts.map +1 -1
  176. package/dist/components/bindable/BindableInputNonString.d.ts +2 -2
  177. package/dist/components/bindable/BindableInputNonString.d.ts.map +1 -1
  178. package/dist/components/bindable/BindableInputString.d.ts +2 -2
  179. package/dist/components/bindable/BindableInputString.d.ts.map +1 -1
  180. package/dist/components/bindable/BindableInputTyped.d.ts +3 -3
  181. package/dist/components/bindable/BindableInputTyped.d.ts.map +1 -1
  182. package/dist/components/bindable/BindableInputTypedLegacy.d.ts +3 -3
  183. package/dist/components/bindable/BindableInputTypedLegacy.d.ts.map +1 -1
  184. package/dist/components/bindable/BindableRadio.js +2 -2
  185. package/dist/components/bindable/BindableSelect.d.ts +13 -10
  186. package/dist/components/bindable/BindableSelect.d.ts.map +1 -1
  187. package/dist/components/bindable/BindableSelectNaive.js +3 -3
  188. package/dist/components/bindable/BindableTextarea.d.ts +7 -7
  189. package/dist/components/bindable/BindableTextarea.d.ts.map +1 -1
  190. package/dist/components/bindable/bindableCandidates.comparison.d.ts +136 -0
  191. package/dist/components/bindable/bindableCandidates.comparison.d.ts.map +1 -0
  192. package/dist/components/bindable/bindableCandidates.comparison.js +268 -0
  193. package/dist/components/bindable/bindableProps.types.test.d.ts +50 -0
  194. package/dist/components/bindable/bindableProps.types.test.d.ts.map +1 -0
  195. package/dist/components/bindable/bindableProps.types.test.js +252 -0
  196. package/dist/components/library/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  197. package/dist/components/library/RichTextEditor/contentTree.d.ts.map +1 -1
  198. package/dist/components/makeTypedLink.d.ts +9 -0
  199. package/dist/components/makeTypedLink.d.ts.map +1 -0
  200. package/dist/components/makeTypedLink.js +15 -0
  201. package/dist/context/registerContext.d.ts +22 -0
  202. package/dist/context/registerContext.d.ts.map +1 -0
  203. package/dist/context/registerContext.js +18 -0
  204. package/dist/env/getEnvSchemas.d.ts.map +1 -1
  205. package/dist/env/getEnvSchemas.js +2 -1
  206. package/dist/fileVersions.d.ts +9 -0
  207. package/dist/fileVersions.d.ts.map +1 -0
  208. package/dist/fileVersions.js +28 -0
  209. package/dist/findUserConfig.d.ts +1 -1
  210. package/dist/findUserConfig.d.ts.map +1 -1
  211. package/dist/findUserConfig.js +2 -1
  212. package/dist/frameworkConfigSchema.d.ts +14 -2
  213. package/dist/frameworkConfigSchema.d.ts.map +1 -1
  214. package/dist/frameworkConfigSchema.js +11 -2
  215. package/dist/getComponent.d.ts.map +1 -1
  216. package/dist/getComponent.js +4 -3
  217. package/dist/getRoutes.d.ts.map +1 -1
  218. package/dist/getRoutes.js +9 -8
  219. package/dist/hmr/applyHmrModule.d.ts.map +1 -1
  220. package/dist/hmr/componentIdentity.js +1 -1
  221. package/dist/hooks/getCurrentComponent.d.ts +1 -1
  222. package/dist/hooks/getCurrentComponent.d.ts.map +1 -1
  223. package/dist/hydrate/hydrate.d.ts +5 -1
  224. package/dist/hydrate/hydrate.d.ts.map +1 -1
  225. package/dist/hydrate/hydrate.js +59 -46
  226. package/dist/hydrate/hydrateGlobalData.d.ts +4 -3
  227. package/dist/hydrate/hydrateGlobalData.d.ts.map +1 -1
  228. package/dist/hydrate/reconcileHydratedAttributes.d.ts +2 -1
  229. package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
  230. package/dist/hydrate/reconcileHydratedAttributes.js +4 -3
  231. package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -1
  232. package/dist/hydrate/renderHydrationMismatchBanner.js +2 -1
  233. package/dist/importDevModuleWithRetry.d.ts +2 -1
  234. package/dist/importDevModuleWithRetry.d.ts.map +1 -1
  235. package/dist/importDevModuleWithRetry.js +2 -1
  236. package/dist/importModule.d.ts +3 -0
  237. package/dist/importModule.d.ts.map +1 -0
  238. package/dist/importModule.js +4 -0
  239. package/dist/index.js +2 -1
  240. package/dist/indexInner.d.ts +30 -7
  241. package/dist/indexInner.d.ts.map +1 -1
  242. package/dist/indexInner.js +37 -2
  243. package/dist/json.d.ts +12 -0
  244. package/dist/json.d.ts.map +1 -0
  245. package/dist/json.js +8 -0
  246. package/dist/jsxHelpers.d.ts +3 -0
  247. package/dist/jsxHelpers.d.ts.map +1 -0
  248. package/dist/jsxHelpers.js +6 -0
  249. package/dist/jsxRuntime.d.ts +1 -0
  250. package/dist/jsxRuntime.d.ts.map +1 -1
  251. package/dist/jsxRuntime.js +3 -1
  252. package/dist/jsxRuntimeSignals.d.ts.map +1 -1
  253. package/dist/jsxRuntimeSignals.js +1 -0
  254. package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
  255. package/dist/makeInstanceConfigFromFrameworkConfig.js +1 -0
  256. package/dist/mergeConfigs.d.ts.map +1 -1
  257. package/dist/mergeConfigs.js +2 -6
  258. package/dist/nbsp.d.ts +1 -2
  259. package/dist/nbsp.d.ts.map +1 -1
  260. package/dist/nbsp.js +3 -7
  261. package/dist/objectMap.d.ts +1 -1
  262. package/dist/objectMap.d.ts.map +1 -1
  263. package/dist/pipeline/PipelineRequestHandler.d.ts +25 -0
  264. package/dist/pipeline/PipelineRequestHandler.d.ts.map +1 -0
  265. package/dist/pipeline/PipelineRequestHandler.js +96 -0
  266. package/dist/pipeline/contextStore.d.ts +12 -0
  267. package/dist/pipeline/contextStore.d.ts.map +1 -0
  268. package/dist/pipeline/contextStore.js +13 -0
  269. package/dist/pipeline/hydratePipeline.d.ts +4 -0
  270. package/dist/pipeline/hydratePipeline.d.ts.map +1 -0
  271. package/dist/pipeline/hydratePipeline.js +64 -0
  272. package/dist/pipeline/importRoutesModule.d.ts +6 -0
  273. package/dist/pipeline/importRoutesModule.d.ts.map +1 -0
  274. package/dist/pipeline/importRoutesModule.js +33 -0
  275. package/dist/pipeline/networkedTransport.d.ts +11 -0
  276. package/dist/pipeline/networkedTransport.d.ts.map +1 -0
  277. package/dist/pipeline/networkedTransport.js +54 -0
  278. package/dist/pipeline/pipeline.d.ts +105 -0
  279. package/dist/pipeline/pipeline.d.ts.map +1 -0
  280. package/dist/pipeline/pipeline.js +108 -0
  281. package/dist/pipeline/pipeline.types.test.d.ts +650 -0
  282. package/dist/pipeline/pipeline.types.test.d.ts.map +1 -0
  283. package/dist/pipeline/pipeline.types.test.js +342 -0
  284. package/dist/pipeline/pipelineDefinition.d.ts +67 -0
  285. package/dist/pipeline/pipelineDefinition.d.ts.map +1 -0
  286. package/dist/pipeline/pipelineDefinition.js +11 -0
  287. package/dist/pipeline/pipelineSplit.types.test.d.ts +1971 -0
  288. package/dist/pipeline/pipelineSplit.types.test.d.ts.map +1 -0
  289. package/dist/pipeline/pipelineSplit.types.test.js +440 -0
  290. package/dist/pipeline/runPipeline.d.ts +31 -0
  291. package/dist/pipeline/runPipeline.d.ts.map +1 -0
  292. package/dist/pipeline/runPipeline.js +71 -0
  293. package/dist/pipeline/runSplitPipeline.d.ts +10 -0
  294. package/dist/pipeline/runSplitPipeline.d.ts.map +1 -0
  295. package/dist/pipeline/runSplitPipeline.js +48 -0
  296. package/dist/pipeline/splitPipeline.d.ts +62 -0
  297. package/dist/pipeline/splitPipeline.d.ts.map +1 -0
  298. package/dist/pipeline/splitPipeline.js +76 -0
  299. package/dist/pop.js +1 -1
  300. package/dist/rawHtml/filterContentNode.d.ts.map +1 -1
  301. package/dist/render/HeadData.d.ts +3 -1
  302. package/dist/render/HeadData.d.ts.map +1 -1
  303. package/dist/render/classComponentNodeToRenderingTree.d.ts.map +1 -1
  304. package/dist/render/componentNodeToRenderingTree.d.ts.map +1 -1
  305. package/dist/render/contentToHtml.d.ts +2 -2
  306. package/dist/render/contentToHtml.d.ts.map +1 -1
  307. package/dist/render/contentToHtml.js +2 -1
  308. package/dist/render/contentToHtmlDev.d.ts +1 -1
  309. package/dist/render/contentToHtmlDev.d.ts.map +1 -1
  310. package/dist/render/contentTreeToRenderingTree.d.ts.map +1 -1
  311. package/dist/render/contentTreeToRenderingTree.js +2 -1
  312. package/dist/render/functionComponentNodeToRenderingTree.d.ts.map +1 -1
  313. package/dist/render/functionComponentNodeToRenderingTree.js +2 -2
  314. package/dist/render/instantiateComponent.d.ts.map +1 -1
  315. package/dist/render/processHead.d.ts.map +1 -1
  316. package/dist/render/processHead.js +12 -18
  317. package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
  318. package/dist/render/renderingTreeToHtml.js +6 -3
  319. package/dist/render/rootToHtml.d.ts +2 -2
  320. package/dist/render/rootToHtml.d.ts.map +1 -1
  321. package/dist/requests/fetch/delete.d.ts.map +1 -1
  322. package/dist/requests/fetch/delete.js +5 -2
  323. package/dist/requests/fetch/get.js +1 -1
  324. package/dist/requests/fetch/patch.d.ts.map +1 -1
  325. package/dist/requests/fetch/patch.js +5 -2
  326. package/dist/requests/fetch/post.d.ts.map +1 -1
  327. package/dist/requests/fetch/post.js +5 -2
  328. package/dist/requests/fetch/put.d.ts.map +1 -1
  329. package/dist/requests/fetch/put.js +5 -2
  330. package/dist/routesLocationParts.d.ts +6 -0
  331. package/dist/routesLocationParts.d.ts.map +1 -0
  332. package/dist/routesLocationParts.js +10 -0
  333. package/dist/routing/AppRoutes.d.ts +5 -3
  334. package/dist/routing/AppRoutes.d.ts.map +1 -1
  335. package/dist/routing/MatchedRouteInfo.d.ts +11 -0
  336. package/dist/routing/MatchedRouteInfo.d.ts.map +1 -0
  337. package/dist/routing/RouteContentFunction.d.ts +1 -2
  338. package/dist/routing/RouteContentFunction.d.ts.map +1 -1
  339. package/dist/routing/RouteDataFunction.type.d.ts +4 -2
  340. package/dist/routing/RouteDataFunction.type.d.ts.map +1 -1
  341. package/dist/routing/RoutePaths.d.ts +12 -0
  342. package/dist/routing/RoutePaths.d.ts.map +1 -0
  343. package/dist/routing/RoutePaths.js +1 -0
  344. package/dist/routing/RouteTypes.d.ts +6 -4
  345. package/dist/routing/RouteTypes.d.ts.map +1 -1
  346. package/dist/routing/Routes.d.ts +17 -11
  347. package/dist/routing/Routes.d.ts.map +1 -1
  348. package/dist/routing/RoutesFunction.d.ts +11 -2
  349. package/dist/routing/RoutesFunction.d.ts.map +1 -1
  350. package/dist/routing/Serializable.d.ts +5 -0
  351. package/dist/routing/Serializable.d.ts.map +1 -0
  352. package/dist/routing/Serializable.js +1 -0
  353. package/dist/routing/builder.d.ts +99 -0
  354. package/dist/routing/builder.d.ts.map +1 -0
  355. package/dist/routing/builder.js +213 -0
  356. package/dist/routing/builder.trial.d.ts +2 -0
  357. package/dist/routing/builder.trial.d.ts.map +1 -0
  358. package/dist/routing/builder.trial.js +85 -0
  359. package/dist/routing/defineRoutes.d.ts +8 -0
  360. package/dist/routing/defineRoutes.d.ts.map +1 -0
  361. package/dist/routing/defineRoutes.js +3 -0
  362. package/dist/routing/pyramidRouting.d.ts +2 -0
  363. package/dist/routing/pyramidRouting.d.ts.map +1 -0
  364. package/dist/routing/pyramidRouting.js +13 -0
  365. package/dist/routing/registerGlobalData.d.ts +11 -3
  366. package/dist/routing/registerGlobalData.d.ts.map +1 -1
  367. package/dist/routing/registerGlobalData.js +6 -0
  368. package/dist/routing/registerParts.types.test.d.ts +2 -0
  369. package/dist/routing/registerParts.types.test.d.ts.map +1 -0
  370. package/dist/routing/registerParts.types.test.js +139 -0
  371. package/dist/routing/registerRoutes.d.ts +10 -0
  372. package/dist/routing/registerRoutes.d.ts.map +1 -0
  373. package/dist/routing/registerRoutes.js +9 -0
  374. package/dist/routing/registerRouting.d.ts +36 -0
  375. package/dist/routing/registerRouting.d.ts.map +1 -0
  376. package/dist/routing/registerRouting.js +34 -0
  377. package/dist/routing/registerRouting.types.test.d.ts +80 -0
  378. package/dist/routing/registerRouting.types.test.d.ts.map +1 -0
  379. package/dist/routing/registerRouting.types.test.js +120 -0
  380. package/dist/routing/registrationTypes.d.ts +11 -0
  381. package/dist/routing/registrationTypes.d.ts.map +1 -0
  382. package/dist/routing/registrationTypes.js +1 -0
  383. package/dist/routing/resolveAppRoutes.d.ts +5 -0
  384. package/dist/routing/resolveAppRoutes.d.ts.map +1 -0
  385. package/dist/routing/resolveAppRoutes.js +25 -0
  386. package/dist/routing/routeUrl.d.ts +4 -0
  387. package/dist/routing/routeUrl.d.ts.map +1 -1
  388. package/dist/routing/routeUrl.js +4 -0
  389. package/dist/routing/routesArray.d.ts +23 -0
  390. package/dist/routing/routesArray.d.ts.map +1 -0
  391. package/dist/routing/routesArray.js +20 -0
  392. package/dist/routing/routesArray.types.test.d.ts +2 -0
  393. package/dist/routing/routesArray.types.test.d.ts.map +1 -0
  394. package/dist/routing/routesArray.types.test.js +132 -0
  395. package/dist/routing/routingBuilder.d.ts +34 -0
  396. package/dist/routing/routingBuilder.d.ts.map +1 -0
  397. package/dist/routing/routingBuilder.js +33 -0
  398. package/dist/routing/routingBuilder.types.test.d.ts +2 -0
  399. package/dist/routing/routingBuilder.types.test.d.ts.map +1 -0
  400. package/dist/routing/routingBuilder.types.test.js +171 -0
  401. package/dist/routing/routingRegistry.d.ts +19 -0
  402. package/dist/routing/routingRegistry.d.ts.map +1 -0
  403. package/dist/routing/routingRegistry.js +29 -0
  404. package/dist/staticGen/getAppRoutes.d.ts +2 -2
  405. package/dist/staticGen/getAppRoutes.d.ts.map +1 -1
  406. package/dist/staticGen/getAppRoutes.js +9 -6
  407. package/dist/staticGen/staticGen.d.ts.map +1 -1
  408. package/dist/staticGen/staticGen.js +8 -2
  409. package/dist/style/styleContentSxy.d.ts.map +1 -1
  410. package/dist/sync/index.d.ts.map +1 -1
  411. package/dist/sync/index.js +2 -0
  412. package/dist/syncServer/index.cjs +1 -2
  413. package/dist/syncServer/preload.js +2 -0
  414. package/dist/testing/createTestApp.d.ts +25 -1
  415. package/dist/testing/createTestApp.d.ts.map +1 -1
  416. package/dist/testing/createTestApp.js +12 -3
  417. package/dist/testing/createTestPipelineApp.d.ts +25 -0
  418. package/dist/testing/createTestPipelineApp.d.ts.map +1 -0
  419. package/dist/testing/createTestPipelineApp.js +153 -0
  420. package/dist/testing/ensure.d.ts +108 -0
  421. package/dist/testing/ensure.d.ts.map +1 -0
  422. package/dist/testing/ensure.js +522 -0
  423. package/dist/testing/ensure.trial.d.ts +2 -0
  424. package/dist/testing/ensure.trial.d.ts.map +1 -0
  425. package/dist/testing/ensure.trial.js +9 -0
  426. package/dist/testing/helpers/contentHtmlElements.d.ts.map +1 -1
  427. package/dist/testing/host.d.ts +80 -9
  428. package/dist/testing/host.d.ts.map +1 -1
  429. package/dist/testing/host.js +81 -20
  430. package/dist/testing/hostPipeline.d.ts +157 -0
  431. package/dist/testing/hostPipeline.d.ts.map +1 -0
  432. package/dist/testing/hostPipeline.js +341 -0
  433. package/dist/testing/hydrateTestApp.d.ts +17 -0
  434. package/dist/testing/hydrateTestApp.d.ts.map +1 -1
  435. package/dist/testing/hydrateTestApp.js +26 -6
  436. package/dist/testing/hydrateTestPipelineApp.d.ts +30 -0
  437. package/dist/testing/hydrateTestPipelineApp.d.ts.map +1 -0
  438. package/dist/testing/hydrateTestPipelineApp.js +190 -0
  439. package/dist/testing/index.d.ts +6 -3
  440. package/dist/testing/index.d.ts.map +1 -1
  441. package/dist/testing/index.js +4 -1
  442. package/dist/testing/resolveContent.d.ts +16 -0
  443. package/dist/testing/resolveContent.d.ts.map +1 -0
  444. package/dist/testing/resolveContent.js +65 -0
  445. package/dist/testing/testingComponentPackage.d.ts +3 -1
  446. package/dist/testing/testingComponentPackage.d.ts.map +1 -1
  447. package/dist/testing/testingComponentPackage.js +16 -1
  448. package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
  449. package/dist/update/integrateUpdateVdom.js +35 -31
  450. package/dist/update/integrateUpdateVdomPrebuild.js +20 -20
  451. package/dist/validChildren.d.ts.map +1 -1
  452. package/dist/zones/react.d.ts.map +1 -1
  453. package/package.json +20 -18
  454. package/types/helpers.d.ts +11 -2
  455. package/types/jsx/html.d.ts +29 -25
  456. package/types/jsx/jsx.d.ts +8 -8
  457. package/types/modules.d.ts +14 -3
  458. package/types/testing.d.ts +0 -0
  459. package/vendor/babel-core.js +5 -5
  460. package/vendor/babel-parser.js +1 -1
  461. package/vendor/babel-preset-react.js +32 -34
  462. package/vendor/babel-preset-typescript.js +5 -5
  463. package/vendor/chalk-extensions.js +3 -146
  464. package/vendor/chokidar.js +311 -5
  465. package/vendor/chunk-B34JUlnS.js +169 -0
  466. package/vendor/{chunk-Bu8ZRE-c.js → chunk-B9ttgKqg.js} +28 -25
  467. package/vendor/{chunk-D2EnpcLg.js → chunk-BGvapINa.js} +3 -164
  468. package/vendor/{chunk-Cqrj-Zqr.js → chunk-BmAiqUzD.js} +22 -8
  469. package/vendor/{chunk-BiUcnLhT.js → chunk-But4T5N_.js} +8 -3
  470. package/vendor/{chunk-OUnVY4Wm.js → chunk-DuR6SGzI.js} +162 -35
  471. package/vendor/dotenv.js +2 -2
  472. package/vendor/express.js +61 -10
  473. package/vendor/manifest.json +2 -2
  474. package/vendor/postcss.js +1 -1
  475. package/vendor/precinct.js +5914 -3591
  476. package/vendor/valibot.js +418 -504
  477. package/dist/Servers/MatchedRouteInfo.d.ts +0 -11
  478. package/dist/Servers/MatchedRouteInfo.d.ts.map +0 -1
  479. package/dist/routing/__fluentRouteBuilder.d.ts +0 -80
  480. package/dist/routing/__fluentRouteBuilder.d.ts.map +0 -1
  481. package/dist/routing/__fluentRouteBuilder.js +0 -183
  482. package/dist/routing/__fluentRoutes.d.ts +0 -2
  483. package/dist/routing/__fluentRoutes.d.ts.map +0 -1
  484. package/dist/routing/__fluentRoutes.js +0 -59
  485. package/vendor/chunk-Hy-cCmu-.js +0 -23
  486. /package/dist/{Servers → routing}/MatchedRouteInfo.js +0 -0
@@ -0,0 +1,8 @@
1
+ import type { ReqRes } from '../ReqRes.js';
2
+ import type { Endpoint } from './RouteTypes.js';
3
+ import type { CustomRoutes } from './Routes.js';
4
+ type AnyRoutes = CustomRoutes<Endpoint<any, any>>;
5
+ export declare function defineRoutes<const R extends AnyRoutes>(routes: R): R;
6
+ export declare function defineRoutes<const R extends AnyRoutes>(routes: (reqRes: ReqRes | null) => R): (reqRes: ReqRes | null) => R;
7
+ export {};
8
+ //# sourceMappingURL=defineRoutes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineRoutes.d.ts","sourceRoot":"","sources":["../../src/routing/defineRoutes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAK/C,KAAK,SAAS,GAAG,YAAY,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAEjD,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAA;AACrE,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,EAClD,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,CAAC,GACrC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export function defineRoutes(routes) {
2
+ return routes;
3
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pyramidRouting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pyramidRouting.d.ts","sourceRoot":"","sources":["../../src/routing/pyramidRouting.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ export {};
2
+ // const register = {
3
+ // context: <C,>(contextInitializer: new () => C) => ({
4
+ // networkedData: <ND,>(networkedDataInitializer: new (reqRes: ReqResOrNull, context: C) => ND) => ({
5
+ // globalData: <G,>(getGlobalData: (reqRes: ReqResOrNull, context: C) => Promise<G>) => ({
6
+ // routes: <Rs,>(getRoutes: (reqRes: ReqResOrNull, context: C) => Rs) => {
7
+ // const routing = {}
8
+ // return routing
9
+ // }
10
+ // })
11
+ // })
12
+ // })
13
+ // }
@@ -1,9 +1,17 @@
1
+ import type { BrandedContext, BrandedGlobalData, BrandedNetworkedData } from '../Brands.js';
1
2
  import type { ReqRes } from '../ReqRes.js';
3
+ import type { Context } from '../context/registerContext.js';
4
+ import type { NetworkedData } from './routingRegistry.js';
5
+ import type { Serializable } from './Serializable.js';
6
+ import type { Fixed } from './registrationTypes.js';
2
7
  export interface GlobalData {
3
8
  }
4
- export type GlobalDataFunction = (reqRes: ReqRes) => Promise<GlobalData>;
9
+ export type GlobalDataFunction<C = Context, NS = NetworkedData, G extends object = GlobalData> = (reqRes: ReqRes | null, context: C, networkedStore: NS) => Promise<G>;
10
+ export type BrandedGlobalDataFunction = (reqRes: ReqRes | null, context: BrandedContext, networkedStore: BrandedNetworkedData) => Promise<BrandedGlobalData>;
5
11
  export declare const globalDataFunc: {
6
- value: GlobalDataFunction | undefined;
12
+ value: BrandedGlobalDataFunction | undefined;
7
13
  };
8
- export declare function registerGlobalData(func: GlobalDataFunction): void;
14
+ export declare function registerGlobalData<G extends object>(func: GlobalDataFunction<Context, NetworkedData, G> & ((reqRes: ReqRes | null, context: Context, networkedData: NetworkedData) => Promise<Serializable<NoInfer<G>>>)): Fixed<{
15
+ globalData: G;
16
+ }>;
9
17
  //# sourceMappingURL=registerGlobalData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registerGlobalData.d.ts","sourceRoot":"","sources":["../../src/routing/registerGlobalData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,MAAM,WAAW,UAAU;CAAG;AAE9B,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;AAExE,eAAO,MAAM,cAAc,EAAE;IAAE,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAAA;CAAyB,CAAA;AAE7F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,QAE1D"}
1
+ {"version":3,"file":"registerGlobalData.d.ts","sourceRoot":"","sources":["../../src/routing/registerGlobalData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAInD,MAAM,WAAW,UAAU;CAAG;AAM9B,MAAM,MAAM,kBAAkB,CAC1B,CAAC,GAAG,OAAO,EACX,EAAE,GAAG,aAAa,EAClB,CAAC,SAAS,MAAM,GAAG,UAAU,IAC7B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,cAAc,EAAE,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;AAEzE,MAAM,MAAM,yBAAyB,GAM/B,CACE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,KACnF,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAEnC,eAAO,MAAM,cAAc,EAAE;IAAE,KAAK,EAAE,yBAAyB,GAAG,SAAS,CAAA;CACjD,CAAA;AAK1B,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAC/C,IAAI,EAAE,kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC,GAE7C,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,KACtE,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC1C,KAAK,CAAC;IAAE,UAAU,EAAE,CAAC,CAAA;CAAE,CAAC,CAK1B"}
@@ -1,6 +1,12 @@
1
1
  export const globalDataFunc = {
2
2
  value: undefined
3
3
  };
4
+ // the callback is handed the global Context and NetworkedData; G is inferred from what it returns,
5
+ // and handed back as a type-only token for GlobalData's augmentation - `GlobalDataType<typeof
6
+ // registration>`. Also set by registerRouting() and the routing builder - the last registration wins
4
7
  export function registerGlobalData(func) {
8
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- the framework's branded view of the same function
5
9
  globalDataFunc.value = func;
10
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- the token is type-only
11
+ return undefined;
6
12
  }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=registerParts.types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerParts.types.test.d.ts","sourceRoot":"","sources":["../../src/routing/registerParts.types.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,139 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { registerContext } from '../context/registerContext.js';
5
+ import { registerGlobalData } from './registerGlobalData.js';
6
+ import { registerNetworkedData } from './routingRegistry.js';
7
+ import { registerRoutes } from './registerRoutes.js';
8
+ /*
9
+ * Type tests for the separate register functions. tsc is the assertion - nothing here runs.
10
+ *
11
+ * Each infers only the shape it is given - the class, the store, the data - and returns it as a
12
+ * token for the augmentation: `interface Context extends ContextType<typeof registration> {}`.
13
+ * Every callback is typed by the global Context, NetworkedData and GlobalData instead. Unaugmented
14
+ * - as here, inside tungsten - those are {}, so reading an app member fails, which is what reminds
15
+ * an app to augment them.
16
+ */
17
+ class AppContext {
18
+ constructor(reqRes) {
19
+ _defineProperty(this, "user", {
20
+ id: 1
21
+ });
22
+ void reqRes;
23
+ }
24
+ }
25
+ const _contextRegistration = registerContext(AppContext);
26
+ const registeredContext = registeredC;
27
+ void registeredContext;
28
+ class ServerContext {
29
+ constructor(reqRes) {
30
+ _defineProperty(this, "reqRes", void 0);
31
+ _defineProperty(this, "user", {
32
+ id: 1
33
+ });
34
+ this.reqRes = reqRes;
35
+ }
36
+ }
37
+ class ClientContext {
38
+ constructor() {
39
+ _defineProperty(this, "user", {
40
+ id: 1
41
+ });
42
+ }
43
+ }
44
+ const _pairRegistration = registerContext({
45
+ client: ClientContext,
46
+ server: ServerContext
47
+ });
48
+ const pairUserId = pairC.user.id;
49
+ void pairUserId;
50
+ class AppStore {
51
+ constructor(reqRes, context) {
52
+ _defineProperty(this, "token", 'abc');
53
+ void reqRes;
54
+ void context;
55
+ }
56
+ }
57
+ const _storeRegistration = registerNetworkedData(AppStore);
58
+ const registeredStore = registeredNd;
59
+ void registeredStore;
60
+ const _dataRegistration = registerGlobalData(async () => Promise.resolve({
61
+ n: 1
62
+ }));
63
+ const registeredData = registeredG;
64
+ void registeredData;
65
+ // ---- the callbacks see the globals, not the registered class ----------------
66
+ registerGlobalData(async (reqRes, context, networkedData) => {
67
+ const c = context;
68
+ const nd = networkedData;
69
+ void c;
70
+ void nd;
71
+ // @ts-expect-error -- `user` is on AppContext, but context is the global Context, still {}
72
+ void context.user;
73
+ return Promise.resolve({});
74
+ });
75
+ registerNetworkedData(class {
76
+ constructor(reqRes, context) {
77
+ void reqRes;
78
+ // @ts-expect-error -- the same in the store's constructor
79
+ void context.user;
80
+ }
81
+ });
82
+ const _appRoutes = registerRoutes((reqRes, context, networkedData) => {
83
+ const c = context;
84
+ const nd = networkedData;
85
+ void c;
86
+ void nd;
87
+ // @ts-expect-error -- and in the routes function
88
+ void context.user;
89
+ return {
90
+ '/leads/:id<1+>': {
91
+ content: (routeData, routeParams, props, globalData) => {
92
+ void globalData;
93
+ return null;
94
+ }
95
+ },
96
+ '404': {
97
+ content: null
98
+ }
99
+ };
100
+ });
101
+ // ---- registerRoutes hands back its argument, typed ---------------------------
102
+ const paths = ['/leads/5'];
103
+ void paths;
104
+ // @ts-expect-error -- not a path of these routes
105
+ const notAPath = '/elsewhere';
106
+ void notAPath;
107
+ // @ts-expect-error -- routes must have a `default` or a `404`
108
+ registerRoutes(() => ({
109
+ '/somewhere': {
110
+ content: null
111
+ }
112
+ }));
113
+ const registeredKeys = ['/leads/:id<1+>', '404'];
114
+ void registeredKeys;
115
+ const registeredPath = '/leads/5';
116
+ void registeredPath;
117
+ const _routesObject = registerRoutes({
118
+ '/about': {
119
+ content: null
120
+ },
121
+ '404': {
122
+ content: null
123
+ }
124
+ });
125
+ const objectPath = '/about';
126
+ void objectPath;
127
+ // ---- what cannot cross the network ------------------------------------------
128
+ class StoreHoldingReqRes {
129
+ constructor(reqRes) {
130
+ _defineProperty(this, "reqRes", void 0);
131
+ this.reqRes = reqRes;
132
+ }
133
+ }
134
+ // @ts-expect-error -- the networked store is serialized into the page
135
+ registerNetworkedData(StoreHoldingReqRes);
136
+ // @ts-expect-error -- and so is the global data
137
+ registerGlobalData(async reqRes => Promise.resolve({
138
+ leaked: reqRes
139
+ }));
@@ -0,0 +1,10 @@
1
+ import type { ReqRes } from '../ReqRes.js';
2
+ import type { Context } from '../context/registerContext.js';
3
+ import type { GlobalData } from './registerGlobalData.js';
4
+ import type { RoutesWithSettings } from './Routes.js';
5
+ import type { NetworkedData } from './routingRegistry.js';
6
+ type GlobalRoutes = RoutesWithSettings<GlobalData>;
7
+ type GlobalRoutesFunction = (reqRes: ReqRes | null, context: Context, networkedData: NetworkedData) => GlobalRoutes;
8
+ export declare function registerRoutes<R extends GlobalRoutes | GlobalRoutesFunction>(routes: R): R;
9
+ export {};
10
+ //# sourceMappingURL=registerRoutes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerRoutes.d.ts","sourceRoot":"","sources":["../../src/routing/registerRoutes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAIzD,KAAK,YAAY,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAA;AAClD,KAAK,oBAAoB,GACnB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,KAAK,YAAY,CAAA;AAM7F,wBAAgB,cAAc,CAAC,CAAC,SAAS,YAAY,GAAG,oBAAoB,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAG1F"}
@@ -0,0 +1,9 @@
1
+ import { registeredRouting } from './routingRegistry.js';
2
+ // the routes, or a function of the request returning them, typed by the global Context,
3
+ // NetworkedData and GlobalData - not inferred. Handed back as given, to type links from:
4
+ // RoutePaths<typeof routes>. Also set by registerRouting() and the routing builder - the last
5
+ // registration wins
6
+ export function registerRoutes(routes) {
7
+ registeredRouting.value = routes;
8
+ return routes;
9
+ }
@@ -0,0 +1,36 @@
1
+ import type { ReqRes } from '../ReqRes.js';
2
+ import type { RoutesWithSettings } from './Routes.js';
3
+ import type { GlobalDataFunction } from './registerGlobalData.js';
4
+ import type { AppPath } from '../components/makeTypedLink.js';
5
+ import type { Serializable } from './Serializable.js';
6
+ import type { KeyedRoutes } from './routesArray.js';
7
+ import type { PipelineApp } from '../pipeline/pipelineDefinition.js';
8
+ import type { $routing, ContextInitializer, Fixed, NetworkedStoreInitializer, RoutesFunctionGeneric } from './registrationTypes.js';
9
+ export type { Serializable } from './Serializable.js';
10
+ export type { ContextInitializer, NetworkedStoreInitializer, RoutesFunctionGeneric, } from './registrationTypes.js';
11
+ type SerializableStore<S> = new (reqRes: ReqRes | null) => Serializable<S>;
12
+ export type Routing<Rs, G, C, NS> = Fixed<{
13
+ routes: Rs;
14
+ globalData: G;
15
+ context: C;
16
+ networkedStore: NS;
17
+ }>;
18
+ type RoutesOf<R> = R extends Fixed<{
19
+ routes: infer Rs;
20
+ }> ? Rs : R extends PipelineApp<infer F> ? RoutesOf<F> : R extends (...args: never[]) => infer Rs ? Rs : R;
21
+ export type RoutesType<R extends object> = RoutesProper<KeyedRoutes<RoutesOf<R>>>;
22
+ type RoutesProper<Rs> = {
23
+ [K in keyof Rs as K extends symbol ? never : K]: Rs[K];
24
+ };
25
+ export type PathsType<R extends object> = AppPath<RoutesType<R>>;
26
+ export type GlobalDataType<R extends Fixed<{
27
+ globalData: unknown;
28
+ }>> = R[typeof $routing]['globalData'];
29
+ export type ContextType<R extends Fixed<{
30
+ context: unknown;
31
+ }>> = R[typeof $routing]['context'];
32
+ export type NetworkedDataType<R extends Fixed<{
33
+ networkedStore: unknown;
34
+ }>> = R[typeof $routing]['networkedStore'];
35
+ export declare function registerRouting<RsS extends RoutesWithSettings<G>, G extends object = object, ContextSchema extends object | undefined = undefined, NetworkedStoreSchema extends object | undefined = undefined>(routesFunction: RoutesFunctionGeneric<G, ContextSchema, NetworkedStoreSchema, RsS>, globalDataFunction: GlobalDataFunction<NoInfer<ContextSchema>, NoInfer<NetworkedStoreSchema>, G> & ((reqRes: ReqRes | null, context: NoInfer<ContextSchema>, store: NoInfer<NetworkedStoreSchema>) => Promise<Serializable<NoInfer<G>>>), context?: ContextInitializer<ContextSchema>, networkedStoreSchema?: NetworkedStoreInitializer<NetworkedStoreSchema> & SerializableStore<NoInfer<NetworkedStoreSchema>>): Routing<RsS, G, ContextSchema, NetworkedStoreSchema>;
36
+ //# sourceMappingURL=registerRouting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerRouting.d.ts","sourceRoot":"","sources":["../../src/routing/registerRouting.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,34 @@
1
+ import { registeredRouting, registeredNetworkedStore } from './routingRegistry.js';
2
+ import { contextRegistration } from '../context/registerContext.js';
3
+ import { globalDataFunc } from './registerGlobalData.js';
4
+ const resolvedRoutes = {
5
+ routes: null
6
+ };
7
+ export function registerRouting(routesFunction,
8
+ // NoInfer on the context and store: they are fixed by the two arguments below, and a callback
9
+ // parameter is a contravariant inference site. Without it an annotated parameter competes and
10
+ // a wider annotation wins - registering Derived but annotating Base yields a Base context
11
+ globalDataFunction, context, networkedStoreSchema) {
12
+ // read in place of routesLocation's named export, by whichever side imported this module
13
+ registeredRouting.value = routesFunction;
14
+ // awaited per request on the server, before routing; hydrated from the page on the client
15
+ globalDataFunc.value = globalDataFunction;
16
+ // createContext() news this per request on the server, once per page on the client
17
+ if (context !== undefined) contextRegistration.value = context; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- ContextSchema may be undefined at the type level, never at this branch
18
+ if (networkedStoreSchema !== undefined) {
19
+ registeredNetworkedStore.value = networkedStoreSchema;
20
+ }
21
+ return undefined;
22
+ //return {
23
+ // getRoutes: () => {
24
+ // if (resolvedRoutes.routes === null) throwError('registerRouting', 'routes are not ready yet')
25
+ // return resolvedRoutes.routes as Rs // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
26
+ // },
27
+ // getGlobalData: () => {
28
+ // },
29
+ // getContext: () => {
30
+ // },
31
+ // getNetworkedStore: () => {
32
+ // }
33
+ //}
34
+ }
@@ -0,0 +1,80 @@
1
+ import type { ReqRes } from '../ReqRes.js';
2
+ declare class AppContext {
3
+ reqRes: ReqRes | null;
4
+ constructor(reqRes: ReqRes | null);
5
+ user: {
6
+ id: number;
7
+ };
8
+ }
9
+ declare class AppStore {
10
+ constructor(reqRes: ReqRes | null);
11
+ token: string;
12
+ }
13
+ export declare const both: import("./registerRouting.js").Routing<{
14
+ default: {
15
+ content: null;
16
+ };
17
+ }, {
18
+ id: number;
19
+ token: string;
20
+ }, AppContext, AppStore>;
21
+ export declare const contextOnly: import("./registerRouting.js").Routing<{
22
+ default: {
23
+ content: null;
24
+ };
25
+ }, {
26
+ id: number;
27
+ }, AppContext, undefined>;
28
+ export declare const neither: import("./registerRouting.js").Routing<{
29
+ default: {
30
+ content: null;
31
+ };
32
+ }, {
33
+ count: number;
34
+ }, undefined, undefined>;
35
+ export declare const wrongContextUse: import("./registerRouting.js").Routing<{
36
+ default: {
37
+ content: null;
38
+ };
39
+ }, {
40
+ id: any;
41
+ }, AppContext, undefined>;
42
+ export declare const wrongStoreUse: import("./registerRouting.js").Routing<{
43
+ default: {
44
+ content: null;
45
+ };
46
+ }, {
47
+ t: any;
48
+ }, AppContext, AppStore>;
49
+ declare class Base {
50
+ a: number;
51
+ }
52
+ declare class Derived extends Base {
53
+ b: number;
54
+ }
55
+ export declare const annotatedWider: import("./registerRouting.js").Routing<{
56
+ default: {
57
+ content: null;
58
+ };
59
+ }, {
60
+ n: number;
61
+ }, Derived, undefined>;
62
+ declare class StoreHoldingReqRes {
63
+ reqRes: ReqRes | null;
64
+ constructor(reqRes: ReqRes | null);
65
+ token: string;
66
+ }
67
+ export declare const storeNotSerializable: import("./registerRouting.js").Routing<{
68
+ default: {
69
+ content: null;
70
+ };
71
+ }, {
72
+ n: number;
73
+ }, AppContext, StoreHoldingReqRes>;
74
+ export declare const dataNotSerializable: import("./registerRouting.js").Routing<{
75
+ default: {
76
+ content: null;
77
+ };
78
+ }, object, AppContext, AppStore>;
79
+ export {};
80
+ //# sourceMappingURL=registerRouting.types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerRouting.types.test.d.ts","sourceRoot":"","sources":["../../src/routing/registerRouting.types.test.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAgB1C,cAAM,UAAU;IACO,MAAM,EAAE,MAAM,GAAG,IAAI;gBAArB,MAAM,EAAE,MAAM,GAAG,IAAI;IACxC,IAAI;;MAAY;CACnB;AAID,cAAM,QAAQ;gBACE,MAAM,EAAE,MAAM,GAAG,IAAI;IACjC,KAAK,SAAQ;CAChB;AAKD,eAAO,MAAM,IAAI;;;;;;;wBAShB,CAAA;AAUD,eAAO,MAAM,WAAW;;;;;;yBAIvB,CAAA;AAMD,eAAO,MAAM,OAAO;;;;;;wBAGnB,CAAA;AAOD,eAAO,MAAM,eAAe;;;;;;yBAK3B,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;wBAMzB,CAAA;AAOD,cAAM,IAAI;IAAG,CAAC,SAAI;CAAE;AACpB,cAAM,OAAQ,SAAQ,IAAI;IAAG,CAAC,SAAI;CAAE;AAEpC,eAAO,MAAM,cAAc;;;;;;sBAK1B,CAAA;AAWD,cAAM,kBAAkB;IACD,MAAM,EAAE,MAAM,GAAG,IAAI;gBAArB,MAAM,EAAE,MAAM,GAAG,IAAI;IACxC,KAAK,SAAQ;CAChB;AAED,eAAO,MAAM,oBAAoB;;;;;;kCAQhC,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;gCAO/B,CAAA"}
@@ -0,0 +1,120 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { registerRouting } from './registerRouting.js';
5
+ /*
6
+ * Type tests for registerRouting()'s inference. tsc is the assertion - nothing here runs.
7
+ *
8
+ * The case that needs pinning: globalDataFunction now takes the context and the networked store,
9
+ * so ContextSchema and NetworkedStoreSchema are inferred from TWO argument positions each (their
10
+ * own, and this callback's parameters). A parameter is a contravariant inference site, so getting
11
+ * this wrong collapses them to never - the same way BindableSelect's Value did before NoInfer.
12
+ */
13
+ const routes = {
14
+ default: {
15
+ content: null
16
+ }
17
+ };
18
+ class AppContext {
19
+ constructor(reqRes) {
20
+ _defineProperty(this, "reqRes", void 0);
21
+ _defineProperty(this, "user", {
22
+ id: 1
23
+ });
24
+ this.reqRes = reqRes;
25
+ }
26
+ }
27
+ // the networked store is serialized to the page, so every member must be JsonValue - holding the
28
+ // reqRes on it makes it fail `NS extends Serializable<NS>` and fall back to its constraint
29
+ class AppStore {
30
+ constructor(reqRes) {
31
+ _defineProperty(this, "token", 'abc');
32
+ void reqRes;
33
+ }
34
+ }
35
+ // ---- both registered: the callback sees the real classes, not never ----------
36
+ export const both = registerRouting(() => routes, async (reqRes, context, store) => {
37
+ const id = context.user.id;
38
+ const token = store.token;
39
+ return await Promise.resolve({
40
+ id,
41
+ token
42
+ });
43
+ }, AppContext, AppStore);
44
+ // G still infers from the callback's return, uncontaminated by the two new parameters
45
+ const bothData = {
46
+ id: 1,
47
+ token: 'a'
48
+ };
49
+ // @ts-expect-error -- and is not widened: `id` is a number
50
+ const bothWrong = {
51
+ id: 'not a number',
52
+ token: 'a'
53
+ };
54
+ // ---- context only: the store parameter is undefined, not any -----------------
55
+ export const contextOnly = registerRouting(() => routes, async (reqRes, context) => Promise.resolve({
56
+ id: context.user.id
57
+ }), AppContext);
58
+ // ---- nothing registered: a one-argument callback still satisfies the type -----
59
+ // the parameters are additive, so an app that ignores them is unaffected
60
+ export const neither = registerRouting(() => routes, async () => Promise.resolve({
61
+ count: 1
62
+ }));
63
+ // ---- the parameters are checked, not any ------------------------------------
64
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment -- suppressing the type error below
65
+ leaves the property error-typed, which is the point of the case */
66
+ export const wrongContextUse = registerRouting(() => routes,
67
+ // @ts-expect-error -- `nope` is not on AppContext
68
+ async (reqRes, context) => Promise.resolve({
69
+ id: context.nope
70
+ }), AppContext);
71
+ export const wrongStoreUse = registerRouting(() => routes,
72
+ // @ts-expect-error -- the store is AppStore, which has no `missing`
73
+ async (reqRes, context, store) => Promise.resolve({
74
+ t: store.missing
75
+ }), AppContext, AppStore);
76
+ /* eslint-enable @typescript-eslint/no-unsafe-assignment */
77
+ // ---- an annotated callback parameter must not redefine the context ----------
78
+ // the context is whatever class was registered. If the callback's own annotation is allowed to
79
+ // compete as an inference site, a wider annotation silently wins and the registered class is lost
80
+ class Base {
81
+ constructor() {
82
+ _defineProperty(this, "a", 1);
83
+ }
84
+ }
85
+ class Derived extends Base {
86
+ constructor(...args) {
87
+ super(...args);
88
+ _defineProperty(this, "b", 2);
89
+ }
90
+ }
91
+ export const annotatedWider = registerRouting(() => routes, async (reqRes, context) => Promise.resolve({
92
+ n: context.a
93
+ }), Derived);
94
+ const stillDerived = annotatedContext;
95
+ void stillDerived;
96
+ // ---- what cannot cross the network -----------------------------------------
97
+ // the store and the global data are both serialized into the page. Checked at the ARGUMENT, so
98
+ // the failure names the offending class or property instead of cascading - see registerRouting.ts
99
+ class StoreHoldingReqRes {
100
+ constructor(reqRes) {
101
+ _defineProperty(this, "reqRes", void 0);
102
+ _defineProperty(this, "token", 'abc');
103
+ this.reqRes = reqRes;
104
+ }
105
+ }
106
+ export const storeNotSerializable = registerRouting(() => routes, async () => Promise.resolve({
107
+ n: 1
108
+ }), AppContext,
109
+ // @ts-expect-error -- on THIS argument, naming the class: "'typeof StoreHoldingReqRes' is not
110
+ // assignable to ... SerializableStore<...>" ... "The types of 'reqRes' are incompatible" ...
111
+ // "Type 'Request' is not assignable to type 'JsonValue'"
112
+ StoreHoldingReqRes);
113
+ export const dataNotSerializable = registerRouting(() => routes,
114
+ // @ts-expect-error -- on the callback, naming the property: "Types of property 'leaked' are
115
+ // incompatible" ... "Type 'Request' is not assignable to type 'JsonValue'"
116
+ async reqRes => Promise.resolve({
117
+ leaked: reqRes
118
+ }), AppContext, AppStore);
119
+ void bothData;
120
+ void bothWrong;
@@ -0,0 +1,11 @@
1
+ import type { ReqRes } from '../ReqRes.js';
2
+ import type { RoutesWithSettings } from './Routes.js';
3
+ import type { RoutesArray } from './routesArray.js';
4
+ export declare const $routing: unique symbol;
5
+ export type Fixed<T> = {
6
+ [$routing]: T;
7
+ };
8
+ export type RoutesFunctionGeneric<G extends object, C, NS, Rs extends RoutesWithSettings<G> | RoutesArray<G>> = (reqRes: ReqRes | null, context: C, networkedData: NS) => Rs;
9
+ export type ContextInitializer<ContextSchema> = new (reqRes: ReqRes | null) => ContextSchema;
10
+ export type NetworkedStoreInitializer<StoreSchema> = new (reqRes: ReqRes | null, context?: unknown) => StoreSchema;
11
+ //# sourceMappingURL=registrationTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registrationTypes.d.ts","sourceRoot":"","sources":["../../src/routing/registrationTypes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAoBnD,MAAM,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,OAAO,MAAM,CAAA;AAI5C,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA;AAExC,MAAM,MAAM,qBAAqB,CAC7B,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,kBAAkB,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,IAC1E,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,CAAA;AAEhE,MAAM,MAAM,kBAAkB,CAAC,aAAa,IAAI,KAC5C,MAAM,EAAE,MAAM,GAAG,IAAI,KACpB,aAAa,CAAA;AAIlB,MAAM,MAAM,yBAAyB,CAAC,WAAW,IAAI,KACjD,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,CAAC,EAAE,OAAO,KAChB,WAAW,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Mode } from '../Mode.js';
2
+ import type { RoutesLocation } from '../FrameworkConfig.js';
3
+ import type { AppRoutes } from './AppRoutes.js';
4
+ export declare function resolveAppRoutes(module: Record<string, unknown>, routesLocation: RoutesLocation, mode: Mode): AppRoutes<any>;
5
+ //# sourceMappingURL=resolveAppRoutes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveAppRoutes.d.ts","sourceRoot":"","sources":["../../src/routing/resolveAppRoutes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAQ/C,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,IAAI,GACX,SAAS,CAAC,GAAG,CAAC,CAgChB"}
@@ -0,0 +1,25 @@
1
+ import { TungstenError } from '../TungstenError.js';
2
+ import { routesLocationParts } from '../routesLocationParts.js';
3
+ import { registeredRouting } from './routingRegistry.js';
4
+ // routes come from registerRouting() or from routesLocation's named export. The module has already
5
+ // been imported by the caller, which is what runs the registerRouting() call
6
+ export function resolveAppRoutes(module, routesLocation, mode) {
7
+ const {
8
+ routesFile,
9
+ routeExport
10
+ } = routesLocationParts(routesLocation);
11
+ const registered = registeredRouting.value;
12
+ const isExported = routeExport !== undefined && routeExport in module;
13
+ // both systems in one app is almost always a mistake, so say so while it is cheap to fix
14
+ if (registered !== undefined && isExported && mode === 'dev') {
15
+ throw new TungstenError(`Routes are set twice: registerRouting() was called, and routes file ${routesFile}` + ` exports ${routeExport} (config.routesLocation). Use one or the other - drop the` + ` export name from routesLocation to keep registerRouting().`);
16
+ }
17
+ if (registered !== undefined) return registered;
18
+ if (isExported) {
19
+ return module[routeExport]; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
20
+ }
21
+ if (routeExport === undefined) {
22
+ throw new TungstenError(`No routes. config.routesLocation names the file ${routesFile} without an export name,` + ` so routes must come from registerRouting(), but ${routesFile} did not call it.`);
23
+ }
24
+ throw new TungstenError(`Could not find an export named ${routeExport} in routes file ${routesFile},` + ` and registerRouting() was not called.` + ` These settings are set in config.routesLocation.`);
25
+ }
@@ -1,4 +1,8 @@
1
1
  import type { SiteBasePath } from '../render/HeadData.js';
2
2
  export declare function routeKeyToUrl(routeKey: string, siteBasePath: SiteBasePath, staticFiles: boolean): string;
3
3
  export declare function urlToRouteKey(pathname: string, siteBasePath: SiteBasePath, staticFiles: boolean): string;
4
+ export declare function urlToLocation(url: {
5
+ pathname: string;
6
+ search: string;
7
+ }, siteBasePath: SiteBasePath, staticFiles: boolean): string;
4
8
  //# sourceMappingURL=routeUrl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routeUrl.d.ts","sourceRoot":"","sources":["../../src/routing/routeUrl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAOzD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CASxG;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CAWxG"}
1
+ {"version":3,"file":"routeUrl.d.ts","sourceRoot":"","sources":["../../src/routing/routeUrl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAOzD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CASxG;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CAWxG;AAGD,wBAAgB,aAAa,CACzB,GAAG,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,GAC5F,MAAM,CAER"}
@@ -20,4 +20,8 @@ export function urlToRouteKey(pathname, siteBasePath, staticFiles) {
20
20
  if (path.endsWith('/index.html')) path = path.slice(0, -'index.html'.length);else if (path.endsWith('.html')) path = path.slice(0, -'.html'.length);
21
21
  }
22
22
  return path;
23
+ }
24
+ // the app's location for a browser URL: route path plus query, as the server sees it (no fragment)
25
+ export function urlToLocation(url, siteBasePath, staticFiles) {
26
+ return urlToRouteKey(url.pathname, siteBasePath, staticFiles) + url.search;
23
27
  }