@slim-lang/core 1.2.3 → 1.2.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/package.json +1 -1
- package/src/modulePaths.js +17 -3
package/package.json
CHANGED
package/src/modulePaths.js
CHANGED
|
@@ -49,9 +49,23 @@ export function getDistPath(slimFile) {
|
|
|
49
49
|
const abs = path.resolve(slimFile)
|
|
50
50
|
const srcRoot = path.resolve("src")
|
|
51
51
|
const projectRoot = path.resolve(".")
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const shippedPackages = path.join(PACKAGE_ROOT, "packages")
|
|
53
|
+
const projectPackages = projectPackagesDir()
|
|
54
|
+
|
|
55
|
+
let relative
|
|
56
|
+
|
|
57
|
+
if (isWithin(shippedPackages, abs)) {
|
|
58
|
+
relative = path.join("packages", path.relative(shippedPackages, abs))
|
|
59
|
+
} else if (isWithin(projectPackages, abs)) {
|
|
60
|
+
relative = path.join(path.basename(projectPackages), path.relative(projectPackages, abs))
|
|
61
|
+
} else if (isWithin(srcRoot, abs)) {
|
|
62
|
+
relative = path.relative(srcRoot, abs)
|
|
63
|
+
} else if (isWithin(projectRoot, abs)) {
|
|
64
|
+
relative = path.relative(projectRoot, abs)
|
|
65
|
+
} else {
|
|
66
|
+
const stripped = path.relative(projectRoot, abs).split(path.sep).filter(seg => seg !== "..")
|
|
67
|
+
relative = stripped.length ? path.join(...stripped) : path.basename(abs)
|
|
68
|
+
}
|
|
55
69
|
|
|
56
70
|
return path.resolve("dist", relative.replace(/\.slim$/, ".js"))
|
|
57
71
|
}
|