@prozilla-os/dev-tools 1.0.6 → 1.1.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/dist/main.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
-
3
1
  import { FC } from 'react';
4
2
  import { JSX as JSX_2 } from 'react/jsx-runtime';
5
3
  import { Plugin as Plugin_2 } from 'rollup';
4
+ import { Plugin as Plugin_3 } from 'vite';
6
5
  import { UserConfig } from 'vite';
7
6
 
8
7
  /**
@@ -55,8 +54,17 @@ declare class App<AppProps extends WindowProps = WindowProps> {
55
54
  * @default false
56
55
  */
57
56
  launchAtStartup: boolean;
57
+ /**
58
+ * The category the app belongs to
59
+ */
60
+ category: typeof APP_CATEGORIES[number] | null;
61
+ /**
62
+ * Metadata of the app's package
63
+ */
64
+ metadata: AppMetadata | null;
58
65
  isActive: boolean;
59
66
  isPinned?: boolean;
67
+ isInstalled: boolean;
60
68
  constructor(name: App["name"], id: App["id"], windowContent: App<AppProps>["windowContent"], windowOptions?: App["windowOptions"]);
61
69
  WindowContent: (props: AppProps) => JSX_2.Element | null;
62
70
  /**
@@ -87,20 +95,47 @@ declare class App<AppProps extends WindowProps = WindowProps> {
87
95
  * Changes whether this application is launched at startup or not
88
96
  */
89
97
  setLaunchAtStartup(launchAtStartup: boolean): this;
98
+ /**
99
+ * Changes whether this application is installed by default or not
100
+ */
101
+ setInstalled(installed: boolean): this;
102
+ /**
103
+ * Changes the category this application belongs to
104
+ */
105
+ setCategory(category: typeof APP_CATEGORIES[number] | null): this;
106
+ setMetadata(metadata: AppMetadata | null): this;
107
+ }
108
+
109
+ declare const APP_CATEGORIES: readonly ["Business", "Developer tools", "Education", "Entertainment", "Food & dining", "Health & fitness", "Kids & family", "Lifestyle", "Media", "Medical", "Multimedia design", "Music", "Navigation & maps", "News & weather", "Personal finance", "Personalization", "Photo & video", "Productivity", "Security", "Shopping", "Social", "Sports", "Travel", "Utilities & tools"];
110
+
111
+ declare interface AppMetadata {
112
+ name: string;
113
+ version: `${number}.${number}.${number}`;
114
+ author: string;
115
+ }
116
+
117
+ export declare function appMetadataPlugin({ entryPath }: AppMetadataPluginOptions): Plugin_3;
118
+
119
+ declare interface AppMetadataPluginOptions {
120
+ entryPath: string;
90
121
  }
91
122
 
92
123
  declare class AppsConfig {
93
124
  apps: AppsConfigOptions["apps"];
94
125
  static APP_ROLES: {
95
- FileExplorer: string;
96
- Terminal: string;
97
- TextEditor: string;
98
- Settings: string;
99
- MediaViewer: string;
100
- Browser: string;
126
+ fileExplorer: string;
127
+ terminal: string;
128
+ textEditor: string;
129
+ settings: string;
130
+ mediaViewer: string;
131
+ browser: string;
101
132
  };
102
133
  constructor(options?: OptionalInterface<AppsConfigOptions>);
103
- getAppById(id: string): App | null;
134
+ get installedApps(): App<any>[];
135
+ /**
136
+ * @param includeUninstalled Include apps that are not currently installed
137
+ */
138
+ getAppById(id: string, includeUninstalled?: boolean): App | null;
104
139
  /**
105
140
  * Get the app associated with a file extension
106
141
  */
@@ -109,6 +144,10 @@ declare class AppsConfig {
109
144
  * Get the app with a specific role
110
145
  */
111
146
  getAppByRole(role: string): App | null;
147
+ /**
148
+ * Get all applications (including uninstalled apps) that belong to a category
149
+ */
150
+ getAppsByCategory(category: typeof APP_CATEGORIES[number]): App[];
112
151
  }
113
152
 
114
153
  declare interface AppsConfigOptions {
@@ -131,11 +170,15 @@ declare type OptionalInterface<Interface> = {
131
170
  [Property in keyof Interface]?: Interface[Property];
132
171
  };
133
172
 
134
- declare function print_2(message: string, status?: status_2, newLine?: boolean): void;
173
+ declare function print_2(message: string, status?: Status, newLine?: boolean): void;
135
174
  export { print_2 as print }
136
175
 
137
176
  export declare interface StageOptions {
138
177
  appsConfig: AppsConfig;
178
+ /**
179
+ * Favicon of the website
180
+ */
181
+ favicon: string;
139
182
  /**
140
183
  * Name of the website
141
184
  * @example "ProzillaOS"
@@ -161,8 +204,7 @@ export declare interface StageOptions {
161
204
 
162
205
  export declare function stageSitePlugin(options: StageOptions): Plugin_2;
163
206
 
164
- declare type status_2 = "error" | "info" | "file" | "success" | "start";
165
- export { status_2 as status }
207
+ export declare type Status = "error" | "info" | "file" | "success" | "start";
166
208
 
167
209
  declare class Vector2 {
168
210
  x: number;
@@ -197,14 +239,14 @@ declare interface WindowOptions {
197
239
 
198
240
  declare interface WindowProps extends WindowOptions {
199
241
  fullscreen?: boolean;
200
- onInteract?: Function;
242
+ onInteract?: () => void;
201
243
  setTitle?: React.Dispatch<React.SetStateAction<string>>;
202
244
  setIconUrl?: React.Dispatch<React.SetStateAction<string>>;
203
245
  close?: (event?: Event) => void;
204
246
  focus?: (event: Event, force?: boolean) => void;
205
247
  active?: boolean;
206
248
  minimized?: boolean;
207
- toggleMinimized?: Function;
249
+ toggleMinimized?: (event?: Event) => void;
208
250
  index?: number;
209
251
  standalone?: boolean;
210
252
  }
package/dist/main.js CHANGED
@@ -1,53 +1,24 @@
1
- import b from "@vitejs/plugin-react-swc";
2
- import w from "vite-plugin-dts";
3
- import A from "vite-plugin-css-injected-by-js";
4
- import { resolve as S, sep as h, posix as F } from "path";
5
- import { ANSI as m } from "@prozilla-os/shared";
6
- const P = (e, t) => {
7
- let o = S(e, t);
8
- return h === "\\" && (o = o.split(h).join(F.sep)), console.log("Using Vite config for app"), console.log("Entry: " + o), {
9
- plugins: [
10
- b(),
11
- A(),
12
- w({
13
- outDir: "dist",
14
- rollupTypes: !0,
15
- strictOutput: !0,
16
- pathsToAliases: !1,
17
- tsconfigPath: "tsconfig.build.json"
18
- })
19
- ],
20
- build: {
21
- lib: {
22
- entry: o,
23
- formats: ["es"]
24
- },
25
- rollupOptions: {
26
- external: ["react", "react/jsx-runtime", "@prozilla-os/core", "@prozilla-os/shared", /@fortawesome\/*/g],
27
- output: {
28
- assetFileNames: "assets/[name][extname]",
29
- entryFileNames: "[name].js"
30
- }
31
- },
32
- sourcemap: !0
33
- }
34
- };
35
- };
36
- function x(e, t, o) {
1
+ import S from "@vitejs/plugin-react-swc";
2
+ import F from "vite-plugin-dts";
3
+ import U from "vite-plugin-css-injected-by-js";
4
+ import { resolve as w, sep as x, posix as j } from "path";
5
+ import { ANSI as f } from "@prozilla-os/shared";
6
+ import { readFileSync as y } from "fs";
7
+ function h(e, t, o) {
37
8
  if (o && console.log(""), t == null)
38
9
  return console.log(e);
39
10
  switch (t) {
40
11
  case "start":
41
- console.log(`${m.fg.yellow}${e}...${m.reset}`);
12
+ console.log(`${f.fg.yellow}${e}...${f.reset}`);
42
13
  break;
43
14
  case "file":
44
- console.log(`- ${m.fg.cyan}${e}${m.reset}`);
15
+ console.log(`- ${f.fg.cyan}${e}${f.reset}`);
45
16
  break;
46
17
  case "success":
47
- console.log(`${m.fg.green}✓ ${e}${m.reset}`);
18
+ console.log(`${f.fg.green}✓ ${e}${f.reset}`);
48
19
  break;
49
20
  case "error":
50
- console.error(`${m.fg.red}⚠ ${e}${m.reset}`);
21
+ console.error(`${f.fg.red}⚠ ${e}${f.reset}`);
51
22
  break;
52
23
  default:
53
24
  console.log(e);
@@ -58,33 +29,33 @@ function $(e) {
58
29
  return e.replace(/\r\n/g, `
59
30
  `);
60
31
  }
61
- function N(e) {
62
- const { imageUrls: t, appsConfig: o, baseUrl: a } = e, i = /* @__PURE__ */ new Date(), c = i.getFullYear(), g = i.getMonth() + 1, n = i.getDate(), r = g >= 10 ? g.toString() : "0" + g, u = n >= 10 ? n.toString() : "0" + n, p = `${c}-${r}-${u}`, s = t.map(
32
+ function C(e) {
33
+ const { imageUrls: t, appsConfig: o, baseUrl: c } = e, r = /* @__PURE__ */ new Date(), g = r.getFullYear(), p = r.getMonth() + 1, a = r.getDate(), s = p >= 10 ? p.toString() : "0" + p, i = a >= 10 ? a.toString() : "0" + a, m = `${g}-${s}-${i}`, l = t.map(
63
34
  (d) => `
64
35
  <image:image>
65
- <image:loc>${a.slice(0, -1) + d}</image:loc>
36
+ <image:loc>${c.slice(0, -1) + d}</image:loc>
66
37
  </image:image>`
67
- ), l = o.apps.map(
38
+ ), u = o.apps.map(
68
39
  ({ id: d }) => `
69
40
  <url>
70
- <loc>${a + d}</loc>
71
- <lastmod>${p}</lastmod>
41
+ <loc>${c + d}</loc>
42
+ <lastmod>${m}</lastmod>
72
43
  </url>`
73
- ), f = `
44
+ ), n = `
74
45
  <?xml version="1.0" encoding="UTF-8"?>
75
46
  <!DOCTYPE xml>
76
47
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
77
48
  xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
78
49
  <url>
79
- <loc>${a}</loc>
80
- <lastmod>${p}</lastmod>
81
- ${s.join("")}
50
+ <loc>${c}</loc>
51
+ <lastmod>${m}</lastmod>
52
+ ${l.join("")}
82
53
  </url>
83
- ${l.join("")}
54
+ ${u.join("")}
84
55
  </urlset>`;
85
- return $(f.trim());
56
+ return $(n.trim());
86
57
  }
87
- function U(e) {
58
+ function R(e) {
88
59
  const { baseUrl: t } = e;
89
60
  return $(`# https://www.robotstxt.org/robotstxt.html
90
61
  User-agent: *
@@ -94,97 +65,173 @@ Sitemap: ${t}sitemap.xml`);
94
65
  function z(e) {
95
66
  return e.domain;
96
67
  }
97
- function T(e, t) {
98
- const { baseUrl: o } = t, a = new RegExp('(?<=")https?:\\/\\/[a-z0-9-]+(\\.)([a-zA-Z0-9-]+(\\.))*[a-z]{2,3}\\/(?=.*")', "gi");
99
- e = e.replaceAll(a, o);
100
- const i = /<!--.*?-->/g;
101
- e = e.replaceAll(i, "");
102
- const c = /^\s*$\n/gm;
103
- return e = e.replaceAll(c, ""), $(e);
68
+ function D(e, t) {
69
+ const { baseUrl: o } = t, c = new RegExp('(?<=")https?:\\/\\/[a-z0-9-]+(\\.)([a-zA-Z0-9-]+(\\.))*[a-z]{2,3}\\/(?=.*")', "gi");
70
+ e = e.replaceAll(c, o);
71
+ const r = /<!--.*?-->/g;
72
+ e = e.replaceAll(r, "");
73
+ const g = /^\s*$\n/gm;
74
+ return e = e.replaceAll(g, ""), $(e);
104
75
  }
105
- function j(e, t) {
76
+ function I(e, t) {
106
77
  e.emitFile({
107
78
  type: "asset",
108
79
  fileName: "404.html",
109
80
  source: t
110
81
  });
111
82
  }
112
- function R(e, t, o) {
113
- const { appsConfig: a, siteName: i, siteTagLine: c, baseUrl: g } = o;
114
- for (const n of a.apps) {
115
- const r = n.id, u = n.name, p = n.description ?? c;
116
- if (r === "index") {
117
- x("Invalid app ID found: " + r, "error");
83
+ function T(e, t, o) {
84
+ const { appsConfig: c, favicon: r, siteName: g, siteTagLine: p, baseUrl: a } = o;
85
+ for (const s of c.apps) {
86
+ const i = s.id, m = s.name, l = s.description ?? p, u = s.iconUrl ?? r;
87
+ if (i === "index") {
88
+ h("Invalid app ID found: " + i, "error");
118
89
  return;
119
90
  }
120
- let s = t;
121
- const l = new RegExp('(?<=(<title>|<meta property="og:title" content="|<meta name="twitter:title" content="))(([a-zA-Z|-]|\\s)+)(?=(<\\/title>|"\\/?>))', "g");
122
- s = s.replaceAll(l, `${u} | ${i}`);
123
- const f = new RegExp('(?<=(<meta name="description" content="|<meta property="og:description" content="|<meta name="twitter:description" content="))(([a-zA-Z-.]|\\s)+)(?=("\\/?>))', "g");
124
- s = s.replaceAll(f, p);
125
- const d = new RegExp('(?<=(<link rel="canonical" href="|<meta name="twitter:url" content="|<meta property="og:url" content="))(http(s)?:\\/\\/[a-zA-Z-.]+\\/)(?=("\\/?>))', "g");
126
- s = s.replaceAll(d, g + r);
127
- const y = /(<!-- FAQ -->.*?)?<script type="application\/ld\+json">.*?<\/script>/gs;
128
- s = s.replaceAll(y, ""), e.emitFile({
91
+ let n = t;
92
+ const d = new RegExp('(?<=(<title>|<meta property="og:title" content="|<meta name="twitter:title" content="))(([a-zA-Z|-]|\\s)+)(?=(<\\/title>|"\\/?>))', "g");
93
+ n = n.replaceAll(d, `${m} | ${g}`);
94
+ const b = new RegExp('(?<=(<meta name="description" content="|<meta property="og:description" content="|<meta name="twitter:description" content="))(([a-zA-Z-.]|\\s)+)(?=("\\/?>))', "g");
95
+ n = n.replaceAll(b, l);
96
+ const A = new RegExp('(?<=(<link rel="canonical" href="|<meta name="twitter:url" content="|<meta property="og:url" content="))(http(s)?:\\/\\/[a-zA-Z-.]+\\/)(?=("\\/?>))', "g");
97
+ n = n.replaceAll(A, a + i);
98
+ const N = new RegExp('(?<=<link [^>]*rel="icon" [^>]*href=")[^"]+(?="[^>]*>)', "g");
99
+ n = n.replaceAll(N, `${u}?x=${Math.round(Date.now() / 36e5)}`);
100
+ const k = /(<!-- FAQ -->.*?)?<script type="application\/ld\+json">.*?<\/script>/gs;
101
+ n = n.replaceAll(k, ""), e.emitFile({
129
102
  type: "asset",
130
- fileName: `${r}.html`,
131
- source: s
103
+ fileName: `${i}.html`,
104
+ source: n
132
105
  });
133
106
  }
134
107
  }
135
- function D(e, t, { appsConfig: o, siteName: a, siteTagLine: i, domain: c, imageUrls: g = [] }) {
108
+ function v(e, t, { appsConfig: o, favicon: c, siteName: r, siteTagLine: g, domain: p, imageUrls: a = [] }) {
136
109
  try {
137
- x("Staging build...", "start", !0);
138
- const n = `https://${c}/`, r = {
110
+ h("Staging build...", "start", !0);
111
+ const s = `https://${p}/`, i = {
139
112
  sitemapXml: "sitemap.xml",
140
113
  robotsTxt: "robots.txt",
141
114
  indexHtml: "index.html",
142
115
  cname: "CNAME"
143
- }, u = [
144
- [r.sitemapXml, N],
145
- [r.robotsTxt, U],
146
- [r.cname, z]
147
- ], p = {
116
+ }, m = [
117
+ [i.sitemapXml, C],
118
+ [i.robotsTxt, R],
119
+ [i.cname, z]
120
+ ], l = {
148
121
  appsConfig: o,
149
- siteName: a,
150
- siteTagLine: i,
151
- domain: c,
152
- baseUrl: n,
153
- imageUrls: g,
154
- paths: r
122
+ favicon: c,
123
+ siteName: r,
124
+ siteTagLine: g,
125
+ domain: p,
126
+ baseUrl: s,
127
+ imageUrls: a,
128
+ paths: i
155
129
  };
156
- u.forEach(([l, f]) => {
130
+ m.forEach(([n, d]) => {
157
131
  e.emitFile({
158
132
  type: "asset",
159
- fileName: l,
160
- source: f(p)
133
+ fileName: n,
134
+ source: d(l)
161
135
  });
162
136
  });
163
- const s = t["index.html"];
164
- if (s && s.type == "asset") {
165
- const l = T(s.source, p);
137
+ const u = t["index.html"];
138
+ if (u && u.type == "asset") {
139
+ const n = D(u.source, l);
166
140
  e.emitFile({
167
141
  type: "asset",
168
142
  fileName: "index.html",
169
- source: l
170
- }), j(e, l), R(e, l, p);
143
+ source: n
144
+ }), I(e, n), T(e, n, l);
171
145
  }
172
- x("Staging complete", "success", !0);
173
- } catch (n) {
174
- console.error(n), x("Staging failed", "error"), process.exit(1);
146
+ h("Staging complete", "success", !0);
147
+ } catch (s) {
148
+ console.error(s), h("Staging failed", "error"), process.exit(1);
175
149
  }
176
150
  }
177
- function v(e) {
151
+ function X(e) {
178
152
  return {
179
153
  name: "vite-plugin-stage-site",
180
154
  generateBundle(t, o) {
181
- D(this, o, e);
155
+ v(this, o, e);
156
+ }
157
+ };
158
+ }
159
+ function M({ entryPath: e }) {
160
+ return {
161
+ name: "vite-plugin-app-metadata",
162
+ apply: "build",
163
+ load(t) {
164
+ if (!t.includes(e)) return null;
165
+ const o = process.cwd(), c = w(o, "package.json");
166
+ let r = null;
167
+ try {
168
+ const l = y(c, "utf-8");
169
+ r = JSON.parse(l);
170
+ } catch (l) {
171
+ this.error(l);
172
+ }
173
+ if (!r)
174
+ return null;
175
+ const { name: g, version: p } = r;
176
+ let { author: a = "Unknown" } = r;
177
+ typeof a == "string" ? a = a.replace(/<[^>]*>|\([^)]*\)/g, "").trim() : a = a.name;
178
+ let s = null;
179
+ try {
180
+ s = y(t, "utf-8");
181
+ } catch (l) {
182
+ this.error(l);
183
+ }
184
+ if (s == null)
185
+ return null;
186
+ const i = /const\s+(\w+)\s*=\s*new\s+App(?:<[\w\s,]+>)?\s*\(([^;]*)\)\s*(\.[\w]+\([^)]*\)\s*)*;/, m = s.match(i);
187
+ if (m) {
188
+ const u = `
189
+ ${m[1]}.setMetadata({ name: "${g}", version: "${p}", author: "${a}" });
190
+ `;
191
+ return s.replace(i, m[0] + u);
192
+ } else
193
+ return this.warn("No App instance found in the entry file."), null;
182
194
  }
183
195
  };
184
196
  }
197
+ const B = (e, t) => {
198
+ let o = w(e, t);
199
+ return x === "\\" && (o = o.split(x).join(j.sep)), console.log("Using Vite config for app"), console.log("Entry: " + o), {
200
+ plugins: [
201
+ M({
202
+ entryPath: t
203
+ }),
204
+ S(),
205
+ U(),
206
+ F({
207
+ outDir: "dist",
208
+ rollupTypes: !0,
209
+ strictOutput: !0,
210
+ pathsToAliases: !1,
211
+ tsconfigPath: "tsconfig.build.json"
212
+ })
213
+ ],
214
+ build: {
215
+ lib: {
216
+ entry: o,
217
+ formats: ["es"]
218
+ },
219
+ rollupOptions: {
220
+ external: ["react", "react/jsx-runtime", "@prozilla-os/core", "@prozilla-os/shared", /@fortawesome\/*/g],
221
+ output: {
222
+ assetFileNames: "assets/[name][extname]",
223
+ chunkFileNames: "chunks/[name]-[hash].js",
224
+ entryFileNames: "[name].js"
225
+ }
226
+ },
227
+ sourcemap: !0
228
+ }
229
+ };
230
+ };
185
231
  export {
186
- P as appViteConfig,
187
- x as print,
188
- v as stageSitePlugin
232
+ M as appMetadataPlugin,
233
+ B as appViteConfig,
234
+ h as print,
235
+ X as stageSitePlugin
189
236
  };
190
237
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sources":["../src/configs/app.vite.config.ts","../src/features/console.ts","../src/plugins/stageSite.ts"],"sourcesContent":["import { UserConfig } from \"vite\";\r\nimport react from \"@vitejs/plugin-react-swc\";\r\nimport dts from \"vite-plugin-dts\";\r\nimport cssInjectedByJs from \"vite-plugin-css-injected-by-js\";\r\nimport { posix, resolve, sep } from \"path\";\r\n\r\n/**\r\n * Helper function for creating Vite configurations for ProzillaOS apps\r\n * @param basePath - Path of base directory\r\n * @param entryPath - Path of library entry\r\n * @returns Vite configuration\r\n * @see https://vitejs.dev/config/\r\n */\r\nexport const appViteConfig = (basePath: string, entryPath: string): UserConfig => {\r\n\tlet entryFile = resolve(basePath, entryPath);\r\n\r\n\t// Normalize paths for Windows compatibility\r\n\tif (sep === \"\\\\\")\r\n\t\tentryFile = entryFile.split(sep).join(posix.sep);\r\n\r\n\tconsole.log(\"Using Vite config for app\");\r\n\tconsole.log(\"Entry: \" + entryFile);\r\n\r\n\treturn {\r\n\t\tplugins: [\r\n\t\t\treact(),\r\n\t\t\tcssInjectedByJs(),\r\n\t\t\tdts({\r\n\t\t\t\toutDir: \"dist\",\r\n\t\t\t\trollupTypes: true,\r\n\t\t\t\tstrictOutput: true,\r\n\t\t\t\tpathsToAliases: false,\r\n\t\t\t\ttsconfigPath: \"tsconfig.build.json\"\r\n\t\t\t})\r\n\t\t],\r\n\t\tbuild: {\r\n\t\t\tlib: {\r\n\t\t\t\tentry: entryFile,\r\n\t\t\t\tformats: [\"es\"],\r\n\t\t\t},\r\n\t\t\trollupOptions: {\r\n\t\t\t\texternal: [\"react\", \"react/jsx-runtime\", \"@prozilla-os/core\", \"@prozilla-os/shared\", /@fortawesome\\/*/g],\r\n\t\t\t\toutput: {\r\n\t\t\t\t\tassetFileNames: \"assets/[name][extname]\",\r\n\t\t\t\t\tentryFileNames: \"[name].js\",\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tsourcemap: true\r\n\t\t}\r\n\t};\r\n};","import { ANSI } from \"@prozilla-os/shared\";\r\n\r\nexport type status = \"error\" | \"info\" | \"file\" | \"success\" | \"start\";\r\n\r\nexport function print(message: string, status?: status, newLine?: boolean) {\r\n\tif (newLine)\r\n\t\tconsole.log(\"\");\r\n\r\n\tif (status == null)\r\n\t\treturn console.log(message);\r\n\r\n\tswitch (status) {\r\n\t\tcase \"start\":\r\n\t\t\tconsole.log(`${ANSI.fg.yellow}${message}...${ANSI.reset}`);\r\n\t\t\tbreak;\r\n\t\tcase \"file\":\r\n\t\t\tconsole.log(`- ${ANSI.fg.cyan}${message}${ANSI.reset}`);\r\n\t\t\tbreak;\r\n\t\tcase \"success\":\r\n\t\t\tconsole.log(`${ANSI.fg.green}✓ ${message}${ANSI.reset}`);\r\n\t\t\tbreak;\r\n\t\tcase \"error\":\r\n\t\t\tconsole.error(`${ANSI.fg.red}⚠ ${message}${ANSI.reset}`);\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tconsole.log(message);\r\n\t\t\tbreak;\r\n\t}\r\n}","import type { AppsConfig } from \"@prozilla-os/core\";\r\nimport { print } from \"../features/console\";\r\nimport type { OutputBundle, PluginContext, Plugin } from \"rollup\";\r\n\r\nexport interface StageOptions {\r\n\tappsConfig: AppsConfig;\r\n\r\n\t/**\r\n\t * Name of the website \r\n\t * @example \"ProzillaOS\"\r\n\t */\r\n\tsiteName: string;\r\n\r\n\t/**\r\n\t * Tag line of the website\r\n\t * @example \"Web-based Operating System\"\r\n\t*/\r\n\tsiteTagLine: string;\r\n\r\n\t/**\r\n\t * Domain of the live website\r\n\t * \r\n\t * A CNAME file will be generated with this value\r\n\t * @example \"os.prozilla.dev\"\r\n\t */\r\n\tdomain: string;\r\n\r\n\t/**\r\n\t * Array of image URLs that will be added to the sitemap\r\n\t */\r\n\timageUrls?: string[];\r\n}\r\n\r\ninterface StageOptionsExtended extends StageOptions {\r\n\timageUrls: string[];\r\n\tbaseUrl: string;\r\n\tpaths: FilePaths;\r\n}\r\n\r\ninterface FilePaths {\r\n\tsitemapXml: string;\r\n\trobotsTxt: string;\r\n\tindexHtml: string;\r\n\tcname: string;\r\n}\r\n\r\nfunction normalizeLineEndings(text: string) {\r\n\treturn text.replace(/\\r\\n/g, \"\\n\");\r\n}\r\n\r\nfunction generateSitemapXml(options: StageOptionsExtended) {\r\n\tconst { imageUrls, appsConfig, baseUrl } = options;\r\n\r\n\tconst date = new Date();\r\n\r\n\tconst year = date.getFullYear();\r\n\tconst month = date.getMonth() + 1;\r\n\tconst day = date.getDate();\r\n\r\n\tconst monthString = month >= 10 ? month.toString() : \"0\" + month;\r\n\tconst dayString = day >= 10 ? day.toString() : \"0\" + day;\r\n\r\n\tconst lastModified = `${year}-${monthString}-${dayString}`;\r\n\r\n\tconst images = imageUrls.map((path) => `\r\n\t\t<image:image>\r\n\t\t\t<image:loc>${baseUrl.slice(0, -1) + path}</image:loc>\r\n\t\t</image:image>`\r\n\t);\r\n\r\n\tconst pages = appsConfig.apps.map(({ id }) => `\r\n\t<url>\r\n\t\t<loc>${baseUrl + id}</loc>\r\n\t\t<lastmod>${lastModified}</lastmod>\r\n\t</url>`\r\n\t);\r\n\r\n\tconst sitemap = `\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!DOCTYPE xml>\r\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\r\n\txmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\">\r\n\t<url>\r\n\t\t<loc>${baseUrl}</loc>\r\n\t\t<lastmod>${lastModified}</lastmod>\r\n\t\t${images.join(\"\")}\r\n\t</url>\r\n\t${pages.join(\"\")}\r\n</urlset>`;\r\n\r\n\treturn normalizeLineEndings(sitemap.trim());\r\n}\r\n\r\nfunction generateRobotsTxt(options: StageOptionsExtended) {\r\n\tconst { baseUrl } = options;\r\n\r\n\treturn normalizeLineEndings(`# https://www.robotstxt.org/robotstxt.html\r\nUser-agent: *\r\nDisallow:\r\nSitemap: ${baseUrl}sitemap.xml`);\r\n}\r\n\r\nfunction generateCname(options: StageOptionsExtended) {\r\n\treturn options.domain;\r\n}\r\n\r\nfunction generateTemplate(html: string, options: StageOptionsExtended) {\r\n\tconst { baseUrl } = options;\r\n\r\n\tconst baseUrlRegex = /(?<=\")https?:\\/\\/[a-z0-9-]+(\\.)([a-zA-Z0-9-]+(\\.))*[a-z]{2,3}\\/(?=.*\")/gi;\r\n\thtml = html.replaceAll(baseUrlRegex, baseUrl);\r\n\r\n\tconst commentsRegex = /<!--.*?-->/g;\r\n\thtml = html.replaceAll(commentsRegex, \"\");\r\n\r\n\tconst emptyLinesRegex = /^\\s*$\\n/gm;\r\n\thtml = html.replaceAll(emptyLinesRegex, \"\");\r\n\r\n\treturn normalizeLineEndings(html);\r\n}\r\n\r\n/**\r\n * To avoid GitHub pages rendering certain pages that are only defined by React router as a 404 page,\r\n * we copy the content of our index file to the 404 page, letting React router properly handle routing on every page \r\n */\r\nfunction generate404Page(context: PluginContext, template: string) {\r\n\tcontext.emitFile({\r\n\t\ttype: \"asset\",\r\n\t\tfileName: \"404.html\",\r\n\t\tsource: template\r\n\t});\r\n}\r\n\r\n/**\r\n * Add an HTML file for every app page so they can be properly crawled and indexed\r\n */\r\nfunction generateAppPages(context: PluginContext, template: string, options: StageOptionsExtended) {\r\n\tconst { appsConfig, siteName, siteTagLine, baseUrl } = options;\r\n\r\n\tfor (const app of appsConfig.apps) {\r\n\t\tconst appId = app.id;\r\n\t\tconst appName = app.name;\r\n\t\tconst appDescription = app.description ?? siteTagLine;\r\n\r\n\t\tif (appId === \"index\") {\r\n\t\t\tprint(\"Invalid app ID found: \" + appId, \"error\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet html = template;\r\n\t\t\r\n\t\tconst titleRegex = /(?<=(<title>|<meta property=\"og:title\" content=\"|<meta name=\"twitter:title\" content=\"))(([a-zA-Z|-]|\\s)+)(?=(<\\/title>|\"\\/?>))/g;\r\n\t\thtml = html.replaceAll(titleRegex, `${appName} | ${siteName}`);\r\n\r\n\t\tconst descriptionRegex = /(?<=(<meta name=\"description\" content=\"|<meta property=\"og:description\" content=\"|<meta name=\"twitter:description\" content=\"))(([a-zA-Z-.]|\\s)+)(?=(\"\\/?>))/g;\r\n\t\thtml = html.replaceAll(descriptionRegex, appDescription);\r\n\r\n\t\tconst canonicalRegex = /(?<=(<link rel=\"canonical\" href=\"|<meta name=\"twitter:url\" content=\"|<meta property=\"og:url\" content=\"))(http(s)?:\\/\\/[a-zA-Z-.]+\\/)(?=(\"\\/?>))/g;\r\n\t\thtml = html.replaceAll(canonicalRegex, baseUrl + appId);\r\n\r\n\t\tconst faqRegex = /(<!-- FAQ -->.*?)?<script type=\"application\\/ld\\+json\">.*?<\\/script>/gs;\r\n\t\thtml = html.replaceAll(faqRegex, \"\");\r\n\r\n\t\tcontext.emitFile({\r\n\t\t\ttype: \"asset\",\r\n\t\t\tfileName: `${appId}.html`,\r\n\t\t\tsource: html\r\n\t\t});\r\n\t}\r\n}\r\n\r\nfunction stageSite(context: PluginContext, bundle: OutputBundle, { appsConfig, siteName, siteTagLine, domain, imageUrls = [] }: StageOptions) {\r\n\ttry {\r\n\t\tprint(\"Staging build...\", \"start\", true);\r\n\r\n\t\tconst baseUrl = `https://${domain}/`;\r\n\r\n\t\tconst paths: FilePaths = {\r\n\t\t\tsitemapXml: \"sitemap.xml\",\r\n\t\t\trobotsTxt: \"robots.txt\",\r\n\t\t\tindexHtml: \"index.html\",\r\n\t\t\tcname: \"CNAME\",\r\n\t\t};\r\n\t\r\n\t\tconst files: [string, (options: StageOptionsExtended) => string][] = [\r\n\t\t\t[paths.sitemapXml, generateSitemapXml],\r\n\t\t\t[paths.robotsTxt, generateRobotsTxt],\r\n\t\t\t[paths.cname, generateCname],\r\n\t\t];\r\n\r\n\t\tconst extendedOptions = {\r\n\t\t\tappsConfig,\r\n\t\t\tsiteName,\r\n\t\t\tsiteTagLine,\r\n\t\t\tdomain,\r\n\t\t\tbaseUrl,\r\n\t\t\timageUrls,\r\n\t\t\tpaths\r\n\t\t};\r\n\t\r\n\t\tfiles.forEach(([path, generateContent]) => {\r\n\t\t\tcontext.emitFile({\r\n\t\t\t\ttype: \"asset\",\r\n\t\t\t\tfileName: path,\r\n\t\t\t\tsource: generateContent(extendedOptions)\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\tconst html = bundle[\"index.html\"];\r\n\t\tif (html && html.type == \"asset\") {\r\n\t\t\tconst template = generateTemplate(html.source as string, extendedOptions);\r\n\r\n\t\t\tcontext.emitFile({\r\n\t\t\t\ttype: \"asset\",\r\n\t\t\t\tfileName: \"index.html\",\r\n\t\t\t\tsource: template \r\n\t\t\t});\r\n\t\r\n\t\t\tgenerate404Page(context, template);\r\n\t\t\tgenerateAppPages(context, template, extendedOptions);\r\n\t\t}\r\n\t\r\n\t\tprint(\"Staging complete\", \"success\", true);\r\n\t} catch (error) {\r\n\t\tconsole.error(error);\r\n\t\tprint(\"Staging failed\", \"error\");\r\n\t\tprocess.exit(1);\r\n\t}\r\n}\r\n\r\nexport function stageSitePlugin(options: StageOptions): Plugin {\r\n\treturn {\r\n\t\tname: \"vite-plugin-stage-site\",\r\n\t\tgenerateBundle(_outputOptions, bundle) {\r\n\t\t\tstageSite(this, bundle, options);\r\n\t\t},\r\n\t};\r\n}"],"names":["appViteConfig","basePath","entryPath","entryFile","resolve","sep","posix","react","cssInjectedByJs","dts","print","message","status","newLine","ANSI","normalizeLineEndings","text","generateSitemapXml","options","imageUrls","appsConfig","baseUrl","date","year","month","day","monthString","dayString","lastModified","images","path","pages","id","sitemap","generateRobotsTxt","generateCname","generateTemplate","html","baseUrlRegex","commentsRegex","emptyLinesRegex","generate404Page","context","template","generateAppPages","siteName","siteTagLine","app","appId","appName","appDescription","titleRegex","descriptionRegex","canonicalRegex","faqRegex","stageSite","bundle","domain","paths","files","extendedOptions","generateContent","error","stageSitePlugin","_outputOptions"],"mappings":";;;;;AAaa,MAAAA,IAAgB,CAACC,GAAkBC,MAAkC;AAC7E,MAAAC,IAAYC,EAAQH,GAAUC,CAAS;AAG3C,SAAIG,MAAQ,SACXF,IAAYA,EAAU,MAAME,CAAG,EAAE,KAAKC,EAAM,GAAG,IAEhD,QAAQ,IAAI,2BAA2B,GAC/B,QAAA,IAAI,YAAYH,CAAS,GAE1B;AAAA,IACN,SAAS;AAAA,MACRI,EAAM;AAAA,MACNC,EAAgB;AAAA,MAChBC,EAAI;AAAA,QACH,QAAQ;AAAA,QACR,aAAa;AAAA,QACb,cAAc;AAAA,QACd,gBAAgB;AAAA,QAChB,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,MACrC,CAACyC,EAAM,WAAWxB,CAAiB;AAAA,MACnC,CAACwB,EAAM,OAAOvB,CAAa;AAAA,IAAA,GAGtByB,IAAkB;AAAA,MACvB,YAAAxC;AAAA,MACA,UAAAyB;AAAA,MACA,aAAAC;AAAA,MACA,QAAAW;AAAA,MACA,SAAApC;AAAA,MACA,WAAAF;AAAA,MACA,OAAAuC;AAAA,IAAA;AAGD,IAAAC,EAAM,QAAQ,CAAC,CAAC7B,GAAM+B,CAAe,MAAM;AAC1C,MAAAnB,EAAQ,SAAS;AAAA,QAChB,MAAM;AAAA,QACN,UAAUZ;AAAA,QACV,QAAQ+B,EAAgBD,CAAe;AAAA,MAAA,CACvC;AAAA,IAAA,CACD;AAEK,UAAAvB,IAAOmB,EAAO,YAAY;AAC5B,QAAAnB,KAAQA,EAAK,QAAQ,SAAS;AACjC,YAAMM,IAAWP,EAAiBC,EAAK,QAAkBuB,CAAe;AAExE,MAAAlB,EAAQ,SAAS;AAAA,QAChB,MAAM;AAAA,QACN,UAAU;AAAA,QACV,QAAQC;AAAA,MAAA,CACR,GAEDF,EAAgBC,GAASC,CAAQ,GAChBC,EAAAF,GAASC,GAAUiB,CAAe;AAAA,IACpD;AAEM,IAAAlD,EAAA,oBAAoB,WAAW,EAAI;AAAA,WACjCoD,GAAO;AACf,YAAQ,MAAMA,CAAK,GACnBpD,EAAM,kBAAkB,OAAO,GAC/B,QAAQ,KAAK,CAAC;AAAA,EACf;AACD;AAEO,SAASqD,EAAgB7C,GAA+B;AACvD,SAAA;AAAA,IACN,MAAM;AAAA,IACN,eAAe8C,GAAgBR,GAAQ;AAC5B,MAAAD,EAAA,MAAMC,GAAQtC,CAAO;AAAA,IAChC;AAAA,EAAA;AAEF;"}
1
+ {"version":3,"file":"main.js","sources":["../src/features/console.ts","../src/plugins/stageSite.ts","../src/plugins/appMetadata.ts","../src/configs/app.vite.config.ts"],"sourcesContent":["import { ANSI } from \"@prozilla-os/shared\";\n\nexport type Status = \"error\" | \"info\" | \"file\" | \"success\" | \"start\";\n\nexport function print(message: string, status?: Status, newLine?: boolean) {\n\tif (newLine)\n\t\tconsole.log(\"\");\n\n\tif (status == null)\n\t\treturn console.log(message);\n\n\tswitch (status) {\n\t\tcase \"start\":\n\t\t\tconsole.log(`${ANSI.fg.yellow}${message}...${ANSI.reset}`);\n\t\t\tbreak;\n\t\tcase \"file\":\n\t\t\tconsole.log(`- ${ANSI.fg.cyan}${message}${ANSI.reset}`);\n\t\t\tbreak;\n\t\tcase \"success\":\n\t\t\tconsole.log(`${ANSI.fg.green}✓ ${message}${ANSI.reset}`);\n\t\t\tbreak;\n\t\tcase \"error\":\n\t\t\tconsole.error(`${ANSI.fg.red}⚠ ${message}${ANSI.reset}`);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tconsole.log(message);\n\t\t\tbreak;\n\t}\n}","import type { AppsConfig } from \"@prozilla-os/core\";\nimport type { OutputBundle, PluginContext, Plugin } from \"rollup\";\nimport { print } from \"../features\";\n\nexport interface StageOptions {\n\tappsConfig: AppsConfig;\n\n\t/**\n\t * Favicon of the website\n\t */\n\tfavicon: string;\n\n\t/**\n\t * Name of the website \n\t * @example \"ProzillaOS\"\n\t */\n\tsiteName: string;\n\n\t/**\n\t * Tag line of the website\n\t * @example \"Web-based Operating System\"\n\t*/\n\tsiteTagLine: string;\n\n\t/**\n\t * Domain of the live website\n\t * \n\t * A CNAME file will be generated with this value\n\t * @example \"os.prozilla.dev\"\n\t */\n\tdomain: string;\n\n\t/**\n\t * Array of image URLs that will be added to the sitemap\n\t */\n\timageUrls?: string[];\n}\n\ninterface StageOptionsExtended extends StageOptions {\n\timageUrls: string[];\n\tbaseUrl: string;\n\tpaths: FilePaths;\n}\n\ninterface FilePaths {\n\tsitemapXml: string;\n\trobotsTxt: string;\n\tindexHtml: string;\n\tcname: string;\n}\n\nfunction normalizeLineEndings(text: string) {\n\treturn text.replace(/\\r\\n/g, \"\\n\");\n}\n\nfunction generateSitemapXml(options: StageOptionsExtended) {\n\tconst { imageUrls, appsConfig, baseUrl } = options;\n\n\tconst date = new Date();\n\n\tconst year = date.getFullYear();\n\tconst month = date.getMonth() + 1;\n\tconst day = date.getDate();\n\n\tconst monthString = month >= 10 ? month.toString() : \"0\" + month;\n\tconst dayString = day >= 10 ? day.toString() : \"0\" + day;\n\n\tconst lastModified = `${year}-${monthString}-${dayString}`;\n\n\tconst images = imageUrls.map((path) => `\n\t\t<image:image>\n\t\t\t<image:loc>${baseUrl.slice(0, -1) + path}</image:loc>\n\t\t</image:image>`\n\t);\n\n\tconst pages = appsConfig.apps.map(({ id }) => `\n\t<url>\n\t\t<loc>${baseUrl + id}</loc>\n\t\t<lastmod>${lastModified}</lastmod>\n\t</url>`\n\t);\n\n\tconst sitemap = `\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE xml>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n\txmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\">\n\t<url>\n\t\t<loc>${baseUrl}</loc>\n\t\t<lastmod>${lastModified}</lastmod>\n\t\t${images.join(\"\")}\n\t</url>\n\t${pages.join(\"\")}\n</urlset>`;\n\n\treturn normalizeLineEndings(sitemap.trim());\n}\n\nfunction generateRobotsTxt(options: StageOptionsExtended) {\n\tconst { baseUrl } = options;\n\n\treturn normalizeLineEndings(`# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\nSitemap: ${baseUrl}sitemap.xml`);\n}\n\nfunction generateCname(options: StageOptionsExtended) {\n\treturn options.domain;\n}\n\nfunction generateTemplate(html: string, options: StageOptionsExtended) {\n\tconst { baseUrl } = options;\n\n\tconst baseUrlRegex = /(?<=\")https?:\\/\\/[a-z0-9-]+(\\.)([a-zA-Z0-9-]+(\\.))*[a-z]{2,3}\\/(?=.*\")/gi;\n\thtml = html.replaceAll(baseUrlRegex, baseUrl);\n\n\tconst commentsRegex = /<!--.*?-->/g;\n\thtml = html.replaceAll(commentsRegex, \"\");\n\n\tconst emptyLinesRegex = /^\\s*$\\n/gm;\n\thtml = html.replaceAll(emptyLinesRegex, \"\");\n\n\treturn normalizeLineEndings(html);\n}\n\n/**\n * To avoid GitHub pages rendering certain pages that are only defined by React router as a 404 page,\n * we copy the content of our index file to the 404 page, letting React router properly handle routing on every page \n */\nfunction generate404Page(context: PluginContext, template: string) {\n\tcontext.emitFile({\n\t\ttype: \"asset\",\n\t\tfileName: \"404.html\",\n\t\tsource: template,\n\t});\n}\n\n/**\n * Add an HTML file for every app page so they can be properly crawled and indexed\n */\nfunction generateAppPages(context: PluginContext, template: string, options: StageOptionsExtended) {\n\tconst { appsConfig, favicon, siteName, siteTagLine, baseUrl } = options;\n\n\tfor (const app of appsConfig.apps) {\n\t\tconst appId = app.id;\n\t\tconst appName = app.name;\n\t\tconst appDescription = app.description ?? siteTagLine;\n\t\tconst appIcon = app.iconUrl ?? favicon;\n\n\t\tif (appId === \"index\") {\n\t\t\tprint(\"Invalid app ID found: \" + appId, \"error\");\n\t\t\treturn;\n\t\t}\n\n\t\tlet html = template;\n\t\t\n\t\tconst titleRegex = /(?<=(<title>|<meta property=\"og:title\" content=\"|<meta name=\"twitter:title\" content=\"))(([a-zA-Z|-]|\\s)+)(?=(<\\/title>|\"\\/?>))/g;\n\t\thtml = html.replaceAll(titleRegex, `${appName} | ${siteName}`);\n\n\t\tconst descriptionRegex = /(?<=(<meta name=\"description\" content=\"|<meta property=\"og:description\" content=\"|<meta name=\"twitter:description\" content=\"))(([a-zA-Z-.]|\\s)+)(?=(\"\\/?>))/g;\n\t\thtml = html.replaceAll(descriptionRegex, appDescription);\n\n\t\tconst canonicalRegex = /(?<=(<link rel=\"canonical\" href=\"|<meta name=\"twitter:url\" content=\"|<meta property=\"og:url\" content=\"))(http(s)?:\\/\\/[a-zA-Z-.]+\\/)(?=(\"\\/?>))/g;\n\t\thtml = html.replaceAll(canonicalRegex, baseUrl + appId);\n\n\t\tconst iconRegex = /(?<=<link [^>]*rel=\"icon\" [^>]*href=\")[^\"]+(?=\"[^>]*>)/g;\n\t\thtml = html.replaceAll(iconRegex, `${appIcon}?x=${Math.round(Date.now() / 3_600_000)}`);\n\n\t\tconst faqRegex = /(<!-- FAQ -->.*?)?<script type=\"application\\/ld\\+json\">.*?<\\/script>/gs;\n\t\thtml = html.replaceAll(faqRegex, \"\");\n\n\t\tcontext.emitFile({\n\t\t\ttype: \"asset\",\n\t\t\tfileName: `${appId}.html`,\n\t\t\tsource: html,\n\t\t});\n\t}\n}\n\nfunction stageSite(context: PluginContext, bundle: OutputBundle, { appsConfig, favicon, siteName, siteTagLine, domain, imageUrls = [] }: StageOptions) {\n\ttry {\n\t\tprint(\"Staging build...\", \"start\", true);\n\n\t\tconst baseUrl = `https://${domain}/`;\n\n\t\tconst paths: FilePaths = {\n\t\t\tsitemapXml: \"sitemap.xml\",\n\t\t\trobotsTxt: \"robots.txt\",\n\t\t\tindexHtml: \"index.html\",\n\t\t\tcname: \"CNAME\",\n\t\t};\n\t\n\t\tconst files: [string, (options: StageOptionsExtended) => string][] = [\n\t\t\t[paths.sitemapXml, generateSitemapXml],\n\t\t\t[paths.robotsTxt, generateRobotsTxt],\n\t\t\t[paths.cname, generateCname],\n\t\t];\n\n\t\tconst extendedOptions = {\n\t\t\tappsConfig,\n\t\t\tfavicon,\n\t\t\tsiteName,\n\t\t\tsiteTagLine,\n\t\t\tdomain,\n\t\t\tbaseUrl,\n\t\t\timageUrls,\n\t\t\tpaths,\n\t\t};\n\t\n\t\tfiles.forEach(([path, generateContent]) => {\n\t\t\tcontext.emitFile({\n\t\t\t\ttype: \"asset\",\n\t\t\t\tfileName: path,\n\t\t\t\tsource: generateContent(extendedOptions),\n\t\t\t});\n\t\t});\n\n\t\tconst html = bundle[\"index.html\"];\n\t\tif (html && html.type == \"asset\") {\n\t\t\tconst template = generateTemplate(html.source as string, extendedOptions);\n\n\t\t\tcontext.emitFile({\n\t\t\t\ttype: \"asset\",\n\t\t\t\tfileName: \"index.html\",\n\t\t\t\tsource: template, \n\t\t\t});\n\t\n\t\t\tgenerate404Page(context, template);\n\t\t\tgenerateAppPages(context, template, extendedOptions);\n\t\t}\n\t\n\t\tprint(\"Staging complete\", \"success\", true);\n\t} catch (error) {\n\t\tconsole.error(error);\n\t\tprint(\"Staging failed\", \"error\");\n\t\tprocess.exit(1);\n\t}\n}\n\nexport function stageSitePlugin(options: StageOptions): Plugin {\n\treturn {\n\t\tname: \"vite-plugin-stage-site\",\n\t\tgenerateBundle(_outputOptions, bundle) {\n\t\t\tstageSite(this, bundle, options);\n\t\t},\n\t};\n}","import { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport { RollupError } from \"rollup\";\nimport { Plugin } from \"vite\";\n\ninterface PackageJson {\n\tname: string;\n\tversion: string;\n\tauthor?: string | { name: string };\n}\n\ninterface AppMetadataPluginOptions {\n\tentryPath: string;\n}\n\nexport function appMetadataPlugin({ entryPath }: AppMetadataPluginOptions): Plugin {\n\treturn {\n\t\tname: \"vite-plugin-app-metadata\",\n\t\tapply: \"build\",\n\t\tload(id) {\n\t\t\tif (!id.includes(entryPath)) return null;\n\t\t\n\t\t\tconst rootDir = process.cwd();\n\t\t\tconst packageJsonPath = resolve(rootDir, \"package.json\");\n\t\t\n\t\t\t// Read and parse the package.json file\n\t\t\tlet packageJson: PackageJson | null = null;\n\t\t\ttry {\n\t\t\t\tconst packageJsonContent = readFileSync(packageJsonPath, \"utf-8\");\n\t\t\t\tpackageJson = JSON.parse(packageJsonContent) as PackageJson;\n\t\t\t} catch (error) {\n\t\t\t\tthis.error(error as RollupError);\n\t\t\t}\n\n\t\t\tif (!packageJson)\n\t\t\t\treturn null;\n\t\t\n\t\t\tconst { name, version } = packageJson;\n\t\t\tlet { author = \"Unknown\" } = packageJson;\n\n\t\t\tif (typeof author == \"string\") {\n\t\t\t\tauthor = author.replace(/<[^>]*>|\\([^)]*\\)/g, \"\").trim();\n\t\t\t} else {\n\t\t\t\tauthor = author.name;\n\t\t\t}\n\t\t\n\t\t\t// Read the source file content\n\t\t\tlet code: string | null = null;\n\t\t\ttry {\n\t\t\t\tcode = readFileSync(id, \"utf-8\");\n\t\t\t} catch (error) {\n\t\t\t\tthis.error(error as RollupError);\n\t\t\t}\n\n\t\t\tif (code == null)\n\t\t\t\treturn null;\n\n\t\t\t// Find instance of app class\n\t\t\tconst appInstanceRegex = /const\\s+(\\w+)\\s*=\\s*new\\s+App(?:<[\\w\\s,]+>)?\\s*\\(([^;]*)\\)\\s*(\\.[\\w]+\\([^)]*\\)\\s*)*;/;\n\t\t\tconst match = code.match(appInstanceRegex);\n\t\t\n\t\t\tif (match) {\n\t\t\t\tconst appInstanceName = match[1];\n\t\t\n\t\t\t\t// Inject code to set metadata of app\n\t\t\t\tconst injectCode = `\\n${appInstanceName}.setMetadata({ name: \"${name}\", version: \"${version}\", author: \"${author}\" });\\n`;\n\t\t\t\tconst modifiedCode = code.replace(appInstanceRegex, match[0] + injectCode);\n\t\t\n\t\t\t\treturn modifiedCode; \n\t\t\t} else {\n\t\t\t\tthis.warn(\"No App instance found in the entry file.\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t},\n\t};\n}","import { UserConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react-swc\";\nimport dts from \"vite-plugin-dts\";\nimport cssInjectedByJs from \"vite-plugin-css-injected-by-js\";\nimport { posix, resolve, sep } from \"path\";\nimport { appMetadataPlugin } from \"../plugins\";\n\n/**\n * Helper function for creating Vite configurations for ProzillaOS apps\n * @param basePath - Path of base directory\n * @param entryPath - Path of library entry\n * @returns Vite configuration\n * @see https://vitejs.dev/config/\n */\nexport const appViteConfig = (basePath: string, entryPath: string): UserConfig => {\n\tlet entryFile = resolve(basePath, entryPath);\n\n\t// Normalize paths for Windows compatibility\n\tif (sep === \"\\\\\")\n\t\tentryFile = entryFile.split(sep).join(posix.sep);\n\n\tconsole.log(\"Using Vite config for app\");\n\tconsole.log(\"Entry: \" + entryFile);\n\n\treturn {\n\t\tplugins: [\n\t\t\tappMetadataPlugin({\n\t\t\t\tentryPath,\n\t\t\t}),\n\t\t\treact(),\n\t\t\tcssInjectedByJs(),\n\t\t\tdts({\n\t\t\t\toutDir: \"dist\",\n\t\t\t\trollupTypes: true,\n\t\t\t\tstrictOutput: true,\n\t\t\t\tpathsToAliases: false,\n\t\t\t\ttsconfigPath: \"tsconfig.build.json\",\n\t\t\t}),\n\t\t],\n\t\tbuild: {\n\t\t\tlib: {\n\t\t\t\tentry: entryFile,\n\t\t\t\tformats: [\"es\"],\n\t\t\t},\n\t\t\trollupOptions: {\n\t\t\t\texternal: [\"react\", \"react/jsx-runtime\", \"@prozilla-os/core\", \"@prozilla-os/shared\", /@fortawesome\\/*/g],\n\t\t\t\toutput: {\n\t\t\t\t\tassetFileNames: \"assets/[name][extname]\",\n\t\t\t\t\tchunkFileNames: \"chunks/[name]-[hash].js\",\n\t\t\t\t\tentryFileNames: \"[name].js\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tsourcemap: true,\n\t\t},\n\t};\n};"],"names":["print","message","status","newLine","ANSI","normalizeLineEndings","text","generateSitemapXml","options","imageUrls","appsConfig","baseUrl","date","year","month","day","monthString","dayString","lastModified","images","path","pages","id","sitemap","generateRobotsTxt","generateCname","generateTemplate","html","baseUrlRegex","commentsRegex","emptyLinesRegex","generate404Page","context","template","generateAppPages","favicon","siteName","siteTagLine","app","appId","appName","appDescription","appIcon","titleRegex","descriptionRegex","canonicalRegex","iconRegex","faqRegex","stageSite","bundle","domain","paths","files","extendedOptions","generateContent","error","stageSitePlugin","_outputOptions","appMetadataPlugin","entryPath","rootDir","packageJsonPath","resolve","packageJson","packageJsonContent","readFileSync","name","version","author","code","appInstanceRegex","match","injectCode","appViteConfig","basePath","entryFile","sep","posix","react","cssInjectedByJs","dts"],"mappings":";;;;;;AAIgB,SAAAA,EAAMC,GAAiBC,GAAiBC,GAAmB;AAI1E,MAHIA,KACH,QAAQ,IAAI,EAAE,GAEXD,KAAU;AACN,WAAA,QAAQ,IAAID,CAAO;AAE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;AAAA,QACJ,OAAOL;AAAA,QACP,SAAS,CAAC,IAAI;AAAA,MACf;AAAA,MACA,eAAe;AAAA,QACd,UAAU,CAAC,SAAS,qBAAqB,qBAAqB,uBAAuB,kBAAkB;AAAA,QACvG,QAAQ;AAAA,UACP,gBAAgB;AAAA,UAChB,gBAAgB;AAAA,UAChB,gBAAgB;AAAA,QACjB;AAAA,MACD;AAAA,MACA,WAAW;AAAA,IACZ;AAAA,EAAA;AAEF;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prozilla-os/dev-tools",
3
3
  "description": "A library of tools for the development of ProzillaOS packages.",
4
- "version": "1.0.6",
4
+ "version": "1.1.1",
5
5
  "homepage": "https://os.prozilla.dev",
6
6
  "author": {
7
7
  "name": "Prozilla",
@@ -19,18 +19,18 @@
19
19
  },
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@prozilla-os/core": "1.3.2",
23
- "@prozilla-os/shared": "^1.2.0",
24
22
  "@vitejs/plugin-react-swc": "^3.7.0",
25
23
  "vite": "^5.4.8",
26
24
  "vite-plugin-css-injected-by-js": "^3.5.1",
27
- "vite-plugin-dts": "^3.9.1"
25
+ "vite-plugin-dts": "^3.9.1",
26
+ "@prozilla-os/shared": "1.2.0",
27
+ "@prozilla-os/core": "1.3.4"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^20.14.5",
31
31
  "@types/react": "^18.3.3",
32
32
  "rollup": "^4.24.0",
33
- "typescript": "^5.4.5"
33
+ "typescript": "^5.5.4"
34
34
  },
35
35
  "files": [
36
36
  "dist"