tungsten 0.3.1 → 0.3.3
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 +2 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +10 -1
- package/dist/DomRegion.js +1 -1
- package/dist/Framework.d.ts +2 -0
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js +68 -57
- package/dist/FrameworkConfig.d.ts +6 -0
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/FunctionComponentStandIn.d.ts +2 -0
- package/dist/FunctionComponentStandIn.d.ts.map +1 -1
- package/dist/FunctionComponentStandIn.js +10 -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 +4 -0
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +116 -13
- package/dist/Servers/MatchedRouteInfo.d.ts +1 -1
- package/dist/Servers/MatchedRouteInfo.d.ts.map +1 -1
- package/dist/Servers/ProdServer.d.ts +1 -0
- package/dist/Servers/ProdServer.d.ts.map +1 -1
- package/dist/Servers/ProdServer.js +79 -5
- package/dist/Servers/devErrorPageAutoRetry.d.ts +4 -0
- package/dist/Servers/devErrorPageAutoRetry.d.ts.map +1 -0
- package/dist/Servers/devErrorPageAutoRetry.js +26 -0
- 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/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/api/getExport.d.ts.map +1 -1
- package/dist/api/getExport.js +2 -1
- package/dist/babelPlugins/BabelAddDevCacheBust.d.ts +11 -0
- package/dist/babelPlugins/BabelAddDevCacheBust.d.ts.map +1 -0
- package/dist/babelPlugins/BabelAddDevCacheBust.js +68 -0
- 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 +3 -0
- package/dist/bin/commands/dev.d.ts.map +1 -1
- package/dist/bin/commands/dev.js +16 -3
- 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/compileJavascript.js +1 -1
- package/dist/build/compileUserApp.d.ts +2 -1
- package/dist/build/compileUserApp.d.ts.map +1 -1
- package/dist/build/compileUserApp.js +10 -9
- package/dist/build/createInstanceConfigFile.js +1 -1
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserDevConfig.js +6 -1
- package/dist/compat/types.d.ts +1 -1
- package/dist/compat/types.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/defaultConfig.d.ts +3 -0
- package/dist/defaultConfig.d.ts.map +1 -1
- package/dist/defaultConfig.js +4 -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/getEnvSchemas.js +2 -1
- package/dist/env/publicEnv.d.ts.map +1 -1
- package/dist/env/publicEnv.js +4 -1
- package/dist/frameworkConfigSchema.d.ts +4 -0
- package/dist/frameworkConfigSchema.d.ts.map +1 -1
- package/dist/frameworkConfigSchema.js +2 -1
- package/dist/getComponent.d.ts.map +1 -1
- package/dist/getComponent.js +2 -1
- package/dist/getRoutes.d.ts.map +1 -1
- package/dist/getRoutes.js +2 -1
- package/dist/hmr/applyHmrModule.d.ts +11 -0
- package/dist/hmr/applyHmrModule.d.ts.map +1 -0
- package/dist/hmr/applyHmrModule.js +78 -0
- package/dist/hmr/componentIdentity.d.ts +9 -0
- package/dist/hmr/componentIdentity.d.ts.map +1 -0
- package/dist/hmr/componentIdentity.js +17 -0
- package/dist/hmr/instanceRegistry.d.ts +4 -0
- package/dist/hmr/instanceRegistry.d.ts.map +1 -0
- package/dist/hmr/instanceRegistry.js +6 -0
- package/dist/hmr/liveReloadHub.d.ts +10 -0
- package/dist/hmr/liveReloadHub.d.ts.map +1 -0
- package/dist/{dev → hmr}/liveReloadHub.js +8 -2
- package/dist/hmr/refreshStylesheets.d.ts +2 -0
- package/dist/hmr/refreshStylesheets.d.ts.map +1 -0
- package/dist/hmr/refreshStylesheets.js +26 -0
- 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 +10 -0
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +81 -19
- package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
- package/dist/hydrate/reconcileHydratedAttributes.js +14 -5
- 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/importDevModuleWithRetry.d.ts +3 -0
- package/dist/importDevModuleWithRetry.d.ts.map +1 -0
- package/dist/importDevModuleWithRetry.js +46 -0
- package/dist/indexInner.d.ts +8 -0
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +7 -1
- 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/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/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +53 -6
- 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/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/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 +16 -1
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +116 -7
- package/dist/warnOnFrameworkChange.d.ts +2 -0
- package/dist/warnOnFrameworkChange.d.ts.map +1 -0
- package/dist/warnOnFrameworkChange.js +27 -0
- package/package.json +18 -16
- 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/_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/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/dev/liveReloadHub.d.ts +0 -6
- package/dist/dev/liveReloadHub.d.ts.map +0 -1
- 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.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/hydrate/reconcileHydratedAttributes.sxyt.d.ts +0 -2
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts.map +0 -1
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.js +0 -173
- 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/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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Same shape as sxy-test-runner's createTimeProfiler (node_modules/sxy-test-runner/dist/packages/timeProfiler.js) -
|
|
2
|
+
// a disabled profiler just runs the task, so callers never need to branch on whether profiling
|
|
3
|
+
// is on. Framework.ts holds one instance per run (default disabled); tungsten dev/build enable
|
|
4
|
+
// it via --profile and wrap their own top-level phases with it too.
|
|
5
|
+
import chalk from 'chalk-extensions';
|
|
6
|
+
import { cliOut } from "./cliOutput.js";
|
|
7
|
+
function report(name, ms) {
|
|
8
|
+
cliOut(chalk.yellow`${name}` + ' - ' + chalk.orange`${ms.toLocaleString()}ms`);
|
|
9
|
+
}
|
|
10
|
+
export function createTimeProfiler(profiling = true) {
|
|
11
|
+
if (!profiling) {
|
|
12
|
+
return {
|
|
13
|
+
timeProfile: (_name, task) => task(),
|
|
14
|
+
timeProfileAsync: async (_name, task) => task()
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
timeProfile(name, task) {
|
|
19
|
+
const start = Date.now();
|
|
20
|
+
const result = task();
|
|
21
|
+
report(name, Date.now() - start);
|
|
22
|
+
return result;
|
|
23
|
+
},
|
|
24
|
+
async timeProfileAsync(name, task) {
|
|
25
|
+
const start = Date.now();
|
|
26
|
+
const result = await task();
|
|
27
|
+
report(name, Date.now() - start);
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -1,17 +1,30 @@
|
|
|
1
|
+
import { DomRegion } from '../DomRegion.js';
|
|
1
2
|
import { DomPointer } from '../DomPointer.js';
|
|
2
3
|
import { ContentNode, ContentNodeHtml, ContentNodeComponentAny } from '../ContentNode.js';
|
|
3
4
|
import { Instance } from '../Instance/Instance.js';
|
|
5
|
+
import { FunctionElement } from '../FunctionComponentStandIn.js';
|
|
4
6
|
import { TungstenElement } from '../TungstenElement.js';
|
|
5
7
|
import { AnyComponent } from '../AnyComponent.js';
|
|
6
8
|
import { $ContentNull } from '../symbols.js';
|
|
7
9
|
import { RenderedContentNode, RenderedContentNodeComponent } from '../RenderedContentNode.js';
|
|
8
10
|
import { UpdateResult } from './UpdateResult.js';
|
|
9
|
-
import type { TungstenBaseComponentType } from '../Components.jsx';
|
|
11
|
+
import type { TungstenBaseComponent, TungstenBaseComponentType } from '../Components.jsx';
|
|
12
|
+
import type { FunctionComponent } from '../FunctionComponent.js';
|
|
10
13
|
export type TungstenHTMLElement = HTMLElement & {
|
|
11
14
|
__tungsten_click_handler: (this: HTMLElement, ev: MouseEvent) => any;
|
|
12
15
|
[key: string]: unknown;
|
|
13
16
|
};
|
|
14
17
|
export declare function integrateElementUpdateVdom(element: AnyComponent, newContent: ContentNode): Promise<UpdateResult>;
|
|
18
|
+
export type ApplyUpdateArgs = {
|
|
19
|
+
tungstenElement: AnyComponent;
|
|
20
|
+
instance: Instance;
|
|
21
|
+
newNode: ContentNode;
|
|
22
|
+
oldNode: RenderedContentNode | $ContentNull;
|
|
23
|
+
domRegion: DomRegion | null;
|
|
24
|
+
domPointer: DomPointer;
|
|
25
|
+
parentNode: ContentNode;
|
|
26
|
+
};
|
|
27
|
+
export declare function applyUpdate({ tungstenElement, instance, newNode, oldNode, domRegion, domPointer, parentNode }: ApplyUpdateArgs): Promise<RenderedContentNode>;
|
|
15
28
|
export declare function deleteNodeIfRendered(node: $ContentNull | RenderedContentNode): void;
|
|
16
29
|
export declare function processHtmlNode(node: ContentNodeHtml, parentNode: ContentNode): void;
|
|
17
30
|
type CreateTungstenComponentArgs = {
|
|
@@ -28,5 +41,7 @@ export type MountedTungstenRoot<ComponentType extends TungstenBaseComponentType<
|
|
|
28
41
|
};
|
|
29
42
|
export declare function createTungstenRootComponent<ComponentType extends TungstenBaseComponentType<any, any>>(RootComponent: ComponentType, props: InstanceType<ComponentType>['props'], routeParams: Record<string, string> | undefined, routeData: unknown, instance: Instance, container: HTMLElement): Promise<MountedTungstenRoot<ComponentType>>;
|
|
30
43
|
export declare function deleteTungstenRoot(root: MountedTungstenRoot<TungstenBaseComponentType<any, any>>): void;
|
|
44
|
+
export declare function hotSwapFunctionComponent(oldElement: FunctionElement<any, any>, NewType: FunctionComponent<any, any>): Promise<FunctionElement<any, any> | null>;
|
|
45
|
+
export declare function hotSwapClassComponent(oldElement: TungstenBaseComponent<any, any>, NewType: TungstenBaseComponentType<any, any>): Promise<TungstenBaseComponent<any, any> | null>;
|
|
31
46
|
export {};
|
|
32
47
|
//# sourceMappingURL=integrateUpdateVdom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrateUpdateVdom.d.ts","sourceRoot":"","sources":["../../src/update/integrateUpdateVdom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"integrateUpdateVdom.d.ts","sourceRoot":"","sources":["../../src/update/integrateUpdateVdom.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EACH,WAAW,EAAwC,eAAe,EAElE,uBAAuB,EAG1B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAIlD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGjD,OAAO,EAAE,YAAY,EAAgB,MAAM,eAAe,CAAA;AAE1D,OAAO,EACe,mBAAmB,EAIT,4BAA4B,EAI3D,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAYhD,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AACzF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAKhE,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC5C,wBAAwB,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,UAAU,KAAK,GAAG,CAAA;IACpE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACzB,CAAA;AAYD,wBAAsB,0BAA0B,CAC5C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,GAC/C,OAAO,CAAC,YAAY,CAAC,CA0GvB;AAiCD,MAAM,MAAM,eAAe,GAAG;IAC1B,eAAe,EAAE,YAAY,CAAC;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAAA;IAC3C,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,WAAW,CAAA;CAC1B,CAAA;AAGD,wBAAsB,WAAW,CAC7B,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,eAAe,GACnG,OAAO,CAAC,mBAAmB,CAAC,CAiV/B;AAiJD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG,mBAAmB,QAuC5E;AAgED,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,QAkK7E;AA6WD,KAAK,2BAA2B,GAAG;IAC/B,MAAM,EAAE,eAAe,CAAA;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,uBAAuB,CAAC;IAE9B,UAAU,EAAE,UAAU,CAAA;CACzB,CAAA;AACD,wBAAsB,uBAAuB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,2BAA2B,GAC3G,OAAO,CAAC,4BAA4B,CAAC,CAU1C;AAED,MAAM,MAAM,mBAAmB,CAC3B,aAAa,SAAS,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,IACzD;IACA,SAAS,EAAE,YAAY,CAAC,aAAa,CAAC,CAAA;IACtC,cAAc,EAAE,OAAO,CAAA;IACvB,cAAc,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,wBAAsB,2BAA2B,CAC7C,aAAa,SAAS,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,EAEzD,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,EAC3C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC/C,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,WAAW,GACvB,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAgD7C;AAED,wBAAgB,kBAAkB,CAC9B,IAAI,EAAE,mBAAmB,CAAC,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAC/D,IAAI,CAON;AAmOD,wBAAsB,wBAAwB,CAC1C,UAAU,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,GAC5E,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAiC3C;AAED,wBAAsB,qBAAqB,CACvC,UAAU,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,GAC1F,OAAO,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAyCjD"}
|
|
@@ -22,6 +22,8 @@ import { validChildren } from "../validChildren.js";
|
|
|
22
22
|
import { setCurrentComponent } from 'tungsten/hooks/setCurrentComponent.js';
|
|
23
23
|
import { clearCurrentComponent } from 'tungsten/hooks/clearCurrentComponent.js';
|
|
24
24
|
import { isDev } from "../isDev.js";
|
|
25
|
+
import { $original } from "../componentProxyHandlers.js";
|
|
26
|
+
import { booleanAttributeValue } from "../booleanAttributeValue.js";
|
|
25
27
|
function debug(...texts) {
|
|
26
28
|
//console.log(...texts)
|
|
27
29
|
//console.log(getStackTrace().split('\n')[2])
|
|
@@ -117,7 +119,9 @@ function getKeyedOldChildren(array) {
|
|
|
117
119
|
}
|
|
118
120
|
return keyedChildren;
|
|
119
121
|
}
|
|
120
|
-
|
|
122
|
+
// oldNode: $contentNull reconciles as a pure create (falls through to createNode()) - used by
|
|
123
|
+
// hydrate.tsx's CSR branch for <body>.
|
|
124
|
+
export async function applyUpdate({
|
|
121
125
|
tungstenElement,
|
|
122
126
|
instance,
|
|
123
127
|
newNode,
|
|
@@ -848,7 +852,8 @@ function addAttributes(tungstenElement, instance, node, domNode) {
|
|
|
848
852
|
//console.log('add attr', key, attributes[key])
|
|
849
853
|
if (typeof attributes[key] === 'boolean') {
|
|
850
854
|
//console.log('bool attr', attributes[key])
|
|
851
|
-
|
|
855
|
+
const attrValue = booleanAttributeValue(key, attributes[key]);
|
|
856
|
+
if (attrValue !== null) domNode.setAttribute(key, attrValue);
|
|
852
857
|
} else if (attributes[key] !== undefined && attributes[key] !== null) {
|
|
853
858
|
//console.log('string attr', String(attributes[key]))
|
|
854
859
|
domNode.setAttribute(key, String(attributes[key]));
|
|
@@ -912,7 +917,8 @@ function updateAttributes(tungstenElement, instance, node, oldNode, domNodeHTMLE
|
|
|
912
917
|
domNode.value = String(newAttributes[key]);
|
|
913
918
|
} else {
|
|
914
919
|
if (typeof newAttributes[key] === 'boolean') {
|
|
915
|
-
|
|
920
|
+
const attrValue = booleanAttributeValue(key, newAttributes[key]);
|
|
921
|
+
if (attrValue !== null) domNode.setAttribute(key, attrValue);else removeAttribute(domNode, key);
|
|
916
922
|
} else if (newAttributes[key] === undefined || newAttributes[key] === null) {
|
|
917
923
|
removeAttribute(domNode, key);
|
|
918
924
|
} else {
|
|
@@ -1003,6 +1009,7 @@ function processAttributes(node) {
|
|
|
1003
1009
|
} else {
|
|
1004
1010
|
attributes.style = attributes.css;
|
|
1005
1011
|
}
|
|
1012
|
+
delete attributes.css;
|
|
1006
1013
|
}
|
|
1007
1014
|
return attributes;
|
|
1008
1015
|
}
|
|
@@ -1135,12 +1142,14 @@ async function createTungstenClassComponent(parent, instance, node, domPointer)
|
|
|
1135
1142
|
//console.log('created dom region', element.__domRegion)
|
|
1136
1143
|
element.__currentContent = renderedContent;
|
|
1137
1144
|
element.__didMount();
|
|
1138
|
-
|
|
1145
|
+
const wrapper = {
|
|
1139
1146
|
...node,
|
|
1140
1147
|
element,
|
|
1141
1148
|
openingComment,
|
|
1142
1149
|
closingComment
|
|
1143
1150
|
};
|
|
1151
|
+
element.__renderedNode = wrapper;
|
|
1152
|
+
return wrapper;
|
|
1144
1153
|
}
|
|
1145
1154
|
let xx = 0;
|
|
1146
1155
|
async function createTungstenFunctionComponent(parent, instance, node, domPointer) {
|
|
@@ -1186,12 +1195,14 @@ async function createTungstenFunctionComponent(parent, instance, node, domPointe
|
|
|
1186
1195
|
//console.log('&& dom region first element', element.__domRegion.firstElement)
|
|
1187
1196
|
//console.log('&& dom region last element', element.__domRegion.lastElement)
|
|
1188
1197
|
element.__currentContent = renderedContent;
|
|
1189
|
-
|
|
1198
|
+
const wrapper = {
|
|
1190
1199
|
...node,
|
|
1191
1200
|
element,
|
|
1192
1201
|
openingComment,
|
|
1193
1202
|
closingComment
|
|
1194
1203
|
};
|
|
1204
|
+
element.__renderedNode = wrapper;
|
|
1205
|
+
return wrapper;
|
|
1195
1206
|
}
|
|
1196
1207
|
async function updateClassComponent({
|
|
1197
1208
|
newNode,
|
|
@@ -1209,12 +1220,14 @@ async function updateClassComponent({
|
|
|
1209
1220
|
//throwError('','')
|
|
1210
1221
|
const updateResult = await element.__update();
|
|
1211
1222
|
domPointer.increment(updateResult.nodesLength); // bump the dom pointer index forward by the number of nodes within that element's content
|
|
1212
|
-
|
|
1223
|
+
const wrapper = {
|
|
1213
1224
|
...newNode,
|
|
1214
1225
|
element,
|
|
1215
1226
|
openingComment: oldNode.openingComment,
|
|
1216
1227
|
closingComment: oldNode.closingComment
|
|
1217
1228
|
};
|
|
1229
|
+
element.__renderedNode = wrapper;
|
|
1230
|
+
return wrapper;
|
|
1218
1231
|
}
|
|
1219
1232
|
async function updateFunctionComponent({
|
|
1220
1233
|
newNode,
|
|
@@ -1227,10 +1240,106 @@ async function updateFunctionComponent({
|
|
|
1227
1240
|
standIn.props = newNode[$props];
|
|
1228
1241
|
const updateResult = await standIn.update();
|
|
1229
1242
|
domPointer.increment(updateResult.nodesLength); // bump the dom pointer index forward by the number of nodes within that element's content
|
|
1230
|
-
|
|
1243
|
+
const wrapper = {
|
|
1231
1244
|
...newNode,
|
|
1232
1245
|
element: standIn,
|
|
1233
1246
|
openingComment: oldNode.openingComment,
|
|
1234
1247
|
closingComment: oldNode.closingComment
|
|
1235
1248
|
};
|
|
1249
|
+
standIn.__renderedNode = wrapper;
|
|
1250
|
+
return wrapper;
|
|
1251
|
+
}
|
|
1252
|
+
function hotSwapPrepare(oldElement) {
|
|
1253
|
+
const wrapper = oldElement.__renderedNode;
|
|
1254
|
+
if (wrapper === undefined || oldElement.__domRegion === undefined) return null;
|
|
1255
|
+
const parent = oldElement.__domRegion.parent;
|
|
1256
|
+
const openingCommentIndex = Array.prototype.indexOf.call(parent.childNodes, wrapper.openingComment);
|
|
1257
|
+
if (openingCommentIndex < 0) return null;
|
|
1258
|
+
const domStartIndex = openingCommentIndex + 1;
|
|
1259
|
+
// tear down everything between the comments, keep the comments themselves
|
|
1260
|
+
oldElement.__delete();
|
|
1261
|
+
deleteNodeIfRendered(oldElement.__currentContent);
|
|
1262
|
+
oldElement.__deleted();
|
|
1263
|
+
return {
|
|
1264
|
+
parent,
|
|
1265
|
+
domPointer: new DomPointer(parent, domStartIndex),
|
|
1266
|
+
domStartIndex
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
export async function hotSwapFunctionComponent(oldElement, NewType) {
|
|
1270
|
+
const prep = hotSwapPrepare(oldElement);
|
|
1271
|
+
if (prep === null) return null;
|
|
1272
|
+
const {
|
|
1273
|
+
parent,
|
|
1274
|
+
domPointer,
|
|
1275
|
+
domStartIndex
|
|
1276
|
+
} = prep;
|
|
1277
|
+
const wrapper = oldElement.__renderedNode; // present - checked in hotSwapPrepare
|
|
1278
|
+
if (wrapper === undefined) return null;
|
|
1279
|
+
const standIn = new FunctionElement(NewType, oldElement.props, oldElement.routeParams, oldElement.routeData, oldElement.__instance, oldElement.parentComponent);
|
|
1280
|
+
// carry the old slot-indexed hook state across - see tungsten/docs/hmr.md for the
|
|
1281
|
+
// (unverifiable, accepted) risk this carries when hook shape changed between edits
|
|
1282
|
+
standIn.state = oldElement.state;
|
|
1283
|
+
standIn.effects = oldElement.effects;
|
|
1284
|
+
standIn.memos = oldElement.memos;
|
|
1285
|
+
standIn.callbacks = oldElement.callbacks;
|
|
1286
|
+
setCurrentComponent(standIn);
|
|
1287
|
+
const content = await getStyledContentFromFunctionComponent(standIn);
|
|
1288
|
+
clearCurrentComponent();
|
|
1289
|
+
const renderedContent = await createNode({
|
|
1290
|
+
tungstenElement: standIn,
|
|
1291
|
+
instance: oldElement.__instance,
|
|
1292
|
+
newNode: content,
|
|
1293
|
+
domPointer,
|
|
1294
|
+
parentNode: null
|
|
1295
|
+
});
|
|
1296
|
+
standIn.__domRegion = new DomRegion(parent, domStartIndex, domPointer.index - domStartIndex);
|
|
1297
|
+
standIn.__currentContent = renderedContent;
|
|
1298
|
+
wrapper.element = standIn;
|
|
1299
|
+
wrapper[$props] = standIn.props;
|
|
1300
|
+
standIn.__renderedNode = wrapper;
|
|
1301
|
+
return standIn;
|
|
1302
|
+
}
|
|
1303
|
+
export async function hotSwapClassComponent(oldElement, NewType) {
|
|
1304
|
+
const prep = hotSwapPrepare(oldElement);
|
|
1305
|
+
if (prep === null) return null;
|
|
1306
|
+
const {
|
|
1307
|
+
parent,
|
|
1308
|
+
domPointer,
|
|
1309
|
+
domStartIndex
|
|
1310
|
+
} = prep;
|
|
1311
|
+
const wrapper = oldElement.__renderedNode; // present - checked in hotSwapPrepare
|
|
1312
|
+
if (wrapper === undefined) return null;
|
|
1313
|
+
const newElement = new NewType({
|
|
1314
|
+
props: oldElement.props,
|
|
1315
|
+
routeParams: oldElement.routeParams,
|
|
1316
|
+
routeData: oldElement.routeData,
|
|
1317
|
+
instance: oldElement.__instance,
|
|
1318
|
+
parentElement: oldElement.parentComponent
|
|
1319
|
+
});
|
|
1320
|
+
// carry the old state across, unwrapping the old proxy so the new instance's own
|
|
1321
|
+
// constructor-created proxy (bound to itself) is what ends up owning it
|
|
1322
|
+
if ('state' in oldElement && oldElement.state !== undefined && 'state' in newElement) {
|
|
1323
|
+
const oldState = oldElement.state; // eslint-disable-line no-type-assertion/no-type-assertion -- state shape is unknown to this generic dev-only code path
|
|
1324
|
+
const rawOldState = $original in oldState ? oldState[$original] // eslint-disable-line no-type-assertion/no-type-assertion -- $original always yields the raw backing object
|
|
1325
|
+
: oldState;
|
|
1326
|
+
const newState = newElement.state; // eslint-disable-line no-type-assertion/no-type-assertion -- state shape is unknown to this generic dev-only code path
|
|
1327
|
+
for (const key in rawOldState) newState[key] = rawOldState[key];
|
|
1328
|
+
}
|
|
1329
|
+
await newElement.__init();
|
|
1330
|
+
const content = await newElement.__initialContent();
|
|
1331
|
+
const renderedContent = await createNode({
|
|
1332
|
+
tungstenElement: newElement,
|
|
1333
|
+
instance: oldElement.__instance,
|
|
1334
|
+
newNode: content,
|
|
1335
|
+
domPointer,
|
|
1336
|
+
parentNode: null
|
|
1337
|
+
});
|
|
1338
|
+
newElement.__domRegion = new DomRegion(parent, domStartIndex, domPointer.index - domStartIndex);
|
|
1339
|
+
newElement.__currentContent = renderedContent;
|
|
1340
|
+
newElement.__didMount();
|
|
1341
|
+
wrapper.element = newElement;
|
|
1342
|
+
wrapper[$props] = newElement.props;
|
|
1343
|
+
newElement.__renderedNode = wrapper;
|
|
1344
|
+
return newElement;
|
|
1236
1345
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnOnFrameworkChange.d.ts","sourceRoot":"","sources":["../src/warnOnFrameworkChange.ts"],"names":[],"mappings":"AAcA,wBAAgB,qBAAqB,IAAI,IAAI,CAc5C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import chokidar from 'chokidar';
|
|
3
|
+
import { getFrameworkDir } from "./getFrameworkDir.js";
|
|
4
|
+
import { cliWarn } from "./cliOutput.js";
|
|
5
|
+
// Dev mode only, opt-in via warnOnFrameworkChange in tungsten.config.js. Node's ESM module
|
|
6
|
+
// cache can't be invalidated at runtime, so an already-running dev server can't pick up a
|
|
7
|
+
// change to the tungsten package itself (e.g. a linked/workspace copy being rebuilt) without a
|
|
8
|
+
// full process restart - this just tells the developer that's needed, rather than attempting it.
|
|
9
|
+
//
|
|
10
|
+
// Watches a single marker file (dist/.build-complete) rather than all of dist - tungsten's own
|
|
11
|
+
// build scripts touch it as their last step (see scripts/writeBuildMarker.mjs), so one file
|
|
12
|
+
// covers every file a build could have changed without chokidar scanning the whole tree. Watch
|
|
13
|
+
// mode (build-babel --watch) does not yet write it on each cycle, only the one-shot builds do.
|
|
14
|
+
export function warnOnFrameworkChange() {
|
|
15
|
+
const frameworkDistDir = join(getFrameworkDir(), 'dist');
|
|
16
|
+
const buildMarkerPath = join(frameworkDistDir, '.build-complete');
|
|
17
|
+
const watcher = chokidar.watch(buildMarkerPath, {
|
|
18
|
+
ignoreInitial: true,
|
|
19
|
+
awaitWriteFinish: {
|
|
20
|
+
stabilityThreshold: 200,
|
|
21
|
+
pollInterval: 20
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
watcher.on('all', () => {
|
|
25
|
+
cliWarn(`tungsten framework files changed (${frameworkDistDir}) - restart the dev server` + ` to pick up the change.`);
|
|
26
|
+
});
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tungsten",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist",
|
|
20
|
+
"!dist/**/*.sxyt.*",
|
|
20
21
|
"types",
|
|
21
22
|
"sxy-loader.config.js",
|
|
22
23
|
"readme.md"
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"@babel/cli": "^7.28.6",
|
|
29
30
|
"@babel/core": "^7.29.0",
|
|
30
31
|
"@babel/parser": "^7.29.2",
|
|
31
|
-
"@babel/plugin-syntax-import-assertions": "^7.
|
|
32
|
+
"@babel/plugin-syntax-import-assertions": "^7.29.7",
|
|
32
33
|
"@babel/plugin-transform-class-properties": "^7.28.6",
|
|
33
34
|
"@babel/preset-react": "^7.28.5",
|
|
34
35
|
"@hono/node-server": "^1.19.11",
|
|
@@ -37,11 +38,11 @@
|
|
|
37
38
|
"@rollup/plugin-json": "^6.1.0",
|
|
38
39
|
"@rollup/plugin-node-resolve": "^14.1.0",
|
|
39
40
|
"@rollup/plugin-terser": "^1.0.0",
|
|
40
|
-
"arktype": "^2.2.
|
|
41
|
+
"arktype": "^2.2.3",
|
|
41
42
|
"babel-plugin-css-to-js": "^0.0.4",
|
|
42
43
|
"babel-plugin-sxy-module-resolver": "^4.1.9",
|
|
43
44
|
"babel-plugin-sxy-transform-cjs-to-esm": "^0.2.6",
|
|
44
|
-
"bcryptjs": "^
|
|
45
|
+
"bcryptjs": "^3.0.3",
|
|
45
46
|
"chalk": "^5.6.2",
|
|
46
47
|
"chalk-extensions": "^2.0.24",
|
|
47
48
|
"chokidar": "^3.6.0",
|
|
@@ -56,29 +57,29 @@
|
|
|
56
57
|
"find-package-json": "^1.2.0",
|
|
57
58
|
"fs-extra": "^10.1.0",
|
|
58
59
|
"globby": "^13.2.2",
|
|
59
|
-
"hono": "^4.12.
|
|
60
|
-
"import-meta-resolve": "^
|
|
60
|
+
"hono": "^4.12.32",
|
|
61
|
+
"import-meta-resolve": "^4.2.0",
|
|
61
62
|
"ini": "^4.1.3",
|
|
62
63
|
"lodash.clonedeep": "^4.5.0",
|
|
63
64
|
"npm-run-all": "^4.1.5",
|
|
64
65
|
"open": "^8.4.2",
|
|
65
|
-
"path-to-regexp": "^
|
|
66
|
-
"postcss": "^8.5.
|
|
66
|
+
"path-to-regexp": "^8.4.2",
|
|
67
|
+
"postcss": "^8.5.24",
|
|
67
68
|
"precinct": "^12.2.0",
|
|
68
69
|
"react-router": "^6.30.3",
|
|
69
70
|
"require-resolve-hook": "^1.1.0",
|
|
70
71
|
"rollup": "^2.80.0",
|
|
71
72
|
"rollup-plugin-gzip": "^3.1.2",
|
|
72
|
-
"sass": "^1.
|
|
73
|
+
"sass": "^1.102.0",
|
|
73
74
|
"serialize-javascript": "^6.0.2",
|
|
74
75
|
"slash": "^4.0.0",
|
|
75
76
|
"sxy-dependency-tree": "^8.1.11",
|
|
76
77
|
"sxy-filing-cabinet": "^3.4.2",
|
|
77
|
-
"sxy-lib": "^3.0.
|
|
78
|
+
"sxy-lib": "^3.0.5",
|
|
78
79
|
"sxy-lib-object-copy": "^2.0.5",
|
|
79
80
|
"sxy-loader": "^3.1.0",
|
|
80
81
|
"sxy-package-investigator": "^1.0.0",
|
|
81
|
-
"zod": "^4.3
|
|
82
|
+
"zod": "^4.4.3"
|
|
82
83
|
},
|
|
83
84
|
"devDependencies": {
|
|
84
85
|
"@babel/generator": "^7.29.1",
|
|
@@ -86,7 +87,6 @@
|
|
|
86
87
|
"@types/babel-types": "^7.0.16",
|
|
87
88
|
"@types/babel__core": "^7.20.5",
|
|
88
89
|
"@types/babel__generator": "^7.27.0",
|
|
89
|
-
"@types/bcryptjs": "^2.4.6",
|
|
90
90
|
"@types/chai": "^4.3.20",
|
|
91
91
|
"@types/cookie-parser": "^1.4.10",
|
|
92
92
|
"@types/express": "^4.17.25",
|
|
@@ -110,11 +110,11 @@
|
|
|
110
110
|
"eslint-import-resolver-typescript": "^2.7.1",
|
|
111
111
|
"eslint-plugin-import": "^2.32.0",
|
|
112
112
|
"eslint-plugin-no-type-assertion": "^1.3.0",
|
|
113
|
-
"happy-dom": "^20.
|
|
113
|
+
"happy-dom": "^20.11.1",
|
|
114
114
|
"prop-types": "^15.8.1",
|
|
115
115
|
"rimraf": "^5.0.10",
|
|
116
116
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
117
|
-
"sxy-test-runner": "^2.
|
|
117
|
+
"sxy-test-runner": "^2.3.12",
|
|
118
118
|
"sxy-types": "^1.0.23",
|
|
119
119
|
"typescript": "^6.0.3"
|
|
120
120
|
},
|
|
@@ -136,13 +136,15 @@
|
|
|
136
136
|
"build": "run-s -c clean build-prep build-watch",
|
|
137
137
|
"clean": "rimraf intermed dist",
|
|
138
138
|
"build-once": "rimraf intermed dist && pnpm build-ts-once && pnpm build-babel-once",
|
|
139
|
+
"build-once-nd": "rimraf intermed dist.building && pnpm build-ts-once && pnpm build-babel-staged && node scripts/syncDist.mjs && node scripts/writeBuildMarker.mjs",
|
|
139
140
|
"build-quick": "pnpm build-watch",
|
|
140
141
|
"build-prep": "pnpm build-ts-once",
|
|
141
142
|
"build-watch": "run-p build-ts build-babel",
|
|
142
143
|
"build-ts": "tsc --watch",
|
|
143
144
|
"build-ts-once": "tsc",
|
|
144
|
-
"build-babel": "
|
|
145
|
-
"build-babel-once": "babel intermed --out-dir dist --ignore \"**/*.cjs\" --copy-files --config-file ./babel.framework.config.js",
|
|
145
|
+
"build-babel": "node scripts/watchBabelAndMark.mjs",
|
|
146
|
+
"build-babel-once": "babel intermed --out-dir dist --ignore \"**/*.cjs\" --copy-files --config-file ./babel.framework.config.js && node scripts/writeBuildMarker.mjs",
|
|
147
|
+
"build-babel-staged": "babel intermed --out-dir dist.building --ignore \"**/*.cjs\" --copy-files --config-file ./babel.framework.config.js",
|
|
146
148
|
"test": "sxy-test-runner",
|
|
147
149
|
"test-once": "sxy-test-runner once"
|
|
148
150
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gotoRedirect.sxyt.d.ts","sourceRoot":"","sources":["../../src/Instance/gotoRedirect.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { describe } from 'sxy-test-runner';
|
|
2
|
-
import { expect } from 'chai';
|
|
3
|
-
// aliased: an unaliased `Window` would shadow the DOM Window type the
|
|
4
|
-
// runtime context is declared with
|
|
5
|
-
import { Window as HappyWindow } from 'happy-dom';
|
|
6
|
-
import { Instance } from "./Instance.js";
|
|
7
|
-
import { WebRedirect } from "../routing/WebRedirect.js";
|
|
8
|
-
import { RoutingRedirect } from "../routing/RoutingRedirect.js";
|
|
9
|
-
import { initStores } from "../Servers/initStores.js";
|
|
10
|
-
import { UpdateScheduler } from "../update/UpdateScheduler.js";
|
|
11
|
-
// A client-side Instance whose hard redirects are recorded rather than
|
|
12
|
-
// performed. Only the routing and redirect paths are exercised, so the rest of
|
|
13
|
-
// the runtime is left at its defaults.
|
|
14
|
-
const makeInstance = routes => {
|
|
15
|
-
const replaced = [];
|
|
16
|
-
const pushed = [];
|
|
17
|
-
const happyWindow = new HappyWindow();
|
|
18
|
-
// Only the two things goto() reaches for: a hard redirect leaves through
|
|
19
|
-
// location.replace, and an in-app navigation records history.
|
|
20
|
-
const fakeWindow = {
|
|
21
|
-
location: {
|
|
22
|
-
replace: url => {
|
|
23
|
-
replaced.push(url);
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
history: {
|
|
27
|
-
pushState: (_state, _title, url) => {
|
|
28
|
-
pushed.push(url);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const runtimeContext = {
|
|
33
|
-
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
34
|
-
document: happyWindow.document,
|
|
35
|
-
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
36
|
-
window: fakeWindow,
|
|
37
|
-
scheduler: new UpdateScheduler(),
|
|
38
|
-
navigation: false
|
|
39
|
-
};
|
|
40
|
-
const matchedRouteInfo = {
|
|
41
|
-
key: null,
|
|
42
|
-
params: {},
|
|
43
|
-
content: null
|
|
44
|
-
};
|
|
45
|
-
const globalData = {}; // eslint-disable-line no-type-assertion/no-type-assertion
|
|
46
|
-
const {
|
|
47
|
-
internalStore,
|
|
48
|
-
stores,
|
|
49
|
-
storeSubscriptions
|
|
50
|
-
} = initStores('/', null, globalData, matchedRouteInfo);
|
|
51
|
-
const config = {
|
|
52
|
-
prod: false,
|
|
53
|
-
useRootComponent: true,
|
|
54
|
-
clientSideNav: false,
|
|
55
|
-
siteBasePath: '/',
|
|
56
|
-
staticSite: false
|
|
57
|
-
};
|
|
58
|
-
const instance = new Instance('/', config, null,
|
|
59
|
-
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
60
|
-
routes, routes,
|
|
61
|
-
// eslint-disable-line no-type-assertion/no-type-assertion
|
|
62
|
-
internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo, runtimeContext);
|
|
63
|
-
return {
|
|
64
|
-
instance,
|
|
65
|
-
replaced,
|
|
66
|
-
pushed
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
const legacyUrl = 'http://legacy.test/';
|
|
70
|
-
describe('Instance.goto() redirects', ({
|
|
71
|
-
it
|
|
72
|
-
}) => {
|
|
73
|
-
// A WebRedirect names a URL, not a route, so it has to leave the
|
|
74
|
-
// application. Client-side navigation used to throw here, which meant a
|
|
75
|
-
// session that expired between page load and a Link click hit an error
|
|
76
|
-
// instead of the log in page.
|
|
77
|
-
it('leaves the application for a WebRedirect returned by route data', async () => {
|
|
78
|
-
const {
|
|
79
|
-
instance,
|
|
80
|
-
replaced
|
|
81
|
-
} = makeInstance({
|
|
82
|
-
'/gone': {
|
|
83
|
-
content: null,
|
|
84
|
-
data: async () => new WebRedirect(legacyUrl)
|
|
85
|
-
},
|
|
86
|
-
'404': {
|
|
87
|
-
content: null
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
await instance.goto('/gone');
|
|
91
|
-
expect(replaced).to.deep.equal([legacyUrl]);
|
|
92
|
-
});
|
|
93
|
-
it('does not adopt the redirect as the current route', async () => {
|
|
94
|
-
const {
|
|
95
|
-
instance
|
|
96
|
-
} = makeInstance({
|
|
97
|
-
'/gone': {
|
|
98
|
-
content: null,
|
|
99
|
-
data: async () => new WebRedirect(legacyUrl)
|
|
100
|
-
},
|
|
101
|
-
'404': {
|
|
102
|
-
content: null
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
await instance.goto('/gone');
|
|
106
|
-
// it left the app; the route it was heading for never became current
|
|
107
|
-
expect(instance.matchedRouteInfo.key).to.not.equal('/gone');
|
|
108
|
-
});
|
|
109
|
-
it('still routes within the application for a RoutingRedirect', async () => {
|
|
110
|
-
const {
|
|
111
|
-
instance,
|
|
112
|
-
replaced
|
|
113
|
-
} = makeInstance({
|
|
114
|
-
'/old': {
|
|
115
|
-
content: null,
|
|
116
|
-
data: async () => new RoutingRedirect('/new')
|
|
117
|
-
},
|
|
118
|
-
'/new': {
|
|
119
|
-
content: null
|
|
120
|
-
},
|
|
121
|
-
'404': {
|
|
122
|
-
content: null
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
await instance.goto('/old');
|
|
126
|
-
expect(replaced).to.deep.equal([]);
|
|
127
|
-
expect(instance.matchedRouteInfo.key).to.equal('/new');
|
|
128
|
-
});
|
|
129
|
-
it('does not redirect for an ordinary data result', async () => {
|
|
130
|
-
const {
|
|
131
|
-
instance,
|
|
132
|
-
replaced
|
|
133
|
-
} = makeInstance({
|
|
134
|
-
'/ok': {
|
|
135
|
-
content: null,
|
|
136
|
-
data: async () => ({
|
|
137
|
-
value: 1
|
|
138
|
-
})
|
|
139
|
-
},
|
|
140
|
-
'404': {
|
|
141
|
-
content: null
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
await instance.goto('/ok');
|
|
145
|
-
expect(replaced).to.deep.equal([]);
|
|
146
|
-
expect(instance.matchedRouteInfo.key).to.equal('/ok');
|
|
147
|
-
});
|
|
148
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runTrackedWork.sxyt.d.ts","sourceRoot":"","sources":["../../src/Instance/runTrackedWork.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { describe } from 'sxy-test-runner';
|
|
3
|
-
import { runTrackedWork } from "./Instance.js";
|
|
4
|
-
describe('runTrackedWork() (no-scheduler tracked work fallback)', ({
|
|
5
|
-
it
|
|
6
|
-
}) => {
|
|
7
|
-
it('reports a synchronous throw with its description', () => {
|
|
8
|
-
const reports = [];
|
|
9
|
-
runTrackedWork(() => {
|
|
10
|
-
throw new Error('sync fail');
|
|
11
|
-
}, 'Comp componentDidUpdate lifecycle', (error, description) => reports.push([error, description]));
|
|
12
|
-
expect(reports).to.have.length(1);
|
|
13
|
-
expect((reports[0]?.[0]).message).to.equal('sync fail');
|
|
14
|
-
expect(reports[0]?.[1]).to.equal('Comp componentDidUpdate lifecycle');
|
|
15
|
-
});
|
|
16
|
-
it('reports an async rejection instead of leaving it unhandled', async () => {
|
|
17
|
-
const reports = [];
|
|
18
|
-
runTrackedWork(async () => {
|
|
19
|
-
await Promise.resolve();
|
|
20
|
-
throw new Error('async fail');
|
|
21
|
-
}, 'Comp componentDidUpdate lifecycle', (error, description) => reports.push([error, description]));
|
|
22
|
-
await new Promise(resolve => setTimeout(resolve, 0));
|
|
23
|
-
expect(reports).to.have.length(1);
|
|
24
|
-
expect((reports[0]?.[0]).message).to.equal('async fail');
|
|
25
|
-
expect(reports[0]?.[1]).to.equal('Comp componentDidUpdate lifecycle');
|
|
26
|
-
});
|
|
27
|
-
it('reports nothing for successful sync and async work', async () => {
|
|
28
|
-
const reports = [];
|
|
29
|
-
const report = error => reports.push(error);
|
|
30
|
-
runTrackedWork(() => 'ok', 'sync work', report);
|
|
31
|
-
runTrackedWork(async () => 'ok', 'async work', report);
|
|
32
|
-
await new Promise(resolve => setTimeout(resolve, 0));
|
|
33
|
-
expect(reports).to.have.length(0);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cjsHelpers.sxyt.d.ts","sourceRoot":"","sources":["../../src/_client/cjsHelpers.sxyt.ts"],"names":[],"mappings":""}
|