vite-plugin-spire.officejs-brook 1.0.2 → 1.0.4

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.
@@ -1,15 +1,15 @@
1
- import { fileURLToPath as y } from "node:url";
1
+ import { fileURLToPath as $ } from "node:url";
2
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
- import { copyFile as _, copySingleFile as D } from "./copyFile.mjs";
4
+ import { copyFile as _, copySingleFile as x } from "./copyFile.mjs";
5
5
  import { chmodSync as C } from "node:fs";
6
- const I = y(import.meta.url);
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
- const G = async (n, a, r) => {
11
- var o, p;
12
- const e = x(a);
6
+ const A = $(import.meta.url);
7
+ m(A);
8
+ const P = "spire.officejs/service", y = "spire.officejs-server-config.json", I = P + "/OnlineServer/config", M = I + "/default.json", W = "win32";
9
+ let n = null, i, F, k, S, w, u;
10
+ const G = async (r, o, c) => {
11
+ var a, p;
12
+ const e = D(o);
13
13
  try {
14
14
  try {
15
15
  const t = await import.meta.resolve(
@@ -20,11 +20,11 @@ const G = async (n, a, r) => {
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), d = s(n, F), l = R();
24
- console.log("platform", l), l != "win32" ? (w = "OfficeServer/sources", S = "officeserver-linux") : (S = "OnlineServer", w = "officeserver-win.exe"), $ = f + e.path, k = s($, S), u = s(k, w);
25
- const g = await T(
23
+ const f = $(i), d = s(r, y), l = R();
24
+ console.log("platform", l), l != "win32" ? (S = "OfficeServer/sources", w = "officeserver-linux") : (S = "OnlineServer", w = "officeserver-win.exe"), F = f + e.path, k = s(F, S), u = s(k, w);
25
+ const g = await z(
26
+ c,
26
27
  r,
27
- n,
28
28
  e
29
29
  );
30
30
  if (l != "win32")
@@ -33,7 +33,7 @@ const G = async (n, a, r) => {
33
33
  } catch (t) {
34
34
  console.error(t);
35
35
  }
36
- c = b(u, [], {
36
+ n = b(u, [], {
37
37
  stdio: "pipe",
38
38
  detached: !1,
39
39
  cwd: k,
@@ -41,14 +41,14 @@ const G = async (n, a, r) => {
41
41
  ...process.env,
42
42
  NODE_CONFIG_DIR: g
43
43
  }
44
- }), console.log(`Officeserver started with PID: ${c.pid}`), (o = c.stdout) == null || o.on("data", (t) => {
44
+ }), console.log(`Officeserver started with PID: ${n.pid}`), (a = n.stdout) == null || a.on("data", (t) => {
45
45
  console.log(`[officeserver] ${t.toString().trim()}`);
46
- }), (p = c.stderr) == null || p.on("data", (t) => {
46
+ }), (p = n.stderr) == null || p.on("data", (t) => {
47
47
  console.error(`[${e.package}] ${t.toString().trim()}`);
48
- }), c.on("close", (t) => {
49
- console.log(`${e.package} process exited with code ${t}`), c = null;
50
- }), c.on("error", (t) => {
51
- console.error("Failed to start ${mapping.package}:", t), c = null;
48
+ }), n.on("close", (t) => {
49
+ console.log(`${e.package} process exited with code ${t}`), n = null;
50
+ }), n.on("error", (t) => {
51
+ console.error("Failed to start ${mapping.package}:", t), n = null;
52
52
  });
53
53
  } catch (f) {
54
54
  console.error(
@@ -57,31 +57,33 @@ const G = async (n, a, r) => {
57
57
  );
58
58
  }
59
59
  }, J = () => {
60
- c && (c.kill("SIGTERM"), c = null);
61
- }, x = (n) => {
62
- const a = R();
63
- let r = n.filter((e) => e.platform == a)[0];
64
- return r || (r = n.filter((e) => e.platform == W)[0]), r;
65
- }, R = () => process && process.platform, T = async (n, a, r) => {
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
- }, H = (n, a, r, e) => {
69
- var o;
70
- G(a, r, e), (o = n.httpServer) == null || o.on("close", () => {
60
+ n && (n.kill("SIGTERM"), n = null);
61
+ }, D = (r) => {
62
+ let o = R(), c = r.filter((e) => e.platform == o)[0];
63
+ return c || (c = r.filter((e) => e.platform == W)[0]), c;
64
+ }, R = () => {
65
+ let r = process && process.platform, o = T();
66
+ return r == "linux" && (o === "arm" || o === "arm64") && (r = "arm"), r;
67
+ }, T = () => process && process.arch, z = async (r, o, c) => {
68
+ const e = s(o, y), a = c.package, p = c.path, l = (await import("module").then((v) => v.createRequire))(o + "/node_modules/").resolve(`${a}/package.json`), g = m(l) + p, t = s(g, "OnlineServer/config"), h = s(t, "default.json");
69
+ return await x(e, h), t;
70
+ }, K = (r, o, c, e) => {
71
+ var a;
72
+ G(o, c, e), (a = r.httpServer) == null || a.on("close", () => {
71
73
  J();
72
74
  });
73
- }, K = async (n, a, r) => {
74
- const e = x(r);
75
+ }, Q = async (r, o, c) => {
76
+ const e = D(c);
75
77
  try {
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);
78
+ const a = r.dir, p = s(a, P), d = (await import("module").then((N) => N.createRequire))(o + "/node_modules/"), l = s(o, y), g = s(a, M);
77
79
  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
- console.log(`copying ${t} ......`), await _(E, j, ["logs"]), await D(l, g), console.log(`✅ successfully copied to: ${p}`);
80
- } catch (o) {
81
- throw new Error(o);
80
+ const q = d.resolve(`${t}/package.json`), E = m(q) + h, j = O(a, v);
81
+ console.log(`copying ${t} ......`), await _(E, j, ["logs"]), await x(l, g), console.log(`✅ successfully copied to: ${p}`);
82
+ } catch (a) {
83
+ throw new Error(a);
82
84
  }
83
85
  };
84
86
  export {
85
- K as bundleCoAuthServer,
86
- H as developCoAuthServer
87
+ Q as bundleCoAuthServer,
88
+ K as developCoAuthServer
87
89
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-spire.officejs-brook",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "./lib/index.mjs",
6
6
  "files": [