From a47118ae5e1ed32494ff1e3df59148c70abf9f1a Mon Sep 17 00:00:00 2001 From: Keegan Carruthers-Smith Date: Thu, 27 Jun 2024 16:50:46 +0200 Subject: [PATCH] more node: prefix --- bin/cli.mts | 6 +++--- client/vscode-lib/src/configuration.ts | 2 +- client/vscode/dev/release.mts | 6 +++--- client/vscode/test/integration/api.test.cts | 6 +++--- client/vscode/test/integration/index.cts | 2 +- client/vscode/test/integration/main.cts | 6 +++--- client/web-playground/vite.config.ts | 2 +- lib/schema/dev/generateJsonSchemaTypes.ts | 4 ++-- provider/devdocs/devdocs.ts | 2 +- provider/devdocs/index.test.ts | 4 ++-- provider/devdocs/update-fixtures.ts | 4 ++-- provider/google-docs/auth.ts | 4 ++-- provider/linear-docs/auth.ts | 8 ++++---- provider/linear-docs/index.ts | 2 +- provider/linear-issues/auth.ts | 8 ++++---- provider/linear-issues/index.ts | 2 +- vitest.workspace.ts | 4 ++-- web/src/server/root.ts | 4 ++-- 18 files changed, 38 insertions(+), 38 deletions(-) diff --git a/bin/cli.mts b/bin/cli.mts index 62fa10a6..8e173ece 100644 --- a/bin/cli.mts +++ b/bin/cli.mts @@ -1,7 +1,7 @@ #!/usr/bin/env -S node --experimental-modules --experimental-network-imports --no-warnings -import { readFileSync } from 'fs' -import path from 'path' -import { pathToFileURL } from 'url' +import { readFileSync } from 'node:fs' +import path from 'node:path' +import { pathToFileURL } from 'node:url' import { type Client, type ClientConfiguration, diff --git a/client/vscode-lib/src/configuration.ts b/client/vscode-lib/src/configuration.ts index 1f595ad8..11d48ffc 100644 --- a/client/vscode-lib/src/configuration.ts +++ b/client/vscode-lib/src/configuration.ts @@ -1,4 +1,4 @@ -import path from 'path' +import path from 'node:path' import type { ClientConfiguration } from '@openctx/client' import * as vscode from 'vscode' diff --git a/client/vscode/dev/release.mts b/client/vscode/dev/release.mts index ce3d4232..d641650f 100644 --- a/client/vscode/dev/release.mts +++ b/client/vscode/dev/release.mts @@ -1,7 +1,7 @@ import { execFileSync } from 'child_process' -import fs from 'fs' -import path from 'path' -import { fileURLToPath } from 'url' +import fs from 'node:fs' +import path from 'node:path' +import { fileURLToPath } from 'node:url' import semver from 'semver' const __dirname = path.dirname(fileURLToPath(import.meta.url)) diff --git a/client/vscode/test/integration/api.test.cts b/client/vscode/test/integration/api.test.cts index d4027a6c..6c7eea5a 100644 --- a/client/vscode/test/integration/api.test.cts +++ b/client/vscode/test/integration/api.test.cts @@ -1,8 +1,8 @@ -import * as assert from 'assert' -import path from 'path' +import * as assert from 'node:assert' +import { copyFile } from 'node:fs/promises' +import path from 'node:path' import type { ClientConfiguration } from '@openctx/client' import type { ExtensionApiForTesting } from '@openctx/vscode-lib' -import { copyFile } from 'node:fs/promises' import { before } from 'mocha' import * as vscode from 'vscode' diff --git a/client/vscode/test/integration/index.cts b/client/vscode/test/integration/index.cts index 51722b26..5e04a236 100644 --- a/client/vscode/test/integration/index.cts +++ b/client/vscode/test/integration/index.cts @@ -1,4 +1,4 @@ -import * as path from 'path' +import * as path from 'node:path' import { globSync } from 'glob' import Mocha from 'mocha' diff --git a/client/vscode/test/integration/main.cts b/client/vscode/test/integration/main.cts index e10a9ef2..ca2d8d96 100644 --- a/client/vscode/test/integration/main.cts +++ b/client/vscode/test/integration/main.cts @@ -1,7 +1,7 @@ -import { tmpdir } from 'os' -import * as path from 'path' -import { runTests } from '@vscode/test-electron' import { mkdir, mkdtemp, rm } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import * as path from 'node:path' +import { runTests } from '@vscode/test-electron' async function main(): Promise { // When run, this script's filename is `client/vscode/dist/tsc/test/integration/main.js`, so diff --git a/client/web-playground/vite.config.ts b/client/web-playground/vite.config.ts index 29d29ece..ac6039ef 100644 --- a/client/web-playground/vite.config.ts +++ b/client/web-playground/vite.config.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'node:path' import react from '@vitejs/plugin-react' import { defineConfig } from 'vite' diff --git a/lib/schema/dev/generateJsonSchemaTypes.ts b/lib/schema/dev/generateJsonSchemaTypes.ts index b23741e0..9b229f9d 100644 --- a/lib/schema/dev/generateJsonSchemaTypes.ts +++ b/lib/schema/dev/generateJsonSchemaTypes.ts @@ -2,9 +2,9 @@ * Generates TypeScript types for a JSON Schema. */ -import path from 'path' -import { pathToFileURL } from 'url' import { readFile } from 'node:fs/promises' +import path from 'node:path' +import { pathToFileURL } from 'node:url' import { compile as compileJSONSchema } from 'json-schema-to-typescript' async function generateSchema(schemaPath: string, preamble?: string): Promise { diff --git a/provider/devdocs/devdocs.ts b/provider/devdocs/devdocs.ts index 00ba1332..951fc824 100644 --- a/provider/devdocs/devdocs.ts +++ b/provider/devdocs/devdocs.ts @@ -1,5 +1,5 @@ -import url from 'url' import fs from 'node:fs/promises' +import url from 'node:url' /** Format of the file found at a location like https://devdocs.io/docs/go/index.json */ interface Index { diff --git a/provider/devdocs/index.test.ts b/provider/devdocs/index.test.ts index 8bd18e87..f07884f4 100644 --- a/provider/devdocs/index.test.ts +++ b/provider/devdocs/index.test.ts @@ -1,5 +1,5 @@ -import path from 'path' -import url from 'url' +import path from 'node:path' +import url from 'node:url' import type { Item, Mention, MentionsParams } from '@openctx/provider' import { describe, expect, test } from 'vitest' import devdocs, { type Settings } from './index.js' diff --git a/provider/devdocs/update-fixtures.ts b/provider/devdocs/update-fixtures.ts index f615ffeb..1cc51420 100644 --- a/provider/devdocs/update-fixtures.ts +++ b/provider/devdocs/update-fixtures.ts @@ -1,6 +1,6 @@ -import path from 'path' -import url from 'url' import fs from 'node:fs/promises' +import path from 'node:path' +import url from 'node:url' import { fetchDoc, fetchIndex } from './devdocs.js' /** diff --git a/provider/google-docs/auth.ts b/provider/google-docs/auth.ts index 5fddcc1a..8530e229 100644 --- a/provider/google-docs/auth.ts +++ b/provider/google-docs/auth.ts @@ -1,7 +1,7 @@ -import { readFileSync } from 'fs' import http from 'http' import type { AddressInfo } from 'net' -import url from 'url' +import { readFileSync } from 'node:fs' +import url from 'node:url' import dedent from 'dedent' import { OAuth2Client } from 'google-auth-library' import open from 'open' diff --git a/provider/linear-docs/auth.ts b/provider/linear-docs/auth.ts index 355cfb61..6ac41e28 100644 --- a/provider/linear-docs/auth.ts +++ b/provider/linear-docs/auth.ts @@ -1,9 +1,9 @@ +import http from 'http' // Identical to provider/linear-issues/auth.ts. // Keep the duplicate for now to keep things simple. -import { readFileSync, writeFileSync } from 'fs' -import http from 'http' -import path from 'path' -import url, { fileURLToPath } from 'url' +import { readFileSync, writeFileSync } from 'node:fs' +import path from 'node:path' +import url, { fileURLToPath } from 'node:url' import open from 'open' import destroyer from 'server-destroy' diff --git a/provider/linear-docs/index.ts b/provider/linear-docs/index.ts index dd7bf5d3..5ff4b398 100644 --- a/provider/linear-docs/index.ts +++ b/provider/linear-docs/index.ts @@ -1,4 +1,4 @@ -import { readFileSync } from 'fs' +import { readFileSync } from 'node:fs' import type { ItemsParams, ItemsResult, diff --git a/provider/linear-issues/auth.ts b/provider/linear-issues/auth.ts index fffd035b..5e0050d0 100644 --- a/provider/linear-issues/auth.ts +++ b/provider/linear-issues/auth.ts @@ -1,9 +1,9 @@ +import http from 'http' // Identical to provider/linear-docs/auth.ts. // Keep the duplicate for now to keep things simple. -import { readFileSync, writeFileSync } from 'fs' -import http from 'http' -import path from 'path' -import url, { fileURLToPath } from 'url' +import { readFileSync, writeFileSync } from 'node:fs' +import path from 'node:path' +import url, { fileURLToPath } from 'node:url' import open from 'open' import destroyer from 'server-destroy' diff --git a/provider/linear-issues/index.ts b/provider/linear-issues/index.ts index 2e792b9d..ed19a7db 100644 --- a/provider/linear-issues/index.ts +++ b/provider/linear-issues/index.ts @@ -1,3 +1,4 @@ +import { readFile } from 'node:fs/promises' import type { ItemsParams, ItemsResult, @@ -8,7 +9,6 @@ import type { } from '@openctx/provider' import dedent from 'dedent' import { XMLBuilder } from 'fast-xml-parser' -import { readFile } from 'node:fs/promises' import type { UserCredentials } from './auth.js' diff --git a/vitest.workspace.ts b/vitest.workspace.ts index e481c9b1..ccc26cc2 100644 --- a/vitest.workspace.ts +++ b/vitest.workspace.ts @@ -1,5 +1,5 @@ -import { readFileSync } from 'fs' -import path from 'path' +import { readFileSync } from 'node:fs' +import path from 'node:path' import { load } from 'js-yaml' interface PnpmWorkspaceFile { diff --git a/web/src/server/root.ts b/web/src/server/root.ts index e560478d..80940ba0 100644 --- a/web/src/server/root.ts +++ b/web/src/server/root.ts @@ -1,7 +1,7 @@ // https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-when-using-the-experimental-modules-flag/50052194#50052194 -import { dirname } from 'path' -import { fileURLToPath } from 'url' +import { dirname } from 'node:path' +import { fileURLToPath } from 'node:url' export { root }