Skip to content

Commit

Permalink
fix: windows path (#182)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
HaitaoWang555 and antfu committed May 24, 2022
1 parent b617b04 commit e3d0885
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/core/ctx.ts
@@ -1,4 +1,4 @@
import { dirname, relative, resolve } from 'path'
import { dirname, isAbsolute, relative, resolve } from 'path'
import { promises as fs } from 'fs'
import { slash, throttle, toArray } from '@antfu/utils'
import { createFilter } from '@rollup/pluginutils'
Expand Down Expand Up @@ -63,7 +63,7 @@ export function createContext(options: Options = {}, root = process.cwd()) {
const dir = dirname(file)
return unimport.generateTypeDecarations({
resolvePath: (i) => {
if (i.from.startsWith('.') || i.from.startsWith('/')) {
if (i.from.startsWith('.') || isAbsolute(i.from)) {
const related = slash(relative(dir, i.from).replace(/\.ts$/, ''))
return !related.startsWith('.')
? `./${related}`
Expand Down
5 changes: 1 addition & 4 deletions test/dts.test.ts
@@ -1,10 +1,7 @@
import { join } from 'path'
import { createContext } from '../src/core/ctx'

const isWindows = process.platform === 'win32'

// TODO: fix windows
it.skipIf(isWindows)('dts', () => {
it('dts', () => {
const cwd = process.cwd()
const ctx = createContext({
imports: [
Expand Down

0 comments on commit e3d0885

Please sign in to comment.