ember-cli 4.0.0-beta.2 → 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.
- package/.github/workflows/ci.yml +5 -5
- package/CHANGELOG.md +48 -3
- package/blueprints/addon/additional-dev-dependencies.json +2 -2
- package/blueprints/addon/files/.github/workflows/ci.yml +5 -1
- package/blueprints/addon/files/.travis.yml +1 -1
- package/blueprints/addon/files/README.md +2 -2
- package/blueprints/addon/files/addon-config/ember-try.js +4 -4
- package/blueprints/app/files/.github/workflows/ci.yml +4 -0
- package/blueprints/app/files/package.json +17 -17
- package/docs/build/data.json +3 -3
- package/lib/commands/init.js +9 -1
- package/lib/models/host-info-cache.js +3 -5
- package/lib/models/per-bundle-addon-cache/index.js +2 -3
- package/lib/utilities/get-lang-arg.js +45 -45
- package/package.json +25 -25
- package/.github/ISSUE_TEMPLATE.md +0 -12
- package/.github/dependabot.yml +0 -15
- package/.github/workflows/coverage.yml +0 -31
- package/docs/analytics.md +0 -44
- package/docs/architecture.md +0 -316
- package/docs/assets/architecture/Ember-CLI architecture.png +0 -0
- package/docs/assets/architecture/Ember-CLI architecture.xml +0 -1
- package/docs/assets/architecture/README.md +0 -5
- package/docs/brocfile-transition.md +0 -46
- package/docs/build/api.js +0 -44
- package/docs/build/assets/css/external-small.png +0 -0
- package/docs/build/assets/css/logo.png +0 -0
- package/docs/build/assets/css/main.css +0 -555
- package/docs/build/assets/favicon.ico +0 -0
- package/docs/build/assets/img/spinner.gif +0 -0
- package/docs/build/assets/index.html +0 -10
- package/docs/build/assets/js/api-filter.js +0 -56
- package/docs/build/assets/js/api-list.js +0 -255
- package/docs/build/assets/js/api-search.js +0 -98
- package/docs/build/assets/js/apidocs.js +0 -376
- package/docs/build/assets/js/yui-prettify.js +0 -17
- package/docs/build/assets/vendor/prettify/CHANGES.html +0 -130
- package/docs/build/assets/vendor/prettify/COPYING +0 -202
- package/docs/build/assets/vendor/prettify/README.html +0 -203
- package/docs/build/assets/vendor/prettify/prettify-min.css +0 -1
- package/docs/build/assets/vendor/prettify/prettify-min.js +0 -1
- package/docs/build/classes/Addon.html +0 -4318
- package/docs/build/classes/AmdTransformAddon.html +0 -202
- package/docs/build/classes/Blueprint.html +0 -4796
- package/docs/build/classes/Builder.html +0 -611
- package/docs/build/classes/CLI.html +0 -810
- package/docs/build/classes/Command.html +0 -1655
- package/docs/build/classes/DefaultPackager.html +0 -202
- package/docs/build/classes/EmberAddon.html +0 -2207
- package/docs/build/classes/EmberApp.html +0 -2225
- package/docs/build/classes/HardwareInfo.html +0 -620
- package/docs/build/classes/HistorySupportAddon.html +0 -203
- package/docs/build/classes/Instrumentation.html +0 -695
- package/docs/build/classes/NodeModulesList.html +0 -460
- package/docs/build/classes/NpmTask.html +0 -333
- package/docs/build/classes/PackageInfo.html +0 -1390
- package/docs/build/classes/PackageInfoCache.html +0 -963
- package/docs/build/classes/PerBundleAddonCache {.html +0 -1010
- package/docs/build/classes/Project.html +0 -2083
- package/docs/build/classes/ServeFilesAddon.html +0 -260
- package/docs/build/classes/TestsServerAddon.html +0 -203
- package/docs/build/classes/WatcherAddon.html +0 -204
- package/docs/build/classes/WindowsSymlinkChecker.html +0 -1505
- package/docs/build/files/lib_broccoli_default-packager.js.html +0 -1426
- package/docs/build/files/lib_broccoli_ember-addon.js.html +0 -159
- package/docs/build/files/lib_broccoli_ember-app.js.html +0 -1913
- package/docs/build/files/lib_cli_cli.js.html +0 -417
- package/docs/build/files/lib_models_addon-info.js.html +0 -112
- package/docs/build/files/lib_models_addon.js.html +0 -1866
- package/docs/build/files/lib_models_blueprint.js.html +0 -1678
- package/docs/build/files/lib_models_builder.js.html +0 -417
- package/docs/build/files/lib_models_command.js.html +0 -804
- package/docs/build/files/lib_models_hardware-info.js.html +0 -479
- package/docs/build/files/lib_models_host-info-cache.js.html +0 -428
- package/docs/build/files/lib_models_installation-checker.js.html +0 -181
- package/docs/build/files/lib_models_instantiate-addons.js.html +0 -191
- package/docs/build/files/lib_models_instrumentation.js.html +0 -433
- package/docs/build/files/lib_models_package-info-cache_index.js.html +0 -793
- package/docs/build/files/lib_models_package-info-cache_node-modules-list.js.html +0 -208
- package/docs/build/files/lib_models_package-info-cache_package-info.js.html +0 -661
- package/docs/build/files/lib_models_per-bundle-addon-cache_addon-proxy.js.html +0 -252
- package/docs/build/files/lib_models_per-bundle-addon-cache_index.js.html +0 -485
- package/docs/build/files/lib_models_per-bundle-addon-cache_target-instance.js.html +0 -108
- package/docs/build/files/lib_models_project.js.html +0 -913
- package/docs/build/files/lib_models_task.js.html +0 -117
- package/docs/build/files/lib_tasks_build-watch.js.html +0 -157
- package/docs/build/files/lib_tasks_npm-task.js.html +0 -463
- package/docs/build/files/lib_tasks_serve.js.html +0 -207
- package/docs/build/files/lib_tasks_server_middleware_broccoli-serve-files_index.js.html +0 -127
- package/docs/build/files/lib_tasks_server_middleware_broccoli-watcher_index.js.html +0 -158
- package/docs/build/files/lib_tasks_server_middleware_history-support_index.js.html +0 -181
- package/docs/build/files/lib_tasks_server_middleware_tests-server_index.js.html +0 -171
- package/docs/build/files/lib_tasks_test-server.js.html +0 -167
- package/docs/build/files/lib_tasks_transforms_amd_index.js.html +0 -143
- package/docs/build/files/lib_utilities_ember-app-utils.js.html +0 -292
- package/docs/build/files/lib_utilities_insert-into-file.js.html +0 -219
- package/docs/build/files/lib_utilities_is-lazy-engine.js.html +0 -125
- package/docs/build/files/lib_utilities_is-yarn-project.js.html +0 -120
- package/docs/build/files/lib_utilities_valid-project-name.js.html +0 -142
- package/docs/build/files/lib_utilities_will-interrupt-process.js.html +0 -290
- package/docs/build/files/lib_utilities_windows-admin.js.html +0 -230
- package/docs/build/index.html +0 -125
- package/docs/build/modules/ember-cli.html +0 -152
- package/docs/build/modules/is-lazy-engine.html +0 -106
- package/docs/build-concurrency.md +0 -15
- package/docs/build-pipeline-debugging.md +0 -33
- package/docs/code-coverage.md +0 -14
- package/docs/error-propagation.md +0 -136
- package/docs/experiments.md +0 -53
- package/docs/node-support.md +0 -43
- package/docs/perf-guide.md +0 -250
- package/docs/project_version_preprocessor.js +0 -8
- package/docs/sourcemaps.md +0 -60
- package/docs/yuidoc.json +0 -13
|
@@ -1,1426 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>lib/broccoli/default-packager.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-beta.2-beta-6d064ff49f
|
|
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/broccoli/default-packager.js</h1>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<pre class="code prettyprint linenums">
|
|
83
|
-
'use strict';
|
|
84
|
-
|
|
85
|
-
const p = require('ember-cli-preprocess-registry/preprocessors');
|
|
86
|
-
const path = require('path');
|
|
87
|
-
const concat = require('broccoli-concat');
|
|
88
|
-
const Funnel = require('broccoli-funnel');
|
|
89
|
-
const BroccoliDebug = require('broccoli-debug');
|
|
90
|
-
const mergeTrees = require('./merge-trees');
|
|
91
|
-
const ConfigLoader = require('broccoli-config-loader');
|
|
92
|
-
const UnwatchedDir = require('broccoli-source').UnwatchedDir;
|
|
93
|
-
const ConfigReplace = require('broccoli-config-replace');
|
|
94
|
-
const emberAppUtils = require('../utilities/ember-app-utils');
|
|
95
|
-
const funnelReducer = require('broccoli-funnel-reducer');
|
|
96
|
-
const addonProcessTree = require('../utilities/addon-process-tree');
|
|
97
|
-
|
|
98
|
-
const preprocessCss = p.preprocessCss;
|
|
99
|
-
const preprocessJs = p.preprocessJs;
|
|
100
|
-
const preprocessTemplates = p.preprocessTemplates;
|
|
101
|
-
const preprocessMinifyCss = p.preprocessMinifyCss;
|
|
102
|
-
|
|
103
|
-
const DEFAULT_BOWER_PATH = 'bower_components';
|
|
104
|
-
const DEFAULT_VENDOR_PATH = 'vendor';
|
|
105
|
-
const EMBER_CLI_INTERNAL_FILES_PATH = '/vendor/ember-cli/';
|
|
106
|
-
const EMBER_CLI_FILES = [
|
|
107
|
-
'app-boot.js',
|
|
108
|
-
'app-config.js',
|
|
109
|
-
'app-prefix.js',
|
|
110
|
-
'app-suffix.js',
|
|
111
|
-
'test-support-prefix.js',
|
|
112
|
-
'test-support-suffix.js',
|
|
113
|
-
'tests-prefix.js',
|
|
114
|
-
'tests-suffix.js',
|
|
115
|
-
'vendor-prefix.js',
|
|
116
|
-
'vendor-suffix.js',
|
|
117
|
-
];
|
|
118
|
-
|
|
119
|
-
const configReplacePatterns = emberAppUtils.configReplacePatterns;
|
|
120
|
-
|
|
121
|
-
function callAddonsPreprocessTreeHook(project, type, tree) {
|
|
122
|
-
return addonProcessTree(project, 'preprocessTree', type, tree);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function callAddonsPostprocessTreeHook(project, type, tree) {
|
|
126
|
-
return addonProcessTree(project, 'postprocessTree', type, tree);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/*
|
|
130
|
-
Creates an object with lists of files to be concatenated into `vendor.js` file.
|
|
131
|
-
|
|
132
|
-
Given a map that looks like:
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
{
|
|
136
|
-
'assets/vendor.js': [
|
|
137
|
-
'vendor/ember-cli-shims/app-shims.js',
|
|
138
|
-
'vendor/loader/loader.js',
|
|
139
|
-
'vendor/ember-resolver/legacy-shims.js',
|
|
140
|
-
...
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Produces an object that looks like:
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
{
|
|
149
|
-
headerFiles: [
|
|
150
|
-
'vendor/ember-cli/vendor-prefix.js',
|
|
151
|
-
'vendor/loader/loader.js',
|
|
152
|
-
'vendor/ember/jquery/jquery.js',
|
|
153
|
-
'vendor/ember/ember.debug.js',
|
|
154
|
-
'vendor/ember-cli-shims/app-shims.js',
|
|
155
|
-
'vendor/ember-resolver/legacy-shims.js'
|
|
156
|
-
],
|
|
157
|
-
inputFiles: [
|
|
158
|
-
'addon-tree-output/**\/*.js'
|
|
159
|
-
],
|
|
160
|
-
footerFiles: [
|
|
161
|
-
'vendor/ember-cli/vendor-suffix.js'
|
|
162
|
-
],
|
|
163
|
-
annotation: 'Vendor JS'
|
|
164
|
-
}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
@private
|
|
168
|
-
@method getVendorFiles
|
|
169
|
-
@param {Object} files A list of files to include into `<file-name>.js`
|
|
170
|
-
@param {Boolean} isMainVendorFile Boolean flag to indicate if we are dealing with `vendor.js` file
|
|
171
|
-
@return {Object} An object with lists of files to be concatenated into `vendor.js` file.
|
|
172
|
-
*/
|
|
173
|
-
function getVendorFiles(files, isMainVendorFile) {
|
|
174
|
-
return {
|
|
175
|
-
headerFiles: files,
|
|
176
|
-
inputFiles: isMainVendorFile ? ['addon-tree-output/**/*.js'] : [],
|
|
177
|
-
footerFiles: isMainVendorFile ? ['vendor/ember-cli/vendor-suffix.js'] : [],
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Responsible for packaging Ember.js application.
|
|
183
|
-
*
|
|
184
|
-
* @class DefaultPackager
|
|
185
|
-
* @constructor
|
|
186
|
-
*/
|
|
187
|
-
module.exports = class DefaultPackager {
|
|
188
|
-
constructor(options) {
|
|
189
|
-
this._cachedTests = null;
|
|
190
|
-
this._cachedBower = null;
|
|
191
|
-
this._cachedVendor = null;
|
|
192
|
-
this._cachedPublic = null;
|
|
193
|
-
this._cachedConfig = null;
|
|
194
|
-
this._cachedJavascript = null;
|
|
195
|
-
this._cachedProcessedIndex = null;
|
|
196
|
-
this._cachedTransformedTree = null;
|
|
197
|
-
this._cachedProcessedStyles = null;
|
|
198
|
-
this._cachedProcessedTemplates = null;
|
|
199
|
-
this._cachedProcessedJavascript = null;
|
|
200
|
-
this._cachedEmberCliInternalTree = null;
|
|
201
|
-
this._cachedProcessedAdditionalAssets = null;
|
|
202
|
-
this._cachedProcessedAppAndDependencies = null;
|
|
203
|
-
|
|
204
|
-
this.options = options || {};
|
|
205
|
-
|
|
206
|
-
this._debugTree = BroccoliDebug.buildDebugCallback('default-packager');
|
|
207
|
-
|
|
208
|
-
this.env = this.options.env;
|
|
209
|
-
this.name = this.options.name;
|
|
210
|
-
this.autoRun = this.options.autoRun;
|
|
211
|
-
this.project = this.options.project;
|
|
212
|
-
this.registry = this.options.registry;
|
|
213
|
-
this.sourcemaps = this.options.sourcemaps;
|
|
214
|
-
this.minifyCSS = this.options.minifyCSS;
|
|
215
|
-
this.distPaths = this.options.distPaths;
|
|
216
|
-
this.areTestsEnabled = this.options.areTestsEnabled;
|
|
217
|
-
this.styleOutputFiles = this.options.styleOutputFiles;
|
|
218
|
-
this.scriptOutputFiles = this.options.scriptOutputFiles;
|
|
219
|
-
this.storeConfigInMeta = this.options.storeConfigInMeta;
|
|
220
|
-
this.customTransformsMap = this.options.customTransformsMap;
|
|
221
|
-
this.additionalAssetPaths = this.options.additionalAssetPaths;
|
|
222
|
-
this.vendorTestStaticStyles = this.options.vendorTestStaticStyles;
|
|
223
|
-
this.legacyTestFilesToAppend = this.options.legacyTestFilesToAppend;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/*
|
|
227
|
-
* Replaces variables in `index.html` file with values from
|
|
228
|
-
* `config/environment.js` and returns a single tree that contains
|
|
229
|
-
* `index.html` file with populated values.
|
|
230
|
-
*
|
|
231
|
-
* Input tree:
|
|
232
|
-
*
|
|
233
|
-
* ```
|
|
234
|
-
* /
|
|
235
|
-
* ├── addon-tree-output/
|
|
236
|
-
* ├── the-best-app-ever/
|
|
237
|
-
* ├── bower_components/
|
|
238
|
-
* └── vendor/
|
|
239
|
-
* ```
|
|
240
|
-
*
|
|
241
|
-
* Returns:
|
|
242
|
-
*
|
|
243
|
-
* ```
|
|
244
|
-
* /
|
|
245
|
-
* └── index.html
|
|
246
|
-
* ```
|
|
247
|
-
*
|
|
248
|
-
* @private
|
|
249
|
-
* @method processIndex
|
|
250
|
-
* @param {BroccoliTree}
|
|
251
|
-
* @return {BroccoliTree}
|
|
252
|
-
*/
|
|
253
|
-
processIndex(tree) {
|
|
254
|
-
if (this._cachedProcessedIndex === null) {
|
|
255
|
-
let indexFilePath = this.distPaths.appHtmlFile;
|
|
256
|
-
|
|
257
|
-
let index = new Funnel(tree, {
|
|
258
|
-
allowEmtpy: true,
|
|
259
|
-
include: [`${this.name}/index.html`],
|
|
260
|
-
getDestinationPath: () => indexFilePath,
|
|
261
|
-
annotation: 'Classic: index.html',
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
let patterns = configReplacePatterns({
|
|
265
|
-
addons: this.project.addons,
|
|
266
|
-
autoRun: this.autoRun,
|
|
267
|
-
storeConfigInMeta: this.storeConfigInMeta,
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
this._cachedProcessedIndex = new ConfigReplace(index, this.packageConfig(), {
|
|
271
|
-
configPath: path.join(this.name, 'config', 'environments', `${this.env}.json`),
|
|
272
|
-
files: [indexFilePath],
|
|
273
|
-
patterns,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
return this._cachedProcessedIndex;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/*
|
|
281
|
-
* Combines compiled javascript, external files (node modules, bower
|
|
282
|
-
* components), vendor files and processed configuration (based on the
|
|
283
|
-
* environment) into a single tree.
|
|
284
|
-
*
|
|
285
|
-
* Input tree:
|
|
286
|
-
*
|
|
287
|
-
* ```
|
|
288
|
-
* /
|
|
289
|
-
* ├── addon-tree-output/
|
|
290
|
-
* ├── the-best-app-ever/
|
|
291
|
-
* ├── bower_components/
|
|
292
|
-
* └── vendor/
|
|
293
|
-
* ```
|
|
294
|
-
*
|
|
295
|
-
* Changes are made "inline" so the output tree has the same structure.
|
|
296
|
-
*
|
|
297
|
-
* @private
|
|
298
|
-
* @method processAppAndDependencies
|
|
299
|
-
* @param {BroccoliTree}
|
|
300
|
-
* @return {BroccoliTree}
|
|
301
|
-
*/
|
|
302
|
-
processAppAndDependencies(allTrees) {
|
|
303
|
-
if (this._cachedProcessedAppAndDependencies === null) {
|
|
304
|
-
let config = this.packageConfig();
|
|
305
|
-
let internal = this.packageEmberCliInternalFiles();
|
|
306
|
-
let appContentsWithCompiledTemplates = this._debugTree(
|
|
307
|
-
this.processTemplates(allTrees),
|
|
308
|
-
'app-and-deps:post-templates'
|
|
309
|
-
);
|
|
310
|
-
|
|
311
|
-
let trees = [allTrees, appContentsWithCompiledTemplates].filter(Boolean);
|
|
312
|
-
|
|
313
|
-
let mergedTree = this._debugTree(
|
|
314
|
-
mergeTrees(trees, {
|
|
315
|
-
annotation: 'TreeMerger (preprocessedApp & templates)',
|
|
316
|
-
overwrite: true,
|
|
317
|
-
}),
|
|
318
|
-
'app-and-deps:merged'
|
|
319
|
-
);
|
|
320
|
-
|
|
321
|
-
let external = this.applyCustomTransforms(allTrees);
|
|
322
|
-
let postprocessedApp = this.processJavascript(mergedTree);
|
|
323
|
-
|
|
324
|
-
let sourceTrees = [external, postprocessedApp, config, internal];
|
|
325
|
-
|
|
326
|
-
this._cachedProcessedAppAndDependencies = this._debugTree(
|
|
327
|
-
mergeTrees(sourceTrees, {
|
|
328
|
-
overwrite: true,
|
|
329
|
-
annotation: 'Processed Application and Dependencies',
|
|
330
|
-
}),
|
|
331
|
-
'app-and-deps:final'
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
return this._cachedProcessedAppAndDependencies;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/*
|
|
339
|
-
* Adds additional assets to the results tree, given the following list:
|
|
340
|
-
*
|
|
341
|
-
* ```
|
|
342
|
-
* [{
|
|
343
|
-
* src: 'vendor/font-awesome/fonts',
|
|
344
|
-
* file: 'FontAwesome.otf',
|
|
345
|
-
* dest: 'fonts'
|
|
346
|
-
* }]
|
|
347
|
-
* ```
|
|
348
|
-
*
|
|
349
|
-
* where `src` is a source path, `file` is a file name, and `dest` is a new
|
|
350
|
-
* destination.
|
|
351
|
-
*
|
|
352
|
-
* @private
|
|
353
|
-
* @method importAdditionalAssets
|
|
354
|
-
* @param {BroccoliTree}
|
|
355
|
-
* @return {BroccoliTree}
|
|
356
|
-
*/
|
|
357
|
-
importAdditionalAssets(tree) {
|
|
358
|
-
if (this._cachedProcessedAdditionalAssets === null) {
|
|
359
|
-
let otherAssetTrees = funnelReducer(this.additionalAssetPaths).map((options) => {
|
|
360
|
-
let files = options.include.join(',');
|
|
361
|
-
options.annotation = `${options.srcDir}/{${files}} => ${options.destDir}/{${files}}`;
|
|
362
|
-
|
|
363
|
-
return new Funnel(tree, options);
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
this._cachedProcessedAdditionalAssets = mergeTrees(otherAssetTrees, {
|
|
367
|
-
annotation: 'Processed Additional Assets',
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
return this._cachedProcessedAdditionalAssets;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/*
|
|
375
|
-
* Runs all registered transformations on the passed in tree and returns the
|
|
376
|
-
* result.
|
|
377
|
-
*
|
|
378
|
-
* Passed-in tree:
|
|
379
|
-
*
|
|
380
|
-
* ```
|
|
381
|
-
* /
|
|
382
|
-
* ├── addon-tree-output/
|
|
383
|
-
* ├── bower_components/
|
|
384
|
-
* └── vendor/
|
|
385
|
-
* ```
|
|
386
|
-
*
|
|
387
|
-
* `customTransformsMap` has information about files that needed to be
|
|
388
|
-
* transformed and the actual transformation functions that are executed.
|
|
389
|
-
*
|
|
390
|
-
* @private
|
|
391
|
-
* @method applyCustomTransforms
|
|
392
|
-
* @param {BroccoliTree} External (vendor) tree
|
|
393
|
-
* @return {BroccoliTree}
|
|
394
|
-
*/
|
|
395
|
-
applyCustomTransforms(externalTree) {
|
|
396
|
-
if (this._cachedTransformedTree === null) {
|
|
397
|
-
this._cachedTransformedTree = externalTree;
|
|
398
|
-
|
|
399
|
-
for (let customTransformEntry of this.customTransformsMap) {
|
|
400
|
-
let transformName = customTransformEntry[0];
|
|
401
|
-
let transformConfig = customTransformEntry[1];
|
|
402
|
-
|
|
403
|
-
let transformTree = new Funnel(this._cachedTransformedTree, {
|
|
404
|
-
files: transformConfig.files,
|
|
405
|
-
annotation: `Funnel (custom transform: ${transformName})`,
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
this._cachedTransformedTree = mergeTrees(
|
|
409
|
-
[this._cachedTransformedTree, transformConfig.callback(transformTree, transformConfig.options)],
|
|
410
|
-
{
|
|
411
|
-
annotation: `TreeMerger (custom transform: ${transformName})`,
|
|
412
|
-
overwrite: true,
|
|
413
|
-
}
|
|
414
|
-
);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
return this._cachedTransformedTree;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/*
|
|
422
|
-
* Returns a single tree with `ember-cli` internal files with the following
|
|
423
|
-
* structure:
|
|
424
|
-
*
|
|
425
|
-
* ```
|
|
426
|
-
* vendor/
|
|
427
|
-
* └── ember-cli
|
|
428
|
-
* ├── app-boot.js
|
|
429
|
-
* ├── app-config.js
|
|
430
|
-
* ├── app-prefix.js
|
|
431
|
-
* ├── app-suffix.js
|
|
432
|
-
* ├── test-support-suffix.js
|
|
433
|
-
* ├── test-support-prefix.js
|
|
434
|
-
* ├── tests-prefix.js
|
|
435
|
-
* ├── tests-suffix.js
|
|
436
|
-
* ├── vendor-prefix.js
|
|
437
|
-
* └── vendor-suffix.js
|
|
438
|
-
* ```
|
|
439
|
-
*
|
|
440
|
-
* Note, that the contents of these files is being matched against several
|
|
441
|
-
* internal `ember-cli` variables, such as:
|
|
442
|
-
*
|
|
443
|
-
* + `{{MODULE_PREFIX}}`
|
|
444
|
-
* + different types of `{{content-for}}` (`{{content-for 'app-boot'}}`)
|
|
445
|
-
*
|
|
446
|
-
* @private
|
|
447
|
-
* @method packageEmberCliInternalFiles
|
|
448
|
-
* @return {BroccoliTree}
|
|
449
|
-
*/
|
|
450
|
-
packageEmberCliInternalFiles() {
|
|
451
|
-
if (this._cachedEmberCliInternalTree === null) {
|
|
452
|
-
let patterns = configReplacePatterns({
|
|
453
|
-
addons: this.project.addons,
|
|
454
|
-
autoRun: this.autoRun,
|
|
455
|
-
storeConfigInMeta: this.storeConfigInMeta,
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
let configTree = this.packageConfig();
|
|
459
|
-
let configPath = path.join(this.name, 'config', 'environments', `${this.env}.json`);
|
|
460
|
-
|
|
461
|
-
let emberCLITree = new ConfigReplace(new UnwatchedDir(__dirname), configTree, {
|
|
462
|
-
configPath,
|
|
463
|
-
files: EMBER_CLI_FILES,
|
|
464
|
-
patterns,
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
this._cachedEmberCliInternalTree = new Funnel(emberCLITree, {
|
|
468
|
-
files: EMBER_CLI_FILES,
|
|
469
|
-
destDir: EMBER_CLI_INTERNAL_FILES_PATH,
|
|
470
|
-
annotation: 'Packaged Ember CLI Internal Files',
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
return this._cachedEmberCliInternalTree;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
/*
|
|
478
|
-
* Runs pre/post-processors hooks on the template files and returns a single
|
|
479
|
-
* tree with the processed templates.
|
|
480
|
-
*
|
|
481
|
-
* Given a tree:
|
|
482
|
-
*
|
|
483
|
-
* ```
|
|
484
|
-
* /
|
|
485
|
-
* ├── addon-tree-output/
|
|
486
|
-
* ├── bower_components/
|
|
487
|
-
* ├── the-best-app-ever/
|
|
488
|
-
* └── vendor/
|
|
489
|
-
* ```
|
|
490
|
-
*
|
|
491
|
-
* Returns:
|
|
492
|
-
*
|
|
493
|
-
* ```
|
|
494
|
-
* the-best-app-ever/
|
|
495
|
-
* └── templates
|
|
496
|
-
* ├── application.js
|
|
497
|
-
* ├── error.js
|
|
498
|
-
* ├── index.js
|
|
499
|
-
* └── loading.js
|
|
500
|
-
* ```
|
|
501
|
-
*
|
|
502
|
-
* @private
|
|
503
|
-
* @method processTemplates
|
|
504
|
-
* @param {BroccoliTree} tree
|
|
505
|
-
* @return {BroccoliTree}
|
|
506
|
-
*/
|
|
507
|
-
processTemplates(inputTree) {
|
|
508
|
-
if (this._cachedProcessedTemplates === null) {
|
|
509
|
-
let appFiles = new Funnel(inputTree, {
|
|
510
|
-
srcDir: `${this.name}/`,
|
|
511
|
-
destDir: `${this.name}/`,
|
|
512
|
-
annotation: 'processTemplates: app files',
|
|
513
|
-
});
|
|
514
|
-
|
|
515
|
-
let mergedTemplates = [appFiles];
|
|
516
|
-
|
|
517
|
-
mergedTemplates = mergeTrees(mergedTemplates, {
|
|
518
|
-
overwrite: true,
|
|
519
|
-
annotation: 'Templates',
|
|
520
|
-
});
|
|
521
|
-
let preprocessedTemplatesFromAddons = callAddonsPreprocessTreeHook(this.project, 'template', mergedTemplates);
|
|
522
|
-
|
|
523
|
-
this._cachedProcessedTemplates = callAddonsPostprocessTreeHook(
|
|
524
|
-
this.project,
|
|
525
|
-
'template',
|
|
526
|
-
preprocessTemplates(preprocessedTemplatesFromAddons, {
|
|
527
|
-
registry: this.registry,
|
|
528
|
-
treeType: 'templates',
|
|
529
|
-
})
|
|
530
|
-
);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
return this._cachedProcessedTemplates;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
/*
|
|
537
|
-
* Runs pre/post-processors hooks on the javascript files and returns a single
|
|
538
|
-
* tree with the processed javascript.
|
|
539
|
-
*
|
|
540
|
-
* Given a tree:
|
|
541
|
-
*
|
|
542
|
-
* ```
|
|
543
|
-
* /
|
|
544
|
-
* ├── addon-tree-output/
|
|
545
|
-
* ├── bower_components/
|
|
546
|
-
* ├── the-best-app-ever/
|
|
547
|
-
* └── vendor/
|
|
548
|
-
* ```
|
|
549
|
-
*
|
|
550
|
-
* Returns:
|
|
551
|
-
*
|
|
552
|
-
* ```
|
|
553
|
-
* the-best-app-ever/
|
|
554
|
-
* ├── adapters
|
|
555
|
-
* │ └── application.js
|
|
556
|
-
* ├── app.js
|
|
557
|
-
* ├── components
|
|
558
|
-
* ├── controllers
|
|
559
|
-
* ├── helpers
|
|
560
|
-
* │ ├── and.js
|
|
561
|
-
* │ ├── app-version.js
|
|
562
|
-
* │ ├── await.js
|
|
563
|
-
* │ ├── camelize.js
|
|
564
|
-
* │ ├── cancel-all.js
|
|
565
|
-
* │ ├── dasherize.js
|
|
566
|
-
* │ ├── dec.js
|
|
567
|
-
* │ ├── drop.js
|
|
568
|
-
* │ └── eq.js
|
|
569
|
-
* ...
|
|
570
|
-
* ```
|
|
571
|
-
*
|
|
572
|
-
* @private
|
|
573
|
-
* @method processJavascript
|
|
574
|
-
* @param {BroccoliTree} tree
|
|
575
|
-
* @return {BroccoliTree}
|
|
576
|
-
*/
|
|
577
|
-
processJavascript(tree) {
|
|
578
|
-
if (this._cachedProcessedJavascript === null) {
|
|
579
|
-
let javascript = new Funnel(tree, {
|
|
580
|
-
srcDir: this.name,
|
|
581
|
-
destDir: this.name,
|
|
582
|
-
annotation: '',
|
|
583
|
-
});
|
|
584
|
-
let app = callAddonsPreprocessTreeHook(this.project, 'js', javascript);
|
|
585
|
-
|
|
586
|
-
let preprocessedApp = preprocessJs(app, '/', this.name, {
|
|
587
|
-
registry: this.registry,
|
|
588
|
-
treeType: 'app',
|
|
589
|
-
});
|
|
590
|
-
|
|
591
|
-
this._cachedProcessedJavascript = callAddonsPostprocessTreeHook(this.project, 'js', preprocessedApp);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
return this._cachedProcessedJavascript;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
/*
|
|
598
|
-
* Compiles application css files, runs pre/post-processors hooks on the them,
|
|
599
|
-
* concatenates them into one application and vendor files and returns a
|
|
600
|
-
* single tree.
|
|
601
|
-
*
|
|
602
|
-
* Given an input tree that looks like:
|
|
603
|
-
*
|
|
604
|
-
* ```
|
|
605
|
-
* addon-tree-output/
|
|
606
|
-
* ...
|
|
607
|
-
* bower_components/
|
|
608
|
-
* hint.css/
|
|
609
|
-
* ...
|
|
610
|
-
* the-best-app-ever/
|
|
611
|
-
* styles/
|
|
612
|
-
* ...
|
|
613
|
-
* vendor/
|
|
614
|
-
* font-awesome/
|
|
615
|
-
* ...
|
|
616
|
-
* ```
|
|
617
|
-
*
|
|
618
|
-
* Returns:
|
|
619
|
-
*
|
|
620
|
-
* ```
|
|
621
|
-
* assets/
|
|
622
|
-
* the-best-app-ever.css
|
|
623
|
-
* vendor.css
|
|
624
|
-
* ```
|
|
625
|
-
*
|
|
626
|
-
* @private
|
|
627
|
-
* @method packageStyles
|
|
628
|
-
* @return {BroccoliTree}
|
|
629
|
-
*/
|
|
630
|
-
packageStyles(tree) {
|
|
631
|
-
if (this._cachedProcessedStyles === null) {
|
|
632
|
-
let cssMinificationEnabled = this.minifyCSS.enabled;
|
|
633
|
-
let options = {
|
|
634
|
-
outputPaths: this.distPaths.appCssFile,
|
|
635
|
-
registry: this.registry,
|
|
636
|
-
minifyCSS: this.minifyCSS.options,
|
|
637
|
-
treeType: 'styles',
|
|
638
|
-
};
|
|
639
|
-
|
|
640
|
-
let stylesAndVendor = callAddonsPreprocessTreeHook(this.project, 'css', tree);
|
|
641
|
-
stylesAndVendor = this._debugTree(stylesAndVendor, 'mu-layout:addonsPreprocessTree:css');
|
|
642
|
-
|
|
643
|
-
let preprocessedStyles = preprocessCss(stylesAndVendor, '/app/styles', '/assets', options);
|
|
644
|
-
preprocessedStyles = this._debugTree(preprocessedStyles, 'mu-layout:preprocess:css');
|
|
645
|
-
|
|
646
|
-
let vendorStyles = [];
|
|
647
|
-
for (let outputFile in this.styleOutputFiles) {
|
|
648
|
-
let isMainVendorFile = outputFile === this.distPaths.vendorCssFile;
|
|
649
|
-
let headerFiles = this.styleOutputFiles[outputFile];
|
|
650
|
-
let inputFiles = isMainVendorFile ? ['addon-tree-output/**/__COMPILED_STYLES__/**/*.css'] : [];
|
|
651
|
-
|
|
652
|
-
vendorStyles.push(
|
|
653
|
-
concat(stylesAndVendor, {
|
|
654
|
-
headerFiles,
|
|
655
|
-
inputFiles,
|
|
656
|
-
outputFile,
|
|
657
|
-
allowNone: true,
|
|
658
|
-
annotation: `Concat: Vendor Styles${outputFile}`,
|
|
659
|
-
})
|
|
660
|
-
);
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
vendorStyles = mergeTrees(vendorStyles, {
|
|
664
|
-
annotation: 'TreeMerger (vendorStyles)',
|
|
665
|
-
overwrite: true,
|
|
666
|
-
});
|
|
667
|
-
|
|
668
|
-
if (cssMinificationEnabled === true) {
|
|
669
|
-
options.minifyCSS.registry = options.registry;
|
|
670
|
-
preprocessedStyles = preprocessMinifyCss(preprocessedStyles, options.minifyCSS);
|
|
671
|
-
vendorStyles = preprocessMinifyCss(vendorStyles, options.minifyCSS);
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
this._cachedProcessedStyles = callAddonsPostprocessTreeHook(
|
|
675
|
-
this.project,
|
|
676
|
-
'css',
|
|
677
|
-
mergeTrees([preprocessedStyles, vendorStyles], {
|
|
678
|
-
annotation: 'Packaged Styles',
|
|
679
|
-
})
|
|
680
|
-
);
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
return this._cachedProcessedStyles;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
/*
|
|
687
|
-
* Given an input tree, returns a properly assembled Broccoli tree with bower
|
|
688
|
-
* components.
|
|
689
|
-
*
|
|
690
|
-
* Given a tree:
|
|
691
|
-
*
|
|
692
|
-
* ```
|
|
693
|
-
* ├── ember.js/
|
|
694
|
-
* ├── pusher/
|
|
695
|
-
* └── raven-js/
|
|
696
|
-
* ```
|
|
697
|
-
*
|
|
698
|
-
* Returns:
|
|
699
|
-
*
|
|
700
|
-
* ```
|
|
701
|
-
* [bowerDirectory]/
|
|
702
|
-
* ├── ember.js/
|
|
703
|
-
* ├── pusher/
|
|
704
|
-
* └── raven-js/
|
|
705
|
-
* ```
|
|
706
|
-
*
|
|
707
|
-
* @private
|
|
708
|
-
* @method packageBower
|
|
709
|
-
* @param {BroccoliTree} tree
|
|
710
|
-
* @param {String} bowerDirectory Custom path to bower components
|
|
711
|
-
*/
|
|
712
|
-
packageBower(tree, bowerDirectory) {
|
|
713
|
-
if (this._cachedBower === null) {
|
|
714
|
-
this._cachedBower = new Funnel(tree, {
|
|
715
|
-
destDir: bowerDirectory || DEFAULT_BOWER_PATH,
|
|
716
|
-
annotation: 'Packaged Bower',
|
|
717
|
-
});
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
return this._cachedBower;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
/*
|
|
724
|
-
* Given an input tree, returns a properly assembled Broccoli tree with vendor
|
|
725
|
-
* files.
|
|
726
|
-
*
|
|
727
|
-
* Given a tree:
|
|
728
|
-
*
|
|
729
|
-
* ```
|
|
730
|
-
* ├── babel-polyfill/
|
|
731
|
-
* ├── ember-cli-shims/
|
|
732
|
-
* ├── ember-load-initializers/
|
|
733
|
-
* ├── ember-qunit/
|
|
734
|
-
* ├── ember-resolver/
|
|
735
|
-
* ├── sinon/
|
|
736
|
-
* └── tether/
|
|
737
|
-
* ```
|
|
738
|
-
*
|
|
739
|
-
* Returns:
|
|
740
|
-
*
|
|
741
|
-
* ```
|
|
742
|
-
* vendor/
|
|
743
|
-
* ├── babel-polyfill/
|
|
744
|
-
* ├── ember-cli-shims/
|
|
745
|
-
* ├── ember-load-initializers/
|
|
746
|
-
* ├── ember-qunit/
|
|
747
|
-
* ├── ember-resolver/
|
|
748
|
-
* ├── sinon/
|
|
749
|
-
* └── tether/
|
|
750
|
-
* ```
|
|
751
|
-
*
|
|
752
|
-
* @private
|
|
753
|
-
* @method packageVendor
|
|
754
|
-
* @param {BroccoliTree} tree
|
|
755
|
-
*/
|
|
756
|
-
packageVendor(tree) {
|
|
757
|
-
if (this._cachedVendor === null) {
|
|
758
|
-
this._cachedVendor = new Funnel(tree, {
|
|
759
|
-
destDir: DEFAULT_VENDOR_PATH,
|
|
760
|
-
annotation: 'Packaged Vendor',
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
return this._cachedVendor;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
/*
|
|
768
|
-
* Given an input tree, returns a properly assembled Broccoli tree with tests
|
|
769
|
-
* files.
|
|
770
|
-
*
|
|
771
|
-
* Given a tree:
|
|
772
|
-
*
|
|
773
|
-
* ```
|
|
774
|
-
* addon-tree-output/
|
|
775
|
-
* bower_components/
|
|
776
|
-
* the-best-app-ever/
|
|
777
|
-
* tests/
|
|
778
|
-
* ├── acceptance/
|
|
779
|
-
* ├── helpers/
|
|
780
|
-
* ├── index.html
|
|
781
|
-
* ├── integration/
|
|
782
|
-
* ├── test-helper.js
|
|
783
|
-
* └── unit/
|
|
784
|
-
* ```
|
|
785
|
-
*
|
|
786
|
-
* Returns:
|
|
787
|
-
*
|
|
788
|
-
* ```
|
|
789
|
-
* [name]/
|
|
790
|
-
* └── tests
|
|
791
|
-
* ├── acceptance/
|
|
792
|
-
* ├── helpers/
|
|
793
|
-
* ├── index.html
|
|
794
|
-
* ├── integration/
|
|
795
|
-
* ├── test-helper.js
|
|
796
|
-
* └── unit/
|
|
797
|
-
* ```
|
|
798
|
-
*
|
|
799
|
-
* @private
|
|
800
|
-
* @method processTests
|
|
801
|
-
* @param {BroccoliTree} tree
|
|
802
|
-
*/
|
|
803
|
-
processTests(tree) {
|
|
804
|
-
if (this._cachedTests === null) {
|
|
805
|
-
let addonTestSupportTree = new Funnel(tree, {
|
|
806
|
-
srcDir: 'tests/addon-test-support',
|
|
807
|
-
destDir: 'addon-test-support',
|
|
808
|
-
});
|
|
809
|
-
|
|
810
|
-
let testTree = new Funnel(tree, {
|
|
811
|
-
srcDir: 'tests',
|
|
812
|
-
exclude: ['addon-test-support/**/*'],
|
|
813
|
-
});
|
|
814
|
-
|
|
815
|
-
let treeToCompile = new Funnel(testTree, {
|
|
816
|
-
destDir: `${this.name}/tests`,
|
|
817
|
-
annotation: 'Tests To Process',
|
|
818
|
-
});
|
|
819
|
-
|
|
820
|
-
treeToCompile = callAddonsPreprocessTreeHook(this.project, 'test', treeToCompile);
|
|
821
|
-
|
|
822
|
-
const inputPath = '/tests';
|
|
823
|
-
let preprocessedTests = preprocessJs(treeToCompile, inputPath, this.name, {
|
|
824
|
-
registry: this.registry,
|
|
825
|
-
treeType: 'test',
|
|
826
|
-
});
|
|
827
|
-
|
|
828
|
-
let mergedTestTrees = mergeTrees([addonTestSupportTree, preprocessedTests], {
|
|
829
|
-
overwrite: true,
|
|
830
|
-
annotation: 'Packaged Tests',
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
this._cachedTests = callAddonsPostprocessTreeHook(this.project, 'test', mergedTestTrees);
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
return this._cachedTests;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
/*
|
|
840
|
-
* Concatenates all test files into one, as follows:
|
|
841
|
-
*
|
|
842
|
-
* Given an input tree that looks like:
|
|
843
|
-
*
|
|
844
|
-
* ```
|
|
845
|
-
* addon-tree-output/
|
|
846
|
-
* bower_components/
|
|
847
|
-
* the-best-app-ever/
|
|
848
|
-
* tests/
|
|
849
|
-
* ├── acceptance/
|
|
850
|
-
* ├── helpers/
|
|
851
|
-
* ├── index.html
|
|
852
|
-
* ├── integration/
|
|
853
|
-
* ├── test-helper.js
|
|
854
|
-
* └── unit/
|
|
855
|
-
* vendor/
|
|
856
|
-
* ```
|
|
857
|
-
*
|
|
858
|
-
* Returns:
|
|
859
|
-
*
|
|
860
|
-
* ```
|
|
861
|
-
* assets/
|
|
862
|
-
* tests.js
|
|
863
|
-
* test.map (if sourcemaps are enabled)
|
|
864
|
-
* test-support.js
|
|
865
|
-
* test-support.map (if sourcemaps are enabled)
|
|
866
|
-
* test-support.css
|
|
867
|
-
* ```
|
|
868
|
-
*
|
|
869
|
-
* @private
|
|
870
|
-
* @method packageTests
|
|
871
|
-
* @param {BroccoliTree}
|
|
872
|
-
* @return {BroccoliTree}
|
|
873
|
-
*/
|
|
874
|
-
packageTests(tree) {
|
|
875
|
-
let coreTestTree = this.processTests(tree);
|
|
876
|
-
|
|
877
|
-
let testIndex = this.processTestIndex(tree);
|
|
878
|
-
let appTestTree = this.packageApplicationTests(coreTestTree);
|
|
879
|
-
let testFilesTree = this.packageTestFiles(tree, coreTestTree);
|
|
880
|
-
|
|
881
|
-
return mergeTrees([testIndex, appTestTree, testFilesTree], {
|
|
882
|
-
annotation: 'Packaged Tests',
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
/*
|
|
887
|
-
* Replaces variables in `tests/index.html` file with values from
|
|
888
|
-
* `config/environment.js` and returns a single tree that contains
|
|
889
|
-
* `index.html` file with populated values.
|
|
890
|
-
*
|
|
891
|
-
* Input tree:
|
|
892
|
-
*
|
|
893
|
-
* ```
|
|
894
|
-
* /
|
|
895
|
-
* ├── addon-tree-output/
|
|
896
|
-
* ├── the-best-app-ever/
|
|
897
|
-
* ├── bower_components/
|
|
898
|
-
* ├── tests/
|
|
899
|
-
* └── vendor/
|
|
900
|
-
* ```
|
|
901
|
-
*
|
|
902
|
-
* Returns:
|
|
903
|
-
*
|
|
904
|
-
* ```
|
|
905
|
-
* └── tests
|
|
906
|
-
* └── index.html/
|
|
907
|
-
* ```
|
|
908
|
-
*
|
|
909
|
-
* @private
|
|
910
|
-
* @method processTestIndex
|
|
911
|
-
* @param {BroccoliTree}
|
|
912
|
-
* @return {BroccoliTree}
|
|
913
|
-
*/
|
|
914
|
-
processTestIndex(tree) {
|
|
915
|
-
let index = new Funnel(tree, {
|
|
916
|
-
srcDir: '/tests',
|
|
917
|
-
files: ['index.html'],
|
|
918
|
-
destDir: '/tests',
|
|
919
|
-
annotation: 'Funnel (test index)',
|
|
920
|
-
});
|
|
921
|
-
|
|
922
|
-
let patterns = configReplacePatterns({
|
|
923
|
-
addons: this.project.addons,
|
|
924
|
-
autoRun: this.autoRun,
|
|
925
|
-
storeConfigInMeta: this.storeConfigInMeta,
|
|
926
|
-
});
|
|
927
|
-
|
|
928
|
-
let configPath = path.join(this.name, 'config', 'environments', 'test.json');
|
|
929
|
-
|
|
930
|
-
return new ConfigReplace(index, this.packageConfig(), {
|
|
931
|
-
configPath,
|
|
932
|
-
files: ['tests/index.html'],
|
|
933
|
-
env: 'test',
|
|
934
|
-
patterns,
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
/*
|
|
939
|
-
* Wraps application configuration into AMD module:
|
|
940
|
-
*
|
|
941
|
-
* ```javascript
|
|
942
|
-
* define('the-best-app-ever/config/environment', [], function() {
|
|
943
|
-
* // read the meta tag that contains escaped configuration from
|
|
944
|
-
* // `index.html` and return as an object
|
|
945
|
-
* });
|
|
946
|
-
* ```
|
|
947
|
-
*
|
|
948
|
-
* Given a tree:
|
|
949
|
-
*
|
|
950
|
-
* ```
|
|
951
|
-
* environments/
|
|
952
|
-
* ├── development.json
|
|
953
|
-
* └── test.json
|
|
954
|
-
* ```
|
|
955
|
-
*
|
|
956
|
-
* Returns:
|
|
957
|
-
*
|
|
958
|
-
* ```
|
|
959
|
-
* └── vendor
|
|
960
|
-
* └── ember-cli
|
|
961
|
-
* └── app-config.js
|
|
962
|
-
* ```
|
|
963
|
-
* @private
|
|
964
|
-
* @method packageTestApplicationConfig
|
|
965
|
-
*/
|
|
966
|
-
packageTestApplicationConfig() {
|
|
967
|
-
let files = ['app-config.js'];
|
|
968
|
-
let patterns = configReplacePatterns({
|
|
969
|
-
addons: this.project.addons,
|
|
970
|
-
autoRun: this.autoRun,
|
|
971
|
-
storeConfigInMeta: this.storeConfigInMeta,
|
|
972
|
-
});
|
|
973
|
-
|
|
974
|
-
let configPath = path.join(this.name, 'config', 'environments', `test.json`);
|
|
975
|
-
let emberCLITree = new ConfigReplace(new UnwatchedDir(__dirname), this.packageConfig(), {
|
|
976
|
-
configPath,
|
|
977
|
-
files,
|
|
978
|
-
patterns,
|
|
979
|
-
});
|
|
980
|
-
|
|
981
|
-
return new Funnel(emberCLITree, {
|
|
982
|
-
files,
|
|
983
|
-
srcDir: '/',
|
|
984
|
-
destDir: '/vendor/ember-cli/',
|
|
985
|
-
annotation: 'Funnel (test-app-config-tree)',
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
/*
|
|
990
|
-
* Concatenates all application test files into one, as follows:
|
|
991
|
-
*
|
|
992
|
-
* Given an input tree that looks like:
|
|
993
|
-
*
|
|
994
|
-
* ```
|
|
995
|
-
* addon-tree-output/
|
|
996
|
-
* bower_components/
|
|
997
|
-
* the-best-app-ever/
|
|
998
|
-
* tests/
|
|
999
|
-
* ├── acceptance/
|
|
1000
|
-
* ├── helpers/
|
|
1001
|
-
* ├── index.html
|
|
1002
|
-
* ├── integration/
|
|
1003
|
-
* ├── test-helper.js
|
|
1004
|
-
* └── unit/
|
|
1005
|
-
* vendor/
|
|
1006
|
-
* ```
|
|
1007
|
-
*
|
|
1008
|
-
* Returns:
|
|
1009
|
-
*
|
|
1010
|
-
* ```
|
|
1011
|
-
* assets/
|
|
1012
|
-
* tests.js
|
|
1013
|
-
* test.map (if sourcemaps are enabled)
|
|
1014
|
-
* ```
|
|
1015
|
-
*
|
|
1016
|
-
* @private
|
|
1017
|
-
* @method packageApplicationTests
|
|
1018
|
-
* @param {BroccoliTree}
|
|
1019
|
-
* @return {BroccoliTree}
|
|
1020
|
-
*/
|
|
1021
|
-
packageApplicationTests(tree) {
|
|
1022
|
-
let appTestTrees = []
|
|
1023
|
-
.concat(this.packageEmberCliInternalFiles(), this.packageTestApplicationConfig(), tree)
|
|
1024
|
-
.filter(Boolean);
|
|
1025
|
-
|
|
1026
|
-
appTestTrees = mergeTrees(appTestTrees, {
|
|
1027
|
-
overwrite: true,
|
|
1028
|
-
annotation: 'TreeMerger (appTestTrees)',
|
|
1029
|
-
});
|
|
1030
|
-
|
|
1031
|
-
return concat(appTestTrees, {
|
|
1032
|
-
inputFiles: ['**/tests/**/*.js'],
|
|
1033
|
-
headerFiles: ['vendor/ember-cli/tests-prefix.js'],
|
|
1034
|
-
footerFiles: ['vendor/ember-cli/app-config.js', 'vendor/ember-cli/tests-suffix.js'],
|
|
1035
|
-
outputFile: this.distPaths.testJsFile,
|
|
1036
|
-
annotation: 'Concat: App Tests',
|
|
1037
|
-
sourceMapConfig: this.sourcemaps,
|
|
1038
|
-
});
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
/*
|
|
1042
|
-
* Concatenates all test support files into one, as follows:
|
|
1043
|
-
*
|
|
1044
|
-
* Given an input tree that looks like:
|
|
1045
|
-
*
|
|
1046
|
-
* ```
|
|
1047
|
-
* addon-tree-output/
|
|
1048
|
-
* bower_components/
|
|
1049
|
-
* the-best-app-ever/
|
|
1050
|
-
* tests/
|
|
1051
|
-
* ├── acceptance/
|
|
1052
|
-
* ├── helpers/
|
|
1053
|
-
* ├── index.html
|
|
1054
|
-
* ├── integration/
|
|
1055
|
-
* ├── test-helper.js
|
|
1056
|
-
* └── unit/
|
|
1057
|
-
* vendor/
|
|
1058
|
-
* ```
|
|
1059
|
-
*
|
|
1060
|
-
* Returns:
|
|
1061
|
-
*
|
|
1062
|
-
* ```
|
|
1063
|
-
* assets/
|
|
1064
|
-
* test-support.js
|
|
1065
|
-
* test-support.map (if sourcemaps are enabled)
|
|
1066
|
-
* test-support.css
|
|
1067
|
-
* ```
|
|
1068
|
-
*
|
|
1069
|
-
* @private
|
|
1070
|
-
* @method packageTestFiles
|
|
1071
|
-
* @return {BroccoliTree}
|
|
1072
|
-
*/
|
|
1073
|
-
packageTestFiles(tree, coreTestTree) {
|
|
1074
|
-
let testSupportPath = this.distPaths.testSupportJsFile;
|
|
1075
|
-
|
|
1076
|
-
testSupportPath = testSupportPath.testSupport || testSupportPath;
|
|
1077
|
-
|
|
1078
|
-
let emberCLITree = this.packageEmberCliInternalFiles();
|
|
1079
|
-
|
|
1080
|
-
let headerFiles = [].concat('vendor/ember-cli/test-support-prefix.js', this.legacyTestFilesToAppend);
|
|
1081
|
-
|
|
1082
|
-
let inputFiles = ['addon-test-support/**/*.js'];
|
|
1083
|
-
|
|
1084
|
-
let footerFiles = ['vendor/ember-cli/test-support-suffix.js'];
|
|
1085
|
-
|
|
1086
|
-
let external = this.applyCustomTransforms(tree);
|
|
1087
|
-
|
|
1088
|
-
let baseMergedTree = mergeTrees([emberCLITree, tree, external, coreTestTree], {
|
|
1089
|
-
overwrite: true,
|
|
1090
|
-
});
|
|
1091
|
-
let testJs = concat(baseMergedTree, {
|
|
1092
|
-
headerFiles,
|
|
1093
|
-
inputFiles,
|
|
1094
|
-
footerFiles,
|
|
1095
|
-
outputFile: testSupportPath,
|
|
1096
|
-
annotation: 'Concat: Test Support JS',
|
|
1097
|
-
allowNone: true,
|
|
1098
|
-
sourceMapConfig: this.sourcemaps,
|
|
1099
|
-
});
|
|
1100
|
-
|
|
1101
|
-
let testemPath = path.join(__dirname, 'testem');
|
|
1102
|
-
testemPath = path.dirname(testemPath);
|
|
1103
|
-
|
|
1104
|
-
let testemTree = new Funnel(new UnwatchedDir(testemPath), {
|
|
1105
|
-
files: ['testem.js'],
|
|
1106
|
-
annotation: 'Funnel (testem)',
|
|
1107
|
-
});
|
|
1108
|
-
|
|
1109
|
-
let sourceTrees = [testemTree, testJs];
|
|
1110
|
-
|
|
1111
|
-
if (this.vendorTestStaticStyles.length > 0) {
|
|
1112
|
-
sourceTrees.push(
|
|
1113
|
-
concat(tree, {
|
|
1114
|
-
headerFiles: this.vendorTestStaticStyles,
|
|
1115
|
-
outputFile: this.distPaths.testSupportCssFile,
|
|
1116
|
-
annotation: 'Concat: Test Support CSS',
|
|
1117
|
-
sourceMapConfig: this.sourcemaps,
|
|
1118
|
-
})
|
|
1119
|
-
);
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
return mergeTrees(sourceTrees, {
|
|
1123
|
-
overwrite: true,
|
|
1124
|
-
annotation: 'TreeMerger (testFiles)',
|
|
1125
|
-
});
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
/*
|
|
1129
|
-
* Returns a flattened input tree.
|
|
1130
|
-
*
|
|
1131
|
-
* Given a tree:
|
|
1132
|
-
*
|
|
1133
|
-
* ```
|
|
1134
|
-
* public
|
|
1135
|
-
* ├── crossdomain.xml
|
|
1136
|
-
* ├── ember-fetch
|
|
1137
|
-
* ├── favicon.ico
|
|
1138
|
-
* ├── images
|
|
1139
|
-
* └── robots.txt
|
|
1140
|
-
* ```
|
|
1141
|
-
*
|
|
1142
|
-
* Returns:
|
|
1143
|
-
*
|
|
1144
|
-
* ```
|
|
1145
|
-
* ├── crossdomain.xml
|
|
1146
|
-
* ├── ember-fetch
|
|
1147
|
-
* ├── favicon.ico
|
|
1148
|
-
* ├── images
|
|
1149
|
-
* └── robots.txt
|
|
1150
|
-
* ```
|
|
1151
|
-
*
|
|
1152
|
-
* @private
|
|
1153
|
-
* @method packagePublic
|
|
1154
|
-
* @param {BroccoliTree} tree
|
|
1155
|
-
* @return {BroccoliTree}
|
|
1156
|
-
*/
|
|
1157
|
-
packagePublic(tree) {
|
|
1158
|
-
if (this._cachedPublic === null) {
|
|
1159
|
-
this._cachedPublic = new Funnel(tree, {
|
|
1160
|
-
srcDir: 'public',
|
|
1161
|
-
destDir: '.',
|
|
1162
|
-
});
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
return this._cachedPublic;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
/*
|
|
1169
|
-
* Given an input tree, returns a properly assembled Broccoli tree with
|
|
1170
|
-
* configuration files.
|
|
1171
|
-
*
|
|
1172
|
-
* Given a tree:
|
|
1173
|
-
*
|
|
1174
|
-
* ```
|
|
1175
|
-
* environments/
|
|
1176
|
-
* ├── development.json
|
|
1177
|
-
* └── test.json
|
|
1178
|
-
* ```
|
|
1179
|
-
*
|
|
1180
|
-
* Returns:
|
|
1181
|
-
*
|
|
1182
|
-
* ```
|
|
1183
|
-
* └── [name]
|
|
1184
|
-
* └── config
|
|
1185
|
-
* └── environments
|
|
1186
|
-
* ├── development.json
|
|
1187
|
-
* └── test.json
|
|
1188
|
-
* ```
|
|
1189
|
-
* @private
|
|
1190
|
-
* @method packageConfig
|
|
1191
|
-
*/
|
|
1192
|
-
packageConfig() {
|
|
1193
|
-
let env = this.env;
|
|
1194
|
-
let name = this.name;
|
|
1195
|
-
let project = this.project;
|
|
1196
|
-
let configPath = this.project.configPath();
|
|
1197
|
-
|
|
1198
|
-
if (this._cachedConfig === null) {
|
|
1199
|
-
let configTree = new ConfigLoader(path.dirname(configPath), {
|
|
1200
|
-
env,
|
|
1201
|
-
tests: this.areTestsEnabled || false,
|
|
1202
|
-
project,
|
|
1203
|
-
});
|
|
1204
|
-
|
|
1205
|
-
this._cachedConfig = new Funnel(configTree, {
|
|
1206
|
-
destDir: `${name}/config`,
|
|
1207
|
-
annotation: 'Packaged Config',
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
return this._cachedConfig;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
/*
|
|
1215
|
-
* Concatenates all javascript Broccoli trees into one, as follows:
|
|
1216
|
-
*
|
|
1217
|
-
* Given an input tree that looks like:
|
|
1218
|
-
*
|
|
1219
|
-
* ```
|
|
1220
|
-
* addon-tree-output/
|
|
1221
|
-
* ember-ajax/
|
|
1222
|
-
* ember-data/
|
|
1223
|
-
* ember-engines/
|
|
1224
|
-
* ember-resolver/
|
|
1225
|
-
* ...
|
|
1226
|
-
* bower_components/
|
|
1227
|
-
* usertiming/
|
|
1228
|
-
* sinonjs/
|
|
1229
|
-
* ...
|
|
1230
|
-
* the-best-app-ever/
|
|
1231
|
-
* components/
|
|
1232
|
-
* config/
|
|
1233
|
-
* helpers/
|
|
1234
|
-
* routes/
|
|
1235
|
-
* ...
|
|
1236
|
-
* vendor/
|
|
1237
|
-
* ...
|
|
1238
|
-
* babel-core/
|
|
1239
|
-
* ...
|
|
1240
|
-
* broccoli-concat/
|
|
1241
|
-
* ...
|
|
1242
|
-
* ember-cli-template-lint/
|
|
1243
|
-
* ...
|
|
1244
|
-
* ```
|
|
1245
|
-
*
|
|
1246
|
-
* Returns:
|
|
1247
|
-
*
|
|
1248
|
-
* ```
|
|
1249
|
-
* assets/
|
|
1250
|
-
* the-best-app-ever.js
|
|
1251
|
-
* the-best-app-ever.map (if sourcemaps are enabled)
|
|
1252
|
-
* vendor.js
|
|
1253
|
-
* vendor.map (if sourcemaps are enabled)
|
|
1254
|
-
* ```
|
|
1255
|
-
*
|
|
1256
|
-
* @private
|
|
1257
|
-
* @method packageJavascript
|
|
1258
|
-
* @return {BroccoliTree}
|
|
1259
|
-
*/
|
|
1260
|
-
packageJavascript(tree) {
|
|
1261
|
-
if (this._cachedJavascript === null) {
|
|
1262
|
-
let applicationJs = this.processAppAndDependencies(tree);
|
|
1263
|
-
|
|
1264
|
-
let vendorFilePath = this.distPaths.vendorJsFile;
|
|
1265
|
-
this.scriptOutputFiles[vendorFilePath].unshift('vendor/ember-cli/vendor-prefix.js');
|
|
1266
|
-
|
|
1267
|
-
let appJs = this.packageApplicationJs(applicationJs);
|
|
1268
|
-
let vendorJs = this.packageVendorJs(applicationJs);
|
|
1269
|
-
|
|
1270
|
-
this._cachedJavascript = mergeTrees([appJs, vendorJs], {
|
|
1271
|
-
overwrite: true,
|
|
1272
|
-
annotation: 'Packaged Javascript',
|
|
1273
|
-
});
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
return this._cachedJavascript;
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
/*
|
|
1280
|
-
* Concatenates all application's javascript Broccoli trees into one, as follows:
|
|
1281
|
-
*
|
|
1282
|
-
* Given an input tree that looks like:
|
|
1283
|
-
*
|
|
1284
|
-
* ```
|
|
1285
|
-
* addon-tree-output/
|
|
1286
|
-
* ember-ajax/
|
|
1287
|
-
* ember-data/
|
|
1288
|
-
* ember-engines/
|
|
1289
|
-
* ember-resolver/
|
|
1290
|
-
* ...
|
|
1291
|
-
* bower_components/
|
|
1292
|
-
* usertiming/
|
|
1293
|
-
* sinonjs/
|
|
1294
|
-
* ...
|
|
1295
|
-
* the-best-app-ever/
|
|
1296
|
-
* components/
|
|
1297
|
-
* config/
|
|
1298
|
-
* helpers/
|
|
1299
|
-
* routes/
|
|
1300
|
-
* ...
|
|
1301
|
-
* vendor/
|
|
1302
|
-
* ...
|
|
1303
|
-
* babel-core/
|
|
1304
|
-
* ...
|
|
1305
|
-
* broccoli-concat/
|
|
1306
|
-
* ...
|
|
1307
|
-
* ember-cli-template-lint/
|
|
1308
|
-
* ...
|
|
1309
|
-
* ```
|
|
1310
|
-
*
|
|
1311
|
-
* Returns:
|
|
1312
|
-
*
|
|
1313
|
-
* ```
|
|
1314
|
-
* assets/
|
|
1315
|
-
* the-best-app-ever.js
|
|
1316
|
-
* the-best-app-ever.map (if sourcemaps are enabled)
|
|
1317
|
-
* ```
|
|
1318
|
-
*
|
|
1319
|
-
* @private
|
|
1320
|
-
* @method packageApplicationJs
|
|
1321
|
-
* @return {BroccoliTree}
|
|
1322
|
-
*/
|
|
1323
|
-
packageApplicationJs(tree) {
|
|
1324
|
-
let inputFiles = [`${this.name}/**/*.js`];
|
|
1325
|
-
let headerFiles = ['vendor/ember-cli/app-prefix.js'];
|
|
1326
|
-
let footerFiles = [
|
|
1327
|
-
'vendor/ember-cli/app-suffix.js',
|
|
1328
|
-
'vendor/ember-cli/app-config.js',
|
|
1329
|
-
'vendor/ember-cli/app-boot.js',
|
|
1330
|
-
];
|
|
1331
|
-
|
|
1332
|
-
return concat(tree, {
|
|
1333
|
-
inputFiles,
|
|
1334
|
-
headerFiles,
|
|
1335
|
-
footerFiles,
|
|
1336
|
-
outputFile: this.distPaths.appJsFile,
|
|
1337
|
-
annotation: 'Packaged Application Javascript',
|
|
1338
|
-
separator: '\n;',
|
|
1339
|
-
sourceMapConfig: this.sourcemaps,
|
|
1340
|
-
});
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
/*
|
|
1344
|
-
* Concatenates all application's vendor javascript Broccoli trees into one, as follows:
|
|
1345
|
-
*
|
|
1346
|
-
* Given an input tree that looks like:
|
|
1347
|
-
* ```
|
|
1348
|
-
* addon-tree-output/
|
|
1349
|
-
* ember-ajax/
|
|
1350
|
-
* ember-data/
|
|
1351
|
-
* ember-engines/
|
|
1352
|
-
* ember-resolver/
|
|
1353
|
-
* ...
|
|
1354
|
-
* bower_components/
|
|
1355
|
-
* usertiming/
|
|
1356
|
-
* sinonjs/
|
|
1357
|
-
* ...
|
|
1358
|
-
* the-best-app-ever/
|
|
1359
|
-
* components/
|
|
1360
|
-
* config/
|
|
1361
|
-
* helpers/
|
|
1362
|
-
* routes/
|
|
1363
|
-
* ...
|
|
1364
|
-
* vendor/
|
|
1365
|
-
* ...
|
|
1366
|
-
* babel-core/
|
|
1367
|
-
* ...
|
|
1368
|
-
* broccoli-concat/
|
|
1369
|
-
* ...
|
|
1370
|
-
* ember-cli-template-lint/
|
|
1371
|
-
* ...
|
|
1372
|
-
* ```
|
|
1373
|
-
*
|
|
1374
|
-
* Returns:
|
|
1375
|
-
*
|
|
1376
|
-
* ```
|
|
1377
|
-
* assets/
|
|
1378
|
-
* vendor.js
|
|
1379
|
-
* vendor.map (if sourcemaps are enabled)
|
|
1380
|
-
* ```
|
|
1381
|
-
*
|
|
1382
|
-
* @method packageVendorJs
|
|
1383
|
-
* @param {BroccoliTree} tree
|
|
1384
|
-
* @return {BroccoliTree}
|
|
1385
|
-
*/
|
|
1386
|
-
packageVendorJs(tree) {
|
|
1387
|
-
let importPaths = Object.keys(this.scriptOutputFiles);
|
|
1388
|
-
|
|
1389
|
-
// iterate over the keys and concat files
|
|
1390
|
-
// to support scenarios like
|
|
1391
|
-
// app.import('vendor/foobar.js', { outputFile: 'assets/baz.js' });
|
|
1392
|
-
let vendorTrees = importPaths.map((importPath) => {
|
|
1393
|
-
let files = this.scriptOutputFiles[importPath];
|
|
1394
|
-
let isMainVendorFile = importPath === this.distPaths.vendorJsFile;
|
|
1395
|
-
|
|
1396
|
-
const vendorObject = getVendorFiles(files, isMainVendorFile);
|
|
1397
|
-
|
|
1398
|
-
return concat(tree, {
|
|
1399
|
-
inputFiles: vendorObject.inputFiles,
|
|
1400
|
-
headerFiles: vendorObject.headerFiles,
|
|
1401
|
-
footerFiles: vendorObject.footerFiles,
|
|
1402
|
-
outputFile: importPath,
|
|
1403
|
-
annotation: `Package ${importPath}`,
|
|
1404
|
-
separator: '\n;',
|
|
1405
|
-
sourceMapConfig: this.sourcemaps,
|
|
1406
|
-
});
|
|
1407
|
-
});
|
|
1408
|
-
|
|
1409
|
-
return mergeTrees(vendorTrees, {
|
|
1410
|
-
overwrite: true,
|
|
1411
|
-
annotation: 'Packaged Vendor Javascript',
|
|
1412
|
-
});
|
|
1413
|
-
}
|
|
1414
|
-
};
|
|
1415
|
-
|
|
1416
|
-
</pre>
|
|
1417
|
-
|
|
1418
|
-
</div>
|
|
1419
|
-
</div>
|
|
1420
|
-
</div>
|
|
1421
|
-
</div>
|
|
1422
|
-
<script src="../assets/vendor/prettify/prettify-min.js"></script>
|
|
1423
|
-
<script>prettyPrint();</script>
|
|
1424
|
-
<script src="../assets/js/yui-prettify.js"></script>
|
|
1425
|
-
</body>
|
|
1426
|
-
</html>
|