Skip to content

Commit 9e93f92

Browse files
authored
Merge branch 'main' into fix-symlink-same-dir-prefix
2 parents c8774f3 + e313c0a commit 9e93f92

File tree

8 files changed

+178
-17
lines changed

8 files changed

+178
-17
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2.1
22

33
orbs:
44
cfa: continuousauth/[email protected]
5-
node: electronjs/[email protected].0
5+
node: electronjs/[email protected].1
66

77
workflows:
88
test_and_release:

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"prepare": "tsc"
3535
},
3636
"dependencies": {
37-
"@types/glob": "^7.1.0",
3837
"commander": "^5.0.0",
3938
"glob": "^7.1.6",
4039
"minimatch": "^3.0.4"

src/asar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from './filesystem';
1111
import * as disk from './disk';
1212
import { crawl as crawlFilesystem, determineFileType } from './crawlfs';
13-
import { IOptions } from 'glob';
13+
import { IOptions } from './types/glob';
1414

1515
/**
1616
* Whether a directory should be excluded from packing due to the `--unpack-dir" option.

src/crawlfs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { promisify } from 'util';
2-
import { glob as _glob, IOptions } from 'glob';
2+
import { glob as _glob } from 'glob';
33

44
import fs from './wrapped-fs';
55
import { Stats } from 'fs';
66
import * as path from 'path';
7+
import { IOptions } from './types/glob';
78

89
const glob = promisify(_glob);
910

src/types/ambient.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* TODO(erikian): remove this file once we upgrade to the latest `glob` version.
3+
* https://github.com/electron/asar/pull/332#issuecomment-2435407933
4+
*/
5+
declare module 'glob' {
6+
export function glob(
7+
pattern: string,
8+
options: import('./glob').IOptions,
9+
cb: (err: Error | null, matches: string[]) => void,
10+
): unknown;
11+
}

src/types/glob.ts

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
/**
2+
* TODO(erikian): remove this file once we upgrade to the latest `glob` version.
3+
* https://github.com/electron/asar/pull/332#issuecomment-2435407933
4+
*/
5+
interface IMinimatchOptions {
6+
/**
7+
* Dump a ton of stuff to stderr.
8+
*
9+
* @default false
10+
*/
11+
debug?: boolean | undefined;
12+
13+
/**
14+
* Do not expand `{a,b}` and `{1..3}` brace sets.
15+
*
16+
* @default false
17+
*/
18+
nobrace?: boolean | undefined;
19+
20+
/**
21+
* Disable `**` matching against multiple folder names.
22+
*
23+
* @default false
24+
*/
25+
noglobstar?: boolean | undefined;
26+
27+
/**
28+
* Allow patterns to match filenames starting with a period,
29+
* even if the pattern does not explicitly have a period in that spot.
30+
*
31+
* Note that by default, `'a/**' + '/b'` will **not** match `a/.d/b`, unless `dot` is set.
32+
*
33+
* @default false
34+
*/
35+
dot?: boolean | undefined;
36+
37+
/**
38+
* Disable "extglob" style patterns like `+(a|b)`.
39+
*
40+
* @default false
41+
*/
42+
noext?: boolean | undefined;
43+
44+
/**
45+
* Perform a case-insensitive match.
46+
*
47+
* @default false
48+
*/
49+
nocase?: boolean | undefined;
50+
51+
/**
52+
* When a match is not found by `minimatch.match`,
53+
* return a list containing the pattern itself if this option is set.
54+
* Otherwise, an empty list is returned if there are no matches.
55+
*
56+
* @default false
57+
*/
58+
nonull?: boolean | undefined;
59+
60+
/**
61+
* If set, then patterns without slashes will be matched
62+
* against the basename of the path if it contains slashes. For example,
63+
* `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
64+
*
65+
* @default false
66+
*/
67+
matchBase?: boolean | undefined;
68+
69+
/**
70+
* Suppress the behavior of treating `#` at the start of a pattern as a comment.
71+
*
72+
* @default false
73+
*/
74+
nocomment?: boolean | undefined;
75+
76+
/**
77+
* Suppress the behavior of treating a leading `!` character as negation.
78+
*
79+
* @default false
80+
*/
81+
nonegate?: boolean | undefined;
82+
83+
/**
84+
* Returns from negate expressions the same as if they were not negated.
85+
* (Ie, true on a hit, false on a miss.)
86+
*
87+
* @default false
88+
*/
89+
flipNegate?: boolean | undefined;
90+
91+
/**
92+
* Compare a partial path to a pattern. As long as the parts of the path that
93+
* are present are not contradicted by the pattern, it will be treated as a
94+
* match. This is useful in applications where you're walking through a
95+
* folder structure, and don't yet have the full path, but want to ensure that
96+
* you do not walk down paths that can never be a match.
97+
*
98+
* @default false
99+
*
100+
* @example
101+
* import minimatch = require("minimatch");
102+
*
103+
* minimatch('/a/b', '/a/*' + '/c/d', { partial: true }) // true, might be /a/b/c/d
104+
* minimatch('/a/b', '/**' + '/d', { partial: true }) // true, might be /a/b/.../d
105+
* minimatch('/x/y/z', '/a/**' + '/z', { partial: true }) // false, because x !== a
106+
*/
107+
partial?: boolean;
108+
109+
/**
110+
* Use `\\` as a path separator _only_, and _never_ as an escape
111+
* character. If set, all `\\` characters are replaced with `/` in
112+
* the pattern. Note that this makes it **impossible** to match
113+
* against paths containing literal glob pattern characters, but
114+
* allows matching with patterns constructed using `path.join()` and
115+
* `path.resolve()` on Windows platforms, mimicking the (buggy!)
116+
* behavior of earlier versions on Windows. Please use with
117+
* caution, and be mindful of the caveat about Windows paths
118+
*
119+
* For legacy reasons, this is also set if
120+
* `options.allowWindowsEscape` is set to the exact value `false`.
121+
*
122+
* @default false
123+
*/
124+
windowsPathsNoEscape?: boolean;
125+
}
126+
127+
export interface IOptions extends IMinimatchOptions {
128+
cwd?: string | undefined;
129+
root?: string | undefined;
130+
dot?: boolean | undefined;
131+
nomount?: boolean | undefined;
132+
mark?: boolean | undefined;
133+
nosort?: boolean | undefined;
134+
stat?: boolean | undefined;
135+
silent?: boolean | undefined;
136+
strict?: boolean | undefined;
137+
cache?: { [path: string]: boolean | 'DIR' | 'FILE' | ReadonlyArray<string> } | undefined;
138+
statCache?: { [path: string]: false | { isDirectory(): boolean } | undefined } | undefined;
139+
symlinks?: { [path: string]: boolean | undefined } | undefined;
140+
realpathCache?: { [path: string]: string } | undefined;
141+
sync?: boolean | undefined;
142+
nounique?: boolean | undefined;
143+
nonull?: boolean | undefined;
144+
debug?: boolean | undefined;
145+
nobrace?: boolean | undefined;
146+
noglobstar?: boolean | undefined;
147+
noext?: boolean | undefined;
148+
nocase?: boolean | undefined;
149+
matchBase?: any;
150+
nodir?: boolean | undefined;
151+
ignore?: string | ReadonlyArray<string> | undefined;
152+
follow?: boolean | undefined;
153+
realpath?: boolean | undefined;
154+
nonegate?: boolean | undefined;
155+
nocomment?: boolean | undefined;
156+
absolute?: boolean | undefined;
157+
allowWindowsEscape?: boolean | undefined;
158+
fs?: typeof import('fs');
159+
}

tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"types": [
1212
"node"
1313
],
14+
"typeRoots": [
15+
"node_modules/@types",
16+
"src/types"
17+
],
1418
"allowSyntheticDefaultImports": true,
1519
"moduleResolution": "node",
1620
"declaration": true,

yarn.lock

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@
3939
"@types/node" "*"
4040
"@types/responselike" "^1.0.0"
4141

42-
"@types/glob@^7.1.0":
43-
version "7.2.0"
44-
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb"
45-
integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==
46-
dependencies:
47-
"@types/minimatch" "*"
48-
"@types/node" "*"
49-
5042
"@types/http-cache-semantics@*":
5143
version "4.0.1"
5244
resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812"
@@ -59,11 +51,6 @@
5951
dependencies:
6052
"@types/node" "*"
6153

62-
"@types/minimatch@*":
63-
version "5.1.2"
64-
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca"
65-
integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==
66-
6754
"@types/minimatch@^3.0.5":
6855
version "3.0.5"
6956
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40"

0 commit comments

Comments
 (0)