Skip to content

Commit

Permalink
fix: do not keep import type for prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Dec 16, 2020
1 parent 677c853 commit de22520
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async function decide() {

const isExternal = /^(https?:)?\/\//;
const isString = (x: unknown): x is string => typeof x === 'string';
const IMPORTS = /import(?:["'\s]*([\w*{}\n,\r\s\t]+)from\s*)?["'\s].*([@\w/_-]+)["'\s].*/g;
const IMPORTS = /import(?![\n\r\s\t]+type)(?:["'\s]*([\w*{}\n,\r\s\t]+)from\s*)?["'\s].*([@\w/_-]+)["'\s].*/g;

function isTypescript(attrs: Attributes): boolean | void {
if (isString(attrs.lang)) return /^(ts|typescript)$/.test(attrs.lang);
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/typescript.imports/Input.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import Counter from './Counter.svelte';
import { capitalize } from './utils';
import type { Readable } from 'svelte/store';
import {
hello, world,
howdy
Expand Down

0 comments on commit de22520

Please sign in to comment.