mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
refactor: move augment module to @jsdoc/doclet package
This commit is contained in:
parent
69d1a0ad3e
commit
b36ccd5bbe
@ -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,
|
||||
|
||||
@ -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 = {};
|
||||
@ -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();
|
||||
@ -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');
|
||||
|
||||
@ -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.');
|
||||
|
||||
2
packages/jsdoc/test/fixtures/augmentstag4.js
vendored
2
packages/jsdoc/test/fixtures/augmentstag4.js
vendored
@ -1,4 +1,4 @@
|
||||
// used to test jsdoc/augments module directly
|
||||
// used to test @jsdoc/doclet.augments module directly
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user