zotero-plugin-scaffold 0.0.30 → 0.0.32

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 CHANGED
@@ -24,7 +24,7 @@ import 'chokidar';
24
24
  import 'process';
25
25
 
26
26
  const name = "zotero-plugin-scaffold";
27
- const version = "0.0.30";
27
+ const version = "0.0.32";
28
28
  const description = "A scaffold for Zotero plugin development.";
29
29
  const scripts = {
30
30
  dev: "unbuild --stub",
@@ -79,17 +79,17 @@ const directories = {
79
79
  const engines = {
80
80
  node: ">=18"
81
81
  };
82
- const packageManager = "pnpm@9.1.3";
82
+ const packageManager = "pnpm@9.4.0";
83
83
  const dependencies = {
84
- "@inquirer/prompts": "5.0.4",
84
+ "@inquirer/prompts": "5.0.6",
85
85
  bumpp: "9.4.1",
86
- c12: "1.10.0",
86
+ c12: "1.11.1",
87
87
  chalk: "5.3.0",
88
88
  chokidar: "3.6.0",
89
89
  commander: "12.1.0",
90
90
  consola: "3.2.3",
91
91
  "conventional-changelog": "6.0.0",
92
- esbuild: "0.21.4",
92
+ esbuild: "0.21.5",
93
93
  "fast-glob": "3.3.2",
94
94
  "fs-extra": "11.2.0",
95
95
  hookable: "5.5.3",
@@ -105,12 +105,12 @@ const devDependencies = {
105
105
  "@trivago/prettier-plugin-sort-imports": "4.3.0",
106
106
  "@types/conventional-changelog": "3.1.5",
107
107
  "@types/fs-extra": "11.0.4",
108
- "@types/node": "20.12.12",
108
+ "@types/node": "20.14.8",
109
109
  "@types/update-notifier": "6.0.8",
110
- eslint: "9.3.0",
111
- prettier: "3.2.5",
112
- typescript: "5.4.5",
113
- "typescript-eslint": "8.0.0-alpha.20",
110
+ eslint: "9.5.0",
111
+ prettier: "3.3.2",
112
+ typescript: "5.5.2",
113
+ "typescript-eslint": "8.0.0-alpha.30",
114
114
  unbuild: "2.0.0"
115
115
  };
116
116
  const pnpm = {
package/dist/index.d.mts CHANGED
@@ -439,14 +439,14 @@ declare class Release extends Base {
439
439
  tag_name: string;
440
440
  target_commitish: string;
441
441
  name: string | null;
442
- body?: string | null | undefined;
442
+ body?: string | null;
443
443
  draft: boolean;
444
444
  prerelease: boolean;
445
445
  created_at: string;
446
446
  published_at: string | null;
447
447
  author: {
448
- name?: string | null | undefined;
449
- email?: string | null | undefined;
448
+ name?: string | null;
449
+ email?: string | null;
450
450
  login: string;
451
451
  id: number;
452
452
  node_id: string;
@@ -465,7 +465,7 @@ declare class Release extends Base {
465
465
  received_events_url: string;
466
466
  type: string;
467
467
  site_admin: boolean;
468
- starred_at?: string | undefined;
468
+ starred_at?: string;
469
469
  };
470
470
  assets: {
471
471
  url: string;
@@ -481,8 +481,8 @@ declare class Release extends Base {
481
481
  created_at: string;
482
482
  updated_at: string;
483
483
  uploader: {
484
- name?: string | null | undefined;
485
- email?: string | null | undefined;
484
+ name?: string | null;
485
+ email?: string | null;
486
486
  login: string;
487
487
  id: number;
488
488
  node_id: string;
@@ -501,13 +501,13 @@ declare class Release extends Base {
501
501
  received_events_url: string;
502
502
  type: string;
503
503
  site_admin: boolean;
504
- starred_at?: string | undefined;
504
+ starred_at?: string;
505
505
  } | null;
506
506
  }[];
507
- body_html?: string | undefined;
508
- body_text?: string | undefined;
509
- mentions_count?: number | undefined;
510
- discussion_url?: string | undefined;
507
+ body_html?: string;
508
+ body_text?: string;
509
+ mentions_count?: number;
510
+ discussion_url?: string;
511
511
  reactions?: {
512
512
  url: string;
513
513
  total_count: number;
@@ -519,7 +519,7 @@ declare class Release extends Base {
519
519
  hooray: number;
520
520
  eyes: number;
521
521
  rocket: number;
522
- } | undefined;
522
+ };
523
523
  } | undefined>;
524
524
  createRelease(options: Parameters<Octokit["rest"]["repos"]["createRelease"]>[0]): Promise<{
525
525
  url: string;
@@ -533,14 +533,14 @@ declare class Release extends Base {
533
533
  tag_name: string;
534
534
  target_commitish: string;
535
535
  name: string | null;
536
- body?: string | null | undefined;
536
+ body?: string | null;
537
537
  draft: boolean;
538
538
  prerelease: boolean;
539
539
  created_at: string;
540
540
  published_at: string | null;
541
541
  author: {
542
- name?: string | null | undefined;
543
- email?: string | null | undefined;
542
+ name?: string | null;
543
+ email?: string | null;
544
544
  login: string;
545
545
  id: number;
546
546
  node_id: string;
@@ -559,7 +559,7 @@ declare class Release extends Base {
559
559
  received_events_url: string;
560
560
  type: string;
561
561
  site_admin: boolean;
562
- starred_at?: string | undefined;
562
+ starred_at?: string;
563
563
  };
564
564
  assets: {
565
565
  url: string;
@@ -575,8 +575,8 @@ declare class Release extends Base {
575
575
  created_at: string;
576
576
  updated_at: string;
577
577
  uploader: {
578
- name?: string | null | undefined;
579
- email?: string | null | undefined;
578
+ name?: string | null;
579
+ email?: string | null;
580
580
  login: string;
581
581
  id: number;
582
582
  node_id: string;
@@ -595,13 +595,13 @@ declare class Release extends Base {
595
595
  received_events_url: string;
596
596
  type: string;
597
597
  site_admin: boolean;
598
- starred_at?: string | undefined;
598
+ starred_at?: string;
599
599
  } | null;
600
600
  }[];
601
- body_html?: string | undefined;
602
- body_text?: string | undefined;
603
- mentions_count?: number | undefined;
604
- discussion_url?: string | undefined;
601
+ body_html?: string;
602
+ body_text?: string;
603
+ mentions_count?: number;
604
+ discussion_url?: string;
605
605
  reactions?: {
606
606
  url: string;
607
607
  total_count: number;
@@ -613,7 +613,7 @@ declare class Release extends Base {
613
613
  hooray: number;
614
614
  eyes: number;
615
615
  rocket: number;
616
- } | undefined;
616
+ };
617
617
  } | undefined>;
618
618
  uploadAsset(releaseID: number, asset: string): Promise<{
619
619
  url: string;
@@ -629,8 +629,8 @@ declare class Release extends Base {
629
629
  created_at: string;
630
630
  updated_at: string;
631
631
  uploader: {
632
- name?: string | null | undefined;
633
- email?: string | null | undefined;
632
+ name?: string | null;
633
+ email?: string | null;
634
634
  login: string;
635
635
  id: number;
636
636
  node_id: string;
@@ -649,7 +649,7 @@ declare class Release extends Base {
649
649
  received_events_url: string;
650
650
  type: string;
651
651
  site_admin: boolean;
652
- starred_at?: string | undefined;
652
+ starred_at?: string;
653
653
  } | null;
654
654
  }>;
655
655
  refreshUpdateManifest(): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -439,14 +439,14 @@ declare class Release extends Base {
439
439
  tag_name: string;
440
440
  target_commitish: string;
441
441
  name: string | null;
442
- body?: string | null | undefined;
442
+ body?: string | null;
443
443
  draft: boolean;
444
444
  prerelease: boolean;
445
445
  created_at: string;
446
446
  published_at: string | null;
447
447
  author: {
448
- name?: string | null | undefined;
449
- email?: string | null | undefined;
448
+ name?: string | null;
449
+ email?: string | null;
450
450
  login: string;
451
451
  id: number;
452
452
  node_id: string;
@@ -465,7 +465,7 @@ declare class Release extends Base {
465
465
  received_events_url: string;
466
466
  type: string;
467
467
  site_admin: boolean;
468
- starred_at?: string | undefined;
468
+ starred_at?: string;
469
469
  };
470
470
  assets: {
471
471
  url: string;
@@ -481,8 +481,8 @@ declare class Release extends Base {
481
481
  created_at: string;
482
482
  updated_at: string;
483
483
  uploader: {
484
- name?: string | null | undefined;
485
- email?: string | null | undefined;
484
+ name?: string | null;
485
+ email?: string | null;
486
486
  login: string;
487
487
  id: number;
488
488
  node_id: string;
@@ -501,13 +501,13 @@ declare class Release extends Base {
501
501
  received_events_url: string;
502
502
  type: string;
503
503
  site_admin: boolean;
504
- starred_at?: string | undefined;
504
+ starred_at?: string;
505
505
  } | null;
506
506
  }[];
507
- body_html?: string | undefined;
508
- body_text?: string | undefined;
509
- mentions_count?: number | undefined;
510
- discussion_url?: string | undefined;
507
+ body_html?: string;
508
+ body_text?: string;
509
+ mentions_count?: number;
510
+ discussion_url?: string;
511
511
  reactions?: {
512
512
  url: string;
513
513
  total_count: number;
@@ -519,7 +519,7 @@ declare class Release extends Base {
519
519
  hooray: number;
520
520
  eyes: number;
521
521
  rocket: number;
522
- } | undefined;
522
+ };
523
523
  } | undefined>;
524
524
  createRelease(options: Parameters<Octokit["rest"]["repos"]["createRelease"]>[0]): Promise<{
525
525
  url: string;
@@ -533,14 +533,14 @@ declare class Release extends Base {
533
533
  tag_name: string;
534
534
  target_commitish: string;
535
535
  name: string | null;
536
- body?: string | null | undefined;
536
+ body?: string | null;
537
537
  draft: boolean;
538
538
  prerelease: boolean;
539
539
  created_at: string;
540
540
  published_at: string | null;
541
541
  author: {
542
- name?: string | null | undefined;
543
- email?: string | null | undefined;
542
+ name?: string | null;
543
+ email?: string | null;
544
544
  login: string;
545
545
  id: number;
546
546
  node_id: string;
@@ -559,7 +559,7 @@ declare class Release extends Base {
559
559
  received_events_url: string;
560
560
  type: string;
561
561
  site_admin: boolean;
562
- starred_at?: string | undefined;
562
+ starred_at?: string;
563
563
  };
564
564
  assets: {
565
565
  url: string;
@@ -575,8 +575,8 @@ declare class Release extends Base {
575
575
  created_at: string;
576
576
  updated_at: string;
577
577
  uploader: {
578
- name?: string | null | undefined;
579
- email?: string | null | undefined;
578
+ name?: string | null;
579
+ email?: string | null;
580
580
  login: string;
581
581
  id: number;
582
582
  node_id: string;
@@ -595,13 +595,13 @@ declare class Release extends Base {
595
595
  received_events_url: string;
596
596
  type: string;
597
597
  site_admin: boolean;
598
- starred_at?: string | undefined;
598
+ starred_at?: string;
599
599
  } | null;
600
600
  }[];
601
- body_html?: string | undefined;
602
- body_text?: string | undefined;
603
- mentions_count?: number | undefined;
604
- discussion_url?: string | undefined;
601
+ body_html?: string;
602
+ body_text?: string;
603
+ mentions_count?: number;
604
+ discussion_url?: string;
605
605
  reactions?: {
606
606
  url: string;
607
607
  total_count: number;
@@ -613,7 +613,7 @@ declare class Release extends Base {
613
613
  hooray: number;
614
614
  eyes: number;
615
615
  rocket: number;
616
- } | undefined;
616
+ };
617
617
  } | undefined>;
618
618
  uploadAsset(releaseID: number, asset: string): Promise<{
619
619
  url: string;
@@ -629,8 +629,8 @@ declare class Release extends Base {
629
629
  created_at: string;
630
630
  updated_at: string;
631
631
  uploader: {
632
- name?: string | null | undefined;
633
- email?: string | null | undefined;
632
+ name?: string | null;
633
+ email?: string | null;
634
634
  login: string;
635
635
  id: number;
636
636
  node_id: string;
@@ -649,7 +649,7 @@ declare class Release extends Base {
649
649
  received_events_url: string;
650
650
  type: string;
651
651
  site_admin: boolean;
652
- starred_at?: string | undefined;
652
+ starred_at?: string;
653
653
  } | null;
654
654
  }>;
655
655
  refreshUpdateManifest(): Promise<void>;
package/dist/index.mjs CHANGED
@@ -337,6 +337,7 @@ class Build extends Base {
337
337
  ...userData,
338
338
  ...this.name && { name: this.name },
339
339
  ...this.version && { version: this.version },
340
+ manifest_version: 2,
340
341
  applications: {
341
342
  //@ts-ignore 此处不包含版本限制
342
343
  zotero: {
@@ -379,22 +380,6 @@ class Build extends Base {
379
380
  );
380
381
  }
381
382
  prepareLocaleFiles() {
382
- const MessagesInHTML = /* @__PURE__ */ new Set();
383
- replaceInFile.sync({
384
- files: [`${this.dist}/addon/**/*.xhtml`, `${this.dist}/addon/**/*.html`],
385
- // @ts-ignore ReplaceInFileConfig has processor
386
- processor: (input) => {
387
- const matchs = [...input.matchAll(/(data-l10n-id)="(\S*)"/g)];
388
- matchs.map((match) => {
389
- input = input.replace(
390
- match[0],
391
- this.ctx.build.fluent.prefixFluentMessages == true ? `${match[1]}="${this.namespace}-${match[2]}"` : match[0]
392
- );
393
- MessagesInHTML.add(match[2]);
394
- });
395
- return input;
396
- }
397
- });
398
383
  const localeNames = glob.sync(`${this.dist}/addon/locale/**`, { onlyDirectories: true }).map((locale) => path.basename(locale));
399
384
  this.logger.debug("locale names: ", localeNames);
400
385
  for (const localeName of localeNames) {
@@ -427,9 +412,35 @@ class Build extends Base {
427
412
  return prefixedLines.join("\n");
428
413
  }
429
414
  });
430
- MessagesInHTML.forEach((message) => {
431
- if (!MessageInThisLang.has(message)) {
432
- this.logger.warn(`${message} don't exist in ${localeName}`);
415
+ const MessagesInHTML = /* @__PURE__ */ new Set();
416
+ replaceInFile.sync({
417
+ files: [
418
+ `${this.dist}/addon/**/*.xhtml`,
419
+ `${this.dist}/addon/**/*.html`
420
+ ],
421
+ // @ts-ignore ReplaceInFileConfig has processor
422
+ processor: (input) => {
423
+ const matches = [
424
+ ...input.matchAll(
425
+ new RegExp(`(data-l10n-id)="((?!${this.namespace})\\S*)"`, "g")
426
+ )
427
+ ];
428
+ matches.forEach((match) => {
429
+ const [matched, attrKey, attrVal] = match;
430
+ if (!MessageInThisLang.has(attrVal)) {
431
+ this.logger.warn(`${attrVal} don't exist in ${localeName}`);
432
+ return;
433
+ }
434
+ if (!this.ctx.build.fluent.prefixFluentMessages) {
435
+ return;
436
+ }
437
+ input = input.replace(
438
+ matched,
439
+ `${attrKey}="${this.namespace}-${attrVal}"`
440
+ );
441
+ MessagesInHTML.add(attrVal);
442
+ });
443
+ return input;
433
444
  }
434
445
  });
435
446
  }
@@ -764,7 +775,7 @@ class Serve extends Base {
764
775
  const onChange = debounce({ delay: 500 }, async (path2) => {
765
776
  try {
766
777
  await this.ctx.hooks.callHook("serve:onChanged", this.ctx, path2);
767
- if (path2.endsWith(".ts")) {
778
+ if (path2.endsWith(".ts") || path2.endsWith(".tsx")) {
768
779
  await this.builder.esbuild();
769
780
  } else {
770
781
  await this.builder.run();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zotero-plugin-scaffold",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "A scaffold for Zotero plugin development.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -47,15 +47,15 @@
47
47
  "node": ">=18"
48
48
  },
49
49
  "dependencies": {
50
- "@inquirer/prompts": "5.0.4",
50
+ "@inquirer/prompts": "5.0.6",
51
51
  "bumpp": "9.4.1",
52
- "c12": "1.10.0",
52
+ "c12": "1.11.1",
53
53
  "chalk": "5.3.0",
54
54
  "chokidar": "3.6.0",
55
55
  "commander": "12.1.0",
56
56
  "consola": "3.2.3",
57
57
  "conventional-changelog": "6.0.0",
58
- "esbuild": "0.21.4",
58
+ "esbuild": "0.21.5",
59
59
  "fast-glob": "3.3.2",
60
60
  "fs-extra": "11.2.0",
61
61
  "hookable": "5.5.3",
@@ -71,12 +71,12 @@
71
71
  "@trivago/prettier-plugin-sort-imports": "4.3.0",
72
72
  "@types/conventional-changelog": "3.1.5",
73
73
  "@types/fs-extra": "11.0.4",
74
- "@types/node": "20.12.12",
74
+ "@types/node": "20.14.8",
75
75
  "@types/update-notifier": "6.0.8",
76
- "eslint": "9.3.0",
77
- "prettier": "3.2.5",
78
- "typescript": "5.4.5",
79
- "typescript-eslint": "8.0.0-alpha.20",
76
+ "eslint": "9.5.0",
77
+ "prettier": "3.3.2",
78
+ "typescript": "5.5.2",
79
+ "typescript-eslint": "8.0.0-alpha.30",
80
80
  "unbuild": "2.0.0"
81
81
  },
82
82
  "scripts": {