@xylabs/buffer 2.12.25 β†’ 2.12.26

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
@@ -1,50 +1,49 @@
1
1
  [![logo][]](https://xylabs.com)
2
2
 
3
- # @xylabs/sdk-js
3
+ # @xylabs/buffer
4
4
 
5
- [![main-build][]][main-build-link]
6
- [![beta-build][]][beta-build-link]
7
5
  [![npm-badge][]][npm-link]
8
- [![bch-badge][]][bch-link]
9
- [![codacy-badge][]][codacy-link]
10
- [![codeclimate-badge][]][codeclimate-link]
11
- [![snyk-badge][]][snyk-link]
6
+ [![npm-downloads-badge][]][npm-link]
7
+ [![jsdelivr-badge][]][jsdelivr-link]
8
+ [![npm-license-badge][]](LICENSE)
9
+
10
+ > XY Labs generalized Javascript library
12
11
 
13
12
  ## Table of Contents
14
13
 
15
14
  - [Description](#description)
16
15
  - [Install](#install)
17
- - [Scripts](#scripts)
18
16
  - [Maintainers](#maintainers)
19
17
  - [License](#license)
20
18
  - [Credits](#credits)
21
19
 
22
20
  ## Description
23
21
 
24
- SDK for base code for Typescript and Javascript Libraries.
22
+ Common Javascript code that is used throughout XYO projects that use React.
25
23
 
26
24
  ## Install
27
25
 
28
26
  Using npm:
29
27
 
30
28
  ```sh
31
- npm i --save @xylabs/sdk-js
29
+ npm i --save @xylabs/buffer
32
30
  ```
33
31
 
34
32
  Using yarn:
35
33
 
36
34
  ```sh
37
- yarn add @xylabs/sdk-js
35
+ yarn add @xylabs/buffer
38
36
  ```
39
37
 
40
- ## Scripts
41
-
42
- See [ts-scripts](https://github.com/xylabs/ts-scripts/blob/main/README.md)
43
- for list of shared scripts.
38
+ ## Documentation
39
+ [Developer Reference](https://xylabs.github.io/sdk-js)
44
40
 
45
41
  ## Maintainers
46
42
 
47
- - [Arie Trouw](https://github.com/arietrouw) (<https://arietrouw.com>)
43
+ - [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
44
+ - [Joel Carter](https://github.com/JoelBCarter)
45
+ - [Matt Jones](https://github.com/jonesmac)
46
+ - [Jordan Trouw](https://github.com/jordantrouw)
48
47
 
49
48
  ## License
50
49
 
@@ -52,20 +51,15 @@ See the [LICENSE](LICENSE) file for license details
52
51
 
53
52
  ## Credits
54
53
 
55
- [Made with πŸ”₯ and ❄️ by XY Labs](https://xylabs.com)
54
+ [Made with πŸ”₯and ❄️ by XY Labs](https://xylabs.com)
56
55
 
57
56
  [logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
58
- [main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build-main.yml/badge.svg
59
- [main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build-main.yml
60
- [beta-build]: https://github.com/xylabs/sdk-js/actions/workflows/build-beta.yml/badge.svg
61
- [beta-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build-beta.yml
62
- [npm-badge]: https://img.shields.io/npm/v/@xylabs/sdk-js.svg
63
- [npm-link]: https://www.npmjs.com/package/@xylabs/sdk-js
64
- [bch-badge]: https://bettercodehub.com/edge/badge/xylabs/sdk-js?branch=main
65
- [bch-link]: https://bettercodehub.com/results/xylabs/sdk-js
66
- [codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
67
- [codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
68
- [codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
69
- [codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
70
- [snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
71
- [snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
57
+
58
+ [npm-badge]: https://img.shields.io/npm/v/@xylabs/buffer.svg
59
+ [npm-link]: https://www.npmjs.com/package/@xylabs/buffer
60
+
61
+ [npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/buffer
62
+ [npm-license-badge]: https://img.shields.io/npm/l/@xylabs/buffer
63
+
64
+ [jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/buffer/badge
65
+ [jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/buffer
@@ -1 +1 @@
1
- {"version":3,"file":"bufferPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/bufferPolyfill.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,cAAc,YAK1B,CAAA"}
1
+ {"version":3,"file":"bufferPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/bufferPolyfill.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,YAK1B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"bufferPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/bufferPolyfill.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,cAAc,YAK1B,CAAA"}
1
+ {"version":3,"file":"bufferPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/bufferPolyfill.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,YAK1B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"bufferPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/bufferPolyfill.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,cAAc,YAK1B,CAAA"}
1
+ {"version":3,"file":"bufferPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/bufferPolyfill.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,YAK1B,CAAA"}
@@ -26,15 +26,10 @@ __export(browser_exports, {
26
26
  module.exports = __toCommonJS(browser_exports);
27
27
 
28
28
  // src/browser/bufferPolyfill.ts
29
+ var import_platform = require("@xylabs/platform");
29
30
  var import_buffer = require("buffer/");
30
- var isBrowser = () => {
31
- return typeof window !== "undefined" && typeof window?.document !== "undefined";
32
- };
33
- var isWebworker = () => {
34
- return typeof self === "object" && self.constructor?.name === "DedicatedWorkerGlobalScope";
35
- };
36
31
  var bufferPolyfill = () => {
37
- const global = isBrowser() ? window : isWebworker() ? self : void 0;
32
+ const global = (0, import_platform.getGlobal)();
38
33
  if (global && global.Buffer === void 0) {
39
34
  global.Buffer = import_buffer.Buffer;
40
35
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/browser/index.ts","../../src/browser/bufferPolyfill.ts"],"sourcesContent":["import { bufferPolyfill } from './bufferPolyfill'\nexport { Buffer } from 'buffer/'\n\nexport { bufferPolyfill }\n","import { Buffer } from 'buffer/'\n\ntype WithOptionalBuffer = { Buffer?: typeof Buffer }\n\nconst isBrowser = () => {\n return typeof window !== 'undefined' && typeof window?.document !== 'undefined'\n}\n\nconst isWebworker = () => {\n return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const bufferPolyfill = () => {\n const global = isBrowser() ? (window as unknown as WithOptionalBuffer) : isWebworker() ? (self as unknown as WithOptionalBuffer) : undefined\n if (global && global.Buffer === undefined) {\n global.Buffer = Buffer\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAuB;AAIvB,IAAM,YAAY,MAAM;AACtB,SAAO,OAAO,WAAW,eAAe,OAAO,QAAQ,aAAa;AACtE;AAEA,IAAM,cAAc,MAAM;AACxB,SAAO,OAAO,SAAS,YAAY,KAAK,aAAa,SAAS;AAChE;AAEO,IAAM,iBAAiB,MAAM;AAClC,QAAM,SAAS,UAAU,IAAK,SAA2C,YAAY,IAAK,OAAyC;AACnI,MAAI,UAAU,OAAO,WAAW,QAAW;AACzC,WAAO,SAAS;AAAA,EAClB;AACF;;;ADhBA,IAAAA,iBAAuB;","names":["import_buffer"]}
1
+ {"version":3,"sources":["../../src/browser/index.ts","../../src/browser/bufferPolyfill.ts"],"sourcesContent":["import { bufferPolyfill } from './bufferPolyfill'\nexport { Buffer } from 'buffer/'\n\nexport { bufferPolyfill }\n","import { getGlobal } from '@xylabs/platform'\nimport { Buffer } from 'buffer/'\n\ntype WithOptionalBuffer = { Buffer?: typeof Buffer }\n\nexport const bufferPolyfill = () => {\n const global = getGlobal<WithOptionalBuffer>()\n if (global && global.Buffer === undefined) {\n global.Buffer = Buffer\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAA0B;AAC1B,oBAAuB;AAIhB,IAAM,iBAAiB,MAAM;AAClC,QAAM,aAAS,2BAA8B;AAC7C,MAAI,UAAU,OAAO,WAAW,QAAW;AACzC,WAAO,SAAS;AAAA,EAClB;AACF;;;ADTA,IAAAA,iBAAuB;","names":["import_buffer"]}
@@ -1,13 +1,8 @@
1
1
  // src/browser/bufferPolyfill.ts
2
+ import { getGlobal } from "@xylabs/platform";
2
3
  import { Buffer } from "buffer/";
3
- var isBrowser = () => {
4
- return typeof window !== "undefined" && typeof window?.document !== "undefined";
5
- };
6
- var isWebworker = () => {
7
- return typeof self === "object" && self.constructor?.name === "DedicatedWorkerGlobalScope";
8
- };
9
4
  var bufferPolyfill = () => {
10
- const global = isBrowser() ? window : isWebworker() ? self : void 0;
5
+ const global = getGlobal();
11
6
  if (global && global.Buffer === void 0) {
12
7
  global.Buffer = Buffer;
13
8
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/browser/bufferPolyfill.ts","../../src/browser/index.ts"],"sourcesContent":["import { Buffer } from 'buffer/'\n\ntype WithOptionalBuffer = { Buffer?: typeof Buffer }\n\nconst isBrowser = () => {\n return typeof window !== 'undefined' && typeof window?.document !== 'undefined'\n}\n\nconst isWebworker = () => {\n return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'\n}\n\nexport const bufferPolyfill = () => {\n const global = isBrowser() ? (window as unknown as WithOptionalBuffer) : isWebworker() ? (self as unknown as WithOptionalBuffer) : undefined\n if (global && global.Buffer === undefined) {\n global.Buffer = Buffer\n }\n}\n","import { bufferPolyfill } from './bufferPolyfill'\nexport { Buffer } from 'buffer/'\n\nexport { bufferPolyfill }\n"],"mappings":";AAAA,SAAS,cAAc;AAIvB,IAAM,YAAY,MAAM;AACtB,SAAO,OAAO,WAAW,eAAe,OAAO,QAAQ,aAAa;AACtE;AAEA,IAAM,cAAc,MAAM;AACxB,SAAO,OAAO,SAAS,YAAY,KAAK,aAAa,SAAS;AAChE;AAEO,IAAM,iBAAiB,MAAM;AAClC,QAAM,SAAS,UAAU,IAAK,SAA2C,YAAY,IAAK,OAAyC;AACnI,MAAI,UAAU,OAAO,WAAW,QAAW;AACzC,WAAO,SAAS;AAAA,EAClB;AACF;;;AChBA,SAAS,UAAAA,eAAc;","names":["Buffer"]}
1
+ {"version":3,"sources":["../../src/browser/bufferPolyfill.ts","../../src/browser/index.ts"],"sourcesContent":["import { getGlobal } from '@xylabs/platform'\nimport { Buffer } from 'buffer/'\n\ntype WithOptionalBuffer = { Buffer?: typeof Buffer }\n\nexport const bufferPolyfill = () => {\n const global = getGlobal<WithOptionalBuffer>()\n if (global && global.Buffer === undefined) {\n global.Buffer = Buffer\n }\n}\n","import { bufferPolyfill } from './bufferPolyfill'\nexport { Buffer } from 'buffer/'\n\nexport { bufferPolyfill }\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAIhB,IAAM,iBAAiB,MAAM;AAClC,QAAM,SAAS,UAA8B;AAC7C,MAAI,UAAU,OAAO,WAAW,QAAW;AACzC,WAAO,SAAS;AAAA,EAClB;AACF;;;ACTA,SAAS,UAAAA,eAAc;","names":["Buffer"]}
package/package.json CHANGED
@@ -33,9 +33,6 @@
33
33
  "default": "./dist/node/index.js"
34
34
  }
35
35
  },
36
- "./docs": {
37
- "default": "./dist/docs.json"
38
- },
39
36
  "./package.json": "./package.json"
40
37
  },
41
38
  "main": "./dist/node/index.cjs",
@@ -49,13 +46,14 @@
49
46
  "esm"
50
47
  ],
51
48
  "dependencies": {
49
+ "@xylabs/platform": "~2.12.26",
52
50
  "buffer": "^6.0.3"
53
51
  },
54
52
  "devDependencies": {
55
- "@types/node": "^20.8.4",
56
- "@xylabs/ts-scripts-yarn3": "^3.1.7",
57
- "@xylabs/tsconfig": "^3.1.7",
58
- "@xylabs/tsconfig-dom": "^3.1.7",
53
+ "@types/node": "^20.8.6",
54
+ "@xylabs/ts-scripts-yarn3": "^3.1.11",
55
+ "@xylabs/tsconfig": "^3.1.11",
56
+ "@xylabs/tsconfig-dom": "^3.1.11",
59
57
  "typescript": "^5.2.2"
60
58
  },
61
59
  "publishConfig": {
@@ -66,6 +64,6 @@
66
64
  "url": "https://github.com/xylabs/sdk-js.git"
67
65
  },
68
66
  "sideEffects": false,
69
- "version": "2.12.25",
67
+ "version": "2.12.26",
70
68
  "type": "module"
71
69
  }
@@ -1,17 +1,10 @@
1
+ import { getGlobal } from '@xylabs/platform'
1
2
  import { Buffer } from 'buffer/'
2
3
 
3
4
  type WithOptionalBuffer = { Buffer?: typeof Buffer }
4
5
 
5
- const isBrowser = () => {
6
- return typeof window !== 'undefined' && typeof window?.document !== 'undefined'
7
- }
8
-
9
- const isWebworker = () => {
10
- return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'
11
- }
12
-
13
6
  export const bufferPolyfill = () => {
14
- const global = isBrowser() ? (window as unknown as WithOptionalBuffer) : isWebworker() ? (self as unknown as WithOptionalBuffer) : undefined
7
+ const global = getGlobal<WithOptionalBuffer>()
15
8
  if (global && global.Buffer === undefined) {
16
9
  global.Buffer = Buffer
17
10
  }