tungsten 0.4.12 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-complete +1 -1
- package/dist/AnyComponent.d.ts.map +1 -1
- package/dist/Components.d.ts +40 -0
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +66 -77
- package/dist/DomPointer.js +1 -1
- package/dist/DomRegion.js +2 -2
- package/dist/Framework.js +1 -1
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/Instance/Instance.js +1 -1
- package/dist/RenderedContentNode.d.ts.map +1 -1
- package/dist/RenderedContentNode.js +2 -1
- package/dist/Sass.d.ts.map +1 -1
- package/dist/Sass.js +1 -0
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +4 -3
- package/dist/Servers/ProdServer.js +1 -1
- package/dist/Servers/StaticSiteServer.js +1 -1
- package/dist/Servers/loadEnvsDev.d.ts +1 -1
- package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.js +4 -2
- package/dist/Servers/routing.d.ts.map +1 -1
- package/dist/Servers/routing.js +1 -1
- package/dist/Store/Store.js +1 -1
- package/dist/Store/TypeSafeStore.js +1 -1
- package/dist/Store/makeStore.js +1 -1
- package/dist/Store/registerStore.js +1 -1
- package/dist/TElement.js +1 -1
- package/dist/TungstenApp.js +6 -2
- package/dist/_client/cjsHelpers.d.ts.map +1 -1
- package/dist/_client/cjsHelpers.js +4 -2
- package/dist/_client/client.js +0 -14
- package/dist/_client/hmr.d.ts +2 -0
- package/dist/_client/hmr.d.ts.map +1 -0
- package/dist/_client/hmr.js +65 -0
- package/dist/_client/liveReload.d.ts +2 -0
- package/dist/_client/liveReload.d.ts.map +1 -0
- package/dist/_client/liveReload.js +6 -0
- package/dist/_client/liveReloadSource.d.ts +3 -0
- package/dist/_client/liveReloadSource.d.ts.map +1 -0
- package/dist/_client/liveReloadSource.js +25 -0
- package/dist/api/getExport.d.ts.map +1 -1
- package/dist/api/getExport.js +1 -0
- package/dist/babelPlugins/BabelTransformBindDirect.js +2 -0
- package/dist/babelPlugins/BabelTransformBindVar.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentState.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.js +5 -4
- package/dist/babelPlugins/BabelTransformCssImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformCssImports.js +2 -2
- package/dist/babelPlugins/BabelTransformDependencyImportsOld.js +1 -1
- package/dist/babelPlugins/BabelTransformDeproxyState.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.js +10 -5
- package/dist/babelPlugins/BabelTransformRemoveBlocks.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.js +2 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.js +2 -1
- package/dist/babelPlugins/transformPackageImports/getWebLocationOfPackageFile.js +1 -1
- package/dist/bin/args.js +1 -1
- package/dist/bin/commands/build.js +1 -1
- package/dist/bin/commands/compileSimplePackage.js +1 -0
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +11 -3
- package/dist/bin/vendorHook.d.ts +3 -0
- package/dist/bin/vendorHook.d.ts.map +1 -0
- package/dist/bin/vendorHook.js +34 -0
- package/dist/browserStorage.js +4 -2
- package/dist/build/babel.user.common.config.d.ts +2 -0
- package/dist/build/babel.user.common.config.d.ts.map +1 -1
- package/dist/build/babel.user.common.config.js +10 -4
- package/dist/build/bundle.d.ts.map +1 -1
- package/dist/build/bundle.js +10 -1
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +40 -27
- package/dist/build/compileStyles.js +4 -4
- package/dist/build/copyAssets.js +3 -3
- package/dist/build/copyPublicFiles.js +3 -3
- package/dist/build/createClientFiles.d.ts.map +1 -1
- package/dist/build/createClientFiles.js +4 -8
- package/dist/build/frameworkStylesheets.js +1 -1
- package/dist/build/getAllSxyClientModules.d.ts.map +1 -1
- package/dist/build/getAllSxyClientModules.js +4 -28
- package/dist/build/getSxyClientPackageAliases.d.ts.map +1 -1
- package/dist/build/getSxyClientPackageAliases.js +3 -1
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
- package/dist/build/rollupExtractComponentStylesheets.js +1 -1
- package/dist/build/sassImportParser.js +2 -2
- package/dist/build/tallyBabel.d.ts +3 -0
- package/dist/build/tallyBabel.d.ts.map +1 -0
- package/dist/build/tallyBabel.js +11 -0
- package/dist/clone.js +4 -4
- package/dist/compat/context.d.ts.map +1 -1
- package/dist/compat/types.d.ts.map +1 -1
- package/dist/componentProxyHandlers.d.ts +20 -13
- package/dist/componentProxyHandlers.d.ts.map +1 -1
- package/dist/componentProxyHandlers.js +134 -94
- package/dist/components/Stylesheet.d.ts +1 -2
- package/dist/components/Stylesheet.d.ts.map +1 -1
- package/dist/components/Stylesheet.js +1 -1
- package/dist/components/bindable/BindableCheckbox.d.ts.map +1 -1
- package/dist/components/bindable/BindableInput.d.ts.map +1 -1
- package/dist/components/bindable/BindableInputTypedLegacy.d.ts.map +1 -1
- package/dist/components/bindable/BindableRadio.d.ts.map +1 -1
- package/dist/components/bindable/BindableTextarea.d.ts.map +1 -1
- package/dist/components/library/RichTextEditor/RichTextEditor.js +2 -2
- package/dist/components/library/RichTextEditor/contentTree.js +1 -1
- package/dist/concat.d.ts.map +1 -1
- package/dist/concat.js +2 -2
- package/dist/copy.d.ts.map +1 -1
- package/dist/createRoutes.d.ts +1 -1
- package/dist/createRoutes.d.ts.map +1 -1
- package/dist/env/Env.js +2 -2
- package/dist/env/getEnvSchemas.d.ts +2 -2
- package/dist/env/getEnvSchemas.d.ts.map +1 -1
- package/dist/env/getEnvSchemas.js +7 -5
- package/dist/env/windowGlobalEnvStatement.d.ts.map +1 -1
- package/dist/findProjectDir.d.ts.map +1 -1
- package/dist/findProjectDir.js +18 -4
- package/dist/findUserConfig.js +2 -2
- package/dist/foreach.js +1 -0
- package/dist/frameworkConfigSchema.js +2 -2
- package/dist/getComponent.d.ts.map +1 -1
- package/dist/getComponentDev.d.ts.map +1 -1
- package/dist/getRoutes.d.ts.map +1 -1
- package/dist/getRoutes.js +13 -22
- package/dist/getRoutesDevs.d.ts.map +1 -1
- package/dist/getStackTrace.js +1 -1
- package/dist/glob.d.ts +5 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +103 -0
- package/dist/helpers/getFetchCompatibleHeaders.js +2 -2
- package/dist/hmr/applyHmrModule.js +5 -5
- package/dist/hmr/componentIdentity.js +1 -1
- package/dist/hmr/instanceRegistry.js +2 -2
- package/dist/hooks/useReducer.d.ts.map +1 -1
- package/dist/hooks/useState.d.ts.map +1 -1
- package/dist/hooks/useState.js +2 -8
- package/dist/hydrate/hydrate.d.ts +1 -1
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +29 -25
- package/dist/hydrate/reconcileHydratedAttributes.js +2 -2
- package/dist/indexInner.d.ts +1 -1
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +1 -0
- package/dist/makeFinalConfig.d.ts.map +1 -1
- package/dist/makeFinalConfig.js +2 -2
- package/dist/markOptionSelected.js +1 -1
- package/dist/mergeConfigs.d.ts.map +1 -1
- package/dist/mergeConfigs.js +11 -2
- package/dist/mutatingFunctions.d.ts +2 -1
- package/dist/mutatingFunctions.d.ts.map +1 -1
- package/dist/mutatingFunctions.js +10 -4
- package/dist/postcssPlugins/TransformCssNames.js +2 -2
- package/dist/rawHtml/parseHtml.js +1 -1
- package/dist/render/componentNodeToRenderingTree.d.ts.map +1 -1
- package/dist/render/componentNodeToRenderingTree.js +6 -17
- package/dist/render/contentToHtml.d.ts.map +1 -1
- package/dist/render/contentToHtml.js +1 -1
- package/dist/render/getFunctionBodyAsString.d.ts.map +1 -1
- package/dist/render/getFunctionBodyAsString.js +2 -5
- package/dist/render/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +5 -34
- package/dist/render/processProps.js +2 -2
- package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
- package/dist/render/rootToHtml.d.ts.map +1 -1
- package/dist/routing/Route.js +1 -1
- package/dist/routing/RouteDataFunction.type.d.ts.map +1 -1
- package/dist/routing/RoutesWithSafeParams.js +1 -1
- package/dist/routing/WebRedirect.d.ts.map +1 -1
- package/dist/routing/compareRequestToRegex.js +2 -2
- package/dist/routing/getPathPriority.js +1 -1
- package/dist/serverRpc.d.ts.map +1 -1
- package/dist/signals/tracking.d.ts +33 -0
- package/dist/signals/tracking.d.ts.map +1 -0
- package/dist/signals/tracking.js +87 -0
- package/dist/slash.d.ts +2 -0
- package/dist/slash.d.ts.map +1 -0
- package/dist/slash.js +5 -0
- package/dist/spawnShellCommand.js +1 -1
- package/dist/staticGen/staticGen.d.ts.map +1 -1
- package/dist/staticGen/staticGen.js +9 -7
- package/dist/staticGen/staticGenFunctions.js +1 -1
- package/dist/style/jssToCss.d.ts.map +1 -1
- package/dist/style/jssToCss.js +11 -9
- package/dist/style/unusedStyles.d.ts.map +1 -1
- package/dist/testing/host.js +11 -11
- package/dist/testing/hydrateTestApp.d.ts.map +1 -1
- package/dist/testing/hydrateTestApp.js +9 -9
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/installTestStyleProcessors.js +1 -1
- package/dist/testing/loadEnv.d.ts +4 -1
- package/dist/testing/loadEnv.d.ts.map +1 -1
- package/dist/testing/loadEnv.js +2 -2
- package/dist/testing/temp/componentPackageMock.js +3 -3
- package/dist/timeProfiler.d.ts +4 -0
- package/dist/timeProfiler.d.ts.map +1 -1
- package/dist/timeProfiler.js +16 -0
- package/dist/todo.js +2 -1
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +17 -14
- package/dist/update/integrateUpdateVdomPrebuild.js +5 -5
- package/dist/warnOnFrameworkChange.js +1 -1
- package/dist/watch.js +2 -2
- package/package.json +14 -33
- package/types/modules.d.ts +0 -1
- package/vendor/babel-core.js +26 -0
- package/vendor/babel-parser.js +9 -0
- package/vendor/babel-plugin-syntax-import-assertions.js +50 -0
- package/vendor/babel-preset-react.js +872 -0
- package/vendor/babel-preset-typescript.js +26 -0
- package/vendor/babel-types.js +9 -0
- package/vendor/chalk-extensions.js +1994 -0
- package/vendor/chalk.js +647 -0
- package/vendor/chokidar.js +6889 -0
- package/vendor/chunk-1TN2rK3j.js +1218 -0
- package/vendor/chunk-1UuLTU0U.js +34 -0
- package/vendor/chunk-B_NeooyV.js +86 -0
- package/vendor/chunk-C12hSZn7.js +88 -0
- package/vendor/chunk-C3YkUGz5.js +19 -0
- package/vendor/chunk-C3fcZDjl.js +41964 -0
- package/vendor/chunk-C9FSKeSx.js +14603 -0
- package/vendor/chunk-CPArXGxa.js +14623 -0
- package/vendor/cjs-module-lexer.js +6 -0
- package/vendor/dotenv.js +412 -0
- package/vendor/express.js +40577 -0
- package/vendor/import-meta-resolve.js +2201 -0
- package/vendor/manifest.json +29 -0
- package/vendor/postcss.js +8546 -0
- package/vendor/serialize-javascript.js +293 -0
- package/vendor/sxy-lib-arrays.js +113 -0
- package/vendor/sxy-lib-object-copy.js +1781 -0
- package/vendor/sxy-lib-objects.js +156 -0
- package/vendor/sxy-lib-promises.js +47 -0
- package/vendor/sxy-package-investigator.js +202 -0
- package/vendor/valibot.js +7664 -0
- package/dist/Servers/hono/DevServerHono.d.ts +0 -2
- package/dist/Servers/hono/DevServerHono.d.ts.map +0 -1
- package/dist/Servers/hono/DevServerHono.js +0 -423
- package/dist/Servers/hono/ProdServerHono.d.ts +0 -2
- package/dist/Servers/hono/ProdServerHono.d.ts.map +0 -1
- package/dist/Servers/hono/ProdServerHono.js +0 -220
- package/dist/Servers/hono/TungstenServerHono.d.ts +0 -6
- package/dist/Servers/hono/TungstenServerHono.d.ts.map +0 -1
- package/dist/Servers/hono/TungstenServerHono.js +0 -36
- package/dist/api/ApiEndpointHono.d.ts +0 -3
- package/dist/api/ApiEndpointHono.d.ts.map +0 -1
- package/dist/api/ApiEndpointHono.js +0 -1
- package/dist/api/ApiRouteHono.d.ts +0 -7
- package/dist/api/ApiRouteHono.d.ts.map +0 -1
- package/dist/api/ApiRouteHono.js +0 -1
- package/dist/api/ApiRoutesHono.d.ts +0 -5
- package/dist/api/ApiRoutesHono.d.ts.map +0 -1
- package/dist/api/ApiRoutesHono.js +0 -1
- package/dist/api/getApiRoutesHono.d.ts +0 -6
- package/dist/api/getApiRoutesHono.d.ts.map +0 -1
- package/dist/api/getApiRoutesHono.js +0 -14
- package/dist/build/compilePackages.d.ts +0 -2
- package/dist/build/compilePackages.d.ts.map +0 -1
- package/dist/build/compilePackages.js +0 -89
- package/dist/build/findRequiredUserModule.d.ts +0 -2
- package/dist/build/findRequiredUserModule.d.ts.map +0 -1
- package/dist/build/findRequiredUserModule.js +0 -36
- package/dist/build/processPackage.d.ts +0 -4
- package/dist/build/processPackage.d.ts.map +0 -1
- package/dist/build/processPackage.js +0 -91
- package/dist/build/tallyBabelPlugins.d.ts +0 -3
- package/dist/build/tallyBabelPlugins.d.ts.map +0 -1
- package/dist/build/tallyBabelPlugins.js +0 -63
- package/dist/testing/loadEnvSetup.d.ts +0 -2
- package/dist/testing/loadEnvSetup.d.ts.map +0 -1
- package/dist/testing/loadEnvSetup.js +0 -7
- package/sxy-loader.config.js +0 -7
package/dist/hydrate/hydrate.js
CHANGED
|
@@ -9,7 +9,7 @@ import { DomRegion } from '../DomRegion.js';
|
|
|
9
9
|
import { FunctionElement } from '../FunctionComponentStandIn.js';
|
|
10
10
|
import { getStyledContentFromFunctionComponent } from '../getStyledContentFromFunctionComponent.js';
|
|
11
11
|
import { StringIsHtmlEvent, htmlEvents } from '../htmlEvents.js';
|
|
12
|
-
import { TungstenStatefulComponent } from "../Components.js";
|
|
12
|
+
import { TungstenStatefulComponent, TungstenSignalsComponent } from "../Components.js";
|
|
13
13
|
import { TungstenError } from '../TungstenError.js';
|
|
14
14
|
import { Instance } from '../Instance/Instance.js';
|
|
15
15
|
import { validChildren } from '../validChildren.js';
|
|
@@ -17,7 +17,6 @@ import { setCurrentComponent } from '../hooks/setCurrentComponent.js';
|
|
|
17
17
|
import { clearCurrentComponent } from '../hooks/clearCurrentComponent.js';
|
|
18
18
|
import { htmlEventHandlerKey } from '../htmlEventHandlerKey.js';
|
|
19
19
|
import { packageNameCapitalized } from '../settings.js';
|
|
20
|
-
import { todo } from '../todo.js';
|
|
21
20
|
import { throwError } from '../throwError.js';
|
|
22
21
|
import { $contentNull } from '../symbols.js';
|
|
23
22
|
import { $props, $routeData, $routeParams, $type } from '../contentNodeSymbols.js';
|
|
@@ -107,7 +106,7 @@ routes) {
|
|
|
107
106
|
} = matchedRouteInfo;
|
|
108
107
|
if (key !== null) {
|
|
109
108
|
if (!(key in routes)) throwError('hydrationRouting', `Route ${key} not found in routes ${routes}`);
|
|
110
|
-
const content = routes[key].content; // eslint-disable-line
|
|
109
|
+
const content = routes[key].content; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- we just checked
|
|
111
110
|
return {
|
|
112
111
|
...matchedRouteInfo,
|
|
113
112
|
content
|
|
@@ -124,11 +123,11 @@ export async function hydrateRootComponent(instance, RootComponent, domPointer,
|
|
|
124
123
|
// route data comes through the store instead - so the default reproduces that. A test
|
|
125
124
|
// harness hydrating an arbitrary component (see testing/hydrateTestApp.ts) passes its own.
|
|
126
125
|
props = {},
|
|
127
|
-
// eslint-disable-line
|
|
126
|
+
// eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- default only reached when Props is empty, same as the hardcoded {} this replaces
|
|
128
127
|
routeParams, routeData) {
|
|
129
128
|
debug('hydrateRootComponent');
|
|
130
129
|
// matches createTungstenRootComponent's identical cast, the create-path equivalent of this function
|
|
131
|
-
// eslint-disable-next-line
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
132
131
|
const element = new RootComponent({
|
|
133
132
|
props,
|
|
134
133
|
routeParams,
|
|
@@ -145,7 +144,7 @@ routeParams, routeData) {
|
|
|
145
144
|
if (openingNode.nodeType !== Node.COMMENT_NODE) {
|
|
146
145
|
throwError('hydrateFunctionComponent', 'expected to find a comment, but instead found ' + openingNode.toString() + ' type ' + openingNode.nodeType.toString());
|
|
147
146
|
}
|
|
148
|
-
//const openingComment = openingNode as Comment // eslint-disable-line
|
|
147
|
+
//const openingComment = openingNode as Comment // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
149
148
|
domPointer.increment();
|
|
150
149
|
const renderedTree = await hydrateNode(content, element, domPointer, instance, meta);
|
|
151
150
|
debug('rendered tree after hydration', renderedTree);
|
|
@@ -153,7 +152,7 @@ routeParams, routeData) {
|
|
|
153
152
|
if (closingNode.nodeType !== Node.COMMENT_NODE) {
|
|
154
153
|
throwError('hydrateFunctionComponent', 'expected to find a comment, but instead found ' + closingNode.toString() + ' type ' + closingNode.nodeType.toString());
|
|
155
154
|
}
|
|
156
|
-
//const closingComment = closingNode as Comment // eslint-disable-line
|
|
155
|
+
//const closingComment = closingNode as Comment // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
157
156
|
domPointer.increment();
|
|
158
157
|
const domIndexCount = domPointer.index - domIndexStart;
|
|
159
158
|
element.__domRegion = new DomRegion(domPointer.parent, domIndexStart, domIndexCount);
|
|
@@ -176,6 +175,8 @@ function handleRootTitle(rootElement) {
|
|
|
176
175
|
if (typeof rootElement.title === 'function') {
|
|
177
176
|
if (rootElement instanceof TungstenStatefulComponent) {
|
|
178
177
|
rootElement.__instance.setDefaultTitle(rootElement.title(rootElement.props, rootElement.state).toString());
|
|
178
|
+
} else if (rootElement instanceof TungstenSignalsComponent) {
|
|
179
|
+
rootElement.__instance.setDefaultTitle(rootElement.title(rootElement.props, rootElement.signals).toString());
|
|
179
180
|
} else {
|
|
180
181
|
rootElement.__instance.setDefaultTitle(rootElement.title(rootElement.props, undefined).toString());
|
|
181
182
|
}
|
|
@@ -198,7 +199,7 @@ async function hydrateClassComponent(node, parentElement, domPointer, instance,
|
|
|
198
199
|
if (openingNode.nodeType !== Node.COMMENT_NODE) {
|
|
199
200
|
throwError('hydrateFunctionComponent', 'expected to find a comment, but instead found ' + openingNode.toString() + ' type ' + openingNode.nodeType.toString());
|
|
200
201
|
}
|
|
201
|
-
const openingComment = openingNode; // eslint-disable-line
|
|
202
|
+
const openingComment = openingNode; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
202
203
|
domPointer.increment();
|
|
203
204
|
//// InstantiateClassComponent???
|
|
204
205
|
const element = new Component({
|
|
@@ -236,7 +237,7 @@ async function hydrateClassComponent(node, parentElement, domPointer, instance,
|
|
|
236
237
|
if (closingNode.nodeType !== Node.COMMENT_NODE) {
|
|
237
238
|
throwError('hydrateFunctionComponent', 'expected to find a comment, but instead found ' + closingNode.toString() + ' type ' + closingNode.nodeType.toString());
|
|
238
239
|
}
|
|
239
|
-
const closingComment = closingNode; // eslint-disable-line
|
|
240
|
+
const closingComment = closingNode; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
240
241
|
domPointer.increment();
|
|
241
242
|
const domIndexCount = domPointer.index - domIndexStart;
|
|
242
243
|
debug('DOM region', domPointer.parent, domIndexStart, domIndexCount);
|
|
@@ -261,7 +262,7 @@ async function hydrateClassComponent(node, parentElement, domPointer, instance,
|
|
|
261
262
|
if (closingNode.nodeType !== Node.COMMENT_NODE) {
|
|
262
263
|
throwError('hydrateFunctionComponent', 'expected to find a comment, but instead found ' + closingNode.toString() + ' type ' + closingNode.nodeType.toString());
|
|
263
264
|
}
|
|
264
|
-
const closingComment = closingNode; // eslint-disable-line
|
|
265
|
+
const closingComment = closingNode; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
265
266
|
domPointer.increment();
|
|
266
267
|
const domIndexCount = domPointer.index - domIndexStart;
|
|
267
268
|
debug('DOM region', domPointer.parent, domIndexStart, domIndexCount);
|
|
@@ -347,14 +348,14 @@ async function hydrateFunctionComponent(node, parentElement, domPointer, instanc
|
|
|
347
348
|
if (openingNode.nodeType !== Node.COMMENT_NODE) {
|
|
348
349
|
throwError('hydrateFunctionComponent', 'expected to find a comment, but instead found ' + openingNode.toString() + ' type ' + openingNode.nodeType.toString());
|
|
349
350
|
}
|
|
350
|
-
const openingComment = openingNode; // eslint-disable-line
|
|
351
|
+
const openingComment = openingNode; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
351
352
|
domPointer.increment();
|
|
352
353
|
const renderedTree = await hydrateNode(content, functionComponentStandIn, domPointer, instance, meta);
|
|
353
354
|
const closingNode = domPointer.get();
|
|
354
355
|
if (closingNode.nodeType !== Node.COMMENT_NODE) {
|
|
355
356
|
throwError('hydrateFunctionComponent', 'expected to find a comment, but instead found ' + closingNode.toString() + ' type ' + closingNode.nodeType.toString());
|
|
356
357
|
}
|
|
357
|
-
const closingComment = closingNode; // eslint-disable-line
|
|
358
|
+
const closingComment = closingNode; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
358
359
|
domPointer.increment();
|
|
359
360
|
const domIndexCount = domPointer.index - domIndexStart;
|
|
360
361
|
functionComponentStandIn.__domRegion = new DomRegion(domPointer.parent, domIndexStart, domIndexCount);
|
|
@@ -463,11 +464,11 @@ async function hydrateNodeSingle(node, parentElement, domPointer, instance, meta
|
|
|
463
464
|
instance.persistentHeadChildren = persistentHeadChildren;
|
|
464
465
|
debug('head node - skipping, because we add a lot to this during initial render, breaking matching');
|
|
465
466
|
domPointer.increment();
|
|
466
|
-
//return { [$type]: $head, domNode: node as HTMLElement } // eslint-disable-line
|
|
467
|
+
//return { [$type]: $head, domNode: node as HTMLElement } // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
467
468
|
return {
|
|
468
469
|
[$type]: 'head',
|
|
469
470
|
domNode: node
|
|
470
|
-
}; // eslint-disable-line
|
|
471
|
+
}; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
471
472
|
}
|
|
472
473
|
if (ContentNodeIsHtml(node)) {
|
|
473
474
|
// HTML el
|
|
@@ -621,15 +622,18 @@ function hydrateAttributes(node, domNode, meta) {
|
|
|
621
622
|
debug(`adding ${key} event handler for`, node);
|
|
622
623
|
debug('domNode', domNode);
|
|
623
624
|
const eventName = htmlEvents[key];
|
|
624
|
-
//domNode.addEventListener(eventName as keyof HTMLElementEventMap, eventListener)
|
|
625
|
-
todo('addAttributes() warning - ensure type safety of event name'); //
|
|
626
|
-
todo('addAttributes() warning - ensure type safety of event listener'); //
|
|
627
625
|
const handler = node[$props][key];
|
|
626
|
+
// JSX types the prop as a handler; a non-function is a spread of foreign props or a raw
|
|
627
|
+
// content tree, and addEventListener would throw a bare TypeError for it
|
|
628
|
+
if (isDev && typeof handler !== 'function') {
|
|
629
|
+
const tag = typeof node[$type] === 'string' ? node[$type] : '(component)';
|
|
630
|
+
throwError('hydrate', `<${tag}> ${key} is ${typeof handler}, not a function`);
|
|
631
|
+
}
|
|
628
632
|
// // if its a button without type="submit", prevent default to stop it from submitting forms
|
|
629
633
|
// const handler = (key === 'onClick' && node[$type] === 'button' && node[$props].type !== 'submit')
|
|
630
634
|
// ? (event: Event) => { event.preventDefault(); return (node[$props][key] as EventListener)(event) }
|
|
631
635
|
// : node[$props][key] as EventListener
|
|
632
|
-
domNode.addEventListener(eventName, handler);
|
|
636
|
+
domNode.addEventListener(eventName, handler); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- a function is all the DOM checks
|
|
633
637
|
domNode[htmlEventHandlerKey(eventName)] = handler;
|
|
634
638
|
} else if (key === 'bind' && ContentNodeElementIsHtml(node)) {
|
|
635
639
|
const eventName = 'input';
|
|
@@ -673,7 +677,7 @@ function hydrateAttributes(node, domNode, meta) {
|
|
|
673
677
|
} else if (key === 'bindChecked' && ContentNodeElementIsHtml(node)) {
|
|
674
678
|
// not checking that el is bindable, don't think its necessary
|
|
675
679
|
debug('binding checked');
|
|
676
|
-
const [bindObject, bindKey] = node[$props][key]; // eslint-disable-line
|
|
680
|
+
const [bindObject, bindKey] = node[$props][key]; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
677
681
|
domNode.checked = bindObject[bindKey];
|
|
678
682
|
const eventName = 'input';
|
|
679
683
|
//let handler
|
|
@@ -684,7 +688,7 @@ function hydrateAttributes(node, domNode, meta) {
|
|
|
684
688
|
// }
|
|
685
689
|
// } else {
|
|
686
690
|
const handler = event => {
|
|
687
|
-
bindObject[bindKey] = event.target.checked; // eslint-disable-line
|
|
691
|
+
bindObject[bindKey] = event.target.checked; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
688
692
|
};
|
|
689
693
|
//}
|
|
690
694
|
domNode.addEventListener(eventName, handler);
|
|
@@ -695,23 +699,23 @@ function hydrateAttributes(node, domNode, meta) {
|
|
|
695
699
|
} else if (key === 'bindRadio' && ContentNodeElementIsHtml(node)) {
|
|
696
700
|
// not checking that el is bindable, don't think its necessary
|
|
697
701
|
debug('binding radio');
|
|
698
|
-
const [bindObject, bindKey] = node[$props][key]; // eslint-disable-line
|
|
702
|
+
const [bindObject, bindKey] = node[$props][key]; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
699
703
|
domNode.checked = node[$props].value === bindObject[bindKey];
|
|
700
704
|
const eventName = 'change';
|
|
701
705
|
//let handler
|
|
702
706
|
// if ('filter' in node[$props]) {
|
|
703
|
-
// const filterFunc = node[$props].filter as FilterCheckedFunc<any, any> // eslint-disable-line
|
|
707
|
+
// const filterFunc = node[$props].filter as FilterCheckedFunc<any, any> // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
704
708
|
// handler = async (event: HTMLElementEventMap['change']) => {
|
|
705
709
|
// console.log('radio changed handler')
|
|
706
|
-
// bindObject[bindKey] = await filterFunc((event.target as HTMLCheckedBindableElement).checked, event) // eslint-disable-line
|
|
710
|
+
// bindObject[bindKey] = await filterFunc((event.target as HTMLCheckedBindableElement).checked, event) // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
707
711
|
// }
|
|
708
712
|
// } else {
|
|
709
713
|
const handler = event => {
|
|
710
714
|
console.log('bound radio changed 1');
|
|
711
|
-
bindObject[bindKey] = event.target.value; // eslint-disable-line
|
|
715
|
+
bindObject[bindKey] = event.target.value; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
712
716
|
};
|
|
713
717
|
//}
|
|
714
|
-
// eslint-disable-next-line
|
|
718
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
715
719
|
domNode.addEventListener(eventName, handler);
|
|
716
720
|
domNode['onchange'] = handler;
|
|
717
721
|
domNode[htmlEventHandlerKey(eventName)] = handler;
|
|
@@ -16,13 +16,13 @@ function attributeValue(name, value) {
|
|
|
16
16
|
function removeAttribute(domNode, name) {
|
|
17
17
|
// checked is both an attribute and live state, and the attribute alone only
|
|
18
18
|
// sets the default. Clear both, or the box stays ticked.
|
|
19
|
-
// eslint-disable-next-line
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
20
20
|
if (name === 'checked') domNode.checked = false;
|
|
21
21
|
domNode.removeAttribute(name);
|
|
22
22
|
}
|
|
23
23
|
function setAttribute(domNode, name, value) {
|
|
24
24
|
domNode.setAttribute(name, value);
|
|
25
|
-
// eslint-disable-next-line
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
26
26
|
if (name === 'checked') domNode.checked = true;
|
|
27
27
|
}
|
|
28
28
|
/**
|
package/dist/indexInner.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './TungstenAppOld.js';
|
|
2
2
|
export { TungstenSimpleComponent, TungstenSimpleComponent as SimpleComponent, // static component
|
|
3
3
|
TungstenStatefulComponent, TungstenStatefulComponent as StatefulComponent, // stateful component
|
|
4
|
-
TungstenBaseSimpleStoreComponent, TungstenBaseSimpleStoreComponent as BaseSimpleStoreComponent, TungstenBaseStatefulStoreComponent, TungstenBaseStatefulStoreComponent as BaseStatefulStoreComponent, } from './Components.jsx';
|
|
4
|
+
TungstenSignalsComponent as __TungstenSignalsComponent, TungstenSignalsComponent as __SignalsComponent, TungstenBaseSimpleStoreComponent, TungstenBaseSimpleStoreComponent as BaseSimpleStoreComponent, TungstenBaseStatefulStoreComponent, TungstenBaseStatefulStoreComponent as BaseStatefulStoreComponent, } from './Components.jsx';
|
|
5
5
|
export * from './alive.js';
|
|
6
6
|
export * from './appOutput.js';
|
|
7
7
|
export * from './AssignedStyle.js';
|
package/dist/indexInner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexInner.d.ts","sourceRoot":"","sources":["../src/indexInner.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAA;AACnC,OAAO,EACH,uBAAuB,EAAE,uBAAuB,IAAI,eAAe,EAAE,mBAAmB;AACxF,yBAAyB,EAAE,yBAAyB,IAAI,iBAAiB,EAAE,qBAAqB;
|
|
1
|
+
{"version":3,"file":"indexInner.d.ts","sourceRoot":"","sources":["../src/indexInner.ts"],"names":[],"mappings":"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"}
|
package/dist/indexInner.js
CHANGED
|
@@ -4,6 +4,7 @@ export { TungstenSimpleComponent, TungstenSimpleComponent as SimpleComponent,
|
|
|
4
4
|
// static component
|
|
5
5
|
TungstenStatefulComponent, TungstenStatefulComponent as StatefulComponent,
|
|
6
6
|
// stateful component
|
|
7
|
+
TungstenSignalsComponent as __TungstenSignalsComponent, TungstenSignalsComponent as __SignalsComponent,
|
|
7
8
|
//TungstenBaseStoreComponent as TungstenBaseStoreComponent, TungstenBaseStoreComponent as BaseStoreComponent,
|
|
8
9
|
TungstenBaseSimpleStoreComponent, TungstenBaseSimpleStoreComponent as BaseSimpleStoreComponent, TungstenBaseStatefulStoreComponent, TungstenBaseStatefulStoreComponent as BaseStatefulStoreComponent } from "./Components.js";
|
|
9
10
|
// other
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeFinalConfig.d.ts","sourceRoot":"","sources":["../src/makeFinalConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeFinalConfig.d.ts","sourceRoot":"","sources":["../src/makeFinalConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,eAAe,EAAE,uBAAuB,EAAE,wBAAwB,EACrE,MAAM,sBAAsB,CAAA;AAG7B,wBAAgB,eAAe,CAC3B,UAAU,EAAE,eAAe,EAC3B,SAAS,GAAE,wBAAwB,GAAG,IAAW,GAClD,uBAAuB,CAiBzB"}
|
package/dist/makeFinalConfig.js
CHANGED
|
@@ -3,14 +3,14 @@ export function makeFinalConfig(userConfig, overrides = null) {
|
|
|
3
3
|
const finalConfig = structuredClone(defaultConfig);
|
|
4
4
|
for (const key in userConfig) {
|
|
5
5
|
//if (Object.prototype.hasOwnProperty.call(userConfig, key)) { // github co-pilot suggestion, unsure if needed
|
|
6
|
-
finalConfig[key] = userConfig[key]; // eslint-disable-line
|
|
6
|
+
finalConfig[key] = userConfig[key]; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
7
7
|
//}
|
|
8
8
|
}
|
|
9
9
|
// an override left undefined keeps the user config / default value
|
|
10
10
|
for (const key in overrides) {
|
|
11
11
|
const value = overrides[key];
|
|
12
12
|
if (value === undefined) continue;
|
|
13
|
-
finalConfig[key] = value; // eslint-disable-line
|
|
13
|
+
finalConfig[key] = value; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
14
14
|
}
|
|
15
15
|
return finalConfig;
|
|
16
16
|
}
|
|
@@ -10,7 +10,7 @@ function collectOptionText(node) {
|
|
|
10
10
|
}
|
|
11
11
|
if (typeof node === 'string' || typeof node === 'number') return String(node);
|
|
12
12
|
if (typeof node !== 'object') return '';
|
|
13
|
-
const element = node; // eslint-disable-line
|
|
13
|
+
const element = node; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- content and rendering nodes are both { [$type], [$props] }
|
|
14
14
|
if (element[$type] === 'script' || typeof element[$props]?.__html === 'string') return '';
|
|
15
15
|
return collectOptionText(element[$props]?.children);
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeConfigs.d.ts","sourceRoot":"","sources":["../src/mergeConfigs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mergeConfigs.d.ts","sourceRoot":"","sources":["../src/mergeConfigs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAc3D,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAU3H"}
|
package/dist/mergeConfigs.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
1
|
+
// plain data is copied, anything else (functions, class instances) kept by reference - config
|
|
2
|
+
// carries babel plugins, which structuredClone would reject
|
|
3
|
+
function cloneDeep(value) {
|
|
4
|
+
if (Array.isArray(value)) return value.map(cloneDeep); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- array in, array out
|
|
5
|
+
if (typeof value === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype) {
|
|
6
|
+
const copy = {};
|
|
7
|
+
for (const [key, entry] of Object.entries(value)) copy[key] = cloneDeep(entry);
|
|
8
|
+
return copy; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- same shape as the input
|
|
9
|
+
}
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
3
12
|
export function mergeConfigs(config1, config2) {
|
|
4
13
|
const newConfig = cloneDeep(config1);
|
|
5
14
|
for (const key in config2) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export declare const arrayMutatingFunctions: readonly ["push", "pop", "shift", "unshift", "sort", "splice", "reverse"];
|
|
1
|
+
export declare const arrayMutatingFunctions: readonly ["push", "pop", "shift", "unshift", "sort", "splice", "reverse", "fill", "copyWithin"];
|
|
2
2
|
type ArrayMutatingFunctions = typeof arrayMutatingFunctions[number];
|
|
3
|
+
export declare const arrayMutatingFunctionInsertsFrom: Partial<Record<ArrayMutatingFunctions, number>>;
|
|
3
4
|
export declare const mapMutatingFunctions: readonly ["set", "delete", "clear"];
|
|
4
5
|
type MapMutatingFunctions = typeof mapMutatingFunctions[number];
|
|
5
6
|
export declare const setMutatingFunctions: readonly ["add", "delete", "clear"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutatingFunctions.d.ts","sourceRoot":"","sources":["../src/mutatingFunctions.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"mutatingFunctions.d.ts","sourceRoot":"","sources":["../src/mutatingFunctions.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,sBAAsB,iGAEzB,CAAA;AACV,KAAK,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAA;AAGnE,eAAO,MAAM,gCAAgC,EAAE,OAAO,CAAC,MAAM,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAE5F,CAAA;AAED,eAAO,MAAM,oBAAoB,qCAAsC,CAAA;AACvE,KAAK,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAA;AAE/D,eAAO,MAAM,oBAAoB,qCAAsC,CAAA;AACvE,KAAK,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAA;AAE/D,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,sBAAsB,CAGrF;AAED,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,oBAAoB,CAGjF;AAED,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,oBAAoB,CAGjF"}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
export const arrayMutatingFunctions = ['push', 'pop', 'shift', 'unshift', 'sort', 'splice', 'reverse'];
|
|
1
|
+
export const arrayMutatingFunctions = ['push', 'pop', 'shift', 'unshift', 'sort', 'splice', 'reverse', 'fill', 'copyWithin'];
|
|
2
|
+
// index of the first argument that becomes an element, for the mutators that insert values
|
|
3
|
+
export const arrayMutatingFunctionInsertsFrom = {
|
|
4
|
+
unshift: 0,
|
|
5
|
+
splice: 2,
|
|
6
|
+
fill: 0
|
|
7
|
+
};
|
|
2
8
|
export const mapMutatingFunctions = ['set', 'delete', 'clear'];
|
|
3
9
|
export const setMutatingFunctions = ['add', 'delete', 'clear'];
|
|
4
10
|
export function KeyIsArrayMutatingFunction(key) {
|
|
5
|
-
// eslint-disable-next-line
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- weird TS issue, won't let us search in a const array
|
|
6
12
|
return arrayMutatingFunctions.includes(key);
|
|
7
13
|
}
|
|
8
14
|
export function KeyIsMapMutatingFunction(key) {
|
|
9
|
-
// eslint-disable-next-line
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- weird TS issue, won't let us search in a const array
|
|
10
16
|
return mapMutatingFunctions.includes(key);
|
|
11
17
|
}
|
|
12
18
|
export function KeyIsSetMutatingFunction(key) {
|
|
13
|
-
// eslint-disable-next-line
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- weird TS issue, won't let us search in a const array
|
|
14
20
|
return setMutatingFunctions.includes(key);
|
|
15
21
|
}
|
|
@@ -178,11 +178,11 @@ export const TransformCssNames = opts => {
|
|
|
178
178
|
const pseudoClassRegex = /:([a-zA-Z0-9-_]+)(?:\((.*)\))?/;
|
|
179
179
|
const results = pseudoClassRegex.exec(content);
|
|
180
180
|
if (results === null) throwError('TransformCssNames -> walkRules', 'pseudo-class selector did not match pseudo-class regex');
|
|
181
|
-
const label = results[1]; // eslint-disable-line
|
|
181
|
+
const label = results[1]; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- typings are incorrect
|
|
182
182
|
// if it is :i(xxx) or :ignore(xxx), pass through the internal part
|
|
183
183
|
// otherwise pass all through unaffected
|
|
184
184
|
if (label === 'i' || label === 'ignore') {
|
|
185
|
-
const inner = results[2]; // eslint-disable-line
|
|
185
|
+
const inner = results[2]; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- typings are incorrect
|
|
186
186
|
if (inner !== undefined && inner !== '') {
|
|
187
187
|
newSelectors.push(inner);
|
|
188
188
|
}
|
|
@@ -134,7 +134,7 @@ export function parseHtml(html, options = {}) {
|
|
|
134
134
|
const current = () => stack[stack.length - 1];
|
|
135
135
|
const close = downTo => {
|
|
136
136
|
while (stack.length > downTo) {
|
|
137
|
-
const element = stack.pop(); // eslint-disable-line
|
|
137
|
+
const element = stack.pop(); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- guarded by the loop
|
|
138
138
|
if (element.removal === 'drop') continue;
|
|
139
139
|
if (element.removal === 'unwrap') current().children.push(...element.children);else current().children.push(toContentNode(element));
|
|
140
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentNodeToRenderingTree.d.ts","sourceRoot":"","sources":["../../src/render/componentNodeToRenderingTree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EACH,KAAK,sBAAsB,EAG9B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAqD,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAGhH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAKjD,wBAAsB,4BAA4B,CAC9C,aAAa,EAAE,oBAAoB,EAAE,eAAe,EAAE,YAAY,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,GACjH,OAAO,CAAC,sBAAsB,CAAC,
|
|
1
|
+
{"version":3,"file":"componentNodeToRenderingTree.d.ts","sourceRoot":"","sources":["../../src/render/componentNodeToRenderingTree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EACH,KAAK,sBAAsB,EAG9B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAqD,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAGhH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAKjD,wBAAsB,4BAA4B,CAC9C,aAAa,EAAE,oBAAoB,EAAE,eAAe,EAAE,YAAY,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,GACjH,OAAO,CAAC,sBAAsB,CAAC,CAmCjC"}
|
|
@@ -10,24 +10,13 @@ export async function componentNodeToRenderingTree(componentNode, parentComponen
|
|
|
10
10
|
const render = componentNode[$type].render;
|
|
11
11
|
//console.log('render', render)
|
|
12
12
|
if (render) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
// ComponentRenderInfo only knows the client location; the object form adds a placeholder
|
|
14
|
+
const placeholder = typeof render === 'object' && 'placeholder' in render ? render.placeholder : null;
|
|
15
|
+
const placeholderTree = await contentTreeToRenderingTree(placeholder, parentComponent, instance, noEscape);
|
|
16
|
+
if (ContentNodeComponentIsClassComponent(componentNode)) {
|
|
17
|
+
return makeRenderingNodeClassComponentFromContentNodeClassComponent(componentNode, null, placeholderTree, true);
|
|
17
18
|
} else {
|
|
18
|
-
|
|
19
|
-
if (typeof render === 'object' && 'placeholder') {
|
|
20
|
-
// not sure what this is
|
|
21
|
-
placeholder = render.placeholder;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (location === 'client') {
|
|
25
|
-
const placeholderTree = await contentTreeToRenderingTree(placeholder, parentComponent, instance, noEscape);
|
|
26
|
-
if (ContentNodeComponentIsClassComponent(componentNode)) {
|
|
27
|
-
return makeRenderingNodeClassComponentFromContentNodeClassComponent(componentNode, null, placeholderTree, true);
|
|
28
|
-
} else {
|
|
29
|
-
return makeRenderingNodeFunctionComponentFromContentNodeFunctionComponent(componentNode, null, placeholderTree, true);
|
|
30
|
-
}
|
|
19
|
+
return makeRenderingNodeFunctionComponentFromContentNodeFunctionComponent(componentNode, null, placeholderTree, true);
|
|
31
20
|
}
|
|
32
21
|
}
|
|
33
22
|
//console.log('componentRenderToTree component', component)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentToHtml.d.ts","sourceRoot":"","sources":["../../src/render/contentToHtml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"contentToHtml.d.ts","sourceRoot":"","sources":["../../src/render/contentToHtml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAIvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAG9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAGrE,wBAAsB,aAAa,CAC/B,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EACpE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EACxC,MAAM,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,YAAY,EACnE,iBAAiB,GAAE,sBAAkC,EAAE,GAAG,UAAQ,GACnE,OAAO,CAAC,MAAM,CAAC,CAuDjB"}
|
|
@@ -4,7 +4,7 @@ import { RenderingNodeIsElement } from '../RenderingNode.js';
|
|
|
4
4
|
import { contentTreeToRenderingTree } from './contentTreeToRenderingTree.js';
|
|
5
5
|
import { cliWarn } from 'tungsten/cliOutput.js';
|
|
6
6
|
export async function contentToHtml(compilationInfo, clientImportAliases, content, instance, config, siteBasePathOverride, tungstenPublicEnv = undefined, dev = false) {
|
|
7
|
-
// const rootNode = { // eslint-disable-line
|
|
7
|
+
// const rootNode = { // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
8
8
|
// [$type]: RootComponentClass, // TypeScript needs some help to understand that { type: AnyComponentType }
|
|
9
9
|
// [$props]: {} // is equivalent to { type: ClassComponentTypeAny } | { type: FunctionComponentTypeAny } (type names simplified here)
|
|
10
10
|
// } as ContentNodeComponent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFunctionBodyAsString.d.ts","sourceRoot":"","sources":["../../src/render/getFunctionBodyAsString.ts"],"names":[],"mappings":"AAEA,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,QAAQ,UAcrD;AAID,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"getFunctionBodyAsString.d.ts","sourceRoot":"","sources":["../../src/render/getFunctionBodyAsString.ts"],"names":[],"mappings":"AAEA,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,QAAQ,UAcrD;AAID,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAYlE"}
|
|
@@ -17,11 +17,8 @@ export function getFunctionBodyAsString(func) {
|
|
|
17
17
|
export function getArrowFunctionBody(func) {
|
|
18
18
|
// Not sure about this RegEx, probably from google
|
|
19
19
|
const regex = /^(?:\s*\(?(?:\s*\w*\s*,?\s*)*\)?\s*?=>\s*){?([\s\S]*)}?$/;
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
const firstPass = matches[1];
|
|
20
|
+
const firstPass = func.toString().match(regex)?.[1];
|
|
21
|
+
if (firstPass === undefined) return null;
|
|
25
22
|
// Needed because the RegExp doesn't handle the last '}'.
|
|
26
23
|
const secondPass = (firstPass.match(/{/g) || []).length === (firstPass.match(/}/g) || []).length - 1 ? firstPass.slice(0, firstPass.lastIndexOf('}')) : firstPass;
|
|
27
24
|
return secondPass;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processHead.d.ts","sourceRoot":"","sources":["../../src/render/processHead.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,OAAO,EAAE,oBAAoB,EAAqB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"processHead.d.ts","sourceRoot":"","sources":["../../src/render/processHead.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,OAAO,EAAE,oBAAoB,EAAqB,MAAM,qBAAqB,CAAA;AAQ7E,wBAAgB,WAAW,CACvB,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,EAAE,QAAQ,QA6IrB"}
|
|
@@ -3,7 +3,6 @@ import { clientFolder, componentCssFolder, componentCssFile } from '../settings.
|
|
|
3
3
|
import { addImportMap } from './addImportMap.js';
|
|
4
4
|
import { $props, $type } from '../contentNodeSymbols.js';
|
|
5
5
|
import { windowGlobalEnvStatement } from 'tungsten/env/windowGlobalEnvStatement.js';
|
|
6
|
-
import { frameworkDestLocation } from '../build/frameworkDestLocation.js';
|
|
7
6
|
import { devErrorPageClearRetryScript } from '../Servers/devErrorPageAutoRetry.js';
|
|
8
7
|
// process the tree returned by the root component
|
|
9
8
|
// doing things like ensuring there is are html and head elements,
|
|
@@ -87,44 +86,16 @@ export function processHead(headNode, headData) {
|
|
|
87
86
|
}
|
|
88
87
|
};
|
|
89
88
|
headNode[$props].children.unshift(clearErrorRetryScriptNode);
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
// framework's traced dependency graph makes the package-copying step that serves
|
|
94
|
-
// framework code to the browser throw (it requires every import specifier to be
|
|
95
|
-
// statically known so it can be rewritten/copied). Keeping this logic as untraced text
|
|
96
|
-
// sidesteps that. applyHmrModule.js itself has no dynamic imports, so it's safely
|
|
97
|
-
// reachable via a normal static import elsewhere (see hydrate.tsx) and gets copied
|
|
98
|
-
// there, then loaded here by computed URL. See tungsten/docs/hmr.md.
|
|
99
|
-
// Tier 1 (hmr: 'reload', or nothing left for Tier 2 to do): always full-reload. A
|
|
100
|
-
// simple, independent branch from Tier 2's logic - restored as an explicit config value
|
|
101
|
-
// so it's available as a one-line escape hatch if Tier 2 itself is misbehaving.
|
|
102
|
-
// The server sends its bootId as the first event on every connection (see
|
|
103
|
-
// handleLiveReloadStream). If sessionStorage already holds a different one, this
|
|
104
|
-
// connection is a reconnect to a process that restarted since the page loaded (e.g. via
|
|
105
|
-
// tungsten devmon on a framework rebuild) - EventSource retries silently on its own, so
|
|
106
|
-
// this is the only reliable signal that the page is now stale and needs reloading.
|
|
107
|
-
const bootIdReloadSnippet = `es.addEventListener('boot',function(ev){` + `var bootId=JSON.parse(ev.data).bootId;` + `var key='__tungsten_boot_id__';` + `var prev=sessionStorage.getItem(key);` + `sessionStorage.setItem(key,bootId);` + `if(prev!==null&&prev!==bootId){location.reload()}` + `});`;
|
|
108
|
-
const tier1OnlyScript = `(function(){` + `var es=new EventSource('${siteBasePath}/__tungsten_live_reload__');` + bootIdReloadSnippet + `es.addEventListener('css',function(){location.reload()});` + `es.addEventListener('js',function(){location.reload()});` + `})();`;
|
|
109
|
-
// Tier 2: attempt an in-place component/CSS hot-swap before falling back to a full
|
|
110
|
-
// reload. See tungsten/docs/hmr.md.
|
|
111
|
-
const tier2Script = `(function(){` + `var es=new EventSource('${siteBasePath}/__tungsten_live_reload__');` + `function fullReload(reason){console.info('[tungsten-hmr] full reload:',reason);location.reload()}` + `es.addEventListener('boot',function(ev){` + `var bootId=JSON.parse(ev.data).bootId;` + `var key='__tungsten_boot_id__';` + `var prev=sessionStorage.getItem(key);` + `sessionStorage.setItem(key,bootId);` + `if(prev!==null&&prev!==bootId){fullReload('dev server restarted')}` + `});` + `function loadHmr(){return import('${frameworkDestLocation}/hmr/applyHmrModule.js')}`
|
|
112
|
-
// CSS has no state to preserve, so re-applying it is always safe: refreshStylesheets()
|
|
113
|
-
// inserts the new link and only removes the old one once it's loaded, so there's no
|
|
114
|
-
// gap where nothing is applied (a plain href swap can produce a visible flash).
|
|
115
|
-
+ `es.addEventListener('css',function(){` + `console.info('[tungsten-hmr] css change, refreshing stylesheets');` + `loadHmr().then(function(hmr){return Promise.all(hmr.refreshStylesheets())})` + `.catch(function(e){console.error('[tungsten-hmr] stylesheet refresh failed',e)});` + `});` + `es.addEventListener('js',function(ev){` + `var payload;` + `try{payload=JSON.parse(ev.data)}catch(e){fullReload('bad payload');return}` + `var files=(payload&&payload.files)||[];` + `if(files.length===0){fullReload('no files in payload');return}` + `console.info('[tungsten-hmr] fetching',files);` + `loadHmr().then(function(hmr){`
|
|
116
|
-
// a component's own inline style block piggybacks on this same JS pipeline (it
|
|
117
|
-
// lives in the .tsx/.jsx source, not a separate .css file), so refresh stylesheets
|
|
118
|
-
// here too rather than only on a dedicated 'css' event - independently of the
|
|
119
|
-
// component swap below, so a stylesheet load error doesn't force a full reload.
|
|
120
|
-
+ `Promise.all(hmr.refreshStylesheets())` + `.catch(function(e){console.error('[tungsten-hmr] stylesheet refresh failed',e)});` + `return Promise.all(files.map(function(f){return import(f+'?t='+Date.now())}))` + `.then(function(modules){` + `return Promise.all(modules.map(function(m,i){return hmr.applyHmrModule(m,files[i])}))` + `})` + `})` + `.then(function(results){` + `console.info('[tungsten-hmr] results',results);` + `if(results.some(function(r){return r&&r.orphaned})){fullReload('a component export was renamed or removed');return}` + `if(!results.some(function(r){return r&&r.matched}))fullReload('no matching live component found')` + `})` + `.catch(function(e){console.error('[tungsten-hmr] swap failed',e);fullReload('error during swap')});` + `});` + `})();`;
|
|
121
|
-
// hmr === false: no live-reload script at all (auto-refresh fully disabled).
|
|
89
|
+
// Live reload / HMR: real modules in _client, copied untraced into .client by
|
|
90
|
+
// createClientFiles (see the note atop _client/hmr.ts). hmr === true runs Tier 2 (hmr.js),
|
|
91
|
+
// 'reload' the always-full-reload Tier 1 (liveReload.js), false injects nothing.
|
|
122
92
|
if (hmr !== false) {
|
|
123
93
|
const liveReloadScriptNode = {
|
|
124
94
|
[$type]: 'script',
|
|
125
95
|
[$props]: {
|
|
126
96
|
'data--t-internal': undefined,
|
|
127
|
-
|
|
97
|
+
type: 'module',
|
|
98
|
+
src: `${siteBasePath}/${clientFolder}/${hmr === true ? 'hmr.js' : 'liveReload.js'}`
|
|
128
99
|
}
|
|
129
100
|
};
|
|
130
101
|
headNode[$props].children.unshift(liveReloadScriptNode);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { filter as objectFilter } from 'sxy-lib/objects.js';
|
|
2
2
|
import { jssToCss } from '../style/jssToCss.js';
|
|
3
3
|
import { StringIsHtmlEvent } from '../htmlEvents.js';
|
|
4
4
|
// Props that are instructions to Tungsten rather than HTML attributes.
|
|
@@ -12,7 +12,7 @@ import { StringIsHtmlEvent } from '../htmlEvents.js';
|
|
|
12
12
|
const omitProps = ['ref', '__zoneHtml', '__opaque', 'dangerouslySetInnerHTML'];
|
|
13
13
|
//// !!!! We need to handle bind here
|
|
14
14
|
export function processProps(props) {
|
|
15
|
-
props =
|
|
15
|
+
props = objectFilter(props, key => {
|
|
16
16
|
return !omitProps.includes(key) && !StringIsHtmlEvent(key);
|
|
17
17
|
});
|
|
18
18
|
// if ('className' in props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderingTreeToHtml.d.ts","sourceRoot":"","sources":["../../src/render/renderingTreeToHtml.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAY7C,OAAO,EACH,KAAK,aAAa,EAAE,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"renderingTreeToHtml.d.ts","sourceRoot":"","sources":["../../src/render/renderingTreeToHtml.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAY7C,OAAO,EACH,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAE7C,MAAM,qBAAqB,CAAA;AAU5B,wBAAsB,mBAAmB,CACrC,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAC1D,UAAU,EAAE,iBAAiB,GAAG,IAAI,GACrC,OAAO,CAAC,MAAM,CAAC,CA8JjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootToHtml.d.ts","sourceRoot":"","sources":["../../src/render/rootToHtml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"rootToHtml.d.ts","sourceRoot":"","sources":["../../src/render/rootToHtml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAGrE,wBAAsB,UAAU,CAC5B,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EACpE,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,uBAAuB,EACzF,oBAAoB,EAAE,YAAY,EAAE,iBAAiB,GAAE,sBAAkC,EACzF,GAAG,UAAQ,GACZ,OAAO,CAAC,MAAM,CAAC,CAWjB"}
|
package/dist/routing/Route.js
CHANGED
|
@@ -36,7 +36,7 @@ export {};
|
|
|
36
36
|
// __T_routeParams: routeParams,
|
|
37
37
|
// __T_routeData: routeData,
|
|
38
38
|
// __T_location: location
|
|
39
|
-
// } = this.props as InternalRouteProps // eslint-disable-line
|
|
39
|
+
// } = this.props as InternalRouteProps // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- using the type assertion to hide internal workings from users
|
|
40
40
|
// if (typeof children === 'function') {
|
|
41
41
|
// const r = children(routeParams, routeData, location)
|
|
42
42
|
// //console.log('r1', r)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteDataFunction.type.d.ts","sourceRoot":"","sources":["../../src/routing/RouteDataFunction.type.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,MAAM,EAAE,QAAQ,IACvD,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"RouteDataFunction.type.d.ts","sourceRoot":"","sources":["../../src/routing/RouteDataFunction.type.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,MAAM,EAAE,QAAQ,IACvD,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,KAClE,OAAO,CAAC,QAAQ,GAAG,eAAe,GAAG,WAAW,CAAC,CAAA"}
|
|
@@ -26,7 +26,7 @@ export {};
|
|
|
26
26
|
// ] satisfies [string, unknown][]
|
|
27
27
|
// type O = ArrayToObject<typeof a>
|
|
28
28
|
// function makeRoutes<Routes extends readonly RouteWithSafeParams<any, any>[]>(routes: Routes): Expand<RoutesArrayToObject<Routes>> {
|
|
29
|
-
// return arrayMapToObject(routes, (route => [route.path, route])) as RoutesArrayToObject<Routes> // eslint-disable-line
|
|
29
|
+
// return arrayMapToObject(routes, (route => [route.path, route])) as RoutesArrayToObject<Routes> // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
30
30
|
// }
|
|
31
31
|
// // function makeRoute<Path extends string>(path: Path, route: RouteWithSafeParams<Path, any>): [Path, RouteWithSafeParams<Path, any>] {
|
|
32
32
|
// // return [path, route]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebRedirect.d.ts","sourceRoot":"","sources":["../../src/routing/WebRedirect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"WebRedirect.d.ts","sourceRoot":"","sources":["../../src/routing/WebRedirect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,MAAM,MAAM,GAAG,GAAG,MAAM,MAAM,MAAM,EAAE,GAAG,MAAM,CAAA;AAErD,qBAAa,WAAW;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,YAAY,CAAA;gBACN,EAAE,EAAE,MAAM,EAAE,IAAI,GAAE,YAAkB;CAInD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mapToObject } from 'sxy-lib/arrays.js';
|
|
2
2
|
export function compareRequestToRegex(request, regex, keys) {
|
|
3
3
|
const matches = regex.exec(request);
|
|
4
4
|
const success = matches !== null;
|
|
5
|
-
const params = success ?
|
|
5
|
+
const params = success ? mapToObject(keys, (key, index) => [key, matches[index + 1]]) : mapToObject(keys, key => [key, undefined]);
|
|
6
6
|
return {
|
|
7
7
|
success,
|
|
8
8
|
params: params // working around the TS issues with records/mapped types. [key: string]: A and [Key in Type]?: A are inconsistent, second turns A into A | undefined. come back to this later
|