Skip to content

Commit 5b373ff

Browse files
committed
revert(polyglot): Remove polyglot mode
BREAKING CHANGE: I'd like to still support C++ and other languages in the future! But I'm much happier doing so by separating the extraction & input phases to the degree that documentation.js can read the output of another module that extracts JSDoc comments from C++ code, rather than having CPP support in it. Fixes #850. Fixes #731. Fixes #702. Fixes #132.
1 parent b42c0d7 commit 5b373ff

File tree

15 files changed

+37
-1101
lines changed

15 files changed

+37
-1101
lines changed

__tests__/__snapshots__/bin.js.snap

+2-203
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`--config 1`] = `
55
<html>
66
<head>
77
<meta charset='utf-8' />
8-
<title>documentation 4.0.0-rc.1 | Documentation</title>
8+
<title>documentation 4.0.0 | Documentation</title>
99
<meta name='viewport' content='width=device-width,initial-scale=1'>
1010
<link href='assets/bass.css' type='text/css' rel='stylesheet' />
1111
<link href='assets/style.css' type='text/css' rel='stylesheet' />
@@ -17,7 +17,7 @@ exports[`--config 1`] = `
1717
<div class='fixed xs-hide fix-3 overflow-auto max-height-100'>
1818
<div class='py1 px2'>
1919
<h3 class='mb0 no-anchor'>documentation</h3>
20-
<div class='mb1'><code>4.0.0-rc.1</code></div>
20+
<div class='mb1'><code>4.0.0</code></div>
2121
<input
2222
placeholder='Filter'
2323
id='filter-input'
@@ -1819,204 +1819,3 @@ f5 comment
18191819
`;
18201820
18211821
exports[`lint command generates lint output 1`] = `""`;
1822-
1823-
exports[`polyglot mode 1`] = `
1824-
Array [
1825-
Object {
1826-
"augments": Array [],
1827-
"context": Object {
1828-
"file": "[path]",
1829-
"loc": Object {
1830-
"end": Object {
1831-
"column": 3,
1832-
"line": 40,
1833-
},
1834-
"start": Object {
1835-
"column": 1,
1836-
"line": 35,
1837-
},
1838-
},
1839-
},
1840-
"description": Object {
1841-
"children": Array [
1842-
Object {
1843-
"children": Array [
1844-
Object {
1845-
"position": Object {
1846-
"end": Object {
1847-
"column": 35,
1848-
"line": 1,
1849-
"offset": 34,
1850-
},
1851-
"indent": Array [],
1852-
"start": Object {
1853-
"column": 1,
1854-
"line": 1,
1855-
"offset": 0,
1856-
},
1857-
},
1858-
"type": "text",
1859-
"value": "This method moves a hex to a color",
1860-
},
1861-
],
1862-
"position": Object {
1863-
"end": Object {
1864-
"column": 35,
1865-
"line": 1,
1866-
"offset": 34,
1867-
},
1868-
"indent": Array [],
1869-
"start": Object {
1870-
"column": 1,
1871-
"line": 1,
1872-
"offset": 0,
1873-
},
1874-
},
1875-
"type": "paragraph",
1876-
},
1877-
],
1878-
"position": Object {
1879-
"end": Object {
1880-
"column": 35,
1881-
"line": 1,
1882-
"offset": 34,
1883-
},
1884-
"start": Object {
1885-
"column": 1,
1886-
"line": 1,
1887-
"offset": 0,
1888-
},
1889-
},
1890-
"type": "root",
1891-
},
1892-
"examples": Array [],
1893-
"loc": Object {
1894-
"end": Object {
1895-
"column": 3,
1896-
"line": 40,
1897-
},
1898-
"start": Object {
1899-
"column": 1,
1900-
"line": 35,
1901-
},
1902-
},
1903-
"members": Object {
1904-
"events": Array [],
1905-
"global": Array [],
1906-
"inner": Array [],
1907-
"instance": Array [],
1908-
"static": Array [],
1909-
},
1910-
"name": "hexToUInt32Color",
1911-
"namespace": "hexToUInt32Color",
1912-
"params": Array [
1913-
Object {
1914-
"lineNumber": 3,
1915-
"name": "hex",
1916-
"title": "param",
1917-
"type": Object {
1918-
"name": "string",
1919-
"type": "NameExpression",
1920-
},
1921-
},
1922-
],
1923-
"path": Array [
1924-
Object {
1925-
"name": "hexToUInt32Color",
1926-
},
1927-
],
1928-
"properties": Array [],
1929-
"returns": Array [
1930-
Object {
1931-
"description": Object {
1932-
"children": Array [
1933-
Object {
1934-
"children": Array [
1935-
Object {
1936-
"position": Object {
1937-
"end": Object {
1938-
"column": 6,
1939-
"line": 1,
1940-
"offset": 5,
1941-
},
1942-
"indent": Array [],
1943-
"start": Object {
1944-
"column": 1,
1945-
"line": 1,
1946-
"offset": 0,
1947-
},
1948-
},
1949-
"type": "text",
1950-
"value": "color",
1951-
},
1952-
],
1953-
"position": Object {
1954-
"end": Object {
1955-
"column": 6,
1956-
"line": 1,
1957-
"offset": 5,
1958-
},
1959-
"indent": Array [],
1960-
"start": Object {
1961-
"column": 1,
1962-
"line": 1,
1963-
"offset": 0,
1964-
},
1965-
},
1966-
"type": "paragraph",
1967-
},
1968-
],
1969-
"position": Object {
1970-
"end": Object {
1971-
"column": 6,
1972-
"line": 1,
1973-
"offset": 5,
1974-
},
1975-
"start": Object {
1976-
"column": 1,
1977-
"line": 1,
1978-
"offset": 0,
1979-
},
1980-
},
1981-
"type": "root",
1982-
},
1983-
"title": "returns",
1984-
"type": Object {
1985-
"name": "number",
1986-
"type": "NameExpression",
1987-
},
1988-
},
1989-
],
1990-
"sees": Array [],
1991-
"tags": Array [
1992-
Object {
1993-
"description": null,
1994-
"lineNumber": 2,
1995-
"name": "hexToUInt32Color",
1996-
"title": "name",
1997-
},
1998-
Object {
1999-
"description": null,
2000-
"lineNumber": 3,
2001-
"name": "hex",
2002-
"title": "param",
2003-
"type": Object {
2004-
"name": "string",
2005-
"type": "NameExpression",
2006-
},
2007-
},
2008-
Object {
2009-
"description": "color",
2010-
"lineNumber": 4,
2011-
"title": "returns",
2012-
"type": Object {
2013-
"name": "number",
2014-
"type": "NameExpression",
2015-
},
2016-
},
2017-
],
2018-
"throws": Array [],
2019-
"todos": Array [],
2020-
},
2021-
]
2022-
`;

__tests__/__snapshots__/test.js.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ Array [
4242
"loc": SourceLocation {
4343
"end": Position {
4444
"column": 1,
45-
"line": 12,
45+
"line": 10,
4646
},
4747
"start": Position {
4848
"column": 0,
49-
"line": 10,
49+
"line": 8,
5050
},
5151
},
5252
},
@@ -142,11 +142,11 @@ Array [
142142
"loc": SourceLocation {
143143
"end": Position {
144144
"column": 3,
145-
"line": 9,
145+
"line": 7,
146146
},
147147
"start": Position {
148148
"column": 0,
149-
"line": 7,
149+
"line": 5,
150150
},
151151
},
152152
"members": Object {

__tests__/bin.js

-18
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ test('defaults to parsing package.json main', async function() {
5858
expect(data.length).toBeTruthy();
5959
});
6060

61-
test('polyglot mode', async function() {
62-
const data = await documentation([
63-
'build fixture/polyglot/blend.cpp --polyglot'
64-
]);
65-
expect(normalize(data)).toMatchSnapshot();
66-
});
67-
6861
test('accepts config file', async function() {
6962
const data = await documentation([
7063
'build fixture/sorting/input.js -c fixture/config.json'
@@ -126,17 +119,6 @@ test('extension option', async function() {
126119
expect(data.length).toBe(1);
127120
});
128121

129-
/*
130-
* This tests that parseExtension adds extensions to smartGlob's
131-
* look through directories.
132-
*/
133-
test('polyglot + parseExtension + smartGlob', async function() {
134-
const data = await documentation([
135-
'build fixture/polyglot ' + '--polyglot --parseExtension=cpp'
136-
]);
137-
expect(data.length).toBe(1);
138-
});
139-
140122
test('extension option', function() {
141123
return documentation(['build fixture/extension.jsx']);
142124
});

__tests__/fixture/external.input.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
require('external');
22
require('external2');
33
require('module-not-found');
4-
// non-js require
5-
require('./polyglot/blend.cpp');
64

75
/**
86
* I am in `external.input.js`.

0 commit comments

Comments
 (0)