tungsten 0.6.3 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-complete +1 -1
- package/dist/Brands.d.ts +16 -0
- package/dist/Brands.d.ts.map +1 -0
- package/dist/Brands.js +22 -0
- package/dist/Components.d.ts +4 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +24 -6
- package/dist/ContentNode.d.ts +3 -2
- package/dist/ContentNode.d.ts.map +1 -1
- package/dist/ContentNode.js +11 -0
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js +23 -4
- package/dist/FrameworkConfig.d.ts +9 -1
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/FrameworkConfig.types.test.d.ts +2 -0
- package/dist/FrameworkConfig.types.test.d.ts.map +1 -0
- package/dist/FrameworkConfig.types.test.js +6 -0
- package/dist/FunctionComponent.d.ts +1 -0
- package/dist/FunctionComponent.d.ts.map +1 -1
- package/dist/FunctionComponentStandIn.d.ts.map +1 -1
- package/dist/Instance/Instance.d.ts +21 -9
- package/dist/Instance/Instance.d.ts.map +1 -1
- package/dist/Instance/Instance.js +42 -38
- package/dist/Instance/InstanceConfig.d.ts +3 -1
- package/dist/Instance/InstanceConfig.d.ts.map +1 -1
- package/dist/RenderedContentNode.d.ts.map +1 -1
- package/dist/RenderingNode.d.ts.map +1 -1
- package/dist/Servers/DevServer.d.ts +4 -2
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +72 -21
- package/dist/Servers/ProdServer.d.ts +5 -2
- package/dist/Servers/ProdServer.d.ts.map +1 -1
- package/dist/Servers/ProdServer.js +95 -19
- package/dist/Servers/StaticSiteServer.d.ts +1 -1
- package/dist/Servers/StaticSiteServer.d.ts.map +1 -1
- package/dist/Servers/TungstenServer.d.ts +2 -1
- package/dist/Servers/TungstenServer.d.ts.map +1 -1
- package/dist/Servers/TungstenServer.js +7 -0
- package/dist/Servers/cacheVersioned.d.ts +3 -0
- package/dist/Servers/cacheVersioned.d.ts.map +1 -0
- package/dist/Servers/cacheVersioned.js +23 -0
- package/dist/Servers/devErrorPageAutoRetry.d.ts.map +1 -1
- package/dist/Servers/devErrorPageAutoRetry.js +1 -0
- package/dist/Servers/initStores.d.ts +4 -4
- package/dist/Servers/initStores.d.ts.map +1 -1
- package/dist/Servers/initStores.js +2 -2
- package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.js +7 -6
- package/dist/Servers/resetRegistrations.d.ts +2 -0
- package/dist/Servers/resetRegistrations.d.ts.map +1 -0
- package/dist/Servers/resetRegistrations.js +13 -0
- package/dist/Servers/routing.d.ts +3 -2
- package/dist/Servers/routing.d.ts.map +1 -1
- package/dist/Servers/routing.js +12 -7
- package/dist/Servers/stubInstance.d.ts +8 -0
- package/dist/Servers/stubInstance.d.ts.map +1 -0
- package/dist/Servers/stubInstance.js +40 -0
- package/dist/Store/InternalStoreSchema.d.ts +1 -1
- package/dist/Store/Store.js +2 -1
- package/dist/Store/StoreSchemaClass.d.ts +6 -3
- package/dist/Store/StoreSchemaClass.d.ts.map +1 -1
- package/dist/Store/StoreSchemaClass.js +8 -1
- package/dist/Store/TypeSafeStore.js +2 -1
- package/dist/Store/createStores.d.ts +3 -3
- package/dist/Store/createStores.d.ts.map +1 -1
- package/dist/Store/createStores.js +7 -2
- package/dist/Store/getInternalStore.d.ts.map +1 -1
- package/dist/Store/registerStore.d.ts.map +1 -1
- package/dist/Store/registerStore.js +2 -2
- package/dist/Store/storeCreators.d.ts +2 -2
- package/dist/Store/storeCreators.d.ts.map +1 -1
- package/dist/TungstenApp.d.ts +3 -3
- package/dist/TungstenApp.d.ts.map +1 -1
- package/dist/_client/cjsHelpers.d.ts.map +1 -1
- package/dist/_client/cjsHelpers.js +5 -3
- package/dist/_client/client.d.ts +2 -0
- package/dist/_client/client.d.ts.map +1 -1
- package/dist/_client/client.js +10 -3
- package/dist/api/getApiRoutes.d.ts.map +1 -1
- package/dist/api/getExport.d.ts +1 -1
- package/dist/api/getExport.d.ts.map +1 -1
- package/dist/api/getExport.js +2 -1
- package/dist/api/getExportDev.d.ts +1 -1
- package/dist/api/getExportDev.d.ts.map +1 -1
- package/dist/appBuilder.d.ts +69 -0
- package/dist/appBuilder.d.ts.map +1 -0
- package/dist/appBuilder.js +98 -0
- package/dist/appBuilder.types.test.d.ts +110 -0
- package/dist/appBuilder.types.test.d.ts.map +1 -0
- package/dist/appBuilder.types.test.js +240 -0
- package/dist/babelPlugins/BabelTransformBindDirect.js +7 -7
- package/dist/babelPlugins/BabelTransformBindVar.js +7 -7
- package/dist/babelPlugins/BabelTransformComponentState.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.js +5 -5
- package/dist/babelPlugins/BabelTransformCssImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformCssImports.js +2 -2
- package/dist/babelPlugins/BabelTransformDeproxyState.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.js +11 -6
- package/dist/babelPlugins/BabelTransformRemoveDevBlocks.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformRemoveServerBlocks.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTypes.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.js +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.js +2 -2
- package/dist/bin/commands/compile.d.ts.map +1 -1
- package/dist/bin/commands/compile.js +2 -1
- package/dist/build/CompilationInfo.d.ts +3 -0
- package/dist/build/CompilationInfo.d.ts.map +1 -1
- package/dist/build/assetVersions.d.ts +9 -0
- package/dist/build/assetVersions.d.ts.map +1 -0
- package/dist/build/assetVersions.js +39 -0
- package/dist/build/babel.user.common.config.d.ts.map +1 -1
- package/dist/build/bundle.d.ts.map +1 -1
- package/dist/build/bundle.js +2 -1
- package/dist/build/bundleBabelOptions.d.ts.map +1 -1
- package/dist/build/clientRoutesFile.d.ts +2 -0
- package/dist/build/clientRoutesFile.d.ts.map +1 -0
- package/dist/build/clientRoutesFile.js +13 -0
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +4 -3
- package/dist/build/compileStyles.d.ts +2 -1
- package/dist/build/compileStyles.d.ts.map +1 -1
- package/dist/build/compileStyles.js +38 -83
- package/dist/build/compileUserApp.d.ts.map +1 -1
- package/dist/build/componentStylesCache.d.ts.map +1 -1
- package/dist/build/componentStylesCache.js +3 -2
- package/dist/build/copyAssets.d.ts.map +1 -1
- package/dist/build/copyAssets.js +2 -1
- package/dist/build/copyPackageModulesToPackagesFolder.d.ts.map +1 -1
- package/dist/build/copyPackageModulesToPackagesFolder.js +1 -1
- package/dist/build/copyPublicFiles.d.ts.map +1 -1
- package/dist/build/copyPublicFiles.js +2 -1
- package/dist/build/createClientFiles.d.ts.map +1 -1
- package/dist/build/createClientFiles.js +9 -5
- package/dist/build/createInstanceConfigFile.d.ts +1 -1
- package/dist/build/createInstanceConfigFile.d.ts.map +1 -1
- package/dist/build/createInstanceConfigFile.js +9 -3
- package/dist/build/frameworkDestLocation.d.ts.map +1 -1
- package/dist/build/frameworkDestLocation.js +5 -6
- package/dist/build/frameworkStylesheets.d.ts.map +1 -1
- package/dist/build/frameworkStylesheets.js +1 -1
- package/dist/build/makeBabelRawConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserDevConfig.d.ts +2 -2
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
- package/dist/build/rollup.user.prod.config.d.ts.map +1 -1
- package/dist/build/rollup.user.prod.config.js +5 -3
- package/dist/build/rollupProdConstants.d.ts +5 -0
- package/dist/build/rollupProdConstants.d.ts.map +1 -0
- package/dist/build/rollupProdConstants.js +21 -0
- package/dist/cacheControl.d.ts +13 -0
- package/dist/cacheControl.d.ts.map +1 -0
- package/dist/cacheControl.js +22 -0
- package/dist/compat/types.d.ts +1 -1
- package/dist/compat/types.d.ts.map +1 -1
- package/dist/componentHelpers.d.ts +19 -0
- package/dist/componentHelpers.d.ts.map +1 -0
- package/dist/componentHelpers.js +31 -0
- package/dist/componentProxyHandlers.d.ts.map +1 -1
- package/dist/components/Fragment.d.ts +8 -0
- package/dist/components/Fragment.d.ts.map +1 -0
- package/dist/components/Fragment.js +10 -0
- package/dist/components/Link.d.ts +4 -3
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +1 -0
- package/dist/components/NoEscape.d.ts +8 -0
- package/dist/components/NoEscape.d.ts.map +1 -0
- package/dist/components/NoEscape.js +6 -0
- package/dist/components/RouteRedirectComponent.d.ts.map +1 -1
- package/dist/components/RouteRedirectComponent.js +1 -1
- package/dist/components/WebRedirectComponent.d.ts.map +1 -1
- package/dist/components/WebRedirectComponent.js +1 -1
- package/dist/components/bindable/BindVariable.d.ts +1 -0
- package/dist/components/bindable/BindVariable.d.ts.map +1 -1
- package/dist/components/bindable/BindableCheckbox.d.ts +7 -7
- package/dist/components/bindable/BindableCheckbox.d.ts.map +1 -1
- package/dist/components/bindable/BindableInput.d.ts +7 -7
- package/dist/components/bindable/BindableInput.d.ts.map +1 -1
- package/dist/components/bindable/BindableInputNonString.d.ts +2 -2
- package/dist/components/bindable/BindableInputNonString.d.ts.map +1 -1
- package/dist/components/bindable/BindableInputString.d.ts +2 -2
- package/dist/components/bindable/BindableInputString.d.ts.map +1 -1
- package/dist/components/bindable/BindableInputTyped.d.ts +3 -3
- package/dist/components/bindable/BindableInputTyped.d.ts.map +1 -1
- package/dist/components/bindable/BindableInputTypedLegacy.d.ts +3 -3
- package/dist/components/bindable/BindableInputTypedLegacy.d.ts.map +1 -1
- package/dist/components/bindable/BindableRadio.js +2 -2
- package/dist/components/bindable/BindableSelect.d.ts +13 -10
- package/dist/components/bindable/BindableSelect.d.ts.map +1 -1
- package/dist/components/bindable/BindableSelectNaive.js +3 -3
- package/dist/components/bindable/BindableTextarea.d.ts +7 -7
- package/dist/components/bindable/BindableTextarea.d.ts.map +1 -1
- package/dist/components/bindable/bindableCandidates.comparison.d.ts +136 -0
- package/dist/components/bindable/bindableCandidates.comparison.d.ts.map +1 -0
- package/dist/components/bindable/bindableCandidates.comparison.js +268 -0
- package/dist/components/bindable/bindableProps.types.test.d.ts +50 -0
- package/dist/components/bindable/bindableProps.types.test.d.ts.map +1 -0
- package/dist/components/bindable/bindableProps.types.test.js +252 -0
- package/dist/components/library/RichTextEditor/RichTextEditor.d.ts.map +1 -1
- package/dist/components/library/RichTextEditor/contentTree.d.ts.map +1 -1
- package/dist/components/makeTypedLink.d.ts +9 -0
- package/dist/components/makeTypedLink.d.ts.map +1 -0
- package/dist/components/makeTypedLink.js +15 -0
- package/dist/context/registerContext.d.ts +22 -0
- package/dist/context/registerContext.d.ts.map +1 -0
- package/dist/context/registerContext.js +18 -0
- package/dist/env/getEnvSchemas.d.ts.map +1 -1
- package/dist/env/getEnvSchemas.js +2 -1
- package/dist/fileVersions.d.ts +9 -0
- package/dist/fileVersions.d.ts.map +1 -0
- package/dist/fileVersions.js +28 -0
- package/dist/findUserConfig.d.ts +1 -1
- package/dist/findUserConfig.d.ts.map +1 -1
- package/dist/findUserConfig.js +2 -1
- package/dist/frameworkConfigSchema.d.ts +16 -2
- package/dist/frameworkConfigSchema.d.ts.map +1 -1
- package/dist/frameworkConfigSchema.js +15 -3
- package/dist/getComponent.d.ts.map +1 -1
- package/dist/getComponent.js +4 -3
- package/dist/getRoutes.d.ts.map +1 -1
- package/dist/getRoutes.js +9 -8
- package/dist/getUserConfig.d.ts.map +1 -1
- package/dist/hmr/applyHmrModule.d.ts.map +1 -1
- package/dist/hmr/componentIdentity.js +1 -1
- package/dist/hooks/getCurrentComponent.d.ts +1 -1
- package/dist/hooks/getCurrentComponent.d.ts.map +1 -1
- package/dist/hydrate/hydrate.d.ts +5 -1
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +86 -52
- package/dist/hydrate/hydrateGlobalData.d.ts +4 -3
- package/dist/hydrate/hydrateGlobalData.d.ts.map +1 -1
- package/dist/hydrate/reconcileHydratedAttributes.d.ts +2 -1
- package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
- package/dist/hydrate/reconcileHydratedAttributes.js +4 -3
- package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -1
- package/dist/hydrate/renderHydrationMismatchBanner.js +2 -1
- package/dist/hydrate/stubRouting.d.ts +8 -0
- package/dist/hydrate/stubRouting.d.ts.map +1 -0
- package/dist/hydrate/stubRouting.js +25 -0
- package/dist/importDevModuleWithRetry.d.ts +2 -1
- package/dist/importDevModuleWithRetry.d.ts.map +1 -1
- package/dist/importDevModuleWithRetry.js +2 -1
- package/dist/importModule.d.ts +3 -0
- package/dist/importModule.d.ts.map +1 -0
- package/dist/importModule.js +4 -0
- package/dist/index.js +2 -1
- package/dist/indexInner.d.ts +30 -7
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +37 -2
- package/dist/json.d.ts +12 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +8 -0
- package/dist/jsxHelpers.d.ts +3 -0
- package/dist/jsxHelpers.d.ts.map +1 -0
- package/dist/jsxHelpers.js +6 -0
- package/dist/jsxRuntime.d.ts +1 -0
- package/dist/jsxRuntime.d.ts.map +1 -1
- package/dist/jsxRuntime.js +3 -1
- package/dist/jsxRuntimeSignals.d.ts.map +1 -1
- package/dist/jsxRuntimeSignals.js +1 -0
- package/dist/makeFinalConfig.d.ts.map +1 -1
- package/dist/makeFinalConfig.js +2 -0
- package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
- package/dist/makeInstanceConfigFromFrameworkConfig.js +2 -0
- package/dist/mergeConfigs.d.ts.map +1 -1
- package/dist/mergeConfigs.js +2 -6
- package/dist/nbsp.d.ts +1 -2
- package/dist/nbsp.d.ts.map +1 -1
- package/dist/nbsp.js +3 -7
- package/dist/objectMap.d.ts +1 -1
- package/dist/objectMap.d.ts.map +1 -1
- package/dist/pipeline/PipelineRequestHandler.d.ts +25 -0
- package/dist/pipeline/PipelineRequestHandler.d.ts.map +1 -0
- package/dist/pipeline/PipelineRequestHandler.js +104 -0
- package/dist/pipeline/contextStore.d.ts +12 -0
- package/dist/pipeline/contextStore.d.ts.map +1 -0
- package/dist/pipeline/contextStore.js +13 -0
- package/dist/pipeline/hydratePipeline.d.ts +4 -0
- package/dist/pipeline/hydratePipeline.d.ts.map +1 -0
- package/dist/pipeline/hydratePipeline.js +83 -0
- package/dist/pipeline/importRoutesModule.d.ts +6 -0
- package/dist/pipeline/importRoutesModule.d.ts.map +1 -0
- package/dist/pipeline/importRoutesModule.js +33 -0
- package/dist/pipeline/networkedTransport.d.ts +11 -0
- package/dist/pipeline/networkedTransport.d.ts.map +1 -0
- package/dist/pipeline/networkedTransport.js +54 -0
- package/dist/pipeline/pipeline.d.ts +107 -0
- package/dist/pipeline/pipeline.d.ts.map +1 -0
- package/dist/pipeline/pipeline.js +113 -0
- package/dist/pipeline/pipeline.types.test.d.ts +760 -0
- package/dist/pipeline/pipeline.types.test.d.ts.map +1 -0
- package/dist/pipeline/pipeline.types.test.js +344 -0
- package/dist/pipeline/pipelineDefinition.d.ts +78 -0
- package/dist/pipeline/pipelineDefinition.d.ts.map +1 -0
- package/dist/pipeline/pipelineDefinition.js +11 -0
- package/dist/pipeline/pipelineSplit.types.test.d.ts +2445 -0
- package/dist/pipeline/pipelineSplit.types.test.d.ts.map +1 -0
- package/dist/pipeline/pipelineSplit.types.test.js +440 -0
- package/dist/pipeline/runPipeline.d.ts +29 -0
- package/dist/pipeline/runPipeline.d.ts.map +1 -0
- package/dist/pipeline/runPipeline.js +71 -0
- package/dist/pipeline/runSplitPipeline.d.ts +10 -0
- package/dist/pipeline/runSplitPipeline.d.ts.map +1 -0
- package/dist/pipeline/runSplitPipeline.js +52 -0
- package/dist/pipeline/splitPipeline.d.ts +62 -0
- package/dist/pipeline/splitPipeline.d.ts.map +1 -0
- package/dist/pipeline/splitPipeline.js +76 -0
- package/dist/pop.js +1 -1
- package/dist/rawHtml/filterContentNode.d.ts.map +1 -1
- package/dist/render/HeadData.d.ts +3 -1
- package/dist/render/HeadData.d.ts.map +1 -1
- package/dist/render/classComponentNodeToRenderingTree.d.ts.map +1 -1
- package/dist/render/componentNodeToRenderingTree.d.ts.map +1 -1
- package/dist/render/contentToHtml.d.ts +2 -2
- package/dist/render/contentToHtml.d.ts.map +1 -1
- package/dist/render/contentToHtml.js +2 -1
- package/dist/render/contentToHtmlDev.d.ts +1 -1
- package/dist/render/contentToHtmlDev.d.ts.map +1 -1
- package/dist/render/contentTreeToRenderingTree.d.ts.map +1 -1
- package/dist/render/contentTreeToRenderingTree.js +6 -2
- package/dist/render/functionComponentNodeToRenderingTree.d.ts.map +1 -1
- package/dist/render/functionComponentNodeToRenderingTree.js +2 -2
- package/dist/render/instantiateComponent.d.ts.map +1 -1
- package/dist/render/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +12 -18
- package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
- package/dist/render/renderingTreeToHtml.js +6 -3
- package/dist/render/rootToHtml.d.ts +2 -2
- package/dist/render/rootToHtml.d.ts.map +1 -1
- package/dist/requests/fetch/delete.d.ts.map +1 -1
- package/dist/requests/fetch/delete.js +5 -2
- package/dist/requests/fetch/get.js +1 -1
- package/dist/requests/fetch/patch.d.ts.map +1 -1
- package/dist/requests/fetch/patch.js +5 -2
- package/dist/requests/fetch/post.d.ts.map +1 -1
- package/dist/requests/fetch/post.js +5 -2
- package/dist/requests/fetch/put.d.ts.map +1 -1
- package/dist/requests/fetch/put.js +5 -2
- package/dist/routesLocationParts.d.ts +6 -0
- package/dist/routesLocationParts.d.ts.map +1 -0
- package/dist/routesLocationParts.js +10 -0
- package/dist/routing/AppRoutes.d.ts +5 -3
- package/dist/routing/AppRoutes.d.ts.map +1 -1
- package/dist/routing/MatchedRouteInfo.d.ts +13 -0
- package/dist/routing/MatchedRouteInfo.d.ts.map +1 -0
- package/dist/routing/MatchedRouteInfo.js +1 -0
- package/dist/routing/RouteContentFunction.d.ts +1 -2
- package/dist/routing/RouteContentFunction.d.ts.map +1 -1
- package/dist/routing/RouteDataFunction.type.d.ts +4 -2
- package/dist/routing/RouteDataFunction.type.d.ts.map +1 -1
- package/dist/routing/RoutePaths.d.ts +12 -0
- package/dist/routing/RoutePaths.d.ts.map +1 -0
- package/dist/routing/RouteTypes.d.ts +6 -4
- package/dist/routing/RouteTypes.d.ts.map +1 -1
- package/dist/routing/Routes.d.ts +20 -11
- package/dist/routing/Routes.d.ts.map +1 -1
- package/dist/routing/RoutesFunction.d.ts +11 -2
- package/dist/routing/RoutesFunction.d.ts.map +1 -1
- package/dist/routing/Serializable.d.ts +5 -0
- package/dist/routing/Serializable.d.ts.map +1 -0
- package/dist/routing/Serializable.js +1 -0
- package/dist/routing/builder.d.ts +100 -0
- package/dist/routing/builder.d.ts.map +1 -0
- package/dist/routing/builder.js +219 -0
- package/dist/routing/builder.trial.d.ts +2 -0
- package/dist/routing/builder.trial.d.ts.map +1 -0
- package/dist/routing/builder.trial.js +85 -0
- package/dist/routing/defineRoutes.d.ts +8 -0
- package/dist/routing/defineRoutes.d.ts.map +1 -0
- package/dist/routing/defineRoutes.js +3 -0
- package/dist/routing/pyramidRouting.d.ts +2 -0
- package/dist/routing/pyramidRouting.d.ts.map +1 -0
- package/dist/routing/pyramidRouting.js +13 -0
- package/dist/routing/redirectOf.d.ts +11 -0
- package/dist/routing/redirectOf.d.ts.map +1 -0
- package/dist/routing/redirectOf.js +32 -0
- package/dist/routing/registerGlobalData.d.ts +11 -3
- package/dist/routing/registerGlobalData.d.ts.map +1 -1
- package/dist/routing/registerGlobalData.js +6 -0
- package/dist/routing/registerParts.types.test.d.ts +2 -0
- package/dist/routing/registerParts.types.test.d.ts.map +1 -0
- package/dist/routing/registerParts.types.test.js +139 -0
- package/dist/routing/registerRoutes.d.ts +10 -0
- package/dist/routing/registerRoutes.d.ts.map +1 -0
- package/dist/routing/registerRoutes.js +9 -0
- package/dist/routing/registerRouting.d.ts +36 -0
- package/dist/routing/registerRouting.d.ts.map +1 -0
- package/dist/routing/registerRouting.js +34 -0
- package/dist/routing/registerRouting.types.test.d.ts +80 -0
- package/dist/routing/registerRouting.types.test.d.ts.map +1 -0
- package/dist/routing/registerRouting.types.test.js +120 -0
- package/dist/routing/registrationTypes.d.ts +11 -0
- package/dist/routing/registrationTypes.d.ts.map +1 -0
- package/dist/routing/registrationTypes.js +1 -0
- package/dist/routing/resolveAppRoutes.d.ts +5 -0
- package/dist/routing/resolveAppRoutes.d.ts.map +1 -0
- package/dist/routing/resolveAppRoutes.js +25 -0
- package/dist/routing/routesArray.d.ts +23 -0
- package/dist/routing/routesArray.d.ts.map +1 -0
- package/dist/routing/routesArray.js +20 -0
- package/dist/routing/routesArray.types.test.d.ts +2 -0
- package/dist/routing/routesArray.types.test.d.ts.map +1 -0
- package/dist/routing/routesArray.types.test.js +132 -0
- package/dist/routing/routingBuilder.d.ts +34 -0
- package/dist/routing/routingBuilder.d.ts.map +1 -0
- package/dist/routing/routingBuilder.js +32 -0
- package/dist/routing/routingBuilder.types.test.d.ts +2 -0
- package/dist/routing/routingBuilder.types.test.d.ts.map +1 -0
- package/dist/routing/routingBuilder.types.test.js +171 -0
- package/dist/routing/routingRegistry.d.ts +19 -0
- package/dist/routing/routingRegistry.d.ts.map +1 -0
- package/dist/routing/routingRegistry.js +29 -0
- package/dist/staticGen/getAppRoutes.d.ts +2 -2
- package/dist/staticGen/getAppRoutes.d.ts.map +1 -1
- package/dist/staticGen/getAppRoutes.js +9 -6
- package/dist/staticGen/staticGen.d.ts.map +1 -1
- package/dist/staticGen/staticGen.js +8 -2
- package/dist/style/styleContentSxy.d.ts.map +1 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +2 -0
- package/dist/syncServer/index.cjs +1 -2
- package/dist/syncServer/preload.js +2 -0
- package/dist/testing/contentToString.d.ts +13 -0
- package/dist/testing/contentToString.d.ts.map +1 -0
- package/dist/testing/contentToString.js +105 -0
- package/dist/testing/createTestApp.d.ts +25 -1
- package/dist/testing/createTestApp.d.ts.map +1 -1
- package/dist/testing/createTestApp.js +12 -3
- package/dist/testing/display.d.ts +2 -0
- package/dist/testing/display.d.ts.map +1 -0
- package/dist/testing/display.js +37 -0
- package/dist/testing/ensure.d.ts +119 -0
- package/dist/testing/ensure.d.ts.map +1 -0
- package/dist/testing/ensure.js +664 -0
- package/dist/testing/ensure.trial.d.ts +2 -0
- package/dist/testing/ensure.trial.d.ts.map +1 -0
- package/dist/testing/ensure.trial.js +9 -0
- package/dist/testing/ensure.types.test.d.ts +2 -0
- package/dist/testing/ensure.types.test.d.ts.map +1 -0
- package/dist/testing/ensure.types.test.js +34 -0
- package/dist/testing/helpers/contentHtmlElements.d.ts.map +1 -1
- package/dist/testing/host.d.ts +86 -15
- package/dist/testing/host.d.ts.map +1 -1
- package/dist/testing/host.js +82 -23
- package/dist/testing/host.types.test.d.ts +2 -0
- package/dist/testing/host.types.test.d.ts.map +1 -0
- package/dist/testing/host.types.test.js +81 -0
- package/dist/testing/hydrateTestApp.d.ts +17 -0
- package/dist/testing/hydrateTestApp.d.ts.map +1 -1
- package/dist/testing/hydrateTestApp.js +27 -6
- package/dist/testing/index.d.ts +5 -3
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +3 -1
- package/dist/testing/pipeline/createTestPacketApp.d.ts +30 -0
- package/dist/testing/pipeline/createTestPacketApp.d.ts.map +1 -0
- package/dist/testing/pipeline/createTestPacketApp.js +45 -0
- package/dist/testing/pipeline/createTestPacketApp.types.test.d.ts +3 -0
- package/dist/testing/pipeline/createTestPacketApp.types.test.d.ts.map +1 -0
- package/dist/testing/pipeline/createTestPacketApp.types.test.js +101 -0
- package/dist/testing/pipeline/createTestPipelineApp.d.ts +70 -0
- package/dist/testing/pipeline/createTestPipelineApp.d.ts.map +1 -0
- package/dist/testing/pipeline/createTestPipelineApp.js +90 -0
- package/dist/testing/pipeline/createTestPipelineApp.types.test.d.ts +6 -0
- package/dist/testing/pipeline/createTestPipelineApp.types.test.d.ts.map +1 -0
- package/dist/testing/pipeline/createTestPipelineApp.types.test.js +146 -0
- package/dist/testing/pipeline/hostPipeline.d.ts +25 -0
- package/dist/testing/pipeline/hostPipeline.d.ts.map +1 -0
- package/dist/testing/pipeline/hostPipeline.js +18 -0
- package/dist/testing/pipeline/hydrateTestPipelineApp.d.ts +30 -0
- package/dist/testing/pipeline/hydrateTestPipelineApp.d.ts.map +1 -0
- package/dist/testing/pipeline/hydrateTestPipelineApp.js +193 -0
- package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.d.ts +2 -0
- package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.d.ts.map +1 -0
- package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.js +27 -0
- package/dist/testing/pipeline/index.d.ts +5 -0
- package/dist/testing/pipeline/index.d.ts.map +1 -0
- package/dist/testing/pipeline/index.js +4 -0
- package/dist/testing/pipeline/pipelineTestApp.d.ts +34 -0
- package/dist/testing/pipeline/pipelineTestApp.d.ts.map +1 -0
- package/dist/testing/pipeline/pipelineTestApp.js +100 -0
- package/dist/testing/pipeline/testPipelineRoute.d.ts +2 -0
- package/dist/testing/pipeline/testPipelineRoute.d.ts.map +1 -0
- package/dist/testing/pipeline/testPipelineRoute.js +1 -0
- package/dist/testing/resolveContent.d.ts +18 -0
- package/dist/testing/resolveContent.d.ts.map +1 -0
- package/dist/testing/resolveContent.js +73 -0
- package/dist/testing/testingComponentPackage.d.ts +3 -1
- package/dist/testing/testingComponentPackage.d.ts.map +1 -1
- package/dist/testing/testingComponentPackage.js +16 -1
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +35 -31
- package/dist/update/integrateUpdateVdomPrebuild.js +20 -20
- package/dist/validChildren.d.ts.map +1 -1
- package/dist/zones/react.d.ts.map +1 -1
- package/package.json +23 -19
- package/types/helpers.d.ts +11 -2
- package/types/jsx/html.d.ts +29 -25
- package/types/jsx/jsx.d.ts +8 -8
- package/types/modules.d.ts +14 -3
- package/types/testing.d.ts +0 -0
- package/vendor/babel-core.js +5 -5
- package/vendor/babel-parser.js +1 -1
- package/vendor/babel-preset-react.js +32 -34
- package/vendor/babel-preset-typescript.js +5 -5
- package/vendor/chalk-extensions.js +3 -146
- package/vendor/chokidar.js +311 -5
- package/vendor/chunk-B34JUlnS.js +169 -0
- package/vendor/{chunk-Bu8ZRE-c.js → chunk-B9ttgKqg.js} +28 -25
- package/vendor/{chunk-D2EnpcLg.js → chunk-BGvapINa.js} +3 -164
- package/vendor/{chunk-Cqrj-Zqr.js → chunk-BmAiqUzD.js} +22 -8
- package/vendor/{chunk-BiUcnLhT.js → chunk-But4T5N_.js} +8 -3
- package/vendor/{chunk-OUnVY4Wm.js → chunk-DuR6SGzI.js} +162 -35
- package/vendor/css-select.js +3383 -0
- package/vendor/dotenv.js +2 -2
- package/vendor/express.js +61 -10
- package/vendor/manifest.json +4 -3
- package/vendor/postcss.js +1 -1
- package/vendor/precinct.js +5914 -3591
- package/vendor/valibot.js +418 -504
- package/dist/Servers/MatchedRouteInfo.d.ts +0 -11
- package/dist/Servers/MatchedRouteInfo.d.ts.map +0 -1
- package/dist/routing/__fluentRouteBuilder.d.ts +0 -80
- package/dist/routing/__fluentRouteBuilder.d.ts.map +0 -1
- package/dist/routing/__fluentRouteBuilder.js +0 -183
- package/dist/routing/__fluentRoutes.d.ts +0 -2
- package/dist/routing/__fluentRoutes.d.ts.map +0 -1
- package/dist/routing/__fluentRoutes.js +0 -59
- package/vendor/chunk-Hy-cCmu-.js +0 -23
- /package/dist/{Servers/MatchedRouteInfo.js → routing/RoutePaths.js} +0 -0
|
@@ -15,18 +15,28 @@ import { makeInstanceConfigFromFrameworkConfig } from '../makeInstanceConfigFrom
|
|
|
15
15
|
import { standardizeWebPath } from '../standardizeWebPath.js';
|
|
16
16
|
import { throwError } from '../throwError.js';
|
|
17
17
|
import { serveStatic } from './serveStatic.js';
|
|
18
|
+
import { cacheVersioned } from './cacheVersioned.js';
|
|
19
|
+
import { $cacheControl, cacheControlHeader, pageCacheControl } from '../cacheControl.js';
|
|
18
20
|
import { routing } from "./routing.js";
|
|
19
21
|
import { globalDataFunc } from '../routing/registerGlobalData.js';
|
|
20
22
|
import { TungstenServer } from "./TungstenServer.js";
|
|
21
23
|
import { portError } from './portError.js';
|
|
22
24
|
import { initStores } from './initStores.js';
|
|
25
|
+
import { createContext } from '../context/registerContext.js';
|
|
26
|
+
import { createNetworkedData } from '../routing/routingRegistry.js';
|
|
23
27
|
import { makeTungstenErrorInfo } from '../routing/TungstenErrorInfo.js';
|
|
28
|
+
import { responseStatus } from '../routing/MatchedRouteInfo.js';
|
|
29
|
+
import { toRoutes } from '../routing/routesArray.js';
|
|
24
30
|
import { listenVerified, newBootId, registerBootProbe } from './listenVerified.js';
|
|
31
|
+
import { PipelineRequestHandler } from '../pipeline/PipelineRequestHandler.js';
|
|
32
|
+
import { sendStub, stubInstance } from './stubInstance.js';
|
|
25
33
|
function debug(...texts) {
|
|
26
34
|
// console.log(...texts)
|
|
27
35
|
}
|
|
28
36
|
export class ProdServer extends TungstenServer {
|
|
29
|
-
constructor(framework, _config, compilationInfo, _appRoutes, _RootComponentOrNull, serverMiddleware
|
|
37
|
+
constructor(framework, _config, compilationInfo, _appRoutes, _RootComponentOrNull, serverMiddleware,
|
|
38
|
+
// config.registration 'pipeline': the routes module's app, in place of appRoutes
|
|
39
|
+
pipelineApp = null) {
|
|
30
40
|
super();
|
|
31
41
|
_defineProperty(this, "framework", void 0);
|
|
32
42
|
_defineProperty(this, "config", void 0);
|
|
@@ -48,6 +58,8 @@ export class ProdServer extends TungstenServer {
|
|
|
48
58
|
_defineProperty(this, "apiRoutes", void 0);
|
|
49
59
|
_defineProperty(this, "server", void 0);
|
|
50
60
|
_defineProperty(this, "bootId", newBootId());
|
|
61
|
+
// pages: the classic handleRequest, or the pipeline's (config.registration)
|
|
62
|
+
_defineProperty(this, "requestHandler", void 0);
|
|
51
63
|
// private addServerMiddleware = (serverMiddleware: ServerMiddlewareInfo): void => {
|
|
52
64
|
// const [middlewareFile, middlewareExportName, middlewarePath] = serverMiddleware
|
|
53
65
|
// const fullFilePath = 'file://' + join(this.compilationInfo.codeLocation, middlewareFile)
|
|
@@ -100,6 +112,9 @@ export class ProdServer extends TungstenServer {
|
|
|
100
112
|
// app's error route with the real global data (theme colour, username, ...) rather
|
|
101
113
|
// than framework defaults, when it did resolve.
|
|
102
114
|
let capturedGlobalData = {};
|
|
115
|
+
// this request's context, for the error route to reuse
|
|
116
|
+
let capturedContext = {};
|
|
117
|
+
let capturedNetworkedData = {};
|
|
103
118
|
try {
|
|
104
119
|
const location = req.url;
|
|
105
120
|
const instanceConfig = makeInstanceConfigFromFrameworkConfig(this.config);
|
|
@@ -109,6 +124,15 @@ export class ProdServer extends TungstenServer {
|
|
|
109
124
|
if (this.framework.clientImportAliases === undefined) {
|
|
110
125
|
throwError('ProdServer.handleRequest()', 'framework.clientImportAliases is undefined');
|
|
111
126
|
}
|
|
127
|
+
if (this.config.serverSideRouting === false) {
|
|
128
|
+
const reqRes = {
|
|
129
|
+
req,
|
|
130
|
+
res
|
|
131
|
+
};
|
|
132
|
+
const instance = stubInstance(location, instanceConfig, reqRes, this.appRoutes);
|
|
133
|
+
sendStub(reqRes, this.config.defaultCacheControl, await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, this.stubRoot(), instance, this.config, this.config.siteBasePath));
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
112
136
|
// const appRoutes: AppRoutes = await getRoutes(this.compilationInfo, this.config)
|
|
113
137
|
// let RootComponentClass: AnyComponentType
|
|
114
138
|
// if (this.config.useRootComponent) {
|
|
@@ -130,11 +154,15 @@ export class ProdServer extends TungstenServer {
|
|
|
130
154
|
const serverDataLoading = {
|
|
131
155
|
value: false
|
|
132
156
|
};
|
|
133
|
-
const
|
|
134
|
-
|
|
157
|
+
const context = createContext('server', reqRes);
|
|
158
|
+
capturedContext = context;
|
|
159
|
+
const networkedData = createNetworkedData(reqRes, context);
|
|
160
|
+
capturedNetworkedData = networkedData;
|
|
161
|
+
const routes = toRoutes(typeof appRoutes === 'function' ? appRoutes(reqRes, context, networkedData) : appRoutes, false);
|
|
162
|
+
const [globalData, matchedRouteInfo] = await Promise.all([globalDataFunc.value !== undefined ? globalDataFunc.value(reqRes, context, networkedData).then(globalData => {
|
|
135
163
|
capturedGlobalData = globalData;
|
|
136
164
|
return globalData;
|
|
137
|
-
}) : {}, routing(location, routes, serverDataLoading)]);
|
|
165
|
+
}) : {}, routing(location, routes, context, networkedData, serverDataLoading)]);
|
|
138
166
|
//instance.matchedRouteInfo =
|
|
139
167
|
//cliTodo('Can we move redirect handling to base class?')
|
|
140
168
|
// // 2025-03-14 copied this code here from Dev server,
|
|
@@ -159,8 +187,11 @@ export class ProdServer extends TungstenServer {
|
|
|
159
187
|
internalStore,
|
|
160
188
|
stores,
|
|
161
189
|
storeSubscriptions
|
|
162
|
-
} = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading);
|
|
190
|
+
} = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading, context, networkedData);
|
|
163
191
|
const instance = new Instance(location, instanceConfig, reqRes, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
|
|
192
|
+
instance.fileVersions = this.compilationInfo.fileVersions;
|
|
193
|
+
instance.context = context;
|
|
194
|
+
instance.networkedData = networkedData;
|
|
164
195
|
let html;
|
|
165
196
|
if (RootComponentOrNull !== null) {
|
|
166
197
|
html = await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, RootComponentOrNull, instance, config, this.config.siteBasePath);
|
|
@@ -182,13 +213,20 @@ export class ProdServer extends TungstenServer {
|
|
|
182
213
|
if (instance.redirected !== undefined) return;
|
|
183
214
|
//debug('html', html)
|
|
184
215
|
res.setHeader('Content-Type', 'text/html');
|
|
185
|
-
|
|
216
|
+
// server middleware ran first, and a Cache-Control it set stands
|
|
217
|
+
if (res.getHeader('Cache-Control') === undefined) {
|
|
218
|
+
const key = instance.matchedRouteInfo.key;
|
|
219
|
+
const byKey = routes;
|
|
220
|
+
const cacheControl = pageCacheControl(key !== null && Object.hasOwn(routes, key) ? byKey[key] : undefined, routes[$cacheControl], this.config.defaultCacheControl, reqRes);
|
|
221
|
+
if (cacheControl !== undefined) res.setHeader('Cache-Control', cacheControlHeader(cacheControl));
|
|
222
|
+
}
|
|
223
|
+
res.status(responseStatus(instance.matchedRouteInfo));
|
|
186
224
|
res.send(html);
|
|
187
225
|
} catch (e) {
|
|
188
226
|
cliLog('handleRequest() error', e);
|
|
189
227
|
// too late for an error page once a redirect has gone out
|
|
190
228
|
if (res.headersSent) return;
|
|
191
|
-
const errorRouteHtml = await this.tryRenderErrorRoute(req, res, capturedGlobalData, e);
|
|
229
|
+
const errorRouteHtml = await this.tryRenderErrorRoute(req, res, capturedGlobalData, capturedContext, capturedNetworkedData, e);
|
|
192
230
|
res.setHeader('Content-Type', 'text/html');
|
|
193
231
|
res.status(500);
|
|
194
232
|
res.send(errorRouteHtml ?? this.errorPage());
|
|
@@ -202,7 +240,7 @@ export class ProdServer extends TungstenServer {
|
|
|
202
240
|
// actually defines an 'error' route. Never throws - falls back to null (the caller's
|
|
203
241
|
// default error page) on any failure, since we're already handling one error and can't
|
|
204
242
|
// risk a second, unhandled one taking the server down.
|
|
205
|
-
_defineProperty(this, "tryRenderErrorRoute", async (req, res, globalData, error) => {
|
|
243
|
+
_defineProperty(this, "tryRenderErrorRoute", async (req, res, globalData, context, networkedData, error) => {
|
|
206
244
|
try {
|
|
207
245
|
if (this.framework.clientImportAliases === undefined) {
|
|
208
246
|
throwError('ProdServer.tryRenderErrorRoute()', 'framework.clientImportAliases is undefined');
|
|
@@ -216,7 +254,7 @@ export class ProdServer extends TungstenServer {
|
|
|
216
254
|
req,
|
|
217
255
|
res
|
|
218
256
|
};
|
|
219
|
-
const routes = typeof appRoutes === 'function' ? appRoutes(reqRes) : appRoutes;
|
|
257
|
+
const routes = toRoutes(typeof appRoutes === 'function' ? appRoutes(reqRes, context, networkedData) : appRoutes, false);
|
|
220
258
|
const errorRouteDef = routes.error;
|
|
221
259
|
if (errorRouteDef === undefined) return null;
|
|
222
260
|
const location = req.url;
|
|
@@ -234,8 +272,11 @@ export class ProdServer extends TungstenServer {
|
|
|
234
272
|
internalStore,
|
|
235
273
|
stores,
|
|
236
274
|
storeSubscriptions
|
|
237
|
-
} = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading);
|
|
275
|
+
} = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading, context, networkedData);
|
|
238
276
|
const instance = new Instance(location, instanceConfig, reqRes, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
|
|
277
|
+
instance.fileVersions = this.compilationInfo.fileVersions;
|
|
278
|
+
instance.context = context;
|
|
279
|
+
instance.networkedData = networkedData;
|
|
239
280
|
if (RootComponentOrNull !== null) {
|
|
240
281
|
return await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, RootComponentOrNull, instance, config, this.config.siteBasePath);
|
|
241
282
|
}
|
|
@@ -255,6 +296,12 @@ export class ProdServer extends TungstenServer {
|
|
|
255
296
|
return null;
|
|
256
297
|
}
|
|
257
298
|
});
|
|
299
|
+
_defineProperty(this, "stubRoot", () => {
|
|
300
|
+
if (this.RootComponentOrNull === null) {
|
|
301
|
+
throwError('ProdServer', 'config.serverSideRouting is false, which needs a root component');
|
|
302
|
+
}
|
|
303
|
+
return this.RootComponentOrNull;
|
|
304
|
+
});
|
|
258
305
|
_defineProperty(this, "errorPage", () => {
|
|
259
306
|
return `<!DOCTYPE html>
|
|
260
307
|
<html>
|
|
@@ -323,7 +370,7 @@ export class ProdServer extends TungstenServer {
|
|
|
323
370
|
cliWarn(`Received a request from the frontend, but it did not arrive at the` + ` address the frontend was loaded from. This may indicate a` + ` misconfiguration, and may prevent the passing of cookies to the` + ` tungsten server.`);
|
|
324
371
|
cliWarn(`request: ${target}`);
|
|
325
372
|
cliWarn(`loaded from: ${origin}`);
|
|
326
|
-
cliWarn(`arrived at: ${host}`);
|
|
373
|
+
cliWarn(`arrived at: ${this.arrivedAt(host, req.protocol)}`);
|
|
327
374
|
cliWarn(`Further mismatches on ${host} are silenced for 24 hours`);
|
|
328
375
|
}
|
|
329
376
|
}
|
|
@@ -342,16 +389,18 @@ export class ProdServer extends TungstenServer {
|
|
|
342
389
|
if (this.compilationInfo.bundleLocation === undefined) {
|
|
343
390
|
throwError('ProdServer', 'compilationInfo.bundleLocation is unset/undefined');
|
|
344
391
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
this.app.use(
|
|
392
|
+
// ?v= urls (processHead, <Stylesheet>) are long-cached when v is the served file's hash
|
|
393
|
+
const serveVersioned = root => [cacheVersioned(root), serveStatic(root)];
|
|
394
|
+
this.app.use('/bundle', serveVersioned(this.compilationInfo.bundleLocation));
|
|
395
|
+
this.app.use(`/${componentCssFolder}/`, serveVersioned(join(this.compilationInfo.buildLocation, componentCssFolder)));
|
|
396
|
+
this.app.use(`/${frameworkCssFolder}/`, serveVersioned(join(this.compilationInfo.buildLocation, frameworkCssFolder)));
|
|
348
397
|
const publicLocation = join(this.compilationInfo.buildLocation, publicFolder);
|
|
349
398
|
//console.log('publicLocation', publicLocation, existsSync(publicLocation))
|
|
350
|
-
if (existsSync(publicLocation)) this.app.use(
|
|
399
|
+
if (existsSync(publicLocation)) this.app.use(serveVersioned(publicLocation)); // files from public folder
|
|
351
400
|
//console.log("serving static files with etag")
|
|
352
|
-
this.app.use(
|
|
401
|
+
this.app.use(serveVersioned(join(this.compilationInfo.buildLocation, staticFolder)));
|
|
353
402
|
if (this.config.assetsDir !== undefined) {
|
|
354
|
-
this.app.use('/assets',
|
|
403
|
+
this.app.use('/assets', serveVersioned(join(this.compilationInfo.buildLocation, assetsFolder)));
|
|
355
404
|
}
|
|
356
405
|
this.app.use(`/${this.compilationInfo.codeSubPath}`, serveStatic(this.compilationInfo.buildCodeLocation));
|
|
357
406
|
if (typeof _config.apiRoutes === 'string' && _config.apiRoutes !== '') {
|
|
@@ -360,7 +409,29 @@ export class ProdServer extends TungstenServer {
|
|
|
360
409
|
this.app.use(apiPath, express.json());
|
|
361
410
|
this.app.use(apiPath, this.handleRequestApi);
|
|
362
411
|
}
|
|
363
|
-
this.
|
|
412
|
+
this.requestHandler = _config.registration === 'pipeline' ? new PipelineRequestHandler({
|
|
413
|
+
dev: false,
|
|
414
|
+
config: _config,
|
|
415
|
+
instanceConfig: () => makeInstanceConfigFromFrameworkConfig(this.config),
|
|
416
|
+
fileVersions: this.compilationInfo.fileVersions,
|
|
417
|
+
loadApp: async () => {
|
|
418
|
+
if (pipelineApp === null) {
|
|
419
|
+
throwError('ProdServer', `config.registration is 'pipeline', but no pipeline app was given`);
|
|
420
|
+
}
|
|
421
|
+
return Promise.resolve({
|
|
422
|
+
Root: this.RootComponentOrNull,
|
|
423
|
+
app: pipelineApp
|
|
424
|
+
});
|
|
425
|
+
},
|
|
426
|
+
render: async (Root, instance) => {
|
|
427
|
+
if (this.framework.clientImportAliases === undefined) {
|
|
428
|
+
throwError('ProdServer', 'framework.clientImportAliases is undefined');
|
|
429
|
+
}
|
|
430
|
+
return renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, Root, instance, this.config, this.config.siteBasePath);
|
|
431
|
+
},
|
|
432
|
+
errorPage: () => this.errorPage()
|
|
433
|
+
}).handle : this.handleRequest;
|
|
434
|
+
this.app.use(this.requestHandler);
|
|
364
435
|
}
|
|
365
436
|
// private async handlePost(req: express.Request, res: express.Response): Promise<void> {
|
|
366
437
|
// throw new TungstenError(`Err - Dev server received a post request. Not supported yet.`)
|
|
@@ -389,7 +460,12 @@ export class ProdServer extends TungstenServer {
|
|
|
389
460
|
// URL.host is the host header's own shape - a port only when it is not the public scheme's
|
|
390
461
|
// default, so an https site on 443 gives `site.example` rather than `site.example:443`
|
|
391
462
|
this.expectedHost = new URL(publicOrigin).host;
|
|
392
|
-
if (!mute)
|
|
463
|
+
if (!mute) {
|
|
464
|
+
cliNews(`${packageNameCapitalized} prod server ready at ${localOrigin}`);
|
|
465
|
+
if (localOrigin !== publicOrigin) {
|
|
466
|
+
cliNews(`Public URL: ${publicOrigin}`);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
393
469
|
return localOrigin;
|
|
394
470
|
}
|
|
395
471
|
// close() alone only stops new connections arriving - keep-alive sockets (fetch/undici
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Server } from 'http';
|
|
2
|
-
import type { FrameworkConfigComplete } from 'tungsten/FrameworkConfig.js';
|
|
3
2
|
import express from 'express';
|
|
3
|
+
import type { FrameworkConfigComplete } from '../FrameworkConfig.js';
|
|
4
4
|
export declare class StaticSiteServer {
|
|
5
5
|
config: FrameworkConfigComplete;
|
|
6
6
|
location?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticSiteServer.d.ts","sourceRoot":"","sources":["../../src/Servers/StaticSiteServer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"StaticSiteServer.d.ts","sourceRoot":"","sources":["../../src/Servers/StaticSiteServer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,OAAO,OAAO,MAAM,SAAS,CAAA;AAG7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAMpE,qBAAa,gBAAgB;IACzB,MAAM,EAAE,uBAAuB,CAAA;IAE/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,OAAO,CAAC,WAAW,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kBAAkB,EAAE,MAAM,CAAA;gBAEd,MAAM,EAAE,uBAAuB;IAa3C,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAW3B;IACD,IAAI,aAEH;CACJ"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Response as ExpressResponse } from 'express';
|
|
2
|
-
import type { MatchedRouteInfo } from '
|
|
2
|
+
import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
|
|
3
3
|
export declare class TungstenServer {
|
|
4
4
|
protected makeOrigin(proto: string, host: string, port: number): string;
|
|
5
|
+
protected arrivedAt(host: string, proto: string): string;
|
|
5
6
|
protected hostOfOrigin(origin: string): string | null;
|
|
6
7
|
protected handleRedirects(res: ExpressResponse, matchedRouteInfo: MatchedRouteInfo): boolean;
|
|
7
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TungstenServer.d.ts","sourceRoot":"","sources":["../../src/Servers/TungstenServer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,SAAS,CAAA;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TungstenServer.d.ts","sourceRoot":"","sources":["../../src/Servers/TungstenServer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,SAAS,CAAA;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAgBtE,qBAAa,cAAc;IAGvB,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAK9D,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAMxD,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAOrD,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO;CAoD/F"}
|
|
@@ -14,6 +14,13 @@ export class TungstenServer {
|
|
|
14
14
|
makeOrigin(proto, host, port) {
|
|
15
15
|
return new URL(`${proto}://${host}:${port}`).origin;
|
|
16
16
|
}
|
|
17
|
+
// A host header leaves the port out when the request went to the scheme's default, so name it:
|
|
18
|
+
// the port is the half of the address that is usually the misconfigured one
|
|
19
|
+
arrivedAt(host, proto) {
|
|
20
|
+
// an ipv6 host is bracketed, and carries a port only after the closing bracket
|
|
21
|
+
const stated = host.startsWith('[') ? host.includes(']:') : host.includes(':');
|
|
22
|
+
return stated ? host : `${host} (over port ${proto === 'https' ? 443 : 80})`;
|
|
23
|
+
}
|
|
17
24
|
// null for an origin that is not a URL - a sandboxed iframe or similar sends the literal `null`
|
|
18
25
|
hostOfOrigin(origin) {
|
|
19
26
|
try {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheVersioned.d.ts","sourceRoot":"","sources":["../../src/Servers/cacheVersioned.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAQ7C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAkB3D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { resolve, sep } from 'path';
|
|
2
|
+
import { fileVersion } from '../build/assetVersions.js';
|
|
3
|
+
// long-caches ?v= when v is the served file's hash, so an old server hit with a newer v pins nothing;
|
|
4
|
+
// prod files don't change while serving, so hashes are kept. serveStatic keeps a Cache-Control set
|
|
5
|
+
export function cacheVersioned(root) {
|
|
6
|
+
const base = resolve(root) + sep;
|
|
7
|
+
const versions = new Map();
|
|
8
|
+
return (req, res, next) => {
|
|
9
|
+
const v = req.query.v;
|
|
10
|
+
if (typeof v === 'string' && v !== '') {
|
|
11
|
+
let file;
|
|
12
|
+
try {
|
|
13
|
+
file = resolve(base, '.' + decodeURIComponent(req.path));
|
|
14
|
+
} catch {/* malformed escape: serveStatic answers it */}
|
|
15
|
+
if (file?.startsWith(base) === true) {
|
|
16
|
+
const version = versions.get(file) ?? fileVersion(file);
|
|
17
|
+
if (version !== undefined) versions.set(file, version);
|
|
18
|
+
if (version === v) res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
next();
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devErrorPageAutoRetry.d.ts","sourceRoot":"","sources":["../../src/Servers/devErrorPageAutoRetry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"devErrorPageAutoRetry.d.ts","sourceRoot":"","sources":["../../src/Servers/devErrorPageAutoRetry.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAGrC,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAqBlE;AAKD,eAAO,MAAM,4BAA4B,2EAC+B,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { StoreSubscriptionsMap } from '../Store/StoreSubscriptions.types.js';
|
|
2
2
|
import type { ServerDataLoading } from '../Store/ServerDataLoading.js';
|
|
3
3
|
import type { ReqRes } from '../ReqRes.js';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
|
|
5
|
+
import type { BrandedContext, BrandedGlobalData, BrandedNetworkedData } from '../Brands.js';
|
|
6
6
|
import { InternalStoreSchema } from '../Store/InternalStoreSchema.js';
|
|
7
7
|
import { type TrueStore } from '../Store/makeStore.js';
|
|
8
8
|
type InitStoresResult = {
|
|
@@ -10,7 +10,7 @@ type InitStoresResult = {
|
|
|
10
10
|
stores: TrueStore<any>[];
|
|
11
11
|
storeSubscriptions: StoreSubscriptionsMap;
|
|
12
12
|
};
|
|
13
|
-
export declare function initStores(location: string, reqResOrNull: ReqRes, globalData:
|
|
14
|
-
export declare function initStores(location: string, reqResOrNull: null, globalData:
|
|
13
|
+
export declare function initStores(location: string, reqResOrNull: ReqRes, globalData: BrandedGlobalData, matchedRouteInfo: MatchedRouteInfo, serverDataLoading: ServerDataLoading, context: BrandedContext, networkedData: BrandedNetworkedData): InitStoresResult;
|
|
14
|
+
export declare function initStores(location: string, reqResOrNull: null, globalData: BrandedGlobalData, matchedRouteInfo: MatchedRouteInfo, serverDataLoading: null, context: BrandedContext, networkedData: BrandedNetworkedData): InitStoresResult;
|
|
15
15
|
export {};
|
|
16
16
|
//# sourceMappingURL=initStores.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initStores.d.ts","sourceRoot":"","sources":["../../src/Servers/initStores.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"initStores.d.ts","sourceRoot":"","sources":["../../src/Servers/initStores.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,qBAAqB,EACxB,MAAM,sCAAsC,CAAA;AAG7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EACS,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAC3E,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAIjE,KAAK,gBAAgB,GAAG;IACpB,aAAa,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAA;IAC7C,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAA;IACxB,kBAAkB,EAAE,qBAAqB,CAAA;CAC5C,CAAA;AAID,wBAAgB,UAAU,CACtB,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EACrE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,EAAE,cAAc,EACjG,aAAa,EAAE,oBAAoB,GACpC,gBAAgB,CAAA;AAEnB,wBAAgB,UAAU,CACtB,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,iBAAiB,EACnE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EACpF,aAAa,EAAE,oBAAoB,GACpC,gBAAgB,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { InternalStoreSchema } from '../Store/InternalStoreSchema.js';
|
|
2
2
|
import { makeStore } from '../Store/makeStore.js';
|
|
3
3
|
import { createStores } from '../Store/createStores.js';
|
|
4
|
-
export function initStores(location, reqResOrNull, globalData, matchedRouteInfo, serverDataLoading =
|
|
4
|
+
export function initStores(location, reqResOrNull, globalData, matchedRouteInfo, serverDataLoading, context, networkedData = {}) {
|
|
5
5
|
const storeSubscriptions = new Map();
|
|
6
6
|
const internalStoreSubscribedElements = new Map();
|
|
7
7
|
const internalStore = makeStore(new InternalStoreSchema(location, matchedRouteInfo), internalStoreSubscribedElements, serverDataLoading);
|
|
8
8
|
storeSubscriptions.set(internalStore, internalStoreSubscribedElements);
|
|
9
|
-
const stores = createStores(reqResOrNull, matchedRouteInfo, globalData, storeSubscriptions, serverDataLoading);
|
|
9
|
+
const stores = createStores(reqResOrNull, matchedRouteInfo, globalData, storeSubscriptions, serverDataLoading, context, networkedData);
|
|
10
10
|
return {
|
|
11
11
|
internalStore,
|
|
12
12
|
stores,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadEnvsDev.d.ts","sourceRoot":"","sources":["../../src/Servers/loadEnvsDev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadEnvsDev.d.ts","sourceRoot":"","sources":["../../src/Servers/loadEnvsDev.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAYpE,KAAK,UAAU,GAAG;IACd,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;CACf,CAAA;AAED,wBAAsB,WAAW,CAC7B,MAAM,EAAE,uBAAuB,EAE/B,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,UAAU,EAC7B,UAAU,EAAE,OAAO,EACnB,eAAe,UAAQ,EAEvB,eAAe,CAAC,EAAE,MAAM,iBAkI3B"}
|
|
@@ -2,7 +2,7 @@ import { join } from 'path';
|
|
|
2
2
|
import { readFile as readFilePromise, access as accessPromise } from 'fs/promises';
|
|
3
3
|
import { remap as objectRemap, filter as objectFilter } from 'sxy-lib/objects.js';
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
|
-
import { throwError } from '
|
|
5
|
+
import { throwError } from '../throwError.js';
|
|
6
6
|
import { getEnvSchemasDev } from '../env/getEnvSchemas.js';
|
|
7
7
|
import { cliLog, cliOut, cliWarn } from '../cliOutput.js';
|
|
8
8
|
import { droppedCoreEnvKeys, droppedCoreEnvWarning } from '../env/droppedCoreEnvKeys.js';
|
|
@@ -10,6 +10,7 @@ import { addToEnv } from '../env/addToEnv.js';
|
|
|
10
10
|
import { tungstenCorePrivateEnvSchema } from './tungstenCorePrivateEnvSchema.js';
|
|
11
11
|
import { tungstenCorePublicEnvSchema } from './tungstenCorePublicEnvSchema.js';
|
|
12
12
|
import { checkIsObject, validate } from '../standardSchema.js';
|
|
13
|
+
import { JSONstringify } from '../json.js';
|
|
13
14
|
export async function loadEnvsDev(config,
|
|
14
15
|
//load: Load,
|
|
15
16
|
iteration, initialProcessEnv, _firstLoad, useTestEnvFiles = false,
|
|
@@ -46,7 +47,7 @@ buildCodeFolder) {
|
|
|
46
47
|
const env = dotenv.parse(await readFilePromise(filePath, 'utf-8'));
|
|
47
48
|
someEnvLoaded = true;
|
|
48
49
|
if (_firstLoad) cliOut(`${fileName} loaded from ${filePath}`);
|
|
49
|
-
//cliOut(fileName,
|
|
50
|
+
//cliOut(fileName, JSONstringify(env, null, 4))
|
|
50
51
|
addToEnv(env, tempEnv, prefix, initialProcessEnv, config.suppressEnvOverwriteWarnings);
|
|
51
52
|
//if (_firstLoad) console.log('loaded env file', fileName)
|
|
52
53
|
} catch (e) {
|
|
@@ -69,7 +70,7 @@ buildCodeFolder) {
|
|
|
69
70
|
if (_firstLoad) cliLog('private env schema found');
|
|
70
71
|
const result = await validate(envSchemas.privateEnvSchema, tempEnv);
|
|
71
72
|
if (!result.success) {
|
|
72
|
-
throwError('Your environment variables failed your private env schema (registerPrivateEnvSchema)', '\n' + result.problems + '\nenv: ' +
|
|
73
|
+
throwError('Your environment variables failed your private env schema (registerPrivateEnvSchema)', '\n' + result.problems + '\nenv: ' + JSONstringify(tempEnv, null, 4));
|
|
73
74
|
}
|
|
74
75
|
checkIsObject('loadEnvsDev()', 'the private env schema', result.value);
|
|
75
76
|
const dropped = droppedCoreEnvKeys(tungstenCorePrivateEnvSchema, tempEnv, result.value);
|
|
@@ -78,7 +79,7 @@ buildCodeFolder) {
|
|
|
78
79
|
if (!coreResult.success) {
|
|
79
80
|
throwError('Your private environment variables don\'t meet the Tungsten requirements. Check .env / .env.private and the schema given to registerPrivateEnvSchema - it may need to coerce a value to the right type.',
|
|
80
81
|
// eslint-disable-line @stylistic/max-len
|
|
81
|
-
'\n' + coreResult.problems + '\nenv: ' +
|
|
82
|
+
'\n' + coreResult.problems + '\nenv: ' + JSONstringify(tempEnv, null, 4));
|
|
82
83
|
}
|
|
83
84
|
global.tungstenPrivateEnv = coreResult.value;
|
|
84
85
|
//console.log('global.tungstenPrivateEnv', global.tungstenPrivateEnv)
|
|
@@ -91,7 +92,7 @@ buildCodeFolder) {
|
|
|
91
92
|
});
|
|
92
93
|
const result = await validate(envSchemas.publicEnvSchema, tempPublicEnv);
|
|
93
94
|
if (!result.success) {
|
|
94
|
-
throwError('Your public environment variables failed your public env schema (registerPublicEnvSchema)', '\n' + result.problems + '\nenv: ' +
|
|
95
|
+
throwError('Your public environment variables failed your public env schema (registerPublicEnvSchema)', '\n' + result.problems + '\nenv: ' + JSONstringify(tempEnv, null, 4) + '\nparsed public env ' + JSONstringify(tempPublicEnv, null, 4));
|
|
95
96
|
}
|
|
96
97
|
checkIsObject('loadEnvsDev()', 'the public env schema', result.value);
|
|
97
98
|
const dropped = droppedCoreEnvKeys(tungstenCorePublicEnvSchema, tempPublicEnv, result.value);
|
|
@@ -100,7 +101,7 @@ buildCodeFolder) {
|
|
|
100
101
|
if (!coreResult.success) {
|
|
101
102
|
throwError('Your public environment variables don\'t meet the Tungsten requirements. Check .env.public and the schema given to registerPublicEnvSchema - it may need to coerce a value to the right type.',
|
|
102
103
|
// eslint-disable-line @stylistic/max-len
|
|
103
|
-
'\n' + coreResult.problems + '\npublic env: ' +
|
|
104
|
+
'\n' + coreResult.problems + '\npublic env: ' + JSONstringify(tempPublicEnv, null, 4));
|
|
104
105
|
}
|
|
105
106
|
global.tungstenPublicEnv = coreResult.value;
|
|
106
107
|
//console.log('global.tungstenPublicEnv', global.tungstenPublicEnv)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resetRegistrations.d.ts","sourceRoot":"","sources":["../../src/Servers/resetRegistrations.ts"],"names":[],"mappings":"AASA,wBAAgB,kBAAkB,SAMjC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { contextRegistration } from '../context/registerContext.js';
|
|
2
|
+
import { globalDataFunc } from '../routing/registerGlobalData.js';
|
|
3
|
+
import { registeredNetworkedStore, registeredRouting } from '../routing/routingRegistry.js';
|
|
4
|
+
import { storeSchemas } from '../Store/storeCreators.js';
|
|
5
|
+
// Dev re-imports the app for each request, but not tungsten: the app's server code imports it bare,
|
|
6
|
+
// so it shares the dev server's copy. Each registry is cleared first, and the re-import fills it
|
|
7
|
+
export function resetRegistrations() {
|
|
8
|
+
globalDataFunc.value = undefined;
|
|
9
|
+
contextRegistration.value = undefined;
|
|
10
|
+
registeredRouting.value = undefined;
|
|
11
|
+
registeredNetworkedStore.value = undefined;
|
|
12
|
+
storeSchemas.length = 0;
|
|
13
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { MatchedRouteInfo } from '
|
|
1
|
+
import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
|
|
2
2
|
import type { Routes } from '../routing/Routes.js';
|
|
3
3
|
import type { ServerDataLoading } from '../Store/ServerDataLoading.js';
|
|
4
|
-
|
|
4
|
+
import type { BrandedContext, BrandedNetworkedData } from '../Brands.js';
|
|
5
|
+
export declare function routing(location: string, routes: Routes, context: BrandedContext, networkedData: BrandedNetworkedData, serverDataLoading?: ServerDataLoading | null): Promise<MatchedRouteInfo>;
|
|
5
6
|
//# sourceMappingURL=routing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/Servers/routing.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/Servers/routing.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAOxE,wBAAsB,OAAO,CACzB,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAC9F,iBAAiB,GAAE,iBAAiB,GAAG,IAAW,GACnD,OAAO,CAAC,gBAAgB,CAAC,CA+D3B"}
|
package/dist/Servers/routing.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Default404 } from "../routing/Default404.js";
|
|
2
2
|
import { matchPath } from '../routing/matchPath.js';
|
|
3
3
|
import { makeTungstenErrorInfo } from '../routing/TungstenErrorInfo.js';
|
|
4
|
+
// context and networkedData: the request's, handed to the matched route's data function
|
|
4
5
|
import { jsx as _jsx } from "tungsten/jsx-runtime";
|
|
5
|
-
export async function routing(location, routes, serverDataLoading = null) {
|
|
6
|
+
export async function routing(location, routes, context, networkedData, serverDataLoading = null) {
|
|
6
7
|
let defaultRoute, _404Route, errorRoute;
|
|
7
8
|
// try the current path against each defined route
|
|
8
9
|
// routeNode is a Route node in the children tree
|
|
@@ -33,7 +34,7 @@ export async function routing(location, routes, serverDataLoading = null) {
|
|
|
33
34
|
};
|
|
34
35
|
if ('data' in route) {
|
|
35
36
|
if (serverDataLoading) serverDataLoading.value = true;
|
|
36
|
-
matched.data = await route.data(params, location, match.query);
|
|
37
|
+
matched.data = await route.data(params, location, match.query, context, networkedData);
|
|
37
38
|
if (serverDataLoading) serverDataLoading.value = false;
|
|
38
39
|
}
|
|
39
40
|
return matched;
|
|
@@ -45,11 +46,15 @@ export async function routing(location, routes, serverDataLoading = null) {
|
|
|
45
46
|
params: {},
|
|
46
47
|
content: defaultRoute.content
|
|
47
48
|
};
|
|
48
|
-
if (_404Route)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
if (_404Route) {
|
|
50
|
+
const matched = {
|
|
51
|
+
key: '404',
|
|
52
|
+
params: {},
|
|
53
|
+
content: _404Route.content
|
|
54
|
+
};
|
|
55
|
+
if ('code' in _404Route && typeof _404Route.code === 'number') matched.code = _404Route.code;
|
|
56
|
+
return matched;
|
|
57
|
+
}
|
|
53
58
|
if (errorRoute) {
|
|
54
59
|
return {
|
|
55
60
|
key: 'error',
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CacheControl } from '../cacheControl.js';
|
|
2
|
+
import type { InstanceConfig } from '../Instance/InstanceConfig.js';
|
|
3
|
+
import type { ReqRes } from '../ReqRes.js';
|
|
4
|
+
import type { AppRoutes } from '../routing/AppRoutes.js';
|
|
5
|
+
import { Instance } from '../Instance/Instance.js';
|
|
6
|
+
export declare function stubInstance(location: string, instanceConfig: InstanceConfig, reqRes: ReqRes, appRoutes: AppRoutes<any>): Instance;
|
|
7
|
+
export declare function sendStub(reqRes: ReqRes, cacheControl: CacheControl | undefined, html: string): void;
|
|
8
|
+
//# sourceMappingURL=stubInstance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stubInstance.d.ts","sourceRoot":"","sources":["../../src/Servers/stubInstance.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAIxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAMlD,wBAAgB,YAAY,CACxB,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,GAC5F,QAAQ,CAgBV;AAGD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,QAS5F"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cacheControlHeader, pageCacheControl } from '../cacheControl.js';
|
|
2
|
+
import { Instance } from '../Instance/Instance.js';
|
|
3
|
+
import { initStores } from './initStores.js';
|
|
4
|
+
// config.serverSideRouting false: the instance for a page the server makes no data for and does not
|
|
5
|
+
// route. The render stops at the root's head and body (contentTreeToRenderingTree)
|
|
6
|
+
export function stubInstance(location, instanceConfig, reqRes, appRoutes) {
|
|
7
|
+
const matchedRouteInfo = {
|
|
8
|
+
key: null,
|
|
9
|
+
params: {},
|
|
10
|
+
content: null
|
|
11
|
+
};
|
|
12
|
+
const globalData = {};
|
|
13
|
+
const context = {};
|
|
14
|
+
const networkedData = {};
|
|
15
|
+
const {
|
|
16
|
+
internalStore,
|
|
17
|
+
stores,
|
|
18
|
+
storeSubscriptions
|
|
19
|
+
} = initStores(location, reqRes, globalData, matchedRouteInfo, {
|
|
20
|
+
value: false
|
|
21
|
+
}, context, networkedData);
|
|
22
|
+
const noRoutes = {}; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- never routed
|
|
23
|
+
const instance = new Instance(location, instanceConfig, reqRes, appRoutes, noRoutes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
|
|
24
|
+
instance.context = context;
|
|
25
|
+
instance.networkedData = networkedData;
|
|
26
|
+
return instance;
|
|
27
|
+
}
|
|
28
|
+
// the same page for every location: no route, so no 404. cacheControl: the config's, in prod
|
|
29
|
+
export function sendStub(reqRes, cacheControl, html) {
|
|
30
|
+
const {
|
|
31
|
+
res
|
|
32
|
+
} = reqRes;
|
|
33
|
+
res.setHeader('Content-Type', 'text/html');
|
|
34
|
+
if (res.getHeader('Cache-Control') === undefined) {
|
|
35
|
+
const chosen = pageCacheControl(undefined, undefined, cacheControl, reqRes);
|
|
36
|
+
if (chosen !== undefined) res.setHeader('Cache-Control', cacheControlHeader(chosen));
|
|
37
|
+
}
|
|
38
|
+
res.status(200);
|
|
39
|
+
res.send(html);
|
|
40
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MatchedRouteInfo } from '../
|
|
1
|
+
import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
|
|
2
2
|
import type { PopMessage } from '../PopMessage.type.js';
|
|
3
3
|
import type { ComponentStoreValue } from '../Components.jsx';
|
|
4
4
|
import type { ReadonlyTrueStoreValue, StoreValue } from './makeStore.js';
|
package/dist/Store/Store.js
CHANGED
|
@@ -7,6 +7,7 @@ import { TungstenComponent } from '../TungstenComponent.jsx'
|
|
|
7
7
|
import { FunctionComponent } from '../FunctionComponent.js'
|
|
8
8
|
import { TungstenError } from '../TungstenError.js'
|
|
9
9
|
import { IsObject } from '../IsObject.js'
|
|
10
|
+
import { JSONstringify } from '../json.js'
|
|
10
11
|
|
|
11
12
|
export default function objectCopy<T extends GenericObject>(obj: T): T {
|
|
12
13
|
return structuredClone(obj)
|
|
@@ -418,7 +419,7 @@ export class Store {
|
|
|
418
419
|
return this.data || {}
|
|
419
420
|
}
|
|
420
421
|
export() {
|
|
421
|
-
return
|
|
422
|
+
return JSONstringify(this.data || {})
|
|
422
423
|
}
|
|
423
424
|
import(jsonData: string) {
|
|
424
425
|
//console.log('json data', jsonData)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ReqRes } from '../ReqRes.js';
|
|
2
|
-
import type { MatchedRouteInfo } from '../
|
|
2
|
+
import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
|
|
3
3
|
import type { GlobalData } from '../routing/registerGlobalData.js';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import type { NetworkedData } from '../routing/routingRegistry.js';
|
|
5
|
+
import type { Context } from '../context/registerContext.js';
|
|
6
|
+
import type { BrandedContext, BrandedGlobalData, BrandedNetworkedData } from '../Brands.js';
|
|
7
|
+
export type StoreSchemaClass<StoreSchema> = new (reqRes: ReqRes | null, context: Context, networkedData: NetworkedData, globalData: GlobalData, matchedRouteInfo: MatchedRouteInfo) => StoreSchema;
|
|
8
|
+
export type BrandedStoreSchemaClass<StoreSchema> = new (reqRes: ReqRes | null, context: BrandedContext, networkedData: BrandedNetworkedData, globalData: BrandedGlobalData, matchedRouteInfo: MatchedRouteInfo) => StoreSchema;
|
|
6
9
|
//# sourceMappingURL=StoreSchemaClass.d.ts.map
|