@xylabs/platform 2.12.28 → 2.12.30

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.
@@ -17,14 +17,15 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
20
+ // src/browser/index.ts
21
+ var browser_exports = {};
22
+ __export(browser_exports, {
23
23
  getGlobal: () => getGlobal,
24
24
  isBrowser: () => isBrowser,
25
- isWebworker: () => isWebworker
25
+ isWebworker: () => isWebworker,
26
+ subtle: () => subtle
26
27
  });
27
- module.exports = __toCommonJS(src_exports);
28
+ module.exports = __toCommonJS(browser_exports);
28
29
  var isBrowser = () => {
29
30
  return typeof window !== "undefined" && typeof window?.document !== "undefined";
30
31
  };
@@ -32,4 +33,5 @@ var isWebworker = () => {
32
33
  return typeof self === "object" && self.constructor?.name === "DedicatedWorkerGlobalScope";
33
34
  };
34
35
  var getGlobal = () => isBrowser() ? window : isWebworker() ? self : globalThis;
36
+ var subtle = getGlobal().subtle;
35
37
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const isBrowser = () => {\n return typeof window !== 'undefined' && typeof window?.document !== 'undefined'\n}\n\nexport const isWebworker = () => {\n return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const getGlobal = <T extends object>() => (isBrowser() ? (window as unknown as T) : isWebworker() ? (self as unknown as T) : globalThis)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,YAAY,MAAM;AAC7B,SAAO,OAAO,WAAW,eAAe,OAAO,QAAQ,aAAa;AACtE;AAEO,IAAM,cAAc,MAAM;AAC/B,SAAO,OAAO,SAAS,YAAY,KAAK,aAAa,SAAS;AAChE;AAEO,IAAM,YAAY,MAAyB,UAAU,IAAK,SAA0B,YAAY,IAAK,OAAwB;","names":[]}
1
+ {"version":3,"sources":["../../src/browser/index.ts"],"sourcesContent":["import type { subtle as subtleType } from 'crypto'\n\nexport const isBrowser = () => {\n return typeof window !== 'undefined' && typeof window?.document !== 'undefined'\n}\n\nexport const isWebworker = () => {\n return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const getGlobal = <T extends object>() => (isBrowser() ? (window as unknown as T) : isWebworker() ? (self as unknown as T) : globalThis)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const subtle = (getGlobal() as any).subtle as typeof subtleType\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,YAAY,MAAM;AAC7B,SAAO,OAAO,WAAW,eAAe,OAAO,QAAQ,aAAa;AACtE;AAEO,IAAM,cAAc,MAAM;AAC/B,SAAO,OAAO,SAAS,YAAY,KAAK,aAAa,SAAS;AAChE;AAEO,IAAM,YAAY,MAAyB,UAAU,IAAK,SAA0B,YAAY,IAAK,OAAwB;AAG7H,IAAM,SAAU,UAAU,EAAU;","names":[]}
@@ -1,4 +1,6 @@
1
+ /// <reference types="node" />
1
2
  export declare const isBrowser: () => boolean;
2
3
  export declare const isWebworker: () => boolean;
3
4
  export declare const getGlobal: <T extends object>() => typeof globalThis | T;
5
+ export declare const subtle: import("crypto").webcrypto.SubtleCrypto;
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA;AAG/I,eAAO,MAAM,MAAM,yCAAmD,CAAA"}
@@ -1,4 +1,6 @@
1
+ /// <reference types="node" />
1
2
  export declare const isBrowser: () => boolean;
2
3
  export declare const isWebworker: () => boolean;
3
4
  export declare const getGlobal: <T extends object>() => typeof globalThis | T;
5
+ export declare const subtle: import("crypto").webcrypto.SubtleCrypto;
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA;AAG/I,eAAO,MAAM,MAAM,yCAAmD,CAAA"}
@@ -1,4 +1,6 @@
1
+ /// <reference types="node" />
1
2
  export declare const isBrowser: () => boolean;
2
3
  export declare const isWebworker: () => boolean;
3
4
  export declare const getGlobal: <T extends object>() => typeof globalThis | T;
5
+ export declare const subtle: import("crypto").webcrypto.SubtleCrypto;
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA;AAG/I,eAAO,MAAM,MAAM,yCAAmD,CAAA"}
@@ -1,4 +1,4 @@
1
- // src/index.ts
1
+ // src/browser/index.ts
2
2
  var isBrowser = () => {
3
3
  return typeof window !== "undefined" && typeof window?.document !== "undefined";
4
4
  };
@@ -6,9 +6,11 @@ var isWebworker = () => {
6
6
  return typeof self === "object" && self.constructor?.name === "DedicatedWorkerGlobalScope";
7
7
  };
8
8
  var getGlobal = () => isBrowser() ? window : isWebworker() ? self : globalThis;
9
+ var subtle = getGlobal().subtle;
9
10
  export {
10
11
  getGlobal,
11
12
  isBrowser,
12
- isWebworker
13
+ isWebworker,
14
+ subtle
13
15
  };
14
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const isBrowser = () => {\n return typeof window !== 'undefined' && typeof window?.document !== 'undefined'\n}\n\nexport const isWebworker = () => {\n return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const getGlobal = <T extends object>() => (isBrowser() ? (window as unknown as T) : isWebworker() ? (self as unknown as T) : globalThis)\n"],"mappings":";AAAO,IAAM,YAAY,MAAM;AAC7B,SAAO,OAAO,WAAW,eAAe,OAAO,QAAQ,aAAa;AACtE;AAEO,IAAM,cAAc,MAAM;AAC/B,SAAO,OAAO,SAAS,YAAY,KAAK,aAAa,SAAS;AAChE;AAEO,IAAM,YAAY,MAAyB,UAAU,IAAK,SAA0B,YAAY,IAAK,OAAwB;","names":[]}
1
+ {"version":3,"sources":["../../src/browser/index.ts"],"sourcesContent":["import type { subtle as subtleType } from 'crypto'\n\nexport const isBrowser = () => {\n return typeof window !== 'undefined' && typeof window?.document !== 'undefined'\n}\n\nexport const isWebworker = () => {\n return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const getGlobal = <T extends object>() => (isBrowser() ? (window as unknown as T) : isWebworker() ? (self as unknown as T) : globalThis)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const subtle = (getGlobal() as any).subtle as typeof subtleType\n"],"mappings":";AAEO,IAAM,YAAY,MAAM;AAC7B,SAAO,OAAO,WAAW,eAAe,OAAO,QAAQ,aAAa;AACtE;AAEO,IAAM,cAAc,MAAM;AAC/B,SAAO,OAAO,SAAS,YAAY,KAAK,aAAa,SAAS;AAChE;AAEO,IAAM,YAAY,MAAyB,UAAU,IAAK,SAA0B,YAAY,IAAK,OAAwB;AAG7H,IAAM,SAAU,UAAU,EAAU;","names":[]}
@@ -17,14 +17,16 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
20
+ // src/node/index.ts
21
+ var node_exports = {};
22
+ __export(node_exports, {
23
23
  getGlobal: () => getGlobal,
24
24
  isBrowser: () => isBrowser,
25
- isWebworker: () => isWebworker
25
+ isWebworker: () => isWebworker,
26
+ subtle: () => import_crypto.subtle
26
27
  });
27
- module.exports = __toCommonJS(src_exports);
28
+ module.exports = __toCommonJS(node_exports);
29
+ var import_crypto = require("crypto");
28
30
  var isBrowser = () => {
29
31
  return typeof window !== "undefined" && typeof (window == null ? void 0 : window.document) !== "undefined";
30
32
  };
@@ -37,6 +39,7 @@ var getGlobal = () => isBrowser() ? window : isWebworker() ? self : globalThis;
37
39
  0 && (module.exports = {
38
40
  getGlobal,
39
41
  isBrowser,
40
- isWebworker
42
+ isWebworker,
43
+ subtle
41
44
  });
42
45
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const isBrowser = () => {\n return typeof window !== 'undefined' && typeof window?.document !== 'undefined'\n}\n\nexport const isWebworker = () => {\n return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const getGlobal = <T extends object>() => (isBrowser() ? (window as unknown as T) : isWebworker() ? (self as unknown as T) : globalThis)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,YAAY,MAAM;AAC7B,SAAO,OAAO,WAAW,eAAe,QAAO,iCAAQ,cAAa;AACtE;AAEO,IAAM,cAAc,MAAM;AAJjC;AAKE,SAAO,OAAO,SAAS,cAAY,UAAK,gBAAL,mBAAkB,UAAS;AAChE;AAEO,IAAM,YAAY,MAAyB,UAAU,IAAK,SAA0B,YAAY,IAAK,OAAwB;","names":[]}
1
+ {"version":3,"sources":["../../src/node/index.ts"],"sourcesContent":["export { subtle } from 'crypto'\n\nexport const isBrowser = () => {\n return typeof window !== 'undefined' && typeof window?.document !== 'undefined'\n}\n\nexport const isWebworker = () => {\n return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const getGlobal = <T extends object>() => (isBrowser() ? (window as unknown as T) : isWebworker() ? (self as unknown as T) : globalThis)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAEhB,IAAM,YAAY,MAAM;AAC7B,SAAO,OAAO,WAAW,eAAe,QAAO,iCAAQ,cAAa;AACtE;AAEO,IAAM,cAAc,MAAM;AANjC;AAOE,SAAO,OAAO,SAAS,cAAY,UAAK,gBAAL,mBAAkB,UAAS;AAChE;AAEO,IAAM,YAAY,MAAyB,UAAU,IAAK,SAA0B,YAAY,IAAK,OAAwB;","names":[]}
@@ -1,3 +1,4 @@
1
+ export { subtle } from 'crypto';
1
2
  export declare const isBrowser: () => boolean;
2
3
  export declare const isWebworker: () => boolean;
3
4
  export declare const getGlobal: <T extends object>() => typeof globalThis | T;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA"}
@@ -1,3 +1,4 @@
1
+ export { subtle } from 'crypto';
1
2
  export declare const isBrowser: () => boolean;
2
3
  export declare const isWebworker: () => boolean;
3
4
  export declare const getGlobal: <T extends object>() => typeof globalThis | T;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA"}
@@ -1,3 +1,4 @@
1
+ export { subtle } from 'crypto';
1
2
  export declare const isBrowser: () => boolean;
2
3
  export declare const isWebworker: () => boolean;
3
4
  export declare const getGlobal: <T extends object>() => typeof globalThis | T;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,eAAO,MAAM,SAAS,eAErB,CAAA;AAED,eAAO,MAAM,WAAW,eAEvB,CAAA;AAED,eAAO,MAAM,SAAS,+CAAyH,CAAA"}
@@ -1,4 +1,5 @@
1
- // src/index.ts
1
+ // src/node/index.ts
2
+ import { subtle } from "crypto";
2
3
  var isBrowser = () => {
3
4
  return typeof window !== "undefined" && typeof (window == null ? void 0 : window.document) !== "undefined";
4
5
  };
@@ -10,6 +11,7 @@ var getGlobal = () => isBrowser() ? window : isWebworker() ? self : globalThis;
10
11
  export {
11
12
  getGlobal,
12
13
  isBrowser,
13
- isWebworker
14
+ isWebworker,
15
+ subtle
14
16
  };
15
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const isBrowser = () => {\n return typeof window !== 'undefined' && typeof window?.document !== 'undefined'\n}\n\nexport const isWebworker = () => {\n return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const getGlobal = <T extends object>() => (isBrowser() ? (window as unknown as T) : isWebworker() ? (self as unknown as T) : globalThis)\n"],"mappings":";AAAO,IAAM,YAAY,MAAM;AAC7B,SAAO,OAAO,WAAW,eAAe,QAAO,iCAAQ,cAAa;AACtE;AAEO,IAAM,cAAc,MAAM;AAJjC;AAKE,SAAO,OAAO,SAAS,cAAY,UAAK,gBAAL,mBAAkB,UAAS;AAChE;AAEO,IAAM,YAAY,MAAyB,UAAU,IAAK,SAA0B,YAAY,IAAK,OAAwB;","names":[]}
1
+ {"version":3,"sources":["../../src/node/index.ts"],"sourcesContent":["export { subtle } from 'crypto'\n\nexport const isBrowser = () => {\n return typeof window !== 'undefined' && typeof window?.document !== 'undefined'\n}\n\nexport const isWebworker = () => {\n return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const getGlobal = <T extends object>() => (isBrowser() ? (window as unknown as T) : isWebworker() ? (self as unknown as T) : globalThis)\n"],"mappings":";AAAA,SAAS,cAAc;AAEhB,IAAM,YAAY,MAAM;AAC7B,SAAO,OAAO,WAAW,eAAe,QAAO,iCAAQ,cAAa;AACtE;AAEO,IAAM,cAAc,MAAM;AANjC;AAOE,SAAO,OAAO,SAAS,cAAY,UAAK,gBAAL,mBAAkB,UAAS;AAChE;AAEO,IAAM,YAAY,MAAyB,UAAU,IAAK,SAA0B,YAAY,IAAK,OAAwB;","names":[]}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "license": "LGPL-3.0",
2
+ "license": "LGPL-3.0-only",
3
3
  "name": "@xylabs/platform",
4
4
  "author": {
5
5
  "email": "support@xylabs.com",
@@ -46,9 +46,9 @@
46
46
  "esm"
47
47
  ],
48
48
  "devDependencies": {
49
- "@xylabs/ts-scripts-yarn3": "^3.1.11",
50
- "@xylabs/tsconfig": "^3.1.11",
51
- "@xylabs/tsconfig-dom": "^3.1.11",
49
+ "@xylabs/ts-scripts-yarn3": "^3.1.12",
50
+ "@xylabs/tsconfig": "^3.1.12",
51
+ "@xylabs/tsconfig-dom": "^3.1.12",
52
52
  "typescript": "^5.2.2"
53
53
  },
54
54
  "publishConfig": {
@@ -59,6 +59,6 @@
59
59
  "url": "https://github.com/xylabs/sdk-js.git"
60
60
  },
61
61
  "sideEffects": false,
62
- "version": "2.12.28",
62
+ "version": "2.12.30",
63
63
  "type": "module"
64
64
  }
@@ -0,0 +1,14 @@
1
+ import type { subtle as subtleType } from 'crypto'
2
+
3
+ export const isBrowser = () => {
4
+ return typeof window !== 'undefined' && typeof window?.document !== 'undefined'
5
+ }
6
+
7
+ export const isWebworker = () => {
8
+ return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'
9
+ }
10
+
11
+ export const getGlobal = <T extends object>() => (isBrowser() ? (window as unknown as T) : isWebworker() ? (self as unknown as T) : globalThis)
12
+
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ export const subtle = (getGlobal() as any).subtle as typeof subtleType
@@ -1,3 +1,5 @@
1
+ export { subtle } from 'crypto'
2
+
1
3
  export const isBrowser = () => {
2
4
  return typeof window !== 'undefined' && typeof window?.document !== 'undefined'
3
5
  }
package/xy.config.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
+ const config: XyTsupConfig = {
3
+ compile: {
4
+ browser: {
5
+ 'src/browser': true,
6
+ },
7
+ node: {
8
+ 'src/node': true,
9
+ },
10
+ },
11
+ }
12
+
13
+ // eslint-disable-next-line import/no-default-export
14
+ export default config