this repo has no description

This ecosystem makes me want to live in the woods sometimes

Changed files
+37 -12
packages
injector
src
+19 -12
build.mjs
···
+
/* eslint-disable no-console */
import * as esbuild from "esbuild";
import copyStaticFiles from "esbuild-copy-static-files";
···
build.onEnd(async (result) => {
const formatted = await Promise.all([
-
esbuild.formatMessages(result.warnings, { kind: "warning", color: true }),
+
esbuild.formatMessages(result.warnings, {
+
kind: "warning",
+
color: true
+
}),
esbuild.formatMessages(result.errors, { kind: "error", color: true })
]).then((a) => a.flat());
-
+
// console.log(formatted);
for (const message of formatted) {
if (lastMessages.has(message)) continue;
···
}
});
}
-
}
+
};
const timeFormatter = new Intl.DateTimeFormat(undefined, {
hour: "numeric",
···
name: "build-log",
setup(build) {
build.onEnd((result) => {
-
console.log(`[${timeFormatter.format(new Date())}] [${tag}] build finished`);
+
console.log(
+
`[${timeFormatter.format(new Date())}] [${tag}] build finished`
+
);
});
}
});
···
dropLabels,
logLevel: "silent",
-
plugins: [
-
deduplicatedLogging,
-
taggedBuildLog(name)
-
]
+
plugins: [deduplicatedLogging, taggedBuildLog(name)]
};
if (watch) {
···
},
logLevel: "silent",
plugins: [
-
...copyManifest ? [copyStaticFiles({
-
src: `./packages/core-extensions/src/${ext}/manifest.json`,
-
dest: `./dist/core-extensions/${ext}/manifest.json`
-
})] : [],
+
...(copyManifest
+
? [
+
copyStaticFiles({
+
src: `./packages/core-extensions/src/${ext}/manifest.json`,
+
dest: `./dist/core-extensions/${ext}/manifest.json`
+
})
+
]
+
: []),
wpImportPlugin,
deduplicatedLogging,
taggedBuildLog(`ext/${ext}`)
+18
packages/injector/src/index.ts
···
}
}
+
/*
+
Fun fact: esbuild transforms that BrowserWindow class statement into this:
+
+
var variableName = class extends electronImport.BrowserWindow {
+
...
+
}
+
+
This means that in production builds, variableName is minified, and for some
+
ungodly reason this breaks electron (because it needs to be named BrowserWindow).
+
Without it, random things fail and crash (like opening DevTools). There is no
+
esbuild option to preserve only a single name, so you get the next best thing:
+
*/
+
Object.defineProperty(BrowserWindow, "name", {
+
value: "BrowserWindow",
+
writable: false
+
});
+
// "aight i'm writing exclusively C# from now on and never touching JavaScript again"
+
export async function inject(asarPath: string) {
try {
const config = readConfig();