tungsten 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-complete +1 -0
- package/dist/Components.d.ts +6 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +103 -40
- package/dist/DomPointer.d.ts +11 -0
- package/dist/DomPointer.d.ts.map +1 -1
- package/dist/DomPointer.js +15 -0
- package/dist/DomRegion.d.ts +2 -0
- package/dist/DomRegion.d.ts.map +1 -1
- package/dist/DomRegion.js +23 -3
- package/dist/Framework.d.ts +2 -0
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js +94 -61
- package/dist/FrameworkConfig.d.ts +4 -0
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/Instance/Instance.d.ts +1 -1
- package/dist/Instance/Instance.d.ts.map +1 -1
- package/dist/Instance/Instance.js +18 -1
- package/dist/Instance/InstanceConfig.d.ts +1 -0
- package/dist/Instance/InstanceConfig.d.ts.map +1 -1
- package/dist/PopMessage.type.d.ts +6 -0
- package/dist/PopMessage.type.d.ts.map +1 -0
- package/dist/PopMessage.type.js +1 -0
- package/dist/Servers/DevServer.d.ts +2 -0
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +87 -11
- package/dist/Servers/MatchedRouteInfo.d.ts +1 -1
- package/dist/Servers/MatchedRouteInfo.d.ts.map +1 -1
- package/dist/Servers/ProdServer.d.ts +2 -1
- package/dist/Servers/ProdServer.d.ts.map +1 -1
- package/dist/Servers/ProdServer.js +92 -8
- package/dist/Servers/hono/DevServerHono.js +25 -29
- package/dist/Servers/hono/ProdServerHono.js +49 -142
- package/dist/Servers/hono/TungstenServerHono.d.ts +1 -1
- package/dist/Servers/hono/TungstenServerHono.d.ts.map +1 -1
- package/dist/Servers/hono/TungstenServerHono.js +12 -29
- package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.js +16 -5
- package/dist/Servers/routing.d.ts.map +1 -1
- package/dist/Servers/routing.js +10 -6
- package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts +0 -3
- package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts.map +1 -1
- package/dist/Servers/tungstenCorePrivateEnvSchema.js +3 -3
- package/dist/Servers/tungstenCorePublicEnvSchema.d.ts +8 -0
- package/dist/Servers/tungstenCorePublicEnvSchema.d.ts.map +1 -0
- package/dist/Servers/tungstenCorePublicEnvSchema.js +14 -0
- package/dist/Store/InternalStoreSchema.d.ts +2 -0
- package/dist/Store/InternalStoreSchema.d.ts.map +1 -1
- package/dist/Store/InternalStoreSchema.js +1 -0
- package/dist/api/Request.d.ts +1 -1
- package/dist/api/Request.d.ts.map +1 -1
- package/dist/api/Response.d.ts +1 -1
- package/dist/api/Response.d.ts.map +1 -1
- package/dist/babelPlugins/BabelExtractComponentStylesheet.d.ts +13 -0
- package/dist/babelPlugins/BabelExtractComponentStylesheet.d.ts.map +1 -0
- package/dist/babelPlugins/BabelExtractComponentStylesheet.js +24 -0
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts +2 -0
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.js +21 -5
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts +1 -0
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.js +21 -9
- package/dist/babelPlugins/BabelTypes.d.ts +2 -2
- package/dist/babelPlugins/BabelTypes.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTypes.js +0 -1
- package/dist/bin/commands/build.d.ts.map +1 -1
- package/dist/bin/commands/build.js +12 -2
- package/dist/bin/commands/compile.d.ts.map +1 -1
- package/dist/bin/commands/compile.js +7 -2
- package/dist/bin/commands/dev.d.ts.map +1 -1
- package/dist/bin/commands/dev.js +15 -4
- package/dist/bin/commands/devmon.d.ts +2 -0
- package/dist/bin/commands/devmon.d.ts.map +1 -0
- package/dist/bin/commands/devmon.js +66 -0
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +6 -0
- package/dist/booleanAttributeValue.d.ts +21 -0
- package/dist/booleanAttributeValue.d.ts.map +1 -0
- package/dist/booleanAttributeValue.js +23 -0
- package/dist/build/CompilationInfo.d.ts +1 -0
- package/dist/build/CompilationInfo.d.ts.map +1 -1
- package/dist/build/combineComponentCss.d.ts +1 -1
- package/dist/build/combineComponentCss.d.ts.map +1 -1
- package/dist/build/combineComponentCss.js +3 -3
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +3 -3
- package/dist/build/compileUserApp.d.ts +2 -1
- package/dist/build/compileUserApp.d.ts.map +1 -1
- package/dist/build/compileUserApp.js +18 -8
- package/dist/build/createInstanceConfigFile.js +1 -1
- package/dist/build/frameworkStylesheets.d.ts +5 -0
- package/dist/build/frameworkStylesheets.d.ts.map +1 -0
- package/dist/build/frameworkStylesheets.js +49 -0
- package/dist/build/getPackageDirForFile.d.ts +2 -0
- package/dist/build/getPackageDirForFile.d.ts.map +1 -0
- package/dist/build/getPackageDirForFile.js +11 -0
- package/dist/build/getSxyClientPackageAliases.d.ts.map +1 -1
- package/dist/build/getSxyClientPackageAliases.js +3 -1
- package/dist/build/makeBabelUserDevConfig.d.ts +1 -1
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserDevConfig.js +3 -2
- package/dist/build/makeBabelUserProdConfig.d.ts +1 -1
- package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserProdConfig.js +4 -2
- package/dist/build/rollup.user.prod.config.d.ts.map +1 -1
- package/dist/build/rollup.user.prod.config.js +4 -1
- package/dist/build/rollupExtractComponentStylesheets.d.ts +12 -0
- package/dist/build/rollupExtractComponentStylesheets.d.ts.map +1 -0
- package/dist/build/rollupExtractComponentStylesheets.js +35 -0
- package/dist/compat/context.d.ts +1 -1
- package/dist/compat/context.d.ts.map +1 -1
- package/dist/compat/types.d.ts +1 -1
- package/dist/compat/types.d.ts.map +1 -1
- package/dist/componentCss/i/T-components-library-RichTextEditor-RichTextEditor.css +115 -0
- package/dist/componentCss/i/T-components-library-__StatefulMessage-StatefulMessage.css +25 -0
- package/dist/componentCss/tungsten.css +2 -0
- package/dist/componentProxyHandlers.d.ts +2 -1
- package/dist/componentProxyHandlers.d.ts.map +1 -1
- package/dist/componentProxyHandlers.js +45 -9
- package/dist/components/GoToComponent.d.ts +1 -1
- package/dist/components/GoToComponent.d.ts.map +1 -1
- package/dist/components/PopMessages.d.ts +12 -0
- package/dist/components/PopMessages.d.ts.map +1 -0
- package/dist/components/PopMessages.js +45 -0
- package/dist/components/_GoToComponent.d.ts +10 -0
- package/dist/components/_GoToComponent.d.ts.map +1 -0
- package/dist/components/_GoToComponent.js +13 -0
- package/dist/components/library/RichTextEditor/RichTextEditor.d.ts +50 -0
- package/dist/components/library/RichTextEditor/RichTextEditor.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/RichTextEditor.js +458 -0
- package/dist/components/library/RichTextEditor/StoredContentNode.d.ts +5 -0
- package/dist/components/library/RichTextEditor/StoredContentNode.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/StoredContentNode.js +1 -0
- package/dist/components/library/RichTextEditor/activeFormats.d.ts +20 -0
- package/dist/components/library/RichTextEditor/activeFormats.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/activeFormats.js +48 -0
- package/dist/components/library/RichTextEditor/contentTree.d.ts +30 -0
- package/dist/components/library/RichTextEditor/contentTree.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/contentTree.js +81 -0
- package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.d.ts +30 -0
- package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.js +97 -0
- package/dist/components/library/__StatefulMessage/MessageData.d.ts +7 -0
- package/dist/components/library/__StatefulMessage/MessageData.d.ts.map +1 -0
- package/dist/components/library/__StatefulMessage/MessageData.js +1 -0
- package/dist/components/library/__StatefulMessage/StatefulMessage.d.ts +22 -0
- package/dist/components/library/__StatefulMessage/StatefulMessage.d.ts.map +1 -0
- package/dist/components/library/__StatefulMessage/StatefulMessage.js +88 -0
- package/dist/components/library/index.d.ts +5 -0
- package/dist/components/library/index.d.ts.map +1 -0
- package/dist/components/library/index.js +7 -0
- package/dist/defaultConfig.d.ts +2 -0
- package/dist/defaultConfig.d.ts.map +1 -1
- package/dist/defaultConfig.js +3 -1
- package/dist/env/Interfaces.d.ts +2 -1
- package/dist/env/Interfaces.d.ts.map +1 -1
- package/dist/env/getEnvSchemas.d.ts +1 -1
- package/dist/env/getEnvSchemas.d.ts.map +1 -1
- package/dist/env/injectEnv.d.ts +1 -1
- package/dist/env/injectEnv.d.ts.map +1 -1
- package/dist/env/injectEnv.js +16 -6
- package/dist/env/publicEnv.d.ts.map +1 -1
- package/dist/env/publicEnv.js +4 -1
- package/dist/findUserConfig.d.ts +1 -1
- package/dist/frameworkConfigSchema.d.ts +4 -0
- package/dist/frameworkConfigSchema.d.ts.map +1 -1
- package/dist/frameworkConfigSchema.js +2 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useInstance.d.ts +3 -0
- package/dist/hooks/useInstance.d.ts.map +1 -0
- package/dist/hooks/useInstance.js +4 -0
- package/dist/hydrate/hydrate.d.ts +6 -4
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +51 -13
- package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
- package/dist/hydrate/reconcileHydratedAttributes.js +4 -3
- package/dist/hydrate/renderHydrationMismatchBanner.d.ts +7 -0
- package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -0
- package/dist/hydrate/renderHydrationMismatchBanner.js +69 -0
- package/dist/indexInner.d.ts +13 -5
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +9 -2
- package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
- package/dist/makeInstanceConfigFromFrameworkConfig.js +2 -1
- package/dist/pop.d.ts +10 -0
- package/dist/pop.d.ts.map +1 -0
- package/dist/pop.js +49 -0
- package/dist/postcssPlugins/TransformCssNames.d.ts.map +1 -1
- package/dist/postcssPlugins/TransformCssNames.js +10 -2
- package/dist/propsAreEqual.d.ts +8 -0
- package/dist/propsAreEqual.d.ts.map +1 -0
- package/dist/propsAreEqual.js +97 -0
- package/dist/rawHtml/filterContentNode.d.ts +20 -0
- package/dist/rawHtml/filterContentNode.d.ts.map +1 -0
- package/dist/rawHtml/filterContentNode.js +96 -0
- package/dist/rawHtml/parseHtml.d.ts +14 -0
- package/dist/rawHtml/parseHtml.d.ts.map +1 -1
- package/dist/rawHtml/parseHtml.js +4 -4
- package/dist/rawHtml/sanitizeHtml.d.ts +17 -0
- package/dist/rawHtml/sanitizeHtml.d.ts.map +1 -0
- package/dist/rawHtml/sanitizeHtml.js +19 -0
- package/dist/render/HeadData.d.ts +2 -0
- package/dist/render/HeadData.d.ts.map +1 -1
- package/dist/render/contentNodeToHtml.d.ts +18 -0
- package/dist/render/contentNodeToHtml.d.ts.map +1 -0
- package/dist/render/contentNodeToHtml.js +66 -0
- package/dist/render/contentToHtml.d.ts.map +1 -1
- package/dist/render/contentToHtml.js +3 -1
- package/dist/render/instantiateClassComponent.d.ts.map +1 -1
- package/dist/render/instantiateClassComponent.js +4 -0
- package/dist/render/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +22 -3
- package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
- package/dist/render/renderingTreeToHtml.js +8 -1
- package/dist/routing/ErrorRouteType.d.ts +6 -0
- package/dist/routing/ErrorRouteType.d.ts.map +1 -0
- package/dist/routing/ErrorRouteType.js +1 -0
- package/dist/routing/RouteTypes.d.ts +2 -1
- package/dist/routing/RouteTypes.d.ts.map +1 -1
- package/dist/routing/Routes.d.ts +5 -0
- package/dist/routing/Routes.d.ts.map +1 -1
- package/dist/routing/TungstenErrorInfo.d.ts +6 -0
- package/dist/routing/TungstenErrorInfo.d.ts.map +1 -0
- package/dist/routing/TungstenErrorInfo.js +6 -0
- package/dist/settings.d.ts +2 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +3 -0
- package/dist/stateTracking.d.ts +47 -0
- package/dist/stateTracking.d.ts.map +1 -0
- package/dist/stateTracking.js +83 -0
- package/dist/staticGen/staticGen.d.ts.map +1 -1
- package/dist/staticGen/staticGen.js +117 -107
- package/dist/style/styleContentSxy.js +21 -0
- package/dist/testing/hydrateTestApp.d.ts +38 -0
- package/dist/testing/hydrateTestApp.d.ts.map +1 -0
- package/dist/testing/hydrateTestApp.js +242 -0
- package/dist/testing/index.d.ts +4 -3
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +16 -2
- package/dist/testing/installTestStyleProcessors.d.ts +2 -0
- package/dist/testing/installTestStyleProcessors.d.ts.map +1 -0
- package/dist/testing/installTestStyleProcessors.js +21 -0
- package/dist/testing/temp/componentPackageMock.d.ts +18 -0
- package/dist/testing/temp/componentPackageMock.d.ts.map +1 -0
- package/dist/testing/temp/componentPackageMock.js +37 -0
- package/dist/testing/temp/contentHtmlElements.d.ts +3 -0
- package/dist/testing/temp/contentHtmlElements.d.ts.map +1 -0
- package/dist/testing/temp/contentHtmlElements.js +12 -0
- package/dist/timeProfiler.d.ts +6 -0
- package/dist/timeProfiler.d.ts.map +1 -0
- package/dist/timeProfiler.js +31 -0
- package/dist/update/integrateUpdateVdom.d.ts +11 -0
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +169 -54
- package/dist/update/pendingMounts.d.ts +25 -0
- package/dist/update/pendingMounts.d.ts.map +1 -0
- package/dist/update/pendingMounts.js +55 -0
- package/dist/warnOnFrameworkChange.d.ts.map +1 -1
- package/dist/warnOnFrameworkChange.js +8 -8
- package/package.json +21 -17
- package/dist/FunctionComponentStandIn.sxyt.d.ts +0 -2
- package/dist/FunctionComponentStandIn.sxyt.d.ts.map +0 -1
- package/dist/FunctionComponentStandIn.sxyt.js +0 -52
- package/dist/Instance/gotoRedirect.sxyt.d.ts +0 -2
- package/dist/Instance/gotoRedirect.sxyt.d.ts.map +0 -1
- package/dist/Instance/gotoRedirect.sxyt.js +0 -148
- package/dist/Instance/runTrackedWork.sxyt.d.ts +0 -2
- package/dist/Instance/runTrackedWork.sxyt.d.ts.map +0 -1
- package/dist/Instance/runTrackedWork.sxyt.js +0 -35
- package/dist/Servers/devErrorPageAutoRetry.sxyt.d.ts +0 -2
- package/dist/Servers/devErrorPageAutoRetry.sxyt.d.ts.map +0 -1
- package/dist/Servers/devErrorPageAutoRetry.sxyt.js +0 -117
- package/dist/_client/cjsHelpers.sxyt.d.ts +0 -2
- package/dist/_client/cjsHelpers.sxyt.d.ts.map +0 -1
- package/dist/_client/cjsHelpers.sxyt.js +0 -45
- package/dist/auth/passwordHashing.sxyt.d.ts +0 -2
- package/dist/auth/passwordHashing.sxyt.d.ts.map +0 -1
- package/dist/auth/passwordHashing.sxyt.js +0 -46
- package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts +0 -2
- package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts.map +0 -1
- package/dist/auth/ref/checkPasswordResetToken.sxyt.js +0 -40
- package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts +0 -2
- package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts.map +0 -1
- package/dist/auth/ref/createPasswordResetToken.sxyt.js +0 -10
- package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.d.ts +0 -2
- package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.d.ts.map +0 -1
- package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.js +0 -138
- package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts +0 -2
- package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts.map +0 -1
- package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.js +0 -108
- package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts +0 -2
- package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts.map +0 -1
- package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.js +0 -104
- package/dist/bin/commands/compile.sxyt.d.ts +0 -2
- package/dist/bin/commands/compile.sxyt.d.ts.map +0 -1
- package/dist/bin/commands/compile.sxyt.js +0 -255
- package/dist/build/modifySassImports.sxyt.d.ts +0 -2
- package/dist/build/modifySassImports.sxyt.d.ts.map +0 -1
- package/dist/build/modifySassImports.sxyt.js +0 -55
- package/dist/build/sassImportParser.sxyt.d.ts +0 -2
- package/dist/build/sassImportParser.sxyt.d.ts.map +0 -1
- package/dist/build/sassImportParser.sxyt.js +0 -110
- package/dist/build/scssImportParserChatgpt.sxyt.d.ts +0 -2
- package/dist/build/scssImportParserChatgpt.sxyt.d.ts.map +0 -1
- package/dist/build/scssImportParserChatgpt.sxyt.js +0 -120
- package/dist/clone.sxyt.d.ts +0 -2
- package/dist/clone.sxyt.d.ts.map +0 -1
- package/dist/clone.sxyt.js +0 -24
- package/dist/componentProxyHandlers.sxyt.d.ts +0 -2
- package/dist/componentProxyHandlers.sxyt.d.ts.map +0 -1
- package/dist/componentProxyHandlers.sxyt.js +0 -130
- package/dist/components/RawHtml.sxyt.d.ts +0 -2
- package/dist/components/RawHtml.sxyt.d.ts.map +0 -1
- package/dist/components/RawHtml.sxyt.js +0 -104
- package/dist/components/bindable/BindableSelect.sxyt.d.ts +0 -2
- package/dist/components/bindable/BindableSelect.sxyt.d.ts.map +0 -1
- package/dist/components/bindable/BindableSelect.sxyt.js +0 -186
- package/dist/env/injectEnv.sxyt.d.ts +0 -2
- package/dist/env/injectEnv.sxyt.d.ts.map +0 -1
- package/dist/env/injectEnv.sxyt.js +0 -20
- package/dist/env/parseEnv.d.ts +0 -2
- package/dist/env/parseEnv.d.ts.map +0 -1
- package/dist/env/parseEnv.js +0 -14
- package/dist/env/parseEnv.sxyt.d.ts +0 -2
- package/dist/env/parseEnv.sxyt.d.ts.map +0 -1
- package/dist/env/parseEnv.sxyt.js +0 -11
- package/dist/findProjectDir.sxyt.d.ts +0 -2
- package/dist/findProjectDir.sxyt.d.ts.map +0 -1
- package/dist/findProjectDir.sxyt.js +0 -82
- package/dist/hmr/applyHmrModule.sxyt.d.ts +0 -2
- package/dist/hmr/applyHmrModule.sxyt.d.ts.map +0 -1
- package/dist/hmr/applyHmrModule.sxyt.js +0 -182
- package/dist/hmr/instanceRegistry.sxyt.d.ts +0 -2
- package/dist/hmr/instanceRegistry.sxyt.d.ts.map +0 -1
- package/dist/hmr/instanceRegistry.sxyt.js +0 -24
- package/dist/hmr/refreshStylesheets.sxyt.d.ts +0 -2
- package/dist/hmr/refreshStylesheets.sxyt.d.ts.map +0 -1
- package/dist/hmr/refreshStylesheets.sxyt.js +0 -46
- package/dist/hydrate/hydrate.sxyt.d.ts +0 -2
- package/dist/hydrate/hydrate.sxyt.d.ts.map +0 -1
- package/dist/hydrate/hydrate.sxyt.js +0 -302
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts +0 -2
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts.map +0 -1
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.js +0 -190
- package/dist/importDevModuleWithRetry.sxyt.d.ts +0 -2
- package/dist/importDevModuleWithRetry.sxyt.d.ts.map +0 -1
- package/dist/importDevModuleWithRetry.sxyt.js +0 -104
- package/dist/innerHtmlFromProps.sxyt.d.ts +0 -2
- package/dist/innerHtmlFromProps.sxyt.d.ts.map +0 -1
- package/dist/innerHtmlFromProps.sxyt.js +0 -99
- package/dist/postcssPlugins/parseSelectors.sxyt.d.ts +0 -2
- package/dist/postcssPlugins/parseSelectors.sxyt.d.ts.map +0 -1
- package/dist/postcssPlugins/parseSelectors.sxyt.js +0 -62
- package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts +0 -2
- package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts.map +0 -1
- package/dist/postcssPlugins/parseSelectorsRich.sxyt.js +0 -155
- package/dist/rawHtml/parseHtml.sxyt.d.ts +0 -2
- package/dist/rawHtml/parseHtml.sxyt.d.ts.map +0 -1
- package/dist/rawHtml/parseHtml.sxyt.js +0 -239
- package/dist/render/getFunctionBodyAsString.sxyt.d.ts +0 -2
- package/dist/render/getFunctionBodyAsString.sxyt.d.ts.map +0 -1
- package/dist/render/getFunctionBodyAsString.sxyt.js +0 -37
- package/dist/render/processHead.sxyt.d.ts +0 -2
- package/dist/render/processHead.sxyt.d.ts.map +0 -1
- package/dist/render/processHead.sxyt.js +0 -93
- package/dist/render/processProps.sxyt.d.ts +0 -2
- package/dist/render/processProps.sxyt.d.ts.map +0 -1
- package/dist/render/processProps.sxyt.js +0 -90
- package/dist/routing/compareRequestToRegex.sxyt.d.ts +0 -2
- package/dist/routing/compareRequestToRegex.sxyt.d.ts.map +0 -1
- package/dist/routing/compareRequestToRegex.sxyt.js +0 -65
- package/dist/routing/getPathPriority.sxyt.d.ts +0 -2
- package/dist/routing/getPathPriority.sxyt.d.ts.map +0 -1
- package/dist/routing/getPathPriority.sxyt.js +0 -24
- package/dist/routing/matchPath.sxyt.d.ts +0 -2
- package/dist/routing/matchPath.sxyt.d.ts.map +0 -1
- package/dist/routing/matchPath.sxyt.js +0 -41
- package/dist/routing/patternToRegex.sxyt.d.ts +0 -2
- package/dist/routing/patternToRegex.sxyt.d.ts.map +0 -1
- package/dist/routing/patternToRegex.sxyt.js +0 -69
- package/dist/routing/splitRequest.sxyt.d.ts +0 -2
- package/dist/routing/splitRequest.sxyt.d.ts.map +0 -1
- package/dist/routing/splitRequest.sxyt.js +0 -47
- package/dist/style/jssToCss.sxyt.d.ts +0 -2
- package/dist/style/jssToCss.sxyt.d.ts.map +0 -1
- package/dist/style/jssToCss.sxyt.js +0 -17
- package/dist/testing/createTestApp.sxyt.d.ts +0 -2
- package/dist/testing/createTestApp.sxyt.d.ts.map +0 -1
- package/dist/testing/createTestApp.sxyt.js +0 -470
- package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts +0 -2
- package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts.map +0 -1
- package/dist/testing/ensureTestEnvLoaded.sxyt.js +0 -20
- package/dist/update/hotSwap.sxyt.d.ts +0 -2
- package/dist/update/hotSwap.sxyt.d.ts.map +0 -1
- package/dist/update/hotSwap.sxyt.js +0 -252
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { describe } from 'sxy-test-runner';
|
|
2
|
-
import { expect } from 'chai';
|
|
3
|
-
import { parseHtml } from "./parseHtml.js";
|
|
4
|
-
import { safeHtmlAllowList } from "./safeHtmlAllowList.js";
|
|
5
|
-
import { decodeHtmlEntities } from "./decodeHtmlEntities.js";
|
|
6
|
-
import { tokenizeHtml } from "./tokenizeHtml.js";
|
|
7
|
-
import { renderingNodeToHtml } from "../render/renderingTreeToHtml.js";
|
|
8
|
-
import { $props, $type } from "../contentNodeSymbols.js";
|
|
9
|
-
// `found: true` short-circuits the <head> handling these tests do not need.
|
|
10
|
-
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
11
|
-
const noHeadData = {
|
|
12
|
-
found: true
|
|
13
|
-
};
|
|
14
|
-
// Renders a parsed tree back to markup. The renderer takes a RenderingNode,
|
|
15
|
-
// which for plain HTML content is structurally what parseHtml returns.
|
|
16
|
-
const render = async content => renderingNodeToHtml(
|
|
17
|
-
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
18
|
-
content, false, noHeadData, null);
|
|
19
|
-
const roundTrip = html => render(parseHtml(html));
|
|
20
|
-
describe('decodeHtmlEntities()', ({
|
|
21
|
-
it
|
|
22
|
-
}) => {
|
|
23
|
-
it('decodes named, decimal and hex references', () => {
|
|
24
|
-
expect(decodeHtmlEntities('£100 & more')).to.equal('£100 & more');
|
|
25
|
-
expect(decodeHtmlEntities('AB')).to.equal('AB');
|
|
26
|
-
expect(decodeHtmlEntities('AB')).to.equal('AB');
|
|
27
|
-
});
|
|
28
|
-
it('leaves unknown and malformed references exactly as written', () => {
|
|
29
|
-
expect(decodeHtmlEntities('¬areal; &')).to.equal('¬areal; &');
|
|
30
|
-
expect(decodeHtmlEntities('a & b')).to.equal('a & b');
|
|
31
|
-
});
|
|
32
|
-
it('does not throw on out-of-range numeric references', () => {
|
|
33
|
-
expect(decodeHtmlEntities('�')).to.equal('�');
|
|
34
|
-
expect(decodeHtmlEntities('�')).to.equal('�');
|
|
35
|
-
expect(decodeHtmlEntities('�')).to.equal('�');
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
describe('tokenizeHtml()', ({
|
|
39
|
-
it
|
|
40
|
-
}) => {
|
|
41
|
-
it('reads attributes in every quoting style', () => {
|
|
42
|
-
const [token] = tokenizeHtml('<a href="/x" title=\'y\' data-n=3 hidden>');
|
|
43
|
-
expect(token?.kind).to.equal('open');
|
|
44
|
-
expect(token?.kind === 'open' && token.attributes).to.deep.equal({
|
|
45
|
-
href: '/x',
|
|
46
|
-
title: 'y',
|
|
47
|
-
'data-n': '3',
|
|
48
|
-
hidden: true
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
it('drops comments and doctypes', () => {
|
|
52
|
-
expect(tokenizeHtml('<!doctype html><!-- hi --><b>x</b>').map(token => token.kind)).to.deep.equal(['open', 'text', 'close']);
|
|
53
|
-
});
|
|
54
|
-
it('treats a bare < as text', () => {
|
|
55
|
-
expect(tokenizeHtml('5 < 6 and 7 > 2')).to.deep.equal([{
|
|
56
|
-
kind: 'text',
|
|
57
|
-
text: '5 < 6 and 7 > 2'
|
|
58
|
-
}]);
|
|
59
|
-
});
|
|
60
|
-
it('takes script content as literal text, not markup', () => {
|
|
61
|
-
expect(tokenizeHtml('<script>if (a<b) x()</script>').map(token => token.kind)).to.deep.equal(['open', 'text', 'close']);
|
|
62
|
-
});
|
|
63
|
-
// scanning for the first > would cut this tag short and build a tree the
|
|
64
|
-
// browser disagrees with
|
|
65
|
-
it('does not end a tag at a > inside a quoted attribute value', () => {
|
|
66
|
-
const [token] = tokenizeHtml('<a title="a > b" href="/x">');
|
|
67
|
-
expect(token?.kind === 'open' && token.attributes).to.deep.equal({
|
|
68
|
-
title: 'a > b',
|
|
69
|
-
href: '/x'
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
describe('parseHtml()', ({
|
|
74
|
-
it
|
|
75
|
-
}) => {
|
|
76
|
-
it('returns null for empty and non-string input', () => {
|
|
77
|
-
expect(parseHtml('')).to.equal(null);
|
|
78
|
-
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
79
|
-
expect(parseHtml(undefined)).to.equal(null);
|
|
80
|
-
});
|
|
81
|
-
it('builds an element tree with decoded text', async () => {
|
|
82
|
-
const content = parseHtml('<p>Bonus £100</p>');
|
|
83
|
-
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
84
|
-
const node = content;
|
|
85
|
-
expect(node[$type]).to.equal('p');
|
|
86
|
-
expect(node[$props].children).to.equal('Bonus £100');
|
|
87
|
-
});
|
|
88
|
-
it('maps class to className and style to css, which the renderer expects', async () => {
|
|
89
|
-
expect(await roundTrip('<p class="a b" style="color: red">x</p>')).to.equal('<p class="a b" style="color: red">x</p>');
|
|
90
|
-
});
|
|
91
|
-
it('keeps sibling paragraphs as siblings rather than nesting them', async () => {
|
|
92
|
-
expect(await roundTrip('<p>one</p><p>two</p>')).to.equal('<p>one</p><p>two</p>');
|
|
93
|
-
});
|
|
94
|
-
// The rule that broke the dashboard: a browser closes an open <p> at the
|
|
95
|
-
// next block-level start tag, so the parser must too, or the tree and the
|
|
96
|
-
// DOM disagree and hydration walks off the end.
|
|
97
|
-
it('applies the implied end tag that closes a p at a block element', async () => {
|
|
98
|
-
expect(await roundTrip('<p>one<div>two</div>')).to.equal('<p>one</p><div>two</div>');
|
|
99
|
-
});
|
|
100
|
-
it('closes list items and table cells implicitly', async () => {
|
|
101
|
-
expect(await roundTrip('<ul><li>a<li>b</ul>')).to.equal('<ul><li>a</li><li>b</li></ul>');
|
|
102
|
-
expect(await roundTrip('<table><tbody><tr><td>a<td>b</tbody></table>')).to.equal('<table><tbody><tr><td>a</td><td>b</td></tr></tbody></table>');
|
|
103
|
-
});
|
|
104
|
-
// Parsers disagree over whether whitespace survives inside a table, so the
|
|
105
|
-
// markup carries none — the tree and the DOM then agree either way.
|
|
106
|
-
it('drops whitespace between table tags', async () => {
|
|
107
|
-
expect(await roundTrip('<table>\n<tbody>\n<tr><td>a</td></tr>\n</tbody>\n</table>')).to.equal('<table><tbody><tr><td>a</td></tr></tbody></table>');
|
|
108
|
-
});
|
|
109
|
-
it('foster-parents real text out to just before the table', async () => {
|
|
110
|
-
expect(await roundTrip('<table><tbody>stray<tr><td>a</td></tr></tbody></table>')).to.equal('stray<table><tbody><tr><td>a</td></tr></tbody></table>');
|
|
111
|
-
});
|
|
112
|
-
it('leaves stray text alone in lists and selects, which do not relocate it', async () => {
|
|
113
|
-
expect(await roundTrip('<ul>loose<li>a</li></ul>')).to.equal('<ul>loose<li>a</li></ul>');
|
|
114
|
-
});
|
|
115
|
-
it('handles void and self-closing elements', async () => {
|
|
116
|
-
expect(await roundTrip('<p>a<br>b<img src="/x" />c</p>')).to.equal('<p>a<br />b<img src="/x" />c</p>');
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
describe('parseHtml() resilience', ({
|
|
120
|
-
it
|
|
121
|
-
}) => {
|
|
122
|
-
// "Safe" here means it always produces something renderable, whatever it
|
|
123
|
-
// is handed. None of these may throw.
|
|
124
|
-
const malformed = ['<p>unclosed', '</p>stray end tag', '<p><b>crossed</p></b>', '<<>><p>x</p>', '<p class="unterminated>x</p>', '<!-- never closed', '<p', '<>', '<p><p><p><p>deep', '&&&;&#;&#x;', '<div><span></div></span>', '<TABLE><TR><TD>caps</TD></TR></TABLE>'];
|
|
125
|
-
for (const html of malformed) {
|
|
126
|
-
it(`does not throw on ${JSON.stringify(html)}`, async () => {
|
|
127
|
-
const content = parseHtml(html);
|
|
128
|
-
const rendered = await render(content);
|
|
129
|
-
expect(rendered).to.be.a('string');
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
it('keeps the text of an unclosed element', async () => {
|
|
133
|
-
expect(await roundTrip('<p>unclosed')).to.equal('<p>unclosed</p>');
|
|
134
|
-
});
|
|
135
|
-
it('ignores a stray end tag but keeps its text', async () => {
|
|
136
|
-
expect(await roundTrip('</p>after')).to.equal('after');
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
describe('parseHtml() sanitizing', ({
|
|
140
|
-
it
|
|
141
|
-
}) => {
|
|
142
|
-
it('drops script elements together with their contents', async () => {
|
|
143
|
-
expect(await roundTrip('<p>a</p><script>alert(1)</script><p>b</p>')).to.equal('<p>a</p><p>b</p>');
|
|
144
|
-
});
|
|
145
|
-
it('drops on* handler attributes', async () => {
|
|
146
|
-
expect(await roundTrip('<p onclick="alert(1)" onerror="x()" title="keep">a</p>')).to.equal('<p title="keep">a</p>');
|
|
147
|
-
});
|
|
148
|
-
it('drops javascript: urls, including obfuscated ones', async () => {
|
|
149
|
-
expect(await roundTrip('<a href="javascript:alert(1)">x</a>')).to.equal('<a>x</a>');
|
|
150
|
-
expect(await roundTrip('<a href=" JaVaScRiPt:alert(1)">x</a>')).to.equal('<a>x</a>');
|
|
151
|
-
// browsers ignore control characters inside the scheme, so this runs
|
|
152
|
-
expect(await roundTrip('<a href="java\tscript:alert(1)">x</a>')).to.equal('<a>x</a>');
|
|
153
|
-
expect(await roundTrip('<a href="vbscript:x">x</a>')).to.equal('<a>x</a>');
|
|
154
|
-
expect(await roundTrip('<a href="/safe">x</a>')).to.equal('<a href="/safe">x</a>');
|
|
155
|
-
expect(await roundTrip('<a href="https://x.test/">x</a>')).to.equal('<a href="https://x.test/">x</a>');
|
|
156
|
-
});
|
|
157
|
-
it('bars data: urls from navigation but allows them as image sources', async () => {
|
|
158
|
-
expect(await roundTrip('<a href="data:text/html,hello">x</a>')).to.equal('<a>x</a>');
|
|
159
|
-
expect(await roundTrip('<img src="data:image/png;base64,AAAA" />')).to.equal('<img src="data:image/png;base64,AAAA" />');
|
|
160
|
-
});
|
|
161
|
-
it('keeps handler attributes out even when sanitizing is off', async () => {
|
|
162
|
-
// Tungsten reads on* props as event listeners, so a string there is a
|
|
163
|
-
// hydration fault, not just a security question.
|
|
164
|
-
const content = parseHtml('<p onclick="alert(1)">a</p>', {
|
|
165
|
-
sanitize: false
|
|
166
|
-
});
|
|
167
|
-
expect(await render(content)).to.equal('<p>a</p>');
|
|
168
|
-
});
|
|
169
|
-
it('keeps scripts when sanitizing is turned off', async () => {
|
|
170
|
-
const content = parseHtml('<div><script>x()</script></div>', {
|
|
171
|
-
sanitize: false
|
|
172
|
-
});
|
|
173
|
-
expect(await render(content)).to.equal('<div><script>x()</script></div>');
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
describe('parseHtml() allow lists', ({
|
|
177
|
-
it
|
|
178
|
-
}) => {
|
|
179
|
-
const withList = (html, allowList) => render(parseHtml(html, {
|
|
180
|
-
allowList
|
|
181
|
-
}));
|
|
182
|
-
const onlyEmphasis = {
|
|
183
|
-
tags: ['p', 'em'],
|
|
184
|
-
attributes: []
|
|
185
|
-
};
|
|
186
|
-
it('keeps listed tags and unwraps unlisted ones, preserving their text', async () => {
|
|
187
|
-
expect(await withList('<p>keep <em>this</em> and <b>that</b></p>', onlyEmphasis)).to.equal('<p>keep <em>this</em> and that</p>');
|
|
188
|
-
});
|
|
189
|
-
it('unwraps an unlisted element without losing its listed descendants', async () => {
|
|
190
|
-
expect(await withList('<div><p>inner</p></div>', onlyEmphasis)).to.equal('<p>inner</p>');
|
|
191
|
-
});
|
|
192
|
-
it('drops program-text elements entirely rather than unwrapping them', async () => {
|
|
193
|
-
// unwrapping <style> would put its CSS on the page as visible text
|
|
194
|
-
expect(await withList('<p>a</p><style>p { color: red }</style>', onlyEmphasis)).to.equal('<p>a</p>');
|
|
195
|
-
});
|
|
196
|
-
it('keeps only listed attributes', async () => {
|
|
197
|
-
const list = {
|
|
198
|
-
tags: ['p'],
|
|
199
|
-
attributes: ['title']
|
|
200
|
-
};
|
|
201
|
-
expect(await withList('<p title="t" id="i" data-x="1">a</p>', list)).to.equal('<p title="t">a</p>');
|
|
202
|
-
});
|
|
203
|
-
it('applies per-tag attributes only to their own tag', async () => {
|
|
204
|
-
const list = {
|
|
205
|
-
tags: ['a', 'p'],
|
|
206
|
-
attributes: [],
|
|
207
|
-
tagAttributes: {
|
|
208
|
-
a: ['href']
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
expect(await withList('<a href="/x">link</a><p href="/y">para</p>', list)).to.equal('<a href="/x">link</a><p>para</p>');
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
describe('safeHtmlAllowList', ({
|
|
215
|
-
it
|
|
216
|
-
}) => {
|
|
217
|
-
const safely = html => render(parseHtml(html, {
|
|
218
|
-
allowList: safeHtmlAllowList
|
|
219
|
-
}));
|
|
220
|
-
it('keeps ordinary authored rich text intact', async () => {
|
|
221
|
-
const html = '<h2>Title</h2><p>Some <strong>bold</strong> and <em>italic</em>.</p>' + '<ul><li>one</li><li>two</li></ul>';
|
|
222
|
-
expect(await safely(html)).to.equal(html);
|
|
223
|
-
});
|
|
224
|
-
it('keeps tables with their layout attributes', async () => {
|
|
225
|
-
const html = '<table><tbody><tr><th align="left">H</th><td colspan="2">C</td></tr></tbody></table>';
|
|
226
|
-
expect(await safely(html)).to.equal(html);
|
|
227
|
-
});
|
|
228
|
-
it('keeps links and images with their own attributes', async () => {
|
|
229
|
-
expect(await safely('<a href="/x" target="_blank" rel="noopener">go</a>')).to.equal('<a href="/x" target="_blank" rel="noopener">go</a>');
|
|
230
|
-
expect(await safely('<img src="/a.png" alt="a" width="10" />')).to.equal('<img src="/a.png" alt="a" width="10" />');
|
|
231
|
-
});
|
|
232
|
-
it('strips style attributes, which can disguise the page without any script', async () => {
|
|
233
|
-
expect(await safely('<p style="position:fixed;top:0">a</p>')).to.equal('<p>a</p>');
|
|
234
|
-
});
|
|
235
|
-
it('removes embedding and form elements but keeps their text', async () => {
|
|
236
|
-
expect(await safely('<iframe src="//evil"></iframe><p>a</p>')).to.equal('<p>a</p>');
|
|
237
|
-
expect(await safely('<form><p>a</p></form>')).to.equal('<p>a</p>');
|
|
238
|
-
});
|
|
239
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getFunctionBodyAsString.sxyt.d.ts","sourceRoot":"","sources":["../../src/render/getFunctionBodyAsString.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { describe } from 'sxy-test-runner';
|
|
2
|
-
import { should as setupShould } from 'chai';
|
|
3
|
-
const should = setupShould(); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
-
import { getFunctionBodyAsString } from "./getFunctionBodyAsString.js";
|
|
5
|
-
describe('getFunctionBodyAsString()', ({
|
|
6
|
-
it
|
|
7
|
-
}) => {
|
|
8
|
-
it('should return the function body of a conventional function as a string', () => {
|
|
9
|
-
const func = function () {
|
|
10
|
-
return 'Hello World';
|
|
11
|
-
};
|
|
12
|
-
const body = getFunctionBodyAsString(func);
|
|
13
|
-
//console.log('body', body)
|
|
14
|
-
body.should.equal('return \'Hello World\';');
|
|
15
|
-
});
|
|
16
|
-
it('should handle multi line conventional functions', () => {
|
|
17
|
-
const func = function () {
|
|
18
|
-
return 'Hello World';
|
|
19
|
-
};
|
|
20
|
-
const body = getFunctionBodyAsString(func);
|
|
21
|
-
//console.log('body', body)
|
|
22
|
-
body.should.equal('return \'Hello World\';');
|
|
23
|
-
});
|
|
24
|
-
it('should return the function body of a braceless arrow function as a string', () => {
|
|
25
|
-
const func = () => 'Hello World';
|
|
26
|
-
const body = getFunctionBodyAsString(func);
|
|
27
|
-
//console.log('body', body)
|
|
28
|
-
body.should.equal('return \'Hello World\';');
|
|
29
|
-
});
|
|
30
|
-
it('should handle multi line braceless arrow functions', () => {
|
|
31
|
-
const func = () => 'Hello' + ' World';
|
|
32
|
-
const body = getFunctionBodyAsString(func);
|
|
33
|
-
//console.log('body', body)
|
|
34
|
-
body.should.equal('return \'Hello\' + \' World\';');
|
|
35
|
-
//body.should.equal('return \'Hello\'\n+ \' World\';')
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processHead.sxyt.d.ts","sourceRoot":"","sources":["../../src/render/processHead.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { Window } from 'happy-dom';
|
|
3
|
-
import { describe } from 'sxy-test-runner';
|
|
4
|
-
import { processHead } from "./processHead.js";
|
|
5
|
-
import { $props, $type } from "../contentNodeSymbols.js";
|
|
6
|
-
import { Instance } from "../Instance/Instance.js";
|
|
7
|
-
import { initStores } from "../Servers/initStores.js";
|
|
8
|
-
import { UpdateScheduler } from "../update/UpdateScheduler.js";
|
|
9
|
-
function makeHeadData(hmr) {
|
|
10
|
-
const location = '/';
|
|
11
|
-
const globalData = {};
|
|
12
|
-
const matchedRouteInfo = {
|
|
13
|
-
key: null,
|
|
14
|
-
params: {},
|
|
15
|
-
content: null
|
|
16
|
-
};
|
|
17
|
-
const {
|
|
18
|
-
internalStore,
|
|
19
|
-
stores,
|
|
20
|
-
storeSubscriptions
|
|
21
|
-
} = initStores(location, null, globalData, matchedRouteInfo);
|
|
22
|
-
const instanceConfig = {
|
|
23
|
-
prod: false,
|
|
24
|
-
useRootComponent: true,
|
|
25
|
-
clientSideNav: false,
|
|
26
|
-
siteBasePath: '/',
|
|
27
|
-
staticSite: false
|
|
28
|
-
};
|
|
29
|
-
const emptyRoutes = {}; // eslint-disable-line no-type-assertion/no-type-assertion -- not exercised by this test
|
|
30
|
-
const window = new Window();
|
|
31
|
-
const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
|
|
32
|
-
const scheduler = new UpdateScheduler();
|
|
33
|
-
// navigation: false sidesteps Instance's popstate listener setup, which reaches for the
|
|
34
|
-
// process-wide `window` global when no runtimeContext is given at all - see hydrate.sxyt.tsx
|
|
35
|
-
const instance = new Instance(location, instanceConfig, null, emptyRoutes, emptyRoutes,
|
|
36
|
-
// eslint-disable-line no-type-assertion/no-type-assertion
|
|
37
|
-
internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo, {
|
|
38
|
-
document,
|
|
39
|
-
window: document.defaultView,
|
|
40
|
-
scheduler,
|
|
41
|
-
navigation: false
|
|
42
|
-
});
|
|
43
|
-
return {
|
|
44
|
-
found: false,
|
|
45
|
-
instance,
|
|
46
|
-
clientImportAliases: {},
|
|
47
|
-
importAliases: {},
|
|
48
|
-
compilationLocation: '',
|
|
49
|
-
dev: true,
|
|
50
|
-
tungstenPublicEnv: undefined,
|
|
51
|
-
siteBasePath: '',
|
|
52
|
-
hmr
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function reloadScriptText(headNode) {
|
|
56
|
-
const children = headNode[$props].children ?? [];
|
|
57
|
-
const scripts = children.filter(node => node[$type] === 'script');
|
|
58
|
-
const reloadScript = scripts.find(node => typeof node[$props].children === 'string' && node[$props].children.includes('__tungsten_live_reload__'));
|
|
59
|
-
return reloadScript?.[$props].children; // eslint-disable-line no-type-assertion/no-type-assertion -- narrowed by the find() predicate above
|
|
60
|
-
}
|
|
61
|
-
describe('processHead() - hmr config option', ({
|
|
62
|
-
it
|
|
63
|
-
}) => {
|
|
64
|
-
it('injects the full Tier 2 hot-swap script when hmr is true', () => {
|
|
65
|
-
const headNode = {
|
|
66
|
-
[$type]: 'head',
|
|
67
|
-
[$props]: {}
|
|
68
|
-
};
|
|
69
|
-
processHead(headNode, makeHeadData(true));
|
|
70
|
-
const script = reloadScriptText(headNode);
|
|
71
|
-
expect(script).to.contain('applyHmrModule');
|
|
72
|
-
expect(script).to.contain('refreshStylesheets');
|
|
73
|
-
});
|
|
74
|
-
it(`injects only the Tier 1 always-full-reload script when hmr is 'reload'`, () => {
|
|
75
|
-
const headNode = {
|
|
76
|
-
[$type]: 'head',
|
|
77
|
-
[$props]: {}
|
|
78
|
-
};
|
|
79
|
-
processHead(headNode, makeHeadData('reload'));
|
|
80
|
-
const script = reloadScriptText(headNode);
|
|
81
|
-
expect(script).to.not.contain('applyHmrModule');
|
|
82
|
-
expect(script).to.not.contain('refreshStylesheets');
|
|
83
|
-
expect(script).to.contain('location.reload()');
|
|
84
|
-
});
|
|
85
|
-
it('injects no live-reload script at all when hmr is false', () => {
|
|
86
|
-
const headNode = {
|
|
87
|
-
[$type]: 'head',
|
|
88
|
-
[$props]: {}
|
|
89
|
-
};
|
|
90
|
-
processHead(headNode, makeHeadData(false));
|
|
91
|
-
expect(reloadScriptText(headNode)).to.equal(undefined);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processProps.sxyt.d.ts","sourceRoot":"","sources":["../../src/render/processProps.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { describe } from 'sxy-test-runner';
|
|
2
|
-
import { expect } from 'chai';
|
|
3
|
-
import { processProps } from "./processProps.js";
|
|
4
|
-
import { htmlEvents } from "../htmlEvents.js";
|
|
5
|
-
describe('processProps()', ({
|
|
6
|
-
it
|
|
7
|
-
}) => {
|
|
8
|
-
it('keeps ordinary attributes', () => {
|
|
9
|
-
expect(processProps({
|
|
10
|
-
name: 'a',
|
|
11
|
-
title: 't',
|
|
12
|
-
'data-x': '1'
|
|
13
|
-
})).to.deep.equal({
|
|
14
|
-
name: 'a',
|
|
15
|
-
title: 't',
|
|
16
|
-
'data-x': '1'
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
// The list of handlers used to be written out by hand and missed most of
|
|
20
|
-
// them, so anything not named leaked into the markup as an attribute
|
|
21
|
-
// holding a stringified function.
|
|
22
|
-
it('strips every event handler Tungsten recognises, not a hand-picked few', () => {
|
|
23
|
-
const handlers = Object.fromEntries(Object.keys(htmlEvents).map(name => [name, () => undefined]));
|
|
24
|
-
expect(processProps({
|
|
25
|
-
...handlers,
|
|
26
|
-
name: 'a'
|
|
27
|
-
})).to.deep.equal({
|
|
28
|
-
name: 'a'
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
it('strips the handlers that were missing from the old list', () => {
|
|
32
|
-
const kept = processProps({
|
|
33
|
-
onInput: () => undefined,
|
|
34
|
-
onFocus: () => undefined,
|
|
35
|
-
onBlur: () => undefined,
|
|
36
|
-
onScroll: () => undefined,
|
|
37
|
-
onPaste: () => undefined,
|
|
38
|
-
name: 'a'
|
|
39
|
-
});
|
|
40
|
-
expect(Object.keys(kept)).to.deep.equal(['name']);
|
|
41
|
-
});
|
|
42
|
-
it('strips props that are instructions to Tungsten rather than attributes', () => {
|
|
43
|
-
const kept = processProps({
|
|
44
|
-
ref: {
|
|
45
|
-
current: null
|
|
46
|
-
},
|
|
47
|
-
__zoneHtml: '<b>x</b>',
|
|
48
|
-
__opaque: true,
|
|
49
|
-
dangerouslySetInnerHTML: {
|
|
50
|
-
__html: '<b>x</b>'
|
|
51
|
-
},
|
|
52
|
-
name: 'a'
|
|
53
|
-
});
|
|
54
|
-
expect(Object.keys(kept)).to.deep.equal(['name']);
|
|
55
|
-
});
|
|
56
|
-
it('renames className to class', () => {
|
|
57
|
-
expect(processProps({
|
|
58
|
-
className: 'a b'
|
|
59
|
-
})).to.deep.equal({
|
|
60
|
-
class: 'a b'
|
|
61
|
-
});
|
|
62
|
-
// a raw class prop is dropped; className is the one that reaches HTML
|
|
63
|
-
expect(processProps({
|
|
64
|
-
class: 'ignored'
|
|
65
|
-
})).to.deep.equal({});
|
|
66
|
-
});
|
|
67
|
-
it('turns a style object into a css string', () => {
|
|
68
|
-
expect(processProps({
|
|
69
|
-
style: {
|
|
70
|
-
backgroundColor: 'red'
|
|
71
|
-
}
|
|
72
|
-
}).style).to.equal('background-color: red;');
|
|
73
|
-
});
|
|
74
|
-
it('folds css into style and does not leave css behind as an attribute', () => {
|
|
75
|
-
const kept = processProps({
|
|
76
|
-
css: 'color: red'
|
|
77
|
-
});
|
|
78
|
-
expect(kept.style).to.equal('color: red');
|
|
79
|
-
expect('css' in kept).to.equal(false);
|
|
80
|
-
});
|
|
81
|
-
it('does not mutate the props it is given', () => {
|
|
82
|
-
const props = {
|
|
83
|
-
className: 'a',
|
|
84
|
-
onClick: () => undefined,
|
|
85
|
-
name: 'n'
|
|
86
|
-
};
|
|
87
|
-
processProps(props);
|
|
88
|
-
expect(Object.keys(props).sort()).to.deep.equal(['className', 'name', 'onClick']);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compareRequestToRegex.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/compareRequestToRegex.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { describe } from 'sxy-test-runner';
|
|
2
|
-
import { expect } from 'chai';
|
|
3
|
-
import { objects } from 'sxy-lib';
|
|
4
|
-
import { compareRequestToRegex } from "./compareRequestToRegex.js";
|
|
5
|
-
import { patternToRegex } from "./patternToRegex.js";
|
|
6
|
-
describe('routing/compareRequestToRegex()', ({
|
|
7
|
-
it
|
|
8
|
-
}) => {
|
|
9
|
-
it(`/foo matches /foo no params`, () => {
|
|
10
|
-
const pattern = '/foo';
|
|
11
|
-
const request = '/foo';
|
|
12
|
-
const {
|
|
13
|
-
regex,
|
|
14
|
-
keys
|
|
15
|
-
} = patternToRegex(pattern);
|
|
16
|
-
const {
|
|
17
|
-
success,
|
|
18
|
-
params
|
|
19
|
-
} = compareRequestToRegex(request, regex, keys);
|
|
20
|
-
success.should.equal(true);
|
|
21
|
-
objects.count(params).should.equal(0);
|
|
22
|
-
});
|
|
23
|
-
it(`/foo does not match /foo/bar`, () => {
|
|
24
|
-
const pattern = '/foo';
|
|
25
|
-
const request = '/foo/bar';
|
|
26
|
-
const {
|
|
27
|
-
regex,
|
|
28
|
-
keys
|
|
29
|
-
} = patternToRegex(pattern);
|
|
30
|
-
const {
|
|
31
|
-
success,
|
|
32
|
-
params
|
|
33
|
-
} = compareRequestToRegex(request, regex, keys); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
34
|
-
success.should.equal(false);
|
|
35
|
-
});
|
|
36
|
-
it(`/foo/:bar matches /foo/bing with the params { bar: 'bing' }"`, () => {
|
|
37
|
-
const pattern = '/foo/:bar';
|
|
38
|
-
const request = '/foo/bing';
|
|
39
|
-
const {
|
|
40
|
-
regex,
|
|
41
|
-
keys
|
|
42
|
-
} = patternToRegex(pattern);
|
|
43
|
-
const c = compareRequestToRegex(request, regex, keys);
|
|
44
|
-
const {
|
|
45
|
-
success,
|
|
46
|
-
params
|
|
47
|
-
} = c;
|
|
48
|
-
success.should.equal(true);
|
|
49
|
-
objects.count(params).should.equal(1);
|
|
50
|
-
expect(params.bar).to.equal('bing');
|
|
51
|
-
});
|
|
52
|
-
it(`/foo/:bar does not match /foo/"`, () => {
|
|
53
|
-
const pattern = '/foo/:bar';
|
|
54
|
-
const request = '/foo/';
|
|
55
|
-
const {
|
|
56
|
-
regex,
|
|
57
|
-
keys
|
|
58
|
-
} = patternToRegex(pattern);
|
|
59
|
-
const {
|
|
60
|
-
success,
|
|
61
|
-
params
|
|
62
|
-
} = compareRequestToRegex(request, regex, keys); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
63
|
-
success.should.equal(false);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPathPriority.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/getPathPriority.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { describe } from 'sxy-test-runner';
|
|
2
|
-
import { getPathPriority } from "./getPathPriority.js";
|
|
3
|
-
describe('routing/compareRequestToRegex()', ({
|
|
4
|
-
it
|
|
5
|
-
}) => {
|
|
6
|
-
it(`/foo returns priority 2`, () => {
|
|
7
|
-
const pattern = '/foo';
|
|
8
|
-
const priority = getPathPriority(pattern);
|
|
9
|
-
//console.log('priority', priority)
|
|
10
|
-
priority.should.equal(2);
|
|
11
|
-
});
|
|
12
|
-
it(`/foo/:bar/foo returns priority 212`, () => {
|
|
13
|
-
const pattern = '/foo/:bar/foo';
|
|
14
|
-
const priority = getPathPriority(pattern);
|
|
15
|
-
//console.log('priority', priority)
|
|
16
|
-
priority.should.equal(212);
|
|
17
|
-
});
|
|
18
|
-
it(`/foo/:bar([^\\/])/foo returns priority 212`, () => {
|
|
19
|
-
const pattern = '/foo/:bar([^\\/])/foo';
|
|
20
|
-
const priority = getPathPriority(pattern);
|
|
21
|
-
//console.log('priority', priority)
|
|
22
|
-
priority.should.equal(212);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchPath.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/matchPath.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { describe } from 'sxy-test-runner';
|
|
2
|
-
import { expect } from 'chai';
|
|
3
|
-
import { matchPath } from "./matchPath.js";
|
|
4
|
-
describe('routing/matchPath()', ({
|
|
5
|
-
it
|
|
6
|
-
}) => {
|
|
7
|
-
it(`returns null for /foo against /bar`, () => {
|
|
8
|
-
expect(matchPath('/foo', '/bar')).to.equal(null);
|
|
9
|
-
});
|
|
10
|
-
it(`returns match object for /foo against /foo`, () => {
|
|
11
|
-
const match = matchPath('/foo', '/foo');
|
|
12
|
-
expect(match).not.to.equal(null);
|
|
13
|
-
});
|
|
14
|
-
it(`returns match object for /foo/ against /foo`, () => {
|
|
15
|
-
const match = matchPath('/foo/', '/foo');
|
|
16
|
-
expect(match).not.to.equal(null);
|
|
17
|
-
});
|
|
18
|
-
it(`matches /foo when the request has a query string`, () => {
|
|
19
|
-
const match = matchPath('/foo', '/foo?bar=1');
|
|
20
|
-
expect(match).not.to.equal(null);
|
|
21
|
-
expect(match.query).to.deep.equal({
|
|
22
|
-
bar: '1'
|
|
23
|
-
});
|
|
24
|
-
expect(match.pathname).to.equal('/foo');
|
|
25
|
-
});
|
|
26
|
-
it(`matches /foo when the request has a hash fragment`, () => {
|
|
27
|
-
const match = matchPath('/foo', '/foo#section');
|
|
28
|
-
expect(match).not.to.equal(null);
|
|
29
|
-
expect(match.hash).to.equal('section');
|
|
30
|
-
});
|
|
31
|
-
it(`matches a dynamic route with a query string and captures the param`, () => {
|
|
32
|
-
const match = matchPath('/leads/:id/details', '/leads/5/details?queue=1');
|
|
33
|
-
expect(match).not.to.equal(null);
|
|
34
|
-
expect(match.params).to.deep.equal({
|
|
35
|
-
id: '5'
|
|
36
|
-
});
|
|
37
|
-
expect(match.query).to.deep.equal({
|
|
38
|
-
queue: '1'
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patternToRegex.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/patternToRegex.sxyt.ts"],"names":[],"mappings":""}
|