MCPcopy
hub / github.com/sveltejs/svelte-preprocess / prepareContent

Function prepareContent

src/modules/prepareContent.ts:2–22  ·  view source on GitHub ↗
({
  options,
  content,
}: {
  options: any;
  content: string;
})

Source from the content-addressed store, hash-verified

1// todo: could use magic-string and generate some sourcemaps 🗺
2export function prepareContent({
3 options,
4 content,
5}: {
6 options: any;
7 content: string;
8}) {
9 if (typeof options !== 'object') {
10 return content;
11 }
12
13 if (options.stripIndent) {
14 content = stripIndent(content);
15 }
16
17 if (options.prependData) {
18 content = `${options.prependData}\n${content}`;
19 }
20
21 return content;
22}
23
24/** Get the shortest leading whitespace from lines in a string */
25function minIndent(s: string) {

Callers 9

getTransformerToFunction · 0.90
styleFunction · 0.90
scriptFunction · 0.90
scriptFunction · 0.90
styleFunction · 0.90
scriptFunction · 0.90
markupFunction · 0.90
styleFunction · 0.90
styleFunction · 0.90

Calls 1

stripIndentFunction · 0.85

Tested by

no test coverage detected