From e8c492dc64100840956890cde43fe3c93782961e Mon Sep 17 00:00:00 2001 From: Huang Buyuan <70076074+kumv-net@users.noreply.github.com> Date: Sun, 19 Nov 2023 12:19:32 +0000 Subject: [PATCH 1/5] fix: config.root for win32 --- src/core/ctx.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/ctx.ts b/src/core/ctx.ts index b6218e14..6af6f85a 100644 --- a/src/core/ctx.ts +++ b/src/core/ctx.ts @@ -1,6 +1,7 @@ import { dirname, isAbsolute, join, relative, resolve } from 'node:path' import { existsSync, promises as fs } from 'node:fs' import process from 'node:process' +import os from 'node:os' import { slash, throttle, toArray } from '@antfu/utils' import { createFilter } from '@rollup/pluginutils' import { isPackageExists } from 'local-pkg' @@ -32,8 +33,11 @@ async function scanDirExports(dirs: string[], root: string) { const files = Array.from(new Set(result.flat())).map(slash) return (await Promise.all(files.map(i => scanExports(i, false)))).flat() } +const isWindows = os.platform() === 'win32'; export function createContext(options: Options = {}, root = process.cwd()) { + root=isWindows?slash(root):root; + const { dts: preferDTS = isPackageExists('typescript'), } = options From 105b1b1261cd5080d9a97394bf5464016b23c869 Mon Sep 17 00:00:00 2001 From: Huang Buyuan <70076074+kumv-net@users.noreply.github.com> Date: Sun, 19 Nov 2023 12:41:41 +0000 Subject: [PATCH 2/5] fix: config.root for win32 --- src/core/ctx.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ctx.ts b/src/core/ctx.ts index 6af6f85a..dfa2bae6 100644 --- a/src/core/ctx.ts +++ b/src/core/ctx.ts @@ -33,7 +33,7 @@ async function scanDirExports(dirs: string[], root: string) { const files = Array.from(new Set(result.flat())).map(slash) return (await Promise.all(files.map(i => scanExports(i, false)))).flat() } -const isWindows = os.platform() === 'win32'; + const isWindows = os.platform() === 'win32'; export function createContext(options: Options = {}, root = process.cwd()) { root=isWindows?slash(root):root; From 91da9d31e8b0e071e0c6e5b31db25cc712303c7f Mon Sep 17 00:00:00 2001 From: Huang Buyuan <70076074+kumv-net@users.noreply.github.com> Date: Sun, 19 Nov 2023 12:43:09 +0000 Subject: [PATCH 3/5] fix: config.root for win32 --- src/core/ctx.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ctx.ts b/src/core/ctx.ts index dfa2bae6..3fba9408 100644 --- a/src/core/ctx.ts +++ b/src/core/ctx.ts @@ -36,7 +36,7 @@ async function scanDirExports(dirs: string[], root: string) { const isWindows = os.platform() === 'win32'; export function createContext(options: Options = {}, root = process.cwd()) { - root=isWindows?slash(root):root; + root = isWindows ? slash(root) : root; const { dts: preferDTS = isPackageExists('typescript'), From ccc21872c5dd7da6815df20d25bd618b4ee5adf2 Mon Sep 17 00:00:00 2001 From: Huang Buyuan <70076074+kumv-net@users.noreply.github.com> Date: Sun, 19 Nov 2023 13:41:35 +0000 Subject: [PATCH 4/5] fix eslint error --- src/core/ctx.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ctx.ts b/src/core/ctx.ts index 3fba9408..552da25c 100644 --- a/src/core/ctx.ts +++ b/src/core/ctx.ts @@ -33,10 +33,10 @@ async function scanDirExports(dirs: string[], root: string) { const files = Array.from(new Set(result.flat())).map(slash) return (await Promise.all(files.map(i => scanExports(i, false)))).flat() } - const isWindows = os.platform() === 'win32'; +const isWindows = os.platform() === 'win32' export function createContext(options: Options = {}, root = process.cwd()) { - root = isWindows ? slash(root) : root; + root = isWindows ? slash(root) : root const { dts: preferDTS = isPackageExists('typescript'), From c8cd9fef8c475d1e39fa0dffe8eae6506995a52c Mon Sep 17 00:00:00 2001 From: Huang Buyuan <70076074+kumv-net@users.noreply.github.com> Date: Fri, 24 Nov 2023 06:36:18 +0000 Subject: [PATCH 5/5] Call flash on any OS --- src/core/ctx.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/ctx.ts b/src/core/ctx.ts index 552da25c..4313f931 100644 --- a/src/core/ctx.ts +++ b/src/core/ctx.ts @@ -1,7 +1,6 @@ import { dirname, isAbsolute, join, relative, resolve } from 'node:path' import { existsSync, promises as fs } from 'node:fs' import process from 'node:process' -import os from 'node:os' import { slash, throttle, toArray } from '@antfu/utils' import { createFilter } from '@rollup/pluginutils' import { isPackageExists } from 'local-pkg' @@ -33,10 +32,9 @@ async function scanDirExports(dirs: string[], root: string) { const files = Array.from(new Set(result.flat())).map(slash) return (await Promise.all(files.map(i => scanExports(i, false)))).flat() } -const isWindows = os.platform() === 'win32' export function createContext(options: Options = {}, root = process.cwd()) { - root = isWindows ? slash(root) : root + root = slash(root) const { dts: preferDTS = isPackageExists('typescript'),