Skip to content

Commit

Permalink
refactor: use import type
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sodatea committed Sep 23, 2021
1 parent 63fdf8d commit 2eccc0e
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/descriptorCache.ts
@@ -1,5 +1,5 @@
import * as fs from 'fs'
import { SFCDescriptor } from '@vue/compiler-sfc'
import type { SFCDescriptor } from '@vue/compiler-sfc'
import { compiler } from './compiler'

const cache = new Map<string, SFCDescriptor>()
Expand Down
2 changes: 1 addition & 1 deletion src/formatError.ts
@@ -1,4 +1,4 @@
import { CompilerError } from '@vue/compiler-sfc'
import type { CompilerError } from '@vue/compiler-sfc'
import { compiler } from './compiler'
import chalk = require('chalk')

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -6,7 +6,7 @@ import * as loaderUtils from 'loader-utils'
import hash = require('hash-sum')

import { compiler } from './compiler'
import {
import type {
TemplateCompiler,
CompilerOptions,
SFCBlock,
Expand Down
2 changes: 1 addition & 1 deletion src/pluginWebpack4.ts
@@ -1,6 +1,6 @@
import * as qs from 'querystring'
import webpack = require('webpack')
import { VueLoaderOptions } from './'
import type { VueLoaderOptions } from './'

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

Expand Down
4 changes: 2 additions & 2 deletions src/pluginWebpack5.ts
@@ -1,6 +1,6 @@
import * as qs from 'querystring'
import { VueLoaderOptions } from './'
import { RuleSetRule, Compiler, Plugin } from 'webpack'
import type { VueLoaderOptions } from './'
import type { RuleSetRule, Compiler, Plugin } from 'webpack'

const id = 'vue-loader-plugin'
const NS = 'vue-loader'
Expand Down
4 changes: 2 additions & 2 deletions src/resolveScript.ts
@@ -1,10 +1,10 @@
import webpack = require('webpack')
import {
import type {
SFCDescriptor,
SFCScriptBlock,
TemplateCompiler,
} from '@vue/compiler-sfc'
import { VueLoaderOptions } from 'src'
import type { VueLoaderOptions } from 'src'
import { resolveTemplateTSOptions } from './util'
import { compiler } from './compiler'

Expand Down
6 changes: 3 additions & 3 deletions src/select.ts
@@ -1,8 +1,8 @@
import webpack = require('webpack')
import { SFCDescriptor } from '@vue/compiler-sfc'
import { ParsedUrlQuery } from 'querystring'
import type { SFCDescriptor } from '@vue/compiler-sfc'
import type { ParsedUrlQuery } from 'querystring'
import { resolveScript } from './resolveScript'
import { VueLoaderOptions } from 'src'
import type { VueLoaderOptions } from 'src'

export function selectBlock(
descriptor: SFCDescriptor,
Expand Down
2 changes: 1 addition & 1 deletion src/templateLoader.ts
Expand Up @@ -3,7 +3,7 @@ import * as qs from 'querystring'
import * as loaderUtils from 'loader-utils'
import { VueLoaderOptions } from './'
import { formatError } from './formatError'
import { TemplateCompiler } from '@vue/compiler-sfc'
import type { TemplateCompiler } from '@vue/compiler-sfc'
import { getDescriptor } from './descriptorCache'
import { resolveScript } from './resolveScript'
import { resolveTemplateTSOptions } from './util'
Expand Down
4 changes: 2 additions & 2 deletions src/util.ts
@@ -1,5 +1,5 @@
import { SFCDescriptor, CompilerOptions } from '@vue/compiler-sfc'
import { VueLoaderOptions } from '.'
import type { SFCDescriptor, CompilerOptions } from '@vue/compiler-sfc'
import type { VueLoaderOptions } from '.'

export function resolveTemplateTSOptions(
descriptor: SFCDescriptor,
Expand Down

0 comments on commit 2eccc0e

Please sign in to comment.