diff --git a/package-lock.json b/package-lock.json index a00755abf..a10212eb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,8 +16,6 @@ "@typescript-eslint/eslint-plugin": "^5.55.0", "@typescript-eslint/parser": "^5.55.0", "archiver": "~2.1.1", - "bfs-path": "~0.1.2", - "bfs-process": "~0.1.6", "buffer": "~5.1.0", "cross-env": "^7.0.3", "esbuild": "^0.17.18", @@ -26,7 +24,6 @@ "jest": "^29.5.0", "path": "^0.12.7", "prettier": "^2.8.7", - "source-map-loader": "~0.2.3", "ts-jest": "^29.1.0", "typedoc": "^0.25.1", "typescript": "^4.9.5" @@ -2850,27 +2847,6 @@ } ] }, - "node_modules/bfs-path": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/bfs-path/-/bfs-path-0.1.2.tgz", - "integrity": "sha512-DyJ1+YW6qdqeFqgWmqakEERjWBSoBDNR1p5CpASS7c+uhBmKUbJEf6z+ybW7LS2H2ylMU+wET9NRrD9QBfXLHA==", - "dev": true - }, - "node_modules/bfs-process": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/bfs-process/-/bfs-process-0.1.6.tgz", - "integrity": "sha512-vLqa9lIyzM/XhiMi1roZOu+/gMA5IY43xnUxyoFiwhB1kXPZAegsY7lcAXCD68lS6KbofWNX/sW+9N5wZ+5Www==", - "dev": true - }, - "node_modules/big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/bl": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", @@ -3429,15 +3405,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "node_modules/emojis-list": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", - "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, "node_modules/end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -6418,18 +6385,6 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, - "node_modules/json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", - "dev": true, - "dependencies": { - "minimist": "^1.2.0" - }, - "bin": { - "json5": "lib/cli.js" - } - }, "node_modules/jsonc-parser": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", @@ -6496,20 +6451,6 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, - "node_modules/loader-utils": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.2.tgz", - "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==", - "dev": true, - "dependencies": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^1.0.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -6664,15 +6605,6 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -7127,19 +7059,6 @@ "node": ">=0.10.0" } }, - "node_modules/source-map-loader": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-0.2.4.tgz", - "integrity": "sha512-OU6UJUty+i2JDpTItnizPrlpOIBLmQbWMuBg9q5bVtnHACqw1tn9nNwqJLbv0/00JjnJb/Ee5g5WS5vrRv7zIQ==", - "dev": true, - "dependencies": { - "async": "^2.5.0", - "loader-utils": "^1.1.0" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/source-map-support": { "version": "0.5.13", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", @@ -9782,24 +9701,6 @@ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "dev": true }, - "bfs-path": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/bfs-path/-/bfs-path-0.1.2.tgz", - "integrity": "sha512-DyJ1+YW6qdqeFqgWmqakEERjWBSoBDNR1p5CpASS7c+uhBmKUbJEf6z+ybW7LS2H2ylMU+wET9NRrD9QBfXLHA==", - "dev": true - }, - "bfs-process": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/bfs-process/-/bfs-process-0.1.6.tgz", - "integrity": "sha512-vLqa9lIyzM/XhiMi1roZOu+/gMA5IY43xnUxyoFiwhB1kXPZAegsY7lcAXCD68lS6KbofWNX/sW+9N5wZ+5Www==", - "dev": true - }, - "big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", - "dev": true - }, "bl": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", @@ -10247,12 +10148,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "emojis-list": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", - "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", - "dev": true - }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -12460,15 +12355,6 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, - "json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - }, "jsonc-parser": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", @@ -12528,17 +12414,6 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, - "loader-utils": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.2.tgz", - "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==", - "dev": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^1.0.1" - } - }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -12664,12 +12539,6 @@ "brace-expansion": "^1.1.7" } }, - "minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true - }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -12992,16 +12861,6 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, - "source-map-loader": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-0.2.4.tgz", - "integrity": "sha512-OU6UJUty+i2JDpTItnizPrlpOIBLmQbWMuBg9q5bVtnHACqw1tn9nNwqJLbv0/00JjnJb/Ee5g5WS5vrRv7zIQ==", - "dev": true, - "requires": { - "async": "^2.5.0", - "loader-utils": "^1.1.0" - } - }, "source-map-support": { "version": "0.5.13", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", diff --git a/package.json b/package.json index 24ba10155..9666f7b99 100644 --- a/package.json +++ b/package.json @@ -57,8 +57,6 @@ "@typescript-eslint/eslint-plugin": "^5.55.0", "@typescript-eslint/parser": "^5.55.0", "archiver": "~2.1.1", - "bfs-path": "~0.1.2", - "bfs-process": "~0.1.6", "buffer": "~5.1.0", "cross-env": "^7.0.3", "esbuild": "^0.17.18", @@ -67,7 +65,6 @@ "jest": "^29.5.0", "path": "^0.12.7", "prettier": "^2.8.7", - "source-map-loader": "~0.2.3", "ts-jest": "^29.1.0", "typedoc": "^0.25.1", "typescript": "^4.9.5" diff --git a/scripts/build.mjs b/scripts/build.mjs index f3e740a51..59036cae3 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -21,7 +21,6 @@ const ctx = await context({ bundle: true, minify: true, platform: 'browser', - alias: { process: 'bfs-process', path: 'path' }, plugins: [polyfillNode(), { name: 'watcher', setup(build) { build.onStart(() => { if(!options.keep) { diff --git a/src/backends/SyncStore.ts b/src/backends/SyncStore.ts index 858c073ed..3c9fc4002 100644 --- a/src/backends/SyncStore.ts +++ b/src/backends/SyncStore.ts @@ -459,15 +459,12 @@ export class SyncKeyValueFileSystem extends SynchronousFileSystem { throw ApiError.ENOENT(path.resolve(parent, filename)); } }; - if (parent === '.') { - parent = process.cwd(); - } if (parent === '/') { if (filename === '') { - // BASE CASE #1: Return the root's ID. + // Return the root's ID. return ROOT_NODE_ID; } else { - // BASE CASE #2: Find the item in the root node. + // Find the item in the root node. return readDirectory(this.getINode(tx, parent, ROOT_NODE_ID)); } } else { diff --git a/src/emulation/shared.ts b/src/emulation/shared.ts index 99b1b7d23..2b1b36f78 100644 --- a/src/emulation/shared.ts +++ b/src/emulation/shared.ts @@ -97,7 +97,7 @@ export function nop() { } // credentials -export let cred: Cred; +export let cred: Cred = Cred.Root; export function setCred(val: Cred): void { cred = val; } diff --git a/src/index.ts b/src/index.ts index 10ca950f2..128895c48 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,14 +7,9 @@ import { FileSystem, type BFSOneArgCallback, type BFSCallback } from './filesyst import { backends } from './backends/index.js'; import { ErrorCode, ApiError } from './ApiError.js'; import { Cred } from './cred.js'; -import * as process from 'process'; import type { BackendConstructor } from './backends/backend.js'; import { type MountMapping, setCred } from './emulation/shared.js'; -if (process && (process)['initializeTTYs']) { - (process)['initializeTTYs'](); -} - /** * Initializes BrowserFS with the given file systems. */ diff --git a/tsconfig.json b/tsconfig.json index 0cb41a3f0..a0b468d9e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "ES2015", + "module": "NodeNext", "target": "ES2015", "outDir": "dist", "lib": ["ESNext"],