@firebase/api-documenter 0.1.2-canary.233e117f0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +16 -0
  3. package/dist/cli/ApiDocumenterCommandLine.d.ts +22 -0
  4. package/dist/cli/ApiDocumenterCommandLine.js +44 -0
  5. package/dist/cli/ApiDocumenterCommandLine.js.map +1 -0
  6. package/dist/cli/BaseAction.d.ts +37 -0
  7. package/dist/cli/BaseAction.js +125 -0
  8. package/dist/cli/BaseAction.js.map +1 -0
  9. package/dist/cli/MarkdownAction.d.ts +22 -0
  10. package/dist/cli/MarkdownAction.js +47 -0
  11. package/dist/cli/MarkdownAction.js.map +1 -0
  12. package/dist/cli/TocAction.d.ts +25 -0
  13. package/dist/cli/TocAction.js +67 -0
  14. package/dist/cli/TocAction.js.map +1 -0
  15. package/dist/documenters/DocumenterConfig.d.ts +45 -0
  16. package/dist/documenters/DocumenterConfig.js +63 -0
  17. package/dist/documenters/DocumenterConfig.js.map +1 -0
  18. package/dist/documenters/IConfigFile.d.ts +98 -0
  19. package/dist/documenters/IConfigFile.js +19 -0
  20. package/dist/documenters/IConfigFile.js.map +1 -0
  21. package/dist/documenters/MarkdownDocumenter.d.ts +75 -0
  22. package/dist/documenters/MarkdownDocumenter.js +750 -0
  23. package/dist/documenters/MarkdownDocumenter.js.map +1 -0
  24. package/dist/documenters/MarkdownDocumenterHelpers.d.ts +40 -0
  25. package/dist/documenters/MarkdownDocumenterHelpers.js +306 -0
  26. package/dist/documenters/MarkdownDocumenterHelpers.js.map +1 -0
  27. package/dist/index.d.ts +27 -0
  28. package/dist/index.js +29 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/markdown/CustomMarkdownEmitter.d.ts +32 -0
  31. package/dist/markdown/CustomMarkdownEmitter.js +161 -0
  32. package/dist/markdown/CustomMarkdownEmitter.js.map +1 -0
  33. package/dist/markdown/MarkdownEmitter.d.ts +48 -0
  34. package/dist/markdown/MarkdownEmitter.js +243 -0
  35. package/dist/markdown/MarkdownEmitter.js.map +1 -0
  36. package/dist/markdown/test/CustomMarkdownEmitter.test.d.ts +17 -0
  37. package/dist/markdown/test/CustomMarkdownEmitter.test.js +205 -0
  38. package/dist/markdown/test/CustomMarkdownEmitter.test.js.map +1 -0
  39. package/dist/nodes/CustomDocNodeKind.d.ts +32 -0
  40. package/dist/nodes/CustomDocNodeKind.js +58 -0
  41. package/dist/nodes/CustomDocNodeKind.js.map +1 -0
  42. package/dist/nodes/DocEmphasisSpan.d.ts +35 -0
  43. package/dist/nodes/DocEmphasisSpan.js +39 -0
  44. package/dist/nodes/DocEmphasisSpan.js.map +1 -0
  45. package/dist/nodes/DocHeading.d.ts +38 -0
  46. package/dist/nodes/DocHeading.js +45 -0
  47. package/dist/nodes/DocHeading.js.map +1 -0
  48. package/dist/nodes/DocNoteBox.d.ts +33 -0
  49. package/dist/nodes/DocNoteBox.js +41 -0
  50. package/dist/nodes/DocNoteBox.js.map +1 -0
  51. package/dist/nodes/DocTable.d.ts +41 -0
  52. package/dist/nodes/DocTable.js +77 -0
  53. package/dist/nodes/DocTable.js.map +1 -0
  54. package/dist/nodes/DocTableCell.d.ts +31 -0
  55. package/dist/nodes/DocTableCell.js +37 -0
  56. package/dist/nodes/DocTableCell.js.map +1 -0
  57. package/dist/nodes/DocTableRow.d.ts +38 -0
  58. package/dist/nodes/DocTableRow.js +68 -0
  59. package/dist/nodes/DocTableRow.js.map +1 -0
  60. package/dist/plugin/IApiDocumenterPluginManifest.d.ts +85 -0
  61. package/dist/plugin/IApiDocumenterPluginManifest.js +19 -0
  62. package/dist/plugin/IApiDocumenterPluginManifest.js.map +1 -0
  63. package/dist/plugin/MarkdownDocumenterAccessor.d.ts +41 -0
  64. package/dist/plugin/MarkdownDocumenterAccessor.js +44 -0
  65. package/dist/plugin/MarkdownDocumenterAccessor.js.map +1 -0
  66. package/dist/plugin/MarkdownDocumenterFeature.d.ts +88 -0
  67. package/dist/plugin/MarkdownDocumenterFeature.js +66 -0
  68. package/dist/plugin/MarkdownDocumenterFeature.js.map +1 -0
  69. package/dist/plugin/PluginFeature.d.ts +61 -0
  70. package/dist/plugin/PluginFeature.js +76 -0
  71. package/dist/plugin/PluginFeature.js.map +1 -0
  72. package/dist/plugin/PluginLoader.d.ts +22 -0
  73. package/dist/plugin/PluginLoader.js +100 -0
  74. package/dist/plugin/PluginLoader.js.map +1 -0
  75. package/dist/schemas/api-documenter-template.json +92 -0
  76. package/dist/schemas/api-documenter.schema.json +42 -0
  77. package/dist/start.d.ts +18 -0
  78. package/dist/start.js +32 -0
  79. package/dist/start.js.map +1 -0
  80. package/dist/toc.d.ts +25 -0
  81. package/dist/toc.js +61 -0
  82. package/dist/toc.js.map +1 -0
  83. package/dist/utils/IndentedWriter.d.ts +116 -0
  84. package/dist/utils/IndentedWriter.js +213 -0
  85. package/dist/utils/IndentedWriter.js.map +1 -0
  86. package/dist/utils/Utilities.d.ts +28 -0
  87. package/dist/utils/Utilities.js +47 -0
  88. package/dist/utils/Utilities.js.map +1 -0
  89. package/dist/utils/test/IndentedWriter.test.d.ts +17 -0
  90. package/dist/utils/test/IndentedWriter.test.js +87 -0
  91. package/dist/utils/test/IndentedWriter.test.js.map +1 -0
  92. package/package.json +38 -0
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright 2020 Google LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.IndentedWriter = void 0;
20
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
21
+ // See LICENSE in the project root for license information.
22
+ const node_core_library_1 = require("@rushstack/node-core-library");
23
+ /**
24
+ * A utility for writing indented text.
25
+ *
26
+ * @remarks
27
+ *
28
+ * Note that the indentation is inserted at the last possible opportunity.
29
+ * For example, this code...
30
+ *
31
+ * ```ts
32
+ * writer.write('begin\n');
33
+ * writer.increaseIndent();
34
+ * writer.write('one\ntwo\n');
35
+ * writer.decreaseIndent();
36
+ * writer.increaseIndent();
37
+ * writer.decreaseIndent();
38
+ * writer.write('end');
39
+ * ```
40
+ *
41
+ * ...would produce this output:
42
+ *
43
+ * ```
44
+ * begin
45
+ * one
46
+ * two
47
+ * end
48
+ * ```
49
+ */
50
+ class IndentedWriter {
51
+ constructor(builder) {
52
+ /**
53
+ * The text characters used to create one level of indentation.
54
+ * Two spaces by default.
55
+ */
56
+ this.defaultIndentPrefix = ' ';
57
+ this._builder = builder === undefined ? new node_core_library_1.StringBuilder() : builder;
58
+ this._latestChunk = undefined;
59
+ this._previousChunk = undefined;
60
+ this._atStartOfLine = true;
61
+ this._indentStack = [];
62
+ this._indentText = '';
63
+ }
64
+ /**
65
+ * Retrieves the output that was built so far.
66
+ */
67
+ getText() {
68
+ return this._builder.toString();
69
+ }
70
+ toString() {
71
+ return this.getText();
72
+ }
73
+ /**
74
+ * Increases the indentation. Normally the indentation is two spaces,
75
+ * however an arbitrary prefix can optional be specified. (For example,
76
+ * the prefix could be "// " to indent and comment simultaneously.)
77
+ * Each call to IndentedWriter.increaseIndent() must be followed by a
78
+ * corresponding call to IndentedWriter.decreaseIndent().
79
+ */
80
+ increaseIndent(indentPrefix) {
81
+ this._indentStack.push(indentPrefix !== undefined ? indentPrefix : this.defaultIndentPrefix);
82
+ this._updateIndentText();
83
+ }
84
+ /**
85
+ * Decreases the indentation, reverting the effect of the corresponding call
86
+ * to IndentedWriter.increaseIndent().
87
+ */
88
+ decreaseIndent() {
89
+ this._indentStack.pop();
90
+ this._updateIndentText();
91
+ }
92
+ /**
93
+ * A shorthand for ensuring that increaseIndent()/decreaseIndent() occur
94
+ * in pairs.
95
+ */
96
+ indentScope(scope, indentPrefix) {
97
+ this.increaseIndent(indentPrefix);
98
+ scope();
99
+ this.decreaseIndent();
100
+ }
101
+ /**
102
+ * Adds a newline if the file pointer is not already at the start of the line (or start of the stream).
103
+ */
104
+ ensureNewLine() {
105
+ const lastCharacter = this.peekLastCharacter();
106
+ if (lastCharacter !== '\n' && lastCharacter !== '') {
107
+ this._writeNewLine();
108
+ }
109
+ }
110
+ /**
111
+ * Adds up to two newlines to ensure that there is a blank line above the current line.
112
+ */
113
+ ensureSkippedLine() {
114
+ if (this.peekLastCharacter() !== '\n') {
115
+ this._writeNewLine();
116
+ }
117
+ const secondLastCharacter = this.peekSecondLastCharacter();
118
+ if (secondLastCharacter !== '\n' && secondLastCharacter !== '') {
119
+ this._writeNewLine();
120
+ }
121
+ }
122
+ /**
123
+ * Returns the last character that was written, or an empty string if no characters have been written yet.
124
+ */
125
+ peekLastCharacter() {
126
+ if (this._latestChunk !== undefined) {
127
+ return this._latestChunk.substr(-1, 1);
128
+ }
129
+ return '';
130
+ }
131
+ /**
132
+ * Returns the second to last character that was written, or an empty string if less than one characters
133
+ * have been written yet.
134
+ */
135
+ peekSecondLastCharacter() {
136
+ if (this._latestChunk !== undefined) {
137
+ if (this._latestChunk.length > 1) {
138
+ return this._latestChunk.substr(-2, 1);
139
+ }
140
+ if (this._previousChunk !== undefined) {
141
+ return this._previousChunk.substr(-1, 1);
142
+ }
143
+ }
144
+ return '';
145
+ }
146
+ /**
147
+ * Writes some text to the internal string buffer, applying indentation according
148
+ * to the current indentation level. If the string contains multiple newlines,
149
+ * each line will be indented separately.
150
+ */
151
+ write(message) {
152
+ if (message.length === 0) {
153
+ return;
154
+ }
155
+ // If there are no newline characters, then append the string verbatim
156
+ if (!/[\r\n]/.test(message)) {
157
+ this._writeLinePart(message);
158
+ return;
159
+ }
160
+ // Otherwise split the lines and write each one individually
161
+ let first = true;
162
+ for (const linePart of message.split('\n')) {
163
+ if (!first) {
164
+ this._writeNewLine();
165
+ }
166
+ else {
167
+ first = false;
168
+ }
169
+ if (linePart) {
170
+ this._writeLinePart(linePart.replace(/[\r]/g, ''));
171
+ }
172
+ }
173
+ }
174
+ /**
175
+ * A shorthand for writing an optional message, followed by a newline.
176
+ * Indentation is applied following the semantics of IndentedWriter.write().
177
+ */
178
+ writeLine(message = '') {
179
+ if (message.length > 0) {
180
+ this.write(message);
181
+ }
182
+ this._writeNewLine();
183
+ }
184
+ /**
185
+ * Writes a string that does not contain any newline characters.
186
+ */
187
+ _writeLinePart(message) {
188
+ if (message.length > 0) {
189
+ if (this._atStartOfLine && this._indentText.length > 0) {
190
+ this._write(this._indentText);
191
+ }
192
+ this._write(message);
193
+ this._atStartOfLine = false;
194
+ }
195
+ }
196
+ _writeNewLine() {
197
+ if (this._atStartOfLine && this._indentText.length > 0) {
198
+ this._write(this._indentText);
199
+ }
200
+ this._write('\n');
201
+ this._atStartOfLine = true;
202
+ }
203
+ _write(s) {
204
+ this._previousChunk = this._latestChunk;
205
+ this._latestChunk = s;
206
+ this._builder.append(s);
207
+ }
208
+ _updateIndentText() {
209
+ this._indentText = this._indentStack.join('');
210
+ }
211
+ }
212
+ exports.IndentedWriter = IndentedWriter;
213
+ //# sourceMappingURL=IndentedWriter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndentedWriter.js","sourceRoot":"","sources":["../../src/utils/IndentedWriter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,4FAA4F;AAC5F,2DAA2D;AAE3D,oEAA6E;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,cAAc;IAgBzB,YAAmB,OAAwB;QAf3C;;;WAGG;QACI,wBAAmB,GAAW,IAAI,CAAC;QAYxC,IAAI,CAAC,QAAQ,GAAG,OAAO,KAA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C;IAEO,iBAAiB;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;CACF;AAjMD,wCAiMC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ApiItem } from 'api-extractor-model-me';
18
+ export declare class Utilities {
19
+ private static readonly _badFilenameCharsRegExp;
20
+ /**
21
+ * Generates a concise signature for a function. Example: "getArea(width, height)"
22
+ */
23
+ static getConciseSignature(apiItem: ApiItem): string;
24
+ /**
25
+ * Converts bad filename characters to underscores.
26
+ */
27
+ static getSafeFilenameForName(name: string): string;
28
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright 2020 Google LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.Utilities = void 0;
20
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
21
+ // See LICENSE in the project root for license information.
22
+ const api_extractor_model_me_1 = require("api-extractor-model-me");
23
+ class Utilities {
24
+ /**
25
+ * Generates a concise signature for a function. Example: "getArea(width, height)"
26
+ */
27
+ static getConciseSignature(apiItem) {
28
+ if (api_extractor_model_me_1.ApiParameterListMixin.isBaseClassOf(apiItem)) {
29
+ return (apiItem.displayName +
30
+ '(' +
31
+ apiItem.parameters.map(x => x.name).join(', ') +
32
+ ')');
33
+ }
34
+ return apiItem.displayName;
35
+ }
36
+ /**
37
+ * Converts bad filename characters to underscores.
38
+ */
39
+ static getSafeFilenameForName(name) {
40
+ // TODO: This can introduce naming collisions.
41
+ // We will fix that as part of https://github.com/microsoft/rushstack/issues/1308
42
+ return name.replace(Utilities._badFilenameCharsRegExp, '_').toLowerCase();
43
+ }
44
+ }
45
+ exports.Utilities = Utilities;
46
+ Utilities._badFilenameCharsRegExp = /[^a-z0-9_\-\.]/gi;
47
+ //# sourceMappingURL=Utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../../src/utils/Utilities.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,4FAA4F;AAC5F,2DAA2D;AAE3D,mEAAwE;AAExE,MAAa,SAAS;IAEpB;;OAEG;IACI,MAAM,CAAC,mBAAmB,CAAC,OAAgB;QAChD,IAAI,8CAAqB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;YAChD,OAAO,CACL,OAAO,CAAC,WAAW;gBACnB,GAAG;gBACH,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC9C,GAAG,CACJ,CAAC;SACH;QACD,OAAO,OAAO,CAAC,WAAW,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAY;QAC/C,8CAA8C;QAC9C,iFAAiF;QACjF,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5E,CAAC;;AAxBH,8BAyBC;AAxByB,iCAAuB,GAAW,kBAAkB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright 2020 Google LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
20
+ // See LICENSE in the project root for license information.
21
+ const IndentedWriter_1 = require("../IndentedWriter");
22
+ const chai_1 = require("chai");
23
+ const mocha_chai_jest_snapshot_1 = require("mocha-chai-jest-snapshot");
24
+ chai_1.use(mocha_chai_jest_snapshot_1.jestSnapshotPlugin());
25
+ it('01 Demo from docs', () => {
26
+ const indentedWriter = new IndentedWriter_1.IndentedWriter();
27
+ indentedWriter.write('begin\n');
28
+ indentedWriter.increaseIndent();
29
+ indentedWriter.write('one\ntwo\n');
30
+ indentedWriter.decreaseIndent();
31
+ indentedWriter.increaseIndent();
32
+ indentedWriter.decreaseIndent();
33
+ indentedWriter.write('end');
34
+ chai_1.expect(indentedWriter.toString()).toMatchSnapshot();
35
+ });
36
+ it('02 Indent something', () => {
37
+ const indentedWriter = new IndentedWriter_1.IndentedWriter();
38
+ indentedWriter.write('a');
39
+ indentedWriter.write('b');
40
+ indentedWriter.increaseIndent();
41
+ indentedWriter.writeLine('c');
42
+ indentedWriter.writeLine('d');
43
+ indentedWriter.decreaseIndent();
44
+ indentedWriter.writeLine('e');
45
+ indentedWriter.increaseIndent('>>> ');
46
+ indentedWriter.writeLine();
47
+ indentedWriter.writeLine();
48
+ indentedWriter.writeLine('g');
49
+ indentedWriter.decreaseIndent();
50
+ chai_1.expect(indentedWriter.toString()).toMatchSnapshot();
51
+ });
52
+ it('03 Two kinds of indents', () => {
53
+ const indentedWriter = new IndentedWriter_1.IndentedWriter();
54
+ indentedWriter.writeLine('---');
55
+ indentedWriter.indentScope(() => {
56
+ indentedWriter.write('a\nb');
57
+ indentedWriter.indentScope(() => {
58
+ indentedWriter.write('c\nd\n');
59
+ });
60
+ indentedWriter.write('e\n');
61
+ }, '> ');
62
+ indentedWriter.writeLine('---');
63
+ chai_1.expect(indentedWriter.toString()).toMatchSnapshot();
64
+ });
65
+ it('04 Edge cases for ensureNewLine()', () => {
66
+ let indentedWriter = new IndentedWriter_1.IndentedWriter();
67
+ indentedWriter.ensureNewLine();
68
+ indentedWriter.write('line');
69
+ chai_1.expect(indentedWriter.toString()).toMatchSnapshot();
70
+ indentedWriter = new IndentedWriter_1.IndentedWriter();
71
+ indentedWriter.write('previous');
72
+ indentedWriter.ensureNewLine();
73
+ indentedWriter.write('line');
74
+ chai_1.expect(indentedWriter.toString()).toMatchSnapshot();
75
+ });
76
+ it('04 Edge cases for ensureSkippedLine()', () => {
77
+ let indentedWriter = new IndentedWriter_1.IndentedWriter();
78
+ indentedWriter.ensureSkippedLine();
79
+ indentedWriter.write('line');
80
+ chai_1.expect(indentedWriter.toString()).toMatchSnapshot();
81
+ indentedWriter = new IndentedWriter_1.IndentedWriter();
82
+ indentedWriter.write('previous');
83
+ indentedWriter.ensureSkippedLine();
84
+ indentedWriter.write('line');
85
+ chai_1.expect(indentedWriter.toString()).toMatchSnapshot();
86
+ });
87
+ //# sourceMappingURL=IndentedWriter.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndentedWriter.test.js","sourceRoot":"","sources":["../../../src/utils/test/IndentedWriter.test.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAEH,4FAA4F;AAC5F,2DAA2D;AAE3D,sDAAmD;AACnD,+BAAmC;AACnC,uEAA8D;AAE9D,UAAG,CAAC,6CAAkB,EAAE,CAAC,CAAC;AAE1B,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC3B,MAAM,cAAc,GAAmB,IAAI,+BAAc,EAAE,CAAC;IAC5D,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC,cAAc,CAAC,cAAc,EAAE,CAAC;IAChC,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACnC,cAAc,CAAC,cAAc,EAAE,CAAC;IAChC,cAAc,CAAC,cAAc,EAAE,CAAC;IAChC,cAAc,CAAC,cAAc,EAAE,CAAC;IAChC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE5B,aAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;AACtD,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;IAC7B,MAAM,cAAc,GAAmB,IAAI,+BAAc,EAAE,CAAC;IAC5D,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,cAAc,C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AC/B,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,aAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpD,cAAc,GAAG,IAAI,+BAAc,EAAE,CAAC;IACtC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACjC,cAAc,CAAC,aAAa,EAAE,CAAC;IAC/B,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,aAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;AACtD,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;IAC/C,IAAI,cAAc,GAAmB,IAAI,+BAAc,EAAE,CAAC;IAC1D,cAAc,CAAC,iBAAiB,EAAE,CAAC;IACnC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,aAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpD,cAAc,GAAG,IAAI,+BAAc,EAAE,CAAC;IACtC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACjC,cAAc,CAAC,iBAAiB,EAAE,CAAC;IACnC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,aAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;AACtD,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@firebase/api-documenter",
3
+ "version": "0.1.2-canary.233e117f0",
4
+ "description": "Read JSON files from api-extractor, generate documentation pages",
5
+ "repository": {
6
+ "directory": "repo-scripts/documenter",
7
+ "type": "git",
8
+ "url": "https://github.com/firebase/firebase-js-sdk.git"
9
+ },
10
+ "license": "Apache-2.0",
11
+ "scripts": {
12
+ "build": "tsc && gulp copy-resources",
13
+ "test": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../config/mocharc.node.js"
14
+ },
15
+ "bin": {
16
+ "api-documenter-fire": "./dist/start.js"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "main": "dist/index.js",
22
+ "typings": "dist/rollup.d.ts",
23
+ "dependencies": {
24
+ "api-extractor-model-me": "0.1.1",
25
+ "@microsoft/tsdoc": "0.12.24",
26
+ "@rushstack/node-core-library": "3.41.0",
27
+ "@rushstack/ts-command-line": "4.9.1",
28
+ "colors": "~1.4.0",
29
+ "resolve": "~1.20.0",
30
+ "tslib": "^2.1.0",
31
+ "js-yaml": "4.1.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/js-yaml": "4.0.3",
35
+ "@types/resolve": "1.20.1",
36
+ "mocha-chai-jest-snapshot": "1.1.3"
37
+ }
38
+ }