refactor: update yarn workspace struct and build scripts. (#288)

* refactor: update yarn workspace struct and build scripts.

* fix: vim upgrade agent script.
sweep/improve-logging-information
Zhiming Ma 2023-07-11 14:02:58 +08:00 committed by GitHub
parent 7ca416aa13
commit 5a5d6ee9d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 1715 additions and 50939 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/target
node_modules

View File

@ -1,2 +1,3 @@
node_modules
generated
dist

View File

@ -0,0 +1,2 @@
node_modules
generated

View File

@ -0,0 +1,3 @@
{
"printWidth": 120
}

View File

@ -1,7 +0,0 @@
.PHONY: openapi-codegen
openapi-codegen:
yarn run openapi-codegen
.PHONY: build
build: openapi-codegen
yarn run build

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,189 +0,0 @@
import { EventEmitter } from 'events';
interface OnCancel {
readonly isResolved: boolean;
readonly isRejected: boolean;
readonly isCancelled: boolean;
(cancelHandler: () => void): void;
}
declare class CancelablePromise<T> implements Promise<T> {
#private;
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
get [Symbol.toStringTag](): string;
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
finally(onFinally?: (() => void) | null): Promise<T>;
cancel(): void;
get isCancelled(): boolean;
}
type Choice = {
index: number;
text: string;
};
type CompletionResponse$1 = {
id: string;
choices: Array<Choice>;
};
type LogEventRequest$1 = {
/**
* Event type, should be `view` or `select`.
*/
type: string;
completion_id: string;
choice_index: number;
};
type AgentConfig = {
server: {
endpoint: string;
};
completion: {
maxPrefixLines: number;
maxSuffixLines: number;
};
logs: {
level: "debug" | "error" | "silent";
};
anonymousUsageTracking: {
disable: boolean;
};
};
type AgentInitOptions = {
config: Partial<AgentConfig>;
client: string;
};
type CompletionRequest = {
filepath: string;
language: string;
text: string;
position: number;
maxPrefixLines?: number;
maxSuffixLines?: number;
};
type CompletionResponse = CompletionResponse$1;
type LogEventRequest = LogEventRequest$1;
type AgentStatus = "notInitialized" | "ready" | "disconnected" | "unauthorized";
interface AgentFunction {
initialize(options: Partial<AgentInitOptions>): Promise<boolean>;
updateConfig(config: Partial<AgentConfig>): Promise<boolean>;
/**
* @returns the current config
*
* Configuration precedence:
* 1. Default config
* 2. User config file `~/.tabby/agent/config.toml` (not available in browser)
* 3. Agent `initialize` and `updateConfig` methods
*/
getConfig(): AgentConfig;
/**
* @returns the current status
*/
getStatus(): AgentStatus;
/**
* @returns the auth url for redirecting, and the code for next step `waitingForAuth`, only return value when
* `AgentStatus` is `unauthorized`, return null otherwise
* @throws Error if agent is not initialized
*/
requestAuthUrl(): CancelablePromise<{
authUrl: string;
code: string;
} | null>;
/**
* Wait for auth token to be ready after redirecting user to auth url,
* returns nothing, but `AgentStatus` will change to `ready` if resolved successfully
* @param code from `requestAuthUrl`
* @throws Error if agent is not initialized
*/
waitForAuthToken(code: string): CancelablePromise<any>;
/**
* @param request
* @returns
* @throws Error if agent is not initialized
*/
getCompletions(request: CompletionRequest): CancelablePromise<CompletionResponse>;
/**
* @param event
* @returns
* @throws Error if agent is not initialized
*/
postEvent(event: LogEventRequest): CancelablePromise<boolean>;
}
type StatusChangedEvent = {
event: "statusChanged";
status: AgentStatus;
};
type ConfigUpdatedEvent = {
event: "configUpdated";
config: AgentConfig;
};
type AuthRequiredEvent = {
event: "authRequired";
server: AgentConfig["server"];
};
type AgentEvent = StatusChangedEvent | ConfigUpdatedEvent | AuthRequiredEvent;
declare const agentEventNames: AgentEvent["event"][];
interface AgentEventEmitter {
on<T extends AgentEvent>(eventName: T["event"], callback: (event: T) => void): this;
}
type Agent = AgentFunction & AgentEventEmitter;
type StoredData = {
anonymousId: string;
auth: {
[endpoint: string]: {
jwt: string;
};
};
};
interface DataStore {
data: Partial<StoredData>;
load(): PromiseLike<void>;
save(): PromiseLike<void>;
}
/**
* Different from AgentInitOptions or AgentConfig, this may contain non-serializable objects,
* so it is not suitable for cli, but only used when imported as module by other js project.
*/
type TabbyAgentOptions = {
dataStore: DataStore;
};
declare class TabbyAgent extends EventEmitter implements Agent {
private readonly logger;
private anonymousUsageLogger;
private config;
private userConfig;
private clientConfig;
private status;
private api;
private auth;
private dataStore;
private completionCache;
static readonly tryConnectInterval: number;
private tryingConnectTimer;
private constructor();
static create(options?: Partial<TabbyAgentOptions>): Promise<TabbyAgent>;
private applyConfig;
private setupApi;
private changeStatus;
private callApi;
private healthCheck;
private createSegments;
initialize(options: Partial<AgentInitOptions>): Promise<boolean>;
updateConfig(config: Partial<AgentConfig>): Promise<boolean>;
getConfig(): AgentConfig;
getStatus(): AgentStatus;
requestAuthUrl(): CancelablePromise<{
authUrl: string;
code: string;
} | null>;
waitForAuthToken(code: string): CancelablePromise<any>;
getCompletions(request: CompletionRequest): CancelablePromise<CompletionResponse>;
postEvent(request: LogEventRequest): CancelablePromise<boolean>;
}
export { Agent, AgentConfig, AgentEvent, AgentFunction, AgentStatus, CancelablePromise, CompletionRequest, CompletionResponse, ConfigUpdatedEvent, DataStore, LogEventRequest, StatusChangedEvent, TabbyAgent, TabbyAgentOptions, agentEventNames };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,236 @@
{
"openapi": "3.0.3",
"info": {
"title": "Tabby Server",
"description": "\n[![tabby stars](https://img.shields.io/github/stars/TabbyML/tabby?style=social)](https://github.com/TabbyML/tabby)\n\nOpenAPI documentation for [tabby](https://github.com/TabbyML/tabby), a self-hosted AI coding assistant.",
"license": {
"name": "Apache 2.0",
"url": "https://github.com/TabbyML/tabby/blob/main/LICENSE"
},
"version": "0.1.0"
},
"servers": [
{
"url": "https://playground.app.tabbyml.com",
"description": "Playground server"
},
{
"url": "http://localhost:8080",
"description": "Local server"
}
],
"paths": {
"/v1/completions": {
"post": {
"tags": [
"v1"
],
"operationId": "completion",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CompletionRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CompletionResponse"
}
}
}
},
"400": {
"description": "Bad Request"
}
}
}
},
"/v1/events": {
"post": {
"tags": [
"v1"
],
"operationId": "event",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LogEventRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Success"
},
"400": {
"description": "Bad Request"
}
}
}
},
"/v1/health": {
"post": {
"tags": [
"v1"
],
"operationId": "health",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HealthState"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Choice": {
"type": "object",
"required": [
"index",
"text"
],
"properties": {
"index": {
"type": "integer",
"format": "int32",
"minimum": 0
},
"text": {
"type": "string"
}
}
},
"CompletionRequest": {
"type": "object",
"properties": {
"prompt": {
"type": "string",
"example": "def fib(n):",
"nullable": true
},
"language": {
"type": "string",
"description": "Language identifier, full list is maintained at\nhttps://code.visualstudio.com/docs/languages/identifiers",
"example": "python",
"nullable": true
},
"segments": {
"allOf": [
{
"$ref": "#/components/schemas/Segments"
}
],
"nullable": true
},
"user": {
"type": "string",
"nullable": true
}
},
"example": {
"language": "python",
"segments": {
"prefix": "def fib(n):\n ",
"suffix": "\n return fib(n - 1) + fib(n - 2)"
}
}
},
"CompletionResponse": {
"type": "object",
"required": [
"id",
"choices"
],
"properties": {
"id": {
"type": "string"
},
"choices": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Choice"
}
}
}
},
"HealthState": {
"type": "object",
"required": [
"model",
"device",
"compute_type"
],
"properties": {
"model": {
"type": "string"
},
"device": {
"type": "string"
},
"compute_type": {
"type": "string"
}
}
},
"LogEventRequest": {
"type": "object",
"required": [
"type",
"completion_id",
"choice_index"
],
"properties": {
"type": {
"type": "string",
"description": "Event type, should be `view` or `select`.",
"example": "view"
},
"completion_id": {
"type": "string"
},
"choice_index": {
"type": "integer",
"format": "int32",
"minimum": 0
}
}
},
"Segments": {
"type": "object",
"required": [
"prefix"
],
"properties": {
"prefix": {
"type": "string",
"description": "Content that appears before the cursor in the editor window."
},
"suffix": {
"type": "string",
"description": "Content that appears after the cursor in the editor window.",
"nullable": true
}
}
}
}
}
}

View File

@ -3,15 +3,14 @@
"version": "0.0.1",
"description": "Generic client agent for Tabby AI coding assistant IDE extensions.",
"repository": "https://github.com/TabbyML/tabby",
"files": [
"dist"
],
"main": "./dist/index.js",
"browser": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"scripts": {
"openapi-codegen": "rimraf ./src/generated && openapi --input ../../website/static/openapi.json --output ./src/generated --client axios --name TabbyApi --indent 2",
"dev": "tsup --watch",
"openapi-codegen": "rimraf ./src/generated && openapi --input ./openapi/tabby.json --output ./src/generated --client axios --name TabbyApi --indent 2",
"predev": "yarn openapi-codegen",
"dev": "tsup --watch --no-minify --no-treeshake",
"prebuild": "yarn openapi-codegen",
"build": "tsup",
"test:watch": "mocha --watch",
"test": "mocha"
@ -23,12 +22,13 @@
"@types/node": "^16.18.32",
"chai": "^4.3.7",
"dedent": "^0.7.0",
"esbuild-plugin-polyfill-node": "^0.2.0",
"esbuild-plugin-polyfill-node": "^0.3.0",
"mocha": "^10.2.0",
"openapi-typescript-codegen": "^0.24.0",
"prettier": "^3.0.0",
"rimraf": "^5.0.1",
"ts-node": "^10.9.1",
"tsup": "^6.7.0",
"tsup": "^7.1.0",
"typescript": "^5.0.3"
},
"dependencies": {

View File

@ -47,8 +47,6 @@ export default async () => [
entry: ["src/index.ts"],
platform: "browser",
format: ["esm"],
// FIXME: bundle all dependencies to reduce module resolving problems, not a good solution
noExternal: Object.keys(dependencies),
treeshake: true,
sourcemap: true,
esbuildPlugins: [

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -4,11 +4,12 @@
"description": "Vim plugin for Tabby AI coding assistant.",
"repository": "https://github.com/TabbyML/tabby",
"scripts": {
"upgrade-agent": "yarn upgrade tabby-agent && rimraf ./node_scripts && cpy node_modules/tabby-agent/dist/cli.js ./node_scripts/ --flat --rename=tabby-agent.js"
"preupgrade-agent": "cd ../tabby-agent && yarn build",
"upgrade-agent": "rimraf ./node_scripts && cpy ../tabby-agent/dist/cli.js ./node_scripts/ --flat --rename=tabby-agent.js"
},
"devDependencies": {
"cpy-cli": "^4.2.0",
"rimraf": "^5.0.1",
"tabby-agent": "file:../tabby-agent"
"tabby-agent": "0.0.1"
}
}

View File

@ -14,5 +14,6 @@
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": ["out", "dist", "**/*.d.ts"]
"ignorePatterns": ["out", "dist", "**/*.d.ts"],
"extends": ["prettier"]
}

View File

@ -0,0 +1,3 @@
{
"printWidth": 120
}

View File

@ -1,5 +0,0 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
}

View File

@ -5,19 +5,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension without Local Extensions",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}", "--disable-extensions"],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--disable-extensions"
],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
@ -30,34 +25,10 @@
"vscode-test-web",
"--extensionDevelopmentPath=${workspaceFolder}",
"--browserType=chromium",
"--port=3000",
"--port=3000"
],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Run Web Extension in VS Code",
"type": "extensionHost",
"debugWebWorkerHost": true,
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionDevelopmentKind=web",
"--disable-extensions"
],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": ["${workspaceFolder}/out/**/*.js", "${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "tasks: watch-tests"
}
]
}

View File

@ -6,7 +6,34 @@
{
"type": "npm",
"script": "watch",
"problemMatcher": "$ts-webpack-watch",
"problemMatcher": [
{
"severity": "error",
"applyTo": "closedDocuments",
"source": "esbuild",
"fileLocation": "relative",
"owner": "typescript",
"pattern": [
{
"regexp": "^(.*?):([0-9]+):([0-9]+): (warning|error): (.+)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
],
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "^(.*?)Change detected:(.*)$"
},
"endsPattern": {
"regexp": "^(.*?)Build (failed|success)(.*)$"
}
}
}
],
"isBackground": true,
"presentation": {
"reveal": "never",
@ -16,22 +43,6 @@
"kind": "build",
"isDefault": true
}
},
{
"type": "npm",
"script": "watch-tests",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "watchers"
},
"group": "build"
},
{
"label": "tasks: watch-tests",
"dependsOn": ["npm: watch", "npm: watch-tests"],
"problemMatcher": []
}
]
}

View File

@ -12,14 +12,12 @@ Tabby VSCode extension is compatible with `VSCode ≥ 1.70.0`, as well as web en
For more information, please check out our [Website](https://tabbyml.com/) and [GitHub](https://github.com/TabbyML/tabby).
If you encounter any problem or have any suggestion, please [open an issue](https://github.com/TabbyML/tabby/issues/new)!
## Demo
Try our online demo [here](https://tabbyml.github.io/tabby/playground).
![Demo](https://tabbyml.github.io/tabby/img/demo.gif)
## Get Started
If you have installed the Tabby VSCode extension, you can follow the built-in walkthrough guides to get started. You can also reopen walkthrough page anytime by using command `Tabby: Getting Started`.

View File

@ -3,7 +3,9 @@
"publisher": "TabbyML",
"displayName": "Tabby",
"description": "Tabby is a self-hosted AI coding assistant that can suggest multi-line code or full functions in real-time.",
"homepage": "https://tabbyml.github.io/tabby",
"repository": "https://github.com/TabbyML/tabby",
"bugs": "https://github.com/TabbyML/tabby/issues",
"license": "Apache-2.0",
"version": "0.1.1",
"keywords": [
@ -128,19 +130,14 @@
}
},
"scripts": {
"vscode:prepublish": "yarn package",
"compile": "webpack",
"watch": "webpack --watch",
"build": "tsup --minify --treeshake smallest",
"watch": "tsup --sourcemap --watch ./ --watch ../tabby-agent/dist",
"dev": "code --extensionDevelopmentPath=$PWD --disable-extensions && yarn watch",
"dev:web": "code --extensionDevelopmentPath=$PWD --extensionDevelopmentKind=web --disable-extensions && yarn watch",
"dev:web-browser": "vscode-test-web --extensionDevelopmentPath=$PWD --browserType=chromium --port=3000 && yarn watch",
"package": "webpack --mode production --devtool hidden-source-map",
"compile-tests": "tsc -p . --outDir out",
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "yarn compile-tests && yarn compile && yarn lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"dev:browser": "vscode-test-web --extensionDevelopmentPath=$PWD --browserType=chromium --port=3000 && yarn watch",
"lint": "eslint . --fix",
"vscode:prepackage": "yarn build",
"vscode:package": "vsce package",
"vscode:prepublish": "yarn build",
"vscode:publish": "vsce publish"
},
"devDependencies": {
@ -152,19 +149,18 @@
"@typescript-eslint/parser": "^5.31.0",
"@vscode/test-electron": "^2.1.5",
"@vscode/test-web": "^0.0.44",
"@vscode/vsce": "^2.15.0",
"assert": "^2.0.0",
"esbuild-plugin-polyfill-node": "^0.3.0",
"eslint": "^8.20.0",
"eslint-config-prettier": "^8.8.0",
"glob": "^8.0.3",
"mocha": "^10.0.0",
"process": "^0.11.10",
"ts-loader": "^9.3.1",
"typescript": "^4.7.4",
"vsce": "^2.15.0",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"prettier": "^3.0.0",
"tsup": "^7.1.0",
"typescript": "^4.7.4"
},
"dependencies": {
"@xstate/fsm": "^2.0.1",
"tabby-agent": "file:../tabby-agent"
"tabby-agent": "0.0.1"
}
}

View File

@ -1,23 +0,0 @@
import * as path from "path";
import { runTests } from "@vscode/test-electron";
async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, "../../");
// The path to test runner
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, "./suite/index");
// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
console.error("Failed to run tests");
process.exit(1);
}
}
main();

View File

@ -1,15 +0,0 @@
import * as assert from "assert";
// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import * as vscode from "vscode";
// import * as myExtension from '../../extension';
suite("Extension Test Suite", () => {
vscode.window.showInformationMessage("Start all tests.");
test("Sample test", () => {
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
});
});

View File

@ -1,38 +0,0 @@
import * as path from "path";
import * as Mocha from "mocha";
import * as glob from "glob";
export function run(): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
ui: "tdd",
color: true,
});
const testsRoot = path.resolve(__dirname, "..");
return new Promise((c, e) => {
glob("**/**.test.js", { cwd: testsRoot }, (err, files) => {
if (err) {
return e(err);
}
// Add files to the test suite
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));
try {
// Run the mocha test
mocha.run((failures) => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`));
} else {
c();
}
});
} catch (err) {
console.error(err);
e(err);
}
});
});
}

View File

@ -4,12 +4,12 @@
"target": "ES2020",
"lib": ["ES2020", "dom"],
"sourceMap": true,
"rootDir": "src",
"allowSyntheticDefaultImports": true,
"strict": true /* enable all strict type-checking options */,
/* Additional Checks */
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
"noUnusedParameters": true /* Report errors on unused parameters. */
}
},
"include": ["./src"]
}

View File

@ -0,0 +1,29 @@
import { defineConfig } from "tsup";
import { polyfillNode } from "esbuild-plugin-polyfill-node";
import { dependencies } from "./package.json";
export default () => [
defineConfig({
name: "node",
entry: ["src/extension.ts"],
outDir: "dist/node",
platform: "node",
external: ["vscode"],
noExternal: Object.keys(dependencies),
clean: true,
}),
defineConfig({
name: "browser",
entry: ["src/extension.ts"],
outDir: "dist/web",
platform: "browser",
external: ["vscode"],
noExternal: Object.keys(dependencies),
esbuildPlugins: [
polyfillNode({
polyfills: { fs: true },
}),
],
clean: true,
}),
];

View File

@ -1,101 +0,0 @@
//@ts-check
'use strict';
const path = require('path');
const webpack = require('webpack');
//@ts-check
/** @typedef {import('webpack').Configuration} WebpackConfig **/
/** @type WebpackConfig */
const extensionNodeConfig = {
name: 'node',
target: 'node', // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
output: {
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
path: path.resolve(__dirname, 'dist', 'node'),
filename: 'extension.js',
libraryTarget: 'commonjs2'
},
externals: {
vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
// modules added here also need to be added in the .vscodeignore file
},
resolve: {
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
}
]
},
devtool: 'nosources-source-map',
infrastructureLogging: {
level: 'log', // enables logging required for problem matchers
},
};
const extensionWebConfig = {
name: 'web',
target: 'webworker', // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
output: {
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
path: path.resolve(__dirname, 'dist', 'web'),
filename: 'extension.js',
libraryTarget: 'commonjs2'
},
externals: {
vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
// modules added here also need to be added in the .vscodeignore file
},
resolve: {
mainFields: ['browser', 'module', 'main'], // look for `browser` entry point in imported node modules
extensions: ['.ts', '.js'], // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
fallback: {
// Webpack 5 no longer polyfills Node.js core modules automatically.
// see https://webpack.js.org/configuration/resolve/#resolvefallback
// for the list of Node.js core module polyfills.
assert: require.resolve('assert'),
},
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser', // provide a shim for the global `process` variable
}),
],
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
}
]
},
devtool: 'nosources-source-map',
infrastructureLogging: {
level: 'log', // enables logging required for problem matchers
},
};
module.exports = [extensionNodeConfig, extensionWebConfig];

8
package.json Normal file
View File

@ -0,0 +1,8 @@
{
"private": true,
"workspaces": [
"clients/tabby-agent",
"clients/vscode",
"clients/vim"
]
}

File diff suppressed because it is too large Load Diff