-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
69 additions
and
63 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cSpell.words": [ | ||
"napi", | ||
"vistor" | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import test from 'ava' | ||
import { performance } from 'perf_hooks'; | ||
import { inspectPackageUsage} from '../index.js' | ||
|
||
|
||
|
||
test('xx', (t) => { | ||
// const start = performance.now() | ||
// const res = inspectPackageUsage("shineout","/Users/ityuany/GitRepository/metric-front"); | ||
// console.log(res); | ||
// const end = performance.now() | ||
// console.log(`inspectPackageUsage cost ${end - start} ms`); | ||
console.log("xx"); | ||
|
||
}) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use swc_ecmascript::{ | ||
ast::{ImportDecl, ImportSpecifier}, | ||
visit::Visit, | ||
}; | ||
|
||
pub struct ImportVisitor { | ||
pub imports: Vec<String>, | ||
pub package_name: String, | ||
} | ||
|
||
impl Visit for ImportVisitor { | ||
fn visit_import_decl(&mut self, n: &ImportDecl) { | ||
if n.src.value == self.package_name { | ||
for specifier in &n.specifiers { | ||
match specifier { | ||
ImportSpecifier::Named(named) => { | ||
self.imports.push(named.local.sym.to_string()); | ||
} | ||
ImportSpecifier::Default(default) => { | ||
self.imports.push(default.local.sym.to_string()); | ||
} | ||
ImportSpecifier::Namespace(namespace) => { | ||
self.imports.push(namespace.local.sym.to_string()); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.