Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
parent
80c9e83ef8
commit
684b06fba1
39 changed files with 13808 additions and 75 deletions
|
@ -99,4 +99,3 @@ steps:
|
|||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -119,6 +119,7 @@ dist
|
|||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
||||
.dccache
|
||||
config.json
|
||||
config.jsonc
|
||||
images/*
|
12859
.pnp.cjs
generated
Executable file
12859
.pnp.cjs
generated
Executable file
File diff suppressed because one or more lines are too long
266
.pnp.loader.mjs
generated
Normal file
266
.pnp.loader.mjs
generated
Normal file
|
@ -0,0 +1,266 @@
|
|||
import { URL, fileURLToPath, pathToFileURL } from 'url';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import moduleExports, { Module } from 'module';
|
||||
|
||||
var PathType;
|
||||
(function(PathType2) {
|
||||
PathType2[PathType2["File"] = 0] = "File";
|
||||
PathType2[PathType2["Portable"] = 1] = "Portable";
|
||||
PathType2[PathType2["Native"] = 2] = "Native";
|
||||
})(PathType || (PathType = {}));
|
||||
const npath = Object.create(path);
|
||||
const ppath = Object.create(path.posix);
|
||||
npath.cwd = () => process.cwd();
|
||||
ppath.cwd = () => toPortablePath(process.cwd());
|
||||
ppath.resolve = (...segments) => {
|
||||
if (segments.length > 0 && ppath.isAbsolute(segments[0])) {
|
||||
return path.posix.resolve(...segments);
|
||||
} else {
|
||||
return path.posix.resolve(ppath.cwd(), ...segments);
|
||||
}
|
||||
};
|
||||
const contains = function(pathUtils, from, to) {
|
||||
from = pathUtils.normalize(from);
|
||||
to = pathUtils.normalize(to);
|
||||
if (from === to)
|
||||
return `.`;
|
||||
if (!from.endsWith(pathUtils.sep))
|
||||
from = from + pathUtils.sep;
|
||||
if (to.startsWith(from)) {
|
||||
return to.slice(from.length);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
npath.fromPortablePath = fromPortablePath;
|
||||
npath.toPortablePath = toPortablePath;
|
||||
npath.contains = (from, to) => contains(npath, from, to);
|
||||
ppath.contains = (from, to) => contains(ppath, from, to);
|
||||
const WINDOWS_PATH_REGEXP = /^([a-zA-Z]:.*)$/;
|
||||
const UNC_WINDOWS_PATH_REGEXP = /^\/\/(\.\/)?(.*)$/;
|
||||
const PORTABLE_PATH_REGEXP = /^\/([a-zA-Z]:.*)$/;
|
||||
const UNC_PORTABLE_PATH_REGEXP = /^\/unc\/(\.dot\/)?(.*)$/;
|
||||
function fromPortablePath(p) {
|
||||
if (process.platform !== `win32`)
|
||||
return p;
|
||||
let portablePathMatch, uncPortablePathMatch;
|
||||
if (portablePathMatch = p.match(PORTABLE_PATH_REGEXP))
|
||||
p = portablePathMatch[1];
|
||||
else if (uncPortablePathMatch = p.match(UNC_PORTABLE_PATH_REGEXP))
|
||||
p = `\\\\${uncPortablePathMatch[1] ? `.\\` : ``}${uncPortablePathMatch[2]}`;
|
||||
else
|
||||
return p;
|
||||
return p.replace(/\//g, `\\`);
|
||||
}
|
||||
function toPortablePath(p) {
|
||||
if (process.platform !== `win32`)
|
||||
return p;
|
||||
p = p.replace(/\\/g, `/`);
|
||||
let windowsPathMatch, uncWindowsPathMatch;
|
||||
if (windowsPathMatch = p.match(WINDOWS_PATH_REGEXP))
|
||||
p = `/${windowsPathMatch[1]}`;
|
||||
else if (uncWindowsPathMatch = p.match(UNC_WINDOWS_PATH_REGEXP))
|
||||
p = `/unc/${uncWindowsPathMatch[1] ? `.dot/` : ``}${uncWindowsPathMatch[2]}`;
|
||||
return p;
|
||||
}
|
||||
|
||||
const builtinModules = new Set(Module.builtinModules || Object.keys(process.binding(`natives`)));
|
||||
const isBuiltinModule = (request) => request.startsWith(`node:`) || builtinModules.has(request);
|
||||
function readPackageScope(checkPath) {
|
||||
const rootSeparatorIndex = checkPath.indexOf(npath.sep);
|
||||
let separatorIndex;
|
||||
do {
|
||||
separatorIndex = checkPath.lastIndexOf(npath.sep);
|
||||
checkPath = checkPath.slice(0, separatorIndex);
|
||||
if (checkPath.endsWith(`${npath.sep}node_modules`))
|
||||
return false;
|
||||
const pjson = readPackage(checkPath + npath.sep);
|
||||
if (pjson) {
|
||||
return {
|
||||
data: pjson,
|
||||
path: checkPath
|
||||
};
|
||||
}
|
||||
} while (separatorIndex > rootSeparatorIndex);
|
||||
return false;
|
||||
}
|
||||
function readPackage(requestPath) {
|
||||
const jsonPath = npath.resolve(requestPath, `package.json`);
|
||||
if (!fs.existsSync(jsonPath))
|
||||
return null;
|
||||
return JSON.parse(fs.readFileSync(jsonPath, `utf8`));
|
||||
}
|
||||
|
||||
async function tryReadFile(path2) {
|
||||
try {
|
||||
return await fs.promises.readFile(path2, `utf8`);
|
||||
} catch (error) {
|
||||
if (error.code === `ENOENT`)
|
||||
return null;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
function tryParseURL(str, base) {
|
||||
try {
|
||||
return new URL(str, base);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function getFileFormat(filepath) {
|
||||
var _a, _b;
|
||||
const ext = path.extname(filepath);
|
||||
switch (ext) {
|
||||
case `.mjs`: {
|
||||
return `module`;
|
||||
}
|
||||
case `.cjs`: {
|
||||
return `commonjs`;
|
||||
}
|
||||
case `.wasm`: {
|
||||
throw new Error(`Unknown file extension ".wasm" for ${filepath}`);
|
||||
}
|
||||
case `.json`: {
|
||||
throw new Error(`Unknown file extension ".json" for ${filepath}`);
|
||||
}
|
||||
case `.js`: {
|
||||
const pkg = readPackageScope(filepath);
|
||||
if (!pkg)
|
||||
return `commonjs`;
|
||||
return (_a = pkg.data.type) != null ? _a : `commonjs`;
|
||||
}
|
||||
default: {
|
||||
const isMain = process.argv[1] === filepath;
|
||||
if (!isMain)
|
||||
return null;
|
||||
const pkg = readPackageScope(filepath);
|
||||
if (!pkg)
|
||||
return `commonjs`;
|
||||
if (pkg.data.type === `module`)
|
||||
return null;
|
||||
return (_b = pkg.data.type) != null ? _b : `commonjs`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function getFormat$1(resolved, context, defaultGetFormat) {
|
||||
const url = tryParseURL(resolved);
|
||||
if ((url == null ? void 0 : url.protocol) !== `file:`)
|
||||
return defaultGetFormat(resolved, context, defaultGetFormat);
|
||||
const format = getFileFormat(fileURLToPath(url));
|
||||
if (format) {
|
||||
return {
|
||||
format
|
||||
};
|
||||
}
|
||||
return defaultGetFormat(resolved, context, defaultGetFormat);
|
||||
}
|
||||
|
||||
async function getSource$1(urlString, context, defaultGetSource) {
|
||||
const url = tryParseURL(urlString);
|
||||
if ((url == null ? void 0 : url.protocol) !== `file:`)
|
||||
return defaultGetSource(urlString, context, defaultGetSource);
|
||||
return {
|
||||
source: await fs.promises.readFile(fileURLToPath(url), `utf8`)
|
||||
};
|
||||
}
|
||||
|
||||
async function load$1(urlString, context, defaultLoad) {
|
||||
const url = tryParseURL(urlString);
|
||||
if ((url == null ? void 0 : url.protocol) !== `file:`)
|
||||
return defaultLoad(urlString, context, defaultLoad);
|
||||
const filePath = fileURLToPath(url);
|
||||
const format = getFileFormat(filePath);
|
||||
if (!format)
|
||||
return defaultLoad(urlString, context, defaultLoad);
|
||||
return {
|
||||
format,
|
||||
source: await fs.promises.readFile(filePath, `utf8`)
|
||||
};
|
||||
}
|
||||
|
||||
const pathRegExp = /^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/;
|
||||
const isRelativeRegexp = /^\.{0,2}\//;
|
||||
async function resolve$1(originalSpecifier, context, defaultResolver) {
|
||||
var _a;
|
||||
const {findPnpApi} = moduleExports;
|
||||
if (!findPnpApi || isBuiltinModule(originalSpecifier))
|
||||
return defaultResolver(originalSpecifier, context, defaultResolver);
|
||||
let specifier = originalSpecifier;
|
||||
const url = tryParseURL(specifier, isRelativeRegexp.test(specifier) ? context.parentURL : void 0);
|
||||
if (url) {
|
||||
if (url.protocol !== `file:`)
|
||||
return defaultResolver(originalSpecifier, context, defaultResolver);
|
||||
specifier = fileURLToPath(url);
|
||||
}
|
||||
const {parentURL, conditions = []} = context;
|
||||
const issuer = parentURL ? fileURLToPath(parentURL) : process.cwd();
|
||||
const pnpapi = (_a = findPnpApi(issuer)) != null ? _a : url ? findPnpApi(specifier) : null;
|
||||
if (!pnpapi)
|
||||
return defaultResolver(originalSpecifier, context, defaultResolver);
|
||||
const dependencyNameMatch = specifier.match(pathRegExp);
|
||||
let allowLegacyResolve = false;
|
||||
if (dependencyNameMatch) {
|
||||
const [, dependencyName, subPath] = dependencyNameMatch;
|
||||
if (subPath === ``) {
|
||||
const resolved = pnpapi.resolveToUnqualified(`${dependencyName}/package.json`, issuer);
|
||||
if (resolved) {
|
||||
const content = await tryReadFile(resolved);
|
||||
if (content) {
|
||||
const pkg = JSON.parse(content);
|
||||
allowLegacyResolve = pkg.exports == null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const result = pnpapi.resolveRequest(specifier, issuer, {
|
||||
conditions: new Set(conditions),
|
||||
extensions: allowLegacyResolve ? void 0 : []
|
||||
});
|
||||
if (!result)
|
||||
throw new Error(`Resolving '${specifier}' from '${issuer}' failed`);
|
||||
const resultURL = pathToFileURL(result);
|
||||
if (url) {
|
||||
resultURL.search = url.search;
|
||||
resultURL.hash = url.hash;
|
||||
}
|
||||
return {
|
||||
url: resultURL.href
|
||||
};
|
||||
}
|
||||
|
||||
const binding = process.binding(`fs`);
|
||||
const originalfstat = binding.fstat;
|
||||
const ZIP_FD = 2147483648;
|
||||
binding.fstat = function(...args) {
|
||||
const [fd, useBigint, req] = args;
|
||||
if ((fd & ZIP_FD) !== 0 && useBigint === false && req === void 0) {
|
||||
try {
|
||||
const stats = fs.fstatSync(fd);
|
||||
return new Float64Array([
|
||||
stats.dev,
|
||||
stats.mode,
|
||||
stats.nlink,
|
||||
stats.uid,
|
||||
stats.gid,
|
||||
stats.rdev,
|
||||
stats.blksize,
|
||||
stats.ino,
|
||||
stats.size,
|
||||
stats.blocks
|
||||
]);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
return originalfstat.apply(this, args);
|
||||
};
|
||||
|
||||
const [major, minor] = process.versions.node.split(`.`).map((value) => parseInt(value, 10));
|
||||
const hasConsolidatedHooks = major > 16 || major === 16 && minor >= 12;
|
||||
const resolve = resolve$1;
|
||||
const getFormat = hasConsolidatedHooks ? void 0 : getFormat$1;
|
||||
const getSource = hasConsolidatedHooks ? void 0 : getSource$1;
|
||||
const load = hasConsolidatedHooks ? load$1 : void 0;
|
||||
|
||||
export { getFormat, getSource, load, resolve };
|
7
.vscode/extensions.json
vendored
Normal file
7
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"recommendations": [
|
||||
"arcanis.vscode-zipfs",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
10
.vscode/settings.json
vendored
Normal file
10
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"search.exclude": {
|
||||
"**/.yarn": true,
|
||||
"**/.pnp.*": true
|
||||
},
|
||||
"eslint.nodePath": ".yarn/sdks",
|
||||
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",
|
||||
"typescript.tsdk": ".yarn/sdks/typescript/lib",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true
|
||||
}
|
BIN
.yarn/cache/@types-node-npm-17.0.31-d8d26aa013-704618350f.zip
vendored
Normal file
BIN
.yarn/cache/@types-node-npm-17.0.31-d8d26aa013-704618350f.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/booru-npm-2.5.6-436ebd79a7-4c5d9b9060.zip
vendored
Normal file
BIN
.yarn/cache/booru-npm-2.5.6-436ebd79a7-4c5d9b9060.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/command-line-usage-npm-6.1.3-145c2dabe1-8261d4e553.zip
vendored
Normal file
BIN
.yarn/cache/command-line-usage-npm-6.1.3-145c2dabe1-8261d4e553.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/got-cjs-npm-12.0.4-7150d32ca6-52a4a9a043.zip
vendored
Normal file
BIN
.yarn/cache/got-cjs-npm-12.0.4-7150d32ca6-52a4a9a043.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
20
.yarn/sdks/eslint/bin/eslint.js
vendored
Executable file
20
.yarn/sdks/eslint/bin/eslint.js
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require eslint/bin/eslint.js
|
||||
require(absPnpApiPath).setup();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real eslint/bin/eslint.js your application uses
|
||||
module.exports = absRequire(`eslint/bin/eslint.js`);
|
20
.yarn/sdks/eslint/lib/api.js
vendored
Normal file
20
.yarn/sdks/eslint/lib/api.js
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require eslint
|
||||
require(absPnpApiPath).setup();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real eslint your application uses
|
||||
module.exports = absRequire(`eslint`);
|
6
.yarn/sdks/eslint/package.json
vendored
Normal file
6
.yarn/sdks/eslint/package.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "eslint",
|
||||
"version": "8.15.0-sdk",
|
||||
"main": "./lib/api.js",
|
||||
"type": "commonjs"
|
||||
}
|
5
.yarn/sdks/integrations.yml
vendored
Normal file
5
.yarn/sdks/integrations.yml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# This file is automatically generated by @yarnpkg/sdks.
|
||||
# Manual changes might be lost!
|
||||
|
||||
integrations:
|
||||
- vscode
|
20
.yarn/sdks/prettier/index.js
vendored
Executable file
20
.yarn/sdks/prettier/index.js
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require prettier/index.js
|
||||
require(absPnpApiPath).setup();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real prettier/index.js your application uses
|
||||
module.exports = absRequire(`prettier/index.js`);
|
6
.yarn/sdks/prettier/package.json
vendored
Normal file
6
.yarn/sdks/prettier/package.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "prettier",
|
||||
"version": "2.6.2-sdk",
|
||||
"main": "./index.js",
|
||||
"type": "commonjs"
|
||||
}
|
20
.yarn/sdks/typescript/bin/tsc
vendored
Executable file
20
.yarn/sdks/typescript/bin/tsc
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/bin/tsc
|
||||
require(absPnpApiPath).setup();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real typescript/bin/tsc your application uses
|
||||
module.exports = absRequire(`typescript/bin/tsc`);
|
20
.yarn/sdks/typescript/bin/tsserver
vendored
Executable file
20
.yarn/sdks/typescript/bin/tsserver
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/bin/tsserver
|
||||
require(absPnpApiPath).setup();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real typescript/bin/tsserver your application uses
|
||||
module.exports = absRequire(`typescript/bin/tsserver`);
|
20
.yarn/sdks/typescript/lib/tsc.js
vendored
Normal file
20
.yarn/sdks/typescript/lib/tsc.js
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/lib/tsc.js
|
||||
require(absPnpApiPath).setup();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real typescript/lib/tsc.js your application uses
|
||||
module.exports = absRequire(`typescript/lib/tsc.js`);
|
208
.yarn/sdks/typescript/lib/tsserver.js
vendored
Normal file
208
.yarn/sdks/typescript/lib/tsserver.js
vendored
Normal file
|
@ -0,0 +1,208 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
const moduleWrapper = tsserver => {
|
||||
if (!process.versions.pnp) {
|
||||
return tsserver;
|
||||
}
|
||||
|
||||
const {isAbsolute} = require(`path`);
|
||||
const pnpApi = require(`pnpapi`);
|
||||
|
||||
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
|
||||
const isPortal = str => str.startsWith("portal:/");
|
||||
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
|
||||
|
||||
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
|
||||
return `${locator.name}@${locator.reference}`;
|
||||
}));
|
||||
|
||||
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
|
||||
// doesn't understand. This layer makes sure to remove the protocol
|
||||
// before forwarding it to TS, and to add it back on all returned paths.
|
||||
|
||||
function toEditorPath(str) {
|
||||
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
|
||||
if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
|
||||
// We also take the opportunity to turn virtual paths into physical ones;
|
||||
// this makes it much easier to work with workspaces that list peer
|
||||
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
|
||||
// file instances instead of the real ones.
|
||||
//
|
||||
// We only do this to modules owned by the the dependency tree roots.
|
||||
// This avoids breaking the resolution when jumping inside a vendor
|
||||
// with peer dep (otherwise jumping into react-dom would show resolution
|
||||
// errors on react).
|
||||
//
|
||||
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
|
||||
if (resolved) {
|
||||
const locator = pnpApi.findPackageLocator(resolved);
|
||||
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
|
||||
str = resolved;
|
||||
}
|
||||
}
|
||||
|
||||
str = normalize(str);
|
||||
|
||||
if (str.match(/\.zip\//)) {
|
||||
switch (hostInfo) {
|
||||
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
||||
// VSCode only adds it automatically for supported schemes,
|
||||
// so we have to do it manually for the `zip` scheme.
|
||||
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
||||
//
|
||||
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
||||
//
|
||||
// Update 2021-10-08: VSCode changed their format in 1.61.
|
||||
// Before | ^zip:/c:/foo/bar.zip/package.json
|
||||
// After | ^/zip//c:/foo/bar.zip/package.json
|
||||
//
|
||||
// Update 2022-04-06: VSCode changed the format in 1.66.
|
||||
// Before | ^/zip//c:/foo/bar.zip/package.json
|
||||
// After | ^/zip/c:/foo/bar.zip/package.json
|
||||
//
|
||||
case `vscode <1.61`: {
|
||||
str = `^zip:${str}`;
|
||||
} break;
|
||||
|
||||
case `vscode <1.66`: {
|
||||
str = `^/zip/${str}`;
|
||||
} break;
|
||||
|
||||
case `vscode`: {
|
||||
str = `^/zip${str}`;
|
||||
} break;
|
||||
|
||||
// To make "go to definition" work,
|
||||
// We have to resolve the actual file system path from virtual path
|
||||
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
|
||||
case `coc-nvim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = resolve(`zipfile:${str}`);
|
||||
} break;
|
||||
|
||||
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
|
||||
// We have to resolve the actual file system path from virtual path,
|
||||
// everything else is up to neovim
|
||||
case `neovim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = `zipfile://${str}`;
|
||||
} break;
|
||||
|
||||
default: {
|
||||
str = `zip:${str}`;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function fromEditorPath(str) {
|
||||
switch (hostInfo) {
|
||||
case `coc-nvim`: {
|
||||
str = str.replace(/\.zip::/, `.zip/`);
|
||||
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
|
||||
// So in order to convert it back, we use .* to match all the thing
|
||||
// before `zipfile:`
|
||||
return process.platform === `win32`
|
||||
? str.replace(/^.*zipfile:\//, ``)
|
||||
: str.replace(/^.*zipfile:/, ``);
|
||||
} break;
|
||||
|
||||
case `neovim`: {
|
||||
str = str.replace(/\.zip::/, `.zip/`);
|
||||
// The path for neovim is in format of zipfile:///<pwd>/.yarn/...
|
||||
return str.replace(/^zipfile:\/\//, ``);
|
||||
} break;
|
||||
|
||||
case `vscode`:
|
||||
default: {
|
||||
return process.platform === `win32`
|
||||
? str.replace(/^\^?(zip:|\/zip)\/+/, ``)
|
||||
: str.replace(/^\^?(zip:|\/zip)\/+/, `/`);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// Force enable 'allowLocalPluginLoads'
|
||||
// TypeScript tries to resolve plugins using a path relative to itself
|
||||
// which doesn't work when using the global cache
|
||||
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
|
||||
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
|
||||
// TypeScript already does local loads and if this code is running the user trusts the workspace
|
||||
// https://github.com/microsoft/vscode/issues/45856
|
||||
const ConfiguredProject = tsserver.server.ConfiguredProject;
|
||||
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
|
||||
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
|
||||
this.projectService.allowLocalPluginLoads = true;
|
||||
return originalEnablePluginsWithOptions.apply(this, arguments);
|
||||
};
|
||||
|
||||
// And here is the point where we hijack the VSCode <-> TS communications
|
||||
// by adding ourselves in the middle. We locate everything that looks
|
||||
// like an absolute path of ours and normalize it.
|
||||
|
||||
const Session = tsserver.server.Session;
|
||||
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
|
||||
let hostInfo = `unknown`;
|
||||
|
||||
Object.assign(Session.prototype, {
|
||||
onMessage(/** @type {string | object} */ message) {
|
||||
const isStringMessage = typeof message === 'string';
|
||||
const parsedMessage = isStringMessage ? JSON.parse(message) : message;
|
||||
|
||||
if (
|
||||
parsedMessage != null &&
|
||||
typeof parsedMessage === `object` &&
|
||||
parsedMessage.arguments &&
|
||||
typeof parsedMessage.arguments.hostInfo === `string`
|
||||
) {
|
||||
hostInfo = parsedMessage.arguments.hostInfo;
|
||||
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
|
||||
if (/(\/|-)1\.([1-5][0-9]|60)\./.test(process.env.VSCODE_IPC_HOOK)) {
|
||||
hostInfo += ` <1.61`;
|
||||
} else if (/(\/|-)1\.(6[1-5])\./.test(process.env.VSCODE_IPC_HOOK)) {
|
||||
hostInfo += ` <1.66`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
|
||||
return typeof value === 'string' ? fromEditorPath(value) : value;
|
||||
});
|
||||
|
||||
return originalOnMessage.call(
|
||||
this,
|
||||
isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
|
||||
);
|
||||
},
|
||||
|
||||
send(/** @type {any} */ msg) {
|
||||
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
|
||||
return typeof value === `string` ? toEditorPath(value) : value;
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
||||
return tsserver;
|
||||
};
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/lib/tsserver.js
|
||||
require(absPnpApiPath).setup();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real typescript/lib/tsserver.js your application uses
|
||||
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));
|
208
.yarn/sdks/typescript/lib/tsserverlibrary.js
vendored
Normal file
208
.yarn/sdks/typescript/lib/tsserverlibrary.js
vendored
Normal file
|
@ -0,0 +1,208 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
const moduleWrapper = tsserver => {
|
||||
if (!process.versions.pnp) {
|
||||
return tsserver;
|
||||
}
|
||||
|
||||
const {isAbsolute} = require(`path`);
|
||||
const pnpApi = require(`pnpapi`);
|
||||
|
||||
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
|
||||
const isPortal = str => str.startsWith("portal:/");
|
||||
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
|
||||
|
||||
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
|
||||
return `${locator.name}@${locator.reference}`;
|
||||
}));
|
||||
|
||||
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
|
||||
// doesn't understand. This layer makes sure to remove the protocol
|
||||
// before forwarding it to TS, and to add it back on all returned paths.
|
||||
|
||||
function toEditorPath(str) {
|
||||
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
|
||||
if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
|
||||
// We also take the opportunity to turn virtual paths into physical ones;
|
||||
// this makes it much easier to work with workspaces that list peer
|
||||
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
|
||||
// file instances instead of the real ones.
|
||||
//
|
||||
// We only do this to modules owned by the the dependency tree roots.
|
||||
// This avoids breaking the resolution when jumping inside a vendor
|
||||
// with peer dep (otherwise jumping into react-dom would show resolution
|
||||
// errors on react).
|
||||
//
|
||||
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
|
||||
if (resolved) {
|
||||
const locator = pnpApi.findPackageLocator(resolved);
|
||||
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
|
||||
str = resolved;
|
||||
}
|
||||
}
|
||||
|
||||
str = normalize(str);
|
||||
|
||||
if (str.match(/\.zip\//)) {
|
||||
switch (hostInfo) {
|
||||
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
||||
// VSCode only adds it automatically for supported schemes,
|
||||
// so we have to do it manually for the `zip` scheme.
|
||||
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
||||
//
|
||||
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
||||
//
|
||||
// Update 2021-10-08: VSCode changed their format in 1.61.
|
||||
// Before | ^zip:/c:/foo/bar.zip/package.json
|
||||
// After | ^/zip//c:/foo/bar.zip/package.json
|
||||
//
|
||||
// Update 2022-04-06: VSCode changed the format in 1.66.
|
||||
// Before | ^/zip//c:/foo/bar.zip/package.json
|
||||
// After | ^/zip/c:/foo/bar.zip/package.json
|
||||
//
|
||||
case `vscode <1.61`: {
|
||||
str = `^zip:${str}`;
|
||||
} break;
|
||||
|
||||
case `vscode <1.66`: {
|
||||
str = `^/zip/${str}`;
|
||||
} break;
|
||||
|
||||
case `vscode`: {
|
||||
str = `^/zip${str}`;
|
||||
} break;
|
||||
|
||||
// To make "go to definition" work,
|
||||
// We have to resolve the actual file system path from virtual path
|
||||
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
|
||||
case `coc-nvim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = resolve(`zipfile:${str}`);
|
||||
} break;
|
||||
|
||||
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
|
||||
// We have to resolve the actual file system path from virtual path,
|
||||
// everything else is up to neovim
|
||||
case `neovim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = `zipfile://${str}`;
|
||||
} break;
|
||||
|
||||
default: {
|
||||
str = `zip:${str}`;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function fromEditorPath(str) {
|
||||
switch (hostInfo) {
|
||||
case `coc-nvim`: {
|
||||
str = str.replace(/\.zip::/, `.zip/`);
|
||||
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
|
||||
// So in order to convert it back, we use .* to match all the thing
|
||||
// before `zipfile:`
|
||||
return process.platform === `win32`
|
||||
? str.replace(/^.*zipfile:\//, ``)
|
||||
: str.replace(/^.*zipfile:/, ``);
|
||||
} break;
|
||||
|
||||
case `neovim`: {
|
||||
str = str.replace(/\.zip::/, `.zip/`);
|
||||
// The path for neovim is in format of zipfile:///<pwd>/.yarn/...
|
||||
return str.replace(/^zipfile:\/\//, ``);
|
||||
} break;
|
||||
|
||||
case `vscode`:
|
||||
default: {
|
||||
return process.platform === `win32`
|
||||
? str.replace(/^\^?(zip:|\/zip)\/+/, ``)
|
||||
: str.replace(/^\^?(zip:|\/zip)\/+/, `/`);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// Force enable 'allowLocalPluginLoads'
|
||||
// TypeScript tries to resolve plugins using a path relative to itself
|
||||
// which doesn't work when using the global cache
|
||||
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
|
||||
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
|
||||
// TypeScript already does local loads and if this code is running the user trusts the workspace
|
||||
// https://github.com/microsoft/vscode/issues/45856
|
||||
const ConfiguredProject = tsserver.server.ConfiguredProject;
|
||||
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
|
||||
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
|
||||
this.projectService.allowLocalPluginLoads = true;
|
||||
return originalEnablePluginsWithOptions.apply(this, arguments);
|
||||
};
|
||||
|
||||
// And here is the point where we hijack the VSCode <-> TS communications
|
||||
// by adding ourselves in the middle. We locate everything that looks
|
||||
// like an absolute path of ours and normalize it.
|
||||
|
||||
const Session = tsserver.server.Session;
|
||||
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
|
||||
let hostInfo = `unknown`;
|
||||
|
||||
Object.assign(Session.prototype, {
|
||||
onMessage(/** @type {string | object} */ message) {
|
||||
const isStringMessage = typeof message === 'string';
|
||||
const parsedMessage = isStringMessage ? JSON.parse(message) : message;
|
||||
|
||||
if (
|
||||
parsedMessage != null &&
|
||||
typeof parsedMessage === `object` &&
|
||||
parsedMessage.arguments &&
|
||||
typeof parsedMessage.arguments.hostInfo === `string`
|
||||
) {
|
||||
hostInfo = parsedMessage.arguments.hostInfo;
|
||||
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
|
||||
if (/(\/|-)1\.([1-5][0-9]|60)\./.test(process.env.VSCODE_IPC_HOOK)) {
|
||||
hostInfo += ` <1.61`;
|
||||
} else if (/(\/|-)1\.(6[1-5])\./.test(process.env.VSCODE_IPC_HOOK)) {
|
||||
hostInfo += ` <1.66`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
|
||||
return typeof value === 'string' ? fromEditorPath(value) : value;
|
||||
});
|
||||
|
||||
return originalOnMessage.call(
|
||||
this,
|
||||
isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
|
||||
);
|
||||
},
|
||||
|
||||
send(/** @type {any} */ msg) {
|
||||
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
|
||||
return typeof value === `string` ? toEditorPath(value) : value;
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
||||
return tsserver;
|
||||
};
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
|
||||
require(absPnpApiPath).setup();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real typescript/lib/tsserverlibrary.js your application uses
|
||||
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`));
|
20
.yarn/sdks/typescript/lib/typescript.js
vendored
Normal file
20
.yarn/sdks/typescript/lib/typescript.js
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/lib/typescript.js
|
||||
require(absPnpApiPath).setup();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real typescript/lib/typescript.js your application uses
|
||||
module.exports = absRequire(`typescript/lib/typescript.js`);
|
6
.yarn/sdks/typescript/package.json
vendored
Normal file
6
.yarn/sdks/typescript/package.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "typescript",
|
||||
"version": "4.6.4-sdk",
|
||||
"main": "./lib/typescript.js",
|
||||
"type": "commonjs"
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
nodeLinker: node-modules
|
||||
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
|
|
25
LICENSE
25
LICENSE
|
@ -1,9 +1,24 @@
|
|||
MIT License
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Copyright (c) 2022 Sam Therapy
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
For more information, please refer to <http://unlicense.org/>
|
13
README.md
13
README.md
|
@ -1,6 +1,6 @@
|
|||
# fediverse-imagebot
|
||||
|
||||
[![Build Status](https://ci.git.froth.zone/api/badges/Sam/fediverse-imagebot/status.svg)](https://ci.git.froth.zone/Sam/fediverse-imagebot)
|
||||
[![Build Status](https://ci.git.froth.zone/api/badges/sam/fediverse-imagebot/status.svg)](https://ci.git.froth.zone/sam/fediverse-imagebot)
|
||||
|
||||
A bot that posts local and booru images to the Fediverse.
|
||||
|
||||
|
@ -8,7 +8,7 @@ Compatible with Mastodon, Misskey and Pleroma!
|
|||
|
||||
## MIGRATING MAJOR VERSIONS
|
||||
|
||||
See [the wiki](https://git.froth.zone/Sam/fediverse-imagebot/wiki/Migrating).
|
||||
See [the wiki](https://git.froth.zone/sam/fediverse-imagebot/wiki/Migrating).
|
||||
|
||||
## Boorus supported
|
||||
|
||||
|
@ -20,14 +20,14 @@ There are currently two ways to do this, either with a pre-built binary or build
|
|||
|
||||
### Downloading pre-built binaries
|
||||
|
||||
Download prebuilt binaries from [here](https://git.froth.zone/Sam/fediverse-imagebot/releases/latest). (currently supports x86_64 and arm64 on Linux
|
||||
Download prebuilt binaries from [here](https://git.froth.zone/sam/fediverse-imagebot/releases/latest). (currently supports x86_64 and arm64 on Linux
|
||||
[glibc or musl], macOS and Windows)
|
||||
|
||||
1. Run the bot with the `-w` flag to have it generate a configuration file to the local directory.
|
||||
|
||||
2. Edit it for your use case.
|
||||
|
||||
- If you want to generate a key you can use https://git.froth.zone/Sam/js-feditoken
|
||||
- If you want to generate a key you can use https://git.froth.zone/sam/js-feditoken
|
||||
|
||||
3. Run the bot by launching the executable!
|
||||
|
||||
|
@ -42,7 +42,7 @@ Download prebuilt binaries from [here](https://git.froth.zone/Sam/fediverse-imag
|
|||
Check https://yarnpkg.com/getting-started/install for more information.
|
||||
|
||||
3. Clone the repository: \
|
||||
`git clone https://git.froth.zone/Sam/fediverse-imagebot.git`
|
||||
`git clone https://git.froth.zone/sam/fediverse-imagebot.git`
|
||||
|
||||
4. Install dependencies: \
|
||||
`yarn`
|
||||
|
@ -52,7 +52,8 @@ Download prebuilt binaries from [here](https://git.froth.zone/Sam/fediverse-imag
|
|||
|
||||
6. Edit the config file: \
|
||||
`cp config.sample.jsonc config.jsonc`
|
||||
- If you want to generate a key you can use https://git.froth.zone/Sam/js-feditoken
|
||||
|
||||
- If you want to generate a key you can use https://git.froth.zone/sam/js-feditoken
|
||||
|
||||
7. Run the bot: \
|
||||
`yarn bot`
|
||||
|
|
16
package.json
16
package.json
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"booru": "^2.5.3",
|
||||
"booru": "^2.5.6",
|
||||
"command-line-args": "^5.2.1",
|
||||
"command-line-usage": "^6.1.1",
|
||||
"got-cjs": "^12.0.1",
|
||||
"command-line-usage": "^6.1.3",
|
||||
"got-cjs": "^12.0.4",
|
||||
"megalodon": "^4.0.1",
|
||||
"strip-json-comments": "^4.0.0",
|
||||
"typescript": "^4.6.2"
|
||||
"strip-json-comments": "3.1.1",
|
||||
"typescript": "^4.6.4"
|
||||
},
|
||||
"name": "fediverse-imagebot",
|
||||
"version": "2.0.0",
|
||||
|
@ -21,17 +21,17 @@
|
|||
"clean": "rm -rf dist",
|
||||
"lint": "eslint --ext .ts ./src --fix && prettier --write ./src",
|
||||
"lint:ci": "eslint --ext .ts,.js ./src && prettier ./src --check",
|
||||
"bot": "node ./dist/index.js",
|
||||
"bot": "yarn node ./dist/index.js",
|
||||
"package": "pkg . -C Gzip",
|
||||
"test": "echo \"No tests yet!\" && exit 0"
|
||||
},
|
||||
"repository": "https://git.froth.zone/Sam/fediverse-imagebot",
|
||||
"author": "Sam Therapy <sam@samtherapy.net>",
|
||||
"license": "MIT",
|
||||
"license": "Unlicense",
|
||||
"devDependencies": {
|
||||
"@types/command-line-args": "5.2.0",
|
||||
"@types/command-line-usage": "5.0.2",
|
||||
"@types/node": "17.0.21",
|
||||
"@types/node": "17.0.31",
|
||||
"@types/node-fetch": "2.6.1",
|
||||
"@typescript-eslint/eslint-plugin": "5.22.0",
|
||||
"@typescript-eslint/parser": "5.22.0",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:base"
|
||||
]
|
||||
"extends": ["config:base"],
|
||||
"rangeStrategy": "pin"
|
||||
}
|
||||
|
|
|
@ -4,8 +4,7 @@ import args from "./cli.js";
|
|||
/**
|
||||
* The function that gets called when the program runs into an error.
|
||||
* @param msg Custom error message
|
||||
* @param e Error object passed in from the error handler (optional),
|
||||
* only displays when `args.verbose` is true
|
||||
* @param e Error object passed in from the error handler
|
||||
* @returns This function will never return.
|
||||
*/
|
||||
export default function crashHandler(msg: string, e: Error) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { config } from "./helpers/types.js";
|
|||
* Uploads an image to a fediverse instance
|
||||
* @param image The image to upload
|
||||
* @param sensitivity The sensitivity of the image
|
||||
* @param cfg Configuration object (see the type definition)
|
||||
* @param cfg {@link config} object
|
||||
* @returns { Promise<void> } Nothing
|
||||
*/
|
||||
export default async function postImage(
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"outDir": "./dist" /* Redirect output structure to the directory. */,
|
||||
"removeComments": true /* Do not emit comments to output. */,
|
||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
||||
"importHelpers": true /* Import emit helpers from 'tslib'. */,
|
||||
"importHelpers": false /* Import emit helpers from 'tslib'. */,
|
||||
"downlevelIteration": true /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */,
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
|
|
92
yarn.lock
92
yarn.lock
|
@ -103,7 +103,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@sindresorhus/is@npm:^4.2.0":
|
||||
"@sindresorhus/is@npm:^4.6.0":
|
||||
version: 4.6.0
|
||||
resolution: "@sindresorhus/is@npm:4.6.0"
|
||||
checksum: 83839f13da2c29d55c97abc3bc2c55b250d33a0447554997a85c539e058e57b8da092da396e252b11ec24a0279a0bed1f537fa26302209327060643e327f81d2
|
||||
|
@ -178,13 +178,20 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:*, @types/node@npm:17.0.21":
|
||||
"@types/node@npm:*":
|
||||
version: 17.0.21
|
||||
resolution: "@types/node@npm:17.0.21"
|
||||
checksum: 89dcd2fe82f21d3634266f8384e9c865cf8af49685639fbdbd799bdd1040480fb1e8eeda2d3b9fce41edbe704d2a4be9f427118c4ae872e8d9bb7cbeb3c41a94
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:17.0.31":
|
||||
version: 17.0.31
|
||||
resolution: "@types/node@npm:17.0.31"
|
||||
checksum: 704618350f8420d5c47db0f7778398e821b7724369946f5c441a7e6b9343295553936400eb8309f0b07d5e39c240988ab3456b983712ca86265dabc9aee4ad3d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/oauth@npm:^0.9.0":
|
||||
version: 0.9.1
|
||||
resolution: "@types/oauth@npm:0.9.1"
|
||||
|
@ -431,7 +438,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"array-back@npm:^4.0.1":
|
||||
"array-back@npm:^4.0.1, array-back@npm:^4.0.2":
|
||||
version: 4.0.2
|
||||
resolution: "array-back@npm:4.0.2"
|
||||
checksum: f30603270771eeb54e5aad5f54604c62b3577a18b6db212a7272b2b6c32049121b49431f656654790ed1469411e45f387e7627c0de8fd0515995cc40df9b9294
|
||||
|
@ -493,13 +500,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"booru@npm:^2.5.3":
|
||||
version: 2.5.3
|
||||
resolution: "booru@npm:2.5.3"
|
||||
"booru@npm:^2.5.6":
|
||||
version: 2.5.6
|
||||
resolution: "booru@npm:2.5.6"
|
||||
dependencies:
|
||||
fast-xml-parser: ^3.19.0
|
||||
node-fetch: ^2.6.1
|
||||
checksum: bd655ee1755f170d0d6a38622d86a5d397f7bb9a761b011953386fdb15236fe8d1c1ac28bc8ee6c493691cc85c638d9c0c8d13f20d096aeead65e004c84e9edd
|
||||
checksum: 4c5d9b90603436815a4225e78591897b71e497be0317db855706daa5dd46d52561ae08db09bb1df24a6acde22b2a8ef1d0f4055305fb020badcfd01b40e03b33
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -669,15 +676,15 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"command-line-usage@npm:^6.1.1":
|
||||
version: 6.1.1
|
||||
resolution: "command-line-usage@npm:6.1.1"
|
||||
"command-line-usage@npm:^6.1.3":
|
||||
version: 6.1.3
|
||||
resolution: "command-line-usage@npm:6.1.3"
|
||||
dependencies:
|
||||
array-back: ^4.0.1
|
||||
array-back: ^4.0.2
|
||||
chalk: ^2.4.2
|
||||
table-layout: ^1.0.1
|
||||
table-layout: ^1.0.2
|
||||
typical: ^5.2.0
|
||||
checksum: f84268a10449323cc838cec3eeaa962b0e63b93142bbeb9202e3e5406ecbbc91fd018d235a49088430f5b757fa1e9c086c3ca141583cfc3950d3fb366b0b2fed
|
||||
checksum: 8261d4e5536eb0bcddee0ec5e89c05bb2abd18e5760785c8078ede5020bc1c612cbe28eb6586f5ed4a3660689748e5aaad4a72f21566f4ef39393694e2fa1a0b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -1118,22 +1125,22 @@ __metadata:
|
|||
dependencies:
|
||||
"@types/command-line-args": 5.2.0
|
||||
"@types/command-line-usage": 5.0.2
|
||||
"@types/node": 17.0.21
|
||||
"@types/node": 17.0.31
|
||||
"@types/node-fetch": 2.6.1
|
||||
"@typescript-eslint/eslint-plugin": 5.22.0
|
||||
"@typescript-eslint/parser": 5.22.0
|
||||
booru: ^2.5.3
|
||||
booru: ^2.5.6
|
||||
command-line-args: ^5.2.1
|
||||
command-line-usage: ^6.1.1
|
||||
command-line-usage: ^6.1.3
|
||||
eslint: 8.15.0
|
||||
eslint-config-prettier: 8.5.0
|
||||
eslint-plugin-prettier: 4.0.0
|
||||
got-cjs: ^12.0.1
|
||||
got-cjs: ^12.0.4
|
||||
megalodon: ^4.0.1
|
||||
pkg: 5.6.0
|
||||
prettier: 2.6.2
|
||||
strip-json-comments: ^4.0.0
|
||||
typescript: ^4.6.2
|
||||
strip-json-comments: 3.1.1
|
||||
typescript: ^4.6.4
|
||||
bin:
|
||||
fediverse-imagebot: dist/index.js
|
||||
languageName: unknown
|
||||
|
@ -1373,11 +1380,11 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"got-cjs@npm:^12.0.1":
|
||||
version: 12.0.1
|
||||
resolution: "got-cjs@npm:12.0.1"
|
||||
"got-cjs@npm:^12.0.4":
|
||||
version: 12.0.4
|
||||
resolution: "got-cjs@npm:12.0.4"
|
||||
dependencies:
|
||||
"@sindresorhus/is": ^4.2.0
|
||||
"@sindresorhus/is": ^4.6.0
|
||||
"@szmarczak/http-timer": 4.0.6
|
||||
"@types/cacheable-request": ^6.0.2
|
||||
"@types/responselike": ^1.0.0
|
||||
|
@ -1386,11 +1393,11 @@ __metadata:
|
|||
decompress-response: ^6.0.0
|
||||
form-data-encoder: 1.7.1
|
||||
get-stream: ^6.0.1
|
||||
http2-wrapper: ^2.1.9
|
||||
http2-wrapper: ^2.1.10
|
||||
lowercase-keys: 2.0.0
|
||||
p-cancelable: 2.1.1
|
||||
responselike: ^2.0.0
|
||||
checksum: c27c71bf5e995f29dda9293cf7459ef8e06106515410cebb98c2c9ff775b5be709e43e169c91faae05bd25a551ceb6e20cd1e4e1106d0dccba949926adb78f46
|
||||
checksum: 52a4a9a043225b9ba102587b201d8f6e4d35c60e67885c371a5fc4360c6a30a1ec9aef88895e2416c1bcb7469ac8de717ec64c0496ad050dd5083d37cc12e887
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -1438,13 +1445,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"http2-wrapper@npm:^2.1.9":
|
||||
version: 2.1.10
|
||||
resolution: "http2-wrapper@npm:2.1.10"
|
||||
"http2-wrapper@npm:^2.1.10":
|
||||
version: 2.1.11
|
||||
resolution: "http2-wrapper@npm:2.1.11"
|
||||
dependencies:
|
||||
quick-lru: ^5.1.1
|
||||
resolve-alpn: ^1.2.0
|
||||
checksum: 54de29576081469998fe48a0de61026dc212373b7e9028fb1b3c393a0aba49610d53e4b8b35cb1d8e40e0c32925705d6c3fb7c7babf8c5ab7953c69149d0ab9d
|
||||
checksum: 5da05aa2c77226ac9cc82c616383f59c8f31b79897b02ecbe44b09714be1fca1f21bb184e672a669ca2830eefea4edac5f07e71c00cb5a8c5afec8e5a20cfaf7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -2465,20 +2472,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"strip-json-comments@npm:^3.1.0, strip-json-comments@npm:^3.1.1":
|
||||
"strip-json-comments@npm:3.1.1, strip-json-comments@npm:^3.1.0, strip-json-comments@npm:^3.1.1":
|
||||
version: 3.1.1
|
||||
resolution: "strip-json-comments@npm:3.1.1"
|
||||
checksum: 492f73e27268f9b1c122733f28ecb0e7e8d8a531a6662efbd08e22cccb3f9475e90a1b82cab06a392f6afae6d2de636f977e231296400d0ec5304ba70f166443
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"strip-json-comments@npm:^4.0.0":
|
||||
version: 4.0.0
|
||||
resolution: "strip-json-comments@npm:4.0.0"
|
||||
checksum: 26bd0fbedd631d673dc5382163efd39cffdff0b7fcaf61e522a1c6d976968811eff6b2d3a3d5fec1d7563efac516f45ced1352df1ab2cf4991cc93fcfb94d05a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"strip-json-comments@npm:~2.0.1":
|
||||
version: 2.0.1
|
||||
resolution: "strip-json-comments@npm:2.0.1"
|
||||
|
@ -2518,7 +2518,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"table-layout@npm:^1.0.1":
|
||||
"table-layout@npm:^1.0.2":
|
||||
version: 1.0.2
|
||||
resolution: "table-layout@npm:1.0.2"
|
||||
dependencies:
|
||||
|
@ -2654,13 +2654,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@npm:^4.6.2":
|
||||
version: 4.6.2
|
||||
resolution: "typescript@npm:4.6.2"
|
||||
"typescript@npm:^4.6.4":
|
||||
version: 4.6.4
|
||||
resolution: "typescript@npm:4.6.4"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 8a44ed7e6f6c4cb1ebe8cf236ecda2fb119d84dcf0fbd77e707b2dfea1bbcfc4e366493a143513ce7f57203c75da9d4e20af6fe46de89749366351046be7577c
|
||||
checksum: e7bfcc39cd4571a63a54e5ea21f16b8445268b9900bf55aee0e02ad981be576acc140eba24f1af5e3c1457767c96cea6d12861768fb386cf3ffb34013718631a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -2674,13 +2674,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@patch:typescript@^4.6.2#~builtin<compat/typescript>":
|
||||
version: 4.6.2
|
||||
resolution: "typescript@patch:typescript@npm%3A4.6.2#~builtin<compat/typescript>::version=4.6.2&hash=bda367"
|
||||
"typescript@patch:typescript@^4.6.4#~builtin<compat/typescript>":
|
||||
version: 4.6.4
|
||||
resolution: "typescript@patch:typescript@npm%3A4.6.4#~builtin<compat/typescript>::version=4.6.4&hash=bda367"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 40b493a71747fb89fa70df104e2c4a5e284b43750af5bea024090a5261cefa387f7a9372411b13030f7bf5555cee4275443d08805642ae5c74ef76740854a4c7
|
||||
checksum: 1cb434fbc637d347be90e3a0c6cd05e33c38f941713c8786d3031faf1842c2c148ba91d2fac01e7276b0ae3249b8633f1660e32686cc7a8c6a8fd5361dc52c66
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
|
Reference in a new issue