ember-source 4.11.0-alpha.6 → 4.11.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 +16 -19
- package/blueprints/route/index.js +28 -6
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +9 -8
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +1 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +75 -18
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +68 -12
- package/dist/packages/@ember/canary-features/index.js +7 -6
- package/dist/packages/@ember/template/index.js +2 -0
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +72 -7
- package/package.json +4 -7
- package/types/preview/@ember/template/index.d.ts +1 -0
- package/types/stable/@ember/-internals/glimmer/lib/utils/string.d.ts +55 -6
- package/types/stable/@ember/string/index.d.ts +1 -1
- package/types/stable/@ember/template/index.d.ts +1 -1
package/dist/header/license.js
CHANGED
|
@@ -2554,13 +2554,58 @@ setHelperManager(() => SIMPLE_CLASSIC_HELPER_MANAGER, Wrapper.prototype);
|
|
|
2554
2554
|
/**
|
|
2555
2555
|
@module @ember/template
|
|
2556
2556
|
*/
|
|
2557
|
+
/**
|
|
2558
|
+
A wrapper around a string that has been marked as safe ("trusted"). **When
|
|
2559
|
+
rendered in HTML, Ember will not perform any escaping.**
|
|
2560
|
+
|
|
2561
|
+
Note:
|
|
2562
|
+
|
|
2563
|
+
1. This does not *make* the string safe; it means that some code in your
|
|
2564
|
+
application has *marked* it as safe using the `htmlSafe()` function.
|
|
2565
|
+
|
|
2566
|
+
2. The only public API for getting a `SafeString` is calling `htmlSafe()`. It
|
|
2567
|
+
is *not* user-constructible.
|
|
2568
|
+
|
|
2569
|
+
If a string contains user inputs or other untrusted data, you must sanitize
|
|
2570
|
+
the string before using the `htmlSafe` method. Otherwise your code is
|
|
2571
|
+
vulnerable to [Cross-Site Scripting][xss]. There are many open source
|
|
2572
|
+
sanitization libraries to choose from, both for front end and server-side
|
|
2573
|
+
sanitization.
|
|
2574
|
+
|
|
2575
|
+
[xss]: https://owasp.org/www-community/attacks/DOM_Based_XSS
|
|
2576
|
+
|
|
2577
|
+
```javascript
|
|
2578
|
+
import { htmlSafe } from '@ember/template';
|
|
2579
|
+
|
|
2580
|
+
let someTrustedOrSanitizedString = "<div>Hello!</div>"
|
|
2581
|
+
|
|
2582
|
+
htmlSafe(someTrustedorSanitizedString);
|
|
2583
|
+
```
|
|
2584
|
+
|
|
2585
|
+
@for @ember/template
|
|
2586
|
+
@class SafeString
|
|
2587
|
+
@since 4.12.0
|
|
2588
|
+
@public
|
|
2589
|
+
*/
|
|
2557
2590
|
class SafeString {
|
|
2558
2591
|
constructor(string) {
|
|
2559
|
-
this.
|
|
2592
|
+
this.__string = string;
|
|
2560
2593
|
}
|
|
2594
|
+
/**
|
|
2595
|
+
Get the string back to use as a string.
|
|
2596
|
+
@public
|
|
2597
|
+
@method toString
|
|
2598
|
+
@returns {String} The string marked as trusted
|
|
2599
|
+
*/
|
|
2561
2600
|
toString() {
|
|
2562
|
-
return `${this.
|
|
2601
|
+
return `${this.__string}`;
|
|
2563
2602
|
}
|
|
2603
|
+
/**
|
|
2604
|
+
Get the wrapped string as HTML to use without escaping.
|
|
2605
|
+
@public
|
|
2606
|
+
@method toHTML
|
|
2607
|
+
@returns {String} the trusted string, without any escaping applied
|
|
2608
|
+
*/
|
|
2564
2609
|
toHTML() {
|
|
2565
2610
|
return this.toString();
|
|
2566
2611
|
}
|
|
@@ -2580,9 +2625,10 @@ function escapeChar(chr) {
|
|
|
2580
2625
|
return escape[chr];
|
|
2581
2626
|
}
|
|
2582
2627
|
function escapeExpression(string) {
|
|
2628
|
+
let s;
|
|
2583
2629
|
if (typeof string !== 'string') {
|
|
2584
2630
|
// don't escape SafeStrings, since they're already safe
|
|
2585
|
-
if (string
|
|
2631
|
+
if (isHTMLSafe$1(string)) {
|
|
2586
2632
|
return string.toHTML();
|
|
2587
2633
|
} else if (string === null || string === undefined) {
|
|
2588
2634
|
return '';
|
|
@@ -2592,12 +2638,21 @@ function escapeExpression(string) {
|
|
|
2592
2638
|
// Force a string conversion as this will be done by the append regardless and
|
|
2593
2639
|
// the regex test will do this transparently behind the scenes, causing issues if
|
|
2594
2640
|
// an object's to string has escaped characters in it.
|
|
2595
|
-
|
|
2596
|
-
}
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2641
|
+
s = String(string);
|
|
2642
|
+
} else {
|
|
2643
|
+
s = string;
|
|
2644
|
+
}
|
|
2645
|
+
if (!possible.test(s)) {
|
|
2646
|
+
return s;
|
|
2647
|
+
}
|
|
2648
|
+
// SAFETY: this is technically a lie, but it's a true lie as long as the
|
|
2649
|
+
// invariant it depends on is upheld: `escapeChar` will always return a string
|
|
2650
|
+
// as long as its input is one of the characters in `escape`, and it will only
|
|
2651
|
+
// be called if it matches one of the characters in the `badChar` regex, which
|
|
2652
|
+
// is hand-maintained to match the set escaped. (It would be nice if TS could
|
|
2653
|
+
// "see" into the regex to see how this works, but that'd be quite a lot of
|
|
2654
|
+
// extra fanciness.)
|
|
2655
|
+
return s.replace(badChars, escapeChar);
|
|
2601
2656
|
}
|
|
2602
2657
|
/**
|
|
2603
2658
|
Use this method to indicate that a string should be rendered as HTML
|
|
@@ -2623,6 +2678,7 @@ function escapeExpression(string) {
|
|
|
2623
2678
|
|
|
2624
2679
|
@method htmlSafe
|
|
2625
2680
|
@for @ember/template
|
|
2681
|
+
@param str {String} The string to treat as trusted.
|
|
2626
2682
|
@static
|
|
2627
2683
|
@return {SafeString} A string that will not be HTML escaped by Handlebars.
|
|
2628
2684
|
@public
|
|
@@ -2641,8 +2697,8 @@ function htmlSafe(str) {
|
|
|
2641
2697
|
```javascript
|
|
2642
2698
|
import { htmlSafe, isHTMLSafe } from '@ember/template';
|
|
2643
2699
|
|
|
2644
|
-
|
|
2645
|
-
|
|
2700
|
+
let plainString = 'plain string';
|
|
2701
|
+
let safeString = htmlSafe('<div>someValue</div>');
|
|
2646
2702
|
|
|
2647
2703
|
isHTMLSafe(plainString); // false
|
|
2648
2704
|
isHTMLSafe(safeString); // true
|
|
@@ -2655,7 +2711,7 @@ function htmlSafe(str) {
|
|
|
2655
2711
|
@public
|
|
2656
2712
|
*/
|
|
2657
2713
|
function isHTMLSafe$1(str) {
|
|
2658
|
-
return str !== null && typeof str === 'object' && typeof str.toHTML === 'function';
|
|
2714
|
+
return str !== null && typeof str === 'object' && 'toHTML' in str && typeof str.toHTML === 'function';
|
|
2659
2715
|
}
|
|
2660
2716
|
|
|
2661
2717
|
function instrumentationPayload(def) {
|
|
@@ -47,10 +47,11 @@ export function isEnabled(feature) {
|
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
// Uncomment the below when features are present:
|
|
51
|
+
// function featureValue(value: null | boolean) {
|
|
52
|
+
// if (ENV.ENABLE_OPTIONAL_FEATURES && value === null) {
|
|
53
|
+
// return true;
|
|
54
|
+
// }
|
|
55
|
+
// return value;
|
|
56
|
+
// }
|
|
56
57
|
// export const FLAG_NAME = featureValue(FEATURES.FLAG_NAME);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default "4.11.0
|
|
1
|
+
export default "4.11.0";
|
package/docs/data.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "The Ember API",
|
|
4
4
|
"description": "The Ember API: a framework for building ambitious web applications",
|
|
5
5
|
"url": "https://emberjs.com/",
|
|
6
|
-
"version": "4.11.0
|
|
6
|
+
"version": "4.11.0"
|
|
7
7
|
},
|
|
8
8
|
"files": {
|
|
9
9
|
"node_modules/rsvp/lib/rsvp/promise/all.js": {
|
|
@@ -498,7 +498,9 @@
|
|
|
498
498
|
"modules": {
|
|
499
499
|
"@ember/template": 1
|
|
500
500
|
},
|
|
501
|
-
"classes": {
|
|
501
|
+
"classes": {
|
|
502
|
+
"SafeString": 1
|
|
503
|
+
},
|
|
502
504
|
"fors": {
|
|
503
505
|
"@ember/template": 1
|
|
504
506
|
},
|
|
@@ -1898,7 +1900,8 @@
|
|
|
1898
1900
|
"submodules": {},
|
|
1899
1901
|
"elements": {},
|
|
1900
1902
|
"classes": {
|
|
1901
|
-
"@ember/template": 1
|
|
1903
|
+
"@ember/template": 1,
|
|
1904
|
+
"SafeString": 1
|
|
1902
1905
|
},
|
|
1903
1906
|
"fors": {
|
|
1904
1907
|
"@ember/template": 1
|
|
@@ -1906,7 +1909,7 @@
|
|
|
1906
1909
|
"namespaces": {},
|
|
1907
1910
|
"tag": "module",
|
|
1908
1911
|
"file": "packages/@ember/-internals/glimmer/lib/utils/string.ts",
|
|
1909
|
-
"line":
|
|
1912
|
+
"line": 7
|
|
1910
1913
|
},
|
|
1911
1914
|
"@glimmer/component": {
|
|
1912
1915
|
"name": "@glimmer/component",
|
|
@@ -2803,6 +2806,23 @@
|
|
|
2803
2806
|
"module": "@ember/template",
|
|
2804
2807
|
"namespace": ""
|
|
2805
2808
|
},
|
|
2809
|
+
"SafeString": {
|
|
2810
|
+
"name": "SafeString",
|
|
2811
|
+
"shortname": "SafeString",
|
|
2812
|
+
"classitems": [],
|
|
2813
|
+
"plugins": [],
|
|
2814
|
+
"extensions": [],
|
|
2815
|
+
"plugin_for": [],
|
|
2816
|
+
"extension_for": [],
|
|
2817
|
+
"module": "@ember/template",
|
|
2818
|
+
"namespace": "",
|
|
2819
|
+
"file": "packages/@ember/-internals/glimmer/lib/utils/string.ts",
|
|
2820
|
+
"line": 7,
|
|
2821
|
+
"description": "A wrapper around a string that has been marked as safe (\"trusted\"). **When\nrendered in HTML, Ember will not perform any escaping.**\n\nNote:\n\n1. This does not *make* the string safe; it means that some code in your\n application has *marked* it as safe using the `htmlSafe()` function.\n\n2. The only public API for getting a `SafeString` is calling `htmlSafe()`. It\n is *not* user-constructible.\n\nIf a string contains user inputs or other untrusted data, you must sanitize\nthe string before using the `htmlSafe` method. Otherwise your code is\nvulnerable to [Cross-Site Scripting][xss]. There are many open source\nsanitization libraries to choose from, both for front end and server-side\nsanitization.\n\n[xss]: https://owasp.org/www-community/attacks/DOM_Based_XSS\n\n```javascript\nimport { htmlSafe } from '@ember/template';\n\nlet someTrustedOrSanitizedString = \"<div>Hello!</div>\"\n\nhtmlSafe(someTrustedorSanitizedString);\n```",
|
|
2822
|
+
"since": "4.12.0",
|
|
2823
|
+
"access": "public",
|
|
2824
|
+
"tagname": ""
|
|
2825
|
+
},
|
|
2806
2826
|
"Component": {
|
|
2807
2827
|
"name": "Component",
|
|
2808
2828
|
"shortname": "Component",
|
|
@@ -6254,10 +6274,47 @@
|
|
|
6254
6274
|
},
|
|
6255
6275
|
{
|
|
6256
6276
|
"file": "packages/@ember/-internals/glimmer/lib/utils/string.ts",
|
|
6257
|
-
"line":
|
|
6277
|
+
"line": 47,
|
|
6278
|
+
"description": "Get the string back to use as a string.",
|
|
6279
|
+
"access": "public",
|
|
6280
|
+
"tagname": "",
|
|
6281
|
+
"itemtype": "method",
|
|
6282
|
+
"name": "toString",
|
|
6283
|
+
"return": {
|
|
6284
|
+
"description": "The string marked as trusted",
|
|
6285
|
+
"type": "String"
|
|
6286
|
+
},
|
|
6287
|
+
"class": "SafeString",
|
|
6288
|
+
"module": "@ember/template"
|
|
6289
|
+
},
|
|
6290
|
+
{
|
|
6291
|
+
"file": "packages/@ember/-internals/glimmer/lib/utils/string.ts",
|
|
6292
|
+
"line": 58,
|
|
6293
|
+
"description": "Get the wrapped string as HTML to use without escaping.",
|
|
6294
|
+
"access": "public",
|
|
6295
|
+
"tagname": "",
|
|
6296
|
+
"itemtype": "method",
|
|
6297
|
+
"name": "toHTML",
|
|
6298
|
+
"return": {
|
|
6299
|
+
"description": "the trusted string, without any escaping applied",
|
|
6300
|
+
"type": "String"
|
|
6301
|
+
},
|
|
6302
|
+
"class": "SafeString",
|
|
6303
|
+
"module": "@ember/template"
|
|
6304
|
+
},
|
|
6305
|
+
{
|
|
6306
|
+
"file": "packages/@ember/-internals/glimmer/lib/utils/string.ts",
|
|
6307
|
+
"line": 121,
|
|
6258
6308
|
"description": "Use this method to indicate that a string should be rendered as HTML\nwhen the string is used in a template. To say this another way,\nstrings marked with `htmlSafe` will not be HTML escaped.\n\nA word of warning - The `htmlSafe` method does not make the string safe;\nit only tells the framework to treat the string as if it is safe to render\nas HTML. If a string contains user inputs or other untrusted\ndata, you must sanitize the string before using the `htmlSafe` method.\nOtherwise your code is vulnerable to\n[Cross-Site Scripting](https://owasp.org/www-community/attacks/DOM_Based_XSS).\nThere are many open source sanitization libraries to choose from,\nboth for front end and server-side sanitization.\n\n```javascript\nimport { htmlSafe } from '@ember/template';\n\nconst someTrustedOrSanitizedString = \"<div>Hello!</div>\"\n\nhtmlSafe(someTrustedorSanitizedString)\n```",
|
|
6259
6309
|
"itemtype": "method",
|
|
6260
6310
|
"name": "htmlSafe",
|
|
6311
|
+
"params": [
|
|
6312
|
+
{
|
|
6313
|
+
"name": "str",
|
|
6314
|
+
"description": "The string to treat as trusted.",
|
|
6315
|
+
"type": "String"
|
|
6316
|
+
}
|
|
6317
|
+
],
|
|
6261
6318
|
"static": 1,
|
|
6262
6319
|
"return": {
|
|
6263
6320
|
"description": "A string that will not be HTML escaped by Handlebars.",
|
|
@@ -6270,8 +6327,8 @@
|
|
|
6270
6327
|
},
|
|
6271
6328
|
{
|
|
6272
6329
|
"file": "packages/@ember/-internals/glimmer/lib/utils/string.ts",
|
|
6273
|
-
"line":
|
|
6274
|
-
"description": "Detects if a string was decorated using `htmlSafe`.\n\n```javascript\nimport { htmlSafe, isHTMLSafe } from '@ember/template';\n\
|
|
6330
|
+
"line": 159,
|
|
6331
|
+
"description": "Detects if a string was decorated using `htmlSafe`.\n\n```javascript\nimport { htmlSafe, isHTMLSafe } from '@ember/template';\n\nlet plainString = 'plain string';\nlet safeString = htmlSafe('<div>someValue</div>');\n\nisHTMLSafe(plainString); // false\nisHTMLSafe(safeString); // true\n```",
|
|
6275
6332
|
"itemtype": "method",
|
|
6276
6333
|
"name": "isHTMLSafe",
|
|
6277
6334
|
"static": 1,
|
|
@@ -19404,6 +19461,14 @@
|
|
|
19404
19461
|
"message": "replacing incorrect tag: returns with return",
|
|
19405
19462
|
"line": " packages/@ember/-internals/container/lib/container.ts:195"
|
|
19406
19463
|
},
|
|
19464
|
+
{
|
|
19465
|
+
"message": "replacing incorrect tag: returns with return",
|
|
19466
|
+
"line": " packages/@ember/-internals/glimmer/lib/utils/string.ts:47"
|
|
19467
|
+
},
|
|
19468
|
+
{
|
|
19469
|
+
"message": "replacing incorrect tag: returns with return",
|
|
19470
|
+
"line": " packages/@ember/-internals/glimmer/lib/utils/string.ts:58"
|
|
19471
|
+
},
|
|
19407
19472
|
{
|
|
19408
19473
|
"message": "unknown tag: decorator",
|
|
19409
19474
|
"line": " packages/@ember/-internals/metal/lib/tracked.ts:12"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-source",
|
|
3
|
-
"version": "4.11.0
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "A JavaScript framework for creating ambitious web applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -182,9 +182,6 @@
|
|
|
182
182
|
]
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
|
-
"_originalVersion": "4.11.0
|
|
186
|
-
"_versionPreviouslyCalculated": true
|
|
187
|
-
|
|
188
|
-
"tag": "alpha"
|
|
189
|
-
}
|
|
190
|
-
}
|
|
185
|
+
"_originalVersion": "4.11.0",
|
|
186
|
+
"_versionPreviouslyCalculated": true
|
|
187
|
+
}
|
|
@@ -2,13 +2,61 @@ declare module '@ember/-internals/glimmer/lib/utils/string' {
|
|
|
2
2
|
/**
|
|
3
3
|
@module @ember/template
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import type { SafeString as GlimmerSafeString } from '@glimmer/runtime';
|
|
6
|
+
/**
|
|
7
|
+
A wrapper around a string that has been marked as safe ("trusted"). **When
|
|
8
|
+
rendered in HTML, Ember will not perform any escaping.**
|
|
9
|
+
|
|
10
|
+
Note:
|
|
11
|
+
|
|
12
|
+
1. This does not *make* the string safe; it means that some code in your
|
|
13
|
+
application has *marked* it as safe using the `htmlSafe()` function.
|
|
14
|
+
|
|
15
|
+
2. The only public API for getting a `SafeString` is calling `htmlSafe()`. It
|
|
16
|
+
is *not* user-constructible.
|
|
17
|
+
|
|
18
|
+
If a string contains user inputs or other untrusted data, you must sanitize
|
|
19
|
+
the string before using the `htmlSafe` method. Otherwise your code is
|
|
20
|
+
vulnerable to [Cross-Site Scripting][xss]. There are many open source
|
|
21
|
+
sanitization libraries to choose from, both for front end and server-side
|
|
22
|
+
sanitization.
|
|
23
|
+
|
|
24
|
+
[xss]: https://owasp.org/www-community/attacks/DOM_Based_XSS
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
import { htmlSafe } from '@ember/template';
|
|
28
|
+
|
|
29
|
+
let someTrustedOrSanitizedString = "<div>Hello!</div>"
|
|
30
|
+
|
|
31
|
+
htmlSafe(someTrustedorSanitizedString);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
@for @ember/template
|
|
35
|
+
@class SafeString
|
|
36
|
+
@since 4.12.0
|
|
37
|
+
@public
|
|
38
|
+
*/
|
|
39
|
+
export class SafeString implements GlimmerSafeString {
|
|
40
|
+
private __string;
|
|
7
41
|
constructor(string: string);
|
|
42
|
+
/**
|
|
43
|
+
Get the string back to use as a string.
|
|
44
|
+
|
|
45
|
+
@public
|
|
46
|
+
@method toString
|
|
47
|
+
@returns {String} The string marked as trusted
|
|
48
|
+
*/
|
|
8
49
|
toString(): string;
|
|
50
|
+
/**
|
|
51
|
+
Get the wrapped string as HTML to use without escaping.
|
|
52
|
+
|
|
53
|
+
@public
|
|
54
|
+
@method toHTML
|
|
55
|
+
@returns {String} the trusted string, without any escaping applied
|
|
56
|
+
*/
|
|
9
57
|
toHTML(): string;
|
|
10
58
|
}
|
|
11
|
-
export function escapeExpression(string:
|
|
59
|
+
export function escapeExpression(string: unknown): string;
|
|
12
60
|
/**
|
|
13
61
|
Use this method to indicate that a string should be rendered as HTML
|
|
14
62
|
when the string is used in a template. To say this another way,
|
|
@@ -33,6 +81,7 @@ declare module '@ember/-internals/glimmer/lib/utils/string' {
|
|
|
33
81
|
|
|
34
82
|
@method htmlSafe
|
|
35
83
|
@for @ember/template
|
|
84
|
+
@param str {String} The string to treat as trusted.
|
|
36
85
|
@static
|
|
37
86
|
@return {SafeString} A string that will not be HTML escaped by Handlebars.
|
|
38
87
|
@public
|
|
@@ -44,8 +93,8 @@ declare module '@ember/-internals/glimmer/lib/utils/string' {
|
|
|
44
93
|
```javascript
|
|
45
94
|
import { htmlSafe, isHTMLSafe } from '@ember/template';
|
|
46
95
|
|
|
47
|
-
|
|
48
|
-
|
|
96
|
+
let plainString = 'plain string';
|
|
97
|
+
let safeString = htmlSafe('<div>someValue</div>');
|
|
49
98
|
|
|
50
99
|
isHTMLSafe(plainString); // false
|
|
51
100
|
isHTMLSafe(safeString); // true
|
|
@@ -57,5 +106,5 @@ declare module '@ember/-internals/glimmer/lib/utils/string' {
|
|
|
57
106
|
@return {Boolean} `true` if the string was decorated with `htmlSafe`, `false` otherwise.
|
|
58
107
|
@public
|
|
59
108
|
*/
|
|
60
|
-
export function isHTMLSafe(str:
|
|
109
|
+
export function isHTMLSafe(str: unknown): str is SafeString;
|
|
61
110
|
}
|
|
@@ -159,5 +159,5 @@ declare module '@ember/string' {
|
|
|
159
159
|
*/
|
|
160
160
|
export function capitalize(str: string): string;
|
|
161
161
|
export function htmlSafe(str: string): SafeString;
|
|
162
|
-
export function isHTMLSafe(str:
|
|
162
|
+
export function isHTMLSafe(str: unknown): str is SafeString;
|
|
163
163
|
}
|