Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chrome-types-helpers

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-types-helpers - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

lib/features-parser/types.d.ts

41

lib/features/helpers.js

@@ -21,2 +21,3 @@ /**

const permissionFeaturePrefix = 'permission:';
const manifestFeaturePrefix = 'manifest:';

@@ -155,2 +156,5 @@

/** @type {Set<string>} */
const selfManifestRequirements = new Set();
/** @type {types.RawFeature[]} */

@@ -174,2 +178,7 @@ const rawFeatures = [];

if (name.startsWith(manifestFeaturePrefix)) {
const manifestRequirement = name.substr(manifestFeaturePrefix.length);
selfManifestRequirements.add(manifestRequirement);
}
rawFeatures.push(lookup);

@@ -220,2 +229,6 @@

if (selfManifestRequirements.size) {
selfFeature.manifestRequirements = [...selfManifestRequirements];
}
if (!this.#skipVersionData) {

@@ -267,9 +280,11 @@ /** @type {types.VersionInfo=} */

/** @type {Set<string>} */
const sparsePermissions = new Set();
(selfFeature.permissions ?? []).forEach((p) => sparsePermissions.add(p));
(parentFeature.permissions ?? []).forEach((p) => sparsePermissions.delete(p));
const sparsePermissions = setDifference(parentFeature.permissions, selfFeature.permissions);
if (sparsePermissions.length) {
out.permissions = sparsePermissions;
}
if (sparsePermissions.size) {
out.permissions = [...sparsePermissions];
const sparseManifestRequirements = setDifference(
parentFeature.manifestRequirements, selfFeature.manifestRequirements);
if (sparseManifestRequirements.length) {
out.manifestRequirements = sparseManifestRequirements;
}

@@ -282,2 +297,16 @@

/**
* @param {Iterable<string>|undefined} parent
* @param {Iterable<string>|undefined} self
* @return {string[]}
*/
export function setDifference(parent, self) {
const sparse = new Set(self ?? []);
for (const remove of parent ?? []) {
sparse.delete(remove);
}
return [...sparse];
}
/**
* Process all raw feature files, seen as a number of top-level dictionaries. Takes ownership of

@@ -284,0 +313,0 @@ * the passed features.

18

lib/gen/parser.js

@@ -78,2 +78,8 @@ /**

raw = this.#unresolveName(raw);
// Catch some cases where types start with a number.
if (raw.match(/^\d/)) {
raw = `_${raw}`;
}
return new model.RefType(raw, true, templates);

@@ -172,3 +178,3 @@ };

#parseProperty = (path, raw, overrideName, fallbackType) => {
const name = overrideName ?? raw.name ?? raw.id;
let name = overrideName ?? raw.name ?? raw.id;
if (name === undefined) {

@@ -178,2 +184,7 @@ throw new Error(`could not parse property, no name`);

// Fix invalid names that start with numbers.
if (name.match(/^\d/)) {
name = `_${name}`;
}
const extendedPath = extendPath(path, name);

@@ -432,8 +443,7 @@ const type = this.#parseType(extendedPath, raw, fallbackType);

const prop = this.#parseProperty(path, f);
if (!f.id) {
if (!prop.name) {
throw new Error(`type without id`);
}
prop.name = f.id;
prop.isType = true;
all[f.id] = prop;
all[prop.name] = prop;
});

@@ -440,0 +450,0 @@

@@ -5,3 +5,3 @@ {

"license": "Apache-2.0",
"version": "0.1.6",
"version": "0.1.7",
"type": "module",

@@ -8,0 +8,0 @@ "dependencies": {

@@ -34,3 +34,3 @@ ⚠️ _If you're looking for TypeScript definitions for Chrome's extension types, you should depend on [chrome-types](https://www.npmjs.com/package/chrome-types)!_

* **prepare.js:** is used internally to prepare a ".d.ts" and the history JSON for regular publish to NPM, and is probably not interesting to the public
* **prepare-types.js:** is used internally to prepare a ".d.ts" and the history JSON for regular publish to NPM, and is probably not interesting to the public
* It internally runs both scripts above

@@ -37,0 +37,0 @@

@@ -199,2 +199,3 @@ /**

permissions: string[];
manifestRequirements: string[];

@@ -201,0 +202,0 @@ // These are not set by direct parsing, but by loading historical verison data.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc