Delete 100 files via Git Manager GUI

This commit is contained in:
2026-10-22 09:13:42 +00:00
parent f4c16b173f
commit e178605833
100 changed files with 0 additions and 7062 deletions
-96
View File
@@ -1,96 +0,0 @@
import { FilesystemDirectoryEntry, FilesystemEntry, FilesystemLinkEntry } from './filesystem';
import * as disk from './disk';
import { CrawledFileType } from './crawlfs';
import { IOptions } from './types/glob';
export declare function createPackage(src: string, dest: string): Promise<NodeJS.WritableStream>;
export type CreateOptions = {
dot?: boolean;
globOptions?: IOptions;
/**
* Path to a file containing the list of relative filepaths relative to `src` and the specific order they should be inserted into the asar.
* Formats allowed below:
* filepath
* : filepath
* <anything>:filepath
*/
ordering?: string;
pattern?: string;
transform?: (filePath: string) => NodeJS.ReadWriteStream | void;
unpack?: string;
unpackDir?: string;
};
export declare function createPackageWithOptions(src: string, dest: string, options: CreateOptions): Promise<NodeJS.WritableStream>;
/**
* Create an ASAR archive from a list of filenames.
*
* @param src - Base path. All files are relative to this.
* @param dest - Archive filename (& path).
* @param filenames - List of filenames relative to src.
* @param [metadata] - Object with filenames as keys and {type='directory|file|link', stat: fs.stat} as values. (Optional)
* @param [options] - Options passed to `createPackageWithOptions`.
*/
export declare function createPackageFromFiles(src: string, dest: string, filenames: string[], metadata?: disk.InputMetadata, options?: CreateOptions): Promise<NodeJS.WritableStream>;
export type AsarStream = {
/**
Relative path to the file or directory from within the archive
*/
path: string;
/**
Function that returns a read stream for a file.
Note: this is called multiple times per "file", so a new NodeJS.ReadableStream needs to be created each time
*/
streamGenerator: () => NodeJS.ReadableStream;
/**
Whether the file/link should be unpacked
*/
unpacked: boolean;
stat: CrawledFileType['stat'];
};
export type AsarDirectory = Pick<AsarStream, 'path' | 'unpacked'> & {
type: 'directory';
};
export type AsarSymlinkStream = AsarStream & {
type: 'link';
symlink: string;
};
export type AsarFileStream = AsarStream & {
type: 'file';
};
export type AsarStreamType = AsarDirectory | AsarFileStream | AsarSymlinkStream;
/**
* Create an ASAR archive from a list of streams.
*
* @param dest - Archive filename (& path).
* @param streams - List of streams to be piped in-memory into asar filesystem. Insertion order is preserved.
*/
export declare function createPackageFromStreams(dest: string, streams: AsarStreamType[]): Promise<import("fs").WriteStream>;
export declare function statFile(archivePath: string, filename: string, followLinks?: boolean): FilesystemEntry;
export declare function getRawHeader(archivePath: string): disk.ArchiveHeader;
export interface ListOptions {
isPack: boolean;
}
export declare function listPackage(archivePath: string, options: ListOptions): string[];
export declare function extractFile(archivePath: string, filename: string, followLinks?: boolean): Buffer;
export declare function extractAll(archivePath: string, dest: string): void;
export declare function uncache(archivePath: string): boolean;
export declare function uncacheAll(): void;
export { EntryMetadata } from './filesystem';
export { InputMetadata, DirectoryRecord, FileRecord, ArchiveHeader } from './disk';
export type InputMetadataType = 'directory' | 'file' | 'link';
export type DirectoryMetadata = FilesystemDirectoryEntry;
export type FileMetadata = FilesystemEntry;
export type LinkMetadata = FilesystemLinkEntry;
declare const _default: {
createPackage: typeof createPackage;
createPackageWithOptions: typeof createPackageWithOptions;
createPackageFromFiles: typeof createPackageFromFiles;
createPackageFromStreams: typeof createPackageFromStreams;
statFile: typeof statFile;
getRawHeader: typeof getRawHeader;
listPackage: typeof listPackage;
extractFile: typeof extractFile;
extractAll: typeof extractAll;
uncache: typeof uncache;
uncacheAll: typeof uncacheAll;
};
export default _default;
-337
View File
@@ -1,337 +0,0 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPackage = createPackage;
exports.createPackageWithOptions = createPackageWithOptions;
exports.createPackageFromFiles = createPackageFromFiles;
exports.createPackageFromStreams = createPackageFromStreams;
exports.statFile = statFile;
exports.getRawHeader = getRawHeader;
exports.listPackage = listPackage;
exports.extractFile = extractFile;
exports.extractAll = extractAll;
exports.uncache = uncache;
exports.uncacheAll = uncacheAll;
const path = __importStar(require("path"));
const minimatch_1 = __importDefault(require("minimatch"));
const wrapped_fs_1 = __importDefault(require("./wrapped-fs"));
const filesystem_1 = require("./filesystem");
const disk = __importStar(require("./disk"));
const crawlfs_1 = require("./crawlfs");
/**
* Whether a directory should be excluded from packing due to the `--unpack-dir" option.
*
* @param dirPath - directory path to check
* @param pattern - literal prefix [for backward compatibility] or glob pattern
* @param unpackDirs - Array of directory paths previously marked as unpacked
*/
function isUnpackedDir(dirPath, pattern, unpackDirs) {
if (dirPath.startsWith(pattern) || (0, minimatch_1.default)(dirPath, pattern)) {
if (!unpackDirs.includes(dirPath)) {
unpackDirs.push(dirPath);
}
return true;
}
else {
return unpackDirs.some((unpackDir) => dirPath.startsWith(unpackDir) && !path.relative(unpackDir, dirPath).startsWith('..'));
}
}
async function createPackage(src, dest) {
return createPackageWithOptions(src, dest, {});
}
async function createPackageWithOptions(src, dest, options) {
const globOptions = options.globOptions ? options.globOptions : {};
globOptions.dot = options.dot === undefined ? true : options.dot;
const pattern = src + (options.pattern ? options.pattern : '/**/*');
const [filenames, metadata] = await (0, crawlfs_1.crawl)(pattern, globOptions);
return createPackageFromFiles(src, dest, filenames, metadata, options);
}
/**
* Create an ASAR archive from a list of filenames.
*
* @param src - Base path. All files are relative to this.
* @param dest - Archive filename (& path).
* @param filenames - List of filenames relative to src.
* @param [metadata] - Object with filenames as keys and {type='directory|file|link', stat: fs.stat} as values. (Optional)
* @param [options] - Options passed to `createPackageWithOptions`.
*/
async function createPackageFromFiles(src, dest, filenames, metadata = {}, options = {}) {
src = path.normalize(src);
dest = path.normalize(dest);
filenames = filenames.map(function (filename) {
return path.normalize(filename);
});
const filesystem = new filesystem_1.Filesystem(src);
const files = [];
const links = [];
const unpackDirs = [];
let filenamesSorted = [];
if (options.ordering) {
const orderingFiles = (await wrapped_fs_1.default.readFile(options.ordering))
.toString()
.split('\n')
.map((line) => {
if (line.includes(':')) {
line = line.split(':').pop();
}
line = line.trim();
if (line.startsWith('/')) {
line = line.slice(1);
}
return line;
});
const ordering = [];
for (const file of orderingFiles) {
const pathComponents = file.split(path.sep);
let str = src;
for (const pathComponent of pathComponents) {
str = path.join(str, pathComponent);
ordering.push(str);
}
}
let missing = 0;
const total = filenames.length;
for (const file of ordering) {
if (!filenamesSorted.includes(file) && filenames.includes(file)) {
filenamesSorted.push(file);
}
}
for (const file of filenames) {
if (!filenamesSorted.includes(file)) {
filenamesSorted.push(file);
missing += 1;
}
}
console.log(`Ordering file has ${((total - missing) / total) * 100}% coverage.`);
}
else {
filenamesSorted = filenames;
}
const handleFile = async function (filename) {
if (!metadata[filename]) {
const fileType = await (0, crawlfs_1.determineFileType)(filename);
if (!fileType) {
throw new Error('Unknown file type for file: ' + filename);
}
metadata[filename] = fileType;
}
const file = metadata[filename];
const shouldUnpackPath = function (relativePath, unpack, unpackDir) {
let shouldUnpack = false;
if (unpack) {
shouldUnpack = (0, minimatch_1.default)(filename, unpack, { matchBase: true });
}
if (!shouldUnpack && unpackDir) {
shouldUnpack = isUnpackedDir(relativePath, unpackDir, unpackDirs);
}
return shouldUnpack;
};
let shouldUnpack;
switch (file.type) {
case 'directory':
shouldUnpack = shouldUnpackPath(path.relative(src, filename), undefined, options.unpackDir);
filesystem.insertDirectory(filename, shouldUnpack);
break;
case 'file':
shouldUnpack = shouldUnpackPath(path.relative(src, path.dirname(filename)), options.unpack, options.unpackDir);
files.push({ filename, unpack: shouldUnpack });
return filesystem.insertFile(filename, () => wrapped_fs_1.default.createReadStream(filename), shouldUnpack, file, options);
case 'link':
shouldUnpack = shouldUnpackPath(path.relative(src, filename), options.unpack, options.unpackDir);
links.push({ filename, unpack: shouldUnpack });
filesystem.insertLink(filename, shouldUnpack);
break;
}
return Promise.resolve();
};
const insertsDone = async function () {
await wrapped_fs_1.default.mkdirp(path.dirname(dest));
return disk.writeFilesystem(dest, filesystem, { files, links }, metadata);
};
const names = filenamesSorted.slice();
const next = async function (name) {
if (!name) {
return insertsDone();
}
await handleFile(name);
return next(names.shift());
};
return next(names.shift());
}
/**
* Create an ASAR archive from a list of streams.
*
* @param dest - Archive filename (& path).
* @param streams - List of streams to be piped in-memory into asar filesystem. Insertion order is preserved.
*/
async function createPackageFromStreams(dest, streams) {
// We use an ambiguous root `src` since we're piping directly from a stream and the `filePath` for the stream is already relative to the src/root
const src = '.';
const filesystem = new filesystem_1.Filesystem(src);
const files = [];
const links = [];
const handleFile = async function (stream) {
const { path: destinationPath, type } = stream;
const filename = path.normalize(destinationPath);
switch (type) {
case 'directory':
filesystem.insertDirectory(filename, stream.unpacked);
break;
case 'file':
files.push({
filename,
streamGenerator: stream.streamGenerator,
link: undefined,
mode: stream.stat.mode,
unpack: stream.unpacked,
});
return filesystem.insertFile(filename, stream.streamGenerator, stream.unpacked, {
type: 'file',
stat: stream.stat,
});
case 'link':
links.push({
filename,
streamGenerator: stream.streamGenerator,
link: stream.symlink,
mode: stream.stat.mode,
unpack: stream.unpacked,
});
filesystem.insertLink(filename, stream.unpacked, path.dirname(filename), stream.symlink, src);
break;
}
return Promise.resolve();
};
const insertsDone = async function () {
await wrapped_fs_1.default.mkdirp(path.dirname(dest));
return disk.streamFilesystem(dest, filesystem, { files, links });
};
const streamQueue = streams.slice();
const next = async function (stream) {
if (!stream) {
return insertsDone();
}
await handleFile(stream);
return next(streamQueue.shift());
};
return next(streamQueue.shift());
}
function statFile(archivePath, filename, followLinks = true) {
const filesystem = disk.readFilesystemSync(archivePath);
return filesystem.getFile(filename, followLinks);
}
function getRawHeader(archivePath) {
return disk.readArchiveHeaderSync(archivePath);
}
function listPackage(archivePath, options) {
return disk.readFilesystemSync(archivePath).listFiles(options);
}
function extractFile(archivePath, filename, followLinks = true) {
const filesystem = disk.readFilesystemSync(archivePath);
const fileInfo = filesystem.getFile(filename, followLinks);
if ('link' in fileInfo || 'files' in fileInfo) {
throw new Error('Expected to find file at: ' + filename + ' but found a directory or link');
}
return disk.readFileSync(filesystem, filename, fileInfo);
}
function extractAll(archivePath, dest) {
const filesystem = disk.readFilesystemSync(archivePath);
const filenames = filesystem.listFiles();
// under windows just extract links as regular files
const followLinks = process.platform === 'win32';
// create destination directory
wrapped_fs_1.default.mkdirpSync(dest);
const extractionErrors = [];
for (const fullPath of filenames) {
// Remove leading slash
const filename = fullPath.substr(1);
const destFilename = path.join(dest, filename);
const file = filesystem.getFile(filename, followLinks);
if (path.relative(dest, destFilename).startsWith('..')) {
throw new Error(`${fullPath}: file "${destFilename}" writes out of the package`);
}
if ('files' in file) {
// it's a directory, create it and continue with the next entry
wrapped_fs_1.default.mkdirpSync(destFilename);
}
else if ('link' in file) {
// it's a symlink, create a symlink
const linkSrcPath = path.dirname(path.join(dest, file.link));
const linkDestPath = path.dirname(destFilename);
const relativePath = path.relative(linkDestPath, linkSrcPath);
// try to delete output file, because we can't overwrite a link
try {
wrapped_fs_1.default.unlinkSync(destFilename);
}
catch (_a) { }
const linkTo = path.join(relativePath, path.basename(file.link));
if (path.relative(dest, linkSrcPath).startsWith('..')) {
throw new Error(`${fullPath}: file "${file.link}" links out of the package to "${linkSrcPath}"`);
}
wrapped_fs_1.default.symlinkSync(linkTo, destFilename);
}
else {
// it's a file, try to extract it
try {
const content = disk.readFileSync(filesystem, filename, file);
wrapped_fs_1.default.writeFileSync(destFilename, content);
if (file.executable) {
wrapped_fs_1.default.chmodSync(destFilename, '755');
}
}
catch (e) {
extractionErrors.push(e);
}
}
}
if (extractionErrors.length) {
throw new Error('Unable to extract some files:\n\n' +
extractionErrors.map((error) => error.stack).join('\n\n'));
}
}
function uncache(archivePath) {
return disk.uncacheFilesystem(archivePath);
}
function uncacheAll() {
disk.uncacheAll();
}
// Export everything in default, too
exports.default = {
createPackage,
createPackageWithOptions,
createPackageFromFiles,
createPackageFromStreams,
statFile,
getRawHeader,
listPackage,
extractFile,
extractAll,
uncache,
uncacheAll,
};
//# sourceMappingURL=asar.js.map
-1
View File
File diff suppressed because one or more lines are too long
-12
View File
@@ -1,12 +0,0 @@
import { Stats } from 'fs';
import { IOptions } from './types/glob';
export type CrawledFileType = {
type: 'file' | 'directory' | 'link';
stat: Pick<Stats, 'mode' | 'size'>;
transformed?: {
path: string;
stat: Stats;
};
};
export declare function determineFileType(filename: string): Promise<CrawledFileType | null>;
export declare function crawl(dir: string, options: IOptions): Promise<readonly [string[], Record<string, CrawledFileType>]>;
-79
View File
@@ -1,79 +0,0 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.determineFileType = determineFileType;
exports.crawl = crawl;
const util_1 = require("util");
const glob_1 = require("glob");
const wrapped_fs_1 = __importDefault(require("./wrapped-fs"));
const path = __importStar(require("path"));
const glob = (0, util_1.promisify)(glob_1.glob);
async function determineFileType(filename) {
const stat = await wrapped_fs_1.default.lstat(filename);
if (stat.isFile()) {
return { type: 'file', stat };
}
else if (stat.isDirectory()) {
return { type: 'directory', stat };
}
else if (stat.isSymbolicLink()) {
return { type: 'link', stat };
}
return null;
}
async function crawl(dir, options) {
const metadata = {};
const crawled = await glob(dir, options);
const results = await Promise.all(crawled.map(async (filename) => [filename, await determineFileType(filename)]));
const links = [];
const filenames = results
.map(([filename, type]) => {
if (type) {
metadata[filename] = type;
if (type.type === 'link')
links.push(filename);
}
return filename;
})
.filter((filename) => {
// Newer glob can return files inside symlinked directories, to avoid
// those appearing in archives we need to manually exclude theme here
const exactLinkIndex = links.findIndex((link) => filename === link);
return links.every((link, index) => {
if (index === exactLinkIndex) {
return true;
}
const isFileWithinSymlinkDir = filename.startsWith(link);
// symlink may point outside the directory: https://github.com/electron/asar/issues/303
const relativePath = path.relative(link, path.dirname(filename));
return !isFileWithinSymlinkDir || relativePath.startsWith('..');
});
});
return [filenames, metadata];
}
//# sourceMappingURL=crawlfs.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"crawlfs.js","sourceRoot":"","sources":["../src/crawlfs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,8CAUC;AAED,sBA8BC;AA7DD,+BAAiC;AACjC,+BAAqC;AAErC,8DAA8B;AAE9B,2CAA6B;AAG7B,MAAM,IAAI,GAAG,IAAA,gBAAS,EAAC,WAAK,CAAC,CAAC;AAWvB,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IACtD,MAAM,IAAI,GAAG,MAAM,oBAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,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