fix: remove another bare type import (#1872)
This commit is contained in:
@@ -26,7 +26,7 @@ export async function dev(
|
|||||||
} else {
|
} else {
|
||||||
currentManifest = { islands: [], routes: [] };
|
currentManifest = { islands: [], routes: [] };
|
||||||
}
|
}
|
||||||
const newManifest = await collect(dir, options);
|
const newManifest = await collect(dir, options?.router?.ignoreFilePattern);
|
||||||
Deno.env.set("FRSH_DEV_PREVIOUS_MANIFEST", JSON.stringify(newManifest));
|
Deno.env.set("FRSH_DEV_PREVIOUS_MANIFEST", JSON.stringify(newManifest));
|
||||||
|
|
||||||
const manifestChanged =
|
const manifestChanged =
|
||||||
|
|||||||
+5
-6
@@ -1,6 +1,5 @@
|
|||||||
import { gte, join, posix, relative, walk, WalkEntry } from "./deps.ts";
|
import { gte, join, posix, relative, walk, WalkEntry } from "./deps.ts";
|
||||||
import { error } from "./error.ts";
|
import { error } from "./error.ts";
|
||||||
import { FreshOptions } from "../server/mod.ts";
|
|
||||||
const MIN_DENO_VERSION = "1.31.0";
|
const MIN_DENO_VERSION = "1.31.0";
|
||||||
const TEST_FILE_PATTERN = /[._]test\.(?:[tj]sx?|[mc][tj]s)$/;
|
const TEST_FILE_PATTERN = /[._]test\.(?:[tj]sx?|[mc][tj]s)$/;
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ export function ensureMinDenoVersion() {
|
|||||||
async function collectDir(
|
async function collectDir(
|
||||||
dir: string,
|
dir: string,
|
||||||
callback: (entry: WalkEntry, dir: string) => void,
|
callback: (entry: WalkEntry, dir: string) => void,
|
||||||
options: FreshOptions,
|
ignoreFilePattern = TEST_FILE_PATTERN,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Check if provided path is a directory
|
// Check if provided path is a directory
|
||||||
try {
|
try {
|
||||||
@@ -39,7 +38,7 @@ async function collectDir(
|
|||||||
includeDirs: false,
|
includeDirs: false,
|
||||||
includeFiles: true,
|
includeFiles: true,
|
||||||
exts: ["tsx", "jsx", "ts", "js"],
|
exts: ["tsx", "jsx", "ts", "js"],
|
||||||
skip: [options?.router?.ignoreFilePattern || TEST_FILE_PATTERN],
|
skip: [ignoreFilePattern],
|
||||||
});
|
});
|
||||||
|
|
||||||
for await (const entry of routesFolder) {
|
for await (const entry of routesFolder) {
|
||||||
@@ -55,7 +54,7 @@ export interface Manifest {
|
|||||||
const GROUP_REG = /[/\\\\]\((_[^/\\\\]+)\)[/\\\\]/;
|
const GROUP_REG = /[/\\\\]\((_[^/\\\\]+)\)[/\\\\]/;
|
||||||
export async function collect(
|
export async function collect(
|
||||||
directory: string,
|
directory: string,
|
||||||
options: FreshOptions = {},
|
ignoreFilePattern?: RegExp,
|
||||||
): Promise<Manifest> {
|
): Promise<Manifest> {
|
||||||
const filePaths = new Set<string>();
|
const filePaths = new Set<string>();
|
||||||
|
|
||||||
@@ -84,11 +83,11 @@ export async function collect(
|
|||||||
}
|
}
|
||||||
filePaths.add(normalized);
|
filePaths.add(normalized);
|
||||||
routes.push(rel);
|
routes.push(rel);
|
||||||
}, options),
|
}, ignoreFilePattern),
|
||||||
collectDir(join(directory, "./islands"), (entry, dir) => {
|
collectDir(join(directory, "./islands"), (entry, dir) => {
|
||||||
const rel = join("islands", relative(dir, entry.path));
|
const rel = join("islands", relative(dir, entry.path));
|
||||||
islands.push(rel);
|
islands.push(rel);
|
||||||
}, options),
|
}, ignoreFilePattern),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
routes.sort();
|
routes.sort();
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,3 @@
|
|||||||
import { LayoutConfig } from "$fresh/server.ts";
|
|
||||||
import { ServerContext } from "./context.ts";
|
import { ServerContext } from "./context.ts";
|
||||||
export type { FromManifestOptions } from "./context.ts";
|
export type { FromManifestOptions } from "./context.ts";
|
||||||
export { Status } from "./deps.ts";
|
export { Status } from "./deps.ts";
|
||||||
@@ -7,6 +6,7 @@ import {
|
|||||||
Handler,
|
Handler,
|
||||||
Handlers,
|
Handlers,
|
||||||
IslandModule,
|
IslandModule,
|
||||||
|
LayoutConfig,
|
||||||
MiddlewareModule,
|
MiddlewareModule,
|
||||||
RouteConfig,
|
RouteConfig,
|
||||||
ServeHandlerInfo,
|
ServeHandlerInfo,
|
||||||
|
|||||||
+1
-6
@@ -6,7 +6,6 @@ Deno.test({
|
|||||||
fn: async () => {
|
fn: async () => {
|
||||||
const { routes } = await collect(
|
const { routes } = await collect(
|
||||||
join(dirname(fromFileUrl(import.meta.url)), "fixture"),
|
join(dirname(fromFileUrl(import.meta.url)), "fixture"),
|
||||||
{},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
@@ -32,11 +31,7 @@ Deno.test({
|
|||||||
dirname(fromFileUrl(import.meta.url)),
|
dirname(fromFileUrl(import.meta.url)),
|
||||||
"fixture_router_ignore_files",
|
"fixture_router_ignore_files",
|
||||||
),
|
),
|
||||||
{
|
/[\.|_]cy\.[t|j]s(x)?$/,
|
||||||
router: {
|
|
||||||
ignoreFilePattern: /[\.|_]cy\.[t|j]s(x)?$/,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
|
|||||||
Reference in New Issue
Block a user