@cloudflare/config 0.0.0 → 0.2.0

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 (2) hide show
  1. package/dist/index.mjs +32 -24
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { a as bindings, i as triggers, n as resolveWorkerDefinition, r as export
2
2
  import * as nodeModule from "node:module";
3
3
  import * as fsp from "node:fs/promises";
4
4
  import * as path from "node:path";
5
- import path2, { dirname, isAbsolute, join, resolve } from "node:path";
5
+ import path2__default, { dirname, isAbsolute, join, resolve } from "node:path";
6
6
  import fs2, { existsSync, readFileSync, statSync } from "node:fs";
7
7
  import { fileURLToPath, pathToFileURL } from "node:url";
8
8
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -15,7 +15,7 @@ var __commonJS = (cb, mod) => function() {
15
15
  };
16
16
 
17
17
  //#endregion
18
- //#region ../workers-utils/dist/chunk-6IEM75FG.mjs
18
+ //#region ../workers-utils/dist/chunk-DDRU76YD.mjs
19
19
  var __defProp = Object.defineProperty;
20
20
  var __name = (target, value) => __defProp(target, "name", {
21
21
  value,
@@ -23,7 +23,7 @@ var __name = (target, value) => __defProp(target, "name", {
23
23
  });
24
24
 
25
25
  //#endregion
26
- //#region ../workers-utils/dist/chunk-DPLELERC.mjs
26
+ //#region ../workers-utils/dist/chunk-OC543JY3.mjs
27
27
  function isDirectory(path$1) {
28
28
  return fs2.statSync(path$1, { throwIfNoEntry: false })?.isDirectory() ?? false;
29
29
  }
@@ -50,7 +50,7 @@ function removeDirSync(dirPath) {
50
50
  __name(removeDirSync, "removeDirSync");
51
51
 
52
52
  //#endregion
53
- //#region ../workers-utils/dist/chunk-WYII773A.mjs
53
+ //#region ../workers-utils/dist/chunk-XPMIK7N6.mjs
54
54
  function partitionExports(exports$2) {
55
55
  const partitioned = {
56
56
  "durable-object": {},
@@ -813,10 +813,10 @@ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
813
813
  return result;
814
814
  }
815
815
  __name(parseTree, "parseTree");
816
- function findNodeAtLocation(root, path2$1) {
816
+ function findNodeAtLocation(root, path2) {
817
817
  if (!root) return;
818
818
  let node = root;
819
- for (let segment of path2$1) if (typeof segment === "string") {
819
+ for (let segment of path2) if (typeof segment === "string") {
820
820
  if (node.type !== "object" || !Array.isArray(node.children)) return;
821
821
  let found = false;
822
822
  for (const propertyNode of node.children) if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
@@ -1043,13 +1043,13 @@ function getNodeType(value) {
1043
1043
  }
1044
1044
  __name(getNodeType, "getNodeType");
1045
1045
  function setProperty(text, originalPath, value, options) {
1046
- const path2$1 = originalPath.slice();
1046
+ const path2 = originalPath.slice();
1047
1047
  const root = parseTree(text, []);
1048
1048
  let parent = void 0;
1049
1049
  let lastSegment = void 0;
1050
- while (path2$1.length > 0) {
1051
- lastSegment = path2$1.pop();
1052
- parent = findNodeAtLocation(root, path2$1);
1050
+ while (path2.length > 0) {
1051
+ lastSegment = path2.pop();
1052
+ parent = findNodeAtLocation(root, path2);
1053
1053
  if (parent === void 0 && value !== void 0) if (typeof lastSegment === "string") value = { [lastSegment]: value };
1054
1054
  else value = [value];
1055
1055
  else break;
@@ -1291,8 +1291,8 @@ function format2(documentText, range, options) {
1291
1291
  return format(documentText, range, options);
1292
1292
  }
1293
1293
  __name(format2, "format");
1294
- function modify(text, path2$1, value, options) {
1295
- return setProperty(text, path2$1, value, options);
1294
+ function modify(text, path2, value, options) {
1295
+ return setProperty(text, path2, value, options);
1296
1296
  }
1297
1297
  __name(modify, "modify");
1298
1298
  function applyEdits(text, edits) {
@@ -2353,13 +2353,21 @@ function up(base, options) {
2353
2353
  }
2354
2354
  __name(up, "up");
2355
2355
  function file(name, options) {
2356
- let dir, tmp;
2357
- for (dir of up(options && options.cwd || "", options)) try {
2358
- tmp = join(dir, name);
2356
+ let dir2, tmp;
2357
+ for (dir2 of up(options && options.cwd || "", options)) try {
2358
+ tmp = join(dir2, name);
2359
2359
  if (statSync(tmp).isFile()) return tmp;
2360
2360
  } catch {}
2361
2361
  }
2362
2362
  __name(file, "file");
2363
+ function dir(name, options) {
2364
+ let dir2, tmp;
2365
+ for (dir2 of up(options && options.cwd || "", options)) try {
2366
+ tmp = join(dir2, name);
2367
+ if (statSync(tmp).isDirectory()) return tmp;
2368
+ } catch {}
2369
+ }
2370
+ __name(dir, "dir");
2363
2371
  function dedent$2(templ) {
2364
2372
  var values = [];
2365
2373
  for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
@@ -2401,7 +2409,7 @@ function resolveWranglerConfigPath({ config, script }, options) {
2401
2409
  deployConfigPath: void 0,
2402
2410
  redirected: false
2403
2411
  };
2404
- return findWranglerConfig(script !== void 0 ? path2.dirname(script) : process.cwd(), options);
2412
+ return findWranglerConfig(script !== void 0 ? path2__default.dirname(script) : process.cwd(), options);
2405
2413
  }
2406
2414
  __name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
2407
2415
  function findWranglerConfig(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
@@ -2432,15 +2440,15 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
2432
2440
  const deployConfigFile = readFileSync$1(deployConfigPath);
2433
2441
  try {
2434
2442
  const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
2435
- redirectedConfigPath = deployConfig.configPath && path2.resolve(path2.dirname(deployConfigPath), deployConfig.configPath);
2443
+ redirectedConfigPath = deployConfig.configPath && path2__default.resolve(path2__default.dirname(deployConfigPath), deployConfig.configPath);
2436
2444
  } catch (e) {
2437
- throw new UserError(`Failed to parse the deploy configuration file at ${path2.relative(".", deployConfigPath)}`, {
2445
+ throw new UserError(`Failed to parse the deploy configuration file at ${path2__default.relative(".", deployConfigPath)}`, {
2438
2446
  cause: e,
2439
2447
  telemetryMessage: false
2440
2448
  });
2441
2449
  }
2442
2450
  if (!redirectedConfigPath) throw new UserError(esm_default`
2443
- A deploy configuration file was found at "${path2.relative(".", deployConfigPath)}".
2451
+ A deploy configuration file was found at "${path2__default.relative(".", deployConfigPath)}".
2444
2452
  But this is not valid - the required "configPath" property was not found.
2445
2453
  Instead this file contains:
2446
2454
  \`\`\`
@@ -2448,13 +2456,13 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
2448
2456
  \`\`\`
2449
2457
  `, { telemetryMessage: false });
2450
2458
  if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default`
2451
- There is a deploy configuration at "${path2.relative(".", deployConfigPath)}".
2452
- But the redirected configuration path it points to, "${path2.relative(".", redirectedConfigPath)}", does not exist.
2459
+ There is a deploy configuration at "${path2__default.relative(".", deployConfigPath)}".
2460
+ But the redirected configuration path it points to, "${path2__default.relative(".", redirectedConfigPath)}", does not exist.
2453
2461
  `, { telemetryMessage: false });
2454
2462
  if (userConfigPath) {
2455
- if (path2.join(path2.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError(esm_default`
2456
- Found both a user configuration file at "${path2.relative(".", userConfigPath)}"
2457
- and a deploy configuration file at "${path2.relative(".", deployConfigPath)}".
2463
+ if (path2__default.join(path2__default.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError(esm_default`
2464
+ Found both a user configuration file at "${path2__default.relative(".", userConfigPath)}"
2465
+ and a deploy configuration file at "${path2__default.relative(".", deployConfigPath)}".
2458
2466
  But these do not share the same base path so it is not clear which should be used.
2459
2467
  `, { telemetryMessage: false });
2460
2468
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/config",
3
- "version": "0.0.0",
3
+ "version": "0.2.0",
4
4
  "description": "Definitions and utilities for configuring Cloudflare Workers and related products. This is not yet stable enough for external use — APIs may change without notice.",
5
5
  "homepage": "https://github.com/cloudflare/workers-sdk/tree/main/packages/config#readme",
6
6
  "bugs": {
@@ -37,7 +37,7 @@
37
37
  "typescript": "5.8.3",
38
38
  "vitest": "4.1.0",
39
39
  "@cloudflare/workers-tsconfig": "0.0.0",
40
- "@cloudflare/workers-utils": "0.26.0"
40
+ "@cloudflare/workers-utils": "0.27.0"
41
41
  },
42
42
  "workers-sdk": {
43
43
  "prerelease": true