tungsten 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +7 -1
- package/dist/FrameworkConfig.d.ts.map +1 -1
- 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 +39 -8
- package/dist/Instance/InstanceConfig.d.ts +2 -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 +62 -20
- package/dist/Servers/ProdServer.d.ts +4 -2
- package/dist/Servers/ProdServer.d.ts.map +1 -1
- package/dist/Servers/ProdServer.js +77 -18
- 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 +3 -2
- 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 +18 -0
- package/dist/componentHelpers.d.ts.map +1 -0
- package/dist/componentHelpers.js +28 -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 +14 -2
- package/dist/frameworkConfigSchema.d.ts.map +1 -1
- package/dist/frameworkConfigSchema.js +11 -2
- 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/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 +57 -44
- 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/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/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
- package/dist/makeInstanceConfigFromFrameworkConfig.js +1 -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 +96 -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 +64 -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 +105 -0
- package/dist/pipeline/pipeline.d.ts.map +1 -0
- package/dist/pipeline/pipeline.js +108 -0
- package/dist/pipeline/pipeline.types.test.d.ts +650 -0
- package/dist/pipeline/pipeline.types.test.d.ts.map +1 -0
- package/dist/pipeline/pipeline.types.test.js +342 -0
- package/dist/pipeline/pipelineDefinition.d.ts +67 -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 +1971 -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 +31 -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 +48 -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 +2 -1
- 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 +11 -0
- package/dist/routing/MatchedRouteInfo.d.ts.map +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/RoutePaths.js +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 +17 -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 +99 -0
- package/dist/routing/builder.d.ts.map +1 -0
- package/dist/routing/builder.js +213 -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/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 +33 -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/createTestApp.d.ts +25 -1
- package/dist/testing/createTestApp.d.ts.map +1 -1
- package/dist/testing/createTestApp.js +12 -3
- package/dist/testing/createTestPipelineApp.d.ts +25 -0
- package/dist/testing/createTestPipelineApp.d.ts.map +1 -0
- package/dist/testing/createTestPipelineApp.js +153 -0
- package/dist/testing/ensure.d.ts +108 -0
- package/dist/testing/ensure.d.ts.map +1 -0
- package/dist/testing/ensure.js +522 -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/helpers/contentHtmlElements.d.ts.map +1 -1
- package/dist/testing/host.d.ts +80 -9
- package/dist/testing/host.d.ts.map +1 -1
- package/dist/testing/host.js +81 -20
- package/dist/testing/hostPipeline.d.ts +157 -0
- package/dist/testing/hostPipeline.d.ts.map +1 -0
- package/dist/testing/hostPipeline.js +341 -0
- package/dist/testing/hydrateTestApp.d.ts +17 -0
- package/dist/testing/hydrateTestApp.d.ts.map +1 -1
- package/dist/testing/hydrateTestApp.js +26 -6
- package/dist/testing/hydrateTestPipelineApp.d.ts +30 -0
- package/dist/testing/hydrateTestPipelineApp.d.ts.map +1 -0
- package/dist/testing/hydrateTestPipelineApp.js +190 -0
- package/dist/testing/index.d.ts +6 -3
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +4 -1
- package/dist/testing/resolveContent.d.ts +16 -0
- package/dist/testing/resolveContent.d.ts.map +1 -0
- package/dist/testing/resolveContent.js +65 -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 +20 -18
- 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/dotenv.js +2 -2
- package/vendor/express.js +61 -10
- package/vendor/manifest.json +2 -2
- 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 → routing}/MatchedRouteInfo.js +0 -0
|
@@ -15,18 +15,26 @@ import { makeInstanceConfigFromFrameworkConfig } from '../makeInstanceConfigFrom
|
|
|
15
15
|
import { standardizeWebPath } from '../standardizeWebPath.js';
|
|
16
16
|
import { throwError } from '../throwError.js';
|
|
17
17
|
import { serveStatic } from './serveStatic.js';
|
|
18
|
+
import { cacheVersioned } from './cacheVersioned.js';
|
|
19
|
+
import { $cacheControl, cacheControlHeader, pageCacheControl } from '../cacheControl.js';
|
|
18
20
|
import { routing } from "./routing.js";
|
|
19
21
|
import { globalDataFunc } from '../routing/registerGlobalData.js';
|
|
20
22
|
import { TungstenServer } from "./TungstenServer.js";
|
|
21
23
|
import { portError } from './portError.js';
|
|
22
24
|
import { initStores } from './initStores.js';
|
|
25
|
+
import { createContext } from '../context/registerContext.js';
|
|
26
|
+
import { createNetworkedData } from '../routing/routingRegistry.js';
|
|
23
27
|
import { makeTungstenErrorInfo } from '../routing/TungstenErrorInfo.js';
|
|
28
|
+
import { toRoutes } from '../routing/routesArray.js';
|
|
24
29
|
import { listenVerified, newBootId, registerBootProbe } from './listenVerified.js';
|
|
30
|
+
import { PipelineRequestHandler } from '../pipeline/PipelineRequestHandler.js';
|
|
25
31
|
function debug(...texts) {
|
|
26
32
|
// console.log(...texts)
|
|
27
33
|
}
|
|
28
34
|
export class ProdServer extends TungstenServer {
|
|
29
|
-
constructor(framework, _config, compilationInfo, _appRoutes, _RootComponentOrNull, serverMiddleware
|
|
35
|
+
constructor(framework, _config, compilationInfo, _appRoutes, _RootComponentOrNull, serverMiddleware,
|
|
36
|
+
// config.registration 'pipeline': the routes module's app, in place of appRoutes
|
|
37
|
+
pipelineApp = null) {
|
|
30
38
|
super();
|
|
31
39
|
_defineProperty(this, "framework", void 0);
|
|
32
40
|
_defineProperty(this, "config", void 0);
|
|
@@ -48,6 +56,8 @@ export class ProdServer extends TungstenServer {
|
|
|
48
56
|
_defineProperty(this, "apiRoutes", void 0);
|
|
49
57
|
_defineProperty(this, "server", void 0);
|
|
50
58
|
_defineProperty(this, "bootId", newBootId());
|
|
59
|
+
// pages: the classic handleRequest, or the pipeline's (config.registration)
|
|
60
|
+
_defineProperty(this, "requestHandler", void 0);
|
|
51
61
|
// private addServerMiddleware = (serverMiddleware: ServerMiddlewareInfo): void => {
|
|
52
62
|
// const [middlewareFile, middlewareExportName, middlewarePath] = serverMiddleware
|
|
53
63
|
// const fullFilePath = 'file://' + join(this.compilationInfo.codeLocation, middlewareFile)
|
|
@@ -100,6 +110,9 @@ export class ProdServer extends TungstenServer {
|
|
|
100
110
|
// app's error route with the real global data (theme colour, username, ...) rather
|
|
101
111
|
// than framework defaults, when it did resolve.
|
|
102
112
|
let capturedGlobalData = {};
|
|
113
|
+
// this request's context, for the error route to reuse
|
|
114
|
+
let capturedContext = {};
|
|
115
|
+
let capturedNetworkedData = {};
|
|
103
116
|
try {
|
|
104
117
|
const location = req.url;
|
|
105
118
|
const instanceConfig = makeInstanceConfigFromFrameworkConfig(this.config);
|
|
@@ -130,11 +143,15 @@ export class ProdServer extends TungstenServer {
|
|
|
130
143
|
const serverDataLoading = {
|
|
131
144
|
value: false
|
|
132
145
|
};
|
|
133
|
-
const
|
|
134
|
-
|
|
146
|
+
const context = createContext('server', reqRes);
|
|
147
|
+
capturedContext = context;
|
|
148
|
+
const networkedData = createNetworkedData(reqRes, context);
|
|
149
|
+
capturedNetworkedData = networkedData;
|
|
150
|
+
const routes = toRoutes(typeof appRoutes === 'function' ? appRoutes(reqRes, context, networkedData) : appRoutes, false);
|
|
151
|
+
const [globalData, matchedRouteInfo] = await Promise.all([globalDataFunc.value !== undefined ? globalDataFunc.value(reqRes, context, networkedData).then(globalData => {
|
|
135
152
|
capturedGlobalData = globalData;
|
|
136
153
|
return globalData;
|
|
137
|
-
}) : {}, routing(location, routes, serverDataLoading)]);
|
|
154
|
+
}) : {}, routing(location, routes, context, networkedData, serverDataLoading)]);
|
|
138
155
|
//instance.matchedRouteInfo =
|
|
139
156
|
//cliTodo('Can we move redirect handling to base class?')
|
|
140
157
|
// // 2025-03-14 copied this code here from Dev server,
|
|
@@ -159,8 +176,11 @@ export class ProdServer extends TungstenServer {
|
|
|
159
176
|
internalStore,
|
|
160
177
|
stores,
|
|
161
178
|
storeSubscriptions
|
|
162
|
-
} = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading);
|
|
179
|
+
} = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading, context, networkedData);
|
|
163
180
|
const instance = new Instance(location, instanceConfig, reqRes, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
|
|
181
|
+
instance.fileVersions = this.compilationInfo.fileVersions;
|
|
182
|
+
instance.context = context;
|
|
183
|
+
instance.networkedData = networkedData;
|
|
164
184
|
let html;
|
|
165
185
|
if (RootComponentOrNull !== null) {
|
|
166
186
|
html = await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, RootComponentOrNull, instance, config, this.config.siteBasePath);
|
|
@@ -182,13 +202,20 @@ export class ProdServer extends TungstenServer {
|
|
|
182
202
|
if (instance.redirected !== undefined) return;
|
|
183
203
|
//debug('html', html)
|
|
184
204
|
res.setHeader('Content-Type', 'text/html');
|
|
205
|
+
// server middleware ran first, and a Cache-Control it set stands
|
|
206
|
+
if (res.getHeader('Cache-Control') === undefined) {
|
|
207
|
+
const key = instance.matchedRouteInfo.key;
|
|
208
|
+
const byKey = routes;
|
|
209
|
+
const cacheControl = pageCacheControl(key !== null && Object.hasOwn(routes, key) ? byKey[key] : undefined, routes[$cacheControl], this.config.defaultCacheControl, reqRes);
|
|
210
|
+
if (cacheControl !== undefined) res.setHeader('Cache-Control', cacheControlHeader(cacheControl));
|
|
211
|
+
}
|
|
185
212
|
res.status(instance.matchedRouteInfo.key === '404' ? 404 : 200);
|
|
186
213
|
res.send(html);
|
|
187
214
|
} catch (e) {
|
|
188
215
|
cliLog('handleRequest() error', e);
|
|
189
216
|
// too late for an error page once a redirect has gone out
|
|
190
217
|
if (res.headersSent) return;
|
|
191
|
-
const errorRouteHtml = await this.tryRenderErrorRoute(req, res, capturedGlobalData, e);
|
|
218
|
+
const errorRouteHtml = await this.tryRenderErrorRoute(req, res, capturedGlobalData, capturedContext, capturedNetworkedData, e);
|
|
192
219
|
res.setHeader('Content-Type', 'text/html');
|
|
193
220
|
res.status(500);
|
|
194
221
|
res.send(errorRouteHtml ?? this.errorPage());
|
|
@@ -202,7 +229,7 @@ export class ProdServer extends TungstenServer {
|
|
|
202
229
|
// actually defines an 'error' route. Never throws - falls back to null (the caller's
|
|
203
230
|
// default error page) on any failure, since we're already handling one error and can't
|
|
204
231
|
// risk a second, unhandled one taking the server down.
|
|
205
|
-
_defineProperty(this, "tryRenderErrorRoute", async (req, res, globalData, error) => {
|
|
232
|
+
_defineProperty(this, "tryRenderErrorRoute", async (req, res, globalData, context, networkedData, error) => {
|
|
206
233
|
try {
|
|
207
234
|
if (this.framework.clientImportAliases === undefined) {
|
|
208
235
|
throwError('ProdServer.tryRenderErrorRoute()', 'framework.clientImportAliases is undefined');
|
|
@@ -216,7 +243,7 @@ export class ProdServer extends TungstenServer {
|
|
|
216
243
|
req,
|
|
217
244
|
res
|
|
218
245
|
};
|
|
219
|
-
const routes = typeof appRoutes === 'function' ? appRoutes(reqRes) : appRoutes;
|
|
246
|
+
const routes = toRoutes(typeof appRoutes === 'function' ? appRoutes(reqRes, context, networkedData) : appRoutes, false);
|
|
220
247
|
const errorRouteDef = routes.error;
|
|
221
248
|
if (errorRouteDef === undefined) return null;
|
|
222
249
|
const location = req.url;
|
|
@@ -234,8 +261,11 @@ export class ProdServer extends TungstenServer {
|
|
|
234
261
|
internalStore,
|
|
235
262
|
stores,
|
|
236
263
|
storeSubscriptions
|
|
237
|
-
} = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading);
|
|
264
|
+
} = initStores(location, reqRes, globalData, matchedRouteInfo, serverDataLoading, context, networkedData);
|
|
238
265
|
const instance = new Instance(location, instanceConfig, reqRes, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
|
|
266
|
+
instance.fileVersions = this.compilationInfo.fileVersions;
|
|
267
|
+
instance.context = context;
|
|
268
|
+
instance.networkedData = networkedData;
|
|
239
269
|
if (RootComponentOrNull !== null) {
|
|
240
270
|
return await renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, RootComponentOrNull, instance, config, this.config.siteBasePath);
|
|
241
271
|
}
|
|
@@ -323,7 +353,7 @@ export class ProdServer extends TungstenServer {
|
|
|
323
353
|
cliWarn(`Received a request from the frontend, but it did not arrive at the` + ` address the frontend was loaded from. This may indicate a` + ` misconfiguration, and may prevent the passing of cookies to the` + ` tungsten server.`);
|
|
324
354
|
cliWarn(`request: ${target}`);
|
|
325
355
|
cliWarn(`loaded from: ${origin}`);
|
|
326
|
-
cliWarn(`arrived at: ${host}`);
|
|
356
|
+
cliWarn(`arrived at: ${this.arrivedAt(host, req.protocol)}`);
|
|
327
357
|
cliWarn(`Further mismatches on ${host} are silenced for 24 hours`);
|
|
328
358
|
}
|
|
329
359
|
}
|
|
@@ -342,16 +372,18 @@ export class ProdServer extends TungstenServer {
|
|
|
342
372
|
if (this.compilationInfo.bundleLocation === undefined) {
|
|
343
373
|
throwError('ProdServer', 'compilationInfo.bundleLocation is unset/undefined');
|
|
344
374
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
this.app.use(
|
|
375
|
+
// ?v= urls (processHead, <Stylesheet>) are long-cached when v is the served file's hash
|
|
376
|
+
const serveVersioned = root => [cacheVersioned(root), serveStatic(root)];
|
|
377
|
+
this.app.use('/bundle', serveVersioned(this.compilationInfo.bundleLocation));
|
|
378
|
+
this.app.use(`/${componentCssFolder}/`, serveVersioned(join(this.compilationInfo.buildLocation, componentCssFolder)));
|
|
379
|
+
this.app.use(`/${frameworkCssFolder}/`, serveVersioned(join(this.compilationInfo.buildLocation, frameworkCssFolder)));
|
|
348
380
|
const publicLocation = join(this.compilationInfo.buildLocation, publicFolder);
|
|
349
381
|
//console.log('publicLocation', publicLocation, existsSync(publicLocation))
|
|
350
|
-
if (existsSync(publicLocation)) this.app.use(
|
|
382
|
+
if (existsSync(publicLocation)) this.app.use(serveVersioned(publicLocation)); // files from public folder
|
|
351
383
|
//console.log("serving static files with etag")
|
|
352
|
-
this.app.use(
|
|
384
|
+
this.app.use(serveVersioned(join(this.compilationInfo.buildLocation, staticFolder)));
|
|
353
385
|
if (this.config.assetsDir !== undefined) {
|
|
354
|
-
this.app.use('/assets',
|
|
386
|
+
this.app.use('/assets', serveVersioned(join(this.compilationInfo.buildLocation, assetsFolder)));
|
|
355
387
|
}
|
|
356
388
|
this.app.use(`/${this.compilationInfo.codeSubPath}`, serveStatic(this.compilationInfo.buildCodeLocation));
|
|
357
389
|
if (typeof _config.apiRoutes === 'string' && _config.apiRoutes !== '') {
|
|
@@ -360,7 +392,29 @@ export class ProdServer extends TungstenServer {
|
|
|
360
392
|
this.app.use(apiPath, express.json());
|
|
361
393
|
this.app.use(apiPath, this.handleRequestApi);
|
|
362
394
|
}
|
|
363
|
-
this.
|
|
395
|
+
this.requestHandler = _config.registration === 'pipeline' ? new PipelineRequestHandler({
|
|
396
|
+
dev: false,
|
|
397
|
+
config: _config,
|
|
398
|
+
instanceConfig: () => makeInstanceConfigFromFrameworkConfig(this.config),
|
|
399
|
+
fileVersions: this.compilationInfo.fileVersions,
|
|
400
|
+
loadApp: async () => {
|
|
401
|
+
if (pipelineApp === null) {
|
|
402
|
+
throwError('ProdServer', `config.registration is 'pipeline', but no pipeline app was given`);
|
|
403
|
+
}
|
|
404
|
+
return Promise.resolve({
|
|
405
|
+
Root: this.RootComponentOrNull,
|
|
406
|
+
app: pipelineApp
|
|
407
|
+
});
|
|
408
|
+
},
|
|
409
|
+
render: async (Root, instance) => {
|
|
410
|
+
if (this.framework.clientImportAliases === undefined) {
|
|
411
|
+
throwError('ProdServer', 'framework.clientImportAliases is undefined');
|
|
412
|
+
}
|
|
413
|
+
return renderRootToHtml(this.compilationInfo, this.framework.clientImportAliases, Root, instance, this.config, this.config.siteBasePath);
|
|
414
|
+
},
|
|
415
|
+
errorPage: () => this.errorPage()
|
|
416
|
+
}).handle : this.handleRequest;
|
|
417
|
+
this.app.use(this.requestHandler);
|
|
364
418
|
}
|
|
365
419
|
// private async handlePost(req: express.Request, res: express.Response): Promise<void> {
|
|
366
420
|
// throw new TungstenError(`Err - Dev server received a post request. Not supported yet.`)
|
|
@@ -389,7 +443,12 @@ export class ProdServer extends TungstenServer {
|
|
|
389
443
|
// URL.host is the host header's own shape - a port only when it is not the public scheme's
|
|
390
444
|
// default, so an https site on 443 gives `site.example` rather than `site.example:443`
|
|
391
445
|
this.expectedHost = new URL(publicOrigin).host;
|
|
392
|
-
if (!mute)
|
|
446
|
+
if (!mute) {
|
|
447
|
+
cliNews(`${packageNameCapitalized} prod server ready at ${localOrigin}`);
|
|
448
|
+
if (localOrigin !== publicOrigin) {
|
|
449
|
+
cliNews(`Public URL: ${publicOrigin}`);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
393
452
|
return localOrigin;
|
|
394
453
|
}
|
|
395
454
|
// close() alone only stops new connections arriving - keep-alive sockets (fetch/undici
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Server } from 'http';
|
|
2
|
-
import type { FrameworkConfigComplete } from 'tungsten/FrameworkConfig.js';
|
|
3
2
|
import express from 'express';
|
|
3
|
+
import type { FrameworkConfigComplete } from '../FrameworkConfig.js';
|
|
4
4
|
export declare class StaticSiteServer {
|
|
5
5
|
config: FrameworkConfigComplete;
|
|
6
6
|
location?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticSiteServer.d.ts","sourceRoot":"","sources":["../../src/Servers/StaticSiteServer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;
|
|
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,CA2D3B"}
|
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;
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoreSchemaClass.d.ts","sourceRoot":"","sources":["../../src/Store/StoreSchemaClass.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"StoreSchemaClass.d.ts","sourceRoot":"","sources":["../../src/Store/StoreSchemaClass.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAO3F,MAAM,MAAM,gBAAgB,CAAC,WAAW,IAAI,KACxC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,KACjC,WAAW,CAAA;AAEhB,MAAM,MAAM,uBAAuB,CAAC,WAAW,IAAI,KAC/C,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,cAAc,EACvB,aAAa,EAAE,oBAAoB,EACnC,UAAU,EAAE,iBAAiB,EAC7B,gBAAgB,EAAE,gBAAgB,KACjC,WAAW,CAAA"}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
|
+
// export type BrandedStoreSchemaClassGeneral = new (
|
|
3
|
+
// reqRes: ReqRes | null,
|
|
4
|
+
// context: BrandedContext,
|
|
5
|
+
// networkedData: BrandedNetworkedData,
|
|
6
|
+
// globalData: BrandedGlobalData,
|
|
7
|
+
// matchedRouteInfo: MatchedRouteInfo,
|
|
8
|
+
// ) => object
|
|
@@ -7,6 +7,7 @@ import { SxyBaseStoreComponent } from '../Components.jsx'
|
|
|
7
7
|
import { FunctionComponent } from '../FunctionComponent.js'
|
|
8
8
|
import { TungstenError } from '../TungstenError.js'
|
|
9
9
|
import { IsObject } from '../IsObject.js'
|
|
10
|
+
import { JSONstringify } from '../json.js'
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
|
|
@@ -421,7 +422,7 @@ export class TypeSafeStore<Schema extends object> {
|
|
|
421
422
|
return this.data || {}
|
|
422
423
|
}
|
|
423
424
|
export() {
|
|
424
|
-
return
|
|
425
|
+
return JSONstringify(this.data || {})
|
|
425
426
|
}
|
|
426
427
|
import(jsonData: string) {
|
|
427
428
|
//console.log('json data', jsonData)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ServerDataLoading } from './ServerDataLoading.js';
|
|
2
2
|
import type { ReqRes } from '../ReqRes.js';
|
|
3
|
-
import type { MatchedRouteInfo } from '../
|
|
4
|
-
import type { GlobalData } from '../routing/registerGlobalData.js';
|
|
3
|
+
import type { MatchedRouteInfo } from '../routing/MatchedRouteInfo.js';
|
|
5
4
|
import type { StoreSubscriptionsMap } from './StoreSubscriptions.types.js';
|
|
5
|
+
import type { BrandedContext, BrandedGlobalData, BrandedNetworkedData } from '../Brands.js';
|
|
6
6
|
import { type TrueStore } from './makeStore.js';
|
|
7
|
-
export declare function createStores(reqRes: ReqRes | null, matchedRouteInfo: MatchedRouteInfo, globalData:
|
|
7
|
+
export declare function createStores(reqRes: ReqRes | null, matchedRouteInfo: MatchedRouteInfo, globalData: BrandedGlobalData, storeSubscriptionsMap: StoreSubscriptionsMap, serverDataLoading: ServerDataLoading | null, context: BrandedContext, networkedData: BrandedNetworkedData): TrueStore<unknown>[];
|
|
8
8
|
//# sourceMappingURL=createStores.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createStores.d.ts","sourceRoot":"","sources":["../../src/Store/createStores.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createStores.d.ts","sourceRoot":"","sources":["../../src/Store/createStores.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAC3F,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI1D,wBAAgB,YAAY,CACxB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,iBAAiB,EAC7B,qBAAqB,EAAE,qBAAqB,EAC5C,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,EAG3C,OAAO,EAAE,cAAc,EAEvB,aAAa,EAAE,oBAAoB,GACpC,SAAS,CAAC,OAAO,CAAC,EAAE,CAYtB"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { makeStore } from './makeStore.js';
|
|
2
2
|
import { storeSchemas } from './storeCreators.js';
|
|
3
|
-
export function createStores(reqRes, matchedRouteInfo, globalData, storeSubscriptionsMap, serverDataLoading
|
|
3
|
+
export function createStores(reqRes, matchedRouteInfo, globalData, storeSubscriptionsMap, serverDataLoading,
|
|
4
|
+
// required: every store is handed the one context the request made. A default here built a
|
|
5
|
+
// second, unrelated {} whenever a caller forgot, and nothing noticed
|
|
6
|
+
context,
|
|
7
|
+
// made before routing (createNetworkedData) and handed down; {} when none is registered
|
|
8
|
+
networkedData) {
|
|
4
9
|
const stores = storeSchemas.map(Schema => {
|
|
5
10
|
const subscribedElements = new Map();
|
|
6
|
-
const store = makeStore(new Schema(reqRes, globalData, matchedRouteInfo), subscribedElements, serverDataLoading);
|
|
11
|
+
const store = makeStore(new Schema(reqRes, context, networkedData, globalData, matchedRouteInfo), subscribedElements, serverDataLoading);
|
|
7
12
|
storeSubscriptionsMap.set(store, subscribedElements);
|
|
8
13
|
return store;
|
|
9
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInternalStore.d.ts","sourceRoot":"","sources":["../../src/Store/getInternalStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,KAAK,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"getInternalStore.d.ts","sourceRoot":"","sources":["../../src/Store/getInternalStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAKtE,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACnD,sBAAsB,CAIxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerStore.d.ts","sourceRoot":"","sources":["../../src/Store/registerStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,cAAc,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"registerStore.d.ts","sourceRoot":"","sources":["../../src/Store/registerStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,cAAc,EAAE,0BAA0B,EAAE,gCAAgC,EAC5E,kCAAkC,EACrC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGlD,KAAK,mBAAmB,GAClB,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACzC,gCAAgC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAC/C,kCAAkC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAG5D,KAAK,iBAAiB,CAAC,WAAW,SAAS,MAAM,IAAI;IACjD,iBAAiB,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,cAAc,CAAC,WAAW,CAAC,CAAA;IAChF,QAAQ,EAAE,CAAC,gBAAgB,EAAE,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,KAAK,SAAS,CAAC,WAAW,CAAC,CAAA;CAC1F,CAAA;AACD,wBAAgB,aAAa,CAAC,WAAW,SAAS,MAAM,EAAE,WAAW,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAC9F,iBAAiB,CAAC,WAAW,CAAC,CAqBnC"}
|