Blog
deno.json file in langchainjs source code.

deno.json file in langchainjs source code.

In this article, we will review deno.json file in lanchainjs source code. we will look at:

  1. What is Deno?

  2. deno.json file in langchainjs

What is Deno?

Deno is the open-source javascript runtime for the modern web.

Built on web standards with zero-config TypeScript, unmatched security, and a complete built-in toolchain.

Stats

  1. 100k+ stars on github

  2. 400k+ active deno users 

  3. 2M+ community modules

Features

  1. TypeScript without the hassle: Write type-safe code without complex build systems or external dependencies.
// Use .ts files with no compile step:
import type { Person } from "./types.ts";
import { Permissions } from "./permissions.ts";


// Author TypeScript with zero setup or configuration:
export interface User extends Person {
  id: number;
  permissions: Permissions[];
}

2. Native support for JSX and TSX: Write code that generates HTML using modern JSX and TSX syntax.

/** @jsx jsx */
import { Hono } from "$hono/mod.ts";
import { jsx } from "$hono/middleware.ts";

const app = new Hono();

app.get("/", (c) => {
  return c.html(
    <html>
      <body>
        <h1>Hello, world!</h1>
      </body>
    </html>
  );
});

3. Bleeding edge ECMAScript features: Write the JavaScript of tomorrow, today! ESNext features like the Temporal API land in Deno first.

const time: Temporal.PlainTime = Temporal.PlainTime.from({
  hour: 19,
  minute: 39,
  second: 9,
  millisecond: 68,
  microsecond: 346,
  nanosecond: 205,
}); // => 19:39:09.068346205

console.log(time.second); // => 9
console.log(time.toString()); // => "19:39:09.068346205"

Learn more about Deno.

deno.json file in langchainjs

In langchainjs/deno.js, you will find this below code

{
  "imports": {
    "langchain/": "npm:/langchain@0.3.2/",
    "@langchain/anthropic": "npm:@langchain/anthropic@0.3.0",
    "@langchain/cloudflare": "npm:@langchain/cloudflare@0.1.0",
    "@langchain/community/": "npm:/@langchain/community@0.3.0/",
    "@langchain/openai": "npm:@langchain/openai@0.3.0",
    "@langchain/cohere": "npm:@langchain/cohere@0.3.0",
    "@langchain/textsplitters": "npm:@langchain/textsplitters@0.1.0",
    "@langchain/google-vertexai-web": "npm:@langchain/google-vertexai-web@0.1.0",
    "@langchain/mistralai": "npm:@langchain/mistralai@0.1.0",
    "@langchain/core/": "npm:/@langchain/core@0.3.1/",
    "@langchain/pinecone": "npm:@langchain/pinecone@0.1.0",
    "@langchain/google-common": "npm:@langchain/google-common@0.1.0",
    "@langchain/langgraph": "npm:/@langchain/langgraph@0.2.3",
    "@langchain/langgraph/": "npm:/@langchain/langgraph@0.2.3/",
    "@faker-js/faker": "npm:@faker-js/faker",
    "@microsoft/fetch-event-source": "npm:@microsoft/fetch-event-source",
    "@pinecone-database/pinecone": "npm:@pinecone-database/pinecone",
    "cheerio": "npm:cheerio",
    "chromadb": "npm:/chromadb",
    "dotenv/": "npm:/dotenv/",
    "zod": "npm:/zod",
    "zod-to-json-schema": "npm:/zod-to-json-schema",
    "node-llama-cpp": "npm:/node-llama-cpp",
    "pdf-parse": "npm:/pdf-parse",
    "peggy": "npm:/peggy",
    "readline": "https://deno.land/x/readline@v1.1.0/mod.ts",
    "uuid": "npm:/uuid",
    "youtubei.js": "npm:/youtubei.js",
    "neo4j-driver": "npm:/neo4j-driver",
    "axios": "npm:/axios",
    "@mendable/firecrawl-js": "npm:/@mendable/firecrawl-js",
    "@aws-crypto/sha256-js": "npm:/@aws-crypto/sha256-js",
    "@aws-sdk/credential-provider-node": "npm:/@aws-sdk/credential-provider-node",
    "@smithy/protocol-http": "npm:/@smithy/protocol-http",
    "@smithy/signature-v4": "npm:/@smithy/signature-v4",
    "@smithy/eventstream-codec": "npm:/@smithy/eventstream-codec",
    "@smithy/util-utf8": "npm:/@smithy/util-utf8",
    "@aws-sdk/types": "npm:/@aws-sdk/types"
  }
}

Let’s learn more about this deno.js file. In deno.js and package.json section in deno documentation, there is information provided about this file.

You can configure Deno using a deno.json file. This file can be used to configure the TypeScript compiler, linter, formatter, and other Deno tools.

The configuration file supports .json and .jsonc extensions.

Deno will automatically detect a deno.json or deno.jsonc configuration file if it's in your current working directory or parent directories. The --config flag can be used to specify a different configuration file.

Dependencies

The "imports" field in your deno.json allows you to specify dependencies used in your project. You can use it to map bare specifiers to URLs or file paths making it easier to manage dependencies and module resolution in your applications.

For example, if you want to use the assert module from the standard library in your project, you could use this import map:

{
  "imports": {
    "@std/assert": "jsr:@std/assert@^1.0.0",
    "chalk": "npm:chalk@5"
  }
}

Then your script can use the bare specifier std/assert:

import { assertEquals } from "@std/assert";
import chalk from "chalk";

assertEquals(1, 2);
console.log(chalk.yellow("Hello world"));

About me

Hey, my name is Ramu Narasinga. I study codebase architecture in large open-source projects.

Email: ramu.narasinga@gmail.com

Build Shadcn CLI from scratch.

References:

  1. https://github.com/langchain-ai/langchainjs/blob/main/deno.json

  2. https://docs.deno.com/runtime/fundamentals/configuration/

  3. https://deno.com/