@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/chunk-54KOF3NB.cjs
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var babel = require('@babel/core');
|
|
4
|
-
var fs = require('fs');
|
|
5
|
-
var path = require('path');
|
|
6
|
-
var typescriptPaths = require('typescript-paths');
|
|
7
|
-
|
|
8
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
function _interopNamespace(e) {
|
|
11
|
-
if (e && e.__esModule) return e;
|
|
12
|
-
var n = Object.create(null);
|
|
13
|
-
if (e) {
|
|
14
|
-
Object.keys(e).forEach(function (k) {
|
|
15
|
-
if (k !== 'default') {
|
|
16
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () { return e[k]; }
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
n.default = e;
|
|
25
|
-
return Object.freeze(n);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
var babel__namespace = /*#__PURE__*/_interopNamespace(babel);
|
|
29
|
-
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
30
|
-
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
31
|
-
|
|
32
|
-
// src/build/plugins/remove-deployer.ts
|
|
33
|
-
function removeDeployer() {
|
|
34
|
-
const t = babel__namespace.default.types;
|
|
35
|
-
return {
|
|
36
|
-
name: "remove-deployer",
|
|
37
|
-
visitor: {
|
|
38
|
-
NewExpression(path2, state) {
|
|
39
|
-
const varDeclaratorPath = path2.findParent((path3) => t.isVariableDeclarator(path3.node));
|
|
40
|
-
if (!varDeclaratorPath) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const parentNode = path2.parentPath.node;
|
|
44
|
-
if (!t.isVariableDeclarator(parentNode) || !t.isIdentifier(parentNode.id) || parentNode.id.name !== "mastra") {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (!state.hasReplaced) {
|
|
48
|
-
state.hasReplaced = true;
|
|
49
|
-
const newMastraObj = t.cloneNode(path2.node);
|
|
50
|
-
if (t.isObjectExpression(newMastraObj.arguments[0]) && newMastraObj.arguments[0].properties?.[0]) {
|
|
51
|
-
const deployer = newMastraObj.arguments[0].properties.find(
|
|
52
|
-
(prop) => t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === "deployer"
|
|
53
|
-
);
|
|
54
|
-
if (!deployer) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
newMastraObj.arguments[0].properties = newMastraObj.arguments[0].properties.filter(
|
|
58
|
-
(prop) => prop !== deployer
|
|
59
|
-
);
|
|
60
|
-
if (t.isObjectProperty(deployer) && t.isIdentifier(deployer.value)) {
|
|
61
|
-
const deployerBinding = state.file.scope.getBinding(deployer.value.name);
|
|
62
|
-
if (deployerBinding) {
|
|
63
|
-
deployerBinding?.path?.parentPath?.remove();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
path2.replaceWith(newMastraObj);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// src/build/plugins/remove-deployer.ts
|
|
75
|
-
function removeDeployer2(mastraEntry) {
|
|
76
|
-
return {
|
|
77
|
-
name: "remove-deployer",
|
|
78
|
-
transform(code, id) {
|
|
79
|
-
if (id !== mastraEntry) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
return new Promise((resolve, reject) => {
|
|
83
|
-
babel__namespace.transform(
|
|
84
|
-
code,
|
|
85
|
-
{
|
|
86
|
-
babelrc: false,
|
|
87
|
-
configFile: false,
|
|
88
|
-
filename: id,
|
|
89
|
-
plugins: [removeDeployer]
|
|
90
|
-
},
|
|
91
|
-
(err, result) => {
|
|
92
|
-
if (err) {
|
|
93
|
-
return reject(err);
|
|
94
|
-
}
|
|
95
|
-
resolve({
|
|
96
|
-
code: result.code,
|
|
97
|
-
map: result.map
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
var PLUGIN_NAME = "tsconfig-paths";
|
|
106
|
-
function tsConfigPaths({ tsConfigPath, respectCoreModule } = {}) {
|
|
107
|
-
let handler;
|
|
108
|
-
return {
|
|
109
|
-
name: PLUGIN_NAME,
|
|
110
|
-
buildStart() {
|
|
111
|
-
handler = typescriptPaths.createHandler({
|
|
112
|
-
log: () => {
|
|
113
|
-
},
|
|
114
|
-
tsConfigPath,
|
|
115
|
-
respectCoreModule,
|
|
116
|
-
falllback: (moduleName) => fs__default.default.existsSync(moduleName)
|
|
117
|
-
});
|
|
118
|
-
return;
|
|
119
|
-
},
|
|
120
|
-
async resolveId(request, importer, options) {
|
|
121
|
-
if (!importer || request.startsWith("\0")) {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
const moduleName = handler?.(request, path.normalize(importer));
|
|
125
|
-
if (!moduleName) {
|
|
126
|
-
return this.resolve(request, importer, { skipSelf: true, ...options });
|
|
127
|
-
}
|
|
128
|
-
if (!path__default.default.extname(moduleName)) {
|
|
129
|
-
return this.resolve(moduleName, importer, { skipSelf: true, ...options });
|
|
130
|
-
}
|
|
131
|
-
return moduleName;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
exports.removeDeployer = removeDeployer2;
|
|
137
|
-
exports.tsConfigPaths = tsConfigPaths;
|
package/dist/chunk-6QMONK4A.cjs
DELETED
package/dist/chunk-C4JT7CIH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/chunk-D2DCFCLH.cjs
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk54KOF3NB_cjs = require('./chunk-54KOF3NB.cjs');
|
|
4
|
-
var alias = require('@rollup/plugin-alias');
|
|
5
|
-
var commonjs = require('@rollup/plugin-commonjs');
|
|
6
|
-
var json = require('@rollup/plugin-json');
|
|
7
|
-
var nodeResolve = require('@rollup/plugin-node-resolve');
|
|
8
|
-
var url = require('url');
|
|
9
|
-
var rollup = require('rollup');
|
|
10
|
-
var esbuild = require('rollup-plugin-esbuild');
|
|
11
|
-
|
|
12
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
|
|
14
|
-
var alias__default = /*#__PURE__*/_interopDefault(alias);
|
|
15
|
-
var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
|
|
16
|
-
var json__default = /*#__PURE__*/_interopDefault(json);
|
|
17
|
-
var nodeResolve__default = /*#__PURE__*/_interopDefault(nodeResolve);
|
|
18
|
-
var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
|
|
19
|
-
|
|
20
|
-
async function getInputOptions(entryFile, analyzedBundleInfo, platform, env = { "process.env.NODE_ENV": JSON.stringify("production") }) {
|
|
21
|
-
let nodeResolvePlugin = platform === "node" ? nodeResolve__default.default({
|
|
22
|
-
preferBuiltins: true,
|
|
23
|
-
exportConditions: ["node"]
|
|
24
|
-
}) : nodeResolve__default.default({
|
|
25
|
-
preferBuiltins: false,
|
|
26
|
-
browser: true
|
|
27
|
-
});
|
|
28
|
-
const externalsCopy = /* @__PURE__ */ new Set();
|
|
29
|
-
for (const external of analyzedBundleInfo.externalDependencies) {
|
|
30
|
-
if (external.startsWith("@")) {
|
|
31
|
-
const [scope, name] = external.split("/", 3);
|
|
32
|
-
externalsCopy.add(`${scope}/${name}`);
|
|
33
|
-
externalsCopy.add(`${scope}/${name}/*`);
|
|
34
|
-
} else {
|
|
35
|
-
externalsCopy.add(external);
|
|
36
|
-
externalsCopy.add(`${external}/*`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const externals = Array.from(externalsCopy);
|
|
40
|
-
const normalizedEntryFile = entryFile.replaceAll("\\", "/");
|
|
41
|
-
return {
|
|
42
|
-
logLevel: process.env.MASTRA_BUNDLER_DEBUG === "true" ? "debug" : "silent",
|
|
43
|
-
treeshake: "smallest",
|
|
44
|
-
preserveSymlinks: true,
|
|
45
|
-
external: externals,
|
|
46
|
-
plugins: [
|
|
47
|
-
chunk54KOF3NB_cjs.tsConfigPaths(),
|
|
48
|
-
{
|
|
49
|
-
name: "alias-optimized-deps",
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
resolveId(id) {
|
|
52
|
-
if (!analyzedBundleInfo.dependencies.has(id)) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
const isInvalidChunk = analyzedBundleInfo.invalidChunks.has(analyzedBundleInfo.dependencies.get(id));
|
|
56
|
-
if (isInvalidChunk) {
|
|
57
|
-
return {
|
|
58
|
-
id,
|
|
59
|
-
external: true
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
id: ".mastra/.build/" + analyzedBundleInfo.dependencies.get(id),
|
|
64
|
-
external: false
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
alias__default.default({
|
|
69
|
-
entries: [
|
|
70
|
-
{
|
|
71
|
-
find: /^\#server$/,
|
|
72
|
-
replacement: url.fileURLToPath(undefined("@mastra/deployer/server")).replaceAll("\\", "/")
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
find: /^\@mastra\/server\/(.*)/,
|
|
76
|
-
replacement: `@mastra/server/$1`,
|
|
77
|
-
customResolver: (id) => {
|
|
78
|
-
if (id.startsWith("@mastra/server")) {
|
|
79
|
-
return {
|
|
80
|
-
id: url.fileURLToPath(undefined(id))
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
{ find: /^\#mastra$/, replacement: normalizedEntryFile }
|
|
86
|
-
]
|
|
87
|
-
}),
|
|
88
|
-
{
|
|
89
|
-
name: "tools-rewriter",
|
|
90
|
-
resolveId(id) {
|
|
91
|
-
if (id === "#tools") {
|
|
92
|
-
return {
|
|
93
|
-
id: "./tools.mjs",
|
|
94
|
-
external: true
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
esbuild__default.default({
|
|
100
|
-
target: "node20",
|
|
101
|
-
platform,
|
|
102
|
-
minify: false,
|
|
103
|
-
define: env
|
|
104
|
-
}),
|
|
105
|
-
commonjs__default.default({
|
|
106
|
-
extensions: [".js", ".ts"],
|
|
107
|
-
transformMixedEsModules: true,
|
|
108
|
-
esmExternals(id) {
|
|
109
|
-
return externals.includes(id);
|
|
110
|
-
}
|
|
111
|
-
}),
|
|
112
|
-
nodeResolvePlugin,
|
|
113
|
-
// for debugging
|
|
114
|
-
// {
|
|
115
|
-
// name: 'logger',
|
|
116
|
-
// //@ts-ignore
|
|
117
|
-
// resolveId(id, ...args) {
|
|
118
|
-
// console.log({ id, args });
|
|
119
|
-
// },
|
|
120
|
-
// // @ts-ignore
|
|
121
|
-
// transform(code, id) {
|
|
122
|
-
// if (code.includes('class Duplexify ')) {
|
|
123
|
-
// console.log({ duplex: id });
|
|
124
|
-
// }
|
|
125
|
-
// },
|
|
126
|
-
// },
|
|
127
|
-
json__default.default(),
|
|
128
|
-
chunk54KOF3NB_cjs.removeDeployer(entryFile),
|
|
129
|
-
// treeshake unused imports
|
|
130
|
-
esbuild__default.default({
|
|
131
|
-
include: entryFile,
|
|
132
|
-
target: "node20",
|
|
133
|
-
platform,
|
|
134
|
-
minify: false
|
|
135
|
-
})
|
|
136
|
-
].filter(Boolean)
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
async function createBundler(inputOptions, outputOptions) {
|
|
140
|
-
const bundler = await rollup.rollup(inputOptions);
|
|
141
|
-
return {
|
|
142
|
-
write: () => {
|
|
143
|
-
return bundler.write({
|
|
144
|
-
...outputOptions,
|
|
145
|
-
format: "esm",
|
|
146
|
-
entryFileNames: "[name].mjs",
|
|
147
|
-
chunkFileNames: "[name].mjs"
|
|
148
|
-
});
|
|
149
|
-
},
|
|
150
|
-
close: () => {
|
|
151
|
-
return bundler.close();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
exports.createBundler = createBundler;
|
|
157
|
-
exports.getInputOptions = getInputOptions;
|
package/dist/chunk-D6736SJL.js
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import { aliasHono, recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-UYQZMNZL.js';
|
|
2
|
-
import { getInputOptions } from './chunk-TIC2KT3M.js';
|
|
3
|
-
import { tsConfigPaths } from './chunk-Z544XXXK.js';
|
|
4
|
-
import { watch, rollup } from 'rollup';
|
|
5
|
-
import { extname, dirname } from 'path';
|
|
6
|
-
import resolveFrom from 'resolve-from';
|
|
7
|
-
import { builtinModules } from 'module';
|
|
8
|
-
import * as babel from '@babel/core';
|
|
9
|
-
import esbuild from 'rollup-plugin-esbuild';
|
|
10
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
11
|
-
|
|
12
|
-
function isBuiltinModule(specifier) {
|
|
13
|
-
return builtinModules.includes(specifier) || specifier.startsWith("node:") || builtinModules.includes(specifier.replace(/^node:/, ""));
|
|
14
|
-
}
|
|
15
|
-
function safeResolve(id, importer) {
|
|
16
|
-
try {
|
|
17
|
-
return resolveFrom(importer, id);
|
|
18
|
-
} catch {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function getPackageName(id) {
|
|
23
|
-
const parts = id.split("/");
|
|
24
|
-
if (id.startsWith("@")) {
|
|
25
|
-
return parts.slice(0, 2).join("/");
|
|
26
|
-
}
|
|
27
|
-
return parts[0];
|
|
28
|
-
}
|
|
29
|
-
function nodeModulesExtensionResolver() {
|
|
30
|
-
return {
|
|
31
|
-
name: "node-modules-extension-resolver",
|
|
32
|
-
resolveId(id, importer) {
|
|
33
|
-
if (id.startsWith(".") || id.startsWith("/") || !importer) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
if (isBuiltinModule(id)) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
if (id.startsWith("@") && id.split("/").length === 2) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
if (!id.startsWith("@") && id.split("/").length === 1) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
const foundExt = extname(id);
|
|
46
|
-
if (foundExt) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
const resolved = import.meta.resolve(id);
|
|
51
|
-
if (!extname(resolved)) {
|
|
52
|
-
throw new Error(`Cannot resolve ${id} from ${importer}`);
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
55
|
-
} catch (e) {
|
|
56
|
-
for (const ext of [".mjs", ".js", ".cjs"]) {
|
|
57
|
-
const resolved = safeResolve(id + ext, importer);
|
|
58
|
-
if (resolved) {
|
|
59
|
-
const pkgName = getPackageName(id);
|
|
60
|
-
if (!pkgName) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
const pkgJsonPath = safeResolve(`${pkgName}/package.json`, importer);
|
|
64
|
-
if (!pkgJsonPath) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
const newImportWithExtension = resolved.replace(dirname(pkgJsonPath), pkgName);
|
|
68
|
-
return {
|
|
69
|
-
id: newImportWithExtension,
|
|
70
|
-
external: true
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// src/build/watcher.ts
|
|
81
|
-
async function getInputOptions2(entryFile, platform, env) {
|
|
82
|
-
const inputOptions = await getInputOptions(
|
|
83
|
-
entryFile,
|
|
84
|
-
{
|
|
85
|
-
dependencies: /* @__PURE__ */ new Map(),
|
|
86
|
-
externalDependencies: /* @__PURE__ */ new Set(),
|
|
87
|
-
invalidChunks: /* @__PURE__ */ new Set()
|
|
88
|
-
},
|
|
89
|
-
platform,
|
|
90
|
-
env
|
|
91
|
-
);
|
|
92
|
-
if (Array.isArray(inputOptions.plugins)) {
|
|
93
|
-
inputOptions.plugins = inputOptions.plugins.filter(
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
(plugin) => !plugin || !plugin?.name || plugin.name !== "node-resolve"
|
|
96
|
-
);
|
|
97
|
-
inputOptions.plugins.push(aliasHono());
|
|
98
|
-
inputOptions.plugins.push(nodeModulesExtensionResolver());
|
|
99
|
-
}
|
|
100
|
-
return inputOptions;
|
|
101
|
-
}
|
|
102
|
-
async function createWatcher(inputOptions, outputOptions) {
|
|
103
|
-
const watcher = await watch({
|
|
104
|
-
...inputOptions,
|
|
105
|
-
output: {
|
|
106
|
-
...outputOptions,
|
|
107
|
-
format: "esm",
|
|
108
|
-
entryFileNames: "[name].mjs",
|
|
109
|
-
chunkFileNames: "[name].mjs"
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
return watcher;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// src/build/babel/remove-all-options-server.ts
|
|
116
|
-
function removeAllOptionsExceptServer(result) {
|
|
117
|
-
return removeAllOptionsFromMastraExcept(result, "server");
|
|
118
|
-
}
|
|
119
|
-
function getServerOptionsBundler(entryFile, result) {
|
|
120
|
-
return rollup({
|
|
121
|
-
logLevel: "silent",
|
|
122
|
-
input: {
|
|
123
|
-
"server-config": entryFile
|
|
124
|
-
},
|
|
125
|
-
treeshake: "smallest",
|
|
126
|
-
plugins: [
|
|
127
|
-
tsConfigPaths(),
|
|
128
|
-
// transpile typescript to something we understand
|
|
129
|
-
esbuild({
|
|
130
|
-
target: "node20",
|
|
131
|
-
platform: "node",
|
|
132
|
-
minify: false
|
|
133
|
-
}),
|
|
134
|
-
commonjs({
|
|
135
|
-
extensions: [".js", ".ts"],
|
|
136
|
-
strictRequires: "strict",
|
|
137
|
-
transformMixedEsModules: true,
|
|
138
|
-
ignoreTryCatch: false
|
|
139
|
-
}),
|
|
140
|
-
{
|
|
141
|
-
name: "get-server-config",
|
|
142
|
-
transform(code, id) {
|
|
143
|
-
if (id !== entryFile) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
return new Promise((resolve, reject) => {
|
|
147
|
-
babel.transform(
|
|
148
|
-
code,
|
|
149
|
-
{
|
|
150
|
-
babelrc: false,
|
|
151
|
-
configFile: false,
|
|
152
|
-
filename: id,
|
|
153
|
-
plugins: [removeAllOptionsExceptServer(result)]
|
|
154
|
-
},
|
|
155
|
-
(err, result2) => {
|
|
156
|
-
if (err) {
|
|
157
|
-
return reject(err);
|
|
158
|
-
}
|
|
159
|
-
resolve({
|
|
160
|
-
code: result2.code,
|
|
161
|
-
map: result2.map
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
// let esbuild remove all unused imports
|
|
169
|
-
esbuild({
|
|
170
|
-
target: "node20",
|
|
171
|
-
platform: "node",
|
|
172
|
-
minify: false
|
|
173
|
-
}),
|
|
174
|
-
{
|
|
175
|
-
name: "cleanup",
|
|
176
|
-
transform(code, id) {
|
|
177
|
-
if (id !== entryFile) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
return recursiveRemoveNonReferencedNodes(code);
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
// let esbuild remove all unused imports
|
|
184
|
-
esbuild({
|
|
185
|
-
target: "node20",
|
|
186
|
-
platform: "node",
|
|
187
|
-
minify: false
|
|
188
|
-
})
|
|
189
|
-
]
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
async function getServerOptions(entryFile, outputDir) {
|
|
193
|
-
const result = {
|
|
194
|
-
hasCustomConfig: false
|
|
195
|
-
};
|
|
196
|
-
const bundle = await getServerOptionsBundler(entryFile, result);
|
|
197
|
-
await bundle.write({
|
|
198
|
-
dir: outputDir,
|
|
199
|
-
format: "es",
|
|
200
|
-
entryFileNames: "[name].mjs",
|
|
201
|
-
sourcemap: true
|
|
202
|
-
});
|
|
203
|
-
if (result.hasCustomConfig) {
|
|
204
|
-
return (await import(`file:${outputDir}/server-config.mjs`)).server;
|
|
205
|
-
}
|
|
206
|
-
return null;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export { createWatcher, getInputOptions2 as getInputOptions, getServerOptions };
|
package/dist/chunk-ENT5RDOI.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { recursiveRemoveNonReferencedNodes, removeAllOptionsFromMastraExcept } from './chunk-UYQZMNZL.js';
|
|
2
|
-
import * as babel from '@babel/core';
|
|
3
|
-
import { rollup } from 'rollup';
|
|
4
|
-
import esbuild from 'rollup-plugin-esbuild';
|
|
5
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
6
|
-
|
|
7
|
-
// src/build/babel/remove-all-options-telemetry.ts
|
|
8
|
-
function removeAllOptionsExceptTelemetry(result) {
|
|
9
|
-
return removeAllOptionsFromMastraExcept(result, "telemetry");
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// src/build/telemetry.ts
|
|
13
|
-
function getTelemetryBundler(entryFile, result) {
|
|
14
|
-
return rollup({
|
|
15
|
-
logLevel: "silent",
|
|
16
|
-
input: {
|
|
17
|
-
"telemetry-config": entryFile
|
|
18
|
-
},
|
|
19
|
-
treeshake: "smallest",
|
|
20
|
-
plugins: [
|
|
21
|
-
// transpile typescript to something we understand
|
|
22
|
-
esbuild({
|
|
23
|
-
target: "node20",
|
|
24
|
-
platform: "node",
|
|
25
|
-
minify: false
|
|
26
|
-
}),
|
|
27
|
-
commonjs({
|
|
28
|
-
extensions: [".js", ".ts"],
|
|
29
|
-
strictRequires: "strict",
|
|
30
|
-
transformMixedEsModules: true,
|
|
31
|
-
ignoreTryCatch: false
|
|
32
|
-
}),
|
|
33
|
-
{
|
|
34
|
-
name: "get-telemetry-config",
|
|
35
|
-
transform(code, id) {
|
|
36
|
-
if (id !== entryFile) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
babel.transform(
|
|
41
|
-
code,
|
|
42
|
-
{
|
|
43
|
-
babelrc: false,
|
|
44
|
-
configFile: false,
|
|
45
|
-
filename: id,
|
|
46
|
-
plugins: [removeAllOptionsExceptTelemetry(result)]
|
|
47
|
-
},
|
|
48
|
-
(err, result2) => {
|
|
49
|
-
if (err) {
|
|
50
|
-
return reject(err);
|
|
51
|
-
}
|
|
52
|
-
resolve({
|
|
53
|
-
code: result2.code,
|
|
54
|
-
map: result2.map
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
// let esbuild remove all unused imports
|
|
62
|
-
esbuild({
|
|
63
|
-
target: "node20",
|
|
64
|
-
platform: "node",
|
|
65
|
-
minify: false
|
|
66
|
-
}),
|
|
67
|
-
{
|
|
68
|
-
name: "cleanup",
|
|
69
|
-
transform(code, id) {
|
|
70
|
-
if (id !== entryFile) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
return recursiveRemoveNonReferencedNodes(code);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
// let esbuild remove all unused imports
|
|
77
|
-
esbuild({
|
|
78
|
-
target: "node20",
|
|
79
|
-
platform: "node",
|
|
80
|
-
minify: false
|
|
81
|
-
})
|
|
82
|
-
]
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
async function writeTelemetryConfig(entryFile, outputDir) {
|
|
86
|
-
const result = {
|
|
87
|
-
hasCustomConfig: false
|
|
88
|
-
};
|
|
89
|
-
const bundle = await getTelemetryBundler(entryFile, result);
|
|
90
|
-
const { output } = await bundle.write({
|
|
91
|
-
dir: outputDir,
|
|
92
|
-
format: "es",
|
|
93
|
-
entryFileNames: "[name].mjs"
|
|
94
|
-
});
|
|
95
|
-
const externals = output[0].imports.filter((x) => !x.startsWith("./"));
|
|
96
|
-
return { ...result, externalDependencies: externals };
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export { writeTelemetryConfig };
|