Skip to content

Commit c010c93

Browse files
committed
chore: refactor type imports
1 parent cd55dea commit c010c93

29 files changed

+434
-316
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161
"devDependencies": {
6262
"@babel/core": "^7.10.2",
6363
"@babel/preset-env": "^7.10.2",
64-
"@kiwi/eslint-config": "^1.2.0",
65-
"@kiwi/prettier-config": "^1.1.0",
64+
"@kiwi/eslint-config": "^1.4.3",
65+
"@kiwi/prettier-config": "^1.4.3",
6666
"@types/jest": "^25.2.3",
6767
"@types/node": "^14.0.11",
6868
"@types/node-sass": "^4.11.1",
@@ -71,16 +71,16 @@
7171
"babel-minify": "^0.5.1",
7272
"coffeescript": "^2.5.1",
7373
"conventional-changelog-cli": "^2.0.34",
74-
"eslint": "^6.0.0",
74+
"eslint": "^7.15.0",
7575
"husky": "^4.2.5",
7676
"jest": "^25.0.0",
7777
"less": "^3.11.3",
78-
"lint-staged": "^10.2.9",
78+
"lint-staged": "^10.5.3",
7979
"node-sass": "^4.14.1",
8080
"postcss": "^8",
8181
"postcss-easy-import": "^3.0.0",
8282
"postcss-load-config": "^2.1.0",
83-
"prettier": "^2.0.5",
83+
"prettier": "^2.2.1",
8484
"pug": "^3.0.0",
8585
"sass": "^1.26.8",
8686
"stylus": "^0.54.7",

src/autoProcess.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
PreprocessorGroup,
33
Preprocessor,
44
Processed,

src/modules/language.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { basename } from 'path';
22

3-
import { PreprocessorArgs } from '../types';
3+
import type { PreprocessorArgs } from '../types';
44
import { isValidLocalPath } from './utils';
55

66
const LANGUAGE_DEFAULTS: Record<string, any> = {

src/modules/markup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Transformer, Preprocessor } from '../types';
1+
import type { Transformer, Preprocessor } from '../types';
22

33
export async function transformMarkup(
44
{ content, filename }: { content: string; filename: string },

src/modules/tagInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { readFile, access } from 'fs';
22
import { resolve, dirname } from 'path';
33

4-
import { PreprocessorArgs } from '../types';
4+
import type { PreprocessorArgs } from '../types';
55
import { getLanguage } from './language';
66
import { isValidLocalPath } from './utils';
77

src/processors/babel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PreprocessorGroup, Options } from '../types';
1+
import type { PreprocessorGroup, Options } from '../types';
22
import { concat } from '../modules/utils';
33
import { getTagInfo } from '../modules/tagInfo';
44
import { prepareContent } from '../modules/prepareContent';

src/processors/coffeescript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PreprocessorGroup, Options } from '../types';
1+
import type { PreprocessorGroup, Options } from '../types';
22
import { getTagInfo } from '../modules/tagInfo';
33
import { concat } from '../modules/utils';
44
import { prepareContent } from '../modules/prepareContent';

src/processors/globalStyle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PreprocessorGroup } from '../types';
1+
import type { PreprocessorGroup } from '../types';
22

33
export default (): PreprocessorGroup => {
44
return {

src/processors/less.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PreprocessorGroup, Options } from '../types';
1+
import type { PreprocessorGroup, Options } from '../types';
22
import { getTagInfo } from '../modules/tagInfo';
33
import { concat } from '../modules/utils';
44
import { prepareContent } from '../modules/prepareContent';

src/processors/postcss.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PreprocessorGroup, Options } from '../types';
1+
import type { PreprocessorGroup, Options } from '../types';
22
import { getTagInfo } from '../modules/tagInfo';
33
import { concat } from '../modules/utils';
44
import { prepareContent } from '../modules/prepareContent';

src/processors/pug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Options, PreprocessorGroup } from '../types/index';
1+
import type { Options, PreprocessorGroup } from '../types/index';
22
import { prepareContent } from '../modules/prepareContent';
33
import { Pug } from '../types/options';
44
import { transformMarkup } from '../modules/markup';

src/processors/replace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PreprocessorGroup, Options } from '../types';
1+
import type { PreprocessorGroup, Options } from '../types';
22

33
export default (options: Options.Replace): PreprocessorGroup => ({
44
async markup({ content, filename }) {

src/processors/scss.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PreprocessorGroup, Options } from '../types';
1+
import type { PreprocessorGroup, Options } from '../types';
22
import { getTagInfo } from '../modules/tagInfo';
33
import { concat } from '../modules/utils';
44
import { prepareContent } from '../modules/prepareContent';

src/processors/stylus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Options, PreprocessorGroup } from '../types';
1+
import type { Options, PreprocessorGroup } from '../types';
22
import { getTagInfo } from '../modules/tagInfo';
33
import { concat } from '../modules/utils';
44
import { prepareContent } from '../modules/prepareContent';

src/processors/typescript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Options, PreprocessorGroup } from '../types';
1+
import type { Options, PreprocessorGroup } from '../types';
22
import { getTagInfo } from '../modules/tagInfo';
33
import { concat } from '../modules/utils';
44
import { prepareContent } from '../modules/prepareContent';

src/transformers/babel.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { transformAsync, TransformOptions } from '@babel/core';
1+
import type { TransformOptions } from '@babel/core';
2+
import { transformAsync } from '@babel/core';
23

3-
import { Transformer, Options } from '../types';
4+
import type { Transformer, Options } from '../types';
45

56
const transformer: Transformer<Options.Babel> = async ({
67
content,

src/transformers/coffeescript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import coffeescript from 'coffeescript';
22

3-
import { Transformer, Options } from '../types';
3+
import type { Transformer, Options } from '../types';
44

55
const transformer: Transformer<Options.Coffeescript> = ({
66
content,

src/transformers/globalStyle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import postcss from 'postcss';
22
import type * as pcss from 'postcss';
33

4-
import { Transformer, Options } from '../types';
4+
import type { Transformer, Options } from '../types';
55
import { globalifySelector } from '../modules/globalifySelector';
66

77
const selectorPattern = /:global(?!\()/;

src/transformers/less.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import less from 'less';
22

33
import { getIncludePaths } from '../modules/utils';
4-
import { Transformer, Options } from '../types';
4+
import type { Transformer, Options } from '../types';
55

66
const transformer: Transformer<Options.Less> = async ({
77
content,

src/transformers/postcss.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import postcss from 'postcss';
22

3-
import { Transformer, Options } from '../types';
3+
import type { Transformer, Options } from '../types';
44

55
async function process({
66
options: { plugins = [], parser, syntax } = {},

src/transformers/pug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import detectIndent from 'detect-indent';
22
import pug from 'pug';
33

4-
import { Transformer, Options } from '../types';
4+
import type { Transformer, Options } from '../types';
55

66
// Mixins to use svelte template features
77
const GET_MIXINS = (identationType: 'tab' | 'space') =>

src/transformers/replace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Transformer, Options } from '../types';
1+
import type { Transformer, Options } from '../types';
22

33
const transformer: Transformer<Options.Replace> = async ({
44
content,

src/transformers/stylus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'path';
33
import stylus from 'stylus';
44

55
import { getIncludePaths } from '../modules/utils';
6-
import { Transformer, Options } from '../types';
6+
import type { Transformer, Options } from '../types';
77

88
const transformer: Transformer<Options.Stylus> = ({
99
content,

src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
Processed as SvelteProcessed,
33
Preprocessor,
44
} from 'svelte/types/compiler/preprocess';

src/types/options.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type * as postcss from 'postcss';
2-
import { Options as SassOptions, render, renderSync } from 'sass';
3-
import { Options as PugOptions } from 'pug';
4-
import { TransformOptions as BabelOptions } from '@babel/core';
2+
import type { Options as SassOptions, render, renderSync } from 'sass';
3+
import type { Options as PugOptions } from 'pug';
4+
import type { TransformOptions as BabelOptions } from '@babel/core';
55

66
type ContentModifier = {
77
prependData?: string;

test/transformers/replace.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import autoProcess from '../../src';
22
import { preprocess } from '../utils';
3-
import { Options } from '../../src/types';
3+
import type { Options } from '../../src/types';
44

55
const options: Options.Replace = [
66
[/@if\s*\((.*?)\)$/gim, '{#if $1}'],

test/transformers/scss.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { resolve } from 'path';
55

66
import sveltePreprocess from '../../src';
77
import { preprocess } from '../utils';
8-
import { Options } from '../../src/types';
8+
import type { Options } from '../../src/types';
99

1010
const implementation: Options.Sass['implementation'] = {
1111
render(options, callback) {

test/transformers/typescript.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { resolve } from 'path';
22

3-
import { Diagnostic } from 'typescript';
3+
import type { Diagnostic } from 'typescript';
44

55
import sveltePreprocess from '../../src';
6-
import { Processed } from '../../src/types';
6+
import type { Processed } from '../../src/types';
77
import { preprocess, getFixtureContent, spyConsole } from '../utils';
88

99
spyConsole({ silent: true });

0 commit comments

Comments
 (0)