@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 +32 -5
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +32 -5
- package/dist/bin.js.map +1 -1
- package/dist/commands/import.d.ts +2 -2
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/index.cjs +32 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/registry.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -146,7 +146,7 @@ function getEffectiveMode(projectRoot, flags) {
|
|
|
146
146
|
if (flags?.registry) return "registry";
|
|
147
147
|
const config = loadMasonConfig(projectRoot);
|
|
148
148
|
if (config?.mode) return config.mode;
|
|
149
|
-
if (fs9.existsSync(path2.join(projectRoot, "index.json")) && (fs9.existsSync(path2.join(projectRoot, "features")) || fs9.existsSync(path2.join(projectRoot, "shared")))
|
|
149
|
+
if (fs9.existsSync(path2.join(projectRoot, "index.json")) && (fs9.existsSync(path2.join(projectRoot, "features")) || fs9.existsSync(path2.join(projectRoot, "shared")) || fs9.existsSync(path2.join(projectRoot, "src/features")) || fs9.existsSync(path2.join(projectRoot, "src/shared")))) {
|
|
150
150
|
return "registry";
|
|
151
151
|
}
|
|
152
152
|
return "app";
|
|
@@ -160,6 +160,9 @@ function getConfiguredFeaturesDir(projectRoot, flags) {
|
|
|
160
160
|
}
|
|
161
161
|
const mode = getEffectiveMode(projectRoot, flags);
|
|
162
162
|
if (mode === "registry") {
|
|
163
|
+
if (fs9.existsSync(path2.join(projectRoot, "src/features"))) {
|
|
164
|
+
return path2.join(projectRoot, "src/features");
|
|
165
|
+
}
|
|
163
166
|
return path2.join(projectRoot, "features");
|
|
164
167
|
}
|
|
165
168
|
if (fs9.existsSync(path2.join(projectRoot, "src/features"))) {
|
|
@@ -176,6 +179,9 @@ function getConfiguredSharedDir(projectRoot, flags) {
|
|
|
176
179
|
}
|
|
177
180
|
const mode = getEffectiveMode(projectRoot, flags);
|
|
178
181
|
if (mode === "registry") {
|
|
182
|
+
if (fs9.existsSync(path2.join(projectRoot, "src/shared"))) {
|
|
183
|
+
return path2.join(projectRoot, "src/shared");
|
|
184
|
+
}
|
|
179
185
|
return path2.join(projectRoot, "shared");
|
|
180
186
|
}
|
|
181
187
|
if (fs9.existsSync(path2.join(projectRoot, "src/shared"))) {
|
|
@@ -3403,7 +3409,14 @@ async function fetchRegistryFile(registryBase, relPath) {
|
|
|
3403
3409
|
if (token) {
|
|
3404
3410
|
headers["Authorization"] = `Bearer ${token}`;
|
|
3405
3411
|
}
|
|
3406
|
-
|
|
3412
|
+
let res = await fetch(url, { headers });
|
|
3413
|
+
if (!res.ok && res.status === 404 && !cleanRelPath.startsWith("src/")) {
|
|
3414
|
+
const srcUrl = `${registryBase.replace(/\/+$/, "")}/src/${cleanRelPath}`;
|
|
3415
|
+
const srcRes = await fetch(srcUrl, { headers });
|
|
3416
|
+
if (srcRes.ok) {
|
|
3417
|
+
res = srcRes;
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3407
3420
|
if (!res.ok) {
|
|
3408
3421
|
let extraHint = "";
|
|
3409
3422
|
if (res.status === 404) {
|
|
@@ -3423,9 +3436,14 @@ async function fetchRegistryFile(registryBase, relPath) {
|
|
|
3423
3436
|
if (baseDir.startsWith("file://")) {
|
|
3424
3437
|
baseDir = fileURLToPath(baseDir);
|
|
3425
3438
|
}
|
|
3426
|
-
|
|
3439
|
+
let filePath = path2.resolve(baseDir, cleanRelPath);
|
|
3427
3440
|
if (!fs9.existsSync(filePath)) {
|
|
3428
|
-
|
|
3441
|
+
const inSrcPath = path2.resolve(baseDir, "src", cleanRelPath);
|
|
3442
|
+
if (fs9.existsSync(inSrcPath)) {
|
|
3443
|
+
filePath = inSrcPath;
|
|
3444
|
+
} else {
|
|
3445
|
+
throw new Error(`Registry file not found at ${filePath}`);
|
|
3446
|
+
}
|
|
3429
3447
|
}
|
|
3430
3448
|
return fs9.promises.readFile(filePath, "utf-8");
|
|
3431
3449
|
}
|
|
@@ -3593,11 +3611,18 @@ function rewriteImports(content, aliasMap) {
|
|
|
3593
3611
|
return rewritten;
|
|
3594
3612
|
}
|
|
3595
3613
|
function getModuleBaseDir(projectRoot, modType) {
|
|
3614
|
+
const mode = getEffectiveMode(projectRoot);
|
|
3615
|
+
if (mode === "registry") {
|
|
3616
|
+
return modType === "shared" ? getConfiguredSharedDir(projectRoot) : getConfiguredFeaturesDir(projectRoot);
|
|
3617
|
+
}
|
|
3596
3618
|
const folder = modType === "shared" ? "shared" : "features";
|
|
3597
3619
|
return path2.join(projectRoot, "src", folder);
|
|
3598
3620
|
}
|
|
3599
3621
|
function getExistingModuleDir(projectRoot, modType, modName) {
|
|
3600
3622
|
const folder = modType === "shared" ? "shared" : "features";
|
|
3623
|
+
const configuredDir = modType === "shared" ? getConfiguredSharedDir(projectRoot) : getConfiguredFeaturesDir(projectRoot);
|
|
3624
|
+
const inConfigured = path2.join(configuredDir, modName);
|
|
3625
|
+
if (fs9.existsSync(inConfigured)) return inConfigured;
|
|
3601
3626
|
const inSrc = path2.join(projectRoot, "src", folder, modName);
|
|
3602
3627
|
if (fs9.existsSync(inSrc)) return inSrc;
|
|
3603
3628
|
const inRoot = path2.join(projectRoot, folder, modName);
|
|
@@ -3609,7 +3634,9 @@ function checkModuleExists(projectRoot, modType, modName) {
|
|
|
3609
3634
|
}
|
|
3610
3635
|
function getAvailableLocalModules(projectRoot, modType) {
|
|
3611
3636
|
const folder = modType === "shared" ? "shared" : "features";
|
|
3637
|
+
const configuredDir = modType === "shared" ? getConfiguredSharedDir(projectRoot) : getConfiguredFeaturesDir(projectRoot);
|
|
3612
3638
|
const dirs = [
|
|
3639
|
+
configuredDir,
|
|
3613
3640
|
path2.join(projectRoot, "src", folder),
|
|
3614
3641
|
path2.join(projectRoot, folder)
|
|
3615
3642
|
];
|
|
@@ -4238,7 +4265,7 @@ function createCli() {
|
|
|
4238
4265
|
});
|
|
4239
4266
|
}
|
|
4240
4267
|
cli.help();
|
|
4241
|
-
cli.version("1.0.
|
|
4268
|
+
cli.version("1.0.18");
|
|
4242
4269
|
return cli;
|
|
4243
4270
|
}
|
|
4244
4271
|
function handleCliError(err) {
|