trigger.dev 0.0.0-beta-20240327140635 → 0.0.0-cli-e2e-20240910161832

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 (234) hide show
  1. package/dist/esm/apiClient.d.ts +187 -0
  2. package/dist/esm/apiClient.js +231 -0
  3. package/dist/esm/apiClient.js.map +1 -0
  4. package/dist/esm/build/buildWorker.d.ts +67 -0
  5. package/dist/esm/build/buildWorker.js +156 -0
  6. package/dist/esm/build/buildWorker.js.map +1 -0
  7. package/dist/esm/build/bundle.d.ts +36 -0
  8. package/dist/esm/build/bundle.js +194 -0
  9. package/dist/esm/build/bundle.js.map +1 -0
  10. package/dist/esm/build/extensions.d.ts +15 -0
  11. package/dist/esm/build/extensions.js +158 -0
  12. package/dist/esm/build/extensions.js.map +1 -0
  13. package/dist/esm/build/externals.d.ts +13 -0
  14. package/dist/esm/build/externals.js +271 -0
  15. package/dist/esm/build/externals.js.map +1 -0
  16. package/dist/esm/build/instrumentation.d.ts +2 -0
  17. package/dist/esm/build/instrumentation.js +19 -0
  18. package/dist/esm/build/instrumentation.js.map +1 -0
  19. package/dist/esm/build/manifests.d.ts +2 -0
  20. package/dist/esm/build/manifests.js +22 -0
  21. package/dist/esm/build/manifests.js.map +1 -0
  22. package/dist/esm/build/packageModules.d.ts +18 -0
  23. package/dist/esm/build/packageModules.js +85 -0
  24. package/dist/esm/build/packageModules.js.map +1 -0
  25. package/dist/esm/build/plugins.d.ts +6 -0
  26. package/dist/esm/build/plugins.js +67 -0
  27. package/dist/esm/build/plugins.js.map +1 -0
  28. package/dist/esm/build/resolveModule.d.ts +1 -0
  29. package/dist/esm/build/resolveModule.js +9 -0
  30. package/dist/esm/build/resolveModule.js.map +1 -0
  31. package/dist/esm/cli/common.d.ts +30 -0
  32. package/dist/esm/cli/common.js +85 -0
  33. package/dist/esm/cli/common.js.map +1 -0
  34. package/dist/esm/cli/index.d.ts +2 -0
  35. package/dist/esm/cli/index.js +27 -0
  36. package/dist/esm/cli/index.js.map +1 -0
  37. package/dist/esm/commands/deploy.d.ts +5 -0
  38. package/dist/esm/commands/deploy.js +399 -0
  39. package/dist/esm/commands/deploy.js.map +1 -0
  40. package/dist/esm/commands/dev.d.ts +37 -0
  41. package/dist/esm/commands/dev.js +128 -0
  42. package/dist/esm/commands/dev.js.map +1 -0
  43. package/dist/esm/commands/init.d.ts +3 -0
  44. package/dist/esm/commands/init.js +415 -0
  45. package/dist/esm/commands/init.js.map +1 -0
  46. package/dist/esm/commands/list-profiles.d.ts +23 -0
  47. package/dist/esm/commands/list-profiles.js +40 -0
  48. package/dist/esm/commands/list-profiles.js.map +1 -0
  49. package/dist/esm/commands/login.d.ts +28 -0
  50. package/dist/esm/commands/login.js +275 -0
  51. package/dist/esm/commands/login.js.map +1 -0
  52. package/dist/esm/commands/logout.d.ts +23 -0
  53. package/dist/esm/commands/logout.js +28 -0
  54. package/dist/esm/commands/logout.js.map +1 -0
  55. package/dist/esm/commands/update.d.ts +24 -0
  56. package/dist/esm/commands/update.js +233 -0
  57. package/dist/esm/commands/update.js.map +1 -0
  58. package/dist/esm/commands/whoami.d.ts +34 -0
  59. package/dist/esm/commands/whoami.js +70 -0
  60. package/dist/esm/commands/whoami.js.map +1 -0
  61. package/dist/esm/config.d.ts +22 -0
  62. package/dist/esm/config.js +185 -0
  63. package/dist/esm/config.js.map +1 -0
  64. package/dist/esm/consts.d.ts +4 -0
  65. package/dist/esm/consts.js +5 -0
  66. package/dist/esm/consts.js.map +1 -0
  67. package/dist/esm/deploy/buildImage.d.ts +69 -0
  68. package/dist/esm/deploy/buildImage.js +472 -0
  69. package/dist/esm/deploy/buildImage.js.map +1 -0
  70. package/dist/esm/deploy/logs.d.ts +19 -0
  71. package/dist/esm/deploy/logs.js +96 -0
  72. package/dist/esm/deploy/logs.js.map +1 -0
  73. package/dist/esm/dev/backgroundWorker.d.ts +114 -0
  74. package/dist/esm/dev/backgroundWorker.js +412 -0
  75. package/dist/esm/dev/backgroundWorker.js.map +1 -0
  76. package/dist/esm/dev/devOutput.d.ts +9 -0
  77. package/dist/esm/dev/devOutput.js +137 -0
  78. package/dist/esm/dev/devOutput.js.map +1 -0
  79. package/dist/esm/dev/devSession.d.ts +17 -0
  80. package/dist/esm/dev/devSession.js +152 -0
  81. package/dist/esm/dev/devSession.js.map +1 -0
  82. package/dist/esm/dev/workerRuntime.d.ts +16 -0
  83. package/dist/esm/dev/workerRuntime.js +259 -0
  84. package/dist/esm/dev/workerRuntime.js.map +1 -0
  85. package/dist/esm/entryPoints/deploy-index-controller.d.ts +1 -0
  86. package/dist/esm/entryPoints/deploy-index-controller.js +86 -0
  87. package/dist/esm/entryPoints/deploy-index-controller.js.map +1 -0
  88. package/dist/esm/entryPoints/deploy-index-worker.d.ts +1 -0
  89. package/dist/esm/entryPoints/deploy-index-worker.js +104 -0
  90. package/dist/esm/entryPoints/deploy-index-worker.js.map +1 -0
  91. package/dist/esm/entryPoints/deploy-run-controller.d.ts +1 -0
  92. package/dist/esm/entryPoints/deploy-run-controller.js +996 -0
  93. package/dist/esm/entryPoints/deploy-run-controller.js.map +1 -0
  94. package/dist/esm/entryPoints/deploy-run-worker.d.ts +1 -0
  95. package/dist/esm/entryPoints/deploy-run-worker.js +297 -0
  96. package/dist/esm/entryPoints/deploy-run-worker.js.map +1 -0
  97. package/dist/esm/entryPoints/dev-index-worker.d.ts +1 -0
  98. package/dist/esm/entryPoints/dev-index-worker.js +104 -0
  99. package/dist/esm/entryPoints/dev-index-worker.js.map +1 -0
  100. package/dist/esm/entryPoints/dev-run-worker.d.ts +1 -0
  101. package/dist/esm/entryPoints/dev-run-worker.js +254 -0
  102. package/dist/esm/entryPoints/dev-run-worker.js.map +1 -0
  103. package/dist/esm/entryPoints/loader.d.ts +1 -0
  104. package/dist/esm/entryPoints/loader.js +16 -0
  105. package/dist/esm/entryPoints/loader.js.map +1 -0
  106. package/dist/esm/executions/taskRunProcess.d.ts +115 -0
  107. package/dist/esm/executions/taskRunProcess.js +254 -0
  108. package/dist/esm/executions/taskRunProcess.js.map +1 -0
  109. package/dist/esm/imports/magicast.d.ts +2 -0
  110. package/dist/esm/imports/magicast.js +5 -0
  111. package/dist/esm/imports/magicast.js.map +1 -0
  112. package/dist/esm/imports/xdg-app-paths.d.ts +2 -0
  113. package/dist/esm/imports/xdg-app-paths.js +3 -0
  114. package/dist/esm/imports/xdg-app-paths.js.map +1 -0
  115. package/dist/{index.d.ts → esm/index.d.ts} +1 -0
  116. package/dist/esm/index.js +17 -0
  117. package/dist/esm/index.js.map +1 -0
  118. package/dist/esm/indexing/indexWorkerManifest.d.ts +85 -0
  119. package/dist/esm/indexing/indexWorkerManifest.js +76 -0
  120. package/dist/esm/indexing/indexWorkerManifest.js.map +1 -0
  121. package/dist/esm/indexing/registerTasks.d.ts +2 -0
  122. package/dist/esm/indexing/registerTasks.js +62 -0
  123. package/dist/esm/indexing/registerTasks.js.map +1 -0
  124. package/dist/esm/package.json +3 -0
  125. package/dist/esm/runtimes/bun.d.ts +2 -0
  126. package/dist/esm/runtimes/bun.js +11 -0
  127. package/dist/esm/runtimes/bun.js.map +1 -0
  128. package/dist/esm/shims/esm.d.ts +1 -0
  129. package/dist/esm/shims/esm.js +9 -0
  130. package/dist/esm/shims/esm.js.map +1 -0
  131. package/dist/esm/sourceDir.d.ts +1 -0
  132. package/dist/esm/sourceDir.js +4 -0
  133. package/dist/esm/sourceDir.js.map +1 -0
  134. package/dist/esm/telemetry/tracing.d.ts +3 -0
  135. package/dist/esm/telemetry/tracing.js +58 -0
  136. package/dist/esm/telemetry/tracing.js.map +1 -0
  137. package/dist/esm/types.d.ts +6 -0
  138. package/dist/esm/types.js +2 -0
  139. package/dist/esm/types.js.map +1 -0
  140. package/dist/esm/utilities/assertExhaustive.d.ts +1 -0
  141. package/dist/esm/utilities/assertExhaustive.js +4 -0
  142. package/dist/esm/utilities/assertExhaustive.js.map +1 -0
  143. package/dist/esm/utilities/buildManifest.d.ts +2 -0
  144. package/dist/esm/utilities/buildManifest.js +9 -0
  145. package/dist/esm/utilities/buildManifest.js.map +1 -0
  146. package/dist/esm/utilities/cliOutput.d.ts +20 -0
  147. package/dist/esm/utilities/cliOutput.js +88 -0
  148. package/dist/esm/utilities/cliOutput.js.map +1 -0
  149. package/dist/esm/utilities/configFiles.d.ts +29 -0
  150. package/dist/esm/utilities/configFiles.js +65 -0
  151. package/dist/esm/utilities/configFiles.js.map +1 -0
  152. package/dist/esm/utilities/createFileFromTemplate.d.ts +16 -0
  153. package/dist/esm/utilities/createFileFromTemplate.js +50 -0
  154. package/dist/esm/utilities/createFileFromTemplate.js.map +1 -0
  155. package/dist/esm/utilities/deployErrors.d.ts +19 -0
  156. package/dist/esm/utilities/deployErrors.js +117 -0
  157. package/dist/esm/utilities/deployErrors.js.map +1 -0
  158. package/dist/esm/utilities/dotEnv.d.ts +4 -0
  159. package/dist/esm/utilities/dotEnv.js +28 -0
  160. package/dist/esm/utilities/dotEnv.js.map +1 -0
  161. package/dist/esm/utilities/eventBus.d.ts +14 -0
  162. package/dist/esm/utilities/eventBus.js +3 -0
  163. package/dist/esm/utilities/eventBus.js.map +1 -0
  164. package/dist/esm/utilities/fileSystem.d.ts +12 -0
  165. package/dist/esm/utilities/fileSystem.js +81 -0
  166. package/dist/esm/utilities/fileSystem.js.map +1 -0
  167. package/dist/esm/utilities/getApiKeyType.d.ts +13 -0
  168. package/dist/esm/utilities/getApiKeyType.js +44 -0
  169. package/dist/esm/utilities/getApiKeyType.js.map +1 -0
  170. package/dist/esm/utilities/initialBanner.d.ts +4 -0
  171. package/dist/esm/utilities/initialBanner.js +82 -0
  172. package/dist/esm/utilities/initialBanner.js.map +1 -0
  173. package/dist/esm/utilities/keyValueBy.d.ts +8 -0
  174. package/dist/esm/utilities/keyValueBy.js +19 -0
  175. package/dist/esm/utilities/keyValueBy.js.map +1 -0
  176. package/dist/esm/utilities/links.d.ts +9 -0
  177. package/dist/esm/utilities/links.js +10 -0
  178. package/dist/esm/utilities/links.js.map +1 -0
  179. package/dist/esm/utilities/linux.d.ts +1 -0
  180. package/dist/esm/utilities/linux.js +24 -0
  181. package/dist/esm/utilities/linux.js.map +1 -0
  182. package/dist/esm/utilities/logger.d.ts +40 -0
  183. package/dist/esm/utilities/logger.js +109 -0
  184. package/dist/esm/utilities/logger.js.map +1 -0
  185. package/dist/esm/utilities/normalizeImportPath.d.ts +1 -0
  186. package/dist/esm/utilities/normalizeImportPath.js +5 -0
  187. package/dist/esm/utilities/normalizeImportPath.js.map +1 -0
  188. package/dist/esm/utilities/obfuscateApiKey.d.ts +1 -0
  189. package/dist/esm/utilities/obfuscateApiKey.js +5 -0
  190. package/dist/esm/utilities/obfuscateApiKey.js.map +1 -0
  191. package/dist/esm/utilities/parseNameAndPath.d.ts +2 -0
  192. package/dist/esm/utilities/parseNameAndPath.js +10 -0
  193. package/dist/esm/utilities/parseNameAndPath.js.map +1 -0
  194. package/dist/esm/utilities/resolveInternalFilePath.d.ts +1 -0
  195. package/dist/esm/utilities/resolveInternalFilePath.js +8 -0
  196. package/dist/esm/utilities/resolveInternalFilePath.js.map +1 -0
  197. package/dist/esm/utilities/runtimeCheck.d.ts +8 -0
  198. package/dist/esm/utilities/runtimeCheck.js +52 -0
  199. package/dist/esm/utilities/runtimeCheck.js.map +1 -0
  200. package/dist/esm/utilities/safeJsonParse.d.ts +1 -0
  201. package/dist/esm/utilities/safeJsonParse.js +12 -0
  202. package/dist/esm/utilities/safeJsonParse.js.map +1 -0
  203. package/dist/esm/utilities/sanitizeEnvVars.d.ts +3 -0
  204. package/dist/esm/utilities/sanitizeEnvVars.js +4 -0
  205. package/dist/esm/utilities/sanitizeEnvVars.js.map +1 -0
  206. package/dist/esm/utilities/session.d.ts +33 -0
  207. package/dist/esm/utilities/session.js +82 -0
  208. package/dist/esm/utilities/session.js.map +1 -0
  209. package/dist/esm/utilities/sourceFiles.d.ts +9 -0
  210. package/dist/esm/utilities/sourceFiles.js +50 -0
  211. package/dist/esm/utilities/sourceFiles.js.map +1 -0
  212. package/dist/esm/utilities/taskFiles.d.ts +6 -0
  213. package/dist/esm/utilities/taskFiles.js +69 -0
  214. package/dist/esm/utilities/taskFiles.js.map +1 -0
  215. package/dist/esm/utilities/tempDirectories.d.ts +16 -0
  216. package/dist/esm/utilities/tempDirectories.js +27 -0
  217. package/dist/esm/utilities/tempDirectories.js.map +1 -0
  218. package/dist/esm/utilities/windows.d.ts +7 -0
  219. package/dist/esm/utilities/windows.js +21 -0
  220. package/dist/esm/utilities/windows.js.map +1 -0
  221. package/dist/esm/version.d.ts +1 -0
  222. package/dist/esm/version.js +2 -0
  223. package/dist/esm/version.js.map +1 -0
  224. package/package.json +84 -84
  225. package/dist/Containerfile.prod +0 -30
  226. package/dist/index.js +0 -5460
  227. package/dist/index.js.map +0 -1
  228. package/dist/templates/examples/simple.ts.template +0 -14
  229. package/dist/templates/trigger.config.ts.template +0 -15
  230. package/dist/workers/dev/worker-facade.js +0 -175
  231. package/dist/workers/dev/worker-setup.js +0 -40
  232. package/dist/workers/prod/entry-point.js +0 -1125
  233. package/dist/workers/prod/worker-facade.js +0 -179
  234. package/dist/workers/prod/worker-setup.js +0 -35
@@ -0,0 +1,271 @@
1
+ import { makeRe } from "minimatch";
2
+ import { mkdir, symlink } from "node:fs/promises";
3
+ import { dirname, join } from "node:path";
4
+ import { readPackageJSON, resolvePackageJSON } from "pkg-types";
5
+ import nodeResolve from "resolve";
6
+ import { getInstrumentedPackageNames } from "./instrumentation.js";
7
+ import { logger } from "../utilities/logger.js";
8
+ const FORCED_EXTERNALS = ["import-in-the-middle"];
9
+ /**
10
+ * externals in dev might not be resolvable from the worker directory
11
+ * for example, if the external is not an immediate dependency of the project
12
+ * and the project is not hoisting the dependency (e.g. pnpm, npm with nested)
13
+ *
14
+ * This function will create a symbolic link from a place where the external is resolvable
15
+ * to the actual resolved external path
16
+ */
17
+ async function linkUnresolvableExternals(externals, resolveDir, logger) {
18
+ for (const external of externals) {
19
+ if (!(await isExternalResolvable(external, resolveDir, logger))) {
20
+ await linkExternal(external, resolveDir, logger);
21
+ }
22
+ }
23
+ }
24
+ async function linkExternal(external, resolveDir, logger) {
25
+ const destinationPath = join(resolveDir, "node_modules");
26
+ await mkdir(destinationPath, { recursive: true });
27
+ logger.debug("[externals] Make a symbolic link", {
28
+ fromPath: external.path,
29
+ destinationPath,
30
+ external,
31
+ });
32
+ const symbolicLinkPath = join(destinationPath, external.name);
33
+ // Make sure the symbolic link does not exist
34
+ try {
35
+ await symlink(external.path, symbolicLinkPath, "dir");
36
+ }
37
+ catch (e) {
38
+ logger.debug("[externals] Unable to create symbolic link", {
39
+ error: e,
40
+ fromPath: external.path,
41
+ destinationPath,
42
+ external,
43
+ });
44
+ }
45
+ }
46
+ async function isExternalResolvable(external, resolveDir, logger) {
47
+ try {
48
+ const resolvedPath = nodeResolve.sync(external.name, {
49
+ basedir: resolveDir,
50
+ });
51
+ logger.debug("[externals][isExternalResolvable] Resolved external", {
52
+ resolveDir,
53
+ external,
54
+ resolvedPath,
55
+ });
56
+ if (!resolvedPath.includes(external.path)) {
57
+ logger.debug("[externals][isExternalResolvable] resolvedPath does not match the external.path", {
58
+ resolveDir,
59
+ external,
60
+ resolvedPath,
61
+ });
62
+ return false;
63
+ }
64
+ return true;
65
+ }
66
+ catch (e) {
67
+ logger.debug("[externals][isExternalResolvable] Unable to resolve external", {
68
+ resolveDir,
69
+ external,
70
+ error: e,
71
+ });
72
+ return false;
73
+ }
74
+ }
75
+ function createExternalsCollector(target, resolvedConfig) {
76
+ const externals = [];
77
+ const maybeExternals = discoverMaybeExternals(target, resolvedConfig);
78
+ return {
79
+ externals,
80
+ plugin: {
81
+ name: "externals",
82
+ setup: (build) => {
83
+ build.onStart(async () => {
84
+ externals.splice(0);
85
+ });
86
+ build.onEnd(async () => {
87
+ logger.debug("[externals][onEnd] Collected externals", { externals });
88
+ });
89
+ maybeExternals.forEach((external) => {
90
+ build.onResolve({ filter: external.filter, namespace: "file" }, async (args) => {
91
+ // Check if the external is already in the externals collection
92
+ if (externals.find((e) => e.name === external.raw)) {
93
+ return {
94
+ external: true,
95
+ };
96
+ }
97
+ const packageName = packageNameForImportPath(args.path);
98
+ try {
99
+ const resolvedPath = nodeResolve.sync(packageName, {
100
+ basedir: args.resolveDir,
101
+ });
102
+ logger.debug("[externals][onResolve] Resolved external", {
103
+ external,
104
+ resolvedPath,
105
+ args,
106
+ packageName,
107
+ });
108
+ const packageJsonPath = await resolvePackageJSON(dirname(resolvedPath));
109
+ if (!packageJsonPath) {
110
+ return undefined;
111
+ }
112
+ logger.debug("[externals][onResolve] Found package.json", {
113
+ packageJsonPath,
114
+ external,
115
+ resolvedPath,
116
+ args,
117
+ packageName,
118
+ });
119
+ const packageJson = await readPackageJSON(packageJsonPath);
120
+ if (!packageJson || !packageJson.name) {
121
+ return undefined;
122
+ }
123
+ if (!external.filter.test(packageJson.name)) {
124
+ logger.debug("[externals][onResolve] Package name does not match", {
125
+ external,
126
+ packageJson,
127
+ resolvedPath,
128
+ packageName,
129
+ });
130
+ return undefined;
131
+ }
132
+ if (!packageJson.version) {
133
+ logger.debug("[externals][onResolve] No version found in package.json", {
134
+ external,
135
+ packageJson,
136
+ resolvedPath,
137
+ });
138
+ return undefined;
139
+ }
140
+ externals.push({
141
+ name: packageName,
142
+ path: dirname(packageJsonPath),
143
+ version: packageJson.version,
144
+ });
145
+ logger.debug("[externals][onResolve] adding external to the externals collection", {
146
+ external,
147
+ resolvedPath,
148
+ args,
149
+ packageName,
150
+ resolvedExternal: {
151
+ name: packageJson.name,
152
+ path: dirname(packageJsonPath),
153
+ version: packageJson.version,
154
+ },
155
+ });
156
+ return {
157
+ external: true,
158
+ };
159
+ }
160
+ catch (error) {
161
+ logger.debug("[externals][onResolve] Unable to resolve external", {
162
+ external,
163
+ error,
164
+ args,
165
+ packageName,
166
+ });
167
+ return undefined;
168
+ }
169
+ });
170
+ });
171
+ },
172
+ },
173
+ };
174
+ }
175
+ function discoverMaybeExternals(target, config) {
176
+ const external = [];
177
+ for (const externalName of FORCED_EXTERNALS) {
178
+ const externalRegex = makeRe(externalName);
179
+ if (!externalRegex) {
180
+ continue;
181
+ }
182
+ external.push({
183
+ raw: externalName,
184
+ filter: new RegExp(`^${externalName}$|${externalRegex.source}`),
185
+ });
186
+ }
187
+ if (config.build?.external) {
188
+ for (const externalName of config.build?.external) {
189
+ const externalRegex = makeExternalRegexp(externalName);
190
+ if (!externalRegex) {
191
+ continue;
192
+ }
193
+ external.push({
194
+ raw: externalName,
195
+ filter: externalRegex,
196
+ });
197
+ }
198
+ }
199
+ for (const externalName of getInstrumentedPackageNames(config)) {
200
+ const externalRegex = makeExternalRegexp(externalName);
201
+ if (!externalRegex) {
202
+ continue;
203
+ }
204
+ external.push({
205
+ raw: externalName,
206
+ filter: externalRegex,
207
+ });
208
+ }
209
+ for (const buildExtension of config.build?.extensions ?? []) {
210
+ const moduleExternals = buildExtension.externalsForTarget?.(target);
211
+ for (const externalName of moduleExternals ?? []) {
212
+ const externalRegex = makeExternalRegexp(externalName);
213
+ if (!externalRegex) {
214
+ continue;
215
+ }
216
+ external.push({
217
+ raw: externalName,
218
+ filter: externalRegex,
219
+ });
220
+ }
221
+ }
222
+ return external;
223
+ }
224
+ export function createExternalsBuildExtension(target, config) {
225
+ const { externals, plugin } = createExternalsCollector(target, config);
226
+ return {
227
+ name: "externals",
228
+ onBuildStart(context) {
229
+ context.registerPlugin(plugin, {
230
+ target,
231
+ // @ts-expect-error
232
+ placement: "$head", // cheat to get to the front of the plugins
233
+ });
234
+ },
235
+ onBuildComplete: async (context, manifest) => {
236
+ if (context.target === "dev") {
237
+ await linkUnresolvableExternals(externals, manifest.outputPath, context.logger);
238
+ }
239
+ context.addLayer({
240
+ id: "externals",
241
+ dependencies: externals.reduce((acc, external) => {
242
+ acc[external.name] = external.version;
243
+ return acc;
244
+ }, {}),
245
+ });
246
+ },
247
+ };
248
+ }
249
+ function makeExternalRegexp(packageName) {
250
+ // Escape special regex characters in the package name
251
+ const escapedPkg = packageName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
252
+ // Create the regex pattern
253
+ const pattern = `^${escapedPkg}(?:/[^'"]*)?$`;
254
+ return new RegExp(pattern);
255
+ }
256
+ function packageNameForImportPath(importPath) {
257
+ // Remove any leading '@' to handle it separately
258
+ const withoutAtSign = importPath.replace(/^@/, "");
259
+ // Split the path by '/'
260
+ const parts = withoutAtSign.split("/");
261
+ // Handle scoped packages
262
+ if (importPath.startsWith("@")) {
263
+ // Return '@org/package' for scoped packages
264
+ return "@" + parts.slice(0, 2).join("/");
265
+ }
266
+ else {
267
+ // Return just the first part for non-scoped packages
268
+ return parts[0];
269
+ }
270
+ }
271
+ //# sourceMappingURL=externals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externals.js","sourceRoot":"","sources":["../../../src/build/externals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,WAAW,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,gBAAgB,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAElD;;;;;;;GAOG;AACH,KAAK,UAAU,yBAAyB,CACtC,SAAmC,EACnC,UAAkB,EAClB,MAAmB;IAEnB,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,CAAC,MAAM,oBAAoB,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;YAChE,MAAM,YAAY,CAAC,QAAQ,EAAE,UAAU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AAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,4CAA4C;QAC5C,OAAO,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;SAAM,CAAC;QACN,qDAAqD;QACrD,OAAO,KAAK,CAAC,CAAC,CAAW,CAAC;IAC5B,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ResolvedConfig } from "@trigger.dev/core/v3/build";
2
+ export declare function getInstrumentedPackageNames(config: ResolvedConfig): Array<string>;
@@ -0,0 +1,19 @@
1
+ import { builtinModules } from "node:module";
2
+ export function getInstrumentedPackageNames(config) {
3
+ const packageNames = [];
4
+ if (config.instrumentations) {
5
+ for (const instrumentation of config.instrumentations) {
6
+ const moduleDefinitions = instrumentation.getModuleDefinitions?.();
7
+ if (!Array.isArray(moduleDefinitions)) {
8
+ continue;
9
+ }
10
+ for (const moduleDefinition of moduleDefinitions) {
11
+ if (!builtinModules.includes(moduleDefinition.name)) {
12
+ packageNames.push(moduleDefinition.name);
13
+ }
14
+ }
15
+ }
16
+ }
17
+ return packageNames;
18
+ }
19
+ //# sourceMappingURL=instrumentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../src/build/instrumentation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,UAAU,2BAA2B,CACzC,MAAsB;IAEtB,MAAM,YAAY,GAAG,EAAE,CAAC;IAExB,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC5B,KAAK,MAAM,eAAe,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACtD,MAAM,iBAAiB,GACrB,eACD,CAAC,oBAAoB,EAAE,EAA4C,CAAC;YAErE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBACtC,SAAQ;YACV,CAAC;YAED,KAAK,MAAM,gBAAgB,IAAI,iBAAiB,EAAE,CAAC;gBACjD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpD,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { BuildManifest } from "@trigger.dev/core/v3/schemas";
2
+ export declare function copyManifestToDir(manifest: BuildManifest, source: string, destination: string): Promise<BuildManifest>;
@@ -0,0 +1,22 @@
1
+ import { cp } from "node:fs/promises";
2
+ import { logger } from "../utilities/logger.js";
3
+ export async function copyManifestToDir(manifest, source, destination) {
4
+ // Copy the dir in destination to workerDir
5
+ await cp(source, destination, { recursive: true });
6
+ logger.debug("Copied manifest to dir", { source, destination });
7
+ // Then update the manifest to point to the new workerDir
8
+ const updatedManifest = { ...manifest };
9
+ updatedManifest.configPath = updatedManifest.configPath.replace(source, destination);
10
+ updatedManifest.loaderEntryPoint = updatedManifest.loaderEntryPoint?.replace(source, destination);
11
+ updatedManifest.runWorkerEntryPoint = updatedManifest.runWorkerEntryPoint.replace(source, destination);
12
+ updatedManifest.indexWorkerEntryPoint = updatedManifest.indexWorkerEntryPoint.replace(source, destination);
13
+ updatedManifest.files = updatedManifest.files.map((file) => {
14
+ return {
15
+ ...file,
16
+ out: file.out.replace(source, destination),
17
+ };
18
+ });
19
+ updatedManifest.outputPath = destination;
20
+ return updatedManifest;
21
+ }
22
+ //# sourceMappingURL=manifests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifests.js","sourceRoot":"","sources":["../../../src/build/manifests.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAuB,EACvB,MAAc,EACd,WAAmB;IAEnB,2CAA2C;IAC3C,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEnD,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IAEhE,yDAAyD;IACzD,MAAM,eAAe,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;IAExC,eAAe,CAAC,UAAU,GAAG,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACrF,eAAe,CAAC,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,EAAE,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAClG,eAAe,CAAC,mBAAmB,GAAG,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAC/E,MAAM,EACN,WAAW,CACZ,CAAC;IACF,eAAe,CAAC,qBAAqB,GAAG,eAAe,CAAC,qBAAqB,CAAC,OAAO,CACnF,MAAM,EACN,WAAW,CACZ,CAAC;IAEF,eAAe,CAAC,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACzD,OAAO;YACL,GAAG,IAAI;YACP,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC;SAC3C,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,eAAe,CAAC,UAAU,GAAG,WAAW,CAAC;IAEzC,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { BuildTarget } from "@trigger.dev/core/v3";
2
+ export declare const devRunWorker: string;
3
+ export declare const devIndexWorker: string;
4
+ export declare const deployRunController: string;
5
+ export declare const deployRunWorker: string;
6
+ export declare const deployIndexController: string;
7
+ export declare const deployIndexWorker: string;
8
+ export declare const telemetryEntryPoint: string;
9
+ export declare const devEntryPoints: string[];
10
+ export declare const deployEntryPoints: string[];
11
+ export declare const esmShimPath: string;
12
+ export declare const shims: string[];
13
+ export declare function isLoaderEntryPoint(entryPoint: string): boolean;
14
+ export declare function isRunWorkerForTarget(entryPoint: string, target: BuildTarget): boolean;
15
+ export declare function isRunControllerForTarget(entryPoint: string, target: BuildTarget): boolean;
16
+ export declare function isIndexWorkerForTarget(entryPoint: string, target: BuildTarget): boolean;
17
+ export declare function isIndexControllerForTarget(entryPoint: string, target: BuildTarget): boolean;
18
+ export declare function isConfigEntryPoint(entryPoint: string): boolean;
@@ -0,0 +1,85 @@
1
+ import { join } from "node:path";
2
+ import { sourceDir } from "../sourceDir.js";
3
+ export const devRunWorker = join(sourceDir, "entryPoints", "dev-run-worker.js");
4
+ export const devIndexWorker = join(sourceDir, "entryPoints", "dev-index-worker.js");
5
+ export const deployRunController = join(sourceDir, "entryPoints", "deploy-run-controller.js");
6
+ export const deployRunWorker = join(sourceDir, "entryPoints", "deploy-run-worker.js");
7
+ export const deployIndexController = join(sourceDir, "entryPoints", "deploy-index-controller.js");
8
+ export const deployIndexWorker = join(sourceDir, "entryPoints", "deploy-index-worker.js");
9
+ export const telemetryEntryPoint = join(sourceDir, "entryPoints", "loader.js");
10
+ export const devEntryPoints = [devRunWorker, devIndexWorker, telemetryEntryPoint];
11
+ export const deployEntryPoints = [
12
+ deployRunController,
13
+ deployRunWorker,
14
+ deployIndexController,
15
+ deployIndexWorker,
16
+ telemetryEntryPoint,
17
+ ];
18
+ export const esmShimPath = join(sourceDir, "shims", "esm.js");
19
+ export const shims = [esmShimPath];
20
+ // IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
21
+ function isDevRunWorker(entryPoint) {
22
+ return (entryPoint.includes("dist/esm/entryPoints/dev-run-worker.js") ||
23
+ entryPoint.includes("src/entryPoints/dev-run-worker.ts"));
24
+ }
25
+ // IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
26
+ function isDevIndexWorker(entryPoint) {
27
+ return (entryPoint.includes("dist/esm/entryPoints/dev-index-worker.js") ||
28
+ entryPoint.includes("src/entryPoints/dev-index-worker.ts"));
29
+ }
30
+ // IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
31
+ function isDeployIndexController(entryPoint) {
32
+ return (entryPoint.includes("dist/esm/entryPoints/deploy-index-controller.js") ||
33
+ entryPoint.includes("src/entryPoints/deploy-index-controller.ts"));
34
+ }
35
+ // IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
36
+ function isDeployIndexWorker(entryPoint) {
37
+ return (entryPoint.includes("dist/esm/entryPoints/deploy-index-worker.js") ||
38
+ entryPoint.includes("src/entryPoints/deploy-index-worker.ts"));
39
+ }
40
+ function isDeployRunController(entryPoint) {
41
+ return (entryPoint.includes("dist/esm/entryPoints/deploy-run-controller.js") ||
42
+ entryPoint.includes("src/entryPoints/deploy-run-controller.ts"));
43
+ }
44
+ // IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
45
+ function isDeployRunWorker(entryPoint) {
46
+ return (entryPoint.includes("dist/esm/entryPoints/deploy-run-worker.js") ||
47
+ entryPoint.includes("src/entryPoints/deploy-run-worker.ts"));
48
+ }
49
+ // IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
50
+ export function isLoaderEntryPoint(entryPoint) {
51
+ return (entryPoint.includes("dist/esm/entryPoints/loader.js") ||
52
+ entryPoint.includes("src/entryPoints/loader.ts"));
53
+ }
54
+ export function isRunWorkerForTarget(entryPoint, target) {
55
+ if (target === "dev") {
56
+ return isDevRunWorker(entryPoint);
57
+ }
58
+ else {
59
+ return isDeployRunWorker(entryPoint);
60
+ }
61
+ }
62
+ export function isRunControllerForTarget(entryPoint, target) {
63
+ if (target === "deploy") {
64
+ return isDeployRunController(entryPoint);
65
+ }
66
+ return false;
67
+ }
68
+ export function isIndexWorkerForTarget(entryPoint, target) {
69
+ if (target === "dev") {
70
+ return isDevIndexWorker(entryPoint);
71
+ }
72
+ else {
73
+ return isDeployIndexWorker(entryPoint);
74
+ }
75
+ }
76
+ export function isIndexControllerForTarget(entryPoint, target) {
77
+ if (target === "deploy") {
78
+ return isDeployIndexController(entryPoint);
79
+ }
80
+ return false;
81
+ }
82
+ export function isConfigEntryPoint(entryPoint) {
83
+ return entryPoint.startsWith("trigger.config.ts");
84
+ }
85
+ //# sourceMappingURL=packageModules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageModules.js","sourceRoot":"","sources":["../../../src/build/packageModules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;AAChF,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,qBAAqB,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,0BAA0B,CAAC,CAAC;AAC9F,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,sBAAsB,CAAC,CAAC;AACtF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,4BAA4B,CAAC,CAAC;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,wBAAwB,CAAC,CAAC;AAE1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,YAAY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pD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import * as esbuild from "esbuild";
2
+ import { BuildTarget } from "@trigger.dev/core/v3/schemas";
3
+ import { ResolvedConfig } from "@trigger.dev/core/v3/build";
4
+ export declare function buildPlugins(target: BuildTarget, resolvedConfig: ResolvedConfig): Promise<esbuild.Plugin[]>;
5
+ export declare function analyzeMetadataPlugin(): esbuild.Plugin;
6
+ export declare function polyshedPlugin(): esbuild.Plugin;
@@ -0,0 +1,67 @@
1
+ import * as esbuild from "esbuild";
2
+ import { configPlugin } from "../config.js";
3
+ import { logger } from "../utilities/logger.js";
4
+ import { bunPlugin } from "../runtimes/bun.js";
5
+ export async function buildPlugins(target, resolvedConfig) {
6
+ logger.debug("Building plugins for target", target);
7
+ const plugins = [];
8
+ const $configPlugin = configPlugin(resolvedConfig);
9
+ if ($configPlugin) {
10
+ plugins.push($configPlugin);
11
+ }
12
+ plugins.push(polyshedPlugin());
13
+ if (resolvedConfig.runtime === "bun") {
14
+ plugins.push(bunPlugin());
15
+ }
16
+ return plugins;
17
+ }
18
+ export function analyzeMetadataPlugin() {
19
+ return {
20
+ name: "analyze-metafile",
21
+ setup(build) {
22
+ build.onEnd(async (result) => {
23
+ if (!result.metafile) {
24
+ return;
25
+ }
26
+ console.log(await esbuild.analyzeMetafile(result.metafile, {
27
+ verbose: true,
28
+ }));
29
+ });
30
+ },
31
+ };
32
+ }
33
+ const polysheds = [
34
+ {
35
+ moduleName: "server-only",
36
+ code: "export default true;",
37
+ },
38
+ ];
39
+ export function polyshedPlugin() {
40
+ return {
41
+ name: "polyshed",
42
+ setup(build) {
43
+ for (const polyshed of polysheds) {
44
+ build.onResolve({ filter: new RegExp(`^${polyshed.moduleName}$`) }, (args) => {
45
+ if (args.path !== polyshed.moduleName) {
46
+ return undefined;
47
+ }
48
+ return {
49
+ path: args.path,
50
+ external: false,
51
+ namespace: `polyshed-${polyshed.moduleName}`,
52
+ };
53
+ });
54
+ build.onLoad({
55
+ filter: new RegExp(`^${polyshed.moduleName}$`),
56
+ namespace: `polyshed-${polyshed.moduleName}`,
57
+ }, (args) => {
58
+ return {
59
+ contents: polyshed.code,
60
+ loader: "js",
61
+ };
62
+ });
63
+ }
64
+ },
65
+ };
66
+ }
67
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/build/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAmB,EACnB,cAA8B;IAE9B,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAqB,EAAE,CAAC;IAErC,MAAM,aAAa,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;IAEnD,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAE/B,IAAI,cAAc,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,KAAK,CAAC,KAAK;YACT,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;oBACrB,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,GAAG,CACT,M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
+ // @ts-ignore
2
+ import { resolvePath } from "mlly";
3
+ export function resolveModule(moduleName, url) {
4
+ return resolvePath(moduleName, {
5
+ // @ts-ignore
6
+ url: url ?? import.meta.url,
7
+ });
8
+ }
9
+ //# sourceMappingURL=resolveModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveModule.js","sourceRoot":"","sources":["../../../src/build/resolveModule.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,MAAM,UAAU,aAAa,CAAC,UAAkB,EAAE,GAAY;IAC5D,OAAO,WAAW,CAAC,UAAU,EAAE;QAC7B,aAAa;QACb,GAAG,EAAE,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG;KAC5B,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Command } from "commander";
2
+ import { z } from "zod";
3
+ export declare const CommonCommandOptions: z.ZodObject<{
4
+ apiUrl: z.ZodOptional<z.ZodString>;
5
+ logLevel: z.ZodDefault<z.ZodEnum<["debug", "info", "log", "warn", "error", "none"]>>;
6
+ skipTelemetry: z.ZodDefault<z.ZodBoolean>;
7
+ profile: z.ZodDefault<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ logLevel: "error" | "log" | "debug" | "info" | "warn" | "none";
10
+ skipTelemetry: boolean;
11
+ profile: string;
12
+ apiUrl?: string | undefined;
13
+ }, {
14
+ apiUrl?: string | undefined;
15
+ logLevel?: "error" | "log" | "debug" | "info" | "warn" | "none" | undefined;
16
+ skipTelemetry?: boolean | undefined;
17
+ profile?: string | undefined;
18
+ }>;
19
+ export type CommonCommandOptions = z.infer<typeof CommonCommandOptions>;
20
+ export declare function commonOptions(command: Command): Command;
21
+ export declare class SkipLoggingError extends Error {
22
+ }
23
+ export declare class SkipCommandError extends Error {
24
+ }
25
+ export declare class OutroCommandError extends SkipCommandError {
26
+ }
27
+ export declare function handleTelemetry(action: () => Promise<void>): Promise<void>;
28
+ export declare const tracer: import("@opentelemetry/api").Tracer;
29
+ export declare function wrapCommandAction<T extends z.AnyZodObject, TResult>(name: string, schema: T, options: unknown, action: (opts: z.output<T>) => Promise<TResult>): Promise<TResult>;
30
+ export declare function installExitHandler(): void;