one 1.1.297 → 1.1.299
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/Root.js.map +1 -1
- package/dist/cjs/Root.native.js.map +1 -1
- package/dist/cjs/cleanUrl.js +9 -2
- package/dist/cjs/cleanUrl.js.map +1 -1
- package/dist/cjs/cleanUrl.native.js +5 -2
- package/dist/cjs/cleanUrl.native.js.map +2 -2
- package/dist/cjs/vite/replaceLoader.js +7 -1
- package/dist/cjs/vite/replaceLoader.js.map +1 -1
- package/dist/cjs/vite/replaceLoader.native.js +7 -1
- package/dist/cjs/vite/replaceLoader.native.js.map +1 -1
- package/dist/esm/Root.js.map +1 -1
- package/dist/esm/Root.mjs.map +1 -1
- package/dist/esm/Root.native.js +110 -104
- package/dist/esm/Root.native.js.map +6 -1
- package/dist/esm/Route.native.js +12 -10
- package/dist/esm/Route.native.js.map +6 -1
- package/dist/esm/cleanUrl.js +9 -2
- package/dist/esm/cleanUrl.js.map +1 -1
- package/dist/esm/cleanUrl.mjs +7 -2
- package/dist/esm/cleanUrl.mjs.map +1 -1
- package/dist/esm/cleanUrl.native.js +16 -13
- package/dist/esm/cleanUrl.native.js.map +6 -1
- package/dist/esm/cli/label-process.native.js +5 -4
- package/dist/esm/cli/label-process.native.js.map +6 -1
- package/dist/esm/cli/main.native.js +8 -13
- package/dist/esm/cli/main.native.js.map +6 -1
- package/dist/esm/cli/prebuild.native.js +5 -5
- package/dist/esm/cli/prebuild.native.js.map +6 -1
- package/dist/esm/cli/run.native.js +21 -28
- package/dist/esm/cli/run.native.js.map +6 -1
- package/dist/esm/cli.native.js +119 -148
- package/dist/esm/cli.native.js.map +6 -1
- package/dist/esm/clientLoaderResolver.native.js +9 -6
- package/dist/esm/clientLoaderResolver.native.js.map +6 -1
- package/dist/esm/config.native.js +12 -11
- package/dist/esm/config.native.js.map +6 -1
- package/dist/esm/constants.native.js +7 -5
- package/dist/esm/constants.native.js.map +6 -1
- package/dist/esm/createApp.native.js +13 -9
- package/dist/esm/createApp.native.js.map +6 -1
- package/dist/esm/createHandleRequest.native.js +55 -64
- package/dist/esm/createHandleRequest.native.js.map +6 -1
- package/dist/esm/createRoute.native.js +16 -16
- package/dist/esm/createRoute.native.js.map +6 -1
- package/dist/esm/fallbackViews/Sitemap.native.js +6 -3
- package/dist/esm/fallbackViews/Sitemap.native.js.map +6 -1
- package/dist/esm/fallbackViews/Unmatched.native.js +5 -3
- package/dist/esm/fallbackViews/Unmatched.native.js.map +6 -1
- package/dist/esm/fork/NavigationContainer.native.js +24 -31
- package/dist/esm/fork/NavigationContainer.native.js.map +6 -1
- package/dist/esm/fork/createMemoryHistory.native.js +99 -115
- package/dist/esm/fork/createMemoryHistory.native.js.map +6 -1
- package/dist/esm/fork/extractPathFromURL.native.js +16 -15
- package/dist/esm/fork/extractPathFromURL.native.js.map +6 -1
- package/dist/esm/fork/findFocusedRoute.native.js +6 -5
- package/dist/esm/fork/findFocusedRoute.native.js.map +6 -1
- package/dist/esm/fork/getPathFromState.native.js +127 -140
- package/dist/esm/fork/getPathFromState.native.js.map +6 -1
- package/dist/esm/fork/getStateFromPath.native.js +292 -288
- package/dist/esm/fork/getStateFromPath.native.js.map +6 -1
- package/dist/esm/fork/useLinking.native.js +70 -61
- package/dist/esm/fork/useLinking.native.js.map +6 -1
- package/dist/esm/fork/validatePathConfig.native.js +15 -9
- package/dist/esm/fork/validatePathConfig.native.js.map +6 -1
- package/dist/esm/getLinkingConfig.native.js +11 -6
- package/dist/esm/getLinkingConfig.native.js.map +6 -1
- package/dist/esm/getReactNavigationConfig.native.js +28 -20
- package/dist/esm/getReactNavigationConfig.native.js.map +6 -1
- package/dist/esm/getRoutes.native.js +249 -229
- package/dist/esm/getRoutes.native.js.map +6 -1
- package/dist/esm/getURL.native.js +4 -4
- package/dist/esm/getURL.native.js.map +6 -1
- package/dist/esm/head/Head.android.js +5 -3
- package/dist/esm/head/Head.android.js.map +6 -1
- package/dist/esm/head/Head.ios.js +144 -132
- package/dist/esm/head/Head.ios.js.map +6 -1
- package/dist/esm/head/Head.native.js +7 -7
- package/dist/esm/head/Head.native.js.map +6 -1
- package/dist/esm/head/HeadModule.native.js +6 -6
- package/dist/esm/head/HeadModule.native.js.map +6 -1
- package/dist/esm/head/index.native.js +2 -2
- package/dist/esm/head/index.native.js.map +6 -1
- package/dist/esm/head/types.native.js +1 -2
- package/dist/esm/head/types.native.js.map +6 -1
- package/dist/esm/head/url.native.js +10 -8
- package/dist/esm/head/url.native.js.map +6 -1
- package/dist/esm/hooks.native.js +53 -34
- package/dist/esm/hooks.native.js.map +6 -1
- package/dist/esm/imperative-api.native.js +9 -6
- package/dist/esm/imperative-api.native.js.map +6 -1
- package/dist/esm/import-mode/index.android.js +4 -3
- package/dist/esm/import-mode/index.android.js.map +6 -1
- package/dist/esm/import-mode/index.ios.js +4 -3
- package/dist/esm/import-mode/index.ios.js.map +6 -1
- package/dist/esm/import-mode/index.native.js +3 -1
- package/dist/esm/import-mode/index.native.js.map +6 -1
- package/dist/esm/index.native.js +65 -27
- package/dist/esm/index.native.js.map +6 -1
- package/dist/esm/interfaces/router.native.js +4 -2
- package/dist/esm/interfaces/router.native.js.map +6 -1
- package/dist/esm/layouts/Drawer.native.js +7 -6
- package/dist/esm/layouts/Drawer.native.js.map +6 -1
- package/dist/esm/layouts/Stack.native.js +7 -6
- package/dist/esm/layouts/Stack.native.js.map +6 -1
- package/dist/esm/layouts/Tabs.native.js +42 -39
- package/dist/esm/layouts/Tabs.native.js.map +6 -1
- package/dist/esm/layouts/withLayoutContext.native.js +51 -48
- package/dist/esm/layouts/withLayoutContext.native.js.map +6 -1
- package/dist/esm/link/Link.native.js +62 -53
- package/dist/esm/link/Link.native.js.map +6 -1
- package/dist/esm/link/Redirect.native.js +8 -9
- package/dist/esm/link/Redirect.native.js.map +6 -1
- package/dist/esm/link/href.native.js +28 -27
- package/dist/esm/link/href.native.js.map +6 -1
- package/dist/esm/link/linking.native.js +51 -40
- package/dist/esm/link/linking.native.js.map +6 -1
- package/dist/esm/link/path.native.js +28 -19
- package/dist/esm/link/path.native.js.map +6 -1
- package/dist/esm/link/useLinkTo.native.js +22 -20
- package/dist/esm/link/useLinkTo.native.js.map +6 -1
- package/dist/esm/link/useLoadedNavigation.native.js +30 -23
- package/dist/esm/link/useLoadedNavigation.native.js.map +6 -1
- package/dist/esm/matchers.native.js +16 -3
- package/dist/esm/matchers.native.js.map +6 -1
- package/dist/esm/platform.native.js +4 -2
- package/dist/esm/platform.native.js.map +6 -1
- package/dist/esm/polyfills-mobile.native.js +4 -5
- package/dist/esm/polyfills-mobile.native.js.map +6 -1
- package/dist/esm/polyfills-server.native.js +1 -1
- package/dist/esm/polyfills-server.native.js.map +6 -1
- package/dist/esm/render.native.js +3 -1
- package/dist/esm/render.native.js.map +6 -1
- package/dist/esm/router/RouterStore.native.js +1 -2
- package/dist/esm/router/RouterStore.native.js.map +6 -1
- package/dist/esm/router/constants.native.js +4 -2
- package/dist/esm/router/constants.native.js.map +6 -1
- package/dist/esm/router/getNormalizedStatePath.native.js +18 -17
- package/dist/esm/router/getNormalizedStatePath.native.js.map +6 -1
- package/dist/esm/router/lastAction.native.js +10 -9
- package/dist/esm/router/lastAction.native.js.map +6 -1
- package/dist/esm/router/router.native.js +135 -114
- package/dist/esm/router/router.native.js.map +6 -1
- package/dist/esm/router/serverLocationContext.native.js +4 -2
- package/dist/esm/router/serverLocationContext.native.js.map +6 -1
- package/dist/esm/router/useInitializeOneRouter.native.js +8 -5
- package/dist/esm/router/useInitializeOneRouter.native.js.map +6 -1
- package/dist/esm/serve.native.js +77 -104
- package/dist/esm/serve.native.js.map +6 -1
- package/dist/esm/server/createRoutesManifest.native.js +14 -11
- package/dist/esm/server/createRoutesManifest.native.js.map +6 -1
- package/dist/esm/server/getServerManifest.native.js +61 -67
- package/dist/esm/server/getServerManifest.native.js.map +6 -1
- package/dist/esm/server-render.native.js +9 -10
- package/dist/esm/server-render.native.js.map +6 -1
- package/dist/esm/sortRoutes.native.js +27 -17
- package/dist/esm/sortRoutes.native.js.map +6 -1
- package/dist/esm/typed-routes/generateRouteTypes.native.js +10 -11
- package/dist/esm/typed-routes/generateRouteTypes.native.js.map +6 -1
- package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js +38 -37
- package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js.map +6 -1
- package/dist/esm/types.native.js +1 -2
- package/dist/esm/types.native.js.map +6 -1
- package/dist/esm/useFocusEffect.native.js +25 -22
- package/dist/esm/useFocusEffect.native.js.map +6 -1
- package/dist/esm/useLoader.native.js +50 -50
- package/dist/esm/useLoader.native.js.map +6 -1
- package/dist/esm/useNavigation.native.js +23 -19
- package/dist/esm/useNavigation.native.js.map +6 -1
- package/dist/esm/useScreens.native.js +143 -160
- package/dist/esm/useScreens.native.js.map +6 -1
- package/dist/esm/useViteRoutes.native.js +25 -28
- package/dist/esm/useViteRoutes.native.js.map +6 -1
- package/dist/esm/utils/assertIsReady.native.js +6 -3
- package/dist/esm/utils/assertIsReady.native.js.map +6 -1
- package/dist/esm/utils/dynamicImport.native.js +5 -3
- package/dist/esm/utils/dynamicImport.native.js.map +6 -1
- package/dist/esm/utils/existsAsync.native.js +6 -4
- package/dist/esm/utils/existsAsync.native.js.map +6 -1
- package/dist/esm/utils/getPageExport.native.js +12 -11
- package/dist/esm/utils/getPageExport.native.js.map +6 -1
- package/dist/esm/utils/globDir.native.js +5 -3
- package/dist/esm/utils/globDir.native.js.map +6 -1
- package/dist/esm/utils/hashString.native.js +4 -2
- package/dist/esm/utils/hashString.native.js.map +6 -1
- package/dist/esm/utils/isResponse.native.js +4 -2
- package/dist/esm/utils/isResponse.native.js.map +6 -1
- package/dist/esm/utils/isStatus.native.js +4 -2
- package/dist/esm/utils/isStatus.native.js.map +6 -1
- package/dist/esm/utils/promiseWithResolvers.native.js +7 -7
- package/dist/esm/utils/promiseWithResolvers.native.js.map +6 -1
- package/dist/esm/utils/rand.native.js +5 -3
- package/dist/esm/utils/rand.native.js.map +6 -1
- package/dist/esm/utils/redirect.native.js +7 -5
- package/dist/esm/utils/redirect.native.js.map +6 -1
- package/dist/esm/utils/removeSearch.native.js +4 -2
- package/dist/esm/utils/removeSearch.native.js.map +6 -1
- package/dist/esm/utils/removeUndefined.native.js +6 -3
- package/dist/esm/utils/removeUndefined.native.js.map +6 -1
- package/dist/esm/utils/requireResolve.native.js +4 -2
- package/dist/esm/utils/requireResolve.native.js.map +6 -1
- package/dist/esm/utils/url.native.js +6 -2
- package/dist/esm/utils/url.native.js.map +6 -1
- package/dist/esm/utils/weakKey.native.js +11 -10
- package/dist/esm/utils/weakKey.native.js.map +6 -1
- package/dist/esm/utils/weakMemo.native.js +8 -8
- package/dist/esm/utils/weakMemo.native.js.map +6 -1
- package/dist/esm/views/EmptyRoute.native.js +5 -3
- package/dist/esm/views/EmptyRoute.native.js.map +6 -1
- package/dist/esm/views/ErrorBoundary.native.js +5 -8
- package/dist/esm/views/ErrorBoundary.native.js.map +6 -1
- package/dist/esm/views/LoadProgressBar.native.js +58 -57
- package/dist/esm/views/LoadProgressBar.native.js.map +6 -1
- package/dist/esm/views/Navigator.native.js +54 -71
- package/dist/esm/views/Navigator.native.js.map +6 -1
- package/dist/esm/views/PreloadLinks.native.js +3 -1
- package/dist/esm/views/PreloadLinks.native.js.map +6 -1
- package/dist/esm/views/RootErrorBoundary.native.js +39 -29
- package/dist/esm/views/RootErrorBoundary.native.js.map +6 -1
- package/dist/esm/views/Screen.native.js +12 -12
- package/dist/esm/views/Screen.native.js.map +6 -1
- package/dist/esm/views/ScrollRestoration.native.js +27 -27
- package/dist/esm/views/ScrollRestoration.native.js.map +6 -1
- package/dist/esm/views/Try.native.js +40 -37
- package/dist/esm/views/Try.native.js.map +6 -1
- package/dist/esm/vite/build.native.js +260 -295
- package/dist/esm/vite/build.native.js.map +6 -1
- package/dist/esm/vite/clientTreeShakePlugin.native.js +34 -33
- package/dist/esm/vite/clientTreeShakePlugin.native.js.map +6 -1
- package/dist/esm/vite/constants.native.js +6 -4
- package/dist/esm/vite/constants.native.js.map +6 -1
- package/dist/esm/vite/createFileSystemRouter.native.js +99 -130
- package/dist/esm/vite/createFileSystemRouter.native.js.map +6 -1
- package/dist/esm/vite/customNodeExternals.native.js +9 -10
- package/dist/esm/vite/customNodeExternals.native.js.map +6 -1
- package/dist/esm/vite/ensureTsConfig.native.js +7 -5
- package/dist/esm/vite/ensureTsConfig.native.js.map +6 -1
- package/dist/esm/vite/findDepsToOptimize.native.js +27 -19
- package/dist/esm/vite/findDepsToOptimize.native.js.map +6 -1
- package/dist/esm/vite/fixDependenciesPlugin.native.js +5 -3
- package/dist/esm/vite/fixDependenciesPlugin.native.js.map +6 -1
- package/dist/esm/vite/generateTypesForRoutes.native.js +9 -9
- package/dist/esm/vite/generateTypesForRoutes.native.js.map +6 -1
- package/dist/esm/vite/getManifest.native.js +6 -4
- package/dist/esm/vite/getManifest.native.js.map +6 -1
- package/dist/esm/vite/headers.native.js +11 -5
- package/dist/esm/vite/headers.native.js.map +6 -1
- package/dist/esm/vite/loadEnv.native.js +7 -6
- package/dist/esm/vite/loadEnv.native.js.map +6 -1
- package/dist/esm/vite/makePluginWebOnly.native.js +9 -5
- package/dist/esm/vite/makePluginWebOnly.native.js.map +6 -1
- package/dist/esm/vite/one.native.js +142 -127
- package/dist/esm/vite/one.native.js.map +6 -1
- package/dist/esm/vite/removeReactNativeWebAnimatedPlugin.native.js +14 -11
- package/dist/esm/vite/removeReactNativeWebAnimatedPlugin.native.js.map +6 -1
- package/dist/esm/vite/replaceLoader.js +7 -1
- package/dist/esm/vite/replaceLoader.js.map +1 -1
- package/dist/esm/vite/replaceLoader.mjs +5 -1
- package/dist/esm/vite/replaceLoader.mjs.map +1 -1
- package/dist/esm/vite/replaceLoader.native.js +13 -10
- package/dist/esm/vite/replaceLoader.native.js.map +6 -1
- package/dist/esm/vite/resolveAPIRequest.native.js +44 -47
- package/dist/esm/vite/resolveAPIRequest.native.js.map +6 -1
- package/dist/esm/vite/server.native.js +5 -4
- package/dist/esm/vite/server.native.js.map +6 -1
- package/dist/esm/vite/types.native.js +1 -2
- package/dist/esm/vite/types.native.js.map +6 -1
- package/dist/esm/vite/virtualEntryPlugin.native.js +21 -16
- package/dist/esm/vite/virtualEntryPlugin.native.js.map +6 -1
- package/dist/esm/vite/vitePluginSsrCss.native.js +61 -50
- package/dist/esm/vite/vitePluginSsrCss.native.js.map +6 -1
- package/dist/esm/vite.native.js +19 -10
- package/dist/esm/vite.native.js.map +6 -1
- package/dist/esm/zero/getQueryKey.native.js +5 -3
- package/dist/esm/zero/getQueryKey.native.js.map +6 -1
- package/dist/esm/zero/isZeroQuery.native.js +4 -2
- package/dist/esm/zero/isZeroQuery.native.js.map +6 -1
- package/dist/esm/zero/resolveQuery.native.js +9 -8
- package/dist/esm/zero/resolveQuery.native.js.map +6 -1
- package/dist/esm/zero/subscribeToQuery.native.js +5 -3
- package/dist/esm/zero/subscribeToQuery.native.js.map +6 -1
- package/dist/esm/zero/types.native.js +1 -2
- package/dist/esm/zero/types.native.js.map +6 -1
- package/dist/esm/zero/useQuery.native.js +12 -12
- package/dist/esm/zero/useQuery.native.js.map +6 -1
- package/dist/esm/zero/useQueryZero.native.js +24 -20
- package/dist/esm/zero/useQueryZero.native.js.map +6 -1
- package/dist/esm/zero.native.js +9 -5
- package/dist/esm/zero.native.js.map +6 -1
- package/package.json +7 -7
- package/src/Root.tsx +20 -16
- package/src/cleanUrl.ts +15 -1
- package/src/vite/replaceLoader.ts +7 -1
- package/types/cleanUrl.d.ts.map +1 -1
- package/types/vite/replaceLoader.d.ts.map +1 -1
@@ -1,64 +1,67 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import React from "react";
|
3
|
-
import { useContextKey } from "../Route
|
4
|
-
import { useSortedScreens } from "../useScreens
|
5
|
-
import { Screen } from "../views/Screen
|
3
|
+
import { useContextKey } from "../Route";
|
4
|
+
import { useSortedScreens } from "../useScreens";
|
5
|
+
import { Screen } from "../views/Screen";
|
6
6
|
function useFilterScreenChildren(children) {
|
7
|
-
var {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
{
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
7
|
+
var { isCustomNavigator, contextKey } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (
|
8
|
+
/** Used for sending developer hints */
|
9
|
+
{}
|
10
|
+
);
|
11
|
+
return React.useMemo(function() {
|
12
|
+
var customChildren = [], screens = React.Children.map(children, function(child) {
|
13
|
+
if (/* @__PURE__ */ React.isValidElement(child) && child && child.type === Screen) {
|
14
|
+
if (!child.props.name)
|
15
|
+
throw new Error(`<Screen /> component in \`default export\` at \`app${contextKey}/_layout\` must have a \`name\` prop when used as a child of a Layout Route.`);
|
16
|
+
if (process.env.NODE_ENV !== "production" && [
|
17
|
+
"children",
|
18
|
+
"component",
|
19
|
+
"getComponent"
|
20
|
+
].some(function(key) {
|
21
|
+
return key in child.props;
|
22
|
+
}))
|
23
|
+
throw new Error(`<Screen /> component in \`default export\` at \`app${contextKey}/_layout\` must not have a \`children\`, \`component\`, or \`getComponent\` prop when used as a child of a Layout Route`);
|
24
|
+
return child.props;
|
25
|
+
}
|
26
|
+
isCustomNavigator ? customChildren.push(child) : console.warn(`Layout children must be of type Screen, all other children are ignored. To use custom children, create a custom <Layout />. Update Layout Route at: "app${contextKey}/_layout"`);
|
27
|
+
});
|
24
28
|
if (process.env.NODE_ENV !== "production") {
|
25
|
-
var names = screens?.map(function
|
29
|
+
var names = screens?.map(function(screen) {
|
26
30
|
return screen.name;
|
27
31
|
});
|
28
|
-
if (names && new Set(names).size !== names.length)
|
32
|
+
if (names && new Set(names).size !== names.length)
|
33
|
+
throw new Error("Screen names must be unique: " + names);
|
29
34
|
}
|
30
35
|
return {
|
31
36
|
screens,
|
32
37
|
children: customChildren
|
33
38
|
};
|
34
|
-
}, [
|
39
|
+
}, [
|
40
|
+
children,
|
41
|
+
contextKey,
|
42
|
+
isCustomNavigator
|
43
|
+
]);
|
35
44
|
}
|
36
45
|
function withLayoutContext(Nav, processor) {
|
37
|
-
var Navigator = /* @__PURE__ */React.forwardRef(function
|
38
|
-
var {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
contextKey
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
// @ts-expect-error
|
52
|
-
// biome-ignore lint/correctness/noChildrenProp: <explanation>
|
53
|
-
/* @__PURE__ */
|
54
|
-
_jsx(Nav, {
|
55
|
-
...props,
|
56
|
-
id: contextKey,
|
57
|
-
ref,
|
58
|
-
children: sorted
|
59
|
-
}) : null;
|
46
|
+
var Navigator = /* @__PURE__ */ React.forwardRef(function(param, ref) {
|
47
|
+
var { children: userDefinedChildren, ...props } = param, contextKey = useContextKey(), { screens } = useFilterScreenChildren(userDefinedChildren, {
|
48
|
+
contextKey
|
49
|
+
}), processed = processor ? processor(screens ?? []) : screens, sorted = useSortedScreens(processed ?? []);
|
50
|
+
return sorted.length ? (
|
51
|
+
// @ts-expect-error
|
52
|
+
// biome-ignore lint/correctness/noChildrenProp: <explanation>
|
53
|
+
/* @__PURE__ */ _jsx(Nav, {
|
54
|
+
...props,
|
55
|
+
id: contextKey,
|
56
|
+
ref,
|
57
|
+
children: sorted
|
58
|
+
})
|
59
|
+
) : null;
|
60
60
|
});
|
61
61
|
return Navigator.Screen = Screen, Navigator;
|
62
62
|
}
|
63
|
-
export {
|
64
|
-
|
63
|
+
export {
|
64
|
+
useFilterScreenChildren,
|
65
|
+
withLayoutContext
|
66
|
+
};
|
67
|
+
//# sourceMappingURL=withLayoutContext.js.map
|
@@ -1 +1,6 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/layouts/Users/n8/one/packages/one/src/layouts/withLayoutContext.tsx"],
|
4
|
+
"mappings": ";AAC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cAAAA,GAEb,EAAES,QAAO,IAAKN,wBAAwBkC,qBAAqB;MAC/D/B;IACF,CAAA,GAEMgC,YAAYL,YAAYA,UAAUxB,WAAW,CAAA,CAAE,IAAIA,SAEnD8B,SAAStC,iBAAiBqC,aAAa,CAAA,CAAE;AAG/C,WAAKC,OAAOT;;;MAOV,qBAACE,KAAAA;QAAK,GAAGjB;QAAOyB,IAAIlC;QAAY8B;QAAUhC,UAAUmC;;QAN7C;EAQX,CAAA;AAIFL,mBAAUhC,SAASA,QAEZgC;AACT;",
|
5
|
+
"names": ["React", "useContextKey", "useSortedScreens", "Screen", "useFilterScreenChildren", "children", "isCustomNavigator", "contextKey", "useMemo", "customChildren", "screens", "Children", "map", "child", "isValidElement", "type", "props", "name", "Error", "process", "env", "NODE_ENV", "some", "key", "push", "console", "warn", "names", "screen", "Set", "size", "length", "withLayoutContext", "Nav", "processor", "Navigator", "forwardRef", "ref", "userDefinedChildren", "processed", "sorted", "id"]
|
6
|
+
}
|
@@ -2,44 +2,41 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot";
|
3
3
|
import * as React from "react";
|
4
4
|
import { Platform, Text } from "react-native";
|
5
|
-
import { resolveHref } from "./href
|
6
|
-
import { useLinkTo } from "./useLinkTo
|
7
|
-
var Link = /* @__PURE__ */React.forwardRef(function
|
5
|
+
import { resolveHref } from "./href";
|
6
|
+
import { useLinkTo } from "./useLinkTo";
|
7
|
+
var Link = /* @__PURE__ */ React.forwardRef(function(param, ref) {
|
8
8
|
var {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
},
|
41
|
-
Element = asChild ? Slot : Text;
|
42
|
-
return /* @__PURE__ */_jsx(Element, {
|
9
|
+
href,
|
10
|
+
replace,
|
11
|
+
push,
|
12
|
+
// TODO: This does not prevent default on the anchor tag.
|
13
|
+
asChild,
|
14
|
+
rel,
|
15
|
+
target,
|
16
|
+
download,
|
17
|
+
...rest
|
18
|
+
} = param, style = useInteropClassName(rest), hrefAttrs = useHrefAttrs({
|
19
|
+
asChild,
|
20
|
+
rel,
|
21
|
+
target,
|
22
|
+
download
|
23
|
+
}), resolvedHref = React.useMemo(function() {
|
24
|
+
if (href == null)
|
25
|
+
throw new Error("Link: href is required");
|
26
|
+
return resolveHref(href);
|
27
|
+
}, [
|
28
|
+
href
|
29
|
+
]), props = useLinkTo({
|
30
|
+
href: resolvedHref,
|
31
|
+
replace
|
32
|
+
}), onPress = function(e) {
|
33
|
+
if ("onPress" in rest) {
|
34
|
+
var _rest_onPress;
|
35
|
+
(_rest_onPress = rest.onPress) === null || _rest_onPress === void 0 || _rest_onPress.call(rest, e);
|
36
|
+
}
|
37
|
+
props.onPress(e);
|
38
|
+
}, Element = asChild ? Slot : Text;
|
39
|
+
return /* @__PURE__ */ _jsx(Element, {
|
43
40
|
ref,
|
44
41
|
...props,
|
45
42
|
...hrefAttrs,
|
@@ -57,24 +54,29 @@ var Link = /* @__PURE__ */React.forwardRef(function (param, ref) {
|
|
57
54
|
});
|
58
55
|
Link.resolveHref = resolveHref;
|
59
56
|
function useInteropClassName(props) {
|
60
|
-
return Platform.OS !== "web" ? props.style : React.useMemo(function
|
61
|
-
if (props.className == null)
|
57
|
+
return Platform.OS !== "web" ? props.style : React.useMemo(function() {
|
58
|
+
if (props.className == null)
|
59
|
+
return props.style;
|
62
60
|
var cssStyle = {
|
63
61
|
$$css: !0,
|
64
62
|
__routerLinkClassName: props.className
|
65
63
|
};
|
66
|
-
return Array.isArray(props.style) ? [
|
67
|
-
|
64
|
+
return Array.isArray(props.style) ? [
|
65
|
+
...props.style,
|
66
|
+
cssStyle
|
67
|
+
] : [
|
68
|
+
props.style,
|
69
|
+
cssStyle
|
70
|
+
];
|
71
|
+
}, [
|
72
|
+
props.style,
|
73
|
+
props.className
|
74
|
+
]);
|
68
75
|
}
|
69
76
|
var useHrefAttrs = Platform.select({
|
70
|
-
web: function
|
71
|
-
var {
|
72
|
-
|
73
|
-
rel,
|
74
|
-
target,
|
75
|
-
download
|
76
|
-
} = param;
|
77
|
-
return React.useMemo(function () {
|
77
|
+
web: function(param) {
|
78
|
+
var { asChild, rel, target, download } = param;
|
79
|
+
return React.useMemo(function() {
|
78
80
|
var hrefAttrs = {
|
79
81
|
rel,
|
80
82
|
target,
|
@@ -83,11 +85,18 @@ var useHrefAttrs = Platform.select({
|
|
83
85
|
return asChild ? hrefAttrs : {
|
84
86
|
hrefAttrs
|
85
87
|
};
|
86
|
-
}, [
|
88
|
+
}, [
|
89
|
+
asChild,
|
90
|
+
rel,
|
91
|
+
target,
|
92
|
+
download
|
93
|
+
]);
|
87
94
|
},
|
88
|
-
default: function
|
95
|
+
default: function() {
|
89
96
|
return {};
|
90
97
|
}
|
91
98
|
});
|
92
|
-
export {
|
93
|
-
|
99
|
+
export {
|
100
|
+
Link
|
101
|
+
};
|
102
|
+
//# sourceMappingURL=Link.js.map
|
@@ -1 +1,6 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/link/Users/n8/one/packages/one/src/link/Link.tsx"],
|
4
|
+
"mappings": ";AAEA,SAASA,YAAY;AACrB,YAAYC,WAAW;AACvB,SAASC,UAAUC,YAAwD;AAG3E,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAanB,IAAMC,OAAOL,sBAAMM,WAAW,SACnC,OAWAC,KAA6B;MAX7B;IACEC;IACAC;IACAC;;IAEAC;IACAC;IACAC;IACAC;IACA,GAAGC;EAAAA,IATL,OAcMC,QAAQC,oBAAoBF,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AChBN;QACAC;QACAC;MACF;AACA,aAAIH,UACKO,YAEF;QACLA;MACF;IACF,GAAG;MAACP;MAASC;MAAKC;MAAQC;KAAS;EACrC;EACAgB,SAAS,WAASX;AAChB,WAAO,CAAC;EACV;AACF,CAAA;",
|
5
|
+
"names": ["Slot", "React", "Platform", "Text", "resolveHref", "useLinkTo", "Link", "forwardRef", "ref", "href", "replace", "push", "asChild", "rel", "target", "download", "rest", "style", "useInteropClassName", "hrefAttrs", "useHrefAttrs", "resolvedHref", "useMemo", "Error", "props", "onPress", "e", "Element", "select", "web", "onClick", "default", "OS", "className", "cssStyle", "$$css", "__routerLinkClassName", "Array", "isArray"]
|
6
|
+
}
|
@@ -1,11 +1,8 @@
|
|
1
|
-
import { useRouter } from "../hooks
|
2
|
-
import { useFocusEffect } from "../useFocusEffect
|
1
|
+
import { useRouter } from "../hooks";
|
2
|
+
import { useFocusEffect } from "../useFocusEffect";
|
3
3
|
function Redirect(param) {
|
4
|
-
var {
|
5
|
-
|
6
|
-
} = param,
|
7
|
-
router = useRouter();
|
8
|
-
return useFocusEffect(function () {
|
4
|
+
var { href } = param, router = useRouter();
|
5
|
+
return useFocusEffect(function() {
|
9
6
|
try {
|
10
7
|
router.replace(href);
|
11
8
|
} catch (error) {
|
@@ -13,5 +10,7 @@ function Redirect(param) {
|
|
13
10
|
}
|
14
11
|
}), null;
|
15
12
|
}
|
16
|
-
export {
|
17
|
-
|
13
|
+
export {
|
14
|
+
Redirect
|
15
|
+
};
|
16
|
+
//# sourceMappingURL=Redirect.js.map
|
@@ -1 +1,6 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/link/Users/n8/one/packages/one/src/link/Redirect.tsx"],
|
4
|
+
"mappings": "AAAA,SAASA,iBAAiB;AAE1B,SAASC,sBAAsB;AAGxB,SAASC,SAAS,OAAkC;MAAlC,EAAEC,KAAI,IAAN,OACjBC,SAASJ,UAAAA;AACfC,wBAAe,WAAA;AACb,QAAI;AACFG,aAAOC,QAAQF,IAAAA;IACjB,SAASG,OAAO;AACdC,cAAQD,MAAMA,KAAAA;IAChB;EACF,CAAA,GACO;AACT;",
|
5
|
+
"names": ["useRouter", "useFocusEffect", "Redirect", "href", "router", "replace", "error", "console"]
|
6
|
+
}
|
@@ -1,29 +1,27 @@
|
|
1
|
-
var resolveHref = function
|
2
|
-
if (typeof href == "string")
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
if (!href?.params)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
...href.params
|
13
|
-
}),
|
14
|
-
paramsString = createQueryParams(params);
|
1
|
+
var resolveHref = function(href) {
|
2
|
+
if (typeof href == "string")
|
3
|
+
return resolveHref({
|
4
|
+
pathname: href
|
5
|
+
});
|
6
|
+
var _href_pathname, path = (_href_pathname = href.pathname) !== null && _href_pathname !== void 0 ? _href_pathname : "";
|
7
|
+
if (!href?.params)
|
8
|
+
return path;
|
9
|
+
var { pathname, params } = createQualifiedPathname(path, {
|
10
|
+
...href.params
|
11
|
+
}), paramsString = createQueryParams(params);
|
15
12
|
return pathname + (paramsString ? `?${paramsString}` : "");
|
16
13
|
};
|
17
14
|
function createQualifiedPathname(pathname, params) {
|
18
|
-
var _iteratorNormalCompletion = !0,
|
19
|
-
_didIteratorError = !1,
|
20
|
-
_iteratorError = void 0;
|
15
|
+
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
21
16
|
try {
|
22
17
|
for (var _iterator = Object.entries(params)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
23
|
-
var [key, value = ""] = _step.value,
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
var [key, value = ""] = _step.value, dynamicKey = `[${key}]`, deepDynamicKey = `[...${key}]`;
|
19
|
+
if (pathname.includes(dynamicKey))
|
20
|
+
pathname = pathname.replace(dynamicKey, encodeParam(value));
|
21
|
+
else if (pathname.includes(deepDynamicKey))
|
22
|
+
pathname = pathname.replace(deepDynamicKey, encodeParam(value));
|
23
|
+
else
|
24
|
+
continue;
|
27
25
|
delete params[key];
|
28
26
|
}
|
29
27
|
} catch (err) {
|
@@ -32,7 +30,8 @@ function createQualifiedPathname(pathname, params) {
|
|
32
30
|
try {
|
33
31
|
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
34
32
|
} finally {
|
35
|
-
if (_didIteratorError)
|
33
|
+
if (_didIteratorError)
|
34
|
+
throw _iteratorError;
|
36
35
|
}
|
37
36
|
}
|
38
37
|
return {
|
@@ -41,18 +40,20 @@ function createQualifiedPathname(pathname, params) {
|
|
41
40
|
};
|
42
41
|
}
|
43
42
|
function encodeParam(param) {
|
44
|
-
return Array.isArray(param) ? param.map(function
|
43
|
+
return Array.isArray(param) ? param.map(function(p) {
|
45
44
|
return encodeParam(p);
|
46
45
|
}).join("/") : encodeURIComponent(`${param}`);
|
47
46
|
}
|
48
47
|
function createQueryParams(params) {
|
49
|
-
return Object.entries(params).filter(function
|
48
|
+
return Object.entries(params).filter(function(param) {
|
50
49
|
var [, value] = param;
|
51
50
|
return value != null;
|
52
|
-
}).map(function
|
51
|
+
}).map(function(param) {
|
53
52
|
var [key, value] = param;
|
54
53
|
return `${key}=${encodeURIComponent(value.toString())}`;
|
55
54
|
}).join("&");
|
56
55
|
}
|
57
|
-
export {
|
58
|
-
|
56
|
+
export {
|
57
|
+
resolveHref
|
58
|
+
};
|
59
|
+
//# sourceMappingURL=href.js.map
|
@@ -1 +1,6 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/link/Users/n8/one/packages/one/src/link/href.ts"],
|
4
|
+
"mappings": "AAGO,IAAMA,cAAc,SAACC,MAAAA;AAC1B,MAAI,OAAOA,QAAS;AAClB,WAAOD,YAAY;MAAEE,UAAUD;IAAK,CAAA;MAEzBA,gBAAPE,QAAOF,iBAAAA,KAAKC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KAC/BS,IAAI,SAAA,OAAA;QAAC,CAACV,KAAKC,KAAAA,IAAM;WAAK,GAAGD,GAAAA,IAAOa,mBAAmBZ,MAAMc,SAAQ,CAAA,CAAA;KACjEH,KAAK,GAAA;AAEZ;",
|
5
|
+
"names": ["resolveHref", "href", "pathname", "path", "params", "createQualifiedPathname", "paramsString", "createQueryParams", "Object", "entries", "key", "value", "dynamicKey", "deepDynamicKey", "includes", "replace", "encodeParam", "param", "Array", "isArray", "map", "p", "join", "encodeURIComponent", "filter", "toString"]
|
6
|
+
}
|
@@ -1,11 +1,9 @@
|
|
1
1
|
import * as Linking from "expo-linking";
|
2
2
|
import { Platform } from "react-native";
|
3
|
-
import { adjustPathname } from "../fork/extractPathFromURL
|
4
|
-
import getPathFromState from "../fork/getPathFromState
|
5
|
-
import getStateFromPath from "../fork/getStateFromPath
|
6
|
-
var _globalThis_expo_modules,
|
7
|
-
_globalThis_expo,
|
8
|
-
isExpoGo = typeof expo < "u" && ((_globalThis_expo = globalThis.expo) === null || _globalThis_expo === void 0 || (_globalThis_expo_modules = _globalThis_expo.modules) === null || _globalThis_expo_modules === void 0 ? void 0 : _globalThis_expo_modules.ExpoGo);
|
3
|
+
import { adjustPathname } from "../fork/extractPathFromURL";
|
4
|
+
import getPathFromState from "../fork/getPathFromState";
|
5
|
+
import getStateFromPath from "../fork/getStateFromPath";
|
6
|
+
var _globalThis_expo_modules, _globalThis_expo, isExpoGo = typeof expo < "u" && ((_globalThis_expo = globalThis.expo) === null || _globalThis_expo === void 0 || (_globalThis_expo_modules = _globalThis_expo.modules) === null || _globalThis_expo_modules === void 0 ? void 0 : _globalThis_expo_modules.ExpoGo);
|
9
7
|
function getInitialURL() {
|
10
8
|
if (process.env.NODE_ENV === "test") {
|
11
9
|
var _Linking_getInitialURL;
|
@@ -13,28 +11,37 @@ function getInitialURL() {
|
|
13
11
|
}
|
14
12
|
if (Platform.OS === "web") {
|
15
13
|
var _window_location;
|
16
|
-
if (typeof window > "u")
|
17
|
-
|
14
|
+
if (typeof window > "u")
|
15
|
+
return "";
|
16
|
+
if (!((_window_location = window.location) === null || _window_location === void 0) && _window_location.href)
|
17
|
+
return window.location.href;
|
18
18
|
}
|
19
|
-
return Promise.race([
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
19
|
+
return Promise.race([
|
20
|
+
async function() {
|
21
|
+
var url = await Linking.getInitialURL();
|
22
|
+
if (url && isExpoGo) {
|
23
|
+
var parsed = Linking.parse(url);
|
24
|
+
if (parsed.path === null || [
|
25
|
+
"",
|
26
|
+
"/"
|
27
|
+
].includes(adjustPathname({
|
28
|
+
hostname: parsed.hostname,
|
29
|
+
pathname: parsed.path
|
30
|
+
})))
|
31
|
+
return getRootURL();
|
32
|
+
}
|
33
|
+
return url ?? getRootURL();
|
34
|
+
}(),
|
35
|
+
new Promise(function(resolve) {
|
36
|
+
return (
|
37
|
+
// Timeout in 150ms if `getInitialState` doesn't resolve
|
38
|
+
// Workaround for https://github.com/facebook/react-native/issues/25675
|
39
|
+
setTimeout(function() {
|
40
|
+
return resolve(getRootURL());
|
41
|
+
}, 150)
|
42
|
+
);
|
43
|
+
})
|
44
|
+
]);
|
38
45
|
}
|
39
46
|
var _rootURL;
|
40
47
|
function getRootURL() {
|
@@ -42,26 +49,30 @@ function getRootURL() {
|
|
42
49
|
}
|
43
50
|
function addEventListener(listener) {
|
44
51
|
var callback;
|
45
|
-
isExpoGo ? callback = function
|
46
|
-
var {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
52
|
+
isExpoGo ? callback = function(param) {
|
53
|
+
var { url } = param, parsed = Linking.parse(url);
|
54
|
+
parsed.path === null || [
|
55
|
+
"",
|
56
|
+
"/"
|
57
|
+
].includes(adjustPathname({
|
51
58
|
hostname: parsed.hostname,
|
52
59
|
pathname: parsed.path
|
53
60
|
})) ? listener(getRootURL()) : listener(url);
|
54
|
-
} : callback = function
|
55
|
-
var {
|
56
|
-
url
|
57
|
-
} = param;
|
61
|
+
} : callback = function(param) {
|
62
|
+
var { url } = param;
|
58
63
|
return listener(url);
|
59
64
|
};
|
60
65
|
var subscription = Linking.addEventListener("url", callback);
|
61
|
-
return function
|
66
|
+
return function() {
|
62
67
|
var _subscription_remove;
|
63
68
|
subscription == null || (_subscription_remove = subscription.remove) === null || _subscription_remove === void 0 || _subscription_remove.call(subscription);
|
64
69
|
};
|
65
70
|
}
|
66
|
-
export {
|
67
|
-
|
71
|
+
export {
|
72
|
+
addEventListener,
|
73
|
+
getInitialURL,
|
74
|
+
getPathFromState,
|
75
|
+
getRootURL,
|
76
|
+
getStateFromPath
|
77
|
+
};
|
78
|
+
//# sourceMappingURL=linking.js.map
|
@@ -1 +1,6 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../src/link/Users/n8/one/packages/one/src/link/linking.ts"],
|
4
|
+
"mappings": "AAAA,YAAYA,aAAa;AACzB,SAASC,gBAAgB;AAEzB,SAASC,sBAAsB;AAC/B,OAAOC,sBAAsB;AAC7B,OAAOC,sBAAsB;IAGmBC,0BAAAA,kBAA1CC,WAAW,OAAOC,OAAS,SAAeF,mBAAAA,WAAWE,UAAI,QAAfF,qBAAAA,WAAAA,2BAAAA,iBAAiBG,aAAO,QAAxBH,6BAAAA,SAAAA,SAAAA,yBAA0BI;AAOnE,SAASC,gBAAAA;AACd,MAAIC,QAAQC,IAAIC,aAAa,QAAQ;QAC5Bb;AAAP,YAAOA,yBAAAA,QAAQU,cAAa,OAAA,QAArBV,2BAAAA,SAAAA,yBAA2Bc,WAAAA;EACpC;AAEA,MAAIb,SAASc,OAAO,OAAO;QAIrBC;AAHJ,QAAI,OAAOA,SAAW;AACpB,aAAO;AAET,QAAIA,sBAAAA,OAAOC,cAAQ,QAAfD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form", "adjustPathname", "getPathFromState", "getStateFromPath", "globalThis", "isExpoGo", "expo", "modules", "ExpoGo", "getInitialURL", "process", "env", "NODE_ENV", "getRootURL", "OS", "window", "location", "href", "Promise", "race", "url", "parsed", "parse", "path", "includes", "hostname", "pathname", "resolve", "setTimeout", "_rootURL", "undefined", "createURL", "addEventListener", "listener", "callback", "subscription", "remove"]
|
6
|
+
}
|
@@ -1,29 +1,35 @@
|
|
1
1
|
function assertPath(path) {
|
2
|
-
if (typeof path != "string")
|
2
|
+
if (typeof path != "string")
|
3
|
+
throw new TypeError("Path must be a string. Received " + JSON.stringify(path));
|
3
4
|
}
|
4
5
|
function normalizeStringPosix(path, allowAboveRoot) {
|
5
6
|
for (var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code, i = 0; i <= path.length; ++i) {
|
6
|
-
if (i < path.length)
|
7
|
-
|
7
|
+
if (i < path.length)
|
8
|
+
code = path.charCodeAt(i);
|
9
|
+
else {
|
10
|
+
if (code === 47)
|
11
|
+
break;
|
8
12
|
code = 47;
|
9
13
|
}
|
10
14
|
if (code === 47) {
|
11
|
-
if (!(lastSlash === i - 1 || dots === 1))
|
12
|
-
if (
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
if (!(lastSlash === i - 1 || dots === 1))
|
16
|
+
if (lastSlash !== i - 1 && dots === 2) {
|
17
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || /*.*/
|
18
|
+
res.charCodeAt(res.length - 2) !== 46) {
|
19
|
+
if (res.length > 2) {
|
20
|
+
var lastSlashIndex = res.lastIndexOf("/");
|
21
|
+
if (lastSlashIndex !== res.length - 1) {
|
22
|
+
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = i, dots = 0;
|
23
|
+
continue;
|
24
|
+
}
|
25
|
+
} else if (res.length === 2 || res.length === 1) {
|
26
|
+
res = "", lastSegmentLength = 0, lastSlash = i, dots = 0;
|
18
27
|
continue;
|
19
28
|
}
|
20
|
-
} else if (res.length === 2 || res.length === 1) {
|
21
|
-
res = "", lastSegmentLength = 0, lastSlash = i, dots = 0;
|
22
|
-
continue;
|
23
29
|
}
|
24
|
-
|
25
|
-
|
26
|
-
|
30
|
+
allowAboveRoot && (res.length > 0 ? res += "/.." : res = "..", lastSegmentLength = 2);
|
31
|
+
} else
|
32
|
+
res.length > 0 ? res += "/" + path.slice(lastSlash + 1, i) : res = path.slice(lastSlash + 1, i), lastSegmentLength = i - lastSlash - 1;
|
27
33
|
lastSlash = i, dots = 0;
|
28
34
|
} else code === 46 && /*.*/
|
29
35
|
dots !== -1 ? ++dots : dots = -1;
|
@@ -31,12 +37,15 @@ function normalizeStringPosix(path, allowAboveRoot) {
|
|
31
37
|
return res;
|
32
38
|
}
|
33
39
|
function resolve() {
|
34
|
-
for (var _len = arguments.length, segments = new Array(_len), _key = 0; _key < _len; _key++)
|
40
|
+
for (var _len = arguments.length, segments = new Array(_len), _key = 0; _key < _len; _key++)
|
41
|
+
segments[_key] = arguments[_key];
|
35
42
|
for (var resolvedPath = "", resolvedAbsolute = !1, i = segments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
36
43
|
var path = void 0;
|
37
44
|
i >= 0 ? path = segments[i] : path = "/", assertPath(path), path.length !== 0 && (resolvedPath = path + "/" + resolvedPath, resolvedAbsolute = path.charCodeAt(0) === 47);
|
38
45
|
}
|
39
46
|
return resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute ? resolvedPath.length > 0 ? "/" + resolvedPath : "/" : resolvedPath.length > 0 ? resolvedPath : ".";
|
40
47
|
}
|
41
|
-
export {
|
42
|
-
|
48
|
+
export {
|
49
|
+
resolve
|
50
|
+
};
|
51
|
+
//# sourceMappingURL=path.js.map
|