Skip to content

Commit a2fb334

Browse files
resolve merge conflicts
2 parents a0f2355 + 080bd33 commit a2fb334

222 files changed

Lines changed: 3538 additions & 5231 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/javascript/authorChecklist/index.js

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8609,6 +8609,7 @@ function useColors() {
86098609

86108610
// Is webkit? http://stackoverflow.com/a/16459606/376773
86118611
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
8612+
// eslint-disable-next-line no-return-assign
86128613
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
86138614
// Is firebug? http://stackoverflow.com/a/398120/376773
86148615
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
@@ -8924,24 +8925,62 @@ function setup(env) {
89248925
createDebug.names = [];
89258926
createDebug.skips = [];
89268927

8927-
let i;
8928-
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
8929-
const len = split.length;
8928+
const split = (typeof namespaces === 'string' ? namespaces : '')
8929+
.trim()
8930+
.replace(' ', ',')
8931+
.split(',')
8932+
.filter(Boolean);
89308933

8931-
for (i = 0; i < len; i++) {
8932-
if (!split[i]) {
8933-
// ignore empty strings
8934-
continue;
8934+
for (const ns of split) {
8935+
if (ns[0] === '-') {
8936+
createDebug.skips.push(ns.slice(1));
8937+
} else {
8938+
createDebug.names.push(ns);
89358939
}
8940+
}
8941+
}
89368942

8937-
namespaces = split[i].replace(/\*/g, '.*?');
8938-
8939-
if (namespaces[0] === '-') {
8940-
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
8943+
/**
8944+
* Checks if the given string matches a namespace template, honoring
8945+
* asterisks as wildcards.
8946+
*
8947+
* @param {String} search
8948+
* @param {String} template
8949+
* @return {Boolean}
8950+
*/
8951+
function matchesTemplate(search, template) {
8952+
let searchIndex = 0;
8953+
let templateIndex = 0;
8954+
let starIndex = -1;
8955+
let matchIndex = 0;
8956+
8957+
while (searchIndex < search.length) {
8958+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
8959+
// Match character or proceed with wildcard
8960+
if (template[templateIndex] === '*') {
8961+
starIndex = templateIndex;
8962+
matchIndex = searchIndex;
8963+
templateIndex++; // Skip the '*'
8964+
} else {
8965+
searchIndex++;
8966+
templateIndex++;
8967+
}
8968+
} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
8969+
// Backtrack to the last '*' and try to match more characters
8970+
templateIndex = starIndex + 1;
8971+
matchIndex++;
8972+
searchIndex = matchIndex;
89418973
} else {
8942-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
8974+
return false; // No match
89438975
}
89448976
}
8977+
8978+
// Handle trailing '*' in template
8979+
while (templateIndex < template.length && template[templateIndex] === '*') {
8980+
templateIndex++;
8981+
}
8982+
8983+
return templateIndex === template.length;
89458984
}
89468985

89478986
/**
@@ -8952,8 +8991,8 @@ function setup(env) {
89528991
*/
89538992
function disable() {
89548993
const namespaces = [
8955-
...createDebug.names.map(toNamespace),
8956-
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
8994+
...createDebug.names,
8995+
...createDebug.skips.map(namespace => '-' + namespace)
89578996
].join(',');
89588997
createDebug.enable('');
89598998
return namespaces;
@@ -8967,41 +9006,21 @@ function setup(env) {
89679006
* @api public
89689007
*/
89699008
function enabled(name) {
8970-
if (name[name.length - 1] === '*') {
8971-
return true;
8972-
}
8973-
8974-
let i;
8975-
let len;
8976-
8977-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
8978-
if (createDebug.skips[i].test(name)) {
9009+
for (const skip of createDebug.skips) {
9010+
if (matchesTemplate(name, skip)) {
89799011
return false;
89809012
}
89819013
}
89829014

8983-
for (i = 0, len = createDebug.names.length; i < len; i++) {
8984-
if (createDebug.names[i].test(name)) {
9015+
for (const ns of createDebug.names) {
9016+
if (matchesTemplate(name, ns)) {
89859017
return true;
89869018
}
89879019
}
89889020

89899021
return false;
89909022
}
89919023

8992-
/**
8993-
* Convert regexp to namespace
8994-
*
8995-
* @param {RegExp} regxep
8996-
* @return {String} namespace
8997-
* @api private
8998-
*/
8999-
function toNamespace(regexp) {
9000-
return regexp.toString()
9001-
.substring(2, regexp.toString().length - 2)
9002-
.replace(/\.\*\?$/, '*');
9003-
}
9004-
90059024
/**
90069025
* Coerce `val`.
90079026
*

.github/actions/javascript/checkAndroidStatus/index.js

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9870,6 +9870,7 @@ function useColors() {
98709870

98719871
// Is webkit? http://stackoverflow.com/a/16459606/376773
98729872
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
9873+
// eslint-disable-next-line no-return-assign
98739874
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
98749875
// Is firebug? http://stackoverflow.com/a/398120/376773
98759876
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
@@ -10185,24 +10186,62 @@ function setup(env) {
1018510186
createDebug.names = [];
1018610187
createDebug.skips = [];
1018710188

10188-
let i;
10189-
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
10190-
const len = split.length;
10189+
const split = (typeof namespaces === 'string' ? namespaces : '')
10190+
.trim()
10191+
.replace(' ', ',')
10192+
.split(',')
10193+
.filter(Boolean);
1019110194

10192-
for (i = 0; i < len; i++) {
10193-
if (!split[i]) {
10194-
// ignore empty strings
10195-
continue;
10195+
for (const ns of split) {
10196+
if (ns[0] === '-') {
10197+
createDebug.skips.push(ns.slice(1));
10198+
} else {
10199+
createDebug.names.push(ns);
1019610200
}
10201+
}
10202+
}
1019710203

10198-
namespaces = split[i].replace(/\*/g, '.*?');
10199-
10200-
if (namespaces[0] === '-') {
10201-
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
10204+
/**
10205+
* Checks if the given string matches a namespace template, honoring
10206+
* asterisks as wildcards.
10207+
*
10208+
* @param {String} search
10209+
* @param {String} template
10210+
* @return {Boolean}
10211+
*/
10212+
function matchesTemplate(search, template) {
10213+
let searchIndex = 0;
10214+
let templateIndex = 0;
10215+
let starIndex = -1;
10216+
let matchIndex = 0;
10217+
10218+
while (searchIndex < search.length) {
10219+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
10220+
// Match character or proceed with wildcard
10221+
if (template[templateIndex] === '*') {
10222+
starIndex = templateIndex;
10223+
matchIndex = searchIndex;
10224+
templateIndex++; // Skip the '*'
10225+
} else {
10226+
searchIndex++;
10227+
templateIndex++;
10228+
}
10229+
} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
10230+
// Backtrack to the last '*' and try to match more characters
10231+
templateIndex = starIndex + 1;
10232+
matchIndex++;
10233+
searchIndex = matchIndex;
1020210234
} else {
10203-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
10235+
return false; // No match
1020410236
}
1020510237
}
10238+
10239+
// Handle trailing '*' in template
10240+
while (templateIndex < template.length && template[templateIndex] === '*') {
10241+
templateIndex++;
10242+
}
10243+
10244+
return templateIndex === template.length;
1020610245
}
1020710246

1020810247
/**
@@ -10213,8 +10252,8 @@ function setup(env) {
1021310252
*/
1021410253
function disable() {
1021510254
const namespaces = [
10216-
...createDebug.names.map(toNamespace),
10217-
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
10255+
...createDebug.names,
10256+
...createDebug.skips.map(namespace => '-' + namespace)
1021810257
].join(',');
1021910258
createDebug.enable('');
1022010259
return namespaces;
@@ -10228,41 +10267,21 @@ function setup(env) {
1022810267
* @api public
1022910268
*/
1023010269
function enabled(name) {
10231-
if (name[name.length - 1] === '*') {
10232-
return true;
10233-
}
10234-
10235-
let i;
10236-
let len;
10237-
10238-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
10239-
if (createDebug.skips[i].test(name)) {
10270+
for (const skip of createDebug.skips) {
10271+
if (matchesTemplate(name, skip)) {
1024010272
return false;
1024110273
}
1024210274
}
1024310275

10244-
for (i = 0, len = createDebug.names.length; i < len; i++) {
10245-
if (createDebug.names[i].test(name)) {
10276+
for (const ns of createDebug.names) {
10277+
if (matchesTemplate(name, ns)) {
1024610278
return true;
1024710279
}
1024810280
}
1024910281

1025010282
return false;
1025110283
}
1025210284

10253-
/**
10254-
* Convert regexp to namespace
10255-
*
10256-
* @param {RegExp} regxep
10257-
* @return {String} namespace
10258-
* @api private
10259-
*/
10260-
function toNamespace(regexp) {
10261-
return regexp.toString()
10262-
.substring(2, regexp.toString().length - 2)
10263-
.replace(/\.\*\?$/, '*');
10264-
}
10265-
1026610285
/**
1026710286
* Coerce `val`.
1026810287
*

0 commit comments

Comments
 (0)