wrangler 0.0.0-ece06ea → 0.0.0-ed4f2ef
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/README.md +3 -3
- package/bin/wrangler.js +12 -3
- package/miniflare-dist/index.mjs +79 -0
- package/miniflare-dist/index.mjs.map +7 -0
- package/package.json +49 -22
- package/pages/functions/buildWorker.ts +62 -0
- package/pages/functions/filepath-routing.test.ts +223 -0
- package/pages/functions/filepath-routing.ts +181 -0
- package/pages/functions/identifiers.ts +78 -0
- package/pages/functions/routes.ts +151 -0
- package/pages/functions/template-worker.ts +130 -0
- package/src/__tests__/configuration.test.ts +2874 -0
- package/src/__tests__/dev.test.tsx +588 -0
- package/src/__tests__/guess-worker-format.test.ts +83 -0
- package/src/__tests__/{clipboardy-mock.js → helpers/clipboardy-mock.js} +0 -0
- package/src/__tests__/helpers/cmd-shim.d.ts +11 -0
- package/src/__tests__/helpers/faye-websocket.d.ts +6 -0
- package/src/__tests__/helpers/mock-account-id.ts +48 -0
- package/src/__tests__/helpers/mock-bin.ts +36 -0
- package/src/__tests__/helpers/mock-cfetch.ts +207 -0
- package/src/__tests__/helpers/mock-console.ts +70 -0
- package/src/__tests__/helpers/mock-dialogs.ts +65 -0
- package/src/__tests__/helpers/mock-kv.ts +33 -0
- package/src/__tests__/helpers/mock-oauth-flow.ts +178 -0
- package/src/__tests__/helpers/mock-stdin.ts +103 -0
- package/src/__tests__/helpers/mock-web-socket.ts +29 -0
- package/src/__tests__/helpers/run-in-tmp.ts +32 -0
- package/src/__tests__/helpers/run-wrangler.ts +16 -0
- package/src/__tests__/helpers/write-wrangler-toml.ts +17 -0
- package/src/__tests__/https-options.test.ts +127 -0
- package/src/__tests__/index.test.ts +953 -119
- package/src/__tests__/jest.setup.ts +74 -0
- package/src/__tests__/kv.test.ts +1380 -0
- package/src/__tests__/package-manager.test.ts +206 -0
- package/src/__tests__/pages.test.ts +180 -0
- package/src/__tests__/parse.test.ts +322 -0
- package/src/__tests__/publish.test.ts +3946 -0
- package/src/__tests__/r2.test.ts +198 -0
- package/src/__tests__/route.test.ts +45 -0
- package/src/__tests__/secret.test.ts +425 -0
- package/src/__tests__/sentry.test.ts +146 -0
- package/src/__tests__/tail.test.ts +638 -0
- package/src/__tests__/user.test.ts +83 -0
- package/src/__tests__/whoami.test.tsx +95 -0
- package/src/bundle.ts +155 -0
- package/src/cfetch/index.ts +104 -0
- package/src/cfetch/internal.ts +139 -0
- package/src/cli.ts +18 -7
- package/src/config/README.md +107 -0
- package/src/config/config.ts +229 -0
- package/src/config/diagnostics.ts +80 -0
- package/src/config/environment.ts +371 -0
- package/src/config/index.ts +62 -0
- package/src/config/validation-helpers.ts +557 -0
- package/src/config/validation.ts +1240 -0
- package/src/create-worker-preview.ts +173 -0
- package/src/create-worker-upload-form.ts +240 -0
- package/src/dev/dev.tsx +413 -0
- package/src/dev/local.tsx +287 -0
- package/src/dev/remote.tsx +209 -0
- package/src/dev/use-esbuild.ts +109 -0
- package/src/dialogs.tsx +6 -14
- package/src/entry.ts +256 -0
- package/src/environment-variables.ts +33 -0
- package/src/errors.ts +11 -0
- package/src/https-options.ts +122 -0
- package/src/index.tsx +1503 -959
- package/src/inspect.ts +624 -0
- package/src/intl-polyfill.d.ts +139 -0
- package/src/kv.ts +319 -0
- package/src/miniflare-cli/README.md +30 -0
- package/src/miniflare-cli/enum-keys.ts +17 -0
- package/src/miniflare-cli/index.ts +38 -0
- package/src/module-collection.ts +257 -0
- package/src/open-in-browser.ts +25 -0
- package/src/package-manager.ts +126 -0
- package/src/pages.tsx +1074 -212
- package/src/parse.ts +183 -0
- package/src/paths.ts +26 -0
- package/src/proxy.ts +455 -0
- package/src/publish.ts +326 -295
- package/src/r2.ts +50 -0
- package/src/reporting.ts +131 -0
- package/src/selfsigned.d.ts +29 -0
- package/src/sites.tsx +224 -59
- package/src/tail/filters.ts +279 -0
- package/src/tail/index.ts +299 -0
- package/src/tail/printing.ts +62 -0
- package/src/user.tsx +340 -203
- package/src/whoami.tsx +69 -0
- package/src/worker.ts +172 -0
- package/templates/new-worker.js +15 -0
- package/templates/new-worker.ts +15 -0
- package/{static-asset-facade.js → templates/static-asset-facade.js} +1 -1
- package/templates/tsconfig.json +105 -0
- package/wrangler-dist/cli.js +136988 -131174
- package/wrangler-dist/cli.js.map +3 -3
- package/src/__tests__/fixtures/init/.gitkeep +0 -0
- package/src/__tests__/mock-cfetch.js +0 -46
- package/src/api/form_data.ts +0 -158
- package/src/api/inspect.ts +0 -441
- package/src/api/preview.ts +0 -123
- package/src/api/worker.ts +0 -161
- package/src/cfetch.ts +0 -72
- package/src/config.ts +0 -124
- package/src/dev.tsx +0 -736
- package/src/kv.tsx +0 -211
- package/src/tail.tsx +0 -71
- package/src/util/fetch.ts +0 -74
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import fetchMock from "jest-fetch-mock";
|
|
2
|
+
import {
|
|
3
|
+
fetchInternal,
|
|
4
|
+
fetchKVGetValue,
|
|
5
|
+
getCloudflareAPIBaseURL,
|
|
6
|
+
} from "../cfetch/internal";
|
|
7
|
+
import { confirm, prompt } from "../dialogs";
|
|
8
|
+
import openInBrowser from "../open-in-browser";
|
|
9
|
+
import { mockFetchInternal, mockFetchKVGetValue } from "./helpers/mock-cfetch";
|
|
10
|
+
import { mockOpenInBrowser as mockOpenInBrowserForOAuthFlow } from "./helpers/mock-oauth-flow";
|
|
11
|
+
import { MockWebSocket } from "./helpers/mock-web-socket";
|
|
12
|
+
|
|
13
|
+
jest.mock("ws", () => {
|
|
14
|
+
return {
|
|
15
|
+
__esModule: true,
|
|
16
|
+
default: MockWebSocket,
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
jest.mock("undici", () => {
|
|
21
|
+
return {
|
|
22
|
+
...jest.requireActual("undici"),
|
|
23
|
+
fetch: jest.requireActual("jest-fetch-mock"),
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Outside of the Sentry tests themselves, we mock Sentry to ensure that it doesn't actually send any data and
|
|
28
|
+
// that it doesn't interfere with the rest of the tests.
|
|
29
|
+
jest.mock("../reporting");
|
|
30
|
+
|
|
31
|
+
fetchMock.doMock(() => {
|
|
32
|
+
// Any un-mocked fetches should throw
|
|
33
|
+
throw new Error("Unexpected fetch request");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
jest.mock("../package-manager");
|
|
37
|
+
|
|
38
|
+
jest.mock("../cfetch/internal");
|
|
39
|
+
(fetchInternal as jest.Mock).mockImplementation(mockFetchInternal);
|
|
40
|
+
(fetchKVGetValue as jest.Mock).mockImplementation(mockFetchKVGetValue);
|
|
41
|
+
(getCloudflareAPIBaseURL as jest.Mock).mockReturnValue(
|
|
42
|
+
"https://api.cloudflare.com/client/v4"
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
jest.mock("../dialogs");
|
|
46
|
+
|
|
47
|
+
// By default (if not configured by mockConfirm()) calls to `confirm()` should throw.
|
|
48
|
+
(confirm as jest.Mock).mockImplementation((text: string) => {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Unexpected call to \`confirm("${text}")\`.\nYou should use \`mockConfirm()\` to mock calls to \`confirm()\` with expectations. Search the codebase for \`mockConfirm\` to learn more.`
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// By default (if not configured by mockPrompt()) calls to `prompt()` should throw.
|
|
55
|
+
(prompt as jest.Mock).mockImplementation((text: string) => {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Unexpected call to \`prompt(${text}, ...)\`.\nYou should use \`mockPrompt()\` to mock calls to \`prompt()\` with expectations. Search the codebase for \`mockPrompt\` to learn more.`
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
jest.mock("../dev/dev", () => {
|
|
62
|
+
const { useApp } = jest.requireActual("ink");
|
|
63
|
+
const { useEffect } = jest.requireActual("react");
|
|
64
|
+
return jest.fn().mockImplementation(() => {
|
|
65
|
+
const { exit } = useApp();
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
exit();
|
|
68
|
+
});
|
|
69
|
+
return null;
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
jest.mock("../open-in-browser");
|
|
74
|
+
(openInBrowser as jest.Mock).mockImplementation(mockOpenInBrowserForOAuthFlow);
|