styled-map-package 4.0.0 → 4.1.0

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 (191) hide show
  1. package/bin/smp-download.js +1 -1
  2. package/bin/smp-view.js +32 -23
  3. package/dist/download.d.cts +1 -1
  4. package/dist/download.d.ts +1 -1
  5. package/dist/index.d.cts +2 -2
  6. package/dist/index.d.ts +2 -2
  7. package/dist/reader-watch.d.cts +1 -1
  8. package/dist/reader-watch.d.ts +1 -1
  9. package/dist/reader.cjs +2 -1
  10. package/dist/reader.d.cts +1 -1
  11. package/dist/reader.d.ts +1 -1
  12. package/dist/reader.js +2 -1
  13. package/dist/server.cjs +3 -4
  14. package/dist/server.d.cts +1 -1
  15. package/dist/server.d.ts +1 -1
  16. package/dist/server.js +3 -4
  17. package/dist/style-downloader.cjs +2 -2
  18. package/dist/style-downloader.d.cts +1 -1
  19. package/dist/style-downloader.d.ts +1 -1
  20. package/dist/style-downloader.js +2 -2
  21. package/dist/tile-downloader.cjs +2 -2
  22. package/dist/tile-downloader.d.cts +1 -1
  23. package/dist/tile-downloader.d.ts +1 -1
  24. package/dist/tile-downloader.js +2 -2
  25. package/dist/{types-B4Xn1F9K.d.cts → types-yLQy3AKR.d.cts} +6 -3
  26. package/dist/{types-B4Xn1F9K.d.ts → types-yLQy3AKR.d.ts} +6 -3
  27. package/dist/utils/file-formats.d.cts +1 -1
  28. package/dist/utils/file-formats.d.ts +1 -1
  29. package/dist/utils/style.cjs +2 -2
  30. package/dist/utils/style.d.cts +1 -1
  31. package/dist/utils/style.d.ts +1 -1
  32. package/dist/utils/style.js +2 -2
  33. package/dist/utils/templates.cjs +4 -0
  34. package/dist/utils/templates.d.cts +4 -2
  35. package/dist/utils/templates.d.ts +4 -2
  36. package/dist/utils/templates.js +2 -0
  37. package/dist/writer.cjs +51 -3
  38. package/dist/writer.d.cts +1 -1
  39. package/dist/writer.d.ts +1 -1
  40. package/dist/writer.js +53 -3
  41. package/node_modules/@node-rs/crc32/LICENSE +21 -0
  42. package/node_modules/@node-rs/crc32/README.md +61 -0
  43. package/node_modules/@node-rs/crc32/browser.js +1 -0
  44. package/node_modules/@node-rs/crc32/index.d.ts +5 -0
  45. package/node_modules/@node-rs/crc32/index.js +368 -0
  46. package/node_modules/@node-rs/crc32/package.json +97 -0
  47. package/node_modules/@node-rs/crc32-linux-x64-gnu/README.md +3 -0
  48. package/node_modules/@node-rs/crc32-linux-x64-gnu/crc32.linux-x64-gnu.node +0 -0
  49. package/node_modules/@node-rs/crc32-linux-x64-gnu/package.json +43 -0
  50. package/node_modules/@node-rs/crc32-linux-x64-musl/README.md +3 -0
  51. package/node_modules/@node-rs/crc32-linux-x64-musl/crc32.linux-x64-musl.node +0 -0
  52. package/node_modules/@node-rs/crc32-linux-x64-musl/package.json +43 -0
  53. package/node_modules/define-data-property/.eslintrc +24 -0
  54. package/node_modules/define-data-property/.github/FUNDING.yml +12 -0
  55. package/node_modules/define-data-property/.nycrc +13 -0
  56. package/node_modules/define-data-property/CHANGELOG.md +70 -0
  57. package/node_modules/define-data-property/LICENSE +21 -0
  58. package/node_modules/define-data-property/README.md +67 -0
  59. package/node_modules/define-data-property/index.d.ts +12 -0
  60. package/node_modules/define-data-property/index.js +56 -0
  61. package/node_modules/define-data-property/package.json +106 -0
  62. package/node_modules/define-data-property/test/index.js +392 -0
  63. package/node_modules/define-data-property/tsconfig.json +59 -0
  64. package/node_modules/define-properties/.editorconfig +13 -0
  65. package/node_modules/define-properties/.eslintrc +19 -0
  66. package/node_modules/define-properties/.github/FUNDING.yml +12 -0
  67. package/node_modules/define-properties/.nycrc +9 -0
  68. package/node_modules/define-properties/CHANGELOG.md +91 -0
  69. package/node_modules/define-properties/LICENSE +21 -0
  70. package/node_modules/define-properties/README.md +84 -0
  71. package/node_modules/define-properties/index.js +47 -0
  72. package/node_modules/define-properties/package.json +88 -0
  73. package/node_modules/es-define-property/.eslintrc +13 -0
  74. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  75. package/node_modules/es-define-property/.nycrc +9 -0
  76. package/node_modules/es-define-property/CHANGELOG.md +29 -0
  77. package/node_modules/es-define-property/LICENSE +21 -0
  78. package/node_modules/es-define-property/README.md +49 -0
  79. package/node_modules/es-define-property/index.d.ts +3 -0
  80. package/node_modules/es-define-property/index.js +14 -0
  81. package/node_modules/es-define-property/package.json +81 -0
  82. package/node_modules/es-define-property/test/index.js +56 -0
  83. package/node_modules/es-define-property/tsconfig.json +10 -0
  84. package/node_modules/es-errors/.eslintrc +5 -0
  85. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  86. package/node_modules/es-errors/CHANGELOG.md +40 -0
  87. package/node_modules/es-errors/LICENSE +21 -0
  88. package/node_modules/es-errors/README.md +55 -0
  89. package/node_modules/es-errors/eval.d.ts +3 -0
  90. package/node_modules/es-errors/eval.js +4 -0
  91. package/node_modules/es-errors/index.d.ts +3 -0
  92. package/node_modules/es-errors/index.js +4 -0
  93. package/node_modules/es-errors/package.json +80 -0
  94. package/node_modules/es-errors/range.d.ts +3 -0
  95. package/node_modules/es-errors/range.js +4 -0
  96. package/node_modules/es-errors/ref.d.ts +3 -0
  97. package/node_modules/es-errors/ref.js +4 -0
  98. package/node_modules/es-errors/syntax.d.ts +3 -0
  99. package/node_modules/es-errors/syntax.js +4 -0
  100. package/node_modules/es-errors/test/index.js +19 -0
  101. package/node_modules/es-errors/tsconfig.json +49 -0
  102. package/node_modules/es-errors/type.d.ts +3 -0
  103. package/node_modules/es-errors/type.js +4 -0
  104. package/node_modules/es-errors/uri.d.ts +3 -0
  105. package/node_modules/es-errors/uri.js +4 -0
  106. package/node_modules/globalthis/.eslintrc +18 -0
  107. package/node_modules/globalthis/.nycrc +10 -0
  108. package/node_modules/globalthis/CHANGELOG.md +109 -0
  109. package/node_modules/globalthis/LICENSE +21 -0
  110. package/node_modules/globalthis/README.md +70 -0
  111. package/node_modules/globalthis/auto.js +3 -0
  112. package/node_modules/globalthis/implementation.browser.js +11 -0
  113. package/node_modules/globalthis/implementation.js +3 -0
  114. package/node_modules/globalthis/index.js +19 -0
  115. package/node_modules/globalthis/package.json +99 -0
  116. package/node_modules/globalthis/polyfill.js +10 -0
  117. package/node_modules/globalthis/shim.js +29 -0
  118. package/node_modules/globalthis/test/implementation.js +11 -0
  119. package/node_modules/globalthis/test/index.js +11 -0
  120. package/node_modules/globalthis/test/native.js +26 -0
  121. package/node_modules/globalthis/test/shimmed.js +29 -0
  122. package/node_modules/globalthis/test/tests.js +36 -0
  123. package/node_modules/gopd/.eslintrc +16 -0
  124. package/node_modules/gopd/.github/FUNDING.yml +12 -0
  125. package/node_modules/gopd/CHANGELOG.md +45 -0
  126. package/node_modules/gopd/LICENSE +21 -0
  127. package/node_modules/gopd/README.md +40 -0
  128. package/node_modules/gopd/gOPD.d.ts +1 -0
  129. package/node_modules/gopd/gOPD.js +4 -0
  130. package/node_modules/gopd/index.d.ts +5 -0
  131. package/node_modules/gopd/index.js +15 -0
  132. package/node_modules/gopd/package.json +77 -0
  133. package/node_modules/gopd/test/index.js +36 -0
  134. package/node_modules/gopd/tsconfig.json +9 -0
  135. package/node_modules/has-property-descriptors/.eslintrc +13 -0
  136. package/node_modules/has-property-descriptors/.github/FUNDING.yml +12 -0
  137. package/node_modules/has-property-descriptors/.nycrc +9 -0
  138. package/node_modules/has-property-descriptors/CHANGELOG.md +35 -0
  139. package/node_modules/has-property-descriptors/LICENSE +21 -0
  140. package/node_modules/has-property-descriptors/README.md +43 -0
  141. package/node_modules/has-property-descriptors/index.js +22 -0
  142. package/node_modules/has-property-descriptors/package.json +77 -0
  143. package/node_modules/has-property-descriptors/test/index.js +57 -0
  144. package/node_modules/is-it-type/License +19 -0
  145. package/node_modules/is-it-type/README.md +102 -0
  146. package/node_modules/is-it-type/changelog.md +239 -0
  147. package/node_modules/is-it-type/dist/cjs/is-it-type.js +173 -0
  148. package/node_modules/is-it-type/dist/cjs/is-it-type.js.map +1 -0
  149. package/node_modules/is-it-type/dist/cjs/is-it-type.min.js +2 -0
  150. package/node_modules/is-it-type/dist/cjs/is-it-type.min.js.map +1 -0
  151. package/node_modules/is-it-type/dist/esm/is-it-type.js +143 -0
  152. package/node_modules/is-it-type/dist/esm/is-it-type.js.map +1 -0
  153. package/node_modules/is-it-type/dist/esm/is-it-type.min.js +2 -0
  154. package/node_modules/is-it-type/dist/esm/is-it-type.min.js.map +1 -0
  155. package/node_modules/is-it-type/dist/esm/package.json +3 -0
  156. package/node_modules/is-it-type/dist/umd/is-it-type.js +450 -0
  157. package/node_modules/is-it-type/dist/umd/is-it-type.js.map +1 -0
  158. package/node_modules/is-it-type/dist/umd/is-it-type.min.js +2 -0
  159. package/node_modules/is-it-type/dist/umd/is-it-type.min.js.map +1 -0
  160. package/node_modules/is-it-type/es/index.js +8 -0
  161. package/node_modules/is-it-type/es/package.json +3 -0
  162. package/node_modules/is-it-type/index.js +10 -0
  163. package/node_modules/is-it-type/package.json +87 -0
  164. package/node_modules/is-it-type/src/index.js +169 -0
  165. package/node_modules/object-keys/.editorconfig +13 -0
  166. package/node_modules/object-keys/.eslintrc +17 -0
  167. package/node_modules/object-keys/.travis.yml +277 -0
  168. package/node_modules/object-keys/CHANGELOG.md +232 -0
  169. package/node_modules/object-keys/LICENSE +21 -0
  170. package/node_modules/object-keys/README.md +76 -0
  171. package/node_modules/object-keys/implementation.js +122 -0
  172. package/node_modules/object-keys/index.js +32 -0
  173. package/node_modules/object-keys/isArguments.js +17 -0
  174. package/node_modules/object-keys/package.json +88 -0
  175. package/node_modules/object-keys/test/index.js +5 -0
  176. package/node_modules/simple-invariant/License +19 -0
  177. package/node_modules/simple-invariant/README.md +64 -0
  178. package/node_modules/simple-invariant/changelog.md +31 -0
  179. package/node_modules/simple-invariant/index.js +19 -0
  180. package/node_modules/simple-invariant/package.json +50 -0
  181. package/node_modules/yauzl-promise/License +19 -0
  182. package/node_modules/yauzl-promise/README.md +440 -0
  183. package/node_modules/yauzl-promise/index.js +10 -0
  184. package/node_modules/yauzl-promise/lib/entry.js +312 -0
  185. package/node_modules/yauzl-promise/lib/index.js +160 -0
  186. package/node_modules/yauzl-promise/lib/reader.js +289 -0
  187. package/node_modules/yauzl-promise/lib/shared.js +20 -0
  188. package/node_modules/yauzl-promise/lib/utils.js +105 -0
  189. package/node_modules/yauzl-promise/lib/zip.js +1224 -0
  190. package/node_modules/yauzl-promise/package.json +56 -0
  191. package/package.json +9 -11
package/dist/writer.js CHANGED
@@ -13,12 +13,14 @@ import { clone } from "./utils/misc.js";
13
13
  import { writeStreamFromAsync } from "./utils/streams.js";
14
14
  import { replaceFontStacks } from "./utils/style.js";
15
15
  import {
16
+ FONTS_FOLDER,
16
17
  getGlyphFilename,
17
18
  getSpriteFilename,
18
19
  getSpriteUri,
19
20
  getTileFilename,
20
21
  getTileUri,
21
22
  GLYPH_URI,
23
+ SOURCES_FOLDER,
22
24
  STYLE_FILE
23
25
  } from "./utils/templates.js";
24
26
  const SUPPORTED_SOURCE_TYPES = (
@@ -269,11 +271,12 @@ class Writer extends EventEmitter {
269
271
  * This method must be called to complete the archive.
270
272
  * You must wait for your destination write stream to 'finish' before using the output.
271
273
  */
272
- finish() {
274
+ async finish() {
273
275
  this.#prepareStyle();
274
276
  const style = JSON.stringify(this.#style);
275
- this.#append(style, { name: STYLE_FILE });
276
- this.#archive.finalize();
277
+ await this.#append(style, { name: STYLE_FILE });
278
+ sortEntries(this.#archive);
279
+ await this.#archive.finalize();
277
280
  }
278
281
  /**
279
282
  * Mutates the style object to prepare it for writing to the archive.
@@ -368,6 +371,53 @@ function get2DBBox(bbox2) {
368
371
  if (bbox2.length === 4) return bbox2;
369
372
  return [bbox2[0], bbox2[1], bbox2[3], bbox2[4]];
370
373
  }
374
+ function sortEntries(archive) {
375
+ const entries = (
376
+ /** @type {unknown} */
377
+ archive._module?.engine?._entries
378
+ );
379
+ if (!Array.isArray(entries)) {
380
+ throw new Error(
381
+ "Cannot find zip entries: check implementation changes in Archiver"
382
+ );
383
+ }
384
+ const sortedEntries = entries.sort(
385
+ /**
386
+ * @param {unknown} a
387
+ * @param {unknown} b
388
+ */
389
+ function(a, b) {
390
+ assertValidEntry(a);
391
+ assertValidEntry(b);
392
+ if (a.name === "style.json") return -1;
393
+ if (b.name === "style.json") return 1;
394
+ const foldersA = a.name.split("/");
395
+ const foldersB = b.name.split("/");
396
+ if (foldersA[0] === FONTS_FOLDER && foldersA[2] === "0-255.pbf.gz")
397
+ return -1;
398
+ if (foldersB[0] === FONTS_FOLDER && foldersB[2] === "0-255.pbf.gz")
399
+ return 1;
400
+ if (foldersA[0] === SOURCES_FOLDER && foldersB[0] !== SOURCES_FOLDER)
401
+ return -1;
402
+ if (foldersB[0] === SOURCES_FOLDER && foldersA[0] !== SOURCES_FOLDER)
403
+ return 1;
404
+ if (foldersA[0] === SOURCES_FOLDER && foldersB[0] === SOURCES_FOLDER) {
405
+ const zoomA = +foldersA[2];
406
+ const zoomB = +foldersB[2];
407
+ return zoomA - zoomB;
408
+ }
409
+ return 0;
410
+ }
411
+ );
412
+ archive._module.engine._entries = sortedEntries;
413
+ }
414
+ function assertValidEntry(maybeEntry) {
415
+ if (!maybeEntry || typeof maybeEntry !== "object" || !("name" in maybeEntry) || typeof maybeEntry.name !== "string") {
416
+ throw new Error(
417
+ "Unexpected zip entry type: check implementation changes in Archiver"
418
+ );
419
+ }
420
+ }
371
421
  export {
372
422
  SUPPORTED_SOURCE_TYPES,
373
423
  Writer
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020-present LongYinan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,61 @@
1
+ # `@node-rs/crc32`
2
+
3
+ ![](https://github.com/napi-rs/node-rs/workflows/CI/badge.svg)
4
+ ![](https://img.shields.io/npm/dm/@node-rs/crc32.svg?sanitize=true)
5
+
6
+ Fastest `crc32` implement in `Node.js`
7
+
8
+ The 4 tested implementations are:
9
+
10
+ - **@node-rs/crc32** Hardware accelerated CRC-32C from [crc32fast](https://crates.io/crates/crc32fast)
11
+ - **sse4_crc32c** Hardware accelerated CRC-32C from [sse4_crc32](https://github.com/Voxer/sse4_crc32)
12
+ - **js_crc32c** Javascript implemented CRC-32C
13
+ - **js_crc32** Javascript implemented CRC-32 from [buffer-crc32](https://github.com/brianloveswords/buffer-crc32)
14
+
15
+ ## Performance
16
+
17
+ ```bash
18
+ @node-rs/crc32 for inputs 1024B x 5,108,123 ops/sec ±1.86% (89 runs sampled)
19
+ @node-rs/crc32 for inputs 16931844B, avg 2066B x 271 ops/sec ±1.15% (85 runs sampled)
20
+ sse4_crc32c_hw for inputs 1024B x 3,543,443 ops/sec ±1.39% (93 runs sampled)
21
+ sse4_crc32c_hw for inputs 16931844B, avg 2066B x 209 ops/sec ±0.78% (76 runs sampled)
22
+ sse4_crc32c_sw for inputs 1024B x 1,460,284 ops/sec ±2.35% (90 runs sampled)
23
+ sse4_crc32c_sw for inputs 16931844B, avg 2066B x 93.50 ops/sec ±2.43% (69 runs sampled)
24
+ js_crc32c for inputs 1024B x 464,681 ops/sec ±0.46% (91 runs sampled)
25
+ js_crc32c for inputs 16931844B, avg 2066B x 28.25 ops/sec ±1.64% (51 runs sampled)
26
+ js_crc32 for inputs 1024B x 442,272 ops/sec ±2.66% (93 runs sampled)
27
+ js_crc32 for inputs 16931844B, avg 2066B x 22.12 ops/sec ±5.20% (40 runs sampled)
28
+ +---------------------+-------------------+----------------------+
29
+ | │ 1024B │ 16931844B, avg 2066B |
30
+ +---------------------+-------------------+----------------------+
31
+ | @node-rs/crc32 │ 5,108,123 ops/sec │ 271 ops/sec |
32
+ +---------------------+-------------------+----------------------+
33
+ | sse4_crc32c_hw │ 3,543,443 ops/sec │ 209 ops/sec |
34
+ +---------------------+-------------------+----------------------+
35
+ | sse4_crc32c_sw │ 1,460,284 ops/sec │ 93.50 ops/sec |
36
+ +---------------------+-------------------+----------------------+
37
+ | js_crc32c │ 464,681 ops/sec │ 28.25 ops/sec |
38
+ +---------------------+-------------------+----------------------+
39
+ | js_crc32 │ 442,272 ops/sec │ 22.12 ops/sec |
40
+ +---------------------+-------------------+----------------------+
41
+ ```
42
+
43
+ ## API
44
+
45
+ > The type of **input initial crc** and **output crc number** is `u32`
46
+
47
+ ```ts
48
+ export function crc32(input: Buffer, crc?: number): number
49
+ export function crc32c(input: Buffer, crc?: number): number
50
+ ```
51
+
52
+ ## Usage
53
+
54
+ ```ts
55
+ const { crc32 } = require('@node-rs/crc32')
56
+ const { readFileSync } = require('fs')
57
+
58
+ const content = readFileSync('./avatar.png')
59
+
60
+ crc32(content)
61
+ ```
@@ -0,0 +1 @@
1
+ export * from '@node-rs/crc32-wasm32-wasi'
@@ -0,0 +1,5 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ export declare function crc32(input: string | Uint8Array, initialState?: number | undefined | null): number
4
+
5
+ export declare function crc32c(input: string | Uint8Array, initialState?: number | undefined | null): number
@@ -0,0 +1,368 @@
1
+ // prettier-ignore
2
+ /* eslint-disable */
3
+ // @ts-nocheck
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ const { createRequire } = require('node:module')
7
+ require = createRequire(__filename)
8
+
9
+ const { readFileSync } = require('node:fs')
10
+ let nativeBinding = null
11
+ const loadErrors = []
12
+
13
+ const isMusl = () => {
14
+ let musl = false
15
+ if (process.platform === 'linux') {
16
+ musl = isMuslFromFilesystem()
17
+ if (musl === null) {
18
+ musl = isMuslFromReport()
19
+ }
20
+ if (musl === null) {
21
+ musl = isMuslFromChildProcess()
22
+ }
23
+ }
24
+ return musl
25
+ }
26
+
27
+ const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
28
+
29
+ const isMuslFromFilesystem = () => {
30
+ try {
31
+ return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
32
+ } catch {
33
+ return null
34
+ }
35
+ }
36
+
37
+ const isMuslFromReport = () => {
38
+ const report = typeof process.report.getReport === 'function' ? process.report.getReport() : null
39
+ if (!report) {
40
+ return null
41
+ }
42
+ if (report.header && report.header.glibcVersionRuntime) {
43
+ return false
44
+ }
45
+ if (Array.isArray(report.sharedObjects)) {
46
+ if (report.sharedObjects.some(isFileMusl)) {
47
+ return true
48
+ }
49
+ }
50
+ return false
51
+ }
52
+
53
+ const isMuslFromChildProcess = () => {
54
+ try {
55
+ return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
56
+ } catch (e) {
57
+ // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
58
+ return false
59
+ }
60
+ }
61
+
62
+ function requireNative() {
63
+ if (process.platform === 'android') {
64
+ if (process.arch === 'arm64') {
65
+ try {
66
+ return require('./crc32.android-arm64.node')
67
+ } catch (e) {
68
+ loadErrors.push(e)
69
+ }
70
+ try {
71
+ return require('@node-rs/crc32-android-arm64')
72
+ } catch (e) {
73
+ loadErrors.push(e)
74
+ }
75
+
76
+ } else if (process.arch === 'arm') {
77
+ try {
78
+ return require('./crc32.android-arm-eabi.node')
79
+ } catch (e) {
80
+ loadErrors.push(e)
81
+ }
82
+ try {
83
+ return require('@node-rs/crc32-android-arm-eabi')
84
+ } catch (e) {
85
+ loadErrors.push(e)
86
+ }
87
+
88
+ } else {
89
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
90
+ }
91
+ } else if (process.platform === 'win32') {
92
+ if (process.arch === 'x64') {
93
+ try {
94
+ return require('./crc32.win32-x64-msvc.node')
95
+ } catch (e) {
96
+ loadErrors.push(e)
97
+ }
98
+ try {
99
+ return require('@node-rs/crc32-win32-x64-msvc')
100
+ } catch (e) {
101
+ loadErrors.push(e)
102
+ }
103
+
104
+ } else if (process.arch === 'ia32') {
105
+ try {
106
+ return require('./crc32.win32-ia32-msvc.node')
107
+ } catch (e) {
108
+ loadErrors.push(e)
109
+ }
110
+ try {
111
+ return require('@node-rs/crc32-win32-ia32-msvc')
112
+ } catch (e) {
113
+ loadErrors.push(e)
114
+ }
115
+
116
+ } else if (process.arch === 'arm64') {
117
+ try {
118
+ return require('./crc32.win32-arm64-msvc.node')
119
+ } catch (e) {
120
+ loadErrors.push(e)
121
+ }
122
+ try {
123
+ return require('@node-rs/crc32-win32-arm64-msvc')
124
+ } catch (e) {
125
+ loadErrors.push(e)
126
+ }
127
+
128
+ } else {
129
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
130
+ }
131
+ } else if (process.platform === 'darwin') {
132
+ try {
133
+ return require('./crc32.darwin-universal.node')
134
+ } catch (e) {
135
+ loadErrors.push(e)
136
+ }
137
+ try {
138
+ return require('@node-rs/crc32-darwin-universal')
139
+ } catch (e) {
140
+ loadErrors.push(e)
141
+ }
142
+
143
+ if (process.arch === 'x64') {
144
+ try {
145
+ return require('./crc32.darwin-x64.node')
146
+ } catch (e) {
147
+ loadErrors.push(e)
148
+ }
149
+ try {
150
+ return require('@node-rs/crc32-darwin-x64')
151
+ } catch (e) {
152
+ loadErrors.push(e)
153
+ }
154
+
155
+ } else if (process.arch === 'arm64') {
156
+ try {
157
+ return require('./crc32.darwin-arm64.node')
158
+ } catch (e) {
159
+ loadErrors.push(e)
160
+ }
161
+ try {
162
+ return require('@node-rs/crc32-darwin-arm64')
163
+ } catch (e) {
164
+ loadErrors.push(e)
165
+ }
166
+
167
+ } else {
168
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
169
+ }
170
+ } else if (process.platform === 'freebsd') {
171
+ if (process.arch === 'x64') {
172
+ try {
173
+ return require('./crc32.freebsd-x64.node')
174
+ } catch (e) {
175
+ loadErrors.push(e)
176
+ }
177
+ try {
178
+ return require('@node-rs/crc32-freebsd-x64')
179
+ } catch (e) {
180
+ loadErrors.push(e)
181
+ }
182
+
183
+ } else if (process.arch === 'arm64') {
184
+ try {
185
+ return require('./crc32.freebsd-arm64.node')
186
+ } catch (e) {
187
+ loadErrors.push(e)
188
+ }
189
+ try {
190
+ return require('@node-rs/crc32-freebsd-arm64')
191
+ } catch (e) {
192
+ loadErrors.push(e)
193
+ }
194
+
195
+ } else {
196
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
197
+ }
198
+ } else if (process.platform === 'linux') {
199
+ if (process.arch === 'x64') {
200
+ if (isMusl()) {
201
+ try {
202
+ return require('./crc32.linux-x64-musl.node')
203
+ } catch (e) {
204
+ loadErrors.push(e)
205
+ }
206
+ try {
207
+ return require('@node-rs/crc32-linux-x64-musl')
208
+ } catch (e) {
209
+ loadErrors.push(e)
210
+ }
211
+
212
+ } else {
213
+ try {
214
+ return require('./crc32.linux-x64-gnu.node')
215
+ } catch (e) {
216
+ loadErrors.push(e)
217
+ }
218
+ try {
219
+ return require('@node-rs/crc32-linux-x64-gnu')
220
+ } catch (e) {
221
+ loadErrors.push(e)
222
+ }
223
+
224
+ }
225
+ } else if (process.arch === 'arm64') {
226
+ if (isMusl()) {
227
+ try {
228
+ return require('./crc32.linux-arm64-musl.node')
229
+ } catch (e) {
230
+ loadErrors.push(e)
231
+ }
232
+ try {
233
+ return require('@node-rs/crc32-linux-arm64-musl')
234
+ } catch (e) {
235
+ loadErrors.push(e)
236
+ }
237
+
238
+ } else {
239
+ try {
240
+ return require('./crc32.linux-arm64-gnu.node')
241
+ } catch (e) {
242
+ loadErrors.push(e)
243
+ }
244
+ try {
245
+ return require('@node-rs/crc32-linux-arm64-gnu')
246
+ } catch (e) {
247
+ loadErrors.push(e)
248
+ }
249
+
250
+ }
251
+ } else if (process.arch === 'arm') {
252
+ if (isMusl()) {
253
+ try {
254
+ return require('./crc32.linux-arm-musleabihf.node')
255
+ } catch (e) {
256
+ loadErrors.push(e)
257
+ }
258
+ try {
259
+ return require('@node-rs/crc32-linux-arm-musleabihf')
260
+ } catch (e) {
261
+ loadErrors.push(e)
262
+ }
263
+
264
+ } else {
265
+ try {
266
+ return require('./crc32.linux-arm-gnueabihf.node')
267
+ } catch (e) {
268
+ loadErrors.push(e)
269
+ }
270
+ try {
271
+ return require('@node-rs/crc32-linux-arm-gnueabihf')
272
+ } catch (e) {
273
+ loadErrors.push(e)
274
+ }
275
+
276
+ }
277
+ } else if (process.arch === 'riscv64') {
278
+ if (isMusl()) {
279
+ try {
280
+ return require('./crc32.linux-riscv64-musl.node')
281
+ } catch (e) {
282
+ loadErrors.push(e)
283
+ }
284
+ try {
285
+ return require('@node-rs/crc32-linux-riscv64-musl')
286
+ } catch (e) {
287
+ loadErrors.push(e)
288
+ }
289
+
290
+ } else {
291
+ try {
292
+ return require('./crc32.linux-riscv64-gnu.node')
293
+ } catch (e) {
294
+ loadErrors.push(e)
295
+ }
296
+ try {
297
+ return require('@node-rs/crc32-linux-riscv64-gnu')
298
+ } catch (e) {
299
+ loadErrors.push(e)
300
+ }
301
+
302
+ }
303
+ } else if (process.arch === 'ppc64') {
304
+ try {
305
+ return require('./crc32.linux-ppc64-gnu.node')
306
+ } catch (e) {
307
+ loadErrors.push(e)
308
+ }
309
+ try {
310
+ return require('@node-rs/crc32-linux-ppc64-gnu')
311
+ } catch (e) {
312
+ loadErrors.push(e)
313
+ }
314
+
315
+ } else if (process.arch === 's390x') {
316
+ try {
317
+ return require('./crc32.linux-s390x-gnu.node')
318
+ } catch (e) {
319
+ loadErrors.push(e)
320
+ }
321
+ try {
322
+ return require('@node-rs/crc32-linux-s390x-gnu')
323
+ } catch (e) {
324
+ loadErrors.push(e)
325
+ }
326
+
327
+ } else {
328
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
329
+ }
330
+ } else {
331
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
332
+ }
333
+ }
334
+
335
+ nativeBinding = requireNative()
336
+
337
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
338
+ try {
339
+ nativeBinding = require('./crc32.wasi.cjs')
340
+ } catch (err) {
341
+ if (process.env.NAPI_RS_FORCE_WASI) {
342
+ loadErrors.push(err)
343
+ }
344
+ }
345
+ if (!nativeBinding) {
346
+ try {
347
+ nativeBinding = require('@node-rs/crc32-wasm32-wasi')
348
+ } catch (err) {
349
+ if (process.env.NAPI_RS_FORCE_WASI) {
350
+ loadErrors.push(err)
351
+ }
352
+ }
353
+ }
354
+ }
355
+
356
+ if (!nativeBinding) {
357
+ if (loadErrors.length > 0) {
358
+ // TODO Link to documentation with potential fixes
359
+ // - The package owner could build/publish bindings for this arch
360
+ // - The user may need to bundle the correct files
361
+ // - The user may need to re-install node_modules to get new packages
362
+ throw new Error('Failed to load native binding', { cause: loadErrors })
363
+ }
364
+ throw new Error(`Failed to load native binding`)
365
+ }
366
+
367
+ module.exports.crc32 = nativeBinding.crc32
368
+ module.exports.crc32c = nativeBinding.crc32c
@@ -0,0 +1,97 @@
1
+ {
2
+ "name": "@node-rs/crc32",
3
+ "version": "1.10.6",
4
+ "description": "SIMD crc32",
5
+ "keywords": [
6
+ "SIMD",
7
+ "NAPI",
8
+ "napi-rs",
9
+ "node-rs",
10
+ "crc32",
11
+ "crc32c"
12
+ ],
13
+ "author": "LongYinan <lynweklm@gmail.com>",
14
+ "homepage": "https://github.com/napi-rs/node-rs",
15
+ "license": "MIT",
16
+ "main": "index.js",
17
+ "typings": "index.d.ts",
18
+ "browser": "browser.js",
19
+ "files": [
20
+ "index.js",
21
+ "index.d.ts",
22
+ "browser.js",
23
+ "LICENSE"
24
+ ],
25
+ "napi": {
26
+ "binaryName": "crc32",
27
+ "targets": [
28
+ "x86_64-apple-darwin",
29
+ "aarch64-apple-darwin",
30
+ "x86_64-pc-windows-msvc",
31
+ "x86_64-unknown-linux-gnu",
32
+ "aarch64-linux-android",
33
+ "aarch64-unknown-linux-gnu",
34
+ "aarch64-unknown-linux-musl",
35
+ "aarch64-pc-windows-msvc",
36
+ "armv7-unknown-linux-gnueabihf",
37
+ "x86_64-unknown-linux-musl",
38
+ "x86_64-unknown-freebsd",
39
+ "i686-pc-windows-msvc",
40
+ "armv7-linux-androideabi",
41
+ "wasm32-wasip1-threads"
42
+ ]
43
+ },
44
+ "engines": {
45
+ "node": ">= 10"
46
+ },
47
+ "publishConfig": {
48
+ "registry": "https://registry.npmjs.org/",
49
+ "access": "public"
50
+ },
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/napi-rs/node-rs.git"
54
+ },
55
+ "scripts": {
56
+ "artifacts": "napi artifacts -d ../../artifacts",
57
+ "bench": "cross-env NODE_ENV=production node --import @oxc-node/core/register benchmark/crc32.ts",
58
+ "build": "napi build --platform --release",
59
+ "build:debug": "napi build --platform",
60
+ "prepublishOnly": "napi prepublish",
61
+ "version": "napi version"
62
+ },
63
+ "bugs": {
64
+ "url": "https://github.com/napi-rs/node-rs/issues"
65
+ },
66
+ "devDependencies": {
67
+ "@napi-rs/cli": "^3.0.0-alpha.64",
68
+ "@types/crc": "^4.0.0",
69
+ "@types/sse4_crc32": "^7.0.3",
70
+ "buffer": "^6.0.3",
71
+ "crc": "^4.3.2",
72
+ "cross-env": "^7.0.3",
73
+ "sse4_crc32": "^7.0.0",
74
+ "tinybench": "^3.0.0"
75
+ },
76
+ "funding": {
77
+ "type": "github",
78
+ "url": "https://github.com/sponsors/Brooooooklyn"
79
+ },
80
+ "gitHead": "83ca124b3e3968c945708136d6ff68d0e0549582",
81
+ "optionalDependencies": {
82
+ "@node-rs/crc32-darwin-x64": "1.10.6",
83
+ "@node-rs/crc32-darwin-arm64": "1.10.6",
84
+ "@node-rs/crc32-win32-x64-msvc": "1.10.6",
85
+ "@node-rs/crc32-linux-x64-gnu": "1.10.6",
86
+ "@node-rs/crc32-android-arm64": "1.10.6",
87
+ "@node-rs/crc32-linux-arm64-gnu": "1.10.6",
88
+ "@node-rs/crc32-linux-arm64-musl": "1.10.6",
89
+ "@node-rs/crc32-win32-arm64-msvc": "1.10.6",
90
+ "@node-rs/crc32-linux-arm-gnueabihf": "1.10.6",
91
+ "@node-rs/crc32-linux-x64-musl": "1.10.6",
92
+ "@node-rs/crc32-freebsd-x64": "1.10.6",
93
+ "@node-rs/crc32-win32-ia32-msvc": "1.10.6",
94
+ "@node-rs/crc32-android-arm-eabi": "1.10.6",
95
+ "@node-rs/crc32-wasm32-wasi": "1.10.6"
96
+ }
97
+ }
@@ -0,0 +1,3 @@
1
+ # `@node-rs/crc32-linux-x64-gnu`
2
+
3
+ This is the **x86_64-unknown-linux-gnu** binary for `@node-rs/crc32`
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@node-rs/crc32-linux-x64-gnu",
3
+ "version": "1.10.6",
4
+ "cpu": [
5
+ "x64"
6
+ ],
7
+ "main": "crc32.linux-x64-gnu.node",
8
+ "files": [
9
+ "crc32.linux-x64-gnu.node"
10
+ ],
11
+ "description": "SIMD crc32",
12
+ "keywords": [
13
+ "SIMD",
14
+ "NAPI",
15
+ "napi-rs",
16
+ "node-rs",
17
+ "crc32",
18
+ "crc32c"
19
+ ],
20
+ "author": "LongYinan <lynweklm@gmail.com>",
21
+ "homepage": "https://github.com/napi-rs/node-rs",
22
+ "license": "MIT",
23
+ "engines": {
24
+ "node": ">= 10"
25
+ },
26
+ "publishConfig": {
27
+ "registry": "https://registry.npmjs.org/",
28
+ "access": "public"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/napi-rs/node-rs.git"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/napi-rs/node-rs/issues"
36
+ },
37
+ "os": [
38
+ "linux"
39
+ ],
40
+ "libc": [
41
+ "glibc"
42
+ ]
43
+ }
@@ -0,0 +1,3 @@
1
+ # `@node-rs/crc32-linux-x64-musl`
2
+
3
+ This is the **x86_64-unknown-linux-musl** binary for `@node-rs/crc32`