Skip to content

Commit 2eccc0e

Browse files
committed
refactor: use import type
Now that we don't depend on `@vue/compiler-sfc` directly, we should only import types from the package, in case of accidentally depending on the unlisted dependency.
1 parent 63fdf8d commit 2eccc0e

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

src/descriptorCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as fs from 'fs'
2-
import { SFCDescriptor } from '@vue/compiler-sfc'
2+
import type { SFCDescriptor } from '@vue/compiler-sfc'
33
import { compiler } from './compiler'
44

55
const cache = new Map<string, SFCDescriptor>()

src/formatError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CompilerError } from '@vue/compiler-sfc'
1+
import type { CompilerError } from '@vue/compiler-sfc'
22
import { compiler } from './compiler'
33
import chalk = require('chalk')
44

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as loaderUtils from 'loader-utils'
66
import hash = require('hash-sum')
77

88
import { compiler } from './compiler'
9-
import {
9+
import type {
1010
TemplateCompiler,
1111
CompilerOptions,
1212
SFCBlock,

src/pluginWebpack4.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as qs from 'querystring'
22
import webpack = require('webpack')
3-
import { VueLoaderOptions } from './'
3+
import type { VueLoaderOptions } from './'
44

55
const RuleSet = require('webpack/lib/RuleSet')
66

src/pluginWebpack5.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as qs from 'querystring'
2-
import { VueLoaderOptions } from './'
3-
import { RuleSetRule, Compiler, Plugin } from 'webpack'
2+
import type { VueLoaderOptions } from './'
3+
import type { RuleSetRule, Compiler, Plugin } from 'webpack'
44

55
const id = 'vue-loader-plugin'
66
const NS = 'vue-loader'

src/resolveScript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import webpack = require('webpack')
2-
import {
2+
import type {
33
SFCDescriptor,
44
SFCScriptBlock,
55
TemplateCompiler,
66
} from '@vue/compiler-sfc'
7-
import { VueLoaderOptions } from 'src'
7+
import type { VueLoaderOptions } from 'src'
88
import { resolveTemplateTSOptions } from './util'
99
import { compiler } from './compiler'
1010

src/select.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import webpack = require('webpack')
2-
import { SFCDescriptor } from '@vue/compiler-sfc'
3-
import { ParsedUrlQuery } from 'querystring'
2+
import type { SFCDescriptor } from '@vue/compiler-sfc'
3+
import type { ParsedUrlQuery } from 'querystring'
44
import { resolveScript } from './resolveScript'
5-
import { VueLoaderOptions } from 'src'
5+
import type { VueLoaderOptions } from 'src'
66

77
export function selectBlock(
88
descriptor: SFCDescriptor,

src/templateLoader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as qs from 'querystring'
33
import * as loaderUtils from 'loader-utils'
44
import { VueLoaderOptions } from './'
55
import { formatError } from './formatError'
6-
import { TemplateCompiler } from '@vue/compiler-sfc'
6+
import type { TemplateCompiler } from '@vue/compiler-sfc'
77
import { getDescriptor } from './descriptorCache'
88
import { resolveScript } from './resolveScript'
99
import { resolveTemplateTSOptions } from './util'

src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { SFCDescriptor, CompilerOptions } from '@vue/compiler-sfc'
2-
import { VueLoaderOptions } from '.'
1+
import type { SFCDescriptor, CompilerOptions } from '@vue/compiler-sfc'
2+
import type { VueLoaderOptions } from '.'
33

44
export function resolveTemplateTSOptions(
55
descriptor: SFCDescriptor,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy