@mastra/deployer 1.58.0-alpha.13 → 1.58.0-alpha.14
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/CHANGELOG.md +8 -0
- package/dist/build/types.d.ts +0 -6
- package/dist/build/types.d.ts.map +1 -1
- package/dist/bundler/index.cjs +508 -6
- package/dist/bundler/index.cjs.map +1 -0
- package/dist/bundler/index.d.ts +1 -1
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +499 -1
- package/dist/bundler/index.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-deployment-cloud-providers.md +9 -9
- package/dist/docs/references/docs-deployment-overview.md +9 -9
- package/dist/docs/references/docs-deployment-web-framework.md +6 -6
- package/dist/docs/references/docs-deployment-workflow-runners.md +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -5
- package/dist/bundler/entries.d.ts +0 -12
- package/dist/bundler/entries.d.ts.map +0 -1
- package/dist/bundler-Ct1ToG6x.js +0 -565
- package/dist/bundler-Ct1ToG6x.js.map +0 -1
- package/dist/bundler-DLXwkS7b.cjs +0 -598
- package/dist/bundler-DLXwkS7b.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @mastra/deployer
|
|
2
2
|
|
|
3
|
+
## 1.58.0-alpha.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`210cb7a`](https://github.com/mastra-ai/mastra/commit/210cb7a167998c7bbf72cb3b93e6eb0563330239), [`5f798b3`](https://github.com/mastra-ai/mastra/commit/5f798b3362e9bdf4d690f85245606e146eef60b9), [`01a2943`](https://github.com/mastra-ai/mastra/commit/01a2943a7d886edefdff072bfa51f055bab54437), [`01a2943`](https://github.com/mastra-ai/mastra/commit/01a2943a7d886edefdff072bfa51f055bab54437), [`25ca73d`](https://github.com/mastra-ai/mastra/commit/25ca73d25dee7ce9f0ca72939e3a505c4db7257e), [`e1cead1`](https://github.com/mastra-ai/mastra/commit/e1cead17b5f3653cf00d2f90cc19b113119c02ba), [`01a2943`](https://github.com/mastra-ai/mastra/commit/01a2943a7d886edefdff072bfa51f055bab54437)]:
|
|
8
|
+
- @mastra/core@1.58.0-alpha.14
|
|
9
|
+
- @mastra/server@1.58.0-alpha.14
|
|
10
|
+
|
|
3
11
|
## 1.58.0-alpha.13
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/build/types.d.ts
CHANGED
|
@@ -34,12 +34,6 @@ export interface BundlerOptions {
|
|
|
34
34
|
enableEsmShim: boolean;
|
|
35
35
|
externals: boolean | string[];
|
|
36
36
|
dynamicPackages?: string[];
|
|
37
|
-
/**
|
|
38
|
-
* Extra process entries to emit beside the server bundle, as output name ->
|
|
39
|
-
* absolute source path. Already resolved and validated against the user's
|
|
40
|
-
* `bundler.entries` config; see `resolveExtraEntries`.
|
|
41
|
-
*/
|
|
42
|
-
entries?: Record<string, string>;
|
|
43
37
|
}
|
|
44
38
|
/**
|
|
45
39
|
* Version information for an external dependency
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/build/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/build/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,7 +1,509 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
const require_rolldown_runtime = require("../rolldown-runtime-emK7D4bc.cjs");
|
|
3
|
+
const require_analyze = require("../analyze-BIrkd7zx.cjs");
|
|
4
|
+
const require_utils = require("../utils-O98BGdnP.cjs");
|
|
5
|
+
const require_services = require("../services-_ksvysL5.cjs");
|
|
6
|
+
const require_bundler = require("../bundler-DCGtF4jP.cjs");
|
|
7
|
+
const require_bundlerOptions = require("../bundlerOptions-CjjAPZYp.cjs");
|
|
8
|
+
let child_process = require("child_process");
|
|
9
|
+
let fs = require("fs");
|
|
10
|
+
let fs_promises = require("fs/promises");
|
|
11
|
+
let path = require("path");
|
|
12
|
+
let _mastra_core_bundler = require("@mastra/core/bundler");
|
|
13
|
+
let _mastra_core_error = require("@mastra/core/error");
|
|
14
|
+
let _rollup_plugin_virtual = require("@rollup/plugin-virtual");
|
|
15
|
+
_rollup_plugin_virtual = require_rolldown_runtime.__toESM(_rollup_plugin_virtual, 1);
|
|
16
|
+
let empathic_package = require("empathic/package");
|
|
17
|
+
empathic_package = require_rolldown_runtime.__toESM(empathic_package, 1);
|
|
18
|
+
let fs_extra_esm = require("fs-extra/esm");
|
|
19
|
+
fs_extra_esm = require_rolldown_runtime.__toESM(fs_extra_esm, 1);
|
|
20
|
+
let tinyglobby = require("tinyglobby");
|
|
21
|
+
//#region src/bundler/index.ts
|
|
22
|
+
const IS_DEFAULT = Symbol("IS_DEFAULT");
|
|
23
|
+
const NPM_ALIAS_PREFIX = "npm:";
|
|
24
|
+
/** Characters a registry range or dist tag can contain. Protocols need `:`, git shorthand needs `/` or `#`. */
|
|
25
|
+
const REGISTRY_SPEC_PATTERN = /^[A-Za-z0-9.+_^~><=*|!\s-]+$/;
|
|
26
|
+
const PACKAGE_NAME_PATTERN = /^(?:@[A-Za-z0-9._-]+\/)?[A-Za-z0-9._-]+$/;
|
|
27
|
+
const TARBALL_SUFFIX_PATTERN = /\.(?:tgz|tar\.gz|tar)$/i;
|
|
28
|
+
/** npm reads a value starting like this as a path, whatever follows. A bare `~` is a semver range. */
|
|
29
|
+
const FILE_SPEC_PREFIX_PATTERN = /^(?:\.|~[/\\]|[/\\]|[A-Za-z]:[/\\])/;
|
|
30
|
+
/** A range admitting any published version: `*`, `x`, `>=0`, and any union containing one. */
|
|
31
|
+
const UNBOUNDED_RANGE_PATTERN = /(?:^|\|\||\s)\s*(?:[*xX]|>=?\s*0(?:\.0)*(?:\.0)*)\s*(?:$|\|\|)/;
|
|
32
|
+
const toStringRecord = (value) => {
|
|
33
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
34
|
+
return Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"));
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* True when a specifier is something the isolated install in `.mastra/output` can resolve from the
|
|
38
|
+
* registry: a semver range, a dist tag, a wildcard, or an npm alias whose target is a registry
|
|
39
|
+
* package and range.
|
|
40
|
+
*
|
|
41
|
+
* This is an allowlist rather than a denylist of known protocols, so an unfamiliar protocol is
|
|
42
|
+
* rejected without this code having to know it exists. The output directory is not a workspace, has
|
|
43
|
+
* no catalog definitions and has a different relative-path base, so `catalog:`, `workspace:`,
|
|
44
|
+
* `file:`, `link:` and git specifiers are all either uninstallable there or point somewhere else.
|
|
45
|
+
*/
|
|
46
|
+
const isRegistryVersionSpec = (spec) => {
|
|
47
|
+
if (FILE_SPEC_PREFIX_PATTERN.test(spec) || TARBALL_SUFFIX_PATTERN.test(spec)) return false;
|
|
48
|
+
if (spec.startsWith(NPM_ALIAS_PREFIX)) {
|
|
49
|
+
const alias = spec.slice(4);
|
|
50
|
+
const rangeSeparator = alias.lastIndexOf("@");
|
|
51
|
+
const name = rangeSeparator > 0 ? alias.slice(0, rangeSeparator) : alias;
|
|
52
|
+
const range = rangeSeparator > 0 ? alias.slice(rangeSeparator + 1) : "*";
|
|
53
|
+
return PACKAGE_NAME_PATTERN.test(name) && isRegistryVersionSpec(range);
|
|
54
|
+
}
|
|
55
|
+
return REGISTRY_SPEC_PATTERN.test(spec);
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* True when a specifier names a version the output install can be held to.
|
|
59
|
+
*
|
|
60
|
+
* A range admitting anything (`*`, `latest`, `>=0`, an alias with no range) is looser than the
|
|
61
|
+
* version already resolved, so writing it would let a later install pull something the bundle was
|
|
62
|
+
* never analyzed against.
|
|
63
|
+
*/
|
|
64
|
+
const isBoundedVersionSpec = (spec) => {
|
|
65
|
+
const range = spec.startsWith(NPM_ALIAS_PREFIX) ? (() => {
|
|
66
|
+
const alias = spec.slice(4);
|
|
67
|
+
const rangeSeparator = alias.lastIndexOf("@");
|
|
68
|
+
return rangeSeparator > 0 ? alias.slice(rangeSeparator + 1) : "";
|
|
69
|
+
})() : spec;
|
|
70
|
+
return /\d/.test(range) && !UNBOUNDED_RANGE_PATTERN.test(range);
|
|
71
|
+
};
|
|
72
|
+
const readManifest = async (manifestPath) => {
|
|
73
|
+
if (!manifestPath) return;
|
|
74
|
+
try {
|
|
75
|
+
const manifest = await (0, fs_extra_esm.readJSON)(manifestPath);
|
|
76
|
+
return manifest && typeof manifest === "object" ? manifest : void 0;
|
|
77
|
+
} catch {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
/** Collect the package names a manifest's resolution fields pin, ignoring their values. */
|
|
82
|
+
const collectManifestPinnedNames = (manifest, pinned) => {
|
|
83
|
+
const pnpmSection = manifest?.pnpm;
|
|
84
|
+
const records = [
|
|
85
|
+
manifest?.overrides,
|
|
86
|
+
manifest?.resolutions,
|
|
87
|
+
pnpmSection && typeof pnpmSection === "object" ? pnpmSection.overrides : void 0
|
|
88
|
+
];
|
|
89
|
+
for (const record of records) if (record && typeof record === "object" && !Array.isArray(record)) for (const key of Object.keys(record)) pinned.add(key);
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Collect the names under a top-level `overrides:` block in `pnpm-workspace.yaml`.
|
|
93
|
+
*
|
|
94
|
+
* pnpm moved overrides out of `package.json` into this file, so a workspace on a current pnpm keeps
|
|
95
|
+
* them only here. Reading names off the indented block avoids a YAML dependency, the same tradeoff
|
|
96
|
+
* `copyPnpmWorkspaceSettings` already makes for the top-level keys it copies.
|
|
97
|
+
*/
|
|
98
|
+
const collectPnpmWorkspacePinnedNames = (source, pinned) => {
|
|
99
|
+
const lines = source.split(/\r?\n/);
|
|
100
|
+
let insideOverrides = false;
|
|
101
|
+
for (const line of lines) {
|
|
102
|
+
if (/^\S/.test(line)) {
|
|
103
|
+
insideOverrides = /^overrides:\s*$/.test(line);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (!insideOverrides) continue;
|
|
107
|
+
const key = /^\s+(?:'([^']+)'|"([^"]+)"|([^'"\s:][^:]*?))\s*:/.exec(line);
|
|
108
|
+
if (key) pinned.add((key[1] ?? key[2] ?? key[3] ?? "").trim());
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Read the constraints the source app declared.
|
|
113
|
+
*
|
|
114
|
+
* `dependencies` come from the manifest at `projectRoot`, the package the build was invoked for and
|
|
115
|
+
* whose directory receives the output, falling back to the manifest above the entry file. Anchoring
|
|
116
|
+
* on `projectRoot` rather than the entry file keeps the answer deterministic when the entry handed
|
|
117
|
+
* to the bundler is a generated wrapper rather than the app's own source file.
|
|
118
|
+
*
|
|
119
|
+
* Resolution-field names are collected from both that manifest and the workspace root, including the
|
|
120
|
+
* root `pnpm-workspace.yaml`, because a name pinned anywhere means the resolved version may have been
|
|
121
|
+
* chosen deliberately rather than hoisted by accident.
|
|
122
|
+
*/
|
|
123
|
+
const getSourceDependencyConstraints = async ({ projectRoot, mastraEntryFile, workspaceRoot }) => {
|
|
124
|
+
const manifestPaths = [empathic_package.up({ cwd: projectRoot }), empathic_package.up({ cwd: (0, path.dirname)(mastraEntryFile) })].filter((entry, index, entries) => !!entry && entries.indexOf(entry) === index);
|
|
125
|
+
if (workspaceRoot) manifestPaths.push((0, path.join)(workspaceRoot, "package.json"));
|
|
126
|
+
const pinnedByResolutionField = /* @__PURE__ */ new Set();
|
|
127
|
+
let dependencies;
|
|
128
|
+
for (const manifestPath of manifestPaths) {
|
|
129
|
+
const manifest = await readManifest(manifestPath);
|
|
130
|
+
if (!manifest) continue;
|
|
131
|
+
dependencies ??= toStringRecord(manifest.dependencies);
|
|
132
|
+
collectManifestPinnedNames(manifest, pinnedByResolutionField);
|
|
133
|
+
}
|
|
134
|
+
if (workspaceRoot) try {
|
|
135
|
+
collectPnpmWorkspacePinnedNames(await (0, fs_promises.readFile)((0, path.join)(workspaceRoot, "pnpm-workspace.yaml"), "utf-8"), pinnedByResolutionField);
|
|
136
|
+
} catch {}
|
|
137
|
+
return {
|
|
138
|
+
dependencies: dependencies ?? {},
|
|
139
|
+
pinnedByResolutionField
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
const findDeclaredConstraint = (constraints, dependencyName) => {
|
|
143
|
+
const names = [dependencyName, require_utils.getPackageName(dependencyName)].filter((name, index, all) => !!name && all.indexOf(name) === index);
|
|
144
|
+
for (const name of names) if (constraints.pinnedByResolutionField.has(name)) return;
|
|
145
|
+
for (const name of names) {
|
|
146
|
+
const declared = (constraints.dependencies[name] ?? "").trim();
|
|
147
|
+
if (declared && isBoundedVersionSpec(declared) && isRegistryVersionSpec(declared)) return declared;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Prefer the constraint the app declared over the version resolved from `node_modules`.
|
|
152
|
+
*
|
|
153
|
+
* The resolved version is whatever the install happened to hoist, so an app declaring `zod: ^4.3.6`
|
|
154
|
+
* next to a hoisted `zod@3.25.76` gets the hoisted version written into the output manifest and the
|
|
155
|
+
* isolated install then locks it in.
|
|
156
|
+
*/
|
|
157
|
+
const applySourceDependencyRange = (dependencyName, dependencyInfo, constraints) => {
|
|
158
|
+
const declared = findDeclaredConstraint(constraints, dependencyName);
|
|
159
|
+
if (!declared) return dependencyInfo;
|
|
160
|
+
if (declared.startsWith(NPM_ALIAS_PREFIX)) return {
|
|
161
|
+
...dependencyInfo,
|
|
162
|
+
packageSpec: declared
|
|
163
|
+
};
|
|
164
|
+
if (dependencyInfo.packageSpec) return dependencyInfo;
|
|
165
|
+
return {
|
|
166
|
+
...dependencyInfo,
|
|
167
|
+
version: declared
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
var Bundler = class extends _mastra_core_bundler.MastraBundler {
|
|
171
|
+
analyzeOutputDir = ".build";
|
|
172
|
+
outputDir = "output";
|
|
173
|
+
platform = "node";
|
|
174
|
+
constructor(name, component = "BUNDLER") {
|
|
175
|
+
super({
|
|
176
|
+
name,
|
|
177
|
+
component
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async prepare(outputDirectory) {
|
|
181
|
+
await (0, fs_extra_esm.emptyDir)(outputDirectory);
|
|
182
|
+
await (0, fs_extra_esm.ensureDir)((0, path.join)(outputDirectory, this.analyzeOutputDir));
|
|
183
|
+
await (0, fs_extra_esm.ensureDir)((0, path.join)(outputDirectory, this.outputDir));
|
|
184
|
+
}
|
|
185
|
+
async writePackageJson(outputDirectory, dependencies, resolutions) {
|
|
186
|
+
this.logger.debug("Writing project's package.json");
|
|
187
|
+
await (0, fs_extra_esm.ensureDir)(outputDirectory);
|
|
188
|
+
const pkgPath = (0, path.join)(outputDirectory, "package.json");
|
|
189
|
+
const dependenciesMap = /* @__PURE__ */ new Map();
|
|
190
|
+
for (const [key, value] of dependencies.entries()) {
|
|
191
|
+
const dependencyValue = typeof value === "string" ? value : value.packageSpec ?? value.version ?? "latest";
|
|
192
|
+
if (key.startsWith("@")) {
|
|
193
|
+
const pkgChunks = key.split("/");
|
|
194
|
+
dependenciesMap.set(`${pkgChunks[0]}/${pkgChunks[1]}`, dependencyValue);
|
|
195
|
+
} else {
|
|
196
|
+
const pkgName = key.split("/")[0] || key;
|
|
197
|
+
dependenciesMap.set(pkgName, dependencyValue);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
await (0, fs_promises.writeFile)(pkgPath, JSON.stringify({
|
|
201
|
+
name: "server",
|
|
202
|
+
version: "1.0.0",
|
|
203
|
+
private: true,
|
|
204
|
+
type: "module",
|
|
205
|
+
main: "index.mjs",
|
|
206
|
+
scripts: { start: "node ./index.mjs" },
|
|
207
|
+
dependencies: Object.fromEntries(dependenciesMap.entries()),
|
|
208
|
+
...Object.keys(resolutions ?? {}).length > 0 && { resolutions }
|
|
209
|
+
}, null, 2));
|
|
210
|
+
}
|
|
211
|
+
createBundler(inputOptions, outputOptions) {
|
|
212
|
+
return require_bundler.createBundler(inputOptions, outputOptions);
|
|
213
|
+
}
|
|
214
|
+
async getUserBundlerOptions(mastraEntryFile, outputDirectory) {
|
|
215
|
+
const defaultBundlerOptions = {
|
|
216
|
+
externals: [],
|
|
217
|
+
sourcemap: false,
|
|
218
|
+
transpilePackages: [],
|
|
219
|
+
[IS_DEFAULT]: true
|
|
220
|
+
};
|
|
221
|
+
try {
|
|
222
|
+
return await require_bundlerOptions.getBundlerOptions(mastraEntryFile, outputDirectory) ?? defaultBundlerOptions;
|
|
223
|
+
} catch (error) {
|
|
224
|
+
this.logger.debug("Failed to get bundler options, sourcemap will be disabled", { error });
|
|
225
|
+
}
|
|
226
|
+
return defaultBundlerOptions;
|
|
227
|
+
}
|
|
228
|
+
async analyze(entry, mastraFile, outputDirectory) {
|
|
229
|
+
return await require_analyze.analyzeBundle([].concat(entry), mastraFile, {
|
|
230
|
+
outputDir: (0, path.join)(outputDirectory, this.analyzeOutputDir),
|
|
231
|
+
projectRoot: outputDirectory,
|
|
232
|
+
platform: this.platform
|
|
233
|
+
}, this.logger);
|
|
234
|
+
}
|
|
235
|
+
pnpmNodeLinker;
|
|
236
|
+
async installDependencies(outputDirectory, rootDir = process.cwd(), pnpmOverrides) {
|
|
237
|
+
const deps = new require_services.DepsService(rootDir);
|
|
238
|
+
deps.__setLogger(this.logger);
|
|
239
|
+
await deps.install({
|
|
240
|
+
dir: (0, path.join)(outputDirectory, this.outputDir),
|
|
241
|
+
pnpmOverrides,
|
|
242
|
+
pnpmNodeLinker: this.pnpmNodeLinker
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Generate a package-lock.json for the output directory so that deploy targets
|
|
247
|
+
* can use `npm ci` instead of `npm install`, skipping version resolution entirely.
|
|
248
|
+
* This is a lockfile-only operation — no packages are downloaded.
|
|
249
|
+
*
|
|
250
|
+
* Temporarily moves node_modules out of the way because pnpm's symlink-based
|
|
251
|
+
* layout confuses npm's arborist, then restores it afterwards so that
|
|
252
|
+
* `mastra start` (or wrangler) can still resolve dependencies at runtime.
|
|
253
|
+
*/
|
|
254
|
+
async generateNpmLockfile(outputDir) {
|
|
255
|
+
const nodeModules = (0, path.join)(outputDir, "node_modules");
|
|
256
|
+
const nodeModulesTmp = (0, path.join)(outputDir, "node_modules.__tmp");
|
|
257
|
+
let movedNodeModules = false;
|
|
258
|
+
try {
|
|
259
|
+
if (await fs_extra_esm.default.pathExists(nodeModules)) {
|
|
260
|
+
await fs_extra_esm.default.move(nodeModules, nodeModulesTmp, { overwrite: true });
|
|
261
|
+
movedNodeModules = true;
|
|
262
|
+
}
|
|
263
|
+
(0, child_process.execSync)("npm install --package-lock-only --force", {
|
|
264
|
+
cwd: outputDir,
|
|
265
|
+
stdio: "pipe",
|
|
266
|
+
timeout: 6e4
|
|
267
|
+
});
|
|
268
|
+
} catch {
|
|
269
|
+
this.logger.warn("Failed to generate package-lock.json — deploy will fall back to npm install");
|
|
270
|
+
} finally {
|
|
271
|
+
if (movedNodeModules) {
|
|
272
|
+
await (0, fs_promises.rm)(nodeModules, {
|
|
273
|
+
recursive: true,
|
|
274
|
+
force: true
|
|
275
|
+
});
|
|
276
|
+
await fs_extra_esm.default.move(nodeModulesTmp, nodeModules, { overwrite: true });
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
async copyPublic(mastraDir, outputDirectory) {
|
|
281
|
+
const publicDir = (0, path.join)(mastraDir, "public");
|
|
282
|
+
try {
|
|
283
|
+
await (0, fs_promises.stat)(publicDir);
|
|
284
|
+
} catch {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
await (0, fs_extra_esm.copy)(publicDir, (0, path.join)(outputDirectory, this.outputDir));
|
|
288
|
+
}
|
|
289
|
+
async copyDOTNPMRC({ rootDir = process.cwd(), outputDirectory }) {
|
|
290
|
+
const sourceDotNpmRcPath = (0, path.join)(rootDir, ".npmrc");
|
|
291
|
+
const targetDotNpmRcPath = (0, path.join)(outputDirectory, this.outputDir, ".npmrc");
|
|
292
|
+
try {
|
|
293
|
+
await (0, fs_promises.stat)(sourceDotNpmRcPath);
|
|
294
|
+
await (0, fs_extra_esm.copy)(sourceDotNpmRcPath, targetDotNpmRcPath);
|
|
295
|
+
} catch {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Writes the `mastra-project.json` deployment marker for Software Factory
|
|
301
|
+
* projects after public assets have been copied. Verifies that the Factory
|
|
302
|
+
* SPA (`factory/index.html`) exists in the output before emitting the marker.
|
|
303
|
+
*/
|
|
304
|
+
async writeFactoryMarker(outputDirectory) {
|
|
305
|
+
const outputDir = (0, path.join)(outputDirectory, this.outputDir);
|
|
306
|
+
if (!(0, fs.existsSync)((0, path.join)(outputDir, "factory", "index.html"))) throw new _mastra_core_error.MastraError({
|
|
307
|
+
id: "DEPLOYER_BUNDLER_FACTORY_UI_MISSING",
|
|
308
|
+
text: "Software Factory project detected but factory/index.html was not found after copying the prebuilt Factory UI.",
|
|
309
|
+
domain: _mastra_core_error.ErrorDomain.DEPLOYER,
|
|
310
|
+
category: _mastra_core_error.ErrorCategory.SYSTEM
|
|
311
|
+
});
|
|
312
|
+
await (0, fs_promises.writeFile)((0, path.join)(outputDir, "mastra-project.json"), JSON.stringify({
|
|
313
|
+
schemaVersion: 1,
|
|
314
|
+
projectType: "factory",
|
|
315
|
+
assets: { ui: "factory" }
|
|
316
|
+
}, null, 2));
|
|
317
|
+
this.logger.info("Wrote mastra-project.json for Software Factory project");
|
|
318
|
+
}
|
|
319
|
+
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, { enableSourcemap, enableMinify, enableEsmShim, externals }) {
|
|
320
|
+
const { workspaceRoot } = await require_analyze.getWorkspaceInformation({ mastraEntryFile });
|
|
321
|
+
const closestPkgJson = empathic_package.up({ cwd: (0, path.dirname)(mastraEntryFile) });
|
|
322
|
+
const projectRoot = closestPkgJson ? (0, path.dirname)(closestPkgJson) : process.cwd();
|
|
323
|
+
const inputOptions = await require_bundler.getInputOptions(mastraEntryFile, analyzedBundleInfo, this.platform, { "process.env.NODE_ENV": JSON.stringify("production") }, {
|
|
324
|
+
sourcemap: enableSourcemap,
|
|
325
|
+
minify: enableMinify,
|
|
326
|
+
workspaceRoot,
|
|
327
|
+
projectRoot,
|
|
328
|
+
enableEsmShim,
|
|
329
|
+
externalsPreset: externals === true
|
|
330
|
+
});
|
|
331
|
+
const isVirtual = serverFile.includes("\n") || !(0, fs.existsSync)(serverFile);
|
|
332
|
+
const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);
|
|
333
|
+
if (isVirtual) {
|
|
334
|
+
inputOptions.input = {
|
|
335
|
+
index: "#entry",
|
|
336
|
+
...toolsInputOptions
|
|
337
|
+
};
|
|
338
|
+
if (Array.isArray(inputOptions.plugins)) inputOptions.plugins.unshift((0, _rollup_plugin_virtual.default)({ "#entry": serverFile }));
|
|
339
|
+
else inputOptions.plugins = [(0, _rollup_plugin_virtual.default)({ "#entry": serverFile })];
|
|
340
|
+
} else inputOptions.input = {
|
|
341
|
+
index: serverFile,
|
|
342
|
+
...toolsInputOptions
|
|
343
|
+
};
|
|
344
|
+
return inputOptions;
|
|
345
|
+
}
|
|
346
|
+
getAllToolPaths(mastraDir, toolsPaths = []) {
|
|
347
|
+
const normalizedMastraDir = require_utils.slash(mastraDir);
|
|
348
|
+
const defaultPaths = [path.posix.join(normalizedMastraDir, "tools/**/*.{js,ts}"), ...[`!${path.posix.join(normalizedMastraDir, "tools/**/*.{test,spec}.{js,ts}")}`, `!${path.posix.join(normalizedMastraDir, "tools/**/__tests__/**")}`]];
|
|
349
|
+
if (toolsPaths.length === 0) return [defaultPaths];
|
|
350
|
+
return [...toolsPaths, defaultPaths];
|
|
351
|
+
}
|
|
352
|
+
async listToolsInputOptions(toolsPaths) {
|
|
353
|
+
const inputs = {};
|
|
354
|
+
for (const toolPath of toolsPaths) {
|
|
355
|
+
const expandedPaths = await (0, tinyglobby.glob)(toolPath, {
|
|
356
|
+
absolute: true,
|
|
357
|
+
expandDirectories: false
|
|
358
|
+
});
|
|
359
|
+
for (const path$1 of expandedPaths) if (await fs_extra_esm.default.pathExists(path$1)) {
|
|
360
|
+
const entryFile = new require_services.FileService().getFirstExistingFile([
|
|
361
|
+
(0, path.join)(path$1, "index.ts"),
|
|
362
|
+
(0, path.join)(path$1, "index.js"),
|
|
363
|
+
path$1
|
|
364
|
+
]);
|
|
365
|
+
if (!entryFile || (await (0, fs_promises.stat)(entryFile)).isDirectory()) {
|
|
366
|
+
this.logger.warn("No entry file found, skipping", { path: path$1 });
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
const uniqueToolID = crypto.randomUUID();
|
|
370
|
+
const normalizedEntryFile = entryFile.replaceAll("\\", "/");
|
|
371
|
+
inputs[`tools/${uniqueToolID}`] = normalizedEntryFile;
|
|
372
|
+
} else this.logger.warn("Tool path does not exist, skipping", { path: path$1 });
|
|
373
|
+
}
|
|
374
|
+
return inputs;
|
|
375
|
+
}
|
|
376
|
+
async _bundle(serverFile, mastraEntryFile, { projectRoot, outputDirectory, enableEsmShim = true }, toolsPaths = [], bundleLocation = (0, path.join)(outputDirectory, this.outputDir)) {
|
|
377
|
+
const analyzeDir = (0, path.join)(outputDirectory, this.analyzeOutputDir);
|
|
378
|
+
const bundlerOptions = await this.getUserBundlerOptions(mastraEntryFile, outputDirectory);
|
|
379
|
+
const internalBundlerOptions = {
|
|
380
|
+
enableSourcemap: !!bundlerOptions.sourcemap,
|
|
381
|
+
enableMinify: !!bundlerOptions.minify,
|
|
382
|
+
externals: bundlerOptions.externals ?? [],
|
|
383
|
+
enableEsmShim,
|
|
384
|
+
dynamicPackages: bundlerOptions.dynamicPackages
|
|
385
|
+
};
|
|
386
|
+
let analyzedBundleInfo;
|
|
387
|
+
try {
|
|
388
|
+
const resolvedToolsPaths = await this.listToolsInputOptions(toolsPaths);
|
|
389
|
+
analyzedBundleInfo = await require_analyze.analyzeBundle([serverFile, ...Object.values(resolvedToolsPaths)], mastraEntryFile, {
|
|
390
|
+
outputDir: analyzeDir,
|
|
391
|
+
projectRoot,
|
|
392
|
+
platform: this.platform,
|
|
393
|
+
bundlerOptions: internalBundlerOptions
|
|
394
|
+
}, this.logger);
|
|
395
|
+
} catch (error) {
|
|
396
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
397
|
+
if (error instanceof _mastra_core_error.MastraError) throw error;
|
|
398
|
+
throw new _mastra_core_error.MastraError({
|
|
399
|
+
id: "DEPLOYER_BUNDLER_ANALYZE_FAILED",
|
|
400
|
+
text: `Failed to analyze Mastra application: ${message}`,
|
|
401
|
+
domain: _mastra_core_error.ErrorDomain.DEPLOYER,
|
|
402
|
+
category: _mastra_core_error.ErrorCategory.SYSTEM
|
|
403
|
+
}, error);
|
|
404
|
+
}
|
|
405
|
+
const { workspaceRoot } = await require_analyze.getWorkspaceInformation({
|
|
406
|
+
dir: projectRoot,
|
|
407
|
+
mastraEntryFile
|
|
408
|
+
});
|
|
409
|
+
const sourceDependencyConstraints = await getSourceDependencyConstraints({
|
|
410
|
+
projectRoot,
|
|
411
|
+
mastraEntryFile,
|
|
412
|
+
workspaceRoot
|
|
413
|
+
});
|
|
414
|
+
const dependenciesToInstall = /* @__PURE__ */ new Map();
|
|
415
|
+
for (const [dep, depInfo] of analyzedBundleInfo.externalDependencies) {
|
|
416
|
+
if (analyzedBundleInfo.workspaceMap.has(dep) || !require_utils.isBareModuleSpecifier(dep)) continue;
|
|
417
|
+
dependenciesToInstall.set(dep, applySourceDependencyRange(dep, depInfo, sourceDependencyConstraints));
|
|
418
|
+
}
|
|
419
|
+
const initialWorkspaceDependencies = /* @__PURE__ */ new Set();
|
|
420
|
+
for (const dep of analyzedBundleInfo.dependencies.keys()) {
|
|
421
|
+
const pkgName = require_utils.getPackageName(dep);
|
|
422
|
+
if (pkgName && analyzedBundleInfo.workspaceMap.has(pkgName)) initialWorkspaceDependencies.add(pkgName);
|
|
423
|
+
}
|
|
424
|
+
const transitiveWorkspaceDependencies = require_analyze.collectTransitiveWorkspaceDependencies({
|
|
425
|
+
workspaceMap: analyzedBundleInfo.workspaceMap,
|
|
426
|
+
initialDependencies: initialWorkspaceDependencies,
|
|
427
|
+
logger: this.logger
|
|
428
|
+
});
|
|
429
|
+
for (const [dep, packageSpec] of Object.entries(transitiveWorkspaceDependencies.resolutions)) dependenciesToInstall.set(dep, {
|
|
430
|
+
version: analyzedBundleInfo.workspaceMap.get(dep)?.version,
|
|
431
|
+
packageSpec
|
|
432
|
+
});
|
|
433
|
+
try {
|
|
434
|
+
await this.writePackageJson((0, path.join)(outputDirectory, this.outputDir), dependenciesToInstall, transitiveWorkspaceDependencies.resolutions);
|
|
435
|
+
if (transitiveWorkspaceDependencies.usedWorkspacePackages.size > 0) await require_analyze.packWorkspaceDependencies({
|
|
436
|
+
workspaceMap: analyzedBundleInfo.workspaceMap,
|
|
437
|
+
usedWorkspacePackages: transitiveWorkspaceDependencies.usedWorkspacePackages,
|
|
438
|
+
bundleOutputDir: (0, path.join)(outputDirectory, this.outputDir),
|
|
439
|
+
logger: this.logger
|
|
440
|
+
});
|
|
441
|
+
this.logger.info("Bundling Mastra application");
|
|
442
|
+
const inputOptions = await this.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths, internalBundlerOptions);
|
|
443
|
+
await (await this.createBundler({
|
|
444
|
+
...inputOptions,
|
|
445
|
+
logLevel: inputOptions.logLevel === "silent" ? "warn" : inputOptions.logLevel,
|
|
446
|
+
onwarn: (warning) => {
|
|
447
|
+
if (warning.code === "CIRCULAR_DEPENDENCY") {
|
|
448
|
+
if (warning.ids?.[0]?.includes("node_modules")) return;
|
|
449
|
+
this.logger.warn("Circular dependency found", { dependency: warning.message.replace("Circular dependency: ", "") });
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}, {
|
|
453
|
+
dir: bundleLocation,
|
|
454
|
+
manualChunks: { mastra: ["#mastra"] },
|
|
455
|
+
sourcemap: internalBundlerOptions.enableSourcemap
|
|
456
|
+
})).write();
|
|
457
|
+
const toolImports = [];
|
|
458
|
+
const toolsExports = [];
|
|
459
|
+
Array.from(Object.keys(inputOptions.input || {})).filter((key) => key.startsWith("tools/")).forEach((key, index) => {
|
|
460
|
+
const toolExport = `tool${index}`;
|
|
461
|
+
toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);
|
|
462
|
+
toolsExports.push(toolExport);
|
|
463
|
+
});
|
|
464
|
+
await (0, fs_promises.writeFile)((0, path.join)(bundleLocation, "tools.mjs"), `${toolImports.join("\n")}
|
|
465
|
+
|
|
466
|
+
export const tools = [${toolsExports.join(", ")}]`);
|
|
467
|
+
this.logger.info("Bundling Mastra done");
|
|
468
|
+
this.logger.info("Copying public files");
|
|
469
|
+
await this.copyPublic((0, path.dirname)(mastraEntryFile), outputDirectory);
|
|
470
|
+
this.logger.info("Done copying public files");
|
|
471
|
+
if (analyzedBundleInfo.projectType === "factory") await this.writeFactoryMarker(outputDirectory);
|
|
472
|
+
this.logger.info("Copying .npmrc file");
|
|
473
|
+
await this.copyDOTNPMRC({
|
|
474
|
+
outputDirectory,
|
|
475
|
+
rootDir: projectRoot
|
|
476
|
+
});
|
|
477
|
+
this.logger.info("Done copying .npmrc file");
|
|
478
|
+
this.logger.info("Installing dependencies");
|
|
479
|
+
await this.installDependencies(outputDirectory, projectRoot, transitiveWorkspaceDependencies.resolutions);
|
|
480
|
+
this.logger.info("Done installing dependencies");
|
|
481
|
+
if (Object.keys(transitiveWorkspaceDependencies.resolutions).length === 0) {
|
|
482
|
+
this.logger.info("Generating package-lock.json for deploy");
|
|
483
|
+
await this.generateNpmLockfile((0, path.join)(outputDirectory, this.outputDir));
|
|
484
|
+
this.logger.info("Done generating package-lock.json");
|
|
485
|
+
} else this.logger.warn("Skipping package-lock.json generation because the output contains packed workspace dependencies");
|
|
486
|
+
} catch (error) {
|
|
487
|
+
if (error instanceof _mastra_core_error.MastraError && error.id === "DEPLOYER_BUNDLER_FACTORY_UI_MISSING") throw error;
|
|
488
|
+
throw new _mastra_core_error.MastraError({
|
|
489
|
+
id: "DEPLOYER_BUNDLER_BUNDLE_STAGE_FAILED",
|
|
490
|
+
text: `Failed during bundler bundle stage: ${error instanceof Error ? error.message : String(error)}`,
|
|
491
|
+
domain: _mastra_core_error.ErrorDomain.DEPLOYER,
|
|
492
|
+
category: _mastra_core_error.ErrorCategory.SYSTEM
|
|
493
|
+
}, error);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
async lint(_entryFile, _outputDirectory, toolsPaths) {
|
|
497
|
+
const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);
|
|
498
|
+
const toolsLength = Object.keys(toolsInputOptions).length;
|
|
499
|
+
if (toolsLength > 0) this.logger.info("Found tools", { count: toolsLength });
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
//#endregion
|
|
503
|
+
exports.Bundler = Bundler;
|
|
504
|
+
exports.IS_DEFAULT = IS_DEFAULT;
|
|
505
|
+
exports.applySourceDependencyRange = applySourceDependencyRange;
|
|
506
|
+
exports.getSourceDependencyConstraints = getSourceDependencyConstraints;
|
|
507
|
+
exports.isRegistryVersionSpec = isRegistryVersionSpec;
|
|
508
|
+
|
|
509
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["pkg","getPackageName","MastraBundler","createBundlerUtil","getBundlerOptions","analyzeBundle","DepsService","fsExtra","MastraError","ErrorDomain","ErrorCategory","getWorkspaceInformation","getInputOptions","slash","posix","path","FileService","isBareModuleSpecifier","collectTransitiveWorkspaceDependencies","packWorkspaceDependencies"],"sources":["../../src/bundler/index.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { readFile, rm, stat, writeFile } from 'node:fs/promises';\nimport { dirname, join, posix } from 'node:path';\nimport { MastraBundler } from '@mastra/core/bundler';\nimport { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';\nimport type { Config } from '@mastra/core/mastra';\nimport virtual from '@rollup/plugin-virtual';\nimport * as pkg from 'empathic/package';\nimport fsExtra, { copy, ensureDir, emptyDir, readJSON } from 'fs-extra/esm';\nimport type { InputOptions, OutputOptions } from 'rollup';\nimport { glob } from 'tinyglobby';\nimport { analyzeBundle } from '../build/analyze';\nimport { createBundler as createBundlerUtil, getInputOptions } from '../build/bundler';\nimport { getBundlerOptions } from '../build/bundlerOptions';\nimport type { BundlerOptions, ExternalDependencyInfo } from '../build/types';\nimport type { BundlerPlatform } from '../build/utils';\nimport { getPackageName, isBareModuleSpecifier, slash } from '../build/utils';\nimport { DepsService } from '../services/deps';\nimport { FileService } from '../services/fs';\nimport {\n collectTransitiveWorkspaceDependencies,\n getWorkspaceInformation,\n packWorkspaceDependencies,\n} from './workspaceDependencies';\n\nexport type { BundlerOptions, ExternalDependencyInfo } from '../build/types';\nexport type { BundlerPlatform } from '../build/utils';\n\nexport const IS_DEFAULT = Symbol('IS_DEFAULT');\n\nconst NPM_ALIAS_PREFIX = 'npm:';\n/** Characters a registry range or dist tag can contain. Protocols need `:`, git shorthand needs `/` or `#`. */\nconst REGISTRY_SPEC_PATTERN = /^[A-Za-z0-9.+_^~><=*|!\\s-]+$/;\nconst PACKAGE_NAME_PATTERN = /^(?:@[A-Za-z0-9._-]+\\/)?[A-Za-z0-9._-]+$/;\nconst TARBALL_SUFFIX_PATTERN = /\\.(?:tgz|tar\\.gz|tar)$/i;\n/** npm reads a value starting like this as a path, whatever follows. A bare `~` is a semver range. */\nconst FILE_SPEC_PREFIX_PATTERN = /^(?:\\.|~[/\\\\]|[/\\\\]|[A-Za-z]:[/\\\\])/;\n/** A range admitting any published version: `*`, `x`, `>=0`, and any union containing one. */\nconst UNBOUNDED_RANGE_PATTERN = /(?:^|\\|\\||\\s)\\s*(?:[*xX]|>=?\\s*0(?:\\.0)*(?:\\.0)*)\\s*(?:$|\\|\\|)/;\n\n/**\n * Constraints declared by the source app, plus the packages some resolution field pins.\n *\n * Only `dependencies` values are read. Override fields contribute names, never values: which of\n * `overrides`, `resolutions`, `pnpm.overrides` or `pnpm-workspace.yaml` a given install honoured\n * depends on the package manager and its version, so reproducing that precedence would mean\n * emulating three package managers. A name appearing in any of them is enough to know the resolved\n * version was chosen deliberately, which is all this needs.\n */\nexport type SourceDependencyConstraints = {\n dependencies: Record<string, string>;\n pinnedByResolutionField: Set<string>;\n};\n\nconst toStringRecord = (value: unknown): Record<string, string> => {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return {};\n }\n\n return Object.fromEntries(\n Object.entries(value).filter((entry): entry is [string, string] => typeof entry[1] === 'string'),\n );\n};\n\n/**\n * True when a specifier is something the isolated install in `.mastra/output` can resolve from the\n * registry: a semver range, a dist tag, a wildcard, or an npm alias whose target is a registry\n * package and range.\n *\n * This is an allowlist rather than a denylist of known protocols, so an unfamiliar protocol is\n * rejected without this code having to know it exists. The output directory is not a workspace, has\n * no catalog definitions and has a different relative-path base, so `catalog:`, `workspace:`,\n * `file:`, `link:` and git specifiers are all either uninstallable there or point somewhere else.\n */\nexport const isRegistryVersionSpec = (spec: string): boolean => {\n if (FILE_SPEC_PREFIX_PATTERN.test(spec) || TARBALL_SUFFIX_PATTERN.test(spec)) {\n return false;\n }\n\n if (spec.startsWith(NPM_ALIAS_PREFIX)) {\n const alias = spec.slice(NPM_ALIAS_PREFIX.length);\n // Skip index 0 so `npm:@scope/pkg` reads as an alias with no range rather than an empty name.\n const rangeSeparator = alias.lastIndexOf('@');\n const name = rangeSeparator > 0 ? alias.slice(0, rangeSeparator) : alias;\n const range = rangeSeparator > 0 ? alias.slice(rangeSeparator + 1) : '*';\n\n return PACKAGE_NAME_PATTERN.test(name) && isRegistryVersionSpec(range);\n }\n\n return REGISTRY_SPEC_PATTERN.test(spec);\n};\n\n/**\n * True when a specifier names a version the output install can be held to.\n *\n * A range admitting anything (`*`, `latest`, `>=0`, an alias with no range) is looser than the\n * version already resolved, so writing it would let a later install pull something the bundle was\n * never analyzed against.\n */\nconst isBoundedVersionSpec = (spec: string): boolean => {\n const range = spec.startsWith(NPM_ALIAS_PREFIX)\n ? (() => {\n const alias = spec.slice(NPM_ALIAS_PREFIX.length);\n const rangeSeparator = alias.lastIndexOf('@');\n return rangeSeparator > 0 ? alias.slice(rangeSeparator + 1) : '';\n })()\n : spec;\n\n return /\\d/.test(range) && !UNBOUNDED_RANGE_PATTERN.test(range);\n};\n\nconst readManifest = async (manifestPath: string | undefined): Promise<Record<string, unknown> | undefined> => {\n if (!manifestPath) {\n return undefined;\n }\n\n try {\n const manifest = await readJSON(manifestPath);\n return manifest && typeof manifest === 'object' ? manifest : undefined;\n } catch {\n // A manifest that cannot be read tells us nothing about intent.\n return undefined;\n }\n};\n\n/** Collect the package names a manifest's resolution fields pin, ignoring their values. */\nconst collectManifestPinnedNames = (manifest: Record<string, unknown> | undefined, pinned: Set<string>) => {\n const pnpmSection = manifest?.pnpm;\n const records = [\n manifest?.overrides,\n manifest?.resolutions,\n pnpmSection && typeof pnpmSection === 'object' ? (pnpmSection as { overrides?: unknown }).overrides : undefined,\n ];\n\n for (const record of records) {\n if (record && typeof record === 'object' && !Array.isArray(record)) {\n for (const key of Object.keys(record)) {\n pinned.add(key);\n }\n }\n }\n};\n\n/**\n * Collect the names under a top-level `overrides:` block in `pnpm-workspace.yaml`.\n *\n * pnpm moved overrides out of `package.json` into this file, so a workspace on a current pnpm keeps\n * them only here. Reading names off the indented block avoids a YAML dependency, the same tradeoff\n * `copyPnpmWorkspaceSettings` already makes for the top-level keys it copies.\n */\nconst collectPnpmWorkspacePinnedNames = (source: string, pinned: Set<string>) => {\n const lines = source.split(/\\r?\\n/);\n let insideOverrides = false;\n\n for (const line of lines) {\n if (/^\\S/.test(line)) {\n insideOverrides = /^overrides:\\s*$/.test(line);\n continue;\n }\n\n if (!insideOverrides) {\n continue;\n }\n\n const key = /^\\s+(?:'([^']+)'|\"([^\"]+)\"|([^'\"\\s:][^:]*?))\\s*:/.exec(line);\n if (key) {\n pinned.add((key[1] ?? key[2] ?? key[3] ?? '').trim());\n }\n }\n};\n\n/**\n * Read the constraints the source app declared.\n *\n * `dependencies` come from the manifest at `projectRoot`, the package the build was invoked for and\n * whose directory receives the output, falling back to the manifest above the entry file. Anchoring\n * on `projectRoot` rather than the entry file keeps the answer deterministic when the entry handed\n * to the bundler is a generated wrapper rather than the app's own source file.\n *\n * Resolution-field names are collected from both that manifest and the workspace root, including the\n * root `pnpm-workspace.yaml`, because a name pinned anywhere means the resolved version may have been\n * chosen deliberately rather than hoisted by accident.\n */\nexport const getSourceDependencyConstraints = async ({\n projectRoot,\n mastraEntryFile,\n workspaceRoot,\n}: {\n projectRoot: string;\n mastraEntryFile: string;\n workspaceRoot?: string;\n}): Promise<SourceDependencyConstraints> => {\n const manifestPaths = [pkg.up({ cwd: projectRoot }), pkg.up({ cwd: dirname(mastraEntryFile) })].filter(\n (entry, index, entries): entry is string => !!entry && entries.indexOf(entry) === index,\n );\n\n if (workspaceRoot) {\n manifestPaths.push(join(workspaceRoot, 'package.json'));\n }\n\n const pinnedByResolutionField = new Set<string>();\n let dependencies: Record<string, string> | undefined;\n\n for (const manifestPath of manifestPaths) {\n const manifest = await readManifest(manifestPath);\n if (!manifest) {\n continue;\n }\n\n // Nearest manifest wins, and an empty `dependencies` record is still that package's answer.\n dependencies ??= toStringRecord(manifest.dependencies);\n collectManifestPinnedNames(manifest, pinnedByResolutionField);\n }\n\n if (workspaceRoot) {\n try {\n collectPnpmWorkspacePinnedNames(\n await readFile(join(workspaceRoot, 'pnpm-workspace.yaml'), 'utf-8'),\n pinnedByResolutionField,\n );\n } catch {\n // No pnpm workspace config, or unreadable: nothing to learn from it.\n }\n }\n\n return { dependencies: dependencies ?? {}, pinnedByResolutionField };\n};\n\nconst findDeclaredConstraint = (\n constraints: SourceDependencyConstraints,\n dependencyName: string,\n): string | undefined => {\n const names = [dependencyName, getPackageName(dependencyName)].filter(\n (name, index, all): name is string => !!name && all.indexOf(name) === index,\n );\n\n for (const name of names) {\n // A pinned package's resolved version is the deliberate answer, so leave it as `main` wrote it.\n if (constraints.pinnedByResolutionField.has(name)) {\n return undefined;\n }\n }\n\n for (const name of names) {\n const declared = (constraints.dependencies[name] ?? '').trim();\n if (declared && isBoundedVersionSpec(declared) && isRegistryVersionSpec(declared)) {\n return declared;\n }\n }\n\n return undefined;\n};\n\n/**\n * Prefer the constraint the app declared over the version resolved from `node_modules`.\n *\n * The resolved version is whatever the install happened to hoist, so an app declaring `zod: ^4.3.6`\n * next to a hoisted `zod@3.25.76` gets the hoisted version written into the output manifest and the\n * isolated install then locks it in.\n */\nexport const applySourceDependencyRange = (\n dependencyName: string,\n dependencyInfo: ExternalDependencyInfo,\n constraints: SourceDependencyConstraints,\n): ExternalDependencyInfo => {\n const declared = findDeclaredConstraint(constraints, dependencyName);\n if (!declared) {\n return dependencyInfo;\n }\n\n if (declared.startsWith(NPM_ALIAS_PREFIX)) {\n return { ...dependencyInfo, packageSpec: declared };\n }\n\n // `packageSpec` is set only when the resolved package's own name differs from the requested one, so\n // a bare range under this key describes a different package and the resolved alias is the answer.\n if (dependencyInfo.packageSpec) {\n return dependencyInfo;\n }\n\n return { ...dependencyInfo, version: declared };\n};\n\nexport abstract class Bundler extends MastraBundler {\n protected analyzeOutputDir = '.build';\n protected outputDir = 'output';\n protected platform: BundlerPlatform = 'node';\n\n constructor(name: string, component: 'BUNDLER' | 'DEPLOYER' = 'BUNDLER') {\n super({ name, component });\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n // Clean up the output directory first\n await emptyDir(outputDirectory);\n\n await ensureDir(join(outputDirectory, this.analyzeOutputDir));\n await ensureDir(join(outputDirectory, this.outputDir));\n }\n\n async writePackageJson(\n outputDirectory: string,\n dependencies: Map<string, string | ExternalDependencyInfo>,\n resolutions?: Record<string, string>,\n ) {\n this.logger.debug(\"Writing project's package.json\");\n\n await ensureDir(outputDirectory);\n const pkgPath = join(outputDirectory, 'package.json');\n\n const dependenciesMap = new Map();\n for (const [key, value] of dependencies.entries()) {\n const dependencyValue = typeof value === 'string' ? value : (value.packageSpec ?? value.version ?? 'latest');\n if (key.startsWith('@')) {\n // Handle scoped packages (e.g. @org/package)\n const pkgChunks = key.split('/');\n dependenciesMap.set(`${pkgChunks[0]}/${pkgChunks[1]}`, dependencyValue);\n } else {\n // For non-scoped packages, take only the first part before any slash\n const pkgName = key.split('/')[0] || key;\n dependenciesMap.set(pkgName, dependencyValue);\n }\n }\n\n await writeFile(\n pkgPath,\n JSON.stringify(\n {\n name: 'server',\n version: '1.0.0',\n private: true,\n type: 'module',\n main: 'index.mjs',\n scripts: {\n start: 'node ./index.mjs',\n },\n dependencies: Object.fromEntries(dependenciesMap.entries()),\n ...(Object.keys(resolutions ?? {}).length > 0 && { resolutions }),\n },\n null,\n 2,\n ),\n );\n }\n\n protected createBundler(inputOptions: InputOptions, outputOptions: Partial<OutputOptions> & { dir: string }) {\n return createBundlerUtil(inputOptions, outputOptions);\n }\n\n protected async getUserBundlerOptions(\n mastraEntryFile: string,\n outputDirectory: string,\n ): Promise<NonNullable<Config['bundler']>> {\n const defaultBundlerOptions: Config['bundler'] = {\n externals: [],\n sourcemap: false,\n transpilePackages: [],\n [IS_DEFAULT]: true,\n } as const;\n\n try {\n const bundlerOptions = await getBundlerOptions(mastraEntryFile, outputDirectory);\n\n return bundlerOptions ?? defaultBundlerOptions;\n } catch (error) {\n this.logger.debug('Failed to get bundler options, sourcemap will be disabled', { error });\n }\n\n return defaultBundlerOptions;\n }\n\n protected async analyze(entry: string | string[], mastraFile: string, outputDirectory: string) {\n return await analyzeBundle(\n ([] as string[]).concat(entry),\n mastraFile,\n {\n outputDir: join(outputDirectory, this.analyzeOutputDir),\n projectRoot: outputDirectory,\n platform: this.platform,\n },\n this.logger,\n );\n }\n\n protected pnpmNodeLinker?: 'hoisted';\n\n protected async installDependencies(\n outputDirectory: string,\n rootDir = process.cwd(),\n pnpmOverrides?: Record<string, string>,\n ) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n await deps.install({\n dir: join(outputDirectory, this.outputDir),\n pnpmOverrides,\n pnpmNodeLinker: this.pnpmNodeLinker,\n });\n }\n\n /**\n * Generate a package-lock.json for the output directory so that deploy targets\n * can use `npm ci` instead of `npm install`, skipping version resolution entirely.\n * This is a lockfile-only operation — no packages are downloaded.\n *\n * Temporarily moves node_modules out of the way because pnpm's symlink-based\n * layout confuses npm's arborist, then restores it afterwards so that\n * `mastra start` (or wrangler) can still resolve dependencies at runtime.\n */\n private async generateNpmLockfile(outputDir: string): Promise<void> {\n const nodeModules = join(outputDir, 'node_modules');\n const nodeModulesTmp = join(outputDir, 'node_modules.__tmp');\n let movedNodeModules = false;\n try {\n // Move node_modules aside — pnpm's symlink layout confuses npm's arborist\n if (await fsExtra.pathExists(nodeModules)) {\n await fsExtra.move(nodeModules, nodeModulesTmp, { overwrite: true });\n movedNodeModules = true;\n }\n execSync('npm install --package-lock-only --force', {\n cwd: outputDir,\n stdio: 'pipe',\n timeout: 60_000,\n });\n } catch {\n this.logger.warn('Failed to generate package-lock.json — deploy will fall back to npm install');\n } finally {\n // Restore node_modules so runtime resolution works\n if (movedNodeModules) {\n await rm(nodeModules, { recursive: true, force: true });\n await fsExtra.move(nodeModulesTmp, nodeModules, { overwrite: true });\n }\n }\n }\n\n protected async copyPublic(mastraDir: string, outputDirectory: string) {\n const publicDir = join(mastraDir, 'public');\n\n try {\n await stat(publicDir);\n } catch {\n return;\n }\n\n await copy(publicDir, join(outputDirectory, this.outputDir));\n }\n\n protected async copyDOTNPMRC({\n rootDir = process.cwd(),\n outputDirectory,\n }: {\n rootDir?: string;\n outputDirectory: string;\n }) {\n const sourceDotNpmRcPath = join(rootDir, '.npmrc');\n const targetDotNpmRcPath = join(outputDirectory, this.outputDir, '.npmrc');\n\n try {\n await stat(sourceDotNpmRcPath);\n await copy(sourceDotNpmRcPath, targetDotNpmRcPath);\n } catch {\n return;\n }\n }\n\n /**\n * Writes the `mastra-project.json` deployment marker for Software Factory\n * projects after public assets have been copied. Verifies that the Factory\n * SPA (`factory/index.html`) exists in the output before emitting the marker.\n */\n protected async writeFactoryMarker(outputDirectory: string): Promise<void> {\n const outputDir = join(outputDirectory, this.outputDir);\n const factoryIndex = join(outputDir, 'factory', 'index.html');\n if (!existsSync(factoryIndex)) {\n throw new MastraError({\n id: 'DEPLOYER_BUNDLER_FACTORY_UI_MISSING',\n text: 'Software Factory project detected but factory/index.html was not found after copying the prebuilt Factory UI.',\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n });\n }\n await writeFile(\n join(outputDir, 'mastra-project.json'),\n JSON.stringify({ schemaVersion: 1, projectType: 'factory', assets: { ui: 'factory' } }, null, 2),\n );\n this.logger.info('Wrote mastra-project.json for Software Factory project');\n }\n\n protected async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: (string | string[])[],\n { enableSourcemap, enableMinify, enableEsmShim, externals }: BundlerOptions,\n ) {\n const { workspaceRoot } = await getWorkspaceInformation({ mastraEntryFile });\n const closestPkgJson = pkg.up({ cwd: dirname(mastraEntryFile) });\n const projectRoot = closestPkgJson ? dirname(closestPkgJson) : process.cwd();\n\n const inputOptions: InputOptions = await getInputOptions(\n mastraEntryFile,\n analyzedBundleInfo,\n this.platform,\n {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n {\n sourcemap: enableSourcemap,\n minify: enableMinify,\n workspaceRoot,\n projectRoot,\n enableEsmShim,\n externalsPreset: externals === true,\n },\n );\n const isVirtual = serverFile.includes('\\n') || !existsSync(serverFile);\n const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);\n\n if (isVirtual) {\n inputOptions.input = { index: '#entry', ...toolsInputOptions };\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins.unshift(virtual({ '#entry': serverFile }));\n } else {\n inputOptions.plugins = [virtual({ '#entry': serverFile })];\n }\n } else {\n inputOptions.input = { index: serverFile, ...toolsInputOptions };\n }\n\n return inputOptions;\n }\n\n getAllToolPaths(mastraDir: string, toolsPaths: (string | string[])[] = []): (string | string[])[] {\n // Normalize Windows paths to forward slashes for consistent handling\n const normalizedMastraDir = slash(mastraDir);\n\n // Prepare default tools paths with glob patterns\n const defaultToolsPath = posix.join(normalizedMastraDir, 'tools/**/*.{js,ts}');\n const defaultToolsIgnorePaths = [\n `!${posix.join(normalizedMastraDir, 'tools/**/*.{test,spec}.{js,ts}')}`,\n `!${posix.join(normalizedMastraDir, 'tools/**/__tests__/**')}`,\n ];\n\n // Combine default path with ignore patterns\n const defaultPaths = [defaultToolsPath, ...defaultToolsIgnorePaths];\n\n // If no tools paths provided, use only the default paths\n if (toolsPaths.length === 0) {\n return [defaultPaths];\n }\n\n // If tools paths are provided, add the default paths to ensure standard tools are always included\n return [...toolsPaths, defaultPaths];\n }\n\n async listToolsInputOptions(toolsPaths: (string | string[])[]) {\n const inputs: Record<string, string> = {};\n\n for (const toolPath of toolsPaths) {\n const expandedPaths = await glob(toolPath, {\n absolute: true,\n expandDirectories: false,\n });\n\n for (const path of expandedPaths) {\n if (await fsExtra.pathExists(path)) {\n const fileService = new FileService();\n const entryFile = fileService.getFirstExistingFile([\n join(path, 'index.ts'),\n join(path, 'index.js'),\n path, // if path itself is a file\n ]);\n\n // if it doesn't exist or is a dir skip it. using a dir as a tool will crash the process\n if (!entryFile || (await stat(entryFile)).isDirectory()) {\n this.logger.warn('No entry file found, skipping', { path });\n continue;\n }\n\n const uniqueToolID = crypto.randomUUID();\n // Normalize Windows paths to forward slashes for consistent handling\n const normalizedEntryFile = entryFile.replaceAll('\\\\', '/');\n inputs[`tools/${uniqueToolID}`] = normalizedEntryFile;\n } else {\n this.logger.warn('Tool path does not exist, skipping', { path });\n }\n }\n }\n\n return inputs;\n }\n\n protected async _bundle(\n serverFile: string,\n mastraEntryFile: string,\n {\n projectRoot,\n outputDirectory,\n enableEsmShim = true,\n }: {\n projectRoot: string;\n outputDirectory: string;\n enableEsmShim?: boolean;\n },\n toolsPaths: (string | string[])[] = [],\n bundleLocation: string = join(outputDirectory, this.outputDir),\n ): Promise<void> {\n const analyzeDir = join(outputDirectory, this.analyzeOutputDir);\n\n const bundlerOptions = await this.getUserBundlerOptions(mastraEntryFile, outputDirectory);\n const internalBundlerOptions: BundlerOptions = {\n enableSourcemap: !!bundlerOptions.sourcemap,\n enableMinify: !!bundlerOptions.minify,\n externals: bundlerOptions.externals ?? [],\n enableEsmShim,\n dynamicPackages: bundlerOptions.dynamicPackages,\n };\n\n let analyzedBundleInfo;\n try {\n const resolvedToolsPaths = await this.listToolsInputOptions(toolsPaths);\n analyzedBundleInfo = await analyzeBundle(\n [serverFile, ...Object.values(resolvedToolsPaths)],\n mastraEntryFile,\n {\n outputDir: analyzeDir,\n projectRoot,\n platform: this.platform,\n bundlerOptions: internalBundlerOptions,\n },\n this.logger,\n );\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n\n if (error instanceof MastraError) {\n throw error;\n }\n\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_ANALYZE_FAILED',\n text: `Failed to analyze Mastra application: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n\n const { workspaceRoot } = await getWorkspaceInformation({ dir: projectRoot, mastraEntryFile });\n const sourceDependencyConstraints = await getSourceDependencyConstraints({\n projectRoot,\n mastraEntryFile,\n workspaceRoot,\n });\n const dependenciesToInstall = new Map<string, ExternalDependencyInfo>();\n for (const [dep, depInfo] of analyzedBundleInfo.externalDependencies) {\n if (analyzedBundleInfo.workspaceMap.has(dep) || !isBareModuleSpecifier(dep)) {\n continue;\n }\n\n dependenciesToInstall.set(dep, applySourceDependencyRange(dep, depInfo, sourceDependencyConstraints));\n }\n\n const initialWorkspaceDependencies = new Set<string>();\n for (const dep of analyzedBundleInfo.dependencies.keys()) {\n const pkgName = getPackageName(dep);\n if (pkgName && analyzedBundleInfo.workspaceMap.has(pkgName)) {\n initialWorkspaceDependencies.add(pkgName);\n }\n }\n\n const transitiveWorkspaceDependencies = collectTransitiveWorkspaceDependencies({\n workspaceMap: analyzedBundleInfo.workspaceMap,\n initialDependencies: initialWorkspaceDependencies,\n logger: this.logger,\n });\n\n for (const [dep, packageSpec] of Object.entries(transitiveWorkspaceDependencies.resolutions)) {\n dependenciesToInstall.set(dep, {\n version: analyzedBundleInfo.workspaceMap.get(dep)?.version,\n packageSpec,\n });\n }\n\n try {\n await this.writePackageJson(\n join(outputDirectory, this.outputDir),\n dependenciesToInstall,\n transitiveWorkspaceDependencies.resolutions,\n );\n if (transitiveWorkspaceDependencies.usedWorkspacePackages.size > 0) {\n await packWorkspaceDependencies({\n workspaceMap: analyzedBundleInfo.workspaceMap,\n usedWorkspacePackages: transitiveWorkspaceDependencies.usedWorkspacePackages,\n bundleOutputDir: join(outputDirectory, this.outputDir),\n logger: this.logger,\n });\n }\n\n this.logger.info('Bundling Mastra application');\n\n const inputOptions: InputOptions = await this.getBundlerOptions(\n serverFile,\n mastraEntryFile,\n analyzedBundleInfo,\n toolsPaths,\n internalBundlerOptions,\n );\n\n const bundler = await this.createBundler(\n {\n ...inputOptions,\n logLevel: inputOptions.logLevel === 'silent' ? 'warn' : inputOptions.logLevel,\n onwarn: warning => {\n if (warning.code === 'CIRCULAR_DEPENDENCY') {\n if (warning.ids?.[0]?.includes('node_modules')) {\n return;\n }\n\n this.logger.warn('Circular dependency found', {\n dependency: warning.message.replace('Circular dependency: ', ''),\n });\n }\n },\n },\n {\n dir: bundleLocation,\n manualChunks: {\n mastra: ['#mastra'],\n },\n sourcemap: internalBundlerOptions.enableSourcemap,\n },\n );\n\n await bundler.write();\n const toolImports: string[] = [];\n const toolsExports: string[] = [];\n Array.from(Object.keys(inputOptions.input || {}))\n .filter(key => key.startsWith('tools/'))\n .forEach((key, index) => {\n const toolExport = `tool${index}`;\n toolImports.push(`import * as ${toolExport} from './${key}.mjs';`);\n toolsExports.push(toolExport);\n });\n\n await writeFile(\n join(bundleLocation, 'tools.mjs'),\n `${toolImports.join('\\n')}\n\nexport const tools = [${toolsExports.join(', ')}]`,\n );\n this.logger.info('Bundling Mastra done');\n\n this.logger.info('Copying public files');\n await this.copyPublic(dirname(mastraEntryFile), outputDirectory);\n this.logger.info('Done copying public files');\n\n // For Software Factory projects, write a deterministic deployment marker\n // after public assets (including the SPA) have been copied.\n if (analyzedBundleInfo.projectType === 'factory') {\n await this.writeFactoryMarker(outputDirectory);\n }\n\n this.logger.info('Copying .npmrc file');\n await this.copyDOTNPMRC({ outputDirectory, rootDir: projectRoot });\n\n this.logger.info('Done copying .npmrc file');\n\n this.logger.info('Installing dependencies');\n await this.installDependencies(outputDirectory, projectRoot, transitiveWorkspaceDependencies.resolutions);\n this.logger.info('Done installing dependencies');\n\n if (Object.keys(transitiveWorkspaceDependencies.resolutions).length === 0) {\n this.logger.info('Generating package-lock.json for deploy');\n await this.generateNpmLockfile(join(outputDirectory, this.outputDir));\n this.logger.info('Done generating package-lock.json');\n } else {\n this.logger.warn(\n 'Skipping package-lock.json generation because the output contains packed workspace dependencies',\n );\n }\n } catch (error) {\n if (error instanceof MastraError && error.id === 'DEPLOYER_BUNDLER_FACTORY_UI_MISSING') {\n throw error;\n }\n\n const message = error instanceof Error ? error.message : String(error);\n throw new MastraError(\n {\n id: 'DEPLOYER_BUNDLER_BUNDLE_STAGE_FAILED',\n text: `Failed during bundler bundle stage: ${message}`,\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.SYSTEM,\n },\n error,\n );\n }\n }\n\n async lint(_entryFile: string, _outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n const toolsInputOptions = await this.listToolsInputOptions(toolsPaths);\n const toolsLength = Object.keys(toolsInputOptions).length;\n if (toolsLength > 0) {\n this.logger.info('Found tools', { count: toolsLength });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,aAAa,OAAO,YAAY;AAE7C,MAAM,mBAAmB;;AAEzB,MAAM,wBAAwB;AAC9B,MAAM,uBAAuB;AAC7B,MAAM,yBAAyB;;AAE/B,MAAM,2BAA2B;;AAEjC,MAAM,0BAA0B;AAgBhC,MAAM,kBAAkB,UAA2C;CACjE,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAC5D,OAAO,CAAC;CAGV,OAAO,OAAO,YACZ,OAAO,QAAQ,KAAK,CAAC,CAAC,QAAQ,UAAqC,OAAO,MAAM,OAAO,QAAQ,CACjG;AACF;;;;;;;;;;;AAYA,MAAa,yBAAyB,SAA0B;CAC9D,IAAI,yBAAyB,KAAK,IAAI,KAAK,uBAAuB,KAAK,IAAI,GACzE,OAAO;CAGT,IAAI,KAAK,WAAW,gBAAgB,GAAG;EACrC,MAAM,QAAQ,KAAK,MAAM,CAAuB;EAEhD,MAAM,iBAAiB,MAAM,YAAY,GAAG;EAC5C,MAAM,OAAO,iBAAiB,IAAI,MAAM,MAAM,GAAG,cAAc,IAAI;EACnE,MAAM,QAAQ,iBAAiB,IAAI,MAAM,MAAM,iBAAiB,CAAC,IAAI;EAErE,OAAO,qBAAqB,KAAK,IAAI,KAAK,sBAAsB,KAAK;CACvE;CAEA,OAAO,sBAAsB,KAAK,IAAI;AACxC;;;;;;;;AASA,MAAM,wBAAwB,SAA0B;CACtD,MAAM,QAAQ,KAAK,WAAW,gBAAgB,WACnC;EACL,MAAM,QAAQ,KAAK,MAAM,CAAuB;EAChD,MAAM,iBAAiB,MAAM,YAAY,GAAG;EAC5C,OAAO,iBAAiB,IAAI,MAAM,MAAM,iBAAiB,CAAC,IAAI;CAChE,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