mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Set up vs project
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
},
|
||||
"ignorePatterns": [
|
||||
"addons/*/src/third-party/*.ts",
|
||||
"src/vs/*",
|
||||
"out/*",
|
||||
"out-test/*",
|
||||
"out-esbuild/*",
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ const devOptions = {
|
||||
const prodOptions = {
|
||||
minify: true,
|
||||
treeShaking: true,
|
||||
logLevel: 'debug',
|
||||
logLevel: 'verbose',
|
||||
legalComments: 'none',
|
||||
// TODO: Mangling private and protected properties will reduce bundle size quite a bit, we must
|
||||
// make sure we don't cast privates to `any` in order to prevent regressions.
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# Get latest vscode repo
|
||||
if (Test-Path -Path "src/vs/temp") {
|
||||
Write-Host "`e[32m> Fetching latest`e[0m"
|
||||
git -C src/vs/temp checkout
|
||||
git -C src/vs/temp pull
|
||||
} else {
|
||||
Write-Host "`e[32m> Cloning microsoft/vscode`e[0m"
|
||||
$null = New-Item -ItemType Directory -Path "src/vs/temp" -Force
|
||||
git clone https://github.com/microsoft/vscode src/vs/temp
|
||||
}
|
||||
|
||||
# Delete old base
|
||||
Write-Host "`e[32m> Deleting old base`e[0m"
|
||||
$null = Remove-Item -Recurse -Force "src/vs/base"
|
||||
|
||||
# Copy base
|
||||
Write-Host "`e[32m> Copying base`e[0m"
|
||||
Copy-Item -Path "src/vs/temp/src/vs/base" -Destination "src/vs/base" -Recurse
|
||||
|
||||
# Comment out any CSS imports
|
||||
Write-Host "`e[32m> Commenting out CSS imports`e[0m" -NoNewline
|
||||
$baseFiles = Get-ChildItem -Path "src/vs/base" -Recurse -File
|
||||
$count = 0
|
||||
foreach ($file in $baseFiles) {
|
||||
$content = Get-Content -Path $file.FullName
|
||||
$updatedContent = $content | ForEach-Object {
|
||||
if ($_ -match "^import 'vs/css!") {
|
||||
Write-Host "`e[32m." -NoNewline
|
||||
$count++
|
||||
"// $_"
|
||||
} else {
|
||||
$_
|
||||
}
|
||||
}
|
||||
$updatedContent | Set-Content -Path $file.FullName
|
||||
}
|
||||
Write-Host " $count files patched"
|
||||
|
||||
# Copy typings
|
||||
Write-Host "`e[32m> Copying typings`e[0m"
|
||||
Copy-Item -Path "src/vs/temp/src/typings" -Destination "src/vs" -Recurse -Force
|
||||
|
||||
# Deleting unwanted typings
|
||||
Write-Host "`e[32m> Deleting unwanted typings`e[0m"
|
||||
$null = Remove-Item -Path "src/vs/typings/vscode-globals-modules.d.ts" -Force
|
||||
+3
-11
@@ -27,15 +27,12 @@
|
||||
"setup": "npm run build",
|
||||
"presetup": "npm run install-addons",
|
||||
"install-addons": "node ./bin/install-addons.js",
|
||||
|
||||
"start": "node demo/start",
|
||||
"build-demo": "webpack --config ./demo/webpack.config.js",
|
||||
|
||||
"build": "npm run tsc",
|
||||
"watch": "npm run tsc-watch",
|
||||
"tsc": "tsc -b ./tsconfig.all.json",
|
||||
"tsc-watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput",
|
||||
|
||||
"esbuild": "node bin/esbuild_all.mjs",
|
||||
"esbuild-watch": "node bin/esbuild_all.mjs --watch",
|
||||
"esbuild-package": "node bin/esbuild_all.mjs --prod",
|
||||
@@ -43,33 +40,26 @@
|
||||
"esbuild-package-headless-only": "node bin/esbuild.mjs --prod --headless",
|
||||
"esbuild-demo": "node bin/esbuild.mjs --demo-client",
|
||||
"esbuild-demo-watch": "node bin/esbuild.mjs --demo-client --watch",
|
||||
|
||||
"test": "npm run test-unit",
|
||||
"posttest": "npm run lint",
|
||||
|
||||
"lint": "eslint -c .eslintrc.json --max-warnings 0 --ext .ts src/ addons/",
|
||||
"lint-api": "eslint --no-eslintrc -c .eslintrc.json.typings --max-warnings 0 --no-ignore --ext .d.ts typings/",
|
||||
|
||||
"test-unit": "node ./bin/test_unit.js",
|
||||
"test-unit-coverage": "node ./bin/test_unit.js --coverage",
|
||||
"test-unit-dev": "cross-env NODE_PATH='./out' mocha",
|
||||
|
||||
"test-integration": "node ./bin/test_integration.js --workers=75%",
|
||||
"test-integration-chromium": "node ./bin/test_integration.js --workers=75% \"--project=ChromeStable\"",
|
||||
"test-integration-firefox": "node ./bin/test_integration.js --workers=75% \"--project=FirefoxStable\"",
|
||||
"test-integration-webkit": "node ./bin/test_integration.js --workers=75% \"--project=WebKit\"",
|
||||
"test-integration-debug": "node ./bin/test_integration.js --workers=1 --headed --timeout=30000",
|
||||
|
||||
"benchmark": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json",
|
||||
"benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --baseline out-tsc/test-benchmark/test/benchmark/*benchmark.js",
|
||||
"benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --eval out-tsc/test-benchmark/test/benchmark/*benchmark.js",
|
||||
|
||||
"clean": "rm -rf lib out addons/*/lib addons/*/out",
|
||||
"vtfeatures": "node bin/extract_vtfeatures.js src/**/*.ts src/*.ts",
|
||||
|
||||
"prepackage": "npm run build",
|
||||
"package": "webpack",
|
||||
"postpackage":"npm run esbuild-package",
|
||||
"postpackage": "npm run esbuild-package",
|
||||
"prepackage-headless": "npm run esbuild-package-headless-only",
|
||||
"package-headless": "webpack --config ./webpack.config.headless.js",
|
||||
"postpackage-headless": "node ./bin/package_headless.js",
|
||||
@@ -88,6 +78,7 @@
|
||||
"@types/jsdom": "^16.2.13",
|
||||
"@types/mocha": "^9.0.0",
|
||||
"@types/node": "^18.16.0",
|
||||
"@types/trusted-types": "^1.0.6",
|
||||
"@types/utf8": "^3.0.0",
|
||||
"@types/webpack": "^5.28.0",
|
||||
"@types/ws": "^8.2.0",
|
||||
@@ -107,6 +98,7 @@
|
||||
"mustache": "^4.2.0",
|
||||
"node-pty": "1.1.0-beta5",
|
||||
"nyc": "^15.1.0",
|
||||
"semver": "^7.6.2",
|
||||
"source-map-loader": "^3.0.0",
|
||||
"source-map-support": "^0.5.20",
|
||||
"ts-loader": "^9.3.1",
|
||||
|
||||
@@ -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" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -9,10 +9,16 @@
|
||||
"types": [
|
||||
"../../node_modules/@types/mocha"
|
||||
],
|
||||
"baseUrl": ".."
|
||||
"baseUrl": "..",
|
||||
"paths": {
|
||||
"vs/*": [ "./vs/*" ]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./**/*",
|
||||
"../../typings/xterm.d.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../vs" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
Vendored
+20
@@ -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 { }
|
||||
Vendored
+42
@@ -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;
|
||||
Vendored
+12
@@ -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
@@ -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
@@ -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 { }
|
||||
@@ -830,6 +830,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.2.tgz#6286b4c7228d58ab7866d19716f3696e03a09397"
|
||||
integrity sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==
|
||||
|
||||
"@types/trusted-types@^1.0.6":
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-1.0.6.tgz#569b8a08121d3203398290d602d84d73c8dcf5da"
|
||||
integrity sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw==
|
||||
|
||||
"@types/utf8@^3.0.0":
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/utf8/-/utf8-3.0.1.tgz#bf081663d4fff05ee63b41f377a35f8b189f7e5b"
|
||||
@@ -3672,7 +3677,7 @@ semver@^7.3.4, semver@^7.5.3, semver@^7.5.4:
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
semver@^7.6.0:
|
||||
semver@^7.6.0, semver@^7.6.2:
|
||||
version "7.6.2"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13"
|
||||
integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==
|
||||
|
||||
Reference in New Issue
Block a user