mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-13 11:35:28 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7188ce0d0d | ||
|
|
4f8ce19fe1 | ||
|
|
a85f2921e8 | ||
|
|
7a2ed16884 | ||
|
|
08e575fee0 | ||
|
|
7dbcab74d3 |
@@ -1,5 +1,9 @@
|
||||
# sapper changelog
|
||||
|
||||
## 0.6.4
|
||||
|
||||
* Prevent phantom HMR requests in production mode ([#114](https://github.com/sveltejs/sapper/pull/114))
|
||||
|
||||
## 0.6.3
|
||||
|
||||
* Ignore non-HTML responses when crawling during `export`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sapper",
|
||||
"version": "0.6.3",
|
||||
"version": "0.6.4",
|
||||
"description": "Military-grade apps, engineered by Svelte",
|
||||
"main": "middleware.js",
|
||||
"bin": {
|
||||
|
||||
108
rollup.config.js
108
rollup.config.js
@@ -11,91 +11,27 @@ const paths = {
|
||||
'sapper/core.js': './core.js'
|
||||
};
|
||||
|
||||
const plugins = [
|
||||
typescript({
|
||||
typescript: require('typescript')
|
||||
})
|
||||
];
|
||||
|
||||
export default [
|
||||
// cli.js
|
||||
{
|
||||
input: 'src/cli/index.ts',
|
||||
output: {
|
||||
file: 'cli.js',
|
||||
format: 'cjs',
|
||||
banner: '#!/usr/bin/env node',
|
||||
paths,
|
||||
sourcemap: true
|
||||
},
|
||||
external,
|
||||
plugins: [
|
||||
typescript({
|
||||
typescript: require('typescript')
|
||||
})
|
||||
]
|
||||
{ name: 'cli', banner: true },
|
||||
{ name: 'core', banner: true },
|
||||
{ name: 'middleware' },
|
||||
{ name: 'runtime', format: 'es' },
|
||||
{ name: 'webpack', file: 'webpack/config' }
|
||||
].map(obj => ({
|
||||
input: `src/${obj.name}/index.ts`,
|
||||
output: {
|
||||
file: `${obj.file || obj.name}.js`,
|
||||
format: obj.format || 'cjs',
|
||||
banner: obj.banner && '#!/usr/bin/env node',
|
||||
paths,
|
||||
sourcemap: true
|
||||
},
|
||||
|
||||
// core.js
|
||||
{
|
||||
input: 'src/core/index.ts',
|
||||
output: {
|
||||
file: 'core.js',
|
||||
format: 'cjs',
|
||||
banner: '#!/usr/bin/env node',
|
||||
paths,
|
||||
sourcemap: true
|
||||
},
|
||||
external,
|
||||
plugins: [
|
||||
typescript({
|
||||
typescript: require('typescript')
|
||||
})
|
||||
]
|
||||
},
|
||||
|
||||
// middleware.js
|
||||
{
|
||||
input: 'src/middleware/index.ts',
|
||||
output: {
|
||||
file: 'middleware.js',
|
||||
format: 'cjs',
|
||||
paths,
|
||||
sourcemap: true
|
||||
},
|
||||
external,
|
||||
plugins: [
|
||||
typescript({
|
||||
typescript: require('typescript')
|
||||
})
|
||||
]
|
||||
},
|
||||
|
||||
// runtime.js
|
||||
{
|
||||
input: 'src/runtime/index.ts',
|
||||
output: {
|
||||
file: 'runtime.js',
|
||||
format: 'es',
|
||||
paths,
|
||||
sourcemap: true
|
||||
},
|
||||
external,
|
||||
plugins: [
|
||||
typescript({
|
||||
typescript: require('typescript')
|
||||
})
|
||||
]
|
||||
},
|
||||
|
||||
// webpack/config.js
|
||||
{
|
||||
input: 'src/webpack/index.ts',
|
||||
output: {
|
||||
file: 'webpack/config.js',
|
||||
format: 'cjs',
|
||||
paths,
|
||||
sourcemap: true
|
||||
},
|
||||
external,
|
||||
plugins: [
|
||||
typescript({
|
||||
typescript: require('typescript')
|
||||
})
|
||||
]
|
||||
}
|
||||
];
|
||||
external,
|
||||
plugins
|
||||
}));
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { build, export as exporter } from 'sapper/core.js';
|
||||
import { dest, dev, entry, src } from '../config';
|
||||
import { dest, entry, isDev, src } from '../config';
|
||||
|
||||
process.env.NODE_ENV = 'production';
|
||||
|
||||
const cmd = process.argv[2];
|
||||
const start = Date.now();
|
||||
const dev = isDev();
|
||||
|
||||
if (cmd === 'build') {
|
||||
build({ dest, dev, entry, src })
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as path from 'path';
|
||||
|
||||
export const dev = process.env.NODE_ENV !== 'production';
|
||||
export const isDev = () => process.env.NODE_ENV !== 'production';
|
||||
|
||||
export const templates = path.resolve(process.env.SAPPER_TEMPLATES || 'templates');
|
||||
export const src = path.resolve(process.env.SAPPER_ROUTES || 'routes');
|
||||
@@ -9,4 +9,4 @@ export const dest = path.resolve(process.env.SAPPER_DEST || '.sapper');
|
||||
export const entry = {
|
||||
client: path.resolve(templates, '.main.rendered.js'),
|
||||
server: path.resolve(dest, 'server-entry.js')
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,8 +5,10 @@ import rimraf from 'rimraf';
|
||||
import serialize from 'serialize-javascript';
|
||||
import escape_html from 'escape-html';
|
||||
import { create_routes, templates, create_compilers, create_assets } from 'sapper/core.js';
|
||||
import { dest, entry, isDev, src } from '../config';
|
||||
import create_watcher from './create_watcher';
|
||||
import { dest, dev, entry, src } from '../config';
|
||||
|
||||
const dev = isDev();
|
||||
|
||||
function connect_dev() {
|
||||
mkdirp.sync(dest);
|
||||
@@ -123,7 +125,6 @@ function connect_prod() {
|
||||
}
|
||||
|
||||
export default function connect({ dev: _dev = dev } = {}) {
|
||||
console.log({ dev, _dev });
|
||||
return _dev ? connect_dev() : connect_prod();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { dest, dev, entry } from '../config';
|
||||
import { dest, isDev, entry } from '../config';
|
||||
|
||||
export default {
|
||||
dev,
|
||||
dev: isDev(),
|
||||
|
||||
client: {
|
||||
entry: () => {
|
||||
|
||||
Reference in New Issue
Block a user