zotero-plugin-scaffold 0.9.1 → 0.9.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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as OverrideConfig, t as Context } from "./shared/scaffold-index-BDz8-InR.mjs";
2
- import { t as Base } from "./shared/scaffold-base-oQP-TMDS.mjs";
1
+ import { n as OverrideConfig, t as Context } from "./shared/scaffold-index-DUirnfLl.mjs";
2
+ import { t as Base } from "./shared/scaffold-base-D5fAvZGP.mjs";
3
3
  //#region src/cli.d.ts
4
4
  type Constructor<T> = new (ctx: Context) => T;
5
5
  declare function runCommand<T extends Base>(CommandClass: Constructor<T>, config: OverrideConfig): Promise<void>;
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { l as logger } from "./shared/scaffold-replace-Dn0wBA9W.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-DVeK7Az0.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-Bv9sPw2S.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.9.1";
10
+ var version = "0.9.3";
11
11
  //#endregion
12
12
  //#region src/utils/gitignore.ts
13
13
  async function checkGitIgnore() {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as OverrideConfig, r as UserConfig, t as Context } from "./shared/scaffold-index-BDz8-InR.mjs";
2
- import { t as Base } from "./shared/scaffold-base-oQP-TMDS.mjs";
1
+ import { n as OverrideConfig, r as UserConfig, t as Context } from "./shared/scaffold-index-DUirnfLl.mjs";
2
+ import { t as Base } from "./shared/scaffold-base-D5fAvZGP.mjs";
3
3
  //#region src/config.d.ts
4
4
  /**
5
5
  * Helper for user define configuration.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as Release, n as Test, o as Build, r as Serve, s as defineConfig, t as Config } from "./shared/scaffold-src-DVeK7Az0.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-Bv9sPw2S.mjs";
2
2
  export { Build, Config, Release, Serve, Test, defineConfig };
@@ -1,4 +1,4 @@
1
- import { i as Logger, t as Context } from "./scaffold-index-BDz8-InR.mjs";
1
+ import { i as Logger, t as Context } from "./scaffold-index-DUirnfLl.mjs";
2
2
  //#region src/core/base.d.ts
3
3
  declare abstract class Base {
4
4
  ctx: Context;
@@ -823,7 +823,7 @@ interface TestConfig {
823
823
  *
824
824
  * 若此选项设置为 false,Zotero 将在测试结束后立即退出。
825
825
  *
826
- * @default true (false in ci)
826
+ * @default true (false in ci or AI agents)
827
827
  */
828
828
  watch: boolean;
829
829
  /**
@@ -5,7 +5,7 @@ import { copy, emptyDir, ensureDir, ensureDirSync, move, outputFile, outputJSON,
5
5
  import { createHooks } from "hookable";
6
6
  import process$1 from "node:process";
7
7
  import { format, inspect, styleText } from "node:util";
8
- import { isCI, isDebug, isLinux, isMacOS, isWindows } from "std-env";
8
+ import { isAgent, isCI, isDebug, isLinux, isMacOS, isWindows } from "std-env";
9
9
  import { glob, globSync } from "tinyglobby";
10
10
  import path, { basename, dirname, extname, isAbsolute, join, resolve } from "node:path";
11
11
  import { build, context } from "esbuild";
@@ -4190,7 +4190,7 @@ var raw_default = "<!-- Generated by zotero-plugin-scaffold -->\n<html lang=\"en
4190
4190
  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";
4191
4191
  //#endregion
4192
4192
  //#region src/core/tester/test-bundler-template/raw/mocha-setup.js?raw
4193
- var mocha_setup_default = "/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// Generated by zotero-plugin-scaffold\nmocha.setup({ \n ui: \"bdd\",\n reporter: Reporter,\n timeout: __TIMEOUT__ || 10000,\n bail: __ABORT_ON_FAIL__\n});\n\nwindow.expect = chai.expect;\nwindow.assert = chai.assert;\n\nasync function send(data) {\n const req = await Zotero.HTTP.request(\n \"POST\",\n \"http://localhost:__PORT__/update\",\n {\n body: JSON.stringify(data),\n }\n );\n\n if (req.status !== 200) {\n dump(\"Error sending data to server\" + req.responseText);\n return null;\n } else {\n const result = JSON.parse(req.responseText);\n return result;\n }\n}\n\nwindow.debug = function (data) {\n send({ type: \"debug\", data });\n};\n\nlet indents = 0,\n passed = 0,\n failed = 0,\n aborted = false;\n\n// Inherit the default test settings from Zotero\nfunction Reporter(runner) {\n function indent() {\n return \" \".repeat(indents);\n }\n\n function dump(str) {\n document.querySelector(\"#mocha\").innerText += str;\n }\n\n runner.on(\"start\", async function () {\n console.log(\"start\")\n await send({ type: \"start\", data: { indents } });\n });\n\n runner.on(\"suite\", async function (suite) {\n console.log(\"suite\", suite)\n indents++;\n const str = indent() + suite.title + \"\\n\";\n dump(str);\n await send({ type: \"suite\", data: { title: suite.title, root: suite.root, indents } });\n });\n\n runner.on(\"suite end\", async function (suite) {\n console.log(\"suite end\", suite)\n indents--;\n const str = indents === 1 ? \"\\n\" : \"\";\n dump(str);\n await send({ type: \"suite end\", data: { title: suite.title, root: suite.root, indents } });\n });\n\n runner.on(\"pending\", async function (test) {\n console.log(\"pending\", test)\n const str = indent() + \"pending -\" + test.title + \"\\n\";\n dump(str);\n await send({ type: \"pending\", data: { title: test.title, fulltest: test.fullTitle(), duration: test.duration, indents: indents + 1 } });\n });\n\n runner.on(\"pass\", async function (test) {\n console.log(\"pass\", test)\n passed++;\n let str = indent() + Mocha.reporters.Base.symbols.ok + \" \" + test.title;\n if (\"fast\" != test.speed) {\n str += \" (\" + Math.round(test.duration) + \" ms)\";\n }\n str += \"\\n\";\n dump(str);\n await send({ type: \"pass\", data: { title: test.title, fulltest: test.fullTitle(), duration: test.duration, indents: indents + 1 } });\n\n });\n\n runner.on(\"fail\", async function (test, error) {\n console.log(\"fail\", test, error)\n\n failed++;\n let indentStr = indent();\n const str =\n indentStr +\n Mocha.reporters.Base.symbols.err +\n (Zotero.automatedTest ? \"\" : \"\\x07\") +\n \" \" +\n test.title +\n \"\\n\" +\n indentStr +\n \" \" +\n error.message +\n \"\\n\\n\";\n dump(str);\n\n await send({ type: \"fail\", data: { title: test.title, fulltest: test.fullTitle(), duration: test.duration, error, indents: indents + 1 } });\n\n });\n\n runner.on(\"end\", async function () {\n console.log(\"end\")\n const str =\n passed +\n \"/\" +\n (passed + failed) +\n \" tests passed\" +\n (aborted ? \" -- aborting\" : \"\") +\n \"\\n\";\n dump(str);\n\n await send({\n type: \"end\",\n data: { passed: passed, failed: failed, aborted: aborted, str, indents },\n });\n\n // Must exit on Zotero side, otherwise the exit code will not be 0 and CI will fail\n if (__EXIT_ON_FINISH__) {\n Zotero.Utilities.Internal.quit(0);\n }\n });\n}\n";
4193
+ var mocha_setup_default = "/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// Generated by zotero-plugin-scaffold\nmocha.setup({ \n ui: \"bdd\",\n reporter: Reporter,\n timeout: __TIMEOUT__ || 10000,\n bail: __ABORT_ON_FAIL__\n});\n\nwindow.expect = chai.expect;\nwindow.assert = chai.assert;\n\nasync function send(data) {\n const req = await Zotero.HTTP.request(\n \"POST\",\n \"http://localhost:__PORT__/update\",\n {\n body: JSON.stringify(data),\n }\n );\n\n if (req.status !== 200) {\n dump(\"Error sending data to server\" + req.responseText);\n return null;\n } else {\n const result = JSON.parse(req.responseText);\n return result;\n }\n}\n\nwindow.debug = function (data) {\n send({ type: \"debug\", data });\n};\n\nlet indents = 0,\n passed = 0,\n failed = 0,\n aborted = false;\n\n// Inherit the default test settings from Zotero\nfunction Reporter(runner) {\n function indent() {\n return \" \".repeat(indents);\n }\n\n function dump(str) {\n document.querySelector(\"#mocha\").innerText += str;\n }\n\n runner.on(\"start\", async function () {\n console.log(\"start\")\n await send({ type: \"start\", data: { indents } });\n });\n\n runner.on(\"suite\", async function (suite) {\n console.log(\"suite\", suite)\n indents++;\n const str = indent() + suite.title + \"\\n\";\n dump(str);\n await send({ type: \"suite\", data: { title: suite.title, root: suite.root, indents } });\n });\n\n runner.on(\"suite end\", async function (suite) {\n console.log(\"suite end\", suite)\n indents--;\n const str = indents === 1 ? \"\\n\" : \"\";\n dump(str);\n await send({ type: \"suite end\", data: { title: suite.title, root: suite.root, indents } });\n });\n\n runner.on(\"pending\", async function (test) {\n console.log(\"pending\", test)\n const str = indent() + \"pending -\" + test.title + \"\\n\";\n dump(str);\n await send({ type: \"pending\", data: { title: test.title, fulltest: test.fullTitle(), duration: test.duration, indents: indents + 1 } });\n });\n\n runner.on(\"pass\", async function (test) {\n console.log(\"pass\", test)\n passed++;\n let str = indent() + Mocha.reporters.Base.symbols.ok + \" \" + test.title;\n if (\"fast\" != test.speed) {\n str += \" (\" + Math.round(test.duration) + \" ms)\";\n }\n str += \"\\n\";\n dump(str);\n await send({ type: \"pass\", data: { title: test.title, fulltest: test.fullTitle(), duration: test.duration, indents: indents + 1 } });\n\n });\n\n runner.on(\"fail\", async function (test, error) {\n console.log(\"fail\", test, error)\n\n failed++;\n let indentStr = indent();\n const str =\n indentStr +\n Mocha.reporters.Base.symbols.err +\n (Zotero.automatedTest ? \"\" : \"\\x07\") +\n \" \" +\n test.title +\n \"\\n\" +\n indentStr +\n \" \" +\n error.message +\n \"\\n\\n\";\n dump(str);\n\n // Serialize the error explicitly: send() JSON-stringifies the payload,\n // and Error instances stringify to {} (message/stack are non-enumerable),\n // so thrown errors / timeouts / XPCOM exceptions reached the terminal as\n // \", undefined\". Chai AssertionErrors were unaffected (own-enumerable\n // props), which is why this went unnoticed in assertion-heavy suites.\n // NOTE: this file is inlined verbatim into index.xhtml, an XML document.\n // Never use raw ampersands or less-than signs here -- they break XML\n // parsing and with it the whole runner page. Optional chaining and\n // nullish coalescing are XML-safe.\n await send({ type: \"fail\", data: { title: test.title, fulltest: test.fullTitle(), duration: test.duration, error: { message: String(error?.message ?? error), stack: error?.stack, actual: error?.actual, expected: error?.expected, showDiff: error?.showDiff, operator: error?.operator }, indents: indents + 1 } });\n\n });\n\n runner.on(\"end\", async function () {\n console.log(\"end\")\n const str =\n passed +\n \"/\" +\n (passed + failed) +\n \" tests passed\" +\n (aborted ? \" -- aborting\" : \"\") +\n \"\\n\";\n dump(str);\n\n await send({\n type: \"end\",\n data: { passed: passed, failed: failed, aborted: aborted, str, indents },\n });\n\n // Must exit on Zotero side, otherwise the exit code will not be 0 and CI will fail\n if (__EXIT_ON_FINISH__) {\n Zotero.Utilities.Internal.quit(0);\n }\n });\n}\n";
4194
4194
  //#endregion
4195
4195
  //#region src/core/tester/test-bundler-template/index.ts
4196
4196
  function generateManifest() {
@@ -4325,6 +4325,7 @@ var Test = class extends Base {
4325
4325
  this.ctx.test.headless = true;
4326
4326
  this.ctx.test.watch = false;
4327
4327
  }
4328
+ if (isAgent) this.ctx.test.watch = false;
4328
4329
  }
4329
4330
  async run() {
4330
4331
  await emptyDir(TESTER_PROFILE_DIR);
package/dist/vendor.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import "./shared/scaffold-index-BDz8-InR.mjs";
1
+ import "./shared/scaffold-index-DUirnfLl.mjs";
2
2
  import * as esToolkit from "es-toolkit";
3
3
  import * as fse from "fs-extra/esm";
4
4
  //#region src/core/builder/replace.d.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zotero-plugin-scaffold",
3
3
  "type": "module",
4
- "version": "0.9.1",
4
+ "version": "0.9.3",
5
5
  "description": "A scaffold for Zotero plugin development.",
6
6
  "author": "northword",
7
7
  "license": "AGPL-3.0-or-later",