2017-06-25 00:58:21 +02:00
|
|
|
import path from 'path';
|
2017-08-20 17:56:21 +02:00
|
|
|
import resolve from 'rollup-plugin-node-resolve';
|
2017-06-25 00:58:21 +02:00
|
|
|
import commonjs from 'rollup-plugin-commonjs';
|
|
|
|
import json from 'rollup-plugin-json';
|
|
|
|
import typescript from 'rollup-plugin-typescript';
|
|
|
|
import buble from 'rollup-plugin-buble';
|
|
|
|
|
|
|
|
const src = path.resolve('src');
|
|
|
|
|
|
|
|
export default [
|
|
|
|
/* compiler/svelte.js */
|
|
|
|
{
|
2017-08-20 17:09:05 +02:00
|
|
|
input: 'src/index.ts',
|
2017-06-25 00:58:21 +02:00
|
|
|
plugins: [
|
|
|
|
{
|
|
|
|
resolveId(importee, importer) {
|
|
|
|
// bit of a hack — TypeScript only really works if it can resolve imports,
|
|
|
|
// but they misguidedly chose to reject imports with file extensions. This
|
|
|
|
// means we need to resolve them here
|
|
|
|
if (
|
|
|
|
importer &&
|
|
|
|
importer.startsWith(src) &&
|
|
|
|
importee[0] === '.' &&
|
|
|
|
path.extname(importee) === ''
|
|
|
|
) {
|
|
|
|
return path.resolve(path.dirname(importer), `${importee}.ts`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2017-08-20 17:56:21 +02:00
|
|
|
resolve(),
|
2017-06-25 00:58:21 +02:00
|
|
|
commonjs(),
|
|
|
|
json(),
|
|
|
|
typescript({
|
|
|
|
include: 'src/**',
|
|
|
|
exclude: 'src/shared/**',
|
|
|
|
typescript: require('typescript')
|
|
|
|
})
|
|
|
|
],
|
2017-08-20 17:09:05 +02:00
|
|
|
output: {
|
|
|
|
file: 'compiler/svelte.js',
|
|
|
|
format: 'umd',
|
|
|
|
name: 'svelte',
|
|
|
|
sourcemap: true
|
|
|
|
}
|
2017-06-25 00:58:21 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
/* ssr/register.js */
|
|
|
|
{
|
2017-08-20 17:09:05 +02:00
|
|
|
input: 'src/server-side-rendering/register.js',
|
2017-06-25 00:58:21 +02:00
|
|
|
plugins: [
|
2017-08-20 17:56:21 +02:00
|
|
|
resolve(),
|
2017-06-25 00:58:21 +02:00
|
|
|
commonjs(),
|
|
|
|
buble({
|
|
|
|
include: 'src/**',
|
|
|
|
exclude: 'src/shared/**',
|
|
|
|
target: {
|
|
|
|
node: 4
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
|
|
|
external: [path.resolve('src/index.ts'), 'fs', 'path'],
|
2017-08-20 17:09:05 +02:00
|
|
|
output: {
|
|
|
|
file: 'ssr/register.js',
|
|
|
|
format: 'cjs',
|
|
|
|
paths: {
|
|
|
|
[path.resolve('src/index.ts')]: '../compiler/svelte.js'
|
|
|
|
},
|
|
|
|
sourcemap: true
|
|
|
|
}
|
2017-06-25 00:58:21 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
/* shared.js */
|
|
|
|
{
|
2017-08-20 17:09:05 +02:00
|
|
|
input: 'src/shared/index.js',
|
|
|
|
output: {
|
|
|
|
file: 'shared.js',
|
|
|
|
format: 'es'
|
|
|
|
}
|
2017-06-25 00:58:21 +02:00
|
|
|
}
|
|
|
|
];
|