wrangler 2.0.22 → 2.0.23
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/miniflare-dist/index.mjs +464 -4
- package/package.json +10 -3
- package/src/__tests__/dev.test.tsx +92 -4
- package/src/__tests__/kv.test.ts +80 -59
- package/src/__tests__/publish.test.ts +76 -0
- package/src/__tests__/version.test.ts +35 -0
- package/src/api/dev.ts +43 -9
- package/src/bundle.ts +30 -4
- package/src/config/config.ts +7 -0
- package/src/config/validation.ts +9 -1
- package/src/create-worker-preview.ts +3 -1
- package/src/dev/dev.tsx +28 -3
- package/src/dev/local.tsx +28 -10
- package/src/dev/remote.tsx +0 -4
- package/src/dev.tsx +82 -28
- package/src/index.tsx +40 -3
- package/src/miniflare-cli/assets.ts +543 -0
- package/src/miniflare-cli/index.ts +36 -4
- package/src/pages/dev.tsx +79 -638
- package/src/publish.ts +13 -0
- package/src/user/choose-account.tsx +20 -11
- package/templates/pages-shim.ts +9 -0
- package/wrangler-dist/cli.d.ts +32 -3
- package/wrangler-dist/cli.js +578 -5756
package/src/publish.ts
CHANGED
|
@@ -276,6 +276,19 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
276
276
|
);
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
// Warn if user tries minify or node-compat with no-bundle
|
|
280
|
+
if (props.noBundle && minify) {
|
|
281
|
+
logger.warn(
|
|
282
|
+
"`--minify` and `--no-bundle` can't be used together. If you want to minify your Worker and disable Wrangler's bundling, please minify as part of your own bundling process."
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (props.noBundle && nodeCompat) {
|
|
287
|
+
logger.warn(
|
|
288
|
+
"`--node-compat` and `--no-bundle` can't be used together. If you want to polyfill Node.js built-ins and disable Wrangler's bundling, please polyfill as part of your own bundling process."
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
279
292
|
const scriptName = props.name;
|
|
280
293
|
assert(
|
|
281
294
|
scriptName,
|
|
@@ -44,17 +44,26 @@ export async function getAccountChoices(): Promise<ChooseAccountItem[]> {
|
|
|
44
44
|
if (accountIdFromEnv) {
|
|
45
45
|
return [{ id: accountIdFromEnv, name: "" }];
|
|
46
46
|
} else {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
try {
|
|
48
|
+
const response = await fetchListResult<{
|
|
49
|
+
account: ChooseAccountItem;
|
|
50
|
+
}>(`/memberships`);
|
|
51
|
+
const accounts = response.map((r) => r.account);
|
|
52
|
+
if (accounts.length === 0) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
"Failed to automatically retrieve account IDs for the logged in user.\n" +
|
|
55
|
+
"In a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or as `account_id` in your `wrangler.toml` file."
|
|
56
|
+
);
|
|
57
|
+
} else {
|
|
58
|
+
return accounts;
|
|
59
|
+
}
|
|
60
|
+
} catch (err) {
|
|
61
|
+
if ((err as { code: number }).code === 9109) {
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Failed to automatically retrieve account IDs for the logged in user.
|
|
64
|
+
You may have incorrect permissions on your API token. You can skip this account check by adding an \`account_id\` in your \`wrangler.toml\`, or by setting the value of CLOUDFLARE_ACCOUNT_ID"`
|
|
65
|
+
);
|
|
66
|
+
} else throw err;
|
|
58
67
|
}
|
|
59
68
|
}
|
|
60
69
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// This Worker is used as a default when no Pages Functions are present.
|
|
2
|
+
// It proxies the request directly on to the asset server binding.
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
async fetch(request, env, context) {
|
|
6
|
+
const response = await env.ASSETS.fetch(request.url, request);
|
|
7
|
+
return new Response(response.body, response);
|
|
8
|
+
},
|
|
9
|
+
};
|
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -39,9 +39,37 @@ declare interface DevOptions {
|
|
|
39
39
|
siteInclude?: string[];
|
|
40
40
|
siteExclude?: string[];
|
|
41
41
|
nodeCompat?: boolean;
|
|
42
|
+
compatibilityDate?: string;
|
|
42
43
|
experimentalEnableLocalPersistence?: boolean;
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
liveReload?: boolean;
|
|
45
|
+
watch?: boolean;
|
|
46
|
+
vars: {
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
};
|
|
49
|
+
kv?: {
|
|
50
|
+
binding: string;
|
|
51
|
+
id: string;
|
|
52
|
+
preview_id?: string;
|
|
53
|
+
}[];
|
|
54
|
+
durableObjects?: {
|
|
55
|
+
name: string;
|
|
56
|
+
class_name: string;
|
|
57
|
+
script_name?: string | undefined;
|
|
58
|
+
environment?: string | undefined;
|
|
59
|
+
}[];
|
|
60
|
+
showInteractiveDevSession?: boolean;
|
|
61
|
+
logLevel?: "none" | "error" | "log" | "warn" | "debug";
|
|
62
|
+
logPrefix?: string;
|
|
63
|
+
inspect?: boolean;
|
|
64
|
+
forceLocal?: boolean;
|
|
65
|
+
enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
|
|
66
|
+
_?: (string | number)[];
|
|
67
|
+
$0?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare interface EnablePagesAssetsServiceBindingOptions {
|
|
71
|
+
proxyPort?: number;
|
|
72
|
+
directory?: string;
|
|
45
73
|
}
|
|
46
74
|
|
|
47
75
|
declare class File extends Blob_2 {
|
|
@@ -290,9 +318,10 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
|
290
318
|
* @param {string} script
|
|
291
319
|
* @param {DevOptions} options
|
|
292
320
|
*/
|
|
293
|
-
export declare function unstable_dev(script: string, options: DevOptions): Promise<{
|
|
321
|
+
export declare function unstable_dev(script: string, options: DevOptions, disableExperimentalWarning?: boolean): Promise<{
|
|
294
322
|
stop: () => void;
|
|
295
323
|
fetch: (init?: RequestInit | undefined) => Promise<Response | undefined>;
|
|
324
|
+
waitUntilExit: () => Promise<void>;
|
|
296
325
|
}>;
|
|
297
326
|
|
|
298
327
|
export { }
|