{
"repo": "sloppy-module-parser",
"timestamp": "2026-01-16T23:56:14.856Z",
"entryPoint": "parse.js",
"exports": {
"packageJson": {
"main": "parse.js"
}
},
"api": {
"file": "parse.js",
"exports": [],
"classes": [],
"functions": [
{
"name": "init"
},
{
"name": "parse"
},
{
"name": "exports"
},
{
"name": "mjsParse"
},
{
"name": "parseNames"
}
]
},
"readme": {
"content": "# sloppy-module-parser\n\nParse imports/exports/requires with a focus on speed over 100% correctness\n\n```\nnpm install sloppy-module-parser\n```\n\nSometimes it might report requires that are indeed not requires but tries to not miss any.\nThis limitation gives it a massive speed boost compared to other parsers.\n\n## Usage\n\n```js\nconst { init, parse } = require('sloppy-module-parser')\n\nawait init() // needed to init the async esm parser used\n\nconsole.log(parse(src))\n```\n\n## API\n\n#### `async parser.init()`\n\nInit the async esm parser. Call this before using the module.\n\n#### `const res = parser.parse(src, type = 'module', strictMode = true)`\n\nParses imports/requires from the source. `type` helps it understand what it should parse for.\n\nType should be one of the following: `module` / `script` / `json`.\n\nIf strict mode is false, and type is not `module`, it autodetects if any `import` / `export` statements\nare used and if so auto corrects the type. This is useful for module interop.\n\nThe returned ",
"sections": [
"intro",
"usage",
"api",
"license"
],
"hasApi": true,
"hasExamples": true,
"exampleCount": 3,
"examples": [
"npm install sloppy-module-parser",
"const { init, parse } = require('sloppy-module-parser')\n\nawait init() // needed to init the async esm parser used\n\nconsole.log(parse(src))",
"{\n type: 'module',\n resolutions: [\n {\n isImport: boolean, // is it an import or a require\n isAddon: boolean, // is this import / require pointing to a native addon\n position: [statementStart, inputStart, inputEnd], // where is the statement, might be null\n input: string, // the input to import / require, `null` is if it is unknown at parse time\n output: null // what it should resolve to, just set for conveinience\n },\n ...\n ],\n namedImports: [\n {\n isWildcard: boolean, // is it a wildcard import\n isExport: boolean, // reexports the import\n names: [string, ...], // the named imports,\n from: referenceToRelevantResolution\n }\n ],\n exports: [string, ...] // only default populated for esm\n}"
]
},
"patterns": []
}