ember-cli 4.0.0 → 4.1.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 (114) hide show
  1. package/.github/workflows/ci.yml +4 -4
  2. package/CHANGELOG.md +42 -2
  3. package/blueprints/addon/additional-dev-dependencies.json +1 -1
  4. package/blueprints/addon/files/.github/workflows/ci.yml +0 -1
  5. package/blueprints/addon/files/.travis.yml +0 -1
  6. package/blueprints/addon/files/addon-config/ember-try.js +0 -13
  7. package/blueprints/app/files/config/environment.js +1 -1
  8. package/blueprints/app/files/package.json +6 -6
  9. package/docs/build/data.json +3 -3
  10. package/lib/models/host-info-cache.js +3 -5
  11. package/lib/models/per-bundle-addon-cache/index.js +2 -3
  12. package/lib/tasks/npm-task.js +1 -1
  13. package/lib/utilities/get-lang-arg.js +45 -45
  14. package/package.json +25 -25
  15. package/tests/helpers/mock-project.js +1 -1
  16. package/.github/ISSUE_TEMPLATE.md +0 -12
  17. package/.github/dependabot.yml +0 -15
  18. package/.github/workflows/coverage.yml +0 -31
  19. package/docs/analytics.md +0 -44
  20. package/docs/architecture.md +0 -316
  21. package/docs/assets/architecture/Ember-CLI architecture.png +0 -0
  22. package/docs/assets/architecture/Ember-CLI architecture.xml +0 -1
  23. package/docs/assets/architecture/README.md +0 -5
  24. package/docs/brocfile-transition.md +0 -46
  25. package/docs/build/api.js +0 -44
  26. package/docs/build/assets/css/external-small.png +0 -0
  27. package/docs/build/assets/css/logo.png +0 -0
  28. package/docs/build/assets/css/main.css +0 -555
  29. package/docs/build/assets/favicon.ico +0 -0
  30. package/docs/build/assets/img/spinner.gif +0 -0
  31. package/docs/build/assets/index.html +0 -10
  32. package/docs/build/assets/js/api-filter.js +0 -56
  33. package/docs/build/assets/js/api-list.js +0 -255
  34. package/docs/build/assets/js/api-search.js +0 -98
  35. package/docs/build/assets/js/apidocs.js +0 -376
  36. package/docs/build/assets/js/yui-prettify.js +0 -17
  37. package/docs/build/assets/vendor/prettify/CHANGES.html +0 -130
  38. package/docs/build/assets/vendor/prettify/COPYING +0 -202
  39. package/docs/build/assets/vendor/prettify/README.html +0 -203
  40. package/docs/build/assets/vendor/prettify/prettify-min.css +0 -1
  41. package/docs/build/assets/vendor/prettify/prettify-min.js +0 -1
  42. package/docs/build/classes/Addon.html +0 -4318
  43. package/docs/build/classes/AmdTransformAddon.html +0 -202
  44. package/docs/build/classes/Blueprint.html +0 -4796
  45. package/docs/build/classes/Builder.html +0 -611
  46. package/docs/build/classes/CLI.html +0 -810
  47. package/docs/build/classes/Command.html +0 -1655
  48. package/docs/build/classes/DefaultPackager.html +0 -202
  49. package/docs/build/classes/EmberAddon.html +0 -2207
  50. package/docs/build/classes/EmberApp.html +0 -2225
  51. package/docs/build/classes/HardwareInfo.html +0 -620
  52. package/docs/build/classes/HistorySupportAddon.html +0 -203
  53. package/docs/build/classes/Instrumentation.html +0 -695
  54. package/docs/build/classes/NodeModulesList.html +0 -460
  55. package/docs/build/classes/NpmTask.html +0 -333
  56. package/docs/build/classes/PackageInfo.html +0 -1390
  57. package/docs/build/classes/PackageInfoCache.html +0 -963
  58. package/docs/build/classes/PerBundleAddonCache {.html +0 -1010
  59. package/docs/build/classes/Project.html +0 -2083
  60. package/docs/build/classes/ServeFilesAddon.html +0 -260
  61. package/docs/build/classes/TestsServerAddon.html +0 -203
  62. package/docs/build/classes/WatcherAddon.html +0 -204
  63. package/docs/build/classes/WindowsSymlinkChecker.html +0 -1505
  64. package/docs/build/files/lib_broccoli_default-packager.js.html +0 -1426
  65. package/docs/build/files/lib_broccoli_ember-addon.js.html +0 -159
  66. package/docs/build/files/lib_broccoli_ember-app.js.html +0 -1913
  67. package/docs/build/files/lib_cli_cli.js.html +0 -417
  68. package/docs/build/files/lib_models_addon-info.js.html +0 -112
  69. package/docs/build/files/lib_models_addon.js.html +0 -1866
  70. package/docs/build/files/lib_models_blueprint.js.html +0 -1678
  71. package/docs/build/files/lib_models_builder.js.html +0 -417
  72. package/docs/build/files/lib_models_command.js.html +0 -804
  73. package/docs/build/files/lib_models_hardware-info.js.html +0 -479
  74. package/docs/build/files/lib_models_host-info-cache.js.html +0 -428
  75. package/docs/build/files/lib_models_installation-checker.js.html +0 -181
  76. package/docs/build/files/lib_models_instantiate-addons.js.html +0 -191
  77. package/docs/build/files/lib_models_instrumentation.js.html +0 -433
  78. package/docs/build/files/lib_models_package-info-cache_index.js.html +0 -793
  79. package/docs/build/files/lib_models_package-info-cache_node-modules-list.js.html +0 -208
  80. package/docs/build/files/lib_models_package-info-cache_package-info.js.html +0 -661
  81. package/docs/build/files/lib_models_per-bundle-addon-cache_addon-proxy.js.html +0 -252
  82. package/docs/build/files/lib_models_per-bundle-addon-cache_index.js.html +0 -485
  83. package/docs/build/files/lib_models_per-bundle-addon-cache_target-instance.js.html +0 -108
  84. package/docs/build/files/lib_models_project.js.html +0 -913
  85. package/docs/build/files/lib_models_task.js.html +0 -117
  86. package/docs/build/files/lib_tasks_build-watch.js.html +0 -157
  87. package/docs/build/files/lib_tasks_npm-task.js.html +0 -463
  88. package/docs/build/files/lib_tasks_serve.js.html +0 -207
  89. package/docs/build/files/lib_tasks_server_middleware_broccoli-serve-files_index.js.html +0 -127
  90. package/docs/build/files/lib_tasks_server_middleware_broccoli-watcher_index.js.html +0 -158
  91. package/docs/build/files/lib_tasks_server_middleware_history-support_index.js.html +0 -181
  92. package/docs/build/files/lib_tasks_server_middleware_tests-server_index.js.html +0 -171
  93. package/docs/build/files/lib_tasks_test-server.js.html +0 -167
  94. package/docs/build/files/lib_tasks_transforms_amd_index.js.html +0 -143
  95. package/docs/build/files/lib_utilities_ember-app-utils.js.html +0 -292
  96. package/docs/build/files/lib_utilities_insert-into-file.js.html +0 -219
  97. package/docs/build/files/lib_utilities_is-lazy-engine.js.html +0 -125
  98. package/docs/build/files/lib_utilities_is-yarn-project.js.html +0 -120
  99. package/docs/build/files/lib_utilities_valid-project-name.js.html +0 -142
  100. package/docs/build/files/lib_utilities_will-interrupt-process.js.html +0 -290
  101. package/docs/build/files/lib_utilities_windows-admin.js.html +0 -230
  102. package/docs/build/index.html +0 -125
  103. package/docs/build/modules/ember-cli.html +0 -152
  104. package/docs/build/modules/is-lazy-engine.html +0 -106
  105. package/docs/build-concurrency.md +0 -15
  106. package/docs/build-pipeline-debugging.md +0 -33
  107. package/docs/code-coverage.md +0 -14
  108. package/docs/error-propagation.md +0 -136
  109. package/docs/experiments.md +0 -53
  110. package/docs/node-support.md +0 -43
  111. package/docs/perf-guide.md +0 -250
  112. package/docs/project_version_preprocessor.js +0 -8
  113. package/docs/sourcemaps.md +0 -60
  114. package/docs/yuidoc.json +0 -13
@@ -1,479 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>lib/models/hardware-info.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/hardware-info.js</h1>
80
- </div>
81
-
82
- <pre class="code prettyprint linenums">
83
- &#x27;use strict&#x27;;
84
-
85
- const execa = require(&#x27;execa&#x27;);
86
- const fs = require(&#x27;fs&#x27;);
87
- const logger = require(&#x27;heimdalljs-logger&#x27;)(&#x27;ember-cli:hardware-info&#x27;);
88
- const os = require(&#x27;os&#x27;);
89
-
90
- function isUsingBatteryAcpi() {
91
- try {
92
- const { stdout } = execa.sync(&#x27;acpi&#x27;, [&#x27;--ac-adapter&#x27;]);
93
- const lines = stdout.split(&#x27;\n&#x27;).filter(Boolean);
94
-
95
- return lines.every((line) =&gt; /off-line/.test(line));
96
- } catch (ex) {
97
- logger.warn(&#x60;Could not get battery status from acpi: ${ex}&#x60;);
98
- logger.warn(ex.stack);
99
-
100
- return null;
101
- }
102
- }
103
-
104
- function isUsingBatteryApm() {
105
- try {
106
- const { stdout } = execa.sync(&#x27;apm&#x27;, [&#x27;-a&#x27;]);
107
-
108
- return parseInt(stdout, 10) === 0;
109
- } catch (ex) {
110
- logger.warn(&#x60;Could not get battery status from apm: ${ex}&#x60;);
111
- logger.warn(ex.stack);
112
-
113
- return null;
114
- }
115
- }
116
-
117
- function isUsingBatteryBsd() {
118
- const apm = isUsingBatteryApm();
119
-
120
- if (apm !== null) {
121
- return apm;
122
- }
123
-
124
- return isUsingBatteryUpower();
125
- }
126
-
127
- function isUsingBatteryDarwin() {
128
- try {
129
- const { stdout } = execa.sync(&#x27;pmset&#x27;, [&#x27;-g&#x27;, &#x27;batt&#x27;]);
130
-
131
- return stdout.indexOf(&#x27;Battery Power&#x27;) !== -1;
132
- } catch (ex) {
133
- logger.warn(&#x60;Could not get battery status from pmset: ${ex}&#x60;);
134
- logger.warn(ex.stack);
135
-
136
- return null;
137
- }
138
- }
139
-
140
- function isUsingBatteryLinux() {
141
- const sysClassPowerSupply = isUsingBatterySysClassPowerSupply();
142
-
143
- if (sysClassPowerSupply !== null) {
144
- return sysClassPowerSupply;
145
- }
146
-
147
- const acpi = isUsingBatteryAcpi();
148
-
149
- if (acpi !== null) {
150
- return acpi;
151
- }
152
-
153
- return isUsingBatteryUpower();
154
- }
155
-
156
- function isUsingBatterySysClassPowerSupply() {
157
- try {
158
- const value = fs.readFileSync(&#x27;/sys/class/power_supply/AC/online&#x27;);
159
-
160
- return parseInt(value, 10) === 0;
161
- } catch (ex) {
162
- logger.warn(&#x60;Could not get battery status from /sys/class/power_supply: ${ex}&#x60;);
163
- logger.warn(ex.stack);
164
-
165
- return null;
166
- }
167
- }
168
-
169
- function isUsingBatteryUpower() {
170
- try {
171
- const { stdout } = execa.sync(&#x27;upower&#x27;, [&#x27;--enumerate&#x27;]);
172
- const devices = stdout.split(&#x27;\n&#x27;).filter(Boolean);
173
-
174
- return devices.some((device) =&gt; {
175
- const { stdout } = execa.sync(&#x27;upower&#x27;, [&#x27;--show-info&#x27;, device]);
176
-
177
- return /\bpower supply:\s+yes\b/.test(stdout) &amp;&amp; /\bstate:\s+discharging\b/.test(stdout);
178
- });
179
- } catch (ex) {
180
- logger.warn(&#x60;Could not get battery status from upower: ${ex}&#x60;);
181
- logger.warn(ex.stack);
182
-
183
- return null;
184
- }
185
- }
186
-
187
- function isUsingBatteryWindows() {
188
- try {
189
- const { stdout } = execa.sync(&#x27;wmic&#x27;, [
190
- &#x27;/namespace:&#x27;,
191
- &#x27;\\\\root\\WMI&#x27;,
192
- &#x27;path&#x27;,
193
- &#x27;BatteryStatus&#x27;,
194
- &#x27;get&#x27;,
195
- &#x27;PowerOnline&#x27;,
196
- &#x27;/format:list&#x27;,
197
- ]);
198
-
199
- return /\bPowerOnline=FALSE\b/.test(stdout);
200
- } catch (ex) {
201
- logger.warn(&#x60;Could not get battery status from wmic: ${ex}&#x60;);
202
- logger.warn(ex.stack);
203
-
204
- return null;
205
- }
206
- }
207
-
208
- function memorySwapUsedDarwin() {
209
- try {
210
- const { stdout } = execa.sync(&#x27;sysctl&#x27;, [&#x27;vm.swapusage&#x27;]);
211
- const match = /\bused = (\d+\.\d+)M\b/.exec(stdout);
212
-
213
- if (!match) {
214
- throw new Error(&#x27;vm.swapusage not in output.&#x27;);
215
- }
216
-
217
- // convert from fractional megabytes to bytes
218
- return parseFloat(match[1]) * 1048576;
219
- } catch (ex) {
220
- logger.warn(&#x60;Could not get swap status from sysctl: ${ex}&#x60;);
221
- logger.warn(ex.stack);
222
-
223
- return null;
224
- }
225
- }
226
-
227
- function memorySwapUsedBsd() {
228
- try {
229
- const { stdout } = execa.sync(&#x27;pstat&#x27;, [&#x27;-s&#x27;]);
230
- const devices = stdout.split(&#x27;\n&#x27;).filter(Boolean);
231
- const header = devices.shift();
232
- const match = /^Device\s+(\d+)(K?)-blocks\s+Used\b/.exec(header);
233
-
234
- if (!match) {
235
- throw new Error(&#x27;Block size not found in output.&#x27;);
236
- }
237
-
238
- const blockSize = parseInt(match[1], 10) * (match[2] === &#x27;K&#x27; ? 1024 : 1);
239
-
240
- return devices.reduce((total, line) =&gt; {
241
- const match = /^\S+\s+\d+\s+(\d+)/.exec(line);
242
-
243
- if (!match) {
244
- throw new Error(&#x60;Unrecognized line in output: &#x27;${line}&#x27;&#x60;);
245
- }
246
-
247
- return total + parseInt(match[1], 10) * blockSize;
248
- }, 0);
249
- } catch (ex) {
250
- logger.warn(&#x60;Could not get swap status from pstat: ${ex}&#x60;);
251
- logger.warn(ex.stack);
252
-
253
- return null;
254
- }
255
- }
256
-
257
- function memorySwapUsedLinux() {
258
- try {
259
- const { stdout } = execa.sync(&#x27;free&#x27;, [&#x27;-b&#x27;]);
260
- const lines = stdout.split(&#x27;\n&#x27;).filter(Boolean);
261
- const header = lines.shift();
262
- const columns = header.split(/\s+/).filter(Boolean);
263
- const columnUsed = columns.reduce((columnUsed, column, index) =&gt; {
264
- if (columnUsed !== undefined) {
265
- return columnUsed;
266
- }
267
-
268
- if (/used/i.test(column)) {
269
- // there is no heading on the first column, so indices are off by 1
270
- return index + 1;
271
- }
272
- }, undefined);
273
-
274
- if (columnUsed === undefined) {
275
- throw new Error(&#x27;Could not find &quot;used&quot; column.&#x27;);
276
- }
277
-
278
- for (const line of lines) {
279
- const columns = line.split(/\s+/).filter(Boolean);
280
-
281
- if (/swap/i.test(columns[0])) {
282
- return parseInt(columns[columnUsed], 10);
283
- }
284
- }
285
-
286
- throw new Error(&#x27;Could not find &quot;swap&quot; row.&#x27;);
287
- } catch (ex) {
288
- logger.warn(&#x60;Could not get swap status from free: ${ex}&#x60;);
289
- logger.warn(ex.stack);
290
-
291
- return null;
292
- }
293
- }
294
-
295
- function memorySwapUsedWindows() {
296
- try {
297
- const { stdout } = execa.sync(&#x27;wmic&#x27;, [&#x27;PAGEFILE&#x27;, &#x27;get&#x27;, &#x27;CurrentUsage&#x27;, &#x27;/format:list&#x27;]);
298
- const match = /\bCurrentUsage=(\d+)/.exec(stdout);
299
-
300
- if (!match) {
301
- throw new Error(&#x27;Page file usage info not in output.&#x27;);
302
- }
303
-
304
- return parseInt(match[1], 10) * 1048576;
305
- } catch (ex) {
306
- logger.warn(&#x60;Could not get swap status from wmic: ${ex}&#x60;);
307
- logger.warn(ex.stack);
308
-
309
- return null;
310
- }
311
- }
312
-
313
- const hwinfo = {
314
- /**
315
- * Indicates whether the host is running on battery power. This can cause
316
- * performance degredation.
317
- *
318
- * @private
319
- * @method isUsingBattery
320
- * @for HardwareInfo
321
- * @param {String=process.platform} platform The current hardware platform.
322
- * USED FOR TESTING ONLY.
323
- * @return {null|Boolean} &#x60;true&#x60; iff the host is running on battery power or
324
- * &#x60;false&#x60; if not. &#x60;null&#x60; if the battery status
325
- * cannot be determined.
326
- */
327
- isUsingBattery(platform = process.platform) {
328
- switch (platform) {
329
- case &#x27;darwin&#x27;:
330
- return isUsingBatteryDarwin();
331
-
332
- case &#x27;freebsd&#x27;:
333
- case &#x27;openbsd&#x27;:
334
- return isUsingBatteryBsd();
335
-
336
- case &#x27;linux&#x27;:
337
- return isUsingBatteryLinux();
338
-
339
- case &#x27;win32&#x27;:
340
- return isUsingBatteryWindows();
341
- }
342
-
343
- logger.warn(&#x60;Battery status is unsupported on the &#x27;${platform}&#x27; platform.&#x60;);
344
-
345
- return null;
346
- },
347
-
348
- /**
349
- * Determines the amount of swap/virtual memory currently in use.
350
- *
351
- * @private
352
- * @method memorySwapUsed
353
- * @param {String=process.platform} platform The current hardware platform.
354
- * USED FOR TESTING ONLY.
355
- * @return {null|Number} The amount of used swap space, in bytes. &#x60;null&#x60; if
356
- * the used swap space cannot be determined.
357
- */
358
- memorySwapUsed(platform = process.platform) {
359
- switch (platform) {
360
- case &#x27;darwin&#x27;:
361
- return memorySwapUsedDarwin();
362
-
363
- case &#x27;freebsd&#x27;:
364
- case &#x27;openbsd&#x27;:
365
- return memorySwapUsedBsd();
366
-
367
- case &#x27;linux&#x27;:
368
- return memorySwapUsedLinux();
369
-
370
- case &#x27;win32&#x27;:
371
- return memorySwapUsedWindows();
372
- }
373
-
374
- logger.warn(&#x60;Swap status is unsupported on the &#x27;${platform}&#x27; platform.&#x60;);
375
-
376
- return null;
377
- },
378
-
379
- /**
380
- * Determines the total amount of memory available to the host, as from
381
- * &#x60;os.totalmem&#x60;.
382
- *
383
- * @private
384
- * @method memoryTotal
385
- * @return {Number} The total memory in bytes.
386
- */
387
- memoryTotal() {
388
- return os.totalmem();
389
- },
390
-
391
- /**
392
- * Determines the amount of memory currently being used by the current Node
393
- * process, as from &#x60;process.memoryUsage&#x60;.
394
- *
395
- * @private
396
- * @method memoryUsed
397
- * @return {Object} The Resident Set Size, as reported by
398
- * &#x60;process.memoryUsage&#x60;.
399
- */
400
- memoryUsed() {
401
- return process.memoryUsage().rss;
402
- },
403
-
404
- /**
405
- * Determines the number of logical processors available to the host, as from
406
- * &#x60;os.cpus&#x60;.
407
- *
408
- * @private
409
- * @method processorCount
410
- * @return {Number} The number of logical processors.
411
- */
412
- processorCount() {
413
- return os.cpus().length;
414
- },
415
-
416
- /**
417
- * Determines the average processor load across the system. This is
418
- * expressed as a fractional number between 0 and the number of logical
419
- * processors.
420
- *
421
- * @private
422
- * @method processorLoad
423
- * @param {String=process.platform} platform The current hardware platform.
424
- * USED FOR TESTING ONLY.
425
- * @return {Array&lt;Number&gt;} The one-, five-, and fifteen-minute processor load
426
- * averages.
427
- */
428
- processorLoad(platform = process.platform) {
429
- // The os.loadavg() call works on win32, but never returns correct
430
- // data. Better to intercept and warn that it&#x27;s unsupported.
431
- if (platform === &#x27;win32&#x27;) {
432
- logger.warn(&#x60;Processor load is unsupported on the &#x27;${platform}&#x27; platform.&#x60;);
433
-
434
- return null;
435
- }
436
-
437
- return os.loadavg();
438
- },
439
-
440
- /**
441
- * Gets the speed of the host&#x27;s processors.
442
- *
443
- * If more than one processor is found, the average of their speeds is taken.
444
- *
445
- * @private
446
- * @method processorSpeed
447
- * @return {Number} The average processor speed in MHz.
448
- */
449
- processorSpeed() {
450
- const cpus = os.cpus();
451
-
452
- return cpus.reduce((sum, cpu) =&gt; sum + cpu.speed, 0) / cpus.length;
453
- },
454
-
455
- /**
456
- * Determines the time since the host was started, as from &#x60;os.uptime&#x60;.
457
- *
458
- * @private
459
- * @method uptime
460
- * @return {Number} The number of seconds since the host was started.
461
- */
462
- uptime() {
463
- return os.uptime();
464
- },
465
- };
466
-
467
- module.exports = hwinfo;
468
-
469
- </pre>
470
-
471
- </div>
472
- </div>
473
- </div>
474
- </div>
475
- <script src="../assets/vendor/prettify/prettify-min.js"></script>
476
- <script>prettyPrint();</script>
477
- <script src="../assets/js/yui-prettify.js"></script>
478
- </body>
479
- </html>