@sentry/junior 0.63.0 → 0.64.0

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.
@@ -0,0 +1,104 @@
1
+ // src/plugins.ts
2
+ function cloneManifests(manifests) {
3
+ return manifests ? structuredClone(manifests) : void 0;
4
+ }
5
+ function cloneInlineManifests(registrations) {
6
+ const inlineManifests = registrations.flatMap(
7
+ (plugin) => plugin.manifest ? [
8
+ {
9
+ manifest: {
10
+ ...structuredClone(plugin.manifest),
11
+ capabilities: plugin.manifest.capabilities?.map(
12
+ (capability) => capability.includes(".") ? capability : `${plugin.manifest.name}.${capability}`
13
+ ) ?? [],
14
+ configKeys: plugin.manifest.configKeys?.map(
15
+ (key) => key.includes(".") ? key : `${plugin.manifest.name}.${key}`
16
+ ) ?? [],
17
+ ...plugin.manifest.target ? {
18
+ target: {
19
+ ...plugin.manifest.target,
20
+ configKey: plugin.manifest.target.configKey.includes(".") ? plugin.manifest.target.configKey : `${plugin.manifest.name}.${plugin.manifest.target.configKey}`
21
+ }
22
+ } : {}
23
+ },
24
+ ...plugin.packageName ? { packageName: plugin.packageName } : {}
25
+ }
26
+ ] : []
27
+ );
28
+ return inlineManifests.length > 0 ? inlineManifests : void 0;
29
+ }
30
+ function assertUniquePluginNames(registrations) {
31
+ const seen = /* @__PURE__ */ new Set();
32
+ for (const plugin of registrations) {
33
+ if (seen.has(plugin.name)) {
34
+ throw new Error(`Duplicate plugin registration name "${plugin.name}"`);
35
+ }
36
+ seen.add(plugin.name);
37
+ }
38
+ }
39
+ function assertUniquePackageNames(packageNames) {
40
+ const seen = /* @__PURE__ */ new Set();
41
+ for (const packageName of packageNames) {
42
+ if (seen.has(packageName)) {
43
+ throw new Error(`Duplicate plugin package name "${packageName}"`);
44
+ }
45
+ seen.add(packageName);
46
+ }
47
+ }
48
+ function normalizePluginInput(input) {
49
+ if (typeof input === "string") {
50
+ return { packageName: input };
51
+ }
52
+ return { registration: input };
53
+ }
54
+ function defineJuniorPlugins(inputs, options = {}) {
55
+ const normalized = inputs.map(normalizePluginInput);
56
+ const packageNames = normalized.flatMap(
57
+ (input) => input.packageName ? [input.packageName] : []
58
+ );
59
+ const registrations = normalized.flatMap(
60
+ (input) => input.registration ? [input.registration] : []
61
+ );
62
+ assertUniquePackageNames(packageNames);
63
+ assertUniquePluginNames(registrations);
64
+ const manifests = cloneManifests(options.manifests);
65
+ return {
66
+ packageNames,
67
+ registrations: registrations.map((plugin) => ({ ...plugin })),
68
+ ...manifests ? { manifests } : {}
69
+ };
70
+ }
71
+ function pluginCatalogConfigFromPluginSet(pluginSet) {
72
+ if (!pluginSet) {
73
+ return void 0;
74
+ }
75
+ const packages = [
76
+ .../* @__PURE__ */ new Set([
77
+ ...pluginSet.packageNames,
78
+ ...pluginSet.registrations.flatMap(
79
+ (plugin) => plugin.packageName ? [plugin.packageName] : []
80
+ )
81
+ ])
82
+ ];
83
+ const manifests = cloneManifests(pluginSet.manifests);
84
+ const inlineManifests = cloneInlineManifests(pluginSet.registrations);
85
+ if (packages.length === 0 && !manifests && !inlineManifests) {
86
+ return void 0;
87
+ }
88
+ return {
89
+ ...inlineManifests ? { inlineManifests } : {},
90
+ ...packages.length > 0 ? { packages } : {},
91
+ ...manifests ? { manifests } : {}
92
+ };
93
+ }
94
+ function trustedPluginRegistrationsFromPluginSet(pluginSet) {
95
+ return pluginSet?.registrations.filter(
96
+ (plugin) => plugin.hooks || plugin.legacyStatePrefixes
97
+ ) ?? [];
98
+ }
99
+
100
+ export {
101
+ defineJuniorPlugins,
102
+ pluginCatalogConfigFromPluginSet,
103
+ trustedPluginRegistrationsFromPluginSet
104
+ };
@@ -2,10 +2,10 @@ import {
2
2
  getPluginForSkillPath,
3
3
  getPluginSkillRoots,
4
4
  logWarn
5
- } from "./chunk-H652GMDH.js";
5
+ } from "./chunk-WDPWFMCE.js";
6
6
  import {
7
7
  skillRoots
8
- } from "./chunk-5LUISFEY.js";
8
+ } from "./chunk-KVZL5NZS.js";
9
9
 
10
10
  // src/chat/skills.ts
11
11
  import fs from "fs/promises";
@@ -6,7 +6,7 @@ import {
6
6
  setSpanAttributes,
7
7
  toOptionalString,
8
8
  withSpan
9
- } from "./chunk-H652GMDH.js";
9
+ } from "./chunk-WDPWFMCE.js";
10
10
 
11
11
  // src/chat/slack/context.ts
12
12
  function toTrimmedSlackString(value) {
@@ -383,7 +383,7 @@ function normalizePluginPackageNames(packageNames) {
383
383
  return [];
384
384
  }
385
385
  if (!Array.isArray(packageNames)) {
386
- throw new Error("plugins.packages must be an array of package names");
386
+ throw new Error("Plugin package names must be an array");
387
387
  }
388
388
  const normalized = [];
389
389
  const seen = /* @__PURE__ */ new Set();
@@ -494,6 +494,11 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
494
494
  packageNames: uniqueStringsInOrder(
495
495
  discoveredPackages.map((pkg) => pkg.name)
496
496
  ),
497
+ packages: discoveredPackages.map((pkg) => ({
498
+ dir: pkg.dir,
499
+ hasSkillsDir: pkg.hasSkillsDir,
500
+ name: pkg.name
501
+ })),
497
502
  manifestRoots: uniqueStringsInOrder(manifestRoots),
498
503
  skillRoots: uniqueStringsInOrder(skillRoots2),
499
504
  tracingIncludes: uniqueStringsInOrder(tracingIncludes)