@mastra/deployer 0.10.12-alpha.1 → 0.10.13
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/package.json +6 -6
- package/dist/_tsup-dts-rollup.d.cts +0 -836
- package/dist/_tsup-dts-rollup.d.ts +0 -836
- package/dist/build/analyze.cjs +0 -10
- package/dist/build/analyze.d.cts +0 -1
- package/dist/build/analyze.d.ts +0 -1
- package/dist/build/analyze.js +0 -1
- package/dist/build/bundler.cjs +0 -14
- package/dist/build/bundler.d.cts +0 -2
- package/dist/build/bundler.d.ts +0 -2
- package/dist/build/bundler.js +0 -1
- package/dist/build/index.cjs +0 -50
- package/dist/build/index.d.cts +0 -10
- package/dist/build/index.d.ts +0 -10
- package/dist/build/index.js +0 -5
- package/dist/bundler/index.cjs +0 -10
- package/dist/bundler/index.d.cts +0 -1
- package/dist/bundler/index.d.ts +0 -1
- package/dist/bundler/index.js +0 -1
- package/dist/chunk-2C7ENC5E.js +0 -474
- package/dist/chunk-54KOF3NB.cjs +0 -137
- package/dist/chunk-6QMONK4A.cjs +0 -2
- package/dist/chunk-C4JT7CIH.js +0 -1
- package/dist/chunk-D2DCFCLH.cjs +0 -157
- package/dist/chunk-D6736SJL.js +0 -209
- package/dist/chunk-ENT5RDOI.js +0 -99
- package/dist/chunk-FK2WUSEN.cjs +0 -238
- package/dist/chunk-GPD54HBC.js +0 -380
- package/dist/chunk-KCP5ITLV.cjs +0 -412
- package/dist/chunk-M2VZQFTW.cjs +0 -125
- package/dist/chunk-MKB7NDY3.cjs +0 -486
- package/dist/chunk-TIC2KT3M.js +0 -146
- package/dist/chunk-UYQZMNZL.js +0 -572
- package/dist/chunk-XKH6F4NE.cjs +0 -604
- package/dist/chunk-Z544XXXK.js +0 -111
- package/dist/index.cjs +0 -194
- package/dist/index.d.cts +0 -8
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -153
- package/dist/server/index.cjs +0 -8326
- package/dist/server/index.d.cts +0 -2
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.js +0 -8318
- package/dist/services/index.cjs +0 -18
- package/dist/services/index.d.cts +0 -3
- package/dist/services/index.d.ts +0 -3
- package/dist/services/index.js +0 -1
- package/dist/templates/instrumentation-template.js +0 -137
- package/dist/validator/custom-resolver.cjs +0 -52
- package/dist/validator/custom-resolver.d.cts +0 -1
- package/dist/validator/custom-resolver.d.ts +0 -1
- package/dist/validator/custom-resolver.js +0 -50
- package/dist/validator/loader.cjs +0 -7
- package/dist/validator/loader.d.cts +0 -1
- package/dist/validator/loader.d.ts +0 -1
- package/dist/validator/loader.js +0 -4
package/dist/index.cjs
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkMKB7NDY3_cjs = require('./chunk-MKB7NDY3.cjs');
|
|
4
|
-
var chunkXKH6F4NE_cjs = require('./chunk-XKH6F4NE.cjs');
|
|
5
|
-
var chunkKCP5ITLV_cjs = require('./chunk-KCP5ITLV.cjs');
|
|
6
|
-
var babel = require('@babel/core');
|
|
7
|
-
var rollup = require('rollup');
|
|
8
|
-
var esbuild = require('rollup-plugin-esbuild');
|
|
9
|
-
var commonjs = require('@rollup/plugin-commonjs');
|
|
10
|
-
|
|
11
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
|
|
13
|
-
function _interopNamespace(e) {
|
|
14
|
-
if (e && e.__esModule) return e;
|
|
15
|
-
var n = Object.create(null);
|
|
16
|
-
if (e) {
|
|
17
|
-
Object.keys(e).forEach(function (k) {
|
|
18
|
-
if (k !== 'default') {
|
|
19
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return e[k]; }
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
n.default = e;
|
|
28
|
-
return Object.freeze(n);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var babel__namespace = /*#__PURE__*/_interopNamespace(babel);
|
|
32
|
-
var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
|
|
33
|
-
var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
|
|
34
|
-
|
|
35
|
-
// src/deploy/base.ts
|
|
36
|
-
var Deployer = class extends chunkMKB7NDY3_cjs.Bundler {
|
|
37
|
-
deps = new chunkKCP5ITLV_cjs.DepsService();
|
|
38
|
-
constructor(args) {
|
|
39
|
-
super(args.name, "DEPLOYER");
|
|
40
|
-
this.deps.__setLogger(this.logger);
|
|
41
|
-
}
|
|
42
|
-
getEnvFiles() {
|
|
43
|
-
const possibleFiles = [".env.production", ".env.local", ".env"];
|
|
44
|
-
try {
|
|
45
|
-
const fileService = new chunkKCP5ITLV_cjs.FileService();
|
|
46
|
-
const envFile = fileService.getFirstExistingFile(possibleFiles);
|
|
47
|
-
return Promise.resolve([envFile]);
|
|
48
|
-
} catch {
|
|
49
|
-
}
|
|
50
|
-
return Promise.resolve([]);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
function removeAllExceptDeployer() {
|
|
54
|
-
const t = babel__namespace.default.types;
|
|
55
|
-
return {
|
|
56
|
-
name: "remove-all-except-deployer",
|
|
57
|
-
visitor: {
|
|
58
|
-
ExportNamedDeclaration: {
|
|
59
|
-
// remove all exports
|
|
60
|
-
exit(path) {
|
|
61
|
-
path.remove();
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
NewExpression(path) {
|
|
65
|
-
const varDeclaratorPath = path.findParent((path2) => t.isVariableDeclarator(path2.node));
|
|
66
|
-
if (!varDeclaratorPath) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const parentNode = path.parentPath.node;
|
|
70
|
-
if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== "mastra") {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const deployer = path.node.arguments[0]?.properties?.find(
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
(prop) => prop.key.name === "deployer"
|
|
76
|
-
);
|
|
77
|
-
const programPath = path.scope.getProgramParent().path;
|
|
78
|
-
if (!deployer || !programPath) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const exportDeclaration = t.exportNamedDeclaration(
|
|
82
|
-
t.variableDeclaration("const", [t.variableDeclarator(t.identifier("deployer"), deployer.value)]),
|
|
83
|
-
[]
|
|
84
|
-
);
|
|
85
|
-
programPath.node.body.push(exportDeclaration);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
function getDeployerBundler(entryFile, result) {
|
|
91
|
-
return rollup.rollup({
|
|
92
|
-
logLevel: "silent",
|
|
93
|
-
input: {
|
|
94
|
-
deployer: entryFile
|
|
95
|
-
},
|
|
96
|
-
treeshake: "smallest",
|
|
97
|
-
plugins: [
|
|
98
|
-
// transpile typescript to something we understand
|
|
99
|
-
esbuild__default.default({
|
|
100
|
-
target: "node20",
|
|
101
|
-
platform: "node",
|
|
102
|
-
minify: false
|
|
103
|
-
}),
|
|
104
|
-
commonjs__default.default({
|
|
105
|
-
extensions: [".js", ".ts"],
|
|
106
|
-
strictRequires: "strict",
|
|
107
|
-
transformMixedEsModules: true,
|
|
108
|
-
ignoreTryCatch: false
|
|
109
|
-
}),
|
|
110
|
-
{
|
|
111
|
-
name: "get-deployer",
|
|
112
|
-
transform(code, id) {
|
|
113
|
-
if (id !== entryFile) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
result.isDeployerRemoved = true;
|
|
117
|
-
return new Promise((resolve, reject) => {
|
|
118
|
-
babel__namespace.transform(
|
|
119
|
-
code,
|
|
120
|
-
{
|
|
121
|
-
babelrc: false,
|
|
122
|
-
configFile: false,
|
|
123
|
-
filename: id,
|
|
124
|
-
plugins: [removeAllExceptDeployer]
|
|
125
|
-
},
|
|
126
|
-
(err, result2) => {
|
|
127
|
-
if (err) {
|
|
128
|
-
return reject(err);
|
|
129
|
-
}
|
|
130
|
-
resolve({
|
|
131
|
-
code: result2.code,
|
|
132
|
-
map: result2.map
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
// let esbuild remove all unused imports
|
|
140
|
-
esbuild__default.default({
|
|
141
|
-
target: "node20",
|
|
142
|
-
platform: "node",
|
|
143
|
-
minify: false
|
|
144
|
-
}),
|
|
145
|
-
{
|
|
146
|
-
name: "cleanup-nodes",
|
|
147
|
-
transform(code, id) {
|
|
148
|
-
if (id !== entryFile) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
return chunkXKH6F4NE_cjs.recursiveRemoveNonReferencedNodes(code);
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
// let esbuild remove all unused imports
|
|
155
|
-
esbuild__default.default({
|
|
156
|
-
target: "node20",
|
|
157
|
-
platform: "node",
|
|
158
|
-
minify: false
|
|
159
|
-
})
|
|
160
|
-
]
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
async function getDeployer(entryFile, outputDir) {
|
|
164
|
-
const result = { isDeployerRemoved: false };
|
|
165
|
-
const bundle = await getDeployerBundler(entryFile, result);
|
|
166
|
-
await bundle.write({
|
|
167
|
-
dir: outputDir,
|
|
168
|
-
format: "es",
|
|
169
|
-
entryFileNames: "[name].mjs"
|
|
170
|
-
});
|
|
171
|
-
if (!result.isDeployerRemoved) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
return (await import(`file:${outputDir}/deployer.mjs`)).deployer;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
Object.defineProperty(exports, "Deps", {
|
|
178
|
-
enumerable: true,
|
|
179
|
-
get: function () { return chunkKCP5ITLV_cjs.Deps; }
|
|
180
|
-
});
|
|
181
|
-
Object.defineProperty(exports, "FileService", {
|
|
182
|
-
enumerable: true,
|
|
183
|
-
get: function () { return chunkKCP5ITLV_cjs.FileService; }
|
|
184
|
-
});
|
|
185
|
-
Object.defineProperty(exports, "createChildProcessLogger", {
|
|
186
|
-
enumerable: true,
|
|
187
|
-
get: function () { return chunkKCP5ITLV_cjs.createChildProcessLogger; }
|
|
188
|
-
});
|
|
189
|
-
Object.defineProperty(exports, "createPinoStream", {
|
|
190
|
-
enumerable: true,
|
|
191
|
-
get: function () { return chunkKCP5ITLV_cjs.createPinoStream; }
|
|
192
|
-
});
|
|
193
|
-
exports.Deployer = Deployer;
|
|
194
|
-
exports.getDeployer = getDeployer;
|
package/dist/index.d.cts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { Deps } from './_tsup-dts-rollup.cjs';
|
|
2
|
-
export { FileService } from './_tsup-dts-rollup.cjs';
|
|
3
|
-
export { getDeployer } from './_tsup-dts-rollup.cjs';
|
|
4
|
-
export { Deployer } from './_tsup-dts-rollup.cjs';
|
|
5
|
-
export { createChildProcessLogger } from './_tsup-dts-rollup.cjs';
|
|
6
|
-
export { createPinoStream } from './_tsup-dts-rollup.cjs';
|
|
7
|
-
export { ApiError } from './_tsup-dts-rollup.cjs';
|
|
8
|
-
export { ServerBundleOptions } from './_tsup-dts-rollup.cjs';
|
package/dist/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { Deps } from './_tsup-dts-rollup.js';
|
|
2
|
-
export { FileService } from './_tsup-dts-rollup.js';
|
|
3
|
-
export { getDeployer } from './_tsup-dts-rollup.js';
|
|
4
|
-
export { Deployer } from './_tsup-dts-rollup.js';
|
|
5
|
-
export { createChildProcessLogger } from './_tsup-dts-rollup.js';
|
|
6
|
-
export { createPinoStream } from './_tsup-dts-rollup.js';
|
|
7
|
-
export { ApiError } from './_tsup-dts-rollup.js';
|
|
8
|
-
export { ServerBundleOptions } from './_tsup-dts-rollup.js';
|
package/dist/index.js
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { Bundler } from './chunk-2C7ENC5E.js';
|
|
2
|
-
import { recursiveRemoveNonReferencedNodes } from './chunk-UYQZMNZL.js';
|
|
3
|
-
import { DepsService, FileService } from './chunk-GPD54HBC.js';
|
|
4
|
-
export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-GPD54HBC.js';
|
|
5
|
-
import * as babel from '@babel/core';
|
|
6
|
-
import babel__default from '@babel/core';
|
|
7
|
-
import { rollup } from 'rollup';
|
|
8
|
-
import esbuild from 'rollup-plugin-esbuild';
|
|
9
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
10
|
-
|
|
11
|
-
// src/deploy/base.ts
|
|
12
|
-
var Deployer = class extends Bundler {
|
|
13
|
-
deps = new DepsService();
|
|
14
|
-
constructor(args) {
|
|
15
|
-
super(args.name, "DEPLOYER");
|
|
16
|
-
this.deps.__setLogger(this.logger);
|
|
17
|
-
}
|
|
18
|
-
getEnvFiles() {
|
|
19
|
-
const possibleFiles = [".env.production", ".env.local", ".env"];
|
|
20
|
-
try {
|
|
21
|
-
const fileService = new FileService();
|
|
22
|
-
const envFile = fileService.getFirstExistingFile(possibleFiles);
|
|
23
|
-
return Promise.resolve([envFile]);
|
|
24
|
-
} catch {
|
|
25
|
-
}
|
|
26
|
-
return Promise.resolve([]);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
function removeAllExceptDeployer() {
|
|
30
|
-
const t = babel__default.types;
|
|
31
|
-
return {
|
|
32
|
-
name: "remove-all-except-deployer",
|
|
33
|
-
visitor: {
|
|
34
|
-
ExportNamedDeclaration: {
|
|
35
|
-
// remove all exports
|
|
36
|
-
exit(path) {
|
|
37
|
-
path.remove();
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
NewExpression(path) {
|
|
41
|
-
const varDeclaratorPath = path.findParent((path2) => t.isVariableDeclarator(path2.node));
|
|
42
|
-
if (!varDeclaratorPath) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const parentNode = path.parentPath.node;
|
|
46
|
-
if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== "mastra") {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const deployer = path.node.arguments[0]?.properties?.find(
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
(prop) => prop.key.name === "deployer"
|
|
52
|
-
);
|
|
53
|
-
const programPath = path.scope.getProgramParent().path;
|
|
54
|
-
if (!deployer || !programPath) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const exportDeclaration = t.exportNamedDeclaration(
|
|
58
|
-
t.variableDeclaration("const", [t.variableDeclarator(t.identifier("deployer"), deployer.value)]),
|
|
59
|
-
[]
|
|
60
|
-
);
|
|
61
|
-
programPath.node.body.push(exportDeclaration);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function getDeployerBundler(entryFile, result) {
|
|
67
|
-
return rollup({
|
|
68
|
-
logLevel: "silent",
|
|
69
|
-
input: {
|
|
70
|
-
deployer: entryFile
|
|
71
|
-
},
|
|
72
|
-
treeshake: "smallest",
|
|
73
|
-
plugins: [
|
|
74
|
-
// transpile typescript to something we understand
|
|
75
|
-
esbuild({
|
|
76
|
-
target: "node20",
|
|
77
|
-
platform: "node",
|
|
78
|
-
minify: false
|
|
79
|
-
}),
|
|
80
|
-
commonjs({
|
|
81
|
-
extensions: [".js", ".ts"],
|
|
82
|
-
strictRequires: "strict",
|
|
83
|
-
transformMixedEsModules: true,
|
|
84
|
-
ignoreTryCatch: false
|
|
85
|
-
}),
|
|
86
|
-
{
|
|
87
|
-
name: "get-deployer",
|
|
88
|
-
transform(code, id) {
|
|
89
|
-
if (id !== entryFile) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
result.isDeployerRemoved = true;
|
|
93
|
-
return new Promise((resolve, reject) => {
|
|
94
|
-
babel.transform(
|
|
95
|
-
code,
|
|
96
|
-
{
|
|
97
|
-
babelrc: false,
|
|
98
|
-
configFile: false,
|
|
99
|
-
filename: id,
|
|
100
|
-
plugins: [removeAllExceptDeployer]
|
|
101
|
-
},
|
|
102
|
-
(err, result2) => {
|
|
103
|
-
if (err) {
|
|
104
|
-
return reject(err);
|
|
105
|
-
}
|
|
106
|
-
resolve({
|
|
107
|
-
code: result2.code,
|
|
108
|
-
map: result2.map
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
// let esbuild remove all unused imports
|
|
116
|
-
esbuild({
|
|
117
|
-
target: "node20",
|
|
118
|
-
platform: "node",
|
|
119
|
-
minify: false
|
|
120
|
-
}),
|
|
121
|
-
{
|
|
122
|
-
name: "cleanup-nodes",
|
|
123
|
-
transform(code, id) {
|
|
124
|
-
if (id !== entryFile) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
return recursiveRemoveNonReferencedNodes(code);
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
// let esbuild remove all unused imports
|
|
131
|
-
esbuild({
|
|
132
|
-
target: "node20",
|
|
133
|
-
platform: "node",
|
|
134
|
-
minify: false
|
|
135
|
-
})
|
|
136
|
-
]
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
async function getDeployer(entryFile, outputDir) {
|
|
140
|
-
const result = { isDeployerRemoved: false };
|
|
141
|
-
const bundle = await getDeployerBundler(entryFile, result);
|
|
142
|
-
await bundle.write({
|
|
143
|
-
dir: outputDir,
|
|
144
|
-
format: "es",
|
|
145
|
-
entryFileNames: "[name].mjs"
|
|
146
|
-
});
|
|
147
|
-
if (!result.isDeployerRemoved) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
return (await import(`file:${outputDir}/deployer.mjs`)).deployer;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export { Deployer, getDeployer };
|