Skip to content

Commit 57047bf

Browse files
Replace path with pathe (#2481)
This is a simple way of getting rid of node path references in common and engine. I thought it best to also replace it in vscode so we don't have different implementations for path in the bundle. I guess for things like running tests and ours setup scrips then just using node path is probably fine? I could go either way. https://www.npmjs.com/package/pathe ## Checklist - [/] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet
1 parent 00651ad commit 57047bf

35 files changed

+70
-34
lines changed

packages/common/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"license": "MIT",
1818
"dependencies": {
1919
"lodash-es": "^4.17.21",
20+
"pathe": "^1.1.2",
2021
"vscode-uri": "^3.0.8"
2122
},
2223
"devDependencies": {

packages/common/src/testUtil/getFixturePaths.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as yaml from "js-yaml";
2-
import * as path from "path";
2+
import * as path from "pathe";
33
import { walkFilesSync } from "../util/walkSync";
44
import { getCursorlessRepoRoot } from "./getCursorlessRepoRoot";
55
import { TestCaseFixtureLegacy } from "../types/TestCaseFixture";

packages/common/src/util/walkAsync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as path from "path";
1+
import * as path from "pathe";
22
import { readdir } from "fs/promises";
33
import { flatten } from "lodash-es";
44

packages/common/src/util/walkSync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as path from "path";
1+
import * as path from "pathe";
22
import { readdirSync } from "fs";
33

44
/**

packages/cursorless-cheatsheet/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"@cursorless/common": "workspace:*",
2828
"immer": "^10.0.4",
2929
"lodash-es": "^4.17.21",
30-
"node-html-parser": "^6.1.12"
30+
"node-html-parser": "^6.1.12",
31+
"pathe": "^1.1.2"
3132
},
3233
"devDependencies": {
3334
"@types/lodash-es": "4.17.0"

packages/cursorless-cheatsheet/src/Cheatsheet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { getCursorlessRepoRoot, type IDE } from "@cursorless/common";
2-
import { readFile, writeFile } from "fs/promises";
2+
import { readFile, writeFile } from "node:fs/promises";
33
import { produce } from "immer";
44
import { sortBy } from "lodash-es";
55
import { parse } from "node-html-parser";
6-
import * as path from "path";
6+
import * as path from "pathe";
77

88
/**
99
* The argument expected by the cheatsheet command.

packages/cursorless-engine/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"lodash-es": "^4.17.21",
3030
"moo": "0.5.2",
3131
"nearley": "2.20.1",
32+
"node-html-parser": "^6.1.12",
33+
"pathe": "^1.1.2",
3234
"sbd": "^1.0.19",
3335
"uuid": "^9.0.1",
3436
"zod": "3.22.4"

packages/cursorless-engine/src/ScopeTestRecorder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from "@cursorless/common";
1212
import * as fs from "node:fs";
1313
import * as fsPromises from "node:fs/promises";
14-
import * as path from "node:path";
14+
import * as path from "pathe";
1515

1616
export class ScopeTestRecorder {
1717
constructor(private ide: IDE) {

packages/cursorless-engine/src/actions/ShowParseTree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FlashStyle, Range, TextDocument } from "@cursorless/common";
2-
import * as path from "node:path";
2+
import * as path from "pathe";
33
import type { Tree, TreeCursor } from "web-tree-sitter";
44
import type { TreeSitter } from "../typings/TreeSitter";
55
import { ide } from "../singletons/ide.singleton";

packages/cursorless-engine/src/languages/LanguageDefinition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
SimpleScopeType,
55
showError,
66
} from "@cursorless/common";
7-
import { basename, dirname, join } from "path";
7+
import { basename, dirname, join } from "pathe";
88
import { TreeSitterScopeHandler } from "../processTargets/modifiers/scopeHandlers";
99
import { ide } from "../singletons/ide.singleton";
1010
import { TreeSitter } from "../typings/TreeSitter";

0 commit comments

Comments
 (0)