mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-10 22:47:58 +08:00
Fix lint in local-cli
Reviewed By: cpojer Differential Revision: D4166993 fbshipit-source-id: 9a8249175d98b42d7557817846d8c09c9769485e
This commit is contained in:
committed by
Facebook Github Bot
parent
eeba5eb774
commit
24d2bbfbab
@@ -6,6 +6,7 @@
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const log = require('../util/log').out('bundle');
|
||||
const Promise = require('promise');
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const buildBundle = require('./buildBundle');
|
||||
const outputBundle = require('./output/bundle');
|
||||
const bundleCommandLineArgs = require('./bundleCommandLineArgs');
|
||||
const outputBundle = require('./output/bundle');
|
||||
|
||||
/**
|
||||
* Builds the bundle starting to look for dependencies at the given entry path.
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const assetPathUtils = require('./assetPathUtils');
|
||||
const path = require('path');
|
||||
|
||||
function getAssetDestPathAndroid(asset, scale) {
|
||||
const androidFolder = assetPathUtils.getAndroidDrawableFolderName(asset, scale);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
'use strict';
|
||||
|
||||
const Promise = require('promise');
|
||||
|
||||
const meta = require('./meta');
|
||||
const writeFile = require('./writeFile');
|
||||
|
||||
|
||||
@@ -8,14 +8,15 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const mkdirp = require('mkdirp');
|
||||
const path = require('path');
|
||||
const MAGIC_UNBUNDLE_NUMBER = require('./magic-number');
|
||||
const Promise = require('promise');
|
||||
|
||||
const buildSourceMapWithMetaData = require('./build-unbundle-sourcemap-with-metadata');
|
||||
const mkdirp = require('mkdirp');
|
||||
const path = require('path');
|
||||
const writeFile = require('../writeFile');
|
||||
const writeSourceMap = require('./write-sourcemap');
|
||||
const MAGIC_UNBUNDLE_NUMBER = require('./magic-number');
|
||||
|
||||
const {joinModules} = require('./util');
|
||||
|
||||
const MAGIC_UNBUNDLE_FILENAME = 'UNBUNDLE'; // must not start with a dot, as that won't go into the apk
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const MAGIC_UNBUNDLE_FILE_HEADER = require('./magic-number');
|
||||
const Promise = require('promise');
|
||||
|
||||
const buildSourceMapWithMetaData = require('./build-unbundle-sourcemap-with-metadata');
|
||||
const fs = require('fs');
|
||||
const Promise = require('promise');
|
||||
const writeSourceMap = require('./write-sourcemap');
|
||||
const {joinModules} = require('./util');
|
||||
|
||||
const MAGIC_UNBUNDLE_FILE_HEADER = require('./magic-number');
|
||||
const {joinModules} = require('./util');
|
||||
const SIZEOF_UINT32 = 4;
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const asIndexedFile = require('./as-indexed-file');
|
||||
const asAssets = require('./as-assets');
|
||||
const asIndexedFile = require('./as-indexed-file');
|
||||
|
||||
function buildBundle(packagerClient, requestOptions) {
|
||||
return packagerClient.buildBundle({
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
'use strict';
|
||||
|
||||
const Promise = require('promise');
|
||||
|
||||
const writeFile = require('../writeFile');
|
||||
|
||||
function writeSourcemap(fileName, contents, log) {
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const Promise = require('promise');
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
function writeFile(file, data, encoding) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.writeFile(
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
var TOKEN = '<<SignedSource::*O*zOeWoEQle#+L!plEphiEmie@IsG>>',
|
||||
OLDTOKEN = '<<SignedSource::*O*zOeWoEQle#+L!plEphiEmie@I>>',
|
||||
TOKENS = [TOKEN, OLDTOKEN],
|
||||
PATTERN = new RegExp('@'+'generated (?:SignedSource<<([a-f0-9]{32})>>)');
|
||||
PATTERN = new RegExp('@' + 'generated (?:SignedSource<<([a-f0-9]{32})>>)');
|
||||
|
||||
exports.SIGN_OK = {message:'ok'};
|
||||
exports.SIGN_UNSIGNED = new Error('unsigned');
|
||||
@@ -19,13 +19,14 @@ exports.SIGN_INVALID = new Error('invalid');
|
||||
|
||||
// Thrown by sign(). Primarily for unit tests.
|
||||
exports.TokenNotFoundError = new Error(
|
||||
'Code signing placeholder not found (expected to find \''+TOKEN+'\')');
|
||||
'Code signing placeholder not found (expected to find \'' + TOKEN + '\')');
|
||||
|
||||
var md5_hash_hex;
|
||||
|
||||
// MD5 hash function for Node.js. To port this to other platforms, provide an
|
||||
// alternate code path for defining the md5_hash_hex function.
|
||||
var crypto = require('crypto');
|
||||
// eslint-disable-next-line no-shadow
|
||||
md5_hash_hex = function md5_hash_hex(data, input_encoding) {
|
||||
var md5sum = crypto.createHash('md5');
|
||||
md5sum.update(data, input_encoding);
|
||||
@@ -37,7 +38,7 @@ md5_hash_hex = function md5_hash_hex(data, input_encoding) {
|
||||
//
|
||||
// @return str to be embedded in to-be-signed file
|
||||
function signing_token() {
|
||||
return '@'+'generated '+TOKEN;
|
||||
return '@' + 'generated ' + TOKEN;
|
||||
}
|
||||
exports.signing_token = signing_token;
|
||||
|
||||
@@ -59,13 +60,14 @@ exports.is_signed = is_signed;
|
||||
function sign(file_data) {
|
||||
var first_time = file_data.indexOf(TOKEN) !== -1;
|
||||
if (!first_time) {
|
||||
if (is_signed(file_data))
|
||||
if (is_signed(file_data)) {
|
||||
file_data = file_data.replace(PATTERN, signing_token());
|
||||
else
|
||||
} else {
|
||||
throw exports.TokenNotFoundError;
|
||||
}
|
||||
}
|
||||
var signature = md5_hash_hex(file_data, 'utf8');
|
||||
var signed_data = file_data.replace(TOKEN, 'SignedSource<<'+signature+'>>');
|
||||
var signed_data = file_data.replace(TOKEN, 'SignedSource<<' + signature + '>>');
|
||||
return { first_time: first_time, signed_data: signed_data };
|
||||
}
|
||||
exports.sign = sign;
|
||||
@@ -78,18 +80,20 @@ exports.sign = sign;
|
||||
// it contains an invalid signature.
|
||||
function verify_signature(file_data) {
|
||||
var match = PATTERN.exec(file_data);
|
||||
if (!match)
|
||||
if (!match) {
|
||||
return exports.SIGN_UNSIGNED;
|
||||
}
|
||||
// Replace the signature with the TOKEN, then hash and see if it matches
|
||||
// the value in the file. For backwards compatibility, also try with
|
||||
// OLDTOKEN if that doesn't match.
|
||||
var k, token, with_token, actual_md5, expected_md5 = match[1];
|
||||
for (k in TOKENS) {
|
||||
token = TOKENS[k];
|
||||
with_token = file_data.replace(PATTERN, '@'+'generated '+token);
|
||||
with_token = file_data.replace(PATTERN, '@' + 'generated ' + token);
|
||||
actual_md5 = md5_hash_hex(with_token, 'utf8');
|
||||
if (expected_md5 === actual_md5)
|
||||
if (expected_md5 === actual_md5) {
|
||||
return exports.SIGN_OK;
|
||||
}
|
||||
}
|
||||
return exports.SIGN_INVALID;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const bundleWithOutput = require('./bundle').withOutput;
|
||||
const bundleCommandLineArgs = require('./bundleCommandLineArgs');
|
||||
|
||||
Reference in New Issue
Block a user