@mbler/mcx-core 0.0.8-rc.2 → 0.0.8-rc.3
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/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -11090,20 +11090,21 @@ function mcxPlugn(opt, output) {
|
|
|
11090
11090
|
return null;
|
|
11091
11091
|
}
|
|
11092
11092
|
else {
|
|
11093
|
+
const isScopedPackage = id.startsWith("@");
|
|
11093
11094
|
const parts = id.split("/");
|
|
11094
|
-
const pkgName = parts[0];
|
|
11095
|
-
const subPath = parts.slice(1).join("/");
|
|
11095
|
+
const pkgName = isScopedPackage ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
11096
|
+
const subPath = isScopedPackage ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
11096
11097
|
const d = path.join(opt.moduleDir, pkgName);
|
|
11097
11098
|
let pkgJson;
|
|
11098
11099
|
try {
|
|
11099
11100
|
pkgJson = JSON.parse(await fs.readFile(path.join(d, "package.json"), "utf-8"));
|
|
11100
11101
|
}
|
|
11101
11102
|
catch (err) {
|
|
11102
|
-
if (err.code === "ENOENT") {
|
|
11103
|
-
throw new Error(`[mcx resolveId]
|
|
11103
|
+
if (!err.code || err.code === "ENOENT") {
|
|
11104
|
+
throw new Error(`[mcx resolveId]: package.json not found for '${id}' at '${d}'`);
|
|
11104
11105
|
}
|
|
11105
11106
|
else {
|
|
11106
|
-
throw new Error(`[mcx resolveId]
|
|
11107
|
+
throw new Error(`[mcx resolveId]: invalid package.json for '${id}': ${err.message}`);
|
|
11107
11108
|
}
|
|
11108
11109
|
}
|
|
11109
11110
|
if (subPath) {
|