@take-out/helpers 0.5.0 → 0.6.0
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/cjs/async/asyncContext.cjs +2 -2
- package/dist/cjs/constants.cjs +5 -5
- package/dist/cjs/constants.native.js +5 -5
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/index.cjs +0 -1
- package/dist/cjs/index.native.js +0 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/platform.cjs +29 -29
- package/dist/cjs/platform.native.js +28 -28
- package/dist/cjs/platform.native.js.map +1 -1
- package/dist/esm/async/asyncContext.mjs +2 -2
- package/dist/esm/async/asyncContext.mjs.map +1 -1
- package/dist/esm/constants.mjs +5 -5
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +5 -5
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +0 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +0 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/platform.mjs +16 -16
- package/dist/esm/platform.mjs.map +1 -1
- package/dist/esm/platform.native.js +15 -15
- package/dist/esm/platform.native.js.map +1 -1
- package/package.json +1 -1
- package/src/async/asyncContext.ts +2 -2
- package/src/constants.ts +4 -4
- package/src/index.ts +0 -1
- package/src/platform.native.ts +18 -19
- package/src/platform.ts +32 -23
- package/types/async/asyncContext.d.ts.map +1 -1
- package/types/constants.d.ts +2 -2
- package/types/constants.d.ts.map +1 -1
- package/types/index.d.ts +0 -1
- package/types/index.d.ts.map +2 -2
- package/types/platform.d.ts +15 -16
- package/types/platform.d.ts.map +2 -2
- package/types/platform.native.d.ts +15 -16
- package/types/platform.native.d.ts.map +2 -2
- package/dist/cjs/server/isServerRuntime.cjs +0 -32
- package/dist/cjs/server/isServerRuntime.native.js +0 -35
- package/dist/cjs/server/isServerRuntime.native.js.map +0 -1
- package/dist/esm/server/isServerRuntime.mjs +0 -7
- package/dist/esm/server/isServerRuntime.mjs.map +0 -1
- package/dist/esm/server/isServerRuntime.native.js +0 -7
- package/dist/esm/server/isServerRuntime.native.js.map +0 -1
- package/src/server/isServerRuntime.ts +0 -11
- package/types/server/isServerRuntime.d.ts +0 -3
- package/types/server/isServerRuntime.d.ts.map +0 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IS_SERVER_RUNTIME } from '../platform'
|
|
2
2
|
|
|
3
3
|
interface AsyncContext<T> {
|
|
4
4
|
get(): T | undefined
|
|
@@ -40,7 +40,7 @@ async function getNodeAsyncLocalStorage(): Promise<AsyncLocalStorageConstructor
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export function createAsyncContext<T>(): AsyncContext<T> {
|
|
43
|
-
if (
|
|
43
|
+
if (IS_SERVER_RUNTIME) {
|
|
44
44
|
let storage: NodeAsyncLocalStorage<T> | null = null
|
|
45
45
|
|
|
46
46
|
const storageReady = Promise.resolve(configuredAsyncLocalStorage)
|
package/src/constants.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IS_WEB } from './platform'
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const IS_TAURI: boolean = typeof window !== 'undefined' && '__TAURI__' in window
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const IS_NATIVE: boolean = !IS_WEB && !IS_TAURI
|
|
6
6
|
|
|
7
7
|
// TODO move to probably ~/interface/constants
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ export const IS_MAC_DESKTOP: boolean =
|
|
|
10
10
|
typeof navigator !== 'undefined' && /Macintosh|MacIntel/.test(navigator.platform)
|
|
11
11
|
|
|
12
12
|
export const IS_SAFARI: boolean =
|
|
13
|
-
|
|
13
|
+
IS_TAURI ||
|
|
14
14
|
(typeof navigator !== 'undefined' &&
|
|
15
15
|
/Version\/[\d.]+.*Safari/.test(navigator.userAgent) &&
|
|
16
16
|
typeof navigator.vendor === 'string' &&
|
package/src/index.ts
CHANGED
|
@@ -81,7 +81,6 @@ export * from './storage/driver'
|
|
|
81
81
|
export type { StorageDriver } from './storage/types'
|
|
82
82
|
|
|
83
83
|
// server
|
|
84
|
-
export * from './server/isServerRuntime'
|
|
85
84
|
export * from './server/ensureEnv'
|
|
86
85
|
export * from './server/getHeaders'
|
|
87
86
|
export * from './server/prettyPrintRequest'
|
package/src/platform.native.ts
CHANGED
|
@@ -6,32 +6,31 @@
|
|
|
6
6
|
import { useLayoutEffect, type useEffect } from 'react'
|
|
7
7
|
import { Platform } from 'react-native'
|
|
8
8
|
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
12
|
-
export const
|
|
13
|
-
|
|
14
|
-
export const isWindowDefined: boolean = false
|
|
9
|
+
export const IS_WEB: boolean = false
|
|
10
|
+
export const IS_BROWSER: boolean = false
|
|
11
|
+
export const IS_SERVER: boolean = false
|
|
12
|
+
export const IS_SERVER_RUNTIME: boolean = false
|
|
13
|
+
export const IS_CLIENT: boolean = true
|
|
15
14
|
export const useIsomorphicLayoutEffect: typeof useEffect = useLayoutEffect
|
|
16
|
-
export const
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
15
|
+
export const IS_CHROME: boolean = false
|
|
16
|
+
export const IS_WEB_TOUCHABLE: boolean = false
|
|
17
|
+
export const IS_NATIVE_DESKTOP: boolean =
|
|
19
18
|
Platform?.OS === 'macos' || Platform?.OS === 'windows'
|
|
20
|
-
export const
|
|
19
|
+
export const IS_TOUCHABLE: boolean = !IS_NATIVE_DESKTOP
|
|
21
20
|
// optional chain required: babel extractor loads native.cjs in node where Platform is undefined
|
|
22
|
-
//
|
|
23
|
-
export const
|
|
21
|
+
// on Android TV: Platform.OS === 'android' per react-native-tvos
|
|
22
|
+
export const IS_ANDROID: boolean =
|
|
24
23
|
Platform?.OS === 'android' ||
|
|
25
24
|
process.env.TEST_NATIVE_PLATFORM === 'android' ||
|
|
26
25
|
process.env.TEST_NATIVE_PLATFORM === 'androidtv'
|
|
27
|
-
//
|
|
28
|
-
export const
|
|
26
|
+
// on tvOS: Platform.OS === 'ios' per react-native-tvos
|
|
27
|
+
export const IS_IOS: boolean =
|
|
29
28
|
Platform?.OS === 'ios' ||
|
|
30
29
|
process.env.TEST_NATIVE_PLATFORM === 'ios' ||
|
|
31
30
|
process.env.TEST_NATIVE_PLATFORM === 'tvos'
|
|
32
|
-
export const
|
|
33
|
-
|
|
34
|
-
export const
|
|
31
|
+
export const SUPPORTS_DYNAMIC_COLOR_IOS: boolean =
|
|
32
|
+
IS_IOS || process.env.TAMAGUI_DYNAMIC_COLOR_IOS === '1'
|
|
33
|
+
export const IS_TV: boolean =
|
|
35
34
|
Platform?.isTV ||
|
|
36
35
|
process.env.TEST_NATIVE_PLATFORM === 'androidtv' ||
|
|
37
36
|
process.env.TEST_NATIVE_PLATFORM === 'tvos'
|
|
@@ -50,9 +49,9 @@ const platforms: Partial<Record<typeof Platform.OS, CurrentPlatform>> = {
|
|
|
50
49
|
* Reflects Platform.OS. TV platforms are intentionally NOT separate values:
|
|
51
50
|
* - Android TV has Platform.OS === 'android' (react-native-tvos behavior)
|
|
52
51
|
* - tvOS has Platform.OS === 'ios' (react-native-tvos behavior)
|
|
53
|
-
* Use `
|
|
52
|
+
* Use `IS_TV` combined with `IS_ANDROID`/`IS_IOS` to detect specific TV platforms.
|
|
54
53
|
*/
|
|
55
|
-
export const
|
|
54
|
+
export const CURRENT_PLATFORM: CurrentPlatform =
|
|
56
55
|
(Platform?.OS ? platforms[Platform.OS] : undefined) || 'native'
|
|
57
56
|
|
|
58
57
|
// In Metro source mode, TAMAGUI_TARGET may not be set by the build tool.
|
package/src/platform.ts
CHANGED
|
@@ -4,60 +4,69 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useLayoutEffect } from 'react'
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const IS_WEB: boolean = true
|
|
8
8
|
|
|
9
9
|
// RN adds fake window and document so its not simple to get this right
|
|
10
10
|
// check both navigator and location
|
|
11
|
-
export const
|
|
12
|
-
|
|
11
|
+
export const IS_BROWSER: boolean =
|
|
12
|
+
process.env.VITE_ENVIRONMENT === 'client' ||
|
|
13
|
+
(process.env.VITE_ENVIRONMENT !== 'ssr' &&
|
|
14
|
+
typeof navigator !== 'undefined' &&
|
|
15
|
+
typeof location !== 'undefined')
|
|
13
16
|
|
|
14
|
-
export const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
export const IS_SERVER_RUNTIME: boolean =
|
|
18
|
+
process.env.VITE_ENVIRONMENT === 'ssr' ||
|
|
19
|
+
(process.env.VITE_ENVIRONMENT !== 'client' &&
|
|
20
|
+
typeof process !== 'undefined' &&
|
|
21
|
+
!!process.versions &&
|
|
22
|
+
!!(process.versions.node || (process.versions as any).bun))
|
|
23
|
+
export const IS_SERVER: boolean =
|
|
24
|
+
process.env.VITE_ENVIRONMENT === 'ssr' ||
|
|
25
|
+
(process.env.VITE_ENVIRONMENT !== 'client' && IS_WEB && !IS_BROWSER)
|
|
26
|
+
export const IS_CLIENT: boolean = IS_WEB && !IS_SERVER
|
|
18
27
|
|
|
19
|
-
export const useIsomorphicLayoutEffect: typeof useEffect =
|
|
28
|
+
export const useIsomorphicLayoutEffect: typeof useEffect = IS_SERVER
|
|
20
29
|
? useEffect
|
|
21
30
|
: useLayoutEffect
|
|
22
31
|
|
|
23
|
-
export const
|
|
24
|
-
typeof navigator !== 'undefined' &&
|
|
32
|
+
export const IS_CHROME: boolean =
|
|
33
|
+
typeof navigator !== 'undefined' && (navigator.userAgent || '').includes('Chrome')
|
|
25
34
|
|
|
26
35
|
// guard the `window` access: in a web worker `navigator`/`location` exist (so
|
|
27
|
-
//
|
|
36
|
+
// IS_CLIENT is true) but `window` does NOT — touching it throws "window is not
|
|
28
37
|
// defined" and kills the worker. soot bundles @take-out/helpers into its
|
|
29
38
|
// project-server web worker, so the unguarded form (which @tamagui/constants
|
|
30
39
|
// also ships, but never loads in a worker) hard-crashes preview bundling.
|
|
31
40
|
// keep this typeof guard even though it diverges from @tamagui/constants.
|
|
32
|
-
export const
|
|
33
|
-
|
|
41
|
+
export const IS_WEB_TOUCHABLE: boolean =
|
|
42
|
+
IS_CLIENT &&
|
|
34
43
|
typeof window !== 'undefined' &&
|
|
35
44
|
('ontouchstart' in window || navigator.maxTouchPoints > 0)
|
|
36
45
|
|
|
37
|
-
export const
|
|
38
|
-
export const
|
|
46
|
+
export const IS_NATIVE_DESKTOP: boolean = false
|
|
47
|
+
export const IS_TOUCHABLE: boolean = !IS_WEB || IS_WEB_TOUCHABLE
|
|
39
48
|
// set :boolean to avoid inferring type to false
|
|
40
|
-
//
|
|
49
|
+
// on web, IS_ANDROID/IS_IOS are always false in production.
|
|
41
50
|
// TEST_NATIVE_PLATFORM is only set by the test runner (vitest) to simulate native
|
|
42
51
|
// environments (e.g. androidtv, tvos) from a web/jsdom test context.
|
|
43
|
-
export const
|
|
52
|
+
export const IS_ANDROID: boolean =
|
|
44
53
|
process.env.TEST_NATIVE_PLATFORM === 'android' ||
|
|
45
54
|
process.env.TEST_NATIVE_PLATFORM === 'androidtv'
|
|
46
|
-
export const
|
|
55
|
+
export const IS_IOS: boolean =
|
|
47
56
|
process.env.TEST_NATIVE_PLATFORM === 'ios' ||
|
|
48
57
|
process.env.TEST_NATIVE_PLATFORM === 'tvos'
|
|
49
|
-
export const
|
|
50
|
-
|
|
51
|
-
export const
|
|
58
|
+
export const SUPPORTS_DYNAMIC_COLOR_IOS: boolean =
|
|
59
|
+
IS_IOS || process.env.TAMAGUI_DYNAMIC_COLOR_IOS === '1'
|
|
60
|
+
export const IS_TV: boolean =
|
|
52
61
|
process.env.TEST_NATIVE_PLATFORM === 'androidtv' ||
|
|
53
62
|
process.env.TEST_NATIVE_PLATFORM === 'tvos'
|
|
54
63
|
/**
|
|
55
64
|
* Reflects Platform.OS. TV platforms are intentionally NOT separate values:
|
|
56
65
|
* - Android TV has Platform.OS === 'android' (react-native-tvos behavior)
|
|
57
66
|
* - tvOS has Platform.OS === 'ios' (react-native-tvos behavior)
|
|
58
|
-
* Use `
|
|
67
|
+
* Use `IS_TV` combined with `IS_ANDROID`/`IS_IOS` to detect specific TV platforms.
|
|
59
68
|
*/
|
|
60
|
-
export const
|
|
69
|
+
export const CURRENT_PLATFORM: 'web' | 'ios' | 'native' | 'android' = 'web'
|
|
61
70
|
|
|
62
71
|
// In web source mode (Vite/webpack without pre-built dist), TAMAGUI_TARGET may not be set.
|
|
63
72
|
// Set it here so all process.env.TAMAGUI_TARGET runtime checks work correctly.
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import {
|
|
9
|
+
"import { IS_SERVER_RUNTIME } from '../platform'\n\ninterface AsyncContext<T> {\n get(): T | undefined\n run<R>(value: T, fn: () => R | Promise<R>): Promise<R>\n}\n\ninterface NodeAsyncLocalStorage<T> {\n getStore(): T | undefined\n run<R>(store: T, callback: () => R): R\n}\n\ninterface AsyncLocalStorageConstructor {\n new <T>(): NodeAsyncLocalStorage<T>\n}\n\nlet nodeAsyncLocalStorageCache: AsyncLocalStorageConstructor | null = null\nlet configuredAsyncLocalStorage: AsyncLocalStorageConstructor | null = null\n\n// hide from vite/esbuild static analysis to avoid browser compat warning\nconst nodeModuleId = ['node', 'async_hooks'].join(':')\n\nexport function setupAsyncLocalStorage(\n AsyncLocalStorage: AsyncLocalStorageConstructor | null,\n): void {\n configuredAsyncLocalStorage = AsyncLocalStorage\n}\n\nasync function getNodeAsyncLocalStorage(): Promise<AsyncLocalStorageConstructor | null> {\n if (!nodeAsyncLocalStorageCache) {\n try {\n const module = await import(/* @vite-ignore */ nodeModuleId)\n nodeAsyncLocalStorageCache =\n module.AsyncLocalStorage as AsyncLocalStorageConstructor\n } catch {\n return null\n }\n }\n return nodeAsyncLocalStorageCache\n}\n\nexport function createAsyncContext<T>(): AsyncContext<T> {\n if (IS_SERVER_RUNTIME) {\n let storage: NodeAsyncLocalStorage<T> | null = null\n\n const storageReady = Promise.resolve(configuredAsyncLocalStorage)\n .then((AsyncLocalStorage) => AsyncLocalStorage || getNodeAsyncLocalStorage())\n .then((AsyncLocalStorage) => {\n if (AsyncLocalStorage && !storage) {\n storage = new AsyncLocalStorage<T>()\n }\n })\n\n return {\n get(): T | undefined {\n if (!storage) {\n throw new Error(`AsyncContext storage not initialized`)\n }\n return storage.getStore()\n },\n\n async run<R>(value: T, fn: () => R | Promise<R>): Promise<R> {\n if (!storage) {\n await storageReady\n }\n if (!storage) {\n throw new Error(`AsyncContext storage unavailable in server runtime`)\n }\n return storage.run(value, fn)\n },\n }\n } else {\n // browser implementation using promise patching\n return createBrowserAsyncContext<T>()\n }\n}\n\nfunction createBrowserAsyncContext<T>(): AsyncContext<T> {\n let currentContext: T | undefined\n const contextStack: (T | undefined)[] = []\n\n return {\n get(): T | undefined {\n return currentContext\n },\n async run<R>(value: T, fn: () => R | Promise<R>): Promise<R> {\n const prevContext = currentContext\n currentContext = value\n contextStack.push(prevContext)\n\n // store original Promise methods\n const OriginalPromise = Promise\n const OriginalThen = OriginalPromise.prototype.then\n const OriginalCatch = OriginalPromise.prototype.catch\n const OriginalFinally = OriginalPromise.prototype.finally\n\n function wrapCallback(\n callback: Function | undefined | null,\n context: T | undefined,\n ): Function | undefined | null {\n if (!callback) return callback\n return (...args: any[]) => {\n const prevContext = currentContext\n currentContext = context\n try {\n return callback(...args)\n } finally {\n currentContext = prevContext\n }\n }\n }\n\n // patch Promise methods to capture and restore context\n // eslint-disable-next-line no-then-property -- intentional patching for context propagation\n OriginalPromise.prototype.then = function (\n this: Promise<any>,\n onFulfilled?: any,\n onRejected?: any,\n ): Promise<any> {\n const context = currentContext\n return OriginalThen.call(\n this,\n wrapCallback(onFulfilled, context) as any,\n wrapCallback(onRejected, context) as any,\n )\n }\n\n OriginalPromise.prototype.catch = function (\n this: Promise<any>,\n onRejected?: any,\n ): Promise<any> {\n const context = currentContext\n return OriginalCatch.call(this, wrapCallback(onRejected, context) as any)\n }\n\n OriginalPromise.prototype.finally = function (\n this: Promise<any>,\n onFinally?: any,\n ): Promise<any> {\n const context = currentContext\n return OriginalFinally.call(this, wrapCallback(onFinally, context) as any)\n }\n\n try {\n const result = await fn()\n return result\n } finally {\n // restore original Promise methods\n // eslint-disable-next-line no-then-property -- restoring original methods\n OriginalPromise.prototype.then = OriginalThen\n OriginalPromise.prototype.catch = OriginalCatch\n OriginalPromise.prototype.finally = OriginalFinally\n\n contextStack.pop()\n currentContext = prevContext\n }\n },\n }\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
package/types/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const IS_TAURI: boolean;
|
|
2
|
+
export declare const IS_NATIVE: boolean;
|
|
3
3
|
export declare const IS_MAC_DESKTOP: boolean;
|
|
4
4
|
export declare const IS_SAFARI: boolean;
|
|
5
5
|
export * from "./platform";
|
package/types/constants.d.ts.map
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import {
|
|
9
|
+
"import { IS_WEB } from './platform'\n\nexport const IS_TAURI: boolean = typeof window !== 'undefined' && '__TAURI__' in window\n\nexport const IS_NATIVE: boolean = !IS_WEB && !IS_TAURI\n\n// TODO move to probably ~/interface/constants\n\nexport const IS_MAC_DESKTOP: boolean =\n typeof navigator !== 'undefined' && /Macintosh|MacIntel/.test(navigator.platform)\n\nexport const IS_SAFARI: boolean =\n IS_TAURI ||\n (typeof navigator !== 'undefined' &&\n /Version\\/[\\d.]+.*Safari/.test(navigator.userAgent) &&\n typeof navigator.vendor === 'string' &&\n navigator.vendor.includes('Apple Computer'))\n\nexport * from './platform'\n\nexport const EMPTY_ARRAY = [] as never\nexport const EMPTY_OBJECT = {} as never\n\nconst getDebugLevelFromUrl = (): number | null => {\n if (typeof window === 'undefined') return null\n const match = window.location?.search?.match(/debug=(\\d+)/)\n return match?.[1] ? parseInt(match[1], 10) : null\n}\n\nexport const DEBUG_LEVEL: number = process.env.DEBUG_LEVEL\n ? +process.env.DEBUG_LEVEL\n : (getDebugLevelFromUrl() ?? (process.env.NODE_ENV === 'development' ? 1 : 0))\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -47,7 +47,6 @@ export * from "./react/getCurrentComponentStack";
|
|
|
47
47
|
export * from "./storage/createStorage";
|
|
48
48
|
export * from "./storage/driver";
|
|
49
49
|
export type { StorageDriver } from "./storage/types";
|
|
50
|
-
export * from "./server/isServerRuntime";
|
|
51
50
|
export * from "./server/ensureEnv";
|
|
52
51
|
export * from "./server/getHeaders";
|
|
53
52
|
export * from "./server/prettyPrintRequest";
|
package/types/index.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AAKd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,SAAS,uBAAuB;AAChC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc,qBAAqB;AAGnC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;
|
|
2
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AAKd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,SAAS,uBAAuB;AAChC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc,qBAAqB;AAGnC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,mBAAmB;AACnB,mBAAmB;AACnB,mBAAmB;AACnB,mBAAmB;AACnB,mBAAmB;AAGnB,cAAc;AACd,cAAc",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/index.ts"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"export * from './constants'\nexport * from './emitter'\n\n// array\nexport * from './array/getRandomItem'\nexport * from './array/takeLast'\nexport * from './array/uniqBy'\n\n// assert\nexport * from './assert'\n\n// async\nexport * from './async/abortable'\nexport * from './async/asyncContext'\nexport * from './async/idle'\nexport * from './async/interval'\nexport * from './async/isAborted'\nexport * from './async/sleep'\nexport * from './async/useAsync'\nexport * from './async/useAsyncEffect'\nexport * from './async/useLazyMount'\nexport * from './async/useLazyValue'\n\n// browser\nexport * from './browser/clearIndexedDB'\n\n// clipboard\nexport * from './clipboard/clipboard'\n\n// color\nexport * from './color/toHex'\nexport * from './color/generateColors'\nexport * from './color/lum'\nexport * from './color/extractOpacityFromColor'\nexport * from './browser/isActiveElementFormField'\nexport * from './browser/openPopup'\n\n// debug\nexport * from './debug/debugLog'\nexport * from './debug/debugUseState'\n\n// ensure\nexport * from './ensure/ensure'\nexport * from './ensure/ensureOne'\n\n// error\nexport * from './error/errors'\n\n// files\n\n// function\nexport * from './function/emptyFn'\nexport * from './function/identityFn'\nexport * from './function/throttle'\n\n// global\nexport * from './global/globalEffect'\nexport * from './global/globalValue'\n\n// number\nexport * from './number/formatNumber'\n\n// object\nexport * from './object/decorateObject'\nexport * from './object/isEqualDeep'\nexport { isEqualDeepLite } from './object/isEqualDeep'\nexport * from './object/isEqualIdentity'\nexport * from './object/isEqualJSON'\nexport * from './object/isEqualNever'\nexport * from './object/mapObject'\nexport * from './object/object'\nexport * from './object/objectUniqueKey'\n\n// react\nexport * from './react/createGlobalContext'\nexport * from './react/getCurrentComponentStack'\n\n// storage\nexport * from './storage/createStorage'\nexport * from './storage/driver'\nexport type { StorageDriver } from './storage/types'\n\n// server\nexport * from './server/
|
|
9
|
+
"export * from './constants'\nexport * from './emitter'\n\n// array\nexport * from './array/getRandomItem'\nexport * from './array/takeLast'\nexport * from './array/uniqBy'\n\n// assert\nexport * from './assert'\n\n// async\nexport * from './async/abortable'\nexport * from './async/asyncContext'\nexport * from './async/idle'\nexport * from './async/interval'\nexport * from './async/isAborted'\nexport * from './async/sleep'\nexport * from './async/useAsync'\nexport * from './async/useAsyncEffect'\nexport * from './async/useLazyMount'\nexport * from './async/useLazyValue'\n\n// browser\nexport * from './browser/clearIndexedDB'\n\n// clipboard\nexport * from './clipboard/clipboard'\n\n// color\nexport * from './color/toHex'\nexport * from './color/generateColors'\nexport * from './color/lum'\nexport * from './color/extractOpacityFromColor'\nexport * from './browser/isActiveElementFormField'\nexport * from './browser/openPopup'\n\n// debug\nexport * from './debug/debugLog'\nexport * from './debug/debugUseState'\n\n// ensure\nexport * from './ensure/ensure'\nexport * from './ensure/ensureOne'\n\n// error\nexport * from './error/errors'\n\n// files\n\n// function\nexport * from './function/emptyFn'\nexport * from './function/identityFn'\nexport * from './function/throttle'\n\n// global\nexport * from './global/globalEffect'\nexport * from './global/globalValue'\n\n// number\nexport * from './number/formatNumber'\n\n// object\nexport * from './object/decorateObject'\nexport * from './object/isEqualDeep'\nexport { isEqualDeepLite } from './object/isEqualDeep'\nexport * from './object/isEqualIdentity'\nexport * from './object/isEqualJSON'\nexport * from './object/isEqualNever'\nexport * from './object/mapObject'\nexport * from './object/object'\nexport * from './object/objectUniqueKey'\n\n// react\nexport * from './react/createGlobalContext'\nexport * from './react/getCurrentComponentStack'\n\n// storage\nexport * from './storage/createStorage'\nexport * from './storage/driver'\nexport type { StorageDriver } from './storage/types'\n\n// server\nexport * from './server/ensureEnv'\nexport * from './server/getHeaders'\nexport * from './server/prettyPrintRequest'\nexport * from './server/prettyPrintResponse'\nexport * from './server/streamToString'\n\n// string\nexport * from './string/dedent'\nexport * from './string/ellipsis'\nexport * from './string/hash'\nexport * from './string/insertAtIndex'\nexport * from './string/nbspLastWord'\nexport * from './string/pickLast'\nexport * from './string/pluralize'\nexport * from './string/randomId'\nexport * from './string/slugify'\nexport * from './string/truncateList'\n\n// time\nexport * from './time/formatDate'\nexport * from './time/formatDateRelative'\nexport * from './time/formatDistanceToNow'\nexport * from './time/time'\nexport * from './time/useTimer'\n\n// types\nexport type * from './types/NullToOptional'\nexport type * from './types/object'\nexport type * from './types/react'\nexport type * from './types/timer'\nexport type * from './types/tuple'\n\n// url\nexport * from './url/urlSanitize'\nexport * from './url/urlValidate'\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
package/types/platform.d.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
export declare const isWindowDefined: boolean;
|
|
2
|
+
export declare const IS_WEB: boolean;
|
|
3
|
+
export declare const IS_BROWSER: boolean;
|
|
4
|
+
export declare const IS_SERVER_RUNTIME: boolean;
|
|
5
|
+
export declare const IS_SERVER: boolean;
|
|
6
|
+
export declare const IS_CLIENT: boolean;
|
|
8
7
|
export declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
8
|
+
export declare const IS_CHROME: boolean;
|
|
9
|
+
export declare const IS_WEB_TOUCHABLE: boolean;
|
|
10
|
+
export declare const IS_NATIVE_DESKTOP: boolean;
|
|
11
|
+
export declare const IS_TOUCHABLE: boolean;
|
|
12
|
+
export declare const IS_ANDROID: boolean;
|
|
13
|
+
export declare const IS_IOS: boolean;
|
|
14
|
+
export declare const SUPPORTS_DYNAMIC_COLOR_IOS: boolean;
|
|
15
|
+
export declare const IS_TV: boolean;
|
|
17
16
|
/**
|
|
18
17
|
* Reflects Platform.OS. TV platforms are intentionally NOT separate values:
|
|
19
18
|
* - Android TV has Platform.OS === 'android' (react-native-tvos behavior)
|
|
20
19
|
* - tvOS has Platform.OS === 'ios' (react-native-tvos behavior)
|
|
21
|
-
* Use `
|
|
20
|
+
* Use `IS_TV` combined with `IS_ANDROID`/`IS_IOS` to detect specific TV platforms.
|
|
22
21
|
*/
|
|
23
|
-
export declare const
|
|
22
|
+
export declare const CURRENT_PLATFORM: "web" | "ios" | "native" | "android";
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=platform.d.ts.map
|
package/types/platform.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAIA,SAAS,iBAAkC;AAE3C,OAAO,cAAM;AAIb,OAAO,cAAM;
|
|
2
|
+
"mappings": "AAIA,SAAS,iBAAkC;AAE3C,OAAO,cAAM;AAIb,OAAO,cAAM;AAMb,OAAO,cAAM;AAMb,OAAO,cAAM;AAGb,OAAO,cAAM;AAEb,OAAO,cAAM,kCAAkC;AAI/C,OAAO,cAAM;AASb,OAAO,cAAM;AAKb,OAAO,cAAM;AACb,OAAO,cAAM;AAKb,OAAO,cAAM;AAGb,OAAO,cAAM;AAGb,OAAO,cAAM;AAEb,OAAO,cAAM;;;;;;;AASb,OAAO,cAAM,kBAAkB,QAAQ,QAAQ,WAAW",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/platform.ts"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"// platform booleans, web/default variant.\n// Re-implemented locally (mirrors @tamagui/constants) so @take-out/helpers carries no @tamagui/* runtime dep.\n// The native values live in platform.native.ts (resolved by metro / the react-native export condition).\n\nimport { useEffect, useLayoutEffect } from 'react'\n\nexport const
|
|
9
|
+
"// platform booleans, web/default variant.\n// Re-implemented locally (mirrors @tamagui/constants) so @take-out/helpers carries no @tamagui/* runtime dep.\n// The native values live in platform.native.ts (resolved by metro / the react-native export condition).\n\nimport { useEffect, useLayoutEffect } from 'react'\n\nexport const IS_WEB: boolean = true\n\n// RN adds fake window and document so its not simple to get this right\n// check both navigator and location\nexport const IS_BROWSER: boolean =\n process.env.VITE_ENVIRONMENT === 'client' ||\n (process.env.VITE_ENVIRONMENT !== 'ssr' &&\n typeof navigator !== 'undefined' &&\n typeof location !== 'undefined')\n\nexport const IS_SERVER_RUNTIME: boolean =\n process.env.VITE_ENVIRONMENT === 'ssr' ||\n (process.env.VITE_ENVIRONMENT !== 'client' &&\n typeof process !== 'undefined' &&\n !!process.versions &&\n !!(process.versions.node || (process.versions as any).bun))\nexport const IS_SERVER: boolean =\n process.env.VITE_ENVIRONMENT === 'ssr' ||\n (process.env.VITE_ENVIRONMENT !== 'client' && IS_WEB && !IS_BROWSER)\nexport const IS_CLIENT: boolean = IS_WEB && !IS_SERVER\n\nexport const useIsomorphicLayoutEffect: typeof useEffect = IS_SERVER\n ? useEffect\n : useLayoutEffect\n\nexport const IS_CHROME: boolean =\n typeof navigator !== 'undefined' && (navigator.userAgent || '').includes('Chrome')\n\n// guard the `window` access: in a web worker `navigator`/`location` exist (so\n// IS_CLIENT is true) but `window` does NOT — touching it throws \"window is not\n// defined\" and kills the worker. soot bundles @take-out/helpers into its\n// project-server web worker, so the unguarded form (which @tamagui/constants\n// also ships, but never loads in a worker) hard-crashes preview bundling.\n// keep this typeof guard even though it diverges from @tamagui/constants.\nexport const IS_WEB_TOUCHABLE: boolean =\n IS_CLIENT &&\n typeof window !== 'undefined' &&\n ('ontouchstart' in window || navigator.maxTouchPoints > 0)\n\nexport const IS_NATIVE_DESKTOP: boolean = false\nexport const IS_TOUCHABLE: boolean = !IS_WEB || IS_WEB_TOUCHABLE\n// set :boolean to avoid inferring type to false\n// on web, IS_ANDROID/IS_IOS are always false in production.\n// TEST_NATIVE_PLATFORM is only set by the test runner (vitest) to simulate native\n// environments (e.g. androidtv, tvos) from a web/jsdom test context.\nexport const IS_ANDROID: boolean =\n process.env.TEST_NATIVE_PLATFORM === 'android' ||\n process.env.TEST_NATIVE_PLATFORM === 'androidtv'\nexport const IS_IOS: boolean =\n process.env.TEST_NATIVE_PLATFORM === 'ios' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\nexport const SUPPORTS_DYNAMIC_COLOR_IOS: boolean =\n IS_IOS || process.env.TAMAGUI_DYNAMIC_COLOR_IOS === '1'\nexport const IS_TV: boolean =\n process.env.TEST_NATIVE_PLATFORM === 'androidtv' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\n/**\n * Reflects Platform.OS. TV platforms are intentionally NOT separate values:\n * - Android TV has Platform.OS === 'android' (react-native-tvos behavior)\n * - tvOS has Platform.OS === 'ios' (react-native-tvos behavior)\n * Use `IS_TV` combined with `IS_ANDROID`/`IS_IOS` to detect specific TV platforms.\n */\nexport const CURRENT_PLATFORM: 'web' | 'ios' | 'native' | 'android' = 'web'\n\n// In web source mode (Vite/webpack without pre-built dist), TAMAGUI_TARGET may not be set.\n// Set it here so all process.env.TAMAGUI_TARGET runtime checks work correctly.\n// In pre-built dist, the build tool inlines TAMAGUI_TARGET as a literal string,\n// making this block dead code (if (!'web') → never executes).\nif (!process.env.TAMAGUI_TARGET) {\n process.env.TAMAGUI_TARGET = 'web'\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { type useEffect } from "react";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
export declare const isWindowDefined: boolean;
|
|
2
|
+
export declare const IS_WEB: boolean;
|
|
3
|
+
export declare const IS_BROWSER: boolean;
|
|
4
|
+
export declare const IS_SERVER: boolean;
|
|
5
|
+
export declare const IS_SERVER_RUNTIME: boolean;
|
|
6
|
+
export declare const IS_CLIENT: boolean;
|
|
8
7
|
export declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
8
|
+
export declare const IS_CHROME: boolean;
|
|
9
|
+
export declare const IS_WEB_TOUCHABLE: boolean;
|
|
10
|
+
export declare const IS_NATIVE_DESKTOP: boolean;
|
|
11
|
+
export declare const IS_TOUCHABLE: boolean;
|
|
12
|
+
export declare const IS_ANDROID: boolean;
|
|
13
|
+
export declare const IS_IOS: boolean;
|
|
14
|
+
export declare const SUPPORTS_DYNAMIC_COLOR_IOS: boolean;
|
|
15
|
+
export declare const IS_TV: boolean;
|
|
17
16
|
type CurrentPlatform = "web" | "ios" | "native" | "android" | "macos" | "windows";
|
|
18
17
|
/**
|
|
19
18
|
* Reflects Platform.OS. TV platforms are intentionally NOT separate values:
|
|
20
19
|
* - Android TV has Platform.OS === 'android' (react-native-tvos behavior)
|
|
21
20
|
* - tvOS has Platform.OS === 'ios' (react-native-tvos behavior)
|
|
22
|
-
* Use `
|
|
21
|
+
* Use `IS_TV` combined with `IS_ANDROID`/`IS_IOS` to detect specific TV platforms.
|
|
23
22
|
*/
|
|
24
|
-
export declare const
|
|
23
|
+
export declare const CURRENT_PLATFORM: CurrentPlatform;
|
|
25
24
|
export {};
|
|
26
25
|
|
|
27
26
|
//# sourceMappingURL=platform.native.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAKA,cAA+B,iBAAiB;AAGhD,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM
|
|
2
|
+
"mappings": "AAKA,cAA+B,iBAAiB;AAGhD,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM,kCAAkC;AAC/C,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;AAEb,OAAO,cAAM;AAGb,OAAO,cAAM;AAKb,OAAO,cAAM;AAIb,OAAO,cAAM;AAEb,OAAO,cAAM;KAKR,kBAAkB,QAAQ,QAAQ,WAAW,YAAY,UAAU;;;;;;;AAgBxE,OAAO,cAAM,kBAAkB",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/platform.native.ts"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"// platform booleans, react-native variant.\n// Mirrors @tamagui/constants (native) so @take-out/helpers carries no @tamagui/* runtime dep.\n// react-native is an optional peer dep and is always present in the native runtime\n// where this file is loaded, so importing it here is safe.\n\nimport { useLayoutEffect, type useEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const
|
|
9
|
+
"// platform booleans, react-native variant.\n// Mirrors @tamagui/constants (native) so @take-out/helpers carries no @tamagui/* runtime dep.\n// react-native is an optional peer dep and is always present in the native runtime\n// where this file is loaded, so importing it here is safe.\n\nimport { useLayoutEffect, type useEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const IS_WEB: boolean = false\nexport const IS_BROWSER: boolean = false\nexport const IS_SERVER: boolean = false\nexport const IS_SERVER_RUNTIME: boolean = false\nexport const IS_CLIENT: boolean = true\nexport const useIsomorphicLayoutEffect: typeof useEffect = useLayoutEffect\nexport const IS_CHROME: boolean = false\nexport const IS_WEB_TOUCHABLE: boolean = false\nexport const IS_NATIVE_DESKTOP: boolean =\n Platform?.OS === 'macos' || Platform?.OS === 'windows'\nexport const IS_TOUCHABLE: boolean = !IS_NATIVE_DESKTOP\n// optional chain required: babel extractor loads native.cjs in node where Platform is undefined\n// on Android TV: Platform.OS === 'android' per react-native-tvos\nexport const IS_ANDROID: boolean =\n Platform?.OS === 'android' ||\n process.env.TEST_NATIVE_PLATFORM === 'android' ||\n process.env.TEST_NATIVE_PLATFORM === 'androidtv'\n// on tvOS: Platform.OS === 'ios' per react-native-tvos\nexport const IS_IOS: boolean =\n Platform?.OS === 'ios' ||\n process.env.TEST_NATIVE_PLATFORM === 'ios' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\nexport const SUPPORTS_DYNAMIC_COLOR_IOS: boolean =\n IS_IOS || process.env.TAMAGUI_DYNAMIC_COLOR_IOS === '1'\nexport const IS_TV: boolean =\n Platform?.isTV ||\n process.env.TEST_NATIVE_PLATFORM === 'androidtv' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\n\ntype CurrentPlatform = 'web' | 'ios' | 'native' | 'android' | 'macos' | 'windows'\n\n// Platform.OS includes 'web' in its type (PlatformOSType) but never at native runtime,\n// so the map is partial — any unmapped OS falls through to 'native'.\nconst platforms: Partial<Record<typeof Platform.OS, CurrentPlatform>> = {\n ios: 'ios',\n android: 'android',\n macos: 'macos',\n windows: 'windows',\n}\n/**\n * Reflects Platform.OS. TV platforms are intentionally NOT separate values:\n * - Android TV has Platform.OS === 'android' (react-native-tvos behavior)\n * - tvOS has Platform.OS === 'ios' (react-native-tvos behavior)\n * Use `IS_TV` combined with `IS_ANDROID`/`IS_IOS` to detect specific TV platforms.\n */\nexport const CURRENT_PLATFORM: CurrentPlatform =\n (Platform?.OS ? platforms[Platform.OS] : undefined) || 'native'\n\n// In Metro source mode, TAMAGUI_TARGET may not be set by the build tool.\n// Set it here so all process.env.TAMAGUI_TARGET runtime checks work correctly.\n// In pre-built dist, the build tool inlines TAMAGUI_TARGET as a literal string,\n// making this block dead code (if (!'native') → never executes).\nif (!process.env.TAMAGUI_TARGET) {\n process.env.TAMAGUI_TARGET = 'native'\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: () => from[key],
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
23
|
-
var isServerRuntime_exports = {};
|
|
24
|
-
__export(isServerRuntime_exports, {
|
|
25
|
-
isServerRuntime: () => isServerRuntime
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(isServerRuntime_exports);
|
|
28
|
-
function isServerRuntime() {
|
|
29
|
-
if (process.env.VITE_ENVIRONMENT === "ssr") return true;
|
|
30
|
-
if (process.env.VITE_ENVIRONMENT === "client") return false;
|
|
31
|
-
return typeof process !== "undefined" && !!process.versions && !!(process.versions.node || process.versions.bun);
|
|
32
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
25
|
-
var isServerRuntime_exports = {};
|
|
26
|
-
__export(isServerRuntime_exports, {
|
|
27
|
-
isServerRuntime: () => isServerRuntime
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(isServerRuntime_exports);
|
|
30
|
-
function isServerRuntime() {
|
|
31
|
-
if (process.env.VITE_ENVIRONMENT === "ssr") return true;
|
|
32
|
-
if (process.env.VITE_ENVIRONMENT === "client") return false;
|
|
33
|
-
return typeof process !== "undefined" && !!process.versions && !!(process.versions.node || process.versions.bun);
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=isServerRuntime.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","isServerRuntime_exports","__export","isServerRuntime","module","exports","process","env","VITE_ENVIRONMENT","versions","node","bun"],"sources":["../../../src/server/isServerRuntime.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAOC,MAAA,CAAAC,OAAS,GAAAT,YAA2B,CAAAK,uBAAA;AAEzC,SAAIE,eAAYA,CAAA;EAChB,IAAIG,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB,cAAU,IAAO;EAEtD,IAAAF,OACE,CAAAC,GAAO,CAAAC,gBAAY,aACjB,SAAQ;EAGd,cAAAF,OAAA,sBAAAA,OAAA,CAAAG,QAAA,OAAAH,OAAA,CAAAG,QAAA,CAAAC,IAAA,IAAAJ,OAAA,CAAAG,QAAA,CAAAE,GAAA","ignoreList":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
function isServerRuntime() {
|
|
2
|
-
if (process.env.VITE_ENVIRONMENT === "ssr") return true;
|
|
3
|
-
if (process.env.VITE_ENVIRONMENT === "client") return false;
|
|
4
|
-
return typeof process !== "undefined" && !!process.versions && !!(process.versions.node || process.versions.bun);
|
|
5
|
-
}
|
|
6
|
-
export { isServerRuntime };
|
|
7
|
-
//# sourceMappingURL=isServerRuntime.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["isServerRuntime","process","env","VITE_ENVIRONMENT","versions","node","bun"],"sources":["../../../src/server/isServerRuntime.ts"],"sourcesContent":[null],"mappings":"AAAO,SAASA,gBAAA,EAA2B;EAEzC,IAAIC,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB,OAAO,OAAO;EACnD,IAAIF,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB,UAAU,OAAO;EAEtD,OACE,OAAOF,OAAA,KAAY,eACnB,CAAC,CAACA,OAAA,CAAQG,QAAA,IACV,CAAC,EAAEH,OAAA,CAAQG,QAAA,CAASC,IAAA,IAASJ,OAAA,CAAQG,QAAA,CAAiBE,GAAA;AAE1D","ignoreList":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
function isServerRuntime() {
|
|
2
|
-
if (process.env.VITE_ENVIRONMENT === "ssr") return true;
|
|
3
|
-
if (process.env.VITE_ENVIRONMENT === "client") return false;
|
|
4
|
-
return typeof process !== "undefined" && !!process.versions && !!(process.versions.node || process.versions.bun);
|
|
5
|
-
}
|
|
6
|
-
export { isServerRuntime };
|
|
7
|
-
//# sourceMappingURL=isServerRuntime.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["isServerRuntime","process","env","VITE_ENVIRONMENT","versions","node","bun"],"sources":["../../../src/server/isServerRuntime.ts"],"sourcesContent":[null],"mappings":"AAAO,SAASA,gBAAA,EAA2B;EAEzC,IAAIC,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB,OAAO,OAAO;EACnD,IAAIF,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB,UAAU,OAAO;EAEtD,OACE,OAAOF,OAAA,KAAY,eACnB,CAAC,CAACA,OAAA,CAAQG,QAAA,IACV,CAAC,EAAEH,OAAA,CAAQG,QAAA,CAASC,IAAA,IAASJ,OAAA,CAAQG,QAAA,CAAiBE,GAAA;AAE1D","ignoreList":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function isServerRuntime(): boolean {
|
|
2
|
-
// explicit env override (vite replaces at build time, enabling DCE)
|
|
3
|
-
if (process.env.VITE_ENVIRONMENT === 'ssr') return true
|
|
4
|
-
if (process.env.VITE_ENVIRONMENT === 'client') return false
|
|
5
|
-
// auto-detect node/bun server runtime
|
|
6
|
-
return (
|
|
7
|
-
typeof process !== 'undefined' &&
|
|
8
|
-
!!process.versions &&
|
|
9
|
-
!!(process.versions.node || (process.versions as any).bun)
|
|
10
|
-
)
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mappings": "AAAA,OAAO,iBAAS",
|
|
3
|
-
"names": [],
|
|
4
|
-
"sources": [
|
|
5
|
-
"src/server/isServerRuntime.ts"
|
|
6
|
-
],
|
|
7
|
-
"version": 3,
|
|
8
|
-
"sourcesContent": [
|
|
9
|
-
"export function isServerRuntime(): boolean {\n // explicit env override (vite replaces at build time, enabling DCE)\n if (process.env.VITE_ENVIRONMENT === 'ssr') return true\n if (process.env.VITE_ENVIRONMENT === 'client') return false\n // auto-detect node/bun server runtime\n return (\n typeof process !== 'undefined' &&\n !!process.versions &&\n !!(process.versions.node || (process.versions as any).bun)\n )\n}\n"
|
|
10
|
-
]
|
|
11
|
-
}
|