Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomayac/fugu-api-data
This repo contains raw data for Project Fugu 🐡 APIs.
https://github.com/tomayac/fugu-api-data
capabilities fugu project-fugu web-capabilities
Last synced: 22 days ago
JSON representation
This repo contains raw data for Project Fugu 🐡 APIs.
- Host: GitHub
- URL: https://github.com/tomayac/fugu-api-data
- Owner: tomayac
- License: apache-2.0
- Created: 2021-06-23T12:17:22.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-22T10:07:05.000Z (3 months ago)
- Last Synced: 2024-10-05T07:51:12.924Z (about 1 month ago)
- Topics: capabilities, fugu, project-fugu, web-capabilities
- Language: JavaScript
- Homepage: https://github.com/tomayac/fugu-api-data
- Size: 188 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Project Fugu 🐡 API Data
This repo contains raw data for Project Fugu 🐡 APIs. The data is available
in two formats: `pattern.js` and `pattern.mjs`.## Data origin
The raw data in this repository comes from a
[Google spreadsheet](https://docs.google.com/spreadsheets/d/1ndxh6sl0fSOLHFlMdSiLPqmGPMDVJqkJFYnQ0Hsmhwo/edit?usp=sharing)
that is published as a
[JSON file](https://sheets.googleapis.com/v4/spreadsheets/1ndxh6sl0fSOLHFlMdSiLPqmGPMDVJqkJFYnQ0Hsmhwo/values/Sheet2?alt=json&key=AIzaSyCkROWBarEOJ9hQJggyrlUFulOFA4h6AW0).
The `index.js` script fetches this data, prettifies it, and saves it locally in
a module and in a no-module variant.## Obtaining fresh data
You can trigger the data fetch process described above by running the `start`
script:```bash
npm start
```## Data usage
- For the module version:
```js
import patterns from './patterns.mjs';console.log(patterns.WebBluetooth);
/*
{
regEx: /navigator\.bluetooth\.requestDevice\s*\(/g,
where: 'JavaScript',
supported: (async () => 'bluetooth' in navigator)(),
featureDetection: `(async () => 'bluetooth' in navigator)()`,
}
*/
```- For the no-module version (for example to use it in a service worker):
```js
importScripts('patterns.js');
console.log(patterns.WebBluetooth);
/*
{
regEx: /navigator\.bluetooth\.requestDevice\s*\(/g,
where: 'JavaScript',
supported: (async () => 'bluetooth' in navigator)(),
featureDetection: `(async () => 'bluetooth' in navigator)()`,
}
*/
```## Data format
Each API is represented as an object with the following properties:
- `regEx`: A regular expression that you can use to detect the API of interest
in source code when you do static source code analysis.
- `where`: The resource type where the regular expression needs to match in
order to be valid. Either `"JavaScript"` or `"Web App Manifest"`.
- `supported`: A function that returns a promise that resolves with `true`,
`false`, or `undefined`, dependent on whether the API is supported or not
(`undefined` means no feature detection method exists).
- `featureDetection`: The source code of the feature detection method, so you
can use it in an `eval()` for example.## Depending projects
This data is used in the following projects:
- The
[Capabilities report](https://almanac.httparchive.org/en/2020/capabilities) of
the [HTTP Almanac](https://almanac.httparchive.org/) in the file
[`custom_metrics/fugu-apis.js`](https://github.com/HTTPArchive/legacy.httparchive.org/blob/master/custom_metrics/fugu-apis.js).
- The
[Project Fugu 🐡 API Detector](https://github.com/tomayac/project-fugu-api-detector)
browser extension in the files
[`patternsFunc.js`](https://github.com/tomayac/project-fugu-api-detector/blob/main/patternsFunc.js#:~:text=import%20patterns%20from%20'.%2Fpatterns.mjs'%3B)
and
[`background.js`]().## License
Apache 2.0.