gitnexus 1.6.12-rc.2 → 1.6.12-rc.21
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/dist/_shared/graph/types.d.ts +1 -1
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/language-detection.d.ts.map +1 -1
- package/dist/_shared/language-detection.js +2 -0
- package/dist/_shared/language-detection.js.map +1 -1
- package/dist/_shared/languages.d.ts +1 -0
- package/dist/_shared/languages.d.ts.map +1 -1
- package/dist/_shared/languages.js +1 -0
- package/dist/_shared/languages.js.map +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts.map +1 -1
- package/dist/_shared/lbug/schema-constants.js +2 -0
- package/dist/_shared/lbug/schema-constants.js.map +1 -1
- package/dist/_shared/scope-resolution/language-classification.d.ts +2 -1
- package/dist/_shared/scope-resolution/language-classification.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/language-classification.js +3 -1
- package/dist/_shared/scope-resolution/language-classification.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/class-registry.d.ts +3 -3
- package/dist/_shared/scope-resolution/registries/class-registry.js +3 -3
- package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.js +2 -0
- package/dist/_shared/scope-resolution/registries/context.js.map +1 -1
- package/dist/_shared/scope-resolution/resolve-type-ref.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/resolve-type-ref.js +2 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.js.map +1 -1
- package/dist/cli/analyze-config.d.ts +2 -2
- package/dist/cli/analyze-config.js +10 -33
- package/dist/cli/doctor.js +6 -4
- package/dist/cli/eval-server.js +13 -1
- package/dist/cli/i18n/en.d.ts +4 -2
- package/dist/cli/i18n/en.js +4 -2
- package/dist/cli/i18n/resources.d.ts +6 -2
- package/dist/cli/i18n/zh-CN.d.ts +2 -0
- package/dist/cli/i18n/zh-CN.js +4 -2
- package/dist/core/analysis-feature-registry.d.ts +1 -1
- package/dist/core/analysis-feature-registry.js +2 -0
- package/dist/core/auto-sync/starter.js +2 -2
- package/dist/core/embeddings/ast-utils.js +8 -3
- package/dist/core/embeddings/chunker.js +67 -10
- package/dist/core/embeddings/embedding-pipeline.d.ts +1 -1
- package/dist/core/embeddings/embedding-pipeline.js +1 -1
- package/dist/core/embeddings/structural-extractor.js +2 -2
- package/dist/core/embeddings/types.d.ts +4 -2
- package/dist/core/embeddings/types.js +18 -0
- package/dist/core/git-ref.d.ts +22 -0
- package/dist/core/git-ref.js +114 -0
- package/dist/core/git-staleness.js +14 -0
- package/dist/core/group/extractors/graphql-extractor.d.ts +1 -1
- package/dist/core/group/extractors/graphql-extractor.js +149 -13
- package/dist/core/group/extractors/manifest-extractor.d.ts +1 -1
- package/dist/core/group/extractors/manifest-extractor.js +2 -2
- package/dist/core/ingestion/call-extractors/zig-static-gating.d.ts +5 -8
- package/dist/core/ingestion/content-language-classification.d.ts +10 -0
- package/dist/core/ingestion/content-language-classification.js +30 -0
- package/dist/core/ingestion/filesystem-walker.d.ts +1 -0
- package/dist/core/ingestion/filesystem-walker.js +1 -1
- package/dist/core/ingestion/import-resolvers/node-workspace-packages.js +3 -2
- package/dist/core/ingestion/language-config.d.ts +82 -13
- package/dist/core/ingestion/language-config.js +217 -13
- package/dist/core/ingestion/language-provider.d.ts +88 -1
- package/dist/core/ingestion/languages/index.d.ts +7 -0
- package/dist/core/ingestion/languages/index.js +30 -1
- package/dist/core/ingestion/languages/objective-c/analysis-features.d.ts +10 -0
- package/dist/core/ingestion/languages/objective-c/analysis-features.js +19 -0
- package/dist/core/ingestion/languages/objective-c/compilation-unit-siblings.d.ts +13 -0
- package/dist/core/ingestion/languages/objective-c/compilation-unit-siblings.js +124 -0
- package/dist/core/ingestion/languages/objective-c/facts.d.ts +148 -0
- package/dist/core/ingestion/languages/objective-c/facts.js +1150 -0
- package/dist/core/ingestion/languages/objective-c/import-target.d.ts +11 -0
- package/dist/core/ingestion/languages/objective-c/import-target.js +122 -0
- package/dist/core/ingestion/languages/objective-c/macro-marker-preprocess.d.ts +24 -0
- package/dist/core/ingestion/languages/objective-c/macro-marker-preprocess.js +261 -0
- package/dist/core/ingestion/languages/objective-c/resolution-config.d.ts +41 -0
- package/dist/core/ingestion/languages/objective-c/resolution-config.js +282 -0
- package/dist/core/ingestion/languages/objective-c/scope-resolver.d.ts +2 -0
- package/dist/core/ingestion/languages/objective-c/scope-resolver.js +503 -0
- package/dist/core/ingestion/languages/objective-c.d.ts +2 -0
- package/dist/core/ingestion/languages/objective-c.js +300 -0
- package/dist/core/ingestion/languages/typescript/query.d.ts +31 -0
- package/dist/core/ingestion/languages/typescript/query.js +7 -1
- package/dist/core/ingestion/languages/typescript/tsconfig.js +3 -2
- package/dist/core/ingestion/languages/typescript.js +1 -1
- package/dist/core/ingestion/languages/zig/query.d.ts +26 -0
- package/dist/core/ingestion/languages/zig/query.js +61 -1
- package/dist/core/ingestion/languages/zig/range-binding.d.ts +8 -0
- package/dist/core/ingestion/languages/zig/range-binding.js +24 -0
- package/dist/core/ingestion/languages/zig/scope-resolver.d.ts +3 -2
- package/dist/core/ingestion/languages/zig/scope-resolver.js +18 -5
- package/dist/core/ingestion/languages/zig/this-alias-bindings.d.ts +58 -0
- package/dist/core/ingestion/languages/zig/this-alias-bindings.js +176 -0
- package/dist/core/ingestion/languages/zig/workspace-static-gating.d.ts +8 -0
- package/dist/core/ingestion/languages/zig/workspace-static-gating.js +82 -0
- package/dist/core/ingestion/model/registration-table.d.ts +3 -3
- package/dist/core/ingestion/model/registration-table.js +9 -5
- package/dist/core/ingestion/model/symbol-table.d.ts +1 -1
- package/dist/core/ingestion/model/symbol-table.js +2 -0
- package/dist/core/ingestion/model/type-registry.d.ts +1 -1
- package/dist/core/ingestion/parsing-processor.d.ts +22 -6
- package/dist/core/ingestion/parsing-processor.js +39 -20
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +9 -1
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +307 -96
- package/dist/core/ingestion/pipeline-phases/parse-round-budget.d.ts +42 -0
- package/dist/core/ingestion/pipeline-phases/parse-round-budget.js +50 -0
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +7 -1
- package/dist/core/ingestion/scope-extractor.js +4 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +13 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +2 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +2 -0
- package/dist/core/ingestion/scope-resolution/passes/property-dispatch.d.ts +78 -5
- package/dist/core/ingestion/scope-resolution/passes/property-dispatch.js +262 -7
- package/dist/core/ingestion/scope-resolution/pipeline/phase.js +5 -2
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +2 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +10 -1
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +39 -3
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +82 -3
- package/dist/core/ingestion/scope-resolution/value-ref-edges.d.ts +14 -0
- package/dist/core/ingestion/scope-resolution/value-ref-edges.js +14 -0
- package/dist/core/ingestion/tree-sitter-queries.js +2 -0
- package/dist/core/ingestion/utils/symbol-labels.js +2 -0
- package/dist/core/ingestion/workers/parse-worker.d.ts +1 -1
- package/dist/core/ingestion/workers/parse-worker.js +63 -3
- package/dist/core/ingestion/workers/worker-pool.d.ts +56 -2
- package/dist/core/ingestion/workers/worker-pool.js +117 -26
- package/dist/core/lbug/csv-generator.js +2 -0
- package/dist/core/lbug/schema.d.ts +3 -1
- package/dist/core/lbug/schema.js +27 -0
- package/dist/core/search/fts-indexes.js +13 -4
- package/dist/core/search/fts-schema.js +2 -0
- package/dist/core/tree-sitter/parser-loader.js +10 -0
- package/dist/core/tree-sitter/vendored-grammars.d.ts +1 -1
- package/dist/core/tree-sitter/vendored-grammars.js +2 -1
- package/dist/mcp/local/local-backend.d.ts +33 -0
- package/dist/mcp/local/local-backend.js +166 -5
- package/dist/mcp/tools.js +6 -4
- package/dist/server/analyze-job.d.ts +19 -1
- package/dist/server/analyze-job.js +14 -3
- package/dist/server/analyze-launch.d.ts +14 -0
- package/dist/server/analyze-launch.js +59 -14
- package/dist/server/analyze-worker-ipc.d.ts +6 -5
- package/dist/server/analyze-worker-ipc.js +4 -0
- package/dist/server/api.js +68 -21
- package/dist/server/git-clone.d.ts +38 -5
- package/dist/server/git-clone.js +216 -38
- package/dist/server/repo-projection.d.ts +88 -0
- package/dist/server/repo-projection.js +53 -0
- package/dist/storage/file-lock.js +5 -3
- package/dist/storage/parse-cache.js +32 -1
- package/dist/storage/parsedfile-store.js +53 -1
- package/dist/storage/v8-sidecar.d.ts +11 -0
- package/dist/storage/v8-sidecar.js +15 -7
- package/dist/utils/process-identity.d.ts +13 -0
- package/dist/utils/process-identity.js +18 -0
- package/package.json +1 -1
- package/scripts/build-tree-sitter-grammars.cjs +4 -3
- package/vendor/tree-sitter-objc/LICENSE +21 -0
- package/vendor/tree-sitter-objc/README.md +18 -0
- package/vendor/tree-sitter-objc/binding.gyp +35 -0
- package/vendor/tree-sitter-objc/bindings/node/binding.cc +19 -0
- package/vendor/tree-sitter-objc/bindings/node/binding_test.js +9 -0
- package/vendor/tree-sitter-objc/bindings/node/index.d.ts +27 -0
- package/vendor/tree-sitter-objc/bindings/node/index.js +11 -0
- package/vendor/tree-sitter-objc/grammar.js +1286 -0
- package/vendor/tree-sitter-objc/package.json +56 -0
- package/vendor/tree-sitter-objc/prebuilds/SHA256SUMS +6 -0
- package/vendor/tree-sitter-objc/prebuilds/darwin-arm64/tree-sitter-objc.node +0 -0
- package/vendor/tree-sitter-objc/prebuilds/darwin-x64/tree-sitter-objc.node +0 -0
- package/vendor/tree-sitter-objc/prebuilds/linux-arm64/tree-sitter-objc.node +0 -0
- package/vendor/tree-sitter-objc/prebuilds/linux-x64/tree-sitter-objc.node +0 -0
- package/vendor/tree-sitter-objc/prebuilds/win32-arm64/tree-sitter-objc.node +0 -0
- package/vendor/tree-sitter-objc/prebuilds/win32-x64/tree-sitter-objc.node +0 -0
- package/vendor/tree-sitter-objc/queries/folds.scm +20 -0
- package/vendor/tree-sitter-objc/queries/highlights.scm +216 -0
- package/vendor/tree-sitter-objc/queries/indents.scm +1 -0
- package/vendor/tree-sitter-objc/queries/injections.scm +10 -0
- package/vendor/tree-sitter-objc/queries/locals.scm +1 -0
- package/vendor/tree-sitter-objc/src/grammar.json +16292 -0
- package/vendor/tree-sitter-objc/src/node-types.json +7524 -0
- package/vendor/tree-sitter-objc/src/parser.c +684023 -0
- package/vendor/tree-sitter-objc/src/tree_sitter/alloc.h +54 -0
- package/vendor/tree-sitter-objc/src/tree_sitter/array.h +291 -0
- package/vendor/tree-sitter-objc/src/tree_sitter/parser.h +266 -0
- package/vendor/tree-sitter-objc/tree-sitter-objc.wasm +0 -0
- package/vendor/tree-sitter-objc/tree-sitter.json +38 -0
- package/web/assets/{agent-BMRqXorA.js → agent-C2n33ANd.js} +1 -1
- package/web/assets/{index-Dj3vQOHK.js → index-CHJoW_P1.js} +18 -18
- package/web/assets/src-jc8Ffy3T.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/src-Df5C1Nz4.js +0 -1
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-workspace Objective-C import config — the analog of TypeScript's
|
|
3
|
+
* tsconfig, C#'s csproj scan, and C/C++'s header scan.
|
|
4
|
+
*
|
|
5
|
+
* Loaded once per analyze pass via `objectiveCScopeResolver.loadResolutionConfig`
|
|
6
|
+
* and threaded into `resolveObjectiveCImportTarget`. `.h` files are usually
|
|
7
|
+
* classified as C++ unless they contain Objective-C syntax, so the ObjC
|
|
8
|
+
* resolver's `allFilePaths` can miss headers that `#import` / `#include`
|
|
9
|
+
* still name. This scan is what makes those paths visible.
|
|
10
|
+
*/
|
|
11
|
+
import { readdirSync, readFileSync } from 'fs';
|
|
12
|
+
import { join, relative } from 'path';
|
|
13
|
+
import { clearObjectiveCFileFacts } from './facts.js';
|
|
14
|
+
const HEADER_EXTENSIONS = new Set(['.h']);
|
|
15
|
+
const MODULE_MAP_NAMES = new Set(['module.modulemap', 'module.map']);
|
|
16
|
+
export function emptyObjectiveCResolutionConfig() {
|
|
17
|
+
return {
|
|
18
|
+
headers: new Set(),
|
|
19
|
+
headerSearchPaths: [],
|
|
20
|
+
userHeaderSearchPaths: [],
|
|
21
|
+
frameworks: new Map(),
|
|
22
|
+
modules: new Map(),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function coerceObjectiveCResolutionConfig(value) {
|
|
26
|
+
if (value == null)
|
|
27
|
+
return undefined;
|
|
28
|
+
if (value instanceof Set) {
|
|
29
|
+
return {
|
|
30
|
+
headers: value,
|
|
31
|
+
headerSearchPaths: [],
|
|
32
|
+
userHeaderSearchPaths: [],
|
|
33
|
+
frameworks: new Map(),
|
|
34
|
+
modules: new Map(),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (typeof value !== 'object')
|
|
38
|
+
return undefined;
|
|
39
|
+
const record = value;
|
|
40
|
+
if (record.headers === undefined)
|
|
41
|
+
return undefined;
|
|
42
|
+
return {
|
|
43
|
+
headers: record.headers,
|
|
44
|
+
headerSearchPaths: record.headerSearchPaths ?? [],
|
|
45
|
+
userHeaderSearchPaths: record.userHeaderSearchPaths ?? [],
|
|
46
|
+
frameworks: record.frameworks ?? new Map(),
|
|
47
|
+
modules: record.modules ?? new Map(),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function loadObjectiveCResolutionConfig(repoPath) {
|
|
51
|
+
// Worker capture facts are process-local and outlive a single analysis in
|
|
52
|
+
// server mode. This hook runs once before each Objective-C workspace pass,
|
|
53
|
+
// before ParsedFile side channels are restored for the current files.
|
|
54
|
+
clearObjectiveCFileFacts();
|
|
55
|
+
return scanObjectiveCWorkspace(repoPath);
|
|
56
|
+
}
|
|
57
|
+
export function scanObjectiveCWorkspace(repoPath) {
|
|
58
|
+
const headers = new Set();
|
|
59
|
+
const frameworks = new Map();
|
|
60
|
+
const moduleMapPaths = [];
|
|
61
|
+
const xcconfigPaths = [];
|
|
62
|
+
const implicitSearchRoots = new Set();
|
|
63
|
+
walk(repoPath, repoPath, {
|
|
64
|
+
headers,
|
|
65
|
+
frameworks,
|
|
66
|
+
moduleMapPaths,
|
|
67
|
+
xcconfigPaths,
|
|
68
|
+
implicitSearchRoots,
|
|
69
|
+
});
|
|
70
|
+
const xcconfig = { headerSearchPaths: [], userHeaderSearchPaths: [] };
|
|
71
|
+
for (const filePath of xcconfigPaths) {
|
|
72
|
+
const parsed = parseXcconfigSearchPaths(readText(join(repoPath, filePath)));
|
|
73
|
+
xcconfig.headerSearchPaths.push(...parsed.headerSearchPaths);
|
|
74
|
+
xcconfig.userHeaderSearchPaths.push(...parsed.userHeaderSearchPaths);
|
|
75
|
+
}
|
|
76
|
+
const headerSearchPaths = uniquePaths(xcconfig.headerSearchPaths);
|
|
77
|
+
const userHeaderSearchPaths = uniquePaths([
|
|
78
|
+
...implicitSearchRoots,
|
|
79
|
+
...xcconfig.userHeaderSearchPaths,
|
|
80
|
+
]);
|
|
81
|
+
const modules = new Map();
|
|
82
|
+
for (const mapPath of moduleMapPaths) {
|
|
83
|
+
for (const [name, header] of parseModuleMap(readText(join(repoPath, mapPath)), dirnamePosix(mapPath))) {
|
|
84
|
+
if (!modules.has(name))
|
|
85
|
+
modules.set(name, header);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { headers, headerSearchPaths, userHeaderSearchPaths, frameworks, modules };
|
|
89
|
+
}
|
|
90
|
+
function walk(dir, root, sink) {
|
|
91
|
+
let entries;
|
|
92
|
+
try {
|
|
93
|
+
entries = readdirSync(dir, { withFileTypes: true, encoding: 'utf8' });
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
for (const entry of entries) {
|
|
99
|
+
const name = entry.name;
|
|
100
|
+
const full = join(dir, name);
|
|
101
|
+
if (entry.isDirectory()) {
|
|
102
|
+
if (shouldSkipDirectory(name))
|
|
103
|
+
continue;
|
|
104
|
+
const relativeDir = normalizeRepoPath(relative(root, full));
|
|
105
|
+
if (name.endsWith('.framework')) {
|
|
106
|
+
const frameworkName = name.slice(0, -'.framework'.length);
|
|
107
|
+
if (frameworkName.length > 0 && !sink.frameworks.has(frameworkName)) {
|
|
108
|
+
sink.frameworks.set(frameworkName, `${relativeDir}/Headers`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (name === 'Headers' || name === 'include') {
|
|
112
|
+
sink.implicitSearchRoots.add(relativeDir);
|
|
113
|
+
}
|
|
114
|
+
walk(full, root, sink);
|
|
115
|
+
}
|
|
116
|
+
else if (entry.isFile()) {
|
|
117
|
+
const relativePath = normalizeRepoPath(relative(root, full));
|
|
118
|
+
const ext = name.slice(name.lastIndexOf('.'));
|
|
119
|
+
if (HEADER_EXTENSIONS.has(ext))
|
|
120
|
+
sink.headers.add(relativePath);
|
|
121
|
+
if (MODULE_MAP_NAMES.has(name))
|
|
122
|
+
sink.moduleMapPaths.push(relativePath);
|
|
123
|
+
if (ext === '.xcconfig')
|
|
124
|
+
sink.xcconfigPaths.push(relativePath);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function shouldSkipDirectory(name) {
|
|
129
|
+
return (name === 'node_modules' ||
|
|
130
|
+
name === '.git' ||
|
|
131
|
+
name === 'vendor' ||
|
|
132
|
+
name === 'dist' ||
|
|
133
|
+
name === 'build' ||
|
|
134
|
+
name === 'out' ||
|
|
135
|
+
name === 'target' ||
|
|
136
|
+
name === '_build' ||
|
|
137
|
+
name === '.next' ||
|
|
138
|
+
name === 'DerivedData' ||
|
|
139
|
+
name === 'xcuserdata' ||
|
|
140
|
+
name === '.build' ||
|
|
141
|
+
name === 'Pods' ||
|
|
142
|
+
name === 'Carthage' ||
|
|
143
|
+
name.startsWith('cmake-build'));
|
|
144
|
+
}
|
|
145
|
+
export function parseXcconfigSearchPaths(source) {
|
|
146
|
+
const headerSearchPaths = [];
|
|
147
|
+
const userHeaderSearchPaths = [];
|
|
148
|
+
const joined = source.replace(/\\\r?\n/g, ' ');
|
|
149
|
+
for (const rawLine of joined.split(/\r?\n/)) {
|
|
150
|
+
const line = rawLine.replace(/\/\/.*$/, '').trim();
|
|
151
|
+
if (line.length === 0)
|
|
152
|
+
continue;
|
|
153
|
+
const match = /^(HEADER_SEARCH_PATHS|USER_HEADER_SEARCH_PATHS)\s*=\s*(.*)$/.exec(line);
|
|
154
|
+
if (match === null)
|
|
155
|
+
continue;
|
|
156
|
+
const sink = match[1] === 'USER_HEADER_SEARCH_PATHS' ? userHeaderSearchPaths : headerSearchPaths;
|
|
157
|
+
for (const token of tokenizeXcconfigValue(match[2] ?? '')) {
|
|
158
|
+
const resolved = expandXcconfigPath(token);
|
|
159
|
+
if (resolved !== undefined)
|
|
160
|
+
sink.push(resolved);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return { headerSearchPaths, userHeaderSearchPaths };
|
|
164
|
+
}
|
|
165
|
+
function tokenizeXcconfigValue(value) {
|
|
166
|
+
const tokens = [];
|
|
167
|
+
let current = '';
|
|
168
|
+
let quoted = false;
|
|
169
|
+
for (let i = 0; i < value.length; i++) {
|
|
170
|
+
const ch = value[i];
|
|
171
|
+
if (ch === '"') {
|
|
172
|
+
quoted = !quoted;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (!quoted && /\s/.test(ch ?? '')) {
|
|
176
|
+
if (current.length > 0) {
|
|
177
|
+
tokens.push(current);
|
|
178
|
+
current = '';
|
|
179
|
+
}
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
current += ch;
|
|
183
|
+
}
|
|
184
|
+
if (current.length > 0)
|
|
185
|
+
tokens.push(current);
|
|
186
|
+
return tokens;
|
|
187
|
+
}
|
|
188
|
+
function expandXcconfigPath(token) {
|
|
189
|
+
if (token === '$(inherited)' || token === '$inherited')
|
|
190
|
+
return undefined;
|
|
191
|
+
if (/\$\((SDKROOT|DEVELOPER_DIR|PLATFORM_DIR|TOOLCHAIN_DIR)\)/.test(token))
|
|
192
|
+
return undefined;
|
|
193
|
+
const expanded = token
|
|
194
|
+
.replace(/\$\((SRCROOT|PROJECT_DIR)\)\/?/g, '')
|
|
195
|
+
.replace(/\/\*\*?$/, '')
|
|
196
|
+
.replace(/\\/g, '/')
|
|
197
|
+
.replace(/^\.\//, '');
|
|
198
|
+
if (expanded.startsWith('$') || expanded.startsWith('/'))
|
|
199
|
+
return undefined;
|
|
200
|
+
return collapseRepoPath(expanded);
|
|
201
|
+
}
|
|
202
|
+
export function parseModuleMap(source, mapDir) {
|
|
203
|
+
const modules = [];
|
|
204
|
+
const blocks = /(?:framework\s+)?module\s+([A-Za-z_][\w.]*)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g;
|
|
205
|
+
for (const match of source.matchAll(blocks)) {
|
|
206
|
+
const name = match[1];
|
|
207
|
+
const body = match[2] ?? '';
|
|
208
|
+
if (name === undefined || name === '*')
|
|
209
|
+
continue;
|
|
210
|
+
const header = /umbrella\s+header\s+"([^"]+)"/.exec(body)?.[1] ??
|
|
211
|
+
/umbrella\s+"([^"]+)"/.exec(body)?.[1] ??
|
|
212
|
+
/header\s+"([^"]+)"/.exec(body)?.[1];
|
|
213
|
+
if (header === undefined)
|
|
214
|
+
continue;
|
|
215
|
+
modules.push([name, collapseRepoPath(resolveModuleMapHeader(mapDir, header))]);
|
|
216
|
+
}
|
|
217
|
+
return modules;
|
|
218
|
+
}
|
|
219
|
+
function readText(filePath) {
|
|
220
|
+
try {
|
|
221
|
+
return readFileSync(filePath, 'utf8');
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
return '';
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function dirnamePosix(filePath) {
|
|
228
|
+
const normalized = normalizeRepoPath(filePath);
|
|
229
|
+
const slash = normalized.lastIndexOf('/');
|
|
230
|
+
return slash === -1 ? '' : normalized.slice(0, slash);
|
|
231
|
+
}
|
|
232
|
+
function uniquePaths(paths) {
|
|
233
|
+
const seen = new Set();
|
|
234
|
+
const out = [];
|
|
235
|
+
for (const path of paths) {
|
|
236
|
+
const normalized = normalizeRepoPath(path);
|
|
237
|
+
if (normalized.length === 0 || seen.has(normalized))
|
|
238
|
+
continue;
|
|
239
|
+
seen.add(normalized);
|
|
240
|
+
out.push(normalized);
|
|
241
|
+
}
|
|
242
|
+
return out;
|
|
243
|
+
}
|
|
244
|
+
export function normalizeRepoPath(value) {
|
|
245
|
+
return value.replaceAll('\\', '/').replace(/^\.\//, '');
|
|
246
|
+
}
|
|
247
|
+
/** Collapse `.` / `..` in scanned config paths. Import targets stay raw. */
|
|
248
|
+
export function collapseRepoPath(value) {
|
|
249
|
+
const parts = normalizeRepoPath(value).split('/');
|
|
250
|
+
const out = [];
|
|
251
|
+
for (const part of parts) {
|
|
252
|
+
if (part === '' || part === '.')
|
|
253
|
+
continue;
|
|
254
|
+
if (part === '..') {
|
|
255
|
+
out.pop();
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
out.push(part);
|
|
259
|
+
}
|
|
260
|
+
return out.join('/');
|
|
261
|
+
}
|
|
262
|
+
function resolveModuleMapHeader(mapDir, header) {
|
|
263
|
+
const direct = collapseRepoPath(joinPosix(mapDir, header));
|
|
264
|
+
const frameworkRoot = frameworkRootFromModulesDir(mapDir);
|
|
265
|
+
if (frameworkRoot === undefined)
|
|
266
|
+
return direct;
|
|
267
|
+
const base = header.slice(header.replaceAll('\\', '/').lastIndexOf('/') + 1);
|
|
268
|
+
return collapseRepoPath(joinPosix(`${frameworkRoot}/Headers`, base));
|
|
269
|
+
}
|
|
270
|
+
function frameworkRootFromModulesDir(mapDir) {
|
|
271
|
+
if (mapDir === 'Modules')
|
|
272
|
+
return undefined;
|
|
273
|
+
if (!mapDir.endsWith('/Modules'))
|
|
274
|
+
return undefined;
|
|
275
|
+
const parent = mapDir.slice(0, -'/Modules'.length);
|
|
276
|
+
return parent.endsWith('.framework') ? parent : undefined;
|
|
277
|
+
}
|
|
278
|
+
function joinPosix(left, right) {
|
|
279
|
+
if (left.length === 0)
|
|
280
|
+
return right;
|
|
281
|
+
return `${left}/${right}`;
|
|
282
|
+
}
|