wrangler 0.0.0-e22f9d7 → 0.0.0-e2a26a0
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 +2 -2
- package/package.json +15 -10
- package/pages/functions/buildWorker.ts +1 -1
- package/pages/functions/filepath-routing.test.ts +21 -13
- package/pages/functions/filepath-routing.ts +38 -28
- package/pages/functions/routes.ts +8 -6
- package/pages/functions/template-worker.ts +16 -24
- package/src/__tests__/dev.test.tsx +7 -3
- 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/mock-account-id.ts +30 -0
- package/src/__tests__/helpers/mock-bin.ts +33 -0
- package/src/__tests__/{mock-cfetch.ts → helpers/mock-cfetch.ts} +49 -13
- package/src/__tests__/helpers/mock-console.ts +56 -0
- package/src/__tests__/{mock-dialogs.ts → helpers/mock-dialogs.ts} +1 -1
- package/src/__tests__/helpers/mock-kv.ts +40 -0
- package/src/__tests__/helpers/mock-user.ts +27 -0
- package/src/__tests__/helpers/run-in-tmp.ts +29 -0
- package/src/__tests__/helpers/run-wrangler.ts +14 -0
- package/src/__tests__/index.test.ts +312 -56
- package/src/__tests__/jest.setup.ts +17 -2
- package/src/__tests__/kv.test.ts +344 -316
- package/src/__tests__/logout.test.ts +50 -0
- package/src/__tests__/package-manager.test.ts +206 -0
- package/src/__tests__/publish.test.ts +1222 -0
- package/src/__tests__/secret.test.ts +210 -0
- package/src/__tests__/whoami.test.tsx +86 -0
- package/src/api/form_data.ts +10 -7
- package/src/api/preview.ts +2 -2
- package/src/api/worker.ts +3 -3
- package/src/cfetch/index.ts +14 -14
- package/src/cfetch/internal.ts +40 -8
- package/src/config.ts +162 -8
- package/src/dev.tsx +103 -53
- package/src/dialogs.tsx +2 -2
- package/src/index.tsx +438 -311
- package/src/inspect.ts +80 -23
- package/src/kv.tsx +9 -1
- package/src/module-collection.ts +5 -6
- package/src/package-manager.ts +120 -0
- package/src/pages.tsx +41 -26
- package/src/paths.ts +26 -0
- package/src/proxy.ts +78 -10
- package/src/publish.ts +98 -52
- package/src/sites.tsx +175 -53
- package/src/user.tsx +51 -59
- package/src/whoami.tsx +69 -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} +0 -0
- package/wrangler-dist/cli.js +111479 -110187
- package/wrangler-dist/cli.js.map +3 -3
- package/src/__tests__/run-in-tmp.ts +0 -19
- package/src/__tests__/run-wrangler.ts +0 -32
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as os from "node:os";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import * as fs from "fs";
|
|
4
|
-
|
|
5
|
-
const originalCwd = process.cwd();
|
|
6
|
-
|
|
7
|
-
export function runInTempDir() {
|
|
8
|
-
let tmpDir: string;
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "wrangler-tests"));
|
|
12
|
-
process.chdir(tmpDir);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
afterEach(() => {
|
|
16
|
-
process.chdir(originalCwd);
|
|
17
|
-
fs.rmSync(tmpDir, { recursive: true });
|
|
18
|
-
});
|
|
19
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { main } from "../index";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Run the wrangler CLI tool in tests, capturing the logging output.
|
|
5
|
-
*/
|
|
6
|
-
export async function runWrangler(cmd?: string) {
|
|
7
|
-
const logSpy = jest.spyOn(console, "log").mockImplementation();
|
|
8
|
-
const errorSpy = jest.spyOn(console, "error").mockImplementation();
|
|
9
|
-
const warnSpy = jest.spyOn(console, "warn").mockImplementation();
|
|
10
|
-
try {
|
|
11
|
-
let error: unknown = undefined;
|
|
12
|
-
try {
|
|
13
|
-
await main(cmd?.split(" ") ?? []);
|
|
14
|
-
} catch (e) {
|
|
15
|
-
error = e;
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
error,
|
|
19
|
-
stdout: captureCalls(logSpy),
|
|
20
|
-
stderr: captureCalls(errorSpy),
|
|
21
|
-
warnings: captureCalls(warnSpy),
|
|
22
|
-
};
|
|
23
|
-
} finally {
|
|
24
|
-
logSpy.mockRestore();
|
|
25
|
-
errorSpy.mockRestore();
|
|
26
|
-
warnSpy.mockRestore();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function captureCalls(spy: jest.SpyInstance): string {
|
|
31
|
-
return spy.mock.calls.flat(2).join("\n");
|
|
32
|
-
}
|