0.4.0 • Published 2 years ago

@drill4j/js-parser v0.4.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 years ago

AST-parser (drill4js-cli utility)

Production build

  1. Set "sourceMap": false, in tsconfig.json

    TODO: add separate build config

  2. Run

   npm run build

Release

To release a new package version:

  1. Bump version in package.json manually
  2. Run commands from Production build section
  3. Run npm publish --dry-run:

    • ensure that only necessary files are listed in package preview

    • ensure that npm-shrinkwrap.json does not include development dependencies

  4. Run npm publish or npm publish --tag beta

Development build & debug

  1. Install development dependencies

      rm -rf node_modules
      npm i
  2. Set "sourceMap": true, in tsconfig.json

  3. Run webpack development server

      npm run dev
  4. Attach debugger to the process started with npm run dev

    VScode:

    • Run Debug on fixtures launch configuration
    • Edit configuration to debug on different files

    Other IDEs:

    • Attach debugger of your choice to the running process, use .vscode/launch.json Debug on fixtures configuration as the example

What is WASM module in `src/third-party/chromehash"

This modules provides algorithm that V8 uses internally to uniquely identify each script

brief explanation:

  1. js-parser utilizes it to get hash for each bundle file

    Here, terms script and bundle file are used interchangeably. Both indicate the javascript files executed in browser.

  2. V8 attaches the exact same hash for each script in Debugger.scriptParsed event

  3. js-agent matches hashes provided by V8 with hashes calculated by js-parser to map coverage to the correct bundle file

  4. Then bundle coverage is mapped to original sources (e.g. TypeScript files). For further details see js-agent repository