@xylabs/platform 5.0.83 → 5.0.84
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/README.md +14 -0
- package/dist/browser/browser/index.d.ts +4 -0
- package/dist/browser/browser/index.d.ts.map +1 -1
- package/dist/browser/index-browser.mjs.map +1 -1
- package/dist/browser/node/index.d.ts +4 -0
- package/dist/browser/node/index.d.ts.map +1 -1
- package/dist/node/browser/index.d.ts +4 -0
- package/dist/node/browser/index.d.ts.map +1 -1
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/node/index.d.ts +4 -0
- package/dist/node/node/index.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -40,6 +40,8 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
40
40
|
function isBrowser(): boolean;
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
Returns whether the current environment is a browser window (not a web worker).
|
|
44
|
+
|
|
43
45
|
## Returns
|
|
44
46
|
|
|
45
47
|
`boolean`
|
|
@@ -54,6 +56,8 @@ function isBrowser(): boolean;
|
|
|
54
56
|
function isNode(): boolean;
|
|
55
57
|
```
|
|
56
58
|
|
|
59
|
+
Returns whether the current environment is Node.js. Always returns false in the browser entry point.
|
|
60
|
+
|
|
57
61
|
## Returns
|
|
58
62
|
|
|
59
63
|
`boolean`
|
|
@@ -68,6 +72,8 @@ function isNode(): boolean;
|
|
|
68
72
|
function isWebworker(): boolean;
|
|
69
73
|
```
|
|
70
74
|
|
|
75
|
+
Returns whether the current environment is a dedicated web worker.
|
|
76
|
+
|
|
71
77
|
## Returns
|
|
72
78
|
|
|
73
79
|
`boolean`
|
|
@@ -84,6 +90,8 @@ function isWebworker(): boolean;
|
|
|
84
90
|
const subtle: SubtleCrypto;
|
|
85
91
|
```
|
|
86
92
|
|
|
93
|
+
The Web Crypto API's SubtleCrypto interface, sourced from the browser's globalThis.crypto.
|
|
94
|
+
|
|
87
95
|
### index-node
|
|
88
96
|
|
|
89
97
|
### functions
|
|
@@ -98,6 +106,8 @@ const subtle: SubtleCrypto;
|
|
|
98
106
|
function isBrowser(): boolean;
|
|
99
107
|
```
|
|
100
108
|
|
|
109
|
+
Returns whether the current environment is a browser. Always returns false in Node.js.
|
|
110
|
+
|
|
101
111
|
## Returns
|
|
102
112
|
|
|
103
113
|
`boolean`
|
|
@@ -112,6 +122,8 @@ function isBrowser(): boolean;
|
|
|
112
122
|
function isNode(): boolean;
|
|
113
123
|
```
|
|
114
124
|
|
|
125
|
+
Returns whether the current environment is Node.js. Always returns true in this entry point.
|
|
126
|
+
|
|
115
127
|
## Returns
|
|
116
128
|
|
|
117
129
|
`boolean`
|
|
@@ -126,6 +138,8 @@ function isNode(): boolean;
|
|
|
126
138
|
function isWebworker(): boolean;
|
|
127
139
|
```
|
|
128
140
|
|
|
141
|
+
Returns whether the current environment is a web worker. Always returns false in Node.js.
|
|
142
|
+
|
|
129
143
|
## Returns
|
|
130
144
|
|
|
131
145
|
`boolean`
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { subtle as subtleType } from 'node:crypto';
|
|
2
|
+
/** Returns whether the current environment is a browser window (not a web worker). */
|
|
2
3
|
export declare const isBrowser: () => boolean;
|
|
4
|
+
/** Returns whether the current environment is a dedicated web worker. */
|
|
3
5
|
export declare const isWebworker: () => boolean;
|
|
6
|
+
/** Returns whether the current environment is Node.js. Always returns false in the browser entry point. */
|
|
4
7
|
export declare const isNode: () => boolean;
|
|
8
|
+
/** The Web Crypto API's SubtleCrypto interface, sourced from the browser's globalThis.crypto. */
|
|
5
9
|
export declare const subtle: typeof subtleType;
|
|
6
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AAEvD,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,MAAM,eAElB,CAAA;AAED,eAAO,MAAM,MAAM,EAA+B,OAAO,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AAEvD,sFAAsF;AACtF,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,yEAAyE;AACzE,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,2GAA2G;AAC3G,eAAO,MAAM,MAAM,eAElB,CAAA;AAED,iGAAiG;AACjG,eAAO,MAAM,MAAM,EAA+B,OAAO,UAAU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/browser/index.ts"],"sourcesContent":["import type { subtle as subtleType } from 'node:crypto'\n\nexport const isBrowser = () => {\n return !isWebworker() && globalThis.constructor?.name === 'Window'\n}\n\nexport const isWebworker = () => {\n return typeof globalThis === 'object' && globalThis.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const isNode = () => {\n return false\n}\n\nexport const subtle = globalThis.crypto.subtle as typeof subtleType\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../src/browser/index.ts"],"sourcesContent":["import type { subtle as subtleType } from 'node:crypto'\n\n/** Returns whether the current environment is a browser window (not a web worker). */\nexport const isBrowser = () => {\n return !isWebworker() && globalThis.constructor?.name === 'Window'\n}\n\n/** Returns whether the current environment is a dedicated web worker. */\nexport const isWebworker = () => {\n return typeof globalThis === 'object' && globalThis.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\n/** Returns whether the current environment is Node.js. Always returns false in the browser entry point. */\nexport const isNode = () => {\n return false\n}\n\n/** The Web Crypto API's SubtleCrypto interface, sourced from the browser's globalThis.crypto. */\nexport const subtle = globalThis.crypto.subtle as typeof subtleType\n"],"mappings":";AAGO,IAAM,YAAY,MAAM;AAC7B,SAAO,CAAC,YAAY,KAAK,WAAW,aAAa,SAAS;AAC5D;AAGO,IAAM,cAAc,MAAM;AAC/B,SAAO,OAAO,eAAe,YAAY,WAAW,aAAa,SAAS;AAC5E;AAGO,IAAM,SAAS,MAAM;AAC1B,SAAO;AACT;AAGO,IAAM,SAAS,WAAW,OAAO;","names":[]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
/** The Web Crypto API's SubtleCrypto interface, re-exported from Node.js crypto module. */
|
|
1
2
|
export { subtle } from 'node:crypto';
|
|
3
|
+
/** Returns whether the current environment is a browser. Always returns false in Node.js. */
|
|
2
4
|
export declare const isBrowser: () => boolean;
|
|
5
|
+
/** Returns whether the current environment is a web worker. Always returns false in Node.js. */
|
|
3
6
|
export declare const isWebworker: () => boolean;
|
|
7
|
+
/** Returns whether the current environment is Node.js. Always returns true in this entry point. */
|
|
4
8
|
export declare const isNode: () => boolean;
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,MAAM,eAElB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,6FAA6F;AAC7F,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,gGAAgG;AAChG,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,mGAAmG;AACnG,eAAO,MAAM,MAAM,eAElB,CAAA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { subtle as subtleType } from 'node:crypto';
|
|
2
|
+
/** Returns whether the current environment is a browser window (not a web worker). */
|
|
2
3
|
export declare const isBrowser: () => boolean;
|
|
4
|
+
/** Returns whether the current environment is a dedicated web worker. */
|
|
3
5
|
export declare const isWebworker: () => boolean;
|
|
6
|
+
/** Returns whether the current environment is Node.js. Always returns false in the browser entry point. */
|
|
4
7
|
export declare const isNode: () => boolean;
|
|
8
|
+
/** The Web Crypto API's SubtleCrypto interface, sourced from the browser's globalThis.crypto. */
|
|
5
9
|
export declare const subtle: typeof subtleType;
|
|
6
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AAEvD,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,MAAM,eAElB,CAAA;AAED,eAAO,MAAM,MAAM,EAA+B,OAAO,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AAEvD,sFAAsF;AACtF,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,yEAAyE;AACzE,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,2GAA2G;AAC3G,eAAO,MAAM,MAAM,eAElB,CAAA;AAED,iGAAiG;AACjG,eAAO,MAAM,MAAM,EAA+B,OAAO,UAAU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/node/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/node/index.ts"],"sourcesContent":["/** The Web Crypto API's SubtleCrypto interface, re-exported from Node.js crypto module. */\nexport { subtle } from 'node:crypto'\n\n/** Returns whether the current environment is a browser. Always returns false in Node.js. */\nexport const isBrowser = () => {\n return false\n}\n\n/** Returns whether the current environment is a web worker. Always returns false in Node.js. */\nexport const isWebworker = () => {\n return false\n}\n\n/** Returns whether the current environment is Node.js. Always returns true in this entry point. */\nexport const isNode = () => {\n return true\n}\n"],"mappings":";AACA,SAAS,cAAc;AAGhB,IAAM,YAAY,MAAM;AAC7B,SAAO;AACT;AAGO,IAAM,cAAc,MAAM;AAC/B,SAAO;AACT;AAGO,IAAM,SAAS,MAAM;AAC1B,SAAO;AACT;","names":[]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
/** The Web Crypto API's SubtleCrypto interface, re-exported from Node.js crypto module. */
|
|
1
2
|
export { subtle } from 'node:crypto';
|
|
3
|
+
/** Returns whether the current environment is a browser. Always returns false in Node.js. */
|
|
2
4
|
export declare const isBrowser: () => boolean;
|
|
5
|
+
/** Returns whether the current environment is a web worker. Always returns false in Node.js. */
|
|
3
6
|
export declare const isWebworker: () => boolean;
|
|
7
|
+
/** Returns whether the current environment is Node.js. Always returns true in this entry point. */
|
|
4
8
|
export declare const isNode: () => boolean;
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,MAAM,eAElB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,6FAA6F;AAC7F,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,gGAAgG;AAChG,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,mGAAmG;AACnG,eAAO,MAAM,MAAM,eAElB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/platform",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.84",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"platform",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"!**/*.test.*"
|
|
49
49
|
],
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
52
|
-
"@xylabs/tsconfig": "~7.4.
|
|
51
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.13",
|
|
52
|
+
"@xylabs/tsconfig": "~7.4.13",
|
|
53
53
|
"typescript": "~5.9.3",
|
|
54
54
|
"vitest": "~4.0.18"
|
|
55
55
|
},
|