From 8eecfe72ada3dff85b50b142bae18a4d42fa48ab Mon Sep 17 00:00:00 2001 From: Eric Crosson Date: Mon, 23 Dec 2024 13:40:49 -0600 Subject: [PATCH] fix: import Node.js path module using node: import syntax This ensures the Node.js-provided `path` module is always the module loaded. --- packages/openapi-generator/src/cli.ts | 2 +- packages/openapi-generator/src/packageInfo.ts | 2 +- packages/openapi-generator/src/project.ts | 2 +- packages/openapi-generator/src/resolveInit.ts | 2 +- packages/openapi-generator/test/externalModule.test.ts | 2 +- packages/openapi-generator/test/externalModuleApiSpec.test.ts | 2 +- packages/superagent-wrapper/src/request.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/openapi-generator/src/cli.ts b/packages/openapi-generator/src/cli.ts index 2b45fdb0..c0b715c6 100644 --- a/packages/openapi-generator/src/cli.ts +++ b/packages/openapi-generator/src/cli.ts @@ -3,7 +3,7 @@ import { command, run, option, string, optional, positional } from 'cmd-ts'; import * as E from 'fp-ts/Either'; import * as fs from 'fs'; -import * as p from 'path'; +import * as p from 'node:path'; import type { Expression } from '@swc/core'; import type { OpenAPIV3 } from 'openapi-types'; diff --git a/packages/openapi-generator/src/packageInfo.ts b/packages/openapi-generator/src/packageInfo.ts index 1ed962eb..b8a13c13 100644 --- a/packages/openapi-generator/src/packageInfo.ts +++ b/packages/openapi-generator/src/packageInfo.ts @@ -1,5 +1,5 @@ import * as fs from 'fs/promises'; -import * as p from 'path'; +import * as p from 'node:path'; export async function getPackageJsonPath( entryPoint: string, diff --git a/packages/openapi-generator/src/project.ts b/packages/openapi-generator/src/project.ts index 788b8e4f..1064051c 100644 --- a/packages/openapi-generator/src/project.ts +++ b/packages/openapi-generator/src/project.ts @@ -1,5 +1,5 @@ import * as fs from 'fs'; -import * as p from 'path'; +import * as p from 'node:path'; import { promisify } from 'util'; import * as E from 'fp-ts/Either'; import resolve from 'resolve'; diff --git a/packages/openapi-generator/src/resolveInit.ts b/packages/openapi-generator/src/resolveInit.ts index 567ed1dd..384a9bd4 100644 --- a/packages/openapi-generator/src/resolveInit.ts +++ b/packages/openapi-generator/src/resolveInit.ts @@ -1,7 +1,7 @@ import * as swc from '@swc/core'; import type { Block } from 'comment-parser'; import * as E from 'fp-ts/Either'; -import { dirname } from 'path'; +import { dirname } from 'node:path'; import type { Project } from './project'; import type { SourceFile } from './sourceFile'; diff --git a/packages/openapi-generator/test/externalModule.test.ts b/packages/openapi-generator/test/externalModule.test.ts index 07891023..b951377d 100644 --- a/packages/openapi-generator/test/externalModule.test.ts +++ b/packages/openapi-generator/test/externalModule.test.ts @@ -1,7 +1,7 @@ import * as E from 'fp-ts/lib/Either'; import assert from 'node:assert/strict'; import test from 'node:test'; -import * as p from 'path'; +import * as p from 'node:path'; import { parsePlainInitializer, Project, type Schema } from '../src'; import { KNOWN_IMPORTS } from '../src/knownImports'; diff --git a/packages/openapi-generator/test/externalModuleApiSpec.test.ts b/packages/openapi-generator/test/externalModuleApiSpec.test.ts index ee535964..401d70c8 100644 --- a/packages/openapi-generator/test/externalModuleApiSpec.test.ts +++ b/packages/openapi-generator/test/externalModuleApiSpec.test.ts @@ -12,7 +12,7 @@ import { } from '../src'; import { KNOWN_IMPORTS } from '../src/knownImports'; import { findSymbolInitializer } from '../src/resolveInit'; -import * as p from 'path'; +import * as p from 'node:path'; import * as E from 'fp-ts/Either'; /** External library parsing and api spec generation test case diff --git a/packages/superagent-wrapper/src/request.ts b/packages/superagent-wrapper/src/request.ts index d4147412..9564bd3c 100644 --- a/packages/superagent-wrapper/src/request.ts +++ b/packages/superagent-wrapper/src/request.ts @@ -3,7 +3,7 @@ import * as E from 'fp-ts/Either'; import { pipe } from 'fp-ts/pipeable'; import * as t from 'io-ts'; import * as PathReporter from 'io-ts/lib/PathReporter'; -import { posix } from 'path'; +import { posix } from 'node:path'; import { URL } from 'whatwg-url'; type SuccessfulResponses = {