Skip to content

Commit

Permalink
Fix dts transform for imports with both default and named imports (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
hayes authored Jul 2, 2023
1 parent d97689b commit 64985de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/dts_walker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var (
regexpImportExportExpr = regexp.MustCompile(`^(import|export)(\s+type)?\s*('|"|[a-zA-Z0-9_\$]+\s+from|\*|\{)`)
regexpImportExportExpr = regexp.MustCompile(`^(import|export)(\s+type)?\s*('|"|[a-zA-Z0-9_\$]+(\s+from|,\s*\{)|\*|\{)`)
regexpFromExpr = regexp.MustCompile(`(\}|\*|\s)from\s*('|")`)
regexpImportPathExpr = regexp.MustCompile(`^import\s*('|")`)
regexpImportCallExpr = regexp.MustCompile(`(import|require)\(('|").+?('|")\)`)
Expand Down
2 changes: 2 additions & 0 deletions server/dts_walker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func TestDtsWalker(t *testing.T) {
import * as CSS from 'csstype';
import * as PropTypes from 'prop-types';
import type { Interaction as SchedulerInteraction } /* bad comment */ from "scheduler/tracing";
import DefaultExport, { AndNamed } from "scheduler/tracing";
export * from "react";
export = React;
Expand All @@ -41,6 +42,7 @@ import React = require("react");
import * as CSS from 'https://esm.sh/[email protected]/index.d.ts';
import * as PropTypes from 'https://esm.sh/[email protected]/index.d.ts';
import type { Interaction as SchedulerInteraction } /* bad comment */ from "https://esm.sh/[email protected]/tracing.d.ts";
import DefaultExport, { AndNamed } from "https://esm.sh/[email protected]/tracing.d.ts";
export * from "https://esm.sh/@types/[email protected]/index.d.ts";
export = React;
Expand Down

0 comments on commit 64985de

Please sign in to comment.