ember-source 4.1.0-alpha.6 → 4.1.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 +80 -63
- package/blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +3 -3
- package/blueprints/helper-test/index.js +4 -22
- package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +1 -13
- package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +0 -13
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -12
- package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -13
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -14
- package/build-metadata.json +3 -3
- package/dist/dependencies/@glimmer/manager.js +19 -98
- package/dist/dependencies/@glimmer/opcode-compiler.js +9 -146
- package/dist/dependencies/@glimmer/runtime.js +1 -55
- package/dist/dependencies/@glimmer/validator.js +19 -51
- package/dist/ember-template-compiler.js +368 -693
- 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 +3261 -6351
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/environment/index.js +0 -15
- package/dist/packages/@ember/-internals/glimmer/index.js +4815 -6763
- package/dist/packages/@ember/-internals/metal/index.js +57 -103
- package/dist/packages/@ember/-internals/routing/lib/location/api.js +10 -1
- package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +7 -2
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +3 -42
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +36 -46
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +2 -173
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -43
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -15
- package/dist/packages/@ember/-internals/utils/index.js +0 -3
- package/dist/packages/@ember/-internals/views/index.js +0 -1
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -4
- package/dist/packages/@ember/application/lib/application.js +7 -8
- package/dist/packages/@ember/canary-features/index.js +4 -6
- package/dist/packages/@ember/component/index.js +1 -1
- package/dist/packages/@ember/deprecated-features/index.js +0 -1
- package/dist/packages/@ember/destroyable/index.js +15 -4
- package/dist/packages/@ember/engine/index.js +1 -2
- package/dist/packages/@ember/routing/index.js +1 -1
- package/dist/packages/@glimmer/tracking/index.js +203 -1
- package/dist/packages/ember/index.js +9 -61
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +430 -1382
- package/lib/browsers.js +50 -0
- package/lib/index.js +7 -29
- package/package.json +19 -22
- package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -345
- package/dist/packages/@ember/component/checkbox.js +0 -17
- package/dist/packages/@ember/component/text-area.js +0 -17
- package/dist/packages/@ember/component/text-field.js +0 -17
- package/dist/packages/@ember/routing/link-component.js +0 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dict, assign, isSmallInt, debugToString, EMPTY_ARRAY, EMPTY_STRING_ARRAY, encodeImmediate, Stack, encodeHandle
|
|
1
|
+
import { dict, assign, isSmallInt, debugToString, EMPTY_ARRAY, EMPTY_STRING_ARRAY, encodeImmediate, Stack, encodeHandle } from '@glimmer/util';
|
|
2
2
|
import { DEBUG } from '@glimmer/env';
|
|
3
3
|
import { $v0, $fp, $s0, $s1, $sp, isMachineOp } from '@glimmer/vm';
|
|
4
4
|
import { assert, deprecate } from '@glimmer/global-context';
|
|
@@ -353,8 +353,7 @@ function resolveComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
353
353
|
*/
|
|
354
354
|
|
|
355
355
|
function resolveOptionalHelper(resolver, constants, meta, [, expr, {
|
|
356
|
-
ifHelper
|
|
357
|
-
ifFallback
|
|
356
|
+
ifHelper
|
|
358
357
|
}]) {
|
|
359
358
|
let {
|
|
360
359
|
upvars,
|
|
@@ -363,9 +362,7 @@ function resolveOptionalHelper(resolver, constants, meta, [, expr, {
|
|
|
363
362
|
let name = upvars[expr[1]];
|
|
364
363
|
let helper = resolver.lookupHelper(name, owner);
|
|
365
364
|
|
|
366
|
-
if (helper
|
|
367
|
-
ifFallback(name, meta.moduleName);
|
|
368
|
-
} else {
|
|
365
|
+
if (helper) {
|
|
369
366
|
ifHelper(constants.helper(helper, name), name, meta.moduleName);
|
|
370
367
|
}
|
|
371
368
|
}
|
|
@@ -376,8 +373,7 @@ function resolveOptionalHelper(resolver, constants, meta, [, expr, {
|
|
|
376
373
|
function resolveOptionalComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
377
374
|
ifComponent,
|
|
378
375
|
ifHelper,
|
|
379
|
-
ifValue
|
|
380
|
-
ifFallback
|
|
376
|
+
ifValue
|
|
381
377
|
}]) {
|
|
382
378
|
let type = expr[0];
|
|
383
379
|
|
|
@@ -432,10 +428,7 @@ function resolveOptionalComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
432
428
|
|
|
433
429
|
if (helper !== null) {
|
|
434
430
|
ifHelper(constants.helper(helper, name));
|
|
435
|
-
return;
|
|
436
431
|
}
|
|
437
|
-
|
|
438
|
-
ifFallback(name);
|
|
439
432
|
}
|
|
440
433
|
}
|
|
441
434
|
|
|
@@ -533,28 +526,6 @@ EXPRESSIONS.add(31
|
|
|
533
526
|
, sym, _handle => {// TODO: Implement in strict mode
|
|
534
527
|
});
|
|
535
528
|
});
|
|
536
|
-
EXPRESSIONS.add(33
|
|
537
|
-
/* GetFreeAsFallback */
|
|
538
|
-
, (op, [, freeVar, path]) => {
|
|
539
|
-
op(1010
|
|
540
|
-
/* ResolveLocal */
|
|
541
|
-
, freeVar, (name, moduleName) => {
|
|
542
|
-
if (DEBUG) {
|
|
543
|
-
let propertyPath = path ? [name, ...path].join('.') : name;
|
|
544
|
-
deprecate(`The \`${propertyPath}\` property path was used in the \`${moduleName}\` template without using \`this\`. This fallback behavior has been deprecated, all properties must be looked up on \`this\` when used in the template: {{this.${propertyPath}}}`, false, {
|
|
545
|
-
id: 'this-property-fallback'
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
op(21
|
|
550
|
-
/* GetVariable */
|
|
551
|
-
, 0);
|
|
552
|
-
op(22
|
|
553
|
-
/* GetProperty */
|
|
554
|
-
, name);
|
|
555
|
-
});
|
|
556
|
-
withPath(op, path);
|
|
557
|
-
});
|
|
558
529
|
EXPRESSIONS.add(34
|
|
559
530
|
/* GetFreeAsComponentOrHelperHeadOrThisFallback */
|
|
560
531
|
, () => {
|
|
@@ -576,17 +547,6 @@ EXPRESSIONS.add(36
|
|
|
576
547
|
, expr$$1, {
|
|
577
548
|
ifHelper: handle => {
|
|
578
549
|
Call(op, handle, null, null);
|
|
579
|
-
},
|
|
580
|
-
ifFallback: (name, moduleName) => {
|
|
581
|
-
deprecate(`The \`${name}\` property was used in the \`${moduleName}\` template without using \`this\`. This fallback behavior has been deprecated, all properties must be looked up on \`this\` when used in the template: {{this.${name}}}`, false, {
|
|
582
|
-
id: 'this-property-fallback'
|
|
583
|
-
});
|
|
584
|
-
op(21
|
|
585
|
-
/* GetVariable */
|
|
586
|
-
, 0);
|
|
587
|
-
op(22
|
|
588
|
-
/* GetProperty */
|
|
589
|
-
, name);
|
|
590
550
|
}
|
|
591
551
|
});
|
|
592
552
|
});
|
|
@@ -608,17 +568,6 @@ EXPRESSIONS.add(99
|
|
|
608
568
|
id: 'argument-less-helper-paren-less-invocation'
|
|
609
569
|
});
|
|
610
570
|
Call(op, handle, null, null);
|
|
611
|
-
},
|
|
612
|
-
ifFallback: (name, moduleName) => {
|
|
613
|
-
deprecate(`The \`${name}\` property was used in the \`${moduleName}\` template without using \`this\`. This fallback behavior has been deprecated, all properties must be looked up on \`this\` when used in the template: {{this.${name}}}`, false, {
|
|
614
|
-
id: 'this-property-fallback'
|
|
615
|
-
});
|
|
616
|
-
op(21
|
|
617
|
-
/* GetVariable */
|
|
618
|
-
, 0);
|
|
619
|
-
op(22
|
|
620
|
-
/* GetProperty */
|
|
621
|
-
, name);
|
|
622
571
|
}
|
|
623
572
|
});
|
|
624
573
|
});
|
|
@@ -801,7 +750,6 @@ function meta(layout) {
|
|
|
801
750
|
|
|
802
751
|
let [, symbols,, upvars] = layout.block;
|
|
803
752
|
return {
|
|
804
|
-
asPartial: layout.asPartial || false,
|
|
805
753
|
evalSymbols: evalSymbols(layout),
|
|
806
754
|
upvars: upvars,
|
|
807
755
|
scopeValues: (_b = (_a = layout.scope) === null || _a === void 0 ? void 0 : _a.call(layout)) !== null && _b !== void 0 ? _b : null,
|
|
@@ -2038,27 +1986,6 @@ STATEMENTS.add(8
|
|
|
2038
1986
|
InvokeDynamicComponent(op, expr$$1, elementBlock, null, named, blocks, true, true);
|
|
2039
1987
|
}
|
|
2040
1988
|
});
|
|
2041
|
-
STATEMENTS.add(19
|
|
2042
|
-
/* Partial */
|
|
2043
|
-
, (op, [, name, evalInfo]) => {
|
|
2044
|
-
ReplayableIf(op, () => {
|
|
2045
|
-
expr(op, name);
|
|
2046
|
-
op(33
|
|
2047
|
-
/* Dup */
|
|
2048
|
-
, $sp, 0);
|
|
2049
|
-
return 2;
|
|
2050
|
-
}, () => {
|
|
2051
|
-
op(101
|
|
2052
|
-
/* InvokePartial */
|
|
2053
|
-
, evalSymbolsOperand(), evalInfo);
|
|
2054
|
-
op(40
|
|
2055
|
-
/* PopScope */
|
|
2056
|
-
);
|
|
2057
|
-
op(1
|
|
2058
|
-
/* PopFrame */
|
|
2059
|
-
);
|
|
2060
|
-
});
|
|
2061
|
-
});
|
|
2062
1989
|
STATEMENTS.add(18
|
|
2063
1990
|
/* Yield */
|
|
2064
1991
|
, (op, [, to, params]) => YieldBlock(op, to, params));
|
|
@@ -2112,31 +2039,6 @@ STATEMENTS.add(1
|
|
|
2112
2039
|
op(1
|
|
2113
2040
|
/* PopFrame */
|
|
2114
2041
|
);
|
|
2115
|
-
},
|
|
2116
|
-
|
|
2117
|
-
ifFallback(_name) {
|
|
2118
|
-
op(0
|
|
2119
|
-
/* PushFrame */
|
|
2120
|
-
);
|
|
2121
|
-
op(1010
|
|
2122
|
-
/* ResolveLocal */
|
|
2123
|
-
, value[1], (name, moduleName) => {
|
|
2124
|
-
deprecate(`The \`${name}\` property was used in the \`${moduleName}\` template without using \`this\`. This fallback behavior has been deprecated, all properties must be looked up on \`this\` when used in the template: {{this.${name}}}`, false, {
|
|
2125
|
-
id: 'this-property-fallback'
|
|
2126
|
-
});
|
|
2127
|
-
op(21
|
|
2128
|
-
/* GetVariable */
|
|
2129
|
-
, 0);
|
|
2130
|
-
op(22
|
|
2131
|
-
/* GetProperty */
|
|
2132
|
-
, name);
|
|
2133
|
-
});
|
|
2134
|
-
op(3
|
|
2135
|
-
/* InvokeStatic */
|
|
2136
|
-
, stdlibOperand('cautious-append'));
|
|
2137
|
-
op(1
|
|
2138
|
-
/* PopFrame */
|
|
2139
|
-
);
|
|
2140
2042
|
}
|
|
2141
2043
|
|
|
2142
2044
|
});
|
|
@@ -2567,16 +2469,8 @@ function encodeOp(encoder, constants, resolver, meta, op) {
|
|
|
2567
2469
|
:
|
|
2568
2470
|
let freeVar = op[1];
|
|
2569
2471
|
let name = meta.upvars[freeVar];
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
encoder.push(constants, 102
|
|
2573
|
-
/* ResolveMaybeLocal */
|
|
2574
|
-
, name);
|
|
2575
|
-
} else {
|
|
2576
|
-
let then = op[2];
|
|
2577
|
-
then(name, meta.moduleName);
|
|
2578
|
-
}
|
|
2579
|
-
|
|
2472
|
+
let andThen = op[2];
|
|
2473
|
+
andThen(name, meta.moduleName);
|
|
2580
2474
|
break;
|
|
2581
2475
|
|
|
2582
2476
|
case 1011
|
|
@@ -2860,7 +2754,6 @@ function compileStd(context) {
|
|
|
2860
2754
|
return new StdLib(mainHandle, trustingGuardedDynamicAppend, cautiousGuardedDynamicAppend, trustingGuardedNonDynamicAppend, cautiousGuardedNonDynamicAppend);
|
|
2861
2755
|
}
|
|
2862
2756
|
const STDLIB_META = {
|
|
2863
|
-
asPartial: false,
|
|
2864
2757
|
evalSymbols: null,
|
|
2865
2758
|
upvars: null,
|
|
2866
2759
|
moduleName: 'stdlib',
|
|
@@ -2938,24 +2831,6 @@ const MINIMAL_CAPABILITIES = {
|
|
|
2938
2831
|
hasSubOwner: false
|
|
2939
2832
|
};
|
|
2940
2833
|
|
|
2941
|
-
class PartialDefinitionImpl {
|
|
2942
|
-
constructor(name, // for debugging
|
|
2943
|
-
template) {
|
|
2944
|
-
this.name = name;
|
|
2945
|
-
this.template = template;
|
|
2946
|
-
}
|
|
2947
|
-
|
|
2948
|
-
getPartial(context) {
|
|
2949
|
-
let partial = unwrapTemplate(this.template).asPartial();
|
|
2950
|
-
let handle = partial.compile(context);
|
|
2951
|
-
return {
|
|
2952
|
-
symbolTable: partial.symbolTable,
|
|
2953
|
-
handle
|
|
2954
|
-
};
|
|
2955
|
-
}
|
|
2956
|
-
|
|
2957
|
-
}
|
|
2958
|
-
|
|
2959
2834
|
class WrappedBuilder {
|
|
2960
2835
|
constructor(layout, moduleName) {
|
|
2961
2836
|
this.layout = layout;
|
|
@@ -3094,7 +2969,6 @@ class TemplateImpl {
|
|
|
3094
2969
|
this.parsedLayout = parsedLayout;
|
|
3095
2970
|
this.result = 'ok';
|
|
3096
2971
|
this.layout = null;
|
|
3097
|
-
this.partial = null;
|
|
3098
2972
|
this.wrappedLayout = null;
|
|
3099
2973
|
}
|
|
3100
2974
|
|
|
@@ -3117,25 +2991,14 @@ class TemplateImpl {
|
|
|
3117
2991
|
|
|
3118
2992
|
asLayout() {
|
|
3119
2993
|
if (this.layout) return this.layout;
|
|
3120
|
-
return this.layout = compilable(assign({}, this.parsedLayout,
|
|
3121
|
-
asPartial: false
|
|
3122
|
-
}), this.moduleName);
|
|
3123
|
-
}
|
|
3124
|
-
|
|
3125
|
-
asPartial() {
|
|
3126
|
-
if (this.partial) return this.partial;
|
|
3127
|
-
return this.partial = compilable(assign({}, this.parsedLayout, {
|
|
3128
|
-
asPartial: true
|
|
3129
|
-
}), this.moduleName);
|
|
2994
|
+
return this.layout = compilable(assign({}, this.parsedLayout), this.moduleName);
|
|
3130
2995
|
}
|
|
3131
2996
|
|
|
3132
2997
|
asWrappedLayout() {
|
|
3133
2998
|
if (this.wrappedLayout) return this.wrappedLayout;
|
|
3134
|
-
return this.wrappedLayout = new WrappedBuilder(assign({}, this.parsedLayout,
|
|
3135
|
-
asPartial: false
|
|
3136
|
-
}), this.moduleName);
|
|
2999
|
+
return this.wrappedLayout = new WrappedBuilder(assign({}, this.parsedLayout), this.moduleName);
|
|
3137
3000
|
}
|
|
3138
3001
|
|
|
3139
3002
|
}
|
|
3140
3003
|
|
|
3141
|
-
export { debugCompiler, compileStatements, compilable, InvokeStaticBlockWithStack as invokeStaticBlockWithStack, InvokeStaticBlock as invokeStaticBlock, compileStd, meta, StdLib,
|
|
3004
|
+
export { debugCompiler, compileStatements, compilable, InvokeStaticBlockWithStack as invokeStaticBlockWithStack, InvokeStaticBlock as invokeStaticBlock, compileStd, meta, StdLib, templateFactory, templateCacheCounters, WrappedBuilder, EMPTY_BLOCKS, CompileTimeCompilationContextImpl, programCompilationContext, templateCompilationContext, DEFAULT_CAPABILITIES, MINIMAL_CAPABILITIES };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assign, symbol, Stack, fillNulls, _WeakSet, isObject, dict, emptyArray, EMPTY_STRING_ARRAY, debugToString, decodeHandle, decodeImmediate, isHandle, unwrapTemplate,
|
|
1
|
+
import { assign, symbol, Stack, fillNulls, _WeakSet, isObject, dict, emptyArray, EMPTY_STRING_ARRAY, debugToString, decodeHandle, decodeImmediate, isHandle, unwrapTemplate, clearElement, unwrapHandle, buildUntouchableThis, HAS_NATIVE_PROXY, isDict } from '@glimmer/util';
|
|
2
2
|
import { UNDEFINED_REFERENCE, valueForRef, createComputeRef, createDebugAliasRef, childRefFor, TRUE_REFERENCE, FALSE_REFERENCE, isConstRef, createPrimitiveRef, NULL_REFERENCE, createConstRef, createIteratorRef, updateRef, createIteratorItemRef, isInvokableRef } from '@glimmer/reference';
|
|
3
3
|
import { warnIfStyleNotTrusted, toBool, assertGlobalContextWasSet, deprecate, getPath, setPath } from '@glimmer/global-context';
|
|
4
4
|
import { DEBUG } from '@glimmer/env';
|
|
@@ -3903,60 +3903,6 @@ APPEND_OPCODES.add(103
|
|
|
3903
3903
|
callback(valueForRef(vm.getSelf()), path => valueForRef(inspector.get(path)));
|
|
3904
3904
|
});
|
|
3905
3905
|
|
|
3906
|
-
APPEND_OPCODES.add(101
|
|
3907
|
-
/* InvokePartial */
|
|
3908
|
-
, (vm, {
|
|
3909
|
-
op1: _symbols,
|
|
3910
|
-
op2: _evalInfo
|
|
3911
|
-
}) => {
|
|
3912
|
-
let {
|
|
3913
|
-
[CONSTANTS]: constants,
|
|
3914
|
-
stack
|
|
3915
|
-
} = vm;
|
|
3916
|
-
let name = valueForRef(stack.pop());
|
|
3917
|
-
let outerScope = vm.scope();
|
|
3918
|
-
let owner = outerScope.owner;
|
|
3919
|
-
let outerSymbols = constants.getArray(_symbols);
|
|
3920
|
-
let evalInfo = constants.getArray(decodeHandle(_evalInfo));
|
|
3921
|
-
let definition = vm.runtime.resolver.lookupPartial(name, owner);
|
|
3922
|
-
let {
|
|
3923
|
-
symbolTable,
|
|
3924
|
-
handle: vmHandle
|
|
3925
|
-
} = definition.getPartial(vm.context);
|
|
3926
|
-
{
|
|
3927
|
-
let partialSymbols = symbolTable.symbols;
|
|
3928
|
-
let partialScope = vm.pushRootScope(partialSymbols.length, owner);
|
|
3929
|
-
let evalScope = outerScope.getEvalScope();
|
|
3930
|
-
partialScope.bindEvalScope(evalScope);
|
|
3931
|
-
partialScope.bindSelf(outerScope.getSelf());
|
|
3932
|
-
let locals = Object.create(outerScope.getPartialMap());
|
|
3933
|
-
|
|
3934
|
-
for (let i = 0; i < evalInfo.length; i++) {
|
|
3935
|
-
let slot = evalInfo[i];
|
|
3936
|
-
|
|
3937
|
-
if (slot !== -1) {
|
|
3938
|
-
let name = outerSymbols[slot - 1];
|
|
3939
|
-
let ref = outerScope.getSymbol(slot);
|
|
3940
|
-
locals[name] = ref;
|
|
3941
|
-
}
|
|
3942
|
-
}
|
|
3943
|
-
|
|
3944
|
-
if (evalScope) {
|
|
3945
|
-
for (let i = 0; i < partialSymbols.length; i++) {
|
|
3946
|
-
let name = partialSymbols[i];
|
|
3947
|
-
let symbol$$1 = i + 1;
|
|
3948
|
-
let value = evalScope[name];
|
|
3949
|
-
if (value !== undefined) partialScope.bind(symbol$$1, value);
|
|
3950
|
-
}
|
|
3951
|
-
}
|
|
3952
|
-
|
|
3953
|
-
partialScope.bindPartialMap(locals);
|
|
3954
|
-
vm.pushFrame(); // sp += 2
|
|
3955
|
-
|
|
3956
|
-
vm.call(unwrapHandle(vmHandle));
|
|
3957
|
-
}
|
|
3958
|
-
});
|
|
3959
|
-
|
|
3960
3906
|
APPEND_OPCODES.add(72
|
|
3961
3907
|
/* EnterList */
|
|
3962
3908
|
, (vm, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEBUG } from '@glimmer/env';
|
|
2
|
-
import {
|
|
2
|
+
import { assert, scheduleRevalidate } from '@glimmer/global-context';
|
|
3
3
|
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
5
5
|
function indexable(input) {
|
|
@@ -28,7 +28,6 @@ function unwrap(val) {
|
|
|
28
28
|
let beginTrackingTransaction;
|
|
29
29
|
let endTrackingTransaction;
|
|
30
30
|
let runInTrackingTransaction;
|
|
31
|
-
let deprecateMutationsInTrackingTransaction;
|
|
32
31
|
let resetTrackingTransaction;
|
|
33
32
|
let setTrackingTransactionEnv;
|
|
34
33
|
let assertTagNotConsumed;
|
|
@@ -62,14 +61,13 @@ if (DEBUG) {
|
|
|
62
61
|
|
|
63
62
|
setTrackingTransactionEnv = env => Object.assign(TRANSACTION_ENV, env);
|
|
64
63
|
|
|
65
|
-
beginTrackingTransaction =
|
|
64
|
+
beginTrackingTransaction = _debugLabel => {
|
|
66
65
|
CONSUMED_TAGS = CONSUMED_TAGS || new WeakMap();
|
|
67
66
|
let debugLabel = _debugLabel || undefined;
|
|
68
67
|
let parent = TRANSACTION_STACK[TRANSACTION_STACK.length - 1] || null;
|
|
69
68
|
TRANSACTION_STACK.push({
|
|
70
69
|
parent,
|
|
71
|
-
debugLabel
|
|
72
|
-
deprecate: deprecate$$1
|
|
70
|
+
debugLabel
|
|
73
71
|
});
|
|
74
72
|
};
|
|
75
73
|
|
|
@@ -122,28 +120,6 @@ if (DEBUG) {
|
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
};
|
|
125
|
-
/**
|
|
126
|
-
* Switches to deprecating within an autotracking transaction, if one exists.
|
|
127
|
-
* If `runInAutotrackingTransaction` is called within the callback of this
|
|
128
|
-
* method, it switches back to throwing an error, allowing zebra-striping of
|
|
129
|
-
* the types of errors that are thrown.
|
|
130
|
-
*
|
|
131
|
-
* Does not start an autotracking transaction.
|
|
132
|
-
*
|
|
133
|
-
* NOTE: For Ember usage only, in general you should assert that these
|
|
134
|
-
* invariants are true.
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
deprecateMutationsInTrackingTransaction = (fn, debugLabel) => {
|
|
139
|
-
beginTrackingTransaction(debugLabel, true);
|
|
140
|
-
|
|
141
|
-
try {
|
|
142
|
-
fn();
|
|
143
|
-
} finally {
|
|
144
|
-
endTrackingTransaction();
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
123
|
|
|
148
124
|
let nthIndex = (str, pattern, n, startingPos = -1) => {
|
|
149
125
|
let i = startingPos;
|
|
@@ -201,32 +177,24 @@ if (DEBUG) {
|
|
|
201
177
|
assertTagNotConsumed = (tag, obj, keyName) => {
|
|
202
178
|
if (CONSUMED_TAGS === null) return;
|
|
203
179
|
let transaction = CONSUMED_TAGS.get(tag);
|
|
204
|
-
if (!transaction) return;
|
|
205
|
-
let
|
|
180
|
+
if (!transaction) return; // This hack makes the assertion message nicer, we can cut off the first
|
|
181
|
+
// few lines of the stack trace and let users know where the actual error
|
|
182
|
+
// occurred.
|
|
206
183
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
} catch (e) {
|
|
218
|
-
if (e.stack) {
|
|
219
|
-
let updateStackBegin = e.stack.indexOf('Stack trace for the update:');
|
|
220
|
-
|
|
221
|
-
if (updateStackBegin !== -1) {
|
|
222
|
-
let start = nthIndex(e.stack, '\n', 1, updateStackBegin);
|
|
223
|
-
let end = nthIndex(e.stack, '\n', 4, updateStackBegin);
|
|
224
|
-
e.stack = e.stack.substr(0, start) + e.stack.substr(end);
|
|
225
|
-
}
|
|
184
|
+
try {
|
|
185
|
+
assert(false, makeTrackingErrorMessage(transaction, obj, keyName));
|
|
186
|
+
} catch (e) {
|
|
187
|
+
if (e.stack) {
|
|
188
|
+
let updateStackBegin = e.stack.indexOf('Stack trace for the update:');
|
|
189
|
+
|
|
190
|
+
if (updateStackBegin !== -1) {
|
|
191
|
+
let start = nthIndex(e.stack, '\n', 1, updateStackBegin);
|
|
192
|
+
let end = nthIndex(e.stack, '\n', 4, updateStackBegin);
|
|
193
|
+
e.stack = e.stack.substr(0, start) + e.stack.substr(end);
|
|
226
194
|
}
|
|
227
|
-
|
|
228
|
-
throw e;
|
|
229
195
|
}
|
|
196
|
+
|
|
197
|
+
throw e;
|
|
230
198
|
}
|
|
231
199
|
};
|
|
232
200
|
}
|
|
@@ -765,4 +733,4 @@ if (globalObj[GLIMMER_VALIDATOR_REGISTRATION] === true) {
|
|
|
765
733
|
|
|
766
734
|
globalObj[GLIMMER_VALIDATOR_REGISTRATION] = true;
|
|
767
735
|
|
|
768
|
-
export { ALLOW_CYCLES, bump, combine, COMPUTE, CONSTANT_TAG, CONSTANT, createTag, createUpdatableTag, CurrentTag, CURRENT_TAG, DIRTY_TAG as dirtyTag, INITIAL, isConstTag, UPDATE_TAG as updateTag, validateTag, valueForTag, VolatileTag, VOLATILE_TAG, VOLATILE, dirtyTagFor, tagFor, tagMetaFor, beginTrackFrame, endTrackFrame, beginUntrackFrame, endUntrackFrame, resetTracking, consumeTag, isTracking, track, untrack, createCache, isConst, getValue, trackedData, logTrackingStack, setTrackingTransactionEnv, runInTrackingTransaction, beginTrackingTransaction, endTrackingTransaction
|
|
736
|
+
export { ALLOW_CYCLES, bump, combine, COMPUTE, CONSTANT_TAG, CONSTANT, createTag, createUpdatableTag, CurrentTag, CURRENT_TAG, DIRTY_TAG as dirtyTag, INITIAL, isConstTag, UPDATE_TAG as updateTag, validateTag, valueForTag, VolatileTag, VOLATILE_TAG, VOLATILE, dirtyTagFor, tagFor, tagMetaFor, beginTrackFrame, endTrackFrame, beginUntrackFrame, endUntrackFrame, resetTracking, consumeTag, isTracking, track, untrack, createCache, isConst, getValue, trackedData, logTrackingStack, setTrackingTransactionEnv, runInTrackingTransaction, beginTrackingTransaction, endTrackingTransaction };
|