{"name":"ast-module-types","version":"4.0.0","description":"Collection of useful helper functions when trying to determine module type (CommonJS or AMD) properties of an AST node.","main":"index.js","scripts":{"lint":"eslint index.js \"test/*.js\"","fix":"npm run lint -- --fix","mocha":"mocha","test":"npm run lint && npm run mocha","test:ci":"c8 npm run mocha"},"repository":{"type":"git","url":"git+https://github.com/dependents/node-ast-module-types.git"},"keywords":["esprima","module","type","define","require","factory"],"author":{"name":"Joel Kemp","email":"joel@mrjoelkemp.com","url":"https://mrjoelkemp.com/"},"license":"MIT","bugs":{"url":"https://github.com/dependents/node-ast-module-types/issues"},"homepage":"https://github.com/dependents/node-ast-module-types","engines":{"node":">=12.0"},"devDependencies":{"c8":"^7.13.0","eslint":"^8.36.0","mocha":"^9.2.2","node-source-walk":"^5.0.0"},"gitHead":"805d4a8a6fef7be78074d92c6eae4bcfd38c98f9","_id":"ast-module-types@4.0.0","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-Kd0o8r6CDazJGCRzs8Ivpn0xj19oNKrULhoJFzhGjRsLpekF2zyZs9Ukz+JvZhWD6smszfepakTFhAaYpsI12g==","shasum":"17e1cadd5b5b108e7295b0cf0cff21ccc226b639","tarball":"http://registry-npm.ywwl.com/ast-module-types/download/ast-module-types-4.0.0.tgz","fileCount":4,"unpackedSize":11068,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjOZR96b221rveDuKtx15rkpAcDjU6D3C/L3aIIGb0ygIgN3x7PEWASWbFPAVkCJuug4CV3Yt500yLkJi9CdKjl4U="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkFrxFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpALA//VzLvEZm8k32BZBPbgiUi+5AGJgU7oEvM9HDC8fkfZobnrCpV\r\ngwhiy7QflPxD+rRjQrJ4HcDfJ7SG90Wf+DL53U8mjemRn3aFNd3CzunDi+u7\r\n2eCoX1MKqEYtyen3MSSHHzjhz8Zuw2jOuM/Ho6JmK79F9qQfhuRRyhXHynoY\r\nlWHNEz2R/2ZPEK7HSvZ/efnsiVPKlF/ya9OAc2LZVWQHsz9O2sA8wdaZy+XB\r\nHSnp4oyUQUl7XZN7Wsr0CAw8GLwb4Wg3zZmMSk40zcYR9ppIX2TbjE3Gxfh1\r\nRgEIBcfR5scP1M2V9WFykcXkEByYrDYzy7G9lZQxbjMWqU1jjzaqTkRQaFVG\r\nDmMqH91ZMD+ZLAchJhZTflWlbqB24sJkL9bY8j+lhIjFwlEplyB4ZDgfhdMW\r\n2/5OZG5Tsk83Wii+RngWVWALRxvBb3Sb82r1lhtZQiNg6FCxa5iQNQqYLB4v\r\nVv+r1TGbZNnMehitBiDOyWN6kbTD6uwCg9drmjZiXTvT8bHWyae1A9TusOOm\r\nKk4ROVvWz9oR3Tx0I1W4XQatuUW1f6+tlHBQRk1UhSyCqjB1mUffJHp2vDBP\r\nb8ZZJEH84apJGJBqTCOdGeop/3MueoxX1EEnFcei5qE6eu/xU/b0HbjB4YjN\r\n8N3VuaNtVWLt73omPR/y9DMEH0DXi9MfqSs=\r\n=WVMT\r\n-----END PGP SIGNATURE-----\r\n","size":3410,"noattachment":false,"key":"/ast-module-types/-/ast-module-types-4.0.0.tgz"},"_npmUser":{"name":"xhmikosr","email":"xhmikosr@gmail.com"},"directories":{},"maintainers":[{"name":"pahen","email":"patrik.henningsson@gmail.com"},{"name":"xhmikosr","email":"xhmikosr@gmail.com"},{"name":"mrjoelkemp","email":"mrjoelkemp@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ast-module-types_4.0.0_1679211589082_0.8642380665579101"},"_hasShrinkwrap":false,"readme":"# ast-module-types\n\n[![CI](https://img.shields.io/github/actions/workflow/status/dependents/node-ast-module-types/ci.yml?branch=main&label=CI&logo=github)](https://github.com/dependents/node-ast-module-types/actions/workflows/ci.yml?query=branch%3Amain)\n[![npm version](https://img.shields.io/npm/v/ast-module-types?logo=npm&logoColor=fff)](https://www.npmjs.com/package/ast-module-types)\n[![npm downloads](https://img.shields.io/npm/dm/ast-module-types)](https://www.npmjs.com/package/ast-module-types)\n\nCollection of useful helper functions when trying to determine\nmodule type (CommonJS or AMD) properties of an AST node.\n\n**AST checks are based on the Esprima (Spidermonkey) format**\n\n```sh\nnpm install ast-module-types\n```\n\n## API\n\nEach of these takes in a single AST node argument\nand returns a boolean.\n\n* `isDefineAMD`: if node matches any form of an AMD `define` function call\n* `isRequire`: if node matches a `require` function all (declaring a dependency)\n* `isTopLevelRequire`: if node matches a `require` at the very top of the file.\n* `isAMDDriverScriptRequire`: if node matches an AMD driver script's require call `require([deps], function)`\n* `isExports`: if the node matches CommonJS `module.exports` or `exports` (defining a module)\n\nDetecting the various forms of defining an AMD module\n\n* `isNamedForm`: if the node is a define call of the form: `define('name', [deps], func)`\n* `isDependencyForm`: if the node is a define call of the form: `define([deps], func)`\n* `isFactoryForm`: if the node is a define call of the form: `define(func(require))`\n* `isNoDependencyForm`: if the node is a define call of the form: `define({})`\n* `isREMForm`: if the node matches the form: `define(function(require, exports, module){});`\n\nES6 Types\n\n*All types abide by the [EStree spec](https://github.com/estree/estree/blob/master/es2015.md)*\n\n* `isES6Import`: if the node is any of the es6 import forms\n* `isES6Export`: if the node is of any es6 export forms\n\n## Usage\n\n```js\nconst types = require('ast-module-types');\n\n// Assume node is some node of an AST that you parsed using esprima or esprima-fb\n// ...\n\nconsole.log(types.isDefineAMD(node));\n```\n\n## License\n\n[MIT](LICENSE)\n","publish_time":1679211589240,"_cnpm_publish_time":1679211589240,"dist-tags":{"latest":"7.0.0"}}