removed bloat and updated packages

This commit is contained in:
Philip Ahlqvist 2025-04-21 04:10:38 +02:00
parent 15ff3bd393
commit ac51344f5b
12 changed files with 432 additions and 7551 deletions

View file

@ -3,14 +3,14 @@
"@babel/env" "@babel/env"
], ],
"plugins": [ "plugins": [
"@babel/proposal-class-properties", // "@babel/proposal-class-properties",
"@babel/proposal-export-namespace-from", // "@babel/proposal-export-namespace-from",
"@babel/proposal-function-sent", // "@babel/proposal-function-sent",
"@babel/proposal-json-strings", // "@babel/proposal-json-strings",
"@babel/proposal-numeric-separator", // "@babel/proposal-numeric-separator",
"@babel/proposal-throw-expressions", // "@babel/proposal-throw-expressions",
"@babel/syntax-dynamic-import", // "@babel/syntax-dynamic-import",
"@babel/syntax-import-meta" // "@babel/syntax-import-meta"
], ],
"ignore": [ "ignore": [
"app/dist/*.js" "app/dist/*.js"

View file

@ -1,5 +1,5 @@
language: node_js language: node_js
node_js: node_js:
- "10.2" - "22"
before_install: before_install:
- npm i -g npm@latest - npm i -g npm@latest

View file

@ -4,10 +4,9 @@
// I M P O R T S // I M P O R T S
import decamelize from "decamelize"; // import decamelize from "decamelize";
import exists from "fs-exists-sync"; import fs from "fs";
import fm from "front-matter"; import fm from "front-matter";
import fs from "graceful-fs";
import html from "choo/html"; import html from "choo/html";
import m from "markdown-it"; import m from "markdown-it";
import markdownAnchor from "markdown-it-anchor"; import markdownAnchor from "markdown-it-anchor";
@ -65,10 +64,10 @@ function partialFinder(markdownBody) {
if (partials) { if (partials) {
for (const partial of partials) { for (const partial of partials) {
const filename = decamelize(partial, "-").replace("<", "") const filename = decamelize(partial).replace("<", "")
.replace("/>", "") .replace("/>", "")
.trim(); .trim();
const fileExistsTest = exists(`./app/components/${filename}.js`); const fileExistsTest = fs.existsSync(`./app/components/${filename}.js`);
if (!fileExistsTest) if (!fileExistsTest)
markdownBody = markdownBody.replace(partial, ""); markdownBody = markdownBody.replace(partial, "");
@ -95,3 +94,13 @@ function wikiFinder(markdownBody) {
match.input; match.input;
}); });
} }
function decamelize(str) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
return str
.replace(/([a-z])([A-Z])/g, '$1-$2')
.replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')
.toLowerCase();
}

View file

@ -4,7 +4,6 @@
// I M P O R T S // I M P O R T S
import dedent from "dedent";
import html from "choo/html"; import html from "choo/html";
import raw from "choo/html/raw"; import raw from "choo/html/raw";
@ -12,7 +11,7 @@ import raw from "choo/html/raw";
// E X P O R T // E X P O R T
export default () => dedent` export default () => html`
<section class="playground"> <section class="playground">
<ul class="playground-navigation"> <ul class="playground-navigation">
${raw(navigation())} ${raw(navigation())}
@ -43,7 +42,7 @@ function example1() {
} }
function navigation() { function navigation() {
return dedent` return html`
<li <li
class="playground-navigation__example" class="playground-navigation__example"
data-action="playground, example 1" data-action="playground, example 1"

View file

@ -6,7 +6,6 @@
import prism from "prismjs"; import prism from "prismjs";
import raw from "choo/html/raw"; import raw from "choo/html/raw";
import stringifyObject from "stringify-object";
// U T I L S // U T I L S
@ -140,7 +139,7 @@ export default async(data, socket) => {
delete memePublishResponse.result.lbrytech_claim_name; delete memePublishResponse.result.lbrytech_claim_name;
const renderedCode = prism.highlight( const renderedCode = prism.highlight(
stringifyObject(memePublishResponse, { indent: " ", singleQuotes: false }), JSON.stringify(memePublishResponse, null, 2),
prism.languages.json, prism.languages.json,
"json" "json"
); );
@ -186,7 +185,7 @@ export default async(data, socket) => {
if (socket) { if (socket) {
const renderedCode = prism.highlight( const renderedCode = prism.highlight(
stringifyObject(resolveResponse, { indent: " ", singleQuotes: false }), JSON.stringify(resolveResponse, null, 2),
prism.languages.json, prism.languages.json,
"json" "json"
); );
@ -245,7 +244,7 @@ export default async(data, socket) => {
if (socket) { if (socket) {
const renderedCode = prism.highlight( const renderedCode = prism.highlight(
stringifyObject(response.body, { indent: " ", singleQuotes: false }), JSON.stringify(response.body, null, 2),
prism.languages.json, prism.languages.json,
"json" "json"
); );

View file

@ -1,55 +1,46 @@
"use strict"; "use strict";
const request = require("request");
const addSupport = function () { }; const addSupport = function () { };
const publish = function () { }; const publish = function () { };
const resolve = function (urls) { const resolve = function (urls) {
return new Promise(function(resolve, reject) { return new Promise(async (resolve, reject) => {
const options = { const options = {
method: "POST", method: "POST",
url: "https://api.na-backend.odysee.com/api/v1/proxy", headers: {
headers:
{
"Content-Type": "application/json" "Content-Type": "application/json"
}, },
body: { body: JSON.stringify({
method: "resolve", method: "resolve",
params: { urls: urls } params: { urls: urls }
}, })
json: true
}; };
request(options, function(error, response, daemonResponse) { const response = await fetch("https://api.na-backend.odysee.com/api/v1/proxy", options);
if (error) { let json;
if (!response.ok) return reject(new Error("DAEMON ERROR: resolve"));
try {
json = await response.json();
} catch (err) {
return reject(new Error("DAEMON ERROR: resolve")); return reject(new Error("DAEMON ERROR: resolve"));
} }
if (Object.prototype.hasOwnProperty.call(daemonResponse, "error")) { return resolve(json.result);
return reject(new Error("DAEMON ERROR: resolve"));
} else
return resolve(daemonResponse.result);
});
}); });
}; };
const getTrending = function () { const getTrending = function () {
return new Promise(function(resolve, reject) { return new Promise(async (resolve, reject) => {
const options = { const options = {
method: "POST", method: "POST",
url: "https://api.na-backend.odysee.com/api/v1/proxy", headers: {
headers:
{
"Content-Type": "application/json" "Content-Type": "application/json"
}, },
body: body: JSON.stringify({
{
method: "claim_search", method: "claim_search",
params: params: {
{
page_size: 20, page_size: 20,
page: 1, page: 1,
no_totals: true, no_totals: true,
@ -71,20 +62,20 @@ const getTrending = function() {
not_tags: ["porn", "porno", "nsfw", "mature", "xxx", "sex", "creampie", "blowjob", "handjob", "vagina", "boobs", "big boobs", "big dick", "pussy", "cumshot", "anal", "hard fucking", "ass", "fuck", "hentai"], not_tags: ["porn", "porno", "nsfw", "mature", "xxx", "sex", "creampie", "blowjob", "handjob", "vagina", "boobs", "big boobs", "big dick", "pussy", "cumshot", "anal", "hard fucking", "ass", "fuck", "hentai"],
order_by: ["trending_group", "trending_mixed"] order_by: ["trending_group", "trending_mixed"]
} }
}, })
json: true
}; };
request(options, function(error, response, daemonResponse) { const response = await fetch("https://api.na-backend.odysee.com/api/v1/proxy", options);
if (error) { let json;
return reject(new Error("DAEMON ERROR: trending")); if (!response.ok) return reject(new Error("DAEMON ERROR: resolve"));
try {
json = await response.json();
} catch (err) {
return reject(new Error("DAEMON ERROR: resolve"));
} }
if (Object.prototype.hasOwnProperty.call(daemonResponse, "error")) { return resolve(json.result.items);
return reject(JSON.stringify(daemonResponse));
} else
return resolve(daemonResponse.result.items);
});
}); });
}; };

View file

@ -4,7 +4,6 @@
// P A C K A G E S // P A C K A G E S
import * as color from "colorette";
import compress from "fastify-compress"; import compress from "fastify-compress";
import fastify from "fastify"; import fastify from "fastify";
import ssr from "choo-ssr/fastify"; import ssr from "choo-ssr/fastify";
@ -62,5 +61,5 @@ server
// B E G I N // B E G I N
server.listen(process.env.PORT || 8080, process.env.IP || "0.0.0.0", async() => { server.listen(process.env.PORT || 8080, process.env.IP || "0.0.0.0", async() => {
process.stdout.write(`\n${color.green("⚡")} ${server.server.address().port}\n`) process.stdout.write(`\n ${server.server.address().port}\n`);
}); });

View file

@ -1,6 +1,6 @@
@charset "utf-8"; @charset "utf-8";
@import "@lbry/components/sass/"; @import "@lbry/components/sass/index";
@import "init/markdown"; @import "init/markdown";
@import "init/extends"; @import "init/extends";

View file

@ -5,7 +5,6 @@
// I M P O R T S // I M P O R T S
import asyncHtml from "choo-async/html"; import asyncHtml from "choo-async/html";
import dedent from "dedent";
// U T I L S // U T I L S
@ -401,3 +400,24 @@ function renderCodeLanguageToggles(pageSlug) {
onSdkPage ? "<button class='api-content__item' id='toggle-python' type='button'>python</button>" : "" onSdkPage ? "<button class='api-content__item' id='toggle-python' type='button'>python</button>" : ""
]; ];
} }
function dedent(string) {
// Split into lines
const lines = string.split('\n');
if (lines[0].trim() === '') lines.shift();
if (lines.length > 0 && lines[lines.length - 1].trim() === '') lines.pop();
const indents = lines
.slice(1)
.filter(line => line.trim() !== '')
.map(line => line.match(/^\s*/)[0].length);
const minIndent = indents.length > 0 ? Math.min(...indents) : 0;
return lines.map(line => {
const leadingWhitespace = line.match(/^\s*/)[0];
if (leadingWhitespace.length >= minIndent) {
return line.slice(minIndent);
}
return line;
}).join('\n');
}

View file

@ -6,7 +6,6 @@
// require('module-alias/register') // require('module-alias/register')
require("@babel/register"); require("@babel/register");
require("@babel/polyfill");
require("date-format-lite"); require("date-format-lite");
require("dotenv").config(); require("dotenv").config();

7709
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,66 +1,37 @@
{ {
"author": "LBRY Team", "author": "LBRY Team",
"dependencies": { "dependencies": {
"@babel/polyfill": "^7.4.4",
"async": "^3.1.0",
"async-es": "^3.1.0",
"choo": "6.13.3", "choo": "6.13.3",
"choo-async": "^0.1.1", "choo-async": "^0.1.1",
"choo-devtools": "^3.0.0", "choo-devtools": "^3.0.0",
"choo-ssr": "^0.2.1", "choo-ssr": "^0.2.1",
"choo-websocket": "^2.0.0", "choo-websocket": "^2.0.0",
"colorette": "^1.1.0",
"date-format-lite": "^17.7.0", "date-format-lite": "^17.7.0",
"decamelize": "^3.2.0", "dotenv": "^8.6.0",
"dedent": "^0.7.0",
"dotenv": "^8.0.0",
"fastify": "~2.7.1", "fastify": "~2.7.1",
"fastify-compress": "^0.10.0", "fastify-compress": "^0.10.0",
"fastify-static": "^2.5.0", "fastify-static": "^2.5.0",
"fastify-ws": "^1.0.3", "fastify-ws": "^1.0.3",
"front-matter": "^3.0.2", "front-matter": "^4.0.2",
"fs-exists-sync": "^0.1.0", "markdown-it": "^14.1.0",
"graceful-fs": "^4.2.1", "markdown-it-anchor": "^9.2.0",
"link-module-alias": "^1.2.0", "pino-pretty": "^3.2.0",
"make-promises-safe": "^5.0.0", "prismjs": "^1.30.0",
"markdown-it": "^9.0.1", "socket.io": "^4.8.1"
"markdown-it-anchor": "^5.2.4",
"module-alias": "^2.2.3",
"prismjs": "^1.17.1",
"redis": "^2.8.0",
"request": "latest",
"socket.io": "^2.2.0",
"stringify-object": "^3.3.0"
}, },
"description": "Documentation for the LBRY protocol and associated projects", "description": "Documentation for the LBRY protocol and associated projects",
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.5.5", "@babel/cli": "^7.27.0",
"@babel/core": "^7.5.5", "@babel/core": "^7.26.10",
"@babel/plugin-external-helpers": "7.2.0", "@babel/preset-env": "^7.26.9",
"@babel/plugin-proposal-class-properties": "7.5.5", "@babel/register": "^7.25.9",
"@babel/plugin-proposal-decorators": "7.4.4",
"@babel/plugin-proposal-export-namespace-from": "7.5.2",
"@babel/plugin-proposal-function-sent": "7.5.0",
"@babel/plugin-proposal-json-strings": "7.2.0",
"@babel/plugin-proposal-numeric-separator": "7.2.0",
"@babel/plugin-proposal-throw-expressions": "7.2.0",
"@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-syntax-import-meta": "7.2.0",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"@lbry/color": "^1.1.1",
"@lbry/components": "^2019.6.22", "@lbry/components": "^2019.6.22",
"@springernature/sasslint-config": "^1.2.1", "@springernature/sasslint-config": "^1.2.1",
"eslint": "^6.1.0", "eslint": "^6.1.0",
"eslint-config": "^0.3.0", "eslint-config": "^0.2.1",
"husky": "^3.0.2", "husky": "^3.0.2",
"nodemon": "^1.19.1",
"npm-run-all": "^4.1.5",
"pino-pretty": "^3.2.0",
"sass": "^1.22.9", "sass": "^1.22.9",
"sass-lint": "^1.13.1", "sass-lint": "^1.13.1"
"standardx": "^4.0.0",
"updates": "^8.5.1"
}, },
"husky": { "husky": {
"hooks": { "hooks": {
@ -74,18 +45,13 @@
"css": "sass --load-path=node_modules --update app/sass:app/dist --style compressed", "css": "sass --load-path=node_modules --update app/sass:app/dist --style compressed",
"format": "eslint . --fix --ignore-pattern '/app/dist/'", "format": "eslint . --fix --ignore-pattern '/app/dist/'",
"start": "npm i && npm run css && NODE_ENV=production node index.js", "start": "npm i && npm run css && NODE_ENV=production node index.js",
"test": "run-s test:*", "test": "npm run test:dependencies & npm run test:lint & npm run test:sass",
"test:dependencies": "updates --update ./ --exclude prismjs", "test:dependencies": "updates --update ./ --exclude prismjs",
"test:lint": "standardx --verbose | snazzy", "test:lint": "standardx --verbose | snazzy",
"test:sass": "sass-lint --config ./node_modules/@inc/sasslint-config/config.json --verbose --no-exit", "test:sass": "sass-lint --config ./node_modules/@inc/sasslint-config/config.json --verbose --no-exit",
"watch": "npm run css && run-p watch:*", "watch": "npm run css && npm run watch:server & npm run watch:sass",
"watch:sass": "sass --load-path=node_modules --watch app/sass:app/dist --style compressed", "watch:sass": "sass --load-path=node_modules --watch app/sass:app/dist --style compressed",
"watch:server": "NODE_ENV=development nodemon --ignore 'app/dist'" "watch:server": "NODE_ENV=development node --watch index.js"
},
"standardx": {
"ignore": [
"app/dist"
]
}, },
"version": "6.0.0" "version": "6.0.0"
} }