@reddoorla/maintenance 0.54.3 → 0.54.4

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.
@@ -2104,6 +2104,20 @@ function fromJsonFile(path) {
2104
2104
  }
2105
2105
 
2106
2106
  // src/cli/fleet/resolve-sites.ts
2107
+ init_url();
2108
+ function sanitizeDynamicSites(sites) {
2109
+ return sites.map((s) => {
2110
+ if (s.deployedUrl !== void 0 && !isHttpUrl(s.deployedUrl)) {
2111
+ console.warn(
2112
+ `[inventory] dynamic inventory: ignoring deployedUrl that is not http(s) for ${s.name ?? s.path}: ${JSON.stringify(s.deployedUrl)}`
2113
+ );
2114
+ const copy = { ...s };
2115
+ delete copy.deployedUrl;
2116
+ return copy;
2117
+ }
2118
+ return s;
2119
+ });
2120
+ }
2107
2121
  async function resolveSites(input) {
2108
2122
  if (input.site && input.fleet) {
2109
2123
  throw Object.assign(new Error("cannot combine a positional [site] with --fleet"), {
@@ -2120,24 +2134,22 @@ async function resolveSites(input) {
2120
2134
  if (input.fleet) {
2121
2135
  const fleetPath = resolve(input.cwd, input.fleet);
2122
2136
  const ext = extname(fleetPath).toLowerCase();
2123
- let provider;
2124
2137
  if (ext === ".json") {
2125
- provider = fromJsonFile(fleetPath);
2126
- } else if (ext === ".js" || ext === ".mjs" || ext === ".cjs") {
2138
+ return fromJsonFile(fleetPath)();
2139
+ }
2140
+ if (ext === ".js" || ext === ".mjs" || ext === ".cjs") {
2127
2141
  const mod = await import(pathToFileURL(fleetPath).href);
2128
2142
  if (!mod.default || typeof mod.default !== "function") {
2129
2143
  throw Object.assign(new Error(`--fleet ${input.fleet}: default export is not a function`), {
2130
2144
  exitCode: 2
2131
2145
  });
2132
2146
  }
2133
- provider = mod.default;
2134
- } else {
2135
- throw Object.assign(
2136
- new Error(`--fleet ${input.fleet}: unsupported extension ${ext || "(none)"}`),
2137
- { exitCode: 2 }
2138
- );
2147
+ return sanitizeDynamicSites(await mod.default());
2139
2148
  }
2140
- return provider();
2149
+ throw Object.assign(
2150
+ new Error(`--fleet ${input.fleet}: unsupported extension ${ext || "(none)"}`),
2151
+ { exitCode: 2 }
2152
+ );
2141
2153
  }
2142
2154
  return localPath(resolve(input.cwd, input.site ?? input.cwd))();
2143
2155
  }