ember-source 4.10.0-beta.5 → 4.10.0
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/CHANGELOG.md +8 -20
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +31 -11
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +3 -3
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +209 -70
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +1 -1
- package/dist/packages/@ember/-internals/metal/index.js +3 -4
- package/dist/packages/@ember/-internals/string/index.js +83 -0
- package/dist/packages/@ember/-internals/views/lib/views/states/default.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/destroying.js +2 -3
- package/dist/packages/@ember/-internals/views/lib/views/states/in_dom.js +1 -2
- package/dist/packages/@ember/debug/container-debug-adapter.js +1 -1
- package/dist/packages/@ember/debug/data-adapter.js +1 -1
- package/dist/packages/@ember/debug/index.js +1 -2
- package/dist/packages/@ember/engine/instance.js +1 -2
- package/dist/packages/@ember/error/index.js +26 -4
- package/dist/packages/@ember/object/promise-proxy-mixin.js +1 -2
- package/dist/packages/@ember/routing/lib/utils.js +1 -2
- package/dist/packages/@ember/routing/router.js +2 -3
- package/dist/packages/@ember/string/index.js +31 -6
- package/dist/packages/@ember/string/lib/string_registry.js +13 -2
- package/dist/packages/ember/index.js +21 -25
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +192 -81
- package/package.json +4 -7
package/dist/header/license.js
CHANGED
|
@@ -15,7 +15,7 @@ import EngineInstance from '@ember/engine/instance';
|
|
|
15
15
|
import { flaggedInstrument, _instrumentStart } from '@ember/instrumentation';
|
|
16
16
|
import { service } from '@ember/service';
|
|
17
17
|
import { DEBUG } from '@glimmer/env';
|
|
18
|
-
import { dasherize } from '@ember/string';
|
|
18
|
+
import { dasherize } from '@ember/-internals/string';
|
|
19
19
|
import { registerDestructor, associateDestroyableChild, destroy } from '@glimmer/destroyable';
|
|
20
20
|
import { join, schedule, _backburner, _getCurrentRunLoop } from '@ember/runloop';
|
|
21
21
|
import { _WeakSet, EMPTY_ARRAY, unwrapTemplate, dict } from '@glimmer/util';
|
|
@@ -9,7 +9,6 @@ export { createCache, getValue, isConst } from '@glimmer/validator';
|
|
|
9
9
|
import { DEBUG } from '@glimmer/env';
|
|
10
10
|
import { getCustomTagFor } from '@glimmer/manager';
|
|
11
11
|
import { _WeakSet } from '@glimmer/util';
|
|
12
|
-
import EmberError from '@ember/error';
|
|
13
12
|
import VERSION from 'ember/version';
|
|
14
13
|
import { getOwner } from '@ember/-internals/owner';
|
|
15
14
|
|
|
@@ -1267,7 +1266,7 @@ class ComputedProperty extends ComputedDescriptor {
|
|
|
1267
1266
|
return ret;
|
|
1268
1267
|
}
|
|
1269
1268
|
_throwReadOnlyError(obj, keyName) {
|
|
1270
|
-
throw new
|
|
1269
|
+
throw new Error(`Cannot set read-only property "${keyName}" on object: ${inspect(obj)}`);
|
|
1271
1270
|
}
|
|
1272
1271
|
_set(obj, keyName, value, meta$$1) {
|
|
1273
1272
|
let hadCachedValue = meta$$1.revisionFor(keyName) !== undefined;
|
|
@@ -1734,7 +1733,7 @@ function _setPath(root, path, value, tolerant) {
|
|
|
1734
1733
|
if (newRoot !== null && newRoot !== undefined) {
|
|
1735
1734
|
return set(newRoot, keyName, value);
|
|
1736
1735
|
} else if (!tolerant) {
|
|
1737
|
-
throw new
|
|
1736
|
+
throw new Error(`Property set failed: object in path "${parts.join('.')}" could not be found.`);
|
|
1738
1737
|
}
|
|
1739
1738
|
}
|
|
1740
1739
|
/**
|
|
@@ -1827,7 +1826,7 @@ class AliasedProperty extends ComputedDescriptor {
|
|
|
1827
1826
|
}
|
|
1828
1827
|
}
|
|
1829
1828
|
function AliasedProperty_readOnlySet(obj, keyName) {
|
|
1830
|
-
throw new
|
|
1829
|
+
throw new Error(`Cannot set read-only property '${keyName}' on object: ${inspect(obj)}`);
|
|
1831
1830
|
}
|
|
1832
1831
|
function AliasedProperty_oneWaySet(obj, keyName, value) {
|
|
1833
1832
|
defineProperty(obj, keyName, null);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This module exists to separate the @ember/string methods used
|
|
3
|
+
internally in ember-source, from those public methods that are
|
|
4
|
+
now deprecated and to be removed.
|
|
5
|
+
*/
|
|
6
|
+
import { Cache } from '@ember/-internals/utils';
|
|
7
|
+
const STRING_DASHERIZE_REGEXP = /[ _]/g;
|
|
8
|
+
const STRING_DASHERIZE_CACHE = new Cache(1000, key => decamelize(key).replace(STRING_DASHERIZE_REGEXP, '-'));
|
|
9
|
+
const STRING_CLASSIFY_REGEXP_1 = /^(-|_)+(.)?/;
|
|
10
|
+
const STRING_CLASSIFY_REGEXP_2 = /(.)(-|_|\.|\s)+(.)?/g;
|
|
11
|
+
const STRING_CLASSIFY_REGEXP_3 = /(^|\/|\.)([a-z])/g;
|
|
12
|
+
const CLASSIFY_CACHE = new Cache(1000, str => {
|
|
13
|
+
let replace1 = (_match, _separator, chr) => chr ? `_${chr.toUpperCase()}` : '';
|
|
14
|
+
let replace2 = (_match, initialChar, _separator, chr) => initialChar + (chr ? chr.toUpperCase() : '');
|
|
15
|
+
let parts = str.split('/');
|
|
16
|
+
for (let i = 0; i < parts.length; i++) {
|
|
17
|
+
parts[i] = parts[i].replace(STRING_CLASSIFY_REGEXP_1, replace1).replace(STRING_CLASSIFY_REGEXP_2, replace2);
|
|
18
|
+
}
|
|
19
|
+
return parts.join('/').replace(STRING_CLASSIFY_REGEXP_3, (match /*, separator, chr */) => match.toUpperCase());
|
|
20
|
+
});
|
|
21
|
+
const STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
|
|
22
|
+
const DECAMELIZE_CACHE = new Cache(1000, str => str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase());
|
|
23
|
+
/**
|
|
24
|
+
Defines string helper methods used internally in ember-source.
|
|
25
|
+
|
|
26
|
+
@class String
|
|
27
|
+
@private
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
Replaces underscores, spaces, or camelCase with dashes.
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
import { dasherize } from '@ember/-internals/string';
|
|
34
|
+
|
|
35
|
+
dasherize('innerHTML'); // 'inner-html'
|
|
36
|
+
dasherize('action_name'); // 'action-name'
|
|
37
|
+
dasherize('css-class-name'); // 'css-class-name'
|
|
38
|
+
dasherize('my favorite items'); // 'my-favorite-items'
|
|
39
|
+
dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
@method dasherize
|
|
43
|
+
@param {String} str The string to dasherize.
|
|
44
|
+
@return {String} the dasherized string.
|
|
45
|
+
@private
|
|
46
|
+
*/
|
|
47
|
+
export function dasherize(str) {
|
|
48
|
+
return STRING_DASHERIZE_CACHE.get(str);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
Returns the UpperCamelCase form of a string.
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
import { classify } from '@ember/string';
|
|
55
|
+
|
|
56
|
+
classify('innerHTML'); // 'InnerHTML'
|
|
57
|
+
classify('action_name'); // 'ActionName'
|
|
58
|
+
classify('css-class-name'); // 'CssClassName'
|
|
59
|
+
classify('my favorite items'); // 'MyFavoriteItems'
|
|
60
|
+
classify('private-docs/owner-invoice'); // 'PrivateDocs/OwnerInvoice'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
@method classify
|
|
64
|
+
@param {String} str the string to classify
|
|
65
|
+
@return {String} the classified string
|
|
66
|
+
@private
|
|
67
|
+
*/
|
|
68
|
+
export function classify(str) {
|
|
69
|
+
return CLASSIFY_CACHE.get(str);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
Converts a camelized string into all lower case separated by underscores.
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
decamelize('innerHTML'); // 'inner_html'
|
|
76
|
+
decamelize('action_name'); // 'action_name'
|
|
77
|
+
decamelize('css-class-name'); // 'css-class-name'
|
|
78
|
+
decamelize('my favorite items'); // 'my favorite items'
|
|
79
|
+
```
|
|
80
|
+
*/
|
|
81
|
+
function decamelize(str) {
|
|
82
|
+
return DECAMELIZE_CACHE.get(str);
|
|
83
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import EmberError from '@ember/error';
|
|
2
1
|
const _default = {
|
|
3
2
|
// appendChild is only legal while rendering the buffer.
|
|
4
3
|
appendChild() {
|
|
5
|
-
throw new
|
|
4
|
+
throw new Error("You can't use appendChild outside of the rendering process");
|
|
6
5
|
},
|
|
7
6
|
// Handle events from `Ember.EventDispatcher`
|
|
8
7
|
handleEvent() {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import EmberError from '@ember/error';
|
|
2
1
|
import _default from './default';
|
|
3
2
|
const destroying = Object.assign(Object.assign({}, _default), {
|
|
4
3
|
appendChild() {
|
|
5
|
-
throw new
|
|
4
|
+
throw new Error("You can't call appendChild on a view being destroyed");
|
|
6
5
|
},
|
|
7
6
|
rerender() {
|
|
8
|
-
throw new
|
|
7
|
+
throw new Error("You can't call rerender on a view being destroyed");
|
|
9
8
|
}
|
|
10
9
|
});
|
|
11
10
|
export default Object.freeze(destroying);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { teardownMandatorySetter } from '@ember/-internals/utils';
|
|
2
2
|
import { assert } from '@ember/debug';
|
|
3
|
-
import EmberError from '@ember/error';
|
|
4
3
|
import { DEBUG } from '@glimmer/env';
|
|
5
4
|
import hasElement from './has_element';
|
|
6
5
|
const inDOM = Object.assign(Object.assign({}, hasElement), {
|
|
@@ -20,7 +19,7 @@ const inDOM = Object.assign(Object.assign({}, hasElement), {
|
|
|
20
19
|
},
|
|
21
20
|
set(value) {
|
|
22
21
|
if (value !== elementId) {
|
|
23
|
-
throw new
|
|
22
|
+
throw new Error("Changing a view's elementId after creation is not allowed");
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getOwner } from '@ember/-internals/owner';
|
|
2
2
|
import { _backburner, next } from '@ember/runloop';
|
|
3
3
|
import { get } from '@ember/object';
|
|
4
|
-
import { dasherize } from '@ember/string';
|
|
4
|
+
import { dasherize } from '@ember/-internals/string';
|
|
5
5
|
import Namespace from '@ember/application/namespace';
|
|
6
6
|
import EmberObject from '@ember/object';
|
|
7
7
|
import { A as emberA } from '@ember/array';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isChrome, isFirefox } from '@ember/-internals/browser-environment';
|
|
2
|
-
import EmberError from '@ember/error';
|
|
3
2
|
import { DEBUG } from '@glimmer/env';
|
|
4
3
|
import _deprecate from './lib/deprecate';
|
|
5
4
|
import { isTesting } from './lib/testing';
|
|
@@ -104,7 +103,7 @@ if (DEBUG) {
|
|
|
104
103
|
*/
|
|
105
104
|
setDebugFunction('assert', function assert(desc, test) {
|
|
106
105
|
if (!test) {
|
|
107
|
-
throw new
|
|
106
|
+
throw new Error(`Assertion Failed: ${desc}`);
|
|
108
107
|
}
|
|
109
108
|
});
|
|
110
109
|
/**
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import EmberObject from '@ember/object';
|
|
5
5
|
import { RSVP } from '@ember/-internals/runtime';
|
|
6
6
|
import { assert } from '@ember/debug';
|
|
7
|
-
import EmberError from '@ember/error';
|
|
8
7
|
import { Registry, privatize as P } from '@ember/-internals/container';
|
|
9
8
|
import { guidFor } from '@ember/-internals/utils';
|
|
10
9
|
import { ENGINE_PARENT, getEngineParent, setEngineParent } from './lib/engine-parent';
|
|
@@ -117,7 +116,7 @@ class EngineInstance extends EmberObject.extend(RegistryProxyMixin, ContainerPro
|
|
|
117
116
|
buildChildEngineInstance(name, options = {}) {
|
|
118
117
|
let Engine = this.lookup(`engine:${name}`);
|
|
119
118
|
if (!Engine) {
|
|
120
|
-
throw new
|
|
119
|
+
throw new Error(`You attempted to mount the engine '${name}', but it is not registered with its parent.`);
|
|
121
120
|
}
|
|
122
121
|
assert('expected an Engine', Engine instanceof CEngine);
|
|
123
122
|
let engineInstance = Engine.buildInstance(options);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
1
|
+
import { deprecate } from '@ember/debug';
|
|
2
|
+
import { DEBUG } from '@glimmer/env';
|
|
4
3
|
/**
|
|
5
4
|
The JavaScript Error object used by Ember.assert.
|
|
6
5
|
|
|
@@ -9,5 +8,28 @@
|
|
|
9
8
|
@extends Error
|
|
10
9
|
@constructor
|
|
11
10
|
@public
|
|
11
|
+
@deprecated
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
let EmberError;
|
|
14
|
+
if (DEBUG) {
|
|
15
|
+
// eslint-disable-next-line no-inner-declarations
|
|
16
|
+
function EmberDebugConstructor(message) {
|
|
17
|
+
deprecate('The @ember/error package merely re-exported the native Error and is deprecated. Please use a native Error directly instead.', false, {
|
|
18
|
+
id: 'deprecate-ember-error',
|
|
19
|
+
until: '5.0.0',
|
|
20
|
+
url: 'https://deprecations.emberjs.com/v4.x/#toc_deprecate-ember-error',
|
|
21
|
+
for: 'ember-source',
|
|
22
|
+
since: {
|
|
23
|
+
available: '4.10.0',
|
|
24
|
+
enabled: '4.10.0'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return new Error(message);
|
|
28
|
+
}
|
|
29
|
+
EmberDebugConstructor.prototype = Error.prototype;
|
|
30
|
+
// SAFETY: We need this cast since our EmberDebugConstructor doesn't define a type for `new` even though it will work with `new`.
|
|
31
|
+
EmberError = EmberDebugConstructor;
|
|
32
|
+
} else {
|
|
33
|
+
EmberError = Error;
|
|
34
|
+
}
|
|
35
|
+
export default EmberError;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { get, setProperties, computed } from '@ember/object';
|
|
2
2
|
import Mixin from '@ember/object/mixin';
|
|
3
|
-
import EmberError from '@ember/error';
|
|
4
3
|
/**
|
|
5
4
|
@module @ember/object/promise-proxy-mixin
|
|
6
5
|
*/
|
|
@@ -39,7 +38,7 @@ const PromiseProxyMixin = Mixin.create({
|
|
|
39
38
|
isFulfilled: false,
|
|
40
39
|
promise: computed({
|
|
41
40
|
get() {
|
|
42
|
-
throw new
|
|
41
|
+
throw new Error("PromiseProxy's promise must be set");
|
|
43
42
|
},
|
|
44
43
|
set(_key, promise) {
|
|
45
44
|
return tap(this, promise);
|
|
@@ -2,7 +2,6 @@ import { get } from '@ember/-internals/metal';
|
|
|
2
2
|
import { getOwner } from '@ember/-internals/owner';
|
|
3
3
|
import { assert, deprecate } from '@ember/debug';
|
|
4
4
|
import EngineInstance from '@ember/engine/instance';
|
|
5
|
-
import EmberError from '@ember/error';
|
|
6
5
|
import { STATE_SYMBOL } from 'router_js';
|
|
7
6
|
const ALL_PERIODS_REGEX = /\./g;
|
|
8
7
|
export function extractRouteArgs(args) {
|
|
@@ -184,7 +183,7 @@ export function prefixRouteNameArg(route, args) {
|
|
|
184
183
|
if (owner.routable && typeof args[0] === 'string') {
|
|
185
184
|
routeName = args[0];
|
|
186
185
|
if (resemblesURL(routeName)) {
|
|
187
|
-
throw new
|
|
186
|
+
throw new Error('Programmatic transitions by URL cannot be used within an Engine. Please use the route name instead.');
|
|
188
187
|
} else {
|
|
189
188
|
routeName = `${prefix}.${routeName}`;
|
|
190
189
|
args[0] = routeName;
|
|
@@ -9,7 +9,6 @@ import { A as emberA } from '@ember/array';
|
|
|
9
9
|
import { typeOf } from '@ember/utils';
|
|
10
10
|
import Evented from '@ember/object/evented';
|
|
11
11
|
import { assert, deprecate, info } from '@ember/debug';
|
|
12
|
-
import EmberError from '@ember/error';
|
|
13
12
|
import { cancel, once, run, scheduleOnce } from '@ember/runloop';
|
|
14
13
|
import { DEBUG } from '@glimmer/env';
|
|
15
14
|
import { defaultSerialize, getFullQueryParams, hasDefaultSerialize, ROUTE_CONNECTIONS } from '@ember/routing/route';
|
|
@@ -1233,7 +1232,7 @@ export function triggerEvent(routeInfos, ignoreFailure, name, args) {
|
|
|
1233
1232
|
return;
|
|
1234
1233
|
}
|
|
1235
1234
|
// TODO: update?
|
|
1236
|
-
throw new
|
|
1235
|
+
throw new Error(`Can't trigger action '${name}' because your app hasn't finished transitioning into its first route. To trigger an action on destination routes during a transition, you can call \`.send()\` on the \`Transition\` object passed to the \`model/beforeModel/afterModel\` hooks.`);
|
|
1237
1236
|
}
|
|
1238
1237
|
let eventWasHandled = false;
|
|
1239
1238
|
let routeInfo, handler, actionHandler;
|
|
@@ -1261,7 +1260,7 @@ export function triggerEvent(routeInfos, ignoreFailure, name, args) {
|
|
|
1261
1260
|
return;
|
|
1262
1261
|
}
|
|
1263
1262
|
if (!eventWasHandled && !ignoreFailure) {
|
|
1264
|
-
throw new
|
|
1263
|
+
throw new Error(`Nothing handled the action '${name}'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.`);
|
|
1265
1264
|
}
|
|
1266
1265
|
}
|
|
1267
1266
|
function calculatePostTransitionState(emberRouter, leafRouteName, contexts) {
|
|
@@ -34,6 +34,7 @@ const DECAMELIZE_CACHE = new Cache(1000, str => str.replace(STRING_DECAMELIZE_RE
|
|
|
34
34
|
|
|
35
35
|
@class String
|
|
36
36
|
@public
|
|
37
|
+
@deprecated Add the package `@ember/string` to your project to use in place of this module.
|
|
37
38
|
*/
|
|
38
39
|
/**
|
|
39
40
|
Splits a string into separate units separated by spaces, eliminating any
|
|
@@ -55,8 +56,10 @@ const DECAMELIZE_CACHE = new Cache(1000, str => str.replace(STRING_DECAMELIZE_RE
|
|
|
55
56
|
@param {String} str The string to split
|
|
56
57
|
@return {Array} array containing the split strings
|
|
57
58
|
@public
|
|
59
|
+
@deprecated Add `@ember/string` to your package.json
|
|
58
60
|
*/
|
|
59
61
|
export function w(str) {
|
|
62
|
+
deprecateImportFromInternalString();
|
|
60
63
|
return str.split(/\s+/);
|
|
61
64
|
}
|
|
62
65
|
/**
|
|
@@ -75,8 +78,10 @@ export function w(str) {
|
|
|
75
78
|
@param {String} str The string to decamelize.
|
|
76
79
|
@return {String} the decamelized string.
|
|
77
80
|
@public
|
|
81
|
+
@deprecated Add `@ember/string` to your package.json
|
|
78
82
|
*/
|
|
79
83
|
export function decamelize(str) {
|
|
84
|
+
deprecateImportFromInternalString();
|
|
80
85
|
return DECAMELIZE_CACHE.get(str);
|
|
81
86
|
}
|
|
82
87
|
/**
|
|
@@ -96,8 +101,10 @@ export function decamelize(str) {
|
|
|
96
101
|
@param {String} str The string to dasherize.
|
|
97
102
|
@return {String} the dasherized string.
|
|
98
103
|
@public
|
|
104
|
+
@deprecated Add `@ember/string` to your package.json
|
|
99
105
|
*/
|
|
100
106
|
export function dasherize(str) {
|
|
107
|
+
deprecateImportFromInternalString();
|
|
101
108
|
return STRING_DASHERIZE_CACHE.get(str);
|
|
102
109
|
}
|
|
103
110
|
/**
|
|
@@ -118,8 +125,10 @@ export function dasherize(str) {
|
|
|
118
125
|
@param {String} str The string to camelize.
|
|
119
126
|
@return {String} the camelized string.
|
|
120
127
|
@public
|
|
128
|
+
@deprecated Add `@ember/string` to your package.json
|
|
121
129
|
*/
|
|
122
130
|
export function camelize(str) {
|
|
131
|
+
deprecateImportFromInternalString();
|
|
123
132
|
return CAMELIZE_CACHE.get(str);
|
|
124
133
|
}
|
|
125
134
|
/**
|
|
@@ -139,8 +148,10 @@ export function camelize(str) {
|
|
|
139
148
|
@param {String} str the string to classify
|
|
140
149
|
@return {String} the classified string
|
|
141
150
|
@public
|
|
151
|
+
@deprecated Add `@ember/string` to your package.json
|
|
142
152
|
*/
|
|
143
153
|
export function classify(str) {
|
|
154
|
+
deprecateImportFromInternalString();
|
|
144
155
|
return CLASSIFY_CACHE.get(str);
|
|
145
156
|
}
|
|
146
157
|
/**
|
|
@@ -161,8 +172,10 @@ export function classify(str) {
|
|
|
161
172
|
@param {String} str The string to underscore.
|
|
162
173
|
@return {String} the underscored string.
|
|
163
174
|
@public
|
|
175
|
+
@deprecated Add `@ember/string` to your package.json
|
|
164
176
|
*/
|
|
165
177
|
export function underscore(str) {
|
|
178
|
+
deprecateImportFromInternalString();
|
|
166
179
|
return UNDERSCORE_CACHE.get(str);
|
|
167
180
|
}
|
|
168
181
|
/**
|
|
@@ -182,21 +195,33 @@ export function underscore(str) {
|
|
|
182
195
|
@param {String} str The string to capitalize.
|
|
183
196
|
@return {String} The capitalized string.
|
|
184
197
|
@public
|
|
198
|
+
@deprecated Add `@ember/string` to your package.json
|
|
185
199
|
*/
|
|
186
200
|
export function capitalize(str) {
|
|
201
|
+
deprecateImportFromInternalString();
|
|
187
202
|
return CAPITALIZE_CACHE.get(str);
|
|
188
203
|
}
|
|
204
|
+
function deprecateImportFromInternalString() {
|
|
205
|
+
deprecate('Importing from `@ember/string` without having the `@ember/string` package in your project is deprecated. Please add `@ember/string` to your `package.json', false, {
|
|
206
|
+
id: 'ember-string.add-package',
|
|
207
|
+
for: 'ember-source',
|
|
208
|
+
since: {
|
|
209
|
+
available: '4.10',
|
|
210
|
+
enabled: '4.10'
|
|
211
|
+
},
|
|
212
|
+
until: '5.0.0',
|
|
213
|
+
url: 'https://deprecations.emberjs.com/v4.x/#toc_ember-string-add-package'
|
|
214
|
+
});
|
|
215
|
+
}
|
|
189
216
|
function deprecateImportFromString(name, message = `Importing ${name} from '@ember/string' is deprecated. Please import ${name} from '@ember/template' instead.`) {
|
|
190
|
-
|
|
191
|
-
// See https://github.com/emberjs/ember.js/issues/19393 fo more information.
|
|
192
|
-
deprecate(message, true, {
|
|
217
|
+
deprecate(message, false, {
|
|
193
218
|
id: 'ember-string.htmlsafe-ishtmlsafe',
|
|
194
219
|
for: 'ember-source',
|
|
195
220
|
since: {
|
|
196
|
-
available: '
|
|
197
|
-
enabled: '
|
|
221
|
+
available: '4.10',
|
|
222
|
+
enabled: '4.10'
|
|
198
223
|
},
|
|
199
|
-
until: '
|
|
224
|
+
until: '5.0.0',
|
|
200
225
|
url: 'https://deprecations.emberjs.com/v3.x/#toc_ember-string-htmlsafe-ishtmlsafe'
|
|
201
226
|
});
|
|
202
227
|
}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
+
import { deprecate } from '@ember/debug';
|
|
1
2
|
// STATE within a module is frowned upon, this exists
|
|
2
3
|
// to support Ember.STRINGS but shield ember internals from this legacy global
|
|
3
4
|
// API.
|
|
4
5
|
let STRINGS = {};
|
|
5
6
|
export function setStrings(strings) {
|
|
7
|
+
deprecateEmberStrings();
|
|
6
8
|
STRINGS = strings;
|
|
7
9
|
}
|
|
8
10
|
export function getStrings() {
|
|
11
|
+
deprecateEmberStrings();
|
|
9
12
|
return STRINGS;
|
|
10
13
|
}
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
function deprecateEmberStrings() {
|
|
15
|
+
deprecate('Ember.STRINGS is deprecated. It is no longer used by Ember.', false, {
|
|
16
|
+
id: 'ember-strings',
|
|
17
|
+
for: 'ember-source',
|
|
18
|
+
since: {
|
|
19
|
+
available: '4.10',
|
|
20
|
+
enabled: '4.10.'
|
|
21
|
+
},
|
|
22
|
+
until: '5.0.0'
|
|
23
|
+
});
|
|
13
24
|
}
|
|
@@ -373,38 +373,34 @@ Object.defineProperty(Ember, 'TEMPLATES', {
|
|
|
373
373
|
configurable: false,
|
|
374
374
|
enumerable: false
|
|
375
375
|
});
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
deprecate(message, true, {
|
|
380
|
-
id: 'ember-string.htmlsafe-ishtmlsafe',
|
|
376
|
+
function deprecateStringUseOnEmberModule() {
|
|
377
|
+
deprecate('Using `Ember.String` is deprecated. Please import methods directly from `@ember/string`.', false, {
|
|
378
|
+
id: 'ember-string.from-ember-module',
|
|
381
379
|
for: 'ember-source',
|
|
382
380
|
since: {
|
|
383
|
-
available: '
|
|
384
|
-
enabled: '
|
|
381
|
+
available: '4.10',
|
|
382
|
+
enabled: '4.10.'
|
|
385
383
|
},
|
|
386
|
-
until: '
|
|
387
|
-
url: 'https://deprecations.emberjs.com/
|
|
384
|
+
until: '5.0.0',
|
|
385
|
+
url: 'https://deprecations.emberjs.com/v4.x/#toc_ember-string-from-ember-module'
|
|
388
386
|
});
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// deprecated and removed. TODO: remove them after we land the TS conversion,
|
|
392
|
-
// and after confirming doing so is safe -- the state of the `@ember/string`
|
|
393
|
-
// conversion remains confused.
|
|
394
|
-
Object.defineProperty(Ember.String, 'htmlSafe', {
|
|
395
|
-
enumerable: true,
|
|
396
|
-
configurable: true,
|
|
397
|
-
get() {
|
|
398
|
-
deprecateImportFromString('htmlSafe');
|
|
399
|
-
return htmlSafe;
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
Object.defineProperty(Ember.String, 'isHTMLSafe', {
|
|
387
|
+
}
|
|
388
|
+
Object.defineProperty(Ember, 'String', {
|
|
403
389
|
enumerable: true,
|
|
404
390
|
configurable: true,
|
|
405
391
|
get() {
|
|
406
|
-
|
|
407
|
-
return
|
|
392
|
+
deprecateStringUseOnEmberModule();
|
|
393
|
+
return {
|
|
394
|
+
camelize,
|
|
395
|
+
capitalize,
|
|
396
|
+
classify,
|
|
397
|
+
dasherize,
|
|
398
|
+
decamelize,
|
|
399
|
+
underscore,
|
|
400
|
+
w,
|
|
401
|
+
htmlSafe,
|
|
402
|
+
isHTMLSafe
|
|
403
|
+
};
|
|
408
404
|
}
|
|
409
405
|
});
|
|
410
406
|
Object.defineProperty(Ember, 'TEMPLATES', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default "4.10.0
|
|
1
|
+
export default "4.10.0";
|