tungsten 0.3.2 → 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/Framework.d.ts +2 -0
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js +68 -57
- package/dist/FrameworkConfig.d.ts +2 -0
- package/dist/FrameworkConfig.d.ts.map +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 +84 -8
- 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/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/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 +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/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 +8 -7
- package/dist/build/createInstanceConfigFile.js +1 -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 +1 -0
- package/dist/defaultConfig.d.ts.map +1 -1
- package/dist/defaultConfig.js +2 -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/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/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 +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 +1 -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 +2 -1
- package/dist/render/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +8 -2
- 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 +11 -0
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +9 -3
- package/dist/warnOnFrameworkChange.d.ts.map +1 -1
- package/dist/warnOnFrameworkChange.js +8 -8
- package/package.json +18 -16
- 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.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,51 +1,34 @@
|
|
|
1
|
-
//import type { Response as ExpressResponse } from 'express'
|
|
2
|
-
import { Hono } from 'hono';
|
|
3
1
|
import { ContentNodeIsClassComponent } from "../../ContentNode.js";
|
|
4
2
|
import { RoutingRedirect } from "../../routing/RoutingRedirect.js";
|
|
5
3
|
import { cliTodo } from "../../cliOutput.js";
|
|
6
4
|
import { RouteRedirectComponent } from "../../components/RouteRedirectComponent.js";
|
|
5
|
+
import { WebRedirectComponent } from "../../components/WebRedirectComponent.js";
|
|
7
6
|
import { $props, $type } from "../../contentNodeSymbols.js";
|
|
8
7
|
import { WebRedirect } from "../../routing/WebRedirect.js";
|
|
9
|
-
import { throwError } from "../../throwError.js";
|
|
10
|
-
const app = new Hono();
|
|
11
|
-
app.get(async c => {
|
|
12
|
-
const id = c.req.param('id');
|
|
13
|
-
c.res;
|
|
14
|
-
// ...
|
|
15
|
-
});
|
|
16
|
-
function debug(...texts) {
|
|
17
|
-
// console.log(...texts)
|
|
18
|
-
}
|
|
19
8
|
export class TungstenServerHono {
|
|
9
|
+
// Hono's c.redirect() builds a Response but doesn't send it - unlike Express's res.redirect()
|
|
10
|
+
// (which sends immediately), the caller here must return the Response itself for Hono to
|
|
11
|
+
// actually deliver it. Returns false when there's no redirect to make.
|
|
20
12
|
handleRedirects(c /* any */, matchedRouteInfo) {
|
|
21
13
|
// handle any redirect issued during routing
|
|
22
14
|
if (matchedRouteInfo.data instanceof RoutingRedirect) {
|
|
23
15
|
const redirect = matchedRouteInfo.data;
|
|
24
|
-
c.redirect(redirect.to, redirect.code);
|
|
25
|
-
return true;
|
|
16
|
+
return c.redirect(redirect.to, redirect.code);
|
|
26
17
|
} else if (matchedRouteInfo.data instanceof WebRedirect) {
|
|
27
18
|
const redirect = matchedRouteInfo.data;
|
|
28
|
-
c.redirect(redirect.to, redirect.code);
|
|
29
|
-
return true;
|
|
19
|
+
return c.redirect(redirect.to, redirect.code);
|
|
30
20
|
}
|
|
31
|
-
// console.log('content', matchedRouteInfo.content)
|
|
32
|
-
// console.log('is func', typeof matchedRouteInfo.content !== 'function')
|
|
33
|
-
// console.log('ContentNodeIsClassComponent', ContentNodeIsClassComponent(matchedRouteInfo.content as any))
|
|
34
|
-
// console.log('instanceof', (matchedRouteInfo as any).content[$type] instanceof RedirectComponent)
|
|
35
|
-
// console.log('prototype instanceof', (matchedRouteInfo as any).content[$type].prototype instanceof RedirectComponent)
|
|
36
|
-
// console.log('__tungstenRedirect', (matchedRouteInfo as any).content[$type].__tungstenRedirect)
|
|
37
|
-
// console.log('$type', (matchedRouteInfo as any).content[$type])
|
|
38
|
-
//console.log('content[$type]', matchedRouteInfo.content[$type])
|
|
39
|
-
//console.log('instanceof', matchedRouteInfo.content instanceof RedirectComponent)
|
|
40
21
|
if (typeof matchedRouteInfo.content !== 'function' && ContentNodeIsClassComponent(matchedRouteInfo.content)) {
|
|
41
22
|
if (matchedRouteInfo.content[$type] === RouteRedirectComponent || matchedRouteInfo.content[$type].prototype instanceof RouteRedirectComponent) {
|
|
42
23
|
cliTodo('consider type of RedirectComponent props');
|
|
43
24
|
const code = matchedRouteInfo.content[$props].code || 302;
|
|
44
25
|
const to = matchedRouteInfo.content[$props].to;
|
|
45
|
-
c.redirect(to, code);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
return c.redirect(to, code);
|
|
27
|
+
} else if (matchedRouteInfo.content[$type] === WebRedirectComponent || matchedRouteInfo.content[$type].prototype instanceof WebRedirectComponent) {
|
|
28
|
+
cliTodo('consider type of RedirectComponent props');
|
|
29
|
+
const code = matchedRouteInfo.content[$props].code || 302;
|
|
30
|
+
const to = matchedRouteInfo.content[$props].to;
|
|
31
|
+
return c.redirect(to, code);
|
|
49
32
|
}
|
|
50
33
|
}
|
|
51
34
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/Servers/routing.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/Servers/routing.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAIjE,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAE,iBAAiB,GAAG,IAAW,GAC5G,OAAO,CAAC,gBAAgB,CAAC,CA+D9B"}
|
package/dist/Servers/routing.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Default404 } from "../routing/Default404.js";
|
|
2
2
|
import { matchPath } from "../routing/matchPath.js";
|
|
3
|
+
import { makeTungstenErrorInfo } from "../routing/TungstenErrorInfo.js";
|
|
3
4
|
import { jsx as _jsx } from "tungsten/jsxRuntime.js";
|
|
4
5
|
export async function routing(location, routes, serverDataLoading = null) {
|
|
5
6
|
let defaultRoute, _404Route, errorRoute;
|
|
@@ -25,7 +26,7 @@ export async function routing(location, routes, serverDataLoading = null) {
|
|
|
25
26
|
if (match !== null) {
|
|
26
27
|
const params = match.params;
|
|
27
28
|
let data = undefined;
|
|
28
|
-
if (route
|
|
29
|
+
if ('data' in route) {
|
|
29
30
|
if (serverDataLoading) serverDataLoading.value = true;
|
|
30
31
|
data = await route.data(params, location, match.query);
|
|
31
32
|
if (serverDataLoading) serverDataLoading.value = false;
|
|
@@ -50,11 +51,14 @@ export async function routing(location, routes, serverDataLoading = null) {
|
|
|
50
51
|
params: {},
|
|
51
52
|
content: _404Route.content
|
|
52
53
|
};
|
|
53
|
-
if (errorRoute)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
if (errorRoute) {
|
|
55
|
+
return {
|
|
56
|
+
key: 'error',
|
|
57
|
+
params: {},
|
|
58
|
+
content: errorRoute.content,
|
|
59
|
+
data: makeTungstenErrorInfo(new Error(`No route matched '${location}'`))
|
|
60
|
+
};
|
|
61
|
+
}
|
|
58
62
|
return {
|
|
59
63
|
key: null,
|
|
60
64
|
params: {},
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const tungstenCorePrivateEnvSchema: z.ZodObject<{
|
|
3
3
|
TUNGSTEN_SERVER_PORT: z.ZodOptional<z.ZodNumber>;
|
|
4
|
-
FRONTEND_PROTO: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"https">]>>;
|
|
5
|
-
FRONTEND_HOST: z.ZodOptional<z.ZodString>;
|
|
6
|
-
FRONTEND_PORT: z.ZodOptional<z.ZodNumber>;
|
|
7
4
|
DEBUG: z.ZodOptional<z.ZodBoolean>;
|
|
8
5
|
}, z.core.$loose>;
|
|
9
6
|
export type TungstenCorePrivateEnv = typeof tungstenCorePrivateEnvSchema._output;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tungstenCorePrivateEnvSchema.d.ts","sourceRoot":"","sources":["../../src/Servers/tungstenCorePrivateEnvSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAkBvB,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"tungstenCorePrivateEnvSchema.d.ts","sourceRoot":"","sources":["../../src/Servers/tungstenCorePrivateEnvSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAkBvB,eAAO,MAAM,4BAA4B;;;iBASvC,CAAA;AAGF,MAAM,MAAM,sBAAsB,GAAG,OAAO,4BAA4B,CAAC,OAAO,CAAA"}
|
|
@@ -14,9 +14,9 @@ const protoSchema = z.union([z.literal('http'), z.literal('https')]);
|
|
|
14
14
|
const portSchema = z.number().gt(0);
|
|
15
15
|
export const tungstenCorePrivateEnvSchema = z.looseObject({
|
|
16
16
|
TUNGSTEN_SERVER_PORT: z.optional(portSchema),
|
|
17
|
-
FRONTEND_PROTO: z.optional(protoSchema),
|
|
18
|
-
FRONTEND_HOST: z.optional(z.string()),
|
|
19
|
-
FRONTEND_PORT: z.optional(portSchema),
|
|
17
|
+
// FRONTEND_PROTO: z.optional(protoSchema),
|
|
18
|
+
// FRONTEND_HOST: z.optional(z.string()),
|
|
19
|
+
// FRONTEND_PORT: z.optional(portSchema),
|
|
20
20
|
DEBUG: z.optional(z.boolean())
|
|
21
21
|
// SUPPRESS: z.optional(z.object({
|
|
22
22
|
// ORIGIN_MISMATCH_WARNING: z.optional(z.boolean())
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const tungstenCorePublicEnvSchema: z.ZodObject<{
|
|
3
|
+
FRONTEND_PROTO: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"https">]>>;
|
|
4
|
+
FRONTEND_HOST: z.ZodOptional<z.ZodString>;
|
|
5
|
+
FRONTEND_PORT: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
export type TungstenCorePublicEnv = typeof tungstenCorePublicEnvSchema._output;
|
|
8
|
+
//# sourceMappingURL=tungstenCorePublicEnvSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tungstenCorePublicEnvSchema.d.ts","sourceRoot":"","sources":["../../src/Servers/tungstenCorePublicEnvSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAWvB,eAAO,MAAM,2BAA2B;;;;iBAItC,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,2BAA2B,CAAC,OAAO,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// FRONTEND_PROTO/FRONTEND_HOST/FRONTEND_PORT are tungsten's own fields (used to
|
|
3
|
+
// report the dev/prod server's own location - see DevServer.ts/ProdServer.ts).
|
|
4
|
+
// Optional here because most apps keep them in the private env instead - see
|
|
5
|
+
// tungstenCorePrivateEnvSchema.ts, which declares the same three fields. An
|
|
6
|
+
// app is free to declare either or both; the servers check private first,
|
|
7
|
+
// then public.
|
|
8
|
+
const protoSchema = z.union([z.literal('http'), z.literal('https')]);
|
|
9
|
+
const portSchema = z.number().gt(0);
|
|
10
|
+
export const tungstenCorePublicEnvSchema = z.looseObject({
|
|
11
|
+
FRONTEND_PROTO: z.optional(protoSchema),
|
|
12
|
+
FRONTEND_HOST: z.optional(z.string()),
|
|
13
|
+
FRONTEND_PORT: z.optional(portSchema)
|
|
14
|
+
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { MatchedRouteInfo } from '../Servers/MatchedRouteInfo.js';
|
|
2
|
+
import type { PopMessage } from '../PopMessage.type.js';
|
|
2
3
|
export declare class InternalStoreSchema {
|
|
3
4
|
location: string;
|
|
4
5
|
matchedRouteInfo: MatchedRouteInfo;
|
|
6
|
+
popMessages: PopMessage[];
|
|
5
7
|
constructor(location: string, matchedRouteInfo: MatchedRouteInfo);
|
|
6
8
|
}
|
|
7
9
|
//# sourceMappingURL=InternalStoreSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalStoreSchema.d.ts","sourceRoot":"","sources":["../../src/Store/InternalStoreSchema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"InternalStoreSchema.d.ts","sourceRoot":"","sources":["../../src/Store/InternalStoreSchema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,qBAAa,mBAAmB;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,WAAW,EAAE,UAAU,EAAE,CAAK;gBAClB,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB;CAInE"}
|
|
@@ -5,6 +5,7 @@ export class InternalStoreSchema {
|
|
|
5
5
|
constructor(location, matchedRouteInfo) {
|
|
6
6
|
_defineProperty(this, "location", void 0);
|
|
7
7
|
_defineProperty(this, "matchedRouteInfo", void 0);
|
|
8
|
+
_defineProperty(this, "popMessages", []);
|
|
8
9
|
this.location = location;
|
|
9
10
|
this.matchedRouteInfo = matchedRouteInfo;
|
|
10
11
|
}
|
package/dist/api/Request.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Request } from 'express';
|
|
1
|
+
export type { Request } from 'express';
|
|
2
2
|
//# sourceMappingURL=Request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/api/Request.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/api/Request.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/api/Response.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Response } from 'express';
|
|
1
|
+
export type { Response } from 'express';
|
|
2
2
|
//# sourceMappingURL=Response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Response.d.ts","sourceRoot":"","sources":["../../src/api/Response.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"Response.d.ts","sourceRoot":"","sources":["../../src/api/Response.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as BabelCore from '@babel/core';
|
|
2
|
-
export { BabelCore };
|
|
3
|
-
export { NodePath, PluginPass } from '@babel/core';
|
|
2
|
+
export type { BabelCore };
|
|
3
|
+
export type { NodePath, PluginPass } from '@babel/core';
|
|
4
4
|
export type Babel = typeof BabelCore;
|
|
5
5
|
export * as BabelTypes from '@babel/types';
|
|
6
6
|
//# sourceMappingURL=BabelTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BabelTypes.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/BabelTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAA;AAC7C,
|
|
1
|
+
{"version":3,"file":"BabelTypes.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/BabelTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAA;AAC7C,YAAY,EAAE,SAAS,EAAE,CAAA;AACzB,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACvD,MAAM,MAAM,KAAK,GAAG,OAAO,SAAS,CAAC;AAErC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/build.ts"],"names":[],"mappings":"AA6CA,OAAO,EAAE,CAAA"}
|
|
@@ -3,8 +3,11 @@ import chalk from 'chalk-extensions';
|
|
|
3
3
|
import { Framework } from "../../Framework.js";
|
|
4
4
|
import { cliOut, cliNews } from "../../cliOutput.js";
|
|
5
5
|
import { staticSiteFolder } from "../../settings.js";
|
|
6
|
+
import { createTimeProfiler } from "../../timeProfiler.js";
|
|
7
|
+
const profile = process.argv.slice(3).includes('--profile');
|
|
6
8
|
//// prep the app
|
|
7
9
|
const sxyFramework = new Framework();
|
|
10
|
+
sxyFramework.profiler = createTimeProfiler(profile);
|
|
8
11
|
await sxyFramework.init();
|
|
9
12
|
await sxyFramework.clean('prod');
|
|
10
13
|
await sxyFramework.build('prod');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/dev.ts"],"names":[],"mappings":"AAqDA,OAAO,EAAE,CAAA"}
|
package/dist/bin/commands/dev.js
CHANGED
|
@@ -2,11 +2,16 @@ import open from 'open';
|
|
|
2
2
|
import { cliOut } from "../../cliOutput.js";
|
|
3
3
|
import { Framework } from "../../Framework.js";
|
|
4
4
|
import { warnOnFrameworkChange } from "../../warnOnFrameworkChange.js";
|
|
5
|
+
import { createTimeProfiler } from "../../timeProfiler.js";
|
|
5
6
|
//import dotenv from 'dotenv'
|
|
6
7
|
//dotenv.config({ path: '.private.env' })
|
|
8
|
+
const args = process.argv.slice(3);
|
|
9
|
+
const boot = !args.includes('--no-boot');
|
|
10
|
+
const profile = args.includes('--profile');
|
|
7
11
|
cliOut(`Starting dev mode`);
|
|
8
12
|
//// prep the app
|
|
9
13
|
const sxyFramework = new Framework();
|
|
14
|
+
sxyFramework.profiler = createTimeProfiler(profile);
|
|
10
15
|
await sxyFramework.init();
|
|
11
16
|
//console.log('framework ready')
|
|
12
17
|
// build for dev
|
|
@@ -17,9 +22,15 @@ await sxyFramework.build('dev');
|
|
|
17
22
|
// start a dev server
|
|
18
23
|
const devServer = await sxyFramework.createDevServer();
|
|
19
24
|
//cliOut('Dev server ready')
|
|
20
|
-
const devServerLocation = await devServer.start();
|
|
21
|
-
|
|
25
|
+
const devServerLocation = await sxyFramework.profiler.timeProfileAsync('start dev server', () => devServer.start());
|
|
26
|
+
// devmon already restarts this process itself on a framework rebuild, so the warning
|
|
27
|
+
// (which just tells you to restart manually) would be redundant noise under it - see devmon.ts.
|
|
28
|
+
if (sxyFramework.config?.warnOnFrameworkChange && process.env.__TUNGSTEN_DEVMON !== 'true') {
|
|
29
|
+
warnOnFrameworkChange();
|
|
30
|
+
}
|
|
22
31
|
// do a dummy request to trigger any error immediately during dev
|
|
23
32
|
//axios.get(sxyFramework.devServer.location)
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
if (boot) {
|
|
34
|
+
cliOut('Booting to the dev site in your browser');
|
|
35
|
+
open(devServerLocation);
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devmon.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/devmon.ts"],"names":[],"mappings":"AAqEA,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Master process for `tungsten dev`: runs it as a child process and watches the same
|
|
2
|
+
// build-notification marker file as warnOnFrameworkChange.ts (dist/.build-complete in the
|
|
3
|
+
// framework package). When a framework rebuild touches it, kills and respawns the dev child
|
|
4
|
+
// instead of just warning that a restart is needed.
|
|
5
|
+
import { spawn } from 'node:child_process';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import chokidar from 'chokidar';
|
|
9
|
+
import { cliError } from "../../cliOutput.js";
|
|
10
|
+
import { getFrameworkDir } from "../../getFrameworkDir.js";
|
|
11
|
+
const binIndexPath = fileURLToPath(new URL('../index.js', import.meta.url));
|
|
12
|
+
const initialArgs = process.argv.slice(3);
|
|
13
|
+
// Restarts always force --no-boot (no reopening the browser tab each time), but otherwise
|
|
14
|
+
// keep whatever else devmon itself was passed - e.g. --profile.
|
|
15
|
+
const restartArgs = [...initialArgs.filter(arg => arg !== '--no-boot'), '--no-boot'];
|
|
16
|
+
const buildMarkerPath = join(getFrameworkDir(), 'dist', '.build-complete');
|
|
17
|
+
let child = null;
|
|
18
|
+
let restarting = false;
|
|
19
|
+
function startDev(args) {
|
|
20
|
+
// __TUNGSTEN_DEVMON tells dev.ts to skip warnOnFrameworkChange() - devmon is already
|
|
21
|
+
// restarting it, so that warning would just be confusing noise here.
|
|
22
|
+
child = spawn(process.execPath, [binIndexPath, 'dev', ...args], {
|
|
23
|
+
stdio: 'inherit',
|
|
24
|
+
env: {
|
|
25
|
+
...process.env,
|
|
26
|
+
__TUNGSTEN_DEVMON: 'true'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
child.on('exit', code => {
|
|
30
|
+
child = null;
|
|
31
|
+
// not one of our own restarts, so the dev process ended on its own (crash, or the
|
|
32
|
+
// user quit it directly) - nothing left for devmon to supervise
|
|
33
|
+
if (!restarting) process.exit(code ?? 0);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function restartDev() {
|
|
37
|
+
if (restarting) return;
|
|
38
|
+
restarting = true;
|
|
39
|
+
cliError('tungsten framework rebuilt - restarting tungsten dev');
|
|
40
|
+
if (child === null) {
|
|
41
|
+
restarting = false;
|
|
42
|
+
startDev(restartArgs);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
child.once('exit', () => {
|
|
46
|
+
restarting = false;
|
|
47
|
+
startDev(restartArgs);
|
|
48
|
+
});
|
|
49
|
+
child.kill();
|
|
50
|
+
}
|
|
51
|
+
startDev(initialArgs);
|
|
52
|
+
const watcher = chokidar.watch(buildMarkerPath, {
|
|
53
|
+
ignoreInitial: true,
|
|
54
|
+
awaitWriteFinish: {
|
|
55
|
+
stabilityThreshold: 200,
|
|
56
|
+
pollInterval: 20
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
watcher.on('all', restartDev);
|
|
60
|
+
function shutdown() {
|
|
61
|
+
void watcher.close();
|
|
62
|
+
if (child !== null) child.kill();
|
|
63
|
+
process.exit(0);
|
|
64
|
+
}
|
|
65
|
+
process.on('SIGINT', shutdown);
|
|
66
|
+
process.on('SIGTERM', shutdown);
|
package/dist/bin/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":"AAwDA,OAAO,EAAE,CAAA"}
|
package/dist/bin/index.js
CHANGED
|
@@ -10,6 +10,12 @@ switch (command) {
|
|
|
10
10
|
await import("./commands/dev.js");
|
|
11
11
|
break;
|
|
12
12
|
}
|
|
13
|
+
case 'devmon':
|
|
14
|
+
{
|
|
15
|
+
process.env.__TUNGSTEN_ENV = 'development';
|
|
16
|
+
await import("./commands/devmon.js");
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
13
19
|
case 'build':
|
|
14
20
|
{
|
|
15
21
|
process.env.__TUNGSTEN_ENV = 'production';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The attribute string value for a boolean prop, or `null` when the attribute
|
|
3
|
+
* should be omitted entirely.
|
|
4
|
+
*
|
|
5
|
+
* The general rule is an ordinary HTML boolean attribute - `disabled`,
|
|
6
|
+
* `checked`, `hidden` and the rest: present (conventionally with an empty
|
|
7
|
+
* value) means true, absent means false. `contentEditable` looks like one of
|
|
8
|
+
* these in JSX but is not: `contenteditable` is a three-state enumerated
|
|
9
|
+
* attribute (true/false/inherit) where an absent attribute means *inherit*,
|
|
10
|
+
* not false. Representing `contentEditable={false}` by omitting the
|
|
11
|
+
* attribute therefore does nothing under an editable ancestor - the element
|
|
12
|
+
* silently stays editable. It gets explicit `"true"`/`"false"` strings
|
|
13
|
+
* instead; every other boolean prop keeps the ordinary rule.
|
|
14
|
+
*
|
|
15
|
+
* Shared by every place that turns a boolean prop into HTML - the server
|
|
16
|
+
* renderer, the client create/update paths, hydration's attribute
|
|
17
|
+
* reconciliation, and `contentNodeToHtml()` - so they cannot disagree with
|
|
18
|
+
* each other and produce a false hydration mismatch.
|
|
19
|
+
*/
|
|
20
|
+
export declare function booleanAttributeValue(name: string, value: boolean): string | null;
|
|
21
|
+
//# sourceMappingURL=booleanAttributeValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booleanAttributeValue.d.ts","sourceRoot":"","sources":["../src/booleanAttributeValue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAGjF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The attribute string value for a boolean prop, or `null` when the attribute
|
|
3
|
+
* should be omitted entirely.
|
|
4
|
+
*
|
|
5
|
+
* The general rule is an ordinary HTML boolean attribute - `disabled`,
|
|
6
|
+
* `checked`, `hidden` and the rest: present (conventionally with an empty
|
|
7
|
+
* value) means true, absent means false. `contentEditable` looks like one of
|
|
8
|
+
* these in JSX but is not: `contenteditable` is a three-state enumerated
|
|
9
|
+
* attribute (true/false/inherit) where an absent attribute means *inherit*,
|
|
10
|
+
* not false. Representing `contentEditable={false}` by omitting the
|
|
11
|
+
* attribute therefore does nothing under an editable ancestor - the element
|
|
12
|
+
* silently stays editable. It gets explicit `"true"`/`"false"` strings
|
|
13
|
+
* instead; every other boolean prop keeps the ordinary rule.
|
|
14
|
+
*
|
|
15
|
+
* Shared by every place that turns a boolean prop into HTML - the server
|
|
16
|
+
* renderer, the client create/update paths, hydration's attribute
|
|
17
|
+
* reconciliation, and `contentNodeToHtml()` - so they cannot disagree with
|
|
18
|
+
* each other and produce a false hydration mismatch.
|
|
19
|
+
*/
|
|
20
|
+
export function booleanAttributeValue(name, value) {
|
|
21
|
+
if (name.toLowerCase() === 'contenteditable') return value ? 'true' : 'false';
|
|
22
|
+
return value ? '' : null;
|
|
23
|
+
}
|
|
@@ -52,7 +52,7 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
52
52
|
const pendingExportWipes = new Map();
|
|
53
53
|
const exportWipeGraceMs = 5000;
|
|
54
54
|
async function transformFile(file) {
|
|
55
|
-
if (options.quiet !== true) console.log('transforming file', file)
|
|
55
|
+
//if (options.quiet !== true) console.log('transforming file', file)
|
|
56
56
|
try {
|
|
57
57
|
let rel = file.slice(codeLocationLength);
|
|
58
58
|
if (rel.endsWith('.jsx')) rel = rel.slice(0, -1);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CompilationInfo } from './CompilationInfo.js';
|
|
2
2
|
import type { FrameworkConfigComplete } from '../FrameworkConfig.js';
|
|
3
3
|
import type { Mode } from '../Mode.js';
|
|
4
|
-
|
|
4
|
+
import { type TimeProfiler } from '../timeProfiler.js';
|
|
5
|
+
export declare function compileUserApp(projectDir: string, appConfig: FrameworkConfigComplete, mode: Mode, profiler?: TimeProfiler): Promise<CompilationInfo>;
|
|
5
6
|
//# sourceMappingURL=compileUserApp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileUserApp.d.ts","sourceRoot":"","sources":["../../src/build/compileUserApp.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"compileUserApp.d.ts","sourceRoot":"","sources":["../../src/build/compileUserApp.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAQtC,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAI1E,wBAAsB,cAAc,CAChC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,EAClE,QAAQ,GAAE,YAAwC,GACnD,OAAO,CAAC,eAAe,CAAC,CAwD1B"}
|
|
@@ -6,8 +6,9 @@ import { copyPublicFiles } from "./copyPublicFiles.js";
|
|
|
6
6
|
import { buildCodeSubPath, bundleFolder, devBuildOuterFolder, prodBuildFolder } from "../settings.js";
|
|
7
7
|
import { combineComponentCss } from "./combineComponentCss.js";
|
|
8
8
|
import { emitReloadEvent } from "../hmr/liveReloadHub.js";
|
|
9
|
+
import { createTimeProfiler } from "../timeProfiler.js";
|
|
9
10
|
//import { compileEnv } from './compileEnv.js'
|
|
10
|
-
export async function compileUserApp(projectDir, appConfig, mode) {
|
|
11
|
+
export async function compileUserApp(projectDir, appConfig, mode, profiler = createTimeProfiler(false)) {
|
|
11
12
|
const codeLocation = join(projectDir, appConfig.codeDir);
|
|
12
13
|
const relSourceDir = appConfig.sourceDir !== undefined && appConfig.sourceDir !== '' ? appConfig.sourceDir : appConfig.codeDir;
|
|
13
14
|
const sourceLocation = join(projectDir, relSourceDir);
|
|
@@ -15,15 +16,15 @@ export async function compileUserApp(projectDir, appConfig, mode) {
|
|
|
15
16
|
const buildLocation = mode === 'dev' ? join(projectDir, devBuildOuterFolder) : join(projectDir, prodBuildFolder);
|
|
16
17
|
const codeSubPath = buildCodeSubPath;
|
|
17
18
|
const buildCodeLocation = join(buildLocation, codeSubPath);
|
|
18
|
-
const compileJavascriptPromise = compileJavascript(projectDir, appConfig, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, mode, true, mode === 'dev' ? {
|
|
19
|
+
const compileJavascriptPromise = profiler.timeProfileAsync('compile javascript', () => compileJavascript(projectDir, appConfig, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, mode, true, mode === 'dev' ? {
|
|
19
20
|
onCycleComplete: cycle => {
|
|
20
21
|
if (cycle.success) emitReloadEvent('js', cycle.file);
|
|
21
22
|
}
|
|
22
|
-
} : {});
|
|
23
|
+
} : {}));
|
|
23
24
|
//const compileEnvPromise = compileEnv(projectDir, appConfig, codeLocation, buildLocation, mode)
|
|
24
|
-
const compileStylesPromise = compileStyles(projectDir, appConfig, styleImportBase, buildLocation, true, mode === 'dev' ? () => emitReloadEvent('css') : undefined);
|
|
25
|
-
const copyAssetsPromise = copyAssets(projectDir, appConfig, buildLocation);
|
|
26
|
-
const copyPublicFilesPromise = copyPublicFiles(projectDir, appConfig, buildLocation);
|
|
25
|
+
const compileStylesPromise = profiler.timeProfileAsync('compile styles', () => compileStyles(projectDir, appConfig, styleImportBase, buildLocation, true, mode === 'dev' ? () => emitReloadEvent('css') : undefined));
|
|
26
|
+
const copyAssetsPromise = profiler.timeProfileAsync('copy assets', () => copyAssets(projectDir, appConfig, buildLocation));
|
|
27
|
+
const copyPublicFilesPromise = profiler.timeProfileAsync('copy public files', () => copyPublicFiles(projectDir, appConfig, buildLocation));
|
|
27
28
|
const {
|
|
28
29
|
importAliases
|
|
29
30
|
} = await compileJavascriptPromise;
|
|
@@ -31,7 +32,7 @@ export async function compileUserApp(projectDir, appConfig, mode) {
|
|
|
31
32
|
await compileStylesPromise;
|
|
32
33
|
await copyAssetsPromise;
|
|
33
34
|
await copyPublicFilesPromise;
|
|
34
|
-
if (mode === 'prod') await combineComponentCss(buildLocation);
|
|
35
|
+
if (mode === 'prod') await profiler.timeProfileAsync('combine component css', () => combineComponentCss(buildLocation));
|
|
35
36
|
const compilationInfo = {
|
|
36
37
|
type: 'success',
|
|
37
38
|
projectDir,
|
|
@@ -20,7 +20,7 @@ export async function createInstanceConfigFile(config, mode, buildLocation) {
|
|
|
20
20
|
});
|
|
21
21
|
await fsPromises.writeFile(appConfigLocation,
|
|
22
22
|
// to
|
|
23
|
-
`export default { prod: ${(mode === 'prod').toString()}, useRootComponent: ${config.useRootComponent.toString()}, siteBasePath: "${siteBasePath}", clientSideNav: ${config.clientSideNav.toString()}, staticSite: ${config.staticSite.toString()} };` // eslint-disable-line max-len
|
|
23
|
+
`export default { prod: ${(mode === 'prod').toString()}, useRootComponent: ${config.useRootComponent.toString()}, siteBasePath: "${siteBasePath}", clientSideNav: ${config.clientSideNav.toString()}, staticSite: ${config.staticSite.toString()}, csr: ${config.csr.toString()} };` // eslint-disable-line max-len
|
|
24
24
|
);
|
|
25
25
|
} catch (e) {
|
|
26
26
|
throw new TungstenError(`createAppConfig() Error: error creating app config file`);
|
package/dist/compat/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TungstenStatefulComponent } from 'tungsten/Components.jsx';
|
|
2
2
|
import { ContentNode, ContentNodeElement } from '../ContentNode.js';
|
|
3
|
-
export { ContentNode as ReactNode, ContentNodeElement as ReactElement };
|
|
3
|
+
export type { ContentNode as ReactNode, ContentNodeElement as ReactElement };
|
|
4
4
|
export type PropsWithChildren<P> = P & {
|
|
5
5
|
children?: ContentNode | undefined;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compat/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,yBAAyB,EAAiC,MAAM,yBAAyB,CAAA;AACzH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEnE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compat/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,yBAAyB,EAAiC,MAAM,yBAAyB,CAAA;AACzH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEnE,YAAY,EAAE,WAAW,IAAI,SAAS,EAAE,kBAAkB,IAAI,YAAY,EAAE,CAAA;AAE5E,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;CAAE,CAAC;AAwJ9E,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAgC9G,OAAO,KAAK,KAAK,SAAS,MAAM,YAAY,CAAA;AAC5C,KAAK,aAAa,CAAC,CAAC,IAAI,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AACnD,KAAK,iBAAiB,CAAC,CAAC,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAS3D,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,EAAE;IACrC,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC9D,SAAS,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC7C,YAAY,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TungstenSimpleInternalStoreComponent } from '../Components.jsx';
|
|
2
|
+
type Props = {
|
|
3
|
+
className?: string;
|
|
4
|
+
messageClassName?: string;
|
|
5
|
+
unstyled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare class PopMessages extends TungstenSimpleInternalStoreComponent<Props> {
|
|
8
|
+
clientInit: () => void;
|
|
9
|
+
content: () => import("../ContentNode.js").ContentNode;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=PopMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopMessages.d.ts","sourceRoot":"","sources":["../../src/components/PopMessages.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,mBAAmB,CAAA;AAGxE,KAAK,KAAK,GAAG;IACT,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAIzB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAkBD,qBAAa,WAAY,SAAQ,oCAAoC,CAAC,KAAK,CAAC;IACxE,UAAU,aAET;IAED,OAAO,gDAsBN;CACJ"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { combineClassNames } from "../helpers/combineClassNames.js";
|
|
5
|
+
import { TungstenSimpleInternalStoreComponent } from "../Components.js";
|
|
6
|
+
import { dismissPop, registerPopInstance } from "../pop.js";
|
|
7
|
+
import { jsx as _jsx } from "tungsten/jsxRuntime.js";
|
|
8
|
+
const messageCss = 'padding: 0.3rem 0.75rem; font-size: 0.85rem; max-height: 3rem; background: #1f3a5f;' + ' color: #eaf2ff; border-bottom: 1px solid #16283f; text-align: center; cursor: pointer; overflow: hidden;' + ' transition: max-height 0.2s ease, padding 0.2s ease;';
|
|
9
|
+
const leavingCss = 'max-height: 0; padding-top: 0; padding-bottom: 0; border-bottom-width: 0;';
|
|
10
|
+
// An app mounts this once in its Root, above <MatchedRoute />, so it can push
|
|
11
|
+
// the page down rather than overlay it. clientInit wires the pop() bridge -
|
|
12
|
+
// see pop.ts. Carries its own default look via the css prop: a component
|
|
13
|
+
// shipped as a framework dependency can't rely on Tungsten's Sass/style-
|
|
14
|
+
// scoping build step, which only runs over an app's own source and never
|
|
15
|
+
// node_modules (the same exclude pattern BabelTransformRemoveServerBlocks
|
|
16
|
+
// relies on elsewhere - see rollup.user.prod.config.ts). Override the look
|
|
17
|
+
// with className, style the PopMessages component selector from your own
|
|
18
|
+
// Root (which reaches this.props.className the same way Link does), or pass
|
|
19
|
+
// unstyled to drop the built-in css entirely.
|
|
20
|
+
export class PopMessages extends TungstenSimpleInternalStoreComponent {
|
|
21
|
+
constructor(...args) {
|
|
22
|
+
super(...args);
|
|
23
|
+
_defineProperty(this, "clientInit", () => {
|
|
24
|
+
registerPopInstance(this.__instance);
|
|
25
|
+
});
|
|
26
|
+
_defineProperty(this, "content", () => {
|
|
27
|
+
const popMessages = this.store.popMessages.sync();
|
|
28
|
+
if (popMessages.length === 0) return null;
|
|
29
|
+
const {
|
|
30
|
+
className,
|
|
31
|
+
messageClassName,
|
|
32
|
+
unstyled = false
|
|
33
|
+
} = this.props;
|
|
34
|
+
return _jsx("div", {
|
|
35
|
+
className: combineClassNames('pop-messages', className),
|
|
36
|
+
children: popMessages.map(message => _jsx("div", {
|
|
37
|
+
className: combineClassNames('pop-message', message.leaving === true && 'leaving', messageClassName),
|
|
38
|
+
css: unstyled ? undefined : messageCss + (message.leaving === true ? leavingCss : ''),
|
|
39
|
+
onClick: () => dismissPop(message.id),
|
|
40
|
+
children: message.text
|
|
41
|
+
}, message.id))
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
package/dist/defaultConfig.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultConfig.d.ts","sourceRoot":"","sources":["../src/defaultConfig.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"defaultConfig.d.ts","sourceRoot":"","sources":["../src/defaultConfig.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;CAwBS,CAAA;AAEnC,MAAM,MAAM,sBAAsB,GAAG,OAAO,aAAa,CAAA"}
|