@adviser/cement 0.4.4 → 0.4.5
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/index.cjs +14 -6
- package/index.cjs.map +1 -1
- package/index.js +14 -6
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +1 -1
- package/src/jsr.json +1 -1
- package/src/path-ops.ts +21 -6
- package/ts/src/path-ops.d.ts.map +1 -1
- package/ts/src/path-ops.js +17 -6
- package/ts/src/path-ops.js.map +1 -1
- package/ts/src/path-ops.test.js +20 -4
- package/ts/src/path-ops.test.js.map +1 -1
package/index.cjs
CHANGED
@@ -3579,7 +3579,11 @@ var pathOpsImpl = class {
|
|
3579
3579
|
__privateAdd(this, _pathOpsImpl_instances);
|
3580
3580
|
}
|
3581
3581
|
join(...paths) {
|
3582
|
-
|
3582
|
+
const parts = __privateMethod(this, _pathOpsImpl_instances, parts_fn).call(this, paths.filter((i) => i).join("/"));
|
3583
|
+
if (parts.dirname === "" || parts.dirname === ".") {
|
3584
|
+
return parts.basename ? parts.basename : ".";
|
3585
|
+
}
|
3586
|
+
return parts.dirname + "/" + parts.basename;
|
3583
3587
|
}
|
3584
3588
|
dirname(path) {
|
3585
3589
|
return __privateMethod(this, _pathOpsImpl_instances, parts_fn).call(this, path).dirname;
|
@@ -3590,14 +3594,18 @@ var pathOpsImpl = class {
|
|
3590
3594
|
};
|
3591
3595
|
_pathOpsImpl_instances = new WeakSet();
|
3592
3596
|
parts_fn = function(path) {
|
3597
|
+
path = path.replace(/\/+/g, "/").replace(/(\/\.\/)+/g, "/").replace(/\/+$/, "");
|
3593
3598
|
const splitted = path.split("/");
|
3594
|
-
|
3595
|
-
|
3596
|
-
|
3599
|
+
if (splitted.length === 1) {
|
3600
|
+
return {
|
3601
|
+
dirname: ".",
|
3602
|
+
basename: splitted[0] === "." ? "" : splitted[0]
|
3603
|
+
};
|
3597
3604
|
}
|
3605
|
+
const basename = splitted.pop();
|
3598
3606
|
return {
|
3599
|
-
dirname:
|
3600
|
-
basename
|
3607
|
+
dirname: splitted.join("/").replace(/^\.\//, ""),
|
3608
|
+
basename
|
3601
3609
|
};
|
3602
3610
|
};
|
3603
3611
|
var pathOps = new pathOpsImpl();
|