wrangler 0.0.0-e928f94 → 0.0.0-e9a1820
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/package.json +13 -7
- package/src/__tests__/index.test.ts +254 -120
- package/src/__tests__/jest.setup.ts +18 -0
- package/src/__tests__/kv.test.ts +322 -0
- package/src/__tests__/mock-cfetch.ts +63 -0
- package/src/__tests__/mock-dialogs.ts +65 -0
- package/src/__tests__/run-in-tmp.ts +19 -0
- package/src/__tests__/run-wrangler.ts +32 -0
- package/src/api/form_data.ts +65 -75
- package/src/api/inspect.ts +0 -11
- package/src/api/worker.ts +33 -39
- package/src/cli.ts +6 -7
- package/src/config.ts +14 -5
- package/src/dev.tsx +264 -109
- package/src/dialogs.tsx +3 -11
- package/src/index.tsx +254 -210
- package/src/kv.tsx +65 -19
- package/src/pages.tsx +107 -99
- package/src/proxy.ts +103 -0
- package/src/publish.ts +37 -33
- package/src/user.tsx +9 -16
- package/wrangler-dist/cli.js +20754 -26926
- package/wrangler-dist/cli.js.map +3 -3
- package/src/__tests__/fixtures/init/.gitkeep +0 -0
- package/src/__tests__/mock-cfetch.js +0 -46
|
File without changes
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// This file mocks ../cfetch.ts
|
|
2
|
-
// so we can insert whatever responses we want from it
|
|
3
|
-
|
|
4
|
-
const { pathToRegexp } = require("path-to-regexp");
|
|
5
|
-
// TODO: add jsdoc style types here
|
|
6
|
-
|
|
7
|
-
// type MockHandler = (resource: string, init?: RequestInit) => any; // TODO: use a generic here
|
|
8
|
-
|
|
9
|
-
let mocks = [];
|
|
10
|
-
|
|
11
|
-
function mockCfetch(resource, init) {
|
|
12
|
-
for (const { regexp, handler } of mocks) {
|
|
13
|
-
if (regexp.test(resource)) {
|
|
14
|
-
return handler(resource, init); // should we have some kind of fallthrough system? we'll see.
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
throw new Error(`no mocks found for ${resource}`);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function setMock(resource, handler) {
|
|
21
|
-
const mock = {
|
|
22
|
-
resource,
|
|
23
|
-
handler,
|
|
24
|
-
regexp: pathToRegexp(resource),
|
|
25
|
-
};
|
|
26
|
-
mocks.push(mock);
|
|
27
|
-
return () => {
|
|
28
|
-
mocks = mocks.filter((x) => x !== mock);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function unsetAllMocks() {
|
|
33
|
-
mocks = [];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const CF_API_BASE_URL =
|
|
37
|
-
process.env.CF_API_BASE_URL || "https://api.cloudflare.com/client/v4";
|
|
38
|
-
|
|
39
|
-
Object.assign(module.exports, {
|
|
40
|
-
__esModule: true,
|
|
41
|
-
default: mockCfetch,
|
|
42
|
-
mockCfetch,
|
|
43
|
-
setMock,
|
|
44
|
-
unsetAllMocks,
|
|
45
|
-
CF_API_BASE_URL,
|
|
46
|
-
});
|