tungsten 0.6.2 → 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 +29 -12
- package/dist/Instance/Instance.d.ts.map +1 -1
- package/dist/Instance/Instance.js +59 -21
- 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 +59 -46
- 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/routeUrl.d.ts +4 -0
- package/dist/routing/routeUrl.d.ts.map +1 -1
- package/dist/routing/routeUrl.js +4 -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
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
import { styleText } from 'node:util';
|
|
5
|
+
import deepEqual from 'deep-eql';
|
|
6
|
+
import { ContentNodeElementIsComponent, ContentNodeElementIsHtml, ContentNodeIsArray, ContentNodeIsElement, ContentNodeIsLiteral, IsContentNode } from '../ContentNode.js';
|
|
7
|
+
import { $fragment, $props, $type } from '../contentNodeSymbols.js';
|
|
8
|
+
import { componentTypeIdentityKey } from '../hmr/componentIdentity.js';
|
|
9
|
+
// exported after
|
|
10
|
+
const _ensure = withMembers(ensure, quantifiers(fact => fact));
|
|
11
|
+
export { _ensure as ensure }; // naming
|
|
12
|
+
// read once: an ends object holds no run state, as each run starts its facts afresh
|
|
13
|
+
export const {
|
|
14
|
+
no,
|
|
15
|
+
none,
|
|
16
|
+
one,
|
|
17
|
+
two,
|
|
18
|
+
three,
|
|
19
|
+
a,
|
|
20
|
+
an,
|
|
21
|
+
some,
|
|
22
|
+
all,
|
|
23
|
+
count
|
|
24
|
+
} = _ensure;
|
|
25
|
+
function quantifiers(finish) {
|
|
26
|
+
return {
|
|
27
|
+
get no() {
|
|
28
|
+
return ends('no', counting(count => count === 0, 0), finish);
|
|
29
|
+
},
|
|
30
|
+
get none() {
|
|
31
|
+
return ends('none', counting(count => count === 0, 0), finish, 'no');
|
|
32
|
+
},
|
|
33
|
+
get one() {
|
|
34
|
+
return ends('one', counting(count => count === 1, 1), finish);
|
|
35
|
+
},
|
|
36
|
+
get two() {
|
|
37
|
+
return ends('two', counting(count => count === 2, 2), finish);
|
|
38
|
+
},
|
|
39
|
+
get three() {
|
|
40
|
+
return ends('three', counting(count => count === 3, 3), finish);
|
|
41
|
+
},
|
|
42
|
+
get a() {
|
|
43
|
+
return ends('a', counting(count => count === 1, 1), finish);
|
|
44
|
+
},
|
|
45
|
+
get an() {
|
|
46
|
+
return ends('an', counting(count => count === 1, 1), finish);
|
|
47
|
+
},
|
|
48
|
+
count: num => ends(`count(${num})`, counting(count => count === num, num), finish, String(num)),
|
|
49
|
+
get some() {
|
|
50
|
+
return ends('some', () => {
|
|
51
|
+
let count = 0;
|
|
52
|
+
return [match => {
|
|
53
|
+
if (match) ++count;
|
|
54
|
+
return count > 0;
|
|
55
|
+
}, () => count > 0 ? undefined : {
|
|
56
|
+
actual: 0,
|
|
57
|
+
expected: '1 or more',
|
|
58
|
+
saw: 'saw 0',
|
|
59
|
+
showDiff: false
|
|
60
|
+
}];
|
|
61
|
+
}, finish);
|
|
62
|
+
},
|
|
63
|
+
// every sighting of its kind must match, and there must be one: all of none proves nothing
|
|
64
|
+
get all() {
|
|
65
|
+
return ends('all', () => {
|
|
66
|
+
let count = 0;
|
|
67
|
+
return [match => {
|
|
68
|
+
if (match) ++count;
|
|
69
|
+
}, ofKind => ofKind > 0 && count === ofKind ? undefined : {
|
|
70
|
+
actual: count,
|
|
71
|
+
expected: ofKind,
|
|
72
|
+
saw: `saw ${count} of ${ofKind}`,
|
|
73
|
+
showDiff: ofKind > 0
|
|
74
|
+
}];
|
|
75
|
+
}, finish, 'every');
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// the facts of a list as prose, joined: (one <li> and no <b>)
|
|
80
|
+
const spokenList = facts => `(${facts.map(fact => fact[5]).join(' and ')})`;
|
|
81
|
+
// a value as JSX writes it in a prop: title="x", size={3}
|
|
82
|
+
const jsxValue = value => typeof value === 'string' ? `"${value}"` : `{${display(value)}}`;
|
|
83
|
+
// each end says only what a sighting must be, and how it reads in a failure;
|
|
84
|
+
// ensure() starts the requirement
|
|
85
|
+
// spoken: the quantifier as prose, where it differs - none as no, count(3) as 3
|
|
86
|
+
function ends(quantifier, requirement, finish, spoken = quantifier) {
|
|
87
|
+
const fact = (kind, test, end, prose, explain) => finish([kind, test, requirement, quantifier, end, `${spoken} ${prose}`, explain]);
|
|
88
|
+
const many = !['one', 'a', 'an', 'every', '1'].includes(spoken);
|
|
89
|
+
const noun = word => !many ? word : word.endsWith('s') ? `${word}es` : `${word}s`;
|
|
90
|
+
// a scoped fact is the outer kind, passing where the inner facts pass on the sightings
|
|
91
|
+
// scopeOf gives for a sighting
|
|
92
|
+
const scoped = (kind, end, prose, scopeOf) => (inner, to, proseTo) => {
|
|
93
|
+
const facts = inner.map(each => forKind(each, kind));
|
|
94
|
+
return fact(kind, scopeTest(scopeOf, facts), `${end}.${to}`, `${prose} ${proseTo}`, scopeExplain(scopeOf, facts));
|
|
95
|
+
};
|
|
96
|
+
// alone: present. with: facts on the element itself, its children among them
|
|
97
|
+
const element = (kind, end, prose, own) => {
|
|
98
|
+
const within = scoped(kind, end, prose, seen => own(seen));
|
|
99
|
+
const below = scoped(kind, end, prose, childrenScope);
|
|
100
|
+
const children = withMembers(facts => below(facts, `with.children(${listed(facts)})`, `with ${spokenList(facts)} in its children`), quantifiers(inner => below([inner], `with.children.${chained(inner)}`, `with ${inner[5]} in its children`)));
|
|
101
|
+
return Object.assign(fact(kind, () => true, end, prose), {
|
|
102
|
+
// facts, or a fn given the props for what facts cannot say
|
|
103
|
+
with: withMembers(withMembers(facts => Array.isArray(facts) ? within(facts, `with(${listed(facts)})`, `with ${spokenList(facts)}`) : fact(kind, seen => facts(seen), `${end}.with(${fnName(facts)})`, `${prose} passing ${fnName(facts)}`), quantifiers(inner => within([inner], `with.${chained(inner)}`, `with ${inner[5]}`))), {
|
|
104
|
+
children
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
// the text ends differ only in the sighting they read and whether case matters
|
|
109
|
+
const stringEnd = (kind, name, what, ci = false) => {
|
|
110
|
+
const norm = text => ci ? lower(text) : text;
|
|
111
|
+
const read = (seen, met) => typeof seen === 'string' && met(norm(seen));
|
|
112
|
+
const said = (ci ? 'case-insensitive ' : '') + noun(what);
|
|
113
|
+
return Object.assign(text => fact(kind, seen => read(seen, found => found === norm(text)), `${name}('${text}')`, (ci ? 'case-insensitive ' : '') + `'${text}' ${noun(what)}`), {
|
|
114
|
+
contains: substring => fact(kind, seen => read(seen, found => found.includes(norm(substring))), `${name}.contains('${substring}')`, `${said} containing '${substring}'`),
|
|
115
|
+
matches: regex => fact(kind, matching(regex, ci ? 'i' : ''), `${name}.matches(${String(regex)})`, `${said} matching ${String(regex)}`)
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
text: stringEnd('text', 'text', 'text node'),
|
|
120
|
+
textCi: stringEnd('text', 'textCi', 'text node', true),
|
|
121
|
+
interruptedText: stringEnd('interruptedText', 'interruptedText', 'element text'),
|
|
122
|
+
html: tag => element(`html:${tag}`, `html('${tag}')`, `<${tag}>`, props => htmlOwnSightings(tag, props)),
|
|
123
|
+
component: name => element(`component:${name}`, `component('${name}')`, `<${name}>`, props => componentOwnSightings(name, props)),
|
|
124
|
+
fragment: () => fact('fragment', () => true, 'fragment()', noun('fragment')),
|
|
125
|
+
className: className => fact('className', seen => className === undefined || seen === className, className === undefined ? 'className()' : `className('${className}')`, className === undefined ? noun('class') : `class="${className}"`),
|
|
126
|
+
id: id => fact('id', seen => id === undefined || seen === id, id === undefined ? 'id()' : `id('${id}')`, id === undefined ? noun('id') : `id="${id}"`),
|
|
127
|
+
// prop() alone: passed, whatever the value - undefined included, as the tree has the key.
|
|
128
|
+
// .is: the value raw, compared by ===, so a handler or ref is matched by reference
|
|
129
|
+
prop: prop => Object.assign(fact(`prop:${prop}`, () => true, `prop('${prop}')`, `${prop} ${noun('prop')}`), {
|
|
130
|
+
is: value => fact(`prop:${prop}`, seen => seen === value, `prop('${prop}').is(${display(value)})`, `${prop}=${jsxValue(value)}`),
|
|
131
|
+
contains: substring => fact(`prop:${prop}`, seen => typeof seen === 'string' && seen.includes(substring), `prop('${prop}').contains('${substring}')`, `${prop} containing '${substring}'`),
|
|
132
|
+
matches: regex => fact(`prop:${prop}`, matching(regex), `prop('${prop}').matches(${String(regex)})`, `${prop} matching ${String(regex)}`),
|
|
133
|
+
// chai's deep.equal, which is deep-eql
|
|
134
|
+
exact: value => fact(`prop:${prop}`, seen => deepEqual(seen, value), `prop('${prop}').exact(${display(value)})`, `${prop} deep-equal to ${display(value)}`),
|
|
135
|
+
subset: shape => fact(`prop:${prop}`, seen => contains(shape, seen, 'anywhere'), `prop('${prop}').subset(${display(shape)})`, `${prop} with subset ${display(shape)}`),
|
|
136
|
+
duck: shape => fact(`prop:${prop}`, seen => contains(shape, seen, 'inPlace'), `prop('${prop}').duck(${display(shape)})`, `${prop} shaped like ${display(shape)}`),
|
|
137
|
+
// opt-in: a content-like prop may not be rendered, so it is walked only on asking.
|
|
138
|
+
// Alone: the value is content; with: facts on its whole tree, root included
|
|
139
|
+
content: () => {
|
|
140
|
+
const end = `prop('${prop}').content()`;
|
|
141
|
+
const prose = `${prop} holding content`;
|
|
142
|
+
const within = scoped(`prop:${prop}`, end, prose, seen => IsContentNode(seen) ? contentSightings(seen) : undefined);
|
|
143
|
+
return Object.assign(fact(`prop:${prop}`, IsContentNode, end, prose), {
|
|
144
|
+
with: withMembers(facts => within(facts, `with(${listed(facts)})`, `with ${spokenList(facts)}`), quantifiers(inner => within([inner], `with.${chained(inner)}`, `with ${inner[5]}`)))
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
// fields as sxy-assert's, for a runner to read; showDiff where actual and expected are counts
|
|
151
|
+
export class EnsureError extends Error {
|
|
152
|
+
constructor(message, actual, expected, operator, showDiff) {
|
|
153
|
+
super(message);
|
|
154
|
+
_defineProperty(this, "actual", void 0);
|
|
155
|
+
_defineProperty(this, "expected", void 0);
|
|
156
|
+
_defineProperty(this, "operator", void 0);
|
|
157
|
+
_defineProperty(this, "showDiff", void 0);
|
|
158
|
+
_defineProperty(this, "name", 'EnsureError');
|
|
159
|
+
this.actual = actual;
|
|
160
|
+
this.expected = expected;
|
|
161
|
+
this.operator = operator;
|
|
162
|
+
this.showDiff = showDiff;
|
|
163
|
+
Error.captureStackTrace(this, ensure); // the stack starts at the test's ensure() call
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function ensure(tree, facts, options = {}) {
|
|
167
|
+
const sightings = contentSightings(tree);
|
|
168
|
+
const miss = check(sightings, facts);
|
|
169
|
+
if (miss === undefined) return;
|
|
170
|
+
const [fact, failure] = miss;
|
|
171
|
+
const {
|
|
172
|
+
readable = true,
|
|
173
|
+
color = process.stdout.isTTY && process.stdout.hasColors()
|
|
174
|
+
} = options;
|
|
175
|
+
const style = {
|
|
176
|
+
readable,
|
|
177
|
+
paint: color ? (tint, text) => styleText(tint, text, {
|
|
178
|
+
validateStream: false
|
|
179
|
+
}) : (_, text) => text
|
|
180
|
+
};
|
|
181
|
+
const message = `expected ${readable ? fact.spoken : fact.chained}, ${failure.saw}`
|
|
182
|
+
// the · holds the gap until sxy-test-runner keeps blank lines
|
|
183
|
+
+ (readable ? `\n rule: ${fact.chained}\n ·` : '') + `\n ${seenLine(fact, sightings, style, true)}`;
|
|
184
|
+
const {
|
|
185
|
+
actual,
|
|
186
|
+
expected,
|
|
187
|
+
showDiff
|
|
188
|
+
} = failure;
|
|
189
|
+
throw new EnsureError(message, actual, expected, fact.operator, showDiff);
|
|
190
|
+
}
|
|
191
|
+
// each fact started and told of its sightings, ready to decide
|
|
192
|
+
function tracked(sightings, facts) {
|
|
193
|
+
const started = buildFacts(facts);
|
|
194
|
+
const byKind = new Map();
|
|
195
|
+
for (const fact of started) byKind.set(fact.kind, [...(byKind.get(fact.kind) ?? []), fact]);
|
|
196
|
+
for (const [kind, value] of sightings) {
|
|
197
|
+
for (const fact of byKind.get(kind) ?? []) fact.track(fact.test(value));
|
|
198
|
+
}
|
|
199
|
+
return started;
|
|
200
|
+
}
|
|
201
|
+
const ofKind = (sightings, kind) => sightings.filter(([seenKind]) => seenKind === kind).length;
|
|
202
|
+
// the first fact to fail, with what it saw.
|
|
203
|
+
// Every fact decides, including those of a kind the tree never showed
|
|
204
|
+
function check(sightings, facts) {
|
|
205
|
+
for (const fact of tracked(sightings, facts)) {
|
|
206
|
+
const failure = fact.decide(ofKind(sightings, fact.kind));
|
|
207
|
+
if (failure !== undefined) return [fact, failure];
|
|
208
|
+
}
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
// matching: whether a sighting meets a scope's inner facts, stopping at the first miss
|
|
212
|
+
const scopeTest = (scopeOf, inner) => seen => {
|
|
213
|
+
const sightings = scopeOf(seen);
|
|
214
|
+
return sightings !== undefined && check(sightings, inner) === undefined;
|
|
215
|
+
};
|
|
216
|
+
// reporting, once a fact has failed: every inner fact a sighting missed and met.
|
|
217
|
+
// Its score: 2 for each fact met, 1 for each missed whose kind it holds
|
|
218
|
+
const scopeExplain = (scopeOf, inner) => seen => {
|
|
219
|
+
const sightings = scopeOf(seen);
|
|
220
|
+
if (sightings === undefined) return 'not content';
|
|
221
|
+
const misses = [];
|
|
222
|
+
const met = [];
|
|
223
|
+
let score = 0;
|
|
224
|
+
for (const fact of tracked(sightings, inner)) {
|
|
225
|
+
const seenOfKind = ofKind(sightings, fact.kind);
|
|
226
|
+
const failure = fact.decide(seenOfKind);
|
|
227
|
+
if (failure === undefined) {
|
|
228
|
+
score += 2;
|
|
229
|
+
met.push(fact);
|
|
230
|
+
} else {
|
|
231
|
+
if (seenOfKind > 0) score += 1;
|
|
232
|
+
misses.push({
|
|
233
|
+
fact,
|
|
234
|
+
failure,
|
|
235
|
+
sightings
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return misses.length === 0 ? undefined : {
|
|
240
|
+
misses,
|
|
241
|
+
met,
|
|
242
|
+
score
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
// a scoped inner fact lists its own sightings with their reasons, down to the miss;
|
|
246
|
+
// its description would only repeat the rest of the outer one
|
|
247
|
+
function explained(outcome, style) {
|
|
248
|
+
const {
|
|
249
|
+
readable,
|
|
250
|
+
paint
|
|
251
|
+
} = style;
|
|
252
|
+
if (outcome === 'not content') return paint('red', outcome);
|
|
253
|
+
const label = fact => readable ? fact.spoken : fact.chained;
|
|
254
|
+
const missed = outcome.misses.map(({
|
|
255
|
+
fact,
|
|
256
|
+
failure,
|
|
257
|
+
sightings
|
|
258
|
+
}) => {
|
|
259
|
+
if (fact.explain === undefined) return paint('red', `${label(fact)}: ${failure.saw}`);
|
|
260
|
+
// a children fact's one sighting is its element, so listing it would repeat the element
|
|
261
|
+
const element = fact.operator === '' ? sightings.find(([kind]) => kind === fact.kind) : undefined;
|
|
262
|
+
const inner = element === undefined ? undefined : fact.explain(element[1]);
|
|
263
|
+
if (inner !== undefined) {
|
|
264
|
+
return `${readable ? 'in its children,' : 'children:'} ${explained(inner, style)}`;
|
|
265
|
+
}
|
|
266
|
+
return `${paint('red', `${failure.saw};`)} ${seenLine(fact, sightings, style)}`;
|
|
267
|
+
});
|
|
268
|
+
const met = outcome.met.length === 0 ? [] : [paint('green', `met: ${outcome.met.map(label).join(', ')}`)];
|
|
269
|
+
return [...missed, ...met].join('; ');
|
|
270
|
+
}
|
|
271
|
+
// met: first; not content: last
|
|
272
|
+
const rank = outcome => outcome === undefined ? Infinity : outcome === 'not content' ? -1 : outcome.score;
|
|
273
|
+
const fnName = fn => fn.name === '' ? 'fn' : fn.name;
|
|
274
|
+
// a fact as it reads inside a scope: one.prop('href'); a children fact carries no quantifier
|
|
275
|
+
const chained = ([,,, quantifier, end]) => quantifier === '' ? end : `${quantifier}.${end}`;
|
|
276
|
+
const listed = facts => `[${facts.map(chained).join(', ')}]`;
|
|
277
|
+
const childrenKind = 'children';
|
|
278
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
279
|
+
const childrenScope = seen => contentSightings(seen.children);
|
|
280
|
+
// a children fact takes the kind of the element whose with list holds it
|
|
281
|
+
const forKind = (fact, kind) => fact[0] === childrenKind ? [kind, fact[1], fact[2], fact[3], fact[4], fact[5], fact[6]] : fact;
|
|
282
|
+
// a with list holds one sighting of its element's kind - the element itself - so a children fact
|
|
283
|
+
// passes where the element's content meets its inner facts
|
|
284
|
+
function childrenFact(inner, end, spoken) {
|
|
285
|
+
return [childrenKind, scopeTest(childrenScope, inner), counting(count => count === 1, 1), '', end, `${spoken} in its children`, scopeExplain(childrenScope, inner)];
|
|
286
|
+
}
|
|
287
|
+
// the element's children as a tree, for a with list, beside the element's own facts:
|
|
288
|
+
// with([one.className('x'), children.one.html('li')]), or with([children([…])]) for a list of them
|
|
289
|
+
export const children = withMembers(facts => childrenFact(facts, `children(${listed(facts)})`, spokenList(facts)), quantifiers(inner => childrenFact([inner], `children.${chained(inner)}`, inner[5])));
|
|
290
|
+
function withMembers(fn, members) {
|
|
291
|
+
Object.defineProperties(fn, Object.getOwnPropertyDescriptors(members));
|
|
292
|
+
return fn; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
293
|
+
}
|
|
294
|
+
// each fact's requirement started for this run, with its own state
|
|
295
|
+
function buildFacts(facts) {
|
|
296
|
+
return facts.map(fact => {
|
|
297
|
+
const [kind, test, requirement, quantifier,, spoken, explain] = fact;
|
|
298
|
+
const [track, decide] = requirement();
|
|
299
|
+
return {
|
|
300
|
+
kind,
|
|
301
|
+
test,
|
|
302
|
+
track,
|
|
303
|
+
decide,
|
|
304
|
+
explain,
|
|
305
|
+
spoken,
|
|
306
|
+
chained: chained(fact),
|
|
307
|
+
operator: quantifier
|
|
308
|
+
};
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
const countFailure = (actual, expected) => ({
|
|
312
|
+
actual,
|
|
313
|
+
expected,
|
|
314
|
+
saw: `saw ${actual}`,
|
|
315
|
+
showDiff: true
|
|
316
|
+
});
|
|
317
|
+
// counts every match, so a failure reports the full count, not the one it stopped at
|
|
318
|
+
function counting(pass, expected) {
|
|
319
|
+
return () => {
|
|
320
|
+
let count = 0;
|
|
321
|
+
return [match => {
|
|
322
|
+
if (match) ++count;
|
|
323
|
+
}, () => pass(count) ? undefined : countFailure(count, expected)];
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
const seenListed = 10;
|
|
327
|
+
// only those listed are shown, as a nested reason is costly to build
|
|
328
|
+
function listing(items, show, separator = ', ') {
|
|
329
|
+
return items.slice(0, seenListed).map(show).join(separator) + (items.length > seenListed ? `${separator}… ${items.length - seenListed} more` : '');
|
|
330
|
+
}
|
|
331
|
+
// each sighting with why it missed, where the fact can say, the nearest first;
|
|
332
|
+
// none of an element kind seen: list the other tags or components, as a near miss.
|
|
333
|
+
// Top level elements a line each, as their props and reasons run long; nested ones stay inline
|
|
334
|
+
function seenLine({
|
|
335
|
+
kind,
|
|
336
|
+
explain
|
|
337
|
+
}, sightings, style, top = false) {
|
|
338
|
+
const {
|
|
339
|
+
readable,
|
|
340
|
+
paint
|
|
341
|
+
} = style;
|
|
342
|
+
const separator = top && /^(html|component):/.test(kind) ? '\n ' : ', ';
|
|
343
|
+
const named = readable ? spokenKind(kind) : kind;
|
|
344
|
+
const seen = sightings.filter(([seenKind]) => seenKind === kind).map(sighting => ({
|
|
345
|
+
sighting,
|
|
346
|
+
outcome: explain?.(sighting[1])
|
|
347
|
+
}));
|
|
348
|
+
if (seen.length > 0) {
|
|
349
|
+
// stable, so sightings as near as each other stay in document order
|
|
350
|
+
if (explain !== undefined) seen.sort((a, b) => rank(b.outcome) - rank(a.outcome));
|
|
351
|
+
const opening = separator === ', ' ? ' ' : separator;
|
|
352
|
+
const shown = listing(seen, ({
|
|
353
|
+
sighting,
|
|
354
|
+
outcome
|
|
355
|
+
}) => paint('white', displaySighting(sighting)) + (outcome === undefined ? '' : ` (${explained(outcome, style)})`), separator);
|
|
356
|
+
const heading = readable && seen.length > 1 ? plural(named) : named;
|
|
357
|
+
return `${paint('white', `${heading} seen:`)}${opening}${shown}`;
|
|
358
|
+
}
|
|
359
|
+
const family = /^(html|component):/.exec(kind)?.[1];
|
|
360
|
+
if (family === undefined) return `no ${named} seen`;
|
|
361
|
+
const others = sightings.filter(([seenKind]) => seenKind.startsWith(`${family}:`)).map(([seenKind]) => seenKind.slice(family.length + 1));
|
|
362
|
+
return others.length === 0 ? `no ${named} seen` : `no ${named} seen; ${family} seen: ${listing(others, name => name)}`;
|
|
363
|
+
}
|
|
364
|
+
// <button>s, title props, classes
|
|
365
|
+
const plural = named => named.endsWith('s') ? `${named}es` : `${named}s`;
|
|
366
|
+
// a kind as prose: <button>, title prop, element text
|
|
367
|
+
function spokenKind(kind) {
|
|
368
|
+
const [family, name] = kind.split(/:(.*)/);
|
|
369
|
+
if (family === 'html' || family === 'component') return `<${name}>`;
|
|
370
|
+
if (family === 'prop') return `${name} prop`;
|
|
371
|
+
const plain = {
|
|
372
|
+
text: 'text node',
|
|
373
|
+
interruptedText: 'element text',
|
|
374
|
+
className: 'class'
|
|
375
|
+
};
|
|
376
|
+
return plain[kind] ?? kind;
|
|
377
|
+
}
|
|
378
|
+
// an element as its tag or name and props, as written: <a href='/x'>
|
|
379
|
+
function displaySighting([kind, value]) {
|
|
380
|
+
if (kind === 'fragment') return '<>';
|
|
381
|
+
const element = /^(?:html|component):(.*)$/.exec(kind)?.[1];
|
|
382
|
+
if (element === undefined) return display(value);
|
|
383
|
+
const props = Object.entries(value).filter(([name]) => name !== 'children').map(([name, prop]) => ` ${name}=${display(prop)}`);
|
|
384
|
+
return `<${element}${props.join('')}>`;
|
|
385
|
+
}
|
|
386
|
+
const displayed = 5; // entries shown of an array or object
|
|
387
|
+
const displayDepth = 2;
|
|
388
|
+
// a value as a failure message shows it; arrays and objects shortened by length and depth
|
|
389
|
+
function display(value, depth = 0) {
|
|
390
|
+
if (typeof value === 'string') return `'${value}'`;
|
|
391
|
+
if (typeof value === 'function') {
|
|
392
|
+
return value.name === '' ? '[function]' : `[function ${value.name}]`;
|
|
393
|
+
}
|
|
394
|
+
if (typeof value !== 'object' || value === null) {
|
|
395
|
+
return String(value); // a number, boolean, bigint, symbol, null or undefined
|
|
396
|
+
}
|
|
397
|
+
if (value instanceof Date) {
|
|
398
|
+
return isNaN(value.getTime()) ? 'Date(invalid)' : `Date(${value.toISOString()})`;
|
|
399
|
+
}
|
|
400
|
+
// an element held as a value, as in a prop: by tag or name, as its symbol keys hide it as data
|
|
401
|
+
if ($type in value && IsContentNode(value) && ContentNodeIsElement(value)) {
|
|
402
|
+
const type = value[$type];
|
|
403
|
+
if (type === $fragment) return '<>';
|
|
404
|
+
return `<${typeof type === 'string' ? type : componentTypeIdentityKey(type)}>`;
|
|
405
|
+
}
|
|
406
|
+
const shown = entries => depth >= displayDepth ? '…' : entries.slice(0, displayed).join(', ') + (entries.length > displayed ? ', …' : '');
|
|
407
|
+
if (Array.isArray(value)) {
|
|
408
|
+
return value.length === 0 ? '[]' : `[${shown(value.map(each => display(each, depth + 1)))}]`;
|
|
409
|
+
}
|
|
410
|
+
if (value instanceof Set) {
|
|
411
|
+
return `Set { ${shown([...value].map(each => display(each, depth + 1)))} }`;
|
|
412
|
+
}
|
|
413
|
+
if (value instanceof Map) {
|
|
414
|
+
const pairs = [...value].map(([key, each]) => `${display(key, depth + 1)} => ${display(each, depth + 1)}`);
|
|
415
|
+
return `Map { ${shown(pairs)} }`;
|
|
416
|
+
}
|
|
417
|
+
const entries = Object.entries(value).map(([key, each]) => `${key}: ${display(each, depth + 1)}`);
|
|
418
|
+
return entries.length === 0 ? '{}' : `{ ${shown(entries)} }`;
|
|
419
|
+
}
|
|
420
|
+
// an element's edge: text either side of one is not one run of text
|
|
421
|
+
const edge = Symbol('edge');
|
|
422
|
+
// in document order; the unrendered tree: a component is seen by name, its content not expanded.
|
|
423
|
+
// Adjacent text is one sighting, as the page shows it: JSX splits `Hi, {name}.` into three
|
|
424
|
+
function contentSightings(content) {
|
|
425
|
+
const sightings = [];
|
|
426
|
+
let run; // the text sighting still open to joining
|
|
427
|
+
for (const token of contentTokens(content)) {
|
|
428
|
+
if (token === edge) run = undefined;
|
|
429
|
+
// a fragment is seen but is no break, as it renders nothing of its own
|
|
430
|
+
else if (token[0] === 'fragment') sightings.push([...token]);else if (token[0] === 'text') {
|
|
431
|
+
if (run === undefined) {
|
|
432
|
+
run = ['text', token[1]];
|
|
433
|
+
sightings.push(run);
|
|
434
|
+
} else run[1] += token[1];
|
|
435
|
+
} else {
|
|
436
|
+
run = undefined;
|
|
437
|
+
sightings.push([...token]);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return sightings;
|
|
441
|
+
}
|
|
442
|
+
// fragments, arrays and non-rendered values add no edge: their text runs on into their neighbours'
|
|
443
|
+
function contentTokens(content) {
|
|
444
|
+
if (ContentNodeIsArray(content)) return content.flatMap(contentTokens);
|
|
445
|
+
if (ContentNodeIsLiteral(content)) return [['text', String(content)]];
|
|
446
|
+
if (!ContentNodeIsElement(content)) return []; // null, undefined, boolean
|
|
447
|
+
const props = content[$props];
|
|
448
|
+
if (ContentNodeElementIsHtml(content)) {
|
|
449
|
+
const descendants = contentTokens(props.children);
|
|
450
|
+
return [edge, ...htmlOwnSightings(content[$type], props), ...descendants, edge];
|
|
451
|
+
}
|
|
452
|
+
if (ContentNodeElementIsComponent(content)) {
|
|
453
|
+
// the name stylesheets match by
|
|
454
|
+
const name = componentTypeIdentityKey(content[$type]);
|
|
455
|
+
/// TODO children is a prop the component may render or not, so the walk arguably should
|
|
456
|
+
/// stop here and leave what it holds to children() - but too much breaks without it for now
|
|
457
|
+
return [edge, ...componentOwnSightings(name, props), ...contentTokens(props.children), edge];
|
|
458
|
+
/// TODO components can have classNames, ids too...
|
|
459
|
+
}
|
|
460
|
+
const fragment = ['fragment', props]; // seen, but unwrapped: its content is walked
|
|
461
|
+
return [fragment, ...contentTokens(props.children)];
|
|
462
|
+
}
|
|
463
|
+
// an element's sightings of itself, its content left out
|
|
464
|
+
function htmlOwnSightings(tag, props) {
|
|
465
|
+
// class and id only on html: a component's className is still a prop, not a class
|
|
466
|
+
const classes = props.className ?? props.class;
|
|
467
|
+
const classNames = typeof classes === 'string' ? classes.split(/\s+/).filter(c => c !== '') : [];
|
|
468
|
+
const id = typeof props.id === 'string' ? [['id', props.id]] : [];
|
|
469
|
+
const text = contentText(props.children);
|
|
470
|
+
const interrupted = text === '' ? [] : [['interruptedText', text]];
|
|
471
|
+
return [[`html:${tag}`, props], ...classNames.map(c => ['className', c]), ...id, ...interrupted, ...propSightings(props)];
|
|
472
|
+
}
|
|
473
|
+
// an element's whole text, the markup between the words ignored, as textContent reads it.
|
|
474
|
+
// A component's children count, as the walk takes them: the two say the same about a tree
|
|
475
|
+
function contentText(content) {
|
|
476
|
+
if (ContentNodeIsArray(content)) return content.map(contentText).join('');
|
|
477
|
+
if (ContentNodeIsLiteral(content)) return String(content);
|
|
478
|
+
if (!ContentNodeIsElement(content)) return ''; // null, undefined, boolean
|
|
479
|
+
return contentText(content[$props].children);
|
|
480
|
+
}
|
|
481
|
+
function componentOwnSightings(name, props) {
|
|
482
|
+
return [[`component:${name}`, props], ...propSightings(props)];
|
|
483
|
+
}
|
|
484
|
+
const lower = text => text.toLowerCase();
|
|
485
|
+
// g and y would carry lastIndex from one sighting's test to the next, so they are dropped
|
|
486
|
+
function matching(regex, addFlags = '') {
|
|
487
|
+
const flags = [...new Set(regex.flags.replace(/[gy]/g, '') + addFlags)].join('');
|
|
488
|
+
const plain = new RegExp(regex.source, flags);
|
|
489
|
+
return seen => typeof seen === 'string' && plain.test(seen);
|
|
490
|
+
}
|
|
491
|
+
// subset: chai-subset's containSubset, but a function in the shape is compared by reference, not
|
|
492
|
+
// called: extra keys and array elements pass, each shape element matching some element, any order.
|
|
493
|
+
// duck: as TS structural typing - extra keys pass, but an array is a tuple: same length, in place.
|
|
494
|
+
// Beyond chai-subset: Object.is, as deep-eql, so NaN matches; Map and Set shapes are subsets too.
|
|
495
|
+
// As chai-subset: a key undefined in the shape matches a missing one
|
|
496
|
+
function contains(shape, value, arrays) {
|
|
497
|
+
const within = (inner, seen) => contains(inner, seen, arrays);
|
|
498
|
+
if (Object.is(shape, value)) return true;
|
|
499
|
+
if (typeof shape !== 'object' || shape === null) return false;
|
|
500
|
+
if (typeof value !== 'object' || value === null) return false;
|
|
501
|
+
const someOf = (values, each) => values.some(seen => within(each, seen));
|
|
502
|
+
if (Array.isArray(shape)) {
|
|
503
|
+
if (!('length' in value) || typeof value.length !== 'number') return false;
|
|
504
|
+
const values = Array.from(value);
|
|
505
|
+
return arrays === 'inPlace' ? shape.length === values.length && shape.every((each, i) => within(each, values[i])) : shape.every(each => someOf(values, each));
|
|
506
|
+
}
|
|
507
|
+
if (shape instanceof Date) {
|
|
508
|
+
return value instanceof Date && Object.is(shape.getTime(), value.getTime());
|
|
509
|
+
}
|
|
510
|
+
if (shape instanceof Set) {
|
|
511
|
+
return value instanceof Set && [...shape].every(each => someOf([...value], each));
|
|
512
|
+
}
|
|
513
|
+
if (shape instanceof Map) {
|
|
514
|
+
return value instanceof Map && [...shape].every(([key, each]) => value.has(key) && within(each, value.get(key)));
|
|
515
|
+
}
|
|
516
|
+
const record = value;
|
|
517
|
+
return Object.entries(shape).every(([key, each]) => within(each, record[key]));
|
|
518
|
+
}
|
|
519
|
+
// every prop but children, whose content is walked instead
|
|
520
|
+
function propSightings(props) {
|
|
521
|
+
return Object.entries(props).filter(([name]) => name !== 'children').map(([name, value]) => [`prop:${name}`, value]);
|
|
522
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure.trial.d.ts","sourceRoot":"","sources":["../../src/testing/ensure.trial.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { $props, $type } from '../contentNodeSymbols.js';
|
|
2
|
+
import { ensure } from './ensure.js';
|
|
3
|
+
const content = {
|
|
4
|
+
[$type]: 'span',
|
|
5
|
+
[$props]: {
|
|
6
|
+
children: 'Bob'
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
ensure(content, [ensure.one.text('Bob'), ensure.one.text.contains('o'), ensure.one.prop('to').is('foo')]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentHtmlElements.d.ts","sourceRoot":"","sources":["../../../src/testing/helpers/contentHtmlElements.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"contentHtmlElements.d.ts","sourceRoot":"","sources":["../../../src/testing/helpers/contentHtmlElements.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,WAAW,EAAE,KAAK,eAAe,EAEzC,MAAM,sBAAsB,CAAA;AAG7B,eAAO,MAAM,mBAAmB,GAAI,SAAS,WAAW,KAAG,eAAe,EAUzE,CAAA"}
|