@kitten-science/kitten-scientists 2.0.0-beta.11-dev.20250520113819 → 2.0.0-beta.11-dev.20250520120826
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/devcontainer/entrypoint-devcontainer.d.ts +3 -0
- package/lib/devcontainer/entrypoint-devcontainer.d.ts.map +1 -0
- package/lib/devcontainer/{rewrite-index.js → entrypoint-devcontainer.js} +30 -3
- package/lib/devcontainer/entrypoint-devcontainer.js.map +1 -0
- package/output/devcontainer/entrypoint-devcontainer.mjs +47 -0
- package/package.json +1 -1
- package/lib/devcontainer/inject-scripts.d.ts +0 -3
- package/lib/devcontainer/inject-scripts.d.ts.map +0 -1
- package/lib/devcontainer/inject-scripts.js +0 -14
- package/lib/devcontainer/inject-scripts.js.map +0 -1
- package/lib/devcontainer/rewrite-index.d.ts +0 -2
- package/lib/devcontainer/rewrite-index.d.ts.map +0 -1
- package/lib/devcontainer/rewrite-index.js.map +0 -1
- package/output/devcontainer/inject-scripts.mjs +0 -18
- package/output/devcontainer/rewrite-index.mjs +0 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entrypoint-devcontainer.d.ts","sourceRoot":"","sources":["../../source/devcontainer/entrypoint-devcontainer.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { readdirSync } from "node:fs";
|
|
1
4
|
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
-
import {
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { redirectErrorsToStream } from "@oliversalzburg/js-utils/errors/stream.js";
|
|
3
7
|
import * as cheerio from "cheerio";
|
|
4
8
|
const main = async () => {
|
|
5
9
|
const indexHtml = await readFile("index.html", { encoding: "utf8" });
|
|
10
|
+
const injectables = readdirSync("overlay")
|
|
11
|
+
.filter(_ => _.endsWith(".inject.js"))
|
|
12
|
+
.map(_ => join("overlay", _));
|
|
6
13
|
const $ = cheerio.load(indexHtml);
|
|
7
14
|
// First script block is NewRelic
|
|
8
15
|
$("script").first().remove();
|
|
@@ -21,8 +28,28 @@ const main = async () => {
|
|
|
21
28
|
await writeFile("index.js", indexJs);
|
|
22
29
|
$("script:not([src])").remove();
|
|
23
30
|
$("html").append('<script type="text/javascript" src="index.js"></script>');
|
|
31
|
+
process.stderr.write(`Injecting ${injectables.join(",")}...\n`);
|
|
32
|
+
$("html").append(`<script type="text/javascript">
|
|
33
|
+
const scripts = ${JSON.stringify(injectables)};
|
|
34
|
+
for (const subject of scripts) {
|
|
35
|
+
const script = document.createElement("script");
|
|
36
|
+
script.src = subject + "?_=" + new Date().getTime();
|
|
37
|
+
document.body.appendChild(script);
|
|
38
|
+
}
|
|
39
|
+
</script>`);
|
|
24
40
|
// Write result back to file.
|
|
25
41
|
await writeFile("index.html", $.html());
|
|
42
|
+
const httpServer = spawn("yarn", ["run", "watch-http-server", "-p", "8080"], { shell: true });
|
|
43
|
+
httpServer.stdout.on("data", data => {
|
|
44
|
+
console.log(`stdout: ${data}`);
|
|
45
|
+
});
|
|
46
|
+
httpServer.stderr.on("data", data => {
|
|
47
|
+
console.error(`stderr: ${data}`);
|
|
48
|
+
});
|
|
49
|
+
httpServer.on("close", code => {
|
|
50
|
+
console.log(`Child process exited with code ${code}. Exiting.`);
|
|
51
|
+
process.exit(code);
|
|
52
|
+
});
|
|
26
53
|
};
|
|
27
|
-
main().catch(
|
|
28
|
-
//# sourceMappingURL=
|
|
54
|
+
main().catch(redirectErrorsToStream(process.stderr));
|
|
55
|
+
//# sourceMappingURL=entrypoint-devcontainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entrypoint-devcontainer.js","sourceRoot":"","sources":["../../source/devcontainer/entrypoint-devcontainer.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,O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AAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// source/devcontainer/entrypoint-devcontainer.ts
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
import { readdirSync } from "node:fs";
|
|
6
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { redirectErrorsToStream } from "@oliversalzburg/js-utils/errors/stream.js";
|
|
9
|
+
import * as cheerio from "cheerio";
|
|
10
|
+
var main = async () => {
|
|
11
|
+
const indexHtml = await readFile("index.html", { encoding: "utf8" });
|
|
12
|
+
const injectables = readdirSync("overlay").filter((_) => _.endsWith(".inject.js")).map((_) => join("overlay", _));
|
|
13
|
+
const $ = cheerio.load(indexHtml);
|
|
14
|
+
$("script").first().remove();
|
|
15
|
+
$("script[src='https://www.googletagmanager.com/gtag/js?id=G-0QBDX221PR'] + script").remove();
|
|
16
|
+
$("script[src='https://www.googletagmanager.com/gtag/js?id=G-0QBDX221PR']").remove();
|
|
17
|
+
$("script[src='https://crowdin.com/js/crowdjet/crowdjet.js']").remove();
|
|
18
|
+
$("#crowdjet-container").remove();
|
|
19
|
+
$("#crowdjet-expand-container").remove();
|
|
20
|
+
const indexJs = $("script:not([src])").text().replaceAll(/Date.now\(\)/g, '"1494-fb07a6718893e6e1039c9ee77ecb388b1da3600a"');
|
|
21
|
+
await writeFile("index.js", indexJs);
|
|
22
|
+
$("script:not([src])").remove();
|
|
23
|
+
$("html").append('<script type="text/javascript" src="index.js"></script>');
|
|
24
|
+
process.stderr.write(`Injecting ${injectables.join(",")}...
|
|
25
|
+
`);
|
|
26
|
+
$("html").append(`<script type="text/javascript">
|
|
27
|
+
const scripts = ${JSON.stringify(injectables)};
|
|
28
|
+
for (const subject of scripts) {
|
|
29
|
+
const script = document.createElement("script");
|
|
30
|
+
script.src = subject + "?_=" + new Date().getTime();
|
|
31
|
+
document.body.appendChild(script);
|
|
32
|
+
}
|
|
33
|
+
</script>`);
|
|
34
|
+
await writeFile("index.html", $.html());
|
|
35
|
+
const httpServer = spawn("yarn", ["run", "watch-http-server", "-p", "8080"], { shell: true });
|
|
36
|
+
httpServer.stdout.on("data", (data) => {
|
|
37
|
+
console.log(`stdout: ${data}`);
|
|
38
|
+
});
|
|
39
|
+
httpServer.stderr.on("data", (data) => {
|
|
40
|
+
console.error(`stderr: ${data}`);
|
|
41
|
+
});
|
|
42
|
+
httpServer.on("close", (code) => {
|
|
43
|
+
console.log(`Child process exited with code ${code}. Exiting.`);
|
|
44
|
+
process.exit(code);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
main().catch(redirectErrorsToStream(process.stderr));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@kitten-science/kitten-scientists",
|
|
4
|
-
"version": "2.0.0-beta.11-dev.
|
|
4
|
+
"version": "2.0.0-beta.11-dev.20250520120826",
|
|
5
5
|
"description": "Add-on for the wonderful incremental browser game: https://kittensgame.com/web/",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Oliver Salzburg <oliver.salzburg@gmail.com>",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inject-scripts.d.ts","sourceRoot":"","sources":["../../source/devcontainer/inject-scripts.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
-
const indexHtml = readFileSync("index.html", "utf8");
|
|
4
|
-
const injectables = readdirSync("overlay").map(_ => _.endsWith(".inject.js"));
|
|
5
|
-
const injectedHtml = indexHtml.replace("</body>", `<script>
|
|
6
|
-
const scripts = ${JSON.stringify(injectables)};
|
|
7
|
-
for (const subject of scripts) {
|
|
8
|
-
const script = document.createElement("script");
|
|
9
|
-
script.src = subject + "?_=" + new Date().getTime();
|
|
10
|
-
document.body.appendChild(script);
|
|
11
|
-
}
|
|
12
|
-
</script></body>`);
|
|
13
|
-
writeFileSync("index.html", injectedHtml);
|
|
14
|
-
//# sourceMappingURL=inject-scripts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inject-scripts.js","sourceRoot":"","sources":["../../source/devcontainer/inject-scripts.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEnE,MAAM,SAAS,GAAG,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACrD,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;AAC9E,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CACpC,SAAS,EACT;sBACoB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;;;;;;mBAM9B,CAClB,CAAC;AACF,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite-index.d.ts","sourceRoot":"","sources":["../../source/devcontainer/rewrite-index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite-index.js","sourceRoot":"","sources":["../../source/devcontainer/rewrite-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IACtB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACrE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAElC,iCAAiC;IACjC,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,CAAC;IAE7B,eAAe;IACf,CAAC,CAAC,iFAAiF,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9F,CAAC,CAAC,wEAAwE,CAAC,CAAC,MAAM,EAAE,CAAC;IAErF,wEAAwE;IACxE,CAAC,CAAC,2DAA2D,CAAC,CAAC,MAAM,EAAE,CAAC;IACxE,CAAC,CAAC,qBAAqB,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,CAAC,CAAC,4BAA4B,CAAC,CAAC,MAAM,EAAE,CAAC;IAEzC,gCAAgC;IAChC,MAAM,OAAO,GAAG,CAAC,CAAC,mBAAmB,CAAC;SACnC,IAAI,EAAE;QACP,kHAAkH;SACjH,UAAU,CAAC,eAAe,EAAE,iDAAiD,CAAC,CAAC;IAElF,MAAM,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAErC,CAAC,CAAC,mBAAmB,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,yDAAyD,CAAC,CAAC;IAE5E,6BAA6B;IAC7B,MAAM,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// source/devcontainer/inject-scripts.ts
|
|
4
|
-
import { readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
-
var indexHtml = readFileSync("index.html", "utf8");
|
|
6
|
-
var injectables = readdirSync("overlay").map((_) => _.endsWith(".inject.js"));
|
|
7
|
-
var injectedHtml = indexHtml.replace(
|
|
8
|
-
"</body>",
|
|
9
|
-
`<script>
|
|
10
|
-
const scripts = ${JSON.stringify(injectables)};
|
|
11
|
-
for (const subject of scripts) {
|
|
12
|
-
const script = document.createElement("script");
|
|
13
|
-
script.src = subject + "?_=" + new Date().getTime();
|
|
14
|
-
document.body.appendChild(script);
|
|
15
|
-
}
|
|
16
|
-
</script></body>`
|
|
17
|
-
);
|
|
18
|
-
writeFileSync("index.html", injectedHtml);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// source/devcontainer/rewrite-index.ts
|
|
2
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
-
import { redirectErrorsToConsole } from "@oliversalzburg/js-utils/errors/console.js";
|
|
4
|
-
import * as cheerio from "cheerio";
|
|
5
|
-
var main = async () => {
|
|
6
|
-
const indexHtml = await readFile("index.html", { encoding: "utf8" });
|
|
7
|
-
const $ = cheerio.load(indexHtml);
|
|
8
|
-
$("script").first().remove();
|
|
9
|
-
$("script[src='https://www.googletagmanager.com/gtag/js?id=G-0QBDX221PR'] + script").remove();
|
|
10
|
-
$("script[src='https://www.googletagmanager.com/gtag/js?id=G-0QBDX221PR']").remove();
|
|
11
|
-
$("script[src='https://crowdin.com/js/crowdjet/crowdjet.js']").remove();
|
|
12
|
-
$("#crowdjet-container").remove();
|
|
13
|
-
$("#crowdjet-expand-container").remove();
|
|
14
|
-
const indexJs = $("script:not([src])").text().replaceAll(/Date.now\(\)/g, '"1494-fb07a6718893e6e1039c9ee77ecb388b1da3600a"');
|
|
15
|
-
await writeFile("index.js", indexJs);
|
|
16
|
-
$("script:not([src])").remove();
|
|
17
|
-
$("html").append('<script type="text/javascript" src="index.js"></script>');
|
|
18
|
-
await writeFile("index.html", $.html());
|
|
19
|
-
};
|
|
20
|
-
main().catch(redirectErrorsToConsole(console));
|