Use .slice() for all substring-ing (#26677)
- substr is Annex B - substring silently flips its arguments if they're in the "wrong order", which is confusing - slice is better than sliced bread (no pun intended) and also it works the same way on Arrays so there's less to remember --- > I'd be down to just lint and enforce a single form just for the potential compression savings by using a repeated string. _Originally posted by @sebmarkbage in https://github.com/facebook/react/pull/26663#discussion_r1170455401_
This commit is contained in:
parent
c826dc50de
commit
767f52237c
|
@ -236,7 +236,14 @@ module.exports = {
|
||||||
'no-inner-declarations': [ERROR, 'functions'],
|
'no-inner-declarations': [ERROR, 'functions'],
|
||||||
'no-multi-spaces': ERROR,
|
'no-multi-spaces': ERROR,
|
||||||
'no-restricted-globals': [ERROR].concat(restrictedGlobals),
|
'no-restricted-globals': [ERROR].concat(restrictedGlobals),
|
||||||
'no-restricted-syntax': [ERROR, 'WithStatement'],
|
'no-restricted-syntax': [
|
||||||
|
ERROR,
|
||||||
|
'WithStatement',
|
||||||
|
{
|
||||||
|
selector: 'MemberExpression[property.name=/^(?:substring|substr)$/]',
|
||||||
|
message: 'Prefer string.slice() over .substring() and .substr().',
|
||||||
|
},
|
||||||
|
],
|
||||||
'no-shadow': ERROR,
|
'no-shadow': ERROR,
|
||||||
'no-unused-vars': [ERROR, {args: 'none'}],
|
'no-unused-vars': [ERROR, {args: 'none'}],
|
||||||
'no-use-before-define': OFF,
|
'no-use-before-define': OFF,
|
||||||
|
|
|
@ -22,7 +22,7 @@ class App extends PureComponent {
|
||||||
}
|
}
|
||||||
const multiplier = input.length !== 0 ? input.length : 1;
|
const multiplier = input.length !== 0 ? input.length : 1;
|
||||||
const complexity =
|
const complexity =
|
||||||
(parseInt(window.location.search.substring(1), 10) / 100) * 25 || 25;
|
(parseInt(window.location.search.slice(1), 10) / 100) * 25 || 25;
|
||||||
const data = _.range(5).map(t =>
|
const data = _.range(5).map(t =>
|
||||||
_.range(complexity * multiplier).map((j, i) => {
|
_.range(complexity * multiplier).map((j, i) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import semver from 'semver';
|
||||||
|
|
||||||
function parseQuery(qstr) {
|
function parseQuery(qstr) {
|
||||||
var query = {};
|
var query = {};
|
||||||
var a = qstr.substr(1).split('&');
|
var a = qstr.slice(1).split('&');
|
||||||
|
|
||||||
for (var i = 0; i < a.length; i++) {
|
for (var i = 0; i < a.length; i++) {
|
||||||
var b = a[i].split('=');
|
var b = a[i].split('=');
|
||||||
|
|
|
@ -18,7 +18,7 @@ const ReactHooksESLintRule = ReactHooksESLintPlugin.rules['exhaustive-deps'];
|
||||||
function normalizeIndent(strings) {
|
function normalizeIndent(strings) {
|
||||||
const codeLines = strings[0].split('\n');
|
const codeLines = strings[0].split('\n');
|
||||||
const leftPadding = codeLines[1].match(/\s+/)[0];
|
const leftPadding = codeLines[1].match(/\s+/)[0];
|
||||||
return codeLines.map(line => line.substr(leftPadding.length)).join('\n');
|
return codeLines.map(line => line.slice(leftPadding.length)).join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************
|
// ***************************************************
|
||||||
|
|
|
@ -26,7 +26,7 @@ ESLintTester.setDefaultConfig({
|
||||||
function normalizeIndent(strings) {
|
function normalizeIndent(strings) {
|
||||||
const codeLines = strings[0].split('\n');
|
const codeLines = strings[0].split('\n');
|
||||||
const leftPadding = codeLines[1].match(/\s+/)[0];
|
const leftPadding = codeLines[1].match(/\s+/)[0];
|
||||||
return codeLines.map(line => line.substr(leftPadding.length)).join('\n');
|
return codeLines.map(line => line.slice(leftPadding.length)).join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************
|
// ***************************************************
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ export default {
|
||||||
extraWarning =
|
extraWarning =
|
||||||
` You can also do a functional update '${
|
` You can also do a functional update '${
|
||||||
setStateRecommendation.setter
|
setStateRecommendation.setter
|
||||||
}(${setStateRecommendation.missingDep.substring(
|
}(${setStateRecommendation.missingDep.slice(
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
)} => ...)' if you only need '${
|
)} => ...)' if you only need '${
|
||||||
|
|
|
@ -515,11 +515,11 @@ export function parseModelString(
|
||||||
switch (value[1]) {
|
switch (value[1]) {
|
||||||
case '$': {
|
case '$': {
|
||||||
// This was an escaped string value.
|
// This was an escaped string value.
|
||||||
return value.substring(1);
|
return value.slice(1);
|
||||||
}
|
}
|
||||||
case 'L': {
|
case 'L': {
|
||||||
// Lazy node
|
// Lazy node
|
||||||
const id = parseInt(value.substring(2), 16);
|
const id = parseInt(value.slice(2), 16);
|
||||||
const chunk = getChunk(response, id);
|
const chunk = getChunk(response, id);
|
||||||
// We create a React.lazy wrapper around any lazy values.
|
// We create a React.lazy wrapper around any lazy values.
|
||||||
// When passed into React, we'll know how to suspend on this.
|
// When passed into React, we'll know how to suspend on this.
|
||||||
|
@ -527,21 +527,21 @@ export function parseModelString(
|
||||||
}
|
}
|
||||||
case '@': {
|
case '@': {
|
||||||
// Promise
|
// Promise
|
||||||
const id = parseInt(value.substring(2), 16);
|
const id = parseInt(value.slice(2), 16);
|
||||||
const chunk = getChunk(response, id);
|
const chunk = getChunk(response, id);
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
case 'S': {
|
case 'S': {
|
||||||
// Symbol
|
// Symbol
|
||||||
return Symbol.for(value.substring(2));
|
return Symbol.for(value.slice(2));
|
||||||
}
|
}
|
||||||
case 'P': {
|
case 'P': {
|
||||||
// Server Context Provider
|
// Server Context Provider
|
||||||
return getOrCreateServerContext(value.substring(2)).Provider;
|
return getOrCreateServerContext(value.slice(2)).Provider;
|
||||||
}
|
}
|
||||||
case 'F': {
|
case 'F': {
|
||||||
// Server Reference
|
// Server Reference
|
||||||
const id = parseInt(value.substring(2), 16);
|
const id = parseInt(value.slice(2), 16);
|
||||||
const chunk = getChunk(response, id);
|
const chunk = getChunk(response, id);
|
||||||
switch (chunk.status) {
|
switch (chunk.status) {
|
||||||
case RESOLVED_MODEL:
|
case RESOLVED_MODEL:
|
||||||
|
@ -582,15 +582,15 @@ export function parseModelString(
|
||||||
}
|
}
|
||||||
case 'D': {
|
case 'D': {
|
||||||
// Date
|
// Date
|
||||||
return new Date(Date.parse(value.substring(2)));
|
return new Date(Date.parse(value.slice(2)));
|
||||||
}
|
}
|
||||||
case 'n': {
|
case 'n': {
|
||||||
// BigInt
|
// BigInt
|
||||||
return BigInt(value.substring(2));
|
return BigInt(value.slice(2));
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
// We assume that anything else is a reference ID.
|
// We assume that anything else is a reference ID.
|
||||||
const id = parseInt(value.substring(1), 16);
|
const id = parseInt(value.slice(1), 16);
|
||||||
const chunk = getChunk(response, id);
|
const chunk = getChunk(response, id);
|
||||||
switch (chunk.status) {
|
switch (chunk.status) {
|
||||||
case RESOLVED_MODEL:
|
case RESOLVED_MODEL:
|
||||||
|
|
|
@ -35,7 +35,7 @@ function processFullRow(response: Response, row: string): void {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const colon = row.indexOf(':', 0);
|
const colon = row.indexOf(':', 0);
|
||||||
const id = parseInt(row.substring(0, colon), 16);
|
const id = parseInt(row.slice(0, colon), 16);
|
||||||
const tag = row[colon + 1];
|
const tag = row[colon + 1];
|
||||||
// When tags that are not text are added, check them here before
|
// When tags that are not text are added, check them here before
|
||||||
// parsing the row as text.
|
// parsing the row as text.
|
||||||
|
@ -43,11 +43,11 @@ function processFullRow(response: Response, row: string): void {
|
||||||
// }
|
// }
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case 'I': {
|
case 'I': {
|
||||||
resolveModule(response, id, row.substring(colon + 2));
|
resolveModule(response, id, row.slice(colon + 2));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 'E': {
|
case 'E': {
|
||||||
const errorInfo = JSON.parse(row.substring(colon + 2));
|
const errorInfo = JSON.parse(row.slice(colon + 2));
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
resolveErrorDev(
|
resolveErrorDev(
|
||||||
response,
|
response,
|
||||||
|
@ -63,7 +63,7 @@ function processFullRow(response: Response, row: string): void {
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
// We assume anything else is JSON.
|
// We assume anything else is JSON.
|
||||||
resolveModel(response, id, row.substring(colon + 1));
|
resolveModel(response, id, row.slice(colon + 1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,13 +76,13 @@ export function processStringChunk(
|
||||||
): void {
|
): void {
|
||||||
let linebreak = chunk.indexOf('\n', offset);
|
let linebreak = chunk.indexOf('\n', offset);
|
||||||
while (linebreak > -1) {
|
while (linebreak > -1) {
|
||||||
const fullrow = response._partialRow + chunk.substring(offset, linebreak);
|
const fullrow = response._partialRow + chunk.slice(offset, linebreak);
|
||||||
processFullRow(response, fullrow);
|
processFullRow(response, fullrow);
|
||||||
response._partialRow = '';
|
response._partialRow = '';
|
||||||
offset = linebreak + 1;
|
offset = linebreak + 1;
|
||||||
linebreak = chunk.indexOf('\n', offset);
|
linebreak = chunk.indexOf('\n', offset);
|
||||||
}
|
}
|
||||||
response._partialRow += chunk.substring(offset);
|
response._partialRow += chunk.slice(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function processBinaryChunk(
|
export function processBinaryChunk(
|
||||||
|
|
|
@ -513,10 +513,10 @@ function parseCustomHookName(functionName: void | string): string {
|
||||||
if (startIndex === -1) {
|
if (startIndex === -1) {
|
||||||
startIndex = 0;
|
startIndex = 0;
|
||||||
}
|
}
|
||||||
if (functionName.substr(startIndex, 3) === 'use') {
|
if (functionName.slice(startIndex, startIndex + 3) === 'use') {
|
||||||
startIndex += 3;
|
startIndex += 3;
|
||||||
}
|
}
|
||||||
return functionName.substr(startIndex);
|
return functionName.slice(startIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildTree(
|
function buildTree(
|
||||||
|
|
|
@ -869,7 +869,7 @@ describe('ReactHooksInspectionIntegration', () => {
|
||||||
const Suspense = React.Suspense;
|
const Suspense = React.Suspense;
|
||||||
|
|
||||||
function Foo(props) {
|
function Foo(props) {
|
||||||
const [value] = React.useState(props.defaultValue.substr(0, 3));
|
const [value] = React.useState(props.defaultValue.slice(0, 3));
|
||||||
return <div>{value}</div>;
|
return <div>{value}</div>;
|
||||||
}
|
}
|
||||||
Foo.defaultProps = {
|
Foo.defaultProps = {
|
||||||
|
|
|
@ -27,7 +27,7 @@ const main = async buildId => {
|
||||||
const json = JSON.parse(file);
|
const json = JSON.parse(file);
|
||||||
const alias = json.alias[0];
|
const alias = json.alias[0];
|
||||||
|
|
||||||
const commit = execSync('git rev-parse HEAD').toString().trim().substr(0, 7);
|
const commit = execSync('git rev-parse HEAD').toString().trim().slice(0, 7);
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
date = `${date.toLocaleDateString()} – ${date.toLocaleTimeString()}`;
|
date = `${date.toLocaleDateString()} – ${date.toLocaleTimeString()}`;
|
||||||
|
|
|
@ -13,7 +13,7 @@ function serializeHook(hook) {
|
||||||
// Remove user-specific portions of this file path.
|
// Remove user-specific portions of this file path.
|
||||||
let fileName = hook.hookSource.fileName;
|
let fileName = hook.hookSource.fileName;
|
||||||
const index = fileName.lastIndexOf('/react-devtools-shared/');
|
const index = fileName.lastIndexOf('/react-devtools-shared/');
|
||||||
fileName = fileName.substring(index + 1);
|
fileName = fileName.slice(index + 1);
|
||||||
|
|
||||||
let subHooks = hook.subHooks;
|
let subHooks = hook.subHooks;
|
||||||
if (subHooks) {
|
if (subHooks) {
|
||||||
|
|
|
@ -4315,7 +4315,7 @@ export function attach(
|
||||||
if (pseudoKey === undefined) {
|
if (pseudoKey === undefined) {
|
||||||
throw new Error('Expected root pseudo key to be known.');
|
throw new Error('Expected root pseudo key to be known.');
|
||||||
}
|
}
|
||||||
const name = pseudoKey.substring(0, pseudoKey.lastIndexOf(':'));
|
const name = pseudoKey.slice(0, pseudoKey.lastIndexOf(':'));
|
||||||
const counter = rootDisplayNameCounter.get(name);
|
const counter = rootDisplayNameCounter.get(name);
|
||||||
if (counter === undefined) {
|
if (counter === undefined) {
|
||||||
throw new Error('Expected counter to be known.');
|
throw new Error('Expected counter to be known.');
|
||||||
|
|
|
@ -155,7 +155,7 @@ export function sanitizeForParse(value: any): any | string {
|
||||||
value.charAt(0) === "'" &&
|
value.charAt(0) === "'" &&
|
||||||
value.charAt(value.length - 1) === "'"
|
value.charAt(value.length - 1) === "'"
|
||||||
) {
|
) {
|
||||||
return '"' + value.substr(1, value.length - 2) + '"';
|
return '"' + value.slice(1, value.length - 1) + '"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -36,10 +36,10 @@ export function createRegExp(string: string): RegExp {
|
||||||
// Allow /regex/ syntax with optional last /
|
// Allow /regex/ syntax with optional last /
|
||||||
if (string[0] === '/') {
|
if (string[0] === '/') {
|
||||||
// Cut off first slash
|
// Cut off first slash
|
||||||
string = string.substring(1);
|
string = string.slice(1);
|
||||||
// Cut off last slash, but only if it's there
|
// Cut off last slash, but only if it's there
|
||||||
if (string[string.length - 1] === '/') {
|
if (string[string.length - 1] === '/') {
|
||||||
string = string.substring(0, string.length - 1);
|
string = string.slice(0, string.length - 1);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new RegExp(string, 'i');
|
return new RegExp(string, 'i');
|
||||||
|
@ -186,9 +186,9 @@ export function truncateText(text: string, maxLength: number): string {
|
||||||
const {length} = text;
|
const {length} = text;
|
||||||
if (length > maxLength) {
|
if (length > maxLength) {
|
||||||
return (
|
return (
|
||||||
text.substr(0, Math.floor(maxLength / 2)) +
|
text.slice(0, Math.floor(maxLength / 2)) +
|
||||||
'…' +
|
'…' +
|
||||||
text.substr(length - Math.ceil(maxLength / 2) - 1)
|
text.slice(length - Math.ceil(maxLength / 2) - 1)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return text;
|
return text;
|
||||||
|
|
|
@ -693,7 +693,7 @@ function truncateForDisplay(
|
||||||
length: number = MAX_PREVIEW_STRING_LENGTH,
|
length: number = MAX_PREVIEW_STRING_LENGTH,
|
||||||
) {
|
) {
|
||||||
if (string.length > length) {
|
if (string.length > length) {
|
||||||
return string.substr(0, length) + '…';
|
return string.slice(0, length) + '…';
|
||||||
} else {
|
} else {
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ const TooltipNetworkMeasure = ({
|
||||||
let urlToDisplay = url;
|
let urlToDisplay = url;
|
||||||
if (urlToDisplay.length > MAX_TOOLTIP_TEXT_LENGTH) {
|
if (urlToDisplay.length > MAX_TOOLTIP_TEXT_LENGTH) {
|
||||||
const half = Math.floor(MAX_TOOLTIP_TEXT_LENGTH / 2);
|
const half = Math.floor(MAX_TOOLTIP_TEXT_LENGTH / 2);
|
||||||
urlToDisplay = url.substr(0, half) + '…' + url.substr(url.length - half);
|
urlToDisplay = url.slice(0, half) + '…' + url.slice(url.length - half);
|
||||||
}
|
}
|
||||||
|
|
||||||
const timestampBegin = sendRequestTimestamp;
|
const timestampBegin = sendRequestTimestamp;
|
||||||
|
|
|
@ -45,7 +45,7 @@ export function trimText(
|
||||||
while (startIndex <= stopIndex) {
|
while (startIndex <= stopIndex) {
|
||||||
const currentIndex = Math.floor((startIndex + stopIndex) / 2);
|
const currentIndex = Math.floor((startIndex + stopIndex) / 2);
|
||||||
const trimmedText =
|
const trimmedText =
|
||||||
currentIndex === maxIndex ? text : text.substr(0, currentIndex) + '…';
|
currentIndex === maxIndex ? text : text.slice(0, currentIndex) + '…';
|
||||||
|
|
||||||
if (getTextWidth(context, trimmedText) <= width) {
|
if (getTextWidth(context, trimmedText) <= width) {
|
||||||
if (longestValidIndex < currentIndex) {
|
if (longestValidIndex < currentIndex) {
|
||||||
|
|
|
@ -476,10 +476,10 @@ function processTimelineEvent(
|
||||||
break;
|
break;
|
||||||
case 'blink.user_timing':
|
case 'blink.user_timing':
|
||||||
if (name.startsWith('--react-version-')) {
|
if (name.startsWith('--react-version-')) {
|
||||||
const [reactVersion] = name.substr(16).split('-');
|
const [reactVersion] = name.slice(16).split('-');
|
||||||
currentProfilerData.reactVersion = reactVersion;
|
currentProfilerData.reactVersion = reactVersion;
|
||||||
} else if (name.startsWith('--profiler-version-')) {
|
} else if (name.startsWith('--profiler-version-')) {
|
||||||
const [versionString] = name.substr(19).split('-');
|
const [versionString] = name.slice(19).split('-');
|
||||||
profilerVersion = parseInt(versionString, 10);
|
profilerVersion = parseInt(versionString, 10);
|
||||||
if (profilerVersion !== SCHEDULING_PROFILER_VERSION) {
|
if (profilerVersion !== SCHEDULING_PROFILER_VERSION) {
|
||||||
throw new InvalidProfileError(
|
throw new InvalidProfileError(
|
||||||
|
@ -487,7 +487,7 @@ function processTimelineEvent(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (name.startsWith('--react-lane-labels-')) {
|
} else if (name.startsWith('--react-lane-labels-')) {
|
||||||
const [laneLabelTuplesString] = name.substr(20).split('-');
|
const [laneLabelTuplesString] = name.slice(20).split('-');
|
||||||
updateLaneToLabelMap(currentProfilerData, laneLabelTuplesString);
|
updateLaneToLabelMap(currentProfilerData, laneLabelTuplesString);
|
||||||
} else if (name.startsWith('--component-')) {
|
} else if (name.startsWith('--component-')) {
|
||||||
processReactComponentMeasure(
|
processReactComponentMeasure(
|
||||||
|
@ -497,7 +497,7 @@ function processTimelineEvent(
|
||||||
state,
|
state,
|
||||||
);
|
);
|
||||||
} else if (name.startsWith('--schedule-render-')) {
|
} else if (name.startsWith('--schedule-render-')) {
|
||||||
const [laneBitmaskString] = name.substr(18).split('-');
|
const [laneBitmaskString] = name.slice(18).split('-');
|
||||||
|
|
||||||
currentProfilerData.schedulingEvents.push({
|
currentProfilerData.schedulingEvents.push({
|
||||||
type: 'schedule-render',
|
type: 'schedule-render',
|
||||||
|
@ -506,7 +506,7 @@ function processTimelineEvent(
|
||||||
warning: null,
|
warning: null,
|
||||||
});
|
});
|
||||||
} else if (name.startsWith('--schedule-forced-update-')) {
|
} else if (name.startsWith('--schedule-forced-update-')) {
|
||||||
const [laneBitmaskString, componentName] = name.substr(25).split('-');
|
const [laneBitmaskString, componentName] = name.slice(25).split('-');
|
||||||
|
|
||||||
const forceUpdateEvent = {
|
const forceUpdateEvent = {
|
||||||
type: 'schedule-force-update',
|
type: 'schedule-force-update',
|
||||||
|
@ -524,7 +524,7 @@ function processTimelineEvent(
|
||||||
|
|
||||||
currentProfilerData.schedulingEvents.push(forceUpdateEvent);
|
currentProfilerData.schedulingEvents.push(forceUpdateEvent);
|
||||||
} else if (name.startsWith('--schedule-state-update-')) {
|
} else if (name.startsWith('--schedule-state-update-')) {
|
||||||
const [laneBitmaskString, componentName] = name.substr(24).split('-');
|
const [laneBitmaskString, componentName] = name.slice(24).split('-');
|
||||||
|
|
||||||
const stateUpdateEvent = {
|
const stateUpdateEvent = {
|
||||||
type: 'schedule-state-update',
|
type: 'schedule-state-update',
|
||||||
|
@ -542,7 +542,7 @@ function processTimelineEvent(
|
||||||
|
|
||||||
currentProfilerData.schedulingEvents.push(stateUpdateEvent);
|
currentProfilerData.schedulingEvents.push(stateUpdateEvent);
|
||||||
} else if (name.startsWith('--error-')) {
|
} else if (name.startsWith('--error-')) {
|
||||||
const [componentName, phase, message] = name.substr(8).split('-');
|
const [componentName, phase, message] = name.slice(8).split('-');
|
||||||
|
|
||||||
currentProfilerData.thrownErrors.push({
|
currentProfilerData.thrownErrors.push({
|
||||||
componentName,
|
componentName,
|
||||||
|
@ -553,7 +553,7 @@ function processTimelineEvent(
|
||||||
});
|
});
|
||||||
} else if (name.startsWith('--suspense-suspend-')) {
|
} else if (name.startsWith('--suspense-suspend-')) {
|
||||||
const [id, componentName, phase, laneBitmaskString, promiseName] = name
|
const [id, componentName, phase, laneBitmaskString, promiseName] = name
|
||||||
.substr(19)
|
.slice(19)
|
||||||
.split('-');
|
.split('-');
|
||||||
const lanes = getLanesFromTransportDecimalBitmask(laneBitmaskString);
|
const lanes = getLanesFromTransportDecimalBitmask(laneBitmaskString);
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ function processTimelineEvent(
|
||||||
currentProfilerData.suspenseEvents.push(suspenseEvent);
|
currentProfilerData.suspenseEvents.push(suspenseEvent);
|
||||||
state.unresolvedSuspenseEvents.set(id, suspenseEvent);
|
state.unresolvedSuspenseEvents.set(id, suspenseEvent);
|
||||||
} else if (name.startsWith('--suspense-resolved-')) {
|
} else if (name.startsWith('--suspense-resolved-')) {
|
||||||
const [id] = name.substr(20).split('-');
|
const [id] = name.slice(20).split('-');
|
||||||
const suspenseEvent = state.unresolvedSuspenseEvents.get(id);
|
const suspenseEvent = state.unresolvedSuspenseEvents.get(id);
|
||||||
if (suspenseEvent != null) {
|
if (suspenseEvent != null) {
|
||||||
state.unresolvedSuspenseEvents.delete(id);
|
state.unresolvedSuspenseEvents.delete(id);
|
||||||
|
@ -613,7 +613,7 @@ function processTimelineEvent(
|
||||||
suspenseEvent.resolution = 'resolved';
|
suspenseEvent.resolution = 'resolved';
|
||||||
}
|
}
|
||||||
} else if (name.startsWith('--suspense-rejected-')) {
|
} else if (name.startsWith('--suspense-rejected-')) {
|
||||||
const [id] = name.substr(20).split('-');
|
const [id] = name.slice(20).split('-');
|
||||||
const suspenseEvent = state.unresolvedSuspenseEvents.get(id);
|
const suspenseEvent = state.unresolvedSuspenseEvents.get(id);
|
||||||
if (suspenseEvent != null) {
|
if (suspenseEvent != null) {
|
||||||
state.unresolvedSuspenseEvents.delete(id);
|
state.unresolvedSuspenseEvents.delete(id);
|
||||||
|
@ -637,7 +637,7 @@ function processTimelineEvent(
|
||||||
state.potentialLongNestedUpdate = null;
|
state.potentialLongNestedUpdate = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [laneBitmaskString] = name.substr(15).split('-');
|
const [laneBitmaskString] = name.slice(15).split('-');
|
||||||
|
|
||||||
throwIfIncomplete('render', state.measureStack);
|
throwIfIncomplete('render', state.measureStack);
|
||||||
if (getLastType(state.measureStack) !== 'render-idle') {
|
if (getLastType(state.measureStack) !== 'render-idle') {
|
||||||
|
@ -682,7 +682,7 @@ function processTimelineEvent(
|
||||||
);
|
);
|
||||||
} else if (name.startsWith('--commit-start-')) {
|
} else if (name.startsWith('--commit-start-')) {
|
||||||
state.nextRenderShouldGenerateNewBatchID = true;
|
state.nextRenderShouldGenerateNewBatchID = true;
|
||||||
const [laneBitmaskString] = name.substr(15).split('-');
|
const [laneBitmaskString] = name.slice(15).split('-');
|
||||||
|
|
||||||
markWorkStarted(
|
markWorkStarted(
|
||||||
'commit',
|
'commit',
|
||||||
|
@ -705,7 +705,7 @@ function processTimelineEvent(
|
||||||
state.measureStack,
|
state.measureStack,
|
||||||
);
|
);
|
||||||
} else if (name.startsWith('--layout-effects-start-')) {
|
} else if (name.startsWith('--layout-effects-start-')) {
|
||||||
const [laneBitmaskString] = name.substr(23).split('-');
|
const [laneBitmaskString] = name.slice(23).split('-');
|
||||||
|
|
||||||
markWorkStarted(
|
markWorkStarted(
|
||||||
'layout-effects',
|
'layout-effects',
|
||||||
|
@ -722,7 +722,7 @@ function processTimelineEvent(
|
||||||
state.measureStack,
|
state.measureStack,
|
||||||
);
|
);
|
||||||
} else if (name.startsWith('--passive-effects-start-')) {
|
} else if (name.startsWith('--passive-effects-start-')) {
|
||||||
const [laneBitmaskString] = name.substr(24).split('-');
|
const [laneBitmaskString] = name.slice(24).split('-');
|
||||||
|
|
||||||
markWorkStarted(
|
markWorkStarted(
|
||||||
'passive-effects',
|
'passive-effects',
|
||||||
|
@ -739,7 +739,7 @@ function processTimelineEvent(
|
||||||
state.measureStack,
|
state.measureStack,
|
||||||
);
|
);
|
||||||
} else if (name.startsWith('--react-internal-module-start-')) {
|
} else if (name.startsWith('--react-internal-module-start-')) {
|
||||||
const stackFrameStart = name.substr(30);
|
const stackFrameStart = name.slice(30);
|
||||||
|
|
||||||
if (!state.internalModuleStackStringSet.has(stackFrameStart)) {
|
if (!state.internalModuleStackStringSet.has(stackFrameStart)) {
|
||||||
state.internalModuleStackStringSet.add(stackFrameStart);
|
state.internalModuleStackStringSet.add(stackFrameStart);
|
||||||
|
@ -749,7 +749,7 @@ function processTimelineEvent(
|
||||||
state.internalModuleCurrentStackFrame = parsedStackFrameStart;
|
state.internalModuleCurrentStackFrame = parsedStackFrameStart;
|
||||||
}
|
}
|
||||||
} else if (name.startsWith('--react-internal-module-stop-')) {
|
} else if (name.startsWith('--react-internal-module-stop-')) {
|
||||||
const stackFrameStop = name.substr(29);
|
const stackFrameStop = name.slice(29);
|
||||||
|
|
||||||
if (!state.internalModuleStackStringSet.has(stackFrameStop)) {
|
if (!state.internalModuleStackStringSet.has(stackFrameStop)) {
|
||||||
state.internalModuleStackStringSet.add(stackFrameStop);
|
state.internalModuleStackStringSet.add(stackFrameStop);
|
||||||
|
@ -833,7 +833,7 @@ function processReactComponentMeasure(
|
||||||
state: ProcessorState,
|
state: ProcessorState,
|
||||||
): void {
|
): void {
|
||||||
if (name.startsWith('--component-render-start-')) {
|
if (name.startsWith('--component-render-start-')) {
|
||||||
const [componentName] = name.substr(25).split('-');
|
const [componentName] = name.slice(25).split('-');
|
||||||
|
|
||||||
assertNoOverlappingComponentMeasure(state);
|
assertNoOverlappingComponentMeasure(state);
|
||||||
|
|
||||||
|
@ -856,7 +856,7 @@ function processReactComponentMeasure(
|
||||||
currentProfilerData.componentMeasures.push(componentMeasure);
|
currentProfilerData.componentMeasures.push(componentMeasure);
|
||||||
}
|
}
|
||||||
} else if (name.startsWith('--component-layout-effect-mount-start-')) {
|
} else if (name.startsWith('--component-layout-effect-mount-start-')) {
|
||||||
const [componentName] = name.substr(38).split('-');
|
const [componentName] = name.slice(38).split('-');
|
||||||
|
|
||||||
assertNoOverlappingComponentMeasure(state);
|
assertNoOverlappingComponentMeasure(state);
|
||||||
|
|
||||||
|
@ -879,7 +879,7 @@ function processReactComponentMeasure(
|
||||||
currentProfilerData.componentMeasures.push(componentMeasure);
|
currentProfilerData.componentMeasures.push(componentMeasure);
|
||||||
}
|
}
|
||||||
} else if (name.startsWith('--component-layout-effect-unmount-start-')) {
|
} else if (name.startsWith('--component-layout-effect-unmount-start-')) {
|
||||||
const [componentName] = name.substr(40).split('-');
|
const [componentName] = name.slice(40).split('-');
|
||||||
|
|
||||||
assertNoOverlappingComponentMeasure(state);
|
assertNoOverlappingComponentMeasure(state);
|
||||||
|
|
||||||
|
@ -902,7 +902,7 @@ function processReactComponentMeasure(
|
||||||
currentProfilerData.componentMeasures.push(componentMeasure);
|
currentProfilerData.componentMeasures.push(componentMeasure);
|
||||||
}
|
}
|
||||||
} else if (name.startsWith('--component-passive-effect-mount-start-')) {
|
} else if (name.startsWith('--component-passive-effect-mount-start-')) {
|
||||||
const [componentName] = name.substr(39).split('-');
|
const [componentName] = name.slice(39).split('-');
|
||||||
|
|
||||||
assertNoOverlappingComponentMeasure(state);
|
assertNoOverlappingComponentMeasure(state);
|
||||||
|
|
||||||
|
@ -925,7 +925,7 @@ function processReactComponentMeasure(
|
||||||
currentProfilerData.componentMeasures.push(componentMeasure);
|
currentProfilerData.componentMeasures.push(componentMeasure);
|
||||||
}
|
}
|
||||||
} else if (name.startsWith('--component-passive-effect-unmount-start-')) {
|
} else if (name.startsWith('--component-passive-effect-unmount-start-')) {
|
||||||
const [componentName] = name.substr(41).split('-');
|
const [componentName] = name.slice(41).split('-');
|
||||||
|
|
||||||
assertNoOverlappingComponentMeasure(state);
|
assertNoOverlappingComponentMeasure(state);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ export function formatDuration(ms: number): string {
|
||||||
|
|
||||||
export function trimString(string: string, length: number): string {
|
export function trimString(string: string, length: number): string {
|
||||||
if (string.length > length) {
|
if (string.length > length) {
|
||||||
return `${string.substr(0, length - 1)}…`;
|
return `${string.slice(0, length - 1)}…`;
|
||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,7 @@ export function setValueForPropertyOnCustomComponent(
|
||||||
) {
|
) {
|
||||||
if (name[0] === 'o' && name[1] === 'n') {
|
if (name[0] === 'o' && name[1] === 'n') {
|
||||||
const useCapture = name.endsWith('Capture');
|
const useCapture = name.endsWith('Capture');
|
||||||
const eventName = name.substr(2, useCapture ? name.length - 9 : undefined);
|
const eventName = name.slice(2, useCapture ? name.length - 7 : undefined);
|
||||||
|
|
||||||
const prevProps = getFiberCurrentPropsFromNode(node);
|
const prevProps = getFiberCurrentPropsFromNode(node);
|
||||||
const prevValue = prevProps != null ? prevProps[name] : null;
|
const prevValue = prevProps != null ? prevProps[name] : null;
|
||||||
|
|
|
@ -88,14 +88,14 @@ function escapeHtml(string: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastIndex !== index) {
|
if (lastIndex !== index) {
|
||||||
html += str.substring(lastIndex, index);
|
html += str.slice(lastIndex, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastIndex = index + 1;
|
lastIndex = index + 1;
|
||||||
html += escape;
|
html += escape;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||||
}
|
}
|
||||||
// end code copied and modified from escape-html
|
// end code copied and modified from escape-html
|
||||||
|
|
||||||
|
|
|
@ -1635,7 +1635,7 @@ describe('ReactNewContext', () => {
|
||||||
|
|
||||||
const LIMIT = 100;
|
const LIMIT = 100;
|
||||||
for (let i = 0; i < LIMIT; i++) {
|
for (let i = 0; i < LIMIT; i++) {
|
||||||
const seed = Math.random().toString(36).substr(2, 5);
|
const seed = Math.random().toString(36).slice(2, 7);
|
||||||
const actions = randomActions(5);
|
const actions = randomActions(5);
|
||||||
try {
|
try {
|
||||||
simulate(seed, actions);
|
simulate(seed, actions);
|
||||||
|
|
|
@ -69,8 +69,8 @@ export function resolveServerReference<T>(
|
||||||
id: ServerReferenceId,
|
id: ServerReferenceId,
|
||||||
): ClientReference<T> {
|
): ClientReference<T> {
|
||||||
const idx = id.lastIndexOf('#');
|
const idx = id.lastIndexOf('#');
|
||||||
const specifier = id.substr(0, idx);
|
const specifier = id.slice(0, idx);
|
||||||
const name = id.substr(idx + 1);
|
const name = id.slice(idx + 1);
|
||||||
return {specifier, name};
|
return {specifier, name};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,8 +85,8 @@ export function resolveServerReference<T>(
|
||||||
// probably go back to encoding path and name separately on the client reference.
|
// probably go back to encoding path and name separately on the client reference.
|
||||||
const idx = id.lastIndexOf('#');
|
const idx = id.lastIndexOf('#');
|
||||||
if (idx !== -1) {
|
if (idx !== -1) {
|
||||||
name = id.substr(idx + 1);
|
name = id.slice(idx + 1);
|
||||||
resolvedModuleData = bundlerConfig[id.substr(0, idx)];
|
resolvedModuleData = bundlerConfig[id.slice(0, idx)];
|
||||||
}
|
}
|
||||||
if (!resolvedModuleData) {
|
if (!resolvedModuleData) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
|
@ -71,8 +71,8 @@ export function resolveClientReferenceMetadata<T>(
|
||||||
// probably go back to encoding path and name separately on the client reference.
|
// probably go back to encoding path and name separately on the client reference.
|
||||||
const idx = modulePath.lastIndexOf('#');
|
const idx = modulePath.lastIndexOf('#');
|
||||||
if (idx !== -1) {
|
if (idx !== -1) {
|
||||||
name = modulePath.substr(idx + 1);
|
name = modulePath.slice(idx + 1);
|
||||||
resolvedModuleData = config[modulePath.substr(0, idx)];
|
resolvedModuleData = config[modulePath.slice(0, idx)];
|
||||||
}
|
}
|
||||||
if (!resolvedModuleData) {
|
if (!resolvedModuleData) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
|
@ -87,8 +87,8 @@ describe('ReactFlightDOMBrowser', () => {
|
||||||
// probably go back to encoding path and name separately on the client reference.
|
// probably go back to encoding path and name separately on the client reference.
|
||||||
const idx = ref.lastIndexOf('#');
|
const idx = ref.lastIndexOf('#');
|
||||||
if (idx !== -1) {
|
if (idx !== -1) {
|
||||||
name = ref.substr(idx + 1);
|
name = ref.slice(idx + 1);
|
||||||
resolvedModuleData = webpackServerMap[ref.substr(0, idx)];
|
resolvedModuleData = webpackServerMap[ref.slice(0, idx)];
|
||||||
}
|
}
|
||||||
if (!resolvedModuleData) {
|
if (!resolvedModuleData) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
|
@ -374,21 +374,21 @@ function parseModelString(
|
||||||
switch (value[1]) {
|
switch (value[1]) {
|
||||||
case '$': {
|
case '$': {
|
||||||
// This was an escaped string value.
|
// This was an escaped string value.
|
||||||
return value.substring(1);
|
return value.slice(1);
|
||||||
}
|
}
|
||||||
case '@': {
|
case '@': {
|
||||||
// Promise
|
// Promise
|
||||||
const id = parseInt(value.substring(2), 16);
|
const id = parseInt(value.slice(2), 16);
|
||||||
const chunk = getChunk(response, id);
|
const chunk = getChunk(response, id);
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
case 'S': {
|
case 'S': {
|
||||||
// Symbol
|
// Symbol
|
||||||
return Symbol.for(value.substring(2));
|
return Symbol.for(value.slice(2));
|
||||||
}
|
}
|
||||||
case 'F': {
|
case 'F': {
|
||||||
// Server Reference
|
// Server Reference
|
||||||
const id = parseInt(value.substring(2), 16);
|
const id = parseInt(value.slice(2), 16);
|
||||||
const chunk = getChunk(response, id);
|
const chunk = getChunk(response, id);
|
||||||
if (chunk.status === RESOLVED_MODEL) {
|
if (chunk.status === RESOLVED_MODEL) {
|
||||||
initializeModelChunk(chunk);
|
initializeModelChunk(chunk);
|
||||||
|
@ -411,7 +411,7 @@ function parseModelString(
|
||||||
}
|
}
|
||||||
case 'K': {
|
case 'K': {
|
||||||
// FormData
|
// FormData
|
||||||
const stringId = value.substring(2);
|
const stringId = value.slice(2);
|
||||||
const formPrefix = response._prefix + stringId + '_';
|
const formPrefix = response._prefix + stringId + '_';
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
const backingFormData = response._formData;
|
const backingFormData = response._formData;
|
||||||
|
@ -421,7 +421,7 @@ function parseModelString(
|
||||||
// $FlowFixMe[prop-missing] FormData has forEach on it.
|
// $FlowFixMe[prop-missing] FormData has forEach on it.
|
||||||
backingFormData.forEach((entry: File | string, entryKey: string) => {
|
backingFormData.forEach((entry: File | string, entryKey: string) => {
|
||||||
if (entryKey.startsWith(formPrefix)) {
|
if (entryKey.startsWith(formPrefix)) {
|
||||||
data.append(entryKey.substr(formPrefix.length), entry);
|
data.append(entryKey.slice(formPrefix.length), entry);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
|
@ -449,15 +449,15 @@ function parseModelString(
|
||||||
}
|
}
|
||||||
case 'D': {
|
case 'D': {
|
||||||
// Date
|
// Date
|
||||||
return new Date(Date.parse(value.substring(2)));
|
return new Date(Date.parse(value.slice(2)));
|
||||||
}
|
}
|
||||||
case 'n': {
|
case 'n': {
|
||||||
// BigInt
|
// BigInt
|
||||||
return BigInt(value.substring(2));
|
return BigInt(value.slice(2));
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
// We assume that anything else is a reference ID.
|
// We assume that anything else is a reference ID.
|
||||||
const id = parseInt(value.substring(1), 16);
|
const id = parseInt(value.slice(1), 16);
|
||||||
const chunk = getChunk(response, id);
|
const chunk = getChunk(response, id);
|
||||||
switch (chunk.status) {
|
switch (chunk.status) {
|
||||||
case RESOLVED_MODEL:
|
case RESOLVED_MODEL:
|
||||||
|
@ -517,7 +517,7 @@ export function resolveField(
|
||||||
const prefix = response._prefix;
|
const prefix = response._prefix;
|
||||||
if (key.startsWith(prefix)) {
|
if (key.startsWith(prefix)) {
|
||||||
const chunks = response._chunks;
|
const chunks = response._chunks;
|
||||||
const id = +key.substr(prefix.length);
|
const id = +key.slice(prefix.length);
|
||||||
const chunk = chunks.get(id);
|
const chunk = chunks.get(id);
|
||||||
if (chunk) {
|
if (chunk) {
|
||||||
// We were waiting on this key so now we can resolve it.
|
// We were waiting on this key so now we can resolve it.
|
||||||
|
|
|
@ -90,7 +90,7 @@ export function describeValueForErrorMessage(value: mixed): string {
|
||||||
switch (typeof value) {
|
switch (typeof value) {
|
||||||
case 'string': {
|
case 'string': {
|
||||||
return JSON.stringify(
|
return JSON.stringify(
|
||||||
value.length <= 10 ? value : value.substr(0, 10) + '...',
|
value.length <= 10 ? value : value.slice(0, 10) + '...',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 'object': {
|
case 'object': {
|
||||||
|
|
|
@ -74,7 +74,7 @@ function transform(babel) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const next3 = code.substring(i, i + 3);
|
const next3 = code.slice(i, i + 3);
|
||||||
if (next3 === '===') {
|
if (next3 === '===') {
|
||||||
tokens.push({type: '=='});
|
tokens.push({type: '=='});
|
||||||
i += 3;
|
i += 3;
|
||||||
|
@ -86,7 +86,7 @@ function transform(babel) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const next2 = code.substring(i, i + 2);
|
const next2 = code.slice(i, i + 2);
|
||||||
switch (next2) {
|
switch (next2) {
|
||||||
case '&&':
|
case '&&':
|
||||||
case '||':
|
case '||':
|
||||||
|
|
|
@ -116,7 +116,7 @@ function mockAllConfigs(rendererInfo) {
|
||||||
// We want the reconciler to pick up the host config for this renderer.
|
// We want the reconciler to pick up the host config for this renderer.
|
||||||
jest.mock(path, () => {
|
jest.mock(path, () => {
|
||||||
let idx = path.lastIndexOf('/');
|
let idx = path.lastIndexOf('/');
|
||||||
let forkPath = path.substr(0, idx) + '/forks' + path.substr(idx);
|
let forkPath = path.slice(0, idx) + '/forks' + path.slice(idx);
|
||||||
return jest.requireActual(`${forkPath}.${rendererInfo.shortName}.js`);
|
return jest.requireActual(`${forkPath}.${rendererInfo.shortName}.js`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -76,7 +76,7 @@ if (process.env.REACT_CLASS_EQUIVALENCE_TEST) {
|
||||||
// Don't throw yet though b'c it might be accidentally caught and suppressed.
|
// Don't throw yet though b'c it might be accidentally caught and suppressed.
|
||||||
const stack = new Error().stack;
|
const stack = new Error().stack;
|
||||||
unexpectedConsoleCallStacks.push([
|
unexpectedConsoleCallStacks.push([
|
||||||
stack.substr(stack.indexOf('\n') + 1),
|
stack.slice(stack.indexOf('\n') + 1),
|
||||||
util.format(format, ...args),
|
util.format(format, ...args),
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
@ -178,7 +178,7 @@ if (process.env.REACT_CLASS_EQUIVALENCE_TEST) {
|
||||||
const args = matches[2]
|
const args = matches[2]
|
||||||
.split('&')
|
.split('&')
|
||||||
.filter(s => s.startsWith('args[]='))
|
.filter(s => s.startsWith('args[]='))
|
||||||
.map(s => s.substr('args[]='.length))
|
.map(s => s.slice('args[]='.length))
|
||||||
.map(decodeURIComponent);
|
.map(decodeURIComponent);
|
||||||
const format = errorMap[code];
|
const format = errorMap[code];
|
||||||
let argIndex = 0;
|
let argIndex = 0;
|
||||||
|
|
|
@ -118,7 +118,7 @@ const getDateStringForCommit = async commit => {
|
||||||
|
|
||||||
// On CI environment, this string is wrapped with quotes '...'s
|
// On CI environment, this string is wrapped with quotes '...'s
|
||||||
if (dateString.startsWith("'")) {
|
if (dateString.startsWith("'")) {
|
||||||
dateString = dateString.substr(1, 8);
|
dateString = dateString.slice(1, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dateString;
|
return dateString;
|
||||||
|
|
|
@ -36,7 +36,7 @@ let dateString = String(
|
||||||
|
|
||||||
// On CI environment, this string is wrapped with quotes '...'s
|
// On CI environment, this string is wrapped with quotes '...'s
|
||||||
if (dateString.startsWith("'")) {
|
if (dateString.startsWith("'")) {
|
||||||
dateString = dateString.substr(1, 8);
|
dateString = dateString.slice(1, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the artifacts using a placeholder React version. We'll then do a string
|
// Build the artifacts using a placeholder React version. We'll then do a string
|
||||||
|
@ -173,7 +173,7 @@ function processStable(buildDir) {
|
||||||
}
|
}
|
||||||
updatePlaceholderReactVersionInCompiledArtifacts(
|
updatePlaceholderReactVersionInCompiledArtifacts(
|
||||||
buildDir + '/facebook-www',
|
buildDir + '/facebook-www',
|
||||||
ReactVersion + '-www-classic-' + hash.digest('hex').substr(0, 8)
|
ReactVersion + '-www-classic-' + hash.digest('hex').slice(0, 8)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ function processExperimental(buildDir, version) {
|
||||||
}
|
}
|
||||||
updatePlaceholderReactVersionInCompiledArtifacts(
|
updatePlaceholderReactVersionInCompiledArtifacts(
|
||||||
buildDir + '/facebook-www',
|
buildDir + '/facebook-www',
|
||||||
ReactVersion + '-www-modern-' + hash.digest('hex').substr(0, 8)
|
ReactVersion + '-www-modern-' + hash.digest('hex').slice(0, 8)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ function getTarOptions(tgzName, packageName) {
|
||||||
entries: [CONTENTS_FOLDER],
|
entries: [CONTENTS_FOLDER],
|
||||||
map(header) {
|
map(header) {
|
||||||
if (header.name.indexOf(CONTENTS_FOLDER + '/') === 0) {
|
if (header.name.indexOf(CONTENTS_FOLDER + '/') === 0) {
|
||||||
header.name = header.name.substring(CONTENTS_FOLDER.length + 1);
|
header.name = header.name.slice(CONTENTS_FOLDER.length + 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue