dinou 7.2.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 +37 -0
- package/README.md +1 -1
- package/cli.js +124 -121
- package/dinou/adapters/netlify.js +1 -0
- package/dinou/adapters/{node.mjs → node.js} +9 -3
- package/dinou/bun/{build.mjs → build.js} +20 -8
- package/dinou/cloudflare/{build.mjs → build.js} +23 -8
- 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 -0
- 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} +20 -8
- 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.d.ts +13 -0
- package/dinou/index.js +40 -19
- package/dinou/node/{build.mjs → build.js} +10 -6
- package/dinou/node/{bundle-dual-engine.mjs → bundle-dual-engine.js} +22 -10
- package/dinou/node/{dev.mjs → dev.js} +43 -20
- 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 +198 -191
- 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
|
@@ -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
|
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { execSync } from "node:child_process";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import postcss from "rollup-plugin-postcss";
|
|
6
|
+
import babelModule from "@rollup/plugin-babel";
|
|
7
|
+
import resolveModule from "@rollup/plugin-node-resolve";
|
|
8
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
9
|
+
import copy from "rollup-plugin-copy";
|
|
10
|
+
import reactClientManifest from "./rollup-plugins/rollup-plugin-react-client-manifest.js";
|
|
11
|
+
import createScopedName from "../core/createScopedName.js";
|
|
12
|
+
import replace from "@rollup/plugin-replace";
|
|
13
|
+
import json from "@rollup/plugin-json";
|
|
14
|
+
import reactRefreshWrapModules from "./react-refresh/react-refresh-wrap-modules.js";
|
|
15
|
+
import { esmHmrPlugin } from "./react-refresh/rollup-plugin-esm-hmr.js";
|
|
16
|
+
import dinouAssetPlugin from "./rollup-plugins/dinou-asset-plugin.js";
|
|
17
|
+
import tsconfigPaths from "rollup-plugin-tsconfig-paths";
|
|
18
|
+
import serverFunctionsPlugin from "./rollup-plugins/rollup-plugin-server-functions.js";
|
|
19
|
+
import { regex } from "../core/asset-extensions.js";
|
|
20
|
+
import manifestGeneratorPlugin from "./rollup-plugins/manifest-generator-plugin.js";
|
|
21
|
+
import rollupMemoryPlugin from "./rollup-plugins/rollup-plugin-memory.js";
|
|
22
|
+
import rollupSwcPlugin from "./rollup-plugins/rollup-plugin-swc.js";
|
|
23
|
+
|
|
24
|
+
const babel = babelModule?.default || babelModule;
|
|
25
|
+
const resolve = resolveModule?.default || resolveModule;
|
|
26
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
21
27
|
|
|
22
28
|
const localDinouPath = path.resolve(process.cwd(), "dinou");
|
|
23
29
|
const isEjected = fs.existsSync(localDinouPath);
|
|
@@ -28,7 +34,7 @@ console.log(
|
|
|
28
34
|
: "📦 [Dinou] Library Mode detected (Using node_modules)",
|
|
29
35
|
);
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
export default async function () {
|
|
32
38
|
const isDevelopment = process.env.NODE_ENV !== "production";
|
|
33
39
|
const outputDirectory = isDevelopment ? ".dinou/public" : ".dinou/dist3";
|
|
34
40
|
const shouldWriteToDisk = process.env.DINOU_WRITE_TO_DISK === "true" || !isDevelopment;
|
|
@@ -284,12 +290,10 @@ module.exports = async function () {
|
|
|
284
290
|
{
|
|
285
291
|
name: "post-build-server",
|
|
286
292
|
closeBundle() {
|
|
287
|
-
const fs = require("fs");
|
|
288
293
|
fs.writeFileSync(
|
|
289
294
|
path.resolve(process.cwd(), ".dinou/dist3/server/package.json"),
|
|
290
295
|
JSON.stringify({ type: "module" }, null, 2)
|
|
291
296
|
);
|
|
292
|
-
const { execSync } = require("child_process");
|
|
293
297
|
execSync(`"${process.execPath}" --conditions=react-server "${path.resolve(__dirname, "../core/run-ssg.js")}"`, {
|
|
294
298
|
stdio: "inherit",
|
|
295
299
|
env: { ...process.env, NODE_ENV: "production" },
|
package/dinou/server.js
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
export async function revalidatePath(path, options) {
|
|
2
|
+
const { revalidatePath: fn } = await import("./core/cache-revalidate.js");
|
|
3
|
+
return fn(path, options);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export async function revalidatePage(path) {
|
|
7
|
+
const { revalidatePage: fn } = await import("./core/cache-revalidate.js");
|
|
8
|
+
return fn(path);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function revalidateTag(tag, options) {
|
|
12
|
+
const { revalidateTag: fn } = await import("./core/cache-revalidate.js");
|
|
13
|
+
return fn(tag, options);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function DinouCacheSlot(props) {
|
|
17
|
+
const { DinouCacheSlot: fn } = await import("./core/cache-slot.js");
|
|
18
|
+
return fn(props);
|
|
19
|
+
}
|
|
12
20
|
|
|
13
|
-
|
|
14
|
-
DinouCacheSlot,
|
|
15
|
-
revalidatePath: async function (path, options) {
|
|
16
|
-
const { revalidatePath: fn } = require("./core/cache-revalidate.js");
|
|
17
|
-
return fn(path, options);
|
|
18
|
-
},
|
|
19
|
-
revalidatePage: async function (path) {
|
|
20
|
-
const { revalidatePage: fn } = require("./core/cache-revalidate.js");
|
|
21
|
-
return fn(path);
|
|
22
|
-
},
|
|
23
|
-
revalidateTag: async function (tag, options) {
|
|
24
|
-
const { revalidateTag: fn } = require("./core/cache-revalidate.js");
|
|
25
|
-
return fn(tag, options);
|
|
26
|
-
},
|
|
21
|
+
export {
|
|
27
22
|
StorageAdapter,
|
|
28
23
|
FileSystemStorage,
|
|
29
24
|
CloudflareKVStorage,
|
|
@@ -32,4 +27,4 @@ module.exports = {
|
|
|
32
27
|
RedisStorage,
|
|
33
28
|
getStorageAdapter,
|
|
34
29
|
setStorageAdapter,
|
|
35
|
-
};
|
|
30
|
+
} from "./core/storage-adapter.js";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import glob from "fast-glob";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
import parser from "@babel/parser";
|
|
6
|
+
import _traverseRaw from "@babel/traverse";
|
|
7
|
+
import crypto from "node:crypto";
|
|
8
|
+
import { regex as assetRegex } from "../../core/asset-extensions.js";
|
|
9
|
+
import { getAbsPathWithExt } from "../../core/get-abs-path-with-ext.js";
|
|
10
|
+
import { useClientRegex, useServerRegex } from "../../constants.js";
|
|
11
|
+
|
|
12
|
+
const traverse = typeof _traverseRaw === "function" ? _traverseRaw : (_traverseRaw.default || _traverseRaw);
|
|
11
13
|
|
|
12
14
|
const normalizePath = (p) => p.split(path.sep).join(path.posix.sep);
|
|
13
15
|
|
|
@@ -203,4 +205,5 @@ async function getCSSEntries({
|
|
|
203
205
|
return [detectedCSSEntries, detectedClientEntries, serverFiles];
|
|
204
206
|
}
|
|
205
207
|
|
|
206
|
-
|
|
208
|
+
export { getCSSEntries };
|
|
209
|
+
export default getCSSEntries;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { normalizePathCase } from "../../core/path-utils.js";
|
|
3
|
+
import parseExports from "../../core/parse-exports.js";
|
|
4
|
+
import { useServerRegex } from "../../constants.js";
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
const parseExports = require("../../core/parse-exports.js");
|
|
5
|
-
const { useServerRegex } = require("../../constants.js");
|
|
6
|
-
|
|
7
|
-
module.exports = function (source) {
|
|
6
|
+
export default function (source) {
|
|
8
7
|
const options = this.getOptions ? this.getOptions() : {};
|
|
9
8
|
const norm = path.resolve(this.resourcePath).replace(/\\/g, "/").toLowerCase();
|
|
10
9
|
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
// Ultra-fast SWC transpilation loader for Webpack.
|
|
3
3
|
// Replaces heavy Babel pipeline in development and eliminates multi-second rebuild latencies.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { createRequire } from "node:module";
|
|
6
7
|
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
7
9
|
let swc = null;
|
|
8
10
|
try {
|
|
9
11
|
swc = require("@swc/core");
|
|
@@ -11,7 +13,7 @@ try {
|
|
|
11
13
|
// Handled on first invocation
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
export default function (source, inputSourceMap) {
|
|
15
17
|
if (this.cacheable) this.cacheable(true);
|
|
16
18
|
|
|
17
19
|
if (!swc) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import manifestGeneratorPlugin from "./manifest-generator-plugin.js";
|
|
3
3
|
|
|
4
4
|
class WebpackServerFunctionsPluginSimple {
|
|
5
5
|
constructor() {
|
|
@@ -130,4 +130,5 @@ class WebpackServerFunctionsPluginSimple {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
export { WebpackServerFunctionsPluginSimple };
|
|
134
|
+
export default WebpackServerFunctionsPluginSimple;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Captures Webpack client assets, chunks, manifests, and sourcemaps in memory (globalThis.__DINOU_MEM_FILES__)
|
|
3
3
|
// and sets global raw manifests in dev mode to prevent massive disk writes.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import path from "node:path";
|
|
6
6
|
|
|
7
7
|
class WebpackMemoryPlugin {
|
|
8
8
|
constructor(options = {}) {
|
|
@@ -63,4 +63,5 @@ class WebpackMemoryPlugin {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
export { WebpackMemoryPlugin };
|
|
67
|
+
export default WebpackMemoryPlugin;
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import "dotenv/config";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import ReactServerWebpackPlugin from "react-server-dom-webpack/plugin";
|
|
7
|
+
import CopyWebpackPlugin from "copy-webpack-plugin";
|
|
8
|
+
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
9
|
+
import createScopedName from "../core/createScopedName.js";
|
|
10
|
+
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
|
|
11
|
+
import manifestGeneratorPlugin from "./plugins/manifest-generator-plugin.js";
|
|
12
|
+
import ServerFunctionsPlugin from "./plugins/server-functions-plugin.js";
|
|
13
|
+
import WebpackMemoryPlugin from "./plugins/webpack-memory-plugin.js";
|
|
14
|
+
import webpack from "webpack";
|
|
15
|
+
import { regex } from "../core/asset-extensions.js";
|
|
16
|
+
import getCSSEntries from "./helpers/get-webpack-entries.js";
|
|
17
|
+
import {
|
|
16
18
|
scanProjectDependenciesForClientComponents,
|
|
17
19
|
scanProjectDependenciesForClientComponentsAsync,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
+
} from "../core/scan-dependency-components.js";
|
|
21
|
+
import { useClientRegex } from "../constants.js";
|
|
22
|
+
|
|
23
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
20
24
|
|
|
21
25
|
const isDevelopment = process.env.NODE_ENV !== "production";
|
|
22
26
|
const outputDirectory = isDevelopment ? ".dinou/public" : ".dinou/dist3";
|
|
@@ -67,7 +71,7 @@ function cleanDir(dir) {
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
export default async () => {
|
|
71
75
|
const outputDir = path.resolve(process.cwd(), outputDirectory);
|
|
72
76
|
|
|
73
77
|
const shouldWriteToDisk =
|
|
@@ -101,14 +105,12 @@ module.exports = async () => {
|
|
|
101
105
|
function runPostBuild() {
|
|
102
106
|
if (clientDone && serverDone && !ssgExecuted) {
|
|
103
107
|
ssgExecuted = true;
|
|
104
|
-
const fs = require("fs");
|
|
105
108
|
const serverDir = path.resolve(process.cwd(), ".dinou/dist3/server");
|
|
106
109
|
fs.mkdirSync(serverDir, { recursive: true });
|
|
107
110
|
fs.writeFileSync(
|
|
108
111
|
path.join(serverDir, "package.json"),
|
|
109
112
|
JSON.stringify({ type: "module" }, null, 2)
|
|
110
113
|
);
|
|
111
|
-
const { execSync } = require("child_process");
|
|
112
114
|
execSync(`"${process.execPath}" --conditions=react-server "${path.resolve(__dirname, "../core/run-ssg.js")}"`, {
|
|
113
115
|
stdio: "inherit",
|
|
114
116
|
env: { ...process.env, NODE_ENV: "production", DINOU_BUILD_TOOL: "webpack" },
|