@tkskto/vue-component-analyzer
Advanced tools
Comparing version 0.5.2 to 0.6.1
#!/usr/bin/env node | ||
import {vueComponentAnalyze} from '../dist/index.mjs'; | ||
import {analyzeFromCLI} from '../dist/index.mjs'; | ||
@@ -17,3 +17,3 @@ /** | ||
(function main() { | ||
(async function main() { | ||
process.on('uncaughtException', onCatchError); | ||
@@ -23,3 +23,3 @@ process.on('unhandledRejection', onCatchError); | ||
try { | ||
vueComponentAnalyze(); | ||
await analyzeFromCLI(); | ||
} catch (err) { | ||
@@ -26,0 +26,0 @@ onCatchError(err); |
{ | ||
"name": "@tkskto/vue-component-analyzer", | ||
"version": "0.5.2", | ||
"version": "0.6.1", | ||
"description": "Analyze dependency tree for Vue.js SFC (Single File Component)", | ||
"type": "module", | ||
"main": "./dist/index.mjs", | ||
"types": "./types/index.d.ts", | ||
"bin": { | ||
@@ -49,3 +51,3 @@ "vca": "bin/analyze.js" | ||
"ejs": "3.1.8", | ||
"express": "4.18.1", | ||
"express": "4.18.2", | ||
"globby": "13.1.2", | ||
@@ -59,23 +61,23 @@ "mkdirp": "1.0.4", | ||
"@mitsue/eslint-config": "4.1.0", | ||
"@rollup/plugin-commonjs": "23.0.2", | ||
"@rollup/plugin-json": "4.1.0", | ||
"@rollup/plugin-commonjs": "23.0.3", | ||
"@rollup/plugin-json": "5.0.2", | ||
"@rollup/plugin-node-resolve": "15.0.1", | ||
"@rollup/plugin-typescript": "8.3.2", | ||
"@rollup/plugin-typescript": "10.0.1", | ||
"@rollup/plugin-terser": "0.1.0", | ||
"@types/ejs": "3.1.1", | ||
"@types/express": "4.17.13", | ||
"@types/express": "4.17.14", | ||
"@types/jest": "29.2.3", | ||
"@types/mkdirp": "1.0.2", | ||
"@types/node": "16.11.38", | ||
"@types/node": "18.11.10", | ||
"@types/opener": "1.4.0", | ||
"@types/ws": "8.5.3", | ||
"@typescript-eslint/eslint-plugin": "5.44.0", | ||
"@typescript-eslint/parser": "5.44.0", | ||
"eslint": "8.28.0", | ||
"@typescript-eslint/eslint-plugin": "5.45.0", | ||
"@typescript-eslint/parser": "5.45.0", | ||
"eslint": "8.29.0", | ||
"husky": "8.0.2", | ||
"jest": "29.3.1", | ||
"lint-staged": "13.0.3", | ||
"lint-staged": "13.0.4", | ||
"nyc": "15.1.0", | ||
"rollup": "2.79.1", | ||
"rollup-plugin-license": "2.8.0", | ||
"rollup": "3.5.1", | ||
"rollup-plugin-license": "3.0.1", | ||
"ts-jest": "29.0.3", | ||
@@ -82,0 +84,0 @@ "ts-node": "10.9.1", |
@@ -49,6 +49,20 @@ # vue-component-analyzer | ||
## API | ||
vue-component-analyzer is also available as an API from v0.6.1. | ||
This API is intended to be used for testing. | ||
```javascript | ||
import {getImportDeclarationTree} from '@tkskto/vue-component-analyzer'; | ||
const jsonOfTree = getImportDeclarationTree('entryFile.vue'); | ||
``` | ||
See [index.d.ts](./types/index.d.ts) for details of types. | ||
(`lastModifiedTime` can be noise. If you don't need it remove explicitly.) | ||
## License | ||
MIT License. | ||
@@ -1,14 +0,32 @@ | ||
declare namespace vueComponentAnalyzer { | ||
interface FileReport { | ||
name: string, | ||
props: string, | ||
size: number, | ||
lastModifiedTime: number, | ||
children: FileReport[] | ||
} | ||
export function getImportDeclarationTree(rootDir: string, file: string): FileReport; | ||
interface AnalyzeReport { | ||
entries: FileReport[], | ||
count: {[key: string]: number} | ||
} | ||
/** | ||
* name: filename | ||
* props: props defined in the component | ||
* size: filesize | ||
* lastModifiedTime: date modified the file | ||
* children: information array this file is importing | ||
*/ | ||
export interface FileReport { | ||
name: string, | ||
props: string, | ||
size: number, | ||
lastModifiedTime: number, | ||
children: FileReport[] | ||
} | ||
export type FileCount = {[key: string]: number} | ||
export interface AnalyzeReport { | ||
entries: FileReport[], | ||
count: FileCount | ||
} | ||
/** | ||
* get import tree as a JSON. | ||
* @param {string} fileName entry file name | ||
* @param {string[]} parents entries of already analyzed file name | ||
*/ | ||
export function getImportDeclarationTree(fileName: string, parents?: string[] = []): FileReport; | ||
export function analyze(): Promise<void>; | ||
function analyzeFromCLI(): Promise<void>; |
Sorry, the diff of this file is not supported yet
419
68
32475
11
+ Addedbody-parser@1.20.1(transitive)
+ Addedexpress@4.18.2(transitive)
+ Addedqs@6.11.0(transitive)
- Removedbody-parser@1.20.0(transitive)
- Removedexpress@4.18.1(transitive)
- Removedqs@6.10.3(transitive)
Updatedexpress@4.18.2