dinou 2.3.1 → 2.3.3

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 CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
+ ## [2.3.3]
9
+
10
+ ### Fixed
11
+
12
+ - babel-esm-loader: check filePath is a file when resolving. This avoids crash when you have a file named equal than a folder in the same directory.
13
+
14
+ ## [2.3.2]
15
+
16
+ ### Fixed
17
+
18
+ - Do not use `for await` when it is not necessary in buildStaticPages.
19
+
8
20
  ## [2.3.1]
9
21
 
10
22
  ### Fixed
@@ -68,17 +68,18 @@ const aliasMap = loadTsconfigAliases();
68
68
 
69
69
  // Añadir extensiones si no existen
70
70
  function tryExtensions(filePath) {
71
- if (fs.existsSync(filePath)) return filePath;
71
+ if (fs.existsSync(filePath) && fs.statSync(filePath).isFile())
72
+ return filePath;
72
73
  const exts = [".js", ".ts", ".jsx", ".tsx"];
73
74
  for (const ext of exts) {
74
75
  const f = filePath + ext;
75
- if (fs.existsSync(f)) return f;
76
+ if (fs.existsSync(f) && fs.statSync(f).isFile()) return f;
76
77
  }
77
78
  // Si es carpeta, probar index.*
78
79
  if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) {
79
80
  for (const ext of exts) {
80
81
  const f = path.join(filePath, "index" + ext);
81
- if (fs.existsSync(f)) return f;
82
+ if (fs.existsSync(f) && fs.statSync(f).isFile()) return f;
82
83
  }
83
84
  }
84
85
  return null;
@@ -142,6 +143,7 @@ exports.load = async function load(url, context, defaultLoad) {
142
143
  const source = `export default ${JSON.stringify(mod)};`;
143
144
  return { format: "module", source, shortCircuit: true, url };
144
145
  }
146
+
145
147
  if (/\.(jsx|tsx|ts|js)$/.test(url)) {
146
148
  let filename;
147
149
  try {
@@ -31,7 +31,7 @@ async function buildStaticPages() {
31
31
  const entries = readdirSync(currentPath, { withFileTypes: true });
32
32
  const pages = [];
33
33
 
34
- for await (const entry of entries) {
34
+ for (const entry of entries) {
35
35
  if (entry.isDirectory()) {
36
36
  if (entry.name.startsWith("(") && entry.name.endsWith(")")) {
37
37
  pages.push(
@@ -307,7 +307,7 @@ async function buildStaticPages() {
307
307
 
308
308
  const pages = await collectPages(srcFolder);
309
309
 
310
- for await (const { path: folderPath, segments, params } of pages) {
310
+ for (const { path: folderPath, segments, params } of pages) {
311
311
  try {
312
312
  const [pagePath] = getFilePathAndDynamicParams(
313
313
  segments,
@@ -545,7 +545,7 @@ async function buildStaticPage(reqPath) {
545
545
  );
546
546
  if (layouts && Array.isArray(layouts)) {
547
547
  let index = 0;
548
- for await (const [layoutPath, dParams, slots] of layouts.reverse()) {
548
+ for (const [layoutPath, dParams, slots] of layouts.reverse()) {
549
549
  const layoutModule = await importModule(layoutPath);
550
550
  const Layout = layoutModule.default ?? layoutModule;
551
551
  const updatedSlots = {};
package/dinou/server.js CHANGED
@@ -296,7 +296,7 @@ app.post("/____server_function____", async (req, res) => {
296
296
  res.json(result);
297
297
  }
298
298
  } catch (err) {
299
- console.error("Server function error:", err);
299
+ console.error(`Server function error [${req.body.id}]:`, err);
300
300
  res.status(500).json({ error: err.message });
301
301
  }
302
302
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinou",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "Minimal React 19 Framework",
5
5
  "main": "index.js",
6
6
  "bin": {