dinou 7.3.0 → 8.0.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.
Files changed (113) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +1 -1
  3. package/cli.js +42 -39
  4. package/dinou/adapters/netlify.js +1 -0
  5. package/dinou/adapters/{node.mjs → node.js} +9 -3
  6. package/dinou/bun/{build.mjs → build.js} +12 -11
  7. package/dinou/cloudflare/{build.mjs → build.js} +15 -11
  8. package/dinou/cloudflare/shims/fs.js +3 -0
  9. package/dinou/constants.js +3 -3
  10. package/dinou/core/asset-extensions.js +5 -5
  11. package/dinou/core/bailout-proxy.js +3 -3
  12. package/dinou/core/build-static-pages.js +21 -17
  13. package/dinou/core/cache-revalidate.js +14 -33
  14. package/dinou/core/cache-slot.js +21 -10
  15. package/dinou/core/config.js +2 -5
  16. package/dinou/core/createScopedName.js +3 -3
  17. package/dinou/core/dinou-paths.js +15 -12
  18. package/dinou/core/{export-static.mjs → export-static.js} +1 -1
  19. package/dinou/core/generate-route-types.js +8 -3
  20. package/dinou/core/generate-static-page.js +6 -5
  21. package/dinou/core/generate-static-rsc.js +15 -10
  22. package/dinou/core/generate-static.js +11 -10
  23. package/dinou/core/generating-isg.js +12 -11
  24. package/dinou/core/get-abs-path-with-ext.js +8 -6
  25. package/dinou/core/get-asset-from-manifest.js +4 -4
  26. package/dinou/core/get-error-jsx.js +12 -9
  27. package/dinou/core/get-file-path-and-dynamic-params.js +7 -4
  28. package/dinou/core/get-jsx.js +19 -13
  29. package/dinou/core/handler.js +73 -33
  30. package/dinou/core/http-adapter.js +6 -2
  31. package/dinou/core/import-module.js +5 -4
  32. package/dinou/core/layout-functions.js +11 -6
  33. package/dinou/core/load-dinou-config.js +10 -4
  34. package/dinou/core/manifest-provider.js +11 -4
  35. package/dinou/core/parse-exports.js +11 -6
  36. package/dinou/core/path-utils.js +2 -2
  37. package/dinou/core/ppr-context.js +11 -11
  38. package/dinou/core/ppr-runtime.js +10 -6
  39. package/dinou/core/render-jsx-to-client-jsx.js +6 -3
  40. package/dinou/core/request-context.js +11 -7
  41. package/dinou/core/resolve-module-ppr.js +2 -2
  42. package/dinou/core/resolve-setup-files.js +70 -69
  43. package/dinou/core/revalidating.js +14 -25
  44. package/dinou/core/route-generator.js +12 -8
  45. package/dinou/core/rsc-renderer.js +13 -2
  46. package/dinou/core/run-ssg.js +9 -4
  47. package/dinou/core/safe-rename.js +3 -3
  48. package/dinou/core/scan-dependency-components.js +9 -3
  49. package/dinou/core/status-manifest.js +5 -5
  50. package/dinou/core/storage-adapter.js +13 -3
  51. package/dinou/core/url-resolver.js +2 -2
  52. package/dinou/core/vfs.js +7 -7
  53. package/dinou/deno/{build.mjs → build.js} +12 -11
  54. package/dinou/esbuild/{build.mjs → build.js} +4 -4
  55. package/dinou/esbuild/{dev.mjs → dev.js} +6 -6
  56. package/dinou/esbuild/helpers-esbuild/{get-config-esbuild-prod.mjs → get-config-esbuild-prod.js} +7 -7
  57. package/dinou/esbuild/helpers-esbuild/{get-config-esbuild.mjs → get-config-esbuild.js} +8 -8
  58. package/dinou/esbuild/helpers-esbuild/{get-esbuild-entries.mjs → get-esbuild-entries.js} +2 -2
  59. package/dinou/esbuild/plugins-esbuild/{assets-plugin.mjs → assets-plugin.js} +1 -1
  60. package/dinou/esbuild/plugins-esbuild/{stable-chunk-names-and-maps-plugin.mjs → stable-chunk-names-and-maps-plugin.js} +1 -1
  61. package/dinou/esbuild/plugins-esbuild/{write-plugin.mjs → write-plugin.js} +1 -1
  62. package/dinou/esbuild/plugins-postcss/postcss-extract-plugin.js +4 -3
  63. package/dinou/esbuild/react-refresh/babel-config.js +5 -1
  64. package/dinou/esbuild/react-refresh/esm-hmr/server.js +7 -4
  65. package/dinou/esbuild/react-refresh/{esm-hmr-plugin.mjs → esm-hmr-plugin.js} +4 -4
  66. package/dinou/esbuild/react-refresh/{react-refresh-runtime.mjs → react-refresh-runtime.js} +1 -1
  67. package/dinou/index.js +40 -19
  68. package/dinou/node/{build.mjs → build.js} +4 -4
  69. package/dinou/node/{bundle-dual-engine.mjs → bundle-dual-engine.js} +13 -12
  70. package/dinou/node/{dev.mjs → dev.js} +27 -22
  71. package/dinou/node/{terminal-status.mjs → terminal-status.js} +1 -1
  72. package/dinou/package.json +8 -7
  73. package/dinou/rollup/postcss.config.js +1 -1
  74. package/dinou/rollup/react-refresh/esm-hmr/server.js +7 -4
  75. package/dinou/rollup/react-refresh/react-refresh-wrap-modules.js +2 -1
  76. package/dinou/rollup/react-refresh/rollup-plugin-esm-hmr.js +23 -16
  77. package/dinou/rollup/rollup-plugins/dinou-asset-plugin.js +6 -5
  78. package/dinou/rollup/rollup-plugins/manifest-generator-plugin.js +2 -1
  79. package/dinou/rollup/rollup-plugins/rollup-plugin-memory.js +3 -2
  80. package/dinou/rollup/rollup-plugins/rollup-plugin-react-client-manifest.js +16 -13
  81. package/dinou/rollup/rollup-plugins/rollup-plugin-server-functions.js +7 -6
  82. package/dinou/rollup/rollup-plugins/rollup-plugin-swc.js +6 -3
  83. package/dinou/rollup/rollup.config.js +27 -23
  84. package/dinou/server.js +21 -26
  85. package/dinou/webpack/helpers/get-webpack-entries.js +14 -11
  86. package/dinou/webpack/loaders/server-functions-loader.js +5 -6
  87. package/dinou/webpack/loaders/swc-loader.js +4 -2
  88. package/dinou/webpack/plugins/manifest-generator-plugin.js +3 -1
  89. package/dinou/webpack/plugins/server-functions-plugin.js +4 -3
  90. package/dinou/webpack/plugins/webpack-memory-plugin.js +3 -2
  91. package/dinou/webpack/postcss.config.js +1 -1
  92. package/dinou/webpack/webpack.config.js +22 -20
  93. package/eject.js +54 -47
  94. package/package.json +9 -8
  95. package/dinou/config.js +0 -1
  96. package/dinou/config.mjs +0 -2
  97. package/dinou/core/css-require-hook.js +0 -64
  98. package/dinou/index.mjs +0 -43
  99. package/dinou/server.mjs +0 -30
  100. /package/dinou/esbuild/helpers-esbuild/{normalize-path.mjs → normalize-path.js} +0 -0
  101. /package/dinou/esbuild/helpers-esbuild/{strip-namespace.mjs → strip-namespace.js} +0 -0
  102. /package/dinou/esbuild/helpers-esbuild/{swc-disk-cache.mjs → swc-disk-cache.js} +0 -0
  103. /package/dinou/esbuild/helpers-esbuild/{update-manifest-for-module.mjs → update-manifest-for-module.js} +0 -0
  104. /package/dinou/esbuild/helpers-esbuild/{write.mjs → write.js} +0 -0
  105. /package/dinou/esbuild/plugins-esbuild/{babel-react-compiler-plugin.mjs → babel-react-compiler-plugin.js} +0 -0
  106. /package/dinou/esbuild/plugins-esbuild/{css-processor-plugin.mjs → css-processor-plugin.js} +0 -0
  107. /package/dinou/esbuild/plugins-esbuild/{manifest-generator-plugin.mjs → manifest-generator-plugin.js} +0 -0
  108. /package/dinou/esbuild/plugins-esbuild/{react-client-manifest-plugin.mjs → react-client-manifest-plugin.js} +0 -0
  109. /package/dinou/esbuild/plugins-esbuild/{server-functions-plugin.mjs → server-functions-plugin.js} +0 -0
  110. /package/dinou/esbuild/plugins-esbuild/{skip-missing-entry-points-plugin.mjs → skip-missing-entry-points-plugin.js} +0 -0
  111. /package/dinou/esbuild/react-refresh/esm-hmr/{client.mjs → client.js} +0 -0
  112. /package/dinou/esbuild/react-refresh/{is-react-refresh-boundary.mjs → is-react-refresh-boundary.js} +0 -0
  113. /package/dinou/node/{port-selector.mjs → port-selector.js} +0 -0
@@ -4,7 +4,7 @@ import createScopedName from "../../core/createScopedName.js";
4
4
  import { regex } from "../../core/asset-extensions.js";
5
5
  import { getAbsPathWithExt } from "../../core/get-abs-path-with-ext.js";
6
6
  import { pathToFileURL } from "node:url";
7
- import stripNamespace from "../helpers-esbuild/strip-namespace.mjs";
7
+ import stripNamespace from "../helpers-esbuild/strip-namespace.js";
8
8
 
9
9
  const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
10
10
 
@@ -1,5 +1,5 @@
1
1
  import path from "node:path";
2
- import stripNamespace from "../helpers-esbuild/strip-namespace.mjs";
2
+ import stripNamespace from "../helpers-esbuild/strip-namespace.js";
3
3
 
4
4
  const normKey = (p) => {
5
5
  if (!p) return "";
@@ -1,4 +1,4 @@
1
- import write from "../helpers-esbuild/write.mjs";
1
+ import write from "../helpers-esbuild/write.js";
2
2
 
3
3
  export default function writePlugin() {
4
4
  return {
@@ -1,6 +1,6 @@
1
1
  // postcss-extract-plugin.js
2
- const fs = require("fs");
3
- const path = require("path");
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
4
 
5
5
  let cachedExtractedCSS = "";
6
6
  let cachedCSSBuffer = null;
@@ -71,4 +71,5 @@ const createPostCSSExtractPlugin = (options = {}) => {
71
71
  };
72
72
  };
73
73
 
74
- module.exports = createPostCSSExtractPlugin;
74
+ export { createPostCSSExtractPlugin };
75
+ export default createPostCSSExtractPlugin;
@@ -1,3 +1,6 @@
1
+ import { createRequire } from "node:module";
2
+ const require = createRequire(import.meta.url);
3
+
1
4
  const babelConfig = {
2
5
  presets: [
3
6
  ["@babel/preset-react", { runtime: "automatic" }],
@@ -10,4 +13,5 @@ const babelConfig = {
10
13
  exclude: /node_modules[\\/](?!dinou|react-refresh)/,
11
14
  };
12
15
 
13
- module.exports.babelConfig = babelConfig;
16
+ export { babelConfig };
17
+ export default babelConfig;
@@ -1,4 +1,6 @@
1
- const WebSocket = require("ws");
1
+ import WebSocket, { WebSocketServer } from "ws";
2
+
3
+ const Server = WebSocketServer || WebSocket.Server;
2
4
 
3
5
  /**
4
6
  * @typedef {Object} Dependency
@@ -15,8 +17,8 @@ class EsmHmrEngine {
15
17
  this.clients = set;
16
18
  this.dependencyTree = map;
17
19
  const wss = options.server
18
- ? new WebSocket.Server({ noServer: true })
19
- : new WebSocket.Server({ port: options.port || Number(process.env.HMR_PORT) || 3001 });
20
+ ? new Server({ noServer: true })
21
+ : new Server({ port: options.port || Number(process.env.HMR_PORT) || 3001 });
20
22
 
21
23
  if (options.server) {
22
24
  options.server.on("upgrade", (req, socket, head) => {
@@ -129,6 +131,7 @@ class EsmHmrEngine {
129
131
  }
130
132
  }
131
133
 
132
- module.exports = {
134
+ export {
133
135
  EsmHmrEngine,
134
136
  };
137
+ export default EsmHmrEngine;
@@ -6,9 +6,9 @@ import { transform } from "@swc/core";
6
6
  import { createServer } from "node:http";
7
7
  import { EsmHmrEngine } from "./esm-hmr/server.js";
8
8
  import { fileURLToPath } from "node:url";
9
- import write from "../helpers-esbuild/write.mjs";
10
- import normalizePath from "../helpers-esbuild/normalize-path.mjs";
11
- import stripNamespace from "../helpers-esbuild/strip-namespace.mjs";
9
+ import write from "../helpers-esbuild/write.js";
10
+ import normalizePath from "../helpers-esbuild/normalize-path.js";
11
+ import stripNamespace from "../helpers-esbuild/strip-namespace.js";
12
12
 
13
13
  const norm = (p) => path.resolve(p).replace(/\\/g, "/");
14
14
  const normKey = (p) => {
@@ -155,7 +155,7 @@ export default function esmHmrPlugin({
155
155
  if (!result || !result.outputFiles) return;
156
156
  const clientPath = path.resolve(
157
157
  path.dirname(fileURLToPath(import.meta.url)),
158
- "./esm-hmr/client.mjs",
158
+ "./esm-hmr/client.js",
159
159
  );
160
160
  let clientCode = await fs.readFile(clientPath, "utf8");
161
161
  const isDebug =
@@ -1,5 +1,5 @@
1
1
  import RefreshRuntime from "/react-refresh-entry.js";
2
- import { isReactRefreshBoundary } from "./is-react-refresh-boundary.mjs";
2
+ import { isReactRefreshBoundary } from "./is-react-refresh-boundary.js";
3
3
 
4
4
  if (
5
5
  typeof window !== "undefined" &&
package/dinou/index.js CHANGED
@@ -1,22 +1,43 @@
1
- const contextModule = require("./core/request-context.js");
2
- const navigationModule = require("./core/navigation.js");
3
- const { defineConfig } = require("./core/config.js");
1
+ import { getContext } from "./core/request-context.js";
2
+ import {
3
+ usePathname,
4
+ useSearchParams,
5
+ useRouter,
6
+ refreshSlot,
7
+ useNavigationLoading,
8
+ } from "./core/navigation.js";
9
+ import { redirect } from "./core/redirect.jsx";
10
+ import { ClientRedirect } from "./core/client-redirect.jsx";
11
+ import { Link } from "./core/link.jsx";
4
12
 
5
- module.exports = {
13
+ function defineConfig(config) {
14
+ return config;
15
+ }
16
+
17
+ const dinou = {
6
18
  defineConfig,
7
- getContext: contextModule.getContext,
8
- usePathname: navigationModule.usePathname,
9
- useSearchParams: navigationModule.useSearchParams,
10
- useRouter: navigationModule.useRouter,
11
- refreshSlot: navigationModule.refreshSlot,
12
- useNavigationLoading: navigationModule.useNavigationLoading,
13
- get redirect() {
14
- return require("./core/redirect.jsx").redirect;
15
- },
16
- get ClientRedirect() {
17
- return require("./core/client-redirect.jsx").ClientRedirect;
18
- },
19
- get Link() {
20
- return require("./core/link.jsx").Link;
21
- },
19
+ getContext,
20
+ usePathname,
21
+ useSearchParams,
22
+ useRouter,
23
+ refreshSlot,
24
+ useNavigationLoading,
25
+ redirect,
26
+ ClientRedirect,
27
+ Link,
22
28
  };
29
+
30
+ export {
31
+ defineConfig,
32
+ getContext,
33
+ usePathname,
34
+ useSearchParams,
35
+ useRouter,
36
+ refreshSlot,
37
+ useNavigationLoading,
38
+ redirect,
39
+ ClientRedirect,
40
+ Link,
41
+ };
42
+
43
+ export default dinou;
@@ -1,5 +1,5 @@
1
- // dinou/node/build.mjs
2
- // Dual-Bundle Build script for packaging Dinou v7 for Node.js (Pre-bundled AOT Standalone).
1
+ // dinou/node/build.js
2
+ // Dual-Bundle Build script for packaging Dinou for Node.js (Pre-bundled AOT Standalone).
3
3
  // Pass A & Pass B: Handled via bundleDualEngine
4
4
  // Pass C: Main Node Orchestrator (.dinou/node/server.js)
5
5
 
@@ -7,7 +7,7 @@ import fs from "node:fs";
7
7
  import path from "node:path";
8
8
  import esbuild from "esbuild";
9
9
  import { fileURLToPath } from "node:url";
10
- import { bundleDualEngine } from "./bundle-dual-engine.mjs";
10
+ import { bundleDualEngine } from "./bundle-dual-engine.js";
11
11
 
12
12
  const projectRoot = process.cwd();
13
13
  const nodeDir = path.resolve(projectRoot, ".dinou/node");
@@ -15,7 +15,7 @@ fs.mkdirSync(nodeDir, { recursive: true });
15
15
 
16
16
  try {
17
17
  const bundlerName = process.env.DINOU_BUILD_TOOL || "esbuild";
18
- console.log(`\n🦖 Dinou v7 (Node.js • ${bundlerName})`);
18
+ console.log(`\n🦖 Dinou (Node.js • ${bundlerName})`);
19
19
  console.log(` ⚡ Compiling Pass A (RSC) and Pass B (SSR) via Dual-Engine...`);
20
20
  const engineResult = await bundleDualEngine({
21
21
  isDev: false,
@@ -6,22 +6,21 @@
6
6
  import fs from "node:fs";
7
7
  import path from "node:path";
8
8
  import esbuild from "esbuild";
9
- import { createRequire } from "node:module";
10
9
  import { fileURLToPath, pathToFileURL } from "node:url";
11
10
 
12
- const require = createRequire(import.meta.url);
13
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
- const { generateRouteModulesCode, generateRouteTypes } = require("../core/route-generator.js");
15
- const parseExports = require("../core/parse-exports.js");
16
- const { useClientRegex, useServerRegex } = require("../constants.js");
17
- const createScopedName = require("../core/createScopedName.js");
18
- const { regex: assetRegex } = require("../core/asset-extensions.js");
19
- const {
11
+ import { generateRouteModulesCode, generateRouteTypes } from "../core/route-generator.js";
12
+ import parseExports from "../core/parse-exports.js";
13
+ import { useClientRegex, useServerRegex } from "../constants.js";
14
+ import createScopedName from "../core/createScopedName.js";
15
+ import { regex as assetRegex } from "../core/asset-extensions.js";
16
+ import {
20
17
  isSupportedClientModule,
21
18
  scanProjectDependenciesForClientComponents,
22
- } = require("../core/scan-dependency-components.js");
23
- const { getDinouConfig } = require("../core/load-dinou-config.js");
24
- const { resolveSetupFiles } = require("../core/resolve-setup-files.js");
19
+ } from "../core/scan-dependency-components.js";
20
+ import { getDinouConfig } from "../core/load-dinou-config.js";
21
+ import { resolveSetupFiles } from "../core/resolve-setup-files.js";
22
+
23
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
25
24
 
26
25
  export async function bundleDualEngine(options = {}) {
27
26
  const isDev = Boolean(options.isDev);
@@ -695,6 +694,8 @@ globalThis.__DINOU_VFS__ = ${JSON.stringify(vfsSnapshot)};
695
694
  const rscEntryContent = `// Auto-generated RSC Engine entry for Node.js (Dual-Bundle)
696
695
  import "./env-setup.mjs";
697
696
  import "./route-modules.mjs";
697
+ import * as edgeRenderer from "react-server-dom-webpack/server.edge";
698
+ globalThis.__DINOU_EDGE_RENDERER__ = edgeRenderer;
698
699
  export { handleRequest } from "${dinouDirSlash}/core/handler.js";
699
700
  export { buildStaticPages, getStaticPaths, getStaticLayouts, getStaticMetadata } from "${dinouDirSlash}/core/build-static-pages.js";
700
701
  `;
@@ -23,8 +23,22 @@ import {
23
23
  logInfo,
24
24
  showIdleStatus,
25
25
  printReadyBanner,
26
- } from "./terminal-status.mjs";
27
- import { resolveDevPorts } from "./port-selector.mjs";
26
+ } from "./terminal-status.js";
27
+ import { resolveDevPorts } from "./port-selector.js";
28
+ import { getDinouConfig } from "../core/load-dinou-config.js";
29
+ import { resolveSetupFiles } from "../core/resolve-setup-files.js";
30
+ import { generateRouteModulesCode, generateRouteTypes } from "../core/route-generator.js";
31
+ import parseExports from "../core/parse-exports.js";
32
+ import { useClientRegex, useServerRegex } from "../constants.js";
33
+ import { nodeToWebRequest, sendWebResponseToNode } from "../core/http-adapter.js";
34
+ import { setStorageAdapter, FileSystemStorage, MemoryStorage } from "../core/storage-adapter.js";
35
+ import createScopedName from "../core/createScopedName.js";
36
+ import { regex as assetRegex } from "../core/asset-extensions.js";
37
+ import {
38
+ isSupportedClientModule,
39
+ scanProjectDependenciesForClientComponents,
40
+ scanProjectDependenciesForClientComponentsAsync,
41
+ } from "../core/scan-dependency-components.js";
28
42
 
29
43
  // Resolve dev HTTP and HMR ports before initiating background compilation
30
44
  const { port: PORT, hmrPort: HMR_PORT } = await resolveDevPorts();
@@ -77,8 +91,6 @@ const dinouDir = fs.existsSync(path.resolve(projectRoot, "dinou"))
77
91
  const dinouDirSlash = dinouDir.replace(/\\/g, "/");
78
92
 
79
93
  // Resolve and execute setupFiles immediately before any compilation
80
- const { getDinouConfig } = require(path.join(dinouDir, "core/load-dinou-config.js"));
81
- const { resolveSetupFiles } = require(path.join(dinouDir, "core/resolve-setup-files.js"));
82
94
  const dinouConfig = await getDinouConfig();
83
95
  const setupFiles = resolveSetupFiles(projectRoot, dinouConfig);
84
96
  if (setupFiles.length > 0) {
@@ -106,21 +118,9 @@ function getFallbackChunkId(absPath) {
106
118
  return `/${name}-${hash}.js`;
107
119
  }
108
120
 
109
- const { generateRouteModulesCode, generateRouteTypes } = require(path.join(dinouDir, "core/route-generator.js"));
110
121
  try {
111
122
  generateRouteTypes(projectRoot);
112
123
  } catch (e) {}
113
- const parseExports = require(path.join(dinouDir, "core/parse-exports.js"));
114
- const { useClientRegex, useServerRegex } = require(path.join(dinouDir, "constants.js"));
115
- const { nodeToWebRequest, sendWebResponseToNode } = require(path.join(dinouDir, "core/http-adapter.js"));
116
- const { setStorageAdapter, FileSystemStorage, MemoryStorage } = require(path.join(dinouDir, "core/storage-adapter.js"));
117
- const createScopedName = require(path.join(dinouDir, "core/createScopedName.js"));
118
- const { regex: assetRegex } = require(path.join(dinouDir, "core/asset-extensions.js"));
119
- const {
120
- isSupportedClientModule,
121
- scanProjectDependenciesForClientComponents,
122
- scanProjectDependenciesForClientComponentsAsync,
123
- } = require(path.join(dinouDir, "core/scan-dependency-components.js"));
124
124
 
125
125
  const yieldToEventLoop = () => new Promise((resolve) => setImmediate(resolve));
126
126
 
@@ -976,6 +976,8 @@ globalThis.__DINOU_LAYOUTS__ = ${JSON.stringify(discoveredLayouts)};
976
976
  const rscEntryContent = `// Auto-generated RSC Engine entry for Dev (Dual-Bundle)
977
977
  import "./env-setup.mjs";
978
978
  import "./route-modules.mjs";
979
+ import * as edgeRenderer from "react-server-dom-webpack/server.edge";
980
+ globalThis.__DINOU_EDGE_RENDERER__ = edgeRenderer;
979
981
  export { handleRequest } from "${dinouDirSlash}/core/handler.js";
980
982
  `;
981
983
  fs.writeFileSync(path.join(devDir, "rsc-entry.mjs"), rscEntryContent, "utf8");
@@ -2071,7 +2073,7 @@ async function startClientBundler(tool) {
2071
2073
 
2072
2074
  if (normTool === "esbuild") {
2073
2075
  const { startEsbuildDev } = await import(
2074
- pathToFileURL(path.resolve(dinouDir, "esbuild/dev.mjs")).href
2076
+ pathToFileURL(path.resolve(dinouDir, "esbuild/dev.js")).href
2075
2077
  );
2076
2078
  return await startEsbuildDev({
2077
2079
  onRebuilt: () => onManifestUpdated(),
@@ -2082,9 +2084,12 @@ async function startClientBundler(tool) {
2082
2084
 
2083
2085
  if (normTool === "rollup") {
2084
2086
  const { watch } = require("rollup");
2085
- const getRollupConfig = require(path.resolve(dinouDir, "rollup/rollup.config.js"));
2086
- const { getHmrEngine, closeHmrServer, notifyFileChanged } = require(path.resolve(dinouDir, "rollup/react-refresh/rollup-plugin-esm-hmr.js"));
2087
- const reactClientManifestPlugin = require(path.resolve(dinouDir, "rollup/rollup-plugins/rollup-plugin-react-client-manifest.js"));
2087
+ const rollupConfigMod = await import(pathToFileURL(path.resolve(dinouDir, "rollup/rollup.config.js")).href);
2088
+ const getRollupConfig = rollupConfigMod.default || rollupConfigMod;
2089
+ const hmrMod = await import(pathToFileURL(path.resolve(dinouDir, "rollup/react-refresh/rollup-plugin-esm-hmr.js")).href);
2090
+ const { getHmrEngine, closeHmrServer, notifyFileChanged } = hmrMod;
2091
+ const rcmpMod = await import(pathToFileURL(path.resolve(dinouDir, "rollup/rollup-plugins/rollup-plugin-react-client-manifest.js")).href);
2092
+ const reactClientManifestPlugin = rcmpMod.default || rcmpMod;
2088
2093
  reactClientManifestPlugin.setOnManifestUpdated?.(() => onManifestUpdated());
2089
2094
 
2090
2095
  let currentWatcher = null;
@@ -2231,7 +2236,8 @@ async function startClientBundler(tool) {
2231
2236
  }
2232
2237
  const webpack = require("webpack");
2233
2238
  const WebpackDevServer = require("webpack-dev-server");
2234
- const getWebpackConfig = require(path.resolve(dinouDir, "webpack/webpack.config.js"));
2239
+ const webpackConfigMod = await import(pathToFileURL(path.resolve(dinouDir, "webpack/webpack.config.js")).href);
2240
+ const getWebpackConfig = webpackConfigMod.default || webpackConfigMod;
2235
2241
  const webpackConfig = await getWebpackConfig();
2236
2242
  const compiler = webpack(webpackConfig);
2237
2243
 
@@ -2325,7 +2331,6 @@ const nodeMiddlewares = [];
2325
2331
 
2326
2332
  async function applyServerPlugins(serverInstance) {
2327
2333
  try {
2328
- const { getDinouConfig } = require(path.join(dinouDir, "core/load-dinou-config.js"));
2329
2334
  const config = await getDinouConfig();
2330
2335
  if (config.plugins && Array.isArray(config.plugins)) {
2331
2336
  const serverContext = {
@@ -279,7 +279,7 @@ export function printReadyBanner({ port, tool, durationMs, timings }) {
279
279
  const timeBadge = durationStr ? ` ${C_DIM}in ${C_BOLD}${durationStr}${C_RESET}` : "";
280
280
 
281
281
  console.log("");
282
- console.log(` ${C_CYAN}${C_BOLD}🦖 Dinou v7${C_RESET} ${C_GREEN}(Dual-Bundle, 0-fork)${C_RESET}${timeBadge}`);
282
+ console.log(` ${C_CYAN}${C_BOLD}🦖 Dinou${C_RESET} ${C_GREEN}(Dual-Bundle, 0-fork)${C_RESET}${timeBadge}`);
283
283
  console.log("");
284
284
  console.log(` ${C_GREEN}➜${C_RESET} ${C_BOLD}Local:${C_RESET} ${C_CYAN}http://localhost:${port}/${C_RESET}`);
285
285
  console.log(` ${C_GREEN}➜${C_RESET} ${C_BOLD}Bundler:${C_RESET} ${tool}`);
@@ -1,28 +1,29 @@
1
1
  {
2
2
  "name": "dinou-ejected",
3
- "version": "7.3.0",
3
+ "version": "8.0.1",
4
+ "type": "module",
4
5
  "main": "index.js",
5
6
  "private": true,
6
7
  "exports": {
7
8
  ".": {
8
9
  "types": "./index.d.ts",
9
- "import": "./index.mjs",
10
- "require": "./index.js"
10
+ "import": "./index.js",
11
+ "default": "./index.js"
11
12
  },
12
13
  "./env": {
13
14
  "types": "./env.d.ts"
14
15
  },
15
16
  "./server": {
16
17
  "types": "./server.d.ts",
17
- "import": "./server.mjs",
18
- "require": "./server.js"
18
+ "import": "./server.js",
19
+ "default": "./server.js"
19
20
  },
20
21
  "./config": {
21
22
  "types": "./index.d.ts",
22
23
  "import": "./core/config.js",
23
- "require": "./core/config.js"
24
+ "default": "./core/config.js"
24
25
  },
25
- "./adapters/node": "./adapters/node.mjs",
26
+ "./adapters/node": "./adapters/node.js",
26
27
  "./adapters/bun": "./adapters/bun.js",
27
28
  "./adapters/deno": "./adapters/deno.js",
28
29
  "./adapters/cloudflare": "./adapters/cloudflare.js",
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  plugins: {
3
3
  "@tailwindcss/postcss": {},
4
4
  autoprefixer: {},
@@ -1,4 +1,6 @@
1
- const WebSocket = require("ws");
1
+ import WebSocket, { WebSocketServer } from "ws";
2
+
3
+ const Server = WebSocketServer || WebSocket.Server;
2
4
 
3
5
  /**
4
6
  * @typedef {Object} Dependency
@@ -15,8 +17,8 @@ class EsmHmrEngine {
15
17
  this.clients = set;
16
18
  this.dependencyTree = map;
17
19
  const wss = options.server
18
- ? new WebSocket.Server({ noServer: true })
19
- : new WebSocket.Server({ port: options.port || Number(process.env.HMR_PORT) || 3001 });
20
+ ? new Server({ noServer: true })
21
+ : new Server({ port: options.port || Number(process.env.HMR_PORT) || 3001 });
20
22
 
21
23
  if (options.server) {
22
24
  options.server.on("upgrade", (req, socket, head) => {
@@ -125,6 +127,7 @@ class EsmHmrEngine {
125
127
  }
126
128
  }
127
129
 
128
- module.exports = {
130
+ export {
129
131
  EsmHmrEngine,
130
132
  };
133
+ export default EsmHmrEngine;
@@ -88,5 +88,6 @@ window.$RefreshSig$ = prevRefreshSig;
88
88
  };
89
89
  }
90
90
 
91
- module.exports = reactRefreshWrapModules;
91
+ export { reactRefreshWrapModules };
92
+ export default reactRefreshWrapModules;
92
93
 
@@ -1,8 +1,11 @@
1
- // plugins/rollup-plugin-esm-hmr.cjs
2
- const fs = require("node:fs");
3
- const path = require("node:path");
4
- const { EsmHmrEngine } = require("./esm-hmr/server");
5
- const { createServer } = require("node:http");
1
+ // plugins/rollup-plugin-esm-hmr.js
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { EsmHmrEngine } from "./esm-hmr/server.js";
6
+ import { createServer } from "node:http";
7
+
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
9
  const changedIds = new Set();
7
10
  const pendingUpdateUrls = new Set();
8
11
  let needsFullReload = false;
@@ -227,19 +230,23 @@ function notifyFileChanged(absPath) {
227
230
  }
228
231
  }
229
232
 
230
- module.exports = {
233
+ const getHmrEngine = () => activeHmrEngine;
234
+ const closeHmrServer = () => {
235
+ if (activeServer) {
236
+ try {
237
+ activeServer.close();
238
+ } catch (e) {}
239
+ activeServer = null;
240
+ activeHmrEngine = null;
241
+ }
242
+ };
243
+
244
+ export {
231
245
  esmHmrPlugin,
232
- getHmrEngine: () => activeHmrEngine,
246
+ getHmrEngine,
233
247
  notifyFileChanged,
234
- closeHmrServer: () => {
235
- if (activeServer) {
236
- try {
237
- activeServer.close();
238
- } catch (e) {}
239
- activeServer = null;
240
- activeHmrEngine = null;
241
- }
242
- },
248
+ closeHmrServer,
243
249
  };
250
+ export default esmHmrPlugin;
244
251
 
245
252
 
@@ -1,7 +1,7 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const createScopedName = require("../../core/createScopedName.js");
4
- const { regex } = require("../../core/asset-extensions.js");
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import createScopedName from "../../core/createScopedName.js";
4
+ import { regex } from "../../core/asset-extensions.js";
5
5
 
6
6
  function dinouAssetPlugin({ include = regex } = {}) {
7
7
  return {
@@ -32,4 +32,5 @@ function dinouAssetPlugin({ include = regex } = {}) {
32
32
  };
33
33
  }
34
34
 
35
- module.exports = dinouAssetPlugin;
35
+ export { dinouAssetPlugin };
36
+ export default dinouAssetPlugin;
@@ -22,4 +22,5 @@ function manifestGeneratorPlugin() {
22
22
 
23
23
  manifestGeneratorPlugin.manifestData = manifestData;
24
24
 
25
- module.exports = manifestGeneratorPlugin;
25
+ export { manifestGeneratorPlugin };
26
+ export default manifestGeneratorPlugin;
@@ -2,7 +2,7 @@
2
2
  // Stores all bundled chunks, assets and sourcemaps in memory (globalThis.__DINOU_MEM_FILES__)
3
3
  // and deletes them from Rollup's emit queue in dev mode to prevent massive disk writes.
4
4
 
5
- const path = require("node:path");
5
+ import path from "node:path";
6
6
 
7
7
  function rollupMemoryPlugin() {
8
8
  return {
@@ -63,4 +63,5 @@ function rollupMemoryPlugin() {
63
63
  };
64
64
  }
65
65
 
66
- module.exports = rollupMemoryPlugin;
66
+ export { rollupMemoryPlugin };
67
+ export default rollupMemoryPlugin;
@@ -1,20 +1,22 @@
1
- const { readFileSync, writeFileSync, mkdirSync, existsSync } = require("fs");
2
- const path = require("path");
3
- const { dirname } = require("path");
4
- const glob = require("fast-glob");
5
- const { pathToFileURL } = require("url");
1
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
2
+ import path, { dirname } from "node:path";
3
+ import glob from "fast-glob";
4
+ import { pathToFileURL } from "node:url";
5
+ import { createRequire } from "node:module";
6
+ import parser from "@babel/parser";
7
+ import _traverseRaw from "@babel/traverse";
8
+ import { regex } from "../../core/asset-extensions.js";
9
+ import createScopedName from "../../core/createScopedName.js";
10
+ import { getAbsPathWithExt } from "../../core/get-abs-path-with-ext.js";
11
+ import { useClientRegex, useServerRegex } from "../../constants.js";
12
+ import parseExports from "../../core/parse-exports.js";
13
+
14
+ const require = createRequire(import.meta.url);
6
15
  let swc = null;
7
16
  try {
8
17
  swc = require("@swc/core");
9
18
  } catch (e) {}
10
- const parser = require("@babel/parser");
11
- const _traverseRaw = require("@babel/traverse");
12
19
  const traverse = typeof _traverseRaw === "function" ? _traverseRaw : (_traverseRaw.default || _traverseRaw);
13
- const { regex } = require("../../core/asset-extensions.js");
14
- const createScopedName = require("../../core/createScopedName.js");
15
- const { getAbsPathWithExt } = require("../../core/get-abs-path-with-ext.js");
16
- const { useClientRegex, useServerRegex } = require("../../constants.js");
17
- const parseExports = require("../../core/parse-exports.js");
18
20
 
19
21
  function getDefaultExportName(code) {
20
22
  let name = null;
@@ -723,4 +725,5 @@ function setOnManifestUpdated(cb) {
723
725
  }
724
726
  reactClientManifestPlugin.setOnManifestUpdated = setOnManifestUpdated;
725
727
 
726
- module.exports = reactClientManifestPlugin;
728
+ export { reactClientManifestPlugin, setOnManifestUpdated };
729
+ export default reactClientManifestPlugin;
@@ -1,9 +1,9 @@
1
1
  // rollup-plugin-server-functions.js
2
- const path = require("path");
3
- const fs = require("fs/promises");
4
- const manifestGeneratorPlugin = require("./manifest-generator-plugin");
5
- const parseExports = require("../../core/parse-exports.js");
6
- const { useServerRegex } = require("../../constants.js");
2
+ import path from "node:path";
3
+ import fs from "node:fs/promises";
4
+ import manifestGeneratorPlugin from "./manifest-generator-plugin.js";
5
+ import parseExports from "../../core/parse-exports.js";
6
+ import { useServerRegex } from "../../constants.js";
7
7
 
8
8
  function serverFunctionsPlugin(manifestData = {}, options = {}) {
9
9
  const opts =
@@ -116,4 +116,5 @@ function serverFunctionsPlugin(manifestData = {}, options = {}) {
116
116
  };
117
117
  }
118
118
 
119
- module.exports = serverFunctionsPlugin;
119
+ export { serverFunctionsPlugin };
120
+ export default serverFunctionsPlugin;
@@ -2,9 +2,11 @@
2
2
  // Ultra-fast SWC transpilation plugin for Rollup with high-speed in-memory cache.
3
3
  // Replaces heavy Babel pipeline in development and eliminates multi-second HMR latencies.
4
4
 
5
- const path = require("node:path");
6
- const fs = require("node:fs");
5
+ import path from "node:path";
6
+ import fs from "node:fs";
7
+ import { createRequire } from "node:module";
7
8
 
9
+ const require = createRequire(import.meta.url);
8
10
  let swc = null;
9
11
  try {
10
12
  swc = require("@swc/core");
@@ -96,5 +98,6 @@ function rollupSwcPlugin(options = {}) {
96
98
  };
97
99
  }
98
100
 
99
- module.exports = rollupSwcPlugin;
101
+ export { rollupSwcPlugin };
102
+ export default rollupSwcPlugin;
100
103