Skip to content

Commit

Permalink
fix: the node10-compatibility-plugin needs to call the write json as …
Browse files Browse the repository at this point in the history
…sync, otherwise it can throw a error that the .tmp file does not exits
  • Loading branch information
prisis committed Jan 22, 2025
1 parent 78e55af commit 51bdebc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readJson, writeJson } from "@visulima/fs";
import { readJson, writeJsonSync } from "@visulima/fs";
import type { PackageJson } from "@visulima/package";
import { dirname, join } from "@visulima/path";
import type { Plugin } from "rollup";
Expand Down Expand Up @@ -81,10 +81,11 @@ export const node10CompatibilityPlugin = (
}

const rootPackageJsonPath = join(rootDirectory, "package.json");
const packageJson = (await readJson(rootPackageJsonPath)) as PackageJson;
const packageJson = await readJson<PackageJson>(rootPackageJsonPath);

if (mode === "file" && Object.keys(typesVersions).length > 0) {
await writeJson(
// This needs to be done in a synchronous manner
writeJsonSync(
rootPackageJsonPath,
{
...packageJson,
Expand Down
3 changes: 2 additions & 1 deletion packages/packem/src/utils/enhance-rollup-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ const extractStack = (error: RollupError): string | undefined => {

// If we don't have a stack, not much we can do.
if (!stack) {
return stack;
return undefined;
}

const expectedPrefix = `${name}: ${message}\n`;

if (stack.startsWith(expectedPrefix)) {
return stack.slice(expectedPrefix.length);
}
Expand Down

0 comments on commit 51bdebc

Please sign in to comment.