utiller 1.0.303 → 1.0.304
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.
|
@@ -1939,6 +1939,31 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
1939
1939
|
}
|
|
1940
1940
|
return false;
|
|
1941
1941
|
}
|
|
1942
|
+
}, {
|
|
1943
|
+
key: "joinRespectingDot",
|
|
1944
|
+
value:
|
|
1945
|
+
/**
|
|
1946
|
+
* console.log(joinRespectingDot('./temp', 'scs', 'qqq', 'as.js'));
|
|
1947
|
+
* // ./temp/scs/qqq/as.js
|
|
1948
|
+
*
|
|
1949
|
+
* console.log(joinRespectingDot('temp', 'scs', 'qqq', 'as.js'));
|
|
1950
|
+
* // temp/scs/qqq/as.js
|
|
1951
|
+
*
|
|
1952
|
+
* console.log(joinRespectingDot('/usr', 'local', 'bin'));
|
|
1953
|
+
* // /usr/local/bin
|
|
1954
|
+
*
|
|
1955
|
+
* 讓./組合的path 不要因為join被拿掉 產生在本機根目錄 /src 的權限問題
|
|
1956
|
+
*/
|
|
1957
|
+
function joinRespectingDot() {
|
|
1958
|
+
var _args$, _args$2;
|
|
1959
|
+
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
|
1960
|
+
args[_key12] = arguments[_key12];
|
|
1961
|
+
}
|
|
1962
|
+
var shouldHaveDotSlash = (_args$ = args[0]) === null || _args$ === void 0 ? void 0 : _args$.startsWith("./");
|
|
1963
|
+
var cleanArgs = (_args$2 = args[0]) !== null && _args$2 !== void 0 && _args$2.startsWith("./") ? [args[0].slice(2)].concat((0, _toConsumableArray2["default"])(args.slice(1))) : args;
|
|
1964
|
+
var joined = _path4["default"].join.apply(_path4["default"], (0, _toConsumableArray2["default"])(cleanArgs));
|
|
1965
|
+
return shouldHaveDotSlash && !_path4["default"].isAbsolute(joined) ? "./".concat(joined) : joined;
|
|
1966
|
+
}
|
|
1942
1967
|
}]);
|
|
1943
1968
|
}(_index["default"]);
|
|
1944
1969
|
var _default = exports["default"] = NodeUtiller;
|
package/package.json
CHANGED