Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use pathe #1632

Merged
merged 6 commits into from Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion alias.ts
@@ -1,4 +1,4 @@
import { resolve } from 'path'
import { resolve } from 'pathe'

const r = (p: string) => resolve(__dirname, p)

Expand Down
2 changes: 1 addition & 1 deletion bench/build.mjs
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
import { performance } from 'perf_hooks'
import { join } from 'path'
import { join } from 'pathe'
import fs from 'fs-extra'
import { build } from 'vite'
import { dir, targets } from './meta.mjs'
Expand Down
2 changes: 1 addition & 1 deletion bench/gen.mjs
@@ -1,5 +1,5 @@
import { existsSync, promises as fs } from 'fs'
import { join } from 'path'
import { join } from 'pathe'
import { dir } from './meta.mjs'

const sizes = [
Expand Down
2 changes: 1 addition & 1 deletion bench/meta.mjs
@@ -1,5 +1,5 @@
import { fileURLToPath } from 'url'
import { dirname, resolve } from 'path'
import { dirname, resolve } from 'pathe'
import { getPackageInfo } from 'local-pkg'
import fs from 'fs-extra'

Expand Down
2 changes: 1 addition & 1 deletion bench/run.mjs
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
import { execSync } from 'child_process'
import { join } from 'path'
import { join } from 'pathe'
import fs from 'fs-extra'
import { escapeSelector } from '@unocss/core'
import { dir, getVersions, targets } from './meta.mjs'
Expand Down
2 changes: 1 addition & 1 deletion interactive/scripts/prepare.ts
@@ -1,4 +1,4 @@
import { basename, dirname, parse } from 'path'
import { basename, dirname, parse } from 'pathe'
import fs from 'fs-extra'
import fg from 'fast-glob'
import YAML from 'js-yaml'
Expand Down
1 change: 1 addition & 0 deletions packages/config/package.json
Expand Up @@ -38,6 +38,7 @@
},
"dependencies": {
"@unocss/core": "workspace:*",
"pathe": "^0.3.7",
"unconfig": "^0.3.6"
}
}
2 changes: 1 addition & 1 deletion packages/config/src/index.ts
@@ -1,5 +1,5 @@
import { dirname, resolve } from 'path'
import fs from 'fs'
import { dirname, resolve } from 'pathe'
import type { UserConfig } from '@unocss/core'
import type { LoadConfigResult, LoadConfigSource } from 'unconfig'
import { createConfigLoader as createLoader } from 'unconfig'
Expand Down
2 changes: 1 addition & 1 deletion packages/inspector/node/index.ts
@@ -1,5 +1,5 @@
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'
import { dirname, resolve } from 'pathe'
import sirv from 'sirv'
import type { Plugin, ViteDevServer } from 'vite'
import type { UnocssPluginContext } from '@unocss/core'
Expand Down
1 change: 1 addition & 0 deletions packages/inspector/package.json
Expand Up @@ -42,6 +42,7 @@
},
"dependencies": {
"gzip-size": "^6.0.0",
"pathe": "^0.3.7",
"sirv": "^2.0.2"
}
}
1 change: 1 addition & 0 deletions packages/nuxt/package.json
Expand Up @@ -53,6 +53,7 @@
"@unocss/reset": "workspace:*",
"@unocss/vite": "workspace:*",
"@unocss/webpack": "workspace:*",
"pathe": "^0.3.7",
"unocss": "workspace:*"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/index.ts
@@ -1,5 +1,5 @@
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'
import { dirname, resolve } from 'pathe'
import { addComponentsDir, addPluginTemplate, defineNuxtModule, extendWebpackConfig } from '@nuxt/kit'
import WebpackPlugin from '@unocss/webpack'
import VitePlugin from '@unocss/vite'
Expand Down
3 changes: 2 additions & 1 deletion packages/preset-uno/package.json
Expand Up @@ -56,6 +56,7 @@
"dependencies": {
"@unocss/core": "workspace:*",
"@unocss/preset-mini": "workspace:*",
"@unocss/preset-wind": "workspace:*"
"@unocss/preset-wind": "workspace:*",
"pathe": "^0.3.7"
}
}
3 changes: 2 additions & 1 deletion packages/preset-web-fonts/package.json
Expand Up @@ -42,6 +42,7 @@
},
"dependencies": {
"@unocss/core": "workspace:*",
"ohmyfetch": "^0.4.18"
"ohmyfetch": "^0.4.18",
"pathe": "^0.3.7"
}
}
3 changes: 2 additions & 1 deletion packages/preset-wind/package.json
Expand Up @@ -40,6 +40,7 @@
},
"dependencies": {
"@unocss/core": "workspace:*",
"@unocss/preset-mini": "workspace:*"
"@unocss/preset-mini": "workspace:*",
"pathe": "^0.3.7"
}
}
3 changes: 2 additions & 1 deletion packages/vite/package.json
Expand Up @@ -53,7 +53,8 @@
"@unocss/inspector": "workspace:*",
"@unocss/scope": "workspace:*",
"@unocss/transformer-directives": "workspace:*",
"magic-string": "^0.26.3"
"magic-string": "^0.26.3",
"pathe": "^0.3.7"
},
"devDependencies": {
"@unocss/shared-integration": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/devtool.ts
@@ -1,6 +1,6 @@
import fs from 'fs'
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'
import { dirname, resolve } from 'pathe'
import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite'
import type { IncomingMessage } from 'connect'
import type { UnocssPluginContext } from '@unocss/core'
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/modes/global/build.ts
@@ -1,4 +1,4 @@
import { resolve } from 'path'
import { resolve } from 'pathe'
import type { Plugin, ResolvedConfig } from 'vite'
import type { GenerateResult, UnocssPluginContext } from '@unocss/core'
import {
Expand Down
3 changes: 3 additions & 0 deletions packages/vscode/package.json
Expand Up @@ -69,6 +69,9 @@
"dev": "tsup --watch src",
"publish": "esno ./scripts/publish.ts"
},
"dependencies": {
"pathe": "^0.3.7"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go devDeps as VS Code is not a npm package.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

},
"devDependencies": {
"@types/vscode": "^1.71.0",
"@unocss/nuxt": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/scripts/publish.ts
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
import { dirname, join } from 'path'
import { fileURLToPath } from 'url'
import { dirname, join } from 'pathe'
import fs from 'fs-extra'
import { execa } from 'execa'

Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/src/annotation.ts
@@ -1,4 +1,4 @@
import path from 'path'
import path from 'pathe'
import type { DecorationOptions, ExtensionContext, StatusBarItem } from 'vscode'
import { DecorationRangeBehavior, MarkdownString, Range, window, workspace } from 'vscode'
import { INCLUDE_COMMENT_IDE, getMatchedPositionsFromCode, isCssId } from './integration'
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/src/contextLoader.ts
@@ -1,6 +1,6 @@
import { readdir } from 'fs/promises'
import path from 'path'
import fs from 'fs'
import path from 'pathe'
import type { UnocssPluginContext, UserConfig, UserConfigDefaults } from '@unocss/core'
import { notNull } from '@unocss/core'
import { sourceObjectFields, sourcePluginFactory } from 'unconfig/presets'
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/src/index.ts
@@ -1,4 +1,4 @@
import path from 'path'
import path from 'pathe'
import type { ExtensionContext } from 'vscode'
import { StatusBarAlignment, commands, window, workspace } from 'vscode'
import { version } from '../package.json'
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/src/utils.ts
@@ -1,4 +1,4 @@
import path from 'path'
import path from 'pathe'
import type { GenerateResult, UnoGenerator } from '@unocss/core'
import prettier from 'prettier/standalone'
import parserCSS from 'prettier/parser-postcss'
Expand Down
1 change: 1 addition & 0 deletions packages/webpack/package.json
Expand Up @@ -45,6 +45,7 @@
"@unocss/config": "workspace:*",
"@unocss/core": "workspace:*",
"magic-string": "^0.26.3",
"pathe": "^0.3.7",
"unplugin": "^0.9.5",
"webpack-sources": "^3.2.3"
},
Expand Down
19 changes: 19 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/copy-files.ts
@@ -1,6 +1,6 @@
import { copyFileSync } from 'fs'
import { resolve } from 'path'
import { fileURLToPath } from 'url'
import { resolve } from 'pathe'

// relative to scripts directory
const destinations = [
Expand Down
2 changes: 1 addition & 1 deletion scripts/prepare.ts
@@ -1,4 +1,4 @@
import { basename, dirname, extname, relative } from 'path'
import { basename, dirname, extname, relative } from 'pathe'
import fg from 'fast-glob'
import fs from 'fs-extra'

Expand Down
2 changes: 1 addition & 1 deletion scripts/size.ts
@@ -1,5 +1,5 @@
import fs from 'fs/promises'
import { basename } from 'path'
import { basename } from 'pathe'
import { sync as brotli } from 'brotli-size'
import { sync as gzip } from 'gzip-size'
import { minify } from 'terser'
Expand Down
2 changes: 1 addition & 1 deletion test/cli.test.ts
@@ -1,4 +1,4 @@
import { resolve } from 'path'
import { resolve } from 'pathe'
import fs from 'fs-extra'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { startCli } from '../packages/cli/src/cli-start'
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures.test.ts
@@ -1,4 +1,4 @@
import { join, resolve } from 'path'
import { join, resolve } from 'pathe'
import { build } from 'vite'
import { describe, expect, it } from 'vitest'
import fs from 'fs-extra'
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/vite-lib/vite.config.ts
@@ -1,4 +1,4 @@
import { resolve } from 'path'
import { resolve } from 'pathe'
import { defineConfig } from 'vite'
import UnoCSS from '@unocss/vite'

Expand Down