@solidjs/router
Advanced tools
+25
-15
@@ -609,5 +609,6 @@ import { isServer, getRequestEvent, createComponent as createComponent$1, memo, delegateEvents, spread, mergeProps, template } from '@solidjs/web'; | ||
| const basePath = resolvePath("", options.base || ""); | ||
| const initialSource = untrack(source); | ||
| if (basePath === undefined) { | ||
| throw new Error(`${basePath} is not a valid base path`); | ||
| } else if (basePath && !source().value) { | ||
| } else if (basePath && !initialSource.value) { | ||
| setSource({ | ||
@@ -859,13 +860,25 @@ value: basePath, | ||
| const createRouterComponent = router => props => { | ||
| const createRouterComponent = router => function IntegratedRouter(props) { | ||
| const { | ||
| base | ||
| } = props; | ||
| const routeDefs = children(() => props.children); | ||
| const branches = createMemo(() => createBranches(routeDefs(), props.base || "")); | ||
| base, | ||
| singleFlight, | ||
| transformUrl, | ||
| root, | ||
| rootPreload, | ||
| routeChildren | ||
| } = untrack(() => ({ | ||
| base: props.base, | ||
| singleFlight: props.singleFlight, | ||
| transformUrl: props.transformUrl, | ||
| root: props.root, | ||
| rootPreload: props.rootPreload, | ||
| routeChildren: props.children | ||
| })); | ||
| const routeDefs = children(() => routeChildren); | ||
| const branches = createMemo(() => createBranches(routeDefs(), base || "")); | ||
| let context; | ||
| const routerState = createRouterContext(router, branches, () => context, { | ||
| base, | ||
| singleFlight: props.singleFlight, | ||
| transformUrl: props.transformUrl | ||
| singleFlight, | ||
| transformUrl | ||
| }); | ||
@@ -878,8 +891,4 @@ router.create && router.create(routerState); | ||
| routerState: routerState, | ||
| get root() { | ||
| return props.root; | ||
| }, | ||
| get preload() { | ||
| return props.rootPreload; | ||
| }, | ||
| root: root, | ||
| preload: rootPreload, | ||
| get children() { | ||
@@ -979,3 +988,4 @@ return [memo(() => (context = getOwner()) && null), createComponent$1(Routes, { | ||
| }, undefined); | ||
| return createOutlet(() => routeStates() && root)(); | ||
| const outlet = createOutlet(() => routeStates() && root); | ||
| return memo(outlet); | ||
| } | ||
@@ -982,0 +992,0 @@ const createOutlet = child => { |
@@ -5,15 +5,22 @@ /*@refresh skip*/ | ||
| import { createBranches, createRouteContext, createRouterContext, getIntent, getRouteMatches, RouteContextObj, RouterContextObj, setInPreloadFn } from "../routing.js"; | ||
| export const createRouterComponent = (router) => (props) => { | ||
| const { base } = props; | ||
| const routeDefs = children(() => props.children); | ||
| const branches = createMemo(() => createBranches(routeDefs(), props.base || "")); | ||
| export const createRouterComponent = (router) => function IntegratedRouter(props) { | ||
| const { base, singleFlight, transformUrl, root, rootPreload, routeChildren } = untrack(() => ({ | ||
| base: props.base, | ||
| singleFlight: props.singleFlight, | ||
| transformUrl: props.transformUrl, | ||
| root: props.root, | ||
| rootPreload: props.rootPreload, | ||
| routeChildren: props.children | ||
| })); | ||
| const routeDefs = children(() => routeChildren); | ||
| const branches = createMemo(() => createBranches(routeDefs(), base || "")); | ||
| let context; | ||
| const routerState = createRouterContext(router, branches, () => context, { | ||
| base, | ||
| singleFlight: props.singleFlight, | ||
| transformUrl: props.transformUrl, | ||
| singleFlight, | ||
| transformUrl, | ||
| }); | ||
| router.create && router.create(routerState); | ||
| return (<RouterContextObj value={routerState}> | ||
| <Root routerState={routerState} root={props.root} preload={props.rootPreload}> | ||
| <Root routerState={routerState} root={root} preload={rootPreload}> | ||
| {(context = getOwner()) && null} | ||
@@ -95,3 +102,4 @@ <Routes routerState={routerState} branches={branches()}/> | ||
| }, undefined); | ||
| return createOutlet(() => routeStates() && root)(); | ||
| const outlet = createOutlet(() => routeStates() && root); | ||
| return <>{outlet()}</>; | ||
| } | ||
@@ -98,0 +106,0 @@ const createOutlet = (child) => { |
+2
-1
@@ -357,6 +357,7 @@ import { flush, runWithOwner } from "solid-js"; | ||
| const basePath = resolvePath("", options.base || ""); | ||
| const initialSource = untrack(source); | ||
| if (basePath === undefined) { | ||
| throw new Error(`${basePath} is not a valid base path`); | ||
| } | ||
| else if (basePath && !source().value) { | ||
| else if (basePath && !initialSource.value) { | ||
| setSource({ value: basePath, replace: true, scroll: false }); | ||
@@ -363,0 +364,0 @@ } |
+1
-1
@@ -9,3 +9,3 @@ { | ||
| "license": "MIT", | ||
| "version": "0.17.0-next.0", | ||
| "version": "0.17.0-next.1", | ||
| "homepage": "https://github.com/solidjs/solid-router#readme", | ||
@@ -12,0 +12,0 @@ "repository": { |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
189056
0.32%4175
0.46%