wrangler 0.0.0-efa548c → 0.0.0-fb43821
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 +51 -0
- package/bin/wrangler.js +36 -2
- package/import_meta_url.js +3 -0
- package/package.json +56 -22
- package/src/__tests__/clipboardy-mock.js +4 -0
- package/src/__tests__/index.test.ts +422 -0
- package/src/__tests__/mock-cfetch.js +42 -0
- package/src/api/form_data.ts +141 -0
- package/src/api/inspect.ts +430 -0
- package/src/api/preview.ts +128 -0
- package/src/api/worker.ts +161 -0
- package/src/cfetch.ts +72 -0
- package/src/cli.ts +10 -0
- package/src/config.ts +122 -0
- package/src/dev.tsx +776 -0
- package/src/dialogs.tsx +77 -0
- package/src/index.tsx +1874 -0
- package/src/kv.tsx +211 -0
- package/src/module-collection.ts +64 -0
- package/src/pages.tsx +818 -0
- package/src/publish.ts +346 -0
- package/src/sites.tsx +115 -0
- package/src/tail.tsx +71 -0
- package/src/user.tsx +1029 -0
- package/{facade.js → static-asset-facade.js} +2 -7
- package/vendor/@cloudflare/kv-asset-handler/dist/index.js +262 -192
- package/vendor/@cloudflare/kv-asset-handler/package.json +1 -1
- package/vendor/{mime → wrangler-mime}/CHANGELOG.md +0 -0
- package/vendor/{mime → wrangler-mime}/LICENSE +0 -0
- package/vendor/{mime → wrangler-mime}/Mime.js +0 -0
- package/vendor/{mime → wrangler-mime}/README.md +0 -0
- package/vendor/{mime → wrangler-mime}/cli.js +0 -0
- package/vendor/{mime → wrangler-mime}/index.js +0 -0
- package/vendor/{mime → wrangler-mime}/lite.js +0 -0
- package/vendor/{mime → wrangler-mime}/package.json +1 -1
- package/vendor/{mime → wrangler-mime}/types/other.js +0 -0
- package/vendor/{mime → wrangler-mime}/types/standard.js +0 -0
- package/wrangler-dist/{index_node.js → cli.js} +90785 -61395
- package/wrangler-dist/cli.js.map +7 -0
- package/wrangler-dist/index_node.js.map +0 -7
package/src/dialogs.tsx
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Text, useInput, render } from "ink";
|
|
4
|
+
import TextInput from "ink-text-input";
|
|
5
|
+
type ConfirmProps = {
|
|
6
|
+
text: string;
|
|
7
|
+
onConfirm: (answer: boolean) => void;
|
|
8
|
+
};
|
|
9
|
+
function Confirm(props: ConfirmProps) {
|
|
10
|
+
useInput((input: string) => {
|
|
11
|
+
if (input === "y") {
|
|
12
|
+
props.onConfirm(true);
|
|
13
|
+
} else if (input === "n") {
|
|
14
|
+
props.onConfirm(false);
|
|
15
|
+
} else {
|
|
16
|
+
console.log("Unrecognised input");
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return (
|
|
20
|
+
<Box>
|
|
21
|
+
<Text>{props.text} (y/n) </Text>
|
|
22
|
+
</Box>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function confirm(text: string): Promise<boolean> {
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
const { unmount } = render(
|
|
29
|
+
<Confirm
|
|
30
|
+
text={text}
|
|
31
|
+
onConfirm={(answer: boolean) => {
|
|
32
|
+
unmount();
|
|
33
|
+
resolve(answer);
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type PromptProps = {
|
|
41
|
+
text: string;
|
|
42
|
+
type?: "text" | "password";
|
|
43
|
+
onSubmit: (text: string) => void;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
function Prompt(props: PromptProps) {
|
|
47
|
+
const [value, setValue] = useState("");
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Box>
|
|
51
|
+
<Text>{props.text} </Text>
|
|
52
|
+
<Box>
|
|
53
|
+
<TextInput
|
|
54
|
+
mask={props.type === "password" ? "*" : undefined}
|
|
55
|
+
value={value}
|
|
56
|
+
onChange={setValue}
|
|
57
|
+
onSubmit={props.onSubmit}
|
|
58
|
+
/>
|
|
59
|
+
</Box>
|
|
60
|
+
</Box>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function prompt(text: string, type: "text" | "password" = "text") {
|
|
65
|
+
return new Promise((resolve) => {
|
|
66
|
+
const { unmount } = render(
|
|
67
|
+
<Prompt
|
|
68
|
+
text={text}
|
|
69
|
+
type={type}
|
|
70
|
+
onSubmit={(text) => {
|
|
71
|
+
unmount();
|
|
72
|
+
resolve(text);
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
}
|