@docfy/ember 0.9.0 → 0.10.0

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.
Files changed (166) hide show
  1. package/README.md +8 -5
  2. package/addon-main.cjs +4 -0
  3. package/declarations/components/docfy-demo.d.ts +44 -0
  4. package/declarations/components/docfy-demo.d.ts.map +1 -0
  5. package/declarations/components/docfy-link.d.ts +23 -0
  6. package/declarations/components/docfy-link.d.ts.map +1 -0
  7. package/declarations/components/docfy-output.d.ts +24 -0
  8. package/declarations/components/docfy-output.d.ts.map +1 -0
  9. package/declarations/components/docfy-previous-and-next-page.d.ts +23 -0
  10. package/declarations/components/docfy-previous-and-next-page.d.ts.map +1 -0
  11. package/declarations/index.d.ts +7 -0
  12. package/declarations/index.d.ts.map +1 -0
  13. package/declarations/routing.d.ts +3 -0
  14. package/declarations/routing.d.ts.map +1 -0
  15. package/{services → declarations/services}/docfy.d.ts +4 -8
  16. package/declarations/services/docfy.d.ts.map +1 -0
  17. package/declarations/template-registry.d.ts +11 -0
  18. package/declarations/template-registry.d.ts.map +1 -0
  19. package/dist/_app_/components/docfy-demo.js +1 -0
  20. package/dist/_app_/components/docfy-link.js +1 -0
  21. package/dist/_app_/components/docfy-output.js +1 -0
  22. package/dist/_app_/components/docfy-previous-and-next-page.js +1 -0
  23. package/dist/_app_/services/docfy.js +1 -0
  24. package/dist/components/docfy-demo.js +121 -0
  25. package/dist/components/docfy-demo.js.map +1 -0
  26. package/dist/components/docfy-link.js +58 -0
  27. package/dist/components/docfy-link.js.map +1 -0
  28. package/dist/components/docfy-output.js +43 -0
  29. package/dist/components/docfy-output.js.map +1 -0
  30. package/dist/components/docfy-previous-and-next-page.js +27 -0
  31. package/dist/components/docfy-previous-and-next-page.js.map +1 -0
  32. package/dist/index.js +8 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/output.d.ts +2 -0
  35. package/dist/output.d.ts.map +1 -0
  36. package/dist/output.js +17 -0
  37. package/dist/output.js.map +1 -0
  38. package/dist/routing.js +29 -0
  39. package/dist/routing.js.map +1 -0
  40. package/dist/services/docfy.js +87 -0
  41. package/dist/services/docfy.js.map +1 -0
  42. package/dist/template-registry.js +2 -0
  43. package/dist/template-registry.js.map +1 -0
  44. package/package.json +91 -124
  45. package/-private/find-previous-or-next-page.d.ts +0 -2
  46. package/-private/flat-nested.d.ts +0 -2
  47. package/.docfy-config.js +0 -40
  48. package/addon/-private/find-previous-or-next-page.ts +0 -22
  49. package/addon/-private/flat-nested.ts +0 -18
  50. package/addon/components/docfy-demo/description.hbs +0 -26
  51. package/addon/components/docfy-demo/description.ts +0 -3
  52. package/addon/components/docfy-demo/example.hbs +0 -3
  53. package/addon/components/docfy-demo/example.ts +0 -3
  54. package/addon/components/docfy-demo/snippet.hbs +0 -8
  55. package/addon/components/docfy-demo/snippet.ts +0 -35
  56. package/addon/components/docfy-demo/snippets.hbs +0 -25
  57. package/addon/components/docfy-demo/snippets.ts +0 -27
  58. package/addon/components/docfy-demo.hbs +0 -10
  59. package/addon/components/docfy-demo.ts +0 -7
  60. package/addon/components/docfy-link.hbs +0 -8
  61. package/addon/components/docfy-link.ts +0 -54
  62. package/addon/components/docfy-output.hbs +0 -1
  63. package/addon/components/docfy-output.ts +0 -37
  64. package/addon/components/docfy-previous-and-next-page.hbs +0 -1
  65. package/addon/components/docfy-previous-and-next-page.ts +0 -20
  66. package/addon/helpers/docfy-eq.ts +0 -7
  67. package/addon/index.ts +0 -31
  68. package/addon/output.d.ts +0 -13
  69. package/addon/services/docfy.ts +0 -101
  70. package/app/components/docfy-demo/description.js +0 -1
  71. package/app/components/docfy-demo/example.js +0 -1
  72. package/app/components/docfy-demo/snippet.js +0 -1
  73. package/app/components/docfy-demo/snippets.js +0 -1
  74. package/app/components/docfy-demo.js +0 -1
  75. package/app/components/docfy-link.js +0 -1
  76. package/app/components/docfy-output.js +0 -1
  77. package/app/components/docfy-previous-and-next-page.js +0 -1
  78. package/app/helpers/docfy-eq.js +0 -1
  79. package/app/services/docfy.js +0 -1
  80. package/components/docfy-demo/description.d.ts +0 -3
  81. package/components/docfy-demo/example.d.ts +0 -3
  82. package/components/docfy-demo/snippet.d.ts +0 -13
  83. package/components/docfy-demo/snippets.d.ts +0 -11
  84. package/components/docfy-demo.d.ts +0 -7
  85. package/components/docfy-link.d.ts +0 -15
  86. package/components/docfy-output.d.ts +0 -16
  87. package/components/docfy-previous-and-next-page.d.ts +0 -12
  88. package/config/environment.js +0 -5
  89. package/docs/components/docfy-demo.md +0 -67
  90. package/docs/components/docfy-link-demo/anchor.md +0 -9
  91. package/docs/components/docfy-link-demo/simple.md +0 -7
  92. package/docs/components/docfy-link.md +0 -31
  93. package/docs/components/docfy-output-demo/edit-page.md +0 -54
  94. package/docs/components/docfy-output-demo/flat.md +0 -23
  95. package/docs/components/docfy-output-demo/on-this-page.md +0 -30
  96. package/docs/components/docfy-output-demo/sidebar.md +0 -45
  97. package/docs/components/docfy-output-demo/top-nav.md +0 -35
  98. package/docs/components/docfy-output.md +0 -34
  99. package/docs/components/docfy-previous-and-next-page-demo/scope.md +0 -26
  100. package/docs/components/docfy-previous-and-next-page-demo/simple.md +0 -24
  101. package/docs/components/docfy-previous-and-next-page.md +0 -21
  102. package/docs/configuration.md +0 -57
  103. package/docs/index.md +0 -165
  104. package/docs/writing-demos-demo/demo1.md +0 -18
  105. package/docs/writing-demos.md +0 -109
  106. package/dummy-docs/README.md +0 -140
  107. package/dummy-docs/github-icon.png +0 -0
  108. package/dummy-docs/installation.md +0 -14
  109. package/dummy-docs/introduction.md +0 -30
  110. package/dummy-docs/overview.md +0 -19
  111. package/dummy-docs/packages/core/helpers/genereate-flat-output.md +0 -10
  112. package/dummy-docs/packages/core/helpers/genereate-nested-output.md +0 -12
  113. package/dummy-docs/packages/core/overview.md +0 -19
  114. package/dummy-docs/packages/ember/components/docfy-link-demo/demo1.md +0 -26
  115. package/dummy-docs/packages/ember/components/docfy-link-demo/demo2.md +0 -20
  116. package/dummy-docs/packages/ember/components/docfy-link.md +0 -19
  117. package/dummy-docs/packages/ember/components/docfy-output.md +0 -32
  118. package/dummy-docs/packages/ember/components/docfy-with-hyphenated-number-2-demo/demo1.md +0 -25
  119. package/dummy-docs/packages/ember/components/docfy-with-hyphenated-number-2.md +0 -9
  120. package/dummy-docs/packages/ember/demo/my-ember-demo.md +0 -3
  121. package/dummy-docs/packages/ember/index.md +0 -23
  122. package/dummy-docs/packages/ember/installation.md +0 -14
  123. package/dummy-docs/packages/ember/plugins/manual-demo-insertion-demo/tomster.md +0 -15
  124. package/dummy-docs/packages/ember/plugins/manual-demo-insertion-demo/zoey.md +0 -9
  125. package/dummy-docs/packages/ember/plugins/manual-demo-insertion.md +0 -31
  126. package/dummy-docs/packages/ember/preview.md +0 -20
  127. package/ember-cli-addon.js +0 -3
  128. package/helpers/docfy-eq.d.ts +0 -7
  129. package/index.d.ts +0 -3
  130. package/lib/docfy-output-template.d.ts +0 -1
  131. package/lib/docfy-output-template.js +0 -23
  132. package/lib/get-config.d.ts +0 -7
  133. package/lib/get-config.js +0 -118
  134. package/lib/index.d.ts +0 -1
  135. package/lib/index.js +0 -177
  136. package/lib/plugins/extract-demos-to-components.d.ts +0 -2
  137. package/lib/plugins/extract-demos-to-components.js +0 -149
  138. package/lib/plugins/preview-template.d.ts +0 -2
  139. package/lib/plugins/preview-template.js +0 -41
  140. package/lib/plugins/replace-internal-links-with-docfy-link.d.ts +0 -6
  141. package/lib/plugins/replace-internal-links-with-docfy-link.js +0 -44
  142. package/lib/plugins/types.d.ts +0 -29
  143. package/lib/plugins/types.js +0 -2
  144. package/lib/plugins/utils.d.ts +0 -31
  145. package/lib/plugins/utils.js +0 -142
  146. package/output.d.ts +0 -13
  147. package/src/docfy-output-template.ts +0 -20
  148. package/src/get-config.ts +0 -109
  149. package/src/index.ts +0 -229
  150. package/src/plugins/extract-demos-to-components.ts +0 -196
  151. package/src/plugins/preview-template.ts +0 -54
  152. package/src/plugins/replace-internal-links-with-docfy-link.ts +0 -61
  153. package/src/plugins/types.ts +0 -33
  154. package/src/plugins/utils.ts +0 -191
  155. package/src/tsconfig.json +0 -14
  156. package/src/types/broccoli-bridge.d.ts +0 -11
  157. package/src/types/broccoli-file-creator.d.ts +0 -11
  158. package/src/types/broccoli-funnel.d.ts +0 -19
  159. package/src/types/broccoli-merge-trees.d.ts +0 -13
  160. package/src/types/broccoli-source.d.ts +0 -9
  161. package/src/types/mdast-util-to-string.d.ts +0 -5
  162. package/src/types/unist-util-find.d.ts +0 -8
  163. package/tsconfig.json +0 -42
  164. package/types/dummy/index.d.ts +0 -0
  165. package/types/ember-get-config/index.d.ts +0 -9
  166. package/types/global.d.ts +0 -6
@@ -1,19 +0,0 @@
1
- ---
2
- category: core
3
- ---
4
-
5
- # Overview
6
-
7
- ## Admovit est tutus nec elusam scrobibus totumque
8
-
9
- Lorem markdownum animaeque obsedit adversam, saevi sed resupina tenuesque levius
10
- tenenti utque. Cornibus et opes crudelia primus procul alvum exit: dum frondes!
11
- Cornibus e, putat procul nostro erat cunctantem munus inventus quod.
12
-
13
- - Unus frondes
14
- - Gelida vos cultus vada dicta sunt lacerto
15
- - Utque meum referam
16
-
17
- ## Helpers
18
-
19
- [Link to another category](../core/helpers/genereate-flat-output.md)
@@ -1,26 +0,0 @@
1
- ---
2
- order: 2
3
- ---
4
-
5
- # Demo of DocfyLink component
6
-
7
- This is a cool feature.
8
-
9
- [Link from a demo](../docfy-output.md)
10
-
11
- ```hbs template
12
- <div data-test-id="demo-1">
13
- This is my Demo:
14
-
15
- <DocfyLink @to={{this.url}}>My Link</DocfyLink>
16
- </div>
17
- <div data-test-id="demo-1-js-data">{{this.url}}</div>
18
- ```
19
-
20
- ```js component
21
- import Component from '@glimmer/component';
22
-
23
- export default class MyDemo extends Component {
24
- url = '/docs/ember/';
25
- }
26
- ```
@@ -1,20 +0,0 @@
1
- ---
2
- order: 1
3
- ---
4
-
5
- # This demo only has a template
6
-
7
- I can use markdown here.
8
-
9
- - Item 1
10
- - Item 2
11
-
12
- _Super Cool_
13
-
14
- ```hbs template
15
- <DocfyLink @to="/" class="font-bold" data-test-id="demo-2">
16
- My Other Demo Link
17
- </DocfyLink>
18
- ```
19
-
20
- This is a cool feature.
@@ -1,19 +0,0 @@
1
- ---
2
- category: ember
3
- subcategory: components
4
- ---
5
-
6
- # Docfy Link Component
7
-
8
- Lorem markdownum animaeque obsedit adversam, saevi sed resupina tenuesque levius
9
- tenenti utque. Cornibus et opes crudelia primus procul alvum exit: dum frondes!
10
- Cornibus e, putat procul nostro erat cunctantem munus inventus quod.
11
-
12
- Another paragraph
13
-
14
- ## This is another thing
15
-
16
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
17
- tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
18
- At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
19
- no sea takimata sanctus est Lorem ipsum dolor sit amet.
@@ -1,32 +0,0 @@
1
- ---
2
- category: ember
3
- subcategory: components
4
- ---
5
-
6
- # Docfy Output Component
7
-
8
- Lorem markdownum animaeque obsedit adversam, saevi sed resupina tenuesque levius
9
- tenenti utque. Cornibus et opes crudelia primus procul alvum exit: dum frondes!
10
- Cornibus e, putat procul nostro erat cunctantem munus inventus quod.
11
-
12
- ## Example of "On this page"
13
-
14
- ```hbs
15
-
16
- <DocfyOutput @fromCurrentURL={{true}} as |page|>
17
- {{#if page.headings.length}}
18
- On this page:
19
- <ul>
20
- {{#each page.headings as |heading|}}
21
- <li>
22
- <DocfyLink @to={{page.url}} @anchor={{heading.id}}>
23
- {{heading.title}}
24
- </DocfyLink>
25
- </li>
26
- {{/each}}
27
- </ul>
28
- {{/if}}
29
- </DocfyOutput>
30
- ```
31
-
32
- For documentation of `DocfyLink` [click here](./docfy-link.md)
@@ -1,25 +0,0 @@
1
- ---
2
- order: 1
3
- ---
4
-
5
- # Demo of DocfyLink component
6
-
7
- [Link from a demo](../docfy-output.md)
8
-
9
- ```hbs template
10
- <div data-test-id="demo-1">
11
- This is my Demo:
12
-
13
- <span class='hyphenated-demo'>Assertable DOM node</span>
14
- <DocfyLink @to={{this.url}}>My Link</DocfyLink>
15
- </div>
16
- <div data-test-id="demo-1-js-data">{{this.url}}</div>
17
- ```
18
-
19
- ```js component
20
- import Component from '@glimmer/component';
21
-
22
- export default class MyDemo extends Component {
23
- url = '/docs/ember/';
24
- }
25
- ```
@@ -1,9 +0,0 @@
1
- ---
2
- category: ember
3
- subcategory: components
4
- ---
5
-
6
- # Docfy With Hyphenated Number 2
7
-
8
- Testing doc pages with numbers in their name and how that corresponds with
9
- automatic component registration.
@@ -1,3 +0,0 @@
1
- ```hbs template
2
- demo for ember folder
3
- ```
@@ -1,23 +0,0 @@
1
- # Working with Ember
2
-
3
- This is a simple markdown
4
-
5
- Where are a lot of cool features here. One of them is to preview a template.
6
-
7
- ```hbs preview-template
8
- <DocfyLink @to="/" class="text-blue-700">This is a link to index</DocfyLink>
9
-
10
- <div class="p-4 my-2 border border-blue-500 rounded" data-test-id="preview-1">
11
- I can have any hbs here and I can use any component avaliable in the host app.
12
- </div>
13
- ```
14
-
15
- ## Another content
16
-
17
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
18
-
19
- ```hbs preview-template
20
- <div data-test-id="preview-2">
21
- Another preview here
22
- </div>
23
- ```
@@ -1,14 +0,0 @@
1
- ---
2
- category: ember
3
- ---
4
-
5
- # Installation
6
-
7
- ```sh
8
-
9
- # Using npm
10
- npm install --save-dev @docfy/ember
11
-
12
- # Using Yarn
13
- yarn add --dev @docfy/ember
14
- ```
@@ -1,15 +0,0 @@
1
- # Tomster
2
-
3
- Lovable hamster
4
-
5
- ```hbs template
6
- <div data-test-id="tomster">
7
- {{#let (array 1 2 3 4 5) as |numbers|}}
8
- <ol>
9
- {{#each numbers as |number|}}
10
- <li>Here is number {{number}}</li>
11
- {{/each}}
12
- </ol>
13
- {{/let}}
14
- </div>
15
- ```
@@ -1,9 +0,0 @@
1
- # Zoey
2
-
3
- Tomster's sister (also a lovable hamster).
4
-
5
- ```hbs template
6
- <div data-test-id="zoey">
7
- Ember is <em>so</em> {{concat 'g' 'r' 'e' 'a' 't'}}!
8
- </div>
9
- ```
@@ -1,31 +0,0 @@
1
- ---
2
- category: ember
3
- subcategory: plugins
4
- manualDemoInsertion: true
5
- ---
6
-
7
- # Manual Demo Insertion
8
-
9
- Docfy will automatically insert demos for a page into the page at build time. However, this convenience comes at the cost of choosing where the demos should be rendered.
10
-
11
- If you want control over where demos are rendered in a page, add `manualDemoInsertion: true` to your page's frontmatter. Then you can use `[[demo:name]]` or `[[demos-all]]` to mark where a specific demo or all demos should be rendered.
12
-
13
- These markers must be on their own line!
14
-
15
- ## It works like this
16
-
17
- Here is the tomster demo
18
-
19
- [[demo:tomster]]
20
-
21
- And here is the zoey demo
22
-
23
- [[demo:zoey]]
24
-
25
- ## Or you can add all demos
26
-
27
- [[demos-all]]
28
-
29
- ## Conclusion
30
-
31
- With Docfy you get demos added to your pages for free, but with a little more work you can also get a bit more control.
@@ -1,20 +0,0 @@
1
- ---
2
- category: ember
3
- ---
4
-
5
- # Preview works with gts, gjs
6
-
7
- This works
8
-
9
- ```gts preview
10
- import Component from '@glimmer/component';
11
-
12
- // components/hello.gjs
13
- export default class Hello extends Component {
14
- isThisCool = true;
15
-
16
- <template>
17
- Is This Cool?: {{this.isThisCool}}
18
- </template>
19
- }
20
- ```
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = require('./lib');
@@ -1,7 +0,0 @@
1
- export declare function docfyEq(params: unknown[]): boolean;
2
- declare const _default: import("@ember/component/helper").FunctionBasedHelper<{
3
- PositionalArgs: unknown[];
4
- NamedArgs: Record<string, unknown>;
5
- Return: boolean;
6
- }>;
7
- export default _default;
package/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import RouterDSL from '@ember/routing/-private/router-dsl';
2
- export { default as DocfyService } from './services/docfy';
3
- export declare function addDocfyRoutes(context: RouterDSL): void;
@@ -1 +0,0 @@
1
- export default function docfyOutputTemplate(modulePrefix: string): string;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function docfyOutputTemplate(modulePrefix) {
4
- return `;
5
- define('@docfy/ember/output', [
6
- 'exports',
7
- '${modulePrefix}/docfy-output'
8
- ], function (_exports, _docfyOutput) {
9
- 'use strict';
10
-
11
- Object.defineProperty(_exports, '__esModule', {
12
- value: true
13
- });
14
- Object.defineProperty(_exports, 'default', {
15
- enumerable: true,
16
- get: function () {
17
- return _docfyOutput.default;
18
- }
19
- });
20
- });
21
- `;
22
- }
23
- exports.default = docfyOutputTemplate;
@@ -1,7 +0,0 @@
1
- import { DocfyConfig } from '@docfy/core/lib/types';
2
- import type { RemarkHbsOptions } from 'remark-hbs';
3
- interface EmberDocfyConfig extends DocfyConfig {
4
- remarkHbsOptions?: RemarkHbsOptions;
5
- }
6
- export default function getDocfyConfig(root: string): Promise<EmberDocfyConfig>;
7
- export {};
package/lib/get-config.js DELETED
@@ -1,118 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
- var __importDefault = (this && this.__importDefault) || function (mod) {
31
- return (mod && mod.__esModule) ? mod : { "default": mod };
32
- };
33
- Object.defineProperty(exports, "__esModule", { value: true });
34
- const path_1 = __importDefault(require("path"));
35
- const url_1 = require("url");
36
- const remark_hbs_1 = __importDefault(require("remark-hbs"));
37
- const replace_internal_links_with_docfy_link_1 = __importDefault(require("./plugins/replace-internal-links-with-docfy-link"));
38
- const extract_demos_to_components_1 = __importDefault(require("./plugins/extract-demos-to-components"));
39
- const preview_template_1 = __importDefault(require("./plugins/preview-template"));
40
- const DEFAULT_CONFIG = {
41
- sources: [
42
- {
43
- pattern: '**/*.md',
44
- urlPrefix: 'docs'
45
- }
46
- ]
47
- };
48
- function getDocfyConfig(root) {
49
- var _a, _b, _c, _d, _e;
50
- return __awaiter(this, void 0, void 0, function* () {
51
- const configPath = path_1.default.join(root, '.docfy-config.js');
52
- let docfyConfig = {};
53
- // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
54
- const pkg = require(path_1.default.join(root, 'package.json'));
55
- try {
56
- // Attempt to require (CJS)
57
- // eslint-disable-next-line @typescript-eslint/no-require-imports
58
- docfyConfig = require(configPath);
59
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
- }
61
- catch (e) {
62
- // Fallback to ESM if the error indicates ESM-only module
63
- const isESMError = e.code === 'ERR_REQUIRE_ESM' ||
64
- ((_a = e.message) === null || _a === void 0 ? void 0 : _a.includes('must use import to load ES Module')) ||
65
- ((_b = e.message) === null || _b === void 0 ? void 0 : _b.includes('Cannot use import statement outside a module'));
66
- if (isESMError || e.code === 'ERR_MODULE_NOT_FOUND') {
67
- try {
68
- const imported = yield Promise.resolve().then(() => __importStar(require((0, url_1.pathToFileURL)(configPath).href)));
69
- docfyConfig = (_c = imported === null || imported === void 0 ? void 0 : imported.default) !== null && _c !== void 0 ? _c : imported;
70
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
- }
72
- catch (esmErr) {
73
- const notFound = esmErr.code === 'ERR_MODULE_NOT_FOUND' ||
74
- ((_d = esmErr.message) === null || _d === void 0 ? void 0 : _d.includes('Cannot find module'));
75
- if (!notFound) {
76
- throw esmErr;
77
- }
78
- docfyConfig = {};
79
- }
80
- }
81
- else {
82
- throw e;
83
- }
84
- }
85
- if (typeof docfyConfig !== 'object' || docfyConfig == null) {
86
- docfyConfig = {};
87
- }
88
- if (!Array.isArray(docfyConfig.sources)) {
89
- docfyConfig.sources = DEFAULT_CONFIG.sources;
90
- }
91
- if (!Array.isArray(docfyConfig.plugins)) {
92
- docfyConfig.plugins = [];
93
- }
94
- docfyConfig.plugins.unshift(replace_internal_links_with_docfy_link_1.default, preview_template_1.default, extract_demos_to_components_1.default);
95
- if (!Array.isArray(docfyConfig.remarkPlugins)) {
96
- docfyConfig.remarkPlugins = [];
97
- }
98
- docfyConfig.remarkPlugins.push([
99
- remark_hbs_1.default,
100
- docfyConfig.remarkHbsOptions || {}
101
- ]);
102
- const repoUrl = ((_e = pkg.repository) === null || _e === void 0 ? void 0 : _e.url) || pkg.repository;
103
- if (!docfyConfig.repository &&
104
- typeof repoUrl === 'string' &&
105
- repoUrl !== '') {
106
- docfyConfig.repository = {
107
- url: repoUrl
108
- };
109
- }
110
- docfyConfig.sources.forEach((source) => {
111
- if (typeof source.root === 'undefined') {
112
- source.root = path_1.default.join(root, 'docs');
113
- }
114
- });
115
- return docfyConfig;
116
- });
117
- }
118
- exports.default = getDocfyConfig;
package/lib/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/lib/index.js DELETED
@@ -1,177 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const fs_1 = __importDefault(require("fs"));
16
- const path_1 = __importDefault(require("path"));
17
- const broccoli_bridge_1 = __importDefault(require("broccoli-bridge"));
18
- const broccoli_funnel_1 = __importDefault(require("broccoli-funnel"));
19
- const broccoli_merge_trees_1 = __importDefault(require("broccoli-merge-trees"));
20
- const broccoli_plugin_1 = __importDefault(require("broccoli-plugin"));
21
- const broccoli_file_creator_1 = __importDefault(require("broccoli-file-creator"));
22
- const broccoli_source_1 = require("broccoli-source");
23
- const core_1 = __importDefault(require("@docfy/core"));
24
- const docfy_output_template_1 = __importDefault(require("./docfy-output-template"));
25
- const get_config_1 = __importDefault(require("./get-config"));
26
- const utils_1 = require("./plugins/utils");
27
- const calculate_cache_key_for_tree_1 = __importDefault(require("calculate-cache-key-for-tree"));
28
- const debug_1 = __importDefault(require("debug"));
29
- const debug = (0, debug_1.default)('@docfy/ember');
30
- const templateOnlyComponent = `
31
- import Component from '@glimmer/component';
32
- export default class extends Component {}
33
- `;
34
- function ensureDirectoryExistence(filePath) {
35
- const dirname = path_1.default.dirname(filePath);
36
- if (fs_1.default.existsSync(dirname)) {
37
- return;
38
- }
39
- ensureDirectoryExistence(dirname);
40
- fs_1.default.mkdirSync(dirname);
41
- }
42
- function hasBackingJS(chunks) {
43
- for (let i = 0; i < chunks.length; i++) {
44
- const chunk = chunks[i];
45
- if (['js', 'ts', 'gts', 'gjs'].includes(chunk.ext)) {
46
- return true;
47
- }
48
- }
49
- return false;
50
- }
51
- // eslint-disable-next-line
52
- function isDeepAddonInstance(addon) {
53
- return addon.parent !== addon.project;
54
- }
55
- class DocfyBroccoli extends broccoli_plugin_1.default {
56
- constructor(inputNodes, options = {}) {
57
- super(inputNodes, options);
58
- this.config = options;
59
- }
60
- build() {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- debug('Output Path: ', this.outputPath);
63
- debug('Config: ', this.config);
64
- const docfy = new core_1.default(this.config);
65
- const result = yield docfy.run(this.config.sources);
66
- const snippets = {
67
- components: {}
68
- };
69
- result.content.forEach((page) => {
70
- const parts = [this.outputPath, 'templates', page.meta.url];
71
- if (page.meta.url[page.meta.url.length - 1] === '/') {
72
- parts.push('index');
73
- }
74
- const fileName = `${path_1.default.join(...parts)}.hbs`;
75
- // console.log(fileName, "RENDERED AS", page.rendered);
76
- ensureDirectoryExistence(fileName);
77
- fs_1.default.writeFileSync(fileName, page.rendered);
78
- const demoComponents = page.pluginData.demoComponents;
79
- if ((0, utils_1.isDemoComponents)(demoComponents)) {
80
- demoComponents.forEach((component) => {
81
- component.chunks.forEach((chunk) => {
82
- const chunkPath = path_1.default.join(this.outputPath, 'components', `${component.name.dashCase}.${chunk.ext}`);
83
- ensureDirectoryExistence(chunkPath);
84
- snippets.components[`${component.name.dashCase}`] = Object.assign(Object.assign({}, (snippets.components[`${component.name.dashCase}`] || {})), { [chunk.ext]: chunk.code });
85
- fs_1.default.writeFileSync(chunkPath, chunk.code);
86
- });
87
- if (!hasBackingJS(component.chunks)) {
88
- const chunkPath = path_1.default.join(this.outputPath, 'components', `${component.name.dashCase}.js`);
89
- ensureDirectoryExistence(chunkPath);
90
- snippets.components[`${component.name.dashCase}`] = Object.assign(Object.assign({}, (snippets.components[`${component.name.dashCase}`] || {})), { js: templateOnlyComponent });
91
- fs_1.default.writeFileSync(chunkPath, templateOnlyComponent);
92
- }
93
- });
94
- }
95
- });
96
- fs_1.default.writeFileSync(path_1.default.join(this.outputPath, 'docfy-output.js'), `export default ${JSON.stringify({ nested: result.nestedPageMetadata })};`);
97
- const urlsJsonFile = path_1.default.join(this.outputPath, 'public', 'docfy-urls.json');
98
- ensureDirectoryExistence(urlsJsonFile);
99
- fs_1.default.writeFileSync(urlsJsonFile, JSON.stringify(result.content.map((page) => page.meta.url)));
100
- const snippetsJsonFile = path_1.default.join(this.outputPath, 'public', 'docfy-snippets.json');
101
- ensureDirectoryExistence(snippetsJsonFile);
102
- fs_1.default.writeFileSync(snippetsJsonFile, JSON.stringify(snippets));
103
- result.staticAssets.forEach((asset) => {
104
- const dest = path_1.default.join(this.outputPath, 'public', asset.toPath);
105
- ensureDirectoryExistence(dest);
106
- fs_1.default.copyFileSync(asset.fromPath, dest);
107
- });
108
- });
109
- }
110
- }
111
- module.exports = {
112
- name: require('../package').name,
113
- docfyConfig: undefined,
114
- included(...args) {
115
- if (!isDeepAddonInstance(this)) {
116
- this.docfyConfig = (0, get_config_1.default)(this.project.root);
117
- this.bridge = new broccoli_bridge_1.default();
118
- }
119
- this._super.included.apply(this, args);
120
- },
121
- // Re-enables caching of this addon, due to opting out
122
- // of the caching implicitly by specifying treeFor* methods
123
- cacheKeyForTree(treeType) {
124
- switch (treeType) {
125
- case 'app':
126
- case 'addon': {
127
- return (0, calculate_cache_key_for_tree_1.default)(treeType, this, [this.docfyConfig]);
128
- }
129
- default:
130
- return (0, calculate_cache_key_for_tree_1.default)(treeType, this);
131
- }
132
- },
133
- treeForApp(tree) {
134
- const trees = [this._super.treeForApp.call(this, tree)];
135
- if (isDeepAddonInstance(this)) {
136
- return trees[0];
137
- }
138
- const inputs = [new broccoli_source_1.UnwatchedDir(this.project.root)];
139
- this.docfyConfig.sources.forEach((item) => {
140
- if (item.root && item.root !== this.project.root) {
141
- inputs.push(item.root);
142
- }
143
- });
144
- const docfyTree = new DocfyBroccoli(inputs, this.docfyConfig);
145
- trees.push(docfyTree);
146
- this.bridge.fulfill('docfy-tree', docfyTree);
147
- return new broccoli_merge_trees_1.default(trees, { overwrite: true });
148
- },
149
- treeForAddon(tree) {
150
- const trees = [this._super.treeForAddon.call(this, tree)];
151
- if (isDeepAddonInstance(this)) {
152
- return trees[0];
153
- }
154
- const EmberApp = require('ember-cli/lib/broccoli/ember-app'); // eslint-disable-line
155
- const modulePrefix = this.project.config(EmberApp.env()).modulePrefix;
156
- trees.push(new broccoli_file_creator_1.default('output.js', (0, docfy_output_template_1.default)(modulePrefix)));
157
- return new broccoli_merge_trees_1.default(trees);
158
- },
159
- treeForPublic() {
160
- if (isDeepAddonInstance(this)) {
161
- return;
162
- }
163
- return new broccoli_funnel_1.default(this.bridge.placeholderFor('docfy-tree'), {
164
- srcDir: 'public',
165
- destDir: './'
166
- });
167
- },
168
- urlsForPrember(distDir) {
169
- try {
170
- return require(path_1.default.join(distDir, 'docfy-urls.json')); // eslint-disable-line
171
- }
172
- catch (_a) {
173
- // empty
174
- }
175
- return [];
176
- }
177
- };
@@ -1,2 +0,0 @@
1
- declare const _default: import("@docfy/core/lib/types").Plugin<import("@docfy/core/lib/types").PluginOptions | null | undefined>;
2
- export default _default;