This commit is contained in:
root
2025-11-25 09:56:15 +03:00
commit 68c8f0e80d
23717 changed files with 3200521 additions and 0 deletions

22
mc_test/node_modules/dir-compare/LICENSE generated vendored Executable file
View File

@ -0,0 +1,22 @@
Copyright 2014 Liviu Grigorescu (grigoresculiviu@gmail.com)
This project is free software released under the MIT license:
http://www.opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

284
mc_test/node_modules/dir-compare/README.md generated vendored Executable file
View File

@ -0,0 +1,284 @@
dir-compare
==========
Node JS directory compare
**!! Important !!** Starting with v3.0.0 the CLI utility has been moved to [dir-compare-cli](https://www.npmjs.com/package/dir-compare-cli).
[![Build status](https://ci.appveyor.com/api/projects/status/fpnqkr2gfg7pwkxk/branch/master?svg=true)](https://ci.appveyor.com/project/gliviu/dir-compare)
[![codecov.io](http://codecov.io/github/gliviu/dir-compare/coverage.svg?branch=master)](http://codecov.io/github/gliviu/dir-compare?branch=master)
- [Installation](#installation)
- [Library](#library)
* [Use](#use)
* [Api](#api)
* [Glob patterns](#glob-patterns)
* [Custom file content comparators](#custom-file-content-comparators)
+ [Ignore line endings and white spaces](#ignore-line-endings-and-white-spaces)
* [Custom name comparators](#custom-name-comparators)
* [Custom result builder](#custom-result-builder)
* [Symbolic links](#symbolic-links)
* [Handling permission denied errors](#handling-permission-denied-errors)
- [UI tools](#ui-tools)
- [Changelog](#changelog)
# Installation
```bash
npm install dir-compare
```
# Library
## Use
```javascript
const dircompare = require('dir-compare');
const options = { compareSize: true };
// Multiple compare strategy can be used simultaneously - compareSize, compareContent, compareDate, compareSymlink.
// If one comparison fails for a pair of files, they are considered distinct.
const path1 = '...';
const path2 = '...';
// Synchronous
const res = dircompare.compareSync(path1, path2, options)
print(res)
// Asynchronous
dircompare.compare(path1, path2, options)
.then(res => print(res))
.catch(error => console.error(error));
function print(result) {
console.log('Directories are %s', result.same ? 'identical' : 'different')
console.log('Statistics - equal entries: %s, distinct entries: %s, left only entries: %s, right only entries: %s, differences: %s',
result.equal, result.distinct, result.left, result.right, result.differences)
result.diffSet.forEach(dif => console.log('Difference - name1: %s, type1: %s, name2: %s, type2: %s, state: %s',
dif.name1, dif.type1, dif.name2, dif.type2, dif.state))
}
```
Typescript
```typescript
import { compare, compareSync, Options, Result } from "dir-compare";
const path1 = '...';
const path2 = '...';
const options: Options = { compareSize: true };
const res: Result = compareSync(path1, path2, options);
console.log(res)
compare(path1, path2, options)
.then(res => console.log(res))
.catch(error => console.error(error));
```
## Api
```typescript
compare(path1: string, path2: string, options?: Options): Promise<Result>
compareSync(path1: string, path2: string, options?: Options): Result
```
More details can be found in the reference documentation:
* [compare](https://gliviu.github.io/dc-api/index.html#compare)
* [compareSync](https://gliviu.github.io/dc-api/index.html#comparesync)
* [Options](https://gliviu.github.io/dc-api/interfaces/options.html)
* [Result](https://gliviu.github.io/dc-api/interfaces/result.html)
Common options:
* [compareSize](https://gliviu.github.io/dc-api/interfaces/options.html#comparesize)
* [compareContent](https://gliviu.github.io/dc-api/interfaces/options.html#comparecontent)
* [compareDate](https://gliviu.github.io/dc-api/interfaces/options.html#comparedate)
* [excludeFilter](https://gliviu.github.io/dc-api/interfaces/options.html#excludefilter)
* [includeFilter](https://gliviu.github.io/dc-api/interfaces/options.html#includefilter)
* [ignoreCase](https://gliviu.github.io/dc-api/interfaces/options.html#ignorecase)
* [skipSubdirs](https://gliviu.github.io/dc-api/interfaces/options.html#skipsubdirs)
* [skipEmptyDirs](https://gliviu.github.io/dc-api/interfaces/options.html#skipemptydirs)
## Glob patterns
[Minimatch](https://www.npmjs.com/package/minimatch) patterns are used to include/exclude files to be compared.
The pattern is matched against the relative path of the entry being compared.
Following examples assume we are comparing two [dir-compare](https://github.com/gliviu/dir-compare) code bases.
```javascript
const options = {
excludeFilter: ".git,node_modules", // exclude git and node modules directories
excludeFilter: "expected" , // exclude '/tests/expected' directory
excludeFilter: "/tests/expected" , // exclude '/tests/expected' directory
excludeFilter: "**/expected" , // exclude '/tests/expected' directory
excludeFilter: "**/tests/**/*.js" , // exclude all js files in '/tests' directory and subdirectories
includeFilter: "*.js,*.yml" , // include js and yaml files
includeFilter: "/tests/**/*.js" , // include all js files in '/tests' directory and subdirectories
includeFilter: "**/tests/**/*.ts" // include all js files in '/tests' directory and subdirectories
}
```
## Custom file content comparators
By default file content is binary compared. As of version 1.5.0 custom file comparison handlers may be specified.
Custom handlers are specified by `compareFileSync` and `compareFileAsync` options which correspond to `dircompare.compareSync()` or `dircompare.compare()` methods.
A couple of handlers are included in the library:
* binary sync compare - `dircompare.fileCompareHandlers.defaultFileCompare.compareSync`
* binary async compare - `dircompare.fileCompareHandlers.defaultFileCompare.compareAsync`
* text sync compare - `dircompare.fileCompareHandlers.lineBasedFileCompare.compareSync`
* text async compare - `dircompare.fileCompareHandlers.lineBasedFileCompare.compareAsync`
Use [defaultFileCompare.js](https://github.com/gliviu/dir-compare/blob/master/src/fileCompareHandler/defaultFileCompare.js) as an example to create your own.
### Ignore line endings and white spaces
Line based comparator can be used to ignore line ending and white space differences.
```javascript
const dircompare = require('dir-compare');
const options = {
compareContent: true,
compareFileSync: dircompare.fileCompareHandlers.lineBasedFileCompare.compareSync,
compareFileAsync: dircompare.fileCompareHandlers.lineBasedFileCompare.compareAsync,
ignoreLineEnding: true, // Ignore crlf/lf line ending differences
ignoreWhiteSpaces: true, // Ignore white spaces at the beginning and ending of a line (similar to 'diff -b')
ignoreAllWhiteSpaces: true, // Ignore all white space differences (similar to 'diff -w')
ignoreEmptyLines: true // Ignores differences caused by empty lines (similar to 'diff -B')
};
const path1 = '...';
const path2 = '...';
const res = dircompare.compareSync(path1, path2, options);
console.log(res)
dircompare.compare(path1, path2, options)
.then(res => console.log(res))
```
## Custom name comparators
If [default](https://github.com/gliviu/dir-compare/blob/master/src/nameCompare/defaultNameCompare.js) name comparison is not enough, custom behavior can be specified with [compareNameHandler](https://gliviu.github.io/dc-api/index.html#comparenamehandler) option.
Following example adds the possibility to ignore file extensions.
```typescript
import { Options, compare } from 'dir-compare'
import path from 'path'
const options: Options = {
compareSize: false, // compare only name by disabling size and content criteria
compareContent: false,
compareNameHandler: customNameCompare, // new name comparator used to ignore extensions
ignoreExtension: true, // supported by the custom name compare below
};
function customNameCompare(name1: string, name2: string, options: Options) {
if (options.ignoreCase) {
name1 = name1.toLowerCase()
name2 = name2.toLowerCase()
}
if (options.ignoreExtension) {
name1 = path.basename(name1, path.extname(name1))
name2 = path.basename(name2, path.extname(name2))
}
return ((name1 === name2) ? 0 : ((name1 > name2) ? 1 : -1))
}
const path1 = '/tmp/a';
const path2 = '/tmp/b';
const res = compare(path1, path2, options).then(res => {
console.log(`Same: ${res.same}`)
if (!res.diffSet) {
return
}
res.diffSet.forEach(dif => console.log(`${dif.name1} ${dif.name2} ${dif.state}`))
})
// Outputs
// icon.svg icon.png equal
// logo.svg logo.jpg equal
```
## Custom result builder
[Result builder](https://gliviu.github.io/dc-api/index.html#resultbuilder) is called for each pair of entries encountered during comparison. Its purpose is to append entries in `diffSet` and eventually update `statistics` object with new stats.
If needed it can be replaced with custom implementation.
```javascript
const dircompare = require("dircompare")
const customResultBuilder = function (entry1, entry2, state, level, relativePath, options, statistics, diffSet, reason) {
...
}
const options = {
compareSize: true,
resultBuilder: customResultBuilder
}
const res = dircompare.compareSync('...', '...', options)
```
The [default](https://github.com/gliviu/dir-compare/blob/master/src/resultBuilder/defaultResultBuilderCallback.js) builder can be used as an example.
## Symbolic links
Unless `compareSymlink` option is used, symbolic links are resolved and any comparison is applied to the file/directory they point to.
Circular loops are handled by breaking the loop as soon as it is detected.
Version `1.x` treats broken links as `ENOENT: no such file or directory`.
Since `2.0` they are treated as a special type of entry - `broken-link` - and are available as stats (`totalBrokenLinks`, `distinctBrokenLinks`, ...).
Using `compareSymlink` option causes `dircompare` to check symlink values for equality.
In this mode two entries with identical name are considered different if
* one is symlink, the other is not
* both are symlinks but point to different locations
These rules are applied in addition to the other comparison modes; ie. by content, by size...
If entries are different because of symlinks, `reason` will be `different-symlink`. Also statistics summarizes differences caused by symbolik links.
## Handling permission denied errors
Unreadable files or directories are normally reported as errors. The comparison will be intrerrupted with an `EACCES` exception.
This behavior can be altered with [Options.handlePermissionDenied](https://gliviu.github.io/dc-api/interfaces/options.html#handlepermissiondenied).
# UI tools
* [dir-compare-cli](https://github.com/gliviu/dir-compare-cli)
* [Visual Studio Code - Compare Folders](https://marketplace.visualstudio.com/items?itemName=moshfeu.compare-folders)
# Changelog
* v3.3.0 Added `skipEmptyDirs` option
* v3.2.0 [Handle permission denied errors](#handling-permission-denied-errors)
* v3.1.0 Added `ignoreAllWhiteSpaces` and `ignoreEmptyLines` options
* v3.0.0 Moved CLI component into separate project [dir-compare-cli](https://github.com/gliviu/dir-compare-cli)
* v2.4.0 New option to customize file/folder name comparison
* v2.3.0 Fixes
* v2.1.0 Removed [bluebird](https://github.com/petkaantonov/bluebird/#note) dependency
* v2.0.0
* New option to compare symlinks.
* New field indicating reason for two entries being distinct.
* Improved command line output format.
* Tests are no longer part of published package.
* Generated [Api](#api) documentation.
Breaking changes:
* Broken links are no longer treated as errors. As a result there are new statistics (leftBrokenLinks, rightBrokenLinks, distinctBrokenLinks, totalBrokenLinks) and new entry type - broken-link.
Details in [Symbolic links](#symbolic-links).
* Typescript correction: new interface `Result` replaced `Statistics`.
* v1.8.0
* globstar patterns
* typescript corrections
* removed support for node 0.11, 0.12, iojs
* v1.7.0 performance improvements
* v1.6.0 typescript support
* v1.5.0 added option to ignore line endings and white space differences
* v1.3.0 added date tolerance option
* v1.2.0 added compare by date option
* v1.1.0
* detect symlink loops
* improved color scheme for command line utility
* v1.0.0
* asynchronous processing
* new library options: noDiffSet, resultBuilder
* new statistics: distinctFiles, equalFiles, leftFiles, rightFiles, distinctDirs, equalDirs, leftDirs, rightDirs
* new --async command line option
* Fix for https://github.com/tj/commander.js/issues/125
* v0.0.3 Fix fille ordering issue for newer node versions

View File

@ -0,0 +1,20 @@
import { CompareFileHandler } from './types';
export interface FileCompareHandlers {
/**
* Default file content comparison handlers, used if [[Options.compareFileAsync]] or [[Options.compareFileSync]] are not specified.
*
* Performs binary comparison.
*/
defaultFileCompare: CompareFileHandler;
/**
* Compares files line by line.
*
* Options:
* * ignoreLineEnding - true/false (default: false) - Ignore cr/lf line endings
* * ignoreWhiteSpaces - true/false (default: false) - Ignore white spaces at the beginning and ending of a line (similar to 'diff -b')
* * ignoreAllWhiteSpaces - true/false (default: false) - Ignore all white space differences (similar to 'diff -w')
* * ignoreEmptyLines - true/false (default: false) - Ignores differences caused by empty lines (similar to 'diff -B')
*/
lineBasedFileCompare: CompareFileHandler;
}
//# sourceMappingURL=FileCompareHandlers.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"FileCompareHandlers.d.ts","sourceRoot":"","sources":["../../src/FileCompareHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C,MAAM,WAAW,mBAAmB;IAChC;;;;OAIG;IACH,kBAAkB,EAAE,kBAAkB,CAAC;IACvC;;;;;;;;OAQG;IACH,oBAAoB,EAAE,kBAAkB,CAAC;CAC5C"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=FileCompareHandlers.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"FileCompareHandlers.js","sourceRoot":"","sources":["../../src/FileCompareHandlers.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,6 @@
export = compare;
/**
* Compares two directories asynchronously.
*/
declare function compare(rootEntry1: any, rootEntry2: any, level: any, relativePath: any, options: any, statistics: any, diffSet: any, symlinkCache: any): any;
//# sourceMappingURL=compareAsync.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareAsync.d.ts","sourceRoot":"","sources":["../../src/compareAsync.js"],"names":[],"mappings":";AA2BA;;GAEG;AACH,+JA2HC"}

142
mc_test/node_modules/dir-compare/build/src/compareAsync.js generated vendored Executable file
View File

@ -0,0 +1,142 @@
const entryBuilder = require('./entry/entryBuilder');
const entryEquality = require('./entry/entryEquality');
const stats = require('./statistics/statisticsUpdate');
const pathUtils = require('path');
const fsPromise = require('./fs/fsPromise');
const loopDetector = require('./symlink/loopDetector');
const entryComparator = require('./entry/entryComparator');
const entryType = require('./entry/entryType');
const { getPrmissionDenieStateWhenLeftMissing, getPrmissionDenieStateWhenRightMissing, getPermissionDeniedState } = require('./permissions/permissionDeniedState');
/**
* Returns the sorted list of entries in a directory.
*/
function getEntries(rootEntry, relativePath, loopDetected, options) {
if (!rootEntry || loopDetected) {
return Promise.resolve([]);
}
if (rootEntry.isDirectory) {
if (rootEntry.isPermissionDenied) {
return [];
}
return fsPromise.readdir(rootEntry.absolutePath)
.then(entries => entryBuilder.buildDirEntries(rootEntry, entries, relativePath, options));
}
return Promise.resolve([rootEntry]);
}
/**
* Compares two directories asynchronously.
*/
function compare(rootEntry1, rootEntry2, level, relativePath, options, statistics, diffSet, symlinkCache) {
const loopDetected1 = loopDetector.detectLoop(rootEntry1, symlinkCache.dir1);
const loopDetected2 = loopDetector.detectLoop(rootEntry2, symlinkCache.dir2);
loopDetector.updateSymlinkCache(symlinkCache, rootEntry1, rootEntry2, loopDetected1, loopDetected2);
return Promise.all([getEntries(rootEntry1, relativePath, loopDetected1, options), getEntries(rootEntry2, relativePath, loopDetected2, options)])
.then(entriesResult => {
const entries1 = entriesResult[0];
const entries2 = entriesResult[1];
let i1 = 0, i2 = 0;
const comparePromises = [];
const compareFilePromises = [];
let subDiffSet;
while (i1 < entries1.length || i2 < entries2.length) {
const entry1 = entries1[i1];
const entry2 = entries2[i2];
let type1, type2;
// compare entry name (-1, 0, 1)
let cmp;
if (i1 < entries1.length && i2 < entries2.length) {
cmp = entryComparator.compareEntry(entry1, entry2, options);
type1 = entryType.getType(entry1);
type2 = entryType.getType(entry2);
}
else if (i1 < entries1.length) {
type1 = entryType.getType(entry1);
type2 = entryType.getType(undefined);
cmp = -1;
}
else {
type1 = entryType.getType(undefined);
type2 = entryType.getType(entry2);
cmp = 1;
}
// process entry
if (cmp === 0) {
// Both left/right exist and have the same name and type
const permissionDeniedState = getPermissionDeniedState(entry1, entry2);
if (permissionDeniedState === "access-ok") {
const compareEntryRes = entryEquality.isEntryEqualAsync(entry1, entry2, type1, diffSet, options);
const samePromise = compareEntryRes.samePromise;
const same = compareEntryRes.same;
if (same !== undefined) {
options.resultBuilder(entry1, entry2, same ? 'equal' : 'distinct', level, relativePath, options, statistics, diffSet, compareEntryRes.reason, permissionDeniedState);
stats.updateStatisticsBoth(entry1, entry2, compareEntryRes.same, compareEntryRes.reason, type1, permissionDeniedState, statistics, options);
}
else {
compareFilePromises.push(samePromise);
}
}
else {
const state = 'distinct';
const reason = "permission-denied";
const same = false;
options.resultBuilder(entry1, entry2, state, level, relativePath, options, statistics, diffSet, reason, permissionDeniedState);
stats.updateStatisticsBoth(entry1, entry2, same, reason, type1, permissionDeniedState, statistics, options);
}
i1++;
i2++;
if (!options.skipSubdirs && type1 === 'directory') {
if (!options.noDiffSet) {
subDiffSet = [];
diffSet.push(subDiffSet);
}
comparePromises.push(compare(entry1, entry2, level + 1, pathUtils.join(relativePath, entry1.name), options, statistics, subDiffSet, loopDetector.cloneSymlinkCache(symlinkCache)));
}
}
else if (cmp < 0) {
// Right missing
const permissionDeniedState = getPrmissionDenieStateWhenRightMissing(entry1);
options.resultBuilder(entry1, undefined, 'left', level, relativePath, options, statistics, diffSet, undefined, permissionDeniedState);
stats.updateStatisticsLeft(entry1, type1, permissionDeniedState, statistics, options);
i1++;
if (type1 === 'directory' && !options.skipSubdirs) {
if (!options.noDiffSet) {
subDiffSet = [];
diffSet.push(subDiffSet);
}
comparePromises.push(compare(entry1, undefined, level + 1, pathUtils.join(relativePath, entry1.name), options, statistics, subDiffSet, loopDetector.cloneSymlinkCache(symlinkCache)));
}
}
else {
// Left missing
let permissionDeniedState = getPrmissionDenieStateWhenLeftMissing(entry2);
options.resultBuilder(undefined, entry2, 'right', level, relativePath, options, statistics, diffSet, undefined, permissionDeniedState);
stats.updateStatisticsRight(entry2, type2, permissionDeniedState, statistics, options);
i2++;
if (type2 === 'directory' && !options.skipSubdirs) {
if (!options.noDiffSet) {
subDiffSet = [];
diffSet.push(subDiffSet);
}
comparePromises.push(compare(undefined, entry2, level + 1, pathUtils.join(relativePath, entry2.name), options, statistics, subDiffSet, loopDetector.cloneSymlinkCache(symlinkCache)));
}
}
}
return Promise.all(comparePromises)
.then(() => Promise.all(compareFilePromises)
.then(sameResults => {
for (let i = 0; i < sameResults.length; i++) {
const sameResult = sameResults[i];
if (sameResult.error) {
return Promise.reject(sameResult.error);
}
else {
const permissionDeniedState = "access-ok";
options.resultBuilder(sameResult.entry1, sameResult.entry2, sameResult.same ? 'equal' : 'distinct', level, relativePath, options, statistics, sameResult.diffSet, sameResult.reason, permissionDeniedState);
stats.updateStatisticsBoth(sameResult.entries1, sameResult.entries2, sameResult.same, sameResult.reason, sameResult.type1, permissionDeniedState, statistics, options);
}
}
}));
});
}
module.exports = compare;
//# sourceMappingURL=compareAsync.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
export = compare;
/**
* Compares two directories synchronously.
*/
declare function compare(rootEntry1: any, rootEntry2: any, level: any, relativePath: any, options: any, statistics: any, diffSet: any, symlinkCache: any): void;
//# sourceMappingURL=compareSync.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareSync.d.ts","sourceRoot":"","sources":["../../src/compareSync.js"],"names":[],"mappings":";AA2BA;;GAEG;AACH,gKA0EC"}

104
mc_test/node_modules/dir-compare/build/src/compareSync.js generated vendored Executable file
View File

@ -0,0 +1,104 @@
const fs = require('fs');
const pathUtils = require('path');
const entryBuilder = require('./entry/entryBuilder');
const entryEquality = require('./entry/entryEquality');
const stats = require('./statistics/statisticsUpdate');
const loopDetector = require('./symlink/loopDetector');
const entryComparator = require('./entry/entryComparator');
const entryType = require('./entry/entryType');
const { getPrmissionDenieStateWhenLeftMissing, getPrmissionDenieStateWhenRightMissing, getPermissionDeniedState } = require('./permissions/permissionDeniedState');
/**
* Returns the sorted list of entries in a directory.
*/
function getEntries(rootEntry, relativePath, loopDetected, options) {
if (!rootEntry || loopDetected) {
return [];
}
if (rootEntry.isDirectory) {
if (rootEntry.isPermissionDenied) {
return [];
}
const entries = fs.readdirSync(rootEntry.absolutePath);
return entryBuilder.buildDirEntries(rootEntry, entries, relativePath, options);
}
return [rootEntry];
}
/**
* Compares two directories synchronously.
*/
function compare(rootEntry1, rootEntry2, level, relativePath, options, statistics, diffSet, symlinkCache) {
const loopDetected1 = loopDetector.detectLoop(rootEntry1, symlinkCache.dir1);
const loopDetected2 = loopDetector.detectLoop(rootEntry2, symlinkCache.dir2);
loopDetector.updateSymlinkCache(symlinkCache, rootEntry1, rootEntry2, loopDetected1, loopDetected2);
const entries1 = getEntries(rootEntry1, relativePath, loopDetected1, options);
const entries2 = getEntries(rootEntry2, relativePath, loopDetected2, options);
let i1 = 0, i2 = 0;
while (i1 < entries1.length || i2 < entries2.length) {
const entry1 = entries1[i1];
const entry2 = entries2[i2];
let type1, type2;
// compare entry name (-1, 0, 1)
let cmp;
if (i1 < entries1.length && i2 < entries2.length) {
cmp = entryComparator.compareEntry(entry1, entry2, options);
type1 = entryType.getType(entry1);
type2 = entryType.getType(entry2);
}
else if (i1 < entries1.length) {
type1 = entryType.getType(entry1);
type2 = entryType.getType(undefined);
cmp = -1;
}
else {
type1 = entryType.getType(undefined);
type2 = entryType.getType(entry2);
cmp = 1;
}
// process entry
if (cmp === 0) {
// Both left/right exist and have the same name and type
let same, reason, state;
const permissionDeniedState = getPermissionDeniedState(entry1, entry2);
if (permissionDeniedState === "access-ok") {
const compareEntryRes = entryEquality.isEntryEqualSync(entry1, entry2, type1, options);
state = compareEntryRes.same ? 'equal' : 'distinct';
same = compareEntryRes.same;
reason = compareEntryRes.reason;
}
else {
state = 'distinct';
same = false;
reason = "permission-denied";
}
options.resultBuilder(entry1, entry2, state, level, relativePath, options, statistics, diffSet, reason, permissionDeniedState);
stats.updateStatisticsBoth(entry1, entry2, same, reason, type1, permissionDeniedState, statistics, options);
i1++;
i2++;
if (!options.skipSubdirs && type1 === 'directory') {
compare(entry1, entry2, level + 1, pathUtils.join(relativePath, entry1.name), options, statistics, diffSet, loopDetector.cloneSymlinkCache(symlinkCache));
}
}
else if (cmp < 0) {
// Right missing
const permissionDeniedState = getPrmissionDenieStateWhenRightMissing(entry1);
options.resultBuilder(entry1, undefined, 'left', level, relativePath, options, statistics, diffSet, undefined, permissionDeniedState);
stats.updateStatisticsLeft(entry1, type1, permissionDeniedState, statistics, options);
i1++;
if (type1 === 'directory' && !options.skipSubdirs) {
compare(entry1, undefined, level + 1, pathUtils.join(relativePath, entry1.name), options, statistics, diffSet, loopDetector.cloneSymlinkCache(symlinkCache));
}
}
else {
// Left missing
let permissionDeniedState = getPrmissionDenieStateWhenLeftMissing(entry2);
options.resultBuilder(undefined, entry2, "right", level, relativePath, options, statistics, diffSet, undefined, permissionDeniedState);
stats.updateStatisticsRight(entry2, type2, permissionDeniedState, statistics, options);
i2++;
if (type2 === 'directory' && !options.skipSubdirs) {
compare(undefined, entry2, level + 1, pathUtils.join(relativePath, entry2.name), options, statistics, diffSet, loopDetector.cloneSymlinkCache(symlinkCache));
}
}
}
}
module.exports = compare;
//# sourceMappingURL=compareSync.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareSync.js","sourceRoot":"","sources":["../../src/compareSync.js"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AACxB,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AACjC,MAAM,YAAY,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAA;AACpD,MAAM,aAAa,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACtD,MAAM,KAAK,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAA;AACtD,MAAM,YAAY,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAA;AACtD,MAAM,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AAC1D,MAAM,SAAS,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;AAC9C,MAAM,EAAE,qCAAqC,EAAE,sCAAsC,EAAE,wBAAwB,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAA;AAElK;;GAEG;AACH,SAAS,UAAU,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO;IAC9D,IAAI,CAAC,SAAS,IAAI,YAAY,EAAE;QAC5B,OAAO,EAAE,CAAA;KACZ;IACD,IAAI,SAAS,CAAC,WAAW,EAAE;QACvB,IAAI,SAAS,CAAC,kBAAkB,EAAE;YAC9B,OAAO,EAAE,CAAA;SACZ;QACD,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;QACtD,OAAO,YAAY,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAA;KACjF;IACD,OAAO,CAAC,SAAS,CAAC,CAAA;AACtB,CAAC;AAED;;GA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KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAA;YACtI,KAAK,CAAC,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;YACtF,EAAE,EAAE,CAAA;YACJ,IAAI,KAAK,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;gBAC/C,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAA;aAC/J;SACJ;KACJ;AACL,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA"}

View File

@ -0,0 +1,53 @@
/// <reference types="node" />
import fs = require("fs");
/**
* Returns the sorted list of entries in a directory.
*/
export function buildDirEntries(rootEntry: any, dirEntries: any, relativePath: any, options: any): {
name: any;
absolutePath: any;
path: any;
stat: fs.Stats;
lstat: fs.Stats;
isSymlink: boolean;
isBrokenLink: boolean;
isDirectory: boolean;
isPermissionDenied: boolean;
}[];
/**
* Returns the sorted list of entries in a directory.
*/
export function buildDirEntries(rootEntry: any, dirEntries: any, relativePath: any, options: any): {
name: any;
absolutePath: any;
path: any;
stat: fs.Stats;
lstat: fs.Stats;
isSymlink: boolean;
isBrokenLink: boolean;
isDirectory: boolean;
isPermissionDenied: boolean;
}[];
export function buildEntry(absolutePath: any, path: any, name: any, options: any): {
name: any;
absolutePath: any;
path: any;
stat: fs.Stats;
lstat: fs.Stats;
isSymlink: boolean;
isBrokenLink: boolean;
isDirectory: boolean;
isPermissionDenied: boolean;
};
export function buildEntry(absolutePath: any, path: any, name: any, options: any): {
name: any;
absolutePath: any;
path: any;
stat: fs.Stats;
lstat: fs.Stats;
isSymlink: boolean;
isBrokenLink: boolean;
isDirectory: boolean;
isPermissionDenied: boolean;
};
//# sourceMappingURL=entryBuilder.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"entryBuilder.d.ts","sourceRoot":"","sources":["../../../src/entry/entryBuilder.js"],"names":[],"mappings":";;AAQC;;GAEG;AACH;;;;;;;;;;IAiBC;AApBD;;GAEG;AACH;;;;;;;;;;IAiBC;AAED;;;;;;;;;;EAqBC;AArBD;;;;;;;;;;EAqBC"}

View File

@ -0,0 +1,114 @@
const fs = require('fs');
const minimatch = require('minimatch');
const pathUtils = require('path');
const entryComparator = require('./entryComparator');
const PATH_SEP = pathUtils.sep;
module.exports = {
/**
* Returns the sorted list of entries in a directory.
*/
buildDirEntries(rootEntry, dirEntries, relativePath, options) {
const res = [];
for (let i = 0; i < dirEntries.length; i++) {
const entryName = dirEntries[i];
const entryAbsolutePath = rootEntry.absolutePath + PATH_SEP + entryName;
const entryPath = rootEntry.path + PATH_SEP + entryName;
const entry = this.buildEntry(entryAbsolutePath, entryPath, entryName, options);
if (options.skipSymlinks && entry.isSymlink) {
entry.stat = undefined;
}
if (filterEntry(entry, relativePath, options)) {
res.push(entry);
}
}
return res.sort((a, b) => entryComparator.compareEntry(a, b, options));
},
buildEntry(absolutePath, path, name, options) {
const stats = getStatIgnoreBrokenLink(absolutePath);
const isDirectory = stats.stat.isDirectory();
let isPermissionDenied = false;
if (options.handlePermissionDenied) {
const isFile = !isDirectory;
isPermissionDenied = hasPermissionDenied(absolutePath, isFile, options);
}
return {
name: name,
absolutePath: absolutePath,
path: path,
stat: stats.stat,
lstat: stats.lstat,
isSymlink: stats.lstat.isSymbolicLink(),
isBrokenLink: stats.isBrokenLink,
isDirectory,
isPermissionDenied
};
},
};
function hasPermissionDenied(absolutePath, isFile, options) {
if (isFile && !options.compareContent) {
return false;
}
try {
fs.accessSync(absolutePath, fs.constants.R_OK);
return false;
}
catch (_a) {
return true;
}
}
function getStatIgnoreBrokenLink(absolutePath) {
const lstat = fs.lstatSync(absolutePath);
try {
return {
stat: fs.statSync(absolutePath),
lstat: lstat,
isBrokenLink: false
};
}
catch (error) {
if (error.code === 'ENOENT') {
return {
stat: lstat,
lstat: lstat,
isBrokenLink: true
};
}
throw error;
}
}
/**
* Filter entries by file name. Returns true if the file is to be processed.
*/
function filterEntry(entry, relativePath, options) {
if (entry.isSymlink && options.skipSymlinks) {
return false;
}
const path = pathUtils.join(relativePath, entry.name);
if (options.skipEmptyDirs && entry.stat.isDirectory() && isEmptyDir(entry.absolutePath)) {
return false;
}
if ((entry.stat.isFile() && options.includeFilter) && (!match(path, options.includeFilter))) {
return false;
}
if ((options.excludeFilter) && (match(path, options.excludeFilter))) {
return false;
}
return true;
}
function isEmptyDir(path) {
return fs.readdirSync(path).length === 0;
}
/**
* Matches path by pattern.
*/
function match(path, pattern) {
const patternArray = pattern.split(',');
for (let i = 0; i < patternArray.length; i++) {
const pat = patternArray[i];
if (minimatch(path, pat, { dot: true, matchBase: true })) { //nocase
return true;
}
}
return false;
}
//# sourceMappingURL=entryBuilder.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"entryBuilder.js","sourceRoot":"","sources":["../../../src/entry/entryBuilder.js"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AACxB,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AACtC,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AACjC,MAAM,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;AAEpD,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAA;AAE9B,MAAM,CAAC,OAAO,GAAG;IAChB;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO;QAC3D,MAAM,GAAG,GAAG,EAAE,CAAA;QACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,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,IAAI,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;QACxF,OAAO,KAAK,CAAA;KACZ;IAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE;QAC5F,OAAO,KAAK,CAAA;KACZ;IAED,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE;QACpE,OAAO,KAAK,CAAA;KACZ;IAED,OAAO,IAAI,CAAA;AACZ,CAAC;AAED,SAAS,UAAU,CAAC,IAAI;IACvB,OAAO,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAA;AACzC,CAAC;AAED;;GAEG;AACH,SAAS,KAAK,CAAC,IAAI,EAAE,OAAO;IAC3B,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7C,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;QAC3B,IAAI,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,QAAQ;YACnE,OAAO,IAAI,CAAA;SACX;KACD;IACD,OAAO,KAAK,CAAA;AACb,CAAC"}

View File

@ -0,0 +1,3 @@
export function compareEntry(a: any, b: any, options: any): any;
export function compareEntry(a: any, b: any, options: any): any;
//# sourceMappingURL=entryComparator.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"entryComparator.d.ts","sourceRoot":"","sources":["../../../src/entry/entryComparator.js"],"names":[],"mappings":"AAIC,gEAcC;AAdD,gEAcC"}

View File

@ -0,0 +1,26 @@
/**
* Determines order criteria for sorting entries in a directory.
*/
module.exports = {
compareEntry(a, b, options) {
if (a.isBrokenLink && b.isBrokenLink) {
return options.compareNameHandler(a.name, b.name, options);
}
else if (a.isBrokenLink) {
return -1;
}
else if (b.isBrokenLink) {
return 1;
}
else if (a.stat.isDirectory() && b.stat.isFile()) {
return -1;
}
else if (a.stat.isFile() && b.stat.isDirectory()) {
return 1;
}
else {
return options.compareNameHandler(a.name, b.name, options);
}
}
};
//# sourceMappingURL=entryComparator.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"entryComparator.js","sourceRoot":"","sources":["../../../src/entry/entryComparator.js"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,GAAG;IAChB,YAAY,CAAE,CAAC,EAAE,CAAC,EAAE,OAAO;QAC1B,IAAI,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,YAAY,EAAE;YACrC,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;SAC1D;aAAM,IAAI,CAAC,CAAC,YAAY,EAAE;YAC1B,OAAO,CAAC,CAAC,CAAA;SACT;aAAM,IAAI,CAAC,CAAC,YAAY,EAAE;YAC1B,OAAO,CAAC,CAAA;SACR;aAAM,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE;YACnD,OAAO,CAAC,CAAC,CAAA;SACT;aAAM,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE;YACnD,OAAO,CAAC,CAAA;SACR;aAAM;YACN,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;SAC1D;IACF,CAAC;CACD,CAAA"}

View File

@ -0,0 +1,37 @@
export function isEntryEqualSync(entry1: any, entry2: any, type: any, options: any): {
same: boolean;
reason: string;
} | {
same: boolean;
reason?: undefined;
};
export function isEntryEqualSync(entry1: any, entry2: any, type: any, options: any): {
same: boolean;
reason: string;
} | {
same: boolean;
reason?: undefined;
};
export function isEntryEqualAsync(entry1: any, entry2: any, type: any, diffSet: any, options: any): {
same: undefined;
samePromise: any;
reason?: undefined;
} | {
same: boolean;
reason: string;
} | {
same: boolean;
reason?: undefined;
};
export function isEntryEqualAsync(entry1: any, entry2: any, type: any, diffSet: any, options: any): {
same: undefined;
samePromise: any;
reason?: undefined;
} | {
same: boolean;
reason: string;
} | {
same: boolean;
reason?: undefined;
};
//# sourceMappingURL=entryEquality.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"entryEquality.d.ts","sourceRoot":"","sources":["../../../src/entry/entryEquality.js"],"names":[],"mappings":"AAKI;;;;;;EAWC;AAXD;;;;;;EAWC;AAED;;;;;;;;;;EAWC;AAXD;;;;;;;;;;EAWC"}

View File

@ -0,0 +1,121 @@
const fs = require('fs');
/**
* Compares two entries with identical name and type.
*/
module.exports = {
isEntryEqualSync(entry1, entry2, type, options) {
if (type === 'file') {
return isFileEqualSync(entry1, entry2, options);
}
if (type === 'directory') {
return isDirectoryEqual(entry1, entry2, options);
}
if (type === 'broken-link') {
return isBrokenLinkEqual();
}
throw new Error('Unexpected type ' + type);
},
isEntryEqualAsync(entry1, entry2, type, diffSet, options) {
if (type === 'file') {
return isFileEqualAsync(entry1, entry2, type, diffSet, options);
}
if (type === 'directory') {
return isDirectoryEqual(entry1, entry2, options);
}
if (type === 'broken-link') {
return isBrokenLinkEqual();
}
throw new Error('Unexpected type ' + type);
}
};
function isFileEqualSync(entry1, entry2, options) {
const p1 = entry1 ? entry1.absolutePath : undefined;
const p2 = entry2 ? entry2.absolutePath : undefined;
if (options.compareSymlink && !isSymlinkEqual(entry1, entry2)) {
return { same: false, reason: 'different-symlink' };
}
if (options.compareSize && entry1.stat.size !== entry2.stat.size) {
return { same: false, reason: 'different-size' };
}
if (options.compareDate && !isDateEqual(entry1.stat.mtime, entry2.stat.mtime, options.dateTolerance)) {
return { same: false, reason: 'different-date' };
}
if (options.compareContent && !options.compareFileSync(p1, entry1.stat, p2, entry2.stat, options)) {
return { same: false, reason: 'different-content' };
}
return { same: true };
}
function isFileEqualAsync(entry1, entry2, type, diffSet, options) {
const p1 = entry1 ? entry1.absolutePath : undefined;
const p2 = entry2 ? entry2.absolutePath : undefined;
if (options.compareSymlink && !isSymlinkEqual(entry1, entry2)) {
return { same: false, reason: 'different-symlink' };
}
if (options.compareSize && entry1.stat.size !== entry2.stat.size) {
return { same: false, samePromise: undefined, reason: 'different-size' };
}
if (options.compareDate && !isDateEqual(entry1.stat.mtime, entry2.stat.mtime, options.dateTolerance)) {
return { same: false, samePromise: undefined, reason: 'different-date' };
}
if (options.compareContent) {
let samePromise = undefined;
let subDiffSet;
if (!options.noDiffSet) {
subDiffSet = [];
diffSet.push(subDiffSet);
}
samePromise = options.compareFileAsync(p1, entry1.stat, p2, entry2.stat, options)
.then((comparisonResult) => {
let same, error;
if (typeof (comparisonResult) === "boolean") {
same = comparisonResult;
}
else {
error = comparisonResult;
}
return {
entry1: entry1, entry2: entry2, same: same,
error: error, type1: type, type2: type,
diffSet: subDiffSet,
reason: same ? undefined : 'different-content'
};
})
.catch((error) => ({
error: error
}));
return { same: undefined, samePromise: samePromise };
}
return { same: true, samePromise: undefined };
}
function isDirectoryEqual(entry1, entry2, options) {
if (options.compareSymlink && !isSymlinkEqual(entry1, entry2)) {
return { same: false, reason: 'different-symlink' };
}
return { same: true };
}
function isBrokenLinkEqual() {
return { same: false, reason: 'broken-link' }; // broken links are never considered equal
}
/**
* Compares two dates and returns true/false depending on tolerance (milliseconds).
* Two dates are considered equal if the difference in milliseconds between them is less or equal than tolerance.
*/
function isDateEqual(date1, date2, tolerance) {
return Math.abs(date1.getTime() - date2.getTime()) <= tolerance ? true : false;
}
/**
* Compares two entries for symlink equality.
*/
function isSymlinkEqual(entry1, entry2) {
if (!entry1.isSymlink && !entry2.isSymlink) {
return true;
}
if (entry1.isSymlink && entry2.isSymlink && hasIdenticalLink(entry1.absolutePath, entry2.absolutePath)) {
return true;
}
return false;
}
function hasIdenticalLink(path1, path2) {
return fs.readlinkSync(path1) === fs.readlinkSync(path2);
}
//# sourceMappingURL=entryEquality.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"entryEquality.js","sourceRoot":"","sources":["../../../src/entry/entryEquality.js"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AACxB;;GAEG;AACH,MAAM,CAAC,OAAO,GAAG;IACb,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;QAC1C,IAAI,IAAI,KAAK,MAAM,EAAE;YACjB,OAAO,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;SAClD;QACD,IAAI,IAAI,KAAK,WAAW,EAAE;YACtB,OAAO,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;SACnD;QACD,IAAI,IAAI,KAAK,aAAa,EAAE;YACxB,OAAO,iBAAiB,EAAE,CAAA;SAC7B;QACD,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAA;IAC9C,CAAC;IAED,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO;QACpD,IAAI,IAAI,KAAK,MAAM,EAAE;YACjB,OAAO,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;SAClE;QACD,IAAI,IAAI,KAAK,WAAW,EAAE;YACtB,OAAO,gBAAgB,CAAC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AE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA,CAAC,0CAA0C;AAC5F,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS;IACxC,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;AAClF,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,MAAM,EAAE,MAAM;IAClC,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;QACxC,OAAO,IAAI,CAAA;KACd;IACD,IAAI,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,IAAI,gBAAgB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE;QACpG,OAAO,IAAI,CAAA;KACd;IACD,OAAO,KAAK,CAAA;AAChB,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAClC,OAAO,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;AAC5D,CAAC"}

View File

@ -0,0 +1,9 @@
/**
* One of 'missing','file','directory','broken-link'
*/
export function getType(entry: any): "file" | "broken-link" | "missing" | "directory";
/**
* One of 'missing','file','directory','broken-link'
*/
export function getType(entry: any): "file" | "broken-link" | "missing" | "directory";
//# sourceMappingURL=entryType.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"entryType.d.ts","sourceRoot":"","sources":["../../../src/entry/entryType.js"],"names":[],"mappings":"AAEC;;GAEG;AACH,sFAWC;AAdD;;GAEG;AACH,sFAWC"}

View File

@ -0,0 +1,18 @@
module.exports = {
/**
* One of 'missing','file','directory','broken-link'
*/
getType(entry) {
if (!entry) {
return 'missing';
}
if (entry.isBrokenLink) {
return 'broken-link';
}
if (entry.isDirectory) {
return 'directory';
}
return 'file';
}
};
//# sourceMappingURL=entryType.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"entryType.js","sourceRoot":"","sources":["../../../src/entry/entryType.js"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,GAAG;IAChB;;OAEG;IACH,OAAO,CAAE,KAAK;QACb,IAAI,CAAC,KAAK,EAAE;YACX,OAAO,SAAS,CAAA;SAChB;QACD,IAAI,KAAK,CAAC,YAAY,EAAE;YACvB,OAAO,aAAa,CAAA;SACpB;QACD,IAAI,KAAK,CAAC,WAAW,EAAE;YACtB,OAAO,WAAW,CAAA;SAClB;QACD,OAAO,MAAM,CAAA;IACd,CAAC;CACD,CAAA"}

View File

@ -0,0 +1,3 @@
import { CompareFileHandler } from '../../types';
export declare const defaultFileCompare: CompareFileHandler;
//# sourceMappingURL=defaultFileCompare.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"defaultFileCompare.d.ts","sourceRoot":"","sources":["../../../../src/fileCompareHandler/default/defaultFileCompare.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAOhD,eAAO,MAAM,kBAAkB,EAAE,kBA+EhC,CAAA"}

View File

@ -0,0 +1,118 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultFileCompare = void 0;
const fs_1 = __importDefault(require("fs"));
const buffer_equal_1 = __importDefault(require("buffer-equal"));
const FileDescriptorQueue_1 = require("../../fs/FileDescriptorQueue");
const fsPromise_1 = __importDefault(require("../../fs/fsPromise"));
const BufferPool_1 = require("../../fs/BufferPool");
const closeFile_1 = __importDefault(require("../../fs/closeFile"));
const MAX_CONCURRENT_FILE_COMPARE = 8;
const BUF_SIZE = 100000;
const fdQueue = new FileDescriptorQueue_1.FileDescriptorQueue(MAX_CONCURRENT_FILE_COMPARE * 2);
const bufferPool = new BufferPool_1.BufferPool(BUF_SIZE, MAX_CONCURRENT_FILE_COMPARE); // fdQueue guarantees there will be no more than MAX_CONCURRENT_FILE_COMPARE async processes accessing the buffers concurrently
exports.defaultFileCompare = {
/**
* Compares two files by content.
*/
compareSync(path1, stat1, path2, stat2, options) {
let fd1;
let fd2;
if (stat1.size !== stat2.size) {
return false;
}
const bufferPair = bufferPool.allocateBuffers();
try {
fd1 = fs_1.default.openSync(path1, 'r');
fd2 = fs_1.default.openSync(path2, 'r');
const buf1 = bufferPair.buf1;
const buf2 = bufferPair.buf2;
for (;;) {
const size1 = fs_1.default.readSync(fd1, buf1, 0, BUF_SIZE, null);
const size2 = fs_1.default.readSync(fd2, buf2, 0, BUF_SIZE, null);
if (size1 !== size2) {
return false;
}
else if (size1 === 0) {
// End of file reached
return true;
}
else if (!compareBuffers(buf1, buf2, size1)) {
return false;
}
}
}
finally {
closeFile_1.default.closeFilesSync(fd1, fd2);
bufferPool.freeBuffers(bufferPair);
}
},
/**
* Compares two files by content
*/
compareAsync(path1, stat1, path2, stat2, options) {
return __awaiter(this, void 0, void 0, function* () {
let fd1;
let fd2;
let bufferPair;
if (stat1.size !== stat2.size) {
return Promise.resolve(false);
}
return Promise.all([fdQueue.openPromise(path1, 'r'), fdQueue.openPromise(path2, 'r')])
.then(fds => {
bufferPair = bufferPool.allocateBuffers();
fd1 = fds[0];
fd2 = fds[1];
const buf1 = bufferPair.buf1;
const buf2 = bufferPair.buf2;
const compareAsyncInternal = () => Promise.all([
fsPromise_1.default.read(fd1, buf1, 0, BUF_SIZE, null),
fsPromise_1.default.read(fd2, buf2, 0, BUF_SIZE, null)
])
.then((bufferSizes) => {
const size1 = bufferSizes[0];
const size2 = bufferSizes[1];
if (size1 !== size2) {
return false;
}
else if (size1 === 0) {
// End of file reached
return true;
}
else if (!compareBuffers(buf1, buf2, size1)) {
return false;
}
else {
return compareAsyncInternal();
}
});
return compareAsyncInternal();
})
.then(
// 'finally' polyfill for node 8 and below
res => finalizeAsync(fd1, fd2, bufferPair).then(() => res), err => finalizeAsync(fd1, fd2, bufferPair).then(() => { throw err; }));
});
}
};
function compareBuffers(buf1, buf2, contentSize) {
return buffer_equal_1.default(buf1.slice(0, contentSize), buf2.slice(0, contentSize));
}
function finalizeAsync(fd1, fd2, bufferPair) {
if (bufferPair) {
bufferPool.freeBuffers(bufferPair);
}
return closeFile_1.default.closeFilesAsync(fd1, fd2, fdQueue);
}
//# sourceMappingURL=defaultFileCompare.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"defaultFileCompare.js","sourceRoot":"","sources":["../../../../src/fileCompareHandler/default/defaultFileCompare.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAmB;AACnB,gEAAsC;AACtC,sEAAkE;AAClE,mEAA0C;AAC1C,oDAA4D;AAC5D,mEAA0C;AAI1C,MAAM,2BAA2B,GAAG,CAAC,CAAA;AACrC,MAAM,QAAQ,GAAG,MAAM,CAAA;AACvB,MAAM,OAAO,GAAG,IAAI,yCAAmB,CAAC,2BAA2B,GAAG,CAAC,CAAC,CAAA;AACxE,MAAM,UAAU,GAAG,IAAI,uBAAU,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAA,CAAE,+HAA+H;AAE5L,QAAA,kBAAkB,GAAuB;IAClD;;OAEG;IACH,WAAW,CAAC,KAAa,EAAE,KAAe,EAAE,KAAa,EAAE,KAAe,EAAE,OAAgB;QACxF,IAAI,GA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CAAC,EAAE;wBAC3C,OAAO,KAAK,CAAA;qBACf;yBAAM;wBACH,OAAO,oBAAoB,EAAE,CAAA;qBAChC;gBACL,CAAC,CAAC,CAAA;gBACN,OAAO,oBAAoB,EAAE,CAAA;YACjC,CAAC,CAAC;iBACD,IAAI;YACD,0CAA0C;YAC1C,GAAG,CAAC,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAC1D,GAAG,CAAC,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,GAAG,CAAA,CAAC,CAAC,CAAC,CACvE,CAAA;QACT,CAAC;KAAA;CAEJ,CAAA;AAGD,SAAS,cAAc,CAAC,IAAY,EAAE,IAAY,EAAE,WAAmB;IACnE,OAAO,sBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAA;AAC9E,CAAC;AAED,SAAS,aAAa,CAAC,GAAY,EAAE,GAAY,EAAE,UAAuB;IACtE,IAAI,UAAU,EAAE;QACZ,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;KACrC;IACD,OAAO,mBAAS,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;AACvD,CAAC"}

View File

@ -0,0 +1,36 @@
import { BufferPair } from '../../fs/BufferPool';
interface RestPair {
rest1: string;
rest2: string;
}
interface RestLines {
restLines1: string[];
restLines2: string[];
}
export declare class LineBasedCompareContext {
/**
* File to compare.
*/
fd1: number;
/**
* File to compare.
*/
fd2: number;
/**
* Buffers used as temporary storage.
*/
buffer: BufferPair;
/**
* Part of a line that was split at buffer boundary in a previous read.
* Will be prefixed to the next read.
*/
rest: RestPair;
/**
* Lines that remain unprocessed from a previous read.
* Will be prefixed to the next read.
*/
restLines: RestLines;
constructor(fd1: number, fd2: number, bufferPair: BufferPair);
}
export {};
//# sourceMappingURL=LineBasedCompareContext.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"LineBasedCompareContext.d.ts","sourceRoot":"","sources":["../../../../src/fileCompareHandler/lines/LineBasedCompareContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,UAAU,QAAQ;IACd,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CAChB;AAED,UAAU,SAAS;IACf,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,UAAU,EAAE,MAAM,EAAE,CAAA;CACvB;AAED,qBAAa,uBAAuB;IAChC;;OAEG;IACI,GAAG,EAAE,MAAM,CAAA;IAClB;;OAEG;IACI,GAAG,EAAE,MAAM,CAAA;IAClB;;OAEG;IACI,MAAM,EAAE,UAAU,CAAA;IACzB;;;OAGG;IACI,IAAI,EAAE,QAAQ,CAAyB;IAC9C;;;OAGG;IACI,SAAS,EAAE,SAAS,CAAmC;gBAElD,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU;CAK/D"}

View File

@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LineBasedCompareContext = void 0;
class LineBasedCompareContext {
constructor(fd1, fd2, bufferPair) {
/**
* Part of a line that was split at buffer boundary in a previous read.
* Will be prefixed to the next read.
*/
this.rest = { rest1: '', rest2: '' };
/**
* Lines that remain unprocessed from a previous read.
* Will be prefixed to the next read.
*/
this.restLines = { restLines1: [], restLines2: [] };
this.fd1 = fd1;
this.fd2 = fd2;
this.buffer = bufferPair;
}
}
exports.LineBasedCompareContext = LineBasedCompareContext;
//# sourceMappingURL=LineBasedCompareContext.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"LineBasedCompareContext.js","sourceRoot":"","sources":["../../../../src/fileCompareHandler/lines/LineBasedCompareContext.ts"],"names":[],"mappings":";;;AAYA,MAAa,uBAAuB;IAwBhC,YAAY,GAAW,EAAE,GAAW,EAAE,UAAsB;QAX5D;;;WAGG;QACI,SAAI,GAAa,EAAC,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAC,CAAA;QAC9C;;;WAGG;QACI,cAAS,GAAc,EAAC,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAC,CAAA;QAG1D,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,UAAU,CAAA;IAC5B,CAAC;CACJ;AA7BD,0DA6BC"}

View File

@ -0,0 +1,15 @@
export interface CompareLinesResult {
/**
* Whether compared lines are identical.
*/
isEqual: boolean;
/**
* Lines that were not compared due to unbalanced buffers.
*/
restLines1: string[];
/**
* Lines that were not compared due to unbalanced buffers.
*/
restLines2: string[];
}
//# sourceMappingURL=CompareLinesResult.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"CompareLinesResult.d.ts","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/compare/CompareLinesResult.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE,CAAA;CACvB"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=CompareLinesResult.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"CompareLinesResult.js","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/compare/CompareLinesResult.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,27 @@
import { Options } from '../../../index';
import { LineBatch } from '../lineReader/LineBatch';
interface RestLines {
restLines1: string[];
restLines2: string[];
}
interface CompareLineBatchResult {
reachedEof: boolean;
batchIsEqual: boolean;
/**
* Lines that were not compared because the two line batches
* contained different number of lines.
* These remaining lines will be compared in the next step.
*/
restLines: RestLines;
}
/**
* Compares two batches of lines.
*
* @param lineBatch1 Batch to compare.
* @param lineBatch2 Batch to compare.
* @param context Comparison context.
* @param options Comparison options.
*/
export declare function compareLineBatches(lineBatch1: LineBatch, lineBatch2: LineBatch, options: Options): CompareLineBatchResult;
export {};
//# sourceMappingURL=compareLineBatches.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareLineBatches.d.ts","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/compare/compareLineBatches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,UAAU,SAAS;IACf,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,UAAU,EAAE,MAAM,EAAE,CAAA;CACvB;AAED,UAAU,sBAAsB;IAC5B,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,OAAO,CAAA;IACrB;;;;OAIG;IACH,SAAS,EAAE,SAAS,CAAA;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,sBAAsB,CAuBzH"}

View File

@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compareLineBatches = void 0;
const compareLines_1 = require("./compareLines");
/**
* Compares two batches of lines.
*
* @param lineBatch1 Batch to compare.
* @param lineBatch2 Batch to compare.
* @param context Comparison context.
* @param options Comparison options.
*/
function compareLineBatches(lineBatch1, lineBatch2, options) {
const compareResult = compareLines_1.compareLines(lineBatch1.lines, lineBatch2.lines, options);
if (!compareResult.isEqual) {
return { batchIsEqual: false, reachedEof: false, restLines: emptyRestLines() };
}
const reachedEof = lineBatch1.reachedEof && lineBatch2.reachedEof;
const hasMoreLinesToProcess = compareResult.restLines1.length > 0 || compareResult.restLines2.length > 0;
if (reachedEof && hasMoreLinesToProcess) {
return { batchIsEqual: false, reachedEof: true, restLines: emptyRestLines() };
}
if (reachedEof) {
return { batchIsEqual: true, reachedEof: true, restLines: emptyRestLines() };
}
return { batchIsEqual: true, reachedEof: false,
restLines: {
restLines1: compareResult.restLines1,
restLines2: compareResult.restLines2,
}
};
}
exports.compareLineBatches = compareLineBatches;
function emptyRestLines() {
return {
restLines1: [],
restLines2: []
};
}
//# sourceMappingURL=compareLineBatches.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareLineBatches.js","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/compare/compareLineBatches.ts"],"names":[],"mappings":";;;AAEA,iDAA6C;AAkB7C;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAAC,UAAqB,EAAE,UAAqB,EAAE,OAAgB;IAE7F,MAAM,aAAa,GAAG,2BAAY,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAC/E,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;QACxB,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,EAAC,CAAA;KAChF;IAED,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,UAAU,CAAC,UAAU,CAAA;IACjE,MAAM,qBAAqB,GAAG,aAAa,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAA;IACxG,IAAI,UAAU,IAAI,qBAAqB,EAAE;QACrC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAG,SAAS,EAAE,cAAc,EAAE,EAAC,CAAA;KAChF;IAED,IAAI,UAAU,EAAE;QACZ,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAG,SAAS,EAAE,cAAc,EAAE,EAAC,CAAA;KAC/E;IAED,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK;QAC1C,SAAS,EAAE;YACP,UAAU,EAAE,aAAa,CAAC,UAAU;YACpC,UAAU,EAAE,aAAa,CAAC,UAAU;SACvC;KACJ,CAAA;AACL,CAAC;AAvBD,gDAuBC;AAED,SAAS,cAAc;IACnB,OAAO;QACH,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,EAAE;KACjB,CAAA;AACL,CAAC"}

View File

@ -0,0 +1,4 @@
import { Options } from "../../../index";
import { CompareLinesResult } from "./CompareLinesResult";
export declare function compareLines(lines1: string[], lines2: string[], options: Options): CompareLinesResult;
//# sourceMappingURL=compareLines.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareLines.d.ts","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/compare/compareLines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAMzD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAkBrG"}

View File

@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compareLines = void 0;
const TRIM_WHITE_SPACES_REGEXP = /^[ \f\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+|[ \f\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+$/g;
const TRIM_LINE_ENDING_REGEXP = /\r\n|\n$/g;
const REMOVE_WHITE_SPACES_REGEXP = /[ \f\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/g;
function compareLines(lines1, lines2, options) {
if (options.ignoreEmptyLines) {
lines1 = removeEmptyLines(lines1);
lines2 = removeEmptyLines(lines2);
}
const len = Math.min(lines1.length, lines2.length);
let i = 0;
for (; i < len; i++) {
const isEqual = compareLine(options, lines1[i], lines2[i]);
if (!isEqual) {
return { isEqual: false, restLines1: [], restLines2: [] };
}
}
return {
isEqual: true,
restLines1: lines1.slice(i),
restLines2: lines2.slice(i)
};
}
exports.compareLines = compareLines;
function compareLine(options, line1, line2) {
if (options.ignoreLineEnding) {
line1 = trimLineEnding(line1);
line2 = trimLineEnding(line2);
}
if (options.ignoreWhiteSpaces) {
line1 = trimSpaces(line1);
line2 = trimSpaces(line2);
}
if (options.ignoreAllWhiteSpaces) {
line1 = removeSpaces(line1);
line2 = removeSpaces(line2);
}
return line1 === line2;
}
// Trims string like ' abc \n' into 'abc\n'
function trimSpaces(s) {
const { content, lineEnding } = separateEol(s);
const trimmed = content.replace(TRIM_WHITE_SPACES_REGEXP, '');
return trimmed + lineEnding;
}
function trimLineEnding(s) {
return s.replace(TRIM_LINE_ENDING_REGEXP, '');
}
function removeSpaces(s) {
return s.replace(REMOVE_WHITE_SPACES_REGEXP, '');
}
function removeEmptyLines(lines) {
return lines.filter(line => !isEmptyLine(line));
}
function isEmptyLine(line) {
return line === '\n' || line === '\r\n';
}
function separateEol(s) {
const len = s.length;
let lineEnding = '';
let content = s;
if (s[len - 1] === '\n') {
if (s[len - 2] === '\r') {
return {
lineEnding: '\r\n',
content: s.slice(0, len - 2)
};
}
{
lineEnding = '\n';
content = s.slice(0, len - 1);
}
}
return { content, lineEnding };
}
//# sourceMappingURL=compareLines.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareLines.js","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/compare/compareLines.ts"],"names":[],"mappings":";;;AAGA,MAAM,wBAAwB,GAAG,oJAAoJ,CAAA;A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;gBACH,UAAU,EAAE,MAAM;gBAClB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;aAC/B,CAAA;SACJ;QAED;YACI,UAAU,GAAG,IAAI,CAAA;YACjB,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAA;SAChC;KACJ;IACD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAA;AAClC,CAAC"}

View File

@ -0,0 +1,3 @@
import { CompareFileAsync } from '../../types';
export declare const lineBasedCompareAsync: CompareFileAsync;
//# sourceMappingURL=compareAsync.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareAsync.d.ts","sourceRoot":"","sources":["../../../../src/fileCompareHandler/lines/compareAsync.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAQ9C,eAAO,MAAM,qBAAqB,EAAE,gBA+BnC,CAAA"}

View File

@ -0,0 +1,75 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.lineBasedCompareAsync = void 0;
const FileDescriptorQueue_1 = require("../../fs/FileDescriptorQueue");
const closeFile_1 = __importDefault(require("../../fs/closeFile"));
const fsPromise_1 = __importDefault(require("../../fs/fsPromise"));
const LineBasedCompareContext_1 = require("./LineBasedCompareContext");
const BufferPool_1 = require("../../fs/BufferPool");
const compareLineBatches_1 = require("./compare/compareLineBatches");
const readBufferedLines_1 = require("./lineReader/readBufferedLines");
const BUF_SIZE = 100000;
const MAX_CONCURRENT_FILE_COMPARE = 8;
const fdQueue = new FileDescriptorQueue_1.FileDescriptorQueue(MAX_CONCURRENT_FILE_COMPARE * 2);
const bufferPool = new BufferPool_1.BufferPool(BUF_SIZE, MAX_CONCURRENT_FILE_COMPARE); // fdQueue guarantees there will be no more than MAX_CONCURRENT_FILE_COMPARE async processes accessing the buffers concurrently
const lineBasedCompareAsync = (path1, stat1, path2, stat2, options) => __awaiter(void 0, void 0, void 0, function* () {
var _a;
const bufferSize = Math.min(BUF_SIZE, (_a = options.lineBasedHandlerBufferSize) !== null && _a !== void 0 ? _a : Number.MAX_VALUE);
let context;
try {
const fileDescriptors = yield Promise.all([fdQueue.openPromise(path1, 'r'), fdQueue.openPromise(path2, 'r')]);
context = new LineBasedCompareContext_1.LineBasedCompareContext(fileDescriptors[0], fileDescriptors[1], bufferPool.allocateBuffers());
for (;;) {
const lineBatch1 = yield readLineBatchAsync(context.fd1, context.buffer.buf1, bufferSize, context.rest.rest1, context.restLines.restLines1);
const lineBatch2 = yield readLineBatchAsync(context.fd2, context.buffer.buf2, bufferSize, context.rest.rest2, context.restLines.restLines2);
context.rest.rest1 = lineBatch1.rest;
context.rest.rest2 = lineBatch2.rest;
const compareResult = compareLineBatches_1.compareLineBatches(lineBatch1, lineBatch2, options);
if (!compareResult.batchIsEqual) {
return false;
}
if (compareResult.reachedEof) {
return compareResult.batchIsEqual;
}
context.restLines.restLines1 = compareResult.restLines.restLines1;
context.restLines.restLines2 = compareResult.restLines.restLines2;
}
}
finally {
if (context) {
bufferPool.freeBuffers(context.buffer);
yield closeFile_1.default.closeFilesAsync(context.fd1, context.fd2, fdQueue);
}
}
});
exports.lineBasedCompareAsync = lineBasedCompareAsync;
/**
* Reads a batch of lines from file starting with current position.
*
* @param fd File to read lines from.
* @param buf Buffer used as temporary line storage.
* @param bufferSize Allocated buffer size. The number of lines in the batch is limited by this size.
* @param rest Part of a line that was split at buffer boundary in a previous read.
* Will be added to result.
* @param restLines Lines that remain unprocessed from a previous read.
* Will be added to result.
*/
function readLineBatchAsync(fd, buf, bufferSize, rest, restLines) {
return __awaiter(this, void 0, void 0, function* () {
const size = yield fsPromise_1.default.read(fd, buf, 0, bufferSize, null);
return readBufferedLines_1.readBufferedLines(buf, size, bufferSize, rest, restLines);
});
}
//# sourceMappingURL=compareAsync.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareAsync.js","sourceRoot":"","sources":["../../../../src/fileCompareHandler/lines/compareAsync.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sEAAkE;AAClE,mEAA2C;AAC3C,mEAA0C;AAI1C,uEAAmE;AACnE,oDAAgD;AAChD,qEAAiE;AACjE,sEAAkE;AAGlE,MAAM,QAAQ,GAAG,MAAM,CAAA;AACvB,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAErC,MAAM,OAAO,GAAG,IAAI,yCAAmB,CAAC,2BAA2B,GAAG,CAAC,CAAC,CAAA;AACxE,MAAM,UAAU,GAAG,IAAI,uBAAU,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAA,CAAE,+HAA+H;AAElM,MAAM,qBAAqB,GAAqB,CAAO,KAAa,EAAE,KAAe,EAAE,KAAa,EAAE,KAAe,EAAE,OAAgB,EAAoB,EAAE;;IAChK,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAA,OAAO,CAAC,0BAA0B,mCAAI,MAAM,CAAC,SAAS,CAAC,CAAA;IAC7F,IAAI,OAA4C,CAAA;IAChD,IAAI;QACA,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;QAC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GAAG,EAAE,OAAO,CAAC,CAAA;SACtE;KACJ;AACL,CAAC,CAAA,CAAA;AA/BY,QAAA,qBAAqB,yBA+BjC;AAED;;;;;;;;;;GAUG;AACH,SAAe,kBAAkB,CAAC,EAAU,EAAE,GAAW,EAAE,UAAkB,EAAE,IAAY,EAAE,SAAmB;;QAC5G,MAAM,IAAI,GAAG,MAAM,mBAAS,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;QAC/D,OAAO,qCAAiB,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;IACpE,CAAC;CAAA"}

View File

@ -0,0 +1,3 @@
import { CompareFileSync } from '../../types';
export declare const lineBasedCompareSync: CompareFileSync;
//# sourceMappingURL=compareSync.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareSync.d.ts","sourceRoot":"","sources":["../../../../src/fileCompareHandler/lines/compareSync.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAU7C,eAAO,MAAM,oBAAoB,EAAE,eA8BlC,CAAA"}

View File

@ -0,0 +1,60 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.lineBasedCompareSync = void 0;
const fs_1 = __importDefault(require("fs"));
const closeFile_1 = __importDefault(require("../../fs/closeFile"));
const LineBasedCompareContext_1 = require("./LineBasedCompareContext");
const compareLineBatches_1 = require("./compare/compareLineBatches");
const readBufferedLines_1 = require("./lineReader/readBufferedLines");
const BUF_SIZE = 100000;
const bufferPair = {
buf1: Buffer.alloc(BUF_SIZE),
buf2: Buffer.alloc(BUF_SIZE),
busy: true
};
const lineBasedCompareSync = (path1, stat1, path2, stat2, options) => {
var _a;
const bufferSize = Math.min(BUF_SIZE, (_a = options.lineBasedHandlerBufferSize) !== null && _a !== void 0 ? _a : Number.MAX_VALUE);
let context;
try {
context = new LineBasedCompareContext_1.LineBasedCompareContext(fs_1.default.openSync(path1, 'r'), fs_1.default.openSync(path2, 'r'), bufferPair);
for (;;) {
const lineBatch1 = readLineBatchSync(context.fd1, context.buffer.buf1, bufferSize, context.rest.rest1, context.restLines.restLines1);
const lineBatch2 = readLineBatchSync(context.fd2, context.buffer.buf2, bufferSize, context.rest.rest2, context.restLines.restLines2);
context.rest.rest1 = lineBatch1.rest;
context.rest.rest2 = lineBatch2.rest;
const compareResult = compareLineBatches_1.compareLineBatches(lineBatch1, lineBatch2, options);
if (!compareResult.batchIsEqual) {
return false;
}
if (compareResult.reachedEof) {
return compareResult.batchIsEqual;
}
context.restLines.restLines1 = compareResult.restLines.restLines1;
context.restLines.restLines2 = compareResult.restLines.restLines2;
}
}
finally {
closeFile_1.default.closeFilesSync(context === null || context === void 0 ? void 0 : context.fd1, context === null || context === void 0 ? void 0 : context.fd2);
}
};
exports.lineBasedCompareSync = lineBasedCompareSync;
/**
* Reads a batch of lines from file starting with current position.
*
* @param fd File to read lines from.
* @param buf Buffer used as temporary line storage.
* @param bufferSize Allocated buffer size. The number of lines in the batch is limited by this size.
* @param rest Part of a line that was split at buffer boundary in a previous read.
* Will be added to result.
* @param restLines Lines that remain unprocessed from a previous read.
* Will be added to result.
*/
function readLineBatchSync(fd, buf, bufferSize, rest, restLines) {
const size = fs_1.default.readSync(fd, buf, 0, bufferSize, null);
return readBufferedLines_1.readBufferedLines(buf, size, bufferSize, rest, restLines);
}
//# sourceMappingURL=compareSync.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"compareSync.js","sourceRoot":"","sources":["../../../../src/fileCompareHandler/lines/compareSync.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AAEnB,mEAA2C;AAC3C,uEAAmE;AACnE,qEAAiE;AACjE,sEAAkE;AAKlE,MAAM,QAAQ,GAAG,MAAM,CAAA;AAEvB,MAAM,UAAU,GAAe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7B,OAAO,KAAK,CAAA;aACf;YACD,IAAI,aAAa,CAAC,UAAU,EAAE;gBAC1B,OAAO,aAAa,CAAC,YAAY,CAAA;aACpC;YAED,OAAO,CAAC,SAAS,CAAC,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,UAAU,CAAA;YACjE,OAAO,CAAC,SAAS,CAAC,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,UAAU,CAAA;SACpE;KACJ;YAAS;QACN,mBAAU,CAAC,cAAc,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,CAAA;KACxD;AACL,CAAC,CAAA;AA9BY,QAAA,oBAAoB,wBA8BhC;AAED;;;;;;;;;;GAUG;AACH,SAAS,iBAAiB,CAAC,EAAU,EAAE,GAAW,EAAE,UAAkB,EAAE,IAAY,EAAE,SAAmB;IACrG,MAAM,IAAI,GAAG,YAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IACtD,OAAO,qCAAiB,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;AACpE,CAAC"}

View File

@ -0,0 +1,7 @@
import { CompareFileHandler } from '../../types';
/**
* Compare files line by line with options to ignore
* line endings and white space differences.
*/
export declare const lineBasedFileCompare: CompareFileHandler;
//# sourceMappingURL=lineBasedFileCompare.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"lineBasedFileCompare.d.ts","sourceRoot":"","sources":["../../../../src/fileCompareHandler/lines/lineBasedFileCompare.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAGlC,CAAA"}

View File

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lineBasedFileCompare = void 0;
const compareSync_1 = require("./compareSync");
const compareAsync_1 = require("./compareAsync");
/**
* Compare files line by line with options to ignore
* line endings and white space differences.
*/
exports.lineBasedFileCompare = {
compareSync: compareSync_1.lineBasedCompareSync,
compareAsync: compareAsync_1.lineBasedCompareAsync
};
//# sourceMappingURL=lineBasedFileCompare.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"lineBasedFileCompare.js","sourceRoot":"","sources":["../../../../src/fileCompareHandler/lines/lineBasedFileCompare.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAClD,iDAAoD;AAGpD;;;GAGG;AACU,QAAA,oBAAoB,GAAuB;IACpD,WAAW,EAAE,kCAAoB;IACjC,YAAY,EAAE,oCAAqB;CACtC,CAAA"}

View File

@ -0,0 +1,16 @@
export interface LineBatch {
/**
* Batch of lines available after this read operation.
*/
lines: string[];
/**
* First part of a line that was split due to buffer boundary.
* It will be used in a subsequent read to complete the next line.
*/
rest: string;
/**
* Whether we reached end of file.
*/
reachedEof: boolean;
}
//# sourceMappingURL=LineBatch.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"LineBatch.d.ts","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/lineReader/LineBatch.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,SAAS;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;IACf;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,UAAU,EAAE,OAAO,CAAA;CACtB"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=LineBatch.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"LineBatch.js","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/lineReader/LineBatch.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,14 @@
/// <reference types="node" />
import { LineBatch } from './LineBatch';
/**
* Reads lines from given buffer.
* @param buf Buffer to read lines from.
* @param size Size of data available in buffer.
* @param allocatedBufferSize Maximum buffer storage.
* @param rest Part of a line that was split at buffer boundary in a previous read.
* Will be added to result.
* @param restLines Lines that remain unprocessed from a previous read due to unbalanced buffers.
* Will be added to result.
*/
export declare function readBufferedLines(buf: Buffer, size: number, allocatedBufferSize: number, rest: string, restLines: string[]): LineBatch;
//# sourceMappingURL=readBufferedLines.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"readBufferedLines.d.ts","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/lineReader/readBufferedLines.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAKvC;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,CAmBtI"}

View File

@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readBufferedLines = void 0;
const LINE_TOKENIZER_REGEXP = /[^\n]+\n?|\n/g;
/**
* Reads lines from given buffer.
* @param buf Buffer to read lines from.
* @param size Size of data available in buffer.
* @param allocatedBufferSize Maximum buffer storage.
* @param rest Part of a line that was split at buffer boundary in a previous read.
* Will be added to result.
* @param restLines Lines that remain unprocessed from a previous read due to unbalanced buffers.
* Will be added to result.
*/
function readBufferedLines(buf, size, allocatedBufferSize, rest, restLines) {
if (size === 0 && rest.length === 0) {
return { lines: [...restLines], rest: '', reachedEof: true };
}
if (size === 0) {
return { lines: [...restLines, rest], rest: '', reachedEof: true };
}
const fileContent = rest + buf.toString('utf8', 0, size);
const lines = [...restLines, ...fileContent.match(LINE_TOKENIZER_REGEXP)];
const reachedEof = size < allocatedBufferSize;
if (reachedEof) {
return {
lines, rest: '', reachedEof: true
};
}
return removeLastLine(lines);
}
exports.readBufferedLines = readBufferedLines;
/**
* Last line is usually incomplete because our buffer rarely matches exactly the end of a line.
* So we remove it from the line batch.
* The deleted line is returned as the 'rest' parameter and will be incorporate at the beginning
* of next read operation.
*/
function removeLastLine(lines) {
const lastLine = lines[lines.length - 1];
return {
lines: lines.slice(0, lines.length - 1),
rest: lastLine,
reachedEof: false
};
}
//# sourceMappingURL=readBufferedLines.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"readBufferedLines.js","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/lineReader/readBufferedLines.ts"],"names":[],"mappings":";;;AAGA,MAAM,qBAAqB,GAAG,eAAe,CAAA;AAE7C;;;;;;;;;GASG;AACH,SAAgB,iBAAiB,CAAC,GAAW,EAAE,IAAY,EAAE,mBAA2B,EAAE,IAAY,EAAE,SAAmB;IACvH,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACjC,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAA;KAC/D;IACD,IAAI,IAAI,KAAK,CAAC,EAAE;QACZ,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAA;KACrE;IAED,MAAM,WAAW,GAAG,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;IACxD,MAAM,KAAK,GAAG,CAAC,GAAG,SAAS,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAa,CAAC,CAAA;IAErF,MAAM,UAAU,GAAG,IAAI,GAAG,mBAAmB,CAAA;IAC7C,IAAI,UAAU,EAAE;QACZ,OAAO;YACH,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI;SACpC,CAAA;KACJ;IAED,OAAO,cAAc,CAAC,KAAK,CAAC,CAAA;AAChC,CAAC;AAnBD,8CAmBC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAC,KAAe;IACnC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACxC,OAAO;QACH,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QACvC,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,KAAK;KACpB,CAAA;AACL,CAAC"}

View File

@ -0,0 +1,24 @@
/// <reference types="node" />
export interface BufferPair {
buf1: Buffer;
buf2: Buffer;
busy: boolean;
}
/**
* Collection of buffers to be shared between async processes.
* Avoids allocating buffers each time async process starts.
*/
export declare class BufferPool {
private readonly bufSize;
private readonly bufNo;
private readonly bufferPool;
/**
*
* @param bufSize Size of each buffer.
* @param bufNo Number of buffers. Caller has to make sure no more than bufNo async processes run simultaneously.
*/
constructor(bufSize: number, bufNo: number);
allocateBuffers(): BufferPair;
freeBuffers(bufferPair: BufferPair): void;
}
//# sourceMappingURL=BufferPool.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"BufferPool.d.ts","sourceRoot":"","sources":["../../../src/fs/BufferPool.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAA;CAChB;AAED;;;GAGG;AACH,qBAAa,UAAU;IAOP,OAAO,CAAC,QAAQ,CAAC,OAAO;IAAU,OAAO,CAAC,QAAQ,CAAC,KAAK;IANpE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAC9C;;;;OAIG;gBAC0B,OAAO,EAAE,MAAM,EAAmB,KAAK,EAAE,MAAM;IAUrE,eAAe,IAAI,UAAU;IAW7B,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;CAGnD"}

41
mc_test/node_modules/dir-compare/build/src/fs/BufferPool.js generated vendored Executable file
View File

@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BufferPool = void 0;
/**
* Collection of buffers to be shared between async processes.
* Avoids allocating buffers each time async process starts.
*/
class BufferPool {
/**
*
* @param bufSize Size of each buffer.
* @param bufNo Number of buffers. Caller has to make sure no more than bufNo async processes run simultaneously.
*/
constructor(bufSize, bufNo) {
this.bufSize = bufSize;
this.bufNo = bufNo;
this.bufferPool = [];
for (let i = 0; i < this.bufNo; i++) {
this.bufferPool.push({
buf1: Buffer.alloc(this.bufSize),
buf2: Buffer.alloc(this.bufSize),
busy: false
});
}
}
allocateBuffers() {
for (let j = 0; j < this.bufNo; j++) {
const bufferPair = this.bufferPool[j];
if (!bufferPair.busy) {
bufferPair.busy = true;
return bufferPair;
}
}
throw new Error('Async buffer limit reached');
}
freeBuffers(bufferPair) {
bufferPair.busy = false;
}
}
exports.BufferPool = BufferPool;
//# sourceMappingURL=BufferPool.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"BufferPool.js","sourceRoot":"","sources":["../../../src/fs/BufferPool.ts"],"names":[],"mappings":";;;AAMA;;;GAGG;AACH,MAAa,UAAU;IAEnB;;;;OAIG;IACH,YAA6B,OAAe,EAAmB,KAAa;QAA/C,YAAO,GAAP,OAAO,CAAQ;QAAmB,UAAK,GAAL,KAAK,CAAQ;QAN3D,eAAU,GAAiB,EAAE,CAAA;QAO1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;YACjC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;gBACjB,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;gBAChC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;gBAChC,IAAI,EAAE,KAAK;aACd,CAAC,CAAA;SACL;IACL,CAAC;IAEM,eAAe;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;YACjC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;YACrC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;gBAClB,UAAU,CAAC,IAAI,GAAG,IAAI,CAAA;gBACtB,OAAO,UAAU,CAAA;aACpB;SACJ;QACD,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;IACjD,CAAC;IAEM,WAAW,CAAC,UAAsB;QACrC,UAAU,CAAC,IAAI,GAAG,KAAK,CAAA;IAC3B,CAAC;CACJ;AA/BD,gCA+BC"}

View File

@ -0,0 +1,30 @@
/// <reference types="node" />
import { NoParamCallback } from 'fs';
declare type OpenFileFlags = string | undefined;
declare type OpenFileCallback = (err: NodeJS.ErrnoException | null, fd: number) => void;
/**
* Limits the number of concurrent file handlers.
* Use it as a wrapper over fs.open() and fs.close().
* Example:
* const fdQueue = new FileDescriptorQueue(8)
* fdQueue.open(path, flags, (err, fd) =>{
* ...
* fdQueue.close(fd, (err) =>{
* ...
* })
* })
* As of node v7, calling fd.close without a callback is deprecated.
*/
export declare class FileDescriptorQueue {
private maxFilesNo;
private activeCount;
private pendingJobs;
constructor(maxFilesNo: number);
open(path: string, flags: OpenFileFlags, callback: OpenFileCallback): void;
process(): void;
close(fd: number, callback: NoParamCallback): void;
openPromise(path: string, flags: OpenFileFlags): Promise<number>;
closePromise(fd: number): Promise<void>;
}
export {};
//# sourceMappingURL=FileDescriptorQueue.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"FileDescriptorQueue.d.ts","sourceRoot":"","sources":["../../../src/fs/FileDescriptorQueue.ts"],"names":[],"mappings":";AAAA,OAAW,EAAE,eAAe,EAAE,MAAM,IAAI,CAAA;AAGxC,aAAK,aAAa,GAAG,MAAM,GAAG,SAAS,CAAA;AACvC,aAAK,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;AAE/E;;;;;;;;;;;;GAYG;AACH,qBAAa,mBAAmB;IAGnB,OAAO,CAAC,UAAU;IAF9B,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,WAAW,CAAc;gBACb,UAAU,EAAE,MAAM;IAEtC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAS1E,OAAO,IAAI,IAAI;IAQf,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI;IAMlD,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAYhE,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAWvC"}

View File

@ -0,0 +1,74 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FileDescriptorQueue = void 0;
const fs_1 = __importDefault(require("fs"));
const Queue_1 = __importDefault(require("./Queue"));
/**
* Limits the number of concurrent file handlers.
* Use it as a wrapper over fs.open() and fs.close().
* Example:
* const fdQueue = new FileDescriptorQueue(8)
* fdQueue.open(path, flags, (err, fd) =>{
* ...
* fdQueue.close(fd, (err) =>{
* ...
* })
* })
* As of node v7, calling fd.close without a callback is deprecated.
*/
class FileDescriptorQueue {
constructor(maxFilesNo) {
this.maxFilesNo = maxFilesNo;
this.activeCount = 0;
this.pendingJobs = new Queue_1.default();
}
open(path, flags, callback) {
this.pendingJobs.enqueue({
path: path,
flags: flags,
callback: callback
});
this.process();
}
process() {
if (this.pendingJobs.getLength() > 0 && this.activeCount < this.maxFilesNo) {
const job = this.pendingJobs.dequeue();
this.activeCount++;
fs_1.default.open(job.path, job.flags, job.callback);
}
}
close(fd, callback) {
this.activeCount--;
fs_1.default.close(fd, callback);
this.process();
}
openPromise(path, flags) {
return new Promise((resolve, reject) => {
this.open(path, flags, (err, fd) => {
if (err) {
reject(err);
}
else {
resolve(fd);
}
});
});
}
closePromise(fd) {
return new Promise((resolve, reject) => {
this.close(fd, (err) => {
if (err) {
reject(err);
}
else {
resolve();
}
});
});
}
}
exports.FileDescriptorQueue = FileDescriptorQueue;
//# sourceMappingURL=FileDescriptorQueue.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"FileDescriptorQueue.js","sourceRoot":"","sources":["../../../src/fs/FileDescriptorQueue.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAwC;AACxC,oDAA2B;AAK3B;;;;;;;;;;;;GAYG;AACH,MAAa,mBAAmB;IAG/B,YAAoB,UAAkB;QAAlB,eAAU,GAAV,UAAU,CAAQ;QAF9B,gBAAW,GAAG,CAAC,CAAA;QACf,gBAAW,GAAG,IAAI,eAAK,EAAE,CAAA;IACS,CAAC;IAE3C,IAAI,CAAC,IAAY,EAAE,KAAoB,EAAE,QAA0B;QAClE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YACxB,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,QAAQ;SAClB,CAAC,CAAA;QACF,IAAI,CAAC,OAAO,EAAE,CAAA;IACf,CAAC;IAED,OAAO;QACN,IAAI,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE;YAC3E,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAA;YACtC,IAAI,CAAC,WAAW,EAAE,CAAA;YAClB,YAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;SAC1C;IACF,CAAC;IAED,KAAK,CAAC,EAAU,EAAE,QAAyB;QAC1C,IAAI,CAAC,WAAW,EAAE,CAAA;QAClB,YAAE,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAA;QACtB,IAAI,CAAC,OAAO,EAAE,CAAA;IACf,CAAC;IAED,WAAW,CAAC,IAAY,EAAE,KAAoB;QAC7C,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE;gBAClC,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAA;iBACX;qBAAM;oBACN,OAAO,CAAC,EAAE,CAAC,CAAA;iBACX;YACF,CAAC,CAAC,CAAA;QACH,CAAC,CAAC,CAAA;IACH,CAAC;IAED,YAAY,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC5C,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;gBACtB,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAA;iBACX;qBAAM;oBACN,OAAO,EAAE,CAAA;iBACT;YACF,CAAC,CAAC,CAAA;QACH,CAAC,CAAC,CAAA;IACH,CAAC;CACD;AAnDD,kDAmDC"}

8
mc_test/node_modules/dir-compare/build/src/fs/Queue.d.ts generated vendored Executable file
View File

@ -0,0 +1,8 @@
export = Queue;
declare function Queue(): void;
declare class Queue {
getLength: () => number;
enqueue: (item: any) => void;
dequeue: () => any;
}
//# sourceMappingURL=Queue.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"Queue.d.ts","sourceRoot":"","sources":["../../../src/fs/Queue.js"],"names":[],"mappings":";AAkBA,+BAwCC;;IAjCC,wBAA8C;IAM9C,6BAEC;IAKD,mBAmBC"}

50
mc_test/node_modules/dir-compare/build/src/fs/Queue.js generated vendored Executable file
View File

@ -0,0 +1,50 @@
/*
Queue.js
A function to represent a queue
Created by Kate Morley - http://code.iamkate.com/ - and released under the terms
of the CC0 1.0 Universal legal code:
http://creativecommons.org/publicdomain/zero/1.0/legalcode
*/
const MAX_UNUSED_ARRAY_SIZE = 10000;
/* Creates a new queue. A queue is a first-in-first-out (FIFO) data structure -
* items are added to the end of the queue and removed from the front.
*/
function Queue() {
// initialise the queue and offset
let queue = [];
let offset = 0;
// Returns the length of the queue.
this.getLength = () => (queue.length - offset);
/* Enqueues the specified item. The parameter is:
*
* item - the item to enqueue
*/
this.enqueue = item => {
queue.push(item);
};
/* Dequeues an item and returns it. If the queue is empty, the value
* 'undefined' is returned.
*/
this.dequeue = () => {
// if the queue is empty, return immediately
if (queue.length === 0) {
return undefined;
}
// store the item at the front of the queue
const item = queue[offset];
// increment the offset and remove the free space if necessary
if (++offset > MAX_UNUSED_ARRAY_SIZE) {
queue = queue.slice(offset);
offset = 0;
}
// return the dequeued item
return item;
};
}
module.exports = Queue;
//# sourceMappingURL=Queue.js.map

1
mc_test/node_modules/dir-compare/build/src/fs/Queue.js.map generated vendored Executable file
View File

@ -0,0 +1 @@
{"version":3,"file":"Queue.js","sourceRoot":"","sources":["../../../src/fs/Queue.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,MAAM,qBAAqB,GAAG,KAAK,CAAA;AAEnC;;GAEG;AACH,SAAS,KAAK;IAEZ,kCAAkC;IAClC,IAAI,KAAK,GAAG,EAAE,CAAA;IACd,IAAI,MAAM,GAAG,CAAC,CAAA;IAEd,mCAAmC;IACnC,IAAI,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;IAE9C;;;OAGG;IACH,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE;QACpB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAA;IAED;;OAEG;IACH,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE;QAElB,4CAA4C;QAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,OAAO,SAAS,CAAA;SACjB;QAED,2CAA2C;QAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;QAE1B,8DAA8D;QAC9D,IAAI,EAAE,MAAM,GAAG,qBAAqB,EAAE;YACpC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YAC3B,MAAM,GAAG,CAAC,CAAA;SACX;QAED,2BAA2B;QAC3B,OAAO,IAAI,CAAA;IAEb,CAAC,CAAA;AACH,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,KAAK,CAAA"}

View File

@ -0,0 +1,9 @@
import { FileDescriptorQueue } from './FileDescriptorQueue';
declare function closeFilesSync(fd1?: number, fd2?: number): void;
declare function closeFilesAsync(fd1: number | undefined, fd2: number | undefined, fdQueue: FileDescriptorQueue): Promise<void>;
declare const _default: {
closeFilesSync: typeof closeFilesSync;
closeFilesAsync: typeof closeFilesAsync;
};
export default _default;
//# sourceMappingURL=closeFile.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"closeFile.d.ts","sourceRoot":"","sources":["../../../src/fs/closeFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,iBAAS,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAOxD;AAED,iBAAe,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAU5H;;;;;AAGD,wBAGC"}

41
mc_test/node_modules/dir-compare/build/src/fs/closeFile.js generated vendored Executable file
View File

@ -0,0 +1,41 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
function closeFilesSync(fd1, fd2) {
if (fd1) {
fs_1.default.closeSync(fd1);
}
if (fd2) {
fs_1.default.closeSync(fd2);
}
}
function closeFilesAsync(fd1, fd2, fdQueue) {
return __awaiter(this, void 0, void 0, function* () {
if (fd1 && fd2) {
return fdQueue.closePromise(fd1).then(() => fdQueue.closePromise(fd2));
}
if (fd1) {
return fdQueue.closePromise(fd1);
}
if (fd2) {
return fdQueue.closePromise(fd2);
}
});
}
exports.default = {
closeFilesSync,
closeFilesAsync
};
//# sourceMappingURL=closeFile.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"closeFile.js","sourceRoot":"","sources":["../../../src/fs/closeFile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4CAAmB;AAGnB,SAAS,cAAc,CAAC,GAAY,EAAE,GAAY;IAC9C,IAAI,GAAG,EAAE;QACL,YAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;KACpB;IACD,IAAI,GAAG,EAAE;QACL,YAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;KACpB;AACL,CAAC;AAED,SAAe,eAAe,CAAC,GAAuB,EAAE,GAAuB,EAAE,OAA4B;;QACzG,IAAI,GAAG,IAAI,GAAG,EAAE;YACZ,OAAO,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;SACzE;QACD,IAAI,GAAG,EAAE;YACL,OAAO,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;SACnC;QACD,IAAI,GAAG,EAAE;YACL,OAAO,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;SACnC;IACL,CAAC;CAAA;AAGD,kBAAe;IACX,cAAc;IACd,eAAe;CAClB,CAAA"}

View File

@ -0,0 +1,5 @@
export function readdir(path: any): Promise<any>;
export function readdir(path: any): Promise<any>;
export function read(fd: any, buffer: any, offset: any, length: any, position: any): Promise<any>;
export function read(fd: any, buffer: any, offset: any, length: any, position: any): Promise<any>;
//# sourceMappingURL=fsPromise.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"fsPromise.d.ts","sourceRoot":"","sources":["../../../src/fs/fsPromise.js"],"names":[],"mappings":"AAGI,iDAUC;AAVD,iDAUC;AACD,kGAUC;AAVD,kGAUC"}

28
mc_test/node_modules/dir-compare/build/src/fs/fsPromise.js generated vendored Executable file
View File

@ -0,0 +1,28 @@
const fs = require('fs');
module.exports = {
readdir(path) {
return new Promise((resolve, reject) => {
fs.readdir(path, (err, files) => {
if (err) {
reject(err);
}
else {
resolve(files);
}
});
});
},
read(fd, buffer, offset, length, position) {
return new Promise((resolve, reject) => {
fs.read(fd, buffer, offset, length, position, (err, bytesRead) => {
if (err) {
reject(err);
}
else {
resolve(bytesRead);
}
});
});
},
};
//# sourceMappingURL=fsPromise.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"fsPromise.js","sourceRoot":"","sources":["../../../src/fs/fsPromise.js"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAExB,MAAM,CAAC,OAAO,GAAG;IACb,OAAO,CAAC,IAAI;QACR,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBAC5B,IAAI,GAAG,EAAE;oBACL,MAAM,CAAC,GAAG,CAAC,CAAA;iBACd;qBAAM;oBACH,OAAO,CAAC,KAAK,CAAC,CAAA;iBACjB;YACL,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;IACD,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ;QACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE;gBAC7D,IAAI,GAAG,EAAE;oBACL,MAAM,CAAC,GAAG,CAAC,CAAA;iBACd;qBAAM;oBACH,OAAO,CAAC,SAAS,CAAC,CAAA;iBACrB;YACL,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;CACJ,CAAA"}

24
mc_test/node_modules/dir-compare/build/src/index.d.ts generated vendored Executable file
View File

@ -0,0 +1,24 @@
import { Options, Result } from './types';
import { FileCompareHandlers } from './FileCompareHandlers';
export * from './types';
export { FileCompareHandlers };
/**
* Synchronously compares given paths.
* @param path1 Left file or directory to be compared.
* @param path2 Right file or directory to be compared.
* @param options Comparison options.
*/
export declare function compareSync(path1: string, path2: string, options?: Options): Result;
/**
* Asynchronously compares given paths.
* @param path1 Left file or directory to be compared.
* @param path2 Right file or directory to be compared.
* @param options Comparison options.
*/
export declare function compare(path1: string, path2: string, options?: Options): Promise<Result>;
/**
* File comparison handlers.
* These handlers are used when [[Options.compareContent]] is set.
*/
export declare const fileCompareHandlers: FileCompareHandlers;
//# sourceMappingURL=index.d.ts.map

1
mc_test/node_modules/dir-compare/build/src/index.d.ts.map generated vendored Executable file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAI3D,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAE9B;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAkBnF;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAgCxF;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,mBAGjC,CAAA"}

149
mc_test/node_modules/dir-compare/build/src/index.js generated vendored Executable file
View File

@ -0,0 +1,149 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.fileCompareHandlers = exports.compare = exports.compareSync = void 0;
const path_1 = __importDefault(require("path"));
const fs_1 = __importDefault(require("fs"));
const compareSync_1 = __importDefault(require("./compareSync"));
const compareAsync_1 = __importDefault(require("./compareAsync"));
const defaultResultBuilderCallback_1 = __importDefault(require("./resultBuilder/defaultResultBuilderCallback"));
const defaultFileCompare_1 = require("./fileCompareHandler/default/defaultFileCompare");
const lineBasedFileCompare_1 = require("./fileCompareHandler/lines/lineBasedFileCompare");
const defaultNameCompare_1 = __importDefault(require("./nameCompare/defaultNameCompare"));
const entryBuilder_1 = __importDefault(require("./entry/entryBuilder"));
const statisticsLifecycle_1 = __importDefault(require("./statistics/statisticsLifecycle"));
const loopDetector_1 = __importDefault(require("./symlink/loopDetector"));
const ROOT_PATH = path_1.default.sep;
__exportStar(require("./types"), exports);
/**
* Synchronously compares given paths.
* @param path1 Left file or directory to be compared.
* @param path2 Right file or directory to be compared.
* @param options Comparison options.
*/
function compareSync(path1, path2, options) {
// realpathSync() is necessary for loop detection to work properly
const absolutePath1 = path_1.default.normalize(path_1.default.resolve(fs_1.default.realpathSync(path1)));
const absolutePath2 = path_1.default.normalize(path_1.default.resolve(fs_1.default.realpathSync(path2)));
let diffSet;
options = prepareOptions(options);
if (!options.noDiffSet) {
diffSet = [];
}
const statistics = statisticsLifecycle_1.default.initStats(options);
compareSync_1.default(entryBuilder_1.default.buildEntry(absolutePath1, path1, path_1.default.basename(absolutePath1), options), entryBuilder_1.default.buildEntry(absolutePath2, path2, path_1.default.basename(absolutePath2), options), 0, ROOT_PATH, options, statistics, diffSet, loopDetector_1.default.initSymlinkCache());
statisticsLifecycle_1.default.completeStatistics(statistics, options);
statistics.diffSet = diffSet;
return statistics;
}
exports.compareSync = compareSync;
/**
* Asynchronously compares given paths.
* @param path1 Left file or directory to be compared.
* @param path2 Right file or directory to be compared.
* @param options Comparison options.
*/
function compare(path1, path2, options) {
let absolutePath1, absolutePath2;
return Promise.resolve()
.then(() => Promise.all([wrapper.realPath(path1), wrapper.realPath(path2)]))
.then(realPaths => {
const realPath1 = realPaths[0];
const realPath2 = realPaths[1];
// realpath() is necessary for loop detection to work properly
absolutePath1 = path_1.default.normalize(path_1.default.resolve(realPath1));
absolutePath2 = path_1.default.normalize(path_1.default.resolve(realPath2));
})
.then(() => {
options = prepareOptions(options);
let asyncDiffSet;
if (!options.noDiffSet) {
asyncDiffSet = [];
}
const statistics = statisticsLifecycle_1.default.initStats(options);
return compareAsync_1.default(entryBuilder_1.default.buildEntry(absolutePath1, path1, path_1.default.basename(path1), options), entryBuilder_1.default.buildEntry(absolutePath2, path2, path_1.default.basename(path2), options), 0, ROOT_PATH, options, statistics, asyncDiffSet, loopDetector_1.default.initSymlinkCache())
.then(() => {
statisticsLifecycle_1.default.completeStatistics(statistics, options);
if (!(options === null || options === void 0 ? void 0 : options.noDiffSet)) {
const diffSet = [];
rebuildAsyncDiffSet(statistics, asyncDiffSet, diffSet);
statistics.diffSet = diffSet;
}
return statistics;
});
});
}
exports.compare = compare;
/**
* File comparison handlers.
* These handlers are used when [[Options.compareContent]] is set.
*/
exports.fileCompareHandlers = {
defaultFileCompare: defaultFileCompare_1.defaultFileCompare,
lineBasedFileCompare: lineBasedFileCompare_1.lineBasedFileCompare
};
const wrapper = {
realPath(path, options) {
return new Promise((resolve, reject) => {
fs_1.default.realpath(path, options, (err, resolvedPath) => {
if (err) {
reject(err);
}
else {
resolve(resolvedPath);
}
});
});
}
};
function prepareOptions(options) {
options = options || {};
const clone = JSON.parse(JSON.stringify(options));
clone.resultBuilder = options.resultBuilder;
clone.compareFileSync = options.compareFileSync;
clone.compareFileAsync = options.compareFileAsync;
clone.compareNameHandler = options.compareNameHandler;
if (!clone.resultBuilder) {
clone.resultBuilder = defaultResultBuilderCallback_1.default;
}
if (!clone.compareFileSync) {
clone.compareFileSync = defaultFileCompare_1.defaultFileCompare.compareSync;
}
if (!clone.compareFileAsync) {
clone.compareFileAsync = defaultFileCompare_1.defaultFileCompare.compareAsync;
}
if (!clone.compareNameHandler) {
clone.compareNameHandler = defaultNameCompare_1.default;
}
clone.dateTolerance = clone.dateTolerance || 1000;
clone.dateTolerance = Number(clone.dateTolerance);
if (isNaN(clone.dateTolerance)) {
throw new Error('Date tolerance is not a number');
}
return clone;
}
// Async diffsets are kept into recursive structures.
// This method transforms them into one dimensional arrays.
function rebuildAsyncDiffSet(statistics, asyncDiffSet, diffSet) {
asyncDiffSet.forEach(rawDiff => {
if (!Array.isArray(rawDiff)) {
diffSet.push(rawDiff);
}
else {
rebuildAsyncDiffSet(statistics, rawDiff, diffSet);
}
});
}
//# sourceMappingURL=index.js.map

1
mc_test/node_modules/dir-compare/build/src/index.js.map generated vendored Executable file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA4B;AAC5B,4CAAmB;AACnB,gEAA+C;AAC/C,kEAAiD;AACjD,gHAAuF;AACvF,wFAAoF;AACpF,0FAAsF;AACtF,0FAAiE;AACjE,wEAA+C;AAC/C,2FAA6D;AAC7D,0EAAiD;AAIjD,MAAM,SAAS,GAAG,cAAS,CAAC,GAAG,CAAA;AAE/B,0CAAuB;AAGvB;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,KAAa,EAAE,KAAa,EAAE,OAAiB;IACvE,kEAAkE;IAClE,MAAM,aAAa,GAAG,cAAS,CAAC,SAAS,CAAC,cAAS,CAAC,OAAO,CAAC,YAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACpF,MAAM,aAAa,GAAG,cAAS,CAAC,SAAS,CAAC,cAAS,CAAC,OAAO,CAAC,YAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACpF,IAAI,OAAO,CAAA;IACX,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IACjC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;QACpB,OAAO,GAAG,EAAE,CAAA;KACf;IACD,MAAM,UAAU,GAAG,6BAAc,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IACpD,qBAAmB,CACf,sBAAY,CAAC,UAAU,CAAC,aAAa,EAAE,KAA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AAK,CAAA;AAChB,CAAC;AAGD,qDAAqD;AACrD,2DAA2D;AAC3D,SAAS,mBAAmB,CAAC,UAAU,EAAE,YAAY,EAAE,OAAO;IAC1D,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACzB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACxB;aAAM;YACH,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;SACpD;IACL,CAAC,CAAC,CAAA;AACN,CAAC"}

View File

@ -0,0 +1,3 @@
declare function _exports(name1: any, name2: any, options: any): 1 | 0 | -1;
export = _exports;
//# sourceMappingURL=defaultNameCompare.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"defaultNameCompare.d.ts","sourceRoot":"","sources":["../../../src/nameCompare/defaultNameCompare.js"],"names":[],"mappings":"AACiB,4EAMhB"}

View File

@ -0,0 +1,11 @@
module.exports = function compareName(name1, name2, options) {
if (options.ignoreCase) {
name1 = name1.toLowerCase();
name2 = name2.toLowerCase();
}
return strcmp(name1, name2);
};
function strcmp(str1, str2) {
return ((str1 === str2) ? 0 : ((str1 > str2) ? 1 : -1));
}
//# sourceMappingURL=defaultNameCompare.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"defaultNameCompare.js","sourceRoot":"","sources":["../../../src/nameCompare/defaultNameCompare.js"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,GAAG,SAAS,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO;IAC1D,IAAI,OAAO,CAAC,UAAU,EAAE;QACvB,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;QAC3B,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;KAC3B;IACD,OAAO,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC5B,CAAC,CAAA;AAED,SAAS,MAAM,CAAC,IAAI,EAAE,IAAI;IACzB,OAAO,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACxD,CAAC"}

View File

@ -0,0 +1,5 @@
import { Entry, PermissionDeniedState } from "../types";
export declare function getPermissionDeniedState(entry1: Entry, entry2: Entry): PermissionDeniedState;
export declare function getPrmissionDenieStateWhenLeftMissing(entry2: Entry): PermissionDeniedState;
export declare function getPrmissionDenieStateWhenRightMissing(entry1: Entry): PermissionDeniedState;
//# sourceMappingURL=permissionDeniedState.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"permissionDeniedState.d.ts","sourceRoot":"","sources":["../../../src/permissions/permissionDeniedState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAEvD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,qBAAqB,CAU5F;AAED,wBAAgB,qCAAqC,CAAC,MAAM,EAAE,KAAK,GAAG,qBAAqB,CAM1F;AAED,wBAAgB,sCAAsC,CAAC,MAAM,EAAE,KAAK,GAAG,qBAAqB,CAM3F"}

Some files were not shown because too many files have changed in this diff Show More