@mastra/deployer-cloudflare 0.1.0-alpha.41 → 0.1.0-alpha.43

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @mastra/deployer-cloudflare
2
2
 
3
+ ## 0.1.0-alpha.43
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [b80ea8d]
8
+ - @mastra/deployer@0.1.0-alpha.34
9
+
10
+ ## 0.1.0-alpha.42
11
+
12
+ ### Minor Changes
13
+
14
+ - 4d4f6b6: Update deployer
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [4d4f6b6]
19
+ - @mastra/deployer@0.1.0-alpha.38
20
+ - @mastra/core@0.2.0-alpha.92
21
+
3
22
  ## 0.1.0-alpha.41
4
23
 
5
24
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -23,11 +23,10 @@ declare class CloudflareDeployer extends Deployer {
23
23
  apiEmail?: string;
24
24
  };
25
25
  });
26
- writePackageJson(outputDirectory: string): Promise<void>;
27
26
  writeFiles(outputDirectory: string): Promise<void>;
28
27
  private getEntry;
29
- bundle(mastraDir: string, outputDirectory: string): Promise<void>;
30
28
  prepare(outputDirectory: string): Promise<void>;
29
+ bundle(entryFile: string, outputDirectory: string): Promise<void>;
31
30
  deploy(outputDirectory: string): Promise<void>;
32
31
  tagWorker({ workerName, namespace, tags, scope, }: {
33
32
  scope: string;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Deployer, createChildProcessLogger } from '@mastra/deployer';
2
- import { getBundler } from '@mastra/deployer/build';
3
- import virtual from '@rollup/plugin-virtual';
2
+ import '@mastra/deployer/build';
3
+ import '@rollup/plugin-virtual';
4
4
  import { Cloudflare } from 'cloudflare';
5
5
  import { writeFileSync } from 'fs';
6
6
  import { join } from 'path';
@@ -31,33 +31,6 @@ var CloudflareDeployer = class extends Deployer {
31
31
  }
32
32
  this.cloudflare = new Cloudflare(auth);
33
33
  }
34
- async writePackageJson(outputDirectory) {
35
- this.logger.debug(`Writing package.json`);
36
- const pkgPath = join(outputDirectory, "package.json");
37
- writeFileSync(
38
- pkgPath,
39
- JSON.stringify(
40
- {
41
- name: "server",
42
- version: "1.0.0",
43
- description: "",
44
- type: "module",
45
- main: "index.mjs",
46
- scripts: {
47
- start: "node ./index.mjs",
48
- build: 'echo "Already built"'
49
- },
50
- author: "Mastra",
51
- license: "ISC",
52
- dependencies: {
53
- "@mastra/core": "latest"
54
- }
55
- },
56
- null,
57
- 2
58
- )
59
- );
60
- }
61
34
  async writeFiles(outputDirectory) {
62
35
  const env = await this.loadEnvVars();
63
36
  const envsAsObject = Object.assign({}, Object.fromEntries(env.entries()), this.env);
@@ -95,26 +68,13 @@ export default {
95
68
  }
96
69
  `;
97
70
  }
98
- async bundle(mastraDir, outputDirectory) {
99
- const bundler = await getBundler(
100
- {
101
- input: "#entry",
102
- plugins: [virtual({ "#entry": this.getEntry() })],
103
- external: [/^@opentelemetry\//],
104
- treeshake: "smallest"
105
- },
106
- { platform: "browser" }
107
- );
108
- await bundler.write({
109
- inlineDynamicImports: true,
110
- file: join(outputDirectory, "index.mjs"),
111
- format: "es"
112
- });
113
- }
114
71
  async prepare(outputDirectory) {
115
72
  await super.prepare(outputDirectory);
116
73
  await this.writeFiles(outputDirectory);
117
74
  }
75
+ async bundle(entryFile, outputDirectory) {
76
+ return this._bundle(this.getEntry(), entryFile, outputDirectory);
77
+ }
118
78
  async deploy(outputDirectory) {
119
79
  const cmd = this.workerNamespace ? `npm exec -- wrangler deploy --dispatch-namespace ${this.workerNamespace}` : "npm exec -- wrangler deploy";
120
80
  const cpLogger = createChildProcessLogger({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-cloudflare",
3
- "version": "0.1.0-alpha.41",
3
+ "version": "0.1.0-alpha.43",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,8 +29,8 @@
29
29
  "rollup-plugin-shim": "^1.0.0",
30
30
  "wrangler": "^3.103.2",
31
31
  "zod": "^3.24.1",
32
- "@mastra/deployer": "^0.1.0-alpha.37",
33
- "@mastra/core": "^0.2.0-alpha.91"
32
+ "@mastra/core": "^0.2.0-alpha.92",
33
+ "@mastra/deployer": "^0.1.0-alpha.34"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@babel/preset-env": "^7.26.0",
package/src/index.ts CHANGED
@@ -51,35 +51,6 @@ export class CloudflareDeployer extends Deployer {
51
51
  this.cloudflare = new Cloudflare(auth);
52
52
  }
53
53
 
54
- async writePackageJson(outputDirectory: string) {
55
- this.logger.debug(`Writing package.json`);
56
- const pkgPath = join(outputDirectory, 'package.json');
57
-
58
- writeFileSync(
59
- pkgPath,
60
- JSON.stringify(
61
- {
62
- name: 'server',
63
- version: '1.0.0',
64
- description: '',
65
- type: 'module',
66
- main: 'index.mjs',
67
- scripts: {
68
- start: 'node ./index.mjs',
69
- build: 'echo "Already built"',
70
- },
71
- author: 'Mastra',
72
- license: 'ISC',
73
- dependencies: {
74
- '@mastra/core': 'latest',
75
- },
76
- },
77
- null,
78
- 2,
79
- ),
80
- );
81
- }
82
-
83
54
  async writeFiles(outputDirectory: string): Promise<void> {
84
55
  const env = await this.loadEnvVars();
85
56
 
@@ -123,30 +94,15 @@ export default {
123
94
  }
124
95
  `;
125
96
  }
126
-
127
- async bundle(mastraDir: string, outputDirectory: string): Promise<void> {
128
- const bundler = await getBundler(
129
- {
130
- input: '#entry',
131
- plugins: [virtual({ '#entry': this.getEntry() })],
132
- external: [/^@opentelemetry\//],
133
- treeshake: 'smallest',
134
- },
135
- { platform: 'browser' },
136
- );
137
-
138
- await bundler.write({
139
- inlineDynamicImports: true,
140
- file: join(outputDirectory, 'index.mjs'),
141
- format: 'es',
142
- });
143
- }
144
-
145
97
  async prepare(outputDirectory: string): Promise<void> {
146
98
  await super.prepare(outputDirectory);
147
99
  await this.writeFiles(outputDirectory);
148
100
  }
149
101
 
102
+ async bundle(entryFile: string, outputDirectory: string): Promise<void> {
103
+ return this._bundle(this.getEntry(), entryFile, outputDirectory);
104
+ }
105
+
150
106
  async deploy(outputDirectory: string): Promise<void> {
151
107
  const cmd = this.workerNamespace
152
108
  ? `npm exec -- wrangler deploy --dispatch-namespace ${this.workerNamespace}`