refactor: add license header to JS files & format files (#12035)

This commit is contained in:
Victor Berchet
2016-10-04 13:15:49 -07:00
committed by Chuck Jazdzewski
parent b64b5ece65
commit 8310c91823
73 changed files with 1174 additions and 948 deletions

View File

@ -1,6 +1,11 @@
module.exports = function(gulp, plugins, config) {
return function(done) {
del(config.path, done);
};
};
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
module.exports = function(gulp, plugins, config) {
return function(done) { del(config.path, done); };
};

View File

@ -1,15 +1,24 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
function file2moduleName(filePath) {
return filePath.replace(/\\/g, '/')
// module name should be relative to `modules` and `tools` folder
.replace(/.*\/modules\//, '')
// and 'dist' folder
.replace(/.*\/dist\/js\/dev\/es5\//, '')
// module name should not include `lib`, `web` folders
// as they are wrapper packages for dart
.replace(/\/web\//, '/')
.replace(/\/lib\//, '/')
// module name should not have a suffix
.replace(/\.\w*$/, '');
return filePath
.replace(/\\/g, '/')
// module name should be relative to `modules` and `tools` folder
.replace(/.*\/modules\//, '')
// and 'dist' folder
.replace(/.*\/dist\/js\/dev\/es5\//, '')
// module name should not include `lib`, `web` folders
// as they are wrapper packages for dart
.replace(/\/web\//, '/')
.replace(/\/lib\//, '/')
// module name should not have a suffix
.replace(/\.\w*$/, '');
}
if (typeof module !== 'undefined') {
module.exports = file2moduleName;

View File

@ -1,7 +1,15 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var fs = require('fs');
module.exports = function(licenseFile, outputFile) {
var licenseText = fs.readFileSync(licenseFile);
var license = "/**\n @license\n" + licenseText + "\n */\n";
var license = '/**\n @license\n' + licenseText + '\n */\n';
if (outputFile) {
outputFile = licenseFile + '.wrapped';
fs.writeFileSync(outputFile, license, 'utf8');

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var fs = require('fs');
var path = require('path');
@ -8,8 +16,7 @@ module.exports = function(gulp, plugins, config) {
console.log('creating link', linkDir, sourceDir);
try {
fs.symlinkSync(sourceDir, linkDir, 'dir');
}
catch(e) {
} catch (e) {
var sourceDir = path.join(config.dir, relativeFolder);
console.log('linking failed: trying to hard copy', linkDir, sourceDir);
copyRecursiveSync(sourceDir, linkDir);
@ -35,14 +42,13 @@ module.exports = function(gulp, plugins, config) {
};
};
function copyRecursiveSync (src, dest) {
function copyRecursiveSync(src, dest) {
if (fs.existsSync(src)) {
var stats = fs.statSync(src);
if (stats.isDirectory()) {
fs.mkdirSync(dest);
fs.readdirSync(src).forEach(function(childItemName) {
copyRecursiveSync(path.join(src, childItemName),
path.join(dest, childItemName));
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
});
} else {
fs.writeFileSync(dest, fs.readFileSync(src));

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var kLogsArgument = /^--logs\s*=\s*(.+?)$/;
var kTrimLeft = /^\s+/;
var kTrimRight = /\s+$/;
@ -15,23 +23,18 @@ function findArgvLogs() {
}
function logsToObject(logstr) {
return logstr.
split(',').
reduce(function(obj, key) {
key = camelize(key);
if (key.length > 0) obj[key] = true;
return obj;
}, Object.create(null));
return logstr.split(',').reduce(function(obj, key) {
key = camelize(key);
if (key.length > 0) obj[key] = true;
return obj;
}, Object.create(null));
return logs;
}
function camelize(str) {
return str.
replace(kTrimLeft, '').
replace(kTrimRight, '').
replace(kCamelCase, function(match, c) {
return c ? c.toUpperCase() : "";
});
return str.replace(kTrimLeft, '').replace(kTrimRight, '').replace(kCamelCase, function(match, c) {
return c ? c.toUpperCase() : '';
});
}
function shouldLog(str) {

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// helper script that will read out the url parameters
// and store them in appropriate form fields on the page
(function() {
@ -6,9 +14,9 @@
while (match = regex.exec(search)) {
var name = match[1];
var value = match[2];
var els = document.querySelectorAll('input[name="'+name+'"]');
var els = document.querySelectorAll('input[name="' + name + '"]');
var el;
for (var i=0; i<els.length; i++) {
for (var i = 0; i < els.length; i++) {
el = els[i];
if (el.type === 'radio' || el.type === 'checkbox') {
el.checked = el.value === value;

View File

@ -1,5 +1,12 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var fs = require('fs');
var path = require('path');
var minimatch = require('minimatch');
var path = require('path');
var Q = require('q');
@ -21,10 +28,8 @@ function subDirs(dir) {
function forEachSubDir(dir, callback) {
var dirs = subDirs(dir);
return Q.all(dirs.map(function(subdir) {
return callback(path.join(dir, subdir));
}));
};
return Q.all(dirs.map(function(subdir) { return callback(path.join(dir, subdir)); }));
}
function forEachSubDirSequential(dir, callback) {
var dirs = subDirs(dir);
@ -32,9 +37,7 @@ function forEachSubDirSequential(dir, callback) {
function next(index) {
if (index < dirs.length) {
return callback(path.join(dir, dirs[index])).then(function() {
return next(index+1);
});
return callback(path.join(dir, dirs[index])).then(function() { return next(index + 1); });
} else {
return true;
}
@ -75,6 +78,6 @@ function filterByFile(pathMapping, folder) {
if (match !== undefined) {
return match;
} else {
throw new Error('No entry for folder '+folder+' found in '+JSON.stringify(pathMapping));
throw new Error('No entry for folder ' + folder + ' found in ' + JSON.stringify(pathMapping));
}
}

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var chokidar = require('chokidar');
var runSequence = require('run-sequence');
var path = require('path');
@ -16,9 +24,7 @@ function watch(globs, opts, tasks) {
if (!Array.isArray(tasks)) tasks = [tasks];
tasks = tasks.slice();
tasks.push(tasksDone);
runTasks = function runTaskSequence() {
runSequence.apply(null, tasks);
}
runTasks = function runTaskSequence() { runSequence.apply(null, tasks); };
} else {
var sync = tasks.length === 0;
runTasks = function runCallback() {
@ -42,13 +48,11 @@ function watch(globs, opts, tasks) {
var delay = opts.delay;
if (delay === undefined) delay = 100;
var watcher = chokidar.watch(globs, opts).
on('all', handleEvent).
on('error', function(err) {
throw err;
});
var watcher =
chokidar.watch(globs, opts).on('all', handleEvent).on('error', function(err) { throw err; });
var log = function watchLogger(triggerCount) {
var log =
function watchLogger(triggerCount) {
// Don't report change for initial event
if (!ignoreInitial && !--triggerCount) return;
@ -62,7 +66,7 @@ function watch(globs, opts, tasks) {
function prettyTime() {
var now = new Date();
return now.toLocaleDateString() + " at " + now.toLocaleTimeString();
return now.toLocaleDateString() + ' at ' + now.toLocaleTimeString();
}
}
@ -76,8 +80,8 @@ function watch(globs, opts, tasks) {
close();
};
var eventsRecorded = 0; // Number of events recorded
var timeoutId = null; // If non-null, event capture window is open
var eventsRecorded = 0; // Number of events recorded
var timeoutId = null; // If non-null, event capture window is open
if (!ignoreInitial) {
// synthetic event to kick off the first task run

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var rewire = require('rewire');
describe('watch()', function() {
@ -27,7 +35,7 @@ describe('watch()', function() {
it('should fire callback once for events which occur within `delay` window', function() {
var cb = jasmine.createSpy('callback');
watcher = watch('./$$fake_path/**/*', { delay: 10, log: false }, cb);
watcher = watch('./$$fake_path/**/*', {delay: 10, log: false}, cb);
watcher._emit('add', './$$fake_path/test.txt');
timeout.flush(9);
@ -61,7 +69,7 @@ describe('watch()', function() {
expect(timeout.pending).toBe(1);
}
var watcher = watch('./$$fake_path/**/*', { delay: 10, log: false }, cb);
var watcher = watch('./$$fake_path/**/*', {delay: 10, log: false}, cb);
watcher._emit('change', './$$fake_path/test1.txt');
expect(timeout.pending).toBe(1);
@ -81,7 +89,7 @@ describe('watch()', function() {
done();
}
var watcher = watch('./$$fake_path/**/*', { delay: 10, log: false }, cb);
var watcher = watch('./$$fake_path/**/*', {delay: 10, log: false}, cb);
watcher._emit('change', './$$fake_path/test1.txt');
timeout.flush();
@ -96,7 +104,7 @@ describe('watch()', function() {
it('should cancel pending callback if FSWatcher is closed', function() {
var cb = jasmine.createSpy('callback');
var watcher = watch('./$$fake_path/**/*', { delay: 10, log: false }, cb);
var watcher = watch('./$$fake_path/**/*', {delay: 10, log: false}, cb);
watcher._emit('change', './$$fake_path/test1.txt');
expect(timeout.pending).toBe(1);
@ -119,7 +127,7 @@ describe('watch()', function() {
expect(timeout.pending).toBe(0);
}
var watcher = watch('./$$fake_path/**/*', { delay: 10, log: false }, cb);
var watcher = watch('./$$fake_path/**/*', {delay: 10, log: false}, cb);
watcher._emit('change', './$$fake_path/test1.txt');
timeout.flush(10);
@ -136,21 +144,13 @@ function mockTimeout() {
var now = 0;
return {
mocks: {
setTimeout: mockSetTimeout,
clearTimeout: mockClearTimeout
},
flush: flush,
get pending() { return events.length; }
mocks: {setTimeout: mockSetTimeout, clearTimeout: mockClearTimeout},
flush: flush, get pending() { return events.length; }
};
function mockSetTimeout(fn, delay) {
delay = delay || 0;
events.push({
time: now + delay,
fn: fn,
id: id
});
events.push({time: now + delay, fn: fn, id: id});
events.sort(function(a, b) { return a.time - b.time; });
return id++;
}
@ -165,9 +165,12 @@ function mockTimeout() {
}
function flush(delay) {
if (delay !== undefined) now += delay;
else if (events.length) now = events[events.length - 1].time;
else throw new Error('No timer events registered');
if (delay !== undefined)
now += delay;
else if (events.length)
now = events[events.length - 1].time;
else
throw new Error('No timer events registered');
while (events.length && events[0].time <= now) {
events.shift().fn();

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// this bundle is almost identical to the angular2.umd.js
// the only difference being "testing" exports
exports.core = require('angular2/core');
@ -8,9 +16,7 @@ exports.platform = {
common_dom: require('angular2/platform/common_dom'),
// this is included as compared to the angular2-all.umd.js bundle
testing: {
browser: require('angular2/platform/testing/browser')
}
testing: {browser: require('angular2/platform/testing/browser')}
};
exports.http = require('angular2/http');
exports.router = require('angular2/router');

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
exports.core = require('angular2/core');
exports.common = require('angular2/common');
exports.compiler = require('angular2/compiler');

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var webpack = require('webpack');
/**
@ -8,8 +16,7 @@ var webpack = require('webpack');
* @returns {Function}
*/
function webPackPromiseify(options) {
return new Promise(function (resolve, reject) {
return new Promise(function(resolve, reject) {
webpack(options, function(err, stats) {
var jsonStats = stats.toJson() || {};
@ -29,4 +36,4 @@ function webPackPromiseify(options) {
});
}
module.exports = webPackPromiseify;
module.exports = webPackPromiseify;

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! !!!
!!! This file is special in that it must be able to execute with wrong Node version !!!
@ -16,28 +24,29 @@ var issues = [];
// coarse Node version check
if (+process.version[1] < 5) {
issues.push("Angular 2 build currently requires Node 5+. Use nvm to update your node version.");
issues.push('Angular 2 build currently requires Node 5+. Use nvm to update your node version.');
}
try {
semver = require('semver');
} catch(e) {
issues.push("Looks like you are missing some npm dependencies. Run: npm install");
} catch (e) {
issues.push('Looks like you are missing some npm dependencies. Run: npm install');
}
if (issues.length) {
printWarning(issues);
console.error("Your environment doesn't provide the prerequisite dependencies.\n" +
"Please fix the issues listed above and then rerun the gulp command.\n" +
"Check out https://github.com/angular/angular/blob/master/DEVELOPER.md for more info.");
console.error(
'Your environment doesn\'t provide the prerequisite dependencies.\n' +
'Please fix the issues listed above and then rerun the gulp command.\n' +
'Check out https://github.com/angular/angular/blob/master/DEVELOPER.md for more info.');
process.exit(1);
}
// wrap in try/catch in case someone requires from within that file
try {
checkNodeModules = require('./npm/check-node-modules.js');
} catch(e) {
issues.push("Looks like you are missing some npm dependencies. Run: npm install");
} catch (e) {
issues.push('Looks like you are missing some npm dependencies. Run: npm install');
throw e;
} finally {
// print warnings and move on, the next steps will likely fail, but hey, we warned them.
@ -45,7 +54,6 @@ try {
}
function checkEnvironment(reqs) {
exec('npm --version', function(e, stdout) {
var foundNpmVersion = semver.clean(stdout);
var foundNodeVersion = process.version;
@ -53,17 +61,20 @@ function checkEnvironment(reqs) {
if (!semver.satisfies(foundNodeVersion, reqs.requiredNodeVersion)) {
issues.push('You are running unsupported node version. Found: ' + foundNodeVersion +
' Expected: ' + reqs.requiredNodeVersion + '. Use nvm to update your node version.');
issues.push(
'You are running unsupported node version. Found: ' + foundNodeVersion + ' Expected: ' +
reqs.requiredNodeVersion + '. Use nvm to update your node version.');
}
if (!semver.satisfies(foundNpmVersion, reqs.requiredNpmVersion)) {
issues.push('You are running unsupported npm version. Found: ' + foundNpmVersion +
' Expected: ' + reqs.requiredNpmVersion + '. Run: npm update -g npm');
issues.push(
'You are running unsupported npm version. Found: ' + foundNpmVersion + ' Expected: ' +
reqs.requiredNpmVersion + '. Run: npm update -g npm');
}
if (!checkNodeModules()) {
issues.push('Your node_modules directory is stale or out of sync with npm-shrinkwrap.json. Run: npm install');
issues.push(
'Your node_modules directory is stale or out of sync with npm-shrinkwrap.json. Run: npm install');
}
printWarning(issues);
@ -76,7 +87,7 @@ function printWarning(issues) {
console.warn('');
console.warn('!'.repeat(110));
console.warn('!!! Your environment is not in a good shape. Following issues were found:');
issues.forEach(function(issue) {console.warn('!!! - ' + issue);});
issues.forEach(function(issue) { console.warn('!!! - ' + issue); });
console.warn('!'.repeat(110));
console.warn('');

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Patch Protractor so that it uses ChromeDriver 2.14 instead of 2.15.
*
@ -13,11 +21,11 @@ var path = require('path');
var protractorConfigFile = path.resolve(require.resolve('protractor'), '../../config.json');
var newConfig = {
"webdriverVersions": {
"selenium": "2.45.0",
"chromedriver": "2.14",
"iedriver": "2.45.0"
'webdriverVersions': {
'selenium': '2.45.0',
'chromedriver': '2.14',
'iedriver': '2.45.0',
}
}
};
fs.writeFile(protractorConfigFile, JSON.stringify(newConfig));
fs.writeFile(protractorConfigFile, JSON.stringify(newConfig));

View File

@ -1,4 +1,11 @@
#! /usr/bin/env node
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* TODO: remove this file when license is included in RxJS bundles.
@ -17,22 +24,19 @@ ${license}
**/
`;
var bundles = fs.readdirSync(args['build-path'])
// Match files that begin with Rx and end with js
.filter(bundle => /^Rx\.?.*\.js$/.test(bundle))
// Load file contents
.map(bundle => {
return {
path: bundle,
contents: fs.readFileSync(`${args['build-path']}/${bundle}`).toString()
};
})
// Concatenate license to bundle
.map(bundle => {
return {
path: bundle.path,
contents: `${license}${bundle.contents}`
};
})
// Write file to disk
.forEach(bundle => fs.writeFileSync(`${args['build-path']}/${bundle.path}`, bundle.contents));
var bundles =
fs.readdirSync(args['build-path'])
// Match files that begin with Rx and end with js
.filter(bundle => /^Rx\.?.*\.js$/.test(bundle))
// Load file contents
.map(bundle => {
return {
path: bundle,
contents: fs.readFileSync(`${args['build-path']}/${bundle}`).toString()
};
})
// Concatenate license to bundle
.map(bundle => { return {path: bundle.path, contents: `${license}${bundle.contents}`}; })
// Write file to disk
.forEach(
bundle => fs.writeFileSync(`${args['build-path']}/${bundle.path}`, bundle.contents));

View File

@ -1,39 +1,44 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var SourceMapConsumer = require('source-map').SourceMapConsumer;
var DotsReporter = require('karma/lib/reporters/dots_color');
var createErrorFormatter = function (basePath, emitter, SourceMapConsumer) {
var createErrorFormatter = function(basePath, emitter, SourceMapConsumer) {
var lastServedFiles = [];
emitter.on('file_list_modified', function (files) {
lastServedFiles = files.served
});
function findFile(path) {
return lastServedFiles.filter(_ => _.path === path)[0];
}
emitter.on('file_list_modified', function(files) { lastServedFiles = files.served });
function findFile(path) { return lastServedFiles.filter(_ => _.path === path)[0]; }
var URL_REGEXP = new RegExp('(?:https?:\\/\\/[^\\/]*)?\\/?' +
'(base|absolute)' + // prefix
'((?:[A-z]\\:)?[^\\?\\s\\:]*)' + // path
'(\\?\\w*)?' + // sha
'(\\:(\\d+))?' + // line
'(\\:(\\d+))?' + // column
'', 'g')
var URL_REGEXP = new RegExp(
'(?:https?:\\/\\/[^\\/]*)?\\/?' +
'(base|absolute)' + // prefix
'((?:[A-z]\\:)?[^\\?\\s\\:]*)' + // path
'(\\?\\w*)?' + // sha
'(\\:(\\d+))?' + // line
'(\\:(\\d+))?' + // column
'',
'g');
return function (msg, indentation) {
msg = (msg || '').replace(URL_REGEXP, function (_, prefix, path, __, ___, line, ____, column) {
return function(msg, indentation) {
msg = (msg || '').replace(URL_REGEXP, function(_, prefix, path, __, ___, line, ____, column) {
if (prefix === 'base') {
path = basePath + path;
}
line = parseInt(line || '0', 10);
column = parseInt(column || '0', 10);
var file = findFile(path)
var file = findFile(path);
if (file && file.sourceMap) {
try {
var original = new SourceMapConsumer(file.sourceMap).originalPositionFor({
line: line,
column: column
});
return process.cwd() + "/modules/" + original.source + ":" + original.line + ":" + original.column;
var original = new SourceMapConsumer(file.sourceMap)
.originalPositionFor({line: line, column: column});
return process.cwd() + '/modules/' + original.source + ':' + original.line + ':' +
original.column;
} catch (e) {
console.warn('SourceMap position not found for trace: %s', msg);
}
@ -47,13 +52,16 @@ var createErrorFormatter = function (basePath, emitter, SourceMapConsumer) {
}
return msg + '\n';
}
}
};
var InternalAngularReporter = function (config, emitter) {
var InternalAngularReporter = function(config, emitter) {
var formatter = createErrorFormatter(config.basePath, emitter, SourceMapConsumer);
DotsReporter.call(this, formatter, false, config.colors)
}
InternalAngularReporter.$inject = ['config', 'emitter']
};
module.exports = {'reporter:internal-angular': ['type', InternalAngularReporter]};
InternalAngularReporter.$inject = ['config', 'emitter'];
module.exports = {
'reporter:internal-angular': ['type', InternalAngularReporter]
};

View File

@ -1,4 +1,12 @@
"use strict";
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
'use strict';
var fs = require('fs');
var path = require('path');
@ -45,11 +53,11 @@ function _checkCache(markerFile, cacheMarkerFile) {
* pull in existing module.
*/
function _deleteDir(path) {
if( fs.existsSync(path) ) {
if (fs.existsSync(path)) {
var subpaths = fs.readdirSync(path);
subpaths.forEach(function(subpath) {
var curPath = path + "/" + subpath;
if(fs.lstatSync(curPath).isDirectory()) {
var curPath = path + '/' + subpath;
if (fs.lstatSync(curPath).isDirectory()) {
_deleteDir(curPath);
} else {
fs.unlinkSync(curPath);

View File

@ -1,4 +1,11 @@
#!/usr/bin/env node
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* this script is just a temporary solution to deal with the issue of npm outputting the npm
@ -14,25 +21,22 @@ var path = require('path');
function cleanModule(moduleRecord, name) {
// keep `resolve` properties for git dependencies, delete otherwise
delete moduleRecord.from;
if (!(moduleRecord.resolved && moduleRecord.resolved.match(/^git(\+[a-z]+)?:\/\//))) {
delete moduleRecord.resolved;
}
_.forEach(moduleRecord.dependencies, function(mod, name) {
cleanModule(mod, name);
});
_.forEach(moduleRecord.dependencies, function(mod, name) { cleanModule(mod, name); });
}
//console.log('Reading npm-shrinkwrap.json');
// console.log('Reading npm-shrinkwrap.json');
var shrinkwrap = require('../../npm-shrinkwrap.json');
//console.log('Cleaning shrinkwrap object');
// console.log('Cleaning shrinkwrap object');
cleanModule(shrinkwrap, shrinkwrap.name);
var cleanShrinkwrapPath = path.join(__dirname, '..', '..', 'npm-shrinkwrap.clean.json');
console.log('writing npm-shrinkwrap.clean.json');
fs.writeFileSync(cleanShrinkwrapPath, JSON.stringify(sorted(shrinkwrap), null, 2) + "\n");
fs.writeFileSync(cleanShrinkwrapPath, JSON.stringify(sorted(shrinkwrap), null, 2) + '\n');

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
module.exports = function travisFoldStart(name) {
if (process.env.TRAVIS) console.log('travis_fold:start:' + encode(name));

View File

@ -1,6 +1,14 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
class RollupNG2 {
resolveId(id, from){
if(id.startsWith('@angular/')){
resolveId(id, from) {
if (id.startsWith('@angular/')) {
return `${__dirname}/../../packages-dist/${id.split('/')[1]}/esm/index.js`;
}
@ -10,11 +18,10 @@ class RollupNG2 {
}
}
export default {
entry: 'test.js',
format: 'es6',
plugins: [
new RollupNG2(),
]
}
};