Repository: esdoc/esdoc-plugins Branch: master Commit: 2de5022baa56 Files: 605 Total size: 543.1 KB Directory structure: gitextract_msrci168/ ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── _template/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── MyClass.js │ │ └── MyClass.test.js │ └── util.js ├── esdoc-accessor-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── MyClass.js │ │ └── MyClass.test.js │ └── util.js ├── esdoc-brand-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── misc/ │ │ └── publish-html-mock-plugin.js │ ├── package.json │ └── src/ │ ├── MyClass.js │ └── MyClass.test.js ├── esdoc-coverage-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ └── src/ │ ├── MyClass.js │ └── MyClass.test.js ├── esdoc-ecmascript-proposal-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── AsyncGenerators.js │ │ ├── ClassProperties.js │ │ ├── Decorators.js │ │ ├── DoExpressions.js │ │ ├── DynamicImport.js │ │ ├── ECMAScriptProposal.test.js │ │ ├── ExportExtensions.js │ │ ├── FunctionBind.js │ │ ├── FunctionSent.js │ │ └── ObjectRestSpread.js │ └── util.js ├── esdoc-exclude-source-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ └── src/ │ ├── MyClass.js │ └── MyClass.test.js ├── esdoc-external-ecmascript-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ ├── Plugin.js │ │ └── external-ecmascript.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ └── src/ │ ├── MyClass.js │ └── MyClass.test.js ├── esdoc-external-nodejs-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ ├── Plugin.js │ │ └── external-nodejs.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── MyClass.js │ │ └── MyClass.test.js │ └── util.js ├── esdoc-external-webapi-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ ├── Plugin.js │ │ └── external-webapi.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── MyClass.js │ │ └── MyClass.test.js │ └── util.js ├── esdoc-flow-type-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── FlowType.js │ │ └── FlowType.test.js │ └── util.js ├── esdoc-importpath-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── package.json │ ├── src/ │ │ ├── Index.js │ │ ├── MyClass1.js │ │ ├── MyClass2.js │ │ └── all.test.js │ └── util.js ├── esdoc-inject-gtm-plugin/ │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── misc/ │ │ └── publish-html-mock-plugin.js │ └── src/ │ ├── MyClass.js │ └── MyClass.test.js ├── esdoc-inject-script-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── misc/ │ │ ├── inject.js │ │ └── publish-html-mock-plugin.js │ └── src/ │ ├── MyClass.js │ └── MyClass.test.js ├── esdoc-inject-style-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── misc/ │ │ ├── inject.css │ │ └── publish-html-mock-plugin.js │ └── src/ │ ├── MyClass.js │ └── MyClass.test.js ├── esdoc-integrate-manual-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── CHANGELOG.md │ ├── esdoc.json │ ├── init.js │ ├── manual/ │ │ ├── advanced.md │ │ ├── all.test.js │ │ ├── configuration.md │ │ ├── design.md │ │ ├── example.md │ │ ├── faq.md │ │ ├── index.md │ │ ├── installation.md │ │ ├── overview.md │ │ ├── tutorial.md │ │ ├── usage1.md │ │ └── usage2.md │ ├── src/ │ │ └── Dummy.js │ └── util.js ├── esdoc-integrate-test-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ ├── Plugin.js │ │ ├── TestDoc.js │ │ ├── TestDocFactory.js │ │ └── TestFileDoc.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ └── Dummy.js │ ├── test/ │ │ ├── Test.js │ │ └── Test.test.js │ └── util.js ├── esdoc-jsx-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── MyClass.js │ │ └── MyClass.test.js │ └── util.js ├── esdoc-lint-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ └── src/ │ ├── MyArrowFunction.js │ ├── MyClass.js │ └── results.test.js ├── esdoc-publish-html-plugin/ │ ├── .babelrc │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ ├── Builder/ │ │ │ ├── ClassDocBuilder.js │ │ │ ├── DocBuilder.js │ │ │ ├── DocResolver.js │ │ │ ├── FileDocBuilder.js │ │ │ ├── IdentifiersDocBuilder.js │ │ │ ├── IndexDocBuilder.js │ │ │ ├── ManualDocBuilder.js │ │ │ ├── SearchIndexBuilder.js │ │ │ ├── SingleDocBuilder.js │ │ │ ├── SourceDocBuilder.js │ │ │ ├── StaticFileBuilder.js │ │ │ ├── TestDocBuilder.js │ │ │ ├── TestFileDocBuilder.js │ │ │ ├── template/ │ │ │ │ ├── class.html │ │ │ │ ├── css/ │ │ │ │ │ ├── github.css │ │ │ │ │ ├── identifiers.css │ │ │ │ │ ├── manual.css │ │ │ │ │ ├── prettify-tomorrow.css │ │ │ │ │ ├── search.css │ │ │ │ │ ├── source.css │ │ │ │ │ ├── style.css │ │ │ │ │ └── test.css │ │ │ │ ├── details.html │ │ │ │ ├── file.html │ │ │ │ ├── identifiers.html │ │ │ │ ├── index.html │ │ │ │ ├── layout.html │ │ │ │ ├── manual.html │ │ │ │ ├── manualCardIndex.html │ │ │ │ ├── manualIndex.html │ │ │ │ ├── nav.html │ │ │ │ ├── properties.html │ │ │ │ ├── script/ │ │ │ │ │ ├── inherited-summary.js │ │ │ │ │ ├── inner-link.js │ │ │ │ │ ├── manual.js │ │ │ │ │ ├── patch-for-local.js │ │ │ │ │ ├── prettify/ │ │ │ │ │ │ ├── Apache-License-2.0.txt │ │ │ │ │ │ └── prettify.js │ │ │ │ │ ├── pretty-print.js │ │ │ │ │ ├── search.js │ │ │ │ │ └── test-summary.js │ │ │ │ ├── single.html │ │ │ │ ├── source.html │ │ │ │ ├── summary.html │ │ │ │ ├── test.html │ │ │ │ └── testInterface.html │ │ │ └── util.js │ │ └── Plugin.js │ └── test/ │ ├── fixture/ │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── esdoc.json │ │ ├── manual/ │ │ │ ├── advanced.md │ │ │ ├── configuration.md │ │ │ ├── design.md │ │ │ ├── example.md │ │ │ ├── faq.md │ │ │ ├── index.md │ │ │ ├── installation.md │ │ │ ├── overview.md │ │ │ ├── tutorial.md │ │ │ ├── usage1.md │ │ │ └── usage2.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── Abstract/ │ │ │ │ ├── Definition.js │ │ │ │ └── Override.js │ │ │ ├── Access/ │ │ │ │ ├── Class.js │ │ │ │ ├── Function.js │ │ │ │ ├── Method.js │ │ │ │ ├── Property.js │ │ │ │ └── Variable.js │ │ │ ├── Async/ │ │ │ │ ├── Function.js │ │ │ │ └── Method.js │ │ │ ├── Class/ │ │ │ │ └── Definition.js │ │ │ ├── ClassProperty/ │ │ │ │ └── Definition.js │ │ │ ├── Computed/ │ │ │ │ ├── Method.js │ │ │ │ └── Property.js │ │ │ ├── Decorator/ │ │ │ │ └── Definition.js │ │ │ ├── Deprecated/ │ │ │ │ ├── Class.js │ │ │ │ ├── Function.js │ │ │ │ └── Variable.js │ │ │ ├── Desc/ │ │ │ │ ├── Class.js │ │ │ │ ├── Function.js │ │ │ │ ├── Markdown.js │ │ │ │ ├── MultiLine.js │ │ │ │ └── Variable.js │ │ │ ├── Destructuring/ │ │ │ │ ├── Array.js │ │ │ │ └── Object.js │ │ │ ├── Duplication/ │ │ │ │ └── Definition.js │ │ │ ├── Emits/ │ │ │ │ ├── Function.js │ │ │ │ └── Method.js │ │ │ ├── Example/ │ │ │ │ ├── Caption.js │ │ │ │ ├── Class.js │ │ │ │ ├── Function.js │ │ │ │ └── Variable.js │ │ │ ├── Experimental/ │ │ │ │ ├── Class.js │ │ │ │ ├── Function.js │ │ │ │ └── Variable.js │ │ │ ├── ExponentiationOperator/ │ │ │ │ └── Definition.js │ │ │ ├── Export/ │ │ │ │ ├── AnonymousClass.js │ │ │ │ ├── AnonymousFunction.js │ │ │ │ ├── ArrowFunction.js │ │ │ │ ├── Class.js │ │ │ │ ├── ClassIndirectDefault.js │ │ │ │ ├── Default.js │ │ │ │ ├── Extends.js │ │ │ │ ├── Function.js │ │ │ │ ├── FunctionIndirectDefault.js │ │ │ │ ├── Multiple.js │ │ │ │ ├── Named.js │ │ │ │ ├── NewExpression.js │ │ │ │ ├── NewExpressionIndirect.js │ │ │ │ ├── NewExpressionProperty.js │ │ │ │ ├── Variable.js │ │ │ │ └── VariableIndirectDefault.js │ │ │ ├── Extends/ │ │ │ │ ├── Builtin.js │ │ │ │ ├── Deep.js │ │ │ │ ├── Expression.js │ │ │ │ ├── Inner.js │ │ │ │ ├── Mixin.js │ │ │ │ ├── Outer.js │ │ │ │ └── Property.js │ │ │ ├── External/ │ │ │ │ └── Definition.js │ │ │ ├── Generator/ │ │ │ │ ├── Function.js │ │ │ │ └── Method.js │ │ │ ├── Ignore/ │ │ │ │ ├── Class.js │ │ │ │ ├── Function.js │ │ │ │ └── Variable.js │ │ │ ├── Interface/ │ │ │ │ ├── Definition.js │ │ │ │ └── Implements.js │ │ │ ├── Invalid/ │ │ │ │ ├── CodeSyntax.js │ │ │ │ └── DocSyntax.js │ │ │ ├── Link/ │ │ │ │ ├── Class.js │ │ │ │ ├── Function.js │ │ │ │ └── Variable.js │ │ │ ├── Listens/ │ │ │ │ ├── Function.js │ │ │ │ └── Method.js │ │ │ ├── Param/ │ │ │ │ ├── Function.js │ │ │ │ └── Method.js │ │ │ ├── Property/ │ │ │ │ └── Return.js │ │ │ ├── Return/ │ │ │ │ ├── Function.js │ │ │ │ └── Method.js │ │ │ ├── See/ │ │ │ │ ├── Class.js │ │ │ │ ├── Function.js │ │ │ │ └── Variable.js │ │ │ ├── Since/ │ │ │ │ ├── Class.js │ │ │ │ ├── Function.js │ │ │ │ └── Variable.js │ │ │ ├── Throws/ │ │ │ │ ├── Function.js │ │ │ │ └── Method.js │ │ │ ├── Todo/ │ │ │ │ ├── Class.js │ │ │ │ ├── Function.js │ │ │ │ └── Variable.js │ │ │ ├── TrailingComma/ │ │ │ │ └── Definition.js │ │ │ ├── Type/ │ │ │ │ ├── Array.js │ │ │ │ ├── Class.js │ │ │ │ ├── Complex.js │ │ │ │ ├── Default.js │ │ │ │ ├── External.js │ │ │ │ ├── Function.js │ │ │ │ ├── Generics.js │ │ │ │ ├── Literal.js │ │ │ │ ├── Nullable.js │ │ │ │ ├── Object.js │ │ │ │ ├── Optional.js │ │ │ │ ├── Record.js │ │ │ │ ├── Spread.js │ │ │ │ ├── Typedef.js │ │ │ │ └── Union.js │ │ │ ├── Typedef/ │ │ │ │ └── Definition.js │ │ │ ├── Undocument/ │ │ │ │ └── Definition.js │ │ │ ├── Unknown/ │ │ │ │ └── Definition.js │ │ │ ├── Variable/ │ │ │ │ ├── ArrayPattern.js │ │ │ │ ├── Definition.js │ │ │ │ └── ObjectPattern.js │ │ │ └── Version/ │ │ │ ├── Class.js │ │ │ ├── Function.js │ │ │ └── Variable.js │ │ └── test/ │ │ └── DescTest.js │ └── src/ │ ├── DocumentTest/ │ │ ├── AbstractTest/ │ │ │ ├── DefinitionTest.js │ │ │ └── OverrideTest.js │ │ ├── AsyncTest/ │ │ │ ├── FunctionTest.js │ │ │ └── MethodTest.js │ │ ├── ClassPropertyTest/ │ │ │ └── DefinitionTest.js │ │ ├── ClassTest/ │ │ │ └── DefinitionTest.js │ │ ├── ComputedTest/ │ │ │ ├── MethodTest.js │ │ │ └── PropertyTest.js │ │ ├── DecoratorTest/ │ │ │ └── DefinitionTest.js │ │ ├── DeprecatedTest/ │ │ │ ├── ClassTest.js │ │ │ ├── FunctionTest.js │ │ │ └── VariableTest.js │ │ ├── DescTest/ │ │ │ ├── ClassTest.js │ │ │ ├── FunctionTest.js │ │ │ ├── MarkdownTest.js │ │ │ ├── MultiLineTest.js │ │ │ └── VariableTest.js │ │ ├── DestructuringTest/ │ │ │ ├── ArrayTest.js │ │ │ └── ObjectTest.js │ │ ├── DuplicationTest/ │ │ │ └── DefinitionTest.js │ │ ├── EmitsTest/ │ │ │ ├── FunctionTest.js │ │ │ └── MethodTest.js │ │ ├── ExamleTest/ │ │ │ ├── CaptionTest.js │ │ │ ├── ClassTest.js │ │ │ ├── FunctionTest.js │ │ │ └── VariableTest.js │ │ ├── ExperimentalTest/ │ │ │ ├── ClassTest.js │ │ │ ├── FunctionTest.js │ │ │ └── VariableTest.js │ │ ├── ExponentialOperatorTest/ │ │ │ └── DefinitionTest.js │ │ ├── ExportTest/ │ │ │ ├── AnonymousClassTest.js │ │ │ ├── AnonymousFunctionTest.js │ │ │ ├── ArrowFunctionTest.js │ │ │ ├── ClassIndirectDefaultTest.js │ │ │ ├── ClassTest.js │ │ │ ├── DefaultTest.js │ │ │ ├── ExtendTest.js │ │ │ ├── FunctionIndirectDefaultTest.js │ │ │ ├── FunctionTest.js │ │ │ ├── MultipleTest.js │ │ │ ├── NamedTest.js │ │ │ ├── NewExpressionIndirectTest.js │ │ │ ├── NewExpressionPropertyTest.js │ │ │ ├── NewExpressionTest.js │ │ │ ├── VariableIndirectDefaultTest.js │ │ │ └── VariableTest.js │ │ ├── ExtendsTest/ │ │ │ ├── BuiltinTest.js │ │ │ ├── DeepTest.js │ │ │ ├── ExpressionTest.js │ │ │ ├── InnerTest.js │ │ │ ├── MixinTest.js │ │ │ ├── OuterTest.js │ │ │ └── PropertyTest.js │ │ ├── ExternalTest/ │ │ │ └── DefinitionTest.js │ │ ├── GeneratorTest/ │ │ │ ├── FunctionTest.js │ │ │ └── MethodTest.js │ │ ├── IgnoreTest/ │ │ │ ├── ClassTest.js │ │ │ ├── FunctionTest.js │ │ │ └── VariableTest.js │ │ ├── InterfaceTest/ │ │ │ ├── DefinitionTest.js │ │ │ └── ImplementsTest.js │ │ ├── LinkTest/ │ │ │ ├── ClassTest.js │ │ │ ├── FunctionTest.js │ │ │ └── VariableTest.js │ │ ├── ListensTest/ │ │ │ ├── FunctionTest.js │ │ │ └── MethodTest.js │ │ ├── ParamTest/ │ │ │ ├── FunctionTest.js │ │ │ └── MethodTest.js │ │ ├── PropertyTest/ │ │ │ └── ReturnTest.js │ │ ├── ReturnTest/ │ │ │ ├── FunctionTest.js │ │ │ └── MethodTest.js │ │ ├── SeeTest/ │ │ │ ├── ClassTest.js │ │ │ ├── FunctionTest.js │ │ │ └── VariableTest.js │ │ ├── SinceTest/ │ │ │ ├── ClassTest.js │ │ │ ├── FunctionTest.js │ │ │ └── VariableTest.js │ │ ├── ThrowsTest/ │ │ │ ├── FunctionTest.js │ │ │ └── MethodTest.js │ │ ├── TodoTest/ │ │ │ ├── ClassTest.js │ │ │ ├── FunctionTest.js │ │ │ └── VariableTest.js │ │ ├── TrailingCommaTest/ │ │ │ └── DefinitionTest.js │ │ ├── TypeTest/ │ │ │ ├── ArrayTest.js │ │ │ ├── ClassTest.js │ │ │ ├── ComplexTest.js │ │ │ ├── DefaultTest.js │ │ │ ├── ExternalTest.js │ │ │ ├── FunctionTest.js │ │ │ ├── GenericsTest.js │ │ │ ├── LiteralTest.js │ │ │ ├── NullableTest.js │ │ │ ├── ObjectTest.js │ │ │ ├── OptionalTest.js │ │ │ ├── RecordTest.js │ │ │ ├── SpreadTest.js │ │ │ ├── TypedefTest.js │ │ │ └── UnionTest.js │ │ ├── TypedefTest/ │ │ │ └── DefinitionTest.js │ │ ├── UndocumentTest/ │ │ │ └── DefinitionTest.js │ │ ├── VariableTest/ │ │ │ ├── ArrayPatterTest.js │ │ │ ├── DefinitionTest.js │ │ │ └── ObjectPatterTest.js │ │ └── VersionTest/ │ │ ├── ClassTest.js │ │ ├── FunctionTest.js │ │ └── VariableTest.js │ ├── FileTest/ │ │ └── FileTest.js │ ├── IdentifiersTest/ │ │ └── IdentifiersTest.js │ ├── IndexTest/ │ │ └── IndexTest.js │ ├── ManualTest/ │ │ └── ManualTest.js │ ├── NavTest/ │ │ └── NavTest.js │ ├── SearchTest/ │ │ └── SearchTest.js │ ├── TestTest/ │ │ ├── TestLinkTest.js │ │ └── TestTest.js │ ├── init.js │ └── util.js ├── esdoc-publish-markdown-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── misc/ │ │ └── index.md │ ├── package.json │ ├── src/ │ │ ├── AbstractBuilder.js │ │ ├── ClassBuilder.js │ │ ├── FunctionBuilder.js │ │ ├── Plugin.js │ │ └── template/ │ │ ├── class.html │ │ └── function.html │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── MyClass.js │ │ ├── MyClass.test.js │ │ ├── myFunction.js │ │ └── myFunction.test.js │ └── util.js ├── esdoc-react-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── MyClass.js │ │ └── MyClass.test.js │ └── util.js ├── esdoc-standard-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── README.md │ ├── esdoc.json │ ├── init.js │ ├── manual/ │ │ └── overview.md │ ├── package.json │ ├── spy-plugin.js │ ├── src/ │ │ ├── MyClass.js │ │ └── Plugin.test.js │ └── test/ │ └── MyClassTest.js ├── esdoc-type-inference-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── Getter.js │ │ ├── Getter.test.js │ │ ├── Member.js │ │ ├── Member.test.js │ │ ├── Param.js │ │ ├── Param.test.js │ │ ├── Return.js │ │ ├── Return.test.js │ │ ├── Variable.js │ │ └── Variable.test.js │ └── util.js ├── esdoc-typescript-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── TypeScript.test.js │ │ └── TypeScript.ts │ └── util.js ├── esdoc-undocumented-identifier-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── MyClass.js │ │ └── MyClass.test.js │ └── util.js ├── esdoc-unexported-identifier-plugin/ │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src/ │ │ └── Plugin.js │ └── test/ │ ├── esdoc.json │ ├── init.js │ ├── src/ │ │ ├── MyClass.js │ │ └── MyClass.test.js │ └── util.js └── script/ ├── check.sh ├── install.sh └── test.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ node_modules out npm-debug.log ================================================ FILE: .travis.yml ================================================ language: node_js sudo: false node_js: - "6" script: - ./script/test.sh install: - ./script/install.sh ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ [![](https://travis-ci.org/esdoc/esdoc-plugins.svg?branch=master)](https://travis-ci.org/esdoc/esdoc-plugins) # ESDoc Plugins This repository is official plugins for ESDoc. **In most case, we recommend [esdoc-standard-plugin](./esdoc-standard-plugin)** ## Each Plugins **Publisher** - [esdoc-publish-html-plugin](./esdoc-publish-html-plugin) - [esdoc-publish-markdown-plugin](./esdoc-publish-markdown-plugin) [PoC] **Integration** - [esdoc-integrate-manual-plugin](./esdoc-integrate-manual-plugin) - [esdoc-integrate-test-plugin](./esdoc-integrate-test-plugin) **Transform** - [esdoc-accessor-plugin](./esdoc-accessor-plugin) - [esdoc-brand-plugin](./esdoc-brand-plugin) - [esdoc-exclude-source-plugin](./esdoc-exclude-source-plugin) - [esdoc-importpath-plugin](./esdoc-importpath-plugin) - [esdoc-inject-script-plugin](./esdoc-inject-script-plugin) - [esdoc-inject-style-plugin](./esdoc-inject-style-plugin) - [esdoc-undocumented-identifier-plugin](./esdoc-undocumented-identifier-plugin) - [esdoc-unexported-identifier-plugin](./esdoc-unexported-identifier-plugin) **Inspection** - [esdoc-coverage-plugin](./esdoc-coverage-plugin) - [esdoc-lint-plugin](./esdoc-lint-plugin) - [esdoc-type-inference-plugin](./esdoc-type-inference-plugin) **External Identifier** - [esdoc-external-ecmascript-plugin](./esdoc-external-ecmascript-plugin) - [esdoc-external-nodejs-plugin](./esdoc-external-nodejs-plugin) - [esdoc-external-webapi-plugin](./esdoc-external-webapi-plugin) **Language** - [esdoc-ecmascript-proposal-plugin](./esdoc-ecmascript-proposal-plugin) - [esdoc-flow-type-plugin](./esdoc-flow-type-plugin) [PoC] - [esdoc-typescript-plugin](./esdoc-typescript-plugin) [PoC] **React** - [esdoc-jsx-plugin](./esdoc-jsx-plugin) - [esdoc-react-plugin](./esdoc-react-plugin) [PoC] ================================================ FILE: _template/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: _template/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: _template/README.md ================================================ # ESDoc Template Plugin ## Install ```bash npm install esdoc-template-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-template-plugin", "option": {"foo": true}} ] } ``` - `foo` is default `true` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: _template/package.json ================================================ { "name": "esdoc-template-plugin", "version": "0.0.1", "description": "A __TEMPLATE__ plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "alpha", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: _template/src/Plugin.js ================================================ class Plugin { onHandleDocs(ev) { this._docs = ev.data.docs; } } module.exports = new Plugin(); ================================================ FILE: _template/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js", "option": {"foo": true}} ] } ================================================ FILE: _template/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: _template/test/src/MyClass.js ================================================ export default class MyClass { method1(){} } ================================================ FILE: _template/test/src/MyClass.test.js ================================================ const assert = require('assert'); const {find, file} = require('../util'); describe('test/MyClass.js:', ()=> { it('has method doc', ()=>{ const doc = find('longname', 'src/MyClass.js~MyClass#method1'); assert(doc); }); }); ================================================ FILE: _template/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-accessor-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-accessor-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-accessor-plugin/README.md ================================================ # ESDoc Accessor Plugin ## Install ```bash npm install esdoc-accessor-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-accessor-plugin", "option": {"access": ["public", "protected", "private"], "autoPrivate": true}} ] } ``` - `access` is default `["public", "protected", "private"]` - `autoPrivate` is default `true` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-accessor-plugin/package.json ================================================ { "name": "esdoc-accessor-plugin", "version": "1.0.0", "description": "A accessor plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "accessor", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-accessor-plugin/src/Plugin.js ================================================ class Plugin { constructor() { this._docs = null; this._option = null; } onHandleDocs(ev) { const option = ev.data.option || {}; if (!('access' in option)) option.access = ['public', 'protected', 'private']; if (!('autoPrivate' in option)) option.autoPrivate = true; const access = option.access; const autoPrivate = option.autoPrivate; for (const doc of ev.data.docs) { if (!doc.access) { if (autoPrivate && doc.name.charAt(0) === '_') { doc.access = 'private'; } else { doc.access = 'public'; } } if (!access.includes(doc.access)) doc.ignore = true; } } } module.exports = new Plugin(); ================================================ FILE: esdoc-accessor-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js", "option": {"access": ["public", "protected"], "autoPrivate": true}} ] } ================================================ FILE: esdoc-accessor-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-accessor-plugin/test/src/MyClass.js ================================================ export default class MyClass { /** * method1 is default access. */ method1(){} /** * method2 is public. * @public */ method2(){} /** * method3 is protected. * @protected */ method3(){} /** * method4 is private. * @private */ method4(){} /** * method5 is auto private. */ _method5(){} } ================================================ FILE: esdoc-accessor-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const {find} = require('../util'); describe('test/MyClass.js:', ()=> { it('has default access', ()=>{ const doc = find('longname', 'src/MyClass.js~MyClass#method1'); assert.equal(doc.access, 'public'); assert.equal(doc.ignore, undefined); }); it('has public access', ()=>{ const doc = find('longname', 'src/MyClass.js~MyClass#method2'); assert.equal(doc.access, 'public'); assert.equal(doc.ignore, undefined); }); it('has protected access', ()=>{ const doc = find('longname', 'src/MyClass.js~MyClass#method3'); assert.equal(doc.access, 'protected'); assert.equal(doc.ignore, undefined); }); it('has private access and is ignored', ()=>{ const doc = find('longname', 'src/MyClass.js~MyClass#method4'); assert.equal(doc.access, 'private'); assert.equal(doc.ignore, true); }); it('has auto private access and is ignored', ()=>{ const doc = find('longname', 'src/MyClass.js~MyClass#_method5'); assert.equal(doc.access, 'private'); assert.equal(doc.ignore, true); }); }); ================================================ FILE: esdoc-accessor-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-brand-plugin/CHANGELOG.md ================================================ # Changelog ## Next - **Fix** - Use the same as original logo file type ([#43](https://github.com/esdoc/esdoc-plugins/pull/43)). Thanks [@bencevans](https://github.com/bencevans) ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-brand-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-brand-plugin/README.md ================================================ # ESDoc Brand Plugin ## Install ```bash npm install esdoc-brand-plugin ``` ## Config This plugin takes a title and a repository from `package.json (name, repsitory)`. ```json { "source": "./src", "destination": "./doc", "package.json": "./package.json", "plugins": [ { "name": "esdoc-brand-plugin", "option": { "logo": "./logo.png", "title": "My Library", "description": "this is awesome library", "repository": "https://github.com/foo/bar", "site": "http://my-library.org", "author": "https://twitter.com/foo", "image": "http://my-library.org/logo.png" } } ] } ``` - `logo` default is `null` - `title` default is `name` of `package.json` - `description` default is `description` of `package.json` - `repository` default is `repository` of `package.json` - `site` default is `homepage` of `package.json` - `author` default is `author` of `package.json` - `image` default is `null`. support an aspect ratio of 1:1 ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-brand-plugin/package.json ================================================ { "name": "esdoc-brand-plugin", "version": "1.0.0", "description": "A brand plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "cheerio": "0.22.0" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "brand", "title", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-brand-plugin/src/Plugin.js ================================================ const fs = require('fs'); const path = require('path'); const cheerio = require('cheerio'); class Plugin { onHandleConfig(ev) { const config = ev.data.config; const option = ev.data.option || {}; // get package.json let packageObj = {}; try { const packagePath = config.package || './package.json'; const tmp = fs.readFileSync(packagePath).toString(); packageObj = JSON.parse(tmp); } catch (e) { // ignore } this._logo = option.logo; this._description = option.description || packageObj.description; this._title = option.title || packageObj.name; this._repository = option.repository || this._getRepositoryURL(packageObj); this._site = option.site || packageObj.homepage; this._image = option.image; this._author = option.author || this._getAuthor(packageObj); } onPublish(ev) { if (this._repository && this._repository.indexOf('https://github.com/') === 0) { const srcPath = path.resolve(__dirname, 'github.png'); ev.data.copyFile(srcPath, 'image/github.png'); } if (this._logo) { const srcPath = path.resolve(this._logo); ev.data.copyFile(srcPath, 'image/brand_logo' + path.extname(this._logo)); } } onHandleContent(ev) { const content = ev.data.content; const fileName = ev.data.fileName; if (path.extname(fileName) !== '.html') return content; const $ = cheerio.load(content); // logo if (this._logo) { const $el = $('header a[href="./"]'); $el.text(''); $el.css({display: 'flex', 'align-items': 'center'}); $el.append(''); } // title if (this._title) { const $title = $('title'); const original = $title.text(); $title.text(`${original} | ${this._title}`); } // repository if (this._repository) { if (this._repository.indexOf('https://github.com/') === 0) { const style = 'style="position:relative; top:3px;"'; $('header').append(``); } else { $('header').append(`Repository`); } } // meta tag this._addMetaTag($); ev.data.content = $.html(); } _getRepositoryURL(packageObj) { if (!packageObj.repository) return null; let url = packageObj.repository.url || packageObj.repository; if (typeof url !== 'string') return null; if (url.indexOf('git@github.com:') === 0) { // url: git@github.com:foo/bar.git const matched = url.match(/^git@github\.com:(.*)\.git$/); return `https://github.com/${matched[1]}`; } else if (url.match(/^[\w\d\-_]+\/[\w\d\-_]+$/)) { // url: foo/bar return `https://github.com/${url}`; } else if (url.match(/^git\+https:\/\/github.com\/.*\.git$/)) { // git+https://github.com/foo/bar.git const matched = url.match(/^git\+(https:\/\/github.com\/.*)\.git$/); return matched[1]; } else if (url.match(/(https?:\/\/.*$)/)) { // other url const matched = url.match(/(https?:\/\/.*$)/); return matched[1]; } return null; } _getAuthor(packageObj) { if (!packageObj.author) return null; if (typeof packageObj.author === 'string') { return packageObj.author; } else { return packageObj.author.url || packageObj.author.name; } } _addMetaTag($) { const metaProps = []; // normal if (this._description){ metaProps.push({name: 'description', content: this._description}); } // og tag http://ogp.me/#metadata if (this._title && this._image && this._site){ metaProps.push({property: 'og:type', content: 'website'}); metaProps.push({property: 'og:url', content: this._site}); metaProps.push({property: 'og:site_name', content: this._title}); metaProps.push({property: 'og:title', content: this._title}); metaProps.push({property: 'og:image', content: this._image}); if (this._description) metaProps.push({property: 'og:description', content: this._description}); if (this._author) metaProps.push({property: 'og:author', content: this._author}); } // twitter card https://dev.twitter.com/cards/types/summary if (this._title && this._description){ metaProps.push({property: 'twitter:card', content: 'summary'}); metaProps.push({property: 'twitter:title', content: this._title}); metaProps.push({property: 'twitter:description', content: this._description}); if (this._image) metaProps.push({property: 'twitter:image', content: this._image}); if (this._site && this._site.indexOf('https://twitter.com/') === 0) { const twitterName = this._site.replace('https://twitter.com/', '@'); metaProps.push({property: 'twitter:site', content: twitterName}); metaProps.push({property: 'twitter:creator', content: twitterName}); } } const $head = $('head'); for (const metaProp of metaProps) { const prop = Object.keys(metaProp).map((key) => `${key}="${metaProp[key]}"`).join(' '); const metaTag = ``; $head.append(metaTag); } } } module.exports = new Plugin(); ================================================ FILE: esdoc-brand-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "package": "./test/package.json", "plugins": [ {"name": "./test/misc/publish-html-mock-plugin.js"}, {"name": "./src/Plugin.js", "option": {"logo": "./test/misc/logo.png", "image": "https://esdoc.org/manual/asset/image/logo.png"}} ] } ================================================ FILE: esdoc-brand-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-brand-plugin/test/misc/publish-html-mock-plugin.js ================================================ exports.onPublish = function(ev) { const html = ` Home
Home
`; ev.data.writeFile('index.html', html); }; ================================================ FILE: esdoc-brand-plugin/test/package.json ================================================ { "name": "esdoc-brand-plugin-test", "description": "this is esdoc-brand-plugin test", "repository": "https://github.com/esdoc/esdoc-optional-plugins", "homepage": "https://esdoc.org", "author": { "name": "h13i32maru", "url": "http://h13i32maru.jp" } } ================================================ FILE: esdoc-brand-plugin/test/src/MyClass.js ================================================ export default class MyClass { } ================================================ FILE: esdoc-brand-plugin/test/src/MyClass.test.js ================================================ const fs = require('fs'); const assert = require('assert'); const cheerio = require('cheerio'); describe('test/MyClass.js:', ()=> { const $ = cheerio.load(fs.readFileSync('./test/out/index.html')); it('has brand logo', ()=>{ assert.equal($('header a[href="./"] img[src="./image/brand_logo.png"]').length, 1); assert(fs.readFileSync('./test/out/image/brand_logo.png')); }); it('has brand title', ()=>{ assert.equal($('title').text(), 'Home | esdoc-brand-plugin-test'); }); it('has repository link', ()=>{ assert.equal($('header a[href="https://github.com/esdoc/esdoc-optional-plugins"]').length, 1); assert.equal($('header img[src="./image/github.png"]').length, 1); assert(fs.readFileSync('./test/out/image/github.png')); }); it('has meta tag', ()=>{ // normal assert.equal($('meta[name="description"]').attr('content'), 'this is esdoc-brand-plugin test'); // og assert.equal($('meta[property="og:type"]').attr('content'), 'website'); assert.equal($('meta[property="og:url"]').attr('content'), 'https://esdoc.org'); assert.equal($('meta[property="og:site_name"]').attr('content'), 'esdoc-brand-plugin-test'); assert.equal($('meta[property="og:title"]').attr('content'), 'esdoc-brand-plugin-test'); assert.equal($('meta[property="og:image"]').attr('content'), 'https://esdoc.org/manual/asset/image/logo.png'); assert.equal($('meta[property="og:description"]').attr('content'), 'this is esdoc-brand-plugin test'); assert.equal($('meta[property="og:author"]').attr('content'), 'http://h13i32maru.jp'); // twitter assert.equal($('meta[property="twitter:card"]').attr('content'), 'summary'); assert.equal($('meta[property="twitter:title"]').attr('content'), 'esdoc-brand-plugin-test'); assert.equal($('meta[property="twitter:description"]').attr('content'), 'this is esdoc-brand-plugin test'); assert.equal($('meta[property="twitter:image"]').attr('content'), 'https://esdoc.org/manual/asset/image/logo.png'); }); }); ================================================ FILE: esdoc-coverage-plugin/CHANGELOG.md ================================================ # Changelog ## 1.1.0 (2017-09-09) - **Feat** - Add `kind` option ([#7](https://github.com/esdoc/esdoc-plugins/pull/7)) Thanks [@jaxx2104](https://github.com/jaxx2104) ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-coverage-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-coverage-plugin/README.md ================================================ # ESDoc Coverage Plugin ## Install ``` npm install esdoc-coverage-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ { "name": "esdoc-coverage-plugin", "option": { "enable": true, "kind": ["class", "method", "member", "get", "set", "constructor", "function", "variable"] } } ] } ``` `enable` is default `true`. `kind` is default `["class", "method", "member", "get", "set", "constructor", "function", "variable"]`. ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-coverage-plugin/package.json ================================================ { "name": "esdoc-coverage-plugin", "version": "1.1.0", "description": "A coverage plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "coverage", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-coverage-plugin/src/Plugin.js ================================================ const fs = require('fs'); const path = require('path'); class Plugin { onHandleDocs(ev) { this._docs = ev.data.docs; } onPublish(ev) { const option = ev.data.option || {}; if (!('enable' in option)) option.enable = true; if (!option.enable) return; if (!('kind' in option)) option.kind = ['class', 'method', 'member', 'get', 'set', 'constructor', 'function', 'variable']; if (!option.kind) return; const docs = this._docs.filter(v => option.kind.includes(v.kind)); const expectCount = docs.length; let actualCount = 0; const files = {}; for (const doc of docs) { const filePath = doc.longname.split('~')[0]; if (!files[filePath]) files[filePath] = {expectCount: 0, actualCount: 0, undocumentLines: []}; files[filePath].expectCount++; if (doc.undocument) { files[filePath].undocumentLines.push(doc.lineNumber); } else { actualCount++; files[filePath].actualCount++; } } const coveragePercent = (expectCount === 0 ? 0 : Math.floor(10000 * actualCount / expectCount) / 100); const coverage = { coverage: `${coveragePercent}%`, expectCount: expectCount, actualCount: actualCount, files: files }; ev.data.writeFile('coverage.json', JSON.stringify(coverage, null, 2)); // create badge const ratio = Math.floor(100 * actualCount / expectCount); let color; if (ratio < 50) { color = '#db654f'; } else if (ratio < 90) { color = '#dab226'; } else { color = '#4fc921'; } const filePath = path.resolve(__dirname, 'badge.svg'); let badge = fs.readFileSync(filePath, {encoding: 'utf-8'}); badge = badge.replace(/@ratio@/g, `${ratio}%`); badge = badge.replace(/@color@/g, color); ev.data.writeFile('badge.svg', badge); } } module.exports = new Plugin(); ================================================ FILE: esdoc-coverage-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-coverage-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-coverage-plugin/test/src/MyClass.js ================================================ /** * this is MyClass class. */ export default class MyClass { /** * this is constructor. */ constructor(){ /** * this is p property. * @type {number} */ this.p = 100; } /** * this is method. */ method(){} undocumentMethod(){} } ================================================ FILE: esdoc-coverage-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const fs = require('fs'); describe('test/MyClass.js:', ()=> { it('has coverage', ()=>{ const tmp = fs.readFileSync('./test/out/coverage.json').toString(); const coverage = JSON.parse(tmp); assert.equal(coverage.coverage, '80%'); assert.equal(coverage.expectCount, 5); assert.equal(coverage.actualCount, 4); assert.deepEqual(coverage.files, { 'src/MyClass.js': { expectCount: 5, actualCount: 4, undocumentLines: [21] } }); }); it('has coverage badge', ()=> { const badge = fs.readFileSync('./test/out/badge.svg').toString(); assert(badge.includes('80%')); }); }); ================================================ FILE: esdoc-ecmascript-proposal-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-ecmascript-proposal-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-ecmascript-proposal-plugin/README.md ================================================ # ESDoc ECMAScript Proposal Plugin ## Install ``` npm install esdoc-ecmascript-proposal-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-ecmascript-proposal-plugin", "option": {"all": true}} ] } ``` If you want to enable each proposals, ```json { "source": "./src", "destination": "./doc", "plugins": [ { "name": "esdoc-ecmascript-proposal-plugin", "option": { "classProperties": true, "objectRestSpread": true, "doExpressions": true, "functionBind": true, "functionSent": true, "asyncGenerators": true, "decorators": true, "exportExtensions": true, "dynamicImport": true } } ] } ``` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-ecmascript-proposal-plugin/package.json ================================================ { "name": "esdoc-ecmascript-proposal-plugin", "version": "1.0.0", "description": "A ECMAScript proposal plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "^1.1.0", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "ecmascript", "proposal", "experimental", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-ecmascript-proposal-plugin/src/Plugin.js ================================================ class Plugin { onHandleCodeParser(ev) { const option = ev.data.option; const plugins = ev.data.parserOption.plugins; if (option.all || option.classProperties) plugins.push('classProperties'); if (option.all || option.objectRestSpread) plugins.push('objectRestSpread'); if (option.all || option.doExpressions) plugins.push('doExpressions'); if (option.all || option.functionBind) plugins.push('functionBind'); if (option.all || option.functionSent) plugins.push('functionSent'); if (option.all || option.asyncGenerators) plugins.push('asyncGenerators'); if (option.all || option.decorators) plugins.push('decorators'); if (option.all || option.exportExtensions) plugins.push('exportExtensions'); if (option.all || option.dynamicImport) plugins.push('dynamicImport'); } } module.exports = new Plugin(); ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js", "option": {"all": true}} ] } ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/src/AsyncGenerators.js ================================================ export default class AsyncGenerators { async *method() { const stream = [ Promise.resolve(4), Promise.resolve(9), Promise.resolve(12) ]; let total = 0; for await (const val of stream) { total += await val; yield total; } } } ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/src/ClassProperties.js ================================================ export default class ClassProperties { /** @type {number} */ static p1 = 123; /** @type {number} */ p1 = 123; } ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/src/Decorators.js ================================================ @annotation1 export default class Decorators { @annotation1 static method1(){} @annotation1 get value1(){} @annotation1 set value2(v){} @annotation1 @annotation2(true) method1(){} @annotation1.bar @annotation1.foo(1, 2) method2() {} } export function annotation1(){} export function annotation2(){} ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/src/DoExpressions.js ================================================ export default class DoExpressions { method1(){ const a = do { if(x > 10) { 'big'; } else { 'small'; } }; } } ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/src/DynamicImport.js ================================================ export default class DynamicImport { method() { for (let i = 0; i < 10; i++) { import(`mod${$i}.js`) .then(module => console.log(module)) .catch(err => console.log(err)); } } } ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/src/ECMAScriptProposal.test.js ================================================ const assert = require('assert'); const {find, file} = require('../util'); describe('test ecmascript proposal result:', ()=> { it('parses AsyncGenerators', ()=>{ const doc = find('longname', 'src/AsyncGenerators.js~AsyncGenerators#method'); assert(doc); }); it('parses ClassProperties', ()=>{ let doc = find('longname', 'src/ClassProperties.js~ClassProperties.p1'); assert.equal(doc.static, true); assert.equal(doc.type.types[0], 'number'); doc = find('longname', 'src/ClassProperties.js~ClassProperties#p1'); assert.equal(doc.static, false); assert.equal(doc.type.types[0], 'number'); }); it('parses Decorators', ()=>{ let doc = find('longname', 'src/Decorators.js~Decorators'); assert.deepEqual(doc.decorators, [{name: 'annotation1', arguments: null}]); doc = find('longname', 'src/Decorators.js~Decorators.method1'); assert.deepEqual(doc.decorators, [{name: 'annotation1', arguments: null}]); doc = find('longname', 'src/Decorators.js~Decorators#value1'); assert.deepEqual(doc.decorators, [{name: 'annotation1', arguments: null}]); doc = find('longname', 'src/Decorators.js~Decorators#value2'); assert.deepEqual(doc.decorators, [{name: 'annotation1', arguments: null}]); doc = find('longname', 'src/Decorators.js~Decorators#method1'); assert.deepEqual(doc.decorators, [{name: 'annotation1', arguments: null}, {name: 'annotation2', arguments: '(true)'}]); doc = find('longname', 'src/Decorators.js~Decorators#method2'); assert.deepEqual(doc.decorators, [{name: 'annotation1.bar', arguments: null}, {name: 'annotation1.foo', arguments: '(1, 2)'}]); }); it('parses DoExpressions', ()=>{ const doc = find('longname', 'src/DoExpressions.js~DoExpressions'); assert(doc); }); it('parses DynamicImport', ()=>{ const doc = find('longname', 'src/DynamicImport.js~DynamicImport'); assert(doc); }); it('parses ExportExtensions', ()=>{ const doc = find('longname', 'src/ExportExtensions.js~ExportExtensions'); assert(doc); }); it('parses FunctionBind', ()=>{ const doc = find('longname', 'src/FunctionBind.js~FunctionBind'); assert(doc); }); it('parses FunctionSent', ()=>{ const doc = find('longname', 'src/FunctionSent.js~FunctionSent'); assert(doc); }); it('parses ObjectRestSpread', ()=>{ let doc = find('longname', 'src/ObjectRestSpread.js~ObjectRestSpread#method1'); assert.deepEqual(doc.params, [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "config", "description": "this is config." }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": false, "name": "config.x", "description": "this is number x." }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "config.y", "description": "this is string y." }, { "nullable": null, "types": [ "number[]" ], "spread": false, "optional": false, "name": "config.a", "description": "thi is number[] a." }, { "nullable": null, "types": [ "string[]" ], "spread": false, "optional": false, "name": "config.b", "description": "thi is number[] b." } ]); doc = find('longname', 'src/ObjectRestSpread.js~ObjectRestSpread#method2'); assert.deepEqual(doc.return, { "nullable": null, "types": [ "{a: number, b: string, c: boolean}" ], "spread": false, "description": "" }); }); }); ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/src/ExportExtensions.js ================================================ export * as ns from 'mod' export v from "mod" export vv, {x, y as w} from "mod" export default from "mod" export class ExportExtensions { } ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/src/FunctionBind.js ================================================ function foo(){} export default class FunctionBind { method() { this::foo(); } } ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/src/FunctionSent.js ================================================ export default class FunctionSent { *method() { console.log(function.sent); } } ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/src/ObjectRestSpread.js ================================================ export default class ObjectRestSpread { /** * this is method1. * @param {Object} config - this is config. * @param {number} config.x - this is number x. * @param {string} config.y - this is string y. * @param {number[]} config.a - thi is number[] a. * @param {string[]} config.b - thi is number[] b. */ method1({x, y, ...z}){} /** * @returns {{a: number, b: string, c: boolean}} */ method2(){ const a = 1; const obj = {b: 'text', c: true}; return {a, ...obj}; } } ================================================ FILE: esdoc-ecmascript-proposal-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-exclude-source-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-exclude-source-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-exclude-source-plugin/README.md ================================================ # ESDoc Exclude Source Plugin ## Install ```bash npm install esdoc-exclude-source-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-exclude-source-plugin"} ] } ``` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-exclude-source-plugin/package.json ================================================ { "name": "esdoc-exclude-source-plugin", "version": "1.0.0", "description": "A exclude source plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "exclude", "source", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-exclude-source-plugin/src/Plugin.js ================================================ class Plugin { onHandleDocs(ev) { for (const doc of ev.data.docs) { if (doc.kind === 'file' || doc.kind === 'testFile') doc.content = ''; } } } module.exports = new Plugin(); ================================================ FILE: esdoc-exclude-source-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-exclude-source-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-exclude-source-plugin/test/src/MyClass.js ================================================ export default class MyClass { } ================================================ FILE: esdoc-exclude-source-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const fs = require('fs'); describe('test/MyClass.js:', ()=> { const tmp = fs.readFileSync('./test/out/index.json').toString(); const docs = JSON.parse(tmp); it('does not have source code.', ()=>{ docs.forEach((doc) => { if (doc.kind === 'file' || doc.kind === 'testFile') { assert.equal(doc.content, ''); } }); }); }); ================================================ FILE: esdoc-external-ecmascript-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-external-ecmascript-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-external-ecmascript-plugin/README.md ================================================ # ESDoc External ECMAScript Plugin ## Install ```bash npm install esdoc-external-ecmascript-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-external-ecmascript-plugin", "option": {"enable": true}} ] } ``` `enable` is default `true`. ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-external-ecmascript-plugin/package.json ================================================ { "name": "esdoc-external-ecmascript-plugin", "version": "1.0.0", "description": "A external ECMAScript plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "fs-extra": "1.0.0" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "external", "ecmascript", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-external-ecmascript-plugin/src/Plugin.js ================================================ const fs = require('fs-extra'); const path = require('path'); class Plugin { onHandleConfig(ev) { this._config = ev.data.config; this._option = ev.data.option || {}; if (!('enable' in this._option)) this._option.enable = true; if (!this._option.enable) return; const srcPath = path.resolve(__dirname, 'external-ecmascript.js'); const outPath = path.resolve(this._config.source, '.external-ecmascript.js'); fs.copySync(srcPath, outPath); } onHandleDocs(ev) { if (!this._option.enable) return; const outPath = path.resolve(this._config.source, '.external-ecmascript.js'); fs.removeSync(outPath); const name = path.basename(path.resolve(this._config.source)) + '/.external-ecmascript.js'; for (const doc of ev.data.docs) { if (doc.kind === 'external' && doc.memberof === name) doc.builtinExternal = true; } const tagIndex = ev.data.docs.findIndex(doc => doc.kind === 'file' && doc.name === name); ev.data.docs.splice(tagIndex, 1); } } module.exports = new Plugin(); ================================================ FILE: esdoc-external-ecmascript-plugin/src/external-ecmascript.js ================================================ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects // Value properties /** * @external {Infinity} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity */ /** * @external {NaN} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN */ /** * @external {undefined} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined */ /** * @external {null} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null */ // Fundamental objects /** * @external {Object} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object */ /** * @external {object} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object */ /** * @external {Function} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function */ /** * @external {function} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function */ /** * @external {Boolean} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean */ /** * @external {boolean} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean */ /** * @external {Symbol} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol */ /** * @external {Error} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error */ /** * @external {EvalError} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError */ /** * @external {InternalError} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError */ /** * @external {RangeError} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError */ /** * @external {ReferenceError} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError */ /** * @external {SyntaxError} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError */ /** * @external {TypeError} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError */ /** * @external {URIError} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError */ // Numbers and dates /** * @external {Number} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number */ /** * @external {number} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number */ /** * @external {Date} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date */ // Text processing /** * @external {String} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String */ /** * @external {string} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String */ /** * @external {RegExp} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp */ // Indexed collections /** * @external {Array} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array */ /** * @external {Int8Array} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array */ /** * @external {Uint8Array} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array */ /** * @external {Uint8ClampedArray} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray */ /** * @external {Int16Array} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array */ /** * @external {Uint16Array} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array */ /** * @external {Int32Array} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array */ /** * @external {Uint32Array} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array */ /** * @external {Float32Array} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array */ /** * @external {Float64Array} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array */ // Keyed collections /** * @external {Map} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map */ /** * @external {Set} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set */ /** * @external {WeakMap} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap */ /** * @external {WeakSet} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet */ // Structured data /** * @external {ArrayBuffer} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer */ /** * @external {DataView} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView */ /** * @external {JSON} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON */ // Control abstraction objects /** * @external {Promise} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise */ /** * @external {Generator} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator */ /** * @external {GeneratorFunction} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction */ // Reflection /** * @external {Reflect} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect */ /** * @external {Proxy} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy */ ================================================ FILE: esdoc-external-ecmascript-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-external-ecmascript-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-external-ecmascript-plugin/test/src/MyClass.js ================================================ export default class MyClass { } ================================================ FILE: esdoc-external-ecmascript-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const path = require('path'); const fs = require('fs'); describe('test external ecmascript results:', ()=>{ const tmp = fs.readFileSync('./test/out/index.json').toString(); const tags = JSON.parse(tmp); it('has external ecmascript.', ()=>{ const tag = tags.find(tag => tag.kind === 'external' && tag.name === 'number'); assert.equal(tag.externalLink, "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number"); }); it('removed external-ecmascript.js', ()=>{ assert.throws(()=>{ fs.readFileSync('./test/src/.external-ecmascript.js'); }); }); }); ================================================ FILE: esdoc-external-nodejs-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-external-nodejs-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-external-nodejs-plugin/README.md ================================================ # ESDoc External Node.js Plugin ## Install ```bash npm install esdoc-external-nodejs-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-external-nodejs-plugin", "option": {"enable": true}} ] } ``` `enable` is default `true`. ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-external-nodejs-plugin/package.json ================================================ { "name": "esdoc-external-nodejs-plugin", "version": "1.0.0", "description": "A external Node.js plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "fs-extra": "1.0.0" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "external", "nodejs", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-external-nodejs-plugin/src/Plugin.js ================================================ const fs = require('fs-extra'); const path = require('path'); class Plugin { onHandleConfig(ev) { this._config = ev.data.config; this._option = ev.data.option || {}; if (!('enable' in this._option)) this._option.enable = true; if (!this._option.enable) return; const srcPath = path.resolve(__dirname, 'external-nodejs.js'); const outPath = path.resolve(this._config.source, '.external-nodejs.js'); fs.copySync(srcPath, outPath); } onHandleDocs(ev) { if (!this._option.enable) return; const outPath = path.resolve(this._config.source, '.external-nodejs.js'); fs.removeSync(outPath); const name = path.basename(path.resolve(this._config.source)) + '/.external-nodejs.js'; for (const doc of ev.data.docs) { if (doc.kind === 'external' && doc.memberof === name) doc.builtinExternal = true; } const docIndex = ev.data.docs.findIndex(doc => doc.kind === 'file' && doc.name === name); ev.data.docs.splice(docIndex, 1); } } module.exports = new Plugin(); ================================================ FILE: esdoc-external-nodejs-plugin/src/external-nodejs.js ================================================ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects // Value properties /** * @external {http~ClientRequest} https://nodejs.org/dist/latest/docs/api/http.html#http_class_http_clientrequest */ ================================================ FILE: esdoc-external-nodejs-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-external-nodejs-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-external-nodejs-plugin/test/src/MyClass.js ================================================ export default class MyClass { /** * @param {http~ClientRequest} p */ method(p){} } ================================================ FILE: esdoc-external-nodejs-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const fs = require('fs'); const {find} = require('../util'); describe('test/MyClass.js:', ()=>{ it('has external Node.js.', ()=>{ const doc = find('name', 'http~ClientRequest'); assert.equal(doc.externalLink, "https://nodejs.org/dist/latest/docs/api/http.html#http_class_http_clientrequest"); }); it('removed external-nodejs.js', ()=>{ assert.throws(()=>{ fs.readFileSync('./test/src/.external-nodejs.js'); }); }); }); ================================================ FILE: esdoc-external-nodejs-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-external-webapi-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-external-webapi-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-external-webapi-plugin/README.md ================================================ # ESDoc External WebAPI Plugin ## Install ```bash npm install esdoc-external-webapi-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-external-webapi-plugin", "option": {"enable": true}} ] } ``` `enable` is default `true`. ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-external-webapi-plugin/package.json ================================================ { "name": "esdoc-external-webapi-plugin", "version": "1.0.0", "description": "A external Web API plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "fs-extra": "1.0.0" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "external", "webapi", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-external-webapi-plugin/src/Plugin.js ================================================ const fs = require('fs-extra'); const path = require('path'); class Plugin { onHandleConfig(ev) { this._config = ev.data.config; this._option = ev.data.option || {}; if (!('enable' in this._option)) this._option.enable = true; if (!this._option.enable) return; const srcPath = path.resolve(__dirname, 'external-webapi.js'); const outPath = path.resolve(this._config.source, '.external-webapi.js'); fs.copySync(srcPath, outPath); } onHandleDocs(ev) { if (!this._option.enable) return; const outPath = path.resolve(this._config.source, '.external-webapi.js'); fs.removeSync(outPath); const name = path.basename(path.resolve(this._config.source)) + '/.external-webapi.js'; for (const doc of ev.data.docs) { if (doc.kind === 'external' && doc.memberof === name) doc.builtinExternal = true; } const docIndex = ev.data.docs.findIndex(doc => doc.kind === 'file' && doc.name === name); ev.data.docs.splice(docIndex, 1); } } module.exports = new Plugin(); ================================================ FILE: esdoc-external-webapi-plugin/src/external-webapi.js ================================================ // https://developer.mozilla.org/en-US/docs/Web/API /** * @external {CanvasRenderingContext2D} https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D */ /** * @external {DocumentFragment} https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment */ /** * @external {Element} https://developer.mozilla.org/en-US/docs/Web/API/Element */ /** * @external {Event} https://developer.mozilla.org/en-US/docs/Web/API/Event */ /** * @external {Node} https://developer.mozilla.org/en-US/docs/Web/API/Node */ /** * @external {NodeList} https://developer.mozilla.org/en-US/docs/Web/API/NodeList */ /** * @external {XMLHttpRequest} https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest */ /** * @external {AudioContext} https://developer.mozilla.org/en/docs/Web/API/AudioContext */ ================================================ FILE: esdoc-external-webapi-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-external-webapi-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-external-webapi-plugin/test/src/MyClass.js ================================================ export default class MyClass { } ================================================ FILE: esdoc-external-webapi-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const {find} = require('../util'); describe('test/MyClass.js:', ()=>{ it('has external web api.', ()=>{ const doc = find('name', 'XMLHttpRequest'); assert.equal(doc.externalLink, 'https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest'); }); it('removed external-webapi.js', ()=>{ assert.throws(()=>{ fs.readFileSync('./test/src/.external-webapi.js'); }); }); }); ================================================ FILE: esdoc-external-webapi-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-flow-type-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.2 (2018-04-29) - **Fix** - Broken `@type {type} desc` ([#30](https://github.com/esdoc/esdoc-plugins/pull/30)) Thanks [@samskivert](https://github.com/samskivert) ## 1.0.1 (2017-09-03) - **Fix** - [esdoc-flow-type-plugin] Broken `@return {type} desc` ([#23](https://github.com/esdoc/esdoc-plugins/pull/23)) Thanks [@samskivert](https://github.com/samskivert) ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-flow-type-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-flow-type-plugin/README.md ================================================ # ESDoc Flow Type Plugin (PoC) **This plugin is proof of concept.** ## Install ```bash npm install esdoc-flow-type-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-flow-type-plugin", "option": {"enable": true}} ] } ``` - `enable` is default `true` ## Example ```js export class Foo { // without document member: number; // without document method1(n: number): string { } // without @param and @return /** * this is method2. */ method2(n: number): string { } // without type in @param and @return /** * this is method3. * @param n - this is param desc. * @return this is return desc. */ method3(n: number): string { } } ``` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-flow-type-plugin/package.json ================================================ { "name": "esdoc-flow-type-plugin", "version": "1.0.2", "description": "A flow type plugin for ESDoc [PoC]", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3", "esdoc-standard-plugin": "latest" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "flow", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-flow-type-plugin/src/Plugin.js ================================================ const ASTUtil = require('esdoc/out/src/Util/ASTUtil').default; const CommentParser = require('esdoc/out/src/Parser/CommentParser').default; const InvalidCodeLogger = require('esdoc/out/src/Util/InvalidCodeLogger').default; function formatExpression(expr) { switch (expr.type) { case 'ObjectExpression': return `{${expr.properties.map(formatExpression)}}`; default: // XLiteral return expr.value ? String(expr.value) : undefined; } } function formatTypeId(id) { switch (id.type) { case 'QualifiedTypeIdentifier': return `${formatTypeId(id.qualification)}.${formatTypeId(id.id)}`; case 'Identifier': return id.name; default: return id.type; } } function isOptional(type) { // TODO: should detect 'foo | void' here as well... return type.type === 'NullableTypeAnnotation'; } function formatTypeAnnotation(type) { switch (type.type) { case 'GenericTypeAnnotation': return type.typeParameters ? `${formatTypeId(type.id)}<${formatTypeAnnotations(type.typeParameters.params, ', ')}>` : formatTypeId(type.id); case 'TupleTypeAnnotation': return `[${formatTypeAnnotations(type.types, ', ')}]`; case 'NullableTypeAnnotation': return `?${formatTypeAnnotation(type.typeAnnotation)}`; case 'UnionTypeAnnotation': return formatTypeAnnotations(type.types, '|'); case 'ArrayTypeAnnotation': return `${formatTypeAnnotation(type.elementType)}[]`; default: return type.type.replace('TypeAnnotation', '').toLowerCase(); } } function formatTypeAnnotations(types, sep) { return types.map(formatTypeAnnotation).join(sep); } class FlowTypePlugin { constructor() { this._enable = true; } onStart(ev) { if (!ev.data.option) return; if ('enable' in ev.data.option) this._enable = ev.data.option.enable; } onHandleCodeParser(ev) { if (this._enable) ev.data.parserOption.plugins.push('flow'); } onHandleAST(ev) { if (!this._enable) return; ASTUtil.traverse(ev.data.ast, (node, parent, path) =>{ try { this._dispatch(node, parent, path); } catch (e) { console.log(`${e.message}`); InvalidCodeLogger.show(ev.data.filePath, node); } }); } _dispatch(node, parent, path) { switch (node.type) { case 'ClassMethod': switch (node.kind) { case 'constructor': this._applyCallableParam(node); break; case 'method': this._applyCallableParam(node); this._applyCallableReturn(node); break; case 'get': this._applyClassMethodGetter(node); break; case 'set': this._applyClassMethodSetter(node); break; default: console.warn(`Unknown ClassMethod kind: ${node.kind}`); break; } break; case 'ClassProperty': this._applyClassProperty(node); break; case 'FunctionDeclaration': this._applyCallableParam(node); this._applyCallableReturn(node); break; } } _applyCallableParam(node) { if (!node.params) return; // get comments const {tags, commentNode} = CommentParser.parseFromNode(node); // get types const types = node.params.map(param => { switch (param.type) { case 'Identifier': return { type: this._getTypeFromAnnotation(param.typeAnnotation), name: param.name, tagName: param.typeAnnotation && isOptional(param.typeAnnotation) ? `[${param.name}]` : param.name, }; case 'AssignmentPattern': return { type: this._getTypeFromAnnotation(param.left.typeAnnotation), name: param.name, tagName: `[${param.left.name}=${formatExpression(param.right)}]`, }; case 'RestElement': return { type: `...${this._getTypeFromAnnotation(param.typeAnnotation)}`, name: param.argument.name, tagName: param.argument.name, }; default: console.warn(`Unhandled method parameter type: ${param.type}`); console.dir(param); return { type: '*', name: param.name, tagName: param.name, }; } }); const paramTags = tags.filter(tag => tag.tagName === '@param'); // merge // case: params without comments if (paramTags.length === 0 && types.length) { const tmp = types.map(({type, tagName}) => { return { tagName: '@param', tagValue: `{${type}} ${tagName}` }; }); tags.push(...tmp); commentNode.value = CommentParser.buildComment(tags); return; } // case: params with comments if (paramTags.length === types.length) { for (let i = 0; i < paramTags.length; i++) { const paramTag = paramTags[i]; const type = types[i]; let text = paramTag.tagValue; if (text.charAt(0) !== '{') { // does not have type if (text.charAt(0) !== '[') { // does not have attrs text = `${type.tagName} ${text.substring(text.indexOf(' ')+1)}`; } paramTag.tagValue = `{${type.type}} ${text}`; } } commentNode.value = CommentParser.buildComment(tags); return; } // case: mismatch params and comments throw new Error('mismatch params and comments'); } _applyCallableReturn(node) { if (!node.returnType) return; // get type const type = this._getTypeFromAnnotation(node.returnType); if (!type) return; // get comments const {tags, commentNode} = CommentParser.parseFromNode(node); const returnTag = tags.find(tag => tag.tagName === '@return' || tag.tagName === '@returns'); // merge if (returnTag) { if (returnTag.tagValue.charAt(0) !== '{') { // return with comment but does not have tpe returnTag.tagValue = `{${type}} ${returnTag.tagValue}`; } // otherwise @return already has type annotation, leave as is } else { tags.push({tagName: '@return', tagValue: `{${type}}`}); } commentNode.value = CommentParser.buildComment(tags); } _applyClassMethodGetter(classMethodNode) { if (classMethodNode.kind !== 'get') return; if (!classMethodNode.returnType) return; // get type const type = this._getTypeFromAnnotation(classMethodNode.returnType); if (!type) return; // get comments const {tags, commentNode} = CommentParser.parseFromNode(classMethodNode); const typeComment = tags.find(tag => tag.tagName === '@type'); if (typeComment) { if (typeComment.tagValue.charAt(0) !== '{') { // type with comment but does not have tpe typeComment.tagValue = `{${type}}`; } // otherwise getter already has type annotation, leave as is } else { tags.push({tagName: '@type', tagValue: `{${type}}`}); } commentNode.value = CommentParser.buildComment(tags); } _applyClassMethodSetter(classMethodNode) { if (classMethodNode.kind !== 'set') return; if (!classMethodNode.params) return; // get type const type = this._getTypeFromAnnotation(classMethodNode.params[0].typeAnnotation); if (!type) return; // get comment const {tags, commentNode} = CommentParser.parseFromNode(classMethodNode); const typeComment = tags.find(tag => tag.tagName === '@type'); if (typeComment) return; // merge // case: param without comment tags.push({tagName: '@type', tagValue: `{${type}}`}); commentNode.value = CommentParser.buildComment(tags); } _applyClassProperty(classPropertyNode) { if (!classPropertyNode.typeAnnotation) return; // get type const type = this._getTypeFromAnnotation(classPropertyNode.typeAnnotation); if (!type) return; // get comments const {tags, commentNode} = CommentParser.parseFromNode(classPropertyNode); const typeComment = tags.find(tag => tag.tagName === '@type'); if (typeComment) { if (typeComment.tagValue.charAt(0) !== '{') { // type with comment but does not have tpe typeComment.tagValue = `{${type}}`; } // otherwise property already has type annotation, leave as is } else { tags.push({tagName: '@type', tagValue: `{${type}}`}); } commentNode.value = CommentParser.buildComment(tags); } _getTypeFromAnnotation(typeAnnotation) { if (!typeAnnotation) return '*'; return formatTypeAnnotation(typeAnnotation.typeAnnotation); } } module.exports = new FlowTypePlugin(); ================================================ FILE: esdoc-flow-type-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js"], "plugins": [ {"name": "./src/Plugin.js"}, {"name": "esdoc-standard-plugin"} ] } ================================================ FILE: esdoc-flow-type-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-flow-type-plugin/test/src/FlowType.js ================================================ // @flow export class TestFlowTypeClass { member1: number; get getter1(): string {} set setter1(v: number) {} method1(n: number, x: Foo): string { return 'Hello'.repeat(n); } /** * this is method2. */ method2(n: number, x: Foo): string { return 'Hello'.repeat(n); } /** * this is method3. * @param n - this is n * @param x - this is x * @return this is return */ method3(n: number, x: Foo): string { return 'Hello'.repeat(n); } /** * this is method4. * @param t - this is t * @param x - this is x * @param o - this is o * @param q - this is q * @return this is return */ method4(t: [number, number], x: Foo, o: string|void, q: THREE.Vector3): ?string { return 'Hello'.repeat(t[0]); } } export function testFlowTypeFunction(n: number, x: Foo): string{} ================================================ FILE: esdoc-flow-type-plugin/test/src/FlowType.test.js ================================================ const assert = require('assert'); const {find, file} = require('../util'); describe('test/FlowType.js:', ()=> { it('has type of method, without comment', ()=>{ const doc = find('longname', 'src/FlowType.js~TestFlowTypeClass#method1'); assert.equal(doc.params.length, 2); assert.deepEqual(doc.params[0].types, ['number']); assert.deepEqual(doc.params[1].types, ['Foo']); assert.deepEqual(doc.return.types, ['string']); }); it('has type of method, without tags', ()=>{ const doc = find('longname', 'src/FlowType.js~TestFlowTypeClass#method2'); assert.equal(doc.params.length, 2); assert.deepEqual(doc.params[0].types, ['number']); assert.deepEqual(doc.params[1].types, ['Foo']); assert.deepEqual(doc.return.types, ['string']); }); it('has type of method, without type', ()=>{ const doc = find('longname', 'src/FlowType.js~TestFlowTypeClass#method3'); assert.equal(doc.params.length, 2); assert.deepEqual(doc.params[0].types, ['number']); assert.deepEqual(doc.params[1].types, ['Foo']); assert.deepEqual(doc.return.types, ['string']); }); it('has type of method, extracting proper argument types', ()=>{ const doc = find('longname', 'src/FlowType.js~TestFlowTypeClass#method4'); assert.equal(doc.params.length, 4); assert.deepEqual(doc.params[0].types, ['[number, number]']); assert.deepEqual(doc.params[1].types, ['Foo']); assert.deepEqual(doc.params[2].types, ['string' , 'void']); assert.deepEqual(doc.params[3].types, ['THREE.Vector3']); assert.deepEqual(doc.return.types, ['string']); assert.equal(doc.return.nullable, true); }); it('has type of getter, without comment', ()=>{ const doc = find('longname', 'src/FlowType.js~TestFlowTypeClass#getter1'); assert.deepEqual(doc.type.types, ['string']); }); it('has type of setter, without comment', ()=>{ const doc = find('longname', 'src/FlowType.js~TestFlowTypeClass#setter1'); assert.deepEqual(doc.type.types, ['number']); }); it('has type of member, without comment', ()=>{ const doc = find('longname', 'src/FlowType.js~TestFlowTypeClass#member1'); assert.deepEqual(doc.type.types, ['number']); }); it('has type of function, without comment', ()=>{ const doc = find('longname', 'src/FlowType.js~testFlowTypeFunction'); assert.equal(doc.params.length, 2); assert.deepEqual(doc.params[0].types, ['number']); assert.deepEqual(doc.params[1].types, ['Foo']); assert.deepEqual(doc.return.types, ['string']); }); }); ================================================ FILE: esdoc-flow-type-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-importpath-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.2 (2018-04-29) - **Fix** - Strip last slash ([#37](https://github.com/esdoc/esdoc-plugins/pull/37)) Thanks [@LestaD](https://github.com/LestaD) ## 1.0.1 (2017-09-09) - **Feat** - Add `option.stripPackageName` ([#21](https://github.com/esdoc/esdoc-plugins/pull/21)) Thanks [@BKcore](https://github.com/BKcore) ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-importpath-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-importpath-plugin/README.md ================================================ # ESDoc Import Path Plugin This is a plugin that converts the import path in documentation. ESDoc displays the import path of class/function into the document. However, the import path may be different from real import path because usually ES2015 is transpiled to use it. For example, ``src/MyClass.js`` will be referred to as ``import MyClass from 'my-module/src/MyClass.js'`` in the documentation. However, in practice it is different from the real import path when you use because it is transpiled (for example, ``import MyClass from 'my-module/lib/MyClass.js'``). Therefore, convert the import path by using following setting. ```json { "source": "./src", "destination": "./doc", "plugins": [ { "name": "esdoc-importpath-plugin", "option": { "stripPackageName": false, "replaces": [ {"from": "^src/", "to": "lib/"} ] } } ] } ``` ``from`` is regular expression and ``to``is letter. In the internal ``from`` and ``to`` are used with ``String#replace(new RegExp (from), to)``. When writing multi rules, it will also be carried out transformation many times. For example, ``[{from: "^src/", to: "lib/"}, {from: "MyFooClass", to: "my-foo"}]`` converted as follows: - `` my-module/src/MyFooClass.js`` => `` my-module/lib/MyFooClass.js`` => ``my-module/lib/my-foo`` ``stripPackageName`` is a boolean that when set to ``true`` will strip the package name from the import path. This is useful for projects that have custom module resolvers where you want to be able to replace the whole path. ## Install ```sh npm install esdoc-importpath-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ { "name": "esdoc-importpath-plugin", "option": { "replaces": [ {"from": "^src/", "to": "lib"} ] } } ] } ``` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://twitter.com/h13i32maru) ================================================ FILE: esdoc-importpath-plugin/package.json ================================================ { "name": "esdoc-importpath-plugin", "version": "1.0.2", "description": "A import path plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "import", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-importpath-plugin/src/Plugin.js ================================================ const fs = require('fs'); class Plugin { onHandleConfig(ev) { this._config = ev.data.config; } onHandleDocs(ev) { const packagePath = this._config.package || './package.json'; const option = ev.data.option; for (let item of option.replaces) { item.from = new RegExp(item.from); } // get package.json let packageName = ''; let mainPath = ''; try { const packageJSON = fs.readFileSync(packagePath).toString(); const packageObj = JSON.parse(packageJSON); packageName = packageObj.name; if(packageObj.main) mainPath = packageObj.main; } catch (e) { // ignore } for (const doc of ev.data.docs) { if (!doc.importPath) continue; let importPath = doc.importPath; if (packageName) importPath = importPath.replace(new RegExp(`^${packageName}/`), ''); for (let item of option.replaces) { importPath = importPath.replace(item.from, item.to); } if (importPath === mainPath || importPath.trim().length === 0) { doc.importPath = packageName; } else if (packageName && option.stripPackageName !== true) { doc.importPath = `${packageName}/${importPath}`; } else { doc.importPath = importPath; } } } } module.exports = new Plugin(); ================================================ FILE: esdoc-importpath-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "package": "./test/package.json", "plugins": [ { "name": "./src/Plugin.js", "option": { "replaces": [ {"from": "^src/", "to": "lib/"}, {"from": "^lib/MyClass2.js", "to": "lib/foo"} ] } } ] } ================================================ FILE: esdoc-importpath-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-importpath-plugin/test/package.json ================================================ { "name": "esdoc-importpath-plugin", "main": "lib/Index.js" } ================================================ FILE: esdoc-importpath-plugin/test/src/Index.js ================================================ export default class Index { } ================================================ FILE: esdoc-importpath-plugin/test/src/MyClass1.js ================================================ export default class MyClass1 { } ================================================ FILE: esdoc-importpath-plugin/test/src/MyClass2.js ================================================ export default class MyClass2 { } ================================================ FILE: esdoc-importpath-plugin/test/src/all.test.js ================================================ const assert = require('assert'); const {find} = require('../util'); describe('test/MyClass.js:', ()=> { it('converts simply', ()=> { const doc = find('name', 'MyClass1'); assert.equal(doc.importPath, 'esdoc-importpath-plugin/lib/MyClass1.js'); }); it('converts multiple', ()=>{ const doc = find('name', 'MyClass2'); assert.equal(doc.importPath, 'esdoc-importpath-plugin/lib/foo'); }); it('converts with package name', ()=>{ const doc = find('name', 'Index'); assert.equal(doc.importPath, 'esdoc-importpath-plugin'); }); }); ================================================ FILE: esdoc-importpath-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-inject-gtm-plugin/CHANGELOG.md ================================================ # Changelog ================================================ FILE: esdoc-inject-gtm-plugin/README.md ================================================ # ESDoc Inject GTM Plugin ## Install ```bash npm install esdoc-inject-gtm-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-inject-script-plugin", "option": {"enable": true, "id": "GTM-XXXXX"}} ] } ``` `enable` is default `true`. ## LICENSE MIT ## Author [9renpoto](https://github.com/9renpoto) ================================================ FILE: esdoc-inject-gtm-plugin/package.json ================================================ { "name": "esdoc-inject-gtm-plugin", "description": "A inject google-tag-manager plugin for ESDoc", "version": "0.0.1", "author": "9renpoto", "dependencies": { "cheerio": "^1.0.0-rc.2", "fs-extra": "^4.0.1" }, "devDependencies": { "esdoc": "latest", "mocha": "^3.5.0" }, "engines": { "node": ">= 6.0.0" }, "files": [ "src", "README.md" ], "homepage": "https://github.com/esdoc/esdoc-plugins", "keywords": [ "esdoc", "inject", "plugin", "script" ], "license": "MIT", "main": "src/Plugin.js", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" } } ================================================ FILE: esdoc-inject-gtm-plugin/src/Plugin.js ================================================ const fs = require("fs-extra") const path = require("path") const cheerio = require("cheerio") const toSnippet = id => { return `` } class Plugin { onStart(ev) { this._option = ev.data.option || {} if (!("enable" in this._option)) this._option.enable = true } onHandleContent(ev) { if (!this._option.enable) return const fileName = ev.data.fileName if (path.extname(fileName) !== ".html") return const $ = cheerio.load(ev.data.content) $("head").append(toSnippet(this._option.id)) ev.data.content = $.html() } onPublish(ev) { if (!this._option.enable) return ev.data.writeFile("gtm.js", toSnippet(this._option.id)) } } module.exports = new Plugin() ================================================ FILE: esdoc-inject-gtm-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./test/misc/publish-html-mock-plugin.js"}, {"name": "./src/Plugin.js", "option": {"id": "GTM-XXXXX"}} ] } ================================================ FILE: esdoc-inject-gtm-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-inject-gtm-plugin/test/misc/publish-html-mock-plugin.js ================================================ exports.onPublish = function(ev) { const html = ` Home
`; ev.data.writeFile('index.html', html); }; ================================================ FILE: esdoc-inject-gtm-plugin/test/src/MyClass.js ================================================ export default class MyClass { } ================================================ FILE: esdoc-inject-gtm-plugin/test/src/MyClass.test.js ================================================ const assert = require("assert") const path = require("path") const fs = require("fs") const cheerio = require("cheerio") describe("test inject script result:", () => { it("has injected script tag title", () => { const html = fs.readFileSync("./test/out/index.html").toString() const $ = cheerio.load(html) assert.equal($("script").length, 1) }) }) ================================================ FILE: esdoc-inject-script-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-inject-script-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-inject-script-plugin/README.md ================================================ # ESDoc Inject Script Plugin ## Install ```bash npm install esdoc-inject-script-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-inject-script-plugin", "option": {"enable": true, "scripts": ["./foo.js"]}} ] } ``` `enable` is default `true`. ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-inject-script-plugin/package.json ================================================ { "name": "esdoc-inject-script-plugin", "version": "1.0.0", "description": "A inject script plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "cheerio": "0.22.0", "fs-extra": "1.0.0" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "inject", "script", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-inject-script-plugin/src/Plugin.js ================================================ const fs = require('fs-extra'); const path = require('path'); const cheerio = require('cheerio'); class Plugin { onStart(ev) { this._option = ev.data.option || {}; if (!('enable' in this._option)) this._option.enable = true; } onHandleContent(ev) { if (!this._option.enable) return; const fileName = ev.data.fileName; if (path.extname(fileName) !== '.html') return; const $ = cheerio.load(ev.data.content); let i = 0; for (const script of this._option.scripts) { const src = `./inject/script/${i}-${path.basename(script)}`; $('head').append(``); } ev.data.content = $.html(); } onPublish(ev) { if (!this._option.enable) return; let i = 0; for (const script of this._option.scripts) { const outPath = `inject/script/${i}-${path.basename(script)}`; const content = fs.readFileSync(script).toString(); ev.data.writeFile(outPath, content); } } } module.exports = new Plugin(); ================================================ FILE: esdoc-inject-script-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./test/misc/publish-html-mock-plugin.js"}, {"name": "./src/Plugin.js", "option": {"scripts": ["./test/misc/inject.js"]}} ] } ================================================ FILE: esdoc-inject-script-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-inject-script-plugin/test/misc/inject.js ================================================ console.log('this is injected script'); ================================================ FILE: esdoc-inject-script-plugin/test/misc/publish-html-mock-plugin.js ================================================ exports.onPublish = function(ev) { const html = ` Home
`; ev.data.writeFile('index.html', html); }; ================================================ FILE: esdoc-inject-script-plugin/test/src/MyClass.js ================================================ export default class MyClass { } ================================================ FILE: esdoc-inject-script-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const path = require('path'); const fs = require('fs'); const cheerio = require('cheerio'); describe('test inject script result:', ()=> { it('has injected script tag title', ()=>{ const html = fs.readFileSync('./test/out/index.html').toString(); const $ = cheerio.load(html); assert.equal($('script[src="./inject/script/0-inject.js"]').length, 1); }); it('has injected script', ()=>{ const script = fs.readFileSync('./test/out/inject/script/0-inject.js').toString(); assert.equal(script, "console.log('this is injected script');\n"); }); }); ================================================ FILE: esdoc-inject-style-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-inject-style-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-inject-style-plugin/README.md ================================================ # ESDoc Inject Style Plugin ## Install ```bash npm install esdoc-inject-style-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-inject-style-plugin", "option": {"enable": true, "styles": ["./foo.css"]}} ] } ``` `enable` is default `true`. ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-inject-style-plugin/package.json ================================================ { "name": "esdoc-inject-style-plugin", "version": "1.0.0", "description": "A inject style plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "cheerio": "0.22.0", "fs-extra": "1.0.0" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "inject", "style", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-inject-style-plugin/src/Plugin.js ================================================ const fs = require('fs'); const path = require('path'); const cheerio = require('cheerio'); class Plugin { onStart(ev) { this._option = ev.data.option || {}; if (!('enable' in this._option)) this._option.enable = true; } onHandleContent(ev) { if (!this._option.enable) return; if (path.extname(ev.data.fileName) !== '.html') return; const $ = cheerio.load(ev.data.content); let i = 0; for (const style of this._option.styles) { const src = `./inject/css/${i}-${path.basename(style)}`; $('head').append(``); } ev.data.content = $.html(); } onPublish(ev) { if (!this._option.enable) return; let i = 0; for (const style of this._option.styles) { const outPath = `inject/css/${i}-${path.basename(style)}`; const content = fs.readFileSync(style).toString(); ev.data.writeFile(outPath, content); } } } module.exports = new Plugin(); ================================================ FILE: esdoc-inject-style-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./test/misc/publish-html-mock-plugin.js"}, {"name": "./src/Plugin.js", "option": {"styles": ["./test/misc/inject.css"]}} ] } ================================================ FILE: esdoc-inject-style-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-inject-style-plugin/test/misc/inject.css ================================================ body { background: #eee; } ================================================ FILE: esdoc-inject-style-plugin/test/misc/publish-html-mock-plugin.js ================================================ exports.onPublish = function(ev) { const html = ` Home
`; ev.data.writeFile('index.html', html); }; ================================================ FILE: esdoc-inject-style-plugin/test/src/MyClass.js ================================================ export default class MyClass { } ================================================ FILE: esdoc-inject-style-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const path = require('path'); const fs = require('fs'); const cheerio = require('cheerio'); describe('test inject style result:', ()=> { it('has injected style tag title', ()=>{ const html = fs.readFileSync('./test/out/index.html').toString(); const $ = cheerio.load(html); assert.equal($('link[href="./inject/css/0-inject.css"]').length, 1); }); it('has injected style', ()=>{ const style = fs.readFileSync('./test/out/inject/css/0-inject.css').toString(); assert.equal(style, "body { background: #eee; }\n"); }); }); ================================================ FILE: esdoc-integrate-manual-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-integrate-manual-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-integrate-manual-plugin/README.md ================================================ # ESDoc Integrate Manual Plugin ## Install ```bash npm install esdoc-integrate-manual-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ { "name": "esdoc-integrate-manual-plugin", "option": { "index": "./manual/index.md", "globalIndex": true, "asset": "./manual/asset", "files": [ "./manual/overview.md", "./manual/design.md", "./manual/installation.md", "./manual/usage1.md", "./manual/usage2.md", "./manual/tutorial.md", "./manual/configuration.md", "./manual/example.md", "./manual/advanced.md", "./manual/faq.md", "./CHANGELOG.md" ] } } ] } ``` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-integrate-manual-plugin/package.json ================================================ { "name": "esdoc-integrate-manual-plugin", "version": "1.0.0", "description": "A integrate manual plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "manual", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-integrate-manual-plugin/src/Plugin.js ================================================ const fs = require('fs'); const path = require('path'); const assert = require('assert'); class Plugin { onHandleDocs(ev) { this._docs = ev.data.docs; this._option = ev.data.option; this._exec(); } _exec(){ this._setDefault(); const docs = this._generateDocs(); this._docs.push(...docs); } _setDefault() { if (!this._option) return; assert(this._option.files); if (!('coverage' in this._option)) this._option.coverage = true; } _generateDocs() { const manual = this._option; const results = []; if (!this._option) return results; if (manual.index) { results.push({ kind: 'manualIndex', globalIndex: manual.globalIndex, content: fs.readFileSync(manual.index).toString(), longname: path.resolve(manual.index), name: manual.index, static: true, access: 'public' }); } else { results.push({ kind: 'manualIndex', globalIndex: false, content: null, longname: '', // longname does not must be null. name: manual.index, static: true, access: 'public' }); } if (manual.asset) { results.push({ kind: 'manualAsset', longname: path.resolve(manual.asset), name: manual.asset, static: true, access: 'public' }); } for (const filePath of manual.files) { results.push({ kind: 'manual', longname: path.resolve(filePath), name: filePath, content: fs.readFileSync(filePath).toString(), static: true, access: 'public' }); } return results; } } module.exports = new Plugin(); ================================================ FILE: esdoc-integrate-manual-plugin/test/CHANGELOG.md ================================================ # Changelog ## 0.0.1 - **Fix** - fix a bug ================================================ FILE: esdoc-integrate-manual-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ { "name": "./src/Plugin.js", "option": { "index": "./test/manual/index.md", "globalIndex": true, "asset": "./test/manual/asset", "files": [ "./test/manual/overview.md", "./test/manual/design.md", "./test/manual/installation.md", "./test/manual/usage1.md", "./test/manual/usage2.md", "./test/manual/tutorial.md", "./test/manual/configuration.md", "./test/manual/example.md", "./test/manual/advanced.md", "./test/manual/faq.md", "./test/CHANGELOG.md" ] } } ] } ================================================ FILE: esdoc-integrate-manual-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/advanced.md ================================================ # Advanced foo ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/all.test.js ================================================ const assert = require('assert'); const {find, file} = require('../util'); describe('test/manual:', ()=>{ it('has manual index', ()=>{ const doc = find('longname', /manual\/index.md$/); assert.equal(doc.content, file(doc.name)); assert.equal(doc.globalIndex, true); }); it('has manual asset', ()=>{ const doc = find('longname', /manual\/asset$/); assert(doc); }); it('has manual overview', ()=>{ const doc = find('longname', /manual\/overview.md$/); assert.equal(doc.content, file(doc.name)); }); it('has manual design', ()=>{ const doc = find('longname', /manual\/design.md$/); assert.equal(doc.content, file(doc.name)); }); it('has manual installation', ()=>{ const doc = find('longname', /manual\/installation.md$/); assert.equal(doc.content, file(doc.name)); }); it('has manual usage', ()=>{ const [doc1, doc2] = find('longname', /manual\/usage1.md$/, /manual\/usage2.md$/); assert.equal(doc1.content, file(doc1.name)); assert.equal(doc2.content, file(doc2.name)); }); it('has manual tutorial', ()=>{ const doc = find('longname', /manual\/tutorial.md$/); assert.equal(doc.content, file(doc.name)); }); it('has manual configuration', ()=>{ const doc = find('longname', /manual\/configuration.md$/); assert.equal(doc.content, file(doc.name)); }); it('has manual example', ()=>{ const doc = find('longname', /manual\/example.md$/); assert.equal(doc.content, file(doc.name)); }); it('has manual advanced', ()=>{ const doc = find('longname', /manual\/advanced.md$/); assert.equal(doc.content, file(doc.name)); }); it('has manual faq', ()=>{ const doc = find('longname', /manual\/faq.md$/); assert.equal(doc.content, file(doc.name)); }); it('has manual changelog', ()=>{ const doc = find('longname', /CHANGELOG.md$/); assert.equal(doc.content, file(doc.name)); }); }); ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/configuration.md ================================================ # Configuration this is configuration. ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/design.md ================================================ # Design ## Concept foo ## Architecture foo ## Model foo ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/example.md ================================================ # Example ## Minimum Config ```json { "source": "./src", "destination": "./doc" } ``` ## Integration Test Code Into Documentation ```json { "source": "./src", "destination": "./doc", "test": { "type": "mocha", "source": "./test" } } ``` ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/faq.md ================================================ # FAQ - [Goal](#goal) ## Goal ESDoc has two goals. The first goal is reducing the cost to write an documentation, it is able to continuously maintenance. The second goal is without looking the source code of a library, it is to be able to use the library. ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/index.md ================================================ # ESDoc Manual tbd ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/installation.md ================================================ # Installation ```sh npm install -g esdoc ``` ## indent 2 ### indent 3 #### indent 4 ##### indent 5 ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/overview.md ================================================ # Overview ESDoc is a documentation generator for JavaScript(ES6). ## Feature - Generates detailed document. - Measures document coverage. - Integrate test codes into documentation. - [ESDoc Hosting Service](https://doc.esdoc.org) ## Demo - [ESDoc](https://esdoc.org/esdoc) is self-hosting 😄 ## License MIT ## Author [Ryo Maruyama@h13i32maru](https://twitter.com/h13i32maru) ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/tutorial.md ================================================ # Tutorial this is tutorial. ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/usage1.md ================================================ # Usage ```sh esdoc -c esdoc.json ``` ``esdoc.json`` ```json { "source": "./src", "destination": "./doc" } ``` ================================================ FILE: esdoc-integrate-manual-plugin/test/manual/usage2.md ================================================ # Usage2 this is usage2 ## h2 in usage2 this is h2 in usage2 ### h3 in usage2 this is h2 in usage3 ================================================ FILE: esdoc-integrate-manual-plugin/test/src/Dummy.js ================================================ export default class TestDummy {} ================================================ FILE: esdoc-integrate-manual-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-integrate-test-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-integrate-test-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-integrate-test-plugin/README.md ================================================ # ESDoc Integrate Test Plugin ## Install ```bash npm install esdoc-integrate-test-plugin ``` ## Config ```json { "source": "./src", "destination": "./docs", "plugins": [ { "name": "esdoc-integrate-test-plugin", "option": { "source": "./test/", "interfaces": ["describe", "it", "context", "suite", "test"], "includes": ["(spec|Spec|test|Test)\\.js$"], "excludes": ["\\.config\\.js$"] } } ] } ``` - `source` is required - `interfaces` default is `["describe", "it", "context", "suite", "test"]` - `includes` default is `["(spec|Spec|test|Test)\\.js$"]` - `excludes` default is `["\\.config\\.js$"]` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-integrate-test-plugin/package.json ================================================ { "name": "esdoc-integrate-test-plugin", "version": "1.0.0", "description": "A integrate test plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "test", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-integrate-test-plugin/src/Plugin.js ================================================ const assert = require('assert'); const path = require('path'); const fs = require('fs'); const TestDocFactory = require('./TestDocFactory'); // hack const ESParser = require('esdoc/out/src/Parser/ESParser').default; const InvalidCodeLogger = require('esdoc/out/src/Util/InvalidCodeLogger').default; const PathResolver = require('esdoc/out/src/Util/PathResolver').default; const ASTUtil = require('esdoc/out/src/Util/ASTUtil').default; class Plugin { onHandleDocs(ev) { this._docs = ev.data.docs; this._option = ev.data.option; this._exec(); } _exec() { this._setDefault(); const docs = this._generateDocs(); this._docs.push(...docs); } _setDefault() { if (!this._option) return; const option = this._option; assert(option.source); if (!option.interfaces) option.interfaces = ['describe', 'it', 'context', 'suite', 'test']; if (!option.includes) option.includes = ['(spec|Spec|test|Test)\\.js$']; if (!option.excludes) option.excludes = ['\\.config\\.js$']; } /** * Generate document from test code. */ _generateDocs() { const option = this._option; const results = []; if (!option) return results; const includes = option.includes.map((v) => new RegExp(v)); const excludes = option.excludes.map((v) => new RegExp(v)); const sourceDirPath = path.resolve(option.source); this._walk(option.source, (filePath)=>{ const relativeFilePath = path.relative(sourceDirPath, filePath); let match = false; for (const reg of includes) { if (relativeFilePath.match(reg)) { match = true; break; } } if (!match) return; for (const reg of excludes) { if (relativeFilePath.match(reg)) return; } console.log(`parse: ${filePath}`); const temp = this._traverse(option.interfaces, option.source, filePath); if (!temp) return; results.push(...temp.results); // todo: enable work // asts.push({filePath: `test${path.sep}${relativeFilePath}`, ast: temp.ast}); }); return results; } /** * walk recursive in directory. * @param {string} dirPath - target directory path. * @param {function(entryPath: string)} callback - callback for find file. * @private */ _walk(dirPath, callback) { const entries = fs.readdirSync(dirPath); for (const entry of entries) { const entryPath = path.resolve(dirPath, entry); const stat = fs.statSync(entryPath); if (stat.isFile()) { callback(entryPath); } else if (stat.isDirectory()) { this._walk(entryPath, callback); } } } /** * traverse doc comment in test code file. * @param {string[]} interfaces - test interface names. * @param {string} inDirPath - root directory path. * @param {string} filePath - target test code file path. * @returns {Object} return document info that is traversed. * @property {DocObject[]} results - this is contained test code. * @property {AST} ast - this is AST of test code. * @private */ _traverse(interfaces, inDirPath, filePath) { let ast; try { ast = ESParser.parse(filePath); } catch (e) { InvalidCodeLogger.showFile(filePath, e); return null; } const pathResolver = new PathResolver(inDirPath, filePath); const factory = new TestDocFactory(interfaces, ast, pathResolver); ASTUtil.traverse(ast, (node, parent)=>{ try { factory.push(node, parent); } catch (e) { InvalidCodeLogger.show(filePath, node); throw e; } }); return {results: factory.results, ast: ast}; } } module.exports = new Plugin(); ================================================ FILE: esdoc-integrate-test-plugin/src/TestDoc.js ================================================ // hack: depends on esdoc internal class const AbstractDoc = require('esdoc/out/src/Doc/AbstractDoc').default; const ParamParser = require('esdoc/out/src/Parser/ParamParser').default; /** * Doc Class from test code file. */ class TestDoc extends AbstractDoc { /** * apply own tag. * @private */ _apply() { super._apply(); this._$testTarget(); Reflect.deleteProperty(this._value, 'export'); Reflect.deleteProperty(this._value, 'importPath'); Reflect.deleteProperty(this._value, 'importStyle'); } /** use name property of self node. */ _$kind() { super._$kind(); this._value.kind = 'test'; } /** set name and testId from special esdoc property. */ _$name() { super._$name(); this._value.name = this._node._esdocTestName; this._value.testId = this._node._esdocTestId; } /** set memberof to use parent test nod and file path. */ _$memberof() { super._$memberof(); const chain = []; let parent = this._node.parent; while (parent) { if (parent._esdocTestName) chain.push(parent._esdocTestName); parent = parent.parent; } const filePath = this._pathResolver.filePath; if (chain.length) { this._value.memberof = `${filePath}~${chain.reverse().join('.')}`; this._value.testDepth = chain.length; } else { this._value.memberof = filePath; this._value.testDepth = 0; } } /** set describe by using test node arguments. */ _$desc() { super._$desc(); if (this._value.description) return; this._value.description = this._node.arguments[0].value; } /** for @testTarget. */ _$testTarget() { const values = this._findAllTagValues(['@test', '@testTarget']); if (!values) return; this._value.testTargets = []; for (const value of values) { const {typeText} = ParamParser.parseParamValue(value, true, false, false); this._value.testTargets.push(typeText); } } _$test() { // alias of testTarget } } module.exports = TestDoc; ================================================ FILE: esdoc-integrate-test-plugin/src/TestDocFactory.js ================================================ const assert = require('assert'); const TestDoc = require('./TestDoc'); const TestFileDoc = require('./TestFileDoc'); // hack: depends on ESDoc internal class const CommentParser = require('esdoc/out/src/Parser/CommentParser').default; const already = Symbol('already'); /** * Test doc factory class. * @example * let factory = new TestDocFactory('mocha', ast, pathResolver); * factory.push(node, parentNode); * let results = factory.results; */ class TestDocFactory { /** * get unique id. * @returns {number} unique id. * @private */ static _getUniqueId() { if (!this._sequence) /** @type {number} */ this._sequence = 0; return this._sequence++; } /** * @type {DocObject[]} */ get results() { return [...this._results]; } /** * create instance. * @param {string[]} interfaces - test interface names. * @param {AST} ast - AST of test code. * @param {PathResolver} pathResolver - path resolver of test code. */ constructor(interfaces, ast, pathResolver) { /** @type {string} */ this._interfaces = interfaces; /** @type {AST} */ this._ast = ast; /** @type {PathResolver} */ this._pathResolver = pathResolver; /** @type {DocObject[]} */ this._results = []; // file doc const doc = new TestFileDoc(ast, ast, pathResolver, []); this._results.push(doc.value); } /** * push node, and factory process the node. * @param {ASTNode} node - target node. * @param {ASTNode} parentNode - parent node of target node. */ push(node, parentNode) { if (node[already]) return; node[already] = true; Reflect.defineProperty(node, 'parent', {value: parentNode}); this._push(node); } /** * push node as mocha test code. * @param {ASTNode} node - target node. * @private */ _push(node) { if (node.type !== 'ExpressionStatement') return; const expression = node.expression; if (expression.type !== 'CallExpression') return; if (!this._interfaces.includes(expression.callee.name)) return; expression[already] = true; Reflect.defineProperty(expression, 'parent', {value: node}); let tags = []; if (node.leadingComments && node.leadingComments.length) { const comment = node.leadingComments[node.leadingComments.length - 1]; tags = CommentParser.parse(comment); } const uniqueId = this.constructor._getUniqueId(); expression._esdocTestId = uniqueId; expression._esdocTestName = expression.callee.name + uniqueId; const testDoc = new TestDoc(this._ast, expression, this._pathResolver, tags); this._results.push(testDoc.value); } } module.exports = TestDocFactory; ================================================ FILE: esdoc-integrate-test-plugin/src/TestFileDoc.js ================================================ // hack: depends on esdoc internal class const FileDoc = require('esdoc/out/src/Doc/FileDoc').default; /** * Doc class for test code file. */ class TestFileDoc extends FileDoc { /** set ``testFile`` to kind. */ _$kind() { this._value.kind = 'testFile'; } } module.exports = TestFileDoc; ================================================ FILE: esdoc-integrate-test-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ { "name": "./src/Plugin.js", "option": { "source": "./test/test", "excludes": ["\\.test\\.js$"] } } ] } ================================================ FILE: esdoc-integrate-test-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-integrate-test-plugin/test/src/Dummy.js ================================================ export default class Dummy { } ================================================ FILE: esdoc-integrate-test-plugin/test/test/Test.js ================================================ /** * @test {TestTarget1} */ describe('describe/', ()=>{ /** * @test {TestTarget2} */ it('describe/it', ()=>{}); /** * @test {TestTarget3} */ describe('describe/describe/', ()=>{ /** * @test {TestTarget4} */ it('describe/describe/it', ()=>{}); }); /** * @test {TestTarget5} */ context('describe/context/', ()=>{ /** * @test {TestTarget6} */ it('describe/context/it', ()=>{}); }); }); /** * @test {TestTarget7} */ suite('suite/', ()=>{ /** * @test {TestTarget8} */ test('suite/test', ()=>{}); /** * @test {TestTarget9} */ suite('suite/suite/', ()=>{ /** * @test {TestTarget10} */ test('suite/suite/test', ()=>{}); }) }); ================================================ FILE: esdoc-integrate-test-plugin/test/test/Test.test.js ================================================ const assert = require('assert'); const {find} = require('../util'); describe('test/Test.js:', ()=>{ it('has describe/', ()=>{ const doc = find('longname', 'test/Test.js~describe0'); assert.equal(doc.testId, 0); assert.equal(doc.testDepth, 0); assert.equal(doc.description, 'describe/'); assert.deepEqual(doc.testTargets, ['TestTarget1']); }); it('has describe/it', ()=>{ const doc = find('longname', 'test/Test.js~describe0.it1'); assert.equal(doc.testId, 1); assert.equal(doc.testDepth, 1); assert.equal(doc.description, 'describe/it'); assert.deepEqual(doc.testTargets, ['TestTarget2']); }); it('has describe/describe', ()=>{ const doc = find('longname', 'test/Test.js~describe0.describe2'); assert.equal(doc.testId, 2); assert.equal(doc.testDepth, 1); assert.equal(doc.description, 'describe/describe/'); assert.deepEqual(doc.testTargets, ['TestTarget3']); }); it('has describe/describe/it', ()=>{ const doc = find('longname', 'test/Test.js~describe0.describe2.it3'); assert.equal(doc.testId, 3); assert.equal(doc.testDepth, 2); assert.equal(doc.description, 'describe/describe/it'); assert.deepEqual(doc.testTargets, ['TestTarget4']); }); it('has describe/context/it', ()=>{ const doc = find('longname', 'test/Test.js~describe0.context4.it5'); assert.equal(doc.testId, 5); assert.equal(doc.testDepth, 2); assert.equal(doc.description, 'describe/context/it'); assert.deepEqual(doc.testTargets, ['TestTarget6']); }); it('has suite/', ()=>{ const doc = find('longname', 'test/Test.js~suite6'); assert.equal(doc.testId, 6); assert.equal(doc.testDepth, 0); assert.equal(doc.description, 'suite/'); assert.deepEqual(doc.testTargets, ['TestTarget7']); }); it('has suite/test', ()=>{ const doc = find('longname', 'test/Test.js~suite6.test7'); assert.equal(doc.testId, 7); assert.equal(doc.testDepth, 1); assert.equal(doc.description, 'suite/test'); assert.deepEqual(doc.testTargets, ['TestTarget8']); }); it('has suite/suite/', ()=>{ const doc = find('longname', 'test/Test.js~suite6.suite8'); assert.equal(doc.testId, 8); assert.equal(doc.testDepth, 1); assert.equal(doc.description, 'suite/suite/'); assert.deepEqual(doc.testTargets, ['TestTarget9']); }); it('has suite/suite/test', ()=>{ const doc = find('longname', 'test/Test.js~suite6.suite8.test9'); assert.equal(doc.testId, 9); assert.equal(doc.testDepth, 2); assert.equal(doc.description, 'suite/suite/test'); assert.deepEqual(doc.testTargets, ['TestTarget10']); }); }); ================================================ FILE: esdoc-integrate-test-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-jsx-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-jsx-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-jsx-plugin/README.md ================================================ # ESDoc JSX Plugin ## Install ```bash npm install esdoc-jsx-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-jsx-plugin", "option": {"enable": true}} ] } ``` - `enable` is default `true` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-jsx-plugin/package.json ================================================ { "name": "esdoc-jsx-plugin", "version": "1.0.0", "description": "A JSX plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "jsx", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-jsx-plugin/src/Plugin.js ================================================ class Plugin { onHandleCodeParser(ev) { const option = ev.data.option || {}; const plugins = ev.data.parserOption.plugins; if (!('enable' in option)) option.enable = true; if (option.enable) plugins.push('jsx'); } } module.exports = new Plugin(); ================================================ FILE: esdoc-jsx-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-jsx-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-jsx-plugin/test/src/MyClass.js ================================================ export default class MyClass { method(){ return
hello
; } } ================================================ FILE: esdoc-jsx-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const {find} = require('../util'); describe('test/MyClass.js:', ()=> { it('can parse jsx', ()=>{ const doc = find('longname', 'src/MyClass.js~MyClass#method'); assert(doc); }); }); ================================================ FILE: esdoc-jsx-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-lint-plugin/CHANGELOG.md ================================================ # Changelog ## Next - **Fix** - Crash if export with variable (e.g. `/** foo */ export const foo = (p)=>{}`) ([#48](https://github.com/esdoc/esdoc-plugins/pull/48)). Thanks [@paztis](https://github.com/paztis) ## 1.0.1 (2017-09-09) - **Fix** - Disabling lint bug ([#4](https://github.com/esdoc/esdoc-plugins/pull/4), [#19](https://github.com/esdoc/esdoc-plugins/pull/19)) Thanks [@pzuraq](https://github.com/pzuraq) [@moshest](https://github.com/moshest) ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-lint-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-lint-plugin/README.md ================================================ # ESDoc Lint Plugin ## Install ```bash npm install esdoc-lint-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-lint-plugin", "option": {"enable": true}} ] } ``` `enable` is default `true` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-lint-plugin/package.json ================================================ { "name": "esdoc-lint-plugin", "version": "1.0.1", "description": "A lint plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "lint", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-lint-plugin/src/Plugin.js ================================================ const path = require('path'); const fs = require('fs'); // hack: using a internal code of esdoc. const ASTNodeContainer = require('esdoc/out/src/Util/ASTNodeContainer.js').default; /** * Lint Output Builder class. */ class Plugin { onHandleDocs(ev) { this._docs = ev.data.docs; this._option = ev.data.option || {}; this._results = null; if (!('enable' in this._option)) this._option.enable = true; } onPublish(ev) { if (!this._option.enable) return; const tmpResults = []; const docs = this._docs.filter(v => ['method', 'function'].includes(v.kind)); for (const doc of docs) { if (doc.undocument) continue; const node = ASTNodeContainer.getNode(doc.__docId__); const codeParams = this._getParamsFromNode(node); const docParams = this._getParamsFromDoc(doc); if (this._match(codeParams, docParams)) continue; tmpResults.push({node, doc, codeParams, docParams}); } const results = this._formatResult(tmpResults); ev.data.writeFile('lint.json', JSON.stringify(results, null, 2)); this._results = results; } onComplete() { if (!this._option.enable) return; this._showResult(); } /** * get variable names of method argument. * @param {ASTNode} node - target node. * @returns {string[]} variable names. * @private */ _getParamsFromNode(node) { let params; switch (node.type) { case 'FunctionExpression': case 'FunctionDeclaration': params = node.params || []; break; case 'ClassMethod': params = node.params || []; break; case 'ArrowFunctionExpression': params = node.params || []; break; default: throw new Error(`unknown node type. type = ${node.type}`); } const result = []; for (const param of params) { switch (param.type) { case 'Identifier': result.push(param.name); break; case 'AssignmentPattern': if (param.left.type === 'Identifier') { result.push(param.left.name); } else if (param.left.type === 'ObjectPattern') { result.push('*'); } break; case 'RestElement': result.push(param.argument.name); break; case 'ObjectPattern': result.push('*'); break; case 'ArrayPattern': result.push('*'); break; default: throw new Error(`unknown param type: ${param.type}`); } } return result; } /** * get variable names of method argument. * @param {DocObject} doc - target doc object. * @returns {string[]} variable names. * @private */ _getParamsFromDoc(doc) { const params = doc.params || []; return params.map(v => v.name).filter(v => !v.includes('.')).filter(v => !v.includes('[')); } _match(codeParams, docParams) { if (codeParams.length !== docParams.length) return false; for (let i = 0; i < codeParams.length; i++) { if (codeParams[i] === '*') { // nothing } else if (codeParams[i] !== docParams[i]) { return false; } } return true; } /** * show invalid lint code. * @param {Object[]} tmpResults - target results. * @param {DocObject} tmpResults[].doc * @param {ASTNode} tmpResults[].node * @param {string[]} tmpResults[].codeParams * @param {string[]} tmpResults[].docParams * @private */ _formatResult(tmpResults) { const results = []; for (const result of tmpResults) { const doc = result.doc; const node = result.node; const filePath = doc.longname.split('~')[0]; const name = doc.longname.split('~')[1]; let startLineNumber; if (node.leadingComments) { const comment = node.leadingComments[node.leadingComments.length - 1]; startLineNumber = comment.loc.start.line; } else if (node.parent.leadingComments) { const comment = node.parent.leadingComments[node.parent.leadingComments.length - 1]; startLineNumber = comment.loc.start.line; } else { // Missing leadingComments fallback: will report the node start line instead of the comment one startLineNumber = node.loc.start.line; } const endLineNumber = node.loc.start.line; const fileDoc = this._docs.find(tag => tag.kind === 'file' && tag.name === filePath); const lines = fileDoc.content.split('\n'); const targetLines = []; for (let i = startLineNumber - 1; i < endLineNumber; i++) { targetLines.push({lineNumber: i, line: lines[i]}); } results.push({ name: name, filePath: filePath, lines: targetLines, codeParams: result.codeParams, docParams: result.docParams, }); } return results; } _showResult() { if (!this._option.enable) return; for (const result of this._results) { console.log(`warning: signature mismatch: ${result.name} ${result.filePath}#${result.lines[0].lineNumber}`); for (const line of result.lines) { console.log(`${line.lineNumber}| ${line.line}`); } console.log(''); } } } module.exports = new Plugin(); ================================================ FILE: esdoc-lint-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-lint-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-lint-plugin/test/src/MyArrowFunction.js ================================================ /** * this is arrowFunction1 with a good import * @param p1 * @param p2 */ export const arrowFunction1 = (p1, p2) => {}; /** * this is arrowFunction2 with a bad import * necessary to tests the missing leadingComments * @param p1 */ export const arrowFunction2 = (p1, p2) => {}; ================================================ FILE: esdoc-lint-plugin/test/src/MyClass.js ================================================ /** * this is MyClass. */ export default class MyClass { /** * this is method1. * @param {number} x */ method1(p){} /** * this is method2. * @param {number} x1 * @param {number[]} x2 * @param {Object} x3 */ method2(p1 = 10, p2 = [1,2,3], p3 = {foo:1, bar: 2}){} /** * this is method3. * @param {number[]} x */ method3(...p){} /** * this is method4. * @param {Object} o */ method4({p1, p2}, {p3, p4}){} } ================================================ FILE: esdoc-lint-plugin/test/src/results.test.js ================================================ const assert = require('assert'); const fs = require('fs'); const path = require('path'); describe('test/results.js:', ()=>{ const tmp = fs.readFileSync('./test/out/lint.json').toString(); const lintResults = JSON.parse(tmp); it('has 5 lint errors.', ()=>{ assert.equal(lintResults.length, 5); assert.equal(lintResults[0].name, 'arrowFunction2'); assert.equal(lintResults[1].name, 'MyClass#method1'); assert.equal(lintResults[2].name, 'MyClass#method2'); assert.equal(lintResults[3].name, 'MyClass#method3'); assert.equal(lintResults[4].name, 'MyClass#method4'); }); }); ================================================ FILE: esdoc-publish-html-plugin/.babelrc ================================================ { "plugins": [ "transform-es2015-modules-commonjs" ] } ================================================ FILE: esdoc-publish-html-plugin/CHANGELOG.md ================================================ # Changelog ## Next - **Fix** - Crash if object key includes a comma ([#49](https://github.com/esdoc/esdoc-plugins/pull/49)). Thanks [@josephschmitt](https://github.com/josephschmitt) ## 1.1.1 (2018-04-29) - **Chore** - Update `marked` ## 1.1.0 (2017-09-10) - **Feat** - Support custom template ([#12](https://github.com/esdoc/esdoc-plugins/pull/12)) Thanks [@andersevenrud](https://github.com/andersevenrud) ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-publish-html-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-publish-html-plugin/README.md ================================================ # ESDoc Publish HTML Plugin ## Install ```bash npm install esdoc-publish-html-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-publish-html-plugin"} ] } ``` ## Custom Template To use a custom template (ex `my-template` placed in the working directory): ```json {"name": "esdoc-publish-html-plugin", "option": {"template": "my-template"}} ``` We recommend that you base on [the original template](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-publish-html-plugin/src/Builder/template). ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-publish-html-plugin/package.json ================================================ { "name": "esdoc-publish-html-plugin", "version": "1.1.1", "description": "A publish HTML plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "cheerio": "0.22.0", "fs-extra": "1.0.0", "escape-html": "1.0.3", "babel-generator": "6.11.4", "ice-cap": "0.0.4", "marked": "0.3.19", "taffydb": "2.7.2" }, "devDependencies": { "babel-cli": "6.11.4", "babel-plugin-transform-es2015-modules-commonjs": "6.11.5", "babel-register": "6.11.6", "esdoc": "^1.1.0", "esdoc-accessor-plugin": "^1.0.0", "esdoc-brand-plugin": "^1.0.0", "esdoc-coverage-plugin": "^1.1.0", "esdoc-ecmascript-proposal-plugin": "^1.0.0", "esdoc-external-ecmascript-plugin": "^1.0.0", "esdoc-integrate-manual-plugin": "^1.0.0", "esdoc-integrate-test-plugin": "^1.0.0", "esdoc-type-inference-plugin": "^1.0.1", "esdoc-undocumented-identifier-plugin": "^1.0.0", "esdoc-unexported-identifier-plugin": "^1.0.0", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "build": "rm -rf ./out/src && babel --out-dir out/src --ignore 'Builder/template' src && cp -a src/Builder/template out/src/Builder/", "test": "rm -rf ./test/fixture/out && mocha -t 10000 --require ./node_modules/babel-register --require ./test/src/init.js --recursive ./test/src -R spec" }, "keywords": [ "esdoc", "publish", "html", "plugin" ], "files": [ "out/src", "README.md" ], "main": "out/src/Plugin.js" } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/ClassDocBuilder.js ================================================ import IceCap from 'ice-cap'; import DocBuilder from './DocBuilder.js'; import {parseExample} from './util.js'; /** * Class Output Builder class. */ export default class ClassDocBuilder extends DocBuilder { exec(writeFile) { const ice = this._buildLayoutDoc(); ice.autoDrop = false; const docs = this._find({kind: ['class']}); for (const doc of docs) { const fileName = this._getOutputFileName(doc); const baseUrl = this._getBaseUrl(fileName); const title = this._getTitle(doc); ice.load('content', this._buildClassDoc(doc), IceCap.MODE_WRITE); ice.attr('baseUrl', 'href', baseUrl, IceCap.MODE_WRITE); ice.text('title', title, IceCap.MODE_WRITE); writeFile(fileName, ice.html); } } /** * build class output. * @param {DocObject} doc - class doc object. * @returns {IceCap} built output. * @private */ _buildClassDoc(doc) { const expressionExtends = this._buildExpressionExtendsHTML(doc); const mixinClasses = this._buildMixinClassesHTML(doc); const extendsChain = this._buildExtendsChainHTML(doc); const directSubclass = this._buildDirectSubclassHTML(doc); const indirectSubclass = this._buildIndirectSubclassHTML(doc); const instanceDocs = this._find({kind: 'variable'}).filter((v)=> { return v.type && v.type.types.includes(doc.longname); }); const ice = new IceCap(this._readTemplate('class.html')); // header if (doc.export && doc.importPath && doc.importStyle) { const link = this._buildFileDocLinkHTML(doc, doc.importPath); ice.into('importPath', `import ${doc.importStyle} from '${link}'`, (code, ice)=>{ ice.load('importPathCode', code); }); } ice.text('access', doc.access); ice.text('kind', doc.interface ? 'interface' : 'class'); ice.load('source', this._buildFileDocLinkHTML(doc, 'source'), 'append'); ice.text('since', doc.since, 'append'); ice.text('version', doc.version, 'append'); ice.load('variation', this._buildVariationHTML(doc), 'append'); ice.into('expressionExtends', expressionExtends, (expressionExtends, ice)=> ice.load('expressionExtendsCode', expressionExtends)); ice.load('mixinExtends', mixinClasses, 'append'); ice.load('extendsChain', extendsChain, 'append'); ice.load('directSubclass', directSubclass, 'append'); ice.load('indirectSubclass', indirectSubclass, 'append'); ice.load('implements', this._buildDocsLinkHTML(doc.implements, null, false, ', '), 'append'); ice.load('indirectImplements', this._buildDocsLinkHTML(doc._custom_indirect_implements, null, false, ', '), 'append'); ice.load('directImplemented', this._buildDocsLinkHTML(doc._custom_direct_implemented, null, false, ', '), 'append'); ice.load('indirectImplemented', this._buildDocsLinkHTML(doc._custom_indirect_implemented, null, false, ', '), 'append'); // self ice.text('name', doc.name); ice.load('description', doc.description); ice.load('deprecated', this._buildDeprecatedHTML(doc)); ice.load('experimental', this._buildExperimentalHTML(doc)); ice.load('see', this._buildDocsLinkHTML(doc.see), 'append'); ice.load('todo', this._buildDocsLinkHTML(doc.todo), 'append'); ice.load('decorator', this._buildDecoratorHTML(doc), 'append'); ice.into('instanceDocs', instanceDocs, (instanceDocs, ice)=>{ ice.loop('instanceDoc', instanceDocs, (i, instanceDoc, ice)=>{ ice.load('instanceDoc', this._buildDocLinkHTML(instanceDoc.longname)); }); }); ice.into('exampleDocs', doc.examples, (examples, ice)=>{ ice.loop('exampleDoc', examples, (i, example, ice)=>{ const parsed = parseExample(example); ice.text('exampleCode', parsed.body); ice.text('exampleCaption', parsed.caption); }); }); ice.into('tests', doc._custom_tests, (tests, ice)=>{ ice.loop('test', tests, (i, test, ice)=>{ const testDoc = this._find({longname: test})[0]; ice.load('test', this._buildFileDocLinkHTML(testDoc, testDoc.testFullDescription)); }); }); // summary ice.load('staticMemberSummary', this._buildSummaryHTML(doc, 'member', 'Members', true)); ice.load('staticMethodSummary', this._buildSummaryHTML(doc, 'method', 'Methods', true)); ice.load('constructorSummary', this._buildSummaryHTML(doc, 'constructor', 'Constructor', false)); ice.load('memberSummary', this._buildSummaryHTML(doc, 'member', 'Members', false)); ice.load('methodSummary', this._buildSummaryHTML(doc, 'method', 'Methods', false)); ice.load('inheritedSummary', this._buildInheritedSummaryHTML(doc), 'append'); // detail ice.load('staticMemberDetails', this._buildDetailHTML(doc, 'member', 'Members', true)); ice.load('staticMethodDetails', this._buildDetailHTML(doc, 'method', 'Methods', true)); ice.load('constructorDetails', this._buildDetailHTML(doc, 'constructor', 'Constructors', false)); ice.load('memberDetails', this._buildDetailHTML(doc, 'member', 'Members', false)); ice.load('methodDetails', this._buildDetailHTML(doc, 'method', 'Methods', false)); return ice; } /** * build variation of doc. * @param {DocObject} doc - target doc object. * @returns {string} variation links html. * @private * @experimental */ _buildVariationHTML(doc) { const variationDocs = this._find({memberof: doc.memberof, name: doc.name}); const html = []; for (const variationDoc of variationDocs) { if (variationDoc.variation === doc.variation) continue; html.push(this._buildDocLinkHTML(variationDoc.longname, `(${variationDoc.variation || 1})`)); } return html.join(', '); } /** * build mixin extends html. * @param {DocObject} doc - target class doc. * @return {string} mixin extends html. */ _buildMixinClassesHTML(doc) { if (!doc.extends) return ''; if (doc.extends.length <= 1) return ''; const links = []; for (const longname of doc.extends) { links.push(this._buildDocLinkHTML(longname)); } return `
${links.join(', ')}
`; } /** * build expression extends html. * @param {DocObject} doc - target class doc. * @return {string} expression extends html. */ _buildExpressionExtendsHTML(doc) { if (!doc.expressionExtends) return ''; const html = doc.expressionExtends.replace(/[A-Z_$][a-zA-Z0-9_$]*/g, (v)=>{ return this._buildDocLinkHTML(v); }); return `class ${doc.name} extends ${html}`; } /** * build class ancestor extends chain. * @param {DocObject} doc - target class doc. * @returns {string} extends chain links html. * @private */ _buildExtendsChainHTML(doc) { if (!doc._custom_extends_chains) return ''; if (doc.extends.length > 1) return ''; const links = []; for (const longname of doc._custom_extends_chains) { links.push(this._buildDocLinkHTML(longname)); } links.push(doc.name); return `
${links.join(' → ')}
`; } /** * build in-direct subclass list. * @param {DocObject} doc - target class doc. * @returns {string} html of in-direct subclass links. * @private */ _buildIndirectSubclassHTML(doc) { if (!doc._custom_indirect_subclasses) return ''; const links = []; for (const longname of doc._custom_indirect_subclasses) { links.push(this._buildDocLinkHTML(longname)); } return `
${links.join(', ')}
`; } /** * build direct subclass list. * @param {DocObject} doc - target class doc. * @returns {string} html of direct subclass links. * @private */ _buildDirectSubclassHTML(doc) { if (!doc._custom_direct_subclasses) return ''; const links = []; for (const longname of doc._custom_direct_subclasses) { links.push(this._buildDocLinkHTML(longname)); } return `
${links.join(', ')}
`; } /** * build inherited method/member summary. * @param {DocObject} doc - target class doc. * @returns {string} html of inherited method/member from ancestor classes. * @private */ _buildInheritedSummaryHTML(doc) { if (['class', 'interface'].indexOf(doc.kind) === -1) return ''; const longnames = [ ...doc._custom_extends_chains || [] // ...doc.implements || [], // ...doc._custom_indirect_implements || [], ]; const html = []; for (const longname of longnames) { const superDoc = this._find({longname})[0]; if (!superDoc) continue; const targetDocs = this._find({memberof: longname, kind: ['member', 'method', 'get', 'set']}); targetDocs.sort((a, b)=>{ if (a.static !== b.static) return -(a.static - b.static); let order = {get: 0, set: 0, member: 1, method: 2}; if (order[a.kind] !== order[b.kind]) { return order[a.kind] - order[b.kind]; } order = {public: 0, protected: 1, private: 2}; if (a.access !== b.access) return order[a.access] - order[b.access]; if (a.name !== b.name) return a.name < b.name ? -1 : 1; order = {get: 0, set: 1, member: 2}; return order[a.kind] - order[b.kind]; }); const title = ` From ${superDoc.kind} ${this._buildDocLinkHTML(longname, superDoc.name)}`; const result = this._buildSummaryDoc(targetDocs, '----------'); if (result) { result.load('title', title, IceCap.MODE_WRITE); html.push(result.html); } } return html.join('\n'); } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/DocBuilder.js ================================================ /* eslint-disable max-lines */ import fs from 'fs'; import path from 'path'; import escape from 'escape-html'; import IceCap from 'ice-cap'; import {shorten, parseExample, escapeURLHash} from './util.js'; import DocResolver from './DocResolver.js'; import NPMUtil from 'esdoc/out/src/Util/NPMUtil.js'; /** * Builder base class. */ export default class DocBuilder { /** * create instance. * @param {String} template - template absolute path * @param {Taffy} data - doc object database. */ constructor(template, data, tags) { this._template = template; this._data = data; this._tags = tags; new DocResolver(this).resolve(); } /* eslint-disable no-unused-vars */ /** * execute building output. * @abstract * @param {function(html: string, filePath: string)} writeFile - is called each manual. * @param {function(src: string, dest: string)} copyDir - is called asset. */ exec(writeFile, copyDir) { } /** * find doc object. * @param {...Object} cond - find condition. * @returns {DocObject[]} found doc objects. * @private */ _find(...cond) { return this._orderedFind(null, ...cond); } /** * find all identifiers with kind grouping. * @returns {{class: DocObject[], interface: DocObject[], function: DocObject[], variable: DocObject[], typedef: DocObject[], external: DocObject[]}} found doc objects. * @private */ _findAllIdentifiersKindGrouping() { const result = { class: this._find([{kind: 'class', interface: false}]), interface: this._find([{kind: 'class', interface: true}]), function: this._find([{kind: 'function'}]), variable: this._find([{kind: 'variable'}]), typedef: this._find([{kind: 'typedef'}]), external: this._find([{kind: 'external'}]).filter(v => !v.builtinExternal) }; return result; } /** * fuzzy find doc object by name. * - equal with longname * - equal with name * - include in longname * - include in ancestor * * @param {string} name - target identifier name. * @param {string} [kind] - target kind. * @returns {DocObject[]} found doc objects. * @private */ _findByName(name, kind = null) { let docs; if (kind) { docs = this._orderedFind(null, {longname: name, kind: kind}); } else { docs = this._orderedFind(null, {longname: name}); } if (docs.length) return docs; if (kind) { docs = this._orderedFind(null, {name: name, kind: kind}); } else { docs = this._orderedFind(null, {name: name}); } if (docs.length) return docs; const regexp = new RegExp(`[~]${name.replace('*', '\\*')}$`); // if name is `*`, need to escape. if (kind) { docs = this._orderedFind(null, {longname: {regex: regexp}, kind: kind}); } else { docs = this._orderedFind(null, {longname: {regex: regexp}}); } if (docs.length) return docs; // inherited method? const matched = name.match(/(.*)[.#](.*)$/); // instance method(Foo#bar) or static method(Foo.baz) if (matched) { const parent = matched[1]; const childName = matched[2]; const parentDoc = this._findByName(parent, 'class')[0]; if (parentDoc && parentDoc._custom_extends_chains) { for (const superLongname of parentDoc._custom_extends_chains) { const docs = this._find({memberof: superLongname, name: childName}); if (docs.length) return docs; } } } return []; } /** * find doc objects that is ordered. * @param {string} order - doc objects order(``column asec`` or ``column desc``). * @param {...Object} cond - condition objects * @returns {DocObject[]} found doc objects. * @private */ _orderedFind(order, ...cond) { const data = this._data(...cond); if (order) { return data.order(`${order}, name asec`).map(v => v); } else { return data.order('name asec').map(v => v); } } /** * read html template. * @param {string} fileName - template file name. * @return {string} html of template. * @protected */ _readTemplate(fileName) { const filePath = path.resolve(this._template, `./${fileName}`); return fs.readFileSync(filePath, {encoding: 'utf-8'}); } /** * build common layout output. * @return {IceCap} layout output. * @private */ _buildLayoutDoc() { const ice = new IceCap(this._readTemplate('layout.html'), {autoClose: false}); const packageObj = NPMUtil.findPackage(); if (packageObj) { ice.text('esdocVersion', `(${packageObj.version})`); } else { ice.drop('esdocVersion'); } const existTest = this._tags.find(tag => tag.kind.indexOf('test') === 0); ice.drop('testLink', !existTest); const existManual = this._tags.find(tag => tag.kind.indexOf('manual') === 0); ice.drop('manualHeaderLink', !existManual); const manualIndex = this._tags.find(tag => tag.kind === 'manualIndex'); if (manualIndex && manualIndex.globalIndex) { ice.drop('manualHeaderLink'); } ice.load('nav', this._buildNavDoc()); return ice; } /** * build common navigation output. * @return {IceCap} navigation output. * @private */ _buildNavDoc() { const html = this._readTemplate('nav.html'); const ice = new IceCap(html); const kinds = ['class', 'function', 'variable', 'typedef', 'external']; const allDocs = this._find({kind: kinds}).filter(v => !v.builtinExternal); const kindOrder = {class: 0, interface: 1, function: 2, variable: 3, typedef: 4, external: 5}; // see: IdentifiersDocBuilder#_buildIdentifierDoc allDocs.sort((a, b)=>{ const filePathA = a.longname.split('~')[0]; const filePathB = b.longname.split('~')[0]; const dirPathA = path.dirname(filePathA); const dirPathB = path.dirname(filePathB); const kindA = a.interface ? 'interface' : a.kind; const kindB = b.interface ? 'interface' : b.kind; if (dirPathA === dirPathB) { if (kindA === kindB) { return a.longname > b.longname ? 1 : -1; } else { return kindOrder[kindA] > kindOrder[kindB] ? 1 : -1; } } else { return dirPathA > dirPathB ? 1 : -1; } }); let lastDirPath = '.'; ice.loop('doc', allDocs, (i, doc, ice)=>{ const filePath = doc.longname.split('~')[0].replace(/^.*?[/]/, ''); const dirPath = path.dirname(filePath); const kind = doc.interface ? 'interface' : doc.kind; const kindText = kind.charAt(0).toUpperCase(); const kindClass = `kind-${kind}`; ice.load('name', this._buildDocLinkHTML(doc.longname)); ice.load('kind', kindText); ice.attr('kind', 'class', kindClass); ice.text('dirPath', dirPath); ice.attr('dirPath', 'href', `identifiers.html#${escapeURLHash(dirPath)}`); ice.drop('dirPath', lastDirPath === dirPath); lastDirPath = dirPath; }); return ice; } /** * find doc object for each access. * @param {DocObject} doc - parent doc object. * @param {string} kind - kind property condition. * @param {boolean} isStatic - static property condition * @returns {Array[]} found doc objects. * @property {Array[]} 0 - ['Public', DocObject[]] * @property {Array[]} 1 - ['Protected', DocObject[]] * @property {Array[]} 2 - ['Private', DocObject[]] * @private */ _findAccessDocs(doc, kind, isStatic = true) { const cond = {kind: kind, static: isStatic}; if (doc) cond.memberof = doc.longname; /* eslint-disable default-case */ switch (kind) { case 'class': cond.interface = false; break; case 'interface': cond.kind = 'class'; cond.interface = true; break; case 'member': cond.kind = ['member', 'get', 'set']; break; } const publicDocs = this._find(cond, {access: 'public'}).filter(v => !v.builtinExternal); const protectedDocs = this._find(cond, {access: 'protected'}).filter(v => !v.builtinExternal); const privateDocs = this._find(cond, {access: 'private'}).filter(v => !v.builtinExternal); const accessDocs = [['Public', publicDocs], ['Protected', protectedDocs], ['Private', privateDocs]]; return accessDocs; } /** * build summary output html by parent doc. * @param {DocObject} doc - parent doc object. * @param {string} kind - target kind property. * @param {string} title - summary title. * @param {boolean} [isStatic=true] - target static property. * @returns {string} html of summary. * @private */ _buildSummaryHTML(doc, kind, title, isStatic = true) { const accessDocs = this._findAccessDocs(doc, kind, isStatic); let html = ''; for (const accessDoc of accessDocs) { const docs = accessDoc[1]; if (!docs.length) continue; let prefix = ''; if (docs[0].static) prefix = 'Static '; const _title = `${prefix}${accessDoc[0]} ${title}`; const result = this._buildSummaryDoc(docs, _title); if (result) { html += result.html; } } return html; } /** * build summary output html by docs. * @param {DocObject[]} docs - target docs. * @param {string} title - summary title. * @param {boolean} innerLink - if true, link in summary is inner link. * @param {boolean} kindIcon - use kind icon. * @return {IceCap} summary output. * @protected */ _buildSummaryDoc(docs, title, innerLink = false, kindIcon = false) { if (docs.length === 0) return null; const ice = new IceCap(this._readTemplate('summary.html')); ice.text('title', title); ice.loop('target', docs, (i, doc, ice)=>{ ice.text('generator', doc.generator ? '*' : ''); ice.text('async', doc.async ? 'async' : ''); ice.load('name', this._buildDocLinkHTML(doc.longname, null, innerLink, doc.kind)); ice.load('signature', this._buildSignatureHTML(doc)); ice.load('description', shorten(doc, true)); ice.text('abstract', doc.abstract ? 'abstract' : ''); ice.text('access', doc.access); if (['get', 'set'].includes(doc.kind)) { ice.text('kind', doc.kind); } else { ice.drop('kind'); } if (['member', 'method', 'get', 'set'].includes(doc.kind)) { ice.text('static', doc.static ? 'static' : ''); } else { ice.drop('static'); } if (kindIcon) { const kind = doc.interface ? 'interface' : doc.kind; ice.text('kind-icon', kind.charAt(0).toUpperCase()); ice.attr('kind-icon', 'class', `kind-${kind}`, IceCap.MODE_APPEND); } else { ice.drop('kind-icon'); } ice.text('since', doc.since); ice.load('deprecated', this._buildDeprecatedHTML(doc)); ice.load('experimental', this._buildExperimentalHTML(doc)); ice.text('version', doc.version); }); return ice; } /** * build detail output html by parent doc. * @param {DocObject} doc - parent doc object. * @param {string} kind - target kind property. * @param {string} title - detail title. * @param {boolean} [isStatic=true] - target static property. * @returns {string} html of detail. * @private */ _buildDetailHTML(doc, kind, title, isStatic = true) { const accessDocs = this._findAccessDocs(doc, kind, isStatic); let html = ''; for (const accessDoc of accessDocs) { const docs = accessDoc[1]; if (!docs.length) continue; let prefix = ''; if (docs[0].static) prefix = 'Static '; const _title = `${prefix}${accessDoc[0]} ${title}`; const result = this._buildDetailDocs(docs, _title); if (result) html += result.html; } return html; } /* eslint-disable max-statements */ /** * build detail output html by docs. * @param {DocObject[]} docs - target docs. * @param {string} title - detail title. * @return {IceCap} detail output. * @private */ _buildDetailDocs(docs, title) { const ice = new IceCap(this._readTemplate('details.html')); ice.text('title', title); ice.drop('title', !docs.length); ice.loop('detail', docs, (i, doc, ice)=>{ const scope = doc.static ? 'static' : 'instance'; ice.attr('anchor', 'id', `${scope}-${doc.kind}-${doc.name}`); ice.text('generator', doc.generator ? '*' : ''); ice.text('async', doc.async ? 'async' : ''); ice.text('name', doc.name); ice.load('signature', this._buildSignatureHTML(doc)); ice.load('description', doc.description || this._buildOverrideMethodDescription(doc)); ice.text('abstract', doc.abstract ? 'abstract' : ''); ice.text('access', doc.access); if (['get', 'set'].includes(doc.kind)) { ice.text('kind', doc.kind); } else { ice.drop('kind'); } if (doc.export && doc.importPath && doc.importStyle) { const link = this._buildFileDocLinkHTML(doc, doc.importPath); ice.into('importPath', `import ${doc.importStyle} from '${link}'`, (code, ice)=>{ ice.load('importPathCode', code); }); } else { ice.drop('importPath'); } if (['member', 'method', 'get', 'set'].includes(doc.kind)) { ice.text('static', doc.static ? 'static' : ''); } else { ice.drop('static'); } ice.load('source', this._buildFileDocLinkHTML(doc, 'source')); ice.text('since', doc.since, 'append'); ice.load('deprecated', this._buildDeprecatedHTML(doc)); ice.load('experimental', this._buildExperimentalHTML(doc)); ice.text('version', doc.version, 'append'); ice.load('see', this._buildDocsLinkHTML(doc.see), 'append'); ice.load('todo', this._buildDocsLinkHTML(doc.todo), 'append'); ice.load('override', this._buildOverrideMethod(doc)); ice.load('decorator', this._buildDecoratorHTML(doc), 'append'); let isFunction = false; if (['method', 'constructor', 'function'].indexOf(doc.kind) !== -1) isFunction = true; if (doc.kind === 'typedef' && doc.params && doc.type.types[0] === 'function') isFunction = true; if (isFunction) { ice.load('properties', this._buildProperties(doc.params, 'Params:')); } else { ice.load('properties', this._buildProperties(doc.properties, 'Properties:')); } // return if (doc.return) { ice.load('returnDescription', doc.return.description); const typeNames = []; for (const typeName of doc.return.types) { typeNames.push(this._buildTypeDocLinkHTML(typeName)); } if (typeof doc.return.nullable === 'boolean') { const nullable = doc.return.nullable; ice.load('returnType', `${typeNames.join(' | ')} (nullable: ${nullable})`); } else { ice.load('returnType', typeNames.join(' | ')); } ice.load('returnProperties', this._buildProperties(doc.properties, 'Return Properties:')); } else { ice.drop('returnParams'); } // throws if (doc.throws) { ice.loop('throw', doc.throws, (i, exceptionDoc, ice)=>{ ice.load('throwName', this._buildDocLinkHTML(exceptionDoc.types[0])); ice.load('throwDesc', exceptionDoc.description); }); } else { ice.drop('throwWrap'); } // fires if (doc.emits) { ice.loop('emit', doc.emits, (i, emitDoc, ice)=>{ ice.load('emitName', this._buildDocLinkHTML(emitDoc.types[0])); ice.load('emitDesc', emitDoc.description); }); } else { ice.drop('emitWrap'); } // listens if (doc.listens) { ice.loop('listen', doc.listens, (i, listenDoc, ice)=>{ ice.load('listenName', this._buildDocLinkHTML(listenDoc.types[0])); ice.load('listenDesc', listenDoc.description); }); } else { ice.drop('listenWrap'); } // example ice.into('example', doc.examples, (examples, ice)=>{ ice.loop('exampleDoc', examples, (i, exampleDoc, ice)=>{ const parsed = parseExample(exampleDoc); ice.text('exampleCode', parsed.body); ice.text('exampleCaption', parsed.caption); }); }); // tests ice.into('tests', doc._custom_tests, (tests, ice)=>{ ice.loop('test', tests, (i, test, ice)=>{ const testDoc = this._find({longname: test})[0]; ice.load('test', this._buildFileDocLinkHTML(testDoc, testDoc.testFullDescription)); }); }); }); return ice; } /** * get output html page title. * @param {DocObject} doc - target doc object. * @returns {string} page title. * @private */ _getTitle(doc = '') { const name = doc.name || doc.toString(); if (name) { return `${name}`; } else { return ''; } } /** * get base url html page. it is used html base tag. * @param {string} fileName - output file path. * @returns {string} base url. * @protected */ _getBaseUrl(fileName) { const baseUrl = '../'.repeat(fileName.split('/').length - 1); return baseUrl; } /** * gat url of output html page. * @param {DocObject} doc - target doc object. * @returns {string} url of output html. it is relative path from output root dir. * @private */ _getURL(doc) { let inner = false; if (['variable', 'function', 'member', 'typedef', 'method', 'constructor', 'get', 'set'].includes(doc.kind)) { inner = true; } if (inner) { const scope = doc.static ? 'static' : 'instance'; const fileName = this._getOutputFileName(doc); return `${fileName}#${scope}-${doc.kind}-${doc.name}`; } else { const fileName = this._getOutputFileName(doc); return fileName; } } /** * get file name of output html page. * @param {DocObject} doc - target doc object. * @returns {string} file name. * @private */ _getOutputFileName(doc) { switch (doc.kind) { case 'variable': return 'variable/index.html'; case 'function': return 'function/index.html'; case 'member': // fall case 'method': // fall case 'constructor': // fall case 'set': // fall case 'get': { // fal const parentDoc = this._find({longname: doc.memberof})[0]; return this._getOutputFileName(parentDoc); } case 'external': return 'external/index.html'; case 'typedef': return 'typedef/index.html'; case 'class': return `class/${doc.longname}.html`; case 'file': return `file/${doc.name}.html`; case 'testFile': return `test-file/${doc.name}.html`; case 'test': return 'test.html'; default: throw new Error('DocBuilder: can not resolve file name.'); } } /** * build html link to file page. * @param {DocObject} doc - target doc object. * @param {string} text - link text. * @returns {string} html of link. * @private */ _buildFileDocLinkHTML(doc, text = null) { if (!doc) return ''; let fileDoc; if (doc.kind === 'file' || doc.kind === 'testFile') { fileDoc = doc; } else { const filePath = doc.longname.split('~')[0]; fileDoc = this._find({kind: ['file', 'testFile'], name: filePath})[0]; } if (!fileDoc) return ''; if (!text) text = fileDoc.name; if (doc.kind === 'file' || doc.kind === 'testFile') { return `${text}`; } else { return `${text}`; } } /** * build html link of type. * @param {string} typeName - type name(e.g. ``number[]``, ``Map``) * @returns {string} html of link. * @private * @todo re-implement with parser combinator. */ _buildTypeDocLinkHTML(typeName) { // e.g. number[] let matched = typeName.match(/^(.*?)\[\]$/); if (matched) { typeName = matched[1]; return `${this._buildDocLinkHTML(typeName, typeName)}[]`; } // e.g. function(a: number, b: string): boolean matched = typeName.match(/function *\((.*?)\)(.*)/); if (matched) { const functionLink = this._buildDocLinkHTML('function'); if (!matched[1] && !matched[2]) return `${functionLink}()`; let innerTypes = []; if (matched[1]) { // bad hack: Map. => Map. // bad hack: {a: string, b: boolean} => {a\Y string\Z b\Y boolean} const inner = matched[1] .replace(/<.*?>/g, (a)=> a.replace(/,/g, '\\Z')) .replace(/{.*?}/g, (a)=> a.replace(/,/g, '\\Z').replace(/:/g, '\\Y')); innerTypes = inner.split(',').map((v)=>{ const tmp = v.split(':').map((v)=> v.trim()); if (tmp.length !== 2) throw new SyntaxError(`Invalid function type annotation: \`${matched[0]}\``); const paramName = tmp[0]; const typeName = tmp[1].replace(/\\Z/g, ',').replace(/\\Y/g, ':'); return `${paramName}: ${this._buildTypeDocLinkHTML(typeName)}`; }); } let returnType = ''; if (matched[2]) { const type = matched[2].split(':')[1]; if (type) returnType = `: ${this._buildTypeDocLinkHTML(type.trim())}`; } return `${functionLink}(${innerTypes.join(', ')})${returnType}`; } // e.g. {a: number, b: string} matched = typeName.match(/^\{(.*?)\}$/); if (matched) { if (!matched[1]) return '{}'; // bad hack: Map. => Map. // bad hack: {a: string, b: boolean} => {a\Y string\Z b\Y boolean} const inner = matched[1] .replace(/<.*?>/g, (a)=> a.replace(/,/g, '\\Z')) .replace(/{.*?}/g, (a)=> a.replace(/,/g, '\\Z').replace(/:/g, '\\Y')); let broken = false; const innerTypes = inner.split(',').map((v)=>{ const tmp = v.split(':').map((v)=> v.trim()); // edge case: if object key includes comma, this parsing is broken. // e.g. {"a,b": 10} // https://github.com/esdoc/esdoc-plugins/pull/49 if (!tmp[0] || !tmp[1]) { broken = true; return; } const paramName = tmp[0]; let typeName = tmp[1].replace(/\\Z/g, ',').replace(/\\Y/g, ':'); if (typeName.includes('|')) { typeName = typeName.replace(/^\(/, '').replace(/\)$/, ''); const typeNames = typeName.split('|').map(v => v.trim()); const html = []; for (const unionType of typeNames) { html.push(this._buildTypeDocLinkHTML(unionType)); } return `${paramName}: ${html.join('|')}`; } else { return `${paramName}: ${this._buildTypeDocLinkHTML(typeName)}`; } }); if (broken) return `*`; return `{${innerTypes.join(', ')}}`; } // e.g. Map matched = typeName.match(/^(.*?)\.?<(.*?)>$/); if (matched) { const mainType = matched[1]; // bad hack: Map. => Map. // bad hack: {a: string, b: boolean} => {a\Y string\Z b\Y boolean} const inner = matched[2] .replace(/<.*?>/g, (a)=> a.replace(/,/g, '\\Z')) .replace(/{.*?}/g, (a)=> a.replace(/,/g, '\\Z').replace(/:/g, '\\Y')); const innerTypes = inner.split(',').map((v) => { return v.split('|').map((vv) => { vv = vv.trim().replace(/\\Z/g, ',').replace(/\\Y/g, ':'); return this._buildTypeDocLinkHTML(vv); }).join('|'); }); const html = `${this._buildDocLinkHTML(mainType, mainType)}<${innerTypes.join(', ')}>`; return html; } if (typeName.indexOf('...') === 0) { typeName = typeName.replace('...', ''); if (typeName.includes('|')) { const typeNames = typeName.replace('(', '').replace(')', '').split('|'); const typeLinks = typeNames.map((v) => this._buildDocLinkHTML(v)); return `...(${typeLinks.join('|')})`; } else { return `...${this._buildDocLinkHTML(typeName)}`; } } else if (typeName.indexOf('?') === 0) { typeName = typeName.replace('?', ''); return `?${this._buildDocLinkHTML(typeName)}`; } else { return this._buildDocLinkHTML(typeName); } } /** * build html link to identifier. * @param {string} longname - link to this. * @param {string} [text] - link text. default is name property of doc object. * @param {boolean} [inner=false] - if true, use inner link. * @param {string} [kind] - specify target kind property. * @returns {string} html of link. * @private */ _buildDocLinkHTML(longname, text = null, inner = false, kind = null) { if (!longname) return ''; if (typeof longname !== 'string') throw new Error(JSON.stringify(longname)); const doc = this._findByName(longname, kind)[0]; if (!doc) { // if longname is HTML tag, not escape. if (longname.indexOf('<') === 0) { return `${longname}`; } else { return `${escape(text || longname)}`; } } if (doc.kind === 'external') { text = doc.name; return `${text}`; } else { text = escape(text || doc.name); const url = this._getURL(doc, inner); if (url) { return `${text}`; } else { return `${text}`; } } } /** * build html links to identifiers * @param {string[]} longnames - link to these. * @param {string} [text] - link text. default is name property of doc object. * @param {boolean} [inner=false] - if true, use inner link. * @param {string} [separator='\n'] - used link separator. * @returns {string} html links. * @private */ _buildDocsLinkHTML(longnames, text = null, inner = false, separator = '\n') { if (!longnames) return ''; if (!longnames.length) return ''; const links = []; for (const longname of longnames) { if (!longname) continue; const link = this._buildDocLinkHTML(longname, text, inner); links.push(`
  • ${link}
  • `); } if (!links.length) return ''; return `
      ${links.join(separator)}
    `; } /** * build identifier signature html. * @param {DocObject} doc - target doc object. * @returns {string} signature html. * @private */ _buildSignatureHTML(doc) { // call signature const callSignatures = []; if (doc.params) { for (const param of doc.params) { const paramName = param.name; if (paramName.indexOf('.') !== -1) continue; // for object property if (paramName.indexOf('[') !== -1) continue; // for array property const types = []; for (const typeName of param.types) { types.push(this._buildTypeDocLinkHTML(typeName)); } callSignatures.push(`${paramName}: ${types.join(' | ')}`); } } // return signature const returnSignatures = []; if (doc.return) { for (const typeName of doc.return.types) { returnSignatures.push(this._buildTypeDocLinkHTML(typeName)); } } // type signature let typeSignatures = []; if (doc.type) { for (const typeName of doc.type.types) { typeSignatures.push(this._buildTypeDocLinkHTML(typeName)); } } // callback is not need type. because type is always function. if (doc.kind === 'function') { typeSignatures = []; } let html = ''; if (callSignatures.length) { html = `(${callSignatures.join(', ')})`; } else if (['function', 'method', 'constructor'].includes(doc.kind)) { html = '()'; } if (returnSignatures.length) html = `${html}: ${returnSignatures.join(' | ')}`; if (typeSignatures.length) html = `${html}: ${typeSignatures.join(' | ')}`; return html; } /** * build properties output. * @param {ParsedParam[]} [properties=[]] - properties in doc object. * @param {string} title - output title. * @return {IceCap} built properties output. * @private */ _buildProperties(properties = [], title = 'Properties:') { const ice = new IceCap(this._readTemplate('properties.html')); ice.text('title', title); ice.loop('property', properties, (i, prop, ice)=>{ ice.autoDrop = false; ice.attr('property', 'data-depth', prop.name.split('.').length - 1); ice.text('name', prop.name); ice.attr('name', 'data-depth', prop.name.split('.').length - 1); ice.load('description', prop.description); const typeNames = []; for (const typeName of prop.types) { typeNames.push(this._buildTypeDocLinkHTML(typeName)); } ice.load('type', typeNames.join(' | ')); // appendix const appendix = []; if (prop.optional) { appendix.push('
  • optional
  • '); } if ('defaultValue' in prop) { appendix.push(`
  • default: ${prop.defaultValue}
  • `); } if (typeof prop.nullable === 'boolean') { appendix.push(`
  • nullable: ${prop.nullable}
  • `); } if (appendix.length) { ice.load('appendix', `
      ${appendix.join('\n')}
    `); } else { ice.text('appendix', ''); } }); if (!properties || properties.length === 0) { ice.drop('properties'); } return ice; } /** * build deprecated html. * @param {DocObject} doc - target doc object. * @returns {string} if doc is not deprecated, returns empty. * @private */ _buildDeprecatedHTML(doc) { if (doc.deprecated) { const deprecated = [`this ${doc.kind} was deprecated.`]; if (typeof doc.deprecated === 'string') deprecated.push(doc.deprecated); return deprecated.join(' '); } else { return ''; } } /** * build experimental html. * @param {DocObject} doc - target doc object. * @returns {string} if doc is not experimental, returns empty. * @private */ _buildExperimentalHTML(doc) { if (doc.experimental) { const experimental = [`this ${doc.kind} is experimental.`]; if (typeof doc.experimental === 'string') experimental.push(doc.experimental); return experimental.join(' '); } else { return ''; } } /** * build method of ancestor class link html. * @param {DocObject} doc - target doc object. * @returns {string} html link. if doc does not override ancestor method, returns empty. * @private */ _buildOverrideMethod(doc) { const parentDoc = this._findByName(doc.memberof)[0]; if (!parentDoc) return ''; if (!parentDoc._custom_extends_chains) return ''; const chains = [...parentDoc._custom_extends_chains].reverse(); for (const longname of chains) { const superClassDoc = this._findByName(longname)[0]; if (!superClassDoc) continue; const superMethodDoc = this._find({name: doc.name, memberof: superClassDoc.longname})[0]; if (!superMethodDoc) continue; return this._buildDocLinkHTML(superMethodDoc.longname, `${superClassDoc.name}#${superMethodDoc.name}`, true); } return ''; } /** * build method of ancestor class description. * @param {DocObject} doc - target doc object. * @returns {string} description. if doc does not override ancestor method, returns empty. * @private */ _buildOverrideMethodDescription(doc) { const parentDoc = this._findByName(doc.memberof)[0]; if (!parentDoc) return ''; if (!parentDoc._custom_extends_chains) return ''; const chains = [...parentDoc._custom_extends_chains].reverse(); for (const longname of chains) { const superClassDoc = this._findByName(longname)[0]; if (!superClassDoc) continue; const superMethodDoc = this._find({name: doc.name, memberof: superClassDoc.longname})[0]; if (!superMethodDoc) continue; if (superMethodDoc.description) return superMethodDoc.description; } return ''; } _buildDecoratorHTML(doc) { if (!doc.decorators) return ''; const links = []; for (const decorator of doc.decorators) { const link = this._buildDocLinkHTML(decorator.name, decorator.name, false, 'function'); if (decorator.arguments) { links.push(`
  • ${link}${decorator.arguments}
  • `); } else { links.push(`
  • ${link}
  • `); } } if (!links.length) return ''; return `
      ${links.join('\n')}
    `; } // _buildAuthorHTML(doc, separator = '\n') { // if (!doc.author) return ''; // // var html = []; // for (var author of doc.author) { // var matched = author.match(/(.*?) *<(.*?)>/); // if (matched) { // var name = matched[1]; // var link = matched[2]; // if (link.indexOf('http') === 0) { // html.push(`
  • ${name}
  • `) // } else { // html.push(`
  • ${name}
  • `) // } // } else { // html.push(`
  • ${author}
  • `) // } // } // // return `
      ${html.join(separator)}
    `; // } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/DocResolver.js ================================================ import {markdown} from './util.js'; /** * Resolve various properties in doc object. */ export default class DocResolver { /** * create instance. * @param {DocBuilder} builder - target doc builder. */ constructor(builder) { this._builder = builder; this._data = builder._data; } /** * resolve various properties. */ resolve() { if (this._data.__RESOLVED_ALL__) return; console.log('resolve: extends chain'); this._resolveExtendsChain(); console.log('resolve: necessary'); this._resolveNecessary(); console.log('resolve: ignore'); this._resolveIgnore(); console.log('resolve: link'); this._resolveLink(); console.log('resolve: markdown in description'); this._resolveMarkdown(); console.log('resolve: test relation'); this._resolveTestRelation(); this._data.__RESOLVED_ALL__ = true; } /** * resolve ignore property. * remove docs that has ignore property. * @private */ _resolveIgnore() { if (this._data.__RESOLVED_IGNORE__) return; const docs = this._builder._find({ignore: true}); for (const doc of docs) { const longname = doc.longname.replace(/[$]/g, '\\$'); const regex = new RegExp(`^${longname}[.~#]`); this._data({longname: {regex: regex}}).remove(); } this._data({ignore: true}).remove(); this._data.__RESOLVED_IGNORE__ = true; } /** * resolve description as markdown. * @private */ _resolveMarkdown() { if (this._data.__RESOLVED_MARKDOWN__) return; function convert(obj) { for (const key of Object.keys(obj)) { const value = obj[key]; if (key === 'description' && typeof value === 'string') { obj[`${key}Raw`] = obj[key]; obj[key] = markdown(value, false); } else if (typeof value === 'object' && value) { convert(value); } } } const docs = this._builder._find(); for (const doc of docs) { convert(doc); } this._data.__RESOLVED_MARKDOWN__ = true; } /** * resolve @link as html link. * @private * @todo resolve all ``description`` property. */ _resolveLink() { if (this._data.__RESOLVED_LINK__) return; const link = (str)=>{ if (!str) return str; return str.replace(/\{@link ([\w#_\-.:~\/$]+)}/g, (str, longname)=>{ return this._builder._buildDocLinkHTML(longname, longname); }); }; this._data().each((v)=>{ v.description = link(v.description); if (v.params) { for (const param of v.params) { param.description = link(param.description); } } if (v.properties) { for (const property of v.properties) { property.description = link(property.description); } } if (v.return) { v.return.description = link(v.return.description); } if (v.throws) { for (const _throw of v.throws) { _throw.description = link(_throw.description); } } if (v.see) { for (let i = 0; i < v.see.length; i++) { if (v.see[i].indexOf('{@link') === 0) { v.see[i] = link(v.see[i]); } else if (v.see[i].indexOf('${v.see[i]}`; } } } }); this._data.__RESOLVED_LINK__ = true; } /** * resolve class extends chain. * add following special property. * - ``_custom_extends_chain``: ancestor class chain. * - ``_custom_direct_subclasses``: class list that direct extends target doc. * - ``_custom_indirect_subclasses``: class list that indirect extends target doc. * - ``_custom_indirect_implements``: class list that target doc indirect implements. * - ``_custom_direct_implemented``: class list that direct implements target doc. * - ``_custom_indirect_implemented``: class list that indirect implements target doc. * * @private */ _resolveExtendsChain() { if (this._data.__RESOLVED_EXTENDS_CHAIN__) return; const extendsChain = (doc) => { if (!doc.extends) return; const selfDoc = doc; // traverse super class. const chains = []; /* eslint-disable */ while (1) { if (!doc.extends) break; let superClassDoc = this._builder._findByName(doc.extends[0])[0]; if (superClassDoc) { // this is circular extends if (superClassDoc.longname === selfDoc.longname) { break; } chains.push(superClassDoc.longname); doc = superClassDoc; } else { chains.push(doc.extends[0]); break; } } if (chains.length) { // direct subclass let superClassDoc = this._builder._findByName(chains[0])[0]; if (superClassDoc) { if (!superClassDoc._custom_direct_subclasses) superClassDoc._custom_direct_subclasses = []; superClassDoc._custom_direct_subclasses.push(selfDoc.longname); } // indirect subclass for (let superClassLongname of chains.slice(1)) { superClassDoc = this._builder._findByName(superClassLongname)[0]; if (superClassDoc) { if (!superClassDoc._custom_indirect_subclasses) superClassDoc._custom_indirect_subclasses = []; superClassDoc._custom_indirect_subclasses.push(selfDoc.longname); } } // indirect implements and mixes for (let superClassLongname of chains) { superClassDoc = this._builder._findByName(superClassLongname)[0]; if (!superClassDoc) continue; // indirect implements if (superClassDoc.implements) { if (!selfDoc._custom_indirect_implements) selfDoc._custom_indirect_implements = []; selfDoc._custom_indirect_implements.push(...superClassDoc.implements); } // indirect mixes //if (superClassDoc.mixes) { // if (!selfDoc._custom_indirect_mixes) selfDoc._custom_indirect_mixes = []; // selfDoc._custom_indirect_mixes.push(...superClassDoc.mixes); //} } // extends chains selfDoc._custom_extends_chains = chains.reverse(); } }; let implemented = (doc) =>{ let selfDoc = doc; // direct implemented (like direct subclass) for (let superClassLongname of selfDoc.implements || []) { let superClassDoc = this._builder._findByName(superClassLongname)[0]; if (!superClassDoc) continue; if(!superClassDoc._custom_direct_implemented) superClassDoc._custom_direct_implemented = []; superClassDoc._custom_direct_implemented.push(selfDoc.longname); } // indirect implemented (like indirect subclass) for (let superClassLongname of selfDoc._custom_indirect_implements || []) { let superClassDoc = this._builder._findByName(superClassLongname)[0]; if (!superClassDoc) continue; if(!superClassDoc._custom_indirect_implemented) superClassDoc._custom_indirect_implemented = []; superClassDoc._custom_indirect_implemented.push(selfDoc.longname); } }; //var mixed = (doc) =>{ // var selfDoc = doc; // // // direct mixed (like direct subclass) // for (var superClassLongname of selfDoc.mixes || []) { // var superClassDoc = this._builder._find({longname: superClassLongname})[0]; // if (!superClassDoc) continue; // if(!superClassDoc._custom_direct_mixed) superClassDoc._custom_direct_mixed = []; // superClassDoc._custom_direct_mixed.push(selfDoc.longname); // } // // // indirect mixed (like indirect subclass) // for (var superClassLongname of selfDoc._custom_indirect_mixes || []) { // var superClassDoc = this._builder._find({longname: superClassLongname})[0]; // if (!superClassDoc) continue; // if(!superClassDoc._custom_indirect_mixed) superClassDoc._custom_indirect_mixed = []; // superClassDoc._custom_indirect_mixed.push(selfDoc.longname); // } //}; let docs = this._builder._find({kind: 'class'}); for (let doc of docs) { extendsChain(doc); implemented(doc); //mixed(doc); } this._data.__RESOLVED_EXTENDS_CHAIN__ = true; } /** * resolve necessary identifier. * * ```javascript * class Foo {} * * export default Bar extends Foo {} * ``` * * ``Foo`` is not exported, but ``Bar`` extends ``Foo``. * ``Foo`` is necessary. * So, ``Foo`` must be exported by force. * * @private */ _resolveNecessary() { let builder = this._builder; this._data({export: false}).update(function() { let doc = this; let childNames = []; if (doc._custom_direct_subclasses) childNames.push(...doc._custom_direct_subclasses); if (doc._custom_indirect_subclasses) childNames.push(...doc._custom_indirect_subclasses); if (doc._custom_direct_implemented) childNames.push(...doc._custom_direct_implemented); if (doc._custom_indirect_implemented) childNames.push(...doc._custom_indirect_implemented); for (let childName of childNames) { let childDoc = builder._find({longname: childName})[0]; if (!childDoc) continue; if (!childDoc.ignore && childDoc.export) { doc.ignore = false; return doc; } } }); } /** * resolve test and identifier relation. add special property. * - ``_custom_tests``: longnames of test doc. * - ``_custom_test_targets``: longnames of identifier. * * @private */ _resolveTestRelation() { if (this._data.__RESOLVED_TEST_RELATION__) return; let testDocs = this._builder._find({kind: 'test'}); for (let testDoc of testDocs) { let testTargets = testDoc.testTargets; if (!testTargets) continue; for (let testTarget of testTargets) { let doc = this._builder._findByName(testTarget)[0]; if (doc) { if (!doc._custom_tests) doc._custom_tests = []; doc._custom_tests.push(testDoc.longname); if (!testDoc._custom_test_targets) testDoc._custom_test_targets = []; testDoc._custom_test_targets.push([doc.longname, testTarget]); } else { if (!testDoc._custom_test_targets) testDoc._custom_test_targets = []; testDoc._custom_test_targets.push([testTarget, testTarget]); } } } // test full description for (let testDoc of testDocs) { let desc = []; let parents = (testDoc.memberof.split('~')[1] || '').split('.'); for (let parent of parents) { let doc = this._builder._find({kind: 'test', name: parent})[0]; if (!doc) continue; desc.push(doc.descriptionRaw); } desc.push(testDoc.descriptionRaw); testDoc.testFullDescription = desc.join(' '); } this._data.__RESOLVED_TEST_RELATION__ = true; } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/FileDocBuilder.js ================================================ import IceCap from 'ice-cap'; import DocBuilder from './DocBuilder.js'; /** * File output builder class. */ export default class FileDocBuilder extends DocBuilder { exec(writeFile, copyDir) { const ice = this._buildLayoutDoc(); const docs = this._find({kind: 'file'}); for (const doc of docs) { const fileName = this._getOutputFileName(doc); const baseUrl = this._getBaseUrl(fileName); const title = this._getTitle(doc); ice.load('content', this._buildFileDoc(doc), IceCap.MODE_WRITE); ice.attr('baseUrl', 'href', baseUrl, IceCap.MODE_WRITE); ice.text('title', title, IceCap.MODE_WRITE); writeFile(fileName, ice.html); } } /** * build file output html. * @param {DocObject} doc - target file doc object. * @returns {string} html of file page. * @private */ _buildFileDoc(doc) { const ice = new IceCap(this._readTemplate('file.html')); ice.text('title', doc.name); ice.text('content', doc.content); ice.drop('emptySourceCode', !!doc.content); return ice.html; } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/IdentifiersDocBuilder.js ================================================ import IceCap from 'ice-cap'; import DocBuilder from './DocBuilder.js'; import path from 'path'; import {escapeURLHash} from './util'; /** * Identifier output builder class. */ export default class IdentifiersDocBuilder extends DocBuilder { exec(writeFile, copyDir) { const ice = this._buildLayoutDoc(); const title = this._getTitle('Reference'); ice.load('content', this._buildIdentifierDoc()); ice.text('title', title, IceCap.MODE_WRITE); writeFile('identifiers.html', ice.html); } /** * build identifier output. * @return {IceCap} built output. * @private */ _buildIdentifierDoc() { const ice = new IceCap(this._readTemplate('identifiers.html')); // traverse docs and create Map const dirDocs = new Map(); const kinds = ['class', 'interface', 'function', 'variable', 'typedef', 'external']; for (const doc of this._tags) { if (!kinds.includes(doc.kind)) continue; if (doc.builtinExternal) continue; if (doc.ignore) continue; const filePath = doc.memberof.replace(/^.*?[/]/, ''); const dirPath = path.dirname(filePath); if (!dirDocs.has(dirPath)) dirDocs.set(dirPath, []); dirDocs.get(dirPath).push(doc); } // create a summary of dir const dirPaths = Array.from(dirDocs.keys()).sort((a, b) => a > b ? 1 : -1); const kindOrder = {class: 0, interface: 1, function: 2, variable: 3, typedef: 4, external: 5}; ice.loop('dirSummaryWrap', dirPaths, (i, dirPath, ice) =>{ const docs = dirDocs.get(dirPath); // see: DocBuilder#_buildNavDoc docs.sort((a, b) => { const kindA = a.interface ? 'interface' : a.kind; const kindB = b.interface ? 'interface' : b.kind; if (kindA === kindB) { return a.longname > b.longname ? 1 : -1; } else { return kindOrder[kindA] > kindOrder[kindB] ? 1 : -1; } }); const dirPathLabel = dirPath === '.' ? '' : dirPath; const summary = this._buildSummaryDoc(docs, `summary`, false, true); ice.text('dirPath', dirPathLabel); ice.attr('dirPath', 'id', escapeURLHash(dirPath)); ice.load('dirSummary', summary); }); const dirTree = this._buildDirTree(dirPaths); ice.load('dirTree', dirTree); ice.drop('dirTreeWrap', !dirTree); return ice; } _buildDirTree(dirPaths) { const lines = []; for (const dirPath of dirPaths) { const padding = dirPath.split('/').length - 1; const dirName = path.basename(dirPath); if (dirName === '.') continue; const hash = escapeURLHash(dirPath); lines.push(``); } return lines.join('\n'); } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/IndexDocBuilder.js ================================================ import path from 'path'; import IceCap from 'ice-cap'; import DocBuilder from './DocBuilder.js'; import {markdown} from './util.js'; /** * Index output builder class. */ export default class IndexDocBuilder extends DocBuilder { exec(writeFile, copyDir) { const ice = this._buildLayoutDoc(); const title = this._getTitle('Home'); ice.load('content', this._buildIndexDoc()); ice.text('title', title, IceCap.MODE_WRITE); writeFile('index.html', ice.html); } /** * build index output. * @returns {string} html of index output. * @private */ _buildIndexDoc() { const indexTag = this._tags.find(tag => tag.kind === 'index'); if (!indexTag) return 'Please create README.md'; const indexContent = indexTag.content; const html = this._readTemplate('index.html'); const ice = new IceCap(html); const ext = path.extname(indexTag.name); if (['.md', '.markdown'].includes(ext)) { ice.load('index', markdown(indexContent)); } else { ice.load('index', indexContent); } return ice.html; } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/ManualDocBuilder.js ================================================ import IceCap from 'ice-cap'; import path from 'path'; import {Buffer} from 'buffer'; import cheerio from 'cheerio'; import DocBuilder from './DocBuilder.js'; import {markdown, escapeURLHash} from './util.js'; /** * Manual Output Builder class. */ export default class ManualDocBuilder extends DocBuilder { exec(writeFile, copyDir, readFile) { const manuals = this._tags.filter(tag => tag.kind === 'manual'); const manualIndex = this._tags.find(tag => tag.kind === 'manualIndex'); const manualAsset = this._tags.find(tag => tag.kind === 'manualAsset'); if (manuals.length === 0) return; const ice = this._buildLayoutDoc(); ice.autoDrop = false; ice.attr('rootContainer', 'class', ' manual-root'); { const fileName = 'manual/index.html'; const baseUrl = this._getBaseUrl(fileName); const badge = this._writeBadge(manuals, writeFile); ice.load('content', this._buildManualCardIndex(manuals, manualIndex, badge), IceCap.MODE_WRITE); ice.load('nav', this._buildManualNav(manuals), IceCap.MODE_WRITE); ice.text('title', 'Manual', IceCap.MODE_WRITE); ice.attr('baseUrl', 'href', baseUrl, IceCap.MODE_WRITE); ice.attr('rootContainer', 'class', ' manual-index'); writeFile(fileName, ice.html); if (manualIndex.globalIndex) { ice.attr('baseUrl', 'href', './', IceCap.MODE_WRITE); writeFile('index.html', ice.html); } ice.attr('rootContainer', 'class', ' manual-index', IceCap.MODE_REMOVE); } for (const manual of manuals) { const fileName = this._getManualOutputFileName(manual.name); const baseUrl = this._getBaseUrl(fileName); ice.load('content', this._buildManual(manual), IceCap.MODE_WRITE); ice.load('nav', this._buildManualNav(manuals), IceCap.MODE_WRITE); ice.attr('baseUrl', 'href', baseUrl, IceCap.MODE_WRITE); writeFile(fileName, ice.html); } if (manualAsset) { copyDir(manualAsset.name, 'manual/asset'); } } /** * this is * @param {manual[]} manuals * @param {function(filePath:string, content:string)} writeFile * @returns {boolean} * @private */ _writeBadge(manuals, writeFile) { const specialFileNamePatterns = [ '(overview.*)', '(design.*)', '(installation.*)|(install.*)', '(usage.*)', '(configuration.*)|(config.*)', '(example.*)', '(faq.*)', '(changelog.*)' ]; let count = 0; for (const pattern of specialFileNamePatterns) { const regexp = new RegExp(pattern, 'i'); for (const manual of manuals) { const fileName = path.parse(manual.name).name; if (fileName.match(regexp)) { count++; break; } } } if (count !== specialFileNamePatterns.length) return false; let badge = this._readTemplate('image/manual-badge.svg'); badge = badge.replace(/@value@/g, 'perfect'); badge = badge.replace(/@color@/g, '#4fc921'); writeFile('manual-badge.svg', badge); return true; } /** * build manual navigation. * @param {Manual[]} manuals - target manuals. * @return {IceCap} built navigation * @private */ _buildManualNav(manuals) { const ice = new IceCap(this._readTemplate('manualIndex.html')); ice.loop('manual', manuals, (i, manual, ice)=>{ const toc = []; const fileName = this._getManualOutputFileName(manual.name); const html = markdown(manual.content); const $root = cheerio.load(html).root(); const h1Count = $root.find('h1').length; $root.find('h1,h2,h3,h4,h5').each((i, el)=>{ const $el = cheerio(el); const label = $el.text(); const indent = `indent-${el.tagName.toLowerCase()}`; let link = `${fileName}#${$el.attr('id')}`; if (el.tagName.toLowerCase() === 'h1' && h1Count === 1) link = fileName; toc.push({label, link, indent}); }); ice.loop('manualNav', toc, (i, tocItem, ice)=>{ ice.attr('manualNav', 'class', tocItem.indent); ice.attr('manualNav', 'data-link', tocItem.link.split('#')[0]); ice.text('link', tocItem.label); ice.attr('link', 'href', tocItem.link); }); }); return ice; } /** * build manual. * @param {Object} manual - target manual. * @return {IceCap} built manual. * @private */ _buildManual(manual) { const html = markdown(manual.content); const ice = new IceCap(this._readTemplate('manual.html')); ice.load('content', html); // convert relative src to base url relative src. const $root = cheerio.load(ice.html).root(); $root.find('img').each((i, el)=>{ const $el = cheerio(el); const src = $el.attr('src'); if (!src) return; if (src.match(/^http[s]?:/)) return; if (src.charAt(0) === '/') return; $el.attr('src', `./manual/${src}`); }); $root.find('a').each((i, el)=>{ const $el = cheerio(el); const href = $el.attr('href'); if (!href) return; if (href.match(/^http[s]?:/)) return; if (href.charAt(0) === '/') return; if (href.charAt(0) === '#') return; $el.attr('href', `./manual/${href}`); }); return $root.html(); } /** * built manual card style index. * @param {Object[]} manuals - target manual. * @return {IceCap} built index. * @private */ _buildManualCardIndex(manuals, manualIndex, badgeFlag) { const cards = []; for (const manual of manuals) { const fileName = this._getManualOutputFileName(manual.name); const html = this._buildManual(manual); const $root = cheerio.load(html).root(); const h1Count = $root.find('h1').length; $root.find('h1').each((i, el)=>{ const $el = cheerio(el); const label = $el.text(); const link = h1Count === 1 ? fileName : `${fileName}#${$el.attr('id')}`; let card = `

    ${label}

    `; const nextAll = $el.nextAll(); for (let i = 0; i < nextAll.length; i++) { const next = nextAll.get(i); const tagName = next.tagName.toLowerCase(); if (tagName === 'h1') return; const $next = cheerio(next); card += `<${tagName}>${$next.html()}`; } cards.push({label, link, card}); }); } const ice = new IceCap(this._readTemplate('manualCardIndex.html')); ice.loop('cards', cards, (i, card, ice)=>{ ice.attr('link', 'href', card.link); ice.load('card', card.card); }); if (manualIndex && manualIndex.content) { const userIndex = markdown(manualIndex.content); ice.load('manualUserIndex', userIndex); } else { ice.drop('manualUserIndex', true); } // fixme? ice.drop('manualBadge', !manualIndex.coverage || !badgeFlag); return ice; } /** * get manual file name. * @param {string} filePath - target manual markdown file path. * @returns {string} file name. * @private */ _getManualOutputFileName(filePath) { const fileName = path.parse(filePath).name; return `manual/${fileName}.html`; } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/SearchIndexBuilder.js ================================================ import DocBuilder from './DocBuilder.js'; /** * Search index of identifier builder class. */ export default class SearchIndexBuilder extends DocBuilder { exec(writeFile, copyDir) { const searchIndex = []; const docs = this._find({}); for (const doc of docs) { if (doc.kind === 'index') continue; if (doc.kind.indexOf('manual') === 0) continue; let indexText; let url; let displayText; if (doc.importPath) { displayText = `${doc.name} ${doc.importPath}`; indexText = `${doc.importPath}~${doc.name}`.toLowerCase(); url = this._getURL(doc); } else if (doc.kind === 'test') { displayText = doc.testFullDescription; indexText = [...(doc.testTargets || []), ...(doc._custom_test_targets || [])].join(' ').toLowerCase(); const filePath = doc.longname.split('~')[0]; const fileDoc = this._find({kind: 'testFile', name: filePath})[0]; url = `${this._getURL(fileDoc)}#lineNumber${doc.lineNumber}`; } else if (doc.kind === 'external') { displayText = doc.longname; indexText = displayText.toLowerCase(); url = doc.externalLink; } else if (doc.kind === 'file' || doc.kind === 'testFile') { displayText = doc.name; indexText = displayText.toLowerCase(); url = this._getURL(doc); } else if (doc.kind === 'packageJSON'){ continue; } else { displayText = doc.longname; indexText = displayText.toLowerCase(); url = this._getURL(doc); } let kind = doc.kind; /* eslint-disable default-case */ switch (kind) { case 'constructor': kind = 'method'; break; case 'get': case 'set': kind = 'member'; break; } searchIndex.push([indexText, url, displayText, kind]); } searchIndex.sort((a, b)=>{ if (a[2] === b[2]) { return 0; } else if (a[2] < b[2]) { return -1; } else { return 1; } }); const javascript = `window.esdocSearchIndex = ${JSON.stringify(searchIndex, null, 2)}`; writeFile('script/search_index.js', javascript); } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/SingleDocBuilder.js ================================================ import IceCap from 'ice-cap'; import DocBuilder from './DocBuilder.js'; /** * Single output builder class. * "single" means function, variable, typedef, external, etc... */ export default class SingleDocBuilder extends DocBuilder { exec(writeFile, copyDir) { const ice = this._buildLayoutDoc(); ice.autoClose = false; const kinds = ['function', 'variable', 'typedef']; for (const kind of kinds) { const docs = this._find({kind: kind}); if (!docs.length) continue; const fileName = this._getOutputFileName(docs[0]); const baseUrl = this._getBaseUrl(fileName); let title = kind.replace(/^(\w)/, (c)=> c.toUpperCase()); title = this._getTitle(title); ice.load('content', this._buildSingleDoc(kind), IceCap.MODE_WRITE); ice.attr('baseUrl', 'href', baseUrl, IceCap.MODE_WRITE); ice.text('title', title, IceCap.MODE_WRITE); writeFile(fileName, ice.html); } } /** * build single output. * @param {string} kind - target kind property. * @returns {string} html of single output * @private */ _buildSingleDoc(kind) { const title = kind.replace(/^(\w)/, (c)=> c.toUpperCase()); const ice = new IceCap(this._readTemplate('single.html')); ice.text('title', title); ice.load('summaries', this._buildSummaryHTML(null, kind, 'Summary'), 'append'); ice.load('details', this._buildDetailHTML(null, kind, '')); return ice.html; } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/SourceDocBuilder.js ================================================ import fs from 'fs'; import IceCap from 'ice-cap'; import DocBuilder from './DocBuilder.js'; import {dateForUTC} from './util.js'; /** * Source output html builder class. */ export default class SourceDocBuilder extends DocBuilder { exec(writeFile, copyDir, coverage) { this._coverage = coverage; const ice = this._buildLayoutDoc(); const fileName = 'source.html'; const baseUrl = this._getBaseUrl(fileName); const title = this._getTitle('Source'); ice.attr('baseUrl', 'href', baseUrl); ice.load('content', this._buildSourceHTML()); ice.text('title', title, IceCap.MODE_WRITE); writeFile(fileName, ice.html); } /** * build source list output html. * @returns {string} html of source list. * @private */ _buildSourceHTML() { const ice = new IceCap(this._readTemplate('source.html')); const docs = this._find({kind: 'file'}); let coverage; if (this._coverage) coverage = this._coverage.files; ice.drop('coverageBadge', !coverage); ice.attr('files', 'data-use-coverage', !!coverage); if (coverage) { const actual = this._coverage.actualCount; const expect = this._coverage.expectCount; const coverageCount = `${actual}/${expect}`; ice.text('totalCoverageCount', coverageCount); } ice.loop('file', docs, (i, doc, ice)=>{ const filePath = doc.name; const content = doc.content; const lines = content.split('\n').length - 1; const stat = fs.statSync(doc.longname); const date = dateForUTC(stat.ctime); let coverageRatio; let coverageCount; let undocumentLines; if (coverage && coverage[filePath]) { const actual = coverage[filePath].actualCount; const expect = coverage[filePath].expectCount; coverageRatio = `${Math.floor(100 * actual / expect)} %`; coverageCount = `${actual}/${expect}`; undocumentLines = coverage[filePath].undocumentLines.sort().join(','); } else { coverageRatio = '-'; } const identifierDocs = this._find({ longname: {left: `${doc.name}~`}, kind: ['class', 'function', 'variable'] }); const identifiers = identifierDocs.map(doc =>{ return this._buildDocLinkHTML(doc.longname); }); if (undocumentLines) { const url = this._getURL(doc); const link = this._buildFileDocLinkHTML(doc).replace(/href=".*\.html"/, `href="${url}#errorLines=${undocumentLines}"`); ice.load('filePath', link); } else { ice.load('filePath', this._buildFileDocLinkHTML(doc)); } ice.text('coverage', coverageRatio); ice.text('coverageCount', coverageCount); ice.text('lines', lines); ice.text('updated', date); ice.text('size', `${stat.size} byte`); ice.load('identifier', identifiers.join('\n') || '-'); }); return ice.html; } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/StaticFileBuilder.js ================================================ import path from 'path'; import DocBuilder from './DocBuilder.js'; /** * Static file output builder class. */ export default class StaticFileBuilder extends DocBuilder { exec(writeFile, copyDir) { copyDir(path.resolve(this._template, 'css'), './css'); copyDir(path.resolve(this._template, 'script'), './script'); copyDir(path.resolve(this._template, 'image'), './image'); } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/TestDocBuilder.js ================================================ import IceCap from 'ice-cap'; import DocBuilder from './DocBuilder.js'; /** * Test file output html builder class. */ export default class TestDocBuilder extends DocBuilder { exec(writeFile, copyDir) { const testDoc = this._find({kind: 'test'})[0]; if (!testDoc) return; const ice = this._buildLayoutDoc(); const fileName = this._getOutputFileName(testDoc); const baseUrl = this._getBaseUrl(fileName); const title = this._getTitle('Test'); ice.load('content', this._buildTestDocHTML()); ice.attr('baseUrl', 'href', baseUrl); ice.text('title', title); writeFile(fileName, ice.html); } /** * build whole test file output html. * @returns {string} html of whole test file. * @private */ _buildTestDocHTML() { const ice = new IceCap(this._readTemplate('test.html')); const testDocHTML = this._buildTestInterfaceDocHTML(); ice.load('tests', testDocHTML); return ice.html; } /** * build test describe list html. * @param {number} [depth=0] - test depth. * @param {string} [memberof] - target test. * @returns {string} html of describe list. * @private */ _buildTestInterfaceDocHTML(depth = 0, memberof = null) { const cond = {kind: 'test', testDepth: depth}; if (memberof) cond.memberof = memberof; const docs = this._orderedFind('testId asec', cond); const resultHTMLs = []; for (const doc of docs) { const childHTML = this._buildTestInterfaceDocHTML(depth + 1, doc.longname); const ice = new IceCap(this._readTemplate('testInterface.html')); const padding = 10 * (depth + 1); ice.attr('testInterface', 'data-test-depth', depth); ice.into('testInterface', doc, (doc, ice)=>{ // description const descriptionHTML = this._buildFileDocLinkHTML(doc, doc.description); // identifier let testTargetsHTML = []; for (const testTarget of doc._custom_test_targets || []) { testTargetsHTML.push(this._buildDocLinkHTML(testTarget[0], testTarget[1])); } testTargetsHTML = testTargetsHTML.join('\n') || '-'; // apply ice.drop('testInterfaceToggle', !childHTML); ice.load('testDescription', descriptionHTML); ice.attr('testDescription', 'style', `padding-left: ${padding}px`); ice.load('testTarget', testTargetsHTML); }); resultHTMLs.push(ice.html); if(childHTML) resultHTMLs.push(childHTML); } return resultHTMLs.join('\n'); } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/TestFileDocBuilder.js ================================================ import IceCap from 'ice-cap'; import DocBuilder from './DocBuilder.js'; /** * File output html builder class. */ export default class TestFileDocBuilder extends DocBuilder { exec(writeFile, copyDir) { const ice = this._buildLayoutDoc(); const docs = this._find({kind: 'testFile'}); for (const doc of docs) { const fileName = this._getOutputFileName(doc); const baseUrl = this._getBaseUrl(fileName); const title = this._getTitle(doc); ice.load('content', this._buildFileDoc(doc), IceCap.MODE_WRITE); ice.attr('baseUrl', 'href', baseUrl, IceCap.MODE_WRITE); ice.text('title', title, IceCap.MODE_WRITE); writeFile(fileName, ice.html); } } /** * build file output html. * @param {DocObject} doc - target file doc object. * @returns {string} html of file output. * @private */ _buildFileDoc(doc) { const ice = new IceCap(this._readTemplate('file.html')); ice.text('title', doc.name); ice.text('content', doc.content); ice.drop('emptySourceCode', !!doc.content); return ice.html; } } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/class.html ================================================
    | variation | version | since |

    You can directly use an instance of this class.

    Expression Extends:

    Mixin Extends:

    Extends:

    Direct Subclass:

    Indirect Subclass:

    Implements:

    Indirect Implements:

    Direct Implemented:

    Indirect Implemented:

    Decorators:

    See:

    Example:

    Test:

    TODO:

    Static Member Summary

    Static Method Summary

    Constructor Summary

    Member Summary

    Method Summary

    Inherited Summary

    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/css/github.css ================================================ /* github markdown */ .github-markdown { font-size: 16px; } .github-markdown h1, .github-markdown h2, .github-markdown h3, .github-markdown h4, .github-markdown h5 { margin-top: 1em; margin-bottom: 16px; font-weight: bold; padding: 0; } .github-markdown h1:nth-of-type(1) { margin-top: 0; } .github-markdown h1 { font-size: 2em; padding-bottom: 0.3em; } .github-markdown h2 { font-size: 1.75em; padding-bottom: 0.3em; } .github-markdown h3 { font-size: 1.5em; } .github-markdown h4 { font-size: 1.25em; } .github-markdown h5 { font-size: 1em; } .github-markdown ul, .github-markdown ol { padding-left: 2em; } .github-markdown pre > code { font-size: 0.85em; } .github-markdown table { margin-bottom: 1em; border-collapse: collapse; border-spacing: 0; } .github-markdown table tr { background-color: #fff; border-top: 1px solid #ccc; } .github-markdown table th, .github-markdown table td { padding: 6px 13px; border: 1px solid #ddd; } .github-markdown table tr:nth-child(2n) { background-color: #f8f8f8; } .github-markdown hr { border-right: 0; border-bottom: 1px solid #e5e5e5; border-left: 0; border-top: 0; } /** badge(.svg) does not have border */ .github-markdown img:not([src*=".svg"]) { max-width: 100%; box-shadow: 1px 1px 1px rgba(0,0,0,0.5); } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/css/identifiers.css ================================================ .identifiers-wrap { display: flex; align-items: flex-start; } .identifier-dir-tree { background: #fff; border: solid 1px #ddd; border-radius: 0.25em; top: 52px; position: -webkit-sticky; position: sticky; max-height: calc(100vh - 155px); overflow-y: scroll; min-width: 200px; margin-left: 1em; } .identifier-dir-tree-header { padding: 0.5em; background-color: #fafafa; border-bottom: solid 1px #ddd; } .identifier-dir-tree-content { padding: 0 0.5em 0; } .identifier-dir-tree-content > div { padding-top: 0.25em; padding-bottom: 0.25em; } .identifier-dir-tree-content a { color: inherit; } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/css/manual.css ================================================ .github-markdown .manual-toc { padding-left: 0; } .manual-index .manual-cards { display: flex; flex-wrap: wrap; } .manual-index .manual-card-wrap { width: 280px; padding: 10px 20px 10px 0; box-sizing: border-box; } .manual-index .manual-card-wrap > h1 { margin: 0; font-size: 1em; font-weight: 600; padding: 0.2em 0 0.2em 0.5em; border-radius: 0.1em 0.1em 0 0; border: none; } .manual-index .manual-card-wrap > h1 span { color: #555; } .manual-index .manual-card { height: 200px; overflow: hidden; border: solid 1px rgba(230, 230, 230, 0.84); border-radius: 0 0 0.1em 0.1em; padding: 8px; position: relative; } .manual-index .manual-card > div { transform: scale(0.4); transform-origin: 0 0; width: 250%; } .manual-index .manual-card > a { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(210, 210, 210, 0.1); } .manual-index .manual-card > a:hover { background: none; } .manual-index .manual-badge { margin: 0; } .manual-index .manual-user-index { margin-bottom: 1em; border-bottom: solid 1px #ddd; } .manual-root .navigation { padding-left: 4px; margin-top: 4px; } .navigation .manual-toc-root > div { padding-left: 0.25em; padding-right: 0.75em; } .github-markdown .manual-toc-title a { color: inherit; } .manual-breadcrumb-list { font-size: 0.8em; margin-bottom: 1em; } .manual-toc-title a:hover { color: #039BE5; } .manual-toc li { margin: 0.75em 0; list-style-type: none; } .navigation .manual-toc [class^="indent-h"] a { color: #666; } .navigation .manual-toc .indent-h1 a { color: #555; font-weight: 600; display: block; } .manual-toc .indent-h1 { display: block; margin: 0.4em 0 0 0.25em; padding: 0.2em 0 0.2em 0.5em; border-radius: 0.1em; } .manual-root .navigation .manual-toc li:not(.indent-h1) { margin-top: 0.5em; } .manual-toc .indent-h2 { display: none; margin-left: 1.5em; } .manual-toc .indent-h3 { display: none; margin-left: 2.5em; } .manual-toc .indent-h4 { display: none; margin-left: 3.5em; } .manual-toc .indent-h5 { display: none; margin-left: 4.5em; } .manual-nav li { margin: 0.75em 0; } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/css/prettify-tomorrow.css ================================================ /* Tomorrow Theme */ /* Original theme - https://github.com/chriskempson/tomorrow-theme */ /* Pretty printing styles. Used with prettify.js. */ /* SPAN elements with the classes below are added by prettyprint. */ /* plain text */ .pln { color: #4d4d4c; } @media screen { /* string content */ .str { color: #718c00; } /* a keyword */ .kwd { color: #8959a8; } /* a comment */ .com { color: #8e908c; } /* a type name */ .typ { color: #4271ae; } /* a literal value */ .lit { color: #f5871f; } /* punctuation */ .pun { color: #4d4d4c; } /* lisp open bracket */ .opn { color: #4d4d4c; } /* lisp close bracket */ .clo { color: #4d4d4c; } /* a markup tag name */ .tag { color: #c82829; } /* a markup attribute name */ .atn { color: #f5871f; } /* a markup attribute value */ .atv { color: #3e999f; } /* a declaration */ .dec { color: #f5871f; } /* a variable name */ .var { color: #c82829; } /* a function name */ .fun { color: #4271ae; } } /* Use higher contrast and text-weight for printable form. */ @media print, projection { .str { color: #060; } .kwd { color: #006; font-weight: bold; } .com { color: #600; font-style: italic; } .typ { color: #404; font-weight: bold; } .lit { color: #044; } .pun, .opn, .clo { color: #440; } .tag { color: #006; font-weight: bold; } .atn { color: #404; } .atv { color: #060; } } /* Style */ /* pre.prettyprint { background: white; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; line-height: 1.5; border: 1px solid #ccc; padding: 10px; } */ /* Specify class=linenums on a pre to get line numbering */ ol.linenums { margin-top: 0; margin-bottom: 0; } /* IE indents via margin-left */ li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9 { /* */ } /* Alternate shading for lines */ li.L1, li.L3, li.L5, li.L7, li.L9 { /* */ } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/css/search.css ================================================ /* search box */ .search-box { position: absolute; top: 10px; right: 50px; padding-right: 8px; padding-bottom: 10px; line-height: normal; font-size: 12px; } .search-box img { width: 20px; vertical-align: top; } .search-input { display: inline; visibility: hidden; width: 0; padding: 2px; height: 1.5em; outline: none; background: transparent; border: 1px #0af; border-style: none none solid none; vertical-align: bottom; } .search-input-edge { display: none; width: 1px; height: 5px; background-color: #0af; vertical-align: bottom; } .search-result { position: absolute; display: none; height: 600px; width: 100%; padding: 0; margin-top: 5px; margin-left: 24px; background: white; box-shadow: 1px 1px 4px rgb(0,0,0); white-space: nowrap; overflow-y: scroll; } .search-result-import-path { color: #aaa; font-size: 12px; } .search-result li { list-style: none; padding: 2px 4px; } .search-result li a { display: block; } .search-result li.selected { background: #ddd; } .search-result li.search-separator { background: rgb(37, 138, 175); color: white; } .search-box.active .search-input { visibility: visible; transition: width 0.2s ease-out; width: 300px; } .search-box.active .search-input-edge { display: inline-block; } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/css/source.css ================================================ table.files-summary { width: 100%; margin: 10px 0; border-spacing: 0; border: 0; border-collapse: collapse; text-align: right; } table.files-summary tbody tr:hover { background: #eee; } table.files-summary td:first-child, table.files-summary td:nth-of-type(2) { text-align: left; } table.files-summary[data-use-coverage="false"] td.coverage { display: none; } table.files-summary thead { background: #fafafa; } table.files-summary td { border: solid 1px #ddd; padding: 4px 10px; vertical-align: top; } table.files-summary td.identifiers > span { display: block; margin-top: 4px; } table.files-summary td.identifiers > span:first-child { margin-top: 0; } table.files-summary .coverage-count { font-size: 12px; color: #aaa; display: inline-block; min-width: 40px; } .total-coverage-count { position: relative; bottom: 2px; font-size: 12px; color: #666; font-weight: 500; padding-left: 5px; } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/css/style.css ================================================ @import url(https://fonts.googleapis.com/css?family=Roboto:400,300,700); @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600,700); @import url(./manual.css); @import url(./source.css); @import url(./test.css); @import url(./identifiers.css); @import url(./github.css); @import url(./search.css); * { margin: 0; padding: 0; text-decoration: none; } html { font-family: 'Source Sans Pro', 'Roboto', sans-serif; overflow: auto; /*font-size: 14px;*/ /*color: #4d4e53;*/ /*color: rgba(0, 0, 0, .68);*/ color: #555; background-color: #fff; } a { /*color: #0095dd;*/ /*color:rgb(37, 138, 175);*/ color: #039BE5; } code a:hover { text-decoration: underline; } ul, ol { padding-left: 20px; } ul li { list-style: disc; margin: 4px 0; } ol li { margin: 4px 0; } h1 { margin-bottom: 10px; font-size: 34px; font-weight: 300; border-bottom: solid 1px #ddd; } h2 { margin-top: 24px; margin-bottom: 10px; font-size: 20px; border-bottom: solid 1px #ddd; font-weight: 300; } h3 { position: relative; font-size: 16px; margin-bottom: 12px; padding: 4px; font-weight: 300; } details { cursor: pointer; } del { text-decoration: line-through; } p { margin-bottom: 15px; line-height: 1.5; } code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; } pre > code { display: block; } pre.prettyprint, pre > code { padding: 4px; margin: 1em 0; background-color: #f5f5f5; border-radius: 3px; } pre.prettyprint > code { margin: 0; } p > code, li > code { padding: 0.2em 0.5em; margin: 0; font-size: 85%; background-color: rgba(0,0,0,0.04); border-radius: 3px; } .code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13px; } .import-path pre.prettyprint, .import-path pre.prettyprint code { margin: 0; padding: 0; border: none; background: white; } .layout-container { /*display: flex;*/ /*flex-direction: row;*/ /*justify-content: flex-start;*/ /*align-items: stretch;*/ } .layout-container > header { display: flex; height: 40px; line-height: 40px; font-size: 16px; padding: 0 10px; margin: 0; position: fixed; width: 100%; z-index: 1; background-color: #fafafa; top: 0; border-bottom: solid 1px #ddd; } .layout-container > header > a{ margin: 0 5px; color: #444; } .layout-container > header > a.repo-url-github { font-size: 0; display: inline-block; width: 20px; height: 38px; background: url("../image/github.png") no-repeat center; background-size: 20px; vertical-align: top; } .navigation { position: fixed; top: 0; left: 0; box-sizing: border-box; width: 250px; height: 100%; padding-top: 40px; padding-left: 15px; padding-bottom: 2em; margin-top:1em; overflow-x: scroll; box-shadow: rgba(255, 255, 255, 1) -1px 0 0 inset; border-right: 1px solid #ddd; } .navigation ul { padding: 0; } .navigation li { list-style: none; margin: 4px 0; white-space: nowrap; } .navigation li a { color: #666; } .navigation .nav-dir-path { display: block; margin-top: 0.7em; margin-bottom: 0.25em; font-weight: 600; } .kind-class, .kind-interface, .kind-function, .kind-typedef, .kind-variable, .kind-external { margin-left: 0.75em; width: 1.2em; height: 1.2em; display: inline-block; text-align: center; border-radius: 0.2em; margin-right: 0.2em; font-weight: bold; line-height: 1.2em; } .kind-class { color: #009800; background-color: #bfe5bf; } .kind-interface { color: #fbca04; background-color: #fef2c0; } .kind-function { color: #6b0090; background-color: #d6bdde; } .kind-variable { color: #eb6420; background-color: #fad8c7; } .kind-typedef { color: #db001e; background-color: #edbec3; } .kind-external { color: #0738c3; background-color: #bbcbea; } .summary span[class^="kind-"] { margin-left: 0; } h1 .version, h1 .url a { font-size: 14px; color: #aaa; } .content { margin-top: 40px; margin-left: 250px; padding: 10px 50px 10px 20px; } .header-notice { font-size: 14px; color: #aaa; margin: 0; } .expression-extends .prettyprint { margin-left: 10px; background: white; } .extends-chain { border-bottom: 1px solid#ddd; padding-bottom: 10px; margin-bottom: 10px; } .extends-chain span:nth-of-type(1) { padding-left: 10px; } .extends-chain > div { margin: 5px 0; } .description table { font-size: 14px; border-spacing: 0; border: 0; border-collapse: collapse; } .description thead { background: #999; color: white; } .description table td, .description table th { border: solid 1px #ddd; padding: 4px; font-weight: normal; } .flat-list ul { padding-left: 0; } .flat-list li { display: inline; list-style: none; } table.summary { width: 100%; margin: 10px 0; border-spacing: 0; border: 0; border-collapse: collapse; } table.summary thead { background: #fafafa; } table.summary td { border: solid 1px #ddd; padding: 4px 10px; } table.summary tbody td:nth-child(1) { text-align: right; white-space: nowrap; min-width: 64px; vertical-align: top; } table.summary tbody td:nth-child(2) { width: 100%; border-right: none; } table.summary tbody td:nth-child(3) { white-space: nowrap; border-left: none; vertical-align: top; } table.summary td > div:nth-of-type(2) { padding-top: 4px; padding-left: 15px; } table.summary td p { margin-bottom: 0; } .inherited-summary thead td { padding-left: 2px; } .inherited-summary thead a { color: white; } .inherited-summary .summary tbody { display: none; } .inherited-summary .summary .toggle { padding: 0 4px; font-size: 12px; cursor: pointer; } .inherited-summary .summary .toggle.closed:before { content: "▶"; } .inherited-summary .summary .toggle.opened:before { content: "▼"; } .member, .method { margin-bottom: 24px; } table.params { width: 100%; margin: 10px 0; border-spacing: 0; border: 0; border-collapse: collapse; } table.params thead { background: #eee; color: #aaa; } table.params td { padding: 4px; border: solid 1px #ddd; } table.params td p { margin: 0; } .content .detail > * { margin: 15px 0; } .content .detail > h3 { color: black; background-color: #f0f0f0; } .content .detail > div { margin-left: 10px; } .content .detail > .import-path { margin-top: -8px; } .content .detail + .detail { margin-top: 30px; } .content .detail .throw td:first-child { padding-right: 10px; } .content .detail h4 + :not(pre) { padding-left: 0; margin-left: 10px; } .content .detail h4 + ul li { list-style: none; } .return-param * { display: inline; } .argument-params { margin-bottom: 20px; } .return-type { padding-right: 10px; font-weight: normal; } .return-desc { margin-left: 10px; margin-top: 4px; } .return-desc p { margin: 0; } .deprecated, .experimental, .instance-docs { border-left: solid 5px orange; padding-left: 4px; margin: 4px 0; } tr.listen p, tr.throw p, tr.emit p{ margin-bottom: 10px; } .version, .since { color: #aaa; } h3 .right-info { position: absolute; right: 4px; font-size: 14px; } .version + .since:before { content: '| '; } .see { margin-top: 10px; } .see h4 { margin: 4px 0; } .content .detail h4 + .example-doc { margin: 6px 0; } .example-caption { position: relative; bottom: -1px; display: inline-block; padding: 4px; font-style: italic; background-color: #f5f5f5; font-weight: bold; border-radius: 3px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; } .example-caption + pre.source-code { margin-top: 0; border-top-left-radius: 0; } footer, .file-footer { text-align: right; font-style: italic; font-weight: 100; font-size: 13px; margin-right: 50px; margin-left: 270px; border-top: 1px solid #ddd; padding-top: 30px; margin-top: 20px; padding-bottom: 10px; } footer img { width: 24px; vertical-align: middle; padding-left: 4px; position: relative; top: -3px; opacity: 0.6; } pre.source-code { padding: 4px; } pre.raw-source-code > code { padding: 0; margin: 0; font-size: 12px; background: #fff; border: solid 1px #ddd; line-height: 1.5; } pre.raw-source-code > code > ol { counter-reset:number; list-style:none; margin:0; padding:0; overflow: hidden; } pre.raw-source-code > code > ol li:before { counter-increment: number; content: counter(number); display: inline-block; min-width: 3em; color: #aaa; text-align: right; padding-right: 1em; } pre.source-code.line-number { padding: 0; } pre.source-code ol { background: #eee; padding-left: 40px; } pre.source-code li { background: white; padding-left: 4px; list-style: decimal; margin: 0; } pre.source-code.line-number li.active { background: rgb(255, 255, 150) !important; } pre.source-code.line-number li.error-line { background: #ffb8bf; } .inner-link-active { /*background: rgb(255, 255, 150) !important;*/ background: #039BE5 !important; color: #fff !important; padding-left: 0.1em !important; } .inner-link-active a { color: inherit; } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/css/test.css ================================================ table.test-summary thead { background: #fafafa; } table.test-summary thead .test-description { width: 50%; } table.test-summary { width: 100%; margin: 10px 0; border-spacing: 0; border: 0; border-collapse: collapse; } table.test-summary thead .test-count { width: 3em; } table.test-summary tbody tr:hover { background-color: #eee; } table.test-summary td { border: solid 1px #ddd; padding: 4px 10px; vertical-align: top; } table.test-summary td p { margin: 0; } table.test-summary tr.test-interface .toggle { display: inline-block; float: left; margin-right: 4px; cursor: pointer; font-size: 0.8em; padding-top: 0.25em; } table.test-summary tr.test-interface .toggle.opened:before { content: '▼'; } table.test-summary tr.test-interface .toggle.closed:before { content: '▶'; } table.test-summary .test-target > span { display: block; margin-top: 4px; } table.test-summary .test-target > span:first-child { margin-top: 0; } ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/details.html ================================================

    version since

    Override:

    Return:

    Emit:

    Listen:

    Throw:

    Decorators:

    Example:

    Test:

    See:

    TODO:

    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/file.html ================================================

    Sorry, this documentation does not provide source code.

    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/identifiers.html ================================================

    References

    Directories
    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/index.html ================================================
    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/layout.html ================================================
    Home Manual Reference Source Test
    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/manual.html ================================================
    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/manualCardIndex.html ================================================

    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/manualIndex.html ================================================
    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/nav.html ================================================
    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/properties.html ================================================

    NameTypeAttributeDescription
    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/script/inherited-summary.js ================================================ (function(){ function toggle(ev) { var button = ev.target; var parent = ev.target.parentElement; while(parent) { if (parent.tagName === 'TABLE' && parent.classList.contains('summary')) break; parent = parent.parentElement; } if (!parent) return; var tbody = parent.querySelector('tbody'); if (button.classList.contains('opened')) { button.classList.remove('opened'); button.classList.add('closed'); tbody.style.display = 'none'; } else { button.classList.remove('closed'); button.classList.add('opened'); tbody.style.display = 'block'; } } var buttons = document.querySelectorAll('.inherited-summary thead .toggle'); for (var i = 0; i < buttons.length; i++) { buttons[i].addEventListener('click', toggle); } })(); ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/script/inner-link.js ================================================ // inner link(#foo) can not correctly scroll, because page has fixed header, // so, I manually scroll. (function(){ var matched = location.hash.match(/errorLines=([\d,]+)/); if (matched) return; function adjust() { window.scrollBy(0, -55); var el = document.querySelector('.inner-link-active'); if (el) el.classList.remove('inner-link-active'); // ``[ ] . ' " @`` are not valid in DOM id. so must escape these. var id = location.hash.replace(/([\[\].'"@$])/g, '\\$1'); var el = document.querySelector(id); if (el) el.classList.add('inner-link-active'); } window.addEventListener('hashchange', adjust); if (location.hash) { setTimeout(adjust, 0); } })(); (function(){ var els = document.querySelectorAll('[href^="#"]'); var href = location.href.replace(/#.*$/, ''); // remove existed hash for (var i = 0; i < els.length; i++) { var el = els[i]; el.href = href + el.getAttribute('href'); // because el.href is absolute path } })(); ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/script/manual.js ================================================ (function(){ var matched = location.pathname.match(/\/(manual\/.*\.html)$/); if (!matched) return; var currentName = matched[1]; var cssClass = '.navigation .manual-toc li[data-link="' + currentName + '"]'; var styleText = cssClass + '{ display: block; }\n'; styleText += cssClass + '.indent-h1 a { color: #039BE5 }'; var style = document.createElement('style'); style.textContent = styleText; document.querySelector('head').appendChild(style); })(); ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/script/patch-for-local.js ================================================ (function(){ if (location.protocol === 'file:') { var elms = document.querySelectorAll('a[href="./"]'); for (var i = 0; i < elms.length; i++) { elms[i].href = './index.html'; } } })(); ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/script/prettify/Apache-License-2.0.txt ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/script/prettify/prettify.js ================================================ !function(){/* Copyright (C) 2006 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ window.PR_SHOULD_USE_CONTINUATION=!0; (function(){function T(a){function d(e){var b=e.charCodeAt(0);if(92!==b)return b;var a=e.charAt(1);return(b=w[a])?b:"0"<=a&&"7">=a?parseInt(e.substring(1),8):"u"===a||"x"===a?parseInt(e.substring(2),16):e.charCodeAt(1)}function f(e){if(32>e)return(16>e?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return"\\"===e||"-"===e||"]"===e||"^"===e?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[0-9A-Fa-f]{4}|\\x[0-9A-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\s\S]|-|[^-\\]/g);e= [];var a="^"===b[0],c=["["];a&&c.push("^");for(var a=a?1:0,g=b.length;ak||122k||90k||122h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(f(h[1])));c.push("]");return c.join("")}function v(e){for(var a=e.source.match(/(?:\[(?:[^\x5C\x5D]|\\[\s\S])*\]|\\u[A-Fa-f0-9]{4}|\\x[A-Fa-f0-9]{2}|\\[0-9]+|\\[^ux0-9]|\(\?[:!=]|[\(\)\^]|[^\x5B\x5C\(\)\^]+)/g),c=a.length,d=[],g=0,h=0;g/,null])):d.push(["com",/^#[^\r\n]*/,null,"#"]));a.cStyleComments&&(f.push(["com",/^\/\/[^\r\n]*/,null]),f.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));if(b=a.regexLiterals){var v=(b=1|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+ ("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+v+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+v+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&f.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&f.push(["kwd",new RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),null]);d.push(["pln",/^\s+/,null," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");f.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i, null],["lit",/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",new RegExp(b),null]);return G(d,f)}function L(a,d,f){function b(a){var c=a.nodeType;if(1==c&&!A.test(a.className))if("br"===a.nodeName)v(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((3==c||4==c)&&f){var d=a.nodeValue,q=d.match(n);q&&(c=d.substring(0,q.index),a.nodeValue=c,(d=d.substring(q.index+q[0].length))&& a.parentNode.insertBefore(l.createTextNode(d),a.nextSibling),v(a),c||a.parentNode.removeChild(a))}}function v(a){function b(a,c){var d=c?a.cloneNode(!1):a,k=a.parentNode;if(k){var k=b(k,1),e=a.nextSibling;k.appendChild(d);for(var f=e;f;f=e)e=f.nextSibling,k.appendChild(f)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;a=b(a.nextSibling,0);for(var d;(d=a.parentNode)&&1===d.nodeType;)a=d;c.push(a)}for(var A=/(?:^|\s)nocode(?:\s|$)/,n=/\r\n?|\n/,l=a.ownerDocument,m=l.createElement("li");a.firstChild;)m.appendChild(a.firstChild); for(var c=[m],p=0;p=+v[1],d=/\n/g,A=a.a,n=A.length,f=0,l=a.c,m=l.length,b=0,c=a.g,p=c.length,w=0;c[p]=n;var r,e;for(e=r=0;e=h&&(b+=2);f>=k&&(w+=2)}}finally{g&&(g.style.display=a)}}catch(x){E.console&&console.log(x&&x.stack||x)}}var E=window,C=["break,continue,do,else,for,if,return,while"], F=[[C,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],H=[F,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"], O=[F,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],P=[F,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"], F=[F,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],Q=[C,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],R=[C,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],C=[C,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"], S=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,W=/\S/,X=y({keywords:[H,P,O,F,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",Q,R,C],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),I={};t(X,["default-code"]);t(G([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),"default-markup htm html mxml xhtml xml xsl".split(" "));t(G([["pln",/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null, "\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],["pun",/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);t(G([],[["atv",/^[\s\S]+/]]),["uq.val"]);t(y({keywords:H, hashComments:!0,cStyleComments:!0,types:S}),"c cc cpp cxx cyc m".split(" "));t(y({keywords:"null,true,false"}),["json"]);t(y({keywords:P,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:S}),["cs"]);t(y({keywords:O,cStyleComments:!0}),["java"]);t(y({keywords:C,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);t(y({keywords:Q,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);t(y({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END", hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);t(y({keywords:R,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);t(y({keywords:F,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]);t(y({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0, regexLiterals:!0}),["coffee"]);t(G([],[["str",/^[\s\S]+/]]),["regex"]);var Y=E.PR={createSimpleLexer:G,registerLangHandler:t,sourceDecorator:y,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:E.prettyPrintOne=function(a,d,f){f=f||!1;d=d||null;var b=document.createElement("div");b.innerHTML="
    "+a+"
    "; b=b.firstChild;f&&L(b,f,!0);M({j:d,m:f,h:b,l:1,a:null,i:null,c:null,g:null});return b.innerHTML},prettyPrint:E.prettyPrint=function(a,d){function f(){for(var b=E.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;p' + pair[2] + ''); } } var innerHTML = ''; for (kind in html) { var list = html[kind]; if (!list.length) continue; innerHTML += '
  • ' + kind + '
  • \n' + list.join('\n'); } result.innerHTML = innerHTML; if (innerHTML) result.style.display = 'block'; selectedIndex = -1; }); // down, up and enter key are pressed, select search result. input.addEventListener('keydown', function(ev){ if (ev.keyCode === 40) { // arrow down var current = result.children[selectedIndex]; var selected = result.children[selectedIndex + 1]; if (selected && selected.classList.contains('search-separator')) { var selected = result.children[selectedIndex + 2]; selectedIndex++; } if (selected) { if (current) current.classList.remove('selected'); selectedIndex++; selected.classList.add('selected'); } } else if (ev.keyCode === 38) { // arrow up var current = result.children[selectedIndex]; var selected = result.children[selectedIndex - 1]; if (selected && selected.classList.contains('search-separator')) { var selected = result.children[selectedIndex - 2]; selectedIndex--; } if (selected) { if (current) current.classList.remove('selected'); selectedIndex--; selected.classList.add('selected'); } } else if (ev.keyCode === 13) { // enter var current = result.children[selectedIndex]; if (current) { var link = current.querySelector('a'); if (link) location.href = link.href; } } else { return; } ev.preventDefault(); }); // select search result when search result is mouse over. result.addEventListener('mousemove', function(ev){ var current = result.children[selectedIndex]; if (current) current.classList.remove('selected'); var li = ev.target; while (li) { if (li.nodeName === 'LI') break; li = li.parentElement; } if (li) { selectedIndex = Array.prototype.indexOf.call(result.children, li); li.classList.add('selected'); } }); // clear search result when body is clicked. document.body.addEventListener('click', function(ev){ selectedIndex = -1; result.style.display = 'none'; result.innerHTML = ''; }); })(); ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/script/test-summary.js ================================================ (function(){ function toggle(ev) { var button = ev.target; var parent = ev.target.parentElement; while(parent) { if (parent.tagName === 'TR' && parent.classList.contains('test-interface')) break; parent = parent.parentElement; } if (!parent) return; var direction; if (button.classList.contains('opened')) { button.classList.remove('opened'); button.classList.add('closed'); direction = 'closed'; } else { button.classList.remove('closed'); button.classList.add('opened'); direction = 'opened'; } var targetDepth = parseInt(parent.dataset.testDepth, 10) + 1; var nextElement = parent.nextElementSibling; while (nextElement) { var depth = parseInt(nextElement.dataset.testDepth, 10); if (depth >= targetDepth) { if (direction === 'opened') { if (depth === targetDepth) nextElement.style.display = ''; } else if (direction === 'closed') { nextElement.style.display = 'none'; var innerButton = nextElement.querySelector('.toggle'); if (innerButton && innerButton.classList.contains('opened')) { innerButton.classList.remove('opened'); innerButton.classList.add('closed'); } } } else { break; } nextElement = nextElement.nextElementSibling; } } var buttons = document.querySelectorAll('.test-summary tr.test-interface .toggle'); for (var i = 0; i < buttons.length; i++) { buttons[i].addEventListener('click', toggle); } var topDescribes = document.querySelectorAll('.test-summary tr[data-test-depth="0"]'); for (var i = 0; i < topDescribes.length; i++) { topDescribes[i].style.display = ''; } })(); ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/single.html ================================================

    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/source.html ================================================

    Source

    File Identifier Document Size Lines Updated
    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/summary.html ================================================

    version since
    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/test.html ================================================

    Test

    Description Identifier
    ================================================ FILE: esdoc-publish-html-plugin/src/Builder/template/testInterface.html ================================================ ================================================ FILE: esdoc-publish-html-plugin/src/Builder/util.js ================================================ import marked from 'marked'; import escape from 'escape-html'; /** * shorten description. * e.g. ``this is JavaScript. this is Java.`` => ``this is JavaScript.``. * * @param {DocObject} doc - target doc object. * @param {boolean} [asMarkdown=false] - is true, test as markdown and convert to html. * @returns {string} shorten description. * @todo shorten before process markdown. */ export function shorten(doc, asMarkdown = false) { if (!doc) return ''; if (doc.summary) return doc.summary; const desc = doc.descriptionRaw; if (!desc) return ''; let len = desc.length; let inSQuote = false; let inWQuote = false; let inCode = false; for (let i = 0; i < desc.length; i++) { const char1 = desc.charAt(i); const char2 = desc.charAt(i + 1); const char4 = desc.substr(i, 6); const char5 = desc.substr(i, 7); if (char1 === '\'') inSQuote = !inSQuote; else if (char1 === '"') inWQuote = !inWQuote; else if (char4 === '') inCode = true; else if (char5 === '') inCode = false; if (inSQuote || inCode || inWQuote) continue; if (char1 === '.') { if (char2 === ' ' || char2 === '\n' || char2 === '<') { len = i + 1; break; } } else if (char1 === '\n' && char2 === '\n') { len = i + 1; break; } } let result = desc.substr(0, len); if (asMarkdown) { result = markdown(result); } return result; } /** * convert markdown text to html. * @param {string} text - markdown text. * @param {boolean} [breaks=false] if true, break line. FYI gfm is not breaks. * @return {string} html. */ export function markdown(text, breaks = false) { // original render does not support multi-byte anchor const renderer = new marked.Renderer(); renderer.heading = function (text, level) { const id = escapeURLHash(text); return `${text}`; }; const availableTags = ['span', 'a', 'p', 'div', 'img', 'h1', 'h2', 'h3', 'h4', 'h5', 'br', 'hr', 'li', 'ul', 'ol', 'code', 'pre', 'details', 'summary', 'kbd']; const availableAttributes = ['src', 'href', 'title', 'class', 'id', 'name', 'width', 'height', 'target']; const compiled = marked(text, { renderer: renderer, gfm: true, tables: true, breaks: breaks, sanitize: true, sanitizer: (tag) =>{ if (tag.match(//)) { return tag; } const tagName = tag.match(/^<\/?(\w+)/)[1]; if (!availableTags.includes(tagName)) { return escape(tag); } const sanitizedTag = tag.replace(/([\w\-]+)=(["'].*?["'])/g, (_, attr, val)=>{ if (!availableAttributes.includes(attr)) return ''; /* eslint-disable no-script-url */ if (val.indexOf('javascript:') !== -1) return ''; return `${attr}=${val}`; }); return sanitizedTag; }, highlight: function(code) { // return `
    ${escape(code)}
    `; return `${escape(code)}`; } }); return compiled; } /** * get UTC date string. * @param {Date} date - target date object. * @returns {string} UTC date string(yyyy-mm-dd hh:mm:ss) */ export function dateForUTC(date) { function pad(num, len) { const count = Math.max(0, len - `${num}`.length); return '0'.repeat(count) + num; } const year = date.getUTCFullYear(); const month = pad(date.getUTCMonth() + 1, 2); const day = pad(date.getUTCDay() + 1, 2); const hours = pad(date.getUTCHours(), 2); const minutes = pad(date.getUTCMinutes(), 2); const seconds = pad(date.getUTCSeconds(), 2); return `${year}-${month}-${day} ${hours}:${minutes}:${seconds} (UTC)`; } /** * parse ``@example`` value. * ``@example`` value can have ```` tag. * * @param {string} example - target example value. * @returns {{body: string, caption: string}} parsed example value. */ export function parseExample(example) { let body = example; let caption = ''; /* eslint-disable no-control-regex */ const regexp = new RegExp('^(.*?)\n'); const matched = example.match(regexp); if (matched) { body = example.replace(regexp, ''); caption = matched[1].trim(); } return {body, caption}; } /** * escape URL hash. * @param {string} hash - URL hash for HTML a tag and id tag * @returns {string} escaped URL hash */ export function escapeURLHash(hash) { return hash.toLowerCase().replace(/[~!@#$%^&*()_+=\[\]\\{}|;':"<>?,.\/ ]/g, '-'); } ================================================ FILE: esdoc-publish-html-plugin/src/Plugin.js ================================================ import path from 'path'; import {taffy} from 'taffydb'; import IceCap from 'ice-cap'; import DocBuilder from './Builder/DocBuilder'; import StaticFileBuilder from './Builder/StaticFileBuilder.js'; import IdentifiersDocBuilder from './Builder/IdentifiersDocBuilder.js'; import IndexDocBuilder from './Builder/IndexDocBuilder.js'; import ClassDocBuilder from './Builder/ClassDocBuilder.js'; import SingleDocBuilder from './Builder/SingleDocBuilder.js'; import FileDocBuilder from './Builder/FileDocBuilder.js'; import SearchIndexBuilder from './Builder/SearchIndexBuilder.js'; import SourceDocBuilder from './Builder/SourceDocBuilder.js'; import TestDocBuilder from './Builder/TestDocBuilder.js'; import TestFileDocBuilder from './Builder/TestFileDocBuilder.js'; import ManualDocBuilder from './Builder/ManualDocBuilder.js'; class Plugin { onHandleDocs(ev) { this._docs = ev.data.docs; } onPublish(ev) { this._option = ev.data.option || {}; this._template = typeof this._option.template === 'string' ? path.resolve(process.cwd(), this._option.template) : path.resolve(__dirname, './Builder/template'); this._exec(this._docs, ev.data.writeFile, ev.data.copyDir, ev.data.readFile); } _exec(tags, writeFile, copyDir, readFile) { IceCap.debug = !!this._option.debug; const data = taffy(tags); //bad hack: for other plugin uses builder. DocBuilder.createDefaultBuilder = () => { return new DocBuilder(this._template, data, tags); }; let coverage = null; try { coverage = JSON.parse(readFile('coverage.json')); } catch (e) { // nothing } new IdentifiersDocBuilder(this._template, data, tags).exec(writeFile, copyDir); new IndexDocBuilder(this._template, data, tags).exec(writeFile, copyDir); new ClassDocBuilder(this._template, data, tags).exec(writeFile, copyDir); new SingleDocBuilder(this._template, data, tags).exec(writeFile, copyDir); new FileDocBuilder(this._template, data, tags).exec(writeFile, copyDir); new StaticFileBuilder(this._template, data, tags).exec(writeFile, copyDir); new SearchIndexBuilder(this._template, data, tags).exec(writeFile, copyDir); new SourceDocBuilder(this._template, data, tags).exec(writeFile, copyDir, coverage); new ManualDocBuilder(this._template, data, tags).exec(writeFile, copyDir, readFile); const existTest = tags.find(tag => tag.kind.indexOf('test') === 0); if (existTest) { new TestDocBuilder(this._template, data, tags).exec(writeFile, copyDir); new TestFileDocBuilder(this._template, data, tags).exec(writeFile, copyDir); } } } module.exports = new Plugin(); ================================================ FILE: esdoc-publish-html-plugin/test/fixture/CHANGELOG.md ================================================ # Changelog ## 0.0.1 - **Fix** - fix a bug ================================================ FILE: esdoc-publish-html-plugin/test/fixture/README.md ================================================ [![Build Status](https://travis-ci.org/esdoc/esdoc.svg?branch=master)](https://travis-ci.org/esdoc/esdoc) [![Coverage Status](https://coveralls.io/repos/esdoc/esdoc/badge.svg)](https://coveralls.io/r/esdoc/esdoc) # ESDoc Test Fixture this is ESDoc Test Fixture README. - item1 - item2 - item3 1st line. second line. http://github.com/h13i32maru/esdoc ```javascript export default class Foo { static get foo() {} constructor(p1) { } } var foo = 123; ``` | First Header | Second Header | | ------------- | ------------- | | Content Cell | Content Cell | | Content Cell | Content Cell | **text** ~~text~~ # text ## text ### text #### text ##### text ================================================ FILE: esdoc-publish-html-plugin/test/fixture/esdoc.json ================================================ { "source": "./test/fixture/src", "destination": "./test/fixture/out", "index": "./test/fixture/README.md", "package": "./test/fixture/package.json", "plugins": [ {"name": "esdoc-brand-plugin", "option": {"logo": "./test/fixture/logo.png", "image": "https://esdoc.org/manual/asset/image/logo.png"}}, {"name": "esdoc-coverage-plugin"}, {"name": "esdoc-ecmascript-proposal-plugin", "option": {"all": true}}, {"name": "esdoc-external-ecmascript-plugin", "option": {"enable": true}}, {"name": "esdoc-accessor-plugin", "option": {"access": ["public", "protected", "private"], "autoPrivate": true}}, {"name": "esdoc-type-inference-plugin", "option": {"enable": true}}, {"name": "esdoc-undocumented-identifier-plugin"}, {"name": "esdoc-unexported-identifier-plugin"}, {"name": "esdoc-integrate-manual-plugin", "option": { "index": "./test/fixture/manual/index.md", "files": [ "./test/fixture/manual/overview.md", "./test/fixture/manual/design.md", "./test/fixture/manual/installation.md", "./test/fixture/manual/tutorial.md", "./test/fixture/manual/usage1.md", "./test/fixture/manual/usage2.md", "./test/fixture/manual/configuration.md", "./test/fixture/manual/example.md", "./test/fixture/manual/advanced.md", "./test/fixture/manual/faq.md", "./test/fixture/CHANGELOG.md" ] }}, {"name": "esdoc-integrate-test-plugin", "option": { "type": "mocha", "source": "./test/fixture/test", "includes": ["Test.js$"] }}, {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/advanced.md ================================================ # Advanced foo ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/configuration.md ================================================ # Configuration this is configuration. ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/design.md ================================================ # Design ## Concept foo ## Architecture foo ## Model foo ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/example.md ================================================ # Example ## Minimum Config ```json { "source": "./src", "destination": "./doc" } ``` ## Integration Test Code Into Documentation ```json { "source": "./src", "destination": "./doc", "test": { "type": "mocha", "source": "./test" } } ``` ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/faq.md ================================================ # FAQ - [Goal](#goal) ## Goal ESDoc has two goals. The first goal is reducing the cost to write an documentation, it is able to continuously maintenance. The second goal is without looking the source code of a library, it is to be able to use the library. ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/index.md ================================================ # ESDoc Manual tbd ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/installation.md ================================================ # Installation ```sh npm install -g esdoc ``` ## indent 2 ### indent 3 #### indent 4 ##### indent 5 ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/overview.md ================================================ # Overview ESDoc is a documentation generator for JavaScript(ES6). ## Feature - Generates detailed document. - Measures document coverage. - Integrate test codes into documentation. - [ESDoc Hosting Service](https://doc.esdoc.org) ## Demo - [ESDoc](https://esdoc.org/esdoc) is self-hosting 😄 ## License MIT ## Author [Ryo Maruyama@h13i32maru](https://twitter.com/h13i32maru) ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/tutorial.md ================================================ # Tutorial this is tutorial. ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/usage1.md ================================================ # Usage ```sh esdoc -c esdoc.json ``` ``esdoc.json`` ```json { "source": "./src", "destination": "./doc" } ``` ================================================ FILE: esdoc-publish-html-plugin/test/fixture/manual/usage2.md ================================================ # Usage2 this is usage2 ## h2 in usage2 this is h2 in usage2 ### h3 in usage2 this is h2 in usage3 ================================================ FILE: esdoc-publish-html-plugin/test/fixture/package.json ================================================ { "name": "esdoc-test-fixture", "version": "1.2.3", "private": true, "description": "this is esdoc-publish-html-plugin fixture", "author": { "name": "h13i32maru", "url": "http://h13i32maru.jp" }, "homepage": "http://esdoc.org", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc" }, "main": "./src/Class/Definition.js" } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Abstract/Definition.js ================================================ /** * this is TestAbstractDefinition. */ export default class TestAbstractDefinition { /** * this is abstract method1. * @abstract */ method1(){} /** * this is abstract method2. * @abstract */ method2(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Abstract/Override.js ================================================ import TestAbstractDefinition from './Definition'; /** * this is TestAbstractOverride */ export default class TestAbstractOverride extends TestAbstractDefinition { /** * this is override method1. * @override */ method1(){} /** * this is override method2 with automatically detection. */ method2(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Access/Class.js ================================================ /** * this is TestAccessClassPublic. * @public */ export default class TestAccessClassPublic {} /** * this is TestAccessClassProtected. * @protected */ export class TestAccessClassProtected {} /** * this is TestAccessClassPrivate. * @private */ export class TestAccessClassPrivate {} /** * this is TestAccessClassAutoPrivate. */ export class _TestAccessClassAutoPrivate {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Access/Function.js ================================================ /** * this is testAccessFunctionPublic. * @public */ export default function testAccessFunctionPublic(){} /** * this is testAccessFunctionProtected. * @protected */ export function testAccessFunctionProtected(){} /** * this is testAccessFunctionPrivate. * @private */ export function testAccessFunctionPrivate(){} /** * this is testAccessFunctionAutoPrivate. */ export function _testAccessFunctionAutoPrivate(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Access/Method.js ================================================ /** * this is TestAccessMethod. */ export default class TestAccessMethod { /** * this is method1. * @public */ method1(){} /** * this is method2. * @protected */ method2(){} /** * this is method3. * @private */ method3(){} /** * this is _method4. */ _method4(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Access/Property.js ================================================ /** * this is TestAccessProperty. */ export default class TestAccessProperty { constructor() { /** * this is p1. * @public * @type {number} */ this.p1 = 123; /** * this is p2. * @protected * @type {number} */ this.p2 = 123; /** * this is p3. * @private * @type {number} */ this.p3 = 123; /** * this is _p4. * @type {number} */ this._p4 = 123; } } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Access/Variable.js ================================================ /** * this is testAccessVariablePublic. * @type {number} * @public */ export const testAccessVariablePublic = 123; /** * this is testAccessVariableProtected. * @type {number} * @protected */ export const testAccessVariableProtected = 123; /** * this is testAccessVariablePrivate. * @type {number} * @private */ export const testAccessVariablePrivate = 123; /** * this is _testAccessVariableAutoPrivate. * @type {number} */ export const _testAccessVariableAutoPrivate = 123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Async/Function.js ================================================ /** * this is testAsyncFunction. */ export default async function testAsyncFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Async/Method.js ================================================ /** * this is TestAsyncMethod. */ export default class TestAsyncMethod { /** * this is async method1. */ async method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Class/Definition.js ================================================ /** * this is TestClassDefinition. */ export default class TestClassDefinition { /** * this is static method1. */ static method1(){ /** * this is static p1. * @type {number} */ this.p1 = 123; } /** * this is get value1. * @type {number} */ get value1(){} /** * this is set value2. * @type {number} */ set value2(v){} /** * this is constructor. */ constructor(){ /** * this is p1. * @type {number} */ this.p1 = 123; } /** * this is method1. */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/ClassProperty/Definition.js ================================================ /** * this is TestClassPropertyDefinition. * @todo test `Access`, `Deprecated`, `Desc`, `Duplication`, `Example`, `Experimental`, `Guess`, `Ignore`, `Link`, `See`, `Since`, `Todo` and `Version`. */ export default class TestClassPropertyDefinition { /** * this is static p1. * @type {number} */ static p1 = 123; /** * this is p1. * @type {number} */ p1 = 123; } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Computed/Method.js ================================================ /** * this is TestComputedMethod */ export default class TestComputedMethod { /** * this is foo. */ ['foo'](){} /** * this is iterator. */ [Symbol.iterator]() { } /** * this is [foo]. */ [foo](){} /** * this is [foo.bar.baz]. */ [foo.bar.baz](){} /** * this is [foo + bar]. */ [foo + bar](){} /** * this is [foo.p + bar]. */ [foo.p + bar](){} /** * this is [foo()]. */ [foo()](){} /** * this is [foo.bar()]. */ [foo.bar()](){} /** * this is [`${foo}`]. */ [`${foo}`](){} /** * this is *[foo.bar] */ *[foo.bar](){} } /** * @ignore */ const foo = ''; /** * @ignore */ const bar = ''; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Computed/Property.js ================================================ /** * this is TestComputedProperty */ export default class TestComputedProperty { /** * this is constructor. */ constructor(){ /** * this is foo. * @type {number} */ this['foo'] = 123; /** * this is iterator. * @type {number} */ this[Symbol.iterator] = 123; /** * this is [foo]. * @type {number} */ this[foo] = 123; /** * this is [foo.bar]. * @type {number} */ this[foo.bar] = 123; /** * this is [foo.bar.baz]. * @type {number} */ this[foo.bar.baz] = 123; /** * this is [foo + bar]. * @type {number} */ this[foo + bar] = 123; /** * this is [foo.p + bar]. * @type {number} */ this[foo.p + bar] = 123; /** * this is [foo()]. * @type {number} */ this[foo()] = 123; /** * this is [foo.bar()]. * @type {number} */ this[foo.bar()] = 123; /** * this is [`${foo}`]. * @type {number} */ this[`${foo}`] = 123; } } /** * @ignore */ const foo = ''; /** * @ignore */ const bar = ''; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Decorator/Definition.js ================================================ /** * this is TestDecoratorDefinition. */ @testDecoratorAnnotation1 export default class TestDecoratorDefinition { /** * this is static method1. */ @testDecoratorAnnotation1 static method1(){} /** * this is get value1. * @type {number} */ @testDecoratorAnnotation1 get value1(){} /** * this is set value2. * @type {number} */ @testDecoratorAnnotation1 set value2(v){} /** * this is method1. */ @testDecoratorAnnotation1 @testDecoratorAnnotation2(true) method1(){} } /** * this is testDecoratorAnnotation1. */ export function testDecoratorAnnotation1(){} /** * this is testDecoratorAnnotation2. */ export function testDecoratorAnnotation2(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Deprecated/Class.js ================================================ /** * this is TestDeprecatedClass. * @deprecated this is deprecated. */ export default class TestDeprecatedClass { constructor() { /** * this is p1. * @type {number} * @deprecated */ this.p1 = 123; } /** * this is method1. * @deprecated */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Deprecated/Function.js ================================================ /** * this is testDeprecatedFunction. * @deprecated */ export default function testDeprecatedFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Deprecated/Variable.js ================================================ /** * this is testDeprecatedVariable. * @deprecated */ export const testDeprecatedVariable = 123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Desc/Class.js ================================================ /** * @desc this is TestDescClass. */ export default class TestDescClass { /** * @desc this is constructor. */ constructor() { /** * @desc this is p1. * @type {number} */ this.p1 = 123; } /** * @desc this is method1. */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Desc/Function.js ================================================ /** * @desc this is testDescFunction. */ export default function testDescFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Desc/Markdown.js ================================================ /** * this is TestDescMarkdown. * * ```html *
    text
    *
      *
    • item1
    • *
    • item2
    • *
    • item3
    • *
    * ``` * * # Inner Link * - item1 * - item2 * - item3 * * [inner link](#inner-link) * * ```js * let foo = 'this is code block' * ``` * * | Left align | Right align | Center align | * |:-----------|------------:|:------------:| * | This | This | This | * | column | column | column | */ export default class TestDescMarkdown {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Desc/MultiLine.js ================================================ /** * this is TestDescMultiLine. */ export default class TestDescMultiLine { /** * this is method1. * this is second line. */ method1(){} /** * this is method2. this is second sentence. */ method2(){} /** * this is * method3. this is second sentence. */ method3(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Desc/Variable.js ================================================ /** * @desc this is testDescVariable. * @type {number} */ export const testDescVariable = 123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Destructuring/Array.js ================================================ /** * this is TestDestructuringArray. */ export default class TestDestructuringArray { /** * this is method1. * @param {number[]} p - this is p. * @param {number} p[0] - this is first of p. * @param {number} p[1] - this is second of p. */ method1([p1, p2]){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Destructuring/Object.js ================================================ /** * this is TestDestructuringObject. */ export default class TestDestructuringObject { /** * this is method1. * @param {Object} p - this is object p. * @param {number} p.p1 - this is property p1 of p. * @param {string} p.p2 - this is property p2 of p. */ method1({p1, p2}){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Duplication/Definition.js ================================================ /** * this is TestDuplicationDefinition. */ export default class TestDuplicationDefinition { /** * this is constructor. */ constructor() { this.value = 10; this.onClick = this.onClick.bind(this); } /** * this is set value. * @type {number} */ set value(v){} /** * this is get value. * @type {number} */ get value(){} /** * this is onClick. * @param {number} p - this is p. */ onClick(p){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Emits/Function.js ================================================ /** * this is testEmitsFunction. * @emits {TestEmitsFunctionEvent} */ export default function testEmitsFunction(){} export class TestEmitsFunctionEvent {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Emits/Method.js ================================================ /** * this is TestEmitsMethod. */ export default class TestEmitsMethod { /** * this is method1. * @emits {TestEmitsMethodEvent1} emits event when foo. * @emits {TestEmitsMethodEvent2} emits event when bar. */ method1(){} } export class TestEmitsMethodEvent1 {} export class TestEmitsMethodEvent2 {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Example/Caption.js ================================================ /** * this is TestExampleCaption. * @example this is caption * const foo = 123; * console.log(foo); */ export default class TestExampleCaption {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Example/Class.js ================================================ /** * this is TestExampleClass. * @example * const foo = 123; * console.log(foo); * * @example * const bar = 123; * console.log(bar); */ export default class TestExampleClass { /** * this is constructor. * @example * const foo = 123; */ constructor() { /** * this is p1. * @type {number} * @example * const foo = 123; */ this.p1 = 123; } /** * this is method1. * @example * const foo = 123; */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Example/Function.js ================================================ /** * this is testExampleFunction. * @example * const foo = 123; */ export default function testExampleFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Example/Variable.js ================================================ /** * this is testExampleVariable. * @type {number} * @example * const foo = 123; */ export const testExampleVariable = 123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Experimental/Class.js ================================================ /** * this is TestExperimentalClass. * @experimental this is experimental */ export default class TestExperimentalClass { /** * this is constructor. */ constructor(){ /** * this is p1. * @type {number} * @experimental */ this.p1 = 123; } /** * this is method1. * @experimental */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Experimental/Function.js ================================================ /** * this is testExperimentalFunction. * @experimental */ export default function testExperimentalFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Experimental/Variable.js ================================================ /** * this is testExperimentalVariable. * @type {number} * @experimental */ export const testExperimentalVariable =123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/ExponentiationOperator/Definition.js ================================================ /** * this is TestExponentiationOperatorDefinition. */ export default class TestExponentiationOperatorDefinition { /** * this is method1. * @return {number} */ method1(){ return 2 ** 3 ; } } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/AnonymousClass.js ================================================ /** * this is anonymous class. */ export default class {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/AnonymousFunction.js ================================================ /** * this is anonymous function. */ export default function(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/ArrowFunction.js ================================================ /** * this is ArrowFunction. */ export default ()=>{} /** * this is testExportArrowFunction2. */ export const testExportArrowFunction2 = ()=>{}; /** * this is testExportArrowFunction3. */ const testExportArrowFunction3 = ()=>{}; // this is undocument export const testExportArrowFunction4 = ()=>{}; /** * this is testExportArrowFunction5. */ const testExportArrowFunction5 = ()=>{}; export {testExportArrowFunction5}; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/Class.js ================================================ /** * this is TestExportClass1. */ export default class TestExportClass1 {} /** * this is TestExportClass2. */ export class TestExportClass2 {} /** * this is TestExportClass3. */ class TestExportClass3 {} export {TestExportClass3}; /** * this is TestExportClass4. */ const TestExportClass4 = class {}; export {TestExportClass4}; // this is undocument. export class TestExportClass5 {} /** * this is TestExportClass6. */ class TestExportClass6 {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/ClassIndirectDefault.js ================================================ /** * this is TestExportClassIndirectDefault. */ class TestExportClassIndirectDefault {} export default TestExportClassIndirectDefault; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/Default.js ================================================ /** * this is TestExportDefault. */ export default class TestExportDefault {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/Extends.js ================================================ /** * this is TestExportExtendsInner. */ class TestExportExtendsInner {} /** * this is TestExportExtends. */ export class TestExportExtends extends TestExportExtendsInner {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/Function.js ================================================ /** * this is testExportFunction1. */ export default function testExportFunction1(){} /** * this is testExportFunction2. */ export function testExportFunction2(){} /** * this is testExportFunction3. */ export const testExportFunction3 = function(){}; /** * this is testExportFunction4. */ function testExportFunction4(){} /** * this is testExportFunction5. */ const testExportFunction5 = function(){}; /** * this is testExportFunction6. */ export function *testExportFunction6(){} // this is undocument export function testExportFunction7(){} /** * this is testExportFunction8. */ function testExportFunction8() {} export {testExportFunction8}; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/FunctionIndirectDefault.js ================================================ /** * this is testExportFunctionIndirectDefault */ function testExportFunctionIndirectDefault() {} export default testExportFunctionIndirectDefault; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/Multiple.js ================================================ /** * this is TestExportMultiple */ class TestExportMultiple {} /** * this is instance of TestExportMultiple. */ const testExportMultiple = new TestExportMultiple(); export {TestExportMultiple, testExportMultiple}; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/Named.js ================================================ /** * this is TestExportNamed. */ export class TestExportNamed {} export {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/NewExpression.js ================================================ /** * this is TestExportNewExpression. */ class TestExportNewExpression {} /** * this is instance of TestExportNewExpression. */ export default new TestExportNewExpression(); /** * this is TestExportNewExpression2. */ class TestExportNewExpression2 {} /** * this is instance of TestExportNewExpression2. */ export const testExportNewExpression2 = new TestExportNewExpression2(); ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/NewExpressionIndirect.js ================================================ /** * this is TestExportNewExpressionIndirect. */ class TestExportNewExpressionIndirect {} /** * @ignore */ const testExportNewExpressionIndirect = new TestExportNewExpressionIndirect(); /** * this is instance of TestExportNewExpressionIndirect. */ export default testExportNewExpressionIndirect; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/NewExpressionProperty.js ================================================ /** * this is TestExportNewExpressionProperty. */ class TestExportNewExpressionProperty {} const obj = {}; obj.TestExportNewExpressionProperty = TestExportNewExpressionProperty; /** * this is instance of TestExportNewExpressionProperty. */ export default new obj.TestExportNewExpressionProperty(); ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/Variable.js ================================================ /** * this is testExportVariable1. * @type {Object} * @property {number} p1 - this is p1. * @property {string[]} p2 - this is p2. */ export default testExportVariable1 = {}; /** * this is testExportVariable2. * @type {number} */ export const testExportVariable2 = 123; /** * this is testExportVariable3. * @type {number} */ const testExportVariable3 = 123; // this is undocument export const testExportVariable4 = 123; export const testExportVariable5 = []; /** * this is testExportVariable6. * @type {Object} * @property {number} p1 - this is p1. * @property {string} p2 - this is p2. */ const testExportVariable6 = {}; export {testExportVariable6}; /** * this is testExportVariable7 with unknown type. * @see https://github.com/esdoc/esdoc/issues/75 */ export const testExportVariable7 = new foo.Bar(); ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Export/VariableIndirectDefault.js ================================================ /** * this is testExportVariableIndirectDefault. * @type {{x1: number, x2: string}} */ const testExportVariableIndirectDefault = {}; export default testExportVariableIndirectDefault; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Extends/Builtin.js ================================================ /** * this is TestExtendsBuiltin. */ export default class TestExtendsBuiltin extends Array { method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Extends/Deep.js ================================================ export class TestExtendsDeepShape extends Array { static get staticValueShape(){} static set staticValueShape(v){} static staticMethodShape(){ this.staticPShape = 123; } get valueShape(){} set valueShape(v){} methodShape() { this.pShape = 123; } } export class TestExtendsDeepRectangle extends TestExtendsDeepShape { static get staticValueRectangle(){} static set staticValueRectangle(v){} static staticMethodRectangle(){ this.staticPRectangle = 123; } get valueRectangle(){} set valueRectangle(v){} methodRectangle(){ this.pRectangle = 123; } } export default class TestExtendsDeepSquare extends TestExtendsDeepRectangle { static get staticValueSquare(){} static set staticValueSquare(v){} static staticMethodSquare(){ this.staticPSquare = 123; } get valueSquare(){} set valueSquare(v){} methodSquare(){ this.pSquare = 123; } } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Extends/Expression.js ================================================ /** * this is TestExtendsExpressionInner. */ function TestExtendsExpressionInner(){} /** * this is TestExtendsExpression. */ export default class TestExtendsExpression extends TestExtendsExpressionInner(123) { method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Extends/Inner.js ================================================ class _TestExtendsInner { /** * this is method1. */ method1(){} /** * this is method2. */ method2(){} } /** * this is TestExtendsInner. */ export default class TestExtendsInner extends _TestExtendsInner { /** * this is method1 with override. */ method1(){} /** * this is method3. */ method3(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Extends/Mixin.js ================================================ /** * @ignore * @param a * @param b */ function mixin(a, b){} export class TestExtendsMixinInner1 { /** * this is method1. */ method1(){} } export class TestExtendsMixinInner2 { /** * this is method2. */ method2(){} } /** * this is TestExtendsMixin. */ export default class TestExtendsMixin extends mixin(TestExtendsMixinInner1, TestExtendsMixinInner2) { /** * this is method3. */ method3(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Extends/Outer.js ================================================ import TestExtendsBuiltin from './Builtin.js'; /** * this is TextExtendsOuter. */ export default class TestExtendsOuter extends TestExtendsBuiltin { /** * this is method1. */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Extends/Property.js ================================================ import obj from 'TestExtendsPropertyPackage'; /** * this is TestExtendsProperty. */ export default class TestExtendsProperty extends obj.TestExtendsPropertyInner {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/External/Definition.js ================================================ /** * @external {TestExternalDefinition} http://example.com */ ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Generator/Function.js ================================================ /** * this is testGeneratorFunction. */ export default function *testGeneratorFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Generator/Method.js ================================================ /** * this is TestGeneratorMethod. */ export default class TestGeneratorMethod { /** * this is generator method1. */ *method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Ignore/Class.js ================================================ /** * this is TestIgnoreClass1. * @ignore */ export default class TestIgnoreClass1 { method1(){} } /** * this is TestIgnoreClass2. */ export class TestIgnoreClass2 { /** * this is constructor. */ constructor(){ /** * this is p1. * @type {number} * @ignore */ this.p1 = 123; } /** * this is method1. * @ignore */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Ignore/Function.js ================================================ /** * this is testIgnoreFunction. * @ignore */ export default function testIgnoreFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Ignore/Variable.js ================================================ /** * this is testIgnoreVariable. * @type {number} * @ignore */ export const testIgnoreVariable = 123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Interface/Definition.js ================================================ /** * this is TestInterfaceDefinition * @interface */ export default class TestInterfaceDefinition { /** * this is interface method1. */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Interface/Implements.js ================================================ /** * this is TestInterfaceImplements. * @implements {TestInterfaceDefinition} * @implements {TestInterfaceImplementsInner} */ export default class TestInterfaceImplements { /** * this is implements method1. */ method1(){} /** * this is implements method2. */ method2(){} } /** * this is TestInterfaceImplementsInner * @interface */ export class TestInterfaceImplementsInner { /** * this is interface method2. */ method2(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Invalid/CodeSyntax.js ================================================ this is invalid syntax. ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Invalid/DocSyntax.js ================================================ /** * @param {} p */ function testInvalidCodeSyntax(p){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Link/Class.js ================================================ /** * this is TestLinkClass. * link to {@link testLinkFunction} */ export default class TestLinkClass { /** * this is constructor. * link to {@link testLinkFunction} */ constructor(){ /** * this is p1. * link to {@link testLinkFunction} * @type {number} */ this.p1 = 123; } /** * this is method1. * link to {@link testLinkFunction} */ method1(){} } export class TestLinkClass2 extends TestLinkClass { } export class TestLinkClass3 extends TestLinkClass2 { /** * {@link TestLinkClass2#method1} */ method1FooBar() { } } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Link/Function.js ================================================ /** * this is testLinkFunction. * link to {@link TestLinkClass} * link to {@link TestLinkClass#p1} * link to {@link TestLinkClass#method1} */ export default function testLinkFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Link/Variable.js ================================================ /** * this is testLinkVariable. * link to {@link TestLinkClass} * @type {number} */ export const testLinkVariable = 123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Listens/Function.js ================================================ /** * this is testListensFunction. * @listens {TestListensFunctionEvent} */ export default function testListensFunction(){} /** * this is TestListensFunctionEvent. */ export class TestListensFunctionEvent {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Listens/Method.js ================================================ /** * this is TestListensMethod. */ export default class TestListensMethod { /** * this is method1. * @listens {TestListensMethodEvent1} listen event because foo. * @listens {TestListensMethodEvent2} listen event because bar. */ method1(){} } /** * this is TestListensMethodEvent1. */ export class TestListensMethodEvent1 {} /** * this is TestListensMethodEvent2. */ export class TestListensMethodEvent2 {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Param/Function.js ================================================ /** * this is testParamFunction. * @param {number} p1 - this is p1. * @param {TestClassDefinition} p2 - this is p2. */ export default function testParamFunction(p1, p2){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Param/Method.js ================================================ /** * this is TestParamMethod. */ export default class TestParamMethod { /** * this is method1. * @param {number} p1 - this is p1. * @param {TestClassDefinition} p2 - this is p2. */ method1(p1, p2){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Property/Return.js ================================================ /** * this is TestPropertyReturn. */ export default class TestPropertyReturn { /** * this is method1. * @return {Object} - this is return value. * @property {number} x1 - this is x1 of return value. * @property {TestClassDefinition} x2 - this is x2 of return value. */ method1(){ return {}; } } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Return/Function.js ================================================ /** * this is testReturnFunction1. * @returns {TestClassDefinition} - this is return value. */ export default function testReturnFunction1(){} /** * this is testReturnFunction2. * @returns {number} - this is return value. */ export function testReturnFunction2(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Return/Method.js ================================================ /** * this is TestReturnMethod. */ export default class TestReturnMethod { /** * this is method1. * @returns {number} - this is return value. */ method1(){ return 123; } /** * this is method2. * @returns {TestClassDefinition} - this is return value. */ method2(){ } } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/See/Class.js ================================================ /** * this is TestSeeClass. * @see http://foo.example.com * @see http://bar.example.com */ export default class TestSeeClass { /** * this is constructor. * @see http://example.com */ constructor(){ /** * this is p1. * @type {number} * @see http://example.com */ this.p1 = 123; } /** * this is method1. * @see http://example.com */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/See/Function.js ================================================ /** * this is testSeeFunction. * @see http://example.com */ export default function testSeeFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/See/Variable.js ================================================ /** * this is testSeeVariable. * @type {number} * @see http://example.com */ export const testSeeVariable = 123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Since/Class.js ================================================ /** * this TestSinceClass. * @since 1.2.3 */ export default class TestSinceClass { /** * this is constructor. * @since 1.2.3 */ constructor() { /** * this is p1. * @type {number} * @since 1.2.3 */ this.p1 = 123; } /** * this is method1. * @since 1.2.3 */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Since/Function.js ================================================ /** * this is testSinceFunction. * @since 1.2.3 */ export default function testSinceFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Since/Variable.js ================================================ /** * this is testSinceVariable. * @type {number} * @since 1.2.3 */ export const testSinceVariable =123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Throws/Function.js ================================================ /** * this is testThrowsFunction. * @throws {TestThrowsFunctionError} */ export default function testThrowsFunction(){} /** * this is TestThrowsFunctionError. */ export class TestThrowsFunctionError {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Throws/Method.js ================================================ /** * this is TestThrowsMethod. */ export default class TestThrowsMethod { /** * this is method1. * @throws {TestThrowsMethodError1} throw error if foo. * @throws {TestThrowsMethodError2} throw error if bar. */ method1(){} } /** * this is TestThrowsMethodError1. */ export class TestThrowsMethodError1 {} /** * this is TestThrowsMethodError2. */ export class TestThrowsMethodError2 {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Todo/Class.js ================================================ /** * this is TestTodoClass. * @todo this is first todo. * @todo this is second todo. */ export default class TestTodoClass { /** * this is constructor. * @todo this is todo. */ constructor() { /** * this is p1. * @type {number} * @todo this is todo. */ this.p1 = 123; } /** * this is method1. * @todo this is todo. */ method1() {} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Todo/Function.js ================================================ /** * this is testTodoFunction. * @todo this is todo. */ export default function testTodoFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Todo/Variable.js ================================================ /** * this is testTodoVariable. * @todo this is todo. */ export const testTodoVariable = 123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/TrailingComma/Definition.js ================================================ /** * this is TestTrailingCommaDefinition. */ export default class TestTrailingCommaDefinition { /** * this is method1. * @param {number} p1 - this is p1. * @param {string} p2 - this is p2. */ method1(p1, p2,) {} /** * this is method2. */ method2(){ this.method1(1, 'abc',); } } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Array.js ================================================ /** * this is TestTypeArray. */ export default class TestTypeArray { /** * this is method1. * @param {number[]} p1 - this is number array p1. */ method1(p1){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Class.js ================================================ export default class TestTypeClass { /** * this is method1. * @param {TestTypeClassInner} p1 - this is class p1. */ method1(p1){} } export class TestTypeClassInner {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Complex.js ================================================ export default class TestTypeComplex { // function /** * this is method1. * @param {function(x1: number[], x2: Map): Object} p1 - this is p1. */ method1(p1){} // generics /** * this is method2. * @param {Map} p1 - this is p1. */ method2(p1){} // record /** * this is method3. * @param {{x1: number[], x2: Map, x3: {y1: number, y2: string}}} p1 - this is p1. */ method3(p1){} // union /** * this is method4. * @param {?(number|string)} p1 - this is p1. * @param {!(number|string)} p2 - this is p2. */ method4(p1, p2){} // union in generics /** * this is method5. * @param {Promise} p1 - this is p1. */ method5(p1){} // union with spread /** * this is method6. * @param {...(number|string)} p1 - this is p1. */ method6(...p1){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Default.js ================================================ /** * this is TestTypeDefault. */ export default class TestTypeDefault { /** * this is method1. * @param {number} [p1=123] - this is default number p1. * @param {string[]} [p2=[]] - this is default string array p2. */ method1(p1 = 123, p2 = []){} /** * this is method2. * @param {Foo} [p1 = new Foo()] - this is default object p1. */ method2(p1 = new Foo()){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/External.js ================================================ /** * this is TestTypeExternal */ export default class TestTypeExternal { /** * this is method1. * @param {ArrayBuffer} p1 - this external p1. */ method1(p1){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Function.js ================================================ /** * this is TestTypeFunction. */ export default class TestTypeFunction { /** * this is method1. * @param {function(x1: number, x2: string): boolean} p1 - this is function p1. */ method1(p1){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Generics.js ================================================ /** * this is TestTypeGenerics. */ export default class TestTypeGenerics { /** * this is method1. * @param {Array} p1 - this is array p1. * @param {Map} p2 - this map p2. * @param {Promise} p3 - this is promise p3. */ method1(p1, p2, p3){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Literal.js ================================================ /** * this is TestTypeLiteral. */ export default class TestTypeLiteral { /** * this is method1. * @param {number} p1 - this is number p1. * @param {string} p2 - this is string p2. * @param {boolean} p3 - this is boolean p3. */ method1(p1, p2, p3){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Nullable.js ================================================ export default class TypeTestNullable { /** * this is method1 * @param {?number} p1 - this is nullable number p1. * @param {!string} p2 - this is not nullable string p2. */ method1(p1, p2){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Object.js ================================================ /** * this is TestTypeObject. */ export default class TestTypeObject { /** * this is method1. * @param {Object} p1 - this is object p1. * @param {number} p1.x1 - this is number x1. */ method1(p1){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Optional.js ================================================ /** * this is TestTypeOptional. */ export default class TestTypeOptional { /** * this is method1. * @param {number} [p1] - this is optional number p1. */ method1(p1){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Record.js ================================================ /** * this is TestTypeRecord. */ export default class TestTypeRecord { /** * this is method1. * @param {{x1: number, x2: string}} p1 - this is record p1. */ method1(p1){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Spread.js ================================================ /** * this is TestTypeSpread. */ export default class TestTypeSpread { /** * this is method1. * @param {...number} p1 - this is spread number p1. */ method1(...p1){} /** * this is method2. * @param {Object} config - this is config. * @param {number} config.x - this is number x. * @param {string} config.y - this is string y. * @param {number[]} config.a - thi is number[] a. * @param {string[]} config.b - thi is number[] b. */ method2({x, y, ...z}){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Typedef.js ================================================ /** * @typedef {Object} TestTypeTypedefInner */ /** * this is TestTypedef. */ export default class TestTypeTypedef { /** * this is method1. * @param {TestTypeTypedefInner} p1 - this is typedef p1. */ method1(p1){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Type/Union.js ================================================ /** * this is TestTypeUnion. */ export default class TestTypeUnion { /** * this is method1. * @param {number|string} p1 - this is number or string p1. */ method1(p1){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Typedef/Definition.js ================================================ /** * this is TestTypedefDefinition. * @typedef {Object} TestTypedefDefinition * @property {number} p1 - this is p1. */ ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Undocument/Definition.js ================================================ // this is undocument. export default class TestUndocumentDefinition {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Unknown/Definition.js ================================================ /** * this is TestUnknownDefinition. * @foobar this is unknown tag. */ export default class TestUnknownDefinition {} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Variable/ArrayPattern.js ================================================ /** * this is testVariableArrayPattern1. * @type {number} */ export const [testVariableArrayPattern1, testVariableArrayPattern2] = [1, 2]; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Variable/Definition.js ================================================ /** * this is testVariableDefinition. * @type {number} */ export const testVariableDefinition = 123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Variable/ObjectPattern.js ================================================ /** * this is testVariableObjectPattern1. * @type {number} */ export const {testVariableObjectPattern1, testVariableObjectPattern2} = {testVariableObjectPattern1: 1, testVariableObjectPattern2: 2}; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Version/Class.js ================================================ /** * this is TestVersionClass. * @version 1.2.3 */ export default class TestVersionClass { /** * this is constructor. * @version 1.2.3 */ constructor(){ /** * this is p1. * @type {number} * @version 1.2.3 */ this.p1 = 123; } /** * this is method1. * @version 1.2.3 */ method1(){} } ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Version/Function.js ================================================ /** * this is testVersionFunction. * @version 1.2.3 */ export default function testVersionFunction(){} ================================================ FILE: esdoc-publish-html-plugin/test/fixture/src/Version/Variable.js ================================================ /** * this is testVersionVariable. * @type {number} * @version 1.2.3 */ export const testVersionVariable = 123; ================================================ FILE: esdoc-publish-html-plugin/test/fixture/test/DescTest.js ================================================ /** @test {TestDescClass} */ describe('Use describe style mocha interface', ()=>{ /** @test {TestDescClass#constructor} */ it('Use it style mocha interface', ()=>{ }); /** @test {TestDescClass#p1} */ describe('Nested describe', ()=>{ /** @test {testDescVariable} */ it('Nested it in describe', ()=>{ }); }); /** @test {TestDescClass#method1} */ context('Use context style mocha interface', ()=>{ /** @test {testDescFunction} */ it('Nested it in context', ()=>{ }); }); }); /** @test {TestDescClass} */ suite('Use suite style mocha interface', ()=>{ /** @test {TestDescClass#constructor} */ test('Use test style mocha interface', ()=>{ }); /** @test {TestDescClass#p1} */ suite('Nested suite', ()=>{ /** @test {TestDescClass#method1} */ test('Nested test', ()=>{ }); }) }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/AbstractTest/DefinitionTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {DocBuilder} */ describe('TestAbstractDefinition:', ()=> { const doc = readDoc('class/src/Abstract/Definition.js~TestAbstractDefinition.html'); /** @test {DocBuilder#_buildSummaryDoc} */ it('has abstract method in summary.', ()=> { find(doc, '[data-ice="summary"]', (doc)=> { assert.includes(doc, '[data-ice="target"]:nth-of-type(1)', 'public abstract method1() this is abstract method1'); assert.includes(doc, '[data-ice="target"]:nth-of-type(2)', 'public abstract method2() this is abstract method2'); }); }); /** @test {DocBuilder#_buildDetailDocs} */ it('has abstract method in detail.', ()=>{ assert.includes(doc, '[data-ice="detail"]:nth-of-type(1)', 'public abstract method1()'); assert.includes(doc, '[data-ice="detail"]:nth-of-type(2)', 'public abstract method2()'); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/AbstractTest/OverrideTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {DocBuilder} */ describe('TestAbstractOverrideDefinition:', ()=> { const doc = readDoc('class/src/Abstract/Override.js~TestAbstractOverride.html'); /** @test {DocBuilder#_buildOverrideMethod} */ it('has override description in summary.', ()=> { find(doc, '[data-ice="detail"]:nth-of-type(1)', (doc)=> { assert.includes(doc, '[data-ice="override"] a', 'TestAbstractDefinition#method1'); assert.includes(doc, '[data-ice="override"] a', 'class/src/Abstract/Definition.js~TestAbstractDefinition.html#instance-method-method1', 'href'); }); find(doc, '[data-ice="detail"]:nth-of-type(2)', (doc)=> { assert.includes(doc, '[data-ice="override"] a', 'TestAbstractDefinition#method2'); assert.includes(doc, '[data-ice="override"] a', 'class/src/Abstract/Definition.js~TestAbstractDefinition.html#instance-method-method2', 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/AsyncTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {FunctionDoc#_$async} */ describe('testAsyncFunction', ()=> { const doc = readDoc('function/index.html'); describe('in summary', ()=> { it('has async mark', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-function-testAsyncFunction"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public async testAsyncFunction()'); }); }); }); describe('in details', ()=>{ it('has async mark.', ()=>{ findParent(doc, '[id="static-function-testAsyncFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public async testAsyncFunction()'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/AsyncTest/MethodTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {MethodDoc#_$async} */ describe('TestAsyncMethod', ()=> { const doc = readDoc('class/src/Async/Method.js~TestAsyncMethod.html'); describe('in summary', ()=> { it('has async mark.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public async method1()'); }); }); }); describe('in details', ()=>{ it('has async mark.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public async method1()'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ClassPropertyTest/DefinitionTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {ClassDocBuilder} */ describe('TestClassPropertyDefinition:', ()=> { const doc = readDoc('class/src/ClassProperty/Definition.js~TestClassPropertyDefinition.html'); /** @test {ClassDocBuilder#_buildClassDoc} */ describe('in summary', ()=>{ it('has static member', ()=>{ find(doc, '[data-ice="staticMemberSummary"]', (doc)=>{ find(doc, 'table[data-ice="summary"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '[data-ice="target"]:nth-of-type(1)', 'public static p1: number this is static p1.'); assert.includes(doc, '[data-ice="target"]:nth-of-type(1) [data-ice="name"] a', 'class/src/ClassProperty/Definition.js~TestClassPropertyDefinition.html#static-member-p1', 'href'); }); }); }); it('has member.', ()=>{ find(doc, '[data-ice="memberSummary"]', (doc)=>{ find(doc, 'table[data-ice="summary"]:nth-of-type(1)', (doc)=> { assert.includes(doc, '[data-ice="target"]:nth-of-type(1)', 'public p1: number this is p1.'); assert.includes(doc, '[data-ice="target"]:nth-of-type(1) [data-ice="name"] a', 'class/src/ClassProperty/Definition.js~TestClassPropertyDefinition.html#instance-member-p1', 'href'); }); }); }); }); /** @test {ClassDocBuilder#_buildClassDoc} */ describe('in detail', ()=>{ it('has static member.', ()=>{ find(doc, '[data-ice="staticMemberDetails"]', (doc)=>{ find(doc, '[data-ice="detail"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '#static-member-p1', 'public static p1: number'); assert.includes(doc, '[data-ice="description"]', 'this is static p1.'); }); }); }); it('has member.', ()=>{ find(doc, '[data-ice="memberDetails"]', (doc)=>{ find(doc, '[data-ice="detail"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '#instance-member-p1', 'public p1: number'); assert.includes(doc, '#instance-member-p1 + [data-ice="description"]', 'this is p1.'); }); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ClassTest/DefinitionTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {ClassDocBuilder} */ describe('TestClassDefinition:', ()=> { const doc = readDoc('class/src/Class/Definition.js~TestClassDefinition.html'); /** @test {DocBuilder#_getTitle} */ describe('in title:', ()=>{ it('has document title', ()=> { assert.includes(doc, 'head title', 'TestClassDefinition'); }); }); /** @test {ClassDocBuilder#_buildClassDoc} */ describe('in header', ()=>{ it('has header notice.', ()=> { find(doc, '[data-ice="content"] .header-notice', (doc)=> { assert.includes(doc, '[data-ice="importPath"]', "import TestClassDefinition from 'esdoc-test-fixture'"); assert.includes(doc, '[data-ice="access"]', 'public'); assert.includes(doc, '[data-ice="kind"]', 'class'); assert.includes(doc, '[data-ice="source"]', 'source'); assert.includes(doc, '[data-ice="source"] a', 'file/src/Class/Definition.js.html#lineNumber4', 'href'); }); }); }); /** @test {ClassDocBuilder#_buildClassDoc} */ describe('in detail', ()=>{ it('has self detail.', ()=>{ find(doc, '[data-ice="content"] .self-detail', (doc)=>{ assert.includes(doc, '[data-ice="name"]', 'TestClassDefinition'); assert.includes(doc, '[data-ice="description"]', 'this is TestClassDefinition.'); }); }); }); /** @test {ClassDocBuilder#_buildClassDoc} */ describe('in summary', ()=>{ it('has static member', ()=>{ find(doc, '[data-ice="staticMemberSummary"]', (doc)=>{ find(doc, 'table[data-ice="summary"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '[data-ice="target"]:nth-of-type(1)', 'public static p1: number this is static p1.'); assert.includes(doc, '[data-ice="target"]:nth-of-type(1) [data-ice="name"] a', 'class/src/Class/Definition.js~TestClassDefinition.html#static-member-p1', 'href'); }); }); }); it('has static method.', ()=>{ find(doc, '[data-ice="staticMethodSummary"]', (doc)=>{ find(doc, 'table[data-ice="summary"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '[data-ice="target"]:nth-of-type(1)', 'public static method1() this is static method1.'); assert.includes(doc, '[data-ice="target"]:nth-of-type(1) a', 'class/src/Class/Definition.js~TestClassDefinition.html#static-method-method1', 'href'); }); }); }); it('has constructor.', ()=>{ find(doc, '[data-ice="constructorSummary"]', (doc)=>{ find(doc, 'table[data-ice="summary"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '[data-ice="target"]:nth-of-type(1)', 'public constructor() this is constructor.'); assert.includes(doc, '[data-ice="target"]:nth-of-type(1) [data-ice="name"] a', 'class/src/Class/Definition.js~TestClassDefinition.html#instance-constructor-constructor', 'href'); }); }); }); it('has member.', ()=>{ find(doc, '[data-ice="memberSummary"]', (doc)=>{ find(doc, 'table[data-ice="summary"]:nth-of-type(1)', (doc)=> { assert.includes(doc, '[data-ice="target"]:nth-of-type(1)', 'public p1: number this is p1.'); assert.includes(doc, '[data-ice="target"]:nth-of-type(1) [data-ice="name"] a', 'class/src/Class/Definition.js~TestClassDefinition.html#instance-member-p1', 'href'); assert.includes(doc, '[data-ice="target"]:nth-of-type(2)', 'public get value1: number this is get value1.'); assert.includes(doc, '[data-ice="target"]:nth-of-type(2) [data-ice="name"] a', 'class/src/Class/Definition.js~TestClassDefinition.html#instance-get-value1', 'href'); assert.includes(doc, '[data-ice="target"]:nth-of-type(3)', 'public set value2: number this is set value2.'); assert.includes(doc, '[data-ice="target"]:nth-of-type(3) [data-ice="name"] a', 'class/src/Class/Definition.js~TestClassDefinition.html#instance-set-value2', 'href'); }); }); }); it('has method summary.', ()=>{ find(doc, '[data-ice="methodSummary"]', (doc)=>{ find(doc, 'table[data-ice="summary"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '[data-ice="target"]:nth-of-type(1)', 'public method1() this is method1.'); assert.includes(doc, '[data-ice="target"]:nth-of-type(1) [data-ice="name"] a', 'class/src/Class/Definition.js~TestClassDefinition.html#instance-method-method1', 'href'); }); }); }); }); /** @test {ClassDocBuilder#_buildClassDoc} */ describe('in detail', ()=>{ it('has static member.', ()=>{ find(doc, '[data-ice="staticMemberDetails"]', (doc)=>{ find(doc, '[data-ice="detail"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '#static-member-p1', 'public static p1: number'); assert.includes(doc, '[data-ice="description"]', 'this is static p1.'); }); }); }); it('has static method.', ()=>{ find(doc, '[data-ice="staticMethodDetails"]', (doc)=>{ find(doc, '[data-ice="detail"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '#static-method-method1', 'public static method1()'); assert.includes(doc, '[data-ice="description"]', 'this is static method1.'); }); }); }); it('has member.', ()=>{ find(doc, '[data-ice="memberDetails"]', (doc)=>{ find(doc, '[data-ice="detail"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '#instance-member-p1', 'public p1: number'); assert.includes(doc, '#instance-member-p1 + [data-ice="description"]', 'this is p1.'); }); find(doc, '[data-ice="detail"]:nth-of-type(2)', (doc)=>{ assert.includes(doc, '#instance-get-value1', 'public get value1: number'); assert.includes(doc, '#instance-get-value1 + [data-ice="description"]', 'this is get value1.'); }); find(doc, '[data-ice="detail"]:nth-of-type(3)', (doc)=>{ assert.includes(doc, '#instance-set-value2', 'public set value2: number'); assert.includes(doc, '#instance-set-value2 + [data-ice="description"]', 'this is set value2.'); }); }); }); it('has constructor detail.', ()=>{ find(doc, '[data-ice="constructorDetails"]', (doc)=>{ find(doc, '[data-ice="detail"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '#instance-constructor-constructor', 'public constructor()'); assert.includes(doc, '#instance-constructor-constructor + [data-ice="description"]', 'this is constructor.'); }); }); }); it('has method detail.', ()=>{ find(doc, '[data-ice="methodDetails"]', (doc)=>{ find(doc, '[data-ice="detail"]:nth-of-type(1)', (doc)=> { assert.includes(doc, '#instance-method-method1', 'public method1()'); assert.includes(doc, '#instance-method-method1 ~ [data-ice="description"]', 'this is method1.'); }); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ComputedTest/MethodTest.js ================================================ /* eslint-disable no-template-curly-in-string, no-multi-spaces */ import {readDoc, assert, find} from './../../util.js'; /** @test {MethodDoc#@_name} */ describe('TestComputedMethod:', ()=> { const doc = readDoc('class/src/Computed/Method.js~TestComputedMethod.html'); describe('in summary:', ()=>{ it('has computed methods.', ()=> { find(doc, '[data-ice="summary"]', (doc)=>{ assert.includes(doc, `[href="class/src/Computed/Method.js~TestComputedMethod.html#instance-method-['foo']"]`, `['foo']`); assert.includes(doc, `[href="class/src/Computed/Method.js~TestComputedMethod.html#instance-method-[Symbol.iterator]"]`, `[Symbol.iterator]`); assert.includes(doc, '[href="class/src/Computed/Method.js~TestComputedMethod.html#instance-method-[`${foo}`]"]', '[`${foo}`]'); assert.includes(doc, `[href="class/src/Computed/Method.js~TestComputedMethod.html#instance-method-[foo + bar]"]`, `[foo + bar]`); assert.includes(doc, `[href="class/src/Computed/Method.js~TestComputedMethod.html#instance-method-[foo()]"]`, `[foo()]`); assert.includes(doc, `[href="class/src/Computed/Method.js~TestComputedMethod.html#instance-method-[foo.bar()]"]`, `[foo.bar()]`); assert.includes(doc, `[href="class/src/Computed/Method.js~TestComputedMethod.html#instance-method-[foo.bar.baz]"]`, `[foo.bar.baz]`); assert.includes(doc, `[href="class/src/Computed/Method.js~TestComputedMethod.html#instance-method-[foo.bar]"]`, `[foo.bar]`); assert.includes(doc, `[href="class/src/Computed/Method.js~TestComputedMethod.html#instance-method-[foo.p + bar]"]`, `[foo.p + bar]`); assert.includes(doc, `[href="class/src/Computed/Method.js~TestComputedMethod.html#instance-method-[foo]"]`, `[foo]`); }); }); }); describe('in detail:', ()=>{ it('has computed method.', ()=>{ assert.includes(doc, `[id="instance-method-['foo']"] [data-ice="name"]`, `['foo']`); assert.includes(doc, `[id="instance-method-[Symbol.iterator]"] [data-ice="name"]`, `[Symbol.iterator]`); assert.includes(doc, '[id="instance-method-[`${foo}`]"] [data-ice="name"]', '[`${foo}`]'); assert.includes(doc, `[id="instance-method-[foo + bar]"] [data-ice="name"]`, `[foo + bar]`); assert.includes(doc, `[id="instance-method-[foo()]"] [data-ice="name"]`, `[foo()]`); assert.includes(doc, `[id="instance-method-[foo.bar()]"] [data-ice="name"]`, `[foo.bar()]`); assert.includes(doc, `[id="instance-method-[foo.bar.baz]"] [data-ice="name"]`, `[foo.bar.baz]`); assert.includes(doc, `[id="instance-method-[foo.bar]"] [data-ice="name"]`, `[foo.bar]`); assert.includes(doc, `[id="instance-method-[foo.p + bar]"] [data-ice="name"]`, `[foo.p + bar]`); assert.includes(doc, `[id="instance-method-[foo]"] [data-ice="name"]`, `[foo]`); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ComputedTest/PropertyTest.js ================================================ /* eslint-disable no-template-curly-in-string, no-multi-spaces */ import {readDoc, assert, find} from './../../util.js'; /** @test {MemberDoc#@_name} */ describe('TestComputedProperty:', ()=> { const doc = readDoc('class/src/Computed/Property.js~TestComputedProperty.html'); describe('in summary:', ()=>{ it('has computed properties.', ()=> { find(doc, '[data-ice="memberSummary"]', (doc)=>{ assert.includes(doc, `[href="class/src/Computed/Property.js~TestComputedProperty.html#instance-member-['foo']"]`, `['foo']`); assert.includes(doc, `[href="class/src/Computed/Property.js~TestComputedProperty.html#instance-member-[Symbol.iterator]"]`, `[Symbol.iterator]`); assert.includes(doc, '[href="class/src/Computed/Property.js~TestComputedProperty.html#instance-member-[`${foo}`]"]', '[`${foo}`]'); assert.includes(doc, `[href="class/src/Computed/Property.js~TestComputedProperty.html#instance-member-[foo + bar]"]`, `[foo + bar]`); assert.includes(doc, `[href="class/src/Computed/Property.js~TestComputedProperty.html#instance-member-[foo()]"]`, `[foo()]`); assert.includes(doc, `[href="class/src/Computed/Property.js~TestComputedProperty.html#instance-member-[foo.bar()]"]`, `[foo.bar()]`); assert.includes(doc, `[href="class/src/Computed/Property.js~TestComputedProperty.html#instance-member-[foo.bar.baz]"]`, `[foo.bar.baz]`); assert.includes(doc, `[href="class/src/Computed/Property.js~TestComputedProperty.html#instance-member-[foo.bar]"]`, `[foo.bar]`); assert.includes(doc, `[href="class/src/Computed/Property.js~TestComputedProperty.html#instance-member-[foo.p + bar]"]`, `[foo.p + bar]`); assert.includes(doc, `[href="class/src/Computed/Property.js~TestComputedProperty.html#instance-member-[foo]"]`, `[foo]`); }); }); }); describe('in detail:', ()=>{ it('has computed properties.', ()=>{ assert.includes(doc, `[id="instance-member-['foo']"] [data-ice="name"]`, `['foo']`); assert.includes(doc, `[id="instance-member-[Symbol.iterator]"] [data-ice="name"]`, `[Symbol.iterator]`); assert.includes(doc, '[id="instance-member-[`${foo}`]"] [data-ice="name"]', '[`${foo}`]'); assert.includes(doc, `[id="instance-member-[foo + bar]"] [data-ice="name"]`, `[foo + bar]`); assert.includes(doc, `[id="instance-member-[foo()]"] [data-ice="name"]`, `[foo()]`); assert.includes(doc, `[id="instance-member-[foo.bar()]"] [data-ice="name"]`, `[foo.bar()]`); assert.includes(doc, `[id="instance-member-[foo.bar.baz]"] [data-ice="name"]`, `[foo.bar.baz]`); assert.includes(doc, `[id="instance-member-[foo.bar]"] [data-ice="name"]`, `[foo.bar]`); assert.includes(doc, `[id="instance-member-[foo.p + bar]"] [data-ice="name"]`, `[foo.p + bar]`); assert.includes(doc, `[id="instance-member-[foo]"] [data-ice="name"]`, `[foo]`); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DecoratorTest/DefinitionTest.js ================================================ import {readDoc, assert, find, findParent} from './../../util.js'; /** * @test {ClassDocBuilder#_buildClassDoc} * @test {DocBuilder#_buildDetailDocs} */ describe('TestDecoratorDefinition:', ()=> { const doc = readDoc('class/src/Decorator/Definition.js~TestDecoratorDefinition.html'); it('has decorator at class.', ()=>{ find(doc, '[data-ice="content"] .self-detail', (doc)=>{ assert.includes(doc, '[data-ice="decorator"]', 'testDecoratorAnnotation1'); }); }); it('has decorator at static method.', ()=>{ findParent(doc, '[id="static-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="decorator"]', 'testDecoratorAnnotation1'); }); }); it('has decorator at getter.', ()=>{ findParent(doc, '[id="instance-get-value1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="decorator"]', 'testDecoratorAnnotation1'); }); }); it('has decorator at setter.', ()=>{ findParent(doc, '[id="instance-set-value2"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="decorator"]', 'testDecoratorAnnotation1'); }); }); it('has decorator at method.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="decorator"] li:nth-of-type(1)', 'testDecoratorAnnotation1'); assert.includes(doc, '[data-ice="decorator"] li:nth-of-type(2)', 'testDecoratorAnnotation2(true)'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DeprecatedTest/ClassTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {AbstractDoc#@deprecated} */ describe('TestDeprecatedClass:', ()=> { const doc = readDoc('class/src/Deprecated/Class.js~TestDeprecatedClass.html'); describe('in self detail:', ()=> { it('has deprecated message of self.', ()=> { assert.includes(doc, '.self-detail [data-ice="deprecated"]', 'this class was deprecated. this is deprecated.'); }); }); describe('in summary:', ()=> { it('has deprecated message of member and method.', ()=> { find(doc, '[data-ice="summary"] [href="class/src/Deprecated/Class.js~TestDeprecatedClass.html#instance-member-p1"]', (doc)=> { doc = doc.parents('[data-ice="target"]'); assert.includes(doc, '[data-ice="deprecated"]', 'this member was deprecated.'); }); find(doc, '[data-ice="summary"] [href="class/src/Deprecated/Class.js~TestDeprecatedClass.html#instance-method-method1"]', (doc)=> { doc = doc.parents('[data-ice="target"]'); assert.includes(doc, '[data-ice="deprecated"]', 'this method was deprecated.'); }); }); }); describe('in details:', ()=>{ it('has deprecated message of member and method.', ()=>{ find(doc, '[id="instance-member-p1"]', (doc)=>{ doc = doc.parents('[data-ice="detail"]'); assert.includes(doc, '[data-ice="deprecated"]', 'this member was deprecated.'); }); find(doc, '[id="instance-method-method1"]', (doc)=>{ doc = doc.parents('[data-ice="detail"]'); assert.includes(doc, '[data-ice="deprecated"]', 'this method was deprecated.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DeprecatedTest/FunctionTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {AbstractDoc#@deprecated} */ describe('testDeprecatedFunction:', ()=> { const doc = readDoc('function/index.html'); describe('in summary', ()=> { it('has deprecated message.', ()=> { find(doc, '[data-ice="summary"] [href="function/index.html#static-function-testDeprecatedFunction"]', (doc)=>{ doc = doc.parents('[data-ice="target"]'); assert.includes(doc, '[data-ice="deprecated"]', 'this function was deprecated.'); }); }); }); describe('in details', ()=>{ it('has deprecated message of member and method.', ()=>{ find(doc, '[id="static-function-testDeprecatedFunction"]', (doc)=>{ doc = doc.parents('[data-ice="detail"]'); assert.includes(doc, '[data-ice="deprecated"]', 'this function was deprecated.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DeprecatedTest/VariableTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {AbstractDoc#@deprecated} */ describe('testDeprecatedVariable:', ()=> { const doc = readDoc('variable/index.html'); describe('in summary', ()=> { it('has deprecated message.', ()=> { find(doc, '[data-ice="summary"] [href="variable/index.html#static-variable-testDeprecatedVariable"]', (doc)=>{ doc = doc.parents('[data-ice="target"]'); assert.includes(doc, '[data-ice="deprecated"]', 'this variable was deprecated.'); }); }); }); describe('in details', ()=>{ it('has deprecated message.', ()=>{ find(doc, '[id="static-variable-testDeprecatedVariable"]', (doc)=>{ doc = doc.parents('[data-ice="detail"]'); assert.includes(doc, '[data-ice="deprecated"]', 'this variable was deprecated.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DescTest/ClassTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@desc} */ describe('TestDescClass', ()=> { const doc = readDoc('class/src/Desc/Class.js~TestDescClass.html'); describe('in self detail', ()=> { it('has desc.', ()=> { assert.includes(doc, '.self-detail [data-ice="description"]', 'this is TestDescClass.'); }); }); describe('in summary', ()=> { it('has desc', ()=> { assert.includes(doc, '[data-ice="constructorSummary"] [data-ice="description"]', 'this is constructor.'); findParent(doc, '[data-ice="summary"] [href$="#instance-member-p1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="description"]', 'this is p1.'); }); findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="description"]', 'this is method1.'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="instance-constructor-constructor"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"]', 'this is constructor.'); }); findParent(doc, '[id="instance-member-p1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"]', 'this is p1.'); }); findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"]', 'this is method1.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DescTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@desc} */ describe('testDescFunction', ()=> { const doc = readDoc('function/index.html'); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-function-testDescFunction"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="description"]', 'this is testDescFunction.'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-function-testDescFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"]', 'this is testDescFunction.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DescTest/MarkdownTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {AbstractDoc#@desc} */ describe('TestDescMarkdown:', ()=> { const doc = readDoc('class/src/Desc/Markdown.js~TestDescMarkdown.html'); describe('in self detail', ()=> { it('has markdown desc.', ()=> { find(doc, '.self-detail [data-ice="description"]', (doc)=>{ // line assert.includes(doc.find('p:nth-child(1)'), null, 'this is TestDescMarkdown.'); // code fence of html assert.includes(doc.find('pre:nth-child(2) code.lang-html code.source-code.prettyprint'), null, `
    text
    • item1
    • item2
    • item3
    ` ); // header assert.includes(doc.find('h1#inner-link:nth-child(3)'), null, 'Inner Link'); // list assert.includes(doc.find('ul:nth-child(4) li:nth-child(1)'), null, 'item1'); assert.includes(doc.find('ul:nth-child(4) li:nth-child(2)'), null, 'item2'); assert.includes(doc.find('ul:nth-child(4) li:nth-child(3)'), null, 'item3'); // link assert.includes(doc.find('p:nth-child(5) a[href$="#inner-link"]'), null, 'inner link'); // code fence of js assert.includes(doc.find('pre:nth-child(6) code.lang-js code.source-code.prettyprint'), null, `let foo = 'this is code block'` ); // table assert.includes(doc.find('table:nth-child(7) thead tr'), null, 'Left align Right align Center align'); assert.includes(doc.find('table:nth-child(7) tbody tr:nth-child(1)'), null, 'This This This'); assert.includes(doc.find('table:nth-child(7) tbody tr:nth-child(2)'), null, 'column column column'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DescTest/MultiLineTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@desc} */ describe('TestDescMultiLine:', ()=> { const doc = readDoc('class/src/Desc/MultiLine.js~TestDescMultiLine.html'); describe('in summary', ()=> { it('has first sentence desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="description"]', 'this is method1.'); }); findParent(doc, '[data-ice="summary"] [href$="#instance-method-method2"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="description"]', 'this is method2.'); }); findParent(doc, '[data-ice="summary"] [href$="#instance-method-method3"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="description"]', 'this is method3.'); }); }); }); describe('in details:', ()=>{ it('has all sentence desc.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"]', 'this is method1. this is second line.'); }); findParent(doc, '[id="instance-method-method2"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"]', 'this is method2. this is second sentence.'); }); findParent(doc, '[id="instance-method-method3"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"]', 'this is method3. this is second sentence.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DescTest/VariableTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@desc} */ describe('testDescVariable', ()=> { const doc = readDoc('variable/index.html'); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-variable-testDescVariable"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="description"]', 'this is testDescVariable.'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-variable-testDescVariable"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"]', 'this is testDescVariable.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DestructuringTest/ArrayTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@param} */ describe('TestDestructuringArray', ()=> { const doc = readDoc('class/src/Destructuring/Array.js~TestDestructuringArray.html'); describe('in summary', ()=> { it('has array destructuring', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p: number[])'); }); }); }); describe('in details', ()=>{ it('has array destructuring.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'method1(p: number[])'); assert.includes(doc, 'table.params', 'p number[] this is p.'); assert.includes(doc, 'table.params', 'p[0] number this is first of p.'); assert.includes(doc, 'table.params', 'p[1] number this is second of p.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DestructuringTest/ObjectTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@param} */ describe('TestDestructuringObject', ()=> { const doc = readDoc('class/src/Destructuring/Object.js~TestDestructuringObject.html'); describe('in summary', ()=> { it('has object destructuring', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p: Object)'); }); }); }); describe('in details', ()=>{ it('has object destructuring.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'method1(p: Object)'); assert.includes(doc, 'table.params', 'p Object this is object p.'); assert.includes(doc, 'table.params', 'p.p1 number this is property p1 of p.'); assert.includes(doc, 'table.params', 'p.p2 string this is property p2 of p.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/DuplicationTest/DefinitionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {DocResolver#_resolveDuplication} */ describe('TestDuplicationDefinition', ()=> { const doc = readDoc('class/src/Duplication/Definition.js~TestDuplicationDefinition.html'); describe('in summary', ()=> { it('has setter/getter/method.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-set-value"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public set value: number'); }); findParent(doc, '[data-ice="summary"] [href$="#instance-get-value"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public get value: number'); }); findParent(doc, '[data-ice="summary"] [href$="#instance-method-onClick"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public onClick(p: number)'); }); }); }); describe('in details', ()=>{ it('has setter/getter/method.', ()=>{ findParent(doc, '[id="instance-set-value"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, null, 'public set value: number'); }); findParent(doc, '[id="instance-get-value"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, null, 'public get value: number'); }); findParent(doc, '[id="instance-method-onClick"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, null, 'public onClick(p: number)'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/EmitsTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@emits} */ describe('testEmitsFunction', ()=> { const doc = readDoc('function/index.html'); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-function-testEmitsFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="emitName"] [href$="TestEmitsFunctionEvent.html"]', 'TestEmitsFunctionEvent'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/EmitsTest/MethodTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@emits} */ describe('TestEmitsMethod', ()=> { const doc = readDoc('class/src/Emits/Method.js~TestEmitsMethod.html'); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ findParent(doc, '[data-ice="emit"] [href$="TestEmitsMethodEvent1.html"]', '[data-ice="emit"]', (doc)=>{ assert.includes(doc, 'a', 'TestEmitsMethodEvent1'); assert.includes(doc, 'a', 'class/src/Emits/Method.js~TestEmitsMethodEvent1.html', 'href'); assert.includes(doc, null, 'TestEmitsMethodEvent1 emits event when foo'); }); findParent(doc, '[data-ice="emit"] [href$="TestEmitsMethodEvent2.html"]', '[data-ice="emit"]', (doc)=>{ assert.includes(doc, 'a', 'TestEmitsMethodEvent2'); assert.includes(doc, 'a', 'class/src/Emits/Method.js~TestEmitsMethodEvent2.html', 'href'); assert.includes(doc, null, 'TestEmitsMethodEvent2 emits event when bar'); }); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExamleTest/CaptionTest.js ================================================ import {readDoc, assert} from './../../util.js'; /** @test {AbstractDoc#@example} */ describe('TestExampleCaption', ()=> { const doc = readDoc('class/src/Example/Caption.js~TestExampleCaption.html'); describe('in self detail', ()=> { it('has caption of example.', ()=> { assert.includes(doc, '.self-detail [data-ice="exampleDoc"] [data-ice="exampleCaption"]', 'this is caption'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExamleTest/ClassTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@example} */ describe('TestExampleClass', ()=> { const doc = readDoc('class/src/Example/Class.js~TestExampleClass.html'); describe('in self detail', ()=> { it('has example.', ()=> { assert.includes(doc, '.self-detail [data-ice="exampleDoc"]:nth-of-type(1)', 'const foo = 123; console.log(foo);'); assert.includes(doc, '.self-detail [data-ice="exampleDoc"]:nth-of-type(2)', 'const bar = 123; console.log(bar);'); }); }); describe('in details', ()=>{ it('has example.', ()=>{ findParent(doc, '[id="instance-constructor-constructor"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="exampleDoc"]', 'const foo = 123;'); }); findParent(doc, '[id="instance-member-p1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="exampleDoc"]', 'const foo = 123;'); }); findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="exampleDoc"]', 'const foo = 123;'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExamleTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@example} */ describe('testExampleFunction', ()=> { const doc = readDoc('function/index.html'); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-function-testExampleFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="exampleDoc"]', 'const foo = 123;'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExamleTest/VariableTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@example} */ describe('testDescVariable', ()=> { const doc = readDoc('variable/index.html'); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-variable-testExampleVariable"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="exampleDoc"]', 'const foo = 123;'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExperimentalTest/ClassTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@experimental} */ describe('TestExperimentalClass', ()=> { const doc = readDoc('class/src/Experimental/Class.js~TestExperimentalClass.html'); describe('in self detail', ()=> { it('has desc.', ()=> { assert.includes(doc, '.self-detail [data-ice="experimental"]', 'this class is experimental. this is experimental'); }); }); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-member-p1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="experimental"]', 'this member is experimental.'); }); findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="experimental"]', 'this method is experimental.'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="instance-member-p1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="experimental"]', 'this member is experimental.'); }); findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="experimental"]', 'this method is experimental.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExperimentalTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@experimental} */ describe('testExperimentalFunction', ()=> { const doc = readDoc('function/index.html'); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-function-testExperimentalFunction"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="experimental"]', 'this function is experimental.'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-function-testExperimentalFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="experimental"]', 'this function is experimental.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExperimentalTest/VariableTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@experimental} */ describe('testExperimentalVariable', ()=> { const doc = readDoc('variable/index.html'); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-variable-testExperimentalVariable"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="experimental"]', 'this variable is experimental.'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-variable-testExperimentalVariable"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="experimental"]', 'this variable is experimental.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExponentialOperatorTest/DefinitionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {ESParser} */ describe('TestExponentiationOperatorDefinition', ()=> { const doc = readDoc('class/src/ExponentiationOperator/Definition.js~TestExponentiationOperatorDefinition.html'); describe('in self detail', ()=> { it('has desc.', ()=> { assert.includes(doc, '.self-detail [data-ice="description"]', 'this is TestExponentiationOperatorDefinition.'); }); }); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="description"]', 'this is method1.'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"]', 'this is method1.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/AnonymousClassTest.js ================================================ import {readDoc, assert} from './../../util.js'; /** @test {ClassDoc#@_name} */ describe('TestExportAnonymousClass', ()=> { const doc = readDoc('class/src/Export/AnonymousClass.js~AnonymousClass.html'); describe('in self detail', ()=> { it('is named with anonymous.', ()=> { assert.includes(doc, '[data-ice="importPath"]', `import AnonymousClass from 'esdoc-test-fixture/src/Export/AnonymousClass.js'`); assert.includes(doc, '.self-detail [data-ice="name"]', 'AnonymousClass'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/AnonymousFunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {FunctionDoc#@_name} */ describe('testExportAnonymousFunction', ()=> { const doc = readDoc('function/index.html'); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-function-AnonymousFunction"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public AnonymousFunction()'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-function-AnonymousFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public AnonymousFunction()'); assert.includes(doc, '[data-ice="importPath"]', `import AnonymousFunction from 'esdoc-test-fixture/src/Export/AnonymousFunction.js'`); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/ArrowFunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {FunctionDoc#@_name} */ describe('test export arrow function', ()=> { const doc = readDoc('function/index.html'); it('has default import path with direct arrow function definition.', ()=> { findParent(doc, '[id="static-function-ArrowFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import ArrowFunction from 'esdoc-test-fixture/src/Export/ArrowFunction.js'`); }); }); it('has named import path with direct arrow function definition.', ()=>{ findParent(doc, '[id="static-function-testExportArrowFunction2"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportArrowFunction2} from 'esdoc-test-fixture/src/Export/ArrowFunction.js'`); }); }); it('is not documented with direct arrow function expression', ()=> { try { findParent(doc, '[id="static-function-testExportArrowFunction3"]', '[data-ice="detail"]', ()=>{}); } catch (e) { return; } assert(false); }); it('has named import path with undocument', ()=>{ findParent(doc, '[id="static-function-testExportArrowFunction4"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportArrowFunction4} from 'esdoc-test-fixture/src/Export/ArrowFunction.js'`); }); }); it('has named import path with indirect function definition.', ()=> { findParent(doc, '[id="static-function-testExportArrowFunction5"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportArrowFunction5} from 'esdoc-test-fixture/src/Export/ArrowFunction.js'`); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/ClassIndirectDefaultTest.js ================================================ import {readDoc, assert} from './../../util.js'; /** * @test {AbstractDoc#@_export} * @test {ClassDocBuilder@_buildClassDoc} */ describe('test export class indirect default', ()=> { it('has default import path with indirect class definition.', ()=> { const doc = readDoc('class/src/Export/ClassIndirectDefault.js~TestExportClassIndirectDefault.html'); assert.includes(doc, '.header-notice [data-ice="importPath"]', `import TestExportClassIndirectDefault from 'esdoc-test-fixture/src/Export/ClassIndirectDefault.js'`); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/ClassTest.js ================================================ import {readDoc, assert} from './../../util.js'; /** * @test {AbstractDoc#@_export} * @test {ClassDocBuilder@_buildClassDoc} */ describe('test export class', ()=> { it('has default import path with direct class definition.', ()=> { const doc = readDoc('class/src/Export/Class.js~TestExportClass1.html'); assert.includes(doc, '.header-notice [data-ice="importPath"]', `import TestExportClass1 from 'esdoc-test-fixture/src/Export/Class.js'`); }); it('has named import path with direct.', ()=>{ const doc = readDoc('class/src/Export/Class.js~TestExportClass2.html'); assert.includes(doc, '.header-notice [data-ice="importPath"]', `import {TestExportClass2} from 'esdoc-test-fixture/src/Export/Class.js'`); }); it('has named import path with indirect class definition', ()=>{ const doc = readDoc('class/src/Export/Class.js~TestExportClass3.html'); assert.includes(doc, '.header-notice [data-ice="importPath"]', `import {TestExportClass3} from 'esdoc-test-fixture/src/Export/Class.js'`); }); it('has named import path with indirect class expression', ()=>{ const doc = readDoc('class/src/Export/Class.js~TestExportClass4.html'); assert.includes(doc, '.header-notice [data-ice="importPath"]', `import {TestExportClass4} from 'esdoc-test-fixture/src/Export/Class.js'`); }); it('has named import path with undocument', ()=>{ const doc = readDoc('class/src/Export/Class.js~TestExportClass5.html'); assert.includes(doc, '.header-notice [data-ice="importPath"]', `import {TestExportClass5} from 'esdoc-test-fixture/src/Export/Class.js'`); }); it('is not documented.', ()=> { try { readDoc('class/src/Export/Class.js~TestExportClass6.html'); } catch (e) { return; } assert(false); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/DefaultTest.js ================================================ import {readDoc, assert} from './../../util.js'; /** * @test {AbstractDoc#@_export} * @test {ClassDocBuilder@_buildClassDoc} */ describe('TestExportDefault', ()=> { const doc = readDoc('class/src/Export/Default.js~TestExportDefault.html'); it('has default import path.', ()=> { assert.includes(doc, '.header-notice [data-ice="importPath"]', `import TestExportDefault from 'esdoc-test-fixture/src/Export/Default.js'`); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/ExtendTest.js ================================================ import {readDoc} from './../../util.js'; /** @test {DocResolver#_resolveNecessary} */ describe('TestExportExtendsInner', ()=> { it('is documented.', ()=> { readDoc('class/src/Export/Extends.js~TestExportExtendsInner.html'); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/FunctionIndirectDefaultTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {FunctionDoc#@_name} */ describe('test export function indirect default', ()=> { const doc = readDoc('function/index.html'); it('has default import path with indirect function definition', ()=>{ findParent(doc, '[id="static-function-testExportFunctionIndirectDefault"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import testExportFunctionIndirectDefault from 'esdoc-test-fixture/src/Export/FunctionIndirectDefault.js'`); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {FunctionDoc#@_name} */ describe('test export function', ()=> { const doc = readDoc('function/index.html'); it('has default import path with direct function definition.', ()=> { findParent(doc, '[id="static-function-testExportFunction1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import testExportFunction1 from 'esdoc-test-fixture/src/Export/Function.js'`); }); }); it('has named import path with direct function definition.', ()=>{ findParent(doc, '[id="static-function-testExportFunction2"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportFunction2} from 'esdoc-test-fixture/src/Export/Function.js'`); }); }); it('has named import path with direct function expression', ()=>{ findParent(doc, '[id="static-function-testExportFunction3"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportFunction3} from 'esdoc-test-fixture/src/Export/Function.js'`); }); }); it('is not documented with direct function definition', ()=> { try { findParent(doc, '[id="static-function-testExportFunction4"]', '[data-ice="detail"]', ()=>{}); } catch (e) { return; } assert(false); }); it('is not documented with direct function expression', ()=> { try { findParent(doc, '[id="static-function-testExportFunction5"]', '[data-ice="detail"]', ()=>{}); } catch (e) { return; } assert(false); }); it('has named import path with direct generator function definition.', ()=>{ findParent(doc, '[id="static-function-testExportFunction6"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportFunction6} from 'esdoc-test-fixture/src/Export/Function.js'`); }); }); it('has named import path with undocument', ()=>{ findParent(doc, '[id="static-function-testExportFunction7"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportFunction7} from 'esdoc-test-fixture/src/Export/Function.js'`); }); }); it('has named import path with indirect function definition.', ()=> { findParent(doc, '[id="static-function-testExportFunction8"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportFunction8} from 'esdoc-test-fixture/src/Export/Function.js'`); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/MultipleTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {DocFactory#_inspectExportNamedDeclaration} */ describe('test multiple export', ()=> { it('is documented.', ()=>{ const doc1 = readDoc('class/src/Export/Multiple.js~TestExportMultiple.html'); assert.includes(doc1, '.header-notice [data-ice="importPath"]', `import {TestExportMultiple} from 'esdoc-test-fixture/src/Export/Multiple.js'`); const doc2 = readDoc('variable/index.html'); findParent(doc2, '[id="static-variable-testExportMultiple"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportMultiple} from 'esdoc-test-fixture/src/Export/Multiple.js'`); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/NamedTest.js ================================================ import {readDoc, assert} from './../../util.js'; /** * @test {AbstractDoc#@_export} * @test {ClassDocBuilder@_buildClassDoc} */ describe('TestExportNamed', ()=> { it('has named import path.', ()=>{ const doc = readDoc('class/src/Export/Named.js~TestExportNamed.html'); assert.includes(doc, '.header-notice [data-ice="importPath"]', `import {TestExportNamed} from 'esdoc-test-fixture/src/Export/Named.js'`); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/NewExpressionIndirectTest.js ================================================ import {readDoc, assert, find, findParent} from './../../util.js'; /** * @test {DocFactory#_inspectExportDefaultDeclaration} * @test {DocFactory#_inspectExportNamedDeclaration} */ describe('test default export with new expression and indirect.', ()=> { it('has instance description', ()=> { const doc = readDoc('class/src/Export/NewExpressionIndirect.js~TestExportNewExpressionIndirect.html'); find(doc, '[data-ice="instanceDocs"]', (doc)=>{ assert.includes(doc, null, 'You can directly use an instance of this class. testExportNewExpressionIndirect'); assert.includes(doc, 'a', 'testExportNewExpressionIndirect'); assert.includes(doc, 'a', 'variable/index.html#static-variable-testExportNewExpressionIndirect', 'href'); }); // does not have import path because the class is not clear exported. try { assert.includes(doc, '.header-notice [data-ice="importPath"]', 'import'); } catch (e) { return; } assert(false); }); it('has class description', ()=>{ const doc = readDoc('variable/index.html'); findParent(doc, '[data-ice="summary"] [href$="#static-variable-testExportNewExpressionIndirect"]', '[data-ice="target"]', (doc)=>{ assert.includes(doc, null, 'public testExportNewExpressionIndirect: TestExportNewExpressionIndirect'); }); findParent(doc, '#static-variable-testExportNewExpressionIndirect', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public testExportNewExpressionIndirect: TestExportNewExpressionIndirect'); assert.includes(doc, '[data-ice="importPath"]', `import testExportNewExpressionIndirect from 'esdoc-test-fixture/src/Export/NewExpressionIndirect.js'`); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/NewExpressionPropertyTest.js ================================================ import {readDoc, assert, find, findParent} from './../../util.js'; /** * @test {DocFactory#_inspectExportDefaultDeclaration} * @test {DocFactory#_inspectExportNamedDeclaration} */ describe('test default export with new expression and property.', ()=> { it('has instance description', ()=> { const doc = readDoc('class/src/Export/NewExpressionProperty.js~TestExportNewExpressionProperty.html'); find(doc, '[data-ice="instanceDocs"]', (doc)=>{ assert.includes(doc, null, 'You can directly use an instance of this class. testExportNewExpressionProperty'); assert.includes(doc, 'a', 'testExportNewExpressionProperty'); assert.includes(doc, 'a', 'variable/index.html#static-variable-testExportNewExpressionProperty', 'href'); }); // does not have import path because the class is not clear exported. try { assert.includes(doc, '.header-notice [data-ice="importPath"]', 'import'); } catch (e) { return; } assert(false); }); it('has class description', ()=>{ const doc = readDoc('variable/index.html'); findParent(doc, '[data-ice="summary"] [href$="#static-variable-testExportNewExpressionProperty"]', '[data-ice="target"]', (doc)=>{ assert.includes(doc, null, 'public testExportNewExpressionProperty: TestExportNewExpressionProperty'); }); findParent(doc, '#static-variable-testExportNewExpressionProperty', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public testExportNewExpressionProperty: TestExportNewExpressionProperty'); assert.includes(doc, '[data-ice="importPath"]', `import testExportNewExpressionProperty from 'esdoc-test-fixture/src/Export/NewExpressionProperty.js'`); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/NewExpressionTest.js ================================================ import {readDoc, assert, find, findParent} from './../../util.js'; /** * @test {DocFactory#_inspectExportDefaultDeclaration} * @test {DocFactory#_inspectExportNamedDeclaration} */ describe('test default export with new expression.', ()=> { describe('default export', ()=>{ it('has instance description', ()=> { const doc = readDoc('class/src/Export/NewExpression.js~TestExportNewExpression.html'); find(doc, '[data-ice="instanceDocs"]', (doc)=>{ assert.includes(doc, null, 'You can directly use an instance of this class. testExportNewExpression'); assert.includes(doc, 'a', 'testExportNewExpression'); assert.includes(doc, 'a', 'variable/index.html#static-variable-testExportNewExpression', 'href'); }); // does not have import path because the class is not clear exported. try { assert.includes(doc, '.header-notice [data-ice="importPath"]', 'import'); } catch (e) { return; } assert(false); }); it('has class description', ()=>{ const doc = readDoc('variable/index.html'); findParent(doc, '[data-ice="summary"] [href$="#static-variable-testExportNewExpression"]', '[data-ice="target"]', (doc)=>{ assert.includes(doc, null, 'public testExportNewExpression: TestExportNewExpression'); }); findParent(doc, '#static-variable-testExportNewExpression', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public testExportNewExpression: TestExportNewExpression'); assert.includes(doc, '[data-ice="importPath"]', `import testExportNewExpression from 'esdoc-test-fixture/src/Export/NewExpression.js'`); }); }); }); describe('named export', ()=>{ it('has instance description', ()=> { const doc = readDoc('class/src/Export/NewExpression.js~TestExportNewExpression2.html'); find(doc, '[data-ice="instanceDocs"]', (doc)=>{ assert.includes(doc, null, 'You can directly use an instance of this class. testExportNewExpression2'); assert.includes(doc, 'a', 'testExportNewExpression2'); assert.includes(doc, 'a', 'variable/index.html#static-variable-testExportNewExpression2', 'href'); }); // does not have import path because the class is not clear exported. try { assert.includes(doc, '.header-notice [data-ice="importPath"]', 'import'); } catch (e) { return; } assert(false); }); it('has class description', ()=>{ const doc = readDoc('variable/index.html'); findParent(doc, '[data-ice="summary"] [href$="#static-variable-testExportNewExpression2"]', '[data-ice="target"]', (doc)=>{ assert.includes(doc, null, 'public testExportNewExpression2: TestExportNewExpression2'); }); findParent(doc, '#static-variable-testExportNewExpression2', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public testExportNewExpression2: TestExportNewExpression2'); assert.includes(doc, '[data-ice="importPath"]', `import {testExportNewExpression2} from 'esdoc-test-fixture/src/Export/NewExpression.js'`); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/VariableIndirectDefaultTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {VariableDoc#@_name} */ describe('test export variable indirect default', ()=> { const doc = readDoc('variable/index.html'); it('has default import path with indirect variable definition.', ()=> { findParent(doc, '[id="static-variable-testExportVariableIndirectDefault"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import testExportVariableIndirectDefault from 'esdoc-test-fixture/src/Export/VariableIndirectDefault.js'`); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExportTest/VariableTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {VariableDoc#@_name} */ describe('test export variable', ()=> { const doc = readDoc('variable/index.html'); it('has default import path with direct variable definition.', ()=> { findParent(doc, '[id="static-variable-testExportVariable1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import testExportVariable1 from 'esdoc-test-fixture/src/Export/Variable.js'`); }); }); it('has named import path with direct variable definition.', ()=>{ findParent(doc, '[id="static-variable-testExportVariable2"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportVariable2} from 'esdoc-test-fixture/src/Export/Variable.js'`); }); }); it('is not documented with direct variable definition', ()=> { try { findParent(doc, '[id="static-variable-testExportVariable3"]', '[data-ice="detail"]', ()=>{}); } catch (e) { return; } assert(false); }); it('has named import path with none doc comment', ()=>{ findParent(doc, '[id="static-variable-testExportVariable4"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportVariable4} from 'esdoc-test-fixture/src/Export/Variable.js'`); }); findParent(doc, '[id="static-variable-testExportVariable5"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportVariable5} from 'esdoc-test-fixture/src/Export/Variable.js'`); }); }); it('has named import path with indirect variable definition.', ()=>{ findParent(doc, '[id="static-variable-testExportVariable6"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportVariable6} from 'esdoc-test-fixture/src/Export/Variable.js'`); }); }); it('has named import path with unknown type.', ()=>{ findParent(doc, '[id="static-variable-testExportVariable7"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="importPath"]', `import {testExportVariable7} from 'esdoc-test-fixture/src/Export/Variable.js'`); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExtendsTest/BuiltinTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {ClassDoc#@extends} */ describe('TestExtendsBuiltin', ()=> { const doc = readDoc('class/src/Extends/Builtin.js~TestExtendsBuiltin.html'); it('has extends chain.', ()=> { find(doc, '.self-detail [data-ice="extendsChain"]', (doc)=>{ assert.includes(doc, null, 'Array → TestExtendsBuiltin'); assert.includes(doc, 'a', 'Array'); assert.includes(doc, 'a', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array', 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExtendsTest/DeepTest.js ================================================ import {readDoc, assert, find, findParent} from './../../util.js'; /** * @test {ClassDoc#@extends} * @test {ClassDocBuilder#_buildInheritedSummaryHTML} */ describe('test deep extends', ()=>{ describe('TestExtendsDeepSquare', ()=> { const doc = readDoc('class/src/Extends/Deep.js~TestExtendsDeepSquare.html'); it('has extends chain.', ()=> { find(doc, '.self-detail [data-ice="extendsChain"]', (doc)=>{ assert.includes(doc, null, 'TestExtendsDeepShape → TestExtendsDeepRectangle → TestExtendsDeepSquare'); assert.includes(doc, 'a[href$="Array"]', 'Array'); assert.includes(doc, 'a[href="class/src/Extends/Deep.js~TestExtendsDeepShape.html"]', 'TestExtendsDeepShape'); assert.includes(doc, 'a[href="class/src/Extends/Deep.js~TestExtendsDeepRectangle.html"]', 'TestExtendsDeepRectangle'); }); }); it('has super^1 class methods and more.', ()=>{ findParent(doc, '[data-ice="inheritedSummary"] a[href$="TestExtendsDeepRectangle.html"]', '[data-ice="summary"]', (doc)=>{ assert.includes(doc, 'thead', 'From class TestExtendsDeepRectangle'); assert.includes(doc, 'thead a', 'class/src/Extends/Deep.js~TestExtendsDeepRectangle.html', 'href'); assert.includes(doc, 'a[href$="#static-get-staticValueRectangle"]', 'staticValueRectangle'); assert.includes(doc, 'a[href$="#static-set-staticValueRectangle"]', 'staticValueRectangle'); assert.includes(doc, 'a[href$="#static-member-staticPRectangle"]', 'staticPRectangle'); assert.includes(doc, 'a[href$="#static-method-staticMethodRectangle"]', 'staticMethodRectangle'); assert.includes(doc, 'a[href$="#instance-get-valueRectangle"]', 'valueRectangle'); assert.includes(doc, 'a[href$="#instance-set-valueRectangle"]', 'valueRectangle'); assert.includes(doc, 'a[href$="#instance-member-pRectangle"]', 'pRectangle'); assert.includes(doc, 'a[href$="#instance-method-methodRectangle"]', 'methodRectangle'); }); }); it('has super^2 class methods and more.', ()=>{ findParent(doc, '[data-ice="inheritedSummary"] a[href$="TestExtendsDeepShape.html"]', '[data-ice="summary"]', (doc)=>{ assert.includes(doc, 'thead', 'From class TestExtendsDeepShape'); assert.includes(doc, 'thead a', 'class/src/Extends/Deep.js~TestExtendsDeepShape.html', 'href'); assert.includes(doc, 'a[href$="#static-get-staticValueShape"]', 'staticValueShape'); assert.includes(doc, 'a[href$="#static-set-staticValueShape"]', 'staticValueShape'); assert.includes(doc, 'a[href$="#static-member-staticPShape"]', 'staticPShape'); assert.includes(doc, 'a[href$="#static-method-staticMethodShape"]', 'staticMethodShape'); assert.includes(doc, 'a[href$="#instance-get-valueShape"]', 'valueShape'); assert.includes(doc, 'a[href$="#instance-set-valueShape"]', 'valueShape'); assert.includes(doc, 'a[href$="#instance-member-pShape"]', 'pShape'); assert.includes(doc, 'a[href$="#instance-method-methodShape"]', 'methodShape'); }); }); }); describe('TestExtendsDeepRectangle', ()=>{ const doc = readDoc('class/src/Extends/Deep.js~TestExtendsDeepRectangle.html'); it('has direct subclass.', ()=> { find(doc, '.self-detail [data-ice="directSubclass"]', (doc)=>{ assert.includes(doc, 'a[href="class/src/Extends/Deep.js~TestExtendsDeepSquare.html"]', 'TestExtendsDeepSquare'); }); }); }); describe('TestExtendsDeepShape', ()=>{ const doc = readDoc('class/src/Extends/Deep.js~TestExtendsDeepShape.html'); it('has direct subclass.', ()=> { find(doc, '.self-detail [data-ice="directSubclass"]', (doc)=>{ assert.includes(doc, 'a[href="class/src/Extends/Deep.js~TestExtendsDeepRectangle.html"]', 'TestExtendsDeepRectangle'); }); }); it('has indirect subclass.', ()=> { find(doc, '.self-detail [data-ice="indirectSubclass"]', (doc)=>{ assert.includes(doc, 'a[href="class/src/Extends/Deep.js~TestExtendsDeepSquare.html"]', 'TestExtendsDeepSquare'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExtendsTest/ExpressionTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {ClassDoc#@extends} */ describe('TestExtendsExpression', ()=> { const doc = readDoc('class/src/Extends/Expression.js~TestExtendsExpression.html'); it('has expression extends.', ()=> { find(doc, '.self-detail [data-ice="expressionExtends"]', (doc)=>{ assert.includes(doc, 'pre code', 'class TestExtendsExpression extends TestExtendsExpressionInner(123)'); }); }); it('has extends chain.', ()=> { find(doc, '.self-detail [data-ice="extendsChain"]', (doc)=>{ assert.includes(doc, null, 'TestExtendsExpressionInner → TestExtendsExpression'); assert.includes(doc, 'a[href$="#static-function-TestExtendsExpressionInner"]', 'TestExtendsExpressionInner'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExtendsTest/InnerTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** * @test {ClassDoc#@extends} * @test {DocResolver@_resolveNecessary} */ describe('TestExtendsInner', ()=> { it('has extends chain.', ()=>{ const doc = readDoc('class/src/Extends/Inner.js~TestExtendsInner.html'); find(doc, '.self-detail [data-ice="extendsChain"]', (doc)=>{ assert.includes(doc, null, '_TestExtendsInner → TestExtendsInner'); assert.includes(doc, 'a[href$="_TestExtendsInner.html"]', '_TestExtendsInner'); }); }); it('has direct subclass.', ()=>{ const doc = readDoc('class/src/Extends/Inner.js~_TestExtendsInner.html'); find(doc, '.self-detail [data-ice="directSubclass"]', (doc)=>{ assert.includes(doc, 'a[href="class/src/Extends/Inner.js~TestExtendsInner.html"]', 'TestExtendsInner'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExtendsTest/MixinTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** * @test {ClassDoc#@extends} * @test {DocResolver#_resolveNecessary} */ describe('TestExtendsMixin', ()=> { const doc = readDoc('class/src/Extends/Mixin.js~TestExtendsMixin.html'); it('has expression extends.', ()=> { find(doc, '.self-detail [data-ice="expressionExtends"]', (doc)=>{ assert.includes(doc, 'pre code', 'class TestExtendsMixin extends mixin(TestExtendsMixinInner1, TestExtendsMixinInner2)'); }); }); it('has extends chain.', ()=> { find(doc, '.self-detail [data-ice="mixinExtends"]', (doc)=>{ assert.includes(doc, null, 'TestExtendsMixinInner1, TestExtendsMixinInner2'); assert.includes(doc, 'a[href="class/src/Extends/Mixin.js~TestExtendsMixinInner1.html"]', 'TestExtendsMixinInner1'); assert.includes(doc, 'a[href="class/src/Extends/Mixin.js~TestExtendsMixinInner2.html"]', 'TestExtendsMixinInner2'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExtendsTest/OuterTest.js ================================================ import {readDoc, assert, find, findParent} from './../../util.js'; /** @test {ClassDoc#@extends} */ describe('TestExtendsOuter', ()=> { const doc = readDoc('class/src/Extends/Outer.js~TestExtendsOuter.html'); it('has extends chain.', ()=> { find(doc, '.self-detail [data-ice="extendsChain"]', (doc)=>{ assert.includes(doc, null, 'Array → TestExtendsBuiltin → TestExtendsOuter'); assert.includes(doc, 'a[href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array"]', 'Array'); assert.includes(doc, 'a[href="class/src/Extends/Builtin.js~TestExtendsBuiltin.html"]', 'TestExtendsBuiltin'); }); }); it('has inherited methods and more', ()=>{ it('has super class methods and more.', ()=>{ findParent(doc, '[data-ice="inheritedSummary"] a[href$="TestExtendsBuiltin.html"]', '[data-ice="summary"]', (doc)=>{ assert.includes(doc, 'thead', 'From class TestExtendsBuiltin'); assert.includes(doc, 'thead a', 'class/src/Extends/Builtin.js~TestExtendsBuiltin.html', 'href'); assert.includes(doc, 'a[href$="#instance-method-method1"]', 'method1'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExtendsTest/PropertyTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {ClassDoc#@extends} */ describe('TestExtendsProperty', ()=> { const doc = readDoc('class/src/Extends/Property.js~TestExtendsProperty.html'); it('has extends chain.', ()=> { find(doc, '.self-detail [data-ice="extendsChain"]', (doc)=>{ assert.includes(doc, null, 'TestExtendsPropertyPackage~obj.TestExtendsPropertyInner → TestExtendsProperty'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ExternalTest/DefinitionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {ExternalDoc#@_name} */ describe('TestExternalDefinition', ()=> { const doc = readDoc('index.html'); it('has external document.', ()=> { findParent(doc, '[data-ice="nav"] [data-ice="doc"] a[href="http://example.com"]', '[data-ice="doc"]', (doc)=> { assert.includes(doc, '[data-ice="name"]', 'TestExternalDefinition'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/GeneratorTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@_generator} */ describe('testGeneratorFunction', ()=> { const doc = readDoc('function/index.html'); describe('in summary', ()=> { it('has generator mark', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-function-testGeneratorFunction"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public * testGeneratorFunction()'); }); }); }); describe('in details', ()=>{ it('has generator mark.', ()=>{ findParent(doc, '[id="static-function-testGeneratorFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public * testGeneratorFunction()'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/GeneratorTest/MethodTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@_generator} */ describe('TestGeneratorMethod', ()=> { const doc = readDoc('class/src/Generator/Method.js~TestGeneratorMethod.html'); describe('in summary', ()=> { it('has generator mark.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public * method1()'); }); }); }); describe('in details', ()=>{ it('has generator mark.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public * method1()'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/IgnoreTest/ClassTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {DocResolver#_resolveIgnore */ describe('test ignore class', ()=>{ describe('TestIgnoreClass1', ()=> { it('is not documented.', ()=> { assert.throws(()=> readDoc('class/src/Ignore/Class.js~TestIgnoreClass1.html')); }); }); describe('TestIgnoreClass2', ()=>{ const doc = readDoc('class/src/Ignore/Class.js~TestIgnoreClass2.html'); it('does not have ignored member.', ()=>{ assert.throws(()=> find(doc, '[data-ice="summary"] [href$="#instance-member-p1"]', ()=>{})); assert.throws(()=> find(doc, '[id="instance-member-p1"]', ()=>{})); }); it('does not have ignored method.', ()=>{ assert.throws(()=> find(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', ()=>{})); assert.throws(()=> find(doc, '[id="instance-method-method1"]', ()=>{})); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/IgnoreTest/FunctionTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {DocResolver#_resolveIgnore */ describe('testIgnoreFunction', ()=>{ const doc = readDoc('function/index.html'); it('is not documented.', ()=>{ assert.throws(()=> find(doc, '[data-ice="summary"] [href$="#static-function-testIgnoreFunction"]', ()=>{})); assert.throws(()=> find(doc, '[id="static-function-testIgnoreFunction"]', ()=>{})); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/IgnoreTest/VariableTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {DocResolver#_resolveIgnore */ describe('testIgnoreVariable', ()=>{ const doc = readDoc('variable/index.html'); it('is not documented.', ()=>{ assert.throws(()=> find(doc, '[data-ice="summary"] [href$="#static-variable-testIgnoreVariable"]', ()=>{})); assert.throws(()=> find(doc, '[id="static-variable-testIgnoreVariable"]', ()=>{})); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/InterfaceTest/DefinitionTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {ClassDoc#@interface} */ describe('TestInterfaceDefinition', ()=> { const doc = readDoc('class/src/Interface/Definition.js~TestInterfaceDefinition.html'); it('has interface mark.', ()=> { assert.includes(doc, '.header-notice [data-ice="kind"]', 'interface'); }); it('has direct subclass.', ()=>{ find(doc, '.self-detail [data-ice="directImplemented"]', (doc)=>{ assert.includes(doc, 'a[href="class/src/Interface/Implements.js~TestInterfaceImplements.html"]', 'TestInterfaceImplements'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/InterfaceTest/ImplementsTest.js ================================================ import {readDoc, assert, find} from './../../util.js'; /** @test {ClassDoc#@implements} */ describe('TestInterfaceImplements', ()=> { const doc = readDoc('class/src/Interface/Implements.js~TestInterfaceImplements.html'); it('has implements.', ()=>{ find(doc, '.self-detail [data-ice="implements"]', (doc)=>{ assert.includes(doc, 'ul', 'TestInterfaceDefinition, TestInterfaceImplementsInner'); assert.includes(doc, 'ul a[href="class/src/Interface/Definition.js~TestInterfaceDefinition.html"]', 'TestInterfaceDefinition'); assert.includes(doc, 'ul a[href="class/src/Interface/Implements.js~TestInterfaceImplementsInner.html"]', 'TestInterfaceImplementsInner'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/LinkTest/ClassTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {DocResolver#_resolveLink} */ describe('TestLinkClass', ()=> { const doc = readDoc('class/src/Link/Class.js~TestLinkClass.html'); it('has link from class.', ()=> { assert.includes(doc, '.self-detail [data-ice="description"] a[href="function/index.html#static-function-testLinkFunction"]', 'testLinkFunction'); }); it('has link from constructor.', ()=>{ findParent(doc, '[id="instance-constructor-constructor"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"] a[href="function/index.html#static-function-testLinkFunction"]', 'testLinkFunction'); }); }); it('has link from member.', ()=>{ findParent(doc, '[id="instance-member-p1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"] a[href="function/index.html#static-function-testLinkFunction"]', 'testLinkFunction'); }); }); it('has link from method.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"] a[href="function/index.html#static-function-testLinkFunction"]', 'testLinkFunction'); }); }); }); /** @test {DocResolver#_resolveLink} */ describe('TestLinkClass3', () => { const doc = readDoc('class/src/Link/Class.js~TestLinkClass3.html'); it('has link to inherited class method.', ()=>{ findParent(doc, '[id="instance-method-method1FooBar"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"] a[href="class/src/Link/Class.js~TestLinkClass.html#instance-method-method1"]', 'TestLinkClass2#method1'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/LinkTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {DocResolver#_resolveLink} */ describe('testLinkFunction', ()=> { const doc = readDoc('function/index.html'); it('has link.', ()=>{ findParent(doc, '[id="static-function-testLinkFunction"]', '[data-ice="detail"]', (doc)=> { assert.includes(doc, '[data-ice="description"] a[href="class/src/Link/Class.js~TestLinkClass.html"]', 'TestLinkClass'); assert.includes(doc, '[data-ice="description"] a[href="class/src/Link/Class.js~TestLinkClass.html#instance-member-p1"]', 'TestLinkClass#p1'); assert.includes(doc, '[data-ice="description"] a[href="class/src/Link/Class.js~TestLinkClass.html#instance-method-method1"]', 'TestLinkClass#method1'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/LinkTest/VariableTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {DocResolver#_resolveLink} */ describe('testLinkVariable', ()=> { const doc = readDoc('variable/index.html'); it('has link.', ()=>{ findParent(doc, '[id="static-variable-testLinkVariable"]', '[data-ice="detail"]', (doc)=> { assert.includes(doc, '[data-ice="description"] a[href="class/src/Link/Class.js~TestLinkClass.html"]', 'TestLinkClass'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ListensTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@listens} */ describe('testListensFunction', ()=> { const doc = readDoc('function/index.html'); it('has listens.', ()=>{ findParent(doc, '[id="static-function-testListensFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="listen"] a[href="class/src/Listens/Function.js~TestListensFunctionEvent.html"]', 'TestListensFunctionEvent'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ListensTest/MethodTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@listens} */ describe('TestListensMethod', ()=> { const doc = readDoc('class/src/Listens/Method.js~TestListensMethod.html'); it('has listens.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ findParent(doc, 'a[href="class/src/Listens/Method.js~TestListensMethodEvent1.html"]', '[data-ice="listen"]', (doc)=>{ assert.includes(doc, null, 'TestListensMethodEvent1 listen event because foo.'); assert.includes(doc, 'a[href="class/src/Listens/Method.js~TestListensMethodEvent1.html"]', 'TestListensMethodEvent1'); }); findParent(doc, 'a[href="class/src/Listens/Method.js~TestListensMethodEvent2.html"]', '[data-ice="listen"]', (doc)=>{ assert.includes(doc, null, 'TestListensMethodEvent2 listen event because bar.'); assert.includes(doc, 'a[href="class/src/Listens/Method.js~TestListensMethodEvent2.html"]', 'TestListensMethodEvent2'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ParamTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {FunctionDoc#@param} */ describe('testParamFunction', ()=> { const doc = readDoc('function/index.html'); describe('in summary', ()=> { it('has param.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-function-testParamFunction"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public testParamFunction(p1: number, p2: TestClassDefinition)'); }); }); }); describe('in details', ()=>{ it('has param.', ()=>{ findParent(doc, '[id="static-function-testParamFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public testParamFunction(p1: number, p2: TestClassDefinition)'); assert.includes(doc, '.params tbody tr:nth-child(1)', 'p1 number this is p1.'); assert.includes(doc, '.params tbody tr:nth-child(2)', 'p2 TestClassDefinition this is p2.'); assert.includes(doc, '.params tbody tr:nth-child(2) a', 'class/src/Class/Definition.js~TestClassDefinition.html', 'href'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ParamTest/MethodTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@desc} */ describe('TestParamMethod', ()=> { const doc = readDoc('class/src/Param/Method.js~TestParamMethod.html'); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public method1(p1: number, p2: TestClassDefinition)'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public method1(p1: number, p2: TestClassDefinition)'); assert.includes(doc, '.params tbody tr:nth-child(1)', 'p1 number this is p1.'); assert.includes(doc, '.params tbody tr:nth-child(2)', 'p2 TestClassDefinition this is p2.'); assert.includes(doc, '.params tbody tr:nth-child(2) a', 'class/src/Class/Definition.js~TestClassDefinition.html', 'href'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/PropertyTest/ReturnTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@property} */ describe('TestPropertyReturn', ()=> { const doc = readDoc('class/src/Property/Return.js~TestPropertyReturn.html'); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="returnProperties"] tbody tr:nth-child(1)', 'x1 number this is x1 of return value.'); assert.includes(doc, '[data-ice="returnProperties"] tbody tr:nth-child(2)', 'x2 TestClassDefinition this is x2 of return value.'); assert.includes(doc, '[data-ice="returnProperties"] tbody tr:nth-child(2) a', 'class/src/Class/Definition.js~TestClassDefinition.html', 'href'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ReturnTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {FunctionDoc#@return} */ describe('test return', ()=>{ const doc = readDoc('function/index.html'); describe('testReturnFunction1', ()=> { describe('in summary', ()=> { it('has return.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-function-testReturnFunction1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public testReturnFunction1(): TestClassDefinition'); }); }); }); describe('in details', ()=>{ it('has return.', ()=>{ findParent(doc, '[id="static-function-testReturnFunction1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public testReturnFunction1(): TestClassDefinition'); assert.includes(doc, '[data-ice="returnParams"] tbody tr', 'TestClassDefinition this is return value.'); assert.includes(doc, '[data-ice="returnParams"] tbody tr a', 'class/src/Class/Definition.js~TestClassDefinition.html', 'href'); }); }); }); }); describe('testReturnFunction2', ()=> { describe('in summary', ()=> { it('has return.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-function-testReturnFunction2"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public testReturnFunction2(): number'); }); }); }); describe('in details', ()=>{ it('has return.', ()=>{ findParent(doc, '[id="static-function-testReturnFunction2"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public testReturnFunction2(): number'); assert.includes(doc, '[data-ice="returnParams"] tbody tr', 'number this is return value.'); }); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ReturnTest/MethodTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {MethodDoc#@return} */ describe('TestReturnMethod', ()=> { const doc = readDoc('class/src/Return/Method.js~TestReturnMethod.html'); describe('in summary', ()=> { it('has return', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public method1(): number'); }); findParent(doc, '[data-ice="summary"] [href$="#instance-method-method2"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public method2(): TestClassDefinition'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public method1(): number'); assert.includes(doc, '[data-ice="returnParams"] tbody tr', 'number this is return value.'); }); findParent(doc, '[id="instance-method-method2"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public method2(): TestClassDefinition'); assert.includes(doc, '[data-ice="returnParams"] tbody tr', 'TestClassDefinition this is return value.'); assert.includes(doc, '[data-ice="returnParams"] tbody tr a', 'class/src/Class/Definition.js~TestClassDefinition.html', 'href'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/SeeTest/ClassTest.js ================================================ import {readDoc, assert, find, findParent} from './../../util.js'; /** @test {AbstractDoc#@see} */ describe('TestSeeClass', ()=> { const doc = readDoc('class/src/See/Class.js~TestSeeClass.html'); it('has see from class.', ()=> { find(doc, '.self-detail [data-ice="see"]', (doc)=>{ assert.includes(doc, 'a[href="http://foo.example.com"]', 'http://foo.example.com'); assert.includes(doc, 'a[href="http://bar.example.com"]', 'http://bar.example.com'); }); }); it('has see from constructor.', ()=>{ findParent(doc, '[id="instance-constructor-constructor"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="see"] a[href="http://example.com"]', 'http://example.com'); }); }); it('has see from member.', ()=>{ findParent(doc, '[id="instance-member-p1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="see"] a[href="http://example.com"]', 'http://example.com'); }); }); it('has see from method.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="see"] a[href="http://example.com"]', 'http://example.com'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/SeeTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@see} */ describe('testSeeFunction', ()=> { const doc = readDoc('function/index.html'); it('has see.', ()=>{ findParent(doc, '[id="static-function-testSeeFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="see"] a[href="http://example.com"]', 'http://example.com'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/SeeTest/VariableTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@see} */ describe('testSeeVariable', ()=> { const doc = readDoc('variable/index.html'); it('has see.', ()=>{ findParent(doc, '[id="static-variable-testSeeVariable"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="see"] a[href="http://example.com"]', 'http://example.com'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/SinceTest/ClassTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@since} */ describe('TestSinceClass', ()=> { const doc = readDoc('class/src/Since/Class.js~TestSinceClass.html'); it('has since at class.', ()=> { assert.includes(doc, '.header-notice [data-ice="since"]', 'since 1.2.3'); }); describe('in summary', ()=>{ it('has since at constructor.', ()=>{ findParent(doc, '[href$="#instance-constructor-constructor"]', '[data-ice="target"]', (doc)=>{ assert.includes(doc, '[data-ice="since"]', 'since 1.2.3'); }); }); it('has since at member.', ()=>{ findParent(doc, '[href$="#instance-member-p1"]', '[data-ice="target"]', (doc)=>{ assert.includes(doc, '[data-ice="since"]', 'since 1.2.3'); }); }); it('has since at method.', ()=>{ findParent(doc, '[href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=>{ assert.includes(doc, '[data-ice="since"]', 'since 1.2.3'); }); }); }); describe('in detail', ()=>{ it('has since at constructor.', ()=>{ findParent(doc, '[id="instance-constructor-constructor"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="since"]', 'since 1.2.3'); }); }); it('has since at member.', ()=>{ findParent(doc, '[id="instance-member-p1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="since"]', 'since 1.2.3'); }); }); it('has since at method.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="since"]', 'since 1.2.3'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/SinceTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@since} */ describe('testSinceFunction', ()=> { const doc = readDoc('function/index.html'); describe('in summary', ()=>{ it('has since.', ()=>{ findParent(doc, '[data-ice="summary"] [href$="#static-function-testSinceFunction"]', '[data-ice="target"]', (doc)=>{ assert.includes(doc, '[data-ice="since"]', 'since 1.2.3'); }); }); }); describe('in detail', ()=>{ it('has since.', ()=>{ findParent(doc, '[id="static-function-testSinceFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="since"]', 'since 1.2.3'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/SinceTest/VariableTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@since} */ describe('testSinceVariable', ()=> { const doc = readDoc('variable/index.html'); describe('in summary', ()=>{ it('has since.', ()=>{ findParent(doc, '[data-ice="summary"] [href$="#static-variable-testSinceVariable"]', '[data-ice="target"]', (doc)=>{ assert.includes(doc, '[data-ice="since"]', 'since 1.2.3'); }); }); }); describe('in detail', ()=>{ it('has since.', ()=>{ findParent(doc, '[id="static-variable-testSinceVariable"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="since"]', 'since 1.2.3'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ThrowsTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@throws} */ describe('testThrowsFunction', ()=> { const doc = readDoc('function/index.html'); it('has throws.', ()=>{ findParent(doc, '[id="static-function-testThrowsFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="throw"] a[href="class/src/Throws/Function.js~TestThrowsFunctionError.html"]', 'TestThrowsFunctionError'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/ThrowsTest/MethodTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@throws} */ describe('TestThrowsMethod', ()=> { const doc = readDoc('class/src/Throws/Method.js~TestThrowsMethod.html'); it('has throws.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'tr[data-ice="throw"]:nth-child(1)', 'TestThrowsMethodError1 throw error if foo.'); assert.includes(doc, 'tr[data-ice="throw"]:nth-child(1) a', 'class/src/Throws/Method.js~TestThrowsMethodError1.html', 'href'); assert.includes(doc, 'tr[data-ice="throw"]:nth-child(2)', 'TestThrowsMethodError2 throw error if bar.'); assert.includes(doc, 'tr[data-ice="throw"]:nth-child(2) a', 'class/src/Throws/Method.js~TestThrowsMethodError2.html', 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TodoTest/ClassTest.js ================================================ import {readDoc, assert, find, findParent} from './../../util.js'; /** @test {AbstractDoc#@todo} */ describe('TestTodoClass', ()=> { const doc = readDoc('class/src/Todo/Class.js~TestTodoClass.html'); it('has todo at class.', ()=> { find(doc, '.self-detail [data-ice="todo"]', (doc)=>{ assert.includes(doc, 'li:nth-child(1)', 'this is first todo.'); assert.includes(doc, 'li:nth-child(2)', 'this is second todo.'); }); }); it('has todo at constructor.', ()=>{ findParent(doc, '[id="instance-constructor-constructor"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="todo"]', 'this is todo'); }); }); it('has see from member.', ()=>{ findParent(doc, '[id="instance-member-p1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="todo"]', 'this is todo'); }); }); it('has see from method.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="todo"]', 'this is todo'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TodoTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@todo} */ describe('testTodoFunction', ()=> { const doc = readDoc('function/index.html'); it('has todo.', ()=>{ findParent(doc, '[id="static-function-testTodoFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="todo"]', 'this is todo.'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TodoTest/VariableTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@todo} */ describe('testTodoVariable', ()=> { const doc = readDoc('variable/index.html'); it('has see.', ()=>{ findParent(doc, '[id="static-variable-testTodoVariable"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="todo"]', 'this is todo.'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TrailingCommaTest/DefinitionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {ESParser} */ describe('TestTrailingCommaDefinition', ()=> { const doc = readDoc('class/src/TrailingComma/Definition.js~TestTrailingCommaDefinition.html'); describe('in self detail', ()=> { it('has desc.', ()=> { assert.includes(doc, '.self-detail [data-ice="description"]', 'this is TestTrailingCommaDefinition.'); }); }); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public method1(p1: number, p2: string)'); }); findParent(doc, '[data-ice="summary"] [href$="#instance-method-method2"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public method2()'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '.params [data-ice="property"]:nth-of-type(1)', 'p1 number this is p1.'); assert.includes(doc, '.params [data-ice="property"]:nth-of-type(2)', 'p2 string this is p2.'); }); findParent(doc, '[id="instance-method-method2"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="description"]', 'this is method2.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/ArrayTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeArray', ()=> { const doc = readDoc('class/src/Type/Array.js~TestTypeArray.html'); it('has array type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: number[])'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/ClassTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeClass', ()=> { const doc = readDoc('class/src/Type/Class.js~TestTypeClass.html'); it('has class type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: TestTypeClassInner)'); assert.includes(doc, 'a[href="class/src/Type/Class.js~TestTypeClassInner.html"]', 'TestTypeClassInner'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/ComplexTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeComplex', ()=> { const doc = readDoc('class/src/Type/Complex.js~TestTypeComplex.html'); it('has function complex type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: function(x1: number[], x2: Map): Object)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object' ], 'href'); }); }); it('has complex generics type.', ()=>{ findParent(doc, '[data-ice="summary"] [href$="#instance-method-method2"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method2(p1: Map)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String', ], 'href'); }); }); it('has complex record type.', ()=>{ findParent(doc, '[data-ice="summary"] [href$="#instance-method-method3"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method3(p1: {x1: number[], x2: Map, x3: {y1: number, y2: string}})'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String', ], 'href'); }); }); it('has complex union type.', ()=>{ findParent(doc, '[data-ice="summary"] [href$="#instance-method-method4"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method4(p1: number | string, p2: number | string)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String', ], 'href'); }); }); it('has complex union type in generics.', ()=>{ findParent(doc, '[data-ice="summary"] [href$="#instance-method-method5"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method5(p1: Promise)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error' ], 'href'); }); }); it('has complex union type with spread.', ()=>{ findParent(doc, '[data-ice="summary"] [href$="#instance-method-method6"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method6(p1: ...(number|string))'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String' ], 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/DefaultTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeDefault', ()=> { const doc = readDoc('class/src/Type/Default.js~TestTypeDefault.html'); it('has default value.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '.params [data-ice="property"]:nth-child(1)', 'optional default: 123'); assert.includes(doc, '.params [data-ice="property"]:nth-child(2)', 'optional default: []'); }); }); it('has default value of object.', ()=>{ findParent(doc, '[id="instance-method-method2"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '.params [data-ice="property"]:nth-child(1)', 'optional default: new Foo()'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/ExternalTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeExternal', ()=> { const doc = readDoc('class/src/Type/External.js~TestTypeExternal.html'); it('has external type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: ArrayBuffer)'); assert.includes(doc, 'a[href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"]', 'ArrayBuffer'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeFunction', ()=> { const doc = readDoc('class/src/Type/Function.js~TestTypeFunction.html'); it('has function type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: function(x1: number, x2: string): boolean)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean' ], 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/GenericsTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeGenerics', ()=> { const doc = readDoc('class/src/Type/Generics.js~TestTypeGenerics.html'); it('has generics type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: Array, p2: Map, p3: Promise)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error' ], 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/LiteralTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeLiteral', ()=> { const doc = readDoc('class/src/Type/Literal.js~TestTypeLiteral.html'); it('has literal type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: number, p2: string, p3: boolean)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean' ], 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/NullableTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeNullable', ()=> { const doc = readDoc('class/src/Type/Nullable.js~TypeTestNullable.html'); it('has nullable value.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '.params [data-ice="property"]:nth-child(1)', 'nullable: true'); assert.includes(doc, '.params [data-ice="property"]:nth-child(2)', 'nullable: false'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/ObjectTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeObject', ()=> { const doc = readDoc('class/src/Type/Object.js~TestTypeObject.html'); it('has object type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: Object)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object' ], 'href'); }); }); it('has object property.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '.params [data-ice="property"]:nth-child(1)', 'p1 Object this is object p1.'); assert.includes(doc, '.params [data-ice="property"]:nth-child(2)', 'p1.x1 number this is number x1.'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/OptionalTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeOptional', ()=> { const doc = readDoc('class/src/Type/Optional.js~TestTypeOptional.html'); it('has optional attribute.', ()=>{ findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '.params [data-ice="property"]:nth-child(1)', 'optional'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/RecordTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeRecord', ()=> { const doc = readDoc('class/src/Type/Record.js~TestTypeRecord.html'); it('has record type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: {x1: number, x2: string})'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String' ], 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/SpreadTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeSpread', ()=> { const doc = readDoc('class/src/Type/Spread.js~TestTypeSpread.html'); it('has spread type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: ...number)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number' ], 'href'); }); }); it('has object spread type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method2"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method2(config: Object)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object' ], 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/TypedefTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeTypedef', ()=> { const doc = readDoc('class/src/Type/Typedef.js~TestTypeTypedef.html'); it('has typedef type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: TestTypeTypedefInner)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'typedef/index.html#static-typedef-TestTypeTypedefInner' ], 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypeTest/UnionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** * @test {ParamParser#parseParamValue} * @test {ParamParser#parseParam} */ describe('TestTypeUnion', ()=> { const doc = readDoc('class/src/Type/Union.js~TestTypeUnion.html'); it('has union type.', ()=> { findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'method1(p1: number | string)'); assert.multiIncludes(doc, '[data-ice="signature"] a', [ 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number', 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String' ], 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/TypedefTest/DefinitionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {TypedefDoc} */ describe('TestTypedefDefinition', ()=> { const doc = readDoc('typedef/index.html'); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-typedef-TestTypedefDefinition"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public TestTypedefDefinition: Object'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-typedef-TestTypedefDefinition"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public TestTypedefDefinition: Object'); assert.includes(doc, '.params [data-ice="property"]:nth-child(1)', 'p1 number this is p1.'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/UndocumentTest/DefinitionTest.js ================================================ import {readDoc, assert} from './../../util.js'; /** * @test {DocFactory#_traverseComments} * @test {AbstractDoc#@desc} * @test {DocResolver#_resolveUndocumentIdentifier} */ describe('TestUndocumentDefinition', ()=> { const doc = readDoc('class/src/Undocument/Definition.js~TestUndocumentDefinition.html'); it('is exist', ()=> { assert.includes(doc, '.self-detail [data-ice="name"]', 'TestUndocumentDefinition'); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/VariableTest/ArrayPatterTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {VariableDoc} */ describe('testVariableArrayPattern', ()=> { const doc = readDoc('variable/index.html'); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-variable-testVariableArrayPattern1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public testVariableArrayPattern1: number'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-variable-testVariableArrayPattern1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public testVariableArrayPattern1: number'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/VariableTest/DefinitionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {VariableDoc} */ describe('testVariableDefinition', ()=> { const doc = readDoc('variable/index.html'); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-variable-testVariableDefinition"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public testVariableDefinition: number'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-variable-testVariableDefinition"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public testVariableDefinition: number'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/VariableTest/ObjectPatterTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {VariableDoc} */ describe('testVariableObjectPattern', ()=> { const doc = readDoc('variable/index.html'); describe('in summary', ()=> { it('has desc', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-variable-testVariableObjectPattern1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, null, 'public testVariableObjectPattern1: number'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-variable-testVariableObjectPattern1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, 'h3', 'public testVariableObjectPattern1: number'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/VersionTest/ClassTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@version} */ describe('TestVersionClass', ()=> { const doc = readDoc('class/src/Version/Class.js~TestVersionClass.html'); describe('in self detail', ()=> { it('has version.', ()=> { assert.includes(doc, '.header-notice [data-ice="version"]', '1.2.3'); }); }); describe('in summary', ()=> { it('has version', ()=> { assert.includes(doc, '[data-ice="constructorSummary"] [data-ice="version"]', '1.2.3'); findParent(doc, '[data-ice="summary"] [href$="#instance-member-p1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="version"]', '1.2.3'); }); findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="version"]', '1.2.3'); }); }); }); describe('in details', ()=>{ it('has version', ()=>{ findParent(doc, '[id="instance-constructor-constructor"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="version"]', '1.2.3'); }); findParent(doc, '[id="instance-member-p1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="version"]', '1.2.3'); }); findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="version"]', '1.2.3'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/VersionTest/FunctionTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@version} */ describe('testVersionFunction', ()=> { const doc = readDoc('function/index.html'); describe('in summary', ()=> { it('has version', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-function-testVersionFunction"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="version"]', '1.2.3'); }); }); }); describe('in details', ()=>{ it('has version.', ()=>{ findParent(doc, '[id="static-function-testVersionFunction"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="version"]', '1.2.3'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/DocumentTest/VersionTest/VariableTest.js ================================================ import {readDoc, assert, findParent} from './../../util.js'; /** @test {AbstractDoc#@version} */ describe('testVersionVariable', ()=> { const doc = readDoc('variable/index.html'); describe('in summary', ()=> { it('has version', ()=> { findParent(doc, '[data-ice="summary"] [href$="#static-variable-testVersionVariable"]', '[data-ice="target"]', (doc)=> { assert.includes(doc, '[data-ice="version"]', '1.2.3'); }); }); }); describe('in details', ()=>{ it('has desc.', ()=>{ findParent(doc, '[id="static-variable-testVersionVariable"]', '[data-ice="detail"]', (doc)=>{ assert.includes(doc, '[data-ice="version"]', '1.2.3'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/FileTest/FileTest.js ================================================ import {readDoc, assert} from './../util.js'; /** @test {FileDocBuilder} */ describe('test source code file', ()=> { const doc = readDoc('file/src/Desc/Class.js.html'); it('has source code.', ()=>{ assert.includes(doc, 'body [data-ice="title"]', 'src/Desc/Class.js'); assert.includes(doc, 'code[data-ice="content"]', 'export default class TestDescClass {'); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/IdentifiersTest/IdentifiersTest.js ================================================ import {readDoc, assert, findParent} from './../util.js'; /** @test {IdentifiersDocBuilder} */ describe('test identifiers', ()=> { const doc = readDoc('identifiers.html'); it('has Abstract summary.', ()=>{ findParent(doc, '#abstract', '[data-ice="dirSummaryWrap"]', (doc)=>{ assert.includes(doc, '[data-ice="dirSummary"] [data-ice="target"]:nth-of-type(1)', 'public C TestAbstractDefinition'); }); }); it('has Version summary.', ()=>{ findParent(doc, '#version', '[data-ice="dirSummaryWrap"]', (doc)=>{ assert.includes(doc, '[data-ice="dirSummary"] [data-ice="target"]:nth-of-type(1)', 'public C TestVersionClass'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/IndexTest/IndexTest.js ================================================ import {readDoc, assert} from './../util.js'; /** @test {IndexDocBuilder} */ describe('test index', ()=> { const doc = readDoc('index.html'); it('has README.md', ()=>{ assert.includes(doc, '[data-ice="index"]', 'this is ESDoc Test Fixture README.'); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/ManualTest/ManualTest.js ================================================ import {readDoc, assert, find} from './../util.js'; /** @test {ManualDocBuilder} */ describe('test manual', ()=>{ describe('test navigation', ()=>{ it('has manual link in header', ()=>{ const doc = readDoc('index.html'); assert.includes(doc, '[data-ice="manualHeaderLink"]', 'Manual'); assert.includes(doc, '[data-ice="manualHeaderLink"]', './manual/index.html', 'href'); }); /** @test {ManualDocBuilder#_buildManualNav} */ it('has manual navigation', ()=>{ const doc = readDoc('manual/index.html'); find(doc, '[data-ice="nav"]', (doc)=>{ assert.includes(doc, '[data-ice="manual"]:nth-of-type(1)', 'Overview Feature Demo License Author'); assert.includes(doc, '[data-ice="manual"]:nth-of-type(2)', 'Design Concept Architecture Model'); assert.includes(doc, '[data-ice="manual"]:nth-of-type(3)', 'Installation indent 2 indent 3 indent 4 indent 5'); assert.includes(doc, '[data-ice="manual"]:nth-of-type(4)', 'Tutorial'); assert.includes(doc, '[data-ice="manual"]:nth-of-type(5)', 'Usage'); assert.includes(doc, '[data-ice="manual"]:nth-of-type(6)', 'Usage2 h2 in usage2 h3 in usage2'); assert.includes(doc, '[data-ice="manual"]:nth-of-type(7)', 'Configuration'); assert.includes(doc, '[data-ice="manual"]:nth-of-type(8)', 'Example Minimum Config Integration Test Code Into Documentation'); assert.includes(doc, '[data-ice="manual"]:nth-of-type(9)', 'Advanced'); assert.includes(doc, '[data-ice="manual"]:nth-of-type(10)', 'FAQ Goal'); assert.includes(doc, '[data-ice="manual"]:nth-of-type(11)', 'Changelog 0.0.1'); // overview find(doc, '[data-ice="manual"]:nth-of-type(1)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/overview.html', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(2) a', 'manual/overview.html#feature', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(3) a', 'manual/overview.html#demo', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(4) a', 'manual/overview.html#license', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(5) a', 'manual/overview.html#author', 'href'); }); // design find(doc, '[data-ice="manual"]:nth-of-type(2)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/design.html', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(2) a', 'manual/design.html#concept', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(3) a', 'manual/design.html#architecture', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(4) a', 'manual/design.html#model', 'href'); }); // installation find(doc, '[data-ice="manual"]:nth-of-type(3)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/installation.html', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(2) a', 'manual/installation.html#indent-2', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(3) a', 'manual/installation.html#indent-3', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(4) a', 'manual/installation.html#indent-4', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(5) a', 'manual/installation.html#indent-5', 'href'); }); // tutorial find(doc, '[data-ice="manual"]:nth-of-type(4)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/tutorial.html', 'href'); }); // usage1 find(doc, '[data-ice="manual"]:nth-of-type(5)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/usage1.html', 'href'); }); // usage2 find(doc, '[data-ice="manual"]:nth-of-type(6)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/usage2.html', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(2) a', 'manual/usage2.html#h2-in-usage2', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(3) a', 'manual/usage2.html#h3-in-usage2', 'href'); }); // configuration find(doc, '[data-ice="manual"]:nth-of-type(7)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/configuration.html', 'href'); }); // example find(doc, '[data-ice="manual"]:nth-of-type(8)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/example.html', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(2) a', 'manual/example.html#minimum-config', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(3) a', 'manual/example.html#integration-test-code-into-documentation', 'href'); }); // advanced find(doc, '[data-ice="manual"]:nth-of-type(9)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/advanced.html', 'href'); }); // faq find(doc, '[data-ice="manual"]:nth-of-type(10)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/faq.html', 'href'); }); // changelog find(doc, '[data-ice="manual"]:nth-of-type(11)', (doc)=>{ assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(1) a', 'manual/CHANGELOG.html', 'href'); assert.includes(doc, '[data-ice="manualNav"]:nth-of-type(2) a', 'manual/CHANGELOG.html#0-0-1', 'href'); }); }); }); }); /** @test {ManualDocBuilder#_buildManualIndex} */ describe('test each heading tags', ()=>{ const doc = readDoc('manual/index.html'); it('has overview heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(1)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/overview.html', 'href'); }); }); it('has design heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(2)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/design.html', 'href'); }); }); it('has installation heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(3)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/installation.html', 'href'); }); }); it('has tutorial heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(4)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/tutorial.html', 'href'); }); }); it('has usage heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(5)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/usage1.html', 'href'); }); }); it('has usage2 heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(6)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/usage2.html', 'href'); }); }); it('has configuration heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(7)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/configuration.html', 'href'); }); }); it('has example heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(8)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/example.html', 'href'); }); }); it('has advanced heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(9)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/advanced.html', 'href'); }); }); it('has faq heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(10)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/faq.html', 'href'); }); }); it('has changelog heading tags', ()=>{ find(doc, '.manual-card-wrap:nth-of-type(11)', (doc)=>{ assert.includes(doc, '.manual-card > a', 'manual/CHANGELOG.html', 'href'); }); }); }); /** @test {ManualDocBuilder#_buildManual} */ describe('test each manual', ()=>{ it('has overview', ()=>{ const doc = readDoc('manual/overview.html'); assert.includes(doc, '.github-markdown h1', 'Overview'); assert.includes(doc, '.github-markdown[data-ice="content"]', 'ESDoc is a documentation generator for JavaScript(ES6).'); }); it('has installation', ()=>{ const doc = readDoc('manual/installation.html'); assert.includes(doc, '.github-markdown h1', 'Installation'); assert.includes(doc, '.github-markdown[data-ice="content"]', 'npm install -g esdoc'); }); it('has usage', ()=>{ const doc = readDoc('manual/usage1.html'); assert.includes(doc, '.github-markdown h1:nth-of-type(1)', 'Usage'); assert.includes(doc, '.github-markdown[data-ice="content"]', 'esdoc -c esdoc.json'); }); it('has tutorial', ()=>{ const doc = readDoc('manual/tutorial.html'); assert.includes(doc, '.github-markdown h1', 'Tutorial'); assert.includes(doc, '.github-markdown[data-ice="content"]', 'this is tutorial'); }); it('has configuration', ()=>{ const doc = readDoc('manual/configuration.html'); assert.includes(doc, '.github-markdown h1', 'Configuration'); assert.includes(doc, '.github-markdown[data-ice="content"]', 'this is configuration'); }); it('has example', ()=>{ const doc = readDoc('manual/example.html'); assert.includes(doc, '.github-markdown h1', 'Example'); assert.includes(doc, '.github-markdown[data-ice="content"] h2:nth-of-type(1)', 'Minimum Config'); }); it('has faq', ()=>{ const doc = readDoc('manual/faq.html'); assert.includes(doc, '.github-markdown h1', 'FAQ'); assert.includes(doc, '.github-markdown[data-ice="content"]', 'ESDoc has two goals.'); }); it('has changelog', ()=>{ const doc = readDoc('manual/CHANGELOG.html'); assert.includes(doc, '.github-markdown h1', 'Changelog'); assert.includes(doc, '.github-markdown[data-ice="content"] h2:nth-of-type(1)', '0.0.1'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/NavTest/NavTest.js ================================================ import {readDoc, assert, findParent} from './../util.js'; /** @test {DocBuilder#_buildNavDoc} */ describe('test navigation:', ()=> { const doc = readDoc('index.html'); it('has class', ()=>{ findParent(doc, '[data-ice="nav"] a[href="class/src/Desc/Class.js~TestDescClass.html"]', '[data-ice="doc"]', (doc)=>{ assert.includes(doc, null, 'TestDescClass'); }); }); it('has interface.', ()=>{ findParent(doc, '[data-ice="nav"] a[href="class/src/Interface/Definition.js~TestInterfaceDefinition.html"]', '[data-ice="doc"]', (doc)=>{ assert.includes(doc, null, 'TestInterfaceDefinition'); }); }); it('has function.', ()=>{ findParent(doc, '[data-ice="nav"] a[href="function/index.html#static-function-testDescFunction"]', '[data-ice="doc"]', (doc)=>{ assert.includes(doc, null, 'testDescFunction'); }); }); it('has variable.', ()=>{ findParent(doc, '[data-ice="nav"] a[href="variable/index.html#static-variable-testDescVariable"]', '[data-ice="doc"]', (doc)=>{ assert.includes(doc, null, 'testDescVariable'); }); }); it('has typedef.', ()=>{ findParent(doc, '[data-ice="nav"] a[href="typedef/index.html#static-typedef-TestTypedefDefinition"]', '[data-ice="doc"]', (doc)=>{ assert.includes(doc, null, 'TestTypedefDefinition'); }); }); it('has external.', ()=>{ findParent(doc, '[data-ice="nav"] a[href="http://example.com"]', '[data-ice="doc"]', (doc)=>{ assert.includes(doc, null, 'TestExternalDefinition'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/SearchTest/SearchTest.js ================================================ import fs from 'fs'; import assert from 'assert'; describe('test search', ()=>{ const searchIndexJS = fs.readFileSync('./test/fixture/out/script/search_index.js', {encoding: 'utf8'}).toString(); const searchIndexJSON = searchIndexJS.replace('window.esdocSearchIndex = ', ''); const searchIndex = JSON.parse(searchIndexJSON); function find(searchIndex, url) { const results = []; for (const item of searchIndex) { if (item[1] === url) results.push(item); } if (results.length > 1) assert(false, `some ${url} found. results = ${results}`); return results[0]; } it('has class index', ()=>{ assert.deepEqual(find(searchIndex, 'class/src/Desc/Class.js~TestDescClass.html'), [ 'esdoc-test-fixture/src/desc/class.js~testdescclass', 'class/src/Desc/Class.js~TestDescClass.html', 'TestDescClass esdoc-test-fixture/src/Desc/Class.js', 'class' ]); }); it('has member index', ()=>{ assert.deepEqual(find(searchIndex, 'class/src/Desc/Class.js~TestDescClass.html#instance-member-p1'), [ 'src/desc/class.js~testdescclass#p1', 'class/src/Desc/Class.js~TestDescClass.html#instance-member-p1', 'src/Desc/Class.js~TestDescClass#p1', 'member' ]); }); it('has method index', ()=>{ assert.deepEqual(find(searchIndex, 'class/src/Desc/Class.js~TestDescClass.html#instance-method-method1'), [ 'src/desc/class.js~testdescclass#method1', 'class/src/Desc/Class.js~TestDescClass.html#instance-method-method1', 'src/Desc/Class.js~TestDescClass#method1', 'method' ]); }); it('has interface index', ()=>{ assert.deepEqual(find(searchIndex, 'class/src/Interface/Definition.js~TestInterfaceDefinition.html'), [ 'esdoc-test-fixture/src/interface/definition.js~testinterfacedefinition', 'class/src/Interface/Definition.js~TestInterfaceDefinition.html', 'TestInterfaceDefinition esdoc-test-fixture/src/Interface/Definition.js', 'class' ]); }); it('has function index', ()=>{ assert.deepEqual(find(searchIndex, 'function/index.html#static-function-testDescFunction'), [ 'esdoc-test-fixture/src/desc/function.js~testdescfunction', 'function/index.html#static-function-testDescFunction', 'testDescFunction esdoc-test-fixture/src/Desc/Function.js', 'function' ]); }); it('has variable index', ()=>{ assert.deepEqual(find(searchIndex, 'variable/index.html#static-variable-testDescVariable'), [ 'esdoc-test-fixture/src/desc/variable.js~testdescvariable', 'variable/index.html#static-variable-testDescVariable', 'testDescVariable esdoc-test-fixture/src/Desc/Variable.js', 'variable' ]); }); it('has typedef index', ()=>{ assert.deepEqual(find(searchIndex, 'typedef/index.html#static-typedef-TestTypedefDefinition'), [ 'src/typedef/definition.js~testtypedefdefinition', 'typedef/index.html#static-typedef-TestTypedefDefinition', 'src/Typedef/Definition.js~TestTypedefDefinition', 'typedef' ]); }); it('has external index', ()=>{ assert.deepEqual(find(searchIndex, 'http://example.com'), [ 'src/external/definition.js~testexternaldefinition', 'http://example.com', 'src/External/Definition.js~TestExternalDefinition', 'external' ]); }); it('has file index', ()=>{ assert.deepEqual(find(searchIndex, 'file/src/Desc/Class.js.html'), [ 'src/desc/class.js', 'file/src/Desc/Class.js.html', 'src/Desc/Class.js', 'file' ]); }); it('has test file index', ()=>{ assert.deepEqual(find(searchIndex, 'test-file/test/DescTest.js.html'), [ 'test/desctest.js', 'test-file/test/DescTest.js.html', 'test/DescTest.js', 'testFile' ]); }); it('has test index', ()=>{ assert.deepEqual(find(searchIndex, 'test-file/test/DescTest.js.html#lineNumber2'), [ 'testdescclass src/desc/class.js~testdescclass,testdescclass', 'test-file/test/DescTest.js.html#lineNumber2', 'Use describe style mocha interface', 'test' ]); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/TestTest/TestLinkTest.js ================================================ import {readDoc, assert, findParent} from './../util.js'; /** @test {ClassDocBuilder} */ describe('test link of test', ()=>{ const doc = readDoc('class/src/Desc/Class.js~TestDescClass.html'); it('has link of test at class', ()=>{ assert.multiIncludes(doc, '.self-detail [data-ice="test"] a', [ 'Use describe style mocha interface', 'Use suite style mocha interface' ]); assert.multiIncludes(doc, '.self-detail [data-ice="test"] a', [ 'test-file/test/DescTest.js.html#lineNumber2', 'test-file/test/DescTest.js.html#lineNumber23' ], 'href'); }); it('has link of test at constructor', ()=>{ findParent(doc, '#instance-constructor-constructor', '[data-ice="detail"]', (doc)=>{ assert.multiIncludes(doc, '[data-ice="test"] a', [ 'Use describe style mocha interface Use it style mocha interface', 'Use suite style mocha interface Use test style mocha interface' ]); assert.multiIncludes(doc, '[data-ice="test"] a', [ 'test-file/test/DescTest.js.html#lineNumber4', 'test-file/test/DescTest.js.html#lineNumber25', ], 'href'); }); }); it('has link of test at member', ()=>{ findParent(doc, '#instance-member-p1', '[data-ice="detail"]', (doc)=>{ assert.multiIncludes(doc, '[data-ice="test"] a', [ 'Use describe style mocha interface Nested describe', 'Use suite style mocha interface Nested suite' ]); assert.multiIncludes(doc, '[data-ice="test"] a', [ 'test-file/test/DescTest.js.html#lineNumber8', 'test-file/test/DescTest.js.html#lineNumber29' ], 'href'); }); }); it('has link of test at method', ()=>{ findParent(doc, '#instance-method-method1', '[data-ice="detail"]', (doc)=>{ assert.multiIncludes(doc, '[data-ice="test"] a', [ 'Use describe style mocha interface Use context style mocha interface', 'Use suite style mocha interface Nested suite Nested test' ]); assert.multiIncludes(doc, '[data-ice="test"] a', [ 'test-file/test/DescTest.js.html#lineNumber15', 'test-file/test/DescTest.js.html#lineNumber31' ], 'href'); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/TestTest/TestTest.js ================================================ import {readDoc, assert, findParent} from './../util.js'; /** * @test {TestDocBuilder} * @test {TestDocBuilder#_buildTestDocHTML} */ describe('test integration of test', ()=> { const doc = readDoc('test.html').find('[data-ice="tests"]'); describe('describe/it style', ()=>{ it('has describe', ()=>{ findParent(doc, 'a[href="test-file/test/DescTest.js.html#lineNumber2"]', '[data-ice="testInterface"]', (doc)=>{ assert.includes(doc, null, 'Use describe style mocha interface TestDescClass'); assert.multiIncludes(doc, 'a', [ 'test-file/test/DescTest.js.html#lineNumber2', 'class/src/Desc/Class.js~TestDescClass.html' ], 'href'); }); }); it('has it', ()=>{ findParent(doc, 'a[href="test-file/test/DescTest.js.html#lineNumber4"]', '[data-ice="testInterface"]', (doc)=>{ assert.includes(doc, null, 'Use it style mocha interface TestDescClass#constructor'); assert.multiIncludes(doc, 'a', [ 'test-file/test/DescTest.js.html#lineNumber4', 'class/src/Desc/Class.js~TestDescClass.html#instance-constructor-constructor' ], 'href'); }); }); it('has nested describe', ()=>{ findParent(doc, 'a[href="test-file/test/DescTest.js.html#lineNumber8"]', '[data-ice="testInterface"]', (doc)=>{ assert.includes(doc, null, 'Nested describe TestDescClass#p1'); assert.multiIncludes(doc, 'a', [ 'test-file/test/DescTest.js.html#lineNumber8', 'class/src/Desc/Class.js~TestDescClass.html#instance-member-p1' ], 'href'); }); }); it('has nested it', ()=>{ findParent(doc, 'a[href="test-file/test/DescTest.js.html#lineNumber10"]', '[data-ice="testInterface"]', (doc)=>{ assert.includes(doc, null, 'Nested it in describe testDescVariable'); assert.multiIncludes(doc, 'a', [ 'test-file/test/DescTest.js.html#lineNumber10', 'variable/index.html#static-variable-testDescVariable' ], 'href'); }); }); }); describe('context style', ()=>{ it('has context', ()=>{ findParent(doc, 'a[href="test-file/test/DescTest.js.html#lineNumber15"]', '[data-ice="testInterface"]', (doc)=>{ assert.includes(doc, null, 'Use context style mocha interface TestDescClass#method1'); assert.multiIncludes(doc, 'a', [ 'test-file/test/DescTest.js.html#lineNumber15', 'class/src/Desc/Class.js~TestDescClass.html#instance-method-method1' ], 'href'); }); }); it('has context it', ()=>{ findParent(doc, 'a[href="test-file/test/DescTest.js.html#lineNumber17"]', '[data-ice="testInterface"]', (doc)=>{ assert.includes(doc, null, 'Nested it in context testDescFunction'); assert.multiIncludes(doc, 'a', [ 'test-file/test/DescTest.js.html#lineNumber17', 'function/index.html#static-function-testDescFunction' ], 'href'); }); }); }); describe('suite/test style', ()=>{ it('has suite', ()=>{ findParent(doc, 'a[href="test-file/test/DescTest.js.html#lineNumber23"]', '[data-ice="testInterface"]', (doc)=>{ assert.includes(doc, null, 'Use suite style mocha interface TestDescClass'); assert.multiIncludes(doc, 'a', [ 'test-file/test/DescTest.js.html#lineNumber23', 'class/src/Desc/Class.js~TestDescClass.html' ], 'href'); }); }); it('has test', ()=>{ findParent(doc, 'a[href="test-file/test/DescTest.js.html#lineNumber25"]', '[data-ice="testInterface"]', (doc)=>{ assert.includes(doc, null, 'Use test style mocha interface TestDescClass#constructor'); assert.multiIncludes(doc, 'a', [ 'test-file/test/DescTest.js.html#lineNumber25', 'class/src/Desc/Class.js~TestDescClass.html#instance-constructor-constructor' ], 'href'); }); }); it('has nested suite', ()=>{ findParent(doc, 'a[href="test-file/test/DescTest.js.html#lineNumber29"]', '[data-ice="testInterface"]', (doc)=>{ assert.includes(doc, null, 'Nested suite TestDescClass#p1'); assert.multiIncludes(doc, 'a', [ 'test-file/test/DescTest.js.html#lineNumber29', 'class/src/Desc/Class.js~TestDescClass.html#instance-member-p1' ], 'href'); }); }); it('has nested test', ()=>{ findParent(doc, 'a[href="test-file/test/DescTest.js.html#lineNumber31"]', '[data-ice="testInterface"]', (doc)=>{ assert.includes(doc, null, 'Nested test TestDescClass#method1'); assert.multiIncludes(doc, 'a', [ 'test-file/test/DescTest.js.html#lineNumber31', 'class/src/Desc/Class.js~TestDescClass.html#instance-method-method1' ], 'href'); }); }); }); }); ================================================ FILE: esdoc-publish-html-plugin/test/src/init.js ================================================ const path = require('path'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/fixture/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); } cli(); ================================================ FILE: esdoc-publish-html-plugin/test/src/util.js ================================================ import _assert from 'assert'; import fs from 'fs'; import cheerio from 'cheerio'; // import path from 'path'; // import ESDocCLI from '../../src/ESDocCLI.js'; // export function cli(configPath = null) { // const cliPath = path.resolve('./src/cli.js'); // const argv = ['node', cliPath]; // // if (configPath) { // configPath = path.resolve(configPath); // argv.push('-c', configPath); // console.log(`process: ${configPath}`); // } // // const cli = new ESDocCLI(argv); // consoleLogSwitch(false); // cli.exec(); // consoleLogSwitch(true); // } export function readDoc(fileName, dirName = './test/fixture/out') { const html = fs.readFileSync(`${dirName}/${fileName}`, {encoding: 'utf-8'}); const $ = cheerio.load(html); return $('html').first(); } export function find($el, selector, callback) { const $els = $el.find(selector); if (!$els.length) _assert(false, `node is not found. selector = "${selector}"`); if ($els.length !== 1) _assert(false, `many nodes are found. selector = "${selector}"`); callback($els.first()); } export function findParent($el, selector, parentSelector, callback) { find($el, selector, ($child)=>{ const $parents = $child.parents(parentSelector); if (!$parents.length) _assert(false, `parent is not found. selector = "${parentSelector}"`); if ($parents.length !== 1) _assert(false, `many parents are found. selector = "${parentSelector}"`); callback($parents.first()); }); } function getActual($el, selector, attr) { let $target; if (selector) { const $els = $el.find(selector); if (!$els.length) _assert(false, `node is not found. selector = "${selector}"`); if ($els.length !== 1) _assert(false, `many nodes are found. selector = "${selector}"`); $target = $els.first(); } else { $target = $el; } if (!$target.length) { _assert(false, `node is not found. selector = "${selector}"`); } let actual; if (attr) { actual = $target.attr(attr); } else { actual = $target.text().replace(/\s+/g, ' '); } if (actual === null) { _assert(false, `actual is null. selector = ${selector}, attr = ${attr}`); } return actual; } _assert.includes = function($el, selector, expect, attr) { const actual = getActual($el, selector, attr); _assert(actual.includes(expect) === true, `selector: "${selector}",\nactual: ${actual}\nexpect: ${expect}`); }; _assert.multiIncludes = function($el, selector, expects, attr) { const $targets = $el.find(selector); if ($targets.length !== expects.length) _assert(false, `node length and expects length is mismatch. selector = "${selector}"`); for (let i = 0; i < $targets.length; i++) { const $target = $targets.eq(i); let actual; if (attr) { actual = $target.attr(attr); } else { actual = $target.text().replace(/\s+/g, ' '); } if (actual === null) { _assert(false, `actual is null. selector = ${selector}, attr = ${attr}`); } const expect = expects[i]; _assert(actual.includes(expect) === true, `selector: "${selector}",\nactual: ${actual}\nexpect: ${expect}`); } }; _assert.notIncludes = function($el, selector, expect, attr) { const actual = getActual($el, selector, attr); _assert(actual.includes(expect) === false, `selector: "${selector}"`); }; export const assert = _assert; // const consoleLog = console.log; // export function consoleLogSwitch(on) { // if (on) { // console.log = consoleLog; // } else { // console.log = ()=>{}; // } // } ================================================ FILE: esdoc-publish-markdown-plugin/CHANGELOG.md ================================================ # Changelog ## Next - **Feat** - Add `option.filename` ([#56](https://github.com/esdoc/esdoc-plugins/pull/56)). Thanks [@Verikon](https://github.com/Verikon) ================================================ FILE: esdoc-publish-markdown-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-publish-markdown-plugin/README.md ================================================ # ESDoc Publish Markdown Plugin (PoC) **This plugin is proof of concept.** **So, the plugin has only minimum features.** **We are waiting for your pull request!** ## Example [example](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-publish-markdown-plugin/misc/index.md) ## Install ```bash npm install esdoc-publish-markdown-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ { "name": "esdoc-publish-markdown-plugin", "option": { "filename":"README.md" } } ] } ``` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-publish-markdown-plugin/misc/index.md ================================================ # Class ## `MyClass` this is MyClass ### `constructor()` this is constructor ### `member1: number` this is member1. ### `member2: string` this is member2. ### `method1(p1: ...number): boolean` this is method1. | Name | Type | Attribute | Description | | --- | --- | --- | --- | | p1 | ...number | | this is p1 | ### `method2(p1: number)` this is method2. | Name | Type | Attribute | Description | | --- | --- | --- | --- | | p1 | number | optional: true, default: 10 | this is p1 | # Function ## `myFunction(p1: number): string` this is myFunction | Name | Type | Attribute | Description | | --- | --- | --- | --- | | p1 | number | | this is p1. | ================================================ FILE: esdoc-publish-markdown-plugin/package.json ================================================ { "name": "esdoc-publish-markdown-plugin", "version": "1.0.0", "description": "A publish markdown plugin for ESDoc [PoC]", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "ice-cap": "0.0.4", "to-markdown": "3.0.4" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "markdown", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-publish-markdown-plugin/src/AbstractBuilder.js ================================================ const path = require('path'); const fs = require('fs'); class AbstractBuilder { constructor(docs) { this._docs = docs; } makeHTML() { return ''; } _findAll(cond = {}) { const keys = Object.keys(cond); return this._docs.filter((doc) =>{ for (const key of keys) if (doc[key] !== cond[key]) return false; return true; }); } _find(cond = {}) { return this._findAll(cond)[0]; } _makeSignature(doc) { if (['constructor', 'method', 'function'].includes(doc.kind)) { let params = []; if (doc.params) params = doc.params.map(param => `${param.name}: ${param.types.join('|')}`); const type = doc.return ? `: ${doc.return.types.join('|')}` : ''; return `\`${doc.name}(${params.join(', ')})${type}\``; } if (['member', 'variable'].includes(doc.kind)) { const type = doc.type ? doc.type.types.join('|') : '*'; return `\`${doc.name}: ${type}\``; } } _makeParamAttribute(param) { const attrs = []; if (param.nullable !== null) attrs.push(`nullable: ${param.nullable}`); if (param.optional) attrs.push('optional: true'); if (param.defaultValue) attrs.push(`default: ${param.defaultValue}`); return attrs.join(', '); } _readTemplate(fileName) { const filePath = path.resolve(__dirname, `./template/${fileName}`); return fs.readFileSync(filePath, {encoding: 'utf-8'}); } } module.exports = AbstractBuilder; ================================================ FILE: esdoc-publish-markdown-plugin/src/ClassBuilder.js ================================================ const AbstractBuilder = require('./AbstractBuilder'); const IceCap = require('ice-cap').default; class ClassBuilder extends AbstractBuilder { makeHTML() { const docs = this._findAll({kind: 'class'}); const outputs = []; for (const doc of docs) { const ice = new IceCap(this._readTemplate('class.html')); this._applyBody(doc, ice); this._applyConstructor(doc, ice); this._applyMember(doc, ice); this._applyMethod(doc, ice); outputs.push(ice.html); } return outputs.join('\n'); } _applyBody(classDoc, ice) { ice.text('className', `\`${classDoc.name}\``); ice.text('classDesc', classDoc.description); } _applyConstructor(classDoc, ice) { const constructorDoc = this._find({kind: 'constructor', memberof: classDoc.longname}); if (constructorDoc) { ice.text('constructorSignature', this._makeSignature(constructorDoc)); ice.text('constructorDesc', constructorDoc.description); } } _applyMember(classDoc, ice) { const memberDocs = this._findAll({kind: 'member', memberof: classDoc.longname}); ice.loop('member', memberDocs, (index, doc, ice) =>{ ice.text('memberSignature', this._makeSignature(doc)); ice.text('memberDesc', doc.description); }); } _applyMethod(classDoc, ice) { const methodDocs = this._findAll({kind: 'method', memberof: classDoc.longname}); ice.loop('method', methodDocs, (index, doc, ice) =>{ ice.text('methodSignature', this._makeSignature(doc)); ice.text('methodDesc', doc.description); const params = doc.params || []; ice.loop('methodParam', params, (index, param, ice) =>{ ice.text('name', param.name); ice.text('type', param.types.join('|')); ice.text('attribute', this._makeParamAttribute(param) || ' '); ice.text('desc', param.description); }); }); } } module.exports = ClassBuilder; ================================================ FILE: esdoc-publish-markdown-plugin/src/FunctionBuilder.js ================================================ const AbstractBuilder = require('./AbstractBuilder'); const IceCap = require('ice-cap').default; class FunctionBuilder extends AbstractBuilder { makeHTML() { const docs = this._docs.filter(doc => doc.kind === 'function'); const outputs = []; for (const doc of docs) { const ice = new IceCap(this._readTemplate('function.html')); this._applyBody(doc, ice); this._applyParam(doc, ice); outputs.push(ice.html); } return outputs.join('\n'); } _applyBody(doc, ice) { ice.text('functionName', this._makeSignature(doc)); ice.text('functionDesc', doc.description); } _applyParam(doc, ice) { const params = doc.params || []; ice.loop('functionParam', params, (index, param, ice) =>{ ice.text('name', param.name); ice.text('type', param.types.join('|')); ice.text('attribute', this._makeParamAttribute(param) || ' '); ice.text('desc', param.description); }); } } module.exports = FunctionBuilder; ================================================ FILE: esdoc-publish-markdown-plugin/src/Plugin.js ================================================ const toMarkdown = require('to-markdown'); const ClassBuilder = require('./ClassBuilder'); const FunctionBuilder = require('./FunctionBuilder'); class Plugin { onHandleDocs(ev) { this._docs = ev.data.docs; } onPublish(ev) { // create builder const classBuilder = new ClassBuilder(this._docs); const functionBuilder = new FunctionBuilder(this._docs); // create html let html = ''; html += '

    Class

    \n' + classBuilder.makeHTML() + '\n'; html += '

    Function

    \n' + functionBuilder.makeHTML() + '\n'; // to markdown const markdown = this._toMarkdown(html); // write file const filename = ev.data.option && ev.data.option.filename ? ev.data.option.filename : 'index.md'; ev.data.writeFile(filename, markdown); } _toMarkdown(html) { // div is using as wrapper. so remove self tag. const converter = { filter: 'div', replacement: function (innerHTML, node) { return innerHTML; } }; return toMarkdown(html, {gfm: true, converters: [converter]}); } } module.exports = new Plugin(); ================================================ FILE: esdoc-publish-markdown-plugin/src/template/class.html ================================================

    Name Type Attribute Description
    ================================================ FILE: esdoc-publish-markdown-plugin/src/template/function.html ================================================

    Name Type Attribute Description
    ================================================ FILE: esdoc-publish-markdown-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-publish-markdown-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-publish-markdown-plugin/test/src/MyClass.js ================================================ /** * this is MyClass */ export default class MyClass { /** * this is constructor */ constructor() { /** * this is member1. * @type {number} */ this.member1 = 10; /** * this is member2. * @type {string} */ this.member2 = 'foo'; } /** * this is method1. * @param {...number} p1 - this is p1 * @return {boolean} return boolean */ method1(...p1){} /** * this is method2. * @param {number} [p1=10] - this is p1 */ method2(p1 = 10){} } ================================================ FILE: esdoc-publish-markdown-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const {hasLine} = require('../util'); describe('test/MyClass.js:', ()=> { it('has class', ()=>{ assert(hasLine('## `MyClass`')); assert(hasLine('this is MyClass')); }); it('has constructor', ()=>{ assert(hasLine('### `constructor()`')); assert(hasLine('this is constructor')); }); it('has member', ()=>{ assert(hasLine('### `member1: number`')); assert(hasLine('this is member1.')); }); it('has method', ()=>{ assert(hasLine('### `method1(p1: ...number): boolean`')); assert(hasLine('this is method1.')); assert(hasLine('| p1 | ...number | | this is p1 |')); }); }); ================================================ FILE: esdoc-publish-markdown-plugin/test/src/myFunction.js ================================================ /** * this is myFunction * @param {number} p1 - this is p1. * @return {string} return string. */ export default function myFunction(p1){} ================================================ FILE: esdoc-publish-markdown-plugin/test/src/myFunction.test.js ================================================ const assert = require('assert'); const {hasLine} = require('../util'); describe('test/myFunction.js:', ()=> { it('has function', ()=>{ assert(hasLine('## `myFunction(p1: number): string`')); assert(hasLine('this is myFunction')); }); it('has param', ()=>{ assert(hasLine('| p1 | number | | this is p1. |')); }); }); ================================================ FILE: esdoc-publish-markdown-plugin/test/util.js ================================================ const fs = require('fs'); const md = fs.readFileSync('./test/out/index.md').toString(); const lines = md.split('\n'); module.exports.hasLine = function hasLine(line) { return lines.includes(line); }; ================================================ FILE: esdoc-react-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.1 (2017-09-10) - **Fix** - Crash when `esdoc-publish-html-plugin`@1.1.0 ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-react-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-react-plugin/README.md ================================================ # ESDoc React Plugin (PoC) **This plugin is proof of concept.** **So, the plugin has only minimum features.** **We are waiting for your pull request!** ## Example ```js /** * This is MyClass. * @reactProps {!number} prop1 - this is prop1 * @reactProps {string} prop2 - this is prop2 */ export default class MyClass extends React.Component { } ``` ## Install ```bash npm install esdoc-react-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-standard-plugin"}, {"name": "esdoc-react-plugin"} ] } ``` ## Dependency - esdoc-standard-plugin ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-react-plugin/package.json ================================================ { "name": "esdoc-react-plugin", "version": "1.0.1", "description": "A React plugin for ESDoc [PoC]", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "cheerio": "1.0.0-rc.1" }, "devDependencies": { "esdoc": "latest", "esdoc-standard-plugin": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "react", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-react-plugin/src/Plugin.js ================================================ const path = require('path'); const cheerio = require('cheerio'); const ParamParser = require('esdoc/out/src/Parser/ParamParser').default; const DocBuilder = require('esdoc-publish-html-plugin/out/src/Builder/DocBuilder').default; class Plugin { constructor() { this._docs = null; this._reactPropsDocs = null; } onHandleDocs(ev) { this._docs = ev.data.docs; const reactPropsDocs = []; for (const doc of ev.data.docs) { if (doc.kind !== 'class') continue; if (!doc.unknown) continue; const reactProps = doc.unknown.filter(v => v.tagName === '@reactProps'); if (!reactProps.length) continue; reactPropsDocs.push({ longname: doc.longname, fileName: `${doc.longname}.html`, reactProps: reactProps }); } this._reactPropsDocs = reactPropsDocs; } onHandleContent(ev) { const content = ev.data.content; const fileName = ev.data.fileName; // only html if (path.extname(fileName) !== '.html') return; // find target doc const doc = this._reactPropsDocs.find(doc => { const regexp = new RegExp(`${doc.fileName}$`); if (fileName.match(regexp)) return true; }); if (!doc) return; // create esdoc properties from react props const properties = doc.reactProps.map(reactProp => { const {typeText, paramName, paramDesc} = ParamParser.parseParamValue(reactProp.tagValue); return ParamParser.parseParam(typeText, paramName, paramDesc); }); // hack: create html const docBuilder = DocBuilder.createDefaultBuilder(); const html = docBuilder._buildProperties(properties, 'React Props:').html; // append html const $ = cheerio.load(content); $('.self-detail.detail').append(html); ev.data.content = $.html(); } } module.exports = new Plugin(); ================================================ FILE: esdoc-react-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "esdoc-standard-plugin"}, {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-react-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-react-plugin/test/src/MyClass.js ================================================ /** * This is MyClass. * @reactProps {!number} prop1 - this is prop1 * @reactProps {string} prop2 - this is prop2 */ export default class MyClass extends React.Component { } /** * this is NonReactClass */ export class NonReactClass { } ================================================ FILE: esdoc-react-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const {load, text} = require('../util'); describe('test/MyClass.js:', ()=> { it('has React props', ()=>{ const $ = load('./test/out/class/src/MyClass.js~MyClass.html'); const $table = $('.self-detail.detail [data-ice="properties"]'); assert.equal(text($table, 'tbody tr:nth-child(1)'), 'prop1 number nullable: false this is prop1'); assert.equal(text($table, 'tbody tr:nth-child(2)'), 'prop2 string this is prop2'); }); it('does not have React props', ()=>{ const $ = load('./test/out/class/src/MyClass.js~NonReactClass.html'); const $table = $('.self-detail.detail [data-ice="properties"]'); assert.equal($table.length, 0); }); }); ================================================ FILE: esdoc-react-plugin/test/util.js ================================================ const fs = require('fs'); const cheerio = require('cheerio'); module.exports.load = function(fileName) { const html = fs.readFileSync(fileName, {encoding: 'utf-8'}); return cheerio.load(html); }; module.exports.text = function($el, query) { return $el.find(query).text().replace(/\s+/g, ' ').trim(); }; ================================================ FILE: esdoc-standard-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-standard-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-standard-plugin/README.md ================================================ # ESDoc Standard Plugin ## Install ```bash npm install esdoc-standard-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ { "name": "esdoc-standard-plugin", "option": { "lint": {"enable": true}, "coverage": {"enable": true}, "accessor": {"access": ["public", "protected", "private"], "autoPrivate": true}, "undocumentIdentifier": {"enable": true}, "unexportedIdentifier": {"enable": false}, "typeInference": {"enable": true}, "brand": { "logo": "./logo.png", "title": "My Library", "description": "this is awesome library", "repository": "https://github.com/foo/bar", "site": "http://my-library.org", "author": "https://twitter.com/foo", "image": "http://my-library.org/logo.png" }, "manual": { "index": "./manual/index.md", "globalIndex": true, "asset": "./manual/asset", "files": [ "./manual/overview.md", "./manual/design.md", "./manual/installation.md", "./manual/usage1.md", "./manual/usage2.md", "./manual/tutorial.md", "./manual/configuration.md", "./manual/example.md", "./manual/advanced.md", "./manual/faq.md", "./CHANGELOG.md" ] }, "test": { "source": "./test/", "interfaces": ["describe", "it", "context", "suite", "test"], "includes": ["(spec|Spec|test|Test)\\.js$"], "excludes": ["\\.config\\.js$"] } } } ] } ``` The `esdoc-standard-plugin` is a glue plugin. The following plugins are used by this. - [esdoc-lint-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-lint-plugin) - [esdoc-coverage-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-coverage-plugin) - [esdoc-accessor-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-accessor-plugin) - [esdoc-type-inference-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-type-inference-plugin) - [esdoc-external-ecmascript-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-external-ecmascript-plugin) - [esdoc-brand-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-brand-plugin) - [esdoc-undocumented-identifier-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-undocumented-identifier-plugin) - [esdoc-unexported-identifier-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-unexported-identifier-plugin) - [esdoc-integrate-manual-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-integrate-manual-plugin) - [esdoc-integrate-test-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-integrate-test-plugin) - [esdoc-publish-html-plugin](https://github.com/esdoc/esdoc-plugins/tree/master/esdoc-publish-html-plugin) ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-standard-plugin/package.json ================================================ { "name": "esdoc-standard-plugin", "version": "1.0.0", "description": "A standard plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "esdoc-lint-plugin": "^1.0.0", "esdoc-coverage-plugin": "^1.0.0", "esdoc-accessor-plugin": "^1.0.0", "esdoc-external-ecmascript-plugin": "^1.0.0", "esdoc-brand-plugin": "^1.0.0", "esdoc-undocumented-identifier-plugin": "^1.0.0", "esdoc-unexported-identifier-plugin": "^1.0.0", "esdoc-publish-html-plugin": "^1.0.0", "esdoc-type-inference-plugin": "^1.0.0", "esdoc-integrate-manual-plugin": "^1.0.0", "esdoc-integrate-test-plugin": "^1.0.0" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "standard", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-standard-plugin/src/Plugin.js ================================================ class Plugin { onHandlePlugins(ev) { const option = ev.data.option || {}; const plugins = [ {name: 'esdoc-lint-plugin', option: option.lint}, {name: 'esdoc-coverage-plugin', option: option.coverage}, {name: 'esdoc-accessor-plugin', option: option.accessor}, {name: 'esdoc-type-inference-plugin', option: option.typeInference}, {name: 'esdoc-external-ecmascript-plugin'}, {name: 'esdoc-brand-plugin', option: option.brand}, {name: 'esdoc-undocumented-identifier-plugin', option: option.undocumentIdentifier}, {name: 'esdoc-unexported-identifier-plugin', option: option.unexportedIdentifier}, {name: 'esdoc-integrate-manual-plugin', option: option.manual}, {name: 'esdoc-integrate-test-plugin', option: option.test}, {name: 'esdoc-publish-html-plugin'} ]; const existPluginNames = ev.data.plugins.map(plugin => plugin.name); for (const plugin of plugins) { if (existPluginNames.includes(plugin.name)) continue; if (plugin.option === undefined) delete plugin.option; ev.data.plugins.push(plugin); } } } module.exports = new Plugin(); ================================================ FILE: esdoc-standard-plugin/test/README.md ================================================ [![Build Status](https://travis-ci.org/esdoc/esdoc.svg?branch=master)](https://travis-ci.org/esdoc/esdoc) [![Coverage Status](https://coveralls.io/repos/esdoc/esdoc/badge.svg)](https://coveralls.io/r/esdoc/esdoc) # ESDoc Test Fixture this is ESDoc Test Fixture README. - item1 - item2 - item3 1st line. second line. http://github.com/h13i32maru/esdoc ```javascript export default class Foo { static get foo() {} constructor(p1) { } } var foo = 123; ``` | First Header | Second Header | | ------------- | ------------- | | Content Cell | Content Cell | | Content Cell | Content Cell | **text** ~~text~~ # text ## text ### text #### text ##### text ================================================ FILE: esdoc-standard-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "index": "./test/README.md", "package": "./test/package.json", "plugins": [ { "name": "./src/Plugin.js", "option": { "brand": { "title": "My Library" }, "manual": { "files": ["./test/manual/overview.md"] }, "test": { "source": "./test/test", "includes": ["Test.js$"] } } }, { "name": "./test/spy-plugin.js" } ] } ================================================ FILE: esdoc-standard-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-standard-plugin/test/manual/overview.md ================================================ # This is Overview fixture ================================================ FILE: esdoc-standard-plugin/test/package.json ================================================ { "name": "esdoc-test-fixture", "version": "1.2.3", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc" }, "main": "./src/Class/Definition.js" } ================================================ FILE: esdoc-standard-plugin/test/spy-plugin.js ================================================ exports.onHandlePlugins = function(ev) { exports.testTargetPlugins = ev.data.plugins; }; ================================================ FILE: esdoc-standard-plugin/test/src/MyClass.js ================================================ export default class MyClass { /** * this is invalid param name. * @param xxx */ invalidMeethod(p){} /** * @param {number} p */ method1(p){} /** * @protected */ method2(){} /** * @private */ method3(){} _method4(p = 1){} } ================================================ FILE: esdoc-standard-plugin/test/src/Plugin.test.js ================================================ const assert = require('assert'); const path = require('path'); describe('test standard plugin:', ()=>{ it('dynamically load plugins', ()=>{ const plugins = require('../spy-plugin.js').testTargetPlugins; assert.deepEqual(plugins, [ {name: './src/Plugin.js', option: { brand: { title: 'My Library' }, manual: { files: ['./test/manual/overview.md'] }, test: { source: "./test/test", includes: ["Test.js$"] } }}, {name: './test/spy-plugin.js'}, {name: 'esdoc-lint-plugin'}, {name: 'esdoc-coverage-plugin'}, {name: 'esdoc-accessor-plugin'}, {name: 'esdoc-type-inference-plugin'}, {name: 'esdoc-external-ecmascript-plugin'}, {name: 'esdoc-brand-plugin', option: {title: 'My Library'}}, {name: 'esdoc-undocumented-identifier-plugin'}, {name: 'esdoc-unexported-identifier-plugin'}, {name: 'esdoc-integrate-manual-plugin', option: { coverage: true, files: ['./test/manual/overview.md'] }}, {name: 'esdoc-integrate-test-plugin', option: { source: "./test/test", interfaces: ["describe", "it", "context", "suite", "test"], includes: ["Test.js$"], excludes: ["\\.config\\.js$"] }}, {name: 'esdoc-publish-html-plugin'}, ]); }); }); ================================================ FILE: esdoc-standard-plugin/test/test/MyClassTest.js ================================================ const assert = require('assert'); const MyClass = require('../src/MyClass'); /** * @test {MyClass} */ describe('MyClass', ()=>{ it('has MyClass', ()=>{ assert(MyClass) }); }); ================================================ FILE: esdoc-type-inference-plugin/CHANGELOG.md ================================================ # Changelog ## Next - **Fix** - Crash if `export default foo = new Foo()` ([#55](https://github.com/esdoc/esdoc-plugins/pull/55)). Thanks [@ushu](https://github.com/ushu) ## 1.0.1 (2017-09-03) - **Fix** - Broken if array sparse destructuring ([esdoc/esdoc#394](https://github.com/esdoc/esdoc/pull/394)) Thanks [@technicallyfeasible](https://github.com/technicallyfeasible) ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-type-inference-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-type-inference-plugin/README.md ================================================ # ESDoc Type Inference Plugin(PoC) **This is Proof of Concept** ## Install ```bash npm install esdoc-type-inference-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-type-inference-plugin", "option": {"enable": true}} ] } ``` - `enable` is default `true` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-type-inference-plugin/package.json ================================================ { "name": "esdoc-type-inference-plugin", "version": "1.0.1", "description": "A type inference plugin for ESDoc [PoC]", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "inference", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-type-inference-plugin/src/Plugin.js ================================================ const ASTNodeContainer = require('esdoc/out/src/Util/ASTNodeContainer.js').default; const ASTUtil = require('esdoc/out/src/Util/ASTUtil').default; class Plugin { onHandleDocs(ev) { this._docs = ev.data.docs; this._option = ev.data.option || {}; if (!('enable' in this._option)) this._option.enable = true; this._exec(); } _exec() { if (!this._option.enable) return this._docs; this._inferenceMethod(); this._inferenceFunction(); this._inferenceGetter(); this._inferenceSetter(); this._inferenceMember(); this._inferenceVariable(); } _inferenceMethod() { const docs = this._docs.filter((doc) => doc.kind === 'method'); for (const doc of docs) { const node = ASTNodeContainer.getNode(doc.__docId__); if (!doc.params) doc.params = this._inferenceParam(node); if (!doc.return) doc.return = this._inferenceReturn(node); } } _inferenceFunction() { const docs = this._docs.filter((doc) => doc.kind === 'function'); for (const doc of docs) { const node = ASTNodeContainer.getNode(doc.__docId__); if (!doc.params) doc.params = this._inferenceParam(node); if (!doc.return) doc.return = this._inferenceReturn(node); } } _inferenceGetter() { const docs = this._docs.filter((doc) => doc.kind === 'get'); for (const doc of docs) { const node = ASTNodeContainer.getNode(doc.__docId__); if (!doc.type) doc.type = this._inferenceReturn(node); } } _inferenceSetter() { // todo: infer setter is not working. please implement inference. // const docs = this._docs.filter((doc) => doc.kind === 'set'); // // for (const doc of docs) { // const node = ASTNodeContainer.getNode(doc.__docId__); // if (!doc.type) doc.type = this._inferenceType(node.right); // } } _inferenceMember() { const docs = this._docs.filter((doc) => doc.kind === 'member'); for (const doc of docs) { const node = ASTNodeContainer.getNode(doc.__docId__); if (!doc.type) doc.type = this._inferenceType(node.right); } } _inferenceVariable() { const docs = this._docs.filter((doc) => doc.kind === 'variable'); for (const doc of docs) { if (doc.type) continue; const node = ASTNodeContainer.getNode(doc.__docId__); let className; // e.g. `export default foo = new Foo();` if (node.type === 'AssignmentExpression') { if (node.right && node.right.type === 'NewExpression') { className = node.right.callee.name; } else { doc.type = this._inferenceType(node.right); continue; } } // e.g. `let foo = new Foo();` if (node.type === 'VariableDeclaration') { if (node.declarations[0].init.type === 'NewExpression') { className = node.declarations[0].init.callee.name; } else { doc.type = this._inferenceType(node.declarations[0].init); continue; } } // can not infer className if (!className) { doc.type = {types: ['*']}; continue; } if (className) { // infer from same file. const classDoc = this._docs.find((_doc) =>{ if (_doc.kind === 'class' && _doc.memberof === doc.memberof && _doc.name === className) { return true; } }); if (classDoc) { doc.type = {types: [classDoc.longname]}; continue; } // ambiguous infer from other file const ambiguousClassDocs = this._docs.filter((_doc) => { if (_doc.kind === 'class' && _doc.name === className) { return true; } }); if (ambiguousClassDocs.length === 1) { doc.type = {types: [ambiguousClassDocs[0].longname]}; continue; } // can not infer doc.type = {types: ['*']}; } else { doc.type = {types: ['*']}; } } } _inferenceParam(node) { const params = node.params; const _params = []; for (let i = 0; i < params.length; i++) { const param = params[i]; const result = {}; switch (param.type) { case 'Identifier': // e.g. func(a){} result.name = param.name; result.types = ['*']; break; case 'AssignmentPattern': if (param.left.type === 'Identifier') { result.name = param.left.name; } else if (param.left.type === 'ObjectPattern') { result.name = `objectPattern${i === 0 ? '' : i}`; } else if (param.left.type === 'ArrayPattern') { result.name = `arrayPattern${i === 0 ? '' : i}`; } result.optional = true; if (param.right.type.includes('Literal')) { // e.g. func(a = 10){} result.types = param.right.value === null ? ['*'] : [typeof param.right.value]; result.defaultRaw = param.right.value; result.defaultValue = `${result.defaultRaw}`; } else if (param.right.type === 'ArrayExpression') { // e.g. func(a = [123]){} result.types = param.right.elements.length ? [`${typeof param.right.elements[0].value}[]`] : ['*[]']; result.defaultRaw = param.right.elements.map((elm)=> elm.value); result.defaultValue = `${JSON.stringify(result.defaultRaw)}`; } else if (param.right.type === 'ObjectExpression') { const typeMap = {}; for (const prop of param.left.properties || []) { typeMap[prop.key.name] = '*'; } // e.g. func(a = {key: 123}){} const obj = {}; for (const prop of param.right.properties) { obj[prop.key.name] = prop.value.value; typeMap[prop.key.name] = typeof prop.value.value; } const types = []; for (const key of Object.keys(typeMap)) { types.push(`"${key}": ${typeMap[key]}`); } result.types = [`{${types.join(', ')}}`]; result.defaultRaw = obj; result.defaultValue = `${JSON.stringify(result.defaultRaw)}`; } else if (param.right.type === 'Identifier') { // e.g. func(a = value){} result.types = ['*']; result.defaultRaw = param.right.name; result.defaultValue = `${param.right.name}`; } else { // e.g. func(a = new Foo()){}, func(a = foo()){} // CallExpression, NewExpression result.types = ['*']; } break; case 'RestElement': // e.g. func(...a){} result.name = `${param.argument.name}`; result.types = ['...*']; result.spread = true; break; case 'ObjectPattern': { const objectPattern = []; const raw = {}; for (const property of param.properties) { if (property.type === 'ObjectProperty') { objectPattern.push(`"${property.key.name}": *`); raw[property.key.name] = null; } else if (property.type === 'RestProperty') { objectPattern.push(`...${property.argument.name}: Object`); raw[property.argument.name] = {}; } } result.name = `objectPattern${i === 0 ? '' : i}`; result.types = [`{${objectPattern.join(', ')}}`]; result.defaultRaw = raw; result.defaultValue = `${JSON.stringify(result.defaultRaw)}`; break; } case 'ArrayPattern': { // e.g. func([a, b = 10]){} let arrayType = null; const raw = []; for (const element of param.elements) { if (!element) { // case `function([, v]){} raw.push('undefined'); } else if (element.type === 'Identifier') { raw.push('null'); } else if (element.type === 'AssignmentPattern') { if ('value' in element.right) { if (!arrayType && element.right.value !== null) arrayType = typeof element.right.value; raw.push(JSON.stringify(element.right.value)); } else { raw.push('*'); } } } if (!arrayType) arrayType = '*'; result.name = `arrayPattern${i === 0 ? '' : i}`; result.types = [`${arrayType}[]`]; result.defaultRaw = raw; result.defaultValue = `[${raw.join(', ')}]`; break; } default: logger.w('unknown param.type', param); } _params.push(result); } return _params; } _inferenceReturn(node) { const body = node.body; const result = {}; const inferenceType = this._inferenceType.bind(this); ASTUtil.traverse(body, (node, parent, path)=>{ // `return` in Function is not the body's `return` if (node.type.includes('Function')) { path.skip(); return; } if (node.type !== 'ReturnStatement') return; if (!node.argument) return; result.types = inferenceType(node.argument).types; }); if (result.types) { return result; } return null; } _inferenceType(right) { if (!right) { return {types: ['*']}; } if (right.type === 'TemplateLiteral') { return {types: ['string']}; } if (right.type === 'NullLiteral') { return {types: ['*']}; } if (right.type.includes('Literal')) { return {types: [typeof right.value]}; } if (right.type === 'ArrayExpression') { if (right.elements.length) { return {types: [`${typeof right.elements[0].value}[]`]}; } else { return {types: ['*[]']}; } } if (right.type === 'ObjectExpression') { const typeMap = {}; for (const prop of right.properties) { switch (prop.type) { case 'ObjectProperty': { const name = `"${prop.key.name || prop.key.value}"`; typeMap[name] = prop.value.value ? typeof prop.value.value : '*'; break; } case 'ObjectMethod': { const name = `"${prop.key.name || prop.key.value}"`; typeMap[name] = 'function'; break; } case 'SpreadProperty': { const name = `...${prop.argument.name}`; typeMap[name] = 'Object'; break; } default: { const name = `"${prop.key.name || prop.key.value}"`; typeMap[name] = '*'; } } } const types = []; for (const key of Object.keys(typeMap)) { types.push(`${key}: ${typeMap[key]}`); } return {types: [`{${types.join(', ')}}`]}; } return {types: ['*']}; } } module.exports = new Plugin(); ================================================ FILE: esdoc-type-inference-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-type-inference-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-type-inference-plugin/test/src/Getter.js ================================================ export default class TestGetter { get getLiteral () { return 123; } get getArray () { return [123, 456]; } get getObject() { return {x1: 123, x2: 'text'}; } get getTemplateLiteral() { return `text`; } } ================================================ FILE: esdoc-type-inference-plugin/test/src/Getter.test.js ================================================ const assert = require('assert'); const {find} = require('../util'); describe('test/Getter.js:', ()=>{ it('infer type that is literal', ()=>{ const doc = find('longname', 'src/Getter.js~TestGetter#getLiteral'); assert.deepEqual(doc.type, {types: ['number']}); }); it('infer type that is array', ()=>{ const doc = find('longname', 'src/Getter.js~TestGetter#getArray'); assert.deepEqual(doc.type, {types: ['number[]']}); }); it('infer type that is object', ()=>{ const doc = find('longname', 'src/Getter.js~TestGetter#getObject'); assert.deepEqual(doc.type, {types: ['{"x1": number, "x2": string}']}); }); it('infer type that is template literal', ()=>{ const doc = find('longname', 'src/Getter.js~TestGetter#getTemplateLiteral'); assert.deepEqual(doc.type, {types: ['string']}); }); }); ================================================ FILE: esdoc-type-inference-plugin/test/src/Member.js ================================================ export default class TestMember { constructor() { // literal this.memberLiteral = 123; // array this.memberArray = [123, 456]; // object this.memberObject = {x1: 123, x2: 'text'}; // template literal this.memberTemplateLiteral= `text`; } } ================================================ FILE: esdoc-type-inference-plugin/test/src/Member.test.js ================================================ const assert = require('assert'); const {find} = require('../util'); describe('test/Member.js:', ()=>{ it('infer type that is literal', ()=>{ const doc = find('longname', 'src/Member.js~TestMember#memberLiteral'); assert.deepEqual(doc.type, {types: ['number']}); }); it('infer type that is array', ()=>{ const doc = find('longname', 'src/Member.js~TestMember#memberArray'); assert.deepEqual(doc.type, {types: ['number[]']}); }); it('infer type that is object', ()=>{ const doc = find('longname', 'src/Member.js~TestMember#memberObject'); assert.deepEqual(doc.type, {types: ['{"x1": number, "x2": string}']}); }); it('infer type that is template literal', ()=>{ const doc = find('longname', 'src/Member.js~TestMember#memberTemplateLiteral'); assert.deepEqual(doc.type, {types: ['string']}); }); }); ================================================ FILE: esdoc-type-inference-plugin/test/src/Param.js ================================================ export default class TestParam { // literal default methodLiteral(p1 = 123){} // identifier default methodIdentifier(p1 = value){} // new expression default methodNewExpression(p1 = new Foo()){} // array default methodArray(p1 = [123, 456]){} // array destructuring methodArrayDestructuring([p1, p2]){} // array default and destructuring methodArrayAndDestructuring([p1, p2] = [123, 456]){} // sparse array destructuring methodArraySparseDestructuring([, p2]) {} // object default methodObject(p1 = {x1: "text", x2: true}){} // object destructuring methodObjectDestructuring({x1, x2}){} // object default and destructuring methodObjectAndDestructuring({x1, x2} = {x1: 123, x2: "text"}){} // spread methodSpread(...p1){} // array destructuring and partial default methodArrayDestructuringAndPartialDefault([p1, p2 = 10, p3 = null, p4 = 'text', p5 = v]){} } ================================================ FILE: esdoc-type-inference-plugin/test/src/Param.test.js ================================================ const assert = require('assert'); const {find} = require('../util'); describe('test/Param.js:', ()=> { it('infer literal param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodLiteral'); assert.deepEqual(doc.params, [ { "name": "p1", "optional": true, "types": [ "number" ], "defaultRaw": 123, "defaultValue": "123" } ]); }); it('infer identifier param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodIdentifier'); assert.deepEqual(doc.params, [ { "name": "p1", "optional": true, "types": [ "*" ], "defaultRaw": "value", "defaultValue": "value" } ]); }); it('infer new expression param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodNewExpression'); assert.deepEqual(doc.params, [ { "name": "p1", "optional": true, "types": [ "*" ] } ]); }); it('infer array param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodArray'); assert.deepEqual(doc.params, [ { "name": "p1", "optional": true, "types": [ "number[]" ], "defaultRaw": [ 123, 456 ], "defaultValue": "[123,456]" } ]); }); it('infer array destructuring param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodArrayDestructuring'); assert.deepEqual(doc.params, [ { "name": "arrayPattern", "types": [ "*[]" ], "defaultRaw": [ "null", "null" ], "defaultValue": "[null, null]" } ]); }); it('infer array default and destructuring param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodArrayAndDestructuring'); assert.deepEqual(doc.params, [ { "name": "arrayPattern", "optional": true, "types": [ "number[]" ], "defaultRaw": [ 123, 456 ], "defaultValue": "[123,456]" } ]); }); it('infer array sparse destructuring param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodArraySparseDestructuring'); assert.deepEqual(doc.params, [ { "name": "arrayPattern", "types": [ "*[]" ], "defaultRaw": [ 'undefined', 'null' ], "defaultValue": "[undefined, null]" } ]); }); it('infer object param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodObject'); assert.deepEqual(doc.params, [ { "name": "p1", "optional": true, "types": [ "{\"x1\": string, \"x2\": boolean}" ], "defaultRaw": { "x1": "text", "x2": true }, "defaultValue": "{\"x1\":\"text\",\"x2\":true}" } ]); }); it('infer object destructuring param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodObjectDestructuring'); assert.deepEqual(doc.params, [ { "name": "objectPattern", "types": [ "{\"x1\": *, \"x2\": *}" ], "defaultRaw": { "x1": null, "x2": null }, "defaultValue": "{\"x1\":null,\"x2\":null}" } ]); }); it('infer object default and destructuring param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodObjectAndDestructuring'); assert.deepEqual(doc.params, [ { "name": "objectPattern", "optional": true, "types": [ "{\"x1\": number, \"x2\": string}" ], "defaultRaw": { "x1": 123, "x2": "text" }, "defaultValue": "{\"x1\":123,\"x2\":\"text\"}" } ]); }); it('infer spread param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodSpread'); assert.deepEqual(doc.params, [ { "name": "p1", "types": [ "...*" ], "spread": true } ]); }); it('infer array destructuring and partial default param', ()=>{ const doc = find('longname', 'src/Param.js~TestParam#methodArrayDestructuringAndPartialDefault'); assert.deepEqual(doc.params, [ { "name": "arrayPattern", "types": [ "number[]" ], "defaultRaw": [ "null", "10", "*", "\"text\"", "*" ], "defaultValue": "[null, 10, *, \"text\", *]" } ]); }); }); ================================================ FILE: esdoc-type-inference-plugin/test/src/Return.js ================================================ export default class TestReturn { // literal methodLiteral(){ return 123; } // array methodArray(){ return [123, 456]; } // object methodObject(){ return {x1: 123, x2: 'text'}; } // template literal methodTemplateLiteral(){ return `text`; } } ================================================ FILE: esdoc-type-inference-plugin/test/src/Return.test.js ================================================ const assert = require('assert'); const {find} = require('../util'); describe('test/Return.js:', ()=>{ it('infer return value that is literal', ()=>{ const doc = find('longname', 'src/Return.js~TestReturn#methodLiteral'); assert.deepEqual(doc.return, {types: ['number']}); }); it('infer return value that is array', ()=>{ const doc = find('longname', 'src/Return.js~TestReturn#methodArray'); assert.deepEqual(doc.return, {types: ['number[]']}); }); it('infer return value that is object', ()=>{ const doc = find('longname', 'src/Return.js~TestReturn#methodObject'); assert.deepEqual(doc.return, {types: ['{"x1": number, "x2": string}']}); }); it('infer return value that is template literal', ()=>{ const doc = find('longname', 'src/Return.js~TestReturn#methodTemplateLiteral'); assert.deepEqual(doc.return, {types: ['string']}); }); }); ================================================ FILE: esdoc-type-inference-plugin/test/src/Variable.js ================================================ // literal export const testVariableLiteral = 123; // array export const testVariableArray = [123, 456]; // object export const testVariableObject = {x1: 123, x2: "text"}; // template literal export const testVariableTemplateLiteral = `text`; // new expression with same file export class TestVariableNewExpression {} export default new TestVariableNewExpression(); // new expression with other file import TestMember from './Member'; export const testVariableNewExpressionOtherFile = new TestMember(); ================================================ FILE: esdoc-type-inference-plugin/test/src/Variable.test.js ================================================ const assert = require('assert'); const {find} = require('../util'); describe('test/Variable.js:', ()=>{ it('infer type that is literal', ()=>{ const doc = find('longname', 'src/Variable.js~testVariableLiteral'); assert.deepEqual(doc.type, {types: ['number']}); }); it('infer type that is array', ()=>{ const doc = find('longname', 'src/Variable.js~testVariableArray'); assert.deepEqual(doc.type, {types: ['number[]']}); }); it('infer type that is object', ()=>{ const doc = find('longname', 'src/Variable.js~testVariableObject'); assert.deepEqual(doc.type, {types: ['{"x1": number, "x2": string}']}); }); it('infer type that is template literal', ()=>{ const doc = find('longname', 'src/Variable.js~testVariableTemplateLiteral'); assert.deepEqual(doc.type, {types: ['string']}); }); it('infer type that is new expression with same file', ()=>{ const doc = find('longname', 'src/Variable.js~testVariableNewExpression'); assert.deepEqual(doc.type, {types: ['src/Variable.js~TestVariableNewExpression']}); }); it('infer type that is new expression with other file', ()=>{ const doc = find('longname', 'src/Variable.js~testVariableNewExpressionOtherFile'); assert.deepEqual(doc.type, {types: ['src/Member.js~TestMember']}); }); }); ================================================ FILE: esdoc-type-inference-plugin/test/util.js ================================================ exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; ================================================ FILE: esdoc-typescript-plugin/CHANGELOG.md ================================================ # Changelog ## Next - **Fix** - Crash if overload methods ([#42](https://github.com/esdoc/esdoc-plugins/pull/42)). Thanks [@tchakabam](https://github.com/tchakabam) - **Chore** - Update typescript ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-typescript-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-typescript-plugin/README.md ================================================ # ESDoc TypeScript Plugin (PoC) **This plugin is proof of concept** ## Install ```bash npm install esdoc-typescript-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-typescript-plugin", "option": {"enable": true}} ] } ``` - `enable` is default `true` ## Example ```js export class Foo { // without document, with initializer member: number = 10; // without document method1(n: number): string { } // without @param and @return /** * this is method2. */ method2(n: number): string { } // without type in @param and @return /** * this is method3. * @param n - this is param desc. * @return this is return desc. */ method3(n: number): string { } } ``` ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-typescript-plugin/package.json ================================================ { "name": "esdoc-typescript-plugin", "version": "1.0.0", "description": "A TypeScript plugin for ESDoc [PoC]", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "dependencies": { "typescript": "^2.8.3" }, "devDependencies": { "esdoc": "^1.1.0", "esdoc-standard-plugin": "^1.0.0", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "typescript", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-typescript-plugin/src/Plugin.js ================================================ const path = require('path'); const ts = require('typescript'); const CommentParser = require('esdoc/out/src/Parser/CommentParser').default; class Plugin { constructor() { this._enable = true; } onStart(ev) { if (!ev.data.option) return; if ('enable' in ev.data.option) this._enable = ev.data.option.enable; } onHandleConfig(ev) { if (!this._enable) return; if (!ev.data.config.includes) ev.data.config.includes = []; ev.data.config.includes.push('\\.ts$', '\\.js$'); } onHandleCodeParser(ev) { if (!this._enable) return; const esParser = ev.data.parser; const esParserOption = ev.data.parserOption; const filePath = ev.data.filePath; // ev.data.parser = this._tsParser.bind(this, esParser, esParserOption, filePath); ev.data.parser = (code) =>{ try { return this._tsParser(esParser, esParserOption, filePath, code); } catch(e) { console.log(e) } }; } // https://github.com/Microsoft/TypeScript/blob/master/src/services/transpile.ts#L26 _tsParser(esParser, esParserOption, filePath, code) { // return if not typescript if (path.extname(filePath) !== '.ts') return esParser(code); // create ast and get target nodes const sourceFile = ts.createSourceFile(filePath, code, ts.ScriptTarget.Latest, true); const nodes = this._getTargetTSNodes(sourceFile); // rewrite jsdoc comment nodes.sort((a,b) => b.pos - a.pos); // hack: transpile comment with reverse const codeChars = [...code]; for (const node of nodes) { const jsDocNode = this._getJSDocNode( node); if (jsDocNode && jsDocNode.comment) codeChars.splice(jsDocNode.pos, jsDocNode.end - jsDocNode.pos); const newComment = this._transpileComment(node, jsDocNode ? jsDocNode.comment : '', code); codeChars.splice(node.pos, 0, newComment); } const newTSCode = codeChars.join(''); // transpile typescript to es const esCode = this._transpileTS2ES(newTSCode); return esParser(esCode); } _getTargetTSNodes(sourceFile) { const nodes = []; walk(sourceFile); return nodes; function walk(node) { switch (node.kind) { case ts.SyntaxKind.ClassDeclaration: case ts.SyntaxKind.MethodDeclaration: case ts.SyntaxKind.PropertyDeclaration: case ts.SyntaxKind.GetAccessor: case ts.SyntaxKind.SetAccessor: case ts.SyntaxKind.FunctionDeclaration: nodes.push(node); break; } ts.forEachChild(node, walk); } } _getJSDocNode(node) { if (!node.jsDoc) return null; return node.jsDoc[node.jsDoc.length - 1]; } _transpileComment(node, comment, code) { const esNode = {type: 'CommentBlock', value: `*\n${comment}`}; const tags = CommentParser.parse(esNode); this._applyLOC(node, tags, code); switch(node.kind) { case ts.SyntaxKind.ClassDeclaration: // do nothing break; case ts.SyntaxKind.MethodDeclaration: this._applyCallableParam(node, tags); this._applyCallableReturn(node, tags); break; case ts.SyntaxKind.PropertyDeclaration: this._applyClassProperty(node, tags); break; case ts.SyntaxKind.GetAccessor: this._applyClassMethodGetter(node, tags); break; case ts.SyntaxKind.SetAccessor: this._applyClassMethodSetter(node, tags); break; case ts.SyntaxKind.FunctionDeclaration: this._applyCallableParam(node, tags); this._applyCallableReturn(node, tags); break; } return `\n/*${CommentParser.buildComment(tags)} */\n`; } _applyLOC(node, tags, code) { let loc = 1; const codeChars = [...code]; for (let i = 0; i < node.name.end; i++) { if (codeChars[i] === '\n') loc++; } tags.push({tagName: '@lineNumber', tagValue: `${loc}`}); } _applyCallableParam(node, tags) { const types = node.parameters.map(param => { return { type: this._getTypeFromAnnotation(param.type), name: param.name.text }; }); const paramTags = tags.filter(tag => tag.tagName === '@param'); // merge // case: params without comments if (paramTags.length === 0 && types.length) { const tmp = types.map(({type, name}) => { return { tagName: '@param', tagValue: `{${type}} ${name}` }; }); tags.push(...tmp); return; } // case: params with comments if (paramTags.length === types.length) { for (let i = 0; i < paramTags.length; i++) { const paramTag = paramTags[i]; const type = types[i]; if (paramTag.tagValue.charAt(0) !== '{') { // does not have type paramTag.tagValue = `{${type.type}} ${paramTag.tagValue}`; } } return; } // case: mismatch params and comments throw new Error('mismatch params and comments'); } _applyCallableReturn(node, tags) { if (!node.type) return; // get type const type = this._getTypeFromAnnotation(node.type); if (!type) return; // get comments const returnTag = tags.find(tag => tag.tagName === '@return' || tag.tagName === '@returns'); // merge if (returnTag && returnTag.tagValue.charAt(0) !== '{') { // return with comment but does not have type returnTag.tagValue = `{${type}} ${returnTag.tagValue}`; } else { tags.push({tagName: '@return', tagValue: `{${type}}`}); } } _applyClassMethodGetter(node, tags) { if (!node.type) return; // get type const type = this._getTypeFromAnnotation(node.type); if (!type) return; // get comments const typeComment = tags.find(tag => tag.tagName === '@type'); if (typeComment && typeComment.tagValue.charAt(0) !== '{') { // type with comment but does not have tpe typeComment.tagValue = `{${type}}`; } else { tags.push({tagName: '@type', tagValue: `{${type}}`}); } } _applyClassMethodSetter(node, tags) { if (!node.parameters) return; // get type const type = this._getTypeFromAnnotation(node.parameters[0].type); if (!type) return; // get comment const typeComment = tags.find(tag => tag.tagName === '@type'); if (typeComment) return; // merge // case: param without comment tags.push({tagName: '@type', tagValue: `{${type}}`}); } _applyClassProperty(node, tags) { if (!node.type) return; // get type const type = this._getTypeFromAnnotation(node.type); if (!type) return; // get comments const typeComment = tags.find(tag => tag.tagName === '@type'); if (typeComment && typeComment.tagValue.charAt(0) !== '{') { // type with comment but does not have tpe typeComment.tagValue = `{${type}}`; } else { tags.push({tagName: '@type', tagValue: `{${type}}`}); } } _getTypeFromAnnotation(typeNode) { if (!typeNode) { return 'undefined'; } switch(typeNode.kind) { case ts.SyntaxKind.NumberKeyword: return 'number'; case ts.SyntaxKind.StringKeyword: return 'string'; case ts.SyntaxKind.BooleanKeyword: return 'boolean'; case ts.SyntaxKind.TypeReference: return typeNode.typeName.text; } } _transpileTS2ES(tsCode) { // todo const esOption = { decorators: true, jsx: true, }; const options = { module: ts.ModuleKind.ES2015, noResolve: true, target: ts.ScriptTarget.Latest, experimentalDecorators: esOption.decorators, jsx: esOption.jsx ? 'preserve' : undefined, }; const result = ts.transpileModule(tsCode, {compilerOptions: options}); return result.outputText; } } module.exports = new Plugin(); ================================================ FILE: esdoc-typescript-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js"], "plugins": [ {"name": "./src/Plugin.js"}, {"name": "esdoc-standard-plugin"} ] } ================================================ FILE: esdoc-typescript-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-typescript-plugin/test/src/TypeScript.test.js ================================================ const assert = require('assert'); const {find, file} = require('../util'); describe('test/TypeScript.js:', ()=> { it('has type of method, without comment', ()=>{ const doc = find('longname', 'src/TypeScript.ts~TestTypeScriptClass#method1'); assert.equal(doc.params.length, 2); assert.deepEqual(doc.params[0].types, ['number']); assert.deepEqual(doc.params[1].types, ['Foo']); assert.deepEqual(doc.return.types, ['string']); }); it('has type of method, without tags', ()=>{ const doc = find('longname', 'src/TypeScript.ts~TestTypeScriptClass#method2'); assert.equal(doc.params.length, 2); assert.deepEqual(doc.params[0].types, ['number']); assert.deepEqual(doc.params[1].types, ['Foo']); assert.deepEqual(doc.return.types, ['string']); }); it('has type of method, without type', ()=>{ const doc = find('longname', 'src/TypeScript.ts~TestTypeScriptClass#method3'); assert.equal(doc.params.length, 2); assert.deepEqual(doc.params[0].types, ['number']); assert.deepEqual(doc.params[1].types, ['Foo']); assert.deepEqual(doc.return.types, ['string']); }); it('has type of getter, without comment', ()=>{ const doc = find('longname', 'src/TypeScript.ts~TestTypeScriptClass#getter1'); assert.deepEqual(doc.type.types, ['string']); }); it('has type of setter, without comment', ()=>{ const doc = find('longname', 'src/TypeScript.ts~TestTypeScriptClass#setter1'); assert.deepEqual(doc.type.types, ['number']); }); it('has type of member, without comment', ()=>{ const doc = find('longname', 'src/TypeScript.ts~TestTypeScriptClass#member1'); assert.deepEqual(doc.type.types, ['number']); }); it('has type of function, without comment', ()=>{ const doc = find('longname', 'src/TypeScript.ts~testTypeScriptFunction'); assert.equal(doc.params.length, 2); assert.deepEqual(doc.params[0].types, ['number']); assert.deepEqual(doc.params[1].types, ['Foo']); assert.deepEqual(doc.return.types, ['string']); }); }); ================================================ FILE: esdoc-typescript-plugin/test/src/TypeScript.ts ================================================ /** * this is TestTypeScriptClass. */ export class TestTypeScriptClass { member1: number = null; get getter1(): string { return 'Hello'; } set setter1(v: number) {} method1(n: number, x: Foo): string { return 'Hello'.repeat(n); } /** * this is method2. */ method2(n: number, x: Foo): string { return 'Hello'.repeat(n); } /** * this is method3. * @param n - this is n * @param x - this is x * @return this is return */ method3(n: number, x: Foo): string { return 'Hello'.repeat(n); } } export function testTypeScriptFunction(n: number, x: Foo): string{ return 'Hello'; } export class Foo{} ================================================ FILE: esdoc-typescript-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-undocumented-identifier-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-undocumented-identifier-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-undocumented-identifier-plugin/README.md ================================================ # ESDoc Undocumented Identifier Plugin ## Install ```bash npm install esdoc-undocumented-identifier-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-undocumented-identifier-plugin", "option": {"enable": true}} ] } ``` `enable` is default `true`. ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-undocumented-identifier-plugin/package.json ================================================ { "name": "esdoc-undocumented-identifier-plugin", "version": "1.0.0", "description": "A undocumented identifier plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "undocument", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-undocumented-identifier-plugin/src/Plugin.js ================================================ class Plugin { onHandleDocs(ev) { this._option = ev.data.option || {}; if (!('enable' in this._option)) this._option.enable = true; const ignore = !this._option.enable; for (const doc of ev.data.docs) { if (doc.undocument === true && ignore && !('ignore' in doc)) { doc.ignore = ignore; } } } } module.exports = new Plugin(); ================================================ FILE: esdoc-undocumented-identifier-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-undocumented-identifier-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-undocumented-identifier-plugin/test/src/MyClass.js ================================================ export class MyClass1 { } /** * this is desc * @ignore */ export class MyClass2 { } ================================================ FILE: esdoc-undocumented-identifier-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const {find, file} = require('../util'); describe('test undocumented identifier result:', ()=> { it('does not ignore undocumented identifier.', ()=>{ const doc = find('name', 'MyClass1'); assert.equal(doc.undocument, true); assert.equal(doc.ignore, undefined); }); it('ignores documented identifier with @ignore.', ()=>{ const doc = find('name', 'MyClass2'); assert.equal(doc.undocument, undefined); assert.equal(doc.ignore, true); }); }); ================================================ FILE: esdoc-undocumented-identifier-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: esdoc-unexported-identifier-plugin/CHANGELOG.md ================================================ # Changelog ## 1.0.0 (2017-07-30) - Release ================================================ FILE: esdoc-unexported-identifier-plugin/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Ryo Maruyama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: esdoc-unexported-identifier-plugin/README.md ================================================ # ESDoc Unexported Identifier Plugin ## Install ```bash npm install esdoc-unexported-identifier-plugin ``` ## Config ```json { "source": "./src", "destination": "./doc", "plugins": [ {"name": "esdoc-unexported-identifier-plugin", "option": {"enable": false}} ] } ``` `enable` is default `false`. ## LICENSE MIT ## Author [Ryo Maruyama@h13i32maru](https://github.com/h13i32maru) ================================================ FILE: esdoc-unexported-identifier-plugin/package.json ================================================ { "name": "esdoc-unexported-identifier-plugin", "version": "1.0.0", "description": "A unexported identifier plugin for ESDoc", "author": "h13i32maru", "homepage": "https://github.com/esdoc/esdoc-plugins", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/esdoc/esdoc-plugins" }, "devDependencies": { "esdoc": "latest", "mocha": "2.5.3" }, "engines": { "node": ">= 6.0.0" }, "scripts": { "test": "rm -rf ./test/out && mocha --require ./test/init.js $(find test/ -regex '.*.test.js$') -R spec" }, "keywords": [ "esdoc", "unexported", "plugin" ], "files": [ "src", "README.md" ], "main": "src/Plugin.js" } ================================================ FILE: esdoc-unexported-identifier-plugin/src/Plugin.js ================================================ class Plugin { onHandleDocs(ev) { const option = ev.data.option || {}; if (!('enable' in option)) option.enable = false; const ignore = !option.enable; for (const doc of ev.data.docs) { if (doc.export === false && ignore && !('ignore' in doc)) { doc.ignore = ignore; } } } } module.exports = new Plugin(); ================================================ FILE: esdoc-unexported-identifier-plugin/test/esdoc.json ================================================ { "source": "./test/src", "destination": "./test/out", "excludes": ["\\.test\\.js$"], "plugins": [ {"name": "./src/Plugin.js"} ] } ================================================ FILE: esdoc-unexported-identifier-plugin/test/init.js ================================================ const path = require('path'); const fs = require('fs'); const ESDocCLI = require('esdoc/out/src/ESDocCLI.js').default; function cli() { const cliPath = path.resolve('./node_modules/esdoc/out/ESDocCLI.js'); const argv = ['node', cliPath, '-c', './test/esdoc.json']; const cli = new ESDocCLI(argv); cli.exec(); global.docs = JSON.parse(fs.readFileSync('./test/out/index.json').toString()); } cli(); ================================================ FILE: esdoc-unexported-identifier-plugin/test/src/MyClass.js ================================================ class MyClass1 { } /** * @ignore */ export class MyClass2 { } export class MyClass3 { } ================================================ FILE: esdoc-unexported-identifier-plugin/test/src/MyClass.test.js ================================================ const assert = require('assert'); const {find, file} = require('../util'); describe('test unexported identifier result:', ()=> { it('ignores unexported identifier.', ()=>{ const doc = find('name', 'MyClass1'); assert.equal(doc.export, false); assert.equal(doc.ignore, true); }); it('ignores exported identifier with @ignore.', ()=>{ const doc = find('name', 'MyClass2'); assert.equal(doc.export, true); assert.equal(doc.ignore, true); }); it('does not ignore exported identifier.', ()=>{ const doc = find('name', 'MyClass3'); assert.equal(doc.export, true); assert.equal(doc.ignore, undefined); }); }); ================================================ FILE: esdoc-unexported-identifier-plugin/test/util.js ================================================ const fs = require('fs'); exports.find = function(key, ...values) { if (values.length === 1) { return global.docs.find((doc) => { if (typeof values[0] === 'string') return doc[key] === values[0]; if (values[0] instanceof RegExp) return doc[key].match(values[0]); }); } const results = []; for (const value of values) { const result = global.docs.find(doc => { if (typeof value === 'string') return doc[key] === value; if (value instanceof RegExp) return doc[key].match(value); }); results.push(result); } return results; }; exports.file = function (filePath) { return fs.readFileSync(filePath).toString(); }; ================================================ FILE: script/check.sh ================================================ #!/bin/bash for plugin in $(ls -1 -d esdoc-*) do cd $plugin # localDate=$(TZ=UTC git log --date=format-local:%Y-%m-%d -n 1 ./ | grep Date | cut -d ' ' -f 4 | cut -d 'T' -f 1) npmDate=$(npm view ./ | grep modified | awk -F "'" '{print $2}') log=$(git log --since="$npmDate" --invert-grep --grep="bump v" -n 1 ./) if [ "$log" != "" ]; then echo $plugin fi cd ../ done ================================================ FILE: script/install.sh ================================================ #!/bin/bash -e for plugin in $(ls -1 -d esdoc-*) do echo $plugin (cd $plugin && npm install) echo ======================================================================== done ================================================ FILE: script/test.sh ================================================ #!/bin/bash -e for plugin in $(ls -1 -d esdoc-*) do echo $plugin (cd $plugin && npm run test) echo ======================================================================== done