zotero-plugin-scaffold 0.2.0-beta.21 → 0.2.0-beta.22
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/chunks/github.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import process from 'node:process';
|
|
|
4
4
|
import { Octokit } from 'octokit';
|
|
5
5
|
import { globSync, glob } from 'tinyglobby';
|
|
6
6
|
import { isCI } from 'std-env';
|
|
7
|
-
import { B as Base } from '../shared/zotero-plugin-scaffold.
|
|
7
|
+
import { B as Base } from '../shared/zotero-plugin-scaffold.BHL5XRhZ.mjs';
|
|
8
8
|
import 'c12';
|
|
9
9
|
import 'es-toolkit';
|
|
10
10
|
import 'fs-extra/esm';
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { Command } from '@commander-js/extra-typings';
|
|
3
|
-
import { E as ExitSignals, l as logger, C as Config, a as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.
|
|
3
|
+
import { E as ExitSignals, l as logger, C as Config, a as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.BHL5XRhZ.mjs';
|
|
4
4
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
5
5
|
import { pathExists, ensureFile } from 'fs-extra';
|
|
6
6
|
import tinyUpdateNotifier from 'tiny-update-notifier';
|
|
@@ -30,7 +30,7 @@ import 'xvfb-ts';
|
|
|
30
30
|
|
|
31
31
|
const name = "zotero-plugin-scaffold";
|
|
32
32
|
const type = "module";
|
|
33
|
-
const version = "0.2.0-beta.
|
|
33
|
+
const version = "0.2.0-beta.22";
|
|
34
34
|
const packageManager = "pnpm@9.15.2";
|
|
35
35
|
const description = "A scaffold for Zotero plugin development.";
|
|
36
36
|
const author = "northword";
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as Build, C as Config, R as Release, S as Serve, T as Test, d as defineConfig } from './shared/zotero-plugin-scaffold.
|
|
1
|
+
export { a as Build, C as Config, R as Release, S as Serve, T as Test, d as defineConfig } from './shared/zotero-plugin-scaffold.BHL5XRhZ.mjs';
|
|
2
2
|
import 'c12';
|
|
3
3
|
import 'es-toolkit';
|
|
4
4
|
import 'fs-extra/esm';
|
package/dist/shared/{zotero-plugin-scaffold.BM5qZVo0.mjs → zotero-plugin-scaffold.BHL5XRhZ.mjs}
RENAMED
|
@@ -339,7 +339,7 @@ class PrefsManager {
|
|
|
339
339
|
async write(path) {
|
|
340
340
|
const content = this.render();
|
|
341
341
|
await outputFile(path, content, "utf-8");
|
|
342
|
-
logger.debug("The
|
|
342
|
+
logger.debug("The prefs.js has been modified.");
|
|
343
343
|
}
|
|
344
344
|
setPref(key, value) {
|
|
345
345
|
if (value === null || value === void 0) {
|
|
@@ -537,7 +537,7 @@ class Build extends Base {
|
|
|
537
537
|
await writeFile(ftlPath, ftlContent);
|
|
538
538
|
if (build.fluent.prefixLocaleFiles === true) {
|
|
539
539
|
await move(ftlPath, `${dirname(ftlPath)}/${namespace}-${basename(ftlPath)}`);
|
|
540
|
-
this.logger.debug(`
|
|
540
|
+
this.logger.debug(`FTL file '${ftlPath}' is renamed to '${namespace}-${basename(ftlPath)}'.`);
|
|
541
541
|
}
|
|
542
542
|
}));
|
|
543
543
|
messagesByLocale.set(localeName, localeMessages);
|
|
@@ -553,12 +553,13 @@ class Build extends Base {
|
|
|
553
553
|
for (const match of matches) {
|
|
554
554
|
const [matched, attrKey, attrVal] = match;
|
|
555
555
|
if (!allMessages.has(attrVal)) {
|
|
556
|
-
this.logger.
|
|
556
|
+
this.logger.warn(`HTML data-i10n-id '${chalk.blue(attrVal)}' in ${chalk.gray(htmlPath)} do not exist in any FTL message, skip to namespace it.`);
|
|
557
557
|
continue;
|
|
558
558
|
}
|
|
559
559
|
messagesInHTML.add(attrVal);
|
|
560
560
|
const namespacedAttr = `${namespace}-${attrVal}`;
|
|
561
561
|
htmlContent = htmlContent.replace(matched, `${attrKey}="${namespacedAttr}"`);
|
|
562
|
+
this.logger.debug(`HTML data-i10n-id '${chalk.blue(attrVal)}' in ${chalk.gray(htmlPath)} is namespaced to ${chalk.blue(namespacedAttr)}.`);
|
|
562
563
|
}
|
|
563
564
|
if (build.fluent.prefixFluentMessages)
|
|
564
565
|
await writeFile(htmlPath, htmlContent);
|
|
@@ -566,7 +567,7 @@ class Build extends Base {
|
|
|
566
567
|
messagesInHTML.forEach((messageInHTML) => {
|
|
567
568
|
const missingLocales = [...messagesByLocale.entries()].filter(([_, messages]) => !messages.has(messageInHTML)).map(([locale]) => locale);
|
|
568
569
|
if (missingLocales.length > 0) {
|
|
569
|
-
this.logger.warn(`HTML data-l10n-id
|
|
570
|
+
this.logger.warn(`HTML data-l10n-id '${chalk.blue(messageInHTML)}' is missing in locales: ${missingLocales.join(", ")}.`);
|
|
570
571
|
}
|
|
571
572
|
});
|
|
572
573
|
}
|
|
@@ -592,21 +593,26 @@ class Build extends Base {
|
|
|
592
593
|
await prefsManager.write(prefsFilePath);
|
|
593
594
|
}
|
|
594
595
|
if (prefixPrefKeys) {
|
|
595
|
-
const HTML_PREFERENCE_PATTERN =
|
|
596
|
+
const HTML_PREFERENCE_PATTERN = /preference="(\S*)"/g;
|
|
596
597
|
const xhtmlPaths = await glob(`${dist}/addon/**/*.xhtml`);
|
|
597
598
|
await Promise.all(xhtmlPaths.map(async (path) => {
|
|
598
599
|
let content = await readFile(path, "utf-8");
|
|
599
600
|
const matchs = [...content.matchAll(HTML_PREFERENCE_PATTERN)];
|
|
600
601
|
for (const match of matchs) {
|
|
601
602
|
const [matched, key] = match;
|
|
602
|
-
if (!(key in prefsWithoutPrefix) && !(key in prefsWithoutPrefix)) {
|
|
603
|
-
this.logger.warn(`preference key '${key}' in ${path.replace(`${dist}/`, "")} not init in prefs.js`);
|
|
604
|
-
continue;
|
|
605
|
-
}
|
|
606
603
|
if (key.startsWith(prefix)) {
|
|
604
|
+
this.logger.debug(`Pref key '${chalk.blue(key)}' is already starts with '${prefix}', skip prefixing it.`);
|
|
605
|
+
continue;
|
|
606
|
+
} else if (key.startsWith("extensions.")) {
|
|
607
|
+
this.logger.warn(`Pref key '${chalk.blue(key)}' in ${chalk.gray(path)} starts with 'extensions.' but not '${chalk.blue(prefix)}', skip prefixing it.`);
|
|
608
|
+
continue;
|
|
609
|
+
} else if (!(key in prefsWithPrefix) && !(key in prefsWithoutPrefix)) {
|
|
610
|
+
this.logger.warn(`Pref key '${chalk.blue(key)}' in ${chalk.gray(path)} is not found in prefs.js, skip prefixing it.`);
|
|
607
611
|
continue;
|
|
608
612
|
} else {
|
|
609
|
-
|
|
613
|
+
const prefixed = `${prefix}.${key}`;
|
|
614
|
+
this.logger.debug(`Pref key '${chalk.blue(key)}' in ${chalk.gray(path)} is prefixed to ${chalk.blue(prefixed)}.`);
|
|
615
|
+
content = content.replace(matched, `preference="${prefixed}"`);
|
|
610
616
|
}
|
|
611
617
|
}
|
|
612
618
|
await outputFile(path, content, "utf-8");
|
package/package.json
CHANGED