create-mastra 1.35.0 → 1.35.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +225 -210
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -13174,7 +13174,7 @@ const u = Object.create(a, {
|
|
|
13174
13174
|
value: o
|
|
13175
13175
|
}
|
|
13176
13176
|
});
|
|
13177
|
-
function h
|
|
13177
|
+
function h({ preventCancel: r = !1 } = {}) {
|
|
13178
13178
|
const t = new c(this.getReader(), r), s = Object.create(u);
|
|
13179
13179
|
return s[n] = t, s;
|
|
13180
13180
|
}
|
|
@@ -13183,7 +13183,7 @@ function h$1({ preventCancel: r = !1 } = {}) {
|
|
|
13183
13183
|
const getAsyncIterable = (stream) => {
|
|
13184
13184
|
if (isReadableStream$1(stream, { checkOpen: false }) && nodeImports.on !== void 0) return getStreamIterable(stream);
|
|
13185
13185
|
if (typeof stream?.[Symbol.asyncIterator] === "function") return stream;
|
|
13186
|
-
if (toString.call(stream) === "[object ReadableStream]") return h
|
|
13186
|
+
if (toString.call(stream) === "[object ReadableStream]") return h.call(stream);
|
|
13187
13187
|
throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.");
|
|
13188
13188
|
};
|
|
13189
13189
|
const { toString } = Object.prototype;
|
|
@@ -17267,7 +17267,7 @@ var require_yocto_spinner = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
17267
17267
|
};
|
|
17268
17268
|
}));
|
|
17269
17269
|
//#endregion
|
|
17270
|
-
//#region ../cli/dist/analytics-
|
|
17270
|
+
//#region ../cli/dist/analytics-2-XO4VBq.js
|
|
17271
17271
|
const CREATE_LLM_PROVIDERS = [
|
|
17272
17272
|
{
|
|
17273
17273
|
value: "openai",
|
|
@@ -19040,7 +19040,7 @@ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19040
19040
|
};
|
|
19041
19041
|
}));
|
|
19042
19042
|
//#endregion
|
|
19043
|
-
//#region ../cli/dist/create-
|
|
19043
|
+
//#region ../cli/dist/create-CS8ImN4Y.js
|
|
19044
19044
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
19045
19045
|
var import_yocto_spinner = /* @__PURE__ */ __toESM(require_yocto_spinner(), 1);
|
|
19046
19046
|
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
@@ -19552,20 +19552,20 @@ const MANAGED_PROVIDER_CONFIGS = {
|
|
|
19552
19552
|
},
|
|
19553
19553
|
anthropic: {
|
|
19554
19554
|
displayName: "Anthropic",
|
|
19555
|
-
primaryModel: "anthropic/claude-sonnet-5",
|
|
19556
|
-
observationalModel: "anthropic/claude-haiku-
|
|
19555
|
+
primaryModel: "anthropic/claude-sonnet-5-5",
|
|
19556
|
+
observationalModel: "anthropic/claude-haiku-5-5",
|
|
19557
19557
|
apiKeyEnv: "ANTHROPIC_API_KEY"
|
|
19558
19558
|
},
|
|
19559
19559
|
google: {
|
|
19560
19560
|
displayName: "Google Gemini",
|
|
19561
|
-
primaryModel: "google/gemini-3.
|
|
19562
|
-
observationalModel: "google/gemini-3.
|
|
19561
|
+
primaryModel: "google/gemini-3.8-flash",
|
|
19562
|
+
observationalModel: "google/gemini-3.8-flash",
|
|
19563
19563
|
apiKeyEnv: "GOOGLE_GENERATIVE_AI_API_KEY"
|
|
19564
19564
|
},
|
|
19565
19565
|
xai: {
|
|
19566
19566
|
displayName: "xAI",
|
|
19567
|
-
primaryModel: "xai/grok-4.
|
|
19568
|
-
observationalModel: "xai/grok-4.
|
|
19567
|
+
primaryModel: "xai/grok-4.7",
|
|
19568
|
+
observationalModel: "xai/grok-4.7",
|
|
19569
19569
|
apiKeyEnv: "XAI_API_KEY"
|
|
19570
19570
|
}
|
|
19571
19571
|
};
|
|
@@ -20310,201 +20310,213 @@ async function resolveTemplate(mode, template) {
|
|
|
20310
20310
|
return found;
|
|
20311
20311
|
}
|
|
20312
20312
|
//#endregion
|
|
20313
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/tinyexec/1.
|
|
20314
|
-
const
|
|
20315
|
-
const
|
|
20313
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/tinyexec/1.3.1/50fc88cbc4442f3393090d7d0dba550c64855cf2ab2c02916e6c18035fba2f9e/node_modules/tinyexec/dist/main.mjs
|
|
20314
|
+
const isPathLikePattern = /^path$/i;
|
|
20315
|
+
const defaultEnvPathInfo = {
|
|
20316
20316
|
key: "PATH",
|
|
20317
20317
|
value: ""
|
|
20318
20318
|
};
|
|
20319
|
-
function
|
|
20320
|
-
for (const
|
|
20321
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
20322
|
-
const
|
|
20323
|
-
if (!
|
|
20319
|
+
function getPathFromEnv(env) {
|
|
20320
|
+
for (const key in env) {
|
|
20321
|
+
if (!Object.prototype.hasOwnProperty.call(env, key) || !isPathLikePattern.test(key)) continue;
|
|
20322
|
+
const value = env[key];
|
|
20323
|
+
if (!value) return defaultEnvPathInfo;
|
|
20324
20324
|
return {
|
|
20325
|
-
key
|
|
20326
|
-
value
|
|
20325
|
+
key,
|
|
20326
|
+
value
|
|
20327
20327
|
};
|
|
20328
20328
|
}
|
|
20329
|
-
return
|
|
20329
|
+
return defaultEnvPathInfo;
|
|
20330
20330
|
}
|
|
20331
|
-
function
|
|
20332
|
-
const
|
|
20333
|
-
const
|
|
20334
|
-
let
|
|
20335
|
-
let
|
|
20331
|
+
function addNodeBinToPath(cwd, path) {
|
|
20332
|
+
const parts = path.value.split(delimiter);
|
|
20333
|
+
const nodeBinPaths = [];
|
|
20334
|
+
let currentPath = typeof cwd === "string" ? cwd : fileURLToPath(cwd, { windows: false });
|
|
20335
|
+
let lastPath;
|
|
20336
20336
|
do {
|
|
20337
|
-
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
} while (
|
|
20341
|
-
|
|
20342
|
-
const
|
|
20337
|
+
nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
|
|
20338
|
+
lastPath = currentPath;
|
|
20339
|
+
currentPath = dirname(currentPath);
|
|
20340
|
+
} while (currentPath !== lastPath);
|
|
20341
|
+
nodeBinPaths.push(dirname(process.execPath));
|
|
20342
|
+
const newPath = nodeBinPaths.concat(parts).join(delimiter);
|
|
20343
20343
|
return {
|
|
20344
|
-
key:
|
|
20345
|
-
value:
|
|
20344
|
+
key: path.key,
|
|
20345
|
+
value: newPath
|
|
20346
20346
|
};
|
|
20347
20347
|
}
|
|
20348
|
-
function
|
|
20349
|
-
const
|
|
20348
|
+
function computeEnv(cwd, env, nodePath = true) {
|
|
20349
|
+
const envWithDefault = {
|
|
20350
20350
|
...process.env,
|
|
20351
|
-
...
|
|
20351
|
+
...env
|
|
20352
20352
|
};
|
|
20353
|
-
if (!
|
|
20354
|
-
const
|
|
20355
|
-
|
|
20356
|
-
return
|
|
20357
|
-
}
|
|
20358
|
-
const
|
|
20359
|
-
let
|
|
20360
|
-
const
|
|
20361
|
-
const
|
|
20362
|
-
if (--
|
|
20353
|
+
if (!nodePath) return envWithDefault;
|
|
20354
|
+
const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
|
|
20355
|
+
envWithDefault[envPathInfo.key] = envPathInfo.value;
|
|
20356
|
+
return envWithDefault;
|
|
20357
|
+
}
|
|
20358
|
+
const combineStreams = (streams) => {
|
|
20359
|
+
let streamCount = streams.length;
|
|
20360
|
+
const combined = new PassThrough();
|
|
20361
|
+
const maybeEmitEnd = () => {
|
|
20362
|
+
if (--streamCount === 0) combined.end();
|
|
20363
20363
|
};
|
|
20364
|
-
for (const
|
|
20365
|
-
return
|
|
20366
|
-
};
|
|
20367
|
-
const
|
|
20368
|
-
const
|
|
20369
|
-
const
|
|
20370
|
-
const
|
|
20371
|
-
const
|
|
20372
|
-
const
|
|
20364
|
+
for (const stream of streams) pipeline(stream, combined, { end: false }).then(maybeEmitEnd).catch(maybeEmitEnd);
|
|
20365
|
+
return combined;
|
|
20366
|
+
};
|
|
20367
|
+
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
20368
|
+
const shebangRegExp = /^#!\s*(.+)/;
|
|
20369
|
+
const isWindowsExecutableRegExp = /\.(?:com|exe)$/i;
|
|
20370
|
+
const isNodeModulesCmdRegExp = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
|
|
20371
|
+
const isWindows = process.platform === "win32";
|
|
20372
|
+
const defaultPathExt = [
|
|
20373
20373
|
".EXE",
|
|
20374
20374
|
".CMD",
|
|
20375
20375
|
".BAT",
|
|
20376
20376
|
".COM"
|
|
20377
20377
|
];
|
|
20378
|
+
const noPathExt = [""];
|
|
20378
20379
|
/**
|
|
20379
20380
|
* Normalizes the command and arguments to work cross-platform.
|
|
20380
20381
|
* On Windows, this basically handles things like shebangs, calling
|
|
20381
20382
|
* `node_modules/.bin` commands, and escaping meta characters.
|
|
20382
20383
|
* On other platforms, it just returns the command and arguments as-is.
|
|
20383
20384
|
*/
|
|
20384
|
-
function
|
|
20385
|
-
if (
|
|
20386
|
-
command
|
|
20387
|
-
args
|
|
20388
|
-
options
|
|
20385
|
+
function normalizeSpawnCommand(command, args = [], options = {}) {
|
|
20386
|
+
if (options.shell === true || !isWindows) return {
|
|
20387
|
+
command,
|
|
20388
|
+
args,
|
|
20389
|
+
options
|
|
20389
20390
|
};
|
|
20390
|
-
let
|
|
20391
|
-
let
|
|
20392
|
-
if (
|
|
20393
|
-
const
|
|
20394
|
-
const
|
|
20395
|
-
let
|
|
20391
|
+
let file = resolveCommand(command, options);
|
|
20392
|
+
let shebang = null;
|
|
20393
|
+
if (file !== null) {
|
|
20394
|
+
const size = 150;
|
|
20395
|
+
const buffer = Buffer.alloc(size);
|
|
20396
|
+
let fd = null;
|
|
20396
20397
|
try {
|
|
20397
|
-
|
|
20398
|
-
readSync(
|
|
20398
|
+
fd = openSync(file, "r");
|
|
20399
|
+
readSync(fd, buffer, 0, size, 0);
|
|
20399
20400
|
} catch {} finally {
|
|
20400
|
-
if (
|
|
20401
|
-
}
|
|
20402
|
-
const
|
|
20403
|
-
if (
|
|
20404
|
-
const
|
|
20405
|
-
const
|
|
20406
|
-
const
|
|
20407
|
-
const
|
|
20408
|
-
const
|
|
20409
|
-
|
|
20410
|
-
}
|
|
20411
|
-
}
|
|
20412
|
-
if (
|
|
20413
|
-
|
|
20414
|
-
|
|
20415
|
-
|
|
20416
|
-
}
|
|
20417
|
-
if (
|
|
20418
|
-
const
|
|
20419
|
-
|
|
20420
|
-
|
|
20421
|
-
|
|
20422
|
-
|
|
20423
|
-
|
|
20424
|
-
|
|
20425
|
-
|
|
20426
|
-
if (
|
|
20427
|
-
return
|
|
20401
|
+
if (fd !== null) closeSync(fd);
|
|
20402
|
+
}
|
|
20403
|
+
const match = buffer.toString().match(shebangRegExp);
|
|
20404
|
+
if (match !== null) {
|
|
20405
|
+
const line = match[1].trim();
|
|
20406
|
+
const separatorIndex = line.indexOf(" ");
|
|
20407
|
+
const path = separatorIndex !== -1 ? line.slice(0, separatorIndex) : line;
|
|
20408
|
+
const argument = separatorIndex !== -1 ? line.slice(separatorIndex + 1) : "";
|
|
20409
|
+
const binary = basename(path);
|
|
20410
|
+
shebang = binary === "env" ? argument || null : binary;
|
|
20411
|
+
}
|
|
20412
|
+
}
|
|
20413
|
+
if (shebang !== null && file !== null) {
|
|
20414
|
+
args = [file, ...args];
|
|
20415
|
+
command = shebang;
|
|
20416
|
+
file = resolveCommand(command, options);
|
|
20417
|
+
}
|
|
20418
|
+
if (file === null || !isWindowsExecutableRegExp.test(file)) {
|
|
20419
|
+
const needsDoubleEscapeMetaChars = file !== null && isNodeModulesCmdRegExp.test(file);
|
|
20420
|
+
command = normalize(command);
|
|
20421
|
+
command = command.replace(metaCharsRegExp, "^$1");
|
|
20422
|
+
args = args.map((arg) => {
|
|
20423
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
20424
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
20425
|
+
arg = `"${arg}"`;
|
|
20426
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
20427
|
+
if (needsDoubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
20428
|
+
return arg;
|
|
20428
20429
|
});
|
|
20429
|
-
|
|
20430
|
+
args = [
|
|
20430
20431
|
"/d",
|
|
20431
20432
|
"/s",
|
|
20432
20433
|
"/c",
|
|
20433
|
-
`"${[
|
|
20434
|
+
`"${[command, ...args].join(" ")}"`
|
|
20434
20435
|
];
|
|
20435
|
-
|
|
20436
|
-
|
|
20437
|
-
...
|
|
20436
|
+
command = options.env?.comspec ?? "cmd.exe";
|
|
20437
|
+
options = {
|
|
20438
|
+
...options,
|
|
20438
20439
|
windowsVerbatimArguments: true
|
|
20439
20440
|
};
|
|
20440
20441
|
}
|
|
20441
20442
|
return {
|
|
20442
|
-
command
|
|
20443
|
-
args
|
|
20444
|
-
options
|
|
20443
|
+
command,
|
|
20444
|
+
args,
|
|
20445
|
+
options
|
|
20445
20446
|
};
|
|
20446
20447
|
}
|
|
20447
20448
|
/**
|
|
20448
20449
|
* Resolves the command to an absolute path if possible.
|
|
20449
20450
|
* Handles things like traversing PATH and adding extensions from PATHEXT
|
|
20450
20451
|
*/
|
|
20451
|
-
function
|
|
20452
|
-
const
|
|
20453
|
-
const
|
|
20454
|
-
const
|
|
20455
|
-
const
|
|
20456
|
-
|
|
20457
|
-
if (
|
|
20458
|
-
for (const
|
|
20459
|
-
const
|
|
20460
|
-
|
|
20461
|
-
|
|
20452
|
+
function resolveCommand(command, options) {
|
|
20453
|
+
const cwd$3 = (options.cwd ?? cwd()).toString();
|
|
20454
|
+
const env = options.env ?? process.env;
|
|
20455
|
+
const PATH = getPathFromEnv(env).value;
|
|
20456
|
+
const pathEnv = command.includes("/") || command.includes("\\") ? [""] : [cwd$3, ...PATH.split(delimiter)];
|
|
20457
|
+
let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
|
|
20458
|
+
if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
|
|
20459
|
+
for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
|
|
20460
|
+
const unquoted = path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path;
|
|
20461
|
+
const dest = resolve(cwd$3, unquoted, command);
|
|
20462
|
+
for (const ext of extensions) {
|
|
20463
|
+
const destWithExt = dest + ext;
|
|
20462
20464
|
try {
|
|
20463
|
-
if (statSync(
|
|
20465
|
+
if (statSync(destWithExt).isFile()) return destWithExt;
|
|
20464
20466
|
} catch {}
|
|
20465
20467
|
}
|
|
20466
20468
|
}
|
|
20467
20469
|
return null;
|
|
20468
20470
|
}
|
|
20469
|
-
var
|
|
20471
|
+
var NonZeroExitError = class extends Error {
|
|
20470
20472
|
result;
|
|
20471
20473
|
output;
|
|
20472
|
-
|
|
20473
|
-
|
|
20474
|
-
|
|
20475
|
-
|
|
20476
|
-
|
|
20477
|
-
|
|
20478
|
-
|
|
20474
|
+
exitCode;
|
|
20475
|
+
get signalCode() {
|
|
20476
|
+
return this.result.signalCode;
|
|
20477
|
+
}
|
|
20478
|
+
constructor(result, output, command, args) {
|
|
20479
|
+
let target = "The process";
|
|
20480
|
+
if (command) target = `The command \`${args?.length ? `${command} ${args.map((a) => /[ "'`()]/.test(a) ? JSON.stringify(a) : a).join(" ")}` : command}\``;
|
|
20481
|
+
const exitCode = result.exitCode ?? 1;
|
|
20482
|
+
super(result.signalCode !== null ? `${target} was killed by the signal ${result.signalCode}` : `${target} exited with a non-zero status (${exitCode})`);
|
|
20483
|
+
this.result = result;
|
|
20484
|
+
this.output = output;
|
|
20485
|
+
this.exitCode = exitCode;
|
|
20486
|
+
Object.defineProperty(this, "result", {
|
|
20487
|
+
enumerable: false,
|
|
20488
|
+
writable: false,
|
|
20489
|
+
configurable: false
|
|
20490
|
+
});
|
|
20479
20491
|
}
|
|
20480
20492
|
};
|
|
20481
|
-
const
|
|
20493
|
+
const defaultOptions = {
|
|
20482
20494
|
timeout: void 0,
|
|
20483
20495
|
persist: false
|
|
20484
20496
|
};
|
|
20485
|
-
const
|
|
20486
|
-
function
|
|
20487
|
-
const
|
|
20488
|
-
for (const
|
|
20489
|
-
if (
|
|
20490
|
-
|
|
20491
|
-
return
|
|
20497
|
+
const defaultNodeOptions = { windowsHide: true };
|
|
20498
|
+
function combineSignals(signals) {
|
|
20499
|
+
const controller = new AbortController();
|
|
20500
|
+
for (const signal of signals) {
|
|
20501
|
+
if (signal.aborted) {
|
|
20502
|
+
controller.abort();
|
|
20503
|
+
return signal;
|
|
20492
20504
|
}
|
|
20493
|
-
const
|
|
20494
|
-
|
|
20505
|
+
const onAbort = () => {
|
|
20506
|
+
controller.abort(signal.reason);
|
|
20495
20507
|
};
|
|
20496
|
-
|
|
20508
|
+
signal.addEventListener("abort", onAbort, { signal: controller.signal });
|
|
20497
20509
|
}
|
|
20498
|
-
return
|
|
20510
|
+
return controller.signal;
|
|
20499
20511
|
}
|
|
20500
|
-
async function
|
|
20501
|
-
let
|
|
20512
|
+
async function readStream(stream) {
|
|
20513
|
+
let output = "";
|
|
20502
20514
|
try {
|
|
20503
|
-
for await (const
|
|
20515
|
+
for await (const chunk of stream) output += chunk.toString();
|
|
20504
20516
|
} catch {}
|
|
20505
|
-
return
|
|
20517
|
+
return output;
|
|
20506
20518
|
}
|
|
20507
|
-
var
|
|
20519
|
+
var ExecProcess = class {
|
|
20508
20520
|
_process;
|
|
20509
20521
|
_aborted = false;
|
|
20510
20522
|
_options;
|
|
@@ -20522,19 +20534,22 @@ var I = class {
|
|
|
20522
20534
|
get exitCode() {
|
|
20523
20535
|
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
20524
20536
|
}
|
|
20525
|
-
|
|
20537
|
+
get signalCode() {
|
|
20538
|
+
return this._process?.signalCode ?? null;
|
|
20539
|
+
}
|
|
20540
|
+
constructor(command, args, options) {
|
|
20526
20541
|
this._options = {
|
|
20527
|
-
...
|
|
20528
|
-
...
|
|
20542
|
+
...defaultOptions,
|
|
20543
|
+
...options
|
|
20529
20544
|
};
|
|
20530
|
-
this._command =
|
|
20531
|
-
this._args =
|
|
20532
|
-
this._processClosed = new Promise((
|
|
20533
|
-
this._resolveClose =
|
|
20545
|
+
this._command = command;
|
|
20546
|
+
this._args = args ?? [];
|
|
20547
|
+
this._processClosed = new Promise((resolve) => {
|
|
20548
|
+
this._resolveClose = resolve;
|
|
20534
20549
|
});
|
|
20535
20550
|
}
|
|
20536
|
-
kill(
|
|
20537
|
-
return this._process?.kill(
|
|
20551
|
+
kill(signal) {
|
|
20552
|
+
return this._process?.kill(signal) === true;
|
|
20538
20553
|
}
|
|
20539
20554
|
get aborted() {
|
|
20540
20555
|
return this._aborted;
|
|
@@ -20542,99 +20557,99 @@ var I = class {
|
|
|
20542
20557
|
get killed() {
|
|
20543
20558
|
return this._process?.killed === true;
|
|
20544
20559
|
}
|
|
20545
|
-
pipe(
|
|
20546
|
-
return
|
|
20547
|
-
...
|
|
20560
|
+
pipe(command, args, options) {
|
|
20561
|
+
return exec(command, args, {
|
|
20562
|
+
...options,
|
|
20548
20563
|
stdin: this
|
|
20549
20564
|
});
|
|
20550
20565
|
}
|
|
20551
20566
|
async *[Symbol.asyncIterator]() {
|
|
20552
|
-
const
|
|
20553
|
-
if (!
|
|
20554
|
-
const
|
|
20555
|
-
if (this._streamErr)
|
|
20556
|
-
if (this._streamOut)
|
|
20557
|
-
const
|
|
20558
|
-
const
|
|
20559
|
-
for await (const
|
|
20567
|
+
const proc = this._process;
|
|
20568
|
+
if (!proc) return;
|
|
20569
|
+
const streams = [];
|
|
20570
|
+
if (this._streamErr) streams.push(this._streamErr);
|
|
20571
|
+
if (this._streamOut) streams.push(this._streamOut);
|
|
20572
|
+
const streamCombined = combineStreams(streams);
|
|
20573
|
+
const rl = l__default.createInterface({ input: streamCombined });
|
|
20574
|
+
for await (const chunk of rl) yield chunk.toString();
|
|
20560
20575
|
await this._processClosed;
|
|
20561
|
-
|
|
20576
|
+
proc.removeAllListeners();
|
|
20562
20577
|
if (this._thrownError) throw this._thrownError;
|
|
20563
|
-
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
20578
|
+
if (this._options?.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, void 0, this._command, this._args);
|
|
20564
20579
|
}
|
|
20565
20580
|
async _waitForOutput() {
|
|
20566
|
-
const
|
|
20567
|
-
if (!
|
|
20568
|
-
const [
|
|
20581
|
+
const proc = this._process;
|
|
20582
|
+
if (!proc) throw new Error("No process was started");
|
|
20583
|
+
const [stdout, stderr] = await Promise.all([this._streamOut ? readStream(this._streamOut) : "", this._streamErr ? readStream(this._streamErr) : ""]);
|
|
20569
20584
|
await this._processClosed;
|
|
20570
|
-
const { stdin
|
|
20571
|
-
if (
|
|
20572
|
-
|
|
20585
|
+
const { stdin } = this._options;
|
|
20586
|
+
if (stdin && typeof stdin !== "string") await stdin;
|
|
20587
|
+
proc.removeAllListeners();
|
|
20573
20588
|
if (this._thrownError) throw this._thrownError;
|
|
20574
|
-
const
|
|
20575
|
-
stderr
|
|
20576
|
-
stdout
|
|
20589
|
+
const result = {
|
|
20590
|
+
stderr,
|
|
20591
|
+
stdout,
|
|
20577
20592
|
exitCode: this.exitCode
|
|
20578
20593
|
};
|
|
20579
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
20580
|
-
return
|
|
20594
|
+
if (this._options.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, result, this._command, this._args);
|
|
20595
|
+
return result;
|
|
20581
20596
|
}
|
|
20582
|
-
then(
|
|
20583
|
-
return this._waitForOutput().then(
|
|
20597
|
+
then(onfulfilled, onrejected) {
|
|
20598
|
+
return this._waitForOutput().then(onfulfilled, onrejected);
|
|
20584
20599
|
}
|
|
20585
20600
|
_streamOut;
|
|
20586
20601
|
_streamErr;
|
|
20587
20602
|
spawn() {
|
|
20588
|
-
const
|
|
20589
|
-
const
|
|
20590
|
-
|
|
20591
|
-
...
|
|
20592
|
-
...r.nodeOptions
|
|
20603
|
+
const options = this._options;
|
|
20604
|
+
const nodeOptions = {
|
|
20605
|
+
...defaultNodeOptions,
|
|
20606
|
+
...options.nodeOptions
|
|
20593
20607
|
};
|
|
20594
|
-
const
|
|
20608
|
+
const cwd$1 = nodeOptions?.cwd ?? cwd();
|
|
20609
|
+
const signals = [];
|
|
20595
20610
|
this._resetState();
|
|
20596
|
-
if (
|
|
20597
|
-
if (
|
|
20598
|
-
if (
|
|
20599
|
-
if (
|
|
20600
|
-
|
|
20601
|
-
const
|
|
20602
|
-
const
|
|
20603
|
-
if (
|
|
20604
|
-
if (
|
|
20605
|
-
this._process =
|
|
20606
|
-
|
|
20607
|
-
|
|
20608
|
-
if (
|
|
20609
|
-
const { stdin
|
|
20610
|
-
if (typeof
|
|
20611
|
-
else
|
|
20611
|
+
if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
|
|
20612
|
+
if (options.signal !== void 0) signals.push(options.signal);
|
|
20613
|
+
if (options.persist === true) nodeOptions.detached = true;
|
|
20614
|
+
if (signals.length > 0) nodeOptions.signal = combineSignals(signals);
|
|
20615
|
+
nodeOptions.env = computeEnv(cwd$1, nodeOptions.env, options.nodePath);
|
|
20616
|
+
const crossResult = normalizeSpawnCommand(this._command, this._args, nodeOptions);
|
|
20617
|
+
const handle = spawn(crossResult.command, crossResult.args, crossResult.options);
|
|
20618
|
+
if (handle.stderr) this._streamErr = handle.stderr;
|
|
20619
|
+
if (handle.stdout) this._streamOut = handle.stdout;
|
|
20620
|
+
this._process = handle;
|
|
20621
|
+
handle.once("error", this._onError);
|
|
20622
|
+
handle.once("close", this._onClose);
|
|
20623
|
+
if (handle.stdin) {
|
|
20624
|
+
const { stdin } = options;
|
|
20625
|
+
if (typeof stdin === "string") handle.stdin.end(stdin);
|
|
20626
|
+
else stdin?.process?.stdout?.pipe(handle.stdin);
|
|
20612
20627
|
}
|
|
20613
20628
|
}
|
|
20614
20629
|
_resetState() {
|
|
20615
20630
|
this._aborted = false;
|
|
20616
|
-
this._processClosed = new Promise((
|
|
20617
|
-
this._resolveClose =
|
|
20631
|
+
this._processClosed = new Promise((resolve) => {
|
|
20632
|
+
this._resolveClose = resolve;
|
|
20618
20633
|
});
|
|
20619
20634
|
this._thrownError = void 0;
|
|
20620
20635
|
}
|
|
20621
|
-
_onError = (
|
|
20622
|
-
if (
|
|
20636
|
+
_onError = (err) => {
|
|
20637
|
+
if (err.name === "AbortError" && (!(err.cause instanceof Error) || err.cause.name !== "TimeoutError")) {
|
|
20623
20638
|
this._aborted = true;
|
|
20624
20639
|
return;
|
|
20625
20640
|
}
|
|
20626
|
-
this._thrownError =
|
|
20641
|
+
this._thrownError = err;
|
|
20627
20642
|
};
|
|
20628
20643
|
_onClose = () => {
|
|
20629
20644
|
if (this._resolveClose) this._resolveClose();
|
|
20630
20645
|
};
|
|
20631
20646
|
};
|
|
20632
|
-
const
|
|
20633
|
-
const
|
|
20634
|
-
|
|
20635
|
-
return
|
|
20647
|
+
const x = (command, args, userOptions) => {
|
|
20648
|
+
const proc = new ExecProcess(command, args, userOptions);
|
|
20649
|
+
proc.spawn();
|
|
20650
|
+
return proc;
|
|
20636
20651
|
};
|
|
20637
|
-
const
|
|
20652
|
+
const exec = x;
|
|
20638
20653
|
//#endregion
|
|
20639
20654
|
//#region src/utils.ts
|
|
20640
20655
|
const NUMERIC_IDENTIFIER_PATTERN = /^\d+$/;
|
|
@@ -20665,7 +20680,7 @@ function selectMatchingDistTag(version, output) {
|
|
|
20665
20680
|
}
|
|
20666
20681
|
async function getCreateVersionTag(version) {
|
|
20667
20682
|
try {
|
|
20668
|
-
const { stdout } = await
|
|
20683
|
+
const { stdout } = await x("npm", [
|
|
20669
20684
|
"dist-tag",
|
|
20670
20685
|
"ls",
|
|
20671
20686
|
"create-mastra"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mastra",
|
|
3
|
-
"version": "1.35.0",
|
|
3
|
+
"version": "1.35.1-alpha.0",
|
|
4
4
|
"description": "Create Mastra apps with one command",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"project"
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "22.20.
|
|
32
|
+
"@types/node": "22.20.5",
|
|
33
33
|
"commander": "^14.0.3",
|
|
34
34
|
"posthog-node": "^5.46.1",
|
|
35
35
|
"tinyexec": "^1.1.1",
|
|
36
|
-
"tsdown": "0.
|
|
36
|
+
"tsdown": "0.23.1",
|
|
37
37
|
"typescript": "^7.0.2",
|
|
38
38
|
"vitest": "4.1.11",
|
|
39
39
|
"@internal/lint": "0.0.145",
|
|
40
|
-
"mastra": "^1.35.0"
|
|
40
|
+
"mastra": "^1.35.1-alpha.0"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=22.13.0"
|