@mastra/deployer 1.55.0 → 1.56.0-alpha.0
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/CHANGELOG.md +10 -0
- package/dist/{analyze-DhDZW9TS.cjs → analyze-Bd7sweH1.cjs} +102 -6
- package/dist/{analyze-DhDZW9TS.cjs.map → analyze-Bd7sweH1.cjs.map} +1 -1
- package/dist/{analyze-C2q7jxbN.js → analyze-NsGxmfVD.js} +90 -7
- package/dist/analyze-NsGxmfVD.js.map +1 -0
- package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
- package/dist/build/analyze.cjs +1 -1
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +5 -5
- package/dist/build/index.js +5 -5
- package/dist/build/plugins/node-modules-extension-resolver.d.ts.map +1 -1
- package/dist/{build-KCOeHd4N.js → build-BXESKc2J.js} +5 -5
- package/dist/{build-KCOeHd4N.js.map → build-BXESKc2J.js.map} +1 -1
- package/dist/{build-De4AZhfJ.cjs → build-CwZ98Yf2.cjs} +5 -5
- package/dist/{build-De4AZhfJ.cjs.map → build-CwZ98Yf2.cjs.map} +1 -1
- package/dist/bundler/index.cjs +36 -11
- package/dist/bundler/index.cjs.map +1 -1
- package/dist/bundler/index.d.ts +1 -1
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +37 -12
- package/dist/bundler/index.js.map +1 -1
- package/dist/bundler/workspaceDependencies.d.ts +3 -5
- package/dist/bundler/workspaceDependencies.d.ts.map +1 -1
- package/dist/{bundler-D86rFu2J.js → bundler-U9F2---r.js} +2 -3
- package/dist/bundler-U9F2---r.js.map +1 -0
- package/dist/{bundler-BqrDXofn.cjs → bundler-u9WOUtpl.cjs} +2 -3
- package/dist/bundler-u9WOUtpl.cjs.map +1 -0
- package/dist/{bundlerOptions-aFsEi86t.js → bundlerOptions-9DigsVhY.js} +2 -2
- package/dist/{bundlerOptions-aFsEi86t.js.map → bundlerOptions-9DigsVhY.js.map} +1 -1
- package/dist/{bundlerOptions-rBmtSyGe.cjs → bundlerOptions-CYRir4LE.cjs} +2 -2
- package/dist/{bundlerOptions-rBmtSyGe.cjs.map → bundlerOptions-CYRir4LE.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/services/deps.d.ts +6 -2
- package/dist/services/deps.d.ts.map +1 -1
- package/dist/services/index.cjs +1 -1
- package/dist/services/index.js +1 -1
- package/dist/{services-CLi56qqe.js → services-CHz7RuZ1.js} +7 -3
- package/dist/services-CHz7RuZ1.js.map +1 -0
- package/dist/{services-BxYMLS9-.cjs → services-Cw3Ho44Z.cjs} +7 -3
- package/dist/services-Cw3Ho44Z.cjs.map +1 -0
- package/package.json +6 -6
- package/dist/analyze-C2q7jxbN.js.map +0 -1
- package/dist/bundler-BqrDXofn.cjs.map +0 -1
- package/dist/bundler-D86rFu2J.js.map +0 -1
- package/dist/services-BxYMLS9-.cjs.map +0 -1
- package/dist/services-CLi56qqe.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @mastra/deployer
|
|
2
2
|
|
|
3
|
+
## 1.56.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed builds for transitive workspace dependencies that only expose subpath exports. ([#19808](https://github.com/mastra-ai/mastra/pull/19808))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`7f4e26d`](https://github.com/mastra-ai/mastra/commit/7f4e26dd57bd9b23c278ea21235ab823a3810a6c), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c)]:
|
|
10
|
+
- @mastra/core@1.56.0-alpha.0
|
|
11
|
+
- @mastra/server@1.56.0-alpha.0
|
|
12
|
+
|
|
3
13
|
## 1.55.0
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
2
|
const require_utils = require("./utils-O98BGdnP.cjs");
|
|
3
|
-
require("./services-
|
|
4
|
-
const require_bundler = require("./bundler-
|
|
3
|
+
const require_services = require("./services-Cw3Ho44Z.cjs");
|
|
4
|
+
const require_bundler = require("./bundler-u9WOUtpl.cjs");
|
|
5
5
|
let child_process = require("child_process");
|
|
6
6
|
let fs = require("fs");
|
|
7
7
|
let fs_promises = require("fs/promises");
|
|
@@ -13,9 +13,10 @@ _rollup_plugin_virtual = require_rolldown_runtime.__toESM(_rollup_plugin_virtual
|
|
|
13
13
|
let empathic_package = require("empathic/package");
|
|
14
14
|
empathic_package = require_rolldown_runtime.__toESM(empathic_package, 1);
|
|
15
15
|
let _babel_core = require("@babel/core");
|
|
16
|
-
require("@sindresorhus/slugify");
|
|
16
|
+
let _sindresorhus_slugify = require("@sindresorhus/slugify");
|
|
17
|
+
_sindresorhus_slugify = require_rolldown_runtime.__toESM(_sindresorhus_slugify, 1);
|
|
17
18
|
let find_workspaces = require("find-workspaces");
|
|
18
|
-
require("fs-extra");
|
|
19
|
+
let fs_extra = require("fs-extra");
|
|
19
20
|
let url = require("url");
|
|
20
21
|
let _rollup_plugin_commonjs = require("@rollup/plugin-commonjs");
|
|
21
22
|
_rollup_plugin_commonjs = require_rolldown_runtime.__toESM(_rollup_plugin_commonjs, 1);
|
|
@@ -126,6 +127,24 @@ var require_stack_trace_parser_cjs = /* @__PURE__ */ require_rolldown_runtime.__
|
|
|
126
127
|
//#endregion
|
|
127
128
|
//#region src/bundler/workspaceDependencies.ts
|
|
128
129
|
var import_stack_trace_parser_cjs = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_stack_trace_parser_cjs(), 1);
|
|
130
|
+
const isExportTargetImportable = (target) => {
|
|
131
|
+
if (!target) return false;
|
|
132
|
+
if (typeof target === "string") return true;
|
|
133
|
+
if (Array.isArray(target)) return target.some(isExportTargetImportable);
|
|
134
|
+
if (typeof target !== "object") return false;
|
|
135
|
+
return Object.values(target).some(isExportTargetImportable);
|
|
136
|
+
};
|
|
137
|
+
const hasRootExport = (exportsField) => {
|
|
138
|
+
if (exportsField === void 0) return true;
|
|
139
|
+
if (typeof exportsField === "string" || Array.isArray(exportsField)) return isExportTargetImportable(exportsField);
|
|
140
|
+
if (!exportsField || typeof exportsField !== "object") return false;
|
|
141
|
+
const exportMap = exportsField;
|
|
142
|
+
const exportKeys = Object.keys(exportMap);
|
|
143
|
+
if (exportKeys.length === 0) return false;
|
|
144
|
+
if (Object.prototype.hasOwnProperty.call(exportMap, ".")) return isExportTargetImportable(exportMap["."]);
|
|
145
|
+
if (exportKeys.some((key) => key.startsWith("./"))) return false;
|
|
146
|
+
return isExportTargetImportable(exportMap);
|
|
147
|
+
};
|
|
129
148
|
/**
|
|
130
149
|
* Create a shared cache for find-workspaces
|
|
131
150
|
*/
|
|
@@ -148,7 +167,8 @@ async function getWorkspaceInformation({ dir = process.cwd(), mastraEntryFile })
|
|
|
148
167
|
const _workspaceMap = new Map(workspaces?.map((workspace) => [workspace.package.name, {
|
|
149
168
|
location: workspace.location,
|
|
150
169
|
dependencies: workspace.package.dependencies,
|
|
151
|
-
version: workspace.package.version
|
|
170
|
+
version: workspace.package.version,
|
|
171
|
+
exports: workspace.package.exports
|
|
152
172
|
}]) ?? []);
|
|
153
173
|
const isWorkspacePackage = (workspaces ?? []).some((ws) => ws.location === location);
|
|
154
174
|
const workspaceRoot = isWorkspacePackage ? (0, find_workspaces.findWorkspacesRoot)(dir, { cache: workspacesCache })?.location : void 0;
|
|
@@ -158,6 +178,69 @@ async function getWorkspaceInformation({ dir = process.cwd(), mastraEntryFile })
|
|
|
158
178
|
isWorkspacePackage
|
|
159
179
|
};
|
|
160
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Collects all transitive workspace dependencies and their TGZ paths
|
|
183
|
+
*/
|
|
184
|
+
const collectTransitiveWorkspaceDependencies = ({ workspaceMap, initialDependencies, logger }) => {
|
|
185
|
+
const usedWorkspacePackages = /* @__PURE__ */ new Set();
|
|
186
|
+
const queue = Array.from(initialDependencies);
|
|
187
|
+
const resolutions = {};
|
|
188
|
+
while (queue.length > 0) {
|
|
189
|
+
const len = queue.length;
|
|
190
|
+
for (let i = 0; i < len; i += 1) {
|
|
191
|
+
const pkgName = queue.shift();
|
|
192
|
+
if (!pkgName || usedWorkspacePackages.has(pkgName)) continue;
|
|
193
|
+
const dep = workspaceMap.get(pkgName);
|
|
194
|
+
if (!dep) continue;
|
|
195
|
+
const root = (0, find_workspaces.findWorkspacesRoot)();
|
|
196
|
+
if (!root) throw new Error("Could not find workspace root");
|
|
197
|
+
const depsService = new require_services.DepsService(root.location);
|
|
198
|
+
depsService.__setLogger(logger);
|
|
199
|
+
const sanitizedName = (0, _sindresorhus_slugify.default)(pkgName);
|
|
200
|
+
resolutions[pkgName] = depsService.getWorkspaceDependencyPath({
|
|
201
|
+
pkgName: sanitizedName,
|
|
202
|
+
version: dep.version
|
|
203
|
+
});
|
|
204
|
+
usedWorkspacePackages.add(pkgName);
|
|
205
|
+
for (const [depName, _depVersion] of Object.entries(dep?.dependencies ?? {})) if (!usedWorkspacePackages.has(depName) && workspaceMap.has(depName)) queue.push(depName);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
resolutions,
|
|
210
|
+
usedWorkspacePackages
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Creates TGZ packages for workspace dependencies in the workspace-module directory
|
|
215
|
+
*/
|
|
216
|
+
const packWorkspaceDependencies = async ({ workspaceMap, usedWorkspacePackages, bundleOutputDir, logger }) => {
|
|
217
|
+
const root = (0, find_workspaces.findWorkspacesRoot)();
|
|
218
|
+
if (!root) throw new Error("Could not find workspace root");
|
|
219
|
+
const depsService = new require_services.DepsService(root.location);
|
|
220
|
+
depsService.__setLogger(logger);
|
|
221
|
+
if (usedWorkspacePackages.size > 0) {
|
|
222
|
+
const workspaceDirPath = (0, path.join)(bundleOutputDir, "workspace-module");
|
|
223
|
+
await (0, fs_extra.ensureDir)(workspaceDirPath);
|
|
224
|
+
logger.info("Packaging workspace dependencies", { count: usedWorkspacePackages.size });
|
|
225
|
+
const batchSize = 5;
|
|
226
|
+
const packages = Array.from(usedWorkspacePackages.values());
|
|
227
|
+
for (let i = 0; i < packages.length; i += batchSize) {
|
|
228
|
+
const batch = packages.slice(i, i + batchSize);
|
|
229
|
+
logger.info(`Packaging batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(packages.length / batchSize)}: ${batch.join(", ")}`);
|
|
230
|
+
await Promise.all(batch.map(async (pkgName) => {
|
|
231
|
+
const dep = workspaceMap.get(pkgName);
|
|
232
|
+
const sanitizedName = (0, _sindresorhus_slugify.default)(pkgName);
|
|
233
|
+
if (!dep) return;
|
|
234
|
+
await depsService.pack({
|
|
235
|
+
dir: dep.location,
|
|
236
|
+
destination: workspaceDirPath,
|
|
237
|
+
sanitizedName
|
|
238
|
+
});
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
logger.info("Successfully packaged workspace dependencies", { count: usedWorkspacePackages.size });
|
|
242
|
+
}
|
|
243
|
+
};
|
|
161
244
|
//#endregion
|
|
162
245
|
//#region src/validator/validate.ts
|
|
163
246
|
var ValidationError = class extends Error {
|
|
@@ -358,6 +441,7 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
|
|
|
358
441
|
for (const [innerDep, _innerDepVersion] of Object.entries(workspaceInfo.dependencies)) {
|
|
359
442
|
const innerWorkspaceInfo = workspaceMap.get(innerDep);
|
|
360
443
|
if (!innerWorkspaceInfo) continue;
|
|
444
|
+
if (!hasRootExport(innerWorkspaceInfo.exports)) continue;
|
|
361
445
|
const existingMeta = depsToOptimize.get(innerDep);
|
|
362
446
|
if (existingMeta) {
|
|
363
447
|
depsToOptimize.set(innerDep, {
|
|
@@ -1308,11 +1392,23 @@ Object.defineProperty(exports, "checkConfigExport", {
|
|
|
1308
1392
|
return checkConfigExport;
|
|
1309
1393
|
}
|
|
1310
1394
|
});
|
|
1395
|
+
Object.defineProperty(exports, "collectTransitiveWorkspaceDependencies", {
|
|
1396
|
+
enumerable: true,
|
|
1397
|
+
get: function() {
|
|
1398
|
+
return collectTransitiveWorkspaceDependencies;
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1311
1401
|
Object.defineProperty(exports, "getWorkspaceInformation", {
|
|
1312
1402
|
enumerable: true,
|
|
1313
1403
|
get: function() {
|
|
1314
1404
|
return getWorkspaceInformation;
|
|
1315
1405
|
}
|
|
1316
1406
|
});
|
|
1407
|
+
Object.defineProperty(exports, "packWorkspaceDependencies", {
|
|
1408
|
+
enumerable: true,
|
|
1409
|
+
get: function() {
|
|
1410
|
+
return packWorkspaceDependencies;
|
|
1411
|
+
}
|
|
1412
|
+
});
|
|
1317
1413
|
|
|
1318
|
-
//# sourceMappingURL=analyze-
|
|
1414
|
+
//# sourceMappingURL=analyze-Bd7sweH1.cjs.map
|