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.
- package/.github/workflows/ci.yml +4 -4
- package/CHANGELOG.md +17 -2
- package/blueprints/app/files/package.json +2 -2
- package/docs/build/data.json +3 -3
- 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,252 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>lib/models/per-bundle-addon-cache/addon-proxy.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/per-bundle-addon-cache/addon-proxy.js</h1>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<pre class="code prettyprint linenums">
|
|
83
|
-
'use strict';
|
|
84
|
-
|
|
85
|
-
const { TARGET_INSTANCE } = require('./target-instance');
|
|
86
|
-
|
|
87
|
-
const CACHE_KEY_FOR_TREE_TRACKER = Symbol('CACHE_KEY_FOR_TREE_TRACKER');
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Validates that a new cache key for a given tree type matches the previous
|
|
91
|
-
* cache key for the same tree type. To opt-in to bundle addon caching for
|
|
92
|
-
* a given addon it's assumed that it returns stable cache keys; specifically
|
|
93
|
-
* this is because the interplay between bundle addon caching and `ember-engines`
|
|
94
|
-
* when transitive deduplication is enabled assumes stable cache keys, so we validate
|
|
95
|
-
* for this case here.
|
|
96
|
-
*
|
|
97
|
-
* @method validateCacheKey
|
|
98
|
-
* @param {Addon} realAddonInstance The real addon instance
|
|
99
|
-
* @param {string} treeType
|
|
100
|
-
* @param {string} newCacheKey
|
|
101
|
-
* @throws {Error} If the new cache key doesn't match the previous cache key
|
|
102
|
-
*/
|
|
103
|
-
function validateCacheKey(realAddonInstance, treeType, newCacheKey) {
|
|
104
|
-
let cacheKeyTracker = realAddonInstance[CACHE_KEY_FOR_TREE_TRACKER];
|
|
105
|
-
|
|
106
|
-
if (!cacheKeyTracker) {
|
|
107
|
-
cacheKeyTracker = {};
|
|
108
|
-
realAddonInstance[CACHE_KEY_FOR_TREE_TRACKER] = cacheKeyTracker;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
cacheKeyTracker[treeType] = treeType in cacheKeyTracker ? cacheKeyTracker[treeType] : newCacheKey;
|
|
112
|
-
|
|
113
|
-
if (cacheKeyTracker[treeType] !== newCacheKey) {
|
|
114
|
-
throw new Error(
|
|
115
|
-
`[ember-cli] addon bundle caching can only be used on addons that have stable cache keys (previously \`${
|
|
116
|
-
cacheKeyTracker[treeType]
|
|
117
|
-
}\`, now \`${newCacheKey}\`; for addon \`${realAddonInstance.name}\` located at \`${
|
|
118
|
-
realAddonInstance.packageRoot || realAddonInstance.root
|
|
119
|
-
}\`)`
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Returns a proxy to a target with specific handling for the
|
|
126
|
-
* `parent` property, as well has to handle the `app` property;
|
|
127
|
-
* that is, the proxy should maintain correct local state in
|
|
128
|
-
* closure scope for the `app` property if it happens to be set
|
|
129
|
-
* by `ember-cli`. Other than `parent` & `app`, this function also
|
|
130
|
-
* proxies _almost_ everything to `target[TARGET_INSTANCE] with a few
|
|
131
|
-
* exceptions: we trap & return `[]` for `addons`, and we don't return
|
|
132
|
-
* the original `included` (it's already called on the "real" addon
|
|
133
|
-
* by `ember-cli`).
|
|
134
|
-
*
|
|
135
|
-
* Note: the target is NOT the per-bundle cacheable instance of the addon. Rather,
|
|
136
|
-
* it is a cache entry POJO from PerBundleAddonCache.
|
|
137
|
-
*
|
|
138
|
-
* @method getAddonProxy
|
|
139
|
-
* @param targetCacheEntry the PerBundleAddonCache cache entry we are to proxy. It
|
|
140
|
-
* has one interesting property, the real addon instance the proxy is forwarding
|
|
141
|
-
* calls to (that property is not globally exposed).
|
|
142
|
-
* @param parent the parent object of the proxy being created (the same as
|
|
143
|
-
* the 'parent' property of a normal addon instance)
|
|
144
|
-
* @return Proxy
|
|
145
|
-
*/
|
|
146
|
-
function getAddonProxy(targetCacheEntry, parent) {
|
|
147
|
-
let _app;
|
|
148
|
-
|
|
149
|
-
// handle `preprocessJs` separately for Embroider
|
|
150
|
-
//
|
|
151
|
-
// some context here:
|
|
152
|
-
//
|
|
153
|
-
// Embroider patches `preprocessJs`, so we want to maintain local state within the
|
|
154
|
-
// proxy rather than allowing a patched `preprocessJs` set on the original addon
|
|
155
|
-
// instance itself
|
|
156
|
-
//
|
|
157
|
-
// for more info as to where this happens, see:
|
|
158
|
-
// https://github.com/embroider-build/embroider/blob/master/packages/compat/src/v1-addon.ts#L634
|
|
159
|
-
let _preprocessJs;
|
|
160
|
-
|
|
161
|
-
return new Proxy(targetCacheEntry, {
|
|
162
|
-
get(targetCacheEntry, property) {
|
|
163
|
-
if (property === 'parent') {
|
|
164
|
-
return parent;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (property === 'app') {
|
|
168
|
-
return _app;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// only return `_preprocessJs` here if it was previously set to a patched version
|
|
172
|
-
if (property === 'preprocessJs' && _preprocessJs) {
|
|
173
|
-
return _preprocessJs;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// keep proxies from even trying to set or initialize addons
|
|
177
|
-
if (property === 'initializeAddons') {
|
|
178
|
-
return undefined;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// See the {@link index.js} file for a discussion of why the proxy 'addons'
|
|
182
|
-
// property returns an empty array.
|
|
183
|
-
if (property === 'addons') {
|
|
184
|
-
return [];
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// allow access to the property pointing to the real instance.
|
|
188
|
-
if (property === TARGET_INSTANCE) {
|
|
189
|
-
return targetCacheEntry[TARGET_INSTANCE];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// `included` will be called on the "real" addon, so there's no need for it to be
|
|
193
|
-
// called again; instead we return a no-op implementation here
|
|
194
|
-
if (property === 'included') {
|
|
195
|
-
return () => undefined;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (targetCacheEntry[TARGET_INSTANCE]) {
|
|
199
|
-
if (property !== 'constructor' && typeof targetCacheEntry[TARGET_INSTANCE][property] === 'function') {
|
|
200
|
-
// If we fall through to the Reflect.get just below, the 'this' context of the function when
|
|
201
|
-
// invoked is the proxy, not the original instance (so its local state is incorrect).
|
|
202
|
-
// Wrap the original methods to maintain the correct 'this' context.
|
|
203
|
-
return function _originalAddonPropMethodWrapper() {
|
|
204
|
-
let originalReturnValue = targetCacheEntry[TARGET_INSTANCE][property](...arguments);
|
|
205
|
-
|
|
206
|
-
if (property === 'cacheKeyForTree') {
|
|
207
|
-
const treeType = arguments[0];
|
|
208
|
-
validateCacheKey(targetCacheEntry[TARGET_INSTANCE], treeType, originalReturnValue);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return originalReturnValue;
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return Reflect.get(targetCacheEntry[TARGET_INSTANCE], property);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return Reflect.get(targetCacheEntry, property);
|
|
219
|
-
},
|
|
220
|
-
set(targetCacheEntry, property, value) {
|
|
221
|
-
if (property === 'app') {
|
|
222
|
-
_app = value;
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (property === 'preprocessJs') {
|
|
227
|
-
_preprocessJs = value;
|
|
228
|
-
return true;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (targetCacheEntry[TARGET_INSTANCE]) {
|
|
232
|
-
return Reflect.set(targetCacheEntry[TARGET_INSTANCE], property, value);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return Reflect.set(targetCacheEntry, property, value);
|
|
236
|
-
},
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
module.exports = { getAddonProxy };
|
|
241
|
-
|
|
242
|
-
</pre>
|
|
243
|
-
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
<script src="../assets/vendor/prettify/prettify-min.js"></script>
|
|
249
|
-
<script>prettyPrint();</script>
|
|
250
|
-
<script src="../assets/js/yui-prettify.js"></script>
|
|
251
|
-
</body>
|
|
252
|
-
</html>
|