in extensions/gnome-legacy-extension/build-scripts/extension.js [76:161]
for await (const entry of await fs.opendir("./src")) {
if (entry.isFile()) {
if (!entry.name.endsWith(".js")) continue;
tasks.add(
new Task(async () => {
switch (env.GNOME_SHELL_BUILD_RELEASE) {
case "0":
case "false":
case undefined:
{
const source = await (async () => {
let source = await fs.readFile(
path.join("./src", entry.name),
"utf8",
);
// Remove property declarations from the source, they're only there
// to aid in type acquisition.
source = source.replaceAll(/(?<=\s)_[a-zA-Z0-9_$]*?;/g, "");
source = source.replaceAll(
/(?<=\s)#[a-zA-Z_$][a-zA-Z0-9_$]*?;/g,
"",
);
return source;
})();
const bundled = (() => {
let bundled = "const DEBUG=true;\n";
bundled += source;
bundled = bundled.replaceAll(
/this.#([a-zA-Z_$][a-zA-Z0-9_$]*)/g,
(_, ident) => `this.$${ident}`,
);
bundled = bundled.replaceAll(
/#([a-zA-Z_$][a-zA-Z0-9_$]*?)\(/g,
(_, ident) => `$${ident}(`,
);
return bundled;
})();
zip.add(entry.name, new File(bundled));
}
break;
default:
{
const source = await (async () => {
let source = await fs.readFile(
path.join("./src", entry.name),
"utf8",
);
// Remove property declarations from the source, they're only there
// to aid in type acquisition.
source = source.replaceAll(/(?<=\s)_[a-zA-Z0-9_$]*?;/g, "");
source = source.replaceAll(
/(?<=\s)#[a-zA-Z_$][a-zA-Z0-9_$]*?;/g,
"",
);
return source;
})();
const bundled = (() => {
let bundled = "const DEBUG=false;\n";
bundled += source;
bundled = bundled.replaceAll(
/this.#([a-zA-Z_$][a-zA-Z0-9_$]*)/g,
(_, ident) => `this.$${ident}`,
);
bundled = bundled.replaceAll(
/#([a-zA-Z_$][a-zA-Z0-9_$]*?)\(/g,
(_, ident) => `$${ident}(`,
);
return bundled;
})();
zip.add(entry.name, new File(bundled));
}
break;
}
}),
);
}
}