markmap-view
Advanced tools
Comparing version 0.14.5-alpha.21 to 0.14.5-alpha.22
@@ -1,6 +0,63 @@ | ||
/*! markmap-view v0.14.5-alpha.21+fb81f2c | MIT License */ | ||
/*! markmap-view v0.14.5-alpha.22+04afb38 | MIT License */ | ||
(function (exports, d3) { | ||
'use strict'; | ||
/*! markmap-common v0.14.5-alpha.21+fb81f2c | MIT License */ | ||
/*! markmap-common v0.14.5-alpha.22+04afb38 | MIT License */ | ||
function _extends$1() { | ||
_extends$1 = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends$1.apply(this, arguments); | ||
} | ||
const testPath = "npm2url/dist/index.cjs"; | ||
const defaultProviders = { | ||
jsdelivr: path => `https://cdn.jsdelivr.net/npm/${path}`, | ||
unpkg: path => `https://unpkg.com/${path}` | ||
}; | ||
class UrlBuilder { | ||
constructor() { | ||
this.providers = _extends$1({}, defaultProviders); | ||
this.provider = "jsdelivr"; | ||
} | ||
getFastestProvider(path = testPath) { | ||
return Promise.any(Object.entries(this.providers).map(async ([name, factory]) => { | ||
const res = await fetch(factory(path)); | ||
if (!res.ok) { | ||
throw res; | ||
} | ||
await res.text(); | ||
return name; | ||
})); | ||
} | ||
async findFastestProvider() { | ||
this.provider = await this.getFastestProvider(); | ||
return this.provider; | ||
} | ||
setProvider(name, factory) { | ||
if (factory) { | ||
this.providers[name] = factory; | ||
} else { | ||
delete this.providers[name]; | ||
} | ||
} | ||
getFullUrl(path, provider = this.provider) { | ||
if (path.includes("://")) { | ||
return path; | ||
} | ||
const factory = this.providers[provider]; | ||
if (!factory) { | ||
throw new Error(`Provider ${provider} not found`); | ||
} | ||
return factory(path); | ||
} | ||
} | ||
new UrlBuilder(); | ||
class Hook { | ||
@@ -27,16 +84,2 @@ constructor() { | ||
} | ||
function _extends$1() { | ||
_extends$1 = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends$1.apply(this, arguments); | ||
} | ||
const uniqId = Math.random().toString(36).slice(2, 8); | ||
@@ -43,0 +86,0 @@ let globalIndex = 0; |
@@ -1,2 +0,2 @@ | ||
/*! markmap-view v0.14.5-alpha.21+fb81f2c | MIT License */ | ||
/*! markmap-view v0.14.5-alpha.22+04afb38 | MIT License */ | ||
import { Hook, getId, addClass, walkTree, childSelector, noop } from 'markmap-common'; | ||
@@ -3,0 +3,0 @@ export { loadCSS, loadJS } from 'markmap-common'; |
{ | ||
"name": "markmap-view", | ||
"version": "0.14.5-alpha.21+fb81f2c", | ||
"version": "0.14.5-alpha.22+04afb38", | ||
"description": "View markmaps in browser", | ||
@@ -49,3 +49,3 @@ "author": "Gerald <gera2ld@live.com>", | ||
"@types/d3-flextree": "^2.1.1", | ||
"markmap-common": "0.14.5-alpha.21+fb81f2c" | ||
"markmap-common": "0.14.5-alpha.22+04afb38" | ||
}, | ||
@@ -55,3 +55,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "fb81f2cb688f400f17f911774539267219f639ce" | ||
"gitHead": "04afb38dd0a6f3b5e8eaffde3c29e9e38b215c35" | ||
} |
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
Network access
Supply chain riskThis module accesses the network.
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
97150
2944
2