@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 +25 -31
- package/dist/browser/bufferPolyfill.d.cts.map +1 -1
- package/dist/browser/bufferPolyfill.d.mts.map +1 -1
- package/dist/browser/bufferPolyfill.d.ts.map +1 -1
- package/dist/browser/index.cjs +2 -7
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +2 -7
- package/dist/browser/index.js.map +1 -1
- package/package.json +6 -8
- package/src/browser/bufferPolyfill.ts +2 -9
package/README.md
CHANGED
|
@@ -1,50 +1,49 @@
|
|
|
1
1
|
[![logo][]](https://xylabs.com)
|
|
2
2
|
|
|
3
|
-
# @xylabs/
|
|
3
|
+
# @xylabs/buffer
|
|
4
4
|
|
|
5
|
-
[![main-build][]][main-build-link]
|
|
6
|
-
[![beta-build][]][beta-build-link]
|
|
7
5
|
[![npm-badge][]][npm-link]
|
|
8
|
-
[![
|
|
9
|
-
[![
|
|
10
|
-
[![
|
|
11
|
-
|
|
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
|
-
|
|
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/
|
|
29
|
+
npm i --save @xylabs/buffer
|
|
32
30
|
```
|
|
33
31
|
|
|
34
32
|
Using yarn:
|
|
35
33
|
|
|
36
34
|
```sh
|
|
37
|
-
yarn add @xylabs/
|
|
35
|
+
yarn add @xylabs/buffer
|
|
38
36
|
```
|
|
39
37
|
|
|
40
|
-
##
|
|
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) (
|
|
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 π₯
|
|
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
|
-
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
|
|
62
|
-
[npm-badge]: https://img.shields.io/npm/
|
|
63
|
-
[npm-
|
|
64
|
-
|
|
65
|
-
[
|
|
66
|
-
[
|
|
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":"
|
|
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":"
|
|
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":"
|
|
1
|
+
{"version":3,"file":"bufferPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/bufferPolyfill.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,YAK1B,CAAA"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -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 =
|
|
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 {
|
|
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"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -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 =
|
|
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 {
|
|
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.
|
|
56
|
-
"@xylabs/ts-scripts-yarn3": "^3.1.
|
|
57
|
-
"@xylabs/tsconfig": "^3.1.
|
|
58
|
-
"@xylabs/tsconfig-dom": "^3.1.
|
|
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.
|
|
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 =
|
|
7
|
+
const global = getGlobal<WithOptionalBuffer>()
|
|
15
8
|
if (global && global.Buffer === undefined) {
|
|
16
9
|
global.Buffer = Buffer
|
|
17
10
|
}
|