Skip to content

Commit fab8ceb

Browse files
committed
port to node/vitest/swc-core
1 parent 0142261 commit fab8ceb

13 files changed

+10857
-460
lines changed

README.md

+4-432
Large diffs are not rendered by default.

bun.lockb

-265 KB
Binary file not shown.

package-lock.json

+10,819
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+20-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
{
2-
"name": "bunvim",
3-
"author": "wallpants",
2+
"name": "nvim-node",
3+
"author": "dlants",
44
"type": "module",
55
"version": "0.0.0",
66
"license": "MIT",
7-
"description": "Neovim bun client",
7+
"description": "minimalist neovim client for node",
88
"repository": {
99
"type": "git",
10-
"url": "git://github.com/wallpants/bunvim.git"
11-
},
12-
"bin": {
13-
"bunvim": "src/cli/index.ts"
10+
"url": "git://github.com/dlants/nvim-node.git"
1411
},
1512
"exports": {
16-
"types": "./src/index.ts",
17-
"bun": "./src/index.ts"
13+
"types": "./src/index.ts"
1814
},
1915
"release": {
2016
"branches": [
@@ -38,21 +34,21 @@
3834
},
3935
"scripts": {
4036
"commit": "cz",
41-
"vi": "nvim",
4237
"format": "prettier **/*.{md,ts,yml} -w",
4338
"lint": "eslint . --ext ts --report-unused-disable-directives --max-warnings 0",
4439
"typecheck": "tsc",
45-
"check": "bun run typecheck && bun run lint"
40+
"check": "npm run typecheck && npm run lint"
4641
},
4742
"dependencies": {
43+
"@types/node": "^22.10.5",
4844
"commander": "^12.1.0",
4945
"msgpackr": "^1.11.2",
5046
"winston": "^3.16.0"
5147
},
5248
"devDependencies": {
5349
"@commitlint/config-conventional": "^19.5.0",
5450
"@commitlint/cz-commitlint": "^19.5.0",
55-
"@types/bun": "^1.1.12",
51+
"@swc-node/register": "^1.10.9",
5652
"@typescript-eslint/eslint-plugin": "^8.12.2",
5753
"@typescript-eslint/parser": "^8.13.0",
5854
"commitizen": "^4.3.1",
@@ -61,6 +57,16 @@
6157
"prettier": "^3.3.3",
6258
"prettier-plugin-organize-imports": "^4.1.0",
6359
"semantic-release": "^24.2.0",
64-
"typescript": "^5.6.3"
65-
}
60+
"typescript": "^5.6.3",
61+
"vitest": "^2.1.8"
62+
},
63+
"main": "index.js",
64+
"directories": {
65+
"doc": "docs",
66+
"test": "tests"
67+
},
68+
"bugs": {
69+
"url": "https://github.com/dlants/nvim-node/issues"
70+
},
71+
"homepage": "https://github.com/dlants/nvim-node#readme"
6672
}

src/attach.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, expect, it } from "bun:test";
1+
import { describe, expect, it } from "vitest";
22
import { withNvimClient } from "../tests/preamble";
33

44
describe("src/attach.test.ts", () => {

src/attach.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function attach<ApiInfo extends BaseEvents = BaseEvents>({
5858
logger?.debug("connection closed by neovim");
5959
})
6060
.on("close", () => {
61-
logger?.debug("connection closed by bunvim");
61+
logger?.debug("connection closed by node");
6262
});
6363
resolve(client);
6464
});

src/cli/generate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function generateTypescriptContent(neovimApi: ApiMeta) {
4040
* file generated by bunvim: https://github.com/gualcasas/bunvim
4141
*/
4242
43-
import { type EventsMap } from "bunvim";
43+
import { type EventsMap } from "nvim-node";
4444
4545
export type NeovimApi<
4646
Notifications extends EventsMap = EventsMap,

src/cli/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#!/usr/bin/env bun
1+
#!/usr/bin/env node --import @swc-node/register/esm-register script.ts
22
import { program } from "commander";
33
import { version } from "../../package.json";
44

5-
program.name("bunvim").description("CLI to work with neovim's bun client").version(version);
5+
program.name("nvim-node").description("CLI to work with neovim's node client").version(version);
66

77
program
88
.command("logs")
9-
.description("print bunvim client logs")
9+
.description("print nvim-node client logs")
1010
.argument("<client_name>", "Client name you specify in your attach call.")
1111
.action((name) => {
1212
Bun.spawn({
13-
cmd: ["tail", "-F", "-n", "0", `/tmp/${name}.bunvim.logs`],
13+
cmd: ["tail", "-F", "-n", "0", `/tmp/${name}.node.logs`],
1414
stdin: null,
1515
stdout: "inherit",
1616
});

src/logger.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function createLogger(
88
) {
99
if (!logging?.level) return;
1010

11-
const defaultFilePath = `/tmp/${client.name}.bunvim.logs`;
11+
const defaultFilePath = `/tmp/${client.name}.node.logs`;
1212

1313
const logger = winston.createLogger({
1414
level: logging.level,

src/tests.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type MyEvents = {
1515
const nvim = await attach<MyEvents>({
1616
socket: SOCKET,
1717
client: {
18-
name: "bunvim",
18+
name: "node",
1919
version: {
2020
minor: 0,
2121
},

src/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export type AttachParams = {
8686
* @example
8787
* ```lua
8888
* -- init.lua
89-
* vim.fn.jobstart("bun run src/main.ts", { cwd = root_dir })
89+
* vim.fn.jobstart("npm run src/main.ts", { cwd = root_dir })
9090
* ```
9191
*
9292
* ```typescript
@@ -112,7 +112,7 @@ export type AttachParams = {
112112
logging?: {
113113
/**
114114
* @remarks
115-
* bunvim internally logs with `logger.debug()` and `logger.error()`
115+
* node internally logs with `logger.debug()` and `logger.error()`
116116
* Set logLevel higher than `debug` to not display bunvim's internal logs
117117
*
118118
* Levels from highest to lowest priority

tests/preamble.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { unlink } from "node:fs/promises";
33
import { spawn } from "child_process";
44
import path from "path";
55

6-
const SOCK = `/tmp/bunvim-test.sock`;
6+
const SOCK = `/tmp/nvim-node-test.sock`;
77
export async function withNvimProcess(fn: (sock: string) => Promise<void>) {
88
try {
99
await unlink(SOCK);
@@ -51,7 +51,7 @@ export async function withNvimProcess(fn: (sock: string) => Promise<void>) {
5151
}
5252

5353
export async function withNvimClient(fn: (nvim: Nvim) => Promise<void>) {
54-
return await withNvimProcess(async (sock) => {
54+
return withNvimProcess(async (sock) => {
5555
const nvim = await attach({
5656
socket: sock,
5757
client: { name: "test" },

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"target": "ESNext",
66
"moduleResolution": "Bundler",
77
"moduleDetection": "force",
8-
"types": ["bun-types"],
8+
"types": [],
99
"allowImportingTsExtensions": true,
1010
"noEmit": true,
1111
"strict": true,

0 commit comments

Comments
 (0)