xplorajs 0.1.9 → 0.3.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/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- const { Command } = require("commander");
3
- const { build } = require("./commands/build");
4
- const { dev } = require("./commands/dev");
5
- const { start } = require("./commands/start");
2
+ import { Command } from "commander";
3
+ import { build } from "./commands/build";
4
+ import { dev } from "./commands/dev";
5
+ import { start } from "./commands/start";
6
6
  const program = new Command();
7
7
  program.name("xplorajs").description("Xplora.js CLI tool").version("0.0.0");
8
8
  program.command("dev").description("Start development server").action(dev);
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nconst { Command } = require(\"commander\");\nconst { build } = require(\"./commands/build\");\nconst { dev } = require(\"./commands/dev\");\nconst { start } = require(\"./commands/start\");\n\nconst program = new Command();\n\nprogram.name(\"xplorajs\").description(\"Xplora.js CLI tool\").version(\"0.0.0\");\n\nprogram.command(\"dev\").description(\"Start development server\").action(dev);\n\nprogram.command(\"build\").description(\"Build for production\").action(build);\n\nprogram.command(\"start\").description(\"Start production server\").action(start);\n\nprogram.parse();\n"],"names":["Command","require","build","dev","start","program","name","description","version","command","action","parse"],"mappings":";AACA,MAAM,EAAEA,OAAO,EAAE,GAAGC,QAAQ;AAC5B,MAAM,EAAEC,KAAK,EAAE,GAAGD,QAAQ;AAC1B,MAAM,EAAEE,GAAG,EAAE,GAAGF,QAAQ;AACxB,MAAM,EAAEG,KAAK,EAAE,GAAGH,QAAQ;AAE1B,MAAMI,UAAU,IAAIL;AAEpBK,QAAQC,IAAI,CAAC,YAAYC,WAAW,CAAC,sBAAsBC,OAAO,CAAC;AAEnEH,QAAQI,OAAO,CAAC,OAAOF,WAAW,CAAC,4BAA4BG,MAAM,CAACP;AAEtEE,QAAQI,OAAO,CAAC,SAASF,WAAW,CAAC,wBAAwBG,MAAM,CAACR;AAEpEG,QAAQI,OAAO,CAAC,SAASF,WAAW,CAAC,2BAA2BG,MAAM,CAACN;AAEvEC,QAAQM,KAAK"}
1
+ {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\";\nimport { build } from \"./commands/build\";\nimport { dev } from \"./commands/dev\";\nimport { start } from \"./commands/start\";\n\nconst program = new Command();\n\nprogram.name(\"xplorajs\").description(\"Xplora.js CLI tool\").version(\"0.0.0\");\n\nprogram.command(\"dev\").description(\"Start development server\").action(dev);\n\nprogram.command(\"build\").description(\"Build for production\").action(build);\n\nprogram.command(\"start\").description(\"Start production server\").action(start);\n\nprogram.parse();\n"],"names":["Command","build","dev","start","program","name","description","version","command","action","parse"],"mappings":";AACA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,GAAG,QAAQ,iBAAiB;AACrC,SAASC,KAAK,QAAQ,mBAAmB;AAEzC,MAAMC,UAAU,IAAIJ;AAEpBI,QAAQC,IAAI,CAAC,YAAYC,WAAW,CAAC,sBAAsBC,OAAO,CAAC;AAEnEH,QAAQI,OAAO,CAAC,OAAOF,WAAW,CAAC,4BAA4BG,MAAM,CAACP;AAEtEE,QAAQI,OAAO,CAAC,SAASF,WAAW,CAAC,wBAAwBG,MAAM,CAACR;AAEpEG,QAAQI,OAAO,CAAC,SAASF,WAAW,CAAC,2BAA2BG,MAAM,CAACN;AAEvEC,QAAQM,KAAK"}
@@ -0,0 +1 @@
1
+ export declare function build(): Promise<void>;
@@ -1,8 +1,8 @@
1
- const { mkdir, readFile, writeFile } = require("node:fs/promises");
2
- const { dirname, join } = require("node:path");
3
- const { glob } = require("fast-glob");
4
- const React = require("react");
5
- const { generateStaticPage } = require("xplorajs-react");
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { glob } from "fast-glob";
4
+ import React from "react";
5
+ import { generateStaticPage } from "xplorajs-react";
6
6
  function convertToRoute(filePath) {
7
7
  const relativePath = filePath.replace("src/app/", "");
8
8
  const path = relativePath.replace(/\.tsx$/, "").replace(/\/page$/, "").replace(/\[([^\]]+)\]/g, ":$1");
@@ -16,9 +16,9 @@ function convertToRoute(filePath) {
16
16
  }
17
17
  async function processPage(page, route) {
18
18
  try {
19
- const module1 = await import(join(process.cwd(), page));
20
- const PageComponent = module1.default;
21
- const getStaticProps = module1.getStaticProps;
19
+ const module = await import(join(process.cwd(), page));
20
+ const PageComponent = module.default;
21
+ const getStaticProps = module.getStaticProps;
22
22
  let props = {};
23
23
  if (getStaticProps) {
24
24
  const result = await getStaticProps();
@@ -35,7 +35,7 @@ async function processPage(page, route) {
35
35
  console.error(`Error processing ${page}:`, error);
36
36
  }
37
37
  }
38
- async function build() {
38
+ export async function build() {
39
39
  console.log("Building application...");
40
40
  await mkdir(join(process.cwd(), "dist"), {
41
41
  recursive: true
@@ -59,8 +59,5 @@ async function build() {
59
59
  console.log("Build completed!");
60
60
  console.log("Routes:", routes.map((r)=>r.path).join("\n"));
61
61
  }
62
- module.exports = {
63
- build
64
- };
65
62
 
66
63
  //# sourceMappingURL=build.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/build.ts"],"sourcesContent":["const { mkdir, readFile, writeFile } = require(\"node:fs/promises\");\nconst { dirname, join } = require(\"node:path\");\nconst { glob } = require(\"fast-glob\");\nconst React = require(\"react\");\nconst { generateStaticPage } = require(\"xplorajs-react\");\n\ninterface Route {\n\tpath: string;\n\tfile: string;\n\tisDynamic: boolean;\n\tparams: string[];\n}\n\nfunction convertToRoute(filePath: string): Route {\n\tconst relativePath = filePath.replace(\"src/app/\", \"\");\n\tconst path = relativePath\n\t\t.replace(/\\.tsx$/, \"\")\n\t\t.replace(/\\/page$/, \"\")\n\t\t.replace(/\\[([^\\]]+)\\]/g, \":$1\");\n\n\tconst params = (relativePath.match(/\\[([^\\]]+)\\]/g) || []).map((param) =>\n\t\tparam.slice(1, -1),\n\t);\n\n\treturn {\n\t\tpath: path === \"page\" ? \"/\" : `/${path}`,\n\t\tfile: filePath,\n\t\tisDynamic: params.length > 0,\n\t\tparams,\n\t};\n}\n\nasync function processPage(page: string, route: Route) {\n\ttry {\n\t\tconst module = await import(join(process.cwd(), page));\n\t\tconst PageComponent = module.default;\n\n\t\tconst getStaticProps = module.getStaticProps;\n\t\tlet props = {};\n\n\t\tif (getStaticProps) {\n\t\t\tconst result = await getStaticProps();\n\t\t\tprops = result.props;\n\t\t}\n\n\t\tconst outputPath = join(process.cwd(), \"dist\", route.path, \"index.html\");\n\t\tawait generateStaticPage({\n\t\t\tcomponent: React.createElement(PageComponent, props),\n\t\t\toutputPath,\n\t\t\tprops,\n\t\t});\n\n\t\tconsole.log(`Generated ${outputPath}`);\n\t} catch (error) {\n\t\tconsole.error(`Error processing ${page}:`, error);\n\t}\n}\n\nasync function build() {\n\tconsole.log(\"Building application...\");\n\n\tawait mkdir(join(process.cwd(), \"dist\"), { recursive: true });\n\n\tconst pages = await glob(\"src/app/**/*.tsx\", {\n\t\tignore: [\"**/node_modules/**\"],\n\t});\n\n\tconst routes: Route[] = [];\n\n\tfor (const page of pages) {\n\t\tconst route = convertToRoute(page);\n\t\troutes.push(route);\n\t\tawait processPage(page, route);\n\t}\n\n\tconst routesConfig = {\n\t\troutes,\n\t\tgeneratedAt: new Date().toISOString(),\n\t};\n\n\tawait writeFile(\n\t\tjoin(process.cwd(), \".xplora\", \"routes.json\"),\n\t\tJSON.stringify(routesConfig, null, 2),\n\t);\n\n\tconsole.log(\"Build completed!\");\n\tconsole.log(\"Routes:\", routes.map((r) => r.path).join(\"\\n\"));\n}\n\nmodule.exports = { build };\n"],"names":["mkdir","readFile","writeFile","require","dirname","join","glob","React","generateStaticPage","convertToRoute","filePath","relativePath","replace","path","params","match","map","param","slice","file","isDynamic","length","processPage","page","route","module","process","cwd","PageComponent","default","getStaticProps","props","result","outputPath","component","createElement","console","log","error","build","recursive","pages","ignore","routes","push","routesConfig","generatedAt","Date","toISOString","JSON","stringify","r","exports"],"mappings":"AAAA,MAAM,EAAEA,KAAK,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,QAAQ;AAC/C,MAAM,EAAEC,OAAO,EAAEC,IAAI,EAAE,GAAGF,QAAQ;AAClC,MAAM,EAAEG,IAAI,EAAE,GAAGH,QAAQ;AACzB,MAAMI,QAAQJ,QAAQ;AACtB,MAAM,EAAEK,kBAAkB,EAAE,GAAGL,QAAQ;AASvC,SAASM,eAAeC,QAAgB;IACvC,MAAMC,eAAeD,SAASE,OAAO,CAAC,YAAY;IAClD,MAAMC,OAAOF,aACXC,OAAO,CAAC,UAAU,IAClBA,OAAO,CAAC,WAAW,IACnBA,OAAO,CAAC,iBAAiB;IAE3B,MAAME,SAAS,AAACH,CAAAA,aAAaI,KAAK,CAAC,oBAAoB,EAAE,AAAD,EAAGC,GAAG,CAAC,CAACC,QAC/DA,MAAMC,KAAK,CAAC,GAAG,CAAC;IAGjB,OAAO;QACNL,MAAMA,SAAS,SAAS,MAAM,CAAC,CAAC,EAAEA,MAAM;QACxCM,MAAMT;QACNU,WAAWN,OAAOO,MAAM,GAAG;QAC3BP;IACD;AACD;AAEA,eAAeQ,YAAYC,IAAY,EAAEC,KAAY;IACpD,IAAI;QACH,MAAMC,UAAS,MAAM,MAAM,CAACpB,KAAKqB,QAAQC,GAAG,IAAIJ;QAChD,MAAMK,gBAAgBH,QAAOI,OAAO;QAEpC,MAAMC,iBAAiBL,QAAOK,cAAc;QAC5C,IAAIC,QAAQ,CAAC;QAEb,IAAID,gBAAgB;YACnB,MAAME,SAAS,MAAMF;YACrBC,QAAQC,OAAOD,KAAK;QACrB;QAEA,MAAME,aAAa5B,KAAKqB,QAAQC,GAAG,IAAI,QAAQH,MAAMX,IAAI,EAAE;QAC3D,MAAML,mBAAmB;YACxB0B,WAAW3B,MAAM4B,aAAa,CAACP,eAAeG;YAC9CE;YACAF;QACD;QAEAK,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAEJ,YAAY;IACtC,EAAE,OAAOK,OAAO;QACfF,QAAQE,KAAK,CAAC,CAAC,iBAAiB,EAAEf,KAAK,CAAC,CAAC,EAAEe;IAC5C;AACD;AAEA,eAAeC;IACdH,QAAQC,GAAG,CAAC;IAEZ,MAAMrC,MAAMK,KAAKqB,QAAQC,GAAG,IAAI,SAAS;QAAEa,WAAW;IAAK;IAE3D,MAAMC,QAAQ,MAAMnC,KAAK,oBAAoB;QAC5CoC,QAAQ;YAAC;SAAqB;IAC/B;IAEA,MAAMC,SAAkB,EAAE;IAE1B,KAAK,MAAMpB,QAAQkB,MAAO;QACzB,MAAMjB,QAAQf,eAAec;QAC7BoB,OAAOC,IAAI,CAACpB;QACZ,MAAMF,YAAYC,MAAMC;IACzB;IAEA,MAAMqB,eAAe;QACpBF;QACAG,aAAa,IAAIC,OAAOC,WAAW;IACpC;IAEA,MAAM9C,UACLG,KAAKqB,QAAQC,GAAG,IAAI,WAAW,gBAC/BsB,KAAKC,SAAS,CAACL,cAAc,MAAM;IAGpCT,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC,WAAWM,OAAO3B,GAAG,CAAC,CAACmC,IAAMA,EAAEtC,IAAI,EAAER,IAAI,CAAC;AACvD;AAEAoB,OAAO2B,OAAO,GAAG;IAAEb;AAAM"}
1
+ {"version":3,"sources":["../../src/commands/build.ts"],"sourcesContent":["import { mkdir, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { glob } from \"fast-glob\";\nimport React from \"react\";\nimport { generateStaticPage } from \"xplorajs-react\";\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 processPage(page: string, route: Route) {\n try {\n const module = await import(join(process.cwd(), page));\n const PageComponent = module.default;\n\n const getStaticProps = module.getStaticProps;\n let props = {};\n\n if (getStaticProps) {\n const result = await getStaticProps();\n props = result.props;\n }\n\n const outputPath = join(process.cwd(), \"dist\", route.path, \"index.html\");\n await generateStaticPage({\n component: React.createElement(PageComponent, props),\n outputPath,\n props,\n });\n\n console.log(`Generated ${outputPath}`);\n } catch (error) {\n console.error(`Error processing ${page}:`, error);\n }\n}\n\nexport async function build() {\n console.log(\"Building application...\");\n\n await mkdir(join(process.cwd(), \"dist\"), { recursive: true });\n\n const pages = await glob(\"src/app/**/*.tsx\", {\n ignore: [\"**/node_modules/**\"],\n });\n\n const routes: Route[] = [];\n\n for (const page of pages) {\n const route = convertToRoute(page);\n routes.push(route);\n await processPage(page, route);\n }\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 console.log(\"Build completed!\");\n console.log(\"Routes:\", routes.map((r) => r.path).join(\"\\n\"));\n}\n"],"names":["mkdir","writeFile","join","glob","React","generateStaticPage","convertToRoute","filePath","relativePath","replace","path","params","match","map","param","slice","file","isDynamic","length","processPage","page","route","module","process","cwd","PageComponent","default","getStaticProps","props","result","outputPath","component","createElement","console","log","error","build","recursive","pages","ignore","routes","push","routesConfig","generatedAt","Date","toISOString","JSON","stringify","r"],"mappings":"AAAA,SAASA,KAAK,EAAEC,SAAS,QAAQ,mBAAmB;AACpD,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,IAAI,QAAQ,YAAY;AACjC,OAAOC,WA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IAE3D,MAAMC,QAAQ,MAAMnC,KAAK,oBAAoB;QAC3CoC,QAAQ;YAAC;SAAqB;IAChC;IAEA,MAAMC,SAAkB,EAAE;IAE1B,KAAK,MAAMpB,QAAQkB,MAAO;QACxB,MAAMjB,QAAQf,eAAec;QAC7BoB,OAAOC,IAAI,CAACpB;QACZ,MAAMF,YAAYC,MAAMC;IAC1B;IAEA,MAAMqB,eAAe;QACnBF;QACAG,aAAa,IAAIC,OAAOC,WAAW;IACrC;IAEA,MAAM5C,UACJC,KAAKqB,QAAQC,GAAG,IAAI,WAAW,gBAC/BsB,KAAKC,SAAS,CAACL,cAAc,MAAM;IAGrCT,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC,WAAWM,OAAO3B,GAAG,CAAC,CAACmC,IAAMA,EAAEtC,IAAI,EAAER,IAAI,CAAC;AACxD"}
@@ -0,0 +1 @@
1
+ export declare function dev(): Promise<void>;
@@ -1,20 +1,19 @@
1
- const { readFileSync } = require("node:fs");
2
- const { join } = require("node:path");
3
- const { serve } = require("bun");
4
- const { watch } = require("chokidar");
5
- const React = require("react");
6
- const type = require("react");
7
- const { WebSocketServer } = require("ws");
8
- const { renderToStream } = require("xplorajs-react");
9
- const { build } = require("./build");
1
+ import { readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { serve } from "bun";
4
+ import { watch } from "chokidar";
5
+ import React from "react";
6
+ import { WebSocketServer } from "ws";
7
+ import { renderToStream } from "xplorajs-react";
8
+ import { build } from "./build";
10
9
  const pages = new Map();
11
10
  async function loadPages() {
12
11
  pages.clear();
13
12
  const routes = await loadRoutes();
14
13
  for (const route of routes){
15
14
  const abs = join(process.cwd(), route.file);
16
- delete require.cache?.[abs];
17
- pages.set(route.path, require(abs).default);
15
+ delete import.meta.require?.cache?.[abs];
16
+ pages.set(route.path, (await import(abs)).default);
18
17
  }
19
18
  }
20
19
  async function loadRoutes() {
@@ -26,7 +25,7 @@ async function loadRoutes() {
26
25
  return [];
27
26
  }
28
27
  }
29
- async function dev() {
28
+ export async function dev() {
30
29
  console.log("Starting development server...");
31
30
  const wss = new WebSocketServer({
32
31
  port: 3001
@@ -51,12 +50,8 @@ async function dev() {
51
50
  });
52
51
  await build();
53
52
  await loadPages();
54
- const config = {
55
- port: 3000,
56
- hmr: true
57
- };
58
53
  serve({
59
- port: config.port,
54
+ port: 3000,
60
55
  development: true,
61
56
  async fetch (req) {
62
57
  const url = new URL(req.url);
@@ -127,8 +122,5 @@ async function dev() {
127
122
  });
128
123
  console.log("Development server running at http://localhost:3000");
129
124
  }
130
- module.exports = {
131
- dev
132
- };
133
125
 
134
126
  //# sourceMappingURL=dev.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/dev.ts"],"sourcesContent":["const { readFileSync } = require(\"node:fs\");\nconst { join } = require(\"node:path\");\nconst { serve } = require(\"bun\");\nconst { watch } = require(\"chokidar\");\nconst React = require(\"react\");\nconst type = require(\"react\");\nconst { WebSocketServer } = require(\"ws\");\nconst { renderToStream } = require(\"xplorajs-react\");\nconst { build } = require(\"./build\");\n\nconst pages = new Map();\n\nasync function loadPages() {\n pages.clear();\n const routes = await loadRoutes();\n\n for (const route of routes) {\n const abs = join(process.cwd(), route.file);\n delete require.cache?.[abs];\n pages.set(route.path, require(abs).default);\n }\n}\n\nasync function loadRoutes() {\n try {\n const routesPath = join(process.cwd(), \".xplora\", \"routes.json\");\n const routesContent = readFileSync(routesPath, \"utf-8\");\n return JSON.parse(routesContent).routes;\n } catch {\n return [];\n }\n}\n\nasync 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) => {\n console.log(`File ${path} has been changed`);\n await build();\n await loadPages();\n\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 await build();\n await loadPages();\n\n const config = {\n port: 3000,\n hmr: true,\n };\n\n serve({\n port: config.port,\n development: true,\n async fetch(req) {\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 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 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\">\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 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\nmodule.exports = { dev };\n"],"names":["readFileSync","require","join","serve","watch","React","type","WebSocketServer","renderToStream","build","pages","Map","loadPages","clear","routes","loadRoutes","route","abs","process","cwd","file","cache","set","path","default","routesPath","routesContent","JSON","parse","dev","console","log","wss","port","watcher","ignored","persistent","on","client","clients","readyState","WebSocket","OPEN","send","stringify","config","hmr","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","module","exports"],"mappings":"AAAA,MAAM,EAAEA,YAAY,EAAE,GAAGC,QAAQ;AACjC,MAAM,EAAEC,IAAI,EAAE,GAAGD,QAAQ;AACzB,MAAM,EAAEE,KAAK,EAAE,GAAGF,QAAQ;AAC1B,MAAM,EAAEG,KAAK,EAAE,GAAGH,QAAQ;AAC1B,MAAMI,QAAQJ,QAAQ;AACtB,MAAMK,OAAOL,QAAQ;AACrB,MAAM,EAAEM,eAAe,EAAE,GAAGN,QAAQ;AACpC,MAAM,EAAEO,cAAc,EAAE,GAAGP,QAAQ;AACnC,MAAM,EAAEQ,KAAK,EAAE,GAAGR,QAAQ;AAE1B,MAAMS,QAAQ,IAAIC;AAElB,eAAeC;IACbF,MAAMG,KAAK;IACX,MAAMC,SAAS,MAAMC;IAErB,KAAK,MAAMC,SAASF,OAAQ;QAC1B,MAAMG,MAAMf,KAAKgB,QAAQC,GAAG,IA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I,CAAClB,KAAKgB,QAAQC,GAAG,IAAI,QAAQI;gBAC/C,IAAI,MAAMgC,EAAEE,MAAM,IAAI,OAAO,IAAIJ,SAASE;YAC5C;YAEA,MAAMG,OAAOhD,MAAMiD,GAAG,CAACpC;YACvB,IAAI,CAACmC,MAAM,OAAO,IAAIL,SAAS,aAAa;gBAAEO,QAAQ;YAAI;YAE1D,MAAMC,SAAS,MAAMrD,eAAeH,MAAMyD,aAAa,CAACJ;YAExD,MAAMK,OAAO,CAAC;;;;gCAIY,CAAC;YAE3B,MAAMC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;iBAsBH,CAAC;YAEZ,OAAO,IAAIX,SACT,IAAIY,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;gBAAEC,SAAS;oBAAE,gBAAgB;gBAA2B;YAAE;QAE9D;IACF;IAEA9C,QAAQC,GAAG,CAAC;AACd;AAEA8C,OAAOC,OAAO,GAAG;IAAEjD;AAAI"}
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 pages.clear();\n const routes = await loadRoutes();\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\nasync function loadRoutes() {\n try {\n const routesPath = join(process.cwd(), \".xplora\", \"routes.json\");\n const routesContent = readFileSync(routesPath, \"utf-8\");\n return JSON.parse(routesContent).routes;\n } catch {\n return [];\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 await build();\n await loadPages();\n\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 await build();\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 === \"/\") {\n return new Response(\"Hello from XploraJS!\");\n }\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 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\">\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 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":["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","Text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ACF;YACF,IACA;gBAAEC,SAAS;oBAAE,gBAAgB;gBAA2B;YAAE;QAE9D;IACF;IAEA7C,QAAQC,GAAG,CAAC;AACd"}
@@ -0,0 +1 @@
1
+ export declare function start(): Promise<void>;
@@ -1,7 +1,5 @@
1
- const { serve } = require("bun");
2
- const { readFileSync } = require("node:fs");
3
- const { join } = require("node:path");
4
- async function start() {
1
+ import { serve } from "bun";
2
+ export async function start() {
5
3
  console.log("Starting production server...");
6
4
  const config = {
7
5
  port: 3000
@@ -21,8 +19,5 @@ async function start() {
21
19
  });
22
20
  console.log("Production server running at http://localhost:3000");
23
21
  }
24
- module.exports = {
25
- start
26
- };
27
22
 
28
23
  //# sourceMappingURL=start.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/start.ts"],"sourcesContent":["const { serve } = require(\"bun\");\n\nconst { readFileSync } = require(\"node:fs\");\nconst { join } = require(\"node:path\");\n\nasync 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\nmodule.exports = { start };\n"],"names":["serve","require","readFileSync","join","start","console","log","config","port","fetch","req","url","URL","path","pathname","Response","status","module","exports"],"mappings":"AAAA,MAAM,EAAEA,KAAK,EAAE,GAAGC,QAAQ;AAE1B,MAAM,EAAEC,YAAY,EAAE,GAAGD,QAAQ;AACjC,MAAM,EAAEE,IAAI,EAAE,GAAGF,QAAQ;AAEzB,eAAeG;IACbC,QAAQC,GAAG,CAAC;IAEZ,MAAMC,SAAS;QACbC,MAAM;IACR;IAEAR,MAAM;QACJQ,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;AAEAW,OAAOC,OAAO,GAAG;IAAEd;AAAM"}
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"}
@@ -0,0 +1,18 @@
1
+ interface XploraConfig {
2
+ dev?: {
3
+ port?: number;
4
+ hmr?: boolean;
5
+ };
6
+ static?: {
7
+ outputDir?: string;
8
+ revalidate?: number;
9
+ fallback?: boolean;
10
+ };
11
+ build?: {
12
+ minify?: boolean;
13
+ sourcemap?: boolean;
14
+ };
15
+ }
16
+ declare function defineConfig(config: XploraConfig): XploraConfig;
17
+ export type { XploraConfig };
18
+ export { defineConfig };
package/dist/config.js CHANGED
@@ -18,9 +18,6 @@ function defineConfig(config) {
18
18
  }
19
19
  };
20
20
  }
21
- module.exports = {
22
- XploraConfig,
23
- defineConfig
24
- };
21
+ export { defineConfig };
25
22
 
26
23
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config.ts"],"sourcesContent":["interface XploraConfig {\n\tdev?: {\n\t\tport?: number;\n\t\thmr?: boolean;\n\t};\n\tstatic?: {\n\t\toutputDir?: string;\n\t\trevalidate?: number;\n\t\tfallback?: boolean;\n\t};\n\tbuild?: {\n\t\tminify?: boolean;\n\t\tsourcemap?: boolean;\n\t};\n}\n\nfunction defineConfig(config: XploraConfig): XploraConfig {\n\treturn {\n\t\tdev: {\n\t\t\tport: 3000,\n\t\t\thmr: true,\n\t\t\t...config.dev,\n\t\t},\n\t\tstatic: {\n\t\t\toutputDir: \"./dist\",\n\t\t\trevalidate: 3600,\n\t\t\tfallback: false,\n\t\t\t...config.static,\n\t\t},\n\t\tbuild: {\n\t\t\tminify: true,\n\t\t\tsourcemap: true,\n\t\t\t...config.build,\n\t\t},\n\t};\n}\n\nmodule.exports = {\n\tXploraConfig,\n\tdefineConfig,\n};\n"],"names":["defineConfig","config","dev","port","hmr","static","outputDir","revalidate","fallback","build","minify","sourcemap","module","exports","XploraConfig"],"mappings":"AAgBA,SAASA,aAAaC,MAAoB;IACzC,OAAO;QACNC,KAAK;YACJC,MAAM;YACNC,KAAK;YACL,GAAGH,OAAOC,GAAG;QACd;QACAG,QAAQ;YACPC,WAAW;YACXC,YAAY;YACZC,UAAU;YACV,GAAGP,OAAOI,MAAM;QACjB;QACAI,OAAO;YACNC,QAAQ;YACRC,WAAW;YACX,GAAGV,OAAOQ,KAAK;QAChB;IACD;AACD;AAEAG,OAAOC,OAAO,GAAG;IAChBC;IACAd;AACD"}
1
+ {"version":3,"sources":["../src/config.ts"],"sourcesContent":["interface XploraConfig {\n dev?: {\n port?: number;\n hmr?: boolean;\n };\n static?: {\n outputDir?: string;\n revalidate?: number;\n fallback?: boolean;\n };\n build?: {\n minify?: boolean;\n sourcemap?: boolean;\n };\n}\n\nfunction defineConfig(config: XploraConfig): XploraConfig {\n return {\n dev: {\n port: 3000,\n hmr: true,\n ...config.dev,\n },\n static: {\n outputDir: \"./dist\",\n revalidate: 3600,\n fallback: false,\n ...config.static,\n },\n build: {\n minify: true,\n sourcemap: true,\n ...config.build,\n },\n };\n}\n\nexport type { XploraConfig };\nexport { defineConfig };\n"],"names":["defineConfig","config","dev","port","hmr","static","outputDir","revalidate","fallback","build","minify","sourcemap"],"mappings":"AAgBA,SAASA,aAAaC,MAAoB;IACxC,OAAO;QACLC,KAAK;YACHC,MAAM;YACNC,KAAK;YACL,GAAGH,OAAOC,GAAG;QACf;QACAG,QAAQ;YACNC,WAAW;YACXC,YAAY;YACZC,UAAU;YACV,GAAGP,OAAOI,MAAM;QAClB;QACAI,OAAO;YACLC,QAAQ;YACRC,WAAW;YACX,GAAGV,OAAOQ,KAAK;QACjB;IACF;AACF;AAGA,SAAST,YAAY,GAAG"}
@@ -0,0 +1,2 @@
1
+ declare const defineConfig: any;
2
+ export { defineConfig };
package/dist/index.js CHANGED
@@ -3,5 +3,6 @@ module.exports = {
3
3
  XploraConfig,
4
4
  defineConfig
5
5
  };
6
+ export { defineConfig };
6
7
 
7
8
  //# 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};\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"}
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"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "xplorajs",
3
- "version": "0.1.9",
3
+ "version": "0.3.1",
4
+ "type": "module",
4
5
  "main": "dist/index.js",
5
6
  "types": "dist/index.d.ts",
6
7
  "bin": {
@@ -12,17 +13,17 @@
12
13
  ],
13
14
  "scripts": {
14
15
  "dev": "bun run build --watch",
15
- "build": "swc src -d dist --config-file .swcrc",
16
+ "build": "swc src -d dist --config-file .swcrc && tsc --emitDeclarationOnly",
16
17
  "prepublishOnly": "bun run build"
17
18
  },
18
19
  "dependencies": {
19
20
  "@swc/cli": "^0.1.65",
20
21
  "@swc/core": "^1.11.24",
21
22
  "chokidar": "^3.6.0",
22
- "commander": "^11.0.0",
23
+ "commander": "^11.1.0",
23
24
  "fast-glob": "^3.3.3",
24
25
  "ws": "^8.18.2",
25
- "xplorajs-react": "latest"
26
+ "xplorajs-react": "^0.2.0"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@types/bun": "^1.2.13",
@@ -31,7 +32,9 @@
31
32
  },
32
33
  "peerDependencies": {
33
34
  "react": "^19.1.0",
34
- "react-dom": "^19.1.0"
35
+ "react-dom": "^19.1.0",
36
+ "@types/react": "^19.1.4",
37
+ "@types/react-dom": "^19.1.5"
35
38
  },
36
39
  "publishConfig": {
37
40
  "access": "public"
package/dist/app/page.js DELETED
@@ -1,7 +0,0 @@
1
- export default function Home() {
2
- return /*#__PURE__*/ React.createElement("section", {
3
- className: "flex h-screen items-center justify-center bg-gray-100"
4
- }, /*#__PURE__*/ React.createElement("h1", {
5
- className: "text-4xl font-bold text-teal-600"
6
- }, "XploraJS \uD83D\uDE80"));
7
- }