copy libs into out

This commit is contained in:
Patrick Erichsen 2024-08-21 14:06:11 -07:00
parent a51c520dee
commit 23fffea2cc
15 changed files with 172 additions and 768 deletions

2
.vscode/tasks.json vendored
View file

@ -45,8 +45,6 @@
}
]
},
// Tsc currently errors out due to testing setup issues, will be resolved in a different PR
// This will be useful for preventing debugging if there are compile errors
{
"label": "vscode-extension:tsc",
"type": "npm",

View file

@ -49,6 +49,7 @@
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.10",
"@continuedev/llm-info": "^1.0.1",
"@crawlee/playwright": "^3.11.1",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@typescript-eslint/eslint-plugin": "^7.8.0",
@ -57,11 +58,11 @@
"adf-to-md": "^1.1.0",
"async-mutex": "^0.5.0",
"axios": "^1.6.7",
"cheerio": "^1.0.0-rc.12",
"commander": "^12.0.0",
"comment-json": "^4.2.3",
"dbinfoz": "^0.1.4",
"dotenv": "^16.4.5",
"extract-zip": "^2.0.1",
"fastest-levenshtein": "^1.0.16",
"follow-redirects": "^1.15.5",
"handlebars": "^4.7.8",
@ -79,7 +80,9 @@
"ollama": "^0.4.6",
"onnxruntime-node": "1.14.0",
"openai": "^4.20.1",
"p-limit": "^6.1.0",
"pg": "^8.11.3",
"playwright": "^1.46.1",
"posthog-node": "^3.6.3",
"quick-lru": "^7.0.0",
"replicate": "^0.26.0",

View file

@ -202,34 +202,6 @@ export default class DocsService {
let processedPages = 0;
let maxKnownPages = 1;
// crawlSite(
// new URL(startUrl),
// siteIndexingConfig.maxDepth,
// async function* (page) {
// processedPages++;
// const article = pageToArticle(page);
// if (article) {
// articles.push(article);
// }
// // Use a heuristic approach for progress calculation
// const progress = Math.min(processedPages / maxKnownPages, 1);
// yield {
// progress, // Yield the heuristic progress
// desc: `Finding subpages (${page.path})`,
// status: "indexing",
// };
// // Increase maxKnownPages to delay progress reaching 100% too soon
// if (processedPages === maxKnownPages) {
// maxKnownPages *= 2;
// }
// },
// );
// Crawl pages and retrieve info as articles
for await (const page of crawlSite(startUrl)) {
processedPages++;

View file

@ -1,8 +1,8 @@
import { Readability } from "@mozilla/readability";
import { JSDOM } from "jsdom";
import { Chunk } from "../../index.js";
import { cleanFragment, cleanHeader } from "../chunk/markdown.js";
import { PageData } from "./crawlSite.js";
import { Chunk } from "../../";
import { cleanFragment, cleanHeader } from "../chunk/markdown";
import { PageData } from "./crawlSite";
export type ArticleComponent = {
title: string;

View file

@ -1,6 +1,10 @@
import { Octokit } from "@octokit/rest";
import { URL } from "node:url";
import { PlaywrightCrawler, Configuration, LogLevel } from "crawlee";
import {
PlaywrightCrawler,
Configuration,
LogLevel,
} from "@crawlee/playwright";
import { EventEmitter } from "events";
import { installChromium, isChromiumInstalled } from "./installChromium";
import { getChromiumExecutablePath } from "../../util/paths";

View file

@ -5,8 +5,8 @@ import {
getChromiumExecutablePath,
getContinueUtilsChromiumPath,
} from "../../util/paths";
import { finished } from "stream/promises";
import extract from "extract-zip";
import { Writable } from "stream";
const PACKAGE_ZIP_FILENAME = "package.zip";
@ -54,11 +54,10 @@ async function downloadPackage(): Promise<string> {
throw new Error("Response body is null");
}
const file = fs.createWriteStream(zipPath);
// https://stackoverflow.com/a/74722818
// @ts-ignore
await finished(response.body.pipe(file));
const fileStream = Writable.toWeb(fs.createWriteStream(zipPath));
await response.body.pipeTo(fileStream);
return zipPath;
}
@ -85,6 +84,7 @@ export async function installChromium() {
console.debug("Installing Chromium");
const zipPath = await downloadPackage();
await extractZip(zipPath);
console.debug("Successfully installed Chromium");
} catch (error) {
console.debug("Chromium installation failed:", error);
process.exit(1);

View file

@ -16,16 +16,16 @@ globalThis.Response = Response;
globalThis.TextEncoder = TextEncoder;
globalThis.TextDecoder = TextDecoder;
// globalThis.beforeAll(() => {
// // We can ignore TS warnings here since we set this explicitly in `./jest.global-setup.ts`
// if (fs.existsSync(process.env.CONTINUE_GLOBAL_DIR!)) {
// fs.rmSync(process.env.CONTINUE_GLOBAL_DIR!, { recursive: true });
// }
// });
globalThis.beforeAll(() => {
// We can ignore TS warnings here since we set this explicitly in `./jest.global-setup.ts`
if (fs.existsSync(process.env.CONTINUE_GLOBAL_DIR!)) {
fs.rmSync(process.env.CONTINUE_GLOBAL_DIR!, { recursive: true });
}
});
// globalThis.afterAll(() => {
// // We can ignore TS warnings here since we set this explicitly in `./jest.global-setup.ts`
// if (fs.existsSync(process.env.CONTINUE_GLOBAL_DIR!)) {
// fs.rmSync(process.env.CONTINUE_GLOBAL_DIR!, { recursive: true });
// }
// });
globalThis.afterAll(() => {
// We can ignore TS warnings here since we set this explicitly in `./jest.global-setup.ts`
if (fs.existsSync(process.env.CONTINUE_GLOBAL_DIR!)) {
fs.rmSync(process.env.CONTINUE_GLOBAL_DIR!, { recursive: true });
}
});

731
core/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -43,6 +43,7 @@
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.10",
"@continuedev/llm-info": "^1.0.1",
"@crawlee/playwright": "^3.11.1",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@typescript-eslint/eslint-plugin": "^7.8.0",
@ -53,13 +54,14 @@
"axios": "^1.6.7",
"commander": "^12.0.0",
"comment-json": "^4.2.3",
"crawlee": "^3.11.1",
"dbinfoz": "^0.1.4",
"dotenv": "^16.4.5",
"extract-zip": "^2.0.1",
"fastest-levenshtein": "^1.0.16",
"fingerprint-generator": "^2.1.54",
"follow-redirects": "^1.15.5",
"handlebars": "^4.7.8",
"header-generator": "^2.1.54",
"http-proxy-agent": "^7.0.1",
"https-proxy-agent": "^7.0.3",
"ignore": "^5.3.1",
@ -94,9 +96,6 @@
"yaml": "^2.4.2",
"zod": "^3.23.8"
},
"puppeteer": {
"chromium_revision": "119.0.6045.105"
},
"engine-strict": true,
"engines": {
"node": ">=20.11.0"

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.197",
"version": "0.9.199",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.197",
"version": "0.9.199",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",
@ -100,6 +100,7 @@
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.10",
"@continuedev/llm-info": "^1.0.1",
"@crawlee/playwright": "^3.11.1",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@typescript-eslint/eslint-plugin": "^7.8.0",
@ -110,13 +111,14 @@
"axios": "^1.6.7",
"commander": "^12.0.0",
"comment-json": "^4.2.3",
"crawlee": "^3.11.1",
"dbinfoz": "^0.1.4",
"dotenv": "^16.4.5",
"extract-zip": "^2.0.1",
"fastest-levenshtein": "^1.0.16",
"fingerprint-generator": "^2.1.54",
"follow-redirects": "^1.15.5",
"handlebars": "^4.7.8",
"header-generator": "^2.1.54",
"http-proxy-agent": "^7.0.1",
"https-proxy-agent": "^7.0.3",
"ignore": "^5.3.1",

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "0.9.197",
"version": "0.9.199",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

View file

@ -6,7 +6,7 @@ const esbuildConfig = {
entryPoints: ["src/extension.ts"],
bundle: true,
outfile: "out/extension.js",
external: ["vscode", "esbuild", "./xhr-sync-worker.js"],
external: ["vscode", "esbuild", "jquery", "./xhr-sync-worker.js"],
format: "cjs",
platform: "node",
sourcemap: flags.includes("--sourcemap"),

View file

@ -241,14 +241,107 @@ const exe = os === "win32" ? ".exe" : "";
);
});
// Crawlee uses a `require.resolve` to check for jquery which
// forces us to exclude it from our esbuild, but we still need
// to copy it over to prevent build errors
// await new Promise((resolve, reject) => {
// ncp(
// path.join(__dirname, "../../../core/node_modules/jquery"),
// path.join(__dirname, "../out/node_modules/jquery"),
// { dereference: true },
// (error) => {
// if (error) {
// console.warn("[error] Error copying jquery files", error);
// reject(error);
// } else {
// resolve();
// }
// },
// );
// });
// await new Promise((resolve, reject) => {
// ncp(
// path.join(__dirname, "../../../core/node_modules/playwright"),
// path.join(__dirname, "../out/node_modules/playwright"),
// { dereference: true },
// (error) => {
// if (error) {
// console.warn("[error] Error copying playwright files", error);
// reject(error);
// } else {
// resolve();
// }
// },
// );
// });
// await new Promise((resolve, reject) => {
// ncp(
// path.join(__dirname, "../../../core/node_modules/playwright-core"),
// path.join(__dirname, "../out/node_modules/playwright-core"),
// { dereference: true },
// (error) => {
// if (error) {
// console.warn("[error] Error copying playwright-core files", error);
// reject(error);
// } else {
// resolve();
// }
// },
// );
// });
// await new Promise((resolve, reject) => {
// ncp(
// path.join(
// __dirname,
// "../../../core/node_modules/header-generator/data_files",
// ),
// path.join(__dirname, "../out/data_files"),
// { dereference: true },
// (error) => {
// if (error) {
// console.warn("[error] Error copying data_files files", error);
// reject(error);
// } else {
// resolve();
// }
// },
// );
// });
// await new Promise((resolve, reject) => {
// ncp(
// path.join(
// __dirname,
// "../../../core/node_modules/fingerprint-generator/data_files",
// ),
// path.join(__dirname, "../out/data_files"),
// { dereference: true },
// (error) => {
// if (error) {
// console.warn("[error] Error copying data_files files", error);
// reject(error);
// } else {
// resolve();
// }
// },
// );
// });
const filesToCopy = [
"../../../core/vendor/tree-sitter.wasm",
"../../../core/llm/llamaTokenizerWorkerPool.mjs",
"../../../core/llm/llamaTokenizer.mjs",
"../../../core/llm/tiktokenWorkerPool.mjs",
];
for (const f of filesToCopy) {
fs.copyFileSync(path.join(__dirname, f), path.join(__dirname, "..", "out", path.basename(f)));
fs.copyFileSync(
path.join(__dirname, f),
path.join(__dirname, "..", "out", path.basename(f)),
);
console.log(`[info] Copied ${path.basename(f)}`);
}
@ -457,6 +550,7 @@ const exe = os === "win32" ? ".exe" : "";
"@vscode/ripgrep",
"workerpool",
];
fs.mkdirSync("out/node_modules", { recursive: true });
await Promise.all(
@ -504,8 +598,8 @@ const exe = os === "win32" ? ".exe" : "";
os === "darwin"
? "libonnxruntime.1.14.0.dylib"
: os === "linux"
? "libonnxruntime.so.1.14.0"
: "onnxruntime.dll"
? "libonnxruntime.so.1.14.0"
: "onnxruntime.dll"
}`,
"builtin-themes/dark_modern.json",
@ -544,8 +638,8 @@ const exe = os === "win32" ? ".exe" : "";
target === "win32-arm64"
? "esbuild.exe"
: target === "win32-x64"
? "win32-x64/esbuild.exe"
: `${target}/bin/esbuild`
? "win32-x64/esbuild.exe"
: `${target}/bin/esbuild`
}`,
`out/node_modules/@lancedb/vectordb-${
os === "win32"

View file

@ -9,6 +9,7 @@
"strict": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"types": ["mocha"] // This solves conflict between jest and mocha: https://github.com/cypress-io/cypress/issues/7435#issuecomment-631695007
},
"include": ["src/**/*", "../../core/**/*.ts", "../../core/**/*.d.ts"],

4
gui/package-lock.json generated
View file

@ -93,6 +93,7 @@
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.10",
"@continuedev/llm-info": "^1.0.1",
"@crawlee/playwright": "^3.11.1",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@typescript-eslint/eslint-plugin": "^7.8.0",
@ -103,13 +104,14 @@
"axios": "^1.6.7",
"commander": "^12.0.0",
"comment-json": "^4.2.3",
"crawlee": "^3.11.1",
"dbinfoz": "^0.1.4",
"dotenv": "^16.4.5",
"extract-zip": "^2.0.1",
"fastest-levenshtein": "^1.0.16",
"fingerprint-generator": "^2.1.54",
"follow-redirects": "^1.15.5",
"handlebars": "^4.7.8",
"header-generator": "^2.1.54",
"http-proxy-agent": "^7.0.1",
"https-proxy-agent": "^7.0.3",
"ignore": "^5.3.1",