-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(storage): add node storage for memfs
- Loading branch information
Showing
9 changed files
with
362 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import vscode, { UIKind } from 'vscode'; | ||
|
||
export const EXTENSION_NAME = 'js-runner-and-debugger'; | ||
export const EXTENSION_NAME_SHORT = 'JSRunner'; | ||
export const FS_SCHEME = 'memfs'; | ||
export const LOGGER_LEVEL = 0; // LogLevel.DEBUG | ||
export const isWebEnv = vscode.env.uiKind === UIKind.Web; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/extensions/js-runner-and-debugger/src/web/utils/decorator/auto-init-class.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { logger } from '../logger'; | ||
|
||
export function autoInit( | ||
target: any, | ||
propertyKey: string, | ||
descriptor: PropertyDescriptor | ||
) { | ||
const originalMethod = descriptor.value; | ||
|
||
descriptor.value = function (...args: any[]) { | ||
const _that = this as AutoInitClass; | ||
if (!_that['_initPromise']) { | ||
_that['_initPromise'] = _that['_init'](); | ||
} | ||
return _that['_initPromise'] | ||
.then(() => originalMethod.apply(this, args)) | ||
.catch((err: Error) => { | ||
logger.debug( | ||
`${target.constructor.name}.${propertyKey} @autoInit failed:`, | ||
err | ||
); | ||
throw err; | ||
}); | ||
}; | ||
|
||
return descriptor; | ||
} | ||
|
||
export abstract class AutoInitClass { | ||
protected abstract _init: () => Promise<void>; | ||
protected _initPromise?: Promise<void>; | ||
} |
Oops, something went wrong.