Skip to content

Commit

Permalink
app depth isn't calculated correctly with only non-JS routes #160
Browse files Browse the repository at this point in the history
  • Loading branch information
terrablue committed Aug 23, 2024
1 parent 4ad7cd8 commit 1434e51
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/build/hook/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ const pre = async (app, mode, target) => {
await Promise.all(["server", "client", "components"]
.map(directory => app.runpath(directory).create()));

const router = await $router(app.path.routes);
const router = await $router(app.path.routes,
[".js"].concat(Object.keys(app.bindings)));
const layout = { depth: router.depth("layout") };
app.set("layout", layout);

Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/build/hook/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ const error_entries = Object.entries({
RestRoute: rest_route,
});

export default async directory => {

export default async (directory, extensions) => {
try {
return await Router.load({
import: false,
extensions,
directory,
specials: {
guard: { recursive: true },
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/serve/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ export default async (rootfile, build) => {
this.handlers[extension] = handle;
},
hash,
// noop
// noops
target(name, handler) {},
bind(extension, handler) {},
build_target: target,
loader,
stop() {
Expand Down
4 changes: 4 additions & 0 deletions packages/go/src/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ import pkgname from "#pkgname";
export default ({ extension = default_extension } = {}) => ({
name: pkgname,
build: build({ extension }),
init(app, next) {
app.bind(extension, () => null);
next(app);
},
});
4 changes: 4 additions & 0 deletions packages/python/src/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ import pkgname from "#pkgname";
export default ({ extension = default_extension, packages = [] } = {}) => ({
name: pkgname,
build: build({ extension, packages }),
init(app, next) {
app.bind(extension, () => null);
next(app);
},
});
4 changes: 4 additions & 0 deletions packages/ruby/src/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ import pkgname from "#pkgname";
export default ({ extension = default_extension } = {}) => ({
name: pkgname,
build: build({ extension }),
init(app, next) {
app.bind(extension, () => null);
next(app);
},
});
4 changes: 4 additions & 0 deletions packages/typescript/src/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ import pkgname from "#pkgname";
export default ({ extension = default_extension } = {}) => ({
name: pkgname,
build: build({ extension }),
init(app, next) {
app.bind(extension, () => null);
next(app);
},
});

0 comments on commit 1434e51

Please sign in to comment.