markmap-cli
Advanced tools
Comparing version 0.15.9-alpha.11 to 0.15.9-alpha.12
@@ -1,1 +0,1 @@ | ||
export declare function fetchAssets(): Promise<void>; | ||
export declare function fetchAssets(assetsDir?: string): Promise<void>; |
import { type IMarkmapCreateOptions } from 'markmap-lib'; | ||
import { IDevelopOptions } from './util'; | ||
import { IDevelopOptions, config } from './util'; | ||
import { develop } from './dev-server'; | ||
import { fetchAssets } from './fetch-assets'; | ||
export * from 'markmap-lib'; | ||
export { develop, fetchAssets }; | ||
export { config, develop, fetchAssets }; | ||
export declare function createMarkmap(options: IMarkmapCreateOptions & IDevelopOptions): Promise<void>; | ||
export declare function main(): Promise<void>; |
@@ -11,3 +11,2 @@ import { readFile, stat, mkdir, writeFile } from "fs/promises"; | ||
export * from "markmap-lib"; | ||
import { packageDirectory } from "pkg-dir"; | ||
import { serve } from "@hono/node-server"; | ||
@@ -56,10 +55,2 @@ import chokidar from "chokidar"; | ||
} | ||
const rootDirPromise = packageDirectory({ | ||
cwd: new URL(import.meta.url).pathname | ||
}); | ||
const assetsDirPromise = rootDirPromise.then((rootDir) => { | ||
if (!rootDir) | ||
throw new Error("Could not find root dir"); | ||
return resolve(rootDir, `.${ASSETS_PREFIX}`); | ||
}); | ||
function createStreamBody(stream) { | ||
@@ -81,2 +72,6 @@ const body = new ReadableStream({ | ||
} | ||
const rootDir = new URL(import.meta.url).pathname; | ||
const config = { | ||
assetsDir: resolve(rootDir, `.${ASSETS_PREFIX}`) | ||
}; | ||
var getMimeType = (filename) => { | ||
@@ -318,3 +313,3 @@ const regexp = /\.([a-zA-Z0-9]+?)$/; | ||
}); | ||
const assetsDir = await assetsDirPromise; | ||
const { assetsDir } = config; | ||
app.get(`${ASSETS_PREFIX}*`, async (c) => { | ||
@@ -374,3 +369,3 @@ const relpath = c.req.path.slice(ASSETS_PREFIX.length); | ||
const providerName = "local-hook"; | ||
async function fetchAssets() { | ||
async function fetchAssets(assetsDir = config.assetsDir) { | ||
var _a, _b; | ||
@@ -394,3 +389,2 @@ const transformer = new Transformer(); | ||
const paths = [...baseJsPaths, ...pluginPaths]; | ||
const assetsDir = await assetsDirPromise; | ||
const fastest = await transformer.urlBuilder.getFastestProvider(); | ||
@@ -426,4 +420,3 @@ await Promise.all( | ||
const relpath = path.slice(ASSETS_PREFIX.length); | ||
const assetsDir = await assetsDirPromise; | ||
return readFile(resolve(assetsDir, relpath), "utf8"); | ||
return readFile(resolve(config.assetsDir, relpath), "utf8"); | ||
} | ||
@@ -541,2 +534,3 @@ const res = await fetch(path); | ||
export { | ||
config, | ||
createMarkmap, | ||
@@ -543,0 +537,0 @@ develop, |
@@ -25,4 +25,5 @@ /// <reference types="node" /> | ||
export declare function localProvider(path: string): string; | ||
export declare const rootDirPromise: Promise<string | undefined>; | ||
export declare const assetsDirPromise: Promise<string>; | ||
export declare function createStreamBody(stream: ReadStream): ReadableStream<any>; | ||
export declare const config: { | ||
assetsDir: string; | ||
}; |
{ | ||
"name": "markmap-cli", | ||
"version": "0.15.9-alpha.11+d60da2f", | ||
"version": "0.15.9-alpha.12+e2132d2", | ||
"description": "Create markmaps from CLI", | ||
@@ -51,5 +51,5 @@ "author": "Gerald <gera2ld@live.com>", | ||
"hono": "^3.11.8", | ||
"markmap-common": "0.15.9-alpha.11+d60da2f", | ||
"markmap-lib": "0.15.9-alpha.11+d60da2f", | ||
"markmap-toolbar": "0.15.9-alpha.11+d60da2f", | ||
"markmap-common": "0.15.9-alpha.12+e2132d2", | ||
"markmap-lib": "0.15.9-alpha.12+e2132d2", | ||
"markmap-toolbar": "0.15.9-alpha.12+e2132d2", | ||
"open": "^10.0.0", | ||
@@ -60,3 +60,3 @@ "pkg-dir": "^8.0.0", | ||
}, | ||
"gitHead": "d60da2fb13a85edec875ef002f1be414a0c00abe" | ||
"gitHead": "e2132d2615f5b19e246478dc9dbb6b6ca4d6d75f" | ||
} |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
21641
593