Skip to content

Commit

Permalink
fix: Export a "default" property (#325)
Browse files Browse the repository at this point in the history
* fix: Export a "default" property

* test: Add a test for default export
  • Loading branch information
felixrieseberg authored Sep 10, 2024
1 parent 4f7abe9 commit 06312cd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/asar.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
};
8 changes: 8 additions & 0 deletions test/api-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"moduleResolution": "node",
"declaration": true,
"noImplicitAny": true,
"strictNullChecks": true
"strictNullChecks": true,
"esModuleInterop": true
},
"include": [
"src"
Expand Down

0 comments on commit 06312cd

Please sign in to comment.