From 9ae3cb52a874adce0217dcb19284089a1f1bd01e Mon Sep 17 00:00:00 2001 From: dominikg Date: Mon, 2 Aug 2021 13:18:24 +0200 Subject: [PATCH] test: add css sourcemap to testcase for output filename --- .../_config.js | 21 ++++++++++++++++--- .../input.svelte | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/test/sourcemaps/samples/sourcemap-basename-without-outputname/_config.js b/test/sourcemaps/samples/sourcemap-basename-without-outputname/_config.js index d9004f7e58..15c346bfb9 100644 --- a/test/sourcemaps/samples/sourcemap-basename-without-outputname/_config.js +++ b/test/sourcemaps/samples/sourcemap-basename-without-outputname/_config.js @@ -1,11 +1,26 @@ -export const component_filepath = 'src/some/deep/path/input.svelte'; +import {magic_string_bundle} from '../../helpers'; + +export const component_filepath = 'src/some/deep/path/input.svelte'; export const component_file_basename = 'input.svelte'; +export const css_file_basename = 'input.css'; -export default { +const input_css = ' h1 {color: blue;}'; +export default { + preprocess: [ + { + style: ({ content, filename }) => { + const style_to_add = `/* Filename from preprocess: ${filename} */` + input_css; + return magic_string_bundle([ + { code: content, filename: component_file_basename }, + { code: style_to_add, filename: css_file_basename } + ],component_filepath); + } + } + ], js_map_sources: [component_file_basename], - + css_map_sources: [css_file_basename,component_file_basename], options: { filename: component_filepath }, diff --git a/test/sourcemaps/samples/sourcemap-basename-without-outputname/input.svelte b/test/sourcemaps/samples/sourcemap-basename-without-outputname/input.svelte index 4548af5548..189f28c390 100644 --- a/test/sourcemaps/samples/sourcemap-basename-without-outputname/input.svelte +++ b/test/sourcemaps/samples/sourcemap-basename-without-outputname/input.svelte @@ -1 +1,2 @@

sourcemap-basename-without-outputname

+