dinou 7.3.0 → 8.0.0
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/CHANGELOG.md +22 -0
- package/README.md +1 -1
- package/cli.js +44 -41
- package/dinou/adapters/netlify.js +1 -0
- package/dinou/adapters/{node.mjs → node.js} +9 -3
- package/dinou/bun/{build.mjs → build.js} +11 -10
- package/dinou/cloudflare/{build.mjs → build.js} +14 -10
- package/dinou/cloudflare/shims/fs.js +3 -0
- package/dinou/constants.js +3 -3
- package/dinou/core/asset-extensions.js +5 -5
- package/dinou/core/bailout-proxy.js +3 -3
- package/dinou/core/build-static-pages.js +21 -17
- package/dinou/core/cache-revalidate.js +14 -33
- package/dinou/core/cache-slot.js +21 -10
- package/dinou/core/config.js +2 -5
- package/dinou/core/createScopedName.js +3 -3
- package/dinou/core/dinou-paths.js +15 -12
- package/dinou/core/generate-route-types.js +8 -3
- package/dinou/core/generate-static-page.js +6 -5
- package/dinou/core/generate-static-rsc.js +15 -10
- package/dinou/core/generate-static.js +11 -10
- package/dinou/core/generating-isg.js +12 -11
- package/dinou/core/get-abs-path-with-ext.js +8 -6
- package/dinou/core/get-asset-from-manifest.js +4 -4
- package/dinou/core/get-error-jsx.js +12 -9
- package/dinou/core/get-file-path-and-dynamic-params.js +7 -4
- package/dinou/core/get-jsx.js +19 -13
- package/dinou/core/handler.js +73 -33
- package/dinou/core/http-adapter.js +6 -2
- package/dinou/core/import-module.js +5 -4
- package/dinou/core/layout-functions.js +11 -6
- package/dinou/core/load-dinou-config.js +10 -4
- package/dinou/core/manifest-provider.js +11 -4
- package/dinou/core/parse-exports.js +11 -6
- package/dinou/core/path-utils.js +2 -2
- package/dinou/core/ppr-context.js +11 -11
- package/dinou/core/ppr-runtime.js +10 -6
- package/dinou/core/render-jsx-to-client-jsx.js +6 -3
- package/dinou/core/request-context.js +11 -7
- package/dinou/core/resolve-module-ppr.js +2 -2
- package/dinou/core/resolve-setup-files.js +70 -69
- package/dinou/core/revalidating.js +14 -25
- package/dinou/core/route-generator.js +12 -8
- package/dinou/core/rsc-renderer.js +13 -2
- package/dinou/core/run-ssg.js +9 -4
- package/dinou/core/safe-rename.js +3 -3
- package/dinou/core/scan-dependency-components.js +9 -3
- package/dinou/core/status-manifest.js +5 -5
- package/dinou/core/storage-adapter.js +13 -3
- package/dinou/core/url-resolver.js +2 -2
- package/dinou/core/vfs.js +7 -7
- package/dinou/deno/{build.mjs → build.js} +11 -10
- package/dinou/esbuild/{build.mjs → build.js} +4 -4
- package/dinou/esbuild/{dev.mjs → dev.js} +6 -6
- package/dinou/esbuild/helpers-esbuild/{get-config-esbuild-prod.mjs → get-config-esbuild-prod.js} +7 -7
- package/dinou/esbuild/helpers-esbuild/{get-config-esbuild.mjs → get-config-esbuild.js} +8 -8
- package/dinou/esbuild/helpers-esbuild/{get-esbuild-entries.mjs → get-esbuild-entries.js} +2 -2
- package/dinou/esbuild/plugins-esbuild/{assets-plugin.mjs → assets-plugin.js} +1 -1
- package/dinou/esbuild/plugins-esbuild/{stable-chunk-names-and-maps-plugin.mjs → stable-chunk-names-and-maps-plugin.js} +1 -1
- package/dinou/esbuild/plugins-esbuild/{write-plugin.mjs → write-plugin.js} +1 -1
- package/dinou/esbuild/plugins-postcss/postcss-extract-plugin.js +4 -3
- package/dinou/esbuild/react-refresh/babel-config.js +5 -1
- package/dinou/esbuild/react-refresh/esm-hmr/server.js +7 -4
- package/dinou/esbuild/react-refresh/{esm-hmr-plugin.mjs → esm-hmr-plugin.js} +4 -4
- package/dinou/esbuild/react-refresh/{react-refresh-runtime.mjs → react-refresh-runtime.js} +1 -1
- package/dinou/index.js +40 -19
- package/dinou/node/{build.mjs → build.js} +1 -1
- package/dinou/node/{bundle-dual-engine.mjs → bundle-dual-engine.js} +13 -12
- package/dinou/node/{dev.mjs → dev.js} +27 -22
- package/dinou/package.json +8 -7
- package/dinou/rollup/postcss.config.js +1 -1
- package/dinou/rollup/react-refresh/esm-hmr/server.js +7 -4
- package/dinou/rollup/react-refresh/react-refresh-wrap-modules.js +2 -1
- package/dinou/rollup/react-refresh/rollup-plugin-esm-hmr.js +23 -16
- package/dinou/rollup/rollup-plugins/dinou-asset-plugin.js +6 -5
- package/dinou/rollup/rollup-plugins/manifest-generator-plugin.js +2 -1
- package/dinou/rollup/rollup-plugins/rollup-plugin-memory.js +3 -2
- package/dinou/rollup/rollup-plugins/rollup-plugin-react-client-manifest.js +16 -13
- package/dinou/rollup/rollup-plugins/rollup-plugin-server-functions.js +7 -6
- package/dinou/rollup/rollup-plugins/rollup-plugin-swc.js +6 -3
- package/dinou/rollup/rollup.config.js +27 -23
- package/dinou/server.js +21 -26
- package/dinou/webpack/helpers/get-webpack-entries.js +14 -11
- package/dinou/webpack/loaders/server-functions-loader.js +5 -6
- package/dinou/webpack/loaders/swc-loader.js +4 -2
- package/dinou/webpack/plugins/manifest-generator-plugin.js +3 -1
- package/dinou/webpack/plugins/server-functions-plugin.js +4 -3
- package/dinou/webpack/plugins/webpack-memory-plugin.js +3 -2
- package/dinou/webpack/postcss.config.js +1 -1
- package/dinou/webpack/webpack.config.js +22 -20
- package/eject.js +224 -217
- package/package.json +111 -110
- package/dinou/config.js +0 -1
- package/dinou/config.mjs +0 -2
- package/dinou/core/css-require-hook.js +0 -64
- package/dinou/index.mjs +0 -43
- package/dinou/server.mjs +0 -30
- /package/dinou/core/{export-static.mjs → export-static.js} +0 -0
- /package/dinou/esbuild/helpers-esbuild/{normalize-path.mjs → normalize-path.js} +0 -0
- /package/dinou/esbuild/helpers-esbuild/{strip-namespace.mjs → strip-namespace.js} +0 -0
- /package/dinou/esbuild/helpers-esbuild/{swc-disk-cache.mjs → swc-disk-cache.js} +0 -0
- /package/dinou/esbuild/helpers-esbuild/{update-manifest-for-module.mjs → update-manifest-for-module.js} +0 -0
- /package/dinou/esbuild/helpers-esbuild/{write.mjs → write.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{babel-react-compiler-plugin.mjs → babel-react-compiler-plugin.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{css-processor-plugin.mjs → css-processor-plugin.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{manifest-generator-plugin.mjs → manifest-generator-plugin.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{react-client-manifest-plugin.mjs → react-client-manifest-plugin.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{server-functions-plugin.mjs → server-functions-plugin.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{skip-missing-entry-points-plugin.mjs → skip-missing-entry-points-plugin.js} +0 -0
- /package/dinou/esbuild/react-refresh/esm-hmr/{client.mjs → client.js} +0 -0
- /package/dinou/esbuild/react-refresh/{is-react-refresh-boundary.mjs → is-react-refresh-boundary.js} +0 -0
- /package/dinou/node/{port-selector.mjs → port-selector.js} +0 -0
- /package/dinou/node/{terminal-status.mjs → terminal-status.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// postcss-extract-plugin.js
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
16
|
+
export { babelConfig };
|
|
17
|
+
export default babelConfig;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
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
|
|
19
|
-
: new
|
|
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
|
-
|
|
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.
|
|
10
|
-
import normalizePath from "../helpers-esbuild/normalize-path.
|
|
11
|
-
import stripNamespace from "../helpers-esbuild/strip-namespace.
|
|
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.
|
|
158
|
+
"./esm-hmr/client.js",
|
|
159
159
|
);
|
|
160
160
|
let clientCode = await fs.readFile(clientPath, "utf8");
|
|
161
161
|
const isDebug =
|
package/dinou/index.js
CHANGED
|
@@ -1,22 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
13
|
+
function defineConfig(config) {
|
|
14
|
+
return config;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const dinou = {
|
|
6
18
|
defineConfig,
|
|
7
|
-
getContext
|
|
8
|
-
usePathname
|
|
9
|
-
useSearchParams
|
|
10
|
-
useRouter
|
|
11
|
-
refreshSlot
|
|
12
|
-
useNavigationLoading
|
|
13
|
-
|
|
14
|
-
|
|
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;
|
|
@@ -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.
|
|
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");
|
|
@@ -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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
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.
|
|
27
|
-
import { resolveDevPorts } from "./port-selector.
|
|
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.
|
|
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
|
|
2086
|
-
const
|
|
2087
|
-
const
|
|
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
|
|
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 = {
|
package/dinou/package.json
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dinou-ejected",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
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.
|
|
10
|
-
"
|
|
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.
|
|
18
|
-
"
|
|
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
|
-
"
|
|
24
|
+
"default": "./core/config.js"
|
|
24
25
|
},
|
|
25
|
-
"./adapters/node": "./adapters/node.
|
|
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,6 @@
|
|
|
1
|
-
|
|
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
|
|
19
|
-
: new
|
|
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
|
-
|
|
130
|
+
export {
|
|
129
131
|
EsmHmrEngine,
|
|
130
132
|
};
|
|
133
|
+
export default EsmHmrEngine;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
// plugins/rollup-plugin-esm-hmr.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
35
|
+
export { dinouAssetPlugin };
|
|
36
|
+
export default dinouAssetPlugin;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
66
|
+
export { rollupMemoryPlugin };
|
|
67
|
+
export default rollupMemoryPlugin;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
728
|
+
export { reactClientManifestPlugin, setOnManifestUpdated };
|
|
729
|
+
export default reactClientManifestPlugin;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// rollup-plugin-server-functions.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6
|
-
|
|
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
|
-
|
|
101
|
+
export { rollupSwcPlugin };
|
|
102
|
+
export default rollupSwcPlugin;
|
|
100
103
|
|