@omercnet/paseo-shared-browser 1.0.1-next.166.1 → 1.0.1-next.173.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omercnet/paseo-shared-browser",
|
|
3
|
-
"version": "1.0.1-next.
|
|
3
|
+
"version": "1.0.1-next.173.1",
|
|
4
4
|
"description": "One real Chromium session per Paseo workspace, shared live across every connected client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"client",
|
|
30
30
|
"scripts/prepare-dependencies.mjs",
|
|
31
31
|
"scripts/prepare-runtime.mjs",
|
|
32
|
+
"scripts/replace-runtime.mjs",
|
|
32
33
|
"server",
|
|
33
34
|
"shared",
|
|
34
35
|
"paseo-plugin.json"
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
2
|
import { constants } from "node:fs";
|
|
3
|
-
import {
|
|
4
|
-
access,
|
|
5
|
-
chmod,
|
|
6
|
-
cp,
|
|
7
|
-
lstat,
|
|
8
|
-
mkdir,
|
|
9
|
-
readdir,
|
|
10
|
-
rename,
|
|
11
|
-
rm,
|
|
12
|
-
symlink,
|
|
13
|
-
writeFile,
|
|
14
|
-
} from "node:fs/promises";
|
|
3
|
+
import { access, chmod, cp, lstat, mkdir, readdir, rm, symlink, writeFile } from "node:fs/promises";
|
|
15
4
|
import { createRequire } from "node:module";
|
|
16
5
|
import { arch, homedir, platform, userInfo } from "node:os";
|
|
17
6
|
import { dirname, join, resolve } from "node:path";
|
|
18
7
|
import { fileURLToPath } from "node:url";
|
|
19
8
|
import { promisify } from "node:util";
|
|
20
9
|
import { build } from "esbuild";
|
|
10
|
+
import { replaceRuntime } from "./replace-runtime.mjs";
|
|
21
11
|
|
|
22
12
|
const require = createRequire(import.meta.url);
|
|
23
13
|
|
|
@@ -257,6 +247,6 @@ await applyPrivatePermissions(stagingRoot);
|
|
|
257
247
|
if (hostPlatform !== "win32") {
|
|
258
248
|
await validateChromium(await requireExecutable(chromiumEntry, "Staged Chromium executable"));
|
|
259
249
|
}
|
|
260
|
-
await
|
|
250
|
+
await replaceRuntime(stagingRoot, runtimeRoot);
|
|
261
251
|
|
|
262
252
|
console.log(`Prepared immutable Shared Browser runtime assets in ${runtimeRoot}`);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { rename, rm } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
export async function replaceRuntime(stagingRoot, runtimeRoot) {
|
|
5
|
+
const previousRuntimeRoot = join(runtimeRoot, "..", `.runtime-previous-${process.pid}`);
|
|
6
|
+
await rm(previousRuntimeRoot, { recursive: true, force: true });
|
|
7
|
+
let replacedExistingRuntime = false;
|
|
8
|
+
try {
|
|
9
|
+
await rename(runtimeRoot, previousRuntimeRoot);
|
|
10
|
+
replacedExistingRuntime = true;
|
|
11
|
+
} catch (error) {
|
|
12
|
+
if (error?.code !== "ENOENT") throw error;
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
await rename(stagingRoot, runtimeRoot);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
if (replacedExistingRuntime) await rename(previousRuntimeRoot, runtimeRoot);
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
if (replacedExistingRuntime) {
|
|
21
|
+
await rm(previousRuntimeRoot, { recursive: true, force: true }).catch((error) => {
|
|
22
|
+
console.warn(`Could not remove previous Shared Browser runtime: ${error}`);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|