dinou 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,14 @@
1
- const addHook = require("./asset-require-hook.js");
2
- const { register } = require("esbuild-register/dist/node");
3
- register({
4
- target: "esnext",
5
- format: "cjs",
1
+ const babelRegister = require("@babel/register");
2
+ babelRegister({
3
+ ignore: [/[\\\/](build|server|node_modules)[\\\/]/],
4
+ presets: [
5
+ ["@babel/preset-react", { runtime: "automatic" }],
6
+ "@babel/preset-typescript",
7
+ ],
8
+ plugins: ["@babel/transform-modules-commonjs"],
6
9
  extensions: [".js", ".jsx", ".ts", ".tsx"],
7
- jsx: "automatic",
8
10
  });
11
+ const addHook = require("./asset-require-hook.js");
9
12
  const createScopedName = require("./createScopedName");
10
13
  require("css-modules-require-hook")({
11
14
  generateScopedName: createScopedName,
package/dinou/server.js CHANGED
@@ -5,7 +5,6 @@ const { readFileSync } = require("fs");
5
5
  const { renderToPipeableStream } = require("react-server-dom-webpack/server");
6
6
  const express = require("express");
7
7
  const { spawn } = require("child_process");
8
- const { register } = require("esbuild-register/dist/node");
9
8
  const webpack = require("webpack");
10
9
  const webpackDevMiddleware = require("webpack-dev-middleware");
11
10
  const webpackHotMiddleware = require("webpack-hot-middleware");
@@ -13,11 +12,15 @@ const webpackConfig = require(path.resolve(__dirname, "../webpack.config.js"));
13
12
  const { getSSGJSXOrJSX } = require("./get-jsx.js");
14
13
  const addHook = require("./asset-require-hook.js");
15
14
  webpackRegister();
16
- register({
17
- target: "esnext",
18
- format: "cjs",
15
+ const babelRegister = require("@babel/register");
16
+ babelRegister({
17
+ ignore: [/[\\\/](build|server|node_modules)[\\\/]/],
18
+ presets: [
19
+ ["@babel/preset-react", { runtime: "automatic" }],
20
+ "@babel/preset-typescript",
21
+ ],
22
+ plugins: ["@babel/transform-modules-commonjs"],
19
23
  extensions: [".js", ".jsx", ".ts", ".tsx"],
20
- jsx: "automatic",
21
24
  });
22
25
  const createScopedName = require("./createScopedName");
23
26
  require("css-modules-require-hook")({
@@ -53,7 +56,6 @@ app.get(/^\/____rsc_payload____\/.*\/?$/, async (req, res) => {
53
56
  const reqPath = (
54
57
  req.path.endsWith("/") ? req.path : req.path + "/"
55
58
  ).replace("/____rsc_payload____", "");
56
-
57
59
  jsx = await getSSGJSXOrJSX(reqPath, { ...req.query });
58
60
  const manifest = readFileSync(
59
61
  path.resolve(process.cwd(), "____public____/react-client-manifest.json"),
@@ -106,13 +108,11 @@ function renderAppToHtml(reqPath, paramsString) {
106
108
  app.get(/^\/.*\/?$/, async (req, res) => {
107
109
  try {
108
110
  const reqPath = req.path.endsWith("/") ? req.path : req.path + "/";
109
-
110
111
  // Get the stream from the child process
111
112
  const appHtmlStream = await renderAppToHtml(
112
113
  reqPath,
113
114
  JSON.stringify({ ...req.query })
114
115
  );
115
-
116
116
  // Set headers for the response
117
117
  res.setHeader("Content-Type", "text/html");
118
118
 
package/dinou/ssg.js CHANGED
@@ -1,12 +1,15 @@
1
- const { register } = require("esbuild-register/dist/node");
2
- const { buildStaticPages } = require("./build-static-pages");
3
- const addHook = require("./asset-require-hook.js");
4
- register({
5
- target: "esnext",
6
- format: "cjs",
1
+ const babelRegister = require("@babel/register");
2
+ babelRegister({
3
+ ignore: [/[\\\/](build|server|node_modules)[\\\/]/],
4
+ presets: [
5
+ ["@babel/preset-react", { runtime: "automatic" }],
6
+ "@babel/preset-typescript",
7
+ ],
8
+ plugins: ["@babel/transform-modules-commonjs"],
7
9
  extensions: [".js", ".jsx", ".ts", ".tsx"],
8
- jsx: "automatic",
9
10
  });
11
+ const { buildStaticPages } = require("./build-static-pages");
12
+ const addHook = require("./asset-require-hook.js");
10
13
  const createScopedName = require("./createScopedName");
11
14
  require("css-modules-require-hook")({
12
15
  generateScopedName: createScopedName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinou",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Minimal React 19 Framework",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -20,6 +20,12 @@
20
20
  "url": "https://github.com/roggc/dinou.git"
21
21
  },
22
22
  "dependencies": {
23
+ "@babel/core": "^7.27.4",
24
+ "@babel/plugin-syntax-import-meta": "^7.10.4",
25
+ "@babel/plugin-transform-modules-commonjs": "^7.27.1",
26
+ "@babel/preset-react": "^7.27.1",
27
+ "@babel/preset-typescript": "^7.27.1",
28
+ "@babel/register": "^7.27.1",
23
29
  "@tailwindcss/postcss": "^4.1.10",
24
30
  "autoprefixer": "^10.4.21",
25
31
  "babel-loader": "^10.0.0",
@@ -29,8 +35,6 @@
29
35
  "css-loader": "^7.1.2",
30
36
  "css-modules-require-hook": "^4.2.3",
31
37
  "dotenv": "^16.5.0",
32
- "esbuild-loader": "^4.3.0",
33
- "esbuild-register": "^3.6.0",
34
38
  "express": "^5.1.0",
35
39
  "generic-names": "^4.0.0",
36
40
  "loader-utils": "^3.3.1",
package/webpack.config.js CHANGED
@@ -7,7 +7,6 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
7
7
  const MiniCssExtractPlugin = require("mini-css-extract-plugin");
8
8
  const createScopedName = require("./dinou/createScopedName");
9
9
  const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
10
- const { EsbuildPlugin } = require("esbuild-loader");
11
10
 
12
11
  const isDevelopment = process.env.NODE_ENV !== "production";
13
12
 
@@ -40,13 +39,19 @@ module.exports = {
40
39
  module: {
41
40
  rules: [
42
41
  {
43
- // Match `.js`, `.jsx`, `.ts` or `.tsx` files
44
- test: /\.[jt]sx?$/,
45
- loader: "esbuild-loader",
46
- options: {
47
- // JavaScript version to compile to
48
- target: "esnext",
49
- jsx: "automatic", // Use React's automatic JSX runtime
42
+ test: /\.(js|jsx|ts|tsx)$/,
43
+ use: {
44
+ loader: "babel-loader",
45
+ options: {
46
+ presets: [
47
+ ["@babel/preset-react", { runtime: "automatic" }],
48
+ "@babel/preset-typescript",
49
+ ],
50
+ plugins: [
51
+ "@babel/plugin-transform-modules-commonjs",
52
+ "@babel/plugin-syntax-import-meta",
53
+ ],
54
+ },
50
55
  },
51
56
  exclude: [/node_modules\/(?!dinou)/],
52
57
  },
@@ -106,7 +111,7 @@ module.exports = {
106
111
 
107
112
  return `images/${scoped}[ext]`;
108
113
  },
109
- publicPath: "/",
114
+ publicPath: "",
110
115
  },
111
116
  },
112
117
  ],
@@ -149,10 +154,6 @@ module.exports = {
149
154
  },
150
155
  },
151
156
  },
152
- minimize: !isDevelopment,
153
- minimizer: !isDevelopment
154
- ? [new EsbuildPlugin({ target: "esnext", css: true })]
155
- : [],
156
157
  },
157
158
  watchOptions: {
158
159
  ignored: /____public____/,