mirror of https://github.com/sveltejs/svelte
parent
c842d1617f
commit
1c241dd1a8
@ -0,0 +1,15 @@
|
||||
import MagicString from 'magic-string';
|
||||
import { magic_string_preprocessor_result } from '../../helpers';
|
||||
|
||||
export default {
|
||||
js_map_sources: ['input.svelte'],
|
||||
preprocess: [
|
||||
{
|
||||
script: ({ content }) => {
|
||||
const src = new MagicString(content);
|
||||
src.prepend('console.log("Injected first line");\n');
|
||||
return magic_string_preprocessor_result('input.svelte', src);
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
@ -0,0 +1,3 @@
|
||||
<script>console.log('Target')</script>
|
||||
|
||||
<h1>Hello</h1>
|
@ -0,0 +1,9 @@
|
||||
import { assert_mapped } from '../../helpers';
|
||||
|
||||
export function test({ input, preprocessed }) {
|
||||
assert_mapped({
|
||||
code: 'Target',
|
||||
input: input.locate,
|
||||
preprocessed
|
||||
});
|
||||
}
|
Loading…
Reference in new issue