From fe7ba7a81c9c7c092a55755d663f8a1624c40970 Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Tue, 7 Mar 2023 16:47:19 +0100 Subject: [PATCH 1/8] update app-renderer --- .../next-core/js/src/entry/app-renderer.tsx | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/crates/next-core/js/src/entry/app-renderer.tsx b/crates/next-core/js/src/entry/app-renderer.tsx index 966ed2605be51..94ed78d442b64 100644 --- a/crates/next-core/js/src/entry/app-renderer.tsx +++ b/crates/next-core/js/src/entry/app-renderer.tsx @@ -137,32 +137,25 @@ async function runOperation(renderData: RenderData) { tree = [info.segment, { children: tree }, components]; } - const proxyMethodsForModule = ( - id: string, - css: boolean - ): ProxyHandler => ({ - get(target, name, receiver) { - return { - id, - chunks: JSON.parse(id)[1], - name, - }; - }, - }); - const proxyMethods = (css: boolean): ProxyHandler => { + const proxyMethods = (): ProxyHandler => { return { - get(target, name, receiver) { - if (name === "__ssr_module_mapping__") { + get(target, key) { + if (key === "__ssr_module_mapping__") { return manifest; } - if (name === "__entry_css_files__") { + if (key === "__entry_css_files__") { return __entry_css_files__; } - return new Proxy({}, proxyMethodsForModule(name as string, css)); + const [file, name] = (key as string).split("#"); + return { + id: file, + chunks: JSON.parse(file)[1], + name: name === undefined ? "*" : name, + }; }, }; }; - const manifest: FlightManifest = new Proxy({} as any, proxyMethods(false)); + const manifest: FlightManifest = new Proxy({} as any, proxyMethods()); const serverCSSManifest: FlightCSSManifest = {}; const __entry_css_files__: FlightManifest["__entry_css_files__"] = {}; for (const [key, chunks] of Object.entries(layoutInfoChunks)) { From fcd12860350d377e31448a34407884dd686f63cd Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Tue, 7 Mar 2023 18:19:06 -0500 Subject: [PATCH 2/8] Use rsplit to accommodate hash in filename --- crates/next-core/js/src/entry/app-renderer.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/next-core/js/src/entry/app-renderer.tsx b/crates/next-core/js/src/entry/app-renderer.tsx index 94ed78d442b64..64f2ba5d0e393 100644 --- a/crates/next-core/js/src/entry/app-renderer.tsx +++ b/crates/next-core/js/src/entry/app-renderer.tsx @@ -139,18 +139,25 @@ async function runOperation(renderData: RenderData) { const proxyMethods = (): ProxyHandler => { return { - get(target, key) { + get(_target, key: string) { if (key === "__ssr_module_mapping__") { return manifest; } if (key === "__entry_css_files__") { return __entry_css_files__; } - const [file, name] = (key as string).split("#"); + + // The key is a `${file}#${name}`, but `file` can contain `#` itself. + let pos = key.lastIndexOf("#"); + if (pos === -1) pos = key.length; + + const file = key.slice(0, pos); + const name = key.slice(pos + 1); + return { id: file, chunks: JSON.parse(file)[1], - name: name === undefined ? "*" : name, + name: name || "*", }; }, }; From d5f4ab65e65d91f3080aeafc72689cb6a26e9f66 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Tue, 7 Mar 2023 18:21:40 -0500 Subject: [PATCH 3/8] Update to next@13.2.4-canary.6 --- crates/next-core/js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/next-core/js/package.json b/crates/next-core/js/package.json index 1cad37d1a8ab0..f552142d2101b 100644 --- a/crates/next-core/js/package.json +++ b/crates/next-core/js/package.json @@ -12,7 +12,7 @@ "@vercel/turbopack-runtime": "latest", "anser": "^2.1.1", "css.escape": "^1.5.1", - "next": "13.1.7-canary.30", + "next": "13.2.4-canary.6", "platform": "1.3.6", "react-dom": "^18.2.0", "react": "^18.2.0", From aa040d2875318e32cefd74c62e0568e65eb36bd5 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Tue, 7 Mar 2023 18:22:16 -0500 Subject: [PATCH 4/8] Update pnpm lock --- pnpm-lock.yaml | 92 +++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b100e8bc1fc60..7870b3b88a493 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -134,7 +134,7 @@ importers: anser: ^2.1.1 css.escape: ^1.5.1 find-up: ^6.3.0 - next: 13.1.7-canary.30 + next: 13.2.4-canary.6 platform: 1.3.6 react: ^18.2.0 react-dom: ^18.2.0 @@ -145,7 +145,7 @@ importers: '@vercel/turbopack-runtime': link:../../turbopack-ecmascript/js anser: 2.1.1 css.escape: 1.5.1 - next: 13.1.7-canary.30_biqbaboplfbrettd7655fr4n2y + next: 13.2.4-canary.6_biqbaboplfbrettd7655fr4n2y platform: 1.3.6 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 @@ -1893,8 +1893,8 @@ packages: resolution: {integrity: sha512-urnc6aGE0r34euoenPD6kSdGn+Tzwl+g+m4UaEeLpaPCF2110/rd1WIwR4izqG8hxG6GUBj0R+T0XfFgmyNydg==} dev: true - /@next/env/13.1.7-canary.30: - resolution: {integrity: sha512-j9o0DMVPYSc9Zx9N8bWFoptpWacy6cM7tKjcrdbtodSZ5p7YZnoFQfMx6Nf2cBReM284wUhjerAOPL2U9hws1w==} + /@next/env/13.2.4-canary.6: + resolution: {integrity: sha512-LJ6sSANO6LlO3KU44jIztbFB0+I/fruajv/usXQdB7XIIUrGLD9WrgvNryaxUHivr3UMYYYkDhjDaImndenbCQ==} dev: false /@next/eslint-plugin-next/12.3.1: @@ -1947,8 +1947,8 @@ packages: dev: true optional: true - /@next/swc-android-arm-eabi/13.1.7-canary.30: - resolution: {integrity: sha512-lJhel1+0XLenOgnveGt14HFpIDC3SXzy+EWgYfZU1hjsma/FrVNkYtiDCp33OE9VbCbGBKUS2om8QH1O8vIjRQ==} + /@next/swc-android-arm-eabi/13.2.4-canary.6: + resolution: {integrity: sha512-KzX5/Kfib9tv93XvscxSyxdwNJx5f3USneVONYhexkf0mqQ3Bkp4iD29RIhhbbLmXz1WZLcE+aTQ3fccddBnyQ==} engines: {node: '>= 10'} cpu: [arm] os: [android] @@ -1982,8 +1982,8 @@ packages: dev: true optional: true - /@next/swc-android-arm64/13.1.7-canary.30: - resolution: {integrity: sha512-laeS2L7DK15CB43AWIthoAASKhWULWxFHVm407uo7kAUZHyy0ahRThr2ugsNyqB3q4NLJfxVWUxz760/jyO7Ng==} + /@next/swc-android-arm64/13.2.4-canary.6: + resolution: {integrity: sha512-syKdUPeuRmtIBlYmKXKLyYdmVVvpk/lkRMAxanqWy0PxmT6BWxGEfyFTDSfLvsqmyWOZWD8y2H0u80t+wWAWGA==} engines: {node: '>= 10'} cpu: [arm64] os: [android] @@ -2017,8 +2017,8 @@ packages: dev: true optional: true - /@next/swc-darwin-arm64/13.1.7-canary.30: - resolution: {integrity: sha512-Ghkxdle8TNja+f6RiqeADWGBYV1ylKnDDUpFnJDDW4vkHDYvQ8Am5o34rZA0SLFYipLBJBnNJ8fiahBAelyoyw==} + /@next/swc-darwin-arm64/13.2.4-canary.6: + resolution: {integrity: sha512-82sxT7TrWOY8LAbRWpl4+ngVKbPXLn2HDLUOAYQ/2/9kyHxkd0kY/4PWpHnI+tBd4fgzX0PXrghMW9MRMnmYUg==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -2052,8 +2052,8 @@ packages: dev: true optional: true - /@next/swc-darwin-x64/13.1.7-canary.30: - resolution: {integrity: sha512-rEED9dJT2O1Npth25SQNfPdsgXjbZY3XfStZBCU+hFvn7xh26eyxz2YpOaKPWewbKr78hxJUrt2q4Qv8+CeLXg==} + /@next/swc-darwin-x64/13.2.4-canary.6: + resolution: {integrity: sha512-cfKENPa/PEZpdo34Cz2ycuXvi9z/QPUGsM3kFoim9gK0TNxkbDy9iwEBGiB4001JJlIBjfCnbUiAbc565It6zg==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -2087,8 +2087,8 @@ packages: dev: true optional: true - /@next/swc-freebsd-x64/13.1.7-canary.30: - resolution: {integrity: sha512-BsTyQLWcbLMXoAUgEj1L+/L9SafV3P+8OuG7Jxaw9eqGa8+Tde2DCEt0vpCoAAdTyq/VCfWpnaIRdOUNcjFjwg==} + /@next/swc-freebsd-x64/13.2.4-canary.6: + resolution: {integrity: sha512-CnV7R79bkHWo6SSJds3gvWt5+TnsQWLk/7neiM0FeTzIiLZf/27DS+NEJmaPPWRxO3/OGsNI2D6zCoJHM7NshA==} engines: {node: '>= 10'} cpu: [x64] os: [freebsd] @@ -2122,8 +2122,8 @@ packages: dev: true optional: true - /@next/swc-linux-arm-gnueabihf/13.1.7-canary.30: - resolution: {integrity: sha512-rN63QKfpvJ5uI+6raIGqWA26XuG1+Wp9SjtETrxOPY9jFxpTrJsxL3/QIxIW5NLTSqtA2ImV83NjwCwEcJPyTQ==} + /@next/swc-linux-arm-gnueabihf/13.2.4-canary.6: + resolution: {integrity: sha512-iR2GF5G69pbl2XTNnFKeMwHYARn6GHGuhypIs9cOShxxUhCt9iF6RCyHHItipop4SuSbG4hkVZYPIo2DFsRANg==} engines: {node: '>= 10'} cpu: [arm] os: [linux] @@ -2157,8 +2157,8 @@ packages: dev: true optional: true - /@next/swc-linux-arm64-gnu/13.1.7-canary.30: - resolution: {integrity: sha512-dsqKI25EMu0KmBXGyJiWBMsGm3oW5h+VZ57ZIXwsLsgIaXsgvEny8kY0ndyGKweETuq9RDUpwOvutsuy0QHJDQ==} + /@next/swc-linux-arm64-gnu/13.2.4-canary.6: + resolution: {integrity: sha512-b1a8PQHpe4DD7ovd/bq31n1FkGHBTbKn0qJg1iSV8gbZddDwlczcKFQPMKqNcW6ZLjJlIZ9MmubkW1HL/ACzmA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -2192,8 +2192,8 @@ packages: dev: true optional: true - /@next/swc-linux-arm64-musl/13.1.7-canary.30: - resolution: {integrity: sha512-wpRimC1MEniQ8bJgFgp3psFBnSAdoUKx83j1D8zyMTc5N7Pa50cYa+bgdAaoUT5jPXCSPKRZJgD8kEZmadOQIQ==} + /@next/swc-linux-arm64-musl/13.2.4-canary.6: + resolution: {integrity: sha512-HGIfFPOFuhfAqreGxUniDw7oQbEg8/thcsOxFjYE6CrmsU9uc453rMGZFtfdFVbyFCO6TITCEPDXNiCbIryG1w==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -2227,8 +2227,8 @@ packages: dev: true optional: true - /@next/swc-linux-x64-gnu/13.1.7-canary.30: - resolution: {integrity: sha512-vyUckZ8aJHGrf4nMwaWY89DV8x0CkYhdA8e5fqMsEXkMC8LEE4PSuS3Cl4mj+afRs/8maYr9egwcYq1N4kIaUA==} + /@next/swc-linux-x64-gnu/13.2.4-canary.6: + resolution: {integrity: sha512-7dzH4x9eK2HMX3ExBrlHlxQfGzrgPW7ruDQoe85ad0XKbkjSGjc3YkOahDsnXiK0/whuazliUMvXbRWXy7F6xA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -2262,8 +2262,8 @@ packages: dev: true optional: true - /@next/swc-linux-x64-musl/13.1.7-canary.30: - resolution: {integrity: sha512-WmgZdnj5QJSPG//LOPfsNCfc3EzTnfKB4rAhpk0hC/G7Szmd7fkoVOiihSbCSJlWl3zSSyo+JaGQQUjH7aswvQ==} + /@next/swc-linux-x64-musl/13.2.4-canary.6: + resolution: {integrity: sha512-WkSrHGFn7XueW7hP6KRuzLnFfCrOG2KiIlwE45TKpFEq0OFw/8zr/BCtXLF5LnJOi1G87hk2KQ/Ow+4QMPPj9g==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -2297,8 +2297,8 @@ packages: dev: true optional: true - /@next/swc-win32-arm64-msvc/13.1.7-canary.30: - resolution: {integrity: sha512-CkzUyEEnEFdSZtMoFNXFP2yTtgwQ6Ui8QJgVe+o3UaFsWwKW+jdTibDgwJlt9xjt06EaqMQKGR6lc/W8sEzU9A==} + /@next/swc-win32-arm64-msvc/13.2.4-canary.6: + resolution: {integrity: sha512-SWiZD7QI3jnug1W+v0TrglNJFYUFRnO3QPvH05ILJNr1cbYftTU46HLAt38KvROuQQEEtcfRksXn72m14p1Dhg==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -2332,8 +2332,8 @@ packages: dev: true optional: true - /@next/swc-win32-ia32-msvc/13.1.7-canary.30: - resolution: {integrity: sha512-M7Jzo7TVClWFZ6gAlrBzQhzr/YH/ZDNkNu17VOasMSeBOjIjqUPvlFXkRqbyT2lAdLCb9am32MHtVMyLTc9JoQ==} + /@next/swc-win32-ia32-msvc/13.2.4-canary.6: + resolution: {integrity: sha512-BoaUiTnab0HwD8A83MIJRqF+VNoHAxa+TWZb7rWXyb4SwxcoXMxiIas29zblbmctjV4odlHF9ULSLog+XcJ8Ww==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -2367,8 +2367,8 @@ packages: dev: true optional: true - /@next/swc-win32-x64-msvc/13.1.7-canary.30: - resolution: {integrity: sha512-6nxSJuUNwVOpAlISHhRXWt6EE4QrmZ+KxgTbz9Mh2jYXv+T8EkrMxYQhizwSs5Yu2mhWvYxWgLpvJEZNKGCnVA==} + /@next/swc-win32-x64-msvc/13.2.4-canary.6: + resolution: {integrity: sha512-NSlYeg1hbVnYsIVRgKIqjrkrzfKncnqCrhnLxrN0EuQ2XsRjrBfamcP4dPOvXXwp16XOoyHseW8wIK0ZeZlxdQ==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -9840,8 +9840,8 @@ packages: - babel-plugin-macros dev: true - /next/13.1.7-canary.30_biqbaboplfbrettd7655fr4n2y: - resolution: {integrity: sha512-oN7ib4Yb4KkHYP81SdU4OUkvmWhXFcT7cTgp2gH+5wA1dfz9v1mxXFw4550OMu6gDBJxtn0gn57qrRH8CQ5fBQ==} + /next/13.2.4-canary.6_biqbaboplfbrettd7655fr4n2y: + resolution: {integrity: sha512-FL7nfqaB3E3VidynLAlKJKYa9CbTi36dbCwo65IzI2ZGvnW5u7HNxWV6TGsFJnjKKbP3siSraL9ZhheiL9zQEA==} engines: {node: '>=14.6.0'} hasBin: true peerDependencies: @@ -9861,7 +9861,7 @@ packages: sass: optional: true dependencies: - '@next/env': 13.1.7-canary.30 + '@next/env': 13.2.4-canary.6 '@swc/helpers': 0.4.14 caniuse-lite: 1.0.30001439 postcss: 8.4.14 @@ -9869,19 +9869,19 @@ packages: react-dom: 18.2.0_react@18.2.0 styled-jsx: 5.1.1_react@18.2.0 optionalDependencies: - '@next/swc-android-arm-eabi': 13.1.7-canary.30 - '@next/swc-android-arm64': 13.1.7-canary.30 - '@next/swc-darwin-arm64': 13.1.7-canary.30 - '@next/swc-darwin-x64': 13.1.7-canary.30 - '@next/swc-freebsd-x64': 13.1.7-canary.30 - '@next/swc-linux-arm-gnueabihf': 13.1.7-canary.30 - '@next/swc-linux-arm64-gnu': 13.1.7-canary.30 - '@next/swc-linux-arm64-musl': 13.1.7-canary.30 - '@next/swc-linux-x64-gnu': 13.1.7-canary.30 - '@next/swc-linux-x64-musl': 13.1.7-canary.30 - '@next/swc-win32-arm64-msvc': 13.1.7-canary.30 - '@next/swc-win32-ia32-msvc': 13.1.7-canary.30 - '@next/swc-win32-x64-msvc': 13.1.7-canary.30 + '@next/swc-android-arm-eabi': 13.2.4-canary.6 + '@next/swc-android-arm64': 13.2.4-canary.6 + '@next/swc-darwin-arm64': 13.2.4-canary.6 + '@next/swc-darwin-x64': 13.2.4-canary.6 + '@next/swc-freebsd-x64': 13.2.4-canary.6 + '@next/swc-linux-arm-gnueabihf': 13.2.4-canary.6 + '@next/swc-linux-arm64-gnu': 13.2.4-canary.6 + '@next/swc-linux-arm64-musl': 13.2.4-canary.6 + '@next/swc-linux-x64-gnu': 13.2.4-canary.6 + '@next/swc-linux-x64-musl': 13.2.4-canary.6 + '@next/swc-win32-arm64-msvc': 13.2.4-canary.6 + '@next/swc-win32-ia32-msvc': 13.2.4-canary.6 + '@next/swc-win32-x64-msvc': 13.2.4-canary.6 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros From 9428ea7de8b284955a7d2789944c0367a939e632 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Tue, 7 Mar 2023 22:28:32 -0500 Subject: [PATCH 5/8] Fix name parsing, update test deps --- .../next-core/js/src/entry/app-renderer.tsx | 24 ++- crates/next-dev-tests/tests/package.json | 2 +- pnpm-lock.yaml | 181 +++--------------- 3 files changed, 40 insertions(+), 167 deletions(-) diff --git a/crates/next-core/js/src/entry/app-renderer.tsx b/crates/next-core/js/src/entry/app-renderer.tsx index 64f2ba5d0e393..ec135ce31efd0 100644 --- a/crates/next-core/js/src/entry/app-renderer.tsx +++ b/crates/next-core/js/src/entry/app-renderer.tsx @@ -148,16 +148,24 @@ async function runOperation(renderData: RenderData) { } // The key is a `${file}#${name}`, but `file` can contain `#` itself. - let pos = key.lastIndexOf("#"); - if (pos === -1) pos = key.length; - - const file = key.slice(0, pos); - const name = key.slice(pos + 1); + // There are 3 possibilities: + // "file" => id = "file", name = "*" + // "file#" => id = "file", name = "" + // "file#foo" => id = "file", name = "foo" + const pos = key.lastIndexOf("#"); + let id = key; + let name = ""; + if (pos === -1) { + name = "*"; + } else { + id = key.slice(0, pos); + name = key.slice(pos + 1); + } return { - id: file, - chunks: JSON.parse(file)[1], - name: name || "*", + id, + name, + chunks: JSON.parse(id)[1], }; }, }; diff --git a/crates/next-dev-tests/tests/package.json b/crates/next-dev-tests/tests/package.json index d0530c32f9ea3..140a0dca96f02 100644 --- a/crates/next-dev-tests/tests/package.json +++ b/crates/next-dev-tests/tests/package.json @@ -9,7 +9,7 @@ "autoprefixer": "^10.4.13", "babel-loader": "^9.1.2", "loader-runner": "^4.3.0", - "next": "13.1.7-canary.28", + "next": "13.2.4-canary.6", "postcss": "^8.4.20", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7870b3b88a493..bef4e795e7cf3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -179,7 +179,7 @@ importers: autoprefixer: ^10.4.13 babel-loader: ^9.1.2 loader-runner: ^4.3.0 - next: 13.1.7-canary.28 + next: 13.2.4-canary.6 postcss: ^8.4.20 react: ^18.2.0 react-dom: ^18.2.0 @@ -194,7 +194,7 @@ importers: autoprefixer: 10.4.13_postcss@8.4.20 babel-loader: 9.1.2_la66t7xldg4uecmyawueag5wkm loader-runner: 4.3.0 - next: 13.1.7-canary.28_pjwopsidmaokadturxaafygjp4 + next: 13.2.4-canary.6_pjwopsidmaokadturxaafygjp4 postcss: 8.4.20 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 @@ -1889,13 +1889,8 @@ packages: /@next/env/13.0.6: resolution: {integrity: sha512-yceT6DCHKqPRS1cAm8DHvDvK74DLIkDQdm5iV+GnIts8h0QbdHvkUIkdOvQoOODgpr6018skbmSQp12z5OWIQQ==} - /@next/env/13.1.7-canary.28: - resolution: {integrity: sha512-urnc6aGE0r34euoenPD6kSdGn+Tzwl+g+m4UaEeLpaPCF2110/rd1WIwR4izqG8hxG6GUBj0R+T0XfFgmyNydg==} - dev: true - /@next/env/13.2.4-canary.6: resolution: {integrity: sha512-LJ6sSANO6LlO3KU44jIztbFB0+I/fruajv/usXQdB7XIIUrGLD9WrgvNryaxUHivr3UMYYYkDhjDaImndenbCQ==} - dev: false /@next/eslint-plugin-next/12.3.1: resolution: {integrity: sha512-sw+lTf6r6P0j+g/n9y4qdWWI2syPqZx+uc0+B/fRENqfR3KpSid6MIKqc9gNwGhJASazEQ5b3w8h4cAET213jw==} @@ -1938,22 +1933,12 @@ packages: requiresBuild: true optional: true - /@next/swc-android-arm-eabi/13.1.7-canary.28: - resolution: {integrity: sha512-6NfztI8OnbN5dhdIuLxKq6VgMittoEM7Z/RrhwZmaa5jL/qFgX2U0JupkXsP/NT5BAnVK2ZfQwcc7OkLoX6Lww==} - engines: {node: '>= 10'} - cpu: [arm] - os: [android] - requiresBuild: true - dev: true - optional: true - /@next/swc-android-arm-eabi/13.2.4-canary.6: resolution: {integrity: sha512-KzX5/Kfib9tv93XvscxSyxdwNJx5f3USneVONYhexkf0mqQ3Bkp4iD29RIhhbbLmXz1WZLcE+aTQ3fccddBnyQ==} engines: {node: '>= 10'} cpu: [arm] os: [android] requiresBuild: true - dev: false optional: true /@next/swc-android-arm64/13.0.3: @@ -1973,22 +1958,12 @@ packages: requiresBuild: true optional: true - /@next/swc-android-arm64/13.1.7-canary.28: - resolution: {integrity: sha512-LfIt74SQsO2o5oKnS6P+9sFTnJUGW4osGEV3voGnqyKSQKNL/x0JrT9ebntEyf4qELc7UpNaguTdI3xgrAiXEQ==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - /@next/swc-android-arm64/13.2.4-canary.6: resolution: {integrity: sha512-syKdUPeuRmtIBlYmKXKLyYdmVVvpk/lkRMAxanqWy0PxmT6BWxGEfyFTDSfLvsqmyWOZWD8y2H0u80t+wWAWGA==} engines: {node: '>= 10'} cpu: [arm64] os: [android] requiresBuild: true - dev: false optional: true /@next/swc-darwin-arm64/13.0.3: @@ -2008,22 +1983,12 @@ packages: requiresBuild: true optional: true - /@next/swc-darwin-arm64/13.1.7-canary.28: - resolution: {integrity: sha512-BCwhRUHiamB/ktOusnS0re4W373o4HurQPvGM1k5YRekeHDWeawGGrEktCFJCjxNTMzu+VfFCxXJIMm/JhTUgg==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - /@next/swc-darwin-arm64/13.2.4-canary.6: resolution: {integrity: sha512-82sxT7TrWOY8LAbRWpl4+ngVKbPXLn2HDLUOAYQ/2/9kyHxkd0kY/4PWpHnI+tBd4fgzX0PXrghMW9MRMnmYUg==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] requiresBuild: true - dev: false optional: true /@next/swc-darwin-x64/13.0.3: @@ -2043,22 +2008,12 @@ packages: requiresBuild: true optional: true - /@next/swc-darwin-x64/13.1.7-canary.28: - resolution: {integrity: sha512-girCRXjOgbJtuiP9V7IKSrFcYHFAcBldt5d4YPEbLtLuo1q56WHHPbGvYWWetaLbKmSvMxxUQDmEHkEcqWZgNA==} - engines: {node: '>= 10'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - /@next/swc-darwin-x64/13.2.4-canary.6: resolution: {integrity: sha512-cfKENPa/PEZpdo34Cz2ycuXvi9z/QPUGsM3kFoim9gK0TNxkbDy9iwEBGiB4001JJlIBjfCnbUiAbc565It6zg==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] requiresBuild: true - dev: false optional: true /@next/swc-freebsd-x64/13.0.3: @@ -2078,22 +2033,12 @@ packages: requiresBuild: true optional: true - /@next/swc-freebsd-x64/13.1.7-canary.28: - resolution: {integrity: sha512-JhH+Pgu5Vx3h0/P9IB+z0shpP2T08SGu29IQIWicAuliz684mrott3i7QiFuer3FzHCY8fxuJQNKD2/cn4sgoA==} - engines: {node: '>= 10'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - /@next/swc-freebsd-x64/13.2.4-canary.6: resolution: {integrity: sha512-CnV7R79bkHWo6SSJds3gvWt5+TnsQWLk/7neiM0FeTzIiLZf/27DS+NEJmaPPWRxO3/OGsNI2D6zCoJHM7NshA==} engines: {node: '>= 10'} cpu: [x64] os: [freebsd] requiresBuild: true - dev: false optional: true /@next/swc-linux-arm-gnueabihf/13.0.3: @@ -2113,22 +2058,12 @@ packages: requiresBuild: true optional: true - /@next/swc-linux-arm-gnueabihf/13.1.7-canary.28: - resolution: {integrity: sha512-mFD8pdgb3iNjQ+4614h6ZJwqFj4sDms1mi9BZ3AZ+MZy5vqBgiq8KF933RoiIcZMoKRt5gziD0vX/pY7LyeLxA==} - engines: {node: '>= 10'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@next/swc-linux-arm-gnueabihf/13.2.4-canary.6: resolution: {integrity: sha512-iR2GF5G69pbl2XTNnFKeMwHYARn6GHGuhypIs9cOShxxUhCt9iF6RCyHHItipop4SuSbG4hkVZYPIo2DFsRANg==} engines: {node: '>= 10'} cpu: [arm] os: [linux] requiresBuild: true - dev: false optional: true /@next/swc-linux-arm64-gnu/13.0.3: @@ -2148,22 +2083,12 @@ packages: requiresBuild: true optional: true - /@next/swc-linux-arm64-gnu/13.1.7-canary.28: - resolution: {integrity: sha512-2rB5eBfOBFlWWJd9pFG79d5mjz8370XwtXxkbIUqaukNVA8COYYMTrm0D5tiCGBvRgEZXpNHCMxQMif5e7AhSA==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@next/swc-linux-arm64-gnu/13.2.4-canary.6: resolution: {integrity: sha512-b1a8PQHpe4DD7ovd/bq31n1FkGHBTbKn0qJg1iSV8gbZddDwlczcKFQPMKqNcW6ZLjJlIZ9MmubkW1HL/ACzmA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] requiresBuild: true - dev: false optional: true /@next/swc-linux-arm64-musl/13.0.3: @@ -2183,22 +2108,12 @@ packages: requiresBuild: true optional: true - /@next/swc-linux-arm64-musl/13.1.7-canary.28: - resolution: {integrity: sha512-9qls07LNqiUgGMbFi861X9aMw7GNNJaWtUEl3NR1tncAftxCWKSwDV2Ju/a2+Ts2Mts6awpi8pBNDfZrVYNAKg==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@next/swc-linux-arm64-musl/13.2.4-canary.6: resolution: {integrity: sha512-HGIfFPOFuhfAqreGxUniDw7oQbEg8/thcsOxFjYE6CrmsU9uc453rMGZFtfdFVbyFCO6TITCEPDXNiCbIryG1w==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] requiresBuild: true - dev: false optional: true /@next/swc-linux-x64-gnu/13.0.3: @@ -2218,22 +2133,12 @@ packages: requiresBuild: true optional: true - /@next/swc-linux-x64-gnu/13.1.7-canary.28: - resolution: {integrity: sha512-/HqW+OmTwJ28QpPCXGjgFsWYPJdpwGq5/vcTITQJaWIWRJN7dkpLraGZ8U0VQYOlbu25b0aKqHZ3r7Uf/TM7NQ==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@next/swc-linux-x64-gnu/13.2.4-canary.6: resolution: {integrity: sha512-7dzH4x9eK2HMX3ExBrlHlxQfGzrgPW7ruDQoe85ad0XKbkjSGjc3YkOahDsnXiK0/whuazliUMvXbRWXy7F6xA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] requiresBuild: true - dev: false optional: true /@next/swc-linux-x64-musl/13.0.3: @@ -2253,22 +2158,12 @@ packages: requiresBuild: true optional: true - /@next/swc-linux-x64-musl/13.1.7-canary.28: - resolution: {integrity: sha512-+wa7Q6OBHLumMghMVWXoxZPXibWm9cyJaF3eqjMg8W3HLkZbEciBp4ZihnjpQPNMLnUBtGLup3AabxbnwPyzVg==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@next/swc-linux-x64-musl/13.2.4-canary.6: resolution: {integrity: sha512-WkSrHGFn7XueW7hP6KRuzLnFfCrOG2KiIlwE45TKpFEq0OFw/8zr/BCtXLF5LnJOi1G87hk2KQ/Ow+4QMPPj9g==} engines: {node: '>= 10'} cpu: [x64] os: [linux] requiresBuild: true - dev: false optional: true /@next/swc-win32-arm64-msvc/13.0.3: @@ -2288,22 +2183,12 @@ packages: requiresBuild: true optional: true - /@next/swc-win32-arm64-msvc/13.1.7-canary.28: - resolution: {integrity: sha512-pmQnhZgUaulYnInujnVQ8tuLYapEPpWwPAoXoBgAcaMgSve7Wa2zvGv1EyMzDSeWnozDcIULkKff0KlQVPockA==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@next/swc-win32-arm64-msvc/13.2.4-canary.6: resolution: {integrity: sha512-SWiZD7QI3jnug1W+v0TrglNJFYUFRnO3QPvH05ILJNr1cbYftTU46HLAt38KvROuQQEEtcfRksXn72m14p1Dhg==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] requiresBuild: true - dev: false optional: true /@next/swc-win32-ia32-msvc/13.0.3: @@ -2323,22 +2208,12 @@ packages: requiresBuild: true optional: true - /@next/swc-win32-ia32-msvc/13.1.7-canary.28: - resolution: {integrity: sha512-n2m67mHeJYQRZxZXyZaiLbISMesfLIEHwppvhjPwEGJeYu4rFqAa9Fd7zTpcoNn3uSZjYjGtoTRwjyqtn5caHg==} - engines: {node: '>= 10'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@next/swc-win32-ia32-msvc/13.2.4-canary.6: resolution: {integrity: sha512-BoaUiTnab0HwD8A83MIJRqF+VNoHAxa+TWZb7rWXyb4SwxcoXMxiIas29zblbmctjV4odlHF9ULSLog+XcJ8Ww==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] requiresBuild: true - dev: false optional: true /@next/swc-win32-x64-msvc/13.0.3: @@ -2358,22 +2233,12 @@ packages: requiresBuild: true optional: true - /@next/swc-win32-x64-msvc/13.1.7-canary.28: - resolution: {integrity: sha512-sGfbSG1wwzp4v2KRSTIfGtYMY4qJOoS59JzfWBNbLIvsfi3o2/W+41eNBfvlubGlp4CNX9+JBvDNu3qaeFI6AA==} - engines: {node: '>= 10'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@next/swc-win32-x64-msvc/13.2.4-canary.6: resolution: {integrity: sha512-NSlYeg1hbVnYsIVRgKIqjrkrzfKncnqCrhnLxrN0EuQ2XsRjrBfamcP4dPOvXXwp16XOoyHseW8wIK0ZeZlxdQ==} engines: {node: '>= 10'} cpu: [x64] os: [win32] requiresBuild: true - dev: false optional: true /@nodelib/fs.scandir/2.1.5: @@ -9793,8 +9658,8 @@ packages: - '@babel/core' - babel-plugin-macros - /next/13.1.7-canary.28_pjwopsidmaokadturxaafygjp4: - resolution: {integrity: sha512-z8CrJmzkNVb7+DN9r8vbjnEbY15GS1xEoVPwROJk+A8VYvbLzDKy5bPAHD8Llbzl51UQ4LUiGHWW+hQ8yVlxuw==} + /next/13.2.4-canary.6_biqbaboplfbrettd7655fr4n2y: + resolution: {integrity: sha512-FL7nfqaB3E3VidynLAlKJKYa9CbTi36dbCwo65IzI2ZGvnW5u7HNxWV6TGsFJnjKKbP3siSraL9ZhheiL9zQEA==} engines: {node: '>=14.6.0'} hasBin: true peerDependencies: @@ -9814,33 +9679,33 @@ packages: sass: optional: true dependencies: - '@next/env': 13.1.7-canary.28 + '@next/env': 13.2.4-canary.6 '@swc/helpers': 0.4.14 caniuse-lite: 1.0.30001439 postcss: 8.4.14 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 - styled-jsx: 5.1.1_2exiyaescjxorpwwmy4ejghgte + styled-jsx: 5.1.1_react@18.2.0 optionalDependencies: - '@next/swc-android-arm-eabi': 13.1.7-canary.28 - '@next/swc-android-arm64': 13.1.7-canary.28 - '@next/swc-darwin-arm64': 13.1.7-canary.28 - '@next/swc-darwin-x64': 13.1.7-canary.28 - '@next/swc-freebsd-x64': 13.1.7-canary.28 - '@next/swc-linux-arm-gnueabihf': 13.1.7-canary.28 - '@next/swc-linux-arm64-gnu': 13.1.7-canary.28 - '@next/swc-linux-arm64-musl': 13.1.7-canary.28 - '@next/swc-linux-x64-gnu': 13.1.7-canary.28 - '@next/swc-linux-x64-musl': 13.1.7-canary.28 - '@next/swc-win32-arm64-msvc': 13.1.7-canary.28 - '@next/swc-win32-ia32-msvc': 13.1.7-canary.28 - '@next/swc-win32-x64-msvc': 13.1.7-canary.28 + '@next/swc-android-arm-eabi': 13.2.4-canary.6 + '@next/swc-android-arm64': 13.2.4-canary.6 + '@next/swc-darwin-arm64': 13.2.4-canary.6 + '@next/swc-darwin-x64': 13.2.4-canary.6 + '@next/swc-freebsd-x64': 13.2.4-canary.6 + '@next/swc-linux-arm-gnueabihf': 13.2.4-canary.6 + '@next/swc-linux-arm64-gnu': 13.2.4-canary.6 + '@next/swc-linux-arm64-musl': 13.2.4-canary.6 + '@next/swc-linux-x64-gnu': 13.2.4-canary.6 + '@next/swc-linux-x64-musl': 13.2.4-canary.6 + '@next/swc-win32-arm64-msvc': 13.2.4-canary.6 + '@next/swc-win32-ia32-msvc': 13.2.4-canary.6 + '@next/swc-win32-x64-msvc': 13.2.4-canary.6 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros - dev: true + dev: false - /next/13.2.4-canary.6_biqbaboplfbrettd7655fr4n2y: + /next/13.2.4-canary.6_pjwopsidmaokadturxaafygjp4: resolution: {integrity: sha512-FL7nfqaB3E3VidynLAlKJKYa9CbTi36dbCwo65IzI2ZGvnW5u7HNxWV6TGsFJnjKKbP3siSraL9ZhheiL9zQEA==} engines: {node: '>=14.6.0'} hasBin: true @@ -9867,7 +9732,7 @@ packages: postcss: 8.4.14 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 - styled-jsx: 5.1.1_react@18.2.0 + styled-jsx: 5.1.1_2exiyaescjxorpwwmy4ejghgte optionalDependencies: '@next/swc-android-arm-eabi': 13.2.4-canary.6 '@next/swc-android-arm64': 13.2.4-canary.6 @@ -9885,7 +9750,7 @@ packages: transitivePeerDependencies: - '@babel/core' - babel-plugin-macros - dev: false + dev: true /nextra-theme-docs/2.0.1_ogpkrxaz2lg6nectum6dl66tn4: resolution: {integrity: sha512-vrxSQjfG5hcWXd0foVUgRu1T9rD+dQdVnKzJhpEG+ncAIYTT/o7GajvYUEPPZMYvvZwehmNIUhSTDN9unnVsxw==} From bc3eeeace27452ca9aa61cf63b866987a85991c3 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Tue, 7 Mar 2023 23:10:17 -0500 Subject: [PATCH 6/8] Update snapshots --- .../Issue while running loader-37fd78.txt | 21 +++++++++++++++++++ .../Issue while running loader-75e07a.txt | 21 +++++++++++++++++++ .../Issue while running loader-9bd07c.txt | 21 ------------------- .../Issue while running loader-bb7ea7.txt | 21 ------------------- 4 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-37fd78.txt create mode 100644 crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-75e07a.txt delete mode 100644 crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-9bd07c.txt delete mode 100644 crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-bb7ea7.txt diff --git a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-37fd78.txt b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-37fd78.txt new file mode 100644 index 0000000000000..664465f2e9195 --- /dev/null +++ b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-37fd78.txt @@ -0,0 +1,21 @@ +PlainIssue { + severity: Warning, + context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", + category: "loaders", + title: "Issue while running loader", + description: "Error: Warning!\n at module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:2:20)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at \n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n", + detail: "", + documentation_link: "", + source: None, + sub_issues: [], + processing_path: Some( + [ + PlainIssueProcessingPathItem { + context: Some( + "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js", + ), + description: "Next.js pages directory", + }, + ], + ), +} \ No newline at end of file diff --git a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-75e07a.txt b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-75e07a.txt new file mode 100644 index 0000000000000..08ee99c19cf9d --- /dev/null +++ b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-75e07a.txt @@ -0,0 +1,21 @@ +PlainIssue { + severity: Error, + context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", + category: "loaders", + title: "Issue while running loader", + description: "Error: Error!\n at module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:4:18)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at \n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n", + detail: "", + documentation_link: "", + source: None, + sub_issues: [], + processing_path: Some( + [ + PlainIssueProcessingPathItem { + context: Some( + "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js", + ), + description: "Next.js pages directory", + }, + ], + ), +} \ No newline at end of file diff --git a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-9bd07c.txt b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-9bd07c.txt deleted file mode 100644 index bd8631682017d..0000000000000 --- a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-9bd07c.txt +++ /dev/null @@ -1,21 +0,0 @@ -PlainIssue { - severity: Warning, - context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", - category: "loaders", - title: "Issue while running loader", - description: "Error: Warning!\n at Object.module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:2:20)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at \n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n", - detail: "", - documentation_link: "", - source: None, - sub_issues: [], - processing_path: Some( - [ - PlainIssueProcessingPathItem { - context: Some( - "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js", - ), - description: "Next.js pages directory", - }, - ], - ), -} \ No newline at end of file diff --git a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-bb7ea7.txt b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-bb7ea7.txt deleted file mode 100644 index a3f786e0f9334..0000000000000 --- a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-bb7ea7.txt +++ /dev/null @@ -1,21 +0,0 @@ -PlainIssue { - severity: Error, - context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", - category: "loaders", - title: "Issue while running loader", - description: "Error: Error!\n at Object.module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:4:18)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at \n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n", - detail: "", - documentation_link: "", - source: None, - sub_issues: [], - processing_path: Some( - [ - PlainIssueProcessingPathItem { - context: Some( - "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js", - ), - description: "Next.js pages directory", - }, - ], - ), -} \ No newline at end of file From 72972a835890f2d29cf5ed949356b0f8af638d12 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Tue, 7 Mar 2023 23:58:44 -0500 Subject: [PATCH 7/8] Use Node 16.19.1 to generate snapshots --- .../Issue while running loader-00caad.txt | 21 + .../Issue while running loader-37fd78.txt | 21 - .../Issue while running loader-75e07a.txt | 21 - .../Issue while running loader-c98676.txt | 21 + crates/turbo-tasks-fs/src/async_file.rs | 853 ++++++++++++++++++ 5 files changed, 895 insertions(+), 42 deletions(-) create mode 100644 crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-00caad.txt delete mode 100644 crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-37fd78.txt delete mode 100644 crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-75e07a.txt create mode 100644 crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-c98676.txt create mode 100644 crates/turbo-tasks-fs/src/async_file.rs diff --git a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-00caad.txt b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-00caad.txt new file mode 100644 index 0000000000000..c192a236b6089 --- /dev/null +++ b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-00caad.txt @@ -0,0 +1,21 @@ +PlainIssue { + severity: Error, + context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", + category: "loaders", + title: "Issue while running loader", + description: "Error: Error!\n at Object.module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:4:18)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at \n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n", + detail: "", + documentation_link: "", + source: None, + sub_issues: [], + processing_path: Some( + [ + PlainIssueProcessingPathItem { + context: Some( + "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js", + ), + description: "Next.js pages directory", + }, + ], + ), +} \ No newline at end of file diff --git a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-37fd78.txt b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-37fd78.txt deleted file mode 100644 index 664465f2e9195..0000000000000 --- a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-37fd78.txt +++ /dev/null @@ -1,21 +0,0 @@ -PlainIssue { - severity: Warning, - context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", - category: "loaders", - title: "Issue while running loader", - description: "Error: Warning!\n at module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:2:20)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at \n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n", - detail: "", - documentation_link: "", - source: None, - sub_issues: [], - processing_path: Some( - [ - PlainIssueProcessingPathItem { - context: Some( - "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js", - ), - description: "Next.js pages directory", - }, - ], - ), -} \ No newline at end of file diff --git a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-75e07a.txt b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-75e07a.txt deleted file mode 100644 index 08ee99c19cf9d..0000000000000 --- a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-75e07a.txt +++ /dev/null @@ -1,21 +0,0 @@ -PlainIssue { - severity: Error, - context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", - category: "loaders", - title: "Issue while running loader", - description: "Error: Error!\n at module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:4:18)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at \n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n", - detail: "", - documentation_link: "", - source: None, - sub_issues: [], - processing_path: Some( - [ - PlainIssueProcessingPathItem { - context: Some( - "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js", - ), - description: "Next.js pages directory", - }, - ], - ), -} \ No newline at end of file diff --git a/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-c98676.txt b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-c98676.txt new file mode 100644 index 0000000000000..157ae7a7f7f36 --- /dev/null +++ b/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-c98676.txt @@ -0,0 +1,21 @@ +PlainIssue { + severity: Warning, + context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", + category: "loaders", + title: "Issue while running loader", + description: "Error: Warning!\n at Object.module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:2:20)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at \n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n", + detail: "", + documentation_link: "", + source: None, + sub_issues: [], + processing_path: Some( + [ + PlainIssueProcessingPathItem { + context: Some( + "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js", + ), + description: "Next.js pages directory", + }, + ], + ), +} \ No newline at end of file diff --git a/crates/turbo-tasks-fs/src/async_file.rs b/crates/turbo-tasks-fs/src/async_file.rs new file mode 100644 index 0000000000000..cc24a299f1365 --- /dev/null +++ b/crates/turbo-tasks-fs/src/async_file.rs @@ -0,0 +1,853 @@ +//! Types for working with [`File`]. +//! +//! [`File`]: File + +pub(crate) const MAX_BUF: usize = 2 * 1024 * 1024; + +use std::{ + cmp, fmt, + fs::{File as StdFile, Metadata, Permissions}, + future::Future, + io::{self, Read, Seek, SeekFrom, Write}, + path::Path, + pin::Pin, + sync::Arc, + task::{Context, Poll, Poll::*}, +}; + +use tokio::{ + io::{AsyncRead, AsyncSeek, ReadBuf}, + sync::Mutex, + task::{spawn_blocking, JoinHandle}, +}; + +pub(crate) async fn asyncify(f: F) -> io::Result +where + F: FnOnce() -> io::Result + Send + 'static, + T: Send + 'static, +{ + match spawn_blocking(f).await { + Ok(res) => res, + Err(_) => Err(io::Error::new( + io::ErrorKind::Other, + "background task failed", + )), + } +} + +#[derive(Debug)] +pub(crate) struct Buf { + buf: Vec, + pos: usize, +} + +/// Repeats operations that are interrupted. +macro_rules! uninterruptibly { + ($e:expr) => {{ + loop { + match $e { + Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {} + res => break res, + } + } + }}; +} +macro_rules! ready { + ($e:expr $(,)?) => { + match $e { + std::task::Poll::Ready(t) => t, + std::task::Poll::Pending => return std::task::Poll::Pending, + } + }; +} + +impl Buf { + pub(crate) fn with_capacity(n: usize) -> Buf { + Buf { + buf: Vec::with_capacity(n), + pos: 0, + } + } + + pub(crate) fn is_empty(&self) -> bool { + self.len() == 0 + } + + pub(crate) fn len(&self) -> usize { + self.buf.len() - self.pos + } + + pub(crate) fn copy_to(&mut self, dst: &mut ReadBuf<'_>) -> usize { + let n = cmp::min(self.len(), dst.remaining()); + dst.put_slice(&self.bytes()[..n]); + self.pos += n; + + if self.pos == self.buf.len() { + self.buf.truncate(0); + self.pos = 0; + } + + n + } + + pub(crate) fn copy_from(&mut self, src: &[u8]) -> usize { + assert!(self.is_empty()); + + let n = cmp::min(src.len(), MAX_BUF); + + self.buf.extend_from_slice(&src[..n]); + n + } + + pub(crate) fn bytes(&self) -> &[u8] { + &self.buf[self.pos..] + } + + pub(crate) fn ensure_capacity_for(&mut self, bytes: &ReadBuf<'_>) { + assert!(self.is_empty()); + + let len = cmp::min(bytes.remaining(), MAX_BUF); + + if self.buf.len() < len { + self.buf.reserve(len - self.buf.len()); + } + + unsafe { + self.buf.set_len(len); + } + } + + pub(crate) fn read_from(&mut self, rd: &mut T) -> io::Result { + let res = uninterruptibly!(rd.read(&mut self.buf)); + + if let Ok(n) = res { + self.buf.truncate(n); + } else { + self.buf.clear(); + } + + assert_eq!(self.pos, 0); + + res + } + + pub(crate) fn write_to(&mut self, wr: &mut T) -> io::Result<()> { + assert_eq!(self.pos, 0); + + // `write_all` already ignores interrupts + let res = wr.write_all(&self.buf); + self.buf.clear(); + res + } + + pub(crate) fn discard_read(&mut self) -> i64 { + let ret = -(self.bytes().len() as i64); + self.pos = 0; + self.buf.truncate(0); + ret + } +} + +use self::State::*; + +/// A reference to an open file on the filesystem. +/// +/// This is a specialized version of [`std::fs::File`][std] for usage from the +/// Tokio runtime. +/// +/// An instance of a `File` can be read and/or written depending on what options +/// it was opened with. Files also implement [`AsyncSeek`] to alter the logical +/// cursor that the file contains internally. +/// +/// A file will not be closed immediately when it goes out of scope if there +/// are any IO operations that have not yet completed. To ensure that a file is +/// closed immediately when it is dropped, you should call [`flush`] before +/// dropping it. Note that this does not ensure that the file has been fully +/// written to disk; the operating system might keep the changes around in an +/// in-memory buffer. See the [`sync_all`] method for telling the OS to write +/// the data to disk. +/// +/// Reading and writing to a `File` is usually done using the convenience +/// methods found on the [`AsyncReadExt`] and [`AsyncWriteExt`] traits. +/// +/// [std]: struct@std::fs::File +/// [`AsyncSeek`]: trait@crate::io::AsyncSeek +/// [`flush`]: fn@crate::io::AsyncWriteExt::flush +/// [`sync_all`]: fn@crate::fs::File::sync_all +/// [`AsyncReadExt`]: trait@crate::io::AsyncReadExt +/// [`AsyncWriteExt`]: trait@crate::io::AsyncWriteExt +/// +/// # Examples +/// +/// Create a new file and asynchronously write bytes to it: +/// +/// ```no_run +/// use tokio::fs::File; +/// use tokio::io::AsyncWriteExt; // for write_all() +/// +/// # async fn dox() -> std::io::Result<()> { +/// let mut file = File::create("foo.txt").await?; +/// file.write_all(b"hello, world!").await?; +/// # Ok(()) +/// # } +/// ``` +/// +/// Read the contents of a file into a buffer: +/// +/// ```no_run +/// use tokio::fs::File; +/// use tokio::io::AsyncReadExt; // for read_to_end() +/// +/// # async fn dox() -> std::io::Result<()> { +/// let mut file = File::open("foo.txt").await?; +/// +/// let mut contents = vec![]; +/// file.read_to_end(&mut contents).await?; +/// +/// println!("len = {}", contents.len()); +/// # Ok(()) +/// # } +/// ``` +pub struct File { + std: Arc, + inner: Mutex, +} + +struct Inner { + state: State, + + /// Errors from writes/flushes are returned in write/flush calls. If a write + /// error is observed while performing a read, it is saved until the next + /// write / flush call. + last_write_err: Option, + + pos: u64, +} + +#[derive(Debug)] +enum State { + Idle(Option), + Busy(JoinHandle<(Operation, Buf)>), +} + +#[derive(Debug)] +enum Operation { + Read(io::Result), + Write(io::Result<()>), + Seek(io::Result), +} + +impl File { + /// Attempts to open a file in read-only mode. + /// + /// See [`OpenOptions`] for more details. + /// + /// [`OpenOptions`]: super::OpenOptions + /// + /// # Errors + /// + /// This function will return an error if called from outside of the Tokio + /// runtime or if path does not already exist. Other errors may also be + /// returned according to OpenOptions::open. + /// + /// # Examples + /// + /// ```no_run + /// use tokio::fs::File; + /// use tokio::io::AsyncReadExt; + /// + /// # async fn dox() -> std::io::Result<()> { + /// let mut file = File::open("foo.txt").await?; + /// + /// let mut contents = vec![]; + /// file.read_to_end(&mut contents).await?; + /// + /// println!("len = {}", contents.len()); + /// # Ok(()) + /// # } + /// ``` + /// + /// The [`read_to_end`] method is defined on the [`AsyncReadExt`] trait. + /// + /// [`read_to_end`]: fn@crate::io::AsyncReadExt::read_to_end + /// [`AsyncReadExt`]: trait@crate::io::AsyncReadExt + pub async fn open(path: impl AsRef) -> io::Result { + let path = path.as_ref().to_owned(); + let std = asyncify(|| StdFile::open(path)).await?; + + Ok(File::from_std(std)) + } + + /// Opens a file in write-only mode. + /// + /// This function will create a file if it does not exist, and will truncate + /// it if it does. + /// + /// See [`OpenOptions`] for more details. + /// + /// [`OpenOptions`]: super::OpenOptions + /// + /// # Errors + /// + /// Results in an error if called from outside of the Tokio runtime or if + /// the underlying [`create`] call results in an error. + /// + /// [`create`]: std::fs::File::create + /// + /// # Examples + /// + /// ```no_run + /// use tokio::fs::File; + /// use tokio::io::AsyncWriteExt; + /// + /// # async fn dox() -> std::io::Result<()> { + /// let mut file = File::create("foo.txt").await?; + /// file.write_all(b"hello, world!").await?; + /// # Ok(()) + /// # } + /// ``` + /// + /// The [`write_all`] method is defined on the [`AsyncWriteExt`] trait. + /// + /// [`write_all`]: fn@crate::io::AsyncWriteExt::write_all + /// [`AsyncWriteExt`]: trait@crate::io::AsyncWriteExt + pub async fn create(path: impl AsRef) -> io::Result { + let path = path.as_ref().to_owned(); + let std_file = asyncify(move || StdFile::create(path)).await?; + Ok(File::from_std(std_file)) + } + + /// Converts a [`std::fs::File`][std] to a [`tokio::fs::File`][file]. + /// + /// [std]: std::fs::File + /// [file]: File + /// + /// # Examples + /// + /// ```no_run + /// // This line could block. It is not recommended to do this on the Tokio + /// // runtime. + /// let std_file = std::fs::File::open("foo.txt").unwrap(); + /// let file = tokio::fs::File::from_std(std_file); + /// ``` + pub fn from_std(std: StdFile) -> File { + File { + std: Arc::new(std), + inner: Mutex::new(Inner { + state: State::Idle(Some(Buf::with_capacity(0))), + last_write_err: None, + pos: 0, + }), + } + } + + /// Attempts to sync all OS-internal metadata to disk. + /// + /// This function will attempt to ensure that all in-core data reaches the + /// filesystem before returning. + /// + /// # Examples + /// + /// ```no_run + /// use tokio::fs::File; + /// use tokio::io::AsyncWriteExt; + /// + /// # async fn dox() -> std::io::Result<()> { + /// let mut file = File::create("foo.txt").await?; + /// file.write_all(b"hello, world!").await?; + /// file.sync_all().await?; + /// # Ok(()) + /// # } + /// ``` + /// + /// The [`write_all`] method is defined on the [`AsyncWriteExt`] trait. + /// + /// [`write_all`]: fn@crate::io::AsyncWriteExt::write_all + /// [`AsyncWriteExt`]: trait@crate::io::AsyncWriteExt + pub async fn sync_all(&self) -> io::Result<()> { + let mut inner = self.inner.lock().await; + inner.complete_inflight().await; + + let std = self.std.clone(); + asyncify(move || std.sync_all()).await + } + + /// This function is similar to `sync_all`, except that it may not + /// synchronize file metadata to the filesystem. + /// + /// This is intended for use cases that must synchronize content, but don't + /// need the metadata on disk. The goal of this method is to reduce disk + /// operations. + /// + /// Note that some platforms may simply implement this in terms of + /// `sync_all`. + /// + /// # Examples + /// + /// ```no_run + /// use tokio::fs::File; + /// use tokio::io::AsyncWriteExt; + /// + /// # async fn dox() -> std::io::Result<()> { + /// let mut file = File::create("foo.txt").await?; + /// file.write_all(b"hello, world!").await?; + /// file.sync_data().await?; + /// # Ok(()) + /// # } + /// ``` + /// + /// The [`write_all`] method is defined on the [`AsyncWriteExt`] trait. + /// + /// [`write_all`]: fn@crate::io::AsyncWriteExt::write_all + /// [`AsyncWriteExt`]: trait@crate::io::AsyncWriteExt + pub async fn sync_data(&self) -> io::Result<()> { + let mut inner = self.inner.lock().await; + inner.complete_inflight().await; + + let std = self.std.clone(); + asyncify(move || std.sync_data()).await + } + + /// Truncates or extends the underlying file, updating the size of this file + /// to become size. + /// + /// If the size is less than the current file's size, then the file will be + /// shrunk. If it is greater than the current file's size, then the file + /// will be extended to size and have all of the intermediate data filled in + /// with 0s. + /// + /// # Errors + /// + /// This function will return an error if the file is not opened for + /// writing. + /// + /// # Examples + /// + /// ```no_run + /// use tokio::fs::File; + /// use tokio::io::AsyncWriteExt; + /// + /// # async fn dox() -> std::io::Result<()> { + /// let mut file = File::create("foo.txt").await?; + /// file.write_all(b"hello, world!").await?; + /// file.set_len(10).await?; + /// # Ok(()) + /// # } + /// ``` + /// + /// The [`write_all`] method is defined on the [`AsyncWriteExt`] trait. + /// + /// [`write_all`]: fn@crate::io::AsyncWriteExt::write_all + /// [`AsyncWriteExt`]: trait@crate::io::AsyncWriteExt + pub async fn set_len(&self, size: u64) -> io::Result<()> { + let mut inner = self.inner.lock().await; + inner.complete_inflight().await; + + let mut buf = match inner.state { + Idle(ref mut buf_cell) => buf_cell.take().unwrap(), + _ => unreachable!(), + }; + + let seek = if !buf.is_empty() { + Some(SeekFrom::Current(buf.discard_read())) + } else { + None + }; + + let std = self.std.clone(); + + inner.state = Busy(spawn_blocking(move || { + let res = if let Some(seek) = seek { + (&*std).seek(seek).and_then(|_| std.set_len(size)) + } else { + std.set_len(size) + } + .map(|_| 0); // the value is discarded later + + // Return the result as a seek + (Operation::Seek(res), buf) + })); + + let (op, buf) = match inner.state { + Idle(_) => unreachable!(), + Busy(ref mut rx) => rx.await?, + }; + + inner.state = Idle(Some(buf)); + + match op { + Operation::Seek(res) => res.map(|pos| { + inner.pos = pos; + }), + _ => unreachable!(), + } + } + + /// Queries metadata about the underlying file. + /// + /// # Examples + /// + /// ```no_run + /// use tokio::fs::File; + /// + /// # async fn dox() -> std::io::Result<()> { + /// let file = File::open("foo.txt").await?; + /// let metadata = file.metadata().await?; + /// + /// println!("{:?}", metadata); + /// # Ok(()) + /// # } + /// ``` + pub async fn metadata(&self) -> io::Result { + let std = self.std.clone(); + asyncify(move || std.metadata()).await + } + + /// Creates a new `File` instance that shares the same underlying file + /// handle as the existing `File` instance. Reads, writes, and seeks + /// will affect both File instances simultaneously. + /// + /// # Examples + /// + /// ```no_run + /// use tokio::fs::File; + /// + /// # async fn dox() -> std::io::Result<()> { + /// let file = File::open("foo.txt").await?; + /// let file_clone = file.try_clone().await?; + /// # Ok(()) + /// # } + /// ``` + pub async fn try_clone(&self) -> io::Result { + let std = self.std.clone(); + let std_file = asyncify(move || std.try_clone()).await?; + Ok(File::from_std(std_file)) + } + + /// Destructures `File` into a [`std::fs::File`][std]. This function is + /// async to allow any in-flight operations to complete. + /// + /// Use `File::try_into_std` to attempt conversion immediately. + /// + /// [std]: std::fs::File + /// + /// # Examples + /// + /// ```no_run + /// use tokio::fs::File; + /// + /// # async fn dox() -> std::io::Result<()> { + /// let tokio_file = File::open("foo.txt").await?; + /// let std_file = tokio_file.into_std().await; + /// # Ok(()) + /// # } + /// ``` + pub async fn into_std(mut self) -> StdFile { + self.inner.get_mut().complete_inflight().await; + Arc::try_unwrap(self.std).expect("Arc::try_unwrap failed") + } + + /// Tries to immediately destructure `File` into a [`std::fs::File`][std]. + /// + /// [std]: std::fs::File + /// + /// # Errors + /// + /// This function will return an error containing the file if some + /// operation is in-flight. + /// + /// # Examples + /// + /// ```no_run + /// use tokio::fs::File; + /// + /// # async fn dox() -> std::io::Result<()> { + /// let tokio_file = File::open("foo.txt").await?; + /// let std_file = tokio_file.try_into_std().unwrap(); + /// # Ok(()) + /// # } + /// ``` + pub fn try_into_std(mut self) -> Result { + match Arc::try_unwrap(self.std) { + Ok(file) => Ok(file), + Err(std_file_arc) => { + self.std = std_file_arc; + Err(self) + } + } + } + + /// Changes the permissions on the underlying file. + /// + /// # Platform-specific behavior + /// + /// This function currently corresponds to the `fchmod` function on Unix and + /// the `SetFileInformationByHandle` function on Windows. Note that, this + /// [may change in the future][changes]. + /// + /// [changes]: https://doc.rust-lang.org/std/io/index.html#platform-specific-behavior + /// + /// # Errors + /// + /// This function will return an error if the user lacks permission change + /// attributes on the underlying file. It may also return an error in other + /// os-specific unspecified cases. + /// + /// # Examples + /// + /// ```no_run + /// use tokio::fs::File; + /// + /// # async fn dox() -> std::io::Result<()> { + /// let file = File::open("foo.txt").await?; + /// let mut perms = file.metadata().await?.permissions(); + /// perms.set_readonly(true); + /// file.set_permissions(perms).await?; + /// # Ok(()) + /// # } + /// ``` + pub async fn set_permissions(&self, perm: Permissions) -> io::Result<()> { + let std = self.std.clone(); + asyncify(move || std.set_permissions(perm)).await + } +} + +impl AsyncRead for File { + fn poll_read( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + dst: &mut ReadBuf<'_>, + ) -> Poll> { + let me = self.get_mut(); + let inner = me.inner.get_mut(); + + loop { + match inner.state { + Idle(ref mut buf_cell) => { + let mut buf = buf_cell.take().unwrap(); + + if !buf.is_empty() { + buf.copy_to(dst); + *buf_cell = Some(buf); + return Ready(Ok(())); + } + + buf.ensure_capacity_for(dst); + let std = me.std.clone(); + + inner.state = Busy(spawn_blocking(move || { + let res = buf.read_from(&mut &*std); + (Operation::Read(res), buf) + })); + } + Busy(ref mut rx) => { + let (op, mut buf) = ready!(Pin::new(rx).poll(cx))?; + + match op { + Operation::Read(Ok(_)) => { + buf.copy_to(dst); + inner.state = Idle(Some(buf)); + return Ready(Ok(())); + } + Operation::Read(Err(e)) => { + assert!(buf.is_empty()); + + inner.state = Idle(Some(buf)); + return Ready(Err(e)); + } + Operation::Write(Ok(_)) => { + assert!(buf.is_empty()); + inner.state = Idle(Some(buf)); + continue; + } + Operation::Write(Err(e)) => { + assert!(inner.last_write_err.is_none()); + inner.last_write_err = Some(e.kind()); + inner.state = Idle(Some(buf)); + } + Operation::Seek(result) => { + assert!(buf.is_empty()); + inner.state = Idle(Some(buf)); + if let Ok(pos) = result { + inner.pos = pos; + } + continue; + } + } + } + } + } + } +} + +impl AsyncSeek for File { + fn start_seek(self: Pin<&mut Self>, mut pos: SeekFrom) -> io::Result<()> { + let me = self.get_mut(); + let inner = me.inner.get_mut(); + + match inner.state { + Busy(_) => Err(io::Error::new( + io::ErrorKind::Other, + "other file operation is pending, call poll_complete before start_seek", + )), + Idle(ref mut buf_cell) => { + let mut buf = buf_cell.take().unwrap(); + + // Factor in any unread data from the buf + if !buf.is_empty() { + let n = buf.discard_read(); + + if let SeekFrom::Current(ref mut offset) = pos { + *offset += n; + } + } + + let std = me.std.clone(); + + inner.state = Busy(spawn_blocking(move || { + let res = (&*std).seek(pos); + (Operation::Seek(res), buf) + })); + Ok(()) + } + } + } + + fn poll_complete(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + let inner = self.inner.get_mut(); + + loop { + match inner.state { + Idle(_) => return Poll::Ready(Ok(inner.pos)), + Busy(ref mut rx) => { + let (op, buf) = ready!(Pin::new(rx).poll(cx))?; + inner.state = Idle(Some(buf)); + + match op { + Operation::Read(_) => {} + Operation::Write(Err(e)) => { + assert!(inner.last_write_err.is_none()); + inner.last_write_err = Some(e.kind()); + } + Operation::Write(_) => {} + Operation::Seek(res) => { + if let Ok(pos) = res { + inner.pos = pos; + } + return Ready(res); + } + } + } + } + } + } +} + +impl From for File { + fn from(std: StdFile) -> Self { + Self::from_std(std) + } +} + +impl fmt::Debug for File { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt.debug_struct("tokio::fs::File") + .field("std", &self.std) + .finish() + } +} + +#[cfg(unix)] +impl std::os::unix::io::AsRawFd for File { + fn as_raw_fd(&self) -> std::os::unix::io::RawFd { + self.std.as_raw_fd() + } +} + +#[cfg(unix)] +impl std::os::unix::io::FromRawFd for File { + unsafe fn from_raw_fd(fd: std::os::unix::io::RawFd) -> Self { + StdFile::from_raw_fd(fd).into() + } +} + +#[cfg(windows)] +impl std::os::windows::io::AsRawHandle for File { + fn as_raw_handle(&self) -> std::os::windows::io::RawHandle { + self.std.as_raw_handle() + } +} + +#[cfg(windows)] +impl std::os::windows::io::FromRawHandle for File { + unsafe fn from_raw_handle(handle: std::os::windows::io::RawHandle) -> Self { + StdFile::from_raw_handle(handle).into() + } +} + +pub struct PollFn { + f: F, +} + +/// Creates a new future wrapping around a function returning [`Poll`]. +pub fn poll_fn(f: F) -> PollFn +where + F: FnMut(&mut Context<'_>) -> Poll, +{ + PollFn { f } +} + +impl fmt::Debug for PollFn { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("PollFn").finish() + } +} + +impl Future for PollFn +where + F: FnMut(&mut Context<'_>) -> Poll, +{ + type Output = T; + + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + // Safety: We never construct a `Pin<&mut F>` anywhere, so accessing `f` + // mutably in an unpinned way is sound. + // + // This use of unsafe cannot be replaced with the pin-project macro + // because: + // * If we put `#[pin]` on the field, then it gives us a `Pin<&mut F>`, which + // we can't use to call the closure. + // * If we don't put `#[pin]` on the field, then it makes `PollFn` be + // unconditionally `Unpin`, which we also don't want. + let me = unsafe { Pin::into_inner_unchecked(self) }; + (me.f)(cx) + } +} + +impl Inner { + async fn complete_inflight(&mut self) { + if let Err(e) = poll_fn(|cx| Pin::new(&mut *self).poll_flush(cx)).await { + self.last_write_err = Some(e.kind()); + } + } + + fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll> { + if let Some(e) = self.last_write_err.take() { + return Ready(Err(e.into())); + } + + let (op, buf) = match self.state { + Idle(_) => return Ready(Ok(())), + Busy(ref mut rx) => ready!(Pin::new(rx).poll(cx))?, + }; + + // The buffer is not used here + self.state = Idle(Some(buf)); + + match op { + Operation::Read(_) => Ready(Ok(())), + Operation::Write(res) => Ready(res), + Operation::Seek(_) => Ready(Ok(())), + } + } +} From 55f766e2a09fe52dbf8ba751aa8e90ecbe9f0706 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Wed, 8 Mar 2023 00:26:27 -0500 Subject: [PATCH 8/8] Update benchmark dep --- crates/next-dev/benches/bundlers/turbopack/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/next-dev/benches/bundlers/turbopack/mod.rs b/crates/next-dev/benches/bundlers/turbopack/mod.rs index 2ff754de987f0..a5fd6155d6c9d 100644 --- a/crates/next-dev/benches/bundlers/turbopack/mod.rs +++ b/crates/next-dev/benches/bundlers/turbopack/mod.rs @@ -49,7 +49,7 @@ impl Bundler for Turbopack { npm::install( install_dir, &[ - NpmPackage::new("next", "13.1.7-canary.28"), + NpmPackage::new("next", "13.2.4-canary.6"), // Dependency on this is inserted by swc's preset_env NpmPackage::new("@swc/helpers", "^0.4.11"), ],