The `get-amd-module-type` package, currently at version 6.0.2, is a utility for statically analyzing JavaScript code to determine the specific pattern of an Asynchronous Module Definition (AMD) module. It supports analysis from file paths, raw source code strings, or Abstract Syntax Tree (AST) nodes, returning one of several predefined AMD module types such as 'named', 'deps', 'rem' (CommonJS wrapper), 'factory', 'nodeps' (object literal), or 'driver' (requirejs-style `require`). The package maintains a steady release cadence, primarily updating dependencies and aligning with Node.js LTS cycles; for instance, version 6.0.0 introduced a breaking change by dropping support for Node.js versions prior to 18. This library is crucial for tools performing code transformation, linting, or dependency analysis in environments that still utilize AMD module formats.
npm install get-amd-module-typeVerified import paths — ran on the pinned version, not inferred.
Demonstrates asynchronous and synchronous file analysis, as well as direct source code string analysis using the `get-amd-module-type` package.
Upgrade your Node.js runtime to version 18 or higher. If unable to upgrade Node.js, pin `get-amd-module-type` to a compatible version (e.g., `npm install get-amd-module-type@5`).
Upgrade your Node.js runtime to version 14 or higher (for v5.x) or 18 or higher (for v6.x). If unable to upgrade Node.js, pin `get-amd-module-type` to a compatible version.
Be explicit in your choice of API: use `getType(path, callback)` for non-blocking I/O, or `getType.sync(path)` for simpler scripting where blocking is acceptable. Always handle errors for both patterns.
Ensure the package is installed (`npm install get-amd-module-type`). If the issue persists, check your Node.js version (`node -v`) and verify it meets the `get-amd-module-type` requirements (e.g., Node.js >=18 for v6.x). Upgrade Node.js or downgrade the package if necessary.
Ensure your file is treated as CommonJS (e.g., by using `.js` extension in a project without `"type": "module"` in `package.json`). If you must use `get-amd-module-type` in an ESM file, consider dynamically importing it or using `createRequire` from the `module` module if running in Node.js.
Stick to the documented CommonJS import pattern: `const getType = require('get-amd-module-type');`. The package exports a single function as its main entry point.No dependency data recorded yet.