Skip to content

Commit 8810064

Browse files
authored
(refactor) move svelte2tsx into subfolder + split up (#527)
Part two of #514
1 parent 4309964 commit 8810064

22 files changed

+1202
-1164
lines changed

packages/svelte2tsx/src/htmlxtojsx/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Node } from 'estree-walker';
22
import MagicString from 'magic-string';
33
import svelte from 'svelte/compiler';
4-
import { parseHtmlx } from '../htmlxparser';
4+
import { parseHtmlx } from '../utils/htmlxparser';
55
import { handleActionDirective } from './nodes/action-directive';
66
import { handleAnimateDirective } from './nodes/animation-directive';
77
import { handleAttribute } from './nodes/attribute';

packages/svelte2tsx/src/htmlxtojsx/nodes/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import MagicString from 'magic-string';
22
import { Node } from 'estree-walker';
33
import { getSlotName } from '../../utils/svelteAst';
44
import { beforeStart } from '../utils/node-utils';
5-
import { getSingleSlotDef } from '../../nodes/slot';
5+
import { getSingleSlotDef } from '../../svelte2tsx/nodes/slot';
66

77
/**
88
* Handle `<svelte:self>` and slot-specific transformations.
Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
1-
import MagicString from 'magic-string';
21
import { Node } from 'estree-walker';
32
import { ArrayPattern, ObjectPattern, Identifier } from 'estree';
4-
import { ExportedNames } from './nodes/ExportedNames';
5-
import { ComponentEvents } from './nodes/ComponentEvents';
6-
7-
export interface InstanceScriptProcessResult {
8-
exportedNames: ExportedNames;
9-
events: ComponentEvents;
10-
uses$$props: boolean;
11-
uses$$restProps: boolean;
12-
uses$$slots: boolean;
13-
getters: Set<string>;
14-
}
15-
16-
export interface CreateRenderFunctionPara extends InstanceScriptProcessResult {
17-
str: MagicString;
18-
scriptTag: Node;
19-
scriptDestination: number;
20-
slots: Map<string, Map<string, string>>;
21-
events: ComponentEvents;
22-
isTsFile: boolean;
23-
}
243

254
export interface NodeRange {
265
start: number;
@@ -54,19 +33,3 @@ export interface BaseDirective extends Node {
5433
name: string;
5534
modifiers: string[];
5635
}
57-
58-
export interface AddComponentExportPara {
59-
str: MagicString;
60-
uses$$propsOr$$restProps: boolean;
61-
strictMode: boolean;
62-
/**
63-
* If true, not fallback to `CustomEvent<any>`
64-
* -> all unknown events will throw a type error
65-
* */
66-
strictEvents: boolean;
67-
isTsFile: boolean;
68-
getters: Set<string>;
69-
/** A named export allows for TSDoc-compatible docstrings */
70-
className?: string;
71-
componentDocumentation?: string | null;
72-
}

0 commit comments

Comments
 (0)