@xylabs/crypto 4.0.10 → 4.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"cryptoPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/cryptoPolyfill.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,YAK1B,CAAA"}
1
+ {"version":3,"file":"cryptoPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/cryptoPolyfill.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,YAE1B,CAAA"}
@@ -2,12 +2,8 @@
2
2
  import { default as default2 } from "crypto-js";
3
3
 
4
4
  // src/browser/cryptoPolyfill.ts
5
- import { getGlobal } from "@xylabs/platform";
6
5
  var cryptoPolyfill = () => {
7
- const global = getGlobal();
8
- if (global) {
9
- global.Crypto = global.Crypto === void 0 ? default2 : { ...default2, ...global.Crypto };
10
- }
6
+ globalThis.Crypto = globalThis.Crypto ?? default2;
11
7
  };
12
8
  export {
13
9
  default2 as Crypto,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/browser/Crypto.ts","../../src/browser/cryptoPolyfill.ts"],"sourcesContent":["export { default as Crypto } from 'crypto-js'\n","import { getGlobal } from '@xylabs/platform'\n\nimport { Crypto } from './Crypto.ts'\n\ntype WithOptionalCrypto = { Crypto?: typeof Crypto }\n\nexport const cryptoPolyfill = () => {\n const global = getGlobal<WithOptionalCrypto>()\n if (global) {\n global.Crypto = global.Crypto === undefined ? Crypto : { ...Crypto, ...global.Crypto }\n }\n}\n"],"mappings":";AAAA,SAAoB,WAAXA,gBAAyB;;;ACAlC,SAAS,iBAAiB;AAMnB,IAAM,iBAAiB,MAAM;AAClC,QAAM,SAAS,UAA8B;AAC7C,MAAI,QAAQ;AACV,WAAO,SAAS,OAAO,WAAW,SAAYC,WAAS,EAAE,GAAGA,UAAQ,GAAG,OAAO,OAAO;AAAA,EACvF;AACF;","names":["default","default"]}
1
+ {"version":3,"sources":["../../src/browser/Crypto.ts","../../src/browser/cryptoPolyfill.ts"],"sourcesContent":["export { default as Crypto } from 'crypto-js'\n","import { Crypto } from './Crypto.ts'\n\nexport const cryptoPolyfill = () => {\n globalThis.Crypto = globalThis.Crypto ?? Crypto\n}\n"],"mappings":";AAAA,SAAoB,WAAXA,gBAAyB;;;ACE3B,IAAM,iBAAiB,MAAM;AAClC,aAAW,SAAS,WAAW,UAAUC;AAC3C;","names":["default","default"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/crypto",
3
- "version": "4.0.10",
3
+ "version": "4.1.0",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "crypto",
@@ -40,16 +40,15 @@
40
40
  "module": "./dist/node/index.mjs",
41
41
  "types": "./dist/node/index.d.ts",
42
42
  "dependencies": {
43
- "@xylabs/platform": "^4.0.10",
44
43
  "crypto-js": "^4.2.0"
45
44
  },
46
45
  "devDependencies": {
47
46
  "@types/crypto-js": "^4.2.2",
48
- "@types/node": "^22.5.4",
49
- "@xylabs/ts-scripts-yarn3": "^4.0.7",
50
- "@xylabs/tsconfig": "^4.0.7",
51
- "@xylabs/tsconfig-dom": "^4.0.7",
52
- "typescript": "^5.5.4"
47
+ "@types/node": "^22.7.5",
48
+ "@xylabs/ts-scripts-yarn3": "^4.1.0",
49
+ "@xylabs/tsconfig": "^4.1.0",
50
+ "@xylabs/tsconfig-dom": "^4.1.0",
51
+ "typescript": "^5.6.2"
53
52
  },
54
53
  "engines": {
55
54
  "node": ">=18"
@@ -1,12 +1,5 @@
1
- import { getGlobal } from '@xylabs/platform'
2
-
3
1
  import { Crypto } from './Crypto.ts'
4
2
 
5
- type WithOptionalCrypto = { Crypto?: typeof Crypto }
6
-
7
3
  export const cryptoPolyfill = () => {
8
- const global = getGlobal<WithOptionalCrypto>()
9
- if (global) {
10
- global.Crypto = global.Crypto === undefined ? Crypto : { ...Crypto, ...global.Crypto }
11
- }
4
+ globalThis.Crypto = globalThis.Crypto ?? Crypto
12
5
  }