xplorajs 0.3.4 → 0.3.7

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/cli.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ const ws = new WebSocket("ws://localhost:3001");
2
+ ws.onmessage = async (e)=>{
3
+ const data = JSON.parse(e.data);
4
+ if (data.type === "css") {
5
+ document.querySelectorAll('link[rel="stylesheet"]').forEach((l)=>{
6
+ l.href = "/assets/style.css?v=" + Date.now();
7
+ });
8
+ }
9
+ if (data.type === "reload") {
10
+ console.log("Reloading...");
11
+ location.reload();
12
+ }
13
+ };
14
+
15
+ //# sourceMappingURL=hmr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/hmr.js"],"sourcesContent":["const ws = new WebSocket(\"ws://localhost:3001\");\n\nws.onmessage = async (e) => {\n const data = JSON.parse(e.data);\n\n if (data.type === \"css\") {\n document.querySelectorAll('link[rel=\"stylesheet\"]').forEach((l) => {\n l.href = \"/assets/style.css?v=\" + Date.now();\n });\n }\n\n if (data.type === \"reload\") {\n console.log(\"Reloading...\");\n location.reload();\n }\n};\n"],"names":["ws","WebSocket","onmessage","e","data","JSON","parse","type","document","querySelectorAll","forEach","l","href","Date","now","console","log","location","reload"],"mappings":"AAAA,MAAMA,KAAK,IAAIC,UAAU;AAEzBD,GAAGE,SAAS,GAAG,OAAOC;IACpB,MAAMC,OAAOC,KAAKC,KAAK,CAACH,EAAEC,IAAI;IAE9B,IAAIA,KAAKG,IAAI,KAAK,OAAO;QACvBC,SAASC,gBAAgB,CAAC,0BAA0BC,OAAO,CAAC,CAACC;YAC3DA,EAAEC,IAAI,GAAG,yBAAyBC,KAAKC,GAAG;QAC5C;IACF;IAEA,IAAIV,KAAKG,IAAI,KAAK,UAAU;QAC1BQ,QAAQC,GAAG,CAAC;QACZC,SAASC,MAAM;IACjB;AACF"}
@@ -0,0 +1,9 @@
1
+ import * as RefreshRuntime from "https://esm.sh/react-refresh@0.17.0/runtime";
2
+ if (window.process?.env?.NODE_ENV === "development") {
3
+ console.log("Fast refresh runtime loaded in development mode");
4
+ }
5
+ RefreshRuntime.injectIntoGlobalHook(window);
6
+ window.$RefreshReg$ = ()=>{};
7
+ window.$RefreshSig$ = ()=>(t)=>t;
8
+
9
+ //# sourceMappingURL=refresh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/refresh.js"],"sourcesContent":["import * as RefreshRuntime from \"https://esm.sh/react-refresh@0.17.0/runtime\";\n\nif (window.process?.env?.NODE_ENV === \"development\") {\n console.log(\"Fast refresh runtime loaded in development mode\");\n}\n\nRefreshRuntime.injectIntoGlobalHook(window);\nwindow.$RefreshReg$ = () => {};\nwindow.$RefreshSig$ = () => (t) => t;\n"],"names":["RefreshRuntime","window","process","env","NODE_ENV","console","log","injectIntoGlobalHook","$RefreshReg$","$RefreshSig$","t"],"mappings":"AAAA,YAAYA,oBAAoB,8CAA8C;AAE9E,IAAIC,OAAOC,OAAO,EAAEC,KAAKC,aAAa,eAAe;IACnDC,QAAQC,GAAG,CAAC;AACd;AAEAN,eAAeO,oBAAoB,CAACN;AACpCA,OAAOO,YAAY,GAAG,KAAO;AAC7BP,OAAOQ,YAAY,GAAG,IAAM,CAACC,IAAMA"}
@@ -1 +1,2 @@
1
1
  export declare function build(): Promise<void>;
2
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AA0DA,wBAAsB,KAAK,kBA8B1B"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Build CSS with Tailwind CSS v4.
3
+ * Reads src/app/styles.css and outputs to dist/assets/style.css
4
+ */
5
+ export declare function buildCSS(): Promise<void>;
6
+ //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/commands/css.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,QAAQ,kBAmB7B"}
@@ -0,0 +1,24 @@
1
+ import { join } from "node:path";
2
+ import { mkdir } from "node:fs/promises";
3
+ import { $, file } from "bun";
4
+ export async function buildCSS() {
5
+ const inputPath = join(process.cwd(), "src/app/styles.css");
6
+ const outputPath = join(process.cwd(), "dist/assets/style.css");
7
+ const inputFile = file(inputPath);
8
+ if (!await inputFile.exists()) {
9
+ console.log("No styles.css found, skipping CSS build");
10
+ return;
11
+ }
12
+ await mkdir(join(process.cwd(), "dist/assets"), {
13
+ recursive: true
14
+ });
15
+ try {
16
+ await $`bunx tailwindcss -i ${inputPath} -o ${outputPath} --minify`.quiet();
17
+ console.log("CSS built successfully");
18
+ } catch (error) {
19
+ console.error("CSS build failed:", error);
20
+ throw error;
21
+ }
22
+ }
23
+
24
+ //# sourceMappingURL=css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/css.ts"],"sourcesContent":["import { join } from \"node:path\";\nimport { mkdir } from \"node:fs/promises\";\nimport { $, file } from \"bun\";\n\n/**\n * Build CSS with Tailwind CSS v4.\n * Reads src/app/styles.css and outputs to dist/assets/style.css\n */\nexport async function buildCSS() {\n const inputPath = join(process.cwd(), \"src/app/styles.css\");\n const outputPath = join(process.cwd(), \"dist/assets/style.css\");\n\n const inputFile = file(inputPath);\n if (!(await inputFile.exists())) {\n console.log(\"No styles.css found, skipping CSS build\");\n return;\n }\n\n await mkdir(join(process.cwd(), \"dist/assets\"), { recursive: true });\n\n try {\n await $`bunx tailwindcss -i ${inputPath} -o ${outputPath} --minify`.quiet();\n console.log(\"CSS built successfully\");\n } catch (error) {\n console.error(\"CSS build failed:\", error);\n throw error;\n }\n}\n"],"names":["join","mkdir","$","file","buildCSS","inputPath","process","cwd","outputPath","inputFile","exists","console","log","recursive","quiet","error"],"mappings":"AAAA,SAASA,IAAI,QAAQ,YAAY;AACjC,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,CAAC,EAAEC,IAAI,QAAQ,MAAM;AAM9B,OAAO,eAAeC;IACpB,MAAMC,YAAYL,KAAKM,QAAQC,GAAG,IAAI;IACtC,MAAMC,aAAaR,KAAKM,QAAQC,GAAG,IAAI;IAEvC,MAAME,YAAYN,KAAKE;IACvB,IAAI,CAAE,MAAMI,UAAUC,MAAM,IAAK;QAC/BC,QAAQC,GAAG,CAAC;QACZ;IACF;IAEA,MAAMX,MAAMD,KAAKM,QAAQC,GAAG,IAAI,gBAAgB;QAAEM,WAAW;IAAK;IAElE,IAAI;QACF,MAAMX,CAAC,CAAC,oBAAoB,EAAEG,UAAU,IAAI,EAAEG,WAAW,SAAS,CAAC,CAACM,KAAK;QACzEH,QAAQC,GAAG,CAAC;IACd,EAAE,OAAOG,OAAO;QACdJ,QAAQI,KAAK,CAAC,qBAAqBA;QACnC,MAAMA;IACR;AACF"}
@@ -1 +1,2 @@
1
1
  export declare function dev(): Promise<void>;
2
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AA8EA,wBAAsB,GAAG,kBAyGxB"}
@@ -1,30 +1,50 @@
1
- import { readFileSync } from "node:fs";
2
1
  import { join } from "node:path";
2
+ import { mkdir, writeFile } from "node:fs/promises";
3
3
  import { serve } from "bun";
4
4
  import { watch } from "chokidar";
5
+ import { glob } from "fast-glob";
5
6
  import React from "react";
6
7
  import { WebSocketServer } from "ws";
7
8
  import { renderToStream } from "xplorajs-react";
8
- import { build } from "./build";
9
+ import { buildCSS } from "./css";
9
10
  const pages = new Map();
11
+ function convertToRoute(filePath) {
12
+ const relativePath = filePath.replace("src/app/", "");
13
+ const path = relativePath.replace(/\.tsx$/, "").replace(/\/page$/, "").replace(/\[([^\]]+)\]/g, ":$1");
14
+ const params = (relativePath.match(/\[([^\]]+)\]/g) || []).map((param)=>param.slice(1, -1));
15
+ return {
16
+ path: path === "page" ? "/" : `/${path}`,
17
+ file: filePath,
18
+ isDynamic: params.length > 0,
19
+ params
20
+ };
21
+ }
22
+ async function generateRoutes() {
23
+ await mkdir(join(process.cwd(), ".xplora"), {
24
+ recursive: true
25
+ });
26
+ const pageFiles = await glob("src/app/**/*.tsx", {
27
+ ignore: [
28
+ "**/node_modules/**"
29
+ ]
30
+ });
31
+ const routes = pageFiles.map(convertToRoute);
32
+ const routesConfig = {
33
+ routes,
34
+ generatedAt: new Date().toISOString()
35
+ };
36
+ await writeFile(join(process.cwd(), ".xplora", "routes.json"), JSON.stringify(routesConfig, null, 2));
37
+ return routes;
38
+ }
10
39
  async function loadPages() {
11
40
  pages.clear();
12
- const routes = await loadRoutes();
41
+ const routes = await generateRoutes();
13
42
  for (const route of routes){
14
43
  const abs = join(process.cwd(), route.file);
15
44
  delete import.meta.require?.cache?.[abs];
16
45
  pages.set(route.path, (await import(abs)).default);
17
46
  }
18
47
  }
19
- async function loadRoutes() {
20
- try {
21
- const routesPath = join(process.cwd(), ".xplora", "routes.json");
22
- const routesContent = readFileSync(routesPath, "utf-8");
23
- return JSON.parse(routesContent).routes;
24
- } catch {
25
- return [];
26
- }
27
- }
28
48
  export async function dev() {
29
49
  console.log("Starting development server...");
30
50
  const wss = new WebSocketServer({
@@ -38,17 +58,27 @@ export async function dev() {
38
58
  });
39
59
  watcher.on("change", async (path)=>{
40
60
  console.log(`File ${path} has been changed`);
41
- await build();
42
- await loadPages();
43
- for (const client of wss.clients){
44
- if (client.readyState === WebSocket.OPEN) {
45
- client.send(JSON.stringify({
46
- type: "reload"
47
- }));
61
+ if (path.endsWith(".css")) {
62
+ await buildCSS();
63
+ for (const client of wss.clients){
64
+ if (client.readyState === WebSocket.OPEN) {
65
+ client.send(JSON.stringify({
66
+ type: "css"
67
+ }));
68
+ }
69
+ }
70
+ } else {
71
+ await loadPages();
72
+ for (const client of wss.clients){
73
+ if (client.readyState === WebSocket.OPEN) {
74
+ client.send(JSON.stringify({
75
+ type: "reload"
76
+ }));
77
+ }
48
78
  }
49
79
  }
50
80
  });
51
- await build();
81
+ await buildCSS();
52
82
  await loadPages();
53
83
  serve({
54
84
  port: 3000,
@@ -56,13 +86,21 @@ export async function dev() {
56
86
  async fetch (req) {
57
87
  const url = new URL(req.url);
58
88
  const path = url.pathname;
59
- if (path === "/") {
60
- return new Response("Hello from XploraJS!");
61
- }
62
89
  if (path.startsWith("/assets/")) {
63
90
  const f = Bun.file(join(process.cwd(), "dist", path));
64
91
  if (await f.exists()) return new Response(f);
65
92
  }
93
+ if (path.startsWith("/client/")) {
94
+ const clientPath = join(import.meta.dir, "..", "client", path.replace("/client/", ""));
95
+ const f = Bun.file(clientPath);
96
+ if (await f.exists()) {
97
+ return new Response(f, {
98
+ headers: {
99
+ "Content-Type": "application/javascript"
100
+ }
101
+ });
102
+ }
103
+ }
66
104
  const Page = pages.get(path);
67
105
  if (!Page) return new Response("Not Found", {
68
106
  status: 404
@@ -74,27 +112,8 @@ export async function dev() {
74
112
  <script>window.process={env:{NODE_ENV:"development"}};</script>
75
113
  </head><body><div id="root">`;
76
114
  const foot = `</div>
77
- <script type="module">
78
- import * as RefreshRuntime from "https://esm.sh/react-refresh@0.17.0/runtime";
79
- if (window.process?.env?.NODE_ENV === "development") {
80
- console.log("Fast refresh runtime loaded in development mode");
81
- }
82
- RefreshRuntime.injectIntoGlobalHook(window);
83
- window.$RefreshReg$=()=>{};
84
- window.$RefreshSig$=()=>t=>t;
85
- </script>
86
- <script>
87
- const ws=new WebSocket("ws://localhost:3001");
88
- ws.onmessage=async e=>{
89
- if(e.data==="css"){
90
- document.querySelectorAll('link[rel="stylesheet"]').forEach(l=>l.href="/assets/style.css?v="+Date.now());
91
- }
92
- if(e.data==="reload"){
93
- console.log("Reloading...");
94
- location.reload();
95
- }
96
- };
97
- </script>
115
+ <script type="module" src="/client/refresh.js"></script>
116
+ <script type="module" src="/client/hmr.js"></script>
98
117
  </body></html>`;
99
118
  return new Response(new ReadableStream({
100
119
  start (ctrl) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/dev.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { serve } from \"bun\";\nimport { watch } from \"chokidar\";\nimport React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { WebSocketServer } from \"ws\";\nimport { renderToStream } from \"xplorajs-react\";\nimport { build } from \"./build\";\n\n// biome-ignore lint/suspicious/noExplicitAny: <intended>\nconst pages = new Map<string, ComponentType<Record<string, any>>>();\n\nasync function loadPages() {\n\tpages.clear();\n\tconst routes = await loadRoutes();\n\n\tfor (const route of routes) {\n\t\tconst abs = join(process.cwd(), route.file);\n\t\tdelete import.meta.require?.cache?.[abs];\n\t\tpages.set(\n\t\t\troute.path,\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <intended>\n\t\t\t(await import(abs)).default as ComponentType<Record<string, any>>,\n\t\t);\n\t}\n}\n\nasync function loadRoutes() {\n\ttry {\n\t\tconst routesPath = join(process.cwd(), \".xplora\", \"routes.json\");\n\t\tconst routesContent = readFileSync(routesPath, \"utf-8\");\n\t\treturn JSON.parse(routesContent).routes;\n\t} catch {\n\t\treturn [];\n\t}\n}\n\nexport async function dev() {\n\tconsole.log(\"Starting development server...\");\n\n\tconst wss = new WebSocketServer({ port: 3001 });\n\n\tconst watcher = watch([\"src/**/*\"], {\n\t\tignored: /(^|[\\/\\\\])\\../,\n\t\tpersistent: true,\n\t});\n\n\twatcher.on(\"change\", async (path: string) => {\n\t\tconsole.log(`File ${path} has been changed`);\n\t\tawait build();\n\t\tawait loadPages();\n\n\t\tfor (const client of wss.clients) {\n\t\t\tif (client.readyState === WebSocket.OPEN) {\n\t\t\t\tclient.send(JSON.stringify({ type: \"reload\" }));\n\t\t\t}\n\t\t}\n\t});\n\n\tawait build();\n\tawait loadPages();\n\n\tserve({\n\t\tport: 3000,\n\t\tdevelopment: true,\n\t\tasync fetch(req: Request) {\n\t\t\tconst url = new URL(req.url);\n\t\t\tconst path = url.pathname;\n\n\t\t\tif (path === \"/\") {\n\t\t\t\treturn new Response(\"Hello from XploraJS!\");\n\t\t\t}\n\n\t\t\tif (path.startsWith(\"/assets/\")) {\n\t\t\t\tconst f = Bun.file(join(process.cwd(), \"dist\", path));\n\t\t\t\tif (await f.exists()) return new Response(f);\n\t\t\t}\n\n\t\t\tconst Page = pages.get(path);\n\t\t\tif (!Page) return new Response(\"Not Found\", { status: 404 });\n\n\t\t\tconst stream = await renderToStream(React.createElement(Page));\n\n\t\t\tconst head = `<!DOCTYPE html><html><head>\n\t\t\t\t<meta charset=\"utf-8\"/>\n\t\t\t\t<link rel=\"stylesheet\" href=\"/assets/style.css\"/>\n\t\t\t\t<script>window.process={env:{NODE_ENV:\"development\"}};</script>\n\t\t\t\t</head><body><div id=\"root\">`;\n\n\t\t\tconst foot = `</div>\n\t\t\t\t<script type=\"module\">\n\t\t\t\t\timport * as RefreshRuntime from \"https://esm.sh/react-refresh@0.17.0/runtime\";\n\t\t\t\t\tif (window.process?.env?.NODE_ENV === \"development\") {\n\t\t\t\t\t\tconsole.log(\"Fast refresh runtime loaded in development mode\");\n\t\t\t\t\t}\n\t\t\t\t\tRefreshRuntime.injectIntoGlobalHook(window);\n\t\t\t\t\twindow.$RefreshReg$=()=>{};\n\t\t\t\t\twindow.$RefreshSig$=()=>t=>t;\n\t\t\t\t</script>\n\t\t\t\t<script>\n\t\t\t\t\tconst ws=new WebSocket(\"ws://localhost:3001\");\n\t\t\t\t\tws.onmessage=async e=>{\n\t\t\t\t\t\tif(e.data===\"css\"){\n\t\t\t\t\t\t\tdocument.querySelectorAll('link[rel=\"stylesheet\"]').forEach(l=>l.href=\"/assets/style.css?v=\"+Date.now());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(e.data===\"reload\"){\n\t\t\t\t\t\t\tconsole.log(\"Reloading...\");\n\t\t\t\t\t\t\tlocation.reload();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t</script>\n\t\t\t</body></html>`;\n\n\t\t\treturn new Response(\n\t\t\t\tnew ReadableStream({\n\t\t\t\t\tstart(ctrl) {\n\t\t\t\t\t\tctrl.enqueue(new TextEncoder().encode(head));\n\t\t\t\t\t\tif (typeof stream === \"string\") {\n\t\t\t\t\t\t\tctrl.enqueue(new TextEncoder().encode(stream));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstream.pipeTo(\n\t\t\t\t\t\t\t\tnew WritableStream({\n\t\t\t\t\t\t\t\t\twrite(c) {\n\t\t\t\t\t\t\t\t\t\tctrl.enqueue(c);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tclose() {\n\t\t\t\t\t\t\t\t\t\tctrl.enqueue(new TextEncoder().encode(foot));\n\t\t\t\t\t\t\t\t\t\tctrl.close();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\t{ headers: { \"Content-Type\": \"text/html; charset=utf-8\" } },\n\t\t\t);\n\t\t},\n\t});\n\n\tconsole.log(\"Development server running at http://localhost:3000\");\n}\n"],"names":["readFileSync","join","serve","watch","React","WebSocketServer","renderToStream","build","pages","Map","loadPages","clear","routes","loadRoutes","route","abs","process","cwd","file","require","cache","set","path","default","routesPath","routesContent","JSON","parse","dev","console","log","wss","port","watcher","ignored","persistent","on","client","clients","readyState","WebSocket","OPEN","send","stringify","type","development","fetch","req","url","URL","pathname","Response","startsWith","f","Bun","exists","Page","get","status","stream","createElement","head","foot","ReadableStream","start","ctrl","enqueue","TextEncoder","encode","pipeTo","WritableStream","write","c","close","headers"],"mappings":"AAAA,SAASA,YAAY,QAAQ,UAAU;AACv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QC,GAAG,CAAC;AACb"}
1
+ {"version":3,"sources":["../../src/commands/dev.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { serve } from \"bun\";\nimport { watch } from \"chokidar\";\nimport { glob } from \"fast-glob\";\nimport React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { WebSocketServer } from \"ws\";\nimport { renderToStream } from \"xplorajs-react\";\nimport { buildCSS } from \"./css\";\n\n// biome-ignore lint/suspicious/noExplicitAny: <intended>\nconst pages = new Map<string, ComponentType<Record<string, any>>>();\n\ninterface Route {\n path: string;\n file: string;\n isDynamic: boolean;\n params: string[];\n}\n\nfunction convertToRoute(filePath: string): Route {\n const relativePath = filePath.replace(\"src/app/\", \"\");\n const path = relativePath\n .replace(/\\.tsx$/, \"\")\n .replace(/\\/page$/, \"\")\n .replace(/\\[([^\\]]+)\\]/g, \":$1\");\n\n const params = (relativePath.match(/\\[([^\\]]+)\\]/g) || []).map((param) =>\n param.slice(1, -1),\n );\n\n return {\n path: path === \"page\" ? \"/\" : `/${path}`,\n file: filePath,\n isDynamic: params.length > 0,\n params,\n };\n}\n\nasync function generateRoutes() {\n await mkdir(join(process.cwd(), \".xplora\"), { recursive: true });\n\n const pageFiles = await glob(\"src/app/**/*.tsx\", {\n ignore: [\"**/node_modules/**\"],\n });\n\n const routes: Route[] = pageFiles.map(convertToRoute);\n\n const routesConfig = {\n routes,\n generatedAt: new Date().toISOString(),\n };\n\n await writeFile(\n join(process.cwd(), \".xplora\", \"routes.json\"),\n JSON.stringify(routesConfig, null, 2),\n );\n\n return routes;\n}\n\nasync function loadPages() {\n pages.clear();\n const routes = await generateRoutes();\n\n for (const route of routes) {\n const abs = join(process.cwd(), route.file);\n delete import.meta.require?.cache?.[abs];\n pages.set(\n route.path,\n // biome-ignore lint/suspicious/noExplicitAny: <intended>\n (await import(abs)).default as ComponentType<Record<string, any>>,\n );\n }\n}\n\nexport async function dev() {\n console.log(\"Starting development server...\");\n\n const wss = new WebSocketServer({ port: 3001 });\n\n const watcher = watch([\"src/**/*\"], {\n ignored: /(^|[\\/\\\\])\\../,\n persistent: true,\n });\n\n watcher.on(\"change\", async (path: string) => {\n console.log(`File ${path} has been changed`);\n\n if (path.endsWith(\".css\")) {\n // CSS changed - rebuild CSS and notify clients for CSS-only reload\n await buildCSS();\n for (const client of wss.clients) {\n if (client.readyState === WebSocket.OPEN) {\n client.send(JSON.stringify({ type: \"css\" }));\n }\n }\n } else {\n // TSX/other files changed - reload pages and trigger full reload\n await loadPages();\n for (const client of wss.clients) {\n if (client.readyState === WebSocket.OPEN) {\n client.send(JSON.stringify({ type: \"reload\" }));\n }\n }\n }\n });\n\n await buildCSS();\n await loadPages();\n\n serve({\n port: 3000,\n development: true,\n async fetch(req: Request) {\n const url = new URL(req.url);\n const path = url.pathname;\n\n if (path.startsWith(\"/assets/\")) {\n const f = Bun.file(join(process.cwd(), \"dist\", path));\n if (await f.exists()) return new Response(f);\n }\n\n if (path.startsWith(\"/client/\")) {\n const clientPath = join(\n import.meta.dir,\n \"..\",\n \"client\",\n path.replace(\"/client/\", \"\"),\n );\n const f = Bun.file(clientPath);\n if (await f.exists()) {\n return new Response(f, {\n headers: { \"Content-Type\": \"application/javascript\" },\n });\n }\n }\n\n const Page = pages.get(path);\n if (!Page) return new Response(\"Not Found\", { status: 404 });\n\n const stream = await renderToStream(React.createElement(Page));\n\n const head = `<!DOCTYPE html><html><head>\n\t\t\t\t<meta charset=\"utf-8\"/>\n\t\t\t\t<link rel=\"stylesheet\" href=\"/assets/style.css\"/>\n\t\t\t\t<script>window.process={env:{NODE_ENV:\"development\"}};</script>\n\t\t\t\t</head><body><div id=\"root\">`;\n\n const foot = `</div>\n\t\t\t\t<script type=\"module\" src=\"/client/refresh.js\"></script>\n\t\t\t\t<script type=\"module\" src=\"/client/hmr.js\"></script>\n\t\t\t</body></html>`;\n\n return new Response(\n new ReadableStream({\n start(ctrl) {\n ctrl.enqueue(new TextEncoder().encode(head));\n if (typeof stream === \"string\") {\n ctrl.enqueue(new TextEncoder().encode(stream));\n } else {\n stream.pipeTo(\n new WritableStream({\n write(c) {\n ctrl.enqueue(c);\n },\n close() {\n ctrl.enqueue(new TextEncoder().encode(foot));\n ctrl.close();\n },\n }),\n );\n }\n },\n }),\n { headers: { \"Content-Type\": \"text/html; charset=utf-8\" } },\n );\n },\n });\n\n console.log(\"Development server running at http://localhost:3000\");\n}\n"],"names":["join","mkdir","writeFile","serve","watch","glob","React","WebSocketServer","renderToStream","buildCSS","pages","Map","convertToRoute","filePath","relativePath","replace","path","params","match","map","param","slice","file","isDynamic","length","generateRoutes","process","cwd","recursive","pageFiles","ignore","routes","routesConfig","generatedAt","Date","toISOString","JSON","stringify","loadPages","clear","route","abs","require","cache","set","default","dev","console","log","wss","port","watcher","ignored","persistent","on","endsWith","client","clients","readyState","WebSocket","OPEN","send","type","development","fetch","req","url","URL","pathname","startsWith","f","Bun","exists","Response","clientPath","dir","headers","Page","get","status","stream","createElement","head","foot","ReadableStream","start","ctrl","enqueue","TextEncoder","encode","pipeTo","WritableStream","write","c","close"],"mappings":"AACA,SAASA,IAAI,QAAQ,YAAY;AACjC,SAASC,KAAK,EAAEC,SAAS,QAAQ,mBAAmB;AACpD,SAASC,KAAK,QAAQ,MAAM;AAC5B,SAASC,KAAK,QAAQ,WAAW;AACjC,SAASC,IAAI,QAAQ,YAAY;AACjC,OAAOC,WAAW,QAAQ;AAE1B,SAASC,eAAe,QAAQ,KAAK;AACrC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,QAAQ,QAAQ,QAAQ;AAGjC,MAAMC,QAAQ,IAAIC;AASlB,SAASC,eAAeC,QAAgB;IACtC,MAAMC,eAAeD,SAASE,OAAO,CAAC,YAAY;IAClD,MAAMC,OAAOF,aACVC,OAAO,CAAC,UAAU,IAClBA,OAAO,CAAC,WAAW,IACnBA,OAAO,CAAC,iBAAiB;IAE5B,MAAME,SAAS,AAACH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,IAAIJ,SAAS,aAAa;gBAAEM,QAAQ;YAAI;YAE1D,MAAMC,SAAS,MAAMxE,eAAeF,MAAM2E,aAAa,CAACJ;YAExD,MAAMK,OAAO,CAAC;;;;gCAIY,CAAC;YAE3B,MAAMC,OAAO,CAAC;;;iBAGH,CAAC;YAEZ,OAAO,IAAIV,SACT,IAAIW,eAAe;gBACjBC,OAAMC,IAAI;oBACRA,KAAKC,OAAO,CAAC,IAAIC,cAAcC,MAAM,CAACP;oBACtC,IAAI,OAAOF,WAAW,UAAU;wBAC9BM,KAAKC,OAAO,CAAC,IAAIC,cAAcC,MAAM,CAACT;oBACxC,OAAO;wBACLA,OAAOU,MAAM,CACX,IAAIC,eAAe;4BACjBC,OAAMC,CAAC;gCACLP,KAAKC,OAAO,CAACM;4BACf;4BACAC;gCACER,KAAKC,OAAO,CAAC,IAAIC,cAAcC,MAAM,CAACN;gCACtCG,KAAKQ,KAAK;4BACZ;wBACF;oBAEJ;gBACF;YACF,IACA;gBAAElB,SAAS;oBAAE,gBAAgB;gBAA2B;YAAE;QAE9D;IACF;IAEA7B,QAAQC,GAAG,CAAC;AACd"}
@@ -1 +1,2 @@
1
1
  export declare function start(): Promise<void>;
2
+ //# sourceMappingURL=start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAGA,wBAAsB,KAAK,kBAkC1B"}
@@ -1,3 +1,4 @@
1
+ import { join } from "node:path";
1
2
  import { serve } from "bun";
2
3
  export async function start() {
3
4
  console.log("Starting production server...");
@@ -8,9 +9,17 @@ export async function start() {
8
9
  port: config.port,
9
10
  async fetch (req) {
10
11
  const url = new URL(req.url);
11
- const path = url.pathname;
12
- if (path === "/") {
13
- return new Response("Hello from XploraJS!");
12
+ const pathname = url.pathname;
13
+ const distDir = join(process.cwd(), "dist");
14
+ let filePath;
15
+ if (pathname.includes(".")) {
16
+ filePath = join(distDir, pathname);
17
+ } else {
18
+ filePath = join(distDir, pathname, "index.html");
19
+ }
20
+ const file = Bun.file(filePath);
21
+ if (await file.exists()) {
22
+ return new Response(file);
14
23
  }
15
24
  return new Response("Not found", {
16
25
  status: 404
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/start.ts"],"sourcesContent":["import { serve } from \"bun\";\n\nexport async function start() {\n console.log(\"Starting production server...\");\n\n const config = {\n port: 3000,\n };\n\n serve({\n port: config.port,\n async fetch(req: Request) {\n const url = new URL(req.url);\n const path = url.pathname;\n\n if (path === \"/\") {\n return new Response(\"Hello from XploraJS!\");\n }\n\n return new Response(\"Not found\", { status: 404 });\n },\n });\n\n console.log(\"Production server running at http://localhost:3000\");\n}\n"],"names":["serve","start","console","log","config","port","fetch","req","url","URL","path","pathname","Response","status"],"mappings":"AAAA,SAASA,KAAK,QAAQ,MAAM;AAE5B,OAAO,eAAeC;IACpBC,QAAQC,GAAG,CAAC;IAEZ,MAAMC,SAAS;QACbC,MAAM;IACR;IAEAL,MAAM;QACJK,MAAMD,OAAOC,IAAI;QACjB,MAAMC,OAAMC,GAAY;YACtB,MAAMC,MAAM,IAAIC,IAAIF,IAAIC,GAAG;YAC3B,MAAME,OAAOF,IAAIG,QAAQ;YAEzB,IAAID,SAAS,KAAK;gBAChB,OAAO,IAAIE,SAAS;YACtB;YAEA,OAAO,IAAIA,SAAS,aAAa;gBAAEC,QAAQ;YAAI;QACjD;IACF;IAEAX,QAAQC,GAAG,CAAC;AACd"}
1
+ {"version":3,"sources":["../../src/commands/start.ts"],"sourcesContent":["import { join } from \"node:path\";\nimport { serve } from \"bun\";\n\nexport async function start() {\n console.log(\"Starting production server...\");\n\n const config = {\n port: 3000,\n };\n\n serve({\n port: config.port,\n async fetch(req: Request) {\n const url = new URL(req.url);\n const pathname = url.pathname;\n\n const distDir = join(process.cwd(), \"dist\");\n\n let filePath: string;\n\n if (pathname.includes(\".\")) {\n filePath = join(distDir, pathname);\n } else {\n filePath = join(distDir, pathname, \"index.html\");\n }\n\n const file = Bun.file(filePath);\n\n if (await file.exists()) {\n return new Response(file);\n }\n\n return new Response(\"Not found\", { status: 404 });\n },\n });\n\n console.log(\"Production server running at http://localhost:3000\");\n}\n"],"names":["join","serve","start","console","log","config","port","fetch","req","url","URL","pathname","distDir","process","cwd","filePath","includes","file","Bun","exists","Response","status"],"mappings":"AAAA,SAASA,IAAI,QAAQ,YAAY;AACjC,SAASC,KAAK,QAAQ,MAAM;AAE5B,OAAO,eAAeC;IACpBC,QAAQC,GAAG,CAAC;IAEZ,MAAMC,SAAS;QACbC,MAAM;IACR;IAEAL,MAAM;QACJK,MAAMD,OAAOC,IAAI;QACjB,MAAMC,OAAMC,GAAY;YACtB,MAAMC,MAAM,IAAIC,IAAIF,IAAIC,GAAG;YAC3B,MAAME,WAAWF,IAAIE,QAAQ;YAE7B,MAAMC,UAAUZ,KAAKa,QAAQC,GAAG,IAAI;YAEpC,IAAIC;YAEJ,IAAIJ,SAASK,QAAQ,CAAC,MAAM;gBAC1BD,WAAWf,KAAKY,SAASD;YAC3B,OAAO;gBACLI,WAAWf,KAAKY,SAASD,UAAU;YACrC;YAEA,MAAMM,OAAOC,IAAID,IAAI,CAACF;YAEtB,IAAI,MAAME,KAAKE,MAAM,IAAI;gBACvB,OAAO,IAAIC,SAASH;YACtB;YAEA,OAAO,IAAIG,SAAS,aAAa;gBAAEC,QAAQ;YAAI;QACjD;IACF;IAEAlB,QAAQC,GAAG,CAAC;AACd"}
package/dist/config.d.ts CHANGED
@@ -16,3 +16,4 @@ interface XploraConfig {
16
16
  declare function defineConfig(config: XploraConfig): XploraConfig;
17
17
  export type { XploraConfig };
18
18
  export { defineConfig };
19
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,GAAG,CAAC,EAAE;QACJ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,OAAO,CAAC;KACf,CAAC;IACF,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;CACH;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAmBxD;AAED,YAAY,EAAE,YAAY,EAAE,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- declare const defineConfig: any;
2
- export { defineConfig };
1
+ export type { XploraConfig } from "./config";
2
+ export { defineConfig } from "./config";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,3 @@
1
- const { XploraConfig, defineConfig } = require("./config");
2
- module.exports = {
3
- XploraConfig,
4
- defineConfig
5
- };
6
- export { defineConfig };
1
+ export { defineConfig } from "./config";
7
2
 
8
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["const { XploraConfig, defineConfig } = require(\"./config\");\n\nmodule.exports = {\n\tXploraConfig,\n\tdefineConfig,\n};\nexport { defineConfig };\n\n"],"names":["XploraConfig","defineConfig","require","module","exports"],"mappings":"AAAA,MAAM,EAAEA,YAAY,EAAEC,YAAY,EAAE,GAAGC,QAAQ;AAE/CC,OAAOC,OAAO,GAAG;IAChBJ;IACAC;AACD;AACA,SAASA,YAAY,GAAG"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type { XploraConfig } from \"./config\";\nexport { defineConfig } from \"./config\";\n"],"names":["defineConfig"],"mappings":"AACA,SAASA,YAAY,QAAQ,WAAW"}
package/package.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "xplorajs",
3
- "version": "0.3.4",
3
+ "version": "0.3.7",
4
4
  "type": "module",
5
- "main": "dist/index.js",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/XplorationTechnologies/xplora.js.git"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
6
15
  "types": "dist/index.d.ts",
7
16
  "bin": {
8
17
  "xplorajs": "./dist/cli.js"
@@ -11,6 +20,7 @@
11
20
  "dist",
12
21
  "README.md"
13
22
  ],
23
+ "sideEffects": false,
14
24
  "scripts": {
15
25
  "dev": "bun run build --watch",
16
26
  "build": "swc src -d dist --config-file .swcrc && tsc --emitDeclarationOnly",
@@ -18,24 +28,23 @@
18
28
  "prepublishOnly": "bun run build"
19
29
  },
20
30
  "dependencies": {
21
- "@swc/cli": "^0.1.65",
22
- "@swc/core": "^1.11.24",
23
31
  "chokidar": "^3.6.0",
24
32
  "commander": "^11.1.0",
25
33
  "fast-glob": "^3.3.3",
26
34
  "ws": "^8.18.2",
27
- "xplorajs-react": "latest"
35
+ "xplorajs-react": "^0.3.6"
28
36
  },
29
37
  "devDependencies": {
38
+ "@swc/cli": "^0.1.65",
39
+ "@swc/core": "^1.11.24",
30
40
  "@types/bun": "^1.2.13",
31
41
  "@types/ws": "^8.18.1",
32
42
  "react-refresh": "^0.17.0"
33
43
  },
34
44
  "peerDependencies": {
35
- "react": "^19.1.0",
36
- "react-dom": "^19.1.0",
37
- "@types/react": "^19.1.4",
38
- "@types/react-dom": "^19.1.5"
45
+ "react": ">=18 || >=19",
46
+ "react-dom": ">=18 || >=19",
47
+ "tailwindcss": ">=4.0.0"
39
48
  },
40
49
  "publishConfig": {
41
50
  "access": "public"