Skip to content

Commit

Permalink
Added default credentials
Browse files Browse the repository at this point in the history
Removed unused/uneeded `process` code
Removed unused dependencies
  • Loading branch information
james-pre committed Oct 12, 2023
1 parent 6b799e7 commit f63cbaa
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 157 deletions.
141 changes: 0 additions & 141 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
1 change: 0 additions & 1 deletion scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 2 additions & 5 deletions src/backends/SyncStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/emulation/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 0 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 && (<any>process)['initializeTTYs']) {
(<any>process)['initializeTTYs']();
}

/**
* Initializes BrowserFS with the given file systems.
*/
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"module": "ES2015",
"module": "NodeNext",
"target": "ES2015",
"outDir": "dist",
"lib": ["ESNext"],
Expand Down

0 comments on commit f63cbaa

Please sign in to comment.