From d4ad5fec9104c32066242e3abcea495198588a2c Mon Sep 17 00:00:00 2001 From: Fatme Date: Thu, 18 Apr 2019 17:04:15 +0300 Subject: [PATCH 1/5] release: cut the 0.21.1 release (#869) --- CHANGELOG.md | 13 +++++++++++++ package.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c52998fa..5af59993 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ + +## [0.21.1](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.21.0...0.21.1) (2019-04-18) + + +### Bug Fixes + +* add support for ts files on test command when `--bundle` is provided ([#848](https://github.com/NativeScript/nativescript-dev-webpack/issues/848)) ([bd4fa9c](https://github.com/NativeScript/nativescript-dev-webpack/commit/bd4fa9c)) +* fix "ERROR in Must have a source file to refactor." error from ngCompilerPlugin on `test` command ([#859](https://github.com/NativeScript/nativescript-dev-webpack/issues/859)) ([196d977](https://github.com/NativeScript/nativescript-dev-webpack/commit/196d977)) +* typescript source maps are containing javascript code ([#857](https://github.com/NativeScript/nativescript-dev-webpack/issues/857)) ([384bee2](https://github.com/NativeScript/nativescript-dev-webpack/commit/384bee2)) +* use correct slashes on windows ([#851](https://github.com/NativeScript/nativescript-dev-webpack/issues/851)) ([9020c47](https://github.com/NativeScript/nativescript-dev-webpack/commit/9020c47)) + + + # [0.21.0](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.20.3...0.21.0) (2019-03-21) diff --git a/package.json b/package.json index 695e365d..6a0a709d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-dev-webpack", - "version": "0.21.0", + "version": "0.21.1", "main": "index", "description": "", "homepage": "http://www.telerik.com", From c8afe9fcef4698eabe474a2ed6faac80039ae7f9 Mon Sep 17 00:00:00 2001 From: Fatme Date: Fri, 19 Apr 2019 12:19:37 +0300 Subject: [PATCH 2/5] fix: add support for executing unit tests for vue projects (#839) (#870) --- templates/webpack.vue.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/templates/webpack.vue.js b/templates/webpack.vue.js index 3ed688de..3361cc3d 100644 --- a/templates/webpack.vue.js +++ b/templates/webpack.vue.js @@ -253,6 +253,21 @@ module.exports = env => { ], }; + if (unitTesting) { + config.module.rules.push( + { + test: /-page\.js$/, + use: "nativescript-dev-webpack/script-hot-loader" + }, + { + test: /\.(html|xml)$/, + use: "nativescript-dev-webpack/markup-hot-loader" + }, + + { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"} + ); + } + // Copy the native app resources to the out dir // only if doing a full build (tns run/build) and not previewing (tns preview) if (!externals || externals.length === 0) { From ff226b2389b8d4697d77862b0804425e9e82f4df Mon Sep 17 00:00:00 2001 From: Fatme Date: Tue, 23 Apr 2019 09:34:52 +0300 Subject: [PATCH 3/5] release: cut the 0.21.2 release (#871) --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5af59993..845a7224 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [0.21.2](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.21.0...0.21.2) (2019-04-22) + + +### Bug Fixes + +* add support for executing unit tests for vue projects ([#870](https://github.com/NativeScript/nativescript-dev-webpack/issues/870)) ([c8afe9f](https://github.com/NativeScript/nativescript-dev-webpack/commit/c8afe9f)) + + + ## [0.21.1](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.21.0...0.21.1) (2019-04-18) diff --git a/package.json b/package.json index 6a0a709d..cf938de4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-dev-webpack", - "version": "0.21.1", + "version": "0.21.2", "main": "index", "description": "", "homepage": "http://www.telerik.com", From be82ab7a267d6c8a0ab879fe289115eeae73f8f0 Mon Sep 17 00:00:00 2001 From: DimitarTachev Date: Tue, 23 Apr 2019 11:20:34 +0300 Subject: [PATCH 4/5] fix: ignore the Webpack runtime chunks when sending HMR updates --- lib/compiler.js | 2 +- lib/utils.js | 6 +++++- plugins/WatchStateLoggerPlugin.ts | 24 +++++++++++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 588edc5d..6398436c 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -80,7 +80,7 @@ exports.runWebpackCompiler = function runWebpackCompiler(config, $projectData, $ return; } - const result = getUpdatedEmittedFiles(message.emittedFiles); + const result = getUpdatedEmittedFiles(message.emittedFiles, message.webpackRuntimeFiles); if (hookArgs.hmrData) { hookArgs.hmrData[platform] = { diff --git a/lib/utils.js b/lib/utils.js index 5bb0dea2..b5341c52 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -34,7 +34,7 @@ function buildEnvData($projectData, platform, env) { * if yes this is a HMR update and remove all bundle files as we don't need them to be synced, * but only the update chunks */ -function getUpdatedEmittedFiles(emittedFiles) { +function getUpdatedEmittedFiles(emittedFiles, webpackRuntimeFiles) { let fallbackFiles = []; let hotHash; if (emittedFiles.some(x => x.endsWith('.hot-update.json'))) { @@ -45,6 +45,10 @@ function getUpdatedEmittedFiles(emittedFiles) { hotHash = hash; // remove bundle/vendor.js files if there's a bundle.XXX.hot-update.js or vendor.XXX.hot-update.js result = result.filter(file => file !== `${name}.js`); + if (webpackRuntimeFiles && webpackRuntimeFiles.length) { + // remove files containing only the Webpack runtime (e.g. runtime.js) + result = result.filter(file => webpackRuntimeFiles.indexOf(file) === -1); + } }); //if applying of hot update fails, we must fallback to the full files fallbackFiles = emittedFiles.filter(file => result.indexOf(file) === -1); diff --git a/plugins/WatchStateLoggerPlugin.ts b/plugins/WatchStateLoggerPlugin.ts index 565407c1..0a8229c5 100644 --- a/plugins/WatchStateLoggerPlugin.ts +++ b/plugins/WatchStateLoggerPlugin.ts @@ -31,6 +31,7 @@ export class WatchStateLoggerPlugin { console.log(messages.compilationComplete); } + const runtimeOnlyFiles = getWebpackRuntimeOnlyFiles(compilation, compiler); let emittedFiles = Object .keys(compilation.assets) .filter(assetKey => compilation.assets[assetKey].emitted); @@ -42,7 +43,28 @@ export class WatchStateLoggerPlugin { process.send && process.send(messages.compilationComplete, error => null); // Send emitted files so they can be LiveSynced if need be - process.send && process.send({ emittedFiles: emittedFilesFakePaths }, error => null); + process.send && process.send({ emittedFiles: emittedFilesFakePaths, webpackRuntimeFiles: runtimeOnlyFiles }, error => null); }); } } + +function getWebpackRuntimeOnlyFiles(compilation, compiler) { + let runtimeOnlyFiles = []; + try { + runtimeOnlyFiles = [].concat(...compilation.chunkGroups + // get the chunk group of each entry points (e.g. main.js and inspector-modules.js) + .map(chunkGroup => chunkGroup.runtimeChunk) + // filter embedded runtime chunks (e.g. part of bundle.js or inspector-modules.js) + .filter(runtimeChunk => runtimeChunk.preventIntegration) + .map(runtimeChunk => runtimeChunk.files)) + // get only the unique files in case of "single" runtime (e.g. runtime.js) + .filter((value, index, self) => self.indexOf(value) === index) + // convert to absolute paths + .map(fileName => join(compiler.context, fileName)); + } catch (e) { + // breaking change in the Webpack API + console.log("Warning: Unable to find Webpack runtime files."); + } + + return runtimeOnlyFiles; +} From e9b52b64be37d6eaa4c6a5c375a5d438596ef1e9 Mon Sep 17 00:00:00 2001 From: Stanimira Vlaeva Date: Thu, 25 Apr 2019 09:00:22 +0300 Subject: [PATCH 5/5] chore: apply PR suggestions --- plugins/WatchStateLoggerPlugin.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/WatchStateLoggerPlugin.ts b/plugins/WatchStateLoggerPlugin.ts index 0a8229c5..55cbb8ba 100644 --- a/plugins/WatchStateLoggerPlugin.ts +++ b/plugins/WatchStateLoggerPlugin.ts @@ -31,7 +31,7 @@ export class WatchStateLoggerPlugin { console.log(messages.compilationComplete); } - const runtimeOnlyFiles = getWebpackRuntimeOnlyFiles(compilation, compiler); + const runtimeOnlyFiles = getWebpackRuntimeOnlyFiles(compilation, compiler.context); let emittedFiles = Object .keys(compilation.assets) .filter(assetKey => compilation.assets[assetKey].emitted); @@ -48,19 +48,18 @@ export class WatchStateLoggerPlugin { } } -function getWebpackRuntimeOnlyFiles(compilation, compiler) { +function getWebpackRuntimeOnlyFiles(compilation, basePath) { let runtimeOnlyFiles = []; try { - runtimeOnlyFiles = [].concat(...compilation.chunkGroups - // get the chunk group of each entry points (e.g. main.js and inspector-modules.js) - .map(chunkGroup => chunkGroup.runtimeChunk) + runtimeOnlyFiles = [].concat(...Array.from(compilation.entrypoints.values()) + .map(entrypoint => entrypoint.runtimeChunk) // filter embedded runtime chunks (e.g. part of bundle.js or inspector-modules.js) - .filter(runtimeChunk => runtimeChunk.preventIntegration) + .filter(runtimeChunk => !!runtimeChunk && runtimeChunk.preventIntegration) .map(runtimeChunk => runtimeChunk.files)) // get only the unique files in case of "single" runtime (e.g. runtime.js) .filter((value, index, self) => self.indexOf(value) === index) // convert to absolute paths - .map(fileName => join(compiler.context, fileName)); + .map(fileName => join(basePath, fileName)); } catch (e) { // breaking change in the Webpack API console.log("Warning: Unable to find Webpack runtime files.");