Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
67bc262b
Unverified
Commit
67bc262b
authored
Sep 14, 2023
by
Tobias Koppers
Committed by
GitHub
Sep 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Revert "feat(turbopack): support next.js specific node polyfills"" (#55392)
Reverts vercel/next.js#55385 Closes WEB-1565
parent
42ad2cef
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
19 additions
and
192 deletions
+19
-192
next_import_map.rs
packages/next-swc/crates/next-core/src/next_import_map.rs
+6
-0
client.tsx
.../integration/next/polyfill/basic/input/app/app/client.tsx
+0
-9
page.tsx
...ts/integration/next/polyfill/basic/input/app/app/page.tsx
+0
-10
layout.tsx
...ests/integration/next/polyfill/basic/input/app/layout.tsx
+0
-7
index.tsx
...sts/integration/next/polyfill/basic/input/pages/index.tsx
+0
-58
page.tsx
...ests/integration/next/polyfill/basic/input/pages/page.tsx
+0
-20
lint TP1004 fs.readFile(__q____q____q____star__0__-1ea14a.txt
... TP1004 fs.readFile(__q____q____q____star__0__-1ea14a.txt
+0
-15
lint TP1004 fs.readFile(__q____q____q____star__0__-9b3c3c.txt
... TP1004 fs.readFile(__q____q____q____star__0__-9b3c3c.txt
+0
-15
lint TP1004 fs.readFileSync(__q____q____q____star_-0b346e.txt
... TP1004 fs.readFileSync(__q____q____q____star_-0b346e.txt
+0
-15
lint TP1004 fs.readFileSync(__q____q____q____star_-c0b6ea.txt
... TP1004 fs.readFileSync(__q____q____q____star_-c0b6ea.txt
+0
-15
lint TP1004 fs.stat(__q____q____q____star__0__star-05f14f.txt
... TP1004 fs.stat(__q____q____q____star__0__star-05f14f.txt
+0
-14
lint TP1004 fs.stat(__q____q____q____star__0__star-a12dc8.txt
... TP1004 fs.stat(__q____q____q____star__0__star-a12dc8.txt
+0
-14
layout.js
test/development/basic/node-builtins/app/layout.js
+12
-0
turbopack-tests-manifest.js
test/turbopack-tests-manifest.js
+1
-0
No files found.
packages/next-swc/crates/next-core/src/next_import_map.rs
View file @
67bc262b
...
...
@@ -661,6 +661,12 @@ pub async fn insert_next_shared_aliases(
import_map
.insert_singleton_alias
(
"react"
,
project_path
);
import_map
.insert_singleton_alias
(
"react-dom"
,
project_path
);
//https://github.com/vercel/next.js/blob/f94d4f93e4802f951063cfa3351dd5a2325724b3/packages/next/src/build/webpack-config.ts#L1196
import_map
.insert_exact_alias
(
"setimmediate"
,
request_to_import_mapping
(
project_path
,
"next/dist/compiled/setimmediate"
),
);
insert_turbopack_dev_alias
(
import_map
);
insert_package_alias
(
import_map
,
...
...
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/input/app/app/client.tsx
deleted
100644 → 0
View file @
42ad2cef
'use client'
export
default
function
Component
()
{
return
(
<
div
id=
"client"
>
{
Buffer
.
from
(
'Hello Client Component'
,
'utf-8'
).
toString
()
}
</
div
>
)
}
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/input/app/app/page.tsx
deleted
100644 → 0
View file @
42ad2cef
import
Component
from
'./client'
export
default
function
Page
()
{
return
(
<
div
id=
"server"
>
{
Buffer
.
from
(
'Hello Server Component'
,
'utf-8'
).
toString
()
}
<
Component
/>
</
div
>
)
}
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/input/app/layout.tsx
deleted
100644 → 0
View file @
42ad2cef
export
default
function
RootLayout
({
children
}:
{
children
:
any
})
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/input/pages/index.tsx
deleted
100644 → 0
View file @
42ad2cef
import
{
useRef
}
from
'react'
import
{
Harness
,
useTestHarness
}
from
'@turbo/pack-test-harness'
export
default
function
Page
()
{
const
pageIframeRef
=
useRef
<
HTMLIFrameElement
|
null
>
(
null
)
const
appIframeRef
=
useRef
<
HTMLIFrameElement
|
null
>
(
null
)
useTestHarness
((
mod
)
=>
runTests
(
mod
,
pageIframeRef
.
current
!
,
appIframeRef
.
current
)
)
return
(
<>
<
iframe
style=
{
{
width
:
800
,
height
:
600
}
}
src=
"/app"
ref=
{
appIframeRef
}
/>
<
iframe
style=
{
{
width
:
800
,
height
:
600
}
}
src=
"/page"
ref=
{
pageIframeRef
}
/>
</>
)
}
function
runTests
(
harness
:
Harness
,
page
:
HTMLIFrameElement
,
app
:
HTMLIFrameElement
)
{
const
TIMEOUT
=
30000
it
(
'should support Buffer on pages'
,
async
()
=>
{
await
harness
.
waitForLoaded
(
page
)
const
server
=
await
harness
.
waitForSelector
(
page
,
'#server'
)
expect
(
server
.
innerHTML
).
toContain
(
'Hello Server Page'
)
const
client
=
await
harness
.
waitForSelector
(
page
,
'#client'
)
expect
(
client
.
innerHTML
).
toContain
(
'Hello Client Page'
)
},
TIMEOUT
)
it
(
'should support Buffer on app'
,
async
()
=>
{
await
harness
.
waitForLoaded
(
app
)
const
server
=
await
harness
.
waitForSelector
(
app
,
'#server'
)
expect
(
server
.
innerHTML
).
toContain
(
'Hello Server Component'
)
const
client
=
await
harness
.
waitForSelector
(
app
,
'#client'
)
expect
(
client
.
innerHTML
).
toContain
(
'Hello Client Component'
)
},
TIMEOUT
)
}
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/input/pages/page.tsx
deleted
100644 → 0
View file @
42ad2cef
import
{
useEffect
,
useState
}
from
'react'
export
default
function
Page
()
{
const
[
state
,
setState
]
=
useState
(
'SSR'
)
useEffect
(()
=>
{
setState
(
<
div
id=
"client"
>
{
Buffer
.
from
(
'Hello Client Page'
,
'utf-8'
).
toString
()
}
</
div
>
)
},
[
setState
])
return
(
<
div
>
<
div
id=
"server"
>
{
Buffer
.
from
(
'Hello Server Page'
,
'utf-8'
).
toString
()
}
</
div
>
{
state
}
</
div
>
)
}
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/issues/lint TP1004 fs.readFile(__q____q____q____star__0__-1ea14a.txt
deleted
100644 → 0
View file @
42ad2cef
warning - [parse] [project]/packages/next/dist/server/lib/node-fs-methods.js /packages/next/dist/server/lib/node-fs-methods.js:18:19 lint TP1004 fs.readFile(???*0*) is very dynamic
14 | default: obj
15 | };
16 | }
17 | const nodeFs = {
+ v
18 + readFile: (f)=>_fs.default.promises.readFile(f),
+ ^
19 | readFileSync: (f)=>_fs.default.readFileSync(f),
20 | writeFile: (f, d)=>_fs.default.promises.writeFile(f, d),
21 | mkdir: (dir)=>_fs.default.promises.mkdir(dir, {
22 | recursive: true
- *0* f
⚠️ pattern without value
\ No newline at end of file
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/issues/lint TP1004 fs.readFile(__q____q____q____star__0__-9b3c3c.txt
deleted
100644 → 0
View file @
42ad2cef
warning - [parse] [project]/packages/next/dist/server/lib/node-fs-methods.js /packages/next/dist/server/lib/node-fs-methods.js:18:19 lint TP1004 fs.readFile(???*0*) is very dynamic
14 | default: obj
15 | };
16 | }
17 | const nodeFs = {
+ v
18 + readFile: (f)=>_fs.default.promises.readFile(f),
+ ^
19 | readFileSync: (f)=>_fs.default.readFileSync(f),
20 | writeFile: (f, d)=>_fs.default.promises.writeFile(f, d),
21 | mkdir: (dir)=>_fs.default.promises.mkdir(dir, {
22 | recursive: true
- *0* f
⚠️ pattern without value
\ No newline at end of file
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/issues/lint TP1004 fs.readFileSync(__q____q____q____star_-0b346e.txt
deleted
100644 → 0
View file @
42ad2cef
warning - [parse] [project]/packages/next/dist/server/lib/node-fs-methods.js /packages/next/dist/server/lib/node-fs-methods.js:19:23 lint TP1004 fs.readFileSync(???*0*) is very dynamic
15 | };
16 | }
17 | const nodeFs = {
18 | readFile: (f)=>_fs.default.promises.readFile(f),
+ v
19 + readFileSync: (f)=>_fs.default.readFileSync(f),
+ ^
20 | writeFile: (f, d)=>_fs.default.promises.writeFile(f, d),
21 | mkdir: (dir)=>_fs.default.promises.mkdir(dir, {
22 | recursive: true
23 | }),
- *0* f
⚠️ pattern without value
\ No newline at end of file
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/issues/lint TP1004 fs.readFileSync(__q____q____q____star_-c0b6ea.txt
deleted
100644 → 0
View file @
42ad2cef
warning - [parse] [project]/packages/next/dist/server/lib/node-fs-methods.js /packages/next/dist/server/lib/node-fs-methods.js:19:23 lint TP1004 fs.readFileSync(???*0*) is very dynamic
15 | };
16 | }
17 | const nodeFs = {
18 | readFile: (f)=>_fs.default.promises.readFile(f),
+ v
19 + readFileSync: (f)=>_fs.default.readFileSync(f),
+ ^
20 | writeFile: (f, d)=>_fs.default.promises.writeFile(f, d),
21 | mkdir: (dir)=>_fs.default.promises.mkdir(dir, {
22 | recursive: true
23 | }),
- *0* f
⚠️ pattern without value
\ No newline at end of file
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/issues/lint TP1004 fs.stat(__q____q____q____star__0__star-05f14f.txt
deleted
100644 → 0
View file @
42ad2cef
warning - [parse] [project]/packages/next/dist/server/lib/node-fs-methods.js /packages/next/dist/server/lib/node-fs-methods.js:24:15 lint TP1004 fs.stat(???*0*) is very dynamic
20 | writeFile: (f, d)=>_fs.default.promises.writeFile(f, d),
21 | mkdir: (dir)=>_fs.default.promises.mkdir(dir, {
22 | recursive: true
23 | }),
+ v
24 + stat: (f)=>_fs.default.promises.stat(f)
+ ^
25 | };
26 |
27 | //# sourceMappingURL=node-fs-methods.js.map
- *0* f
⚠️ pattern without value
\ No newline at end of file
packages/next-swc/crates/next-dev-tests/tests/integration/next/polyfill/basic/issues/lint TP1004 fs.stat(__q____q____q____star__0__star-a12dc8.txt
deleted
100644 → 0
View file @
42ad2cef
warning - [parse] [project]/packages/next/dist/server/lib/node-fs-methods.js /packages/next/dist/server/lib/node-fs-methods.js:24:15 lint TP1004 fs.stat(???*0*) is very dynamic
20 | writeFile: (f, d)=>_fs.default.promises.writeFile(f, d),
21 | mkdir: (dir)=>_fs.default.promises.mkdir(dir, {
22 | recursive: true
23 | }),
+ v
24 + stat: (f)=>_fs.default.promises.stat(f)
+ ^
25 | };
26 |
27 | //# sourceMappingURL=node-fs-methods.js.map
- *0* f
⚠️ pattern without value
\ No newline at end of file
test/development/basic/node-builtins/app/layout.js
0 → 100644
View file @
67bc262b
export
const
metadata
=
{
title
:
'Next.js'
,
description
:
'Generated by Next.js'
,
}
export
default
function
RootLayout
({
children
})
{
return
(
<
html
lang
=
"en"
>
<
body
>
{
children
}
<
/body
>
<
/html
>
)
}
test/turbopack-tests-manifest.js
View file @
67bc262b
...
...
@@ -11,6 +11,7 @@ const enabledTests = [
'test/development/basic/emotion-swc.test.ts'
,
'test/development/basic/legacy-decorators.test.ts'
,
'test/development/basic/misc.test.ts'
,
'test/development/basic/node-builtins.test.ts'
,
'test/development/basic/next-rs-api.test.ts'
,
'test/development/basic/tailwind-jit.test.ts'
,
'test/development/basic/theme-ui.test.ts'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment