@mastra/deployer-cloudflare 0.1.14-alpha.0 → 0.1.14-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.
@@ -1,4 +1,6 @@
1
+ import type { analyzeBundle } from '@mastra/deployer/analyze';
1
2
  import { Deployer } from '@mastra/deployer';
3
+ import { InputOptions } from 'rollup';
2
4
 
3
5
  declare interface CFRoute {
4
6
  pattern: string;
@@ -27,6 +29,7 @@ export declare class CloudflareDeployer extends Deployer {
27
29
  writeFiles(outputDirectory: string): Promise<void>;
28
30
  private getEntry;
29
31
  prepare(outputDirectory: string): Promise<void>;
32
+ getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>): Promise<InputOptions>;
30
33
  bundle(entryFile: string, outputDirectory: string): Promise<void>;
31
34
  deploy(outputDirectory: string): Promise<void>;
32
35
  tagWorker({ workerName, namespace, tags, scope, }: {
@@ -1,4 +1,6 @@
1
+ import type { analyzeBundle } from '@mastra/deployer/analyze';
1
2
  import { Deployer } from '@mastra/deployer';
3
+ import { InputOptions } from 'rollup';
2
4
 
3
5
  declare interface CFRoute {
4
6
  pattern: string;
@@ -27,6 +29,7 @@ export declare class CloudflareDeployer extends Deployer {
27
29
  writeFiles(outputDirectory: string): Promise<void>;
28
30
  private getEntry;
29
31
  prepare(outputDirectory: string): Promise<void>;
32
+ getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>): Promise<InputOptions>;
30
33
  bundle(entryFile: string, outputDirectory: string): Promise<void>;
31
34
  deploy(outputDirectory: string): Promise<void>;
32
35
  tagWorker({ workerName, namespace, tags, scope, }: {
package/dist/index.cjs CHANGED
@@ -3,8 +3,13 @@
3
3
  var promises = require('fs/promises');
4
4
  var path = require('path');
5
5
  var deployer = require('@mastra/deployer');
6
+ var virtual = require('@rollup/plugin-virtual');
6
7
  var cloudflare = require('cloudflare');
7
8
 
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var virtual__default = /*#__PURE__*/_interopDefault(virtual);
12
+
8
13
  // src/index.ts
9
14
  var CloudflareDeployer = class extends deployer.Deployer {
10
15
  cloudflare;
@@ -54,6 +59,7 @@ var CloudflareDeployer = class extends deployer.Deployer {
54
59
  }
55
60
  getEntry() {
56
61
  return `
62
+ import '#polyfills';
57
63
  import { mastra } from '#mastra';
58
64
  import { createHonoServer } from '#server';
59
65
 
@@ -74,6 +80,21 @@ export default {
74
80
  await super.prepare(outputDirectory);
75
81
  await this.writeFiles(outputDirectory);
76
82
  }
83
+ async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo) {
84
+ const inputOptions = await super.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo);
85
+ if (Array.isArray(inputOptions.plugins)) {
86
+ inputOptions.plugins = [
87
+ virtual__default.default({
88
+ "#polyfills": `
89
+ process.versions = process.versions || {};
90
+ process.versions.node = '${process.versions.node}';
91
+ `
92
+ }),
93
+ ...inputOptions.plugins
94
+ ];
95
+ }
96
+ return inputOptions;
97
+ }
77
98
  async bundle(entryFile, outputDirectory) {
78
99
  return this._bundle(this.getEntry(), entryFile, outputDirectory);
79
100
  }
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { writeFile } from 'fs/promises';
2
2
  import { join } from 'path';
3
3
  import { Deployer, createChildProcessLogger } from '@mastra/deployer';
4
+ import virtual from '@rollup/plugin-virtual';
4
5
  import { Cloudflare } from 'cloudflare';
5
6
 
6
7
  // src/index.ts
@@ -52,6 +53,7 @@ var CloudflareDeployer = class extends Deployer {
52
53
  }
53
54
  getEntry() {
54
55
  return `
56
+ import '#polyfills';
55
57
  import { mastra } from '#mastra';
56
58
  import { createHonoServer } from '#server';
57
59
 
@@ -72,6 +74,21 @@ export default {
72
74
  await super.prepare(outputDirectory);
73
75
  await this.writeFiles(outputDirectory);
74
76
  }
77
+ async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo) {
78
+ const inputOptions = await super.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo);
79
+ if (Array.isArray(inputOptions.plugins)) {
80
+ inputOptions.plugins = [
81
+ virtual({
82
+ "#polyfills": `
83
+ process.versions = process.versions || {};
84
+ process.versions.node = '${process.versions.node}';
85
+ `
86
+ }),
87
+ ...inputOptions.plugins
88
+ ];
89
+ }
90
+ return inputOptions;
91
+ }
75
92
  async bundle(entryFile, outputDirectory) {
76
93
  return this._bundle(this.getEntry(), entryFile, outputDirectory);
77
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-cloudflare",
3
- "version": "0.1.14-alpha.0",
3
+ "version": "0.1.14-alpha.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -41,18 +41,18 @@
41
41
  "execa": "^9.5.2",
42
42
  "rollup-plugin-polyfill-node": "^0.13.0",
43
43
  "rollup-plugin-shim": "^1.0.0",
44
- "wrangler": "^3.112.0",
44
+ "wrangler": "^4.4.0",
45
45
  "zod": "^3.24.2",
46
- "@mastra/core": "^0.6.5-alpha.0",
47
- "@mastra/deployer": "^0.2.5-alpha.0"
46
+ "@mastra/core": "^0.7.0-alpha.2",
47
+ "@mastra/deployer": "^0.2.5-alpha.2"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@microsoft/api-extractor": "^7.52.1",
51
- "@types/node": "^22.13.10",
52
- "eslint": "^9.22.0",
51
+ "@types/node": "^20.17.27",
52
+ "eslint": "^9.23.0",
53
53
  "tsup": "^8.4.0",
54
54
  "typescript": "^5.8.2",
55
- "vitest": "^3.0.8",
55
+ "vitest": "^3.0.9",
56
56
  "@internal/lint": "0.0.1"
57
57
  },
58
58
  "scripts": {