zotero-plugin-scaffold 0.2.1 → 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.DiPAIBFh.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.1";
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.DiPAIBFh.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;
@@ -770,14 +790,14 @@ class Bump extends Base {
770
790
  }
771
791
 
772
792
  const mimeTypes = {
773
- "application/json": ["json"],
774
- "application/x-xpinstall": ["xpi"]
793
+ json: "application/json",
794
+ xpi: "application/x-xpinstall"
775
795
  };
776
796
  function getMimeTypeByFileName(filename) {
777
797
  const ext = extname(filename);
778
798
  for (const type in mimeTypes) {
779
- if (mimeTypes[type].includes(ext))
780
- return type;
799
+ if (ext === `.${type}`)
800
+ return mimeTypes[type];
781
801
  }
782
802
  return undefined;
783
803
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zotero-plugin-scaffold",
3
3
  "type": "module",
4
- "version": "0.2.1",
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",