dinou 8.0.2 → 8.0.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,12 @@ 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
+ ## [8.0.3] - 2026-10-22
9
+
10
+ ### Fixed
11
+ - **Type-Safe Route Pattern Autocompletion in Segment Configs**: Added generic constraints (`TRouteOrParams extends DinouRoutePattern | object = any`) to `PageFunctions` and `LayoutFunctions`, as well as `RouteParams<T extends DinouRoutePattern = DinouRoutePattern>`. This enables immediate IDE / TypeScript autocompletion for known project routes when typing string literals (`PageFunctions<"..."`) and strict compile-time validation against typos in route strings, while preserving full backward compatibility for parameter dictionaries and custom interfaces (`PageFunctions<CustomParams>`).
12
+ - **Direct `defineConfig` Import from `"dinou"`**: Added an esbuild resolution plugin (`dinou-config-alias`) in `load-dinou-config.js` to alias exact `"dinou"` specifier imports to `"dinou/config"` when bundling configuration files (`dinou.config.ts`, `dinou.config.mjs`, etc.). This allows importing `defineConfig` directly from `"dinou"` (`import { defineConfig } from "dinou"`) without triggering Node.js native ESM `ERR_UNKNOWN_FILE_EXTENSION` errors from unbundled React JSX components (`redirect.jsx`, `link.jsx`) in `dinou/index.js`, while keeping all other subpath imports (`dinou/adapters/*`, `dinou/config`) intact.
13
+
8
14
  ## [8.0.2] - 2026-10-22
9
15
 
10
16
  ### Fixed
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # **Dinou**
2
2
 
3
- [![Documentation](https://img.shields.io/badge/docs-dinou.dev-blue?style=flat-square)](https://dinou.dev) [![Version](https://img.shields.io/badge/version-8.0.2-orange?style=flat-square)](https://www.npmjs.com/package/dinou)
3
+ [![Documentation](https://img.shields.io/badge/docs-dinou.dev-blue?style=flat-square)](https://dinou.dev) [![Version](https://img.shields.io/badge/version-8.0.3-orange?style=flat-square)](https://www.npmjs.com/package/dinou)
4
4
 
5
5
  ### **Full-Stack React 19 Framework**
6
6
 
@@ -2222,12 +2222,24 @@ export interface RouteSegmentConfig<TParams = any, TProps = any> {
2222
2222
  /**
2223
2223
  * Concrete semantic alias to import and use in 'page_functions.ts'
2224
2224
  */
2225
- export type PageFunctions<TParams = any, TProps = any> = RouteSegmentConfig<TParams, TProps>;
2225
+ export type PageFunctions<
2226
+ TRouteOrParams extends DinouRoutePattern | object = any,
2227
+ TProps = any
2228
+ > = RouteSegmentConfig<
2229
+ [TRouteOrParams] extends [string] ? RouteParams<TRouteOrParams> : TRouteOrParams,
2230
+ TProps
2231
+ >;
2226
2232
 
2227
2233
  /**
2228
2234
  * Concrete semantic alias to import and use in 'layout_functions.ts'
2229
2235
  */
2230
- export type LayoutFunctions<TParams = any, TProps = any> = RouteSegmentConfig<TParams, TProps>;
2236
+ export type LayoutFunctions<
2237
+ TRouteOrParams extends DinouRoutePattern | object = any,
2238
+ TProps = any
2239
+ > = RouteSegmentConfig<
2240
+ [TRouteOrParams] extends [string] ? RouteParams<TRouteOrParams> : TRouteOrParams,
2241
+ TProps
2242
+ >;
2231
2243
  ```
2232
2244
 
2233
2245
  | Where to use | Type to import | Purpose |
@@ -51,6 +51,16 @@ async function getDinouConfig() {
51
51
  platform: "node",
52
52
  packages: "external",
53
53
  sourcemap: "inline",
54
+ plugins: [
55
+ {
56
+ name: "dinou-config-alias",
57
+ setup(build) {
58
+ build.onResolve({ filter: /^dinou$/ }, () => {
59
+ return { path: "dinou/config", external: true };
60
+ });
61
+ },
62
+ },
63
+ ],
54
64
  });
55
65
  loaded = await import(pathToFileURL(bundledPath).href + (isDev ? `?t=${Date.now()}` : ""));
56
66
  } else if (p.endsWith(".mjs")) {
package/dinou/index.d.ts CHANGED
@@ -288,7 +288,10 @@ export interface RouteSegmentConfig<TParams = any, TProps = any> {
288
288
  * Type-safe interface representing the available exports in `page_functions.ts`.
289
289
  * Accepts either a route pattern string (e.g. `"/products/[id]"`) or a direct parameters dictionary.
290
290
  */
291
- export type PageFunctions<TRouteOrParams = any, TProps = any> = RouteSegmentConfig<
291
+ export type PageFunctions<
292
+ TRouteOrParams extends DinouRoutePattern | object = any,
293
+ TProps = any
294
+ > = RouteSegmentConfig<
292
295
  [TRouteOrParams] extends [string] ? RouteParams<TRouteOrParams> : TRouteOrParams,
293
296
  TProps
294
297
  >;
@@ -297,7 +300,10 @@ export type PageFunctions<TRouteOrParams = any, TProps = any> = RouteSegmentConf
297
300
  * Type-safe interface representing the available exports in `layout_functions.ts`.
298
301
  * Accepts either a route pattern string (e.g. `"/[organization]"`) or a direct parameters dictionary.
299
302
  */
300
- export type LayoutFunctions<TRouteOrParams = any, TProps = any> = RouteSegmentConfig<
303
+ export type LayoutFunctions<
304
+ TRouteOrParams extends DinouRoutePattern | object = any,
305
+ TProps = any
306
+ > = RouteSegmentConfig<
301
307
  [TRouteOrParams] extends [string] ? RouteParams<TRouteOrParams> : TRouteOrParams,
302
308
  TProps
303
309
  >;
@@ -479,7 +485,7 @@ export type CleanRoutePath<T extends string> = T extends `/${string}` ? T : `/${
479
485
  * Prioritizes the generated route parameters map from .dinou/types/routes.d.ts,
480
486
  * and falls back to template literal extraction.
481
487
  */
482
- export type RouteParams<T extends string = string> =
488
+ export type RouteParams<T extends DinouRoutePattern = DinouRoutePattern> =
483
489
  DinouRouter.Register extends { params: infer P }
484
490
  ? (CleanRoutePath<T> extends keyof P
485
491
  ? P[CleanRoutePath<T>]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinou-ejected",
3
- "version": "8.0.2",
3
+ "version": "8.0.3",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "private": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinou",
3
- "version": "8.0.2",
3
+ "version": "8.0.3",
4
4
  "description": "Full-stack React 19 framework with native RSC, Server Functions, progressive streaming, and zero vendor lock-in.",
5
5
  "type": "module",
6
6
  "main": "./dinou/index.js",