wrangler 2.8.0 → 2.8.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/package.json +1 -1
- package/src/__tests__/d1/d1.test.ts +12 -8
- package/src/__tests__/deployments.test.ts +4 -4
- package/src/__tests__/helpers/msw/handlers/deployments.ts +10 -18
- package/src/__tests__/helpers/msw/handlers/namespaces.ts +18 -41
- package/src/__tests__/helpers/msw/handlers/r2.ts +14 -34
- package/src/__tests__/helpers/msw/handlers/script.ts +9 -28
- package/src/__tests__/helpers/msw/handlers/user.ts +13 -24
- package/src/__tests__/helpers/msw/handlers/zones.ts +6 -8
- package/src/__tests__/pages.test.ts +34 -37
- package/src/__tests__/publish.test.ts +126 -0
- package/src/__tests__/r2.test.ts +11 -35
- package/src/__tests__/tail.test.ts +6 -18
- package/src/__tests__/tsconfig.tsbuildinfo +1 -1
- package/src/__tests__/user.test.ts +0 -1
- package/src/__tests__/whoami.test.tsx +6 -17
- package/src/__tests__/worker-namespace.test.ts +56 -48
- package/src/api/index.ts +1 -0
- package/src/api/pages/index.ts +5 -0
- package/src/api/pages/publish.tsx +321 -0
- package/src/bundle.ts +62 -10
- package/src/cli.ts +2 -2
- package/src/config/environment.ts +12 -10
- package/src/d1/utils.ts +1 -1
- package/src/deployments.ts +16 -6
- package/src/dev/local.tsx +1 -10
- package/src/dev/start-server.ts +5 -10
- package/src/dev/use-esbuild.ts +1 -0
- package/src/entry.ts +1 -2
- package/src/index.ts +1 -1
- package/src/metrics/send-event.ts +2 -1
- package/src/pages/build.ts +4 -124
- package/src/pages/buildFunctions.ts +129 -0
- package/src/pages/dev.ts +12 -2
- package/src/pages/functions/buildPlugin.ts +1 -0
- package/src/pages/functions/buildWorker.ts +8 -2
- package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
- package/src/pages/publish.tsx +9 -235
- package/src/publish/publish.ts +1 -0
- package/templates/d1-beta-facade.js +1 -1
- package/templates/middleware/loader-modules.ts +2 -0
- package/templates/tsconfig.tsbuildinfo +1 -1
- package/wrangler-dist/cli.d.ts +132 -10
- package/wrangler-dist/cli.js +486 -388
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -74,6 +74,17 @@ declare interface DeprecatedUpload {
|
|
|
74
74
|
rules?: Environment["rules"];
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
declare type DurableObjectBindings = {
|
|
78
|
+
/** The name of the binding used to refer to the Durable Object */
|
|
79
|
+
name: string;
|
|
80
|
+
/** The exported class name of the Durable Object */
|
|
81
|
+
class_name: string;
|
|
82
|
+
/** The script where the Durable Object is defined (if it's external to this worker) */
|
|
83
|
+
script_name?: string;
|
|
84
|
+
/** The service environment of the script_name to bind to */
|
|
85
|
+
environment?: string;
|
|
86
|
+
}[];
|
|
87
|
+
|
|
77
88
|
declare interface EnablePagesAssetsServiceBindingOptions {
|
|
78
89
|
proxyPort?: number;
|
|
79
90
|
directory?: string;
|
|
@@ -346,16 +357,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
346
357
|
* @nonInheritable
|
|
347
358
|
*/
|
|
348
359
|
durable_objects: {
|
|
349
|
-
bindings:
|
|
350
|
-
/** The name of the binding used to refer to the Durable Object */
|
|
351
|
-
name: string;
|
|
352
|
-
/** The exported class name of the Durable Object */
|
|
353
|
-
class_name: string;
|
|
354
|
-
/** The script where the Durable Object is defined (if it's external to this worker) */
|
|
355
|
-
script_name?: string;
|
|
356
|
-
/** The service environment of the script_name to bind to */
|
|
357
|
-
environment?: string;
|
|
358
|
-
}[];
|
|
360
|
+
bindings: DurableObjectBindings;
|
|
359
361
|
};
|
|
360
362
|
/**
|
|
361
363
|
* These specify any Workers KV Namespaces you want to
|
|
@@ -661,6 +663,122 @@ declare class Headers implements SpecIterable<[string, string]> {
|
|
|
661
663
|
|
|
662
664
|
declare type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
|
|
663
665
|
|
|
666
|
+
declare interface PagesPublishOptions {
|
|
667
|
+
/**
|
|
668
|
+
* Path to static assets to publish to Pages
|
|
669
|
+
*/
|
|
670
|
+
directory: string;
|
|
671
|
+
/**
|
|
672
|
+
* The Cloudflare Account ID that owns the project that's
|
|
673
|
+
* being published
|
|
674
|
+
*/
|
|
675
|
+
accountId: string;
|
|
676
|
+
/**
|
|
677
|
+
* The name of the project to be published
|
|
678
|
+
*/
|
|
679
|
+
projectName: string;
|
|
680
|
+
/**
|
|
681
|
+
* Branch name to use. Defaults to production branch
|
|
682
|
+
*/
|
|
683
|
+
branch?: string;
|
|
684
|
+
/**
|
|
685
|
+
* Whether or not to skip local file upload result caching
|
|
686
|
+
*/
|
|
687
|
+
skipCaching?: boolean;
|
|
688
|
+
/**
|
|
689
|
+
* Commit message associated to deployment
|
|
690
|
+
*/
|
|
691
|
+
commitMessage?: string;
|
|
692
|
+
/**
|
|
693
|
+
* Commit hash associated to deployment
|
|
694
|
+
*/
|
|
695
|
+
commitHash?: string;
|
|
696
|
+
/**
|
|
697
|
+
* Whether or not the deployment should be considered to be
|
|
698
|
+
* in a dirty commit state
|
|
699
|
+
*/
|
|
700
|
+
commitDirty?: boolean;
|
|
701
|
+
/**
|
|
702
|
+
* Path to the project's functions directory. Default uses
|
|
703
|
+
* the current working directory + /functions since this is
|
|
704
|
+
* typically called in a CLI
|
|
705
|
+
*/
|
|
706
|
+
functionsDirectory?: string;
|
|
707
|
+
/**
|
|
708
|
+
* Whether to run bundling on `_worker.js` before deploying.
|
|
709
|
+
* Default: false
|
|
710
|
+
*/
|
|
711
|
+
bundle?: boolean;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Publish a directory to an account/project.
|
|
716
|
+
* NOTE: You will need the `CLOUDFLARE_API_KEY` environment
|
|
717
|
+
* variable set
|
|
718
|
+
*/
|
|
719
|
+
declare function publish({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, }: PagesPublishOptions): Promise<{
|
|
720
|
+
environment: "production" | "preview";
|
|
721
|
+
id: string;
|
|
722
|
+
url: string;
|
|
723
|
+
project_name: string;
|
|
724
|
+
build_config: {
|
|
725
|
+
build_command: string;
|
|
726
|
+
destination_dir: string;
|
|
727
|
+
root_dir: string;
|
|
728
|
+
web_analytics_tag?: string | undefined;
|
|
729
|
+
web_analytics_token?: string | undefined;
|
|
730
|
+
fast_builds?: boolean | undefined;
|
|
731
|
+
};
|
|
732
|
+
created_on: string;
|
|
733
|
+
production_branch: string;
|
|
734
|
+
project_id: string;
|
|
735
|
+
deployment_trigger: {
|
|
736
|
+
type: string;
|
|
737
|
+
metadata: {
|
|
738
|
+
branch: string;
|
|
739
|
+
commit_hash: string;
|
|
740
|
+
commit_message: string;
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
latest_stage: {
|
|
744
|
+
name: "build" | "queued" | "initialize" | "clone_repo" | "deploy";
|
|
745
|
+
status: "active" | "canceled" | "success" | "idle" | "failure" | "skipped";
|
|
746
|
+
started_on: string | null;
|
|
747
|
+
ended_on: string | null;
|
|
748
|
+
};
|
|
749
|
+
stages: {
|
|
750
|
+
name: "build" | "queued" | "initialize" | "clone_repo" | "deploy";
|
|
751
|
+
status: "active" | "canceled" | "success" | "idle" | "failure" | "skipped";
|
|
752
|
+
started_on: string | null;
|
|
753
|
+
ended_on: string | null;
|
|
754
|
+
}[];
|
|
755
|
+
aliases: string[];
|
|
756
|
+
modified_on: string;
|
|
757
|
+
short_id: string;
|
|
758
|
+
build_image_major_version: number;
|
|
759
|
+
kv_namespaces?: any;
|
|
760
|
+
source?: {
|
|
761
|
+
type: "github" | "gitlab";
|
|
762
|
+
config: {
|
|
763
|
+
owner: string;
|
|
764
|
+
repo_name: string;
|
|
765
|
+
production_branch?: string | undefined;
|
|
766
|
+
pr_comments_enabled?: boolean | undefined;
|
|
767
|
+
deployments_enabled?: boolean | undefined;
|
|
768
|
+
production_deployments_enabled?: boolean | undefined;
|
|
769
|
+
preview_deployment_setting?: "none" | "all" | "custom" | undefined;
|
|
770
|
+
preview_branch_includes?: string[] | undefined;
|
|
771
|
+
preview_branch_excludes?: string[] | undefined;
|
|
772
|
+
};
|
|
773
|
+
} | undefined;
|
|
774
|
+
env_vars?: any;
|
|
775
|
+
durable_object_namespaces?: any;
|
|
776
|
+
is_skipped?: boolean | undefined;
|
|
777
|
+
files?: {
|
|
778
|
+
[x: string]: string | undefined;
|
|
779
|
+
} | undefined;
|
|
780
|
+
}>;
|
|
781
|
+
|
|
664
782
|
declare type ReferrerPolicy =
|
|
665
783
|
| ''
|
|
666
784
|
| 'no-referrer'
|
|
@@ -826,6 +944,10 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
|
826
944
|
*/
|
|
827
945
|
export declare function unstable_dev(script: string, options?: UnstableDevOptions, apiOptions?: unknown): Promise<UnstableDevWorker>;
|
|
828
946
|
|
|
947
|
+
export declare const unstable_pages: {
|
|
948
|
+
publish: typeof publish;
|
|
949
|
+
};
|
|
950
|
+
|
|
829
951
|
export declare interface UnstableDevOptions {
|
|
830
952
|
config?: string;
|
|
831
953
|
env?: string;
|