refactor: move augment module to @jsdoc/doclet package

This commit is contained in:
Jeff Williams 2023-01-22 08:46:16 -08:00
parent 69d1a0ad3e
commit b36ccd5bbe
No known key found for this signature in database
8 changed files with 20 additions and 10 deletions

View File

@ -13,12 +13,14 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
const augment = require('./lib/augment');
const { combine: combineDoclets, Doclet } = require('./lib/doclet');
const { Package } = require('./lib/package');
const { resolveBorrows } = require('./lib/borrow');
const schema = require('./lib/schema');
module.exports = {
augment,
combineDoclets,
Doclet,
Package,

View File

@ -15,12 +15,11 @@
*/
/**
* Provides methods for augmenting the parse results based on their content.
* @module jsdoc/augment
*/
const _ = require('lodash');
const { combine: combineDoclets } = require('./doclet');
const { fromParts, SCOPE, toParts } = require('@jsdoc/core').name;
const { combineDoclets } = require('@jsdoc/doclet');
function mapDependencies(index, propertyName) {
const dependencies = {};

View File

@ -13,10 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
describe('jsdoc/augment', () => {
/* global jsdoc */
describe('@jsdoc/doclet/lib/augment', () => {
// TODO: more tests
const augment = require('jsdoc/augment');
const augment = require('../../lib/augment');
it('should exist', () => {
expect(augment).toBeObject();

View File

@ -20,6 +20,14 @@ describe('@jsdoc/doclet', () => {
expect(doclet).toBeObject();
});
describe('augment', () => {
it('is lib/augment', () => {
const augment = require('../../lib/augment');
expect(doclet.augment).toBe(augment);
});
});
describe('combineDoclets', () => {
it('is lib/doclet.combine', () => {
const { combine } = require('../../lib/doclet');

View File

@ -338,7 +338,7 @@ module.exports = (() => {
cli.parseFiles = () => {
// Must be imported after the config is loaded.
const augment = require('jsdoc/augment');
const { augmentAll } = require('@jsdoc/doclet').augment;
let docs;
const env = dependencies.get('env');
@ -353,7 +353,7 @@ module.exports = (() => {
docs.push(packageDocs);
log.debug('Adding inherited symbols, mixins, and interface implementations...');
augment.augmentAll(docs);
augmentAll(docs);
log.debug('Adding borrowed doclets...');
resolveBorrows(docs);
log.debug('Post-processing complete.');

View File

@ -1,4 +1,4 @@
// used to test jsdoc/augments module directly
// used to test @jsdoc/doclet.augments module directly
/**
* @constructor

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
const { augmentAll } = require('jsdoc/augment');
const { augmentAll } = require('@jsdoc/doclet').augment;
const { createParser } = require('jsdoc/src/parser');
const { EventBus } = require('@jsdoc/util');
const fs = require('fs');

View File

@ -13,14 +13,14 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
const augment = require('jsdoc/augment');
const { augmentAll } = require('@jsdoc/doclet').augment;
const { SCOPE } = require('@jsdoc/core').name;
describe('mixins', () => {
describe('doclet augmentation', () => {
const docSet = jsdoc.getDocSetFromFile('test/fixtures/mixintag2.js');
augment.augmentAll(docSet.doclets);
augmentAll(docSet.doclets);
it('should create doclets for mixed-in symbols', () => {
const objectBMethod = docSet.getByLongname('module:mixy.ObjectB.method')[0];