Skip to content

Commit 14283fb

Browse files
authored
build: use upstream youch back (#3175)
1 parent 7cbf0b2 commit 14283fb

File tree

3 files changed

+20
-42
lines changed

3 files changed

+20
-42
lines changed

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@
170170
"unstorage": "^1.15.0",
171171
"untyped": "^2.0.0",
172172
"unwasm": "^0.3.9",
173-
"youch-redist": "4.1.0-beta.5-1"
173+
"youch": "^4.1.0-beta.6",
174+
"youch-core": "^0.3.1"
174175
},
175176
"devDependencies": {
176177
"@azure/functions": "^3.5.1",
@@ -206,9 +207,7 @@
206207
"unbuild": "^3.5.0",
207208
"undici": "^7.4.0",
208209
"vitest": "^3.0.7",
209-
"xml2js": "^0.6.2",
210-
"youch": "^4.1.0-beta.5",
211-
"youch-core": "^0.3.1"
210+
"xml2js": "^0.6.2"
212211
},
213212
"peerDependencies": {
214213
"xml2js": "^0.6.2"

pnpm-lock.yaml

Lines changed: 14 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/internal/error/dev.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,14 @@ import {
99
setResponseHeaders,
1010
setResponseStatus,
1111
} from "h3";
12-
import nodeCrypto from "node:crypto";
1312
import { readFile } from "node:fs/promises";
1413
import { resolve, dirname } from "node:path";
1514
import consola from "consola";
16-
import type { ErrorParser as ErrorParserT } from "youch-core";
17-
import type { Youch as YouchT } from "youch";
18-
// @ts-ignore
19-
import * as _youch from "youch-redist";
15+
import { ErrorParser } from "youch-core";
16+
import { Youch } from "youch";
2017
import { SourceMapConsumer } from "source-map";
2118
import { defineNitroErrorHandler, type InternalHandlerResponse } from "./utils";
2219

23-
const { Youch, ErrorParser } = _youch as {
24-
Youch: { new (): YouchT };
25-
ErrorParser: { new (): ErrorParserT };
26-
};
27-
2820
export default defineNitroErrorHandler(
2921
async function defaultNitroErrorHandler(error, event) {
3022
const res = await defaultHandler(error, event);
@@ -104,11 +96,6 @@ export async function defaultHandler(
10496
headers["cache-control"] = "no-cache";
10597
}
10698

107-
// Crypto polyfill for Node.18 (used by youch > @poppinss+dumper)
108-
if (!globalThis.crypto && !useJSON) {
109-
globalThis.crypto = nodeCrypto as unknown as Crypto;
110-
}
111-
11299
// Prepare body
113100
const body = useJSON
114101
? {
@@ -158,7 +145,7 @@ export async function loadStackTrace(error: any) {
158145
}
159146
}
160147

161-
type SourceLoader = Parameters<ErrorParserT["defineSourceLoader"]>[0];
148+
type SourceLoader = Parameters<ErrorParser["defineSourceLoader"]>[0];
162149
type StackFrame = Parameters<SourceLoader>[0];
163150
async function sourceLoader(frame: StackFrame) {
164151
if (!frame.fileName || frame.fileType !== "fs" || frame.type === "native") {

0 commit comments

Comments
 (0)