zotero-plugin-scaffold 0.8.4 → 0.8.5
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-BF5nY3YC.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.5";
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/utils/gitignore.ts
|
|
13
13
|
async function checkGitIgnore() {
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./shared/scaffold-replace-BTU0g6CT.mjs";
|
|
2
|
-
import { a as Release, n as Test, o as Build, r as Serve, s as defineConfig, t as Config } from "./shared/scaffold-src-
|
|
2
|
+
import { a as Release, n as Test, o as Build, r as Serve, s as defineConfig, t as Config } from "./shared/scaffold-src-BF5nY3YC.mjs";
|
|
3
3
|
export { Build, Config, Release, Serve, Test, defineConfig };
|
|
@@ -4040,10 +4040,10 @@ async function saveResource(url, path) {
|
|
|
4040
4040
|
}
|
|
4041
4041
|
//#endregion
|
|
4042
4042
|
//#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: \"fail\",\n data: {\n title: \"Internal: Plugin awaiting timeout\",\n stack: \"\",\n str: \"Plugin awaiting timeout\",\n },\n }),\n }\n );\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 await Zotero.Promise.delay(__STARTUP_DELAY__);\n\n const waitForPlugin = \"
|
|
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: \"fail\",\n data: {\n title: \"Internal: Plugin awaiting timeout\",\n stack: \"\",\n str: \"Plugin awaiting timeout\",\n },\n }),\n }\n );\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 await Zotero.Promise.delay(__STARTUP_DELAY__);\n\n const waitForPlugin = \"__WAIT_FOR_PLUGIN__\";\n\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(\"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
4044
|
//#endregion
|
|
4045
4045
|
//#region src/core/tester/test-bundler-template/raw/index.html?raw
|
|
4046
|
-
var raw_default = "<!-- Generated by zotero-plugin-scaffold -->\n
|
|
4046
|
+
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
4047
|
//#endregion
|
|
4048
4048
|
//#region src/core/tester/test-bundler-template/raw/manifest.json?raw
|
|
4049
4049
|
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 +4053,18 @@ var mocha_setup_default = "/* eslint-disable eslint-comments/no-unlimited-disabl
|
|
|
4053
4053
|
//#endregion
|
|
4054
4054
|
//#region src/core/tester/test-bundler-template/index.ts
|
|
4055
4055
|
function generateManifest() {
|
|
4056
|
-
const manifestStr = manifest_default.
|
|
4056
|
+
const manifestStr = manifest_default.replaceAll("__TESTER_PLUGIN_ID__", TESTER_PLUGIN_ID);
|
|
4057
4057
|
return JSON.parse(manifestStr);
|
|
4058
4058
|
}
|
|
4059
4059
|
function generateBootstrap(options) {
|
|
4060
|
-
return bootstrap_default.
|
|
4060
|
+
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
4061
|
}
|
|
4062
4062
|
function generateHtml(setupCode, testFiles) {
|
|
4063
4063
|
const tests = testFiles.map((f) => `<script src="${f}"><\/script>`).join("\n ");
|
|
4064
|
-
return raw_default.
|
|
4064
|
+
return raw_default.replaceAll("__TEST_FILES__", tests).replaceAll("__SETUP_CODE__", setupCode);
|
|
4065
4065
|
}
|
|
4066
4066
|
function generateMochaSetup(options) {
|
|
4067
|
-
return mocha_setup_default.
|
|
4067
|
+
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
4068
|
}
|
|
4069
4069
|
//#endregion
|
|
4070
4070
|
//#region src/core/tester/test-bundler.ts
|