chrome-types-helpers
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -416,2 +416,6 @@ /** | ||
} else { | ||
if (returns instanceof Property && returns.name !== 'return') { | ||
throw new Error(`got return property with unexpected name: ${returns.name}`); | ||
} | ||
const returnProperty = returns instanceof Type ? new Property(returns, 'return') : returns; | ||
@@ -432,9 +436,2 @@ this.returnProperty = returnProperty; | ||
// If this is returns async, then announce that "return" exists as a function type. | ||
if (this.isReturnsAsync) { | ||
const fakeReturnProperty = new Property(this.returnTypeForAsync, 'return'); | ||
fakeReturnProperty.traverse(fn, path); | ||
return; | ||
} | ||
// Otherwise, only announce a return property if it's not void. | ||
@@ -441,0 +438,0 @@ const t = this.returnType; |
@@ -46,5 +46,2 @@ /** | ||
/** @type {{[path: string]: model.Property}} */ | ||
#accumulateByPath = {}; | ||
/** | ||
@@ -163,3 +160,2 @@ * @param {Features} f | ||
prop.type = propertyOverride(extendedPath, prop) ?? prop.type; | ||
this.#announce(extendedPath, prop); | ||
return prop; | ||
@@ -198,3 +194,2 @@ }); | ||
d.type = propertyOverride(extendedPath, d) ?? d.type; | ||
this.#announce(extendedPath, d); | ||
return d; | ||
@@ -401,3 +396,4 @@ }; | ||
} | ||
returnProperty = this.#parseProperty(path, raw.returns_async); | ||
// We expect the `returns_async` to be called "callback", so just override it here. | ||
returnProperty = this.#parseProperty(path, raw.returns_async, 'callback'); | ||
} | ||
@@ -457,13 +453,2 @@ | ||
/** | ||
* @param {string} path | ||
* @param {model.Property} prop | ||
*/ | ||
#announce = (path, prop) => { | ||
if (path in this.#accumulateByPath) { | ||
throw new Error(`duplicate path: ${path}`); | ||
} | ||
this.#accumulateByPath[path] = prop; | ||
}; | ||
/** | ||
* Parse a raw comment from Chrome's source into Markdown. | ||
@@ -509,10 +494,11 @@ * | ||
/** @type {{[path: string]: model.Property}} */ | ||
const byPath = {}; | ||
// Augment or hide every property within this namespace. | ||
const byPath = this.#accumulateByPath; | ||
const byPathKeys = Object.keys(byPath); | ||
byPathKeys.sort((a, b) => a.length - b.length); // short first, so features are calculated | ||
namespace.traverse((pathParts, prop) => { | ||
const path = pathParts.join('.'); | ||
byPath[path] = prop; | ||
for (const path of byPathKeys) { | ||
const parentPath = parentName(path); | ||
const prop = byPath[path]; | ||
@@ -534,3 +520,3 @@ // Awkwardly get the parent Node either from the dictionary OR from the namespace name. | ||
prop.nodoc = true; | ||
continue; | ||
return false; | ||
} | ||
@@ -542,3 +528,3 @@ | ||
prop.nodoc = true; | ||
continue; | ||
return false; | ||
} | ||
@@ -549,3 +535,4 @@ | ||
prop.feature = sparseFeature(selfFeature, parentNode.canonicalFeature); | ||
} | ||
return false; | ||
}); | ||
@@ -555,3 +542,2 @@ return {namespace, byPath}; | ||
this.#namespace = emptyNamespace; | ||
this.#accumulateByPath = {}; | ||
} | ||
@@ -558,0 +544,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"license": "Apache-2.0", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206635
5765