From 57578e9398c861863ca331a58b13801af4a973d4 Mon Sep 17 00:00:00 2001 From: Alvis HT Tang Date: Fri, 5 May 2023 19:20:29 +0800 Subject: [PATCH] style: make any node build-in modules explicitly imported first --- source/index.ts | 3 ++- spec/index.spec.ts | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/index.ts b/source/index.ts index 05f8ae6..518f271 100644 --- a/source/index.ts +++ b/source/index.ts @@ -13,7 +13,8 @@ * ------------------------------------------------------------------------- */ -import { resolve } from 'path'; +import { resolve } from 'node:path'; + import { loadFile, template } from 'presetter'; import { getRollupParameter } from './rollup'; diff --git a/spec/index.spec.ts b/spec/index.spec.ts index 8ba838c..eed1a9d 100644 --- a/spec/index.spec.ts +++ b/spec/index.spec.ts @@ -13,16 +13,16 @@ * ------------------------------------------------------------------------- */ -import { readdirSync } from 'fs'; -import { resolve } from 'path'; +import { readdirSync } from 'node:fs'; +import { resolve } from 'node:path'; import { loadDynamicMap, resolveContext } from 'presetter'; import getPresetAsset from '#index'; -jest.mock('path', () => ({ +jest.mock('node:path', () => ({ __esModule: true, - ...jest.requireActual('path'), - resolve: jest.fn(jest.requireActual('path').resolve), + ...jest.requireActual('node:path'), + resolve: jest.fn(jest.requireActual('node:path').resolve), })); describe('fn:getPresetAsset', () => {