Updates
This commit is contained in:
+19
-2
@@ -1,4 +1,4 @@
|
||||
import { watch, existsSync, statSync } from "fs";
|
||||
import { watch, existsSync, statSync, glob } from "fs";
|
||||
import path from "path";
|
||||
import grabDirNames from "../../utils/grab-dir-names";
|
||||
import fullRebuild from "./full-rebuild";
|
||||
@@ -16,6 +16,24 @@ export default async function watcherEsbuildCTX() {
|
||||
try {
|
||||
if (!filename)
|
||||
return;
|
||||
const full_file_path = path.join(ROOT_DIR, filename);
|
||||
if (global.CONFIG.exclude_watch_patterns) {
|
||||
for (let i = 0; i < global.CONFIG.exclude_watch_patterns.length; i++) {
|
||||
const watch_pattern = global.CONFIG.exclude_watch_patterns[i];
|
||||
if (watch_pattern instanceof RegExp) {
|
||||
const is_path_excluded = watch_pattern.test(filename);
|
||||
if (is_path_excluded) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const excluded_path = path.resolve(ROOT_DIR, watch_pattern);
|
||||
if (excluded_path == full_file_path) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (existsSync(BUNX_BUNDLER_ERROR_EXIT_FILE)) {
|
||||
await fullRebuild();
|
||||
return;
|
||||
@@ -35,7 +53,6 @@ export default async function watcherEsbuildCTX() {
|
||||
if (filename.endsWith(AppData["BunextTmpFileExt"])) {
|
||||
return;
|
||||
}
|
||||
const full_file_path = path.join(ROOT_DIR, filename);
|
||||
const does_file_exist = existsSync(full_file_path);
|
||||
const file_stat = does_file_exist
|
||||
? statSync(full_file_path)
|
||||
|
||||
@@ -138,6 +138,7 @@ export default async function grabPageComponent(params) {
|
||||
else {
|
||||
log.error(`Error Grabbing Page Component: ${error.message}`);
|
||||
log.error(`Page: ${passed_file_path || url?.pathname}`);
|
||||
process.exit(1);
|
||||
}
|
||||
return await grabPageErrorComponent({
|
||||
error,
|
||||
|
||||
Vendored
+6
@@ -66,6 +66,12 @@ export type BunextConfig = {
|
||||
* bundler for the browser. Eg. `react/jsx-dev-runtime`
|
||||
*/
|
||||
page_compiler_excludes?: string[];
|
||||
/**
|
||||
* Patterns to exclude from the watcher. Eg. `./src/server.ts`
|
||||
* or `\*.test.ts\`. It should either be a file path (relative or
|
||||
* absolute), or a RegEx pattern.
|
||||
*/
|
||||
exclude_watch_patterns?: (string | RegExp)[];
|
||||
};
|
||||
export type BunextConfigMiddlewareParams = {
|
||||
req: Request;
|
||||
|
||||
Reference in New Issue
Block a user