lib0 1.0.0-rc.21 → 1.0.0-rc.22
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/environment.d.ts +6 -0
- package/package.json +1 -1
- package/src/environment.js +22 -10
package/dist/environment.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ export const isNode: boolean;
|
|
|
4
4
|
* @type {boolean}
|
|
5
5
|
*/
|
|
6
6
|
export const isDeno: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* True iff this script is running in a browser-family environment — either a DOM main
|
|
9
|
+
* thread (`window` + `document`) or a WebWorker / ServiceWorker (a `WorkerGlobalScope`,
|
|
10
|
+
* which has `btoa`/`atob`/`fetch` but no DOM). Excludes Node and Deno.
|
|
11
|
+
* @type {boolean}
|
|
12
|
+
*/
|
|
7
13
|
export const isBrowser: boolean;
|
|
8
14
|
export const isMac: boolean;
|
|
9
15
|
/**
|
package/package.json
CHANGED
package/src/environment.js
CHANGED
|
@@ -21,8 +21,29 @@ export const isNode = /* @__PURE__ */(() => typeof process !== 'undefined' && pr
|
|
|
21
21
|
// @ts-ignore
|
|
22
22
|
export const isDeno = /* @__PURE__ */(() => typeof Deno !== 'undefined')()
|
|
23
23
|
|
|
24
|
+
/* c8 ignore start */
|
|
25
|
+
const globalScope = /* @__PURE__ */(() =>/** @type {any} */ (typeof globalThis !== 'undefined'
|
|
26
|
+
? globalThis
|
|
27
|
+
: typeof window !== 'undefined'
|
|
28
|
+
? window
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
: typeof global !== 'undefined' ? global : {}))()
|
|
31
|
+
/* c8 ignore stop */
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* True iff this script is running in a browser-family environment — either a DOM main
|
|
35
|
+
* thread (`window` + `document`) or a WebWorker / ServiceWorker (a `WorkerGlobalScope`,
|
|
36
|
+
* which has `btoa`/`atob`/`fetch` but no DOM). Excludes Node and Deno.
|
|
37
|
+
* @type {boolean}
|
|
38
|
+
*/
|
|
24
39
|
/* c8 ignore next */
|
|
25
|
-
export const isBrowser = /* @__PURE__ */(() =>
|
|
40
|
+
export const isBrowser = /* @__PURE__ */(() =>
|
|
41
|
+
!isNode && !isDeno && (
|
|
42
|
+
(typeof window !== 'undefined' && typeof document !== 'undefined') ||
|
|
43
|
+
// WebWorker / ServiceWorker: no window/document, but a worker global scope
|
|
44
|
+
(typeof globalScope.WorkerGlobalScope !== 'undefined' && globalScope.self instanceof globalScope.WorkerGlobalScope)
|
|
45
|
+
)
|
|
46
|
+
)()
|
|
26
47
|
/* c8 ignore next */
|
|
27
48
|
export const isMac = /* @__PURE__ */(() => typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false)()
|
|
28
49
|
|
|
@@ -168,13 +189,4 @@ export const supportsColor = /* @__PURE__ */(() => forceColor || (
|
|
|
168
189
|
))()
|
|
169
190
|
/* c8 ignore stop */
|
|
170
191
|
|
|
171
|
-
/* c8 ignore start */
|
|
172
|
-
const globalScope = /* @__PURE__ */(() =>/** @type {any} */ (typeof globalThis !== 'undefined'
|
|
173
|
-
? globalThis
|
|
174
|
-
: typeof window !== 'undefined'
|
|
175
|
-
? window
|
|
176
|
-
// @ts-ignore
|
|
177
|
-
: typeof global !== 'undefined' ? global : {}))()
|
|
178
|
-
/* c8 ignore stop */
|
|
179
|
-
|
|
180
192
|
export { globalScope as global }
|