zotero-plugin-scaffold 0.0.18 → 0.0.21

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
@@ -24,7 +24,7 @@ import 'chokidar';
24
24
  import 'process';
25
25
 
26
26
  const name = "zotero-plugin-scaffold";
27
- const version = "0.0.18";
27
+ const version = "0.0.21";
28
28
  const description = "A scaffold for Zotero plugin development.";
29
29
  const scripts = {
30
30
  dev: "unbuild --stub",
@@ -78,22 +78,22 @@ const directories = {
78
78
  const engines = {
79
79
  node: ">=18"
80
80
  };
81
- const packageManager = "pnpm@8.15.5";
81
+ const packageManager = "pnpm@9.1.1";
82
82
  const dependencies = {
83
- "@inquirer/prompts": "4.3.1",
84
- bumpp: "9.4.0",
83
+ "@inquirer/prompts": "5.0.3",
84
+ bumpp: "9.4.1",
85
85
  c12: "1.10.0",
86
86
  chalk: "5.3.0",
87
87
  chokidar: "3.6.0",
88
88
  commander: "12.0.0",
89
89
  consola: "3.2.3",
90
- "conventional-changelog": "5.1.0",
91
- esbuild: "0.20.2",
90
+ "conventional-changelog": "6.0.0",
91
+ esbuild: "0.21.2",
92
92
  "fast-glob": "3.3.2",
93
93
  "fs-extra": "11.2.0",
94
94
  hookable: "5.5.3",
95
- mime: "4.0.1",
96
- octokit: "3.1.2",
95
+ mime: "4.0.3",
96
+ octokit: "4.0.2",
97
97
  radash: "12.1.0",
98
98
  "replace-in-file": "7.1.0",
99
99
  "std-env": "3.7.0",
@@ -104,14 +104,14 @@ const devDependencies = {
104
104
  "@trivago/prettier-plugin-sort-imports": "4.3.0",
105
105
  "@types/conventional-changelog": "3.1.5",
106
106
  "@types/fs-extra": "11.0.4",
107
- "@types/node": "20.12.2",
107
+ "@types/node": "20.12.12",
108
108
  "@types/update-notifier": "6.0.8",
109
- "@typescript-eslint/eslint-plugin": "7.4.0",
110
- "@typescript-eslint/parser": "7.4.0",
109
+ "@typescript-eslint/eslint-plugin": "7.9.0",
110
+ "@typescript-eslint/parser": "7.9.0",
111
111
  eslint: "8.57.0",
112
112
  "eslint-config-prettier": "9.1.0",
113
113
  prettier: "3.2.5",
114
- typescript: "5.4.3",
114
+ typescript: "5.4.5",
115
115
  unbuild: "2.0.0"
116
116
  };
117
117
  const pnpm = {
package/dist/index.d.mts CHANGED
@@ -679,7 +679,6 @@ declare class Serve extends Base {
679
679
  */
680
680
  prepareDevEnv(): void;
681
681
  reload(): void;
682
- openDevTool(): void;
683
682
  exit(): void;
684
683
  private get zoteroBinPath();
685
684
  private get profilePath();
package/dist/index.d.ts CHANGED
@@ -679,7 +679,6 @@ declare class Serve extends Base {
679
679
  */
680
680
  prepareDevEnv(): void;
681
681
  reload(): void;
682
- openDevTool(): void;
683
682
  exit(): void;
684
683
  private get zoteroBinPath();
685
684
  private get profilePath();
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import versionBump, { ProgressEvent } from 'bumpp';
1
+ import { ProgressEvent, versionBump } from 'bumpp';
2
2
  import chalk from 'chalk';
3
3
  import consola, { createConsola } from 'consola';
4
4
  import { isCI, isWindows, isMacOS, isLinux } from 'std-env';
@@ -173,7 +173,13 @@ const defaultConfig = {
173
173
  hooks: {}
174
174
  },
175
175
  server: {
176
- startArgs: ["--debugger", "--purgecaches"],
176
+ startArgs: [
177
+ "--no-remote",
178
+ "--start-debugger-server",
179
+ "--jsdebugger",
180
+ "--debugger",
181
+ "--purgecaches"
182
+ ],
177
183
  asProxy: false,
178
184
  hooks: {}
179
185
  },
@@ -329,7 +335,7 @@ class Build extends Base {
329
335
  ...this.name && { name: this.name },
330
336
  ...this.version && { version: this.version },
331
337
  applications: {
332
- //@ts-expect-error 此处不包含版本限制
338
+ //@ts-ignore 此处不包含版本限制
333
339
  zotero: {
334
340
  id: this.id,
335
341
  update_url: this.updateURL
@@ -765,7 +771,6 @@ ${path2} changed`);
765
771
  * Starts zotero with plugins pre-installed as proxy file
766
772
  */
767
773
  async startZotero() {
768
- let isZoteroReady = false;
769
774
  if (!fs.existsSync(this.zoteroBinPath)) {
770
775
  throw new Error("Zotero binary does not exist.");
771
776
  }
@@ -774,19 +779,15 @@ ${path2} changed`);
774
779
  }
775
780
  this.prepareDevEnv();
776
781
  const zoteroProcess = spawn(this.zoteroBinPath, [
782
+ "--no-remote",
783
+ "--start-debugger-server",
784
+ "--jsdebugger",
777
785
  "--debugger",
778
786
  "--purgecaches",
779
787
  "-profile",
780
788
  this.profilePath
781
789
  ]);
782
790
  zoteroProcess.stdout?.on("data", (data) => {
783
- if (!isZoteroReady && data.toString().includes(`Calling bootstrap method 'startup' for plugin ${this.id}`)) {
784
- this.logger.log(data.toString());
785
- isZoteroReady = true;
786
- setTimeout(() => {
787
- this.openDevTool();
788
- }, 1e3);
789
- }
790
791
  });
791
792
  zoteroProcess.on("close", (code) => {
792
793
  this.logger.info(`Zotero terminated with code ${code}.`);
@@ -810,8 +811,9 @@ ${path2} changed`);
810
811
  keepProfileChanges: true,
811
812
  args: this.ctx.server.startArgs,
812
813
  pref: { "extensions.experiments.enabled": true },
813
- browserConsole: true,
814
- // devtools: true, // need Zotero upgrade to firefox 115,
814
+ // Use Zotero's devtools instead
815
+ browserConsole: false,
816
+ devtools: false,
815
817
  noInput: true
816
818
  },
817
819
  {
@@ -834,7 +836,7 @@ ${path2} changed`);
834
836
  );
835
837
  const buildPath = path.resolve("build/addon");
836
838
  if (!fs.existsSync(addonProxyFilePath) || fs.readFileSync(addonProxyFilePath, "utf-8") !== buildPath) {
837
- fs.writeFileSync(addonProxyFilePath, buildPath);
839
+ fs.outputFileSync(addonProxyFilePath, buildPath);
838
840
  this.logger.debug(
839
841
  `Addon proxy file has been updated.
840
842
  File path: ${addonProxyFilePath}
@@ -890,68 +892,6 @@ ${path2} changed`);
890
892
  const command = `${startZoteroCmd} -url "${url}"`;
891
893
  execSync(command);
892
894
  }
893
- openDevTool() {
894
- this.logger.debug("Open dev tools...");
895
- const openDevToolScript = `
896
- (async () => {
897
-
898
- // const { BrowserToolboxLauncher } = ChromeUtils.import(
899
- // "resource://devtools/client/framework/browser-toolbox/Launcher.jsm",
900
- // );
901
- // BrowserToolboxLauncher.init();
902
- // TODO: Use the above code to open the devtool after https://github.com/zotero/zotero/pull/3387
903
-
904
- Zotero.Prefs.set("devtools.debugger.remote-enabled", true, true);
905
- Zotero.Prefs.set("devtools.debugger.remote-port", 6100, true);
906
- Zotero.Prefs.set("devtools.debugger.prompt-connection", false, true);
907
- Zotero.Prefs.set("devtools.debugger.chrome-debugging-websocket", false, true);
908
-
909
- env =
910
- Services.env ||
911
- Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
912
-
913
- env.set("MOZ_BROWSER_TOOLBOX_PORT", 6100);
914
- Zotero.openInViewer(
915
- "chrome://devtools/content/framework/browser-toolbox/window.html",
916
- {
917
- onLoad: (doc) => {
918
- doc.querySelector("#status-message-container").style.visibility =
919
- "collapse";
920
- let toolboxBody;
921
- waitUntil(
922
- () => {
923
- toolboxBody = doc
924
- .querySelector(".devtools-toolbox-browsertoolbox-iframe")
925
- ?.contentDocument?.querySelector(".theme-body");
926
- return toolboxBody;
927
- },
928
- () => {
929
- toolboxBody.style = "pointer-events: all !important";
930
- }
931
- );
932
- },
933
- }
934
- );
935
-
936
- function waitUntil(condition, callback, interval = 100, timeout = 10000) {
937
- const start = Date.now();
938
- const intervalId = setInterval(() => {
939
- if (condition()) {
940
- clearInterval(intervalId);
941
- callback();
942
- } else if (Date.now() - start > timeout) {
943
- clearInterval(intervalId);
944
- }
945
- }, interval);
946
- }
947
- })()`;
948
- const url = `zotero://ztoolkit-debug/?run=${encodeURIComponent(
949
- openDevToolScript
950
- )}`;
951
- const startZoteroCmd = `"${this.zoteroBinPath}" --debugger --purgecaches -profile "${this.profilePath}"`;
952
- const command = `${startZoteroCmd} -url "${url}"`;
953
- execSync(command);
954
- }
955
895
  exit() {
956
896
  console.log("");
957
897
  this.logger.info("Server shutdown by user request.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zotero-plugin-scaffold",
3
- "version": "0.0.18",
3
+ "version": "0.0.21",
4
4
  "description": "A scaffold for Zotero plugin development.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -46,22 +46,21 @@
46
46
  "engines": {
47
47
  "node": ">=18"
48
48
  },
49
- "packageManager": "pnpm@8.15.5",
50
49
  "dependencies": {
51
- "@inquirer/prompts": "4.3.1",
52
- "bumpp": "9.4.0",
50
+ "@inquirer/prompts": "5.0.3",
51
+ "bumpp": "9.4.1",
53
52
  "c12": "1.10.0",
54
53
  "chalk": "5.3.0",
55
54
  "chokidar": "3.6.0",
56
55
  "commander": "12.0.0",
57
56
  "consola": "3.2.3",
58
- "conventional-changelog": "5.1.0",
59
- "esbuild": "0.20.2",
57
+ "conventional-changelog": "6.0.0",
58
+ "esbuild": "0.21.2",
60
59
  "fast-glob": "3.3.2",
61
60
  "fs-extra": "11.2.0",
62
61
  "hookable": "5.5.3",
63
- "mime": "4.0.1",
64
- "octokit": "3.1.2",
62
+ "mime": "4.0.3",
63
+ "octokit": "4.0.2",
65
64
  "radash": "12.1.0",
66
65
  "replace-in-file": "7.1.0",
67
66
  "std-env": "3.7.0",
@@ -72,14 +71,14 @@
72
71
  "@trivago/prettier-plugin-sort-imports": "4.3.0",
73
72
  "@types/conventional-changelog": "3.1.5",
74
73
  "@types/fs-extra": "11.0.4",
75
- "@types/node": "20.12.2",
74
+ "@types/node": "20.12.12",
76
75
  "@types/update-notifier": "6.0.8",
77
- "@typescript-eslint/eslint-plugin": "7.4.0",
78
- "@typescript-eslint/parser": "7.4.0",
76
+ "@typescript-eslint/eslint-plugin": "7.9.0",
77
+ "@typescript-eslint/parser": "7.9.0",
79
78
  "eslint": "8.57.0",
80
79
  "eslint-config-prettier": "9.1.0",
81
80
  "prettier": "3.2.5",
82
- "typescript": "5.4.3",
81
+ "typescript": "5.4.5",
83
82
  "unbuild": "2.0.0"
84
83
  },
85
84
  "scripts": {