External Libraries: Update `moment` to version `2.29.2`.

See #55547.
Built from https://develop.svn.wordpress.org/trunk@53163


git-svn-id: http://core.svn.wordpress.org/trunk@52752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2022-04-12 16:52:23 +00:00
parent fd9d7a7547
commit e15e2d78bf
4 changed files with 98 additions and 83 deletions

View File

@ -1,5 +1,5 @@
//! moment.js //! moment.js
//! version : 2.29.1 //! version : 2.29.2
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT //! license : MIT
//! momentjs.com //! momentjs.com
@ -76,8 +76,9 @@
function map(arr, fn) { function map(arr, fn) {
var res = [], var res = [],
i; i,
for (i = 0; i < arr.length; ++i) { arrLen = arr.length;
for (i = 0; i < arrLen; ++i) {
res.push(fn(arr[i], i)); res.push(fn(arr[i], i));
} }
return res; return res;
@ -206,7 +207,10 @@
updateInProgress = false; updateInProgress = false;
function copyConfig(to, from) { function copyConfig(to, from) {
var i, prop, val; var i,
prop,
val,
momentPropertiesLen = momentProperties.length;
if (!isUndefined(from._isAMomentObject)) { if (!isUndefined(from._isAMomentObject)) {
to._isAMomentObject = from._isAMomentObject; to._isAMomentObject = from._isAMomentObject;
@ -239,8 +243,8 @@
to._locale = from._locale; to._locale = from._locale;
} }
if (momentProperties.length > 0) { if (momentPropertiesLen > 0) {
for (i = 0; i < momentProperties.length; i++) { for (i = 0; i < momentPropertiesLen; i++) {
prop = momentProperties[i]; prop = momentProperties[i];
val = from[prop]; val = from[prop];
if (!isUndefined(val)) { if (!isUndefined(val)) {
@ -295,8 +299,9 @@
var args = [], var args = [],
arg, arg,
i, i,
key; key,
for (i = 0; i < arguments.length; i++) { argLen = arguments.length;
for (i = 0; i < argLen; i++) {
arg = ''; arg = '';
if (typeof arguments[i] === 'object') { if (typeof arguments[i] === 'object') {
arg += '\n[' + i + '] '; arg += '\n[' + i + '] ';
@ -446,7 +451,8 @@
); );
} }
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, var formattingTokens =
/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
formatFunctions = {}, formatFunctions = {},
formatTokenFunctions = {}; formatTokenFunctions = {};
@ -750,8 +756,9 @@
if (typeof units === 'object') { if (typeof units === 'object') {
units = normalizeObjectUnits(units); units = normalizeObjectUnits(units);
var prioritized = getPrioritizedUnits(units), var prioritized = getPrioritizedUnits(units),
i; i,
for (i = 0; i < prioritized.length; i++) { prioritizedLen = prioritized.length;
for (i = 0; i < prioritizedLen; i++) {
this[prioritized[i].unit](units[prioritized[i].unit]); this[prioritized[i].unit](units[prioritized[i].unit]);
} }
} else { } else {
@ -781,7 +788,8 @@
matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
// any word (or two) characters or numbers including two/three word month in arabic. // any word (or two) characters or numbers including two/three word month in arabic.
// includes scottish gaelic two word and hyphenated months // includes scottish gaelic two word and hyphenated months
matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, matchWord =
/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
regexes; regexes;
regexes = {}; regexes = {};
@ -807,15 +815,12 @@
return regexEscape( return regexEscape(
s s
.replace('\\', '') .replace('\\', '')
.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function ( .replace(
matched, /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
p1, function (matched, p1, p2, p3, p4) {
p2, return p1 || p2 || p3 || p4;
p3, }
p4 )
) {
return p1 || p2 || p3 || p4;
})
); );
} }
@ -827,7 +832,8 @@
function addParseToken(token, callback) { function addParseToken(token, callback) {
var i, var i,
func = callback; func = callback,
tokenLen;
if (typeof token === 'string') { if (typeof token === 'string') {
token = [token]; token = [token];
} }
@ -836,7 +842,8 @@
array[callback] = toInt(input); array[callback] = toInt(input);
}; };
} }
for (i = 0; i < token.length; i++) { tokenLen = token.length;
for (i = 0; i < tokenLen; i++) {
tokens[token[i]] = func; tokens[token[i]] = func;
} }
} }
@ -947,12 +954,12 @@
// LOCALES // LOCALES
var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split( var defaultLocaleMonths =
'_' 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
), '_'
defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split( ),
'_' defaultLocaleMonthsShort =
), 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
defaultMonthsShortRegex = matchWord, defaultMonthsShortRegex = matchWord,
defaultMonthsRegex = matchWord; defaultMonthsRegex = matchWord;
@ -1394,14 +1401,12 @@
addRegexToken('W', match1to2); addRegexToken('W', match1to2);
addRegexToken('WW', match1to2, match2); addRegexToken('WW', match1to2, match2);
addWeekParseToken(['w', 'ww', 'W', 'WW'], function ( addWeekParseToken(
input, ['w', 'ww', 'W', 'WW'],
week, function (input, week, config, token) {
config, week[token.substr(0, 1)] = toInt(input);
token }
) { );
week[token.substr(0, 1)] = toInt(input);
});
// HELPERS // HELPERS
@ -1526,9 +1531,8 @@
return ws.slice(n, 7).concat(ws.slice(0, n)); return ws.slice(n, 7).concat(ws.slice(0, n));
} }
var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( var defaultLocaleWeekdays =
'_' 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
),
defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
defaultWeekdaysRegex = matchWord, defaultWeekdaysRegex = matchWord,
@ -2076,6 +2080,11 @@
return globalLocale; return globalLocale;
} }
function isLocaleNameSane(name) {
// Prevent names that look like filesystem paths, i.e contain '/' or '\'
return name.match('^[^/\\\\]*$') != null;
}
function loadLocale(name) { function loadLocale(name) {
var oldLocale = null, var oldLocale = null,
aliasedRequire; aliasedRequire;
@ -2084,7 +2093,8 @@
locales[name] === undefined && locales[name] === undefined &&
typeof module !== 'undefined' && typeof module !== 'undefined' &&
module && module &&
module.exports module.exports &&
isLocaleNameSane(name)
) { ) {
try { try {
oldLocale = globalLocale._abbr; oldLocale = globalLocale._abbr;
@ -2301,8 +2311,10 @@
// iso 8601 regex // iso 8601 regex
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, var extendedIsoRegex =
basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
basicIsoRegex =
/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
isoDates = [ isoDates = [
['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
@ -2333,7 +2345,8 @@
], ],
aspNetJsonRegex = /^\/?Date\((-?\d+)/i, aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, rfc2822 =
/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
obsOffsets = { obsOffsets = {
UT: 0, UT: 0,
GMT: 0, GMT: 0,
@ -2356,12 +2369,13 @@
allowTime, allowTime,
dateFormat, dateFormat,
timeFormat, timeFormat,
tzFormat; tzFormat,
isoDatesLen = isoDates.length,
isoTimesLen = isoTimes.length;
if (match) { if (match) {
getParsingFlags(config).iso = true; getParsingFlags(config).iso = true;
for (i = 0, l = isoDatesLen; i < l; i++) {
for (i = 0, l = isoDates.length; i < l; i++) {
if (isoDates[i][1].exec(match[1])) { if (isoDates[i][1].exec(match[1])) {
dateFormat = isoDates[i][0]; dateFormat = isoDates[i][0];
allowTime = isoDates[i][2] !== false; allowTime = isoDates[i][2] !== false;
@ -2373,7 +2387,7 @@
return; return;
} }
if (match[3]) { if (match[3]) {
for (i = 0, l = isoTimes.length; i < l; i++) { for (i = 0, l = isoTimesLen; i < l; i++) {
if (isoTimes[i][1].exec(match[3])) { if (isoTimes[i][1].exec(match[3])) {
// match[2] should be 'T' or space // match[2] should be 'T' or space
timeFormat = (match[2] || ' ') + isoTimes[i][0]; timeFormat = (match[2] || ' ') + isoTimes[i][0];
@ -2753,12 +2767,13 @@
skipped, skipped,
stringLength = string.length, stringLength = string.length,
totalParsedInputLength = 0, totalParsedInputLength = 0,
era; era,
tokenLen;
tokens = tokens =
expandFormat(config._f, config._locale).match(formattingTokens) || []; expandFormat(config._f, config._locale).match(formattingTokens) || [];
tokenLen = tokens.length;
for (i = 0; i < tokens.length; i++) { for (i = 0; i < tokenLen; i++) {
token = tokens[i]; token = tokens[i];
parsedInput = (string.match(getParseRegexForToken(token, config)) || parsedInput = (string.match(getParseRegexForToken(token, config)) ||
[])[0]; [])[0];
@ -2853,15 +2868,16 @@
i, i,
currentScore, currentScore,
validFormatFound, validFormatFound,
bestFormatIsValid = false; bestFormatIsValid = false,
configfLen = config._f.length;
if (config._f.length === 0) { if (configfLen === 0) {
getParsingFlags(config).invalidFormat = true; getParsingFlags(config).invalidFormat = true;
config._d = new Date(NaN); config._d = new Date(NaN);
return; return;
} }
for (i = 0; i < config._f.length; i++) { for (i = 0; i < configfLen; i++) {
currentScore = 0; currentScore = 0;
validFormatFound = false; validFormatFound = false;
tempConfig = copyConfig({}, config); tempConfig = copyConfig({}, config);
@ -3102,7 +3118,8 @@
function isDurationValid(m) { function isDurationValid(m) {
var key, var key,
unitHasDecimal = false, unitHasDecimal = false,
i; i,
orderLen = ordering.length;
for (key in m) { for (key in m) {
if ( if (
hasOwnProp(m, key) && hasOwnProp(m, key) &&
@ -3115,7 +3132,7 @@
} }
} }
for (i = 0; i < ordering.length; ++i) { for (i = 0; i < orderLen; ++i) {
if (m[ordering[i]]) { if (m[ordering[i]]) {
if (unitHasDecimal) { if (unitHasDecimal) {
return false; // only allow non-integers for smallest unit return false; // only allow non-integers for smallest unit
@ -3440,7 +3457,8 @@
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
// and further modified to allow for strings containing both week and day // and further modified to allow for strings containing both week and day
isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; isoRegex =
/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function createDuration(input, key) { function createDuration(input, key) {
var duration = input, var duration = input,
@ -3661,9 +3679,10 @@
'ms', 'ms',
], ],
i, i,
property; property,
propertyLen = properties.length;
for (i = 0; i < properties.length; i += 1) { for (i = 0; i < propertyLen; i += 1) {
property = properties[i]; property = properties[i];
propertyTest = propertyTest || hasOwnProp(input, property); propertyTest = propertyTest || hasOwnProp(input, property);
} }
@ -4286,19 +4305,17 @@
addRegexToken('NNNN', matchEraName); addRegexToken('NNNN', matchEraName);
addRegexToken('NNNNN', matchEraNarrow); addRegexToken('NNNNN', matchEraNarrow);
addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function ( addParseToken(
input, ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],
array, function (input, array, config, token) {
config, var era = config._locale.erasParse(input, token, config._strict);
token if (era) {
) { getParsingFlags(config).era = era;
var era = config._locale.erasParse(input, token, config._strict); } else {
if (era) { getParsingFlags(config).invalidEra = input;
getParsingFlags(config).era = era; }
} else {
getParsingFlags(config).invalidEra = input;
} }
}); );
addRegexToken('y', matchUnsigned); addRegexToken('y', matchUnsigned);
addRegexToken('yy', matchUnsigned); addRegexToken('yy', matchUnsigned);
@ -4590,14 +4607,12 @@
addRegexToken('GGGGG', match1to6, match6); addRegexToken('GGGGG', match1to6, match6);
addRegexToken('ggggg', match1to6, match6); addRegexToken('ggggg', match1to6, match6);
addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function ( addWeekParseToken(
input, ['gggg', 'ggggg', 'GGGG', 'GGGGG'],
week, function (input, week, config, token) {
config, week[token.substr(0, 2)] = toInt(input);
token }
) { );
week[token.substr(0, 2)] = toInt(input);
});
addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
week[token] = hooks.parseTwoDigitYear(input); week[token] = hooks.parseTwoDigitYear(input);
@ -5620,7 +5635,7 @@
//! moment.js //! moment.js
hooks.version = '2.29.1'; hooks.version = '2.29.2';
setHookCallback(createLocal); setHookCallback(createLocal);

File diff suppressed because one or more lines are too long

View File

@ -106,7 +106,7 @@ function wp_default_packages_vendor( $scripts ) {
'react' => '17.0.1', 'react' => '17.0.1',
'react-dom' => '17.0.1', 'react-dom' => '17.0.1',
'regenerator-runtime' => '0.13.9', 'regenerator-runtime' => '0.13.9',
'moment' => '2.29.1', 'moment' => '2.29.2',
'lodash' => '4.17.19', 'lodash' => '4.17.19',
'wp-polyfill-fetch' => '3.6.2', 'wp-polyfill-fetch' => '3.6.2',
'wp-polyfill-formdata' => '4.0.0', 'wp-polyfill-formdata' => '4.0.0',

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.0-alpha-53162'; $wp_version = '6.0-alpha-53163';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.