@nitpicker/core 0.18.0 → 0.19.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.
@@ -32,8 +32,8 @@ export { definePlugin } from './hooks/define-plugin.js';
32
32
  * ```ts
33
33
  * import { Nitpicker } from '@nitpicker/core';
34
34
  *
35
- * // Open an existing archive
36
- * const nitpicker = await Nitpicker.open('./example.nitpicker');
35
+ * // Open an existing archive — `Symbol.asyncDispose` closes it on scope exit
36
+ * await using nitpicker = await Nitpicker.open('./example.nitpicker');
37
37
  *
38
38
  * // Run all configured analyze plugins
39
39
  * await nitpicker.analyze();
@@ -56,6 +56,11 @@ export declare class Nitpicker extends EventEmitter<NitpickerEvent> {
56
56
  * Use {@link Nitpicker.open} for a convenient static factory.
57
57
  */
58
58
  constructor(archive: Archive);
59
+ /**
60
+ * Enables `await using nitpicker = ...`. Delegates to the wrapped
61
+ * archive's `Symbol.asyncDispose` (i.e. {@link Archive.close}).
62
+ */
63
+ [Symbol.asyncDispose](): Promise<void>;
59
64
  /**
60
65
  * Runs all configured analyze plugins (or a filtered subset) against
61
66
  * every page in the archive.
@@ -151,6 +156,10 @@ export declare class Nitpicker extends EventEmitter<NitpickerEvent> {
151
156
  * the archive to a temporary directory, opens the SQLite database, and
152
157
  * enables plugin data access.
153
158
  * @param filePath - Path to the `.nitpicker` archive file.
159
+ * @param onExtractProgress - Forwarded to `Archive.open` — called during
160
+ * the untar step with bytes read so far and the archive's total size
161
+ * (issue #294: a large archive's extraction can take tens of seconds
162
+ * with no other signal it isn't hung).
154
163
  * @returns A new Nitpicker instance backed by the opened archive.
155
164
  * @example
156
165
  * ```ts
@@ -159,5 +168,5 @@ export declare class Nitpicker extends EventEmitter<NitpickerEvent> {
159
168
  * await nitpicker.write();
160
169
  * ```
161
170
  */
162
- static open(filePath: string): Promise<Nitpicker>;
171
+ static open(filePath: string, onExtractProgress?: (readBytes: number, totalBytes: number) => void): Promise<Nitpicker>;
163
172
  }
package/lib/nitpicker.js CHANGED
@@ -89,8 +89,8 @@ function formatTemplateClassificationProgress(event) {
89
89
  * ```ts
90
90
  * import { Nitpicker } from '@nitpicker/core';
91
91
  *
92
- * // Open an existing archive
93
- * const nitpicker = await Nitpicker.open('./example.nitpicker');
92
+ * // Open an existing archive — `Symbol.asyncDispose` closes it on scope exit
93
+ * await using nitpicker = await Nitpicker.open('./example.nitpicker');
94
94
  *
95
95
  * // Run all configured analyze plugins
96
96
  * await nitpicker.analyze();
@@ -132,6 +132,13 @@ export class Nitpicker extends EventEmitter {
132
132
  super();
133
133
  this.#archive = archive;
134
134
  }
135
+ /**
136
+ * Enables `await using nitpicker = ...`. Delegates to the wrapped
137
+ * archive's `Symbol.asyncDispose` (i.e. {@link Archive.close}).
138
+ */
139
+ async [Symbol.asyncDispose]() {
140
+ await this.#archive.close();
141
+ }
135
142
  /**
136
143
  * Runs all configured analyze plugins (or a filtered subset) against
137
144
  * every page in the archive.
@@ -561,6 +568,10 @@ export class Nitpicker extends EventEmitter {
561
568
  * the archive to a temporary directory, opens the SQLite database, and
562
569
  * enables plugin data access.
563
570
  * @param filePath - Path to the `.nitpicker` archive file.
571
+ * @param onExtractProgress - Forwarded to `Archive.open` — called during
572
+ * the untar step with bytes read so far and the archive's total size
573
+ * (issue #294: a large archive's extraction can take tens of seconds
574
+ * with no other signal it isn't hung).
564
575
  * @returns A new Nitpicker instance backed by the opened archive.
565
576
  * @example
566
577
  * ```ts
@@ -569,8 +580,12 @@ export class Nitpicker extends EventEmitter {
569
580
  * await nitpicker.write();
570
581
  * ```
571
582
  */
572
- static async open(filePath) {
573
- const archive = await Archive.open({ filePath, openPluginData: true });
583
+ static async open(filePath, onExtractProgress) {
584
+ const archive = await Archive.open({
585
+ filePath,
586
+ openPluginData: true,
587
+ onExtractProgress,
588
+ });
574
589
  return new Nitpicker(archive);
575
590
  }
576
591
  }
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@nitpicker/core",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Plugin-based page analysis engine for Nitpicker",
5
5
  "author": "D-ZERO",
6
6
  "license": "Apache-2.0",
7
+ "engines": {
8
+ "node": ">=24.11.0"
9
+ },
7
10
  "repository": {
8
11
  "type": "git",
9
12
  "url": "https://github.com/d-zero-dev/nitpicker.git",
@@ -27,14 +30,14 @@
27
30
  "clean": "tsc --build --clean"
28
31
  },
29
32
  "dependencies": {
30
- "@d-zero/dealer": "1.10.4",
31
- "@d-zero/page-cluster": "0.5.6",
32
- "@d-zero/shared": "0.22.5",
33
- "@nitpicker/crawler": "0.18.0",
34
- "@nitpicker/types": "0.18.0",
33
+ "@d-zero/dealer": "1.12.0",
34
+ "@d-zero/page-cluster": "0.6.0",
35
+ "@d-zero/shared": "0.23.0",
36
+ "@nitpicker/crawler": "0.19.0",
37
+ "@nitpicker/types": "0.19.0",
35
38
  "ansi-colors": "4.1.3",
36
- "cosmiconfig": "9.0.2",
39
+ "cosmiconfig": "10.0.0",
37
40
  "jsdom": "29.1.1"
38
41
  },
39
- "gitHead": "9be5b756adb5bfaaa3e7fd52fabc93213c7e0b50"
42
+ "gitHead": "b79b5c304820d924168a139e7148e0593c29fe1c"
40
43
  }