Skip to content

Commit 08dc5db

Browse files
sestinjpzabackmaxbrunetJoseVeganejch
authored
🚒 Preview (#1355)
* πŸ“ rename googlepalmapi.md to googlegeminiapi.md * πŸ“ update mistral models * Rename to geminiapi & change filename this time * ✨ global request options (#1153) * ✨ global request options * πŸ› fix jira context provider by injecting fetch * ✨ request options for embeddings providers * ✨ add Cohere as Reranker (#1159) * ♻️ use custom requestOptions with CohereEmbeddingsProvider * Update preIndexedDocs.ts (#1154) Add WordPress and WooCommerce as preIndexedDocs. * 🩹 remove example "outputDir" from default config * Fix slash command params loading (#1084) Existing slash commands expect an object named "params" so mapping to "options" here caused params to be undefined within the run scope. I renamed from 'm' to 's' just to avoid potential confusion with the model property mapping above. * πŸ› don't index if no open workspace folders * πŸ’„ improve onboarding language * 🚸 improve onboarding * πŸ› stop loading when error * πŸ’„ replace text in input box * Respect Retry-After header when available from 429 responses (#1182) * 🩹 remove dead code for exponential backoff This has been replaced by the withExponentialBackoff helper * 🩹 respect Retry-After header when available * 🚸 update inline tips language * ✨ input box history * πŸ“Œ update package-locks * πŸ”Š log errors in prepackage * πŸ› err to string * πŸ“Œ pin llama-tokenizer-js * πŸ“Œ update lockfile * 🚚 change /docs to docs. * πŸ“¦ package win-ca dependencies in binary * πŸ”₯ remove unpopular models from UI * 🍱 new logo in jetbrains * 🎨 use node-fetch everywhere * 🚸 immediately select newly added models * 🚸 spell out Alt instead of using symbol * πŸ”₯ remove config shortcut * πŸ› fix changing model bug * 🩹 de-duplicate before adding models * πŸ”§ add embeddingsProvider specific request options * 🎨 refactor to always use node-fetch from LLM * πŸ”₯ remove duplicate tokens generated * πŸ”Š add timestamp to JetBrains logs * 🎨 maxStopWords for Groq * πŸ› fix groq provider calling /completions * πŸ› correctly adhere to LanceDB table name spec * πŸ› fix sqlite NOT NULL constraint failed error with custom model * Fix issue where Accept/Reject All only accepts/rejects a single diff hunk. (#1197) * Fix issues parsing Ollama /api/show endpoint payloads. (#1199) * ✨ model role for inlineEdit * 🩹 various small updates * πŸ› fix openai image support * πŸ”– update gradle version * 🍱 update jetbrains icon * πŸ› fix autocomplete in notebook cells * πŸ”₯ remove unused media * πŸ”₯ remove unused files * Fix schema to allow 'AUTODETECT' sentinel for model when provider is 'groq'. (#1203) * πŸ› small improvements * Fix issue with @codebase provider when n becomes odd due to a divide by 2 during the full text search portion of the query. (#1204) * πŸ› add skipLines * ✨ URLContextProvider * πŸ₯… improved error handling for codebase indexing * 🏷️ use official Git extension types * βž• declare vscode.git extension dependency * ⚑️ use reranker for docs context provider * 🚸 Use templating in default customCommand * 🎨 use U+23CE * 🚸 disable autocomplete in commit message box * 🩹 add gems to default ignored paths * ⚑️ format markdown blocks as comments in .ipynb completions * πŸ› don't strip port in URL * πŸ› fix "gemini" provider spacing issues * πŸ“¦ update posthog version * CON-1067: Failed state seems to be toggling as intended * 🏷️ update types.ts * πŸ› fix copy/paste/cut behavior in VS Code notebooks * ✨ llama3 prompt template * Rework for proper initialization on start up * CON-1067 Clean-up * CON-1067 more clean-up * Add indexingNotLoaded state * CON-1067 communicate progress to frontend * πŸ› fix undefined prefix, suffix and language for `/edit` (#1216) * πŸ› add .bind to fix templating in systemMessage * CON-1067 clean up * πŸ› small improvements to autocomplete * Update DocsContextProvider.ts (#1217) I fixed a bug where you were sending the query variable (which holds the base URL of the doc) to the rerank method, and it made no sense to rerank the chunks based on a URL. So I changed it to extras.fullInput because it should rerank based on the user input, which should provide better results. * πŸ“ select-provider.md update * πŸ› fix merge errors * Nate/autocomplete-metrics (#1230) * ⚑️ use context.selectedCompletionInfo, deduplicate logs * ⚑️ don't reject if user keeps typing same as completion * ⚑️ vscode autocomplete edge cases * 🚧 WIP on vscode autocomplete * ⚑️ better bracket handlng * ⚑️ improved multi-line detection * Active file default context (#1231) * 🚸 include currently active file by default * 🚸 warn if non-autocomplete model being used * ✨ try hole filling template for gpt * πŸ’„ ui for no context * ⚑️ leave out bottom of excessively large files * 🚧 experimenting with perplexity style streaming * πŸ› fix #1237 * πŸ’š fix type error * ⚑️ improve LSP usage in autocomplete * πŸ› fix content parsing regression in /edit * add PySide6 docs to preindexed docs (#1236) * CON-232 bring custom docs to top, alphabetize doc results, make scrol… (#1239) * CON-232 bring custom docs to top, alphabetize doc results, make scrollable * CON-232 cleanup --------- Co-authored-by: Justin Milner <[email protected]> * CON-1067 condense some things * 🚚 [Auxiliary -> Continue] Sidebar * πŸ”Š log completion options in ~/.continue/sessions * CON-1067 wrong ret val fix * CON-1067: fixes from testing * ⚑️ filter out completions that are only punctuation/space * ⚑️ inject intellisense docs, no multi-line on comments * ⚑️ crawl type definitions for autocomplete * ⚑️ truncate function text * ⚑️ cache LSP calls * ⚑️ find recently edited ranges with perfect prefix match * πŸ› fix gif paths * ⚑️ bring back double new line stop words * πŸ“Œ add yarn lock files * πŸ› allow language keywords to be generated * πŸ’„ toggle on help button * 🎨 defaultContext option * πŸ› fix lancedb bug by upgrading * πŸ› fix groq stop tokens * πŸ› preventDefault to avoid double paste * 🚸 don't repeatedly override cmd+J * πŸ§‘β€πŸ’» fix npm run test in core * πŸ“ change description * πŸ› silence Ollama invalid server state warning * ⚑️ more accurate getTerminalContents * ⚑️ make getTerminalContents more accurate * πŸ§‘β€πŸ’» use yarn instead of npm * πŸ‘· fix yarn add --no-save in prepackge * πŸ› correctly read entire notebook file contents * βž• import handlebars * πŸ”₯ remove unnecessary migrations * ⚑️ improve /comment prompt * Add debug terminal context menu (#1261) * Add --no-dependencies to vsce package (#1255) This is not needed because we bundle first with esbuild, and vsce pack has issues with modern package managers. see: microsoft/vscode-vsce#421 (comment) * ui: change line decoration color to use vscode theme (#1253) * ui: change line decoration color to use vscode theme to give user a more consistent experience by letting the decoration color to user the color defined in the theme. * fix: incorrect color item should be line background not text background because the decoration is for the whole line * 🎨 refactor indexing state into a single object * CON-223 Correct diff streaming abort (#1263) Co-authored-by: Justin Milner <[email protected]> * πŸ“¦ switch to pnpm (#1265) * 🎨 use pnpm instead of yarn * βž• make dependencies explicit for pnpm * πŸ› add powershell to extension mapping, and default to ext * Add stream support for Bedrock Anthropic * 🎨 make llamatokenizer commonjs compatible * βž• add esbuild optional deps * 🚚 rename vendor/node_modules -> modules * πŸ”– update core version * πŸ› fixes for transformers.js compatibility * πŸ”– update core version * 🎨 set modelPath in constructor * 🎨 fix transformers.js import * 🎨 eslint enforce import extensions * 🎨 require -> import * 🚸 notify user if not diff in /commit * πŸ’„ Improve colors of the IntelliJ tool window icon (#1273) Without this fix, the continue icon sticks out from the other toolwindow icons, resulting in an inconsistent appearance of the whole IDE and creates a feeling that the continue plugin "doesn't fit, something must be broken". According to https://plugins.jetbrains.com/docs/intellij/icons.html#new-ui-icon-colors specific colors are needed to work nicely with dark and light modes. Bonus is that the active tool window icon color then changes automatically to white. Co-authored-by: Lukas Baron <[email protected]> * ✨ send Bearer token to Ollama if apiKey set * πŸ› fix slash command bug * πŸ§‘β€πŸ’» add onnxruntime (--save-dev) for types * πŸ› don't apply to file when running code block in terminal * πŸ› avoid double paste * ✨ gpt-4o * 🎨 pass uniqueId to constructor * 🚸 focus without scrolling into vie * 🎨 refactoring for continue-proxy LLM (#1277) * πŸ› continue server client fixes * 🎨 refactor OpenAI _getHeaders * 🎨 pass ideSettings to llmFromDescription * ⚑️ improve add docstring command * πŸ’š ci updates * πŸ› fix repeated paste bug * πŸ› fix build script * 🩹 various small improvements * πŸ“Œ pin esbuild 0.17.19 * πŸ§‘β€πŸ’» pnpm i gui in prepackage * πŸ› show all diff changes in vscode * 🩹 getMetaKeyName * πŸ› fix reading of unopened ipynb files * ⚑️ gpt-4o system prompt * πŸ’„ make font size configurable in config.json ui.fontSize * 🩹 properly dispose of diff handler * πŸ› fix indexing status display * ⚑️ context pruning * 🎨 update free trial models * fix: remove some backup files generated by pkg if present (#1287) * adjust toCopy (#1305) Co-authored-by: Justin Milner <[email protected]> * Nate/prompt-file (#1308) * ✨ .prompt files * πŸ§‘β€πŸ’» back to npm : ( * 🎨 nicer dropdown icon * 🎨 full switch back to npm * πŸ§‘β€πŸ’» uninstall script for fresh start * 🎨 updated package-locks * πŸ”₯ remove hello from continuerc.json * πŸ”₯ remove example files * 🎨 update test prompt * 🎨 update prompt * 🎨 update test prompt * πŸ‘· create out/node_modules in prepackage.js * Log prompt-tokens to devdb and show in 'My Usage' view (#1309) * Also log the number of prompt tokens to the dev-db * Show prompt tokens in 'My Usage' view * πŸ”₯ remove console logs * add lm studio tab-autocomplete walkthrough (#1298) * πŸ“ update autocomplete LM Studio docs * πŸ’š fix prepackage.js * ⬆️ upgrade lancedb version * 🚸 make it easier to continue past trial * 🚸 improve model setup process * πŸ“Œ update package-lock.jsons * πŸ› fix prompt file loading bug * docs: add setup guide for OpenRouter (#1284) * Update preIndexedDocs.ts (#1292) Add Bootstrap and Alpine.js as pre indexed docs. * add toString (#1324) * add toString * Fix indentation --------- Co-authored-by: Justin Milner <[email protected]> * don't overwrite all models in onboarding * πŸ”§ override headers with custom headers * ✨ allow overwriting slash command description * feature flag (#1327) * βž• feature flags dependency * 🎨 make getHeaders awaitable * πŸ”’οΈ token count for abuse monitoring * πŸ‘· remove win32-arm64 target * Update build.js (#1330) Fix error: EBUSY: resource busy or locked, rmdir '...\continue\binary\tmp\continue-node_modules-lancedb' * πŸ“Œ pin onnxruntime version to match transformers.js * 🎨 transformers cleanup, extensionVersion header * πŸ”₯ remove lingering pnpm * 🎨 update default models * 🎨 update defaults * πŸ‘· fix version in build post-check * 🎨 test.js in dev * πŸ§‘β€πŸ’» cleaning * Add Gemini 1.5 Flash as a model (#1337) * 🎨 log dev data for tokens generated * Expose custom context provider registration through a vscode extension api. (#1288) * Fix typo "Experimantal" (#1353) * 🎨 Refactor core (#1281) * 🎨 refactor out react context * 🎨 refactor local storage * 🎨 refactor IdeMessenger * πŸ”₯ removing unused files * 🚚 move scripts * βœ… setup VSCode integration testing * 🎨 fix test-related stuff * 🚧 testing * 🎨 tweak terminal cmd+L * πŸ§‘β€πŸ’» install biome in core * 🎨 run biome check on core * 🎨 run biome check in vscode * 🎨 run biome check in binary * πŸ§‘β€πŸ’» global biome config * 🎨 run biome check on core * 🎨 run biome check in vscode * 🎨 fix a few biome warnings * 🚧 WIP on protocols * 🚧 progress, organizing, about to remove webviewCore protocol * 🚧 now running * 🚧 move indexing code to core * 🚧 WIP on JetBrains indexing implementation * 🎨 finish listDir * 🚧 gui fixes * 🏷️ update IMessenger.on return type * πŸ› fix jetbrains types + IDE detection * πŸ§‘β€πŸ’» set up debugging for binary with TcpMessenger * πŸ‘· fix prepackage.js * πŸ§‘β€πŸ’» turn off debug mode for intellij * πŸ› merge fixes * πŸ› fixes after refactor * πŸ› merge fixes * πŸ’„ increase font size in JB * πŸ”€ merge changes * 🩹 small fixes * πŸ› fix jetbrains build * 🩹 more jetbrains fixes * 🎨 jetbrains improvements * πŸ› fix lancedb prob in jetbrains build * πŸ‘· update jetbrains build process * ✨ intellij problems context provider * πŸ‘· add script utils file * πŸ’š fix jetbrains build regression * 🎨 dynamic import transformers.js * 🩹 small jetbrains updates * ✨ folder context provider in jetbrains * 🎨 many more jetbrains improvements * πŸ”€ merge fixes * ⚑️ small improvements * 🎨 tell users transformers.js not supported * 🎨 trial updates * πŸ“ update jetbrains readmej * ⚑️ only use smaller context for local autocomplete models * ⚑️ improve bracket filter * ✨ global .continue/.prompts folder * πŸ’„ improved model setup process * πŸ₯… display VSCode req errs * ⚑️ improved autocomplete stopping * 🎨 count cmd+I --------- Co-authored-by: Peter Zaback <[email protected]> Co-authored-by: Maxime Brunet <[email protected]> Co-authored-by: Jose Vega <[email protected]> Co-authored-by: Nejc Habjan <[email protected]> Co-authored-by: Chad Yates <[email protected]> Co-authored-by: Justin Milner <[email protected]> Co-authored-by: ε°ι’šθ™« <[email protected]> Co-authored-by: 5eqn <[email protected]> Co-authored-by: Pixel <[email protected]> Co-authored-by: Justin Milner <[email protected]> Co-authored-by: Devin Gould <[email protected]> Co-authored-by: Dipta Mahardhika <[email protected]> Co-authored-by: Ruben Kostandyan <[email protected]> Co-authored-by: tnglemongrass <[email protected]> Co-authored-by: Lukas Baron <[email protected]> Co-authored-by: Fernando <[email protected]> Co-authored-by: Tijs Zwinkels <[email protected]> Co-authored-by: DJ Johnson <[email protected]> Co-authored-by: sam <[email protected]> Co-authored-by: Pratik Parmar <[email protected]> Co-authored-by: Sam El-Husseini <[email protected]>
1 parent 311fc0a commit 08dc5db

File tree

274 files changed

+11294
-36335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+11294
-36335
lines changed

β€Ž.vscode/launch.jsonβ€Ž

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111
"name": "Core Binary",
1212
"skipFiles": ["<node_internals>/**"],
1313
"program": "${workspaceFolder}/binary/out/index.js",
14-
"preLaunchTask": "binary:esbuild",
14+
// "preLaunchTask": "binary:esbuild",
1515
"outFiles": ["${workspaceFolder}/binary/out/**/*.js"],
1616
"sourceMaps": true,
1717
"smartStep": true,
18-
"internalConsoleOptions": "openOnSessionStart"
18+
"internalConsoleOptions": "openOnSessionStart",
19+
"cwd": "${workspaceFolder}/binary",
20+
"env": {
21+
"CONTINUE_DEVELOPMENT": "true"
22+
}
1923
},
2024
{
2125
"type": "node",
@@ -69,18 +73,17 @@
6973
// Pass a directory to run tests in
7074
"${workspaceFolder}/extensions/vscode/manual-testing-sandbox",
7175
"--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode",
72-
"--extensionTestsPath=${workspaceFolder}/extensions/vscode/out/test-runner/mochaRunner"
76+
"--extensionTestsPath=${workspaceFolder}/extensions/vscode/out/test/runner/mochaRunner"
7377
],
7478
"outFiles": [
7579
// Allows setting breakpoints in test suites across the /src folder
76-
"${workspaceFolder}/extensions/vscode/out/test-suites/**/*.js",
80+
"${workspaceFolder}/extensions/vscode/out/test/test-suites/**/*.js",
7781
// Allows setting breakpoints in mocha test runner file
78-
"${workspaceFolder}/extensions/vscode/out/test-runner/**/*.js"
82+
"${workspaceFolder}/extensions/vscode/out/test/runner/**/*.js"
7983
],
8084
"internalConsoleOptions": "openOnSessionStart",
8185
"preLaunchTask": "vscode-extension:tests:build",
8286
"env": {
83-
"CONTINUE_SERVER_URL": "http://localhost:65432",
8487
// Avoid timing out when stopping on breakpoints during debugging in VSCode
8588
"MOCHA_TIMEOUT": "0"
8689
}

β€Žbinary/.gitignoreβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
bin
33
data
44
out
5+
tmp

β€Žbinary/README.mdβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ The build process is otherwise defined entirely in `build.js`.
2626
- tree-sitter-wasms/
2727

2828
(\*) = need to download for each platform manually
29+
30+
## Debugging
31+
32+
To debug the binary with IntelliJ, set `useTcp` to `true` in `CoreMessenger.kt`, and then in VS Code run the "Core Binary" debug script. Instead of starting a subprocess for the binary and communicating over stdin/stdout, the IntelliJ extension will connect over TCP to the server started from the VS Code window. You can place breakpoints anywhere in the `core` or `binary` folders.

β€Žbinary/build.jsβ€Ž

Lines changed: 84 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
const esbuild = require("esbuild");
2-
const { execSync } = require("child_process");
32
const fs = require("fs");
43
const path = require("path");
54
const ncp = require("ncp").ncp;
65
const { rimrafSync } = require("rimraf");
6+
const { validateFilesPresent, execCmdSync } = require("../scripts/util");
77

8-
function execCmdSync(cmd) {
9-
try {
10-
execSync(cmd);
11-
} catch (err) {
12-
console.error(`Error executing command '${cmd}': `, err.output.toString());
13-
process.exit(1);
14-
}
15-
}
8+
// Clean slate
9+
const bin = path.join(__dirname, "bin");
10+
const out = path.join(__dirname, "out");
11+
rimrafSync(bin);
12+
rimrafSync(out);
13+
rimrafSync(path.join(__dirname, "tmp"));
14+
fs.mkdirSync(bin);
15+
fs.mkdirSync(out);
1616

1717
const esbuildOutputFile = "out/index.js";
18-
const targets = [
18+
let targets = [
1919
"darwin-x64",
2020
"darwin-arm64",
2121
"linux-x64",
@@ -44,38 +44,43 @@ const targetToLanceDb = {
4444
"linux-arm64": "@lancedb/vectordb-linux-arm64-gnu",
4545
"linux-x64": "@lancedb/vectordb-linux-x64-gnu",
4646
"win32-x64": "@lancedb/vectordb-win32-x64-msvc",
47+
"win32-arm64": "@lancedb/vectordb-win32-x64-msvc", // they don't have a win32-arm64 build
4748
};
4849

49-
async function installNodeModuleInTempDirAndCopyToCurrent(package, toCopy) {
50-
console.log(`Copying ${package} to ${toCopy}`);
50+
async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
51+
console.log(`Copying ${packageName} to ${toCopy}`);
5152
// This is a way to install only one package without npm trying to install all the dependencies
5253
// Create a temporary directory for installing the package
53-
const adjustedName = toCopy.replace(/^@/, "").replace("/", "-");
54+
const adjustedName = packageName.replace(/^@/, "").replace("/", "-");
5455
const tempDir = path.join(
5556
__dirname,
5657
"tmp",
5758
`continue-node_modules-${adjustedName}`,
5859
);
5960
const currentDir = process.cwd();
6061

61-
// Remove the dir we will be copying to
62-
rimrafSync(`node_modules/${toCopy}`);
62+
// // Remove the dir we will be copying to
63+
// rimrafSync(`node_modules/${toCopy}`);
6364

64-
// Ensure the temporary directory exists
65+
// // Ensure the temporary directory exists
6566
fs.mkdirSync(tempDir, { recursive: true });
6667

6768
try {
6869
// Move to the temporary directory
6970
process.chdir(tempDir);
7071

7172
// Initialize a new package.json and install the package
72-
execCmdSync(`npm init -y && npm i -f ${package} --no-save`);
73+
execCmdSync(`npm init -y && npm i -f ${packageName} --no-save`);
7374

7475
console.log(
75-
`Contents of: ${package}`,
76+
`Contents of: ${packageName}`,
7677
fs.readdirSync(path.join(tempDir, "node_modules", toCopy)),
7778
);
7879

80+
// Without this it seems the file isn't completely written to disk
81+
// Ideally we validate file integrity in the validation at the end
82+
await new Promise((resolve) => setTimeout(resolve, 2000));
83+
7984
// Copy the installed package back to the current directory
8085
await new Promise((resolve, reject) => {
8186
ncp(
@@ -84,7 +89,10 @@ async function installNodeModuleInTempDirAndCopyToCurrent(package, toCopy) {
8489
{ dereference: true },
8590
(error) => {
8691
if (error) {
87-
console.error(`[error] Error copying ${package} package`, error);
92+
console.error(
93+
`[error] Error copying ${packageName} package`,
94+
error,
95+
);
8896
reject(error);
8997
} else {
9098
resolve();
@@ -102,78 +110,66 @@ async function installNodeModuleInTempDirAndCopyToCurrent(package, toCopy) {
102110
}
103111

104112
(async () => {
105-
// console.log("[info] Building with ncc...");
106-
// execCmdSync(`npx ncc build src/index.ts -o out`);
107-
108-
// Copy node_modules for pre-built binaries
109-
const DYNAMIC_IMPORTS = [
110-
// "esbuild",
111-
// "@esbuild",
112-
// // "@lancedb",
113-
// "posthog-node",
114-
// "@octokit",
115-
];
116113
fs.mkdirSync("out/node_modules", { recursive: true });
117114
fs.mkdirSync("bin/node_modules", { recursive: true });
118115

119-
await Promise.all(
120-
DYNAMIC_IMPORTS.map(
121-
(mod) =>
122-
new Promise((resolve, reject) => {
123-
ncp(
124-
`node_modules/${mod}`,
125-
`out/node_modules/${mod}`,
126-
function (error) {
127-
if (error) {
128-
console.error(`[error] Error copying ${mod}`, error);
129-
reject(error);
130-
} else {
131-
resolve();
132-
}
133-
},
134-
);
135-
ncp(
136-
`node_modules/${mod}`,
137-
`bin/node_modules/${mod}`,
138-
function (error) {
139-
if (error) {
140-
console.error(`[error] Error copying ${mod}`, error);
141-
reject(error);
142-
} else {
143-
resolve();
144-
}
145-
},
146-
);
147-
}),
148-
),
149-
);
150-
console.log(`[info] Copied ${DYNAMIC_IMPORTS.join(", ")}`);
151-
152116
console.log("[info] Downloading prebuilt lancedb...");
153117
for (const target of targets) {
154118
if (targetToLanceDb[target]) {
155-
console.log(`[info] Downloading ${target}...`);
119+
console.log(`[info] Downloading for ${target}...`);
156120
await installNodeModuleInTempDirAndCopyToCurrent(
157121
targetToLanceDb[target],
158122
"@lancedb",
159123
);
160124
}
161125
}
162126

127+
// tree-sitter-wasm
128+
const treeSitterWasmsDir = path.join(out, "tree-sitter-wasms");
129+
fs.mkdirSync(treeSitterWasmsDir);
130+
await new Promise((resolve, reject) => {
131+
ncp(
132+
path.join(
133+
__dirname,
134+
"..",
135+
"core",
136+
"node_modules",
137+
"tree-sitter-wasms",
138+
"out",
139+
),
140+
treeSitterWasmsDir,
141+
{ dereference: true },
142+
(error) => {
143+
if (error) {
144+
console.warn("[error] Error copying tree-sitter-wasm files", error);
145+
reject(error);
146+
} else {
147+
resolve();
148+
}
149+
},
150+
);
151+
});
152+
153+
fs.copyFileSync(
154+
path.join(__dirname, "../core/vendor/tree-sitter.wasm"),
155+
path.join(__dirname, "out/tree-sitter.wasm"),
156+
);
157+
console.log("[info] Copied tree-sitter wasms");
158+
163159
console.log("[info] Cleaning up artifacts from previous builds...");
164160

165161
// delete asset backups generated by previous pkg invocations, if present
166162
for (const assetPath of assetBackups) {
167163
fs.rmSync(assetPath, { force: true });
168164
}
169165

170-
console.log("[info] Building with esbuild...");
171166
// Bundles the extension into one file
167+
console.log("[info] Building with esbuild...");
172168
await esbuild.build({
173169
entryPoints: ["src/index.ts"],
174170
bundle: true,
175171
outfile: esbuildOutputFile,
176-
external: ["esbuild", ...DYNAMIC_IMPORTS, "./xhr-sync-worker.js", "vscode"],
172+
external: ["esbuild", "./xhr-sync-worker.js", "vscode"],
177173
format: "cjs",
178174
platform: "node",
179175
sourcemap: true,
@@ -208,6 +204,7 @@ async function installNodeModuleInTempDirAndCopyToCurrent(package, toCopy) {
208204
);
209205

210206
// Download and unzip prebuilt sqlite3 binary for the target
207+
console.log("[info] Downloading node-sqlite3");
211208
const downloadUrl = `https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-${
212209
target === "win32-arm64" ? "win32-ia32" : target
213210
}.tar.gz`;
@@ -240,9 +237,30 @@ async function installNodeModuleInTempDirAndCopyToCurrent(package, toCopy) {
240237
force: true,
241238
recursive: true,
242239
});
240+
241+
// copy @lancedb to bin folders
242+
console.log("[info] Copying @lancedb files to bin");
243+
fs.copyFileSync(
244+
`node_modules/${targetToLanceDb[target]}/index.node`,
245+
`${targetDir}/index.node`,
246+
);
243247
}
244248
// execCmdSync(
245249
// `npx pkg out/index.js --target node18-darwin-arm64 --no-bytecode --public-packages "*" --public -o bin/pkg`
246250
// );
251+
252+
const pathsToVerify = [];
253+
for (target of targets) {
254+
const exe = target.startsWith("win") ? ".exe" : "";
255+
const targetDir = `bin/${target}`;
256+
pathsToVerify.push(
257+
`${targetDir}/continue-binary${exe}`,
258+
`${targetDir}/esbuild${exe}`,
259+
`${targetDir}/index.node`, // @lancedb
260+
`${targetDir}/node_sqlite3.node`,
261+
);
262+
}
263+
validateFilesPresent(pathsToVerify);
264+
247265
console.log("[info] Done!");
248266
})();

0 commit comments

Comments
Β (0)