Skip to content

Commit

Permalink
apply code style to generated types
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Apr 19, 2023
1 parent c529e2d commit 163fd91
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/next-swc/crates/next-core/js/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const packages = [
{
name: 'css.escape',
type: 'cjs',
types: 'export = CSS.escape;',
types: 'export = CSS.escape',
},
{
name: 'platform',
Expand Down Expand Up @@ -134,17 +134,17 @@ async function main() {

await writePackageManifest(pkg.name, 'index.js')

types += `\ndeclare module "@vercel/turbopack-next/compiled/${pkg.name}" {\n`
types += `\ndeclare module '@vercel/turbopack-next/compiled/${pkg.name}' {\n`
if (pkg.types) {
types += ` ${pkg.types}\n`
} else if (pkg.type === 'module-default') {
types += ` import m from "${pkg.name}";\n`
types += ` export default m;\n`
types += ` import m from '${pkg.name}'\n`
types += ` export default m\n`
} else if (pkg.type === 'module') {
types += ` export * from "${pkg.name}";\n`
types += ` export * from '${pkg.name}'\n`
} else if (pkg.type === 'cjs') {
types += ` import m from "${pkg.name}";\n`
types += ` export = m;\n`
types += ` import m from '${pkg.name}'\n`
types += ` export = m\n`
} else {
throw new Error(`unknown package type ${pkg.type} for ${pkg.name}`)
}
Expand Down

0 comments on commit 163fd91

Please sign in to comment.