Compare commits

...

9 Commits

Author SHA1 Message Date
Rich Harris
4071acf7c0 -> v0.22.4 2018-10-01 15:53:40 -04:00
Rich Harris
e8773d3196 Merge pull request #455 from sveltejs/deconflict-server
put server assets in subfolder
2018-10-01 15:52:14 -04:00
Rich Harris
01a519a4d9 fix everything i just broke 2018-10-01 15:47:01 -04:00
Rich Harris
d9ad1d1b10 put server assets in subfolder 2018-10-01 15:21:35 -04:00
Rich Harris
0826a58995 -> v0.22.3 2018-10-01 12:13:52 -04:00
Rich Harris
6a74097b0c ensure dev client is not imported if server imports client.js 2018-10-01 12:13:03 -04:00
Rich Harris
278be67228 -> v0.22.2 2018-09-30 22:06:19 -04:00
Rich Harris
64921dfc3c make directories relative to project 2018-09-30 22:05:55 -04:00
Rich Harris
c8962ccf8c update gitignore 2018-09-30 21:12:46 -04:00
10 changed files with 34 additions and 14 deletions

3
.gitignore vendored
View File

@@ -11,4 +11,5 @@ test/app/build
sapper
runtime.js
dist
!rollup.config.js
!rollup.config.js
templates/*.js

View File

@@ -1,5 +1,17 @@
# sapper changelog
## 0.22.4
* Ensure launcher does not overwrite a module ([#455](https://github.com/sveltejs/sapper/pull/455))
## 0.22.3
* Prevent server from accidentally importing dev client
## 0.22.2
* Make paths in generated code relative to project
## 0.22.1
* Fix `pkg.files`

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "sapper",
"version": "0.21.1",
"version": "0.22.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "sapper",
"version": "0.22.1",
"version": "0.22.4",
"description": "Military-grade apps, engineered by Svelte",
"bin": {
"sapper": "./sapper"

View File

@@ -71,7 +71,7 @@ async function execute(emitter: EventEmitter, opts: Opts) {
message: `Crawling ${root.href}`
});
const proc = child_process.fork(path.resolve(`${opts.build}/server.js`), [], {
const proc = child_process.fork(path.resolve(`${opts.build}/server/server.js`), [], {
cwd: process.cwd(),
env: Object.assign({
PORT: port,

View File

@@ -58,7 +58,7 @@ prog.command('build [dest]')
process.env.PORT = process.env.PORT || ${opts.port || 3000};
console.log('Starting server on port ' + process.env.PORT);
require('./server.js');
require('./server/server.js');
`.replace(/^\t+/gm, '').trim());
console.error(`\n> Finished in ${elapsed(start)}. Type ${colors.bold.cyan(`node ${dest}`)} to run the app.`);

View File

@@ -127,9 +127,11 @@ function generate_client(
footer = `
import(${stringify(sapper_dev_client)}).then(client => {
client.connect(${dev_port});
});`.replace(/^\t{3}/gm, '');
if (typeof window !== 'undefined') {
import(${stringify(sapper_dev_client)}).then(client => {
client.connect(${dev_port});
});
}`.replace(/^\t{3}/gm, '');
}
return `// This file is generated by Sapper — do not edit it!\n` + template
@@ -204,9 +206,12 @@ function generate_server(
error
};`.replace(/^\t\t/gm, '').trim();
const build_dir = path.relative(process.cwd(), locations.dest());
const src_dir = path.relative(process.cwd(), locations.src());
return `// This file is generated by Sapper — do not edit it!\n` + template
.replace('__BUILD__DIR__', JSON.stringify(locations.dest()))
.replace('__SRC__DIR__', JSON.stringify(locations.src()))
.replace('__BUILD__DIR__', JSON.stringify(build_dir))
.replace('__SRC__DIR__', JSON.stringify(src_dir))
.replace('__DEV__', dev() ? 'true' : 'false')
.replace(/const manifest = __MANIFEST__;/, code);
}

View File

@@ -24,12 +24,14 @@ export default {
server: {
input: () => {
return `${locations.src()}/server.js`
return {
server: `${locations.src()}/server.js`
};
},
output: () => {
return {
dir: locations.dest(),
dir: `${locations.dest()}/server`,
format: 'cjs',
sourcemap: dev()
};

View File

@@ -29,7 +29,7 @@ export default {
output: () => {
return {
path: locations.dest(),
path: `${locations.dest()}/server`,
filename: '[name].js',
chunkFilename: '[hash]/[name].[id].js',
libraryTarget: 'commonjs2'

View File

@@ -184,7 +184,7 @@ function run({ mode, basepath = '' }) {
assert.ok(fs.existsSync('__sapper__/build/index.js'));
}
proc = require('child_process').fork(`${dir}/server.js`, {
proc = require('child_process').fork(`${dir}/server/server.js`, {
cwd: process.cwd(),
env: {
NODE_ENV: mode,