@rohal12/spindle-lsp 0.3.0 → 0.3.1
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/bin.js +16 -1
- package/dist/bin.js.map +3 -3
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -244,6 +244,7 @@ var init_passage_index = __esm({
|
|
|
244
244
|
|
|
245
245
|
// src/core/workspace/macro-registry.ts
|
|
246
246
|
import { existsSync, readFileSync as readFileSync2 } from "node:fs";
|
|
247
|
+
import { createRequire } from "node:module";
|
|
247
248
|
import { dirname, join, parse as parsePath } from "node:path";
|
|
248
249
|
import { fileURLToPath } from "node:url";
|
|
249
250
|
var MacroRegistry;
|
|
@@ -262,7 +263,7 @@ var init_macro_registry = __esm({
|
|
|
262
263
|
let builtinMacros = [];
|
|
263
264
|
try {
|
|
264
265
|
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
265
|
-
const registryPath = this.resolveRegistryPath(thisDir);
|
|
266
|
+
const registryPath = this.resolveRegistryPathViaRequire(thisDir) ?? this.resolveRegistryPath(thisDir);
|
|
266
267
|
if (registryPath) {
|
|
267
268
|
const raw = readFileSync2(registryPath, "utf-8");
|
|
268
269
|
const parsed = JSON.parse(raw);
|
|
@@ -352,6 +353,20 @@ var init_macro_registry = __esm({
|
|
|
352
353
|
* Walk up directory tree from `startDir` to find the
|
|
353
354
|
* @rohal12/spindle/dist/pkg/macro-registry.json file.
|
|
354
355
|
*/
|
|
356
|
+
/**
|
|
357
|
+
* Resolve macro-registry.json using Node's require resolution.
|
|
358
|
+
* Works in bundled contexts where import.meta.url may not be near node_modules.
|
|
359
|
+
*/
|
|
360
|
+
resolveRegistryPathViaRequire(startDir) {
|
|
361
|
+
try {
|
|
362
|
+
const require2 = createRequire(join(startDir, "_"));
|
|
363
|
+
const toolingPath = require2.resolve("@rohal12/spindle/tooling");
|
|
364
|
+
const candidate = join(dirname(toolingPath), "macro-registry.json");
|
|
365
|
+
if (existsSync(candidate)) return candidate;
|
|
366
|
+
} catch {
|
|
367
|
+
}
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
355
370
|
resolveRegistryPath(startDir) {
|
|
356
371
|
const target = join("node_modules", "@rohal12", "spindle", "dist", "pkg", "macro-registry.json");
|
|
357
372
|
let dir = startDir;
|