INNER CODE UNIT · TypeScript
re
baizunxian/zerorunner · frontend/src/components/monaco/nls/index.ts:79
const re = /(?:monaco-editor[\/\\]esm[\/\\])(.+)(?=\.js)/;
if (re.exec(filepath) && code.includes('localize(')) {
let path = RegExp.$1;
path=path.replaceAll('\\','/')
if (JSON.parse(CURRENT_LOCALE_DATA)[path]) {
code = code.replace(
/localize\(/g,
`localize("${path}", `,
);
}
return {
code: code,
/** 使用magic-string 生成 source map */
map: new MagicString(code).generateMap({
includeContent: true,
hires: true,
source: filepath,
}),