vite-plugin-spire.officejs-brook 1.0.0 → 1.0.3
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/utils/coAuthServer.mjs +16 -16
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { fileURLToPath as y } from "node:url";
|
|
2
|
-
import { dirname as
|
|
2
|
+
import { dirname as m, resolve as s, join as O } from "node:path";
|
|
3
3
|
import { spawn as b } from "node:child_process";
|
|
4
4
|
import { copyFile as _, copySingleFile as D } from "./copyFile.mjs";
|
|
5
5
|
import { chmodSync as C } from "node:fs";
|
|
6
6
|
const I = y(import.meta.url);
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
let c = null, i,
|
|
7
|
+
m(I);
|
|
8
|
+
const P = "spire.officejs/service", F = "spire.officejs-server-config.json", A = P + "/OnlineServer/config", M = A + "/default.json", W = "win32";
|
|
9
|
+
let c = null, i, $, k, S, w, u;
|
|
10
10
|
const G = async (n, a, r) => {
|
|
11
11
|
var o, p;
|
|
12
12
|
const e = x(a);
|
|
@@ -15,13 +15,13 @@ const G = async (n, a, r) => {
|
|
|
15
15
|
const t = await import.meta.resolve(
|
|
16
16
|
`${e.package}/package.json`
|
|
17
17
|
);
|
|
18
|
-
i =
|
|
18
|
+
i = m(t);
|
|
19
19
|
} catch {
|
|
20
20
|
i = s(process.cwd(), "node_modules", e.package);
|
|
21
21
|
}
|
|
22
22
|
i.startsWith("file://") || (i.startsWith("/") || i.match(/^[A-Za-z]:/)) && (i = "file://" + (i.startsWith("/") ? "" : "/") + i);
|
|
23
|
-
const f = y(i),
|
|
24
|
-
console.log("platform", l), l != "win32" ? (
|
|
23
|
+
const f = y(i), d = s(n, F), l = R();
|
|
24
|
+
console.log("platform", l), l != "win32" ? (S = "OfficeServer/sources", w = "officeserver-linux") : (S = "OnlineServer", w = "officeserver-win.exe"), $ = f + e.path, k = s($, S), u = s(k, w);
|
|
25
25
|
const g = await T(
|
|
26
26
|
r,
|
|
27
27
|
n,
|
|
@@ -29,14 +29,14 @@ const G = async (n, a, r) => {
|
|
|
29
29
|
);
|
|
30
30
|
if (l != "win32")
|
|
31
31
|
try {
|
|
32
|
-
C(
|
|
32
|
+
C(u, 493);
|
|
33
33
|
} catch (t) {
|
|
34
34
|
console.error(t);
|
|
35
35
|
}
|
|
36
|
-
c = b(
|
|
36
|
+
c = b(u, [], {
|
|
37
37
|
stdio: "pipe",
|
|
38
38
|
detached: !1,
|
|
39
|
-
cwd:
|
|
39
|
+
cwd: k,
|
|
40
40
|
env: {
|
|
41
41
|
...process.env,
|
|
42
42
|
NODE_CONFIG_DIR: g
|
|
@@ -52,7 +52,7 @@ const G = async (n, a, r) => {
|
|
|
52
52
|
});
|
|
53
53
|
} catch (f) {
|
|
54
54
|
console.error(
|
|
55
|
-
`${e.package} executable not found at ${
|
|
55
|
+
`${e.package} executable not found at ${u}:`,
|
|
56
56
|
f
|
|
57
57
|
);
|
|
58
58
|
}
|
|
@@ -63,8 +63,8 @@ const G = async (n, a, r) => {
|
|
|
63
63
|
let r = n.filter((e) => e.platform == a)[0];
|
|
64
64
|
return r || (r = n.filter((e) => e.platform == W)[0]), r;
|
|
65
65
|
}, R = () => process && process.platform, T = async (n, a, r) => {
|
|
66
|
-
const e = s(a,
|
|
67
|
-
return await D(e,
|
|
66
|
+
const e = s(a, F), o = r.package, p = r.path, l = (await import("module").then((v) => v.createRequire))(a + "/node_modules/").resolve(`${o}/package.json`), g = m(l) + p, t = s(g, "OnlineServer/config"), h = s(t, "default.json");
|
|
67
|
+
return await D(e, h), t;
|
|
68
68
|
}, H = (n, a, r, e) => {
|
|
69
69
|
var o;
|
|
70
70
|
G(a, r, e), (o = n.httpServer) == null || o.on("close", () => {
|
|
@@ -73,9 +73,9 @@ const G = async (n, a, r) => {
|
|
|
73
73
|
}, K = async (n, a, r) => {
|
|
74
74
|
const e = x(r);
|
|
75
75
|
try {
|
|
76
|
-
const o = n.dir, p = s(o,
|
|
77
|
-
let t = e.package,
|
|
78
|
-
const q =
|
|
76
|
+
const o = n.dir, p = s(o, P), d = (await import("module").then((N) => N.createRequire))(a + "/node_modules/"), l = s(a, F), g = s(o, M);
|
|
77
|
+
let t = e.package, h = e.path, v = P + e.build;
|
|
78
|
+
const q = d.resolve(`${t}/package.json`), E = m(q) + h, j = O(o, v);
|
|
79
79
|
console.log(`copying ${t} ......`), await _(E, j, ["logs"]), await D(l, g), console.log(`✅ successfully copied to: ${p}`);
|
|
80
80
|
} catch (o) {
|
|
81
81
|
throw new Error(o);
|