tungsten 0.6.3 → 0.7.1

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 (532) 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 +9 -1
  14. package/dist/FrameworkConfig.d.ts.map +1 -1
  15. package/dist/FrameworkConfig.types.test.d.ts +2 -0
  16. package/dist/FrameworkConfig.types.test.d.ts.map +1 -0
  17. package/dist/FrameworkConfig.types.test.js +6 -0
  18. package/dist/FunctionComponent.d.ts +1 -0
  19. package/dist/FunctionComponent.d.ts.map +1 -1
  20. package/dist/FunctionComponentStandIn.d.ts.map +1 -1
  21. package/dist/Instance/Instance.d.ts +21 -9
  22. package/dist/Instance/Instance.d.ts.map +1 -1
  23. package/dist/Instance/Instance.js +42 -38
  24. package/dist/Instance/InstanceConfig.d.ts +3 -1
  25. package/dist/Instance/InstanceConfig.d.ts.map +1 -1
  26. package/dist/RenderedContentNode.d.ts.map +1 -1
  27. package/dist/RenderingNode.d.ts.map +1 -1
  28. package/dist/Servers/DevServer.d.ts +4 -2
  29. package/dist/Servers/DevServer.d.ts.map +1 -1
  30. package/dist/Servers/DevServer.js +72 -21
  31. package/dist/Servers/ProdServer.d.ts +5 -2
  32. package/dist/Servers/ProdServer.d.ts.map +1 -1
  33. package/dist/Servers/ProdServer.js +95 -19
  34. package/dist/Servers/StaticSiteServer.d.ts +1 -1
  35. package/dist/Servers/StaticSiteServer.d.ts.map +1 -1
  36. package/dist/Servers/TungstenServer.d.ts +2 -1
  37. package/dist/Servers/TungstenServer.d.ts.map +1 -1
  38. package/dist/Servers/TungstenServer.js +7 -0
  39. package/dist/Servers/cacheVersioned.d.ts +3 -0
  40. package/dist/Servers/cacheVersioned.d.ts.map +1 -0
  41. package/dist/Servers/cacheVersioned.js +23 -0
  42. package/dist/Servers/devErrorPageAutoRetry.d.ts.map +1 -1
  43. package/dist/Servers/devErrorPageAutoRetry.js +1 -0
  44. package/dist/Servers/initStores.d.ts +4 -4
  45. package/dist/Servers/initStores.d.ts.map +1 -1
  46. package/dist/Servers/initStores.js +2 -2
  47. package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
  48. package/dist/Servers/loadEnvsDev.js +7 -6
  49. package/dist/Servers/resetRegistrations.d.ts +2 -0
  50. package/dist/Servers/resetRegistrations.d.ts.map +1 -0
  51. package/dist/Servers/resetRegistrations.js +13 -0
  52. package/dist/Servers/routing.d.ts +3 -2
  53. package/dist/Servers/routing.d.ts.map +1 -1
  54. package/dist/Servers/routing.js +12 -7
  55. package/dist/Servers/stubInstance.d.ts +8 -0
  56. package/dist/Servers/stubInstance.d.ts.map +1 -0
  57. package/dist/Servers/stubInstance.js +40 -0
  58. package/dist/Store/InternalStoreSchema.d.ts +1 -1
  59. package/dist/Store/Store.js +2 -1
  60. package/dist/Store/StoreSchemaClass.d.ts +6 -3
  61. package/dist/Store/StoreSchemaClass.d.ts.map +1 -1
  62. package/dist/Store/StoreSchemaClass.js +8 -1
  63. package/dist/Store/TypeSafeStore.js +2 -1
  64. package/dist/Store/createStores.d.ts +3 -3
  65. package/dist/Store/createStores.d.ts.map +1 -1
  66. package/dist/Store/createStores.js +7 -2
  67. package/dist/Store/getInternalStore.d.ts.map +1 -1
  68. package/dist/Store/registerStore.d.ts.map +1 -1
  69. package/dist/Store/registerStore.js +2 -2
  70. package/dist/Store/storeCreators.d.ts +2 -2
  71. package/dist/Store/storeCreators.d.ts.map +1 -1
  72. package/dist/TungstenApp.d.ts +3 -3
  73. package/dist/TungstenApp.d.ts.map +1 -1
  74. package/dist/_client/cjsHelpers.d.ts.map +1 -1
  75. package/dist/_client/cjsHelpers.js +5 -3
  76. package/dist/_client/client.d.ts +2 -0
  77. package/dist/_client/client.d.ts.map +1 -1
  78. package/dist/_client/client.js +10 -3
  79. package/dist/api/getApiRoutes.d.ts.map +1 -1
  80. package/dist/api/getExport.d.ts +1 -1
  81. package/dist/api/getExport.d.ts.map +1 -1
  82. package/dist/api/getExport.js +2 -1
  83. package/dist/api/getExportDev.d.ts +1 -1
  84. package/dist/api/getExportDev.d.ts.map +1 -1
  85. package/dist/appBuilder.d.ts +69 -0
  86. package/dist/appBuilder.d.ts.map +1 -0
  87. package/dist/appBuilder.js +98 -0
  88. package/dist/appBuilder.types.test.d.ts +110 -0
  89. package/dist/appBuilder.types.test.d.ts.map +1 -0
  90. package/dist/appBuilder.types.test.js +240 -0
  91. package/dist/babelPlugins/BabelTransformBindDirect.js +7 -7
  92. package/dist/babelPlugins/BabelTransformBindVar.js +7 -7
  93. package/dist/babelPlugins/BabelTransformComponentState.d.ts.map +1 -1
  94. package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
  95. package/dist/babelPlugins/BabelTransformComponentStyles.js +5 -5
  96. package/dist/babelPlugins/BabelTransformCssImports.d.ts.map +1 -1
  97. package/dist/babelPlugins/BabelTransformCssImports.js +2 -2
  98. package/dist/babelPlugins/BabelTransformDeproxyState.d.ts.map +1 -1
  99. package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
  100. package/dist/babelPlugins/BabelTransformPackageImports.js +11 -6
  101. package/dist/babelPlugins/BabelTransformRemoveDevBlocks.d.ts.map +1 -1
  102. package/dist/babelPlugins/BabelTransformRemoveServerBlocks.d.ts.map +1 -1
  103. package/dist/babelPlugins/BabelTypes.d.ts.map +1 -1
  104. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.d.ts.map +1 -1
  105. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.js +1 -1
  106. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.d.ts.map +1 -1
  107. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.js +2 -2
  108. package/dist/bin/commands/compile.d.ts.map +1 -1
  109. package/dist/bin/commands/compile.js +2 -1
  110. package/dist/build/CompilationInfo.d.ts +3 -0
  111. package/dist/build/CompilationInfo.d.ts.map +1 -1
  112. package/dist/build/assetVersions.d.ts +9 -0
  113. package/dist/build/assetVersions.d.ts.map +1 -0
  114. package/dist/build/assetVersions.js +39 -0
  115. package/dist/build/babel.user.common.config.d.ts.map +1 -1
  116. package/dist/build/bundle.d.ts.map +1 -1
  117. package/dist/build/bundle.js +2 -1
  118. package/dist/build/bundleBabelOptions.d.ts.map +1 -1
  119. package/dist/build/clientRoutesFile.d.ts +2 -0
  120. package/dist/build/clientRoutesFile.d.ts.map +1 -0
  121. package/dist/build/clientRoutesFile.js +13 -0
  122. package/dist/build/compileJavascript.d.ts.map +1 -1
  123. package/dist/build/compileJavascript.js +4 -3
  124. package/dist/build/compileStyles.d.ts +2 -1
  125. package/dist/build/compileStyles.d.ts.map +1 -1
  126. package/dist/build/compileStyles.js +38 -83
  127. package/dist/build/compileUserApp.d.ts.map +1 -1
  128. package/dist/build/componentStylesCache.d.ts.map +1 -1
  129. package/dist/build/componentStylesCache.js +3 -2
  130. package/dist/build/copyAssets.d.ts.map +1 -1
  131. package/dist/build/copyAssets.js +2 -1
  132. package/dist/build/copyPackageModulesToPackagesFolder.d.ts.map +1 -1
  133. package/dist/build/copyPackageModulesToPackagesFolder.js +1 -1
  134. package/dist/build/copyPublicFiles.d.ts.map +1 -1
  135. package/dist/build/copyPublicFiles.js +2 -1
  136. package/dist/build/createClientFiles.d.ts.map +1 -1
  137. package/dist/build/createClientFiles.js +9 -5
  138. package/dist/build/createInstanceConfigFile.d.ts +1 -1
  139. package/dist/build/createInstanceConfigFile.d.ts.map +1 -1
  140. package/dist/build/createInstanceConfigFile.js +9 -3
  141. package/dist/build/frameworkDestLocation.d.ts.map +1 -1
  142. package/dist/build/frameworkDestLocation.js +5 -6
  143. package/dist/build/frameworkStylesheets.d.ts.map +1 -1
  144. package/dist/build/frameworkStylesheets.js +1 -1
  145. package/dist/build/makeBabelRawConfig.d.ts.map +1 -1
  146. package/dist/build/makeBabelUserDevConfig.d.ts +2 -2
  147. package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
  148. package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
  149. package/dist/build/rollup.user.prod.config.d.ts.map +1 -1
  150. package/dist/build/rollup.user.prod.config.js +5 -3
  151. package/dist/build/rollupProdConstants.d.ts +5 -0
  152. package/dist/build/rollupProdConstants.d.ts.map +1 -0
  153. package/dist/build/rollupProdConstants.js +21 -0
  154. package/dist/cacheControl.d.ts +13 -0
  155. package/dist/cacheControl.d.ts.map +1 -0
  156. package/dist/cacheControl.js +22 -0
  157. package/dist/compat/types.d.ts +1 -1
  158. package/dist/compat/types.d.ts.map +1 -1
  159. package/dist/componentHelpers.d.ts +19 -0
  160. package/dist/componentHelpers.d.ts.map +1 -0
  161. package/dist/componentHelpers.js +31 -0
  162. package/dist/componentProxyHandlers.d.ts.map +1 -1
  163. package/dist/components/Fragment.d.ts +8 -0
  164. package/dist/components/Fragment.d.ts.map +1 -0
  165. package/dist/components/Fragment.js +10 -0
  166. package/dist/components/Link.d.ts +4 -3
  167. package/dist/components/Link.d.ts.map +1 -1
  168. package/dist/components/Link.js +1 -0
  169. package/dist/components/NoEscape.d.ts +8 -0
  170. package/dist/components/NoEscape.d.ts.map +1 -0
  171. package/dist/components/NoEscape.js +6 -0
  172. package/dist/components/RouteRedirectComponent.d.ts.map +1 -1
  173. package/dist/components/RouteRedirectComponent.js +1 -1
  174. package/dist/components/WebRedirectComponent.d.ts.map +1 -1
  175. package/dist/components/WebRedirectComponent.js +1 -1
  176. package/dist/components/bindable/BindVariable.d.ts +1 -0
  177. package/dist/components/bindable/BindVariable.d.ts.map +1 -1
  178. package/dist/components/bindable/BindableCheckbox.d.ts +7 -7
  179. package/dist/components/bindable/BindableCheckbox.d.ts.map +1 -1
  180. package/dist/components/bindable/BindableInput.d.ts +7 -7
  181. package/dist/components/bindable/BindableInput.d.ts.map +1 -1
  182. package/dist/components/bindable/BindableInputNonString.d.ts +2 -2
  183. package/dist/components/bindable/BindableInputNonString.d.ts.map +1 -1
  184. package/dist/components/bindable/BindableInputString.d.ts +2 -2
  185. package/dist/components/bindable/BindableInputString.d.ts.map +1 -1
  186. package/dist/components/bindable/BindableInputTyped.d.ts +3 -3
  187. package/dist/components/bindable/BindableInputTyped.d.ts.map +1 -1
  188. package/dist/components/bindable/BindableInputTypedLegacy.d.ts +3 -3
  189. package/dist/components/bindable/BindableInputTypedLegacy.d.ts.map +1 -1
  190. package/dist/components/bindable/BindableRadio.js +2 -2
  191. package/dist/components/bindable/BindableSelect.d.ts +13 -10
  192. package/dist/components/bindable/BindableSelect.d.ts.map +1 -1
  193. package/dist/components/bindable/BindableSelectNaive.js +3 -3
  194. package/dist/components/bindable/BindableTextarea.d.ts +7 -7
  195. package/dist/components/bindable/BindableTextarea.d.ts.map +1 -1
  196. package/dist/components/bindable/bindableCandidates.comparison.d.ts +136 -0
  197. package/dist/components/bindable/bindableCandidates.comparison.d.ts.map +1 -0
  198. package/dist/components/bindable/bindableCandidates.comparison.js +268 -0
  199. package/dist/components/bindable/bindableProps.types.test.d.ts +50 -0
  200. package/dist/components/bindable/bindableProps.types.test.d.ts.map +1 -0
  201. package/dist/components/bindable/bindableProps.types.test.js +252 -0
  202. package/dist/components/library/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  203. package/dist/components/library/RichTextEditor/contentTree.d.ts.map +1 -1
  204. package/dist/components/makeTypedLink.d.ts +9 -0
  205. package/dist/components/makeTypedLink.d.ts.map +1 -0
  206. package/dist/components/makeTypedLink.js +15 -0
  207. package/dist/context/registerContext.d.ts +22 -0
  208. package/dist/context/registerContext.d.ts.map +1 -0
  209. package/dist/context/registerContext.js +18 -0
  210. package/dist/env/getEnvSchemas.d.ts.map +1 -1
  211. package/dist/env/getEnvSchemas.js +2 -1
  212. package/dist/fileVersions.d.ts +9 -0
  213. package/dist/fileVersions.d.ts.map +1 -0
  214. package/dist/fileVersions.js +28 -0
  215. package/dist/findUserConfig.d.ts +1 -1
  216. package/dist/findUserConfig.d.ts.map +1 -1
  217. package/dist/findUserConfig.js +2 -1
  218. package/dist/frameworkConfigSchema.d.ts +16 -2
  219. package/dist/frameworkConfigSchema.d.ts.map +1 -1
  220. package/dist/frameworkConfigSchema.js +15 -3
  221. package/dist/getComponent.d.ts.map +1 -1
  222. package/dist/getComponent.js +4 -3
  223. package/dist/getRoutes.d.ts.map +1 -1
  224. package/dist/getRoutes.js +9 -8
  225. package/dist/getUserConfig.d.ts.map +1 -1
  226. package/dist/hmr/applyHmrModule.d.ts.map +1 -1
  227. package/dist/hmr/componentIdentity.js +1 -1
  228. package/dist/hooks/getCurrentComponent.d.ts +1 -1
  229. package/dist/hooks/getCurrentComponent.d.ts.map +1 -1
  230. package/dist/hydrate/hydrate.d.ts +5 -1
  231. package/dist/hydrate/hydrate.d.ts.map +1 -1
  232. package/dist/hydrate/hydrate.js +86 -52
  233. package/dist/hydrate/hydrateGlobalData.d.ts +4 -3
  234. package/dist/hydrate/hydrateGlobalData.d.ts.map +1 -1
  235. package/dist/hydrate/reconcileHydratedAttributes.d.ts +2 -1
  236. package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
  237. package/dist/hydrate/reconcileHydratedAttributes.js +4 -3
  238. package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -1
  239. package/dist/hydrate/renderHydrationMismatchBanner.js +2 -1
  240. package/dist/hydrate/stubRouting.d.ts +8 -0
  241. package/dist/hydrate/stubRouting.d.ts.map +1 -0
  242. package/dist/hydrate/stubRouting.js +25 -0
  243. package/dist/importDevModuleWithRetry.d.ts +2 -1
  244. package/dist/importDevModuleWithRetry.d.ts.map +1 -1
  245. package/dist/importDevModuleWithRetry.js +2 -1
  246. package/dist/importModule.d.ts +3 -0
  247. package/dist/importModule.d.ts.map +1 -0
  248. package/dist/importModule.js +4 -0
  249. package/dist/index.js +2 -1
  250. package/dist/indexInner.d.ts +30 -7
  251. package/dist/indexInner.d.ts.map +1 -1
  252. package/dist/indexInner.js +37 -2
  253. package/dist/json.d.ts +12 -0
  254. package/dist/json.d.ts.map +1 -0
  255. package/dist/json.js +8 -0
  256. package/dist/jsxHelpers.d.ts +3 -0
  257. package/dist/jsxHelpers.d.ts.map +1 -0
  258. package/dist/jsxHelpers.js +6 -0
  259. package/dist/jsxRuntime.d.ts +1 -0
  260. package/dist/jsxRuntime.d.ts.map +1 -1
  261. package/dist/jsxRuntime.js +3 -1
  262. package/dist/jsxRuntimeSignals.d.ts.map +1 -1
  263. package/dist/jsxRuntimeSignals.js +1 -0
  264. package/dist/makeFinalConfig.d.ts.map +1 -1
  265. package/dist/makeFinalConfig.js +2 -0
  266. package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
  267. package/dist/makeInstanceConfigFromFrameworkConfig.js +2 -0
  268. package/dist/mergeConfigs.d.ts.map +1 -1
  269. package/dist/mergeConfigs.js +2 -6
  270. package/dist/nbsp.d.ts +1 -2
  271. package/dist/nbsp.d.ts.map +1 -1
  272. package/dist/nbsp.js +3 -7
  273. package/dist/objectMap.d.ts +1 -1
  274. package/dist/objectMap.d.ts.map +1 -1
  275. package/dist/pipeline/PipelineRequestHandler.d.ts +25 -0
  276. package/dist/pipeline/PipelineRequestHandler.d.ts.map +1 -0
  277. package/dist/pipeline/PipelineRequestHandler.js +104 -0
  278. package/dist/pipeline/contextStore.d.ts +12 -0
  279. package/dist/pipeline/contextStore.d.ts.map +1 -0
  280. package/dist/pipeline/contextStore.js +13 -0
  281. package/dist/pipeline/hydratePipeline.d.ts +4 -0
  282. package/dist/pipeline/hydratePipeline.d.ts.map +1 -0
  283. package/dist/pipeline/hydratePipeline.js +83 -0
  284. package/dist/pipeline/importRoutesModule.d.ts +6 -0
  285. package/dist/pipeline/importRoutesModule.d.ts.map +1 -0
  286. package/dist/pipeline/importRoutesModule.js +33 -0
  287. package/dist/pipeline/networkedTransport.d.ts +11 -0
  288. package/dist/pipeline/networkedTransport.d.ts.map +1 -0
  289. package/dist/pipeline/networkedTransport.js +54 -0
  290. package/dist/pipeline/pipeline.d.ts +107 -0
  291. package/dist/pipeline/pipeline.d.ts.map +1 -0
  292. package/dist/pipeline/pipeline.js +113 -0
  293. package/dist/pipeline/pipeline.types.test.d.ts +760 -0
  294. package/dist/pipeline/pipeline.types.test.d.ts.map +1 -0
  295. package/dist/pipeline/pipeline.types.test.js +344 -0
  296. package/dist/pipeline/pipelineDefinition.d.ts +78 -0
  297. package/dist/pipeline/pipelineDefinition.d.ts.map +1 -0
  298. package/dist/pipeline/pipelineDefinition.js +11 -0
  299. package/dist/pipeline/pipelineSplit.types.test.d.ts +2445 -0
  300. package/dist/pipeline/pipelineSplit.types.test.d.ts.map +1 -0
  301. package/dist/pipeline/pipelineSplit.types.test.js +440 -0
  302. package/dist/pipeline/runPipeline.d.ts +29 -0
  303. package/dist/pipeline/runPipeline.d.ts.map +1 -0
  304. package/dist/pipeline/runPipeline.js +71 -0
  305. package/dist/pipeline/runSplitPipeline.d.ts +10 -0
  306. package/dist/pipeline/runSplitPipeline.d.ts.map +1 -0
  307. package/dist/pipeline/runSplitPipeline.js +52 -0
  308. package/dist/pipeline/splitPipeline.d.ts +62 -0
  309. package/dist/pipeline/splitPipeline.d.ts.map +1 -0
  310. package/dist/pipeline/splitPipeline.js +76 -0
  311. package/dist/pop.js +1 -1
  312. package/dist/rawHtml/filterContentNode.d.ts.map +1 -1
  313. package/dist/render/HeadData.d.ts +3 -1
  314. package/dist/render/HeadData.d.ts.map +1 -1
  315. package/dist/render/classComponentNodeToRenderingTree.d.ts.map +1 -1
  316. package/dist/render/componentNodeToRenderingTree.d.ts.map +1 -1
  317. package/dist/render/contentToHtml.d.ts +2 -2
  318. package/dist/render/contentToHtml.d.ts.map +1 -1
  319. package/dist/render/contentToHtml.js +2 -1
  320. package/dist/render/contentToHtmlDev.d.ts +1 -1
  321. package/dist/render/contentToHtmlDev.d.ts.map +1 -1
  322. package/dist/render/contentTreeToRenderingTree.d.ts.map +1 -1
  323. package/dist/render/contentTreeToRenderingTree.js +6 -2
  324. package/dist/render/functionComponentNodeToRenderingTree.d.ts.map +1 -1
  325. package/dist/render/functionComponentNodeToRenderingTree.js +2 -2
  326. package/dist/render/instantiateComponent.d.ts.map +1 -1
  327. package/dist/render/processHead.d.ts.map +1 -1
  328. package/dist/render/processHead.js +12 -18
  329. package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
  330. package/dist/render/renderingTreeToHtml.js +6 -3
  331. package/dist/render/rootToHtml.d.ts +2 -2
  332. package/dist/render/rootToHtml.d.ts.map +1 -1
  333. package/dist/requests/fetch/delete.d.ts.map +1 -1
  334. package/dist/requests/fetch/delete.js +5 -2
  335. package/dist/requests/fetch/get.js +1 -1
  336. package/dist/requests/fetch/patch.d.ts.map +1 -1
  337. package/dist/requests/fetch/patch.js +5 -2
  338. package/dist/requests/fetch/post.d.ts.map +1 -1
  339. package/dist/requests/fetch/post.js +5 -2
  340. package/dist/requests/fetch/put.d.ts.map +1 -1
  341. package/dist/requests/fetch/put.js +5 -2
  342. package/dist/routesLocationParts.d.ts +6 -0
  343. package/dist/routesLocationParts.d.ts.map +1 -0
  344. package/dist/routesLocationParts.js +10 -0
  345. package/dist/routing/AppRoutes.d.ts +5 -3
  346. package/dist/routing/AppRoutes.d.ts.map +1 -1
  347. package/dist/routing/MatchedRouteInfo.d.ts +13 -0
  348. package/dist/routing/MatchedRouteInfo.d.ts.map +1 -0
  349. package/dist/routing/MatchedRouteInfo.js +1 -0
  350. package/dist/routing/RouteContentFunction.d.ts +1 -2
  351. package/dist/routing/RouteContentFunction.d.ts.map +1 -1
  352. package/dist/routing/RouteDataFunction.type.d.ts +4 -2
  353. package/dist/routing/RouteDataFunction.type.d.ts.map +1 -1
  354. package/dist/routing/RoutePaths.d.ts +12 -0
  355. package/dist/routing/RoutePaths.d.ts.map +1 -0
  356. package/dist/routing/RouteTypes.d.ts +6 -4
  357. package/dist/routing/RouteTypes.d.ts.map +1 -1
  358. package/dist/routing/Routes.d.ts +20 -11
  359. package/dist/routing/Routes.d.ts.map +1 -1
  360. package/dist/routing/RoutesFunction.d.ts +11 -2
  361. package/dist/routing/RoutesFunction.d.ts.map +1 -1
  362. package/dist/routing/Serializable.d.ts +5 -0
  363. package/dist/routing/Serializable.d.ts.map +1 -0
  364. package/dist/routing/Serializable.js +1 -0
  365. package/dist/routing/builder.d.ts +100 -0
  366. package/dist/routing/builder.d.ts.map +1 -0
  367. package/dist/routing/builder.js +219 -0
  368. package/dist/routing/builder.trial.d.ts +2 -0
  369. package/dist/routing/builder.trial.d.ts.map +1 -0
  370. package/dist/routing/builder.trial.js +85 -0
  371. package/dist/routing/defineRoutes.d.ts +8 -0
  372. package/dist/routing/defineRoutes.d.ts.map +1 -0
  373. package/dist/routing/defineRoutes.js +3 -0
  374. package/dist/routing/pyramidRouting.d.ts +2 -0
  375. package/dist/routing/pyramidRouting.d.ts.map +1 -0
  376. package/dist/routing/pyramidRouting.js +13 -0
  377. package/dist/routing/redirectOf.d.ts +11 -0
  378. package/dist/routing/redirectOf.d.ts.map +1 -0
  379. package/dist/routing/redirectOf.js +32 -0
  380. package/dist/routing/registerGlobalData.d.ts +11 -3
  381. package/dist/routing/registerGlobalData.d.ts.map +1 -1
  382. package/dist/routing/registerGlobalData.js +6 -0
  383. package/dist/routing/registerParts.types.test.d.ts +2 -0
  384. package/dist/routing/registerParts.types.test.d.ts.map +1 -0
  385. package/dist/routing/registerParts.types.test.js +139 -0
  386. package/dist/routing/registerRoutes.d.ts +10 -0
  387. package/dist/routing/registerRoutes.d.ts.map +1 -0
  388. package/dist/routing/registerRoutes.js +9 -0
  389. package/dist/routing/registerRouting.d.ts +36 -0
  390. package/dist/routing/registerRouting.d.ts.map +1 -0
  391. package/dist/routing/registerRouting.js +34 -0
  392. package/dist/routing/registerRouting.types.test.d.ts +80 -0
  393. package/dist/routing/registerRouting.types.test.d.ts.map +1 -0
  394. package/dist/routing/registerRouting.types.test.js +120 -0
  395. package/dist/routing/registrationTypes.d.ts +11 -0
  396. package/dist/routing/registrationTypes.d.ts.map +1 -0
  397. package/dist/routing/registrationTypes.js +1 -0
  398. package/dist/routing/resolveAppRoutes.d.ts +5 -0
  399. package/dist/routing/resolveAppRoutes.d.ts.map +1 -0
  400. package/dist/routing/resolveAppRoutes.js +25 -0
  401. package/dist/routing/routesArray.d.ts +23 -0
  402. package/dist/routing/routesArray.d.ts.map +1 -0
  403. package/dist/routing/routesArray.js +20 -0
  404. package/dist/routing/routesArray.types.test.d.ts +2 -0
  405. package/dist/routing/routesArray.types.test.d.ts.map +1 -0
  406. package/dist/routing/routesArray.types.test.js +132 -0
  407. package/dist/routing/routingBuilder.d.ts +34 -0
  408. package/dist/routing/routingBuilder.d.ts.map +1 -0
  409. package/dist/routing/routingBuilder.js +32 -0
  410. package/dist/routing/routingBuilder.types.test.d.ts +2 -0
  411. package/dist/routing/routingBuilder.types.test.d.ts.map +1 -0
  412. package/dist/routing/routingBuilder.types.test.js +171 -0
  413. package/dist/routing/routingRegistry.d.ts +19 -0
  414. package/dist/routing/routingRegistry.d.ts.map +1 -0
  415. package/dist/routing/routingRegistry.js +29 -0
  416. package/dist/staticGen/getAppRoutes.d.ts +2 -2
  417. package/dist/staticGen/getAppRoutes.d.ts.map +1 -1
  418. package/dist/staticGen/getAppRoutes.js +9 -6
  419. package/dist/staticGen/staticGen.d.ts.map +1 -1
  420. package/dist/staticGen/staticGen.js +8 -2
  421. package/dist/style/styleContentSxy.d.ts.map +1 -1
  422. package/dist/sync/index.d.ts.map +1 -1
  423. package/dist/sync/index.js +2 -0
  424. package/dist/syncServer/index.cjs +1 -2
  425. package/dist/syncServer/preload.js +2 -0
  426. package/dist/testing/contentToString.d.ts +13 -0
  427. package/dist/testing/contentToString.d.ts.map +1 -0
  428. package/dist/testing/contentToString.js +105 -0
  429. package/dist/testing/createTestApp.d.ts +25 -1
  430. package/dist/testing/createTestApp.d.ts.map +1 -1
  431. package/dist/testing/createTestApp.js +12 -3
  432. package/dist/testing/display.d.ts +2 -0
  433. package/dist/testing/display.d.ts.map +1 -0
  434. package/dist/testing/display.js +37 -0
  435. package/dist/testing/ensure.d.ts +119 -0
  436. package/dist/testing/ensure.d.ts.map +1 -0
  437. package/dist/testing/ensure.js +664 -0
  438. package/dist/testing/ensure.trial.d.ts +2 -0
  439. package/dist/testing/ensure.trial.d.ts.map +1 -0
  440. package/dist/testing/ensure.trial.js +9 -0
  441. package/dist/testing/ensure.types.test.d.ts +2 -0
  442. package/dist/testing/ensure.types.test.d.ts.map +1 -0
  443. package/dist/testing/ensure.types.test.js +34 -0
  444. package/dist/testing/helpers/contentHtmlElements.d.ts.map +1 -1
  445. package/dist/testing/host.d.ts +86 -15
  446. package/dist/testing/host.d.ts.map +1 -1
  447. package/dist/testing/host.js +82 -23
  448. package/dist/testing/host.types.test.d.ts +2 -0
  449. package/dist/testing/host.types.test.d.ts.map +1 -0
  450. package/dist/testing/host.types.test.js +81 -0
  451. package/dist/testing/hydrateTestApp.d.ts +17 -0
  452. package/dist/testing/hydrateTestApp.d.ts.map +1 -1
  453. package/dist/testing/hydrateTestApp.js +27 -6
  454. package/dist/testing/index.d.ts +5 -3
  455. package/dist/testing/index.d.ts.map +1 -1
  456. package/dist/testing/index.js +3 -1
  457. package/dist/testing/pipeline/createTestPacketApp.d.ts +30 -0
  458. package/dist/testing/pipeline/createTestPacketApp.d.ts.map +1 -0
  459. package/dist/testing/pipeline/createTestPacketApp.js +45 -0
  460. package/dist/testing/pipeline/createTestPacketApp.types.test.d.ts +3 -0
  461. package/dist/testing/pipeline/createTestPacketApp.types.test.d.ts.map +1 -0
  462. package/dist/testing/pipeline/createTestPacketApp.types.test.js +101 -0
  463. package/dist/testing/pipeline/createTestPipelineApp.d.ts +70 -0
  464. package/dist/testing/pipeline/createTestPipelineApp.d.ts.map +1 -0
  465. package/dist/testing/pipeline/createTestPipelineApp.js +90 -0
  466. package/dist/testing/pipeline/createTestPipelineApp.types.test.d.ts +6 -0
  467. package/dist/testing/pipeline/createTestPipelineApp.types.test.d.ts.map +1 -0
  468. package/dist/testing/pipeline/createTestPipelineApp.types.test.js +146 -0
  469. package/dist/testing/pipeline/hostPipeline.d.ts +25 -0
  470. package/dist/testing/pipeline/hostPipeline.d.ts.map +1 -0
  471. package/dist/testing/pipeline/hostPipeline.js +18 -0
  472. package/dist/testing/pipeline/hydrateTestPipelineApp.d.ts +30 -0
  473. package/dist/testing/pipeline/hydrateTestPipelineApp.d.ts.map +1 -0
  474. package/dist/testing/pipeline/hydrateTestPipelineApp.js +193 -0
  475. package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.d.ts +2 -0
  476. package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.d.ts.map +1 -0
  477. package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.js +27 -0
  478. package/dist/testing/pipeline/index.d.ts +5 -0
  479. package/dist/testing/pipeline/index.d.ts.map +1 -0
  480. package/dist/testing/pipeline/index.js +4 -0
  481. package/dist/testing/pipeline/pipelineTestApp.d.ts +34 -0
  482. package/dist/testing/pipeline/pipelineTestApp.d.ts.map +1 -0
  483. package/dist/testing/pipeline/pipelineTestApp.js +100 -0
  484. package/dist/testing/pipeline/testPipelineRoute.d.ts +2 -0
  485. package/dist/testing/pipeline/testPipelineRoute.d.ts.map +1 -0
  486. package/dist/testing/pipeline/testPipelineRoute.js +1 -0
  487. package/dist/testing/resolveContent.d.ts +18 -0
  488. package/dist/testing/resolveContent.d.ts.map +1 -0
  489. package/dist/testing/resolveContent.js +73 -0
  490. package/dist/testing/testingComponentPackage.d.ts +3 -1
  491. package/dist/testing/testingComponentPackage.d.ts.map +1 -1
  492. package/dist/testing/testingComponentPackage.js +16 -1
  493. package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
  494. package/dist/update/integrateUpdateVdom.js +35 -31
  495. package/dist/update/integrateUpdateVdomPrebuild.js +20 -20
  496. package/dist/validChildren.d.ts.map +1 -1
  497. package/dist/zones/react.d.ts.map +1 -1
  498. package/package.json +23 -19
  499. package/types/helpers.d.ts +11 -2
  500. package/types/jsx/html.d.ts +29 -25
  501. package/types/jsx/jsx.d.ts +8 -8
  502. package/types/modules.d.ts +14 -3
  503. package/types/testing.d.ts +0 -0
  504. package/vendor/babel-core.js +5 -5
  505. package/vendor/babel-parser.js +1 -1
  506. package/vendor/babel-preset-react.js +32 -34
  507. package/vendor/babel-preset-typescript.js +5 -5
  508. package/vendor/chalk-extensions.js +3 -146
  509. package/vendor/chokidar.js +311 -5
  510. package/vendor/chunk-B34JUlnS.js +169 -0
  511. package/vendor/{chunk-Bu8ZRE-c.js → chunk-B9ttgKqg.js} +28 -25
  512. package/vendor/{chunk-D2EnpcLg.js → chunk-BGvapINa.js} +3 -164
  513. package/vendor/{chunk-Cqrj-Zqr.js → chunk-BmAiqUzD.js} +22 -8
  514. package/vendor/{chunk-BiUcnLhT.js → chunk-But4T5N_.js} +8 -3
  515. package/vendor/{chunk-OUnVY4Wm.js → chunk-DuR6SGzI.js} +162 -35
  516. package/vendor/css-select.js +3383 -0
  517. package/vendor/dotenv.js +2 -2
  518. package/vendor/express.js +61 -10
  519. package/vendor/manifest.json +4 -3
  520. package/vendor/postcss.js +1 -1
  521. package/vendor/precinct.js +5914 -3591
  522. package/vendor/valibot.js +418 -504
  523. package/dist/Servers/MatchedRouteInfo.d.ts +0 -11
  524. package/dist/Servers/MatchedRouteInfo.d.ts.map +0 -1
  525. package/dist/routing/__fluentRouteBuilder.d.ts +0 -80
  526. package/dist/routing/__fluentRouteBuilder.d.ts.map +0 -1
  527. package/dist/routing/__fluentRouteBuilder.js +0 -183
  528. package/dist/routing/__fluentRoutes.d.ts +0 -2
  529. package/dist/routing/__fluentRoutes.d.ts.map +0 -1
  530. package/dist/routing/__fluentRoutes.js +0 -59
  531. package/vendor/chunk-Hy-cCmu-.js +0 -23
  532. /package/dist/{Servers/MatchedRouteInfo.js → routing/RoutePaths.js} +0 -0
@@ -15,18 +15,28 @@ 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 { responseStatus } from '../routing/MatchedRouteInfo.js';
29
+ import { toRoutes } from '../routing/routesArray.js';
24
30
  import { listenVerified, newBootId, registerBootProbe } from './listenVerified.js';
31
+ import { PipelineRequestHandler } from '../pipeline/PipelineRequestHandler.js';
32
+ import { sendStub, stubInstance } from './stubInstance.js';
25
33
  function debug(...texts) {
26
34
  // console.log(...texts)
27
35
  }
28
36
  export class ProdServer extends TungstenServer {
29
- constructor(framework, _config, compilationInfo, _appRoutes, _RootComponentOrNull, serverMiddleware) {
37
+ constructor(framework, _config, compilationInfo, _appRoutes, _RootComponentOrNull, serverMiddleware,
38
+ // config.registration 'pipeline': the routes module's app, in place of appRoutes
39
+ pipelineApp = null) {
30
40
  super();
31
41
  _defineProperty(this, "framework", void 0);
32
42
  _defineProperty(this, "config", void 0);
@@ -48,6 +58,8 @@ export class ProdServer extends TungstenServer {
48
58
  _defineProperty(this, "apiRoutes", void 0);
49
59
  _defineProperty(this, "server", void 0);
50
60
  _defineProperty(this, "bootId", newBootId());
61
+ // pages: the classic handleRequest, or the pipeline's (config.registration)
62
+ _defineProperty(this, "requestHandler", void 0);
51
63
  // private addServerMiddleware = (serverMiddleware: ServerMiddlewareInfo): void => {
52
64
  // const [middlewareFile, middlewareExportName, middlewarePath] = serverMiddleware
53
65
  // const fullFilePath = 'file://' + join(this.compilationInfo.codeLocation, middlewareFile)
@@ -100,6 +112,9 @@ export class ProdServer extends TungstenServer {
100
112
  // app's error route with the real global data (theme colour, username, ...) rather
101
113
  // than framework defaults, when it did resolve.
102
114
  let capturedGlobalData = {};
115
+ // this request's context, for the error route to reuse
116
+ let capturedContext = {};
117
+ let capturedNetworkedData = {};
103
118
  try {
104
119
  const location = req.url;
105
120
  const instanceConfig = makeInstanceConfigFromFrameworkConfig(this.config);
@@ -109,6 +124,15 @@ export class ProdServer extends TungstenServer {
109
124
  if (this.framework.clientImportAliases === undefined) {
110
125
  throwError('ProdServer.handleRequest()', 'framework.clientImportAliases is undefined');
111
126
  }
127
+ if (this.config.serverSideRouting === false) {
128
+ const reqRes = {
129
+ req,
130
+ res
131
+ };
132
+ const instance = stubInstance(location, instanceConfig, reqRes, this.appRoutes);
133
+ sendStub(reqRes, this.config.defaultCacheControl, await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, this.stubRoot(), instance, this.config, this.config.siteBasePath));
134
+ return;
135
+ }
112
136
  // const appRoutes: AppRoutes = await getRoutes(this.compilationInfo, this.config)
113
137
  // let RootComponentClass: AnyComponentType
114
138
  // if (this.config.useRootComponent) {
@@ -130,11 +154,15 @@ export class ProdServer extends TungstenServer {
130
154
  const serverDataLoading = {
131
155
  value: false
132
156
  };
133
- const routes = typeof appRoutes === 'function' ? appRoutes(reqRes) : appRoutes;
134
- const [globalData, matchedRouteInfo] = await Promise.all([globalDataFunc.value !== undefined ? globalDataFunc.value(reqRes).then(globalData => {
157
+ const context = createContext('server', reqRes);
158
+ capturedContext = context;
159
+ const networkedData = createNetworkedData(reqRes, context);
160
+ capturedNetworkedData = networkedData;
161
+ const routes = toRoutes(typeof appRoutes === 'function' ? appRoutes(reqRes, context, networkedData) : appRoutes, false);
162
+ const [globalData, matchedRouteInfo] = await Promise.all([globalDataFunc.value !== undefined ? globalDataFunc.value(reqRes, context, networkedData).then(globalData => {
135
163
  capturedGlobalData = globalData;
136
164
  return globalData;
137
- }) : {}, routing(location, routes, serverDataLoading)]);
165
+ }) : {}, routing(location, routes, context, networkedData, serverDataLoading)]);
138
166
  //instance.matchedRouteInfo =
139
167
  //cliTodo('Can we move redirect handling to base class?')
140
168
  // // 2025-03-14 copied this code here from Dev server,
@@ -159,8 +187,11 @@ export class ProdServer extends TungstenServer {
159
187
  internalStore,
160
188
  stores,
161
189
  storeSubscriptions
162
- } = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading);
190
+ } = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading, context, networkedData);
163
191
  const instance = new Instance(location, instanceConfig, reqRes, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
192
+ instance.fileVersions = this.compilationInfo.fileVersions;
193
+ instance.context = context;
194
+ instance.networkedData = networkedData;
164
195
  let html;
165
196
  if (RootComponentOrNull !== null) {
166
197
  html = await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, RootComponentOrNull, instance, config, this.config.siteBasePath);
@@ -182,13 +213,20 @@ export class ProdServer extends TungstenServer {
182
213
  if (instance.redirected !== undefined) return;
183
214
  //debug('html', html)
184
215
  res.setHeader('Content-Type', 'text/html');
185
- res.status(instance.matchedRouteInfo.key === '404' ? 404 : 200);
216
+ // server middleware ran first, and a Cache-Control it set stands
217
+ if (res.getHeader('Cache-Control') === undefined) {
218
+ const key = instance.matchedRouteInfo.key;
219
+ const byKey = routes;
220
+ const cacheControl = pageCacheControl(key !== null && Object.hasOwn(routes, key) ? byKey[key] : undefined, routes[$cacheControl], this.config.defaultCacheControl, reqRes);
221
+ if (cacheControl !== undefined) res.setHeader('Cache-Control', cacheControlHeader(cacheControl));
222
+ }
223
+ res.status(responseStatus(instance.matchedRouteInfo));
186
224
  res.send(html);
187
225
  } catch (e) {
188
226
  cliLog('handleRequest() error', e);
189
227
  // too late for an error page once a redirect has gone out
190
228
  if (res.headersSent) return;
191
- const errorRouteHtml = await this.tryRenderErrorRoute(req, res, capturedGlobalData, e);
229
+ const errorRouteHtml = await this.tryRenderErrorRoute(req, res, capturedGlobalData, capturedContext, capturedNetworkedData, e);
192
230
  res.setHeader('Content-Type', 'text/html');
193
231
  res.status(500);
194
232
  res.send(errorRouteHtml ?? this.errorPage());
@@ -202,7 +240,7 @@ export class ProdServer extends TungstenServer {
202
240
  // actually defines an 'error' route. Never throws - falls back to null (the caller's
203
241
  // default error page) on any failure, since we're already handling one error and can't
204
242
  // risk a second, unhandled one taking the server down.
205
- _defineProperty(this, "tryRenderErrorRoute", async (req, res, globalData, error) => {
243
+ _defineProperty(this, "tryRenderErrorRoute", async (req, res, globalData, context, networkedData, error) => {
206
244
  try {
207
245
  if (this.framework.clientImportAliases === undefined) {
208
246
  throwError('ProdServer.tryRenderErrorRoute()', 'framework.clientImportAliases is undefined');
@@ -216,7 +254,7 @@ export class ProdServer extends TungstenServer {
216
254
  req,
217
255
  res
218
256
  };
219
- const routes = typeof appRoutes === 'function' ? appRoutes(reqRes) : appRoutes;
257
+ const routes = toRoutes(typeof appRoutes === 'function' ? appRoutes(reqRes, context, networkedData) : appRoutes, false);
220
258
  const errorRouteDef = routes.error;
221
259
  if (errorRouteDef === undefined) return null;
222
260
  const location = req.url;
@@ -234,8 +272,11 @@ export class ProdServer extends TungstenServer {
234
272
  internalStore,
235
273
  stores,
236
274
  storeSubscriptions
237
- } = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading);
275
+ } = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading, context, networkedData);
238
276
  const instance = new Instance(location, instanceConfig, reqRes, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
277
+ instance.fileVersions = this.compilationInfo.fileVersions;
278
+ instance.context = context;
279
+ instance.networkedData = networkedData;
239
280
  if (RootComponentOrNull !== null) {
240
281
  return await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, RootComponentOrNull, instance, config, this.config.siteBasePath);
241
282
  }
@@ -255,6 +296,12 @@ export class ProdServer extends TungstenServer {
255
296
  return null;
256
297
  }
257
298
  });
299
+ _defineProperty(this, "stubRoot", () => {
300
+ if (this.RootComponentOrNull === null) {
301
+ throwError('ProdServer', 'config.serverSideRouting is false, which needs a root component');
302
+ }
303
+ return this.RootComponentOrNull;
304
+ });
258
305
  _defineProperty(this, "errorPage", () => {
259
306
  return `<!DOCTYPE html>
260
307
  <html>
@@ -323,7 +370,7 @@ export class ProdServer extends TungstenServer {
323
370
  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
371
  cliWarn(`request: ${target}`);
325
372
  cliWarn(`loaded from: ${origin}`);
326
- cliWarn(`arrived at: ${host}`);
373
+ cliWarn(`arrived at: ${this.arrivedAt(host, req.protocol)}`);
327
374
  cliWarn(`Further mismatches on ${host} are silenced for 24 hours`);
328
375
  }
329
376
  }
@@ -342,16 +389,18 @@ export class ProdServer extends TungstenServer {
342
389
  if (this.compilationInfo.bundleLocation === undefined) {
343
390
  throwError('ProdServer', 'compilationInfo.bundleLocation is unset/undefined');
344
391
  }
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)));
392
+ // ?v= urls (processHead, <Stylesheet>) are long-cached when v is the served file's hash
393
+ const serveVersioned = root => [cacheVersioned(root), serveStatic(root)];
394
+ this.app.use('/bundle', serveVersioned(this.compilationInfo.bundleLocation));
395
+ this.app.use(`/${componentCssFolder}/`, serveVersioned(join(this.compilationInfo.buildLocation, componentCssFolder)));
396
+ this.app.use(`/${frameworkCssFolder}/`, serveVersioned(join(this.compilationInfo.buildLocation, frameworkCssFolder)));
348
397
  const publicLocation = join(this.compilationInfo.buildLocation, publicFolder);
349
398
  //console.log('publicLocation', publicLocation, existsSync(publicLocation))
350
- if (existsSync(publicLocation)) this.app.use(serveStatic(publicLocation)); // files from public folder
399
+ if (existsSync(publicLocation)) this.app.use(serveVersioned(publicLocation)); // files from public folder
351
400
  //console.log("serving static files with etag")
352
- this.app.use(serveStatic(join(this.compilationInfo.buildLocation, staticFolder)));
401
+ this.app.use(serveVersioned(join(this.compilationInfo.buildLocation, staticFolder)));
353
402
  if (this.config.assetsDir !== undefined) {
354
- this.app.use('/assets', serveStatic(join(this.compilationInfo.buildLocation, assetsFolder)));
403
+ this.app.use('/assets', serveVersioned(join(this.compilationInfo.buildLocation, assetsFolder)));
355
404
  }
356
405
  this.app.use(`/${this.compilationInfo.codeSubPath}`, serveStatic(this.compilationInfo.buildCodeLocation));
357
406
  if (typeof _config.apiRoutes === 'string' && _config.apiRoutes !== '') {
@@ -360,7 +409,29 @@ export class ProdServer extends TungstenServer {
360
409
  this.app.use(apiPath, express.json());
361
410
  this.app.use(apiPath, this.handleRequestApi);
362
411
  }
363
- this.app.use(this.handleRequest);
412
+ this.requestHandler = _config.registration === 'pipeline' ? new PipelineRequestHandler({
413
+ dev: false,
414
+ config: _config,
415
+ instanceConfig: () => makeInstanceConfigFromFrameworkConfig(this.config),
416
+ fileVersions: this.compilationInfo.fileVersions,
417
+ loadApp: async () => {
418
+ if (pipelineApp === null) {
419
+ throwError('ProdServer', `config.registration is 'pipeline', but no pipeline app was given`);
420
+ }
421
+ return Promise.resolve({
422
+ Root: this.RootComponentOrNull,
423
+ app: pipelineApp
424
+ });
425
+ },
426
+ render: async (Root, instance) => {
427
+ if (this.framework.clientImportAliases === undefined) {
428
+ throwError('ProdServer', 'framework.clientImportAliases is undefined');
429
+ }
430
+ return renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, Root, instance, this.config, this.config.siteBasePath);
431
+ },
432
+ errorPage: () => this.errorPage()
433
+ }).handle : this.handleRequest;
434
+ this.app.use(this.requestHandler);
364
435
  }
365
436
  // private async handlePost(req: express.Request, res: express.Response): Promise<void> {
366
437
  // throw new TungstenError(`Err - Dev server received a post request. Not supported yet.`)
@@ -389,7 +460,12 @@ export class ProdServer extends TungstenServer {
389
460
  // URL.host is the host header's own shape - a port only when it is not the public scheme's
390
461
  // default, so an https site on 443 gives `site.example` rather than `site.example:443`
391
462
  this.expectedHost = new URL(publicOrigin).host;
392
- if (!mute) cliNews(`${packageNameCapitalized} prod server ready at ${localOrigin}`);
463
+ if (!mute) {
464
+ cliNews(`${packageNameCapitalized} prod server ready at ${localOrigin}`);
465
+ if (localOrigin !== publicOrigin) {
466
+ cliNews(`Public URL: ${publicOrigin}`);
467
+ }
468
+ }
393
469
  return localOrigin;
394
470
  }
395
471
  // 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,CA+D3B"}
@@ -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;
@@ -45,11 +46,15 @@ export async function routing(location, routes, serverDataLoading = null) {
45
46
  params: {},
46
47
  content: defaultRoute.content
47
48
  };
48
- if (_404Route) return {
49
- key: '404',
50
- params: {},
51
- content: _404Route.content
52
- };
49
+ if (_404Route) {
50
+ const matched = {
51
+ key: '404',
52
+ params: {},
53
+ content: _404Route.content
54
+ };
55
+ if ('code' in _404Route && typeof _404Route.code === 'number') matched.code = _404Route.code;
56
+ return matched;
57
+ }
53
58
  if (errorRoute) {
54
59
  return {
55
60
  key: 'error',
@@ -0,0 +1,8 @@
1
+ import type { CacheControl } from '../cacheControl.js';
2
+ import type { InstanceConfig } from '../Instance/InstanceConfig.js';
3
+ import type { ReqRes } from '../ReqRes.js';
4
+ import type { AppRoutes } from '../routing/AppRoutes.js';
5
+ import { Instance } from '../Instance/Instance.js';
6
+ export declare function stubInstance(location: string, instanceConfig: InstanceConfig, reqRes: ReqRes, appRoutes: AppRoutes<any>): Instance;
7
+ export declare function sendStub(reqRes: ReqRes, cacheControl: CacheControl | undefined, html: string): void;
8
+ //# sourceMappingURL=stubInstance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stubInstance.d.ts","sourceRoot":"","sources":["../../src/Servers/stubInstance.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAIxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAMlD,wBAAgB,YAAY,CACxB,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,GAC5F,QAAQ,CAgBV;AAGD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,QAS5F"}
@@ -0,0 +1,40 @@
1
+ import { cacheControlHeader, pageCacheControl } from '../cacheControl.js';
2
+ import { Instance } from '../Instance/Instance.js';
3
+ import { initStores } from './initStores.js';
4
+ // config.serverSideRouting false: the instance for a page the server makes no data for and does not
5
+ // route. The render stops at the root's head and body (contentTreeToRenderingTree)
6
+ export function stubInstance(location, instanceConfig, reqRes, appRoutes) {
7
+ const matchedRouteInfo = {
8
+ key: null,
9
+ params: {},
10
+ content: null
11
+ };
12
+ const globalData = {};
13
+ const context = {};
14
+ const networkedData = {};
15
+ const {
16
+ internalStore,
17
+ stores,
18
+ storeSubscriptions
19
+ } = initStores(location, reqRes, globalData, matchedRouteInfo, {
20
+ value: false
21
+ }, context, networkedData);
22
+ const noRoutes = {}; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- never routed
23
+ const instance = new Instance(location, instanceConfig, reqRes, appRoutes, noRoutes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
24
+ instance.context = context;
25
+ instance.networkedData = networkedData;
26
+ return instance;
27
+ }
28
+ // the same page for every location: no route, so no 404. cacheControl: the config's, in prod
29
+ export function sendStub(reqRes, cacheControl, html) {
30
+ const {
31
+ res
32
+ } = reqRes;
33
+ res.setHeader('Content-Type', 'text/html');
34
+ if (res.getHeader('Cache-Control') === undefined) {
35
+ const chosen = pageCacheControl(undefined, undefined, cacheControl, reqRes);
36
+ if (chosen !== undefined) res.setHeader('Cache-Control', cacheControlHeader(chosen));
37
+ }
38
+ res.status(200);
39
+ res.send(html);
40
+ }
@@ -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