@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.
package/dist/cli/bin.js CHANGED
@@ -3858,6 +3858,20 @@ function fromJsonFile(path) {
3858
3858
  }
3859
3859
 
3860
3860
  // src/cli/fleet/resolve-sites.ts
3861
+ init_url();
3862
+ function sanitizeDynamicSites(sites) {
3863
+ return sites.map((s) => {
3864
+ if (s.deployedUrl !== void 0 && !isHttpUrl(s.deployedUrl)) {
3865
+ console.warn(
3866
+ `[inventory] dynamic inventory: ignoring deployedUrl that is not http(s) for ${s.name ?? s.path}: ${JSON.stringify(s.deployedUrl)}`
3867
+ );
3868
+ const copy = { ...s };
3869
+ delete copy.deployedUrl;
3870
+ return copy;
3871
+ }
3872
+ return s;
3873
+ });
3874
+ }
3861
3875
  async function resolveSites(input) {
3862
3876
  if (input.site && input.fleet) {
3863
3877
  throw Object.assign(new Error("cannot combine a positional [site] with --fleet"), {
@@ -3874,24 +3888,22 @@ async function resolveSites(input) {
3874
3888
  if (input.fleet) {
3875
3889
  const fleetPath = resolve(input.cwd, input.fleet);
3876
3890
  const ext = extname(fleetPath).toLowerCase();
3877
- let provider;
3878
3891
  if (ext === ".json") {
3879
- provider = fromJsonFile(fleetPath);
3880
- } else if (ext === ".js" || ext === ".mjs" || ext === ".cjs") {
3892
+ return fromJsonFile(fleetPath)();
3893
+ }
3894
+ if (ext === ".js" || ext === ".mjs" || ext === ".cjs") {
3881
3895
  const mod = await import(pathToFileURL(fleetPath).href);
3882
3896
  if (!mod.default || typeof mod.default !== "function") {
3883
3897
  throw Object.assign(new Error(`--fleet ${input.fleet}: default export is not a function`), {
3884
3898
  exitCode: 2
3885
3899
  });
3886
3900
  }
3887
- provider = mod.default;
3888
- } else {
3889
- throw Object.assign(
3890
- new Error(`--fleet ${input.fleet}: unsupported extension ${ext || "(none)"}`),
3891
- { exitCode: 2 }
3892
- );
3901
+ return sanitizeDynamicSites(await mod.default());
3893
3902
  }
3894
- return provider();
3903
+ throw Object.assign(
3904
+ new Error(`--fleet ${input.fleet}: unsupported extension ${ext || "(none)"}`),
3905
+ { exitCode: 2 }
3906
+ );
3895
3907
  }
3896
3908
  return localPath(resolve(input.cwd, input.site ?? input.cwd))();
3897
3909
  }