feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -59,7 +59,8 @@ When using the ESM version, Wasm is supported instead:
```js
import { parse, init } from 'cjs-module-lexer';
// init needs to be called and waited upon
// init() needs to be called and waited upon, or use initSync() to compile
// Wasm blockingly and synchronously.
await init();
const { exports, reexports } = parse(source);
```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -5,3 +5,4 @@ export interface Exports {
export declare function parse(source: string, name?: string): Exports;
export declare function init(): Promise<void>;
export declare function initSync(): void;

View File

@@ -1439,4 +1439,5 @@ function isExpressionTerminator (curPos) {
const initPromise = Promise.resolve();
module.exports.init = () => initPromise;
module.exports.initSync = () => {};
module.exports.parse = parseCJS;

View File

@@ -1,6 +1,6 @@
{
"name": "cjs-module-lexer",
"version": "1.3.1",
"version": "1.4.1",
"description": "Lexes CommonJS modules, returning their named exports metadata",
"main": "lexer.js",
"exports": {
@@ -14,20 +14,24 @@
"scripts": {
"test-js": "mocha -b -u tdd test/*.js",
"test-wasm": "cross-env WASM=1 mocha -b -u tdd test/*.js",
"test": "npm run test-wasm && npm run test-js",
"test-wasm-sync": "cross-env WASM_SYNC=1 mocha -b -u tdd test/*.js",
"test": "npm run test-wasm ; npm run test-wasm-sync ; npm run test-js",
"bench": "node --expose-gc bench/index.mjs",
"build": "node build.js",
"build-wasm": "make lib/lexer.wasm && node build.js",
"build": "node build.js ; babel dist/lexer.mjs -o dist/lexer.js ; terser dist/lexer.js -o dist/lexer.js",
"build-wasm": "make lib/lexer.wasm ; node build.js",
"prepublishOnly": "make && npm run build",
"footprint": "npm run build && cat dist/lexer.js | gzip -9f | wc -c"
},
"author": "Guy Bedford",
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-transform-modules-commonjs": "^7.5.0",
"cross-env": "^7.0.3",
"esbuild": "^0.19.12",
"kleur": "^2.0.2",
"mocha": "^9.1.3"
"mocha": "^9.1.3",
"terser": "^4.1.4"
},
"files": [
"dist",
@@ -41,4 +45,4 @@
"url": "https://github.com/nodejs/cjs-module-lexer/issues"
},
"homepage": "https://github.com/nodejs/cjs-module-lexer#readme"
}
}