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

rxjs-report-usage

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rxjs-report-usage - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

21

package.json

@@ -10,13 +10,16 @@ {

"dependencies": {
"@babel/parser": "^7.10.3",
"@babel/traverse": "^7.10.3",
"@babel/types": "^7.10.3",
"bent": "^7.3.6",
"chalk": "^4.1.0",
"glob": "^7.1.6",
"prompts": "^2.3.2"
"@babel/parser": "~7.10.3",
"@babel/traverse": "~7.10.3",
"@babel/types": "~7.10.3",
"bent": "~7.3.6",
"chalk": "~4.1.0",
"glob": "~7.1.6",
"prompts": "~2.3.2"
},
"description": "Report RxJS API usage to the core team",
"devDependencies": {
"jest": "^26.0.1"
"csv-parser": "^2.3.3",
"jest": "^26.0.1",
"ndjson-cli": "^0.3.1",
"yargs": "^15.3.1"
},

@@ -50,3 +53,3 @@ "homepage": "https://github.com/cartant/rxjs-report-usage",

"scripts": {},
"version": "1.0.4"
"version": "1.0.5"
}
# rxjs-report-usage
### What is it?
The script within this package collects anonymous API usage statistics and reports them to the RxJS core team.
### How do you run it?
This package is included as a dependency in:
* [`eslint-plugin-rxjs`](https://github.com/cartant/eslint-plugin-rxjs)
* [`rxjs-etc`](https://github.com/cartant/rxjs-etc)
* [`rxjs-marbles`](https://github.com/cartant/rxjs-marbles)
* [`rxjs-spy`](https://github.com/cartant/rxjs-spy)
* [`rxjs-tslint-rules`](https://github.com/cartant/rxjs-tslint-rules)
So if you are using the most-recent version of any of those packages, you can run the following npm command:
```
npm rxjs-report-usage
```
Or, with yarn:
```
yarn rxjs-report-usage
```
If you're not using any of those packages, you can install `rxjs-report-usage` as a `devDependency` and then run one of the above commands, or you can use `npx` to run the script without installing the package:
```
npx rxjs-report-error
```
### What it does actually do?
When run inside a project, the script locates all JavaScript and TypeScript files - except for those in the `node_modules` directory - and parses them with Babel. The parsed code is searched for `import` statements and `require` calls that consume `rxjs` and a usage count is recorded for each consumed RxJS API.

@@ -22,3 +54,3 @@

"mergeMap": 1
},
}
},

@@ -36,2 +68,2 @@ "packageVersions": {

For more information - including the most convenient ways of running the script - see this blog post: [Reporting API Usage](http://ncjamieson.com/reporting-api-usage/).
For more information see this blog post: [Reporting API Usage](http://ncjamieson.com/reporting-api-usage/).
"use strict";
const { parse } = require("@babel/parser");
const { readFileSync } = require("fs");
const { readFileSync, statSync } = require("fs");
const glob = require("glob");

@@ -22,10 +22,14 @@ const { resolve } = require("path");

sourceFiles.forEach((file) => {
const code = readFileSync(resolve(cwd, file), "utf8");
try {
const resolvedFile = resolve(cwd, file);
if (!statSync(resolvedFile).isFile()) {
return;
}
const code = readFileSync(resolvedFile, "utf8");
const ast = parse(code, {
// https://babeljs.io/docs/en/babel-parser#ecmascript-proposals-https-githubcom-babel-proposals
plugins: [
"classProperties",
"classPrivateMethods",
"classPrivateProperties",
"classProperties",
"decorators-legacy",

@@ -32,0 +36,0 @@ "jsx",

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