@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
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Settings } from '../settings';
|
|
2
|
-
import { FileSystem } from './file-system';
|
|
3
|
-
import ApexBundle from '../core/apex-bundle';
|
|
4
|
-
|
|
5
|
-
const APEX_FILE_EXTENSION = '.cls';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Reads from .cls files and returns their raw body.
|
|
9
|
-
*/
|
|
10
|
-
export class ApexFileReader {
|
|
11
|
-
/**
|
|
12
|
-
* Reads from .cls files and returns their raw body.
|
|
13
|
-
*/
|
|
14
|
-
static processFiles(fileSystem: FileSystem, rootPath: string = this.sourceDirectory): ApexBundle[] {
|
|
15
|
-
let bundles: ApexBundle[] = [];
|
|
16
|
-
|
|
17
|
-
const directoryContents = fileSystem.readDirectory(rootPath);
|
|
18
|
-
directoryContents.forEach((currentFilePath) => {
|
|
19
|
-
const currentPath = fileSystem.joinPath(rootPath, currentFilePath);
|
|
20
|
-
if (this.readRecursively && fileSystem.isDirectory(currentPath)) {
|
|
21
|
-
bundles = bundles.concat(this.processFiles(fileSystem, currentPath));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (!this.isApexFile(currentFilePath)) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const rawApexFile = fileSystem.readFile(currentPath);
|
|
29
|
-
const metadataPath = fileSystem.joinPath(rootPath, `${currentFilePath}-meta.xml`);
|
|
30
|
-
let rawMetadataFile = null;
|
|
31
|
-
if (Settings.getInstance().includeMetadata()) {
|
|
32
|
-
rawMetadataFile = fileSystem.exists(metadataPath) ? fileSystem.readFile(metadataPath) : null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
bundles.push(new ApexBundle(currentFilePath, rawApexFile, rawMetadataFile));
|
|
36
|
-
});
|
|
37
|
-
return bundles;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
private static isApexFile(currentFile: string): boolean {
|
|
41
|
-
return currentFile.endsWith(APEX_FILE_EXTENSION);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private static get sourceDirectory() {
|
|
45
|
-
return Settings.getInstance().sourceDirectory;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
private static get readRecursively() {
|
|
49
|
-
return Settings.getInstance().recursive;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { OutputFile } from '../model/outputFile';
|
|
4
|
-
import { OnBeforeFileWrite, Settings, TargetFile } from '../settings';
|
|
5
|
-
|
|
6
|
-
export class FileWriter {
|
|
7
|
-
static write(files: OutputFile[], onWriteCallback: (file: TargetFile) => void) {
|
|
8
|
-
const onBeforeFileWrite: OnBeforeFileWrite = (file: TargetFile) => Settings.getInstance().onBeforeFileWrite(file);
|
|
9
|
-
files.forEach((file) => {
|
|
10
|
-
const resolvedFile = this.getTargetLocation(file, onBeforeFileWrite);
|
|
11
|
-
const fullDir = path.join(resolvedFile.dir.baseDir, resolvedFile.dir.fileDir);
|
|
12
|
-
if (!fs.existsSync(fullDir)) {
|
|
13
|
-
fs.mkdirSync(fullDir, { recursive: true });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const filePath = path.join(fullDir, `${resolvedFile.name}${resolvedFile.extension}`);
|
|
17
|
-
fs.writeFileSync(filePath, file.body, 'utf8');
|
|
18
|
-
onWriteCallback(resolvedFile);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
private static getTargetLocation(file: OutputFile, onBeforeFileWrite: OnBeforeFileWrite): TargetFile {
|
|
23
|
-
const targetFile: TargetFile = {
|
|
24
|
-
name: file.fileName,
|
|
25
|
-
extension: file.fileExtension(),
|
|
26
|
-
dir: {
|
|
27
|
-
baseDir: Settings.getInstance().outputDir,
|
|
28
|
-
fileDir: file.dir,
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return onBeforeFileWrite(targetFile);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { XMLParser } from 'fast-xml-parser';
|
|
2
|
-
|
|
3
|
-
export default class MetadataProcessor {
|
|
4
|
-
public static process(input: string) {
|
|
5
|
-
const map = new Map<string, string>();
|
|
6
|
-
const xml = new XMLParser().parse(input);
|
|
7
|
-
|
|
8
|
-
map.set('apiVersion', xml.ApexClass.apiVersion ?? '');
|
|
9
|
-
|
|
10
|
-
if (xml.ApexClass.status) {
|
|
11
|
-
map.set('status', xml.ApexClass.status);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return map;
|
|
15
|
-
}
|
|
16
|
-
}
|
package/src/service/state.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Type } from '@cparra/apex-reflection';
|
|
2
|
-
|
|
3
|
-
export default class State {
|
|
4
|
-
private static instance: State;
|
|
5
|
-
private typeBeingProcessed?: Type;
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
8
|
-
private constructor() {}
|
|
9
|
-
|
|
10
|
-
public static getInstance(): State {
|
|
11
|
-
if (!State.instance) {
|
|
12
|
-
State.instance = new State();
|
|
13
|
-
}
|
|
14
|
-
return State.instance;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public setTypeBeingProcessed(typeToSet: Type): void {
|
|
18
|
-
this.typeBeingProcessed = typeToSet;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public getTypeBeingProcessed(): Type | undefined {
|
|
22
|
-
return this.typeBeingProcessed;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Walker, WalkerListener } from './walker';
|
|
2
|
-
import { ClassMirror } from '@cparra/apex-reflection';
|
|
3
|
-
|
|
4
|
-
export class ClassWalker extends Walker {
|
|
5
|
-
walk(listener: WalkerListener): void {
|
|
6
|
-
listener.onTypeDeclaration(this.type);
|
|
7
|
-
const classMirror = this.type as ClassMirror;
|
|
8
|
-
if (classMirror.constructors.length) {
|
|
9
|
-
listener.onConstructorDeclaration(this.type.name, classMirror.constructors);
|
|
10
|
-
}
|
|
11
|
-
if (classMirror.fields.length) {
|
|
12
|
-
listener.onFieldsDeclaration(this.sortType(classMirror.fields));
|
|
13
|
-
}
|
|
14
|
-
if (classMirror.properties.length) {
|
|
15
|
-
listener.onPropertiesDeclaration(this.sortType(classMirror.properties));
|
|
16
|
-
}
|
|
17
|
-
if (classMirror.methods.length) {
|
|
18
|
-
listener.onMethodsDeclaration(this.sortType(classMirror.methods));
|
|
19
|
-
}
|
|
20
|
-
if (classMirror.enums.length) {
|
|
21
|
-
listener.onInnerEnumsDeclaration(this.sortType(classMirror.enums));
|
|
22
|
-
}
|
|
23
|
-
if (classMirror.classes.length) {
|
|
24
|
-
listener.onInnerClassesDeclaration(this.sortType(classMirror.classes));
|
|
25
|
-
}
|
|
26
|
-
if (classMirror.interfaces.length) {
|
|
27
|
-
listener.onInnerInterfacesDeclaration(this.sortType(classMirror.interfaces));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Walker, WalkerListener } from './walker';
|
|
2
|
-
import { InterfaceMirror } from '@cparra/apex-reflection';
|
|
3
|
-
|
|
4
|
-
export class InterfaceWalker extends Walker {
|
|
5
|
-
walk(listener: WalkerListener): void {
|
|
6
|
-
listener.onTypeDeclaration(this.type);
|
|
7
|
-
const interfaceMirror = this.type as InterfaceMirror;
|
|
8
|
-
if (interfaceMirror.methods.length) {
|
|
9
|
-
listener.onMethodsDeclaration(this.sortType(interfaceMirror.methods));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Type } from '@cparra/apex-reflection';
|
|
2
|
-
import { Walker } from './walker';
|
|
3
|
-
import { ClassWalker } from './class-walker';
|
|
4
|
-
import { EnumWalker } from './enum-walker';
|
|
5
|
-
import { InterfaceWalker } from './interface-walker';
|
|
6
|
-
|
|
7
|
-
export class WalkerFactory {
|
|
8
|
-
static get(type: Type): Walker {
|
|
9
|
-
switch (type.type_name) {
|
|
10
|
-
case 'class':
|
|
11
|
-
return new ClassWalker(type);
|
|
12
|
-
case 'enum':
|
|
13
|
-
return new EnumWalker(type);
|
|
14
|
-
case 'interface':
|
|
15
|
-
return new InterfaceWalker(type);
|
|
16
|
-
}
|
|
17
|
-
throw Error('Walker not found for type.');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClassMirror,
|
|
3
|
-
ConstructorMirror,
|
|
4
|
-
EnumMirror,
|
|
5
|
-
FieldMirror,
|
|
6
|
-
InterfaceMirror,
|
|
7
|
-
MethodMirror,
|
|
8
|
-
PropertyMirror,
|
|
9
|
-
Type,
|
|
10
|
-
} from '@cparra/apex-reflection';
|
|
11
|
-
import { Settings } from '../../settings';
|
|
12
|
-
|
|
13
|
-
export interface WalkerListener {
|
|
14
|
-
onTypeDeclaration(typeMirror: Type): void;
|
|
15
|
-
|
|
16
|
-
onConstructorDeclaration(className: string, constructors: ConstructorMirror[]): void;
|
|
17
|
-
|
|
18
|
-
onFieldsDeclaration(fields: FieldMirror[]): void;
|
|
19
|
-
|
|
20
|
-
onPropertiesDeclaration(properties: PropertyMirror[]): void;
|
|
21
|
-
|
|
22
|
-
onMethodsDeclaration(methods: MethodMirror[]): void;
|
|
23
|
-
|
|
24
|
-
onInnerEnumsDeclaration(enums: EnumMirror[]): void;
|
|
25
|
-
|
|
26
|
-
onInnerClassesDeclaration(classes: ClassMirror[]): void;
|
|
27
|
-
|
|
28
|
-
onInnerInterfacesDeclaration(interfaces: InterfaceMirror[]): void;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export abstract class Walker {
|
|
32
|
-
constructor(public type: Type) {}
|
|
33
|
-
|
|
34
|
-
abstract walk(listener: WalkerListener): void;
|
|
35
|
-
|
|
36
|
-
protected sortType<T extends { name: string }>(types: T[]): T[] {
|
|
37
|
-
if (Settings.getInstance().sortMembersAlphabetically()) {
|
|
38
|
-
return types.sort((a, b) => a.name.localeCompare(b.name));
|
|
39
|
-
}
|
|
40
|
-
return types;
|
|
41
|
-
}
|
|
42
|
-
}
|
package/src/settings.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { GeneratorChoices } from './transpiler/generator-choices';
|
|
2
|
-
import { LinkingStrategy } from './transpiler/processor-type-transpiler';
|
|
3
|
-
|
|
4
|
-
export type OnBeforeFileWrite = (file: TargetFile) => TargetFile;
|
|
5
|
-
|
|
6
|
-
export type TargetFile = {
|
|
7
|
-
name: string;
|
|
8
|
-
extension: string;
|
|
9
|
-
dir: OutputDir;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type OutputDir = {
|
|
13
|
-
baseDir: string;
|
|
14
|
-
fileDir: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type TargetType = {
|
|
18
|
-
name: string;
|
|
19
|
-
typeName: 'class' | 'interface' | 'enum';
|
|
20
|
-
accessModifier: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
group?: string;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export interface SettingsConfig {
|
|
26
|
-
sourceDirectory: string;
|
|
27
|
-
recursive: boolean;
|
|
28
|
-
scope: string[];
|
|
29
|
-
outputDir: string;
|
|
30
|
-
targetGenerator: GeneratorChoices;
|
|
31
|
-
indexOnly: boolean;
|
|
32
|
-
defaultGroupName: string;
|
|
33
|
-
sanitizeHtml: boolean;
|
|
34
|
-
openApiTitle?: string;
|
|
35
|
-
title: string;
|
|
36
|
-
namespace?: string;
|
|
37
|
-
openApiFileName: string;
|
|
38
|
-
includeMetadata: boolean;
|
|
39
|
-
rootDir?: string;
|
|
40
|
-
sortMembersAlphabetically?: boolean;
|
|
41
|
-
onAfterProcess?: (files: TargetFile[]) => void;
|
|
42
|
-
onBeforeFileWrite?: (file: TargetFile) => TargetFile;
|
|
43
|
-
frontMatterHeader?: (file: TargetType) => string[];
|
|
44
|
-
linkingStrategy: LinkingStrategy;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export class Settings {
|
|
48
|
-
private static instance: Settings;
|
|
49
|
-
|
|
50
|
-
private constructor(public config: SettingsConfig) {}
|
|
51
|
-
|
|
52
|
-
public static build(config: SettingsConfig) {
|
|
53
|
-
Settings.instance = new Settings(config);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public static getInstance(): Settings {
|
|
57
|
-
if (!Settings.instance) {
|
|
58
|
-
throw new Error('Settings has not been initialized');
|
|
59
|
-
}
|
|
60
|
-
return Settings.instance;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
get sourceDirectory(): string {
|
|
64
|
-
return this.config.sourceDirectory;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
get recursive(): boolean {
|
|
68
|
-
return this.config.recursive;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
get scope(): string[] {
|
|
72
|
-
return this.config.scope;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
get outputDir(): string {
|
|
76
|
-
return this.config.outputDir;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
get targetGenerator(): GeneratorChoices {
|
|
80
|
-
return this.config.targetGenerator;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
get indexOnly(): boolean {
|
|
84
|
-
return this.config.indexOnly;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get sanitizeHtml(): boolean {
|
|
88
|
-
return this.config.sanitizeHtml;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
public getDefaultGroupName(): string {
|
|
92
|
-
return this.config.defaultGroupName;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
public getOpenApiTitle(): string | undefined {
|
|
96
|
-
return this.config.openApiTitle ?? this.config.title;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public getTitle(): string {
|
|
100
|
-
return this.config.title;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
public getNamespace(): string | undefined {
|
|
104
|
-
return this.config.namespace;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
public getNamespacePrefix(): string {
|
|
108
|
-
if (!this.config.namespace) {
|
|
109
|
-
return '';
|
|
110
|
-
}
|
|
111
|
-
return `${this.config.namespace}.`;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public openApiFileName(): string {
|
|
115
|
-
return this.config.openApiFileName;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public includeMetadata(): boolean {
|
|
119
|
-
return this.config.includeMetadata;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public sortMembersAlphabetically(): boolean {
|
|
123
|
-
return this.config.sortMembersAlphabetically ?? false;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
public getRootDir(): string | undefined {
|
|
127
|
-
return this.config.rootDir;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public onAfterProcess(files: TargetFile[]): void {
|
|
131
|
-
if (this.config.onAfterProcess) {
|
|
132
|
-
this.config.onAfterProcess(files);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
public onBeforeFileWrite(file: TargetFile): TargetFile {
|
|
137
|
-
if (this.config.onBeforeFileWrite) {
|
|
138
|
-
return this.config.onBeforeFileWrite(file);
|
|
139
|
-
}
|
|
140
|
-
return file;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
public frontMatterHeader(file: TargetType): string[] {
|
|
144
|
-
if (this.config.frontMatterHeader) {
|
|
145
|
-
return this.config.frontMatterHeader(file);
|
|
146
|
-
}
|
|
147
|
-
return [];
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
public getLinkingStrategy(): LinkingStrategy {
|
|
151
|
-
return this.config.linkingStrategy;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import ProcessorTypeTranspiler from './processor-type-transpiler';
|
|
2
|
-
import { GeneratorChoices } from './generator-choices';
|
|
3
|
-
import { JekyllDocsProcessor } from './markdown/jekyll/jekyll-docsProcessor';
|
|
4
|
-
import DocsifyDocsProcessor from './markdown/docsify/docsify-docs-processor';
|
|
5
|
-
import { OpenApiDocsProcessor } from './openapi/open-api-docs-processor';
|
|
6
|
-
|
|
7
|
-
export class TypeTranspilerFactory {
|
|
8
|
-
private static typeTranspilerCache?: ProcessorTypeTranspiler;
|
|
9
|
-
|
|
10
|
-
public static get(generator: GeneratorChoices): ProcessorTypeTranspiler {
|
|
11
|
-
if (this.typeTranspilerCache) {
|
|
12
|
-
return this.typeTranspilerCache;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
switch (generator) {
|
|
16
|
-
case 'jekyll':
|
|
17
|
-
this.typeTranspilerCache = new JekyllDocsProcessor();
|
|
18
|
-
return this.typeTranspilerCache;
|
|
19
|
-
case 'docsify':
|
|
20
|
-
this.typeTranspilerCache = new DocsifyDocsProcessor();
|
|
21
|
-
return this.typeTranspilerCache;
|
|
22
|
-
case 'openapi':
|
|
23
|
-
this.typeTranspilerCache = new OpenApiDocsProcessor();
|
|
24
|
-
return this.typeTranspilerCache;
|
|
25
|
-
case 'plain-markdown':
|
|
26
|
-
throw Error('Plain Markdown processor is not supported through this factory anymore.');
|
|
27
|
-
default:
|
|
28
|
-
throw Error('Invalid target generator');
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type GeneratorChoices = 'jekyll' | 'docsify' | 'plain-markdown' | 'openapi';
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Type } from '@cparra/apex-reflection';
|
|
2
|
-
import { TypesRepository } from '../../model/types-repository';
|
|
3
|
-
import { Settings } from '../../settings';
|
|
4
|
-
import State from '../../service/state';
|
|
5
|
-
|
|
6
|
-
export default class ClassFileGeneratorHelper {
|
|
7
|
-
public static getSanitizedGroup(classModel: Type) {
|
|
8
|
-
return this.getClassGroup(classModel).replace(/ /g, '-').replace('.', '');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public static getFileLink(classModel: Type) {
|
|
12
|
-
const [fullClassName, fileLink] = ClassFileGeneratorHelper.getFileLinkTuple(classModel);
|
|
13
|
-
return `[${fullClassName}](${fileLink})`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
private static getFileLinkTuple(classModel: Type): [string, string] {
|
|
17
|
-
const documentationRoot = Settings.getInstance().getRootDir() ?? '';
|
|
18
|
-
const directoryRoot = `${documentationRoot}${this.getDirectoryRoot(classModel)}`;
|
|
19
|
-
const fullClassName = `${Settings.getInstance().getNamespacePrefix()}${classModel.name}`;
|
|
20
|
-
return [fullClassName, `${directoryRoot}${fullClassName}.md`];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public static getFileLinkByTypeName(typeName: string): string {
|
|
24
|
-
const type = TypesRepository.getInstance().getFromScopedByName(typeName);
|
|
25
|
-
if (!type) {
|
|
26
|
-
// If the type is not found, we return a Markdown hyperlink with whatever we received.
|
|
27
|
-
return `[${typeName}](${typeName})`;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return this.getFileLink(type);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
private static getDirectoryRoot(classModel: Type) {
|
|
34
|
-
// root-relative links start from the root by using a leading '/'
|
|
35
|
-
if (Settings.getInstance().getLinkingStrategy() === 'root-relative') {
|
|
36
|
-
return `/${this.getSanitizedGroup(classModel)}/`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// path-relative links traverse the directory structure
|
|
40
|
-
const typeBeingProcessed = State.getInstance().getTypeBeingProcessed();
|
|
41
|
-
if (typeBeingProcessed) {
|
|
42
|
-
if (this.getClassGroup(typeBeingProcessed) === this.getClassGroup(classModel)) {
|
|
43
|
-
// If the types the same groups then we simply link directly to that file
|
|
44
|
-
return './';
|
|
45
|
-
} else {
|
|
46
|
-
// If the types have different groups, then we have to go up a directory
|
|
47
|
-
return `../${this.getSanitizedGroup(classModel)}/`;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
// If nothing is being processed, then we assume we are at the root and links should include the groups
|
|
51
|
-
return `./${this.getSanitizedGroup(classModel)}/`;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
private static getClassGroup(classModel: Type): string {
|
|
56
|
-
const groupAnnotation = classModel.docComment?.annotations.find(
|
|
57
|
-
(annotation) => annotation.name.toLowerCase() === 'group',
|
|
58
|
-
);
|
|
59
|
-
return groupAnnotation?.body ?? Settings.getInstance().getDefaultGroupName();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
3
|
-
|
|
4
|
-
export default class DocsifyDocsProcessor extends MarkdownTranspilerBase {
|
|
5
|
-
homeFileName(): string {
|
|
6
|
-
return 'README';
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
getLinkingStrategy(): LinkingStrategy {
|
|
10
|
-
return 'root-relative';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
|
-
import { Type } from '@cparra/apex-reflection';
|
|
3
|
-
import { MarkdownHomeFile } from '../../../model/markdown-home-file';
|
|
4
|
-
import { MarkdownTypeFile } from '../../../model/markdown-type-file';
|
|
5
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
6
|
-
import { Settings } from '../../../settings';
|
|
7
|
-
|
|
8
|
-
export class JekyllDocsProcessor extends MarkdownTranspilerBase {
|
|
9
|
-
homeFileName(): string {
|
|
10
|
-
return 'index';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
onBeforeProcess = (types: Type[]) => {
|
|
14
|
-
this._fileContainer.pushFile(new MarkdownHomeFile(this.homeFileName(), types, this.frontMatterForHomeFile));
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
onProcess(type: Type): void {
|
|
18
|
-
this._fileContainer.pushFile(new MarkdownTypeFile(type, 1, this.getFrontMatterHeader(type)));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
get frontMatterForHomeFile(): string {
|
|
22
|
-
return '---\nlayout: default\n---';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getFrontMatterHeader(type: Type): string {
|
|
26
|
-
const headerLines = ['---'];
|
|
27
|
-
// "layout: default" is a required front matter header for Jekyll
|
|
28
|
-
headerLines.push('layout: default');
|
|
29
|
-
// Add any additional front matter headers that might have been configured in the settings
|
|
30
|
-
const targetType = {
|
|
31
|
-
name: type.name,
|
|
32
|
-
typeName: type.type_name,
|
|
33
|
-
accessModifier: type.access_modifier,
|
|
34
|
-
group: type.group,
|
|
35
|
-
description: type.docComment?.description,
|
|
36
|
-
};
|
|
37
|
-
const configuredHeaders = Settings.getInstance().frontMatterHeader(targetType);
|
|
38
|
-
if (configuredHeaders) {
|
|
39
|
-
configuredHeaders.forEach((header) => {
|
|
40
|
-
headerLines.push(header);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
headerLines.push('---');
|
|
44
|
-
return headerLines.join('\n');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
getLinkingStrategy(): LinkingStrategy {
|
|
48
|
-
return 'path-relative';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import ProcessorTypeTranspiler from '../processor-type-transpiler';
|
|
2
|
-
import { Type } from '@cparra/apex-reflection';
|
|
3
|
-
import { FileContainer } from '../file-container';
|
|
4
|
-
import { MarkdownHomeFile } from '../../model/markdown-home-file';
|
|
5
|
-
import { MarkdownTypeFile } from '../../model/markdown-type-file';
|
|
6
|
-
|
|
7
|
-
export abstract class MarkdownTranspilerBase extends ProcessorTypeTranspiler {
|
|
8
|
-
protected readonly _fileContainer: FileContainer;
|
|
9
|
-
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
this._fileContainer = new FileContainer();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
abstract homeFileName(): string;
|
|
16
|
-
|
|
17
|
-
fileBuilder(): FileContainer {
|
|
18
|
-
return this._fileContainer;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
onBeforeProcess = (types: Type[]) => {
|
|
22
|
-
this._fileContainer.pushFile(new MarkdownHomeFile(this.homeFileName(), types));
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
onProcess(type: Type): void {
|
|
26
|
-
this._fileContainer.pushFile(new MarkdownTypeFile(type));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Type } from '@cparra/apex-reflection';
|
|
2
|
-
import { FileContainer } from './file-container';
|
|
3
|
-
|
|
4
|
-
export type LinkingStrategy = 'root-relative' | 'path-relative';
|
|
5
|
-
|
|
6
|
-
export default abstract class ProcessorTypeTranspiler {
|
|
7
|
-
onBeforeProcess: ((types: Type[]) => void) | undefined;
|
|
8
|
-
|
|
9
|
-
abstract onProcess(type: Type): void;
|
|
10
|
-
|
|
11
|
-
onAfterProcess: ((types: Type[]) => void) | undefined;
|
|
12
|
-
|
|
13
|
-
abstract fileBuilder(): FileContainer;
|
|
14
|
-
|
|
15
|
-
getLinkingStrategy(): LinkingStrategy {
|
|
16
|
-
return 'root-relative';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/enum-template.ts
RENAMED
|
File without changes
|
/package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/fieldsPartialTemplate.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/interface-template.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{transpiler/markdown/plain-markdown → core/markdown/templates}/type-doc-partial.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|