(task, opts)
| 161 | |
| 162 | externals['@babel/runtime'] = 'next/dist/compiled/@babel/runtime' |
| 163 | export async function copy_babel_runtime(task, opts) { |
| 164 | const runtimeDir = dirname(require.resolve('@babel/runtime/package.json')) |
| 165 | const outputDir = join(__dirname, 'src/compiled/@babel/runtime') |
| 166 | const runtimeFiles = glob.sync('**/*', { |
| 167 | cwd: runtimeDir, |
| 168 | ignore: ['node_modules/**/*'], |
| 169 | }) |
| 170 | |
| 171 | for (const file of runtimeFiles) { |
| 172 | const inputPath = join(runtimeDir, file) |
| 173 | const outputPath = join(outputDir, file) |
| 174 | |
| 175 | if (!(await fs.stat(inputPath)).isFile()) { |
| 176 | continue |
| 177 | } |
| 178 | let contents = await fs.readFile(inputPath, 'utf8') |
| 179 | |
| 180 | if (inputPath.endsWith('.js')) { |
| 181 | contents = contents |
| 182 | .replace( |
| 183 | 'regenerator-runtime', |
| 184 | 'next/dist/compiled/regenerator-runtime' |
| 185 | ) |
| 186 | .replace('@babel/runtime', 'next/dist/compiled/@babel/runtime') |
| 187 | } |
| 188 | |
| 189 | if (inputPath.endsWith('package.json')) { |
| 190 | contents = JSON.stringify({ |
| 191 | ...JSON.parse(contents), |
| 192 | dependencies: {}, |
| 193 | }) |
| 194 | } |
| 195 | |
| 196 | await fs.mkdir(dirname(outputPath), { recursive: true }) |
| 197 | await fs.writeFile(outputPath, contents) |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | externals['@vercel/og'] = 'next/dist/compiled/@vercel/og' |
| 202 | export async function copy_vercel_og(task, opts) { |
nothing calls this directly
no test coverage detected