@futpib/parser 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/allSettledStream.js +32 -14
- package/build/allSettledStream.test.js +32 -0
- package/build/androidPackage.d.ts +39 -0
- package/build/androidPackageParser.d.ts +17 -0
- package/build/androidPackageParser.js +183 -0
- package/build/{apkParser.test.js → androidPackageParser.test.js} +6 -6
- package/build/androidPackageUnparser.d.ts +4 -0
- package/build/{apkUnparser.js → androidPackageUnparser.js} +23 -23
- package/build/androidPackageUnparser.test.js +26 -0
- package/build/arbitrarilySlicedAsyncInterable.d.ts +3 -1
- package/build/arbitrarilySlicedAsyncInterable.js +3 -3
- package/build/arrayParser.test.js +3 -3
- package/build/backsmali.d.ts +1 -0
- package/build/backsmali.js +22 -0
- package/build/bsonParser.js +6 -2
- package/build/customInvariant.d.ts +1 -1
- package/build/dalvikBytecodeParser/formatParsers.d.ts +97 -0
- package/build/dalvikBytecodeParser/formatParsers.js +169 -0
- package/build/dalvikBytecodeParser.d.ts +107 -0
- package/build/dalvikBytecodeParser.js +836 -0
- package/build/dalvikExecutable.d.ts +158 -0
- package/build/dalvikExecutable.js +20 -0
- package/build/dalvikExecutableParser/stringSyntaxParser.d.ts +4 -0
- package/build/dalvikExecutableParser/stringSyntaxParser.js +76 -0
- package/build/dalvikExecutableParser/typeParsers.d.ts +10 -0
- package/build/dalvikExecutableParser/typeParsers.js +34 -0
- package/build/dalvikExecutableParser/typedNumbers.d.ts +90 -0
- package/build/dalvikExecutableParser/typedNumbers.js +19 -0
- package/build/dalvikExecutableParser.d.ts +5 -0
- package/build/dalvikExecutableParser.js +1439 -0
- package/build/dalvikExecutableParser.test.js +70 -0
- package/build/dalvikExecutableParserAgainstSmaliParser.test.js +298 -0
- package/build/debugLogInputParser.d.ts +4 -0
- package/build/debugLogInputParser.js +16 -0
- package/build/debugLogParser.js +14 -3
- package/build/disjunctionParser.d.ts +2 -1
- package/build/disjunctionParser.js +4 -2
- package/build/elementTerminatedArrayParser.d.ts +3 -0
- package/build/elementTerminatedArrayParser.js +18 -0
- package/build/elementTerminatedArrayParser.test.js +52 -0
- package/build/elementTerminatedSequenceArrayParser.d.ts +3 -0
- package/build/elementTerminatedSequenceArrayParser.js +32 -0
- package/build/elementTerminatedSequenceArrayParser.test.js +34 -0
- package/build/elementTerminatedSequenceParser.d.ts +3 -0
- package/build/elementTerminatedSequenceParser.js +27 -0
- package/build/elementTerminatedSequenceParser.test.js +34 -0
- package/build/exactElementParser.js +10 -5
- package/build/exactSequenceParser.d.ts +2 -1
- package/build/exactSequenceParser.js +12 -2
- package/build/fetchCid.d.ts +1 -0
- package/build/fetchCid.js +107 -0
- package/build/fixedLengthSequenceParser.d.ts +1 -0
- package/build/fixedLengthSequenceParser.js +18 -1
- package/build/fixedLengthSequenceParser.test.js +41 -0
- package/build/hasExecutable.d.ts +1 -0
- package/build/hasExecutable.js +8 -0
- package/build/highResolutionTimer.d.ts +16 -0
- package/build/highResolutionTimer.js +42 -0
- package/build/inputReader.d.ts +11 -0
- package/build/inputReader.js +37 -0
- package/build/inputReader.test.js +165 -0
- package/build/inputReaderState.d.ts +10 -0
- package/build/inputReaderState.js +16 -0
- package/build/inspect.d.ts +1 -0
- package/build/inspect.js +7 -0
- package/build/javaKeyStoreParser.test.js +2 -2
- package/build/jsonParser.d.ts +2 -0
- package/build/jsonParser.js +11 -14
- package/build/leb128Parser.d.ts +7 -0
- package/build/leb128Parser.js +82 -0
- package/build/leb128Parser.test.js +107 -0
- package/build/lookaheadParser.d.ts +2 -0
- package/build/lookaheadParser.js +14 -0
- package/build/negativeLookaheadParser.js +21 -15
- package/build/negativeLookaheadParser.test.js +30 -0
- package/build/nonEmptyArrayParser.d.ts +2 -0
- package/build/nonEmptyArrayParser.js +32 -0
- package/build/nonEmptyArrayParser.test.js +16 -0
- package/build/parser.d.ts +10 -1
- package/build/parser.js +66 -31
- package/build/parser.test.js +79 -12
- package/build/parserAccessorParser.js +9 -1
- package/build/parserConsumedSequenceParser.js +20 -15
- package/build/parserContext.d.ts +14 -0
- package/build/parserContext.js +56 -27
- package/build/parserContext.test.js +27 -0
- package/build/parserCreatorCompose.d.ts +1 -0
- package/build/parserCreatorCompose.js +8 -2
- package/build/parserError.d.ts +6 -0
- package/build/parserError.js +6 -6
- package/build/parserInputCompanion.d.ts +15 -0
- package/build/parserInputCompanion.js +38 -0
- package/build/promiseCompose.d.ts +1 -1
- package/build/promiseCompose.js +12 -1
- package/build/promiseSettled.d.ts +1 -0
- package/build/promiseSettled.js +4 -0
- package/build/separatedArrayParser.d.ts +2 -0
- package/build/separatedArrayParser.js +39 -0
- package/build/separatedArrayParser.test.d.ts +1 -0
- package/build/separatedArrayParser.test.js +21 -0
- package/build/sequenceBuffer.d.ts +10 -0
- package/build/sequenceBuffer.js +54 -2
- package/build/sequenceBuffer.test.js +57 -0
- package/build/sequenceTerminatedSequenceParser.d.ts +5 -0
- package/build/sequenceTerminatedSequenceParser.js +32 -0
- package/build/sequenceTerminatedSequenceParser.test.d.ts +1 -0
- package/build/sequenceTerminatedSequenceParser.test.js +37 -0
- package/build/skipParser.d.ts +1 -1
- package/build/skipParser.js +4 -2
- package/build/skipToParser.d.ts +2 -0
- package/build/skipToParser.js +11 -0
- package/build/sliceBoundedParser.d.ts +1 -1
- package/build/sliceBoundedParser.js +7 -2
- package/build/sliceBoundedParser.test.js +35 -1
- package/build/smali.d.ts +1 -0
- package/build/smali.js +17 -0
- package/build/smaliParser.d.ts +12 -0
- package/build/smaliParser.js +656 -0
- package/build/smaliParser.test.d.ts +1 -0
- package/build/smaliParser.test.js +115 -0
- package/build/terminatedArrayParser.d.ts +3 -1
- package/build/terminatedArrayParser.js +79 -2
- package/build/terminatedArrayParser.test.d.ts +1 -0
- package/build/terminatedArrayParser.test.js +131 -0
- package/build/toAsyncIterable.d.ts +1 -0
- package/build/toAsyncIterable.js +7 -0
- package/build/toAsyncIterator.d.ts +1 -0
- package/build/toAsyncIterator.js +33 -0
- package/build/tupleParser.d.ts +4 -0
- package/build/tupleParser.js +1 -5
- package/build/unionParser.d.ts +2 -1
- package/build/unionParser.js +27 -12
- package/build/unionParser.test.d.ts +1 -0
- package/build/unionParser.test.js +60 -0
- package/build/zipParser.d.ts +7 -2
- package/build/zipParser.js +36 -12
- package/build/zipUnparser.d.ts +4 -1
- package/build/zipUnparser.js +55 -26
- package/build/zipUnparser.test.js +14 -14
- package/package.json +23 -7
- package/src/allSettledStream.test.ts +40 -0
- package/src/allSettledStream.ts +47 -15
- package/src/androidPackage.ts +48 -0
- package/src/{apkParser.test.ts → androidPackageParser.test.ts} +6 -7
- package/src/{apkParser.test.ts.md → androidPackageParser.test.ts.md} +4 -4
- package/src/androidPackageParser.test.ts.snap +0 -0
- package/src/androidPackageParser.ts +440 -0
- package/src/androidPackageUnparser.test.ts +36 -0
- package/src/androidPackageUnparser.ts +120 -0
- package/src/arbitrarilySlicedAsyncInterable.ts +7 -2
- package/src/arrayParser.test.ts +3 -3
- package/src/backsmali.ts +30 -0
- package/src/bsonParser.ts +13 -2
- package/src/customInvariant.ts +1 -1
- package/src/dalvikBytecodeParser/formatParsers.ts +421 -0
- package/src/dalvikBytecodeParser.ts +2074 -0
- package/src/dalvikExecutable.ts +220 -0
- package/src/dalvikExecutableParser/stringSyntaxParser.ts +145 -0
- package/src/dalvikExecutableParser/typeParsers.ts +65 -0
- package/src/dalvikExecutableParser/typedNumbers.ts +57 -0
- package/src/dalvikExecutableParser.test.ts +89 -0
- package/src/dalvikExecutableParser.test.ts.md +634 -0
- package/src/dalvikExecutableParser.test.ts.snap +0 -0
- package/src/dalvikExecutableParser.ts +2768 -0
- package/src/dalvikExecutableParserAgainstSmaliParser.test.ts +346 -0
- package/src/debugLogInputParser.ts +28 -0
- package/src/debugLogParser.ts +19 -3
- package/src/disjunctionParser.ts +10 -5
- package/src/elementTerminatedArrayParser.test.ts +99 -0
- package/src/elementTerminatedArrayParser.ts +31 -0
- package/src/elementTerminatedSequenceArrayParser.test.ts +54 -0
- package/src/elementTerminatedSequenceArrayParser.ts +52 -0
- package/src/elementTerminatedSequenceParser.test.ts +54 -0
- package/src/elementTerminatedSequenceParser.ts +43 -0
- package/src/exactElementParser.ts +17 -11
- package/src/exactSequenceParser.ts +23 -2
- package/src/fetchCid.ts +125 -0
- package/src/fixedLengthSequenceParser.test.ts +77 -0
- package/src/fixedLengthSequenceParser.ts +28 -1
- package/src/hasExecutable.ts +11 -0
- package/src/highResolutionTimer.ts +49 -0
- package/src/inputReader.test.ts +209 -0
- package/src/inputReader.ts +75 -0
- package/src/inputReaderState.ts +33 -0
- package/src/inspect.ts +9 -0
- package/src/javaKeyStoreParser.test.ts +2 -3
- package/src/jsonParser.ts +13 -25
- package/src/leb128Parser.test.ts +171 -0
- package/src/leb128Parser.ts +125 -0
- package/src/lookaheadParser.ts +19 -0
- package/src/negativeLookaheadParser.test.ts +53 -0
- package/src/negativeLookaheadParser.ts +26 -14
- package/src/nonEmptyArrayParser.test.ts +20 -0
- package/src/nonEmptyArrayParser.ts +44 -0
- package/src/optionalParser.ts +1 -0
- package/src/parser.test.ts +131 -12
- package/src/parser.test.ts.md +21 -21
- package/src/parser.test.ts.snap +0 -0
- package/src/parser.ts +149 -45
- package/src/parserAccessorParser.ts +12 -2
- package/src/parserConsumedSequenceParser.ts +25 -16
- package/src/parserContext.test.ts +31 -0
- package/src/parserContext.ts +109 -37
- package/src/parserCreatorCompose.ts +20 -2
- package/src/parserError.ts +9 -6
- package/src/parserInputCompanion.ts +55 -0
- package/src/promiseCompose.ts +17 -3
- package/src/promiseSettled.ts +6 -0
- package/src/separatedArrayParser.test.ts +34 -0
- package/src/separatedArrayParser.ts +55 -0
- package/src/sequenceBuffer.test.ts +70 -0
- package/src/sequenceBuffer.ts +88 -2
- package/src/sequenceTerminatedSequenceParser.test.ts +60 -0
- package/src/sequenceTerminatedSequenceParser.ts +62 -0
- package/src/skipParser.ts +7 -5
- package/src/skipToParser.ts +16 -0
- package/src/sliceBoundedParser.test.ts +43 -1
- package/src/sliceBoundedParser.ts +19 -1
- package/src/smali.ts +24 -0
- package/src/smaliParser.test.ts +132 -0
- package/src/smaliParser.test.ts.md +2320 -0
- package/src/smaliParser.test.ts.snap +0 -0
- package/src/smaliParser.ts +1166 -0
- package/src/terminatedArrayParser.test.ts +258 -0
- package/src/terminatedArrayParser.ts +108 -3
- package/src/toAsyncIterable.ts +7 -0
- package/src/toAsyncIterator.ts +48 -0
- package/src/tupleParser.ts +8 -5
- package/src/unionParser.test.ts +79 -0
- package/src/unionParser.ts +44 -16
- package/src/zipParser.ts +77 -18
- package/src/zipUnparser.test.ts +18 -18
- package/src/zipUnparser.ts +88 -27
- package/build/apk.d.ts +0 -39
- package/build/apkParser.d.ts +0 -16
- package/build/apkParser.js +0 -164
- package/build/apkUnparser.d.ts +0 -4
- package/build/apkUnparser.test.js +0 -26
- package/build/arbitraryDosDate.d.ts +0 -2
- package/build/arbitraryDosDate.js +0 -8
- package/build/arbitraryZipEntry.d.ts +0 -3
- package/build/arbitraryZipEntry.js +0 -26
- package/build/createDisjunctionParser.d.ts +0 -2
- package/build/createDisjunctionParser.js +0 -47
- package/build/createExactParser.d.ts +0 -2
- package/build/createExactParser.js +0 -12
- package/build/createSequentialUnionParser.d.ts +0 -2
- package/build/createSequentialUnionParser.js +0 -69
- package/build/fixedLengthChunkParser.d.ts +0 -2
- package/build/fixedLengthChunkParser.js +0 -12
- package/build/fixedLengthParser.d.ts +0 -2
- package/build/fixedLengthParser.js +0 -12
- package/build/inputChunkBuffer.d.ts +0 -15
- package/build/inputChunkBuffer.js +0 -40
- package/build/inputChunkBuffer.test.js +0 -34
- package/build/inputCompanion.d.ts +0 -18
- package/build/inputCompanion.js +0 -28
- package/build/invariantDefined.d.ts +0 -1
- package/build/invariantDefined.js +0 -5
- package/build/invariantIdentity.d.ts +0 -3
- package/build/invariantIdentity.js +0 -5
- package/build/javaKeystoreParser.d.ts +0 -2
- package/build/javaKeystoreParser.js +0 -7
- package/build/jsonParser2.d.ts +0 -3
- package/build/jsonParser2.js +0 -52
- package/build/jsonParser2.test.js +0 -22
- package/build/negativeLookahead.d.ts +0 -2
- package/build/negativeLookahead.js +0 -18
- package/build/parserCompose.d.ts +0 -3
- package/build/parserCompose.js +0 -7
- package/build/parserImplementationInvariantInvariant.d.ts +0 -3
- package/build/parserImplementationInvariantInvariant.js +0 -15
- package/build/parserInvariant.d.ts +0 -4
- package/build/parserInvariant.js +0 -11
- package/build/promiseFish.d.ts +0 -1
- package/build/promiseFish.js +0 -3
- package/build/sequenceParser.d.ts +0 -3
- package/build/sequenceParser.js +0 -10
- package/build/terminatedSequenceParser.d.ts +0 -2
- package/build/terminatedSequenceParser.js +0 -24
- package/build/unparserInputCompanion.d.ts +0 -15
- package/build/unparserInputCompanion.js +0 -13
- package/build/zipEntry.d.ts +0 -28
- package/build/zipFile.d.ts +0 -32
- package/build/zipFileEntry.d.ts +0 -6
- package/src/apk.ts +0 -48
- package/src/apkParser.test.ts.snap +0 -0
- package/src/apkParser.ts +0 -392
- package/src/apkUnparser.test.ts +0 -37
- package/src/apkUnparser.ts +0 -120
- package/src/invariantDefined.ts +0 -6
- package/src/invariantIdentity.ts +0 -8
- /package/build/{apk.js → androidPackage.js} +0 -0
- /package/build/{apkParser.test.d.ts → androidPackageParser.test.d.ts} +0 -0
- /package/build/{apkUnparser.test.d.ts → androidPackageUnparser.test.d.ts} +0 -0
- /package/build/{arbitraryDosPermissions.d.ts → dalvikExecutableParser.test.d.ts} +0 -0
- /package/build/{arbitraryDosPermissions.js → dalvikExecutableParserAgainstSmaliParser.test.d.ts} +0 -0
- /package/build/{inputChunkBuffer.test.d.ts → elementTerminatedArrayParser.test.d.ts} +0 -0
- /package/build/{jsonParser2.test.d.ts → elementTerminatedSequenceArrayParser.test.d.ts} +0 -0
- /package/build/{parserParsingInvariant.d.ts → elementTerminatedSequenceParser.test.d.ts} +0 -0
- /package/build/{parserParsingInvariant.js → fixedLengthSequenceParser.test.d.ts} +0 -0
- /package/build/{zipEntry.js → leb128Parser.test.d.ts} +0 -0
- /package/build/{zipFile.js → negativeLookaheadParser.test.d.ts} +0 -0
- /package/build/{zipFileEntry.js → nonEmptyArrayParser.test.d.ts} +0 -0
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { ParserParsingFailedError } from './parserError.js';
|
|
2
|
-
import { parserImplementationInvariant } from './parserImplementationInvariant.js';
|
|
3
|
-
import { parserParsingInvariant } from './parserParsingInvariant.js';
|
|
4
|
-
function getParserName(parser) {
|
|
5
|
-
return parser.name || 'anonymousDisjunctionChild';
|
|
6
|
-
}
|
|
7
|
-
export const createDisjunctionParser = (childParsers) => {
|
|
8
|
-
parserImplementationInvariant(childParsers.length > 0, 'Disjunction parser must have at least one child parser.');
|
|
9
|
-
const disjunctionParser = async (parserContext) => {
|
|
10
|
-
const parserParsingFailedErrors = [];
|
|
11
|
-
for (const childParser of childParsers) {
|
|
12
|
-
const childParserContext = parserContext.lookahead(getParserName(childParser));
|
|
13
|
-
const [childParserResult] = await Promise.allSettled([childParser(childParserContext)]);
|
|
14
|
-
if (childParserResult.status === 'fulfilled') {
|
|
15
|
-
const successfulParserOutput = childParserResult.value;
|
|
16
|
-
childParserContext.unlookahead();
|
|
17
|
-
childParserContext.dispose();
|
|
18
|
-
return successfulParserOutput;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
const error = childParserResult.reason;
|
|
22
|
-
if (error instanceof ParserParsingFailedError) {
|
|
23
|
-
parserParsingFailedErrors.push(error);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
throw error;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
parserParsingInvariant(false, [
|
|
31
|
-
'No disjunction child parser succeeded.',
|
|
32
|
-
'Parsing errors, indented, separated by newlines:',
|
|
33
|
-
'%s',
|
|
34
|
-
'End of parsing errors.',
|
|
35
|
-
], parserParsingFailedErrors
|
|
36
|
-
.flatMap(error => error.stack?.split('\n'))
|
|
37
|
-
.map(line => ' ' + line)
|
|
38
|
-
.join('\n'));
|
|
39
|
-
};
|
|
40
|
-
const name = [
|
|
41
|
-
'(',
|
|
42
|
-
...childParsers.map(getParserName).join('|'),
|
|
43
|
-
')',
|
|
44
|
-
].join('');
|
|
45
|
-
Object.defineProperty(disjunctionParser, 'name', { value: name });
|
|
46
|
-
return disjunctionParser;
|
|
47
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { parserImplementationInvariant } from './parserImplementationInvariant.js';
|
|
2
|
-
export const createExactParser = (inputChunk) => {
|
|
3
|
-
parserImplementationInvariant(length > 0, 'Length must be positive.');
|
|
4
|
-
return async (parserContext) => {
|
|
5
|
-
const elements = [];
|
|
6
|
-
for (let i = 0; i < length; i++) {
|
|
7
|
-
const element = await parserContext.read(0);
|
|
8
|
-
elements.push(element);
|
|
9
|
-
}
|
|
10
|
-
return parserContext.from(elements);
|
|
11
|
-
};
|
|
12
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ParserParsingFailedError } from './parserError.js';
|
|
2
|
-
import { parserImplementationInvariant } from './parserImplementationInvariant.js';
|
|
3
|
-
import { parserParsingInvariant } from './parserParsingInvariant.js';
|
|
4
|
-
function getParserName(parser) {
|
|
5
|
-
return parser.name || 'anonymousSequentialUnionChild';
|
|
6
|
-
}
|
|
7
|
-
export const createDisjunctionParser = (childParsers) => {
|
|
8
|
-
parserImplementationInvariant(childParsers.length > 0, 'SequentialUnion parser must have at least one child parser.');
|
|
9
|
-
const sequentialUnionParser = async (parserContext) => {
|
|
10
|
-
let runningChildParserContexts = [];
|
|
11
|
-
const childParserResults = (async function* () {
|
|
12
|
-
for (const childParser of childParsers) {
|
|
13
|
-
const childParserContext = parserContext.lookahead(getParserName(childParser));
|
|
14
|
-
runningChildParserContexts.push(childParserContext);
|
|
15
|
-
const [promiseSettledResult] = await Promise.allSettled([childParser(childParserContext)]);
|
|
16
|
-
yield {
|
|
17
|
-
...promiseSettledResult,
|
|
18
|
-
context: childParserContext,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
})();
|
|
22
|
-
const parserParsingFailedErrors = [];
|
|
23
|
-
const successfulParserOutputs = [];
|
|
24
|
-
const successfulParserContexts = [];
|
|
25
|
-
for await (const childParserResult of childParserResults) {
|
|
26
|
-
runningChildParserContexts = runningChildParserContexts.filter(runningChildParserContext => runningChildParserContext !== childParserResult.context);
|
|
27
|
-
if (childParserResult.status === 'fulfilled') {
|
|
28
|
-
successfulParserOutputs.push(childParserResult.value);
|
|
29
|
-
successfulParserContexts.push(childParserResult.context);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
const error = childParserResult.reason;
|
|
33
|
-
if (error instanceof ParserParsingFailedError) {
|
|
34
|
-
parserParsingFailedErrors.push(error);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
parserImplementationInvariant(successfulParserOutputs.length <= 1, [
|
|
42
|
-
'Multiple sequentialUnion child parsers succeeded.',
|
|
43
|
-
'Successful parser outputs, indented, separated by newlines:',
|
|
44
|
-
'%s',
|
|
45
|
-
'End of successful parser outputs.',
|
|
46
|
-
], successfulParserOutputs.map(output => ' ' + JSON.stringify(output)).join('\n'));
|
|
47
|
-
parserParsingInvariant(successfulParserOutputs.length === 1, [
|
|
48
|
-
'No sequentialUnion child parser succeeded.',
|
|
49
|
-
'Parsing errors, indented, separated by newlines:',
|
|
50
|
-
'%s',
|
|
51
|
-
'End of parsing errors.',
|
|
52
|
-
], parserParsingFailedErrors
|
|
53
|
-
.flatMap(error => error.stack?.split('\n'))
|
|
54
|
-
.map(line => ' ' + line)
|
|
55
|
-
.join('\n'));
|
|
56
|
-
const [successfulParserContext] = successfulParserContexts;
|
|
57
|
-
successfulParserContext.unlookahead();
|
|
58
|
-
successfulParserContext.dispose();
|
|
59
|
-
const [successfulParserOutput] = successfulParserOutputs;
|
|
60
|
-
return successfulParserOutput;
|
|
61
|
-
};
|
|
62
|
-
const name = [
|
|
63
|
-
'(',
|
|
64
|
-
...childParsers.map(getParserName).join('|'),
|
|
65
|
-
')',
|
|
66
|
-
].join('');
|
|
67
|
-
Object.defineProperty(sequentialUnionParser, 'name', { value: name });
|
|
68
|
-
return sequentialUnionParser;
|
|
69
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { parserImplementationInvariant } from './parserImplementationInvariant.js';
|
|
2
|
-
export const createFixedLengthParser = (length) => {
|
|
3
|
-
parserImplementationInvariant(length > 0, 'Length must be positive.');
|
|
4
|
-
return async (parserContext) => {
|
|
5
|
-
const elements = [];
|
|
6
|
-
for (let i = 0; i < length; i++) {
|
|
7
|
-
const element = await parserContext.read(0);
|
|
8
|
-
elements.push(element);
|
|
9
|
-
}
|
|
10
|
-
return parserContext.from(elements);
|
|
11
|
-
};
|
|
12
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { parserImplementationInvariant } from './parserImplementationInvariant.js';
|
|
2
|
-
export const createFixedLengthSequenceParser = (length) => {
|
|
3
|
-
parserImplementationInvariant(length >= 0, 'Length must be non-negative got %s.', length);
|
|
4
|
-
return async (parserContext) => {
|
|
5
|
-
const elements = [];
|
|
6
|
-
for (let i = 0; i < length; i++) {
|
|
7
|
-
const element = await parserContext.read(0);
|
|
8
|
-
elements.push(element);
|
|
9
|
-
}
|
|
10
|
-
return parserContext.from(elements);
|
|
11
|
-
};
|
|
12
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type InputCompanion } from './inputCompanion.js';
|
|
2
|
-
export interface SequenceBuffer<Sequence, InputElement> {
|
|
3
|
-
push(sequence: Sequence): void;
|
|
4
|
-
peek(offset: number): InputElement | undefined;
|
|
5
|
-
skip(offset: number): void;
|
|
6
|
-
}
|
|
7
|
-
export declare class SequenceBufferImplementation<Sequence, InputElement> implements SequenceBuffer<Sequence, InputElement> {
|
|
8
|
-
private readonly _inputCompanion;
|
|
9
|
-
private readonly _sequences;
|
|
10
|
-
private _indexInFirstSequence;
|
|
11
|
-
constructor(_inputCompanion: InputCompanion<Sequence, InputElement>);
|
|
12
|
-
push(sequence: Sequence): void;
|
|
13
|
-
peek(offset: number): InputElement | undefined;
|
|
14
|
-
skip(offset: number): void;
|
|
15
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import invariant from 'invariant';
|
|
2
|
-
export class SequenceBufferImplementation {
|
|
3
|
-
_inputCompanion;
|
|
4
|
-
_sequences = [];
|
|
5
|
-
_indexInFirstSequence = 0;
|
|
6
|
-
constructor(_inputCompanion) {
|
|
7
|
-
this._inputCompanion = _inputCompanion;
|
|
8
|
-
}
|
|
9
|
-
push(sequence) {
|
|
10
|
-
this._sequences.push(sequence);
|
|
11
|
-
while (this._sequences.length > 0) {
|
|
12
|
-
const firstSequence = this._sequences[0];
|
|
13
|
-
const firstSequenceLength = this._inputCompanion.length(firstSequence);
|
|
14
|
-
if (firstSequenceLength === 0) {
|
|
15
|
-
this._sequences.shift();
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
if (this._indexInFirstSequence < firstSequenceLength) {
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
this._sequences.shift();
|
|
22
|
-
this._indexInFirstSequence -= firstSequenceLength;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
peek(offset) {
|
|
26
|
-
invariant(offset >= 0, 'Offset must be non-negative.');
|
|
27
|
-
let index = this._indexInFirstSequence + offset;
|
|
28
|
-
for (const sequence of this._sequences) {
|
|
29
|
-
const sequenceLength = this._inputCompanion.length(sequence);
|
|
30
|
-
if (index < sequenceLength) {
|
|
31
|
-
return this._inputCompanion.at(sequence, index);
|
|
32
|
-
}
|
|
33
|
-
index -= sequenceLength;
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
skip(offset) {
|
|
38
|
-
this._indexInFirstSequence += offset;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import { SequenceBufferImplementation } from './sequenceBuffer.js';
|
|
3
|
-
import { stringInputCompanion } from './inputCompanion.js';
|
|
4
|
-
test('sequenceBuffer', t => {
|
|
5
|
-
const sequenceBuffer = new SequenceBufferImplementation(stringInputCompanion);
|
|
6
|
-
t.is(sequenceBuffer.peek(0), undefined);
|
|
7
|
-
sequenceBuffer.push('');
|
|
8
|
-
t.is(sequenceBuffer.peek(0), undefined);
|
|
9
|
-
sequenceBuffer.push('abc');
|
|
10
|
-
t.is(sequenceBuffer.peek(0), 'a');
|
|
11
|
-
t.is(sequenceBuffer.peek(1), 'b');
|
|
12
|
-
t.is(sequenceBuffer.peek(2), 'c');
|
|
13
|
-
t.is(sequenceBuffer.peek(3), undefined);
|
|
14
|
-
sequenceBuffer.push('def');
|
|
15
|
-
t.is(sequenceBuffer.peek(0), 'a');
|
|
16
|
-
t.is(sequenceBuffer.peek(3), 'd');
|
|
17
|
-
t.is(sequenceBuffer.peek(6), undefined);
|
|
18
|
-
sequenceBuffer.push('');
|
|
19
|
-
t.is(sequenceBuffer.peek(0), 'a');
|
|
20
|
-
t.is(sequenceBuffer.peek(3), 'd');
|
|
21
|
-
t.is(sequenceBuffer.peek(6), undefined);
|
|
22
|
-
sequenceBuffer.skip(1);
|
|
23
|
-
t.is(sequenceBuffer.peek(0), 'b');
|
|
24
|
-
t.is(sequenceBuffer.peek(3), 'e');
|
|
25
|
-
t.is(sequenceBuffer.peek(5), undefined);
|
|
26
|
-
sequenceBuffer.skip(3);
|
|
27
|
-
t.is(sequenceBuffer.peek(0), 'e');
|
|
28
|
-
t.is(sequenceBuffer.peek(2), undefined);
|
|
29
|
-
sequenceBuffer.push('gh');
|
|
30
|
-
t.is(sequenceBuffer.peek(0), 'e');
|
|
31
|
-
t.is(sequenceBuffer.peek(2), 'g');
|
|
32
|
-
t.is(sequenceBuffer.peek(3), 'h');
|
|
33
|
-
t.is(sequenceBuffer.peek(4), undefined);
|
|
34
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type InputCompanion<Sequence, Element> = {
|
|
2
|
-
is(value: unknown): value is Sequence;
|
|
3
|
-
from(elements: Element[]): Sequence;
|
|
4
|
-
length(sequence: Sequence): number;
|
|
5
|
-
at(sequence: Sequence, index: number): Element | undefined;
|
|
6
|
-
};
|
|
7
|
-
export declare const stringInputCompanion: {
|
|
8
|
-
is(value: unknown): value is string;
|
|
9
|
-
from(elements: string[]): string;
|
|
10
|
-
length(sequence: string): number;
|
|
11
|
-
at(sequence: string, index: number): string | undefined;
|
|
12
|
-
};
|
|
13
|
-
export declare const uint8ArrayInputCompanion: {
|
|
14
|
-
is(value: unknown): value is Uint8Array;
|
|
15
|
-
from(elements: number[]): Uint8Array;
|
|
16
|
-
length(sequence: Uint8Array): number;
|
|
17
|
-
at(sequence: Uint8Array, index: number): number | undefined;
|
|
18
|
-
};
|
package/build/inputCompanion.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export const stringInputCompanion = new class StringInputCompanion {
|
|
2
|
-
is(value) {
|
|
3
|
-
return typeof value === 'string';
|
|
4
|
-
}
|
|
5
|
-
from(elements) {
|
|
6
|
-
return elements.join('');
|
|
7
|
-
}
|
|
8
|
-
length(sequence) {
|
|
9
|
-
return sequence.length;
|
|
10
|
-
}
|
|
11
|
-
at(sequence, index) {
|
|
12
|
-
return sequence.at(index);
|
|
13
|
-
}
|
|
14
|
-
}();
|
|
15
|
-
export const uint8ArrayInputCompanion = new class Uint8ArrayInputCompanion {
|
|
16
|
-
is(value) {
|
|
17
|
-
return value instanceof Uint8Array;
|
|
18
|
-
}
|
|
19
|
-
from(elements) {
|
|
20
|
-
return new Uint8Array(elements);
|
|
21
|
-
}
|
|
22
|
-
length(sequence) {
|
|
23
|
-
return sequence.length;
|
|
24
|
-
}
|
|
25
|
-
at(sequence, index) {
|
|
26
|
-
return sequence.at(index);
|
|
27
|
-
}
|
|
28
|
-
}();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function invariantDefined<T>(value: T, format: string, ...extra: any[]): Exclude<T, undefined>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createArrayParser } from "./arrayParser.js";
|
|
2
|
-
import { createElementParser } from "./elementParser.js";
|
|
3
|
-
import { createTupleParser } from "./tupleParser.js";
|
|
4
|
-
export const javaKeyStoreParser = createTupleParser([
|
|
5
|
-
createArrayParser(createElementParser()),
|
|
6
|
-
createArrayParser(createElementParser()),
|
|
7
|
-
]);
|
package/build/jsonParser2.d.ts
DELETED
package/build/jsonParser2.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { parserParsingInvariant } from './parserParsingInvariant.js';
|
|
2
|
-
import { createUnionParser } from './unionParser.js';
|
|
3
|
-
import { createExactSequenceParser } from './exactSequenceParser.js';
|
|
4
|
-
import { promiseCompose } from './promiseCompose.js';
|
|
5
|
-
const jsonStringParser = async (inputContext) => {
|
|
6
|
-
await inputContext.read(0);
|
|
7
|
-
await inputContext.read(0);
|
|
8
|
-
return '';
|
|
9
|
-
};
|
|
10
|
-
const jsonDummyParser = async (inputContext) => {
|
|
11
|
-
await inputContext.read(0);
|
|
12
|
-
parserParsingInvariant(false, 'dummy');
|
|
13
|
-
return 0;
|
|
14
|
-
};
|
|
15
|
-
const jsonNullParser = promiseCompose(createExactSequenceParser('null'), () => null);
|
|
16
|
-
Object.defineProperty(jsonNullParser, 'name', { value: 'jsonNullParser' });
|
|
17
|
-
const jsonPrimitiveParser = createUnionParser([
|
|
18
|
-
jsonDummyParser,
|
|
19
|
-
jsonDummyParser,
|
|
20
|
-
jsonDummyParser,
|
|
21
|
-
jsonDummyParser,
|
|
22
|
-
jsonNullParser,
|
|
23
|
-
]);
|
|
24
|
-
Object.defineProperty(jsonPrimitiveParser, 'name', { value: 'jsonPrimitiveParser' });
|
|
25
|
-
const jsonObjectParser = async (inputContext) => {
|
|
26
|
-
const value = {};
|
|
27
|
-
const firstCharacter = await inputContext.read(0);
|
|
28
|
-
parserParsingInvariant(firstCharacter === '{', 'Expected "{", got "%s"', firstCharacter);
|
|
29
|
-
const key = await jsonStringParser(inputContext);
|
|
30
|
-
const colon = await inputContext.read(0);
|
|
31
|
-
parserParsingInvariant(colon === ':', 'Expected ":", got "%s"', colon);
|
|
32
|
-
const keyValue = await jsonValueParser2(inputContext);
|
|
33
|
-
Object.defineProperty(value, key, {
|
|
34
|
-
value: keyValue,
|
|
35
|
-
enumerable: true,
|
|
36
|
-
});
|
|
37
|
-
const commaOrClosingBrace = await inputContext.peek(0);
|
|
38
|
-
parserParsingInvariant((commaOrClosingBrace === ','
|
|
39
|
-
|| commaOrClosingBrace === '}'), 'Expected "," or "}", got "%s"', commaOrClosingBrace);
|
|
40
|
-
if (commaOrClosingBrace === '}') {
|
|
41
|
-
inputContext.skip(1);
|
|
42
|
-
return value;
|
|
43
|
-
}
|
|
44
|
-
parserParsingInvariant(commaOrClosingBrace === ',', 'Expected ",", got "%s"', commaOrClosingBrace);
|
|
45
|
-
inputContext.skip(1);
|
|
46
|
-
return value;
|
|
47
|
-
};
|
|
48
|
-
export const jsonValueParser2 = createUnionParser([
|
|
49
|
-
jsonObjectParser,
|
|
50
|
-
jsonPrimitiveParser,
|
|
51
|
-
]);
|
|
52
|
-
Object.defineProperty(jsonValueParser2, 'name', { value: 'jsonValueParser2' });
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { testProp, fc } from '@fast-check/ava';
|
|
2
|
-
import { jsonValueParser2 } from './jsonParser2.js';
|
|
3
|
-
import { runParser } from './parser.js';
|
|
4
|
-
import { arbitrarilySlicedAsyncIterator } from './arbitrarilySlicedAsyncInterator.js';
|
|
5
|
-
import { stringInputCompanion } from './inputCompanion.js';
|
|
6
|
-
testProp('json', [
|
|
7
|
-
arbitrarilySlicedAsyncIterator(fc.json()),
|
|
8
|
-
], async (t, [jsonString, jsonStringChunkIterator]) => {
|
|
9
|
-
if (jsonString !== '{"":null}') {
|
|
10
|
-
throw new Error('This test is only for the JSON string \'{"":null}\'.');
|
|
11
|
-
}
|
|
12
|
-
const actual = await runParser(jsonValueParser2, jsonStringChunkIterator, stringInputCompanion);
|
|
13
|
-
const expected = JSON.parse(jsonString);
|
|
14
|
-
t.deepEqual(actual, expected);
|
|
15
|
-
}, {
|
|
16
|
-
verbose: true,
|
|
17
|
-
examples: [
|
|
18
|
-
[['{"":null}', (async function* () {
|
|
19
|
-
yield* ['{"":null}'];
|
|
20
|
-
})()[Symbol.asyncIterator]()]],
|
|
21
|
-
],
|
|
22
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { getParserName } from './parser.js';
|
|
2
|
-
import { ParserParsingFailedError } from './parserError.js';
|
|
3
|
-
export const createNegativeLookaheadParser = (childParser) => async (parserContext) => {
|
|
4
|
-
const childParserContext = parserContext.lookahead();
|
|
5
|
-
try {
|
|
6
|
-
await childParser(childParserContext);
|
|
7
|
-
parserContext.invariant(false, 'Negative lookahead assertion failed for child parser %s.', getParserName(childParser));
|
|
8
|
-
}
|
|
9
|
-
catch (error) {
|
|
10
|
-
if (error instanceof ParserParsingFailedError) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
throw error;
|
|
14
|
-
}
|
|
15
|
-
finally {
|
|
16
|
-
childParserContext.dispose();
|
|
17
|
-
}
|
|
18
|
-
};
|
package/build/parserCompose.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Parser } from "./parser.js";
|
|
2
|
-
import { DeriveSequenceElement } from "./sequence.js";
|
|
3
|
-
export declare function parserCreatorCompose<OutputA, OutputB, Sequence, Element = DeriveSequenceElement<Sequence>>(f1: Parser<OutputA, Sequence, Element>, f2: (outputA: OutputA) => Parser<OutputB, Sequence, Element>): Parser<OutputB, Sequence, Element>;
|
package/build/parserCompose.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import invariant from 'invariant';
|
|
2
|
-
import { ParserImplementationInvariantError } from './parserError.js';
|
|
3
|
-
export function parserImplementationInvariant(value, formatOrFormatLines, ...extra) {
|
|
4
|
-
const format = Array.isArray(formatOrFormatLines) ? formatOrFormatLines.join('\n') : formatOrFormatLines;
|
|
5
|
-
try {
|
|
6
|
-
invariant(value, format, ...extra);
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
catch (error) {
|
|
10
|
-
if (error instanceof Error) {
|
|
11
|
-
throw new ParserImplementationInvariantError(error.message);
|
|
12
|
-
}
|
|
13
|
-
throw error;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type Constructor } from 'type-fest';
|
|
2
|
-
export type Falsy = '' | 0 | false | undefined;
|
|
3
|
-
export type ValueOrAccessor<T> = T | (() => T);
|
|
4
|
-
export declare function customInvariant<T>(ErrorConstructor: Constructor<Error, [message: string]> | ((message: string) => Error), value: T, formatOrFormatLines: ValueOrAccessor<string | string[]>, ...formatArguments: any[]): Exclude<T, Falsy>;
|
package/build/parserInvariant.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function customInvariant(ErrorConstructor, value, formatOrFormatLines, ...formatArguments) {
|
|
2
|
-
if (value) {
|
|
3
|
-
return value;
|
|
4
|
-
}
|
|
5
|
-
let format = typeof formatOrFormatLines === 'function' ? formatOrFormatLines() : formatOrFormatLines;
|
|
6
|
-
format = Array.isArray(format) ? format.join('\n') : format;
|
|
7
|
-
throw new ErrorConstructor(format.replaceAll('%s', () => {
|
|
8
|
-
const argumentOrAccessor = formatArguments.shift();
|
|
9
|
-
return typeof argumentOrAccessor === 'function' ? argumentOrAccessor() : argumentOrAccessor;
|
|
10
|
-
}));
|
|
11
|
-
}
|
package/build/promiseFish.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function promiseCompose<A, B, C>(f1: (a: A) => Promise<B>, f2: (b: B) => Promise<C>): (a: A) => Promise<C>;
|
package/build/promiseFish.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type Parser } from './parser.js';
|
|
2
|
-
export declare function createTupleParser<A, B, Sequence>([parserA, parserB]: [Parser<A, Sequence>, Parser<B, Sequence>]): Parser<[A, B], Sequence>;
|
|
3
|
-
export declare function createTupleParser<A, B, C, Sequence>([parserA, parserB, parserC]: [Parser<A, Sequence>, Parser<B, Sequence>, Parser<C, Sequence>]): Parser<[A, B, C], Sequence>;
|
package/build/sequenceParser.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { Parser } from "./parser.js";
|
|
2
|
-
export declare const createTerminatedArrayParser: <ElementOutput, TerminatorOutput, Sequence>(elementParser: Parser<ElementOutput, Sequence>, terminatorParser: Parser<unknown, Sequence>) => Parser<[ElementOutput[], TerminatorOutput], Sequence>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { promiseCompose } from "./promiseCompose.js";
|
|
2
|
-
import { createUnionParser } from "./unionParser.js";
|
|
3
|
-
class Terminated {
|
|
4
|
-
value;
|
|
5
|
-
constructor(value) {
|
|
6
|
-
this.value = value;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export const createTerminatedArrayParser = (elementParser, terminatorParser) => {
|
|
10
|
-
const elementOrTerminatorParser = createUnionParser([
|
|
11
|
-
elementParser,
|
|
12
|
-
promiseCompose(terminatorParser, terminatorValue => new Terminated(terminatorValue)),
|
|
13
|
-
]);
|
|
14
|
-
return async (parserContext) => {
|
|
15
|
-
const elements = [];
|
|
16
|
-
while (true) {
|
|
17
|
-
const elementOrTerminator = await elementOrTerminatorParser(parserContext);
|
|
18
|
-
if (elementOrTerminator instanceof Terminated) {
|
|
19
|
-
return [elements, elementOrTerminator.value];
|
|
20
|
-
}
|
|
21
|
-
elements.push(elementOrTerminator);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { StringParserInputCompanion, Uint8ArrayParserInputCompanion } from "./parserInputCompanion.js";
|
|
2
|
-
export type UnparserOutputCompanion<Sequence, Element> = {
|
|
3
|
-
is(value: unknown): value is Sequence;
|
|
4
|
-
from(elements: Element[]): Sequence;
|
|
5
|
-
concat(sequences: Sequence[]): Sequence;
|
|
6
|
-
length(sequence: Sequence): number;
|
|
7
|
-
};
|
|
8
|
-
export declare class StringUnparserOutputCompanion extends StringParserInputCompanion implements UnparserOutputCompanion<string, string> {
|
|
9
|
-
concat(sequences: string[]): string;
|
|
10
|
-
}
|
|
11
|
-
export declare const stringUnparserOutputCompanion: StringUnparserOutputCompanion;
|
|
12
|
-
export declare class Uint8ArrayUnparserOutputCompanion extends Uint8ArrayParserInputCompanion implements UnparserOutputCompanion<Uint8Array, number> {
|
|
13
|
-
concat(sequences: Uint8Array[]): Uint8Array;
|
|
14
|
-
}
|
|
15
|
-
export declare const uint8ArrayUnparserOutputCompanion: Uint8ArrayUnparserOutputCompanion;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { StringParserInputCompanion, Uint8ArrayParserInputCompanion } from "./parserInputCompanion.js";
|
|
2
|
-
export class StringUnparserOutputCompanion extends StringParserInputCompanion {
|
|
3
|
-
concat(sequences) {
|
|
4
|
-
return sequences.join('');
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
export const stringUnparserOutputCompanion = new StringUnparserOutputCompanion();
|
|
8
|
-
export class Uint8ArrayUnparserOutputCompanion extends Uint8ArrayParserInputCompanion {
|
|
9
|
-
concat(sequences) {
|
|
10
|
-
return Buffer.concat(sequences);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export const uint8ArrayUnparserOutputCompanion = new Uint8ArrayUnparserOutputCompanion();
|
package/build/zipEntry.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export type ZipStoreCompression = {
|
|
2
|
-
type: 'store';
|
|
3
|
-
};
|
|
4
|
-
export type ZipDeflateCompression = {
|
|
5
|
-
type: 'deflate';
|
|
6
|
-
level: number;
|
|
7
|
-
};
|
|
8
|
-
export type ZipCompression = ZipStoreCompression | ZipDeflateCompression;
|
|
9
|
-
export type ZipFileEntry = {
|
|
10
|
-
type: 'file';
|
|
11
|
-
name: string;
|
|
12
|
-
date: Date;
|
|
13
|
-
comment: string;
|
|
14
|
-
unixPermissions: number;
|
|
15
|
-
dosPermissions: number;
|
|
16
|
-
compression: ZipCompression;
|
|
17
|
-
content: Uint8Array;
|
|
18
|
-
};
|
|
19
|
-
export type ZipDirectoryEntry = {
|
|
20
|
-
type: 'directory';
|
|
21
|
-
name: string;
|
|
22
|
-
date: Date;
|
|
23
|
-
comment: string;
|
|
24
|
-
unixPermissions: number;
|
|
25
|
-
dosPermissions: number;
|
|
26
|
-
entries: ZipEntry[];
|
|
27
|
-
};
|
|
28
|
-
export type ZipEntry = ZipFileEntry | ZipDirectoryEntry;
|