zotero-plugin-scaffold 0.8.0 → 0.8.1
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 +3 -3
- package/dist/index.mjs +2 -2
- package/dist/shared/{zotero-plugin-scaffold.8gLns8GX.mjs → zotero-plugin-scaffold.5VjiPpN8.mjs} +14 -14
- package/dist/shared/{zotero-plugin-scaffold.CzBjWbS8.mjs → zotero-plugin-scaffold.qsx_2VJx.mjs} +23 -17
- package/dist/vendor/index.mjs +1 -1
- package/package.json +23 -23
package/dist/cli.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import { E as ExitSignals, C as Config, B as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.
|
|
3
|
+
import { E as ExitSignals, C as Config, B as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.5VjiPpN8.mjs';
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
5
|
import { pathExists } from 'fs-extra';
|
|
6
|
-
import { l as logger } from './shared/zotero-plugin-scaffold.
|
|
6
|
+
import { l as logger } from './shared/zotero-plugin-scaffold.qsx_2VJx.mjs';
|
|
7
7
|
import tinyUpdateNotifier from 'tiny-update-notifier';
|
|
8
8
|
import 'c12';
|
|
9
9
|
import 'es-toolkit';
|
|
@@ -36,7 +36,7 @@ import 'node:http';
|
|
|
36
36
|
import 'node:readline';
|
|
37
37
|
|
|
38
38
|
const name = "zotero-plugin-scaffold";
|
|
39
|
-
const version = "0.8.
|
|
39
|
+
const version = "0.8.1";
|
|
40
40
|
const pkg = {
|
|
41
41
|
name: name,
|
|
42
42
|
version: version};
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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.
|
|
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.5VjiPpN8.mjs';
|
|
2
2
|
import 'c12';
|
|
3
3
|
import 'es-toolkit';
|
|
4
4
|
import 'fs-extra/esm';
|
|
5
5
|
import 'hookable';
|
|
6
|
-
import './shared/zotero-plugin-scaffold.
|
|
6
|
+
import './shared/zotero-plugin-scaffold.qsx_2VJx.mjs';
|
|
7
7
|
import 'node:fs/promises';
|
|
8
8
|
import 'tinyglobby';
|
|
9
9
|
import 'node:process';
|
package/dist/shared/{zotero-plugin-scaffold.8gLns8GX.mjs → zotero-plugin-scaffold.5VjiPpN8.mjs}
RENAMED
|
@@ -2,7 +2,7 @@ import { loadConfig as loadConfig$1, setupDotenv } from 'c12';
|
|
|
2
2
|
import { kebabCase, mapValues, toMerged, escapeRegExp, debounce, delay } from 'es-toolkit';
|
|
3
3
|
import { readJsonSync, copy, move, outputFile, readJSON, outputJSON, writeJson, emptyDir, pathExists, ensureDir, remove } from 'fs-extra/esm';
|
|
4
4
|
import { createHooks } from 'hookable';
|
|
5
|
-
import { l as logger, p as parseRepoUrl, d as dateFormat, t as template, b as toArray, s as
|
|
5
|
+
import { l as logger, p as parseRepoUrl, d as dateFormat, t as template, b as toArray, s as stdout, c as replaceDefine, L as LOG_LEVEL } from './zotero-plugin-scaffold.qsx_2VJx.mjs';
|
|
6
6
|
import process$1 from 'node:process';
|
|
7
7
|
import { glob, globSync } from 'tinyglobby';
|
|
8
8
|
import path, { resolve as resolve$1, dirname, basename, join as join$1, isAbsolute as isAbsolute$1, extname as extname$1 } from 'node:path';
|
|
@@ -374,7 +374,7 @@ class MessageManager {
|
|
|
374
374
|
return;
|
|
375
375
|
const missingLocales = [...this.ftlMessages.entries()].filter(([_, messages]) => !messages.has(msg)).map(([locale]) => locale);
|
|
376
376
|
if (missingLocales.length > 0)
|
|
377
|
-
logger.warn(`I10N id ${
|
|
377
|
+
logger.warn(`I10N id ${stdout.blue(msg)} missing in locale: ${missingLocales.join(", ")}`);
|
|
378
378
|
});
|
|
379
379
|
}
|
|
380
380
|
getFTLMessages() {
|
|
@@ -397,11 +397,11 @@ function processHTMLFile(content, namespace, allMessages, ignores, filePath) {
|
|
|
397
397
|
const processed = content.replace(L10N_PATTERN, (match, attr, id) => {
|
|
398
398
|
foundMessages.add(id);
|
|
399
399
|
if (ignores.includes(id)) {
|
|
400
|
-
logger.debug(`Skipped ignored ID: ${
|
|
400
|
+
logger.debug(`Skipped ignored ID: ${stdout.blue(id)} in ${stdout.gray(filePath)}`);
|
|
401
401
|
return match;
|
|
402
402
|
}
|
|
403
403
|
if (!allMessages.has(id)) {
|
|
404
|
-
logger.warn(`I10N id ${
|
|
404
|
+
logger.warn(`I10N id ${stdout.blue(id)} in path ${stdout.gray(filePath)} does not exist in any locale, skip renaming it.`);
|
|
405
405
|
return match;
|
|
406
406
|
}
|
|
407
407
|
return `${attr}="${namespace}-${id}"`;
|
|
@@ -683,7 +683,7 @@ async function buildPrefs(dist, options) {
|
|
|
683
683
|
Object.entries(prefs).forEach(([key, value]) => {
|
|
684
684
|
if (typeof value === "number") {
|
|
685
685
|
if (!is32BitNumber(value)) {
|
|
686
|
-
logger.warn(`Pref key '${
|
|
686
|
+
logger.warn(`Pref key '${stdout.blue(key)}' is a number, but is more than 4 bytes, which can be problematic on some OS.`);
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
});
|
|
@@ -705,17 +705,17 @@ async function buildPrefs(dist, options) {
|
|
|
705
705
|
for (const match of matchs) {
|
|
706
706
|
const [matched, key] = match;
|
|
707
707
|
if (key.startsWith(prefix)) {
|
|
708
|
-
logger.debug(`Pref key '${
|
|
708
|
+
logger.debug(`Pref key '${stdout.blue(key)}' is already starts with '${prefix}', skip prefixing it.`);
|
|
709
709
|
continue;
|
|
710
710
|
} else if (key.startsWith("extensions.")) {
|
|
711
|
-
logger.warn(`Pref key '${
|
|
711
|
+
logger.warn(`Pref key '${stdout.blue(key)}' in ${stdout.gray(path)} starts with 'extensions.' but not '${stdout.blue(prefix)}', skip prefixing it.`);
|
|
712
712
|
continue;
|
|
713
713
|
} else if (!(key in prefsWithPrefix) && !(key in prefsWithoutPrefix)) {
|
|
714
|
-
logger.warn(`Pref key '${
|
|
714
|
+
logger.warn(`Pref key '${stdout.blue(key)}' in ${stdout.gray(path)} is not found in prefs.js, skip prefixing it.`);
|
|
715
715
|
continue;
|
|
716
716
|
} else {
|
|
717
717
|
const prefixed = `${prefix}.${key}`;
|
|
718
|
-
logger.debug(`Pref key '${
|
|
718
|
+
logger.debug(`Pref key '${stdout.blue(key)}' in ${stdout.gray(path)} is prefixed to ${stdout.blue(prefixed)}.`);
|
|
719
719
|
content = content.replace(matched, `preference="${prefixed}"`);
|
|
720
720
|
}
|
|
721
721
|
}
|
|
@@ -816,7 +816,7 @@ class Build extends Base {
|
|
|
816
816
|
const { dist, version } = this.ctx;
|
|
817
817
|
const t = /* @__PURE__ */ new Date();
|
|
818
818
|
this.buildTime = dateFormat("YYYY-mm-dd HH:MM:SS", t);
|
|
819
|
-
this.logger.info(`Building version ${
|
|
819
|
+
this.logger.info(`Building version ${stdout.blue(version)} to ${stdout.blue(dist)} at ${stdout.blue(this.buildTime)} in ${stdout.blue(process$1.env.NODE_ENV)} mode.`);
|
|
820
820
|
await this.ctx.hooks.callHook("build:init", this.ctx);
|
|
821
821
|
this.logger.tip("Preparing static assets", { space: 1 });
|
|
822
822
|
await this.prepareAssets();
|
|
@@ -4354,7 +4354,7 @@ class TestHttpReporter {
|
|
|
4354
4354
|
logger.tip(data.title, logger_option);
|
|
4355
4355
|
break;
|
|
4356
4356
|
case "pass":
|
|
4357
|
-
logger.success(`${data.title} ${
|
|
4357
|
+
logger.success(`${data.title} ${stdout.gray(`${data.duration}ms`)}`, logger_option);
|
|
4358
4358
|
break;
|
|
4359
4359
|
case "fail": {
|
|
4360
4360
|
let formatOutput = function(obj, indent) {
|
|
@@ -4365,15 +4365,15 @@ class TestHttpReporter {
|
|
|
4365
4365
|
return `${firstLine}
|
|
4366
4366
|
${restLines}`;
|
|
4367
4367
|
};
|
|
4368
|
-
logger.fail(
|
|
4368
|
+
logger.fail(stdout.red(`${data.title}, ${data?.error?.message}`), logger_option);
|
|
4369
4369
|
let expected = data.error.expected;
|
|
4370
4370
|
let received = data.error.actual;
|
|
4371
4371
|
if (expected && typeof expected === "object")
|
|
4372
4372
|
expected = formatOutput(expected, data.indents + 1);
|
|
4373
4373
|
if (received && typeof received === "object")
|
|
4374
4374
|
received = formatOutput(received, data.indents + 1);
|
|
4375
|
-
logger.log(`Expected: ${
|
|
4376
|
-
logger.log(`Received: ${
|
|
4375
|
+
logger.log(`Expected: ${stdout.green(String(expected))}`, { space: data.indents + 0.5 });
|
|
4376
|
+
logger.log(`Received: ${stdout.red(String(received))}`, { space: data.indents + 0.5 });
|
|
4377
4377
|
break;
|
|
4378
4378
|
}
|
|
4379
4379
|
case "pending":
|
package/dist/shared/{zotero-plugin-scaffold.CzBjWbS8.mjs → zotero-plugin-scaffold.qsx_2VJx.mjs}
RENAMED
|
@@ -3,16 +3,22 @@ import { glob } from 'tinyglobby';
|
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
import readline from 'node:readline';
|
|
5
5
|
import { isPlainObject } from 'es-toolkit';
|
|
6
|
-
import
|
|
6
|
+
import { styleText } from 'node:util';
|
|
7
7
|
import { isDebug } from 'std-env';
|
|
8
8
|
|
|
9
|
-
const factory = (...formats) =>
|
|
10
|
-
new Proxy(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const factory = (styleText, options, ...formats) =>
|
|
10
|
+
new Proxy(
|
|
11
|
+
(raw, ...substitutions) =>
|
|
12
|
+
styleText(
|
|
13
|
+
formats,
|
|
14
|
+
raw.raw ? String.raw({raw}, ...substitutions) : raw,
|
|
15
|
+
options,
|
|
16
|
+
),
|
|
17
|
+
{get: (_, format) => factory(styleText, options, ...formats, format)},
|
|
18
|
+
);
|
|
14
19
|
|
|
15
|
-
const
|
|
20
|
+
const stdout = factory(styleText, {stream: process.stdout});
|
|
21
|
+
factory(styleText, {stream: process.stderr});
|
|
16
22
|
|
|
17
23
|
var LOG_LEVEL = /* @__PURE__ */ ((LOG_LEVEL2) => {
|
|
18
24
|
LOG_LEVEL2[LOG_LEVEL2["TRACE"] = 0] = "TRACE";
|
|
@@ -23,13 +29,13 @@ var LOG_LEVEL = /* @__PURE__ */ ((LOG_LEVEL2) => {
|
|
|
23
29
|
return LOG_LEVEL2;
|
|
24
30
|
})(LOG_LEVEL || {});
|
|
25
31
|
const SYMBOLS = {
|
|
26
|
-
SUCCESS:
|
|
27
|
-
INFO:
|
|
28
|
-
FAIL:
|
|
29
|
-
TIP:
|
|
30
|
-
ERROR:
|
|
31
|
-
WARN:
|
|
32
|
-
DEBUG:
|
|
32
|
+
SUCCESS: stdout.green("\u2714"),
|
|
33
|
+
INFO: stdout.blue("\u2139"),
|
|
34
|
+
FAIL: stdout.red("\u2716"),
|
|
35
|
+
TIP: stdout.blue("\u2192"),
|
|
36
|
+
ERROR: stdout.bgRed(" ERROR "),
|
|
37
|
+
WARN: stdout.bgYellow(" WARN "),
|
|
38
|
+
DEBUG: stdout.grey("\u2699"),
|
|
33
39
|
NONE: ""
|
|
34
40
|
};
|
|
35
41
|
const DEFAULT_OPTIONS = {
|
|
@@ -112,7 +118,7 @@ class Logger {
|
|
|
112
118
|
return String(content);
|
|
113
119
|
}
|
|
114
120
|
formatError(error) {
|
|
115
|
-
return `${
|
|
121
|
+
return `${stdout.red(error.name)}: ${stdout.red(error.message)}
|
|
116
122
|
${error.stack}`;
|
|
117
123
|
}
|
|
118
124
|
/**
|
|
@@ -157,7 +163,7 @@ ${error.stack}`;
|
|
|
157
163
|
this.logInternal(content, LOG_METHODS_CONFIG.fail, options);
|
|
158
164
|
}
|
|
159
165
|
ready(content) {
|
|
160
|
-
this.logInternal(
|
|
166
|
+
this.logInternal(stdout.green(content), LOG_METHODS_CONFIG.success);
|
|
161
167
|
}
|
|
162
168
|
log(content, options) {
|
|
163
169
|
this.logInternal(content, LOG_METHODS_CONFIG.log, options);
|
|
@@ -254,4 +260,4 @@ async function replaceDefine(dist, define) {
|
|
|
254
260
|
});
|
|
255
261
|
}
|
|
256
262
|
|
|
257
|
-
export { LOG_LEVEL as L, replaceInFile as a, toArray as b, replaceDefine as c, dateFormat as d, logger as l, parseRepoUrl as p, replace as r,
|
|
263
|
+
export { LOG_LEVEL as L, replaceInFile as a, toArray as b, replaceDefine as c, dateFormat as d, logger as l, parseRepoUrl as p, replace as r, stdout as s, template as t };
|
package/dist/vendor/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { r as replace, a as replaceInFile } from '../shared/zotero-plugin-scaffold.
|
|
1
|
+
export { r as replace, a as replaceInFile } from '../shared/zotero-plugin-scaffold.qsx_2VJx.mjs';
|
|
2
2
|
import * as esToolkit from 'es-toolkit';
|
|
3
3
|
export { esToolkit };
|
|
4
4
|
import * as esm from 'fs-extra/esm';
|
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.1",
|
|
5
5
|
"description": "A scaffold for Zotero plugin development.",
|
|
6
6
|
"author": "northword",
|
|
7
7
|
"license": "AGPL-3.0-or-later",
|
|
@@ -55,39 +55,39 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@fluent/syntax": "^0.19.0",
|
|
58
|
-
"@swc/core": "^1.
|
|
58
|
+
"@swc/core": "^1.15.0",
|
|
59
59
|
"adm-zip": "^0.5.16",
|
|
60
|
-
"bumpp": "^10.
|
|
61
|
-
"c12": "^3.
|
|
60
|
+
"bumpp": "^10.3.1",
|
|
61
|
+
"c12": "^3.3.1",
|
|
62
62
|
"chokidar": "^4.0.3",
|
|
63
|
-
"commander": "^14.0.
|
|
64
|
-
"es-toolkit": "^1.
|
|
65
|
-
"esbuild": "^0.25.
|
|
66
|
-
"fs-extra": "^11.3.
|
|
63
|
+
"commander": "^14.0.2",
|
|
64
|
+
"es-toolkit": "^1.41.0",
|
|
65
|
+
"esbuild": "^0.25.12",
|
|
66
|
+
"fs-extra": "^11.3.2",
|
|
67
67
|
"hookable": "^5.5.3",
|
|
68
|
-
"octokit": "^5.0.
|
|
69
|
-
"std-env": "^3.
|
|
68
|
+
"octokit": "^5.0.5",
|
|
69
|
+
"std-env": "^3.10.0",
|
|
70
70
|
"tiny-update-notifier": "^2.0.2",
|
|
71
|
-
"tinyglobby": "^0.2.
|
|
72
|
-
"xvfb-ts": "^1.1.
|
|
71
|
+
"tinyglobby": "^0.2.15",
|
|
72
|
+
"xvfb-ts": "^1.1.1"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@antfu/eslint-config": "^
|
|
75
|
+
"@antfu/eslint-config": "^6.2.0",
|
|
76
76
|
"@commander-js/extra-typings": "^14.0.0",
|
|
77
77
|
"@types/adm-zip": "^0.5.7",
|
|
78
78
|
"@types/fs-extra": "^11.0.4",
|
|
79
|
-
"@types/node": "^
|
|
80
|
-
"bumpp": "^10.
|
|
79
|
+
"@types/node": "^24.10.0",
|
|
80
|
+
"bumpp": "^10.3.1",
|
|
81
81
|
"changelogen": "^0.6.2",
|
|
82
|
-
"eslint": "^9.
|
|
83
|
-
"eslint-plugin-format": "^1.0.
|
|
82
|
+
"eslint": "^9.39.1",
|
|
83
|
+
"eslint-plugin-format": "^1.0.2",
|
|
84
84
|
"husky": "^9.1.7",
|
|
85
|
-
"lint-staged": "^16.
|
|
86
|
-
"node-style-text": "^
|
|
87
|
-
"tsx": "^4.20.
|
|
88
|
-
"typescript": "^5.9.
|
|
89
|
-
"unbuild": "^3.6.
|
|
90
|
-
"vitest": "^
|
|
85
|
+
"lint-staged": "^16.2.6",
|
|
86
|
+
"node-style-text": "^2.1.2",
|
|
87
|
+
"tsx": "^4.20.6",
|
|
88
|
+
"typescript": "^5.9.3",
|
|
89
|
+
"unbuild": "^3.6.1",
|
|
90
|
+
"vitest": "^4.0.7"
|
|
91
91
|
},
|
|
92
92
|
"workspaces": [
|
|
93
93
|
"src",
|