Skip to content

Commit

Permalink
chore: use node prefix (#8309)
Browse files Browse the repository at this point in the history
Co-authored-by: bluwy <bjornlu.dev@gmail.com>
  • Loading branch information
Shinigami92 and bluwy committed Jun 19, 2022
1 parent d956094 commit 32dc514
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-vue-jsx/src/index.ts
@@ -1,5 +1,5 @@
import { createHash } from 'crypto'
import path from 'path'
import { createHash } from 'node:crypto'
import path from 'node:path'
import type { types } from '@babel/core'
import * as babel from '@babel/core'
import jsx from '@vue/babel-plugin-jsx'
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue/src/compiler.ts
Expand Up @@ -5,7 +5,7 @@ declare module 'vue/compiler-sfc' {
}
}

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

export function resolveCompiler(root: string): typeof _compiler {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue/src/index.ts
@@ -1,4 +1,4 @@
import fs from 'fs'
import fs from 'node:fs'
import type { Plugin, ViteDevServer } from 'vite'
import { createFilter } from 'vite'
/* eslint-disable import/no-duplicates */
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue/src/main.ts
@@ -1,4 +1,4 @@
import path from 'path'
import path from 'node:path'
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
import type { PluginContext, TransformPluginContext } from 'rollup'
import type { RawSourceMap } from 'source-map'
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue/src/template.ts
@@ -1,4 +1,4 @@
import path from 'path'
import path from 'node:path'
import slash from 'slash'
import type {
CompilerOptions,
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-vue/src/utils/descriptorCache.ts
@@ -1,6 +1,6 @@
import fs from 'fs'
import path from 'path'
import { createHash } from 'crypto'
import fs from 'node:fs'
import path from 'node:path'
import { createHash } from 'node:crypto'
import slash from 'slash'
import type { CompilerError, SFCDescriptor } from 'vue/compiler-sfc'
import type { ResolvedOptions, VueQuery } from '..'
Expand Down
2 changes: 1 addition & 1 deletion playground/ssr-vue/__tests__/serve.ts
@@ -1,7 +1,7 @@
// this is automatically detected by playground/vitestSetup.ts and will replace
// the default e2e test serve behavior

import path from 'path'
import path from 'node:path'
import kill from 'kill-port'
import { hmrPorts, isBuild, ports, rootDir } from '~utils'

Expand Down
2 changes: 1 addition & 1 deletion playground/ssr-vue/__tests__/ssr-vue.spec.ts
@@ -1,4 +1,4 @@
import { resolve } from 'path'
import { resolve } from 'node:path'
import fetch from 'node-fetch'
import { port } from './serve'
import {
Expand Down
4 changes: 2 additions & 2 deletions playground/ssr-vue/prerender.js
@@ -1,8 +1,8 @@
// Pre-render the app into static HTML.
// run `npm run generate` and then `dist/static` can be served as a static site.

import fs from 'fs'
import path from 'path'
import fs from 'node:fs'
import path from 'node:path'

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

Expand Down
4 changes: 2 additions & 2 deletions playground/ssr-vue/server.js
@@ -1,6 +1,6 @@
// @ts-check
import fs from 'fs'
import path from 'path'
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'url'
import express from 'express'

Expand Down
2 changes: 1 addition & 1 deletion playground/ssr-vue/src/entry-server.js
@@ -1,4 +1,4 @@
import { basename } from 'path'
import { basename } from 'node:path'
import { renderToString } from 'vue/server-renderer'
import { createApp } from './main'

Expand Down
4 changes: 2 additions & 2 deletions playground/test-utils.ts
Expand Up @@ -5,8 +5,8 @@
// TODO: explicitly import APIs and remove this
/// <reference types="vitest/globals"/>

import fs from 'fs'
import path from 'path'
import fs from 'node:fs'
import path from 'node:path'
import colors from 'css-color-names'
import type { ElementHandle } from 'playwright-chromium'
import type { Manifest } from 'vite'
Expand Down
4 changes: 2 additions & 2 deletions playground/vitestGlobalSetup.ts
@@ -1,5 +1,5 @@
import os from 'os'
import path from 'path'
import os from 'node:os'
import path from 'node:path'
import fs from 'fs-extra'
import type { BrowserServer } from 'playwright-chromium'
import { chromium } from 'playwright-chromium'
Expand Down
12 changes: 6 additions & 6 deletions playground/vitestSetup.ts
@@ -1,6 +1,6 @@
import * as http from 'http'
import path, { dirname, resolve } from 'path'
import os from 'os'
import * as http from 'node:http'
import path, { dirname, join, resolve } from 'node:path'
import os from 'node:os'
import sirv from 'sirv'
import fs from 'fs-extra'
import { chromium } from 'playwright-chromium'
Expand All @@ -19,7 +19,7 @@ import { beforeAll } from 'vitest'

// #region env

export const workspaceRoot = path.resolve(__dirname, '../')
export const workspaceRoot = resolve(__dirname, '../')

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

// #endregion

const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup')
const DIR = join(os.tmpdir(), 'vitest_playwright_global_setup')

beforeAll(async (s) => {
const suite = s as File
Expand All @@ -93,7 +93,7 @@ beforeAll(async (s) => {
return
}

const wsEndpoint = fs.readFileSync(path.join(DIR, 'wsEndpoint'), 'utf-8')
const wsEndpoint = fs.readFileSync(join(DIR, 'wsEndpoint'), 'utf-8')
if (!wsEndpoint) {
throw new Error('wsEndpoint not found')
}
Expand Down
2 changes: 1 addition & 1 deletion playground/vue-lib/__tests__/vue-lib.spec.ts
@@ -1,4 +1,4 @@
import path from 'path'
import path from 'node:path'
import { build } from 'vite'
import type { OutputChunk, RollupOutput } from 'rollup'

Expand Down
2 changes: 1 addition & 1 deletion playground/vue-lib/vite.config.lib.ts
@@ -1,4 +1,4 @@
import path from 'path'
import path from 'node:path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

Expand Down
2 changes: 1 addition & 1 deletion playground/vue-sourcemap/__tests__/serve.spec.ts
@@ -1,4 +1,4 @@
import { URL } from 'url'
import { URL } from 'node:url'
import {
extractSourcemap,
formatSourcemapForSnapshot,
Expand Down
2 changes: 1 addition & 1 deletion scripts/patchCJS.ts
Expand Up @@ -16,7 +16,7 @@ module.exports.parseVueRequest = parseVueRequest;
```
*/

import { readFileSync, writeFileSync } from 'fs'
import { readFileSync, writeFileSync } from 'node:fs'
import colors from 'picocolors'

const indexPath = 'dist/index.cjs'
Expand Down
4 changes: 2 additions & 2 deletions scripts/releaseUtils.ts
@@ -1,8 +1,8 @@
/**
* modified from https://github.com/vuejs/core/blob/master/scripts/release.js
*/
import { existsSync, readdirSync, writeFileSync } from 'fs'
import path from 'path'
import { existsSync, readdirSync, writeFileSync } from 'node:fs'
import path from 'node:path'
import colors from 'picocolors'
import type { Options as ExecaOptions, ExecaReturnValue } from 'execa'
import { execa } from 'execa'
Expand Down
2 changes: 1 addition & 1 deletion scripts/verifyCommit.ts
@@ -1,6 +1,6 @@
// Invoked on the commit-msg git hook by simple-git-hooks.

import { readFileSync } from 'fs'
import { readFileSync } from 'node:fs'
import colors from 'picocolors'

// get $1 from commit-msg script
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.e2e.ts
@@ -1,4 +1,4 @@
import { resolve } from 'path'
import { resolve } from 'node:path'
import { defineConfig } from 'vitest/config'

const timeout = process.env.CI ? 50000 : 30000
Expand Down

0 comments on commit 32dc514

Please sign in to comment.