migrate to "export default"

also, set no-use-before-define in linter
This commit is contained in:
Girish Ramakrishnan
2026-02-14 15:43:24 +01:00
parent ddb46646fa
commit 36aa641cb9
231 changed files with 2846 additions and 2728 deletions
+26 -26
View File
@@ -2,42 +2,18 @@ import assert from 'node:assert';
import BoxError from '../boxerror.js';
import crypto from 'crypto';
import debugModule from 'debug';
import * as df from '../df.js';
import df from '../df.js';
import fs from 'node:fs';
import mounts from '../mounts.js';
import path from 'node:path';
import paths from '../paths.js';
import safe from 'safetydance';
import shellModule from '../shell.js';
import * as _ from '../underscore.js';
import _ from '../underscore.js';
const debug = debugModule('box:storage/filesystem');
const shell = shellModule('filesystem');
export {
setup,
teardown,
cleanup,
verifyConfig,
removePrivateFields,
injectPrivateFields,
getAvailableSize,
getStatus,
upload,
download,
copy,
copyDir,
exists,
listDir,
remove,
removeDir,
};
function getRootPath(config) {
assert.strictEqual(typeof config, 'object');
@@ -442,3 +418,27 @@ function injectPrivateFields(newConfig, currentConfig) {
if (currentConfig._managedMountPath) newConfig._managedMountPath = currentConfig._managedMountPath;
}
export default {
setup,
teardown,
cleanup,
verifyConfig,
removePrivateFields,
injectPrivateFields,
getAvailableSize,
getStatus,
upload,
download,
copy,
copyDir,
exists,
listDir,
remove,
removeDir,
};
+25 -25
View File
@@ -6,34 +6,10 @@ import debugModule from 'debug';
import { Storage as GCS } from '@google-cloud/storage';
import path from 'node:path';
import safe from 'safetydance';
import * as _ from '../underscore.js';
import _ from '../underscore.js';
const debug = debugModule('box:storage/gcs');
export {
getAvailableSize,
getStatus,
upload,
exists,
download,
copy,
copyDir,
listDir,
remove,
removeDir,
setup,
teardown,
cleanup,
verifyConfig,
removePrivateFields,
injectPrivateFields,
};
function getBucket(config) {
assert.strictEqual(typeof config, 'object');
@@ -284,3 +260,27 @@ function injectPrivateFields(newConfig, currentConfig) {
if (!Object.hasOwn(newConfig.credentials, 'private_key') && currentConfig.credentials) newConfig.credentials.private_key = currentConfig.credentials.private_key;
}
export default {
getAvailableSize,
getStatus,
upload,
exists,
download,
copy,
copyDir,
listDir,
remove,
removeDir,
setup,
teardown,
cleanup,
verifyConfig,
removePrivateFields,
injectPrivateFields,
};
+26 -25
View File
@@ -11,31 +11,6 @@ import BoxError from '../boxerror.js';
// retry logic for upload() comes from the syncer since it is stream based
// for the other API calls we leave it to the backend to retry. this allows
// them to tune the concurrency based on failures/rate limits accordingly
export {
getAvailableSize,
getStatus,
upload,
exists,
download,
copy,
copyDir,
listDir,
remove,
removeDir,
setup,
teardown,
cleanup,
verifyConfig,
removePrivateFields,
injectPrivateFields
};
function removePrivateFields(config) {
// in-place removal of tokens and api keys
@@ -166,3 +141,29 @@ async function teardown(config) {
throw new BoxError(BoxError.NOT_IMPLEMENTED, 'teardown is not implemented');
}
export default {
getAvailableSize,
getStatus,
upload,
exists,
download,
copy,
copyDir,
listDir,
remove,
removeDir,
setup,
teardown,
cleanup,
verifyConfig,
removePrivateFields,
injectPrivateFields
};
+20 -20
View File
@@ -15,31 +15,12 @@ import { Readable } from 'node:stream';
import { S3, NoSuchKey, NoSuchBucket } from '@aws-sdk/client-s3';
import safe from 'safetydance';
import { Upload } from '@aws-sdk/lib-storage';
import * as _ from '../underscore.js';
import _ from '../underscore.js';
const debug = debugModule('box:storage/s3');
const _chunk = chunk;
export {
setup,
teardown,
cleanup,
verifyConfig,
removePrivateFields,
injectPrivateFields,
getAvailableSize,
getStatus,
upload,
exists,
download,
copy,
copyDir,
listDir,
remove,
removeDir,
_chunk,
};
function S3_NOT_FOUND(error) {
return error instanceof NoSuchKey || error instanceof NoSuchBucket;
@@ -691,3 +672,22 @@ function injectPrivateFields(newConfig, currentConfig) {
newConfig._provider = currentConfig._provider;
}
export default {
setup,
teardown,
cleanup,
verifyConfig,
removePrivateFields,
injectPrivateFields,
getAvailableSize,
getStatus,
upload,
exists,
download,
copy,
copyDir,
listDir,
remove,
removeDir,
_chunk,
};