tungsten 0.6.3 → 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 (483) 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 +21 -9
  19. package/dist/Instance/Instance.d.ts.map +1 -1
  20. package/dist/Instance/Instance.js +39 -8
  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 +57 -44
  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/routesArray.d.ts +23 -0
  387. package/dist/routing/routesArray.d.ts.map +1 -0
  388. package/dist/routing/routesArray.js +20 -0
  389. package/dist/routing/routesArray.types.test.d.ts +2 -0
  390. package/dist/routing/routesArray.types.test.d.ts.map +1 -0
  391. package/dist/routing/routesArray.types.test.js +132 -0
  392. package/dist/routing/routingBuilder.d.ts +34 -0
  393. package/dist/routing/routingBuilder.d.ts.map +1 -0
  394. package/dist/routing/routingBuilder.js +33 -0
  395. package/dist/routing/routingBuilder.types.test.d.ts +2 -0
  396. package/dist/routing/routingBuilder.types.test.d.ts.map +1 -0
  397. package/dist/routing/routingBuilder.types.test.js +171 -0
  398. package/dist/routing/routingRegistry.d.ts +19 -0
  399. package/dist/routing/routingRegistry.d.ts.map +1 -0
  400. package/dist/routing/routingRegistry.js +29 -0
  401. package/dist/staticGen/getAppRoutes.d.ts +2 -2
  402. package/dist/staticGen/getAppRoutes.d.ts.map +1 -1
  403. package/dist/staticGen/getAppRoutes.js +9 -6
  404. package/dist/staticGen/staticGen.d.ts.map +1 -1
  405. package/dist/staticGen/staticGen.js +8 -2
  406. package/dist/style/styleContentSxy.d.ts.map +1 -1
  407. package/dist/sync/index.d.ts.map +1 -1
  408. package/dist/sync/index.js +2 -0
  409. package/dist/syncServer/index.cjs +1 -2
  410. package/dist/syncServer/preload.js +2 -0
  411. package/dist/testing/createTestApp.d.ts +25 -1
  412. package/dist/testing/createTestApp.d.ts.map +1 -1
  413. package/dist/testing/createTestApp.js +12 -3
  414. package/dist/testing/createTestPipelineApp.d.ts +25 -0
  415. package/dist/testing/createTestPipelineApp.d.ts.map +1 -0
  416. package/dist/testing/createTestPipelineApp.js +153 -0
  417. package/dist/testing/ensure.d.ts +108 -0
  418. package/dist/testing/ensure.d.ts.map +1 -0
  419. package/dist/testing/ensure.js +522 -0
  420. package/dist/testing/ensure.trial.d.ts +2 -0
  421. package/dist/testing/ensure.trial.d.ts.map +1 -0
  422. package/dist/testing/ensure.trial.js +9 -0
  423. package/dist/testing/helpers/contentHtmlElements.d.ts.map +1 -1
  424. package/dist/testing/host.d.ts +80 -9
  425. package/dist/testing/host.d.ts.map +1 -1
  426. package/dist/testing/host.js +81 -20
  427. package/dist/testing/hostPipeline.d.ts +157 -0
  428. package/dist/testing/hostPipeline.d.ts.map +1 -0
  429. package/dist/testing/hostPipeline.js +341 -0
  430. package/dist/testing/hydrateTestApp.d.ts +17 -0
  431. package/dist/testing/hydrateTestApp.d.ts.map +1 -1
  432. package/dist/testing/hydrateTestApp.js +26 -6
  433. package/dist/testing/hydrateTestPipelineApp.d.ts +30 -0
  434. package/dist/testing/hydrateTestPipelineApp.d.ts.map +1 -0
  435. package/dist/testing/hydrateTestPipelineApp.js +190 -0
  436. package/dist/testing/index.d.ts +6 -3
  437. package/dist/testing/index.d.ts.map +1 -1
  438. package/dist/testing/index.js +4 -1
  439. package/dist/testing/resolveContent.d.ts +16 -0
  440. package/dist/testing/resolveContent.d.ts.map +1 -0
  441. package/dist/testing/resolveContent.js +65 -0
  442. package/dist/testing/testingComponentPackage.d.ts +3 -1
  443. package/dist/testing/testingComponentPackage.d.ts.map +1 -1
  444. package/dist/testing/testingComponentPackage.js +16 -1
  445. package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
  446. package/dist/update/integrateUpdateVdom.js +35 -31
  447. package/dist/update/integrateUpdateVdomPrebuild.js +20 -20
  448. package/dist/validChildren.d.ts.map +1 -1
  449. package/dist/zones/react.d.ts.map +1 -1
  450. package/package.json +20 -18
  451. package/types/helpers.d.ts +11 -2
  452. package/types/jsx/html.d.ts +29 -25
  453. package/types/jsx/jsx.d.ts +8 -8
  454. package/types/modules.d.ts +14 -3
  455. package/types/testing.d.ts +0 -0
  456. package/vendor/babel-core.js +5 -5
  457. package/vendor/babel-parser.js +1 -1
  458. package/vendor/babel-preset-react.js +32 -34
  459. package/vendor/babel-preset-typescript.js +5 -5
  460. package/vendor/chalk-extensions.js +3 -146
  461. package/vendor/chokidar.js +311 -5
  462. package/vendor/chunk-B34JUlnS.js +169 -0
  463. package/vendor/{chunk-Bu8ZRE-c.js → chunk-B9ttgKqg.js} +28 -25
  464. package/vendor/{chunk-D2EnpcLg.js → chunk-BGvapINa.js} +3 -164
  465. package/vendor/{chunk-Cqrj-Zqr.js → chunk-BmAiqUzD.js} +22 -8
  466. package/vendor/{chunk-BiUcnLhT.js → chunk-But4T5N_.js} +8 -3
  467. package/vendor/{chunk-OUnVY4Wm.js → chunk-DuR6SGzI.js} +162 -35
  468. package/vendor/dotenv.js +2 -2
  469. package/vendor/express.js +61 -10
  470. package/vendor/manifest.json +2 -2
  471. package/vendor/postcss.js +1 -1
  472. package/vendor/precinct.js +5914 -3591
  473. package/vendor/valibot.js +418 -504
  474. package/dist/Servers/MatchedRouteInfo.d.ts +0 -11
  475. package/dist/Servers/MatchedRouteInfo.d.ts.map +0 -1
  476. package/dist/routing/__fluentRouteBuilder.d.ts +0 -80
  477. package/dist/routing/__fluentRouteBuilder.d.ts.map +0 -1
  478. package/dist/routing/__fluentRouteBuilder.js +0 -183
  479. package/dist/routing/__fluentRoutes.d.ts +0 -2
  480. package/dist/routing/__fluentRoutes.d.ts.map +0 -1
  481. package/dist/routing/__fluentRoutes.js +0 -59
  482. package/vendor/chunk-Hy-cCmu-.js +0 -23
  483. /package/dist/{Servers → routing}/MatchedRouteInfo.js +0 -0
@@ -15,18 +15,26 @@ import { makeInstanceConfigFromFrameworkConfig } from '../makeInstanceConfigFrom
15
15
  import { standardizeWebPath } from '../standardizeWebPath.js';
16
16
  import { throwError } from '../throwError.js';
17
17
  import { serveStatic } from './serveStatic.js';
18
+ import { cacheVersioned } from './cacheVersioned.js';
19
+ import { $cacheControl, cacheControlHeader, pageCacheControl } from '../cacheControl.js';
18
20
  import { routing } from "./routing.js";
19
21
  import { globalDataFunc } from '../routing/registerGlobalData.js';
20
22
  import { TungstenServer } from "./TungstenServer.js";
21
23
  import { portError } from './portError.js';
22
24
  import { initStores } from './initStores.js';
25
+ import { createContext } from '../context/registerContext.js';
26
+ import { createNetworkedData } from '../routing/routingRegistry.js';
23
27
  import { makeTungstenErrorInfo } from '../routing/TungstenErrorInfo.js';
28
+ import { toRoutes } from '../routing/routesArray.js';
24
29
  import { listenVerified, newBootId, registerBootProbe } from './listenVerified.js';
30
+ import { PipelineRequestHandler } from '../pipeline/PipelineRequestHandler.js';
25
31
  function debug(...texts) {
26
32
  // console.log(...texts)
27
33
  }
28
34
  export class ProdServer extends TungstenServer {
29
- constructor(framework, _config, compilationInfo, _appRoutes, _RootComponentOrNull, serverMiddleware) {
35
+ constructor(framework, _config, compilationInfo, _appRoutes, _RootComponentOrNull, serverMiddleware,
36
+ // config.registration 'pipeline': the routes module's app, in place of appRoutes
37
+ pipelineApp = null) {
30
38
  super();
31
39
  _defineProperty(this, "framework", void 0);
32
40
  _defineProperty(this, "config", void 0);
@@ -48,6 +56,8 @@ export class ProdServer extends TungstenServer {
48
56
  _defineProperty(this, "apiRoutes", void 0);
49
57
  _defineProperty(this, "server", void 0);
50
58
  _defineProperty(this, "bootId", newBootId());
59
+ // pages: the classic handleRequest, or the pipeline's (config.registration)
60
+ _defineProperty(this, "requestHandler", void 0);
51
61
  // private addServerMiddleware = (serverMiddleware: ServerMiddlewareInfo): void => {
52
62
  // const [middlewareFile, middlewareExportName, middlewarePath] = serverMiddleware
53
63
  // const fullFilePath = 'file://' + join(this.compilationInfo.codeLocation, middlewareFile)
@@ -100,6 +110,9 @@ export class ProdServer extends TungstenServer {
100
110
  // app's error route with the real global data (theme colour, username, ...) rather
101
111
  // than framework defaults, when it did resolve.
102
112
  let capturedGlobalData = {};
113
+ // this request's context, for the error route to reuse
114
+ let capturedContext = {};
115
+ let capturedNetworkedData = {};
103
116
  try {
104
117
  const location = req.url;
105
118
  const instanceConfig = makeInstanceConfigFromFrameworkConfig(this.config);
@@ -130,11 +143,15 @@ export class ProdServer extends TungstenServer {
130
143
  const serverDataLoading = {
131
144
  value: false
132
145
  };
133
- const routes = typeof appRoutes === 'function' ? appRoutes(reqRes) : appRoutes;
134
- const [globalData, matchedRouteInfo] = await Promise.all([globalDataFunc.value !== undefined ? globalDataFunc.value(reqRes).then(globalData => {
146
+ const context = createContext('server', reqRes);
147
+ capturedContext = context;
148
+ const networkedData = createNetworkedData(reqRes, context);
149
+ capturedNetworkedData = networkedData;
150
+ const routes = toRoutes(typeof appRoutes === 'function' ? appRoutes(reqRes, context, networkedData) : appRoutes, false);
151
+ const [globalData, matchedRouteInfo] = await Promise.all([globalDataFunc.value !== undefined ? globalDataFunc.value(reqRes, context, networkedData).then(globalData => {
135
152
  capturedGlobalData = globalData;
136
153
  return globalData;
137
- }) : {}, routing(location, routes, serverDataLoading)]);
154
+ }) : {}, routing(location, routes, context, networkedData, serverDataLoading)]);
138
155
  //instance.matchedRouteInfo =
139
156
  //cliTodo('Can we move redirect handling to base class?')
140
157
  // // 2025-03-14 copied this code here from Dev server,
@@ -159,8 +176,11 @@ export class ProdServer extends TungstenServer {
159
176
  internalStore,
160
177
  stores,
161
178
  storeSubscriptions
162
- } = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading);
179
+ } = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading, context, networkedData);
163
180
  const instance = new Instance(location, instanceConfig, reqRes, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
181
+ instance.fileVersions = this.compilationInfo.fileVersions;
182
+ instance.context = context;
183
+ instance.networkedData = networkedData;
164
184
  let html;
165
185
  if (RootComponentOrNull !== null) {
166
186
  html = await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, RootComponentOrNull, instance, config, this.config.siteBasePath);
@@ -182,13 +202,20 @@ export class ProdServer extends TungstenServer {
182
202
  if (instance.redirected !== undefined) return;
183
203
  //debug('html', html)
184
204
  res.setHeader('Content-Type', 'text/html');
205
+ // server middleware ran first, and a Cache-Control it set stands
206
+ if (res.getHeader('Cache-Control') === undefined) {
207
+ const key = instance.matchedRouteInfo.key;
208
+ const byKey = routes;
209
+ const cacheControl = pageCacheControl(key !== null && Object.hasOwn(routes, key) ? byKey[key] : undefined, routes[$cacheControl], this.config.defaultCacheControl, reqRes);
210
+ if (cacheControl !== undefined) res.setHeader('Cache-Control', cacheControlHeader(cacheControl));
211
+ }
185
212
  res.status(instance.matchedRouteInfo.key === '404' ? 404 : 200);
186
213
  res.send(html);
187
214
  } catch (e) {
188
215
  cliLog('handleRequest() error', e);
189
216
  // too late for an error page once a redirect has gone out
190
217
  if (res.headersSent) return;
191
- const errorRouteHtml = await this.tryRenderErrorRoute(req, res, capturedGlobalData, e);
218
+ const errorRouteHtml = await this.tryRenderErrorRoute(req, res, capturedGlobalData, capturedContext, capturedNetworkedData, e);
192
219
  res.setHeader('Content-Type', 'text/html');
193
220
  res.status(500);
194
221
  res.send(errorRouteHtml ?? this.errorPage());
@@ -202,7 +229,7 @@ export class ProdServer extends TungstenServer {
202
229
  // actually defines an 'error' route. Never throws - falls back to null (the caller's
203
230
  // default error page) on any failure, since we're already handling one error and can't
204
231
  // risk a second, unhandled one taking the server down.
205
- _defineProperty(this, "tryRenderErrorRoute", async (req, res, globalData, error) => {
232
+ _defineProperty(this, "tryRenderErrorRoute", async (req, res, globalData, context, networkedData, error) => {
206
233
  try {
207
234
  if (this.framework.clientImportAliases === undefined) {
208
235
  throwError('ProdServer.tryRenderErrorRoute()', 'framework.clientImportAliases is undefined');
@@ -216,7 +243,7 @@ export class ProdServer extends TungstenServer {
216
243
  req,
217
244
  res
218
245
  };
219
- const routes = typeof appRoutes === 'function' ? appRoutes(reqRes) : appRoutes;
246
+ const routes = toRoutes(typeof appRoutes === 'function' ? appRoutes(reqRes, context, networkedData) : appRoutes, false);
220
247
  const errorRouteDef = routes.error;
221
248
  if (errorRouteDef === undefined) return null;
222
249
  const location = req.url;
@@ -234,8 +261,11 @@ export class ProdServer extends TungstenServer {
234
261
  internalStore,
235
262
  stores,
236
263
  storeSubscriptions
237
- } = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading);
264
+ } = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading, context, networkedData);
238
265
  const instance = new Instance(location, instanceConfig, reqRes, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
266
+ instance.fileVersions = this.compilationInfo.fileVersions;
267
+ instance.context = context;
268
+ instance.networkedData = networkedData;
239
269
  if (RootComponentOrNull !== null) {
240
270
  return await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, RootComponentOrNull, instance, config, this.config.siteBasePath);
241
271
  }
@@ -323,7 +353,7 @@ export class ProdServer extends TungstenServer {
323
353
  cliWarn(`Received a request from the frontend, but it did not arrive at the` + ` address the frontend was loaded from. This may indicate a` + ` misconfiguration, and may prevent the passing of cookies to the` + ` tungsten server.`);
324
354
  cliWarn(`request: ${target}`);
325
355
  cliWarn(`loaded from: ${origin}`);
326
- cliWarn(`arrived at: ${host}`);
356
+ cliWarn(`arrived at: ${this.arrivedAt(host, req.protocol)}`);
327
357
  cliWarn(`Further mismatches on ${host} are silenced for 24 hours`);
328
358
  }
329
359
  }
@@ -342,16 +372,18 @@ export class ProdServer extends TungstenServer {
342
372
  if (this.compilationInfo.bundleLocation === undefined) {
343
373
  throwError('ProdServer', 'compilationInfo.bundleLocation is unset/undefined');
344
374
  }
345
- this.app.use('/bundle', serveStatic(this.compilationInfo.bundleLocation));
346
- this.app.use(`/${componentCssFolder}/`, serveStatic(join(this.compilationInfo.buildLocation, componentCssFolder)));
347
- this.app.use(`/${frameworkCssFolder}/`, serveStatic(join(this.compilationInfo.buildLocation, frameworkCssFolder)));
375
+ // ?v= urls (processHead, <Stylesheet>) are long-cached when v is the served file's hash
376
+ const serveVersioned = root => [cacheVersioned(root), serveStatic(root)];
377
+ this.app.use('/bundle', serveVersioned(this.compilationInfo.bundleLocation));
378
+ this.app.use(`/${componentCssFolder}/`, serveVersioned(join(this.compilationInfo.buildLocation, componentCssFolder)));
379
+ this.app.use(`/${frameworkCssFolder}/`, serveVersioned(join(this.compilationInfo.buildLocation, frameworkCssFolder)));
348
380
  const publicLocation = join(this.compilationInfo.buildLocation, publicFolder);
349
381
  //console.log('publicLocation', publicLocation, existsSync(publicLocation))
350
- if (existsSync(publicLocation)) this.app.use(serveStatic(publicLocation)); // files from public folder
382
+ if (existsSync(publicLocation)) this.app.use(serveVersioned(publicLocation)); // files from public folder
351
383
  //console.log("serving static files with etag")
352
- this.app.use(serveStatic(join(this.compilationInfo.buildLocation, staticFolder)));
384
+ this.app.use(serveVersioned(join(this.compilationInfo.buildLocation, staticFolder)));
353
385
  if (this.config.assetsDir !== undefined) {
354
- this.app.use('/assets', serveStatic(join(this.compilationInfo.buildLocation, assetsFolder)));
386
+ this.app.use('/assets', serveVersioned(join(this.compilationInfo.buildLocation, assetsFolder)));
355
387
  }
356
388
  this.app.use(`/${this.compilationInfo.codeSubPath}`, serveStatic(this.compilationInfo.buildCodeLocation));
357
389
  if (typeof _config.apiRoutes === 'string' && _config.apiRoutes !== '') {
@@ -360,7 +392,29 @@ export class ProdServer extends TungstenServer {
360
392
  this.app.use(apiPath, express.json());
361
393
  this.app.use(apiPath, this.handleRequestApi);
362
394
  }
363
- this.app.use(this.handleRequest);
395
+ this.requestHandler = _config.registration === 'pipeline' ? new PipelineRequestHandler({
396
+ dev: false,
397
+ config: _config,
398
+ instanceConfig: () => makeInstanceConfigFromFrameworkConfig(this.config),
399
+ fileVersions: this.compilationInfo.fileVersions,
400
+ loadApp: async () => {
401
+ if (pipelineApp === null) {
402
+ throwError('ProdServer', `config.registration is 'pipeline', but no pipeline app was given`);
403
+ }
404
+ return Promise.resolve({
405
+ Root: this.RootComponentOrNull,
406
+ app: pipelineApp
407
+ });
408
+ },
409
+ render: async (Root, instance) => {
410
+ if (this.framework.clientImportAliases === undefined) {
411
+ throwError('ProdServer', 'framework.clientImportAliases is undefined');
412
+ }
413
+ return renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, Root, instance, this.config, this.config.siteBasePath);
414
+ },
415
+ errorPage: () => this.errorPage()
416
+ }).handle : this.handleRequest;
417
+ this.app.use(this.requestHandler);
364
418
  }
365
419
  // private async handlePost(req: express.Request, res: express.Response): Promise<void> {
366
420
  // throw new TungstenError(`Err - Dev server received a post request. Not supported yet.`)
@@ -389,7 +443,12 @@ export class ProdServer extends TungstenServer {
389
443
  // URL.host is the host header's own shape - a port only when it is not the public scheme's
390
444
  // default, so an https site on 443 gives `site.example` rather than `site.example:443`
391
445
  this.expectedHost = new URL(publicOrigin).host;
392
- if (!mute) cliNews(`${packageNameCapitalized} prod server ready at ${localOrigin}`);
446
+ if (!mute) {
447
+ cliNews(`${packageNameCapitalized} prod server ready at ${localOrigin}`);
448
+ if (localOrigin !== publicOrigin) {
449
+ cliNews(`Public URL: ${publicOrigin}`);
450
+ }
451
+ }
393
452
  return localOrigin;
394
453
  }
395
454
  // close() alone only stops new connections arriving - keep-alive sockets (fetch/undici
@@ -1,6 +1,6 @@
1
1
  import type { Server } from 'http';
2
- import type { FrameworkConfigComplete } from 'tungsten/FrameworkConfig.js';
3
2
  import express from 'express';
3
+ import type { FrameworkConfigComplete } from '../FrameworkConfig.js';
4
4
  export declare class StaticSiteServer {
5
5
  config: FrameworkConfigComplete;
6
6
  location?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"StaticSiteServer.d.ts","sourceRoot":"","sources":["../../src/Servers/StaticSiteServer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAE1E,OAAO,OAAO,MAAM,SAAS,CAAA;AAQ7B,qBAAa,gBAAgB;IACzB,MAAM,EAAE,uBAAuB,CAAA;IAE/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,OAAO,CAAC,WAAW,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kBAAkB,EAAE,MAAM,CAAA;gBAEd,MAAM,EAAE,uBAAuB;IAa3C,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAW3B;IACD,IAAI,aAEH;CACJ"}
1
+ {"version":3,"file":"StaticSiteServer.d.ts","sourceRoot":"","sources":["../../src/Servers/StaticSiteServer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,OAAO,OAAO,MAAM,SAAS,CAAA;AAG7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAMpE,qBAAa,gBAAgB;IACzB,MAAM,EAAE,uBAAuB,CAAA;IAE/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,OAAO,CAAC,WAAW,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kBAAkB,EAAE,MAAM,CAAA;gBAEd,MAAM,EAAE,uBAAuB;IAa3C,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAW3B;IACD,IAAI,aAEH;CACJ"}
@@ -1,7 +1,8 @@
1
1
  import type { Response as ExpressResponse } from 'express';
2
- import type { MatchedRouteInfo } from './MatchedRouteInfo.js';
2
+ import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
3
3
  export declare class TungstenServer {
4
4
  protected makeOrigin(proto: string, host: string, port: number): string;
5
+ protected arrivedAt(host: string, proto: string): string;
5
6
  protected hostOfOrigin(origin: string): string | null;
6
7
  protected handleRedirects(res: ExpressResponse, matchedRouteInfo: MatchedRouteInfo): boolean;
7
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TungstenServer.d.ts","sourceRoot":"","sources":["../../src/Servers/TungstenServer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,SAAS,CAAA;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAgB7D,qBAAa,cAAc;IAGvB,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAI9D,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAOrD,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO;CAoD/F"}
1
+ {"version":3,"file":"TungstenServer.d.ts","sourceRoot":"","sources":["../../src/Servers/TungstenServer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,SAAS,CAAA;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAgBtE,qBAAa,cAAc;IAGvB,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAK9D,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAMxD,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAOrD,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO;CAoD/F"}
@@ -14,6 +14,13 @@ export class TungstenServer {
14
14
  makeOrigin(proto, host, port) {
15
15
  return new URL(`${proto}://${host}:${port}`).origin;
16
16
  }
17
+ // A host header leaves the port out when the request went to the scheme's default, so name it:
18
+ // the port is the half of the address that is usually the misconfigured one
19
+ arrivedAt(host, proto) {
20
+ // an ipv6 host is bracketed, and carries a port only after the closing bracket
21
+ const stated = host.startsWith('[') ? host.includes(']:') : host.includes(':');
22
+ return stated ? host : `${host} (over port ${proto === 'https' ? 443 : 80})`;
23
+ }
17
24
  // null for an origin that is not a URL - a sandboxed iframe or similar sends the literal `null`
18
25
  hostOfOrigin(origin) {
19
26
  try {
@@ -0,0 +1,3 @@
1
+ import type { RequestHandler } from 'express';
2
+ export declare function cacheVersioned(root: string): RequestHandler;
3
+ //# sourceMappingURL=cacheVersioned.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cacheVersioned.d.ts","sourceRoot":"","sources":["../../src/Servers/cacheVersioned.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAQ7C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAkB3D"}
@@ -0,0 +1,23 @@
1
+ import { resolve, sep } from 'path';
2
+ import { fileVersion } from '../build/assetVersions.js';
3
+ // long-caches ?v= when v is the served file's hash, so an old server hit with a newer v pins nothing;
4
+ // prod files don't change while serving, so hashes are kept. serveStatic keeps a Cache-Control set
5
+ export function cacheVersioned(root) {
6
+ const base = resolve(root) + sep;
7
+ const versions = new Map();
8
+ return (req, res, next) => {
9
+ const v = req.query.v;
10
+ if (typeof v === 'string' && v !== '') {
11
+ let file;
12
+ try {
13
+ file = resolve(base, '.' + decodeURIComponent(req.path));
14
+ } catch {/* malformed escape: serveStatic answers it */}
15
+ if (file?.startsWith(base) === true) {
16
+ const version = versions.get(file) ?? fileVersion(file);
17
+ if (version !== undefined) versions.set(file, version);
18
+ if (version === v) res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
19
+ }
20
+ }
21
+ next();
22
+ };
23
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"devErrorPageAutoRetry.d.ts","sourceRoot":"","sources":["../../src/Servers/devErrorPageAutoRetry.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAGrC,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAqBlE;AAKD,eAAO,MAAM,4BAA4B,2EAC+B,CAAA"}
1
+ {"version":3,"file":"devErrorPageAutoRetry.d.ts","sourceRoot":"","sources":["../../src/Servers/devErrorPageAutoRetry.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAGrC,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAqBlE;AAKD,eAAO,MAAM,4BAA4B,2EAC+B,CAAA"}
@@ -1,3 +1,4 @@
1
+ // NOT WIRED IN (2026-09-19): unhooked from DevServer/processHead - the race belongs at source (docs/hmr.md)
1
2
  // devErrorPageAutoRetry
2
3
  // exports devErrorPageAutoRetryScript, devErrorPageClearRetryScript, maxAutoRetryAttempts
3
4
  //
@@ -1,8 +1,8 @@
1
1
  import type { StoreSubscriptionsMap } from '../Store/StoreSubscriptions.types.js';
2
2
  import type { ServerDataLoading } from '../Store/ServerDataLoading.js';
3
3
  import type { ReqRes } from '../ReqRes.js';
4
- import type { GlobalData } from '../routing/registerGlobalData.js';
5
- import type { MatchedRouteInfo } from './MatchedRouteInfo.js';
4
+ import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
5
+ import type { BrandedContext, BrandedGlobalData, BrandedNetworkedData } from '../Brands.js';
6
6
  import { InternalStoreSchema } from '../Store/InternalStoreSchema.js';
7
7
  import { type TrueStore } from '../Store/makeStore.js';
8
8
  type InitStoresResult = {
@@ -10,7 +10,7 @@ type InitStoresResult = {
10
10
  stores: TrueStore<any>[];
11
11
  storeSubscriptions: StoreSubscriptionsMap;
12
12
  };
13
- export declare function initStores(location: string, reqResOrNull: ReqRes, globalData: GlobalData, matchedRouteInfo: MatchedRouteInfo, serverDataLoading: ServerDataLoading): InitStoresResult;
14
- export declare function initStores(location: string, reqResOrNull: null, globalData: GlobalData, matchedRouteInfo: MatchedRouteInfo, serverDataLoading?: null): InitStoresResult;
13
+ export declare function initStores(location: string, reqResOrNull: ReqRes, globalData: BrandedGlobalData, matchedRouteInfo: MatchedRouteInfo, serverDataLoading: ServerDataLoading, context: BrandedContext, networkedData: BrandedNetworkedData): InitStoresResult;
14
+ export declare function initStores(location: string, reqResOrNull: null, globalData: BrandedGlobalData, matchedRouteInfo: MatchedRouteInfo, serverDataLoading: null, context: BrandedContext, networkedData: BrandedNetworkedData): InitStoresResult;
15
15
  export {};
16
16
  //# sourceMappingURL=initStores.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initStores.d.ts","sourceRoot":"","sources":["../../src/Servers/initStores.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAsB,MAAM,sCAAsC,CAAA;AAGrG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,EAAa,KAAK,SAAS,EAAI,MAAM,uBAAuB,CAAA;AAInE,KAAK,gBAAgB,GAAG;IACpB,aAAa,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAA;IAC7C,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAA;IACxB,kBAAkB,EAAE,qBAAqB,CAAA;CAC5C,CAAA;AAGD,wBAAgB,UAAU,CACtB,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAC9D,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,GACzE,gBAAgB,CAAA;AAEnB,wBAAgB,UAAU,CACtB,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAC5D,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,EAAE,IAAI,GAC7D,gBAAgB,CAAA"}
1
+ {"version":3,"file":"initStores.d.ts","sourceRoot":"","sources":["../../src/Servers/initStores.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,qBAAqB,EACxB,MAAM,sCAAsC,CAAA;AAG7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EACS,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAC3E,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAIjE,KAAK,gBAAgB,GAAG;IACpB,aAAa,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAA;IAC7C,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAA;IACxB,kBAAkB,EAAE,qBAAqB,CAAA;CAC5C,CAAA;AAID,wBAAgB,UAAU,CACtB,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EACrE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,EAAE,cAAc,EACjG,aAAa,EAAE,oBAAoB,GACpC,gBAAgB,CAAA;AAEnB,wBAAgB,UAAU,CACtB,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,iBAAiB,EACnE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EACpF,aAAa,EAAE,oBAAoB,GACpC,gBAAgB,CAAA"}
@@ -1,12 +1,12 @@
1
1
  import { InternalStoreSchema } from '../Store/InternalStoreSchema.js';
2
2
  import { makeStore } from '../Store/makeStore.js';
3
3
  import { createStores } from '../Store/createStores.js';
4
- export function initStores(location, reqResOrNull, globalData, matchedRouteInfo, serverDataLoading = null) {
4
+ export function initStores(location, reqResOrNull, globalData, matchedRouteInfo, serverDataLoading, context, networkedData = {}) {
5
5
  const storeSubscriptions = new Map();
6
6
  const internalStoreSubscribedElements = new Map();
7
7
  const internalStore = makeStore(new InternalStoreSchema(location, matchedRouteInfo), internalStoreSubscribedElements, serverDataLoading);
8
8
  storeSubscriptions.set(internalStore, internalStoreSubscribedElements);
9
- const stores = createStores(reqResOrNull, matchedRouteInfo, globalData, storeSubscriptions, serverDataLoading);
9
+ const stores = createStores(reqResOrNull, matchedRouteInfo, globalData, storeSubscriptions, serverDataLoading, context, networkedData);
10
10
  return {
11
11
  internalStore,
12
12
  stores,
@@ -1 +1 @@
1
- {"version":3,"file":"loadEnvsDev.d.ts","sourceRoot":"","sources":["../../src/Servers/loadEnvsDev.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAUpE,KAAK,UAAU,GAAG;IACd,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;CACf,CAAA;AAED,wBAAsB,WAAW,CAC7B,MAAM,EAAE,uBAAuB,EAE/B,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,UAAU,EAC7B,UAAU,EAAE,OAAO,EACnB,eAAe,UAAQ,EAEvB,eAAe,CAAC,EAAE,MAAM,iBAkI3B"}
1
+ {"version":3,"file":"loadEnvsDev.d.ts","sourceRoot":"","sources":["../../src/Servers/loadEnvsDev.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAYpE,KAAK,UAAU,GAAG;IACd,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;CACf,CAAA;AAED,wBAAsB,WAAW,CAC7B,MAAM,EAAE,uBAAuB,EAE/B,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,UAAU,EAC7B,UAAU,EAAE,OAAO,EACnB,eAAe,UAAQ,EAEvB,eAAe,CAAC,EAAE,MAAM,iBAkI3B"}
@@ -2,7 +2,7 @@ import { join } from 'path';
2
2
  import { readFile as readFilePromise, access as accessPromise } from 'fs/promises';
3
3
  import { remap as objectRemap, filter as objectFilter } from 'sxy-lib/objects.js';
4
4
  import dotenv from 'dotenv';
5
- import { throwError } from 'tungsten/throwError.js';
5
+ import { throwError } from '../throwError.js';
6
6
  import { getEnvSchemasDev } from '../env/getEnvSchemas.js';
7
7
  import { cliLog, cliOut, cliWarn } from '../cliOutput.js';
8
8
  import { droppedCoreEnvKeys, droppedCoreEnvWarning } from '../env/droppedCoreEnvKeys.js';
@@ -10,6 +10,7 @@ import { addToEnv } from '../env/addToEnv.js';
10
10
  import { tungstenCorePrivateEnvSchema } from './tungstenCorePrivateEnvSchema.js';
11
11
  import { tungstenCorePublicEnvSchema } from './tungstenCorePublicEnvSchema.js';
12
12
  import { checkIsObject, validate } from '../standardSchema.js';
13
+ import { JSONstringify } from '../json.js';
13
14
  export async function loadEnvsDev(config,
14
15
  //load: Load,
15
16
  iteration, initialProcessEnv, _firstLoad, useTestEnvFiles = false,
@@ -46,7 +47,7 @@ buildCodeFolder) {
46
47
  const env = dotenv.parse(await readFilePromise(filePath, 'utf-8'));
47
48
  someEnvLoaded = true;
48
49
  if (_firstLoad) cliOut(`${fileName} loaded from ${filePath}`);
49
- //cliOut(fileName, JSON.stringify(env, null, 4))
50
+ //cliOut(fileName, JSONstringify(env, null, 4))
50
51
  addToEnv(env, tempEnv, prefix, initialProcessEnv, config.suppressEnvOverwriteWarnings);
51
52
  //if (_firstLoad) console.log('loaded env file', fileName)
52
53
  } catch (e) {
@@ -69,7 +70,7 @@ buildCodeFolder) {
69
70
  if (_firstLoad) cliLog('private env schema found');
70
71
  const result = await validate(envSchemas.privateEnvSchema, tempEnv);
71
72
  if (!result.success) {
72
- throwError('Your environment variables failed your private env schema (registerPrivateEnvSchema)', '\n' + result.problems + '\nenv: ' + JSON.stringify(tempEnv, null, 4));
73
+ throwError('Your environment variables failed your private env schema (registerPrivateEnvSchema)', '\n' + result.problems + '\nenv: ' + JSONstringify(tempEnv, null, 4));
73
74
  }
74
75
  checkIsObject('loadEnvsDev()', 'the private env schema', result.value);
75
76
  const dropped = droppedCoreEnvKeys(tungstenCorePrivateEnvSchema, tempEnv, result.value);
@@ -78,7 +79,7 @@ buildCodeFolder) {
78
79
  if (!coreResult.success) {
79
80
  throwError('Your private environment variables don\'t meet the Tungsten requirements. Check .env / .env.private and the schema given to registerPrivateEnvSchema - it may need to coerce a value to the right type.',
80
81
  // eslint-disable-line @stylistic/max-len
81
- '\n' + coreResult.problems + '\nenv: ' + JSON.stringify(tempEnv, null, 4));
82
+ '\n' + coreResult.problems + '\nenv: ' + JSONstringify(tempEnv, null, 4));
82
83
  }
83
84
  global.tungstenPrivateEnv = coreResult.value;
84
85
  //console.log('global.tungstenPrivateEnv', global.tungstenPrivateEnv)
@@ -91,7 +92,7 @@ buildCodeFolder) {
91
92
  });
92
93
  const result = await validate(envSchemas.publicEnvSchema, tempPublicEnv);
93
94
  if (!result.success) {
94
- throwError('Your public environment variables failed your public env schema (registerPublicEnvSchema)', '\n' + result.problems + '\nenv: ' + JSON.stringify(tempEnv, null, 4) + '\nparsed public env ' + JSON.stringify(tempPublicEnv, null, 4));
95
+ throwError('Your public environment variables failed your public env schema (registerPublicEnvSchema)', '\n' + result.problems + '\nenv: ' + JSONstringify(tempEnv, null, 4) + '\nparsed public env ' + JSONstringify(tempPublicEnv, null, 4));
95
96
  }
96
97
  checkIsObject('loadEnvsDev()', 'the public env schema', result.value);
97
98
  const dropped = droppedCoreEnvKeys(tungstenCorePublicEnvSchema, tempPublicEnv, result.value);
@@ -100,7 +101,7 @@ buildCodeFolder) {
100
101
  if (!coreResult.success) {
101
102
  throwError('Your public environment variables don\'t meet the Tungsten requirements. Check .env.public and the schema given to registerPublicEnvSchema - it may need to coerce a value to the right type.',
102
103
  // eslint-disable-line @stylistic/max-len
103
- '\n' + coreResult.problems + '\npublic env: ' + JSON.stringify(tempPublicEnv, null, 4));
104
+ '\n' + coreResult.problems + '\npublic env: ' + JSONstringify(tempPublicEnv, null, 4));
104
105
  }
105
106
  global.tungstenPublicEnv = coreResult.value;
106
107
  //console.log('global.tungstenPublicEnv', global.tungstenPublicEnv)
@@ -0,0 +1,2 @@
1
+ export declare function resetRegistrations(): void;
2
+ //# sourceMappingURL=resetRegistrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resetRegistrations.d.ts","sourceRoot":"","sources":["../../src/Servers/resetRegistrations.ts"],"names":[],"mappings":"AASA,wBAAgB,kBAAkB,SAMjC"}
@@ -0,0 +1,13 @@
1
+ import { contextRegistration } from '../context/registerContext.js';
2
+ import { globalDataFunc } from '../routing/registerGlobalData.js';
3
+ import { registeredNetworkedStore, registeredRouting } from '../routing/routingRegistry.js';
4
+ import { storeSchemas } from '../Store/storeCreators.js';
5
+ // Dev re-imports the app for each request, but not tungsten: the app's server code imports it bare,
6
+ // so it shares the dev server's copy. Each registry is cleared first, and the re-import fills it
7
+ export function resetRegistrations() {
8
+ globalDataFunc.value = undefined;
9
+ contextRegistration.value = undefined;
10
+ registeredRouting.value = undefined;
11
+ registeredNetworkedStore.value = undefined;
12
+ storeSchemas.length = 0;
13
+ }
@@ -1,5 +1,6 @@
1
- import type { MatchedRouteInfo } from './MatchedRouteInfo.js';
1
+ import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
2
2
  import type { Routes } from '../routing/Routes.js';
3
3
  import type { ServerDataLoading } from '../Store/ServerDataLoading.js';
4
- export declare function routing(location: string, routes: Routes, serverDataLoading?: ServerDataLoading | null): Promise<MatchedRouteInfo>;
4
+ import type { BrandedContext, BrandedNetworkedData } from '../Brands.js';
5
+ export declare function routing(location: string, routes: Routes, context: BrandedContext, networkedData: BrandedNetworkedData, serverDataLoading?: ServerDataLoading | null): Promise<MatchedRouteInfo>;
5
6
  //# sourceMappingURL=routing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/Servers/routing.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAOtE,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAE,iBAAiB,GAAG,IAAW,GAC5G,OAAO,CAAC,gBAAgB,CAAC,CA0D9B"}
1
+ {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/Servers/routing.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAOxE,wBAAsB,OAAO,CACzB,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAC9F,iBAAiB,GAAE,iBAAiB,GAAG,IAAW,GACnD,OAAO,CAAC,gBAAgB,CAAC,CA2D3B"}
@@ -1,8 +1,9 @@
1
1
  import { Default404 } from "../routing/Default404.js";
2
2
  import { matchPath } from '../routing/matchPath.js';
3
3
  import { makeTungstenErrorInfo } from '../routing/TungstenErrorInfo.js';
4
+ // context and networkedData: the request's, handed to the matched route's data function
4
5
  import { jsx as _jsx } from "tungsten/jsx-runtime";
5
- export async function routing(location, routes, serverDataLoading = null) {
6
+ export async function routing(location, routes, context, networkedData, serverDataLoading = null) {
6
7
  let defaultRoute, _404Route, errorRoute;
7
8
  // try the current path against each defined route
8
9
  // routeNode is a Route node in the children tree
@@ -33,7 +34,7 @@ export async function routing(location, routes, serverDataLoading = null) {
33
34
  };
34
35
  if ('data' in route) {
35
36
  if (serverDataLoading) serverDataLoading.value = true;
36
- matched.data = await route.data(params, location, match.query);
37
+ matched.data = await route.data(params, location, match.query, context, networkedData);
37
38
  if (serverDataLoading) serverDataLoading.value = false;
38
39
  }
39
40
  return matched;
@@ -1,4 +1,4 @@
1
- import type { MatchedRouteInfo } from '../Servers/MatchedRouteInfo.js';
1
+ import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
2
2
  import type { PopMessage } from '../PopMessage.type.js';
3
3
  import type { ComponentStoreValue } from '../Components.jsx';
4
4
  import type { ReadonlyTrueStoreValue, StoreValue } from './makeStore.js';
@@ -7,6 +7,7 @@ import { TungstenComponent } from '../TungstenComponent.jsx'
7
7
  import { FunctionComponent } from '../FunctionComponent.js'
8
8
  import { TungstenError } from '../TungstenError.js'
9
9
  import { IsObject } from '../IsObject.js'
10
+ import { JSONstringify } from '../json.js'
10
11
 
11
12
  export default function objectCopy<T extends GenericObject>(obj: T): T {
12
13
  return structuredClone(obj)
@@ -418,7 +419,7 @@ export class Store {
418
419
  return this.data || {}
419
420
  }
420
421
  export() {
421
- return JSON.stringify(this.data || {})
422
+ return JSONstringify(this.data || {})
422
423
  }
423
424
  import(jsonData: string) {
424
425
  //console.log('json data', jsonData)
@@ -1,6 +1,9 @@
1
1
  import type { ReqRes } from '../ReqRes.js';
2
- import type { MatchedRouteInfo } from '../Servers/MatchedRouteInfo.js';
2
+ import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
3
3
  import type { GlobalData } from '../routing/registerGlobalData.js';
4
- export type StoreSchemaClass<StoreSchema> = new (reqRes: ReqRes | null, globalData: GlobalData, matchedRouteInfo: MatchedRouteInfo) => StoreSchema;
5
- export type StoreSchemaClassGeneral = new (reqRes: ReqRes | null, globalData: GlobalData, matchedRouteInfo: MatchedRouteInfo) => object;
4
+ import type { NetworkedData } from '../routing/routingRegistry.js';
5
+ import type { Context } from '../context/registerContext.js';
6
+ import type { BrandedContext, BrandedGlobalData, BrandedNetworkedData } from '../Brands.js';
7
+ export type StoreSchemaClass<StoreSchema> = new (reqRes: ReqRes | null, context: Context, networkedData: NetworkedData, globalData: GlobalData, matchedRouteInfo: MatchedRouteInfo) => StoreSchema;
8
+ export type BrandedStoreSchemaClass<StoreSchema> = new (reqRes: ReqRes | null, context: BrandedContext, networkedData: BrandedNetworkedData, globalData: BrandedGlobalData, matchedRouteInfo: MatchedRouteInfo) => StoreSchema;
6
9
  //# sourceMappingURL=StoreSchemaClass.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StoreSchemaClass.d.ts","sourceRoot":"","sources":["../../src/Store/StoreSchemaClass.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAGlE,MAAM,MAAM,gBAAgB,CAAC,WAAW,IAAI,KACxC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,KACjC,WAAW,CAAA;AAEhB,MAAM,MAAM,uBAAuB,GAAG,KAClC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,KACjC,MAAM,CAAA"}
1
+ {"version":3,"file":"StoreSchemaClass.d.ts","sourceRoot":"","sources":["../../src/Store/StoreSchemaClass.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAO3F,MAAM,MAAM,gBAAgB,CAAC,WAAW,IAAI,KACxC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,KACjC,WAAW,CAAA;AAEhB,MAAM,MAAM,uBAAuB,CAAC,WAAW,IAAI,KAC/C,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,cAAc,EACvB,aAAa,EAAE,oBAAoB,EACnC,UAAU,EAAE,iBAAiB,EAC7B,gBAAgB,EAAE,gBAAgB,KACjC,WAAW,CAAA"}
@@ -1 +1,8 @@
1
- export {};
1
+ export {};
2
+ // export type BrandedStoreSchemaClassGeneral = new (
3
+ // reqRes: ReqRes | null,
4
+ // context: BrandedContext,
5
+ // networkedData: BrandedNetworkedData,
6
+ // globalData: BrandedGlobalData,
7
+ // matchedRouteInfo: MatchedRouteInfo,
8
+ // ) => object
@@ -7,6 +7,7 @@ import { SxyBaseStoreComponent } from '../Components.jsx'
7
7
  import { FunctionComponent } from '../FunctionComponent.js'
8
8
  import { TungstenError } from '../TungstenError.js'
9
9
  import { IsObject } from '../IsObject.js'
10
+ import { JSONstringify } from '../json.js'
10
11
 
11
12
 
12
13
 
@@ -421,7 +422,7 @@ export class TypeSafeStore<Schema extends object> {
421
422
  return this.data || {}
422
423
  }
423
424
  export() {
424
- return JSON.stringify(this.data || {})
425
+ return JSONstringify(this.data || {})
425
426
  }
426
427
  import(jsonData: string) {
427
428
  //console.log('json data', jsonData)
@@ -1,8 +1,8 @@
1
1
  import type { ServerDataLoading } from './ServerDataLoading.js';
2
2
  import type { ReqRes } from '../ReqRes.js';
3
- import type { MatchedRouteInfo } from '../Servers/MatchedRouteInfo.js';
4
- import type { GlobalData } from '../routing/registerGlobalData.js';
3
+ import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
5
4
  import type { StoreSubscriptionsMap } from './StoreSubscriptions.types.js';
5
+ import type { BrandedContext, BrandedGlobalData, BrandedNetworkedData } from '../Brands.js';
6
6
  import { type TrueStore } from './makeStore.js';
7
- export declare function createStores(reqRes: ReqRes | null, matchedRouteInfo: MatchedRouteInfo, globalData: GlobalData, storeSubscriptionsMap: StoreSubscriptionsMap, serverDataLoading?: ServerDataLoading | null): TrueStore<unknown>[];
7
+ export declare function createStores(reqRes: ReqRes | null, matchedRouteInfo: MatchedRouteInfo, globalData: BrandedGlobalData, storeSubscriptionsMap: StoreSubscriptionsMap, serverDataLoading: ServerDataLoading | null, context: BrandedContext, networkedData: BrandedNetworkedData): TrueStore<unknown>[];
8
8
  //# sourceMappingURL=createStores.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createStores.d.ts","sourceRoot":"","sources":["../../src/Store/createStores.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI1D,wBAAgB,YAAY,CACxB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,qBAAqB,EAAE,qBAAqB,EAC5C,iBAAiB,GAAE,iBAAiB,GAAG,IAAW,GACnD,SAAS,CAAC,OAAO,CAAC,EAAE,CAQtB"}
1
+ {"version":3,"file":"createStores.d.ts","sourceRoot":"","sources":["../../src/Store/createStores.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAC3F,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI1D,wBAAgB,YAAY,CACxB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,iBAAiB,EAC7B,qBAAqB,EAAE,qBAAqB,EAC5C,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,EAG3C,OAAO,EAAE,cAAc,EAEvB,aAAa,EAAE,oBAAoB,GACpC,SAAS,CAAC,OAAO,CAAC,EAAE,CAYtB"}
@@ -1,9 +1,14 @@
1
1
  import { makeStore } from './makeStore.js';
2
2
  import { storeSchemas } from './storeCreators.js';
3
- export function createStores(reqRes, matchedRouteInfo, globalData, storeSubscriptionsMap, serverDataLoading = null) {
3
+ export function createStores(reqRes, matchedRouteInfo, globalData, storeSubscriptionsMap, serverDataLoading,
4
+ // required: every store is handed the one context the request made. A default here built a
5
+ // second, unrelated {} whenever a caller forgot, and nothing noticed
6
+ context,
7
+ // made before routing (createNetworkedData) and handed down; {} when none is registered
8
+ networkedData) {
4
9
  const stores = storeSchemas.map(Schema => {
5
10
  const subscribedElements = new Map();
6
- const store = makeStore(new Schema(reqRes, globalData, matchedRouteInfo), subscribedElements, serverDataLoading);
11
+ const store = makeStore(new Schema(reqRes, context, networkedData, globalData, matchedRouteInfo), subscribedElements, serverDataLoading);
7
12
  storeSubscriptionsMap.set(store, subscribedElements);
8
13
  return store;
9
14
  });
@@ -1 +1 @@
1
- {"version":3,"file":"getInternalStore.d.ts","sourceRoot":"","sources":["../../src/Store/getInternalStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAuB,MAAM,0BAA0B,CAAA;AAM3F,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACnD,sBAAsB,CAIxB"}
1
+ {"version":3,"file":"getInternalStore.d.ts","sourceRoot":"","sources":["../../src/Store/getInternalStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAKtE,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACnD,sBAAsB,CAIxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"registerStore.d.ts","sourceRoot":"","sources":["../../src/Store/registerStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,cAAc,EAAE,0BAA0B,EAAC,gCAAgC,EAAE,kCAAkC,EAClH,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGlD,KAAK,mBAAmB,GAClB,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACzC,gCAAgC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAC/C,kCAAkC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAG5D,KAAK,iBAAiB,CAAC,WAAW,SAAS,MAAM,IAAI;IACjD,iBAAiB,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,cAAc,CAAC,WAAW,CAAC,CAAA;IAChF,QAAQ,EAAE,CAAC,gBAAgB,EAAE,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,KAAK,SAAS,CAAC,WAAW,CAAC,CAAA;CAC1F,CAAA;AACD,wBAAgB,aAAa,CAAC,WAAW,SAAS,MAAM,EAAE,WAAW,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAC9F,iBAAiB,CAAC,WAAW,CAAC,CAqBnC"}
1
+ {"version":3,"file":"registerStore.d.ts","sourceRoot":"","sources":["../../src/Store/registerStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,cAAc,EAAE,0BAA0B,EAAE,gCAAgC,EAC5E,kCAAkC,EACrC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGlD,KAAK,mBAAmB,GAClB,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACzC,gCAAgC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAC/C,kCAAkC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAG5D,KAAK,iBAAiB,CAAC,WAAW,SAAS,MAAM,IAAI;IACjD,iBAAiB,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,cAAc,CAAC,WAAW,CAAC,CAAA;IAChF,QAAQ,EAAE,CAAC,gBAAgB,EAAE,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,KAAK,SAAS,CAAC,WAAW,CAAC,CAAA;CAC1F,CAAA;AACD,wBAAgB,aAAa,CAAC,WAAW,SAAS,MAAM,EAAE,WAAW,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAC9F,iBAAiB,CAAC,WAAW,CAAC,CAqBnC"}