@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
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { InlineCode, Link, RenderableContent } from './types';
|
|
2
|
+
import { pipe } from 'fp-ts/function';
|
|
3
|
+
import { apply } from '../../util/fp';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
type InlineRenderableContent = InlineCode | Link | string;
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
ClassFileGeneratorHelper.getRenderableLinkByTypeName;
|
|
7
|
+
type ToInlineRenderableContent = (typeName: string) => InlineRenderableContent;
|
|
8
8
|
|
|
9
9
|
function defaultGetEmailByReference(email: string): Link {
|
|
10
10
|
return {
|
|
11
|
+
__type: 'link',
|
|
11
12
|
title: email,
|
|
12
13
|
url: `mailto:${email}`,
|
|
13
14
|
};
|
|
@@ -15,22 +16,51 @@ function defaultGetEmailByReference(email: string): Link {
|
|
|
15
16
|
|
|
16
17
|
export function replaceInlineReferences(
|
|
17
18
|
text: string,
|
|
18
|
-
linkReplacer:
|
|
19
|
-
emailReplacer:
|
|
19
|
+
linkReplacer: ToInlineRenderableContent,
|
|
20
|
+
emailReplacer: ToInlineRenderableContent = defaultGetEmailByReference,
|
|
20
21
|
): RenderableContent[] {
|
|
21
|
-
|
|
22
|
+
const inlineLinks = apply(replaceInlineLinks, linkReplacer);
|
|
23
|
+
const inlineEmails = apply(replaceInlineEmails, emailReplacer);
|
|
24
|
+
|
|
25
|
+
return pipe(inlineCode([text]), inlineLinks, inlineEmails);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function inlineCode(renderableContents: RenderableContent[]): RenderableContent[] {
|
|
29
|
+
return renderableContents.flatMap((renderableContent) => inlineCodeContent(renderableContent));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Replace string that is inline code with InlineCode
|
|
33
|
+
// Inline code is any text that backticks surround
|
|
34
|
+
function inlineCodeContent(renderableContent: RenderableContent): RenderableContent[] {
|
|
35
|
+
if (typeof renderableContent !== 'string') {
|
|
36
|
+
return [renderableContent];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function inlineCodeLink(text: string): InlineCode {
|
|
40
|
+
return {
|
|
41
|
+
__type: 'inline-code',
|
|
42
|
+
content: text,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const text = renderableContent;
|
|
47
|
+
|
|
48
|
+
// Matches any text surrounded by backticks
|
|
49
|
+
const codeFormatRegEx = '`([^`]*)`';
|
|
50
|
+
const matches = match(codeFormatRegEx, text);
|
|
51
|
+
return createRenderableContents(matches, text, inlineCodeLink);
|
|
22
52
|
}
|
|
23
53
|
|
|
24
54
|
function replaceInlineLinks(
|
|
55
|
+
getLinkByTypeName: ToInlineRenderableContent,
|
|
25
56
|
renderableContents: RenderableContent[],
|
|
26
|
-
getLinkByTypeName: GetRenderableContentByTypeName,
|
|
27
57
|
): RenderableContent[] {
|
|
28
58
|
return renderableContents.flatMap((renderableContent) => inlineLinkContent(renderableContent, getLinkByTypeName));
|
|
29
59
|
}
|
|
30
60
|
|
|
31
61
|
function inlineLinkContent(
|
|
32
62
|
renderableContent: RenderableContent,
|
|
33
|
-
getLinkByTypeName:
|
|
63
|
+
getLinkByTypeName: ToInlineRenderableContent,
|
|
34
64
|
): RenderableContent[] {
|
|
35
65
|
if (typeof renderableContent !== 'string') {
|
|
36
66
|
return [renderableContent];
|
|
@@ -45,15 +75,15 @@ function inlineLinkContent(
|
|
|
45
75
|
}
|
|
46
76
|
|
|
47
77
|
export function replaceInlineEmails(
|
|
78
|
+
getLinkByTypeName: ToInlineRenderableContent,
|
|
48
79
|
renderableContents: RenderableContent[],
|
|
49
|
-
getLinkByTypeName: GetRenderableContentByTypeName,
|
|
50
80
|
): RenderableContent[] {
|
|
51
81
|
return renderableContents.flatMap((renderableContent) => inlineEmailContent(renderableContent, getLinkByTypeName));
|
|
52
82
|
}
|
|
53
83
|
|
|
54
84
|
function inlineEmailContent(
|
|
55
85
|
renderableContent: RenderableContent,
|
|
56
|
-
getLinkByTypeName:
|
|
86
|
+
getLinkByTypeName: ToInlineRenderableContent,
|
|
57
87
|
): RenderableContent[] {
|
|
58
88
|
if (typeof renderableContent !== 'string') {
|
|
59
89
|
return [renderableContent];
|
|
@@ -82,7 +112,7 @@ function match(regex: string, text: string) {
|
|
|
82
112
|
return matches;
|
|
83
113
|
}
|
|
84
114
|
|
|
85
|
-
function createRenderableContents(matches: RegExpExecArray[], text: string, linker:
|
|
115
|
+
function createRenderableContents(matches: RegExpExecArray[], text: string, linker: ToInlineRenderableContent) {
|
|
86
116
|
if (matches.length === 0) {
|
|
87
117
|
return [text];
|
|
88
118
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { ConstructorMirror, MethodMirror, ParameterMirror, ThrowsAnnotation } from '@cparra/apex-reflection';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
RenderableConstructor,
|
|
4
|
+
RenderableMethod,
|
|
5
|
+
MethodMirrorWithInheritance,
|
|
6
|
+
CodeBlock,
|
|
7
|
+
GetRenderableContentByTypeName,
|
|
8
|
+
} from './types';
|
|
4
9
|
import { adaptDescribable, adaptDocumentable } from './documentables';
|
|
5
|
-
import { GetRenderableContentByTypeName } from './references';
|
|
6
10
|
import { Documentable } from './types';
|
|
7
11
|
|
|
8
12
|
export function adaptMethod(
|
|
@@ -16,13 +20,17 @@ export function adaptMethod(
|
|
|
16
20
|
return `${name}(${parametersString})`;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
function buildSignature(method: MethodMirrorWithInheritance):
|
|
23
|
+
function buildSignature(method: MethodMirrorWithInheritance): CodeBlock {
|
|
20
24
|
const { access_modifier, typeReference, name, memberModifiers } = method;
|
|
21
25
|
const parameters = method.parameters
|
|
22
26
|
.map((param) => `${param.typeReference.rawDeclaration} ${param.name}`)
|
|
23
27
|
.join(', ');
|
|
24
28
|
const members = memberModifiers.length > 0 ? `${memberModifiers.join(' ')} ` : '';
|
|
25
|
-
return
|
|
29
|
+
return {
|
|
30
|
+
__type: 'code-block',
|
|
31
|
+
language: 'apex',
|
|
32
|
+
content: [`${access_modifier} ${members}${typeReference.rawDeclaration} ${name}(${parameters})`],
|
|
33
|
+
};
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
return {
|
|
@@ -32,7 +40,7 @@ export function adaptMethod(
|
|
|
32
40
|
signature: {
|
|
33
41
|
headingLevel: baseHeadingLevel + 1,
|
|
34
42
|
heading: 'Signature',
|
|
35
|
-
value:
|
|
43
|
+
value: buildSignature(method as MethodMirrorWithInheritance),
|
|
36
44
|
},
|
|
37
45
|
returnType: {
|
|
38
46
|
headingLevel: baseHeadingLevel + 1,
|
|
@@ -68,12 +76,16 @@ export function adaptConstructor(
|
|
|
68
76
|
return `${name}(${parametersString})`;
|
|
69
77
|
}
|
|
70
78
|
|
|
71
|
-
function buildSignature(name: string, constructor: ConstructorMirror):
|
|
79
|
+
function buildSignature(name: string, constructor: ConstructorMirror): CodeBlock {
|
|
72
80
|
const { access_modifier } = constructor;
|
|
73
81
|
const parameters = constructor.parameters
|
|
74
82
|
.map((param) => `${param.typeReference.rawDeclaration} ${param.name}`)
|
|
75
83
|
.join(', ');
|
|
76
|
-
return
|
|
84
|
+
return {
|
|
85
|
+
__type: 'code-block',
|
|
86
|
+
language: 'apex',
|
|
87
|
+
content: [`${access_modifier} ${name}(${parameters})`],
|
|
88
|
+
};
|
|
77
89
|
}
|
|
78
90
|
|
|
79
91
|
return {
|
|
@@ -83,7 +95,7 @@ export function adaptConstructor(
|
|
|
83
95
|
signature: {
|
|
84
96
|
headingLevel: baseHeadingLevel + 1,
|
|
85
97
|
heading: 'Signature',
|
|
86
|
-
value:
|
|
98
|
+
value: buildSignature(typeName, constructor),
|
|
87
99
|
},
|
|
88
100
|
parameters: {
|
|
89
101
|
headingLevel: baseHeadingLevel + 1,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CodeBlock, EmptyLine, InlineCode, RenderableContent } from './types';
|
|
2
|
+
|
|
3
|
+
export function isEmptyLine(content: RenderableContent): content is EmptyLine {
|
|
4
|
+
return Object.keys(content).includes('__type') && (content as { __type: string }).__type === 'empty-line';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function isCodeBlock(content: RenderableContent): content is CodeBlock {
|
|
8
|
+
return Object.keys(content).includes('__type') && (content as { __type: string }).__type === 'code-block';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function isInlineCode(content: RenderableContent): content is InlineCode {
|
|
12
|
+
return Object.keys(content).includes('__type') && (content as { __type: string }).__type === 'inline-code';
|
|
13
|
+
}
|
|
@@ -1,15 +1,44 @@
|
|
|
1
|
+
// Apex Reflection-based types
|
|
2
|
+
import {
|
|
3
|
+
Annotation as MirrorAnnotation,
|
|
4
|
+
ClassMirror,
|
|
5
|
+
DocComment,
|
|
6
|
+
FieldMirror,
|
|
7
|
+
MethodMirror,
|
|
8
|
+
PropertyMirror,
|
|
9
|
+
} from '@cparra/apex-reflection';
|
|
10
|
+
|
|
11
|
+
export type Describable = string[] | undefined;
|
|
12
|
+
|
|
13
|
+
export type Documentable = {
|
|
14
|
+
annotations: MirrorAnnotation[];
|
|
15
|
+
docComment?: DocComment;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type InheritanceSupport = { inherited: boolean };
|
|
19
|
+
export type ClassMirrorWithInheritanceChain = ClassMirror & { inheritanceChain: string[] };
|
|
20
|
+
export type FieldMirrorWithInheritance = FieldMirror & InheritanceSupport;
|
|
21
|
+
export type PropertyMirrorWithInheritance = PropertyMirror & InheritanceSupport;
|
|
22
|
+
export type MethodMirrorWithInheritance = MethodMirror & InheritanceSupport;
|
|
23
|
+
export type FieldOrProperty = FieldMirrorWithInheritance | PropertyMirrorWithInheritance;
|
|
24
|
+
|
|
25
|
+
// Renderable types
|
|
26
|
+
|
|
1
27
|
export type Link = {
|
|
28
|
+
readonly __type: 'link';
|
|
2
29
|
title: string;
|
|
3
30
|
url: string;
|
|
4
31
|
};
|
|
5
32
|
|
|
6
33
|
export type EmptyLine = {
|
|
7
|
-
|
|
34
|
+
__type: 'empty-line';
|
|
8
35
|
};
|
|
9
36
|
|
|
10
37
|
export type StringOrLink = string | Link;
|
|
11
38
|
|
|
12
|
-
export type
|
|
39
|
+
export type GetRenderableContentByTypeName = (typeName: string) => StringOrLink;
|
|
40
|
+
|
|
41
|
+
export type RenderableContent = StringOrLink | EmptyLine | CodeBlock | InlineCode;
|
|
13
42
|
|
|
14
43
|
type EnumValue = {
|
|
15
44
|
value: string;
|
|
@@ -22,11 +51,20 @@ type CustomTag = {
|
|
|
22
51
|
};
|
|
23
52
|
|
|
24
53
|
/**
|
|
25
|
-
* Represents an annotation to a top-level type. For example @NamespaceAccessible.
|
|
54
|
+
* Represents an annotation to a top-level type. For example, @NamespaceAccessible.
|
|
26
55
|
*/
|
|
27
56
|
type Annotation = string;
|
|
28
57
|
|
|
29
|
-
type CodeBlock =
|
|
58
|
+
type CodeBlock = {
|
|
59
|
+
readonly __type: 'code-block';
|
|
60
|
+
language: string;
|
|
61
|
+
content: string[];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
type InlineCode = {
|
|
65
|
+
readonly __type: 'inline-code';
|
|
66
|
+
content: string;
|
|
67
|
+
};
|
|
30
68
|
|
|
31
69
|
type RenderableDocumentation = {
|
|
32
70
|
annotations?: Annotation[];
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { ClassMirror, InterfaceMirror, reflect as mirrorReflection, Type } from '@cparra/apex-reflection';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { classMarkdownTemplate } from '../transpiler/markdown/plain-markdown/class-template';
|
|
5
|
-
import { enumMarkdownTemplate } from '../transpiler/markdown/plain-markdown/enum-template';
|
|
6
|
-
import { interfaceMarkdownTemplate } from '../transpiler/markdown/plain-markdown/interface-template';
|
|
2
|
+
import * as O from 'fp-ts/Option';
|
|
3
|
+
import { pipe } from 'fp-ts/function';
|
|
7
4
|
import * as E from 'fp-ts/Either';
|
|
8
|
-
|
|
5
|
+
|
|
6
|
+
import { typeToRenderable } from './adapters/apex-types';
|
|
7
|
+
import { Link, Renderable, RenderableContent, RenderableEnum, StringOrLink } from './adapters/types';
|
|
9
8
|
import { CompilationRequest, Template } from './template';
|
|
10
|
-
import Manifest from '../model/manifest';
|
|
11
9
|
import { referenceGuideTemplate } from './templates/reference-guide';
|
|
12
|
-
import { adaptDescribable } from '
|
|
10
|
+
import { adaptDescribable } from './adapters/documentables';
|
|
13
11
|
import { createInheritanceChain } from './inheritance-chain';
|
|
12
|
+
import ApexBundle from './apex-bundle';
|
|
13
|
+
import Manifest from './manifest';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// TODO: The core should never depend on things from the outside, so it should never reference "back" (../)
|
|
16
|
+
import { classMarkdownTemplate } from '../transpiler/markdown/plain-markdown/class-template';
|
|
17
|
+
import { interfaceMarkdownTemplate } from '../transpiler/markdown/plain-markdown/interface-template';
|
|
18
|
+
import { enumMarkdownTemplate } from '../transpiler/markdown/plain-markdown/enum-template';
|
|
19
|
+
import MetadataProcessor from '../service/metadata-processor';
|
|
16
20
|
|
|
17
21
|
export type DocumentationBundle = {
|
|
18
22
|
format: 'markdown';
|
|
@@ -44,13 +48,13 @@ const configDefaults: DocumentationConfig = {
|
|
|
44
48
|
};
|
|
45
49
|
|
|
46
50
|
export function generateDocs(
|
|
47
|
-
input:
|
|
51
|
+
input: ApexBundle[],
|
|
48
52
|
config?: Partial<DocumentationConfig>,
|
|
49
|
-
): E.Either<
|
|
53
|
+
): E.Either<ReflectionError[], DocumentationBundle> {
|
|
50
54
|
const configWithDefaults = { ...configDefaults, ...config };
|
|
51
55
|
return pipe(
|
|
52
56
|
input,
|
|
53
|
-
(input) => input.map(reflectSourceBody),
|
|
57
|
+
(input) => input.map((bundle) => reflectSourceBody(bundle)),
|
|
54
58
|
checkForReflectionErrors,
|
|
55
59
|
E.map((types) => filterTypesOutOfScope(types, configWithDefaults.scope)),
|
|
56
60
|
E.map((types) => types.map((type) => addInheritedMembers(type, types))),
|
|
@@ -82,7 +86,7 @@ type RenderableBundle = {
|
|
|
82
86
|
function typesToRenderableBundle(types: Type[], config: DocumentationConfig) {
|
|
83
87
|
return types.reduce<RenderableBundle>(
|
|
84
88
|
(acc, type) => {
|
|
85
|
-
const renderable =
|
|
89
|
+
const renderable = typeToRenderable(
|
|
86
90
|
type,
|
|
87
91
|
(referenceName) => {
|
|
88
92
|
return linkFromTypeNameGenerator(type, types, referenceName, config);
|
|
@@ -159,12 +163,12 @@ function filterTypesOutOfScope(types: Type[], scope: string[]): Type[] {
|
|
|
159
163
|
return new Manifest(types).filteredByAccessModifierAndAnnotations(scope);
|
|
160
164
|
}
|
|
161
165
|
|
|
162
|
-
function checkForReflectionErrors(reflectionResult: E.Either<
|
|
163
|
-
function reduceReflectionResultIntoSingleEither(results: E.Either<
|
|
164
|
-
errors:
|
|
166
|
+
function checkForReflectionErrors(reflectionResult: E.Either<ReflectionError, Type>[]) {
|
|
167
|
+
function reduceReflectionResultIntoSingleEither(results: E.Either<ReflectionError, Type>[]): {
|
|
168
|
+
errors: ReflectionError[];
|
|
165
169
|
types: Type[];
|
|
166
170
|
} {
|
|
167
|
-
return results.reduce<{ errors:
|
|
171
|
+
return results.reduce<{ errors: ReflectionError[]; types: Type[] }>(
|
|
168
172
|
(acc, result) => {
|
|
169
173
|
E.isLeft(result) ? acc.errors.push(result.left) : acc.types.push(result.right);
|
|
170
174
|
return acc;
|
|
@@ -181,10 +185,39 @@ function checkForReflectionErrors(reflectionResult: E.Either<string, Type>[]) {
|
|
|
181
185
|
);
|
|
182
186
|
}
|
|
183
187
|
|
|
184
|
-
function
|
|
188
|
+
function addFileMetadataToTypeAnnotation(type: Type, metadata: string | null): Type {
|
|
189
|
+
return pipe(
|
|
190
|
+
O.fromNullable(metadata),
|
|
191
|
+
O.map((metadata) => {
|
|
192
|
+
const metadataParams = MetadataProcessor.process(metadata);
|
|
193
|
+
metadataParams.forEach((value, key) => {
|
|
194
|
+
const declaration = `${key}: ${value}`;
|
|
195
|
+
type.annotations.push({
|
|
196
|
+
rawDeclaration: declaration,
|
|
197
|
+
name: declaration,
|
|
198
|
+
type: declaration,
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
return type;
|
|
202
|
+
}),
|
|
203
|
+
O.getOrElse(() => type),
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export class ReflectionError {
|
|
208
|
+
constructor(
|
|
209
|
+
public file: string,
|
|
210
|
+
public message: string,
|
|
211
|
+
) {}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function reflectSourceBody(apexBundle: ApexBundle): E.Either<ReflectionError, Type> {
|
|
215
|
+
const { filePath, rawTypeContent: input, rawMetadataContent: metadata } = apexBundle;
|
|
185
216
|
const result = mirrorReflection(input);
|
|
186
217
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
187
|
-
return result.error
|
|
218
|
+
return result.error
|
|
219
|
+
? E.left(new ReflectionError(filePath, result.error.message))
|
|
220
|
+
: E.right(addFileMetadataToTypeAnnotation(result.typeMirror!, metadata));
|
|
188
221
|
}
|
|
189
222
|
|
|
190
223
|
function resolveApexTypeTemplate(renderable: Renderable): CompilationRequest {
|
|
@@ -330,6 +363,7 @@ function linkFromTypeNameGenerator(
|
|
|
330
363
|
|
|
331
364
|
const [fullClassName, fileLink] = getFileLinkTuple(typeBeingDocumented, type, config);
|
|
332
365
|
return {
|
|
366
|
+
__type: 'link',
|
|
333
367
|
title: fullClassName,
|
|
334
368
|
url: fileLink,
|
|
335
369
|
};
|
|
@@ -362,6 +396,7 @@ function getPossibleLinkFromRoot(config: DocumentationConfig, fallback: string,
|
|
|
362
396
|
const namespacePrefix = config.namespace ? `${config.namespace}.` : '';
|
|
363
397
|
const title = `${namespacePrefix}${type.name}`;
|
|
364
398
|
return {
|
|
399
|
+
__type: 'link',
|
|
365
400
|
title: title,
|
|
366
401
|
url: `${getDirectoryFromRoot(config, type)}/${title}.md`,
|
|
367
402
|
};
|
|
@@ -371,6 +406,7 @@ function getLinkFromRoot(config: DocumentationConfig, type: Type): Link {
|
|
|
371
406
|
const namespacePrefix = config.namespace ? `${config.namespace}.` : '';
|
|
372
407
|
const title = `${namespacePrefix}${type.name}`;
|
|
373
408
|
return {
|
|
409
|
+
__type: 'link',
|
|
374
410
|
title: title,
|
|
375
411
|
url: `${getDirectoryFromRoot(config, type)}/${title}.md`,
|
|
376
412
|
};
|
package/src/core/template.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { fieldsPartialTemplate } from '../transpiler/markdown/plain-markdown/fie
|
|
|
7
7
|
import { classMarkdownTemplate } from '../transpiler/markdown/plain-markdown/class-template';
|
|
8
8
|
import { enumMarkdownTemplate } from '../transpiler/markdown/plain-markdown/enum-template';
|
|
9
9
|
import { interfaceMarkdownTemplate } from '../transpiler/markdown/plain-markdown/interface-template';
|
|
10
|
-
import { RenderableContent, StringOrLink } from './
|
|
11
|
-
import { isEmptyLine } from '
|
|
10
|
+
import { CodeBlock, RenderableContent, StringOrLink } from './adapters/types';
|
|
11
|
+
import { isCodeBlock, isEmptyLine, isInlineCode } from './adapters/type-utils';
|
|
12
12
|
import { groupedMembersPartialTemplate } from '../transpiler/markdown/plain-markdown/grouped-members-partial-template';
|
|
13
13
|
|
|
14
14
|
export type CompilationRequest = {
|
|
@@ -32,7 +32,7 @@ export class Template {
|
|
|
32
32
|
|
|
33
33
|
Handlebars.registerHelper('link', link);
|
|
34
34
|
Handlebars.registerHelper('code', convertCodeBlock);
|
|
35
|
-
Handlebars.registerHelper('
|
|
35
|
+
Handlebars.registerHelper('renderContent', resolveRenderableContent);
|
|
36
36
|
Handlebars.registerHelper('heading', heading);
|
|
37
37
|
Handlebars.registerHelper('inlineCode', inlineCode);
|
|
38
38
|
Handlebars.registerHelper('splitAndCapitalize', splitAndCapitalize);
|
|
@@ -73,17 +73,17 @@ const inlineCode = (text: string) => {
|
|
|
73
73
|
return new Handlebars.SafeString(`\`${text}\``);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
const convertCodeBlock = (
|
|
76
|
+
const convertCodeBlock = (codeBlock: CodeBlock): Handlebars.SafeString => {
|
|
77
77
|
return new Handlebars.SafeString(
|
|
78
78
|
`
|
|
79
|
-
\`\`\`${language}
|
|
80
|
-
${
|
|
79
|
+
\`\`\`${codeBlock.language}
|
|
80
|
+
${codeBlock.content.join('\n')}
|
|
81
81
|
\`\`\`
|
|
82
82
|
`.trim(),
|
|
83
83
|
);
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
const
|
|
86
|
+
const resolveRenderableContent = (description?: RenderableContent[]): string => {
|
|
87
87
|
if (!description) {
|
|
88
88
|
return '';
|
|
89
89
|
}
|
|
@@ -92,8 +92,14 @@ const resolveLinksInContent = (description?: RenderableContent[]): string => {
|
|
|
92
92
|
if (isEmptyLine(curr)) {
|
|
93
93
|
return acc + '\n\n';
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
if (isCodeBlock(curr)) {
|
|
96
|
+
return acc + convertCodeBlock(curr) + '\n';
|
|
97
|
+
}
|
|
98
|
+
if (isInlineCode(curr)) {
|
|
99
|
+
return acc + inlineCode(curr.content).toString() + ' ';
|
|
100
|
+
} else {
|
|
101
|
+
return acc + Handlebars.escapeExpression(link(curr)).trim() + ' ';
|
|
102
|
+
}
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
return description.reduce(reduceDescription, '').trim();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MarkdownFile } from '../markdown-file';
|
|
2
|
-
import { FieldMirrorWithInheritance, FieldOrProperty, PropertyMirrorWithInheritance } from '
|
|
2
|
+
import { FieldMirrorWithInheritance, FieldOrProperty, PropertyMirrorWithInheritance } from '../../core/adapters/types';
|
|
3
3
|
|
|
4
4
|
export function declareField(
|
|
5
5
|
markdownFile: MarkdownFile,
|
|
@@ -2,7 +2,7 @@ import { ConstructorMirror, DocComment } from '@cparra/apex-reflection';
|
|
|
2
2
|
import { MarkdownFile } from '../markdown-file';
|
|
3
3
|
import { ParameterMirror } from '@cparra/apex-reflection';
|
|
4
4
|
import { addCustomDocCommentAnnotations, addMermaid } from './doc-comment-annotation-util';
|
|
5
|
-
import { MethodMirrorWithInheritance } from '
|
|
5
|
+
import { MethodMirrorWithInheritance } from '../../core/adapters/types';
|
|
6
6
|
|
|
7
7
|
export function declareMethod(
|
|
8
8
|
markdownFile: MarkdownFile,
|
|
@@ -11,8 +11,12 @@ import { WalkerListener } from '../service/walkers/walker';
|
|
|
11
11
|
import { MarkdownFile } from './markdown-file';
|
|
12
12
|
import { declareType, declareMethod, declareField } from './markdown-generation-util';
|
|
13
13
|
import ClassFileGeneratorHelper from '../transpiler/markdown/class-file-generatorHelper';
|
|
14
|
-
import { FieldMirrorWithInheritance, MethodMirrorWithInheritance, PropertyMirrorWithInheritance } from './inheritance';
|
|
15
14
|
import { Settings } from '../settings';
|
|
15
|
+
import {
|
|
16
|
+
FieldMirrorWithInheritance,
|
|
17
|
+
MethodMirrorWithInheritance,
|
|
18
|
+
PropertyMirrorWithInheritance
|
|
19
|
+
} from '../core/adapters/types';
|
|
16
20
|
|
|
17
21
|
interface GroupAware {
|
|
18
22
|
group?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Settings } from '../settings';
|
|
2
2
|
import { FileSystem } from './file-system';
|
|
3
|
-
import ApexBundle from '../
|
|
3
|
+
import ApexBundle from '../core/apex-bundle';
|
|
4
4
|
|
|
5
5
|
const APEX_FILE_EXTENSION = '.cls';
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ export class ApexFileReader {
|
|
|
17
17
|
const directoryContents = fileSystem.readDirectory(rootPath);
|
|
18
18
|
directoryContents.forEach((currentFilePath) => {
|
|
19
19
|
const currentPath = fileSystem.joinPath(rootPath, currentFilePath);
|
|
20
|
-
if (
|
|
20
|
+
if (fileSystem.isDirectory(currentPath)) {
|
|
21
21
|
bundles = bundles.concat(this.processFiles(fileSystem, currentPath));
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -44,8 +44,4 @@ export class ApexFileReader {
|
|
|
44
44
|
private static get sourceDirectory() {
|
|
45
45
|
return Settings.getInstance().sourceDirectory;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
private static get readRecursively() {
|
|
49
|
-
return Settings.getInstance().recursive;
|
|
50
|
-
}
|
|
51
47
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Manifest from '../
|
|
1
|
+
import Manifest from '../core/manifest';
|
|
2
2
|
import { TypeParser } from './parser';
|
|
3
3
|
import { ReflectionResult } from '@cparra/apex-reflection';
|
|
4
|
-
import ApexBundle from '../
|
|
4
|
+
import ApexBundle from '../core/apex-bundle';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Builds a new Manifest object, sourcing its types from the received TypeParser.
|
package/src/service/parser.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClassMirror, InterfaceMirror, ReflectionResult, Type } from '@cparra/apex-reflection';
|
|
2
|
-
import ApexBundle from '../
|
|
2
|
+
import ApexBundle from '../core/apex-bundle';
|
|
3
3
|
import MetadataProcessor from './metadata-processor';
|
|
4
4
|
import { Logger } from '../util/logger';
|
|
5
5
|
|
package/src/settings.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GeneratorChoices } from './transpiler/generator-choices';
|
|
2
|
+
import { LinkingStrategy } from './transpiler/processor-type-transpiler';
|
|
2
3
|
|
|
3
4
|
export type OnBeforeFileWrite = (file: TargetFile) => TargetFile;
|
|
4
5
|
|
|
@@ -23,13 +24,11 @@ export type TargetType = {
|
|
|
23
24
|
|
|
24
25
|
export interface SettingsConfig {
|
|
25
26
|
sourceDirectory: string;
|
|
26
|
-
recursive: boolean;
|
|
27
27
|
scope: string[];
|
|
28
28
|
outputDir: string;
|
|
29
29
|
targetGenerator: GeneratorChoices;
|
|
30
30
|
indexOnly: boolean;
|
|
31
31
|
defaultGroupName: string;
|
|
32
|
-
sanitizeHtml: boolean;
|
|
33
32
|
openApiTitle?: string;
|
|
34
33
|
title: string;
|
|
35
34
|
namespace?: string;
|
|
@@ -40,6 +39,7 @@ export interface SettingsConfig {
|
|
|
40
39
|
onAfterProcess?: (files: TargetFile[]) => void;
|
|
41
40
|
onBeforeFileWrite?: (file: TargetFile) => TargetFile;
|
|
42
41
|
frontMatterHeader?: (file: TargetType) => string[];
|
|
42
|
+
linkingStrategy: LinkingStrategy;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export class Settings {
|
|
@@ -62,10 +62,6 @@ export class Settings {
|
|
|
62
62
|
return this.config.sourceDirectory;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
get recursive(): boolean {
|
|
66
|
-
return this.config.recursive;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
65
|
get scope(): string[] {
|
|
70
66
|
return this.config.scope;
|
|
71
67
|
}
|
|
@@ -82,10 +78,6 @@ export class Settings {
|
|
|
82
78
|
return this.config.indexOnly;
|
|
83
79
|
}
|
|
84
80
|
|
|
85
|
-
get sanitizeHtml(): boolean {
|
|
86
|
-
return this.config.sanitizeHtml;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
81
|
public getDefaultGroupName(): string {
|
|
90
82
|
return this.config.defaultGroupName;
|
|
91
83
|
}
|
|
@@ -144,4 +136,8 @@ export class Settings {
|
|
|
144
136
|
}
|
|
145
137
|
return [];
|
|
146
138
|
}
|
|
139
|
+
|
|
140
|
+
public getLinkingStrategy(): LinkingStrategy {
|
|
141
|
+
return this.config.linkingStrategy;
|
|
142
|
+
}
|
|
147
143
|
}
|
|
@@ -8,17 +8,16 @@ export class SettingsBuilder {
|
|
|
8
8
|
build(): SettingsConfig {
|
|
9
9
|
return {
|
|
10
10
|
sourceDirectory: './',
|
|
11
|
-
recursive: true,
|
|
12
11
|
scope: [],
|
|
13
12
|
outputDir: './',
|
|
14
13
|
targetGenerator: 'openapi',
|
|
15
14
|
indexOnly: false,
|
|
16
15
|
defaultGroupName: 'Misc',
|
|
17
|
-
sanitizeHtml: true,
|
|
18
16
|
openApiTitle: 'Apex API',
|
|
19
17
|
openApiFileName: 'openapi',
|
|
20
18
|
title: 'Classes',
|
|
21
19
|
includeMetadata: false,
|
|
20
|
+
linkingStrategy: 'root-relative',
|
|
22
21
|
};
|
|
23
22
|
}
|
|
24
23
|
}
|
|
@@ -2,7 +2,6 @@ import ProcessorTypeTranspiler from './processor-type-transpiler';
|
|
|
2
2
|
import { GeneratorChoices } from './generator-choices';
|
|
3
3
|
import { JekyllDocsProcessor } from './markdown/jekyll/jekyll-docsProcessor';
|
|
4
4
|
import DocsifyDocsProcessor from './markdown/docsify/docsify-docs-processor';
|
|
5
|
-
import { PlainMarkdownDocsProcessor } from './markdown/plain-markdown/plain-docsProcessor';
|
|
6
5
|
import { OpenApiDocsProcessor } from './openapi/open-api-docs-processor';
|
|
7
6
|
|
|
8
7
|
export class TypeTranspilerFactory {
|
|
@@ -20,12 +19,11 @@ export class TypeTranspilerFactory {
|
|
|
20
19
|
case 'docsify':
|
|
21
20
|
this.typeTranspilerCache = new DocsifyDocsProcessor();
|
|
22
21
|
return this.typeTranspilerCache;
|
|
23
|
-
case 'plain-markdown':
|
|
24
|
-
this.typeTranspilerCache = new PlainMarkdownDocsProcessor();
|
|
25
|
-
return this.typeTranspilerCache;
|
|
26
22
|
case 'openapi':
|
|
27
23
|
this.typeTranspilerCache = new OpenApiDocsProcessor();
|
|
28
24
|
return this.typeTranspilerCache;
|
|
25
|
+
case 'plain-markdown':
|
|
26
|
+
throw Error('Plain Markdown processor is not supported through this factory anymore.');
|
|
29
27
|
default:
|
|
30
28
|
throw Error('Invalid target generator');
|
|
31
29
|
}
|