@solid-stack/mason 1.0.17 → 1.0.18

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/bin.cjs CHANGED
@@ -175,7 +175,7 @@ function getEffectiveMode(projectRoot, flags) {
175
175
  if (flags?.registry) return "registry";
176
176
  const config = loadMasonConfig(projectRoot);
177
177
  if (config?.mode) return config.mode;
178
- if (fs9__default.default.existsSync(path2__default.default.join(projectRoot, "index.json")) && (fs9__default.default.existsSync(path2__default.default.join(projectRoot, "features")) || fs9__default.default.existsSync(path2__default.default.join(projectRoot, "shared"))) && !fs9__default.default.existsSync(path2__default.default.join(projectRoot, "src"))) {
178
+ if (fs9__default.default.existsSync(path2__default.default.join(projectRoot, "index.json")) && (fs9__default.default.existsSync(path2__default.default.join(projectRoot, "features")) || fs9__default.default.existsSync(path2__default.default.join(projectRoot, "shared")) || fs9__default.default.existsSync(path2__default.default.join(projectRoot, "src/features")) || fs9__default.default.existsSync(path2__default.default.join(projectRoot, "src/shared")))) {
179
179
  return "registry";
180
180
  }
181
181
  return "app";
@@ -189,6 +189,9 @@ function getConfiguredFeaturesDir(projectRoot, flags) {
189
189
  }
190
190
  const mode = getEffectiveMode(projectRoot, flags);
191
191
  if (mode === "registry") {
192
+ if (fs9__default.default.existsSync(path2__default.default.join(projectRoot, "src/features"))) {
193
+ return path2__default.default.join(projectRoot, "src/features");
194
+ }
192
195
  return path2__default.default.join(projectRoot, "features");
193
196
  }
194
197
  if (fs9__default.default.existsSync(path2__default.default.join(projectRoot, "src/features"))) {
@@ -205,6 +208,9 @@ function getConfiguredSharedDir(projectRoot, flags) {
205
208
  }
206
209
  const mode = getEffectiveMode(projectRoot, flags);
207
210
  if (mode === "registry") {
211
+ if (fs9__default.default.existsSync(path2__default.default.join(projectRoot, "src/shared"))) {
212
+ return path2__default.default.join(projectRoot, "src/shared");
213
+ }
208
214
  return path2__default.default.join(projectRoot, "shared");
209
215
  }
210
216
  if (fs9__default.default.existsSync(path2__default.default.join(projectRoot, "src/shared"))) {
@@ -3432,7 +3438,14 @@ async function fetchRegistryFile(registryBase, relPath) {
3432
3438
  if (token) {
3433
3439
  headers["Authorization"] = `Bearer ${token}`;
3434
3440
  }
3435
- const res = await fetch(url, { headers });
3441
+ let res = await fetch(url, { headers });
3442
+ if (!res.ok && res.status === 404 && !cleanRelPath.startsWith("src/")) {
3443
+ const srcUrl = `${registryBase.replace(/\/+$/, "")}/src/${cleanRelPath}`;
3444
+ const srcRes = await fetch(srcUrl, { headers });
3445
+ if (srcRes.ok) {
3446
+ res = srcRes;
3447
+ }
3448
+ }
3436
3449
  if (!res.ok) {
3437
3450
  let extraHint = "";
3438
3451
  if (res.status === 404) {
@@ -3452,9 +3465,14 @@ async function fetchRegistryFile(registryBase, relPath) {
3452
3465
  if (baseDir.startsWith("file://")) {
3453
3466
  baseDir = url.fileURLToPath(baseDir);
3454
3467
  }
3455
- const filePath = path2__default.default.resolve(baseDir, cleanRelPath);
3468
+ let filePath = path2__default.default.resolve(baseDir, cleanRelPath);
3456
3469
  if (!fs9__default.default.existsSync(filePath)) {
3457
- throw new Error(`Registry file not found at ${filePath}`);
3470
+ const inSrcPath = path2__default.default.resolve(baseDir, "src", cleanRelPath);
3471
+ if (fs9__default.default.existsSync(inSrcPath)) {
3472
+ filePath = inSrcPath;
3473
+ } else {
3474
+ throw new Error(`Registry file not found at ${filePath}`);
3475
+ }
3458
3476
  }
3459
3477
  return fs9__default.default.promises.readFile(filePath, "utf-8");
3460
3478
  }
@@ -3622,11 +3640,18 @@ function rewriteImports(content, aliasMap) {
3622
3640
  return rewritten;
3623
3641
  }
3624
3642
  function getModuleBaseDir(projectRoot, modType) {
3643
+ const mode = getEffectiveMode(projectRoot);
3644
+ if (mode === "registry") {
3645
+ return modType === "shared" ? getConfiguredSharedDir(projectRoot) : getConfiguredFeaturesDir(projectRoot);
3646
+ }
3625
3647
  const folder = modType === "shared" ? "shared" : "features";
3626
3648
  return path2__default.default.join(projectRoot, "src", folder);
3627
3649
  }
3628
3650
  function getExistingModuleDir(projectRoot, modType, modName) {
3629
3651
  const folder = modType === "shared" ? "shared" : "features";
3652
+ const configuredDir = modType === "shared" ? getConfiguredSharedDir(projectRoot) : getConfiguredFeaturesDir(projectRoot);
3653
+ const inConfigured = path2__default.default.join(configuredDir, modName);
3654
+ if (fs9__default.default.existsSync(inConfigured)) return inConfigured;
3630
3655
  const inSrc = path2__default.default.join(projectRoot, "src", folder, modName);
3631
3656
  if (fs9__default.default.existsSync(inSrc)) return inSrc;
3632
3657
  const inRoot = path2__default.default.join(projectRoot, folder, modName);
@@ -3638,7 +3663,9 @@ function checkModuleExists(projectRoot, modType, modName) {
3638
3663
  }
3639
3664
  function getAvailableLocalModules(projectRoot, modType) {
3640
3665
  const folder = modType === "shared" ? "shared" : "features";
3666
+ const configuredDir = modType === "shared" ? getConfiguredSharedDir(projectRoot) : getConfiguredFeaturesDir(projectRoot);
3641
3667
  const dirs = [
3668
+ configuredDir,
3642
3669
  path2__default.default.join(projectRoot, "src", folder),
3643
3670
  path2__default.default.join(projectRoot, folder)
3644
3671
  ];
@@ -4267,7 +4294,7 @@ function createCli() {
4267
4294
  });
4268
4295
  }
4269
4296
  cli.help();
4270
- cli.version("1.0.17");
4297
+ cli.version("1.0.18");
4271
4298
  return cli;
4272
4299
  }
4273
4300
  function handleCliError(err) {