Skip to content

Commit

Permalink
fix router bug, rmv types
Browse files Browse the repository at this point in the history
  • Loading branch information
sjc5 committed Oct 24, 2023
1 parent c230da3 commit 8921292
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 361 deletions.
8 changes: 0 additions & 8 deletions .changeset/early-readers-rule.md

This file was deleted.

12 changes: 0 additions & 12 deletions .changeset/famous-adults-push.md

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/large-worms-sparkle.md

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/light-carpets-cough.md

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/neat-moles-brush.md

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/poor-phones-lie.md

This file was deleted.

21 changes: 0 additions & 21 deletions .changeset/pre.json

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/rude-kiwis-approve.md

This file was deleted.

3 changes: 1 addition & 2 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"skipLibCheck": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx",
"types": ["@hwy-js/dev"]
"jsxImportSource": "hono/jsx"
},
"exclude": ["node_modules", "dist"]
}
23 changes: 22 additions & 1 deletion packages/core/src/router/get-matching-path-data-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,28 @@ function get_matching_paths_internal(__paths: Array<SemiDecoratedPath>) {
: x.realSegmentsLength;

// make sure any remaining matches are not longer than the path itself
return x.segments.length <= index_adjusted_real_segments_length;
const should_move_on =
x.segments.length <= index_adjusted_real_segments_length;

if (!should_move_on) {
return false;
}

// now we need to remove ineligible indices
if (!x.isIndex) {
// if not an index, then you're already confirmed good
return true;
}

const truthy_segments_length = x.segments.filter((x) => x.segment).length;

const path_segments_length = x.path.split("/").filter(Boolean).length;

if (truthy_segments_length === path_segments_length) {
return true;
}

return false;
});

// if there are multiple matches, filter out the ultimate catch-all
Expand Down
13 changes: 3 additions & 10 deletions packages/create-hwy/src/get-tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const ts_config = {
esModuleInterop: true,
jsx: "react-jsx",
jsxImportSource: "hono/jsx",
types: ["@hwy-js/dev"],
},
exclude: ["node_modules", "dist"],
};
Expand All @@ -22,15 +21,13 @@ const js_config = {
compilerOptions: {
jsx: "react-jsx",
jsxImportSource: "hono/jsx",
types: ["@hwy-js/dev"],
},
};

const deno_config = {
compilerOptions: {
jsx: "react-jsx",
jsxImportSource: "npm:hono/jsx",
types: ["@hwy-js/dev"],
},
};

Expand All @@ -48,21 +45,17 @@ function get_ts_config(options: Options) {
options.deployment_target === "vercel-lambda"
) {
// @ts-ignore
ts_config.compilerOptions.types = ["@hwy-js/dev", "node"];
ts_config.compilerOptions.types = ["node"];
}

if (options.deployment_target === "bun") {
// @ts-ignore
ts_config.compilerOptions.types = ["@hwy-js/dev", "bun-types"];
ts_config.compilerOptions.types = ["bun-types"];
}

if (options.deployment_target === "cloudflare-pages") {
// @ts-ignore
ts_config.compilerOptions.types = [
"@hwy-js/dev",
"@cloudflare/workers-types",
"node",
];
ts_config.compilerOptions.types = ["@cloudflare/workers-types", "node"];
}

return JSON.stringify(ts_config).trim() + "\n";
Expand Down
Loading

0 comments on commit 8921292

Please sign in to comment.