@sentry/junior 0.202.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.
- package/dist/agent-CMyTD4DD.js +17509 -0
- package/dist/agent-hooks-Bbcp9e33.js +4040 -0
- package/dist/agent-runner-DNb1A49M.js +678 -0
- package/dist/api/schema.d.ts +2728 -2639
- package/dist/api/schema.js +4 -169
- package/dist/api.d.ts +23 -17
- package/dist/api.js +3881 -5326
- package/dist/app-B1TOqBI8.d.ts +246 -0
- package/dist/app.d.ts +4 -520
- package/dist/app.js +9522 -11875
- package/dist/auth-pause-state-DosEalIG.js +168 -0
- package/dist/catalog-runtime-BReos-D4.js +7 -0
- package/dist/checkpoint-CNrPyRJN.js +2450 -0
- package/dist/cli/chat.d.ts +20 -0
- package/dist/cli/chat.js +229 -336
- package/dist/cli/check.d.ts +8 -0
- package/dist/cli/check.js +513 -806
- package/dist/cli/env.d.ts +13 -0
- package/dist/cli/env.js +63 -12
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.js +90 -159
- package/dist/cli/main.d.ts +6 -0
- package/dist/cli/main.js +43 -64
- package/dist/cli/plugins.d.ts +13 -0
- package/dist/cli/plugins.js +148 -227
- package/dist/cli/run.d.ts +16 -0
- package/dist/cli/run.js +52 -8
- package/dist/cli/snapshot-create.d.ts +4 -0
- package/dist/cli/snapshot-create.js +71 -125
- package/dist/cli/upgrade.d.ts +15 -0
- package/dist/cli/upgrade.js +232 -335
- package/dist/config-nGCW1OTG.js +941 -0
- package/dist/context-B45_WqVX.js +298 -0
- package/dist/conversation-privacy-B4voFRSm.js +182 -0
- package/dist/conversation-work-C6y3T5Hx.js +51 -0
- package/dist/credential-sync-kXr1hvO1.js +2660 -0
- package/dist/db-BeyXKJOI.d.ts +5 -0
- package/dist/destinations-BeBiJeEM.js +29 -0
- package/dist/execution-stats-DWfSihcH.js +373 -0
- package/dist/executor-DcMSlI5c.js +721 -0
- package/dist/experimental-CIXf7Uye.js +46 -0
- package/dist/history-ClE4toxe.d.ts +32 -0
- package/dist/history-CqTuSAdI.js +441 -0
- package/dist/instrumentation.d.ts +3 -3
- package/dist/instrumentation.js +130 -176
- package/dist/job-queue-Drn_LXlM.js +63 -0
- package/dist/logging-BzAk1S_s.js +1210 -0
- package/dist/model-profile-CZmVoGdX.js +49 -0
- package/dist/nitro.d.ts +31 -36
- package/dist/nitro.js +275 -456
- package/dist/oauth-callback-server-JiftokvA.js +130 -0
- package/dist/oauth-relay-CdCnu80W.js +62 -0
- package/dist/package-discovery-7a9YqLhE.js +455 -0
- package/dist/pending-auth-CWmSdZVg.js +185 -0
- package/dist/plugin-module-BKGOXca2.js +81 -0
- package/dist/plugins-BI9A1vKA.d.ts +95 -0
- package/dist/plugins-egKWjgue.js +99 -0
- package/dist/private-trace-result-BLvBjy_e.js +16 -0
- package/dist/profile-CrT5nXbw.js +861 -0
- package/dist/registry-DH1xUo2N.js +1419 -0
- package/dist/reporting-schema-DosTN__Q.js +105 -0
- package/dist/resolve-CZHnfxaS.js +546 -0
- package/dist/rolldown-runtime-B4FMCO8f.js +28 -0
- package/dist/runner-CZV2sC46.js +392 -0
- package/dist/sandbox-egress-signals-bHZfmhbd.js +46 -0
- package/dist/schema-Rn8-XEaN.js +1140 -0
- package/dist/sentry-CD3SdJl-.js +26 -0
- package/dist/skills-CIcDQSgM.js +316 -0
- package/dist/spawn-DdkUFRmq.js +29 -0
- package/dist/stats-DTUbAb88.js +2634 -0
- package/dist/store-C5qxF2ac.d.ts +208 -0
- package/dist/task-queue-CJIR4RF7.js +136 -0
- package/dist/task-runner-D-O3A-Cp.js +639 -0
- package/dist/thread-state-CRc9jTJS.js +431 -0
- package/dist/turn-execution-BkinIdJF.js +47 -0
- package/dist/turn-lifecycle-DQV19VTW.js +54 -0
- package/dist/usage-D3EbSO7w.js +296 -0
- package/dist/usage-schema-CKaDkH_j.js +20 -0
- package/dist/validation-C2CR-OX3.js +40 -0
- package/dist/vercel-queue-DIkVcfK4.js +167 -0
- package/dist/vercel.d.ts +6 -6
- package/dist/vercel.js +14 -6
- package/dist/version-CnXZ614E.d.ts +5 -0
- package/dist/version-DxcWdoKa.js +8 -0
- package/dist/version.d.ts +2 -4
- package/dist/version.js +2 -6
- package/dist/web-authorization-RMBxAR_t.js +76 -0
- package/dist/web-input-3EPfpf55.js +494 -0
- package/dist/work-fGofI7Op.js +509 -0
- package/dist/worker-CsOLq-mR.js +625 -0
- package/package.json +9 -9
- package/dist/agent-hooks-UXITLYOK.js +0 -51
- package/dist/catalog-runtime-BG3JLLK2.js +0 -14
- package/dist/chunk-2LYHWMR4.js +0 -46
- package/dist/chunk-2MK3QBGA.js +0 -321
- package/dist/chunk-3PGQSKJV.js +0 -692
- package/dist/chunk-3UI3WFTX.js +0 -519
- package/dist/chunk-3Y47VMHV.js +0 -6
- package/dist/chunk-4UO6FK4G.js +0 -64
- package/dist/chunk-5NOPO64K.js +0 -198
- package/dist/chunk-5PKWYPFT.js +0 -2943
- package/dist/chunk-63NKKFJL.js +0 -1228
- package/dist/chunk-6AYH6252.js +0 -787
- package/dist/chunk-6Y5B5PEX.js +0 -80
- package/dist/chunk-7DHZP5KJ.js +0 -333
- package/dist/chunk-7H2VZTWN.js +0 -103
- package/dist/chunk-7NL7T6VU.js +0 -406
- package/dist/chunk-A76OIMYN.js +0 -102
- package/dist/chunk-AWMS3SPP.js +0 -58
- package/dist/chunk-B3LY5RCL.js +0 -229
- package/dist/chunk-BD2KT3OB.js +0 -36
- package/dist/chunk-BXCX5QKA.js +0 -2086
- package/dist/chunk-C6VVF43U.js +0 -81
- package/dist/chunk-CEMMLV5L.js +0 -98
- package/dist/chunk-CM5HNV2W.js +0 -131
- package/dist/chunk-DA2KGZZI.js +0 -13
- package/dist/chunk-DBVY6HLX.js +0 -64
- package/dist/chunk-DIB4GX3G.js +0 -8
- package/dist/chunk-DKIJ2RP5.js +0 -68
- package/dist/chunk-DL2KLKVH.js +0 -931
- package/dist/chunk-DWPN6SCH.js +0 -172
- package/dist/chunk-ELWOYVOY.js +0 -206
- package/dist/chunk-EWT7H65X.js +0 -506
- package/dist/chunk-FA6POGLH.js +0 -70
- package/dist/chunk-HMREVIO2.js +0 -135
- package/dist/chunk-IIWUT4FO.js +0 -820
- package/dist/chunk-JAL3CH4G.js +0 -27
- package/dist/chunk-JSJQEWBJ.js +0 -3295
- package/dist/chunk-KHKKHDLD.js +0 -387
- package/dist/chunk-LA6R4A7Q.js +0 -706
- package/dist/chunk-LOOU2DUR.js +0 -20428
- package/dist/chunk-M6FHWXE3.js +0 -700
- package/dist/chunk-M76HMB7M.js +0 -1856
- package/dist/chunk-MAGNK5J4.js +0 -1520
- package/dist/chunk-MTM5IFCY.js +0 -1190
- package/dist/chunk-N7TMSOZH.js +0 -235
- package/dist/chunk-NHJU2ZAL.js +0 -56
- package/dist/chunk-NSXKRGRT.js +0 -717
- package/dist/chunk-OWMPFXJA.js +0 -1764
- package/dist/chunk-PDO5BLNM.js +0 -22
- package/dist/chunk-PEQXYSSE.js +0 -45
- package/dist/chunk-PW4P4JYF.js +0 -1135
- package/dist/chunk-QB54UQUS.js +0 -320
- package/dist/chunk-QP3OGJXF.js +0 -105
- package/dist/chunk-RC745GGZ.js +0 -122
- package/dist/chunk-REOIRYPR.js +0 -37
- package/dist/chunk-SCOZRLZ4.js +0 -164
- package/dist/chunk-TXJSXBV5.js +0 -1433
- package/dist/chunk-TXKUKMVO.js +0 -417
- package/dist/chunk-U2GPUYAL.js +0 -3656
- package/dist/chunk-UIE3R5XU.js +0 -17
- package/dist/chunk-UXPG6ZIN.js +0 -84
- package/dist/chunk-VFUK3X5B.js +0 -50
- package/dist/chunk-WQSHDTTI.js +0 -1163
- package/dist/chunk-X6GDDWQH.js +0 -60
- package/dist/chunk-Y2CM7HXH.js +0 -111
- package/dist/chunk-Y7X25LFY.js +0 -15
- package/dist/chunk-YDUR3ZYW.js +0 -10
- package/dist/conversation-work-VIOQ5ZF3.js +0 -54
- package/dist/db-3L2MCVRI.js +0 -26
- package/dist/discovery-DWVDM7UK.js +0 -44
- package/dist/experimental-P5FZM4CU.js +0 -12
- package/dist/oauth-callback-server-YVV6C6T2.js +0 -243
- package/dist/oauth-relay-5XPVRPYB.js +0 -8
- package/dist/plugins-YTYJMMJF.js +0 -14
- package/dist/runner-LQ7RETDP.js +0 -522
- package/dist/sandbox-egress-signals-FIL7EGPR.js +0 -73
- package/dist/sentry-MB3NL3IR.js +0 -42
- package/dist/skills-XRWYEDCD.js +0 -27
- package/dist/spawn-RC6SJUAI.js +0 -42
- package/dist/task-runner-7DY7ARYH.js +0 -36
- package/dist/validation-7MNQGCJA.js +0 -17
- package/dist/work-COALHUCG.js +0 -51
- package/dist/worker-6MURZIPD.js +0 -24
package/dist/nitro.js
CHANGED
|
@@ -1,506 +1,325 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import "./chunk-5NOPO64K.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-MAGNK5J4.js";
|
|
40
|
-
import "./chunk-PEQXYSSE.js";
|
|
41
|
-
import "./chunk-HMREVIO2.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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
58
|
-
|
|
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
|
-
|
|
64
|
-
|
|
36
|
+
const escaped = pattern.replace(/[\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
|
|
37
|
+
return new RegExp(`^${escaped}$`);
|
|
65
38
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
108
|
+
try {
|
|
109
|
+
return statSync(targetPath).isDirectory();
|
|
110
|
+
} catch {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
214
113
|
}
|
|
215
114
|
function copyIfExists(source, target) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
-
|
|
126
|
+
copyIfExists(root, resolveServerOutputPath(cwd, serverRoot, root));
|
|
239
127
|
}
|
|
240
128
|
function resolveServerOutputPath(cwd, serverRoot, sourcePath) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
-
|
|
136
|
+
return Boolean(relativePath) && !path.isAbsolute(relativePath) && relativePath !== ".." && !relativePath.startsWith(`..${path.sep}`);
|
|
255
137
|
}
|
|
256
138
|
function nodeModulesRelativePath(sourcePath) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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
|
-
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/build/virtual-config.ts
|
|
266
146
|
function renderRuntimePluginImport(module) {
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
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
|
-
|
|
314
|
-
|
|
315
|
-
|
|
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
|
-
|
|
186
|
+
return typeof value === "string" || Boolean(value && "module" in value);
|
|
318
187
|
}
|
|
319
188
|
function isPluginSet(value) {
|
|
320
|
-
|
|
321
|
-
|
|
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
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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
|
|
337
|
-
|
|
197
|
+
function dashboardEnabled(dashboard) {
|
|
198
|
+
return Boolean(dashboard && !dashboard.disabled);
|
|
338
199
|
}
|
|
339
200
|
function runtimeModuleForResolvedPluginModule(moduleRef) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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
|
-
|
|
347
|
-
|
|
348
|
-
|
|
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
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
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
|
-
|
|
505
|
-
|
|
506
|
-
};
|
|
324
|
+
//#endregion
|
|
325
|
+
export { juniorNitro };
|