Skip to content

Commit 6e0e3e3

Browse files
committed
feat: migrate to obug
1 parent da1f356 commit 6e0e3e3

File tree

8 files changed

+32
-36
lines changed

8 files changed

+32
-36
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
},
6868
"dependencies": {
6969
"chokidar": "^5.0.0",
70-
"debug": "^4.4.3",
7170
"local-pkg": "^1.1.2",
7271
"magic-string": "^0.30.21",
7372
"mlly": "^1.8.0",
73+
"obug": "^2.1.1",
7474
"tinyglobby": "^0.2.15",
7575
"unplugin": "^2.3.11",
7676
"unplugin-utils": "^0.3.1"
@@ -82,7 +82,6 @@
8282
"@babel/types": "^7.28.6",
8383
"@nuxt/kit": "^4.2.2",
8484
"@nuxt/schema": "^4.2.2",
85-
"@types/debug": "^4.1.12",
8685
"@types/node": "^25.0.8",
8786
"bumpp": "^10.4.0",
8887
"compare-versions": "^6.1.1",

pnpm-lock.yaml

Lines changed: 15 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/context.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { ComponentInfo, Options, ResolvedOptions, Transformer } from '../ty
55
import { relative } from 'node:path'
66
import process from 'node:process'
77
import { slash, throttle, toArray } from '@antfu/utils'
8-
import Debug from 'debug'
8+
import { createDebug } from 'obug'
99
import { DIRECTIVE_IMPORT_PREFIX } from './constants'
1010
import { writeComponentsJson, writeDeclaration } from './declaration'
1111
import { searchComponents } from './fs/glob'
@@ -14,11 +14,11 @@ import transformer from './transformer'
1414
import { getNameFromFilePath, isExclude, matchGlobs, normalizeComponentInfo, parseId, pascalCase, resolveAlias } from './utils'
1515

1616
const debug = {
17-
components: Debug('unplugin-vue-components:context:components'),
18-
search: Debug('unplugin-vue-components:context:search'),
19-
hmr: Debug('unplugin-vue-components:context:hmr'),
20-
declaration: Debug('unplugin-vue-components:declaration'),
21-
env: Debug('unplugin-vue-components:env'),
17+
components: createDebug('unplugin-vue-components:context:components'),
18+
search: createDebug('unplugin-vue-components:context:search'),
19+
hmr: createDebug('unplugin-vue-components:context:hmr'),
20+
declaration: createDebug('unplugin-vue-components:declaration'),
21+
env: createDebug('unplugin-vue-components:env'),
2222
}
2323

2424
export class Context {

src/core/fs/glob.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { Context } from '../context'
2-
import Debug from 'debug'
2+
import { createDebug } from 'obug'
33
import { globSync } from 'tinyglobby'
44

5-
const debug = Debug('unplugin-vue-components:glob')
5+
const debug = createDebug('unplugin-vue-components:glob')
66

77
export function searchComponents(ctx: Context) {
88
debug(`started with: [${ctx.options.globs.join(', ')}]`)

src/core/resolvers/arco.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { ComponentInfo, ComponentResolver } from '../../types'
2-
import Debug from 'debug'
2+
import { createDebug } from 'obug'
33
import { isExclude, kebabCase, pascalCase } from '../utils'
44

5-
const debug = Debug('unplugin-vue-components:resolvers:arco')
5+
const debug = createDebug('unplugin-vue-components:resolvers:arco')
66

77
const matchComponents = [
88
{

src/core/transformer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import type { TransformResult } from 'unplugin'
22
import type { SupportedTransformer } from '..'
33
import type { Transformer } from '../types'
44
import type { Context } from './context'
5-
import Debug from 'debug'
65
import MagicString from 'magic-string'
6+
import { createDebug } from 'obug'
77
import { DISABLE_COMMENT } from './constants'
88
import transformComponent from './transforms/component'
99
import transformDirectives from './transforms/directive'
1010

11-
const debug = Debug('unplugin-vue-components:transformer')
11+
const debug = createDebug('unplugin-vue-components:transformer')
1212

1313
export interface ResolveResult {
1414
rawName: string

src/core/transforms/component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import type MagicString from 'magic-string'
22
import type { SupportedTransformer } from '../..'
33
import type { Context } from '../context'
44
import type { ResolveResult } from '../transformer'
5-
import Debug from 'debug'
5+
import { createDebug } from 'obug'
66
import { pascalCase, stringifyComponentImport } from '../utils'
77

8-
const debug = Debug('unplugin-vue-components:transform:component')
8+
const debug = createDebug('unplugin-vue-components:transform:component')
99

1010
function resolveVue2(code: string, s: MagicString) {
1111
const results: ResolveResult[] = []

src/core/transforms/directive/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import type MagicString from 'magic-string'
22
import type { SupportedTransformer } from '../../..'
33
import type { Context } from '../../context'
4-
import Debug from 'debug'
4+
import { createDebug } from 'obug'
55
import { DIRECTIVE_IMPORT_PREFIX } from '../../constants'
66
import { pascalCase, stringifyComponentImport } from '../../utils'
77
import vue2Resolver from './vue2'
88
import vue3Resolver from './vue3'
99

10-
const debug = Debug('unplugin-vue-components:transform:directive')
10+
const debug = createDebug('unplugin-vue-components:transform:directive')
1111

1212
export default async function transformDirective(code: string, transformer: SupportedTransformer, s: MagicString, ctx: Context, sfcPath: string) {
1313
let no = 0

0 commit comments

Comments
 (0)