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
2 changes: 2 additions & 0 deletions i18n/english.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const ui = {
tsTypings: "TS Typings",
node: "Node.js Compatibility",
npm: "NPM Compatibility",
type: "Module type",
lastReleaseVersion: "Last release version",
lastReleaseDate: "Last release date",
publishedReleases: "Number of published releases",
Expand Down Expand Up @@ -174,6 +175,7 @@ const ui = {
},
watch: "Packages in the dependency tree requiring greater attention",
criticalWarnings: "Critical Warnings",
moduleTypes: "Module Types",
maintainers: "Maintainers",
showMore: "show more",
showLess: "show less"
Expand Down
4 changes: 3 additions & 1 deletion i18n/french.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const cli = {
startHttp: {
invalidScannerVersion: tS`le fichier d'analyse correspond à la version '${0}' du scanner et ne satisfait pas la range '${1}' attendu par la CLI`,
regenerate: "veuillez re-générer un nouveau fichier d'analyse JSON en utilisant votre CLI"
},
}
};

const ui = {
Expand Down Expand Up @@ -128,6 +128,7 @@ const ui = {
tsTypings: "Typages TS",
node: "Compatibilité Node.js",
npm: "Compatibilité NPM",
type: "Type de module",
lastReleaseVersion: "Dernière version publiée",
lastReleaseDate: "Date de la dernière version",
publishedReleases: "Nombre de versions publiées",
Expand Down Expand Up @@ -174,6 +175,7 @@ const ui = {
},
watch: "Packages dans l'arbre de dépendance nécessitant une plus grande attention",
criticalWarnings: "Avertissements critiques",
moduleTypes: "Types de modules",
maintainers: "Mainteneurs",
showMore: "voir plus",
showLess: "voir moins"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"@nodesecure/documentation-ui": "^1.3.0",
"@nodesecure/flags": "^3.0.3",
"@nodesecure/i18n": "^4.0.1",
"@nodesecure/js-x-ray": "^9.0.0",
"@nodesecure/js-x-ray": "^9.2.0",
"@nodesecure/licenses-conformance": "^2.1.0",
"@nodesecure/npm-registry-sdk": "^3.0.0",
"@nodesecure/ossf-scorecard-sdk": "^3.2.1",
Expand Down
6 changes: 5 additions & 1 deletion public/components/package/pannels/overview/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class Overview {
}

renderTopFields() {
const { size, composition, engines = {} } = this.package.dependencyVersion;
const { size, composition, engines = {}, type } = this.package.dependencyVersion;
const { metadata } = this.package.dependency;

const fragment = document.createDocumentFragment();
Expand Down Expand Up @@ -168,6 +168,10 @@ export class Overview {
));
}

fragment.appendChild(utils.createLiField(
i18n.package_info.overview.type, type
));

return fragment;
}

Expand Down
7 changes: 7 additions & 0 deletions public/components/views/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
<div class="home--warnings"></div>
</div>
</div>
<div class="module">
<div class="title">
<i class="icon-eye"></i>
<p>[[=z.token('home.moduleTypes')]]</p>
</div>
<div class="content" id="home-modules-types"></div>
</div>
<div class="module">
<div class="title">
<i class="icon-doc"></i>
Expand Down
28 changes: 28 additions & 0 deletions public/components/views/home/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class HomeView {
this.generateExtensions();
this.generateLicenses();
this.generateMaintainers();
this.generateModuleTypes();
this.handleReport();
}

Expand Down Expand Up @@ -316,6 +317,33 @@ export class HomeView {
.render();
}

generateModuleTypes() {
const moduleTypesElement = document.getElementById("home-modules-types");
const moduleTypes = Object.values(this.secureDataSet.data.dependencies).reduce((acc, dep) => {
const types = Object.values(dep.versions).map((version) => version.type);
for (const type of types) {
acc[type] += 1;
}

return acc;
}, {
esm: 0,
cjs: 0,
dual: 0,
dts: 0,
faux: 0
});
const moduleTypesJaugeData = [...Object.entries(moduleTypes)]
.sort(([, left], [, right]) => right - left)
.map(([name, value]) => {
return { name, value };
});

moduleTypesElement.appendChild(
new Gauge(moduleTypesJaugeData).render()
);
}

async generateDownloads() {
const homeOverviewElement = document.querySelector(".home--overview");
const { name } = this.secureDataSet.linker.get(0);
Expand Down
2 changes: 1 addition & 1 deletion workspaces/server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { appCache, type AppConfig } from "@nodesecure/cache";
import { logger } from "./logger.js";

const experimentalWarnings = Object.entries(warnings)
.flatMap(([warning, { experimental }]) => (experimental ? [warning] : [])) as WarningName[];
.flatMap(([warning, metadata]) => ("experimental" in metadata && metadata.experimental ? [warning] : [])) as WarningName[];

// CONSTANTS
const kDefaultConfig = {
Expand Down