@mastra/deployer 0.11.0-alpha.0 → 0.11.0-alpha.2
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/_tsup-dts-rollup.d.cts +80 -9
- package/dist/_tsup-dts-rollup.d.ts +80 -9
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +15 -15
- package/dist/build/index.js +5 -5
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-GPD54HBC.js → chunk-7HFWRNM7.js} +1 -7
- package/dist/{chunk-Z544XXXK.js → chunk-AFR3LY44.js} +45 -4
- package/dist/{chunk-LT2BJRBN.js → chunk-APPDEIPA.js} +9 -4
- package/dist/{chunk-UFVGATV6.cjs → chunk-D73JIE6N.cjs} +41 -25
- package/dist/{chunk-D57U647E.js → chunk-DB7LRMOC.js} +31 -15
- package/dist/{chunk-M2VZQFTW.cjs → chunk-E7ZSCQUV.cjs} +15 -9
- package/dist/{chunk-KCP5ITLV.cjs → chunk-F25LATVR.cjs} +3 -9
- package/dist/{chunk-TIC2KT3M.js → chunk-HZNWZQHG.js} +2 -1
- package/dist/{chunk-D2DCFCLH.cjs → chunk-MOG6ASL4.cjs} +4 -3
- package/dist/{chunk-ENT5RDOI.js → chunk-NB6XIOPQ.js} +14 -8
- package/dist/{chunk-YVPLA2GR.cjs → chunk-TK2RG7LU.cjs} +14 -9
- package/dist/{chunk-UYQZMNZL.js → chunk-TLGEPS44.js} +29 -3
- package/dist/{chunk-54KOF3NB.cjs → chunk-WKW236CI.cjs} +46 -4
- package/dist/{chunk-XKH6F4NE.cjs → chunk-WTGMSQT5.cjs} +32 -6
- package/dist/index.cjs +11 -11
- package/dist/index.js +4 -4
- package/dist/server/index.cjs +1169 -375
- package/dist/server/index.d.cts +1 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1174 -381
- package/dist/services/index.cjs +4 -4
- package/dist/services/index.js +1 -1
- package/dist/templates/instrumentation-template.js +10 -6
- package/package.json +3 -3
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var babel = require('@babel/core');
|
|
4
4
|
var fs = require('fs');
|
|
5
5
|
var path = require('path');
|
|
6
|
+
var resolveFrom = require('resolve-from');
|
|
6
7
|
var typescriptPaths = require('typescript-paths');
|
|
7
8
|
|
|
8
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -28,6 +29,7 @@ function _interopNamespace(e) {
|
|
|
28
29
|
var babel__namespace = /*#__PURE__*/_interopNamespace(babel);
|
|
29
30
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
30
31
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
32
|
+
var resolveFrom__default = /*#__PURE__*/_interopDefault(resolveFrom);
|
|
31
33
|
|
|
32
34
|
// src/build/plugins/remove-deployer.ts
|
|
33
35
|
function removeDeployer() {
|
|
@@ -103,7 +105,7 @@ function removeDeployer2(mastraEntry) {
|
|
|
103
105
|
};
|
|
104
106
|
}
|
|
105
107
|
var PLUGIN_NAME = "tsconfig-paths";
|
|
106
|
-
function tsConfigPaths({ tsConfigPath, respectCoreModule } = {}) {
|
|
108
|
+
function tsConfigPaths({ tsConfigPath, respectCoreModule, localResolve } = {}) {
|
|
107
109
|
let handler;
|
|
108
110
|
return {
|
|
109
111
|
name: PLUGIN_NAME,
|
|
@@ -123,12 +125,52 @@ function tsConfigPaths({ tsConfigPath, respectCoreModule } = {}) {
|
|
|
123
125
|
}
|
|
124
126
|
const moduleName = handler?.(request, path.normalize(importer));
|
|
125
127
|
if (!moduleName) {
|
|
126
|
-
|
|
128
|
+
let importerMeta = {};
|
|
129
|
+
if (localResolve) {
|
|
130
|
+
const importerInfo = this.getModuleInfo(importer);
|
|
131
|
+
importerMeta = importerInfo?.meta || {};
|
|
132
|
+
if (!request.startsWith("./") && !request.startsWith("../") && importerMeta?.[PLUGIN_NAME]?.resolved) {
|
|
133
|
+
return {
|
|
134
|
+
id: resolveFrom__default.default(importer, request) ?? null,
|
|
135
|
+
external: true
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const resolved = await this.resolve(request, importer, { skipSelf: true, ...options });
|
|
140
|
+
if (!resolved) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
...resolved,
|
|
145
|
+
meta: {
|
|
146
|
+
...resolved.meta || {},
|
|
147
|
+
...importerMeta
|
|
148
|
+
}
|
|
149
|
+
};
|
|
127
150
|
}
|
|
128
151
|
if (!path__default.default.extname(moduleName)) {
|
|
129
|
-
|
|
152
|
+
const resolved = await this.resolve(moduleName, importer, { skipSelf: true, ...options });
|
|
153
|
+
if (!resolved) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
...resolved,
|
|
158
|
+
meta: {
|
|
159
|
+
...resolved.meta,
|
|
160
|
+
[PLUGIN_NAME]: {
|
|
161
|
+
resolved: true
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
130
165
|
}
|
|
131
|
-
return
|
|
166
|
+
return {
|
|
167
|
+
id: moduleName,
|
|
168
|
+
meta: {
|
|
169
|
+
[PLUGIN_NAME]: {
|
|
170
|
+
resolved: true
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
132
174
|
}
|
|
133
175
|
};
|
|
134
176
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkWKW236CI_cjs = require('./chunk-WKW236CI.cjs');
|
|
4
4
|
var commonjs2 = require('@rollup/plugin-commonjs');
|
|
5
5
|
var json = require('@rollup/plugin-json');
|
|
6
6
|
var nodeResolve = require('@rollup/plugin-node-resolve');
|
|
@@ -95,7 +95,7 @@ function validate(file) {
|
|
|
95
95
|
}
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
|
-
function removeAllOptionsFromMastraExcept(result, option) {
|
|
98
|
+
function removeAllOptionsFromMastraExcept(result, option, logger) {
|
|
99
99
|
const t = babel__namespace.default.types;
|
|
100
100
|
return {
|
|
101
101
|
name: "remove-all-except-" + option + "-config",
|
|
@@ -145,6 +145,28 @@ function removeAllOptionsFromMastraExcept(result, option) {
|
|
|
145
145
|
[]
|
|
146
146
|
);
|
|
147
147
|
programPath.node.body.push(exportDeclaration);
|
|
148
|
+
},
|
|
149
|
+
Program: {
|
|
150
|
+
exit(path) {
|
|
151
|
+
const hasExport = path.node.body.some(
|
|
152
|
+
(node) => node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration"
|
|
153
|
+
);
|
|
154
|
+
if (!hasExport) {
|
|
155
|
+
if (logger) {
|
|
156
|
+
logger.warn(`Mastra ${option} config could not be extracted. Make sure you entry file looks like
|
|
157
|
+
export const mastra = new Mastra({
|
|
158
|
+
${option}: <value>
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
`);
|
|
162
|
+
}
|
|
163
|
+
const fallbackExportDeclaration = t.exportNamedDeclaration(
|
|
164
|
+
t.variableDeclaration("const", [t.variableDeclarator(t.identifier(option), t.objectExpression([]))]),
|
|
165
|
+
[]
|
|
166
|
+
);
|
|
167
|
+
path.node.body.push(fallbackExportDeclaration);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
148
170
|
}
|
|
149
171
|
}
|
|
150
172
|
};
|
|
@@ -237,7 +259,7 @@ function getBundlerOptionsBundler(entryFile, result) {
|
|
|
237
259
|
},
|
|
238
260
|
treeshake: "smallest",
|
|
239
261
|
plugins: [
|
|
240
|
-
|
|
262
|
+
chunkWKW236CI_cjs.tsConfigPaths(),
|
|
241
263
|
// transpile typescript to something we understand
|
|
242
264
|
esbuild__default.default({
|
|
243
265
|
target: "node20",
|
|
@@ -328,7 +350,8 @@ var globalExternals = [
|
|
|
328
350
|
"jsdom",
|
|
329
351
|
"sqlite3",
|
|
330
352
|
"fastembed",
|
|
331
|
-
"nodemailer"
|
|
353
|
+
"nodemailer",
|
|
354
|
+
"#tools"
|
|
332
355
|
];
|
|
333
356
|
function findExternalImporter(module, external, allOutputs) {
|
|
334
357
|
const capturedFiles = /* @__PURE__ */ new Set();
|
|
@@ -369,7 +392,7 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
|
|
|
369
392
|
preserveSymlinks: true,
|
|
370
393
|
plugins: [
|
|
371
394
|
virtualPlugin,
|
|
372
|
-
|
|
395
|
+
chunkWKW236CI_cjs.tsConfigPaths(),
|
|
373
396
|
{
|
|
374
397
|
name: "custom-alias-resolver",
|
|
375
398
|
resolveId(id) {
|
|
@@ -402,7 +425,7 @@ async function analyze(entry, mastraEntry, isVirtualFile, platform, logger) {
|
|
|
402
425
|
transformMixedEsModules: true,
|
|
403
426
|
extensions: [".js", ".ts"]
|
|
404
427
|
}),
|
|
405
|
-
|
|
428
|
+
chunkWKW236CI_cjs.removeDeployer(normalizedMastraEntry),
|
|
406
429
|
esbuild__default.default({
|
|
407
430
|
target: "node20",
|
|
408
431
|
platform,
|
|
@@ -517,6 +540,9 @@ async function bundleExternals(depsToOptimize, outputDir, logger, customExternal
|
|
|
517
540
|
const filteredChunks = output.filter((o) => o.type === "chunk");
|
|
518
541
|
for (const o of filteredChunks.filter((o2) => o2.isEntry || o2.isDynamicEntry)) {
|
|
519
542
|
for (const external of allExternals) {
|
|
543
|
+
if (external === "#tools") {
|
|
544
|
+
continue;
|
|
545
|
+
}
|
|
520
546
|
const importer = findExternalImporter(o, external, filteredChunks);
|
|
521
547
|
if (importer) {
|
|
522
548
|
const fullPath = path.join(outputDir, importer.fileName);
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkD73JIE6N_cjs = require('./chunk-D73JIE6N.cjs');
|
|
4
|
+
var chunkWTGMSQT5_cjs = require('./chunk-WTGMSQT5.cjs');
|
|
5
|
+
var chunkF25LATVR_cjs = require('./chunk-F25LATVR.cjs');
|
|
6
6
|
var babel = require('@babel/core');
|
|
7
7
|
var rollup = require('rollup');
|
|
8
8
|
var esbuild = require('rollup-plugin-esbuild');
|
|
@@ -33,8 +33,8 @@ 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
|
|
37
|
-
deps = new
|
|
36
|
+
var Deployer = class extends chunkD73JIE6N_cjs.Bundler {
|
|
37
|
+
deps = new chunkF25LATVR_cjs.DepsService();
|
|
38
38
|
constructor(args) {
|
|
39
39
|
super(args.name, "DEPLOYER");
|
|
40
40
|
this.deps.__setLogger(this.logger);
|
|
@@ -42,7 +42,7 @@ var Deployer = class extends chunkUFVGATV6_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 chunkF25LATVR_cjs.FileService();
|
|
46
46
|
const envFile = fileService.getFirstExistingFile(possibleFiles);
|
|
47
47
|
return Promise.resolve([envFile]);
|
|
48
48
|
} catch {
|
|
@@ -148,7 +148,7 @@ function getDeployerBundler(entryFile, result) {
|
|
|
148
148
|
if (id !== entryFile) {
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
return
|
|
151
|
+
return chunkWTGMSQT5_cjs.recursiveRemoveNonReferencedNodes(code);
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
154
|
// let esbuild remove all unused imports
|
|
@@ -176,19 +176,19 @@ async function getDeployer(entryFile, outputDir) {
|
|
|
176
176
|
|
|
177
177
|
Object.defineProperty(exports, "Deps", {
|
|
178
178
|
enumerable: true,
|
|
179
|
-
get: function () { return
|
|
179
|
+
get: function () { return chunkF25LATVR_cjs.Deps; }
|
|
180
180
|
});
|
|
181
181
|
Object.defineProperty(exports, "FileService", {
|
|
182
182
|
enumerable: true,
|
|
183
|
-
get: function () { return
|
|
183
|
+
get: function () { return chunkF25LATVR_cjs.FileService; }
|
|
184
184
|
});
|
|
185
185
|
Object.defineProperty(exports, "createChildProcessLogger", {
|
|
186
186
|
enumerable: true,
|
|
187
|
-
get: function () { return
|
|
187
|
+
get: function () { return chunkF25LATVR_cjs.createChildProcessLogger; }
|
|
188
188
|
});
|
|
189
189
|
Object.defineProperty(exports, "createPinoStream", {
|
|
190
190
|
enumerable: true,
|
|
191
|
-
get: function () { return
|
|
191
|
+
get: function () { return chunkF25LATVR_cjs.createPinoStream; }
|
|
192
192
|
});
|
|
193
193
|
exports.Deployer = Deployer;
|
|
194
194
|
exports.getDeployer = getDeployer;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Bundler } from './chunk-
|
|
2
|
-
import { recursiveRemoveNonReferencedNodes } from './chunk-
|
|
3
|
-
import { DepsService, FileService } from './chunk-
|
|
4
|
-
export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-
|
|
1
|
+
import { Bundler } from './chunk-DB7LRMOC.js';
|
|
2
|
+
import { recursiveRemoveNonReferencedNodes } from './chunk-TLGEPS44.js';
|
|
3
|
+
import { DepsService, FileService } from './chunk-7HFWRNM7.js';
|
|
4
|
+
export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-7HFWRNM7.js';
|
|
5
5
|
import * as babel from '@babel/core';
|
|
6
6
|
import babel__default from '@babel/core';
|
|
7
7
|
import { rollup } from 'rollup';
|