immosquare-cleaner 0.1.46 → 0.1.47

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/immosquare-cleaner/version.rb +1 -1
  3. data/linters/rubocop-3.3.4.yml +2 -0
  4. data/linters/rubocop.yml +2 -0
  5. data/node_modules/@eslint/eslintrc/node_modules/ignore/LICENSE-MIT +21 -0
  6. data/node_modules/@eslint/eslintrc/node_modules/ignore/README.md +412 -0
  7. data/node_modules/@eslint/eslintrc/node_modules/ignore/index.d.ts +61 -0
  8. data/node_modules/@eslint/eslintrc/node_modules/ignore/index.js +618 -0
  9. data/node_modules/@eslint/eslintrc/node_modules/ignore/legacy.js +539 -0
  10. data/node_modules/@eslint/eslintrc/node_modules/ignore/package.json +73 -0
  11. data/node_modules/@eslint/js/package.json +1 -1
  12. data/node_modules/@eslint/plugin-kit/LICENSE +201 -0
  13. data/node_modules/@eslint/plugin-kit/README.md +224 -0
  14. data/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs +555 -0
  15. data/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts +239 -0
  16. data/node_modules/@eslint/plugin-kit/dist/cjs/types.ts +7 -0
  17. data/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts +239 -0
  18. data/node_modules/@eslint/plugin-kit/dist/esm/index.js +551 -0
  19. data/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts +6 -0
  20. data/node_modules/@eslint/plugin-kit/dist/esm/types.ts +7 -0
  21. data/node_modules/@eslint/plugin-kit/package.json +62 -0
  22. data/node_modules/eslint/README.md +2 -2
  23. data/node_modules/eslint/lib/config/config.js +278 -0
  24. data/node_modules/eslint/lib/config/flat-config-array.js +3 -204
  25. data/node_modules/eslint/lib/languages/js/source-code/source-code.js +29 -94
  26. data/node_modules/eslint/lib/linter/apply-disable-directives.js +17 -28
  27. data/node_modules/eslint/lib/linter/file-context.js +134 -0
  28. data/node_modules/eslint/lib/linter/linter.js +37 -42
  29. data/node_modules/eslint/lib/rules/id-length.js +1 -0
  30. data/node_modules/eslint/lib/rules/no-invalid-regexp.js +34 -18
  31. data/node_modules/eslint/lib/rules/require-unicode-regexp.js +95 -14
  32. data/node_modules/eslint/lib/rules/utils/regular-expressions.js +11 -3
  33. data/node_modules/eslint/lib/types/index.d.ts +1635 -0
  34. data/node_modules/eslint/lib/types/rules/best-practices.d.ts +1075 -0
  35. data/node_modules/eslint/lib/types/rules/deprecated.d.ts +294 -0
  36. data/node_modules/eslint/lib/types/rules/ecmascript-6.d.ts +561 -0
  37. data/node_modules/eslint/lib/types/rules/index.d.ts +50 -0
  38. data/node_modules/eslint/lib/types/rules/node-commonjs.d.ts +160 -0
  39. data/node_modules/eslint/lib/types/rules/possible-errors.d.ts +598 -0
  40. data/node_modules/eslint/lib/types/rules/strict-mode.d.ts +38 -0
  41. data/node_modules/eslint/lib/types/rules/stylistic-issues.d.ts +1932 -0
  42. data/node_modules/eslint/lib/types/rules/variables.d.ts +221 -0
  43. data/node_modules/eslint/lib/types/use-at-your-own-risk.d.ts +85 -0
  44. data/node_modules/eslint/package.json +20 -8
  45. data/node_modules/ignore/index.d.ts +1 -1
  46. data/node_modules/ignore/index.js +25 -7
  47. data/node_modules/ignore/legacy.js +34 -14
  48. data/node_modules/ignore/package.json +12 -11
  49. data/node_modules/npm-check-updates/build/index.js +282 -282
  50. data/node_modules/npm-check-updates/build/index.js.map +1 -1
  51. data/node_modules/npm-check-updates/package.json +1 -1
  52. data/package.json +3 -3
  53. metadata +31 -4
  54. data/linters/rubocop-2.7.6.yml +0 -88
  55. data/node_modules/eslint/lib/linter/config-comment-parser.js +0 -169
@@ -0,0 +1,618 @@
1
+ // A simple implementation of make-array
2
+ function makeArray (subject) {
3
+ return Array.isArray(subject)
4
+ ? subject
5
+ : [subject]
6
+ }
7
+
8
+ const EMPTY = ''
9
+ const SPACE = ' '
10
+ const ESCAPE = '\\'
11
+ const REGEX_TEST_BLANK_LINE = /^\s+$/
12
+ const REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/
13
+ const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/
14
+ const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/
15
+ const REGEX_SPLITALL_CRLF = /\r?\n/g
16
+ // /foo,
17
+ // ./foo,
18
+ // ../foo,
19
+ // .
20
+ // ..
21
+ const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/
22
+
23
+ const SLASH = '/'
24
+
25
+ // Do not use ternary expression here, since "istanbul ignore next" is buggy
26
+ let TMP_KEY_IGNORE = 'node-ignore'
27
+ /* istanbul ignore else */
28
+ if (typeof Symbol !== 'undefined') {
29
+ TMP_KEY_IGNORE = Symbol.for('node-ignore')
30
+ }
31
+ const KEY_IGNORE = TMP_KEY_IGNORE
32
+
33
+ const define = (object, key, value) =>
34
+ Object.defineProperty(object, key, {value})
35
+
36
+ const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g
37
+
38
+ const RETURN_FALSE = () => false
39
+
40
+ // Sanitize the range of a regular expression
41
+ // The cases are complicated, see test cases for details
42
+ const sanitizeRange = range => range.replace(
43
+ REGEX_REGEXP_RANGE,
44
+ (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)
45
+ ? match
46
+ // Invalid range (out of order) which is ok for gitignore rules but
47
+ // fatal for JavaScript regular expression, so eliminate it.
48
+ : EMPTY
49
+ )
50
+
51
+ // See fixtures #59
52
+ const cleanRangeBackSlash = slashes => {
53
+ const {length} = slashes
54
+ return slashes.slice(0, length - length % 2)
55
+ }
56
+
57
+ // > If the pattern ends with a slash,
58
+ // > it is removed for the purpose of the following description,
59
+ // > but it would only find a match with a directory.
60
+ // > In other words, foo/ will match a directory foo and paths underneath it,
61
+ // > but will not match a regular file or a symbolic link foo
62
+ // > (this is consistent with the way how pathspec works in general in Git).
63
+ // '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
64
+ // -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
65
+ // you could use option `mark: true` with `glob`
66
+
67
+ // '`foo/`' should not continue with the '`..`'
68
+ const REPLACERS = [
69
+
70
+ // > Trailing spaces are ignored unless they are quoted with backslash ("\")
71
+ [
72
+ // (a\ ) -> (a )
73
+ // (a ) -> (a)
74
+ // (a \ ) -> (a )
75
+ /\\?\s+$/,
76
+ match => match.indexOf('\\') === 0
77
+ ? SPACE
78
+ : EMPTY
79
+ ],
80
+
81
+ // replace (\ ) with ' '
82
+ [
83
+ /\\\s/g,
84
+ () => SPACE
85
+ ],
86
+
87
+ // Escape metacharacters
88
+ // which is written down by users but means special for regular expressions.
89
+
90
+ // > There are 12 characters with special meanings:
91
+ // > - the backslash \,
92
+ // > - the caret ^,
93
+ // > - the dollar sign $,
94
+ // > - the period or dot .,
95
+ // > - the vertical bar or pipe symbol |,
96
+ // > - the question mark ?,
97
+ // > - the asterisk or star *,
98
+ // > - the plus sign +,
99
+ // > - the opening parenthesis (,
100
+ // > - the closing parenthesis ),
101
+ // > - and the opening square bracket [,
102
+ // > - the opening curly brace {,
103
+ // > These special characters are often called "metacharacters".
104
+ [
105
+ /[\\$.|*+(){^]/g,
106
+ match => `\\${match}`
107
+ ],
108
+
109
+ [
110
+ // > a question mark (?) matches a single character
111
+ /(?!\\)\?/g,
112
+ () => '[^/]'
113
+ ],
114
+
115
+ // leading slash
116
+ [
117
+
118
+ // > A leading slash matches the beginning of the pathname.
119
+ // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
120
+ // A leading slash matches the beginning of the pathname
121
+ /^\//,
122
+ () => '^'
123
+ ],
124
+
125
+ // replace special metacharacter slash after the leading slash
126
+ [
127
+ /\//g,
128
+ () => '\\/'
129
+ ],
130
+
131
+ [
132
+ // > A leading "**" followed by a slash means match in all directories.
133
+ // > For example, "**/foo" matches file or directory "foo" anywhere,
134
+ // > the same as pattern "foo".
135
+ // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
136
+ // > under directory "foo".
137
+ // Notice that the '*'s have been replaced as '\\*'
138
+ /^\^*\\\*\\\*\\\//,
139
+
140
+ // '**/foo' <-> 'foo'
141
+ () => '^(?:.*\\/)?'
142
+ ],
143
+
144
+ // starting
145
+ [
146
+ // there will be no leading '/'
147
+ // (which has been replaced by section "leading slash")
148
+ // If starts with '**', adding a '^' to the regular expression also works
149
+ /^(?=[^^])/,
150
+ function startingReplacer () {
151
+ // If has a slash `/` at the beginning or middle
152
+ return !/\/(?!$)/.test(this)
153
+ // > Prior to 2.22.1
154
+ // > If the pattern does not contain a slash /,
155
+ // > Git treats it as a shell glob pattern
156
+ // Actually, if there is only a trailing slash,
157
+ // git also treats it as a shell glob pattern
158
+
159
+ // After 2.22.1 (compatible but clearer)
160
+ // > If there is a separator at the beginning or middle (or both)
161
+ // > of the pattern, then the pattern is relative to the directory
162
+ // > level of the particular .gitignore file itself.
163
+ // > Otherwise the pattern may also match at any level below
164
+ // > the .gitignore level.
165
+ ? '(?:^|\\/)'
166
+
167
+ // > Otherwise, Git treats the pattern as a shell glob suitable for
168
+ // > consumption by fnmatch(3)
169
+ : '^'
170
+ }
171
+ ],
172
+
173
+ // two globstars
174
+ [
175
+ // Use lookahead assertions so that we could match more than one `'/**'`
176
+ /\\\/\\\*\\\*(?=\\\/|$)/g,
177
+
178
+ // Zero, one or several directories
179
+ // should not use '*', or it will be replaced by the next replacer
180
+
181
+ // Check if it is not the last `'/**'`
182
+ (_, index, str) => index + 6 < str.length
183
+
184
+ // case: /**/
185
+ // > A slash followed by two consecutive asterisks then a slash matches
186
+ // > zero or more directories.
187
+ // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
188
+ // '/**/'
189
+ ? '(?:\\/[^\\/]+)*'
190
+
191
+ // case: /**
192
+ // > A trailing `"/**"` matches everything inside.
193
+
194
+ // #21: everything inside but it should not include the current folder
195
+ : '\\/.+'
196
+ ],
197
+
198
+ // normal intermediate wildcards
199
+ [
200
+ // Never replace escaped '*'
201
+ // ignore rule '\*' will match the path '*'
202
+
203
+ // 'abc.*/' -> go
204
+ // 'abc.*' -> skip this rule,
205
+ // coz trailing single wildcard will be handed by [trailing wildcard]
206
+ /(^|[^\\]+)(\\\*)+(?=.+)/g,
207
+
208
+ // '*.js' matches '.js'
209
+ // '*.js' doesn't match 'abc'
210
+ (_, p1, p2) => {
211
+ // 1.
212
+ // > An asterisk "*" matches anything except a slash.
213
+ // 2.
214
+ // > Other consecutive asterisks are considered regular asterisks
215
+ // > and will match according to the previous rules.
216
+ const unescaped = p2.replace(/\\\*/g, '[^\\/]*')
217
+ return p1 + unescaped
218
+ }
219
+ ],
220
+
221
+ [
222
+ // unescape, revert step 3 except for back slash
223
+ // For example, if a user escape a '\\*',
224
+ // after step 3, the result will be '\\\\\\*'
225
+ /\\\\\\(?=[$.|*+(){^])/g,
226
+ () => ESCAPE
227
+ ],
228
+
229
+ [
230
+ // '\\\\' -> '\\'
231
+ /\\\\/g,
232
+ () => ESCAPE
233
+ ],
234
+
235
+ [
236
+ // > The range notation, e.g. [a-zA-Z],
237
+ // > can be used to match one of the characters in a range.
238
+
239
+ // `\` is escaped by step 3
240
+ /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
241
+ (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE
242
+ // '\\[bar]' -> '\\\\[bar\\]'
243
+ ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`
244
+ : close === ']'
245
+ ? endEscape.length % 2 === 0
246
+ // A normal case, and it is a range notation
247
+ // '[bar]'
248
+ // '[bar\\\\]'
249
+ ? `[${sanitizeRange(range)}${endEscape}]`
250
+ // Invalid range notaton
251
+ // '[bar\\]' -> '[bar\\\\]'
252
+ : '[]'
253
+ : '[]'
254
+ ],
255
+
256
+ // ending
257
+ [
258
+ // 'js' will not match 'js.'
259
+ // 'ab' will not match 'abc'
260
+ /(?:[^*])$/,
261
+
262
+ // WTF!
263
+ // https://git-scm.com/docs/gitignore
264
+ // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
265
+ // which re-fixes #24, #38
266
+
267
+ // > If there is a separator at the end of the pattern then the pattern
268
+ // > will only match directories, otherwise the pattern can match both
269
+ // > files and directories.
270
+
271
+ // 'js*' will not match 'a.js'
272
+ // 'js/' will not match 'a.js'
273
+ // 'js' will match 'a.js' and 'a.js/'
274
+ match => /\/$/.test(match)
275
+ // foo/ will not match 'foo'
276
+ ? `${match}$`
277
+ // foo matches 'foo' and 'foo/'
278
+ : `${match}(?=$|\\/$)`
279
+ ],
280
+
281
+ // trailing wildcard
282
+ [
283
+ /(\^|\\\/)?\\\*$/,
284
+ (_, p1) => {
285
+ const prefix = p1
286
+ // '\^':
287
+ // '/*' does not match EMPTY
288
+ // '/*' does not match everything
289
+
290
+ // '\\\/':
291
+ // 'abc/*' does not match 'abc/'
292
+ ? `${p1}[^/]+`
293
+
294
+ // 'a*' matches 'a'
295
+ // 'a*' matches 'aa'
296
+ : '[^/]*'
297
+
298
+ return `${prefix}(?=$|\\/$)`
299
+ }
300
+ ],
301
+ ]
302
+
303
+ // A simple cache, because an ignore rule only has only one certain meaning
304
+ const regexCache = Object.create(null)
305
+
306
+ // @param {pattern}
307
+ const makeRegex = (pattern, ignoreCase) => {
308
+ let source = regexCache[pattern]
309
+
310
+ if (!source) {
311
+ source = REPLACERS.reduce(
312
+ (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
313
+ pattern
314
+ )
315
+ regexCache[pattern] = source
316
+ }
317
+
318
+ return ignoreCase
319
+ ? new RegExp(source, 'i')
320
+ : new RegExp(source)
321
+ }
322
+
323
+ const isString = subject => typeof subject === 'string'
324
+
325
+ // > A blank line matches no files, so it can serve as a separator for readability.
326
+ const checkPattern = pattern => pattern
327
+ && isString(pattern)
328
+ && !REGEX_TEST_BLANK_LINE.test(pattern)
329
+ && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern)
330
+
331
+ // > A line starting with # serves as a comment.
332
+ && pattern.indexOf('#') !== 0
333
+
334
+ const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)
335
+
336
+ class IgnoreRule {
337
+ constructor (
338
+ origin,
339
+ pattern,
340
+ negative,
341
+ regex
342
+ ) {
343
+ this.origin = origin
344
+ this.pattern = pattern
345
+ this.negative = negative
346
+ this.regex = regex
347
+ }
348
+ }
349
+
350
+ const createRule = (pattern, ignoreCase) => {
351
+ const origin = pattern
352
+ let negative = false
353
+
354
+ // > An optional prefix "!" which negates the pattern;
355
+ if (pattern.indexOf('!') === 0) {
356
+ negative = true
357
+ pattern = pattern.substr(1)
358
+ }
359
+
360
+ pattern = pattern
361
+ // > Put a backslash ("\") in front of the first "!" for patterns that
362
+ // > begin with a literal "!", for example, `"\!important!.txt"`.
363
+ .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')
364
+ // > Put a backslash ("\") in front of the first hash for patterns that
365
+ // > begin with a hash.
366
+ .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')
367
+
368
+ const regex = makeRegex(pattern, ignoreCase)
369
+
370
+ return new IgnoreRule(
371
+ origin,
372
+ pattern,
373
+ negative,
374
+ regex
375
+ )
376
+ }
377
+
378
+ const throwError = (message, Ctor) => {
379
+ throw new Ctor(message)
380
+ }
381
+
382
+ const checkPath = (path, originalPath, doThrow) => {
383
+ if (!isString(path)) {
384
+ return doThrow(
385
+ `path must be a string, but got \`${originalPath}\``,
386
+ TypeError
387
+ )
388
+ }
389
+
390
+ // We don't know if we should ignore EMPTY, so throw
391
+ if (!path) {
392
+ return doThrow(`path must not be empty`, TypeError)
393
+ }
394
+
395
+ // Check if it is a relative path
396
+ if (checkPath.isNotRelative(path)) {
397
+ const r = '`path.relative()`d'
398
+ return doThrow(
399
+ `path should be a ${r} string, but got "${originalPath}"`,
400
+ RangeError
401
+ )
402
+ }
403
+
404
+ return true
405
+ }
406
+
407
+ const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)
408
+
409
+ checkPath.isNotRelative = isNotRelative
410
+ checkPath.convert = p => p
411
+
412
+ class Ignore {
413
+ constructor ({
414
+ ignorecase = true,
415
+ ignoreCase = ignorecase,
416
+ allowRelativePaths = false
417
+ } = {}) {
418
+ define(this, KEY_IGNORE, true)
419
+
420
+ this._rules = []
421
+ this._ignoreCase = ignoreCase
422
+ this._allowRelativePaths = allowRelativePaths
423
+ this._initCache()
424
+ }
425
+
426
+ _initCache () {
427
+ this._ignoreCache = Object.create(null)
428
+ this._testCache = Object.create(null)
429
+ }
430
+
431
+ _addPattern (pattern) {
432
+ // #32
433
+ if (pattern && pattern[KEY_IGNORE]) {
434
+ this._rules = this._rules.concat(pattern._rules)
435
+ this._added = true
436
+ return
437
+ }
438
+
439
+ if (checkPattern(pattern)) {
440
+ const rule = createRule(pattern, this._ignoreCase)
441
+ this._added = true
442
+ this._rules.push(rule)
443
+ }
444
+ }
445
+
446
+ // @param {Array<string> | string | Ignore} pattern
447
+ add (pattern) {
448
+ this._added = false
449
+
450
+ makeArray(
451
+ isString(pattern)
452
+ ? splitPattern(pattern)
453
+ : pattern
454
+ ).forEach(this._addPattern, this)
455
+
456
+ // Some rules have just added to the ignore,
457
+ // making the behavior changed.
458
+ if (this._added) {
459
+ this._initCache()
460
+ }
461
+
462
+ return this
463
+ }
464
+
465
+ // legacy
466
+ addPattern (pattern) {
467
+ return this.add(pattern)
468
+ }
469
+
470
+ // | ignored : unignored
471
+ // negative | 0:0 | 0:1 | 1:0 | 1:1
472
+ // -------- | ------- | ------- | ------- | --------
473
+ // 0 | TEST | TEST | SKIP | X
474
+ // 1 | TESTIF | SKIP | TEST | X
475
+
476
+ // - SKIP: always skip
477
+ // - TEST: always test
478
+ // - TESTIF: only test if checkUnignored
479
+ // - X: that never happen
480
+
481
+ // @param {boolean} whether should check if the path is unignored,
482
+ // setting `checkUnignored` to `false` could reduce additional
483
+ // path matching.
484
+
485
+ // @returns {TestResult} true if a file is ignored
486
+ _testOne (path, checkUnignored) {
487
+ let ignored = false
488
+ let unignored = false
489
+
490
+ this._rules.forEach(rule => {
491
+ const {negative} = rule
492
+ if (
493
+ unignored === negative && ignored !== unignored
494
+ || negative && !ignored && !unignored && !checkUnignored
495
+ ) {
496
+ return
497
+ }
498
+
499
+ const matched = rule.regex.test(path)
500
+
501
+ if (matched) {
502
+ ignored = !negative
503
+ unignored = negative
504
+ }
505
+ })
506
+
507
+ return {
508
+ ignored,
509
+ unignored
510
+ }
511
+ }
512
+
513
+ // @returns {TestResult}
514
+ _test (originalPath, cache, checkUnignored, slices) {
515
+ const path = originalPath
516
+ // Supports nullable path
517
+ && checkPath.convert(originalPath)
518
+
519
+ checkPath(
520
+ path,
521
+ originalPath,
522
+ this._allowRelativePaths
523
+ ? RETURN_FALSE
524
+ : throwError
525
+ )
526
+
527
+ return this._t(path, cache, checkUnignored, slices)
528
+ }
529
+
530
+ _t (path, cache, checkUnignored, slices) {
531
+ if (path in cache) {
532
+ return cache[path]
533
+ }
534
+
535
+ if (!slices) {
536
+ // path/to/a.js
537
+ // ['path', 'to', 'a.js']
538
+ slices = path.split(SLASH)
539
+ }
540
+
541
+ slices.pop()
542
+
543
+ // If the path has no parent directory, just test it
544
+ if (!slices.length) {
545
+ return cache[path] = this._testOne(path, checkUnignored)
546
+ }
547
+
548
+ const parent = this._t(
549
+ slices.join(SLASH) + SLASH,
550
+ cache,
551
+ checkUnignored,
552
+ slices
553
+ )
554
+
555
+ // If the path contains a parent directory, check the parent first
556
+ return cache[path] = parent.ignored
557
+ // > It is not possible to re-include a file if a parent directory of
558
+ // > that file is excluded.
559
+ ? parent
560
+ : this._testOne(path, checkUnignored)
561
+ }
562
+
563
+ ignores (path) {
564
+ return this._test(path, this._ignoreCache, false).ignored
565
+ }
566
+
567
+ createFilter () {
568
+ return path => !this.ignores(path)
569
+ }
570
+
571
+ filter (paths) {
572
+ return makeArray(paths).filter(this.createFilter())
573
+ }
574
+
575
+ // @returns {TestResult}
576
+ test (path) {
577
+ return this._test(path, this._testCache, true)
578
+ }
579
+ }
580
+
581
+ const factory = options => new Ignore(options)
582
+
583
+ const isPathValid = path =>
584
+ checkPath(path && checkPath.convert(path), path, RETURN_FALSE)
585
+
586
+ factory.isPathValid = isPathValid
587
+
588
+ // Fixes typescript
589
+ factory.default = factory
590
+
591
+ module.exports = factory
592
+
593
+ // Windows
594
+ // --------------------------------------------------------------
595
+ /* istanbul ignore if */
596
+ if (
597
+ // Detect `process` so that it can run in browsers.
598
+ typeof process !== 'undefined'
599
+ && (
600
+ process.env && process.env.IGNORE_TEST_WIN32
601
+ || process.platform === 'win32'
602
+ )
603
+ ) {
604
+ /* eslint no-control-regex: "off" */
605
+ const makePosix = str => /^\\\\\?\\/.test(str)
606
+ || /["<>|\u0000-\u001F]+/u.test(str)
607
+ ? str
608
+ : str.replace(/\\/g, '/')
609
+
610
+ checkPath.convert = makePosix
611
+
612
+ // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/'
613
+ // 'd:\\foo'
614
+ const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i
615
+ checkPath.isNotRelative = path =>
616
+ REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)
617
+ || isNotRelative(path)
618
+ }