@mastra/deployer 1.8.0 → 1.9.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 +32 -0
- package/LICENSE.md +15 -0
- package/dist/build/analyze/bundleExternals.d.ts +2 -0
- package/dist/build/analyze/bundleExternals.d.ts.map +1 -1
- package/dist/build/analyze/constants.d.ts.map +1 -1
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.d.ts +1 -1
- package/dist/build/analyze.d.ts.map +1 -1
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.d.ts.map +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +18 -14
- package/dist/build/index.d.ts +2 -2
- package/dist/build/index.d.ts.map +1 -1
- package/dist/build/index.js +5 -5
- package/dist/build/utils.d.ts +43 -0
- package/dist/build/utils.d.ts.map +1 -1
- package/dist/bundler/index.cjs +3 -3
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-SYOOUXQR.cjs → chunk-2U66YH5A.cjs} +16 -16
- package/dist/{chunk-SYOOUXQR.cjs.map → chunk-2U66YH5A.cjs.map} +1 -1
- package/dist/{chunk-2ADDVHED.js → chunk-56QWTZZP.js} +7 -7
- package/dist/{chunk-2ADDVHED.js.map → chunk-56QWTZZP.js.map} +1 -1
- package/dist/{chunk-CAHLKF47.js → chunk-6UIXBIO6.js} +43 -22
- package/dist/chunk-6UIXBIO6.js.map +1 -0
- package/dist/{chunk-SAAWBL2Q.cjs → chunk-73SEUI3W.cjs} +79 -58
- package/dist/chunk-73SEUI3W.cjs.map +1 -0
- package/dist/{chunk-AMZJCH64.js → chunk-ANF3UFZ3.js} +3 -3
- package/dist/{chunk-AMZJCH64.js.map → chunk-ANF3UFZ3.js.map} +1 -1
- package/dist/{chunk-TOBYD27M.cjs → chunk-EBHDMP6N.cjs} +16 -16
- package/dist/{chunk-TOBYD27M.cjs.map → chunk-EBHDMP6N.cjs.map} +1 -1
- package/dist/{chunk-KRRQVSI7.js → chunk-EZBW45SX.js} +7 -13
- package/dist/chunk-EZBW45SX.js.map +1 -0
- package/dist/{chunk-ITC6JDLC.cjs → chunk-G7R456H2.cjs} +33 -2
- package/dist/chunk-G7R456H2.cjs.map +1 -0
- package/dist/{chunk-MIZUMHGW.js → chunk-IMLDKOVJ.js} +7 -7
- package/dist/{chunk-MIZUMHGW.js.map → chunk-IMLDKOVJ.js.map} +1 -1
- package/dist/{chunk-3WL6HPU3.js → chunk-O73YCD6A.js} +3 -3
- package/dist/{chunk-3WL6HPU3.js.map → chunk-O73YCD6A.js.map} +1 -1
- package/dist/{chunk-R2SIOO54.cjs → chunk-R2SYO6PH.cjs} +20 -26
- package/dist/chunk-R2SYO6PH.cjs.map +1 -0
- package/dist/{chunk-K7J2W7DJ.cjs → chunk-UPVHAZ5Q.cjs} +7 -7
- package/dist/{chunk-K7J2W7DJ.cjs.map → chunk-UPVHAZ5Q.cjs.map} +1 -1
- package/dist/{chunk-UKA2IZKF.js → chunk-XN3FKMO6.js} +32 -3
- package/dist/chunk-XN3FKMO6.js.map +1 -0
- package/dist/{chunk-E4SQOERA.cjs → chunk-YIUDHDPS.cjs} +4 -4
- package/dist/{chunk-E4SQOERA.cjs.map → chunk-YIUDHDPS.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +151 -155
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +149 -153
- package/dist/server/index.js.map +1 -1
- package/dist/validator/custom-resolver.cjs +28 -2
- package/dist/validator/custom-resolver.cjs.map +1 -1
- package/dist/validator/custom-resolver.d.ts +15 -1
- package/dist/validator/custom-resolver.d.ts.map +1 -1
- package/dist/validator/custom-resolver.js +27 -2
- package/dist/validator/custom-resolver.js.map +1 -1
- package/dist/validator/validate.d.ts +2 -1
- package/dist/validator/validate.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-CAHLKF47.js.map +0 -1
- package/dist/chunk-ITC6JDLC.cjs.map +0 -1
- package/dist/chunk-KRRQVSI7.js.map +0 -1
- package/dist/chunk-R2SIOO54.cjs.map +0 -1
- package/dist/chunk-SAAWBL2Q.cjs.map +0 -1
- package/dist/chunk-UKA2IZKF.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkYIUDHDPS_cjs = require('./chunk-YIUDHDPS.cjs');
|
|
4
|
+
var chunkG7R456H2_cjs = require('./chunk-G7R456H2.cjs');
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
var promises = require('fs/promises');
|
|
7
7
|
var path = require('path');
|
|
@@ -158,7 +158,7 @@ async function getWorkspaceInformation({
|
|
|
158
158
|
mastraEntryFile
|
|
159
159
|
}) {
|
|
160
160
|
const closestPkgJson = pkg__namespace.up({ cwd: path.dirname(mastraEntryFile) });
|
|
161
|
-
const location = closestPkgJson ? path.dirname(
|
|
161
|
+
const location = closestPkgJson ? path.dirname(chunkG7R456H2_cjs.slash(closestPkgJson)) : chunkG7R456H2_cjs.slash(process.cwd());
|
|
162
162
|
const workspaces = await findWorkspaces.findWorkspaces(dir, { cache: workspacesCache });
|
|
163
163
|
const _workspaceMap = new Map(
|
|
164
164
|
workspaces?.map((workspace) => [
|
|
@@ -219,7 +219,11 @@ function spawn(command, args = [], options = {}) {
|
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
-
function validate(file, {
|
|
222
|
+
function validate(file, {
|
|
223
|
+
injectESMShim = false,
|
|
224
|
+
moduleResolveMapLocation,
|
|
225
|
+
stubbedExternals = []
|
|
226
|
+
}) {
|
|
223
227
|
let prefixCode = "";
|
|
224
228
|
if (injectESMShim) {
|
|
225
229
|
prefixCode = `import { fileURLToPath } from 'url';
|
|
@@ -255,7 +259,8 @@ globalThis.__dirname = dirname(__filename);
|
|
|
255
259
|
{
|
|
256
260
|
env: {
|
|
257
261
|
...process.env,
|
|
258
|
-
MODULE_MAP: `${moduleResolveMapLocation}
|
|
262
|
+
MODULE_MAP: `${moduleResolveMapLocation}`,
|
|
263
|
+
STUBBED_EXTERNALS: JSON.stringify(stubbedExternals)
|
|
259
264
|
},
|
|
260
265
|
cwd: path.dirname(file)
|
|
261
266
|
}
|
|
@@ -267,7 +272,7 @@ function isNodeBuiltin(dep) {
|
|
|
267
272
|
}
|
|
268
273
|
|
|
269
274
|
// src/build/analyze/constants.ts
|
|
270
|
-
var DEPS_TO_IGNORE = ["#tools"];
|
|
275
|
+
var DEPS_TO_IGNORE = ["#tools", "execa"];
|
|
271
276
|
var GLOBAL_EXTERNALS = [
|
|
272
277
|
"pino",
|
|
273
278
|
"pino-pretty",
|
|
@@ -277,13 +282,16 @@ var GLOBAL_EXTERNALS = [
|
|
|
277
282
|
"#tools",
|
|
278
283
|
"typescript",
|
|
279
284
|
"undici",
|
|
280
|
-
"readable-stream"
|
|
285
|
+
"readable-stream",
|
|
286
|
+
"bufferutil",
|
|
287
|
+
"utf-8-validate",
|
|
288
|
+
"execa"
|
|
281
289
|
];
|
|
282
290
|
var DEPRECATED_EXTERNALS = ["fastembed", "nodemailer", "jsdom", "sqlite3"];
|
|
283
291
|
|
|
284
292
|
// src/build/analyze/analyzeEntry.ts
|
|
285
293
|
function getInputPlugins({ entry, isVirtualFile }, mastraEntry, { sourcemapEnabled }) {
|
|
286
|
-
const normalizedMastraEntry =
|
|
294
|
+
const normalizedMastraEntry = chunkG7R456H2_cjs.slash(mastraEntry);
|
|
287
295
|
let virtualPlugin = null;
|
|
288
296
|
if (isVirtualFile) {
|
|
289
297
|
virtualPlugin = virtual__default.default({
|
|
@@ -297,12 +305,12 @@ function getInputPlugins({ entry, isVirtualFile }, mastraEntry, { sourcemapEnabl
|
|
|
297
305
|
}
|
|
298
306
|
plugins.push(
|
|
299
307
|
...[
|
|
300
|
-
|
|
308
|
+
chunkYIUDHDPS_cjs.tsConfigPaths(),
|
|
301
309
|
{
|
|
302
310
|
name: "custom-alias-resolver",
|
|
303
311
|
resolveId(id) {
|
|
304
312
|
if (id === "#server") {
|
|
305
|
-
return
|
|
313
|
+
return chunkG7R456H2_cjs.slash(url.fileURLToPath(undefined("@mastra/deployer/server")));
|
|
306
314
|
}
|
|
307
315
|
if (id === "#mastra") {
|
|
308
316
|
return normalizedMastraEntry;
|
|
@@ -313,17 +321,17 @@ function getInputPlugins({ entry, isVirtualFile }, mastraEntry, { sourcemapEnabl
|
|
|
313
321
|
}
|
|
314
322
|
},
|
|
315
323
|
json__default.default(),
|
|
316
|
-
|
|
324
|
+
chunkYIUDHDPS_cjs.esbuild(),
|
|
317
325
|
commonjs__default.default({
|
|
318
326
|
strictRequires: "debug",
|
|
319
327
|
ignoreTryCatch: false,
|
|
320
328
|
transformMixedEsModules: true,
|
|
321
329
|
extensions: [".js", ".ts"]
|
|
322
330
|
}),
|
|
323
|
-
|
|
331
|
+
chunkYIUDHDPS_cjs.removeDeployer(mastraEntry, {
|
|
324
332
|
sourcemap: sourcemapEnabled
|
|
325
333
|
}),
|
|
326
|
-
|
|
334
|
+
chunkYIUDHDPS_cjs.esbuild()
|
|
327
335
|
]
|
|
328
336
|
);
|
|
329
337
|
return plugins;
|
|
@@ -340,18 +348,18 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
|
|
|
340
348
|
}
|
|
341
349
|
let entryRootPath = projectRoot;
|
|
342
350
|
if (!output.facadeModuleId.startsWith("\0virtual:")) {
|
|
343
|
-
entryRootPath = await
|
|
351
|
+
entryRootPath = await chunkYIUDHDPS_cjs.getPackageRootPath(output.facadeModuleId) || projectRoot;
|
|
344
352
|
}
|
|
345
353
|
for (const [dependency, bindings] of Object.entries(output.importedBindings)) {
|
|
346
354
|
if (isNodeBuiltin(dependency) || dependency.startsWith("#")) {
|
|
347
355
|
continue;
|
|
348
356
|
}
|
|
349
|
-
const pkgName =
|
|
357
|
+
const pkgName = chunkG7R456H2_cjs.getPackageName(dependency);
|
|
350
358
|
let rootPath = null;
|
|
351
359
|
let isWorkspace = false;
|
|
352
360
|
let version;
|
|
353
361
|
if (pkgName) {
|
|
354
|
-
rootPath = await
|
|
362
|
+
rootPath = await chunkYIUDHDPS_cjs.getPackageRootPath(dependency, entryRootPath);
|
|
355
363
|
isWorkspace = workspaceMap.has(pkgName);
|
|
356
364
|
if (rootPath) {
|
|
357
365
|
try {
|
|
@@ -361,7 +369,7 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
|
|
|
361
369
|
}
|
|
362
370
|
}
|
|
363
371
|
}
|
|
364
|
-
const normalizedRootPath = rootPath ?
|
|
372
|
+
const normalizedRootPath = rootPath ? chunkG7R456H2_cjs.slash(rootPath) : null;
|
|
365
373
|
depsToOptimize.set(dependency, {
|
|
366
374
|
exports: bindings,
|
|
367
375
|
rootPath: normalizedRootPath,
|
|
@@ -421,11 +429,11 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
|
|
|
421
429
|
if (dynamicImports.length) {
|
|
422
430
|
for (const dynamicImport of dynamicImports) {
|
|
423
431
|
if (!depsToOptimize.has(dynamicImport) && !isNodeBuiltin(dynamicImport)) {
|
|
424
|
-
const pkgName =
|
|
432
|
+
const pkgName = chunkG7R456H2_cjs.getPackageName(dynamicImport);
|
|
425
433
|
let version;
|
|
426
434
|
let rootPath = null;
|
|
427
435
|
if (pkgName) {
|
|
428
|
-
rootPath = await
|
|
436
|
+
rootPath = await chunkYIUDHDPS_cjs.getPackageRootPath(dynamicImport, entryRootPath);
|
|
429
437
|
if (rootPath) {
|
|
430
438
|
try {
|
|
431
439
|
const pkgJson = await esm.readJSON(`${rootPath}/package.json`);
|
|
@@ -436,7 +444,7 @@ async function captureDependenciesToOptimize(output, workspaceMap, projectRoot,
|
|
|
436
444
|
}
|
|
437
445
|
depsToOptimize.set(dynamicImport, {
|
|
438
446
|
exports: ["*"],
|
|
439
|
-
rootPath: rootPath ?
|
|
447
|
+
rootPath: rootPath ? chunkG7R456H2_cjs.slash(rootPath) : null,
|
|
440
448
|
isWorkspace: false,
|
|
441
449
|
version
|
|
442
450
|
});
|
|
@@ -510,7 +518,7 @@ function moduleResolveMap(externals, projectRoot) {
|
|
|
510
518
|
}
|
|
511
519
|
for (const importedId of info.importedIds) {
|
|
512
520
|
for (const external of externals) {
|
|
513
|
-
if (
|
|
521
|
+
if (chunkG7R456H2_cjs.isDependencyPartOfPackage(importedId, external)) {
|
|
514
522
|
importMap.set(external, info.id);
|
|
515
523
|
}
|
|
516
524
|
}
|
|
@@ -522,9 +530,9 @@ function moduleResolveMap(externals, projectRoot) {
|
|
|
522
530
|
if (chunk.type === "chunk") {
|
|
523
531
|
for (const [external, resolvedFrom] of importMap) {
|
|
524
532
|
if (chunk.moduleIds.includes(resolvedFrom)) {
|
|
525
|
-
const fullPath = url.pathToFileURL(
|
|
533
|
+
const fullPath = url.pathToFileURL(chunkG7R456H2_cjs.slash(path.join(projectRoot, fileName))).toString();
|
|
526
534
|
const innerMap = resolveMap.get(fullPath) || /* @__PURE__ */ new Map();
|
|
527
|
-
innerMap.set(external, url.pathToFileURL(
|
|
535
|
+
innerMap.set(external, url.pathToFileURL(chunkG7R456H2_cjs.slash(resolvedFrom)).toString());
|
|
528
536
|
resolveMap.set(fullPath, innerMap);
|
|
529
537
|
}
|
|
530
538
|
}
|
|
@@ -590,7 +598,7 @@ function nodeGypDetector() {
|
|
|
590
598
|
|
|
591
599
|
// src/build/analyze/bundleExternals.ts
|
|
592
600
|
function prepareEntryFileName(name, rootDir) {
|
|
593
|
-
return
|
|
601
|
+
return chunkG7R456H2_cjs.rollupSafeName(name, rootDir);
|
|
594
602
|
}
|
|
595
603
|
function createVirtualDependencies(depsToOptimize, {
|
|
596
604
|
projectRoot,
|
|
@@ -640,7 +648,7 @@ function createVirtualDependencies(depsToOptimize, {
|
|
|
640
648
|
continue;
|
|
641
649
|
}
|
|
642
650
|
const fileName = posix.basename(currentDepPath.name);
|
|
643
|
-
const entryName = prepareEntryFileName(
|
|
651
|
+
const entryName = prepareEntryFileName(chunkG7R456H2_cjs.getCompiledDepCachePath(rootPath, fileName), rootDir);
|
|
644
652
|
fileNameToDependencyMap.set(entryName, dep);
|
|
645
653
|
optimizedDependencyEntries.set(dep, {
|
|
646
654
|
...currentDepPath,
|
|
@@ -655,13 +663,14 @@ async function getInputPlugins2(virtualDependencies, {
|
|
|
655
663
|
workspaceMap,
|
|
656
664
|
bundlerOptions,
|
|
657
665
|
rootDir,
|
|
658
|
-
externals
|
|
666
|
+
externals,
|
|
667
|
+
platform
|
|
659
668
|
}) {
|
|
660
669
|
const transpilePackagesMap = /* @__PURE__ */ new Map();
|
|
661
670
|
for (const pkg2 of transpilePackages) {
|
|
662
|
-
const dir = await
|
|
671
|
+
const dir = await chunkYIUDHDPS_cjs.getPackageRootPath(pkg2);
|
|
663
672
|
if (dir) {
|
|
664
|
-
transpilePackagesMap.set(pkg2,
|
|
673
|
+
transpilePackagesMap.set(pkg2, chunkG7R456H2_cjs.slash(dir));
|
|
665
674
|
} else {
|
|
666
675
|
transpilePackagesMap.set(pkg2, workspaceMap.get(pkg2)?.location ?? pkg2);
|
|
667
676
|
}
|
|
@@ -676,9 +685,9 @@ async function getInputPlugins2(virtualDependencies, {
|
|
|
676
685
|
{}
|
|
677
686
|
)
|
|
678
687
|
),
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
transpilePackagesMap.size ?
|
|
688
|
+
chunkYIUDHDPS_cjs.tsConfigPaths(),
|
|
689
|
+
chunkYIUDHDPS_cjs.subpathExternalsResolver(externals),
|
|
690
|
+
transpilePackagesMap.size ? chunkYIUDHDPS_cjs.esbuild({
|
|
682
691
|
format: "esm",
|
|
683
692
|
include: [
|
|
684
693
|
// Match files from transpilePackages by their actual directory paths
|
|
@@ -733,11 +742,8 @@ async function getInputPlugins2(virtualDependencies, {
|
|
|
733
742
|
transformMixedEsModules: true,
|
|
734
743
|
ignoreTryCatch: false
|
|
735
744
|
}),
|
|
736
|
-
bundlerOptions.noBundling ? null : nodeResolve__default.default(
|
|
737
|
-
|
|
738
|
-
exportConditions: ["node"]
|
|
739
|
-
}),
|
|
740
|
-
bundlerOptions.noBundling ? chunkE4SQOERA_cjs.esmShim() : null,
|
|
745
|
+
bundlerOptions.noBundling ? null : nodeResolve__default.default(chunkG7R456H2_cjs.getNodeResolveOptions(platform)),
|
|
746
|
+
bundlerOptions.noBundling ? chunkYIUDHDPS_cjs.esmShim() : null,
|
|
741
747
|
// hono is imported from deployer, so we need to resolve from here instead of the project root
|
|
742
748
|
aliasHono(),
|
|
743
749
|
json__default.default(),
|
|
@@ -785,7 +791,8 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
785
791
|
workspaceMap,
|
|
786
792
|
rootDir,
|
|
787
793
|
outputDir,
|
|
788
|
-
bundlerOptions
|
|
794
|
+
bundlerOptions,
|
|
795
|
+
platform
|
|
789
796
|
}) {
|
|
790
797
|
if (virtualDependencies.size === 0) {
|
|
791
798
|
return [];
|
|
@@ -798,7 +805,8 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
798
805
|
noBundling
|
|
799
806
|
},
|
|
800
807
|
rootDir,
|
|
801
|
-
externals
|
|
808
|
+
externals,
|
|
809
|
+
platform
|
|
802
810
|
});
|
|
803
811
|
const bundler = await rollup.rollup({
|
|
804
812
|
logLevel: process.env.MASTRA_BUNDLER_DEBUG === "true" ? "debug" : "silent",
|
|
@@ -828,9 +836,9 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
828
836
|
if (noBundling) {
|
|
829
837
|
const importedFromPackages = /* @__PURE__ */ new Set();
|
|
830
838
|
for (const moduleId of chunkInfo.moduleIds) {
|
|
831
|
-
const normalized =
|
|
839
|
+
const normalized = chunkG7R456H2_cjs.slash(moduleId);
|
|
832
840
|
for (const [pkgName, pkgInfo] of workspaceMap.entries()) {
|
|
833
|
-
const location =
|
|
841
|
+
const location = chunkG7R456H2_cjs.slash(pkgInfo.location);
|
|
834
842
|
if (normalized.startsWith(location)) {
|
|
835
843
|
importedFromPackages.add(pkgName);
|
|
836
844
|
break;
|
|
@@ -852,7 +860,7 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
852
860
|
if (importedFromPackages.size === 1) {
|
|
853
861
|
const [pkgName] = importedFromPackages;
|
|
854
862
|
const workspaceLocation = workspaceMap.get(pkgName).location;
|
|
855
|
-
return prepareEntryFileName(
|
|
863
|
+
return prepareEntryFileName(chunkG7R456H2_cjs.getCompiledDepCachePath(workspaceLocation, "[name].mjs"), rootDir);
|
|
856
864
|
}
|
|
857
865
|
}
|
|
858
866
|
return `${outputDirRelative}/[name].mjs`;
|
|
@@ -866,7 +874,7 @@ async function buildExternalDependencies(virtualDependencies, {
|
|
|
866
874
|
function findExternalImporter(module, external, allOutputs) {
|
|
867
875
|
const capturedFiles = /* @__PURE__ */ new Set();
|
|
868
876
|
for (const id of module.imports) {
|
|
869
|
-
if (
|
|
877
|
+
if (chunkG7R456H2_cjs.isDependencyPartOfPackage(id, external)) {
|
|
870
878
|
return module;
|
|
871
879
|
} else {
|
|
872
880
|
if (id.endsWith(".mjs")) {
|
|
@@ -886,7 +894,13 @@ function findExternalImporter(module, external, allOutputs) {
|
|
|
886
894
|
return null;
|
|
887
895
|
}
|
|
888
896
|
async function bundleExternals(depsToOptimize, outputDir, options) {
|
|
889
|
-
const {
|
|
897
|
+
const {
|
|
898
|
+
workspaceRoot = null,
|
|
899
|
+
workspaceMap = /* @__PURE__ */ new Map(),
|
|
900
|
+
projectRoot = outputDir,
|
|
901
|
+
bundlerOptions = {},
|
|
902
|
+
platform = "node"
|
|
903
|
+
} = options;
|
|
890
904
|
const { externals: customExternals = [], transpilePackages = [], isDev = false } = bundlerOptions || {};
|
|
891
905
|
let externalsPreset = false;
|
|
892
906
|
if (customExternals === true) {
|
|
@@ -923,7 +937,8 @@ async function bundleExternals(depsToOptimize, outputDir, options) {
|
|
|
923
937
|
bundlerOptions: {
|
|
924
938
|
isDev,
|
|
925
939
|
externalsPreset
|
|
926
|
-
}
|
|
940
|
+
},
|
|
941
|
+
platform
|
|
927
942
|
});
|
|
928
943
|
const moduleResolveMap2 = /* @__PURE__ */ new Map();
|
|
929
944
|
const filteredChunks = output.filter((o) => o.type === "chunk");
|
|
@@ -1104,13 +1119,15 @@ async function validateFile(root, file, {
|
|
|
1104
1119
|
binaryMapData,
|
|
1105
1120
|
moduleResolveMapLocation,
|
|
1106
1121
|
logger,
|
|
1107
|
-
workspaceMap
|
|
1122
|
+
workspaceMap,
|
|
1123
|
+
stubbedExternals
|
|
1108
1124
|
}) {
|
|
1109
1125
|
try {
|
|
1110
1126
|
if (!file.isDynamicEntry && file.isEntry) {
|
|
1111
1127
|
await validate(path.join(root, file.fileName), {
|
|
1112
1128
|
moduleResolveMapLocation,
|
|
1113
|
-
injectESMShim: false
|
|
1129
|
+
injectESMShim: false,
|
|
1130
|
+
stubbedExternals
|
|
1114
1131
|
});
|
|
1115
1132
|
}
|
|
1116
1133
|
} catch (err) {
|
|
@@ -1119,7 +1136,8 @@ async function validateFile(root, file, {
|
|
|
1119
1136
|
try {
|
|
1120
1137
|
await validate(path.join(root, file.fileName), {
|
|
1121
1138
|
moduleResolveMapLocation,
|
|
1122
|
-
injectESMShim: true
|
|
1139
|
+
injectESMShim: true,
|
|
1140
|
+
stubbedExternals
|
|
1123
1141
|
});
|
|
1124
1142
|
errorToHandle = null;
|
|
1125
1143
|
} catch (err2) {
|
|
@@ -1147,7 +1165,7 @@ async function validateOutput({
|
|
|
1147
1165
|
};
|
|
1148
1166
|
for (const deps of Object.values(usedExternals)) {
|
|
1149
1167
|
for (const dep of Object.keys(deps)) {
|
|
1150
|
-
const pkgName =
|
|
1168
|
+
const pkgName = chunkG7R456H2_cjs.getPackageName(dep);
|
|
1151
1169
|
if (pkgName) {
|
|
1152
1170
|
const versionInfo = depsVersionInfo.get(dep) || depsVersionInfo.get(pkgName) || {};
|
|
1153
1171
|
result.externalDependencies.set(pkgName, versionInfo);
|
|
@@ -1171,7 +1189,8 @@ async function validateOutput({
|
|
|
1171
1189
|
binaryMapData,
|
|
1172
1190
|
moduleResolveMapLocation: path.join(outputDir, "module-resolve-map.json"),
|
|
1173
1191
|
logger,
|
|
1174
|
-
workspaceMap
|
|
1192
|
+
workspaceMap,
|
|
1193
|
+
stubbedExternals: [...GLOBAL_EXTERNALS, ...DEPS_TO_IGNORE]
|
|
1175
1194
|
});
|
|
1176
1195
|
}
|
|
1177
1196
|
return result;
|
|
@@ -1179,6 +1198,7 @@ async function validateOutput({
|
|
|
1179
1198
|
async function analyzeBundle(entries, mastraEntry, {
|
|
1180
1199
|
outputDir,
|
|
1181
1200
|
projectRoot,
|
|
1201
|
+
platform,
|
|
1182
1202
|
isDev = false,
|
|
1183
1203
|
bundlerOptions
|
|
1184
1204
|
}, logger) {
|
|
@@ -1221,9 +1241,9 @@ If you think your configuration is valid, please open an issue.`);
|
|
|
1221
1241
|
});
|
|
1222
1242
|
await promises.writeFile(path.join(outputDir, `entry-${index++}.mjs`), analyzeResult.output.code);
|
|
1223
1243
|
for (const [dep, metadata] of analyzeResult.dependencies.entries()) {
|
|
1224
|
-
const isPartOfExternals = allExternals.some((external) =>
|
|
1244
|
+
const isPartOfExternals = allExternals.some((external) => chunkG7R456H2_cjs.isDependencyPartOfPackage(dep, external));
|
|
1225
1245
|
if (isPartOfExternals || externalsPreset && !metadata.isWorkspace) {
|
|
1226
|
-
const pkgName =
|
|
1246
|
+
const pkgName = chunkG7R456H2_cjs.getPackageName(dep);
|
|
1227
1247
|
if (pkgName && !allUsedExternals.has(pkgName)) {
|
|
1228
1248
|
allUsedExternals.set(pkgName, {
|
|
1229
1249
|
version: metadata.version
|
|
@@ -1260,14 +1280,15 @@ If you think your configuration is valid, please open an issue.`);
|
|
|
1260
1280
|
},
|
|
1261
1281
|
projectRoot,
|
|
1262
1282
|
workspaceRoot,
|
|
1263
|
-
workspaceMap
|
|
1283
|
+
workspaceMap,
|
|
1284
|
+
platform
|
|
1264
1285
|
});
|
|
1265
1286
|
const relativeWorkspaceFolderPaths = Array.from(workspaceMap.values()).map(
|
|
1266
|
-
(pkgInfo) =>
|
|
1287
|
+
(pkgInfo) => chunkG7R456H2_cjs.slash(path.relative(workspaceRoot || projectRoot, pkgInfo.location))
|
|
1267
1288
|
);
|
|
1268
1289
|
const depsVersionInfo = /* @__PURE__ */ new Map();
|
|
1269
1290
|
for (const [dep, metadata] of depsToOptimize.entries()) {
|
|
1270
|
-
const pkgName =
|
|
1291
|
+
const pkgName = chunkG7R456H2_cjs.getPackageName(dep);
|
|
1271
1292
|
if (pkgName && metadata.version) {
|
|
1272
1293
|
depsVersionInfo.set(pkgName, {
|
|
1273
1294
|
version: metadata.version
|
|
@@ -1284,7 +1305,7 @@ If you think your configuration is valid, please open an issue.`);
|
|
|
1284
1305
|
continue;
|
|
1285
1306
|
}
|
|
1286
1307
|
for (const i of o.imports) {
|
|
1287
|
-
if (
|
|
1308
|
+
if (chunkG7R456H2_cjs.isBuiltinModule(i)) {
|
|
1288
1309
|
continue;
|
|
1289
1310
|
}
|
|
1290
1311
|
if (i.startsWith(".") || i.startsWith("/")) {
|
|
@@ -1293,7 +1314,7 @@ If you think your configuration is valid, please open an issue.`);
|
|
|
1293
1314
|
if (relativeWorkspaceFolderPaths.some((workspacePath) => i.startsWith(workspacePath))) {
|
|
1294
1315
|
continue;
|
|
1295
1316
|
}
|
|
1296
|
-
const pkgName =
|
|
1317
|
+
const pkgName = chunkG7R456H2_cjs.getPackageName(i);
|
|
1297
1318
|
if (pkgName && !allUsedExternals.has(pkgName)) {
|
|
1298
1319
|
const versionInfo = depsVersionInfo.get(i) || depsVersionInfo.get(pkgName) || {};
|
|
1299
1320
|
allUsedExternals.set(pkgName, versionInfo);
|
|
@@ -1328,5 +1349,5 @@ If you think your configuration is valid, please open an issue.`);
|
|
|
1328
1349
|
exports.aliasHono = aliasHono;
|
|
1329
1350
|
exports.analyzeBundle = analyzeBundle;
|
|
1330
1351
|
exports.getWorkspaceInformation = getWorkspaceInformation;
|
|
1331
|
-
//# sourceMappingURL=chunk-
|
|
1332
|
-
//# sourceMappingURL=chunk-
|
|
1352
|
+
//# sourceMappingURL=chunk-73SEUI3W.cjs.map
|
|
1353
|
+
//# sourceMappingURL=chunk-73SEUI3W.cjs.map
|