@loaders.gl/polyfills 4.1.0-alpha.1 → 4.1.0-alpha.11

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.
Files changed (36) hide show
  1. package/dist/fetch/fetch-polyfill.d.ts.map +1 -1
  2. package/dist/fetch/fetch-polyfill.js.map +1 -1
  3. package/dist/fetch/response-polyfill.d.ts.map +1 -1
  4. package/dist/fetch/response-polyfill.js.map +1 -1
  5. package/dist/filesystems/fetch-node.d.ts.map +1 -1
  6. package/dist/filesystems/fetch-node.js.map +1 -1
  7. package/dist/filesystems/node-file.d.ts +3 -1
  8. package/dist/filesystems/node-file.d.ts.map +1 -1
  9. package/dist/filesystems/node-file.js +26 -0
  10. package/dist/filesystems/node-file.js.map +1 -1
  11. package/dist/filesystems/node-filesystem.d.ts.map +1 -1
  12. package/dist/filesystems/node-filesystem.js.map +1 -1
  13. package/dist/filesystems/stream-utils.node.d.ts.map +1 -1
  14. package/dist/filesystems/stream-utils.node.js.map +1 -1
  15. package/dist/images/parse-image-node.d.ts.map +1 -1
  16. package/dist/images/parse-image-node.js.map +1 -1
  17. package/dist/images/parse-image.node.d.ts.map +1 -1
  18. package/dist/images/parse-image.node.js.map +1 -1
  19. package/dist/index.browser.d.ts.map +1 -1
  20. package/dist/index.browser.js.map +1 -1
  21. package/dist/index.cjs +29 -0
  22. package/dist/libs/encoding-indexes-asian.js +13 -2
  23. package/dist/utils/is-browser.d.ts.map +1 -1
  24. package/dist/utils/is-browser.js.map +1 -1
  25. package/package.json +6 -6
  26. package/src/fetch/fetch-polyfill.ts +2 -1
  27. package/src/fetch/response-polyfill.ts +2 -1
  28. package/src/filesystems/fetch-node.ts +2 -1
  29. package/src/filesystems/node-file.ts +29 -1
  30. package/src/filesystems/node-filesystem.ts +2 -1
  31. package/src/filesystems/stream-utils.node.ts +2 -1
  32. package/src/images/parse-image-node.ts +2 -1
  33. package/src/images/parse-image.node.ts +2 -1
  34. package/src/index.browser.ts +2 -1
  35. package/src/utils/is-browser.ts +2 -1
  36. package/dist/libs/encoding-indexes-asian.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"is-browser.d.ts","sourceRoot":"","sources":["../../src/utils/is-browser.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,EAAE,OAEkE,CAAC"}
1
+ {"version":3,"file":"is-browser.d.ts","sourceRoot":"","sources":["../../src/utils/is-browser.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,EAAE,OAEkE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-browser.js","names":["isBrowser","process","String","browser"],"sources":["../../src/utils/is-browser.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable no-restricted-globals */\nexport const isBrowser: boolean =\n // @ts-ignore process.browser\n typeof process !== 'object' || String(process) !== '[object process]' || process.browser;\n"],"mappings":"AAIA,OAAO,MAAMA,SAAkB,GAE7B,OAAOC,OAAO,KAAK,QAAQ,IAAIC,MAAM,CAACD,OAAO,CAAC,KAAK,kBAAkB,IAAIA,OAAO,CAACE,OAAO"}
1
+ {"version":3,"file":"is-browser.js","names":["isBrowser","process","String","browser"],"sources":["../../src/utils/is-browser.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable no-restricted-globals */\nexport const isBrowser: boolean =\n // @ts-ignore process.browser\n typeof process !== 'object' || String(process) !== '[object process]' || process.browser;\n"],"mappings":"AAKA,OAAO,MAAMA,SAAkB,GAE7B,OAAOC,OAAO,KAAK,QAAQ,IAAIC,MAAM,CAACD,OAAO,CAAC,KAAK,kBAAkB,IAAIA,OAAO,CAACE,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/polyfills",
3
- "version": "4.1.0-alpha.1",
3
+ "version": "4.1.0-alpha.11",
4
4
  "description": "Polyfills for TextEncoder/TextDecoder",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,9 +23,9 @@
23
23
  "module": "dist/index.js",
24
24
  "exports": {
25
25
  ".": {
26
+ "types": "./dist/index.d.ts",
26
27
  "import": "./dist/index.js",
27
- "require": "./dist/index.cjs",
28
- "types": "./dist/index.d.ts"
28
+ "require": "./dist/index.cjs"
29
29
  }
30
30
  },
31
31
  "files": [
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@babel/runtime": "^7.3.1",
49
- "@loaders.gl/crypto": "4.1.0-alpha.1",
50
- "@loaders.gl/loader-utils": "4.1.0-alpha.1",
49
+ "@loaders.gl/crypto": "4.1.0-alpha.11",
50
+ "@loaders.gl/loader-utils": "4.1.0-alpha.11",
51
51
  "buffer": "^6.0.3",
52
52
  "get-pixels": "^3.3.3",
53
53
  "ndarray": "^1.0.19",
@@ -56,5 +56,5 @@
56
56
  "through": "^2.3.8",
57
57
  "web-streams-polyfill": "^3.2.1"
58
58
  },
59
- "gitHead": "6a4d3da93d45115ad99861474a43c3f4a0b280a7"
59
+ "gitHead": "5d3e23bf93762b48c8c1d6d926ede7a97fe43ab0"
60
60
  }
@@ -1,4 +1,5 @@
1
- // loaders.gl, MIT license
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import http from 'http';
@@ -1,4 +1,5 @@
1
- // loaders.gl, MIT license
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import {assert} from '../utils/assert';
@@ -1,4 +1,5 @@
1
- // loaders.gl, MIT license
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import fs from 'fs';
@@ -8,7 +8,7 @@ export class NodeFile implements ReadableFile, WritableFile {
8
8
  bigsize: bigint;
9
9
  url: string;
10
10
 
11
- constructor(path: string, flags: 'r' | 'w' | 'wx', mode?: number) {
11
+ constructor(path: string, flags: 'r' | 'w' | 'wx' | 'a+', mode?: number) {
12
12
  path = resolvePath(path);
13
13
  this.handle = fs.openSync(path, flags, mode);
14
14
  const stats = fs.fstatSync(this.handle, {bigint: true});
@@ -23,6 +23,34 @@ export class NodeFile implements ReadableFile, WritableFile {
23
23
  });
24
24
  }
25
25
 
26
+ async truncate(length: number): Promise<void> {
27
+ return new Promise((resolve, reject) => {
28
+ fs.ftruncate(this.handle, length, (err) => {
29
+ if (err) {
30
+ reject(err);
31
+ } else {
32
+ this.bigsize = BigInt(length);
33
+ this.size = Number(this.bigsize);
34
+ resolve();
35
+ }
36
+ });
37
+ });
38
+ }
39
+
40
+ async append(data: Uint8Array): Promise<void> {
41
+ return new Promise((resolve, reject) => {
42
+ fs.appendFile(this.handle, data, (err) => {
43
+ if (err) {
44
+ reject(err);
45
+ } else {
46
+ this.bigsize = this.bigsize + BigInt(data.length);
47
+ this.size = Number(this.bigsize);
48
+ resolve();
49
+ }
50
+ });
51
+ });
52
+ }
53
+
26
54
  async stat(): Promise<Stat> {
27
55
  return await new Promise((resolve, reject) =>
28
56
  fs.fstat(this.handle, {bigint: true}, (err, info) => {
@@ -1,4 +1,5 @@
1
- // loaders.gl, MIT license
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import {Stat, RandomAccessFileSystem} from '@loaders.gl/loader-utils';
@@ -1,4 +1,5 @@
1
- // loaders.gl, MIT license
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import zlib from 'zlib';
@@ -1,4 +1,5 @@
1
- // loaders.gl, MIT license
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import getPixels from 'get-pixels';
@@ -1,4 +1,5 @@
1
- // loaders.gl, MIT license
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import getPixels from 'get-pixels';
@@ -1,4 +1,5 @@
1
- // loaders.gl, MIT License
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
2
3
 
3
4
  export function installFilePolyfills() {}
4
5
 
@@ -1,4 +1,5 @@
1
- // loaders.gl, MIT license
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  /* eslint-disable no-restricted-globals */