Skip to content

Commit 32dc514

Browse files
Shinigami92bluwy
andauthored
chore: use node prefix (#8309)
Co-authored-by: bluwy <[email protected]>
1 parent d956094 commit 32dc514

21 files changed

+34
-34
lines changed

Diff for: packages/plugin-vue-jsx/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { createHash } from 'crypto'
2-
import path from 'path'
1+
import { createHash } from 'node:crypto'
2+
import path from 'node:path'
33
import type { types } from '@babel/core'
44
import * as babel from '@babel/core'
55
import jsx from '@vue/babel-plugin-jsx'

Diff for: packages/plugin-vue/src/compiler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ declare module 'vue/compiler-sfc' {
55
}
66
}
77

8-
import { createRequire } from 'module'
8+
import { createRequire } from 'node:module'
99
import type * as _compiler from 'vue/compiler-sfc'
1010

1111
export function resolveCompiler(root: string): typeof _compiler {

Diff for: packages/plugin-vue/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import fs from 'fs'
1+
import fs from 'node:fs'
22
import type { Plugin, ViteDevServer } from 'vite'
33
import { createFilter } from 'vite'
44
/* eslint-disable import/no-duplicates */

Diff for: packages/plugin-vue/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from 'path'
1+
import path from 'node:path'
22
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
33
import type { PluginContext, TransformPluginContext } from 'rollup'
44
import type { RawSourceMap } from 'source-map'

Diff for: packages/plugin-vue/src/template.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from 'path'
1+
import path from 'node:path'
22
import slash from 'slash'
33
import type {
44
CompilerOptions,

Diff for: packages/plugin-vue/src/utils/descriptorCache.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import fs from 'fs'
2-
import path from 'path'
3-
import { createHash } from 'crypto'
1+
import fs from 'node:fs'
2+
import path from 'node:path'
3+
import { createHash } from 'node:crypto'
44
import slash from 'slash'
55
import type { CompilerError, SFCDescriptor } from 'vue/compiler-sfc'
66
import type { ResolvedOptions, VueQuery } from '..'

Diff for: playground/ssr-vue/__tests__/serve.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// this is automatically detected by playground/vitestSetup.ts and will replace
22
// the default e2e test serve behavior
33

4-
import path from 'path'
4+
import path from 'node:path'
55
import kill from 'kill-port'
66
import { hmrPorts, isBuild, ports, rootDir } from '~utils'
77

Diff for: playground/ssr-vue/__tests__/ssr-vue.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { resolve } from 'path'
1+
import { resolve } from 'node:path'
22
import fetch from 'node-fetch'
33
import { port } from './serve'
44
import {

Diff for: playground/ssr-vue/prerender.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Pre-render the app into static HTML.
22
// run `npm run generate` and then `dist/static` can be served as a static site.
33

4-
import fs from 'fs'
5-
import path from 'path'
4+
import fs from 'node:fs'
5+
import path from 'node:path'
66

77
const toAbsolute = (p) => path.resolve(__dirname, p)
88

Diff for: playground/ssr-vue/server.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
2-
import fs from 'fs'
3-
import path from 'path'
2+
import fs from 'node:fs'
3+
import path from 'node:path'
44
import { fileURLToPath } from 'url'
55
import express from 'express'
66

Diff for: playground/ssr-vue/src/entry-server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { basename } from 'path'
1+
import { basename } from 'node:path'
22
import { renderToString } from 'vue/server-renderer'
33
import { createApp } from './main'
44

Diff for: playground/test-utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// TODO: explicitly import APIs and remove this
66
/// <reference types="vitest/globals"/>
77

8-
import fs from 'fs'
9-
import path from 'path'
8+
import fs from 'node:fs'
9+
import path from 'node:path'
1010
import colors from 'css-color-names'
1111
import type { ElementHandle } from 'playwright-chromium'
1212
import type { Manifest } from 'vite'

Diff for: playground/vitestGlobalSetup.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import os from 'os'
2-
import path from 'path'
1+
import os from 'node:os'
2+
import path from 'node:path'
33
import fs from 'fs-extra'
44
import type { BrowserServer } from 'playwright-chromium'
55
import { chromium } from 'playwright-chromium'

Diff for: playground/vitestSetup.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as http from 'http'
2-
import path, { dirname, resolve } from 'path'
3-
import os from 'os'
1+
import * as http from 'node:http'
2+
import path, { dirname, join, resolve } from 'node:path'
3+
import os from 'node:os'
44
import sirv from 'sirv'
55
import fs from 'fs-extra'
66
import { chromium } from 'playwright-chromium'
@@ -19,7 +19,7 @@ import { beforeAll } from 'vitest'
1919

2020
// #region env
2121

22-
export const workspaceRoot = path.resolve(__dirname, '../')
22+
export const workspaceRoot = resolve(__dirname, '../')
2323

2424
export const isBuild = !!process.env.VITE_TEST_BUILD
2525
export const isServe = !isBuild
@@ -84,7 +84,7 @@ export function setViteUrl(url: string): void {
8484

8585
// #endregion
8686

87-
const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup')
87+
const DIR = join(os.tmpdir(), 'vitest_playwright_global_setup')
8888

8989
beforeAll(async (s) => {
9090
const suite = s as File
@@ -93,7 +93,7 @@ beforeAll(async (s) => {
9393
return
9494
}
9595

96-
const wsEndpoint = fs.readFileSync(path.join(DIR, 'wsEndpoint'), 'utf-8')
96+
const wsEndpoint = fs.readFileSync(join(DIR, 'wsEndpoint'), 'utf-8')
9797
if (!wsEndpoint) {
9898
throw new Error('wsEndpoint not found')
9999
}

Diff for: playground/vue-lib/__tests__/vue-lib.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from 'path'
1+
import path from 'node:path'
22
import { build } from 'vite'
33
import type { OutputChunk, RollupOutput } from 'rollup'
44

Diff for: playground/vue-lib/vite.config.lib.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from 'path'
1+
import path from 'node:path'
22
import { defineConfig } from 'vite'
33
import vue from '@vitejs/plugin-vue'
44

Diff for: playground/vue-sourcemap/__tests__/serve.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { URL } from 'url'
1+
import { URL } from 'node:url'
22
import {
33
extractSourcemap,
44
formatSourcemapForSnapshot,

Diff for: scripts/patchCJS.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports.parseVueRequest = parseVueRequest;
1616
```
1717
*/
1818

19-
import { readFileSync, writeFileSync } from 'fs'
19+
import { readFileSync, writeFileSync } from 'node:fs'
2020
import colors from 'picocolors'
2121

2222
const indexPath = 'dist/index.cjs'

Diff for: scripts/releaseUtils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* modified from https://github.com/vuejs/core/blob/master/scripts/release.js
33
*/
4-
import { existsSync, readdirSync, writeFileSync } from 'fs'
5-
import path from 'path'
4+
import { existsSync, readdirSync, writeFileSync } from 'node:fs'
5+
import path from 'node:path'
66
import colors from 'picocolors'
77
import type { Options as ExecaOptions, ExecaReturnValue } from 'execa'
88
import { execa } from 'execa'

Diff for: scripts/verifyCommit.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Invoked on the commit-msg git hook by simple-git-hooks.
22

3-
import { readFileSync } from 'fs'
3+
import { readFileSync } from 'node:fs'
44
import colors from 'picocolors'
55

66
// get $1 from commit-msg script

Diff for: vitest.config.e2e.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { resolve } from 'path'
1+
import { resolve } from 'node:path'
22
import { defineConfig } from 'vitest/config'
33

44
const timeout = process.env.CI ? 50000 : 30000

0 commit comments

Comments
 (0)