@opencloud-eu/extension-sdk 6.2.0 → 7.0.0

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,20 +1,21 @@
1
1
  import { mergeConfig as e, searchForWorkspaceRoot as t } from "vite";
2
- import { join as n } from "path";
3
- import { cwd as r } from "process";
4
- import { existsSync as i, readFileSync as a, watch as o } from "fs";
5
- import s from "@tailwindcss/vite";
6
- import c from "@vitejs/plugin-basic-ssl";
7
- import l from "@vitejs/plugin-vue";
8
- import { federation as u } from "@module-federation/vite";
9
- import d from "https";
10
- import f from "http";
2
+ import { join as n, posix as r } from "path";
3
+ import { cwd as i } from "process";
4
+ import { existsSync as a, readFileSync as o, watch as s } from "fs";
5
+ import c from "@tailwindcss/vite";
6
+ import l from "@vitejs/plugin-basic-ssl";
7
+ import u from "@vitejs/plugin-vue";
8
+ import { federation as d } from "@module-federation/vite";
9
+ import f from "https";
10
+ import p from "http";
11
11
  //#region src/externalModules.ts
12
- var p = [
12
+ var m = [
13
13
  "vue",
14
14
  "luxon",
15
15
  "pinia",
16
16
  "vue3-gettext",
17
17
  "@opencloud-eu/web-pkg",
18
+ "@opencloud-eu/web-pkg/editor",
18
19
  "@opencloud-eu/web-client",
19
20
  "@opencloud-eu/web-client/graph",
20
21
  "@opencloud-eu/web-client/graph/generated",
@@ -24,9 +25,9 @@ var p = [
24
25
  ];
25
26
  //#endregion
26
27
  //#region src/plugins/federationRegistrationClient.ts
27
- function m(e, { method: t = "GET", body: n } = {}) {
28
+ function h(e, { method: t = "GET", body: n } = {}) {
28
29
  return new Promise((r, i) => {
29
- let a = (new URL(e).protocol === "https:" ? d : f).request(e, {
30
+ let a = (new URL(e).protocol === "https:" ? f : p).request(e, {
30
31
  method: t,
31
32
  rejectUnauthorized: !1
32
33
  }, (e) => {
@@ -40,7 +41,7 @@ function m(e, { method: t = "GET", body: n } = {}) {
40
41
  a.on("error", i), n && (a.setHeader("Content-Type", "application/json"), a.write(n)), a.end();
41
42
  });
42
43
  }
43
- function h({ hostUrl: e, name: t, entryPoint: n, getMetadata: r, interval: i = 5e3, path: a = "/_dev/remotes", metadataWatchFiles: s = [] }) {
44
+ function g({ hostUrl: e, name: t, entryPoint: n, getMetadata: r, interval: i = 5e3, path: a = "/_dev/remotes", metadataWatchFiles: o = [] }) {
44
45
  return {
45
46
  name: "federation-registration-client",
46
47
  apply: "serve",
@@ -51,7 +52,7 @@ function h({ hostUrl: e, name: t, entryPoint: n, getMetadata: r, interval: i = 5
51
52
  if (!u) return;
52
53
  let n = r?.(), i = `${e}${a}`;
53
54
  try {
54
- let e = await m(i, {
55
+ let e = await h(i, {
55
56
  method: "POST",
56
57
  body: JSON.stringify({
57
58
  id: t,
@@ -65,8 +66,8 @@ function h({ hostUrl: e, name: t, entryPoint: n, getMetadata: r, interval: i = 5
65
66
  c.httpServer?.on("listening", () => {
66
67
  let e = c.httpServer.address(), t = typeof e == "object" ? e?.port : e;
67
68
  u = `https://${typeof c.config.server.host == "string" ? c.config.server.host : "localhost"}:${t}/${n}`, f(), l = setInterval(f, i);
68
- for (let e of s) try {
69
- let t = o(e, { persistent: !1 }, () => {
69
+ for (let e of o) try {
70
+ let t = s(e, { persistent: !1 }, () => {
70
71
  console.log(`[federation-registration] ${e} changed, re-registering...`), f();
71
72
  });
72
73
  d.push(t);
@@ -80,8 +81,8 @@ function h({ hostUrl: e, name: t, entryPoint: n, getMetadata: r, interval: i = 5
80
81
  }
81
82
  //#endregion
82
83
  //#region src/plugins/manifest.ts
83
- var g = "manifest.json", _ = n("./src/", g);
84
- function v(e) {
84
+ var _ = "manifest.json", v = n("./src/", _);
85
+ function y(e) {
85
86
  let t = "";
86
87
  return {
87
88
  name: "manifest",
@@ -90,25 +91,25 @@ function v(e) {
90
91
  t = e.build.outDir;
91
92
  },
92
93
  buildStart() {
93
- this.addWatchFile(_);
94
+ this.addWatchFile(v);
94
95
  },
95
- generateBundle(r, o) {
96
- let s = n(t, g);
97
- if (i(s)) {
96
+ generateBundle(r, i) {
97
+ let s = n(t, _);
98
+ if (a(s)) {
98
99
  this.warn(`${s} already exists in output directory (likely from public/), skipping generation\nConsider using --emptyOutDir if outDir is outside of project root.`);
99
100
  return;
100
101
  }
101
- let c = Object.values(o).find((t) => t.type === "chunk" && t.name === e);
102
+ let c = Object.values(i).find((t) => t.type === "chunk" && t.name === e);
102
103
  c || this.error("No entry chunk found");
103
104
  let l = {};
104
- if (i(_)) try {
105
- l = JSON.parse(a(_).toString());
105
+ if (a(v)) try {
106
+ l = JSON.parse(o(v).toString());
106
107
  } catch (e) {
107
- this.error(`Failed to parse manifest.json at ${_}: ${e.message}\nPlease ensure manifest.json contains a valid JSON object.`);
108
+ this.error(`Failed to parse manifest.json at ${v}: ${e.message}\nPlease ensure manifest.json contains a valid JSON object.`);
108
109
  }
109
110
  l.entrypoint = c.fileName, this.emitFile({
110
111
  type: "asset",
111
- fileName: g,
112
+ fileName: _,
112
113
  source: JSON.stringify(l, null, 2)
113
114
  });
114
115
  }
@@ -116,32 +117,32 @@ function v(e) {
116
117
  }
117
118
  //#endregion
118
119
  //#region src/utils.ts
119
- function y(e, t) {
120
+ function b(e, t) {
120
121
  let n = { ...e };
121
122
  for (let r of Object.keys(t)) {
122
123
  let i = e[r], a = t[r];
123
- a && typeof a == "object" && !Array.isArray(a) && i && typeof i == "object" && !Array.isArray(i) ? n[r] = y(i, a) : n[r] = a;
124
+ a && typeof a == "object" && !Array.isArray(a) && i && typeof i == "object" && !Array.isArray(i) ? n[r] = b(i, a) : n[r] = a;
124
125
  }
125
126
  return n;
126
127
  }
127
128
  //#endregion
128
129
  //#region src/index.ts
129
- var b = process.env.OPENCLOUD_EXTENSION_DIST_DIR || "dist", x = process.env.OPENCLOUD_CERTS_DIR, S = x ? {
130
- key: a(n(x, "server.key")),
131
- cert: a(n(x, "server.crt"))
132
- } : null, C = n("./src/", "config.json"), w = "remoteEntry", T = ".mjs";
133
- function E(o = {}) {
134
- return ({ mode: d }) => {
135
- let f = d === "production", m = d === "test", g = JSON.parse(a(n(t(r()), "package.json")).toString()), x = o.name || g.name, { port: E = 9210 } = o?.server || {}, D = o?.opencloudWebHostUrl || process.env.OPENCLOUD_WEB_HOST_URL || "https://host.docker.internal:9201";
136
- function O() {
130
+ var x = process.env.OPENCLOUD_EXTENSION_DIST_DIR || "dist", S = process.env.OPENCLOUD_CERTS_DIR, C = S ? {
131
+ key: o(n(S, "server.key")),
132
+ cert: o(n(S, "server.crt"))
133
+ } : null, w = n("./src/", "config.json"), T = "remoteEntry", E = ".mjs";
134
+ function D(s = {}) {
135
+ return ({ mode: f }) => {
136
+ let p = f === "production", h = f === "test", _ = JSON.parse(o(n(t(i()), "package.json")).toString()), S = s.name || _.name, { port: D = 9210 } = s?.server || {}, O = s?.opencloudWebHostUrl || process.env.OPENCLOUD_WEB_HOST_URL || "https://host.docker.internal:9201";
137
+ function k() {
137
138
  let e = {};
138
- if (i(_)) try {
139
- let t = JSON.parse(a(_).toString());
139
+ if (a(v)) try {
140
+ let t = JSON.parse(o(v).toString());
140
141
  t.config && (e = t.config);
141
142
  } catch {}
142
- if (i(C)) try {
143
- let t = JSON.parse(a(C).toString());
144
- e = y(e, t);
143
+ if (a(w)) try {
144
+ let t = JSON.parse(o(w).toString());
145
+ e = b(e, t);
145
146
  } catch {}
146
147
  return Object.keys(e).length > 0 ? e : void 0;
147
148
  }
@@ -149,22 +150,22 @@ function E(o = {}) {
149
150
  base: "./",
150
151
  build: {
151
152
  cssCodeSplit: !0,
152
- minify: f,
153
- outDir: b,
153
+ minify: p,
154
+ outDir: x,
154
155
  rollupOptions: {
155
- input: { [x]: "./src/index.ts" },
156
+ input: { [S]: "./src/index.ts" },
156
157
  output: {
157
- entryFileNames: n("js", `[name]${f ? "-[hash]" : ""}${T}`),
158
- chunkFileNames: n("js", `[name]-[hash]${T}`)
158
+ entryFileNames: r.join("js", `[name]${p ? "-[hash]" : ""}${E}`),
159
+ chunkFileNames: r.join("js", `[name]-[hash]${E}`)
159
160
  }
160
161
  }
161
162
  },
162
163
  plugins: [
163
- l({
164
+ u({
164
165
  customElement: !1,
165
- ...m && { template: { compilerOptions: { whitespace: "preserve" } } }
166
+ ...h && { template: { compilerOptions: { whitespace: "preserve" } } }
166
167
  }),
167
- ...S ? [] : [c({ name: "opencloud" })],
168
+ ...C ? [] : [l({ name: "opencloud" })],
168
169
  {
169
170
  name: "fix-sec-fetch-dest",
170
171
  configureServer(e) {
@@ -173,33 +174,33 @@ function E(o = {}) {
173
174
  });
174
175
  }
175
176
  },
176
- ...m ? [] : [u({
177
- name: x,
177
+ ...h ? [] : [d({
178
+ name: S,
178
179
  exposes: { ".": "./src/index.ts" },
179
- filename: `${w}${f ? "-[hash]" : ""}${T}`,
180
- shared: Object.fromEntries(p.map((e) => [e, {
180
+ filename: `${T}${p ? "-[hash]" : ""}${E}`,
181
+ shared: Object.fromEntries(m.map((e) => [e, {
181
182
  singleton: !0,
182
183
  import: !1
183
184
  }])),
184
185
  manifest: !1,
185
186
  dts: !1
186
187
  })],
187
- s(),
188
- v(w),
189
- h({
190
- hostUrl: D,
191
- name: x,
192
- entryPoint: `${w}${T}`,
193
- getMetadata: O,
194
- metadataWatchFiles: [_, C]
188
+ c(),
189
+ y(T),
190
+ g({
191
+ hostUrl: O,
192
+ name: S,
193
+ entryPoint: `${T}${E}`,
194
+ getMetadata: k,
195
+ metadataWatchFiles: [v, w]
195
196
  })
196
197
  ],
197
198
  server: {
198
- origin: `https://host.docker.internal:${E}`,
199
+ origin: `https://host.docker.internal:${D}`,
199
200
  host: "host.docker.internal",
200
- port: E,
201
+ port: D,
201
202
  cors: !0,
202
- ...S && { https: S }
203
+ ...C && { https: C }
203
204
  },
204
205
  test: {
205
206
  globals: !0,
@@ -221,8 +222,8 @@ function E(o = {}) {
221
222
  reporter: "lcov"
222
223
  }
223
224
  }
224
- }, o);
225
+ }, s);
225
226
  };
226
227
  }
227
228
  //#endregion
228
- export { E as defineConfig };
229
+ export { D as defineConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencloud-eu/extension-sdk",
3
- "version": "6.2.0",
3
+ "version": "7.0.0",
4
4
  "description": "OpenCloud Web Extension SDK",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "dist/extension-sdk.js",
@@ -25,7 +25,7 @@
25
25
  "./tailwind.css": "./dist/tailwind.css"
26
26
  },
27
27
  "dependencies": {
28
- "@module-federation/vite": "^1.13.5",
28
+ "@module-federation/vite": "1.15.4",
29
29
  "@tailwindcss/vite": "^4.2.2",
30
30
  "@vitejs/plugin-basic-ssl": "^2.3.0",
31
31
  "@vitejs/plugin-vue": "^6.0.5"