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,417 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>lib/models/builder.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/builder.js</h1>
80
- </div>
81
-
82
- <pre class="code prettyprint linenums">
83
- &#x27;use strict&#x27;;
84
- const onProcessInterrupt = require(&#x27;../utilities/will-interrupt-process&#x27;);
85
- const fs = require(&#x27;fs-extra&#x27;);
86
- const path = require(&#x27;path&#x27;);
87
- const CoreObject = require(&#x27;core-object&#x27;);
88
- const SilentError = require(&#x27;silent-error&#x27;);
89
- const chalk = require(&#x27;chalk&#x27;);
90
- const findBuildFile = require(&#x27;../utilities/find-build-file&#x27;);
91
- const _resetTreeCache = require(&#x27;./addon&#x27;)._resetTreeCache;
92
- const Sync = require(&#x27;tree-sync&#x27;);
93
- const heimdall = require(&#x27;heimdalljs&#x27;);
94
- const progress = require(&#x27;../utilities/heimdall-progress&#x27;);
95
-
96
- /**
97
- * Wrapper for the Broccoli [Builder](https://github.com/broccolijs/broccoli/blob/master/lib/builder.js) class.
98
- *
99
- * @private
100
- * @module ember-cli
101
- * @class Builder
102
- * @constructor
103
- * @extends Task
104
- */
105
- class Builder extends CoreObject {
106
- constructor(options) {
107
- super(options);
108
-
109
- // Use Broccoli 2.0 by default, if this fails due to .read/.rebuild API, fallback to broccoli-builder
110
- this.broccoliBuilderFallback = false;
111
- this.setupBroccoliBuilder();
112
-
113
- this._instantiationStack = new Error().stack.replace(/[^\n]*\n/, &#x27;&#x27;);
114
- this._cleanup = this.cleanup.bind(this);
115
-
116
- this._cleanupStarted = false;
117
- this._onProcessInterrupt = options.onProcessInterrupt || onProcessInterrupt;
118
-
119
- this._onProcessInterrupt.addHandler(this._cleanup);
120
- }
121
-
122
- /**
123
- * @private
124
- * @method readBuildFile
125
- * @param path The file path to read the build file from
126
- */
127
- readBuildFile(path) {
128
- // Load the build file
129
- let buildFile = findBuildFile(&#x27;ember-cli-build.js&#x27;, path);
130
- if (buildFile) {
131
- return buildFile({ project: this.project });
132
- }
133
-
134
- throw new SilentError(&#x27;No ember-cli-build.js found.&#x27;);
135
- }
136
-
137
- /**
138
- * @private
139
- * @method setupBroccoliBuilder
140
- */
141
- setupBroccoliBuilder() {
142
- this.environment = this.environment || &#x27;development&#x27;;
143
- process.env.EMBER_ENV = process.env.EMBER_ENV || this.environment;
144
-
145
- this.tree = this.readBuildFile(this.project.root);
146
-
147
- let broccoli = require(&#x27;broccoli&#x27;);
148
-
149
- try {
150
- this.builder = new broccoli.Builder(this.tree);
151
- return;
152
- } catch (e) {
153
- // Catch here to trap InvalidNodeError. If this is thrown, it&#x27;s because the node provided is not valid
154
- // and likely uses the old .read/.rebuild API, so fallback to broccoli-builder that supports that API
155
- if (
156
- !(e instanceof broccoli.Builder.InvalidNodeError) ||
157
- e.message.indexOf(&#x27;The .read/.rebuild API is no longer supported as of Broccoli 1.0&#x27;) === -1
158
- ) {
159
- throw e;
160
- }
161
-
162
- // Fallback to broccoli-builder
163
- let error = &#x60;Invalid Broccoli2 node detected, falling back to broccoli-builder. Broccoli error:\n&#x60;;
164
- error += &#x60;---------------\n&#x60;;
165
- error += e.message;
166
- error += &#x60;---------------\n&#x60;;
167
- this.ui.writeWarnLine(error);
168
- }
169
-
170
- broccoli = require(&#x27;broccoli-builder&#x27;);
171
- this.broccoliBuilderFallback = true;
172
- this.builder = new broccoli.Builder(this.tree);
173
- }
174
-
175
- /**
176
- Determine whether the output path is safe to delete. If the outputPath
177
- appears anywhere in the parents of the project root, the build would
178
- delete the project directory. In this case return &#x60;false&#x60;, otherwise
179
- return &#x60;true&#x60;.
180
-
181
- @private
182
- @method canDeleteOutputPath
183
- @param {String} outputPath
184
- @return {Boolean}
185
- */
186
- canDeleteOutputPath(outputPath) {
187
- let rootPathParents = [this.project.root];
188
- let dir = path.dirname(this.project.root);
189
- rootPathParents.push(dir);
190
- while (dir !== path.dirname(dir)) {
191
- dir = path.dirname(dir);
192
- rootPathParents.push(dir);
193
- }
194
- return rootPathParents.indexOf(outputPath) === -1;
195
- }
196
-
197
- /**
198
- * @private
199
- * @method copyToOutputPath
200
- * @param {String} inputPath
201
- */
202
- copyToOutputPath(inputPath) {
203
- let outputPath = this.outputPath;
204
-
205
- fs.mkdirsSync(outputPath);
206
-
207
- if (!this.canDeleteOutputPath(outputPath)) {
208
- throw new SilentError(&#x60;Using a build destination path of \&#x60;${outputPath}\&#x60; is not supported.&#x60;);
209
- }
210
-
211
- let sync = this._sync;
212
- if (sync === undefined) {
213
- this._sync = sync = new Sync(inputPath, path.resolve(this.outputPath));
214
- }
215
-
216
- let changes = sync.sync();
217
-
218
- return changes.map((op) =&gt; op[1]);
219
- }
220
-
221
- /**
222
- * @private
223
- * @method processAddonBuildSteps
224
- * @param buildStep
225
- * @param results
226
- * @return {Promise}
227
- */
228
- processAddonBuildSteps(buildStep, results) {
229
- let addonPromises = [];
230
- if (this.project &amp;&amp; this.project.addons.length) {
231
- addonPromises = this.project.addons.reduce((sum, addon) =&gt; {
232
- let method = addon[buildStep];
233
- if (method) {
234
- let val = method.call(addon, results);
235
- if (val) {
236
- sum.push(val);
237
- }
238
- }
239
- return sum;
240
- }, []);
241
- }
242
-
243
- return Promise.all(addonPromises).then(() =&gt; results);
244
- }
245
-
246
- /**
247
- * @private
248
- * @method build
249
- * @return {Promise}
250
- */
251
- async build(addWatchDirCallback, resultAnnotation) {
252
- let buildResults, uiProgressIntervalID;
253
-
254
- try {
255
- this.project._instrumentation.start(&#x27;build&#x27;);
256
-
257
- if (addWatchDirCallback &amp;&amp; !this.broccoliBuilderFallback) {
258
- for (let path of this.builder.watchedPaths) {
259
- addWatchDirCallback(path);
260
- }
261
- }
262
-
263
- this.ui.startProgress(progress.format(progress()));
264
-
265
- uiProgressIntervalID = setInterval(() =&gt; {
266
- this.ui.spinner.text = progress.format(progress());
267
- }, this.ui.spinner.interval);
268
-
269
- await this.processAddonBuildSteps(&#x27;preBuild&#x27;);
270
-
271
- if (this.broccoliBuilderFallback) {
272
- try {
273
- buildResults = await this.builder.build(addWatchDirCallback);
274
- } catch (error) {
275
- this.throwFormattedBroccoliError(error);
276
- }
277
- } else {
278
- try {
279
- await this.builder.build();
280
-
281
- // build legacy style results object (this is passed to various addon APIs)
282
- buildResults = {
283
- directory: this.builder.outputPath,
284
- graph: this.builder.outputNodeWrapper,
285
- };
286
- } catch (error) {
287
- this.throwFormattedBroccoliError(error);
288
- }
289
- }
290
-
291
- await this.processAddonBuildSteps(&#x27;postBuild&#x27;, buildResults);
292
-
293
- let outputChanges = await this.copyToOutputPath(buildResults.directory);
294
-
295
- await this.processAddonBuildSteps(
296
- &#x27;outputReady&#x27;,
297
- Object.assign({}, buildResults, { outputChanges, directory: this.outputPath })
298
- );
299
-
300
- this.checkForPostBuildEnvironmentIssues();
301
-
302
- return buildResults;
303
- } catch (error) {
304
- await this.processAddonBuildSteps(&#x27;buildError&#x27;, error);
305
-
306
- throw error;
307
- } finally {
308
- clearInterval(uiProgressIntervalID);
309
- this.ui.stopProgress();
310
- this.project._instrumentation.stopAndReport(&#x27;build&#x27;, buildResults, resultAnnotation);
311
- this.project.configCache.clear();
312
- }
313
- }
314
-
315
- /**
316
- * Delegates to the &#x60;cleanup&#x60; method of the wrapped Broccoli builder.
317
- *
318
- * @private
319
- * @method cleanup
320
- * @return {Promise}
321
- */
322
- async cleanup() {
323
- if (!this._cleanupStarted) {
324
- this._cleanupStarted = true;
325
- let ui = this.project.ui;
326
- ui.startProgress(&#x27;cleaning up&#x27;);
327
- ui.writeLine(&#x27;cleaning up...&#x27;);
328
-
329
- // ensure any addon treeFor caches are reset
330
- _resetTreeCache();
331
-
332
- this._onProcessInterrupt.removeHandler(this._cleanup);
333
-
334
- let node = heimdall.start({ name: &#x27;Builder Cleanup&#x27; });
335
- try {
336
- await this.builder.cleanup();
337
- } catch (error) {
338
- ui.writeLine(chalk.red(&#x27;Cleanup error.&#x27;));
339
- ui.writeError(error);
340
- } finally {
341
- ui.stopProgress();
342
- node.stop();
343
- }
344
- }
345
- }
346
-
347
- /**
348
- * Checks for issues in the environment that can&#x27;t easily be detected until
349
- * after a build and issues any necessary deprecation warnings.
350
- *
351
- * - check for old (pre 0.1.4) versions of heimdalljs
352
- *
353
- * @private
354
- * @method checkForPostBuildEnvironmentIssues
355
- */
356
- checkForPostBuildEnvironmentIssues(value) {
357
- // 0.1.3 and prior used a global heimdall instance to share sessions
358
- // newer versions keep the session itself on process
359
- this.project.ui.writeDeprecateLine(
360
- &#x27;Heimdalljs &lt; 0.1.4 found. Please remove old versions of heimdalljs and reinstall (you can find them with &#x60;npm ls heimdalljs&#x60; as long as you have nothing &#x60;npm link&#x60;d). Performance instrumentation data will be incomplete until then.&#x27;,
361
- !process._heimdall
362
- );
363
-
364
- return value;
365
- }
366
-
367
- throwFormattedBroccoliError(err) {
368
- // TODO fix ember-cli/console-ui to handle current broccoli broccoliPayload
369
- let broccoliPayload = err &amp;&amp; err.broccoliPayload;
370
- if (broccoliPayload) {
371
- if (!broccoliPayload.error) {
372
- let originalError = broccoliPayload.originalError || {};
373
- let location = broccoliPayload.location || originalError.location;
374
- broccoliPayload.error = {
375
- message: originalError.message,
376
- stack: originalError.stack,
377
- errorType: originalError.type || &#x27;Build Error&#x27;,
378
- codeFrame: originalError.codeFrame || originalError.message,
379
- location: location || {},
380
- };
381
- }
382
- if (!broccoliPayload.broccoliNode) {
383
- broccoliPayload.broccoliNode = {
384
- nodeName: broccoliPayload.nodeName,
385
- nodeAnnotation: broccoliPayload.nodeAnnotation,
386
- instantiationStack: broccoliPayload.instantiationStack || &#x27;&#x27;,
387
- };
388
- }
389
- if (!broccoliPayload.versions) {
390
- let builderVersion = this.broccoliBuilderFallback
391
- ? require(&#x27;broccoli-builder/package&#x27;).version
392
- : require(&#x27;broccoli/package&#x27;).version;
393
-
394
- broccoliPayload.versions = {
395
- &#x27;broccoli-builder&#x27;: builderVersion,
396
- node: process.version,
397
- };
398
- }
399
- }
400
-
401
- throw err;
402
- }
403
- }
404
-
405
- module.exports = Builder;
406
-
407
- </pre>
408
-
409
- </div>
410
- </div>
411
- </div>
412
- </div>
413
- <script src="../assets/vendor/prettify/prettify-min.js"></script>
414
- <script>prettyPrint();</script>
415
- <script src="../assets/js/yui-prettify.js"></script>
416
- </body>
417
- </html>