tungsten 0.3.2 → 0.3.4
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.
- package/dist/.build-complete +1 -0
- package/dist/Components.d.ts +6 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +103 -40
- package/dist/DomPointer.d.ts +11 -0
- package/dist/DomPointer.d.ts.map +1 -1
- package/dist/DomPointer.js +15 -0
- package/dist/DomRegion.d.ts +2 -0
- package/dist/DomRegion.d.ts.map +1 -1
- package/dist/DomRegion.js +23 -3
- package/dist/Framework.d.ts +2 -0
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js +94 -61
- package/dist/FrameworkConfig.d.ts +4 -0
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/Instance/Instance.d.ts +1 -1
- package/dist/Instance/Instance.d.ts.map +1 -1
- package/dist/Instance/Instance.js +18 -1
- package/dist/Instance/InstanceConfig.d.ts +1 -0
- package/dist/Instance/InstanceConfig.d.ts.map +1 -1
- package/dist/PopMessage.type.d.ts +6 -0
- package/dist/PopMessage.type.d.ts.map +1 -0
- package/dist/PopMessage.type.js +1 -0
- package/dist/Servers/DevServer.d.ts +2 -0
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +87 -11
- package/dist/Servers/MatchedRouteInfo.d.ts +1 -1
- package/dist/Servers/MatchedRouteInfo.d.ts.map +1 -1
- package/dist/Servers/ProdServer.d.ts +2 -1
- package/dist/Servers/ProdServer.d.ts.map +1 -1
- package/dist/Servers/ProdServer.js +92 -8
- package/dist/Servers/hono/DevServerHono.js +25 -29
- package/dist/Servers/hono/ProdServerHono.js +49 -142
- package/dist/Servers/hono/TungstenServerHono.d.ts +1 -1
- package/dist/Servers/hono/TungstenServerHono.d.ts.map +1 -1
- package/dist/Servers/hono/TungstenServerHono.js +12 -29
- package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.js +16 -5
- package/dist/Servers/routing.d.ts.map +1 -1
- package/dist/Servers/routing.js +10 -6
- package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts +0 -3
- package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts.map +1 -1
- package/dist/Servers/tungstenCorePrivateEnvSchema.js +3 -3
- package/dist/Servers/tungstenCorePublicEnvSchema.d.ts +8 -0
- package/dist/Servers/tungstenCorePublicEnvSchema.d.ts.map +1 -0
- package/dist/Servers/tungstenCorePublicEnvSchema.js +14 -0
- package/dist/Store/InternalStoreSchema.d.ts +2 -0
- package/dist/Store/InternalStoreSchema.d.ts.map +1 -1
- package/dist/Store/InternalStoreSchema.js +1 -0
- package/dist/api/Request.d.ts +1 -1
- package/dist/api/Request.d.ts.map +1 -1
- package/dist/api/Response.d.ts +1 -1
- package/dist/api/Response.d.ts.map +1 -1
- package/dist/babelPlugins/BabelExtractComponentStylesheet.d.ts +13 -0
- package/dist/babelPlugins/BabelExtractComponentStylesheet.d.ts.map +1 -0
- package/dist/babelPlugins/BabelExtractComponentStylesheet.js +24 -0
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts +2 -0
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.js +21 -5
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts +1 -0
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.js +21 -9
- package/dist/babelPlugins/BabelTypes.d.ts +2 -2
- package/dist/babelPlugins/BabelTypes.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTypes.js +0 -1
- package/dist/bin/commands/build.d.ts.map +1 -1
- package/dist/bin/commands/build.js +12 -2
- package/dist/bin/commands/compile.d.ts.map +1 -1
- package/dist/bin/commands/compile.js +7 -2
- package/dist/bin/commands/dev.d.ts.map +1 -1
- package/dist/bin/commands/dev.js +15 -4
- package/dist/bin/commands/devmon.d.ts +2 -0
- package/dist/bin/commands/devmon.d.ts.map +1 -0
- package/dist/bin/commands/devmon.js +66 -0
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +6 -0
- package/dist/booleanAttributeValue.d.ts +21 -0
- package/dist/booleanAttributeValue.d.ts.map +1 -0
- package/dist/booleanAttributeValue.js +23 -0
- package/dist/build/CompilationInfo.d.ts +1 -0
- package/dist/build/CompilationInfo.d.ts.map +1 -1
- package/dist/build/combineComponentCss.d.ts +1 -1
- package/dist/build/combineComponentCss.d.ts.map +1 -1
- package/dist/build/combineComponentCss.js +3 -3
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +3 -3
- package/dist/build/compileUserApp.d.ts +2 -1
- package/dist/build/compileUserApp.d.ts.map +1 -1
- package/dist/build/compileUserApp.js +18 -8
- package/dist/build/createInstanceConfigFile.js +1 -1
- package/dist/build/frameworkStylesheets.d.ts +5 -0
- package/dist/build/frameworkStylesheets.d.ts.map +1 -0
- package/dist/build/frameworkStylesheets.js +49 -0
- package/dist/build/getPackageDirForFile.d.ts +2 -0
- package/dist/build/getPackageDirForFile.d.ts.map +1 -0
- package/dist/build/getPackageDirForFile.js +11 -0
- package/dist/build/getSxyClientPackageAliases.d.ts.map +1 -1
- package/dist/build/getSxyClientPackageAliases.js +3 -1
- package/dist/build/makeBabelUserDevConfig.d.ts +1 -1
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserDevConfig.js +3 -2
- package/dist/build/makeBabelUserProdConfig.d.ts +1 -1
- package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserProdConfig.js +4 -2
- package/dist/build/rollup.user.prod.config.d.ts.map +1 -1
- package/dist/build/rollup.user.prod.config.js +4 -1
- package/dist/build/rollupExtractComponentStylesheets.d.ts +12 -0
- package/dist/build/rollupExtractComponentStylesheets.d.ts.map +1 -0
- package/dist/build/rollupExtractComponentStylesheets.js +35 -0
- package/dist/compat/context.d.ts +1 -1
- package/dist/compat/context.d.ts.map +1 -1
- package/dist/compat/types.d.ts +1 -1
- package/dist/compat/types.d.ts.map +1 -1
- package/dist/componentCss/i/T-components-library-RichTextEditor-RichTextEditor.css +115 -0
- package/dist/componentCss/i/T-components-library-__StatefulMessage-StatefulMessage.css +25 -0
- package/dist/componentCss/tungsten.css +2 -0
- package/dist/componentProxyHandlers.d.ts +2 -1
- package/dist/componentProxyHandlers.d.ts.map +1 -1
- package/dist/componentProxyHandlers.js +45 -9
- package/dist/components/GoToComponent.d.ts +1 -1
- package/dist/components/GoToComponent.d.ts.map +1 -1
- package/dist/components/PopMessages.d.ts +12 -0
- package/dist/components/PopMessages.d.ts.map +1 -0
- package/dist/components/PopMessages.js +45 -0
- package/dist/components/_GoToComponent.d.ts +10 -0
- package/dist/components/_GoToComponent.d.ts.map +1 -0
- package/dist/components/_GoToComponent.js +13 -0
- package/dist/components/library/RichTextEditor/RichTextEditor.d.ts +50 -0
- package/dist/components/library/RichTextEditor/RichTextEditor.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/RichTextEditor.js +458 -0
- package/dist/components/library/RichTextEditor/StoredContentNode.d.ts +5 -0
- package/dist/components/library/RichTextEditor/StoredContentNode.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/StoredContentNode.js +1 -0
- package/dist/components/library/RichTextEditor/activeFormats.d.ts +20 -0
- package/dist/components/library/RichTextEditor/activeFormats.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/activeFormats.js +48 -0
- package/dist/components/library/RichTextEditor/contentTree.d.ts +30 -0
- package/dist/components/library/RichTextEditor/contentTree.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/contentTree.js +81 -0
- package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.d.ts +30 -0
- package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.js +97 -0
- package/dist/components/library/__StatefulMessage/MessageData.d.ts +7 -0
- package/dist/components/library/__StatefulMessage/MessageData.d.ts.map +1 -0
- package/dist/components/library/__StatefulMessage/MessageData.js +1 -0
- package/dist/components/library/__StatefulMessage/StatefulMessage.d.ts +22 -0
- package/dist/components/library/__StatefulMessage/StatefulMessage.d.ts.map +1 -0
- package/dist/components/library/__StatefulMessage/StatefulMessage.js +88 -0
- package/dist/components/library/index.d.ts +5 -0
- package/dist/components/library/index.d.ts.map +1 -0
- package/dist/components/library/index.js +7 -0
- package/dist/defaultConfig.d.ts +2 -0
- package/dist/defaultConfig.d.ts.map +1 -1
- package/dist/defaultConfig.js +3 -1
- package/dist/env/Interfaces.d.ts +2 -1
- package/dist/env/Interfaces.d.ts.map +1 -1
- package/dist/env/getEnvSchemas.d.ts +1 -1
- package/dist/env/getEnvSchemas.d.ts.map +1 -1
- package/dist/env/injectEnv.d.ts +1 -1
- package/dist/env/injectEnv.d.ts.map +1 -1
- package/dist/env/injectEnv.js +16 -6
- package/dist/env/publicEnv.d.ts.map +1 -1
- package/dist/env/publicEnv.js +4 -1
- package/dist/findUserConfig.d.ts +1 -1
- package/dist/frameworkConfigSchema.d.ts +4 -0
- package/dist/frameworkConfigSchema.d.ts.map +1 -1
- package/dist/frameworkConfigSchema.js +2 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useInstance.d.ts +3 -0
- package/dist/hooks/useInstance.d.ts.map +1 -0
- package/dist/hooks/useInstance.js +4 -0
- package/dist/hydrate/hydrate.d.ts +6 -4
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +51 -13
- package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
- package/dist/hydrate/reconcileHydratedAttributes.js +4 -3
- package/dist/hydrate/renderHydrationMismatchBanner.d.ts +7 -0
- package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -0
- package/dist/hydrate/renderHydrationMismatchBanner.js +69 -0
- package/dist/indexInner.d.ts +13 -5
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +9 -2
- package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
- package/dist/makeInstanceConfigFromFrameworkConfig.js +2 -1
- package/dist/pop.d.ts +10 -0
- package/dist/pop.d.ts.map +1 -0
- package/dist/pop.js +49 -0
- package/dist/postcssPlugins/TransformCssNames.d.ts.map +1 -1
- package/dist/postcssPlugins/TransformCssNames.js +10 -2
- package/dist/propsAreEqual.d.ts +8 -0
- package/dist/propsAreEqual.d.ts.map +1 -0
- package/dist/propsAreEqual.js +97 -0
- package/dist/rawHtml/filterContentNode.d.ts +20 -0
- package/dist/rawHtml/filterContentNode.d.ts.map +1 -0
- package/dist/rawHtml/filterContentNode.js +96 -0
- package/dist/rawHtml/parseHtml.d.ts +14 -0
- package/dist/rawHtml/parseHtml.d.ts.map +1 -1
- package/dist/rawHtml/parseHtml.js +4 -4
- package/dist/rawHtml/sanitizeHtml.d.ts +17 -0
- package/dist/rawHtml/sanitizeHtml.d.ts.map +1 -0
- package/dist/rawHtml/sanitizeHtml.js +19 -0
- package/dist/render/HeadData.d.ts +2 -0
- package/dist/render/HeadData.d.ts.map +1 -1
- package/dist/render/contentNodeToHtml.d.ts +18 -0
- package/dist/render/contentNodeToHtml.d.ts.map +1 -0
- package/dist/render/contentNodeToHtml.js +66 -0
- package/dist/render/contentToHtml.d.ts.map +1 -1
- package/dist/render/contentToHtml.js +3 -1
- package/dist/render/instantiateClassComponent.d.ts.map +1 -1
- package/dist/render/instantiateClassComponent.js +4 -0
- package/dist/render/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +22 -3
- package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
- package/dist/render/renderingTreeToHtml.js +8 -1
- package/dist/routing/ErrorRouteType.d.ts +6 -0
- package/dist/routing/ErrorRouteType.d.ts.map +1 -0
- package/dist/routing/ErrorRouteType.js +1 -0
- package/dist/routing/RouteTypes.d.ts +2 -1
- package/dist/routing/RouteTypes.d.ts.map +1 -1
- package/dist/routing/Routes.d.ts +5 -0
- package/dist/routing/Routes.d.ts.map +1 -1
- package/dist/routing/TungstenErrorInfo.d.ts +6 -0
- package/dist/routing/TungstenErrorInfo.d.ts.map +1 -0
- package/dist/routing/TungstenErrorInfo.js +6 -0
- package/dist/settings.d.ts +2 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +3 -0
- package/dist/stateTracking.d.ts +47 -0
- package/dist/stateTracking.d.ts.map +1 -0
- package/dist/stateTracking.js +83 -0
- package/dist/staticGen/staticGen.d.ts.map +1 -1
- package/dist/staticGen/staticGen.js +117 -107
- package/dist/style/styleContentSxy.js +21 -0
- package/dist/testing/hydrateTestApp.d.ts +38 -0
- package/dist/testing/hydrateTestApp.d.ts.map +1 -0
- package/dist/testing/hydrateTestApp.js +242 -0
- package/dist/testing/index.d.ts +4 -3
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +16 -2
- package/dist/testing/installTestStyleProcessors.d.ts +2 -0
- package/dist/testing/installTestStyleProcessors.d.ts.map +1 -0
- package/dist/testing/installTestStyleProcessors.js +21 -0
- package/dist/testing/temp/componentPackageMock.d.ts +18 -0
- package/dist/testing/temp/componentPackageMock.d.ts.map +1 -0
- package/dist/testing/temp/componentPackageMock.js +37 -0
- package/dist/testing/temp/contentHtmlElements.d.ts +3 -0
- package/dist/testing/temp/contentHtmlElements.d.ts.map +1 -0
- package/dist/testing/temp/contentHtmlElements.js +12 -0
- package/dist/timeProfiler.d.ts +6 -0
- package/dist/timeProfiler.d.ts.map +1 -0
- package/dist/timeProfiler.js +31 -0
- package/dist/update/integrateUpdateVdom.d.ts +11 -0
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +169 -54
- package/dist/update/pendingMounts.d.ts +25 -0
- package/dist/update/pendingMounts.d.ts.map +1 -0
- package/dist/update/pendingMounts.js +55 -0
- package/dist/warnOnFrameworkChange.d.ts.map +1 -1
- package/dist/warnOnFrameworkChange.js +8 -8
- package/package.json +21 -17
- package/dist/FunctionComponentStandIn.sxyt.d.ts +0 -2
- package/dist/FunctionComponentStandIn.sxyt.d.ts.map +0 -1
- package/dist/FunctionComponentStandIn.sxyt.js +0 -52
- package/dist/Instance/gotoRedirect.sxyt.d.ts +0 -2
- package/dist/Instance/gotoRedirect.sxyt.d.ts.map +0 -1
- package/dist/Instance/gotoRedirect.sxyt.js +0 -148
- package/dist/Instance/runTrackedWork.sxyt.d.ts +0 -2
- package/dist/Instance/runTrackedWork.sxyt.d.ts.map +0 -1
- package/dist/Instance/runTrackedWork.sxyt.js +0 -35
- package/dist/Servers/devErrorPageAutoRetry.sxyt.d.ts +0 -2
- package/dist/Servers/devErrorPageAutoRetry.sxyt.d.ts.map +0 -1
- package/dist/Servers/devErrorPageAutoRetry.sxyt.js +0 -117
- package/dist/_client/cjsHelpers.sxyt.d.ts +0 -2
- package/dist/_client/cjsHelpers.sxyt.d.ts.map +0 -1
- package/dist/_client/cjsHelpers.sxyt.js +0 -45
- package/dist/auth/passwordHashing.sxyt.d.ts +0 -2
- package/dist/auth/passwordHashing.sxyt.d.ts.map +0 -1
- package/dist/auth/passwordHashing.sxyt.js +0 -46
- package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts +0 -2
- package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts.map +0 -1
- package/dist/auth/ref/checkPasswordResetToken.sxyt.js +0 -40
- package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts +0 -2
- package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts.map +0 -1
- package/dist/auth/ref/createPasswordResetToken.sxyt.js +0 -10
- package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.d.ts +0 -2
- package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.d.ts.map +0 -1
- package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.js +0 -138
- package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts +0 -2
- package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts.map +0 -1
- package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.js +0 -108
- package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts +0 -2
- package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts.map +0 -1
- package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.js +0 -104
- package/dist/bin/commands/compile.sxyt.d.ts +0 -2
- package/dist/bin/commands/compile.sxyt.d.ts.map +0 -1
- package/dist/bin/commands/compile.sxyt.js +0 -255
- package/dist/build/modifySassImports.sxyt.d.ts +0 -2
- package/dist/build/modifySassImports.sxyt.d.ts.map +0 -1
- package/dist/build/modifySassImports.sxyt.js +0 -55
- package/dist/build/sassImportParser.sxyt.d.ts +0 -2
- package/dist/build/sassImportParser.sxyt.d.ts.map +0 -1
- package/dist/build/sassImportParser.sxyt.js +0 -110
- package/dist/build/scssImportParserChatgpt.sxyt.d.ts +0 -2
- package/dist/build/scssImportParserChatgpt.sxyt.d.ts.map +0 -1
- package/dist/build/scssImportParserChatgpt.sxyt.js +0 -120
- package/dist/clone.sxyt.d.ts +0 -2
- package/dist/clone.sxyt.d.ts.map +0 -1
- package/dist/clone.sxyt.js +0 -24
- package/dist/componentProxyHandlers.sxyt.d.ts +0 -2
- package/dist/componentProxyHandlers.sxyt.d.ts.map +0 -1
- package/dist/componentProxyHandlers.sxyt.js +0 -130
- package/dist/components/RawHtml.sxyt.d.ts +0 -2
- package/dist/components/RawHtml.sxyt.d.ts.map +0 -1
- package/dist/components/RawHtml.sxyt.js +0 -104
- package/dist/components/bindable/BindableSelect.sxyt.d.ts +0 -2
- package/dist/components/bindable/BindableSelect.sxyt.d.ts.map +0 -1
- package/dist/components/bindable/BindableSelect.sxyt.js +0 -186
- package/dist/env/injectEnv.sxyt.d.ts +0 -2
- package/dist/env/injectEnv.sxyt.d.ts.map +0 -1
- package/dist/env/injectEnv.sxyt.js +0 -20
- package/dist/env/parseEnv.d.ts +0 -2
- package/dist/env/parseEnv.d.ts.map +0 -1
- package/dist/env/parseEnv.js +0 -14
- package/dist/env/parseEnv.sxyt.d.ts +0 -2
- package/dist/env/parseEnv.sxyt.d.ts.map +0 -1
- package/dist/env/parseEnv.sxyt.js +0 -11
- package/dist/findProjectDir.sxyt.d.ts +0 -2
- package/dist/findProjectDir.sxyt.d.ts.map +0 -1
- package/dist/findProjectDir.sxyt.js +0 -82
- package/dist/hmr/applyHmrModule.sxyt.d.ts +0 -2
- package/dist/hmr/applyHmrModule.sxyt.d.ts.map +0 -1
- package/dist/hmr/applyHmrModule.sxyt.js +0 -182
- package/dist/hmr/instanceRegistry.sxyt.d.ts +0 -2
- package/dist/hmr/instanceRegistry.sxyt.d.ts.map +0 -1
- package/dist/hmr/instanceRegistry.sxyt.js +0 -24
- package/dist/hmr/refreshStylesheets.sxyt.d.ts +0 -2
- package/dist/hmr/refreshStylesheets.sxyt.d.ts.map +0 -1
- package/dist/hmr/refreshStylesheets.sxyt.js +0 -46
- package/dist/hydrate/hydrate.sxyt.d.ts +0 -2
- package/dist/hydrate/hydrate.sxyt.d.ts.map +0 -1
- package/dist/hydrate/hydrate.sxyt.js +0 -302
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts +0 -2
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts.map +0 -1
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.js +0 -190
- package/dist/importDevModuleWithRetry.sxyt.d.ts +0 -2
- package/dist/importDevModuleWithRetry.sxyt.d.ts.map +0 -1
- package/dist/importDevModuleWithRetry.sxyt.js +0 -104
- package/dist/innerHtmlFromProps.sxyt.d.ts +0 -2
- package/dist/innerHtmlFromProps.sxyt.d.ts.map +0 -1
- package/dist/innerHtmlFromProps.sxyt.js +0 -99
- package/dist/postcssPlugins/parseSelectors.sxyt.d.ts +0 -2
- package/dist/postcssPlugins/parseSelectors.sxyt.d.ts.map +0 -1
- package/dist/postcssPlugins/parseSelectors.sxyt.js +0 -62
- package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts +0 -2
- package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts.map +0 -1
- package/dist/postcssPlugins/parseSelectorsRich.sxyt.js +0 -155
- package/dist/rawHtml/parseHtml.sxyt.d.ts +0 -2
- package/dist/rawHtml/parseHtml.sxyt.d.ts.map +0 -1
- package/dist/rawHtml/parseHtml.sxyt.js +0 -239
- package/dist/render/getFunctionBodyAsString.sxyt.d.ts +0 -2
- package/dist/render/getFunctionBodyAsString.sxyt.d.ts.map +0 -1
- package/dist/render/getFunctionBodyAsString.sxyt.js +0 -37
- package/dist/render/processHead.sxyt.d.ts +0 -2
- package/dist/render/processHead.sxyt.d.ts.map +0 -1
- package/dist/render/processHead.sxyt.js +0 -93
- package/dist/render/processProps.sxyt.d.ts +0 -2
- package/dist/render/processProps.sxyt.d.ts.map +0 -1
- package/dist/render/processProps.sxyt.js +0 -90
- package/dist/routing/compareRequestToRegex.sxyt.d.ts +0 -2
- package/dist/routing/compareRequestToRegex.sxyt.d.ts.map +0 -1
- package/dist/routing/compareRequestToRegex.sxyt.js +0 -65
- package/dist/routing/getPathPriority.sxyt.d.ts +0 -2
- package/dist/routing/getPathPriority.sxyt.d.ts.map +0 -1
- package/dist/routing/getPathPriority.sxyt.js +0 -24
- package/dist/routing/matchPath.sxyt.d.ts +0 -2
- package/dist/routing/matchPath.sxyt.d.ts.map +0 -1
- package/dist/routing/matchPath.sxyt.js +0 -41
- package/dist/routing/patternToRegex.sxyt.d.ts +0 -2
- package/dist/routing/patternToRegex.sxyt.d.ts.map +0 -1
- package/dist/routing/patternToRegex.sxyt.js +0 -69
- package/dist/routing/splitRequest.sxyt.d.ts +0 -2
- package/dist/routing/splitRequest.sxyt.d.ts.map +0 -1
- package/dist/routing/splitRequest.sxyt.js +0 -47
- package/dist/style/jssToCss.sxyt.d.ts +0 -2
- package/dist/style/jssToCss.sxyt.d.ts.map +0 -1
- package/dist/style/jssToCss.sxyt.js +0 -17
- package/dist/testing/createTestApp.sxyt.d.ts +0 -2
- package/dist/testing/createTestApp.sxyt.d.ts.map +0 -1
- package/dist/testing/createTestApp.sxyt.js +0 -470
- package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts +0 -2
- package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts.map +0 -1
- package/dist/testing/ensureTestEnvLoaded.sxyt.js +0 -20
- package/dist/update/hotSwap.sxyt.d.ts +0 -2
- package/dist/update/hotSwap.sxyt.d.ts.map +0 -1
- package/dist/update/hotSwap.sxyt.js +0 -252
|
@@ -4,7 +4,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
4
4
|
import express from 'express';
|
|
5
5
|
import { join } from 'path';
|
|
6
6
|
import { existsSync } from 'fs';
|
|
7
|
-
import { staticFolder, assetsFolder, packageNameCapitalized, publicFolder, componentCssFolder } from "../settings.js";
|
|
7
|
+
import { staticFolder, assetsFolder, packageNameCapitalized, publicFolder, componentCssFolder, frameworkCssFolder } from "../settings.js";
|
|
8
8
|
import { rootToHtml as renderRootToHtml } from "../render/rootToHtml.js";
|
|
9
9
|
import { contentToHtml as renderContentToHtml } from "../render/contentToHtml.js";
|
|
10
10
|
import { Instance } from "../Instance/Instance.js";
|
|
@@ -19,6 +19,7 @@ import { globalDataFunc } from "../routing/registerGlobalData.js";
|
|
|
19
19
|
import { TungstenServer } from "./TungstenServer.js";
|
|
20
20
|
import { portError } from "./portError.js";
|
|
21
21
|
import { initStores } from "./initStores.js";
|
|
22
|
+
import { makeTungstenErrorInfo } from "../routing/TungstenErrorInfo.js";
|
|
22
23
|
function debug(...texts) {
|
|
23
24
|
// console.log(...texts)
|
|
24
25
|
}
|
|
@@ -83,6 +84,14 @@ export class ProdServer extends TungstenServer {
|
|
|
83
84
|
res.status(404).end();
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
87
|
+
// Captured as soon as it resolves, independent of the Promise.all below - that's
|
|
88
|
+
// all-or-nothing, so if routing/route-data-fetching fails afterwards, `globalData`
|
|
89
|
+
// never gets assigned even though fetching it didn't fail (global data and route data
|
|
90
|
+
// are independent tRPC calls, batched together but not coupled - see
|
|
91
|
+
// resolveResponse.ts in @trpc/server). tryRenderErrorRoute uses this to render the
|
|
92
|
+
// app's error route with the real global data (theme colour, username, ...) rather
|
|
93
|
+
// than framework defaults, when it did resolve.
|
|
94
|
+
let capturedGlobalData = {};
|
|
86
95
|
try {
|
|
87
96
|
const location = req.url;
|
|
88
97
|
const instanceConfig = makeInstanceConfigFromFrameworkConfig(this.config);
|
|
@@ -115,7 +124,10 @@ export class ProdServer extends TungstenServer {
|
|
|
115
124
|
value: false
|
|
116
125
|
};
|
|
117
126
|
const routes = typeof appRoutes === 'function' ? appRoutes(reqRes) : appRoutes;
|
|
118
|
-
const [globalData, matchedRouteInfo] = await Promise.all([globalDataFunc.value !== undefined ? globalDataFunc.value(reqRes)
|
|
127
|
+
const [globalData, matchedRouteInfo] = await Promise.all([globalDataFunc.value !== undefined ? globalDataFunc.value(reqRes).then(globalData => {
|
|
128
|
+
capturedGlobalData = globalData;
|
|
129
|
+
return globalData;
|
|
130
|
+
}) : {}, routing(location, routes, serverDataLoading)]);
|
|
119
131
|
//instance.matchedRouteInfo =
|
|
120
132
|
//cliTodo('Can we move redirect handling to base class?')
|
|
121
133
|
// // 2025-03-14 copied this code here from Dev server,
|
|
@@ -165,14 +177,76 @@ export class ProdServer extends TungstenServer {
|
|
|
165
177
|
res.send(html);
|
|
166
178
|
} catch (e) {
|
|
167
179
|
cliLog('handleRequest() error', e);
|
|
180
|
+
const errorRouteHtml = await this.tryRenderErrorRoute(req, res, capturedGlobalData, e);
|
|
168
181
|
res.setHeader('Content-Type', 'text/html');
|
|
169
182
|
res.status(500);
|
|
170
|
-
res.send(this.errorPage());
|
|
183
|
+
res.send(errorRouteHtml ?? this.errorPage());
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
// Attempts to render the app's own 'error' route in place of the framework's generic
|
|
187
|
+
// error page, using whatever `globalData` handleRequest above managed to capture before
|
|
188
|
+
// it failed (see the capturedGlobalData comment there for why that's not always {}). Only
|
|
189
|
+
// usable when the app routes themselves could be resolved (this runs from the catch block
|
|
190
|
+
// of handleRequest, so anything from route resolution onward may have failed) and the app
|
|
191
|
+
// actually defines an 'error' route. Never throws - falls back to null (the caller's
|
|
192
|
+
// default error page) on any failure, since we're already handling one error and can't
|
|
193
|
+
// risk a second, unhandled one taking the server down.
|
|
194
|
+
_defineProperty(this, "tryRenderErrorRoute", async (req, res, globalData, error) => {
|
|
195
|
+
try {
|
|
196
|
+
if (this.framework.clientImportAliases === undefined) {
|
|
197
|
+
throwError('ProdServer.tryRenderErrorRoute()', 'framework.clientImportAliases is undefined');
|
|
198
|
+
}
|
|
199
|
+
const {
|
|
200
|
+
config,
|
|
201
|
+
appRoutes,
|
|
202
|
+
RootComponentOrNull
|
|
203
|
+
} = this;
|
|
204
|
+
const reqRes = {
|
|
205
|
+
req,
|
|
206
|
+
res
|
|
207
|
+
};
|
|
208
|
+
const routes = typeof appRoutes === 'function' ? appRoutes(reqRes) : appRoutes;
|
|
209
|
+
const errorRouteDef = routes.error;
|
|
210
|
+
if (errorRouteDef === undefined) return null;
|
|
211
|
+
const location = req.url;
|
|
212
|
+
const instanceConfig = makeInstanceConfigFromFrameworkConfig(this.config);
|
|
213
|
+
const matchedRouteInfo = {
|
|
214
|
+
key: 'error',
|
|
215
|
+
params: {},
|
|
216
|
+
content: errorRouteDef.content,
|
|
217
|
+
data: makeTungstenErrorInfo(error)
|
|
218
|
+
};
|
|
219
|
+
const serverDataLoading = {
|
|
220
|
+
value: false
|
|
221
|
+
};
|
|
222
|
+
const {
|
|
223
|
+
internalStore,
|
|
224
|
+
stores,
|
|
225
|
+
storeSubscriptions
|
|
226
|
+
} = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading);
|
|
227
|
+
const instance = new Instance(location, instanceConfig, reqRes, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
|
|
228
|
+
if (RootComponentOrNull !== null) {
|
|
229
|
+
return await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, RootComponentOrNull, instance, config, this.config.siteBasePath);
|
|
230
|
+
}
|
|
231
|
+
const {
|
|
232
|
+
params,
|
|
233
|
+
data
|
|
234
|
+
} = matchedRouteInfo;
|
|
235
|
+
let {
|
|
236
|
+
content
|
|
237
|
+
} = matchedRouteInfo;
|
|
238
|
+
if (typeof content === 'function') {
|
|
239
|
+
content = content(data, params, {} /* props */, globalData, location);
|
|
240
|
+
}
|
|
241
|
+
return await renderContentToHtml(this.compilationInfo, this.framework.clientImportAliases, content, instance, config, this.config.siteBasePath);
|
|
242
|
+
} catch (renderError) {
|
|
243
|
+
cliLog('Error rendering app error route, falling back to default error page', renderError);
|
|
244
|
+
return null;
|
|
171
245
|
}
|
|
172
246
|
});
|
|
173
247
|
_defineProperty(this, "errorPage", () => {
|
|
174
248
|
return `<!DOCTYPE html>
|
|
175
|
-
|
|
249
|
+
<html>
|
|
176
250
|
<head><title>Error</title></head>
|
|
177
251
|
<body>
|
|
178
252
|
<h1>Internal error</h1>
|
|
@@ -240,6 +314,7 @@ export class ProdServer extends TungstenServer {
|
|
|
240
314
|
}
|
|
241
315
|
this.app.use('/bundle', express.static(this.compilationInfo.bundleLocation));
|
|
242
316
|
this.app.use(`/${componentCssFolder}/`, express.static(join(this.compilationInfo.buildLocation, componentCssFolder)));
|
|
317
|
+
this.app.use(`/${frameworkCssFolder}/`, express.static(join(this.compilationInfo.buildLocation, frameworkCssFolder)));
|
|
243
318
|
const publicLocation = join(this.compilationInfo.buildLocation, publicFolder);
|
|
244
319
|
//console.log('publicLocation', publicLocation, existsSync(publicLocation))
|
|
245
320
|
if (existsSync(publicLocation)) this.app.use(express.static(publicLocation)); // files from public folder
|
|
@@ -263,8 +338,8 @@ export class ProdServer extends TungstenServer {
|
|
|
263
338
|
// I don't think we ever override the port, not sure why
|
|
264
339
|
start(portOverride, mute = false) {
|
|
265
340
|
return new Promise(resolve => {
|
|
266
|
-
const proto =
|
|
267
|
-
const host =
|
|
341
|
+
const proto = tungstenPublicEnv.FRONTEND_PROTO ?? 'http';
|
|
342
|
+
const host = tungstenPublicEnv.FRONTEND_HOST ?? 'localhost';
|
|
268
343
|
let port;
|
|
269
344
|
if (portOverride !== undefined) {
|
|
270
345
|
port = portOverride;
|
|
@@ -283,7 +358,16 @@ export class ProdServer extends TungstenServer {
|
|
|
283
358
|
});
|
|
284
359
|
});
|
|
285
360
|
}
|
|
286
|
-
|
|
287
|
-
|
|
361
|
+
// close() alone only stops new connections arriving - keep-alive sockets (fetch/undici
|
|
362
|
+
// holds them open) keep the handle, and so the event loop, alive until they time out
|
|
363
|
+
async stop() {
|
|
364
|
+
const server = this.server;
|
|
365
|
+
if (server === undefined) return;
|
|
366
|
+
await new Promise((resolve, reject) => {
|
|
367
|
+
server.close(error => error === undefined ? resolve() : reject(error));
|
|
368
|
+
server.closeAllConnections();
|
|
369
|
+
});
|
|
370
|
+
delete this.server;
|
|
371
|
+
this.location = null;
|
|
288
372
|
}
|
|
289
373
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
// //import express, { Request, Response, NextFunction, RequestHandler } from 'express'
|
|
1
|
+
// Status/known gaps: see ./README.md
|
|
3
2
|
// import { Context, Hono } from 'hono'
|
|
4
3
|
// import type { BlankEnv, BlankSchema, Handler, Next } from 'hono/types'
|
|
5
|
-
// import { serve } from '@hono/node-server'
|
|
4
|
+
// import { serve, type ServerType } from '@hono/node-server'
|
|
6
5
|
// import { serveStatic } from '@hono/node-server/serve-static'
|
|
7
6
|
// import { join } from 'path'
|
|
8
7
|
// import { allObj as promiseAllObj } from 'sxy-lib/promises.js'
|
|
@@ -35,7 +34,6 @@
|
|
|
35
34
|
// import { ServerDataLoading } from '../../Store/ServerDataLoading.js'
|
|
36
35
|
// import { TungstenServer } from '../TungstenServer.jsx'
|
|
37
36
|
// import { Routes } from '../../routing/Routes.js'
|
|
38
|
-
// import { RedirectCode, RoutingRedirect } from '../../routing/RoutingRedirect.js'
|
|
39
37
|
// import { portError } from '../portError.js'
|
|
40
38
|
// import { loadEnvsDev } from '../loadEnvsDev.js'
|
|
41
39
|
// import { initStores } from '../initStores.js'
|
|
@@ -45,7 +43,6 @@
|
|
|
45
43
|
// import { MatchedRoute } from '../../routing/MatchedRoute.js'
|
|
46
44
|
// import { ContentNodeIsClassComponent } from '../../ContentNode.js'
|
|
47
45
|
// import { $props, $type } from '../../contentNodeSymbols.js'
|
|
48
|
-
// import { RedirectComponent } from '../../components/RedirectComponent.js'
|
|
49
46
|
// import { Path } from '../../routing/RouteTypes.js'
|
|
50
47
|
// import type { ApiRoutesHono } from '../../api/ApiRoutesHono.js'
|
|
51
48
|
// import { TungstenServerHono } from './TungstenServerHono.jsx'
|
|
@@ -64,9 +61,10 @@ export {};
|
|
|
64
61
|
// app: Hono<BlankEnv, BlankSchema, '/'>
|
|
65
62
|
// apiRoutes?: ApiRoutesHono
|
|
66
63
|
// apiPath?: string
|
|
67
|
-
// server?:
|
|
64
|
+
// server?: ServerType
|
|
68
65
|
// reqId: number
|
|
69
66
|
// firstRender: boolean = true
|
|
67
|
+
// iterationCount: number = 0
|
|
70
68
|
// constructor(
|
|
71
69
|
// framework: Framework, config: FrameworkConfigComplete, compilationInfo: CompilationInfo,
|
|
72
70
|
// initialProcessEnv: Record<string, string> = {}/* FIX ME */
|
|
@@ -83,8 +81,8 @@ export {};
|
|
|
83
81
|
// // + '\n Ensure that you have an env schema with this field, and a matching env file'
|
|
84
82
|
// // )
|
|
85
83
|
// // }
|
|
86
|
-
// const proto =
|
|
87
|
-
// const host =
|
|
84
|
+
// const proto = tungstenPublicEnv.FRONTEND_PROTO ?? 'http'
|
|
85
|
+
// const host = tungstenPublicEnv.FRONTEND_HOST ?? 'localhost'
|
|
88
86
|
// const port = tungstenPrivateEnv.TUNGSTEN_SERVER_PORT ?? 3000
|
|
89
87
|
// if (isNaN(port) || port === 0) throwError('DevServer', portError(port))
|
|
90
88
|
// this.port = port
|
|
@@ -301,21 +299,24 @@ export {};
|
|
|
301
299
|
// )
|
|
302
300
|
// }
|
|
303
301
|
// globalDataFunc.value = undefined
|
|
304
|
-
// const
|
|
305
|
-
// await loadEnvsDev(this.config,
|
|
306
|
-
// //
|
|
307
|
-
// //
|
|
308
|
-
// //
|
|
302
|
+
// const iteration = this.iterationCount++
|
|
303
|
+
// await loadEnvsDev(this.config, iteration, this.initialProcessEnv, false)
|
|
304
|
+
// // ReqRes is Express-shaped ({req, res}) and Hono's Context isn't - this cast is a
|
|
305
|
+
// // type-only bridge so the (Express-only) Instance/initStores/routing plumbing below
|
|
306
|
+
// // still compiles. Not behaviorally correct; fine since this dev server isn't wired
|
|
307
|
+
// // up anywhere live (see Framework.createDevServer, which only builds DevServer).
|
|
308
|
+
// // eslint-disable-next-line no-type-assertion/no-type-assertion -- see comment above
|
|
309
|
+
// const reqRes = c as unknown as ReqRes
|
|
309
310
|
// // Save some state. I think this is a placeholder for later
|
|
310
311
|
// const serverDataLoading: ServerDataLoading = { value: false }
|
|
311
|
-
// const routingPromise = getRoutesDev(this.compilationInfo, this.config,
|
|
312
|
+
// const routingPromise = getRoutesDev(this.compilationInfo, this.config, iteration).then(
|
|
312
313
|
// async (appRoutes) => {
|
|
313
|
-
// const routes = (typeof appRoutes === 'function') ? appRoutes(
|
|
314
|
+
// const routes = (typeof appRoutes === 'function') ? appRoutes(reqRes) : appRoutes
|
|
314
315
|
// // load data, and do routing
|
|
315
316
|
// return promiseAllObj({
|
|
316
317
|
// appRoutes,
|
|
317
318
|
// routes,
|
|
318
|
-
// globalData: (globalDataFunc.value !== undefined) ? globalDataFunc.value(
|
|
319
|
+
// globalData: (globalDataFunc.value !== undefined) ? globalDataFunc.value(reqRes) : {},
|
|
319
320
|
// matchedRouteInfo: routing(location, routes, serverDataLoading)
|
|
320
321
|
// })
|
|
321
322
|
// }
|
|
@@ -330,7 +331,7 @@ export {};
|
|
|
330
331
|
// ;({ routing: { appRoutes, routes, globalData, matchedRouteInfo }, RootComponentClass }
|
|
331
332
|
// = await promiseAllObj({
|
|
332
333
|
// routing: routingPromise,
|
|
333
|
-
// RootComponentClass: getComponentDev(rootComponentFileFull, this.config.rootComponent,
|
|
334
|
+
// RootComponentClass: getComponentDev(rootComponentFileFull, this.config.rootComponent, iteration)
|
|
334
335
|
// }))
|
|
335
336
|
// } else {
|
|
336
337
|
// ({ appRoutes, routes, globalData, matchedRouteInfo } = await routingPromise)
|
|
@@ -344,13 +345,13 @@ export {};
|
|
|
344
345
|
// // routing(location, routes, serverDataLoading)
|
|
345
346
|
// // ])
|
|
346
347
|
// const redirected = this.handleRedirects(c, matchedRouteInfo)
|
|
347
|
-
// if (redirected) return // end early
|
|
348
|
+
// if (redirected !== false) return redirected // end early
|
|
348
349
|
// // make stores
|
|
349
350
|
// const { internalStore, stores, storeSubscriptions }
|
|
350
|
-
// = initStores(location,
|
|
351
|
+
// = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading)
|
|
351
352
|
// // create the instance
|
|
352
|
-
// const instance = new Instance(
|
|
353
|
-
// location, instanceConfig,
|
|
353
|
+
// const instance = new Instance(
|
|
354
|
+
// location, instanceConfig, reqRes, appRoutes, routes, internalStore,
|
|
354
355
|
// stores, storeSubscriptions, globalData, matchedRouteInfo
|
|
355
356
|
// )
|
|
356
357
|
// let html: string
|
|
@@ -379,16 +380,11 @@ export {};
|
|
|
379
380
|
// // '' // siteBasePathOverride
|
|
380
381
|
// // )
|
|
381
382
|
// }
|
|
382
|
-
//
|
|
383
|
-
// res.setHeader('Content-Type', 'text/html')
|
|
384
|
-
// res.status((instance.matchedRouteInfo.key === '404') ? 404 : 200)
|
|
385
|
-
// res.send(html)
|
|
383
|
+
// return c.html(html, (instance.matchedRouteInfo.key === '404') ? 404 : 200)
|
|
386
384
|
// } catch(e) {
|
|
387
385
|
// cliLog('error', e)
|
|
388
|
-
// res.setHeader('Content-Type', 'text/html')
|
|
389
|
-
// res.status(500)
|
|
390
386
|
// this.errorLog(e)
|
|
391
|
-
//
|
|
387
|
+
// return c.html(this.errorPage(e), 500)
|
|
392
388
|
// }
|
|
393
389
|
// }
|
|
394
390
|
// // private async handlePost(req: express.Request, res: express.Response): Promise<void> {
|
|
@@ -414,7 +410,7 @@ export {};
|
|
|
414
410
|
// }
|
|
415
411
|
// start = (): Promise<string> => {
|
|
416
412
|
// return new Promise( resolve => {
|
|
417
|
-
// this.server = this.app.
|
|
413
|
+
// this.server = serve({ fetch: this.app.fetch, port: this.port }, () => {
|
|
418
414
|
// cliNews(`Dev server ready at ${this.location}`)
|
|
419
415
|
// resolve(this.location ?? '')
|
|
420
416
|
// })
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// import {
|
|
4
|
-
// import {
|
|
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:
|
|
41
|
+
// app: Hono
|
|
52
42
|
// apiRoutesPromise?: Promise<ApiRoutes>
|
|
53
43
|
// apiRoutes?: ApiRoutes
|
|
54
|
-
// 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
|
-
//
|
|
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((
|
|
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((
|
|
90
|
-
// const
|
|
91
|
-
// const
|
|
92
|
-
//
|
|
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
|
-
//
|
|
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('
|
|
101
|
+
// throwError('ProdServerHono', 'compilationInfo.bundleLocation is unset/undefined')
|
|
123
102
|
// }
|
|
124
|
-
// this.app.use('/bundle',
|
|
103
|
+
// this.app.use('/bundle/*', serveStatic({ root: this.compilationInfo.bundleLocation }))
|
|
125
104
|
// const publicLocation = join(this.compilationInfo.location, publicFolder)
|
|
126
|
-
//
|
|
127
|
-
//
|
|
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',
|
|
108
|
+
// this.app.use('/assets/*', serveStatic({ root: join(this.compilationInfo.location, assetsFolder) }))
|
|
132
109
|
// }
|
|
133
|
-
// this.app.use(
|
|
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
|
-
//
|
|
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 (
|
|
183
|
-
//
|
|
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
|
-
//
|
|
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('
|
|
132
|
+
// throwError('ProdServerHono.handleRequest()',
|
|
193
133
|
// 'framework.frameworkModules is undefined'
|
|
194
134
|
// )
|
|
195
135
|
// }
|
|
196
136
|
// if (this.framework.clientImportAliases === undefined) {
|
|
197
|
-
// throwError('
|
|
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
|
-
//
|
|
211
|
-
// //
|
|
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
|
-
//
|
|
219
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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 =
|
|
290
|
-
// const host =
|
|
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('
|
|
205
|
+
// if (isNaN(_port) || _port === 0) throwError('ProdServerHono', portError(_port))
|
|
297
206
|
// port = _port
|
|
298
207
|
// }
|
|
299
|
-
//
|
|
300
|
-
//
|
|
301
|
-
// this.server = this.app.
|
|
302
|
-
//
|
|
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):
|
|
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":"
|
|
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"}
|