Builds errors bugfix
This commit is contained in:
Vendored
+2
@@ -5,6 +5,7 @@ import { rmSync, writeFileSync } from "fs";
|
||||
import bunextInit from "../../functions/bunext-init";
|
||||
import { v4 } from "uuid";
|
||||
import { updatePageLastmodRecord } from "../../utils/page-lastmod-record";
|
||||
import disposeBundlerContexts from "../../functions/bundler/dispose-bundler-contexts";
|
||||
const { HYDRATION_DST_DIR, BUNX_CWD_PAGES_REWRITE_DIR, BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON, BUNX_CWD_MODULE_CACHE_DIR, BUILD_INFO_JSON, } = grabDirNames();
|
||||
export default function () {
|
||||
return new Command("build")
|
||||
@@ -21,6 +22,7 @@ export default function () {
|
||||
catch (error) { }
|
||||
global.BUNEXT_SKIPPED_BROWSER_MODULES = new Set();
|
||||
await bunextInit({ build_only: true });
|
||||
await disposeBundlerContexts({ stop_service: true });
|
||||
// A failed bundle must fail the command: CI and scripts rely on
|
||||
// the exit code instead of grepping logs.
|
||||
if (global.BUNEXT_BUILD_FAILED) {
|
||||
|
||||
+10
-1
@@ -1,6 +1,15 @@
|
||||
type Params = {
|
||||
/**
|
||||
* Also stop esbuild's service process. Only safe when no other esbuild
|
||||
* call can be in flight (e.g. before exiting, or right after the startup
|
||||
* build). The service restarts on the next esbuild call.
|
||||
*/
|
||||
stop_service?: boolean;
|
||||
};
|
||||
/**
|
||||
* Disposes the hydration and SSR esbuild contexts, releasing the incremental
|
||||
* build state esbuild keeps in memory for them. The bundlers re-create the
|
||||
* contexts on their next run.
|
||||
*/
|
||||
export default function disposeBundlerContexts(): Promise<void>;
|
||||
export default function disposeBundlerContexts(params?: Params): Promise<void>;
|
||||
export {};
|
||||
|
||||
+11
-1
@@ -1,9 +1,10 @@
|
||||
import * as esbuild from "esbuild";
|
||||
/**
|
||||
* Disposes the hydration and SSR esbuild contexts, releasing the incremental
|
||||
* build state esbuild keeps in memory for them. The bundlers re-create the
|
||||
* contexts on their next run.
|
||||
*/
|
||||
export default async function disposeBundlerContexts() {
|
||||
export default async function disposeBundlerContexts(params) {
|
||||
try {
|
||||
await global.BUNEXT_BUNDLER_CTX?.dispose();
|
||||
}
|
||||
@@ -14,4 +15,13 @@ export default async function disposeBundlerContexts() {
|
||||
}
|
||||
catch (error) { }
|
||||
global.BUNEXT_SSR_BUNDLER_CTX = undefined;
|
||||
if (params?.stop_service) {
|
||||
// Exiting while the service is still running can leave it orphaned
|
||||
// with an unanswered ping, which crashes it with "all goroutines are
|
||||
// asleep - deadlock!".
|
||||
try {
|
||||
await esbuild.stop();
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -89,7 +89,7 @@ export default async function bunextInit(params) {
|
||||
await allPagesESBuildContextBundler({ start: true });
|
||||
// The server only needs the artifact maps; don't keep
|
||||
// esbuild's build state alive for the rest of the process.
|
||||
await disposeBundlerContexts();
|
||||
await disposeBundlerContexts({ stop_service: true });
|
||||
}
|
||||
cron();
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/bunext",
|
||||
"version": "1.3.2",
|
||||
"version": "1.3.3",
|
||||
"main": "dist/index.js",
|
||||
"module": "index.ts",
|
||||
"dependencies": {
|
||||
|
||||
@@ -6,6 +6,7 @@ import bunextInit from "../../functions/bunext-init";
|
||||
import type { BuildDataType } from "../../types";
|
||||
import { v4 } from "uuid";
|
||||
import { updatePageLastmodRecord } from "../../utils/page-lastmod-record";
|
||||
import disposeBundlerContexts from "../../functions/bundler/dispose-bundler-contexts";
|
||||
|
||||
const {
|
||||
HYDRATION_DST_DIR,
|
||||
@@ -33,6 +34,8 @@ export default function () {
|
||||
|
||||
await bunextInit({ build_only: true });
|
||||
|
||||
await disposeBundlerContexts({ stop_service: true });
|
||||
|
||||
// A failed bundle must fail the command: CI and scripts rely on
|
||||
// the exit code instead of grepping logs.
|
||||
if (global.BUNEXT_BUILD_FAILED) {
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
import * as esbuild from "esbuild";
|
||||
|
||||
type Params = {
|
||||
/**
|
||||
* Also stop esbuild's service process. Only safe when no other esbuild
|
||||
* call can be in flight (e.g. before exiting, or right after the startup
|
||||
* build). The service restarts on the next esbuild call.
|
||||
*/
|
||||
stop_service?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Disposes the hydration and SSR esbuild contexts, releasing the incremental
|
||||
* build state esbuild keeps in memory for them. The bundlers re-create the
|
||||
* contexts on their next run.
|
||||
*/
|
||||
export default async function disposeBundlerContexts() {
|
||||
export default async function disposeBundlerContexts(params?: Params) {
|
||||
try {
|
||||
await global.BUNEXT_BUNDLER_CTX?.dispose();
|
||||
} catch (error) {}
|
||||
@@ -13,4 +24,13 @@ export default async function disposeBundlerContexts() {
|
||||
await global.BUNEXT_SSR_BUNDLER_CTX?.dispose();
|
||||
} catch (error) {}
|
||||
global.BUNEXT_SSR_BUNDLER_CTX = undefined;
|
||||
|
||||
if (params?.stop_service) {
|
||||
// Exiting while the service is still running can leave it orphaned
|
||||
// with an unanswered ping, which crashes it with "all goroutines are
|
||||
// asleep - deadlock!".
|
||||
try {
|
||||
await esbuild.stop();
|
||||
} catch (error) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ export default async function bunextInit(params?: Params) {
|
||||
await allPagesESBuildContextBundler({ start: true });
|
||||
// The server only needs the artifact maps; don't keep
|
||||
// esbuild's build state alive for the rest of the process.
|
||||
await disposeBundlerContexts();
|
||||
await disposeBundlerContexts({ stop_service: true });
|
||||
}
|
||||
|
||||
cron();
|
||||
|
||||
Reference in New Issue
Block a user