diff --git a/src/asar.ts b/src/asar.ts index bd0f7aa..2d1b5cb 100644 --- a/src/asar.ts +++ b/src/asar.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import * as minimatch from 'minimatch'; +import minimatch from 'minimatch'; import fs from './wrapped-fs'; import { Filesystem, FilesystemEntry } from './filesystem'; @@ -271,3 +271,16 @@ export function uncache(archivePath: string) { export function uncacheAll() { disk.uncacheAll(); } + +export default { + createPackage, + createPackageWithOptions, + createPackageFromFiles, + statFile, + getRawHeader, + listPackage, + extractFile, + extractAll, + uncache, + uncacheAll, +}; diff --git a/test/api-spec.js b/test/api-spec.js index db01989..892e814 100644 --- a/test/api-spec.js +++ b/test/api-spec.js @@ -160,4 +160,12 @@ describe('api', function () { ); return compDirs('test/input/packthis-object-prototype/', 'tmp/packthis-object-prototype'); }); + it('should export all functions also in the default export', () => { + const topLevelFunctions = Object.keys(asar).filter((key) => typeof asar[key] === 'function'); + const defaultExportFunctions = Object.keys(asar.default).filter( + (key) => typeof asar.default[key] === 'function', + ); + + assert.deepStrictEqual(topLevelFunctions, defaultExportFunctions); + }); }); diff --git a/tsconfig.json b/tsconfig.json index 0833e88..9e5b08d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,8 @@ "moduleResolution": "node", "declaration": true, "noImplicitAny": true, - "strictNullChecks": true + "strictNullChecks": true, + "esModuleInterop": true }, "include": [ "src"