@reliverse/pathkit 1.1.2 → 1.1.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/README.md +1 -1
- package/bin/mod.js +4 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
- ⚙️ **node.js api compatible** – familiar methods, no learning curve
|
|
13
13
|
- 🚀 **modern & fast** – typescript, pure esm, bun & node‑ready
|
|
14
14
|
- 🧠 **predictable & testable** – deterministic output across windows / macos / linux
|
|
15
|
-
- 🧼 **no dependencies** – just better path api + couple of cool utilities = [
|
|
15
|
+
- 🧼 **no dependencies** – just better path api + couple of cool utilities = [5kB](https://bundlephobia.com/package/@reliverse/pathkit@latest)
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
package/bin/mod.js
CHANGED
|
@@ -14,7 +14,7 @@ const UNC_REGEX = /^[/\\]{2}/;
|
|
|
14
14
|
const IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
15
15
|
const ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
16
16
|
const PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
17
|
-
const IMPORT_REGEX = /(?:import\s+(?:[\s\S]*?)\s+from\s+|import\s*\(\s*)\s*(['"])(
|
|
17
|
+
const IMPORT_REGEX = /(?:import\s+(?:[\s\S]*?)\s+from\s+|import\s*\(\s*)\s*(['"])([^'"]+)\1/g;
|
|
18
18
|
async function cleanDirs(dirs) {
|
|
19
19
|
await Promise.all(
|
|
20
20
|
dirs.map(async (d) => {
|
|
@@ -492,10 +492,7 @@ async function processFile(filePath, aliasToReplace, targetDir, pathExtFilter) {
|
|
|
492
492
|
for (const match of matches) {
|
|
493
493
|
const originalQuote = match[1];
|
|
494
494
|
const importPath = match[2];
|
|
495
|
-
if (!importPath.startsWith(baseAlias)
|
|
496
|
-
continue;
|
|
497
|
-
}
|
|
498
|
-
if (importPath.startsWith("@") && !importPath.startsWith(baseAlias)) {
|
|
495
|
+
if (!importPath.startsWith(baseAlias)) {
|
|
499
496
|
continue;
|
|
500
497
|
}
|
|
501
498
|
const importExt = extname(importPath);
|
|
@@ -778,8 +775,8 @@ async function stripPathSegmentsInDirectory({
|
|
|
778
775
|
logInternal(` - skipping non-path import: ${importPath}`);
|
|
779
776
|
continue;
|
|
780
777
|
}
|
|
781
|
-
if (
|
|
782
|
-
logInternal(` - skipping
|
|
778
|
+
if (alias && !importPath.startsWith(alias.replace("/*", ""))) {
|
|
779
|
+
logInternal(` - skipping non-alias import: ${importPath}`);
|
|
783
780
|
continue;
|
|
784
781
|
}
|
|
785
782
|
logInternal(` Processing import: ${importPath}`);
|