oxidejs 0.1.0 → 0.1.2

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/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as useEnv, i as useCtx, n as unpluginFactory, o as useFetchCtx, r as vite, s as useRequest, t as oxidejs } from "./src-CIjvqMo2.mjs";
1
+ import { a as useEnv, i as useCtx, n as unpluginFactory, o as useFetchCtx, r as vite, s as useRequest, t as oxidejs } from "./src-w2Bg2KiM.mjs";
2
2
  export { oxidejs as default, oxidejs, unpluginFactory, useCtx, useEnv, useFetchCtx, useRequest, vite };
package/dist/rsbuild.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as oxidejs } from "./src-CIjvqMo2.mjs";
1
+ import { t as oxidejs } from "./src-w2Bg2KiM.mjs";
2
2
  //#region src/rsbuild.ts
3
3
  var rsbuild_default = oxidejs.rsbuild;
4
4
  //#endregion
@@ -474,14 +474,23 @@ function applyViteEnvironments(config, opts) {
474
474
  config.builder ??= {};
475
475
  config.environments ??= {};
476
476
  const celld = opts.preset === "celld";
477
- config.environments["server"] = {
477
+ config.environments["ssr"] = {
478
478
  consumer: "server",
479
479
  build: {
480
480
  outDir: opts.outDir,
481
481
  emptyOutDir: true,
482
482
  ssr: true,
483
+ rolldownOptions: {
484
+ input: VIRTUAL_WORKER_ID,
485
+ external: celld ? [/^cloudflare:/] : [],
486
+ output: {
487
+ format: "es",
488
+ entryFileNames: "server.js"
489
+ }
490
+ },
483
491
  rollupOptions: {
484
492
  input: VIRTUAL_WORKER_ID,
493
+ external: celld ? [/^cloudflare:/] : [],
485
494
  output: {
486
495
  format: "es",
487
496
  entryFileNames: "server.js"
@@ -494,8 +503,9 @@ function applyViteEnvironments(config, opts) {
494
503
  } : { noExternal: true },
495
504
  ssr: celld ? {
496
505
  target: "webworker",
497
- noExternal: true
498
- } : { noExternal: true }
506
+ noExternal: true,
507
+ external: [/^cloudflare:/]
508
+ } : { noExternal: ["tacho"] }
499
509
  };
500
510
  config.build ??= {};
501
511
  if (opts.hasClient) {
@@ -511,7 +521,7 @@ function applyViteEnvironments(config, opts) {
511
521
  manifest: true
512
522
  }
513
523
  };
514
- config.environments["server"].build.emptyOutDir = false;
524
+ config.environments["ssr"].build.emptyOutDir = false;
515
525
  config.build.outDir ??= clientOutDir;
516
526
  config.build.manifest ??= true;
517
527
  } else {
@@ -520,7 +530,7 @@ function applyViteEnvironments(config, opts) {
520
530
  config.build.outDir ??= opts.outDir;
521
531
  config.build.emptyOutDir ??= true;
522
532
  config.builder.buildApp ??= async (builder) => {
523
- const server = builder.environments["server"];
533
+ const server = builder.environments["ssr"];
524
534
  if (server) await builder.build(server);
525
535
  };
526
536
  }
@@ -599,14 +609,23 @@ function actionMiddleware(loadRouter) {
599
609
  return;
600
610
  }
601
611
  (async () => {
602
- const { handle } = await import("tacho/transport/fetch");
612
+ const { handle } = await import(
613
+ /* @vite-ignore */
614
+ "tacho/transport/fetch"
615
+ );
603
616
  await sendWebResponseFrom(req, res, await handle(await loadRouter(), { path: ACTION_PATH })(await nodeToWebRequest(req)));
604
617
  })().catch(next);
605
618
  };
606
619
  }
607
620
  function attachActionUpgrade(httpServer, loadRouter) {
608
621
  if (!httpServer) return;
609
- Promise.all([import("tacho/transport/ws"), import("crossws/adapters/node")]).then(([{ handle }, { default: crossws }]) => {
622
+ Promise.all([import(
623
+ /* @vite-ignore */
624
+ "tacho/transport/ws"
625
+ ), import(
626
+ /* @vite-ignore */
627
+ "crossws/adapters/node"
628
+ )]).then(([{ handle }, { default: crossws }]) => {
610
629
  httpServer.on("upgrade", (req, socket, head) => {
611
630
  if ((req.url ?? "").split("?")[0] !== "/_action") return;
612
631
  loadRouter().then((router) => crossws({ hooks: handle(router, { path: ACTION_PATH }) }).handleUpgrade(req, socket, head)).catch(() => {
@@ -735,7 +754,7 @@ const unpluginFactory = (options) => {
735
754
  }
736
755
  };
737
756
  };
738
- const oxidejs = createUnplugin(unpluginFactory);
739
- const vite = oxidejs.vite;
757
+ const oxidejs = /* @__PURE__ */ createUnplugin(unpluginFactory);
758
+ const vite = /* @__PURE__ */ (() => oxidejs.vite)();
740
759
  //#endregion
741
760
  export { useEnv as a, useCtx as i, unpluginFactory as n, useFetchCtx as o, vite as r, useRequest as s, oxidejs as t };
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as oxidejs } from "./src-CIjvqMo2.mjs";
1
+ import { t as oxidejs } from "./src-w2Bg2KiM.mjs";
2
2
  //#region src/vite.ts
3
3
  var vite_default = oxidejs.vite;
4
4
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxidejs",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Vite/Rsbuild plugin. One build → dist/server.js + optional client. Server actions via *.server.ts.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -59,7 +59,7 @@
59
59
  "unplugin": "^3.3.0"
60
60
  },
61
61
  "devDependencies": {
62
- "tacho": "workspace:*"
62
+ "tacho": "^0.4.1"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@rsbuild/core": "*",