ashley-evans / how-many-buzzwords

Some buzzwords are incredibly overused, a simple tool tool to find the biggest culprits
2 stars 0 forks source link

Update Find keyphrase lambda to pure ES module #328

Closed ashley-evans closed 1 year ago

ashley-evans commented 2 years ago

Value Added

Enables future work to update retext to the latest version

Description

Currently, the find keyphrase lambda uses the retext library to find keywords and phrases in text. Unfortunately, the most recent versions of the retext libraries are pure ES modules, meaning that they cannot be required and most be imported by another ES module or via dynamic imports.

To get around this, the lambda currently uses an older version of the libraries that were written prior to their transition away from CommonJS.

Transitioning this lambda from CommonJS to ESM will allow the latest versions of these libraries to be used and also provide a basis for any future development that uses ESM.

Acceptance Criteria

AC01

AC02

ashley-evans commented 2 years ago

Waiting for Jest (or more accurately node experimental vm modules to be non-experimental) to fully support ESM before doing this. May be possible to achieve desired affect of having latest version by using dynamic import, however, would need to figure out a way of stopping TSC from compiling dynamic import into require