We now simply use `require()` to load plugins and Markdown highlighters.
Note that `@jsdoc/util.path.commonPrefix`, unlike `jsdoc/path.commonPrefix`, does not append `path.sep` to the return value.
Includes other minor cleanup.
+ Use `cosmiconfig` instead of rolling our own code (which gives us YAML support)
+ Look for the config in these locations, and in this order:
+ A `jsdoc` property in `package.json`
+ `.jsdocrc` (can be JSON or YAML; comments not allowed for JSON)
+ `.jsdocrc.json` (comments allowed)
+ `.jsdocrc.yaml`
+ `.jsdocrc.yml`
+ `.jsdocrc.js`
+ `jsdoc.config.js`
API changes:
+ No more `jsdoc/template` module. Each JSDoc template uses whatever templating system it wants.
+ No more TaffyDB. Each template finds doclets however it wants. (TODO: Update `jsdoc/util/templateHelper` so none of its methods expect a TaffyDB object.)
+ Templates are now loaded with `require('my-template-name-here')`. The resulting object must include a `publish` method.
+ The `publish` method now takes two parameters: a `data` object with `doclets` and `tutorials` properties, and an `options` object. `data.doclets` is just an array.
Other notable changes:
+ No more `haruki` template.
+ Moved the `default` and `silent` templates to new packages.
+ The `.tmpl` files for the `default` template (now called `@jsdoc/template-original`) no longer use custom delimiters.
- tightened-up detection of the correct path for the plugins by checking if the plugin file *itself* actually exists in the given path; it's done this way to cope with scenarios where JSDoc is executed in another project's working directory where *that* project has plugins of itself in a similar directory structure (`plugins/*`).
We DO NOT change the search path used by JSDoc.
- ditto for templates: we know that a template MUST have a `publish.js` file at least, so we go and check if that one exists at the location where we would otherwise have assumed it does.
JSDoc has a few requirements that are somewhat unusual for a Node.js app:
1. We need `require('jsdoc/foo')` to work from any module.
2. We need `require('jsdoc/foo')` to work from external code, such as templates and plugins.
Prior to this commit, JSDoc did two separate things to meet these requirements:
1. Use an npm post-install script to create a symlink from `lib/jsdoc` to `node_modules/jsdoc`.
2. When a user runs JSDoc, copy templates and plugins into the JSDoc directory.
These fixes worked, sort of. But they also caused numerous issues with file permissions, especially on Windows.
We now use the Requizzle module, which hacks the Node.js module system to support JSDoc's use cases. There's no longer a post-install script, and there's no need for a symlink in `node_modules`.