Compare commits

..

5 Commits

Author SHA1 Message Date
Rich Harris
e66e3cd7eb -> v0.20.4 2018-09-19 11:11:42 -04:00
Rich Harris
ff415b391b Merge pull request #436 from nsivertsen/devtools
Enable debugging in Chrome and VS Code - fixes #435
2018-09-19 11:09:19 -04:00
Rich Harris
91182ad0a2 Merge pull request #441 from silentworks/bugfix/legacy-manifest
Fix for legacy manifest file
2018-09-19 10:43:50 -04:00
Andrew Smith
467041a3cd Fix for legacy manifest file 2018-09-13 19:45:30 +01:00
Nikolai Sivertsen
520949c5e1 Enable debugging in Chrome and VS Code - fixes 435 2018-09-12 16:55:45 +02:00
5 changed files with 29 additions and 3 deletions

View File

@@ -1,5 +1,10 @@
# sapper changelog
## 0.20.4
* Fix legacy build CSS ([#439](https://github.com/sveltejs/sapper/issues/439))
* Enable debugging in Chrome and VSCode ([#435](https://github.com/sveltejs/sapper/issues/435))
## 0.20.3
* Inject `nonce` attribute if `res.locals.nonce` is present ([#424](https://github.com/sveltejs/sapper/pull/424))

View File

@@ -1,6 +1,6 @@
{
"name": "sapper",
"version": "0.20.3",
"version": "0.20.4",
"description": "Military-grade apps, engineered by Svelte",
"main": "dist/middleware.js",
"bin": {
@@ -74,6 +74,7 @@
"test": "mocha --opts mocha.opts",
"pretest": "npm run build",
"build": "rm -rf dist && rollup -c",
"prepare": "npm run build",
"dev": "rollup -cw",
"prepublishOnly": "npm test",
"update_mime_types": "curl http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types | grep -e \"^[^#]\" > src/middleware/mime-types.md"

View File

@@ -79,7 +79,8 @@ async function execute(emitter: EventEmitter, opts: Opts, dirs: Dirs) {
// TODO duration/warnings
result: client_result
});
client_result.to_json(manifest_data, dirs);
build_info.legacy_assets = client_result.assets;
delete process.env.SAPPER_LEGACY_BUILD;
}

View File

@@ -36,6 +36,8 @@ class Watcher extends EventEmitter {
live: boolean;
hot: boolean;
devtools_port: number;
dev_server: DevServer;
proc: child_process.ChildProcess;
filewatchers: Array<{ close: () => void }>;
@@ -57,6 +59,7 @@ class Watcher extends EventEmitter {
'dev-port': dev_port,
live,
hot,
'devtools-port': devtools_port,
bundler,
webpack = 'webpack',
rollup = 'rollup',
@@ -68,6 +71,7 @@ class Watcher extends EventEmitter {
'dev-port': number,
live: boolean,
hot: boolean,
'devtools-port': number,
bundler?: string,
webpack: string,
rollup: string,
@@ -84,6 +88,8 @@ class Watcher extends EventEmitter {
this.live = live;
this.hot = hot;
this.devtools_port = devtools_port;
this.filewatchers = [];
this.current_build = {
@@ -129,6 +135,9 @@ class Watcher extends EventEmitter {
if (!this.dev_port) this.dev_port = await ports.find(10000);
// Chrome looks for debugging targets on ports 9222 and 9229 by default
if (!this.devtools_port) this.devtools_port = await ports.find(9222);
let manifest_data: ManifestData;
try {
@@ -238,12 +247,21 @@ class Watcher extends EventEmitter {
restart();
}
// we need to give the child process its own DevTools port,
// otherwise Node will try to use the parent's (and fail)
const debugArgRegex = /--inspect(?:-brk|-port)?|--debug-port/;
const execArgv = process.execArgv.slice();
if (execArgv.some((arg: string) => !!arg.match(debugArgRegex))) {
execArgv.push(`--inspect-port=${this.devtools_port}`);
}
this.proc = child_process.fork(`${dest}/server.js`, [], {
cwd: process.cwd(),
env: Object.assign({
PORT: this.port
}, process.env),
stdio: ['ipc']
stdio: ['ipc'],
execArgv
});
this.proc.stdout.on('data', chunk => {

View File

@@ -170,6 +170,7 @@ export default function extract_css(client_result: CompileResult, components: Pa
}
const main = client_result.assets.main;
if (process.env.SAPPER_LEGACY_BUILD) main = `legacy/${main}`;
const entry = fs.readFileSync(`${dirs.dest}/client/${main}`, 'utf-8');
const replacements = new Map();