@bino0216/nitro-cloudflare-dev 0.2.7 → 0.2.11

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
@@ -25,6 +25,7 @@ interface CloudflareDevOptions {
25
25
  environment?: string;
26
26
  persistDir?: string;
27
27
  silent?: boolean;
28
+ remote?: boolean;
28
29
  remoteCredentials?: {
29
30
  accountId?: string;
30
31
  apiToken?: string;
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ interface CloudflareDevOptions {
25
25
  environment?: string;
26
26
  persistDir?: string;
27
27
  silent?: boolean;
28
+ remote?: boolean;
28
29
  remoteCredentials?: {
29
30
  accountId?: string;
30
31
  apiToken?: string;
package/dist/index.mjs CHANGED
@@ -55,7 +55,7 @@ async function parseWranglerConfig(configPath) {
55
55
  if (configPath.endsWith(".toml")) {
56
56
  const r2Bindings = parseTomlBindings(content, "r2_buckets");
57
57
  for (const item of r2Bindings) {
58
- if (item.remote === true && typeof item.binding === "string") {
58
+ if (typeof item.binding === "string") {
59
59
  remoteBindings.push({
60
60
  type: "r2",
61
61
  name: item.binding,
@@ -65,7 +65,7 @@ async function parseWranglerConfig(configPath) {
65
65
  }
66
66
  const kvBindings = parseTomlBindings(content, "kv_namespaces");
67
67
  for (const item of kvBindings) {
68
- if (item.remote === true && typeof item.binding === "string") {
68
+ if (typeof item.binding === "string") {
69
69
  remoteBindings.push({
70
70
  type: "kv",
71
71
  name: item.binding,
@@ -75,7 +75,7 @@ async function parseWranglerConfig(configPath) {
75
75
  }
76
76
  const d1Bindings = parseTomlBindings(content, "d1_databases");
77
77
  for (const item of d1Bindings) {
78
- if (item.remote === true && typeof item.binding === "string") {
78
+ if (typeof item.binding === "string") {
79
79
  remoteBindings.push({
80
80
  type: "d1",
81
81
  name: item.binding,
@@ -88,7 +88,7 @@ async function parseWranglerConfig(configPath) {
88
88
  const config = JSON.parse(jsonContent);
89
89
  if (config.r2_buckets) {
90
90
  for (const bucket of config.r2_buckets) {
91
- if (bucket.remote === true) {
91
+ if (bucket.binding) {
92
92
  remoteBindings.push({
93
93
  type: "r2",
94
94
  name: bucket.binding,
@@ -99,7 +99,7 @@ async function parseWranglerConfig(configPath) {
99
99
  }
100
100
  if (config.kv_namespaces) {
101
101
  for (const kv of config.kv_namespaces) {
102
- if (kv.remote === true) {
102
+ if (kv.binding) {
103
103
  remoteBindings.push({
104
104
  type: "kv",
105
105
  name: kv.binding,
@@ -110,7 +110,7 @@ async function parseWranglerConfig(configPath) {
110
110
  }
111
111
  if (config.d1_databases) {
112
112
  for (const d1 of config.d1_databases) {
113
- if (d1.remote === true) {
113
+ if (d1.binding) {
114
114
  remoteBindings.push({
115
115
  type: "d1",
116
116
  name: d1.binding,
@@ -175,6 +175,7 @@ Remote bindings: ${remoteBindings.map((b) => `${b.name} (${b.type})`).join(", ")
175
175
  configPath,
176
176
  persistDir,
177
177
  environment: nitro.options.cloudflareDev?.environment,
178
+ remote: nitro.options.cloudflareDev?.remote ?? false,
178
179
  remoteBindings,
179
180
  remoteCredentials: nitro.options.cloudflareDev?.remoteCredentials
180
181
  };
@@ -32,7 +32,7 @@ export default (function(nitroApp) {
32
32
  });
33
33
  async function _getPlatformProxy() {
34
34
  const runtimeConfig = useRuntimeConfig();
35
- const { remoteBindings, remoteCredentials } = runtimeConfig.wrangler;
35
+ const { remote, remoteBindings, remoteCredentials } = runtimeConfig.wrangler;
36
36
  const _pkg = "wrangler";
37
37
  const { getPlatformProxy } = await import(_pkg).catch(() => {
38
38
  throw new Error(
@@ -51,7 +51,7 @@ async function _getPlatformProxy() {
51
51
  if (!accountId || !apiToken) {
52
52
  console.warn("config remoteCredentials is empty. then remote is not working");
53
53
  }
54
- if (remoteBindings.length > 0 && accountId && apiToken) {
54
+ if (remote && remoteBindings.length > 0 && accountId && apiToken) {
55
55
  const config = { accountId, apiToken };
56
56
  const { createR2Binding, createKVBinding, createD1Binding } = await import("openwrangler");
57
57
  for (const binding of remoteBindings) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bino0216/nitro-cloudflare-dev",
3
3
  "type": "module",
4
- "version": "0.2.7",
4
+ "version": "0.2.11",
5
5
  "private": false,
6
6
  "description": "POC module to enable access to the Cloudflare runtime bindings in development server of Nitro and Nuxt",
7
7
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "consola": "^3.4.0",
27
27
  "mlly": "^1.7.4",
28
28
  "pkg-types": "^2.1.0",
29
- "openwrangler": "0.0.5"
29
+ "openwrangler": "0.0.10"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@cloudflare/workers-types": "^4.20250303.0",