ember-cli 4.0.0 → 4.1.0-beta.1

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 (107) hide show
  1. package/.github/workflows/ci.yml +4 -4
  2. package/CHANGELOG.md +17 -2
  3. package/blueprints/app/files/package.json +2 -2
  4. package/docs/build/data.json +3 -3
  5. package/lib/models/host-info-cache.js +3 -5
  6. package/lib/models/per-bundle-addon-cache/index.js +2 -3
  7. package/lib/utilities/get-lang-arg.js +45 -45
  8. package/package.json +25 -25
  9. package/.github/ISSUE_TEMPLATE.md +0 -12
  10. package/.github/dependabot.yml +0 -15
  11. package/.github/workflows/coverage.yml +0 -31
  12. package/docs/analytics.md +0 -44
  13. package/docs/architecture.md +0 -316
  14. package/docs/assets/architecture/Ember-CLI architecture.png +0 -0
  15. package/docs/assets/architecture/Ember-CLI architecture.xml +0 -1
  16. package/docs/assets/architecture/README.md +0 -5
  17. package/docs/brocfile-transition.md +0 -46
  18. package/docs/build/api.js +0 -44
  19. package/docs/build/assets/css/external-small.png +0 -0
  20. package/docs/build/assets/css/logo.png +0 -0
  21. package/docs/build/assets/css/main.css +0 -555
  22. package/docs/build/assets/favicon.ico +0 -0
  23. package/docs/build/assets/img/spinner.gif +0 -0
  24. package/docs/build/assets/index.html +0 -10
  25. package/docs/build/assets/js/api-filter.js +0 -56
  26. package/docs/build/assets/js/api-list.js +0 -255
  27. package/docs/build/assets/js/api-search.js +0 -98
  28. package/docs/build/assets/js/apidocs.js +0 -376
  29. package/docs/build/assets/js/yui-prettify.js +0 -17
  30. package/docs/build/assets/vendor/prettify/CHANGES.html +0 -130
  31. package/docs/build/assets/vendor/prettify/COPYING +0 -202
  32. package/docs/build/assets/vendor/prettify/README.html +0 -203
  33. package/docs/build/assets/vendor/prettify/prettify-min.css +0 -1
  34. package/docs/build/assets/vendor/prettify/prettify-min.js +0 -1
  35. package/docs/build/classes/Addon.html +0 -4318
  36. package/docs/build/classes/AmdTransformAddon.html +0 -202
  37. package/docs/build/classes/Blueprint.html +0 -4796
  38. package/docs/build/classes/Builder.html +0 -611
  39. package/docs/build/classes/CLI.html +0 -810
  40. package/docs/build/classes/Command.html +0 -1655
  41. package/docs/build/classes/DefaultPackager.html +0 -202
  42. package/docs/build/classes/EmberAddon.html +0 -2207
  43. package/docs/build/classes/EmberApp.html +0 -2225
  44. package/docs/build/classes/HardwareInfo.html +0 -620
  45. package/docs/build/classes/HistorySupportAddon.html +0 -203
  46. package/docs/build/classes/Instrumentation.html +0 -695
  47. package/docs/build/classes/NodeModulesList.html +0 -460
  48. package/docs/build/classes/NpmTask.html +0 -333
  49. package/docs/build/classes/PackageInfo.html +0 -1390
  50. package/docs/build/classes/PackageInfoCache.html +0 -963
  51. package/docs/build/classes/PerBundleAddonCache {.html +0 -1010
  52. package/docs/build/classes/Project.html +0 -2083
  53. package/docs/build/classes/ServeFilesAddon.html +0 -260
  54. package/docs/build/classes/TestsServerAddon.html +0 -203
  55. package/docs/build/classes/WatcherAddon.html +0 -204
  56. package/docs/build/classes/WindowsSymlinkChecker.html +0 -1505
  57. package/docs/build/files/lib_broccoli_default-packager.js.html +0 -1426
  58. package/docs/build/files/lib_broccoli_ember-addon.js.html +0 -159
  59. package/docs/build/files/lib_broccoli_ember-app.js.html +0 -1913
  60. package/docs/build/files/lib_cli_cli.js.html +0 -417
  61. package/docs/build/files/lib_models_addon-info.js.html +0 -112
  62. package/docs/build/files/lib_models_addon.js.html +0 -1866
  63. package/docs/build/files/lib_models_blueprint.js.html +0 -1678
  64. package/docs/build/files/lib_models_builder.js.html +0 -417
  65. package/docs/build/files/lib_models_command.js.html +0 -804
  66. package/docs/build/files/lib_models_hardware-info.js.html +0 -479
  67. package/docs/build/files/lib_models_host-info-cache.js.html +0 -428
  68. package/docs/build/files/lib_models_installation-checker.js.html +0 -181
  69. package/docs/build/files/lib_models_instantiate-addons.js.html +0 -191
  70. package/docs/build/files/lib_models_instrumentation.js.html +0 -433
  71. package/docs/build/files/lib_models_package-info-cache_index.js.html +0 -793
  72. package/docs/build/files/lib_models_package-info-cache_node-modules-list.js.html +0 -208
  73. package/docs/build/files/lib_models_package-info-cache_package-info.js.html +0 -661
  74. package/docs/build/files/lib_models_per-bundle-addon-cache_addon-proxy.js.html +0 -252
  75. package/docs/build/files/lib_models_per-bundle-addon-cache_index.js.html +0 -485
  76. package/docs/build/files/lib_models_per-bundle-addon-cache_target-instance.js.html +0 -108
  77. package/docs/build/files/lib_models_project.js.html +0 -913
  78. package/docs/build/files/lib_models_task.js.html +0 -117
  79. package/docs/build/files/lib_tasks_build-watch.js.html +0 -157
  80. package/docs/build/files/lib_tasks_npm-task.js.html +0 -463
  81. package/docs/build/files/lib_tasks_serve.js.html +0 -207
  82. package/docs/build/files/lib_tasks_server_middleware_broccoli-serve-files_index.js.html +0 -127
  83. package/docs/build/files/lib_tasks_server_middleware_broccoli-watcher_index.js.html +0 -158
  84. package/docs/build/files/lib_tasks_server_middleware_history-support_index.js.html +0 -181
  85. package/docs/build/files/lib_tasks_server_middleware_tests-server_index.js.html +0 -171
  86. package/docs/build/files/lib_tasks_test-server.js.html +0 -167
  87. package/docs/build/files/lib_tasks_transforms_amd_index.js.html +0 -143
  88. package/docs/build/files/lib_utilities_ember-app-utils.js.html +0 -292
  89. package/docs/build/files/lib_utilities_insert-into-file.js.html +0 -219
  90. package/docs/build/files/lib_utilities_is-lazy-engine.js.html +0 -125
  91. package/docs/build/files/lib_utilities_is-yarn-project.js.html +0 -120
  92. package/docs/build/files/lib_utilities_valid-project-name.js.html +0 -142
  93. package/docs/build/files/lib_utilities_will-interrupt-process.js.html +0 -290
  94. package/docs/build/files/lib_utilities_windows-admin.js.html +0 -230
  95. package/docs/build/index.html +0 -125
  96. package/docs/build/modules/ember-cli.html +0 -152
  97. package/docs/build/modules/is-lazy-engine.html +0 -106
  98. package/docs/build-concurrency.md +0 -15
  99. package/docs/build-pipeline-debugging.md +0 -33
  100. package/docs/code-coverage.md +0 -14
  101. package/docs/error-propagation.md +0 -136
  102. package/docs/experiments.md +0 -53
  103. package/docs/node-support.md +0 -43
  104. package/docs/perf-guide.md +0 -250
  105. package/docs/project_version_preprocessor.js +0 -8
  106. package/docs/sourcemaps.md +0 -60
  107. package/docs/yuidoc.json +0 -13
@@ -1,428 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>lib/models/host-info-cache.js - ember-cli</title>
6
- <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
7
- <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
8
- <script src="https://cdnjs.cloudflare.com/ajax/libs/yui/3.18.0/yui/yui-min.js"></script>
9
- </head>
10
- <body class="yui3-skin-sam">
11
-
12
- <div id="doc">
13
- <div class="yui3-g">
14
- <div id="sidebar" class="yui3-u">
15
- <div class="logo">
16
- <a href="../index.html">
17
- <img src="https://ember-cli.com/assets/images/ember-cli-logo-small-dark.png">
18
- </a>
19
- </div>
20
-
21
- <div id="modules" class="sidebox">
22
- <div class="hd">
23
- <h2 class="no-toc">Modules</h2>
24
- </div>
25
- <div class="bd">
26
- <ul>
27
- <li><a href="../modules/ember-cli.html">ember-cli</a>
28
- </li>
29
- <li><a href="../modules/is-lazy-engine.html">is-lazy-engine</a>
30
- </li>
31
- </ul>
32
- </div>
33
- </div>
34
-
35
- <div id="classes" class="sidebox">
36
- <div class="hd">
37
- <h2 class="no-toc">Classes</h2>
38
- </div>
39
- <div class="bd">
40
- <ul>
41
- <li><a href="../classes/Addon.html">Addon</a></li>
42
- <li><a href="../classes/AmdTransformAddon.html">AmdTransformAddon</a></li>
43
- <li><a href="../classes/Blueprint.html">Blueprint</a></li>
44
- <li><a href="../classes/Builder.html">Builder</a></li>
45
- <li><a href="../classes/CLI.html">CLI</a></li>
46
- <li><a href="../classes/Command.html">Command</a></li>
47
- <li><a href="../classes/DefaultPackager.html">DefaultPackager</a></li>
48
- <li><a href="../classes/EmberAddon.html">EmberAddon</a></li>
49
- <li><a href="../classes/EmberApp.html">EmberApp</a></li>
50
- <li><a href="../classes/HardwareInfo.html">HardwareInfo</a></li>
51
- <li><a href="../classes/HistorySupportAddon.html">HistorySupportAddon</a></li>
52
- <li><a href="../classes/Instrumentation.html">Instrumentation</a></li>
53
- <li><a href="../classes/NodeModulesList.html">NodeModulesList</a></li>
54
- <li><a href="../classes/NpmTask.html">NpmTask</a></li>
55
- <li><a href="../classes/PackageInfo.html">PackageInfo</a></li>
56
- <li><a href="../classes/PackageInfoCache.html">PackageInfoCache</a></li>
57
- <li><a href="../classes/PerBundleAddonCache {.html">PerBundleAddonCache {</a></li>
58
- <li><a href="../classes/Project.html">Project</a></li>
59
- <li><a href="../classes/ServeFilesAddon.html">ServeFilesAddon</a></li>
60
- <li><a href="../classes/TestsServerAddon.html">TestsServerAddon</a></li>
61
- <li><a href="../classes/WatcherAddon.html">WatcherAddon</a></li>
62
- <li><a href="../classes/WindowsSymlinkChecker.html">WindowsSymlinkChecker</a></li>
63
- </ul>
64
- </div>
65
- </div>
66
-
67
-
68
-
69
-
70
-
71
- <div class="version-info">
72
- Version: 4.0.0-release-b4cbb1029f
73
- </div>
74
-
75
- </div>
76
-
77
- <div id="main" class="yui3-u">
78
- <div class="content"><div class="title">
79
- <h1 class="file-name">lib/models/host-info-cache.js</h1>
80
- </div>
81
-
82
- <pre class="code prettyprint linenums">
83
- &#x27;use strict&#x27;;
84
-
85
- function allPkgInfosEqualAtIndex(paths, index) {
86
- const itemToCheck = paths[0][index];
87
- return paths.every((pathToLazyEngine) =&gt; pathToLazyEngine[index] === itemToCheck);
88
- }
89
-
90
- class HostInfoCache {
91
- constructor(project) {
92
- this.project = project;
93
- this._bundledPackageInfoCache = new Map();
94
- this._hostAddonInfoCache = new Map();
95
- this._lcaHostCache = new Map();
96
- }
97
-
98
- /**
99
- * Given a path (calculated as part of &#x60;getHostAddonInfo&#x60;), return the correct
100
- * &quot;bundle host&quot;. A bundle host is considered the project or lazy engine.
101
- *
102
- * For example, given the following package structure:
103
- *
104
- * --Project--
105
- * / \
106
- * / \
107
- * Lazy Engine A \
108
- * Addon A
109
- * |
110
- * |
111
- * Lazy Engine B
112
- * / \
113
- * / \
114
- * Lazy Engine A Lazy Engine C
115
- *
116
- * The provided paths for lazy engine A would look like:
117
- *
118
- * - [Project]
119
- * - [Project, Addon A, Lazy Engine B]
120
- *
121
- * For this project structure, this function would return [Project, [Project]]
122
- *
123
- * Similarly, given the following project structure:
124
- *
125
- * --Project--
126
- * / \
127
- * / \
128
- * Lazy Engine A \
129
- * / Lazy Engine B
130
- * / |
131
- * / |
132
- * Lazy Engine C Lazy Engine C
133
- *
134
- * The provided paths for lazy engine C would look like:
135
- *
136
- * - [Project, Lazy Engine A]
137
- * - [Project, Lazy Engine B]
138
- *
139
- * In this case, the host is the project and would also return [Project, [Project]]
140
- *
141
- * @method _findNearestBundleHost
142
- * @param {Array&lt;PackageInfo[]&gt;} paths The found paths to a given bundle host
143
- * @return {[PackageInfo, PackageInfo[]]}
144
- * @private
145
- */
146
- _findNearestBundleHost(paths, pkgInfoForLazyEngine) {
147
- // building an engine in isolation (it&#x27;s considered the project, but it&#x27;s
148
- // also added as a dependency to the project by &#x60;ember-cli&#x60;)
149
- if (this.project._packageInfo === pkgInfoForLazyEngine) {
150
- return [this.project._packageInfo, [this.project._packageInfo]];
151
- }
152
-
153
- const shortestPath = paths.reduce(
154
- (acc, pathToLazyEngine) =&gt; Math.min(acc, pathToLazyEngine.length),
155
- Number.POSITIVE_INFINITY
156
- );
157
-
158
- const pathsEqualToShortest = paths.filter((pathToLazyEngine) =&gt; pathToLazyEngine.length === shortestPath);
159
- const [firstPath] = pathsEqualToShortest;
160
-
161
- for (let i = firstPath.length - 1; i &gt;= 0; i--) {
162
- const pkgInfo = firstPath[i];
163
-
164
- if (pkgInfo.isForBundleHost() &amp;&amp; allPkgInfosEqualAtIndex(pathsEqualToShortest, i)) {
165
- return [pkgInfo, firstPath.slice(0, i + 1)];
166
- }
167
- }
168
-
169
- // this should _never_ be triggered
170
- throw new Error(
171
- &#x60;[ember-cli] Could not find a common host for: \&#x60;${pkgInfoForLazyEngine.name}\&#x60; (located at \&#x60;${pkgInfoForLazyEngine.realPath}\&#x60;)&#x60;
172
- );
173
- }
174
-
175
- /**
176
- * Returns a &#x60;Set&#x60; of package-info objects that a given bundle host is
177
- * _directly_ responsible for bundling (i.e., it excludes other bundle
178
- * hosts/lazy engines when it encounters these)
179
- *
180
- * @method _getBundledPackageInfos
181
- * @param {PackageInfo} pkgInfoToStartAt
182
- * @return {Set&lt;PackageInfo&gt;}
183
- * @private
184
- */
185
- _getBundledPackageInfos(pkgInfoToStartAt) {
186
- let pkgInfos = this._bundledPackageInfoCache.get(pkgInfoToStartAt);
187
-
188
- if (pkgInfos) {
189
- return pkgInfos;
190
- }
191
-
192
- if (!pkgInfoToStartAt.isForBundleHost()) {
193
- throw new Error(
194
- &#x60;[ember-cli] \&#x60;${pkgInfoToStartAt.name}\&#x60; is not a bundle host; \&#x60;getBundledPackageInfos\&#x60; should only be used to find bundled package infos for a project or lazy engine&#x60;
195
- );
196
- }
197
-
198
- pkgInfos = new Set();
199
- this._bundledPackageInfoCache.set(pkgInfoToStartAt, pkgInfos);
200
-
201
- let findAddons = (currentPkgInfo) =&gt; {
202
- if (!currentPkgInfo.valid || !currentPkgInfo.addonMainPath) {
203
- return;
204
- }
205
-
206
- if (pkgInfos.has(currentPkgInfo)) {
207
- return;
208
- }
209
-
210
- if (currentPkgInfo.isForBundleHost()) {
211
- return;
212
- }
213
-
214
- pkgInfos.add(currentPkgInfo);
215
-
216
- let addonPackageList = currentPkgInfo.discoverAddonAddons();
217
- addonPackageList.forEach((pkgInfo) =&gt; findAddons(pkgInfo));
218
- };
219
-
220
- let addonPackageList = pkgInfoToStartAt.project
221
- ? pkgInfoToStartAt.discoverProjectAddons()
222
- : pkgInfoToStartAt.discoverAddonAddons();
223
-
224
- addonPackageList.forEach((pkgInfo) =&gt; findAddons(pkgInfo));
225
-
226
- return pkgInfos;
227
- }
228
-
229
- /**
230
- * This function intends to return a common host for a bundle host (lazy engine). The root
231
- * package info should be the starting point (i.e., the project&#x27;s package info). We do this
232
- * by performing a breadth-first traversal until we find the intended lazy engine (represented
233
- * as a package-info &amp; the 1st argument passed to this function). As part of the traversal, we keep
234
- * track of all paths to said engine; then, once we find the intended engine we use this to determine
235
- * the nearest common host amongst all shortest paths.
236
- *
237
- * Some context:
238
- *
239
- * For a given engine/bundle host, this finds the lowest common ancestor that is considered a
240
- * host amongst _all_ engines by the same name in the project.
241
- *
242
- * For example, given the following package structure:
243
- *
244
- * --Project--
245
- * / \
246
- * / \
247
- * Lazy Engine A \
248
- * Addon A
249
- * |
250
- * |
251
- * Lazy Engine B
252
- * / \
253
- * / \
254
- * Lazy Engine A Lazy Engine C
255
- *
256
- * - The LCA host for Lazy Engine A is the project
257
- * - The LCA host for Lazy Engine B is the project
258
- * - The LCA host for Lazy Engine C is Lazy Engine B
259
- *
260
- * This also returns &#x60;hostAndAncestorBundledPackageInfos&#x60;, which are all bundled addons above a given host:
261
- *
262
- * - &#x60;hostAndAncestorBundledPackageInfos&#x60; for lazy engine A includes all non-lazy dependencies of its LCA host &amp; above (in this case, just the project)
263
- * - &#x60;hostAndAncestorBundledPackageInfos&#x60; for lazy engine B includes all non-lazy dependencies of its LCA host &amp; above (in this case, just the project)
264
- * - &#x60;hostAndAncestorBundledPackageInfos&#x60; for lazy engine C includes non-lazy deps of lazy engine B &amp; non-lazy deps of the project (LCA host &amp; above)
265
- *
266
- * This is intended to mimic the behavior of &#x60;ancestorHostAddons&#x60; in &#x60;ember-engines&#x60;:
267
- * https://github.com/ember-engines/ember-engines/blob/master/packages/ember-engines/lib/engine-addon.js#L333
268
- *
269
- * Unfortunately, we can&#x27;t easily repurpose the logic in &#x60;ember-engines&#x60; since the algorithm has to be different;
270
- * in &#x60;ember-engines&#x60; we need access to the actual addon instance, however, this is intended to be used _during_
271
- * addon instantiation, so we only have access to package-info objects. In having said this, we _can_ repurpose
272
- * the &#x60;hostPackageInfo&#x60; to determine the LCA host; see below &#x60;findLCAHost&#x60;.
273
- *
274
- * @method getHostAddonInfo
275
- * @param {PackageInfo} packageInfoForLazyEngine
276
- * @return {{ hostPackageInfo: PackageInfo, hostAndAncestorBundledPackageInfos: Set&lt;PackageInfo&gt; }}
277
- */
278
- getHostAddonInfo(packageInfoForLazyEngine) {
279
- const cacheKey = &#x60;${this.project._packageInfo.realPath}-${packageInfoForLazyEngine.realPath}&#x60;;
280
-
281
- let hostInfoCacheEntry = this._hostAddonInfoCache.get(cacheKey);
282
-
283
- if (hostInfoCacheEntry) {
284
- return hostInfoCacheEntry;
285
- }
286
-
287
- if (!packageInfoForLazyEngine.isForEngine()) {
288
- throw new Error(
289
- &#x60;[ember-cli] \&#x60;${packageInfoForLazyEngine.name}\&#x60; is not an engine; \&#x60;getHostAddonInfo\&#x60; should only be used to find host information about engines&#x60;
290
- );
291
- }
292
-
293
- const queue = [{ pkgInfo: this.project._packageInfo, path: [] }];
294
- const visited = new Set();
295
- const foundPaths = [];
296
-
297
- while (queue.length) {
298
- const { pkgInfo: currentPackageInfo, path } = queue.shift();
299
-
300
- const {
301
- addonMainPath,
302
- inRepoAddons = [],
303
- dependencyPackages = {},
304
- devDependencyPackages = {},
305
- } = currentPackageInfo;
306
-
307
- const isCurrentPackageInfoProject = this.project._packageInfo === currentPackageInfo;
308
-
309
- // don&#x27;t process non-ember addons
310
- if (!isCurrentPackageInfoProject &amp;&amp; typeof addonMainPath !== &#x27;string&#x27;) {
311
- continue;
312
- }
313
-
314
- // store found paths
315
- if (currentPackageInfo === packageInfoForLazyEngine) {
316
- foundPaths.push([...path]);
317
- }
318
-
319
- // don&#x27;t process a given &#x60;PackageInfo&#x60; object more than once
320
- if (!visited.has(currentPackageInfo)) {
321
- visited.add(currentPackageInfo);
322
-
323
- // add current package info to current path
324
- path.push(currentPackageInfo);
325
-
326
- queue.push(
327
- ...[
328
- ...inRepoAddons,
329
- ...Object.values(dependencyPackages),
330
- ...Object.values(devDependencyPackages),
331
- ].map((pkgInfo) =&gt; ({ pkgInfo, path: [...path] }))
332
- );
333
- }
334
- }
335
-
336
- const [hostPackageInfo, foundPath] = this._findNearestBundleHost(foundPaths, packageInfoForLazyEngine);
337
-
338
- const hostAndAncestorBundledPackageInfos = foundPath
339
- .filter((pkgInfo) =&gt; pkgInfo.isForBundleHost())
340
- .reduce((acc, curr) =&gt; {
341
- acc.push(...this._getBundledPackageInfos(curr));
342
- return acc;
343
- }, []);
344
-
345
- hostInfoCacheEntry = {
346
- hostPackageInfo,
347
- hostAndAncestorBundledPackageInfos: new Set(hostAndAncestorBundledPackageInfos),
348
- };
349
-
350
- this._hostAddonInfoCache.set(cacheKey, hostInfoCacheEntry);
351
- return hostInfoCacheEntry;
352
- }
353
-
354
- /**
355
- * This returns the LCA host for a given engine; we use the associated package info
356
- * to compute this (see &#x60;getHostAddonInfo&#x60; above); this finds the lowest common ancestor
357
- * that is considered a host amongst _all_ engines by the same name in the project. This
358
- * function is intended to replace the original behavior in &#x60;ember-engines&#x60;.
359
- *
360
- * For more info, see the original implementation here:
361
- *
362
- * https://github.com/ember-engines/ember-engines/blob/master/packages/ember-engines/lib/utils/find-lca-host.js
363
- *
364
- * @method findLCAHost
365
- * @param {EngineAddon} engineInstance
366
- * @return {EngineAddon|EmberApp}
367
- */
368
- findLCAHost(engineInstance) {
369
- // only compute once for a given engine
370
- // we&#x27;re using the engine name as the cache key here because regardless of its
371
- // version, lazy engines will always get output to: &#x60;engines-dist/${engineName}&#x60;
372
- let lcaHost = this._lcaHostCache.get(engineInstance.name);
373
-
374
- if (lcaHost) {
375
- return lcaHost;
376
- }
377
-
378
- if (!engineInstance._packageInfo.isForEngine()) {
379
- throw new Error(
380
- &#x60;[ember-cli] \&#x60;findLCAHost\&#x60; should only be used for engines; \&#x60;${engineInstance.name}\&#x60; is not an engine&#x60;
381
- );
382
- }
383
-
384
- const { hostPackageInfo } = this.getHostAddonInfo(engineInstance._packageInfo);
385
-
386
- let curr = engineInstance;
387
-
388
- while (curr &amp;&amp; curr.parent) {
389
- if (curr.app) {
390
- lcaHost = curr.app;
391
- break;
392
- }
393
-
394
- if (curr._packageInfo === hostPackageInfo) {
395
- lcaHost = curr;
396
- break;
397
- }
398
-
399
- curr = curr.parent;
400
- }
401
-
402
- if (lcaHost) {
403
- this._lcaHostCache.set(engineInstance.name, lcaHost);
404
- return lcaHost;
405
- }
406
-
407
- // this should _never_ be triggered
408
- throw new Error(
409
- &#x60;[ember-cli] Could not find an LCA host for: \&#x60;${engineInstance.name}\&#x60; (located at \&#x60;${
410
- engineInstance.packageRoot || engineInstance.root
411
- }\&#x60;)&#x60;
412
- );
413
- }
414
- }
415
-
416
- module.exports = HostInfoCache;
417
-
418
- </pre>
419
-
420
- </div>
421
- </div>
422
- </div>
423
- </div>
424
- <script src="../assets/vendor/prettify/prettify-min.js"></script>
425
- <script>prettyPrint();</script>
426
- <script src="../assets/js/yui-prettify.js"></script>
427
- </body>
428
- </html>
@@ -1,181 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>lib/models/installation-checker.js - ember-cli</title>
6
- <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
7
- <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
8
- <script src="https://cdnjs.cloudflare.com/ajax/libs/yui/3.18.0/yui/yui-min.js"></script>
9
- </head>
10
- <body class="yui3-skin-sam">
11
-
12
- <div id="doc">
13
- <div class="yui3-g">
14
- <div id="sidebar" class="yui3-u">
15
- <div class="logo">
16
- <a href="../index.html">
17
- <img src="https://ember-cli.com/assets/images/ember-cli-logo-small-dark.png">
18
- </a>
19
- </div>
20
-
21
- <div id="modules" class="sidebox">
22
- <div class="hd">
23
- <h2 class="no-toc">Modules</h2>
24
- </div>
25
- <div class="bd">
26
- <ul>
27
- <li><a href="../modules/ember-cli.html">ember-cli</a>
28
- </li>
29
- <li><a href="../modules/is-lazy-engine.html">is-lazy-engine</a>
30
- </li>
31
- </ul>
32
- </div>
33
- </div>
34
-
35
- <div id="classes" class="sidebox">
36
- <div class="hd">
37
- <h2 class="no-toc">Classes</h2>
38
- </div>
39
- <div class="bd">
40
- <ul>
41
- <li><a href="../classes/Addon.html">Addon</a></li>
42
- <li><a href="../classes/AmdTransformAddon.html">AmdTransformAddon</a></li>
43
- <li><a href="../classes/Blueprint.html">Blueprint</a></li>
44
- <li><a href="../classes/Builder.html">Builder</a></li>
45
- <li><a href="../classes/CLI.html">CLI</a></li>
46
- <li><a href="../classes/Command.html">Command</a></li>
47
- <li><a href="../classes/DefaultPackager.html">DefaultPackager</a></li>
48
- <li><a href="../classes/EmberAddon.html">EmberAddon</a></li>
49
- <li><a href="../classes/EmberApp.html">EmberApp</a></li>
50
- <li><a href="../classes/HardwareInfo.html">HardwareInfo</a></li>
51
- <li><a href="../classes/HistorySupportAddon.html">HistorySupportAddon</a></li>
52
- <li><a href="../classes/Instrumentation.html">Instrumentation</a></li>
53
- <li><a href="../classes/NodeModulesList.html">NodeModulesList</a></li>
54
- <li><a href="../classes/NpmTask.html">NpmTask</a></li>
55
- <li><a href="../classes/PackageInfo.html">PackageInfo</a></li>
56
- <li><a href="../classes/PackageInfoCache.html">PackageInfoCache</a></li>
57
- <li><a href="../classes/PerBundleAddonCache {.html">PerBundleAddonCache {</a></li>
58
- <li><a href="../classes/Project.html">Project</a></li>
59
- <li><a href="../classes/ServeFilesAddon.html">ServeFilesAddon</a></li>
60
- <li><a href="../classes/TestsServerAddon.html">TestsServerAddon</a></li>
61
- <li><a href="../classes/WatcherAddon.html">WatcherAddon</a></li>
62
- <li><a href="../classes/WindowsSymlinkChecker.html">WindowsSymlinkChecker</a></li>
63
- </ul>
64
- </div>
65
- </div>
66
-
67
-
68
-
69
-
70
-
71
- <div class="version-info">
72
- Version: 4.0.0-release-b4cbb1029f
73
- </div>
74
-
75
- </div>
76
-
77
- <div id="main" class="yui3-u">
78
- <div class="content"><div class="title">
79
- <h1 class="file-name">lib/models/installation-checker.js</h1>
80
- </div>
81
-
82
- <pre class="code prettyprint linenums">
83
- &#x27;use strict&#x27;;
84
-
85
- const logger = require(&#x27;heimdalljs-logger&#x27;)(&#x27;ember-cli:installation-checker&#x27;);
86
- const fs = require(&#x27;fs-extra&#x27;);
87
- const path = require(&#x27;path&#x27;);
88
- const SilentError = require(&#x27;silent-error&#x27;);
89
-
90
- class InstallationChecker {
91
- constructor(options) {
92
- this.project = options.project;
93
- }
94
-
95
- /**
96
- * Check if npm and bower installation directories are present,
97
- * and raise an error message with instructions on how to proceed.
98
- *
99
- * If some of these package managers aren&#x27;t being used in the project
100
- * we just ignore them. Their usage is considered by checking the
101
- * presence of your manifest files: package.json for npm and bower.json for bower.
102
- *
103
- * @method checkInstallations
104
- */
105
- checkInstallations() {
106
- let commands = [];
107
-
108
- if (this.usingNpm() &amp;&amp; this.npmDependenciesNotPresent()) {
109
- logger.info(&#x27;npm dependencies not installed&#x27;);
110
- const command = this.usingYarn() ? &#x27;&#x60;yarn&#x60;&#x27; : &#x27;&#x60;npm install&#x60;&#x27;;
111
- commands.push(command);
112
- }
113
-
114
- if (this.usingBower() &amp;&amp; this.bowerDependenciesNotPresent()) {
115
- logger.info(&#x27;bower dependencies not installed&#x27;);
116
- commands.push(&#x27;&#x60;bower install&#x60;&#x27;);
117
- }
118
- if (commands.length) {
119
- let commandText = commands.join(&#x27; and &#x27;);
120
- throw new SilentError(&#x60;No dependencies installed. Run ${commandText} to install missing dependencies.&#x60;);
121
- }
122
- }
123
-
124
- hasBowerDeps() {
125
- return hasDependencies(readJSON(path.join(this.project.root, &#x27;bower.json&#x27;)));
126
- }
127
-
128
- usingBower() {
129
- return fs.existsSync(path.join(this.project.root, &#x27;bower.json&#x27;)) &amp;&amp; this.hasBowerDeps();
130
- }
131
-
132
- bowerDependenciesNotPresent() {
133
- return !fs.existsSync(this.project.bowerDirectory);
134
- }
135
-
136
- hasNpmDeps() {
137
- return hasDependencies(readJSON(path.join(this.project.root, &#x27;package.json&#x27;)));
138
- }
139
-
140
- usingNpm() {
141
- return this.fileExistsInRoot(&#x27;package.json&#x27;) &amp;&amp; this.hasNpmDeps();
142
- }
143
-
144
- usingYarn() {
145
- return this.fileExistsInRoot(&#x27;yarn.lock&#x27;) &amp;&amp; this.hasNpmDeps();
146
- }
147
-
148
- fileExistsInRoot(fileName) {
149
- return fs.existsSync(path.join(this.project.root, fileName));
150
- }
151
-
152
- npmDependenciesNotPresent() {
153
- return !this.project.hasDependencies();
154
- }
155
- }
156
-
157
- module.exports = InstallationChecker;
158
-
159
- function hasDependencies(pkg) {
160
- return (pkg.dependencies &amp;&amp; pkg.dependencies.length) || (pkg.devDependencies &amp;&amp; pkg.devDependencies.length);
161
- }
162
-
163
- function readJSON(path) {
164
- try {
165
- return fs.readJsonSync(path);
166
- } catch (e) {
167
- throw new SilentError(&#x60;InstallationChecker: Unable to parse: ${path}&#x60;);
168
- }
169
- }
170
-
171
- </pre>
172
-
173
- </div>
174
- </div>
175
- </div>
176
- </div>
177
- <script src="../assets/vendor/prettify/prettify-min.js"></script>
178
- <script>prettyPrint();</script>
179
- <script src="../assets/js/yui-prettify.js"></script>
180
- </body>
181
- </html>