@xylabs/platform 5.0.83 → 5.0.86

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 CHANGED
@@ -15,6 +15,8 @@
15
15
 
16
16
  Base functionality used throughout XY Labs TypeScript/JavaScript libraries
17
17
 
18
+
19
+
18
20
  ## Reference
19
21
 
20
22
  **@xylabs/platform**
@@ -23,8 +25,10 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
23
25
 
24
26
  ## Modules
25
27
 
26
- - [index-browser](#index-browser/README)
27
- - [index-node](#index-node/README)
28
+ | Module | Description |
29
+ | ------ | ------ |
30
+ | [index-browser](#index-browser/README) | - |
31
+ | [index-node](#index-node/README) | - |
28
32
 
29
33
  ### index-browser
30
34
 
@@ -40,6 +44,8 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
40
44
  function isBrowser(): boolean;
41
45
  ```
42
46
 
47
+ Returns whether the current environment is a browser window (not a web worker).
48
+
43
49
  ## Returns
44
50
 
45
51
  `boolean`
@@ -54,6 +60,8 @@ function isBrowser(): boolean;
54
60
  function isNode(): boolean;
55
61
  ```
56
62
 
63
+ Returns whether the current environment is Node.js. Always returns false in the browser entry point.
64
+
57
65
  ## Returns
58
66
 
59
67
  `boolean`
@@ -68,6 +76,8 @@ function isNode(): boolean;
68
76
  function isWebworker(): boolean;
69
77
  ```
70
78
 
79
+ Returns whether the current environment is a dedicated web worker.
80
+
71
81
  ## Returns
72
82
 
73
83
  `boolean`
@@ -84,6 +94,8 @@ function isWebworker(): boolean;
84
94
  const subtle: SubtleCrypto;
85
95
  ```
86
96
 
97
+ The Web Crypto API's SubtleCrypto interface, sourced from the browser's globalThis.crypto.
98
+
87
99
  ### index-node
88
100
 
89
101
  ### functions
@@ -98,6 +110,8 @@ const subtle: SubtleCrypto;
98
110
  function isBrowser(): boolean;
99
111
  ```
100
112
 
113
+ Returns whether the current environment is a browser. Always returns false in Node.js.
114
+
101
115
  ## Returns
102
116
 
103
117
  `boolean`
@@ -112,6 +126,8 @@ function isBrowser(): boolean;
112
126
  function isNode(): boolean;
113
127
  ```
114
128
 
129
+ Returns whether the current environment is Node.js. Always returns true in this entry point.
130
+
115
131
  ## Returns
116
132
 
117
133
  `boolean`
@@ -126,6 +142,8 @@ function isNode(): boolean;
126
142
  function isWebworker(): boolean;
127
143
  ```
128
144
 
145
+ Returns whether the current environment is a web worker. Always returns false in Node.js.
146
+
129
147
  ## Returns
130
148
 
131
149
  `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":";AAEO,IAAM,YAAY,MAAM;AAC7B,SAAO,CAAC,YAAY,KAAK,WAAW,aAAa,SAAS;AAC5D;AAEO,IAAM,cAAc,MAAM;AAC/B,SAAO,OAAO,eAAe,YAAY,WAAW,aAAa,SAAS;AAC5E;AAEO,IAAM,SAAS,MAAM;AAC1B,SAAO;AACT;AAEO,IAAM,SAAS,WAAW,OAAO;","names":[]}
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":["export { subtle } from 'node:crypto'\n\nexport const isBrowser = () => {\n return false\n}\n\nexport const isWebworker = () => {\n return false\n}\n\nexport const isNode = () => {\n return true\n}\n"],"mappings":";AAAA,SAAS,cAAc;AAEhB,IAAM,YAAY,MAAM;AAC7B,SAAO;AACT;AAEO,IAAM,cAAc,MAAM;AAC/B,SAAO;AACT;AAEO,IAAM,SAAS,MAAM;AAC1B,SAAO;AACT;","names":[]}
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.83",
3
+ "version": "5.0.86",
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.11",
52
- "@xylabs/tsconfig": "~7.4.11",
51
+ "@xylabs/ts-scripts-yarn3": "~7.4.16",
52
+ "@xylabs/tsconfig": "~7.4.16",
53
53
  "typescript": "~5.9.3",
54
54
  "vitest": "~4.0.18"
55
55
  },