@mastra/deployer 0.2.9-alpha.5 → 0.2.9-alpha.7

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.
@@ -52,6 +52,12 @@ export declare interface ApiError extends Error {
52
52
  status?: number;
53
53
  }
54
54
 
55
+ declare interface ArchitectureOptions {
56
+ os?: string[];
57
+ cpu?: string[];
58
+ libc?: string[];
59
+ }
60
+
55
61
  declare type Bindings = {};
56
62
 
57
63
  export declare abstract class Bundler extends MastraBundler {
@@ -151,8 +157,12 @@ declare class Deps extends MastraBase {
151
157
  constructor(rootDir?: string);
152
158
  private findLockFile;
153
159
  private getPackageManager;
154
- install({ dir }: {
160
+ private writePnpmConfig;
161
+ private writeYarnConfig;
162
+ private getNpmArgs;
163
+ install({ dir, architecture, }?: {
155
164
  dir?: string;
165
+ architecture?: ArchitectureOptions;
156
166
  }): Promise<unknown>;
157
167
  installPackages(packages: string[]): Promise<unknown>;
158
168
  checkDependencies(dependencies: string[]): Promise<string>;
@@ -52,6 +52,12 @@ export declare interface ApiError extends Error {
52
52
  status?: number;
53
53
  }
54
54
 
55
+ declare interface ArchitectureOptions {
56
+ os?: string[];
57
+ cpu?: string[];
58
+ libc?: string[];
59
+ }
60
+
55
61
  declare type Bindings = {};
56
62
 
57
63
  export declare abstract class Bundler extends MastraBundler {
@@ -151,8 +157,12 @@ declare class Deps extends MastraBase {
151
157
  constructor(rootDir?: string);
152
158
  private findLockFile;
153
159
  private getPackageManager;
154
- install({ dir }: {
160
+ private writePnpmConfig;
161
+ private writeYarnConfig;
162
+ private getNpmArgs;
163
+ install({ dir, architecture, }?: {
155
164
  dir?: string;
165
+ architecture?: ArchitectureOptions;
156
166
  }): Promise<unknown>;
157
167
  installPackages(packages: string[]): Promise<unknown>;
158
168
  checkDependencies(dependencies: string[]): Promise<string>;
@@ -5,7 +5,7 @@ var chunk2ZPQX6BX_cjs = require('../chunk-2ZPQX6BX.cjs');
5
5
  var chunkP5SATU7G_cjs = require('../chunk-P5SATU7G.cjs');
6
6
  var chunkAE4CVAPK_cjs = require('../chunk-AE4CVAPK.cjs');
7
7
  var chunkNCROGJGB_cjs = require('../chunk-NCROGJGB.cjs');
8
- var chunkMYE33AKL_cjs = require('../chunk-MYE33AKL.cjs');
8
+ var chunkTHU6NH7X_cjs = require('../chunk-THU6NH7X.cjs');
9
9
 
10
10
 
11
11
 
@@ -43,5 +43,5 @@ Object.defineProperty(exports, "FileService", {
43
43
  });
44
44
  Object.defineProperty(exports, "Deps", {
45
45
  enumerable: true,
46
- get: function () { return chunkMYE33AKL_cjs.Deps; }
46
+ get: function () { return chunkTHU6NH7X_cjs.Deps; }
47
47
  });
@@ -3,4 +3,4 @@ export { writeTelemetryConfig } from '../chunk-4AYFLP6G.js';
3
3
  export { analyzeBundle } from '../chunk-BDTZS3JM.js';
4
4
  export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-IKPL4RGG.js';
5
5
  export { FileService } from '../chunk-DYQ225MJ.js';
6
- export { Deps } from '../chunk-YQB677IB.js';
6
+ export { Deps } from '../chunk-P7ZN2KUE.js';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkJDY6E7BT_cjs = require('../chunk-JDY6E7BT.cjs');
3
+ var chunkEUFD4MGO_cjs = require('../chunk-EUFD4MGO.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Bundler", {
8
8
  enumerable: true,
9
- get: function () { return chunkJDY6E7BT_cjs.Bundler; }
9
+ get: function () { return chunkEUFD4MGO_cjs.Bundler; }
10
10
  });
@@ -1 +1 @@
1
- export { Bundler } from '../chunk-SQQUYWPS.js';
1
+ export { Bundler } from '../chunk-KHNXH7BY.js';
@@ -3,7 +3,7 @@
3
3
  var chunk2ZPQX6BX_cjs = require('./chunk-2ZPQX6BX.cjs');
4
4
  var chunkP5SATU7G_cjs = require('./chunk-P5SATU7G.cjs');
5
5
  var chunkAE4CVAPK_cjs = require('./chunk-AE4CVAPK.cjs');
6
- var chunkMYE33AKL_cjs = require('./chunk-MYE33AKL.cjs');
6
+ var chunkTHU6NH7X_cjs = require('./chunk-THU6NH7X.cjs');
7
7
  var fs = require('fs');
8
8
  var promises = require('fs/promises');
9
9
  var path = require('path');
@@ -32,7 +32,7 @@ var Bundler = class extends bundler.MastraBundler {
32
32
  }
33
33
  async writeInstrumentationFile(outputDirectory) {
34
34
  const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
35
- const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-JDY6E7BT.cjs', document.baseURI).href))));
35
+ const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-EUFD4MGO.cjs', document.baseURI).href))));
36
36
  await esm.copy(path.join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
37
37
  }
38
38
  async writePackageJson(outputDirectory, dependencies) {
@@ -77,7 +77,7 @@ var Bundler = class extends bundler.MastraBundler {
77
77
  return await chunkP5SATU7G_cjs.analyzeBundle(entry, mastraFile, path.join(outputDirectory, this.analyzeOutputDir), "node", this.logger);
78
78
  }
79
79
  async installDependencies(outputDirectory, rootDir = process.cwd()) {
80
- const deps = new chunkMYE33AKL_cjs.DepsService(rootDir);
80
+ const deps = new chunkTHU6NH7X_cjs.DepsService(rootDir);
81
81
  deps.__setLogger(this.logger);
82
82
  await deps.install({ dir: path.join(outputDirectory, this.outputDir) });
83
83
  }
@@ -1,7 +1,7 @@
1
1
  import { writeTelemetryConfig } from './chunk-4AYFLP6G.js';
2
2
  import { analyzeBundle } from './chunk-BDTZS3JM.js';
3
3
  import { createBundler, getInputOptions } from './chunk-IKPL4RGG.js';
4
- import { DepsService } from './chunk-YQB677IB.js';
4
+ import { DepsService } from './chunk-P7ZN2KUE.js';
5
5
  import { existsSync } from 'node:fs';
6
6
  import { writeFile, stat } from 'node:fs/promises';
7
7
  import { join, dirname } from 'node:path';
@@ -5,7 +5,7 @@ import fsPromises from 'fs/promises';
5
5
  import path, { dirname } from 'path';
6
6
  import { fileURLToPath } from 'url';
7
7
  import { MastraBase } from '@mastra/core/base';
8
- import { ensureFile, readJSON, writeJSON } from 'fs-extra/esm';
8
+ import { readJSON, writeJSON, ensureFile } from 'fs-extra/esm';
9
9
 
10
10
  // src/deploy/log.ts
11
11
  var createPinoStream = (logger) => {
@@ -90,14 +90,67 @@ var Deps = class extends MastraBase {
90
90
  return "npm";
91
91
  }
92
92
  }
93
- async install({ dir = this.rootDir }) {
93
+ async writePnpmConfig(dir, options) {
94
+ const packageJsonPath = path.join(dir, "package.json");
95
+ const packageJson = await readJSON(packageJsonPath);
96
+ packageJson.pnpm = {
97
+ ...packageJson.pnpm,
98
+ supportedArchitectures: {
99
+ os: options.os || [],
100
+ cpu: options.cpu || [],
101
+ libc: options.libc || []
102
+ }
103
+ };
104
+ await writeJSON(packageJsonPath, packageJson, { spaces: 2 });
105
+ }
106
+ async writeYarnConfig(dir, options) {
107
+ const yarnrcPath = path.join(dir, ".yarnrc.yml");
108
+ const config = {
109
+ supportedArchitectures: {
110
+ cpu: options.cpu || [],
111
+ os: options.os || [],
112
+ libc: options.libc || []
113
+ }
114
+ };
115
+ await fsPromises.writeFile(
116
+ yarnrcPath,
117
+ `supportedArchitectures:
118
+ ${Object.entries(config.supportedArchitectures).map(([key, value]) => ` ${key}: ${JSON.stringify(value)}`).join("\n")}`
119
+ );
120
+ }
121
+ getNpmArgs(options) {
122
+ const args = [];
123
+ if (options.cpu) args.push(`--cpu=${options.cpu.join(",")}`);
124
+ if (options.os) args.push(`--os=${options.os.join(",")}`);
125
+ if (options.libc) args.push(`--libc=${options.libc.join(",")}`);
126
+ return args;
127
+ }
128
+ async install({
129
+ dir = this.rootDir,
130
+ architecture
131
+ } = {}) {
94
132
  let runCommand = this.packageManager;
133
+ let args = [];
95
134
  switch (this.packageManager) {
96
135
  case "pnpm":
97
136
  runCommand = `${this.packageManager} --ignore-workspace install`;
137
+ if (architecture) {
138
+ await this.writePnpmConfig(dir, architecture);
139
+ }
98
140
  break;
99
141
  case "yarn":
100
142
  await ensureFile(path.join(dir, "yarn.lock"));
143
+ if (architecture) {
144
+ await this.writeYarnConfig(dir, architecture);
145
+ }
146
+ runCommand = `${this.packageManager} install`;
147
+ break;
148
+ case "npm":
149
+ runCommand = `${this.packageManager} install`;
150
+ if (architecture) {
151
+ args = this.getNpmArgs(architecture);
152
+ }
153
+ break;
101
154
  default:
102
155
  runCommand = `${this.packageManager} install`;
103
156
  }
@@ -107,7 +160,7 @@ var Deps = class extends MastraBase {
107
160
  });
108
161
  return cpLogger({
109
162
  cmd: runCommand,
110
- args: [],
163
+ args,
111
164
  env: {
112
165
  PATH: process.env.PATH
113
166
  }
@@ -99,14 +99,67 @@ var Deps = class extends base.MastraBase {
99
99
  return "npm";
100
100
  }
101
101
  }
102
- async install({ dir = this.rootDir }) {
102
+ async writePnpmConfig(dir, options) {
103
+ const packageJsonPath = path__default.default.join(dir, "package.json");
104
+ const packageJson = await esm.readJSON(packageJsonPath);
105
+ packageJson.pnpm = {
106
+ ...packageJson.pnpm,
107
+ supportedArchitectures: {
108
+ os: options.os || [],
109
+ cpu: options.cpu || [],
110
+ libc: options.libc || []
111
+ }
112
+ };
113
+ await esm.writeJSON(packageJsonPath, packageJson, { spaces: 2 });
114
+ }
115
+ async writeYarnConfig(dir, options) {
116
+ const yarnrcPath = path__default.default.join(dir, ".yarnrc.yml");
117
+ const config = {
118
+ supportedArchitectures: {
119
+ cpu: options.cpu || [],
120
+ os: options.os || [],
121
+ libc: options.libc || []
122
+ }
123
+ };
124
+ await fsPromises__default.default.writeFile(
125
+ yarnrcPath,
126
+ `supportedArchitectures:
127
+ ${Object.entries(config.supportedArchitectures).map(([key, value]) => ` ${key}: ${JSON.stringify(value)}`).join("\n")}`
128
+ );
129
+ }
130
+ getNpmArgs(options) {
131
+ const args = [];
132
+ if (options.cpu) args.push(`--cpu=${options.cpu.join(",")}`);
133
+ if (options.os) args.push(`--os=${options.os.join(",")}`);
134
+ if (options.libc) args.push(`--libc=${options.libc.join(",")}`);
135
+ return args;
136
+ }
137
+ async install({
138
+ dir = this.rootDir,
139
+ architecture
140
+ } = {}) {
103
141
  let runCommand = this.packageManager;
142
+ let args = [];
104
143
  switch (this.packageManager) {
105
144
  case "pnpm":
106
145
  runCommand = `${this.packageManager} --ignore-workspace install`;
146
+ if (architecture) {
147
+ await this.writePnpmConfig(dir, architecture);
148
+ }
107
149
  break;
108
150
  case "yarn":
109
151
  await esm.ensureFile(path__default.default.join(dir, "yarn.lock"));
152
+ if (architecture) {
153
+ await this.writeYarnConfig(dir, architecture);
154
+ }
155
+ runCommand = `${this.packageManager} install`;
156
+ break;
157
+ case "npm":
158
+ runCommand = `${this.packageManager} install`;
159
+ if (architecture) {
160
+ args = this.getNpmArgs(architecture);
161
+ }
162
+ break;
110
163
  default:
111
164
  runCommand = `${this.packageManager} install`;
112
165
  }
@@ -116,7 +169,7 @@ var Deps = class extends base.MastraBase {
116
169
  });
117
170
  return cpLogger({
118
171
  cmd: runCommand,
119
- args: [],
172
+ args,
120
173
  env: {
121
174
  PATH: process.env.PATH
122
175
  }
@@ -171,7 +224,7 @@ var Deps = class extends base.MastraBase {
171
224
  }
172
225
  }
173
226
  async getPackageVersion() {
174
- const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-MYE33AKL.cjs', document.baseURI).href)));
227
+ const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-THU6NH7X.cjs', document.baseURI).href)));
175
228
  const __dirname = path.dirname(__filename);
176
229
  const pkgJsonPath = path__default.default.join(__dirname, "..", "..", "package.json");
177
230
  const content = await esm.readJSON(pkgJsonPath);
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkJDY6E7BT_cjs = require('./chunk-JDY6E7BT.cjs');
3
+ var chunkEUFD4MGO_cjs = require('./chunk-EUFD4MGO.cjs');
4
4
  var chunk2ZPQX6BX_cjs = require('./chunk-2ZPQX6BX.cjs');
5
5
  var chunkNCROGJGB_cjs = require('./chunk-NCROGJGB.cjs');
6
- var chunkMYE33AKL_cjs = require('./chunk-MYE33AKL.cjs');
6
+ var chunkTHU6NH7X_cjs = require('./chunk-THU6NH7X.cjs');
7
7
  var babel = require('@babel/core');
8
8
  var rollup = require('rollup');
9
9
  var esbuild = require('rollup-plugin-esbuild');
@@ -34,8 +34,8 @@ var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
34
34
  var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
35
35
 
36
36
  // src/deploy/base.ts
37
- var Deployer = class extends chunkJDY6E7BT_cjs.Bundler {
38
- deps = new chunkMYE33AKL_cjs.DepsService();
37
+ var Deployer = class extends chunkEUFD4MGO_cjs.Bundler {
38
+ deps = new chunkTHU6NH7X_cjs.DepsService();
39
39
  constructor(args) {
40
40
  super(args.name, "DEPLOYER");
41
41
  this.deps.__setLogger(this.logger);
@@ -177,15 +177,15 @@ Object.defineProperty(exports, "FileService", {
177
177
  });
178
178
  Object.defineProperty(exports, "Deps", {
179
179
  enumerable: true,
180
- get: function () { return chunkMYE33AKL_cjs.Deps; }
180
+ get: function () { return chunkTHU6NH7X_cjs.Deps; }
181
181
  });
182
182
  Object.defineProperty(exports, "createChildProcessLogger", {
183
183
  enumerable: true,
184
- get: function () { return chunkMYE33AKL_cjs.createChildProcessLogger; }
184
+ get: function () { return chunkTHU6NH7X_cjs.createChildProcessLogger; }
185
185
  });
186
186
  Object.defineProperty(exports, "createPinoStream", {
187
187
  enumerable: true,
188
- get: function () { return chunkMYE33AKL_cjs.createPinoStream; }
188
+ get: function () { return chunkTHU6NH7X_cjs.createPinoStream; }
189
189
  });
190
190
  exports.Deployer = Deployer;
191
191
  exports.getDeployer = getDeployer;
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { Bundler } from './chunk-SQQUYWPS.js';
1
+ import { Bundler } from './chunk-KHNXH7BY.js';
2
2
  import { recursiveRemoveNonReferencedNodes } from './chunk-4AYFLP6G.js';
3
3
  import { FileService } from './chunk-DYQ225MJ.js';
4
4
  export { FileService } from './chunk-DYQ225MJ.js';
5
- import { DepsService } from './chunk-YQB677IB.js';
6
- export { Deps, createChildProcessLogger, createPinoStream } from './chunk-YQB677IB.js';
5
+ import { DepsService } from './chunk-P7ZN2KUE.js';
6
+ export { Deps, createChildProcessLogger, createPinoStream } from './chunk-P7ZN2KUE.js';
7
7
  import * as babel from '@babel/core';
8
8
  import babel__default from '@babel/core';
9
9
  import { rollup } from 'rollup';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkNCROGJGB_cjs = require('../chunk-NCROGJGB.cjs');
4
- var chunkMYE33AKL_cjs = require('../chunk-MYE33AKL.cjs');
4
+ var chunkTHU6NH7X_cjs = require('../chunk-THU6NH7X.cjs');
5
5
 
6
6
 
7
7
 
@@ -15,5 +15,5 @@ Object.defineProperty(exports, "FileService", {
15
15
  });
16
16
  Object.defineProperty(exports, "DepsService", {
17
17
  enumerable: true,
18
- get: function () { return chunkMYE33AKL_cjs.DepsService; }
18
+ get: function () { return chunkTHU6NH7X_cjs.DepsService; }
19
19
  });
@@ -1,2 +1,2 @@
1
1
  export { EnvService, FileService } from '../chunk-DYQ225MJ.js';
2
- export { DepsService } from '../chunk-YQB677IB.js';
2
+ export { DepsService } from '../chunk-P7ZN2KUE.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "0.2.9-alpha.5",
3
+ "version": "0.2.9-alpha.7",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -105,8 +105,8 @@
105
105
  "rollup-plugin-node-externals": "^8.0.0",
106
106
  "typescript-paths": "^1.5.1",
107
107
  "zod": "^3.24.2",
108
- "@mastra/server": "^1.0.3-alpha.5",
109
- "@mastra/core": "^0.8.3-alpha.4"
108
+ "@mastra/core": "^0.8.3-alpha.5",
109
+ "@mastra/server": "^1.0.3-alpha.6"
110
110
  },
111
111
  "devDependencies": {
112
112
  "@hono/node-server": "^1.13.8",