Skip to content

Commit

Permalink
chore: lint files
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Nov 6, 2023
1 parent 7575703 commit d09eb8b
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions docs/code-block-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ async function webpackLoader(content, map, meta) {
const cb = this.async();
const BASE_URL = "https://api.js.langchain.com";
// Directories generated inside the API docs (excluding "modules").
const CATEGORIES = ["classes", "functions", "interfaces", "types", "variables"];
const CATEGORIES = [
"classes",
"functions",
"interfaces",
"types",
"variables",
];

if (!this.resourcePath.endsWith(".ts")) {
cb(null, JSON.stringify({ content, imports: [] }), map, meta);
Expand Down Expand Up @@ -62,17 +68,23 @@ async function webpackLoader(content, map, meta) {
let modulePath;
CATEGORIES.forEach((category) => {
const componentPath = `${category}/${moduleName}.${imported}.html`;
const docsPath = path.resolve(__dirname, "..", "api-docs", "public", componentPath);
const docsPath = path.resolve(
__dirname,
"..",
"api-docs",
"public",
componentPath
);
if (fs.existsSync(docsPath)) {
modulePath = componentPath
modulePath = componentPath;
}
})
});
return modulePath;
}
};

imports.forEach((imp) => {
const { imported, source } = imp;
const moduleName = source.split("/").slice(1).join("_");
const moduleName = source.split("/").slice(1).join("_");
const exactPath = findExactPath(moduleName, imported);
if (exactPath) {
imp.docs = BASE_URL + "/" + exactPath;
Expand Down

0 comments on commit d09eb8b

Please sign in to comment.