tungsten 0.3.1 → 0.3.3

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 (291) hide show
  1. package/dist/.build-complete +1 -0
  2. package/dist/Components.d.ts +2 -1
  3. package/dist/Components.d.ts.map +1 -1
  4. package/dist/Components.js +10 -1
  5. package/dist/DomRegion.js +1 -1
  6. package/dist/Framework.d.ts +2 -0
  7. package/dist/Framework.d.ts.map +1 -1
  8. package/dist/Framework.js +68 -57
  9. package/dist/FrameworkConfig.d.ts +6 -0
  10. package/dist/FrameworkConfig.d.ts.map +1 -1
  11. package/dist/FunctionComponentStandIn.d.ts +2 -0
  12. package/dist/FunctionComponentStandIn.d.ts.map +1 -1
  13. package/dist/FunctionComponentStandIn.js +10 -1
  14. package/dist/Instance/Instance.d.ts.map +1 -1
  15. package/dist/Instance/Instance.js +18 -1
  16. package/dist/Instance/InstanceConfig.d.ts +1 -0
  17. package/dist/Instance/InstanceConfig.d.ts.map +1 -1
  18. package/dist/PopMessage.type.d.ts +6 -0
  19. package/dist/PopMessage.type.d.ts.map +1 -0
  20. package/dist/PopMessage.type.js +1 -0
  21. package/dist/Servers/DevServer.d.ts +4 -0
  22. package/dist/Servers/DevServer.d.ts.map +1 -1
  23. package/dist/Servers/DevServer.js +116 -13
  24. package/dist/Servers/MatchedRouteInfo.d.ts +1 -1
  25. package/dist/Servers/MatchedRouteInfo.d.ts.map +1 -1
  26. package/dist/Servers/ProdServer.d.ts +1 -0
  27. package/dist/Servers/ProdServer.d.ts.map +1 -1
  28. package/dist/Servers/ProdServer.js +79 -5
  29. package/dist/Servers/devErrorPageAutoRetry.d.ts +4 -0
  30. package/dist/Servers/devErrorPageAutoRetry.d.ts.map +1 -0
  31. package/dist/Servers/devErrorPageAutoRetry.js +26 -0
  32. package/dist/Servers/hono/DevServerHono.js +25 -29
  33. package/dist/Servers/hono/ProdServerHono.js +49 -142
  34. package/dist/Servers/hono/TungstenServerHono.d.ts +1 -1
  35. package/dist/Servers/hono/TungstenServerHono.d.ts.map +1 -1
  36. package/dist/Servers/hono/TungstenServerHono.js +12 -29
  37. package/dist/Servers/routing.d.ts.map +1 -1
  38. package/dist/Servers/routing.js +10 -6
  39. package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts +0 -3
  40. package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts.map +1 -1
  41. package/dist/Servers/tungstenCorePrivateEnvSchema.js +3 -3
  42. package/dist/Servers/tungstenCorePublicEnvSchema.d.ts +8 -0
  43. package/dist/Servers/tungstenCorePublicEnvSchema.d.ts.map +1 -0
  44. package/dist/Servers/tungstenCorePublicEnvSchema.js +14 -0
  45. package/dist/Store/InternalStoreSchema.d.ts +2 -0
  46. package/dist/Store/InternalStoreSchema.d.ts.map +1 -1
  47. package/dist/Store/InternalStoreSchema.js +1 -0
  48. package/dist/api/Request.d.ts +1 -1
  49. package/dist/api/Request.d.ts.map +1 -1
  50. package/dist/api/Response.d.ts +1 -1
  51. package/dist/api/Response.d.ts.map +1 -1
  52. package/dist/api/getExport.d.ts.map +1 -1
  53. package/dist/api/getExport.js +2 -1
  54. package/dist/babelPlugins/BabelAddDevCacheBust.d.ts +11 -0
  55. package/dist/babelPlugins/BabelAddDevCacheBust.d.ts.map +1 -0
  56. package/dist/babelPlugins/BabelAddDevCacheBust.js +68 -0
  57. package/dist/babelPlugins/BabelTypes.d.ts +2 -2
  58. package/dist/babelPlugins/BabelTypes.d.ts.map +1 -1
  59. package/dist/babelPlugins/BabelTypes.js +0 -1
  60. package/dist/bin/commands/build.d.ts.map +1 -1
  61. package/dist/bin/commands/build.js +3 -0
  62. package/dist/bin/commands/dev.d.ts.map +1 -1
  63. package/dist/bin/commands/dev.js +16 -3
  64. package/dist/bin/commands/devmon.d.ts +2 -0
  65. package/dist/bin/commands/devmon.d.ts.map +1 -0
  66. package/dist/bin/commands/devmon.js +66 -0
  67. package/dist/bin/index.d.ts.map +1 -1
  68. package/dist/bin/index.js +6 -0
  69. package/dist/booleanAttributeValue.d.ts +21 -0
  70. package/dist/booleanAttributeValue.d.ts.map +1 -0
  71. package/dist/booleanAttributeValue.js +23 -0
  72. package/dist/build/compileJavascript.js +1 -1
  73. package/dist/build/compileUserApp.d.ts +2 -1
  74. package/dist/build/compileUserApp.d.ts.map +1 -1
  75. package/dist/build/compileUserApp.js +10 -9
  76. package/dist/build/createInstanceConfigFile.js +1 -1
  77. package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
  78. package/dist/build/makeBabelUserDevConfig.js +6 -1
  79. package/dist/compat/types.d.ts +1 -1
  80. package/dist/compat/types.d.ts.map +1 -1
  81. package/dist/components/PopMessages.d.ts +12 -0
  82. package/dist/components/PopMessages.d.ts.map +1 -0
  83. package/dist/components/PopMessages.js +45 -0
  84. package/dist/defaultConfig.d.ts +3 -0
  85. package/dist/defaultConfig.d.ts.map +1 -1
  86. package/dist/defaultConfig.js +4 -1
  87. package/dist/env/Interfaces.d.ts +2 -1
  88. package/dist/env/Interfaces.d.ts.map +1 -1
  89. package/dist/env/getEnvSchemas.d.ts +1 -1
  90. package/dist/env/getEnvSchemas.d.ts.map +1 -1
  91. package/dist/env/getEnvSchemas.js +2 -1
  92. package/dist/env/publicEnv.d.ts.map +1 -1
  93. package/dist/env/publicEnv.js +4 -1
  94. package/dist/frameworkConfigSchema.d.ts +4 -0
  95. package/dist/frameworkConfigSchema.d.ts.map +1 -1
  96. package/dist/frameworkConfigSchema.js +2 -1
  97. package/dist/getComponent.d.ts.map +1 -1
  98. package/dist/getComponent.js +2 -1
  99. package/dist/getRoutes.d.ts.map +1 -1
  100. package/dist/getRoutes.js +2 -1
  101. package/dist/hmr/applyHmrModule.d.ts +11 -0
  102. package/dist/hmr/applyHmrModule.d.ts.map +1 -0
  103. package/dist/hmr/applyHmrModule.js +78 -0
  104. package/dist/hmr/componentIdentity.d.ts +9 -0
  105. package/dist/hmr/componentIdentity.d.ts.map +1 -0
  106. package/dist/hmr/componentIdentity.js +17 -0
  107. package/dist/hmr/instanceRegistry.d.ts +4 -0
  108. package/dist/hmr/instanceRegistry.d.ts.map +1 -0
  109. package/dist/hmr/instanceRegistry.js +6 -0
  110. package/dist/hmr/liveReloadHub.d.ts +10 -0
  111. package/dist/hmr/liveReloadHub.d.ts.map +1 -0
  112. package/dist/{dev → hmr}/liveReloadHub.js +8 -2
  113. package/dist/hmr/refreshStylesheets.d.ts +2 -0
  114. package/dist/hmr/refreshStylesheets.d.ts.map +1 -0
  115. package/dist/hmr/refreshStylesheets.js +26 -0
  116. package/dist/hooks/index.d.ts +1 -0
  117. package/dist/hooks/index.d.ts.map +1 -1
  118. package/dist/hooks/index.js +1 -0
  119. package/dist/hooks/useInstance.d.ts +3 -0
  120. package/dist/hooks/useInstance.d.ts.map +1 -0
  121. package/dist/hooks/useInstance.js +4 -0
  122. package/dist/hydrate/hydrate.d.ts +10 -0
  123. package/dist/hydrate/hydrate.d.ts.map +1 -1
  124. package/dist/hydrate/hydrate.js +81 -19
  125. package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
  126. package/dist/hydrate/reconcileHydratedAttributes.js +14 -5
  127. package/dist/hydrate/renderHydrationMismatchBanner.d.ts +7 -0
  128. package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -0
  129. package/dist/hydrate/renderHydrationMismatchBanner.js +69 -0
  130. package/dist/importDevModuleWithRetry.d.ts +3 -0
  131. package/dist/importDevModuleWithRetry.d.ts.map +1 -0
  132. package/dist/importDevModuleWithRetry.js +46 -0
  133. package/dist/indexInner.d.ts +8 -0
  134. package/dist/indexInner.d.ts.map +1 -1
  135. package/dist/indexInner.js +7 -1
  136. package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
  137. package/dist/makeInstanceConfigFromFrameworkConfig.js +2 -1
  138. package/dist/pop.d.ts +10 -0
  139. package/dist/pop.d.ts.map +1 -0
  140. package/dist/pop.js +49 -0
  141. package/dist/rawHtml/filterContentNode.d.ts +20 -0
  142. package/dist/rawHtml/filterContentNode.d.ts.map +1 -0
  143. package/dist/rawHtml/filterContentNode.js +96 -0
  144. package/dist/rawHtml/parseHtml.d.ts +14 -0
  145. package/dist/rawHtml/parseHtml.d.ts.map +1 -1
  146. package/dist/rawHtml/parseHtml.js +4 -4
  147. package/dist/rawHtml/sanitizeHtml.d.ts +17 -0
  148. package/dist/rawHtml/sanitizeHtml.d.ts.map +1 -0
  149. package/dist/rawHtml/sanitizeHtml.js +19 -0
  150. package/dist/render/HeadData.d.ts +2 -0
  151. package/dist/render/HeadData.d.ts.map +1 -1
  152. package/dist/render/contentNodeToHtml.d.ts +18 -0
  153. package/dist/render/contentNodeToHtml.d.ts.map +1 -0
  154. package/dist/render/contentNodeToHtml.js +66 -0
  155. package/dist/render/contentToHtml.d.ts.map +1 -1
  156. package/dist/render/contentToHtml.js +3 -1
  157. package/dist/render/processHead.d.ts.map +1 -1
  158. package/dist/render/processHead.js +53 -6
  159. package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
  160. package/dist/render/renderingTreeToHtml.js +8 -1
  161. package/dist/routing/ErrorRouteType.d.ts +6 -0
  162. package/dist/routing/ErrorRouteType.d.ts.map +1 -0
  163. package/dist/routing/ErrorRouteType.js +1 -0
  164. package/dist/routing/RouteTypes.d.ts +2 -1
  165. package/dist/routing/RouteTypes.d.ts.map +1 -1
  166. package/dist/routing/Routes.d.ts +5 -0
  167. package/dist/routing/Routes.d.ts.map +1 -1
  168. package/dist/routing/TungstenErrorInfo.d.ts +6 -0
  169. package/dist/routing/TungstenErrorInfo.d.ts.map +1 -0
  170. package/dist/routing/TungstenErrorInfo.js +6 -0
  171. package/dist/style/styleContentSxy.js +21 -0
  172. package/dist/testing/hydrateTestApp.d.ts +38 -0
  173. package/dist/testing/hydrateTestApp.d.ts.map +1 -0
  174. package/dist/testing/hydrateTestApp.js +242 -0
  175. package/dist/testing/index.d.ts +4 -3
  176. package/dist/testing/index.d.ts.map +1 -1
  177. package/dist/testing/index.js +16 -2
  178. package/dist/timeProfiler.d.ts +6 -0
  179. package/dist/timeProfiler.d.ts.map +1 -0
  180. package/dist/timeProfiler.js +31 -0
  181. package/dist/update/integrateUpdateVdom.d.ts +16 -1
  182. package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
  183. package/dist/update/integrateUpdateVdom.js +116 -7
  184. package/dist/warnOnFrameworkChange.d.ts +2 -0
  185. package/dist/warnOnFrameworkChange.d.ts.map +1 -0
  186. package/dist/warnOnFrameworkChange.js +27 -0
  187. package/package.json +18 -16
  188. package/dist/Instance/gotoRedirect.sxyt.d.ts +0 -2
  189. package/dist/Instance/gotoRedirect.sxyt.d.ts.map +0 -1
  190. package/dist/Instance/gotoRedirect.sxyt.js +0 -148
  191. package/dist/Instance/runTrackedWork.sxyt.d.ts +0 -2
  192. package/dist/Instance/runTrackedWork.sxyt.d.ts.map +0 -1
  193. package/dist/Instance/runTrackedWork.sxyt.js +0 -35
  194. package/dist/_client/cjsHelpers.sxyt.d.ts +0 -2
  195. package/dist/_client/cjsHelpers.sxyt.d.ts.map +0 -1
  196. package/dist/_client/cjsHelpers.sxyt.js +0 -45
  197. package/dist/auth/passwordHashing.sxyt.d.ts +0 -2
  198. package/dist/auth/passwordHashing.sxyt.d.ts.map +0 -1
  199. package/dist/auth/passwordHashing.sxyt.js +0 -46
  200. package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts +0 -2
  201. package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts.map +0 -1
  202. package/dist/auth/ref/checkPasswordResetToken.sxyt.js +0 -40
  203. package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts +0 -2
  204. package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts.map +0 -1
  205. package/dist/auth/ref/createPasswordResetToken.sxyt.js +0 -10
  206. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts +0 -2
  207. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts.map +0 -1
  208. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.js +0 -108
  209. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts +0 -2
  210. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts.map +0 -1
  211. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.js +0 -104
  212. package/dist/bin/commands/compile.sxyt.d.ts +0 -2
  213. package/dist/bin/commands/compile.sxyt.d.ts.map +0 -1
  214. package/dist/bin/commands/compile.sxyt.js +0 -255
  215. package/dist/build/modifySassImports.sxyt.d.ts +0 -2
  216. package/dist/build/modifySassImports.sxyt.d.ts.map +0 -1
  217. package/dist/build/modifySassImports.sxyt.js +0 -55
  218. package/dist/build/sassImportParser.sxyt.d.ts +0 -2
  219. package/dist/build/sassImportParser.sxyt.d.ts.map +0 -1
  220. package/dist/build/sassImportParser.sxyt.js +0 -110
  221. package/dist/build/scssImportParserChatgpt.sxyt.d.ts +0 -2
  222. package/dist/build/scssImportParserChatgpt.sxyt.d.ts.map +0 -1
  223. package/dist/build/scssImportParserChatgpt.sxyt.js +0 -120
  224. package/dist/clone.sxyt.d.ts +0 -2
  225. package/dist/clone.sxyt.d.ts.map +0 -1
  226. package/dist/clone.sxyt.js +0 -24
  227. package/dist/componentProxyHandlers.sxyt.d.ts +0 -2
  228. package/dist/componentProxyHandlers.sxyt.d.ts.map +0 -1
  229. package/dist/componentProxyHandlers.sxyt.js +0 -130
  230. package/dist/components/RawHtml.sxyt.d.ts +0 -2
  231. package/dist/components/RawHtml.sxyt.d.ts.map +0 -1
  232. package/dist/components/RawHtml.sxyt.js +0 -104
  233. package/dist/components/bindable/BindableSelect.sxyt.d.ts +0 -2
  234. package/dist/components/bindable/BindableSelect.sxyt.d.ts.map +0 -1
  235. package/dist/components/bindable/BindableSelect.sxyt.js +0 -186
  236. package/dist/dev/liveReloadHub.d.ts +0 -6
  237. package/dist/dev/liveReloadHub.d.ts.map +0 -1
  238. package/dist/env/injectEnv.sxyt.d.ts +0 -2
  239. package/dist/env/injectEnv.sxyt.d.ts.map +0 -1
  240. package/dist/env/injectEnv.sxyt.js +0 -20
  241. package/dist/env/parseEnv.sxyt.d.ts +0 -2
  242. package/dist/env/parseEnv.sxyt.d.ts.map +0 -1
  243. package/dist/env/parseEnv.sxyt.js +0 -11
  244. package/dist/findProjectDir.sxyt.d.ts +0 -2
  245. package/dist/findProjectDir.sxyt.d.ts.map +0 -1
  246. package/dist/findProjectDir.sxyt.js +0 -82
  247. package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts +0 -2
  248. package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts.map +0 -1
  249. package/dist/hydrate/reconcileHydratedAttributes.sxyt.js +0 -173
  250. package/dist/innerHtmlFromProps.sxyt.d.ts +0 -2
  251. package/dist/innerHtmlFromProps.sxyt.d.ts.map +0 -1
  252. package/dist/innerHtmlFromProps.sxyt.js +0 -99
  253. package/dist/postcssPlugins/parseSelectors.sxyt.d.ts +0 -2
  254. package/dist/postcssPlugins/parseSelectors.sxyt.d.ts.map +0 -1
  255. package/dist/postcssPlugins/parseSelectors.sxyt.js +0 -62
  256. package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts +0 -2
  257. package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts.map +0 -1
  258. package/dist/postcssPlugins/parseSelectorsRich.sxyt.js +0 -155
  259. package/dist/rawHtml/parseHtml.sxyt.d.ts +0 -2
  260. package/dist/rawHtml/parseHtml.sxyt.d.ts.map +0 -1
  261. package/dist/rawHtml/parseHtml.sxyt.js +0 -239
  262. package/dist/render/getFunctionBodyAsString.sxyt.d.ts +0 -2
  263. package/dist/render/getFunctionBodyAsString.sxyt.d.ts.map +0 -1
  264. package/dist/render/getFunctionBodyAsString.sxyt.js +0 -37
  265. package/dist/render/processProps.sxyt.d.ts +0 -2
  266. package/dist/render/processProps.sxyt.d.ts.map +0 -1
  267. package/dist/render/processProps.sxyt.js +0 -90
  268. package/dist/routing/compareRequestToRegex.sxyt.d.ts +0 -2
  269. package/dist/routing/compareRequestToRegex.sxyt.d.ts.map +0 -1
  270. package/dist/routing/compareRequestToRegex.sxyt.js +0 -65
  271. package/dist/routing/getPathPriority.sxyt.d.ts +0 -2
  272. package/dist/routing/getPathPriority.sxyt.d.ts.map +0 -1
  273. package/dist/routing/getPathPriority.sxyt.js +0 -24
  274. package/dist/routing/matchPath.sxyt.d.ts +0 -2
  275. package/dist/routing/matchPath.sxyt.d.ts.map +0 -1
  276. package/dist/routing/matchPath.sxyt.js +0 -41
  277. package/dist/routing/patternToRegex.sxyt.d.ts +0 -2
  278. package/dist/routing/patternToRegex.sxyt.d.ts.map +0 -1
  279. package/dist/routing/patternToRegex.sxyt.js +0 -69
  280. package/dist/routing/splitRequest.sxyt.d.ts +0 -2
  281. package/dist/routing/splitRequest.sxyt.d.ts.map +0 -1
  282. package/dist/routing/splitRequest.sxyt.js +0 -47
  283. package/dist/style/jssToCss.sxyt.d.ts +0 -2
  284. package/dist/style/jssToCss.sxyt.d.ts.map +0 -1
  285. package/dist/style/jssToCss.sxyt.js +0 -17
  286. package/dist/testing/createTestApp.sxyt.d.ts +0 -2
  287. package/dist/testing/createTestApp.sxyt.d.ts.map +0 -1
  288. package/dist/testing/createTestApp.sxyt.js +0 -470
  289. package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts +0 -2
  290. package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts.map +0 -1
  291. package/dist/testing/ensureTestEnvLoaded.sxyt.js +0 -20
@@ -1,11 +1,9 @@
1
- // import type { AddressInfo } from 'net'
2
- // //import express from 'express'
3
- // import { Hono } from 'hono'
4
- // import { serve } from '@hono/node-server'
5
- // import { Server } from 'http'
1
+ // Status/known gaps: see ./README.md
2
+ // import { Context, Hono } from 'hono'
3
+ // import { serve, type ServerType } from '@hono/node-server'
4
+ // import { serveStatic } from '@hono/node-server/serve-static'
6
5
  // import { join } from 'path'
7
6
  // import { existsSync } from 'fs'
8
- // //import { SxyServer } from './SxyServer.js'
9
7
  // import type { FrameworkConfigComplete } from '../../FrameworkConfig.js'
10
8
  // import type { CompilationInfo } from '../../build/CompilationInfo.js'
11
9
  // import type { ApiRoutes } from '../../api/ApiRoutes.js'
@@ -17,7 +15,6 @@
17
15
  // import { Framework } from '../../Framework.js'
18
16
  // import { TungstenError } from '../../TungstenError.js'
19
17
  // import { makeInstanceConfigFromFrameworkConfig } from '../../makeInstanceConfigFromFrameworkConfig.js'
20
- // //import { addRequireResolveHooks } from '../reRouting/addRequireResolveHooks.js'
21
18
  // import { standardizeWebPath } from '../../standardizeWebPath.js'
22
19
  // import { throwError } from '../../throwError.js'
23
20
  // import { AnyComponentType } from '../../AnyComponentType.js'
@@ -27,11 +24,8 @@
27
24
  // import { globalDataFunc } from '../../routing/registerGlobalData.js'
28
25
  // import { ServerDataLoading } from '../../Store/ServerDataLoading.js'
29
26
  // import { ServerMiddleware } from '../ServerMiddleware.js'
30
- // import { TungstenServer } from '../TungstenServer.jsx'
31
27
  // import { portError } from '../portError.js'
32
28
  // import { initStores } from '../initStores.js'
33
- // import { RoutingRedirect } from '../../routing/RoutingRedirect.js'
34
- // import { RedirectComponent } from 'tungsten/components/RedirectComponent.js'
35
29
  // import { TungstenServerHono } from './TungstenServerHono.jsx'
36
30
  export {};
37
31
  // function debug(...texts: any[]) { // eslint-disable-line @typescript-eslint/no-unused-vars
@@ -43,15 +37,11 @@ export {};
43
37
  // compilationInfo: CompilationInfo
44
38
  // appRoutes: AppRoutes
45
39
  // RootComponentOrNull: AnyComponentType | null
46
- // // projectDir: string
47
- // // prodBuildLocation: string
48
- // // bundleLocation: string
49
- // //port: number
50
40
  // location: string | null = null
51
- // app: express.Application
41
+ // app: Hono
52
42
  // apiRoutesPromise?: Promise<ApiRoutes>
53
43
  // apiRoutes?: ApiRoutes
54
- // server?: Server
44
+ // server?: ServerType
55
45
  // constructor(
56
46
  // framework: Framework,
57
47
  // config: FrameworkConfigComplete,
@@ -66,40 +56,29 @@ export {};
66
56
  // this.compilationInfo = compilationInfo
67
57
  // this.appRoutes = appRoutes
68
58
  // this.RootComponentOrNull = RootComponentOrNull
69
- // // if (tungstenPrivateEnv.TUNGSTEN_SERVER_PORT === -999) {
70
- // // throwError('ProdServer', 'TUNGSTEN_SERVER_PORT environment variable has not been set')
71
- // // }
72
- // // !! I wrote this line while drunk. Please check this over. I think its wrong
73
- // //const _port = Number((typeof tungstenPrivateEnv !== 'undefined')
74
- // // ? tungstenPrivateEnv.TUNGSTEN_SERVER_PORT
75
- // // : process.env.TUNGSTEN_SERVER_PORT)
76
- // // seems like all we need is:
77
- // this.app = express()
59
+ // this.app = new Hono()
78
60
  // if (tungstenPrivateEnv.DEBUG === true) {
79
61
  // let reqId = 0
80
- // this.app.use((req, res, next) => {
62
+ // this.app.use(async (c, next) => {
81
63
  // reqId++
82
- // cliDebug(`Received request [${reqId}] for ${req.url}`)
83
- // next()
64
+ // cliDebug(`Received request [${reqId}] for ${c.req.url}`)
65
+ // await next()
84
66
  // })
85
67
  // }
86
68
  // const requestLog = (tungstenPrivateEnv.DEBUG === true)
87
69
  // const originMismatchWarning = (this.config.suppressOriginMismatchWarning !== true)
88
70
  // if (requestLog || originMismatchWarning) {
89
- // this.app.use((req, res, next) => {
90
- // const target = req.protocol + '://' + String(req.header('host')) + req.url
91
- // const origin = req.header('origin')
92
- // // request log
71
+ // this.app.use(async (c, next) => {
72
+ // const urlObj = new URL(c.req.url)
73
+ // const target = urlObj.origin + c.req.url
74
+ // const origin = c.req.header('origin')
93
75
  // if (requestLog) {
94
76
  // let message = 'Received request at ' + target
95
77
  // if (origin !== undefined) {
96
- // message += ' from ' + String(req.header('origin'))
97
- // // should we use referrer as a backup option?
98
- // // not sure what that is
78
+ // message += ' from ' + String(c.req.header('origin'))
99
79
  // }
100
80
  // cliOut(message)
101
81
  // }
102
- // // origin-target mismatch warning
103
82
  // if (originMismatchWarning) {
104
83
  // if (origin !== undefined && origin === this.location && origin !== target) {
105
84
  // cliWarn(
@@ -110,131 +89,70 @@ export {};
110
89
  // )
111
90
  // }
112
91
  // }
113
- // next()
92
+ // await next()
114
93
  // })
115
94
  // }
95
+ // // serverMiddleware isn't ported to Hono yet - it's a list of Express RequestHandlers,
96
+ // // which Hono's middleware signature can't run directly.
116
97
  // if (serverMiddleware) {
117
- // const { path, middlewares } = serverMiddleware
118
- // this.app.use(path, middlewares)
98
+ // cliWarn('ProdServerHono: serverMiddleware is not yet supported on the Hono server')
119
99
  // }
120
- // //this.app.set('etag', false)
121
100
  // if (this.compilationInfo.bundleLocation === undefined) {
122
- // throwError('ProdServer', 'compilationInfo.bundleLocation is unset/undefined')
101
+ // throwError('ProdServerHono', 'compilationInfo.bundleLocation is unset/undefined')
123
102
  // }
124
- // this.app.use('/bundle', express.static(this.compilationInfo.bundleLocation))
103
+ // this.app.use('/bundle/*', serveStatic({ root: this.compilationInfo.bundleLocation }))
125
104
  // const publicLocation = join(this.compilationInfo.location, publicFolder)
126
- // //console.log('publicLocation', publicLocation, existsSync(publicLocation))
127
- // if (existsSync(publicLocation)) this.app.use(express.static(publicLocation)) // files from public folder
128
- // //console.log("serving static files with etag")
129
- // this.app.use(express.static(join(this.compilationInfo.location, staticFolder)))
105
+ // if (existsSync(publicLocation)) this.app.use(serveStatic({ root: publicLocation })) // files from public folder
106
+ // this.app.use(serveStatic({ root: join(this.compilationInfo.location, staticFolder) }))
130
107
  // if (this.config.assetsDir !== undefined) {
131
- // this.app.use('/assets', express.static(join(this.compilationInfo.location, assetsFolder)))
108
+ // this.app.use('/assets/*', serveStatic({ root: join(this.compilationInfo.location, assetsFolder) }))
132
109
  // }
133
- // this.app.use(express.static(this.compilationInfo.location))
110
+ // this.app.use(serveStatic({ root: this.compilationInfo.location }))
134
111
  // if (typeof config.apiRoutes === 'string' && config.apiRoutes !== '') {
135
112
  // const apiPath = standardizeWebPath(this.config.apiPath)
136
113
  // cliOut(`API listening at ${apiPath}`)
137
- // this.app.use(apiPath, express.json())
138
114
  // this.app.use(apiPath, this.handleRequestApi)
139
115
  // }
140
116
  // this.app.use(this.handleRequest)
141
117
  // }
142
- // // private addServerMiddleware = (serverMiddleware: ServerMiddlewareInfo): void => {
143
- // // const [middlewareFile, middlewareExportName, middlewarePath] = serverMiddleware
144
- // // const fullFilePath = 'file://' + join(this.compilationInfo.codeLocation, middlewareFile)
145
- // // const middlewareModule = await import(fullFilePath)
146
- // // if ( ! (middlewareExportName in middlewareModule) ) {
147
- // // throwError('DevServer', `export ${middlewareExportName} not found in ${middlewareFile} when trying to load server middleware`)
148
- // // }
149
- // // const middleware = middlewareModule[middlewareExportName] as RequestHandler[]
150
- // // console.log('prod middleware', middleware)
151
- // // const path = middlewarePath.startsWith('/') ? middlewarePath : '/' + middlewarePath
152
- // // console.log('path', `|${path}|`)
153
- // // console.log('this.app', this.app)
154
- // // this.app.use('/api', (req, res, next) => {
155
- // // console.log('request to api 1')
156
- // // next()
157
- // // })
158
- // // this.app.use(path, (req, res, next) => {
159
- // // console.log('request to api')
160
- // // next()
161
- // // })
162
- // // this.app.use(path, middleware)
163
- // // cliOut(`Server Middleware added to server at ${path}`)
164
- // // }
165
- // private handleRequestApi = async (
166
- // req: express.Request, res: express.Response, next: express.NextFunction
167
- // ): Promise<void> => {
118
+ // private handleRequestApi = async (c: Context): Promise<Response> => { // eslint-disable-line @typescript-eslint/no-unused-vars
168
119
  // //this.apiRoutes = await this.apiRoutesPromise
169
120
  // throw new TungstenError(`handleRequestApi incomplete in dev server - add to get the API in the build step`)
170
- // // const requestPath = standardizeWebPath(req.baseUrl + req.path)
171
- // // for (const [path, route] of Object.entries(this.apiRoutes)) {
172
- // // //console.log(path, 'vs', requestPath)
173
- // // //console.log('path', path, standardizeWebPath(path))
174
- // // if (standardizeWebPath(path) === requestPath) {
175
- // // //console.log('API route matched', path)
176
- // // return route.endpoint(req, res)
177
- // // }
178
- // // }
179
- // // // else
180
- // // res.sendStatus(404)
181
121
  // }
182
- // handleRequest = async (req: express.Request, res: express.Response): Promise<void> => {
183
- // if (/\.(css|scss|sass|js|jsx|png|jpg|jpeg|svg|ico|txt)$/.test(req.url)) {
122
+ // handleRequest = async (c: Context): Promise<Response> => {
123
+ // const { req } = c
124
+ // if (/\.(css|scss|sass|js|jsx|png|jpg|jpeg|svg|ico|txt)$/.test(req.path)) {
184
125
  // cliLog(`Requested asset file ${req.url} was not found`)
185
- // res.status(404).end()
186
- // return
126
+ // return c.notFound()
187
127
  // }
188
128
  // try {
189
129
  // const location = req.url
190
130
  // const instanceConfig = makeInstanceConfigFromFrameworkConfig(this.config)
191
131
  // if (this.framework.frameworkModules === undefined) {
192
- // throwError('ProdServer.handleRequest()',
132
+ // throwError('ProdServerHono.handleRequest()',
193
133
  // 'framework.frameworkModules is undefined'
194
134
  // )
195
135
  // }
196
136
  // if (this.framework.clientImportAliases === undefined) {
197
- // throwError('ProdServer.handleRequest()',
137
+ // throwError('ProdServerHono.handleRequest()',
198
138
  // 'framework.clientImportAliases is undefined'
199
139
  // )
200
140
  // }
201
- // // const appRoutes: AppRoutes = await getRoutes(this.compilationInfo, this.config)
202
- // // let RootComponentClass: AnyComponentType
203
- // // if (this.config.useRootComponent) {
204
- // // const rootComponentFileFull = join(this.compilationInfo.location, this.config.rootComponent)
205
- // // RootComponentClass = await getComponent(rootComponentFileFull, this.config.rootComponent)
206
- // // } else {
207
- // // throwError('DevServer', 'useRootComponent = false not implemented yet')
208
- // // }
209
141
  // const { compilationInfo, config, appRoutes, RootComponentOrNull } = this
210
- // const reqRes: ReqRes = { req, res }
211
- // //const routes = instance.getRoutes()
142
+ // // ReqRes is Express-shaped ({req, res}) and Hono's Context isn't - this cast is a
143
+ // // type-only bridge so the (Express-only) Instance/initStores/routing plumbing below
144
+ // // still compiles. Not behaviorally correct; fine since this prod server isn't wired
145
+ // // up anywhere live.
146
+ // // eslint-disable-next-line no-type-assertion/no-type-assertion -- see comment above
147
+ // const reqRes = c as unknown as ReqRes
212
148
  // const serverDataLoading: ServerDataLoading = { value: false }
213
149
  // const routes = (typeof appRoutes === 'function') ? appRoutes(reqRes) : appRoutes
214
150
  // const [globalData, matchedRouteInfo] = await Promise.all([
215
151
  // (globalDataFunc.value !== undefined) ? globalDataFunc.value(reqRes) : {},
216
152
  // routing(location, routes, serverDataLoading)
217
153
  // ])
218
- // //instance.matchedRouteInfo =
219
- // //cliTodo('Can we move redirect handling to base class?')
220
- // // // 2025-03-14 copied this code here from Dev server,
221
- // // // because it looked like it was missing
222
- // // if (matchedRouteInfo.data instanceof RoutingRedirect) {
223
- // // const redirect = matchedRouteInfo.data
224
- // // res.redirect(redirect.code, redirect.to)
225
- // // return
226
- // // }
227
- // // // handle redirect components
228
- // // if (
229
- // // matchedRouteInfo.content instanceof RedirectComponent
230
- // // //&& matchedRouteInfo.content.__tungstenComponentType === 'redirect'
231
- // // ) {
232
- // // const { code = 302, to } = matchedRouteInfo.content.props
233
- // // res.redirect(code, to)
234
- // // return
235
- // // }
236
- // const redirected = this.handleRedirects(res, matchedRouteInfo)
237
- // if (redirected) return // end early
154
+ // const redirected = this.handleRedirects(c, matchedRouteInfo)
155
+ // if (redirected !== false) return redirected // end early
238
156
  // const { internalStore, stores, storeSubscriptions }
239
157
  // = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading)
240
158
  // const instance = new Instance(
@@ -252,22 +170,16 @@ export {};
252
170
  // let { content } = matchedRouteInfo
253
171
  // if (typeof content === 'function') {
254
172
  // content = content(data, params, {} /* props */, globalData, location)
255
- // //throwError('DevServer', 'route content is a function')
256
173
  // }
257
174
  // html = await renderContentToHtml(
258
175
  // this.compilationInfo, this.framework.clientImportAliases,
259
176
  // content, instance, config, this.config.siteBasePath
260
177
  // )
261
178
  // }
262
- // //debug('html', html)
263
- // res.setHeader('Content-Type', 'text/html')
264
- // res.status((instance.matchedRouteInfo.key === '404') ? 404 : 200)
265
- // res.send(html)
179
+ // return c.html(html, (instance.matchedRouteInfo.key === '404') ? 404 : 200)
266
180
  // } catch(e) {
267
181
  // cliLog('handleRequest() error', e)
268
- // res.setHeader('Content-Type', 'text/html')
269
- // res.status(500)
270
- // res.send(this.errorPage())
182
+ // return c.html(this.errorPage(), 500)
271
183
  // }
272
184
  // }
273
185
  // errorPage = () => {
@@ -280,27 +192,23 @@ export {};
280
192
  // </body>
281
193
  // </html>`
282
194
  // }
283
- // // private async handlePost(req: express.Request, res: express.Response): Promise<void> {
284
- // // throw new TungstenError(`Err - Dev server received a post request. Not supported yet.`)
285
- // // }
286
195
  // // I don't think we ever override the port, not sure why
287
196
  // start(portOverride?: number | null, mute = false): Promise<string> {
288
197
  // return new Promise( (resolve) => {
289
- // const proto = tungstenPrivateEnv.FRONTEND_PROTO ?? 'http'
290
- // const host = tungstenPrivateEnv.FRONTEND_HOST ?? 'localhost'
198
+ // const proto = tungstenPublicEnv.FRONTEND_PROTO ?? 'http'
199
+ // const host = tungstenPublicEnv.FRONTEND_HOST ?? 'localhost'
291
200
  // let port: number | null
292
201
  // if (portOverride !== undefined) {
293
202
  // port = portOverride
294
203
  // } else {
295
204
  // const _port = tungstenPrivateEnv.TUNGSTEN_SERVER_PORT ?? 3000
296
- // if (isNaN(_port) || _port === 0) throwError('ProdServer', portError(_port))
205
+ // if (isNaN(_port) || _port === 0) throwError('ProdServerHono', portError(_port))
297
206
  // port = _port
298
207
  // }
299
- // //const port = (portOverride !== undefined) ? portOverride : port
300
- // // eslint-disable-next-line no-console
301
- // this.server = this.app.listen(port, () => {
302
- // const serverAddress = this.server!.address() as AddressInfo // eslint-disable-line @typescript-eslint/no-non-null-assertion, no-type-assertion/no-type-assertion
303
- // this.location = `${proto}://${host}:${serverAddress.port}`
208
+ // if (port === null) throwError('ProdServerHono', portError(NaN))
209
+ // if (isNaN(port) || port === 0) throwError('ProdServerHono', portError(port))
210
+ // this.server = serve({ fetch: this.app.fetch, port }, info => {
211
+ // this.location = `${proto}://${host}:${info.port}`
304
212
  // if (!mute) cliNews(`${packageNameCapitalized} prod server ready at ${this.location}`)
305
213
  // resolve(this.location)
306
214
  // })
@@ -309,5 +217,4 @@ export {};
309
217
  // stop() {
310
218
  // if (this.server !== undefined) this.server.close()
311
219
  // }
312
- // //treeToHtml = treeToHtml
313
220
  // }
@@ -1,6 +1,6 @@
1
1
  import type { MatchedRouteInfo } from '../MatchedRouteInfo.js';
2
2
  import { Context } from 'hono';
3
3
  export declare class TungstenServerHono {
4
- protected handleRedirects(c: Context, matchedRouteInfo: MatchedRouteInfo): boolean;
4
+ protected handleRedirects(c: Context, matchedRouteInfo: MatchedRouteInfo): Response | false;
5
5
  }
6
6
  //# sourceMappingURL=TungstenServerHono.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TungstenServerHono.d.ts","sourceRoot":"","sources":["../../../src/Servers/hono/TungstenServerHono.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAG9D,OAAO,EAAQ,OAAO,EAAE,MAAM,MAAM,CAAA;AAuBpC,qBAAa,kBAAkB;IAC3B,SAAS,CAAC,eAAe,CAAC,CAAC,EAAE,OAAO,EAAY,gBAAgB,EAAE,gBAAgB,GAAG,OAAO;CA6C/F"}
1
+ {"version":3,"file":"TungstenServerHono.d.ts","sourceRoot":"","sources":["../../../src/Servers/hono/TungstenServerHono.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAU9B,qBAAa,kBAAkB;IAI3B,SAAS,CAAC,eAAe,CAAC,CAAC,EAAE,OAAO,EAAY,gBAAgB,EAAE,gBAAgB,GAAG,QAAQ,GAAG,KAAK;CAoCxG"}
@@ -1,51 +1,34 @@
1
- //import type { Response as ExpressResponse } from 'express'
2
- import { Hono } from 'hono';
3
1
  import { ContentNodeIsClassComponent } from "../../ContentNode.js";
4
2
  import { RoutingRedirect } from "../../routing/RoutingRedirect.js";
5
3
  import { cliTodo } from "../../cliOutput.js";
6
4
  import { RouteRedirectComponent } from "../../components/RouteRedirectComponent.js";
5
+ import { WebRedirectComponent } from "../../components/WebRedirectComponent.js";
7
6
  import { $props, $type } from "../../contentNodeSymbols.js";
8
7
  import { WebRedirect } from "../../routing/WebRedirect.js";
9
- import { throwError } from "../../throwError.js";
10
- const app = new Hono();
11
- app.get(async c => {
12
- const id = c.req.param('id');
13
- c.res;
14
- // ...
15
- });
16
- function debug(...texts) {
17
- // console.log(...texts)
18
- }
19
8
  export class TungstenServerHono {
9
+ // Hono's c.redirect() builds a Response but doesn't send it - unlike Express's res.redirect()
10
+ // (which sends immediately), the caller here must return the Response itself for Hono to
11
+ // actually deliver it. Returns false when there's no redirect to make.
20
12
  handleRedirects(c /* any */, matchedRouteInfo) {
21
13
  // handle any redirect issued during routing
22
14
  if (matchedRouteInfo.data instanceof RoutingRedirect) {
23
15
  const redirect = matchedRouteInfo.data;
24
- c.redirect(redirect.to, redirect.code);
25
- return true;
16
+ return c.redirect(redirect.to, redirect.code);
26
17
  } else if (matchedRouteInfo.data instanceof WebRedirect) {
27
18
  const redirect = matchedRouteInfo.data;
28
- c.redirect(redirect.to, redirect.code);
29
- return true;
19
+ return c.redirect(redirect.to, redirect.code);
30
20
  }
31
- // console.log('content', matchedRouteInfo.content)
32
- // console.log('is func', typeof matchedRouteInfo.content !== 'function')
33
- // console.log('ContentNodeIsClassComponent', ContentNodeIsClassComponent(matchedRouteInfo.content as any))
34
- // console.log('instanceof', (matchedRouteInfo as any).content[$type] instanceof RedirectComponent)
35
- // console.log('prototype instanceof', (matchedRouteInfo as any).content[$type].prototype instanceof RedirectComponent)
36
- // console.log('__tungstenRedirect', (matchedRouteInfo as any).content[$type].__tungstenRedirect)
37
- // console.log('$type', (matchedRouteInfo as any).content[$type])
38
- //console.log('content[$type]', matchedRouteInfo.content[$type])
39
- //console.log('instanceof', matchedRouteInfo.content instanceof RedirectComponent)
40
21
  if (typeof matchedRouteInfo.content !== 'function' && ContentNodeIsClassComponent(matchedRouteInfo.content)) {
41
22
  if (matchedRouteInfo.content[$type] === RouteRedirectComponent || matchedRouteInfo.content[$type].prototype instanceof RouteRedirectComponent) {
42
23
  cliTodo('consider type of RedirectComponent props');
43
24
  const code = matchedRouteInfo.content[$props].code || 302;
44
25
  const to = matchedRouteInfo.content[$props].to;
45
- c.redirect(to, code);
46
- return true;
47
- } else {
48
- throwError('TungstenServerHono', 'Need to check for WebRedirectComponent here');
26
+ return c.redirect(to, code);
27
+ } else if (matchedRouteInfo.content[$type] === WebRedirectComponent || matchedRouteInfo.content[$type].prototype instanceof WebRedirectComponent) {
28
+ cliTodo('consider type of RedirectComponent props');
29
+ const code = matchedRouteInfo.content[$props].code || 302;
30
+ const to = matchedRouteInfo.content[$props].to;
31
+ return c.redirect(to, code);
49
32
  }
50
33
  }
51
34
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/Servers/routing.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAGjE,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":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAIjE,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAE,iBAAiB,GAAG,IAAW,GAC5G,OAAO,CAAC,gBAAgB,CAAC,CA+D9B"}
@@ -1,5 +1,6 @@
1
1
  import { Default404 } from "../routing/Default404.js";
2
2
  import { matchPath } from "../routing/matchPath.js";
3
+ import { makeTungstenErrorInfo } from "../routing/TungstenErrorInfo.js";
3
4
  import { jsx as _jsx } from "tungsten/jsxRuntime.js";
4
5
  export async function routing(location, routes, serverDataLoading = null) {
5
6
  let defaultRoute, _404Route, errorRoute;
@@ -25,7 +26,7 @@ export async function routing(location, routes, serverDataLoading = null) {
25
26
  if (match !== null) {
26
27
  const params = match.params;
27
28
  let data = undefined;
28
- if (route.data) {
29
+ if ('data' in route) {
29
30
  if (serverDataLoading) serverDataLoading.value = true;
30
31
  data = await route.data(params, location, match.query);
31
32
  if (serverDataLoading) serverDataLoading.value = false;
@@ -50,11 +51,14 @@ export async function routing(location, routes, serverDataLoading = null) {
50
51
  params: {},
51
52
  content: _404Route.content
52
53
  };
53
- if (errorRoute) return {
54
- key: 'error',
55
- params: {},
56
- content: errorRoute.content
57
- };
54
+ if (errorRoute) {
55
+ return {
56
+ key: 'error',
57
+ params: {},
58
+ content: errorRoute.content,
59
+ data: makeTungstenErrorInfo(new Error(`No route matched '${location}'`))
60
+ };
61
+ }
58
62
  return {
59
63
  key: null,
60
64
  params: {},
@@ -1,9 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const tungstenCorePrivateEnvSchema: z.ZodObject<{
3
3
  TUNGSTEN_SERVER_PORT: z.ZodOptional<z.ZodNumber>;
4
- FRONTEND_PROTO: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"https">]>>;
5
- FRONTEND_HOST: z.ZodOptional<z.ZodString>;
6
- FRONTEND_PORT: z.ZodOptional<z.ZodNumber>;
7
4
  DEBUG: z.ZodOptional<z.ZodBoolean>;
8
5
  }, z.core.$loose>;
9
6
  export type TungstenCorePrivateEnv = typeof tungstenCorePrivateEnvSchema._output;
@@ -1 +1 @@
1
- {"version":3,"file":"tungstenCorePrivateEnvSchema.d.ts","sourceRoot":"","sources":["../../src/Servers/tungstenCorePrivateEnvSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAkBvB,eAAO,MAAM,4BAA4B;;;;;;iBASvC,CAAA;AAGF,MAAM,MAAM,sBAAsB,GAAG,OAAO,4BAA4B,CAAC,OAAO,CAAA"}
1
+ {"version":3,"file":"tungstenCorePrivateEnvSchema.d.ts","sourceRoot":"","sources":["../../src/Servers/tungstenCorePrivateEnvSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAkBvB,eAAO,MAAM,4BAA4B;;;iBASvC,CAAA;AAGF,MAAM,MAAM,sBAAsB,GAAG,OAAO,4BAA4B,CAAC,OAAO,CAAA"}
@@ -14,9 +14,9 @@ const protoSchema = z.union([z.literal('http'), z.literal('https')]);
14
14
  const portSchema = z.number().gt(0);
15
15
  export const tungstenCorePrivateEnvSchema = z.looseObject({
16
16
  TUNGSTEN_SERVER_PORT: z.optional(portSchema),
17
- FRONTEND_PROTO: z.optional(protoSchema),
18
- FRONTEND_HOST: z.optional(z.string()),
19
- FRONTEND_PORT: z.optional(portSchema),
17
+ // FRONTEND_PROTO: z.optional(protoSchema),
18
+ // FRONTEND_HOST: z.optional(z.string()),
19
+ // FRONTEND_PORT: z.optional(portSchema),
20
20
  DEBUG: z.optional(z.boolean())
21
21
  // SUPPRESS: z.optional(z.object({
22
22
  // ORIGIN_MISMATCH_WARNING: z.optional(z.boolean())
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export declare const tungstenCorePublicEnvSchema: z.ZodObject<{
3
+ FRONTEND_PROTO: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"https">]>>;
4
+ FRONTEND_HOST: z.ZodOptional<z.ZodString>;
5
+ FRONTEND_PORT: z.ZodOptional<z.ZodNumber>;
6
+ }, z.core.$loose>;
7
+ export type TungstenCorePublicEnv = typeof tungstenCorePublicEnvSchema._output;
8
+ //# sourceMappingURL=tungstenCorePublicEnvSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tungstenCorePublicEnvSchema.d.ts","sourceRoot":"","sources":["../../src/Servers/tungstenCorePublicEnvSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAWvB,eAAO,MAAM,2BAA2B;;;;iBAItC,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,2BAA2B,CAAC,OAAO,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ // FRONTEND_PROTO/FRONTEND_HOST/FRONTEND_PORT are tungsten's own fields (used to
3
+ // report the dev/prod server's own location - see DevServer.ts/ProdServer.ts).
4
+ // Optional here because most apps keep them in the private env instead - see
5
+ // tungstenCorePrivateEnvSchema.ts, which declares the same three fields. An
6
+ // app is free to declare either or both; the servers check private first,
7
+ // then public.
8
+ const protoSchema = z.union([z.literal('http'), z.literal('https')]);
9
+ const portSchema = z.number().gt(0);
10
+ export const tungstenCorePublicEnvSchema = z.looseObject({
11
+ FRONTEND_PROTO: z.optional(protoSchema),
12
+ FRONTEND_HOST: z.optional(z.string()),
13
+ FRONTEND_PORT: z.optional(portSchema)
14
+ });
@@ -1,7 +1,9 @@
1
1
  import type { MatchedRouteInfo } from '../Servers/MatchedRouteInfo.js';
2
+ import type { PopMessage } from '../PopMessage.type.js';
2
3
  export declare class InternalStoreSchema {
3
4
  location: string;
4
5
  matchedRouteInfo: MatchedRouteInfo;
6
+ popMessages: PopMessage[];
5
7
  constructor(location: string, matchedRouteInfo: MatchedRouteInfo);
6
8
  }
7
9
  //# sourceMappingURL=InternalStoreSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InternalStoreSchema.d.ts","sourceRoot":"","sources":["../../src/Store/InternalStoreSchema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAEtE,qBAAa,mBAAmB;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,gBAAgB,EAAE,gBAAgB,CAAA;gBACtB,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB;CAInE"}
1
+ {"version":3,"file":"InternalStoreSchema.d.ts","sourceRoot":"","sources":["../../src/Store/InternalStoreSchema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,qBAAa,mBAAmB;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,WAAW,EAAE,UAAU,EAAE,CAAK;gBAClB,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB;CAInE"}
@@ -5,6 +5,7 @@ export class InternalStoreSchema {
5
5
  constructor(location, matchedRouteInfo) {
6
6
  _defineProperty(this, "location", void 0);
7
7
  _defineProperty(this, "matchedRouteInfo", void 0);
8
+ _defineProperty(this, "popMessages", []);
8
9
  this.location = location;
9
10
  this.matchedRouteInfo = matchedRouteInfo;
10
11
  }
@@ -1,2 +1,2 @@
1
- export { Request } from 'express';
1
+ export type { Request } from 'express';
2
2
  //# sourceMappingURL=Request.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/api/Request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/api/Request.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA"}
@@ -1,2 +1,2 @@
1
- export { Response } from 'express';
1
+ export type { Response } from 'express';
2
2
  //# sourceMappingURL=Response.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Response.d.ts","sourceRoot":"","sources":["../../src/api/Response.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"Response.d.ts","sourceRoot":"","sources":["../../src/api/Response.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getExport.d.ts","sourceRoot":"","sources":["../../src/api/getExport.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAOjC,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,IAAa,GAAG,OAAO,CAAC,GAAG,CAAC,CAuBpG"}
1
+ {"version":3,"file":"getExport.d.ts","sourceRoot":"","sources":["../../src/api/getExport.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAQjC,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,IAAa,GAAG,OAAO,CAAC,GAAG,CAAC,CAuBpG"}
@@ -2,6 +2,7 @@ import { basename } from 'path';
2
2
  import { fixExtension } from "../fixExtension.js";
3
3
  import { TungstenError } from "../TungstenError.js";
4
4
  import { iterationQueryString } from "../iterationQueryString.js";
5
+ import { importDevModuleWithRetry } from "../importDevModuleWithRetry.js";
5
6
  //let load //// !! future improvement
6
7
  let exportIteration = 0;
7
8
  export async function getExport(filePath, relFile, mode = 'prod') {
@@ -12,7 +13,7 @@ export async function getExport(filePath, relFile, mode = 'prod') {
12
13
  if (mode === 'dev') {
13
14
  //if ( ! load ) load = await createLoad(import.meta.url, sxyLoaderConfig) //// !! future improvement
14
15
  //const load = await createLoad(import.meta.url, sxyLoaderConfig)
15
- module = await import(iterationQueryString(filePath, exportIteration++, 'api'));
16
+ module = await importDevModuleWithRetry(iterationQueryString(filePath, exportIteration++, 'api'));
16
17
  } else {
17
18
  module = await import(filePath); // import the module
18
19
  }
@@ -0,0 +1,11 @@
1
+ import type { NodePath, BabelFile } from '@babel/core';
2
+ import type { ImportDeclaration, ExportNamedDeclaration, ExportAllDeclaration } from '@babel/types';
3
+ export declare function MakeBabelAddDevCacheBust(): () => {
4
+ pre(state: BabelFile): void;
5
+ visitor: {
6
+ ImportDeclaration(path: NodePath<ImportDeclaration>): void;
7
+ ExportNamedDeclaration(path: NodePath<ExportNamedDeclaration>): void;
8
+ ExportAllDeclaration(path: NodePath<ExportAllDeclaration>): void;
9
+ };
10
+ };
11
+ //# sourceMappingURL=BabelAddDevCacheBust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BabelAddDevCacheBust.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/BabelAddDevCacheBust.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAuBnG,wBAAgB,wBAAwB;eAIjB,SAAS;;gCAKQ,QAAQ,CAAC,iBAAiB,CAAC;qCAItB,QAAQ,CAAC,sBAAsB,CAAC;mCAIlC,QAAQ,CAAC,oBAAoB,CAAC;;EAOxE"}