From 71bf3758e1248cb35ceb28823097d28c813418b8 Mon Sep 17 00:00:00 2001 From: NestorTejero Date: Mon, 7 Nov 2016 13:57:09 +0100 Subject: [PATCH 1/4] Fix link to Github issues --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dcb0074..1676a94 100644 --- a/README.md +++ b/README.md @@ -222,5 +222,5 @@ MIT ## Contributing -Please create a [Github issue](issues) if problems occur. Pull request are also welcome +Please create a [Github issue](/../../issues) if problems occur. Pull request are also welcome and they can be created to the `development` branch. From 2000deb99622d5f1f6dc1f1f8615df4b6a74bdbb Mon Sep 17 00:00:00 2001 From: Matti Lankinen Date: Fri, 25 Nov 2016 15:02:40 +0200 Subject: [PATCH 2/4] Re-arrange module compiling and loading codes --- src/browserify-plugin/main.js | 12 +----------- src/reloading.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/browserify-plugin/main.js b/src/browserify-plugin/main.js index a78a931..f986a39 100644 --- a/src/browserify-plugin/main.js +++ b/src/browserify-plugin/main.js @@ -153,8 +153,7 @@ function LiveReactloadPlugin(b, opts = {}) { clientOpts ] let bundleSrc = - `(${loader.toString()})(${args.map(a => JSON.stringify(a, null, 2)).join(", ")}); - ${__livereactload_loadAsModule.toString()};` + `(${loader.toString()})(${args.map(a => JSON.stringify(a, null, 2)).join(", ")});` if (standalone) { bundleSrc = umd(standalone, `return ${bundleSrc}`) } @@ -173,13 +172,4 @@ function LiveReactloadPlugin(b, opts = {}) { } } -function __livereactload_loadAsModule(__livereactload_source, __livereactload_sourcemap) { - return eval( - 'function __livereactload_module(require, module, exports){\n' + - __livereactload_source + - '\n}; __livereactload_module;' + - (__livereactload_sourcemap || '') - ); -} - module.exports = LiveReactloadPlugin diff --git a/src/reloading.js b/src/reloading.js index b501c91..b2380d3 100644 --- a/src/reloading.js +++ b/src/reloading.js @@ -84,12 +84,21 @@ function loader(mappings, entryPoints, options) { var body = mapping[0]; if (typeof body !== "function") { debug("Compiling module", mapping[2]) - var compiled = __livereactload_loadAsModule(body, mapping[2].sourcemap); + var compiled = compileModule(body, mapping[2].sourcemap); mapping[0] = compiled; mapping[2].source = body; } } + function compileModule(source, sourcemap) { + return eval( + "function __livereactload_module(require, module, exports){\n" + + source + + "\n}; __livereactload_module;" + + (sourcemap || "") + ); + } + function unknownUseCase() { throw new Error( "Unknown use-case encountered! Please raise an issue: " + @@ -428,7 +437,6 @@ function loader(mappings, entryPoints, options) { function error(msg) { console.error("LiveReactload ::", msg); } - } module.exports = loader; From 6d41e1e24791aa9719e0e6fe082be596924c7ad6 Mon Sep 17 00:00:00 2001 From: Matti Lankinen Date: Fri, 25 Nov 2016 15:02:49 +0200 Subject: [PATCH 3/4] Fix hash --- src/browserify-plugin/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browserify-plugin/main.js b/src/browserify-plugin/main.js index f986a39..c9566b7 100644 --- a/src/browserify-plugin/main.js +++ b/src/browserify-plugin/main.js @@ -116,7 +116,7 @@ function LiveReactloadPlugin(b, opts = {}) { if (entry) { entries.push(file) } - mappings[file] = [sourceWithoutMaps, deps, {id: file, hash: md5(sourceWithoutMaps), browserifyId: id, sourcemap: adjustedSourcemap}] + mappings[file] = [sourceWithoutMaps, deps, {id: file, hash: hash, browserifyId: id, sourcemap: adjustedSourcemap}] next(null, row) }, function flush(next) { From e3defcbe901a5d0937850ca2bc1b4f98005526e9 Mon Sep 17 00:00:00 2001 From: Matti Lankinen Date: Fri, 25 Nov 2016 15:03:36 +0200 Subject: [PATCH 4/4] Version 3.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a877d43..078973e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "livereactload", - "version": "3.1.0", + "version": "3.1.1", "description": "Live code editing with Browserify and React", "author": "Matti Lankinen (https://github.com/milankinen)", "license": "MIT",