@cparra/apexdocs 2.25.0-alpha.2 → 2.25.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/cli/generate.js +291 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/examples/plain-markdown/docs/Miscellaneous/ns.SampleException.md +18 -0
- package/examples/plain-markdown/docs/Miscellaneous/ns.SampleInterface.md +6 -2
- package/examples/plain-markdown/docs/Miscellaneous/ns.Url.md +320 -0
- package/examples/plain-markdown/docs/Sample-Enums/ns.SampleEnum.md +3 -1
- package/examples/plain-markdown/docs/SampleGroup/ns.SampleClass.md +1 -1
- package/examples/plain-markdown/docs/index.md +84 -0
- package/examples/plain-markdown/force-app/classes/SampleException.cls +16 -0
- package/examples/plain-markdown/force-app/classes/Url.cls +194 -0
- package/examples/plain-markdown/package.json +2 -1
- package/jest.config.js +1 -1
- package/package.json +11 -13
- package/src/__spec__/core/generating-class-docs.spec.ts +57 -37
- package/src/__spec__/core/generating-enum-docs.spec.ts +25 -22
- package/src/__spec__/core/generating-interface-docs.spec.ts +33 -30
- package/src/__spec__/core/generating-reference-guide.spec.ts +8 -7
- package/src/__spec__/core/test-helpers.ts +9 -0
- package/src/application/Apexdocs.ts +34 -5
- package/src/application/{flows → generators}/generate-markdown-files.ts +19 -13
- package/src/cli/args.ts +138 -0
- package/src/cli/generate.ts +12 -138
- package/src/core/adapters/__tests__/documentables.spec.ts +109 -0
- package/src/{adapters → core/adapters}/__tests__/interface-adapter.spec.ts +13 -11
- package/src/{adapters → core/adapters}/__tests__/references.spec.ts +23 -2
- package/src/{adapters → core/adapters}/apex-types.ts +18 -15
- package/src/{adapters → core/adapters}/documentables.ts +54 -12
- package/src/{adapters → core/adapters}/fields-and-properties.ts +17 -10
- package/src/{adapters/references.ts → core/adapters/inline.ts} +43 -13
- package/src/{adapters → core/adapters}/methods-and-constructors.ts +21 -9
- package/src/core/adapters/type-utils.ts +13 -0
- package/src/core/{renderable → adapters}/types.d.ts +42 -4
- package/src/core/generate-docs.ts +55 -19
- package/src/core/template.ts +15 -9
- package/src/core/templates/reference-guide.ts +1 -1
- package/src/model/__tests__/manifest.spec.ts +1 -1
- package/src/model/markdown-generation-util/field-declaration-util.ts +1 -1
- package/src/model/markdown-generation-util/method-declaration-util.ts +1 -1
- package/src/model/markdown-type-file.ts +5 -1
- package/src/service/__tests__/apex-file-reader.spec.ts +1 -0
- package/src/service/apex-file-reader.ts +2 -6
- package/src/service/manifest-factory.ts +2 -2
- package/src/service/parser.ts +1 -1
- package/src/settings.ts +6 -10
- package/src/test-helpers/SettingsBuilder.ts +1 -2
- package/src/transpiler/factory.ts +2 -4
- package/src/transpiler/markdown/class-file-generatorHelper.ts +1 -18
- package/src/transpiler/markdown/plain-markdown/constructors-partial-template.ts +2 -2
- package/src/transpiler/markdown/plain-markdown/documentable-partial-template.ts +6 -4
- package/src/transpiler/markdown/plain-markdown/fieldsPartialTemplate.ts +1 -1
- package/src/transpiler/markdown/plain-markdown/methods-partial-template.ts +2 -2
- package/src/util/fp.ts +3 -0
- package/tsconfig.json +1 -1
- package/docs/.nojekyll +0 -0
- package/docs/__old/README.md +0 -1
- package/docs/__old/index.html +0 -22
- package/docs/__old/restapi.json +0 -589
- package/docs/__old/types/Classes/nspc.AnotherInterface.md +0 -22
- package/docs/__old/types/Classes/nspc.ChildClass.md +0 -97
- package/docs/__old/types/Main/nspc.GroupedClass.md +0 -10
- package/docs/__old/types/Main/nspc.SampleClass.md +0 -189
- package/docs/__old/types/Misc-Group/nspc.EscapedAnnotations.md +0 -4
- package/docs/__old/types/Misc-Group/nspc.GrandparentClass.md +0 -13
- package/docs/__old/types/Misc-Group/nspc.InterfaceWithInheritance.md +0 -29
- package/docs/__old/types/Misc-Group/nspc.MemberGrouping.md +0 -13
- package/docs/__old/types/Misc-Group/nspc.ParentClass.md +0 -37
- package/docs/__old/types/Misc-Group/nspc.Reference1.md +0 -18
- package/docs/__old/types/Misc-Group/nspc.Reference2.md +0 -12
- package/docs/__old/types/Misc-Group/nspc.Reference3.md +0 -7
- package/docs/__old/types/Misc-Group/nspc.Reference4.md +0 -7
- package/docs/__old/types/Misc-Group/nspc.Reference5.md +0 -7
- package/docs/__old/types/Misc-Group/nspc.Reference6.md +0 -9
- package/docs/__old/types/Misc-Group/nspc.Reference7.md +0 -7
- package/docs/__old/types/Misc-Group/nspc.SampleClassWithoutModifier.md +0 -11
- package/docs/__old/types/Misc-Group/nspc.SampleRestResource.md +0 -104
- package/docs/__old/types/Misc-Group/nspc.SampleRestResourceWithInnerClass.md +0 -33
- package/docs/__old/types/Misc-Group/nspc.SampleRestResourceWithoutApexDocs.md +0 -14
- package/docs/__old/types/README.md +0 -97
- package/docs/__old/types/Sample-Interfaces/nspc.SampleInterface.md +0 -23
- package/examples/includes/header.md +0 -3
- package/lib/__spec__/core/expect-extensions.d.ts +0 -3
- package/lib/__spec__/core/expect-extensions.js +0 -54
- package/lib/__spec__/core/expect-extensions.js.map +0 -1
- package/lib/__spec__/core/generating-class-docs.spec.d.ts +0 -1
- package/lib/__spec__/core/generating-class-docs.spec.js +0 -427
- package/lib/__spec__/core/generating-class-docs.spec.js.map +0 -1
- package/lib/__spec__/core/generating-enum-docs.spec.d.ts +0 -1
- package/lib/__spec__/core/generating-enum-docs.spec.js +0 -303
- package/lib/__spec__/core/generating-enum-docs.spec.js.map +0 -1
- package/lib/__spec__/core/generating-interface-docs.spec.d.ts +0 -1
- package/lib/__spec__/core/generating-interface-docs.spec.js +0 -361
- package/lib/__spec__/core/generating-interface-docs.spec.js.map +0 -1
- package/lib/__spec__/core/generating-reference-guide.spec.d.ts +0 -1
- package/lib/__spec__/core/generating-reference-guide.spec.js +0 -161
- package/lib/__spec__/core/generating-reference-guide.spec.js.map +0 -1
- package/lib/adapters/apex-types.d.ts +0 -5
- package/lib/adapters/apex-types.js +0 -109
- package/lib/adapters/apex-types.js.map +0 -1
- package/lib/adapters/documentables.d.ts +0 -7
- package/lib/adapters/documentables.js +0 -56
- package/lib/adapters/documentables.js.map +0 -1
- package/lib/adapters/fields-and-properties.d.ts +0 -4
- package/lib/adapters/fields-and-properties.js +0 -31
- package/lib/adapters/fields-and-properties.js.map +0 -1
- package/lib/adapters/methods-and-constructors.d.ts +0 -5
- package/lib/adapters/methods-and-constructors.js +0 -91
- package/lib/adapters/methods-and-constructors.js.map +0 -1
- package/lib/adapters/references.d.ts +0 -5
- package/lib/adapters/references.js +0 -82
- package/lib/adapters/references.js.map +0 -1
- package/lib/adapters/type-utils.d.ts +0 -2
- package/lib/adapters/type-utils.js +0 -7
- package/lib/adapters/type-utils.js.map +0 -1
- package/lib/application/Apexdocs.d.ts +0 -13
- package/lib/application/Apexdocs.js +0 -86
- package/lib/application/Apexdocs.js.map +0 -1
- package/lib/application/flows/generate-markdown-files.d.ts +0 -3
- package/lib/application/flows/generate-markdown-files.js +0 -57
- package/lib/application/flows/generate-markdown-files.js.map +0 -1
- package/lib/cli/generate.d.ts +0 -2
- package/lib/cli/generate.js +0 -157
- package/lib/cli/generate.js.map +0 -1
- package/lib/core/__test__/inheritance-chain.test.d.ts +0 -1
- package/lib/core/__test__/inheritance-chain.test.js +0 -42
- package/lib/core/__test__/inheritance-chain.test.js.map +0 -1
- package/lib/core/generate-docs.d.ts +0 -24
- package/lib/core/generate-docs.js +0 -267
- package/lib/core/generate-docs.js.map +0 -1
- package/lib/core/inheritance-chain.d.ts +0 -2
- package/lib/core/inheritance-chain.js +0 -35
- package/lib/core/inheritance-chain.js.map +0 -1
- package/lib/core/template.d.ts +0 -10
- package/lib/core/template.js +0 -92
- package/lib/core/template.js.map +0 -1
- package/lib/core/templates/reference-guide.d.ts +0 -1
- package/lib/core/templates/reference-guide.js +0 -18
- package/lib/core/templates/reference-guide.js.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -29
- package/lib/index.js.map +0 -1
- package/lib/model/apex-bundle.d.ts +0 -6
- package/lib/model/apex-bundle.js +0 -11
- package/lib/model/apex-bundle.js.map +0 -1
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.d.ts +0 -7
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.js +0 -14
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.js.map +0 -1
- package/lib/model/apex-type-wrappers/MethodMirrorWrapper.d.ts +0 -7
- package/lib/model/apex-type-wrappers/MethodMirrorWrapper.js +0 -12
- package/lib/model/apex-type-wrappers/MethodMirrorWrapper.js.map +0 -1
- package/lib/model/inheritance.d.ts +0 -11
- package/lib/model/inheritance.js +0 -3
- package/lib/model/inheritance.js.map +0 -1
- package/lib/model/manifest.d.ts +0 -22
- package/lib/model/manifest.js +0 -53
- package/lib/model/manifest.js.map +0 -1
- package/lib/model/markdown-file.d.ts +0 -16
- package/lib/model/markdown-file.js +0 -111
- package/lib/model/markdown-file.js.map +0 -1
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.d.ts +0 -8
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js +0 -46
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js.map +0 -1
- package/lib/model/markdown-generation-util/field-declaration-util.d.ts +0 -3
- package/lib/model/markdown-generation-util/field-declaration-util.js +0 -54
- package/lib/model/markdown-generation-util/field-declaration-util.js.map +0 -1
- package/lib/model/markdown-generation-util/index.d.ts +0 -3
- package/lib/model/markdown-generation-util/index.js +0 -20
- package/lib/model/markdown-generation-util/index.js.map +0 -1
- package/lib/model/markdown-generation-util/method-declaration-util.d.ts +0 -4
- package/lib/model/markdown-generation-util/method-declaration-util.js +0 -114
- package/lib/model/markdown-generation-util/method-declaration-util.js.map +0 -1
- package/lib/model/markdown-generation-util/type-declaration-util.d.ts +0 -3
- package/lib/model/markdown-generation-util/type-declaration-util.js +0 -81
- package/lib/model/markdown-generation-util/type-declaration-util.js.map +0 -1
- package/lib/model/markdown-home-file.d.ts +0 -11
- package/lib/model/markdown-home-file.js +0 -57
- package/lib/model/markdown-home-file.js.map +0 -1
- package/lib/model/markdown-type-file.d.ts +0 -26
- package/lib/model/markdown-type-file.js +0 -137
- package/lib/model/markdown-type-file.js.map +0 -1
- package/lib/model/openapi/apex-doc-types.d.ts +0 -19
- package/lib/model/openapi/apex-doc-types.js +0 -5
- package/lib/model/openapi/apex-doc-types.js.map +0 -1
- package/lib/model/openapi/open-api-types.d.ts +0 -93
- package/lib/model/openapi/open-api-types.js +0 -3
- package/lib/model/openapi/open-api-types.js.map +0 -1
- package/lib/model/openapi/open-api.d.ts +0 -16
- package/lib/model/openapi/open-api.js +0 -34
- package/lib/model/openapi/open-api.js.map +0 -1
- package/lib/model/openapi/openapi-type-file.d.ts +0 -7
- package/lib/model/openapi/openapi-type-file.js +0 -17
- package/lib/model/openapi/openapi-type-file.js.map +0 -1
- package/lib/model/outputFile.d.ts +0 -10
- package/lib/model/outputFile.js +0 -22
- package/lib/model/outputFile.js.map +0 -1
- package/lib/model/types-repository.d.ts +0 -16
- package/lib/model/types-repository.js +0 -54
- package/lib/model/types-repository.js.map +0 -1
- package/lib/service/apex-file-reader.d.ts +0 -14
- package/lib/service/apex-file-reader.js +0 -49
- package/lib/service/apex-file-reader.js.map +0 -1
- package/lib/service/file-system.d.ts +0 -14
- package/lib/service/file-system.js +0 -48
- package/lib/service/file-system.js.map +0 -1
- package/lib/service/file-writer.d.ts +0 -6
- package/lib/service/file-writer.js +0 -57
- package/lib/service/file-writer.js.map +0 -1
- package/lib/service/manifest-factory.d.ts +0 -10
- package/lib/service/manifest-factory.js +0 -16
- package/lib/service/manifest-factory.js.map +0 -1
- package/lib/service/metadata-processor.d.ts +0 -3
- package/lib/service/metadata-processor.js +0 -17
- package/lib/service/metadata-processor.js.map +0 -1
- package/lib/service/parser.d.ts +0 -21
- package/lib/service/parser.js +0 -138
- package/lib/service/parser.js.map +0 -1
- package/lib/service/state.d.ts +0 -9
- package/lib/service/state.js +0 -20
- package/lib/service/state.js.map +0 -1
- package/lib/service/walkers/class-walker.d.ts +0 -4
- package/lib/service/walkers/class-walker.js +0 -33
- package/lib/service/walkers/class-walker.js.map +0 -1
- package/lib/service/walkers/enum-walker.d.ts +0 -4
- package/lib/service/walkers/enum-walker.js +0 -11
- package/lib/service/walkers/enum-walker.js.map +0 -1
- package/lib/service/walkers/interface-walker.d.ts +0 -4
- package/lib/service/walkers/interface-walker.js +0 -15
- package/lib/service/walkers/interface-walker.js.map +0 -1
- package/lib/service/walkers/walker-factory.d.ts +0 -5
- package/lib/service/walkers/walker-factory.js +0 -21
- package/lib/service/walkers/walker-factory.js.map +0 -1
- package/lib/service/walkers/walker.d.ts +0 -19
- package/lib/service/walkers/walker.js +0 -17
- package/lib/service/walkers/walker.js.map +0 -1
- package/lib/settings.d.ts +0 -64
- package/lib/settings.js +0 -89
- package/lib/settings.js.map +0 -1
- package/lib/test-helpers/AnnotationBuilder.d.ts +0 -12
- package/lib/test-helpers/AnnotationBuilder.js +0 -31
- package/lib/test-helpers/AnnotationBuilder.js.map +0 -1
- package/lib/test-helpers/ClassMirrorBuilder.d.ts +0 -22
- package/lib/test-helpers/ClassMirrorBuilder.js +0 -64
- package/lib/test-helpers/ClassMirrorBuilder.js.map +0 -1
- package/lib/test-helpers/DocCommentAnnotationBuilder.d.ts +0 -8
- package/lib/test-helpers/DocCommentAnnotationBuilder.js +0 -26
- package/lib/test-helpers/DocCommentAnnotationBuilder.js.map +0 -1
- package/lib/test-helpers/DocCommentBuilder.d.ts +0 -12
- package/lib/test-helpers/DocCommentBuilder.js +0 -38
- package/lib/test-helpers/DocCommentBuilder.js.map +0 -1
- package/lib/test-helpers/FieldMirrorBuilder.d.ts +0 -18
- package/lib/test-helpers/FieldMirrorBuilder.js +0 -54
- package/lib/test-helpers/FieldMirrorBuilder.js.map +0 -1
- package/lib/test-helpers/InterfaceMirrorBuilder.d.ts +0 -16
- package/lib/test-helpers/InterfaceMirrorBuilder.js +0 -43
- package/lib/test-helpers/InterfaceMirrorBuilder.js.map +0 -1
- package/lib/test-helpers/MethodMirrorBuilder.d.ts +0 -29
- package/lib/test-helpers/MethodMirrorBuilder.js +0 -72
- package/lib/test-helpers/MethodMirrorBuilder.js.map +0 -1
- package/lib/test-helpers/SettingsBuilder.d.ts +0 -8
- package/lib/test-helpers/SettingsBuilder.js +0 -27
- package/lib/test-helpers/SettingsBuilder.js.map +0 -1
- package/lib/transpiler/factory.d.ts +0 -6
- package/lib/transpiler/factory.js +0 -35
- package/lib/transpiler/factory.js.map +0 -1
- package/lib/transpiler/file-container.d.ts +0 -6
- package/lib/transpiler/file-container.js +0 -16
- package/lib/transpiler/file-container.js.map +0 -1
- package/lib/transpiler/generator-choices.d.ts +0 -1
- package/lib/transpiler/generator-choices.js +0 -3
- package/lib/transpiler/generator-choices.js.map +0 -1
- package/lib/transpiler/markdown/class-file-generatorHelper.d.ts +0 -11
- package/lib/transpiler/markdown/class-file-generatorHelper.js +0 -75
- package/lib/transpiler/markdown/class-file-generatorHelper.js.map +0 -1
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.d.ts +0 -6
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.js +0 -13
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.js.map +0 -1
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.d.ts +0 -11
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js +0 -51
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +0 -1
- package/lib/transpiler/markdown/markdown-transpiler-base.d.ts +0 -11
- package/lib/transpiler/markdown/markdown-transpiler-base.js +0 -27
- package/lib/transpiler/markdown/markdown-transpiler-base.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/class-template.d.ts +0 -1
- package/lib/transpiler/markdown/plain-markdown/class-template.js +0 -77
- package/lib/transpiler/markdown/plain-markdown/class-template.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.d.ts +0 -1
- package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.js +0 -36
- package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.d.ts +0 -1
- package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.js +0 -28
- package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/enum-template.d.ts +0 -1
- package/lib/transpiler/markdown/plain-markdown/enum-template.js +0 -16
- package/lib/transpiler/markdown/plain-markdown/enum-template.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.d.ts +0 -1
- package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js +0 -27
- package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/grouped-members-partial-template.d.ts +0 -1
- package/lib/transpiler/markdown/plain-markdown/grouped-members-partial-template.js +0 -10
- package/lib/transpiler/markdown/plain-markdown/grouped-members-partial-template.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/interface-template.d.ts +0 -1
- package/lib/transpiler/markdown/plain-markdown/interface-template.js +0 -20
- package/lib/transpiler/markdown/plain-markdown/interface-template.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/methods-partial-template.d.ts +0 -1
- package/lib/transpiler/markdown/plain-markdown/methods-partial-template.js +0 -47
- package/lib/transpiler/markdown/plain-markdown/methods-partial-template.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.d.ts +0 -9
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js +0 -42
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/type-doc-partial.d.ts +0 -1
- package/lib/transpiler/markdown/plain-markdown/type-doc-partial.js +0 -31
- package/lib/transpiler/markdown/plain-markdown/type-doc-partial.js.map +0 -1
- package/lib/transpiler/openapi/open-api-docs-processor.d.ts +0 -13
- package/lib/transpiler/openapi/open-api-docs-processor.js +0 -78
- package/lib/transpiler/openapi/open-api-docs-processor.js.map +0 -1
- package/lib/transpiler/openapi/parsers/Builder.d.ts +0 -16
- package/lib/transpiler/openapi/parsers/Builder.js +0 -30
- package/lib/transpiler/openapi/parsers/Builder.js.map +0 -1
- package/lib/transpiler/openapi/parsers/MethodParser.d.ts +0 -20
- package/lib/transpiler/openapi/parsers/MethodParser.js +0 -190
- package/lib/transpiler/openapi/parsers/MethodParser.js.map +0 -1
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.d.ts +0 -7
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.js +0 -11
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.js.map +0 -1
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.d.ts +0 -39
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js +0 -250
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js.map +0 -1
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.d.ts +0 -10
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.js +0 -20
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.js.map +0 -1
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.d.ts +0 -7
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.js +0 -22
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.js.map +0 -1
- package/lib/transpiler/processor-type-transpiler.d.ts +0 -10
- package/lib/transpiler/processor-type-transpiler.js +0 -9
- package/lib/transpiler/processor-type-transpiler.js.map +0 -1
- package/lib/transpiler/transpiler.d.ts +0 -5
- package/lib/transpiler/transpiler.js +0 -30
- package/lib/transpiler/transpiler.js.map +0 -1
- package/lib/util/error-logger.d.ts +0 -8
- package/lib/util/error-logger.js +0 -90
- package/lib/util/error-logger.js.map +0 -1
- package/lib/util/logger.d.ts +0 -21
- package/lib/util/logger.js +0 -61
- package/lib/util/logger.js.map +0 -1
- package/lib/util/string-utils.d.ts +0 -2
- package/lib/util/string-utils.js +0 -15
- package/lib/util/string-utils.js.map +0 -1
- package/src/adapters/type-utils.ts +0 -5
- package/src/adapters/types.d.ts +0 -8
- package/src/model/inheritance.ts +0 -8
- package/src/transpiler/markdown/plain-markdown/plain-docsProcessor.ts +0 -42
- /package/src/{model → core}/apex-bundle.ts +0 -0
- /package/src/{model → core}/manifest.ts +0 -0
package/src/cli/generate.ts
CHANGED
|
@@ -1,140 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import * as yargs from 'yargs';
|
|
3
|
-
|
|
4
|
-
import { Settings } from '../settings';
|
|
5
2
|
import { Apexdocs } from '../application/Apexdocs';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
describe: 'The directory location which contains your apex .cls classes.',
|
|
19
|
-
},
|
|
20
|
-
targetDir: {
|
|
21
|
-
type: 'string',
|
|
22
|
-
alias: 't',
|
|
23
|
-
default: './docs/',
|
|
24
|
-
describe: 'The directory location where documentation will be generated to.',
|
|
25
|
-
},
|
|
26
|
-
recursive: {
|
|
27
|
-
type: 'boolean',
|
|
28
|
-
alias: 'r',
|
|
29
|
-
default: true,
|
|
30
|
-
describe: 'Whether .cls classes will be searched for recursively in the directory provided.',
|
|
31
|
-
},
|
|
32
|
-
scope: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
array: true,
|
|
35
|
-
alias: 'p',
|
|
36
|
-
default: ['global'],
|
|
37
|
-
describe:
|
|
38
|
-
'A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. ' +
|
|
39
|
-
'Annotations are supported and should be passed lowercased and without the @ symbol, e.g. namespaceaccessible auraenabled. ' +
|
|
40
|
-
'Note that this setting is ignored if generating an OpenApi REST specification since that looks for classes annotated with @RestResource.',
|
|
41
|
-
},
|
|
42
|
-
targetGenerator: {
|
|
43
|
-
type: 'string',
|
|
44
|
-
alias: 'g',
|
|
45
|
-
default: 'jekyll',
|
|
46
|
-
choices: ['jekyll', 'docsify', 'plain-markdown', 'openapi'],
|
|
47
|
-
describe:
|
|
48
|
-
'Define the static file generator for which the documents will be created. ' +
|
|
49
|
-
'Currently supports jekyll, docsify, plain markdown, and OpenAPI v3.1.0.',
|
|
50
|
-
},
|
|
51
|
-
indexOnly: {
|
|
52
|
-
type: 'boolean',
|
|
53
|
-
default: false,
|
|
54
|
-
describe: 'Defines whether only the index file should be generated.',
|
|
55
|
-
},
|
|
56
|
-
defaultGroupName: {
|
|
57
|
-
type: 'string',
|
|
58
|
-
default: 'Miscellaneous',
|
|
59
|
-
describe: 'Defines the @group name to be used when a file does not specify it.',
|
|
60
|
-
},
|
|
61
|
-
sanitizeHtml: {
|
|
62
|
-
type: 'boolean',
|
|
63
|
-
default: true,
|
|
64
|
-
describe:
|
|
65
|
-
'When on, any special character within your ApexDocs is converted into its HTML code representation. ' +
|
|
66
|
-
'This is specially useful when generic objects are described within the docs, e.g. "List< Foo>", "Map<Foo, Bar>" ' +
|
|
67
|
-
'because otherwise the content within < and > would be treated as HTML tags and not shown in the output. ' +
|
|
68
|
-
'Content in @example blocks are never sanitized.',
|
|
69
|
-
},
|
|
70
|
-
openApiTitle: {
|
|
71
|
-
type: 'string',
|
|
72
|
-
default: 'Apex REST Api',
|
|
73
|
-
describe: 'If using "openapi" as the target generator, this allows you to specify the OpenApi title value.',
|
|
74
|
-
},
|
|
75
|
-
title: {
|
|
76
|
-
type: 'string',
|
|
77
|
-
describe: "If this allows you to specify the title of the generated documentation's home file.",
|
|
78
|
-
default: 'Classes',
|
|
79
|
-
},
|
|
80
|
-
namespace: {
|
|
81
|
-
type: 'string',
|
|
82
|
-
describe:
|
|
83
|
-
'The package namespace, if any. If this value is provided the namespace will be added as a prefix to all of the parsed files. ' +
|
|
84
|
-
"If generating an OpenApi definition, it will be added to the file's Server Url.",
|
|
85
|
-
},
|
|
86
|
-
openApiFileName: {
|
|
87
|
-
type: 'string',
|
|
88
|
-
describe: 'If using "openapi" as the target generator, this allows you to specify the name of the output file.',
|
|
89
|
-
default: 'openapi',
|
|
90
|
-
},
|
|
91
|
-
sortMembersAlphabetically: {
|
|
92
|
-
type: 'boolean',
|
|
93
|
-
describe: 'Whether to sort members alphabetically.',
|
|
94
|
-
default: false,
|
|
95
|
-
},
|
|
96
|
-
includeMetadata: {
|
|
97
|
-
type: 'boolean',
|
|
98
|
-
describe: "Whether to include the file's meta.xml information: Whether it is active and and the API version",
|
|
99
|
-
default: false,
|
|
100
|
-
},
|
|
101
|
-
documentationRootDir: {
|
|
102
|
-
type: 'string',
|
|
103
|
-
describe:
|
|
104
|
-
'Allows you to specify the root documentation directory where the files are being generated. This can be helpful when embedding the generated docs into an existing site so that the links are generated correctly.',
|
|
105
|
-
},
|
|
106
|
-
})
|
|
107
|
-
.parseSync();
|
|
108
|
-
|
|
109
|
-
if (config) {
|
|
110
|
-
argv = { ...config.config, ...argv };
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
Settings.build({
|
|
114
|
-
sourceDirectory: argv.sourceDir,
|
|
115
|
-
recursive: argv.recursive,
|
|
116
|
-
scope: argv.scope,
|
|
117
|
-
outputDir: argv.targetDir,
|
|
118
|
-
targetGenerator: argv.targetGenerator as GeneratorChoices,
|
|
119
|
-
indexOnly: argv.indexOnly,
|
|
120
|
-
defaultGroupName: argv.defaultGroupName,
|
|
121
|
-
sanitizeHtml: argv.sanitizeHtml,
|
|
122
|
-
openApiTitle: argv.openApiTitle,
|
|
123
|
-
title: argv.title,
|
|
124
|
-
namespace: argv.namespace,
|
|
125
|
-
openApiFileName: argv.openApiFileName,
|
|
126
|
-
sortMembersAlphabetically: argv.sortMembersAlphabetically,
|
|
127
|
-
includeMetadata: argv.includeMetadata,
|
|
128
|
-
rootDir: argv.documentationRootDir,
|
|
129
|
-
onAfterProcess: config?.config?.onAfterProcess,
|
|
130
|
-
onBeforeFileWrite: config?.config?.onBeforeFileWrite,
|
|
131
|
-
frontMatterHeader: config?.config?.frontMatterHeader,
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
try {
|
|
135
|
-
Apexdocs.generate();
|
|
136
|
-
} catch (error) {
|
|
137
|
-
console.error(error);
|
|
138
|
-
process.exit(1);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
3
|
+
import { extractArgs } from './args';
|
|
4
|
+
|
|
5
|
+
function main() {
|
|
6
|
+
extractArgs()
|
|
7
|
+
.then((config) => Apexdocs.generate(config))
|
|
8
|
+
.catch((error) => {
|
|
9
|
+
console.error(error);
|
|
10
|
+
process.exit(1);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
main();
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { adaptDescribable } from '../documentables';
|
|
2
|
+
|
|
3
|
+
function linkGenerator(typeName: string) {
|
|
4
|
+
return typeName;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
describe('describable', () => {
|
|
8
|
+
it('returns undefined if describable is undefined', () => {
|
|
9
|
+
const result = adaptDescribable(undefined, linkGenerator);
|
|
10
|
+
|
|
11
|
+
expect(result).toEqual({
|
|
12
|
+
description: undefined,
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('returns an empty array if describable is an empty array', () => {
|
|
17
|
+
const result = adaptDescribable([], linkGenerator);
|
|
18
|
+
|
|
19
|
+
expect(result).toEqual({
|
|
20
|
+
description: [],
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('returns a string if describable contains a string', () => {
|
|
25
|
+
const describable = ['This is a test'];
|
|
26
|
+
|
|
27
|
+
const result = adaptDescribable(describable, linkGenerator);
|
|
28
|
+
|
|
29
|
+
expect(result).toEqual({
|
|
30
|
+
description: ['This is a test'],
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('separates strings with an empty line', () => {
|
|
35
|
+
const describable = ['This is a test', 'This is another test'];
|
|
36
|
+
|
|
37
|
+
const result = adaptDescribable(describable, linkGenerator);
|
|
38
|
+
|
|
39
|
+
expect(result).toEqual({
|
|
40
|
+
description: ['This is a test', { __type: 'empty-line' }, 'This is another test'],
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('returns a code block if describable contains code', () => {
|
|
45
|
+
const describable = ['```typescript', 'const a = 1;', '```'];
|
|
46
|
+
|
|
47
|
+
const result = adaptDescribable(describable, linkGenerator);
|
|
48
|
+
|
|
49
|
+
expect(result).toEqual({
|
|
50
|
+
description: [
|
|
51
|
+
{
|
|
52
|
+
__type: 'code-block',
|
|
53
|
+
language: 'typescript',
|
|
54
|
+
content: ['const a = 1;'],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('sets the code blocks language to apex if one is not provided', () => {
|
|
61
|
+
const describable = ['```', 'const a = 1;', '```'];
|
|
62
|
+
|
|
63
|
+
const result = adaptDescribable(describable, linkGenerator);
|
|
64
|
+
|
|
65
|
+
expect(result).toEqual({
|
|
66
|
+
description: [
|
|
67
|
+
{
|
|
68
|
+
__type: 'code-block',
|
|
69
|
+
language: 'apex',
|
|
70
|
+
content: ['const a = 1;'],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('returns a code block followed by an empty line and then whatever content is in the describable', () => {
|
|
77
|
+
const describable = ['```typescript', 'const a = 1;', '```', 'This is a test'];
|
|
78
|
+
|
|
79
|
+
const result = adaptDescribable(describable, linkGenerator);
|
|
80
|
+
|
|
81
|
+
expect(result).toEqual({
|
|
82
|
+
description: [
|
|
83
|
+
{
|
|
84
|
+
__type: 'code-block',
|
|
85
|
+
language: 'typescript',
|
|
86
|
+
content: ['const a = 1;'],
|
|
87
|
+
},
|
|
88
|
+
{ __type: 'empty-line' },
|
|
89
|
+
'This is a test',
|
|
90
|
+
],
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('returns a code block even when there is no closing tag', () => {
|
|
95
|
+
const describable = ['```typescript', 'const a = 1;'];
|
|
96
|
+
|
|
97
|
+
const result = adaptDescribable(describable, linkGenerator);
|
|
98
|
+
|
|
99
|
+
expect(result).toEqual({
|
|
100
|
+
description: [
|
|
101
|
+
{
|
|
102
|
+
__type: 'code-block',
|
|
103
|
+
language: 'typescript',
|
|
104
|
+
content: ['const a = 1;'],
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { typeToRenderable } from '../apex-types';
|
|
2
|
+
import { InterfaceMirrorBuilder } from '../../../test-helpers/InterfaceMirrorBuilder';
|
|
3
|
+
import { AnnotationBuilder } from '../../../test-helpers/AnnotationBuilder';
|
|
4
|
+
import { MethodMirrorBuilder, ParameterBuilder } from '../../../test-helpers/MethodMirrorBuilder';
|
|
5
5
|
|
|
6
6
|
function linkGenerator(type: string): string {
|
|
7
7
|
return type;
|
|
@@ -10,14 +10,14 @@ function linkGenerator(type: string): string {
|
|
|
10
10
|
describe('Conversion from InterfaceMirror to InterfaceSource understandable by the templating engine', () => {
|
|
11
11
|
it('converts the name', () => {
|
|
12
12
|
const interfaceMirror = new InterfaceMirrorBuilder().withName('SampleInterface').build();
|
|
13
|
-
const interfaceSource =
|
|
13
|
+
const interfaceSource = typeToRenderable(interfaceMirror, linkGenerator);
|
|
14
14
|
|
|
15
15
|
expect(interfaceSource.name).toBe('SampleInterface');
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
it('converts the access modifier', () => {
|
|
19
19
|
const interfaceMirror = new InterfaceMirrorBuilder().build();
|
|
20
|
-
const interfaceSource =
|
|
20
|
+
const interfaceSource = typeToRenderable(interfaceMirror, linkGenerator);
|
|
21
21
|
|
|
22
22
|
expect(interfaceSource.meta.accessModifier).toBe('public');
|
|
23
23
|
});
|
|
@@ -26,7 +26,7 @@ describe('Conversion from InterfaceMirror to InterfaceSource understandable by t
|
|
|
26
26
|
const interfaceMirror = new InterfaceMirrorBuilder()
|
|
27
27
|
.addAnnotation(new AnnotationBuilder().withName('MyAnnotation').build())
|
|
28
28
|
.build();
|
|
29
|
-
const interfaceSource =
|
|
29
|
+
const interfaceSource = typeToRenderable(interfaceMirror, linkGenerator);
|
|
30
30
|
|
|
31
31
|
expect(interfaceSource.doc.annotations).toEqual(['MYANNOTATION']);
|
|
32
32
|
});
|
|
@@ -44,10 +44,10 @@ describe('Conversion from InterfaceMirror to InterfaceSource understandable by t
|
|
|
44
44
|
)
|
|
45
45
|
.build();
|
|
46
46
|
|
|
47
|
-
const interfaceSource =
|
|
47
|
+
const interfaceSource = typeToRenderable(interfaceMirror, linkGenerator);
|
|
48
48
|
|
|
49
49
|
expect(interfaceSource.methods.value).toHaveLength(1);
|
|
50
|
-
expect(interfaceSource.methods.value[0].signature.value[0]).toBe('public String sampleMethod()');
|
|
50
|
+
expect(interfaceSource.methods.value[0].signature.value.content[0]).toBe('public String sampleMethod()');
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
it('converts method declarations. Method with parameters', () => {
|
|
@@ -72,9 +72,11 @@ describe('Conversion from InterfaceMirror to InterfaceSource understandable by t
|
|
|
72
72
|
)
|
|
73
73
|
.build();
|
|
74
74
|
|
|
75
|
-
const interfaceSource =
|
|
75
|
+
const interfaceSource = typeToRenderable(interfaceMirror, linkGenerator);
|
|
76
76
|
|
|
77
77
|
expect(interfaceSource.methods.value).toHaveLength(1);
|
|
78
|
-
expect(interfaceSource.methods.value[0].signature.value[0]).toBe(
|
|
78
|
+
expect(interfaceSource.methods.value[0].signature.value.content[0]).toBe(
|
|
79
|
+
'public String sampleMethod(String param1)',
|
|
80
|
+
);
|
|
79
81
|
});
|
|
80
82
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { replaceInlineReferences } from '../
|
|
2
|
-
import { Link } from '
|
|
1
|
+
import { replaceInlineReferences } from '../inline';
|
|
2
|
+
import { Link } from '../types';
|
|
3
3
|
|
|
4
4
|
function getFileLink(typeName: string): Link {
|
|
5
5
|
return {
|
|
6
|
+
__type: 'link' as const,
|
|
6
7
|
title: typeName,
|
|
7
8
|
url: `/api/${typeName}.html`,
|
|
8
9
|
};
|
|
@@ -10,6 +11,7 @@ function getFileLink(typeName: string): Link {
|
|
|
10
11
|
|
|
11
12
|
function getEmailLink(typeName: string) {
|
|
12
13
|
return {
|
|
14
|
+
__type: 'link' as const,
|
|
13
15
|
title: typeName,
|
|
14
16
|
url: `mailto:${typeName}`,
|
|
15
17
|
};
|
|
@@ -25,6 +27,17 @@ describe('reference utilities', () => {
|
|
|
25
27
|
expect(result).toEqual(expected);
|
|
26
28
|
});
|
|
27
29
|
|
|
30
|
+
describe('replace inline code', () => {
|
|
31
|
+
it('replaces inline code with InlineCode', () => {
|
|
32
|
+
const text = 'This is a test `ClassName`.';
|
|
33
|
+
const result = replaceInlineReferences(text, getFileLink, getEmailLink);
|
|
34
|
+
|
|
35
|
+
const expected = ['This is a test ', { __type: 'inline-code', content: 'ClassName' }, '.'];
|
|
36
|
+
|
|
37
|
+
expect(result).toEqual(expected);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
28
41
|
describe('replace inline links', () => {
|
|
29
42
|
it('replaces links in the format of <<ClassName>>', () => {
|
|
30
43
|
const text = 'This is a test <<ClassName>>.';
|
|
@@ -33,6 +46,7 @@ describe('reference utilities', () => {
|
|
|
33
46
|
const expected = [
|
|
34
47
|
'This is a test ',
|
|
35
48
|
{
|
|
49
|
+
__type: 'link',
|
|
36
50
|
title: 'ClassName',
|
|
37
51
|
url: '/api/ClassName.html',
|
|
38
52
|
},
|
|
@@ -44,6 +58,7 @@ describe('reference utilities', () => {
|
|
|
44
58
|
it('replaces links in the format of {@link ClassName}', () => {
|
|
45
59
|
function getFileLinkByTypeName(typeName: string): Link {
|
|
46
60
|
return {
|
|
61
|
+
__type: 'link' as const,
|
|
47
62
|
title: typeName,
|
|
48
63
|
url: `/api/${typeName}.html`,
|
|
49
64
|
};
|
|
@@ -55,6 +70,7 @@ describe('reference utilities', () => {
|
|
|
55
70
|
const expected = [
|
|
56
71
|
'This is a test ',
|
|
57
72
|
{
|
|
73
|
+
__type: 'link',
|
|
58
74
|
title: 'ClassName',
|
|
59
75
|
url: '/api/ClassName.html',
|
|
60
76
|
},
|
|
@@ -68,6 +84,7 @@ describe('reference utilities', () => {
|
|
|
68
84
|
it('replaces emails in the format of {@email email-address}', () => {
|
|
69
85
|
function getLinkByTypeName(typeName: string) {
|
|
70
86
|
return {
|
|
87
|
+
__type: 'link' as const,
|
|
71
88
|
title: typeName,
|
|
72
89
|
url: `mailto:${typeName}`,
|
|
73
90
|
};
|
|
@@ -79,6 +96,7 @@ describe('reference utilities', () => {
|
|
|
79
96
|
const expected = [
|
|
80
97
|
'This is an email ',
|
|
81
98
|
{
|
|
99
|
+
__type: 'link',
|
|
82
100
|
title: 'example@example.com',
|
|
83
101
|
url: 'mailto:example@example.com',
|
|
84
102
|
},
|
|
@@ -95,16 +113,19 @@ describe('reference utilities', () => {
|
|
|
95
113
|
const expected = [
|
|
96
114
|
'This is a test ',
|
|
97
115
|
{
|
|
116
|
+
__type: 'link',
|
|
98
117
|
title: 'ClassName',
|
|
99
118
|
url: '/api/ClassName.html',
|
|
100
119
|
},
|
|
101
120
|
', and ',
|
|
102
121
|
{
|
|
122
|
+
__type: 'link',
|
|
103
123
|
title: 'AnotherClass',
|
|
104
124
|
url: '/api/AnotherClass.html',
|
|
105
125
|
},
|
|
106
126
|
', and an email ',
|
|
107
127
|
{
|
|
128
|
+
__type: 'link',
|
|
108
129
|
title: 'testerson',
|
|
109
130
|
url: 'mailto:testerson',
|
|
110
131
|
},
|
|
@@ -4,38 +4,41 @@ import {
|
|
|
4
4
|
RenderableClass,
|
|
5
5
|
RenderableEnum,
|
|
6
6
|
RenderableInterface,
|
|
7
|
-
Renderable,
|
|
8
7
|
RenderableSection,
|
|
9
8
|
GroupedMember,
|
|
10
|
-
} from '../core/renderable/types';
|
|
11
|
-
import { adaptDescribable, adaptDocumentable } from './documentables';
|
|
12
|
-
import { GetRenderableContentByTypeName } from './references';
|
|
13
|
-
import {
|
|
14
9
|
ClassMirrorWithInheritanceChain,
|
|
15
10
|
FieldMirrorWithInheritance,
|
|
16
11
|
PropertyMirrorWithInheritance,
|
|
17
|
-
|
|
12
|
+
GetRenderableContentByTypeName,
|
|
13
|
+
} from './types';
|
|
14
|
+
import { adaptDescribable, adaptDocumentable } from './documentables';
|
|
18
15
|
import { adaptConstructor, adaptMethod } from './methods-and-constructors';
|
|
19
16
|
import { adaptFieldOrProperty } from './fields-and-properties';
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
type GetReturnRenderable<T extends Type> = T extends InterfaceMirror
|
|
19
|
+
? RenderableInterface
|
|
20
|
+
: T extends ClassMirror
|
|
21
|
+
? RenderableClass
|
|
22
|
+
: RenderableEnum;
|
|
23
|
+
|
|
24
|
+
export function typeToRenderable<T extends Type>(
|
|
25
|
+
type: T,
|
|
23
26
|
linkGenerator: GetRenderableContentByTypeName,
|
|
24
27
|
namespace?: string,
|
|
25
|
-
):
|
|
26
|
-
function getRenderable() {
|
|
28
|
+
): GetReturnRenderable<T> {
|
|
29
|
+
function getRenderable(): RenderableInterface | RenderableClass | RenderableEnum {
|
|
27
30
|
switch (type.type_name) {
|
|
28
31
|
case 'enum':
|
|
29
|
-
return enumTypeToEnumSource(type as EnumMirror, linkGenerator);
|
|
32
|
+
return enumTypeToEnumSource(type as EnumMirror, linkGenerator) as RenderableEnum;
|
|
30
33
|
case 'interface':
|
|
31
|
-
return interfaceTypeToInterfaceSource(type as InterfaceMirror, linkGenerator);
|
|
34
|
+
return interfaceTypeToInterfaceSource(type as InterfaceMirror, linkGenerator) as RenderableInterface;
|
|
32
35
|
case 'class':
|
|
33
|
-
return classTypeToClassSource(type as ClassMirrorWithInheritanceChain, linkGenerator);
|
|
36
|
+
return classTypeToClassSource(type as ClassMirrorWithInheritanceChain, linkGenerator) as RenderableClass;
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
return {
|
|
38
|
-
...getRenderable(),
|
|
41
|
+
...(getRenderable() as GetReturnRenderable<T>),
|
|
39
42
|
namespace,
|
|
40
43
|
};
|
|
41
44
|
}
|
|
@@ -85,7 +88,7 @@ function enumTypeToEnumSource(
|
|
|
85
88
|
};
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
function interfaceTypeToInterfaceSource(
|
|
89
92
|
interfaceType: InterfaceMirror,
|
|
90
93
|
linkGenerator: GetRenderableContentByTypeName,
|
|
91
94
|
baseHeadingLevel: number = 1,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CustomTag, RenderableDocumentation, RenderableContent } from '
|
|
2
|
-
import { Describable, Documentable } from './types';
|
|
3
|
-
import {
|
|
1
|
+
import { CustomTag, RenderableDocumentation, RenderableContent, CodeBlock } from './types';
|
|
2
|
+
import { Describable, Documentable, GetRenderableContentByTypeName } from './types';
|
|
3
|
+
import { replaceInlineReferences } from './inline';
|
|
4
4
|
import { isEmptyLine } from './type-utils';
|
|
5
5
|
|
|
6
6
|
export function adaptDescribable(
|
|
@@ -14,15 +14,46 @@ export function adaptDescribable(
|
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
let content: RenderableContent[] = [];
|
|
18
|
+
for (let i = 0; i < describable.length; i++) {
|
|
19
|
+
const line = describable[i];
|
|
20
|
+
// The language might or might not be present after ```
|
|
21
|
+
const codeBlockMatch = line.match(/^```([a-zA-Z]*)$/);
|
|
22
|
+
if (codeBlockMatch) {
|
|
23
|
+
// Check if the language is present, if not, fallback to "apex"
|
|
24
|
+
const language = codeBlockMatch[1] || 'apex';
|
|
25
|
+
const codeBlockLines: string[] = [];
|
|
26
|
+
i++;
|
|
27
|
+
while (i < describable.length) {
|
|
28
|
+
const currentLine = describable[i];
|
|
29
|
+
if (currentLine.trim() === '```') {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
codeBlockLines.push(currentLine);
|
|
33
|
+
i++;
|
|
34
|
+
}
|
|
35
|
+
content = [
|
|
36
|
+
...content,
|
|
21
37
|
{
|
|
22
|
-
|
|
38
|
+
__type: 'code-block',
|
|
39
|
+
language,
|
|
40
|
+
content: codeBlockLines,
|
|
23
41
|
},
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
{ __type: 'empty-line' },
|
|
43
|
+
];
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
content = [
|
|
48
|
+
...content,
|
|
49
|
+
...replaceInlineReferences(line, linkGenerator),
|
|
50
|
+
{
|
|
51
|
+
__type: 'empty-line',
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
return (
|
|
56
|
+
content
|
|
26
57
|
// If the last element is an empty line, remove it
|
|
27
58
|
.filter((line, index, lines) => !(isEmptyLine(line) && index === lines.length - 1))
|
|
28
59
|
);
|
|
@@ -71,6 +102,17 @@ export function adaptDocumentable(
|
|
|
71
102
|
);
|
|
72
103
|
}
|
|
73
104
|
|
|
105
|
+
function bodyLinesToCodeBlock(language: string, bodyLines: string[] | undefined): CodeBlock | undefined {
|
|
106
|
+
if (!bodyLines) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
__type: 'code-block',
|
|
111
|
+
language,
|
|
112
|
+
content: bodyLines,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
74
116
|
return {
|
|
75
117
|
...adaptDescribable(documentable.docComment?.descriptionLines, linkGenerator),
|
|
76
118
|
annotations: documentable.annotations.map((annotation) => annotation.type.toUpperCase()),
|
|
@@ -78,12 +120,12 @@ export function adaptDocumentable(
|
|
|
78
120
|
mermaid: {
|
|
79
121
|
headingLevel: subHeadingLevel,
|
|
80
122
|
heading: 'Diagram',
|
|
81
|
-
value: extractAnnotationBodyLines(documentable, 'mermaid'),
|
|
123
|
+
value: bodyLinesToCodeBlock('mermaid', extractAnnotationBodyLines(documentable, 'mermaid')),
|
|
82
124
|
},
|
|
83
125
|
example: {
|
|
84
126
|
headingLevel: subHeadingLevel,
|
|
85
127
|
heading: 'Example',
|
|
86
|
-
value: documentable.docComment?.exampleAnnotation?.bodyLines,
|
|
128
|
+
value: bodyLinesToCodeBlock('apex', documentable.docComment?.exampleAnnotation?.bodyLines),
|
|
87
129
|
},
|
|
88
130
|
group: extractAnnotationBody(documentable, 'group'),
|
|
89
131
|
author: extractAnnotationBody(documentable, 'author'),
|
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
CodeBlock,
|
|
3
|
+
FieldMirrorWithInheritance,
|
|
4
|
+
PropertyMirrorWithInheritance,
|
|
5
|
+
RenderableField,
|
|
6
|
+
GetRenderableContentByTypeName,
|
|
7
|
+
} from './types';
|
|
3
8
|
import { adaptDocumentable } from './documentables';
|
|
4
|
-
import { GetRenderableContentByTypeName } from './references';
|
|
5
9
|
|
|
6
10
|
export function adaptFieldOrProperty(
|
|
7
11
|
field: FieldMirrorWithInheritance | PropertyMirrorWithInheritance,
|
|
8
12
|
linkGenerator: GetRenderableContentByTypeName,
|
|
9
13
|
baseHeadingLevel: number,
|
|
10
14
|
): RenderableField {
|
|
11
|
-
function buildSignature() {
|
|
15
|
+
function buildSignature(): CodeBlock {
|
|
12
16
|
const { access_modifier, name } = field;
|
|
13
17
|
const memberModifiers = field.memberModifiers.join(' ');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const codeContents = `${access_modifier} ${memberModifiers} ${name}`
|
|
19
|
+
// remove double spaces
|
|
20
|
+
.replace(/ {2}/g, ' ');
|
|
21
|
+
return {
|
|
22
|
+
__type: 'code-block',
|
|
23
|
+
language: 'apex',
|
|
24
|
+
content: [codeContents],
|
|
25
|
+
};
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
return {
|
|
@@ -32,7 +39,7 @@ export function adaptFieldOrProperty(
|
|
|
32
39
|
signature: {
|
|
33
40
|
headingLevel: baseHeadingLevel + 1,
|
|
34
41
|
heading: 'Signature',
|
|
35
|
-
value:
|
|
42
|
+
value: buildSignature(),
|
|
36
43
|
},
|
|
37
44
|
};
|
|
38
45
|
}
|