diff --git a/binary/build.js b/binary/build.js
index 99a5d0e12..91e0f304e 100644
--- a/binary/build.js
+++ b/binary/build.js
@@ -9,17 +9,20 @@ const {
autodetectPlatformAndArch,
} = require("../scripts/util");
-// Clean slate
const bin = path.join(__dirname, "bin");
const out = path.join(__dirname, "out");
const build = path.join(__dirname, "build");
-rimrafSync(bin);
-rimrafSync(out);
-rimrafSync(build);
-rimrafSync(path.join(__dirname, "tmp"));
-fs.mkdirSync(bin);
-fs.mkdirSync(out);
-fs.mkdirSync(build);
+
+function cleanSlate() {
+// Clean slate
+ rimrafSync(bin);
+ rimrafSync(out);
+ rimrafSync(build);
+ rimrafSync(path.join(__dirname, "tmp"));
+ fs.mkdirSync(bin);
+ fs.mkdirSync(out);
+ fs.mkdirSync(build);
+}
const esbuildOutputFile = "out/index.js";
let targets = [
@@ -56,6 +59,39 @@ const targetToLanceDb = {
"win32-arm64": "@lancedb/vectordb-win32-arm64-msvc",
};
+// Bundles the extension into one file
+async function buildWithEsbuild() {
+ console.log("[info] Building with esbuild...");
+ await esbuild.build({
+ entryPoints: ["src/index.ts"],
+ bundle: true,
+ outfile: esbuildOutputFile,
+ external: [
+ "esbuild",
+ "./xhr-sync-worker.js",
+ "llamaTokenizerWorkerPool.mjs",
+ "tiktokenWorkerPool.mjs",
+ "vscode",
+ "./index.node",
+ ],
+ format: "cjs",
+ platform: "node",
+ sourcemap: true,
+ minify: true,
+ treeShaking: true,
+ loader: {
+ // eslint-disable-next-line @typescript-eslint/naming-convention
+ ".node": "file",
+ },
+
+ // To allow import.meta.path for transformers.js
+ // https://github.com/evanw/esbuild/issues/1492#issuecomment-893144483
+ inject: ["./importMetaUrl.js"],
+ define: { "import.meta.url": "importMetaUrl" },
+ });
+
+}
+
async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
console.log(`Copying ${packageName} to ${toCopy}`);
// This is a way to install only one package without npm trying to install all the dependencies
@@ -118,6 +154,13 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
}
(async () => {
+ if (esbuildOnly) {
+ await buildWithEsbuild();
+ return;
+ }
+
+ cleanSlate()
+
// Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
// This is only needed for our `pkg` command at build time
fs.writeFileSync(
@@ -192,35 +235,7 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
fs.rmSync(assetPath, { force: true });
}
- // Bundles the extension into one file
- console.log("[info] Building with esbuild...");
- await esbuild.build({
- entryPoints: ["src/index.ts"],
- bundle: true,
- outfile: esbuildOutputFile,
- external: [
- "esbuild",
- "./xhr-sync-worker.js",
- "llamaTokenizerWorkerPool.mjs",
- "tiktokenWorkerPool.mjs",
- "vscode",
- "./index.node",
- ],
- format: "cjs",
- platform: "node",
- sourcemap: true,
- minify: true,
- treeShaking: true,
- loader: {
- // eslint-disable-next-line @typescript-eslint/naming-convention
- ".node": "file",
- },
-
- // To allow import.meta.path for transformers.js
- // https://github.com/evanw/esbuild/issues/1492#issuecomment-893144483
- inject: ["./importMetaUrl.js"],
- define: { "import.meta.url": "importMetaUrl" },
- });
+ await buildWithEsbuild();
// Copy over any worker files
fs.cpSync(
@@ -233,10 +248,6 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
"out/llamaTokenizerWorkerPool.mjs",
);
- if (esbuildOnly) {
- return;
- }
-
console.log("[info] Building binaries with pkg...");
for (const target of targets) {
const targetDir = `bin/${target}`;
diff --git a/binary/package.json b/binary/package.json
index 426127922..19dff8a6b 100644
--- a/binary/package.json
+++ b/binary/package.json
@@ -23,6 +23,7 @@
"scripts": {
"test": "jest",
"build": "node build.js",
+ "rebuild": "node build.js --esbuild-only",
"build:darwin-x64": "node build.js --os darwin-x64"
},
"license": "Apache-2.0",
diff --git a/extensions/intellij/.run/Start Core Dev Server.run.xml b/extensions/intellij/.run/Start Core Dev Server.run.xml
index 24fef9e5d..9f3e93003 100644
--- a/extensions/intellij/.run/Start Core Dev Server.run.xml
+++ b/extensions/intellij/.run/Start Core Dev Server.run.xml
@@ -4,6 +4,16 @@
-
+
+
+
\ No newline at end of file