wrangler 0.0.0-e3278fa → 0.0.0-e3ce82b

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "0.0.0-e3278fa",
3
+ "version": "0.0.0-e3ce82b",
4
4
  "author": "wrangler@cloudflare.com",
5
5
  "description": "Command-line interface for all things Cloudflare Workers",
6
6
  "bin": {
@@ -19,7 +19,7 @@ describe("normalizeAndValidateConfig()", () => {
19
19
  build: {
20
20
  command: undefined,
21
21
  cwd: undefined,
22
- watch_dir: undefined,
22
+ watch_dir: "./src",
23
23
  },
24
24
  compatibility_date: undefined,
25
25
  compatibility_flags: [],
@@ -879,171 +879,250 @@ describe("normalizeAndValidateConfig()", () => {
879
879
  `);
880
880
  });
881
881
 
882
- it("should error on invalid `name` value with spaces", () => {
883
- const expectedConfig: RawEnvironment = {
884
- name: "NCC 1701 D",
885
- } as unknown as RawEnvironment;
882
+ describe("name", () => {
883
+ it("should error on invalid `name` value with spaces", () => {
884
+ const expectedConfig: RawEnvironment = {
885
+ name: "NCC 1701 D",
886
+ } as unknown as RawEnvironment;
886
887
 
887
- const { config, diagnostics } = normalizeAndValidateConfig(
888
- expectedConfig,
889
- undefined,
890
- { env: undefined }
891
- );
888
+ const { config, diagnostics } = normalizeAndValidateConfig(
889
+ expectedConfig,
890
+ undefined,
891
+ { env: undefined }
892
+ );
892
893
 
893
- expect(config).toEqual(expect.objectContaining(expectedConfig));
894
- expect(diagnostics.hasWarnings()).toBe(false);
895
- expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
896
- "Processing wrangler configuration:
897
- - Expected \\"name\\" to be of type string, alphanumeric and lowercase with dashes only but got \\"NCC 1701 D\\"."
898
- `);
899
- });
894
+ expect(config).toEqual(expect.objectContaining(expectedConfig));
895
+ expect(diagnostics.hasWarnings()).toBe(false);
896
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
897
+ "Processing wrangler configuration:
898
+ - Expected \\"name\\" to be of type string, alphanumeric and lowercase with dashes only but got \\"NCC 1701 D\\"."
899
+ `);
900
+ });
900
901
 
901
- it("should be valid `name` with underscores", () => {
902
- const expectedConfig: RawEnvironment = {
903
- name: "enterprise_nx_01",
904
- } as unknown as RawEnvironment;
902
+ it("should be valid `name` with underscores", () => {
903
+ const expectedConfig: RawEnvironment = {
904
+ name: "enterprise_nx_01",
905
+ } as unknown as RawEnvironment;
905
906
 
906
- const { config, diagnostics } = normalizeAndValidateConfig(
907
- expectedConfig,
908
- undefined,
909
- { env: undefined }
910
- );
907
+ const { config, diagnostics } = normalizeAndValidateConfig(
908
+ expectedConfig,
909
+ undefined,
910
+ { env: undefined }
911
+ );
911
912
 
912
- expect(config).toEqual(expect.objectContaining(expectedConfig));
913
- expect(diagnostics.hasWarnings()).toBe(false);
914
- expect(diagnostics.hasErrors()).toBe(false);
915
- });
913
+ expect(config).toEqual(expect.objectContaining(expectedConfig));
914
+ expect(diagnostics.hasWarnings()).toBe(false);
915
+ expect(diagnostics.hasErrors()).toBe(false);
916
+ });
916
917
 
917
- it("should error on invalid `name` value with special characters", () => {
918
- const expectedConfig: RawEnvironment = {
919
- name: "Thy'lek-Shran",
920
- } as unknown as RawEnvironment;
918
+ it("should error on invalid `name` value with special characters", () => {
919
+ const expectedConfig: RawEnvironment = {
920
+ name: "Thy'lek-Shran",
921
+ } as unknown as RawEnvironment;
921
922
 
922
- const { config, diagnostics } = normalizeAndValidateConfig(
923
- expectedConfig,
924
- undefined,
925
- { env: undefined }
926
- );
923
+ const { config, diagnostics } = normalizeAndValidateConfig(
924
+ expectedConfig,
925
+ undefined,
926
+ { env: undefined }
927
+ );
927
928
 
928
- expect(config).toEqual(expect.objectContaining(expectedConfig));
929
- expect(diagnostics.hasWarnings()).toBe(false);
930
- expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
931
- "Processing wrangler configuration:
932
- - Expected \\"name\\" to be of type string, alphanumeric and lowercase with dashes only but got \\"Thy'lek-Shran\\"."
933
- `);
934
- });
929
+ expect(config).toEqual(expect.objectContaining(expectedConfig));
930
+ expect(diagnostics.hasWarnings()).toBe(false);
931
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
932
+ "Processing wrangler configuration:
933
+ - Expected \\"name\\" to be of type string, alphanumeric and lowercase with dashes only but got \\"Thy'lek-Shran\\"."
934
+ `);
935
+ });
935
936
 
936
- it("should error on invalid `name` value with only special characters", () => {
937
- const expectedConfig: RawEnvironment = {
938
- name: "!@#$%^&*(()",
939
- } as unknown as RawEnvironment;
937
+ it("should error on invalid `name` value with only special characters", () => {
938
+ const expectedConfig: RawEnvironment = {
939
+ name: "!@#$%^&*(()",
940
+ } as unknown as RawEnvironment;
940
941
 
941
- const { config, diagnostics } = normalizeAndValidateConfig(
942
- expectedConfig,
943
- undefined,
944
- { env: undefined }
945
- );
942
+ const { config, diagnostics } = normalizeAndValidateConfig(
943
+ expectedConfig,
944
+ undefined,
945
+ { env: undefined }
946
+ );
946
947
 
947
- expect(config).toEqual(expect.objectContaining(expectedConfig));
948
- expect(diagnostics.hasWarnings()).toBe(false);
949
- expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
950
- "Processing wrangler configuration:
951
- - Expected \\"name\\" to be of type string, alphanumeric and lowercase with dashes only but got \\"!@#$%^&*(()\\"."
952
- `);
948
+ expect(config).toEqual(expect.objectContaining(expectedConfig));
949
+ expect(diagnostics.hasWarnings()).toBe(false);
950
+ expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
951
+ "Processing wrangler configuration:
952
+ - Expected \\"name\\" to be of type string, alphanumeric and lowercase with dashes only but got \\"!@#$%^&*(()\\"."
953
+ `);
954
+ });
953
955
  });
954
956
 
955
- it("should override build.upload config defaults with provided values and warn about deprecations", () => {
956
- const expectedConfig: RawEnvironment = {
957
- build: {
958
- upload: {
959
- dir: "src",
960
- format: "modules",
961
- main: "index.ts",
962
- rules: [{ type: "Text", globs: ["GLOB"], fallthrough: true }],
957
+ describe("build", () => {
958
+ it("should override build.upload config defaults with provided values and warn about deprecations", () => {
959
+ const expectedConfig: RawEnvironment = {
960
+ build: {
961
+ upload: {
962
+ dir: "src",
963
+ format: "modules",
964
+ main: "index.ts",
965
+ rules: [{ type: "Text", globs: ["GLOB"], fallthrough: true }],
966
+ },
963
967
  },
964
- },
965
- };
968
+ };
966
969
 
967
- const { config, diagnostics } = normalizeAndValidateConfig(
968
- expectedConfig,
969
- path.resolve("project/wrangler.toml"),
970
- { env: undefined }
971
- );
970
+ const { config, diagnostics } = normalizeAndValidateConfig(
971
+ expectedConfig,
972
+ path.resolve("project/wrangler.toml"),
973
+ { env: undefined }
974
+ );
972
975
 
973
- expect(config.main).toEqual(path.resolve("project/src/index.ts"));
974
- expect(config.build.upload).toBeUndefined();
975
- expect(diagnostics.hasErrors()).toBe(false);
976
- expect(diagnostics.hasWarnings()).toBe(true);
977
- expect(normalizePath(diagnostics.renderWarnings()))
978
- .toMatchInlineSnapshot(`
979
- "Processing project/wrangler.toml configuration:
980
- - Deprecation: \\"build.upload.format\\":
981
- The format is inferred automatically from the code.
982
- - Deprecation: \\"build.upload.main\\":
983
- Delete the \`build.upload.main\` and \`build.upload.dir\` fields.
984
- Then add the top level \`main\` field to your configuration file:
985
- \`\`\`
986
- main = \\"src/index.ts\\"
987
- \`\`\`
988
- - Deprecation: \\"build.upload.dir\\":
989
- Use the top level \\"main\\" field or a command-line argument to specify the entry-point for the Worker.
990
- - Deprecation: The \`build.upload.rules\` config field is no longer used, the rules should be specified via the \`rules\` config field. Delete the \`build.upload\` field from the configuration file, and add this:
991
- \`\`\`
992
- [[rules]]
993
- type = \\"Text\\"
994
- globs = [ \\"GLOB\\" ]
995
- fallthrough = true
996
- \`\`\`"
997
- `);
998
- });
976
+ expect(config.main).toEqual(path.resolve("project/src/index.ts"));
977
+ expect(config.build.upload).toBeUndefined();
978
+ expect(diagnostics.hasErrors()).toBe(false);
979
+ expect(diagnostics.hasWarnings()).toBe(true);
980
+ expect(normalizePath(diagnostics.renderWarnings()))
981
+ .toMatchInlineSnapshot(`
982
+ "Processing project/wrangler.toml configuration:
983
+ - Deprecation: \\"build.upload.format\\":
984
+ The format is inferred automatically from the code.
985
+ - Deprecation: \\"build.upload.main\\":
986
+ Delete the \`build.upload.main\` and \`build.upload.dir\` fields.
987
+ Then add the top level \`main\` field to your configuration file:
988
+ \`\`\`
989
+ main = \\"src/index.ts\\"
990
+ \`\`\`
991
+ - Deprecation: \\"build.upload.dir\\":
992
+ Use the top level \\"main\\" field or a command-line argument to specify the entry-point for the Worker.
993
+ - Deprecation: The \`build.upload.rules\` config field is no longer used, the rules should be specified via the \`rules\` config field. Delete the \`build.upload\` field from the configuration file, and add this:
994
+ \`\`\`
995
+ [[rules]]
996
+ type = \\"Text\\"
997
+ globs = [ \\"GLOB\\" ]
998
+ fallthrough = true
999
+ \`\`\`"
1000
+ `);
1001
+ });
999
1002
 
1000
- it("should default custom build watch directories to src", () => {
1001
- const expectedConfig: RawEnvironment = {
1002
- build: {
1003
- command: "execute some --build",
1004
- },
1005
- };
1003
+ it("should default custom build watch directories to src", () => {
1004
+ const expectedConfig: RawEnvironment = {
1005
+ build: {
1006
+ command: "execute some --build",
1007
+ },
1008
+ };
1006
1009
 
1007
- const { config, diagnostics } = normalizeAndValidateConfig(
1008
- expectedConfig,
1009
- undefined,
1010
- { env: undefined }
1011
- );
1010
+ const { config, diagnostics } = normalizeAndValidateConfig(
1011
+ expectedConfig,
1012
+ undefined,
1013
+ { env: undefined }
1014
+ );
1012
1015
 
1013
- expect(config.build).toEqual(
1014
- expect.objectContaining({
1015
- command: "execute some --build",
1016
- watch_dir: "./src",
1017
- })
1018
- );
1016
+ expect(config.build).toEqual(
1017
+ expect.objectContaining({
1018
+ command: "execute some --build",
1019
+ watch_dir: "./src",
1020
+ })
1021
+ );
1019
1022
 
1020
- expect(diagnostics.hasErrors()).toBe(false);
1021
- expect(diagnostics.hasWarnings()).toBe(false);
1022
- });
1023
+ expect(diagnostics.hasErrors()).toBe(false);
1024
+ expect(diagnostics.hasWarnings()).toBe(false);
1025
+ });
1023
1026
 
1024
- it("should resolve custom build watch directories relative to wrangler.toml", async () => {
1025
- const expectedConfig: RawEnvironment = {
1026
- build: {
1027
- command: "execute some --build",
1028
- watch_dir: "some/path",
1029
- },
1030
- };
1027
+ it("should resolve custom build watch directories relative to wrangler.toml", async () => {
1028
+ const expectedConfig: RawEnvironment = {
1029
+ build: {
1030
+ command: "execute some --build",
1031
+ watch_dir: "some/path",
1032
+ },
1033
+ };
1031
1034
 
1032
- const { config, diagnostics } = normalizeAndValidateConfig(
1033
- expectedConfig,
1034
- "project/wrangler.toml",
1035
- { env: undefined }
1036
- );
1035
+ const { config, diagnostics } = normalizeAndValidateConfig(
1036
+ expectedConfig,
1037
+ "project/wrangler.toml",
1038
+ { env: undefined }
1039
+ );
1037
1040
 
1038
- expect(config.build).toEqual(
1039
- expect.objectContaining({
1040
- command: "execute some --build",
1041
- watch_dir: path.normalize("project/some/path"),
1042
- })
1043
- );
1041
+ expect(config.build).toEqual(
1042
+ expect.objectContaining({
1043
+ command: "execute some --build",
1044
+ watch_dir: path.normalize("project/some/path"),
1045
+ })
1046
+ );
1044
1047
 
1045
- expect(diagnostics.hasErrors()).toBe(false);
1046
- expect(diagnostics.hasWarnings()).toBe(false);
1048
+ expect(diagnostics.hasErrors()).toBe(false);
1049
+ expect(diagnostics.hasWarnings()).toBe(false);
1050
+ });
1051
+
1052
+ it("should allow watch_dir to be an array of paths", () => {
1053
+ const expectedConfig: RawEnvironment = {
1054
+ build: {
1055
+ command: "execute some --build",
1056
+ watch_dir: ["some/path/a", "some/path/b", "some/path/c"],
1057
+ },
1058
+ };
1059
+
1060
+ const { config, diagnostics } = normalizeAndValidateConfig(
1061
+ expectedConfig,
1062
+ "project/wrangler.toml",
1063
+ { env: undefined }
1064
+ );
1065
+
1066
+ expect(config.build).toEqual(
1067
+ expect.objectContaining({
1068
+ command: "execute some --build",
1069
+ watch_dir: [
1070
+ path.normalize("project/some/path/a"),
1071
+ path.normalize("project/some/path/b"),
1072
+ path.normalize("project/some/path/c"),
1073
+ ],
1074
+ })
1075
+ );
1076
+
1077
+ expect(diagnostics.hasErrors()).toBe(false);
1078
+ expect(diagnostics.hasWarnings()).toBe(false);
1079
+ });
1080
+
1081
+ it("should error when the watch_dir array isn't an array of strings", () => {
1082
+ const expectedConfig: RawEnvironment = {
1083
+ build: {
1084
+ command: "execute some --build",
1085
+ watch_dir: [
1086
+ "some/path/a",
1087
+ "some/path/b",
1088
+ // @ts-expect-error intentionally bad "paths"
1089
+ 123,
1090
+ "some/path/c",
1091
+ // @ts-expect-error intentionally bad "paths"
1092
+ false,
1093
+ ],
1094
+ },
1095
+ };
1096
+
1097
+ const { config, diagnostics } = normalizeAndValidateConfig(
1098
+ expectedConfig,
1099
+ "project/wrangler.toml",
1100
+ { env: undefined }
1101
+ );
1102
+
1103
+ expect(config.build).toEqual(
1104
+ expect.objectContaining({
1105
+ command: "execute some --build",
1106
+ watch_dir: [
1107
+ path.normalize("project/some/path/a"),
1108
+ path.normalize("project/some/path/b"),
1109
+ path.normalize("project/123"),
1110
+ path.normalize("project/some/path/c"),
1111
+ path.normalize("project/false"),
1112
+ ],
1113
+ })
1114
+ );
1115
+
1116
+ expect(diagnostics.hasWarnings()).toBe(false);
1117
+ expect(diagnostics.hasErrors()).toBe(true);
1118
+
1119
+ expect(normalizePath(diagnostics.renderErrors()))
1120
+ .toMatchInlineSnapshot(`
1121
+ "Processing project/wrangler.toml configuration:
1122
+ - Expected \\"build.watch_dir.[2]\\" to be of type string but got 123.
1123
+ - Expected \\"build.watch_dir.[4]\\" to be of type string but got false."
1124
+ `);
1125
+ });
1047
1126
  });
1048
1127
 
1049
1128
  describe("durable_objects field", () => {
@@ -242,7 +242,8 @@ describe("wrangler", () => {
242
242
  expect(std.out).toMatchInlineSnapshot(`
243
243
  "▲ [WARNING] Deprecation: \`wrangler build\` has been deprecated.
244
244
 
245
- Please refer to https://developers.cloudflare.com/workers/wrangler/migration/deprecations/#build for more information.
245
+ Please refer to https://developers.cloudflare.com/workers/wrangler/migration/deprecations/#build
246
+ for more information.
246
247
  Attempting to run \`wrangler publish --dry-run --outdir=dist\` for you instead:
247
248
 
248
249
 
@@ -5347,6 +5347,7 @@ function mockUploadWorkerRequest(
5347
5347
  expect(envName).toEqual(env);
5348
5348
  }
5349
5349
  expect(queryParams.get("include_subdomain_availability")).toEqual("true");
5350
+ expect(queryParams.get("excludeScript")).toEqual("true");
5350
5351
  const formBody = body as FormData;
5351
5352
  if (expectedEntry !== undefined) {
5352
5353
  expect(await (formBody.get("index.js") as File).text()).toMatch(
@@ -175,7 +175,7 @@ interface EnvironmentInheritable {
175
175
  /** The directory in which the command is executed. */
176
176
  cwd?: string;
177
177
  /** The directory to watch for changes while using wrangler dev, defaults to the current working directory */
178
- watch_dir?: string;
178
+ watch_dir?: string | string[];
179
179
  /**
180
180
  * Deprecated field previously used to configure the build and upload of the script.
181
181
  * @deprecated
@@ -227,19 +227,23 @@ function normalizeAndValidateBuild(
227
227
  rawBuild: Config["build"],
228
228
  configPath: string | undefined
229
229
  ): Config["build"] & { deprecatedUpload: DeprecatedUpload } {
230
- const { command, cwd, watch_dir, upload, ...rest } = rawBuild;
230
+ const { command, cwd, watch_dir = "./src", upload, ...rest } = rawBuild;
231
231
  const deprecatedUpload: DeprecatedUpload = { ...upload };
232
232
  validateAdditionalProperties(diagnostics, "build", Object.keys(rest), []);
233
233
 
234
234
  validateOptionalProperty(diagnostics, "build", "command", command, "string");
235
235
  validateOptionalProperty(diagnostics, "build", "cwd", cwd, "string");
236
- validateOptionalProperty(
237
- diagnostics,
238
- "build",
239
- "watch_dir",
240
- watch_dir,
241
- "string"
242
- );
236
+ if (Array.isArray(watch_dir)) {
237
+ validateTypedArray(diagnostics, "build.watch_dir", watch_dir, "string");
238
+ } else {
239
+ validateOptionalProperty(
240
+ diagnostics,
241
+ "build",
242
+ "watch_dir",
243
+ watch_dir,
244
+ "string"
245
+ );
246
+ }
243
247
 
244
248
  deprecated(
245
249
  diagnostics,
@@ -288,13 +292,18 @@ function normalizeAndValidateBuild(
288
292
  // - `configPath` will always be defined since `build` can only
289
293
  // be configured in `wrangler.toml`, but who knows, that may
290
294
  // change in the future, so we do a check anyway
291
- command
292
- ? configPath
293
- ? path.relative(
295
+ command && configPath
296
+ ? Array.isArray(watch_dir)
297
+ ? watch_dir.map((dir) =>
298
+ path.relative(
299
+ process.cwd(),
300
+ path.join(path.dirname(configPath), `${dir}`)
301
+ )
302
+ )
303
+ : path.relative(
294
304
  process.cwd(),
295
- path.join(path.dirname(configPath), watch_dir || "./src")
305
+ path.join(path.dirname(configPath), `${watch_dir}`)
296
306
  )
297
- : watch_dir || "./src"
298
307
  : watch_dir,
299
308
  cwd,
300
309
  deprecatedUpload,
package/src/dev/dev.tsx CHANGED
@@ -46,11 +46,7 @@ export type DevProps = {
46
46
  usageModel: "bundled" | "unbound" | undefined;
47
47
  minify: boolean | undefined;
48
48
  nodeCompat: boolean | undefined;
49
- build: {
50
- command?: string | undefined;
51
- cwd?: string | undefined;
52
- watch_dir?: string | undefined;
53
- };
49
+ build: Config["build"];
54
50
  env: string | undefined;
55
51
  legacyEnv: boolean;
56
52
  zone: string | undefined;
@@ -221,14 +217,7 @@ function useTmpDir(): string | undefined {
221
217
  return directory?.name;
222
218
  }
223
219
 
224
- function useCustomBuild(
225
- expectedEntry: Entry,
226
- build: {
227
- command?: string | undefined;
228
- cwd?: string | undefined;
229
- watch_dir?: string | undefined;
230
- }
231
- ): void {
220
+ function useCustomBuild(expectedEntry: Entry, build: Config["build"]): void {
232
221
  useEffect(() => {
233
222
  if (!build.command) return;
234
223
  let watcher: ReturnType<typeof watch> | undefined;
package/src/parse.ts CHANGED
@@ -2,6 +2,7 @@ import * as fs from "node:fs";
2
2
  import { resolve } from "node:path";
3
3
  import TOML from "@iarna/toml";
4
4
  import { formatMessagesSync } from "esbuild";
5
+ import { logger } from "./logger";
5
6
 
6
7
  export type Message = {
7
8
  text: string;
@@ -38,7 +39,7 @@ export function formatMessage(
38
39
  const lines = formatMessagesSync([input], {
39
40
  color,
40
41
  kind: kind,
41
- terminalWidth: process.stderr.columns,
42
+ terminalWidth: logger.columns,
42
43
  });
43
44
  return lines.join("\n");
44
45
  }
package/src/publish.ts CHANGED
@@ -430,7 +430,12 @@ export default async function publish(props: Props): Promise<void> {
430
430
  method: "PUT",
431
431
  body: createWorkerUploadForm(worker),
432
432
  },
433
- new URLSearchParams({ include_subdomain_availability: "true" })
433
+ new URLSearchParams({
434
+ include_subdomain_availability: "true",
435
+ // pass excludeScript so the whole body of the
436
+ // script doesn't get included in the response
437
+ excludeScript: "true",
438
+ })
434
439
  )
435
440
  ).available_on_subdomain;
436
441
  }
@@ -116943,7 +116943,7 @@ var yargs_default = Yargs;
116943
116943
 
116944
116944
  // package.json
116945
116945
  var name = "wrangler";
116946
- var version = "0.0.0-e3278fa";
116946
+ var version = "0.0.0-e3ce82b";
116947
116947
  var author = "wrangler@cloudflare.com";
116948
116948
  var description = "Command-line interface for all things Cloudflare Workers";
116949
116949
  var bin = {
@@ -117123,17 +117123,66 @@ init_import_meta_url();
117123
117123
  var fs2 = __toESM(require("node:fs"));
117124
117124
  var import_node_path5 = require("node:path");
117125
117125
  var import_toml = __toESM(require_toml());
117126
+ var import_esbuild2 = require("esbuild");
117127
+
117128
+ // src/logger.ts
117129
+ init_import_meta_url();
117130
+ var import_node_util = require("node:util");
117126
117131
  var import_esbuild = require("esbuild");
117132
+ var LOGGER_LEVELS = {
117133
+ error: 0,
117134
+ warn: 1,
117135
+ log: 2,
117136
+ debug: 3
117137
+ };
117138
+ var LOGGER_LEVEL_FORMAT_TYPE_MAP = {
117139
+ error: "error",
117140
+ warn: "warning",
117141
+ log: void 0,
117142
+ debug: void 0
117143
+ };
117144
+ var Logger = class {
117145
+ constructor(loggerLevel = "log") {
117146
+ this.loggerLevel = loggerLevel;
117147
+ }
117148
+ columns = process.stdout.columns;
117149
+ debug = (...args) => this.doLog("debug", args);
117150
+ log = (...args) => this.doLog("log", args);
117151
+ warn = (...args) => this.doLog("warn", args);
117152
+ error = (...args) => this.doLog("error", args);
117153
+ doLog(messageLevel, args) {
117154
+ if (LOGGER_LEVELS[this.loggerLevel] >= LOGGER_LEVELS[messageLevel]) {
117155
+ console[messageLevel](this.formatMessage(messageLevel, (0, import_node_util.format)(...args)));
117156
+ }
117157
+ }
117158
+ formatMessage(level, message) {
117159
+ const kind = LOGGER_LEVEL_FORMAT_TYPE_MAP[level];
117160
+ if (kind) {
117161
+ const [firstLine, ...otherLines] = message.split("\n");
117162
+ const notes = otherLines.length > 0 ? otherLines.map((text) => ({ text })) : void 0;
117163
+ return (0, import_esbuild.formatMessagesSync)([{ text: firstLine, notes }], {
117164
+ color: true,
117165
+ kind,
117166
+ terminalWidth: this.columns
117167
+ })[0];
117168
+ } else {
117169
+ return message;
117170
+ }
117171
+ }
117172
+ };
117173
+ var logger = new Logger();
117174
+
117175
+ // src/parse.ts
117127
117176
  function formatMessage({ text, notes, location, kind = "error" }, color = true) {
117128
117177
  const input = { text, notes, location };
117129
117178
  delete input.location?.fileText;
117130
117179
  for (const note of notes ?? []) {
117131
117180
  delete note.location?.fileText;
117132
117181
  }
117133
- const lines = (0, import_esbuild.formatMessagesSync)([input], {
117182
+ const lines = (0, import_esbuild2.formatMessagesSync)([input], {
117134
117183
  color,
117135
117184
  kind,
117136
- terminalWidth: process.stderr.columns
117185
+ terminalWidth: logger.columns
117137
117186
  });
117138
117187
  return lines.join("\n");
117139
117188
  }
@@ -117230,55 +117279,6 @@ var import_undici2 = __toESM(require_undici());
117230
117279
 
117231
117280
  // src/environment-variables.ts
117232
117281
  init_import_meta_url();
117233
-
117234
- // src/logger.ts
117235
- init_import_meta_url();
117236
- var import_node_util = require("node:util");
117237
- var import_esbuild2 = require("esbuild");
117238
- var LOGGER_LEVELS = {
117239
- error: 0,
117240
- warn: 1,
117241
- log: 2,
117242
- debug: 3
117243
- };
117244
- var LOGGER_LEVEL_FORMAT_TYPE_MAP = {
117245
- error: "error",
117246
- warn: "warning",
117247
- log: void 0,
117248
- debug: void 0
117249
- };
117250
- var Logger = class {
117251
- constructor(loggerLevel = "log") {
117252
- this.loggerLevel = loggerLevel;
117253
- }
117254
- columns = process.stdout.columns;
117255
- debug = (...args) => this.doLog("debug", args);
117256
- log = (...args) => this.doLog("log", args);
117257
- warn = (...args) => this.doLog("warn", args);
117258
- error = (...args) => this.doLog("error", args);
117259
- doLog(messageLevel, args) {
117260
- if (LOGGER_LEVELS[this.loggerLevel] >= LOGGER_LEVELS[messageLevel]) {
117261
- console[messageLevel](this.formatMessage(messageLevel, (0, import_node_util.format)(...args)));
117262
- }
117263
- }
117264
- formatMessage(level, message) {
117265
- const kind = LOGGER_LEVEL_FORMAT_TYPE_MAP[level];
117266
- if (kind) {
117267
- const [firstLine, ...otherLines] = message.split("\n");
117268
- const notes = otherLines.length > 0 ? otherLines.map((text) => ({ text })) : void 0;
117269
- return (0, import_esbuild2.formatMessagesSync)([{ text: firstLine, notes }], {
117270
- color: true,
117271
- kind,
117272
- terminalWidth: this.columns
117273
- })[0];
117274
- } else {
117275
- return message;
117276
- }
117277
- }
117278
- };
117279
- var logger = new Logger();
117280
-
117281
- // src/environment-variables.ts
117282
117282
  function getEnvironmentVariableFactory({
117283
117283
  variableName,
117284
117284
  deprecatedName,
@@ -118398,12 +118398,16 @@ Consider adding an environment configuration section to the wrangler.toml file:
118398
118398
  return { config, diagnostics };
118399
118399
  }
118400
118400
  function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
118401
- const { command: command2, cwd: cwd2, watch_dir, upload: upload2, ...rest } = rawBuild;
118401
+ const { command: command2, cwd: cwd2, watch_dir = "./src", upload: upload2, ...rest } = rawBuild;
118402
118402
  const deprecatedUpload = { ...upload2 };
118403
118403
  validateAdditionalProperties(diagnostics, "build", Object.keys(rest), []);
118404
118404
  validateOptionalProperty(diagnostics, "build", "command", command2, "string");
118405
118405
  validateOptionalProperty(diagnostics, "build", "cwd", cwd2, "string");
118406
- validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
118406
+ if (Array.isArray(watch_dir)) {
118407
+ validateTypedArray(diagnostics, "build.watch_dir", watch_dir, "string");
118408
+ } else {
118409
+ validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
118410
+ }
118407
118411
  deprecated(diagnostics, rawEnv, "build.upload.format", "The format is inferred automatically from the code.", true);
118408
118412
  if (rawEnv.main !== void 0 && rawBuild.upload?.main) {
118409
118413
  diagnostics.errors.push(`Don't define both the \`main\` and \`build.upload.main\` fields in your configuration.
@@ -118419,7 +118423,7 @@ main = "${import_node_path7.default.join(rawBuild.upload?.dir ?? "./dist", rawBu
118419
118423
  }
118420
118424
  return {
118421
118425
  command: command2,
118422
- watch_dir: command2 ? configPath ? import_node_path7.default.relative(process.cwd(), import_node_path7.default.join(import_node_path7.default.dirname(configPath), watch_dir || "./src")) : watch_dir || "./src" : watch_dir,
118426
+ watch_dir: command2 && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir) => import_node_path7.default.relative(process.cwd(), import_node_path7.default.join(import_node_path7.default.dirname(configPath), `${dir}`))) : import_node_path7.default.relative(process.cwd(), import_node_path7.default.join(import_node_path7.default.dirname(configPath), `${watch_dir}`)) : watch_dir,
118423
118427
  cwd: cwd2,
118424
118428
  deprecatedUpload
118425
118429
  };
@@ -124600,7 +124604,10 @@ async function publish(props) {
124600
124604
  available_on_subdomain = (await fetchResult(workerUrl, {
124601
124605
  method: "PUT",
124602
124606
  body: createWorkerUploadForm(worker)
124603
- }, new import_node_url12.URLSearchParams({ include_subdomain_availability: "true" }))).available_on_subdomain;
124607
+ }, new import_node_url12.URLSearchParams({
124608
+ include_subdomain_availability: "true",
124609
+ excludeScript: "true"
124610
+ }))).available_on_subdomain;
124604
124611
  }
124605
124612
  } finally {
124606
124613
  if (typeof destination !== "string") {