Skip to content

Commit 202a087

Browse files
committed
fix(paths): use upath package.json
Resolve unix/window path issue hopefully
1 parent 82a4167 commit 202a087

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"build": "yarn clean && bili src/index.ts,src/loader.ts",
2727
"clean": "rimraf dist",
2828
"test": "jest --coverage",
29-
"dev": "nuxt-ts test/fixture",
3029
"release": "dotenv release-it --",
3130
"lint": "prettier --write --parser typescript \"{src,test}/**/*.{j,t}s\""
3231
},
@@ -59,6 +58,7 @@
5958
"pug": "^3.0.0",
6059
"release-it": "^14.2.2",
6160
"rollup-plugin-typescript2": "^0.29.0",
62-
"typescript": "^4.1.2"
61+
"typescript": "^4.1.2",
62+
"upath": "^2.0.1"
6363
}
6464
}

src/loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getOptions } from 'loader-utils';
33
import { matcher, scanComponents } from './util/scanComponents'
44
import { injectComponents } from './util/injectComponents'
55
import { PluginOptions, Component } from './types'
6-
import { resolve } from 'path'
6+
import { resolve } from 'upath'
77

88
export default async function loader (this : loader.LoaderContext, source: string) {
99

src/util/scanComponents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { basename, extname, join, dirname, resolve } from 'path'
1+
import { basename, extname, join, dirname, resolve } from 'upath'
22
import globby from 'globby'
33
import { camelCase, kebabCase, upperFirst, first, filter } from 'lodash'
44
import type { Component, PluginOptions } from '../types'

src/vue2/parseSfc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { loader } from 'webpack'
22
import { readFileSync } from 'fs'
3-
import { basename, dirname, relative } from 'path'
3+
import { basename, dirname, relative } from 'upath'
44

55
export default function parseSfc (this : loader.LoaderContext, compiler: any) {
66
const filename = basename(this.resourcePath)

src/vue3/parseSfc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { loader } from 'webpack'
22
import { SFCDescriptor } from '@vue/compiler-sfc'
33
import { readFileSync } from 'fs'
4-
import { basename, dirname, relative } from 'path'
4+
import { basename, dirname, relative } from 'upath'
55

66
export default function parseSfc (this : loader.LoaderContext, compiler: any) : SFCDescriptor {
77
const filename = basename(this.resourcePath)

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9199,6 +9199,11 @@ upath@^1.1.1:
91999199
resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894"
92009200
integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==
92019201

9202+
upath@^2.0.1:
9203+
version "2.0.1"
9204+
resolved "https://registry.yarnpkg.com/upath/-/upath-2.0.1.tgz#50c73dea68d6f6b990f51d279ce6081665d61a8b"
9205+
integrity sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w==
9206+
92029207
92039208
version "5.0.1"
92049209
resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-5.0.1.tgz#1f92d45fb1f70b9e33880a72dd262bc12d22c20d"
@@ -9432,8 +9437,10 @@ watchpack@^1.7.4:
94329437
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.7.5.tgz#1267e6c55e0b9b5be44c2023aed5437a2c26c453"
94339438
integrity sha512-9P3MWk6SrKjHsGkLT2KHXdQ/9SNkyoJbabxnKOoJepsvJjJG8uYTR3yTPxPQvNDI3w4Nz1xnE0TLHK4RIVe/MQ==
94349439
dependencies:
9440+
chokidar "^3.4.1"
94359441
graceful-fs "^4.1.2"
94369442
neo-async "^2.5.0"
9443+
watchpack-chokidar2 "^2.0.1"
94379444
optionalDependencies:
94389445
chokidar "^3.4.1"
94399446
watchpack-chokidar2 "^2.0.1"

0 commit comments

Comments
 (0)