MCPcopy Index your code
hub / github.com/darkreader/darkreader / bundleLocales

Function bundleLocales

tasks/bundle-locales.js:72–84  ·  view source on GitHub ↗
(srcLocalesDir, {platforms, debug})

Source from the content-addressed store, hash-verified

70}
71
72async function bundleLocales(srcLocalesDir, {platforms, debug}) {
73 const absoluteSrcLocalesDir = absolutePath(srcLocalesDir);
74 const list = await fs.readdir(absoluteSrcLocalesDir);
75 for (const name of list) {
76 if (!name.endsWith('.config')) {
77 continue;
78 }
79 const code = /** @type {string} */(name.split('.').at(-2));
80 const locale = await mergeLocale(absoluteSrcLocalesDir, code);
81 const fileName = name.substring(name.lastIndexOf('/') + 1);
82 await writeFiles(locale, fileName, {platforms, debug});
83 }
84}
85
86async function writeFiles(data, fileName, {platforms, debug}){
87 const locale = fileName.substring(0, fileName.lastIndexOf('.')).replace('-', '_');

Callers 1

createBundleLocalesTaskFunction · 0.85

Calls 3

absolutePathFunction · 0.90
mergeLocaleFunction · 0.85
writeFilesFunction · 0.70

Tested by

no test coverage detected