Files
Niklas MischkulnigandGitHub a13487fe77 Turbopack: trace worker_threads worker entry (#85734)
Closes PACK-5688  
Closes https://github.com/vercel/next.js/issues/84766

1. Trace `new require("worker_threads").Worker` calls
2. ignore syntax errors in all traced files

This does lead to a build error currently with cargo run --bin turbopack-nft -- --show-issues --graph bench/app-router-server/node_modules/thread-stream/index.js:

```
error - [analysis] [workspace]/node_modules/.pnpm/[email protected]/node_modules/thread-stream/test/syntax-error.mjs
  [workspace]/node_modules/.pnpm/[email protected]/node_modules/thread-stream/test/syntax-error.mjs:2:6  Parsing ecmascript source code failed
       1 | // this is a syntax error
         +       v
       2 + import
         +       ^
       3 | 
  
  Expected 'from', got '<eof>'
```

Pulled in by this partly dynamic `new Worker()`  call: https://github.com/pinojs/thread-stream/blob/82e011281b8895bf5e8f70008e0242927fcaf0cb/index.js#L53-L55

(Related to https://github.com/vercel/next.js/pull/84408, where this was previously fixed for extensionless files such as `LICENSE`)
2025-11-04 23:42:33 +01:00

19 lines
364 B
JavaScript

// for transport({target: 'pino-pretty'}) to work
require('pino-pretty')
const { pino, transport } = require('pino')
const loggerOptions = {
level: 'info',
timestamp: false,
}
const loggerTransport = transport({
target: 'pino-pretty',
options: {
ignore: 'pid,hostname',
},
})
const logger = pino(loggerOptions, loggerTransport)
logger.info('foo')