@cypress/github-action 7.1.8 → 7.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +307 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15169,7 +15169,7 @@ function expand(str, isTop) {
15169
15169
  var y = numeric(n[1]);
15170
15170
  var width = Math.max(n[0].length, n[1].length)
15171
15171
  var incr = n.length == 3
15172
- ? Math.abs(numeric(n[2]))
15172
+ ? Math.max(Math.abs(numeric(n[2])), 1)
15173
15173
  : 1;
15174
15174
  var test = lte;
15175
15175
  var reverse = y < x;
@@ -15218,7 +15218,6 @@ function expand(str, isTop) {
15218
15218
  }
15219
15219
 
15220
15220
 
15221
-
15222
15221
  /***/ }),
15223
15222
 
15224
15223
  /***/ 60748:
@@ -26703,6 +26702,8 @@ const path = __nccwpck_require__(16928);
26703
26702
  const WIN_SLASH = '\\\\/';
26704
26703
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
26705
26704
 
26705
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
26706
+
26706
26707
  /**
26707
26708
  * Posix glob regex
26708
26709
  */
@@ -26766,6 +26767,7 @@ const WINDOWS_CHARS = {
26766
26767
  */
26767
26768
 
26768
26769
  const POSIX_REGEX_SOURCE = {
26770
+ __proto__: null,
26769
26771
  alnum: 'a-zA-Z0-9',
26770
26772
  alpha: 'a-zA-Z',
26771
26773
  ascii: '\\x00-\\x7F',
@@ -26783,6 +26785,7 @@ const POSIX_REGEX_SOURCE = {
26783
26785
  };
26784
26786
 
26785
26787
  module.exports = {
26788
+ DEFAULT_MAX_EXTGLOB_RECURSION,
26786
26789
  MAX_LENGTH: 1024 * 64,
26787
26790
  POSIX_REGEX_SOURCE,
26788
26791
 
@@ -26796,6 +26799,7 @@ module.exports = {
26796
26799
 
26797
26800
  // Replace globs with equivalent patterns to reduce parsing time.
26798
26801
  REPLACEMENTS: {
26802
+ __proto__: null,
26799
26803
  '***': '*',
26800
26804
  '**/**': '**',
26801
26805
  '**/**/**': '**'
@@ -26931,6 +26935,277 @@ const syntaxError = (type, char) => {
26931
26935
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
26932
26936
  };
26933
26937
 
26938
+ const splitTopLevel = input => {
26939
+ const parts = [];
26940
+ let bracket = 0;
26941
+ let paren = 0;
26942
+ let quote = 0;
26943
+ let value = '';
26944
+ let escaped = false;
26945
+
26946
+ for (const ch of input) {
26947
+ if (escaped === true) {
26948
+ value += ch;
26949
+ escaped = false;
26950
+ continue;
26951
+ }
26952
+
26953
+ if (ch === '\\') {
26954
+ value += ch;
26955
+ escaped = true;
26956
+ continue;
26957
+ }
26958
+
26959
+ if (ch === '"') {
26960
+ quote = quote === 1 ? 0 : 1;
26961
+ value += ch;
26962
+ continue;
26963
+ }
26964
+
26965
+ if (quote === 0) {
26966
+ if (ch === '[') {
26967
+ bracket++;
26968
+ } else if (ch === ']' && bracket > 0) {
26969
+ bracket--;
26970
+ } else if (bracket === 0) {
26971
+ if (ch === '(') {
26972
+ paren++;
26973
+ } else if (ch === ')' && paren > 0) {
26974
+ paren--;
26975
+ } else if (ch === '|' && paren === 0) {
26976
+ parts.push(value);
26977
+ value = '';
26978
+ continue;
26979
+ }
26980
+ }
26981
+ }
26982
+
26983
+ value += ch;
26984
+ }
26985
+
26986
+ parts.push(value);
26987
+ return parts;
26988
+ };
26989
+
26990
+ const isPlainBranch = branch => {
26991
+ let escaped = false;
26992
+
26993
+ for (const ch of branch) {
26994
+ if (escaped === true) {
26995
+ escaped = false;
26996
+ continue;
26997
+ }
26998
+
26999
+ if (ch === '\\') {
27000
+ escaped = true;
27001
+ continue;
27002
+ }
27003
+
27004
+ if (/[?*+@!()[\]{}]/.test(ch)) {
27005
+ return false;
27006
+ }
27007
+ }
27008
+
27009
+ return true;
27010
+ };
27011
+
27012
+ const normalizeSimpleBranch = branch => {
27013
+ let value = branch.trim();
27014
+ let changed = true;
27015
+
27016
+ while (changed === true) {
27017
+ changed = false;
27018
+
27019
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
27020
+ value = value.slice(2, -1);
27021
+ changed = true;
27022
+ }
27023
+ }
27024
+
27025
+ if (!isPlainBranch(value)) {
27026
+ return;
27027
+ }
27028
+
27029
+ return value.replace(/\\(.)/g, '$1');
27030
+ };
27031
+
27032
+ const hasRepeatedCharPrefixOverlap = branches => {
27033
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
27034
+
27035
+ for (let i = 0; i < values.length; i++) {
27036
+ for (let j = i + 1; j < values.length; j++) {
27037
+ const a = values[i];
27038
+ const b = values[j];
27039
+ const char = a[0];
27040
+
27041
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
27042
+ continue;
27043
+ }
27044
+
27045
+ if (a === b || a.startsWith(b) || b.startsWith(a)) {
27046
+ return true;
27047
+ }
27048
+ }
27049
+ }
27050
+
27051
+ return false;
27052
+ };
27053
+
27054
+ const parseRepeatedExtglob = (pattern, requireEnd = true) => {
27055
+ if ((pattern[0] !== '+' && pattern[0] !== '*') || pattern[1] !== '(') {
27056
+ return;
27057
+ }
27058
+
27059
+ let bracket = 0;
27060
+ let paren = 0;
27061
+ let quote = 0;
27062
+ let escaped = false;
27063
+
27064
+ for (let i = 1; i < pattern.length; i++) {
27065
+ const ch = pattern[i];
27066
+
27067
+ if (escaped === true) {
27068
+ escaped = false;
27069
+ continue;
27070
+ }
27071
+
27072
+ if (ch === '\\') {
27073
+ escaped = true;
27074
+ continue;
27075
+ }
27076
+
27077
+ if (ch === '"') {
27078
+ quote = quote === 1 ? 0 : 1;
27079
+ continue;
27080
+ }
27081
+
27082
+ if (quote === 1) {
27083
+ continue;
27084
+ }
27085
+
27086
+ if (ch === '[') {
27087
+ bracket++;
27088
+ continue;
27089
+ }
27090
+
27091
+ if (ch === ']' && bracket > 0) {
27092
+ bracket--;
27093
+ continue;
27094
+ }
27095
+
27096
+ if (bracket > 0) {
27097
+ continue;
27098
+ }
27099
+
27100
+ if (ch === '(') {
27101
+ paren++;
27102
+ continue;
27103
+ }
27104
+
27105
+ if (ch === ')') {
27106
+ paren--;
27107
+
27108
+ if (paren === 0) {
27109
+ if (requireEnd === true && i !== pattern.length - 1) {
27110
+ return;
27111
+ }
27112
+
27113
+ return {
27114
+ type: pattern[0],
27115
+ body: pattern.slice(2, i),
27116
+ end: i
27117
+ };
27118
+ }
27119
+ }
27120
+ }
27121
+ };
27122
+
27123
+ const getStarExtglobSequenceOutput = pattern => {
27124
+ let index = 0;
27125
+ const chars = [];
27126
+
27127
+ while (index < pattern.length) {
27128
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
27129
+
27130
+ if (!match || match.type !== '*') {
27131
+ return;
27132
+ }
27133
+
27134
+ const branches = splitTopLevel(match.body).map(branch => branch.trim());
27135
+ if (branches.length !== 1) {
27136
+ return;
27137
+ }
27138
+
27139
+ const branch = normalizeSimpleBranch(branches[0]);
27140
+ if (!branch || branch.length !== 1) {
27141
+ return;
27142
+ }
27143
+
27144
+ chars.push(branch);
27145
+ index += match.end + 1;
27146
+ }
27147
+
27148
+ if (chars.length < 1) {
27149
+ return;
27150
+ }
27151
+
27152
+ const source = chars.length === 1
27153
+ ? utils.escapeRegex(chars[0])
27154
+ : `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;
27155
+
27156
+ return `${source}*`;
27157
+ };
27158
+
27159
+ const repeatedExtglobRecursion = pattern => {
27160
+ let depth = 0;
27161
+ let value = pattern.trim();
27162
+ let match = parseRepeatedExtglob(value);
27163
+
27164
+ while (match) {
27165
+ depth++;
27166
+ value = match.body.trim();
27167
+ match = parseRepeatedExtglob(value);
27168
+ }
27169
+
27170
+ return depth;
27171
+ };
27172
+
27173
+ const analyzeRepeatedExtglob = (body, options) => {
27174
+ if (options.maxExtglobRecursion === false) {
27175
+ return { risky: false };
27176
+ }
27177
+
27178
+ const max =
27179
+ typeof options.maxExtglobRecursion === 'number'
27180
+ ? options.maxExtglobRecursion
27181
+ : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
27182
+
27183
+ const branches = splitTopLevel(body).map(branch => branch.trim());
27184
+
27185
+ if (branches.length > 1) {
27186
+ if (
27187
+ branches.some(branch => branch === '') ||
27188
+ branches.some(branch => /^[*?]+$/.test(branch)) ||
27189
+ hasRepeatedCharPrefixOverlap(branches)
27190
+ ) {
27191
+ return { risky: true };
27192
+ }
27193
+ }
27194
+
27195
+ for (const branch of branches) {
27196
+ const safeOutput = getStarExtglobSequenceOutput(branch);
27197
+ if (safeOutput) {
27198
+ return { risky: true, safeOutput };
27199
+ }
27200
+
27201
+ if (repeatedExtglobRecursion(branch) > max) {
27202
+ return { risky: true };
27203
+ }
27204
+ }
27205
+
27206
+ return { risky: false };
27207
+ };
27208
+
26934
27209
  /**
26935
27210
  * Parse the given input string.
26936
27211
  * @param {String} input
@@ -27112,6 +27387,8 @@ const parse = (input, options) => {
27112
27387
  token.prev = prev;
27113
27388
  token.parens = state.parens;
27114
27389
  token.output = state.output;
27390
+ token.startIndex = state.index;
27391
+ token.tokensIndex = tokens.length;
27115
27392
  const output = (opts.capture ? '(' : '') + token.open;
27116
27393
 
27117
27394
  increment('parens');
@@ -27121,6 +27398,34 @@ const parse = (input, options) => {
27121
27398
  };
27122
27399
 
27123
27400
  const extglobClose = token => {
27401
+ const literal = input.slice(token.startIndex, state.index + 1);
27402
+ const body = input.slice(token.startIndex + 2, state.index);
27403
+ const analysis = analyzeRepeatedExtglob(body, opts);
27404
+
27405
+ if ((token.type === 'plus' || token.type === 'star') && analysis.risky) {
27406
+ const safeOutput = analysis.safeOutput
27407
+ ? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput)
27408
+ : undefined;
27409
+ const open = tokens[token.tokensIndex];
27410
+
27411
+ open.type = 'text';
27412
+ open.value = literal;
27413
+ open.output = safeOutput || utils.escapeRegex(literal);
27414
+
27415
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
27416
+ tokens[i].value = '';
27417
+ tokens[i].output = '';
27418
+ delete tokens[i].suffix;
27419
+ }
27420
+
27421
+ state.output = token.output + open.output;
27422
+ state.backtrack = true;
27423
+
27424
+ push({ type: 'paren', extglob: true, value, output: '' });
27425
+ decrement('parens');
27426
+ return;
27427
+ }
27428
+
27124
27429
  let output = token.close + (opts.capture ? ')' : '');
27125
27430
  let rest;
27126
27431
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/github-action",
3
- "version": "7.1.8",
3
+ "version": "7.1.9",
4
4
  "description": "GitHub Action for running Cypress end-to-end and component tests",
5
5
  "private": false,
6
6
  "main": "dist/index.js",