diff --git a/bin/pest-tia-vite-deps.mjs b/bin/pest-tia-vite-deps.mjs
index 7ab3905b..856a6639 100644
--- a/bin/pest-tia-vite-deps.mjs
+++ b/bin/pest-tia-vite-deps.mjs
@@ -13,7 +13,7 @@ const PAGE_EXTENSIONS = new Set([
'.mts', '.cts', '.mjs', '.cjs',
])
const SFC_RE = /\.(vue|svelte)$/i
-const SCRIPT_BLOCK_RE = /",
['imports' => ['@/A.vue'], 'moduleType' => 'js'],
],
+ 'generic-attribute' => [
+ "",
+ ['imports' => ['@/E.vue'], 'moduleType' => 'ts'],
+ ],
+ 'generic-attribute-single-quoted' => [
+ "",
+ ['imports' => ['@/F.vue'], 'moduleType' => 'ts'],
+ ],
+ 'generic-attribute-before-lang' => [
+ "",
+ ['imports' => ['@/G.vue'], 'moduleType' => 'ts'],
+ ],
];
}
@@ -630,6 +642,10 @@ it('always leaves a default export for importers to resolve against', function (
expect(tiaSfcResults()[$name]['code'])->toMatch('/export\s+default\b/');
})->with(array_keys(tiaSfcFixtures()));
+it('ends the opening script tag after a quoted attribute that holds a closing angle bracket', function (string $name): void {
+ expect(tiaSfcResults()[$name]['code'])->toStartWith("\nimport ");
+})->with(['generic-attribute', 'generic-attribute-single-quoted', 'generic-attribute-before-lang']);
+
it('does not add a second default export when the block already has one', function (): void {
preg_match_all('/export\s+default\b/', tiaSfcResults()['plain-script-with-default']['code'], $matches);
@@ -711,3 +727,50 @@ it('bundles a script setup component that mentions export default in a comment',
'resources/js/components/format.js' => ['Dashboard'],
]);
});
+
+it('bundles a generic component whose script tag holds a closing angle bracket', function (): void {
+ $rolldown = tiaRolldownPackageDir();
+ if ($rolldown === null) {
+ $this->markTestSkipped('rolldown is not resolvable.');
+ }
+
+ $root = sys_get_temp_dir().'/pest-tia-rolldown-generic-'.bin2hex(random_bytes(6));
+ mkdir($root.'/resources/js/pages', 0755, true);
+ mkdir($root.'/resources/js/components', 0755, true);
+ mkdir($root.'/node_modules', 0755, true);
+ $root = realpath($root);
+
+ symlink($rolldown, $root.'/node_modules/rolldown');
+ file_put_contents($root.'/package.json', '{}');
+ file_put_contents($root.'/resources/js/pages/Items.vue', <<<'VUE'
+
+
+ VUE);
+ file_put_contents($root.'/resources/js/components/SortableList.vue', <<<'VUE'
+
+ {{ label(item) }}
+ VUE);
+ file_put_contents($root.'/resources/js/components/label.ts', "export const label = (v: unknown): string => String(v)\n");
+
+ $process = new Process(['node', tiaViteHelperPath(), $root]);
+ $process->run();
+
+ unlink($root.'/node_modules/rolldown');
+ foreach (['resources/js/pages/Items.vue', 'resources/js/components/SortableList.vue', 'resources/js/components/label.ts', 'package.json'] as $file) {
+ @unlink($root.'/'.$file);
+ }
+ foreach (['node_modules', 'resources/js/pages', 'resources/js/components', 'resources/js', 'resources', ''] as $dir) {
+ @rmdir($root.'/'.$dir);
+ }
+
+ expect($process->getExitCode())->toBe(0, $process->getErrorOutput())
+ ->and(json_decode($process->getOutput(), true, flags: JSON_THROW_ON_ERROR))->toMatchArray([
+ 'resources/js/components/SortableList.vue' => ['Items'],
+ 'resources/js/components/label.ts' => ['Items'],
+ ]);
+});
diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php
index d97a8025..92dcb586 100644
--- a/tests/Visual/Parallel.php
+++ b/tests/Visual/Parallel.php
@@ -21,7 +21,7 @@ test('parallel', function () use ($run): void {
$output = implode("\n", array_slice(explode("\n", (string) $output), -10));
$profileOutput = $run('tests/Fixtures/Suites/SuccessOnly.php', '--profile');
- $expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 30 skipped, 1810 passed (3880 assertions)';
+ $expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 31 skipped, 1822 passed (3892 assertions)';
expect($output)
->toContain("Tests: {$expected}")