;
+ return body;
+};
+
+//@ts-ignore
+< SvelteTranscriber /> + function PrepareDSLs()
+{
+ this.m_DSLMap.set("watch", new SvelteWatch());
+};
+
+//@ts-ignore
+< SvelteTranscriber /> + function PreparePlugins(this: SvelteTranscriber)
+{
+ this.m_Plugins = [
+ new DSLPlugin(this),
+ new ClassPlugin(this),
+ new LocalContextPlugin(this),
+ new SvelteFilterPlugin(this)
+ ]
+}
\ No newline at end of file
diff --git a/test/section/__snapshots__/import-section.test.ts.snap b/test/section/__snapshots__/import-section.test.ts.snap
new file mode 100644
index 0000000..cdb2dff
--- /dev/null
+++ b/test/section/__snapshots__/import-section.test.ts.snap
@@ -0,0 +1,5 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`translate import section extrat import from code 1`] = `"import Nested from \\"./Nested.svelte\\";"`;
+
+exports[`translate import section remove ts related import 1`] = `"import { Test } from \\"./Nested.svelte\\";"`;
diff --git a/test/section/__snapshots__/script-section.test.ts.snap b/test/section/__snapshots__/script-section.test.ts.snap
new file mode 100644
index 0000000..a7780e6
--- /dev/null
+++ b/test/section/__snapshots__/script-section.test.ts.snap
@@ -0,0 +1,23 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`translate props get props on demand 1`] = `
+"export let answer = 42;
+export let question;"
+`;
+
+exports[`translate props handle default prop 1`] = `"export let answer = 42;"`;
+
+exports[`translate props use {} to get props 1`] = `
+"export let answer;
+export let question;"
+`;
+
+exports[`translate script section extrat script from code 1`] = `"let name = 'world';"`;
+
+exports[`translate script section track change 1`] = `
+"let count = 0;
+let doubled = 0;
+$: {
+ doubled = count * 2;
+}"
+`;
diff --git a/test/section/__snapshots__/template-section.test.ts.snap b/test/section/__snapshots__/template-section.test.ts.snap
new file mode 100644
index 0000000..c43ba10
--- /dev/null
+++ b/test/section/__snapshots__/template-section.test.ts.snap
@@ -0,0 +1,115 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`translate template section extrat template from code 1`] = `
+"Hello {name.toUpperCase()}!
+"
+`;
+
+exports[`translate template section translate await 1`] = `
+"{#await promise}
+...waiting
+{:then number}
+The number is {number}
+{:catch error}
+{error.message}
+{/await}
+"
+`;
+
+exports[`translate template section translate await: only then exist 1`] = `
+"{#await promise} {:then number}
+The number is {number}
+{/await}
+"
+`;
+
+exports[`translate template section translate await: then & loading 1`] = `
+"{#await promise}
+...waiting
+{:then number}
+The number is {number}
+{/await}
+"
+`;
+
+exports[`translate template section translate each 1`] = `
+"Te Famous Cats of YouTube
+
+"
+`;
+
+exports[`translate template section translate each with value 1`] = `
+"
+"
+`;
+
+exports[`translate template section translate each with value and index 1`] = `
+"
+"
+`;
+
+exports[`translate template section translate each with value and key 1`] = `
+"
+"
+`;
+
+exports[`translate template section translate else 1`] = `
+"{#if x > 10}
+{x} is greater than 10
+{:else if x < 5}
+{x} is less than 5
+
+{:else}
+{x} is between 5 and 10
+
+{/if}
+"
+`;
+
+exports[`translate template section translate if 1`] = `
+"{#if user.loggedIn}
+
+{/if}
+"
+`;
+
+exports[`translate template section translate tag attribute starts with on 1`] = `
+"
+"
+`;
diff --git a/test/section/import-section.test.ts b/test/section/import-section.test.ts
new file mode 100644
index 0000000..652e8e7
--- /dev/null
+++ b/test/section/import-section.test.ts
@@ -0,0 +1,38 @@
+import { SvelteTranscriber } from "../../src";
+
+describe("translate import section", () =>
+{
+ test("extrat import from code", () =>
+ {
+ const code = `
+ import Nested from "./Nested";
+
+ export default function App()
+ {
+ let name = "";
+
+ This is a paragraph.
;
+ ;
+ }
+ `;
+
+ const { import_section } = new SvelteTranscriber(code).TranscribeToSections();
+ expect(import_section).toMatchSnapshot();
+ })
+
+ test("remove ts related import", () =>
+ {
+ const code = `
+ import {ITest, Test} from "./Nested";
+
+ export default function App()
+ {
+ const test1: ITest = {};
+ const test2 = new Test();
+ }
+ `;
+
+ const { import_section } = new SvelteTranscriber(code).TranscribeToSections();
+ expect(import_section).toMatchSnapshot();
+ })
+})
\ No newline at end of file
diff --git a/test/section/script-section.test.ts b/test/section/script-section.test.ts
new file mode 100644
index 0000000..d4963e1
--- /dev/null
+++ b/test/section/script-section.test.ts
@@ -0,0 +1,122 @@
+import { SvelteTranscriber } from "../../src";
+
+describe("translate script section", () =>
+{
+ test("extrat script from code", () =>
+ {
+ const code = `
+ export default function App()
+ {
+ let name = 'world';
+
+ //@ts-ignore
+ ;
+ }
+
+ function UI(name: string)
+ {
+ Hello {name.toUpperCase()}!
;
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("track change", () =>
+ {
+ const code = `
+ export default function App()
+ {
+ let count = 0;
+ let doubled = 0;
+
+ //@ts-ignore
+ ;
+ }
+
+ function TrackChange(doubled: number, count: number)
+ {
+ "use watch";
+ doubled = count * 2;
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+
+})
+
+describe("translate props", () =>
+{
+ test("use {} to get props", () =>
+ {
+ const code = `
+ export interface INestedProps
+ {
+ answer: number;
+ question: string;
+ }
+
+ export default function Nested(props: INestedProps)
+ {
+ const { answer, question } = props;
+
+ The answer is {answer}
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("handle default prop", () =>
+ {
+ const code = `
+ export interface INestedProps
+ {
+ answer: number;
+ }
+
+ export default function Nested(props: INestedProps)
+ {
+ const { answer = 42 } = props;
+
+ The answer is {answer}
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("get props on demand", () =>
+ {
+ const code = `
+ export interface INestedProps
+ {
+ answer: number;
+ question: string;
+ }
+
+ export default function Nested(props: INestedProps)
+ {
+ const { answer = 42 } = props;
+
+ The answer is {answer}
;
+
+ // ...
+
+ const { question } = props;
+
+ The question is {question}
;
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+})
+
+function SnapshotTest(code: string)
+{
+ const { script_section } = new SvelteTranscriber(code).TranscribeToSections();
+ expect(script_section).toMatchSnapshot();
+}
\ No newline at end of file
diff --git a/test/section/template-section.test.ts b/test/section/template-section.test.ts
new file mode 100644
index 0000000..02eb589
--- /dev/null
+++ b/test/section/template-section.test.ts
@@ -0,0 +1,240 @@
+import { SvelteTranscriber } from "../../src";
+import { FormatTemplate } from "../utility/utility";
+
+describe("translate template section", () =>
+{
+ test("extrat template from code", () =>
+ {
+ const code = `
+ export default function App()
+ {
+ let name = 'world';
+
+ //@ts-ignore
+ ;
+ }
+
+ function UI(name: string)
+ {
+ Hello {name.toUpperCase()}!
;
+ }
+ `;
+
+ SnapshotTest(code);
+
+ })
+
+ test("translate tag attribute starts with on", () =>
+ {
+ const code = `
+ export default function App()
+ {
+ ;
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("translate if", () =>
+ {
+ const code = `
+ export default function App()
+ {
+
+
+
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("translate else", () =>
+ {
+ const code = `
+ export default function App()
+ {
+ let x = 7;
+
+ 10}>
+ {x} is greater than 10
+
+ {x} is less than 5
+
+
+ {x} is between 5 and 10
+
+
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("translate each", () =>
+ {
+ const code = `
+ interface ICat
+ {
+ id: string;
+ name: string;
+ }
+
+ export default function App()
+ {
+ let cats: Array = [
+ { id: 'J---aiyznGQ', name: 'Keyboard Cat' },
+ { id: 'z_AbfPXTKms', name: 'Maru' },
+ { id: 'OUtn3pvWmpg', name: 'Henri The Existential Cat' }
+ ];
+
+ Te Famous Cats of YouTube
;
+
+
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("translate each with value", () =>
+ {
+ const code = `
+ export default function App()
+ {
+
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("translate each with value and index", () =>
+ {
+ const code = `
+ export default function App()
+ {
+
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("translate each with value and key", () =>
+ {
+ const code = `
+ export default function App()
+ {
+
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("translate await: only then exist", () =>
+ {
+ const code = `
+ export default function App()
+ {
+
+ {{
+ promise: promise
+ .then(number => The number is {number}
)
+ }}
+
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("translate await: then & loading", () =>
+ {
+ const code = `
+ export default function App()
+ {
+
+ {{
+ loading: ...waiting
,
+ promise: promise
+ .then(number => The number is {number}
)
+ }}
+
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+
+ test("translate await", () =>
+ {
+ const code = `
+ export default function App()
+ {
+
+ {{
+ loading: ...waiting
,
+ promise: promise
+ .then(number => The number is {number}
)
+ .catch((error: Error) => {error.message}
)
+ }}
+
+ }
+ `;
+
+ SnapshotTest(code);
+ })
+})
+
+function SnapshotTest(code: string)
+{
+ const { template_section } = new SvelteTranscriber(code).TranscribeToSections();
+ expect(FormatTemplate(template_section)).toMatchSnapshot();
+}
\ No newline at end of file
diff --git a/test/utility/utility.ts b/test/utility/utility.ts
new file mode 100644
index 0000000..ca6457d
--- /dev/null
+++ b/test/utility/utility.ts
@@ -0,0 +1,9 @@
+import * as prettier from "prettier";
+
+export function FormatTemplate(code: string)
+{
+ return prettier.format(code, {
+ parser: "html",
+ htmlWhitespaceSensitivity: "ignore"
+ });
+}
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..3df0e7b
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "compilerOptions": {
+ "target": "es6",
+ "module": "commonjs",
+ "moduleResolution": "node",
+ "outDir": "./dist",
+ "declaration": true,
+ "jsx": "preserve"
+ },
+ "include": [
+ "src/**/*.ts",
+ "cli/**/*.ts"
+ ]
+}
\ No newline at end of file