Installations
npm install @poppinss/module-methods-extractor
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.8.0
NPM Version
6.14.7
Score
70.8
Supply Chain
99.3
Quality
79.5
Maintenance
100
Vulnerability
100
License
Releases
Update underlying dependencies
Updated on Aug 31, 2020
Updating underlying dependencies
Updated on Jul 18, 2020
Adding prettier
Updated on Jul 04, 2020
Update overall project structure
Updated on Apr 12, 2020
Fixes a bug where esm exports with imports where not handled properly
Updated on Nov 13, 2019
First Release
Updated on Nov 10, 2019
Contributors
Unable to fetch Contributors
Languages
TypeScript (66.22%)
HTML (29.21%)
JavaScript (4.58%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
poppinss
Download Statistics
Total Downloads
1,746
Last Day
1
Last Week
3
Last Month
34
Last Year
161
GitHub Statistics
MIT License
4 Stars
24 Commits
1 Forks
2 Watchers
5 Branches
3 Contributors
Updated on Dec 27, 2023
Bundle Size
10.96 kB
Minified
3.83 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.5
Package Id
@poppinss/module-methods-extractor@1.0.5
Unpacked Size
20.96 kB
Size
6.08 kB
File Count
9
NPM Version
6.14.7
Node Version
14.8.0
Total Downloads
Cumulative downloads
Total Downloads
1,746
Last Day
0%
1
Compared to previous day
Last Week
-25%
3
Compared to previous week
Last Month
126.7%
34
Compared to previous month
Last Year
-42.9%
161
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads

Module methods exporter
Returns a list of method names and line number for a JavaScript or TypeScript module.
This module is used by the AdonisJs VsCode extension to show an autocomplete list of controller methods, event listeners and so on.
The module is tailored for AdonisJs only, which helps in optimizing the way we scan the source code AST.
Table of contents
Usage
Install the package from npm registry as follows:
1import { Extractor } from '@poppinss/Extractor' 2 3const extractor = new Extractor() 4 5const response = extractor.extract(` 6export default class UserController { 7 public async index () { 8 } 9 10 public async store () { 11 } 12} 13`) 14 15assert.deepEqual(response, { 16 kind: 'class', 17 methods: [ 18 { 19 name: 'index', 20 lineno: 2 21 }, 22 { 23 name: 'store', 24 lineno: 5 25 }, 26 ] 27})
Design & Limitations
The module is written to work with AdonisJs, where modules are not imported explicitly but their filenames are passed as a reference. For example:
1Route.get('users', 'UsersController.index')
In the above example, The UsersController
is an actual module that has a default export
on the UserController
class. AdonisJs behind the scenes will use its IoC container to lazy load this class and invoke the defined method.
Features supported
- CommonJs
module.exports
andexports
are supported. - ESM
export default
is supported. - Handle assignment references like
module.exports = exports = UserController
. - Handle inline class declarations like
export default UserController {}
. - Returns
lineno
for all methods.
Limitations
-
Named exports are not allowed, since they are also forbidden by the IoC container automatic bindings.
-
The export reference must be located as a top level property. For example:
1const someObject = { 2 prop: class UserController {} 3} 4 5export default someObject.prop
The above expression is not something we advocate in the AdonisJs eco-system and also it is not a great pattern to use either.
-
Only 3 levels deep assignments are supported.
1// works 2module.exports = exports = UserController 3 4// works 5module.exports = exports = someFunc = UserController 6 7// does not work 8module.exports = exports = someFunc = someOtherFunc = UserController

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/poppinss/.github/docs/SECURITY.md:1
- Info: Found linked content: github.com/poppinss/.github/docs/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/poppinss/.github/docs/SECURITY.md:1
- Info: Found text in security policy: github.com/poppinss/.github/docs/SECURITY.md:1
Reason
project is archived
Details
- Warn: Repository is archived.
Reason
Found 0/21 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'develop'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 3 are checked with a SAST tool
Reason
39 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-4r62-v4vq-hr96
- Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj
- Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf
- Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4
- Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g
- Warn: Project is vulnerable to: GHSA-px4h-xg32-q955
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx
- Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
2.6
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More