A ECMAScript proposal plugin for ESDoc
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
ESDoc ECMAScript Proposal Plugin enables parsing of experimental ECMAScript proposals in JavaScript documentation generation. This ESDoc plugin extends the parser capabilities to support cutting-edge language features that are not yet part of the official ECMAScript specification.
npm install esdoc-ecmascript-proposal-pluginThis package exports a singleton Plugin instance for ESDoc integration:
// ESDoc automatically loads the plugin - no direct imports needed
// Plugin is configured through ESDoc's configuration system
// Main export: module.exports = new Plugin()The plugin integrates with ESDoc through the plugin system rather than direct imports. The package exports a single instance of the Plugin class, not the class itself.
Configure the plugin in your ESDoc configuration file to enable all experimental features:
{
"source": "./src",
"destination": "./doc",
"plugins": [
{"name": "esdoc-ecmascript-proposal-plugin", "option": {"all": true}}
]
}For selective feature enablement:
{
"source": "./src",
"destination": "./doc",
"plugins": [
{
"name": "esdoc-ecmascript-proposal-plugin",
"option": {
"classProperties": true,
"objectRestSpread": true,
"decorators": true
}
}
]
}The package exports a singleton Plugin instance that integrates with ESDoc's event system.
/**
* ESDoc plugin singleton instance that enables experimental ECMAScript proposals
* This is the main export from the package: module.exports = new Plugin()
*/
const pluginInstance = {
/**
* Event handler called by ESDoc during code parsing phase
* Modifies parser options to enable experimental language features
* @param {Object} ev - ESDoc event object
* @param {Object} ev.data.option - Plugin configuration options
* @param {Array} ev.data.parserOption.plugins - Parser plugins array to modify
* @returns {void}
*/
onHandleCodeParser(ev) { /* implementation in src/Plugin.js */ }
};The plugin accepts configuration through ESDoc's option system:
/**
* Plugin configuration options passed through ESDoc's option system
* @typedef {Object} PluginOptions
* @property {boolean} [all] - Enable all experimental features at once
* @property {boolean} [classProperties] - Enable class properties proposal
* @property {boolean} [objectRestSpread] - Enable object rest/spread operators
* @property {boolean} [doExpressions] - Enable do expressions
* @property {boolean} [functionBind] - Enable function bind operator
* @property {boolean} [functionSent] - Enable function.sent meta property
* @property {boolean} [asyncGenerators] - Enable async generators
* @property {boolean} [decorators] - Enable decorators
* @property {boolean} [exportExtensions] - Enable export extensions
* @property {boolean} [dynamicImport] - Enable dynamic import()
*/The plugin enables parsing of the following ECMAScript proposals:
Enables parsing of class property declarations:
class MyClass {
myProperty = 'value';
static staticProperty = 'static value';
}Enables parsing of object rest and spread operators:
const {a, ...rest} = obj;
const newObj = {...obj, newProperty: 'value'};Enables parsing of do expressions:
const value = do {
if (condition) 'yes';
else 'no';
};Enables parsing of function bind operator (::):
obj::func();
const boundFunc = obj::func;Enables parsing of function.sent meta property:
function* gen() {
console.log(function.sent);
}Enables parsing of async generator functions:
async function* gen() {
yield await Promise.resolve(1);
}Enables parsing of decorator syntax:
@decorator
class MyClass {
@methodDecorator
method() {}
}Enables parsing of export extensions:
export v from 'module';Enables parsing of dynamic import() expressions:
const module = await import('./module.js');The plugin integrates with ESDoc through the event-driven plugin system:
onHandleCodeParser - Called during code parsing phaseThe plugin modifies ESDoc's parser options by:
ev.data.optionev.data.parserOption.pluginsEnable All Features:
{"name": "esdoc-ecmascript-proposal-plugin", "option": {"all": true}}Selective Feature Enablement:
{
"name": "esdoc-ecmascript-proposal-plugin",
"option": {
"classProperties": true,
"objectRestSpread": true
}
}No Configuration (No Features Enabled):
{"name": "esdoc-ecmascript-proposal-plugin"}Install with Tessl CLI
npx tessl i tessl/npm-esdoc-ecmascript-proposal-plugin