Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ export default [
...ESLintConfig,
{
rules: {
"func-style": "off",
"no-invalid-this": "off",
"no-inner-declarations": "off",
"no-case-declarations": "off",
// TODO: enable this rule when migrating to @topcli/cmder
"default-param-last": "off"
"no-invalid-this": "off"
},
languageOptions: {
sourceType: "module",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@myunisoft/httpie": "^5.0.0",
"@nodesecure/size-satisfies": "^1.1.0",
"@nodesecure/vis-network": "^1.4.0",
"@openally/config.eslint": "^1.3.0",
"@openally/config.eslint": "^2.1.0",
"@types/node": "^22.2.0",
"c8": "^10.1.2",
"cross-env": "^7.0.3",
Expand Down
14 changes: 6 additions & 8 deletions public/common/utils.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Import static
import avatarURL from "../img/avatar-default.png";

// Import Internal Dependencies
import { createExpandableSpan } from "../components/expandable/expandable";
import avatarURL from "../img/avatar-default.png";
import { createExpandableSpan } from "../components/expandable/expandable.js";

window.activeLegendElement = null;

Expand Down Expand Up @@ -233,7 +231,7 @@ export function hideOnClickOutside(
callback = () => void 0
} = options;

const outsideClickListener = (event) => {
function outsideClickListener(event) {
if (!element.contains(event.target) && !blacklist.includes(event.target)) {
if (hiddenTarget) {
if (reverse) {
Expand All @@ -246,11 +244,11 @@ export function hideOnClickOutside(
callback();
removeClickListener();
}
};
}

const removeClickListener = () => {
function removeClickListener() {
document.removeEventListener("click", outsideClickListener);
};
}

document.addEventListener("click", outsideClickListener);

Expand Down
4 changes: 2 additions & 2 deletions public/components/package/pannels/files/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class Files {
generate(clone) {
const { name, version, composition } = this.package.dependencyVersion;

const onclick = (_, fileName) => {
function onclick(_, fileName) {
if (fileName === "../" || fileName === "./") {
return;
}
Expand All @@ -21,7 +21,7 @@ export class Files {
window
.open(`https://unpkg.com/${name}@${version}/${cleanedFile}`, "_blank")
.focus();
};
}

utils.createItemsList(
clone.getElementById("extensions"),
Expand Down
4 changes: 3 additions & 1 deletion public/components/package/pannels/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export class Scripts {

renderScripts() {
const fragment = document.createDocumentFragment();
const createPElement = (className, text) => utils.createDOMElement("p", { className, text });
function createPElement(className, text) {
return utils.createDOMElement("p", { className, text });
}

const scripts = Object.entries(this.package.dependencyVersion.scripts);
if (scripts.length === 0) {
Expand Down
1 change: 1 addition & 0 deletions public/components/package/pannels/warnings/code-fetcher.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Import Third-party Dependencies
import hljs from "highlight.js/lib/core";
window.hljs = hljs;
require("highlightjs-line-numbers.js/dist/highlightjs-line-numbers.min.js");
Expand Down
4 changes: 2 additions & 2 deletions public/components/views/home/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class HomeView {
async generateOverview() {
const fragment = document.createDocumentFragment();

const createOverviewDiv = (icon, title, value) => {
function createOverviewDiv(icon, title, value) {
const titleDiv = utils.createDOMElement("div", {
className: "title",
childs: [
Expand All @@ -151,7 +151,7 @@ export class HomeView {
utils.createDOMElement("span", { text: value })
]
});
};
}

const { name } = this.secureDataSet.linker.get(0);
let directDependencies = 0;
Expand Down
2 changes: 1 addition & 1 deletion public/core/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { getJSON } from "@nodesecure/vis-network";

export class i18n {
async fetch() {
return await getJSON(`/i18n`);
return await getJSON("/i18n");
}
}
8 changes: 1 addition & 7 deletions public/main.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
// Import Third-party Dependencies
import { NodeSecureDataSet, NodeSecureNetwork } from "@nodesecure/vis-network";

// Import UI Components
// Import Internal Dependencies
import { PackageInfo } from "./components/package/package.js";
import { ViewNavigation } from "./components/navigation/navigation.js";
import { Wiki } from "./components/wiki/wiki.js";
import { Popup } from "./components/popup/popup.js";
import { Locker } from "./components/locker/locker.js";
import { Legend } from "./components/legend/legend.js";

// Import Views Components
import { Settings } from "./components/views/settings/settings.js";
import { HomeView } from "./components/views/home/home.js";
import { SearchView } from "./components/views/search/search.js";

// Import Core Components
import { NetworkNavigation } from "./core/network-navigation.js";
import { i18n } from "./core/i18n.js";
import { initSearchNav } from "./core/search-nav.js";

// Import Utils
import * as utils from "./common/utils.js";

let secureDataSet;
Expand Down
1 change: 1 addition & 0 deletions src/ALS.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Import Node.js Dependencies
import { AsyncLocalStorage } from "node:async_hooks";

export const context = new AsyncLocalStorage();
4 changes: 2 additions & 2 deletions src/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class _AppCache {
return JSON.parse(data.toString());
}
catch (err) {
logger.error(`[cache|get](cache: not found)`);
logger.error("[cache|get](cache: not found)");

throw err;
}
Expand All @@ -99,7 +99,7 @@ class _AppCache {
root: null
};

logger.info(`[cache|init](startFromZero)`);
logger.info("[cache|init](startFromZero)");
await cacache.put(CACHE_PATH, `${this.prefix}${kPayloadsCache}`, JSON.stringify(payloadsList));

return;
Expand Down
5 changes: 4 additions & 1 deletion src/commands/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ export function editConfigFile() {
}
}

export async function createConfigFile(configuration = "minimal", opts) {
export async function createConfigFile(
configuration = "minimal",
opts = {}
) {
const { cwd } = opts;

const pathConfigFile = cwd ? process.cwd() : K_HOME_PATH;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/report.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Import Third-party Dependencikes
// Import Third-party Dependencies
import { report } from "@nodesecure/report";
import * as Scanner from "@nodesecure/scanner";

Expand Down
2 changes: 1 addition & 1 deletion src/commands/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function separatorLine() {

export async function main(
packageName = undefined,
options,
options = {},
verifyFn = verify
) {
const payload = await verifyFn(packageName);
Expand Down
6 changes: 3 additions & 3 deletions src/http-server/ViewBuilder.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ViewBuilder {
}

async #enableWatcher() {
logger.info(`[ViewBuilder] autoReload is enabled`);
logger.info("[ViewBuilder] autoReload is enabled");

const watcher = chokidar.watch(kComponentsDir, {
persistent: false,
Expand All @@ -41,7 +41,7 @@ export class ViewBuilder {
async #freeCache(
filePath
) {
logger.info(`[ViewBuilder] the cache has been released`);
logger.info("[ViewBuilder] the cache has been released");
logger.info(`[ViewBuilder](filePath: ${filePath})`);

this.#cached = null;
Expand Down Expand Up @@ -74,7 +74,7 @@ export class ViewBuilder {
HTMLStr += components.reduce((prev, curr) => prev + curr, "");

this.#cached = HTMLStr;
logger.info(`[ViewBuilder] the cache has been hydrated`);
logger.info("[ViewBuilder] the cache has been hydrated");

return HTMLStr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/http-server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function set(newValue) {
try {
await appCache.updateConfig(newValue);

logger.info(`[config|set](sucess)`);
logger.info("[config|set](sucess)");
}
catch (err) {
logger.error(`[config|set](error: ${err.message})`);
Expand Down
2 changes: 1 addition & 1 deletion src/http-server/endpoints/bundle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Import Third-party Dependencikes
// Import Third-party Dependencies
import * as httpie from "@myunisoft/httpie";
import send from "@polka/send-type";

Expand Down
2 changes: 1 addition & 1 deletion src/http-server/endpoints/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function get(_req, res) {
send(res, 200, appCache.getPayload(current));
}
catch {
logger.error(`[data|get](No cache yet. Creating one...)`);
logger.error("[data|get](No cache yet. Creating one...)");

const payload = JSON.parse(fs.readFileSync(kDefaultPayloadPath, "utf-8"));
const version = Object.keys(payload.dependencies[payload.rootDependencyName].versions)[0];
Expand Down
2 changes: 1 addition & 1 deletion src/http-server/endpoints/flags.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Import Node.Js Dependencies
// Import Node.js Dependencies
import { pipeline } from "node:stream";

// Import Third-party Dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/http-server/endpoints/npm-downloads.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Import Third-party Dependencikes
// Import Third-party Dependencies
import { downloads } from "@nodesecure/npm-registry-sdk";
import send from "@polka/send-type";

Expand Down
2 changes: 1 addition & 1 deletion src/http-server/endpoints/ossf-scorecard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Import Third-party Dependencikes
// Import Third-party Dependencies
import * as scorecard from "@nodesecure/ossf-scorecard-sdk";
import send from "@polka/send-type";

Expand Down
2 changes: 1 addition & 1 deletion src/http-server/endpoints/report.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Import Node.js Dependencies
import fs from "node:fs";

// Import Third-party Dependencikes
// Import Third-party Dependencies
import { report } from "@nodesecure/report";
import send from "@polka/send-type";

Expand Down
6 changes: 3 additions & 3 deletions src/http-server/websocket/commands/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function* remove(
try {
const { mru, lru, current, lastUsed, root, availables } = await cache.payloadsList();
if (availables.includes(pkg)) {
logger.info(`[ws|remove] remove from availables`);
logger.info("[ws|remove] remove from availables");
cache.removePayload(pkg);
const updatedList = {
mru,
Expand Down Expand Up @@ -45,7 +45,7 @@ export async function* remove(
}

if (mruIndex > -1) {
logger.info(`[ws|remove](remove from lru)`);
logger.info("[ws|remove](remove from lru)");
const updatedMru = mru.filter((pkgName) => pkgName !== pkg);
if (lru.length > 0) {
// We need to move the first lru package to the mru list
Expand Down Expand Up @@ -78,7 +78,7 @@ export async function* remove(
};
}
else {
logger.info(`[ws|remove](remove from lru)`);
logger.info("[ws|remove](remove from lru)");
const updatedLru = lru.filter((pkgName) => pkgName !== pkg);
const updatedList = {
mru,
Expand Down
2 changes: 1 addition & 1 deletion src/http-server/websocket/commands/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ export async function* search(

cache.startFromZero = false;

logger.info(`[ws|search](data sent to client|cache: updated)`);
logger.info("[ws|search](data sent to client|cache: updated)");
}
}
2 changes: 1 addition & 1 deletion src/http-server/websocket/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class WebSocketServerInstanciator {
return null;
}

logger.error(`[ws|init](No cache yet. Creating one...)`);
logger.error("[ws|init](No cache yet. Creating one...)");
await appCache.initPayloadsList();

return this.initializeServer(true);
Expand Down
Loading