adnbn 0.0.43 → 0.0.44

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.
Files changed (55) hide show
  1. package/dist/{background-BX-FOksS.d.ts → background-BzgHVate.d.ts} +1 -1
  2. package/dist/{background-Bb-Jb4ux.d.mts → background-DOXP08qy.d.mts} +1 -1
  3. package/dist/browser/index.d.mts +5 -5
  4. package/dist/browser/index.d.ts +5 -5
  5. package/dist/cli/index.cjs +58 -19
  6. package/dist/cli/index.cjs.map +1 -1
  7. package/dist/{command-BS1Gaf2V.d.mts → command-iDG4o_9j.d.mts} +2 -2
  8. package/dist/{command-BMCZquL6.d.ts → command-jc9ZjOVb.d.ts} +2 -2
  9. package/dist/{content-BVHUxFJ7.d.ts → content-BSpM2EOf.d.ts} +1 -1
  10. package/dist/{content-BiaISlC7.d.mts → content-Bq-PFdQ8.d.mts} +1 -1
  11. package/dist/entry/background/index.cjs.map +1 -1
  12. package/dist/entry/background/index.d.mts +3 -3
  13. package/dist/entry/background/index.d.ts +3 -3
  14. package/dist/entry/background/index.js.map +1 -1
  15. package/dist/entry/command/index.cjs.map +1 -1
  16. package/dist/entry/command/index.d.mts +4 -4
  17. package/dist/entry/command/index.d.ts +4 -4
  18. package/dist/entry/command/index.js.map +1 -1
  19. package/dist/entry/content/index.d.mts +2 -2
  20. package/dist/entry/content/index.d.ts +2 -2
  21. package/dist/entry/content/react.cjs.map +1 -1
  22. package/dist/entry/content/react.d.mts +6 -2
  23. package/dist/entry/content/react.d.ts +6 -2
  24. package/dist/entry/content/react.js.map +1 -1
  25. package/dist/entry/content/vanilla.cjs.map +1 -1
  26. package/dist/entry/content/vanilla.d.mts +6 -2
  27. package/dist/entry/content/vanilla.d.ts +6 -2
  28. package/dist/entry/content/vanilla.js.map +1 -1
  29. package/dist/entry/service/index.cjs.map +1 -1
  30. package/dist/entry/service/index.d.mts +4 -4
  31. package/dist/entry/service/index.d.ts +4 -4
  32. package/dist/entry/service/index.js.map +1 -1
  33. package/dist/entry/view/index.d.mts +2 -2
  34. package/dist/entry/view/index.d.ts +2 -2
  35. package/dist/entry/view/react.cjs.map +1 -1
  36. package/dist/entry/view/react.d.mts +7 -2
  37. package/dist/entry/view/react.d.ts +7 -2
  38. package/dist/entry/view/react.js.map +1 -1
  39. package/dist/entry/view/vanilla.cjs.map +1 -1
  40. package/dist/entry/view/vanilla.d.mts +7 -2
  41. package/dist/entry/view/vanilla.d.ts +7 -2
  42. package/dist/entry/view/vanilla.js.map +1 -1
  43. package/dist/{entrypoint-Bozi3iE2.d.mts → entrypoint-D8VDFatw.d.mts} +1 -2
  44. package/dist/{entrypoint-Bozi3iE2.d.ts → entrypoint-D8VDFatw.d.ts} +1 -2
  45. package/dist/index.d.mts +11 -11
  46. package/dist/index.d.ts +11 -11
  47. package/dist/{manifest-BtVC5HMh.d.mts → manifest-D0_7wLt-.d.mts} +3 -3
  48. package/dist/{manifest-BW07GSzr.d.ts → manifest-lcY0-2jY.d.ts} +3 -3
  49. package/dist/service/index.d.mts +4 -4
  50. package/dist/service/index.d.ts +4 -4
  51. package/dist/{service-DQ_4M0d4.d.ts → service-CTejhKtg.d.ts} +2 -2
  52. package/dist/{service-DBsQltUm.d.mts → service-CmreEMMG.d.mts} +2 -2
  53. package/dist/{view-07p9hUFJ.d.ts → view-BTqJnpXV.d.ts} +1 -1
  54. package/dist/{view--Rxg8ghw.d.mts → view-BooU4REd.d.mts} +1 -1
  55. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { E as EntrypointOptions } from './entrypoint-Bozi3iE2.js';
1
+ import { E as EntrypointOptions } from './entrypoint-D8VDFatw.js';
2
2
  import { A as Awaiter } from './helpers-CS2jFMJ_.js';
3
3
 
4
4
  type ManifestPermissions = chrome.runtime.ManifestPermissions;
@@ -1,4 +1,4 @@
1
- import { E as EntrypointOptions } from './entrypoint-Bozi3iE2.mjs';
1
+ import { E as EntrypointOptions } from './entrypoint-D8VDFatw.mjs';
2
2
  import { A as Awaiter } from './helpers-CS2jFMJ_.mjs';
3
3
 
4
4
  type ManifestPermissions = chrome.runtime.ManifestPermissions;
@@ -1,12 +1,12 @@
1
- import { a as ManifestVersion } from '../manifest-BtVC5HMh.mjs';
1
+ import { a as ManifestVersion } from '../manifest-D0_7wLt-.mjs';
2
2
  import { a as MessageDictionary, M as MessageType, d as MessageBody, e as MessageResponse } from '../message-CXzpmlXD.mjs';
3
- import '../content-BiaISlC7.mjs';
3
+ import '../content-Bq-PFdQ8.mjs';
4
4
  import 'react';
5
5
  import 'utility-types';
6
- import '../entrypoint-Bozi3iE2.mjs';
6
+ import '../entrypoint-D8VDFatw.mjs';
7
7
  import '../helpers-CS2jFMJ_.mjs';
8
- import '../background-Bb-Jb4ux.mjs';
9
- import '../command-BS1Gaf2V.mjs';
8
+ import '../background-DOXP08qy.mjs';
9
+ import '../command-iDG4o_9j.mjs';
10
10
  import '../locale-HimfVAcq.mjs';
11
11
 
12
12
  type BadgeBackgroundColorDetails = chrome.browserAction.BadgeBackgroundColorDetails;
@@ -1,12 +1,12 @@
1
- import { a as ManifestVersion } from '../manifest-BW07GSzr.js';
1
+ import { a as ManifestVersion } from '../manifest-lcY0-2jY.js';
2
2
  import { a as MessageDictionary, M as MessageType, d as MessageBody, e as MessageResponse } from '../message-CXzpmlXD.js';
3
- import '../content-BVHUxFJ7.js';
3
+ import '../content-BSpM2EOf.js';
4
4
  import 'react';
5
5
  import 'utility-types';
6
- import '../entrypoint-Bozi3iE2.js';
6
+ import '../entrypoint-D8VDFatw.js';
7
7
  import '../helpers-CS2jFMJ_.js';
8
- import '../background-BX-FOksS.js';
9
- import '../command-BMCZquL6.js';
8
+ import '../background-BzgHVate.js';
9
+ import '../command-jc9ZjOVb.js';
10
10
  import '../locale-HimfVAcq.js';
11
11
 
12
12
  type BadgeBackgroundColorDetails = chrome.browserAction.BadgeBackgroundColorDetails;
@@ -859,7 +859,6 @@ var asset_default = definePlugin(() => {
859
859
  // raw-loader:./background.ts?raw
860
860
  var background_default = `//@ts-ignore
861
861
  import {type BackgroundDefinition} from "adnbn";
862
- //@ts-ignore
863
862
  import background, {isValidBackgroundDefinition, isValidBackgroundMainHandler} from "adnbn/entry/background";
864
863
 
865
864
  import * as module from "virtual:background-entrypoint";
@@ -886,7 +885,6 @@ try {
886
885
  // raw-loader:./command.ts?raw
887
886
  var command_default = `//@ts-ignore
888
887
  import type {CommandUnresolvedDefinition} from "adnbn";
889
- //@ts-ignore
890
888
  import command, {isValidCommandDefinition, isValidCommandExecuteFunction} from "adnbn/entry/command";
891
889
 
892
890
  import * as module from "virtual:command-entrypoint";
@@ -1122,6 +1120,9 @@ var EntrypointFinder_default = class extends OptionsFinder_default {
1122
1120
  canMerge() {
1123
1121
  return false;
1124
1122
  }
1123
+ deepFind() {
1124
+ return false;
1125
+ }
1125
1126
  async getFiles() {
1126
1127
  const entrypoint = this.type();
1127
1128
  let files = /* @__PURE__ */ new Set();
@@ -1174,7 +1175,9 @@ var EntrypointFinder_default = class extends OptionsFinder_default {
1174
1175
  }
1175
1176
  }
1176
1177
  }
1177
- finder(fullPath);
1178
+ if (this.deepFind()) {
1179
+ finder(fullPath);
1180
+ }
1178
1181
  } else if (entry.isFile()) {
1179
1182
  if (this.isValidFilename(entry.name)) {
1180
1183
  files.push(this.file(fullPath));
@@ -1674,13 +1677,14 @@ var EntryFile = class _EntryFile {
1674
1677
 
1675
1678
  // src/cli/entrypoint/parser/drivers/OptionFile.ts
1676
1679
  var OptionFile_default = class extends EntryFile {
1677
- definition = /* @__PURE__ */ new Set();
1680
+ definitions = /* @__PURE__ */ new Set();
1681
+ definition = void 0;
1678
1682
  properties = /* @__PURE__ */ new Set();
1679
1683
  setDefinition(definition) {
1680
1684
  if (_6__default.default.isString(definition)) {
1681
1685
  definition = [definition];
1682
1686
  }
1683
- definition.forEach((definition2) => this.definition.add(definition2));
1687
+ definition.forEach((definition2) => this.definitions.add(definition2));
1684
1688
  return this;
1685
1689
  }
1686
1690
  setProperties(properties) {
@@ -1690,6 +1694,15 @@ var OptionFile_default = class extends EntryFile {
1690
1694
  getOptions() {
1691
1695
  return { ...this.getOptionsFromVariables(), ...this.getOptionsFromDefinition() };
1692
1696
  }
1697
+ getDefinition() {
1698
+ if (this.definition === void 0) {
1699
+ this.getOptionsFromDefinition();
1700
+ }
1701
+ if (this.definition === null) {
1702
+ return;
1703
+ }
1704
+ return this.definition;
1705
+ }
1693
1706
  getOptionsFromVariables() {
1694
1707
  const options = Array.from(this.getVariables().values()).filter(({ name: name2, exported }) => exported && this.properties.has(name2)).reduce((config, { name: name2, value }) => ({ ...config, [name2]: value }), {});
1695
1708
  return options;
@@ -1709,6 +1722,7 @@ var OptionFile_default = class extends EntryFile {
1709
1722
  return _6__default.default.pickBy(options, (_14, key) => this.properties.has(key));
1710
1723
  }
1711
1724
  getExpressionForOptions(expr) {
1725
+ this.definition = null;
1712
1726
  if (ts4__default.default.isObjectLiteralExpression(expr)) {
1713
1727
  return expr;
1714
1728
  } else if ((ts4__default.default.isAsExpression(expr) || ts4__default.default.isSatisfiesExpression(expr)) && ts4__default.default.isObjectLiteralExpression(expr.expression)) {
@@ -1719,9 +1733,10 @@ var OptionFile_default = class extends EntryFile {
1719
1733
  console.warn(`Function ${functionName} is not imported from '${PackageName}' on file ${this.file}`);
1720
1734
  return;
1721
1735
  }
1722
- if (this.definition.has(functionName) && expr.arguments.length > 0) {
1736
+ if (this.definitions.has(functionName) && expr.arguments.length > 0) {
1723
1737
  const arg = expr.arguments[0];
1724
1738
  if (ts4__default.default.isObjectLiteralExpression(arg)) {
1739
+ this.definition = functionName;
1725
1740
  return arg;
1726
1741
  }
1727
1742
  }
@@ -2206,12 +2221,20 @@ var AbstractParser = class {
2206
2221
  includeBrowser: z4.z.array(z4.z.nativeEnum(Browser)).optional(),
2207
2222
  excludeBrowser: z4.z.array(z4.z.nativeEnum(Browser)).optional()
2208
2223
  });
2209
- options(file) {
2210
- const schema = this.schema();
2224
+ optionFile(file) {
2211
2225
  const instance = OptionFile_default.make(file.file);
2212
2226
  instance.setImportResolver(this.ir);
2213
- const options = instance.setProperties(Object.keys(schema.shape)).setDefinition(this.definition()).getOptions();
2214
- const { success, error, data } = schema.safeParse(options);
2227
+ return instance.setProperties(Object.keys(this.schema().shape)).setDefinition(this.definition());
2228
+ }
2229
+ getOptions(file) {
2230
+ const instance = this.optionFile(file);
2231
+ return instance.getOptions();
2232
+ }
2233
+ agreement() {
2234
+ return void 0;
2235
+ }
2236
+ options(file) {
2237
+ const { success, error, data } = this.schema().safeParse(this.getOptions(file));
2215
2238
  if (!success) {
2216
2239
  const e = error == null ? void 0 : error.errors[0];
2217
2240
  if (e) {
@@ -2231,9 +2254,6 @@ var AbstractParser = class {
2231
2254
  instance.setImportResolver(this.ir);
2232
2255
  return instance.setDefinition(this.definition()).setProperty(agreement).getType();
2233
2256
  }
2234
- agreement() {
2235
- return void 0;
2236
- }
2237
2257
  };
2238
2258
 
2239
2259
  // src/cli/entrypoint/parser/BackgroundParser.ts
@@ -2351,6 +2371,9 @@ var modifyLocaleMessageKey = (key) => {
2351
2371
  return key;
2352
2372
  };
2353
2373
 
2374
+ // src/types/command.ts
2375
+ var CommandExecuteActionName = "_execute_action";
2376
+
2354
2377
  // src/cli/entrypoint/parser/CommandParser.ts
2355
2378
  var CommandParser_default = class extends BackgroundParser_default {
2356
2379
  definition() {
@@ -2370,12 +2393,28 @@ var CommandParser_default = class extends BackgroundParser_default {
2370
2393
  });
2371
2394
  }
2372
2395
  options(file) {
2373
- const options = super.options(file);
2396
+ const { defaultKey, windowsKey, macKey, chromeosKey, linuxKey, ...options } = super.options(file);
2397
+ if (!defaultKey && !windowsKey && !macKey && !chromeosKey && !linuxKey) {
2398
+ throw new Error("Invalid command options: At least one suggested key must be defined");
2399
+ }
2374
2400
  return {
2375
2401
  ...options,
2402
+ defaultKey,
2403
+ windowsKey,
2404
+ macKey,
2405
+ chromeosKey,
2406
+ linuxKey,
2376
2407
  description: modifyLocaleMessageKey(options.description)
2377
2408
  };
2378
2409
  }
2410
+ getOptions(file) {
2411
+ const instance = this.optionFile(file);
2412
+ const options = instance.getOptions();
2413
+ if (instance.getDefinition() === "defineExecuteActionCommand") {
2414
+ return { ...options, name: CommandExecuteActionName };
2415
+ }
2416
+ return options;
2417
+ }
2379
2418
  };
2380
2419
  var ContentParser_default = class extends AbstractParser {
2381
2420
  definition() {
@@ -4089,9 +4128,6 @@ var config_default = async (config) => {
4089
4128
  };
4090
4129
  };
4091
4130
 
4092
- // src/types/command.ts
4093
- var CommandExecuteActionName = "_execute_action";
4094
-
4095
4131
  // src/cli/builders/manifest/ManifestBase.ts
4096
4132
  var ManifestError = class extends Error {
4097
4133
  constructor(message) {
@@ -4222,7 +4258,7 @@ var ManifestBase_default = class {
4222
4258
  chromeos: command == null ? void 0 : command.chromeosKey,
4223
4259
  linux: command == null ? void 0 : command.linuxKey
4224
4260
  },
4225
- description: (command == null ? void 0 : command.description) || command.name,
4261
+ description: (command == null ? void 0 : command.description) || (command.name === CommandExecuteActionName ? void 0 : command.name),
4226
4262
  global: command == null ? void 0 : command.global
4227
4263
  };
4228
4264
  return { ...commands2, [command.name]: item };
@@ -4459,6 +4495,9 @@ var bundler_default = async (config) => {
4459
4495
  uniqueName: config.app
4460
4496
  },
4461
4497
  optimization: {
4498
+ usedExports: true,
4499
+ providedExports: true,
4500
+ sideEffects: true,
4462
4501
  splitChunks: {
4463
4502
  minSize: 10,
4464
4503
  cacheGroups: {
@@ -4538,7 +4577,7 @@ var app_default = async (config) => {
4538
4577
 
4539
4578
  // package.json
4540
4579
  var name = "adnbn";
4541
- var version = "0.0.42";
4580
+ var version = "0.0.43";
4542
4581
 
4543
4582
  // src/cli/index.ts
4544
4583
  var cli = cac__default.default(name);