zotero-plugin-scaffold 0.8.4 → 0.8.6
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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as logger } from "./shared/scaffold-replace-BTU0g6CT.mjs";
|
|
2
|
-
import { a as Release, i as ExitSignals, n as Test, o as Build, r as Serve, t as Config } from "./shared/scaffold-src-
|
|
2
|
+
import { a as Release, i as ExitSignals, n as Test, o as Build, r as Serve, t as Config } from "./shared/scaffold-src-CQEdY9K7.mjs";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import { Command } from "commander";
|
|
@@ -7,7 +7,7 @@ import { pathExists } from "fs-extra";
|
|
|
7
7
|
import tinyUpdateNotifier from "tiny-update-notifier";
|
|
8
8
|
//#region package.json
|
|
9
9
|
var name = "zotero-plugin-scaffold";
|
|
10
|
-
var version = "0.8.
|
|
10
|
+
var version = "0.8.6";
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/utils/gitignore.ts
|
|
13
13
|
async function checkGitIgnore() {
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "./shared/scaffold-
|
|
2
|
-
import { a as Release, n as Test, o as Build, r as Serve, s as defineConfig, t as Config } from "./shared/scaffold-src-BXURNLxp.mjs";
|
|
1
|
+
import { a as Release, n as Test, o as Build, r as Serve, s as defineConfig, t as Config } from "./shared/scaffold-src-CQEdY9K7.mjs";
|
|
3
2
|
export { Build, Config, Release, Serve, Test, defineConfig };
|
|
@@ -4024,6 +4024,10 @@ var TestHttpReporter = class {
|
|
|
4024
4024
|
if (this.failed === 0) logger.success(`Test run completed - ${this.passed} passed`);
|
|
4025
4025
|
else logger.fail(`Test run completed - ${this.passed} passed, ${this.failed} failed`);
|
|
4026
4026
|
break;
|
|
4027
|
+
case "error":
|
|
4028
|
+
logger.error(body.data?.title);
|
|
4029
|
+
this.failed++;
|
|
4030
|
+
break;
|
|
4027
4031
|
default:
|
|
4028
4032
|
logger.log(data);
|
|
4029
4033
|
break;
|
|
@@ -4040,10 +4044,10 @@ async function saveResource(url, path) {
|
|
|
4040
4044
|
}
|
|
4041
4045
|
//#endregion
|
|
4042
4046
|
//#region src/core/tester/test-bundler-template/raw/bootstrap.js?raw
|
|
4043
|
-
var bootstrap_default = "/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// Code generated by the zotero-plugin-scaffold tester\nvar chromeHandle;\n\nfunction install(data, reason) {}\n\nasync function startup({ id, version, resourceURI, rootURI }, reason) {\n await Zotero.initializationPromise;\n const aomStartup = Components.classes[\n \"@mozilla.org/addons/addon-manager-startup;1\"\n ].getService(Components.interfaces.amIAddonManagerStartup);\n const manifestURI = Services.io.newURI(rootURI + \"manifest.json\");\n chromeHandle = aomStartup.registerChrome(manifestURI, [\n [\"content\", \"__TESTER_PLUGIN_REF__\", rootURI + \"content/\"],\n ]);\n\n launchTests().catch((error) => {\n Zotero.debug(error);\n Zotero.HTTP.request(\n \"POST\",\n \"http://localhost:__PORT__/update\",\n {\n body: JSON.stringify({\n type: \"
|
|
4047
|
+
var bootstrap_default = "/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// Code generated by the zotero-plugin-scaffold tester\nvar chromeHandle;\n\nfunction install(data, reason) {}\n\nasync function startup({ id, version, resourceURI, rootURI }, reason) {\n await Zotero.initializationPromise;\n const aomStartup = Components.classes[\n \"@mozilla.org/addons/addon-manager-startup;1\"\n ].getService(Components.interfaces.amIAddonManagerStartup);\n const manifestURI = Services.io.newURI(rootURI + \"manifest.json\");\n chromeHandle = aomStartup.registerChrome(manifestURI, [\n [\"content\", \"__TESTER_PLUGIN_REF__\", rootURI + \"content/\"],\n ]);\n\n launchTests().catch((error) => {\n Zotero.debug(error);\n Zotero.HTTP.request(\n \"POST\",\n \"http://localhost:__PORT__/update\",\n {\n body: JSON.stringify({\n type: \"error\",\n data: {\n title: error.message,\n },\n }),\n }\n );\n // Although this is an exception, we still need to use the status code 0, \n // because status code 1 will cause Zotero to auto-restart.\n Zotero.Utilities.Internal.quit(0);\n });\n}\n\nfunction onMainWindowLoad({ window: win }) {}\n\nfunction onMainWindowUnload({ window: win }) {}\n\nfunction shutdown({ id, version, resourceURI, rootURI }, reason) {\n if (reason === APP_SHUTDOWN) {\n return;\n }\n\n if (chromeHandle) {\n chromeHandle.destruct();\n chromeHandle = null;\n }\n}\n\nfunction uninstall(data, reason) {}\n\nasync function launchTests() {\n // Delay to allow plugin to fully load before opening the test page\n if (__STARTUP_DELAY__) {\n await Zotero.Promise.delay(__STARTUP_DELAY__);\n }\n\n const waitForPlugin = \"__WAIT_FOR_PLUGIN__\";\n if (waitForPlugin) {\n // Wait for a plugin to be installed\n await waitUtilAsync(() => {\n try {\n return !!eval(waitForPlugin)();\n } catch (error) {\n return false;\n }\n }).catch(() => {\n throw new Error(\"Internal: Plugin awaiting timeout\");\n });\n }\n\n Services.ww.openWindow(\n null,\n \"chrome://__TESTER_PLUGIN_REF__/content/index.xhtml\",\n \"Zotero Plugin Scaffold Test Runnner\",\n \"chrome,centerscreen,resizable=yes\",\n {}\n );\n}\n\nfunction waitUtilAsync(condition, interval = 100, timeout = 1e4) {\n return new Promise((resolve, reject) => {\n const start = Date.now();\n const intervalId = setInterval(() => {\n if (condition()) {\n clearInterval(intervalId);\n resolve();\n } else if (Date.now() - start > timeout) {\n clearInterval(intervalId);\n reject();\n }\n }, interval);\n });\n}\n";
|
|
4044
4048
|
//#endregion
|
|
4045
4049
|
//#region src/core/tester/test-bundler-template/raw/index.html?raw
|
|
4046
|
-
var raw_default = "<!-- Generated by zotero-plugin-scaffold -->\n
|
|
4050
|
+
var raw_default = "<!-- Generated by zotero-plugin-scaffold -->\n<html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Zotero Plugin Test</title>\n <style>\n html {\n min-width: 400px;\n min-height: 600px;\n }\n body {\n font-family: Arial, sans-serif;\n }\n </style>\n </head>\n <body>\n <div id=\"mocha\"></div>\n\n <!-- Include Zotero Vars -->\n <script src=\"chrome://zotero/content/include.js\"><\/script>\n\n <!-- Mocha and Chai Libraries -->\n <script src=\"mocha.js\"><\/script>\n <script src=\"chai.js\"><\/script>\n\n <!-- Setup Mocha -->\n <script>\n __SETUP_CODE__;\n <\/script>\n\n <!-- Unit tests -->\n __TEST_FILES__\n\n <!-- Run Mocha -->\n <script class=\"mocha-exec\">\n mocha.run();\n <\/script>\n </body>\n</html>\n";
|
|
4047
4051
|
//#endregion
|
|
4048
4052
|
//#region src/core/tester/test-bundler-template/raw/manifest.json?raw
|
|
4049
4053
|
var manifest_default = "{\n \"manifest_version\": 2,\n \"name\": \"Zotero Plugin Scaffold Test Runner\",\n \"version\": \"0.0.1\",\n \"description\": \"Test suite for the Zotero plugin. This is a runtime-generated plugin only for testing purposes.\",\n \"applications\": {\n \"zotero\": {\n \"id\": \"__TESTER_PLUGIN_ID__\",\n \"update_url\": \"https://example.com\",\n \"strict_max_version\": \"999.*.*\"\n }\n }\n}\n";
|
|
@@ -4053,18 +4057,18 @@ var mocha_setup_default = "/* eslint-disable eslint-comments/no-unlimited-disabl
|
|
|
4053
4057
|
//#endregion
|
|
4054
4058
|
//#region src/core/tester/test-bundler-template/index.ts
|
|
4055
4059
|
function generateManifest() {
|
|
4056
|
-
const manifestStr = manifest_default.
|
|
4060
|
+
const manifestStr = manifest_default.replaceAll("__TESTER_PLUGIN_ID__", TESTER_PLUGIN_ID);
|
|
4057
4061
|
return JSON.parse(manifestStr);
|
|
4058
4062
|
}
|
|
4059
4063
|
function generateBootstrap(options) {
|
|
4060
|
-
return bootstrap_default.
|
|
4064
|
+
return bootstrap_default.replaceAll("__PORT__", String(options.port)).replaceAll("__STARTUP_DELAY__", String(options.startupDelay || 1e3)).replaceAll("__WAIT_FOR_PLUGIN__", options.waitForPlugin).replaceAll("__TESTER_PLUGIN_REF__", TESTER_PLUGIN_REF);
|
|
4061
4065
|
}
|
|
4062
4066
|
function generateHtml(setupCode, testFiles) {
|
|
4063
4067
|
const tests = testFiles.map((f) => `<script src="${f}"><\/script>`).join("\n ");
|
|
4064
|
-
return raw_default.
|
|
4068
|
+
return raw_default.replaceAll("__TEST_FILES__", tests).replaceAll("__SETUP_CODE__", setupCode);
|
|
4065
4069
|
}
|
|
4066
4070
|
function generateMochaSetup(options) {
|
|
4067
|
-
return mocha_setup_default.
|
|
4071
|
+
return mocha_setup_default.replaceAll("__TIMEOUT__", String(options.timeout || 1e4)).replaceAll("__PORT__", String(options.port)).replaceAll("__ABORT_ON_FAIL__", String(options.abortOnFail)).replaceAll("__EXIT_ON_FINISH__", String(options.exitOnFinish ? "true" : "false"));
|
|
4068
4072
|
}
|
|
4069
4073
|
//#endregion
|
|
4070
4074
|
//#region src/core/tester/test-bundler.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zotero-plugin-scaffold",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.6",
|
|
5
5
|
"description": "A scaffold for Zotero plugin development.",
|
|
6
6
|
"author": "northword",
|
|
7
7
|
"license": "AGPL-3.0-or-later",
|
|
@@ -55,40 +55,39 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@fluent/syntax": "^0.19.0",
|
|
58
|
-
"@swc/core": "^1.15.
|
|
59
|
-
"adm-zip": "^0.5.
|
|
60
|
-
"bumpp": "^
|
|
61
|
-
"c12": "4.0.0-beta.
|
|
58
|
+
"@swc/core": "^1.15.24",
|
|
59
|
+
"adm-zip": "^0.5.17",
|
|
60
|
+
"bumpp": "^11.0.1",
|
|
61
|
+
"c12": "4.0.0-beta.4",
|
|
62
62
|
"chokidar": "^5.0.0",
|
|
63
63
|
"commander": "^14.0.3",
|
|
64
64
|
"es-toolkit": "^1.45.1",
|
|
65
|
-
"esbuild": "^0.
|
|
65
|
+
"esbuild": "^0.28.0",
|
|
66
66
|
"fs-extra": "^11.3.4",
|
|
67
|
-
"hookable": "^6.0
|
|
67
|
+
"hookable": "^6.1.0",
|
|
68
68
|
"octokit": "^5.0.5",
|
|
69
69
|
"std-env": "^4.0.0",
|
|
70
70
|
"tiny-update-notifier": "^2.0.2",
|
|
71
|
-
"tinyglobby": "^0.2.
|
|
71
|
+
"tinyglobby": "^0.2.16",
|
|
72
72
|
"xvfb-ts": "^1.1.1"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@antfu/eslint-config": "^7.7.
|
|
75
|
+
"@antfu/eslint-config": "^7.7.3",
|
|
76
76
|
"@commander-js/extra-typings": "^14.0.0",
|
|
77
|
-
"@types/adm-zip": "^0.5.
|
|
77
|
+
"@types/adm-zip": "^0.5.8",
|
|
78
78
|
"@types/fs-extra": "^11.0.4",
|
|
79
|
-
"@types/node": "^25.
|
|
80
|
-
"bumpp": "^
|
|
79
|
+
"@types/node": "^25.6.0",
|
|
80
|
+
"bumpp": "^11.0.1",
|
|
81
81
|
"changelogen": "^0.6.2",
|
|
82
|
-
"eslint": "^10.0
|
|
82
|
+
"eslint": "^10.2.0",
|
|
83
83
|
"eslint-plugin-format": "^2.0.1",
|
|
84
84
|
"husky": "^9.1.7",
|
|
85
85
|
"lint-staged": "^16.4.0",
|
|
86
|
-
"tsdown": "^0.21.
|
|
86
|
+
"tsdown": "^0.21.7",
|
|
87
87
|
"tsx": "^4.21.0",
|
|
88
88
|
"typescript": "^5.9.3",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"vitest": "^4.1.0"
|
|
89
|
+
"unplugin-raw": "^0.7.0",
|
|
90
|
+
"vitest": "^4.1.4"
|
|
92
91
|
},
|
|
93
92
|
"workspaces": [
|
|
94
93
|
"src",
|