@openzim/libzim 3.2.2 → 3.3.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.
package/.env CHANGED
@@ -1 +1 @@
1
- LIBZIM_VERSION=9.2.1
1
+ LIBZIM_VERSION=9.3.0
package/Changelog CHANGED
@@ -1,3 +1,12 @@
1
+ 3.3.0
2
+ * NEW: Use libzim 9.3.0
3
+ * UPDATE: Upgrade many dependencies versions
4
+ * UPDATE: drop macOS12, add macOS15 in the CI
5
+ * UPDATE: drop ubuntu-20.04, add ubuntu-24.04 in the CI
6
+
7
+ 3.2.3
8
+ * FIX: Module (finally) properly in ESM format
9
+
1
10
  3.2.2
2
11
  * FIX: Module properly in ESM format
3
12
  * FIX: Upgrade version of node-gyp
package/README.md CHANGED
@@ -6,10 +6,11 @@ This is the Node.js binding to the
6
6
  [ZIM](https://openzim.org) files easily in Javascript.
7
7
 
8
8
  [![npm](https://img.shields.io/npm/v/@openzim/libzim.svg)](https://www.npmjs.com/package/@openzim/libzim)
9
- [![Build Status](https://github.com/openzim/node-libzim/workflows/CI/badge.svg?branch=main)](https://github.com/openzim/node-libzim/actions?query=branch%3Amain)
9
+ [![Build Status](https://github.com/openzim/node-libzim/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/openzim/node-libzim/actions/workflows/ci.yml?query=branch%3Amain)
10
10
  [![codecov](https://codecov.io/gh/openzim/node-libzim/branch/main/graph/badge.svg)](https://codecov.io/gh/openzim/node-libzim)
11
11
  [![CodeFactor](https://www.codefactor.io/repository/github/openzim/node-libzim/badge)](https://www.codefactor.io/repository/github/openzim/node-libzim)
12
12
  [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
13
+ [![Join Slack](https://img.shields.io/badge/Join%20us%20on%20Slack%20%23mwoffliner-2EB67D)](https://slack.kiwix.org)
13
14
 
14
15
  ## Dependencies
15
16
 
package/bundle-libzim.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import dotenv from "dotenv";
2
2
  dotenv.config();
3
- import mkdirp from "mkdirp";
3
+ import { mkdirp } from "mkdirp";
4
4
  import exec from "exec-then";
5
5
  import os from "os";
6
6
 
@@ -11,14 +11,14 @@ const isLinux = os.type() === "Linux";
11
11
 
12
12
  if (!isMacOS && !isLinux) {
13
13
  console.warn(
14
- "\x1b[41m\n================================ README \n\nlibzim bundle with prebuilt binaries only available for macOS and Linux:\n\n\thttps://github.com/openzim/libzim/\n\n================================\x1b[0m\n"
14
+ "\x1b[41m\n================================ README \n\nlibzim bundle with prebuilt binaries only available for macOS and Linux:\n\n\thttps://github.com/openzim/libzim/\n\n================================\x1b[0m\n",
15
15
  );
16
16
  }
17
17
 
18
18
  if (isLinux) {
19
19
  console.info("Copying libzim.so.9 to build folder");
20
20
  exec(
21
- "cp download/lib/x86_64-linux-gnu/libzim.so.9 build/Release/libzim.so.9"
21
+ "cp download/lib/x86_64-linux-gnu/libzim.so.9 build/Release/libzim.so.9",
22
22
  );
23
23
  exec("ln -sf build/Release/libzim.so.9 build/Release/libzim.so"); // convienience only, not required
24
24
  }
@@ -28,6 +28,6 @@ if (isMacOS) {
28
28
  exec("ln -sf build/Release/libzim.9.dylib build/Release/libzim.dylib"); // convienience only, not required
29
29
  console.info("Fixing rpath");
30
30
  exec(
31
- "install_name_tool -change libzim.9.dylib @loader_path/libzim.9.dylib build/Release/zim_binding.node"
31
+ "install_name_tool -change libzim.9.dylib @loader_path/libzim.9.dylib build/Release/zim_binding.node",
32
32
  );
33
33
  }
package/dist/index.d.ts CHANGED
@@ -66,7 +66,7 @@ export class StringItem {
66
66
  mimeType: string,
67
67
  title: string,
68
68
  hint: Hint,
69
- content: ArrayBuffer | Buffer | string
69
+ content: ArrayBuffer | Buffer | string,
70
70
  );
71
71
  readonly path: string;
72
72
  readonly title: string;
@@ -81,7 +81,7 @@ export class FileItem {
81
81
  mimeType: string,
82
82
  title: string,
83
83
  hints: Hint,
84
- filePath: string
84
+ filePath: string,
85
85
  );
86
86
  readonly path: string;
87
87
  readonly title: string;
@@ -102,14 +102,14 @@ export class Creator {
102
102
  addMetadata(
103
103
  name: string,
104
104
  content: string | ContentProvider,
105
- mimetype?: string
105
+ mimetype?: string,
106
106
  ): void;
107
107
  addIllustration(size: number, content: string | ContentProvider): void;
108
108
  addRedirection(
109
109
  path: string,
110
110
  title: string,
111
111
  targetPath: string,
112
- hints?: Hint
112
+ hints?: Hint,
113
113
  ): void;
114
114
  setMainPath(mainPath: string): void;
115
115
  setUuid(uuid: string): void;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import bindings from "bindings";
2
2
 
3
- const {
3
+ export const {
4
4
  Archive,
5
5
  Entry,
6
6
  IntegrityCheck,
@@ -15,19 +15,3 @@ const {
15
15
  StringItem,
16
16
  FileItem,
17
17
  } = bindings("zim_binding");
18
-
19
- module.exports = {
20
- Archive,
21
- Entry,
22
- IntegrityCheck,
23
- Compression,
24
- Blob,
25
- Searcher,
26
- Query,
27
- SuggestionSearcher,
28
- Creator,
29
- StringProvider,
30
- FileProvider,
31
- StringItem,
32
- FileItem,
33
- };
@@ -1,7 +1,7 @@
1
1
  import dotenv from "dotenv";
2
2
  dotenv.config();
3
3
  import axios from "axios";
4
- import mkdirp from "mkdirp";
4
+ import { mkdirp } from "mkdirp";
5
5
  import exec from "exec-then";
6
6
  import os from "os";
7
7
  import fs from "fs";
@@ -20,21 +20,21 @@ const isAvailableArch =
20
20
 
21
21
  if (!isMacOS && !isLinux) {
22
22
  console.warn(
23
- `\x1b[41m\n================================ README \n\nPre-built binaries only available on Linux and MacOS for now...\nPlease ensure you have libzim installed globally on this machine:\n\n\thttps://github.com/openzim/libzim/\n\n================================\x1b[0m\n`
23
+ `\x1b[41m\n================================ README \n\nPre-built binaries only available on Linux and MacOS for now...\nPlease ensure you have libzim installed globally on this machine:\n\n\thttps://github.com/openzim/libzim/\n\n================================\x1b[0m\n`,
24
24
  );
25
25
  }
26
26
  if (!isAvailableArch) {
27
27
  console.warn(
28
- `\x1b[41m\n================================ README \n\nPre-built binaries only available on x86_64, arm and arm64 for now...\nPlease ensure you have libzim installed globally on this machine:\n\n\thttps://github.com/openzim/libzim/\n\n================================\x1b[0m\n`
28
+ `\x1b[41m\n================================ README \n\nPre-built binaries only available on x86_64, arm and arm64 for now...\nPlease ensure you have libzim installed globally on this machine:\n\n\thttps://github.com/openzim/libzim/\n\n================================\x1b[0m\n`,
29
29
  );
30
30
  }
31
31
 
32
32
  let osPrefix = isMacOS ? "macos" : "linux";
33
- let osArch = isLinux ? "x86_64-bionic" : "x86_64";
33
+ let osArch = isLinux ? "x86_64" : "x86_64";
34
34
 
35
35
  if (rawArch !== "x64") {
36
36
  if (isLinux) {
37
- osArch = rawArch === "arm64" ? "aarch64-bionic" : "armhf";
37
+ osArch = rawArch === "arm64" ? "aarch64-manylinux" : "armhf";
38
38
  } else {
39
39
  osArch = rawArch;
40
40
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@openzim/libzim",
3
3
  "main": "dist/index.js",
4
4
  "types": "dist/index.d.js",
5
- "version": "3.2.2",
5
+ "version": "3.3.0",
6
6
  "description": "Libzim bindings for NodeJS",
7
7
  "type": "module",
8
8
  "scripts": {
@@ -14,8 +14,9 @@
14
14
  "build": "node-gyp rebuild -v && npm run bundle",
15
15
  "download": "node ./download-libzim.js",
16
16
  "bundle": "node ./bundle-libzim.js",
17
- "test": "jest",
17
+ "test": "jest --testPathIgnorePatterns=test/dist.test.ts",
18
18
  "test-mem-leak": "node -r ts-node/register test/makeLargeZim.ts",
19
+ "test:dist": "npm run build && jest",
19
20
  "lint": "npx eslint .",
20
21
  "lint:fix": "npx eslint . --fix"
21
22
  },
@@ -41,31 +42,30 @@
41
42
  "gypfile": true,
42
43
  "dependencies": {
43
44
  "@types/bindings": "^1.5.1",
44
- "@types/jest": "^28.1.6",
45
+ "@types/jest": "^29.5.12",
45
46
  "@types/node": "^18.0.6",
46
47
  "axios": "^1.6.0",
47
48
  "bindings": "^1.5.0",
48
49
  "dotenv": "^16.0.1",
49
50
  "exec-then": "^1.3.1",
50
- "mkdirp": "^1.0.4",
51
- "node-addon-api": "^5.0.0",
51
+ "mkdirp": "^3.0.1",
52
+ "node-addon-api": "^8.0.0",
52
53
  "node-gyp": "^10.1.0",
53
54
  "tqdm": "^2.0.3",
54
55
  "ts-node": "^10.9.1",
55
56
  "tsconfig-paths": "^4.0.0"
56
57
  },
57
58
  "devDependencies": {
58
- "@faker-js/faker": "^7.6.0",
59
+ "@faker-js/faker": "^8.4.1",
59
60
  "@typescript-eslint/eslint-plugin": "^5.59.2",
60
61
  "@typescript-eslint/parser": "^5.59.2",
61
- "eslint": "^8.39.0",
62
- "eslint-config-prettier": "^8.8.0",
63
- "eslint-plugin-prettier": "^4.2.1",
64
- "jest": "^28.1.3",
65
- "nyc": "^15.1.0",
66
- "prettier": "^2.8.8",
67
- "ts-jest": "^28.0.7",
68
- "typescript": "^4.7.4"
62
+ "eslint": "^8.57.0",
63
+ "eslint-config-prettier": "^8.10.0",
64
+ "eslint-plugin-prettier": "^5.1.3",
65
+ "nyc": "^17.0.0",
66
+ "prettier": "^3.3.2",
67
+ "ts-jest": "^29.1.5",
68
+ "typescript": "^5.1.6"
69
69
  },
70
70
  "jest": {
71
71
  "preset": "ts-jest/presets/js-with-ts"
package/src/index.d.ts CHANGED
@@ -66,7 +66,7 @@ export class StringItem {
66
66
  mimeType: string,
67
67
  title: string,
68
68
  hint: Hint,
69
- content: ArrayBuffer | Buffer | string
69
+ content: ArrayBuffer | Buffer | string,
70
70
  );
71
71
  readonly path: string;
72
72
  readonly title: string;
@@ -81,7 +81,7 @@ export class FileItem {
81
81
  mimeType: string,
82
82
  title: string,
83
83
  hints: Hint,
84
- filePath: string
84
+ filePath: string,
85
85
  );
86
86
  readonly path: string;
87
87
  readonly title: string;
@@ -102,14 +102,14 @@ export class Creator {
102
102
  addMetadata(
103
103
  name: string,
104
104
  content: string | ContentProvider,
105
- mimetype?: string
105
+ mimetype?: string,
106
106
  ): void;
107
107
  addIllustration(size: number, content: string | ContentProvider): void;
108
108
  addRedirection(
109
109
  path: string,
110
110
  title: string,
111
111
  targetPath: string,
112
- hints?: Hint
112
+ hints?: Hint,
113
113
  ): void;
114
114
  setMainPath(mainPath: string): void;
115
115
  setUuid(uuid: string): void;
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import bindings from "bindings";
2
2
 
3
- const {
3
+ export const {
4
4
  Archive,
5
5
  Entry,
6
6
  IntegrityCheck,
@@ -15,19 +15,3 @@ const {
15
15
  StringItem,
16
16
  FileItem,
17
17
  } = bindings("zim_binding");
18
-
19
- module.exports = {
20
- Archive,
21
- Entry,
22
- IntegrityCheck,
23
- Compression,
24
- Blob,
25
- Searcher,
26
- Query,
27
- SuggestionSearcher,
28
- Creator,
29
- StringProvider,
30
- FileProvider,
31
- StringItem,
32
- FileItem,
33
- };