MCPcopy
hub / github.com/zoontek/react-native-bootsplash / writeXmlLike

Function writeXmlLike

src/extras/utils.ts:174–220  ·  view source on GitHub ↗
(
  filePath: string,
  content: string,
  { indent, ...formatOptions }: FormatOptions,
)

Source from the content-addressed store, hash-verified

172};
173
174export const writeXmlLike = async (
175 filePath: string,
176 content: string,
177 { indent, ...formatOptions }: FormatOptions,
178) => {
179 if (formatOptions.formatter === "prettier") {
180 const {
181 formatter,
182 useCssPlugin = false,
183 selfClosingTags = false,
184 ...options
185 } = formatOptions;
186
187 const formatted = await prettier.format(content, {
188 parser: "html",
189 bracketSameLine: true,
190 printWidth: 10000,
191 plugins: [htmlPlugin, ...(useCssPlugin ? [cssPlugin] : [])],
192 useTabs: indent?.type === "tab",
193 tabWidth: (indent?.amount ?? 0) || 2,
194 ...options,
195 });
196
197 hfs.write(
198 filePath,
199 selfClosingTags
200 ? formatted.replace(/><\/[a-z-0-9]+>/gi, " />")
201 : formatted,
202 );
203
204 log.write(filePath);
205 } else {
206 const { formatter, ...options } = formatOptions;
207
208 const formatted = formatXml(content, {
209 collapseContent: true,
210 forceSelfClosingEmptyTag: true,
211 lineSeparator: "\n",
212 whiteSpaceAtEndOfSelfclosingTag: true,
213 indentation: (indent?.indent ?? "") || " ",
214 ...options,
215 });
216
217 hfs.write(filePath, formatted);
218 log.write(filePath);
219 }
220};
221
222export type Asset = {
223 path: string;

Callers 3

generateFunction · 0.90
writeIOSAssetsFunction · 0.85
writeWebAssetsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…