Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions demo/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const tableRoute = rootRoute.createChildRoute("table", {
async function Content(url: string) {
return rootRoute.map(url, async ({ hasChildRouteActive }) =>
hasChildRouteActive
? tableRoute.map(url, async ({ hasChildRouteActive, parameter }) => {
const { items, totalCount } = await getItems({
? tableRoute.map(url, async ({ parameter }) => {
const { items } = await getItems({
page: parameter.table.page,
size: parameter.table.size,
sortField: parameter.table.sort.field,
Expand Down
19 changes: 1 addition & 18 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 8 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
npmlock2nixSrc = {
url = "github:nix-community/npmlock2nix";
flake = false;
};
};

outputs = { self, nixpkgs, flake-utils, npmlock2nixSrc }:
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let pkgs = nixpkgs.legacyPackages.${system};
npmlock2nix = import npmlock2nixSrc { inherit pkgs; };

in {
devShells.default = pkgs.mkShell (with pkgs; {
Expand All @@ -27,19 +22,14 @@
};
});

checks.default = pkgs.importNpmLock.buildNodeModules (with pkgs; {
npmRoot = ./.;
inherit nodejs;
derivationArgs = {
buildCommands = [
"npm exec tsc -- --noEmit"
"CHROME_PATH=${pkgs.chromium}/bin/chromium XDG_CONFIG_HOME=$TMPDIR/chromium-config XDG_CACHE_HOME=$TMPDIR=/chromium-cache npm run test"
];
installPhase = ''
touch $out
'';
checks.default = with pkgs; buildNpmPackage {
name = "plusnew-router";
src = ./.;
npmDeps = importNpmLock.buildNodeModules {
npmRoot = ./.;
inherit nodejs;
};
});
};
}
);
}
Expand Down
53 changes: 38 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "@plusnew/router",
"version": "4.0.1",
"version": "5.0.0",
"description": "typesafe router",
"main": "src/index.ts",
"module": "src/index.ts",
"scripts": {
"check": "tsc --noEmit",
"start": "web-dev-server",
"test": "web-test-runner --coverage",
"test:watch": "web-test-runner --watch --coverage"
Expand All @@ -18,12 +19,13 @@
},
"author": "Carlo Jeske",
"devDependencies": {
"@esm-bundle/chai": "^4.3.4-fix.0",
"@types/chai": "^5.2.3",
"@types/mocha": "^10.0.6",
"@typescript-eslint/eslint-plugin": "^8.58.0",
"@typescript-eslint/parser": "^8.58.0",
"@web/dev-server-esbuild": "^1.0.2",
"@web/test-runner": "^0.20.2",
"chai": "^6.2.2",
"eslint": "^10.2.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.1.3",
Expand Down
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
export { createRootRoute } from "./routeHandler";
export type { RouteToParameter } from "./types";
export { mapPath, createPath } from "./routeHandler";

export * as schema from "./schema";

import type { InferschemaFromUrl } from "./types";
import { object } from "./schema";

export type RouteToParameter<T extends { [1]: any }> = InferschemaFromUrl<
ReturnType<typeof object<T[1]>>
>;
Loading
Loading