Skip to content

Commit cec22a1

Browse files
committed
Turbopack: improve module evaluation name
1 parent 642ae3e commit cec22a1

File tree

22 files changed

+79
-93
lines changed

22 files changed

+79
-93
lines changed

test/development/acceptance-app/ReactRefreshLogBox.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ describe('ReactRefreshLogBox app', () => {
9595
"description": "no",
9696
"environmentLabel": null,
9797
"label": "Runtime Error",
98-
"source": "index.js (3:7) @ {module evaluation}
98+
"source": "index.js (3:7) @ module evaluation
9999
> 3 | throw new Error('no')
100100
| ^",
101101
"stack": [
102-
"{module evaluation} index.js (3:7)",
103-
"{module evaluation} app/page.js (2:1)",
102+
"module evaluation index.js (3:7)",
103+
"module evaluation app/page.js (2:1)",
104104
],
105105
}
106106
`)
@@ -1722,12 +1722,12 @@ export default function Home() {
17221722
"description": "utils error",
17231723
"environmentLabel": null,
17241724
"label": "Runtime Error",
1725-
"source": "app/utils.ts (1:7) @ {module evaluation}
1725+
"source": "app/utils.ts (1:7) @ module evaluation
17261726
> 1 | throw new Error('utils error')
17271727
| ^",
17281728
"stack": [
1729-
"{module evaluation} app/utils.ts (1:7)",
1730-
"{module evaluation} app/page.js (2:1)",
1729+
"module evaluation app/utils.ts (1:7)",
1730+
"module evaluation app/page.js (2:1)",
17311731
],
17321732
}
17331733
`)

test/development/acceptance/ReactRefreshLogBox.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ describe('ReactRefreshLogBox', () => {
122122
"description": "no",
123123
"environmentLabel": null,
124124
"label": "Runtime Error",
125-
"source": "index.js (3:7) @ {module evaluation}
125+
"source": "index.js (3:7) @ module evaluation
126126
> 3 | throw new Error('no')
127127
| ^",
128128
"stack": [
129-
"{module evaluation} index.js (3:7)",
130-
"{module evaluation} pages/index.js (1:1)",
131-
"{module evaluation} pages/index.js (1:1)",
129+
"module evaluation index.js (3:7)",
130+
"module evaluation pages/index.js (1:1)",
131+
"module evaluation pages/index.js (1:1)",
132132
"<FIXME-next-dist-dir>",
133133
],
134134
}
@@ -163,13 +163,13 @@ describe('ReactRefreshLogBox', () => {
163163
"description": "no",
164164
"environmentLabel": null,
165165
"label": "Runtime Error",
166-
"source": "index.js (3:7) @ {module evaluation}
166+
"source": "index.js (3:7) @ module evaluation
167167
> 3 | throw new Error('no')
168168
| ^",
169169
"stack": [
170-
"{module evaluation} index.js (3:7)",
171-
"{module evaluation} pages/index.js (1:1)",
172-
"{module evaluation} pages/index.js (1:1)",
170+
"module evaluation index.js (3:7)",
171+
"module evaluation pages/index.js (1:1)",
172+
"module evaluation pages/index.js (1:1)",
173173
"<FIXME-next-dist-dir>",
174174
],
175175
}

test/development/app-dir/ssr-in-rsc/ssr-in-rsc.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ describe('react-dom/server in React Server environment', () => {
269269
expect(redbox).toMatchInlineSnapshot(`
270270
{
271271
"description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')",
272-
"source": "app/exports/app-code/react-dom-server-node-explicit/page.js (1:1) @ {module evaluation}
272+
"source": "app/exports/app-code/react-dom-server-node-explicit/page.js (1:1) @ module evaluation
273273
274274
> 1 | import * as ReactDOMServerNode from 'react-dom/server.node'
275275
| ^
@@ -282,7 +282,7 @@ describe('react-dom/server in React Server environment', () => {
282282
expect(redbox).toMatchInlineSnapshot(`
283283
{
284284
"description": "react-dom/server is not supported in React Server Components.",
285-
"source": "app/exports/app-code/react-dom-server-node-explicit/page.js (1:1) @ {module evaluation}
285+
"source": "app/exports/app-code/react-dom-server-node-explicit/page.js (1:1) @ module evaluation
286286
287287
> 1 | import * as ReactDOMServerNode from 'react-dom/server.node'
288288
| ^
@@ -409,7 +409,7 @@ describe('react-dom/server in React Server environment', () => {
409409
expect(redbox).toMatchInlineSnapshot(`
410410
{
411411
"description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')",
412-
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation}
412+
"source": "internal-pkg/server.node.js (1:1) @ module evaluation
413413
414414
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
415415
| ^
@@ -422,7 +422,7 @@ describe('react-dom/server in React Server environment', () => {
422422
expect(redbox).toMatchInlineSnapshot(`
423423
{
424424
"description": "react-dom/server is not supported in React Server Components.",
425-
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation}
425+
"source": "internal-pkg/server.node.js (1:1) @ module evaluation
426426
427427
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
428428
| ^
@@ -610,7 +610,7 @@ describe('react-dom/server in React Server environment', () => {
610610
expect(redbox).toMatchInlineSnapshot(`
611611
{
612612
"description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')",
613-
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation}
613+
"source": "internal-pkg/server.node.js (1:1) @ module evaluation
614614
615615
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
616616
| ^
@@ -623,7 +623,7 @@ describe('react-dom/server in React Server environment', () => {
623623
expect(redbox).toMatchInlineSnapshot(`
624624
{
625625
"description": "react-dom/server is not supported in React Server Components.",
626-
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation}
626+
"source": "internal-pkg/server.node.js (1:1) @ module evaluation
627627
628628
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
629629
| ^
@@ -668,7 +668,7 @@ describe('react-dom/server in React Server environment', () => {
668668
expect(redbox).toMatchInlineSnapshot(`
669669
{
670670
"description": "Cannot read properties of undefined (reading 'ReactCurrentDispatcher')",
671-
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation}
671+
"source": "internal-pkg/server.node.js (1:1) @ module evaluation
672672
673673
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
674674
| ^
@@ -681,7 +681,7 @@ describe('react-dom/server in React Server environment', () => {
681681
expect(redbox).toMatchInlineSnapshot(`
682682
{
683683
"description": "react-dom/server is not supported in React Server Components.",
684-
"source": "internal-pkg/server.node.js (1:1) @ {module evaluation}
684+
"source": "internal-pkg/server.node.js (1:1) @ module evaluation
685685
686686
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
687687
| ^

test/development/middleware-errors/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ describe('middleware - development errors', () => {
297297
isTurbopack
298298
? '\n ⨯ Error: booooom!' +
299299
// TODO(veil): Should be sourcemapped
300-
'\n at __TURBOPACK__module__evaluation__ (middleware.js:3:13)'
300+
'\n at module evaluation (middleware.js:3:13)'
301301
: '\n ⨯ Error: booooom!' +
302302
// TODO: Should be anonymous method without a method name
303303
'\n at <unknown> (middleware.js:3)' +
@@ -317,11 +317,11 @@ describe('middleware - development errors', () => {
317317
"description": "booooom!",
318318
"environmentLabel": null,
319319
"label": "Runtime Error",
320-
"source": "middleware.js (3:13) @ {module evaluation}
320+
"source": "middleware.js (3:13) @ module evaluation
321321
> 3 | throw new Error('booooom!')
322322
| ^",
323323
"stack": [
324-
"{module evaluation} middleware.js (3:13)",
324+
"module evaluation middleware.js (3:13)",
325325
],
326326
}
327327
`)

test/development/pages-dir/client-navigation/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,11 @@ describe('Client Navigation', () => {
354354
"description": "An Expected error occurred",
355355
"environmentLabel": null,
356356
"label": "Runtime Error",
357-
"source": "pages/error-in-the-browser-global-scope.js (2:9) @ {module evaluation}
357+
"source": "pages/error-in-the-browser-global-scope.js (2:9) @ module evaluation
358358
> 2 | throw new Error('An Expected error occurred')
359359
| ^",
360360
"stack": [
361-
"{module evaluation} pages/error-in-the-browser-global-scope.js (2:9)",
361+
"module evaluation pages/error-in-the-browser-global-scope.js (2:9)",
362362
],
363363
}
364364
`)

test/development/pages-dir/client-navigation/rendering.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ describe('Client Navigation rendering', () => {
274274
"description": "aa is not defined",
275275
"environmentLabel": null,
276276
"label": "Runtime ReferenceError",
277-
"source": "pages/error-in-the-global-scope.js (1:1) @ {module evaluation}
277+
"source": "pages/error-in-the-global-scope.js (1:1) @ module evaluation
278278
> 1 | aa = 10 //eslint-disable-line
279279
| ^",
280280
"stack": [
281-
"{module evaluation} pages/error-in-the-global-scope.js (1:1)",
281+
"module evaluation pages/error-in-the-global-scope.js (1:1)",
282282
"<FIXME-next-dist-dir>",
283283
],
284284
}

test/e2e/app-dir/cache-components-errors/cache-components-errors.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2699,11 +2699,11 @@ describe('Cache Components Errors', () => {
26992699
"description": ""use cache: private" must not be used within \`unstable_cache()\`.",
27002700
"environmentLabel": null,
27012701
"label": "Runtime Error",
2702-
"source": "app/use-cache-private-in-unstable-cache/page.tsx (21:38) @ {module evaluation}
2702+
"source": "app/use-cache-private-in-unstable-cache/page.tsx (21:38) @ module evaluation
27032703
> 21 | const getCachedData = unstable_cache(async () => {
27042704
| ^",
27052705
"stack": [
2706-
"{module evaluation} app/use-cache-private-in-unstable-cache/page.tsx (21:38)",
2706+
"module evaluation app/use-cache-private-in-unstable-cache/page.tsx (21:38)",
27072707
"<FIXME-next-dist-dir>",
27082708
],
27092709
}
@@ -2758,7 +2758,7 @@ describe('Cache Components Errors', () => {
27582758
if (isDebugPrerender) {
27592759
expect(output).toMatchInlineSnapshot(`
27602760
"Error: "use cache: private" must not be used within \`unstable_cache()\`.
2761-
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-unstable-cache/page.tsx:21:38)
2761+
at module evaluation (bundler:///app/use-cache-private-in-unstable-cache/page.tsx:21:38)
27622762
at a (<next-dist-dir>)
27632763
19 | }
27642764
20 |
@@ -2776,7 +2776,7 @@ describe('Cache Components Errors', () => {
27762776
} else {
27772777
expect(output).toMatchInlineSnapshot(`
27782778
"Error: "use cache: private" must not be used within \`unstable_cache()\`.
2779-
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-unstable-cache/page.tsx:21:38)
2779+
at module evaluation (bundler:///app/use-cache-private-in-unstable-cache/page.tsx:21:38)
27802780
19 | }
27812781
20 |
27822782
> 21 | const getCachedData = unstable_cache(async () => {
@@ -2870,11 +2870,11 @@ describe('Cache Components Errors', () => {
28702870
"description": ""use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".",
28712871
"environmentLabel": null,
28722872
"label": "Runtime Error",
2873-
"source": "app/use-cache-private-in-use-cache/page.tsx (15:1) @ {module evaluation}
2873+
"source": "app/use-cache-private-in-use-cache/page.tsx (15:1) @ module evaluation
28742874
> 15 | async function Private() {
28752875
| ^",
28762876
"stack": [
2877-
"{module evaluation} app/use-cache-private-in-use-cache/page.tsx (15:1)",
2877+
"module evaluation app/use-cache-private-in-use-cache/page.tsx (15:1)",
28782878
"<FIXME-next-dist-dir>",
28792879
],
28802880
}
@@ -2930,7 +2930,7 @@ describe('Cache Components Errors', () => {
29302930
if (isDebugPrerender) {
29312931
expect(output).toMatchInlineSnapshot(`
29322932
"Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
2933-
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
2933+
at module evaluation (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
29342934
at a (<next-dist-dir>)
29352935
13 | }
29362936
14 |
@@ -2940,7 +2940,7 @@ describe('Cache Components Errors', () => {
29402940
17 |
29412941
18 | return <p>Private</p>
29422942
Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
2943-
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
2943+
at module evaluation (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
29442944
at b (<next-dist-dir>)
29452945
13 | }
29462946
14 |
@@ -2958,7 +2958,7 @@ describe('Cache Components Errors', () => {
29582958
} else {
29592959
expect(output).toMatchInlineSnapshot(`
29602960
"Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
2961-
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
2961+
at module evaluation (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
29622962
13 | }
29632963
14 |
29642964
> 15 | async function Private() {
@@ -2967,7 +2967,7 @@ describe('Cache Components Errors', () => {
29672967
17 |
29682968
18 | return <p>Private</p>
29692969
Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
2970-
at __TURBOPACK__module__evaluation__ (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
2970+
at module evaluation (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
29712971
13 | }
29722972
14 |
29732973
> 15 | async function Private() {

test/e2e/app-dir/non-root-project-monorepo/non-root-project-monorepo.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ describe('non-root-project-monorepo', () => {
9090
if (isTurbopack) {
9191
// TODO the function name should be hidden
9292
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
93-
"app/separate-file.ts (1:7) @ {module evaluation}
93+
"app/separate-file.ts (1:7) @ module evaluation
9494
9595
> 1 | throw new Error('Expected error')
9696
| ^
9797
2 |"
9898
`)
9999
expect(await getRedboxCallStack(browser)).toMatchInlineSnapshot(`
100100
[
101-
"{module evaluation} app/separate-file.ts (1:7)",
101+
"module evaluation app/separate-file.ts (1:7)",
102102
"innerArrowFunction app/source-maps-rsc/page.tsx (13:28)",
103103
"innerFunction app/source-maps-rsc/page.tsx (10:3)",
104104
"Page app/source-maps-rsc/page.tsx (4:5)",
@@ -153,15 +153,15 @@ describe('non-root-project-monorepo', () => {
153153
if (isTurbopack) {
154154
// TODO the function name should be hidden
155155
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
156-
"app/separate-file.ts (1:7) @ {module evaluation}
156+
"app/separate-file.ts (1:7) @ module evaluation
157157
158158
> 1 | throw new Error('Expected error')
159159
| ^
160160
2 |"
161161
`)
162162
expect(await getRedboxCallStack(browser)).toMatchInlineSnapshot(`
163163
[
164-
"{module evaluation} app/separate-file.ts (1:7)",
164+
"module evaluation app/separate-file.ts (1:7)",
165165
"innerArrowFunction app/source-maps-ssr/page.tsx (15:28)",
166166
"innerFunction app/source-maps-ssr/page.tsx (12:3)",
167167
"Page app/source-maps-ssr/page.tsx (6:5)",
@@ -216,15 +216,15 @@ describe('non-root-project-monorepo', () => {
216216
if (isTurbopack) {
217217
// TODO the function name should be hidden
218218
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
219-
"app/separate-file.ts (1:7) @ {module evaluation}
219+
"app/separate-file.ts (1:7) @ module evaluation
220220
221221
> 1 | throw new Error('Expected error')
222222
| ^
223223
2 |"
224224
`)
225225
expect(await getRedboxCallStack(browser)).toMatchInlineSnapshot(`
226226
[
227-
"{module evaluation} app/separate-file.ts (1:7)",
227+
"module evaluation app/separate-file.ts (1:7)",
228228
"innerArrowFunction app/source-maps-client/page.tsx (16:28)",
229229
"innerFunction app/source-maps-client/page.tsx (13:3)",
230230
"effectCallback app/source-maps-client/page.tsx (7:5)",

test/e2e/app-dir/server-source-maps/server-source-maps.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,10 @@ describe('app-dir - server source maps', () => {
445445
'' +
446446
'\nError: module-evaluation' +
447447
// TODO(veil): Should map to no name like you'd get with native stacks without a bundler.
448-
'\n at __TURBOPACK__module__evaluation__ (app/module-evaluation/module.js:1:22)' +
448+
'\n at module evaluation (app/module-evaluation/module.js:1:22)' +
449449
// TODO(veil): Added frames from bundler should be sourcemapped (https://linear.app/vercel/issue/NDX-509/)
450-
'\n at __TURBOPACK__module__evaluation__ (app/module-evaluation/page.js:1:1)' +
451-
'\n at __TURBOPACK__module__evaluation__ (.next'
450+
'\n at module evaluation (app/module-evaluation/page.js:1:1)' +
451+
'\n at module evaluation (.next'
452452
)
453453
} else {
454454
expect(cliOutput).toContain(
@@ -474,13 +474,13 @@ describe('app-dir - server source maps', () => {
474474
"description": "module-evaluation",
475475
"environmentLabel": "Prerender",
476476
"label": "Console Error",
477-
"source": "app/module-evaluation/module.js (1:22) @ {module evaluation}
477+
"source": "app/module-evaluation/module.js (1:22) @ module evaluation
478478
> 1 | export const error = new Error('module-evaluation')
479479
| ^",
480480
"stack": [
481-
"{module evaluation} app/module-evaluation/module.js (1:22)",
482-
"{module evaluation} app/module-evaluation/page.js (1:1)",
483-
"{module evaluation} app/module-evaluation/page.js (6:1)",
481+
"module evaluation app/module-evaluation/module.js (1:22)",
482+
"module evaluation app/module-evaluation/page.js (1:1)",
483+
"module evaluation app/module-evaluation/page.js (6:1)",
484484
"Array.map <anonymous>",
485485
"Function.all <anonymous>",
486486
"Page <anonymous>",
@@ -536,7 +536,7 @@ describe('app-dir - server source maps', () => {
536536
'' +
537537
'\nError: module-evaluation' +
538538
// TODO(veil): Turbopack internals. Feel free to update. Tracked in https://linear.app/vercel/issue/NEXT-4362
539-
'\n at __TURBOPACK__module__evaluation__ (bundler:///app/module-evaluation/module.js:1:22)'
539+
'\n at module evaluation (bundler:///app/module-evaluation/module.js:1:22)'
540540
)
541541
expect(normalizeCliOutput(next.cliOutput)).toContain(
542542
'' +

0 commit comments

Comments
 (0)