@lvce-editor/search-process 9.4.0 → 10.0.0

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -462,7 +462,7 @@ const listen$a = () => {
462
462
  parentPort
463
463
  } = process;
464
464
  if (!parentPort) {
465
- throw new Error('parent port must be defined');
465
+ throw new IpcError('parent port must be defined');
466
466
  }
467
467
  return parentPort;
468
468
  };
@@ -520,7 +520,7 @@ const getTransferrablesNode = value => {
520
520
  };
521
521
  const listen$5 = async () => {
522
522
  if (!process.send) {
523
- throw new Error('process.send must be defined');
523
+ throw new IpcError('process.send must be defined');
524
524
  }
525
525
  return process;
526
526
  };
@@ -1509,6 +1509,13 @@ const searchFile = async ({
1509
1509
  const Utf8 = 'utf8';
1510
1510
  const Base64 = 'base64';
1511
1511
 
1512
+ const formatFile = text => {
1513
+ if (text.startsWith('./') || text.startsWith('.\\')) {
1514
+ return text.slice(2);
1515
+ }
1516
+ return text;
1517
+ };
1518
+
1512
1519
  const processData = async (stdout, handleData) => {
1513
1520
  await pipeline(stdout, new Writable({
1514
1521
  decodeStrings: false,
@@ -1599,7 +1606,7 @@ const collectStdout = async (stdout, kill, maxSearchResults, charsBefore, charsA
1599
1606
  start: 0,
1600
1607
  end: 0,
1601
1608
  lineNumber: 0,
1602
- text: data.path.text
1609
+ text: formatFile(data.path.text)
1603
1610
  }];
1604
1611
  break;
1605
1612
  case Match$1:
@@ -1711,7 +1718,7 @@ const search = async ({
1711
1718
  ripGrepArgs = []
1712
1719
  } = {}) => {
1713
1720
  const charsBefore = 26;
1714
- const charsAfter = 50;
1721
+ const charsAfter = 50; // TODO pass these also in as parameters
1715
1722
  const cwd = ensurePath(searchDir);
1716
1723
  const childProcess = spawn(ripGrepArgs, {
1717
1724
  cwd
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/search-process",
3
- "version": "9.4.0",
3
+ "version": "10.0.0",
4
4
  "description": "Search Process",
5
5
  "keywords": [
6
6
  "Lvce Editor",
@@ -22,7 +22,7 @@
22
22
  "ws": "^8.18.3"
23
23
  },
24
24
  "optionalDependencies": {
25
- "@lvce-editor/ripgrep": "^2.1.0"
25
+ "@lvce-editor/ripgrep": "^2.4.0"
26
26
  },
27
27
  "engines": {
28
28
  "node": ">=22"