zotero-plugin-scaffold 0.4.0 → 0.4.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.
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import { l as logger, E as ExitSignals, C as Config, B as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.
|
|
3
|
+
import { l as logger, E as ExitSignals, C as Config, B as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.DGHktPRh.mjs';
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
5
|
import { pathExists } from 'fs-extra';
|
|
6
6
|
import tinyUpdateNotifier from 'tiny-update-notifier';
|
|
@@ -31,7 +31,7 @@ import 'xvfb-ts';
|
|
|
31
31
|
import 'node:http';
|
|
32
32
|
|
|
33
33
|
const name = "zotero-plugin-scaffold";
|
|
34
|
-
const version = "0.4.
|
|
34
|
+
const version = "0.4.2";
|
|
35
35
|
const pkg = {
|
|
36
36
|
name: name,
|
|
37
37
|
version: version};
|
package/dist/index.d.mts
CHANGED
|
@@ -45,12 +45,9 @@ declare class Logger {
|
|
|
45
45
|
success(content: unknown, options?: LoggerOptions): void;
|
|
46
46
|
fail(content: unknown, options?: LoggerOptions): void;
|
|
47
47
|
ready(content: string): void;
|
|
48
|
+
log(content: unknown, options?: LoggerOptions): void;
|
|
48
49
|
clear(): void;
|
|
49
50
|
newLine(): void;
|
|
50
|
-
/**
|
|
51
|
-
* Direct passthrough to console.log
|
|
52
|
-
*/
|
|
53
|
-
log(content: unknown): void;
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
interface Manifest {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as Build, C as Config, R as Release, S as Serve, T as Test, d as defineConfig } from './shared/zotero-plugin-scaffold.
|
|
1
|
+
export { B as Build, C as Config, R as Release, S as Serve, T as Test, d as defineConfig } from './shared/zotero-plugin-scaffold.DGHktPRh.mjs';
|
|
2
2
|
import 'c12';
|
|
3
3
|
import 'es-toolkit';
|
|
4
4
|
import 'fs-extra/esm';
|
package/dist/shared/{zotero-plugin-scaffold.CLDX-OU6.mjs → zotero-plugin-scaffold.DGHktPRh.mjs}
RENAMED
|
@@ -49,7 +49,9 @@ const SYMBOLS = {
|
|
|
49
49
|
TIP: styleText.blue("\u2192"),
|
|
50
50
|
ERROR: styleText.bgRed(" ERROR "),
|
|
51
51
|
WARN: styleText.bgYellow(" WARN "),
|
|
52
|
-
DEBUG: styleText.grey("\u2699")
|
|
52
|
+
DEBUG: styleText.grey("\u2699"),
|
|
53
|
+
NONE: ""
|
|
54
|
+
};
|
|
53
55
|
const DEFAULT_OPTIONS = {
|
|
54
56
|
SPACE: 0,
|
|
55
57
|
NEW_LINE: false
|
|
@@ -84,6 +86,10 @@ const LOG_METHODS_CONFIG = {
|
|
|
84
86
|
fail: {
|
|
85
87
|
level: 4 /* ERROR */,
|
|
86
88
|
symbol: SYMBOLS.FAIL
|
|
89
|
+
},
|
|
90
|
+
log: {
|
|
91
|
+
level: 2 /* INFO */,
|
|
92
|
+
symbol: SYMBOLS.NONE
|
|
87
93
|
}
|
|
88
94
|
};
|
|
89
95
|
class Logger {
|
|
@@ -173,6 +179,9 @@ ${error.stack}`;
|
|
|
173
179
|
ready(content) {
|
|
174
180
|
this.logInternal(styleText.green(content), LOG_METHODS_CONFIG.success);
|
|
175
181
|
}
|
|
182
|
+
log(content, options) {
|
|
183
|
+
this.logInternal(content, LOG_METHODS_CONFIG.log, options);
|
|
184
|
+
}
|
|
176
185
|
clear() {
|
|
177
186
|
const blank = process.stdout.rows > 2 ? "\n".repeat(process.stdout.rows - 2) : "";
|
|
178
187
|
console.log(blank);
|
|
@@ -182,12 +191,6 @@ ${error.stack}`;
|
|
|
182
191
|
newLine() {
|
|
183
192
|
console.log();
|
|
184
193
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Direct passthrough to console.log
|
|
187
|
-
*/
|
|
188
|
-
log(content) {
|
|
189
|
-
console.log(content);
|
|
190
|
-
}
|
|
191
194
|
}
|
|
192
195
|
const logger = Logger.getInstance();
|
|
193
196
|
|
|
@@ -397,6 +400,9 @@ class PrefsManager {
|
|
|
397
400
|
else
|
|
398
401
|
throw new Error("Invalid prefs.js file - unsupported value type.");
|
|
399
402
|
break;
|
|
403
|
+
case "TemplateLiteral":
|
|
404
|
+
value = arg2.expression.quasis[0]?.cooked ?? "";
|
|
405
|
+
break;
|
|
400
406
|
default:
|
|
401
407
|
throw new Error("Invalid prefs.js file - unsupported value type.");
|
|
402
408
|
}
|
|
@@ -1249,6 +1255,7 @@ function watch(source, event) {
|
|
|
1249
1255
|
persistent: true
|
|
1250
1256
|
});
|
|
1251
1257
|
const onChangeDebounced = safeDebounce(event.onChange);
|
|
1258
|
+
const onAddDebounced = safeDebounce(event.onAdd);
|
|
1252
1259
|
watcher.on("ready", async () => {
|
|
1253
1260
|
if (event.onReady)
|
|
1254
1261
|
await event.onReady();
|
|
@@ -1258,6 +1265,9 @@ function watch(source, event) {
|
|
|
1258
1265
|
logger.clear();
|
|
1259
1266
|
logger.info(`${path} changed`);
|
|
1260
1267
|
await onChangeDebounced(path);
|
|
1268
|
+
}).on("add", async (path, stats) => {
|
|
1269
|
+
if (event.onAdd)
|
|
1270
|
+
await onAddDebounced(path, stats);
|
|
1261
1271
|
}).on("error", async (err) => {
|
|
1262
1272
|
if (event.onError)
|
|
1263
1273
|
await event.onError(err);
|
|
@@ -2262,19 +2272,36 @@ class TestHttpReporter {
|
|
|
2262
2272
|
logger.tip(data.title, logger_option);
|
|
2263
2273
|
break;
|
|
2264
2274
|
case "pass":
|
|
2265
|
-
this.passed++;
|
|
2266
2275
|
logger.success(`${data.title} ${styleText.gray(`${data.duration}ms`)}`, logger_option);
|
|
2267
2276
|
break;
|
|
2268
|
-
case "fail":
|
|
2269
|
-
|
|
2270
|
-
|
|
2277
|
+
case "fail": {
|
|
2278
|
+
let formatOutput = function(obj, indent) {
|
|
2279
|
+
const jsonStr = JSON.stringify(obj, null, 2);
|
|
2280
|
+
const lines = jsonStr.split("\n");
|
|
2281
|
+
const firstLine = lines[0];
|
|
2282
|
+
const restLines = lines.slice(1).map((line) => " ".repeat(indent) + line).join("\n");
|
|
2283
|
+
return `${firstLine}
|
|
2284
|
+
${restLines}`;
|
|
2285
|
+
};
|
|
2286
|
+
logger.fail(styleText.red(`${data.title}, ${data?.error?.message}`), logger_option);
|
|
2287
|
+
let expected = data.error.expected;
|
|
2288
|
+
let received = data.error.actual;
|
|
2289
|
+
if (expected && typeof expected === "object")
|
|
2290
|
+
expected = formatOutput(expected, data.indents + 1);
|
|
2291
|
+
if (received && typeof received === "object")
|
|
2292
|
+
received = formatOutput(received, data.indents + 1);
|
|
2293
|
+
logger.log(`Expected: ${styleText.green(String(expected))}`, { space: data.indents + 0.5 });
|
|
2294
|
+
logger.log(`Received: ${styleText.red(String(received))}`, { space: data.indents + 0.5 });
|
|
2271
2295
|
break;
|
|
2296
|
+
}
|
|
2272
2297
|
case "pending":
|
|
2273
2298
|
logger.info(`${data.title} pending`, logger_option);
|
|
2274
2299
|
break;
|
|
2275
2300
|
case "suite end":
|
|
2276
2301
|
break;
|
|
2277
2302
|
case "end":
|
|
2303
|
+
this.passed = data.passed;
|
|
2304
|
+
this.failed = data.failed;
|
|
2278
2305
|
logger.newLine();
|
|
2279
2306
|
if (this.failed === 0)
|
|
2280
2307
|
logger.success(`Test run completed - ${this.passed} passed`);
|
|
@@ -2761,6 +2788,16 @@ class Test extends Base {
|
|
|
2761
2788
|
await this.testBundler?.regenerate(path);
|
|
2762
2789
|
await this.zotero?.reloadTemporaryPluginBySourceDir(TESTER_PLUGIN_DIR);
|
|
2763
2790
|
}
|
|
2791
|
+
},
|
|
2792
|
+
onAdd: async (path) => {
|
|
2793
|
+
if (isSource(path)) {
|
|
2794
|
+
await this.builder.run();
|
|
2795
|
+
await this.testBundler?.regenerate(path);
|
|
2796
|
+
await this.zotero?.reloadAllPlugins();
|
|
2797
|
+
} else {
|
|
2798
|
+
await this.testBundler?.generate();
|
|
2799
|
+
await this.zotero?.reloadTemporaryPluginBySourceDir(TESTER_PLUGIN_DIR);
|
|
2800
|
+
}
|
|
2764
2801
|
}
|
|
2765
2802
|
}
|
|
2766
2803
|
);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zotero-plugin-scaffold",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.2",
|
|
5
5
|
"description": "A scaffold for Zotero plugin development.",
|
|
6
6
|
"author": "northword",
|
|
7
7
|
"license": "AGPL-3.0-or-later",
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@swc/core": "^1.11.
|
|
66
|
+
"@swc/core": "^1.11.16",
|
|
67
67
|
"adm-zip": "^0.5.16",
|
|
68
68
|
"bumpp": "^10.1.0",
|
|
69
|
-
"c12": "^3.0.
|
|
69
|
+
"c12": "^3.0.3",
|
|
70
70
|
"chokidar": "^4.0.3",
|
|
71
71
|
"commander": "^13.1.0",
|
|
72
|
-
"es-toolkit": "^1.
|
|
73
|
-
"esbuild": "^0.25.
|
|
72
|
+
"es-toolkit": "^1.34.1",
|
|
73
|
+
"esbuild": "^0.25.2",
|
|
74
74
|
"fs-extra": "^11.3.0",
|
|
75
75
|
"hookable": "^5.5.3",
|
|
76
76
|
"octokit": "^4.1.2",
|
|
77
|
-
"std-env": "^3.
|
|
77
|
+
"std-env": "^3.9.0",
|
|
78
78
|
"tiny-update-notifier": "^2.0.0",
|
|
79
79
|
"tinyglobby": "^0.2.12",
|
|
80
80
|
"xvfb-ts": "^1.1.0"
|