From 9dfa7a16265895149db646a228a9e1d21f77a5b2 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Wed, 10 Mar 2021 10:11:23 +0100 Subject: [PATCH] (chore) make svelte/compiler imports named Technically, there is no default export, although Rollup did handle it. --- packages/svelte2tsx/src/htmlxtojsx/index.ts | 4 ++-- packages/svelte2tsx/src/utils/htmlxparser.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/svelte2tsx/src/htmlxtojsx/index.ts b/packages/svelte2tsx/src/htmlxtojsx/index.ts index 81eb06f62..20b5c25ff 100644 --- a/packages/svelte2tsx/src/htmlxtojsx/index.ts +++ b/packages/svelte2tsx/src/htmlxtojsx/index.ts @@ -1,6 +1,6 @@ import { Node } from 'estree-walker'; import MagicString from 'magic-string'; -import svelte from 'svelte/compiler'; +import { walk } from 'svelte/compiler'; import { parseHtmlx } from '../utils/htmlxparser'; import { getSlotName } from '../utils/svelteAst'; import { handleActionDirective } from './nodes/action-directive'; @@ -55,7 +55,7 @@ export function convertHtmlxToJsx( let ifScope = new IfScope(templateScopeManager); - (svelte as any).walk(ast, { + (walk as any)(ast, { enter: (node: Node, parent: Node, prop: string, index: number) => { try { switch (node.type) { diff --git a/packages/svelte2tsx/src/utils/htmlxparser.ts b/packages/svelte2tsx/src/utils/htmlxparser.ts index bbccd92cd..9db013d72 100644 --- a/packages/svelte2tsx/src/utils/htmlxparser.ts +++ b/packages/svelte2tsx/src/utils/htmlxparser.ts @@ -1,4 +1,4 @@ -import compiler from 'svelte/compiler'; +import { parse } from 'svelte/compiler'; import { Node } from 'estree-walker'; function parseAttributeValue(value: string): string { @@ -106,7 +106,7 @@ export function parseHtmlx(htmlx: string, options?: { emitOnTemplateError?: bool const parsingCode = options?.emitOnTemplateError ? blankPossiblyErrorOperatorOrPropertyAccess(deconstructed) : deconstructed; - const svelteHtmlxAst = compiler.parse(parsingCode).html; + const svelteHtmlxAst = parse(parsingCode).html; //restore our script and style tags as nodes to maintain validity with HTMLx for (const s of verbatimElements) {