@mastra/deployer 0.2.4-alpha.0 → 0.2.4
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/build/analyze.cjs +2 -2
- package/dist/build/analyze.js +1 -1
- package/dist/build/index.cjs +8 -8
- package/dist/build/index.js +2 -2
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-AXUXJ2OU.cjs → chunk-7GYBZLVN.cjs} +3 -3
- package/dist/{chunk-7J2ZTGHM.js → chunk-CS5NGTWK.js} +1 -1
- package/dist/{chunk-QVHMDKNM.cjs → chunk-NWERLYTR.cjs} +9 -4
- package/dist/{chunk-YE3YSKC6.js → chunk-PUX2FDGX.js} +1 -1
- package/dist/{chunk-ARY7G5XC.js → chunk-UTZ3434D.js} +9 -4
- package/dist/{chunk-HBJIG6EL.cjs → chunk-WUF7W23E.cjs} +4 -4
- package/dist/index.cjs +12 -11
- package/dist/index.js +10 -9
- package/package.json +2 -2
package/dist/build/analyze.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNWERLYTR_cjs = require('../chunk-NWERLYTR.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "analyzeBundle", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkNWERLYTR_cjs.analyzeBundle; }
|
|
10
10
|
});
|
package/dist/build/analyze.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { analyzeBundle } from '../chunk-
|
|
1
|
+
export { analyzeBundle } from '../chunk-UTZ3434D.js';
|
package/dist/build/index.cjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7GYBZLVN_cjs = require('../chunk-7GYBZLVN.cjs');
|
|
4
4
|
var chunkKFOGAPGX_cjs = require('../chunk-KFOGAPGX.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkNWERLYTR_cjs = require('../chunk-NWERLYTR.cjs');
|
|
6
6
|
var chunkOT6UKL2S_cjs = require('../chunk-OT6UKL2S.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "FileService", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk7GYBZLVN_cjs.FileService; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "createWatcher", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunk7GYBZLVN_cjs.createWatcher; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "getBundler", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunk7GYBZLVN_cjs.getBundler; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "getWatcher", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunk7GYBZLVN_cjs.getWatcher; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "getWatcherInputOptions", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunk7GYBZLVN_cjs.getInputOptions; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "Deps", {
|
|
31
31
|
enumerable: true,
|
|
@@ -37,7 +37,7 @@ Object.defineProperty(exports, "writeTelemetryConfig", {
|
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "analyzeBundle", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkNWERLYTR_cjs.analyzeBundle; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "createBundler", {
|
|
43
43
|
enumerable: true,
|
package/dist/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { FileService, createWatcher, getBundler, getWatcher, getInputOptions as getWatcherInputOptions } from '../chunk-
|
|
1
|
+
export { FileService, createWatcher, getBundler, getWatcher, getInputOptions as getWatcherInputOptions } from '../chunk-PUX2FDGX.js';
|
|
2
2
|
export { Deps, writeTelemetryConfig } from '../chunk-ZAXXMFXX.js';
|
|
3
|
-
export { analyzeBundle } from '../chunk-
|
|
3
|
+
export { analyzeBundle } from '../chunk-UTZ3434D.js';
|
|
4
4
|
export { createBundler, getInputOptions as getBundlerInputOptions } from '../chunk-XEFBJH3T.js';
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkWUF7W23E_cjs = require('../chunk-WUF7W23E.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Bundler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkWUF7W23E_cjs.Bundler; }
|
|
10
10
|
});
|
package/dist/bundler/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Bundler } from '../chunk-
|
|
1
|
+
export { Bundler } from '../chunk-CS5NGTWK.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNWERLYTR_cjs = require('./chunk-NWERLYTR.cjs');
|
|
4
4
|
var chunkOT6UKL2S_cjs = require('./chunk-OT6UKL2S.cjs');
|
|
5
5
|
var chunk54KOF3NB_cjs = require('./chunk-54KOF3NB.cjs');
|
|
6
6
|
var alias = require('@rollup/plugin-alias');
|
|
@@ -116,7 +116,7 @@ var FileService = class {
|
|
|
116
116
|
* @returns
|
|
117
117
|
*/
|
|
118
118
|
async copyStarterFile(inputFile, outputFilePath, replaceIfExists) {
|
|
119
|
-
const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
119
|
+
const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-7GYBZLVN.cjs', document.baseURI).href)));
|
|
120
120
|
const __dirname = path__default.default.dirname(__filename);
|
|
121
121
|
const filePath = path__default.default.resolve(__dirname, "..", "starter-files", inputFile);
|
|
122
122
|
const fileString = fs2__namespace.default.readFileSync(filePath, "utf8");
|
|
@@ -262,7 +262,7 @@ async function getInputOptions2(entryFile, platform) {
|
|
|
262
262
|
// @ts-ignore
|
|
263
263
|
(plugin) => !plugin || !plugin?.name || plugin.name !== "node-resolve"
|
|
264
264
|
);
|
|
265
|
-
inputOptions.plugins.push(
|
|
265
|
+
inputOptions.plugins.push(chunkNWERLYTR_cjs.aliasHono());
|
|
266
266
|
}
|
|
267
267
|
return inputOptions;
|
|
268
268
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Deps, writeTelemetryConfig } from './chunk-ZAXXMFXX.js';
|
|
2
|
-
import { analyzeBundle } from './chunk-
|
|
2
|
+
import { analyzeBundle } from './chunk-UTZ3434D.js';
|
|
3
3
|
import { createBundler, getInputOptions } from './chunk-XEFBJH3T.js';
|
|
4
4
|
import { existsSync } from 'node:fs';
|
|
5
5
|
import { writeFile, stat } from 'node:fs/promises';
|
|
@@ -90,7 +90,10 @@ function findExternalImporter(module, external, allOutputs) {
|
|
|
90
90
|
for (const file of capturedFiles) {
|
|
91
91
|
const nextModule = allOutputs.find((o) => o.fileName === file);
|
|
92
92
|
if (nextModule) {
|
|
93
|
-
|
|
93
|
+
const importer = findExternalImporter(nextModule, external, allOutputs);
|
|
94
|
+
if (importer) {
|
|
95
|
+
return importer;
|
|
96
|
+
}
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
return null;
|
|
@@ -173,7 +176,7 @@ async function bundleExternals(depsToOptimize, outputDir, logger) {
|
|
|
173
176
|
if (local === "*") {
|
|
174
177
|
virtualFile.push(`export * from '${dep}';`);
|
|
175
178
|
} else if (local === "default") {
|
|
176
|
-
virtualFile.push(`export
|
|
179
|
+
virtualFile.push(`export { default } from '${dep}';`);
|
|
177
180
|
} else {
|
|
178
181
|
exportStringBuilder.push(local);
|
|
179
182
|
}
|
|
@@ -239,8 +242,10 @@ async function bundleExternals(depsToOptimize, outputDir, logger) {
|
|
|
239
242
|
if (importer) {
|
|
240
243
|
const fullPath = path.join(outputDir, importer.fileName);
|
|
241
244
|
moduleResolveMap[fullPath] = moduleResolveMap[fullPath] || {};
|
|
242
|
-
if (importer.moduleIds.length
|
|
243
|
-
moduleResolveMap[fullPath][external] = importer.moduleIds.
|
|
245
|
+
if (importer.moduleIds.length) {
|
|
246
|
+
moduleResolveMap[fullPath][external] = importer.moduleIds[importer.moduleIds.length - 1]?.startsWith(
|
|
247
|
+
"\0virtual:#virtual"
|
|
248
|
+
) ? importer.moduleIds[importer.moduleIds.length - 2] : importer.moduleIds[importer.moduleIds.length - 1];
|
|
244
249
|
}
|
|
245
250
|
}
|
|
246
251
|
}
|
|
@@ -80,7 +80,10 @@ function findExternalImporter(module, external, allOutputs) {
|
|
|
80
80
|
for (const file of capturedFiles) {
|
|
81
81
|
const nextModule = allOutputs.find((o) => o.fileName === file);
|
|
82
82
|
if (nextModule) {
|
|
83
|
-
|
|
83
|
+
const importer = findExternalImporter(nextModule, external, allOutputs);
|
|
84
|
+
if (importer) {
|
|
85
|
+
return importer;
|
|
86
|
+
}
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
return null;
|
|
@@ -163,7 +166,7 @@ async function bundleExternals(depsToOptimize, outputDir, logger) {
|
|
|
163
166
|
if (local === "*") {
|
|
164
167
|
virtualFile.push(`export * from '${dep}';`);
|
|
165
168
|
} else if (local === "default") {
|
|
166
|
-
virtualFile.push(`export
|
|
169
|
+
virtualFile.push(`export { default } from '${dep}';`);
|
|
167
170
|
} else {
|
|
168
171
|
exportStringBuilder.push(local);
|
|
169
172
|
}
|
|
@@ -229,8 +232,10 @@ async function bundleExternals(depsToOptimize, outputDir, logger) {
|
|
|
229
232
|
if (importer) {
|
|
230
233
|
const fullPath = join(outputDir, importer.fileName);
|
|
231
234
|
moduleResolveMap[fullPath] = moduleResolveMap[fullPath] || {};
|
|
232
|
-
if (importer.moduleIds.length
|
|
233
|
-
moduleResolveMap[fullPath][external] = importer.moduleIds.
|
|
235
|
+
if (importer.moduleIds.length) {
|
|
236
|
+
moduleResolveMap[fullPath][external] = importer.moduleIds[importer.moduleIds.length - 1]?.startsWith(
|
|
237
|
+
"\0virtual:#virtual"
|
|
238
|
+
) ? importer.moduleIds[importer.moduleIds.length - 2] : importer.moduleIds[importer.moduleIds.length - 1];
|
|
234
239
|
}
|
|
235
240
|
}
|
|
236
241
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkKFOGAPGX_cjs = require('./chunk-KFOGAPGX.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkNWERLYTR_cjs = require('./chunk-NWERLYTR.cjs');
|
|
5
5
|
var chunkOT6UKL2S_cjs = require('./chunk-OT6UKL2S.cjs');
|
|
6
6
|
var fs = require('fs');
|
|
7
7
|
var promises = require('fs/promises');
|
|
@@ -31,7 +31,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
31
31
|
}
|
|
32
32
|
async writeInstrumentationFile(outputDirectory) {
|
|
33
33
|
const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
|
|
34
|
-
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-
|
|
34
|
+
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-WUF7W23E.cjs', document.baseURI).href))));
|
|
35
35
|
await esm.copy(path.join(__dirname, "templates", "instrumentation-template.js"), instrumentationFile);
|
|
36
36
|
}
|
|
37
37
|
async writePackageJson(outputDirectory, dependencies) {
|
|
@@ -73,7 +73,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
73
73
|
return chunkOT6UKL2S_cjs.createBundler(inputOptions, outputOptions);
|
|
74
74
|
}
|
|
75
75
|
async analyze(entry, mastraFile, outputDirectory) {
|
|
76
|
-
return await
|
|
76
|
+
return await chunkNWERLYTR_cjs.analyzeBundle(entry, mastraFile, path.join(outputDirectory, this.analyzeOutputDir), "node", this.logger);
|
|
77
77
|
}
|
|
78
78
|
async installDependencies(outputDirectory, rootDir = process.cwd()) {
|
|
79
79
|
const deps = new chunkKFOGAPGX_cjs.Deps(rootDir);
|
|
@@ -92,7 +92,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
92
92
|
async _bundle(serverFile, mastraEntryFile, outputDirectory, bundleLocation = path.join(outputDirectory, this.outputDir)) {
|
|
93
93
|
this.logger.info("Start bundling Mastra");
|
|
94
94
|
const isVirtual = serverFile.includes("\n") || fs.existsSync(serverFile);
|
|
95
|
-
const analyzedBundleInfo = await
|
|
95
|
+
const analyzedBundleInfo = await chunkNWERLYTR_cjs.analyzeBundle(
|
|
96
96
|
serverFile,
|
|
97
97
|
mastraEntryFile,
|
|
98
98
|
path.join(outputDirectory, this.analyzeOutputDir),
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk7GYBZLVN_cjs = require('./chunk-7GYBZLVN.cjs');
|
|
4
|
+
var chunkWUF7W23E_cjs = require('./chunk-WUF7W23E.cjs');
|
|
5
5
|
var chunkKFOGAPGX_cjs = require('./chunk-KFOGAPGX.cjs');
|
|
6
6
|
var babel = require('@babel/core');
|
|
7
7
|
var rollup = require('rollup');
|
|
@@ -33,7 +33,7 @@ var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
|
|
|
33
33
|
var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
|
|
34
34
|
|
|
35
35
|
// src/deploy/base.ts
|
|
36
|
-
var Deployer = class extends
|
|
36
|
+
var Deployer = class extends chunkWUF7W23E_cjs.Bundler {
|
|
37
37
|
deps = new chunkKFOGAPGX_cjs.Deps();
|
|
38
38
|
constructor(args) {
|
|
39
39
|
super(args.name, "DEPLOYER");
|
|
@@ -42,7 +42,7 @@ var Deployer = class extends chunkHBJIG6EL_cjs.Bundler {
|
|
|
42
42
|
getEnvFiles() {
|
|
43
43
|
const possibleFiles = [".env.production", ".env.local", ".env"];
|
|
44
44
|
try {
|
|
45
|
-
const fileService = new
|
|
45
|
+
const fileService = new chunk7GYBZLVN_cjs.FileService();
|
|
46
46
|
const envFile = fileService.getFirstExistingFile(possibleFiles);
|
|
47
47
|
return Promise.resolve([envFile]);
|
|
48
48
|
} catch {
|
|
@@ -95,18 +95,18 @@ function getDeployerBundler(entryFile) {
|
|
|
95
95
|
},
|
|
96
96
|
treeshake: "smallest",
|
|
97
97
|
plugins: [
|
|
98
|
-
commonjs__default.default({
|
|
99
|
-
extensions: [".js", ".ts"],
|
|
100
|
-
strictRequires: "strict",
|
|
101
|
-
transformMixedEsModules: true,
|
|
102
|
-
ignoreTryCatch: false
|
|
103
|
-
}),
|
|
104
98
|
// transpile typescript to something we understand
|
|
105
99
|
esbuild__default.default({
|
|
106
100
|
target: "node20",
|
|
107
101
|
platform: "node",
|
|
108
102
|
minify: false
|
|
109
103
|
}),
|
|
104
|
+
commonjs__default.default({
|
|
105
|
+
extensions: [".js", ".ts"],
|
|
106
|
+
strictRequires: "strict",
|
|
107
|
+
transformMixedEsModules: true,
|
|
108
|
+
ignoreTryCatch: false
|
|
109
|
+
}),
|
|
110
110
|
{
|
|
111
111
|
name: "get-deployer",
|
|
112
112
|
transform(code, id) {
|
|
@@ -160,6 +160,7 @@ function getDeployerBundler(entryFile) {
|
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
async function getDeployer(entryFile, outputDir) {
|
|
163
|
+
console.log("entryFile", entryFile);
|
|
163
164
|
const bundle = await getDeployerBundler(entryFile);
|
|
164
165
|
await bundle.write({
|
|
165
166
|
dir: outputDir,
|
|
@@ -171,7 +172,7 @@ async function getDeployer(entryFile, outputDir) {
|
|
|
171
172
|
|
|
172
173
|
Object.defineProperty(exports, "FileService", {
|
|
173
174
|
enumerable: true,
|
|
174
|
-
get: function () { return
|
|
175
|
+
get: function () { return chunk7GYBZLVN_cjs.FileService; }
|
|
175
176
|
});
|
|
176
177
|
Object.defineProperty(exports, "Deps", {
|
|
177
178
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FileService } from './chunk-
|
|
2
|
-
export { FileService } from './chunk-
|
|
3
|
-
import { Bundler } from './chunk-
|
|
1
|
+
import { FileService } from './chunk-PUX2FDGX.js';
|
|
2
|
+
export { FileService } from './chunk-PUX2FDGX.js';
|
|
3
|
+
import { Bundler } from './chunk-CS5NGTWK.js';
|
|
4
4
|
import { Deps, recursiveRemoveNonReferencedNodes } from './chunk-ZAXXMFXX.js';
|
|
5
5
|
export { Deps, createChildProcessLogger, createPinoStream } from './chunk-ZAXXMFXX.js';
|
|
6
6
|
import * as babel from '@babel/core';
|
|
@@ -72,18 +72,18 @@ function getDeployerBundler(entryFile) {
|
|
|
72
72
|
},
|
|
73
73
|
treeshake: "smallest",
|
|
74
74
|
plugins: [
|
|
75
|
-
commonjs({
|
|
76
|
-
extensions: [".js", ".ts"],
|
|
77
|
-
strictRequires: "strict",
|
|
78
|
-
transformMixedEsModules: true,
|
|
79
|
-
ignoreTryCatch: false
|
|
80
|
-
}),
|
|
81
75
|
// transpile typescript to something we understand
|
|
82
76
|
esbuild({
|
|
83
77
|
target: "node20",
|
|
84
78
|
platform: "node",
|
|
85
79
|
minify: false
|
|
86
80
|
}),
|
|
81
|
+
commonjs({
|
|
82
|
+
extensions: [".js", ".ts"],
|
|
83
|
+
strictRequires: "strict",
|
|
84
|
+
transformMixedEsModules: true,
|
|
85
|
+
ignoreTryCatch: false
|
|
86
|
+
}),
|
|
87
87
|
{
|
|
88
88
|
name: "get-deployer",
|
|
89
89
|
transform(code, id) {
|
|
@@ -137,6 +137,7 @@ function getDeployerBundler(entryFile) {
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
async function getDeployer(entryFile, outputDir) {
|
|
140
|
+
console.log("entryFile", entryFile);
|
|
140
141
|
const bundle = await getDeployerBundler(entryFile);
|
|
141
142
|
await bundle.write({
|
|
142
143
|
dir: outputDir,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer",
|
|
3
|
-
"version": "0.2.4
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"rollup-plugin-node-externals": "^8.0.0",
|
|
96
96
|
"typescript-paths": "^1.5.1",
|
|
97
97
|
"zod": "^3.24.2",
|
|
98
|
-
"@mastra/core": "^0.6.4
|
|
98
|
+
"@mastra/core": "^0.6.4"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@hono/node-server": "^1.13.8",
|