@mastra/deployer 1.68.0-alpha.0 → 1.68.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/@hono_node-server/package.json +1 -0
- package/dist/_types/@mastra_hono/package.json +1 -0
- package/dist/{analyze-hp4aHpms.cjs → analyze-BC22OIkc.cjs} +109 -94
- package/dist/analyze-BC22OIkc.cjs.map +1 -0
- package/dist/{analyze-B5HY26Tt.js → analyze-D3eRdXC9.js} +107 -91
- package/dist/analyze-D3eRdXC9.js.map +1 -0
- package/dist/{arktype-aI7TBD0R-S0daSmHG.js → arktype-aI7TBD0R-BGjyzmsj.js} +2 -2
- package/dist/{arktype-aI7TBD0R-S0daSmHG.js.map → arktype-aI7TBD0R-BGjyzmsj.js.map} +1 -1
- package/dist/{arktype-aI7TBD0R-BuTX_Phx.cjs → arktype-aI7TBD0R-DCxjN6oF.cjs} +2 -2
- package/dist/{arktype-aI7TBD0R-BuTX_Phx.cjs.map → arktype-aI7TBD0R-DCxjN6oF.cjs.map} +1 -1
- package/dist/build/analyze/analyzeEntry.d.ts +3 -1
- package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
- package/dist/build/analyze/bundleExternals.d.ts.map +1 -1
- package/dist/build/analyze.cjs +1 -1
- package/dist/build/analyze.d.ts.map +1 -1
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +2 -1
- package/dist/build/bundler.d.ts +10 -0
- package/dist/build/bundler.d.ts.map +1 -1
- package/dist/build/bundler.js +2 -2
- package/dist/build/index.cjs +6 -6
- package/dist/build/index.js +6 -6
- package/dist/build/package-info.d.ts +4 -0
- package/dist/build/package-info.d.ts.map +1 -1
- package/dist/build/plugins/tsconfig-paths.d.ts +2 -1
- package/dist/build/plugins/tsconfig-paths.d.ts.map +1 -1
- package/dist/{build-Boe3fe3L.js → build-C5eBQq1A.js} +6 -6
- package/dist/{build-Boe3fe3L.js.map → build-C5eBQq1A.js.map} +1 -1
- package/dist/{build-Dit9VFE2.cjs → build-D-GPvP7A.cjs} +6 -6
- package/dist/{build-Dit9VFE2.cjs.map → build-D-GPvP7A.cjs.map} +1 -1
- package/dist/bundler/index.cjs +29 -62
- package/dist/bundler/index.cjs.map +1 -1
- package/dist/bundler/index.d.ts +1 -11
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +30 -63
- package/dist/bundler/index.js.map +1 -1
- package/dist/bundler/workspaceDependencies.d.ts +1 -1
- package/dist/bundler/workspaceDependencies.d.ts.map +1 -1
- package/dist/{bundler-CzQiVHzN.js → bundler-CNFQP4Qm.js} +45 -10
- package/dist/bundler-CNFQP4Qm.js.map +1 -0
- package/dist/{bundler-BKf2S2r_.cjs → bundler-I4HUeik1.cjs} +55 -8
- package/dist/bundler-I4HUeik1.cjs.map +1 -0
- package/dist/{bundlerOptions-I2E5y2Wp.cjs → bundlerOptions-CkFbsVoE.cjs} +2 -2
- package/dist/{bundlerOptions-I2E5y2Wp.cjs.map → bundlerOptions-CkFbsVoE.cjs.map} +1 -1
- package/dist/{bundlerOptions-BSySFLb3.js → bundlerOptions-Dg4pdJsM.js} +2 -2
- package/dist/{bundlerOptions-BSySFLb3.js.map → bundlerOptions-Dg4pdJsM.js.map} +1 -1
- package/dist/core-D3wM1JKp.js +1159 -0
- package/dist/core-D3wM1JKp.js.map +1 -0
- package/dist/core-QL_X0T4Y.cjs +1159 -0
- package/dist/core-QL_X0T4Y.cjs.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-monorepo.md +2 -2
- package/dist/{effect-QlVUlMFu-tf02PTZR.cjs → effect-QlVUlMFu-B2nZ842E.cjs} +3 -3
- package/dist/{effect-QlVUlMFu-tf02PTZR.cjs.map → effect-QlVUlMFu-B2nZ842E.cjs.map} +1 -1
- package/dist/{effect-QlVUlMFu-BN-VJnMF.js → effect-QlVUlMFu-DbWuPaWV.js} +3 -3
- package/dist/{effect-QlVUlMFu-BN-VJnMF.js.map → effect-QlVUlMFu-DbWuPaWV.js.map} +1 -1
- package/dist/{esm-DZ1Siz1C.cjs → esm-Ai6osZ1a.cjs} +61 -50
- package/dist/esm-Ai6osZ1a.cjs.map +1 -0
- package/dist/{esm-B51vJPGv.js → esm-D-wYOO-S.js} +61 -50
- package/dist/esm-D-wYOO-S.js.map +1 -0
- package/dist/{index-CLddUTqr-eO-ae7Sx.js → index-CLddUTqr-BXqo9et4.js} +8 -8
- package/dist/{index-CLddUTqr-eO-ae7Sx.js.map → index-CLddUTqr-BXqo9et4.js.map} +1 -1
- package/dist/{index-CLddUTqr-DS5tJ3WV.cjs → index-CLddUTqr-DsGkVS-W.cjs} +8 -8
- package/dist/{index-CLddUTqr-DS5tJ3WV.cjs.map → index-CLddUTqr-DsGkVS-W.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/server/index.cjs +8 -8
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +8 -8
- package/dist/server/index.js.map +1 -1
- package/dist/services/deps.d.ts +1 -1
- package/dist/services/deps.d.ts.map +1 -1
- package/dist/services/index.cjs +1 -1
- package/dist/services/index.js +1 -1
- package/dist/{services-BLvNG7v7.cjs → services-Beob47UW.cjs} +42 -23
- package/dist/services-Beob47UW.cjs.map +1 -0
- package/dist/{services-B9KRKBT-.js → services-Lm6PRS4D.js} +42 -23
- package/dist/services-Lm6PRS4D.js.map +1 -0
- package/dist/{sury-CWZTCd75-YUPbTtKO.cjs → sury-CWZTCd75-ChXu4j-p.cjs} +3 -3
- package/dist/{sury-CWZTCd75-YUPbTtKO.cjs.map → sury-CWZTCd75-ChXu4j-p.cjs.map} +1 -1
- package/dist/{sury-CWZTCd75-ClSNrMWF.js → sury-CWZTCd75-OKz7uWLi.js} +3 -3
- package/dist/{sury-CWZTCd75-ClSNrMWF.js.map → sury-CWZTCd75-OKz7uWLi.js.map} +1 -1
- package/dist/{typebox-Dei93FPO-CVSJ3SAf.js → typebox-Dei93FPO-C5ACKU09.js} +2 -2
- package/dist/{typebox-Dei93FPO-CVSJ3SAf.js.map → typebox-Dei93FPO-C5ACKU09.js.map} +1 -1
- package/dist/{typebox-Dei93FPO-BTBshlGz.cjs → typebox-Dei93FPO-KTtPU745.cjs} +2 -2
- package/dist/{typebox-Dei93FPO-BTBshlGz.cjs.map → typebox-Dei93FPO-KTtPU745.cjs.map} +1 -1
- package/dist/{utils-DYi43Kp4.js → utils-Bl3Lm7SI.js} +1 -2
- package/dist/{utils-DYi43Kp4.js.map → utils-Bl3Lm7SI.js.map} +1 -1
- package/dist/{utils-7WDNT3Ca.cjs → utils-Bsr_sEcH.cjs} +2 -2
- package/dist/{utils-7WDNT3Ca.cjs.map → utils-Bsr_sEcH.cjs.map} +1 -1
- package/dist/{valibot--1zFm7rT-Dn5WqdyK.cjs → valibot--1zFm7rT-BeX3W1HK.cjs} +3 -3
- package/dist/{valibot--1zFm7rT-Dn5WqdyK.cjs.map → valibot--1zFm7rT-BeX3W1HK.cjs.map} +1 -1
- package/dist/{valibot--1zFm7rT-BxcEC3Pu.js → valibot--1zFm7rT-BuVb-6oJ.js} +3 -3
- package/dist/{valibot--1zFm7rT-BxcEC3Pu.js.map → valibot--1zFm7rT-BuVb-6oJ.js.map} +1 -1
- package/dist/validator/custom-resolver.cjs +1 -1
- package/dist/validator/custom-resolver.js +1 -1
- package/dist/{zod-Bwrt9trS-Bd40XYOT.js → zod-Bwrt9trS-D5b1oyiT.js} +5 -5
- package/dist/{zod-Bwrt9trS-Bd40XYOT.js.map → zod-Bwrt9trS-D5b1oyiT.js.map} +1 -1
- package/dist/{zod-Bwrt9trS-Bi11nE9Q.cjs → zod-Bwrt9trS-DGQs9DWc.cjs} +5 -5
- package/dist/{zod-Bwrt9trS-Bi11nE9Q.cjs.map → zod-Bwrt9trS-DGQs9DWc.cjs.map} +1 -1
- package/package.json +13 -12
- package/dist/analyze-B5HY26Tt.js.map +0 -1
- package/dist/analyze-hp4aHpms.cjs.map +0 -1
- package/dist/bundler-BKf2S2r_.cjs.map +0 -1
- package/dist/bundler-CzQiVHzN.js.map +0 -1
- package/dist/core-D0wEgdn3.cjs +0 -790
- package/dist/core-D0wEgdn3.cjs.map +0 -1
- package/dist/core-DF65PJXc.js +0 -790
- package/dist/core-DF65PJXc.js.map +0 -1
- package/dist/esm-B51vJPGv.js.map +0 -1
- package/dist/esm-DZ1Siz1C.cjs.map +0 -1
- package/dist/services-B9KRKBT-.js.map +0 -1
- package/dist/services-BLvNG7v7.cjs.map +0 -1
package/dist/services/deps.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ export declare function copyPnpmWorkspaceSettings(source: string, options?: Inst
|
|
|
13
13
|
export declare class Deps extends MastraBase {
|
|
14
14
|
private packageManager;
|
|
15
15
|
private rootDir;
|
|
16
|
+
private lockFile;
|
|
16
17
|
constructor(rootDir?: string);
|
|
17
18
|
private findLockFile;
|
|
18
|
-
private getPackageManager;
|
|
19
19
|
getWorkspaceDependencyPath({ pkgName, version }: {
|
|
20
20
|
pkgName: string;
|
|
21
21
|
version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../src/services/deps.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../src/services/deps.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAgB/C,UAAU,mBAAmB;IAC3B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,UAAU,cAAe,SAAQ,mBAAmB;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAA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AAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAQrE;AAED,qBAAa,WAAY,SAAQ,IAAI;CAAG"}
|
package/dist/services/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_services = require("../services-
|
|
2
|
+
const require_services = require("../services-Beob47UW.cjs");
|
|
3
3
|
exports.DepsService = require_services.DepsService;
|
|
4
4
|
exports.EnvService = require_services.EnvService;
|
|
5
5
|
exports.FileService = require_services.FileService;
|
package/dist/services/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as DepsService, n as EnvService, t as FileService } from "../services-
|
|
1
|
+
import { i as DepsService, n as EnvService, t as FileService } from "../services-Lm6PRS4D.js";
|
|
2
2
|
export { DepsService, EnvService, FileService };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
-
let child_process = require("child_process");
|
|
3
2
|
let fs = require("fs");
|
|
4
3
|
fs = require_rolldown_runtime.__toESM(fs, 1);
|
|
5
4
|
let fs_promises = require("fs/promises");
|
|
@@ -9,6 +8,7 @@ path = require_rolldown_runtime.__toESM(path, 1);
|
|
|
9
8
|
let _mastra_core_error = require("@mastra/core/error");
|
|
10
9
|
let fs_extra_esm = require("fs-extra/esm");
|
|
11
10
|
fs_extra_esm = require_rolldown_runtime.__toESM(fs_extra_esm, 1);
|
|
11
|
+
let child_process = require("child_process");
|
|
12
12
|
let url = require("url");
|
|
13
13
|
let _mastra_core_base = require("@mastra/core/base");
|
|
14
14
|
let yaml = require("yaml");
|
|
@@ -177,34 +177,45 @@ function copyPnpmWorkspaceSettings(source, options = {}) {
|
|
|
177
177
|
var Deps = class extends _mastra_core_base.MastraBase {
|
|
178
178
|
packageManager;
|
|
179
179
|
rootDir;
|
|
180
|
+
lockFile;
|
|
180
181
|
constructor(rootDir = process.cwd()) {
|
|
181
182
|
super({
|
|
182
183
|
component: "DEPLOYER",
|
|
183
184
|
name: "DEPS"
|
|
184
185
|
});
|
|
185
186
|
this.rootDir = rootDir;
|
|
186
|
-
this.
|
|
187
|
+
this.lockFile = this.findLockFile(rootDir);
|
|
188
|
+
this.packageManager = this.lockFile?.packageManager ?? "npm";
|
|
187
189
|
}
|
|
188
190
|
findLockFile(dir) {
|
|
189
|
-
for (const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
for (const lockFile of [
|
|
192
|
+
{
|
|
193
|
+
filename: "pnpm-lock.yaml",
|
|
194
|
+
packageManager: "pnpm"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
filename: "package-lock.json",
|
|
198
|
+
packageManager: "npm"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
filename: "yarn.lock",
|
|
202
|
+
packageManager: "yarn"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
filename: "bun.lock",
|
|
206
|
+
packageManager: "bun"
|
|
207
|
+
}
|
|
208
|
+
]) {
|
|
209
|
+
const lockFilePath = path.default.join(dir, lockFile.filename);
|
|
210
|
+
if (fs.default.existsSync(lockFilePath)) return {
|
|
211
|
+
...lockFile,
|
|
212
|
+
path: lockFilePath
|
|
213
|
+
};
|
|
214
|
+
}
|
|
195
215
|
const parentDir = path.default.resolve(dir, "..");
|
|
196
216
|
if (parentDir !== dir) return this.findLockFile(parentDir);
|
|
197
217
|
return null;
|
|
198
218
|
}
|
|
199
|
-
getPackageManager() {
|
|
200
|
-
switch (this.findLockFile(this.rootDir)) {
|
|
201
|
-
case "pnpm-lock.yaml": return "pnpm";
|
|
202
|
-
case "package-lock.json": return "npm";
|
|
203
|
-
case "yarn.lock": return "yarn";
|
|
204
|
-
case "bun.lock": return "bun";
|
|
205
|
-
default: return "npm";
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
219
|
getWorkspaceDependencyPath({ pkgName, version }) {
|
|
209
220
|
return `file:./workspace-module/${pkgName}-${version}.tgz`;
|
|
210
221
|
}
|
|
@@ -258,19 +269,27 @@ var Deps = class extends _mastra_core_base.MastraBase {
|
|
|
258
269
|
* Depending on whether we want to install or add a package, this function returns the appropriate commands.
|
|
259
270
|
* All package managers support both commands (e.g. npm install has an alias on "add")
|
|
260
271
|
*/
|
|
261
|
-
getPackageManagerCommand(pm, type) {
|
|
272
|
+
getPackageManagerCommand(pm, type, { yarnClassic = false } = {}) {
|
|
262
273
|
const cmd = type === "install" ? "install" : "add";
|
|
263
274
|
switch (pm) {
|
|
264
275
|
case "npm": return `${cmd} --audit=false --fund=false --loglevel=error --progress=false --update-notifier=false`;
|
|
265
|
-
case "yarn": return `${cmd}
|
|
266
|
-
case "pnpm": return
|
|
267
|
-
case "bun": return cmd;
|
|
276
|
+
case "yarn": return type === "install" && !yarnClassic ? `${cmd} --no-immutable` : cmd;
|
|
277
|
+
case "pnpm": return type === "install" ? `${cmd} --no-frozen-lockfile --loglevel=error` : `${cmd} --loglevel=error`;
|
|
268
278
|
default: return cmd;
|
|
269
279
|
}
|
|
270
280
|
}
|
|
271
281
|
async install({ dir = this.rootDir, architecture, pnpmOverrides, pnpmNodeLinker } = {}) {
|
|
272
282
|
const pm = this.packageManager;
|
|
273
|
-
|
|
283
|
+
let yarnClassic = false;
|
|
284
|
+
if (this.lockFile) {
|
|
285
|
+
const destination = path.default.join(dir, this.lockFile.filename);
|
|
286
|
+
if (path.default.resolve(this.lockFile.path) !== path.default.resolve(destination)) await fs_promises.default.copyFile(this.lockFile.path, destination);
|
|
287
|
+
if (pm === "yarn") {
|
|
288
|
+
const lockfileContents = await fs_promises.default.readFile(destination, "utf-8");
|
|
289
|
+
yarnClassic = /^# yarn lockfile v1\r?$/m.test(lockfileContents);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const installCommand = this.getPackageManagerCommand(pm, "install", { yarnClassic });
|
|
274
293
|
let args = [];
|
|
275
294
|
switch (pm) {
|
|
276
295
|
case "pnpm":
|
|
@@ -515,4 +534,4 @@ Object.defineProperty(exports, "createPinoStream", {
|
|
|
515
534
|
}
|
|
516
535
|
});
|
|
517
536
|
|
|
518
|
-
//# sourceMappingURL=services-
|
|
537
|
+
//# sourceMappingURL=services-Beob47UW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services-Beob47UW.cjs","names":["Writable","MastraError","ErrorDomain","ErrorCategory","MastraBase","fsPromises","fsExtra"],"sources":["../src/deploy/log.ts","../src/services/deps.ts","../src/services/env.ts","../src/services/fs.ts"],"sourcesContent":["import { spawn } from 'node:child_process';\nimport { Writable } from 'node:stream';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport const createPinoStream = (logger: IMastraLogger) => {\n return new Writable({\n write(chunk, _encoding, callback) {\n // Convert Buffer/string to string and trim whitespace\n const line = chunk.toString().trim();\n\n if (line) {\n console.info(line);\n // Log each line through Pino\n logger.info(line);\n }\n\n callback();\n },\n });\n};\n\n/**\n * Args are joined into a shell command (`shell: true` is required for package\n * manager shims on Windows), so only allow characters that appear in package\n * specifiers and CLI flags — never shell metacharacters (CodeQL\n * js/shell-command-constructed-from-input).\n */\nconst SAFE_SHELL_ARG = /^[\\w@%+=:,./^~-]*$/;\n\nexport function createChildProcessLogger({ logger, root }: { logger: IMastraLogger; root: string }) {\n const pinoStream = createPinoStream(logger);\n return async ({ cmd, args, env }: { cmd: string; args: string[]; env: Record<string, string> }) => {\n try {\n for (const arg of args) {\n if (!SAFE_SHELL_ARG.test(arg)) {\n throw new Error(`Refusing to pass unsafe argument to shell command: ${JSON.stringify(arg)}`);\n }\n }\n const subprocess = spawn(cmd, args, {\n cwd: root,\n shell: true,\n env,\n // No stdin for the child process — it doesn't need interactive input\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n subprocess.stdout?.on('data', chunk => {\n stdout += chunk.toString();\n });\n subprocess.stderr?.on('data', chunk => {\n stderr += chunk.toString();\n });\n\n // Pipe stdout and stderr through the logging stream.\n // { end: false } prevents the first stream to close from ending pinoStream\n // while the other may still be writing.\n subprocess.stdout?.pipe(pinoStream, { end: false });\n subprocess.stderr?.pipe(pinoStream, { end: false });\n\n // Wait for the process to complete\n return new Promise((resolve, reject) => {\n subprocess.on('close', code => {\n pinoStream.end();\n if (code === 0) {\n resolve({ success: true, stdout, stderr });\n } else {\n reject(Object.assign(new Error(`Process exited with code ${code}`), { stdout, stderr }));\n }\n });\n\n subprocess.on('error', error => {\n pinoStream.end();\n logger.error('Process failed', { error });\n reject(error);\n });\n });\n } catch (error) {\n console.error(error);\n logger.error('Process failed', { error });\n pinoStream.end();\n return { success: false, error };\n }\n };\n}\n","import fs from 'node:fs';\nimport fsPromises from 'node:fs/promises';\nimport path, { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { MastraBase } from '@mastra/core/base';\nimport { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';\nimport { readJSON, writeJSON, ensureFile } from 'fs-extra/esm';\nimport type { PackageJson } from 'type-fest';\nimport { parse } from 'yaml';\n\nimport { createChildProcessLogger } from '../deploy/log.js';\n\ntype PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\ninterface LockFileInfo {\n path: string;\n filename: string;\n packageManager: PackageManager;\n}\n\ninterface ArchitectureOptions {\n os?: string[];\n cpu?: string[];\n libc?: string[];\n}\n\ninterface InstallOptions extends ArchitectureOptions {\n pnpmOverrides?: Record<string, string>;\n pnpmNodeLinker?: 'hoisted';\n}\n\nconst PNPM_CONFIG_KEYS_TO_COPY = new Set([\n 'allowBuilds',\n 'onlyBuiltDependencies',\n 'ignoredBuiltDependencies',\n 'neverBuiltDependencies',\n 'minimumReleaseAge',\n 'minimumReleaseAgeExclude',\n 'trustPolicy',\n 'trustPolicyExclude',\n 'trustPolicyIgnoreAfter',\n 'supportedArchitectures',\n]);\n\nfunction getTopLevelYamlKey(line: string) {\n const match = /^(?!\\s)([\\w-]+):/.exec(line);\n return match?.[1];\n}\n\nconst PNPM_IGNORED_BUILDS_ERROR = 'ERR_PNPM_IGNORED_BUILDS';\n\nexport function getPnpmIgnoredBuildPackages(output: string): string[] {\n const match = new RegExp(`\\\\[?${PNPM_IGNORED_BUILDS_ERROR}\\\\]?[^\\\\n]*Ignored build scripts:\\\\s*([^\\\\n]+)`).exec(\n output,\n );\n if (!match?.[1]) return [];\n\n return match[1]\n .split(',')\n .map(specifier => specifier.trim())\n .filter(Boolean)\n .map(specifier => {\n if (specifier.startsWith('@')) {\n const versionSeparator = specifier.indexOf('@', 1);\n return versionSeparator === -1 ? specifier : specifier.slice(0, versionSeparator);\n }\n return specifier.split('@', 1)[0]!;\n });\n}\n\nfunction validatePnpmBuildApprovals(key: string, block: string): void {\n if (key !== 'allowBuilds' && key !== 'onlyBuiltDependencies') return;\n\n let value: unknown;\n try {\n value = (parse(block) as Record<string, unknown>)[key];\n } catch (error) {\n throw new MastraError(\n {\n id: 'DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG',\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n details: { key },\n text: `Invalid pnpm ${key} configuration`,\n },\n error,\n );\n }\n\n const invalidEntries =\n key === 'allowBuilds'\n ? value && typeof value === 'object' && !Array.isArray(value)\n ? Object.entries(value).filter(\n ([dependency, approval]) => dependency.trim().length === 0 || typeof approval !== 'boolean',\n )\n : [[key, value]]\n : Array.isArray(value) &&\n value.every(dependency => typeof dependency === 'string' && dependency.trim().length > 0)\n ? []\n : [[key, value]];\n\n if (invalidEntries.length === 0) return;\n const invalidEntryNames = invalidEntries.map(([entry]) => entry).join(', ');\n\n throw new MastraError({\n id: 'DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG',\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n details: { key, invalidEntries: invalidEntryNames },\n text: `Invalid pnpm ${key} entries: ${invalidEntryNames}`,\n });\n}\n\nexport function copyPnpmWorkspaceSettings(source: string, options: InstallOptions = {}) {\n const hasArchitecture = Boolean(options.os?.length || options.cpu?.length || options.libc?.length);\n const lines = source.split(/\\r?\\n/);\n const blocks: string[] = [];\n\n for (let index = 0; index < lines.length;) {\n const key = getTopLevelYamlKey(lines[index] ?? '');\n if (!key) {\n index += 1;\n continue;\n }\n\n const start = index;\n index += 1;\n while (index < lines.length && !getTopLevelYamlKey(lines[index] ?? '')) {\n index += 1;\n }\n\n if (!PNPM_CONFIG_KEYS_TO_COPY.has(key) || (key === 'supportedArchitectures' && hasArchitecture)) {\n continue;\n }\n\n const block = lines.slice(start, index).join('\\n').trimEnd();\n if (block) {\n validatePnpmBuildApprovals(key, block);\n blocks.push(block);\n }\n }\n\n if (hasArchitecture) {\n const architectureBlock = ['supportedArchitectures:'];\n if (options.os?.length) {\n architectureBlock.push(` os: ${JSON.stringify(options.os)}`);\n }\n if (options.cpu?.length) {\n architectureBlock.push(` cpu: ${JSON.stringify(options.cpu)}`);\n }\n if (options.libc?.length) {\n architectureBlock.push(` libc: ${JSON.stringify(options.libc)}`);\n }\n blocks.push(architectureBlock.join('\\n'));\n }\n\n if (options.pnpmOverrides && Object.keys(options.pnpmOverrides).length > 0) {\n blocks.push(\n [\n 'overrides:',\n ...Object.entries(options.pnpmOverrides).map(\n ([key, value]) => ` ${JSON.stringify(key)}: ${JSON.stringify(value)}`,\n ),\n ].join('\\n'),\n );\n }\n\n if (options.pnpmNodeLinker) {\n blocks.push(`nodeLinker: ${options.pnpmNodeLinker}`);\n }\n\n return [\"packages:\\n - '.'\", ...blocks].join('\\n\\n') + '\\n';\n}\n\nexport class Deps extends MastraBase {\n private packageManager: PackageManager;\n private rootDir: string;\n private lockFile: LockFileInfo | null;\n\n constructor(rootDir = process.cwd()) {\n super({ component: 'DEPLOYER', name: 'DEPS' });\n\n this.rootDir = rootDir;\n this.lockFile = this.findLockFile(rootDir);\n this.packageManager = this.lockFile?.packageManager ?? 'npm';\n }\n\n private findLockFile(dir: string): LockFileInfo | null {\n const lockFiles: Array<{ filename: string; packageManager: PackageManager }> = [\n { filename: 'pnpm-lock.yaml', packageManager: 'pnpm' },\n { filename: 'package-lock.json', packageManager: 'npm' },\n { filename: 'yarn.lock', packageManager: 'yarn' },\n { filename: 'bun.lock', packageManager: 'bun' },\n ];\n for (const lockFile of lockFiles) {\n const lockFilePath = path.join(dir, lockFile.filename);\n if (fs.existsSync(lockFilePath)) {\n return { ...lockFile, path: lockFilePath };\n }\n }\n const parentDir = path.resolve(dir, '..');\n if (parentDir !== dir) {\n return this.findLockFile(parentDir);\n }\n return null;\n }\n\n public getWorkspaceDependencyPath({ pkgName, version }: { pkgName: string; version: string }) {\n return `file:./workspace-module/${pkgName}-${version}.tgz`;\n }\n\n public async pack({ dir, destination, sanitizedName }: { dir: string; destination: string; sanitizedName: string }) {\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: dir,\n });\n\n let packCmd = 'pack';\n let destinationFlag = `--pack-destination ${destination}`;\n if (this.packageManager === 'yarn') {\n // %s includes an '@' at the start of packages names with an '@'\n // so we need to use our sanitizedName instead.\n destinationFlag = `--out ${destination}/${sanitizedName}-%v.tgz`;\n }\n if (this.packageManager === 'bun') {\n // bun uses `pm pack` instead of `pack`\n packCmd = 'pm pack';\n // bun uses --destination instead of --pack-destination\n destinationFlag = `--destination ${destination}`;\n }\n\n return cpLogger({\n cmd: `${this.packageManager} ${packCmd} ${destinationFlag}`,\n args: [],\n env: {\n PATH: process.env.PATH!,\n },\n });\n }\n\n private findPnpmWorkspaceFile(dir: string): string | null {\n const workspaceYamlPath = path.join(dir, 'pnpm-workspace.yaml');\n if (fs.existsSync(workspaceYamlPath)) {\n return workspaceYamlPath;\n }\n\n const parentDir = path.resolve(dir, '..');\n if (parentDir !== dir) {\n return this.findPnpmWorkspaceFile(parentDir);\n }\n\n return null;\n }\n\n private async writePnpmConfig(dir: string, options: InstallOptions = {}) {\n const sourceWorkspaceYamlPath = this.findPnpmWorkspaceFile(this.rootDir);\n const sourceWorkspaceYaml = sourceWorkspaceYamlPath\n ? await fsPromises.readFile(sourceWorkspaceYamlPath, 'utf-8')\n : '';\n\n await fsPromises.writeFile(\n path.join(dir, 'pnpm-workspace.yaml'),\n copyPnpmWorkspaceSettings(sourceWorkspaceYaml, options),\n 'utf-8',\n );\n }\n\n private async writeYarnConfig(dir: string, options: ArchitectureOptions) {\n const yarnrcPath = path.join(dir, '.yarnrc.yml');\n const config = {\n supportedArchitectures: {\n cpu: options.cpu || [],\n os: options.os || [],\n libc: options.libc || [],\n },\n };\n\n await fsPromises.writeFile(\n yarnrcPath,\n `supportedArchitectures:\\n${Object.entries(config.supportedArchitectures)\n .map(([key, value]) => ` ${key}: ${JSON.stringify(value)}`)\n .join('\\n')}`,\n );\n }\n\n private getNpmArgs(options: ArchitectureOptions): string[] {\n const args: string[] = [];\n if (options.cpu) args.push(`--cpu=${options.cpu.join(',')}`);\n if (options.os) args.push(`--os=${options.os.join(',')}`);\n if (options.libc) args.push(`--libc=${options.libc.join(',')}`);\n return args;\n }\n\n /**\n * Depending on whether we want to install or add a package, this function returns the appropriate commands.\n * All package managers support both commands (e.g. npm install has an alias on \"add\")\n */\n private getPackageManagerCommand(\n pm: PackageManager,\n type: 'install' | 'add',\n { yarnClassic = false }: { yarnClassic?: boolean } = {},\n ): string {\n const cmd = type === 'install' ? 'install' : 'add';\n\n switch (pm) {\n case 'npm':\n return `${cmd} --audit=false --fund=false --loglevel=error --progress=false --update-notifier=false`;\n case 'yarn':\n return type === 'install' && !yarnClassic ? `${cmd} --no-immutable` : cmd;\n case 'pnpm':\n return type === 'install' ? `${cmd} --no-frozen-lockfile --loglevel=error` : `${cmd} --loglevel=error`;\n default:\n return cmd;\n }\n }\n\n public async install({\n dir = this.rootDir,\n architecture,\n pnpmOverrides,\n pnpmNodeLinker,\n }: {\n dir?: string;\n architecture?: ArchitectureOptions;\n pnpmOverrides?: Record<string, string>;\n pnpmNodeLinker?: 'hoisted';\n } = {}) {\n const pm = this.packageManager;\n let yarnClassic = false;\n if (this.lockFile) {\n const destination = path.join(dir, this.lockFile.filename);\n if (path.resolve(this.lockFile.path) !== path.resolve(destination)) {\n await fsPromises.copyFile(this.lockFile.path, destination);\n }\n\n if (pm === 'yarn') {\n const lockfileContents = await fsPromises.readFile(destination, 'utf-8');\n yarnClassic = /^# yarn lockfile v1\\r?$/m.test(lockfileContents);\n }\n }\n\n const installCommand = this.getPackageManagerCommand(pm, 'install', { yarnClassic });\n let args: string[] = [];\n\n switch (pm) {\n case 'pnpm':\n await this.writePnpmConfig(dir, { ...architecture, pnpmOverrides, pnpmNodeLinker });\n break;\n case 'yarn':\n // similar to --ignore-workspace but for yarn\n await ensureFile(path.join(dir, 'yarn.lock'));\n if (architecture) {\n await this.writeYarnConfig(dir, architecture);\n }\n break;\n case 'npm':\n if (architecture) {\n args = this.getNpmArgs(architecture);\n }\n break;\n default:\n // Do nothing\n }\n\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: dir,\n });\n\n try {\n return await cpLogger({\n cmd: `${pm} ${installCommand}`,\n args,\n env: process.env as Record<string, string>,\n });\n } catch (error) {\n if (pm !== 'pnpm') throw error;\n\n const processOutput =\n error && typeof error === 'object'\n ? `${'stdout' in error ? String(error.stdout) : ''}\\n${'stderr' in error ? String(error.stderr) : ''}`\n : '';\n const ignoredPackages = getPnpmIgnoredBuildPackages(processOutput);\n if (ignoredPackages.length === 0) throw error;\n\n throw new MastraError(\n {\n id: 'DEPLOYER_PNPM_IGNORED_BUILDS',\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n details: { packageNames: ignoredPackages.join(', ') },\n text: `pnpm blocked build scripts for: ${ignoredPackages.join(', ')}. Add these packages to allowBuilds in pnpm-workspace.yaml and retry the build.`,\n },\n error,\n );\n }\n }\n\n public async installPackages(packages: string[]) {\n const pm = this.packageManager;\n const installCommand = this.getPackageManagerCommand(pm, 'add');\n\n const env: Record<string, string> = {\n PATH: process.env.PATH!,\n };\n\n if (process.env.npm_config_registry) {\n env.npm_config_registry = process.env.npm_config_registry;\n }\n\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: '',\n });\n\n return cpLogger({\n cmd: `${pm} ${installCommand}`,\n args: packages,\n env,\n });\n }\n\n public async checkDependencies(dependencies: string[]): Promise<string> {\n try {\n const packageJsonPath = path.join(this.rootDir, 'package.json');\n\n try {\n await fsPromises.access(packageJsonPath);\n } catch {\n return 'No package.json file found in the current directory';\n }\n\n const packageJson = await readJSON(packageJsonPath);\n for (const dependency of dependencies) {\n if (!packageJson.dependencies || !packageJson.dependencies[dependency]) {\n return `Please install ${dependency} before running this command (${this.packageManager} install ${dependency})`;\n }\n }\n\n return 'ok';\n } catch (err) {\n console.error(err);\n return 'Could not check dependencies';\n }\n }\n\n public async getProjectName() {\n try {\n const packageJsonPath = path.join(this.rootDir, 'package.json');\n const pkg = await readJSON(packageJsonPath);\n return pkg.name;\n } catch (err) {\n throw err;\n }\n }\n\n public async getPackageVersion() {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n const pkgJsonPath = path.join(__dirname, '..', '..', 'package.json');\n\n const content = (await readJSON(pkgJsonPath)) as PackageJson;\n return content.version;\n }\n\n public async addScriptsToPackageJson(scripts: Record<string, string>) {\n const packageJson = await readJSON('package.json');\n packageJson.scripts = {\n ...packageJson.scripts,\n ...scripts,\n };\n await writeJSON('package.json', packageJson, { spaces: 2 });\n }\n}\n\nexport class DepsService extends Deps {}\n","import * as fs from 'node:fs';\n\nexport abstract class EnvService {\n abstract getEnvValue(key: string): Promise<string | null>;\n abstract setEnvValue(key: string, value: string): Promise<void>;\n}\n\nexport class FileEnvService extends EnvService {\n private filePath: string;\n\n constructor(filePath: string) {\n super();\n this.filePath = filePath;\n }\n\n private readFile(filePath: string): Promise<string> {\n return new Promise((resolve, reject) => {\n fs.readFile(filePath, 'utf8', (err: NodeJS.ErrnoException | null, data: string) => {\n if (err) reject(err);\n else resolve(data);\n });\n });\n }\n\n private writeFile({ filePath, data }: { filePath: string; data: string }): Promise<void> {\n return new Promise((resolve, reject) => {\n fs.writeFile(filePath, data, 'utf8', (err: NodeJS.ErrnoException | null) => {\n if (err) reject(err);\n else resolve();\n });\n });\n }\n\n private async updateEnvData({\n key,\n value,\n filePath = this.filePath,\n data,\n }: {\n key: string;\n value: string;\n filePath?: string;\n data: string;\n }): Promise<string> {\n const regex = new RegExp(`^${key}=.*$`, 'm');\n if (data.match(regex)) {\n // Use a replacement function so `$` sequences in the value (e.g. `$&`,\n // `$$`) are written literally instead of being interpreted as\n // String.prototype.replace special patterns.\n data = data.replace(regex, () => `${key}=${value}`);\n } else {\n data += `\\n${key}=${value}`;\n }\n await this.writeFile({ filePath, data });\n console.info(`${key} set to ${value} in ENV file.`);\n return data;\n }\n\n async getEnvValue(key: string): Promise<string | null> {\n try {\n const data = await this.readFile(this.filePath);\n const regex = new RegExp(`^${key}=(.*)$`, 'm');\n const match = data.match(regex);\n return match?.[1] || null;\n } catch (err) {\n console.error(`Error reading ENV value: ${err}`);\n return null;\n }\n }\n\n async setEnvValue(key: string, value: string): Promise<void> {\n try {\n const data = await this.readFile(this.filePath);\n await this.updateEnvData({ key, value, data });\n } catch (err) {\n console.error(`Error writing ENV value: ${err}`);\n }\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport fsExtra from 'fs-extra/esm';\n\nimport { FileEnvService } from './env.js';\n\nexport class FileService {\n /**\n *\n * @param inputFile the file in the starter files directory to copy\n * @param outputFilePath the destination path\n * @param replaceIfExists flag to replace if it exists\n * @returns\n */\n public async copyStarterFile(inputFile: string, outputFilePath: string, replaceIfExists?: boolean) {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n const filePath = path.resolve(__dirname, '..', 'starter-files', inputFile);\n const fileString = fs.readFileSync(filePath, 'utf8');\n\n if (fs.existsSync(outputFilePath) && !replaceIfExists) {\n console.info(`${outputFilePath} already exists`);\n return false;\n }\n\n await fsExtra.outputFile(outputFilePath, fileString);\n\n return true;\n }\n\n public async setupEnvFile({ dbUrl }: { dbUrl: string }) {\n const envPath = path.join(process.cwd(), '.env.development');\n\n await fsExtra.ensureFile(envPath);\n\n const fileEnvService = new FileEnvService(envPath);\n await fileEnvService.setEnvValue('DB_URL', dbUrl);\n }\n\n public getFirstExistingFile(files: string[]): string {\n for (const f of files) {\n if (fs.existsSync(f)) {\n return f;\n }\n }\n\n throw new Error('Missing required file, checked the following paths: ' + files.join(', '));\n }\n\n /**\n * Returns every existing file from the provided array in the same order.\n * Callers supply files from the lowest to highest precedence so later dotenv\n * files override earlier values when the bundler loads them.\n */\n public getExistingFiles(files: string[]): string[] {\n return files.filter(file => fs.existsSync(file));\n }\n\n /**\n * Returns the first existing file from the provided array, or undefined if none exist\n * @param files array of file paths to check\n * @returns the first existing file path or undefined\n */\n public getFirstExistingFileOrUndefined(files: string[]): string | undefined {\n for (const f of files) {\n if (fs.existsSync(f)) {\n return f;\n }\n }\n\n return undefined;\n }\n\n public replaceValuesInFile({\n filePath,\n replacements,\n }: {\n filePath: string;\n replacements: { search: string; replace: string }[];\n }) {\n let fileContent = fs.readFileSync(filePath, 'utf8');\n replacements.forEach(({ search, replace }) => {\n fileContent = fileContent.replaceAll(search, replace);\n });\n\n fs.writeFileSync(filePath, fileContent);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,MAAa,oBAAoB,WAA0B;CACzD,OAAO,IAAIA,OAAAA,SAAS,EAClB,MAAM,OAAO,WAAW,UAAU;EAEhC,MAAM,OAAO,MAAM,SAAS,CAAC,CAAC,KAAK;EAEnC,IAAI,MAAM;GACR,QAAQ,KAAK,IAAI;GAEjB,OAAO,KAAK,IAAI;EAClB;EAEA,SAAS;CACX,EACF,CAAC;AACH;;;;;;;AAQA,MAAM,iBAAiB;AAEvB,SAAgB,yBAAyB,EAAE,QAAQ,QAAiD;CAClG,MAAM,aAAa,iBAAiB,MAAM;CAC1C,OA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,OAAqC;EAC1E,KAAK,MAAM,KAAK,OACd,IAAI,GAAA,QAAG,WAAW,CAAC,GACjB,OAAO;CAKb;CAEA,oBAA2B,EACzB,UACA,gBAIC;EACD,IAAI,cAAc,GAAA,QAAG,aAAa,UAAU,MAAM;EAClD,aAAa,SAAS,EAAE,QAAQ,cAAc;GAC5C,cAAc,YAAY,WAAW,QAAQ,OAAO;EACtD,CAAC;EAED,GAAA,QAAG,cAAc,UAAU,WAAW;CACxC;AACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { spawn } from "child_process";
|
|
2
1
|
import * as fs$1 from "fs";
|
|
3
2
|
import fs from "fs";
|
|
4
3
|
import fsPromises from "fs/promises";
|
|
5
4
|
import path, { dirname } from "path";
|
|
6
5
|
import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
|
|
7
6
|
import fsExtra, { ensureFile, readJSON, writeJSON } from "fs-extra/esm";
|
|
7
|
+
import { spawn } from "child_process";
|
|
8
8
|
import { fileURLToPath } from "url";
|
|
9
9
|
import { MastraBase } from "@mastra/core/base";
|
|
10
10
|
import { parse } from "yaml";
|
|
@@ -173,34 +173,45 @@ function copyPnpmWorkspaceSettings(source, options = {}) {
|
|
|
173
173
|
var Deps = class extends MastraBase {
|
|
174
174
|
packageManager;
|
|
175
175
|
rootDir;
|
|
176
|
+
lockFile;
|
|
176
177
|
constructor(rootDir = process.cwd()) {
|
|
177
178
|
super({
|
|
178
179
|
component: "DEPLOYER",
|
|
179
180
|
name: "DEPS"
|
|
180
181
|
});
|
|
181
182
|
this.rootDir = rootDir;
|
|
182
|
-
this.
|
|
183
|
+
this.lockFile = this.findLockFile(rootDir);
|
|
184
|
+
this.packageManager = this.lockFile?.packageManager ?? "npm";
|
|
183
185
|
}
|
|
184
186
|
findLockFile(dir) {
|
|
185
|
-
for (const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
for (const lockFile of [
|
|
188
|
+
{
|
|
189
|
+
filename: "pnpm-lock.yaml",
|
|
190
|
+
packageManager: "pnpm"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
filename: "package-lock.json",
|
|
194
|
+
packageManager: "npm"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
filename: "yarn.lock",
|
|
198
|
+
packageManager: "yarn"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
filename: "bun.lock",
|
|
202
|
+
packageManager: "bun"
|
|
203
|
+
}
|
|
204
|
+
]) {
|
|
205
|
+
const lockFilePath = path.join(dir, lockFile.filename);
|
|
206
|
+
if (fs.existsSync(lockFilePath)) return {
|
|
207
|
+
...lockFile,
|
|
208
|
+
path: lockFilePath
|
|
209
|
+
};
|
|
210
|
+
}
|
|
191
211
|
const parentDir = path.resolve(dir, "..");
|
|
192
212
|
if (parentDir !== dir) return this.findLockFile(parentDir);
|
|
193
213
|
return null;
|
|
194
214
|
}
|
|
195
|
-
getPackageManager() {
|
|
196
|
-
switch (this.findLockFile(this.rootDir)) {
|
|
197
|
-
case "pnpm-lock.yaml": return "pnpm";
|
|
198
|
-
case "package-lock.json": return "npm";
|
|
199
|
-
case "yarn.lock": return "yarn";
|
|
200
|
-
case "bun.lock": return "bun";
|
|
201
|
-
default: return "npm";
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
215
|
getWorkspaceDependencyPath({ pkgName, version }) {
|
|
205
216
|
return `file:./workspace-module/${pkgName}-${version}.tgz`;
|
|
206
217
|
}
|
|
@@ -254,19 +265,27 @@ var Deps = class extends MastraBase {
|
|
|
254
265
|
* Depending on whether we want to install or add a package, this function returns the appropriate commands.
|
|
255
266
|
* All package managers support both commands (e.g. npm install has an alias on "add")
|
|
256
267
|
*/
|
|
257
|
-
getPackageManagerCommand(pm, type) {
|
|
268
|
+
getPackageManagerCommand(pm, type, { yarnClassic = false } = {}) {
|
|
258
269
|
const cmd = type === "install" ? "install" : "add";
|
|
259
270
|
switch (pm) {
|
|
260
271
|
case "npm": return `${cmd} --audit=false --fund=false --loglevel=error --progress=false --update-notifier=false`;
|
|
261
|
-
case "yarn": return `${cmd}
|
|
262
|
-
case "pnpm": return
|
|
263
|
-
case "bun": return cmd;
|
|
272
|
+
case "yarn": return type === "install" && !yarnClassic ? `${cmd} --no-immutable` : cmd;
|
|
273
|
+
case "pnpm": return type === "install" ? `${cmd} --no-frozen-lockfile --loglevel=error` : `${cmd} --loglevel=error`;
|
|
264
274
|
default: return cmd;
|
|
265
275
|
}
|
|
266
276
|
}
|
|
267
277
|
async install({ dir = this.rootDir, architecture, pnpmOverrides, pnpmNodeLinker } = {}) {
|
|
268
278
|
const pm = this.packageManager;
|
|
269
|
-
|
|
279
|
+
let yarnClassic = false;
|
|
280
|
+
if (this.lockFile) {
|
|
281
|
+
const destination = path.join(dir, this.lockFile.filename);
|
|
282
|
+
if (path.resolve(this.lockFile.path) !== path.resolve(destination)) await fsPromises.copyFile(this.lockFile.path, destination);
|
|
283
|
+
if (pm === "yarn") {
|
|
284
|
+
const lockfileContents = await fsPromises.readFile(destination, "utf-8");
|
|
285
|
+
yarnClassic = /^# yarn lockfile v1\r?$/m.test(lockfileContents);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
const installCommand = this.getPackageManagerCommand(pm, "install", { yarnClassic });
|
|
270
289
|
let args = [];
|
|
271
290
|
switch (pm) {
|
|
272
291
|
case "pnpm":
|
|
@@ -476,4 +495,4 @@ var FileService = class {
|
|
|
476
495
|
//#endregion
|
|
477
496
|
export { createChildProcessLogger as a, DepsService as i, EnvService as n, createPinoStream as o, Deps as r, FileService as t };
|
|
478
497
|
|
|
479
|
-
//# sourceMappingURL=services-
|
|
498
|
+
//# sourceMappingURL=services-Lm6PRS4D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services-Lm6PRS4D.js","names":[],"sources":["../src/deploy/log.ts","../src/services/deps.ts","../src/services/env.ts","../src/services/fs.ts"],"sourcesContent":["import { spawn } from 'node:child_process';\nimport { Writable } from 'node:stream';\nimport type { IMastraLogger } from '@mastra/core/logger';\n\nexport const createPinoStream = (logger: IMastraLogger) => {\n return new Writable({\n write(chunk, _encoding, callback) {\n // Convert Buffer/string to string and trim whitespace\n const line = chunk.toString().trim();\n\n if (line) {\n console.info(line);\n // Log each line through Pino\n logger.info(line);\n }\n\n callback();\n },\n });\n};\n\n/**\n * Args are joined into a shell command (`shell: true` is required for package\n * manager shims on Windows), so only allow characters that appear in package\n * specifiers and CLI flags — never shell metacharacters (CodeQL\n * js/shell-command-constructed-from-input).\n */\nconst SAFE_SHELL_ARG = /^[\\w@%+=:,./^~-]*$/;\n\nexport function createChildProcessLogger({ logger, root }: { logger: IMastraLogger; root: string }) {\n const pinoStream = createPinoStream(logger);\n return async ({ cmd, args, env }: { cmd: string; args: string[]; env: Record<string, string> }) => {\n try {\n for (const arg of args) {\n if (!SAFE_SHELL_ARG.test(arg)) {\n throw new Error(`Refusing to pass unsafe argument to shell command: ${JSON.stringify(arg)}`);\n }\n }\n const subprocess = spawn(cmd, args, {\n cwd: root,\n shell: true,\n env,\n // No stdin for the child process — it doesn't need interactive input\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n subprocess.stdout?.on('data', chunk => {\n stdout += chunk.toString();\n });\n subprocess.stderr?.on('data', chunk => {\n stderr += chunk.toString();\n });\n\n // Pipe stdout and stderr through the logging stream.\n // { end: false } prevents the first stream to close from ending pinoStream\n // while the other may still be writing.\n subprocess.stdout?.pipe(pinoStream, { end: false });\n subprocess.stderr?.pipe(pinoStream, { end: false });\n\n // Wait for the process to complete\n return new Promise((resolve, reject) => {\n subprocess.on('close', code => {\n pinoStream.end();\n if (code === 0) {\n resolve({ success: true, stdout, stderr });\n } else {\n reject(Object.assign(new Error(`Process exited with code ${code}`), { stdout, stderr }));\n }\n });\n\n subprocess.on('error', error => {\n pinoStream.end();\n logger.error('Process failed', { error });\n reject(error);\n });\n });\n } catch (error) {\n console.error(error);\n logger.error('Process failed', { error });\n pinoStream.end();\n return { success: false, error };\n }\n };\n}\n","import fs from 'node:fs';\nimport fsPromises from 'node:fs/promises';\nimport path, { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { MastraBase } from '@mastra/core/base';\nimport { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';\nimport { readJSON, writeJSON, ensureFile } from 'fs-extra/esm';\nimport type { PackageJson } from 'type-fest';\nimport { parse } from 'yaml';\n\nimport { createChildProcessLogger } from '../deploy/log.js';\n\ntype PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\ninterface LockFileInfo {\n path: string;\n filename: string;\n packageManager: PackageManager;\n}\n\ninterface ArchitectureOptions {\n os?: string[];\n cpu?: string[];\n libc?: string[];\n}\n\ninterface InstallOptions extends ArchitectureOptions {\n pnpmOverrides?: Record<string, string>;\n pnpmNodeLinker?: 'hoisted';\n}\n\nconst PNPM_CONFIG_KEYS_TO_COPY = new Set([\n 'allowBuilds',\n 'onlyBuiltDependencies',\n 'ignoredBuiltDependencies',\n 'neverBuiltDependencies',\n 'minimumReleaseAge',\n 'minimumReleaseAgeExclude',\n 'trustPolicy',\n 'trustPolicyExclude',\n 'trustPolicyIgnoreAfter',\n 'supportedArchitectures',\n]);\n\nfunction getTopLevelYamlKey(line: string) {\n const match = /^(?!\\s)([\\w-]+):/.exec(line);\n return match?.[1];\n}\n\nconst PNPM_IGNORED_BUILDS_ERROR = 'ERR_PNPM_IGNORED_BUILDS';\n\nexport function getPnpmIgnoredBuildPackages(output: string): string[] {\n const match = new RegExp(`\\\\[?${PNPM_IGNORED_BUILDS_ERROR}\\\\]?[^\\\\n]*Ignored build scripts:\\\\s*([^\\\\n]+)`).exec(\n output,\n );\n if (!match?.[1]) return [];\n\n return match[1]\n .split(',')\n .map(specifier => specifier.trim())\n .filter(Boolean)\n .map(specifier => {\n if (specifier.startsWith('@')) {\n const versionSeparator = specifier.indexOf('@', 1);\n return versionSeparator === -1 ? specifier : specifier.slice(0, versionSeparator);\n }\n return specifier.split('@', 1)[0]!;\n });\n}\n\nfunction validatePnpmBuildApprovals(key: string, block: string): void {\n if (key !== 'allowBuilds' && key !== 'onlyBuiltDependencies') return;\n\n let value: unknown;\n try {\n value = (parse(block) as Record<string, unknown>)[key];\n } catch (error) {\n throw new MastraError(\n {\n id: 'DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG',\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n details: { key },\n text: `Invalid pnpm ${key} configuration`,\n },\n error,\n );\n }\n\n const invalidEntries =\n key === 'allowBuilds'\n ? value && typeof value === 'object' && !Array.isArray(value)\n ? Object.entries(value).filter(\n ([dependency, approval]) => dependency.trim().length === 0 || typeof approval !== 'boolean',\n )\n : [[key, value]]\n : Array.isArray(value) &&\n value.every(dependency => typeof dependency === 'string' && dependency.trim().length > 0)\n ? []\n : [[key, value]];\n\n if (invalidEntries.length === 0) return;\n const invalidEntryNames = invalidEntries.map(([entry]) => entry).join(', ');\n\n throw new MastraError({\n id: 'DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG',\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n details: { key, invalidEntries: invalidEntryNames },\n text: `Invalid pnpm ${key} entries: ${invalidEntryNames}`,\n });\n}\n\nexport function copyPnpmWorkspaceSettings(source: string, options: InstallOptions = {}) {\n const hasArchitecture = Boolean(options.os?.length || options.cpu?.length || options.libc?.length);\n const lines = source.split(/\\r?\\n/);\n const blocks: string[] = [];\n\n for (let index = 0; index < lines.length;) {\n const key = getTopLevelYamlKey(lines[index] ?? '');\n if (!key) {\n index += 1;\n continue;\n }\n\n const start = index;\n index += 1;\n while (index < lines.length && !getTopLevelYamlKey(lines[index] ?? '')) {\n index += 1;\n }\n\n if (!PNPM_CONFIG_KEYS_TO_COPY.has(key) || (key === 'supportedArchitectures' && hasArchitecture)) {\n continue;\n }\n\n const block = lines.slice(start, index).join('\\n').trimEnd();\n if (block) {\n validatePnpmBuildApprovals(key, block);\n blocks.push(block);\n }\n }\n\n if (hasArchitecture) {\n const architectureBlock = ['supportedArchitectures:'];\n if (options.os?.length) {\n architectureBlock.push(` os: ${JSON.stringify(options.os)}`);\n }\n if (options.cpu?.length) {\n architectureBlock.push(` cpu: ${JSON.stringify(options.cpu)}`);\n }\n if (options.libc?.length) {\n architectureBlock.push(` libc: ${JSON.stringify(options.libc)}`);\n }\n blocks.push(architectureBlock.join('\\n'));\n }\n\n if (options.pnpmOverrides && Object.keys(options.pnpmOverrides).length > 0) {\n blocks.push(\n [\n 'overrides:',\n ...Object.entries(options.pnpmOverrides).map(\n ([key, value]) => ` ${JSON.stringify(key)}: ${JSON.stringify(value)}`,\n ),\n ].join('\\n'),\n );\n }\n\n if (options.pnpmNodeLinker) {\n blocks.push(`nodeLinker: ${options.pnpmNodeLinker}`);\n }\n\n return [\"packages:\\n - '.'\", ...blocks].join('\\n\\n') + '\\n';\n}\n\nexport class Deps extends MastraBase {\n private packageManager: PackageManager;\n private rootDir: string;\n private lockFile: LockFileInfo | null;\n\n constructor(rootDir = process.cwd()) {\n super({ component: 'DEPLOYER', name: 'DEPS' });\n\n this.rootDir = rootDir;\n this.lockFile = this.findLockFile(rootDir);\n this.packageManager = this.lockFile?.packageManager ?? 'npm';\n }\n\n private findLockFile(dir: string): LockFileInfo | null {\n const lockFiles: Array<{ filename: string; packageManager: PackageManager }> = [\n { filename: 'pnpm-lock.yaml', packageManager: 'pnpm' },\n { filename: 'package-lock.json', packageManager: 'npm' },\n { filename: 'yarn.lock', packageManager: 'yarn' },\n { filename: 'bun.lock', packageManager: 'bun' },\n ];\n for (const lockFile of lockFiles) {\n const lockFilePath = path.join(dir, lockFile.filename);\n if (fs.existsSync(lockFilePath)) {\n return { ...lockFile, path: lockFilePath };\n }\n }\n const parentDir = path.resolve(dir, '..');\n if (parentDir !== dir) {\n return this.findLockFile(parentDir);\n }\n return null;\n }\n\n public getWorkspaceDependencyPath({ pkgName, version }: { pkgName: string; version: string }) {\n return `file:./workspace-module/${pkgName}-${version}.tgz`;\n }\n\n public async pack({ dir, destination, sanitizedName }: { dir: string; destination: string; sanitizedName: string }) {\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: dir,\n });\n\n let packCmd = 'pack';\n let destinationFlag = `--pack-destination ${destination}`;\n if (this.packageManager === 'yarn') {\n // %s includes an '@' at the start of packages names with an '@'\n // so we need to use our sanitizedName instead.\n destinationFlag = `--out ${destination}/${sanitizedName}-%v.tgz`;\n }\n if (this.packageManager === 'bun') {\n // bun uses `pm pack` instead of `pack`\n packCmd = 'pm pack';\n // bun uses --destination instead of --pack-destination\n destinationFlag = `--destination ${destination}`;\n }\n\n return cpLogger({\n cmd: `${this.packageManager} ${packCmd} ${destinationFlag}`,\n args: [],\n env: {\n PATH: process.env.PATH!,\n },\n });\n }\n\n private findPnpmWorkspaceFile(dir: string): string | null {\n const workspaceYamlPath = path.join(dir, 'pnpm-workspace.yaml');\n if (fs.existsSync(workspaceYamlPath)) {\n return workspaceYamlPath;\n }\n\n const parentDir = path.resolve(dir, '..');\n if (parentDir !== dir) {\n return this.findPnpmWorkspaceFile(parentDir);\n }\n\n return null;\n }\n\n private async writePnpmConfig(dir: string, options: InstallOptions = {}) {\n const sourceWorkspaceYamlPath = this.findPnpmWorkspaceFile(this.rootDir);\n const sourceWorkspaceYaml = sourceWorkspaceYamlPath\n ? await fsPromises.readFile(sourceWorkspaceYamlPath, 'utf-8')\n : '';\n\n await fsPromises.writeFile(\n path.join(dir, 'pnpm-workspace.yaml'),\n copyPnpmWorkspaceSettings(sourceWorkspaceYaml, options),\n 'utf-8',\n );\n }\n\n private async writeYarnConfig(dir: string, options: ArchitectureOptions) {\n const yarnrcPath = path.join(dir, '.yarnrc.yml');\n const config = {\n supportedArchitectures: {\n cpu: options.cpu || [],\n os: options.os || [],\n libc: options.libc || [],\n },\n };\n\n await fsPromises.writeFile(\n yarnrcPath,\n `supportedArchitectures:\\n${Object.entries(config.supportedArchitectures)\n .map(([key, value]) => ` ${key}: ${JSON.stringify(value)}`)\n .join('\\n')}`,\n );\n }\n\n private getNpmArgs(options: ArchitectureOptions): string[] {\n const args: string[] = [];\n if (options.cpu) args.push(`--cpu=${options.cpu.join(',')}`);\n if (options.os) args.push(`--os=${options.os.join(',')}`);\n if (options.libc) args.push(`--libc=${options.libc.join(',')}`);\n return args;\n }\n\n /**\n * Depending on whether we want to install or add a package, this function returns the appropriate commands.\n * All package managers support both commands (e.g. npm install has an alias on \"add\")\n */\n private getPackageManagerCommand(\n pm: PackageManager,\n type: 'install' | 'add',\n { yarnClassic = false }: { yarnClassic?: boolean } = {},\n ): string {\n const cmd = type === 'install' ? 'install' : 'add';\n\n switch (pm) {\n case 'npm':\n return `${cmd} --audit=false --fund=false --loglevel=error --progress=false --update-notifier=false`;\n case 'yarn':\n return type === 'install' && !yarnClassic ? `${cmd} --no-immutable` : cmd;\n case 'pnpm':\n return type === 'install' ? `${cmd} --no-frozen-lockfile --loglevel=error` : `${cmd} --loglevel=error`;\n default:\n return cmd;\n }\n }\n\n public async install({\n dir = this.rootDir,\n architecture,\n pnpmOverrides,\n pnpmNodeLinker,\n }: {\n dir?: string;\n architecture?: ArchitectureOptions;\n pnpmOverrides?: Record<string, string>;\n pnpmNodeLinker?: 'hoisted';\n } = {}) {\n const pm = this.packageManager;\n let yarnClassic = false;\n if (this.lockFile) {\n const destination = path.join(dir, this.lockFile.filename);\n if (path.resolve(this.lockFile.path) !== path.resolve(destination)) {\n await fsPromises.copyFile(this.lockFile.path, destination);\n }\n\n if (pm === 'yarn') {\n const lockfileContents = await fsPromises.readFile(destination, 'utf-8');\n yarnClassic = /^# yarn lockfile v1\\r?$/m.test(lockfileContents);\n }\n }\n\n const installCommand = this.getPackageManagerCommand(pm, 'install', { yarnClassic });\n let args: string[] = [];\n\n switch (pm) {\n case 'pnpm':\n await this.writePnpmConfig(dir, { ...architecture, pnpmOverrides, pnpmNodeLinker });\n break;\n case 'yarn':\n // similar to --ignore-workspace but for yarn\n await ensureFile(path.join(dir, 'yarn.lock'));\n if (architecture) {\n await this.writeYarnConfig(dir, architecture);\n }\n break;\n case 'npm':\n if (architecture) {\n args = this.getNpmArgs(architecture);\n }\n break;\n default:\n // Do nothing\n }\n\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: dir,\n });\n\n try {\n return await cpLogger({\n cmd: `${pm} ${installCommand}`,\n args,\n env: process.env as Record<string, string>,\n });\n } catch (error) {\n if (pm !== 'pnpm') throw error;\n\n const processOutput =\n error && typeof error === 'object'\n ? `${'stdout' in error ? String(error.stdout) : ''}\\n${'stderr' in error ? String(error.stderr) : ''}`\n : '';\n const ignoredPackages = getPnpmIgnoredBuildPackages(processOutput);\n if (ignoredPackages.length === 0) throw error;\n\n throw new MastraError(\n {\n id: 'DEPLOYER_PNPM_IGNORED_BUILDS',\n domain: ErrorDomain.DEPLOYER,\n category: ErrorCategory.USER,\n details: { packageNames: ignoredPackages.join(', ') },\n text: `pnpm blocked build scripts for: ${ignoredPackages.join(', ')}. Add these packages to allowBuilds in pnpm-workspace.yaml and retry the build.`,\n },\n error,\n );\n }\n }\n\n public async installPackages(packages: string[]) {\n const pm = this.packageManager;\n const installCommand = this.getPackageManagerCommand(pm, 'add');\n\n const env: Record<string, string> = {\n PATH: process.env.PATH!,\n };\n\n if (process.env.npm_config_registry) {\n env.npm_config_registry = process.env.npm_config_registry;\n }\n\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: '',\n });\n\n return cpLogger({\n cmd: `${pm} ${installCommand}`,\n args: packages,\n env,\n });\n }\n\n public async checkDependencies(dependencies: string[]): Promise<string> {\n try {\n const packageJsonPath = path.join(this.rootDir, 'package.json');\n\n try {\n await fsPromises.access(packageJsonPath);\n } catch {\n return 'No package.json file found in the current directory';\n }\n\n const packageJson = await readJSON(packageJsonPath);\n for (const dependency of dependencies) {\n if (!packageJson.dependencies || !packageJson.dependencies[dependency]) {\n return `Please install ${dependency} before running this command (${this.packageManager} install ${dependency})`;\n }\n }\n\n return 'ok';\n } catch (err) {\n console.error(err);\n return 'Could not check dependencies';\n }\n }\n\n public async getProjectName() {\n try {\n const packageJsonPath = path.join(this.rootDir, 'package.json');\n const pkg = await readJSON(packageJsonPath);\n return pkg.name;\n } catch (err) {\n throw err;\n }\n }\n\n public async getPackageVersion() {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n const pkgJsonPath = path.join(__dirname, '..', '..', 'package.json');\n\n const content = (await readJSON(pkgJsonPath)) as PackageJson;\n return content.version;\n }\n\n public async addScriptsToPackageJson(scripts: Record<string, string>) {\n const packageJson = await readJSON('package.json');\n packageJson.scripts = {\n ...packageJson.scripts,\n ...scripts,\n };\n await writeJSON('package.json', packageJson, { spaces: 2 });\n }\n}\n\nexport class DepsService extends Deps {}\n","import * as fs from 'node:fs';\n\nexport abstract class EnvService {\n abstract getEnvValue(key: string): Promise<string | null>;\n abstract setEnvValue(key: string, value: string): Promise<void>;\n}\n\nexport class FileEnvService extends EnvService {\n private filePath: string;\n\n constructor(filePath: string) {\n super();\n this.filePath = filePath;\n }\n\n private readFile(filePath: string): Promise<string> {\n return new Promise((resolve, reject) => {\n fs.readFile(filePath, 'utf8', (err: NodeJS.ErrnoException | null, data: string) => {\n if (err) reject(err);\n else resolve(data);\n });\n });\n }\n\n private writeFile({ filePath, data }: { filePath: string; data: string }): Promise<void> {\n return new Promise((resolve, reject) => {\n fs.writeFile(filePath, data, 'utf8', (err: NodeJS.ErrnoException | null) => {\n if (err) reject(err);\n else resolve();\n });\n });\n }\n\n private async updateEnvData({\n key,\n value,\n filePath = this.filePath,\n data,\n }: {\n key: string;\n value: string;\n filePath?: string;\n data: string;\n }): Promise<string> {\n const regex = new RegExp(`^${key}=.*$`, 'm');\n if (data.match(regex)) {\n // Use a replacement function so `$` sequences in the value (e.g. `$&`,\n // `$$`) are written literally instead of being interpreted as\n // String.prototype.replace special patterns.\n data = data.replace(regex, () => `${key}=${value}`);\n } else {\n data += `\\n${key}=${value}`;\n }\n await this.writeFile({ filePath, data });\n console.info(`${key} set to ${value} in ENV file.`);\n return data;\n }\n\n async getEnvValue(key: string): Promise<string | null> {\n try {\n const data = await this.readFile(this.filePath);\n const regex = new RegExp(`^${key}=(.*)$`, 'm');\n const match = data.match(regex);\n return match?.[1] || null;\n } catch (err) {\n console.error(`Error reading ENV value: ${err}`);\n return null;\n }\n }\n\n async setEnvValue(key: string, value: string): Promise<void> {\n try {\n const data = await this.readFile(this.filePath);\n await this.updateEnvData({ key, value, data });\n } catch (err) {\n console.error(`Error writing ENV value: ${err}`);\n }\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport fsExtra from 'fs-extra/esm';\n\nimport { FileEnvService } from './env.js';\n\nexport class FileService {\n /**\n *\n * @param inputFile the file in the starter files directory to copy\n * @param outputFilePath the destination path\n * @param replaceIfExists flag to replace if it exists\n * @returns\n */\n public async copyStarterFile(inputFile: string, outputFilePath: string, replaceIfExists?: boolean) {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n const filePath = path.resolve(__dirname, '..', 'starter-files', inputFile);\n const fileString = fs.readFileSync(filePath, 'utf8');\n\n if (fs.existsSync(outputFilePath) && !replaceIfExists) {\n console.info(`${outputFilePath} already exists`);\n return false;\n }\n\n await fsExtra.outputFile(outputFilePath, fileString);\n\n return true;\n }\n\n public async setupEnvFile({ dbUrl }: { dbUrl: string }) {\n const envPath = path.join(process.cwd(), '.env.development');\n\n await fsExtra.ensureFile(envPath);\n\n const fileEnvService = new FileEnvService(envPath);\n await fileEnvService.setEnvValue('DB_URL', dbUrl);\n }\n\n public getFirstExistingFile(files: string[]): string {\n for (const f of files) {\n if (fs.existsSync(f)) {\n return f;\n }\n }\n\n throw new Error('Missing required file, checked the following paths: ' + files.join(', '));\n }\n\n /**\n * Returns every existing file from the provided array in the same order.\n * Callers supply files from the lowest to highest precedence so later dotenv\n * files override earlier values when the bundler loads them.\n */\n public getExistingFiles(files: string[]): string[] {\n return files.filter(file => fs.existsSync(file));\n }\n\n /**\n * Returns the first existing file from the provided array, or undefined if none exist\n * @param files array of file paths to check\n * @returns the first existing file path or undefined\n */\n public getFirstExistingFileOrUndefined(files: string[]): string | undefined {\n for (const f of files) {\n if (fs.existsSync(f)) {\n return f;\n }\n }\n\n return undefined;\n }\n\n public replaceValuesInFile({\n filePath,\n replacements,\n }: {\n filePath: string;\n replacements: { search: string; replace: string }[];\n }) {\n let fileContent = fs.readFileSync(filePath, 'utf8');\n replacements.forEach(({ search, replace }) => {\n fileContent = fileContent.replaceAll(search, replace);\n });\n\n fs.writeFileSync(filePath, fileContent);\n }\n}\n"],"mappings":";;;;;;;;;;;;AAIA,MAAa,oBAAoB,WAA0B;CACzD,OAAO,IAAI,SAAS,EAClB,MAAM,OAAO,WAAW,UAAU;EAEhC,MAAM,OAAO,MAAM,SAAS,CAAC,CAAC,KAAK;EAEnC,IAAI,MAAM;GACR,QAAQ,KAAK,IAAI;GAEjB,OAAO,KAAK,IAAI;EAClB;EAEA,SAAS;CACX,EACF,CAAC;AACH;;;;;;;AAQA,MAAM,iBAAiB;AAEvB,SAAgB,yBAAyB,EAAE,QAAQ,QAAiD;CAClG,MAAM,aAAa,iBAAiB,MAAM;CAC1C,OAAO,OAAO,EAAE,KAAK,MAAM,UAAwE;EACjG,IAAI;GACF,KAAK,MAAM,OAAO,MAChB,IAAI,CAAC,eAAe,KAAK,GAAG,GAC1B,MAAM,IAAI,MAAM,sDAAsD,KAAK,UAAU,GAAG,GAAG;GAG/F,MAAM,aAAa,MAAM,KAAK,MAAM;IAClC,KAAK;IACL,OAAO;IACP;IAEA,OAAO;KAAC;KAAU;KAAQ;IAAM;GAClC,CAAC;GAED,IAAI,SAAS;GACb,IAAI,SAAS;GACb,WAAW,QAAQ,GAAG,SAAQ,UAAS;IACrC,UAAU,MAAM,SAAS;GAC3B,CAAC;GACD,WAAW,QAAQ,GAAG,SAA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AAyB;EACnD,KAAK,MAAM,KAAK,OACd,IAAI,GAAG,WAAW,CAAC,GACjB,OAAO;EAIX,MAAM,IAAI,MAAM,yDAAyD,MAAM,KAAK,IAAI,CAAC;CAC3F;;;;;;CAOA,iBAAwB,OAA2B;EACjD,OAAO,MAAM,QAAO,SAAQ,GAAG,WAAW,IAAI,CAAC;CACjD;;;;;;CAOA,gCAAuC,OAAqC;EAC1E,KAAK,MAAM,KAAK,OACd,IAAI,GAAG,WAAW,CAAC,GACjB,OAAO;CAKb;CAEA,oBAA2B,EACzB,UACA,gBAIC;EACD,IAAI,cAAc,GAAG,aAAa,UAAU,MAAM;EAClD,aAAa,SAAS,EAAE,QAAQ,cAAc;GAC5C,cAAc,YAAY,WAAW,QAAQ,OAAO;EACtD,CAAC;EAED,GAAG,cAAc,UAAU,WAAW;CACxC;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_index_CLddUTqr = require("./index-CLddUTqr-
|
|
2
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/
|
|
1
|
+
const require_index_CLddUTqr = require("./index-CLddUTqr-DsGkVS-W.cjs");
|
|
2
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/51aed048de3b19fc603080fe95a6465a0f7208b9be56abfbffac914316d9d07e/node_modules/@standard-community/standard-json/dist/sury-CWZTCd75.js
|
|
3
3
|
async function getToJsonSchemaFn() {
|
|
4
4
|
try {
|
|
5
5
|
const { toJSONSchema } = await import("sury");
|
|
@@ -11,4 +11,4 @@ async function getToJsonSchemaFn() {
|
|
|
11
11
|
//#endregion
|
|
12
12
|
exports.default = getToJsonSchemaFn;
|
|
13
13
|
|
|
14
|
-
//# sourceMappingURL=sury-CWZTCd75-
|
|
14
|
+
//# sourceMappingURL=sury-CWZTCd75-ChXu4j-p.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sury-CWZTCd75-
|
|
1
|
+
{"version":3,"file":"sury-CWZTCd75-ChXu4j-p.cjs","names":["MissingDependencyError"],"sources":["../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/51aed048de3b19fc603080fe95a6465a0f7208b9be56abfbffac914316d9d07e/node_modules/@standard-community/standard-json/dist/sury-CWZTCd75.js"],"sourcesContent":["import { M as MissingDependencyError } from './index-CLddUTqr.js';\nimport 'quansync';\n\nasync function getToJsonSchemaFn() {\n try {\n const { toJSONSchema } = await import('sury');\n return toJSONSchema;\n } catch {\n throw new MissingDependencyError(\"sury\");\n }\n}\n\nexport { getToJsonSchemaFn as default };\n"],"x_google_ignoreList":[0],"mappings":";;AAGA,eAAe,oBAAoB;CACjC,IAAI;EACF,MAAM,EAAE,iBAAiB,MAAM,OAAO;EACtC,OAAO;CACT,QAAQ;EACN,MAAM,IAAIA,uBAAAA,uBAAuB,MAAM;CACzC;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as MissingDependencyError } from "./index-CLddUTqr-
|
|
2
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/
|
|
1
|
+
import { t as MissingDependencyError } from "./index-CLddUTqr-BXqo9et4.js";
|
|
2
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/51aed048de3b19fc603080fe95a6465a0f7208b9be56abfbffac914316d9d07e/node_modules/@standard-community/standard-json/dist/sury-CWZTCd75.js
|
|
3
3
|
async function getToJsonSchemaFn() {
|
|
4
4
|
try {
|
|
5
5
|
const { toJSONSchema } = await import("sury");
|
|
@@ -11,4 +11,4 @@ async function getToJsonSchemaFn() {
|
|
|
11
11
|
//#endregion
|
|
12
12
|
export { getToJsonSchemaFn as default };
|
|
13
13
|
|
|
14
|
-
//# sourceMappingURL=sury-CWZTCd75-
|
|
14
|
+
//# sourceMappingURL=sury-CWZTCd75-OKz7uWLi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sury-CWZTCd75-
|
|
1
|
+
{"version":3,"file":"sury-CWZTCd75-OKz7uWLi.js","names":[],"sources":["../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/51aed048de3b19fc603080fe95a6465a0f7208b9be56abfbffac914316d9d07e/node_modules/@standard-community/standard-json/dist/sury-CWZTCd75.js"],"sourcesContent":["import { M as MissingDependencyError } from './index-CLddUTqr.js';\nimport 'quansync';\n\nasync function getToJsonSchemaFn() {\n try {\n const { toJSONSchema } = await import('sury');\n return toJSONSchema;\n } catch {\n throw new MissingDependencyError(\"sury\");\n }\n}\n\nexport { getToJsonSchemaFn as default };\n"],"x_google_ignoreList":[0],"mappings":";;AAGA,eAAe,oBAAoB;CACjC,IAAI;EACF,MAAM,EAAE,iBAAiB,MAAM,OAAO;EACtC,OAAO;CACT,QAAQ;EACN,MAAM,IAAI,uBAAuB,MAAM;CACzC;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/
|
|
1
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/51aed048de3b19fc603080fe95a6465a0f7208b9be56abfbffac914316d9d07e/node_modules/@standard-community/standard-json/dist/typebox-Dei93FPO.js
|
|
2
2
|
function getToJsonSchemaFn() {
|
|
3
3
|
return (schema) => JSON.parse(JSON.stringify(schema.Type()));
|
|
4
4
|
}
|
|
5
5
|
//#endregion
|
|
6
6
|
export { getToJsonSchemaFn as default };
|
|
7
7
|
|
|
8
|
-
//# sourceMappingURL=typebox-Dei93FPO-
|
|
8
|
+
//# sourceMappingURL=typebox-Dei93FPO-C5ACKU09.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typebox-Dei93FPO-
|
|
1
|
+
{"version":3,"file":"typebox-Dei93FPO-C5ACKU09.js","names":[],"sources":["../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/51aed048de3b19fc603080fe95a6465a0f7208b9be56abfbffac914316d9d07e/node_modules/@standard-community/standard-json/dist/typebox-Dei93FPO.js"],"sourcesContent":["function getToJsonSchemaFn() {\n return (schema) => JSON.parse(JSON.stringify(schema.Type()));\n}\n\nexport { getToJsonSchemaFn as default };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAS,oBAAoB;CAC3B,QAAQ,WAAW,KAAK,MAAM,KAAK,UAAU,OAAO,KAAK,CAAC,CAAC;AAC7D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/
|
|
1
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/51aed048de3b19fc603080fe95a6465a0f7208b9be56abfbffac914316d9d07e/node_modules/@standard-community/standard-json/dist/typebox-Dei93FPO.js
|
|
2
2
|
function getToJsonSchemaFn() {
|
|
3
3
|
return (schema) => JSON.parse(JSON.stringify(schema.Type()));
|
|
4
4
|
}
|
|
5
5
|
//#endregion
|
|
6
6
|
exports.default = getToJsonSchemaFn;
|
|
7
7
|
|
|
8
|
-
//# sourceMappingURL=typebox-Dei93FPO-
|
|
8
|
+
//# sourceMappingURL=typebox-Dei93FPO-KTtPU745.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typebox-Dei93FPO-
|
|
1
|
+
{"version":3,"file":"typebox-Dei93FPO-KTtPU745.cjs","names":[],"sources":["../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@standard-community/standard-json/0.3.5/51aed048de3b19fc603080fe95a6465a0f7208b9be56abfbffac914316d9d07e/node_modules/@standard-community/standard-json/dist/typebox-Dei93FPO.js"],"sourcesContent":["function getToJsonSchemaFn() {\n return (schema) => JSON.parse(JSON.stringify(schema.Type()));\n}\n\nexport { getToJsonSchemaFn as default };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAS,oBAAoB;CAC3B,QAAQ,WAAW,KAAK,MAAM,KAAK,UAAU,OAAO,KAAK,CAAC,CAAC;AAC7D"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { builtinModules } from "module";
|
|
2
|
-
import "child_process";
|
|
3
2
|
import "fs";
|
|
4
3
|
import { basename, join, relative } from "path";
|
|
5
4
|
//#region src/build/utils.ts
|
|
@@ -199,4 +198,4 @@ function isBareModuleSpecifier(specifier) {
|
|
|
199
198
|
//#endregion
|
|
200
199
|
export { getPackageName as a, isBuiltinModule as c, normalizeStudioBase as d, rollupSafeName as f, getNodeResolveOptions as i, isDependencyPartOfPackage as l, slash as m, escapeStudioHtmlValue as n, injectStudioHtmlConfig as o, shouldSkipInstall as p, getCompiledDepCachePath as r, isBareModuleSpecifier as s, detectRuntime as t, isExternalProtocolImport as u };
|
|
201
200
|
|
|
202
|
-
//# sourceMappingURL=utils-
|
|
201
|
+
//# sourceMappingURL=utils-Bl3Lm7SI.js.map
|