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,167 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>lib/tasks/test-server.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/tasks/test-server.js</h1>
80
- </div>
81
-
82
- <pre class="code prettyprint linenums">
83
- &#x27;use strict&#x27;;
84
-
85
- const TestTask = require(&#x27;./test&#x27;);
86
- const chalk = require(&#x27;chalk&#x27;);
87
- const SilentError = require(&#x27;silent-error&#x27;);
88
-
89
- class TestServerTask extends TestTask {
90
- invokeTestem(options) {
91
- let task = this;
92
-
93
- return new Promise((resolve, reject) =&gt; {
94
- task.testem.setDefaultOptions(task.defaultOptions(options));
95
- task.testem.startDev(task.transformOptions(options), (exitCode, error) =&gt; {
96
- if (error) {
97
- reject(error);
98
- } else if (exitCode !== 0) {
99
- reject(new SilentError(&#x27;Testem finished with non-zero exit code. Tests failed.&#x27;));
100
- } else {
101
- resolve(exitCode);
102
- }
103
- });
104
- });
105
- }
106
-
107
- run(options) {
108
- let ui = this.ui;
109
- let testem = this.testem;
110
- let task = this;
111
-
112
- // The building has actually started already, but we want some output while we wait for the server
113
-
114
- return new Promise((resolve, reject) =&gt; {
115
- if (options.path) {
116
- resolve(task.invokeTestem(options));
117
- return;
118
- }
119
-
120
- ui.startProgress(chalk.green(&#x27;Building&#x27;), chalk.green(&#x27;.&#x27;));
121
-
122
- let watcher = options.watcher;
123
- let started = false;
124
-
125
- // Wait for a build and then either start or restart testem
126
- watcher.on(&#x27;change&#x27;, () =&gt; {
127
- try {
128
- if (started) {
129
- testem.restart();
130
- } else {
131
- started = true;
132
-
133
- ui.stopProgress();
134
- resolve(task.invokeTestem(options));
135
- }
136
- } catch (e) {
137
- reject(e);
138
- }
139
- });
140
- });
141
- }
142
-
143
- /**
144
- * Exit silently
145
- *
146
- * @private
147
- * @method onInterrupt
148
- */
149
- onInterrupt() {
150
- // We don&#x27;t have any hanging promise to resolve here because the SIGINT is
151
- // captured and handled by testem
152
- }
153
- }
154
-
155
- module.exports = TestServerTask;
156
-
157
- </pre>
158
-
159
- </div>
160
- </div>
161
- </div>
162
- </div>
163
- <script src="../assets/vendor/prettify/prettify-min.js"></script>
164
- <script>prettyPrint();</script>
165
- <script src="../assets/js/yui-prettify.js"></script>
166
- </body>
167
- </html>
@@ -1,143 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>lib/tasks/transforms/amd/index.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/tasks/transforms/amd/index.js</h1>
80
- </div>
81
-
82
- <pre class="code prettyprint linenums">
83
- &#x27;use strict&#x27;;
84
-
85
- const shimAmd = require(&#x27;./amd-shim&#x27;);
86
-
87
- class AmdTransformAddon {
88
- /**
89
- * This addon is used to register a custom AMD transform for app and addons to use.
90
- *
91
- * @class AmdTransformAddon
92
- * @constructor
93
- */
94
- constructor(project) {
95
- this.project = project;
96
- this.name = &#x27;amd-transform&#x27;;
97
- }
98
-
99
- importTransforms() {
100
- return {
101
- amd: {
102
- transform: (tree, options) =&gt; {
103
- let nameMapping = {};
104
- for (let relativePath in options) {
105
- nameMapping[relativePath] = options[relativePath].as;
106
- }
107
-
108
- let amdTransform = shimAmd(tree, nameMapping);
109
-
110
- return amdTransform;
111
- },
112
- processOptions: (assetPath, entry, options) =&gt; {
113
- // If the import is specified to be a different name we must break because of the broccoli rewrite behavior.
114
- if (Object.keys(options).indexOf(assetPath) !== -1 &amp;&amp; options[assetPath].as !== entry.as) {
115
- throw new Error(
116
- &#x60;Highlander error while importing ${assetPath}. You may not import an AMD transformed asset at different module names.&#x60;
117
- );
118
- }
119
-
120
- options[assetPath] = {
121
- as: entry.as,
122
- };
123
-
124
- return options;
125
- },
126
- },
127
- };
128
- }
129
- }
130
-
131
- module.exports = AmdTransformAddon;
132
-
133
- </pre>
134
-
135
- </div>
136
- </div>
137
- </div>
138
- </div>
139
- <script src="../assets/vendor/prettify/prettify-min.js"></script>
140
- <script>prettyPrint();</script>
141
- <script src="../assets/js/yui-prettify.js"></script>
142
- </body>
143
- </html>
@@ -1,292 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>lib/utilities/ember-app-utils.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/utilities/ember-app-utils.js</h1>
80
- </div>
81
-
82
- <pre class="code prettyprint linenums">
83
- &#x27;use strict&#x27;;
84
-
85
- const fs = require(&#x27;fs&#x27;);
86
- const path = require(&#x27;path&#x27;);
87
- const cleanBaseURL = require(&#x27;clean-base-url&#x27;);
88
-
89
- /**
90
- * Returns a normalized url given a string.
91
- * Returns an empty string if &#x60;null&#x60;, &#x60;undefined&#x60; or an empty string are passed
92
- * in.
93
- *
94
- * @method normalizeUrl
95
- * @param {String} Raw url.
96
- * @return {String} Normalized url.
97
- */
98
- function normalizeUrl(rootURL) {
99
- if (rootURL === undefined || rootURL === null || rootURL === &#x27;&#x27;) {
100
- return &#x27;&#x27;;
101
- }
102
-
103
- return cleanBaseURL(rootURL);
104
- }
105
-
106
- /**
107
- * Converts Javascript Object to a string.
108
- * Returns an empty object string representation if a &quot;falsy&quot; value is passed
109
- * in.
110
- *
111
- * @method convertObjectToString
112
- * @param {Object} Any Javascript Object.
113
- * @return {String} A string representation of a Javascript Object.
114
- */
115
- function convertObjectToString(env) {
116
- return JSON.stringify(env || {});
117
- }
118
-
119
- /**
120
- * Returns the &lt;base&gt; tag for index.html.
121
- *
122
- * @method calculateBaseTag
123
- * @param {String} baseURL
124
- * @param {String} locationType &#x27;history&#x27;, &#x27;none&#x27; or &#x27;hash&#x27;.
125
- * @return {String} Base tag or an empty string
126
- */
127
- function calculateBaseTag(baseURL, locationType) {
128
- let normalizedBaseUrl = cleanBaseURL(baseURL);
129
-
130
- if (locationType === &#x27;hash&#x27;) {
131
- return &#x27;&#x27;;
132
- }
133
-
134
- return normalizedBaseUrl ? &#x60;&lt;base href=&quot;${normalizedBaseUrl}&quot; /&gt;&#x60; : &#x27;&#x27;;
135
- }
136
-
137
- /**
138
- * Returns the content for a specific type (section) for index.html.
139
- *
140
- * &#x60;&#x60;&#x60;
141
- * {{content-for &quot;[type]&quot;}}
142
- * &#x60;&#x60;&#x60;
143
- *
144
- * Supported types:
145
- *
146
- * - &#x27;head&#x27;
147
- * - &#x27;config-module&#x27;
148
- * - &#x27;head-footer&#x27;
149
- * - &#x27;test-header-footer&#x27;
150
- * - &#x27;body-footer&#x27;
151
- * - &#x27;test-body-footer&#x27;
152
- *
153
- * @method contentFor
154
- * @param {Object} config Ember.js application configuration
155
- * @param {RegExp} match Regular expression to match against
156
- * @param {String} type Type of content
157
- * @param {Object} options Settings that control the default content
158
- * @param {Boolean} options.autoRun Controls whether to bootstrap the
159
- application or not
160
- * @param {Boolean} options.storeConfigInMeta Controls whether to include the
161
- contents of config
162
- * @return {String} The content.
163
- */
164
- function contentFor(config, match, type, options) {
165
- let content = [];
166
-
167
- // This normalizes &#x60;rootURL&#x60; to the value which we use everywhere inside of Ember CLI.
168
- // This makes sure that the user doesn&#x27;t have to account for it in application code.
169
- if (&#x27;rootURL&#x27; in config) {
170
- config.rootURL = normalizeUrl(config.rootURL);
171
- }
172
-
173
- switch (type) {
174
- case &#x27;head&#x27;:
175
- content.push(calculateBaseTag(config.baseURL, config.locationType));
176
-
177
- if (options.storeConfigInMeta) {
178
- content.push(
179
- &#x60;&lt;meta name=&quot;${config.modulePrefix}/config/environment&quot; content=&quot;${encodeURIComponent(
180
- JSON.stringify(config)
181
- )}&quot; /&gt;&#x60;
182
- );
183
- }
184
-
185
- break;
186
- case &#x27;config-module&#x27;:
187
- if (options.storeConfigInMeta) {
188
- content.push(&#x60;var prefix = &#x27;${config.modulePrefix}&#x27;;&#x60;);
189
- content.push(fs.readFileSync(path.join(__dirname, &#x27;../broccoli/app-config-from-meta.js&#x27;)));
190
- } else {
191
- content.push(&#x60;
192
- var exports = {
193
- &#x27;default&#x27;: ${JSON.stringify(config)}
194
- };
195
- Object.defineProperty(exports, &#x27;__esModule&#x27;, {value: true});
196
- return exports;
197
- &#x60;);
198
- }
199
-
200
- break;
201
- case &#x27;app-boot&#x27;:
202
- if (options.autoRun) {
203
- let moduleToRequire = &#x60;${config.modulePrefix}/app&#x60;;
204
- content.push(&#x60;
205
- if (!runningTests) {
206
- require(&quot;${moduleToRequire}&quot;)[&quot;default&quot;].create(${convertObjectToString(config.APP)});
207
- }
208
- &#x60;);
209
- }
210
-
211
- break;
212
- case &#x27;test-body-footer&#x27;:
213
- content.push(
214
- &#x60;&lt;script&gt;
215
- document.addEventListener(&#x27;DOMContentLoaded&#x27;, function() {
216
- if (!EmberENV.TESTS_FILE_LOADED) {
217
- throw new Error(&#x27;The tests file was not loaded. Make sure your tests index.html includes &quot;assets/tests.js&quot;.&#x27;);
218
- }
219
- });
220
- &lt;/script&gt;&#x60;
221
- );
222
-
223
- break;
224
- }
225
-
226
- content = options.addons.reduce((content, addon) =&gt; {
227
- let addonContent = addon.contentFor ? addon.contentFor(type, config, content) : null;
228
- if (addonContent) {
229
- return content.concat(addonContent);
230
- }
231
-
232
- return content;
233
- }, content);
234
-
235
- return content.join(&#x27;\n&#x27;);
236
- }
237
-
238
- /*
239
- * Return a list of pairs: a pattern to match to a replacement function.
240
- *
241
- * Used to replace various tags in &#x60;index.html&#x60; and &#x60;tests/index.html&#x60;.
242
- *
243
- * @param {Object} options
244
- * @param {Array} options.addons A list of project&#x27;s add-ons
245
- * @param {Boolean} options.autoRun Controls whether to bootstrap the
246
- application or not
247
- * @param {Boolean} options.storeConfigInMeta Controls whether to include the
248
- contents of config
249
- @return {Array} An array of patterns to match against and replace
250
- */
251
- function configReplacePatterns(options) {
252
- return [
253
- {
254
- match: /{{\s?rootURL\s?}}/g,
255
- replacement(config) {
256
- return normalizeUrl(config.rootURL);
257
- },
258
- },
259
- {
260
- match: /{{\s?EMBER_ENV\s?}}/g,
261
- replacement(config) {
262
- return convertObjectToString(config.EmberENV);
263
- },
264
- },
265
- {
266
- match: /{{content-for [&#x27;&quot;](.+?)[&quot;&#x27;]}}/g,
267
- replacement(config, match, type) {
268
- return contentFor(config, match, type, options);
269
- },
270
- },
271
- {
272
- match: /{{\s?MODULE_PREFIX\s?}}/g,
273
- replacement(config) {
274
- return config.modulePrefix;
275
- },
276
- },
277
- ];
278
- }
279
-
280
- module.exports = { normalizeUrl, convertObjectToString, calculateBaseTag, contentFor, configReplacePatterns };
281
-
282
- </pre>
283
-
284
- </div>
285
- </div>
286
- </div>
287
- </div>
288
- <script src="../assets/vendor/prettify/prettify-min.js"></script>
289
- <script>prettyPrint();</script>
290
- <script src="../assets/js/yui-prettify.js"></script>
291
- </body>
292
- </html>