typed-array-byte-offset 1.0.2 → 1.0.3
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/CHANGELOG.md +14 -0
- package/index.js +3 -4
- package/package.json +16 -11
- package/test/index.js +1 -0
- package/tsconfig.json +8 -47
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [v1.0.3](https://github.com/inspect-js/typed-array-byte-offset/compare/v1.0.2...v1.0.3) - 2024-11-21
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- [Fix] avoid relying on `__proto__` accessor [`#4`](https://github.com/inspect-js/typed-array-byte-offset/issues/4)
|
|
13
|
+
|
|
14
|
+
### Commits
|
|
15
|
+
|
|
16
|
+
- [types] use shared config [`10b0823`](https://github.com/inspect-js/typed-array-byte-offset/commit/10b0823ecc13b95920cfa8f27fe61af5678fb67b)
|
|
17
|
+
- [actions] split out node 10-20, and 20+ [`11554a9`](https://github.com/inspect-js/typed-array-byte-offset/commit/11554a96ca11b85c7ad87118e1d811bfde2b9f32)
|
|
18
|
+
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@types/object-inspect`, `auto-changelog`, `object-inspect`, `tape` [`c39dd06`](https://github.com/inspect-js/typed-array-byte-offset/commit/c39dd06d2868a724463722ff2f416b5c41171140)
|
|
19
|
+
- [Tests] run tsc and `@arethetypeswrong/cli` in CI [`0b984aa`](https://github.com/inspect-js/typed-array-byte-offset/commit/0b984aa64c86f4bcb476b716cdd16d67c39b68ca)
|
|
20
|
+
- [Tests] replace `aud` with `npm audit` [`512b59d`](https://github.com/inspect-js/typed-array-byte-offset/commit/512b59df0e567592282795bfec331193d828f2fc)
|
|
21
|
+
|
|
8
22
|
## [v1.0.2](https://github.com/inspect-js/typed-array-byte-offset/compare/v1.0.1...v1.0.2) - 2024-02-20
|
|
9
23
|
|
|
10
24
|
### Commits
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var forEach = require('for-each');
|
|
4
4
|
var callBind = require('call-bind');
|
|
5
|
+
var gPO = require('reflect.getprototypeof/polyfill')();
|
|
5
6
|
|
|
6
7
|
var typedArrays = require('available-typed-arrays')();
|
|
7
8
|
|
|
@@ -10,7 +11,6 @@ var typedArrays = require('available-typed-arrays')();
|
|
|
10
11
|
|
|
11
12
|
/** @type {Object.<typeof typedArrays, ByteOffsetGetter>} */
|
|
12
13
|
var getters = {};
|
|
13
|
-
var hasProto = require('has-proto')();
|
|
14
14
|
|
|
15
15
|
var gOPD = require('gopd');
|
|
16
16
|
var oDP = Object.defineProperty;
|
|
@@ -25,9 +25,8 @@ if (gOPD) {
|
|
|
25
25
|
var Proto = global[typedArray].prototype;
|
|
26
26
|
// @ts-expect-error TS can't guarantee the callback is invoked sync
|
|
27
27
|
var descriptor = gOPD(Proto, 'byteOffset');
|
|
28
|
-
if (!descriptor
|
|
29
|
-
|
|
30
|
-
var superProto = Proto.__proto__; // eslint-disable-line no-proto
|
|
28
|
+
if (!descriptor) {
|
|
29
|
+
var superProto = gPO(Proto);
|
|
31
30
|
// @ts-expect-error TS can't guarantee the callback is invoked sync
|
|
32
31
|
descriptor = gOPD(superProto, 'byteOffset');
|
|
33
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typed-array-byte-offset",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Robustly get the byte offset of a Typed Array",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
"pretest": "npm run lint",
|
|
17
17
|
"prelint": "evalmd README.md",
|
|
18
18
|
"lint": "eslint --ext=js,mjs .",
|
|
19
|
+
"postlint": "tsc -p . && attw -P",
|
|
19
20
|
"tests-only": "nyc tape 'test/**/*.js'",
|
|
20
21
|
"test": "npm run tests-only",
|
|
21
|
-
"posttest": "
|
|
22
|
+
"posttest": "npx npm@'>=10.2' audit --production",
|
|
22
23
|
"version": "auto-changelog && git add CHANGELOG.md",
|
|
23
24
|
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
|
24
25
|
},
|
|
@@ -61,20 +62,23 @@
|
|
|
61
62
|
"for-each": "^0.3.3",
|
|
62
63
|
"gopd": "^1.0.1",
|
|
63
64
|
"has-proto": "^1.0.3",
|
|
64
|
-
"is-typed-array": "^1.1.13"
|
|
65
|
+
"is-typed-array": "^1.1.13",
|
|
66
|
+
"reflect.getprototypeof": "^1.0.6"
|
|
65
67
|
},
|
|
66
68
|
"devDependencies": {
|
|
67
|
-
"@
|
|
69
|
+
"@arethetypeswrong/cli": "^0.17.0",
|
|
70
|
+
"@ljharb/eslint-config": "^21.1.1",
|
|
71
|
+
"@ljharb/tsconfig": "^0.2.0",
|
|
68
72
|
"@types/call-bind": "^1.0.5",
|
|
73
|
+
"@types/es-abstract": "^1.17.9",
|
|
69
74
|
"@types/for-each": "^0.3.3",
|
|
70
75
|
"@types/gopd": "^1.0.3",
|
|
71
76
|
"@types/is-callable": "^1.1.2",
|
|
72
77
|
"@types/make-arrow-function": "^1.2.2",
|
|
73
78
|
"@types/make-generator-function": "^2.0.3",
|
|
74
|
-
"@types/object-inspect": "^1.
|
|
79
|
+
"@types/object-inspect": "^1.13.0",
|
|
75
80
|
"@types/tape": "^5.6.4",
|
|
76
|
-
"
|
|
77
|
-
"auto-changelog": "^2.4.0",
|
|
81
|
+
"auto-changelog": "^2.5.0",
|
|
78
82
|
"eslint": "=8.8.0",
|
|
79
83
|
"evalmd": "^0.0.19",
|
|
80
84
|
"in-publish": "^2.0.1",
|
|
@@ -83,11 +87,11 @@
|
|
|
83
87
|
"make-generator-function": "^2.0.0",
|
|
84
88
|
"npmignore": "^0.3.1",
|
|
85
89
|
"nyc": "^10.3.2",
|
|
86
|
-
"object-inspect": "^1.13.
|
|
90
|
+
"object-inspect": "^1.13.3",
|
|
87
91
|
"possible-typed-array-names": "^1.0.0",
|
|
88
92
|
"safe-publish-latest": "^2.0.0",
|
|
89
|
-
"tape": "^5.
|
|
90
|
-
"typescript": "
|
|
93
|
+
"tape": "^5.9.0",
|
|
94
|
+
"typescript": "next"
|
|
91
95
|
},
|
|
92
96
|
"engines": {
|
|
93
97
|
"node": ">= 0.4"
|
|
@@ -105,7 +109,8 @@
|
|
|
105
109
|
},
|
|
106
110
|
"publishConfig": {
|
|
107
111
|
"ignore": [
|
|
108
|
-
".github/workflows"
|
|
112
|
+
".github/workflows",
|
|
113
|
+
"types"
|
|
109
114
|
]
|
|
110
115
|
}
|
|
111
116
|
}
|
package/test/index.js
CHANGED
|
@@ -67,6 +67,7 @@ test('Typed Arrays', function (t) {
|
|
|
67
67
|
var buffer = new ArrayBuffer(length);
|
|
68
68
|
var TypedArray = global[typedArray];
|
|
69
69
|
if (isCallable(TypedArray)) {
|
|
70
|
+
// @ts-expect-error hush, TS, TAs can take an optional byte offset arg
|
|
70
71
|
var arr = new TypedArray(buffer, byteOffset);
|
|
71
72
|
t.equal(typedArrayByteOffset(arr), byteOffset, 'new ' + typedArray + '(new ArrayBuffer(' + length + '), ' + byteOffset + ') is typed array of byte offset ' + byteOffset);
|
|
72
73
|
} else {
|
package/tsconfig.json
CHANGED
|
@@ -1,49 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
11
|
-
"useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
12
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
13
|
-
|
|
14
|
-
/* Modules */
|
|
15
|
-
"module": "commonjs", /* Specify what module code is generated. */
|
|
16
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
17
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
18
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
19
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
20
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
21
|
-
"typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
22
|
-
"resolveJsonModule": true, /* Enable importing .json files. */
|
|
23
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
24
|
-
|
|
25
|
-
/* JavaScript Support */
|
|
26
|
-
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
27
|
-
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
28
|
-
"maxNodeModuleJsDepth": 0, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
29
|
-
|
|
30
|
-
/* Emit */
|
|
31
|
-
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
32
|
-
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
33
|
-
"noEmit": true, /* Disable emitting files from a compilation. */
|
|
34
|
-
|
|
35
|
-
/* Interop Constraints */
|
|
36
|
-
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
37
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
38
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
39
|
-
|
|
40
|
-
/* Type Checking */
|
|
41
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
42
|
-
|
|
43
|
-
/* Completeness */
|
|
44
|
-
//"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
45
|
-
},
|
|
46
|
-
"exclude": [
|
|
47
|
-
"coverage"
|
|
48
|
-
]
|
|
2
|
+
"extends": "@ljharb/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2021",
|
|
5
|
+
"maxNodeModuleJsDepth": 0,
|
|
6
|
+
},
|
|
7
|
+
"exclude": [
|
|
8
|
+
"coverage",
|
|
9
|
+
],
|
|
49
10
|
}
|