dinou 1.4.3 → 1.5.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/README.md +4 -0
- package/dinou/build-static-pages.js +24 -0
- package/dinou/get-jsx.js +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -126,6 +126,8 @@ dinou main features are:
|
|
|
126
126
|
|
|
127
127
|
- If you don't want a `page` to be applied layouts define a `no_layout` file (without extension) in the same folder. A `no_layout` file, if present, also applies to the `not_found` file if present in the same folder. There exists also a `no_layout_not_found` file if you don't want a `not_found` file to be applied layouts but you do in `page` component.
|
|
128
128
|
|
|
129
|
+
- `reset_layout` file (without extension) if present in the same folder as a `layout.tsx` file, will ignore previous layouts in the layout hierarchy.
|
|
130
|
+
|
|
129
131
|
## page_functions.ts (or `.tsx`, `.js`, `.jsx`)
|
|
130
132
|
|
|
131
133
|
`page_functions.ts` is a file for defining four diferent possible functions. These are:
|
|
@@ -841,6 +843,8 @@ The routing system is file-based and supports static routes, dynamic routes, opt
|
|
|
841
843
|
|
|
842
844
|
- If a **`no_layout`** file exists in a directory (**without extension**), the layout hierarchy is skipped, and only the page content is rendered.
|
|
843
845
|
|
|
846
|
+
- If a **`reset_layout`** file (**without extension**) exists in a directory where a `layout.tsx` file is defined, previous layouts in the hierarchy will be ignored.
|
|
847
|
+
|
|
844
848
|
### Not Found Handling
|
|
845
849
|
|
|
846
850
|
- If no `page.tsx` is found for a route, the system looks for a `not_found.tsx` file in the route hierarchy.
|
|
@@ -382,6 +382,18 @@ async function buildStaticPages() {
|
|
|
382
382
|
}
|
|
383
383
|
jsx = React.createElement(Layout, props, jsx);
|
|
384
384
|
jsx = { ...jsx, __modulePath: layoutPath };
|
|
385
|
+
const layoutFolderPath = path.dirname(layoutPath);
|
|
386
|
+
if (
|
|
387
|
+
getFilePathAndDynamicParams(
|
|
388
|
+
[],
|
|
389
|
+
{},
|
|
390
|
+
layoutFolderPath,
|
|
391
|
+
"reset_layout",
|
|
392
|
+
false
|
|
393
|
+
)[0]
|
|
394
|
+
) {
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
385
397
|
index++;
|
|
386
398
|
}
|
|
387
399
|
}
|
|
@@ -548,6 +560,18 @@ async function buildStaticPage(reqPath) {
|
|
|
548
560
|
}
|
|
549
561
|
jsx = React.createElement(Layout, layoutProps, jsx);
|
|
550
562
|
jsx = { ...jsx, __modulePath: layoutPath };
|
|
563
|
+
const layoutFolderPath = path.dirname(layoutPath);
|
|
564
|
+
if (
|
|
565
|
+
getFilePathAndDynamicParams(
|
|
566
|
+
[],
|
|
567
|
+
{},
|
|
568
|
+
layoutFolderPath,
|
|
569
|
+
"reset_layout",
|
|
570
|
+
false
|
|
571
|
+
)[0]
|
|
572
|
+
) {
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
551
575
|
index++;
|
|
552
576
|
}
|
|
553
577
|
}
|
package/dinou/get-jsx.js
CHANGED
|
@@ -129,6 +129,18 @@ async function getJSX(reqPath, query) {
|
|
|
129
129
|
props = { ...props, ...(pageFunctionsProps?.layout ?? {}) };
|
|
130
130
|
}
|
|
131
131
|
jsx = React.createElement(Layout, props, jsx);
|
|
132
|
+
const layoutFolderPath = path.dirname(layoutPath);
|
|
133
|
+
if (
|
|
134
|
+
getFilePathAndDynamicParams(
|
|
135
|
+
[],
|
|
136
|
+
{},
|
|
137
|
+
layoutFolderPath,
|
|
138
|
+
"reset_layout",
|
|
139
|
+
false
|
|
140
|
+
)[0]
|
|
141
|
+
) {
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
132
144
|
index++;
|
|
133
145
|
}
|
|
134
146
|
}
|