@docfy/ember 0.4.4 → 0.4.8

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.
@@ -0,0 +1,3 @@
1
+ ```hbs template
2
+ demo for ember folder
3
+ ```
package/lib/index.js CHANGED
@@ -24,6 +24,7 @@ const core_1 = __importDefault(require("@docfy/core"));
24
24
  const docfy_output_template_1 = __importDefault(require("./docfy-output-template"));
25
25
  const get_config_1 = __importDefault(require("./get-config"));
26
26
  const utils_1 = require("./plugins/utils");
27
+ const calculate_cache_key_for_tree_1 = __importDefault(require("calculate-cache-key-for-tree"));
27
28
  const debug_1 = __importDefault(require("debug"));
28
29
  const debug = debug_1.default('@docfy/ember');
29
30
  const templateOnlyComponent = `
@@ -108,6 +109,18 @@ module.exports = {
108
109
  }
109
110
  this._super.included.apply(this, args);
110
111
  },
112
+ // Re-enables caching of this addon, due to opting out
113
+ // of the caching implicitly by specifying treeFor* methods
114
+ cacheKeyForTree(treeType) {
115
+ switch (treeType) {
116
+ case 'app':
117
+ case 'addon': {
118
+ return calculate_cache_key_for_tree_1.default(treeType, this, [this.docfyConfig]);
119
+ }
120
+ default:
121
+ return calculate_cache_key_for_tree_1.default(treeType, this);
122
+ }
123
+ },
111
124
  treeForApp(tree) {
112
125
  const trees = [this._super.treeForApp.call(this, tree)];
113
126
  if (isDeepAddonInstance(this)) {
@@ -56,7 +56,10 @@ exports.default = plugin_1.default({
56
56
  });
57
57
  }
58
58
  });
59
- const componentName = utils_1.generateDemoComponentName(`docfy-demo-${path_1.default.basename(page.source).split('.')[0]}-${path_1.default.basename(demo.source).split('.')[0]}`, seenNames);
59
+ // 1. exclude extension
60
+ // 2. remove /index.md because of web conventions
61
+ const baseName = page.source.replace('/index.md', '').split('.')[0];
62
+ const componentName = utils_1.generateDemoComponentName(`docfy-demo-${baseName}-${path_1.default.basename(demo.source).split('.')[0]}`, seenNames);
60
63
  const demoTitle = unist_util_find_1.default(demo.ast, (node) => node.type === 'heading' && node.depth === 1);
61
64
  if (demoTitle) {
62
65
  demoTitle.depth = 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docfy/ember",
3
- "version": "0.4.4",
3
+ "version": "0.4.8",
4
4
  "description": "Ember integration with Docfy",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -38,6 +38,7 @@
38
38
  "broccoli-node-api": "^1.7.0",
39
39
  "broccoli-plugin": "^4.0.3",
40
40
  "broccoli-source": "^3.0.0",
41
+ "calculate-cache-key-for-tree": "2.0.0",
41
42
  "debug": "^4.3.1",
42
43
  "ember-cli-babel": "^7.23.1",
43
44
  "ember-cli-htmlbars": "^5.3.1",
@@ -121,5 +122,5 @@
121
122
  "prember"
122
123
  ]
123
124
  },
124
- "gitHead": "0a5553db528f22491f703c45a66be3073f59217a"
125
+ "gitHead": "367f4946c144db8c5ef4e03fe44ba7450c89849e"
125
126
  }
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ import { DemoComponentChunk } from './plugins/types';
13
13
  import docfyOutputTemplate from './docfy-output-template';
14
14
  import getDocfyConfig from './get-config';
15
15
  import { isDemoComponents } from './plugins/utils';
16
+ import cacheKeyForTree from 'calculate-cache-key-for-tree';
16
17
  import debugFactory from 'debug';
17
18
  const debug = debugFactory('@docfy/ember');
18
19
 
@@ -134,6 +135,19 @@ module.exports = {
134
135
  this._super.included.apply(this, args);
135
136
  },
136
137
 
138
+ // Re-enables caching of this addon, due to opting out
139
+ // of the caching implicitly by specifying treeFor* methods
140
+ cacheKeyForTree(treeType: string): string {
141
+ switch (treeType) {
142
+ case 'app':
143
+ case 'addon': {
144
+ return cacheKeyForTree(treeType, this, [this.docfyConfig]);
145
+ }
146
+ default:
147
+ return cacheKeyForTree(treeType, this);
148
+ }
149
+ },
150
+
137
151
  treeForApp(tree: Node): Node {
138
152
  const trees: Node[] = [this._super.treeForApp.call(this, tree)];
139
153
  if (isDeepAddonInstance(this)) {
@@ -71,8 +71,13 @@ export default plugin({
71
71
  });
72
72
  }
73
73
  });
74
+
75
+ // 1. exclude extension
76
+ // 2. remove /index.md because of web conventions
77
+ const baseName = page.source.replace('/index.md', '').split('.')[0];
78
+
74
79
  const componentName = generateDemoComponentName(
75
- `docfy-demo-${path.basename(page.source).split('.')[0]}-${
80
+ `docfy-demo-${baseName}-${
76
81
  path.basename(demo.source).split('.')[0]
77
82
  }`,
78
83
  seenNames