Update excluded pages paths logic. Add HMR retries on errors.
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
type Params = {
|
||||
path: string;
|
||||
};
|
||||
export default function ({ path }: Params): boolean;
|
||||
export {};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
export default function ({ path }) {
|
||||
for (let i = 0; i < global.CONSTANTS.RouteIgnorePatterns.length; i++) {
|
||||
const regex = global.CONSTANTS.RouteIgnorePatterns[i];
|
||||
if (path.match(regex))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Vendored
+6
-2
@@ -3,6 +3,7 @@ import grabDirNames from "./grab-dir-names";
|
||||
import path from "path";
|
||||
import AppNames from "./grab-app-names";
|
||||
import pagePathTransform from "./page-path-transform";
|
||||
import checkExcludedPatterns from "./check-excluded-patterns";
|
||||
export default function grabAllPages(params) {
|
||||
const { PAGES_DIR } = grabDirNames();
|
||||
const pages = grabPageDirRecursively({ page_dir: PAGES_DIR });
|
||||
@@ -31,7 +32,10 @@ function grabPageDirRecursively({ page_dir }) {
|
||||
if (page.match(new RegExp(`${AppNames["RootPagesComponentName"]}`))) {
|
||||
continue;
|
||||
}
|
||||
if (page.match(/\(|\)|--|\/api\//)) {
|
||||
if (checkExcludedPatterns({ path: page })) {
|
||||
continue;
|
||||
}
|
||||
if (page.match(/\/api\//)) {
|
||||
continue;
|
||||
}
|
||||
if (page_name.split(".").length > 2) {
|
||||
@@ -39,7 +43,7 @@ function grabPageDirRecursively({ page_dir }) {
|
||||
}
|
||||
const page_stat = statSync(full_page_path);
|
||||
if (page_stat.isDirectory()) {
|
||||
if (page.match(/\(|\)/))
|
||||
if (checkExcludedPatterns({ path: page }))
|
||||
continue;
|
||||
const new_page_files = grabPageDirRecursively({
|
||||
page_dir: full_page_path,
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
import AppNames from "./grab-app-names";
|
||||
export default function grabAssetsPrefix() {
|
||||
if (global.CONFIG.assetsPrefix) {
|
||||
return global.CONFIG.assetsPrefix;
|
||||
if (global.CONFIG.assets_prefix) {
|
||||
return global.CONFIG.assets_prefix;
|
||||
}
|
||||
const { defaultAssetPrefix } = AppNames;
|
||||
return defaultAssetPrefix;
|
||||
|
||||
Vendored
+1
@@ -6,4 +6,5 @@ export default function grabConstants(): {
|
||||
readonly ClientRootComponentWindowName: "BUNEXT_ROOT";
|
||||
readonly MaxBundlerRebuilds: 5;
|
||||
readonly config: import("../types").BunextConfig;
|
||||
readonly RouteIgnorePatterns: RegExp[];
|
||||
};
|
||||
|
||||
Vendored
+5
@@ -6,6 +6,10 @@ export default function grabConstants() {
|
||||
const ClientRootComponentWindowName = "BUNEXT_ROOT";
|
||||
const ServerDefaultRequestBodyLimitBytes = MB_IN_BYTES * 10;
|
||||
const MaxBundlerRebuilds = 5;
|
||||
const RouteIgnorePatterns = [/\/\(/];
|
||||
if (config.pages_exclude_patterns) {
|
||||
RouteIgnorePatterns.push(...config.pages_exclude_patterns);
|
||||
}
|
||||
return {
|
||||
ClientRootElementIDName,
|
||||
ClientWindowPagePropsName,
|
||||
@@ -14,5 +18,6 @@ export default function grabConstants() {
|
||||
ClientRootComponentWindowName,
|
||||
MaxBundlerRebuilds,
|
||||
config,
|
||||
RouteIgnorePatterns,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user