This commit is contained in:
Oscar Plaisant
2024-09-20 21:31:23 +02:00
parent 2a56343d56
commit 62f0313af1
412 changed files with 64451 additions and 81085 deletions

View File

@@ -62,6 +62,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
@@ -213,15 +214,15 @@ var require_is_extendable = __commonJS({
var require_extend_shallow = __commonJS({
"node_modules/extend-shallow/index.js"(exports2, module2) {
"use strict";
var isObject2 = require_is_extendable();
var isObject = require_is_extendable();
module2.exports = function extend(o) {
if (!isObject2(o)) {
if (!isObject(o)) {
o = {};
}
var len = arguments.length;
for (var i = 1; i < len; i++) {
var obj = arguments[i];
if (isObject2(obj)) {
if (isObject(obj)) {
assign(o, obj);
}
}
@@ -354,7 +355,7 @@ var require_common = __commonJS({
function isNothing(subject) {
return typeof subject === "undefined" || subject === null;
}
function isObject2(subject) {
function isObject(subject) {
return typeof subject === "object" && subject !== null;
}
function toArray(sequence) {
@@ -384,7 +385,7 @@ var require_common = __commonJS({
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
}
module2.exports.isNothing = isNothing;
module2.exports.isObject = isObject2;
module2.exports.isObject = isObject;
module2.exports.toArray = toArray;
module2.exports.repeat = repeat;
module2.exports.isNegativeZero = isNegativeZero;
@@ -3549,223 +3550,6 @@ var require_gray_matter = __commonJS({
}
});
// node_modules/before-after-hook/lib/register.js
var require_register = __commonJS({
"node_modules/before-after-hook/lib/register.js"(exports2, module2) {
module2.exports = register;
function register(state, name, method, options2) {
if (typeof method !== "function") {
throw new Error("method for before hook must be a function");
}
if (!options2) {
options2 = {};
}
if (Array.isArray(name)) {
return name.reverse().reduce(function(callback, name2) {
return register.bind(null, state, name2, callback, options2);
}, method)();
}
return Promise.resolve().then(function() {
if (!state.registry[name]) {
return method(options2);
}
return state.registry[name].reduce(function(method2, registered) {
return registered.hook.bind(null, method2, options2);
}, method)();
});
}
}
});
// node_modules/before-after-hook/lib/add.js
var require_add = __commonJS({
"node_modules/before-after-hook/lib/add.js"(exports2, module2) {
module2.exports = addHook;
function addHook(state, kind, name, hook2) {
var orig = hook2;
if (!state.registry[name]) {
state.registry[name] = [];
}
if (kind === "before") {
hook2 = function(method, options2) {
return Promise.resolve().then(orig.bind(null, options2)).then(method.bind(null, options2));
};
}
if (kind === "after") {
hook2 = function(method, options2) {
var result;
return Promise.resolve().then(method.bind(null, options2)).then(function(result_) {
result = result_;
return orig(result, options2);
}).then(function() {
return result;
});
};
}
if (kind === "error") {
hook2 = function(method, options2) {
return Promise.resolve().then(method.bind(null, options2)).catch(function(error) {
return orig(error, options2);
});
};
}
state.registry[name].push({
hook: hook2,
orig
});
}
}
});
// node_modules/before-after-hook/lib/remove.js
var require_remove = __commonJS({
"node_modules/before-after-hook/lib/remove.js"(exports2, module2) {
module2.exports = removeHook;
function removeHook(state, name, method) {
if (!state.registry[name]) {
return;
}
var index = state.registry[name].map(function(registered) {
return registered.orig;
}).indexOf(method);
if (index === -1) {
return;
}
state.registry[name].splice(index, 1);
}
}
});
// node_modules/before-after-hook/index.js
var require_before_after_hook = __commonJS({
"node_modules/before-after-hook/index.js"(exports2, module2) {
var register = require_register();
var addHook = require_add();
var removeHook = require_remove();
var bind = Function.bind;
var bindable = bind.bind(bind);
function bindApi(hook2, state, name) {
var removeHookRef = bindable(removeHook, null).apply(
null,
name ? [state, name] : [state]
);
hook2.api = { remove: removeHookRef };
hook2.remove = removeHookRef;
["before", "error", "after", "wrap"].forEach(function(kind) {
var args = name ? [state, kind, name] : [state, kind];
hook2[kind] = hook2.api[kind] = bindable(addHook, null).apply(null, args);
});
}
function HookSingular() {
var singularHookName = "h";
var singularHookState = {
registry: {}
};
var singularHook = register.bind(null, singularHookState, singularHookName);
bindApi(singularHook, singularHookState, singularHookName);
return singularHook;
}
function HookCollection() {
var state = {
registry: {}
};
var hook2 = register.bind(null, state);
bindApi(hook2, state);
return hook2;
}
var collectionHookDeprecationMessageDisplayed = false;
function Hook() {
if (!collectionHookDeprecationMessageDisplayed) {
console.warn(
'[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4'
);
collectionHookDeprecationMessageDisplayed = true;
}
return HookCollection();
}
Hook.Singular = HookSingular.bind();
Hook.Collection = HookCollection.bind();
module2.exports = Hook;
module2.exports.Hook = Hook;
module2.exports.Singular = Hook.Singular;
module2.exports.Collection = Hook.Collection;
}
});
// node_modules/wrappy/wrappy.js
var require_wrappy = __commonJS({
"node_modules/wrappy/wrappy.js"(exports2, module2) {
module2.exports = wrappy;
function wrappy(fn, cb) {
if (fn && cb) return wrappy(fn)(cb);
if (typeof fn !== "function")
throw new TypeError("need wrapper function");
Object.keys(fn).forEach(function(k) {
wrapper[k] = fn[k];
});
return wrapper;
function wrapper() {
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
var ret = fn.apply(this, args);
var cb2 = args[args.length - 1];
if (typeof ret === "function" && ret !== cb2) {
Object.keys(cb2).forEach(function(k) {
ret[k] = cb2[k];
});
}
return ret;
}
}
}
});
// node_modules/once/once.js
var require_once = __commonJS({
"node_modules/once/once.js"(exports2, module2) {
var wrappy = require_wrappy();
module2.exports = wrappy(once2);
module2.exports.strict = wrappy(onceStrict);
once2.proto = once2(function() {
Object.defineProperty(Function.prototype, "once", {
value: function() {
return once2(this);
},
configurable: true
});
Object.defineProperty(Function.prototype, "onceStrict", {
value: function() {
return onceStrict(this);
},
configurable: true
});
});
function once2(fn) {
var f = function() {
if (f.called) return f.value;
f.called = true;
return f.value = fn.apply(this, arguments);
};
f.called = false;
return f;
}
function onceStrict(fn) {
var f = function() {
if (f.called)
throw new Error(f.onceError);
f.called = true;
return f.value = fn.apply(this, arguments);
};
var name = fn.name || "Function wrapped with `once`";
f.onceError = name + " shouldn't be called more than once";
f.called = false;
return f;
}
}
});
// main.ts
var main_exports = {};
__export(main_exports, {
@@ -3775,39 +3559,125 @@ module.exports = __toCommonJS(main_exports);
var import_obsidian = require("obsidian");
var import_gray_matter2 = __toESM(require_gray_matter());
// node_modules/universal-user-agent/dist-web/index.js
// node_modules/@octokit/rest/node_modules/universal-user-agent/index.js
function getUserAgent() {
if (typeof navigator === "object" && "userAgent" in navigator) {
return navigator.userAgent;
}
if (typeof process === "object" && "version" in process) {
if (typeof process === "object" && process.version !== void 0) {
return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`;
}
return "<environment undetectable>";
}
// node_modules/@octokit/core/dist-web/index.js
var import_before_after_hook = __toESM(require_before_after_hook());
// node_modules/is-plain-object/dist/is-plain-object.mjs
function isObject(o) {
return Object.prototype.toString.call(o) === "[object Object]";
}
function isPlainObject(o) {
var ctor, prot;
if (isObject(o) === false) return false;
ctor = o.constructor;
if (ctor === void 0) return true;
prot = ctor.prototype;
if (isObject(prot) === false) return false;
if (prot.hasOwnProperty("isPrototypeOf") === false) {
return false;
// node_modules/@octokit/rest/node_modules/before-after-hook/lib/register.js
function register(state, name, method, options2) {
if (typeof method !== "function") {
throw new Error("method for before hook must be a function");
}
return true;
if (!options2) {
options2 = {};
}
if (Array.isArray(name)) {
return name.reverse().reduce((callback, name2) => {
return register.bind(null, state, name2, callback, options2);
}, method)();
}
return Promise.resolve().then(() => {
if (!state.registry[name]) {
return method(options2);
}
return state.registry[name].reduce((method2, registered) => {
return registered.hook.bind(null, method2, options2);
}, method)();
});
}
// node_modules/@octokit/endpoint/dist-web/index.js
var VERSION = "9.0.0";
// node_modules/@octokit/rest/node_modules/before-after-hook/lib/add.js
function addHook(state, kind, name, hook2) {
const orig = hook2;
if (!state.registry[name]) {
state.registry[name] = [];
}
if (kind === "before") {
hook2 = (method, options2) => {
return Promise.resolve().then(orig.bind(null, options2)).then(method.bind(null, options2));
};
}
if (kind === "after") {
hook2 = (method, options2) => {
let result;
return Promise.resolve().then(method.bind(null, options2)).then((result_) => {
result = result_;
return orig(result, options2);
}).then(() => {
return result;
});
};
}
if (kind === "error") {
hook2 = (method, options2) => {
return Promise.resolve().then(method.bind(null, options2)).catch((error) => {
return orig(error, options2);
});
};
}
state.registry[name].push({
hook: hook2,
orig
});
}
// node_modules/@octokit/rest/node_modules/before-after-hook/lib/remove.js
function removeHook(state, name, method) {
if (!state.registry[name]) {
return;
}
const index = state.registry[name].map((registered) => {
return registered.orig;
}).indexOf(method);
if (index === -1) {
return;
}
state.registry[name].splice(index, 1);
}
// node_modules/@octokit/rest/node_modules/before-after-hook/index.js
var bind = Function.bind;
var bindable = bind.bind(bind);
function bindApi(hook2, state, name) {
const removeHookRef = bindable(removeHook, null).apply(
null,
name ? [state, name] : [state]
);
hook2.api = { remove: removeHookRef };
hook2.remove = removeHookRef;
["before", "error", "after", "wrap"].forEach((kind) => {
const args = name ? [state, kind, name] : [state, kind];
hook2[kind] = hook2.api[kind] = bindable(addHook, null).apply(null, args);
});
}
function Singular() {
const singularHookName = Symbol("Singular");
const singularHookState = {
registry: {}
};
const singularHook = register.bind(null, singularHookState, singularHookName);
bindApi(singularHook, singularHookState, singularHookName);
return singularHook;
}
function Collection() {
const state = {
registry: {}
};
const hook2 = register.bind(null, state);
bindApi(hook2, state);
return hook2;
}
var before_after_hook_default = { Singular, Collection };
// node_modules/@octokit/rest/node_modules/@octokit/endpoint/dist-bundle/index.js
var VERSION = "0.0.0-development";
var userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
var DEFAULTS = {
method: "GET",
@@ -3829,6 +3699,17 @@ function lowercaseKeys(object) {
return newObj;
}, {});
}
function isPlainObject(value) {
if (typeof value !== "object" || value === null)
return false;
if (Object.prototype.toString.call(value) !== "[object Object]")
return false;
const proto = Object.getPrototypeOf(value);
if (proto === null)
return true;
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
}
function mergeDeep(defaults, options2) {
const result = Object.assign({}, defaults);
Object.keys(options2).forEach((key) => {
@@ -3852,7 +3733,7 @@ function removeUndefinedProperties(obj) {
return obj;
}
function merge(defaults, route, options2) {
var _a2;
var _a;
if (typeof route === "string") {
let [method, url] = route.split(" ");
options2 = Object.assign(url ? { method, url } : { url: method }, options2);
@@ -3864,7 +3745,7 @@ function merge(defaults, route, options2) {
removeUndefinedProperties(options2.headers);
const mergedOptions = mergeDeep(defaults || {}, options2);
if (options2.url === "/graphql") {
if (defaults && ((_a2 = defaults.mediaType.previews) == null ? void 0 : _a2.length)) {
if (defaults && ((_a = defaults.mediaType.previews) == null ? void 0 : _a.length)) {
mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
(preview) => !mergedOptions.mediaType.previews.includes(preview)
).concat(mergedOptions.mediaType.previews);
@@ -3898,10 +3779,13 @@ function extractUrlVariableNames(url) {
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
}
function omit(object, keysToOmit) {
return Object.keys(object).filter((option) => !keysToOmit.includes(option)).reduce((obj, key) => {
obj[key] = object[key];
return obj;
}, {});
const result = { __proto__: null };
for (const key of Object.keys(object)) {
if (keysToOmit.indexOf(key) === -1) {
result[key] = object[key];
}
}
return result;
}
function encodeReserved(str2) {
return str2.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
@@ -3997,7 +3881,7 @@ function parseUrl(template) {
}
function expand(template, context) {
var operators = ["+", "#", ".", "/", ";", "?", "&"];
return template.replace(
template = template.replace(
/\{([^\{\}]+)\}|([^\{\}]+)/g,
function(_, expression, literal) {
if (expression) {
@@ -4027,9 +3911,14 @@ function expand(template, context) {
}
}
);
if (template === "/") {
return template;
} else {
return template.replace(/\/$/, "");
}
}
function parse2(options2) {
var _a2;
var _a;
let method = options2.method.toUpperCase();
let url = (options2.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
let headers = Object.assign({}, options2.headers);
@@ -4060,7 +3949,7 @@ function parse2(options2) {
).join(",");
}
if (url.endsWith("/graphql")) {
if ((_a2 = options2.mediaType.previews) == null ? void 0 : _a2.length) {
if ((_a = options2.mediaType.previews) == null ? void 0 : _a.length) {
const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
headers.accept = previewsFromAcceptHeader.concat(options2.mediaType.previews).map((preview) => {
const format = options2.mediaType.format ? `.${options2.mediaType.format}` : "+json";
@@ -4107,36 +3996,30 @@ function withDefaults(oldDefaults, newDefaults) {
}
var endpoint = withDefaults(null, DEFAULTS);
// node_modules/deprecation/dist-web/index.js
var Deprecation = class extends Error {
constructor(message) {
super(message);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
this.name = "Deprecation";
}
};
// node_modules/@octokit/request-error/dist-web/index.js
var import_once = __toESM(require_once());
var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation));
var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation));
// node_modules/@octokit/rest/node_modules/@octokit/request-error/dist-src/index.js
var RequestError = class extends Error {
constructor(message, statusCode, options2) {
super(message);
__publicField(this, "name");
/**
* http status code
*/
__publicField(this, "status");
/**
* Request options that lead to the error.
*/
__publicField(this, "request");
/**
* Response object if a response was received
*/
__publicField(this, "response");
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
this.name = "HttpError";
this.status = statusCode;
let headers;
if ("headers" in options2 && typeof options2.headers !== "undefined") {
headers = options2.headers;
}
if ("response" in options2) {
this.response = options2.response;
headers = options2.response.headers;
}
const requestCopy = Object.assign({}, options2.request);
if (options2.request.headers.authorization) {
@@ -4149,39 +4032,30 @@ var RequestError = class extends Error {
}
requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
this.request = requestCopy;
Object.defineProperty(this, "code", {
get() {
logOnceCode(
new Deprecation(
"[@octokit/request-error] `error.code` is deprecated, use `error.status`."
)
);
return statusCode;
}
});
Object.defineProperty(this, "headers", {
get() {
logOnceHeaders(
new Deprecation(
"[@octokit/request-error] `error.headers` is deprecated, use `error.response.headers`."
)
);
return headers || {};
}
});
}
};
// node_modules/@octokit/request/dist-web/index.js
var VERSION2 = "8.1.0";
// node_modules/@octokit/rest/node_modules/@octokit/request/dist-bundle/index.js
var VERSION2 = "0.0.0-development";
function isPlainObject2(value) {
if (typeof value !== "object" || value === null)
return false;
if (Object.prototype.toString.call(value) !== "[object Object]")
return false;
const proto = Object.getPrototypeOf(value);
if (proto === null)
return true;
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
}
function getBufferResponse(response) {
return response.arrayBuffer();
}
function fetchWrapper(requestOptions) {
var _a2, _b, _c;
var _a, _b, _c, _d;
const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
const parseSuccessResponseBody = ((_a2 = requestOptions.request) == null ? void 0 : _a2.parseSuccessResponseBody) !== false;
if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false;
if (isPlainObject2(requestOptions.body) || Array.isArray(requestOptions.body)) {
requestOptions.body = JSON.stringify(requestOptions.body);
}
let headers = {};
@@ -4193,14 +4067,21 @@ function fetchWrapper(requestOptions) {
}
if (!fetch) {
throw new Error(
'Global "fetch" not found. Please provide `options.request.fetch` to octokit or upgrade to node@18 or newer.'
"fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
);
}
return fetch(requestOptions.url, __spreadValues({
method: requestOptions.method,
body: requestOptions.body,
headers: requestOptions.headers,
signal: (_c = requestOptions.request) == null ? void 0 : _c.signal
redirect: (_c = requestOptions.request) == null ? void 0 : _c.redirect,
// Header values must be `string`
headers: Object.fromEntries(
Object.entries(requestOptions.headers).map(([name, value]) => [
name,
String(value)
])
),
signal: (_d = requestOptions.request) == null ? void 0 : _d.signal
}, requestOptions.body && { duplex: "half" })).then((response) => __async(this, null, function* () {
url = response.url;
status = response.status;
@@ -4268,7 +4149,15 @@ function fetchWrapper(requestOptions) {
throw error;
else if (error.name === "AbortError")
throw error;
throw new RequestError(error.message, 500, {
let message = error.message;
if (error.name === "TypeError" && "cause" in error) {
if (error.cause instanceof Error) {
message = error.cause.message;
} else if (typeof error.cause === "string") {
message = error.cause;
}
}
throw new RequestError(message, 500, {
request: requestOptions
});
});
@@ -4277,7 +4166,7 @@ function getResponseData(response) {
return __async(this, null, function* () {
const contentType = response.headers.get("content-type");
if (/application\/json/.test(contentType)) {
return response.json();
return response.json().catch(() => response.text()).catch(() => "");
}
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
return response.text();
@@ -4288,11 +4177,17 @@ function getResponseData(response) {
function toErrorMessage(data) {
if (typeof data === "string")
return data;
let suffix;
if ("documentation_url" in data) {
suffix = ` - ${data.documentation_url}`;
} else {
suffix = "";
}
if ("message" in data) {
if (Array.isArray(data.errors)) {
return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}`;
return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}${suffix}`;
}
return data.message;
return `${data.message}${suffix}`;
}
return `Unknown error: ${JSON.stringify(data)}`;
}
@@ -4325,8 +4220,8 @@ var request = withDefaults2(endpoint, {
}
});
// node_modules/@octokit/graphql/dist-web/index.js
var VERSION3 = "7.0.1";
// node_modules/@octokit/rest/node_modules/@octokit/graphql/dist-bundle/index.js
var VERSION3 = "0.0.0-development";
function _buildMessageForResponseErrors(data) {
return `Request failed due to following response errors:
` + data.errors.map((e) => ` - ${e.message}`).join("\n");
@@ -4334,10 +4229,12 @@ function _buildMessageForResponseErrors(data) {
var GraphqlResponseError = class extends Error {
constructor(request2, headers, response) {
super(_buildMessageForResponseErrors(response));
__publicField(this, "name", "GraphqlResponseError");
__publicField(this, "errors");
__publicField(this, "data");
this.request = request2;
this.headers = headers;
this.response = response;
this.name = "GraphqlResponseError";
this.errors = response.errors;
this.data = response.data;
if (Error.captureStackTrace) {
@@ -4430,7 +4327,7 @@ function withCustomRequest(customRequest) {
});
}
// node_modules/@octokit/auth-token/dist-web/index.js
// node_modules/@octokit/rest/node_modules/@octokit/auth-token/dist-bundle/index.js
var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
var REGEX_IS_INSTALLATION = /^ghs_/;
var REGEX_IS_USER_TO_SERVER = /^ghu_/;
@@ -4478,54 +4375,25 @@ var createTokenAuth = function createTokenAuth2(token) {
});
};
// node_modules/@octokit/core/dist-web/index.js
var VERSION4 = "5.1.0";
// node_modules/@octokit/rest/node_modules/@octokit/core/dist-src/version.js
var VERSION4 = "6.1.2";
// node_modules/@octokit/rest/node_modules/@octokit/core/dist-src/index.js
var noop = () => {
};
var consoleWarn = console.warn.bind(console);
var consoleError = console.error.bind(console);
var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`;
var _a;
var Octokit = (_a = class {
static defaults(defaults) {
const OctokitWithDefaults = class extends this {
constructor(...args) {
const options2 = args[0] || {};
if (typeof defaults === "function") {
super(defaults(options2));
return;
}
super(
Object.assign(
{},
defaults,
options2,
options2.userAgent && defaults.userAgent ? {
userAgent: `${options2.userAgent} ${defaults.userAgent}`
} : null
)
);
}
};
return OctokitWithDefaults;
}
/**
* Attach a plugin (or many) to your Octokit instance.
*
* @example
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
*/
static plugin(...newPlugins) {
var _a2;
const currentPlugins = this.plugins;
const NewOctokit = (_a2 = class extends this {
}, _a2.plugins = currentPlugins.concat(
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
), _a2);
return NewOctokit;
}
var Octokit = class {
constructor(options2 = {}) {
const hook2 = new import_before_after_hook.Collection();
// assigned during constructor
__publicField(this, "request");
__publicField(this, "graphql");
__publicField(this, "log");
__publicField(this, "hook");
// TODO: type `octokit.auth` based on passed options.authStrategy
__publicField(this, "auth");
const hook2 = new before_after_hook_default.Collection();
const requestDefaults = {
baseUrl: request.endpoint.DEFAULTS.baseUrl,
headers: {},
@@ -4573,7 +4441,7 @@ var Octokit = (_a = class {
this.auth = auth2;
}
} else {
const _a2 = options2, { authStrategy } = _a2, otherOptions = __objRest(_a2, ["authStrategy"]);
const _a = options2, { authStrategy } = _a, otherOptions = __objRest(_a, ["authStrategy"]);
const auth2 = authStrategy(
Object.assign(
{
@@ -4598,10 +4466,51 @@ var Octokit = (_a = class {
Object.assign(this, classConstructor.plugins[i](this, options2));
}
}
}, _a.VERSION = VERSION4, _a.plugins = [], _a);
static defaults(defaults) {
const OctokitWithDefaults = class extends this {
constructor(...args) {
const options2 = args[0] || {};
if (typeof defaults === "function") {
super(defaults(options2));
return;
}
super(
Object.assign(
{},
defaults,
options2,
options2.userAgent && defaults.userAgent ? {
userAgent: `${options2.userAgent} ${defaults.userAgent}`
} : null
)
);
}
};
return OctokitWithDefaults;
}
/**
* Attach a plugin (or many) to your Octokit instance.
*
* @example
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
*/
static plugin(...newPlugins) {
var _a;
const currentPlugins = this.plugins;
const NewOctokit = (_a = class extends this {
}, __publicField(_a, "plugins", currentPlugins.concat(
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
)), _a);
return NewOctokit;
}
};
__publicField(Octokit, "VERSION", VERSION4);
__publicField(Octokit, "plugins", []);
// node_modules/@octokit/plugin-request-log/dist-web/index.js
var VERSION5 = "4.0.0";
// node_modules/@octokit/rest/node_modules/@octokit/plugin-request-log/dist-src/version.js
var VERSION5 = "5.3.0";
// node_modules/@octokit/rest/node_modules/@octokit/plugin-request-log/dist-src/index.js
function requestLog(octokit) {
octokit.hook.wrap("request", (request2, options2) => {
octokit.log.debug("request", options2);
@@ -4609,13 +4518,15 @@ function requestLog(octokit) {
const requestOptions = octokit.request.endpoint.parse(options2);
const path = requestOptions.url.replace(options2.baseUrl, "");
return request2(options2).then((response) => {
const requestId = response.headers["x-github-request-id"];
octokit.log.info(
`${requestOptions.method} ${path} - ${response.status} in ${Date.now() - start}ms`
`${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms`
);
return response;
}).catch((error) => {
octokit.log.info(
`${requestOptions.method} ${path} - ${error.status} in ${Date.now() - start}ms`
const requestId = error.response.headers["x-github-request-id"] || "UNKNOWN";
octokit.log.error(
`${requestOptions.method} ${path} - ${error.status} with id ${requestId} in ${Date.now() - start}ms`
);
throw error;
});
@@ -6807,15 +6718,15 @@ function legacyRestEndpointMethods(octokit) {
}
legacyRestEndpointMethods.VERSION = VERSION7;
// node_modules/@octokit/rest/dist-web/index.js
var VERSION8 = "20.1.1";
var Octokit2 = Octokit.plugin(
requestLog,
legacyRestEndpointMethods,
paginateRest
).defaults({
userAgent: `octokit-rest.js/${VERSION8}`
});
// node_modules/@octokit/rest/dist-src/version.js
var VERSION8 = "21.0.0";
// node_modules/@octokit/rest/dist-src/index.js
var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults(
{
userAgent: `octokit-rest.js/${VERSION8}`
}
);
// src/gists.ts
var updateGist = (opts) => __async(void 0, null, function* () {
@@ -6921,7 +6832,7 @@ var getLatestSettings = (plugin) => __async(void 0, null, function* () {
return plugin.settings;
});
var stripFrontMatter = (content) => (0, import_gray_matter2.default)(content).content;
var copyGitUrlEditorCallback = (opts) => () => __async(void 0, null, function* () {
var copyGistUrlEditorCallback = (opts) => () => __async(void 0, null, function* () {
const { app, plugin } = opts;
const { enableUpdatingGistsAfterCreation } = yield getLatestSettings(plugin);
if (!enableUpdatingGistsAfterCreation) {
@@ -6957,6 +6868,40 @@ var copyGitUrlEditorCallback = (opts) => () => __async(void 0, null, function* (
return new import_obsidian.Notice("Copied gist URL to clipboard.");
}
});
var openGistEditorCallback = (opts) => () => __async(void 0, null, function* () {
const { app, plugin } = opts;
const { enableUpdatingGistsAfterCreation } = yield getLatestSettings(plugin);
if (!enableUpdatingGistsAfterCreation) {
return new import_obsidian.Notice(
"You need to enable 'Update gists after creation' in Settings to use this command."
);
}
const view = app.workspace.getActiveViewOfType(import_obsidian.MarkdownView);
if (!view) {
return new import_obsidian.Notice("No active file");
}
const editor = view.editor;
const originalContent = editor.getValue();
const existingSharedGists = getSharedGistsForFile(originalContent);
if (existingSharedGists.length === 0) {
return new import_obsidian.Notice(
"You must share this note as a gist before you can open its gist."
);
}
if (existingSharedGists.length > 1) {
new SelectExistingGistModal(
app,
existingSharedGists,
false,
(sharedGist) => __async(void 0, null, function* () {
window.open(sharedGist.url, "_blank");
})
).open();
} else {
const sharedGist = existingSharedGists[0];
window.open(sharedGist.url, "_blank");
}
});
var shareGistEditorCallback = (opts) => () => __async(void 0, null, function* () {
const { isPublic, app, plugin } = opts;
const accessToken = getAccessToken();
@@ -7110,7 +7055,15 @@ var ShareAsGistPlugin = class extends import_obsidian.Plugin {
this.addCommand({
id: "copy-gist-url",
name: "Copy GitHub.com gist URL",
callback: copyGitUrlEditorCallback({
callback: copyGistUrlEditorCallback({
plugin: this,
app: this.app
})
});
this.addCommand({
id: "open-gist-url",
name: "Open gist on GitHub.com",
callback: openGistEditorCallback({
plugin: this,
app: this.app
})
@@ -7214,6 +7167,7 @@ var SetGistDescriptionModal = class extends import_obsidian.Modal {
})
);
this.scope.register([], "Enter", (evt) => {
evt.preventDefault();
if (evt.isComposing) {
return;
}
@@ -7288,12 +7242,4 @@ strip-bom-string/index.js:
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*)
is-plain-object/dist/is-plain-object.mjs:
(*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*)
*/

View File

@@ -1,7 +1,7 @@
{
"id": "obsidian-share-as-gist",
"name": "Share as Gist",
"version": "1.5.0",
"version": "1.6.1",
"minAppVersion": "0.9.7",
"description": "Shares an Obsidian note as a GitHub.com gist",
"author": "Tim Rogers",