cjs-module-lexer
Advanced tools
Comparing version 0.5.2 to 0.6.0
@@ -0,1 +1,5 @@ | ||
0.6.0 | ||
- API-only breaking change: Unify JS and Wasm interfaces (https://github.com/guybedford/cjs-module-lexer/pull/27) | ||
- Add type definitions (https://github.com/guybedford/cjs-module-lexer/pull/28) | ||
0.5.2 | ||
@@ -2,0 +6,0 @@ - Support named getter functions (https://github.com/guybedford/cjs-module-lexer/pull/26) |
15
lexer.js
@@ -40,3 +40,3 @@ let source, pos, end; | ||
module.exports = function parseCJS (source, name = '@') { | ||
function parseCJS (source, name = '@') { | ||
resetState(); | ||
@@ -903,3 +903,3 @@ try { | ||
//(https://github.com/acornjs/acorn/blob/master/acorn/src/identifier.js#L23 | ||
// | ||
// | ||
// MIT License | ||
@@ -1039,3 +1039,3 @@ | ||
return; | ||
default: | ||
@@ -1209,3 +1209,3 @@ // no space after "import" -> not an import keyword | ||
function readPrecedingKeyword1 (pos, ch) { | ||
return source.charCodeAt(pos) === ch && (pos === 0 || isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos - 1))); | ||
return source.charCodeAt(pos) === ch && (pos === 0 || isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos - 1))); | ||
} | ||
@@ -1281,3 +1281,3 @@ | ||
default: | ||
return false; | ||
return false; | ||
} | ||
@@ -1328,1 +1328,6 @@ } | ||
} | ||
const initPromise = Promise.resolve(); | ||
module.exports.init = () => initPromise; | ||
module.exports.parse = parseCJS; |
{ | ||
"name": "cjs-module-lexer", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"description": "Lexes CommonJS modules, returning their named exports metadata", | ||
@@ -10,2 +10,3 @@ "main": "lexer.js", | ||
}, | ||
"types": "lexer.d.ts", | ||
"scripts": { | ||
@@ -32,3 +33,4 @@ "test-js": "mocha -b -u tdd test/*.js", | ||
"files": [ | ||
"dist" | ||
"dist", | ||
"lexer.d.ts" | ||
], | ||
@@ -35,0 +37,0 @@ "repository": { |
@@ -22,4 +22,6 @@ # CJS Module Lexer | ||
```js | ||
const parse = require('cjs-module-lexer'); | ||
const { parse } = require('cjs-module-lexer'); | ||
// `init` return a promise for parity with the ESM API, but you do not have to call it | ||
const { exports, reexports } = parse(` | ||
@@ -26,0 +28,0 @@ // named exports detection |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127586
8
1295
419