Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace path with pathe #2481

Merged
merged 8 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"license": "MIT",
"dependencies": {
"lodash-es": "^4.17.21",
"pathe": "^1.1.2",
"vscode-uri": "^3.0.8"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/testUtil/getFixturePaths.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as yaml from "js-yaml";
import * as path from "path";
import * as path from "pathe";
import { walkFilesSync } from "../util/walkSync";
import { getCursorlessRepoRoot } from "./getCursorlessRepoRoot";
import { TestCaseFixtureLegacy } from "../types/TestCaseFixture";
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/util/walkAsync.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as path from "path";
import * as path from "pathe";
import { readdir } from "fs/promises";
import { flatten } from "lodash-es";

Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/util/walkSync.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as path from "path";
import * as path from "pathe";
import { readdirSync } from "fs";

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/cursorless-cheatsheet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"@cursorless/common": "workspace:*",
"immer": "^10.0.4",
"lodash-es": "^4.17.21",
"node-html-parser": "^6.1.12"
"node-html-parser": "^6.1.12",
"pathe": "^1.1.2"
},
"devDependencies": {
"@types/lodash-es": "4.17.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/cursorless-cheatsheet/src/Cheatsheet.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { getCursorlessRepoRoot, type IDE } from "@cursorless/common";
import { readFile, writeFile } from "fs/promises";
import { readFile, writeFile } from "node:fs/promises";
import { produce } from "immer";
import { sortBy } from "lodash-es";
import { parse } from "node-html-parser";
import * as path from "path";
import * as path from "pathe";

/**
* The argument expected by the cheatsheet command.
Expand Down
2 changes: 2 additions & 0 deletions packages/cursorless-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"lodash-es": "^4.17.21",
"moo": "0.5.2",
"nearley": "2.20.1",
"node-html-parser": "^6.1.12",
"pathe": "^1.1.2",
"sbd": "^1.0.19",
"uuid": "^9.0.1",
"zod": "3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/cursorless-engine/src/ScopeTestRecorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "@cursorless/common";
import * as fs from "node:fs";
import * as fsPromises from "node:fs/promises";
import * as path from "node:path";
import * as path from "pathe";

export class ScopeTestRecorder {
constructor(private ide: IDE) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cursorless-engine/src/actions/ShowParseTree.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FlashStyle, Range, TextDocument } from "@cursorless/common";
import * as path from "node:path";
import * as path from "pathe";
import type { Tree, TreeCursor } from "web-tree-sitter";
import type { TreeSitter } from "../typings/TreeSitter";
import { ide } from "../singletons/ide.singleton";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
SimpleScopeType,
showError,
} from "@cursorless/common";
import { basename, dirname, join } from "path";
import { basename, dirname, join } from "pathe";
import { TreeSitterScopeHandler } from "../processTargets/modifiers/scopeHandlers";
import { ide } from "../singletons/ide.singleton";
import { TreeSitter } from "../typings/TreeSitter";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
isTesting,
showError,
} from "@cursorless/common";
import { join } from "path";
import { join } from "pathe";
import { SyntaxNode } from "web-tree-sitter";
import { TreeSitter } from "../typings/TreeSitter";
import { ide } from "../singletons/ide.singleton";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Disposable, FileSystem, Notifier } from "@cursorless/common";
import { readFile } from "fs/promises";

import * as path from "path";
import * as path from "pathe";
import {
NeedsInitialTalonUpdateError,
SpokenFormEntry,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { promises as fsp } from "fs";
import * as path from "path";
import * as path from "pathe";
import * as yaml from "js-yaml";
import { mkdir, rename } from "fs/promises";
import { TestCaseFixture } from "@cursorless/common";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import * as fs from "fs";
import { access, readFile } from "fs/promises";
import { invariant } from "immutability-helper";
import { merge } from "lodash-es";
import * as path from "path";
import * as path from "pathe";
import { CommandRunner } from "../CommandRunner";
import { StoredTargetMap } from "../core/StoredTargets";
import { SpokenFormGenerator } from "../generateSpokenForm";
Expand Down
1 change: 1 addition & 0 deletions packages/cursorless-vscode-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"chai": "^5.1.0",
"js-yaml": "^4.1.0",
"mocha": "^10.3.0",
"pathe": "^1.1.2",
"sinon": "^17.0.1"
},
"types": "./out/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { assert } from "chai";
import { existsSync } from "node:fs";
import { readFile, readdir, rm } from "node:fs/promises";
import path from "node:path";
import * as path from "pathe";
import * as vscode from "vscode";
import { endToEndTestSetup } from "../endToEndTestSetup";
import { produce } from "immer";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { assert } from "chai";
import * as vscode from "vscode";
import { endToEndTestSetup, sleepWithBackoff } from "../../endToEndTestSetup";
import sinon from "sinon";
import path from "path";
import * as path from "pathe";
import { getCursorlessRepoRoot } from "@cursorless/common";
import { readFile } from "node:fs/promises";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { assert } from "chai";
import * as crypto from "crypto";
import { mkdir, readdir, readFile, rm } from "fs/promises";
import * as os from "os";
import * as path from "path";
import { basename } from "path";
import * as path from "pathe";
import * as vscode from "vscode";
import { endToEndTestSetup } from "../endToEndTestSetup";

Expand Down Expand Up @@ -158,7 +157,7 @@ async function checkRecordedTest(tmpdir: string) {
assert.lengthOf(paths, 1);

const actualRecordedTestPath = paths[0];
assert.equal(basename(actualRecordedTestPath), "takeHarp.yml");
assert.equal(path.basename(actualRecordedTestPath), "takeHarp.yml");

const expected = (
await readFile(
Expand Down
1 change: 1 addition & 0 deletions packages/cursorless-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,7 @@
"itertools": "^2.2.5",
"lodash-es": "^4.17.21",
"nearley": "2.20.1",
"pathe": "^1.1.2",
"semver": "^7.6.0",
"tinycolor2": "1.6.0",
"trie-search": "2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cursorless-vscode/src/VscodeSnippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from "@cursorless/cursorless-engine";
import { readFile, stat, open } from "fs/promises";
import { max } from "lodash-es";
import { join } from "path";
import { join } from "pathe";

const CURSORLESS_SNIPPETS_SUFFIX = ".cursorless-snippets";
const SNIPPET_DIR_REFRESH_INTERVAL_MS = 1000;
Expand Down
2 changes: 1 addition & 1 deletion packages/cursorless-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from "@cursorless/vscode-common";
import * as crypto from "crypto";
import * as os from "os";
import * as path from "path";
import * as path from "pathe";
import * as vscode from "vscode";
import { constructTestHelpers } from "./constructTestHelpers";
import { FakeFontMeasurements } from "./ide/vscode/hats/FakeFontMeasurements";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
PathChangeListener,
RunMode,
} from "@cursorless/common";
import { isAbsolute, join } from "path";
import { isAbsolute, join } from "pathe";
import * as vscode from "vscode";

export class VscodeFileSystem implements FileSystem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { VscodeApi } from "@cursorless/vscode-common";
import { cloneDeep, isEqual } from "lodash-es";
import * as fs from "fs/promises";
import * as path from "node:path";
import * as path from "pathe";
import * as vscode from "vscode";
import { vscodeGetConfigurationString } from "../VscodeConfiguration";
import VscodeEnabledHatStyleManager, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copies files into `dist` directory for packaging
import { copy, exists } from "fs-extra";
import { lstat, mkdir, readFile, rm, writeFile } from "fs/promises";
import * as path from "path";
import * as path from "pathe";
import { assets } from "./assets";
import { Context } from "./context";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getCursorlessRepoRoot } from "@cursorless/common";
import * as parser from "fast-xml-parser";
import { promises as fsp, readdirSync } from "fs";
import * as path from "path";
import * as path from "pathe";

async function main() {
const directory = path.join(getCursorlessRepoRoot(), "images/hats");
Expand Down
3 changes: 2 additions & 1 deletion packages/file-system-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
},
"dependencies": {
"@cursorless/common": "workspace:*",
"glob": "^10.3.10"
"glob": "^10.3.10",
"pathe": "^1.1.2"
},
"devDependencies": {
"@types/glob": "^8.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type {
CommandHistoryStorage,
} from "@cursorless/common";
import { glob } from "glob";
import fs from "node:fs/promises";
import path from "node:path";
import * as fs from "node:fs/promises";
import * as path from "pathe";

export class FileSystemCommandHistoryStorage implements CommandHistoryStorage {
constructor(private dir: string) {}
Expand Down
2 changes: 1 addition & 1 deletion packages/meta-updater/src/toPosixPath.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "path";
import * as path from "path";

export function toPosixPath(p: string) {
return p.split(path.sep).join(path.posix.sep);
Expand Down
2 changes: 1 addition & 1 deletion packages/meta-updater/src/updateTSConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FormatPluginFnOptions } from "@pnpm/meta-updater";
import normalizePath from "normalize-path";
import path from "path";
import * as path from "path";
import { pathExists } from "path-exists";
import { PackageJson, TsConfigJson } from "type-fest";
import { toPosixPath } from "./toPosixPath";
Expand Down
3 changes: 2 additions & 1 deletion packages/test-harness/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"license": "MIT",
"dependencies": {
"@cursorless/common": "workspace:*",
"glob": "^10.3.10"
"glob": "^10.3.10",
"pathe": "^1.1.2"
},
"devDependencies": {
"@types/glob": "^8.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-harness/src/launchVscodeAndRunTests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as cp from "child_process";
import * as path from "path";
import * as path from "pathe";
import * as os from "os";
import {
downloadAndUnzipVSCode,
Expand Down
2 changes: 1 addition & 1 deletion packages/test-harness/src/runAllTests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Mocha from "mocha";
import * as path from "path";
import * as path from "pathe";
import { getCursorlessRepoRoot } from "@cursorless/common";
import { runTestSubset, testSubsetGrepString } from "./testSubset";
import { glob } from "glob";
Expand Down
2 changes: 1 addition & 1 deletion packages/test-harness/src/scripts/runTestsCI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { getCursorlessRepoRoot } from "@cursorless/common";
import * as path from "path";
import * as path from "pathe";
import { launchVscodeAndRunTests } from "../launchVscodeAndRunTests";

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/test-harness/src/testSubset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fs from "fs";
import * as path from "path";
import * as path from "pathe";
import { getCursorlessRepoRoot } from "@cursorless/common";

/**
Expand Down
29 changes: 29 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading