zotero-plugin-scaffold 0.2.2 → 0.2.3

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-js/extra-typings';
3
- import { E as ExitSignals, l as logger, C as Config, B as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.V3TH4au2.mjs';
3
+ import { E as ExitSignals, l as logger, C as Config, B as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.BglL0tS0.mjs';
4
4
  import { readFile, writeFile } from 'node:fs/promises';
5
5
  import { pathExists, ensureFile } from 'fs-extra';
6
6
  import tinyUpdateNotifier from 'tiny-update-notifier';
@@ -32,7 +32,7 @@ import 'xvfb-ts';
32
32
 
33
33
  const name = "zotero-plugin-scaffold";
34
34
  const type = "module";
35
- const version = "0.2.2";
35
+ const version = "0.2.3";
36
36
  const packageManager = "pnpm@9.15.4";
37
37
  const description = "A scaffold for Zotero plugin development.";
38
38
  const author = "northword";
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.V3TH4au2.mjs';
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.BglL0tS0.mjs';
2
2
  import 'c12';
3
3
  import 'es-toolkit';
4
4
  import 'fs-extra/esm';
@@ -308,11 +308,31 @@ class PrefsManager {
308
308
  if (node.expression.arguments[0].expression.type !== "StringLiteral") {
309
309
  throw new Error("Invalid prefs.js file - unsupported key type.");
310
310
  }
311
- if (node.expression.arguments[1].expression.type !== "StringLiteral" && node.expression.arguments[1].expression.type !== "NumericLiteral" && node.expression.arguments[1].expression.type !== "BooleanLiteral") {
312
- throw new Error("Invalid prefs.js file - unsupported value type.");
313
- }
314
311
  const key = node.expression.arguments[0].expression.value.trim();
315
- const value = node.expression.arguments[1].expression.value;
312
+ let value;
313
+ switch (node.expression.arguments[1].expression.type) {
314
+ // https://babeljs.io/docs/babel-parser#output
315
+ case "StringLiteral":
316
+ case "NumericLiteral":
317
+ case "BooleanLiteral":
318
+ value = node.expression.arguments[1].expression.value;
319
+ break;
320
+ // https://github.com/estree/estree/blob/master/es5.md#unaryexpression
321
+ // https://github.com/northword/zotero-plugin-scaffold/issues/98
322
+ case "UnaryExpression":
323
+ if (node.expression.arguments[1].expression.argument.type !== "NumericLiteral") {
324
+ throw new Error("Invalid prefs.js file - unsupported value type.");
325
+ }
326
+ if (node.expression.arguments[1].expression.operator === "-")
327
+ value = -node.expression.arguments[1].expression.argument.value;
328
+ else if (node.expression.arguments[1].expression.operator === "+")
329
+ value = node.expression.arguments[1].expression.argument.value;
330
+ else
331
+ throw new Error("Invalid prefs.js file - unsupported value type.");
332
+ break;
333
+ default:
334
+ throw new Error("Invalid prefs.js file - unsupported value type.");
335
+ }
316
336
  _map2[key] = value;
317
337
  }
318
338
  return _map2;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zotero-plugin-scaffold",
3
3
  "type": "module",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "description": "A scaffold for Zotero plugin development.",
6
6
  "author": "northword",
7
7
  "license": "AGPL-3.0-or-later",