Skip to content

Commit

Permalink
Merge branch 'main' into fix-symlink-same-dir-prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaietta authored Oct 31, 2024
2 parents c8774f3 + e313c0a commit 9e93f92
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1

orbs:
cfa: continuousauth/[email protected]
node: electronjs/[email protected].0
node: electronjs/[email protected].1

workflows:
test_and_release:
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"prepare": "tsc"
},
"dependencies": {
"@types/glob": "^7.1.0",
"commander": "^5.0.0",
"glob": "^7.1.6",
"minimatch": "^3.0.4"
Expand Down
2 changes: 1 addition & 1 deletion src/asar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from './filesystem';
import * as disk from './disk';
import { crawl as crawlFilesystem, determineFileType } from './crawlfs';
import { IOptions } from 'glob';
import { IOptions } from './types/glob';

/**
* Whether a directory should be excluded from packing due to the `--unpack-dir" option.
Expand Down
3 changes: 2 additions & 1 deletion src/crawlfs.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { promisify } from 'util';
import { glob as _glob, IOptions } from 'glob';
import { glob as _glob } from 'glob';

import fs from './wrapped-fs';
import { Stats } from 'fs';
import * as path from 'path';
import { IOptions } from './types/glob';

const glob = promisify(_glob);

Expand Down
11 changes: 11 additions & 0 deletions src/types/ambient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* TODO(erikian): remove this file once we upgrade to the latest `glob` version.
* https://github.com/electron/asar/pull/332#issuecomment-2435407933
*/
declare module 'glob' {
export function glob(
pattern: string,
options: import('./glob').IOptions,
cb: (err: Error | null, matches: string[]) => void,
): unknown;
}
159 changes: 159 additions & 0 deletions src/types/glob.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/**
* TODO(erikian): remove this file once we upgrade to the latest `glob` version.
* https://github.com/electron/asar/pull/332#issuecomment-2435407933
*/
interface IMinimatchOptions {
/**
* Dump a ton of stuff to stderr.
*
* @default false
*/
debug?: boolean | undefined;

/**
* Do not expand `{a,b}` and `{1..3}` brace sets.
*
* @default false
*/
nobrace?: boolean | undefined;

/**
* Disable `**` matching against multiple folder names.
*
* @default false
*/
noglobstar?: boolean | undefined;

/**
* Allow patterns to match filenames starting with a period,
* even if the pattern does not explicitly have a period in that spot.
*
* Note that by default, `'a/**' + '/b'` will **not** match `a/.d/b`, unless `dot` is set.
*
* @default false
*/
dot?: boolean | undefined;

/**
* Disable "extglob" style patterns like `+(a|b)`.
*
* @default false
*/
noext?: boolean | undefined;

/**
* Perform a case-insensitive match.
*
* @default false
*/
nocase?: boolean | undefined;

/**
* When a match is not found by `minimatch.match`,
* return a list containing the pattern itself if this option is set.
* Otherwise, an empty list is returned if there are no matches.
*
* @default false
*/
nonull?: boolean | undefined;

/**
* If set, then patterns without slashes will be matched
* against the basename of the path if it contains slashes. For example,
* `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
*
* @default false
*/
matchBase?: boolean | undefined;

/**
* Suppress the behavior of treating `#` at the start of a pattern as a comment.
*
* @default false
*/
nocomment?: boolean | undefined;

/**
* Suppress the behavior of treating a leading `!` character as negation.
*
* @default false
*/
nonegate?: boolean | undefined;

/**
* Returns from negate expressions the same as if they were not negated.
* (Ie, true on a hit, false on a miss.)
*
* @default false
*/
flipNegate?: boolean | undefined;

/**
* Compare a partial path to a pattern. As long as the parts of the path that
* are present are not contradicted by the pattern, it will be treated as a
* match. This is useful in applications where you're walking through a
* folder structure, and don't yet have the full path, but want to ensure that
* you do not walk down paths that can never be a match.
*
* @default false
*
* @example
* import minimatch = require("minimatch");
*
* minimatch('/a/b', '/a/*' + '/c/d', { partial: true }) // true, might be /a/b/c/d
* minimatch('/a/b', '/**' + '/d', { partial: true }) // true, might be /a/b/.../d
* minimatch('/x/y/z', '/a/**' + '/z', { partial: true }) // false, because x !== a
*/
partial?: boolean;

/**
* Use `\\` as a path separator _only_, and _never_ as an escape
* character. If set, all `\\` characters are replaced with `/` in
* the pattern. Note that this makes it **impossible** to match
* against paths containing literal glob pattern characters, but
* allows matching with patterns constructed using `path.join()` and
* `path.resolve()` on Windows platforms, mimicking the (buggy!)
* behavior of earlier versions on Windows. Please use with
* caution, and be mindful of the caveat about Windows paths
*
* For legacy reasons, this is also set if
* `options.allowWindowsEscape` is set to the exact value `false`.
*
* @default false
*/
windowsPathsNoEscape?: boolean;
}

export interface IOptions extends IMinimatchOptions {
cwd?: string | undefined;
root?: string | undefined;
dot?: boolean | undefined;
nomount?: boolean | undefined;
mark?: boolean | undefined;
nosort?: boolean | undefined;
stat?: boolean | undefined;
silent?: boolean | undefined;
strict?: boolean | undefined;
cache?: { [path: string]: boolean | 'DIR' | 'FILE' | ReadonlyArray<string> } | undefined;
statCache?: { [path: string]: false | { isDirectory(): boolean } | undefined } | undefined;
symlinks?: { [path: string]: boolean | undefined } | undefined;
realpathCache?: { [path: string]: string } | undefined;
sync?: boolean | undefined;
nounique?: boolean | undefined;
nonull?: boolean | undefined;
debug?: boolean | undefined;
nobrace?: boolean | undefined;
noglobstar?: boolean | undefined;
noext?: boolean | undefined;
nocase?: boolean | undefined;
matchBase?: any;
nodir?: boolean | undefined;
ignore?: string | ReadonlyArray<string> | undefined;
follow?: boolean | undefined;
realpath?: boolean | undefined;
nonegate?: boolean | undefined;
nocomment?: boolean | undefined;
absolute?: boolean | undefined;
allowWindowsEscape?: boolean | undefined;
fs?: typeof import('fs');
}
4 changes: 4 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"types": [
"node"
],
"typeRoots": [
"node_modules/@types",
"src/types"
],
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"declaration": true,
Expand Down
13 changes: 0 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@
"@types/node" "*"
"@types/responselike" "^1.0.0"

"@types/glob@^7.1.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb"
integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==
dependencies:
"@types/minimatch" "*"
"@types/node" "*"

"@types/http-cache-semantics@*":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812"
Expand All @@ -59,11 +51,6 @@
dependencies:
"@types/node" "*"

"@types/minimatch@*":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca"
integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==

"@types/minimatch@^3.0.5":
version "3.0.5"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40"
Expand Down

0 comments on commit 9e93f92

Please sign in to comment.