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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
const augment = require('./lib/augment');
|
||||||
const { combine: combineDoclets, Doclet } = require('./lib/doclet');
|
const { combine: combineDoclets, Doclet } = require('./lib/doclet');
|
||||||
const { Package } = require('./lib/package');
|
const { Package } = require('./lib/package');
|
||||||
const { resolveBorrows } = require('./lib/borrow');
|
const { resolveBorrows } = require('./lib/borrow');
|
||||||
const schema = require('./lib/schema');
|
const schema = require('./lib/schema');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
augment,
|
||||||
combineDoclets,
|
combineDoclets,
|
||||||
Doclet,
|
Doclet,
|
||||||
Package,
|
Package,
|
||||||
|
|||||||
@ -15,12 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Provides methods for augmenting the parse results based on their content.
|
* Provides methods for augmenting the parse results based on their content.
|
||||||
* @module jsdoc/augment
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
const { combine: combineDoclets } = require('./doclet');
|
||||||
const { fromParts, SCOPE, toParts } = require('@jsdoc/core').name;
|
const { fromParts, SCOPE, toParts } = require('@jsdoc/core').name;
|
||||||
const { combineDoclets } = require('@jsdoc/doclet');
|
|
||||||
|
|
||||||
function mapDependencies(index, propertyName) {
|
function mapDependencies(index, propertyName) {
|
||||||
const dependencies = {};
|
const dependencies = {};
|
||||||
@ -13,10 +13,11 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
describe('jsdoc/augment', () => {
|
/* global jsdoc */
|
||||||
|
describe('@jsdoc/doclet/lib/augment', () => {
|
||||||
// TODO: more tests
|
// TODO: more tests
|
||||||
|
|
||||||
const augment = require('jsdoc/augment');
|
const augment = require('../../lib/augment');
|
||||||
|
|
||||||
it('should exist', () => {
|
it('should exist', () => {
|
||||||
expect(augment).toBeObject();
|
expect(augment).toBeObject();
|
||||||
@ -20,6 +20,14 @@ describe('@jsdoc/doclet', () => {
|
|||||||
expect(doclet).toBeObject();
|
expect(doclet).toBeObject();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('augment', () => {
|
||||||
|
it('is lib/augment', () => {
|
||||||
|
const augment = require('../../lib/augment');
|
||||||
|
|
||||||
|
expect(doclet.augment).toBe(augment);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('combineDoclets', () => {
|
describe('combineDoclets', () => {
|
||||||
it('is lib/doclet.combine', () => {
|
it('is lib/doclet.combine', () => {
|
||||||
const { combine } = require('../../lib/doclet');
|
const { combine } = require('../../lib/doclet');
|
||||||
|
|||||||
@ -338,7 +338,7 @@ module.exports = (() => {
|
|||||||
|
|
||||||
cli.parseFiles = () => {
|
cli.parseFiles = () => {
|
||||||
// Must be imported after the config is loaded.
|
// Must be imported after the config is loaded.
|
||||||
const augment = require('jsdoc/augment');
|
const { augmentAll } = require('@jsdoc/doclet').augment;
|
||||||
|
|
||||||
let docs;
|
let docs;
|
||||||
const env = dependencies.get('env');
|
const env = dependencies.get('env');
|
||||||
@ -353,7 +353,7 @@ module.exports = (() => {
|
|||||||
docs.push(packageDocs);
|
docs.push(packageDocs);
|
||||||
|
|
||||||
log.debug('Adding inherited symbols, mixins, and interface implementations...');
|
log.debug('Adding inherited symbols, mixins, and interface implementations...');
|
||||||
augment.augmentAll(docs);
|
augmentAll(docs);
|
||||||
log.debug('Adding borrowed doclets...');
|
log.debug('Adding borrowed doclets...');
|
||||||
resolveBorrows(docs);
|
resolveBorrows(docs);
|
||||||
log.debug('Post-processing complete.');
|
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
|
* @constructor
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
const { augmentAll } = require('jsdoc/augment');
|
const { augmentAll } = require('@jsdoc/doclet').augment;
|
||||||
const { createParser } = require('jsdoc/src/parser');
|
const { createParser } = require('jsdoc/src/parser');
|
||||||
const { EventBus } = require('@jsdoc/util');
|
const { EventBus } = require('@jsdoc/util');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|||||||
@ -13,14 +13,14 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
const augment = require('jsdoc/augment');
|
const { augmentAll } = require('@jsdoc/doclet').augment;
|
||||||
const { SCOPE } = require('@jsdoc/core').name;
|
const { SCOPE } = require('@jsdoc/core').name;
|
||||||
|
|
||||||
describe('mixins', () => {
|
describe('mixins', () => {
|
||||||
describe('doclet augmentation', () => {
|
describe('doclet augmentation', () => {
|
||||||
const docSet = jsdoc.getDocSetFromFile('test/fixtures/mixintag2.js');
|
const docSet = jsdoc.getDocSetFromFile('test/fixtures/mixintag2.js');
|
||||||
|
|
||||||
augment.augmentAll(docSet.doclets);
|
augmentAll(docSet.doclets);
|
||||||
|
|
||||||
it('should create doclets for mixed-in symbols', () => {
|
it('should create doclets for mixed-in symbols', () => {
|
||||||
const objectBMethod = docSet.getByLongname('module:mixy.ObjectB.method')[0];
|
const objectBMethod = docSet.getByLongname('module:mixy.ObjectB.method')[0];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user