@sentry/junior 0.203.0 → 0.204.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.
Files changed (174) hide show
  1. package/dist/agent-CMyTD4DD.js +17509 -0
  2. package/dist/agent-hooks-Bbcp9e33.js +4040 -0
  3. package/dist/agent-runner-DNb1A49M.js +678 -0
  4. package/dist/api/schema.d.ts +2728 -2639
  5. package/dist/api/schema.js +4 -169
  6. package/dist/api.d.ts +23 -17
  7. package/dist/api.js +3881 -5326
  8. package/dist/app-B1TOqBI8.d.ts +246 -0
  9. package/dist/app.d.ts +4 -520
  10. package/dist/app.js +9522 -11875
  11. package/dist/auth-pause-state-DosEalIG.js +168 -0
  12. package/dist/catalog-runtime-BReos-D4.js +7 -0
  13. package/dist/checkpoint-CNrPyRJN.js +2450 -0
  14. package/dist/cli/chat.d.ts +20 -0
  15. package/dist/cli/chat.js +229 -336
  16. package/dist/cli/check.d.ts +8 -0
  17. package/dist/cli/check.js +513 -806
  18. package/dist/cli/env.d.ts +13 -0
  19. package/dist/cli/env.js +63 -12
  20. package/dist/cli/init.d.ts +3 -0
  21. package/dist/cli/init.js +90 -159
  22. package/dist/cli/main.d.ts +6 -0
  23. package/dist/cli/main.js +43 -64
  24. package/dist/cli/plugins.d.ts +13 -0
  25. package/dist/cli/plugins.js +148 -227
  26. package/dist/cli/run.d.ts +16 -0
  27. package/dist/cli/run.js +52 -8
  28. package/dist/cli/snapshot-create.d.ts +4 -0
  29. package/dist/cli/snapshot-create.js +71 -125
  30. package/dist/cli/upgrade.d.ts +15 -0
  31. package/dist/cli/upgrade.js +232 -335
  32. package/dist/config-nGCW1OTG.js +941 -0
  33. package/dist/context-B45_WqVX.js +298 -0
  34. package/dist/conversation-privacy-B4voFRSm.js +182 -0
  35. package/dist/conversation-work-C6y3T5Hx.js +51 -0
  36. package/dist/credential-sync-kXr1hvO1.js +2660 -0
  37. package/dist/db-BeyXKJOI.d.ts +5 -0
  38. package/dist/destinations-BeBiJeEM.js +29 -0
  39. package/dist/execution-stats-DWfSihcH.js +373 -0
  40. package/dist/executor-DcMSlI5c.js +721 -0
  41. package/dist/experimental-CIXf7Uye.js +46 -0
  42. package/dist/history-ClE4toxe.d.ts +32 -0
  43. package/dist/history-CqTuSAdI.js +441 -0
  44. package/dist/instrumentation.d.ts +3 -3
  45. package/dist/instrumentation.js +130 -176
  46. package/dist/job-queue-Drn_LXlM.js +63 -0
  47. package/dist/logging-BzAk1S_s.js +1210 -0
  48. package/dist/model-profile-CZmVoGdX.js +49 -0
  49. package/dist/nitro.d.ts +31 -36
  50. package/dist/nitro.js +275 -456
  51. package/dist/oauth-callback-server-JiftokvA.js +130 -0
  52. package/dist/oauth-relay-CdCnu80W.js +62 -0
  53. package/dist/package-discovery-7a9YqLhE.js +455 -0
  54. package/dist/pending-auth-CWmSdZVg.js +185 -0
  55. package/dist/plugin-module-BKGOXca2.js +81 -0
  56. package/dist/plugins-BI9A1vKA.d.ts +95 -0
  57. package/dist/plugins-egKWjgue.js +99 -0
  58. package/dist/private-trace-result-BLvBjy_e.js +16 -0
  59. package/dist/profile-CrT5nXbw.js +861 -0
  60. package/dist/registry-DH1xUo2N.js +1419 -0
  61. package/dist/reporting-schema-DosTN__Q.js +105 -0
  62. package/dist/resolve-CZHnfxaS.js +546 -0
  63. package/dist/rolldown-runtime-B4FMCO8f.js +28 -0
  64. package/dist/runner-CZV2sC46.js +392 -0
  65. package/dist/sandbox-egress-signals-bHZfmhbd.js +46 -0
  66. package/dist/schema-Rn8-XEaN.js +1140 -0
  67. package/dist/sentry-CD3SdJl-.js +26 -0
  68. package/dist/skills-CIcDQSgM.js +316 -0
  69. package/dist/spawn-DdkUFRmq.js +29 -0
  70. package/dist/stats-DTUbAb88.js +2634 -0
  71. package/dist/store-C5qxF2ac.d.ts +208 -0
  72. package/dist/task-queue-CJIR4RF7.js +136 -0
  73. package/dist/task-runner-D-O3A-Cp.js +639 -0
  74. package/dist/thread-state-CRc9jTJS.js +431 -0
  75. package/dist/turn-execution-BkinIdJF.js +47 -0
  76. package/dist/turn-lifecycle-DQV19VTW.js +54 -0
  77. package/dist/usage-D3EbSO7w.js +296 -0
  78. package/dist/usage-schema-CKaDkH_j.js +20 -0
  79. package/dist/validation-C2CR-OX3.js +40 -0
  80. package/dist/vercel-queue-DIkVcfK4.js +167 -0
  81. package/dist/vercel.d.ts +6 -6
  82. package/dist/vercel.js +14 -6
  83. package/dist/version-CnXZ614E.d.ts +5 -0
  84. package/dist/version-DxcWdoKa.js +8 -0
  85. package/dist/version.d.ts +2 -4
  86. package/dist/version.js +2 -6
  87. package/dist/web-authorization-RMBxAR_t.js +76 -0
  88. package/dist/web-input-3EPfpf55.js +494 -0
  89. package/dist/work-fGofI7Op.js +509 -0
  90. package/dist/worker-CsOLq-mR.js +625 -0
  91. package/package.json +8 -8
  92. package/dist/agent-hooks-GB2VPTNA.js +0 -51
  93. package/dist/catalog-runtime-UBLIWD3O.js +0 -14
  94. package/dist/chunk-2LYHWMR4.js +0 -46
  95. package/dist/chunk-352OWAZH.js +0 -320
  96. package/dist/chunk-3Y47VMHV.js +0 -6
  97. package/dist/chunk-3YJSKOWF.js +0 -164
  98. package/dist/chunk-4KSSKTQ5.js +0 -229
  99. package/dist/chunk-4UO6FK4G.js +0 -64
  100. package/dist/chunk-5AHX53NQ.js +0 -717
  101. package/dist/chunk-5J3E5FWA.js +0 -700
  102. package/dist/chunk-5PDAG6O3.js +0 -206
  103. package/dist/chunk-6Y5B5PEX.js +0 -80
  104. package/dist/chunk-7GWQ5S5R.js +0 -2086
  105. package/dist/chunk-7H2VZTWN.js +0 -103
  106. package/dist/chunk-7NL7T6VU.js +0 -406
  107. package/dist/chunk-A5L27LE4.js +0 -387
  108. package/dist/chunk-ADIAWL34.js +0 -81
  109. package/dist/chunk-ASTEMBKJ.js +0 -519
  110. package/dist/chunk-CEMMLV5L.js +0 -98
  111. package/dist/chunk-CM5HNV2W.js +0 -131
  112. package/dist/chunk-CRTRBBRI.js +0 -105
  113. package/dist/chunk-DA2KGZZI.js +0 -13
  114. package/dist/chunk-DIB4GX3G.js +0 -8
  115. package/dist/chunk-DKIJ2RP5.js +0 -68
  116. package/dist/chunk-DWPN6SCH.js +0 -172
  117. package/dist/chunk-EDKUFGPL.js +0 -64
  118. package/dist/chunk-ENY6SKIU.js +0 -1228
  119. package/dist/chunk-F4MGCZOX.js +0 -2943
  120. package/dist/chunk-FA6POGLH.js +0 -70
  121. package/dist/chunk-FSUR7GTG.js +0 -20475
  122. package/dist/chunk-GKEOHJL5.js +0 -1856
  123. package/dist/chunk-GMCB6W5Y.js +0 -333
  124. package/dist/chunk-IE2VPG7O.js +0 -1135
  125. package/dist/chunk-IZ5B5IHQ.js +0 -3656
  126. package/dist/chunk-JAL3CH4G.js +0 -27
  127. package/dist/chunk-KIIEUXD3.js +0 -1764
  128. package/dist/chunk-KXU4NIL7.js +0 -692
  129. package/dist/chunk-MTM5IFCY.js +0 -1190
  130. package/dist/chunk-N7TMSOZH.js +0 -235
  131. package/dist/chunk-NCEBK6PH.js +0 -36
  132. package/dist/chunk-NHJU2ZAL.js +0 -56
  133. package/dist/chunk-P6KTRNVC.js +0 -321
  134. package/dist/chunk-PDO5BLNM.js +0 -22
  135. package/dist/chunk-PDRNLLFT.js +0 -3295
  136. package/dist/chunk-PEQXYSSE.js +0 -45
  137. package/dist/chunk-PKEX2AQX.js +0 -198
  138. package/dist/chunk-PSJCGIGO.js +0 -1163
  139. package/dist/chunk-PZUSUL55.js +0 -506
  140. package/dist/chunk-R45M4TUS.js +0 -37
  141. package/dist/chunk-RC745GGZ.js +0 -122
  142. package/dist/chunk-SP3QKZXJ.js +0 -820
  143. package/dist/chunk-TXKUKMVO.js +0 -417
  144. package/dist/chunk-UE4GPWSD.js +0 -931
  145. package/dist/chunk-UIE3R5XU.js +0 -17
  146. package/dist/chunk-UXPG6ZIN.js +0 -84
  147. package/dist/chunk-VFUK3X5B.js +0 -50
  148. package/dist/chunk-VNMJWREK.js +0 -787
  149. package/dist/chunk-VZ7CSOX2.js +0 -706
  150. package/dist/chunk-WCNQJKFT.js +0 -10
  151. package/dist/chunk-WDZR3QQM.js +0 -135
  152. package/dist/chunk-WLYVJCHV.js +0 -1433
  153. package/dist/chunk-WS7NAFTM.js +0 -1520
  154. package/dist/chunk-X6GDDWQH.js +0 -60
  155. package/dist/chunk-XPDEYNQI.js +0 -102
  156. package/dist/chunk-XRW44VGM.js +0 -58
  157. package/dist/chunk-Y2CM7HXH.js +0 -111
  158. package/dist/chunk-Y7X25LFY.js +0 -15
  159. package/dist/conversation-work-VIOQ5ZF3.js +0 -54
  160. package/dist/db-NGDJV7YH.js +0 -26
  161. package/dist/discovery-DWVDM7UK.js +0 -44
  162. package/dist/experimental-P5FZM4CU.js +0 -12
  163. package/dist/oauth-callback-server-YFY7YEGK.js +0 -243
  164. package/dist/oauth-relay-5XPVRPYB.js +0 -8
  165. package/dist/plugins-YTYJMMJF.js +0 -14
  166. package/dist/runner-ORTNSB2Q.js +0 -522
  167. package/dist/sandbox-egress-signals-FIL7EGPR.js +0 -73
  168. package/dist/sentry-MB3NL3IR.js +0 -42
  169. package/dist/skills-H376WQOH.js +0 -27
  170. package/dist/spawn-T43WHLOS.js +0 -42
  171. package/dist/task-runner-LBZWF32V.js +0 -36
  172. package/dist/validation-REJLRKI6.js +0 -17
  173. package/dist/work-3KJ3RE76.js +0 -51
  174. package/dist/worker-QFEBU72E.js +0 -24
package/dist/nitro.js CHANGED
@@ -1,506 +1,325 @@
1
- import {
2
- PLUGIN_TASK_QUEUE_TOPIC
3
- } from "./chunk-3YJSKOWF.js";
4
- import {
5
- pluginCatalogConfigFromPluginSet,
6
- pluginRuntimeRegistrationsFromPluginSet
7
- } from "./chunk-CM5HNV2W.js";
8
- import {
9
- WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC
10
- } from "./chunk-X6GDDWQH.js";
11
- import "./chunk-NCEBK6PH.js";
12
- import {
13
- resolveConversationWorkQueueTopic
14
- } from "./chunk-DKIJ2RP5.js";
15
- import "./chunk-JAL3CH4G.js";
16
- import "./chunk-7H2VZTWN.js";
17
- import {
18
- loadPluginSetFromModule,
19
- resolvePluginModule
20
- } from "./chunk-Y2CM7HXH.js";
21
- import "./chunk-ENY6SKIU.js";
22
- import "./chunk-NHJU2ZAL.js";
23
- import "./chunk-PKEX2AQX.js";
24
- import {
25
- discoverInstalledPluginPackageContent
26
- } from "./chunk-DWPN6SCH.js";
27
- import {
28
- isValidPackageName,
29
- resolvePackageDir
30
- } from "./chunk-TXKUKMVO.js";
31
- import {
32
- JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
33
- JUNIOR_HEARTBEAT_CRON_SCHEDULE,
34
- JUNIOR_HEARTBEAT_ROUTE,
35
- JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE,
36
- JUNIOR_RETENTION_CRON_SCHEDULE,
37
- JUNIOR_RETENTION_ROUTE,
38
- JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE
39
- } from "./chunk-WS7NAFTM.js";
40
- import "./chunk-PEQXYSSE.js";
41
- import "./chunk-WDZR3QQM.js";
42
-
43
- // src/nitro.ts
44
- import path2 from "path";
45
-
46
- // src/build/rolldown-workarounds.ts
1
+ import { A as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, D as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, E as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_RETENTION_CRON_SCHEDULE, T as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_RETENTION_ROUTE, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "./logging-BzAk1S_s.js";
2
+ import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-7a9YqLhE.js";
3
+ import { n as resolveConversationWorkQueueTopic } from "./vercel-queue-DIkVcfK4.js";
4
+ import { t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-Drn_LXlM.js";
5
+ import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-egKWjgue.js";
6
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-CJIR4RF7.js";
7
+ import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-BKGOXca2.js";
8
+ import path from "node:path";
9
+ import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
10
+ //#region src/build/rolldown-workarounds.ts
11
+ /**
12
+ * Override rolldown's treeshake config so that module side effects survive
13
+ * bundling.
14
+ *
15
+ * pi-ai registers API providers via a top-level side-effect in
16
+ * register-builtins.js. Nitro's default moduleSideEffects whitelist only
17
+ * includes unenv polyfills, so rolldown tree-shakes the registration call
18
+ * and the apiProviderRegistry Map stays empty at runtime.
19
+ *
20
+ * TODO(upstream): Track https://github.com/nitrojs/nitro/issues/XXXX for
21
+ * native moduleSideEffects configuration support.
22
+ */
47
23
  function applyRolldownTreeshakeWorkaround(nitro) {
48
- nitro.options.rolldownConfig = {
49
- ...nitro.options.rolldownConfig,
50
- treeshake: {
51
- ...nitro.options.rolldownConfig?.treeshake,
52
- moduleSideEffects: true
53
- }
54
- };
24
+ nitro.options.rolldownConfig = {
25
+ ...nitro.options.rolldownConfig,
26
+ treeshake: {
27
+ ...nitro.options.rolldownConfig?.treeshake,
28
+ moduleSideEffects: true
29
+ }
30
+ };
55
31
  }
56
-
57
- // src/build/copy-build-content.ts
58
- import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "fs";
59
- import path from "path";
60
-
61
- // src/build/glob-to-regex.ts
32
+ //#endregion
33
+ //#region src/build/glob-to-regex.ts
34
+ /** Convert a simple file glob (supporting `*` wildcards) into a RegExp. */
62
35
  function globToRegex(pattern) {
63
- const escaped = pattern.replace(/[\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
64
- return new RegExp(`^${escaped}$`);
36
+ const escaped = pattern.replace(/[\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
37
+ return new RegExp(`^${escaped}$`);
65
38
  }
66
-
67
- // src/build/copy-build-content.ts
68
- var DASHBOARD_PACKAGE_NAME = "@sentry/junior-dashboard";
69
- var JUNIOR_PACKAGE_NAME = "@sentry/junior";
70
- var DASHBOARD_ASSET_NAMES = ["client.js", "tailwind.css"];
39
+ //#endregion
40
+ //#region src/build/copy-build-content.ts
41
+ const DASHBOARD_PACKAGE_NAME = "@sentry/junior-dashboard";
42
+ const JUNIOR_PACKAGE_NAME = "@sentry/junior";
43
+ const DASHBOARD_ASSET_NAMES = ["client.js", "tailwind.css"];
44
+ /** Copy app, built-in skill, and declared plugin content into server output. */
71
45
  function copyRuntimeContent(cwd, serverRoot, packageNames) {
72
- copyIfExists(path.join(cwd, "app"), path.join(serverRoot, "app"));
73
- const juniorPackageDir = resolvePackageDir(cwd, JUNIOR_PACKAGE_NAME);
74
- if (!juniorPackageDir) {
75
- throw new Error(
76
- `Cannot resolve ${JUNIOR_PACKAGE_NAME} while copying runtime content`
77
- );
78
- }
79
- const builtInSkillsDir = path.join(juniorPackageDir, "skills");
80
- if (!copyIfExists(
81
- builtInSkillsDir,
82
- path.join(serverRoot, "node_modules", JUNIOR_PACKAGE_NAME, "skills")
83
- )) {
84
- throw new Error(
85
- `${JUNIOR_PACKAGE_NAME} is missing its built-in skills directory`
86
- );
87
- }
88
- const packagedContent = discoverInstalledPluginPackageContent(cwd, {
89
- packageNames
90
- });
91
- for (const root of packagedContent.manifestRoots) {
92
- if (existsSync(path.join(root, "plugin.yaml"))) {
93
- const manifestPath = path.join(root, "plugin.yaml");
94
- copyIfExists(
95
- manifestPath,
96
- resolveServerOutputPath(cwd, serverRoot, manifestPath)
97
- );
98
- continue;
99
- }
100
- copyRootIntoServerOutput(cwd, serverRoot, root);
101
- }
102
- for (const root of packagedContent.skillRoots) {
103
- copyRootIntoServerOutput(cwd, serverRoot, root);
104
- }
105
- for (const pkg of packagedContent.packages) {
106
- if (pkg.hasMigrationsDir) {
107
- copyRootIntoServerOutput(
108
- cwd,
109
- serverRoot,
110
- path.join(pkg.dir, "migrations")
111
- );
112
- }
113
- }
46
+ copyIfExists(path.join(cwd, "app"), path.join(serverRoot, "app"));
47
+ const juniorPackageDir = resolvePackageDir(cwd, JUNIOR_PACKAGE_NAME);
48
+ if (!juniorPackageDir) throw new Error(`Cannot resolve ${JUNIOR_PACKAGE_NAME} while copying runtime content`);
49
+ if (!copyIfExists(path.join(juniorPackageDir, "skills"), path.join(serverRoot, "node_modules", JUNIOR_PACKAGE_NAME, "skills"))) throw new Error(`${JUNIOR_PACKAGE_NAME} is missing its built-in skills directory`);
50
+ const packagedContent = discoverInstalledPluginPackageContent(cwd, { packageNames });
51
+ for (const root of packagedContent.manifestRoots) {
52
+ if (existsSync(path.join(root, "plugin.yaml"))) {
53
+ const manifestPath = path.join(root, "plugin.yaml");
54
+ copyIfExists(manifestPath, resolveServerOutputPath(cwd, serverRoot, manifestPath));
55
+ continue;
56
+ }
57
+ copyRootIntoServerOutput(cwd, serverRoot, root);
58
+ }
59
+ for (const root of packagedContent.skillRoots) copyRootIntoServerOutput(cwd, serverRoot, root);
60
+ for (const pkg of packagedContent.packages) if (pkg.hasMigrationsDir) copyRootIntoServerOutput(cwd, serverRoot, path.join(pkg.dir, "migrations"));
114
61
  }
62
+ /** Copy dashboard browser assets when core dashboard routes are enabled. */
115
63
  function copyDashboardAssets(cwd, serverRoot) {
116
- const packageDir = resolvePackageDir(cwd, DASHBOARD_PACKAGE_NAME);
117
- if (!packageDir) {
118
- throw new Error(
119
- `createApp({ dashboard }) requires installing "${DASHBOARD_PACKAGE_NAME}"`
120
- );
121
- }
122
- for (const fileName of DASHBOARD_ASSET_NAMES) {
123
- const source = dashboardAssetPath(packageDir, fileName);
124
- copyIfExists(
125
- source,
126
- path.join(
127
- serverRoot,
128
- "node_modules",
129
- DASHBOARD_PACKAGE_NAME,
130
- "dist",
131
- fileName
132
- )
133
- );
134
- }
64
+ const packageDir = resolvePackageDir(cwd, DASHBOARD_PACKAGE_NAME);
65
+ if (!packageDir) throw new Error(`createApp({ dashboard }) requires installing "${DASHBOARD_PACKAGE_NAME}"`);
66
+ for (const fileName of DASHBOARD_ASSET_NAMES) copyIfExists(dashboardAssetPath(packageDir, fileName), path.join(serverRoot, "node_modules", DASHBOARD_PACKAGE_NAME, "dist", fileName));
135
67
  }
68
+ /** Copy extra file patterns into server output for files the bundler cannot trace. */
136
69
  function copyIncludedFiles(cwd, serverRoot, patterns) {
137
- if (patterns === void 0) return;
138
- if (!Array.isArray(patterns)) {
139
- throw new Error(
140
- "includeFiles must be an array of package subpath patterns"
141
- );
142
- }
143
- if (patterns.length === 0) return;
144
- for (const pattern of patterns) {
145
- if (typeof pattern !== "string" || !pattern.trim()) {
146
- throw new Error("includeFiles entries must be package subpath patterns");
147
- }
148
- const { pkgName, subDir, fileGlob } = parseIncludePattern(pattern);
149
- const pkgDir = resolvePackageDir(cwd, pkgName);
150
- if (!pkgDir) {
151
- throw new Error(
152
- `includeFiles entry "${pattern}" references package "${pkgName}", but it could not be resolved`
153
- );
154
- }
155
- const sourceDir = path.join(pkgDir, subDir);
156
- if (!isDirectory(sourceDir)) {
157
- throw new Error(
158
- `includeFiles entry "${pattern}" references missing directory ${sourceDir}`
159
- );
160
- }
161
- const entries = readdirSync(sourceDir);
162
- const re = fileGlob.includes("*") ? globToRegex(fileGlob) : null;
163
- let matched = false;
164
- let copied = false;
165
- for (const entry of entries) {
166
- if (re ? !re.test(entry) : entry !== fileGlob) continue;
167
- matched = true;
168
- copied = copyIfExists(
169
- path.join(sourceDir, entry),
170
- path.join(serverRoot, "node_modules", pkgName, subDir, entry)
171
- ) || copied;
172
- }
173
- if (!matched) {
174
- throw new Error(
175
- `includeFiles entry "${pattern}" did not match any files in ${sourceDir}`
176
- );
177
- }
178
- if (!copied) {
179
- throw new Error(
180
- `includeFiles entry "${pattern}" matched files in ${sourceDir} but did not copy any existing files`
181
- );
182
- }
183
- }
70
+ if (patterns === void 0) return;
71
+ if (!Array.isArray(patterns)) throw new Error("includeFiles must be an array of package subpath patterns");
72
+ if (patterns.length === 0) return;
73
+ for (const pattern of patterns) {
74
+ if (typeof pattern !== "string" || !pattern.trim()) throw new Error("includeFiles entries must be package subpath patterns");
75
+ const { pkgName, subDir, fileGlob } = parseIncludePattern(pattern);
76
+ const pkgDir = resolvePackageDir(cwd, pkgName);
77
+ if (!pkgDir) throw new Error(`includeFiles entry "${pattern}" references package "${pkgName}", but it could not be resolved`);
78
+ const sourceDir = path.join(pkgDir, subDir);
79
+ if (!isDirectory(sourceDir)) throw new Error(`includeFiles entry "${pattern}" references missing directory ${sourceDir}`);
80
+ const entries = readdirSync(sourceDir);
81
+ const re = fileGlob.includes("*") ? globToRegex(fileGlob) : null;
82
+ let matched = false;
83
+ let copied = false;
84
+ for (const entry of entries) {
85
+ if (re ? !re.test(entry) : entry !== fileGlob) continue;
86
+ matched = true;
87
+ copied = copyIfExists(path.join(sourceDir, entry), path.join(serverRoot, "node_modules", pkgName, subDir, entry)) || copied;
88
+ }
89
+ if (!matched) throw new Error(`includeFiles entry "${pattern}" did not match any files in ${sourceDir}`);
90
+ if (!copied) throw new Error(`includeFiles entry "${pattern}" matched files in ${sourceDir} but did not copy any existing files`);
91
+ }
184
92
  }
185
93
  function parseIncludePattern(pattern) {
186
- const normalized = pattern.trim().replace(/^node_modules\//, "");
187
- const parts = normalized.split("/");
188
- if (!normalized || path.isAbsolute(normalized) || parts.some((part) => !part || part === "." || part === "..")) {
189
- throw new Error(
190
- `includeFiles entry "${pattern}" must be a package subpath pattern`
191
- );
192
- }
193
- const isScopedPackage = parts[0].startsWith("@");
194
- const packagePartCount = isScopedPackage ? 2 : 1;
195
- const pkgName = parts.slice(0, packagePartCount).join("/");
196
- const subpath = parts.slice(packagePartCount).join("/");
197
- if (!pkgName || !isValidPackageName(pkgName) || !subpath) {
198
- throw new Error(
199
- `includeFiles entry "${pattern}" must include a package subpath`
200
- );
201
- }
202
- return {
203
- pkgName,
204
- subDir: path.dirname(subpath),
205
- fileGlob: path.basename(subpath)
206
- };
94
+ const normalized = pattern.trim().replace(/^node_modules\//, "");
95
+ const parts = normalized.split("/");
96
+ if (!normalized || path.isAbsolute(normalized) || parts.some((part) => !part || part === "." || part === "..")) throw new Error(`includeFiles entry "${pattern}" must be a package subpath pattern`);
97
+ const packagePartCount = parts[0].startsWith("@") ? 2 : 1;
98
+ const pkgName = parts.slice(0, packagePartCount).join("/");
99
+ const subpath = parts.slice(packagePartCount).join("/");
100
+ if (!pkgName || !isValidPackageName(pkgName) || !subpath) throw new Error(`includeFiles entry "${pattern}" must include a package subpath`);
101
+ return {
102
+ pkgName,
103
+ subDir: path.dirname(subpath),
104
+ fileGlob: path.basename(subpath)
105
+ };
207
106
  }
208
107
  function isDirectory(targetPath) {
209
- try {
210
- return statSync(targetPath).isDirectory();
211
- } catch {
212
- return false;
213
- }
108
+ try {
109
+ return statSync(targetPath).isDirectory();
110
+ } catch {
111
+ return false;
112
+ }
214
113
  }
215
114
  function copyIfExists(source, target) {
216
- if (!existsSync(source)) {
217
- return false;
218
- }
219
- mkdirSync(path.dirname(target), { recursive: true });
220
- cpSync(source, target, { recursive: true });
221
- return true;
115
+ if (!existsSync(source)) return false;
116
+ mkdirSync(path.dirname(target), { recursive: true });
117
+ cpSync(source, target, { recursive: true });
118
+ return true;
222
119
  }
223
120
  function dashboardAssetPath(packageDir, fileName) {
224
- const candidates = [
225
- path.join(packageDir, fileName),
226
- path.join(packageDir, "dist", fileName)
227
- ];
228
- for (const candidate of candidates) {
229
- if (existsSync(candidate)) {
230
- return candidate;
231
- }
232
- }
233
- throw new Error(
234
- `Junior dashboard asset ${fileName} was not built; run pnpm --filter @sentry/junior-dashboard build before building Nitro`
235
- );
121
+ const candidates = [path.join(packageDir, fileName), path.join(packageDir, "dist", fileName)];
122
+ for (const candidate of candidates) if (existsSync(candidate)) return candidate;
123
+ throw new Error(`Junior dashboard asset ${fileName} was not built; run pnpm --filter @sentry/junior-dashboard build before building Nitro`);
236
124
  }
237
125
  function copyRootIntoServerOutput(cwd, serverRoot, root) {
238
- copyIfExists(root, resolveServerOutputPath(cwd, serverRoot, root));
126
+ copyIfExists(root, resolveServerOutputPath(cwd, serverRoot, root));
239
127
  }
240
128
  function resolveServerOutputPath(cwd, serverRoot, sourcePath) {
241
- const relative = path.relative(cwd, sourcePath);
242
- if (isLocalRelativePath(relative)) {
243
- return path.join(serverRoot, relative);
244
- }
245
- const nodeModulesRelative = nodeModulesRelativePath(sourcePath);
246
- if (nodeModulesRelative) {
247
- return path.join(serverRoot, nodeModulesRelative);
248
- }
249
- throw new Error(
250
- `Cannot copy configured plugin content outside the app root or node_modules: ${sourcePath}`
251
- );
129
+ const relative = path.relative(cwd, sourcePath);
130
+ if (isLocalRelativePath(relative)) return path.join(serverRoot, relative);
131
+ const nodeModulesRelative = nodeModulesRelativePath(sourcePath);
132
+ if (nodeModulesRelative) return path.join(serverRoot, nodeModulesRelative);
133
+ throw new Error(`Cannot copy configured plugin content outside the app root or node_modules: ${sourcePath}`);
252
134
  }
253
135
  function isLocalRelativePath(relativePath) {
254
- return Boolean(relativePath) && !path.isAbsolute(relativePath) && relativePath !== ".." && !relativePath.startsWith(`..${path.sep}`);
136
+ return Boolean(relativePath) && !path.isAbsolute(relativePath) && relativePath !== ".." && !relativePath.startsWith(`..${path.sep}`);
255
137
  }
256
138
  function nodeModulesRelativePath(sourcePath) {
257
- const parts = path.resolve(sourcePath).split(path.sep);
258
- const nodeModulesIndex = parts.lastIndexOf("node_modules");
259
- if (nodeModulesIndex === -1 || nodeModulesIndex === parts.length - 1) {
260
- return null;
261
- }
262
- return path.join("node_modules", ...parts.slice(nodeModulesIndex + 1));
139
+ const parts = path.resolve(sourcePath).split(path.sep);
140
+ const nodeModulesIndex = parts.lastIndexOf("node_modules");
141
+ if (nodeModulesIndex === -1 || nodeModulesIndex === parts.length - 1) return null;
142
+ return path.join("node_modules", ...parts.slice(nodeModulesIndex + 1));
263
143
  }
264
-
265
- // src/build/virtual-config.ts
144
+ //#endregion
145
+ //#region src/build/virtual-config.ts
266
146
  function renderRuntimePluginImport(module) {
267
- if (module.exportName === "default") {
268
- return `import juniorRuntimePluginSet from ${JSON.stringify(module.specifier)};`;
269
- }
270
- return `import { ${module.exportName} as juniorRuntimePluginSet } from ${JSON.stringify(module.specifier)};`;
147
+ if (module.exportName === "default") return `import juniorRuntimePluginSet from ${JSON.stringify(module.specifier)};`;
148
+ return `import { ${module.exportName} as juniorRuntimePluginSet } from ${JSON.stringify(module.specifier)};`;
271
149
  }
272
150
  function renderDashboardImport(enabled) {
273
- return enabled ? [
274
- 'import { createDashboardApp as juniorCreateDashboardApp } from "@sentry/junior-dashboard";',
275
- "export const createDashboardApp = juniorCreateDashboardApp;"
276
- ] : ["export const createDashboardApp = undefined;"];
151
+ return enabled ? ["import { createDashboardApp as juniorCreateDashboardApp } from \"@sentry/junior-dashboard\";", "export const createDashboardApp = juniorCreateDashboardApp;"] : ["export const createDashboardApp = undefined;"];
277
152
  }
278
- function dashboardEnabled(dashboard) {
279
- return Boolean(dashboard && !dashboard.disabled);
153
+ function dashboardEnabled$1(dashboard) {
154
+ return Boolean(dashboard && !dashboard.disabled);
280
155
  }
156
+ /** Render the virtual config module consumed by createApp(). */
281
157
  function renderVirtualConfig(options) {
282
- const lines = [
283
- ...renderDashboardImport(dashboardEnabled(options.dashboard)),
284
- ...options.pluginModule ? [
285
- renderRuntimePluginImport(options.pluginModule),
286
- "export const pluginSet = juniorRuntimePluginSet;"
287
- ] : ["export const pluginSet = undefined;"],
288
- `export const plugins = ${JSON.stringify(options.plugins ?? { packages: [] })};`,
289
- `export const pluginRuntimeRegistrations = ${JSON.stringify(options.pluginRuntimeRegistrations ?? [])};`,
290
- `export const dashboard = ${JSON.stringify(options.dashboard)};`,
291
- `export const functionMaxDurationSeconds = ${JSON.stringify(options.functionMaxDurationSeconds)};`
292
- ];
293
- return lines.join("\n");
158
+ return [
159
+ ...renderDashboardImport(dashboardEnabled$1(options.dashboard)),
160
+ ...options.pluginModule ? [renderRuntimePluginImport(options.pluginModule), "export const pluginSet = juniorRuntimePluginSet;"] : ["export const pluginSet = undefined;"],
161
+ `export const plugins = ${JSON.stringify(options.plugins ?? { packages: [] })};`,
162
+ `export const pluginRuntimeRegistrations = ${JSON.stringify(options.pluginRuntimeRegistrations ?? [])};`,
163
+ `export const dashboard = ${JSON.stringify(options.dashboard)};`,
164
+ `export const functionMaxDurationSeconds = ${JSON.stringify(options.functionMaxDurationSeconds)};`
165
+ ].join("\n");
294
166
  }
167
+ /** Inject a virtual module so createApp() can read the plugin list at runtime. */
295
168
  function injectVirtualConfig(nitro, options = {}) {
296
- nitro.options.virtual["#junior/config"] = async () => {
297
- if (!options.loadPluginSet) {
298
- return renderVirtualConfig(options);
299
- }
300
- const pluginSet = await options.loadPluginSet();
301
- return renderVirtualConfig({
302
- functionMaxDurationSeconds: options.functionMaxDurationSeconds,
303
- pluginModule: options.pluginModule,
304
- plugins: pluginCatalogConfigFromPluginSet(pluginSet),
305
- pluginRuntimeRegistrations: pluginRuntimeRegistrationsFromPluginSet(
306
- pluginSet
307
- ).map((plugin) => plugin.manifest.name),
308
- dashboard: options.dashboard
309
- });
310
- };
169
+ nitro.options.virtual["#junior/config"] = async () => {
170
+ if (!options.loadPluginSet) return renderVirtualConfig(options);
171
+ const pluginSet = await options.loadPluginSet();
172
+ return renderVirtualConfig({
173
+ functionMaxDurationSeconds: options.functionMaxDurationSeconds,
174
+ pluginModule: options.pluginModule,
175
+ plugins: pluginCatalogConfigFromPluginSet(pluginSet),
176
+ pluginRuntimeRegistrations: pluginRuntimeRegistrationsFromPluginSet(pluginSet).map((plugin) => plugin.manifest.name),
177
+ dashboard: options.dashboard
178
+ });
179
+ };
311
180
  }
312
-
313
- // src/nitro.ts
314
- var DEFAULT_FUNCTION_MAX_DURATION_SECONDS = 300;
315
- var VERCEL_QUEUE_TRIGGER_TYPE = "queue/v2beta";
181
+ //#endregion
182
+ //#region src/nitro.ts
183
+ const DEFAULT_FUNCTION_MAX_DURATION_SECONDS = 300;
184
+ const VERCEL_QUEUE_TRIGGER_TYPE = "queue/v2beta";
316
185
  function isPluginModuleReference(value) {
317
- return typeof value === "string" || Boolean(value && "module" in value);
186
+ return typeof value === "string" || Boolean(value && "module" in value);
318
187
  }
319
188
  function isPluginSet(value) {
320
- if (!value || typeof value !== "object") {
321
- return false;
322
- }
323
- return "packageNames" in value && "registrations" in value;
189
+ if (!value || typeof value !== "object") return false;
190
+ return "packageNames" in value && "registrations" in value;
324
191
  }
325
192
  function assertSerializableDirectPluginSet(pluginSet) {
326
- const pluginRuntimeNames = pluginRuntimeRegistrationsFromPluginSet(
327
- pluginSet
328
- ).map((plugin) => plugin.manifest.name);
329
- if (pluginRuntimeNames.length === 0) {
330
- return;
331
- }
332
- throw new Error(
333
- `juniorNitro({ plugins }) cannot receive a direct defineJuniorPlugins(...) set with runtime plugin registration(s): ${pluginRuntimeNames.join(", ")}. Export the set from a runtime-safe plugin module and pass juniorNitro({ plugins: "./plugins" }) so createApp() can import the same registrations at runtime.`
334
- );
193
+ const pluginRuntimeNames = pluginRuntimeRegistrationsFromPluginSet(pluginSet).map((plugin) => plugin.manifest.name);
194
+ if (pluginRuntimeNames.length === 0) return;
195
+ throw new Error(`juniorNitro({ plugins }) cannot receive a direct defineJuniorPlugins(...) set with runtime plugin registration(s): ${pluginRuntimeNames.join(", ")}. Export the set from a runtime-safe plugin module and pass juniorNitro({ plugins: "./plugins" }) so createApp() can import the same registrations at runtime.`);
335
196
  }
336
- function dashboardEnabled2(dashboard) {
337
- return Boolean(dashboard && !dashboard.disabled);
197
+ function dashboardEnabled(dashboard) {
198
+ return Boolean(dashboard && !dashboard.disabled);
338
199
  }
339
200
  function runtimeModuleForResolvedPluginModule(moduleRef) {
340
- return {
341
- exportName: moduleRef.exportName,
342
- specifier: moduleRef.kind === "file" ? moduleRef.importPath.split(path2.sep).join("/") : moduleRef.sourceSpecifier
343
- };
201
+ return {
202
+ exportName: moduleRef.exportName,
203
+ specifier: moduleRef.kind === "file" ? moduleRef.importPath.split(path.sep).join("/") : moduleRef.sourceSpecifier
204
+ };
344
205
  }
206
+ /**
207
+ * Prevent import-in-the-middle and require-in-the-middle from being
208
+ * externalized so Rolldown bundles them inline.
209
+ *
210
+ * @sentry/node (via @opentelemetry/instrumentation) statically imports these
211
+ * packages. Nitro already lists them in nf3's NonBundleablePackages, which
212
+ * means it externalizes them and relies on traceNodeModules to copy the
213
+ * package directories into the Vercel function output. In practice that trace
214
+ * step fails to materialize the packages at runtime, causing an
215
+ * ERR_MODULE_NOT_FOUND startup crash.
216
+ *
217
+ * Adding them to noExternals overrides the NonBundleablePackages default and
218
+ * forces Rolldown to bundle their CJS code inline. The trade-off is that
219
+ * Node.js ESM loader hooks (hook.mjs) are not active, which limits OTEL
220
+ * auto-instrumentation of modules loaded after initialization. That is an
221
+ * acceptable cost compared to a fatal startup failure.
222
+ */
345
223
  function bundleOpenTelemetryLoaderHooks(nitro) {
346
- const existing = Array.isArray(nitro.options.noExternals) ? nitro.options.noExternals : [];
347
- const additions = ["import-in-the-middle", "require-in-the-middle"].filter(
348
- (pkg) => !existing.includes(pkg)
349
- );
350
- if (additions.length > 0) {
351
- nitro.options.noExternals = [...existing, ...additions];
352
- }
224
+ const existing = Array.isArray(nitro.options.noExternals) ? nitro.options.noExternals : [];
225
+ const additions = ["import-in-the-middle", "require-in-the-middle"].filter((pkg) => !existing.includes(pkg));
226
+ if (additions.length > 0) nitro.options.noExternals = [...existing, ...additions];
353
227
  }
354
228
  function configureVercelDeployment(nitro, options) {
355
- const defaultMaxDuration = options.maxDuration ?? DEFAULT_FUNCTION_MAX_DURATION_SECONDS;
356
- const queueTopic = resolveConversationWorkQueueTopic({
357
- topic: options.conversationWorkQueueTopic
358
- });
359
- nitro.options.vercel ??= {};
360
- nitro.options.vercel.config ??= { version: 3 };
361
- nitro.options.vercel.config.crons ??= [];
362
- if (!nitro.options.vercel.config.crons.some(
363
- (cron) => cron.path === JUNIOR_HEARTBEAT_ROUTE
364
- )) {
365
- nitro.options.vercel.config.crons.push({
366
- path: JUNIOR_HEARTBEAT_ROUTE,
367
- schedule: JUNIOR_HEARTBEAT_CRON_SCHEDULE
368
- });
369
- }
370
- if (!nitro.options.vercel.config.crons.some(
371
- (cron) => cron.path === JUNIOR_RETENTION_ROUTE
372
- )) {
373
- nitro.options.vercel.config.crons.push({
374
- path: JUNIOR_RETENTION_ROUTE,
375
- schedule: JUNIOR_RETENTION_CRON_SCHEDULE
376
- });
377
- }
378
- nitro.options.vercel.functions ??= {};
379
- nitro.options.vercel.functions.maxDuration = defaultMaxDuration;
380
- nitro.options.vercel.functionRules ??= {};
381
- const existingRule = nitro.options.vercel.functionRules[JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE] ?? {};
382
- const existingTriggers = Array.isArray(existingRule.experimentalTriggers) ? existingRule.experimentalTriggers : [];
383
- const otherTriggers = existingTriggers.filter(
384
- (trigger) => trigger.type !== VERCEL_QUEUE_TRIGGER_TYPE
385
- );
386
- nitro.options.vercel.functionRules[JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE] = {
387
- ...existingRule,
388
- maxDuration: defaultMaxDuration,
389
- experimentalTriggers: [
390
- ...otherTriggers,
391
- {
392
- type: VERCEL_QUEUE_TRIGGER_TYPE,
393
- topic: queueTopic
394
- }
395
- ]
396
- };
397
- const existingPluginTaskRule = nitro.options.vercel.functionRules[JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE] ?? {};
398
- const existingPluginTaskTriggers = Array.isArray(
399
- existingPluginTaskRule.experimentalTriggers
400
- ) ? existingPluginTaskRule.experimentalTriggers : [];
401
- const otherPluginTaskTriggers = existingPluginTaskTriggers.filter(
402
- (trigger) => trigger.type !== VERCEL_QUEUE_TRIGGER_TYPE
403
- );
404
- nitro.options.vercel.functionRules[JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE] = {
405
- ...existingPluginTaskRule,
406
- maxDuration: defaultMaxDuration,
407
- experimentalTriggers: [
408
- ...otherPluginTaskTriggers,
409
- {
410
- type: VERCEL_QUEUE_TRIGGER_TYPE,
411
- topic: PLUGIN_TASK_QUEUE_TOPIC
412
- }
413
- ]
414
- };
415
- const existingSnapshotJobRule = nitro.options.vercel.functionRules[JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE] ?? {};
416
- const existingSnapshotJobTriggers = Array.isArray(
417
- existingSnapshotJobRule.experimentalTriggers
418
- ) ? existingSnapshotJobRule.experimentalTriggers : [];
419
- const otherSnapshotJobTriggers = existingSnapshotJobTriggers.filter(
420
- (trigger) => trigger.type !== VERCEL_QUEUE_TRIGGER_TYPE
421
- );
422
- nitro.options.vercel.functionRules[JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE] = {
423
- ...existingSnapshotJobRule,
424
- maxDuration: defaultMaxDuration,
425
- experimentalTriggers: [
426
- ...otherSnapshotJobTriggers,
427
- {
428
- type: VERCEL_QUEUE_TRIGGER_TYPE,
429
- topic: WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC
430
- }
431
- ]
432
- };
433
- return defaultMaxDuration;
229
+ const defaultMaxDuration = options.maxDuration ?? DEFAULT_FUNCTION_MAX_DURATION_SECONDS;
230
+ const queueTopic = resolveConversationWorkQueueTopic({ topic: options.conversationWorkQueueTopic });
231
+ nitro.options.vercel ??= {};
232
+ nitro.options.vercel.config ??= { version: 3 };
233
+ nitro.options.vercel.config.crons ??= [];
234
+ if (!nitro.options.vercel.config.crons.some((cron) => cron.path === "/api/internal/heartbeat")) nitro.options.vercel.config.crons.push({
235
+ path: JUNIOR_HEARTBEAT_ROUTE,
236
+ schedule: JUNIOR_HEARTBEAT_CRON_SCHEDULE
237
+ });
238
+ if (!nitro.options.vercel.config.crons.some((cron) => cron.path === "/api/internal/retention")) nitro.options.vercel.config.crons.push({
239
+ path: JUNIOR_RETENTION_ROUTE,
240
+ schedule: JUNIOR_RETENTION_CRON_SCHEDULE
241
+ });
242
+ nitro.options.vercel.functions ??= {};
243
+ nitro.options.vercel.functions.maxDuration = defaultMaxDuration;
244
+ nitro.options.vercel.functionRules ??= {};
245
+ const existingRule = nitro.options.vercel.functionRules["/api/internal/agent/continue"] ?? {};
246
+ const otherTriggers = (Array.isArray(existingRule.experimentalTriggers) ? existingRule.experimentalTriggers : []).filter((trigger) => trigger.type !== VERCEL_QUEUE_TRIGGER_TYPE);
247
+ nitro.options.vercel.functionRules[JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE] = {
248
+ ...existingRule,
249
+ maxDuration: defaultMaxDuration,
250
+ experimentalTriggers: [...otherTriggers, {
251
+ type: VERCEL_QUEUE_TRIGGER_TYPE,
252
+ topic: queueTopic
253
+ }]
254
+ };
255
+ const existingPluginTaskRule = nitro.options.vercel.functionRules["/api/internal/plugin/tasks"] ?? {};
256
+ const otherPluginTaskTriggers = (Array.isArray(existingPluginTaskRule.experimentalTriggers) ? existingPluginTaskRule.experimentalTriggers : []).filter((trigger) => trigger.type !== VERCEL_QUEUE_TRIGGER_TYPE);
257
+ nitro.options.vercel.functionRules[JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE] = {
258
+ ...existingPluginTaskRule,
259
+ maxDuration: defaultMaxDuration,
260
+ experimentalTriggers: [...otherPluginTaskTriggers, {
261
+ type: VERCEL_QUEUE_TRIGGER_TYPE,
262
+ topic: PLUGIN_TASK_QUEUE_TOPIC
263
+ }]
264
+ };
265
+ const existingSnapshotJobRule = nitro.options.vercel.functionRules["/api/internal/workspace/snapshots"] ?? {};
266
+ const otherSnapshotJobTriggers = (Array.isArray(existingSnapshotJobRule.experimentalTriggers) ? existingSnapshotJobRule.experimentalTriggers : []).filter((trigger) => trigger.type !== VERCEL_QUEUE_TRIGGER_TYPE);
267
+ nitro.options.vercel.functionRules[JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE] = {
268
+ ...existingSnapshotJobRule,
269
+ maxDuration: defaultMaxDuration,
270
+ experimentalTriggers: [...otherSnapshotJobTriggers, {
271
+ type: VERCEL_QUEUE_TRIGGER_TYPE,
272
+ topic: WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC
273
+ }]
274
+ };
275
+ return defaultMaxDuration;
434
276
  }
277
+ /** Nitro module that configures deployment wiring and copies app/plugin content into the Vercel build output. */
435
278
  function juniorNitro(options = {}) {
436
- return {
437
- nitro: {
438
- setup(nitro) {
439
- const cwd = path2.resolve(
440
- options.cwd ?? nitro.options.rootDir ?? process.cwd()
441
- );
442
- const functionMaxDurationSeconds = configureVercelDeployment(
443
- nitro,
444
- options
445
- );
446
- bundleOpenTelemetryLoaderHooks(nitro);
447
- applyRolldownTreeshakeWorkaround(nitro);
448
- const pluginSource = options.plugins;
449
- const pluginModule = isPluginModuleReference(pluginSource) ? resolvePluginModule(cwd, pluginSource) : void 0;
450
- const directPluginSet = isPluginSet(pluginSource) ? pluginSource : void 0;
451
- if (directPluginSet) {
452
- assertSerializableDirectPluginSet(directPluginSet);
453
- }
454
- let pluginSetPromise;
455
- const loadConfiguredPluginSet = () => {
456
- pluginSetPromise ??= pluginModule ? loadPluginSetFromModule(pluginModule) : Promise.resolve(directPluginSet);
457
- return pluginSetPromise;
458
- };
459
- const pluginCatalogConfig = pluginCatalogConfigFromPluginSet(directPluginSet);
460
- const pluginRuntimeRegistrations = pluginRuntimeRegistrationsFromPluginSet(directPluginSet).map(
461
- (plugin) => plugin.manifest.name
462
- );
463
- injectVirtualConfig(nitro, {
464
- functionMaxDurationSeconds,
465
- ...pluginModule ? {
466
- loadPluginSet: loadConfiguredPluginSet,
467
- pluginModule: runtimeModuleForResolvedPluginModule(pluginModule)
468
- } : void 0,
469
- plugins: pluginCatalogConfig,
470
- pluginRuntimeRegistrations,
471
- dashboard: options.dashboard
472
- });
473
- const copyBuildContent = async () => {
474
- const pluginSet = await loadConfiguredPluginSet();
475
- const compiledPluginCatalogConfig = pluginCatalogConfigFromPluginSet(pluginSet);
476
- copyRuntimeContent(
477
- cwd,
478
- nitro.options.output.serverDir,
479
- compiledPluginCatalogConfig?.packages
480
- );
481
- if (dashboardEnabled2(options.dashboard)) {
482
- copyDashboardAssets(cwd, nitro.options.output.serverDir);
483
- }
484
- copyIncludedFiles(
485
- cwd,
486
- nitro.options.output.serverDir,
487
- options.includeFiles
488
- );
489
- };
490
- nitro.hooks.hook("rollup:before", (_nitro, config) => {
491
- const buildConfig = config;
492
- buildConfig.plugins ??= [];
493
- buildConfig.plugins.push({
494
- name: "junior:copy-build-content",
495
- async writeBundle() {
496
- await copyBuildContent();
497
- }
498
- });
499
- });
500
- }
501
- }
502
- };
279
+ return { nitro: { setup(nitro) {
280
+ const cwd = path.resolve(options.cwd ?? nitro.options.rootDir ?? process.cwd());
281
+ const functionMaxDurationSeconds = configureVercelDeployment(nitro, options);
282
+ bundleOpenTelemetryLoaderHooks(nitro);
283
+ applyRolldownTreeshakeWorkaround(nitro);
284
+ const pluginSource = options.plugins;
285
+ const pluginModule = isPluginModuleReference(pluginSource) ? resolvePluginModule(cwd, pluginSource) : void 0;
286
+ const directPluginSet = isPluginSet(pluginSource) ? pluginSource : void 0;
287
+ if (directPluginSet) assertSerializableDirectPluginSet(directPluginSet);
288
+ let pluginSetPromise;
289
+ const loadConfiguredPluginSet = () => {
290
+ pluginSetPromise ??= pluginModule ? loadPluginSetFromModule(pluginModule) : Promise.resolve(directPluginSet);
291
+ return pluginSetPromise;
292
+ };
293
+ const pluginCatalogConfig = pluginCatalogConfigFromPluginSet(directPluginSet);
294
+ const pluginRuntimeRegistrations = pluginRuntimeRegistrationsFromPluginSet(directPluginSet).map((plugin) => plugin.manifest.name);
295
+ injectVirtualConfig(nitro, {
296
+ functionMaxDurationSeconds,
297
+ ...pluginModule ? {
298
+ loadPluginSet: loadConfiguredPluginSet,
299
+ pluginModule: runtimeModuleForResolvedPluginModule(pluginModule)
300
+ } : void 0,
301
+ plugins: pluginCatalogConfig,
302
+ pluginRuntimeRegistrations,
303
+ dashboard: options.dashboard
304
+ });
305
+ const copyBuildContent = async () => {
306
+ const pluginSet = await loadConfiguredPluginSet();
307
+ const compiledPluginCatalogConfig = pluginCatalogConfigFromPluginSet(pluginSet);
308
+ copyRuntimeContent(cwd, nitro.options.output.serverDir, compiledPluginCatalogConfig?.packages);
309
+ if (dashboardEnabled(options.dashboard)) copyDashboardAssets(cwd, nitro.options.output.serverDir);
310
+ copyIncludedFiles(cwd, nitro.options.output.serverDir, options.includeFiles);
311
+ };
312
+ nitro.hooks.hook("rollup:before", (_nitro, config) => {
313
+ const buildConfig = config;
314
+ buildConfig.plugins ??= [];
315
+ buildConfig.plugins.push({
316
+ name: "junior:copy-build-content",
317
+ async writeBundle() {
318
+ await copyBuildContent();
319
+ }
320
+ });
321
+ });
322
+ } } };
503
323
  }
504
- export {
505
- juniorNitro
506
- };
324
+ //#endregion
325
+ export { juniorNitro };