markmap-cli
Advanced tools
Comparing version 0.16.1 to 0.16.2
import { readFile, stat, mkdir, writeFile } from "fs/promises"; | ||
import { join, resolve, dirname } from "path"; | ||
import { dirname, join, resolve } from "path"; | ||
import { fileURLToPath } from "url"; | ||
@@ -19,6 +19,6 @@ import { Command } from "commander"; | ||
import { finished } from "stream/promises"; | ||
const __vite_glob_0_0 = "data:application/octet-stream;base64,L2Fzc2V0cwo="; | ||
const TOOLBAR_VERSION = "0.16.0"; | ||
const TOOLBAR_CSS = `markmap-toolbar@${TOOLBAR_VERSION}/dist/style.css`; | ||
const TOOLBAR_JS = `markmap-toolbar@${TOOLBAR_VERSION}/dist/index.js`; | ||
const currentDir = dirname(fileURLToPath(import.meta.url)); | ||
const ASSETS_PREFIX = "/assets/"; | ||
@@ -74,3 +74,3 @@ const renderToolbar = () => { | ||
const config = { | ||
assetsDir: fileURLToPath(new URL((/* @__PURE__ */ Object.assign({ "../.gitignore": __vite_glob_0_0 }))[`../.${ASSETS_PREFIX}`], import.meta.url)) | ||
assetsDir: `${currentDir}${ASSETS_PREFIX}` | ||
}; | ||
@@ -386,3 +386,7 @@ var getMimeType = (filename) => { | ||
const paths = [...baseJsPaths, ...pluginPaths]; | ||
const fastest = await transformer.urlBuilder.getFastestProvider(); | ||
let findingProvider; | ||
const findProvider = () => { | ||
findingProvider || (findingProvider = transformer.urlBuilder.getFastestProvider()); | ||
return findingProvider; | ||
}; | ||
await Promise.all( | ||
@@ -392,3 +396,3 @@ paths.map( | ||
resolve(assetsDir, path), | ||
transformer.urlBuilder.getFullUrl(path, fastest) | ||
async () => transformer.urlBuilder.getFullUrl(path, await findProvider()) | ||
) | ||
@@ -398,3 +402,3 @@ ) | ||
} | ||
async function downloadAsset(fullPath, url) { | ||
async function downloadAsset(fullPath, resolveUrl) { | ||
try { | ||
@@ -406,2 +410,3 @@ const result = await stat(fullPath); | ||
} | ||
const url = await resolveUrl(); | ||
const res = await fetch(url); | ||
@@ -408,0 +413,0 @@ if (!res.ok || !res.body) |
{ | ||
"name": "markmap-cli", | ||
"version": "0.16.1", | ||
"version": "0.16.2", | ||
"description": "Create markmaps from CLI", | ||
@@ -60,3 +60,3 @@ "author": "Gerald <gera2ld@live.com>", | ||
}, | ||
"gitHead": "f10ad62ef03e02a1843484cca51521f48989fab7" | ||
"gitHead": "a888c810a9add22cdbbed43d02cb382093004a9a" | ||
} |
20815
600