@sentry/junior 0.13.0 → 0.14.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.
- package/README.md +1 -1
- package/dist/app.js +5 -13
- package/dist/{chunk-WZXIUH5S.js → chunk-5JHLDXBN.js} +1 -1
- package/dist/{chunk-C4N7XWDT.js → chunk-ESPIOJPM.js} +1 -1
- package/dist/{chunk-7YFFZCL4.js → chunk-KTBQH6L5.js} +2 -2
- package/dist/{chunk-XH7TV4JS.js → chunk-RBB2MZAN.js} +22 -240
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +10 -4
- package/dist/cli/snapshot-warmup.js +3 -3
- package/dist/nitro.d.ts +7 -21
- package/dist/nitro.js +27 -24
- package/dist/vercel.js +3 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ export default app;
|
|
|
25
25
|
|
|
26
26
|
Run `junior init my-bot` to scaffold a complete project including `vercel.json` for Vercel deployment.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Use `createApp({ pluginPackages: [...] })` to declare which plugin packages to load at runtime.
|
|
29
29
|
|
|
30
30
|
## Full docs
|
|
31
31
|
|
package/dist/app.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
logCapabilityCatalogLoadedOnce,
|
|
8
8
|
parseSkillInvocation,
|
|
9
9
|
stripFrontmatter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KTBQH6L5.js";
|
|
11
11
|
import {
|
|
12
12
|
SANDBOX_SKILLS_ROOT,
|
|
13
13
|
SANDBOX_WORKSPACE_ROOT,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runNonInteractiveCommand,
|
|
27
27
|
sandboxSkillDir,
|
|
28
28
|
toOptionalTrimmed
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-ESPIOJPM.js";
|
|
30
30
|
import {
|
|
31
31
|
CredentialUnavailableError,
|
|
32
32
|
buildOAuthTokenRequest,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
toOptionalString,
|
|
55
55
|
withContext,
|
|
56
56
|
withSpan
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-5JHLDXBN.js";
|
|
58
58
|
import "./chunk-Z3YD6NHK.js";
|
|
59
59
|
import {
|
|
60
60
|
aboutPathCandidates,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
homeDir,
|
|
63
63
|
setPluginPackages,
|
|
64
64
|
soulPathCandidates
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-RBB2MZAN.js";
|
|
66
66
|
import "./chunk-2KG3PWR4.js";
|
|
67
67
|
|
|
68
68
|
// src/app.ts
|
|
@@ -11846,12 +11846,6 @@ function createReplyToThread(deps) {
|
|
|
11846
11846
|
}
|
|
11847
11847
|
} else {
|
|
11848
11848
|
await streamedReplyPromise;
|
|
11849
|
-
if (reply.diagnostics.outcome !== "success" && reply.text.trim().length > 0) {
|
|
11850
|
-
await postThreadReply(
|
|
11851
|
-
buildSlackOutputMessage(reply.text),
|
|
11852
|
-
"thread_reply_after_stream_failure"
|
|
11853
|
-
);
|
|
11854
|
-
}
|
|
11855
11849
|
}
|
|
11856
11850
|
}
|
|
11857
11851
|
const shouldPersistArtifacts = Object.keys(artifactStatePatch).length > 0;
|
|
@@ -12767,9 +12761,7 @@ async function createApp(options) {
|
|
|
12767
12761
|
return c.text("Internal Server Error", 500);
|
|
12768
12762
|
});
|
|
12769
12763
|
app.get("/health", () => GET2());
|
|
12770
|
-
|
|
12771
|
-
app.get("/__junior/discovery", () => GET());
|
|
12772
|
-
}
|
|
12764
|
+
app.get("/__junior/discovery", () => GET());
|
|
12773
12765
|
app.get("/oauth/callback/mcp/:provider", (c) => {
|
|
12774
12766
|
return GET3(c.req.raw, c.req.param("provider"), waitUntil);
|
|
12775
12767
|
});
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
getPluginSkillRoots,
|
|
6
6
|
logInfo,
|
|
7
7
|
logWarn
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5JHLDXBN.js";
|
|
9
9
|
import {
|
|
10
10
|
skillRoots
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RBB2MZAN.js";
|
|
12
12
|
|
|
13
13
|
// src/chat/skills.ts
|
|
14
14
|
import fs from "fs/promises";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// src/chat/plugins/package-discovery.ts
|
|
2
|
-
import { readFileSync, readdirSync as readdirSync2 } from "fs";
|
|
3
2
|
import path2 from "path";
|
|
4
|
-
import { parse as parseYaml } from "yaml";
|
|
5
3
|
|
|
6
4
|
// src/chat/discovery.ts
|
|
7
|
-
import fs, {
|
|
5
|
+
import fs, { statSync } from "fs";
|
|
8
6
|
import path from "path";
|
|
9
7
|
import { fileURLToPath } from "url";
|
|
10
8
|
function isDirectory(targetPath) {
|
|
@@ -103,37 +101,6 @@ function discoverProjectRoots(cwd = process.cwd(), options) {
|
|
|
103
101
|
).map((nodeModulesDir) => path.dirname(nodeModulesDir));
|
|
104
102
|
return uniqueResolvedPathsInOrder([cwd, ...roots]);
|
|
105
103
|
}
|
|
106
|
-
function listTopLevelPackages(nodeModulesDir) {
|
|
107
|
-
const entries = readdirSync(nodeModulesDir, { withFileTypes: true }).filter(
|
|
108
|
-
(entry) => !entry.name.startsWith(".") && entry.name !== ".bin" && entry.name !== ".pnpm"
|
|
109
|
-
).sort((left, right) => left.name.localeCompare(right.name));
|
|
110
|
-
const packages = [];
|
|
111
|
-
for (const entry of entries) {
|
|
112
|
-
const entryPath = path.join(nodeModulesDir, entry.name);
|
|
113
|
-
if (entry.name.startsWith("@")) {
|
|
114
|
-
if (!isDirectory(entryPath)) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
const scopedEntries = readdirSync(entryPath, {
|
|
118
|
-
withFileTypes: true
|
|
119
|
-
}).sort((left, right) => left.name.localeCompare(right.name));
|
|
120
|
-
for (const scopedEntry of scopedEntries) {
|
|
121
|
-
const packageName = `${entry.name}/${scopedEntry.name}`;
|
|
122
|
-
const packagePath = path.join(entryPath, scopedEntry.name);
|
|
123
|
-
if (!isDirectory(packagePath)) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
packages.push({ name: packageName, dir: packagePath });
|
|
127
|
-
}
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
if (!isDirectory(entryPath)) {
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
packages.push({ name: entry.name, dir: entryPath });
|
|
134
|
-
}
|
|
135
|
-
return packages;
|
|
136
|
-
}
|
|
137
104
|
function unique(values) {
|
|
138
105
|
return [...new Set(values)];
|
|
139
106
|
}
|
|
@@ -260,93 +227,21 @@ function pathForTracingInclude(cwd, targetPath) {
|
|
|
260
227
|
const normalized = normalizeForGlob(relative);
|
|
261
228
|
return normalized.startsWith(".") ? normalized : `./${normalized}`;
|
|
262
229
|
}
|
|
263
|
-
function parseRuntimeConfiguredPackageNames(value) {
|
|
264
|
-
if (!Array.isArray(value)) {
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
const parsed = value.filter(
|
|
268
|
-
(entry) => typeof entry === "string" && entry.trim().length > 0
|
|
269
|
-
);
|
|
270
|
-
return uniqueStringsInOrder(parsed.map((entry) => entry.trim()));
|
|
271
|
-
}
|
|
272
230
|
var configuredPluginPackages;
|
|
273
231
|
function setPluginPackages(packages) {
|
|
274
232
|
configuredPluginPackages = packages;
|
|
275
233
|
}
|
|
276
|
-
function
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
try {
|
|
285
|
-
return parseRuntimeConfiguredPackageNames(JSON.parse(raw)) ?? [];
|
|
286
|
-
} catch {
|
|
287
|
-
return [];
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
function findWorkspaceRoot(cwd) {
|
|
291
|
-
let current = path2.resolve(cwd);
|
|
292
|
-
while (true) {
|
|
293
|
-
const candidate = path2.join(current, "pnpm-workspace.yaml");
|
|
294
|
-
if (isFile(candidate)) {
|
|
295
|
-
return current;
|
|
296
|
-
}
|
|
297
|
-
const parent = path2.dirname(current);
|
|
298
|
-
if (parent === current) {
|
|
299
|
-
return null;
|
|
300
|
-
}
|
|
301
|
-
current = parent;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
function listWorkspacePackageDirs(cwd) {
|
|
305
|
-
const workspaceRoot = findWorkspaceRoot(cwd);
|
|
306
|
-
if (!workspaceRoot) {
|
|
307
|
-
return [];
|
|
308
|
-
}
|
|
309
|
-
let packagePatterns = [];
|
|
310
|
-
try {
|
|
311
|
-
const raw = readFileSync(
|
|
312
|
-
path2.join(workspaceRoot, "pnpm-workspace.yaml"),
|
|
313
|
-
"utf8"
|
|
314
|
-
);
|
|
315
|
-
const parsed = parseYaml(raw);
|
|
316
|
-
packagePatterns = Array.isArray(parsed.packages) ? parsed.packages.filter(
|
|
317
|
-
(entry) => typeof entry === "string" && entry.trim().length > 0
|
|
318
|
-
) : [];
|
|
319
|
-
} catch {
|
|
320
|
-
return [];
|
|
321
|
-
}
|
|
322
|
-
const discovered = [];
|
|
323
|
-
const seen = /* @__PURE__ */ new Set();
|
|
324
|
-
const addDir = (candidate) => {
|
|
325
|
-
const normalized = path2.resolve(candidate);
|
|
326
|
-
if (seen.has(normalized) || !isDirectory(normalized)) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
seen.add(normalized);
|
|
330
|
-
discovered.push(normalized);
|
|
331
|
-
};
|
|
332
|
-
for (const pattern of packagePatterns) {
|
|
333
|
-
const trimmed = pattern.trim();
|
|
334
|
-
if (!trimmed) {
|
|
335
|
-
continue;
|
|
336
|
-
}
|
|
337
|
-
if (trimmed.endsWith("/*")) {
|
|
338
|
-
const baseDir = path2.join(workspaceRoot, trimmed.slice(0, -2));
|
|
339
|
-
if (!isDirectory(baseDir)) {
|
|
340
|
-
continue;
|
|
341
|
-
}
|
|
342
|
-
for (const entry of readdirSync2(baseDir)) {
|
|
343
|
-
addDir(path2.join(baseDir, entry));
|
|
344
|
-
}
|
|
345
|
-
continue;
|
|
234
|
+
function resolvePackageDirFromName(packageName, candidateNodeModulesDirs) {
|
|
235
|
+
for (const nodeModulesDir of candidateNodeModulesDirs) {
|
|
236
|
+
const packageDir = path2.join(nodeModulesDir, ...packageName.split("/"));
|
|
237
|
+
if (isDirectory(packageDir)) {
|
|
238
|
+
return {
|
|
239
|
+
dir: path2.resolve(packageDir),
|
|
240
|
+
nodeModulesDir: path2.resolve(nodeModulesDir)
|
|
241
|
+
};
|
|
346
242
|
}
|
|
347
|
-
addDir(path2.join(workspaceRoot, trimmed));
|
|
348
243
|
}
|
|
349
|
-
return
|
|
244
|
+
return null;
|
|
350
245
|
}
|
|
351
246
|
function readPluginPackageFlags(dir) {
|
|
352
247
|
const hasRootPluginManifest = isFile(path2.join(dir, "plugin.yaml"));
|
|
@@ -361,45 +256,7 @@ function readPluginPackageFlags(dir) {
|
|
|
361
256
|
hasSkillsDir
|
|
362
257
|
};
|
|
363
258
|
}
|
|
364
|
-
function
|
|
365
|
-
if (packageNames !== null) {
|
|
366
|
-
return [];
|
|
367
|
-
}
|
|
368
|
-
return listWorkspacePackageDirs(cwd).filter(
|
|
369
|
-
(candidate) => readPluginPackageFlags(candidate) !== null
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
function readWorkspacePackageName(dir) {
|
|
373
|
-
try {
|
|
374
|
-
const raw = readFileSync(path2.join(dir, "package.json"), "utf8");
|
|
375
|
-
const name = JSON.parse(raw).name;
|
|
376
|
-
return typeof name === "string" && name.trim().length > 0 ? name : null;
|
|
377
|
-
} catch {
|
|
378
|
-
return null;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
function resolveWorkspacePackageDirFromName(cwd, packageName) {
|
|
382
|
-
for (const candidate of listWorkspacePackageDirs(cwd)) {
|
|
383
|
-
if (readWorkspacePackageName(candidate) !== packageName) {
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
return candidate;
|
|
387
|
-
}
|
|
388
|
-
return null;
|
|
389
|
-
}
|
|
390
|
-
function resolvePackageDirFromName(packageName, candidateNodeModulesDirs) {
|
|
391
|
-
for (const nodeModulesDir of candidateNodeModulesDirs) {
|
|
392
|
-
const packageDir = path2.join(nodeModulesDir, ...packageName.split("/"));
|
|
393
|
-
if (isDirectory(packageDir)) {
|
|
394
|
-
return {
|
|
395
|
-
dir: path2.resolve(packageDir),
|
|
396
|
-
nodeModulesDir: path2.resolve(nodeModulesDir)
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
return null;
|
|
401
|
-
}
|
|
402
|
-
function discoverDeclaredPackages(cwd, packageNames, candidateNodeModulesDirs) {
|
|
259
|
+
function discoverDeclaredPackages(packageNames, candidateNodeModulesDirs) {
|
|
403
260
|
const discovered = [];
|
|
404
261
|
const seenPackageNames = /* @__PURE__ */ new Set();
|
|
405
262
|
const seenPackageDirs = /* @__PURE__ */ new Set();
|
|
@@ -408,88 +265,34 @@ function discoverDeclaredPackages(cwd, packageNames, candidateNodeModulesDirs) {
|
|
|
408
265
|
packageName,
|
|
409
266
|
candidateNodeModulesDirs
|
|
410
267
|
);
|
|
411
|
-
|
|
412
|
-
if (!resolved && !workspaceDir) {
|
|
268
|
+
if (!resolved) {
|
|
413
269
|
continue;
|
|
414
270
|
}
|
|
415
|
-
|
|
416
|
-
if (seenPackageNames.has(packageName) || seenPackageDirs.has(packageDir)) {
|
|
271
|
+
if (seenPackageNames.has(packageName) || seenPackageDirs.has(resolved.dir)) {
|
|
417
272
|
continue;
|
|
418
273
|
}
|
|
419
|
-
const pluginFlags = readPluginPackageFlags(
|
|
274
|
+
const pluginFlags = readPluginPackageFlags(resolved.dir);
|
|
420
275
|
if (!pluginFlags) {
|
|
421
276
|
continue;
|
|
422
277
|
}
|
|
423
278
|
seenPackageNames.add(packageName);
|
|
424
|
-
seenPackageDirs.add(
|
|
279
|
+
seenPackageDirs.add(resolved.dir);
|
|
425
280
|
discovered.push({
|
|
426
281
|
name: packageName,
|
|
427
|
-
dir:
|
|
428
|
-
nodeModulesDir: resolved
|
|
282
|
+
dir: resolved.dir,
|
|
283
|
+
nodeModulesDir: resolved.nodeModulesDir,
|
|
429
284
|
...pluginFlags
|
|
430
285
|
});
|
|
431
286
|
}
|
|
432
287
|
return discovered;
|
|
433
288
|
}
|
|
434
|
-
function discoverInstalledJuniorContentPackages(cwd = process.cwd(), nodeModulesDirs, packageNames) {
|
|
435
|
-
const resolvedCwd = path2.resolve(cwd);
|
|
436
|
-
const candidateNodeModulesDirs = nodeModulesDirs ?? discoverNodeModulesDirs(resolvedCwd);
|
|
437
|
-
const configuredPackageNames = packageNames ?? readNextRuntimeConfiguredPackageNames();
|
|
438
|
-
const declaredPackages = discoverDeclaredPackages(
|
|
439
|
-
resolvedCwd,
|
|
440
|
-
configuredPackageNames ?? [],
|
|
441
|
-
candidateNodeModulesDirs
|
|
442
|
-
);
|
|
443
|
-
const useFallbackScan = configuredPackageNames === null;
|
|
444
|
-
const discovered = [...declaredPackages];
|
|
445
|
-
const seenPackageNames = /* @__PURE__ */ new Set();
|
|
446
|
-
const seenPackageDirs = /* @__PURE__ */ new Set();
|
|
447
|
-
for (const pkg of declaredPackages) {
|
|
448
|
-
seenPackageNames.add(pkg.name);
|
|
449
|
-
seenPackageDirs.add(pkg.dir);
|
|
450
|
-
}
|
|
451
|
-
if (!useFallbackScan) {
|
|
452
|
-
return discovered;
|
|
453
|
-
}
|
|
454
|
-
for (const nodeModulesDir of candidateNodeModulesDirs) {
|
|
455
|
-
for (const pkg of listTopLevelPackages(nodeModulesDir)) {
|
|
456
|
-
const resolvedDir = path2.resolve(pkg.dir);
|
|
457
|
-
if (seenPackageNames.has(pkg.name) || seenPackageDirs.has(resolvedDir)) {
|
|
458
|
-
continue;
|
|
459
|
-
}
|
|
460
|
-
seenPackageNames.add(pkg.name);
|
|
461
|
-
seenPackageDirs.add(resolvedDir);
|
|
462
|
-
const hasRootPluginManifest = isFile(
|
|
463
|
-
path2.join(resolvedDir, "plugin.yaml")
|
|
464
|
-
);
|
|
465
|
-
const hasPluginsDir = isDirectory(path2.join(resolvedDir, "plugins"));
|
|
466
|
-
const hasSkillsDir = isDirectory(path2.join(resolvedDir, "skills"));
|
|
467
|
-
if (!hasRootPluginManifest && !hasPluginsDir && !hasSkillsDir) {
|
|
468
|
-
continue;
|
|
469
|
-
}
|
|
470
|
-
discovered.push({
|
|
471
|
-
name: pkg.name,
|
|
472
|
-
dir: resolvedDir,
|
|
473
|
-
nodeModulesDir: path2.resolve(nodeModulesDir),
|
|
474
|
-
hasRootPluginManifest,
|
|
475
|
-
hasPluginsDir,
|
|
476
|
-
hasSkillsDir
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
return discovered;
|
|
481
|
-
}
|
|
482
289
|
function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
483
290
|
const resolvedCwd = path2.resolve(cwd);
|
|
484
|
-
const
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
);
|
|
490
|
-
const workspacePluginDirs = discoverWorkspacePluginPackageDirs(
|
|
491
|
-
resolvedCwd,
|
|
492
|
-
configuredPackageNames
|
|
291
|
+
const packageNames = options?.packageNames ?? configuredPluginPackages ?? [];
|
|
292
|
+
const nodeModulesDirs = options?.nodeModulesDirs ?? discoverNodeModulesDirs(resolvedCwd);
|
|
293
|
+
const discoveredPackages = discoverDeclaredPackages(
|
|
294
|
+
packageNames,
|
|
295
|
+
nodeModulesDirs
|
|
493
296
|
);
|
|
494
297
|
const manifestRoots = [];
|
|
495
298
|
const skillRoots2 = [];
|
|
@@ -518,27 +321,6 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
518
321
|
}
|
|
519
322
|
}
|
|
520
323
|
}
|
|
521
|
-
for (const pluginDir of workspacePluginDirs) {
|
|
522
|
-
const tracingBasePath = pathForTracingInclude(resolvedCwd, pluginDir);
|
|
523
|
-
if (isFile(path2.join(pluginDir, "plugin.yaml"))) {
|
|
524
|
-
manifestRoots.push(pluginDir);
|
|
525
|
-
if (tracingBasePath) {
|
|
526
|
-
tracingIncludes.push(`${tracingBasePath}/plugin.yaml`);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
if (isDirectory(path2.join(pluginDir, "plugins"))) {
|
|
530
|
-
manifestRoots.push(path2.join(pluginDir, "plugins"));
|
|
531
|
-
if (tracingBasePath) {
|
|
532
|
-
tracingIncludes.push(`${tracingBasePath}/plugins/**/*`);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
if (isDirectory(path2.join(pluginDir, "skills"))) {
|
|
536
|
-
skillRoots2.push(path2.join(pluginDir, "skills"));
|
|
537
|
-
if (tracingBasePath) {
|
|
538
|
-
tracingIncludes.push(`${tracingBasePath}/skills/**/*`);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
324
|
return {
|
|
543
325
|
packageNames: uniqueStringsInOrder(
|
|
544
326
|
discoveredPackages.map((pkg) => pkg.name)
|
package/dist/cli/check.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSkillFile
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-KTBQH6L5.js";
|
|
4
4
|
import {
|
|
5
5
|
parsePluginManifest
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-5JHLDXBN.js";
|
|
7
7
|
import "../chunk-Z3YD6NHK.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-RBB2MZAN.js";
|
|
9
9
|
import "../chunk-2KG3PWR4.js";
|
|
10
10
|
|
|
11
11
|
// src/cli/check.ts
|
package/dist/cli/init.js
CHANGED
|
@@ -20,10 +20,16 @@ export default app;
|
|
|
20
20
|
function writeNitroConfig(targetDir) {
|
|
21
21
|
fs.writeFileSync(
|
|
22
22
|
path.join(targetDir, "nitro.config.ts"),
|
|
23
|
-
`import {
|
|
24
|
-
import {
|
|
23
|
+
`import { defineConfig } from "nitro";
|
|
24
|
+
import { juniorNitro } from "@sentry/junior/nitro";
|
|
25
25
|
|
|
26
|
-
export default defineConfig(
|
|
26
|
+
export default defineConfig({
|
|
27
|
+
preset: "vercel",
|
|
28
|
+
modules: [juniorNitro()],
|
|
29
|
+
routes: {
|
|
30
|
+
"/api/**": { handler: "./server.ts" },
|
|
31
|
+
},
|
|
32
|
+
});
|
|
27
33
|
`
|
|
28
34
|
);
|
|
29
35
|
}
|
|
@@ -45,7 +51,7 @@ export default defineConfig({
|
|
|
45
51
|
function writeVercelJson(targetDir) {
|
|
46
52
|
fs.writeFileSync(
|
|
47
53
|
path.join(targetDir, "vercel.json"),
|
|
48
|
-
`${JSON.stringify({ buildCommand: "pnpm build" }, null, 2)}
|
|
54
|
+
`${JSON.stringify({ framework: "nitro", buildCommand: "pnpm build" }, null, 2)}
|
|
49
55
|
`
|
|
50
56
|
);
|
|
51
57
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
disconnectStateAdapter,
|
|
3
3
|
resolveRuntimeDependencySnapshot
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-ESPIOJPM.js";
|
|
5
5
|
import {
|
|
6
6
|
getPluginProviders,
|
|
7
7
|
getPluginRuntimeDependencies,
|
|
8
8
|
getPluginRuntimePostinstall
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-5JHLDXBN.js";
|
|
10
10
|
import "../chunk-Z3YD6NHK.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-RBB2MZAN.js";
|
|
12
12
|
import "../chunk-2KG3PWR4.js";
|
|
13
13
|
|
|
14
14
|
// src/cli/snapshot-warmup.ts
|
package/dist/nitro.d.ts
CHANGED
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface JuniorNitroOptions {
|
|
2
2
|
cwd?: string;
|
|
3
3
|
maxDuration?: number;
|
|
4
|
+
pluginPackages?: string[];
|
|
4
5
|
}
|
|
5
|
-
/**
|
|
6
|
-
declare function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
functions: {
|
|
10
|
-
maxDuration: number;
|
|
11
|
-
};
|
|
6
|
+
/** Nitro module that copies app and plugin content into the Vercel build output. */
|
|
7
|
+
declare function juniorNitro(options?: JuniorNitroOptions): {
|
|
8
|
+
nitro: {
|
|
9
|
+
setup(nitro: unknown): void;
|
|
12
10
|
};
|
|
13
|
-
modules: {
|
|
14
|
-
setup(nitro: {
|
|
15
|
-
hooks: {
|
|
16
|
-
hook(name: "compiled", callback: () => void): void;
|
|
17
|
-
};
|
|
18
|
-
options: {
|
|
19
|
-
output: {
|
|
20
|
-
serverDir: string;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
}): void;
|
|
24
|
-
}[];
|
|
25
11
|
};
|
|
26
12
|
|
|
27
|
-
export { type
|
|
13
|
+
export { type JuniorNitroOptions, juniorNitro };
|
package/dist/nitro.js
CHANGED
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
discoverInstalledPluginPackageContent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RBB2MZAN.js";
|
|
4
4
|
import "./chunk-2KG3PWR4.js";
|
|
5
5
|
|
|
6
6
|
// src/nitro.ts
|
|
7
7
|
import { cpSync, existsSync, mkdirSync } from "fs";
|
|
8
8
|
import path from "path";
|
|
9
|
-
function
|
|
9
|
+
function juniorNitro(options = {}) {
|
|
10
|
+
return {
|
|
11
|
+
nitro: {
|
|
12
|
+
setup(nitro) {
|
|
13
|
+
const cwd = path.resolve(
|
|
14
|
+
options.cwd ?? nitro.options.rootDir ?? process.cwd()
|
|
15
|
+
);
|
|
16
|
+
nitro.options.vercel ??= {};
|
|
17
|
+
nitro.options.vercel.functions ??= {};
|
|
18
|
+
nitro.options.vercel.functions.maxDuration ??= options.maxDuration ?? 800;
|
|
19
|
+
nitro.hooks.hook("compiled", () => {
|
|
20
|
+
copyAppAndPluginContent(
|
|
21
|
+
cwd,
|
|
22
|
+
nitro.options.output.serverDir,
|
|
23
|
+
options.pluginPackages
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function copyAppAndPluginContent(cwd, serverRoot, pluginPackages) {
|
|
10
31
|
copyIfExists(path.join(cwd, "app"), path.join(serverRoot, "app"));
|
|
11
|
-
const packagedContent = discoverInstalledPluginPackageContent(cwd
|
|
32
|
+
const packagedContent = discoverInstalledPluginPackageContent(cwd, {
|
|
33
|
+
packageNames: pluginPackages
|
|
34
|
+
});
|
|
12
35
|
for (const root of packagedContent.manifestRoots) {
|
|
13
36
|
if (existsSync(path.join(root, "plugin.yaml"))) {
|
|
14
37
|
const relative = path.relative(cwd, root);
|
|
@@ -41,26 +64,6 @@ function copyRootIntoServerOutput(cwd, serverRoot, root) {
|
|
|
41
64
|
}
|
|
42
65
|
copyIfExists(root, path.join(serverRoot, relative));
|
|
43
66
|
}
|
|
44
|
-
function juniorNitroConfig(options = {}) {
|
|
45
|
-
const cwd = path.resolve(options.cwd ?? process.cwd());
|
|
46
|
-
return {
|
|
47
|
-
preset: "vercel",
|
|
48
|
-
vercel: {
|
|
49
|
-
functions: {
|
|
50
|
-
maxDuration: options.maxDuration ?? 800
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
modules: [
|
|
54
|
-
{
|
|
55
|
-
setup(nitro) {
|
|
56
|
-
nitro.hooks.hook("compiled", () => {
|
|
57
|
-
copyAppAndPluginContent(cwd, nitro.options.output.serverDir);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
67
|
export {
|
|
65
|
-
|
|
68
|
+
juniorNitro
|
|
66
69
|
};
|
package/dist/vercel.js
CHANGED
|
@@ -3,7 +3,9 @@ import "./chunk-2KG3PWR4.js";
|
|
|
3
3
|
// src/vercel.ts
|
|
4
4
|
function juniorVercelConfig(options = {}) {
|
|
5
5
|
const buildCommand = options.buildCommand === void 0 ? "pnpm build" : options.buildCommand;
|
|
6
|
-
const config = {
|
|
6
|
+
const config = {
|
|
7
|
+
framework: "nitro"
|
|
8
|
+
};
|
|
7
9
|
if (buildCommand !== null) {
|
|
8
10
|
config.buildCommand = buildCommand;
|
|
9
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"@sentry/node": "^10.46.0",
|
|
48
48
|
"@types/node": "^25.5.0",
|
|
49
49
|
"msw": "^2.12.14",
|
|
50
|
+
"nitro": "3.0.260311-beta",
|
|
50
51
|
"tsup": "^8.5.1",
|
|
51
52
|
"typescript": "^5.9.3",
|
|
52
53
|
"vercel": "^50.37.3",
|