@bino0216/nitro-cloudflare-dev 0.2.2 → 0.2.4

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/dist/index.d.mts CHANGED
@@ -37,5 +37,4 @@ declare module "nitropack" {
37
37
  }
38
38
  declare function nitroCloudflareDev(arg1: unknown, arg2: unknown): void;
39
39
 
40
- export { nitroCloudflareDev as default };
41
- export type { CloudflareDevOptions, RemoteBinding };
40
+ export { type CloudflareDevOptions, type RemoteBinding, nitroCloudflareDev as default };
package/dist/index.d.ts CHANGED
@@ -37,5 +37,4 @@ declare module "nitropack" {
37
37
  }
38
38
  declare function nitroCloudflareDev(arg1: unknown, arg2: unknown): void;
39
39
 
40
- export { nitroCloudflareDev as default };
41
- export type { CloudflareDevOptions, RemoteBinding };
40
+ export { type CloudflareDevOptions, type RemoteBinding, nitroCloudflareDev as default };
@@ -48,23 +48,29 @@ async function _getPlatformProxy() {
48
48
  }
49
49
  const proxy = await getPlatformProxy(proxyOptions);
50
50
  if (remoteBindings.length > 0 && remoteCredentials.accountId && remoteCredentials.apiToken) {
51
- const { getBindings } = await import("openwrangler");
52
- const openBindings = getBindings({
51
+ const { createR2Binding, createKVBinding, createD1Binding } = await import("openwrangler");
52
+ const bindingsConfig = {
53
53
  accountId: remoteCredentials.accountId,
54
54
  apiToken: remoteCredentials.apiToken
55
- });
55
+ };
56
56
  for (const binding of remoteBindings) {
57
57
  switch (binding.type) {
58
58
  case "r2": {
59
- proxy.env[binding.name] = openBindings.r2;
59
+ if (binding.bucketName) {
60
+ proxy.env[binding.name] = createR2Binding(bindingsConfig, binding.bucketName);
61
+ }
60
62
  break;
61
63
  }
62
64
  case "kv": {
63
- proxy.env[binding.name] = openBindings.kv;
65
+ if (binding.namespaceId) {
66
+ proxy.env[binding.name] = createKVBinding(bindingsConfig, binding.namespaceId);
67
+ }
64
68
  break;
65
69
  }
66
70
  case "d1": {
67
- proxy.env[binding.name] = openBindings.d1;
71
+ if (binding.databaseId) {
72
+ proxy.env[binding.name] = createD1Binding(bindingsConfig, binding.databaseId);
73
+ }
68
74
  break;
69
75
  }
70
76
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bino0216/nitro-cloudflare-dev",
3
3
  "private": false,
4
- "version": "0.2.2",
4
+ "version": "0.2.4",
5
5
  "description": "POC module to enable access to the Cloudflare runtime bindings in development server of Nitro and Nuxt",
6
6
  "repository": "pi0/nitro-cloudflare-dev",
7
7
  "license": "MIT",
@@ -28,8 +28,8 @@
28
28
  "dependencies": {
29
29
  "consola": "^3.4.0",
30
30
  "mlly": "^1.7.4",
31
- "pkg-types": "^2.1.0",
32
- "openwrangler": "0.0.1"
31
+ "openwrangler": "^0.0.1",
32
+ "pkg-types": "^2.1.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@cloudflare/workers-types": "^4.20250303.0",