wrangler 0.0.0-e1c615f → 0.0.0-e3a458e

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.
Files changed (95) hide show
  1. package/bin/wrangler.js +2 -2
  2. package/package.json +34 -15
  3. package/pages/functions/buildWorker.ts +6 -1
  4. package/pages/functions/filepath-routing.test.ts +212 -28
  5. package/pages/functions/filepath-routing.ts +91 -131
  6. package/pages/functions/routes.ts +11 -18
  7. package/pages/functions/template-worker.ts +21 -28
  8. package/src/__tests__/configuration.test.ts +2598 -0
  9. package/src/__tests__/dev.test.tsx +437 -58
  10. package/src/__tests__/dev2.test.tsx +154 -0
  11. package/src/__tests__/guess-worker-format.test.ts +58 -0
  12. package/src/__tests__/{clipboardy-mock.js → helpers/clipboardy-mock.js} +0 -0
  13. package/src/__tests__/helpers/cmd-shim.d.ts +11 -0
  14. package/src/__tests__/helpers/faye-websocket.d.ts +6 -0
  15. package/src/__tests__/helpers/mock-account-id.ts +48 -0
  16. package/src/__tests__/helpers/mock-bin.ts +36 -0
  17. package/src/__tests__/{mock-cfetch.ts → helpers/mock-cfetch.ts} +55 -19
  18. package/src/__tests__/helpers/mock-console.ts +70 -0
  19. package/src/__tests__/{mock-dialogs.ts → helpers/mock-dialogs.ts} +1 -1
  20. package/src/__tests__/helpers/mock-kv.ts +33 -0
  21. package/src/__tests__/helpers/mock-stdin.ts +103 -0
  22. package/src/__tests__/helpers/mock-web-socket.ts +29 -0
  23. package/src/__tests__/helpers/run-in-tmp.ts +32 -0
  24. package/src/__tests__/helpers/run-wrangler.ts +16 -0
  25. package/src/__tests__/helpers/write-wrangler-toml.ts +17 -0
  26. package/src/__tests__/https-options.test.ts +127 -0
  27. package/src/__tests__/index.test.ts +779 -75
  28. package/src/__tests__/jest.setup.ts +53 -6
  29. package/src/__tests__/kv.test.ts +726 -442
  30. package/src/__tests__/logout.test.ts +52 -0
  31. package/src/__tests__/package-manager.test.ts +206 -0
  32. package/src/__tests__/pages.test.ts +44 -0
  33. package/src/__tests__/parse.test.ts +322 -0
  34. package/src/__tests__/publish.test.ts +2611 -0
  35. package/src/__tests__/r2.test.ts +198 -0
  36. package/src/__tests__/route.test.ts +45 -0
  37. package/src/__tests__/secret.test.ts +425 -0
  38. package/src/__tests__/sentry.test.ts +146 -0
  39. package/src/__tests__/tail.test.ts +564 -0
  40. package/src/__tests__/whoami.test.tsx +100 -0
  41. package/src/bundle.ts +142 -0
  42. package/src/cfetch/index.ts +21 -19
  43. package/src/cfetch/internal.ts +94 -24
  44. package/src/cli.ts +10 -0
  45. package/src/config/README.md +107 -0
  46. package/src/config/config.ts +279 -0
  47. package/src/config/diagnostics.ts +80 -0
  48. package/src/config/environment.ts +305 -0
  49. package/src/config/index.ts +52 -0
  50. package/src/config/validation-helpers.ts +468 -0
  51. package/src/config/validation.ts +1057 -0
  52. package/src/{api/preview.ts → create-worker-preview.ts} +61 -23
  53. package/src/create-worker-upload-form.ts +217 -0
  54. package/src/dev/dev.tsx +362 -0
  55. package/src/dev/local.tsx +247 -0
  56. package/src/dev/remote.tsx +203 -0
  57. package/src/dev/use-esbuild.ts +100 -0
  58. package/src/dialogs.tsx +2 -2
  59. package/src/entry.ts +159 -0
  60. package/src/environment-variables.ts +33 -0
  61. package/src/https-options.ts +122 -0
  62. package/src/index.tsx +1231 -795
  63. package/src/inspect.ts +617 -0
  64. package/src/{kv.tsx → kv.ts} +132 -60
  65. package/src/module-collection.ts +215 -26
  66. package/src/open-in-browser.ts +25 -0
  67. package/src/package-manager.ts +126 -0
  68. package/src/pages.tsx +140 -63
  69. package/src/parse.ts +183 -0
  70. package/src/paths.ts +26 -0
  71. package/src/proxy.ts +414 -77
  72. package/src/publish.ts +296 -292
  73. package/src/r2.ts +50 -0
  74. package/src/reporting.ts +131 -0
  75. package/src/selfsigned.d.ts +29 -0
  76. package/src/sites.tsx +217 -58
  77. package/src/tail/filters.ts +279 -0
  78. package/src/tail/index.ts +299 -0
  79. package/src/tail/printing.ts +62 -0
  80. package/src/user.tsx +284 -188
  81. package/src/whoami.tsx +69 -0
  82. package/src/{api/worker.ts → worker.ts} +51 -43
  83. package/templates/new-worker.js +15 -0
  84. package/templates/new-worker.ts +15 -0
  85. package/{static-asset-facade.js → templates/static-asset-facade.js} +0 -0
  86. package/templates/tsconfig.json +105 -0
  87. package/wrangler-dist/cli.js +130585 -112306
  88. package/wrangler-dist/cli.js.map +3 -3
  89. package/src/__tests__/run-in-tmp.ts +0 -19
  90. package/src/__tests__/run-wrangler.ts +0 -32
  91. package/src/api/form_data.ts +0 -131
  92. package/src/api/inspect.ts +0 -430
  93. package/src/config.ts +0 -131
  94. package/src/dev.tsx +0 -874
  95. package/src/tail.tsx +0 -73
package/src/config.ts DELETED
@@ -1,131 +0,0 @@
1
- // we're going to manually write both the type definition AND
2
- // the validator for the config, so that we can give better error messages
3
-
4
- type DurableObjectMigration = {
5
- tag: string;
6
- new_classes?: string[];
7
- renamed_classes?: string[];
8
- deleted_classes?: string[];
9
- };
10
-
11
- type Project = "webpack" | "javascript" | "rust";
12
-
13
- type Site = {
14
- // inherited
15
- bucket: string;
16
- "entry-point": string;
17
- include?: string[];
18
- exclude?: string[];
19
- };
20
-
21
- type Dev = {
22
- ip?: string;
23
- port?: number;
24
- local_protocol?: string;
25
- upstream_protocol?: string;
26
- };
27
-
28
- export type Vars = { [key: string]: string };
29
-
30
- type Cron = string; // TODO: we should be able to parse a cron pattern with ts
31
-
32
- type KVNamespace = {
33
- binding: string;
34
- preview_id?: string;
35
- id: string;
36
- };
37
-
38
- type DurableObject = {
39
- name: string;
40
- class_name: string;
41
- script_name?: string;
42
- };
43
-
44
- type Service = {
45
- name: string;
46
- service: string;
47
- environment: string;
48
- };
49
-
50
- type Build = {
51
- command?: string;
52
- cwd?: string;
53
- watch_dir?: string;
54
- } & (
55
- | {
56
- upload?: {
57
- format: "service-worker";
58
- main: string;
59
- };
60
- }
61
- | {
62
- upload?: {
63
- format: "modules";
64
- dir?: string;
65
- main?: string;
66
- rules?: {
67
- type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm";
68
- globs: string[]; // can we use typescript for these patterns?
69
- fallthrough?: boolean;
70
- };
71
- };
72
- }
73
- );
74
-
75
- type UsageModel = "bundled" | "unbound";
76
-
77
- type Env = {
78
- name?: string; // inherited
79
- account_id?: string; // inherited
80
- workers_dev?: boolean; // inherited
81
- compatibility_date?: string; // inherited
82
- compatibility_flags?: string[]; // inherited
83
- zone_id?: string; // inherited
84
- routes?: string[]; // inherited
85
- route?: string; // inherited
86
- webpack_config?: string; // inherited
87
- site?: Site;
88
- jsx_factory?: string; // inherited
89
- jsx_fragment?: string; // inherited
90
- // we should use typescript to parse cron patterns
91
- triggers?: { crons: Cron[] }; // inherited
92
- vars?: Vars;
93
- durable_objects?: { bindings: DurableObject[] };
94
- kv_namespaces?: KVNamespace[];
95
- experimental_services?: Service[];
96
- migrations?: DurableObjectMigration[];
97
- usage_model?: UsageModel; // inherited
98
- };
99
-
100
- export type Config = {
101
- name?: string; // inherited
102
- account_id?: string; // inherited
103
- // @deprecated Don't use this
104
- type?: Project; // top level
105
- compatibility_date?: string; // inherited
106
- compatibility_flags?: string[]; // inherited
107
- // -- there's some mutually exclusive logic for this next block,
108
- // but I didn't bother for now
109
- workers_dev?: boolean; // inherited
110
- zone_id?: string; // inherited
111
- routes?: string[]; // inherited
112
- route?: string; // inherited
113
- // -- end mutually exclusive stuff
114
- // @deprecated Don't use this
115
- webpack_config?: string; // inherited
116
- jsx_factory?: string; // inherited
117
- jsx_fragment?: string; // inherited
118
- vars?: Vars;
119
- durable_objects?: { bindings: DurableObject[] };
120
- kv_namespaces?: KVNamespace[];
121
- experimental_services?: Service[];
122
- migrations?: DurableObjectMigration[];
123
- site?: Site; // inherited
124
- // we should use typescript to parse cron patterns
125
- triggers?: { crons: Cron[] }; // inherited
126
- dev?: Dev;
127
- usage_model?: UsageModel; // inherited
128
- // top level
129
- build?: Build;
130
- env?: { [envName: string]: void | Env };
131
- };