From 148201554f513800f35cb8b5aecac9ede8c9ea69 Mon Sep 17 00:00:00 2001 From: xeho91 Date: Fri, 24 May 2024 16:59:48 +0800 Subject: [PATCH] refactor & cleanup --- src/components/StoriesExtractor.svelte | 3 +- src/components/StoryRenderer.svelte | 1 + src/components/context.svelte.ts | 6 +- src/parser/ast.ts | 7 ++ src/parser/collect-stories.ts | 20 +-- src/parser/extract-ast-nodes.ts | 15 +++ src/parser/extract-stories.ts | 30 +++-- src/parser/types.ts | 64 +++++++--- src/parser/walkers/define-meta.ts | 114 +++++++++++++++++ src/parser/walkers/fragment.ts | 22 ++-- src/parser/walkers/module.ts | 167 +++++-------------------- src/preset.ts | 23 ++-- src/presets/vite.ts | 10 +- src/presets/vite/post-transform.ts | 13 +- src/presets/vite/pre-transform.ts | 25 ++-- src/transformer/create-appendix.ts | 31 ++++- src/transformer/define-meta.ts | 24 ++-- 17 files changed, 329 insertions(+), 246 deletions(-) create mode 100644 src/parser/ast.ts create mode 100644 src/parser/extract-ast-nodes.ts create mode 100644 src/parser/walkers/define-meta.ts diff --git a/src/components/StoriesExtractor.svelte b/src/components/StoriesExtractor.svelte index 8153aef..bae3a7f 100644 --- a/src/components/StoriesExtractor.svelte +++ b/src/components/StoriesExtractor.svelte @@ -1,11 +1,12 @@