Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@
},
"type": "module",
"dependencies": {
"@langchain/anthropic": "^0.3.25",
"@langchain/community": "^0.3.49",
"@langchain/google-genai": "^0.2.16",
"@langchain/mistralai": "^0.2.1",
"@langchain/ollama": "^0.2.3",
"@langchain/openai": "^0.6.3",
"langchain": "^0.3.30",
"@langchain/anthropic": "^1.0.0",
"@langchain/classic": "^1.0.0",
"@langchain/community": "^1.0.0",
"@langchain/core": "^1.0.1",
"@langchain/google-genai": "^1.0.0",
"@langchain/mistralai": "^1.0.0",
"@langchain/ollama": "^1.0.0",
"@langchain/openai": "^1.0.0",
"langchain": "^1.0.1",
"uuid": "^13.0.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/docFillerCore/engines/gptEngine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ChatAnthropic } from '@langchain/anthropic';
import { DatetimeOutputParser } from '@langchain/classic/output_parsers';
import { ChromeAI } from '@langchain/community/experimental/llms/chrome_ai';
import {
StringOutputParser,
Expand All @@ -24,7 +25,6 @@ import {
getSelectedProfileKey,
loadProfiles,
} from '@utils/storage/profiles/profileManager';
import { DatetimeOutputParser } from 'langchain/output_parsers';
import { z } from 'zod';
import browser from 'webextension-polyfill';

Expand Down
26 changes: 26 additions & 0 deletions tools/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ import copyContents from './copier';
import entryPoints from './entrypoints';
import { writeManifest } from './manifestWriter';

// Plugin to stub Node.js built-in modules for browser builds
const nodeBuiltinsPlugin: esbuild.Plugin = {
name: 'node-builtins',
setup(build) {
// Stub out node:* imports
build.onResolve({ filter: /^node:/ }, (args) => {
return {
path: args.path,
namespace: 'node-builtins-stub',
};
});

build.onLoad({ filter: /.*/, namespace: 'node-builtins-stub' }, () => {
return {
contents:
'export default {}; export const createRequire = () => () => {};',
loader: 'js',
};
});
},
};

const cleanBuildFolder = async () => {
try {
await fs.remove('./build');
Expand All @@ -25,6 +47,8 @@ const build = async (watch: boolean) => {
bundle: true,
// minify: true,
outdir: './build/src',
platform: 'browser',
plugins: [nodeBuiltinsPlugin],
});
await buildContext.watch();
} else {
Expand All @@ -33,6 +57,8 @@ const build = async (watch: boolean) => {
bundle: true,
// minify: true,
outdir: './build/src',
platform: 'browser',
plugins: [nodeBuiltinsPlugin],
});

if (buildStatus.errors.length > 0) {
Expand Down