filesystem-routing 0.1.0 → 0.1.1
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/dist/router.d.ts +4 -1
- package/dist/router.js +5 -2
- package/package.json +1 -1
package/dist/router.d.ts
CHANGED
|
@@ -3,7 +3,10 @@ export declare const glob: (path: string) => string[];
|
|
|
3
3
|
/** Normalize a file path to posix separators (bundler-agnostic). */
|
|
4
4
|
export declare function normalizePath(path: string): string;
|
|
5
5
|
export interface FileSystemRouterConfig {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Route directory to scan. Relative paths are resolved against the
|
|
8
|
+
* current working directory.
|
|
9
|
+
*/
|
|
7
10
|
dir: string;
|
|
8
11
|
/** File extensions (without the dot) that participate in routing. */
|
|
9
12
|
extensions: string[];
|
package/dist/router.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fg from "fast-glob";
|
|
2
2
|
import micromatch from "micromatch";
|
|
3
|
-
import { posix, sep } from "node:path";
|
|
3
|
+
import { posix, resolve, sep } from "node:path";
|
|
4
4
|
export const glob = (path) => fg.sync(path, { absolute: true });
|
|
5
5
|
/** Normalize a file path to posix separators (bundler-agnostic). */
|
|
6
6
|
export function normalizePath(path) {
|
|
@@ -24,7 +24,10 @@ export class BaseFileSystemRouter extends EventTarget {
|
|
|
24
24
|
constructor(config) {
|
|
25
25
|
super();
|
|
26
26
|
this.routes = [];
|
|
27
|
-
|
|
27
|
+
// A relative dir would glob fine, but the matched files come back
|
|
28
|
+
// absolute and would then fail `isRoute`'s micromatch against the
|
|
29
|
+
// relative pattern, silently yielding zero routes.
|
|
30
|
+
this.config = { ...config, dir: normalizePath(resolve(config.dir)) };
|
|
28
31
|
}
|
|
29
32
|
glob() {
|
|
30
33
|
const extensions = this.config.extensions;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "filesystem-routing",
|
|
3
3
|
"description": "Router-neutral file-system routing: scans a route directory into a neutral route manifest with pluggable conventions and delivery adapters",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.1",
|
|
6
6
|
"author": "Ryan Carniato",
|
|
7
7
|
"homepage": "https://github.com/solidjs/filesystem-routing#readme",
|
|
8
8
|
"repository": {
|