From 8900a8abfd7605ec7107dcd958fc14afa7540c0f Mon Sep 17 00:00:00 2001 From: Slava Kim Date: Mon, 13 Jul 2015 15:58:53 -0700 Subject: [PATCH] WIP fixing minifiers --- .../standard-minifiers/plugin/minify-css.js | 7 ++++++- tools/minifier-plugin.js | 11 ++++++++++ .../tests/apps/standard-app/.meteor/packages | 1 + tools/tests/run.js | 20 +++++++++---------- tools/warehouse.js | 1 + 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/packages/standard-minifiers/plugin/minify-css.js b/packages/standard-minifiers/plugin/minify-css.js index 336a39a8d7..918acee03a 100644 --- a/packages/standard-minifiers/plugin/minify-css.js +++ b/packages/standard-minifiers/plugin/minify-css.js @@ -51,8 +51,13 @@ var mergeCss = function (css) { var ast = CssTools.parseCss(file.getContentsAsString(), parseOptions); ast.filename = filename; } catch (e) { + // XCXC regexp is incorrect + var match = e.message.match(/^(.*):(\d+):(\d+): (.*)$/gi); + file.error({ - message: e.message + message: match[1], + line: match[2], + column: match[3] }); return { type: "stylesheet", stylesheet: { rules: [] }, diff --git a/tools/minifier-plugin.js b/tools/minifier-plugin.js index 32d0652d37..f1818042fe 100644 --- a/tools/minifier-plugin.js +++ b/tools/minifier-plugin.js @@ -1,3 +1,4 @@ +import buildmessage from './buildmessage.js'; const buildPluginModule = require('./build-plugin.js'); class InputFile extends buildPluginModule.InputFile { @@ -25,6 +26,16 @@ class InputFile extends buildPluginModule.InputFile { return this._arch; } + error({message, sourcePath, line, column, func}) { + const relPath = this.getPathInBundle(); + buildmessage.error(message || ('error minifying ' + relPath), { + file: sourcePath || relPath, + line: line ? line : undefined, + column: column ? column : undefined, + func: func ? func : undefined + }); + } + /** * @summary Returns the path of the compiled file in the bundle. * @memberof InputFile diff --git a/tools/tests/apps/standard-app/.meteor/packages b/tools/tests/apps/standard-app/.meteor/packages index aba458ef9a..603b66571d 100644 --- a/tools/tests/apps/standard-app/.meteor/packages +++ b/tools/tests/apps/standard-app/.meteor/packages @@ -4,3 +4,4 @@ # but you can also edit it by hand. meteor-platform +standard-minifiers diff --git a/tools/tests/run.js b/tools/tests/run.js index b347f3d486..36f5ebf143 100644 --- a/tools/tests/run.js +++ b/tools/tests/run.js @@ -81,16 +81,16 @@ selftest.define("run", function () { run.match("restarted"); // Crash just once, then restart successfully - s.write("crash.js", -"var fs = Npm.require('fs')\n" + -"var path = Npm.require('path')\n" + -"var crashmark = path.join(process.env.METEOR_TEST_TMP, 'crashed');\n" + -"try {\n" + -" fs.readFileSync(crashmark);\n" + -"} catch (e) {\n" + -" fs.writeFileSync(crashmark);\n" + -" process.exit(137);\n" + -"}\n"); + s.write("crash.js", ` +var fs = Npm.require('fs'); +var path = Npm.require('path'); +var crashmark = path.join(process.env.METEOR_TEST_TMP, 'crashed'); +try { + fs.readFileSync(crashmark); +} catch (e) { + fs.writeFileSync(crashmark); + process.exit(137); +}`); run.waitSecs(5); run.match("with code: 137"); run.waitSecs(5); diff --git a/tools/warehouse.js b/tools/warehouse.js index e8b1eea1bf..abc9e3815f 100644 --- a/tools/warehouse.js +++ b/tools/warehouse.js @@ -375,6 +375,7 @@ _.extend(warehouse, { dontWriteFreshFile) { fiberHelpers.parallelEach( packagesToDownload, function (version, name) { + console.log(typeof name, typeof version) var packageDir = files.pathJoin( warehouseDirectory, 'packages', name, version); var packageUrl = WAREHOUSE_URLBASE + "/packages/" + name +