@neuralsea/workspace-indexer 0.5.0 → 0.5.2

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.
@@ -30,8 +30,36 @@ var OpenAIEmbeddingsProvider = class {
30
30
  }
31
31
  };
32
32
 
33
+ // src/limit.ts
34
+ function createLimit(concurrency) {
35
+ const n = Math.max(1, Math.floor(concurrency || 1));
36
+ let active = 0;
37
+ const queue = [];
38
+ const runNext = () => {
39
+ active--;
40
+ const next = queue.shift();
41
+ if (next) next();
42
+ };
43
+ return (fn) => new Promise((resolve, reject) => {
44
+ const run = () => {
45
+ active++;
46
+ Promise.resolve().then(fn).then(
47
+ (v) => {
48
+ resolve(v);
49
+ runNext();
50
+ },
51
+ (e) => {
52
+ reject(e);
53
+ runNext();
54
+ }
55
+ );
56
+ };
57
+ if (active < n) run();
58
+ else queue.push(run);
59
+ });
60
+ }
61
+
33
62
  // src/embeddings/ollama.ts
34
- import pLimit from "p-limit";
35
63
  var OllamaEmbeddingsProvider = class {
36
64
  id;
37
65
  dimension = null;
@@ -76,7 +104,7 @@ var OllamaEmbeddingsProvider = class {
76
104
  async embed(texts) {
77
105
  const batch = await this.tryBatchEndpoint(texts);
78
106
  if (batch) return batch;
79
- const limit = pLimit(this.concurrency);
107
+ const limit = createLimit(this.concurrency);
80
108
  const out = await Promise.all(texts.map((t) => limit(() => this.embedOne(t))));
81
109
  return out;
82
110
  }
@@ -87,15 +87,23 @@ function recencyScore(fileMtimeMs, halfLifeDays = 14) {
87
87
  return clamp(score, 0, 1);
88
88
  }
89
89
 
90
- // src/optionalTypescript.ts
90
+ // src/nodeRequire.ts
91
91
  import { createRequire } from "module";
92
+ function nodeRequire(metaUrl) {
93
+ if (metaUrl) return createRequire(metaUrl);
94
+ const r = typeof __require === "function" ? __require : null;
95
+ if (r) return r;
96
+ throw new Error("nodeRequire(metaUrl) requires a valid file URL (pass import.meta.url in ESM).");
97
+ }
98
+
99
+ // src/optionalTypescript.ts
92
100
  var cached = null;
93
101
  var didTryLoad = false;
94
102
  function getTypeScript() {
95
103
  if (didTryLoad) return cached;
96
104
  try {
97
- const require2 = createRequire(import.meta.url);
98
- cached = require2("typescript");
105
+ const req = nodeRequire(import.meta.url);
106
+ cached = req("typescript");
99
107
  didTryLoad = true;
100
108
  return cached;
101
109
  } catch {
@@ -920,7 +928,35 @@ function createAnnIndex(config) {
920
928
  // src/indexer/repoIndexer.ts
921
929
  import fs9 from "fs";
922
930
  import path12 from "path";
923
- import pLimit from "p-limit";
931
+
932
+ // src/limit.ts
933
+ function createLimit(concurrency) {
934
+ const n = Math.max(1, Math.floor(concurrency || 1));
935
+ let active = 0;
936
+ const queue = [];
937
+ const runNext = () => {
938
+ active--;
939
+ const next = queue.shift();
940
+ if (next) next();
941
+ };
942
+ return (fn) => new Promise((resolve, reject) => {
943
+ const run = () => {
944
+ active++;
945
+ Promise.resolve().then(fn).then(
946
+ (v) => {
947
+ resolve(v);
948
+ runNext();
949
+ },
950
+ (e) => {
951
+ reject(e);
952
+ runNext();
953
+ }
954
+ );
955
+ };
956
+ if (active < n) run();
957
+ else queue.push(run);
958
+ });
959
+ }
924
960
 
925
961
  // src/utilNode.ts
926
962
  import os from "os";
@@ -979,14 +1015,13 @@ function loadExtraIgnore(repoRoot, ignoreFiles) {
979
1015
 
980
1016
  // src/store/embeddingCache.ts
981
1017
  import fs4 from "fs";
982
- import { createRequire as createRequire2 } from "module";
983
1018
  import path6 from "path";
984
1019
  var cachedBetterSqlite3 = null;
985
1020
  function loadBetterSqlite3() {
986
1021
  if (cachedBetterSqlite3) return cachedBetterSqlite3;
987
1022
  try {
988
- const require2 = createRequire2(import.meta.url);
989
- cachedBetterSqlite3 = require2("better-sqlite3");
1023
+ const req = nodeRequire(import.meta.url);
1024
+ cachedBetterSqlite3 = req("better-sqlite3");
990
1025
  return cachedBetterSqlite3;
991
1026
  } catch (e) {
992
1027
  const hint = "EmbeddingCache requires optional dependency 'better-sqlite3' (npm i better-sqlite3).";
@@ -1035,14 +1070,13 @@ var EmbeddingCache = class {
1035
1070
 
1036
1071
  // src/store/repoStore.ts
1037
1072
  import fs5 from "fs";
1038
- import { createRequire as createRequire3 } from "module";
1039
1073
  import path7 from "path";
1040
1074
  var cachedBetterSqlite32 = null;
1041
1075
  function loadBetterSqlite32() {
1042
1076
  if (cachedBetterSqlite32) return cachedBetterSqlite32;
1043
1077
  try {
1044
- const require2 = createRequire3(import.meta.url);
1045
- cachedBetterSqlite32 = require2("better-sqlite3");
1078
+ const req = nodeRequire(import.meta.url);
1079
+ cachedBetterSqlite32 = req("better-sqlite3");
1046
1080
  return cachedBetterSqlite32;
1047
1081
  } catch (e) {
1048
1082
  const hint = "RepoStore requires optional dependency 'better-sqlite3' (npm i better-sqlite3).";
@@ -2305,7 +2339,7 @@ var RepoIndexer = class {
2305
2339
  currentCommit = null;
2306
2340
  currentBranch = null;
2307
2341
  fileIgnore = null;
2308
- serial = pLimit(1);
2342
+ serial = createLimit(1);
2309
2343
  emitProgress(event) {
2310
2344
  try {
2311
2345
  this.progress?.emit(event);
@@ -2435,7 +2469,7 @@ var RepoIndexer = class {
2435
2469
  await this.deleteFile(known);
2436
2470
  }
2437
2471
  }
2438
- const limit = pLimit(this.config.embed.concurrency);
2472
+ const limit = createLimit(this.config.embed.concurrency);
2439
2473
  await Promise.all(files.map((f) => limit(() => this.indexFile(f))));
2440
2474
  if (this.vector.get()) await this.vector.flushNow();
2441
2475
  this.emitProgress({
@@ -2760,14 +2794,13 @@ function mergeIndexerConfig(target, patch) {
2760
2794
 
2761
2795
  // src/store/workspace/db.ts
2762
2796
  import fs11 from "fs";
2763
- import { createRequire as createRequire4 } from "module";
2764
2797
  import path14 from "path";
2765
2798
  var cachedBetterSqlite33 = null;
2766
2799
  function loadBetterSqlite33() {
2767
2800
  if (cachedBetterSqlite33) return cachedBetterSqlite33;
2768
2801
  try {
2769
- const require2 = createRequire4(import.meta.url);
2770
- cachedBetterSqlite33 = require2("better-sqlite3");
2802
+ const req = nodeRequire(import.meta.url);
2803
+ cachedBetterSqlite33 = req("better-sqlite3");
2771
2804
  return cachedBetterSqlite33;
2772
2805
  } catch (e) {
2773
2806
  const hint = "To use the better-sqlite3 adapter, install the optional dependency: npm i better-sqlite3";
@@ -2826,7 +2859,6 @@ var betterSqlite3Adapter = {
2826
2859
 
2827
2860
  // src/store/workspace/sqlJsAdapter.ts
2828
2861
  import fs12 from "fs";
2829
- import { createRequire as createRequire5 } from "module";
2830
2862
  import path15 from "path";
2831
2863
  function detectFts5Support2(db) {
2832
2864
  try {
@@ -2916,7 +2948,7 @@ function defaultLocateFile(file) {
2916
2948
  } catch {
2917
2949
  }
2918
2950
  try {
2919
- const req = createRequire5(import.meta.url);
2951
+ const req = nodeRequire(import.meta.url);
2920
2952
  return req.resolve(spec);
2921
2953
  } catch {
2922
2954
  return file;
@@ -3462,7 +3494,6 @@ var WorkspaceStore = class {
3462
3494
  };
3463
3495
 
3464
3496
  // src/graph/neo4j.ts
3465
- import { createRequire as createRequire6 } from "module";
3466
3497
  async function runSession(driver, database, fn) {
3467
3498
  const session = driver.session(database ? { database } : void 0);
3468
3499
  try {
@@ -3903,8 +3934,8 @@ var Neo4jGraphStore = class {
3903
3934
  };
3904
3935
  async function createNeo4jGraphStore(cfg) {
3905
3936
  try {
3906
- const require2 = createRequire6(import.meta.url);
3907
- const neo4j = require2("neo4j-driver");
3937
+ const req = nodeRequire(import.meta.url);
3938
+ const neo4j = req("neo4j-driver");
3908
3939
  const driver = neo4j.driver(cfg.uri, neo4j.auth.basic(cfg.user, cfg.password));
3909
3940
  const store = new Neo4jGraphStore(driver, cfg);
3910
3941
  await store.init();
@@ -4663,7 +4694,6 @@ var WorkspaceIndexer = class {
4663
4694
  };
4664
4695
 
4665
4696
  // src/embeddings/ollama.ts
4666
- import pLimit2 from "p-limit";
4667
4697
  var OllamaEmbeddingsProvider = class {
4668
4698
  id;
4669
4699
  dimension = null;
@@ -4708,7 +4738,7 @@ var OllamaEmbeddingsProvider = class {
4708
4738
  async embed(texts) {
4709
4739
  const batch = await this.tryBatchEndpoint(texts);
4710
4740
  if (batch) return batch;
4711
- const limit = pLimit2(this.concurrency);
4741
+ const limit = createLimit(this.concurrency);
4712
4742
  const out = await Promise.all(texts.map((t) => limit(() => this.embedOne(t))));
4713
4743
  return out;
4714
4744
  }
@@ -4802,6 +4832,7 @@ function loadConfigFile(filePath) {
4802
4832
  }
4803
4833
 
4804
4834
  export {
4835
+ nodeRequire,
4805
4836
  IndexerProgressObservable,
4806
4837
  asProgressSink,
4807
4838
  languageFromPath,
package/dist/cli.cjs CHANGED
@@ -89,7 +89,35 @@ function defaultCacheDir() {
89
89
  // src/indexer/repoIndexer.ts
90
90
  var import_node_fs9 = __toESM(require("fs"), 1);
91
91
  var import_node_path12 = __toESM(require("path"), 1);
92
- var import_p_limit = __toESM(require("p-limit"), 1);
92
+
93
+ // src/limit.ts
94
+ function createLimit(concurrency) {
95
+ const n = Math.max(1, Math.floor(concurrency || 1));
96
+ let active = 0;
97
+ const queue = [];
98
+ const runNext = () => {
99
+ active--;
100
+ const next = queue.shift();
101
+ if (next) next();
102
+ };
103
+ return (fn) => new Promise((resolve, reject) => {
104
+ const run = () => {
105
+ active++;
106
+ Promise.resolve().then(fn).then(
107
+ (v) => {
108
+ resolve(v);
109
+ runNext();
110
+ },
111
+ (e) => {
112
+ reject(e);
113
+ runNext();
114
+ }
115
+ );
116
+ };
117
+ if (active < n) run();
118
+ else queue.push(run);
119
+ });
120
+ }
93
121
 
94
122
  // src/git.ts
95
123
  var import_node_child_process = require("child_process");
@@ -140,15 +168,25 @@ function loadExtraIgnore(repoRoot, ignoreFiles) {
140
168
 
141
169
  // src/store/embeddingCache.ts
142
170
  var import_node_fs2 = __toESM(require("fs"), 1);
143
- var import_node_module = require("module");
144
171
  var import_node_path3 = __toESM(require("path"), 1);
172
+
173
+ // src/nodeRequire.ts
174
+ var import_node_module = require("module");
175
+ function nodeRequire(metaUrl) {
176
+ if (metaUrl) return (0, import_node_module.createRequire)(metaUrl);
177
+ const r = typeof require === "function" ? require : null;
178
+ if (r) return r;
179
+ throw new Error("nodeRequire(metaUrl) requires a valid file URL (pass import.meta.url in ESM).");
180
+ }
181
+
182
+ // src/store/embeddingCache.ts
145
183
  var import_meta = {};
146
184
  var cachedBetterSqlite3 = null;
147
185
  function loadBetterSqlite3() {
148
186
  if (cachedBetterSqlite3) return cachedBetterSqlite3;
149
187
  try {
150
- const require2 = (0, import_node_module.createRequire)(import_meta.url);
151
- cachedBetterSqlite3 = require2("better-sqlite3");
188
+ const req = nodeRequire(import_meta.url);
189
+ cachedBetterSqlite3 = req("better-sqlite3");
152
190
  return cachedBetterSqlite3;
153
191
  } catch (e) {
154
192
  const hint = "EmbeddingCache requires optional dependency 'better-sqlite3' (npm i better-sqlite3).";
@@ -197,15 +235,14 @@ var EmbeddingCache = class {
197
235
 
198
236
  // src/store/repoStore.ts
199
237
  var import_node_fs3 = __toESM(require("fs"), 1);
200
- var import_node_module2 = require("module");
201
238
  var import_node_path4 = __toESM(require("path"), 1);
202
239
  var import_meta2 = {};
203
240
  var cachedBetterSqlite32 = null;
204
241
  function loadBetterSqlite32() {
205
242
  if (cachedBetterSqlite32) return cachedBetterSqlite32;
206
243
  try {
207
- const require2 = (0, import_node_module2.createRequire)(import_meta2.url);
208
- cachedBetterSqlite32 = require2("better-sqlite3");
244
+ const req = nodeRequire(import_meta2.url);
245
+ cachedBetterSqlite32 = req("better-sqlite3");
209
246
  return cachedBetterSqlite32;
210
247
  } catch (e) {
211
248
  const hint = "RepoStore requires optional dependency 'better-sqlite3' (npm i better-sqlite3).";
@@ -448,15 +485,14 @@ function asProgressSink(progress) {
448
485
  }
449
486
 
450
487
  // src/optionalTypescript.ts
451
- var import_node_module3 = require("module");
452
488
  var import_meta3 = {};
453
489
  var cached = null;
454
490
  var didTryLoad = false;
455
491
  function getTypeScript() {
456
492
  if (didTryLoad) return cached;
457
493
  try {
458
- const require2 = (0, import_node_module3.createRequire)(import_meta3.url);
459
- cached = require2("typescript");
494
+ const req = nodeRequire(import_meta3.url);
495
+ cached = req("typescript");
460
496
  didTryLoad = true;
461
497
  return cached;
462
498
  } catch {
@@ -2312,7 +2348,7 @@ var RepoIndexer = class {
2312
2348
  currentCommit = null;
2313
2349
  currentBranch = null;
2314
2350
  fileIgnore = null;
2315
- serial = (0, import_p_limit.default)(1);
2351
+ serial = createLimit(1);
2316
2352
  emitProgress(event) {
2317
2353
  try {
2318
2354
  this.progress?.emit(event);
@@ -2442,7 +2478,7 @@ var RepoIndexer = class {
2442
2478
  await this.deleteFile(known);
2443
2479
  }
2444
2480
  }
2445
- const limit = (0, import_p_limit.default)(this.config.embed.concurrency);
2481
+ const limit = createLimit(this.config.embed.concurrency);
2446
2482
  await Promise.all(files.map((f) => limit(() => this.indexFile(f))));
2447
2483
  if (this.vector.get()) await this.vector.flushNow();
2448
2484
  this.emitProgress({
@@ -2992,15 +3028,14 @@ var import_node_path15 = __toESM(require("path"), 1);
2992
3028
 
2993
3029
  // src/store/workspace/db.ts
2994
3030
  var import_node_fs11 = __toESM(require("fs"), 1);
2995
- var import_node_module4 = require("module");
2996
3031
  var import_node_path14 = __toESM(require("path"), 1);
2997
3032
  var import_meta4 = {};
2998
3033
  var cachedBetterSqlite33 = null;
2999
3034
  function loadBetterSqlite33() {
3000
3035
  if (cachedBetterSqlite33) return cachedBetterSqlite33;
3001
3036
  try {
3002
- const require2 = (0, import_node_module4.createRequire)(import_meta4.url);
3003
- cachedBetterSqlite33 = require2("better-sqlite3");
3037
+ const req = nodeRequire(import_meta4.url);
3038
+ cachedBetterSqlite33 = req("better-sqlite3");
3004
3039
  return cachedBetterSqlite33;
3005
3040
  } catch (e) {
3006
3041
  const hint = "To use the better-sqlite3 adapter, install the optional dependency: npm i better-sqlite3";
@@ -3203,7 +3238,6 @@ function migrateWorkspaceDb(db, meta) {
3203
3238
 
3204
3239
  // src/store/workspace/sqlJsAdapter.ts
3205
3240
  var import_node_fs13 = __toESM(require("fs"), 1);
3206
- var import_node_module5 = require("module");
3207
3241
  var import_node_path16 = __toESM(require("path"), 1);
3208
3242
  var import_meta5 = {};
3209
3243
  function detectFts5Support2(db) {
@@ -3294,7 +3328,7 @@ function defaultLocateFile(file) {
3294
3328
  } catch {
3295
3329
  }
3296
3330
  try {
3297
- const req = (0, import_node_module5.createRequire)(import_meta5.url);
3331
+ const req = nodeRequire(import_meta5.url);
3298
3332
  return req.resolve(spec);
3299
3333
  } catch {
3300
3334
  return file;
@@ -3468,7 +3502,6 @@ var WorkspaceStore = class {
3468
3502
  };
3469
3503
 
3470
3504
  // src/graph/neo4j.ts
3471
- var import_node_module6 = require("module");
3472
3505
  var import_meta7 = {};
3473
3506
  async function runSession(driver, database, fn) {
3474
3507
  const session = driver.session(database ? { database } : void 0);
@@ -3910,8 +3943,8 @@ var Neo4jGraphStore = class {
3910
3943
  };
3911
3944
  async function createNeo4jGraphStore(cfg) {
3912
3945
  try {
3913
- const require2 = (0, import_node_module6.createRequire)(import_meta7.url);
3914
- const neo4j = require2("neo4j-driver");
3946
+ const req = nodeRequire(import_meta7.url);
3947
+ const neo4j = req("neo4j-driver");
3915
3948
  const driver = neo4j.driver(cfg.uri, neo4j.auth.basic(cfg.user, cfg.password));
3916
3949
  const store = new Neo4jGraphStore(driver, cfg);
3917
3950
  await store.init();
@@ -4669,7 +4702,6 @@ var WorkspaceIndexer = class {
4669
4702
  };
4670
4703
 
4671
4704
  // src/embeddings/ollama.ts
4672
- var import_p_limit2 = __toESM(require("p-limit"), 1);
4673
4705
  var OllamaEmbeddingsProvider = class {
4674
4706
  id;
4675
4707
  dimension = null;
@@ -4714,7 +4746,7 @@ var OllamaEmbeddingsProvider = class {
4714
4746
  async embed(texts) {
4715
4747
  const batch = await this.tryBatchEndpoint(texts);
4716
4748
  if (batch) return batch;
4717
- const limit = (0, import_p_limit2.default)(this.concurrency);
4749
+ const limit = createLimit(this.concurrency);
4718
4750
  const out = await Promise.all(texts.map((t) => limit(() => this.embedOne(t))));
4719
4751
  return out;
4720
4752
  }
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  OpenAIEmbeddingsProvider,
6
6
  WorkspaceIndexer,
7
7
  loadConfigFile
8
- } from "./chunk-7B5W6SSN.js";
8
+ } from "./chunk-KLAW2DAP.js";
9
9
 
10
10
  // src/cli.ts
11
11
  import yargs from "yargs";
package/dist/index.cjs CHANGED
@@ -99,8 +99,36 @@ var OpenAIEmbeddingsProvider = class {
99
99
  }
100
100
  };
101
101
 
102
+ // src/limit.ts
103
+ function createLimit(concurrency) {
104
+ const n = Math.max(1, Math.floor(concurrency || 1));
105
+ let active = 0;
106
+ const queue = [];
107
+ const runNext = () => {
108
+ active--;
109
+ const next = queue.shift();
110
+ if (next) next();
111
+ };
112
+ return (fn) => new Promise((resolve, reject) => {
113
+ const run = () => {
114
+ active++;
115
+ Promise.resolve().then(fn).then(
116
+ (v) => {
117
+ resolve(v);
118
+ runNext();
119
+ },
120
+ (e) => {
121
+ reject(e);
122
+ runNext();
123
+ }
124
+ );
125
+ };
126
+ if (active < n) run();
127
+ else queue.push(run);
128
+ });
129
+ }
130
+
102
131
  // src/embeddings/ollama.ts
103
- var import_p_limit = __toESM(require("p-limit"), 1);
104
132
  var OllamaEmbeddingsProvider = class {
105
133
  id;
106
134
  dimension = null;
@@ -145,7 +173,7 @@ var OllamaEmbeddingsProvider = class {
145
173
  async embed(texts) {
146
174
  const batch = await this.tryBatchEndpoint(texts);
147
175
  if (batch) return batch;
148
- const limit = (0, import_p_limit.default)(this.concurrency);
176
+ const limit = createLimit(this.concurrency);
149
177
  const out = await Promise.all(texts.map((t) => limit(() => this.embedOne(t))));
150
178
  return out;
151
179
  }
@@ -971,16 +999,24 @@ async function createVectorIndex(vector) {
971
999
  return new BruteForceVectorIndex();
972
1000
  }
973
1001
 
974
- // src/optionalTypescript.ts
1002
+ // src/nodeRequire.ts
975
1003
  var import_node_module = require("module");
1004
+ function nodeRequire(metaUrl) {
1005
+ if (metaUrl) return (0, import_node_module.createRequire)(metaUrl);
1006
+ const r = typeof require === "function" ? require : null;
1007
+ if (r) return r;
1008
+ throw new Error("nodeRequire(metaUrl) requires a valid file URL (pass import.meta.url in ESM).");
1009
+ }
1010
+
1011
+ // src/optionalTypescript.ts
976
1012
  var import_meta = {};
977
1013
  var cached = null;
978
1014
  var didTryLoad = false;
979
1015
  function getTypeScript() {
980
1016
  if (didTryLoad) return cached;
981
1017
  try {
982
- const require2 = (0, import_node_module.createRequire)(import_meta.url);
983
- cached = require2("typescript");
1018
+ const req = nodeRequire(import_meta.url);
1019
+ cached = req("typescript");
984
1020
  didTryLoad = true;
985
1021
  return cached;
986
1022
  } catch {
@@ -1499,15 +1535,14 @@ var import_node_path6 = __toESM(require("path"), 1);
1499
1535
 
1500
1536
  // src/store/workspace/db.ts
1501
1537
  var import_node_fs4 = __toESM(require("fs"), 1);
1502
- var import_node_module2 = require("module");
1503
1538
  var import_node_path5 = __toESM(require("path"), 1);
1504
1539
  var import_meta2 = {};
1505
1540
  var cachedBetterSqlite3 = null;
1506
1541
  function loadBetterSqlite3() {
1507
1542
  if (cachedBetterSqlite3) return cachedBetterSqlite3;
1508
1543
  try {
1509
- const require2 = (0, import_node_module2.createRequire)(import_meta2.url);
1510
- cachedBetterSqlite3 = require2("better-sqlite3");
1544
+ const req = nodeRequire(import_meta2.url);
1545
+ cachedBetterSqlite3 = req("better-sqlite3");
1511
1546
  return cachedBetterSqlite3;
1512
1547
  } catch (e) {
1513
1548
  const hint = "To use the better-sqlite3 adapter, install the optional dependency: npm i better-sqlite3";
@@ -1710,7 +1745,6 @@ function migrateWorkspaceDb(db, meta) {
1710
1745
 
1711
1746
  // src/store/workspace/sqlJsAdapter.ts
1712
1747
  var import_node_fs6 = __toESM(require("fs"), 1);
1713
- var import_node_module3 = require("module");
1714
1748
  var import_node_path7 = __toESM(require("path"), 1);
1715
1749
  var import_meta3 = {};
1716
1750
  function detectFts5Support2(db) {
@@ -1801,7 +1835,7 @@ function defaultLocateFile(file) {
1801
1835
  } catch {
1802
1836
  }
1803
1837
  try {
1804
- const req = (0, import_node_module3.createRequire)(import_meta3.url);
1838
+ const req = nodeRequire(import_meta3.url);
1805
1839
  return req.resolve(spec);
1806
1840
  } catch {
1807
1841
  return file;
@@ -1991,7 +2025,6 @@ range:${r.startLine}:${r.startCharacter}-${r.endLine}:${r.endCharacter}`;
1991
2025
 
1992
2026
  // src/symbolGraph/vscodeProvider.ts
1993
2027
  var import_node_path10 = __toESM(require("path"), 1);
1994
- var import_node_module4 = require("module");
1995
2028
 
1996
2029
  // src/symbolGraph/strategies.ts
1997
2030
  var import_node_path9 = __toESM(require("path"), 1);
@@ -2329,8 +2362,8 @@ function makeVscodeFacade(vscode) {
2329
2362
  async function createVSCodeSymbolGraphProvider(opts) {
2330
2363
  let vscode;
2331
2364
  try {
2332
- const require2 = (0, import_node_module4.createRequire)(import_meta5.url);
2333
- vscode = require2("vscode");
2365
+ const req = nodeRequire(import_meta5.url);
2366
+ vscode = req("vscode");
2334
2367
  } catch {
2335
2368
  return null;
2336
2369
  }
@@ -2356,7 +2389,6 @@ async function createVSCodeSymbolGraphProvider(opts) {
2356
2389
  }
2357
2390
 
2358
2391
  // src/graph/neo4j.ts
2359
- var import_node_module5 = require("module");
2360
2392
  var import_meta6 = {};
2361
2393
  async function runSession(driver, database, fn) {
2362
2394
  const session = driver.session(database ? { database } : void 0);
@@ -2798,8 +2830,8 @@ var Neo4jGraphStore = class {
2798
2830
  };
2799
2831
  async function createNeo4jGraphStore(cfg) {
2800
2832
  try {
2801
- const require2 = (0, import_node_module5.createRequire)(import_meta6.url);
2802
- const neo4j = require2("neo4j-driver");
2833
+ const req = nodeRequire(import_meta6.url);
2834
+ const neo4j = req("neo4j-driver");
2803
2835
  const driver = neo4j.driver(cfg.uri, neo4j.auth.basic(cfg.user, cfg.password));
2804
2836
  const store = new Neo4jGraphStore(driver, cfg);
2805
2837
  await store.init();
@@ -2843,7 +2875,6 @@ function createAnnIndex(config) {
2843
2875
  // src/indexer/repoIndexer.ts
2844
2876
  var import_node_fs14 = __toESM(require("fs"), 1);
2845
2877
  var import_node_path19 = __toESM(require("path"), 1);
2846
- var import_p_limit2 = __toESM(require("p-limit"), 1);
2847
2878
 
2848
2879
  // src/utilNode.ts
2849
2880
  var import_node_os = __toESM(require("os"), 1);
@@ -2902,15 +2933,14 @@ function loadExtraIgnore(repoRoot, ignoreFiles) {
2902
2933
 
2903
2934
  // src/store/embeddingCache.ts
2904
2935
  var import_node_fs9 = __toESM(require("fs"), 1);
2905
- var import_node_module6 = require("module");
2906
2936
  var import_node_path13 = __toESM(require("path"), 1);
2907
2937
  var import_meta7 = {};
2908
2938
  var cachedBetterSqlite32 = null;
2909
2939
  function loadBetterSqlite32() {
2910
2940
  if (cachedBetterSqlite32) return cachedBetterSqlite32;
2911
2941
  try {
2912
- const require2 = (0, import_node_module6.createRequire)(import_meta7.url);
2913
- cachedBetterSqlite32 = require2("better-sqlite3");
2942
+ const req = nodeRequire(import_meta7.url);
2943
+ cachedBetterSqlite32 = req("better-sqlite3");
2914
2944
  return cachedBetterSqlite32;
2915
2945
  } catch (e) {
2916
2946
  const hint = "EmbeddingCache requires optional dependency 'better-sqlite3' (npm i better-sqlite3).";
@@ -2959,15 +2989,14 @@ var EmbeddingCache = class {
2959
2989
 
2960
2990
  // src/store/repoStore.ts
2961
2991
  var import_node_fs10 = __toESM(require("fs"), 1);
2962
- var import_node_module7 = require("module");
2963
2992
  var import_node_path14 = __toESM(require("path"), 1);
2964
2993
  var import_meta8 = {};
2965
2994
  var cachedBetterSqlite33 = null;
2966
2995
  function loadBetterSqlite33() {
2967
2996
  if (cachedBetterSqlite33) return cachedBetterSqlite33;
2968
2997
  try {
2969
- const require2 = (0, import_node_module7.createRequire)(import_meta8.url);
2970
- cachedBetterSqlite33 = require2("better-sqlite3");
2998
+ const req = nodeRequire(import_meta8.url);
2999
+ cachedBetterSqlite33 = req("better-sqlite3");
2971
3000
  return cachedBetterSqlite33;
2972
3001
  } catch (e) {
2973
3002
  const hint = "RepoStore requires optional dependency 'better-sqlite3' (npm i better-sqlite3).";
@@ -4230,7 +4259,7 @@ var RepoIndexer = class {
4230
4259
  currentCommit = null;
4231
4260
  currentBranch = null;
4232
4261
  fileIgnore = null;
4233
- serial = (0, import_p_limit2.default)(1);
4262
+ serial = createLimit(1);
4234
4263
  emitProgress(event) {
4235
4264
  try {
4236
4265
  this.progress?.emit(event);
@@ -4360,7 +4389,7 @@ var RepoIndexer = class {
4360
4389
  await this.deleteFile(known);
4361
4390
  }
4362
4391
  }
4363
- const limit = (0, import_p_limit2.default)(this.config.embed.concurrency);
4392
+ const limit = createLimit(this.config.embed.concurrency);
4364
4393
  await Promise.all(files.map((f) => limit(() => this.indexFile(f))));
4365
4394
  if (this.vector.get()) await this.vector.flushNow();
4366
4395
  this.emitProgress({
package/dist/index.js CHANGED
@@ -28,14 +28,14 @@ import {
28
28
  linkWorkspaceRepos,
29
29
  loadConfigFile,
30
30
  mergeIndexerConfig,
31
+ nodeRequire,
31
32
  pickRepoOverride,
32
33
  sqlJsAdapter,
33
34
  stableSymbolId
34
- } from "./chunk-7B5W6SSN.js";
35
+ } from "./chunk-KLAW2DAP.js";
35
36
 
36
37
  // src/symbolGraph/vscodeProvider.ts
37
38
  import path2 from "path";
38
- import { createRequire } from "module";
39
39
 
40
40
  // src/symbolGraph/strategies.ts
41
41
  import path from "path";
@@ -372,8 +372,8 @@ function makeVscodeFacade(vscode) {
372
372
  async function createVSCodeSymbolGraphProvider(opts) {
373
373
  let vscode;
374
374
  try {
375
- const require2 = createRequire(import.meta.url);
376
- vscode = require2("vscode");
375
+ const req = nodeRequire(import.meta.url);
376
+ vscode = req("vscode");
377
377
  } catch {
378
378
  return null;
379
379
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuralsea/workspace-indexer",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Local-first multi-repo workspace indexer (semantic embeddings + git-aware incremental updates + hybrid retrieval profiles) for AI agents.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,7 +48,6 @@
48
48
  "@noble/hashes": "^1.8.0",
49
49
  "chokidar": "^5.0.0",
50
50
  "ignore": "^7.0.5",
51
- "p-limit": "^7.2.0",
52
51
  "sql.js": "^1.13.0",
53
52
  "yargs": "^18.0.0"
54
53
  },