devflare 1.0.0-next.5 → 1.0.0-next.6

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,3 +1,10 @@
1
+ import {
2
+ ContextUnavailableError,
3
+ getContext,
4
+ getContextOrNull,
5
+ hasContext,
6
+ runWithContext
7
+ } from "../index-npc1c8jx.js";
1
8
  import {
2
9
  durableObject,
3
10
  getDurableObjectOptions
@@ -62,6 +69,63 @@ function createContextProxy(getter, name) {
62
69
  }
63
70
  });
64
71
  }
72
+
73
+ // src/runtime/exports.ts
74
+ function createReadonlyProxy(getter, name) {
75
+ return new Proxy({}, {
76
+ get(_target, prop) {
77
+ const ctx = getter();
78
+ if (ctx === undefined) {
79
+ throw new ContextAccessError(name, String(prop));
80
+ }
81
+ return ctx[prop];
82
+ },
83
+ set(_target, prop) {
84
+ throw new TypeError(`Cannot assign to '${String(prop)}' on '${name}' because it is read-only.
85
+ ` + `Use 'locals' for mutable request-scoped data.`);
86
+ },
87
+ deleteProperty(_target, prop) {
88
+ throw new TypeError(`Cannot delete property '${String(prop)}' from '${name}' because it is read-only.`);
89
+ },
90
+ has(_target, prop) {
91
+ const ctx = getter();
92
+ if (ctx === undefined) {
93
+ return false;
94
+ }
95
+ return prop in ctx;
96
+ },
97
+ ownKeys(_target) {
98
+ const ctx = getter();
99
+ if (ctx === undefined) {
100
+ return [];
101
+ }
102
+ return Reflect.ownKeys(ctx);
103
+ },
104
+ getOwnPropertyDescriptor(_target, prop) {
105
+ const ctx = getter();
106
+ if (ctx === undefined) {
107
+ return;
108
+ }
109
+ const descriptor = Reflect.getOwnPropertyDescriptor(ctx, prop);
110
+ if (descriptor) {
111
+ return { ...descriptor, writable: false };
112
+ }
113
+ return;
114
+ }
115
+ });
116
+ }
117
+ var env = createReadonlyProxy(() => getContextOrNull()?.env, "env");
118
+ var ctx = createReadonlyProxy(() => getContextOrNull()?.ctx, "ctx");
119
+ var event = createReadonlyProxy(() => {
120
+ const context = getContextOrNull();
121
+ if (!context)
122
+ return;
123
+ return {
124
+ request: context.request,
125
+ type: context.type
126
+ };
127
+ }, "event");
128
+ var locals = createContextProxy(() => getContextOrNull()?.locals, "locals");
65
129
  // src/runtime/middleware.ts
66
130
  function sequence(...middlewares) {
67
131
  return (handler) => {
@@ -102,10 +166,19 @@ function pipe(middlewares, handlers) {
102
166
  }
103
167
  export {
104
168
  sequence,
169
+ runWithContext,
105
170
  resolve,
106
171
  pipe,
172
+ locals,
173
+ hasContext,
107
174
  getDurableObjectOptions,
175
+ getContextOrNull,
176
+ getContext,
177
+ event,
178
+ env,
108
179
  durableObject,
180
+ ctx,
109
181
  createContextProxy,
182
+ ContextUnavailableError,
110
183
  ContextAccessError
111
184
  };
@@ -1,9 +1,11 @@
1
- import"../index-m2q41jwa.js";
1
+ import"../index-n3np2d6t.js";
2
+ import"../index-p7g30wd2.js";
3
+ import"../index-k7r18na8.js";
2
4
  import {
3
5
  createEnvProxy,
4
6
  getClient
5
- } from "../index-pf5s73n9.js";
6
- import"../index-07q6yxyc.js";
7
+ } from "../index-ccrh4w3t.js";
8
+ import"../index-v8vvsn9x.js";
7
9
  import"../index-67qcae0f.js";
8
10
  import {
9
11
  loadConfig
@@ -12,7 +12,6 @@ import {
12
12
  createMultiWorkerContext,
13
13
  createTestContext,
14
14
  email,
15
- env,
16
15
  getBridgeTestContext,
17
16
  hasCrossWorkerDOs,
18
17
  hasServiceBindings,
@@ -27,14 +26,20 @@ import {
27
26
  testEnv,
28
27
  withTestContext,
29
28
  worker
30
- } from "../index-ep3445yc.js";
29
+ } from "../index-rprrn24p.js";
30
+ import"../index-d8bdkx2h.js";
31
31
  import"../index-z14anrqp.js";
32
32
  import"../index-tk6ej9dj.js";
33
- import"../index-d8bdkx2h.js";
33
+ import {
34
+ env
35
+ } from "../index-9ats0s83.js";
36
+ import"../index-npc1c8jx.js";
34
37
  import"../index-rbht7m9r.js";
35
38
  import"../index-gz1gndna.js";
36
- import"../index-pf5s73n9.js";
37
- import"../index-07q6yxyc.js";
39
+ import"../index-p7g30wd2.js";
40
+ import"../index-k7r18na8.js";
41
+ import"../index-ccrh4w3t.js";
42
+ import"../index-v8vvsn9x.js";
38
43
  import"../index-67qcae0f.js";
39
44
  import"../index-hcex3rgh.js";
40
45
  import"../index-tfyxa77h.js";
@@ -1,3 +1,6 @@
1
+ import {
2
+ getDependencies
3
+ } from "./index-1xpj0m4r.js";
1
4
  import {
2
5
  discoverEntrypointsAsync,
3
6
  resolvePackageSpecifier
@@ -10,15 +13,13 @@ import {
10
13
  import {
11
14
  findDurableObjectClasses
12
15
  } from "./index-gz1gndna.js";
13
- import"./index-07q6yxyc.js";
16
+ import"./index-k7r18na8.js";
17
+ import"./index-v8vvsn9x.js";
14
18
  import"./index-67qcae0f.js";
15
19
  import {
16
20
  loadConfig,
17
21
  normalizeDOBinding
18
22
  } from "./index-hcex3rgh.js";
19
- import {
20
- getDependencies
21
- } from "./index-1xpj0m4r.js";
22
23
  import {
23
24
  __require
24
25
  } from "./index-37x76zdn.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devflare",
3
- "version": "1.0.0-next.5",
3
+ "version": "1.0.0-next.6",
4
4
  "description": "Devflare is a developer-first toolkit for Cloudflare Workers that sits on top of Miniflare and Wrangler-compatible config",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -8,6 +8,7 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
+ "browser": "./dist/browser.js",
11
12
  "import": "./dist/index.js",
12
13
  "default": "./dist/index.js"
13
14
  },
@@ -53,7 +54,7 @@
53
54
  ],
54
55
  "scripts": {
55
56
  "prebuild": "node -e \"require('fs').rmSync('./dist', { recursive: true, force: true })\"",
56
- "build": "bun build ./src/index.ts ./src/runtime/index.ts ./src/test/index.ts ./src/vite/index.ts ./src/sveltekit/index.ts ./src/cloudflare/index.ts ./src/decorators/index.ts --outdir ./dist --splitting --target node --packages=external && tsgo --declaration --emitDeclarationOnly --noEmit false --outDir ./dist",
57
+ "build": "bun build ./src/index.ts ./src/browser.ts ./src/runtime/index.ts ./src/test/index.ts ./src/vite/index.ts ./src/sveltekit/index.ts ./src/cloudflare/index.ts ./src/decorators/index.ts --outdir ./dist --splitting --target node --packages=external && tsgo --declaration --emitDeclarationOnly --noEmit false --outDir ./dist",
57
58
  "dev": "bun --watch ./src/cli/index.ts",
58
59
  "test": "bun test",
59
60
  "test:watch": "bun test --watch",
@@ -1,3 +1,6 @@
1
+ import {
2
+ getDependencies
3
+ } from "./index-1xpj0m4r.js";
1
4
  import {
2
5
  compileConfig,
3
6
  writeWranglerConfig
@@ -5,9 +8,6 @@ import {
5
8
  import {
6
9
  loadConfig
7
10
  } from "./index-hcex3rgh.js";
8
- import {
9
- getDependencies
10
- } from "./index-1xpj0m4r.js";
11
11
  import"./index-37x76zdn.js";
12
12
 
13
13
  // src/cli/commands/build.ts
@@ -1,3 +1,6 @@
1
+ import {
2
+ getDependencies
3
+ } from "./index-1xpj0m4r.js";
1
4
  import {
2
5
  compileConfig,
3
6
  stringifyConfig,
@@ -6,9 +9,6 @@ import {
6
9
  import {
7
10
  loadConfig
8
11
  } from "./index-hcex3rgh.js";
9
- import {
10
- getDependencies
11
- } from "./index-1xpj0m4r.js";
12
12
  import"./index-37x76zdn.js";
13
13
 
14
14
  // src/cli/commands/deploy.ts
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  detectViteProject
3
3
  } from "./index-18hvb6gb.js";
4
+ import {
5
+ getDependencies
6
+ } from "./index-1xpj0m4r.js";
4
7
  import {
5
8
  loadConfig,
6
9
  resolveConfigPath
7
10
  } from "./index-hcex3rgh.js";
8
- import {
9
- getDependencies
10
- } from "./index-1xpj0m4r.js";
11
11
  import"./index-37x76zdn.js";
12
12
 
13
13
  // src/cli/commands/doctor.ts