Skip to content

Commit 824ceb7

Browse files
committed
style: format
1 parent f1457f4 commit 824ceb7

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/features/deps.test.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { describe, expect, it } from 'vitest'
2-
import { getTypesPackageName, parseNodeModulesPath, parsePackageSpecifier } from './deps.ts'
2+
import {
3+
getTypesPackageName,
4+
parseNodeModulesPath,
5+
parsePackageSpecifier,
6+
} from './deps.ts'
37

48
describe('parsePackageSpecifier', () => {
59
it('parses a simple package name', () => {
@@ -31,15 +35,15 @@ describe('parsePackageSpecifier', () => {
3135

3236
describe('parseNodeModulesPath', () => {
3337
it('returns undefined for paths without node_modules', () => {
34-
expect(parseNodeModulesPath('/project/project/src/index.ts')).toBeUndefined()
38+
expect(
39+
parseNodeModulesPath('/project/project/src/index.ts'),
40+
).toBeUndefined()
3541
})
3642

3743
it('parses a simple package in node_modules', () => {
38-
expect(parseNodeModulesPath('/project/node_modules/lodash/index.js')).toEqual([
39-
'lodash',
40-
'/index.js',
41-
'/project/node_modules/lodash',
42-
])
44+
expect(
45+
parseNodeModulesPath('/project/node_modules/lodash/index.js'),
46+
).toEqual(['lodash', '/index.js', '/project/node_modules/lodash'])
4347
})
4448

4549
it('parses a scoped package in node_modules', () => {
@@ -54,7 +58,9 @@ describe('parseNodeModulesPath', () => {
5458

5559
it('uses the last node_modules segment for nested deps', () => {
5660
expect(
57-
parseNodeModulesPath('/project/node_modules/foo/node_modules/bar/lib/utils.js'),
61+
parseNodeModulesPath(
62+
'/project/node_modules/foo/node_modules/bar/lib/utils.js',
63+
),
5864
).toEqual([
5965
'bar',
6066
'/lib/utils.js',

src/features/deps.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ export function DepsPlugin(
330330
}
331331
}
332332

333-
export function parsePackageSpecifier(id: string): [name: string, subpath: string] {
333+
export function parsePackageSpecifier(
334+
id: string,
335+
): [name: string, subpath: string] {
334336
const [first, second] = id.split('/', 3)
335337

336338
const name = first[0] === '@' && second ? `${first}/${second}` : first

0 commit comments

Comments
 (0)