archgraph-argo-beta 0.27.0-beta.7 → 0.27.0-beta.8
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.
|
@@ -197,19 +197,67 @@ function bundleSymbolicNames(dir) {
|
|
|
197
197
|
return names;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
function
|
|
200
|
+
function isPathLikeExt(value) {
|
|
201
|
+
return value.includes('/') || value.includes('\\') || value.startsWith('.') || value.startsWith('~')
|
|
202
|
+
|| /^[a-zA-Z]:/.test(value);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Bounded, general candidate list for symbolic bundle resolution: the built-in
|
|
206
|
+
// default bundle, any directory a bundle lists in its own `basePaths`, the bundle's
|
|
207
|
+
// own directory, and its immediate sub-directories. The framework matches a name
|
|
208
|
+
// against each candidate's SELF-DECLARED id/aliases (data) — it hardcodes no
|
|
209
|
+
// modeling-language name. A non-matching symbolic name falls back to a path, so
|
|
210
|
+
// bare relative directory references keep working.
|
|
211
|
+
function candidateBaseDirs(childDir, config) {
|
|
212
|
+
const dirs = [];
|
|
213
|
+
const seen = new Set();
|
|
214
|
+
const push = (dir) => {
|
|
215
|
+
if (!dir) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const resolved = path.resolve(dir);
|
|
219
|
+
const key = resolved.toLowerCase();
|
|
220
|
+
if (!seen.has(key)) {
|
|
221
|
+
seen.add(key);
|
|
222
|
+
dirs.push(resolved);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
push(path.join(getArgoRoot(), 'schema'));
|
|
226
|
+
const basePaths = config && Array.isArray(config.basePaths) ? config.basePaths : [];
|
|
227
|
+
for (const basePath of basePaths) {
|
|
228
|
+
if (typeof basePath === 'string' && basePath.trim() !== '') {
|
|
229
|
+
push(path.resolve(childDir, basePath.trim()));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
push(childDir);
|
|
233
|
+
let entries = [];
|
|
234
|
+
try {
|
|
235
|
+
entries = fs.readdirSync(childDir, { withFileTypes: true });
|
|
236
|
+
} catch {
|
|
237
|
+
entries = [];
|
|
238
|
+
}
|
|
239
|
+
for (const entry of entries) {
|
|
240
|
+
if (entry.isDirectory()) {
|
|
241
|
+
push(path.join(childDir, entry.name));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return dirs;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function resolveBaseBundleDir(ext, childDir, config) {
|
|
201
248
|
const value = String(ext).trim();
|
|
202
249
|
// `default` is the reserved, language-neutral name of the built-in bundle.
|
|
203
250
|
if (value === 'default') {
|
|
204
251
|
return path.join(getArgoRoot(), 'schema');
|
|
205
252
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
253
|
+
if (!isPathLikeExt(value)) {
|
|
254
|
+
for (const dir of candidateBaseDirs(childDir, config)) {
|
|
255
|
+
if (bundleSymbolicNames(dir).has(value)) {
|
|
256
|
+
return dir;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
212
259
|
}
|
|
260
|
+
// Not a symbolic hit: treat as a path relative to the bundle directory.
|
|
213
261
|
return path.resolve(childDir, value);
|
|
214
262
|
}
|
|
215
263
|
|
|
@@ -350,7 +398,7 @@ function applyExtends(bundle, workspaceRoot, seen = new Set()) {
|
|
|
350
398
|
return bundle;
|
|
351
399
|
}
|
|
352
400
|
seen.add(path.resolve(bundle.dir).toLowerCase());
|
|
353
|
-
const baseDir = resolveBaseBundleDir(ext, bundle.dir);
|
|
401
|
+
const baseDir = resolveBaseBundleDir(ext, bundle.dir, bundle.config);
|
|
354
402
|
const baseKey = path.resolve(baseDir).toLowerCase();
|
|
355
403
|
if (seen.has(baseKey)) {
|
|
356
404
|
throw new Error(`schema bundle extends cycle detected at '${baseDir}'`);
|
package/package.json
CHANGED