From 0a3041cdf9e3a2a76ee93117557d7be6df1b95e3 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 12 Jul 2021 11:54:24 +0100 Subject: [PATCH] fix: allow use of nuxt3 in non-wsl windows environment (#308) --- package.json | 3 ++- packages/app/meta.js | 2 +- packages/app/package.json | 1 + packages/cli/package.json | 1 + packages/cli/src/commands/build.ts | 2 +- packages/cli/src/commands/dev.ts | 2 +- packages/cli/src/utils/cjs.ts | 6 ++++-- packages/kit/src/config/env.ts | 2 +- packages/kit/src/config/load.ts | 2 +- packages/kit/src/config/schema/_app.ts | 2 +- packages/kit/src/config/schema/_common.ts | 2 +- packages/kit/src/config/schema/generate.ts | 2 +- packages/kit/src/module/utils.ts | 2 +- packages/kit/src/utils/cjs.ts | 6 +++--- packages/nitro/src/rollup/config.ts | 6 +++--- packages/nitro/src/rollup/plugins/automock.ts | 3 ++- packages/nitro/src/rollup/plugins/esbuild.ts | 2 +- packages/nitro/src/rollup/plugins/externals.ts | 9 +++++++-- packages/nitro/src/rollup/plugins/virtual.ts | 2 +- packages/nuxt3/src/nitro.ts | 3 ++- packages/nuxt3/src/nuxt.ts | 7 ++++--- packages/nuxt3/src/template.utils.ts | 2 +- packages/vite/src/client.ts | 2 +- packages/vite/src/server.ts | 2 +- packages/webpack/package.json | 1 + packages/webpack/src/configs/client.ts | 2 +- packages/webpack/src/plugins/transform-setup.ts | 3 ++- packages/webpack/src/plugins/vue/client.ts | 2 +- packages/webpack/src/presets/babel.ts | 5 +++-- packages/webpack/src/presets/base.ts | 2 +- packages/webpack/src/presets/style.ts | 2 +- packages/webpack/src/presets/vue.ts | 2 +- packages/webpack/src/utils/babel-preset.js | 4 ++-- packages/webpack/src/utils/mfs.ts | 2 +- packages/webpack/src/utils/postcss.ts | 2 +- packages/webpack/src/webpack.ts | 2 +- scripts/bump-edge.ts | 2 +- test/presets/cloudflare.test.ts | 2 +- test/presets/lambda.test.ts | 2 +- test/presets/node.test.ts | 2 +- test/presets/vercel.test.ts | 2 +- test/utils.ts | 2 +- yarn.lock | 4 ++++ 43 files changed, 69 insertions(+), 49 deletions(-) diff --git a/package.json b/package.json index 00898da635..7ca2fe16ef 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "lerna": "^4.0.0", "object-hash": "^2.2.0", "typescript": "^4.3.5", - "unbuild": "^0.3.1" + "unbuild": "^0.3.1", + "upath": "^2.0.1" } } diff --git a/packages/app/meta.js b/packages/app/meta.js index 527b1c77e5..710d00d09b 100644 --- a/packages/app/meta.js +++ b/packages/app/meta.js @@ -1,4 +1,4 @@ -const { resolve } = require('path') +const { resolve } = require('upath') module.exports = { appDir: resolve(__dirname, 'dist') diff --git a/packages/app/package.json b/packages/app/package.json index 539ad4dfb4..3b23afcb7e 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -23,6 +23,7 @@ "@vueuse/head": "^0.6.0", "hookable": "^4.4.1", "ohmyfetch": "^0.2.0", + "upath": "^2.0.1", "vue": "^3.1.4", "vue-router": "^4.0.10", "vuex5": "^0.5.0-testing.3" diff --git a/packages/cli/package.json b/packages/cli/package.json index 455532d420..b7a5d5c0c8 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -33,6 +33,7 @@ "listhen": "^0.2.4", "mri": "^1.1.6", "unbuild": "^0.3.1", + "upath": "^2.0.1", "v8-compile-cache": "^2.3.0" } } diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts index bf4b69862b..3300d6ecba 100644 --- a/packages/cli/src/commands/build.ts +++ b/packages/cli/src/commands/build.ts @@ -1,5 +1,5 @@ -import { resolve } from 'path' +import { resolve } from 'upath' import { requireModule } from '../utils/cjs' export async function invoke (args) { diff --git a/packages/cli/src/commands/dev.ts b/packages/cli/src/commands/dev.ts index 44b7520eb4..e2fb99789c 100644 --- a/packages/cli/src/commands/dev.ts +++ b/packages/cli/src/commands/dev.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'upath' import chokidar from 'chokidar' import debounce from 'debounce-promise' import { createServer, createLoadingHandler } from '../utils/server' diff --git a/packages/cli/src/utils/cjs.ts b/packages/cli/src/utils/cjs.ts index 8ac42d2b34..04ddb35569 100644 --- a/packages/cli/src/utils/cjs.ts +++ b/packages/cli/src/utils/cjs.ts @@ -1,5 +1,7 @@ +import { normalize } from 'upath' + export function resolveModule (id, paths?) { - return require.resolve(id, { + return normalize(require.resolve(id, { paths: [].concat( // @ts-ignore global.__NUXT_PREPATHS__, @@ -8,7 +10,7 @@ export function resolveModule (id, paths?) { // @ts-ignore global.__NUXT_PATHS__ ).filter(Boolean) - }) + })) } export function requireModule (id, paths?) { diff --git a/packages/kit/src/config/env.ts b/packages/kit/src/config/env.ts index 155bee926e..0230433064 100644 --- a/packages/kit/src/config/env.ts +++ b/packages/kit/src/config/env.ts @@ -1,5 +1,5 @@ -import { resolve } from 'path' import { existsSync, promises as fsp } from 'fs' +import { resolve } from 'upath' import dotenv from 'dotenv' export interface LoadDotEnvOptions { diff --git a/packages/kit/src/config/load.ts b/packages/kit/src/config/load.ts index c605af1e74..fce5024ff6 100644 --- a/packages/kit/src/config/load.ts +++ b/packages/kit/src/config/load.ts @@ -1,5 +1,5 @@ -import { resolve } from 'path' import { existsSync } from 'fs' +import { resolve } from 'upath' import defu from 'defu' import { applyDefaults } from 'untyped' import * as rc from 'rc9' diff --git a/packages/kit/src/config/schema/_app.ts b/packages/kit/src/config/schema/_app.ts index cfaec62297..f5736929cc 100644 --- a/packages/kit/src/config/schema/_app.ts +++ b/packages/kit/src/config/schema/_app.ts @@ -1,4 +1,4 @@ -import { resolve, join } from 'path' +import { resolve, join } from 'upath' import { existsSync, readdirSync } from 'fs' import defu from 'defu' import { isRelative, joinURL, hasProtocol } from 'ufo' diff --git a/packages/kit/src/config/schema/_common.ts b/packages/kit/src/config/schema/_common.ts index 9f5f64b6bb..b392449b9f 100644 --- a/packages/kit/src/config/schema/_common.ts +++ b/packages/kit/src/config/schema/_common.ts @@ -1,4 +1,4 @@ -import { join, resolve } from 'path' +import { join, resolve } from 'upath' import env from 'std-env' import createRequire from 'create-require' import { pascalCase } from 'scule' diff --git a/packages/kit/src/config/schema/generate.ts b/packages/kit/src/config/schema/generate.ts index f7962361ce..6d56a6ce32 100644 --- a/packages/kit/src/config/schema/generate.ts +++ b/packages/kit/src/config/schema/generate.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'upath' import { joinURL } from 'ufo' export default { diff --git a/packages/kit/src/module/utils.ts b/packages/kit/src/module/utils.ts index 35b5c3da41..77baba3337 100644 --- a/packages/kit/src/module/utils.ts +++ b/packages/kit/src/module/utils.ts @@ -1,5 +1,5 @@ -import path, { basename, parse } from 'path' import fs from 'fs' +import path, { basename, parse } from 'upath' import hash from 'hash-sum' import consola from 'consola' import { useNuxt } from '../nuxt' diff --git a/packages/kit/src/utils/cjs.ts b/packages/kit/src/utils/cjs.ts index f2593f22b6..1798f01a1f 100644 --- a/packages/kit/src/utils/cjs.ts +++ b/packages/kit/src/utils/cjs.ts @@ -1,4 +1,4 @@ -import { join } from 'path' +import { join, normalize } from 'upath' import jiti from 'jiti' // TODO: use create-require for jest environment @@ -81,7 +81,7 @@ export function requireModulePkg (id: string, opts: RequireModuleOptions = {}) { /** Resolve the path of a module. */ export function resolveModule (id: string, opts: ResolveModuleOptions = {}) { - return _require.resolve(id, { + return normalize(_require.resolve(id, { paths: [].concat( // @ts-ignore global.__NUXT_PREPATHS__, @@ -90,7 +90,7 @@ export function resolveModule (id: string, opts: ResolveModuleOptions = {}) { // @ts-ignore global.__NUXT_PATHS__ ).filter(Boolean) - }) + })) } /** Try to resolve the path of a module, but don't emit an error if it can't be found. */ diff --git a/packages/nitro/src/rollup/config.ts b/packages/nitro/src/rollup/config.ts index 0fffe7a937..9163d9cae5 100644 --- a/packages/nitro/src/rollup/config.ts +++ b/packages/nitro/src/rollup/config.ts @@ -1,4 +1,4 @@ -import { dirname, join, relative, resolve } from 'upath' +import { dirname, join, normalize, relative, resolve } from 'upath' import { InputOptions, OutputOptions } from 'rollup' import defu from 'defu' import { terser } from 'rollup-plugin-terser' @@ -198,8 +198,8 @@ export const getRollupConfig = (nitroContext: NitroContext) => { rollupConfig.plugins.push(alias({ entries: { '#nitro': nitroContext._internal.runtimeDir, - '#nitro-renderer': require.resolve(resolve(nitroContext._internal.runtimeDir, 'app', renderer)), - '#config': require.resolve(resolve(nitroContext._internal.runtimeDir, 'app/config')), + '#nitro-renderer': normalize(require.resolve(resolve(nitroContext._internal.runtimeDir, 'app', renderer))), + '#config': normalize(require.resolve(resolve(nitroContext._internal.runtimeDir, 'app/config'))), '#nitro-vue-renderer': vue2ServerRenderer, '#build': nitroContext._nuxt.buildDir, '~': nitroContext._nuxt.srcDir, diff --git a/packages/nitro/src/rollup/plugins/automock.ts b/packages/nitro/src/rollup/plugins/automock.ts index 549dea1be0..b3d209ae81 100644 --- a/packages/nitro/src/rollup/plugins/automock.ts +++ b/packages/nitro/src/rollup/plugins/automock.ts @@ -1,4 +1,5 @@ import consola from 'consola' +import { normalize } from 'upath' const internalRegex = /^\.|\?|\.[mc]?js$|.ts$|.json$/ @@ -9,7 +10,7 @@ export function autoMock () { if (src && !internalRegex.test(src)) { consola.warn('Auto mock external ', src) return { - id: require.resolve('unenv/runtime/mock/proxy') + id: normalize(require.resolve('unenv/runtime/mock/proxy')) } } return null diff --git a/packages/nitro/src/rollup/plugins/esbuild.ts b/packages/nitro/src/rollup/plugins/esbuild.ts index 01add9174c..7217e3e82d 100644 --- a/packages/nitro/src/rollup/plugins/esbuild.ts +++ b/packages/nitro/src/rollup/plugins/esbuild.ts @@ -1,6 +1,6 @@ // Based on https://github.com/egoist/rollup-plugin-esbuild (MIT) -import { extname, relative } from 'path' +import { extname, relative } from 'upath' import { Plugin, PluginContext } from 'rollup' import { Loader, TransformResult, transform } from 'esbuild' import { createFilter, FilterPattern } from '@rollup/pluginutils' diff --git a/packages/nitro/src/rollup/plugins/externals.ts b/packages/nitro/src/rollup/plugins/externals.ts index fbc64f9994..300888bc37 100644 --- a/packages/nitro/src/rollup/plugins/externals.ts +++ b/packages/nitro/src/rollup/plugins/externals.ts @@ -1,4 +1,4 @@ -import { resolve, dirname } from 'upath' +import { resolve, dirname, normalize } from 'upath' import { copyFile, mkdirp } from 'fs-extra' import { nodeFileTrace, NodeFileTraceOptions } from '@vercel/nft' import type { Plugin } from 'rollup' @@ -23,6 +23,11 @@ export function externals (opts: NodeExternalsOptions): Plugin { return null } + // Normalize path on windows + if (process.platform === 'win32') { + id = id.replace(/\\/g, '/') + } + // Normalize from node_modules const _id = id.split('node_modules/').pop() @@ -42,7 +47,7 @@ export function externals (opts: NodeExternalsOptions): Plugin { // Try to resolve for nft if (opts.trace !== false) { let _resolvedId = _id - try { _resolvedId = require.resolve(_resolvedId, { paths: opts.moduleDirectories }) } catch (_err) {} + try { _resolvedId = normalize(require.resolve(_resolvedId, { paths: opts.moduleDirectories })) } catch (_err) { } resolvedExternals.add(_resolvedId) } diff --git a/packages/nitro/src/rollup/plugins/virtual.ts b/packages/nitro/src/rollup/plugins/virtual.ts index ee47ed6d58..7d3ed6d118 100644 --- a/packages/nitro/src/rollup/plugins/virtual.ts +++ b/packages/nitro/src/rollup/plugins/virtual.ts @@ -1,5 +1,5 @@ // Based on https://github.com/rollup/plugins/blob/master/packages/virtual/src/index.ts -import * as path from 'path' +import * as path from 'upath' import { Plugin } from 'rollup' diff --git a/packages/nuxt3/src/nitro.ts b/packages/nuxt3/src/nitro.ts index a93c9ba0c8..0ae528247f 100644 --- a/packages/nuxt3/src/nitro.ts +++ b/packages/nuxt3/src/nitro.ts @@ -1,3 +1,4 @@ +import { normalize } from 'upath' import { wpfs, getNitroContext, createDevServer, resolveMiddleware, build, prepare, generate } from '@nuxt/nitro' import type { Nuxt } from '@nuxt/kit' @@ -22,7 +23,7 @@ export function initNitro (nuxt: Nuxt) { // Add nitro client plugin (to inject $fetch helper) nuxt.hook('app:resolve', (app) => { - app.plugins.push({ src: require.resolve('@nuxt/nitro/dist/runtime/app/nitro.client.mjs') }) + app.plugins.push({ src: normalize(require.resolve('@nuxt/nitro/dist/runtime/app/nitro.client.mjs')) }) }) // Expose process.env.NITRO_PRESET diff --git a/packages/nuxt3/src/nuxt.ts b/packages/nuxt3/src/nuxt.ts index ccba627844..9d639cba68 100644 --- a/packages/nuxt3/src/nuxt.ts +++ b/packages/nuxt3/src/nuxt.ts @@ -1,3 +1,4 @@ +import { normalize } from 'upath' import Hookable from 'hookable' import { loadNuxtConfig, LoadNuxtOptions, Nuxt, NuxtOptions, nuxtCtx, installModule, ModuleContainer } from '@nuxt/kit' import { initNitro } from './nitro' @@ -52,9 +53,9 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise { const { appDir } = await import('@nuxt/app/meta') options.appDir = appDir options._majorVersion = 3 - options.alias.vue = require.resolve('vue/dist/vue.esm-bundler.js') - options.buildModules.push(require.resolve('@nuxt/pages/module')) - options.buildModules.push(require.resolve('@nuxt/component-discovery/module')) + options.alias.vue = normalize(require.resolve('vue/dist/vue.esm-bundler.js')) + options.buildModules.push(normalize(require.resolve('@nuxt/pages/module'))) + options.buildModules.push(normalize(require.resolve('@nuxt/component-discovery/module'))) const nuxt = createNuxt(options) diff --git a/packages/nuxt3/src/template.utils.ts b/packages/nuxt3/src/template.utils.ts index c2605376b5..516f33fe24 100644 --- a/packages/nuxt3/src/template.utils.ts +++ b/packages/nuxt3/src/template.utils.ts @@ -1,4 +1,4 @@ -import { basename, extname } from 'path' +import { basename, extname } from 'upath' import hash from 'hash-sum' import { camelCase } from 'scule' diff --git a/packages/vite/src/client.ts b/packages/vite/src/client.ts index d723e0c29f..260c27e0d9 100644 --- a/packages/vite/src/client.ts +++ b/packages/vite/src/client.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'upath' import * as vite from 'vite' import vitePlugin from '@vitejs/plugin-vue' import { cacheDirPlugin } from './plugins/cache-dir' diff --git a/packages/vite/src/server.ts b/packages/vite/src/server.ts index a86c2dcb4c..3d724907db 100644 --- a/packages/vite/src/server.ts +++ b/packages/vite/src/server.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'upath' import * as vite from 'vite' import vuePlugin from '@vitejs/plugin-vue' import { mkdirp, writeFile } from 'fs-extra' diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 28faa08328..bacceeab1c 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -35,6 +35,7 @@ "style-resources-loader": "^1.4.1", "time-fix-plugin": "^2.0.7", "ufo": "^0.7.7", + "upath": "^2.0.1", "url-loader": "^4.1.1", "vue": "3.1.4", "vue-loader": "^16.3.0", diff --git a/packages/webpack/src/configs/client.ts b/packages/webpack/src/configs/client.ts index 57842134d9..fb65be6cd3 100644 --- a/packages/webpack/src/configs/client.ts +++ b/packages/webpack/src/configs/client.ts @@ -1,5 +1,5 @@ -import path from 'path' import querystring from 'querystring' +import path from 'upath' import webpack from 'webpack' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' diff --git a/packages/webpack/src/plugins/transform-setup.ts b/packages/webpack/src/plugins/transform-setup.ts index 49baf0fff0..93e8fbba1a 100644 --- a/packages/webpack/src/plugins/transform-setup.ts +++ b/packages/webpack/src/plugins/transform-setup.ts @@ -1,3 +1,4 @@ +import { normalize } from 'upath' import { getQuery } from 'ufo' export default class NuxtSetupTransformerPlugin { @@ -10,7 +11,7 @@ export default class NuxtSetupTransformerPlugin { enforce: 'post', use: [{ ident: 'NuxtSetupTransformerPlugin', - loader: require.resolve('@nuxt/webpack-builder/dist/nuxt-setup-loader') + loader: normalize(require.resolve('@nuxt/webpack-builder/dist/nuxt-setup-loader')) }] }) } diff --git a/packages/webpack/src/plugins/vue/client.ts b/packages/webpack/src/plugins/vue/client.ts index 0e8742897c..9a43f87687 100644 --- a/packages/webpack/src/plugins/vue/client.ts +++ b/packages/webpack/src/plugins/vue/client.ts @@ -3,7 +3,7 @@ * https://github.com/vuejs/vue/blob/dev/src/server/webpack-plugin/client.js */ -import { dirname } from 'path' +import { dirname } from 'upath' import hash from 'hash-sum' import { uniq } from 'lodash' import { writeFile, mkdirp } from 'fs-extra' diff --git a/packages/webpack/src/presets/babel.ts b/packages/webpack/src/presets/babel.ts index 6e537b7770..268c03d74a 100644 --- a/packages/webpack/src/presets/babel.ts +++ b/packages/webpack/src/presets/babel.ts @@ -1,3 +1,4 @@ +import { normalize } from 'upath' import TerserWebpackPlugin from 'terser-webpack-plugin' import { reservedVueTags } from '../utils/reserved-tags' import { WebpackConfigContext } from '../utils/config' @@ -6,7 +7,7 @@ export function babel (ctx: WebpackConfigContext) { const { config, options } = ctx const babelLoader = { - loader: require.resolve('babel-loader'), + loader: normalize(require.resolve('babel-loader')), options: getBabelOptions(ctx) } @@ -66,7 +67,7 @@ function getBabelOptions (ctx: WebpackConfigContext) { babelOptions.plugins = babelOptions.plugins(ctx) } - const defaultPreset = [require.resolve('../../babel-preset-app'), {}] + const defaultPreset = [normalize(require.resolve('../../babel-preset-app')), {}] if (typeof babelOptions.presets === 'function') { babelOptions.presets = babelOptions.presets(ctx, defaultPreset) diff --git a/packages/webpack/src/presets/base.ts b/packages/webpack/src/presets/base.ts index a0baf4d227..69c36b2bf7 100644 --- a/packages/webpack/src/presets/base.ts +++ b/packages/webpack/src/presets/base.ts @@ -1,4 +1,4 @@ -import { resolve, normalize } from 'path' +import { resolve, normalize } from 'upath' import TimeFixPlugin from 'time-fix-plugin' import WebpackBar from 'webpackbar' import consola from 'consola' diff --git a/packages/webpack/src/presets/style.ts b/packages/webpack/src/presets/style.ts index 5417cd52e0..0f0755581f 100644 --- a/packages/webpack/src/presets/style.ts +++ b/packages/webpack/src/presets/style.ts @@ -1,4 +1,4 @@ -import path from 'path' +import path from 'upath' import MiniCssExtractPlugin from 'mini-css-extract-plugin' import CssMinimizerPlugin from 'css-minimizer-webpack-plugin' import { fileName, WebpackConfigContext, applyPresets } from '../utils/config' diff --git a/packages/webpack/src/presets/vue.ts b/packages/webpack/src/presets/vue.ts index ae8560a21d..26e42775a0 100644 --- a/packages/webpack/src/presets/vue.ts +++ b/packages/webpack/src/presets/vue.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'upath' import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5' import { DefinePlugin } from 'webpack' import NuxtSetupTransformerPlugin from '../plugins/transform-setup' diff --git a/packages/webpack/src/utils/babel-preset.js b/packages/webpack/src/utils/babel-preset.js index c6094d6b52..ef674af976 100644 --- a/packages/webpack/src/utils/babel-preset.js +++ b/packages/webpack/src/utils/babel-preset.js @@ -49,8 +49,8 @@ function getPolyfills (targets, includes, { ignoreBrowserslistConfig, configPath } function isPackageHoisted (packageName) { - const path = require('path') - const installedPath = require.resolve(packageName) + const path = require('upath') + const installedPath = path.normalize(require.resolve(packageName)) const relativePath = path.resolve(__dirname, '..', 'node_modules', packageName) return installedPath !== relativePath } diff --git a/packages/webpack/src/utils/mfs.ts b/packages/webpack/src/utils/mfs.ts index 2f55362e6d..7815391e50 100644 --- a/packages/webpack/src/utils/mfs.ts +++ b/packages/webpack/src/utils/mfs.ts @@ -1,4 +1,4 @@ -import path from 'path' +import path from 'upath' import pify from 'pify' import { Volume, createFsFromVolume } from 'memfs' diff --git a/packages/webpack/src/utils/postcss.ts b/packages/webpack/src/utils/postcss.ts index bea3d9190c..34c5e17348 100644 --- a/packages/webpack/src/utils/postcss.ts +++ b/packages/webpack/src/utils/postcss.ts @@ -1,6 +1,6 @@ // @ts-nocheck import fs from 'fs' -import path from 'path' +import path from 'upath' import consola from 'consola' import { defaults, merge, cloneDeep } from 'lodash' import createResolver from 'postcss-import-resolver' diff --git a/packages/webpack/src/webpack.ts b/packages/webpack/src/webpack.ts index bc9062e014..0d3ab75011 100644 --- a/packages/webpack/src/webpack.ts +++ b/packages/webpack/src/webpack.ts @@ -1,5 +1,5 @@ -import path from 'path' import type { IncomingMessage, ServerResponse } from 'http' +import path from 'upath' import pify from 'pify' import webpack from 'webpack' import Glob from 'glob' diff --git a/scripts/bump-edge.ts b/scripts/bump-edge.ts index 3344452b0d..1380be323f 100644 --- a/scripts/bump-edge.ts +++ b/scripts/bump-edge.ts @@ -1,6 +1,6 @@ import { promises as fsp } from 'fs' -import { resolve } from 'path' import { execSync } from 'child_process' +import { resolve } from 'upath' import globby from 'globby' async function loadPackage (dir: string) { diff --git a/test/presets/cloudflare.test.ts b/test/presets/cloudflare.test.ts index ad3fdabf1a..b738ff3a51 100644 --- a/test/presets/cloudflare.test.ts +++ b/test/presets/cloudflare.test.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'upath' import { readFile } from 'fs-extra' import { JSDOM } from 'jsdom' diff --git a/test/presets/lambda.test.ts b/test/presets/lambda.test.ts index 81a7c53d16..9bb8afb691 100644 --- a/test/presets/lambda.test.ts +++ b/test/presets/lambda.test.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'upath' import { testNitroBuild, setupTest, testNitroBehavior } from './_utils' describe('nitro:preset:lambda', () => { diff --git a/test/presets/node.test.ts b/test/presets/node.test.ts index 5bb9c99486..87999c7116 100644 --- a/test/presets/node.test.ts +++ b/test/presets/node.test.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'upath' import { testNitroBuild, startServer, setupTest, testNitroBehavior } from './_utils' describe('nitro:preset:node', () => { diff --git a/test/presets/vercel.test.ts b/test/presets/vercel.test.ts index 719f8332ee..c03ab2ed6f 100644 --- a/test/presets/vercel.test.ts +++ b/test/presets/vercel.test.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'upath' import { testNitroBuild, setupTest, startServer, testNitroBehavior } from './_utils' describe('nitro:preset:vercel', () => { diff --git a/test/utils.ts b/test/utils.ts index ca63056563..8c9e45f74a 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -1,6 +1,6 @@ -import { resolve, dirname } from 'path' import { existsSync, readFileSync, writeFileSync, rmSync, mkdirSync } from 'fs' import { execSync } from 'child_process' +import { resolve, dirname } from 'upath' import defu from 'defu' import hash from 'object-hash' import type { LoadNuxtOptions, NuxtConfig } from '@nuxt/kit' diff --git a/yarn.lock b/yarn.lock index a894ecaa01..b103fd8353 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1660,6 +1660,7 @@ __metadata: hookable: ^4.4.1 ohmyfetch: ^0.2.0 unbuild: ^0.3.1 + upath: ^2.0.1 vue: ^3.1.4 vue-router: ^4.0.10 vuex5: ^0.5.0-testing.3 @@ -1865,6 +1866,7 @@ __metadata: time-fix-plugin: ^2.0.7 ufo: ^0.7.7 unbuild: ^0.3.1 + upath: ^2.0.1 url-loader: ^4.1.1 vue: 3.1.4 vue-loader: ^16.3.0 @@ -9981,6 +9983,7 @@ __metadata: listhen: ^0.2.4 mri: ^1.1.6 unbuild: ^0.3.1 + upath: ^2.0.1 v8-compile-cache: ^2.3.0 dependenciesMeta: fsevents: @@ -10011,6 +10014,7 @@ __metadata: object-hash: ^2.2.0 typescript: ^4.3.5 unbuild: ^0.3.1 + upath: ^2.0.1 languageName: unknown linkType: soft