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,182 +0,0 @@
|
|
|
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 { expect } from 'chai';
|
|
5
|
-
import { Window } from 'happy-dom';
|
|
6
|
-
import { describe } from 'sxy-test-runner';
|
|
7
|
-
import { TungstenSimpleComponent } from "../Components.js";
|
|
8
|
-
import { createTestApp } from "../testing/index.js";
|
|
9
|
-
import { WideRenderedContentNodeIsComponent } from "../RenderedContentNode.js";
|
|
10
|
-
import { AnyComponentIsFunctionComponentStandIn } from "../AnyComponent.js";
|
|
11
|
-
import { setCurrentInstance } from "./instanceRegistry.js";
|
|
12
|
-
import { applyHmrModule } from "./applyHmrModule.js";
|
|
13
|
-
import { jsxs as _jsxs, jsx as _jsx } from "tungsten/jsxRuntime.js";
|
|
14
|
-
describe('applyHmrModule()', ({
|
|
15
|
-
it
|
|
16
|
-
}) => {
|
|
17
|
-
it('matches and swaps a live component by name+kind', async () => {
|
|
18
|
-
const window = new Window();
|
|
19
|
-
const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
|
|
20
|
-
const Greeting = ({
|
|
21
|
-
name
|
|
22
|
-
}) => {
|
|
23
|
-
return _jsxs("div", {
|
|
24
|
-
className: "greeting",
|
|
25
|
-
children: ["Hello ", name]
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
class Root extends TungstenSimpleComponent {
|
|
29
|
-
constructor(...args) {
|
|
30
|
-
super(...args);
|
|
31
|
-
_defineProperty(this, "content", () => _jsx(Greeting, {
|
|
32
|
-
name: "Ada"
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const testApp = await createTestApp(Root, {
|
|
37
|
-
document
|
|
38
|
-
});
|
|
39
|
-
const wrapper = testApp.component.__currentContent;
|
|
40
|
-
if (!WideRenderedContentNodeIsComponent(wrapper) || !AnyComponentIsFunctionComponentStandIn(wrapper.element)) {
|
|
41
|
-
throw new Error('expected the root to directly render a single function component');
|
|
42
|
-
}
|
|
43
|
-
setCurrentInstance(wrapper.element.__instance);
|
|
44
|
-
const NewGreeting = ({
|
|
45
|
-
name
|
|
46
|
-
}) => {
|
|
47
|
-
return _jsxs("div", {
|
|
48
|
-
className: "greeting",
|
|
49
|
-
children: ["Hi there ", name]
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(NewGreeting, 'name', {
|
|
53
|
-
value: 'Greeting'
|
|
54
|
-
});
|
|
55
|
-
const result = await applyHmrModule({
|
|
56
|
-
Greeting: NewGreeting
|
|
57
|
-
}, '/test/applyHmrModule-match.tsx');
|
|
58
|
-
expect(result.matched).to.equal(true);
|
|
59
|
-
expect(result.orphaned).to.equal(false);
|
|
60
|
-
await testApp.unmount();
|
|
61
|
-
});
|
|
62
|
-
it('reports orphaned when a still-live component export disappears from the same file', async () => {
|
|
63
|
-
const window = new Window();
|
|
64
|
-
const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
|
|
65
|
-
const Greeting = ({
|
|
66
|
-
name
|
|
67
|
-
}) => {
|
|
68
|
-
return _jsxs("div", {
|
|
69
|
-
className: "greeting",
|
|
70
|
-
children: ["Hello ", name]
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
class Root extends TungstenSimpleComponent {
|
|
74
|
-
constructor(...args) {
|
|
75
|
-
super(...args);
|
|
76
|
-
_defineProperty(this, "content", () => _jsx(Greeting, {
|
|
77
|
-
name: "Ada"
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const testApp = await createTestApp(Root, {
|
|
82
|
-
document
|
|
83
|
-
});
|
|
84
|
-
const wrapper = testApp.component.__currentContent;
|
|
85
|
-
if (!WideRenderedContentNodeIsComponent(wrapper) || !AnyComponentIsFunctionComponentStandIn(wrapper.element)) {
|
|
86
|
-
throw new Error('expected the root to directly render a single function component');
|
|
87
|
-
}
|
|
88
|
-
setCurrentInstance(wrapper.element.__instance);
|
|
89
|
-
const file = '/test/applyHmrModule-orphan.tsx';
|
|
90
|
-
// first edit: file still exports Greeting - establishes the "previously exported" baseline
|
|
91
|
-
const NewGreeting = ({
|
|
92
|
-
name
|
|
93
|
-
}) => {
|
|
94
|
-
return _jsxs("div", {
|
|
95
|
-
className: "greeting",
|
|
96
|
-
children: ["Hi there ", name]
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
Object.defineProperty(NewGreeting, 'name', {
|
|
100
|
-
value: 'Greeting'
|
|
101
|
-
});
|
|
102
|
-
const firstResult = await applyHmrModule({
|
|
103
|
-
Greeting: NewGreeting
|
|
104
|
-
}, file);
|
|
105
|
-
expect(firstResult.matched).to.equal(true);
|
|
106
|
-
expect(firstResult.orphaned).to.equal(false);
|
|
107
|
-
// second edit to the SAME file: Greeting has been renamed away - the live Greeting
|
|
108
|
-
// instance (now running NewGreeting's code) is still there, but nothing in the fresh
|
|
109
|
-
// module matches it any more
|
|
110
|
-
const Renamed = ({
|
|
111
|
-
name
|
|
112
|
-
}) => {
|
|
113
|
-
return _jsxs("div", {
|
|
114
|
-
className: "greeting",
|
|
115
|
-
children: ["Renamed ", name]
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
Object.defineProperty(Renamed, 'name', {
|
|
119
|
-
value: 'Renamed'
|
|
120
|
-
});
|
|
121
|
-
const secondResult = await applyHmrModule({
|
|
122
|
-
Renamed
|
|
123
|
-
}, file);
|
|
124
|
-
expect(secondResult.matched).to.equal(false);
|
|
125
|
-
expect(secondResult.orphaned).to.equal(true);
|
|
126
|
-
await testApp.unmount();
|
|
127
|
-
});
|
|
128
|
-
it('hot-swaps a component moved to a different file, since identity matching is name+kind based, not file-scoped', async () => {
|
|
129
|
-
const window = new Window();
|
|
130
|
-
const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
|
|
131
|
-
const Greeting = ({
|
|
132
|
-
name
|
|
133
|
-
}) => {
|
|
134
|
-
return _jsxs("div", {
|
|
135
|
-
className: "greeting",
|
|
136
|
-
children: ["Hello ", name]
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
class Root extends TungstenSimpleComponent {
|
|
140
|
-
constructor(...args) {
|
|
141
|
-
super(...args);
|
|
142
|
-
_defineProperty(this, "content", () => _jsx(Greeting, {
|
|
143
|
-
name: "Ada"
|
|
144
|
-
}));
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
const testApp = await createTestApp(Root, {
|
|
148
|
-
document
|
|
149
|
-
});
|
|
150
|
-
const wrapper = testApp.component.__currentContent;
|
|
151
|
-
if (!WideRenderedContentNodeIsComponent(wrapper) || !AnyComponentIsFunctionComponentStandIn(wrapper.element)) {
|
|
152
|
-
throw new Error('expected the root to directly render a single function component');
|
|
153
|
-
}
|
|
154
|
-
setCurrentInstance(wrapper.element.__instance);
|
|
155
|
-
// simulate a single edit that moves Greeting out of its original file into a brand new
|
|
156
|
-
// one - both calls happen on the FIRST ever edit to each file, so neither has a
|
|
157
|
-
// previously-exported baseline to compare against (previousFileExportIdentities starts
|
|
158
|
-
// empty per file either way)
|
|
159
|
-
const MovedGreeting = ({
|
|
160
|
-
name
|
|
161
|
-
}) => {
|
|
162
|
-
return _jsxs("div", {
|
|
163
|
-
className: "greeting",
|
|
164
|
-
children: ["Moved hello ", name]
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
Object.defineProperty(MovedGreeting, 'name', {
|
|
168
|
-
value: 'Greeting'
|
|
169
|
-
});
|
|
170
|
-
const oldFileResult = await applyHmrModule({}, '/test/applyHmrModule-move-old-file.tsx');
|
|
171
|
-
const newFileResult = await applyHmrModule({
|
|
172
|
-
Greeting: MovedGreeting
|
|
173
|
-
}, '/test/applyHmrModule-move-new-file.tsx');
|
|
174
|
-
// the old file's own result correctly sees nothing to do (it's genuinely empty now) and
|
|
175
|
-
// isn't where the swap happens - the new file's result is what should show the match,
|
|
176
|
-
// since applyHmrModule matches by identity across the whole live registry, not per file
|
|
177
|
-
expect(oldFileResult.matched).to.equal(false);
|
|
178
|
-
expect(newFileResult.matched).to.equal(true);
|
|
179
|
-
expect(newFileResult.orphaned).to.equal(false);
|
|
180
|
-
await testApp.unmount();
|
|
181
|
-
});
|
|
182
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instanceRegistry.sxyt.d.ts","sourceRoot":"","sources":["../../src/hmr/instanceRegistry.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { describe } from 'sxy-test-runner';
|
|
3
|
-
describe('instanceRegistry() - cross module-graph visibility', ({
|
|
4
|
-
it
|
|
5
|
-
}) => {
|
|
6
|
-
it('setCurrentInstance() is visible from a separately-instantiated copy of the module', async () => {
|
|
7
|
-
// In the real dev client, hydrate.tsx (and its call to setCurrentInstance) is baked into
|
|
8
|
-
// the rolled-up, single-file client.js bundle, while applyHmrModule.js (and whatever it
|
|
9
|
-
// imports, including this module) is loaded completely separately - as a plain, unbundled
|
|
10
|
-
// ES module fetched fresh from the package-copy location. Those are two distinct module
|
|
11
|
-
// instantiations of this same source file, each with their own copy of any module-scope
|
|
12
|
-
// state. A cache-busting query string reproduces exactly that split here: Node's ESM
|
|
13
|
-
// loader treats these two specifiers as separate module records, the same way the browser
|
|
14
|
-
// treats the bundle and the package-copy as unrelated.
|
|
15
|
-
const moduleA = await import("./instanceRegistry.js");
|
|
16
|
-
const copySpecifier = './instanceRegistry.js' + '?copy=1';
|
|
17
|
-
const moduleB = await import(copySpecifier);
|
|
18
|
-
const fakeInstance = {
|
|
19
|
-
marker: 'fake-instance-for-test'
|
|
20
|
-
}; // eslint-disable-line no-type-assertion/no-type-assertion, @typescript-eslint/no-explicit-any -- only the identity of this object matters for the test
|
|
21
|
-
moduleA.setCurrentInstance(fakeInstance);
|
|
22
|
-
expect(moduleB.getCurrentInstance()).to.equal(fakeInstance);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"refreshStylesheets.sxyt.d.ts","sourceRoot":"","sources":["../../src/hmr/refreshStylesheets.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { Window } from 'happy-dom';
|
|
3
|
-
import { describe } from 'sxy-test-runner';
|
|
4
|
-
import { refreshStylesheets } from "./refreshStylesheets.js";
|
|
5
|
-
describe('refreshStylesheets()', ({
|
|
6
|
-
it
|
|
7
|
-
}) => {
|
|
8
|
-
it('adds the new stylesheet link and waits for it to load before removing the old one', async () => {
|
|
9
|
-
const window = new Window();
|
|
10
|
-
const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
|
|
11
|
-
const oldLink = document.createElement('link');
|
|
12
|
-
oldLink.rel = 'stylesheet';
|
|
13
|
-
oldLink.href = '/.componentCss/ccss.css';
|
|
14
|
-
document.head.appendChild(oldLink);
|
|
15
|
-
const donePromises = refreshStylesheets(document);
|
|
16
|
-
expect(donePromises).to.have.length(1);
|
|
17
|
-
// give the (synchronous, in this test) DOM mutation a tick to land
|
|
18
|
-
await Promise.resolve();
|
|
19
|
-
const links = document.querySelectorAll('link[rel="stylesheet"]');
|
|
20
|
-
expect(links.length).to.equal(2);
|
|
21
|
-
expect(document.contains(oldLink)).to.equal(true);
|
|
22
|
-
const newLink = [...links].find(link => link !== oldLink); // eslint-disable-line no-type-assertion/no-type-assertion -- narrowed by the length check above
|
|
23
|
-
expect(newLink).to.not.equal(undefined);
|
|
24
|
-
expect(newLink.getAttribute('href')).to.match(/^\/\.componentCss\/ccss\.css\?t=\d+$/);
|
|
25
|
-
// simulate the browser finishing the fetch+parse of the new stylesheet
|
|
26
|
-
newLink.dispatchEvent(new window.Event('load')); // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Event is structurally compatible
|
|
27
|
-
await donePromises[0];
|
|
28
|
-
expect(document.contains(oldLink)).to.equal(false);
|
|
29
|
-
expect(document.querySelectorAll('link[rel="stylesheet"]').length).to.equal(1);
|
|
30
|
-
});
|
|
31
|
-
it('removes the old link even if the new stylesheet fails to load, rather than leaving both forever', async () => {
|
|
32
|
-
const window = new Window();
|
|
33
|
-
const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
|
|
34
|
-
const oldLink = document.createElement('link');
|
|
35
|
-
oldLink.rel = 'stylesheet';
|
|
36
|
-
oldLink.href = '/.componentCss/ccss.css';
|
|
37
|
-
document.head.appendChild(oldLink);
|
|
38
|
-
const [done] = refreshStylesheets(document);
|
|
39
|
-
await Promise.resolve();
|
|
40
|
-
const newLink = [...document.querySelectorAll('link[rel="stylesheet"]')].find(link => link !== oldLink); // eslint-disable-line no-type-assertion/no-type-assertion -- there are exactly two links at this point, one of them is oldLink
|
|
41
|
-
expect(newLink).to.not.equal(undefined);
|
|
42
|
-
newLink.dispatchEvent(new window.Event('error')); // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Event is structurally compatible
|
|
43
|
-
await done;
|
|
44
|
-
expect(document.contains(oldLink)).to.equal(false);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hydrate.sxyt.d.ts","sourceRoot":"","sources":["../../src/hydrate/hydrate.sxyt.tsx"],"names":[],"mappings":""}
|
|
@@ -1,302 +0,0 @@
|
|
|
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 { expect } from 'chai';
|
|
5
|
-
import { Window } from 'happy-dom';
|
|
6
|
-
import { describe } from 'sxy-test-runner';
|
|
7
|
-
import { TungstenSimpleComponent } from "../Components.js";
|
|
8
|
-
import { Instance } from "../Instance/Instance.js";
|
|
9
|
-
import { initStores } from "../Servers/initStores.js";
|
|
10
|
-
import { UpdateScheduler } from "../update/UpdateScheduler.js";
|
|
11
|
-
import { contentTreeToRenderingTree } from "../render/contentTreeToRenderingTree.js";
|
|
12
|
-
import { renderingNodeToHtml } from "../render/renderingTreeToHtml.js";
|
|
13
|
-
import { DomPointer } from "../DomPointer.js";
|
|
14
|
-
import { hydrateRootComponent } from "./hydrate.js";
|
|
15
|
-
import { WideRenderedContentNodeIsComponent } from "../RenderedContentNode.js";
|
|
16
|
-
import { AnyComponentIsFunctionComponentStandIn } from "../AnyComponent.js";
|
|
17
|
-
import { hotSwapFunctionComponent } from "../update/integrateUpdateVdom.js";
|
|
18
|
-
import { setCurrentInstance } from "../hmr/instanceRegistry.js";
|
|
19
|
-
import { applyHmrModule } from "../hmr/applyHmrModule.js";
|
|
20
|
-
import { jsxs as _jsxs, jsx as _jsx } from "tungsten/jsxRuntime.js";
|
|
21
|
-
const Greeting = ({
|
|
22
|
-
name
|
|
23
|
-
}) => {
|
|
24
|
-
return _jsxs("button", {
|
|
25
|
-
children: ["Hello ", name]
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
Greeting.style = {
|
|
29
|
-
moduleName: 'Greeting',
|
|
30
|
-
tags: {
|
|
31
|
-
button: 'greeting-button'
|
|
32
|
-
},
|
|
33
|
-
classes: {}
|
|
34
|
-
};
|
|
35
|
-
class Root extends TungstenSimpleComponent {
|
|
36
|
-
constructor(...args) {
|
|
37
|
-
super(...args);
|
|
38
|
-
_defineProperty(this, "content", () => _jsx(Greeting, {
|
|
39
|
-
name: "Ada"
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function makeInstance(document, runtimeContext) {
|
|
44
|
-
const location = '/';
|
|
45
|
-
const globalData = {};
|
|
46
|
-
const matchedRouteInfo = {
|
|
47
|
-
key: null,
|
|
48
|
-
params: {},
|
|
49
|
-
content: null
|
|
50
|
-
};
|
|
51
|
-
const {
|
|
52
|
-
internalStore,
|
|
53
|
-
stores,
|
|
54
|
-
storeSubscriptions
|
|
55
|
-
} = initStores(location, null, globalData, matchedRouteInfo);
|
|
56
|
-
const instanceConfig = {
|
|
57
|
-
prod: false,
|
|
58
|
-
useRootComponent: true,
|
|
59
|
-
clientSideNav: false,
|
|
60
|
-
siteBasePath: '/',
|
|
61
|
-
staticSite: false
|
|
62
|
-
};
|
|
63
|
-
const emptyRoutes = {}; // eslint-disable-line no-type-assertion/no-type-assertion -- not exercised by this test
|
|
64
|
-
return new Instance(location, instanceConfig, null, emptyRoutes, emptyRoutes,
|
|
65
|
-
// eslint-disable-line no-type-assertion/no-type-assertion
|
|
66
|
-
internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo, runtimeContext);
|
|
67
|
-
}
|
|
68
|
-
describe('hydrateRootComponent() - function component styling', ({
|
|
69
|
-
it
|
|
70
|
-
}) => {
|
|
71
|
-
it('keeps the server-rendered class attribute on a styled function component after hydration', async () => {
|
|
72
|
-
const window = new Window();
|
|
73
|
-
const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
|
|
74
|
-
const bridgedGlobals = globalThis; // eslint-disable-line no-type-assertion/no-type-assertion -- bridging happy-dom's globals onto the global scope
|
|
75
|
-
bridgedGlobals.Node = window.Node;
|
|
76
|
-
bridgedGlobals.Text = window.Text;
|
|
77
|
-
bridgedGlobals.Comment = window.Comment;
|
|
78
|
-
bridgedGlobals.Element = window.Element;
|
|
79
|
-
bridgedGlobals.HTMLElement = window.HTMLElement;
|
|
80
|
-
bridgedGlobals.Document = window.Document;
|
|
81
|
-
bridgedGlobals.document = document;
|
|
82
|
-
bridgedGlobals.window = window;
|
|
83
|
-
// navigation: false on both instances - this test never touches routing, and it sidesteps
|
|
84
|
-
// Instance's popstate listener setup, which reaches for the process-wide `window` global
|
|
85
|
-
// when no runtimeContext is given (isClient.ts caches typeof window at first import, and
|
|
86
|
-
// other test files in this same process import happy-dom, so relying on "no runtimeContext
|
|
87
|
-
// means server" here is not reliable the way it is in the real server/client bundle split)
|
|
88
|
-
const ssrScheduler = new UpdateScheduler();
|
|
89
|
-
const ssrInstance = makeInstance(document, {
|
|
90
|
-
document,
|
|
91
|
-
window: document.defaultView,
|
|
92
|
-
scheduler: ssrScheduler,
|
|
93
|
-
navigation: false
|
|
94
|
-
});
|
|
95
|
-
const tree = await contentTreeToRenderingTree(_jsx(Root, {}), null, ssrInstance, false);
|
|
96
|
-
const headData = {
|
|
97
|
-
found: false,
|
|
98
|
-
instance: ssrInstance,
|
|
99
|
-
clientImportAliases: {},
|
|
100
|
-
importAliases: {},
|
|
101
|
-
compilationLocation: '',
|
|
102
|
-
dev: false,
|
|
103
|
-
tungstenPublicEnv: undefined,
|
|
104
|
-
siteBasePath: '',
|
|
105
|
-
hmr: true
|
|
106
|
-
};
|
|
107
|
-
const html = await renderingNodeToHtml(tree, false, headData, null);
|
|
108
|
-
// styleContentSxy prefixes every tag match with componentBumpClass ('__c__')
|
|
109
|
-
expect(html).to.contain('class="__c__ greeting-button"');
|
|
110
|
-
document.body.innerHTML = html;
|
|
111
|
-
// hydrate exactly the way the client does
|
|
112
|
-
const scheduler = new UpdateScheduler();
|
|
113
|
-
const runtimeContext = {
|
|
114
|
-
document,
|
|
115
|
-
window: document.defaultView,
|
|
116
|
-
scheduler,
|
|
117
|
-
navigation: false
|
|
118
|
-
};
|
|
119
|
-
const hydrateInstance = makeInstance(document, runtimeContext);
|
|
120
|
-
const domPointer = new DomPointer(document.body, 0);
|
|
121
|
-
await hydrateRootComponent(hydrateInstance, Root, domPointer, {
|
|
122
|
-
insideForm: false
|
|
123
|
-
});
|
|
124
|
-
const button = document.body.querySelector('button');
|
|
125
|
-
expect(button?.getAttribute('class')).to.equal('__c__ greeting-button');
|
|
126
|
-
scheduler.dispose();
|
|
127
|
-
ssrScheduler.dispose();
|
|
128
|
-
});
|
|
129
|
-
it('sets __renderedNode during hydration, so a hot-swap can find and replace it', async () => {
|
|
130
|
-
// hydrateFunctionComponent builds its own wrapper independently of the reconciler's
|
|
131
|
-
// equivalent functions in integrateUpdateVdom.ts - those set element.__renderedNode, but
|
|
132
|
-
// hydration never did, so hotSwapPrepare() (which requires it) silently bailed out on
|
|
133
|
-
// every hydrated component in the real client, and applyHmrModule() counted the swap as
|
|
134
|
-
// successful anyway because it didn't check the swap functions' return value. Both are
|
|
135
|
-
// fixed; this reproduces the full round trip end to end.
|
|
136
|
-
const window = new Window();
|
|
137
|
-
const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
|
|
138
|
-
const bridgedGlobals = globalThis; // eslint-disable-line no-type-assertion/no-type-assertion -- bridging happy-dom's globals onto the global scope
|
|
139
|
-
bridgedGlobals.Node = window.Node;
|
|
140
|
-
bridgedGlobals.Text = window.Text;
|
|
141
|
-
bridgedGlobals.Comment = window.Comment;
|
|
142
|
-
bridgedGlobals.Element = window.Element;
|
|
143
|
-
bridgedGlobals.HTMLElement = window.HTMLElement;
|
|
144
|
-
bridgedGlobals.Document = window.Document;
|
|
145
|
-
bridgedGlobals.document = document;
|
|
146
|
-
bridgedGlobals.window = window;
|
|
147
|
-
const ssrScheduler = new UpdateScheduler();
|
|
148
|
-
const ssrInstance = makeInstance(document, {
|
|
149
|
-
document,
|
|
150
|
-
window: document.defaultView,
|
|
151
|
-
scheduler: ssrScheduler,
|
|
152
|
-
navigation: false
|
|
153
|
-
});
|
|
154
|
-
const tree = await contentTreeToRenderingTree(_jsx(Root, {}), null, ssrInstance, false);
|
|
155
|
-
const headData = {
|
|
156
|
-
found: false,
|
|
157
|
-
instance: ssrInstance,
|
|
158
|
-
clientImportAliases: {},
|
|
159
|
-
importAliases: {},
|
|
160
|
-
compilationLocation: '',
|
|
161
|
-
dev: false,
|
|
162
|
-
tungstenPublicEnv: undefined,
|
|
163
|
-
siteBasePath: '',
|
|
164
|
-
hmr: true
|
|
165
|
-
};
|
|
166
|
-
const html = await renderingNodeToHtml(tree, false, headData, null);
|
|
167
|
-
document.body.innerHTML = html;
|
|
168
|
-
const scheduler = new UpdateScheduler();
|
|
169
|
-
const runtimeContext = {
|
|
170
|
-
document,
|
|
171
|
-
window: document.defaultView,
|
|
172
|
-
scheduler,
|
|
173
|
-
navigation: false
|
|
174
|
-
};
|
|
175
|
-
const hydrateInstance = makeInstance(document, runtimeContext);
|
|
176
|
-
const domPointer = new DomPointer(document.body, 0);
|
|
177
|
-
const rootElement = await hydrateRootComponent(hydrateInstance, Root, domPointer, {
|
|
178
|
-
insideForm: false
|
|
179
|
-
});
|
|
180
|
-
const wrapper = rootElement.__currentContent;
|
|
181
|
-
if (!WideRenderedContentNodeIsComponent(wrapper) || !AnyComponentIsFunctionComponentStandIn(wrapper.element)) {
|
|
182
|
-
throw new Error('expected the hydrated root to directly wrap a single function component');
|
|
183
|
-
}
|
|
184
|
-
const hydratedElement = wrapper.element;
|
|
185
|
-
expect(hydratedElement.__renderedNode).to.not.equal(undefined);
|
|
186
|
-
const NewGreeting = ({
|
|
187
|
-
name
|
|
188
|
-
}) => {
|
|
189
|
-
return _jsxs("button", {
|
|
190
|
-
children: ["Hi there ", name]
|
|
191
|
-
});
|
|
192
|
-
};
|
|
193
|
-
NewGreeting.style = {
|
|
194
|
-
moduleName: 'Greeting',
|
|
195
|
-
tags: {
|
|
196
|
-
button: 'greeting-button'
|
|
197
|
-
},
|
|
198
|
-
classes: {}
|
|
199
|
-
};
|
|
200
|
-
const swapped = await hotSwapFunctionComponent(hydratedElement, NewGreeting);
|
|
201
|
-
expect(swapped).to.not.equal(null);
|
|
202
|
-
expect(document.body.innerHTML).to.contain('Hi there Ada');
|
|
203
|
-
expect(document.body.innerHTML).to.not.contain('Hello Ada');
|
|
204
|
-
scheduler.dispose();
|
|
205
|
-
ssrScheduler.dispose();
|
|
206
|
-
});
|
|
207
|
-
it('end-to-end: SSR -> hydrate -> a real dev-mode edit applies without a full reload', async () => {
|
|
208
|
-
// This is the high-level test for the actual, user-visible bug ("editing a component
|
|
209
|
-
// always triggers a full page reload instead of an in-place swap"). It goes through the
|
|
210
|
-
// real hydrate() -> applyHmrModule() pipeline exactly as the dev-mode reload script does
|
|
211
|
-
// (setCurrentInstance() + applyHmrModule(), not a lower-level helper like
|
|
212
|
-
// hotSwapFunctionComponent() called directly), so it catches applyHmrModule()
|
|
213
|
-
// miscounting a failed swap as successful and hydration never setting __renderedNode in
|
|
214
|
-
// one broad assertion (DOM shows the edited content) rather than two narrow ones.
|
|
215
|
-
//
|
|
216
|
-
// It does NOT cover the third cause (the registration gate checking
|
|
217
|
-
// runtimeContext !== undefined instead of isClient) - this test, like the others in this
|
|
218
|
-
// file, deliberately passes a real runtimeContext to sidestep isClient.ts's module-load-
|
|
219
|
-
// order flakiness in a shared test process, so runtimeContext is always defined here
|
|
220
|
-
// regardless of which gate the source uses. FunctionComponentStandIn.sxyt.ts covers that
|
|
221
|
-
// cause specifically, by forcing isClient directly instead of relying on either detection
|
|
222
|
-
// path.
|
|
223
|
-
const window = new Window();
|
|
224
|
-
const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
|
|
225
|
-
const bridgedGlobals = globalThis; // eslint-disable-line no-type-assertion/no-type-assertion -- bridging happy-dom's globals onto the global scope
|
|
226
|
-
bridgedGlobals.Node = window.Node;
|
|
227
|
-
bridgedGlobals.Text = window.Text;
|
|
228
|
-
bridgedGlobals.Comment = window.Comment;
|
|
229
|
-
bridgedGlobals.Element = window.Element;
|
|
230
|
-
bridgedGlobals.HTMLElement = window.HTMLElement;
|
|
231
|
-
bridgedGlobals.Document = window.Document;
|
|
232
|
-
bridgedGlobals.document = document;
|
|
233
|
-
bridgedGlobals.window = window;
|
|
234
|
-
const ssrScheduler = new UpdateScheduler();
|
|
235
|
-
const ssrInstance = makeInstance(document, {
|
|
236
|
-
document,
|
|
237
|
-
window: document.defaultView,
|
|
238
|
-
scheduler: ssrScheduler,
|
|
239
|
-
navigation: false
|
|
240
|
-
});
|
|
241
|
-
const tree = await contentTreeToRenderingTree(_jsx(Root, {}), null, ssrInstance, false);
|
|
242
|
-
const headData = {
|
|
243
|
-
found: false,
|
|
244
|
-
instance: ssrInstance,
|
|
245
|
-
clientImportAliases: {},
|
|
246
|
-
importAliases: {},
|
|
247
|
-
compilationLocation: '',
|
|
248
|
-
dev: false,
|
|
249
|
-
tungstenPublicEnv: undefined,
|
|
250
|
-
siteBasePath: '',
|
|
251
|
-
hmr: true
|
|
252
|
-
};
|
|
253
|
-
const html = await renderingNodeToHtml(tree, false, headData, null);
|
|
254
|
-
document.body.innerHTML = html;
|
|
255
|
-
const scheduler = new UpdateScheduler();
|
|
256
|
-
const runtimeContext = {
|
|
257
|
-
document,
|
|
258
|
-
window: document.defaultView,
|
|
259
|
-
scheduler,
|
|
260
|
-
navigation: false
|
|
261
|
-
};
|
|
262
|
-
const hydrateInstance = makeInstance(document, runtimeContext);
|
|
263
|
-
// exactly what hydrate.tsx's real hydrate() does right after constructing its Instance
|
|
264
|
-
setCurrentInstance(hydrateInstance);
|
|
265
|
-
const domPointer = new DomPointer(document.body, 0);
|
|
266
|
-
await hydrateRootComponent(hydrateInstance, Root, domPointer, {
|
|
267
|
-
insideForm: false
|
|
268
|
-
});
|
|
269
|
-
// stands in for "the file was edited and the browser re-imported it fresh" - a
|
|
270
|
-
// same-named export with different markup, exactly like applyHmrModule() receives from
|
|
271
|
-
// the dev-mode reload script
|
|
272
|
-
const EditedGreeting = ({
|
|
273
|
-
name
|
|
274
|
-
}) => {
|
|
275
|
-
return _jsxs("button", {
|
|
276
|
-
children: ["Edited ", name]
|
|
277
|
-
});
|
|
278
|
-
};
|
|
279
|
-
// identity matching is by name, and a const's inferred .name is its own variable name
|
|
280
|
-
// ("EditedGreeting") - force it to match the export name the real dev-mode reload script
|
|
281
|
-
// would see when re-importing the edited file (the export is still called "Greeting")
|
|
282
|
-
Object.defineProperty(EditedGreeting, 'name', {
|
|
283
|
-
value: 'Greeting'
|
|
284
|
-
});
|
|
285
|
-
EditedGreeting.style = {
|
|
286
|
-
moduleName: 'Greeting',
|
|
287
|
-
tags: {
|
|
288
|
-
button: 'greeting-button'
|
|
289
|
-
},
|
|
290
|
-
classes: {}
|
|
291
|
-
};
|
|
292
|
-
const result = await applyHmrModule({
|
|
293
|
-
Greeting: EditedGreeting
|
|
294
|
-
}, '/test/end-to-end-Greeting.tsx');
|
|
295
|
-
expect(result.matched).to.equal(true);
|
|
296
|
-
expect(result.orphaned).to.equal(false);
|
|
297
|
-
expect(document.body.innerHTML).to.contain('Edited Ada');
|
|
298
|
-
expect(document.body.innerHTML).to.not.contain('Hello Ada');
|
|
299
|
-
scheduler.dispose();
|
|
300
|
-
ssrScheduler.dispose();
|
|
301
|
-
});
|
|
302
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reconcileHydratedAttributes.sxyt.d.ts","sourceRoot":"","sources":["../../src/hydrate/reconcileHydratedAttributes.sxyt.ts"],"names":[],"mappings":""}
|