Unverified Commit 3567c153 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Turbopack: improve module evaluation name (#84633)

### What?

We can use the demangled name directly, which is much easier and applies to more cases.
parent 58989c76
...@@ -95,12 +95,12 @@ describe('ReactRefreshLogBox app', () => { ...@@ -95,12 +95,12 @@ describe('ReactRefreshLogBox app', () => {
"description": "no", "description": "no",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime Error", "label": "Runtime Error",
"source": "index.js (3:7) @ {module evaluation} "source": "index.js (3:7) @ module evaluation
> 3 | throw new Error('no') > 3 | throw new Error('no')
| ^", | ^",
"stack": [ "stack": [
"{module evaluation} index.js (3:7)", "module evaluation index.js (3:7)",
"{module evaluation} app/page.js (2:1)", "module evaluation app/page.js (2:1)",
], ],
} }
`) `)
...@@ -1722,12 +1722,12 @@ export default function Home() { ...@@ -1722,12 +1722,12 @@ export default function Home() {
"description": "utils error", "description": "utils error",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime Error", "label": "Runtime Error",
"source": "app/utils.ts (1:7) @ {module evaluation} "source": "app/utils.ts (1:7) @ module evaluation
> 1 | throw new Error('utils error') > 1 | throw new Error('utils error')
| ^", | ^",
"stack": [ "stack": [
"{module evaluation} app/utils.ts (1:7)", "module evaluation app/utils.ts (1:7)",
"{module evaluation} app/page.js (2:1)", "module evaluation app/page.js (2:1)",
], ],
} }
`) `)
......
...@@ -122,13 +122,13 @@ describe('ReactRefreshLogBox', () => { ...@@ -122,13 +122,13 @@ describe('ReactRefreshLogBox', () => {
"description": "no", "description": "no",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime Error", "label": "Runtime Error",
"source": "index.js (3:7) @ {module evaluation} "source": "index.js (3:7) @ module evaluation
> 3 | throw new Error('no') > 3 | throw new Error('no')
| ^", | ^",
"stack": [ "stack": [
"{module evaluation} index.js (3:7)", "module evaluation index.js (3:7)",
"{module evaluation} pages/index.js (1:1)", "module evaluation pages/index.js (1:1)",
"{module evaluation} pages/index.js (1:1)", "module evaluation pages/index.js (1:1)",
"<FIXME-next-dist-dir>", "<FIXME-next-dist-dir>",
], ],
} }
...@@ -163,13 +163,13 @@ describe('ReactRefreshLogBox', () => { ...@@ -163,13 +163,13 @@ describe('ReactRefreshLogBox', () => {
"description": "no", "description": "no",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime Error", "label": "Runtime Error",
"source": "index.js (3:7) @ {module evaluation} "source": "index.js (3:7) @ module evaluation
> 3 | throw new Error('no') > 3 | throw new Error('no')
| ^", | ^",
"stack": [ "stack": [
"{module evaluation} index.js (3:7)", "module evaluation index.js (3:7)",
"{module evaluation} pages/index.js (1:1)", "module evaluation pages/index.js (1:1)",
"{module evaluation} pages/index.js (1:1)", "module evaluation pages/index.js (1:1)",
"<FIXME-next-dist-dir>", "<FIXME-next-dist-dir>",
], ],
} }
......
...@@ -268,7 +268,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -268,7 +268,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')", "description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')",
"source": "app/exports/app-code/react-dom-server-node-explicit/page.js (1:1) @ {module evaluation} "source": "app/exports/app-code/react-dom-server-node-explicit/page.js (1:1) @ module evaluation
> 1 | import * as ReactDOMServerNode from 'react-dom/server.node' > 1 | import * as ReactDOMServerNode from 'react-dom/server.node'
| ^ | ^
...@@ -281,7 +281,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -281,7 +281,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "react-dom/server is not supported in React Server Components.", "description": "react-dom/server is not supported in React Server Components.",
"source": "app/exports/app-code/react-dom-server-node-explicit/page.js (1:1) @ {module evaluation} "source": "app/exports/app-code/react-dom-server-node-explicit/page.js (1:1) @ module evaluation
> 1 | import * as ReactDOMServerNode from 'react-dom/server.node' > 1 | import * as ReactDOMServerNode from 'react-dom/server.node'
| ^ | ^
...@@ -408,7 +408,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -408,7 +408,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')", "description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')",
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation} "source": "internal-pkg/server.node.js (1:1) @ module evaluation
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node' > 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
| ^ | ^
...@@ -421,7 +421,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -421,7 +421,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "react-dom/server is not supported in React Server Components.", "description": "react-dom/server is not supported in React Server Components.",
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation} "source": "internal-pkg/server.node.js (1:1) @ module evaluation
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node' > 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
| ^ | ^
...@@ -609,7 +609,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -609,7 +609,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')", "description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')",
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation} "source": "internal-pkg/server.node.js (1:1) @ module evaluation
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node' > 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
| ^ | ^
...@@ -622,7 +622,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -622,7 +622,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "react-dom/server is not supported in React Server Components.", "description": "react-dom/server is not supported in React Server Components.",
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation} "source": "internal-pkg/server.node.js (1:1) @ module evaluation
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node' > 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
| ^ | ^
...@@ -667,7 +667,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -667,7 +667,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')", "description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')",
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation} "source": "internal-pkg/server.node.js (1:1) @ module evaluation
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node' > 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
| ^ | ^
...@@ -680,7 +680,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -680,7 +680,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "react-dom/server is not supported in React Server Components.", "description": "react-dom/server is not supported in React Server Components.",
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation} "source": "internal-pkg/server.node.js (1:1) @ module evaluation
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node' > 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
| ^ | ^
......
...@@ -297,7 +297,7 @@ describe('middleware - development errors', () => { ...@@ -297,7 +297,7 @@ describe('middleware - development errors', () => {
isTurbopack isTurbopack
? '\n ⨯ Error: booooom!' + ? '\n ⨯ Error: booooom!' +
// TODO(veil): Should be sourcemapped // TODO(veil): Should be sourcemapped
'\n at __TURBOPACK__module__evaluation__ (middleware.js:3:13)' '\n at module evaluation (middleware.js:3:13)'
: '\n ⨯ Error: booooom!' + : '\n ⨯ Error: booooom!' +
// TODO: Should be anonymous method without a method name // TODO: Should be anonymous method without a method name
'\n at <unknown> (middleware.js:3)' + '\n at <unknown> (middleware.js:3)' +
...@@ -317,11 +317,11 @@ describe('middleware - development errors', () => { ...@@ -317,11 +317,11 @@ describe('middleware - development errors', () => {
"description": "booooom!", "description": "booooom!",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime Error", "label": "Runtime Error",
"source": "middleware.js (3:13) @ {module evaluation} "source": "middleware.js (3:13) @ module evaluation
> 3 | throw new Error('booooom!') > 3 | throw new Error('booooom!')
| ^", | ^",
"stack": [ "stack": [
"{module evaluation} middleware.js (3:13)", "module evaluation middleware.js (3:13)",
], ],
} }
`) `)
......
...@@ -354,11 +354,11 @@ describe('Client Navigation', () => { ...@@ -354,11 +354,11 @@ describe('Client Navigation', () => {
"description": "An Expected error occurred", "description": "An Expected error occurred",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime Error", "label": "Runtime Error",
"source": "pages/error-in-the-browser-global-scope.js (2:9) @ {module evaluation} "source": "pages/error-in-the-browser-global-scope.js (2:9) @ module evaluation
> 2 | throw new Error('An Expected error occurred') > 2 | throw new Error('An Expected error occurred')
| ^", | ^",
"stack": [ "stack": [
"{module evaluation} pages/error-in-the-browser-global-scope.js (2:9)", "module evaluation pages/error-in-the-browser-global-scope.js (2:9)",
], ],
} }
`) `)
......
...@@ -274,11 +274,11 @@ describe('Client Navigation rendering', () => { ...@@ -274,11 +274,11 @@ describe('Client Navigation rendering', () => {
"description": "aa is not defined", "description": "aa is not defined",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime ReferenceError", "label": "Runtime ReferenceError",
"source": "pages/error-in-the-global-scope.js (1:1) @ {module evaluation} "source": "pages/error-in-the-global-scope.js (1:1) @ module evaluation
> 1 | aa = 10 //eslint-disable-line > 1 | aa = 10 //eslint-disable-line
| ^", | ^",
"stack": [ "stack": [
"{module evaluation} pages/error-in-the-global-scope.js (1:1)", "module evaluation pages/error-in-the-global-scope.js (1:1)",
"<FIXME-next-dist-dir>", "<FIXME-next-dist-dir>",
], ],
} }
......
...@@ -2699,11 +2699,11 @@ describe('Cache Components Errors', () => { ...@@ -2699,11 +2699,11 @@ describe('Cache Components Errors', () => {
"description": ""use cache: private" must not be used within \`unstable_cache()\`.", "description": ""use cache: private" must not be used within \`unstable_cache()\`.",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime Error", "label": "Runtime Error",
"source": "app/use-cache-private-in-unstable-cache/page.tsx (21:38) @ {module evaluation} "source": "app/use-cache-private-in-unstable-cache/page.tsx (21:38) @ module evaluation
> 21 | const getCachedData = unstable_cache(async () => { > 21 | const getCachedData = unstable_cache(async () => {
| ^", | ^",
"stack": [ "stack": [
"{module evaluation} app/use-cache-private-in-unstable-cache/page.tsx (21:38)", "module evaluation app/use-cache-private-in-unstable-cache/page.tsx (21:38)",
"<FIXME-next-dist-dir>", "<FIXME-next-dist-dir>",
], ],
} }
...@@ -2758,7 +2758,7 @@ describe('Cache Components Errors', () => { ...@@ -2758,7 +2758,7 @@ describe('Cache Components Errors', () => {
if (isDebugPrerender) { if (isDebugPrerender) {
expect(output).toMatchInlineSnapshot(` expect(output).toMatchInlineSnapshot(`
"Error: "use cache: private" must not be used within \`unstable_cache()\`. "Error: "use cache: private" must not be used within \`unstable_cache()\`.
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-unstable-cache/page.tsx:21:38) at module evaluation (bundler:///app/use-cache-private-in-unstable-cache/page.tsx:21:38)
at a (<next-dist-dir>) at a (<next-dist-dir>)
19 | } 19 | }
20 | 20 |
...@@ -2776,7 +2776,7 @@ describe('Cache Components Errors', () => { ...@@ -2776,7 +2776,7 @@ describe('Cache Components Errors', () => {
} else { } else {
expect(output).toMatchInlineSnapshot(` expect(output).toMatchInlineSnapshot(`
"Error: "use cache: private" must not be used within \`unstable_cache()\`. "Error: "use cache: private" must not be used within \`unstable_cache()\`.
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-unstable-cache/page.tsx:21:38) at module evaluation (bundler:///app/use-cache-private-in-unstable-cache/page.tsx:21:38)
19 | } 19 | }
20 | 20 |
> 21 | const getCachedData = unstable_cache(async () => { > 21 | const getCachedData = unstable_cache(async () => {
...@@ -2870,11 +2870,11 @@ describe('Cache Components Errors', () => { ...@@ -2870,11 +2870,11 @@ describe('Cache Components Errors', () => {
"description": ""use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".", "description": ""use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime Error", "label": "Runtime Error",
"source": "app/use-cache-private-in-use-cache/page.tsx (15:1) @ {module evaluation} "source": "app/use-cache-private-in-use-cache/page.tsx (15:1) @ module evaluation
> 15 | async function Private() { > 15 | async function Private() {
| ^", | ^",
"stack": [ "stack": [
"{module evaluation} app/use-cache-private-in-use-cache/page.tsx (15:1)", "module evaluation app/use-cache-private-in-use-cache/page.tsx (15:1)",
"<FIXME-next-dist-dir>", "<FIXME-next-dist-dir>",
], ],
} }
...@@ -2930,7 +2930,7 @@ describe('Cache Components Errors', () => { ...@@ -2930,7 +2930,7 @@ describe('Cache Components Errors', () => {
if (isDebugPrerender) { if (isDebugPrerender) {
expect(output).toMatchInlineSnapshot(` expect(output).toMatchInlineSnapshot(`
"Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private". "Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1) at module evaluation (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
at a (<next-dist-dir>) at a (<next-dist-dir>)
13 | } 13 | }
14 | 14 |
...@@ -2940,7 +2940,7 @@ describe('Cache Components Errors', () => { ...@@ -2940,7 +2940,7 @@ describe('Cache Components Errors', () => {
17 | 17 |
18 | return <p>Private</p> 18 | return <p>Private</p>
Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private". Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1) at module evaluation (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
at b (<next-dist-dir>) at b (<next-dist-dir>)
13 | } 13 | }
14 | 14 |
...@@ -2958,7 +2958,7 @@ describe('Cache Components Errors', () => { ...@@ -2958,7 +2958,7 @@ describe('Cache Components Errors', () => {
} else { } else {
expect(output).toMatchInlineSnapshot(` expect(output).toMatchInlineSnapshot(`
"Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private". "Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1) at module evaluation (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
13 | } 13 | }
14 | 14 |
> 15 | async function Private() { > 15 | async function Private() {
...@@ -2967,7 +2967,7 @@ describe('Cache Components Errors', () => { ...@@ -2967,7 +2967,7 @@ describe('Cache Components Errors', () => {
17 | 17 |
18 | return <p>Private</p> 18 | return <p>Private</p>
Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private". Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1) at module evaluation (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
13 | } 13 | }
14 | 14 |
> 15 | async function Private() { > 15 | async function Private() {
......
...@@ -75,7 +75,7 @@ export function getPrerenderOutput( ...@@ -75,7 +75,7 @@ export function getPrerenderOutput(
} }
line = line line = line
.replace(/at \S+ \(.next[^)]+\)/, replaceNextDistStackFrame) .replace(/at .+? \(.next[^)]+\)/, replaceNextDistStackFrame)
.replace( .replace(
// Single-letter lower-case names are likely minified. // Single-letter lower-case names are likely minified.
/at [a-z] \((?!(<next-dist-dir>|<anonymous>))/, /at [a-z] \((?!(<next-dist-dir>|<anonymous>))/,
......
...@@ -90,7 +90,7 @@ describe('non-root-project-monorepo', () => { ...@@ -90,7 +90,7 @@ describe('non-root-project-monorepo', () => {
if (isTurbopack) { if (isTurbopack) {
// TODO the function name should be hidden // TODO the function name should be hidden
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"app/separate-file.ts (1:7) @ {module evaluation} "app/separate-file.ts (1:7) @ module evaluation
> 1 | throw new Error('Expected error') > 1 | throw new Error('Expected error')
| ^ | ^
...@@ -98,7 +98,7 @@ describe('non-root-project-monorepo', () => { ...@@ -98,7 +98,7 @@ describe('non-root-project-monorepo', () => {
`) `)
expect(await getRedboxCallStack(browser)).toMatchInlineSnapshot(` expect(await getRedboxCallStack(browser)).toMatchInlineSnapshot(`
[ [
"{module evaluation} app/separate-file.ts (1:7)", "module evaluation app/separate-file.ts (1:7)",
"innerArrowFunction app/source-maps-rsc/page.tsx (13:28)", "innerArrowFunction app/source-maps-rsc/page.tsx (13:28)",
"innerFunction app/source-maps-rsc/page.tsx (10:3)", "innerFunction app/source-maps-rsc/page.tsx (10:3)",
"Page app/source-maps-rsc/page.tsx (4:5)", "Page app/source-maps-rsc/page.tsx (4:5)",
...@@ -153,7 +153,7 @@ describe('non-root-project-monorepo', () => { ...@@ -153,7 +153,7 @@ describe('non-root-project-monorepo', () => {
if (isTurbopack) { if (isTurbopack) {
// TODO the function name should be hidden // TODO the function name should be hidden
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"app/separate-file.ts (1:7) @ {module evaluation} "app/separate-file.ts (1:7) @ module evaluation
> 1 | throw new Error('Expected error') > 1 | throw new Error('Expected error')
| ^ | ^
...@@ -161,7 +161,7 @@ describe('non-root-project-monorepo', () => { ...@@ -161,7 +161,7 @@ describe('non-root-project-monorepo', () => {
`) `)
expect(await getRedboxCallStack(browser)).toMatchInlineSnapshot(` expect(await getRedboxCallStack(browser)).toMatchInlineSnapshot(`
[ [
"{module evaluation} app/separate-file.ts (1:7)", "module evaluation app/separate-file.ts (1:7)",
"innerArrowFunction app/source-maps-ssr/page.tsx (15:28)", "innerArrowFunction app/source-maps-ssr/page.tsx (15:28)",
"innerFunction app/source-maps-ssr/page.tsx (12:3)", "innerFunction app/source-maps-ssr/page.tsx (12:3)",
"Page app/source-maps-ssr/page.tsx (6:5)", "Page app/source-maps-ssr/page.tsx (6:5)",
...@@ -216,7 +216,7 @@ describe('non-root-project-monorepo', () => { ...@@ -216,7 +216,7 @@ describe('non-root-project-monorepo', () => {
if (isTurbopack) { if (isTurbopack) {
// TODO the function name should be hidden // TODO the function name should be hidden
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"app/separate-file.ts (1:7) @ {module evaluation} "app/separate-file.ts (1:7) @ module evaluation
> 1 | throw new Error('Expected error') > 1 | throw new Error('Expected error')
| ^ | ^
...@@ -224,7 +224,7 @@ describe('non-root-project-monorepo', () => { ...@@ -224,7 +224,7 @@ describe('non-root-project-monorepo', () => {
`) `)
expect(await getRedboxCallStack(browser)).toMatchInlineSnapshot(` expect(await getRedboxCallStack(browser)).toMatchInlineSnapshot(`
[ [
"{module evaluation} app/separate-file.ts (1:7)", "module evaluation app/separate-file.ts (1:7)",
"innerArrowFunction app/source-maps-client/page.tsx (16:28)", "innerArrowFunction app/source-maps-client/page.tsx (16:28)",
"innerFunction app/source-maps-client/page.tsx (13:3)", "innerFunction app/source-maps-client/page.tsx (13:3)",
"effectCallback app/source-maps-client/page.tsx (7:5)", "effectCallback app/source-maps-client/page.tsx (7:5)",
......
...@@ -444,10 +444,10 @@ describe('app-dir - server source maps', () => { ...@@ -444,10 +444,10 @@ describe('app-dir - server source maps', () => {
'' + '' +
'\nError: module-evaluation' + '\nError: module-evaluation' +
// TODO(veil): Should map to no name like you'd get with native stacks without a bundler. // TODO(veil): Should map to no name like you'd get with native stacks without a bundler.
'\n at __TURBOPACK__module__evaluation__ (app/module-evaluation/module.js:1:22)' + '\n at module evaluation (app/module-evaluation/module.js:1:22)' +
// TODO(veil): Added frames from bundler should be sourcemapped (https://linear.app/vercel/issue/NDX-509/) // TODO(veil): Added frames from bundler should be sourcemapped (https://linear.app/vercel/issue/NDX-509/)
'\n at __TURBOPACK__module__evaluation__ (app/module-evaluation/page.js:1:1)' + '\n at module evaluation (app/module-evaluation/page.js:1:1)' +
'\n at __TURBOPACK__module__evaluation__ (.next' '\n at module evaluation (.next'
) )
} else { } else {
expect(cliOutput).toContain( expect(cliOutput).toContain(
...@@ -473,13 +473,13 @@ describe('app-dir - server source maps', () => { ...@@ -473,13 +473,13 @@ describe('app-dir - server source maps', () => {
"description": "module-evaluation", "description": "module-evaluation",
"environmentLabel": "Prerender", "environmentLabel": "Prerender",
"label": "Console Error", "label": "Console Error",
"source": "app/module-evaluation/module.js (1:22) @ {module evaluation} "source": "app/module-evaluation/module.js (1:22) @ module evaluation
> 1 | export const error = new Error('module-evaluation') > 1 | export const error = new Error('module-evaluation')
| ^", | ^",
"stack": [ "stack": [
"{module evaluation} app/module-evaluation/module.js (1:22)", "module evaluation app/module-evaluation/module.js (1:22)",
"{module evaluation} app/module-evaluation/page.js (1:1)", "module evaluation app/module-evaluation/page.js (1:1)",
"{module evaluation} app/module-evaluation/page.js (6:1)", "module evaluation app/module-evaluation/page.js (6:1)",
"Page <anonymous>", "Page <anonymous>",
], ],
} }
...@@ -531,7 +531,7 @@ describe('app-dir - server source maps', () => { ...@@ -531,7 +531,7 @@ describe('app-dir - server source maps', () => {
'' + '' +
'\nError: module-evaluation' + '\nError: module-evaluation' +
// TODO(veil): Turbopack internals. Feel free to update. Tracked in https://linear.app/vercel/issue/NEXT-4362 // TODO(veil): Turbopack internals. Feel free to update. Tracked in https://linear.app/vercel/issue/NEXT-4362
'\n at __TURBOPACK__module__evaluation__ (bundler:///app/module-evaluation/module.js:1:22)' '\n at module evaluation (bundler:///app/module-evaluation/module.js:1:22)'
) )
expect(normalizeCliOutput(next.cliOutput)).toContain( expect(normalizeCliOutput(next.cliOutput)).toContain(
'' + '' +
......
...@@ -99,7 +99,7 @@ describe('use-cache-close-over-function', () => { ...@@ -99,7 +99,7 @@ describe('use-cache-close-over-function', () => {
'\n [function fn]' + '\n [function fn]' +
'\n ^^^^^^^^^^^' + '\n ^^^^^^^^^^^' +
'\n at createCachedFn (app/server/page.tsx:6:3)' + '\n at createCachedFn (app/server/page.tsx:6:3)' +
'\n at __TURBOPACK__module__evaluation__ (app/server/page.tsx:12:24)' '\n at module evaluation (app/server/page.tsx:12:24)'
: '' + : '' +
'Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.' + 'Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.' +
'\n [function fn]' + '\n [function fn]' +
......
...@@ -47,7 +47,7 @@ describe('use-cache-hanging-inputs', () => { ...@@ -47,7 +47,7 @@ describe('use-cache-hanging-inputs', () => {
if (isTurbopack) { if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"app/uncached-promise/page.tsx (10:13) @ {module evaluation} "app/uncached-promise/page.tsx (10:13) @ module evaluation
8 | } 8 | }
9 | 9 |
...@@ -59,7 +59,7 @@ describe('use-cache-hanging-inputs', () => { ...@@ -59,7 +59,7 @@ describe('use-cache-hanging-inputs', () => {
`) `)
expect(cliOutput).toContain(`Error: ${expectedTimeoutErrorMessage} expect(cliOutput).toContain(`Error: ${expectedTimeoutErrorMessage}
at __TURBOPACK__module__evaluation__`) at module evaluation`)
} else { } else {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"app/uncached-promise/page.tsx (10:13) @ eval "app/uncached-promise/page.tsx (10:13) @ eval
...@@ -101,7 +101,7 @@ describe('use-cache-hanging-inputs', () => { ...@@ -101,7 +101,7 @@ describe('use-cache-hanging-inputs', () => {
if (isTurbopack) { if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"app/uncached-promise-nested/page.tsx (16:1) @ {module evaluation} "app/uncached-promise-nested/page.tsx (16:1) @ module evaluation
14 | } 14 | }
15 | 15 |
...@@ -113,7 +113,7 @@ describe('use-cache-hanging-inputs', () => { ...@@ -113,7 +113,7 @@ describe('use-cache-hanging-inputs', () => {
`) `)
expect(cliOutput).toContain(`Error: ${expectedTimeoutErrorMessage} expect(cliOutput).toContain(`Error: ${expectedTimeoutErrorMessage}
at __TURBOPACK__module__evaluation__`) at module evaluation`)
} else { } else {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"app/uncached-promise-nested/page.tsx (16:1) @ eval "app/uncached-promise-nested/page.tsx (16:1) @ eval
...@@ -156,7 +156,7 @@ describe('use-cache-hanging-inputs', () => { ...@@ -156,7 +156,7 @@ describe('use-cache-hanging-inputs', () => {
if (isTurbopack) { if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"app/bound-args/page.tsx (13:15) @ {module evaluation} "app/bound-args/page.tsx (13:15) @ module evaluation
11 | const uncachedDataPromise = fetchUncachedData() 11 | const uncachedDataPromise = fetchUncachedData()
12 | 12 |
...@@ -168,7 +168,7 @@ describe('use-cache-hanging-inputs', () => { ...@@ -168,7 +168,7 @@ describe('use-cache-hanging-inputs', () => {
`) `)
expect(cliOutput).toContain(`Error: ${expectedTimeoutErrorMessage} expect(cliOutput).toContain(`Error: ${expectedTimeoutErrorMessage}
at __TURBOPACK__module__evaluation__`) at module evaluation`)
} else { } else {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"app/bound-args/page.tsx (13:15) @ eval "app/bound-args/page.tsx (13:15) @ eval
......
...@@ -719,6 +719,6 @@ type ContextConstructor<M> = { ...@@ -719,6 +719,6 @@ type ContextConstructor<M> = {
function applyModuleFactoryName(factory: Function) { function applyModuleFactoryName(factory: Function) {
// Give the module factory a nice name to improve stack traces. // Give the module factory a nice name to improve stack traces.
Object.defineProperty(factory, 'name', { Object.defineProperty(factory, 'name', {
value: '__TURBOPACK__module__evaluation__', value: 'module evaluation',
}) })
} }
...@@ -9,7 +9,7 @@ use turbopack_core::{ ...@@ -9,7 +9,7 @@ use turbopack_core::{
context::AssetContext, context::AssetContext,
environment::{ChunkLoading, Environment}, environment::{ChunkLoading, Environment},
}; };
use turbopack_ecmascript::{magic_identifier, utils::StringifyJs}; use turbopack_ecmascript::utils::StringifyJs;
use crate::{RuntimeType, asset_context::get_runtime_asset_context, embed_js::embed_static_code}; use crate::{RuntimeType, asset_context::get_runtime_asset_context, embed_js::embed_static_code};
...@@ -35,12 +35,6 @@ pub async fn get_browser_runtime_code( ...@@ -35,12 +35,6 @@ pub async fn get_browser_runtime_code(
match runtime_type { match runtime_type {
RuntimeType::Production => runtime_base_code.push("browser/runtime/base/build-base.ts"), RuntimeType::Production => runtime_base_code.push("browser/runtime/base/build-base.ts"),
RuntimeType::Development => { RuntimeType::Development => {
debug_assert!(
// The dev runtime makes this assumption. If that's no longer true, we need to
// update the runtime code.
magic_identifier::mangle("module evaluation").as_str()
== "__TURBOPACK__module__evaluation__"
);
runtime_base_code.push("browser/runtime/base/dev-base.ts"); runtime_base_code.push("browser/runtime/base/dev-base.ts");
} }
#[cfg(feature = "test")] #[cfg(feature = "test")]
......
...@@ -155,10 +155,6 @@ mod tests { ...@@ -155,10 +155,6 @@ mod tests {
#[test] #[test]
fn test_encode() { fn test_encode() {
assert_eq!(
mangle("module evaluation"),
"__TURBOPACK__module__evaluation__"
);
assert_eq!(mangle("Hello World"), "__TURBOPACK__Hello__World__"); assert_eq!(mangle("Hello World"), "__TURBOPACK__Hello__World__");
assert_eq!(mangle("Hello_World"), "__TURBOPACK__Hello_World__"); assert_eq!(mangle("Hello_World"), "__TURBOPACK__Hello_World__");
assert_eq!(mangle("Hello__World"), "__TURBOPACK__Hello_$5f$World__"); assert_eq!(mangle("Hello__World"), "__TURBOPACK__Hello_$5f$World__");
...@@ -180,10 +176,6 @@ mod tests { ...@@ -180,10 +176,6 @@ mod tests {
#[test] #[test]
fn test_decode() { fn test_decode() {
assert_eq!(
unmangle("__TURBOPACK__module__evaluation__"),
"module evaluation"
);
assert_eq!(unmangle("__TURBOPACK__Hello__World__"), "Hello World"); assert_eq!(unmangle("__TURBOPACK__Hello__World__"), "Hello World");
assert_eq!(unmangle("__TURBOPACK__Hello_World__"), "Hello_World"); assert_eq!(unmangle("__TURBOPACK__Hello_World__"), "Hello_World");
assert_eq!(unmangle("__TURBOPACK__Hello_$5f$World__"), "Hello__World"); assert_eq!(unmangle("__TURBOPACK__Hello_$5f$World__"), "Hello__World");
......
;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="8faf1c28-5e36-9739-d4ef-60847ff8a1f3")}catch(e){}}(); ;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="9cc3c4ae-b6b3-7945-3645-c0e627a5103b")}catch(e){}}();
(globalThis.TURBOPACK || (globalThis.TURBOPACK = [])).push([ (globalThis.TURBOPACK || (globalThis.TURBOPACK = [])).push([
"output/ba425_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js", "output/ba425_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js",
{"otherChunks":["output/aaf3a_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0b8736b3.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/input/index.js [test] (ecmascript)"]} {"otherChunks":["output/aaf3a_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0b8736b3.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/input/index.js [test] (ecmascript)"]}
...@@ -489,7 +489,7 @@ contextPrototype.g = globalThis; ...@@ -489,7 +489,7 @@ contextPrototype.g = globalThis;
function applyModuleFactoryName(factory) { function applyModuleFactoryName(factory) {
// Give the module factory a nice name to improve stack traces. // Give the module factory a nice name to improve stack traces.
Object.defineProperty(factory, 'name', { Object.defineProperty(factory, 'name', {
value: '__TURBOPACK__module__evaluation__' value: 'module evaluation'
}); });
} }
/** /**
...@@ -1834,5 +1834,5 @@ chunkListsToRegister.forEach(registerChunkList); ...@@ -1834,5 +1834,5 @@ chunkListsToRegister.forEach(registerChunkList);
})(); })();
//# debugId=8faf1c28-5e36-9739-d4ef-60847ff8a1f3 //# debugId=9cc3c4ae-b6b3-7945-3645-c0e627a5103b
//# sourceMappingURL=aaf3a_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js.map //# sourceMappingURL=aaf3a_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js.map
\ No newline at end of file
...@@ -478,7 +478,7 @@ contextPrototype.g = globalThis; ...@@ -478,7 +478,7 @@ contextPrototype.g = globalThis;
function applyModuleFactoryName(factory) { function applyModuleFactoryName(factory) {
// Give the module factory a nice name to improve stack traces. // Give the module factory a nice name to improve stack traces.
Object.defineProperty(factory, 'name', { Object.defineProperty(factory, 'name', {
value: '__TURBOPACK__module__evaluation__' value: 'module evaluation'
}); });
} }
/// <reference path="../shared/runtime-utils.ts" /> /// <reference path="../shared/runtime-utils.ts" />
...@@ -767,4 +767,4 @@ module.exports = (sourcePath)=>({ ...@@ -767,4 +767,4 @@ module.exports = (sourcePath)=>({
}); });
//# sourceMappingURL=%5Bturbopack%5D_runtime.js.map //# sourceMappingURL=%5Bturbopack%5D_runtime.js.map
\ No newline at end of file
...@@ -478,7 +478,7 @@ contextPrototype.g = globalThis; ...@@ -478,7 +478,7 @@ contextPrototype.g = globalThis;
function applyModuleFactoryName(factory) { function applyModuleFactoryName(factory) {
// Give the module factory a nice name to improve stack traces. // Give the module factory a nice name to improve stack traces.
Object.defineProperty(factory, 'name', { Object.defineProperty(factory, 'name', {
value: '__TURBOPACK__module__evaluation__' value: 'module evaluation'
}); });
} }
/// <reference path="../shared/runtime-utils.ts" /> /// <reference path="../shared/runtime-utils.ts" />
...@@ -767,4 +767,4 @@ module.exports = (sourcePath)=>({ ...@@ -767,4 +767,4 @@ module.exports = (sourcePath)=>({
}); });
//# sourceMappingURL=%5Bturbopack%5D_runtime.js.map //# sourceMappingURL=%5Bturbopack%5D_runtime.js.map
\ No newline at end of file
...@@ -488,7 +488,7 @@ contextPrototype.g = globalThis; ...@@ -488,7 +488,7 @@ contextPrototype.g = globalThis;
function applyModuleFactoryName(factory) { function applyModuleFactoryName(factory) {
// Give the module factory a nice name to improve stack traces. // Give the module factory a nice name to improve stack traces.
Object.defineProperty(factory, 'name', { Object.defineProperty(factory, 'name', {
value: '__TURBOPACK__module__evaluation__' value: 'module evaluation'
}); });
} }
/** /**
...@@ -1833,4 +1833,4 @@ chunkListsToRegister.forEach(registerChunkList); ...@@ -1833,4 +1833,4 @@ chunkListsToRegister.forEach(registerChunkList);
})(); })();
//# sourceMappingURL=780ce_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js.map //# sourceMappingURL=780ce_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js.map
\ No newline at end of file
...@@ -728,7 +728,7 @@ contextPrototype.g = globalThis; ...@@ -728,7 +728,7 @@ contextPrototype.g = globalThis;
function applyModuleFactoryName(factory) { function applyModuleFactoryName(factory) {
// Give the module factory a nice name to improve stack traces. // Give the module factory a nice name to improve stack traces.
Object.defineProperty(factory, 'name', { Object.defineProperty(factory, 'name', {
value: '__TURBOPACK__module__evaluation__' value: 'module evaluation'
}); });
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment