Merge branch 'devel' into batch-plugins

Fix conflicts and continue elimination of startsWith/endsWith
This commit is contained in:
David Glasser
2015-07-16 12:52:21 -07:00
9 changed files with 15 additions and 37 deletions

View File

@@ -2,7 +2,6 @@ import {WatchSet, readAndWatchFile, sha1} from './watch.js';
import files from './files.js';
import NpmDiscards from './npm-discards.js';
import {Profile} from './profile.js';
import {startsWith} from './utils.js';
const ENABLE_IN_PLACE_BUILDER_REPLACEMENT =
! process.env.METEOR_DISABLE_BUILDER_IN_PLACE;
@@ -549,7 +548,7 @@ Previous builder: ${previousBuilder.outputPath}, this builder: ${outputPath}`
// mark all sub-paths as removed, too
paths.forEach((anotherPath) => {
if (startsWith(anotherPath, path + '/')) {
if (anotherPath.startsWith(path + '/')) {
removed[anotherPath] = true;
}
});

View File

@@ -64,16 +64,11 @@ var formatAsList = function (list, options) {
return _.map(list, formatter).join(", ");
};
var endsWith = function (s, suffix) {
return s.length >= suffix.length &&
s.substr(s.length - suffix.length) === suffix;
};
var removeIfEndsWith = function (s, suffix) {
if (!endsWith(s, suffix)) {
return s;
if (s.endsWith(suffix)) {
return s.substring(0, s.length - suffix.length);
}
return s.substring(0, s.length - suffix.length);
return s;
};
var formatArchitecture = function (s) {

View File

@@ -15,7 +15,6 @@ var linterPluginModule = require('./linter-plugin.js');
var compileStepModule = require('./compiler-deprecated-compile-step.js');
var Profile = require('./profile.js').Profile;
import { SourceProcessorSet } from './build-plugin.js';
import { startsWith } from './utils.js';
var compiler = exports;
@@ -850,7 +849,7 @@ compiler.eachUsedUnibuild = function (
// Note: this code is duplicated in packages/constraint-solver/solver.js
export function isIsobuildFeaturePackage(packageName) {
return startsWith(packageName, 'isobuild:');
return packageName.startsWith('isobuild:');
}
export const KNOWN_ISOBUILD_FEATURE_PACKAGES = {

View File

@@ -13,7 +13,6 @@ var linterPluginModule = require('./linter-plugin.js');
var buildPluginModule = require('./build-plugin.js');
var Console = require('./console.js').Console;
var Profile = require('./profile.js').Profile;
import { endsWith } from './utils.js';
var rejectBadPath = function (p) {
if (p.match(/\.\./))
@@ -606,13 +605,13 @@ _.extend(Isopack.prototype, {
// Don't let extensions or filenames try to look for directories (in the
// way that WatchSet expresses them).
if (extensions && extensions.some(e => endsWith(e, '/'))) {
if (extensions && extensions.some(e => e.endsWith('/'))) {
buildmessage.error(
`Plugin.${methodName}: extensions may not end in /`);
// recover by ignoring
return;
}
if (filenames && filenames.some(f => endsWith(f, '/'))) {
if (filenames && filenames.some(f => f.endsWith('/'))) {
buildmessage.error(
`Plugin.${methodName}: filenames may not end in /`);
// recover by ignoring

View File

@@ -15,11 +15,12 @@ babelRegister(); // #RemoveInProd this line is removed in isopack.js
// run all its callbacks in Fibers.
global.Promise = require("meteor-promise");
// Globally install ES2015-complaint Symbol, Map, and Set, patching the
// native implementations if they are available.
// Install ES2015-complaint polyfills for Symbol, Map, Set, and String,
// patching the native implementations if they are available.
require("core-js/es6/symbol");
require("core-js/es6/map");
require("core-js/es6/set");
require("core-js/es6/string");
// Include helpers from NPM so that the compiler doesn't need to add boilerplate
// at the top of every file

View File

@@ -256,10 +256,6 @@ var print = function (indent, text) {
console.log(prefix + spaces(indent * 2) + text);
};
var startsWith = function (s1, s2) {
return (s1.substr(0, s2.length) === s2);
};
var isChild = function (entry1, entry2) {
return (entry2.length === entry1.length + 1 &&
_.isEqual(entry1, entry2.slice(0, entry1.length)));

View File

@@ -214,8 +214,8 @@ _.extend(exports.Tropohouse.prototype, {
}
var latestMeteorSymlink = self.latestMeteorSymlink();
if (utils.startsWith(latestMeteorSymlink,
packagesDirectoryName + files.pathSep)) {
if (latestMeteorSymlink.startsWith(packagesDirectoryName +
files.pathSep)) {
var rest = latestMeteorSymlink.substr(
packagesDirectoryName.length + files.pathSep.length);
@@ -247,7 +247,7 @@ _.extend(exports.Tropohouse.prototype, {
// it points to.
if (packageEscaped === latestToolPackageEscaped &&
(version === latestToolVersion ||
utils.startsWith(version, '.' + latestToolVersion + '.'))) {
version.startsWith('.' + latestToolVersion + '.'))) {
return;
}
@@ -255,7 +255,7 @@ _.extend(exports.Tropohouse.prototype, {
// operation).
if (packageEscaped === currentToolPackageEscaped &&
(version === currentToolVersion ||
utils.startsWith(version, '.' + currentToolVersion + '.'))) {
version.startsWith('.' + currentToolVersion + '.'))) {
return;
}

View File

@@ -170,7 +170,7 @@ var updateMeteorToolSymlink = function (printErrors) {
var localLatestReleaseLink = tropohouse.default.latestMeteorSymlink();
if (! utils.startsWith(localLatestReleaseLink, relativeToolPath + files.pathSep)) {
if (! localLatestReleaseLink.startsWith(relativeToolPath + files.pathSep)) {
// The latest release from the catalog is not where the ~/.meteor/meteor
// symlink points to. Let's make sure we have that release on disk,
// and then update the symlink.

View File

@@ -384,17 +384,6 @@ exports.isDirectory = function (dir) {
return stats.isDirectory();
};
// XXX from Underscore.String (http://epeli.github.com/underscore.string/)
exports.startsWith = function(str, starts) {
return str.length >= starts.length &&
str.substring(0, starts.length) === starts;
};
exports.endsWith = function(str, ends) {
return str.length >= ends.length &&
str.substring(str.length - ends.length) === ends;
};
// Options: noPrefix: do not display 'Meteor ' in front of the version number.
exports.displayRelease = function (track, version, options) {
var catalog = require('./catalog.js');