@cparra/apexdocs 2.25.0-alpha.3 → 2.25.0-alpha.5
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/dist/cli/generate.js +2746 -40
- package/dist/defaults-DUwru49Q.js +12 -0
- package/dist/defaults-SH0Rsi5E.js +11 -0
- package/dist/index.d.ts +62 -2
- package/dist/index.js +36 -1
- package/examples/plain-markdown/docs/Miscellaneous/ns.BaseClass.md +1 -1
- package/examples/plain-markdown/docs/Miscellaneous/ns.MultiInheritanceClass.md +1 -1
- package/examples/plain-markdown/docs/Miscellaneous/ns.ParentInterface.md +1 -1
- package/examples/plain-markdown/docs/Miscellaneous/ns.ReferencedEnum.md +1 -1
- package/examples/plain-markdown/docs/Miscellaneous/ns.SampleException.md +1 -1
- package/examples/plain-markdown/docs/Miscellaneous/ns.SampleInterface.md +1 -1
- package/examples/plain-markdown/docs/Miscellaneous/ns.Url.md +320 -0
- package/examples/plain-markdown/docs/Sample-Enums/ns.SampleEnum.md +1 -1
- package/examples/plain-markdown/docs/SampleGroup/ns.SampleClass.md +1 -1
- package/examples/plain-markdown/docs/index.md +83 -1
- package/examples/plain-markdown/force-app/classes/Url.cls +194 -0
- package/examples/plain-markdown/package.json +2 -2
- package/examples/vitepress/.forceignore +12 -0
- package/examples/vitepress/apexdocs.config.ts +108 -0
- package/examples/vitepress/config/project-scratch-def.json +13 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/@theme_index.js +259 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/@theme_index.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/_metadata.json +40 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-574YRH25.js +11474 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-574YRH25.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-E5DZZB2I.js +9172 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-E5DZZB2I.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/package.json +3 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4339 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +567 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vue.js +323 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vue.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/config.mts +21 -0
- package/examples/vitepress/docs/.vitepress/sidebar.json +119 -0
- package/examples/vitepress/docs/Miscellaneous/apexdocs.BaseClass.md +20 -0
- package/examples/vitepress/docs/Miscellaneous/apexdocs.MultiInheritanceClass.md +78 -0
- package/examples/vitepress/docs/Miscellaneous/apexdocs.ParentInterface.md +19 -0
- package/examples/vitepress/docs/Miscellaneous/apexdocs.ReferencedEnum.md +15 -0
- package/examples/vitepress/docs/Miscellaneous/apexdocs.SampleException.md +28 -0
- package/examples/vitepress/docs/Miscellaneous/apexdocs.SampleInterface.md +122 -0
- package/examples/vitepress/docs/Miscellaneous/apexdocs.Url.md +318 -0
- package/examples/vitepress/docs/Sample-Enums/apexdocs.SampleEnum.md +41 -0
- package/examples/vitepress/docs/SampleGroup/apexdocs.SampleClass.md +178 -0
- package/examples/vitepress/docs/api-examples.md +49 -0
- package/examples/vitepress/docs/index-frontmatter.md +16 -0
- package/examples/vitepress/docs/index.md +127 -0
- package/examples/vitepress/docs/markdown-examples.md +85 -0
- package/examples/vitepress/force-app/main/default/classes/BaseClass.cls +3 -0
- package/examples/vitepress/force-app/main/default/classes/MultiInheritanceClass.cls +1 -0
- package/examples/vitepress/force-app/main/default/classes/ParentInterface.cls +3 -0
- package/examples/vitepress/force-app/main/default/classes/ReferencedEnum.cls +5 -0
- package/examples/vitepress/force-app/main/default/classes/SampleClass.cls +72 -0
- package/examples/vitepress/force-app/main/default/classes/SampleEnum.cls +30 -0
- package/examples/vitepress/force-app/main/default/classes/SampleException.cls +17 -0
- package/examples/vitepress/force-app/main/default/classes/SampleInterface.cls +46 -0
- package/examples/vitepress/force-app/main/default/classes/Url.cls +195 -0
- package/examples/vitepress/package-lock.json +2574 -0
- package/examples/vitepress/package.json +18 -0
- package/examples/vitepress/sfdx-project.json +12 -0
- package/jest.config.js +1 -0
- package/package.json +10 -6
- package/src/application/Apexdocs.ts +16 -106
- package/src/application/__tests__/apex-file-reader.spec.ts +104 -0
- package/src/application/apex-file-reader.ts +42 -0
- package/src/application/file-writer.ts +25 -0
- package/src/application/generators/markdown.ts +53 -0
- package/src/application/generators/openapi.ts +56 -0
- package/src/cli/args.ts +17 -110
- package/src/cli/commands/markdown.ts +58 -0
- package/src/cli/generate.ts +7 -7
- package/src/{model/__tests__ → core/__test__}/manifest.spec.ts +1 -1
- package/src/core/manifest.ts +57 -51
- package/src/{__spec__/core → core/markdown/__test__}/expect-extensions.ts +5 -5
- package/src/core/markdown/__test__/generating-class-docs.spec.ts +727 -0
- package/src/{__spec__/core → core/markdown/__test__}/generating-enum-docs.spec.ts +82 -59
- package/src/{__spec__/core → core/markdown/__test__}/generating-interface-docs.spec.ts +94 -75
- package/src/core/markdown/__test__/generating-reference-guide.spec.ts +184 -0
- package/src/core/{__test__ → markdown/__test__}/inheritance-chain.test.ts +2 -2
- package/src/core/markdown/__test__/test-helpers.ts +22 -0
- package/src/core/markdown/adapters/__tests__/documentables.spec.ts +109 -0
- package/src/core/{adapters → markdown/adapters}/__tests__/interface-adapter.spec.ts +38 -8
- package/src/core/{adapters → markdown/adapters}/__tests__/references.spec.ts +12 -1
- package/src/core/{adapters → markdown/adapters}/apex-types.ts +8 -5
- package/src/core/{adapters → markdown/adapters}/documentables.ts +2 -62
- package/src/core/{adapters → markdown/adapters}/fields-and-properties.ts +7 -2
- package/src/core/{adapters/references.ts → markdown/adapters/inline.ts} +43 -10
- package/src/core/{adapters → markdown/adapters}/methods-and-constructors.ts +7 -2
- package/src/core/markdown/adapters/renderable-bundle.ts +144 -0
- package/src/core/markdown/adapters/renderable-to-page-data.ts +92 -0
- package/src/core/{adapters → markdown/adapters}/type-utils.ts +5 -1
- package/src/core/{adapters → markdown/adapters}/types.d.ts +24 -3
- package/src/core/markdown/generate-docs.ts +158 -0
- package/src/core/markdown/reflection/error-handling.ts +37 -0
- package/src/core/markdown/reflection/filter-scope.ts +13 -0
- package/src/core/markdown/reflection/inheritance-chain-expanion.ts +22 -0
- package/src/core/markdown/reflection/inherited-member-expansion.ts +105 -0
- package/src/core/markdown/reflection/reflect-source.ts +41 -0
- package/src/core/markdown/reflection/sort-members.ts +59 -0
- package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/class-template.ts +2 -0
- package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/constructors-partial-template.ts +1 -1
- package/src/core/markdown/templates/hookable.ts +7 -0
- package/src/core/{template.ts → markdown/templates/template.ts} +15 -12
- package/src/core/markdown/utils.ts +3 -0
- package/src/{transpiler → core}/openapi/__tests__/open-api-docs-processor.spec.ts +1 -1
- package/src/{model → core/openapi}/apex-type-wrappers/__tests__/ClassMirrorWrapper.spec.ts +3 -3
- package/src/core/openapi/file-container.ts +13 -0
- package/src/{service → core/openapi}/manifest-factory.ts +3 -3
- package/src/{transpiler → core}/openapi/open-api-docs-processor.ts +9 -10
- package/src/core/openapi/openapi-type-file.ts +14 -0
- package/src/{service → core/openapi}/parser.ts +8 -8
- package/src/{transpiler → core}/openapi/parsers/Builder.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/MethodParser.ts +5 -5
- package/src/{transpiler → core}/openapi/parsers/ParameterObjectBuilder.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/ReferenceBuilder.ts +3 -3
- package/src/{transpiler → core}/openapi/parsers/RequestBodyBuilder.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/ResponsesBuilder.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/__tests__/MethodParser.spec.ts +1 -1
- package/src/{transpiler → core}/openapi/parsers/__tests__/ParameterObjectBuilder.spec.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/__tests__/ReferenceBuilder.spec.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/__tests__/RequestBodyBuilder.spec.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/__tests__/ResponsesBuilder.spec.ts +1 -1
- package/src/{transpiler → core/openapi}/transpiler.ts +2 -6
- package/src/{model → core/openapi}/types-repository.ts +0 -9
- package/src/core/parse-apex-metadata.ts +14 -0
- package/src/core/settings.ts +56 -0
- package/src/core/shared/types.d.ts +92 -0
- package/src/core/shared/utils.ts +5 -0
- package/src/defaults.ts +8 -0
- package/src/index.ts +34 -2
- package/src/test-helpers/InterfaceMirrorBuilder.ts +0 -5
- package/src/test-helpers/SettingsBuilder.ts +1 -5
- package/src/util/fp.ts +3 -0
- package/src/util/logger.ts +2 -2
- package/src/util/string-utils.ts +0 -4
- package/tsconfig.json +5 -1
- package/apexdocs.config.ts +0 -13
- package/dist/__spec__/core/expect-extensions.d.ts +0 -3
- package/dist/__spec__/core/expect-extensions.js +0 -55
- package/dist/__spec__/core/expect-extensions.js.map +0 -1
- package/dist/__spec__/core/generating-class-docs.spec.d.ts +0 -1
- package/dist/__spec__/core/generating-class-docs.spec.js +0 -444
- package/dist/__spec__/core/generating-class-docs.spec.js.map +0 -1
- package/dist/__spec__/core/generating-enum-docs.spec.d.ts +0 -1
- package/dist/__spec__/core/generating-enum-docs.spec.js +0 -306
- package/dist/__spec__/core/generating-enum-docs.spec.js.map +0 -1
- package/dist/__spec__/core/generating-interface-docs.spec.d.ts +0 -1
- package/dist/__spec__/core/generating-interface-docs.spec.js +0 -364
- package/dist/__spec__/core/generating-interface-docs.spec.js.map +0 -1
- package/dist/__spec__/core/generating-reference-guide.spec.d.ts +0 -1
- package/dist/__spec__/core/generating-reference-guide.spec.js +0 -162
- package/dist/__spec__/core/generating-reference-guide.spec.js.map +0 -1
- package/dist/__spec__/core/test-helpers.d.ts +0 -2
- package/dist/__spec__/core/test-helpers.js +0 -12
- package/dist/__spec__/core/test-helpers.js.map +0 -1
- package/dist/application/Apexdocs.d.ts +0 -15
- package/dist/application/Apexdocs.js +0 -113
- package/dist/application/Apexdocs.js.map +0 -1
- package/dist/application/generators/generate-markdown-files.d.ts +0 -3
- package/dist/application/generators/generate-markdown-files.js +0 -64
- package/dist/application/generators/generate-markdown-files.js.map +0 -1
- package/dist/cli/args.d.ts +0 -39
- package/dist/cli/args.js +0 -154
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/generate.d.ts +0 -2
- package/dist/cli/generate.js.map +0 -1
- package/dist/core/__test__/inheritance-chain.test.d.ts +0 -1
- package/dist/core/__test__/inheritance-chain.test.js +0 -42
- package/dist/core/__test__/inheritance-chain.test.js.map +0 -1
- package/dist/core/adapters/apex-types.d.ts +0 -6
- package/dist/core/adapters/apex-types.js +0 -109
- package/dist/core/adapters/apex-types.js.map +0 -1
- package/dist/core/adapters/documentables.d.ts +0 -7
- package/dist/core/adapters/documentables.js +0 -154
- package/dist/core/adapters/documentables.js.map +0 -1
- package/dist/core/adapters/fields-and-properties.d.ts +0 -3
- package/dist/core/adapters/fields-and-properties.js +0 -37
- package/dist/core/adapters/fields-and-properties.js.map +0 -1
- package/dist/core/adapters/methods-and-constructors.d.ts +0 -5
- package/dist/core/adapters/methods-and-constructors.js +0 -100
- package/dist/core/adapters/methods-and-constructors.js.map +0 -1
- package/dist/core/adapters/references.d.ts +0 -4
- package/dist/core/adapters/references.js +0 -78
- package/dist/core/adapters/references.js.map +0 -1
- package/dist/core/adapters/type-utils.d.ts +0 -3
- package/dist/core/adapters/type-utils.js +0 -12
- package/dist/core/adapters/type-utils.js.map +0 -1
- package/dist/core/apex-bundle.d.ts +0 -6
- package/dist/core/apex-bundle.js +0 -11
- package/dist/core/apex-bundle.js.map +0 -1
- package/dist/core/generate-docs.d.ts +0 -28
- package/dist/core/generate-docs.js +0 -296
- package/dist/core/generate-docs.js.map +0 -1
- package/dist/core/inheritance-chain.d.ts +0 -2
- package/dist/core/inheritance-chain.js +0 -36
- package/dist/core/inheritance-chain.js.map +0 -1
- package/dist/core/manifest.d.ts +0 -22
- package/dist/core/manifest.js +0 -53
- package/dist/core/manifest.js.map +0 -1
- package/dist/core/template.d.ts +0 -10
- package/dist/core/template.js +0 -97
- package/dist/core/template.js.map +0 -1
- package/dist/core/templates/reference-guide.d.ts +0 -1
- package/dist/core/templates/reference-guide.js +0 -18
- package/dist/core/templates/reference-guide.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/model/apex-type-wrappers/ClassMirrorWrapper.d.ts +0 -7
- package/dist/model/apex-type-wrappers/ClassMirrorWrapper.js +0 -14
- package/dist/model/apex-type-wrappers/ClassMirrorWrapper.js.map +0 -1
- package/dist/model/apex-type-wrappers/MethodMirrorWrapper.d.ts +0 -7
- package/dist/model/apex-type-wrappers/MethodMirrorWrapper.js +0 -12
- package/dist/model/apex-type-wrappers/MethodMirrorWrapper.js.map +0 -1
- package/dist/model/markdown-file.d.ts +0 -16
- package/dist/model/markdown-file.js +0 -111
- package/dist/model/markdown-file.js.map +0 -1
- package/dist/model/markdown-generation-util/doc-comment-annotation-util.d.ts +0 -8
- package/dist/model/markdown-generation-util/doc-comment-annotation-util.js +0 -47
- package/dist/model/markdown-generation-util/doc-comment-annotation-util.js.map +0 -1
- package/dist/model/markdown-generation-util/field-declaration-util.d.ts +0 -3
- package/dist/model/markdown-generation-util/field-declaration-util.js +0 -55
- package/dist/model/markdown-generation-util/field-declaration-util.js.map +0 -1
- package/dist/model/markdown-generation-util/index.d.ts +0 -3
- package/dist/model/markdown-generation-util/index.js +0 -20
- package/dist/model/markdown-generation-util/index.js.map +0 -1
- package/dist/model/markdown-generation-util/method-declaration-util.d.ts +0 -4
- package/dist/model/markdown-generation-util/method-declaration-util.js +0 -115
- package/dist/model/markdown-generation-util/method-declaration-util.js.map +0 -1
- package/dist/model/markdown-generation-util/type-declaration-util.d.ts +0 -3
- package/dist/model/markdown-generation-util/type-declaration-util.js +0 -82
- package/dist/model/markdown-generation-util/type-declaration-util.js.map +0 -1
- package/dist/model/markdown-home-file.d.ts +0 -11
- package/dist/model/markdown-home-file.js +0 -57
- package/dist/model/markdown-home-file.js.map +0 -1
- package/dist/model/markdown-type-file.d.ts +0 -26
- package/dist/model/markdown-type-file.js +0 -137
- package/dist/model/markdown-type-file.js.map +0 -1
- package/dist/model/openapi/apex-doc-types.d.ts +0 -19
- package/dist/model/openapi/apex-doc-types.js +0 -5
- package/dist/model/openapi/apex-doc-types.js.map +0 -1
- package/dist/model/openapi/open-api-types.d.ts +0 -93
- package/dist/model/openapi/open-api-types.js +0 -3
- package/dist/model/openapi/open-api-types.js.map +0 -1
- package/dist/model/openapi/open-api.d.ts +0 -16
- package/dist/model/openapi/open-api.js +0 -34
- package/dist/model/openapi/open-api.js.map +0 -1
- package/dist/model/openapi/openapi-type-file.d.ts +0 -7
- package/dist/model/openapi/openapi-type-file.js +0 -17
- package/dist/model/openapi/openapi-type-file.js.map +0 -1
- package/dist/model/outputFile.d.ts +0 -10
- package/dist/model/outputFile.js +0 -22
- package/dist/model/outputFile.js.map +0 -1
- package/dist/model/types-repository.d.ts +0 -16
- package/dist/model/types-repository.js +0 -54
- package/dist/model/types-repository.js.map +0 -1
- package/dist/service/apex-file-reader.d.ts +0 -14
- package/dist/service/apex-file-reader.js +0 -49
- package/dist/service/apex-file-reader.js.map +0 -1
- package/dist/service/file-system.d.ts +0 -14
- package/dist/service/file-system.js +0 -48
- package/dist/service/file-system.js.map +0 -1
- package/dist/service/file-writer.d.ts +0 -6
- package/dist/service/file-writer.js +0 -57
- package/dist/service/file-writer.js.map +0 -1
- package/dist/service/manifest-factory.d.ts +0 -10
- package/dist/service/manifest-factory.js +0 -17
- package/dist/service/manifest-factory.js.map +0 -1
- package/dist/service/metadata-processor.d.ts +0 -3
- package/dist/service/metadata-processor.js +0 -17
- package/dist/service/metadata-processor.js.map +0 -1
- package/dist/service/parser.d.ts +0 -21
- package/dist/service/parser.js +0 -138
- package/dist/service/parser.js.map +0 -1
- package/dist/service/state.d.ts +0 -9
- package/dist/service/state.js +0 -20
- package/dist/service/state.js.map +0 -1
- package/dist/service/walkers/class-walker.d.ts +0 -4
- package/dist/service/walkers/class-walker.js +0 -33
- package/dist/service/walkers/class-walker.js.map +0 -1
- package/dist/service/walkers/enum-walker.d.ts +0 -4
- package/dist/service/walkers/enum-walker.js +0 -11
- package/dist/service/walkers/enum-walker.js.map +0 -1
- package/dist/service/walkers/interface-walker.d.ts +0 -4
- package/dist/service/walkers/interface-walker.js +0 -15
- package/dist/service/walkers/interface-walker.js.map +0 -1
- package/dist/service/walkers/walker-factory.d.ts +0 -5
- package/dist/service/walkers/walker-factory.js +0 -21
- package/dist/service/walkers/walker-factory.js.map +0 -1
- package/dist/service/walkers/walker.d.ts +0 -19
- package/dist/service/walkers/walker.js +0 -17
- package/dist/service/walkers/walker.js.map +0 -1
- package/dist/settings.d.ts +0 -67
- package/dist/settings.js +0 -92
- package/dist/settings.js.map +0 -1
- package/dist/test-helpers/AnnotationBuilder.d.ts +0 -12
- package/dist/test-helpers/AnnotationBuilder.js +0 -31
- package/dist/test-helpers/AnnotationBuilder.js.map +0 -1
- package/dist/test-helpers/ClassMirrorBuilder.d.ts +0 -22
- package/dist/test-helpers/ClassMirrorBuilder.js +0 -64
- package/dist/test-helpers/ClassMirrorBuilder.js.map +0 -1
- package/dist/test-helpers/DocCommentAnnotationBuilder.d.ts +0 -8
- package/dist/test-helpers/DocCommentAnnotationBuilder.js +0 -26
- package/dist/test-helpers/DocCommentAnnotationBuilder.js.map +0 -1
- package/dist/test-helpers/DocCommentBuilder.d.ts +0 -12
- package/dist/test-helpers/DocCommentBuilder.js +0 -38
- package/dist/test-helpers/DocCommentBuilder.js.map +0 -1
- package/dist/test-helpers/FieldMirrorBuilder.d.ts +0 -18
- package/dist/test-helpers/FieldMirrorBuilder.js +0 -54
- package/dist/test-helpers/FieldMirrorBuilder.js.map +0 -1
- package/dist/test-helpers/InterfaceMirrorBuilder.d.ts +0 -16
- package/dist/test-helpers/InterfaceMirrorBuilder.js +0 -43
- package/dist/test-helpers/InterfaceMirrorBuilder.js.map +0 -1
- package/dist/test-helpers/MethodMirrorBuilder.d.ts +0 -29
- package/dist/test-helpers/MethodMirrorBuilder.js +0 -72
- package/dist/test-helpers/MethodMirrorBuilder.js.map +0 -1
- package/dist/test-helpers/SettingsBuilder.d.ts +0 -8
- package/dist/test-helpers/SettingsBuilder.js +0 -28
- package/dist/test-helpers/SettingsBuilder.js.map +0 -1
- package/dist/transpiler/factory.d.ts +0 -6
- package/dist/transpiler/factory.js +0 -33
- package/dist/transpiler/factory.js.map +0 -1
- package/dist/transpiler/file-container.d.ts +0 -6
- package/dist/transpiler/file-container.js +0 -16
- package/dist/transpiler/file-container.js.map +0 -1
- package/dist/transpiler/generator-choices.d.ts +0 -1
- package/dist/transpiler/generator-choices.js +0 -3
- package/dist/transpiler/generator-choices.js.map +0 -1
- package/dist/transpiler/markdown/class-file-generatorHelper.d.ts +0 -9
- package/dist/transpiler/markdown/class-file-generatorHelper.js +0 -61
- package/dist/transpiler/markdown/class-file-generatorHelper.js.map +0 -1
- package/dist/transpiler/markdown/docsify/docsify-docs-processor.d.ts +0 -6
- package/dist/transpiler/markdown/docsify/docsify-docs-processor.js +0 -13
- package/dist/transpiler/markdown/docsify/docsify-docs-processor.js.map +0 -1
- package/dist/transpiler/markdown/jekyll/jekyll-docsProcessor.d.ts +0 -11
- package/dist/transpiler/markdown/jekyll/jekyll-docsProcessor.js +0 -51
- package/dist/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +0 -1
- package/dist/transpiler/markdown/markdown-transpiler-base.d.ts +0 -11
- package/dist/transpiler/markdown/markdown-transpiler-base.js +0 -27
- package/dist/transpiler/markdown/markdown-transpiler-base.js.map +0 -1
- package/dist/transpiler/markdown/plain-markdown/class-template.d.ts +0 -1
- package/dist/transpiler/markdown/plain-markdown/class-template.js +0 -77
- package/dist/transpiler/markdown/plain-markdown/class-template.js.map +0 -1
- package/dist/transpiler/markdown/plain-markdown/constructors-partial-template.d.ts +0 -1
- package/dist/transpiler/markdown/plain-markdown/constructors-partial-template.js +0 -36
- package/dist/transpiler/markdown/plain-markdown/constructors-partial-template.js.map +0 -1
- package/dist/transpiler/markdown/plain-markdown/documentable-partial-template.d.ts +0 -1
- package/dist/transpiler/markdown/plain-markdown/documentable-partial-template.js +0 -30
- package/dist/transpiler/markdown/plain-markdown/documentable-partial-template.js.map +0 -1
- package/dist/transpiler/markdown/plain-markdown/enum-template.d.ts +0 -1
- package/dist/transpiler/markdown/plain-markdown/enum-template.js +0 -16
- package/dist/transpiler/markdown/plain-markdown/enum-template.js.map +0 -1
- package/dist/transpiler/markdown/plain-markdown/fieldsPartialTemplate.d.ts +0 -1
- package/dist/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js +0 -27
- package/dist/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js.map +0 -1
- package/dist/transpiler/markdown/plain-markdown/grouped-members-partial-template.d.ts +0 -1
- package/dist/transpiler/markdown/plain-markdown/grouped-members-partial-template.js +0 -10
- package/dist/transpiler/markdown/plain-markdown/grouped-members-partial-template.js.map +0 -1
- package/dist/transpiler/markdown/plain-markdown/interface-template.d.ts +0 -1
- package/dist/transpiler/markdown/plain-markdown/interface-template.js +0 -20
- package/dist/transpiler/markdown/plain-markdown/interface-template.js.map +0 -1
- package/dist/transpiler/markdown/plain-markdown/methods-partial-template.d.ts +0 -1
- package/dist/transpiler/markdown/plain-markdown/methods-partial-template.js +0 -47
- package/dist/transpiler/markdown/plain-markdown/methods-partial-template.js.map +0 -1
- package/dist/transpiler/markdown/plain-markdown/type-doc-partial.d.ts +0 -1
- package/dist/transpiler/markdown/plain-markdown/type-doc-partial.js +0 -31
- package/dist/transpiler/markdown/plain-markdown/type-doc-partial.js.map +0 -1
- package/dist/transpiler/openapi/open-api-docs-processor.d.ts +0 -13
- package/dist/transpiler/openapi/open-api-docs-processor.js +0 -78
- package/dist/transpiler/openapi/open-api-docs-processor.js.map +0 -1
- package/dist/transpiler/openapi/parsers/Builder.d.ts +0 -16
- package/dist/transpiler/openapi/parsers/Builder.js +0 -30
- package/dist/transpiler/openapi/parsers/Builder.js.map +0 -1
- package/dist/transpiler/openapi/parsers/MethodParser.d.ts +0 -20
- package/dist/transpiler/openapi/parsers/MethodParser.js +0 -190
- package/dist/transpiler/openapi/parsers/MethodParser.js.map +0 -1
- package/dist/transpiler/openapi/parsers/ParameterObjectBuilder.d.ts +0 -7
- package/dist/transpiler/openapi/parsers/ParameterObjectBuilder.js +0 -11
- package/dist/transpiler/openapi/parsers/ParameterObjectBuilder.js.map +0 -1
- package/dist/transpiler/openapi/parsers/ReferenceBuilder.d.ts +0 -39
- package/dist/transpiler/openapi/parsers/ReferenceBuilder.js +0 -250
- package/dist/transpiler/openapi/parsers/ReferenceBuilder.js.map +0 -1
- package/dist/transpiler/openapi/parsers/RequestBodyBuilder.d.ts +0 -10
- package/dist/transpiler/openapi/parsers/RequestBodyBuilder.js +0 -20
- package/dist/transpiler/openapi/parsers/RequestBodyBuilder.js.map +0 -1
- package/dist/transpiler/openapi/parsers/ResponsesBuilder.d.ts +0 -7
- package/dist/transpiler/openapi/parsers/ResponsesBuilder.js +0 -22
- package/dist/transpiler/openapi/parsers/ResponsesBuilder.js.map +0 -1
- package/dist/transpiler/processor-type-transpiler.d.ts +0 -10
- package/dist/transpiler/processor-type-transpiler.js +0 -9
- package/dist/transpiler/processor-type-transpiler.js.map +0 -1
- package/dist/transpiler/transpiler.d.ts +0 -5
- package/dist/transpiler/transpiler.js +0 -30
- package/dist/transpiler/transpiler.js.map +0 -1
- package/dist/util/error-logger.d.ts +0 -8
- package/dist/util/error-logger.js +0 -90
- package/dist/util/error-logger.js.map +0 -1
- package/dist/util/logger.d.ts +0 -21
- package/dist/util/logger.js +0 -61
- package/dist/util/logger.js.map +0 -1
- package/dist/util/string-utils.d.ts +0 -2
- package/dist/util/string-utils.js +0 -15
- package/dist/util/string-utils.js.map +0 -1
- package/examples/plain-markdown/template.md +0 -3
- package/src/__spec__/core/generating-class-docs.spec.ts +0 -531
- package/src/__spec__/core/generating-reference-guide.spec.ts +0 -164
- package/src/__spec__/core/test-helpers.ts +0 -9
- package/src/application/generators/generate-markdown-files.ts +0 -53
- package/src/core/apex-bundle.ts +0 -3
- package/src/core/generate-docs.ts +0 -432
- package/src/model/markdown-file.ts +0 -122
- package/src/model/markdown-generation-util/doc-comment-annotation-util.ts +0 -50
- package/src/model/markdown-generation-util/field-declaration-util.ts +0 -71
- package/src/model/markdown-generation-util/index.ts +0 -3
- package/src/model/markdown-generation-util/method-declaration-util.ts +0 -166
- package/src/model/markdown-generation-util/type-declaration-util.ts +0 -91
- package/src/model/markdown-home-file.ts +0 -58
- package/src/model/markdown-type-file.ts +0 -169
- package/src/model/openapi/openapi-type-file.ts +0 -14
- package/src/model/outputFile.ts +0 -20
- package/src/service/__tests__/apex-file-reader.spec.ts +0 -93
- package/src/service/apex-file-reader.ts +0 -51
- package/src/service/file-writer.ts +0 -34
- package/src/service/metadata-processor.ts +0 -16
- package/src/service/state.ts +0 -24
- package/src/service/walkers/class-walker.ts +0 -30
- package/src/service/walkers/enum-walker.ts +0 -7
- package/src/service/walkers/interface-walker.ts +0 -12
- package/src/service/walkers/walker-factory.ts +0 -19
- package/src/service/walkers/walker.ts +0 -42
- package/src/settings.ts +0 -153
- package/src/transpiler/factory.ts +0 -31
- package/src/transpiler/file-container.ts +0 -13
- package/src/transpiler/generator-choices.ts +0 -1
- package/src/transpiler/markdown/class-file-generatorHelper.ts +0 -61
- package/src/transpiler/markdown/docsify/docsify-docs-processor.ts +0 -12
- package/src/transpiler/markdown/jekyll/jekyll-docsProcessor.ts +0 -50
- package/src/transpiler/markdown/markdown-transpiler-base.ts +0 -28
- package/src/transpiler/processor-type-transpiler.ts +0 -18
- /package/src/{service → application}/file-system.ts +0 -0
- /package/src/core/{inheritance-chain.ts → markdown/reflection/inheritance-chain.ts} +0 -0
- /package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/documentable-partial-template.ts +0 -0
- /package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/enum-template.ts +0 -0
- /package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/fieldsPartialTemplate.ts +0 -0
- /package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/grouped-members-partial-template.ts +0 -0
- /package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/interface-template.ts +0 -0
- /package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/methods-partial-template.ts +0 -0
- /package/src/core/{templates → markdown/templates}/reference-guide.ts +0 -0
- /package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/type-doc-partial.ts +0 -0
- /package/src/{service → core/openapi}/__tests__/manifest-factory.spec.ts +0 -0
- /package/src/{model → core}/openapi/__tests__/open-api.spec.ts +0 -0
- /package/src/{model → core}/openapi/apex-doc-types.ts +0 -0
- /package/src/{model → core/openapi}/apex-type-wrappers/ClassMirrorWrapper.ts +0 -0
- /package/src/{model → core/openapi}/apex-type-wrappers/MethodMirrorWrapper.ts +0 -0
- /package/src/{model → core}/openapi/open-api-types.ts +0 -0
- /package/src/{model → core}/openapi/open-api.ts +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SourceFile } from '../../shared/types';
|
|
2
|
+
import { generateDocs as gen, MarkdownGeneratorConfig } from '../generate-docs';
|
|
3
|
+
import { referenceGuideTemplate } from '../templates/reference-guide';
|
|
4
|
+
|
|
5
|
+
export function apexBundleFromRawString(raw: string, rawMetadata?: string): SourceFile {
|
|
6
|
+
return {
|
|
7
|
+
filePath: 'test.cls',
|
|
8
|
+
content: raw,
|
|
9
|
+
metadataContent: rawMetadata ?? null,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function generateDocs(apexBundles: SourceFile[], config?: Partial<MarkdownGeneratorConfig>) {
|
|
14
|
+
return gen(apexBundles, {
|
|
15
|
+
targetDir: 'target',
|
|
16
|
+
scope: ['global', 'public'],
|
|
17
|
+
defaultGroupName: 'Miscellaneous',
|
|
18
|
+
sortMembersAlphabetically: true,
|
|
19
|
+
referenceGuideTemplate: referenceGuideTemplate,
|
|
20
|
+
...config,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -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,23 +1,41 @@
|
|
|
1
1
|
import { typeToRenderable } from '../apex-types';
|
|
2
|
-
import { InterfaceMirrorBuilder } from '
|
|
3
|
-
import { AnnotationBuilder } from '
|
|
4
|
-
import { MethodMirrorBuilder, ParameterBuilder } from '
|
|
2
|
+
import { InterfaceMirrorBuilder } from '../../../../test-helpers/InterfaceMirrorBuilder';
|
|
3
|
+
import { AnnotationBuilder } from '../../../../test-helpers/AnnotationBuilder';
|
|
4
|
+
import { MethodMirrorBuilder, ParameterBuilder } from '../../../../test-helpers/MethodMirrorBuilder';
|
|
5
|
+
import { MarkdownGeneratorConfig } from '../../generate-docs';
|
|
5
6
|
|
|
6
7
|
function linkGenerator(type: string): string {
|
|
7
8
|
return type;
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
const defaultMarkdownGeneratorConfig: MarkdownGeneratorConfig = {
|
|
12
|
+
targetDir: '',
|
|
13
|
+
scope: ['global', 'public'],
|
|
14
|
+
namespace: '',
|
|
15
|
+
defaultGroupName: 'Miscellaneous',
|
|
16
|
+
referenceGuideTemplate: '',
|
|
17
|
+
sortMembersAlphabetically: false,
|
|
18
|
+
};
|
|
19
|
+
|
|
10
20
|
describe('Conversion from InterfaceMirror to InterfaceSource understandable by the templating engine', () => {
|
|
11
21
|
it('converts the name', () => {
|
|
12
22
|
const interfaceMirror = new InterfaceMirrorBuilder().withName('SampleInterface').build();
|
|
13
|
-
const interfaceSource = typeToRenderable(
|
|
23
|
+
const interfaceSource = typeToRenderable(
|
|
24
|
+
{ filePath: '', type: interfaceMirror },
|
|
25
|
+
linkGenerator,
|
|
26
|
+
defaultMarkdownGeneratorConfig,
|
|
27
|
+
);
|
|
14
28
|
|
|
15
29
|
expect(interfaceSource.name).toBe('SampleInterface');
|
|
16
30
|
});
|
|
17
31
|
|
|
18
32
|
it('converts the access modifier', () => {
|
|
19
33
|
const interfaceMirror = new InterfaceMirrorBuilder().build();
|
|
20
|
-
const interfaceSource = typeToRenderable(
|
|
34
|
+
const interfaceSource = typeToRenderable(
|
|
35
|
+
{ filePath: '', type: interfaceMirror },
|
|
36
|
+
linkGenerator,
|
|
37
|
+
defaultMarkdownGeneratorConfig,
|
|
38
|
+
);
|
|
21
39
|
|
|
22
40
|
expect(interfaceSource.meta.accessModifier).toBe('public');
|
|
23
41
|
});
|
|
@@ -26,7 +44,11 @@ describe('Conversion from InterfaceMirror to InterfaceSource understandable by t
|
|
|
26
44
|
const interfaceMirror = new InterfaceMirrorBuilder()
|
|
27
45
|
.addAnnotation(new AnnotationBuilder().withName('MyAnnotation').build())
|
|
28
46
|
.build();
|
|
29
|
-
const interfaceSource = typeToRenderable(
|
|
47
|
+
const interfaceSource = typeToRenderable(
|
|
48
|
+
{ filePath: '', type: interfaceMirror },
|
|
49
|
+
linkGenerator,
|
|
50
|
+
defaultMarkdownGeneratorConfig,
|
|
51
|
+
);
|
|
30
52
|
|
|
31
53
|
expect(interfaceSource.doc.annotations).toEqual(['MYANNOTATION']);
|
|
32
54
|
});
|
|
@@ -44,7 +66,11 @@ describe('Conversion from InterfaceMirror to InterfaceSource understandable by t
|
|
|
44
66
|
)
|
|
45
67
|
.build();
|
|
46
68
|
|
|
47
|
-
const interfaceSource = typeToRenderable(
|
|
69
|
+
const interfaceSource = typeToRenderable(
|
|
70
|
+
{ filePath: '', type: interfaceMirror },
|
|
71
|
+
linkGenerator,
|
|
72
|
+
defaultMarkdownGeneratorConfig,
|
|
73
|
+
);
|
|
48
74
|
|
|
49
75
|
expect(interfaceSource.methods.value).toHaveLength(1);
|
|
50
76
|
expect(interfaceSource.methods.value[0].signature.value.content[0]).toBe('public String sampleMethod()');
|
|
@@ -72,7 +98,11 @@ describe('Conversion from InterfaceMirror to InterfaceSource understandable by t
|
|
|
72
98
|
)
|
|
73
99
|
.build();
|
|
74
100
|
|
|
75
|
-
const interfaceSource = typeToRenderable(
|
|
101
|
+
const interfaceSource = typeToRenderable(
|
|
102
|
+
{ filePath: '', type: interfaceMirror },
|
|
103
|
+
linkGenerator,
|
|
104
|
+
defaultMarkdownGeneratorConfig,
|
|
105
|
+
);
|
|
76
106
|
|
|
77
107
|
expect(interfaceSource.methods.value).toHaveLength(1);
|
|
78
108
|
expect(interfaceSource.methods.value[0].signature.value.content[0]).toBe(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { replaceInlineReferences } from '../
|
|
1
|
+
import { replaceInlineReferences } from '../inline';
|
|
2
2
|
import { Link } from '../types';
|
|
3
3
|
|
|
4
4
|
function getFileLink(typeName: string): Link {
|
|
@@ -27,6 +27,17 @@ describe('reference utilities', () => {
|
|
|
27
27
|
expect(result).toEqual(expected);
|
|
28
28
|
});
|
|
29
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
|
+
|
|
30
41
|
describe('replace inline links', () => {
|
|
31
42
|
it('replaces links in the format of <<ClassName>>', () => {
|
|
32
43
|
const text = 'This is a test <<ClassName>>.';
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
ClassMirrorWithInheritanceChain,
|
|
10
10
|
FieldMirrorWithInheritance,
|
|
11
11
|
PropertyMirrorWithInheritance,
|
|
12
|
+
GetRenderableContentByTypeName,
|
|
12
13
|
} from './types';
|
|
13
14
|
import { adaptDescribable, adaptDocumentable } from './documentables';
|
|
14
|
-
import { GetRenderableContentByTypeName } from './references';
|
|
15
15
|
import { adaptConstructor, adaptMethod } from './methods-and-constructors';
|
|
16
16
|
import { adaptFieldOrProperty } from './fields-and-properties';
|
|
17
|
+
import { MarkdownGeneratorConfig } from '../generate-docs';
|
|
17
18
|
|
|
18
19
|
type GetReturnRenderable<T extends Type> = T extends InterfaceMirror
|
|
19
20
|
? RenderableInterface
|
|
@@ -22,11 +23,12 @@ type GetReturnRenderable<T extends Type> = T extends InterfaceMirror
|
|
|
22
23
|
: RenderableEnum;
|
|
23
24
|
|
|
24
25
|
export function typeToRenderable<T extends Type>(
|
|
25
|
-
type: T,
|
|
26
|
+
parsedFile: { filePath: string; type: T },
|
|
26
27
|
linkGenerator: GetRenderableContentByTypeName,
|
|
27
|
-
|
|
28
|
-
): GetReturnRenderable<T> {
|
|
28
|
+
config: MarkdownGeneratorConfig,
|
|
29
|
+
): GetReturnRenderable<T> & { filePath: string; namespace?: string } {
|
|
29
30
|
function getRenderable(): RenderableInterface | RenderableClass | RenderableEnum {
|
|
31
|
+
const { type } = parsedFile;
|
|
30
32
|
switch (type.type_name) {
|
|
31
33
|
case 'enum':
|
|
32
34
|
return enumTypeToEnumSource(type as EnumMirror, linkGenerator) as RenderableEnum;
|
|
@@ -39,7 +41,8 @@ export function typeToRenderable<T extends Type>(
|
|
|
39
41
|
|
|
40
42
|
return {
|
|
41
43
|
...(getRenderable() as GetReturnRenderable<T>),
|
|
42
|
-
|
|
44
|
+
filePath: parsedFile.filePath,
|
|
45
|
+
namespace: config.namespace,
|
|
43
46
|
};
|
|
44
47
|
}
|
|
45
48
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomTag, RenderableDocumentation, RenderableContent, CodeBlock } from './types';
|
|
2
|
-
import { Describable, Documentable } from './types';
|
|
3
|
-
import {
|
|
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(
|
|
@@ -32,7 +32,6 @@ export function adaptDescribable(
|
|
|
32
32
|
codeBlockLines.push(currentLine);
|
|
33
33
|
i++;
|
|
34
34
|
}
|
|
35
|
-
console.log('codeBlockLines', codeBlockLines);
|
|
36
35
|
content = [
|
|
37
36
|
...content,
|
|
38
37
|
{
|
|
@@ -55,68 +54,9 @@ export function adaptDescribable(
|
|
|
55
54
|
}
|
|
56
55
|
return (
|
|
57
56
|
content
|
|
58
|
-
.flatMap((line) => line)
|
|
59
57
|
// If the last element is an empty line, remove it
|
|
60
58
|
.filter((line, index, lines) => !(isEmptyLine(line) && index === lines.length - 1))
|
|
61
59
|
);
|
|
62
|
-
|
|
63
|
-
// TODO: Now we want to also extract code blocks if we encounter any line that starts with "```"
|
|
64
|
-
|
|
65
|
-
// return describable.reduce<RenderableContent[]>(
|
|
66
|
-
// (acc, line) => {
|
|
67
|
-
// if (line.trim() === '') {
|
|
68
|
-
// return [...acc, { __type: 'empty-line' }];
|
|
69
|
-
// }
|
|
70
|
-
//
|
|
71
|
-
// // The language might or might not be present after ```
|
|
72
|
-
// const codeBlockMatch = line.match(/^```([a-zA-Z]*)$/);
|
|
73
|
-
// if (codeBlockMatch) {
|
|
74
|
-
// console.log('codeBlockMatch', codeBlockMatch);
|
|
75
|
-
// // Check if the language is present, if not, fallback to "apex"
|
|
76
|
-
// const language = codeBlockMatch[1] || 'apex';
|
|
77
|
-
// const codeBlockLines: string[] = [];
|
|
78
|
-
// let index = acc.length + 1;
|
|
79
|
-
// while (index < describable.length) {
|
|
80
|
-
// const currentLine = describable[index];
|
|
81
|
-
// if (currentLine.trim() === '```') {
|
|
82
|
-
// break;
|
|
83
|
-
// }
|
|
84
|
-
// codeBlockLines.push(currentLine);
|
|
85
|
-
// index++;
|
|
86
|
-
// }
|
|
87
|
-
// return [
|
|
88
|
-
// ...acc,
|
|
89
|
-
// {
|
|
90
|
-
// __type: 'code-block',
|
|
91
|
-
// language,
|
|
92
|
-
// content: codeBlockLines,
|
|
93
|
-
// },
|
|
94
|
-
// ];
|
|
95
|
-
// }
|
|
96
|
-
//
|
|
97
|
-
// return [
|
|
98
|
-
// ...acc,
|
|
99
|
-
// ...replaceInlineReferences(line, linkGenerator),
|
|
100
|
-
// {
|
|
101
|
-
// __type: 'empty-line',
|
|
102
|
-
// },
|
|
103
|
-
// ];
|
|
104
|
-
// },
|
|
105
|
-
// <RenderableContent[]>[],
|
|
106
|
-
// );
|
|
107
|
-
|
|
108
|
-
// return (
|
|
109
|
-
// describable
|
|
110
|
-
// .map<RenderableContent[]>((line) => [
|
|
111
|
-
// ...replaceInlineReferences(line, linkGenerator),
|
|
112
|
-
// {
|
|
113
|
-
// __type: 'empty-line',
|
|
114
|
-
// },
|
|
115
|
-
// ])
|
|
116
|
-
// .flatMap((line) => line)
|
|
117
|
-
// // If the last element is an empty line, remove it
|
|
118
|
-
// .filter((line, index, lines) => !(isEmptyLine(line) && index === lines.length - 1))
|
|
119
|
-
// );
|
|
120
60
|
}
|
|
121
61
|
|
|
122
62
|
return {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CodeBlock,
|
|
3
|
+
FieldMirrorWithInheritance,
|
|
4
|
+
PropertyMirrorWithInheritance,
|
|
5
|
+
RenderableField,
|
|
6
|
+
GetRenderableContentByTypeName,
|
|
7
|
+
} from './types';
|
|
2
8
|
import { adaptDocumentable } from './documentables';
|
|
3
|
-
import { GetRenderableContentByTypeName } from './references';
|
|
4
9
|
|
|
5
10
|
export function adaptFieldOrProperty(
|
|
6
11
|
field: FieldMirrorWithInheritance | PropertyMirrorWithInheritance,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { Link, RenderableContent
|
|
1
|
+
import { InlineCode, Link, RenderableContent } from './types';
|
|
2
|
+
import { pipe } from 'fp-ts/function';
|
|
3
|
+
import { apply } from '#utils/fp';
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
type InlineRenderableContent = InlineCode | Link | string;
|
|
6
|
+
|
|
7
|
+
type ToInlineRenderableContent = (typeName: string) => InlineRenderableContent;
|
|
4
8
|
|
|
5
9
|
function defaultGetEmailByReference(email: string): Link {
|
|
6
10
|
return {
|
|
@@ -12,22 +16,51 @@ function defaultGetEmailByReference(email: string): Link {
|
|
|
12
16
|
|
|
13
17
|
export function replaceInlineReferences(
|
|
14
18
|
text: string,
|
|
15
|
-
linkReplacer:
|
|
16
|
-
emailReplacer:
|
|
19
|
+
linkReplacer: ToInlineRenderableContent,
|
|
20
|
+
emailReplacer: ToInlineRenderableContent = defaultGetEmailByReference,
|
|
17
21
|
): RenderableContent[] {
|
|
18
|
-
|
|
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);
|
|
19
52
|
}
|
|
20
53
|
|
|
21
54
|
function replaceInlineLinks(
|
|
55
|
+
getLinkByTypeName: ToInlineRenderableContent,
|
|
22
56
|
renderableContents: RenderableContent[],
|
|
23
|
-
getLinkByTypeName: GetRenderableContentByTypeName,
|
|
24
57
|
): RenderableContent[] {
|
|
25
58
|
return renderableContents.flatMap((renderableContent) => inlineLinkContent(renderableContent, getLinkByTypeName));
|
|
26
59
|
}
|
|
27
60
|
|
|
28
61
|
function inlineLinkContent(
|
|
29
62
|
renderableContent: RenderableContent,
|
|
30
|
-
getLinkByTypeName:
|
|
63
|
+
getLinkByTypeName: ToInlineRenderableContent,
|
|
31
64
|
): RenderableContent[] {
|
|
32
65
|
if (typeof renderableContent !== 'string') {
|
|
33
66
|
return [renderableContent];
|
|
@@ -42,15 +75,15 @@ function inlineLinkContent(
|
|
|
42
75
|
}
|
|
43
76
|
|
|
44
77
|
export function replaceInlineEmails(
|
|
78
|
+
getLinkByTypeName: ToInlineRenderableContent,
|
|
45
79
|
renderableContents: RenderableContent[],
|
|
46
|
-
getLinkByTypeName: GetRenderableContentByTypeName,
|
|
47
80
|
): RenderableContent[] {
|
|
48
81
|
return renderableContents.flatMap((renderableContent) => inlineEmailContent(renderableContent, getLinkByTypeName));
|
|
49
82
|
}
|
|
50
83
|
|
|
51
84
|
function inlineEmailContent(
|
|
52
85
|
renderableContent: RenderableContent,
|
|
53
|
-
getLinkByTypeName:
|
|
86
|
+
getLinkByTypeName: ToInlineRenderableContent,
|
|
54
87
|
): RenderableContent[] {
|
|
55
88
|
if (typeof renderableContent !== 'string') {
|
|
56
89
|
return [renderableContent];
|
|
@@ -79,7 +112,7 @@ function match(regex: string, text: string) {
|
|
|
79
112
|
return matches;
|
|
80
113
|
}
|
|
81
114
|
|
|
82
|
-
function createRenderableContents(matches: RegExpExecArray[], text: string, linker:
|
|
115
|
+
function createRenderableContents(matches: RegExpExecArray[], text: string, linker: ToInlineRenderableContent) {
|
|
83
116
|
if (matches.length === 0) {
|
|
84
117
|
return [text];
|
|
85
118
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { ConstructorMirror, MethodMirror, ParameterMirror, ThrowsAnnotation } from '@cparra/apex-reflection';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
RenderableConstructor,
|
|
4
|
+
RenderableMethod,
|
|
5
|
+
MethodMirrorWithInheritance,
|
|
6
|
+
CodeBlock,
|
|
7
|
+
GetRenderableContentByTypeName,
|
|
8
|
+
} from './types';
|
|
3
9
|
import { adaptDescribable, adaptDocumentable } from './documentables';
|
|
4
|
-
import { GetRenderableContentByTypeName } from './references';
|
|
5
10
|
import { Documentable } from './types';
|
|
6
11
|
|
|
7
12
|
export function adaptMethod(
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { ParsedFile } from '../../shared/types';
|
|
2
|
+
import { Link, RenderableBundle, StringOrLink } from './types';
|
|
3
|
+
import { typeToRenderable } from './apex-types';
|
|
4
|
+
import { adaptDescribable } from './documentables';
|
|
5
|
+
import { Type } from '@cparra/apex-reflection';
|
|
6
|
+
import { MarkdownGeneratorConfig } from '../generate-docs';
|
|
7
|
+
|
|
8
|
+
export function parsedFilesToRenderableBundle(
|
|
9
|
+
config: MarkdownGeneratorConfig,
|
|
10
|
+
parsedFiles: ParsedFile[],
|
|
11
|
+
): RenderableBundle {
|
|
12
|
+
return parsedFiles.reduce<RenderableBundle>(
|
|
13
|
+
(acc, parsedFile) => {
|
|
14
|
+
const renderable = typeToRenderable(
|
|
15
|
+
parsedFile,
|
|
16
|
+
(referenceName) => {
|
|
17
|
+
return linkFromTypeNameGenerator(
|
|
18
|
+
parsedFile.type,
|
|
19
|
+
parsedFiles.map((file) => file.type),
|
|
20
|
+
referenceName,
|
|
21
|
+
config,
|
|
22
|
+
);
|
|
23
|
+
},
|
|
24
|
+
config,
|
|
25
|
+
);
|
|
26
|
+
acc.renderables.push(renderable);
|
|
27
|
+
|
|
28
|
+
const descriptionLines = parsedFile.type.docComment?.descriptionLines;
|
|
29
|
+
const reference = {
|
|
30
|
+
typeName: parsedFile.type.name,
|
|
31
|
+
directory: getDirectoryFromRoot(config, parsedFile.type),
|
|
32
|
+
title: getLinkFromRoot(config, parsedFile.type),
|
|
33
|
+
description: adaptDescribable(descriptionLines, (referenceName) =>
|
|
34
|
+
getPossibleLinkFromRoot(
|
|
35
|
+
config,
|
|
36
|
+
referenceName,
|
|
37
|
+
findType(
|
|
38
|
+
parsedFiles.map((file) => file.type),
|
|
39
|
+
referenceName,
|
|
40
|
+
),
|
|
41
|
+
),
|
|
42
|
+
).description,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const group = getTypeGroup(parsedFile.type, config);
|
|
46
|
+
if (!acc.references[group]) {
|
|
47
|
+
acc.references[group] = [];
|
|
48
|
+
}
|
|
49
|
+
acc.references[group].push(reference);
|
|
50
|
+
|
|
51
|
+
return acc;
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
references: {},
|
|
55
|
+
renderables: [],
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function linkFromTypeNameGenerator(
|
|
61
|
+
typeBeingDocumented: Type,
|
|
62
|
+
repository: Type[],
|
|
63
|
+
referenceName: string,
|
|
64
|
+
config: MarkdownGeneratorConfig,
|
|
65
|
+
): StringOrLink {
|
|
66
|
+
const type = findType(repository, referenceName);
|
|
67
|
+
if (!type) {
|
|
68
|
+
// If the type is not found, we return the type name as a string.
|
|
69
|
+
return referenceName;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const [fullClassName, fileLink] = getFileLinkTuple(typeBeingDocumented, type, config);
|
|
73
|
+
return {
|
|
74
|
+
__type: 'link',
|
|
75
|
+
title: fullClassName,
|
|
76
|
+
url: fileLink,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getPossibleLinkFromRoot(config: MarkdownGeneratorConfig, fallback: string, type?: Type): StringOrLink {
|
|
81
|
+
if (!type) {
|
|
82
|
+
return fallback;
|
|
83
|
+
}
|
|
84
|
+
const namespacePrefix = config.namespace ? `${config.namespace}.` : '';
|
|
85
|
+
const title = `${namespacePrefix}${type.name}`;
|
|
86
|
+
return {
|
|
87
|
+
__type: 'link',
|
|
88
|
+
title: title,
|
|
89
|
+
url: `${getDirectoryFromRoot(config, type)}/${title}.md`,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function getDirectoryFromRoot(config: MarkdownGeneratorConfig, type?: Type): string {
|
|
94
|
+
if (!type) {
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
return `./${getSanitizedGroup(type, config)}`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function findType(repository: Type[], referenceName: string) {
|
|
101
|
+
return repository.find((currentType: Type) => currentType.name.toLowerCase() === referenceName.toLowerCase());
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function getFileLinkTuple(
|
|
105
|
+
typeBeingDocumented: Type,
|
|
106
|
+
referencedType: Type,
|
|
107
|
+
config: MarkdownGeneratorConfig,
|
|
108
|
+
): [string, string] {
|
|
109
|
+
const namespacePrefix = config.namespace ? `${config.namespace}.` : '';
|
|
110
|
+
const directoryRoot = `${getDirectoryRoot(typeBeingDocumented, referencedType, config)}`;
|
|
111
|
+
// TODO: Instead of adding a "." to the name when there is a namespace, maybe we want to create a folder for everything
|
|
112
|
+
// within that namespace and put the files in there.
|
|
113
|
+
const fullClassName = `${namespacePrefix}${referencedType.name}`;
|
|
114
|
+
return [fullClassName, `${directoryRoot}${fullClassName}.md`];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function getDirectoryRoot(typeBeingDocumented: Type, referencedType: Type, config: MarkdownGeneratorConfig) {
|
|
118
|
+
if (getTypeGroup(typeBeingDocumented, config) === getTypeGroup(referencedType, config)) {
|
|
119
|
+
// If the types the same groups then we simply link directly to that file
|
|
120
|
+
return './';
|
|
121
|
+
} else {
|
|
122
|
+
// If the types have different groups, then we have to go up a directory
|
|
123
|
+
return `../${getSanitizedGroup(referencedType, config)}/`;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function getTypeGroup(type: Type, config: MarkdownGeneratorConfig): string {
|
|
128
|
+
const groupAnnotation = type.docComment?.annotations.find((annotation) => annotation.name.toLowerCase() === 'group');
|
|
129
|
+
return groupAnnotation?.body ?? config.defaultGroupName;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function getSanitizedGroup(classModel: Type, config: MarkdownGeneratorConfig) {
|
|
133
|
+
return getTypeGroup(classModel, config).replace(/ /g, '-').replace('.', '');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function getLinkFromRoot(config: MarkdownGeneratorConfig, type: Type): Link {
|
|
137
|
+
const namespacePrefix = config.namespace ? `${config.namespace}.` : '';
|
|
138
|
+
const title = `${namespacePrefix}${type.name}`;
|
|
139
|
+
return {
|
|
140
|
+
__type: 'link',
|
|
141
|
+
title: title,
|
|
142
|
+
url: `${getDirectoryFromRoot(config, type)}/${title}.md`,
|
|
143
|
+
};
|
|
144
|
+
}
|