-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I'm using esbuild to bundle a functions library for Google Sheets. After fighting with other bundlers, esbuild made the mapping of my TypeScript code to something that Google Sheets can understand remarkably easy.
For an add-on function to be visible, Google Sheets requires that its JSDoc include the @customfunction directive. The rest of the JSDoc is displayed in a popup as you fill in the function call.
The enable this, I add the @preserve directive to JSDoc comments and set legalComments="inline" to preserve the comments in the output. Then, in post-processing, I remove the @preserve directive and the export statement at the end of the file.
The one problem remaining is the mangling of parameter names, which puts them out of sync with the JSDoc and my online documentation. Given the nature of the library, I can't easily change them. I did add a "restore parameter names" step to post-processing, but it's somewhat brittle and I would much prefer to have a keep-parameter-names option, valid only if keep-names is also set so as to prevent accidental collisions with globally mangled names.
Thanks.