diff --git a/__test__/index.spec.js b/__test__/index.spec.js index 27e2309..b92ad91 100644 --- a/__test__/index.spec.js +++ b/__test__/index.spec.js @@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const ava_1 = __importDefault(require("ava")); const node_process_1 = __importDefault(require("node:process")); -const indax_js_1 = require("../indax.js"); +const indax_1 = require("../indax"); const smbURL = node_process_1.default.env.SMB_URL || 'smb://127.0.0.1/Users/Shared/smb/'; //const smbPath = process.env.SMB_PATH; let cachedRoot; @@ -30,7 +30,7 @@ let testPermissions = false; let testResolve = false; async function getRootHandle() { if (!cachedRoot) { - cachedRoot = new indax_js_1.SmbDirectoryHandle(smbURL); + cachedRoot = new indax_1.SmbDirectoryHandle(smbURL); } //let cachedRoot = new SmbDirectoryHandle(smbURL); let subRoot = cachedRoot; diff --git a/__test__/index.spec.ts b/__test__/index.spec.ts index fb45e32..1ea0138 100644 --- a/__test__/index.spec.ts +++ b/__test__/index.spec.ts @@ -19,7 +19,7 @@ import test from 'ava' import process from 'node:process'; -import { SmbDirectoryHandle, SmbFileHandle } from '../indax.js' +import { SmbDirectoryHandle, SmbFileHandle } from '../indax'; const smbURL = process.env.SMB_URL || 'smb://127.0.0.1/Users/Shared/smb/'; //const smbPath = process.env.SMB_PATH; @@ -30,7 +30,7 @@ let testResolve = false; async function getRootHandle(): Promise { if (!cachedRoot) { - cachedRoot = new SmbDirectoryHandle(smbURL); + cachedRoot = new SmbDirectoryHandle(smbURL) as any as FileSystemDirectoryHandle; } //let cachedRoot = new SmbDirectoryHandle(smbURL); let subRoot: FileSystemDirectoryHandle = cachedRoot; @@ -42,7 +42,7 @@ async function getRootHandle(): Promise { test.serial('should have correct properties for directory', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('first') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('first') as any as SmbDirectoryHandle; t.is(dirHandle.kind, 'directory'); t.is(dirHandle.name, 'first'); }) @@ -94,21 +94,21 @@ test.serial('should not be same entry as others for file', async (t) => { test.serial('should be granted read permission when querying on directory', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('first') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('first') as any as SmbDirectoryHandle; const perm = await dirHandle.queryPermission({mode: 'read'}); t.is(perm, 'granted'); }) test.serial('should be granted readwrite permission when querying on directory', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('first') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('first') as any as SmbDirectoryHandle; const perm = await dirHandle.queryPermission({mode: 'readwrite'}); t.is(perm, 'granted'); }) test.serial('should be granted read permission when querying on read-only directory', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('quatre') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('quatre') as any as SmbDirectoryHandle; const perm = await dirHandle.queryPermission({mode: 'read'}); t.is(perm, 'granted'); }) @@ -116,7 +116,7 @@ test.serial('should be granted read permission when querying on read-only direct if (testPermissions) { test.serial('should be denied readwrite permission when querying on read-only directory', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('quatre') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('quatre') as any as SmbDirectoryHandle; const perm = await dirHandle.queryPermission({mode: 'readwrite'}); t.is(perm, 'denied'); }) @@ -131,8 +131,8 @@ if (testPermissions) { const count = process.env.TEST_USING_MOCKS ? 1000 : 10; const rootHandle = await getRootHandle(); const [first, quatre] = await Promise.all([ - rootHandle.getDirectoryHandle('first') as Promise, - rootHandle.getDirectoryHandle('quatre') as Promise, + rootHandle.getDirectoryHandle('first') as any as Promise, + rootHandle.getDirectoryHandle('quatre') as any as Promise, ]); for (let i = 0; i < count; i++) { const [firstPerm, quatrePerm] = await Promise.all([ @@ -147,14 +147,14 @@ if (testPermissions) { test.serial('should be granted read permission when requesting on directory', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('first') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('first') as any as SmbDirectoryHandle; const perm = await dirHandle.requestPermission({mode: 'read'}); t.is(perm, 'granted'); }) test.serial('should be granted readwrite permission when requesting on directory', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('first') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('first') as any as SmbDirectoryHandle; const perm = await dirHandle.requestPermission({mode: 'readwrite'}); t.is(perm, 'granted'); }) @@ -222,7 +222,7 @@ test.serial('should iterate through directory', async (t) => { test.serial('should iterate through subdirectory', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('first') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('first') as any as SmbDirectoryHandle; const expectedEntries = [ {key: 'comment', value: {kind: 'file', name: 'comment'}}, ]; @@ -242,8 +242,8 @@ test.serial('should iterate through subdirectory', async (t) => { test.serial('should iterate through subsubdirectory', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('first') as SmbDirectoryHandle; - const subdirHandle = await dirHandle.getDirectoryHandle('place', {create: true}) as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('first') as any as SmbDirectoryHandle; + const subdirHandle = await dirHandle.getDirectoryHandle('place', {create: true}) as any as SmbDirectoryHandle; const expectedEntries = []; let i = 0; for await (const [ _key, _value ] of subdirHandle) { @@ -285,7 +285,7 @@ test.serial('should iterate through entries', async (t) => { test.serial('should iterate through subdirectory entries', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('quatre') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('quatre') as any as SmbDirectoryHandle; const expectedEntries = [ {key: 'points', value: {kind: 'file', name: 'points'}}, ]; @@ -320,7 +320,7 @@ test.serial('should iterate through keys', async (t) => { test.serial('should iterate through subdirectory keys', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('quatre') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('quatre') as any as SmbDirectoryHandle; const expectedKeys = ['points']; let i = 0; for await (const key of dirHandle.keys()) { @@ -360,7 +360,7 @@ test.serial('should iterate through values', async (t) => { test.serial('should iterate through subdirectory values', async (t) => { const rootHandle = await getRootHandle(); - const dirHandle = await rootHandle.getDirectoryHandle('first') as SmbDirectoryHandle; + const dirHandle = await rootHandle.getDirectoryHandle('first') as any as SmbDirectoryHandle; const expectedValues = [ {kind: 'file', name: 'comment'}, ]; @@ -1296,7 +1296,7 @@ if (!process.env.TEST_USING_MOCKS) { test.serial.skip('should handle watch', async (t) => { const sleep = async (ms: number) => { return new Promise((resolve) => setTimeout(resolve, ms)); }; const rootHandle = await getRootHandle(); - const smbHandle = rootHandle as SmbDirectoryHandle; + const smbHandle = rootHandle as any as SmbDirectoryHandle; const caught: {path: string, action: string}[] = []; const watcher = smbHandle.watch(async (watchEvent) => { caught.push(watchEvent); @@ -1356,7 +1356,7 @@ if (!process.env.TEST_USING_MOCKS) { const rootHandle = await getRootHandle(); const subHandle = await rootHandle.getDirectoryHandle("subbed", {create: true}); const subSubHandle = await subHandle.getDirectoryHandle("sub", {create: true}); - const smbHandle = subHandle as SmbDirectoryHandle; + const smbHandle = subHandle as any as SmbDirectoryHandle; const caught: {path: string, action: string}[] = []; const watcher = smbHandle.watch(async (watchEvent) => { caught.push(watchEvent); diff --git a/build.sh b/build.sh index 82ba438..3719766 100755 --- a/build.sh +++ b/build.sh @@ -87,7 +87,25 @@ else for x in `cat index.js | grep -o "smb-js\..*\.node" | sort | uniq`; do cat index.js | sed "s/join(__dirname, '$x')/new URL('$x', import.meta.url)/g" > index.js~ mv index.js{~,} + + cat index.js | sed "s/require('.\/$x')/require(new URL('$x', import.meta.url).pathname)/g" > index.js~ + mv index.js{~,} done + + # also remove check for universal binary for darwin, as we know we won't have one + cat index.js | grep -v "'smb-js.darwin-universal.node'" > index.js~ + mv index.js{~,} + + # finally, change way in which things are exported from index.js + cat index.js | grep -v 'module.exports.' | sed "s/^const {$/export const {/" > index.js~ + mv index.js{~,} + + # change indax.js to require index.cjs instead of just index + cat indax.js | sed "s/index\"/index.cjs\"/" > indax.js~ + mv indax.js{~,} + + mv index.js index.cjs + mv indax.js indax.cjs fi if [ "${NODE_OS}" == "darwin" ]; then diff --git a/indax.js b/indax.cjs similarity index 86% rename from indax.js rename to indax.cjs index 41484ac..d199f41 100644 --- a/indax.js +++ b/indax.cjs @@ -16,11 +16,13 @@ * * SPDX-License-Identifier: Apache-2.0 */ -var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.SmbWritableFileStream = exports.SmbFileHandle = exports.SmbDirectoryHandle = exports.SmbHandle = void 0; -const index_js_1 = require("./index.js"); +const index_1 = require("./index.cjs"); class SmbHandle { + _jsh; + kind; + name; constructor(_jsh) { this._jsh = _jsh; this.kind = _jsh.kind; @@ -45,30 +47,35 @@ class SmbHandle { } exports.SmbHandle = SmbHandle; class SmbDirectoryHandle extends SmbHandle { + // @ts-ignore + [Symbol.asyncIterator] = this.entries; + _js; constructor(param) { const [url, toWrap] = typeof param === 'string' ? [param] : ['', param]; - const _js = toWrap || new index_js_1.JsSmbDirectoryHandle(url); + const _js = toWrap || new index_1.JsSmbDirectoryHandle(url); super(_js.toHandle()); - this[_a] = this.entries; this[Symbol.asyncIterator] = this.entries; this._js = _js; this.getFile = this.getFileHandle; this.getDirectory = this.getDirectoryHandle; this.getEntries = this.values; } + // @ts-ignore async *entries() { for await (const [key, value] of this._js.entries()) { - yield [key, value instanceof index_js_1.JsSmbDirectoryHandle ? new SmbDirectoryHandle(value) : new SmbFileHandle(value)]; + yield [key, value instanceof index_1.JsSmbDirectoryHandle ? new SmbDirectoryHandle(value) : new SmbFileHandle(value)]; } } + // @ts-ignore async *keys() { for await (const key of this._js.keys()) { yield key; } } + // @ts-ignore async *values() { for await (const value of this._js.values()) { - yield value instanceof index_js_1.JsSmbDirectoryHandle ? new SmbDirectoryHandle(value) : new SmbFileHandle(value); + yield value instanceof index_1.JsSmbDirectoryHandle ? new SmbDirectoryHandle(value) : new SmbFileHandle(value); } } async getDirectoryHandle(name, options) { @@ -114,13 +121,25 @@ class SmbDirectoryHandle extends SmbHandle { async resolve(possibleDescendant) { return this._js.resolve(possibleDescendant._jsh || possibleDescendant); } + /** + * @deprecated Old property just for Chromium <=85. Use `.getFileHandle()` in the new API. + */ + getFile; + /** + * @deprecated Old property just for Chromium <=85. Use `.getDirectoryHandle()` in the new API. + */ + getDirectory; + /** + * @deprecated Old property just for Chromium <=85. Use `.keys()`, `.values()`, `.entries()`, or the directory itself as an async iterable in the new API. + */ + getEntries; watch(callback) { return this._js.watch(callback); } } exports.SmbDirectoryHandle = SmbDirectoryHandle; -_a = Symbol.asyncIterator; class SmbFileHandle extends SmbHandle { + _js; constructor(_js) { super(_js.toHandle()); this._js = _js; @@ -142,6 +161,8 @@ class SmbFileHandle extends SmbHandle { } exports.SmbFileHandle = SmbFileHandle; class SmbWritableFileStream { + _js; + locked; constructor(_js) { this._js = _js; this.locked = _js.locked; diff --git a/indax.ts b/indax.ts index c6ce5d5..34f4780 100644 --- a/indax.ts +++ b/indax.ts @@ -26,7 +26,7 @@ import { JsSmbDirectoryHandle, JsSmbFileHandle, JsSmbWritableFileStream, -} from './index.js'; +} from './index'; type SmbHandlePermissionDescriptor = JsSmbHandlePermissionDescriptor; // @ts-ignore @@ -63,6 +63,7 @@ export class SmbHandle implements FileSystemHandle { } export class SmbDirectoryHandle extends SmbHandle implements FileSystemDirectoryHandle { + // @ts-ignore [Symbol.asyncIterator]: SmbDirectoryHandle['entries'] = this.entries declare readonly kind: 'directory' private _js: JsSmbDirectoryHandle @@ -78,26 +79,29 @@ export class SmbDirectoryHandle extends SmbHandle implements FileSystemDirectory this.getDirectory = this.getDirectoryHandle; this.getEntries = this.values; } + // @ts-ignore async *entries(): AsyncIterableIterator<[string, FileSystemDirectoryHandle | FileSystemFileHandle]> { for await (const [key, value] of this._js.entries()) { - yield [key, value instanceof JsSmbDirectoryHandle ? new SmbDirectoryHandle(value) as FileSystemDirectoryHandle : new SmbFileHandle(value) as FileSystemFileHandle]; + yield [key, value instanceof JsSmbDirectoryHandle ? new SmbDirectoryHandle(value) as any as FileSystemDirectoryHandle : new SmbFileHandle(value) as FileSystemFileHandle]; } } + // @ts-ignore async *keys(): AsyncIterableIterator { for await (const key of this._js.keys()) { yield key; } } + // @ts-ignore async *values(): AsyncIterableIterator { for await (const value of this._js.values()) { - yield value instanceof JsSmbDirectoryHandle ? new SmbDirectoryHandle(value) as FileSystemDirectoryHandle : new SmbFileHandle(value) as FileSystemFileHandle; + yield value instanceof JsSmbDirectoryHandle ? new SmbDirectoryHandle(value) as any as FileSystemDirectoryHandle : new SmbFileHandle(value) as FileSystemFileHandle; } } async getDirectoryHandle(name: string, options?: FileSystemGetDirectoryOptions): Promise { //console.log("getDirectoryHandle: ", name); return new Promise(async (resolve, reject) => { await this._js.getDirectoryHandle(name, options as JsSmbGetDirectoryOptions) - .then((handle) => resolve(new SmbDirectoryHandle(handle) as FileSystemDirectoryHandle)) + .then((handle) => resolve(new SmbDirectoryHandle(handle) as any as FileSystemDirectoryHandle)) .catch((reason) => { let errMsg: string = reason.message; if (errMsg !== undefined) { diff --git a/index.js b/index.cjs similarity index 80% rename from index.js rename to index.cjs index 787a020..b3fa5cb 100644 --- a/index.js +++ b/index.cjs @@ -35,7 +35,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.android-arm64.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.android-arm64.node') + nativeBinding = require(new URL('smb-js.android-arm64.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-android-arm64') } @@ -47,7 +47,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.android-arm-eabi.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.android-arm-eabi.node') + nativeBinding = require(new URL('smb-js.android-arm-eabi.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-android-arm-eabi') } @@ -65,7 +65,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.win32-x64-msvc.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.win32-x64-msvc.node') + nativeBinding = require(new URL('smb-js.win32-x64-msvc.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-win32-x64-msvc') } @@ -77,7 +77,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.win32-ia32-msvc.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.win32-ia32-msvc.node') + nativeBinding = require(new URL('smb-js.win32-ia32-msvc.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-win32-ia32-msvc') } @@ -89,7 +89,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.win32-arm64-msvc.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.win32-arm64-msvc.node') + nativeBinding = require(new URL('smb-js.win32-arm64-msvc.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-win32-arm64-msvc') } @@ -102,10 +102,8 @@ switch (platform) { } break case 'darwin': - localFileExisted = existsSync(new URL('smb-js.darwin-universal.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.darwin-universal.node') } else { nativeBinding = require('@netapplabs/smb-js-darwin-universal') } @@ -116,7 +114,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.darwin-x64.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.darwin-x64.node') + nativeBinding = require(new URL('smb-js.darwin-x64.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-darwin-x64') } @@ -128,7 +126,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.darwin-arm64.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.darwin-arm64.node') + nativeBinding = require(new URL('smb-js.darwin-arm64.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-darwin-arm64') } @@ -147,7 +145,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.freebsd-x64.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.freebsd-x64.node') + nativeBinding = require(new URL('smb-js.freebsd-x64.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-freebsd-x64') } @@ -162,7 +160,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.linux-x64-musl.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.linux-x64-musl.node') + nativeBinding = require(new URL('smb-js.linux-x64-musl.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-linux-x64-musl') } @@ -173,7 +171,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.linux-x64-gnu.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.linux-x64-gnu.node') + nativeBinding = require(new URL('smb-js.linux-x64-gnu.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-linux-x64-gnu') } @@ -187,7 +185,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.linux-arm64-musl.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.linux-arm64-musl.node') + nativeBinding = require(new URL('smb-js.linux-arm64-musl.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-linux-arm64-musl') } @@ -198,7 +196,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.linux-arm64-gnu.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.linux-arm64-gnu.node') + nativeBinding = require(new URL('smb-js.linux-arm64-gnu.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-linux-arm64-gnu') } @@ -212,7 +210,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.linux-arm-musleabihf.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.linux-arm-musleabihf.node') + nativeBinding = require(new URL('smb-js.linux-arm-musleabihf.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-linux-arm-musleabihf') } @@ -223,7 +221,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.linux-arm-gnueabihf.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.linux-arm-gnueabihf.node') + nativeBinding = require(new URL('smb-js.linux-arm-gnueabihf.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-linux-arm-gnueabihf') } @@ -237,7 +235,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.linux-riscv64-musl.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.linux-riscv64-musl.node') + nativeBinding = require(new URL('smb-js.linux-riscv64-musl.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-linux-riscv64-musl') } @@ -248,7 +246,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.linux-riscv64-gnu.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.linux-riscv64-gnu.node') + nativeBinding = require(new URL('smb-js.linux-riscv64-gnu.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-linux-riscv64-gnu') } @@ -261,7 +259,7 @@ switch (platform) { localFileExisted = existsSync(new URL('smb-js.linux-s390x-gnu.node', import.meta.url)) try { if (localFileExisted) { - nativeBinding = require('./smb-js.linux-s390x-gnu.node') + nativeBinding = require(new URL('smb-js.linux-s390x-gnu.node', import.meta.url).pathname) } else { nativeBinding = require('@netapplabs/smb-js-linux-s390x-gnu') } @@ -284,7 +282,7 @@ if (!nativeBinding) { throw new Error(`Failed to load native binding`) } -const { +export const { JsSmbDirectoryHandleEntries, JsSmbDirectoryHandleKeys, JsSmbDirectoryHandleValues, @@ -298,14 +296,3 @@ const { JsSmbWritableStreamSink, } = nativeBinding -module.exports.JsSmbDirectoryHandleEntries = JsSmbDirectoryHandleEntries -module.exports.JsSmbDirectoryHandleKeys = JsSmbDirectoryHandleKeys -module.exports.JsSmbDirectoryHandleValues = JsSmbDirectoryHandleValues -module.exports.JsSmbHandle = JsSmbHandle -module.exports.JsSmbDirectoryHandle = JsSmbDirectoryHandle -module.exports.Cancellable = Cancellable -module.exports.JsSmbFileHandle = JsSmbFileHandle -module.exports.JsSmbFile = JsSmbFile -module.exports.JsSmbReadableStreamSource = JsSmbReadableStreamSource -module.exports.JsSmbWritableFileStream = JsSmbWritableFileStream -module.exports.JsSmbWritableStreamSink = JsSmbWritableStreamSink diff --git a/package.json b/package.json index b2ad0fd..64afa26 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "@netapplabs/smb-js", "version": "0.9.2", + "type": "commonjs", "description": "smb js", - "main": "indax.js", + "main": "indax.cjs", "repository": "git@github.com:NetAppLabs/smb-js.git", "license": "Apache-2.0", "keywords": [ @@ -16,7 +17,7 @@ "files": [ "indax.ts", "index.d.ts", - "index.js", + "index.cjs", "*.node", "lib" ], diff --git a/tsconfig.json b/tsconfig.json index 94bdffd..c975f01 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ES2020", + "target": "esnext", "strict": true, "strictPropertyInitialization": false, "moduleResolution": "node",