@@ -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 *
@@ -737076,7 +737095,11 @@ class GithubUtils {
737076737095 * @private
737077737096 */
737078737097 static initOctokit() {
737079- const token = core.getInput('GITHUB_TOKEN', { required: true });
737098+ const token = process.env.GITHUB_TOKEN ?? core.getInput('GITHUB_TOKEN', { required: true });
737099+ if (!token) {
737100+ console.error('GitHubUtils could not find GITHUB_TOKEN');
737101+ process.exit(1);
737102+ }
737080737103 this.initOctokitWithToken(token);
737081737104 }
737082737105 /**
0 commit comments