WIP fixing minifiers

This commit is contained in:
Slava Kim
2015-07-13 15:58:53 -07:00
parent 4163ceb544
commit 8900a8abfd
5 changed files with 29 additions and 11 deletions

View File

@@ -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: [] },

View File

@@ -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

View File

@@ -4,3 +4,4 @@
# but you can also edit it by hand.
meteor-platform
standard-minifiers

View File

@@ -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);

View File

@@ -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 +