hint tools
npm install @hint/utils@hint/utils)Set of tools for hint.
To install the package, you need to run:
``bash`
npm install @hint/utils
The tools included in this package are:
* asyncTry: Wrap an async function, returning null if the evaluation throwsget-hints-from-extends
and exception.
* : Returns all hints in a configuration, including
hints inside the extended configurations.
* getFriendlyName: Get the friendly name of a browser from an id.getUnsupported
* : Get browsers without support for CSS or HTML features.getUnsupportedDetails
* : Get browsers without support with details onisSupported
when support was added or removed.
* : Query MDN for support of CSS or HTML features.
* get: Get the value from the config store.set
* : Set a value in the config store.
* determineMediaTypeBasedOnFileExtension: Get a mime-type associateddetermineMediaTypeBasedOnFileName
with the specified file extension.
* : Get a mime-type associated withdetermineMediaTypeForScript
the specified filename.
* : Check if the provided mime-type is anull
recognized mime-type for JavaScript, returning the recommended
mime-type if so, otherwise.getContentTypeData
* : Try to determine the correct mime-type for agetFileExtension
response.
* : Try to determine a resource's file extension.getType
* : Returns the group to which the mediaType belongs to. E.g.:image
, font, script, css, html, manifest, xml orunknown
.isTextMediaType
* : Check if a mime-type represents a text-based
resource.
* error: Cover for console.error.log
* : Cover for console.log.warn
* : Cover for console.warn.
* askQuestion: Asks a y/n question to the user defaulting to Yes.delay
* : Convenience wrapper to add a delay using promises.mergeEnvWithOptions
* : Merges any webhint_ prefixed environmentoptions
variable available with the given object.
* installPackages: Install the given packages.search
* : Searches all the packages in npm given searchTerm.getOfficialPackages
* : Get core packages from npm.getUnnoficialPackages
* : Get external packages from npm.
* findNodeModulesRoot: Find the node_modules folder where hint is installedfindPackageRoot
as a dependency or returns the hint node_modules folder if not.
* : Searches for the first folder that contains thefileToFind going up the tree.isOfficial
* : Returns if the hint that is going to be created is anloadPackage
official.
* : Returns the package found in the given pathString or anhasMultipleResources
exception if no package is found.
* : Returns true if a hint package is a multi-hint.isFullPackageName
* : Returns true if the name is a full package name.loadHintPackage
* : Returns the package hint.loadResource
* : Returns a resource if it exists.requirePackage`: Require a package, compatible with webpack.
*