dinou 6.1.1 → 7.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 +94 -0
- package/README.md +9461 -1080
- package/cli.js +392 -169
- package/dinou/adapters/bun.js +62 -0
- package/dinou/adapters/cloudflare.js +65 -0
- package/dinou/adapters/deno.js +48 -0
- package/dinou/adapters/netlify.js +85 -0
- package/dinou/adapters/node.mjs +31 -0
- package/dinou/bun/build.mjs +1077 -0
- package/dinou/cloudflare/build.mjs +1121 -0
- package/dinou/cloudflare/shims/child_process.js +14 -0
- package/dinou/cloudflare/shims/empty.js +2 -0
- package/dinou/cloudflare/shims/fs.js +99 -0
- package/dinou/cloudflare/shims/os.js +29 -0
- package/dinou/config.js +1 -0
- package/dinou/config.mjs +2 -0
- package/dinou/constants.js +29 -4
- package/dinou/core/babel-esm-loader.js +66 -37
- package/dinou/core/bailout-proxy.js +61 -0
- package/dinou/core/build-static-pages.js +309 -157
- package/dinou/core/cache-revalidate.js +471 -144
- package/dinou/core/cache-slot.js +387 -0
- package/dinou/core/client-redirect.jsx +12 -7
- package/dinou/core/client-webpack.jsx +457 -82
- package/dinou/core/client.jsx +452 -82
- package/dinou/core/config.js +11 -0
- package/dinou/core/dinou-paths.js +52 -0
- package/dinou/core/edge-ssr.js +122 -0
- package/dinou/core/export-static.mjs +64 -0
- package/dinou/core/generate-route-types.js +252 -0
- package/dinou/core/generate-static-page.js +55 -94
- package/dinou/core/generate-static-rsc.js +47 -15
- package/dinou/core/generate-static.js +212 -10
- package/dinou/core/generating-isg.js +5 -0
- package/dinou/core/get-asset-from-manifest.js +9 -3
- package/dinou/core/get-error-jsx.js +221 -41
- package/dinou/core/get-file-path-and-dynamic-params.js +9 -13
- package/dinou/core/get-jsx.js +172 -95
- package/dinou/core/handler.js +2296 -0
- package/dinou/core/http-adapter.js +115 -0
- package/dinou/core/import-module.js +83 -53
- package/dinou/core/layout-functions.js +181 -0
- package/dinou/core/link.jsx +18 -6
- package/dinou/core/load-dinou-config.js +60 -0
- package/dinou/core/manifest-provider.js +261 -0
- package/dinou/core/navigation-utils.js +4 -0
- package/dinou/core/navigation.js +50 -39
- package/dinou/core/parse-exports.js +207 -2
- package/dinou/core/ppr-context.js +105 -0
- package/dinou/core/ppr-runtime.js +263 -0
- package/dinou/core/redirect.jsx +20 -19
- package/dinou/core/render-jsx-to-client-jsx.js +133 -15
- package/dinou/core/request-context.js +47 -13
- package/dinou/core/resolve-module-ppr.js +32 -0
- package/dinou/core/revalidating.js +28 -9
- package/dinou/core/route-generator.js +107 -0
- package/dinou/core/rsc-renderer.js +90 -0
- package/dinou/core/run-ssg.js +19 -0
- package/dinou/core/scan-dependency-components.js +218 -0
- package/dinou/core/server-function-proxy-webpack.js +3 -0
- package/dinou/core/server-function-proxy.js +3 -0
- package/dinou/core/slot.js +302 -0
- package/dinou/core/status-manifest.js +41 -1
- package/dinou/core/storage-adapter.js +522 -0
- package/dinou/core/url-resolver.js +16 -16
- package/dinou/core/vfs.js +139 -68
- package/dinou/deno/build.mjs +1112 -0
- package/dinou/deno/seed-kv.js +115 -0
- package/dinou/esbuild/build.mjs +51 -1
- package/dinou/esbuild/dev.mjs +290 -224
- package/dinou/esbuild/helpers-esbuild/get-config-esbuild-prod.mjs +3 -2
- package/dinou/esbuild/helpers-esbuild/get-config-esbuild.mjs +104 -16
- package/dinou/esbuild/helpers-esbuild/get-esbuild-entries.mjs +31 -19
- package/dinou/esbuild/helpers-esbuild/strip-namespace.mjs +9 -0
- package/dinou/esbuild/helpers-esbuild/swc-disk-cache.mjs +225 -0
- package/dinou/esbuild/helpers-esbuild/update-manifest-for-module.mjs +7 -0
- package/dinou/esbuild/helpers-esbuild/write.mjs +111 -2
- package/dinou/esbuild/plugins-esbuild/assets-plugin.mjs +236 -161
- package/dinou/esbuild/plugins-esbuild/css-processor-plugin.mjs +101 -5
- package/dinou/esbuild/plugins-esbuild/react-client-manifest-plugin.mjs +63 -24
- package/dinou/esbuild/plugins-esbuild/server-functions-plugin.mjs +177 -56
- package/dinou/esbuild/plugins-esbuild/skip-missing-entry-points-plugin.mjs +3 -0
- package/dinou/esbuild/plugins-esbuild/stable-chunk-names-and-maps-plugin.mjs +182 -137
- package/dinou/esbuild/plugins-postcss/postcss-extract-plugin.js +38 -11
- package/dinou/esbuild/react-refresh/esm-hmr/client.mjs +55 -8
- package/dinou/esbuild/react-refresh/esm-hmr/server.js +1 -1
- package/dinou/esbuild/react-refresh/esm-hmr-plugin.mjs +238 -101
- package/dinou/esbuild/react-refresh/is-react-refresh-boundary.mjs +18 -4
- package/dinou/index.d.ts +315 -11
- package/dinou/index.js +12 -6
- package/dinou/index.mjs +9 -0
- package/dinou/node/build.mjs +195 -0
- package/dinou/node/bundle-dual-engine.mjs +1012 -0
- package/dinou/node/dev.mjs +2589 -0
- package/dinou/node/port-selector.mjs +164 -0
- package/dinou/node/terminal-status.mjs +345 -0
- package/dinou/package.json +16 -14
- package/dinou/rollup/react-refresh/esm-hmr/client.js +66 -10
- package/dinou/rollup/react-refresh/esm-hmr/server.js +1 -1
- package/dinou/rollup/react-refresh/is-react-refresh-boundary.js +24 -5
- package/dinou/rollup/react-refresh/react-refresh-runtime.js +13 -6
- package/dinou/rollup/react-refresh/react-refresh-wrap-modules.js +56 -11
- package/dinou/rollup/react-refresh/rollup-plugin-esm-hmr.js +176 -48
- package/dinou/rollup/rollup-plugins/dinou-asset-plugin.js +9 -5
- package/dinou/rollup/rollup-plugins/rollup-plugin-memory.js +66 -0
- package/dinou/rollup/rollup-plugins/rollup-plugin-react-client-manifest.js +468 -123
- package/dinou/rollup/rollup-plugins/rollup-plugin-server-functions.js +44 -12
- package/dinou/rollup/rollup-plugins/rollup-plugin-swc.js +100 -0
- package/dinou/rollup/rollup.config.js +155 -43
- package/dinou/server.d.ts +114 -12
- package/dinou/server.js +35 -10
- package/dinou/server.mjs +30 -9
- package/dinou/webpack/helpers/get-webpack-entries.js +14 -19
- package/dinou/webpack/loaders/server-functions-loader.js +22 -1
- package/dinou/webpack/loaders/swc-loader.js +76 -0
- package/dinou/webpack/plugins/manifest-generator-plugin.js +1 -0
- package/dinou/webpack/plugins/server-functions-plugin.js +75 -19
- package/dinou/webpack/plugins/webpack-memory-plugin.js +66 -0
- package/dinou/webpack/webpack.config.js +227 -29
- package/eject.js +173 -94
- package/package.json +110 -108
- package/dinou/core/asset-require-hook.js +0 -58
- package/dinou/core/client-error-webpack.jsx +0 -432
- package/dinou/core/client-error.jsx +0 -432
- package/dinou/core/concurrency-manager.js +0 -48
- package/dinou/core/context-proxy.js +0 -68
- package/dinou/core/generate-static-pages.js +0 -130
- package/dinou/core/generate-static-rscs.js +0 -151
- package/dinou/core/get-ssg-metadata.js +0 -31
- package/dinou/core/register-loader.mjs +0 -11
- package/dinou/core/register-paths.js +0 -27
- package/dinou/core/render-app-to-html.js +0 -430
- package/dinou/core/render-html.js +0 -407
- package/dinou/core/server.js +0 -1542
- package/dinou/esbuild/plugins-esbuild/write-metafile-plugin.mjs +0 -16
|
@@ -8,9 +8,15 @@ const createScopedName = require("../core/createScopedName");
|
|
|
8
8
|
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
|
9
9
|
const manifestGeneratorPlugin = require("./plugins/manifest-generator-plugin");
|
|
10
10
|
const ServerFunctionsPlugin = require("./plugins/server-functions-plugin");
|
|
11
|
+
const WebpackMemoryPlugin = require("./plugins/webpack-memory-plugin");
|
|
11
12
|
const webpack = require("webpack");
|
|
12
13
|
const { regex } = require("../core/asset-extensions");
|
|
13
14
|
const getCSSEntries = require("./helpers/get-webpack-entries");
|
|
15
|
+
const {
|
|
16
|
+
scanProjectDependenciesForClientComponents,
|
|
17
|
+
scanProjectDependenciesForClientComponentsAsync,
|
|
18
|
+
} = require("../core/scan-dependency-components.js");
|
|
19
|
+
const { useClientRegex } = require("../constants.js");
|
|
14
20
|
|
|
15
21
|
const isDevelopment = process.env.NODE_ENV !== "production";
|
|
16
22
|
const outputDirectory = isDevelopment ? ".dinou/public" : ".dinou/dist3";
|
|
@@ -41,6 +47,8 @@ const projectRoot = process.cwd();
|
|
|
41
47
|
const outputDirs = [
|
|
42
48
|
path.resolve(projectRoot, ".dinou/public"),
|
|
43
49
|
path.resolve(projectRoot, ".dinou/dist3"),
|
|
50
|
+
path.resolve(projectRoot, "out"),
|
|
51
|
+
path.resolve(projectRoot, "dist"),
|
|
44
52
|
];
|
|
45
53
|
|
|
46
54
|
function cleanDir(dir) {
|
|
@@ -62,24 +70,66 @@ function cleanDir(dir) {
|
|
|
62
70
|
module.exports = async () => {
|
|
63
71
|
const outputDir = path.resolve(process.cwd(), outputDirectory);
|
|
64
72
|
|
|
73
|
+
const shouldWriteToDisk =
|
|
74
|
+
process.env.DINOU_WRITE_TO_DISK === "true" || !isDevelopment;
|
|
75
|
+
|
|
65
76
|
// 🔥 CLEAN HARD
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
if (shouldWriteToDisk) {
|
|
78
|
+
cleanDir(outputDir);
|
|
79
|
+
}
|
|
80
|
+
const [cssEntries, , serverFiles] = await getCSSEntries();
|
|
81
|
+
|
|
82
|
+
const dependencyClientFiles = new Set();
|
|
83
|
+
if (typeof scanProjectDependenciesForClientComponentsAsync === "function") {
|
|
84
|
+
await scanProjectDependenciesForClientComponentsAsync(
|
|
85
|
+
process.cwd(),
|
|
86
|
+
dependencyClientFiles,
|
|
87
|
+
useClientRegex
|
|
88
|
+
);
|
|
89
|
+
} else {
|
|
90
|
+
scanProjectDependenciesForClientComponents(
|
|
91
|
+
process.cwd(),
|
|
92
|
+
dependencyClientFiles,
|
|
93
|
+
useClientRegex
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let clientDone = false;
|
|
98
|
+
let serverDone = false;
|
|
99
|
+
let ssgExecuted = false;
|
|
100
|
+
|
|
101
|
+
function runPostBuild() {
|
|
102
|
+
if (clientDone && serverDone && !ssgExecuted) {
|
|
103
|
+
ssgExecuted = true;
|
|
104
|
+
const fs = require("fs");
|
|
105
|
+
const serverDir = path.resolve(process.cwd(), ".dinou/dist3/server");
|
|
106
|
+
fs.mkdirSync(serverDir, { recursive: true });
|
|
107
|
+
fs.writeFileSync(
|
|
108
|
+
path.join(serverDir, "package.json"),
|
|
109
|
+
JSON.stringify({ type: "module" }, null, 2)
|
|
110
|
+
);
|
|
111
|
+
const { execSync } = require("child_process");
|
|
112
|
+
execSync(`"${process.execPath}" --conditions=react-server "${path.resolve(__dirname, "../core/run-ssg.js")}"`, {
|
|
113
|
+
stdio: "inherit",
|
|
114
|
+
env: { ...process.env, NODE_ENV: "production", DINOU_BUILD_TOOL: "webpack" },
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const clientConfig = {
|
|
69
119
|
performance: {
|
|
70
120
|
hints: isDevelopment ? false : "warning",
|
|
71
121
|
maxEntrypointSize: 512000,
|
|
72
122
|
maxAssetSize: 512000,
|
|
73
123
|
},
|
|
74
|
-
cache: false,
|
|
124
|
+
cache: isDevelopment ? { type: "memory" } : false,
|
|
75
125
|
mode: isDevelopment ? "development" : "production",
|
|
126
|
+
ignoreWarnings: [
|
|
127
|
+
/from "autoprefixer" plugin/,
|
|
128
|
+
],
|
|
76
129
|
entry: {
|
|
77
130
|
main: [path.resolve(__dirname, "../core/client-webpack.jsx")].filter(
|
|
78
131
|
Boolean,
|
|
79
132
|
),
|
|
80
|
-
error: [
|
|
81
|
-
path.resolve(__dirname, "../core/client-error-webpack.jsx"),
|
|
82
|
-
].filter(Boolean),
|
|
83
133
|
serverFunctionProxy: path.resolve(
|
|
84
134
|
__dirname,
|
|
85
135
|
"../core/server-function-proxy-webpack.js",
|
|
@@ -89,6 +139,7 @@ module.exports = async () => {
|
|
|
89
139
|
"../core/client-redirect.jsx",
|
|
90
140
|
),
|
|
91
141
|
dinouLink: path.resolve(__dirname, "../core/link.jsx"),
|
|
142
|
+
dinouSlot: path.resolve(__dirname, "../core/slot.js"),
|
|
92
143
|
...[...cssEntries].reduce(
|
|
93
144
|
(acc, cssEntry) => ({
|
|
94
145
|
...acc,
|
|
@@ -102,9 +153,10 @@ module.exports = async () => {
|
|
|
102
153
|
},
|
|
103
154
|
output: {
|
|
104
155
|
path: path.resolve(process.cwd(), outputDirectory),
|
|
105
|
-
filename: "[name]-[contenthash].js",
|
|
156
|
+
filename: isDevelopment ? "[name].js" : "[name]-[contenthash].js",
|
|
157
|
+
chunkFilename: isDevelopment ? "[name].js" : "[name]-[contenthash].js",
|
|
106
158
|
publicPath: "/",
|
|
107
|
-
clean:
|
|
159
|
+
clean: shouldWriteToDisk,
|
|
108
160
|
library: {
|
|
109
161
|
type: "module",
|
|
110
162
|
},
|
|
@@ -117,26 +169,37 @@ module.exports = async () => {
|
|
|
117
169
|
rules: [
|
|
118
170
|
{
|
|
119
171
|
test: /\.[jt]sx?$/,
|
|
120
|
-
|
|
172
|
+
type: "javascript/auto",
|
|
173
|
+
exclude: [/[\\/]node_modules[\\/](?!dinou)/, ...outputDirs],
|
|
121
174
|
use: [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"babel-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
175
|
+
isDevelopment
|
|
176
|
+
? {
|
|
177
|
+
loader: path.resolve(__dirname, "./loaders/swc-loader.js"),
|
|
178
|
+
options: {
|
|
179
|
+
isDevelopment: true,
|
|
180
|
+
},
|
|
181
|
+
}
|
|
182
|
+
: {
|
|
183
|
+
loader: "babel-loader",
|
|
184
|
+
options: {
|
|
185
|
+
presets: [
|
|
186
|
+
["@babel/preset-react", { runtime: "automatic" }],
|
|
187
|
+
"@babel/preset-typescript",
|
|
188
|
+
],
|
|
189
|
+
plugins: [
|
|
190
|
+
"babel-plugin-react-compiler",
|
|
191
|
+
"@babel/plugin-syntax-import-meta",
|
|
192
|
+
].filter(Boolean),
|
|
193
|
+
},
|
|
194
|
+
},
|
|
135
195
|
{
|
|
136
196
|
loader: path.resolve(
|
|
137
197
|
__dirname,
|
|
138
198
|
"./loaders/server-functions-loader.js",
|
|
139
199
|
),
|
|
200
|
+
options: {
|
|
201
|
+
serverFiles,
|
|
202
|
+
},
|
|
140
203
|
},
|
|
141
204
|
],
|
|
142
205
|
},
|
|
@@ -202,9 +265,55 @@ module.exports = async () => {
|
|
|
202
265
|
],
|
|
203
266
|
},
|
|
204
267
|
plugins: [
|
|
205
|
-
new ReactServerWebpackPlugin({
|
|
268
|
+
new ReactServerWebpackPlugin({
|
|
269
|
+
isServer: false,
|
|
270
|
+
clientReferences: [
|
|
271
|
+
{
|
|
272
|
+
directory: "./src",
|
|
273
|
+
recursive: true,
|
|
274
|
+
include: /\.(js|ts|jsx|tsx)$/,
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
directory: path.resolve(__dirname, "../core"),
|
|
278
|
+
recursive: false,
|
|
279
|
+
include: /\.(js|ts|jsx|tsx)$/,
|
|
280
|
+
},
|
|
281
|
+
...Array.from(dependencyClientFiles),
|
|
282
|
+
],
|
|
283
|
+
}),
|
|
284
|
+
isDevelopment && {
|
|
285
|
+
apply(compiler) {
|
|
286
|
+
compiler.hooks.thisCompilation.tap(
|
|
287
|
+
"DinouReactServerWatchPlugin",
|
|
288
|
+
(compilation) => {
|
|
289
|
+
const NormalModule = compiler.webpack ? compiler.webpack.NormalModule : webpack.NormalModule;
|
|
290
|
+
const hooks = NormalModule.getCompilationHooks(compilation);
|
|
291
|
+
hooks.needBuild.tap("DinouReactServerWatchPlugin", (module) => {
|
|
292
|
+
if (
|
|
293
|
+
module.resource &&
|
|
294
|
+
(module.resource.includes("client.browser") ||
|
|
295
|
+
module.resource.includes("client-webpack"))
|
|
296
|
+
) {
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
compiler.hooks.afterCompile.tap("DinouWatchSrcPlugin", (compilation) => {
|
|
303
|
+
const srcDir = path.resolve(process.cwd(), "src");
|
|
304
|
+
if (fs.existsSync(srcDir)) {
|
|
305
|
+
compilation.contextDependencies.add(srcDir);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
},
|
|
206
310
|
new CopyWebpackPlugin({
|
|
207
311
|
patterns: [
|
|
312
|
+
{
|
|
313
|
+
from: "public",
|
|
314
|
+
to: ".",
|
|
315
|
+
noErrorOnMissing: true,
|
|
316
|
+
},
|
|
208
317
|
{
|
|
209
318
|
from: "favicons",
|
|
210
319
|
to: ".",
|
|
@@ -226,6 +335,15 @@ module.exports = async () => {
|
|
|
226
335
|
new ServerFunctionsPlugin({
|
|
227
336
|
manifest: manifestGeneratorPlugin.manifestData,
|
|
228
337
|
}),
|
|
338
|
+
isDevelopment && new WebpackMemoryPlugin(),
|
|
339
|
+
!isDevelopment && {
|
|
340
|
+
apply(compiler) {
|
|
341
|
+
compiler.hooks.done.tap("PostBuildClient", () => {
|
|
342
|
+
clientDone = true;
|
|
343
|
+
runPostBuild();
|
|
344
|
+
});
|
|
345
|
+
},
|
|
346
|
+
},
|
|
229
347
|
].filter(Boolean),
|
|
230
348
|
resolve: {
|
|
231
349
|
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
@@ -238,6 +356,10 @@ module.exports = async () => {
|
|
|
238
356
|
alias: {
|
|
239
357
|
...(isEjected ? { dinou: localDinouPath } : {}),
|
|
240
358
|
},
|
|
359
|
+
fallback: {
|
|
360
|
+
async_hooks: false,
|
|
361
|
+
"node:async_hooks": false,
|
|
362
|
+
},
|
|
241
363
|
plugins: configFile
|
|
242
364
|
? [
|
|
243
365
|
new TsconfigPathsPlugin({
|
|
@@ -282,7 +404,13 @@ module.exports = async () => {
|
|
|
282
404
|
},
|
|
283
405
|
},
|
|
284
406
|
watchOptions: {
|
|
285
|
-
ignored:
|
|
407
|
+
ignored: [
|
|
408
|
+
"**/node_modules/**",
|
|
409
|
+
"**/.git/**",
|
|
410
|
+
"**/.dinou/node-dev/**",
|
|
411
|
+
"**/.dinou/dist2/**",
|
|
412
|
+
...outputDirs.map((dir) => `${dir}/**`),
|
|
413
|
+
],
|
|
286
414
|
},
|
|
287
415
|
stats: "normal", // or 'verbose' in dev
|
|
288
416
|
infrastructureLogging: {
|
|
@@ -291,22 +419,92 @@ module.exports = async () => {
|
|
|
291
419
|
...(isDevelopment
|
|
292
420
|
? {
|
|
293
421
|
devServer: {
|
|
294
|
-
port:
|
|
422
|
+
port: Number(process.env.HMR_PORT || (Number(process.env.PORT || 3000) + 1)),
|
|
295
423
|
hot: false,
|
|
424
|
+
liveReload: true,
|
|
425
|
+
client: {
|
|
426
|
+
webSocketURL: `ws://localhost:${process.env.HMR_PORT || (Number(process.env.PORT || 3000) + 1)}/ws`,
|
|
427
|
+
overlay: false,
|
|
428
|
+
},
|
|
296
429
|
devMiddleware: {
|
|
297
430
|
index: false,
|
|
298
|
-
writeToDisk: true,
|
|
431
|
+
writeToDisk: process.env.DINOU_WRITE_TO_DISK === "true",
|
|
299
432
|
},
|
|
433
|
+
watchFiles: [
|
|
434
|
+
path.resolve(process.cwd(), "src/**/*"),
|
|
435
|
+
],
|
|
300
436
|
proxy: [
|
|
301
437
|
{
|
|
302
438
|
context: () => true,
|
|
303
|
-
target:
|
|
439
|
+
target: `http://localhost:${process.env.PORT || 3000}`,
|
|
304
440
|
changeOrigin: true,
|
|
305
441
|
},
|
|
306
442
|
],
|
|
307
|
-
client: false,
|
|
308
443
|
},
|
|
309
444
|
}
|
|
310
445
|
: {}),
|
|
311
446
|
};
|
|
447
|
+
|
|
448
|
+
if (isDevelopment) {
|
|
449
|
+
return clientConfig;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const serverConfig = {
|
|
453
|
+
mode: "production",
|
|
454
|
+
target: "node20",
|
|
455
|
+
experiments: {
|
|
456
|
+
outputModule: true,
|
|
457
|
+
},
|
|
458
|
+
entry: {
|
|
459
|
+
handler: path.resolve(__dirname, "../core/handler.js"),
|
|
460
|
+
netlify: path.resolve(__dirname, "../adapters/netlify.js"),
|
|
461
|
+
},
|
|
462
|
+
output: {
|
|
463
|
+
path: path.resolve(process.cwd(), outputDirectory, "server"),
|
|
464
|
+
filename: "[name].js",
|
|
465
|
+
library: {
|
|
466
|
+
type: "module",
|
|
467
|
+
},
|
|
468
|
+
chunkFormat: "module",
|
|
469
|
+
},
|
|
470
|
+
resolve: {
|
|
471
|
+
conditionNames: ["react-server", "node", "import", "require"],
|
|
472
|
+
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
473
|
+
alias: {
|
|
474
|
+
...(isEjected ? { dinou: localDinouPath } : {}),
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
externals: [
|
|
478
|
+
"express",
|
|
479
|
+
"chokidar",
|
|
480
|
+
"dotenv",
|
|
481
|
+
"fsevents",
|
|
482
|
+
"@swc/core",
|
|
483
|
+
"@babel/core",
|
|
484
|
+
"esbuild",
|
|
485
|
+
],
|
|
486
|
+
module: {
|
|
487
|
+
exprContextCritical: false,
|
|
488
|
+
},
|
|
489
|
+
ignoreWarnings: [
|
|
490
|
+
/Critical dependency/,
|
|
491
|
+
],
|
|
492
|
+
plugins: [
|
|
493
|
+
new webpack.BannerPlugin({
|
|
494
|
+
banner: "import { createRequire as ___createRequire } from 'node:module'; import { fileURLToPath as ___fileURLToPath } from 'node:url'; import ___path from 'node:path'; const require = ___createRequire(import.meta.url || ___path.resolve(process.cwd(), 'package.json')); globalThis.__dinou_require__ = require; const __filename = import.meta.url ? ___fileURLToPath(import.meta.url) : ___path.resolve(process.cwd(), 'index.js'); const __dirname = ___path.dirname(__filename); process.env.NODE_ENV = process.env.NODE_ENV || 'production';",
|
|
495
|
+
raw: true,
|
|
496
|
+
entryOnly: false,
|
|
497
|
+
}),
|
|
498
|
+
{
|
|
499
|
+
apply(compiler) {
|
|
500
|
+
compiler.hooks.done.tap("PostBuildServer", () => {
|
|
501
|
+
serverDone = true;
|
|
502
|
+
runPostBuild();
|
|
503
|
+
});
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
],
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
return [clientConfig, serverConfig];
|
|
312
510
|
};
|
package/eject.js
CHANGED
|
@@ -1,94 +1,173 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
const { execSync } = require("child_process");
|
|
4
|
-
|
|
5
|
-
const dinouPath = path.resolve(__dirname, "dinou");
|
|
6
|
-
const projectRoot = process.cwd();
|
|
7
|
-
|
|
8
|
-
console.log("🚀 Starting Dinou ejecting process...");
|
|
9
|
-
|
|
10
|
-
fs.cpSync(dinouPath, path.join(projectRoot, "dinou"), {
|
|
11
|
-
recursive: true,
|
|
12
|
-
});
|
|
13
|
-
console.log("✅ Files
|
|
14
|
-
|
|
15
|
-
const pkgPath = path.join(projectRoot, "package.json");
|
|
16
|
-
const pkg = require(pkgPath);
|
|
17
|
-
|
|
18
|
-
pkg.scripts
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"cross-env NODE_ENV=production node dinou/
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
"cross-env
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { execSync } = require("child_process");
|
|
4
|
+
|
|
5
|
+
const dinouPath = path.resolve(__dirname, "dinou");
|
|
6
|
+
const projectRoot = process.cwd();
|
|
7
|
+
|
|
8
|
+
console.log("🚀 Starting Dinou ejecting process...");
|
|
9
|
+
|
|
10
|
+
fs.cpSync(dinouPath, path.join(projectRoot, "dinou"), {
|
|
11
|
+
recursive: true,
|
|
12
|
+
});
|
|
13
|
+
console.log("✅ Files copied to ./dinou");
|
|
14
|
+
|
|
15
|
+
const pkgPath = path.join(projectRoot, "package.json");
|
|
16
|
+
const pkg = require(pkgPath);
|
|
17
|
+
|
|
18
|
+
pkg.scripts = pkg.scripts || {};
|
|
19
|
+
|
|
20
|
+
const ejectedScripts = {
|
|
21
|
+
dev: "npm run dev:esbuild",
|
|
22
|
+
build: "npm run build:node",
|
|
23
|
+
start: "npm run start:node",
|
|
24
|
+
"dev:esbuild": "cross-env DINOU_BUILD_TOOL=esbuild node dinou/node/dev.mjs",
|
|
25
|
+
"dev:rollup": "cross-env DINOU_BUILD_TOOL=rollup node dinou/node/dev.mjs",
|
|
26
|
+
"dev:webpack": "cross-env DINOU_BUILD_TOOL=webpack node dinou/node/dev.mjs",
|
|
27
|
+
"build:node": "npm run build:client:esbuild && node ./dinou/node/build.mjs",
|
|
28
|
+
"build:node:esbuild": "npm run build:node",
|
|
29
|
+
"build:node:rollup": "npm run build:client:rollup && node ./dinou/node/build.mjs",
|
|
30
|
+
"build:node:webpack": "npm run build:client:webpack && cross-env DINOU_BUILD_TOOL=webpack node ./dinou/node/build.mjs",
|
|
31
|
+
"start:node": "cross-env NODE_ENV=production node dinou/adapters/node.mjs",
|
|
32
|
+
"start:node:esbuild": "npm run start:node",
|
|
33
|
+
"start:node:rollup": "npm run start:node",
|
|
34
|
+
"start:node:webpack": "cross-env NODE_ENV=production DINOU_BUILD_TOOL=webpack node dinou/adapters/node.mjs",
|
|
35
|
+
"build:cloudflare": "npm run build:client:esbuild && node ./dinou/cloudflare/build.mjs",
|
|
36
|
+
"build:cloudflare:esbuild": "npm run build:cloudflare",
|
|
37
|
+
"build:cloudflare:rollup": "npm run build:client:rollup && node ./dinou/cloudflare/build.mjs",
|
|
38
|
+
"build:cloudflare:webpack": "npm run build:client:webpack && cross-env DINOU_BUILD_TOOL=webpack node ./dinou/cloudflare/build.mjs",
|
|
39
|
+
"build:deno": "npm run build:client:esbuild && node ./dinou/deno/build.mjs && deno run --unstable-kv --allow-net --allow-read --allow-write --allow-env dinou/deno/seed-kv.js",
|
|
40
|
+
"build:deno:esbuild": "npm run build:deno",
|
|
41
|
+
"build:deno:rollup": "npm run build:client:rollup && node ./dinou/deno/build.mjs && deno run --unstable-kv --allow-net --allow-read --allow-write --allow-env dinou/deno/seed-kv.js",
|
|
42
|
+
"build:deno:webpack": "npm run build:client:webpack && cross-env DINOU_BUILD_TOOL=webpack node ./dinou/deno/build.mjs && deno run --unstable-kv --allow-net --allow-read --allow-write --allow-env dinou/deno/seed-kv.js",
|
|
43
|
+
"build:deno:compile": "npm run build:deno:compile:esbuild",
|
|
44
|
+
"build:deno:compile:esbuild": "npm run build:deno:esbuild && deno compile --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server .dinou/deno/main.js",
|
|
45
|
+
"build:deno:compile:rollup": "npm run build:deno:rollup && deno compile --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server .dinou/deno/main.js",
|
|
46
|
+
"build:deno:compile:webpack": "npm run build:deno:webpack && deno compile --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server .dinou/deno/main.js",
|
|
47
|
+
"build:deno:compile:linux": "npm run build:deno:compile:linux:esbuild",
|
|
48
|
+
"build:deno:compile:linux:esbuild": "npm run build:deno:esbuild && deno compile --target x86_64-unknown-linux-gnu --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-linux .dinou/deno/main.js",
|
|
49
|
+
"build:deno:compile:linux:rollup": "npm run build:deno:rollup && deno compile --target x86_64-unknown-linux-gnu --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-linux .dinou/deno/main.js",
|
|
50
|
+
"build:deno:compile:linux:webpack": "npm run build:deno:webpack && deno compile --target x86_64-unknown-linux-gnu --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-linux .dinou/deno/main.js",
|
|
51
|
+
"build:deno:compile:linux_arm": "npm run build:deno:compile:linux_arm:esbuild",
|
|
52
|
+
"build:deno:compile:linux_arm:esbuild": "npm run build:deno:esbuild && deno compile --target aarch64-unknown-linux-gnu --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-linux-arm .dinou/deno/main.js",
|
|
53
|
+
"build:deno:compile:linux_arm:rollup": "npm run build:deno:rollup && deno compile --target aarch64-unknown-linux-gnu --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-linux-arm .dinou/deno/main.js",
|
|
54
|
+
"build:deno:compile:linux_arm:webpack": "npm run build:deno:webpack && deno compile --target aarch64-unknown-linux-gnu --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-linux-arm .dinou/deno/main.js",
|
|
55
|
+
"build:deno:compile:mac": "npm run build:deno:compile:mac:esbuild",
|
|
56
|
+
"build:deno:compile:mac:esbuild": "npm run build:deno:esbuild && deno compile --target aarch64-apple-darwin --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-mac .dinou/deno/main.js",
|
|
57
|
+
"build:deno:compile:mac:rollup": "npm run build:deno:rollup && deno compile --target aarch64-apple-darwin --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-mac .dinou/deno/main.js",
|
|
58
|
+
"build:deno:compile:mac:webpack": "npm run build:deno:webpack && deno compile --target aarch64-apple-darwin --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-mac .dinou/deno/main.js",
|
|
59
|
+
"build:deno:compile:win": "npm run build:deno:compile:win:esbuild",
|
|
60
|
+
"build:deno:compile:win:esbuild": "npm run build:deno:esbuild && deno compile --target x86_64-pc-windows-msvc --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-win .dinou/deno/main.js",
|
|
61
|
+
"build:deno:compile:win:rollup": "npm run build:deno:rollup && deno compile --target x86_64-pc-windows-msvc --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-win .dinou/deno/main.js",
|
|
62
|
+
"build:deno:compile:win:webpack": "npm run build:deno:webpack && deno compile --target x86_64-pc-windows-msvc --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output dist/deno-server-win .dinou/deno/main.js",
|
|
63
|
+
"start:deno": "deno run --unstable-kv --allow-net --allow-read --allow-write --allow-env --allow-sys dinou/adapters/deno.js",
|
|
64
|
+
"build:bun": "npm run build:client:esbuild && node ./dinou/bun/build.mjs",
|
|
65
|
+
"build:bun:esbuild": "npm run build:bun",
|
|
66
|
+
"build:bun:rollup": "npm run build:client:rollup && node ./dinou/bun/build.mjs",
|
|
67
|
+
"build:bun:webpack": "npm run build:client:webpack && cross-env DINOU_BUILD_TOOL=webpack node ./dinou/bun/build.mjs",
|
|
68
|
+
"build:bun:compile": "npm run build:bun:compile:esbuild",
|
|
69
|
+
"build:bun:compile:esbuild": "npm run build:bun:esbuild && bun build --compile .dinou/bun/server.js --outfile dist/server",
|
|
70
|
+
"build:bun:compile:rollup": "npm run build:bun:rollup && bun build --compile .dinou/bun/server.js --outfile dist/server",
|
|
71
|
+
"build:bun:compile:webpack": "npm run build:bun:webpack && bun build --compile .dinou/bun/server.js --outfile dist/server",
|
|
72
|
+
"build:bun:compile:linux": "npm run build:bun:compile:linux:esbuild",
|
|
73
|
+
"build:bun:compile:linux:esbuild": "npm run build:bun:esbuild && bun build --compile --target=bun-linux-x64 .dinou/bun/server.js --outfile dist/server-linux",
|
|
74
|
+
"build:bun:compile:linux:rollup": "npm run build:bun:rollup && bun build --compile --target=bun-linux-x64 .dinou/bun/server.js --outfile dist/server-linux",
|
|
75
|
+
"build:bun:compile:linux:webpack": "npm run build:bun:webpack && bun build --compile --target=bun-linux-x64 .dinou/bun/server.js --outfile dist/server-linux",
|
|
76
|
+
"build:bun:compile:linux_arm": "npm run build:bun:compile:linux_arm:esbuild",
|
|
77
|
+
"build:bun:compile:linux_arm:esbuild": "npm run build:bun:esbuild && bun build --compile --target=bun-linux-arm64 .dinou/bun/server.js --outfile dist/server-linux-arm",
|
|
78
|
+
"build:bun:compile:linux_arm:rollup": "npm run build:bun:rollup && bun build --compile --target=bun-linux-arm64 .dinou/bun/server.js --outfile dist/server-linux-arm",
|
|
79
|
+
"build:bun:compile:linux_arm:webpack": "npm run build:bun:webpack && bun build --compile --target=bun-linux-arm64 .dinou/bun/server.js --outfile dist/server-linux-arm",
|
|
80
|
+
"build:bun:compile:mac": "npm run build:bun:compile:mac:esbuild",
|
|
81
|
+
"build:bun:compile:mac:esbuild": "npm run build:bun:esbuild && bun build --compile --target=bun-darwin-arm64 .dinou/bun/server.js --outfile dist/server-mac",
|
|
82
|
+
"build:bun:compile:mac:rollup": "npm run build:bun:rollup && bun build --compile --target=bun-darwin-arm64 .dinou/bun/server.js --outfile dist/server-mac",
|
|
83
|
+
"build:bun:compile:mac:webpack": "npm run build:bun:webpack && bun build --compile --target=bun-darwin-arm64 .dinou/bun/server.js --outfile dist/server-mac",
|
|
84
|
+
"build:bun:compile:win": "npm run build:bun:compile:win:esbuild",
|
|
85
|
+
"build:bun:compile:win:esbuild": "npm run build:bun:esbuild && bun build --compile --target=bun-windows-x64 .dinou/bun/server.js --outfile dist/server-win",
|
|
86
|
+
"build:bun:compile:win:rollup": "npm run build:bun:rollup && bun build --compile --target=bun-windows-x64 .dinou/bun/server.js --outfile dist/server-win",
|
|
87
|
+
"build:bun:compile:win:webpack": "npm run build:bun:webpack && bun build --compile --target=bun-windows-x64 .dinou/bun/server.js --outfile dist/server-win",
|
|
88
|
+
"build:bun:pure": "npm run build:bun:pure:esbuild",
|
|
89
|
+
"build:bun:pure:esbuild": "cross-env NODE_ENV=production bun dinou/esbuild/build.mjs && bun ./dinou/bun/build.mjs",
|
|
90
|
+
"build:bun:pure:rollup": "cross-env NODE_ENV=production rollup -c ./dinou/rollup/rollup.config.js && bun ./dinou/bun/build.mjs",
|
|
91
|
+
"build:bun:pure:webpack": "cross-env NODE_ENV=production webpack --config dinou/webpack/webpack.config.js && cross-env DINOU_BUILD_TOOL=webpack bun ./dinou/bun/build.mjs",
|
|
92
|
+
"build:bun:pure:compile": "npm run build:bun:pure:compile:esbuild",
|
|
93
|
+
"build:bun:pure:compile:esbuild": "npm run build:bun:pure:esbuild && bun build --compile .dinou/bun/server.js --outfile dist/server",
|
|
94
|
+
"build:bun:pure:compile:rollup": "npm run build:bun:pure:rollup && bun build --compile .dinou/bun/server.js --outfile dist/server",
|
|
95
|
+
"build:bun:pure:compile:webpack": "npm run build:bun:pure:webpack && bun build --compile .dinou/bun/server.js --outfile dist/server",
|
|
96
|
+
"build:bun:pure:compile:linux": "npm run build:bun:pure:compile:linux:esbuild",
|
|
97
|
+
"build:bun:pure:compile:linux:esbuild": "npm run build:bun:pure:esbuild && bun build --compile --target=bun-linux-x64 .dinou/bun/server.js --outfile dist/server-linux",
|
|
98
|
+
"build:bun:pure:compile:linux:rollup": "npm run build:bun:pure:rollup && bun build --compile --target=bun-linux-x64 .dinou/bun/server.js --outfile dist/server-linux",
|
|
99
|
+
"build:bun:pure:compile:linux:webpack": "npm run build:bun:pure:webpack && bun build --compile --target=bun-linux-x64 .dinou/bun/server.js --outfile dist/server-linux",
|
|
100
|
+
"build:bun:pure:compile:linux_arm": "npm run build:bun:pure:compile:linux_arm:esbuild",
|
|
101
|
+
"build:bun:pure:compile:linux_arm:esbuild": "npm run build:bun:pure:esbuild && bun build --compile --target=bun-linux-arm64 .dinou/bun/server.js --outfile dist/server-linux-arm",
|
|
102
|
+
"build:bun:pure:compile:linux_arm:rollup": "npm run build:bun:pure:rollup && bun build --compile --target=bun-linux-arm64 .dinou/bun/server.js --outfile dist/server-linux-arm",
|
|
103
|
+
"build:bun:pure:compile:linux_arm:webpack": "npm run build:bun:pure:webpack && bun build --compile --target=bun-linux-arm64 .dinou/bun/server.js --outfile dist/server-linux-arm",
|
|
104
|
+
"build:bun:pure:compile:mac": "npm run build:bun:pure:compile:mac:esbuild",
|
|
105
|
+
"build:bun:pure:compile:mac:esbuild": "npm run build:bun:pure:esbuild && bun build --compile --target=bun-darwin-arm64 .dinou/bun/server.js --outfile dist/server-mac",
|
|
106
|
+
"build:bun:pure:compile:mac:rollup": "npm run build:bun:pure:rollup && bun build --compile --target=bun-darwin-arm64 .dinou/bun/server.js --outfile dist/server-mac",
|
|
107
|
+
"build:bun:pure:compile:mac:webpack": "npm run build:bun:pure:webpack && bun build --compile --target=bun-darwin-arm64 .dinou/bun/server.js --outfile dist/server-mac",
|
|
108
|
+
"build:bun:pure:compile:win": "npm run build:bun:pure:compile:win:esbuild",
|
|
109
|
+
"build:bun:pure:compile:win:esbuild": "npm run build:bun:pure:esbuild && bun build --compile --target=bun-windows-x64 .dinou/bun/server.js --outfile dist/server-win",
|
|
110
|
+
"build:bun:pure:compile:win:rollup": "npm run build:bun:pure:rollup && bun build --compile --target=bun-windows-x64 .dinou/bun/server.js --outfile dist/server-win",
|
|
111
|
+
"build:bun:pure:compile:win:webpack": "npm run build:bun:pure:webpack && bun build --compile --target=bun-windows-x64 .dinou/bun/server.js --outfile dist/server-win",
|
|
112
|
+
"start:bun": "cross-env NODE_ENV=production bun dinou/adapters/bun.js",
|
|
113
|
+
"start:bun:esbuild": "npm run start:bun",
|
|
114
|
+
"start:bun:rollup": "npm run start:bun",
|
|
115
|
+
"start:bun:webpack": "cross-env NODE_ENV=production DINOU_BUILD_TOOL=webpack bun dinou/adapters/bun.js",
|
|
116
|
+
"export-static": "npm run export-static:esbuild",
|
|
117
|
+
"export-static:esbuild": "npm run build:client:esbuild && node ./dinou/core/export-static.mjs",
|
|
118
|
+
"export-static:rollup": "npm run build:client:rollup && node ./dinou/core/export-static.mjs",
|
|
119
|
+
"export-static:webpack": "npm run build:client:webpack && node ./dinou/core/export-static.mjs",
|
|
120
|
+
"build:client:esbuild": "cross-env NODE_ENV=production node dinou/esbuild/build.mjs",
|
|
121
|
+
"build:client:rollup": "cross-env NODE_ENV=production rollup -c ./dinou/rollup/rollup.config.js",
|
|
122
|
+
"build:client:webpack": "cross-env NODE_ENV=production webpack --config dinou/webpack/webpack.config.js",
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
Object.assign(pkg.scripts, ejectedScripts);
|
|
126
|
+
|
|
127
|
+
delete pkg.scripts.eject;
|
|
128
|
+
|
|
129
|
+
if (!pkg.dependencies) {
|
|
130
|
+
pkg.dependencies = {};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
pkg.dependencies["dinou"] = "file:./dinou";
|
|
134
|
+
|
|
135
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
136
|
+
|
|
137
|
+
function detectPackageManager() {
|
|
138
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
139
|
+
|
|
140
|
+
if (userAgent) {
|
|
141
|
+
if (userAgent.startsWith("yarn")) return "yarn";
|
|
142
|
+
if (userAgent.startsWith("pnpm")) return "pnpm";
|
|
143
|
+
if (userAgent.startsWith("bun")) return "bun";
|
|
144
|
+
if (userAgent.startsWith("npm")) return "npm";
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (fs.existsSync(path.join(projectRoot, "yarn.lock"))) return "yarn";
|
|
148
|
+
if (fs.existsSync(path.join(projectRoot, "pnpm-lock.yaml"))) return "pnpm";
|
|
149
|
+
if (fs.existsSync(path.join(projectRoot, "bun.lockb"))) return "bun";
|
|
150
|
+
if (fs.existsSync(path.join(projectRoot, "package-lock.json"))) return "npm";
|
|
151
|
+
|
|
152
|
+
return "npm";
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const pm = detectPackageManager();
|
|
156
|
+
console.log(`📦 Package manager detected: ${pm}`);
|
|
157
|
+
|
|
158
|
+
const installCommand = `${pm} install`;
|
|
159
|
+
|
|
160
|
+
console.log(`🔄 Executing '${installCommand}' to link dependencies...`);
|
|
161
|
+
|
|
162
|
+
try {
|
|
163
|
+
execSync(installCommand, { stdio: "inherit", cwd: projectRoot });
|
|
164
|
+
console.log("✅ Dependencies updated successfully");
|
|
165
|
+
} catch (error) {
|
|
166
|
+
console.error(
|
|
167
|
+
`❌ Error on executing ${installCommand}. Please, install dependencies manually`,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
console.log(
|
|
172
|
+
"🎉 Eject completed successfully! Dinou is now running from local source.",
|
|
173
|
+
);
|