From c62b35e208684e33777c0ca3d94fef7e110f74c8 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 2 Aug 2024 13:38:47 -0700 Subject: [PATCH 1/3] Fix ncc clearing task --- packages/next/taskfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index 27cea535454f9..60bed027e8ca0 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -2188,7 +2188,7 @@ export async function copy_ncced(task) { export async function ncc(task, opts) { await task - .clear('compiled') + .clear('src/compiled') .parallel( [ 'ncc_node_html_parser', From 5e10dd4ae0a0bb00ae9d4560643a1621bc2578f2 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 2 Aug 2024 13:39:40 -0700 Subject: [PATCH 2/3] update compiled --- .../@mswjs/interceptors/ClientRequest/LICENSE | 9 --------- packages/next/src/compiled/arg/index.js | 1 - packages/next/src/compiled/arg/package.json | 1 - .../next/src/compiled/client-only/error.js | 4 ---- .../next/src/compiled/client-only/index.js | 0 .../src/compiled/client-only/package.json | 19 ------------------- .../next/src/compiled/find-cache-dir/LICENSE | 9 --------- .../next/src/compiled/find-cache-dir/index.js | 1 - .../src/compiled/find-cache-dir/package.json | 1 - .../next/src/compiled/sass-loader/fibers.js | 1 - .../next/src/compiled/server-only/empty.js | 0 .../next/src/compiled/server-only/index.js | 4 ---- .../src/compiled/server-only/package.json | 19 ------------------- 13 files changed, 69 deletions(-) delete mode 100644 packages/next/src/compiled/@mswjs/interceptors/ClientRequest/LICENSE delete mode 100644 packages/next/src/compiled/arg/index.js delete mode 100644 packages/next/src/compiled/arg/package.json delete mode 100644 packages/next/src/compiled/client-only/error.js delete mode 100644 packages/next/src/compiled/client-only/index.js delete mode 100644 packages/next/src/compiled/client-only/package.json delete mode 100644 packages/next/src/compiled/find-cache-dir/LICENSE delete mode 100644 packages/next/src/compiled/find-cache-dir/index.js delete mode 100644 packages/next/src/compiled/find-cache-dir/package.json delete mode 100644 packages/next/src/compiled/sass-loader/fibers.js delete mode 100644 packages/next/src/compiled/server-only/empty.js delete mode 100644 packages/next/src/compiled/server-only/index.js delete mode 100644 packages/next/src/compiled/server-only/package.json diff --git a/packages/next/src/compiled/@mswjs/interceptors/ClientRequest/LICENSE b/packages/next/src/compiled/@mswjs/interceptors/ClientRequest/LICENSE deleted file mode 100644 index e5c461e5fd636..0000000000000 --- a/packages/next/src/compiled/@mswjs/interceptors/ClientRequest/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) 2018–present Artem Zakharchenko - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/next/src/compiled/arg/index.js b/packages/next/src/compiled/arg/index.js deleted file mode 100644 index a2c85f740813c..0000000000000 --- a/packages/next/src/compiled/arg/index.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var e={774:e=>{const r=Symbol("arg flag");function arg(e,{argv:t,permissive:n=false,stopAtPositional:o=false}={}){if(!e){throw new Error("Argument specification object is required")}const i={_:[]};t=t||process.argv.slice(2);const a={};const s={};for(const t of Object.keys(e)){if(!t){throw new TypeError("Argument key cannot be an empty string")}if(t[0]!=="-"){throw new TypeError(`Argument key must start with '-' but found: '${t}'`)}if(t.length===1){throw new TypeError(`Argument key must have a name; singular '-' keys are not allowed: ${t}`)}if(typeof e[t]==="string"){a[t]=e[t];continue}let n=e[t];let o=false;if(Array.isArray(n)&&n.length===1&&typeof n[0]==="function"){const[e]=n;n=(r,t,n=[])=>{n.push(e(r,t,n[n.length-1]));return n};o=e===Boolean||e[r]===true}else if(typeof n==="function"){o=n===Boolean||n[r]===true}else{throw new TypeError(`Type missing or not a function or valid array type: ${t}`)}if(t[1]!=="-"&&t.length>2){throw new TypeError(`Short argument keys (with a single hyphen) must have only one character: ${t}`)}s[t]=[n,o]}for(let e=0,r=t.length;e0){i._=i._.concat(t.slice(e));break}if(r==="--"){i._=i._.concat(t.slice(e+1));break}if(r.length>1&&r[0]==="-"){const o=r[1]==="-"||r.length===2?[r]:r.slice(1).split("").map((e=>`-${e}`));for(let r=0;r1&&t[e+1][0]==="-"){const e=f===c?"":` (alias for ${c})`;throw new Error(`Option requires argument: ${f}${e}`)}i[c]=p(t[e+1],c,i[c]);++e}else{i[c]=p(u,c,i[c])}}}else{i._.push(r)}}return i}arg.flag=e=>{e[r]=true;return e};arg.COUNT=arg.flag(((e,r,t)=>(t||0)+1));e.exports=arg}};var r={};function __nccwpck_require__(t){var n=r[t];if(n!==undefined){return n.exports}var o=r[t]={exports:{}};var i=true;try{e[t](o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete r[t]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(774);module.exports=t})(); \ No newline at end of file diff --git a/packages/next/src/compiled/arg/package.json b/packages/next/src/compiled/arg/package.json deleted file mode 100644 index bcfaddd9d893a..0000000000000 --- a/packages/next/src/compiled/arg/package.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"arg","main":"index.js","author":"Josh Junon ","license":"MIT"} diff --git a/packages/next/src/compiled/client-only/error.js b/packages/next/src/compiled/client-only/error.js deleted file mode 100644 index 2e0083d083ce4..0000000000000 --- a/packages/next/src/compiled/client-only/error.js +++ /dev/null @@ -1,4 +0,0 @@ -throw new Error( - "This module cannot be imported from a Server Component module. " + - "It should only be used from a Client Component." -); diff --git a/packages/next/src/compiled/client-only/index.js b/packages/next/src/compiled/client-only/index.js deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/next/src/compiled/client-only/package.json b/packages/next/src/compiled/client-only/package.json deleted file mode 100644 index 9af6d8dfe9949..0000000000000 --- a/packages/next/src/compiled/client-only/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "client-only", - "description": "This is a marker package to indicate that a module can only be used in Client Components.", - "keywords": [ - "react" - ], - "version": "0.0.1", - "homepage": "https://reactjs.org/", - "bugs": "https://github.com/facebook/react/issues", - "license": "MIT", - "files": ["index.js", "error.js"], - "main": "index.js", - "exports": { - ".": { - "react-server": "./error.js", - "default": "./index.js" - } - } -} diff --git a/packages/next/src/compiled/find-cache-dir/LICENSE b/packages/next/src/compiled/find-cache-dir/LICENSE deleted file mode 100644 index fa7ceba3eb4a9..0000000000000 --- a/packages/next/src/compiled/find-cache-dir/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/next/src/compiled/find-cache-dir/index.js b/packages/next/src/compiled/find-cache-dir/index.js deleted file mode 100644 index 7454171a48000..0000000000000 --- a/packages/next/src/compiled/find-cache-dir/index.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var r={167:(r,e,t)=>{var s=t(17);r.exports=function(r,e){if(e){var t=e.map((function(e){return s.resolve(r,e)}))}else{var t=r}var n=t.slice(1).reduce((function(r,e){if(!e.match(/^([A-Za-z]:)?\/|\\/)){throw new Error("relative path without a basedir")}var t=e.split(/\/+|\\+/);for(var s=0;r[s]===t[s]&&s1?n.join("/"):"/"}},647:(r,e,t)=>{"use strict";const s=t(17);const n=t(147);const o=t(167);const i=t(20);const c=t(940);const{env:a,cwd:u}=process;const isWritable=r=>{try{n.accessSync(r,n.constants.W_OK);return true}catch(r){return false}};function useDirectory(r,e){if(e.create){c.sync(r)}if(e.thunk){return(...e)=>s.join(r,...e)}return r}function getNodeModuleDirectory(r){const e=s.join(r,"node_modules");if(!isWritable(e)&&(n.existsSync(e)||!isWritable(s.join(r)))){return}return e}r.exports=(r={})=>{if(a.CACHE_DIR&&!["true","false","1","0"].includes(a.CACHE_DIR)){return useDirectory(s.join(a.CACHE_DIR,"find-cache-dir"),r)}let{cwd:e=u()}=r;if(r.files){e=o(e,r.files)}e=i.sync(e);if(!e){return}const t=getNodeModuleDirectory(e);if(!t){return undefined}return useDirectory(s.join(e,"node_modules",".cache",r.name),r)}},940:(r,e,t)=>{"use strict";const s=t(147);const n=t(17);const{promisify:o}=t(837);const i=t(849);const c=i.satisfies(process.version,">=10.12.0");const checkPath=r=>{if(process.platform==="win32"){const e=/[<>:"|?*]/.test(r.replace(n.parse(r).root,""));if(e){const e=new Error(`Path contains invalid characters: ${r}`);e.code="EINVAL";throw e}}};const processOptions=r=>{const e={mode:511,fs:s};return{...e,...r}};const permissionError=r=>{const e=new Error(`operation not permitted, mkdir '${r}'`);e.code="EPERM";e.errno=-4048;e.path=r;e.syscall="mkdir";return e};const makeDir=async(r,e)=>{checkPath(r);e=processOptions(e);const t=o(e.fs.mkdir);const i=o(e.fs.stat);if(c&&e.fs.mkdir===s.mkdir){const s=n.resolve(r);await t(s,{mode:e.mode,recursive:true});return s}const make=async r=>{try{await t(r,e.mode);return r}catch(e){if(e.code==="EPERM"){throw e}if(e.code==="ENOENT"){if(n.dirname(r)===r){throw permissionError(r)}if(e.message.includes("null bytes")){throw e}await make(n.dirname(r));return make(r)}try{const e=await i(r);if(!e.isDirectory()){throw new Error("The path is not a directory")}}catch(r){throw e}return r}};return make(n.resolve(r))};r.exports=makeDir;r.exports.sync=(r,e)=>{checkPath(r);e=processOptions(e);if(c&&e.fs.mkdirSync===s.mkdirSync){const t=n.resolve(r);s.mkdirSync(t,{mode:e.mode,recursive:true});return t}const make=r=>{try{e.fs.mkdirSync(r,e.mode)}catch(t){if(t.code==="EPERM"){throw t}if(t.code==="ENOENT"){if(n.dirname(r)===r){throw permissionError(r)}if(t.message.includes("null bytes")){throw t}make(n.dirname(r));return make(r)}try{if(!e.fs.statSync(r).isDirectory()){throw new Error("The path is not a directory")}}catch(r){throw t}}return r};return make(n.resolve(r))}},20:(r,e,t)=>{"use strict";const s=t(17);const n=t(55);const pkgDir=async r=>{const e=await n("package.json",{cwd:r});return e&&s.dirname(e)};r.exports=pkgDir;r.exports["default"]=pkgDir;r.exports.sync=r=>{const e=n.sync("package.json",{cwd:r});return e&&s.dirname(e)}},147:r=>{"use strict";r.exports=require("fs")},55:r=>{"use strict";r.exports=require("next/dist/compiled/find-up")},849:r=>{"use strict";r.exports=require("next/dist/compiled/semver")},17:r=>{"use strict";r.exports=require("path")},837:r=>{"use strict";r.exports=require("util")}};var e={};function __nccwpck_require__(t){var s=e[t];if(s!==undefined){return s.exports}var n=e[t]={exports:{}};var o=true;try{r[t](n,n.exports,__nccwpck_require__);o=false}finally{if(o)delete e[t]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(647);module.exports=t})(); \ No newline at end of file diff --git a/packages/next/src/compiled/find-cache-dir/package.json b/packages/next/src/compiled/find-cache-dir/package.json deleted file mode 100644 index adb51bf07b923..0000000000000 --- a/packages/next/src/compiled/find-cache-dir/package.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"find-cache-dir","main":"index.js","license":"MIT"} diff --git a/packages/next/src/compiled/sass-loader/fibers.js b/packages/next/src/compiled/sass-loader/fibers.js deleted file mode 100644 index 6e6d89ed19dab..0000000000000 --- a/packages/next/src/compiled/sass-loader/fibers.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var e={104:function(e,r,n){"use strict";var s=n(37).platform();var t=n(81).spawnSync;var i=n(147).readdirSync;var o="glibc";var a="musl";var c={encoding:"utf8",env:process.env};if(!t){t=function(){return{status:126,stdout:"",stderr:""}}}function contains(e){return function(r){return r.indexOf(e)!==-1}}function versionFromMuslLdd(e){return e.split(/[\r\n]+/)[1].trim().split(/\s/)[1]}function safeReaddirSync(e){try{return i(e)}catch(e){}return[]}var u="";var d="";var f="";if(s==="linux"){var l=t("getconf",["GNU_LIBC_VERSION"],c);if(l.status===0){u=o;d=l.stdout.trim().split(" ")[1];f="getconf"}else{var p=t("ldd",["--version"],c);if(p.status===0&&p.stdout.indexOf(a)!==-1){u=a;d=versionFromMuslLdd(p.stdout);f="ldd"}else if(p.status===1&&p.stderr.indexOf(a)!==-1){u=a;d=versionFromMuslLdd(p.stderr);f="ldd"}else{var y=safeReaddirSync("/lib");if(y.some(contains("-linux-gnu"))){u=o;f="filesystem"}else if(y.some(contains("libc.musl-"))){u=a;f="filesystem"}else if(y.some(contains("ld-musl-"))){u=a;f="filesystem"}else{var v=safeReaddirSync("/usr/sbin");if(v.some(contains("glibc"))){u=o;f="filesystem"}}}}}var _=u!==""&&u!==o;e.exports={GLIBC:o,MUSL:a,family:u,version:d,method:f,isNonGlibcLinux:_}},276:function(e,r,n){if(process.fiberLib){e.exports=process.fiberLib}else{var s=n(147),t=n(17),i=n(104);Math.random();var o=t.join(__dirname,"bin",process.platform+"-"+process.arch+"-"+process.versions.modules+(process.platform==="linux"?"-"+i.family:""),"fibers");try{process.fiberLib=e.exports=require(o).Fiber}catch(e){console.error("## There is an issue with `node-fibers` ##\n"+"`"+o+".node` is missing.\n\n"+"Try running this to fix the issue: "+process.execPath+" "+__dirname.replace(" ","\\ ")+"/build");console.error(e.stack||e.message||e);throw new Error("Missing binary. See message above.")}setupAsyncHacks(e.exports)}function setupAsyncHacks(e){try{var r=process.binding("async_wrap");var n;if(r.asyncIdStackSize instanceof Function){n=r.asyncIdStackSize}else if(r.constants.kStackLength!==undefined){n=function(e){return function(){return r.async_hook_fields[e]}}(r.constants.kStackLength)}else{throw new Error("Couldn't figure out how to get async stack size")}var s=r.popAsyncContext||r.popAsyncIds;var t=r.pushAsyncContext||r.pushAsyncIds;if(!s||!t){throw new Error("Push/pop do not exist")}var i;if(r.constants.kExecutionAsyncId===undefined){i=r.constants.kCurrentAsyncId}else{i=r.constants.kExecutionAsyncId}var o;if(r.constants.kTriggerAsyncId===undefined){o=r.constants.kCurrentTriggerId}else{o=r.constants.kTriggerAsyncId}var a=r.async_id_fields||r.async_uid_fields;function getAndClearStack(){var e=n();var r=new Array(e);for(;e>0;--e){var t=a[i];r[e-1]={asyncId:t,triggerId:a[o]};s(t)}return r}function restoreStack(e){for(var r=0;r Date: Fri, 2 Aug 2024 13:53:50 -0700 Subject: [PATCH 3/3] fix missing server-only task --- .../next/src/compiled/client-only/error.js | 4 ++++ .../next/src/compiled/client-only/index.js | 0 .../src/compiled/client-only/package.json | 19 +++++++++++++++++++ .../next/src/compiled/server-only/empty.js | 0 .../next/src/compiled/server-only/index.js | 4 ++++ .../src/compiled/server-only/package.json | 19 +++++++++++++++++++ packages/next/taskfile.js | 1 + 7 files changed, 47 insertions(+) create mode 100644 packages/next/src/compiled/client-only/error.js create mode 100644 packages/next/src/compiled/client-only/index.js create mode 100644 packages/next/src/compiled/client-only/package.json create mode 100644 packages/next/src/compiled/server-only/empty.js create mode 100644 packages/next/src/compiled/server-only/index.js create mode 100644 packages/next/src/compiled/server-only/package.json diff --git a/packages/next/src/compiled/client-only/error.js b/packages/next/src/compiled/client-only/error.js new file mode 100644 index 0000000000000..2e0083d083ce4 --- /dev/null +++ b/packages/next/src/compiled/client-only/error.js @@ -0,0 +1,4 @@ +throw new Error( + "This module cannot be imported from a Server Component module. " + + "It should only be used from a Client Component." +); diff --git a/packages/next/src/compiled/client-only/index.js b/packages/next/src/compiled/client-only/index.js new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/packages/next/src/compiled/client-only/package.json b/packages/next/src/compiled/client-only/package.json new file mode 100644 index 0000000000000..9af6d8dfe9949 --- /dev/null +++ b/packages/next/src/compiled/client-only/package.json @@ -0,0 +1,19 @@ +{ + "name": "client-only", + "description": "This is a marker package to indicate that a module can only be used in Client Components.", + "keywords": [ + "react" + ], + "version": "0.0.1", + "homepage": "https://reactjs.org/", + "bugs": "https://github.com/facebook/react/issues", + "license": "MIT", + "files": ["index.js", "error.js"], + "main": "index.js", + "exports": { + ".": { + "react-server": "./error.js", + "default": "./index.js" + } + } +} diff --git a/packages/next/src/compiled/server-only/empty.js b/packages/next/src/compiled/server-only/empty.js new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/packages/next/src/compiled/server-only/index.js b/packages/next/src/compiled/server-only/index.js new file mode 100644 index 0000000000000..e480b5cf2285a --- /dev/null +++ b/packages/next/src/compiled/server-only/index.js @@ -0,0 +1,4 @@ +throw new Error( + "This module cannot be imported from a Client Component module. " + + "It should only be used from a Server Component." +); diff --git a/packages/next/src/compiled/server-only/package.json b/packages/next/src/compiled/server-only/package.json new file mode 100644 index 0000000000000..edeb4f256bff8 --- /dev/null +++ b/packages/next/src/compiled/server-only/package.json @@ -0,0 +1,19 @@ +{ + "name": "server-only", + "description": "This is a marker package to indicate that a module can only be used in Server Components.", + "keywords": [ + "react" + ], + "version": "0.0.1", + "homepage": "https://reactjs.org/", + "bugs": "https://github.com/facebook/react/issues", + "license": "MIT", + "files": ["index.js", "empty.js"], + "main": "index.js", + "exports": { + ".": { + "react-server": "./empty.js", + "default": "./index.js" + } + } +} diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index 60bed027e8ca0..fb7fcef9bc584 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -2323,6 +2323,7 @@ export async function ncc(task, opts) { 'ncc_edge_runtime_ponyfill', 'ncc_edge_runtime', 'ncc_mswjs_interceptors', + 'ncc_rsc_poison_packages', ], opts )