-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
3,166 additions
and
2,179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const ssr = require('./dist/gatsby-ssr') | ||
|
||
exports.onRenderBody = ssr.onRenderBody |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,63 @@ | ||
import typescript from 'rollup-plugin-typescript2' | ||
import json from '@rollup/plugin-json' | ||
import typescript from '@rollup/plugin-typescript' | ||
|
||
import pkg from './package.json' | ||
|
||
const makeExternalPredicate = externalArr => { | ||
const makeExternalPredicate = (externalArr) => { | ||
if (externalArr.length === 0) { | ||
return () => false | ||
} | ||
const pattern = new RegExp(`^(${externalArr.join('|')})($|/)`) | ||
return id => pattern.test(id) | ||
return (id) => pattern.test(id) | ||
} | ||
|
||
const externalPkgs = makeExternalPredicate([ | ||
...Object.keys(pkg.dependencies || {}), | ||
...Object.keys(pkg.peerDependencies || {}), | ||
...Object.keys(pkg.devDependencies || {}), | ||
'fs', | ||
'path', | ||
]) | ||
|
||
export default [ | ||
{ | ||
input: 'src/index.ts', | ||
output: [ | ||
{ file: 'dist/index.cjs.js', format: 'cjs', sourcemap: true }, | ||
{ file: 'dist/index.esm.js', format: 'es', sourcemap: true }, | ||
output: { | ||
dir: './', | ||
entryFileNames: 'dist/index.cjs.js', | ||
format: 'cjs', | ||
sourcemap: true, | ||
}, | ||
external: externalPkgs, | ||
plugins: [ | ||
typescript({ | ||
declaration: true, | ||
declarationDir: 'dist/types', | ||
rootDir: 'src', | ||
}), | ||
], | ||
}, | ||
{ | ||
input: 'src/index.ts', | ||
output: { file: 'dist/index.esm.js', format: 'es', sourcemap: true }, | ||
external: externalPkgs, | ||
plugins: [typescript(), json()], | ||
plugins: [typescript()], | ||
}, | ||
{ | ||
input: 'src/gatsby-node.ts', | ||
output: { file: 'dist/gatsby-node.js', format: 'cjs', sourcemap: true }, | ||
external: externalPkgs, | ||
plugins: [typescript(), json()], | ||
plugins: [typescript()], | ||
}, | ||
{ | ||
input: 'src/gatsby-browser.ts', | ||
output: { file: 'dist/gatsby-browser.js', format: 'cjs', sourcemap: true }, | ||
external: externalPkgs, | ||
plugins: [typescript(), json()], | ||
plugins: [typescript()], | ||
}, | ||
{ | ||
input: 'src/gatsby-ssr.ts', | ||
output: { file: 'dist/gatsby-ssr.js', format: 'cjs', sourcemap: true }, | ||
external: externalPkgs, | ||
plugins: [typescript()], | ||
}, | ||
] |
Oops, something went wrong.