{"name":"ast-module-types","version":"5.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":"xo","fix":"xo --fix","uvu":"uvu test -i fixtures -i utils","test":"npm run lint && npm run uvu","test:ci":"c8 npm run uvu"},"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":">=14"},"devDependencies":{"c8":"^7.13.0","node-source-walk":"^6.0.0","uvu":"^0.5.6","xo":"^0.54.2"},"xo":{"space":true,"ignores":["test/fixtures/*"],"rules":{"arrow-body-style":"off","capitalized-comments":"off","comma-dangle":["error","never"],"curly":["error","multi-line"],"operator-linebreak":["error","after"],"object-curly-spacing":["error","always"],"space-before-function-paren":["error","never"],"unicorn/prefer-module":"off","unicorn/prefer-node-protocol":"off","unicorn/prefer-top-level-await":"off","unicorn/prevent-abbreviations":"off"}},"gitHead":"83a8e93171dfd30a1014539705bd021a84f4485a","_id":"ast-module-types@5.0.0","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-JvqziE0Wc0rXQfma0HZC/aY7URXHFuZV84fJRtP8u+lhp0JYCNd5wJzVXP45t0PH0Mej3ynlzvdyITYIu0G4LQ==","shasum":"32b2b05c56067ff38e95df66f11d6afd6c9ba16b","tarball":"http://registry-npm.ywwl.com/ast-module-types/download/ast-module-types-5.0.0.tgz","fileCount":4,"unpackedSize":11828,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDnXT1hejq8D+Nxgw9ygcNys4M8sLZbWL10Iq5/uRT4rgIhAK9H6MUBy4Nfw4Nkdvn4DvStrdF0uUpKAhZJcUh+YQwK"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkU/9xACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmonIhAAnsfQNa0oBAd9VllXcw4SkZLURqCBhFVPTEvcT+E1aRGX9iGZ\r\nUA/PNdfbqBMiQfA7XI89CFm9quu/gCzCyp+Ukhott2mHEY7LNwigBW5x0vs1\r\nBvSnufqwDpHfqJ9hl0K6Sr+jBuBmvDgqnvYag9OMAjsB+lcBLatgj5U1Y7UB\r\n9ygxCudl/kvUpSW+ulPPs3zPVxse4tfLF8r/kEPFY3WJKcDVvSRtDcBdisNY\r\nLUSrbEMNU5qvFnM0JdoL8pxLnFwKQ0yYvxTIZreE/2mTEzKyv6l0gFjJN/Rr\r\nn+Saq0R8car8I9Gmp/zoQ68kUPVEjjLQu/dinpWuhFKG8Nasd8hLUb79tQtA\r\n8m+/x5UnMXy07+6olXkj8D6Og7jurdG2wBRbFFCKyWqk4bm/taZ7sWXeWFVY\r\nuj6s9gQw40aN50YJ4yIgkswmMTQgcN6Iwrd0/hHBkXBsMvqz2mI0ZoLZuhqV\r\nTfaZdkHwMih8k0I9W9itirNtjVLssDog4jedUIZOuCyGDOOuBuDgpPsDkb0T\r\nORzsQJBJ1qj16EeJhSlrYRrHwZ1gufLh634Sm1Vt5Mh89EmhsApx7RZI/I7c\r\nqmf5X5ry2CfSh0aPGgxyUoRcDZXtm1pbp3UrO7Q61xXhmiO27I1UI6rmofoV\r\nQFs/7+ePs1VHH46FuDV35pH66WpG6phisMY=\r\n=Wy7I\r\n-----END PGP SIGNATURE-----\r\n","size":3662,"noattachment":false,"key":"/ast-module-types/-/ast-module-types-5.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_5.0.0_1683226481056_0.9829236209992667"},"_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":1683226481211,"_cnpm_publish_time":1683226481211,"dist-tags":{"latest":"7.0.0"}}