@ridit/lens 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/index.mjs
CHANGED
|
@@ -277501,7 +277501,8 @@ var readFilesTool = {
|
|
|
277501
277501
|
</read-files>`,
|
|
277502
277502
|
parseInput: (body) => {
|
|
277503
277503
|
try {
|
|
277504
|
-
const
|
|
277504
|
+
const cleaned = body.trim().replace(/\\/g, "/");
|
|
277505
|
+
const parsed = JSON.parse(cleaned);
|
|
277505
277506
|
if (!Array.isArray(parsed) || parsed.length === 0)
|
|
277506
277507
|
return null;
|
|
277507
277508
|
return { paths: parsed };
|
|
@@ -277543,6 +277544,7 @@ function registerBuiltins() {
|
|
|
277543
277544
|
import path26 from "path";
|
|
277544
277545
|
import os9 from "os";
|
|
277545
277546
|
import { existsSync as existsSync20, readdirSync as readdirSync5 } from "fs";
|
|
277547
|
+
import { pathToFileURL } from "url";
|
|
277546
277548
|
var ADDONS_DIR = path26.join(os9.homedir(), ".lens", "addons");
|
|
277547
277549
|
async function loadAddons() {
|
|
277548
277550
|
if (!existsSync20(ADDONS_DIR)) {
|
|
@@ -277554,9 +277556,10 @@ async function loadAddons() {
|
|
|
277554
277556
|
if (!file)
|
|
277555
277557
|
return;
|
|
277556
277558
|
const fullPath = path26.join(ADDONS_DIR, file);
|
|
277559
|
+
const fileUrl = pathToFileURL(fullPath).href;
|
|
277557
277560
|
const isLast = i === files.length - 1;
|
|
277558
277561
|
try {
|
|
277559
|
-
await import(
|
|
277562
|
+
await import(fileUrl);
|
|
277560
277563
|
console.log(`[addons] loaded: ${file}${isLast ? `
|
|
277561
277564
|
` : ""}`);
|
|
277562
277565
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import os from "os";
|
|
3
3
|
import { existsSync, readdirSync } from "fs";
|
|
4
|
+
import { pathToFileURL } from "url";
|
|
4
5
|
|
|
5
6
|
const ADDONS_DIR = path.join(os.homedir(), ".lens", "addons");
|
|
6
7
|
|
|
@@ -18,9 +19,10 @@ export async function loadAddons(): Promise<void> {
|
|
|
18
19
|
if (!file) return;
|
|
19
20
|
|
|
20
21
|
const fullPath = path.join(ADDONS_DIR, file);
|
|
22
|
+
const fileUrl = pathToFileURL(fullPath).href;
|
|
21
23
|
const isLast = i === files.length - 1;
|
|
22
24
|
try {
|
|
23
|
-
await import(
|
|
25
|
+
await import(fileUrl);
|
|
24
26
|
console.log(`[addons] loaded: ${file}${isLast ? "\n" : ""}`);
|
|
25
27
|
} catch (err) {
|
|
26
28
|
console.error(
|
|
@@ -291,7 +291,8 @@ export const readFilesTool: Tool<ReadFilesInput> = {
|
|
|
291
291
|
`### ${i}. read-files — read multiple files from the repo at once\n<read-files>\n["src/foo.ts", "src/bar.ts"]\n</read-files>`,
|
|
292
292
|
parseInput: (body) => {
|
|
293
293
|
try {
|
|
294
|
-
const
|
|
294
|
+
const cleaned = body.trim().replace(/\\/g, "/");
|
|
295
|
+
const parsed = JSON.parse(cleaned) as string[];
|
|
295
296
|
if (!Array.isArray(parsed) || parsed.length === 0) return null;
|
|
296
297
|
return { paths: parsed };
|
|
297
298
|
} catch {
|