wrangler 2.6.2 → 2.7.1
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/bin/wrangler.js +9 -1
- package/miniflare-dist/index.mjs +1 -1
- package/package.json +12 -10
- package/src/__tests__/api-dev.test.ts +65 -36
- package/src/__tests__/api-devregistry.test.js +14 -6
- package/src/__tests__/configuration.test.ts +2 -31
- package/src/__tests__/{d1.test.ts → d1/d1.test.ts} +48 -5
- package/src/__tests__/d1/splitter.test.ts +255 -0
- package/src/__tests__/delete.test.ts +5 -2
- package/src/__tests__/deployments.test.ts +20 -6
- package/src/__tests__/dev.test.tsx +52 -19
- package/src/__tests__/generate.test.ts +7 -4
- package/src/__tests__/helpers/mock-auth-domain.ts +20 -0
- package/src/__tests__/helpers/mock-cfetch.ts +2 -57
- package/src/__tests__/helpers/mock-dialogs.ts +70 -86
- package/src/__tests__/helpers/mock-oauth-flow.ts +64 -49
- package/src/__tests__/helpers/mock-process.ts +8 -13
- package/src/__tests__/helpers/msw/blob-worker.cjs +19 -0
- package/src/__tests__/helpers/msw/read-file-sync.js +61 -0
- package/src/__tests__/index.test.ts +46 -44
- package/src/__tests__/init.test.ts +761 -537
- package/src/__tests__/jest.setup.ts +20 -24
- package/src/__tests__/kv.test.ts +286 -173
- package/src/__tests__/logout.test.ts +1 -1
- package/src/__tests__/metrics.test.ts +5 -7
- package/src/__tests__/middleware.scheduled.test.ts +40 -30
- package/src/__tests__/middleware.test.ts +144 -120
- package/src/__tests__/pages.test.ts +1617 -1161
- package/src/__tests__/publish.test.ts +174 -125
- package/src/__tests__/r2.test.ts +2 -2
- package/src/__tests__/secret.test.ts +183 -126
- package/src/__tests__/tail.test.ts +6 -0
- package/src/__tests__/tsconfig-sanity.ts +12 -0
- package/src/__tests__/tsconfig.json +8 -0
- package/src/__tests__/tsconfig.tsbuildinfo +1 -0
- package/src/__tests__/whoami.test.tsx +1 -96
- package/src/api/dev.ts +90 -41
- package/src/api/index.ts +1 -1
- package/src/{bundle-reporter.tsx → bundle-reporter.ts} +0 -0
- package/src/cfetch/index.ts +0 -2
- package/src/cfetch/internal.ts +6 -15
- package/src/cli.ts +2 -2
- package/src/config/validation.ts +1 -2
- package/src/create-worker-upload-form.ts +2 -2
- package/src/d1/{delete.tsx → delete.ts} +0 -0
- package/src/d1/execute.tsx +8 -37
- package/src/d1/migrations/apply.tsx +29 -19
- package/src/d1/migrations/{index.tsx → index.ts} +0 -0
- package/src/d1/splitter.ts +161 -0
- package/src/d1/{types.tsx → types.ts} +0 -0
- package/src/delete.ts +3 -8
- package/src/deployments.ts +6 -0
- package/src/deprecated/index.ts +2 -295
- package/src/dev/dev.tsx +2 -2
- package/src/dev/{get-local-persistence-path.tsx → get-local-persistence-path.ts} +0 -0
- package/src/dev/local.tsx +16 -4
- package/src/dev/remote.tsx +28 -1
- package/src/dev/start-server.ts +19 -11
- package/src/dev/use-esbuild.ts +1 -1
- package/src/{dev-registry.tsx → dev-registry.ts} +0 -0
- package/src/dev.tsx +21 -2
- package/src/dialogs.ts +136 -0
- package/src/dispatch-namespace.ts +1 -1
- package/src/docs/index.ts +3 -0
- package/src/environment-variables/factory.ts +88 -0
- package/src/environment-variables/misc-variables.ts +30 -0
- package/src/generate/index.ts +300 -0
- package/src/{index.tsx → index.ts} +10 -13
- package/src/init.ts +92 -52
- package/src/jest.d.ts +4 -0
- package/src/logger.ts +15 -3
- package/src/metrics/metrics-config.ts +1 -1
- package/src/miniflare-cli/assets.ts +4 -0
- package/src/miniflare-cli/index.ts +1 -5
- package/src/miniflare-cli/tsconfig.json +9 -0
- package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -0
- package/src/miniflare-cli/types.ts +11 -0
- package/src/pages/{build.tsx → build.ts} +0 -0
- package/src/pages/{deployment-tails.tsx → deployment-tails.ts} +0 -0
- package/src/pages/{dev.tsx → dev.ts} +53 -55
- package/src/pages/functions/buildWorker.ts +1 -1
- package/src/pages/functions/tsconfig.json +8 -0
- package/src/pages/functions/tsconfig.tsbuildinfo +1 -0
- package/src/pages/{functions.tsx → functions.ts} +0 -0
- package/src/pages/{hash.tsx → hash.ts} +0 -0
- package/src/pages/{index.tsx → index.ts} +0 -0
- package/src/pages/projects.tsx +3 -5
- package/src/pages/publish.tsx +5 -4
- package/src/pages/upload.tsx +1 -1
- package/src/publish/publish.ts +9 -7
- package/src/pubsub/{pubsub-commands.tsx → pubsub-commands.ts} +1 -1
- package/src/secret/index.ts +1 -1
- package/src/{sites.tsx → sites.ts} +0 -0
- package/src/tail/index.ts +2 -3
- package/src/tsconfig-sanity.ts +16 -0
- package/src/user/access.ts +0 -1
- package/src/user/auth-variables.ts +113 -0
- package/src/user/choose-account.tsx +1 -31
- package/src/user/index.ts +0 -1
- package/src/user/{user.tsx → user.ts} +107 -73
- package/src/{whoami.tsx → whoami.ts} +37 -71
- package/templates/__tests__/tsconfig-sanity.ts +12 -0
- package/templates/__tests__/tsconfig.json +8 -0
- package/templates/__tests__/tsconfig.tsbuildinfo +1 -0
- package/templates/d1-beta-facade.js +36 -0
- package/templates/facade.d.ts +14 -0
- package/templates/first-party-worker-module-facade.ts +4 -3
- package/templates/format-dev-errors.ts +7 -6
- package/templates/init-tests/test-jest-new-worker.js +3 -5
- package/templates/init-tests/test-vitest-new-worker.js +3 -5
- package/templates/init-tests/test-vitest-new-worker.ts +25 -0
- package/templates/middleware/loader-modules.ts +0 -2
- package/templates/middleware/loader-sw.ts +6 -0
- package/templates/pages-dev-pipeline.ts +4 -1
- package/templates/pages-shim.ts +4 -1
- package/templates/pages-template-plugin.ts +12 -7
- package/templates/serve-static-assets.ts +16 -14
- package/templates/tsconfig-sanity.ts +11 -0
- package/templates/tsconfig.init.json +106 -0
- package/templates/tsconfig.json +5 -103
- package/templates/tsconfig.tsbuildinfo +1 -0
- package/wrangler-dist/cli.d.ts +58 -60
- package/wrangler-dist/cli.js +34447 -55514
- package/wrangler-dist/wasm-sync.wasm +0 -0
- package/src/__tests__/dialogs.test.tsx +0 -40
- package/src/dialogs.tsx +0 -168
- package/src/environment-variables.ts +0 -50
- package/src/user/env-vars.ts +0 -46
|
@@ -4,14 +4,10 @@ import {
|
|
|
4
4
|
fetchInternal,
|
|
5
5
|
fetchKVGetValue,
|
|
6
6
|
fetchR2Objects,
|
|
7
|
-
getCloudflareAPIBaseURL,
|
|
8
7
|
performApiFetch,
|
|
9
8
|
} from "../cfetch/internal";
|
|
10
|
-
import { confirm, prompt } from "../dialogs";
|
|
11
9
|
import {
|
|
12
|
-
mockFetchDashScript,
|
|
13
10
|
mockFetchInternal,
|
|
14
|
-
mockFetchKVGetValue,
|
|
15
11
|
mockFetchR2Objects,
|
|
16
12
|
mockPerformApiFetch,
|
|
17
13
|
} from "./helpers/mock-cfetch";
|
|
@@ -31,6 +27,9 @@ import { msw } from "./helpers/msw";
|
|
|
31
27
|
global as unknown as { __RELATIVE_PACKAGE_PATH__: string }
|
|
32
28
|
).__RELATIVE_PACKAGE_PATH__ = "..";
|
|
33
29
|
|
|
30
|
+
// Set `LC_ALL` to fix the language as English for the messages thrown by Yargs.
|
|
31
|
+
process.env.LC_ALL = "en";
|
|
32
|
+
|
|
34
33
|
// Mock out getPort since we don't actually care about what ports are open in unit tests.
|
|
35
34
|
jest.mock("get-port", () => {
|
|
36
35
|
return {
|
|
@@ -91,31 +90,16 @@ afterEach(() => {
|
|
|
91
90
|
afterAll(() => msw.close());
|
|
92
91
|
|
|
93
92
|
jest.mock("../cfetch/internal");
|
|
93
|
+
(fetchDashboardScript as jest.Mock).mockImplementation(
|
|
94
|
+
jest.requireActual("../cfetch/internal")["fetchDashboardScript"]
|
|
95
|
+
);
|
|
94
96
|
(fetchInternal as jest.Mock).mockImplementation(mockFetchInternal);
|
|
95
|
-
(fetchKVGetValue as jest.Mock).mockImplementation(
|
|
96
|
-
|
|
97
|
-
"https://api.cloudflare.com/client/v4"
|
|
97
|
+
(fetchKVGetValue as jest.Mock).mockImplementation(
|
|
98
|
+
jest.requireActual("../cfetch/internal").fetchKVGetValue
|
|
98
99
|
);
|
|
99
100
|
(fetchR2Objects as jest.Mock).mockImplementation(mockFetchR2Objects);
|
|
100
|
-
(fetchDashboardScript as jest.Mock).mockImplementation(mockFetchDashScript);
|
|
101
101
|
(performApiFetch as jest.Mock).mockImplementation(mockPerformApiFetch);
|
|
102
102
|
|
|
103
|
-
jest.mock("../dialogs");
|
|
104
|
-
|
|
105
|
-
// By default (if not configured by mockConfirm()) calls to `confirm()` should throw.
|
|
106
|
-
(confirm as jest.Mock).mockImplementation((text: string) => {
|
|
107
|
-
throw new Error(
|
|
108
|
-
`Unexpected call to \`confirm("${text}")\`.\nYou should use \`mockConfirm()\` to mock calls to \`confirm()\` with expectations. Search the codebase for \`mockConfirm\` to learn more.`
|
|
109
|
-
);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// By default (if not configured by mockPrompt()) calls to `prompt()` should throw.
|
|
113
|
-
(prompt as jest.Mock).mockImplementation((text: string) => {
|
|
114
|
-
throw new Error(
|
|
115
|
-
`Unexpected call to \`prompt(${text}, ...)\`.\nYou should use \`mockPrompt()\` to mock calls to \`prompt()\` with expectations. Search the codebase for \`mockPrompt\` to learn more.`
|
|
116
|
-
);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
103
|
jest.mock("../dev/dev", () => {
|
|
120
104
|
const { useApp } = jest.requireActual("ink");
|
|
121
105
|
const { useEffect } = jest.requireActual("react");
|
|
@@ -200,3 +184,15 @@ jest.mock("../metrics/metrics-config", () => {
|
|
|
200
184
|
};
|
|
201
185
|
return fakeModule;
|
|
202
186
|
});
|
|
187
|
+
jest.mock("prompts", () => {
|
|
188
|
+
return {
|
|
189
|
+
__esModule: true,
|
|
190
|
+
default: jest.fn((...args) => {
|
|
191
|
+
throw new Error(
|
|
192
|
+
`Unexpected call to \`prompts("${JSON.stringify(
|
|
193
|
+
args
|
|
194
|
+
)}")\`.\nYou should use \`mockConfirm()/mockSelect()/mockPrompt()\` to mock calls to \`confirm()\` with expectations.`
|
|
195
|
+
);
|
|
196
|
+
}),
|
|
197
|
+
};
|
|
198
|
+
});
|