dinou 1.7.1 → 1.7.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,10 +1,11 @@
1
1
  const getJSX = require("./get-jsx.js");
2
2
  const getSSGJSX = require("./get-ssg-jsx.js");
3
3
 
4
- async function getSSGJSXOrJSX(reqPath, query) {
5
- const result = Object.keys(query).length
6
- ? await getJSX(reqPath, query)
7
- : getSSGJSX(reqPath) ?? (await getJSX(reqPath, query));
4
+ async function getSSGJSXOrJSX(reqPath, query, isDevelopment = false) {
5
+ const result =
6
+ Object.keys(query).length || isDevelopment
7
+ ? await getJSX(reqPath, query)
8
+ : getSSGJSX(reqPath) ?? (await getJSX(reqPath, query));
8
9
  return result;
9
10
  }
10
11
 
@@ -28,6 +28,7 @@ const getJSX = require("./get-jsx");
28
28
  const getSSGJSX = require("./get-ssg-jsx.js");
29
29
  const { getErrorJSX } = require("./get-error-jsx");
30
30
  const { renderJSXToClientJSX } = require("./render-jsx-to-client-jsx");
31
+ const isDevelopment = process.env.NODE_ENV !== "production";
31
32
 
32
33
  function formatErrorHtml(error) {
33
34
  const message = error.message || "Unknown error";
@@ -112,10 +113,11 @@ function formatErrorHtmlProduction(error) {
112
113
 
113
114
  async function renderToStream(reqPath, query) {
114
115
  try {
115
- const jsx = Object.keys(query).length
116
- ? renderJSXToClientJSX(await getJSX(reqPath, query))
117
- : getSSGJSX(reqPath) ??
118
- renderJSXToClientJSX(await getJSX(reqPath, query));
116
+ const jsx =
117
+ Object.keys(query).length || isDevelopment
118
+ ? renderJSXToClientJSX(await getJSX(reqPath, query))
119
+ : getSSGJSX(reqPath) ??
120
+ renderJSXToClientJSX(await getJSX(reqPath, query));
119
121
 
120
122
  const stream = renderToPipeableStream(jsx, {
121
123
  onError(error) {
package/dinou/server.js CHANGED
@@ -70,7 +70,7 @@ app.get(/^\/____rsc_payload____\/.*\/?$/, async (req, res) => {
70
70
  }
71
71
  }
72
72
 
73
- const jsx = await getSSGJSXOrJSX(reqPath, { ...req.query });
73
+ const jsx = await getSSGJSXOrJSX(reqPath, { ...req.query }, isDevelopment);
74
74
 
75
75
  const manifest = JSON.parse(
76
76
  readFileSync(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinou",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Minimal React 19 Framework",
5
5
  "main": "index.js",
6
6
  "bin": {
package/webpack.config.js CHANGED
@@ -108,7 +108,7 @@ module.exports = {
108
108
  );
109
109
  const scoped = createScopedName(base, resourcePath);
110
110
 
111
- return `images/${scoped}[ext]`;
111
+ return `/images/${scoped}[ext]`;
112
112
  },
113
113
  publicPath: "",
114
114
  },