<empty-script>
+ diff --git a/playground/vue-sourcemap/Main.vue b/playground/vue-sourcemap/Main.vue index 8b092e88..d63d3799 100644 --- a/playground/vue-sourcemap/Main.vue +++ b/playground/vue-sourcemap/Main.vue @@ -7,6 +7,7 @@<empty-script>
+ +", + ], + "version": 3, +} +`; + exports[`serve:vue-sourcemap > js > serve-js 1`] = ` { "ignoreList": [], @@ -194,7 +212,8 @@ exports[`serve:vue-sourcemap > less with additionalData > serve-less-with-additi exports[`serve:vue-sourcemap > no script > serve-no-script 1`] = ` { - "mappings": ";;;wBACE,oBAAwB,WAArB,aAAiB", + "ignoreList": [], + "mappings": ";;;;wBACE,oBAAwB,WAArB,aAAiB", "sources": [ "NoScript.vue", ], @@ -296,6 +315,20 @@ exports[`serve:vue-sourcemap > src imported > serve-src-imported 1`] = ` } `; +exports[`serve:vue-sourcemap > src imported html > serve-html 1`] = ` +{ + "mappings": ";;;wBAAA,oBAA8B,WAA3B,mBAAuB", + "sources": [ + "src-import.html", + ], + "sourcesContent": [ + "<src-import-html>
+", + ], + "version": 3, +} +`; + exports[`serve:vue-sourcemap > src imported sass > serve-src-imported-sass 1`] = ` { "ignoreList": [], diff --git a/playground/vue-sourcemap/__tests__/vue-sourcemap.spec.ts b/playground/vue-sourcemap/__tests__/vue-sourcemap.spec.ts index 45a1d776..1f9a0987 100644 --- a/playground/vue-sourcemap/__tests__/vue-sourcemap.spec.ts +++ b/playground/vue-sourcemap/__tests__/vue-sourcemap.spec.ts @@ -1,5 +1,6 @@ import { URL } from 'node:url' import { describe, expect, test } from 'vitest' +import * as vite from 'vite' import { extractSourcemap, formatSourcemapForSnapshot, @@ -9,6 +10,8 @@ import { serverLogs, } from '~utils' +const isRolldownVite = 'rolldownVersion' in vite + describe.runIf(isServe)('serve:vue-sourcemap', () => { const getStyleTagContentIncluding = async (content: string) => { const styles = await page.$$('style') @@ -28,7 +31,8 @@ describe.runIf(isServe)('serve:vue-sourcemap', () => { expect(formatSourcemapForSnapshot(map)).toMatchSnapshot('serve-js') }) - test('ts', async () => { + // skip this test for now with rolldown-vite as the snapshot is slightly different + test.skipIf(isRolldownVite)('ts', async () => { const res = await page.request.get(new URL('./Ts.vue', page.url()).href) const js = await res.text() const map = extractSourcemap(js) @@ -91,6 +95,18 @@ describe.runIf(isServe)('serve:vue-sourcemap', () => { ) }) + test('src imported html', async () => { + const res = await page.request.get( + new URL( + './src-import-html/src-import.html?import&vue&type=template&src=true&lang.js', + page.url(), + ).href, + ) + const js = await res.text() + const map = extractSourcemap(js) + expect(formatSourcemapForSnapshot(map)).toMatchSnapshot('serve-html') + }) + test('no script', async () => { const res = await page.request.get( new URL('./NoScript.vue', page.url()).href, @@ -100,6 +116,17 @@ describe.runIf(isServe)('serve:vue-sourcemap', () => { expect(formatSourcemapForSnapshot(map)).toMatchSnapshot('serve-no-script') }) + test('empty script', async () => { + const res = await page.request.get( + new URL('./EmptyScript.vue', page.url()).href, + ) + const js = await res.text() + const map = extractSourcemap(js) + expect(formatSourcemapForSnapshot(map)).toMatchSnapshot( + 'serve-empty-script', + ) + }) + test('no template', async () => { const res = await page.request.get( new URL('./NoTemplate.vue', page.url()).href, diff --git a/playground/vue-sourcemap/package.json b/playground/vue-sourcemap/package.json index b72d8f90..4427b5b0 100644 --- a/playground/vue-sourcemap/package.json +++ b/playground/vue-sourcemap/package.json @@ -11,9 +11,9 @@ }, "devDependencies": { "@vitejs/plugin-vue": "workspace:*", - "less": "^4.2.0", + "less": "^4.3.0", "postcss-nested": "^7.0.2", - "sass": "^1.81.0" + "sass": "^1.89.2" }, "dependencies": { "vue": "catalog:" diff --git a/playground/vue-sourcemap/src-import-html/SrcImportHtml.vue b/playground/vue-sourcemap/src-import-html/SrcImportHtml.vue new file mode 100644 index 00000000..79e3f7b0 --- /dev/null +++ b/playground/vue-sourcemap/src-import-html/SrcImportHtml.vue @@ -0,0 +1,5 @@ + + + diff --git a/playground/vue-sourcemap/src-import-html/src-import.html b/playground/vue-sourcemap/src-import-html/src-import.html new file mode 100644 index 00000000..7202ea93 --- /dev/null +++ b/playground/vue-sourcemap/src-import-html/src-import.html @@ -0,0 +1 @@ +<src-import-html>
diff --git a/playground/vue/ExportTypeProps1.vue b/playground/vue/ExportTypeProps1.vue new file mode 100644 index 00000000..29cb1e17 --- /dev/null +++ b/playground/vue/ExportTypeProps1.vue @@ -0,0 +1,19 @@ + +