@loaders.gl/loader-utils 3.4.0-alpha.1 → 3.4.0-alpha.2

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 (136) hide show
  1. package/dist/es5/index.js +43 -22
  2. package/dist/es5/index.js.map +1 -1
  3. package/dist/es5/json-loader.js +1 -1
  4. package/dist/es5/lib/binary-utils/array-buffer-utils.js +0 -30
  5. package/dist/es5/lib/binary-utils/array-buffer-utils.js.map +1 -1
  6. package/dist/es5/lib/binary-utils/{binary-copy-utils.js → dataview-copy-utils.js} +33 -1
  7. package/dist/es5/lib/binary-utils/dataview-copy-utils.js.map +1 -0
  8. package/dist/es5/lib/binary-utils/get-first-characters.js +2 -0
  9. package/dist/es5/lib/binary-utils/get-first-characters.js.map +1 -1
  10. package/dist/es5/lib/binary-utils/{buffer-utils.js → memory-conversion-utils.js} +26 -7
  11. package/dist/es5/lib/binary-utils/memory-conversion-utils.js.map +1 -0
  12. package/dist/es5/lib/filesystems/readable-file.js +100 -0
  13. package/dist/es5/lib/filesystems/readable-file.js.map +1 -0
  14. package/dist/es5/lib/filesystems/writable-file.js +89 -0
  15. package/dist/es5/lib/filesystems/writable-file.js.map +1 -0
  16. package/dist/es5/lib/node/buffer.browser.js +16 -0
  17. package/dist/es5/lib/node/buffer.browser.js.map +1 -0
  18. package/dist/es5/lib/node/buffer.js +5 -8
  19. package/dist/es5/lib/node/buffer.js.map +1 -1
  20. package/dist/es5/lib/node/fs.js +19 -10
  21. package/dist/es5/lib/node/fs.js.map +1 -1
  22. package/dist/es5/lib/node/promisify.js +37 -0
  23. package/dist/es5/lib/node/promisify.js.map +1 -0
  24. package/dist/es5/lib/node/stream.js +20 -0
  25. package/dist/es5/lib/node/stream.js.map +1 -0
  26. package/dist/es5/lib/option-utils/merge-loader-options.js +29 -0
  27. package/dist/es5/lib/option-utils/merge-loader-options.js.map +1 -0
  28. package/dist/es5/types.js.map +1 -1
  29. package/dist/esm/index.js +12 -9
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/json-loader.js +1 -1
  32. package/dist/esm/lib/binary-utils/array-buffer-utils.js +0 -27
  33. package/dist/esm/lib/binary-utils/array-buffer-utils.js.map +1 -1
  34. package/dist/esm/lib/binary-utils/{binary-copy-utils.js → dataview-copy-utils.js} +31 -1
  35. package/dist/esm/lib/binary-utils/dataview-copy-utils.js.map +1 -0
  36. package/dist/esm/lib/binary-utils/get-first-characters.js +3 -0
  37. package/dist/esm/lib/binary-utils/get-first-characters.js.map +1 -1
  38. package/dist/esm/lib/binary-utils/memory-conversion-utils.js +38 -0
  39. package/dist/esm/lib/binary-utils/memory-conversion-utils.js.map +1 -0
  40. package/dist/esm/lib/filesystems/readable-file.js +22 -0
  41. package/dist/esm/lib/filesystems/readable-file.js.map +1 -0
  42. package/dist/esm/lib/filesystems/writable-file.js +21 -0
  43. package/dist/esm/lib/filesystems/writable-file.js.map +1 -0
  44. package/dist/esm/lib/node/buffer.browser.js +10 -0
  45. package/dist/esm/lib/node/buffer.browser.js.map +1 -0
  46. package/dist/esm/lib/node/buffer.js +5 -9
  47. package/dist/esm/lib/node/buffer.js.map +1 -1
  48. package/dist/esm/lib/node/fs.js +11 -9
  49. package/dist/esm/lib/node/fs.js.map +1 -1
  50. package/dist/esm/lib/node/promisify.js +12 -0
  51. package/dist/esm/lib/node/promisify.js.map +1 -0
  52. package/dist/esm/lib/node/stream.js +11 -0
  53. package/dist/esm/lib/node/stream.js.map +1 -0
  54. package/dist/esm/lib/option-utils/merge-loader-options.js +17 -0
  55. package/dist/esm/lib/option-utils/merge-loader-options.js.map +1 -0
  56. package/dist/esm/types.js.map +1 -1
  57. package/dist/index.d.ts +11 -7
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +28 -23
  60. package/dist/lib/binary-utils/array-buffer-utils.d.ts +4 -8
  61. package/dist/lib/binary-utils/array-buffer-utils.d.ts.map +1 -1
  62. package/dist/lib/binary-utils/array-buffer-utils.js +5 -36
  63. package/dist/lib/binary-utils/dataview-copy-utils.d.ts +43 -0
  64. package/dist/lib/binary-utils/dataview-copy-utils.d.ts.map +1 -0
  65. package/dist/lib/binary-utils/{binary-copy-utils.js → dataview-copy-utils.js} +51 -5
  66. package/dist/lib/binary-utils/get-first-characters.d.ts +15 -1
  67. package/dist/lib/binary-utils/get-first-characters.d.ts.map +1 -1
  68. package/dist/lib/binary-utils/get-first-characters.js +15 -0
  69. package/dist/lib/binary-utils/{buffer-utils.d.ts → memory-conversion-utils.d.ts} +3 -4
  70. package/dist/lib/binary-utils/memory-conversion-utils.d.ts.map +1 -0
  71. package/dist/lib/binary-utils/{buffer-utils.js → memory-conversion-utils.js} +28 -9
  72. package/dist/lib/filesystems/readable-file.d.ts +10 -0
  73. package/dist/lib/filesystems/readable-file.d.ts.map +1 -0
  74. package/dist/lib/filesystems/readable-file.js +25 -0
  75. package/dist/lib/filesystems/writable-file.d.ts +18 -0
  76. package/dist/lib/filesystems/writable-file.d.ts.map +1 -0
  77. package/dist/lib/{node/util.js → filesystems/writable-file.js} +23 -4
  78. package/dist/lib/node/buffer.browser.d.ts +12 -0
  79. package/dist/lib/node/buffer.browser.d.ts.map +1 -0
  80. package/dist/lib/node/buffer.browser.js +22 -0
  81. package/dist/lib/node/buffer.d.ts +3 -1
  82. package/dist/lib/node/buffer.d.ts.map +1 -1
  83. package/dist/lib/node/buffer.js +10 -10
  84. package/dist/lib/node/fs.d.ts +4 -2
  85. package/dist/lib/node/fs.d.ts.map +1 -1
  86. package/dist/lib/node/fs.js +11 -10
  87. package/dist/lib/node/promisify.d.ts +13 -0
  88. package/dist/lib/node/promisify.d.ts.map +1 -0
  89. package/dist/lib/node/promisify.js +22 -0
  90. package/dist/lib/node/stream.d.ts +4 -0
  91. package/dist/lib/node/stream.d.ts.map +1 -0
  92. package/dist/lib/node/stream.js +17 -0
  93. package/dist/lib/option-utils/merge-loader-options.d.ts +9 -0
  94. package/dist/lib/option-utils/merge-loader-options.d.ts.map +1 -0
  95. package/dist/lib/option-utils/merge-loader-options.js +24 -0
  96. package/dist/types.d.ts +19 -19
  97. package/dist/types.d.ts.map +1 -1
  98. package/package.json +10 -17
  99. package/src/index.ts +24 -18
  100. package/src/lib/binary-utils/array-buffer-utils.ts +4 -40
  101. package/src/lib/binary-utils/{binary-copy-utils.ts → dataview-copy-utils.ts} +57 -5
  102. package/src/lib/binary-utils/get-first-characters.ts +17 -1
  103. package/src/lib/binary-utils/memory-conversion-utils.ts +53 -0
  104. package/src/lib/filesystems/readable-file.ts +30 -0
  105. package/src/lib/filesystems/writable-file.ts +44 -0
  106. package/src/lib/node/buffer.browser.ts +20 -0
  107. package/src/lib/node/buffer.ts +12 -11
  108. package/src/lib/node/fs.ts +16 -11
  109. package/src/lib/node/promisify.ts +70 -0
  110. package/src/lib/node/stream.ts +18 -0
  111. package/src/lib/option-utils/merge-loader-options.ts +25 -0
  112. package/src/types.ts +19 -19
  113. package/dist/es5/lib/binary-utils/binary-copy-utils.js.map +0 -1
  114. package/dist/es5/lib/binary-utils/buffer-utils.js.map +0 -1
  115. package/dist/es5/lib/binary-utils/encode-utils.js +0 -36
  116. package/dist/es5/lib/binary-utils/encode-utils.js.map +0 -1
  117. package/dist/es5/lib/node/util.js +0 -13
  118. package/dist/es5/lib/node/util.js.map +0 -1
  119. package/dist/esm/lib/binary-utils/binary-copy-utils.js.map +0 -1
  120. package/dist/esm/lib/binary-utils/buffer-utils.js +0 -18
  121. package/dist/esm/lib/binary-utils/buffer-utils.js.map +0 -1
  122. package/dist/esm/lib/binary-utils/encode-utils.js +0 -29
  123. package/dist/esm/lib/binary-utils/encode-utils.js.map +0 -1
  124. package/dist/esm/lib/node/util.js +0 -4
  125. package/dist/esm/lib/node/util.js.map +0 -1
  126. package/dist/lib/binary-utils/binary-copy-utils.d.ts +0 -24
  127. package/dist/lib/binary-utils/binary-copy-utils.d.ts.map +0 -1
  128. package/dist/lib/binary-utils/buffer-utils.d.ts.map +0 -1
  129. package/dist/lib/binary-utils/encode-utils.d.ts +0 -4
  130. package/dist/lib/binary-utils/encode-utils.d.ts.map +0 -1
  131. package/dist/lib/binary-utils/encode-utils.js +0 -35
  132. package/dist/lib/node/util.d.ts +0 -5
  133. package/dist/lib/node/util.d.ts.map +0 -1
  134. package/src/lib/binary-utils/buffer-utils.ts +0 -28
  135. package/src/lib/binary-utils/encode-utils.ts +0 -32
  136. package/src/lib/node/util.ts +0 -4
@@ -1,9 +1,9 @@
1
1
  // fs wrapper (promisified fs + avoids bundling fs in browsers)
2
2
  import fs from 'fs';
3
3
  import {toArrayBuffer} from './buffer';
4
- import {promisify} from './util';
4
+ import {promisify2, promisify3} from './promisify';
5
5
 
6
- export type {Stats} from 'fs';
6
+ export type {Stats, WriteStream} from 'fs';
7
7
 
8
8
  export let readdir;
9
9
  /** Wrapper for Node.js fs method */
@@ -23,41 +23,46 @@ export let writeFileSync;
23
23
  /** Wrapper for Node.js fs method */
24
24
  export let open;
25
25
  /** Wrapper for Node.js fs method */
26
- export let close;
26
+ export let close: (fd: number) => Promise<void>;
27
27
  /** Wrapper for Node.js fs method */
28
28
  export let read;
29
29
  /** Wrapper for Node.js fs method */
30
30
  export let fstat;
31
31
 
32
+ export let createWriteStream: typeof fs.createWriteStream;
33
+
32
34
  export let isSupported = Boolean(fs);
33
35
 
34
36
  // paths
35
37
 
36
38
  try {
37
39
  /** Wrapper for Node.js fs method */
38
- readdir = promisify(fs.readdir);
40
+ readdir = promisify2(fs.readdir);
39
41
  /** Wrapper for Node.js fs method */
40
- stat = promisify(fs.stat);
42
+ stat = promisify2(fs.stat);
41
43
 
42
44
  /** Wrapper for Node.js fs method */
43
- readFile = promisify(fs.readFile);
45
+ readFile = fs.readFile;
44
46
  /** Wrapper for Node.js fs method */
45
47
  readFileSync = fs.readFileSync;
46
48
  /** Wrapper for Node.js fs method */
47
- writeFile = promisify(fs.writeFile);
49
+ writeFile = promisify3(fs.writeFile);
48
50
  /** Wrapper for Node.js fs method */
49
51
  writeFileSync = fs.writeFileSync;
50
52
 
51
53
  // file descriptors
52
54
 
53
55
  /** Wrapper for Node.js fs method */
54
- open = promisify(fs.open);
56
+ open = fs.open;
55
57
  /** Wrapper for Node.js fs method */
56
- close = promisify(fs.close);
58
+ close = (fd: number) =>
59
+ new Promise((resolve, reject) => fs.close(fd, (err) => (err ? reject(err) : resolve())));
57
60
  /** Wrapper for Node.js fs method */
58
- read = promisify(fs.read);
61
+ read = fs.read;
59
62
  /** Wrapper for Node.js fs method */
60
- fstat = promisify(fs.fstat);
63
+ fstat = fs.fstat;
64
+
65
+ createWriteStream = fs.createWriteStream;
61
66
 
62
67
  isSupported = Boolean(fs);
63
68
  } catch {
@@ -0,0 +1,70 @@
1
+ // @loaders.gl, MIT license
2
+
3
+ // type Parameter1<T extends (arg1: any, ...args: unknown[]) => unknown> = T extends (
4
+ // arg1: infer P,
5
+ // ...args: unknown[]
6
+ // ) => unknown
7
+ // ? P
8
+ // : never;
9
+
10
+ // type Parameter2<T extends (arg1: unknown, arg2: any, ...args: unknown[]) => unknown> = T extends (
11
+ // arg1: unknown,
12
+ // arg2: infer P,
13
+ // ...args: unknown[]
14
+ // ) => unknown
15
+ // ? P
16
+ // : never;
17
+
18
+ // type CallbackParameter2<
19
+ // T extends (arg: unknown, cb: (error: any, value: any) => void) => unknown
20
+ // > = T extends (arg: unknown, cb: (error: any, value: infer P) => void) => unknown ? P : never;
21
+
22
+ // type CallbackParameter3<
23
+ // T extends (arg: unknown, arg2: unknown, cb: (error: any, value: any) => void) => unknown
24
+ // > = T extends (arg: unknown, arg2: unknown, cb: (error: any, value: infer P) => void) => unknown
25
+ // ? P
26
+ // : never;
27
+
28
+ // /** Extract the parameters of a function type in a tuple */
29
+ // export type Promisified<F extends (arg1, cb: (error: unknown, value: any) => void) => any> = (
30
+ // arg1: Parameter1<F>
31
+ // ) => Promise<CallbackParameter2<F>>;
32
+ // /** Extract the parameters of a function type in a tuple */
33
+ // export type Promisified2<F extends (arg1, arg2, cb: (error: unknown, value: any) => void) => any> = (
34
+ // arg1: Parameter1<F>,
35
+ // arg2: Parameter2<F>
36
+ // ) => Promise<CallbackParameter3<F>>;
37
+
38
+ /** Wrapper for Node.js promisify */
39
+ type Callback<A> = (error: unknown, args: A) => void;
40
+
41
+ /**
42
+ * Typesafe promisify implementation
43
+ * @link https://dev.to/_gdelgado/implement-a-type-safe-version-of-node-s-promisify-in-7-lines-of-code-in-typescript-2j34
44
+ * @param fn
45
+ * @returns
46
+ */
47
+ export function promisify1<T, A>(fn: (args: T, cb: Callback<A>) => void): (args: T) => Promise<A> {
48
+ return (args: T) =>
49
+ new Promise((resolve, reject) =>
50
+ fn(args, (error, callbackArgs) => (error ? reject(error) : resolve(callbackArgs)))
51
+ );
52
+ }
53
+
54
+ export function promisify2<T1, T2, A>(
55
+ fn: (arg1: T1, arg2: T2, cb: Callback<A>) => void
56
+ ): (arg1: T1, arg2: T2) => Promise<A> {
57
+ return (arg1: T1, arg2: T2) =>
58
+ new Promise((resolve, reject) =>
59
+ fn(arg1, arg2, (error, callbackArgs) => (error ? reject(error) : resolve(callbackArgs)))
60
+ );
61
+ }
62
+
63
+ export function promisify3<T1, T2, T3, A>(
64
+ fn: (arg1: T1, arg2: T2, arg3: T3, cb: Callback<A>) => void
65
+ ): (arg1: T1, arg2: T2, arg3: T3) => Promise<A> {
66
+ return (arg1: T1, arg2: T2, arg3: T3) =>
67
+ new Promise((resolve, reject) =>
68
+ fn(arg1, arg2, arg3, (error, callbackArgs) => (error ? reject(error) : resolve(callbackArgs)))
69
+ );
70
+ }
@@ -0,0 +1,18 @@
1
+ // loaders.gl, MIT license
2
+
3
+ import stream from 'stream';
4
+
5
+ export type {Writable} from 'stream';
6
+
7
+ export let Transform;
8
+
9
+ export const isSupported = Boolean(stream);
10
+
11
+ // paths
12
+
13
+ try {
14
+ /** Wrapper for Node.js fs method */
15
+ Transform = stream.Transform;
16
+ } catch {
17
+ // ignore
18
+ }
@@ -0,0 +1,25 @@
1
+ // loaders.gl, MIT license
2
+
3
+ import {LoaderOptions} from '../../types';
4
+
5
+ /**
6
+ *
7
+ * @param baseOptions Can be undefined, in which case a fresh options object will be minted
8
+ * @param newOptions
9
+ * @returns
10
+ */
11
+ export function mergeLoaderOptions<Options extends LoaderOptions>(
12
+ baseOptions: Options | undefined,
13
+ newOptions: Options
14
+ ): Options {
15
+ const options = {...baseOptions};
16
+ for (const [key, newValue] of Object.entries(newOptions)) {
17
+ if (newValue && typeof newValue === 'object') {
18
+ options[key] = options[key] || {};
19
+ Object.assign(options[key] as object, newOptions[key]);
20
+ } else {
21
+ options[key] = newOptions[key];
22
+ }
23
+ }
24
+ return options as Options;
25
+ }
package/src/types.ts CHANGED
@@ -57,7 +57,7 @@ export type LoaderOptions = {
57
57
  // workers
58
58
 
59
59
  /** CDN load workers from */
60
- CDN?: string;
60
+ CDN?: string | null;
61
61
  /** Set to `false` to disable workers */
62
62
  worker?: boolean;
63
63
  /** Number of concurrent workers (per loader) on desktop browser */
@@ -76,40 +76,40 @@ export type LoaderOptions = {
76
76
  /** @deprecated `options.throw removed`, Use `options.nothrow` instead */
77
77
  throws?: boolean;
78
78
  /** @deprecated `options.dataType` no longer used */
79
- dataType?: any;
79
+ dataType?: never;
80
80
  /** @deprecated `options.uri` no longer used */
81
- uri?: any;
81
+ uri?: never;
82
82
  /** @deprecated `options.method` removed. Use `options.fetch.method` */
83
- method?: any;
83
+ method?: never;
84
84
  /** @deprecated `options.headers` removed. Use `options.fetch.headers` */
85
- headers?: any;
85
+ headers?: never;
86
86
  /** @deprecated `options.body` removed. Use `options.fetch.body` */
87
- body?: any;
87
+ body?: never;
88
88
  /** @deprecated `options.mode` removed. Use `options.fetch.mode` */
89
- mode?: any;
89
+ mode?: never;
90
90
  /** @deprecated `options.credentials` removed. Use `options.fetch.credentials` */
91
- credentials?: any;
91
+ credentials?: never;
92
92
  /** @deprecated `options.cache` removed. Use `options.fetch.cache` */
93
- cache?: any;
93
+ cache?: never;
94
94
  /** @deprecated `options.redirect` removed. Use `options.fetch.redirect` */
95
- redirect?: any;
95
+ redirect?: never;
96
96
  /** @deprecated `options.referrer` removed. Use `options.fetch.referrer` */
97
- referrer?: any;
97
+ referrer?: never;
98
98
  /** @deprecated `options.referrerPolicy` removed. Use `options.fetch.referrerPolicy` */
99
- referrerPolicy?: any;
99
+ referrerPolicy?: never;
100
100
  /** @deprecated `options.integrity` removed. Use `options.fetch.integrity` */
101
- integrity?: any;
101
+ integrity?: never;
102
102
  /** @deprecated `options.keepalive` removed. Use `options.fetch.keepalive` */
103
- keepalive?: any;
103
+ keepalive?: never;
104
104
  /** @deprecated `options.signal` removed. Use `options.fetch.signal` */
105
- signal?: any;
105
+ signal?: never;
106
106
 
107
107
  // Accept other keys (loader options objects, e.g. `options.csv`, `options.json` ...)
108
- [loaderId: string]: any;
108
+ [loaderId: string]: unknown;
109
109
  };
110
110
 
111
111
  type PreloadOptions = {
112
- [key: string]: any;
112
+ [key: string]: unknown;
113
113
  };
114
114
 
115
115
  /**
@@ -122,7 +122,7 @@ export type Loader = {
122
122
  module: string;
123
123
  version: string;
124
124
  worker?: string | boolean;
125
- options: object;
125
+ options: LoaderOptions;
126
126
  deprecatedOptions?: object;
127
127
  // end Worker
128
128
 
@@ -196,7 +196,7 @@ export type LoaderContext = {
196
196
  loaders?: Loader[] | null;
197
197
  url?: string;
198
198
 
199
- fetch: typeof fetch;
199
+ fetch: typeof fetch | FetchLike;
200
200
  response?: Response;
201
201
  parse: (
202
202
  arrayBuffer: ArrayBuffer,
@@ -1 +0,0 @@
1
- {"version":3,"file":"binary-copy-utils.js","names":["copyPaddedArrayBufferToDataView","dataView","byteOffset","sourceBuffer","padding","paddedLength","padToNBytes","byteLength","padLength","targetArray","Uint8Array","buffer","sourceArray","set","i","setUint8","copyPaddedStringToDataView","string","textEncoder","TextEncoder","stringBuffer","encode"],"sources":["../../../../src/lib/binary-utils/binary-copy-utils.ts"],"sourcesContent":["import {TypedArray} from '../../types';\nimport {padToNBytes} from './memory-copy-utils';\n\n/**\n * Copy sourceBuffer to dataView with some padding\n *\n * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated\n * @param {number} byteOffset - destination byte offset to copy to\n * @param {Array | TypedArray} sourceBuffer - source data buffer\n * @param {number} padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedArrayBufferToDataView(\n dataView: DataView | null,\n byteOffset: number,\n sourceBuffer: TypedArray,\n padding: number\n) {\n const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);\n const padLength = paddedLength - sourceBuffer.byteLength;\n\n if (dataView) {\n // Copy array\n const targetArray = new Uint8Array(\n dataView.buffer,\n dataView.byteOffset + byteOffset,\n sourceBuffer.byteLength\n );\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n\n // Add PADDING\n for (let i = 0; i < padLength; ++i) {\n // json chunk is padded with spaces (ASCII 0x20)\n dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 0x20);\n }\n }\n byteOffset += paddedLength;\n return byteOffset;\n}\n\n/**\n * Copy string to dataView with some padding\n *\n * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated\n * @param {number} byteOffset - destination byte offset to copy to\n * @param {string} string - source string\n * @param {number} padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedStringToDataView(\n dataView: DataView | null,\n byteOffset: number,\n string: string,\n padding: number\n): number {\n const textEncoder = new TextEncoder();\n // PERFORMANCE IDEA: We encode twice, once to get size and once to store\n // PERFORMANCE IDEA: Use TextEncoder.encodeInto() to avoid temporary copy\n const stringBuffer = textEncoder.encode(string);\n\n byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);\n\n return byteOffset;\n}\n"],"mappings":";;;;;;;AACA;AAYO,SAASA,+BAA+B,CAC7CC,QAAyB,EACzBC,UAAkB,EAClBC,YAAwB,EACxBC,OAAe,EACf;EACA,IAAMC,YAAY,GAAG,IAAAC,4BAAW,EAACH,YAAY,CAACI,UAAU,EAAEH,OAAO,CAAC;EAClE,IAAMI,SAAS,GAAGH,YAAY,GAAGF,YAAY,CAACI,UAAU;EAExD,IAAIN,QAAQ,EAAE;IAEZ,IAAMQ,WAAW,GAAG,IAAIC,UAAU,CAChCT,QAAQ,CAACU,MAAM,EACfV,QAAQ,CAACC,UAAU,GAAGA,UAAU,EAChCC,YAAY,CAACI,UAAU,CACxB;IACD,IAAMK,WAAW,GAAG,IAAIF,UAAU,CAACP,YAAY,CAAC;IAChDM,WAAW,CAACI,GAAG,CAACD,WAAW,CAAC;;IAG5B,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,SAAS,EAAE,EAAEM,CAAC,EAAE;MAElCb,QAAQ,CAACc,QAAQ,CAACb,UAAU,GAAGC,YAAY,CAACI,UAAU,GAAGO,CAAC,EAAE,IAAI,CAAC;IACnE;EACF;EACAZ,UAAU,IAAIG,YAAY;EAC1B,OAAOH,UAAU;AACnB;;AAYO,SAASc,0BAA0B,CACxCf,QAAyB,EACzBC,UAAkB,EAClBe,MAAc,EACdb,OAAe,EACP;EACR,IAAMc,WAAW,GAAG,IAAIC,WAAW,EAAE;EAGrC,IAAMC,YAAY,GAAGF,WAAW,CAACG,MAAM,CAACJ,MAAM,CAAC;EAE/Cf,UAAU,GAAGF,+BAA+B,CAACC,QAAQ,EAAEC,UAAU,EAAEkB,YAAY,EAAEhB,OAAO,CAAC;EAEzF,OAAOF,UAAU;AACnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"buffer-utils.js","names":["isBuffer","value","toBuffer","data","node","bufferToArrayBuffer","buffer","typedArray","Uint8Array","byteOffset","length","slice"],"sources":["../../../../src/lib/binary-utils/buffer-utils.ts"],"sourcesContent":["import * as node from '../node/buffer';\n\n/**\n * Check for Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n */\nexport function isBuffer(value: any): boolean {\n return value && typeof value === 'object' && value.isBuffer;\n}\n\n/**\n * Converts to Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toBuffer(data: any): Buffer {\n return node.toBuffer ? node.toBuffer(data) : data;\n}\n\n/**\n * Converts Node.js `Buffer` to `ArrayBuffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function bufferToArrayBuffer(buffer: any): ArrayBuffer {\n if (isBuffer(buffer)) {\n const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);\n return typedArray.slice().buffer;\n }\n return buffer;\n}\n"],"mappings":";;;;;;;;;;;AAAA;AAAuC;AAAA;AAKhC,SAASA,QAAQ,CAACC,KAAU,EAAW;EAC5C,OAAOA,KAAK,IAAI,sBAAOA,KAAK,MAAK,QAAQ,IAAIA,KAAK,CAACD,QAAQ;AAC7D;;AAMO,SAASE,QAAQ,CAACC,IAAS,EAAU;EAC1C,OAAOC,IAAI,CAACF,QAAQ,GAAGE,IAAI,CAACF,QAAQ,CAACC,IAAI,CAAC,GAAGA,IAAI;AACnD;;AAMO,SAASE,mBAAmB,CAACC,MAAW,EAAe;EAC5D,IAAIN,QAAQ,CAACM,MAAM,CAAC,EAAE;IACpB,IAAMC,UAAU,GAAG,IAAIC,UAAU,CAACF,MAAM,CAACA,MAAM,EAAEA,MAAM,CAACG,UAAU,EAAEH,MAAM,CAACI,MAAM,CAAC;IAClF,OAAOH,UAAU,CAACI,KAAK,EAAE,CAACL,MAAM;EAClC;EACA,OAAOA,MAAM;AACf"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.copyBinaryToDataView = copyBinaryToDataView;
7
- exports.copyStringToDataView = copyStringToDataView;
8
- exports.padStringToByteAlignment = padStringToByteAlignment;
9
-
10
- function padStringToByteAlignment(string, byteAlignment) {
11
- var length = string.length;
12
- var paddedLength = Math.ceil(length / byteAlignment) * byteAlignment;
13
- var padding = paddedLength - length;
14
- var whitespace = '';
15
- for (var i = 0; i < padding; ++i) {
16
- whitespace += ' ';
17
- }
18
- return string + whitespace;
19
- }
20
- function copyStringToDataView(dataView, byteOffset, string, byteLength) {
21
- if (dataView) {
22
- for (var i = 0; i < byteLength; i++) {
23
- dataView.setUint8(byteOffset + i, string.charCodeAt(i));
24
- }
25
- }
26
- return byteOffset + byteLength;
27
- }
28
- function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {
29
- if (dataView) {
30
- for (var i = 0; i < byteLength; i++) {
31
- dataView.setUint8(byteOffset + i, binary[i]);
32
- }
33
- }
34
- return byteOffset + byteLength;
35
- }
36
- //# sourceMappingURL=encode-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encode-utils.js","names":["padStringToByteAlignment","string","byteAlignment","length","paddedLength","Math","ceil","padding","whitespace","i","copyStringToDataView","dataView","byteOffset","byteLength","setUint8","charCodeAt","copyBinaryToDataView","binary"],"sources":["../../../../src/lib/binary-utils/encode-utils.ts"],"sourcesContent":["// Note: These were broken out from gltf loader...\n// eslint-disable-next-line complexity\n\n// PERFORMANCE IDEA: No need to copy string twice...\nexport function padStringToByteAlignment(string, byteAlignment) {\n const length = string.length;\n const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment; // Round up to the required alignment\n const padding = paddedLength - length;\n let whitespace = '';\n for (let i = 0; i < padding; ++i) {\n whitespace += ' ';\n }\n return string + whitespace;\n}\n\nexport function copyStringToDataView(dataView, byteOffset, string, byteLength) {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, string.charCodeAt(i));\n }\n }\n return byteOffset + byteLength;\n}\n\nexport function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, binary[i]);\n }\n }\n return byteOffset + byteLength;\n}\n"],"mappings":";;;;;;;;;AAIO,SAASA,wBAAwB,CAACC,MAAM,EAAEC,aAAa,EAAE;EAC9D,IAAMC,MAAM,GAAGF,MAAM,CAACE,MAAM;EAC5B,IAAMC,YAAY,GAAGC,IAAI,CAACC,IAAI,CAACH,MAAM,GAAGD,aAAa,CAAC,GAAGA,aAAa;EACtE,IAAMK,OAAO,GAAGH,YAAY,GAAGD,MAAM;EACrC,IAAIK,UAAU,GAAG,EAAE;EACnB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,OAAO,EAAE,EAAEE,CAAC,EAAE;IAChCD,UAAU,IAAI,GAAG;EACnB;EACA,OAAOP,MAAM,GAAGO,UAAU;AAC5B;AAEO,SAASE,oBAAoB,CAACC,QAAQ,EAAEC,UAAU,EAAEX,MAAM,EAAEY,UAAU,EAAE;EAC7E,IAAIF,QAAQ,EAAE;IACZ,KAAK,IAAIF,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGI,UAAU,EAAEJ,CAAC,EAAE,EAAE;MACnCE,QAAQ,CAACG,QAAQ,CAACF,UAAU,GAAGH,CAAC,EAAER,MAAM,CAACc,UAAU,CAACN,CAAC,CAAC,CAAC;IACzD;EACF;EACA,OAAOG,UAAU,GAAGC,UAAU;AAChC;AAEO,SAASG,oBAAoB,CAACL,QAAQ,EAAEC,UAAU,EAAEK,MAAM,EAAEJ,UAAU,EAAE;EAC7E,IAAIF,QAAQ,EAAE;IACZ,KAAK,IAAIF,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGI,UAAU,EAAEJ,CAAC,EAAE,EAAE;MACnCE,QAAQ,CAACG,QAAQ,CAACF,UAAU,GAAGH,CAAC,EAAEQ,MAAM,CAACR,CAAC,CAAC,CAAC;IAC9C;EACF;EACA,OAAOG,UAAU,GAAGC,UAAU;AAChC"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.promisify = void 0;
8
- var util = _interopRequireWildcard(require("util"));
9
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
- var promisify = util.promisify;
12
- exports.promisify = promisify;
13
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","names":["promisify","util"],"sources":["../../../../src/lib/node/util.ts"],"sourcesContent":["import * as util from 'util';\n\n/** Wrapper for Node.js promisify */\nexport const promisify = util.promisify;\n"],"mappings":";;;;;;;AAAA;AAA6B;AAAA;AAGtB,IAAMA,SAAS,GAAGC,IAAI,CAACD,SAAS;AAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"binary-copy-utils.js","names":["padToNBytes","copyPaddedArrayBufferToDataView","dataView","byteOffset","sourceBuffer","padding","paddedLength","byteLength","padLength","targetArray","Uint8Array","buffer","sourceArray","set","i","setUint8","copyPaddedStringToDataView","string","textEncoder","TextEncoder","stringBuffer","encode"],"sources":["../../../../src/lib/binary-utils/binary-copy-utils.ts"],"sourcesContent":["import {TypedArray} from '../../types';\nimport {padToNBytes} from './memory-copy-utils';\n\n/**\n * Copy sourceBuffer to dataView with some padding\n *\n * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated\n * @param {number} byteOffset - destination byte offset to copy to\n * @param {Array | TypedArray} sourceBuffer - source data buffer\n * @param {number} padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedArrayBufferToDataView(\n dataView: DataView | null,\n byteOffset: number,\n sourceBuffer: TypedArray,\n padding: number\n) {\n const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);\n const padLength = paddedLength - sourceBuffer.byteLength;\n\n if (dataView) {\n // Copy array\n const targetArray = new Uint8Array(\n dataView.buffer,\n dataView.byteOffset + byteOffset,\n sourceBuffer.byteLength\n );\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n\n // Add PADDING\n for (let i = 0; i < padLength; ++i) {\n // json chunk is padded with spaces (ASCII 0x20)\n dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 0x20);\n }\n }\n byteOffset += paddedLength;\n return byteOffset;\n}\n\n/**\n * Copy string to dataView with some padding\n *\n * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated\n * @param {number} byteOffset - destination byte offset to copy to\n * @param {string} string - source string\n * @param {number} padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedStringToDataView(\n dataView: DataView | null,\n byteOffset: number,\n string: string,\n padding: number\n): number {\n const textEncoder = new TextEncoder();\n // PERFORMANCE IDEA: We encode twice, once to get size and once to store\n // PERFORMANCE IDEA: Use TextEncoder.encodeInto() to avoid temporary copy\n const stringBuffer = textEncoder.encode(string);\n\n byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);\n\n return byteOffset;\n}\n"],"mappings":"AACA,SAAQA,WAAW,QAAO,qBAAqB;;AAY/C,OAAO,SAASC,+BAA+B,CAC7CC,QAAyB,EACzBC,UAAkB,EAClBC,YAAwB,EACxBC,OAAe,EACf;EACA,MAAMC,YAAY,GAAGN,WAAW,CAACI,YAAY,CAACG,UAAU,EAAEF,OAAO,CAAC;EAClE,MAAMG,SAAS,GAAGF,YAAY,GAAGF,YAAY,CAACG,UAAU;EAExD,IAAIL,QAAQ,EAAE;IAEZ,MAAMO,WAAW,GAAG,IAAIC,UAAU,CAChCR,QAAQ,CAACS,MAAM,EACfT,QAAQ,CAACC,UAAU,GAAGA,UAAU,EAChCC,YAAY,CAACG,UAAU,CACxB;IACD,MAAMK,WAAW,GAAG,IAAIF,UAAU,CAACN,YAAY,CAAC;IAChDK,WAAW,CAACI,GAAG,CAACD,WAAW,CAAC;;IAG5B,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,SAAS,EAAE,EAAEM,CAAC,EAAE;MAElCZ,QAAQ,CAACa,QAAQ,CAACZ,UAAU,GAAGC,YAAY,CAACG,UAAU,GAAGO,CAAC,EAAE,IAAI,CAAC;IACnE;EACF;EACAX,UAAU,IAAIG,YAAY;EAC1B,OAAOH,UAAU;AACnB;;AAYA,OAAO,SAASa,0BAA0B,CACxCd,QAAyB,EACzBC,UAAkB,EAClBc,MAAc,EACdZ,OAAe,EACP;EACR,MAAMa,WAAW,GAAG,IAAIC,WAAW,EAAE;EAGrC,MAAMC,YAAY,GAAGF,WAAW,CAACG,MAAM,CAACJ,MAAM,CAAC;EAE/Cd,UAAU,GAAGF,+BAA+B,CAACC,QAAQ,EAAEC,UAAU,EAAEiB,YAAY,EAAEf,OAAO,CAAC;EAEzF,OAAOF,UAAU;AACnB"}
@@ -1,18 +0,0 @@
1
- import * as node from '../node/buffer';
2
-
3
- export function isBuffer(value) {
4
- return value && typeof value === 'object' && value.isBuffer;
5
- }
6
-
7
- export function toBuffer(data) {
8
- return node.toBuffer ? node.toBuffer(data) : data;
9
- }
10
-
11
- export function bufferToArrayBuffer(buffer) {
12
- if (isBuffer(buffer)) {
13
- const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
14
- return typedArray.slice().buffer;
15
- }
16
- return buffer;
17
- }
18
- //# sourceMappingURL=buffer-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buffer-utils.js","names":["node","isBuffer","value","toBuffer","data","bufferToArrayBuffer","buffer","typedArray","Uint8Array","byteOffset","length","slice"],"sources":["../../../../src/lib/binary-utils/buffer-utils.ts"],"sourcesContent":["import * as node from '../node/buffer';\n\n/**\n * Check for Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n */\nexport function isBuffer(value: any): boolean {\n return value && typeof value === 'object' && value.isBuffer;\n}\n\n/**\n * Converts to Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toBuffer(data: any): Buffer {\n return node.toBuffer ? node.toBuffer(data) : data;\n}\n\n/**\n * Converts Node.js `Buffer` to `ArrayBuffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function bufferToArrayBuffer(buffer: any): ArrayBuffer {\n if (isBuffer(buffer)) {\n const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);\n return typedArray.slice().buffer;\n }\n return buffer;\n}\n"],"mappings":"AAAA,OAAO,KAAKA,IAAI,MAAM,gBAAgB;;AAKtC,OAAO,SAASC,QAAQ,CAACC,KAAU,EAAW;EAC5C,OAAOA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACD,QAAQ;AAC7D;;AAMA,OAAO,SAASE,QAAQ,CAACC,IAAS,EAAU;EAC1C,OAAOJ,IAAI,CAACG,QAAQ,GAAGH,IAAI,CAACG,QAAQ,CAACC,IAAI,CAAC,GAAGA,IAAI;AACnD;;AAMA,OAAO,SAASC,mBAAmB,CAACC,MAAW,EAAe;EAC5D,IAAIL,QAAQ,CAACK,MAAM,CAAC,EAAE;IACpB,MAAMC,UAAU,GAAG,IAAIC,UAAU,CAACF,MAAM,CAACA,MAAM,EAAEA,MAAM,CAACG,UAAU,EAAEH,MAAM,CAACI,MAAM,CAAC;IAClF,OAAOH,UAAU,CAACI,KAAK,EAAE,CAACL,MAAM;EAClC;EACA,OAAOA,MAAM;AACf"}
@@ -1,29 +0,0 @@
1
-
2
-
3
- export function padStringToByteAlignment(string, byteAlignment) {
4
- const length = string.length;
5
- const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment;
6
- const padding = paddedLength - length;
7
- let whitespace = '';
8
- for (let i = 0; i < padding; ++i) {
9
- whitespace += ' ';
10
- }
11
- return string + whitespace;
12
- }
13
- export function copyStringToDataView(dataView, byteOffset, string, byteLength) {
14
- if (dataView) {
15
- for (let i = 0; i < byteLength; i++) {
16
- dataView.setUint8(byteOffset + i, string.charCodeAt(i));
17
- }
18
- }
19
- return byteOffset + byteLength;
20
- }
21
- export function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {
22
- if (dataView) {
23
- for (let i = 0; i < byteLength; i++) {
24
- dataView.setUint8(byteOffset + i, binary[i]);
25
- }
26
- }
27
- return byteOffset + byteLength;
28
- }
29
- //# sourceMappingURL=encode-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encode-utils.js","names":["padStringToByteAlignment","string","byteAlignment","length","paddedLength","Math","ceil","padding","whitespace","i","copyStringToDataView","dataView","byteOffset","byteLength","setUint8","charCodeAt","copyBinaryToDataView","binary"],"sources":["../../../../src/lib/binary-utils/encode-utils.ts"],"sourcesContent":["// Note: These were broken out from gltf loader...\n// eslint-disable-next-line complexity\n\n// PERFORMANCE IDEA: No need to copy string twice...\nexport function padStringToByteAlignment(string, byteAlignment) {\n const length = string.length;\n const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment; // Round up to the required alignment\n const padding = paddedLength - length;\n let whitespace = '';\n for (let i = 0; i < padding; ++i) {\n whitespace += ' ';\n }\n return string + whitespace;\n}\n\nexport function copyStringToDataView(dataView, byteOffset, string, byteLength) {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, string.charCodeAt(i));\n }\n }\n return byteOffset + byteLength;\n}\n\nexport function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, binary[i]);\n }\n }\n return byteOffset + byteLength;\n}\n"],"mappings":";;AAIA,OAAO,SAASA,wBAAwB,CAACC,MAAM,EAAEC,aAAa,EAAE;EAC9D,MAAMC,MAAM,GAAGF,MAAM,CAACE,MAAM;EAC5B,MAAMC,YAAY,GAAGC,IAAI,CAACC,IAAI,CAACH,MAAM,GAAGD,aAAa,CAAC,GAAGA,aAAa;EACtE,MAAMK,OAAO,GAAGH,YAAY,GAAGD,MAAM;EACrC,IAAIK,UAAU,GAAG,EAAE;EACnB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,OAAO,EAAE,EAAEE,CAAC,EAAE;IAChCD,UAAU,IAAI,GAAG;EACnB;EACA,OAAOP,MAAM,GAAGO,UAAU;AAC5B;AAEA,OAAO,SAASE,oBAAoB,CAACC,QAAQ,EAAEC,UAAU,EAAEX,MAAM,EAAEY,UAAU,EAAE;EAC7E,IAAIF,QAAQ,EAAE;IACZ,KAAK,IAAIF,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGI,UAAU,EAAEJ,CAAC,EAAE,EAAE;MACnCE,QAAQ,CAACG,QAAQ,CAACF,UAAU,GAAGH,CAAC,EAAER,MAAM,CAACc,UAAU,CAACN,CAAC,CAAC,CAAC;IACzD;EACF;EACA,OAAOG,UAAU,GAAGC,UAAU;AAChC;AAEA,OAAO,SAASG,oBAAoB,CAACL,QAAQ,EAAEC,UAAU,EAAEK,MAAM,EAAEJ,UAAU,EAAE;EAC7E,IAAIF,QAAQ,EAAE;IACZ,KAAK,IAAIF,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGI,UAAU,EAAEJ,CAAC,EAAE,EAAE;MACnCE,QAAQ,CAACG,QAAQ,CAACF,UAAU,GAAGH,CAAC,EAAEQ,MAAM,CAACR,CAAC,CAAC,CAAC;IAC9C;EACF;EACA,OAAOG,UAAU,GAAGC,UAAU;AAChC"}
@@ -1,4 +0,0 @@
1
- import * as util from 'util';
2
-
3
- export const promisify = util.promisify;
4
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","names":["util","promisify"],"sources":["../../../../src/lib/node/util.ts"],"sourcesContent":["import * as util from 'util';\n\n/** Wrapper for Node.js promisify */\nexport const promisify = util.promisify;\n"],"mappings":"AAAA,OAAO,KAAKA,IAAI,MAAM,MAAM;;AAG5B,OAAO,MAAMC,SAAS,GAAGD,IAAI,CAACC,SAAS"}
@@ -1,24 +0,0 @@
1
- import { TypedArray } from '../../types';
2
- /**
3
- * Copy sourceBuffer to dataView with some padding
4
- *
5
- * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated
6
- * @param {number} byteOffset - destination byte offset to copy to
7
- * @param {Array | TypedArray} sourceBuffer - source data buffer
8
- * @param {number} padding - pad the resulting array to multiple of "padding" bytes. Additional bytes are filled with 0x20 (ASCII space)
9
- *
10
- * @return new byteOffset of resulting dataView
11
- */
12
- export declare function copyPaddedArrayBufferToDataView(dataView: DataView | null, byteOffset: number, sourceBuffer: TypedArray, padding: number): number;
13
- /**
14
- * Copy string to dataView with some padding
15
- *
16
- * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated
17
- * @param {number} byteOffset - destination byte offset to copy to
18
- * @param {string} string - source string
19
- * @param {number} padding - pad the resulting array to multiple of "padding" bytes. Additional bytes are filled with 0x20 (ASCII space)
20
- *
21
- * @return new byteOffset of resulting dataView
22
- */
23
- export declare function copyPaddedStringToDataView(dataView: DataView | null, byteOffset: number, string: string, padding: number): number;
24
- //# sourceMappingURL=binary-copy-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"binary-copy-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-utils/binary-copy-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAGvC;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,QAAQ,GAAG,IAAI,EACzB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,UAAU,EACxB,OAAO,EAAE,MAAM,UAuBhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,QAAQ,GAAG,IAAI,EACzB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,MAAM,CASR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"buffer-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-utils/buffer-utils.ts"],"names":[],"mappings":";AAEA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAE5C;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAE1C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,GAAG,WAAW,CAM5D"}
@@ -1,4 +0,0 @@
1
- export declare function padStringToByteAlignment(string: any, byteAlignment: any): string;
2
- export declare function copyStringToDataView(dataView: any, byteOffset: any, string: any, byteLength: any): any;
3
- export declare function copyBinaryToDataView(dataView: any, byteOffset: any, binary: any, byteLength: any): any;
4
- //# sourceMappingURL=encode-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encode-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-utils/encode-utils.ts"],"names":[],"mappings":"AAIA,wBAAgB,wBAAwB,CAAC,MAAM,KAAA,EAAE,aAAa,KAAA,UAS7D;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,KAAA,EAAE,UAAU,KAAA,EAAE,MAAM,KAAA,EAAE,UAAU,KAAA,OAO5E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,KAAA,EAAE,UAAU,KAAA,EAAE,MAAM,KAAA,EAAE,UAAU,KAAA,OAO5E"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- // Note: These were broken out from gltf loader...
3
- // eslint-disable-next-line complexity
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.copyBinaryToDataView = exports.copyStringToDataView = exports.padStringToByteAlignment = void 0;
6
- // PERFORMANCE IDEA: No need to copy string twice...
7
- function padStringToByteAlignment(string, byteAlignment) {
8
- const length = string.length;
9
- const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment; // Round up to the required alignment
10
- const padding = paddedLength - length;
11
- let whitespace = '';
12
- for (let i = 0; i < padding; ++i) {
13
- whitespace += ' ';
14
- }
15
- return string + whitespace;
16
- }
17
- exports.padStringToByteAlignment = padStringToByteAlignment;
18
- function copyStringToDataView(dataView, byteOffset, string, byteLength) {
19
- if (dataView) {
20
- for (let i = 0; i < byteLength; i++) {
21
- dataView.setUint8(byteOffset + i, string.charCodeAt(i));
22
- }
23
- }
24
- return byteOffset + byteLength;
25
- }
26
- exports.copyStringToDataView = copyStringToDataView;
27
- function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {
28
- if (dataView) {
29
- for (let i = 0; i < byteLength; i++) {
30
- dataView.setUint8(byteOffset + i, binary[i]);
31
- }
32
- }
33
- return byteOffset + byteLength;
34
- }
35
- exports.copyBinaryToDataView = copyBinaryToDataView;
@@ -1,5 +0,0 @@
1
- /// <reference types="node" />
2
- import * as util from 'util';
3
- /** Wrapper for Node.js promisify */
4
- export declare const promisify: typeof util.promisify;
5
- //# sourceMappingURL=util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/lib/node/util.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,oCAAoC;AACpC,eAAO,MAAM,SAAS,uBAAiB,CAAC"}
@@ -1,28 +0,0 @@
1
- import * as node from '../node/buffer';
2
-
3
- /**
4
- * Check for Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)
5
- */
6
- export function isBuffer(value: any): boolean {
7
- return value && typeof value === 'object' && value.isBuffer;
8
- }
9
-
10
- /**
11
- * Converts to Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)
12
- * @todo better data type
13
- */
14
- export function toBuffer(data: any): Buffer {
15
- return node.toBuffer ? node.toBuffer(data) : data;
16
- }
17
-
18
- /**
19
- * Converts Node.js `Buffer` to `ArrayBuffer` (without triggering bundler to include Buffer polyfill on browser)
20
- * @todo better data type
21
- */
22
- export function bufferToArrayBuffer(buffer: any): ArrayBuffer {
23
- if (isBuffer(buffer)) {
24
- const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
25
- return typedArray.slice().buffer;
26
- }
27
- return buffer;
28
- }
@@ -1,32 +0,0 @@
1
- // Note: These were broken out from gltf loader...
2
- // eslint-disable-next-line complexity
3
-
4
- // PERFORMANCE IDEA: No need to copy string twice...
5
- export function padStringToByteAlignment(string, byteAlignment) {
6
- const length = string.length;
7
- const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment; // Round up to the required alignment
8
- const padding = paddedLength - length;
9
- let whitespace = '';
10
- for (let i = 0; i < padding; ++i) {
11
- whitespace += ' ';
12
- }
13
- return string + whitespace;
14
- }
15
-
16
- export function copyStringToDataView(dataView, byteOffset, string, byteLength) {
17
- if (dataView) {
18
- for (let i = 0; i < byteLength; i++) {
19
- dataView.setUint8(byteOffset + i, string.charCodeAt(i));
20
- }
21
- }
22
- return byteOffset + byteLength;
23
- }
24
-
25
- export function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {
26
- if (dataView) {
27
- for (let i = 0; i < byteLength; i++) {
28
- dataView.setUint8(byteOffset + i, binary[i]);
29
- }
30
- }
31
- return byteOffset + byteLength;
32
- }
@@ -1,4 +0,0 @@
1
- import * as util from 'util';
2
-
3
- /** Wrapper for Node.js promisify */
4
- export const promisify = util.promisify;