prodex 1.4.5 → 1.4.6
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.
|
@@ -16,7 +16,7 @@ const store_1 = require("../../store");
|
|
|
16
16
|
*/
|
|
17
17
|
class ConfigManager {
|
|
18
18
|
static rawFile = null;
|
|
19
|
-
static load(cwd) {
|
|
19
|
+
static load(cwd = process.cwd()) {
|
|
20
20
|
const file = path_1.default.join(cwd, "prodex.json");
|
|
21
21
|
if (!fs_1.default.existsSync(file))
|
|
22
22
|
return default_config_1.DEFAULT_PRODEX_CONFIG;
|
|
@@ -43,7 +43,7 @@ async function resolveJsImports({ filePath, visited = new Set(), depth = 0, maxD
|
|
|
43
43
|
// skip bare packages (react, lodash, etc.)
|
|
44
44
|
if (!imp.startsWith(".") && !imp.startsWith("/") && !imp.startsWith("@"))
|
|
45
45
|
continue;
|
|
46
|
-
if ((0, shared_1.isExcluded)(imp, excludePatterns))
|
|
46
|
+
if ((0, shared_1.isExcluded)(imp, excludePatterns, ROOT))
|
|
47
47
|
continue;
|
|
48
48
|
let base = null;
|
|
49
49
|
if (imp.startsWith(".")) {
|
|
@@ -62,11 +62,11 @@ async function resolveJsImports({ filePath, visited = new Set(), depth = 0, maxD
|
|
|
62
62
|
continue;
|
|
63
63
|
const absBase = path_1.default.resolve(base);
|
|
64
64
|
// Exclusion check after alias resolution
|
|
65
|
-
if ((0, shared_1.isExcluded)(absBase, excludePatterns))
|
|
65
|
+
if ((0, shared_1.isExcluded)(absBase, excludePatterns, ROOT))
|
|
66
66
|
continue;
|
|
67
67
|
const resolvedPath = await tryResolveImport(absBase);
|
|
68
68
|
// Exclusion check after final resolution
|
|
69
|
-
if ((0, shared_1.isExcluded)(resolvedPath, excludePatterns))
|
|
69
|
+
if ((0, shared_1.isExcluded)(resolvedPath, excludePatterns, ROOT))
|
|
70
70
|
continue;
|
|
71
71
|
stats.expected.add(absBase);
|
|
72
72
|
if (!resolvedPath)
|
|
@@ -70,12 +70,11 @@ async function resolvePhpImports({ filePath, visited = new Set(), depth = 0, max
|
|
|
70
70
|
// Only resolve PSR-4 mapped namespaces
|
|
71
71
|
if (!startsWithAnyNamespace(imp, phpCtx.nsKeys))
|
|
72
72
|
continue;
|
|
73
|
-
if (
|
|
74
|
-
continue;
|
|
73
|
+
// if (isExcluded(imp, excludePatterns, ROOT)) continue;
|
|
75
74
|
// Resolve namespace → file path (sync helper retained)
|
|
76
75
|
const resolvedPath = await tryResolvePhpFile(imp, filePath, phpCtx.psr4);
|
|
77
76
|
// Exclusion check after final resolution
|
|
78
|
-
if ((0, shared_1.isExcluded)(resolvedPath, excludePatterns))
|
|
77
|
+
if ((0, shared_1.isExcluded)(resolvedPath, excludePatterns, ROOT))
|
|
79
78
|
continue;
|
|
80
79
|
stats.expected.add(imp);
|
|
81
80
|
if (!resolvedPath)
|
package/dist/shared/patterns.js
CHANGED
|
@@ -7,17 +7,34 @@ exports.isExcluded = isExcluded;
|
|
|
7
7
|
exports.makeExcludeMatcher = makeExcludeMatcher;
|
|
8
8
|
// File: src/shared/patterns.ts
|
|
9
9
|
const micromatch_1 = __importDefault(require("micromatch"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const _1 = require(".");
|
|
10
12
|
/**
|
|
11
13
|
* Returns true if a given path matches any of the provided glob patterns.
|
|
12
14
|
* Equivalent to core/helpers.isExcluded().
|
|
13
15
|
*/
|
|
14
|
-
function isExcluded(p = "", patterns = [], root = process.cwd()) {
|
|
16
|
+
// export function isExcluded(p: string = "", patterns: string[] = [], root = process.cwd()): boolean {
|
|
17
|
+
// if (!patterns?.length) return false;
|
|
18
|
+
// if (!p) return false;
|
|
19
|
+
// const relPath = p.replaceAll("\\", "/");
|
|
20
|
+
// return micromatch.isMatch(relPath, patterns);
|
|
21
|
+
// }
|
|
22
|
+
/**
|
|
23
|
+
* Centralized exclusion logic.
|
|
24
|
+
* Accepts namespaces, absolute paths, or relative paths
|
|
25
|
+
* and converts everything to a normalized, root-relative glob target.
|
|
26
|
+
*/
|
|
27
|
+
function isExcluded(p, patterns = [], root = process.cwd()) {
|
|
15
28
|
if (!patterns?.length)
|
|
16
29
|
return false;
|
|
17
30
|
if (!p)
|
|
18
31
|
return false;
|
|
19
|
-
|
|
20
|
-
|
|
32
|
+
let norm = p.norm();
|
|
33
|
+
if (!path_1.default.isAbsolute(norm) && /^[A-Z]/.test(norm))
|
|
34
|
+
return false;
|
|
35
|
+
if (path_1.default.isAbsolute(norm))
|
|
36
|
+
norm = (0, _1.rel)(norm, root).norm();
|
|
37
|
+
return micromatch_1.default.isMatch(norm, patterns);
|
|
21
38
|
}
|
|
22
39
|
/**
|
|
23
40
|
* Builds a reusable micromatch matcher for efficiency.
|