Set up vs project

This commit is contained in:
Daniel Imms
2024-07-09 10:52:09 -07:00
parent 190e1f014e
commit c30bffc60c
15 changed files with 380 additions and 16 deletions
+4 -2
View File
@@ -11,7 +11,8 @@
],
"baseUrl": "..",
"paths": {
"common/*": [ "./common/*" ]
"common/*": [ "./common/*" ],
"vs/*": [ "./vs/*" ]
}
},
"include": [
@@ -19,6 +20,7 @@
"../../typings/xterm.d.ts"
],
"references": [
{ "path": "../common" }
{ "path": "../common" },
{ "path": "../vs" }
]
}
+7 -1
View File
@@ -9,10 +9,16 @@
"types": [
"../../node_modules/@types/mocha"
],
"baseUrl": ".."
"baseUrl": "..",
"paths": {
"vs/*": [ "./vs/*" ]
}
},
"include": [
"./**/*",
"../../typings/xterm.d.ts"
],
"references": [
{ "path": "../vs" }
]
}
+9
View File
@@ -0,0 +1,9 @@
This folder contains the `base/` module from the [Visual Studio Code repository](https://github.com/microsoft/vscode) which has many helpers that are useful to xterm.js.
To update against upstream:
```
./bin/update_vs_base.ps1
```
TODO: Mention review `src/vs/base` in xterm.js
+90
View File
@@ -0,0 +1,90 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export interface ILocalizeInfo {
key: string;
comment: string[];
}
export function localize(info: ILocalizeInfo | string, message: string, ...args: (string | number | boolean | undefined | null)[]): string {
return message;
}
export interface INLSLanguagePackConfiguration {
/**
* The path to the translations config file that contains pointers to
* all message bundles for `main` and extensions.
*/
readonly translationsConfigFile: string;
/**
* The path to the file containing the translations for this language
* pack as flat string array.
*/
readonly messagesFile: string;
/**
* The path to the file that can be used to signal a corrupt language
* pack, for example when reading the `messagesFile` fails. This will
* instruct the application to re-create the cache on next startup.
*/
readonly corruptMarkerFile: string;
}
export interface INLSConfiguration {
/**
* Locale as defined in `argv.json` or `app.getLocale()`.
*/
readonly userLocale: string;
/**
* Locale as defined by the OS (e.g. `app.getPreferredSystemLanguages()`).
*/
readonly osLocale: string;
/**
* The actual language of the UI that ends up being used considering `userLocale`
* and `osLocale`.
*/
readonly resolvedLanguage: string;
/**
* Defined if a language pack is used that is not the
* default english language pack. This requires a language
* pack to be installed as extension.
*/
readonly languagePack?: INLSLanguagePackConfiguration;
/**
* The path to the file containing the default english messages
* as flat string array. The file is only present in built
* versions of the application.
*/
readonly defaultMessagesFile: string;
/**
* Below properties are deprecated and only there to continue support
* for `vscode-nls` module that depends on them.
* Refs https://github.com/microsoft/vscode-nls/blob/main/src/node/main.ts#L36-L46
*/
/** @deprecated */
readonly locale: string;
/** @deprecated */
readonly availableLanguages: Record<string, string>;
/** @deprecated */
readonly _languagePackSupport?: boolean;
/** @deprecated */
readonly _languagePackId?: string;
/** @deprecated */
readonly _translationsConfigFile?: string;
/** @deprecated */
readonly _cacheRoot?: string;
/** @deprecated */
readonly _resolvedLanguagePackCoreLocation?: string;
/** @deprecated */
readonly _corruptedFile?: string;
}
+71
View File
@@ -0,0 +1,71 @@
{
"extends": "../tsconfig-library-base",
"compilerOptions": {
"experimentalDecorators": true,
"noImplicitReturns": true,
"noImplicitOverride": true,
"noUnusedLocals": true,
"allowUnreachableCode": false,
"strict": true,
"exactOptionalPropertyTypes": false,
"useUnknownInCatchVariables": false,
"forceConsistentCasingInFileNames": true,
"paths": {
"vs/*": [
"./vs/*"
],
"vs/nls": [
"./vs/patches/nls"
]
},
"target": "es2022",
"useDefineForClassFields": false,
"lib": [
"ES2022",
"DOM",
"DOM.Iterable",
"WebWorker.ImportScripts"
],
"esModuleInterop": true,
"removeComments": false,
"preserveConstEnums": true,
"sourceMap": false,
"allowJs": true,
"resolveJsonModule": true,
"isolatedModules": true,
"types": [
"semver",
"trusted-types",
],
"composite": true,
"outDir": "../../out",
"baseUrl": "../",
},
"include": [
"./base/**/*",
"./patches/**/*",
"./typings/**/*",
],
"exclude": [
// Update repo folder
"temp/",
// Unwanted layers/modules
"**/electron-main",
"**/electron-sandbox",
"**/node",
"**/test",
"**/sandbox",
"**/worker",
// Problematic files
"base/common/amd.ts",
"base/browser/defaultWorkerFactory.ts",
"base/common/jsonc.js",
"base/common/performance.js",
"base/common/marked/marked.js",
"base/common/network.js",
"typings/vscode-globals-modules.d.ts"
]
}
+20
View File
@@ -0,0 +1,20 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Declare types that we probe for to implement util and/or polyfill functions
declare global {
interface IdleDeadline {
readonly didTimeout: boolean;
timeRemaining(): number;
}
function requestIdleCallback(callback: (args: IdleDeadline) => void, options?: { timeout: number }): number;
function cancelIdleCallback(handle: number): void;
}
export { }
+42
View File
@@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare class LoaderEvent {
readonly type: number;
readonly timestamp: number;
readonly detail: string;
}
declare const define: {
(moduleName: string, dependencies: string[], callback: (...args: any[]) => any): any;
(moduleName: string, dependencies: string[], definition: any): any;
(moduleName: string, callback: (...args: any[]) => any): any;
(moduleName: string, definition: any): any;
(dependencies: string[], callback: (...args: any[]) => any): any;
(dependencies: string[], definition: any): any;
};
interface NodeRequire {
/**
* @deprecated use `FileAccess.asFileUri()` for node.js contexts or `FileAccess.asBrowserUri` for browser contexts.
*/
toUrl(path: string): string;
/**
* @deprecated MUST not be used anymore
*
* With the move from AMD to ESM we cannot use this anymore. There will be NO MORE node require like this.
*/
__$__nodeRequire<T>(moduleName: string): T;
(dependencies: string[], callback: (...args: any[]) => any, errorback?: (err: any) => void): any;
config(data: any): any;
onError: Function;
getStats?(): ReadonlyArray<LoaderEvent>;
hasDependencyCycle?(): boolean;
define(amdModuleId: string, dependencies: string[], callback: (...args: any[]) => any): any;
}
declare var require: NodeRequire;
+12
View File
@@ -0,0 +1,12 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
* and others. This API makes no assumption about what promise library is being used which
* enables reusing existing code without migrating to a specific promise implementation. Still,
* we recommend the use of native promises which are available in VS Code.
*/
interface Thenable<T> extends PromiseLike<T> { }
+36
View File
@@ -0,0 +1,36 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// AMD2ESM mirgation relevant
/**
* NLS Globals: these need to be defined in all contexts that make
* use of our `nls.localize` and `nls.localize2` functions. This includes:
* - Electron main process
* - Electron window (renderer) process
* - Utility Process
* - Node.js
* - Browser
* - Web worker
*
* That is because during build time we strip out all english strings from
* the resulting JS code and replace it with a <number> that is then looked
* up from the `_VSCODE_NLS_MESSAGES` array.
*/
declare global {
/**
* All NLS messages produced by `localize` and `localize2` calls
* under `src/vs` translated to the language as indicated by
* `_VSCODE_NLS_LANGUAGE`.
*/
var _VSCODE_NLS_MESSAGES: string[];
/**
* The actual language of the NLS messages (e.g. 'en', de' or 'pt-br').
*/
var _VSCODE_NLS_LANGUAGE: string | undefined;
}
// fake export to make global work
export { }
+33
View File
@@ -0,0 +1,33 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// AMD2ESM mirgation relevant
declare global {
/**
* Holds the file root for resources.
*/
var _VSCODE_FILE_ROOT: string;
/**
* CSS loader that's available during development time.
* DO NOT call directly, instead just import css modules, like `import 'some.css'`
*/
var _VSCODE_CSS_LOAD: (module: string) => void;
/**
* @deprecated You MUST use `IProductService` whenever possible.
*/
var _VSCODE_PRODUCT_JSON: Record<string, any>;
/**
* @deprecated You MUST use `IProductService` whenever possible.
*/
var _VSCODE_PACKAGE_JSON: Record<string, any>;
}
// fake export to make global work
export { }