diff --git a/plugins/axiomcode/skills/axiomcode/scripts/ax_fresh.py b/plugins/axiomcode/skills/axiomcode/scripts/ax_fresh.py index 896f104bd..808b4a3cb 100644 --- a/plugins/axiomcode/skills/axiomcode/scripts/ax_fresh.py +++ b/plugins/axiomcode/skills/axiomcode/scripts/ax_fresh.py @@ -42,10 +42,16 @@ # what each language's parser reads: extensions, and file names read whatever their extension. Mirrors # parser/src/extract.ts: Java also reads .properties / XML / YAML / Gradle / lombok.config and # META-INF/services; TypeScript reads JavaScript beside it and resolves through tsconfig and package.json. +# SINGLE-FILE COMPONENTS (#1744): the web front ends read the \n" + "\n"), + ('src/List.svelte', '\n'), ('src/pages/index.astro', '---\n---\n'), + ('src/index.html', '
\n'), ('src/app.css', 'a {}\n'), ('README.md', '# x\n')): + write(root, f, body) + got = {os.path.relpath(p, root) for p in ax_fresh.watched(root, lang)} + check(f"prune: {lang} watches .vue, .svelte and .astro components, not the .html, .css or .md beside them", + got == {'src/lib.js', 'src/views/Home.vue', 'src/List.svelte', 'src/pages/index.astro'}, sorted(got)) + table = dict(lang=lang, lang_auto=True, src='', files=ax_fresh.snapshot(root, lang, root)) + with open(os.path.join(root, 'src/views/Home.vue'), 'w') as fh: + fh.write("\n" + "\n") + write(root, 'src/views/About.vue', '\n') + write(root, 'src/index.html', '
changed
\n') + c = ax_fresh.changes(root, table) + check(f"prune: {lang}: an edited .vue makes the graph stale and a new one is added; an edited .html does neither", + c == (['src/views/Home.vue'], ['src/views/About.vue'], []), c) + only = os.path.join(work, 'sfc-only') + write(only, 'src/App.vue', '\n') + n = {l: sum(1 for p in ax_fresh.watched(only, l) if p.endswith(ax_fresh.SOURCE[l])) for l in ('javascript', 'typescript')} + check("prune: a repository of .vue files alone counts no JavaScript or TypeScript source", n == {'javascript': 0, 'typescript': 0}, n) finally: shutil.rmtree(work, ignore_errors=True)