language
stringclasses 1
value | owner
stringlengths 2
15
| repo
stringlengths 2
21
| sha
stringlengths 45
45
| message
stringlengths 7
36.3k
| path
stringlengths 1
199
| patch
stringlengths 15
102k
| is_multipart
bool 2
classes |
---|---|---|---|---|---|---|---|
Other
|
emberjs
|
ember.js
|
cd364f5c15081c9e20ccb475f9216cf8be779c9f.json
|
promote eslint rule "semi" to entire project
|
packages/internal-test-helpers/lib/test-resolver.js
|
@@ -40,4 +40,4 @@ class ModuleBasedResolver extends Resolver {
}
}
-export { ModuleBasedResolver }
+export { ModuleBasedResolver };
| true |
Other
|
emberjs
|
ember.js
|
cd364f5c15081c9e20ccb475f9216cf8be779c9f.json
|
promote eslint rule "semi" to entire project
|
packages/node-module/lib/node-module.js
|
@@ -4,10 +4,10 @@ enifed('node-module', ['exports'], function(_exports) {
if (IS_NODE) {
_exports.require = module.require;
_exports.module = module;
- _exports.IS_NODE = IS_NODE
+ _exports.IS_NODE = IS_NODE;
} else {
_exports.require = null;
_exports.module = null;
- _exports.IS_NODE = IS_NODE
+ _exports.IS_NODE = IS_NODE;
}
});
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
4caeb8c84dc317af1346337536909c2164e7e3fe.json
|
ember-glimmer/string: Fix escapeExpression() types
escapeExpression() accepts anything and always returns a string
|
packages/ember-glimmer/lib/utils/string.ts
|
@@ -53,7 +53,7 @@ function escapeChar(chr: keyof typeof escape) {
return escape[chr];
}
-export function escapeExpression(string: string | SafeString) {
+export function escapeExpression(string: any): string {
if (typeof string !== 'string') {
// don't escape SafeStrings, since they're already safe
if (string && string.toHTML) {
| false |
Other
|
emberjs
|
ember.js
|
f366bc672291c6d3e70c6ac5dcefcecfcd82ad41.json
|
Remove obsolete JSCS code
We're using ESLint now...
|
lib/jscs-rules/disallow-const-outside-module-scope.js
|
@@ -1,38 +0,0 @@
-var assert = require('assert');
-
-module.exports = function() { };
-
-module.exports.prototype = {
- configure: function(option) {
- assert(option === true, this.getOptionName() + ' requires a true value');
- },
-
- getOptionName: function() {
- return 'disallowConstOutsideModuleScope';
- },
-
- check: function(file, errors) {
- file.iterateNodesByType('VariableDeclaration', function(node) {
- if (node.parentNode.type === 'Program') {
- // Declaration is in root of module.
- return;
- }
-
- if (node.parentNode.type === 'ExportNamedDeclaration' && node.parentNode.parentNode.type === 'Program') {
- // Declaration is a `export const foo = 'asdf'` in root of the module.
- return;
- }
-
- for (var i = 0; i < node.declarations.length; i++) {
- var thisDeclaration = node.declarations[i];
-
- if (thisDeclaration.parentNode.kind === 'const') {
- errors.add(
- '`const` should only be used in module scope (not inside functions/blocks).',
- node.loc.start
- );
- }
- }
- });
- }
-};
| true |
Other
|
emberjs
|
ember.js
|
f366bc672291c6d3e70c6ac5dcefcecfcd82ad41.json
|
Remove obsolete JSCS code
We're using ESLint now...
|
lib/jscs-rules/disallow-multiple-var-decl-with-assignment.js
|
@@ -1,39 +0,0 @@
-var assert = require('assert');
-
-module.exports = function() {};
-
-module.exports.prototype = {
- configure: function(disallowMultipleVarDeclWithAssignment) {
- assert(
- typeof disallowMultipleVarDeclWithAssignment === 'boolean',
- 'disallowMultipleVarDeclWithAssignment option requires boolean value'
- );
- assert(
- disallowMultipleVarDeclWithAssignment === true,
- 'disallowMultipleVarDeclWithAssignment option requires true value or should be removed'
- );
- },
-
- getOptionName: function() {
- return 'disallowMultipleVarDeclWithAssignment';
- },
-
- check: function(file, errors) {
- file.iterateNodesByType('VariableDeclaration', function(node) {
- // Allow multiple var declarations in for statement
- // for (var i = 0, j = myArray.length; i < j; i++) {}
- if (node.parentNode.type === 'ForStatement') { return; }
-
- var hasAssignment = false;
- var multiDeclaration = node.declarations.length > 1;
-
- node.declarations.forEach(function(declaration) {
- if (declaration.init) { hasAssignment = true; }
- });
-
- if (hasAssignment && multiDeclaration) {
- errors.add('Multiple assigning variable declarations', node.loc.start);
- }
- });
- }
-};
| true |
Other
|
emberjs
|
ember.js
|
f366bc672291c6d3e70c6ac5dcefcecfcd82ad41.json
|
Remove obsolete JSCS code
We're using ESLint now...
|
lib/jscs-rules/disallow-space-before-semicolon.js
|
@@ -1,29 +0,0 @@
-var assert = require('assert');
-
-module.exports = function() {};
-
-module.exports.prototype = {
- configure: function(disallowSpacesBeforeSemicolons) {
- assert(
- typeof disallowSpacesBeforeSemicolons === 'boolean',
- 'disallowSpacesBeforeSemicolons option requires boolean value'
- );
- assert(
- disallowSpacesBeforeSemicolons === true,
- 'disallowSpacesBeforeSemicolons option requires true value or should be removed'
- );
- },
-
- getOptionName: function() {
- return 'disallowSpacesBeforeSemicolons';
- },
-
- check: function(file, errors) {
- var lines = file.getLines();
- for (var i = 0; i < lines.length; i++) {
- if (lines[i].match(/\s+;$/)) {
- errors.add('Spaces are disallowed before semicolons.', i + 1, lines[i].length - 2);
- }
- }
- }
-};
| true |
Other
|
emberjs
|
ember.js
|
f366bc672291c6d3e70c6ac5dcefcecfcd82ad41.json
|
Remove obsolete JSCS code
We're using ESLint now...
|
lib/jscs-rules/disallow-space-inside-round-braces-in-call-expression.js
|
@@ -1,74 +0,0 @@
-var assert = require('assert');
-
-function spaceAfterBrace(arg, braceToken) {
- if (arg) {
- var supportedArgs = arg.type !== 'UnaryExpression' && arg.type !== 'BinaryExpression';
-
- return supportedArgs && braceToken.value === '(' && braceToken.range[1] + 1 === arg.range[0];
- }
-
- return false;
-}
-
-function spaceBeforeBrace(arg, braceToken) {
- if (arg) {
- var supportedArgs = arg.type !== 'UnaryExpression' && arg.type !== 'BinaryExpression';
-
- return supportedArgs && braceToken.value === ')' && braceToken.range[0] === arg.range[1] + 1;
- }
-
- return false;
-}
-
-module.exports = function() {};
-
-module.exports.prototype = {
- configure: function(requireSpacesInsideRoundBracesInCallExpression) {
- assert(
- requireSpacesInsideRoundBracesInCallExpression === true,
- 'disallowSpacesInsideRoundBracesInCallExpression option requires true value or should be removed'
- );
- },
-
- getOptionName: function() {
- return 'disallowSpacesInsideRoundBracesInCallExpression';
- },
-
- check: function(file, errors) {
- file.iterateNodesByType('CallExpression', function(node) {
- var nodeBeforeRoundBrace = node;
-
- if (node.callee) {
- nodeBeforeRoundBrace = node.callee;
- }
-
- var roundBraceTokenStart = file.getTokenByRangeStart(nodeBeforeRoundBrace.range[0]);
- var roundBraceTokenEnd = file.getTokenByRangeStart(nodeBeforeRoundBrace.range[0]);
-
- do {
- roundBraceTokenStart = file.findNextToken(roundBraceTokenStart, 'Punctuator', '(');
- roundBraceTokenEnd = file.findNextToken(roundBraceTokenEnd, 'Punctuator', ')');
- } while (roundBraceTokenStart.range[0] < nodeBeforeRoundBrace.range[1]);
-
- var firstArg = nodeBeforeRoundBrace.parentNode.arguments[0];
- var lastArg = nodeBeforeRoundBrace.parentNode.arguments[nodeBeforeRoundBrace.parentNode.arguments.length - 1];
-
- var spaceAfterOpeningRoundBraceExists = spaceAfterBrace(firstArg, roundBraceTokenStart);
- var spaceBeforeClosingRoundBraceExists = spaceBeforeBrace(lastArg, roundBraceTokenEnd);
-
- if (spaceAfterOpeningRoundBraceExists) {
- errors.add(
- 'Illegal space after opening round brace',
- roundBraceTokenStart.loc.start
- );
- }
-
- if (spaceBeforeClosingRoundBraceExists) {
- errors.add(
- 'Illegal space before closing round brace',
- roundBraceTokenEnd.loc.start
- );
- }
- });
- }
-};
| true |
Other
|
emberjs
|
ember.js
|
f366bc672291c6d3e70c6ac5dcefcecfcd82ad41.json
|
Remove obsolete JSCS code
We're using ESLint now...
|
lib/jscs-rules/require-comments-to-include-access.js
|
@@ -1,44 +0,0 @@
-var assert = require('assert');
-
-function isDocComment(comment) {
- return comment.value[0] === '*';
-}
-
-function isModuleOnlyComment(comment) {
- return comment.value.match(/^\*\r?\n\s*@module.+\r?\n(?:\s*@submodule.+\r?\n)?$/);
-}
-
-function accessDeclarationCount(comment) {
- var matched = comment.value.match(/\r?\n\s*(?:@private|@public|@protected)\s/g);
- return matched ? matched.length : 0;
-}
-
-function RequireCommentsToIncludeAccess() { }
-
-RequireCommentsToIncludeAccess.prototype = {
- configure: function(value) {
- assert(
- value === true,
- this.getOptionName() + ' option requires a true value or should be removed'
- );
- },
-
- getOptionName: function() {
- return 'requireCommentsToIncludeAccess';
- },
-
- check: function(file, errors) {
- file.iterateTokensByType('Block', function(comment) {
- if (isDocComment(comment) && !isModuleOnlyComment(comment)) {
- var declarationCount = accessDeclarationCount(comment);
- if (declarationCount === 0) {
- errors.add('You must supply `@public`, `@private`, or `@protected` for block comments.', comment.loc.end);
- } else if (declarationCount > 1) {
- errors.add('You must supply `@public`, `@private`, or `@protected` for block comments only once.', comment.loc.end);
- }
- }
- });
- }
-};
-
-module.exports = RequireCommentsToIncludeAccess;
| true |
Other
|
emberjs
|
ember.js
|
f366bc672291c6d3e70c6ac5dcefcecfcd82ad41.json
|
Remove obsolete JSCS code
We're using ESLint now...
|
lib/jscs-rules/require-spaces-after-closing-parenthesis-in-function-declaration.js
|
@@ -1,69 +0,0 @@
-var assert = require('assert');
-
-module.exports = function() {};
-
-module.exports.prototype = {
- configure: function(options) {
- assert(
- typeof options === 'object',
- 'requireSpacesAfterClosingParenthesisInFunctionDeclaration option must be the object'
- );
-
- assert(
- options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace,
- 'requireSpacesAfterClosingParenthesisInFunctionDeclaration must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property'
- );
-
- this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace);
- this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace);
- },
-
- getOptionName: function() {
- return 'requireSpacesAfterClosingParenthesisInFunctionDeclaration';
- },
-
- check: function(file, errors) {
- var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace;
- var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace;
-
- file.iterateNodesByType(['FunctionDeclaration'], function(node) {
- var functionToken = file.getFirstNodeToken(node.id || node);
- var nextToken = file.getNextToken(functionToken);
-
- if (beforeOpeningRoundBrace) {
- if (nextToken) {
- errors.add(
- 'Missing space before opening round brace',
- nextToken.loc.start
- );
- }
- } else {
- if (!nextToken) {
- errors.add(
- 'Illegal space before opening round brace',
- functionToken.loc.end
- );
- }
- }
-
- // errors if no token is found unless `includeComments` is passed
- var tokenBeforeBody = file.getPrevToken(node.body, { includeComments: true });
-
- if (beforeOpeningCurlyBrace) {
- if (tokenBeforeBody) {
- errors.add(
- 'Missing space before opening curly brace',
- tokenBeforeBody.loc.start
- );
- }
- } else {
- if (!tokenBeforeBody) {
- errors.add(
- 'Illegal space before opening curly brace',
- node.body.loc.end
- );
- }
- }
- });
- }
-};
| true |
Other
|
emberjs
|
ember.js
|
f366bc672291c6d3e70c6ac5dcefcecfcd82ad41.json
|
Remove obsolete JSCS code
We're using ESLint now...
|
packages/ember-glimmer/lib/utils/string.ts
|
@@ -39,9 +39,7 @@ const escape = {
'<': '<',
'>': '>',
'"': '"',
- // jscs:disable
"'": ''',
- // jscs:enable
'`': '`',
'=': '=',
};
| true |
Other
|
emberjs
|
ember.js
|
f366bc672291c6d3e70c6ac5dcefcecfcd82ad41.json
|
Remove obsolete JSCS code
We're using ESLint now...
|
packages/ember-metal/tests/run_loop/later_test.js
|
@@ -27,9 +27,7 @@ function wait(callback, maxWaitCount) {
// run loop has to flush, it would have considered
// the timer already expired.
function pauseUntil(time) {
- // jscs:disable
while (+new Date() < time) { /* do nothing - sleeping */ }
- // jscs:enable
}
QUnit.module('run.later', {
| true |
Other
|
emberjs
|
ember.js
|
f366bc672291c6d3e70c6ac5dcefcecfcd82ad41.json
|
Remove obsolete JSCS code
We're using ESLint now...
|
packages/ember-routing/tests/location/util_test.js
|
@@ -80,7 +80,6 @@ QUnit.test('Feature-Detecting onhashchange', function() {
equal(supportsHashChange(8, { onhashchange() {} }), true, 'When in IE8+, use onhashchange existence as evidence of the feature');
});
-// jscs:disable
QUnit.test("Feature-detecting the history API", function() {
equal(supportsHistory("", { pushState: true }), true, "returns true if not Android Gingerbread and history.pushState exists");
equal(supportsHistory("", {}), false, "returns false if history.pushState doesn't exist");
@@ -132,5 +131,3 @@ QUnit.test("Feature-detecting the history API", function() {
"returns true for Windows Phone 8.1 with misleading user agent string"
);
});
-// jscs:enable
-
| true |
Other
|
emberjs
|
ember.js
|
131bf7ba6c18d4ea711297e58764a7b05f7ba51a.json
|
Add 2.17.0-beta.5 to CHANGELOG
[ci skip]
|
CHANGELOG.md
|
@@ -1,5 +1,9 @@
# Ember Changelog
+### 2.17.0-beta.5 (November 7, 2017)
+- [#15797](https://github.com/emberjs/ember.js/pull/15797) [BUGFIX] Fix issues with using partials nested within other partials.
+- [#15808](https://github.com/emberjs/ember.js/pull/15808) [BUGFIX] Fix a memory leak in certain testing scenarios.
+
### 2.17.0-beta.4 (October 30, 2017)
- [#15746](https://github.com/emberjs/ember.js/pull/15746) [BUGFIX] Fix computed sort regression when array property is initally `null`.
- [#15777](https://github.com/emberjs/ember.js/pull/15777) [BUGFIX] Fix various issues around accessing dynamic data within a partial.
| false |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
ember-cli-build.js
|
@@ -65,8 +65,11 @@ module.exports = function(options) {
glimmerPkgES('@glimmer/compiler', ['@glimmer/util', '@glimmer/wire-format', '@glimmer/syntax']),
{ annotation: '@glimmer/compiler' }
);
+ let glimmerEncoder = toES5(glimmerPkgES('@glimmer/encoder'));
+ let glimmerOpcodeComiler = toES5(glimmerPkgES('@glimmer/opcode-compiler', ['@glimmer/encoder']));
let glimmerReference = toES5(glimmerPkgES('@glimmer/reference', ['@glimmer/util']));
let glimmerUtil = toES5(glimmerPkgES('@glimmer/util'));
+ let glimmerVM = toES5(glimmerPkgES('@glimmer/vm'));
let glimmerWireFormat = toES5(glimmerPkgES('@glimmer/wire-format', ['@glimmer/util']));
let babelDebugHelpersES5 = toES5(babelHelpers('debug'), { annotation: 'babel helpers debug' });
let inlineParser = toES5(handlebarsES(), { annotation: 'handlebars' });
@@ -136,8 +139,11 @@ module.exports = function(options) {
emberMetalES5,
emberConsoleES5,
emberDebugES5,
+ glimmerEncoder,
+ glimmerOpcodeComiler,
glimmerReference,
glimmerUtil,
+ glimmerVM,
glimmerWireFormat,
backburner,
version,
@@ -197,8 +203,11 @@ module.exports = function(options) {
emberDebugES5,
glimmerSyntax,
glimmerCompiler,
+ glimmerEncoder,
+ glimmerOpcodeComiler,
glimmerReference,
glimmerUtil,
+ glimmerVM,
glimmerWireFormat,
backburner,
debugFeatures,
@@ -229,8 +238,11 @@ module.exports = function(options) {
});
let depsProd = [
+ glimmerEncoder,
+ glimmerOpcodeComiler,
glimmerReference,
glimmerUtil,
+ glimmerVM,
glimmerWireFormat,
backburner,
rsvp
@@ -344,9 +356,11 @@ function dependenciesES6() {
routeRecognizerES(),
glimmerPkgES('@glimmer/node', ['@glimmer/runtime']),
glimmerPkgES('@glimmer/runtime', [
- '@glimmer/util',
+ '@glimmer/opcode-compiler',
'@glimmer/reference',
- '@glimmer/wire-format'
+ '@glimmer/wire-format',
+ '@glimmer/util',
+ '@glimmer/vm'
])
];
}
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
package.json
|
@@ -42,6 +42,11 @@
"test:testem": "testem -f testem.dist.json"
},
"dependencies": {
+ "@glimmer/compiler": "^0.29.10",
+ "@glimmer/node": "^0.29.10",
+ "@glimmer/reference": "^0.29.10",
+ "@glimmer/runtime": "^0.29.10",
+ "@glimmer/vm": "^0.29.10",
"broccoli-funnel": "^2.0.1",
"broccoli-merge-trees": "^2.0.0",
"ember-cli-get-component-path-option": "^1.0.0",
@@ -58,10 +63,11 @@
"resolve": "^1.3.3"
},
"devDependencies": {
- "@glimmer/compiler": "^0.25.6",
- "@glimmer/node": "^0.25.6",
- "@glimmer/reference": "^0.25.6",
- "@glimmer/runtime": "^0.25.6",
+ "@glimmer/compiler": "^0.29.10",
+ "@glimmer/node": "^0.29.10",
+ "@glimmer/reference": "^0.29.10",
+ "@glimmer/runtime": "^0.29.10",
+ "@glimmer/vm": "^0.29.10",
"aws-sdk": "^2.46.0",
"babel-plugin-check-es2015-constants": "^6.22.0",
"babel-plugin-debug-macros": "^0.1.10",
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/component-managers/abstract.ts
|
@@ -1,13 +1,14 @@
-import { ProgramSymbolTable } from '@glimmer/interfaces';
+import {
+ ComponentCapabilities,
+} from '@glimmer/interfaces';
import { Tag, VersionedPathReference } from '@glimmer/reference';
import {
Bounds,
- CompiledDynamicTemplate,
- ComponentDefinition,
ComponentManager,
DynamicScope,
ElementOperations,
Environment,
+ Invocation,
PreparedArguments,
} from '@glimmer/runtime';
import { IArguments } from '@glimmer/runtime/dist/types/lib/vm/arguments';
@@ -23,7 +24,7 @@ import DebugStack from '../utils/debug-stack';
// tslint:disable-next-line:max-line-length
// https://github.com/glimmerjs/glimmer-vm/blob/v0.24.0-beta.4/packages/%40glimmer/runtime/lib/component/interfaces.ts#L21
-export default abstract class AbstractManager<T> implements ComponentManager<T> {
+export default abstract class AbstractManager<T, U> implements ComponentManager<T, U> {
public debugStack: typeof DebugStack;
public _pushToDebugStack: (name: string, environment: any) => void;
public _pushEngineToDebugStack: (name: string, environment: any) => void;
@@ -32,7 +33,7 @@ export default abstract class AbstractManager<T> implements ComponentManager<T>
this.debugStack = undefined;
}
- prepareArgs(_definition: ComponentDefinition<T>, _args: IArguments): Option<PreparedArguments> {
+ prepareArgs(_state: U, _args: IArguments): Option<PreparedArguments> {
return null;
}
@@ -42,16 +43,17 @@ export default abstract class AbstractManager<T> implements ComponentManager<T>
abstract create(
env: Environment,
- definition: ComponentDefinition<T>,
+ definition: U,
args: IArguments,
dynamicScope: DynamicScope,
caller: VersionedPathReference<void | {}>,
hasDefaultBlock: boolean): T;
abstract layoutFor(
- definition: ComponentDefinition<T>,
+ definition: any,
component: T,
- env: Environment): CompiledDynamicTemplate<ProgramSymbolTable>;
+ env: Environment): Invocation;
abstract getSelf(component: T): VersionedPathReference<Opaque>;
+ abstract getCapabilities(state: U): ComponentCapabilities;
didCreateElement(_component: T, _element: Element, _operations: ElementOperations): void {
// noop
@@ -68,7 +70,7 @@ export default abstract class AbstractManager<T> implements ComponentManager<T>
// noop
}
- getTag(_bucket: T): Option<Tag> { return null; }
+ abstract getTag(_bucket: T): Tag;
// inheritors should also call `this._pushToDebugStack`
// to ensure the rerendering assertion messages are
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/component-managers/curly.ts
|
@@ -1,4 +1,3 @@
-import { Option } from '@glimmer/interfaces';
import {
combineTagged,
Tag,
@@ -7,19 +6,22 @@ import {
import {
Arguments,
Bounds,
- CompiledDynamicProgram,
- ComponentClass,
ComponentDefinition,
- ComponentManager,
ElementOperations,
+ Invocation,
NamedArguments,
PositionalArguments,
PreparedArguments,
PrimitiveReference,
- Simple,
VM,
} from '@glimmer/runtime';
import { Destroyable, Opaque } from '@glimmer/util';
+import {
+ ComponentCapabilities,
+ Option,
+ Simple,
+ VMHandle
+} from '@glimmer/interfaces';
import { privatize as P } from 'container';
import {
assert,
@@ -53,6 +55,7 @@ import ComponentStateBucket, { Component } from '../utils/curly-component-state-
import { processComponentArgs } from '../utils/process-args';
import { PropertyReference } from '../utils/references';
import AbstractManager from './abstract';
+import DefinitionState, { CAPABILITIES } from './definition-state';
const DEFAULT_LAYOUT = P`template:components/-default`;
@@ -85,7 +88,7 @@ function applyAttributeBindings(element: Simple.Element, attributeBindings: any,
}
if (seen.indexOf('id') === -1) {
- operations.addStaticAttribute(element, 'id', component.elementId);
+ operations.setAttribute('id', PrimitiveReference.create(component.elementId), true, null);
}
if (seen.indexOf('style') === -1) {
@@ -140,9 +143,14 @@ export class PositionalArgumentReference {
}
}
-export default class CurlyComponentManager extends AbstractManager<ComponentStateBucket> {
- prepareArgs(definition: CurlyComponentDefinition, args: Arguments): Option<PreparedArguments> {
- let componentPositionalParamsDefinition = definition.ComponentClass.class.positionalParams;
+export default class CurlyComponentManager extends AbstractManager<ComponentStateBucket, DefinitionState> {
+
+ getCapabilities(state: DefinitionState): ComponentCapabilities {
+ return state.capabilities;
+ }
+
+ prepareArgs(state: DefinitionState, args: Arguments): Option<PreparedArguments> {
+ let componentPositionalParamsDefinition = state.ComponentClass.class.positionalParams;
if (DEBUG && componentPositionalParamsDefinition) {
validatePositionalParameters(args.named, args.positional, componentPositionalParamsDefinition);
@@ -152,7 +160,7 @@ export default class CurlyComponentManager extends AbstractManager<ComponentStat
let componentHasPositionalParams = componentHasRestStylePositionalParams ||
componentPositionalParamsDefinition.length > 0;
let needsPositionalParamMunging = componentHasPositionalParams && args.positional.length !== 0;
- let isClosureComponent = definition.args;
+ let isClosureComponent = args;
if (!needsPositionalParamMunging && !isClosureComponent) {
return null;
@@ -164,10 +172,10 @@ export default class CurlyComponentManager extends AbstractManager<ComponentStat
// handle prep for closure component with positional params
let curriedNamed;
- if (definition.args) {
- let remainingDefinitionPositionals = definition.args.positional.slice(positional.length);
+ if (args) {
+ let remainingDefinitionPositionals = args.positional.slice(positional.length);
positional = positional.concat(remainingDefinitionPositionals);
- curriedNamed = definition.args.named;
+ curriedNamed = args.named;
}
// handle positionalParams
@@ -191,14 +199,14 @@ export default class CurlyComponentManager extends AbstractManager<ComponentStat
return { positional, named };
}
- create(environment: Environment, definition: CurlyComponentDefinition, args: Arguments, dynamicScope: DynamicScope, callerSelfRef: VersionedPathReference<Opaque>, hasBlock: boolean): ComponentStateBucket {
+ create(environment: Environment, state: DefinitionState, args: Arguments, dynamicScope: DynamicScope, callerSelfRef: VersionedPathReference<Opaque>, hasBlock: boolean): ComponentStateBucket {
if (DEBUG) {
- this._pushToDebugStack(`component:${definition.name}`, environment);
+ this._pushToDebugStack(`component:${state.name}`, environment);
}
let parentView = dynamicScope.view;
- let factory = definition.ComponentClass;
+ let factory = state.ComponentClass;
let capturedArgs = args.named.capture();
let props = processComponentArgs(capturedArgs);
@@ -250,7 +258,7 @@ export default class CurlyComponentManager extends AbstractManager<ComponentStat
return bucket;
}
- layoutFor(definition: CurlyComponentDefinition, bucket: ComponentStateBucket, env: Environment): CompiledDynamicProgram {
+ layoutFor(definition: CurlyComponentDefinition, bucket: ComponentStateBucket, env: Environment): Invocation {
let template = definition.template;
if (!template) {
template = this.templateFor(bucket.component, env);
@@ -278,26 +286,25 @@ export default class CurlyComponentManager extends AbstractManager<ComponentStat
return component[ROOT_REF];
}
- didCreateElement({ component, classRef, environment }: ComponentStateBucket, element: Element, operations: ElementOperations): void {
+ didCreateElement({ component, classRef, environment }: ComponentStateBucket, element: HTMLElement, operations: ElementOperations): void {
setViewElement(component, element);
let { attributeBindings, classNames, classNameBindings } = component;
if (attributeBindings && attributeBindings.length) {
applyAttributeBindings(element, attributeBindings, component, operations);
} else {
- operations.addStaticAttribute(element, 'id', component.elementId);
+ operations.setAttribute('id', PrimitiveReference.create(component.elementId), false, null);
IsVisibleBinding.install(element, component, operations);
}
if (classRef) {
- // TODO should make addDynamicAttribute accept an opaque
- operations.addDynamicAttribute(element, 'class', classRef as any, false);
+ operations.setAttribute('class', classRef as any, false, null);
}
if (classNames && classNames.length) {
classNames.forEach((name: string) => {
- operations.addStaticAttribute(element, 'class', name);
+ operations.setAttribute('class', PrimitiveReference.create(name), false, null);
});
}
@@ -323,7 +330,7 @@ export default class CurlyComponentManager extends AbstractManager<ComponentStat
}
}
- getTag({ component }: ComponentStateBucket): Option<Tag> {
+ getTag({ component }: ComponentStateBucket): Tag {
return component[DIRTY_TAG];
}
@@ -442,16 +449,21 @@ export function rerenderInstrumentDetails(component: any): any {
return component.instrumentDetails({ initialRender: false });
}
-const MANAGER = new CurlyComponentManager();
-
-export class CurlyComponentDefinition extends ComponentDefinition<ComponentStateBucket> {
+export class CurlyComponentDefinition implements ComponentDefinition {
public template: OwnedTemplate;
public args: Arguments | undefined;
+ public state: DefinitionState;
// tslint:disable-next-line:no-shadowed-variable
- constructor(name: string, ComponentClass: ComponentClass, template: OwnedTemplate, args: Arguments | undefined, customManager?: ComponentManager<ComponentStateBucket>) {
- super(name, customManager || MANAGER, ComponentClass);
+ constructor(public name: string, public manager: CurlyComponentManager, public ComponentClass: any, public handle: Option<VMHandle>, template: OwnedTemplate, args?: Arguments) {
this.template = template;
this.args = args;
+ this.manager = manager;
+ this.state = {
+ name,
+ ComponentClass,
+ handle,
+ capabilities: CAPABILITIES
+ };
}
}
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/component-managers/definition-state.ts
|
@@ -0,0 +1,28 @@
+import {
+ ComponentCapabilities,
+ ProgramSymbolTable,
+ VMHandle
+} from '@glimmer/interfaces';
+import {
+ Option
+} from '@glimmer/util';
+
+export const CAPABILITIES: ComponentCapabilities = {
+ dynamicLayout: true,
+ dynamicTag: true,
+ prepareArgs: false,
+ createArgs: true,
+ attributeHook: true,
+ elementHook: true
+};
+
+export default interface DefinitionState {
+ capabilities: ComponentCapabilities;
+
+ name: string;
+ ComponentClass: any;
+ handle: Option<VMHandle>;
+ symbolTable?: ProgramSymbolTable;
+ template?: any;
+ outletName?: string;
+}
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/component-managers/mount.ts
|
@@ -2,21 +2,29 @@ import {
Arguments,
ComponentDefinition,
} from '@glimmer/runtime';
+import {
+ ComponentCapabilities,
+ VMHandle
+} from '@glimmer/interfaces';
import {
Destroyable,
Opaque,
Option
} from '@glimmer/util';
import {
+ Tag,
VersionedPathReference
} from '@glimmer/reference';
import { DEBUG } from 'ember-env-flags';
import { generateControllerFactory } from 'ember-routing';
import { EMBER_ENGINES_MOUNT_PARAMS } from 'ember/features';
+import { Component } from '../utils/curly-component-state-bucket';
+import { DIRTY_TAG } from '../component';
import { RootReference } from '../utils/references';
import Environment from '../environment';
import AbstractManager from './abstract';
+import DefinitionState, { CAPABILITIES } from './definition-state';
import { OutletLayoutCompiler } from './outlet';
// TODO: remove these stubbed interfaces when better typing is in place
@@ -29,13 +37,18 @@ interface EngineType {
interface EngineBucket {
engine: EngineType;
+ component?: Component;
controller?: any;
modelReference?: any;
modelRevision?: any;
}
-class MountManager extends AbstractManager<EngineBucket> {
- create(environment: Environment, { name }: ComponentDefinition<EngineBucket>, args: Arguments) {
+class MountManager extends AbstractManager<EngineBucket, DefinitionState> {
+ getCapabilities(state: DefinitionState): ComponentCapabilities {
+ return state.capabilities;
+ }
+
+ create(environment: Environment, { name }: DefinitionState, args: Arguments) {
if (DEBUG) {
this._pushEngineToDebugStack(`engine:${name}`, environment);
}
@@ -74,6 +87,11 @@ class MountManager extends AbstractManager<EngineBucket> {
return new RootReference(controller);
}
+ getTag({ component }: EngineBucket): Tag {
+ // TODO: is this the right tag?
+ return component[DIRTY_TAG];
+ }
+
getDestructor({ engine }: EngineBucket): Option<Destroyable> {
return engine;
}
@@ -97,10 +115,15 @@ class MountManager extends AbstractManager<EngineBucket> {
}
}
-const MOUNT_MANAGER = new MountManager();
+export class MountDefinition implements ComponentDefinition {
+ public state: DefinitionState;
-export class MountDefinition extends ComponentDefinition<Opaque> {
- constructor(name: string) {
- super(name, MOUNT_MANAGER, null);
+ constructor(public name: string, public manager: MountManager, public ComponentClass: any, public handle: Option<VMHandle>) {
+ this.state = {
+ name,
+ ComponentClass,
+ handle,
+ capabilities: CAPABILITIES
+ };
}
}
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/component-managers/outlet.ts
|
@@ -1,10 +1,16 @@
-import { Option } from '@glimmer/interfaces';
+import {
+ ComponentCapabilities,
+ Option
+} from '@glimmer/interfaces';
import {
Arguments,
ComponentDefinition,
DynamicScope,
- Environment,
+ Environment
} from '@glimmer/runtime';
+import {
+ Tag
+} from '@glimmer/reference';
import { Destroyable } from '@glimmer/util/dist/types';
import { DEBUG } from 'ember-env-flags';
import { _instrumentStart } from 'ember-metal';
@@ -16,6 +22,9 @@ import {
} from '../template';
import { RootReference } from '../utils/references';
import AbstractManager from './abstract';
+import { Component } from '../utils/curly-component-state-bucket';
+import DefinitionState from './definition-state';
+import { DIRTY_TAG } from '../component';
function instrumentationPayload({ render: { name, outlet } }: {render: {name: string, outlet: string}}) {
return { object: `${name}:${outlet}` };
@@ -30,6 +39,7 @@ interface OutletDynamicScope extends DynamicScope {
class StateBucket {
public outletState: any;
public finalizer: any;
+ public component: Component;
constructor(outletState: any) {
this.outletState = outletState;
@@ -47,9 +57,9 @@ class StateBucket {
}
}
-class OutletComponentManager extends AbstractManager<StateBucket> {
+class OutletComponentManager extends AbstractManager<StateBucket, DefinitionState> {
create(environment: Environment,
- definition: OutletComponentDefinition,
+ definition: DefinitionState,
_args: Arguments,
dynamicScope: OutletDynamicScope) {
if (DEBUG) {
@@ -62,6 +72,10 @@ class OutletComponentManager extends AbstractManager<StateBucket> {
return new StateBucket(outletState);
}
+ getCapabilities(state: DefinitionState): ComponentCapabilities {
+ return state.capabilities;
+ }
+
layoutFor(definition: OutletComponentDefinition, _bucket: StateBucket, env: Environment) {
return (env as EmberEnvironment).getCompiledBlock(OutletLayoutCompiler, definition.template);
}
@@ -70,6 +84,11 @@ class OutletComponentManager extends AbstractManager<StateBucket> {
return new RootReference(outletState.render.controller);
}
+ getTag({ component }: StateBucket): Tag {
+ // TODO: is this the right tag?
+ return component[DIRTY_TAG];
+ }
+
didRenderLayout(bucket: StateBucket) {
bucket.finalize();
@@ -83,10 +102,8 @@ class OutletComponentManager extends AbstractManager<StateBucket> {
}
}
-const MANAGER = new OutletComponentManager();
-
class TopLevelOutletComponentManager extends OutletComponentManager {
- create(environment: Environment, definition: OutletComponentDefinition, _args: Arguments, dynamicScope: OutletDynamicScope) {
+ create(environment: Environment, definition: DefinitionState, _args: Arguments, dynamicScope: OutletDynamicScope) {
if (DEBUG) {
this._pushToDebugStack(`template:${definition.template.meta.moduleName}`, environment);
}
@@ -98,12 +115,12 @@ class TopLevelOutletComponentManager extends OutletComponentManager {
}
}
-const TOP_LEVEL_MANAGER = new TopLevelOutletComponentManager();
-
-export class TopLevelOutletComponentDefinition extends ComponentDefinition<StateBucket> {
+export class TopLevelOutletComponentDefinition implements ComponentDefinition {
public template: WrappedTemplateFactory;
+ public state: DefinitionState;
+ public manager: TopLevelOutletComponentManager;
+
constructor(instance: any) {
- super('outlet', TOP_LEVEL_MANAGER, instance);
this.template = instance.template;
generateGuid(this);
}
@@ -126,12 +143,13 @@ class TopLevelOutletLayoutCompiler {
TopLevelOutletLayoutCompiler.id = 'top-level-outlet';
-export class OutletComponentDefinition extends ComponentDefinition<StateBucket> {
+export class OutletComponentDefinition implements ComponentDefinition {
public outletName: string;
public template: OwnedTemplate;
+ public state: DefinitionState;
+ public manager: OutletComponentManager;
constructor(outletName: string, template: OwnedTemplate) {
- super('outlet', MANAGER, null);
this.outletName = outletName;
this.template = template;
generateGuid(this);
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/component-managers/render.ts
|
@@ -1,20 +1,27 @@
import {
- ComponentDefinition,
- ComponentManager,
+ ComponentCapabilities,
+} from '@glimmer/interfaces';
+import {
+ Tag
+} from '@glimmer/reference';
+import {
+ Arguments,
+ ComponentDefinition
} from '@glimmer/runtime';
-import { IArguments } from '@glimmer/runtime/dist/types/lib/vm/arguments';
import { assert } from 'ember-debug';
import { DEBUG } from 'ember-env-flags';
import { generateController, generateControllerFactory } from 'ember-routing';
+import { DIRTY_TAG } from '../component';
import Environment from '../environment';
import { DynamicScope } from '../renderer';
import { OwnedTemplate } from '../template';
import { RootReference } from '../utils/references';
import AbstractManager from './abstract';
+import DefinitionState from './definition-state';
import { OutletLayoutCompiler } from './outlet';
-export abstract class AbstractRenderManager extends AbstractManager<RenderState> {
+export abstract class AbstractRenderManager extends AbstractManager<RenderState, DefinitionState> {
layoutFor(definition: RenderDefinition, _bucket: RenderState, env: Environment) {
// only curly components can have lazy layout
assert('definition is missing a template', !!definition.template);
@@ -35,12 +42,13 @@ if (DEBUG) {
export interface RenderState {
controller: any;
model: any;
+ component: any;
}
class SingletonRenderManager extends AbstractRenderManager {
create(env: Environment,
- definition: ComponentDefinition<RenderState>,
- _args: IArguments,
+ definition: DefinitionState,
+ _args: Arguments,
dynamicScope: DynamicScope) {
let { name } = definition;
let controller = env.owner.lookup<any>(`controller:${name}`) || generateController(env.owner, name);
@@ -56,6 +64,15 @@ class SingletonRenderManager extends AbstractRenderManager {
return { controller } as RenderState;
}
+ getCapabilities(state: DefinitionState): ComponentCapabilities {
+ return state.capabilities;
+ }
+
+ getTag({ component }: RenderState): Tag {
+ // TODO: is this the right tag?
+ return component[DIRTY_TAG];
+ }
+
getDestructor() {
return null;
}
@@ -64,7 +81,10 @@ class SingletonRenderManager extends AbstractRenderManager {
export const SINGLETON_RENDER_MANAGER = new SingletonRenderManager();
class NonSingletonRenderManager extends AbstractRenderManager {
- create(environment: Environment, definition: RenderDefinition, args: IArguments, dynamicScope: DynamicScope) {
+ create(environment: Environment,
+ definition: DefinitionState,
+ args: Arguments,
+ dynamicScope: DynamicScope) {
let { name, env } = definition;
let modelRef = args.positional.at(0);
let controllerFactory = env.owner.factoryFor(`controller:${name}`);
@@ -80,30 +100,41 @@ class NonSingletonRenderManager extends AbstractRenderManager {
dynamicScope.outletState = dynamicScope.rootOutletState.getOrphan(name);
}
- return { controller, model: modelRef };
+ return <RenderState>{ controller, model: modelRef };
}
update({ controller, model }: RenderState) {
controller.set('model', model.value());
}
+ getCapabilities(state: DefinitionState): ComponentCapabilities {
+ return state.capabilities;
+ }
+
+ getTag({ component }: RenderState): Tag {
+ // TODO: is this the right tag?
+ return component[DIRTY_TAG];
+ }
+
getDestructor({ controller }: RenderState) {
return controller;
}
}
export const NON_SINGLETON_RENDER_MANAGER = new NonSingletonRenderManager();
-export class RenderDefinition extends ComponentDefinition<RenderState> {
+export class RenderDefinition implements ComponentDefinition {
public name: string;
public template: OwnedTemplate | undefined;
public env: Environment;
+ public state: DefinitionState;
+ public manager: SingletonRenderManager | NonSingletonRenderManager;
- constructor(name: string, template: OwnedTemplate | undefined, env: Environment, manager: ComponentManager<RenderState>) {
- super('render', manager, null);
+ constructor(name: string, template: OwnedTemplate, env: Environment, manager: SingletonRenderManager | NonSingletonRenderManager) {
this.name = name;
this.template = template;
this.env = env;
+ this.manager = manager;
}
}
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/component-managers/root.ts
|
@@ -1,7 +1,13 @@
+import {
+ VMHandle
+} from '@glimmer/interfaces';
import {
Arguments,
ComponentDefinition
} from '@glimmer/runtime';
+import {
+ Option
+} from '@glimmer/util';
import { DEBUG } from 'ember-env-flags';
import {
_instrumentStart,
@@ -10,13 +16,16 @@ import ComponentStateBucket from '../utils/curly-component-state-bucket';
import CurlyComponentManager, {
initialRenderInstrumentDetails,
processComponentInitializationAssertions,
- CurlyComponentDefinition
} from './curly';
import { DynamicScope } from '../renderer';
import Environment from '../environment';
+import DefintionState, { CAPABILITIES } from './definition-state';
class RootComponentManager extends CurlyComponentManager {
- create(environment: Environment, definition: CurlyComponentDefinition, args: Arguments, dynamicScope: DynamicScope) {
+ create(environment: Environment,
+ definition: DefintionState,
+ args: Arguments,
+ dynamicScope: DynamicScope) {
let component = definition.ComponentClass.create();
if (DEBUG) {
@@ -48,19 +57,16 @@ class RootComponentManager extends CurlyComponentManager {
}
}
-const ROOT_MANAGER = new RootComponentManager();
+export class RootComponentDefinition implements ComponentDefinition {
+ public state: DefintionState;
+ public manager: RootComponentManager;
-export class RootComponentDefinition extends ComponentDefinition<ComponentStateBucket> {
- public template: any;
- public args: any;
- constructor(instance: ComponentStateBucket) {
- super('-root', ROOT_MANAGER, {
- class: instance.constructor,
- create() {
- return instance;
- },
- });
- this.template = undefined;
- this.args = undefined;
+ constructor(name: string, _manager: RootComponentManager, ComponentClass: any, handle: Option<VMHandle>) {
+ this.state = {
+ name,
+ ComponentClass,
+ handle,
+ capabilities: CAPABILITIES
+ }
}
}
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/environment.ts
|
@@ -1,20 +1,22 @@
+import {
+ Simple,
+ VMHandle
+} from '@glimmer/interfaces';
+import {
+ WrappedBuilder
+} from '@glimmer/opcode-compiler';
import {
Reference,
} from '@glimmer/reference';
import {
- AttributeManager,
- CompilableLayout,
- CompiledDynamicProgram,
- compileLayout,
ComponentDefinition,
+ DynamicAttributeFactory,
Environment as GlimmerEnvironment,
getDynamicVar,
Helper,
- isSafeString,
ModifierManager,
PrimitiveReference,
PartialDefinition,
- Simple,
} from '@glimmer/runtime';
import {
Destroyable, Opaque,
@@ -33,8 +35,8 @@ import {
CurlyComponentDefinition,
} from './component-managers/curly';
import {
- populateMacros,
-} from './syntax';
+ CAPABILITIES
+} from './component-managers/definition-state';
import DebugStack from './utils/debug-stack';
import createIterable from './utils/iterable';
import {
@@ -85,7 +87,7 @@ function isTemplateFactory(template: OwnedTemplate | WrappedTemplateFactory): te
export interface CompilerFactory {
id: string;
- new (template: OwnedTemplate | undefined): CompilableLayout;
+ new (template: OwnedTemplate): any;
}
export default class Environment extends GlimmerEnvironment {
@@ -113,7 +115,7 @@ export default class Environment extends GlimmerEnvironment {
Template: WrappedTemplateFactory | OwnedTemplate;
owner: Container;
}, OwnedTemplate>;
- private _compilerCache: Cache<CompilerFactory, Cache<OwnedTemplate, CompiledDynamicProgram>>;
+ private _compilerCache: Cache<CompilerFactory, Cache<OwnedTemplate, VMHandle>>;
constructor(injections: any) {
super(injections);
@@ -136,15 +138,15 @@ export default class Environment extends GlimmerEnvironment {
customManager = owner.factoryFor<any>(`component-manager:${managerId}`).class;
}
}
- return new CurlyComponentDefinition(name, componentFactory, layout, undefined, customManager);
+ return new CurlyComponentDefinition(name, customManager, undefined, layout, customManager);
}
return undefined;
}, ({ name, source, owner }) => {
let expandedName = source && this._resolveLocalLookupName(name, source, owner) || name;
let ownerGuid = guidFor(owner);
- return ownerGuid + '|' + expandedName;
+ return `${ownerGuid}|${expandedName}`;
});
this._templateCache = new Cache(1000, ({ Template, owner }) => {
@@ -155,14 +157,14 @@ export default class Environment extends GlimmerEnvironment {
// we were provided an instance already
return Template;
}
- }, ({ Template, owner }) => guidFor(owner) + '|' + Template.id);
+ }, ({ Template, owner }) => `${guidFor(owner)}|${Template.id}`);
this._compilerCache = new Cache(10, (Compiler) => {
return new Cache(2000, (template) => {
let compilable = new Compiler(template);
- return compileLayout(compilable, this);
+ return new WrappedBuilder({asPartial: false, referrer: null}, compilable, CAPABILITIES);
}, (template) => {
- let owner = template.meta.owner;
+ let owner = template.owner;
return guidFor(owner) + '|' + template.id;
});
}, (Compiler) => Compiler.id);
@@ -208,11 +210,13 @@ export default class Environment extends GlimmerEnvironment {
: owner._resolveLocalLookupName(name, source);
}
+ /*
macros() {
let macros = super.macros();
populateMacros(macros.blocks, macros.inlines);
return macros;
}
+ */
hasComponentDefinition() {
return false;
@@ -245,13 +249,11 @@ export default class Environment extends GlimmerEnvironment {
return hasPartial(name, meta.owner);
}
- lookupPartial(name: string, meta: any): PartialDefinition<any> {
- let partial = {
- name,
- template: lookupPartial(name, meta.owner),
- };
+ lookupPartial(name: string, meta: any): PartialDefinition {
+ const template = lookupPartial(name, meta.owner);
+ const partial = new PartialDefinition( name, lookupPartial(name, meta.owner));
- if (partial.template) {
+ if (template) {
return partial;
} else {
throw new Error(`${name} is not a partial`);
@@ -355,29 +357,27 @@ export default class Environment extends GlimmerEnvironment {
}
if (DEBUG) {
- class StyleAttributeManager extends AttributeManager {
- setAttribute(dom: Environment, element: Simple.Element, value: Opaque) {
+ class StyleAttributeManager implements DynamicAttributeFactory {
+ setAttribute(_dom: Environment, _element: Simple.Element, value: Opaque) {
warn(constructStyleDeprecationMessage(value), (() => {
if (value === null || value === undefined || isSafeString(value)) {
return true;
}
return false;
})(), { id: 'ember-htmlbars.style-xss-warning' });
- super.setAttribute(dom, element, value);
}
- updateAttribute(dom: Environment, element: Element, value: Opaque) {
+ updateAttribute(_dom: Environment, _element: Element, value: Opaque) {
warn(constructStyleDeprecationMessage(value), (() => {
if (value === null || value === undefined || isSafeString(value)) {
return true;
}
return false;
})(), { id: 'ember-htmlbars.style-xss-warning' });
- super.updateAttribute(dom, element, value);
}
}
- let STYLE_ATTRIBUTE_MANANGER = new StyleAttributeManager('style');
+ let STYLE_ATTRIBUTE_MANANGER = new StyleAttributeManager();
Environment.prototype.attributeFor = function(element, attribute, isTrusting) {
if (attribute === 'style' && !isTrusting) {
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/helpers/component.ts
|
@@ -4,7 +4,6 @@
import {
Arguments,
Environment,
- isComponentDefinition,
VM
} from '@glimmer/runtime';
import { assert } from 'ember-debug';
@@ -217,7 +216,9 @@ function createCurriedDefinition(definition: CurlyComponentDefinition, args: Arg
return new CurlyComponentDefinition(
definition.name,
+ definition.manager,
definition.ComponentClass,
+ definition.state.handle,
definition.template,
curriedArgs,
);
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/helpers/concat.ts
|
@@ -1,7 +1,6 @@
import {
Arguments,
CapturedArguments,
- normalizeTextValue,
VM
} from '@glimmer/runtime';
import { InternalHelperReference } from '../utils/references';
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/modifiers/action.ts
|
@@ -1,11 +1,19 @@
+import {
+ Simple
+} from '@glimmer/interfaces';
+import {
+ TagWrapper
+} from '@glimmer/reference';
import {
Arguments,
CapturedNamedArguments,
CapturedPositionalArguments,
DynamicScope,
- Simple
+ ModifierManager,
} from '@glimmer/runtime';
-import { Destroyable } from '@glimmer/util';
+import {
+ Destroyable
+} from '@glimmer/util';
import { assert } from 'ember-debug';
import { flaggedInstrument, run } from 'ember-metal';
import { uuid } from 'ember-utils';
@@ -172,7 +180,7 @@ export class ActionState {
}
// implements ModifierManager<Action>
-export default class ActionModifierManager {
+export default class ActionModifierManager implements ModifierManager<ActionState> {
create(element: Simple.Element, args: Arguments, _dynamicScope: DynamicScope, dom: any) {
let { named, positional } = args.capture();
let implicitTarget;
@@ -238,6 +246,11 @@ export default class ActionModifierManager {
actionState.eventName = actionState.getEventName();
}
+ getTag() {
+ // TODO: ModifierManager needs a getTag method. Where does this tag come from?
+ return new TagWrapper();
+ }
+
getDestructor(modifier: Destroyable) {
return modifier;
}
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/syntax/mount.ts
|
@@ -113,6 +113,7 @@ class DynamicEngineReference {
}
this._lastName = nameOrDef;
+ // TODO: maybe I've got the MountDefinition constructor wrong...
this._lastDef = new MountDefinition(nameOrDef);
return this._lastDef;
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/template.ts
|
@@ -25,8 +25,6 @@ export class WrappedTemplateFactory {
constructor(public factory: TemplateFactory<{
moduleName: string;
- }, {
- owner: Container;
}>) {
this.id = factory.id;
this.meta = factory.meta;
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
packages/ember-glimmer/lib/utils/bindings.ts
|
@@ -1,15 +1,17 @@
-import { Opaque, Option } from '@glimmer/interfaces';
+import {
+ Opaque,
+ Option,
+ Simple
+} from '@glimmer/interfaces';
import {
CachedReference,
combine,
map,
Reference,
- referenceFromParts,
Tag,
} from '@glimmer/reference';
import {
- ElementOperations,
- Simple
+ ElementOperations
} from '@glimmer/runtime';
import {
Ops,
@@ -80,15 +82,16 @@ export const AttributeBinding = {
}
},
- install(element: Simple.Element, component: Component, parsed: [string, string, boolean], operations: ElementOperations) {
+ install(_element: Simple.Element, component: Component, parsed: [string, string, boolean], operations: ElementOperations) {
let [prop, attribute, isSimple] = parsed;
if (attribute === 'id') {
let elementId = get(component, prop);
if (elementId === undefined || elementId === null) {
elementId = component.elementId;
}
- operations.addStaticAttribute(element, 'id', elementId);
+ operations.setAttribute('id', elementId, true, null);
+ // operations.addStaticAttribute(element, 'id', elementId);
return;
}
@@ -101,7 +104,8 @@ export const AttributeBinding = {
reference = new StyleBindingReference(reference, referenceForKey(component, 'isVisible'));
}
- operations.addDynamicAttribute(element, attribute, reference, false);
+ operations.setAttribute(attribute, reference, false, null);
+ // operations.addDynamicAttribute(element, attribute, reference, false);
},
};
@@ -132,8 +136,14 @@ class StyleBindingReference extends CachedReference<string | SafeString> {
}
export const IsVisibleBinding = {
- install(element: Simple.Element, component: Component, operations: ElementOperations) {
- operations.addDynamicAttribute(element, 'style', map(referenceForKey(component, 'isVisible'), this.mapStyleValue), false);
+ install(_element: Simple.Element, component: Component, operations: ElementOperations) {
+ operations.setAttribute(
+ 'style',
+ map(referenceForKey(component, 'isVisible'), this.mapStyleValue),
+ false,
+ null
+ );
+ // operations.addDynamicAttribute(element, 'style', map(referenceForKey(component, 'isVisible'), this.mapStyleValue), false);
},
mapStyleValue(isVisible: boolean) {
@@ -142,12 +152,13 @@ export const IsVisibleBinding = {
};
export const ClassNameBinding = {
- install(element: Simple.Element, component: Component, microsyntax: string, operations: ElementOperations) {
+ install(_element: Simple.Element, component: Component, microsyntax: string, operations: ElementOperations) {
let [ prop, truthy, falsy ] = microsyntax.split(':');
let isStatic = prop === '';
if (isStatic) {
- operations.addStaticAttribute(element, 'class', truthy);
+ operations.setAttribute('class', truthy, true, null);
+ // operations.addStaticAttribute(element, 'class', truthy);
} else {
let isPath = prop.indexOf('.') > -1;
let parts = isPath ? prop.split('.') : [];
@@ -160,7 +171,8 @@ export const ClassNameBinding = {
ref = new ColonClassNameBindingReference(value, truthy, falsy);
}
- operations.addDynamicAttribute(element, 'class', ref, false);
+ operations.setAttribute('class', ref, false, null);
+ // operations.addDynamicAttribute(element, 'class', ref, false);
}
},
};
| true |
Other
|
emberjs
|
ember.js
|
32b79662675b2a1ba0db836f72fd8fb5f433be85.json
|
WIP: Upgrade glimmer-vm to 0.29.10
There is much left to do here. This is just the first pass, where I have
done nothing but try to clear out the errors caused by the upgrade. Not
all of the errors are cleared yet, largely because several exports from
glimmer-vm have been removed and I don't know how to replace them (help
wanted). Below is a list of the needed changes and problems I have
encountered in the upgrade process.
UPGRADE NOTES (starting at glimmer-vm 0.25.6)
* Simple is now in @glimmer/interfaces
* ComponentManager.getSelf cannot return null (returns RootReference?)
* ComponentManager.getTag returns ComponentStateBucket.tag (: Tag)
* Some code moved from ComponentManager.update to
* ComponentManager.didUpdate
* ComponentManager<ComponentStateBucket> -->
* ComponentManager<ComponentStateBucket, ComponentDefinition>
* ComponentManager.create signature changed
* ComponentStateBucket's defintion is now DefinitionState instead of
* ComponentDefinition
* ComponentManager.prepareArgs signature changed
* ComponentManager.getCapabilities is new
* CompiledDynamicTemplate is gone (no longer in runtime, anyway) see
* https://github.com/glimmerjs/glimmer-vm/commit/79f2b4521f5a7d48d04e3fd34e224ddf5bc4c241#diff-d561208b0ad153d9273c2188e16c7442
* Must implicitly include @glimmer/vm and @glimmer/opcode-compiler and
* @glimmer/encoder in ember-cli-build.js
* compileLayout -> scanLayout -> prepareLayout -> new WrappedBuilder
* isSafeString is no longer exported publicly. Is that intentional?
* normalizeTextValue is no longer exported publicly. Is that
* intentional?
* isComponentDefinition is gone, kind of replaced by
* `isCurriedComponentDefinition`. Neither is exported.
* getComponentDefintion is no longer part of Environment.
* referenceFromParts has been removed.
* f3444e9ae0c7751047bdcd856e61344bfb548e12
* readDOMAttr has been removed. 316805b9175e01698120b9566ec51c88d075026a
|
yarn.lock
|
@@ -2,78 +2,117 @@
# yarn lockfile v1
-"@glimmer/compiler@^0.25.6":
- version "0.25.6"
- resolved "https://registry.yarnpkg.com/@glimmer/compiler/-/compiler-0.25.6.tgz#dcc2b8bfa6f36b70c34e41e85626f888315d3ad7"
- dependencies:
- "@glimmer/interfaces" "^0.25.6"
- "@glimmer/syntax" "^0.25.6"
- "@glimmer/util" "^0.25.6"
- "@glimmer/wire-format" "^0.25.6"
- simple-html-tokenizer "^0.3.0"
-
-"@glimmer/interfaces@^0.25.6":
- version "0.25.6"
- resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.25.6.tgz#88a6cdb4f414c3a82662cc5fc5cb5bfd91d4ef10"
- dependencies:
- "@glimmer/wire-format" "^0.25.6"
-
-"@glimmer/node@^0.25.6":
- version "0.25.6"
- resolved "https://registry.yarnpkg.com/@glimmer/node/-/node-0.25.6.tgz#3887a79d8fd2cf9376511245babe87647e4349df"
- dependencies:
- "@glimmer/runtime" "^0.25.6"
+"@glimmer/compiler@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/compiler/-/compiler-0.29.10.tgz#b0a3d53069605d78fdf1bf1bc3be28ae81402342"
+ dependencies:
+ "@glimmer/interfaces" "^0.29.10"
+ "@glimmer/syntax" "^0.29.10"
+ "@glimmer/util" "^0.29.10"
+ "@glimmer/wire-format" "^0.29.10"
+ simple-html-tokenizer "^0.4.1"
+
+"@glimmer/encoder@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/encoder/-/encoder-0.29.10.tgz#a49c61a0794d2e1b218ec0a563d0f84dca08334c"
+
+"@glimmer/interfaces@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.29.10.tgz#7744451ca329a42c62b08fa460808bccbddeb2ab"
+ dependencies:
+ "@glimmer/wire-format" "^0.29.10"
+
+"@glimmer/node@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/node/-/node-0.29.10.tgz#ba8a5cb45784a46bbb50c454c56d2188b82d97ab"
+ dependencies:
+ "@glimmer/compiler" "^0.29.10"
+ "@glimmer/interfaces" "^0.29.10"
+ "@glimmer/object-reference" "^0.29.10"
+ "@glimmer/runtime" "^0.29.10"
simple-dom "^0.3.0"
-"@glimmer/object-reference@^0.25.6":
- version "0.25.6"
- resolved "https://registry.yarnpkg.com/@glimmer/object-reference/-/object-reference-0.25.6.tgz#ab45f51c9416bdaff402a0ea3cedd3b1807b1158"
- dependencies:
- "@glimmer/reference" "^0.25.6"
- "@glimmer/util" "^0.25.6"
-
-"@glimmer/object@^0.25.6":
- version "0.25.6"
- resolved "https://registry.yarnpkg.com/@glimmer/object/-/object-0.25.6.tgz#a07860e551980488c2839c6393f7a2c071d68a6e"
- dependencies:
- "@glimmer/object-reference" "^0.25.6"
- "@glimmer/util" "^0.25.6"
-
-"@glimmer/reference@^0.25.6":
- version "0.25.6"
- resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.25.6.tgz#bc57ccc351fc4bcc5750bdb7760cec4b9ef628f4"
- dependencies:
- "@glimmer/util" "^0.25.6"
+"@glimmer/object-reference@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/object-reference/-/object-reference-0.29.10.tgz#9e0acc15779611d306b66819088b0aee2cf06a48"
+ dependencies:
+ "@glimmer/reference" "^0.29.10"
+ "@glimmer/util" "^0.29.10"
+
+"@glimmer/object@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/object/-/object-0.29.10.tgz#ce450757598274e476f73f61a3a36a26f81642e5"
+ dependencies:
+ "@glimmer/object-reference" "^0.29.10"
+ "@glimmer/util" "^0.29.10"
+
+"@glimmer/opcode-compiler@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/opcode-compiler/-/opcode-compiler-0.29.10.tgz#37bb4413e614e442c908d2a38725c9358e4c7e45"
+ dependencies:
+ "@glimmer/encoder" "^0.29.10"
+ "@glimmer/interfaces" "^0.29.10"
+ "@glimmer/program" "^0.29.10"
+ "@glimmer/syntax" "^0.29.10"
+ "@glimmer/util" "^0.29.10"
+ "@glimmer/vm" "^0.29.10"
+ "@glimmer/wire-format" "^0.29.10"
+ simple-html-tokenizer "^0.4.1"
+
+"@glimmer/program@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/program/-/program-0.29.10.tgz#c9a2facda2812b6314f3f7f2153cd51f5e51bfba"
+ dependencies:
+ "@glimmer/encoder" "^0.29.10"
+ "@glimmer/interfaces" "^0.29.10"
+ "@glimmer/util" "^0.29.10"
+
+"@glimmer/reference@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.29.10.tgz#fc5db84f5b2a9aeef28e1407a54679cf5817acab"
+ dependencies:
+ "@glimmer/util" "^0.29.10"
+
+"@glimmer/runtime@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/runtime/-/runtime-0.29.10.tgz#90dce95aa6b596ff1134a11de1c77f50110c38b9"
+ dependencies:
+ "@glimmer/interfaces" "^0.29.10"
+ "@glimmer/object" "^0.29.10"
+ "@glimmer/object-reference" "^0.29.10"
+ "@glimmer/opcode-compiler" "^0.29.10"
+ "@glimmer/program" "^0.29.10"
+ "@glimmer/reference" "^0.29.10"
+ "@glimmer/util" "^0.29.10"
+ "@glimmer/vm" "^0.29.10"
+ "@glimmer/wire-format" "^0.29.10"
+
+"@glimmer/syntax@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.29.10.tgz#2a074223fc3b42d49c8b9345684a80b5133dc030"
+ dependencies:
+ "@glimmer/interfaces" "^0.29.10"
+ "@glimmer/util" "^0.29.10"
+ handlebars "^4.0.6"
+ simple-html-tokenizer "^0.4.1"
-"@glimmer/runtime@^0.25.6":
- version "0.25.6"
- resolved "https://registry.yarnpkg.com/@glimmer/runtime/-/runtime-0.25.6.tgz#2a776dcdd3b8f844e1f6b4e7ca4478b6dc560133"
- dependencies:
- "@glimmer/interfaces" "^0.25.6"
- "@glimmer/object" "^0.25.6"
- "@glimmer/object-reference" "^0.25.6"
- "@glimmer/reference" "^0.25.6"
- "@glimmer/util" "^0.25.6"
- "@glimmer/wire-format" "^0.25.6"
+"@glimmer/util@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.29.10.tgz#8662daf273ffef9254b8d943d39aa396ed7225a5"
-"@glimmer/syntax@^0.25.6":
- version "0.25.6"
- resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.25.6.tgz#aeed43004ece8715d09189b61037c793225b4e88"
+"@glimmer/vm@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/vm/-/vm-0.29.10.tgz#e723ea7d23960dd470cc73ec31e02fd74cab2cd8"
dependencies:
- "@glimmer/interfaces" "^0.25.6"
- "@glimmer/util" "^0.25.6"
- handlebars "^4.0.6"
- simple-html-tokenizer "^0.3.0"
-
-"@glimmer/util@^0.25.6":
- version "0.25.6"
- resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.25.6.tgz#de8dde7f5d30f9c0e3e2f083e3f6d3426a92b302"
+ "@glimmer/interfaces" "^0.29.10"
+ "@glimmer/program" "^0.29.10"
+ "@glimmer/util" "^0.29.10"
-"@glimmer/wire-format@^0.25.6":
- version "0.25.6"
- resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.25.6.tgz#f0543801d234e133bf72d2bdec68dd2c36c06eca"
+"@glimmer/wire-format@^0.29.10":
+ version "0.29.10"
+ resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.29.10.tgz#90e82f67a6325468d6fee4f8dd7affc1070a9557"
dependencies:
- "@glimmer/util" "^0.25.6"
+ "@glimmer/util" "^0.29.10"
abbrev@1:
version "1.1.0"
@@ -5580,10 +5619,6 @@ simple-fmt@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/simple-fmt/-/simple-fmt-0.1.0.tgz#191bf566a59e6530482cb25ab53b4a8dc85c3a6b"
-simple-html-tokenizer@^0.3.0:
- version "0.3.0"
- resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.3.0.tgz#9b8b5559d80e331a544dd13dd59382e5d0d94411"
-
simple-html-tokenizer@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.4.1.tgz#028988bb7fe8b2e6645676d82052587d440b02d3"
| true |
Other
|
emberjs
|
ember.js
|
c432844ce4666d9a0813e026d22a85ccc0541d37.json
|
Add 2.17.0-beta.4 to CHANGELOG
[ci skip]
(cherry picked from commit 96671cbe447b091968120780a29425d5acd055fb)
|
CHANGELOG.md
|
@@ -1,5 +1,9 @@
# Ember Changelog
+### 2.17.0-beta.4 (October 30, 2017)
+- [#15746](https://github.com/emberjs/ember.js/pull/15746) [BUGFIX] Fix computed sort regression when array property is initally `null`.
+- [#15777](https://github.com/emberjs/ember.js/pull/15777) [BUGFIX] Fix various issues around accessing dynamic data within a partial.
+
### 2.17.0-beta.3 (October 23, 2017)
- [#15606](https://github.com/emberjs/ember.js/pull/15606) [BUGFIX] Add fs-extra to deps
- [#15697](https://github.com/emberjs/ember.js/pull/15697) [BUGFIX] Move accessing meta out of the loop
| false |
Other
|
emberjs
|
ember.js
|
53bfb16e72f0493f4ab6d4c73f6296b271527209.json
|
run node-tests through eslint
|
node-tests/.eslintrc.js
|
@@ -0,0 +1,9 @@
+module.exports = {
+ env: {
+ mocha: true,
+ node: true,
+ },
+ rules: {
+ 'semi': 'error',
+ },
+};
| true |
Other
|
emberjs
|
ember.js
|
53bfb16e72f0493f4ab6d4c73f6296b271527209.json
|
run node-tests through eslint
|
node-tests/blueprints/component-test.js
|
@@ -263,10 +263,8 @@ describe('Acceptance: ember generate component', function() {
.to.contain("integration: true");
}));
});
- /**
- * Pod tests
- *
- */
+
+ // Pod tests
it('component x-foo --pod', function() {
var args = ['component', 'x-foo', '--pod'];
@@ -751,7 +749,7 @@ describe('Acceptance: ember generate component', function() {
.to.contain("{{#x-foo}}");
}));
});
- })
+ });
it('component-test x-foo --unit', function() {
var args = ['component-test', 'x-foo', '--unit'];
| true |
Other
|
emberjs
|
ember.js
|
53bfb16e72f0493f4ab6d4c73f6296b271527209.json
|
run node-tests through eslint
|
package.json
|
@@ -34,7 +34,7 @@
"start": "ember serve",
"pretest": "ember build",
"prepare": "ember build -prod",
- "lint": "tslint -p tsconfig.json",
+ "lint": "tslint -p tsconfig.json && eslint node-tests",
"test": "node bin/run-tests.js",
"test:blueprints": "node node-tests/nodetest-runner.js",
"test:node": "node bin/run-node-tests.js",
@@ -84,8 +84,8 @@
"broccoli-debug": "^0.6.3",
"broccoli-file-creator": "^1.1.1",
"broccoli-lint-eslint": "^3.2.1",
- "broccoli-source": "^1.1.0",
"broccoli-rollup": "^1.3.0",
+ "broccoli-source": "^1.1.0",
"broccoli-string-replace": "^0.1.2",
"broccoli-typescript-compiler": "^2.0.1",
"broccoli-uglify-js": "^0.2.0",
@@ -100,6 +100,7 @@
"ember-cli-yuidoc": "^0.8.8",
"ember-dev": "github:emberjs/ember-dev#eace534",
"ember-publisher": "0.0.7",
+ "eslint": "^3.0.0",
"eslint-plugin-ember-internal": "^1.1.0",
"express": "^4.15.2",
"finalhandler": "^1.0.2",
| true |
Other
|
emberjs
|
ember.js
|
5b30f6ebfc2392603cdf0b225d112b2f4f26cc98.json
|
remove unused requires in eslint config
|
.eslintrc.js
|
@@ -1,7 +1,4 @@
-var fs = require('fs');
-var path = require('path');
-
-var options = {
+module.exports = {
root: true,
parserOptions: {
ecmaVersion: 6,
@@ -43,5 +40,3 @@ var options = {
'comma-dangle': 'off',
},
};
-
-module.exports = options;
| false |
Other
|
emberjs
|
ember.js
|
896ce04ed0797a503672db0a5c56d28e7b4074ad.json
|
use fixture for helper-addon blueprint test
|
node-tests/blueprints/helper-test.js
|
@@ -53,7 +53,7 @@ describe('Acceptance: ember generate and destroy helper', function() {
expect(_file('addon/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
expect(_file('app/helpers/foo/bar-baz.js'))
- .to.contain("export { default, fooBarBaz } from 'my-addon/helpers/foo/bar-baz';");
+ .to.equal(file('helper-addon.js'));
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
}));
@@ -67,7 +67,7 @@ describe('Acceptance: ember generate and destroy helper', function() {
expect(_file('addon/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
expect(_file('app/helpers/foo/bar-baz.js'))
- .to.contain("export { default, fooBarBaz } from 'my-addon/helpers/foo/bar-baz';");
+ .to.equal(file('helper-addon.js'));
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
}));
@@ -95,7 +95,7 @@ describe('Acceptance: ember generate and destroy helper', function() {
expect(_file('lib/my-addon/addon/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
expect(_file('lib/my-addon/app/helpers/foo/bar-baz.js'))
- .to.contain("export { default, fooBarBaz } from 'my-addon/helpers/foo/bar-baz';");
+ .to.equal(file('helper-addon.js'));
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
}));
@@ -109,7 +109,7 @@ describe('Acceptance: ember generate and destroy helper', function() {
expect(_file('lib/my-addon/addon/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
expect(_file('lib/my-addon/app/helpers/foo/bar-baz.js'))
- .to.contain("export { default, fooBarBaz } from 'my-addon/helpers/foo/bar-baz';");
+ .to.equal(file('helper-addon.js'));
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
}));
| true |
Other
|
emberjs
|
ember.js
|
896ce04ed0797a503672db0a5c56d28e7b4074ad.json
|
use fixture for helper-addon blueprint test
|
node-tests/fixtures/helper-addon.js
|
@@ -0,0 +1 @@
+export { default, fooBarBaz } from 'my-addon/helpers/foo/bar-baz';
| true |
Other
|
emberjs
|
ember.js
|
b8914d1217ae89df13402e6973395a0c8479048b.json
|
fix newlines in integration helper test blueprint
|
blueprints/helper-test/qunit-files/tests/__testType__/helpers/__name__-test.js
|
@@ -1,5 +1,4 @@
-<% if (testType == 'integration') { %>
-import { moduleForComponent, test } from 'ember-qunit';
+<% if (testType == 'integration') { %>import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('<%= dasherizedModuleName %>', 'helper:<%= dasherizedModuleName %>', {
@@ -13,8 +12,7 @@ test('it renders', function(assert) {
this.render(hbs`{{<%= dasherizedModuleName %> inputValue}}`);
assert.equal(this.$().text().trim(), '1234');
-});
-<% } else if (testType == 'unit') { %>
+});<% } else if (testType == 'unit') { %>
import { <%= camelizedModuleName %> } from '<%= dasherizedModulePrefix %>/helpers/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';
| true |
Other
|
emberjs
|
ember.js
|
b8914d1217ae89df13402e6973395a0c8479048b.json
|
fix newlines in integration helper test blueprint
|
node-tests/fixtures/helper-test/integration.js
|
@@ -1,4 +1,3 @@
-
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
@@ -14,4 +13,3 @@ test('it renders', function(assert) {
assert.equal(this.$().text().trim(), '1234');
});
-
| true |
Other
|
emberjs
|
ember.js
|
cb8dc6c82bde289f4339d65c0c0a53ddf1a233ca.json
|
add test coverage of helper unit test
will fix new line issues in followup
|
node-tests/blueprints/helper-test.js
|
@@ -33,6 +33,23 @@ describe('Acceptance: ember generate and destroy helper', function() {
}));
});
+ it('helper foo/bar-baz unit', function() {
+ var args = ['helper', '--test-type=unit', 'foo/bar-baz'];
+
+ return emberNew()
+ .then(() => emberGenerateDestroy(args, _file => {
+ expect(_file('app/helpers/foo/bar-baz.js'))
+ .to.contain("import { helper } from '@ember/component/helper';\n\n" +
+ "export function fooBarBaz(params/*, hash*/) {\n" +
+ " return params;\n" +
+ "}\n\n" +
+ "export default helper(fooBarBaz);");
+
+ expect(_file('tests/unit/helpers/foo/bar-baz-test.js'))
+ .to.equal(file('helper-test/unit.js'));
+ }));
+ });
+
it('in-addon helper foo/bar-baz', function() {
var args = ['helper', 'foo/bar-baz'];
| true |
Other
|
emberjs
|
ember.js
|
cb8dc6c82bde289f4339d65c0c0a53ddf1a233ca.json
|
add test coverage of helper unit test
will fix new line issues in followup
|
node-tests/fixtures/helper-test/unit.js
|
@@ -0,0 +1,12 @@
+
+import { fooBarBaz } from 'my-app/helpers/foo/bar-baz';
+import { module, test } from 'qunit';
+
+module('Unit | Helper | foo/bar baz');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ let result = fooBarBaz([42]);
+ assert.ok(result);
+});
+
| true |
Other
|
emberjs
|
ember.js
|
d90545005d1cae84705bb0f2635ab0c10b106e8a.json
|
Add CHANGELOG for 2.16.2.
[ci skip]
(cherry picked from commit 7538da2cd04157d4a513509e71a830e9c6672d69)
(cherry picked from commit 09a5fe326961bf0a21c2852402ec11b8034f279a)
|
CHANGELOG.md
|
@@ -16,6 +16,10 @@
- [#15265](https://github.com/emberjs/ember.js/pull/15265) [BUGFIX] fixed issue when passing `false` to `activeClass` for `{{link-to}}`
- [#15672](https://github.com/emberjs/ember.js/pull/15672) Update router_js to 2.0.0.
+### 2.16.2 (November 1, 2017)
+
+- [#15797](https://github.com/emberjs/ember.js/pull/15797) [BUGFIX] Fix issues with using partials nested within other partials.
+
### 2.16.1 (October 29, 2017)
- [#15722](https://github.com/emberjs/ember.js/pull/15722) [BUGFIX] Avoid assertion when using `(get` helper with empty paths.
| false |
Other
|
emberjs
|
ember.js
|
19bbc77f82140140975610727be11293ccd21c7c.json
|
Remove duplicate dependency
|
package.json
|
@@ -41,7 +41,6 @@
"test:testem": "testem -f testem.dist.json"
},
"dependencies": {
- "broccoli-funnel": "^1.2.0",
"broccoli-funnel": "^2.0.1",
"broccoli-merge-trees": "^2.0.0",
"ember-cli-get-component-path-option": "^1.0.0",
| false |
Other
|
emberjs
|
ember.js
|
3e5d79be58a34bbcc0d441f59c1f77dadf8efb9f.json
|
remove unused babel plugins
|
package.json
|
@@ -66,8 +66,6 @@
"aws-sdk": "^2.46.0",
"babel-plugin-check-es2015-constants": "^6.22.0",
"babel-plugin-debug-macros": "^0.1.10",
- "babel-plugin-feature-flags": "^0.3.1",
- "babel-plugin-filter-imports": "^0.3.1",
"babel-plugin-minify-dead-code-elimination": "^0.2.0",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoping": "^6.24.1",
| true |
Other
|
emberjs
|
ember.js
|
3e5d79be58a34bbcc0d441f59c1f77dadf8efb9f.json
|
remove unused babel plugins
|
yarn.lock
|
@@ -646,14 +646,6 @@ babel-plugin-eval@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/babel-plugin-eval/-/babel-plugin-eval-1.0.1.tgz#a2faed25ce6be69ade4bfec263f70169195950da"
-babel-plugin-feature-flags@^0.3.1:
- version "0.3.1"
- resolved "https://registry.yarnpkg.com/babel-plugin-feature-flags/-/babel-plugin-feature-flags-0.3.1.tgz#9c827cf9a4eb9a19f725ccb239e85cab02036fc1"
-
-babel-plugin-filter-imports@^0.3.1:
- version "0.3.1"
- resolved "https://registry.yarnpkg.com/babel-plugin-filter-imports/-/babel-plugin-filter-imports-0.3.1.tgz#e7859b56886b175dd2616425d277b219e209ea8b"
-
babel-plugin-inline-environment-variables@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/babel-plugin-inline-environment-variables/-/babel-plugin-inline-environment-variables-1.0.1.tgz#1f58ce91207ad6a826a8bf645fafe68ff5fe3ffe"
@@ -1879,7 +1871,7 @@ crc@^3.4.4:
version "3.4.4"
resolved "https://registry.yarnpkg.com/crc/-/crc-3.4.4.tgz#9da1e980e3bd44fc5c93bf5ab3da3378d85e466b"
-cross-spawn@^5.0.0, cross-spawn@^5.1.0:
+cross-spawn@^5.0.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
dependencies:
@@ -4159,10 +4151,6 @@ lodash.uniq@^4.2.0, lodash.uniq@^4.5.0, lodash.uniq@~4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
-lodash.uniqby@^4.7.0:
- version "4.7.0"
- resolved "https://registry.yarnpkg.com/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz#d99c07a669e9e6d24e1362dfe266c67616af1302"
-
lodash.without@~4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac"
@@ -5074,7 +5062,7 @@ read@1, read@~1.0.1, read@~1.0.7:
dependencies:
mute-stream "~0.0.4"
-"readable-stream@1 || 2", readable-stream@^2, readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.2.2:
+"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.2.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c"
dependencies:
@@ -5086,6 +5074,18 @@ read@1, read@~1.0.1, read@~1.0.7:
string_decoder "~1.0.3"
util-deprecate "~1.0.1"
+readable-stream@^2, readable-stream@~2.1.5:
+ version "2.1.5"
+ resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0"
+ dependencies:
+ buffer-shims "^1.0.0"
+ core-util-is "~1.0.0"
+ inherits "~2.0.1"
+ isarray "~1.0.0"
+ process-nextick-args "~1.0.6"
+ string_decoder "~0.10.x"
+ util-deprecate "~1.0.1"
+
readable-stream@~1.0.2:
version "1.0.34"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"
@@ -5106,18 +5106,6 @@ readable-stream@~2.0.5:
string_decoder "~0.10.x"
util-deprecate "~1.0.1"
-readable-stream@~2.1.5:
- version "2.1.5"
- resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0"
- dependencies:
- buffer-shims "^1.0.0"
- core-util-is "~1.0.0"
- inherits "~2.0.1"
- isarray "~1.0.0"
- process-nextick-args "~1.0.6"
- string_decoder "~0.10.x"
- util-deprecate "~1.0.1"
-
readdir-scoped-modules@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747"
@@ -5944,7 +5932,7 @@ [email protected]:
os-tmpdir "^1.0.0"
rimraf "~2.2.6"
[email protected]:
[email protected], testem@^1.8.1:
version "1.15.0"
resolved "https://registry.yarnpkg.com/testem/-/testem-1.15.0.tgz#2e3a9e7ac29f16a20f718eb0c4b12e7a44900675"
dependencies:
@@ -5974,37 +5962,6 @@ [email protected]:
tap-parser "^5.1.0"
xmldom "^0.1.19"
-testem@^1.8.1:
- version "1.18.4"
- resolved "https://registry.yarnpkg.com/testem/-/testem-1.18.4.tgz#e45fed922bec2f54a616c43f11922598ac97eb41"
- dependencies:
- backbone "^1.1.2"
- bluebird "^3.4.6"
- charm "^1.0.0"
- commander "^2.6.0"
- consolidate "^0.14.0"
- cross-spawn "^5.1.0"
- express "^4.10.7"
- fireworm "^0.7.0"
- glob "^7.0.4"
- http-proxy "^1.13.1"
- js-yaml "^3.2.5"
- lodash.assignin "^4.1.0"
- lodash.clonedeep "^4.4.1"
- lodash.find "^4.5.1"
- lodash.uniqby "^4.7.0"
- mkdirp "^0.5.1"
- mustache "^2.2.1"
- node-notifier "^5.0.1"
- npmlog "^4.0.0"
- printf "^0.2.3"
- rimraf "^2.4.4"
- socket.io "1.6.0"
- spawn-args "^0.2.0"
- styled_string "0.0.1"
- tap-parser "^5.1.0"
- xmldom "^0.1.19"
-
text-table@~0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
| true |
Other
|
emberjs
|
ember.js
|
8032640f5e51ffd3692dd68cd64b86f915275186.json
|
fix lint warnings
|
packages/ember-glimmer/lib/components/link-to.ts
|
@@ -311,8 +311,6 @@
@public
*/
-import Logger from 'ember-console';
-import { assert, deprecate } from 'ember-debug';
import { DEBUG } from 'ember-env-flags';
import { assert, deprecate, warn } from 'ember-debug';
import {
@@ -655,7 +653,7 @@ const LinkComponent = EmberComponent.extend({
if (get(this, 'loading')) {
// tslint:disable-next-line:max-line-length
- warn('This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.');
+ warn('This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.', false);
return false;
}
| false |
Other
|
emberjs
|
ember.js
|
8f3ec0523780e799751656842aff3265e4c7c23a.json
|
Add 2.16.1 to CHANGELOG.
[ci skip]
|
CHANGELOG.md
|
@@ -16,6 +16,13 @@
- [#15265](https://github.com/emberjs/ember.js/pull/15265) [BUGFIX] fixed issue when passing `false` to `activeClass` for `{{link-to}}`
- [#15672](https://github.com/emberjs/ember.js/pull/15672) Update router_js to 2.0.0.
+### 2.16.1 (October 29, 2017)
+
+- [#15722](https://github.com/emberjs/ember.js/pull/15722) [BUGFIX] Avoid assertion when using `(get` helper with empty paths.
+- [#15746](https://github.com/emberjs/ember.js/pull/15746) [BUGFIX] Fix computed sort regression when array property is initally `null`.
+- [#15613](https://github.com/emberjs/ember.js/pull/15613) [BUGFIX] Prevent an error from being thrown when partial set of query params are passed to the router service.
+- [#15777](https://github.com/emberjs/ember.js/pull/15777) [BUGFIX] Fix various issues around accessing dynamic data within a partial.
+
### 2.16.0 (October 9, 2017)
- [#15604](https://github.com/emberjs/ember.js/pull/15604) Data Adapter: Only trigger model type update if the record live array count actually changed
| false |
Other
|
emberjs
|
ember.js
|
a8a8059de482d6f636b99d1d1c82c5341a4da684.json
|
avoid bool coercion in `Registry`
|
packages/container/lib/registry.js
|
@@ -223,7 +223,7 @@ export default class Registry {
resolve(fullName, options) {
assert('fullName must be a proper full name', this.validateFullName(fullName));
let factory = resolve(this, this.normalize(fullName), options);
- if (factory === undefined && this.fallback) {
+ if (factory === undefined && this.fallback !== null) {
factory = this.fallback.resolve(...arguments);
}
return factory;
@@ -243,9 +243,9 @@ export default class Registry {
@return {string} described fullName
*/
describe(fullName) {
- if (this.resolver && this.resolver.lookupDescription) {
+ if (this.resolver !== null && this.resolver.lookupDescription) {
return this.resolver.lookupDescription(fullName);
- } else if (this.fallback) {
+ } else if (this.fallback !== null) {
return this.fallback.describe(fullName);
} else {
return fullName;
@@ -261,9 +261,9 @@ export default class Registry {
@return {string} normalized fullName
*/
normalizeFullName(fullName) {
- if (this.resolver && this.resolver.normalize) {
+ if (this.resolver !== null && this.resolver.normalize) {
return this.resolver.normalize(fullName);
- } else if (this.fallback) {
+ } else if (this.fallback !== null) {
return this.fallback.normalizeFullName(fullName);
} else {
return fullName;
@@ -293,9 +293,9 @@ export default class Registry {
@return {function} toString function
*/
makeToString(factory, fullName) {
- if (this.resolver && this.resolver.makeToString) {
+ if (this.resolver !== null && this.resolver.makeToString) {
return this.resolver.makeToString(factory, fullName);
- } else if (this.fallback) {
+ } else if (this.fallback !== null) {
return this.fallback.makeToString(factory, fullName);
} else {
return factory.toString();
@@ -358,7 +358,7 @@ export default class Registry {
getOptionsForType(type) {
let optionsForType = this._typeOptions[type];
- if (optionsForType === undefined && this.fallback) {
+ if (optionsForType === undefined && this.fallback !== null) {
optionsForType = this.fallback.getOptionsForType(type);
}
return optionsForType;
@@ -379,7 +379,7 @@ export default class Registry {
let normalizedName = this.normalize(fullName);
let options = this._options[normalizedName];
- if (options === undefined && this.fallback) {
+ if (options === undefined && this.fallback !== null) {
options = this.fallback.getOptions(fullName);
}
return options;
@@ -397,7 +397,7 @@ export default class Registry {
if (options && options[optionName] !== undefined) {
return options[optionName];
- } else if (this.fallback) {
+ } else if (this.fallback !== null) {
return this.fallback.getOption(fullName, optionName);
}
}
@@ -534,11 +534,11 @@ export default class Registry {
}
}
- if (this.fallback) {
+ if (this.fallback !== null) {
fallbackKnown = this.fallback.knownForType(type);
}
- if (this.resolver && this.resolver.knownForType) {
+ if (this.resolver !== null && this.resolver.knownForType) {
resolverKnown = this.resolver.knownForType(type);
}
@@ -559,15 +559,15 @@ export default class Registry {
getInjections(fullName) {
let injections = this._injections[fullName] || [];
- if (this.fallback) {
+ if (this.fallback !== null) {
injections = injections.concat(this.fallback.getInjections(fullName));
}
return injections;
}
getTypeInjections(type) {
let injections = this._typeInjections[type] || [];
- if (this.fallback) {
+ if (this.fallback !== null) {
injections = injections.concat(this.fallback.getTypeInjections(type));
}
return injections;
@@ -600,7 +600,7 @@ export default class Registry {
@return {String} fullName
*/
expandLocalLookup(fullName, options) {
- if (this.resolver && this.resolver.expandLocalLookup) {
+ if (this.resolver !== null && this.resolver.expandLocalLookup) {
assert('fullName must be a proper full name', this.validateFullName(fullName));
assert('options.source must be provided to expandLocalLookup', options && options.source);
assert('options.source must be a proper full name', this.validateFullName(options.source));
@@ -609,7 +609,7 @@ export default class Registry {
let normalizedSource = this.normalize(options.source);
return expandLocalLookup(this, normalizedFullName, normalizedSource);
- } else if (this.fallback) {
+ } else if (this.fallback !== null) {
return this.fallback.expandLocalLookup(fullName, options);
} else {
return null;
| false |
Other
|
emberjs
|
ember.js
|
3b22f49e857f959edc8b5bfeca5dbfff47b38b25.json
|
convert throws to assertions in `Registry`
|
packages/container/lib/registry.js
|
@@ -139,16 +139,10 @@ export default class Registry {
*/
register(fullName, factory, options = {}) {
assert('fullName must be a proper full name', this.validateFullName(fullName));
-
- if (factory === undefined) {
- throw new TypeError(`Attempting to register an unknown factory: '${fullName}'`);
- }
+ assert(`Attempting to register an unknown factory: '${fullName}'`, factory !== undefined);
let normalizedName = this.normalize(fullName);
-
- if (this._resolveCache[normalizedName]) {
- throw new Error(`Cannot re-register: '${fullName}', as it has already been resolved.`);
- }
+ assert(`Cannot re-register: '${fullName}', as it has already been resolved.`, !this._resolveCache[normalizedName]);
delete this._failCache[normalizedName];
this.registrations[normalizedName] = factory;
@@ -442,9 +436,7 @@ export default class Registry {
assert('fullName must be a proper full name', this.validateFullName(fullName));
let fullNameType = fullName.split(':')[0];
- if (fullNameType === type) {
- throw new Error(`Cannot inject a '${fullName}' on other ${type}(s).`);
- }
+ assert(`Cannot inject a '${fullName}' on other ${type}(s).`, fullNameType !== type);
let injections = this._typeInjections[type] ||
(this._typeInjections[type] = []);
| true |
Other
|
emberjs
|
ember.js
|
3b22f49e857f959edc8b5bfeca5dbfff47b38b25.json
|
convert throws to assertions in `Registry`
|
packages/container/tests/registry_test.js
|
@@ -62,7 +62,7 @@ QUnit.test('Throw exception when trying to inject `type:thing` on all type(s)',
registry.register('controller:post', PostController);
- throws(() => {
+ expectAssertion(() => {
registry.typeInjection('controller', 'injected', 'controller:post');
}, /Cannot inject a 'controller:post' on other controller\(s\)\./);
});
@@ -186,7 +186,7 @@ QUnit.test('cannot re-register a factory if it has been resolved', function() {
registry.register('controller:apple', FirstApple);
strictEqual(registry.resolve('controller:apple'), FirstApple);
- throws(function() {
+ expectAssertion(function() {
registry.register('controller:apple', SecondApple);
}, /Cannot re-register: 'controller:apple', as it has already been resolved\./);
| true |
Other
|
emberjs
|
ember.js
|
bc550ed597a70e6c1f15f22b3a9d6f574cbcf547.json
|
avoid extra boolean conversion
|
packages/ember-routing/lib/system/router.js
|
@@ -116,10 +116,8 @@ const EmberRouter = EmberObject.extend(Evented, {
},
_buildDSL() {
- let moduleBasedResolver = this._hasModuleBasedResolver();
- let options = {
- enableLoadingSubstates: !!moduleBasedResolver
- };
+ let enableLoadingSubstates = this._hasModuleBasedResolver();
+ let options = { enableLoadingSubstates };
let owner = getOwner(this);
let router = this;
@@ -171,14 +169,10 @@ const EmberRouter = EmberObject.extend(Evented, {
_hasModuleBasedResolver() {
let owner = getOwner(this);
-
if (!owner) { return false; }
- let resolver = owner.application && owner.application.__registry__ && owner.application.__registry__.resolver;
-
- if (!resolver) { return false; }
-
- return !!resolver.moduleBasedResolver;
+ let resolver = get(owner, 'application.__registry__.resolver.moduleBasedResolver');
+ return !!resolver;
},
/**
| false |
Other
|
emberjs
|
ember.js
|
64da9d6fcab25e34af916917f992fef627510594.json
|
use strippable `warn` in `link-to`
|
packages/ember-console/lib/index.js
|
@@ -56,7 +56,7 @@ export default {
@param {*} arguments
@public
*/
- log: consoleMethod('log') || K,
+ log: consoleMethod('log') || K,
/**
Prints the arguments to the console with a warning icon.
@@ -72,7 +72,7 @@ export default {
@param {*} arguments
@public
*/
- warn: consoleMethod('warn') || K,
+ warn: consoleMethod('warn') || K,
/**
Prints the arguments to the console with an error icon, red text and a stack trace.
@@ -105,7 +105,7 @@ export default {
@param {*} arguments
@public
*/
- info: consoleMethod('info') || K,
+ info: consoleMethod('info') || K,
/**
Logs the arguments to the console in blue text.
| true |
Other
|
emberjs
|
ember.js
|
64da9d6fcab25e34af916917f992fef627510594.json
|
use strippable `warn` in `link-to`
|
packages/ember-glimmer/lib/components/link-to.ts
|
@@ -314,6 +314,7 @@
import Logger from 'ember-console';
import { assert, deprecate } from 'ember-debug';
import { DEBUG } from 'ember-env-flags';
+import { assert, deprecate, warn } from 'ember-debug';
import {
computed,
flaggedInstrument,
@@ -654,7 +655,7 @@ const LinkComponent = EmberComponent.extend({
if (get(this, 'loading')) {
// tslint:disable-next-line:max-line-length
- Logger.warn('This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.');
+ warn('This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.');
return false;
}
| true |
Other
|
emberjs
|
ember.js
|
64da9d6fcab25e34af916917f992fef627510594.json
|
use strippable `warn` in `link-to`
|
packages/ember/tests/helpers/link_to_test.js
|
@@ -1430,20 +1430,9 @@ moduleFor('The {{link-to}} helper - nested routes and link-to arguments', class
moduleFor('The {{link-to}} helper - loading states and warnings', class extends ApplicationTestCase {
- constructor() {
- super();
- this._oldWarn = Logger.warn;
- this.warnCalled = false;
- Logger.warn = () => this.warnCalled = true;
- }
-
- teardown() {
- Logger.warn = this._oldWarn;
- super.teardown();
- }
-
[`@test link-to with null/undefined dynamic parameters are put in a loading state`](assert) {
assert.expect(19);
+ let warningMessage = 'This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.';
this.router.map(function() {
this.route('thing', { path: '/thing/:thing_id' });
@@ -1490,9 +1479,9 @@ moduleFor('The {{link-to}} helper - loading states and warnings', class extends
assertLinkStatus(contextLink);
assertLinkStatus(staticLink);
- this.warnCalled = false;
- this.click(contextLink);
- assert.ok(this.warnCalled, 'Logger.warn was called from clicking loading link');
+ expectWarning(()=> {
+ this.click(contextLink);
+ }, warningMessage);
// Set the destinationRoute (context is still null).
this.runTask(() => controller.set('destinationRoute', 'thing'));
@@ -1516,9 +1505,9 @@ moduleFor('The {{link-to}} helper - loading states and warnings', class extends
this.runTask(() => controller.set('destinationRoute', null));
assertLinkStatus(contextLink);
- this.warnCalled = false;
- this.click(staticLink);
- assert.ok(this.warnCalled, 'Logger.warn was called from clicking loading link');
+ expectWarning(()=> {
+ this.click(staticLink);
+ }, warningMessage);
this.runTask(() => controller.set('secondRoute', 'about'));
assertLinkStatus(staticLink, '/about');
| true |
Other
|
emberjs
|
ember.js
|
bb01997f2edf3baa868ae600c523de9bb05fda1c.json
|
Add types to the rest of /helpers
|
packages/ember-glimmer/lib/helpers/if-unless.ts
|
@@ -1,5 +1,6 @@
/**
@module ember
+@submodule ember-glimmer
*/
import {
@@ -9,6 +10,11 @@ import {
TagWrapper,
UpdatableTag,
} from '@glimmer/reference';
+import {
+ Arguments,
+ PrimitiveReference,
+ VM
+} from '@glimmer/runtime'
import { assert } from 'ember-debug';
import {
CachedReference,
@@ -22,7 +28,7 @@ class ConditionalHelperReference extends CachedReference {
public truthy: any;
public falsy: any;
- static create(_condRef, truthyRef, falsyRef) {
+ static create(_condRef: any, truthyRef: PrimitiveReference<boolean>, falsyRef: PrimitiveReference<boolean>) {
let condRef = ConditionalReference.create(_condRef);
if (isConst(condRef)) {
return condRef.value() ? truthyRef : falsyRef;
@@ -31,7 +37,7 @@ class ConditionalHelperReference extends CachedReference {
}
}
- constructor(cond, truthy, falsy) {
+ constructor(cond: any, truthy: any, falsy: any) {
super();
this.branchTag = UpdatableTag.create(CONSTANT_TAG);
@@ -133,7 +139,7 @@ class ConditionalHelperReference extends CachedReference {
@for Ember.Templates.helpers
@public
*/
-export function inlineIf(_vm, { positional }) {
+export function inlineIf(_vm: VM, { positional }: Arguments) {
assert(
'The inline form of the `if` helper expects two or three arguments, e.g. ' +
'`{{if trialExpired "Expired" expiryDate}}`.',
@@ -162,7 +168,7 @@ export function inlineIf(_vm, { positional }) {
@for Ember.Templates.helpers
@public
*/
-export function inlineUnless(_vm, { positional }) {
+export function inlineUnless(_vm: VM, { positional }: Arguments) {
assert(
'The inline form of the `unless` helper expects two or three arguments, e.g. ' +
'`{{unless isFirstLogin "Welcome back!"}}`.',
| true |
Other
|
emberjs
|
ember.js
|
bb01997f2edf3baa868ae600c523de9bb05fda1c.json
|
Add types to the rest of /helpers
|
packages/ember-glimmer/lib/helpers/loc.ts
|
@@ -2,6 +2,12 @@
/**
@module ember
*/
+
+import {
+ Arguments,
+ CapturedArguments,
+ VM
+} from '@glimmer/runtime';
import { String as StringUtils } from 'ember-runtime';
import { InternalHelperReference } from '../utils/references';
@@ -37,10 +43,10 @@ import { InternalHelperReference } from '../utils/references';
@see {Ember.String#loc}
@public
*/
-function locHelper({ positional }) {
+function locHelper({ positional }: CapturedArguments) {
return StringUtils.loc.apply(null, positional.value());
}
-export default function(_vm, args) {
+export default function(_vm: VM, args: Arguments) {
return new InternalHelperReference(locHelper, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
bb01997f2edf3baa868ae600c523de9bb05fda1c.json
|
Add types to the rest of /helpers
|
packages/ember-glimmer/lib/helpers/log.ts
|
@@ -1,3 +1,8 @@
+import {
+ Arguments,
+ CapturedArguments,
+ VM
+} from '@glimmer/runtime';
import { InternalHelperReference } from '../utils/references';
/**
@module ember
@@ -18,10 +23,10 @@ import Logger from 'ember-console';
@param {Array} params
@public
*/
-function log({ positional }) {
+function log({ positional }: CapturedArguments) {
Logger.log.apply(null, positional.value());
}
-export default function(_vm, args) {
+export default function(_vm: VM, args: Arguments) {
return new InternalHelperReference(log, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
bb01997f2edf3baa868ae600c523de9bb05fda1c.json
|
Add types to the rest of /helpers
|
packages/ember-glimmer/lib/helpers/mut.ts
|
@@ -1,6 +1,10 @@
/**
@module ember
*/
+import {
+ Arguments,
+ VM
+} from '@glimmer/runtime';
import { assert } from 'ember-debug';
import { symbol } from 'ember-utils';
import { UPDATE } from '../utils/references';
@@ -78,15 +82,15 @@ import { INVOKE } from './action';
const MUT_REFERENCE = symbol('MUT');
const SOURCE = symbol('SOURCE');
-export function isMut(ref) {
+export function isMut(ref: any): boolean {
return ref && ref[MUT_REFERENCE];
}
-export function unMut(ref) {
+export function unMut(ref: any) {
return ref[SOURCE] || ref;
}
-export default function(_vm, args) {
+export default function(_vm: VM, args: Arguments) {
let rawRef = args.positional.at(0);
if (isMut(rawRef)) {
| true |
Other
|
emberjs
|
ember.js
|
bb01997f2edf3baa868ae600c523de9bb05fda1c.json
|
Add types to the rest of /helpers
|
packages/ember-glimmer/lib/helpers/query-param.ts
|
@@ -1,6 +1,11 @@
/**
@module ember
*/
+import {
+ Arguments,
+ CapturedArguments,
+ VM
+} from '@glimmer/runtime';
import { assert } from 'ember-debug';
import { QueryParams } from 'ember-routing';
import { assign } from 'ember-utils';
@@ -22,7 +27,7 @@ import { InternalHelperReference } from '../utils/references';
@return {Object} A `QueryParams` object for `{{link-to}}`
@public
*/
-function queryParams({ positional, named }) {
+function queryParams({ positional, named }: CapturedArguments) {
// tslint:disable-next-line:max-line-length
assert('The `query-params` helper only accepts hash parameters, e.g. (query-params queryParamPropertyName=\'foo\') as opposed to just (query-params \'foo\')', positional.value().length === 0);
@@ -31,6 +36,6 @@ function queryParams({ positional, named }) {
});
}
-export default function(_vm, args) {
+export default function(_vm: VM, args: Arguments) {
return new InternalHelperReference(queryParams, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
bb01997f2edf3baa868ae600c523de9bb05fda1c.json
|
Add types to the rest of /helpers
|
packages/ember-glimmer/lib/helpers/readonly.ts
|
@@ -1,6 +1,10 @@
/**
@module ember
*/
+import {
+ Arguments,
+ VM
+} from '@glimmer/runtime';
import { UPDATE } from '../utils/references';
import { unMut } from './mut';
@@ -102,7 +106,7 @@ import { unMut } from './mut';
@for Ember.Templates.helpers
@private
*/
-export default function(_vm, args) {
+export default function(_vm: VM, args: Arguments) {
let ref = unMut(args.positional.at(0));
let wrapped = Object.create(ref);
| true |
Other
|
emberjs
|
ember.js
|
bb01997f2edf3baa868ae600c523de9bb05fda1c.json
|
Add types to the rest of /helpers
|
packages/ember-glimmer/lib/helpers/unbound.ts
|
@@ -2,6 +2,10 @@
@module ember
*/
+import {
+ Arguments,
+ VM
+} from '@glimmer/runtime';
import { assert } from 'ember-debug';
import { UnboundReference } from '../utils/references';
@@ -33,7 +37,7 @@ import { UnboundReference } from '../utils/references';
@public
*/
-export default function(_vm, args) {
+export default function(_vm: VM, args: Arguments) {
assert(
'unbound helper cannot be called with multiple params or hash params',
args.positional.length === 1 && args.named.length === 0,
| true |
Other
|
emberjs
|
ember.js
|
bb01997f2edf3baa868ae600c523de9bb05fda1c.json
|
Add types to the rest of /helpers
|
packages/ember-routing/lib/index.d.ts
|
@@ -195,7 +195,8 @@ export const Route: {
};
export const QueryParams: {
isQueryParams: boolean;
- values: any
+ values: any;
+ create(obj: any): any;
};
export const RoutingService: {
router: any;
| true |
Other
|
emberjs
|
ember.js
|
c2a5884b0d6ed480ec4f78e49a66681cf16a829e.json
|
Use actual types (mostly) for component-managers/
There are a few uses of `any` still, and a few errors I'm still trying
to figure out.
|
packages/ember-glimmer/lib/component-managers/curly.ts
|
@@ -141,7 +141,7 @@ export class PositionalArgumentReference {
}
export default class CurlyComponentManager extends AbstractManager<ComponentStateBucket> {
- prepareArgs(definition: ComponentDefinition<ComponentStateBucket>, args: Arguments): Option<PreparedArguments> {
+ prepareArgs(definition: CurlyComponentDefinition, args: Arguments): Option<PreparedArguments> {
let componentPositionalParamsDefinition = definition.ComponentClass.class.positionalParams;
if (DEBUG && componentPositionalParamsDefinition) {
@@ -191,7 +191,7 @@ export default class CurlyComponentManager extends AbstractManager<ComponentStat
return { positional, named };
}
- create(environment: Environment, definition: ComponentDefinition<ComponentStateBucket>, args: Arguments, dynamicScope: DynamicScope, callerSelfRef: VersionedPathReference<Opaque>, hasBlock: boolean): ComponentStateBucket {
+ create(environment: Environment, definition: CurlyComponentDefinition, args: Arguments, dynamicScope: DynamicScope, callerSelfRef: VersionedPathReference<Opaque>, hasBlock: boolean): ComponentStateBucket {
if (DEBUG) {
this._pushToDebugStack(`component:${definition.name}`, environment);
}
@@ -250,7 +250,7 @@ export default class CurlyComponentManager extends AbstractManager<ComponentStat
return bucket;
}
- layoutFor(definition: ComponentDefinition<ComponentStateBucket>, bucket: ComponentStateBucket, env: Environment): CompiledDynamicProgram {
+ layoutFor(definition: CurlyComponentDefinition, bucket: ComponentStateBucket, env: Environment): CompiledDynamicProgram {
let template = definition.template;
if (!template) {
template = this.templateFor(bucket, env);
@@ -443,11 +443,11 @@ export function rerenderInstrumentDetails(component: any): any {
const MANAGER = new CurlyComponentManager();
-export class CurlyComponentDefinition extends ComponentDefinition<Opaque> {
+export class CurlyComponentDefinition extends ComponentDefinition<ComponentStateBucket> {
public template: WrappedTemplateFactory;
public args: Arguments;
- constructor(name: string, ComponentClass: ComponentClass, template: WrappedTemplateFactory, args: Arguments, customManager?: ComponentManager<Opaque>) {
+ constructor(name: string, ComponentClass: ComponentClass, template: WrappedTemplateFactory, args: Arguments, customManager?: ComponentManager<ComponentStateBucket>) {
super(name, customManager || MANAGER, ComponentClass);
this.template = template;
this.args = args;
| true |
Other
|
emberjs
|
ember.js
|
c2a5884b0d6ed480ec4f78e49a66681cf16a829e.json
|
Use actual types (mostly) for component-managers/
There are a few uses of `any` still, and a few errors I'm still trying
to figure out.
|
packages/ember-glimmer/lib/component-managers/outlet.ts
|
@@ -1,5 +1,6 @@
import { Option } from '@glimmer/interfaces';
import {
+ Arguments,
ComponentDefinition,
DynamicScope,
Environment,
@@ -9,10 +10,11 @@ import { DEBUG } from 'ember-env-flags';
import { _instrumentStart } from 'ember-metal';
import { generateGuid, guidFor } from 'ember-utils';
import EmberEnvironment from '../environment';
+import { WrappedTemplateFactory } from '../template';
import { RootReference } from '../utils/references';
import AbstractManager from './abstract';
-function instrumentationPayload({ render: { name, outlet } }) {
+function instrumentationPayload({ render: { name, outlet } }: {render: {name: string, outlet: string}}) {
return { object: `${name}:${outlet}` };
}
@@ -26,7 +28,7 @@ class StateBucket {
public outletState: any;
public finalizer: any;
- constructor(outletState) {
+ constructor(outletState: any) {
this.outletState = outletState;
this.instrument();
}
@@ -45,7 +47,7 @@ class StateBucket {
class OutletComponentManager extends AbstractManager<StateBucket> {
create(environment: Environment,
definition: OutletComponentDefinition,
- _args,
+ _args: Arguments,
dynamicScope: OutletDynamicScope) {
if (DEBUG) {
this._pushToDebugStack(`template:${definition.template.meta.moduleName}`, environment);
@@ -57,11 +59,11 @@ class OutletComponentManager extends AbstractManager<StateBucket> {
return new StateBucket(outletState);
}
- layoutFor(definition, _bucket, env: Environment) {
+ layoutFor(definition: OutletComponentDefinition, _bucket: StateBucket, env: Environment) {
return (env as EmberEnvironment).getCompiledBlock(OutletLayoutCompiler, definition.template);
}
- getSelf({ outletState }) {
+ getSelf({ outletState }: StateBucket) {
return new RootReference(outletState.render.controller);
}
@@ -81,23 +83,23 @@ class OutletComponentManager extends AbstractManager<StateBucket> {
const MANAGER = new OutletComponentManager();
class TopLevelOutletComponentManager extends OutletComponentManager {
- create(environment, definition, _args, dynamicScope) {
+ create(environment: Environment, definition: OutletComponentDefinition, _args: Arguments, dynamicScope: OutletDynamicScope) {
if (DEBUG) {
this._pushToDebugStack(`template:${definition.template.meta.moduleName}`, environment);
}
return new StateBucket(dynamicScope.outletState.value());
}
- layoutFor(definition, _bucket, env) {
- return env.getCompiledBlock(TopLevelOutletLayoutCompiler, definition.template);
+ layoutFor(definition: OutletComponentDefinition, _bucket: StateBucket, env: Environment) {
+ return (env as EmberEnvironment).getCompiledBlock(TopLevelOutletLayoutCompiler, definition.template);
}
}
const TOP_LEVEL_MANAGER = new TopLevelOutletComponentManager();
export class TopLevelOutletComponentDefinition extends ComponentDefinition<StateBucket> {
- public template: any;
- constructor(instance) {
+ public template: WrappedTemplateFactory;
+ constructor(instance: any) {
super('outlet', TOP_LEVEL_MANAGER, instance);
this.template = instance.template;
generateGuid(this);
@@ -106,12 +108,12 @@ export class TopLevelOutletComponentDefinition extends ComponentDefinition<State
class TopLevelOutletLayoutCompiler {
static id: string;
- public template: any;
- constructor(template) {
+ public template: WrappedTemplateFactory;
+ constructor(template: WrappedTemplateFactory) {
this.template = template;
}
- compile(builder) {
+ compile(builder: any) {
builder.wrapLayout(this.template);
builder.tag.static('div');
builder.attrs.static('id', guidFor(this));
@@ -123,9 +125,9 @@ TopLevelOutletLayoutCompiler.id = 'top-level-outlet';
export class OutletComponentDefinition extends ComponentDefinition<StateBucket> {
public outletName: string;
- public template: any;
+ public template: WrappedTemplateFactory;
- constructor(outletName, template) {
+ constructor(outletName: string, template: WrappedTemplateFactory) {
super('outlet', MANAGER, null);
this.outletName = outletName;
this.template = template;
@@ -135,12 +137,12 @@ export class OutletComponentDefinition extends ComponentDefinition<StateBucket>
export class OutletLayoutCompiler {
static id: string;
- public template: any;
- constructor(template) {
+ public template: WrappedTemplateFactory;
+ constructor(template: WrappedTemplateFactory) {
this.template = template;
}
- compile(builder) {
+ compile(builder: any) {
builder.wrapLayout(this.template);
}
}
| true |
Other
|
emberjs
|
ember.js
|
c2a5884b0d6ed480ec4f78e49a66681cf16a829e.json
|
Use actual types (mostly) for component-managers/
There are a few uses of `any` still, and a few errors I'm still trying
to figure out.
|
packages/ember-glimmer/lib/component-managers/render.ts
|
@@ -1,23 +1,25 @@
import {
ComponentDefinition,
+ ComponentManager
} from '@glimmer/runtime';
import { IArguments } from '@glimmer/runtime/dist/types/lib/vm/arguments';
import { Destroyable } from '@glimmer/util';
import { DEBUG } from 'ember-env-flags';
import { generateController, generateControllerFactory } from 'ember-routing';
import Environment from '../environment';
+import { WrappedTemplateFactory } from '../template';
import { DynamicScope } from '../renderer';
import { RootReference } from '../utils/references';
import AbstractManager from './abstract';
import { OutletLayoutCompiler } from './outlet';
export abstract class AbstractRenderManager extends AbstractManager<RenderState> {
- layoutFor(definition: RenderDefinition, _bucket, env) {
+ layoutFor(definition: RenderDefinition, _bucket: RenderState, env: Environment) {
return env.getCompiledBlock(OutletLayoutCompiler, definition.template);
}
- getSelf({ controller }) {
+ getSelf({ controller }: RenderState) {
return new RootReference(controller);
}
}
@@ -30,6 +32,7 @@ if (DEBUG) {
export interface RenderState {
controller: Destroyable;
+ model: any;
}
class SingletonRenderManager extends AbstractRenderManager {
@@ -48,7 +51,7 @@ class SingletonRenderManager extends AbstractRenderManager {
dynamicScope.outletState = dynamicScope.rootOutletState.getOrphan(name);
}
- return { controller };
+ return <RenderState>{ controller };
}
getDestructor() {
@@ -59,7 +62,7 @@ class SingletonRenderManager extends AbstractRenderManager {
export const SINGLETON_RENDER_MANAGER = new SingletonRenderManager();
class NonSingletonRenderManager extends AbstractRenderManager {
- create(environment, definition, args, dynamicScope) {
+ create(environment: Environment, definition: RenderDefinition, args: IArguments, dynamicScope: DynamicScope) {
let { name, env } = definition;
let modelRef = args.positional.at(0);
let controllerFactory = env.owner.factoryFor(`controller:${name}`);
@@ -78,23 +81,23 @@ class NonSingletonRenderManager extends AbstractRenderManager {
return { controller, model: modelRef };
}
- update({ controller, model }) {
+ update({ controller, model }: RenderState) {
controller.set('model', model.value());
}
- getDestructor({ controller }) {
+ getDestructor({ controller }: RenderState) {
return controller;
}
}
export const NON_SINGLETON_RENDER_MANAGER = new NonSingletonRenderManager();
-export class RenderDefinition extends ComponentDefinition<any> {
+export class RenderDefinition extends ComponentDefinition<RenderState> {
public name: string;
- public template: any;
+ public template: WrappedTemplateFactory;
public env: Environment;
- constructor(name, template, env, manager) {
+ constructor(name: string, template: WrappedTemplateFactory, env: Environment, manager: ComponentManager<RenderState>) {
super('render', manager, null);
this.name = name;
| true |
Other
|
emberjs
|
ember.js
|
c2a5884b0d6ed480ec4f78e49a66681cf16a829e.json
|
Use actual types (mostly) for component-managers/
There are a few uses of `any` still, and a few errors I'm still trying
to figure out.
|
packages/ember-glimmer/lib/component-managers/root.ts
|
@@ -1,5 +1,6 @@
import {
- ComponentDefinition,
+ Arguments,
+ ComponentDefinition
} from '@glimmer/runtime';
import { DEBUG } from 'ember-env-flags';
import {
@@ -9,10 +10,13 @@ import ComponentStateBucket from '../utils/curly-component-state-bucket';
import CurlyComponentManager, {
initialRenderInstrumentDetails,
processComponentInitializationAssertions,
+ CurlyComponentDefinition
} from './curly';
+import { DynamicScope } from '../renderer';
+import Environment from '../environment';
class RootComponentManager extends CurlyComponentManager {
- create(environment, definition, args, dynamicScope) {
+ create(environment: Environment, definition: CurlyComponentDefinition, args: Arguments, dynamicScope: DynamicScope) {
let component = definition.ComponentClass.create();
if (DEBUG) {
@@ -46,10 +50,10 @@ class RootComponentManager extends CurlyComponentManager {
const ROOT_MANAGER = new RootComponentManager();
-export class RootComponentDefinition extends ComponentDefinition<any> {
+export class RootComponentDefinition extends ComponentDefinition<ComponentStateBucket> {
public template: any;
public args: any;
- constructor(instance) {
+ constructor(instance: ComponentStateBucket) {
super('-root', ROOT_MANAGER, {
class: instance.constructor,
create() {
| true |
Other
|
emberjs
|
ember.js
|
c2a5884b0d6ed480ec4f78e49a66681cf16a829e.json
|
Use actual types (mostly) for component-managers/
There are a few uses of `any` still, and a few errors I'm still trying
to figure out.
|
packages/ember-routing/lib/index.d.ts
|
@@ -63,7 +63,7 @@ export const AutoLocation: {
};
export function generateController(owner: any, controllerName: string): any;
-export function generateControllerFactory(owner: any, controllerName: string, context: any): any;
+export function generateControllerFactory(owner: any, controllerName: string, context?: any): any;
export function controllerFor(container: any, controllerName: string, lookupOptions: any): any;
| true |
Other
|
emberjs
|
ember.js
|
b7abdfb14f94db3e22044dd2ea0055dfaa1227b9.json
|
Use WrappedTemplateFactory as template type
|
packages/ember-glimmer/lib/component-managers/curly.ts
|
@@ -43,6 +43,7 @@ import {
} from '../component';
import Environment from '../environment';
import { DynamicScope } from '../renderer';
+import { WrappedTemplateFactory } from '../template';
import {
AttributeBinding,
ClassNameBinding,
@@ -105,9 +106,9 @@ function ariaRole(vm: VM) {
class CurlyComponentLayoutCompiler {
static id: string;
- public template: any;
+ public template: WrappedTemplateFactory;
- constructor(template: any) {
+ constructor(template: WrappedTemplateFactory) {
this.template = template;
}
@@ -257,7 +258,7 @@ export default class CurlyComponentManager extends AbstractManager<ComponentStat
return env.getCompiledBlock(CurlyComponentLayoutCompiler, template);
}
- templateFor(component: ComponentStateBucket, env: Environment): any {
+ templateFor(component: ComponentStateBucket, env: Environment): WrappedTemplateFactory {
let Template = get(component, 'layout');
let owner = component[OWNER];
if (Template) {
@@ -443,10 +444,10 @@ export function rerenderInstrumentDetails(component: any): any {
const MANAGER = new CurlyComponentManager();
export class CurlyComponentDefinition extends ComponentDefinition<Opaque> {
- public template: any;
+ public template: WrappedTemplateFactory;
public args: Arguments;
- constructor(name: string, ComponentClass: ComponentClass, template: any, args: Arguments, customManager?: ComponentManager<Opaque>) {
+ constructor(name: string, ComponentClass: ComponentClass, template: WrappedTemplateFactory, args: Arguments, customManager?: ComponentManager<Opaque>) {
super(name, customManager || MANAGER, ComponentClass);
this.template = template;
this.args = args;
| true |
Other
|
emberjs
|
ember.js
|
b7abdfb14f94db3e22044dd2ea0055dfaa1227b9.json
|
Use WrappedTemplateFactory as template type
|
packages/ember-glimmer/lib/environment.ts
|
@@ -227,7 +227,7 @@ export default class Environment extends GlimmerEnvironment {
// normally templates should be exported at the proper module name
// and cached in the container, but this cache supports templates
// that have been set directly on the component's layout property
- getTemplate(Template, owner) {
+ getTemplate(Template, owner): WrappedTemplateFactory {
return this._templateCache.get({ Template, owner });
}
| true |
Other
|
emberjs
|
ember.js
|
d53214afed6550f593298f137e58354b061f925b.json
|
Add better types for ember-routing
|
packages/ember-glimmer/lib/component-managers/curly.ts
|
@@ -16,6 +16,7 @@ import {
PreparedArguments,
PrimitiveReference,
Simple,
+ VM,
} from '@glimmer/runtime';
import { Opaque, Destroyable } from '@glimmer/util';
import { Option } from '@glimmer/interfaces';
@@ -91,14 +92,14 @@ function applyAttributeBindings(element: Simple.Element, attributeBindings: any,
}
}
-function tagName(vm: any) {
+function tagName(vm: VM) {
// tslint:disable-next-line:no-shadowed-variable
let { tagName } = vm.dynamicScope().view;
return PrimitiveReference.create(tagName === '' ? null : tagName || 'div');
}
-function ariaRole(vm: any) {
+function ariaRole(vm: VM) {
return vm.getSelf().get('ariaRole');
}
@@ -133,7 +134,7 @@ export class PositionalArgumentReference {
return this._references.map((reference: any) => reference.value());
}
- get(key: any) {
+ get(key: string) {
return PropertyReference.create(this, key);
}
}
| true |
Other
|
emberjs
|
ember.js
|
d53214afed6550f593298f137e58354b061f925b.json
|
Add better types for ember-routing
|
packages/ember-routing/lib/index.d.ts
|
@@ -1,16 +1,229 @@
-export const Location: any;
-export const NoneLocation: any;
-export const HashLocation: any;
-export const HistoryLocation: any;
-export const AutoLocation: any;
-
-export const generateController: any;
-export const generateControllerFactory: any;
-export const controllerFor: any;
-export const RouterDSL: any;
-export const Router: any;
-export const Route: any;
-export const QueryParams: any;
-export const RoutingService: any;
-export const RouterService: any;
-export const BucketCache: any;
+export const Location: {
+ create(options: any): any
+};
+
+export const NoneLocation: {
+ implementation: string;
+ path: string;
+ detect(): void;
+ rootURL: string;
+ getURL(): string;
+ setURL(path: string): void;
+ onUpdateURL(callback: ()=>any): void;
+ handleURL(url: string): void;
+ formatURL(url: string): string;
+};
+
+export const HashLocation: {
+ implementation: string;
+ init(): void;
+ getHash(location: { href: string }): string;
+ getURL(): string;
+ setURL(path: string): void;
+ replaceURL(path: string): void;
+ onUpdateURL(callback: ()=>any): void;
+ formatURL(url: string): string;
+ willDestroy(): void;
+ _removeEventListener(): void;
+};
+
+export const HistoryLocation: {
+ implementation: string;
+ init(): void;
+ initState(): void;
+ rootURL: string;
+ getURL(): string;
+ setURL(path: string): void;
+ replaceURL(path: string): void;
+ getState(): any;
+ pushState(path: string): void;
+ replaceState(paht: string): void;
+ onUpdateURL(callback: ()=>any): void;
+ formatURL(url: string): string;
+ willDestroy(): void;
+ getHash(location: { href: string }): string;
+ _removeEventListener(): void;
+};
+
+export const AutoLocation: {
+ location: string | any;
+ history: any;
+ global: any;
+ userAgent: any;
+ cancelRouterSetup: boolean;
+ rootURL: string;
+ detect(): void;
+ initState(): void;
+ getURL(): string;
+ setURL(path: string): void;
+ replaceURL(path: string): void;
+ onUpdateURL(callback: ()=>any): void;
+ formatURL(url: string): string;
+ willDestroy(): void;
+};
+
+export function generateController(owner: any, controllerName: string): any;
+export function generateControllerFactory(owner: any, controllerName: string, context: any): any;
+
+export function controllerFor(container: any, controllerName: string, lookupOptions: any): any;
+
+export class RouterDSL {
+ constructor(name: string, options: any);
+ route(name: string, options: any, callback: ()=>any): void;
+ push(url: string, name: string, callback: ()=>any, serialize: ()=>any): void;
+ resource(name: string, options: any, callback: ()=>any): void;
+ genearte(): (match: any) => void;
+ mount(_name: string, options: any): void;
+}
+
+export const Router: {
+ location: string;
+ rootURL: string;
+ currentState: any;
+ targetState: any;
+ _initRouterJs(): void;
+ _buildDSL(): RouterDSL;
+ init(): void;
+ _resetQueuedQueryParameterChanges(): void;
+ url: string;
+ _hasModuleBasedResolver(): boolean;
+ startRouting(): void;
+ setupRouter(): boolean;
+ didTransition(infos: any): void;
+ _setOutlets(): void;
+ willTransition(oldInfos: any, newInfos: any, transition: any): void;
+ handleURL(url: string): any;
+ _doURLTransition(routerJsMethod: ()=>any, url: string): any;
+ transitionTo(...args: any[]): any;
+ intermediateTransitionTo(...args: any[]): void;
+ replaceWith(): any;
+ generate(): string;
+ isActive(...args: any[]): boolean;
+ isActiveIntent(routeName: string, models: any, queryParams: any): boolean;
+ send(): void;
+ hasRoute(route: any): boolean;
+ reset(): void;
+ willDestroy(): void;
+ _activeQPChanged(queryParameterName: string, newValue: string): void;
+ _updatingQPChanged(queryParameterName: string): void;
+ _fireQueryParamTransition(): void;
+ _setupLocation(): void;
+ _getHandlerFunction(): (name: string) => any;
+ _getSerializerFunction(): (name: string) => any;
+ _setupRouter(location: any): void;
+ _serializeQueryParams(handlerInfos: any[], queryParams: any): void;
+ _serializeQueryParam(value: any, type: string): string;
+ _deserializeQueryParams(handlerInfos: any[], queryParams: any): void;
+ _deserializeQueryParam(value: any, defaultType: string): any;
+ _pruneDefaultQueryParamValues(handlerInfos: any[], queryParams: any): void;
+ _doTransition(_targetRouteName: string, models: any[], _queryParams: any, _keepDefaultQueryParamValues: any): any;
+ _processActiveTransitionQueryParams(targetRouteName: any, models: any[], queryParams: any, _queryParams: any): void;
+ _prepareQueryParams(targetRouteName: string, models: any[], queryParams: any, _fromRouterService: any): void;
+ _getQPMeta(handlerInfo: any): any;
+ _queryParamsFor(handlerInfos: any[]): any;
+ _fullyScopeQueryParams(leafRouteName: string, contexts: any[], queryParams: any): void;
+ _hydrateUnsuppliedQueryParams(state: any, queryParams: any, _fromRouterService: any): void;
+ _scheduleLoadingEvent(transition: any, originRoute: any): void;
+ _handleSlowTransition(transition: any, originRoute: any): void;
+ _cancelSlowTransitionTimer(): void;
+ _markErrorAsHandled(errorGuid: string): void;
+ _isErrorHandled(errorGuid: string): boolean;
+ _clearHandledError(errorGuid: string): void;
+ _getEngineInstance({ name, instanceId, mountPoint }: any): any;
+ map(callback: ()=>any): any;
+ _routePath(handlerInfos: any[]): string;
+};
+
+export const Route: {
+ queryParams: any;
+ _setRouteName(name: string): void;
+ _qp: any;
+ _names: any[];
+ _stashNames(handlerInfo: any, dynamicParent: any): void;
+ _activeQPChanged(qp: any, value: any): void;
+ _updatingQPChanged(qp: any): void;
+ mergedProperties: string[];
+ paramsFor(name: string): any;
+ serializeQueryParamKey(controllerPropertyName: string): string;
+ serializeQueryParam(value: any, urlKey: string, defaultValueType: string): string;
+ deserializeQueryParam(value: any, urlKey: string, defaultValueType: string): any;
+ _optionsForQueryParam(qp: any): any;
+ resetController(controller: any, isExiting: boolean, transition: any): void;
+ exit(): void;
+ _reset(isExiting: boolean, transition: any): void;
+ enter(): void;
+ templateName: string;
+ controllerName: string;
+ actions: {
+ queryParamsDidChange(changed: any, totalPresent: any, removed: any): boolean;
+ finalizeQueryParamChange(params: any, finalParams: any, transition: any): void;
+ };
+ deactivate(): void;
+ activate(): void;
+ transitionTo(name: string, context: any): any;
+ intermediateTransitionTo(): void;
+ refresh(): any;
+ replaceWith(): any;
+ send(...args: any[]): any;
+ setup(context: any, transition: any): void;
+ _qpChanged(prop: any, value: any, qp: any): void;
+ beforeModel(): any;
+ afterModel(): any;
+ redirect(): any;
+ contextDidChange(): void;
+ model(params: any, transition: any): any;
+ deserialize(params: any, transition: any): any;
+ findModel(): any;
+ store: any;
+ serialize(model: any, params: any[]): any;
+ setupController(controller: any, context: any, transition: any): void;
+ controllerFor(name: string, _skipAssert: boolean): any;
+ generateController(name: string): any;
+ modelFor(_name: string): any;
+ renderTemplate(controller: any, model: any): void;
+ render(_name: string, options: {
+ into: string,
+ outlet: string,
+ controller: string | any,
+ model: any
+ }): void;
+ disconnectOutlet(options: any): void;
+ _disconnectOutlet(outletName: any, parentView: any): void;
+ willDestroy(): void;
+ teardownViews(): void;
+ isRouteFactory: boolean;
+};
+export const QueryParams: {
+ isQueryParams: boolean;
+ values: any
+};
+export const RoutingService: {
+ router: any;
+ targetState: any;
+ currentState: any;
+ currentRouteName: string;
+ currentPath: string;
+ hasRoute(routeName: string): boolean;
+ transitionTo(routeName: string, models: any, queryParams: any, shouldReplace: boolean): any;
+ normalizeQueryParams(routeName: string, models: any, queryParams: any): void;
+ generateURL(routeName: string, models: any, queryParams: any): any;
+ isActiveForRoute(contexts: any, queryParams: any, routeName: string, routerState: any, isCurrentWhenSpecified: boolean): boolean;
+};
+export const RouterService: {
+ currentRouteName: string;
+ currentURL: string;
+ location: any;
+ rootURL: string;
+ _router: any;
+ transitionTo(...args: any[]): any;
+ replaceWith(...args: any[]): any;
+ urlFor(...args: any[]): string;
+ isActive(...args: any[]): boolean;
+ _extractArguments(routeName: string, ...models: any[]): {routeName: string, models: any[], queryParams: any};
+};
+export const BucketCache: {
+ init(): void;
+ has(bucketKey: string): boolean;
+ stash(bucketKey: string, key: string, value: any): void;
+ lookup(bucketKey: string, prop: any, defaultValue: any): any;
+};
| true |
Other
|
emberjs
|
ember.js
|
d53214afed6550f593298f137e58354b061f925b.json
|
Add better types for ember-routing
|
packages/ember-routing/lib/location/none_location.js
|
@@ -93,7 +93,7 @@ export default EmberObject.extend({
@private
@method handleURL
- @param callback {Function}
+ @param url {String}
*/
handleURL(url) {
set(this, 'path', url);
| true |
Other
|
emberjs
|
ember.js
|
145711188a89a8cbdec0edc281d96cd74ba5780f.json
|
add more typing
|
packages/ember-environment/lib/index.d.ts
|
@@ -0,0 +1,10 @@
+export const environment: {
+ hasDOM: boolean;
+ isChrome: boolean;
+ isFirefox: boolean;
+ isPhantom: boolean;
+ location: Location | null;
+ history: History | null;
+ userAgent: string;
+ window: Window | null;
+};
| true |
Other
|
emberjs
|
ember.js
|
145711188a89a8cbdec0edc281d96cd74ba5780f.json
|
add more typing
|
packages/ember-glimmer/lib/component-managers/curly.ts
|
@@ -3,6 +3,7 @@ import {
ComponentDefinition,
PrimitiveReference,
} from '@glimmer/runtime';
+import { Opaque } from '@glimmer/util';
import { privatize as P } from 'container';
import {
assert,
@@ -14,7 +15,6 @@ import {
} from 'ember-metal';
import {
assign,
- Opaque,
OWNER,
} from 'ember-utils';
import { setViewElement } from 'ember-views';
| true |
Other
|
emberjs
|
ember.js
|
145711188a89a8cbdec0edc281d96cd74ba5780f.json
|
add more typing
|
packages/ember-glimmer/lib/component.ts
|
@@ -617,11 +617,14 @@ const Component = CoreView.extend(
this._super();
},
- __defineNonEnumerable(property) {
+ __defineNonEnumerable(property: {
+ name: string;
+ descriptor: { value: any }
+ }) {
this[property.name] = property.descriptor.value;
},
- [PROPERTY_DID_CHANGE](key) {
+ [PROPERTY_DID_CHANGE](key: string) {
if (this[IS_DISPATCHING_ATTRS]) { return; }
let args = this[ARGS];
@@ -634,7 +637,7 @@ const Component = CoreView.extend(
}
},
- getAttr(key) {
+ getAttr(key: string) {
// TODO Intimate API should be deprecated
return this.get(key);
},
@@ -670,7 +673,7 @@ const Component = CoreView.extend(
@return String
@public
*/
- readDOMAttr(name) {
+ readDOMAttr(name: string) {
let element = getViewElement(this);
return readDOMAttr(element, name);
},
| true |
Other
|
emberjs
|
ember.js
|
145711188a89a8cbdec0edc281d96cd74ba5780f.json
|
add more typing
|
packages/ember-glimmer/lib/utils/string.ts
|
@@ -7,7 +7,7 @@ import { deprecate } from 'ember-debug';
export class SafeString {
public string: string;
- constructor(string) {
+ constructor(string: string) {
this.string = string;
}
@@ -49,11 +49,11 @@ const escape = {
const possible = /[&<>"'`=]/;
const badChars = /[&<>"'`=]/g;
-function escapeChar(chr) {
+function escapeChar(chr: keyof typeof escape) {
return escape[chr];
}
-export function escapeExpression(string) {
+export function escapeExpression(string: string | SafeString) {
if (typeof string !== 'string') {
// don't escape SafeStrings, since they're already safe
if (string && string.toHTML) {
@@ -91,7 +91,7 @@ export function escapeExpression(string) {
@return {Handlebars.SafeString} A string that will not be HTML escaped by Handlebars.
@public
*/
-export function htmlSafe(str) {
+export function htmlSafe(str: string) {
if (str === null || str === undefined) {
str = '';
} else if (typeof str !== 'string') {
@@ -119,6 +119,6 @@ export function htmlSafe(str) {
@return {Boolean} `true` if the string was decorated with `htmlSafe`, `false` otherwise.
@public
*/
-export function isHTMLSafe(str) {
- return str && typeof str.toHTML === 'function';
+export function isHTMLSafe(str: string | SafeString): str is SafeString {
+ return str !== null && typeof str === 'object' && typeof str.toHTML === 'function';
}
| true |
Other
|
emberjs
|
ember.js
|
145711188a89a8cbdec0edc281d96cd74ba5780f.json
|
add more typing
|
packages/ember-glimmer/lib/utils/to-bool.ts
|
@@ -1,7 +1,8 @@
+import { Opaque } from '@glimmer/interfaces';
import { get } from 'ember-metal';
import { isArray } from 'ember-runtime';
-export default function toBool(predicate) {
+export default function toBool(predicate: Opaque) {
if (!predicate) {
return false;
}
| true |
Other
|
emberjs
|
ember.js
|
145711188a89a8cbdec0edc281d96cd74ba5780f.json
|
add more typing
|
packages/ember-glimmer/lib/views/outlet.ts
|
@@ -14,7 +14,7 @@ export class RootOutletStateReference implements VersionedPathReference<Option<O
this.tag = outletView._tag;
}
- get(key: string): VersionedPathReference<Option<OutletState>> {
+ get(key: string): VersionedPathReference<any> {
return new ChildOutletStateReference(this, key);
}
@@ -66,22 +66,22 @@ class OrphanedOutletStateReference extends RootOutletStateReference {
}
}
-class ChildOutletStateReference implements VersionedPathReference<Option<OutletState>> {
- public parent: VersionedPathReference<Option<OutletState>>;
+class ChildOutletStateReference implements VersionedPathReference<any> {
+ public parent: VersionedPathReference<any>;
public key: string;
public tag: Tag;
- constructor(parent: VersionedPathReference<Option<OutletState>>, key: string) {
+ constructor(parent: VersionedPathReference<any>, key: string) {
this.parent = parent;
this.key = key;
this.tag = parent.tag;
}
- get(key) {
+ get(key: string): VersionedPathReference<any> {
return new ChildOutletStateReference(this, key);
}
- value() {
+ value(): any {
let parent = this.parent.value();
return parent && parent[this.key];
}
@@ -117,9 +117,9 @@ export default class OutletView {
public outletState: Option<OutletState>;
public _tag: TagWrapper<DirtyableTag>;
- static extend(injections) {
+ static extend(injections: any) {
return class extends OutletView {
- static create(options) {
+ static create(options: any) {
if (options) {
return super.create(assign({}, injections, options));
} else {
@@ -129,11 +129,11 @@ export default class OutletView {
};
}
- static reopenClass(injections) {
+ static reopenClass(injections: any) {
assign(this, injections);
}
- static create(options) {
+ static create(options: any) {
let { _environment, renderer, template } = options;
let owner = options[OWNER];
return new OutletView(_environment, renderer, owner, template);
| true |
Other
|
emberjs
|
ember.js
|
145711188a89a8cbdec0edc281d96cd74ba5780f.json
|
add more typing
|
packages/ember-runtime/lib/index.d.ts
|
@@ -0,0 +1,23 @@
+export const TargetActionSupport: any;
+export function isArray(arr: any): boolean;
+export const ControllerMixin: any;
+
+export function deprecatingAlias(name: string, opts: {
+ id: string;
+ until: string;
+}): any;
+
+export const inject: {
+ service(name: string): any;
+};
+
+export const FrameworkObject: any;
+
+export const String: {
+ dasherize(s: string): string;
+ loc(s: string, ...args: string[]): string;
+};
+
+export function objectAt(arr: any, i: number): any;
+
+export function isEmberArray(arr: any): boolean;
| true |
Other
|
emberjs
|
ember.js
|
145711188a89a8cbdec0edc281d96cd74ba5780f.json
|
add more typing
|
packages/ember-utils/lib/index.d.ts
|
@@ -0,0 +1,12 @@
+import { Opaque } from '@glimmer/interfaces';
+
+export const NAME_KEY: string;
+export function getOwner(obj: any): any;
+export function symbol(debugName: string): string;
+export function assign(original: any, ...args: any[]): any;
+export const OWNER: string;
+export const HAS_NATIVE_WEAKMAP: boolean;
+
+export function generateGuid(obj: Opaque, prefix?: string): string;
+export function guidFor(obj: Opaque): string;
+export function uuid(): number;
| true |
Other
|
emberjs
|
ember.js
|
145711188a89a8cbdec0edc281d96cd74ba5780f.json
|
add more typing
|
packages/ember-utils/lib/symbol.js
|
@@ -6,5 +6,5 @@ export default function symbol(debugName) {
// want to require non-enumerability for this API, which
// would introduce a large cost.
let id = GUID_KEY + Math.floor(Math.random() * new Date());
- return intern(`__${debugName}__ [id=${id}]`);
+ return intern(`__${debugName}${id}__`);
}
| true |
Other
|
emberjs
|
ember.js
|
145711188a89a8cbdec0edc281d96cd74ba5780f.json
|
add more typing
|
packages/ember-views/lib/index.d.ts
|
@@ -0,0 +1,36 @@
+import { Opaque } from '@glimmer/util';
+
+export const ActionSupport: any;
+export const ChildViewsSupport: any;
+export const ClassNamesSupport: any;
+export const CoreView: any;
+export const ViewMixin: any;
+export const ViewStateSupport: any;
+export const TextSupport: any;
+
+export function getViewElement(view: Opaque): Element;
+export function setViewElement(view: Opaque, element: Element);
+
+export function isSimpleClick(event: Event): boolean;
+
+export function constructStyleDeprecationMessage(affectedStyle: string): string;
+
+export function hasPartial(name: string, owner: any): boolean;
+
+export function lookupComponent(owner: any, name: string, options: any): any;
+
+export function lookupPartial(templateName: string, owner: any): any;
+
+export function getViewId(view: any): string;
+
+export const fallbackViewRegistry: {
+ [id: string]: any | undefined;
+}
+
+export const MUTABLE_CELL: string;
+
+export const ActionManager: {
+ registeredActions: {
+ [id: string]: any | undefined;
+ }
+};
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/component-managers/outlet.ts
|
@@ -1,13 +1,14 @@
-import { Option } from '@glimmer/interfaces/dist/types';
+import { Option } from '@glimmer/interfaces';
import {
ComponentDefinition,
DynamicScope,
+ Environment,
} from '@glimmer/runtime';
import { Destroyable } from '@glimmer/util/dist/types';
import { DEBUG } from 'ember-env-flags';
-import { Environment } from 'ember-glimmer';
import { _instrumentStart } from 'ember-metal';
import { generateGuid, guidFor } from 'ember-utils';
+import EmberEnvironment from '../environment';
import { RootReference } from '../utils/references';
import AbstractManager from './abstract';
@@ -42,7 +43,10 @@ class StateBucket {
}
class OutletComponentManager extends AbstractManager<StateBucket> {
- create(environment: Environment, definition: OutletComponentDefinition, _args, dynamicScope: OutletDynamicScope) {
+ create(environment: Environment,
+ definition: OutletComponentDefinition,
+ _args,
+ dynamicScope: OutletDynamicScope) {
if (DEBUG) {
this._pushToDebugStack(`template:${definition.template.meta.moduleName}`, environment);
}
@@ -54,7 +58,7 @@ class OutletComponentManager extends AbstractManager<StateBucket> {
}
layoutFor(definition, _bucket, env: Environment) {
- return env.getCompiledBlock(OutletLayoutCompiler, definition.template);
+ return (env as EmberEnvironment).getCompiledBlock(OutletLayoutCompiler, definition.template);
}
getSelf({ outletState }) {
@@ -117,7 +121,7 @@ class TopLevelOutletLayoutCompiler {
TopLevelOutletLayoutCompiler.id = 'top-level-outlet';
-export class OutletComponentDefinition extends ComponentDefinition<any> {
+export class OutletComponentDefinition extends ComponentDefinition<StateBucket> {
public outletName: string;
public template: any;
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/component-managers/render.ts
|
@@ -38,7 +38,7 @@ class SingletonRenderManager extends AbstractRenderManager {
_args: IArguments,
dynamicScope: DynamicScope) {
let { name } = definition;
- let controller = env.owner.lookup(`controller:${name}`) || generateController(env.owner, name);
+ let controller = env.owner.lookup<any>(`controller:${name}`) || generateController(env.owner, name);
if (DEBUG) {
this._pushToDebugStack(`controller:${name} (with the render helper)`, env);
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/environment.ts
|
@@ -6,9 +6,12 @@ import {
CompilableLayout,
CompiledDynamicProgram,
compileLayout,
+ ComponentDefinition,
Environment as GlimmerEnvironment,
getDynamicVar,
+ Helper,
isSafeString,
+ ModifierManager,
PartialDefinition,
} from '@glimmer/runtime';
import {
@@ -90,18 +93,18 @@ export default class Environment extends GlimmerEnvironment {
public isInteractive: boolean;
public destroyedComponents: Destroyable[];
public builtInModifiers: {
- [name: string]: any;
+ [name: string]: ModifierManager<Opaque>;
};
public builtInHelpers: {
- [name: string]: any;
+ [name: string]: Helper;
};
public debugStack: typeof DebugStack;
public inTransaction: boolean;
private _definitionCache: Cache<{
name: string;
source: string;
owner: Container;
- }, CurlyComponentDefinition | undefined>;
+ }, CurlyComponentDefinition>;
private _templateCache: Cache<{
Template: WrappedTemplateFactory | OwnedTemplate;
owner: Container;
@@ -121,19 +124,14 @@ export default class Environment extends GlimmerEnvironment {
this._definitionCache = new Cache(2000, ({ name, source, owner }) => {
let { component: componentFactory, layout } = lookupComponent(owner, name, { source });
let customManager: any;
+ if (GLIMMER_CUSTOM_COMPONENT_MANAGER) {
+ let managerId = layout && layout.meta.managerId;
- if (componentFactory || layout) {
- if (GLIMMER_CUSTOM_COMPONENT_MANAGER) {
- let managerId = layout && layout.meta.managerId;
-
- if (managerId) {
- customManager = owner.factoryFor<any>(`component-manager:${managerId}`).class;
- }
+ if (managerId) {
+ customManager = owner.factoryFor<any>(`component-manager:${managerId}`).class;
}
- return new CurlyComponentDefinition(name, componentFactory, layout, undefined, customManager);
}
-
- return undefined;
+ return new CurlyComponentDefinition(name, componentFactory, layout, undefined, customManager);
}, ({ name, source, owner }) => {
let expandedName = source && this._resolveLocalLookupName(name, source, owner) || name;
@@ -213,7 +211,7 @@ export default class Environment extends GlimmerEnvironment {
return false;
}
- getComponentDefinition(name, { owner, moduleName }) {
+ getComponentDefinition(name, { owner, moduleName }): ComponentDefinition<Opaque> {
let finalizer = _instrumentStart('render.getComponentDefinition', instrumentationPayload, name);
let source = moduleName && `template:${moduleName}`;
let definition = this._definitionCache.get({ name, source, owner });
@@ -262,7 +260,7 @@ export default class Environment extends GlimmerEnvironment {
owner.hasRegistration(`helper:${name}`);
}
- lookupHelper(name, meta) {
+ lookupHelper(name, meta): Helper {
if (name === 'component') {
return (vm, args) => componentHelper(vm, args, meta);
}
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/helpers/action.ts
|
@@ -1,7 +1,9 @@
/**
@module ember
*/
-import { isConst } from '@glimmer/reference';
+import { isConst, VersionedPathReference } from '@glimmer/reference';
+import { IArguments } from '@glimmer/runtime/dist/types/lib/vm/arguments';
+import { Opaque } from '@glimmer/util';
import { assert } from 'ember-debug';
import { DEBUG } from 'ember-env-flags';
import {
@@ -270,7 +272,7 @@ export const ACTION = symbol('ACTION');
@for Ember.Templates.helpers
@public
*/
-export default function(_vm, args): UnboundReference {
+export default function(_vm, args: IArguments): UnboundReference {
let { named, positional } = args;
let capturedArgs = positional.capture();
@@ -282,7 +284,7 @@ export default function(_vm, args): UnboundReference {
let [context, action, ...restArgs] = capturedArgs.references;
// TODO: Is there a better way of doing this?
- let debugKey = action._propertyKey;
+ let debugKey: string | undefined = (action as any)._propertyKey;
let target = named.has('target') ? named.get('target') : context;
let processArgs = makeArgsProcessor(named.has('value') && named.get('value'), restArgs);
@@ -304,23 +306,24 @@ export default function(_vm, args): UnboundReference {
function NOOP(args) { return args; }
-function makeArgsProcessor(valuePathRef, actionArgsRef) {
- let mergeArgs = null;
+function makeArgsProcessor(valuePathRef: VersionedPathReference<Opaque> | false,
+ actionArgsRef: Array<VersionedPathReference<Opaque>>) {
+ let mergeArgs;
if (actionArgsRef.length > 0) {
mergeArgs = (args) => {
return actionArgsRef.map((ref) => ref.value()).concat(args);
};
}
- let readValue = null;
+ let readValue;
if (valuePathRef) {
readValue = (args) => {
let valuePath = valuePathRef.value();
if (valuePath && args.length > 0) {
- args[0] = get(args[0], valuePath);
+ args[0] = get(args[0], valuePath as string);
}
return args;
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/helpers/component.ts
|
@@ -154,7 +154,7 @@ export class ClosureComponentReference extends CachedReference {
public meta: any;
public env: any;
public lastDefinition: any;
- public lastName: string;
+ public lastName: string | undefined;
constructor(args, meta, env) {
super();
@@ -175,7 +175,7 @@ export class ClosureComponentReference extends CachedReference {
// currying are in the assertion messages.
let { args, defRef, env, meta, lastDefinition, lastName } = this;
let nameOrDef = defRef.value();
- let definition = null;
+ let definition;
if (nameOrDef && nameOrDef === lastName) {
return lastDefinition;
@@ -192,7 +192,7 @@ export class ClosureComponentReference extends CachedReference {
definition = env.getComponentDefinition(nameOrDef, meta);
// tslint:disable-next-line:max-line-length
- assert(`The component helper cannot be used without a valid component name. You used "${nameOrDef}" via (component "${nameOrDef}")`, definition);
+ assert(`The component helper cannot be used without a valid component name. You used "${nameOrDef}" via (component "${nameOrDef}")`, !!definition);
} else if (isComponentDefinition(nameOrDef)) {
definition = nameOrDef;
} else {
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/modifiers/action.ts
|
@@ -190,7 +190,7 @@ export default class ActionModifierManager {
}
}
- let actionArgs = [];
+ let actionArgs: any[] = [];
// The first two arguments are (1) `this` and (2) the action name.
// Everything else is a param.
for (let i = 2; i < positional.length; i++) {
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/renderer.ts
|
@@ -1,9 +1,11 @@
-import { Simple } from '@glimmer/interfaces';
+import { Option, Simple } from '@glimmer/interfaces';
import { CURRENT_TAG, VersionedPathReference } from '@glimmer/reference';
-import { IteratorResult } from '@glimmer/runtime';
+import {
+ DynamicScope as GlimmerDynamicScope,
+ IteratorResult,
+} from '@glimmer/runtime';
import { Opaque } from '@glimmer/util';
import { assert } from 'ember-debug';
-import { Environment } from 'ember-glimmer';
import {
run,
runInTransaction,
@@ -18,19 +20,25 @@ import {
import { BOUNDS } from './component';
import { TopLevelOutletComponentDefinition } from './component-managers/outlet';
import { RootComponentDefinition } from './component-managers/root';
+import Environment from './environment';
import { OwnedTemplate } from './template';
import { RootReference } from './utils/references';
-import OutletView, { OutletState, OutletStateReference } from './views/outlet';
+import OutletView, { OutletState, RootOutletStateReference } from './views/outlet';
-import { ComponentDefinition, RenderResult } from '@glimmer/runtime';
+import { ComponentDefinition, NULL_REFERENCE, RenderResult } from '@glimmer/runtime';
const { backburner } = run;
-export class DynamicScope {
+export class DynamicScope implements GlimmerDynamicScope {
+ outletState: VersionedPathReference<Option<OutletState>>;
+ rootOutletState: RootOutletStateReference | undefined;
+
constructor(
public view: Opaque,
- public outletState?: VersionedPathReference<OutletState>,
- public rootOutletState?: OutletStateReference) {
+ outletState: VersionedPathReference<Option<OutletState>>,
+ rootOutletState?: RootOutletStateReference) {
+ this.outletState = outletState;
+ this.rootOutletState = rootOutletState;
}
child() {
@@ -39,13 +47,13 @@ export class DynamicScope {
);
}
- get(key) {
+ get(key: 'outletState'): VersionedPathReference<Option<OutletState>> {
// tslint:disable-next-line:max-line-length
assert(`Using \`-get-dynamic-scope\` is only supported for \`outletState\` (you used \`${key}\`).`, key === 'outletState');
return this.outletState;
}
- set(key, value) {
+ set(key: 'outletState', value: VersionedPathReference<Option<OutletState>>) {
// tslint:disable-next-line:max-line-length
assert(`Using \`-with-dynamic-scope\` is only supported for \`outletState\` (you used \`${key}\`).`, key === 'outletState');
this.outletState = value;
@@ -57,7 +65,7 @@ class RootState {
public id: string;
public env: Environment;
public root: Opaque;
- public result: RenderResult;
+ public result: RenderResult | undefined;
public shouldReflush: boolean;
public destroyed: boolean;
public options: {
@@ -111,10 +119,10 @@ class RootState {
this.destroyed = true;
- this.env = null;
+ this.env = undefined as any;
this.root = null;
- this.result = null;
- this.render = null;
+ this.result = undefined;
+ this.render = undefined as any;
if (result) {
/*
@@ -142,7 +150,7 @@ class RootState {
}
}
-const renderers: any[] = [];
+const renderers: Renderer[] = [];
export function _resetRenderers() {
renderers.length = 0;
@@ -209,7 +217,7 @@ export abstract class Renderer {
this._destinedForDOM = destinedForDOM;
this._destroyed = false;
this._roots = [];
- this._lastRevision = null;
+ this._lastRevision = -1;
this._isRenderingRoots = false;
this._removedRoots = [];
}
@@ -233,9 +241,9 @@ export abstract class Renderer {
root: Opaque,
definition: ComponentDefinition<Opaque>,
target: Simple.Element,
- outletStateReference?: OutletStateReference) {
+ outletStateReference?: RootOutletStateReference) {
let self = new RootReference(definition);
- let dynamicScope = new DynamicScope(null, outletStateReference, outletStateReference);
+ let dynamicScope = new DynamicScope(null, outletStateReference || NULL_REFERENCE, outletStateReference);
let rootState = new RootState(root, this._env, this._rootTemplate, self, target, dynamicScope);
this._renderRoot(rootState);
@@ -376,7 +384,7 @@ export abstract class Renderer {
while (removedRoots.length) {
let root = removedRoots.pop();
- let rootIndex = roots.indexOf(root);
+ let rootIndex = roots.indexOf(root!);
roots.splice(rootIndex, 1);
}
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/templates/component.d.ts
|
@@ -1,2 +1,3 @@
-declare const TEMPLATE: any;
+import { WrappedTemplateFactory } from '../template';
+declare const TEMPLATE: WrappedTemplateFactory;
export default TEMPLATE;
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/templates/empty.d.ts
|
@@ -1,2 +1,3 @@
-declare const TEMPLATE: any;
+import { WrappedTemplateFactory } from '../template';
+declare const TEMPLATE: WrappedTemplateFactory;
export default TEMPLATE;
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/templates/link-to.d.ts
|
@@ -1,2 +1,3 @@
-declare const TEMPLATE: any;
+import { WrappedTemplateFactory } from '../template';
+declare const TEMPLATE: WrappedTemplateFactory;
export default TEMPLATE;
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/templates/outlet.d.ts
|
@@ -1,2 +1,3 @@
-declare const TEMPLATE: any;
+import { WrappedTemplateFactory } from '../template';
+declare const TEMPLATE: WrappedTemplateFactory;
export default TEMPLATE;
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/templates/root.d.ts
|
@@ -1,2 +1,3 @@
-declare const TEMPLATE: any;
+import { WrappedTemplateFactory } from '../template';
+declare const TEMPLATE: WrappedTemplateFactory;
export default TEMPLATE;
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/lib/views/outlet.ts
|
@@ -1,28 +1,28 @@
import { Simple } from '@glimmer/interfaces';
-import { DirtyableTag, VersionedPathReference } from '@glimmer/reference';
+import { DirtyableTag, Tag, TagWrapper, VersionedPathReference } from '@glimmer/reference';
+import { Opaque, Option } from '@glimmer/util';
import { environment } from 'ember-environment';
import { run } from 'ember-metal';
-import { assign } from 'ember-utils';
-import { OWNER } from 'ember-utils';
-import Environment from '../environment';
+import { assign, OWNER } from 'ember-utils';
import { Renderer } from '../renderer';
+import { Container, OwnedTemplate } from '../template';
-export class OutletStateReference implements VersionedPathReference<OutletState> {
- public tag: any;
+export class RootOutletStateReference implements VersionedPathReference<Option<OutletState>> {
+ tag: Tag;
constructor(public outletView: OutletView) {
this.tag = outletView._tag;
}
- get(key: string): VersionedPathReference<OutletState> {
+ get(key: string): VersionedPathReference<Option<OutletState>> {
return new ChildOutletStateReference(this, key);
}
- value(): OutletState {
+ value(): Option<OutletState> {
return this.outletView.outletState;
}
- getOrphan(name: string): VersionedPathReference<OutletState> {
+ getOrphan(name: string): VersionedPathReference<Option<OutletState>> {
return new OrphanedOutletStateReference(this, name);
}
@@ -34,17 +34,17 @@ export class OutletStateReference implements VersionedPathReference<OutletState>
// So this is a relic of the past that SHOULD go away
// in 3.0. Preferably it is deprecated in the release that
// follows the Glimmer release.
-class OrphanedOutletStateReference extends OutletStateReference {
+class OrphanedOutletStateReference extends RootOutletStateReference {
public root: any;
public name: string;
- constructor(root, name) {
+ constructor(root: RootOutletStateReference, name: string) {
super(root.outletView);
this.root = root;
this.name = name;
}
- value(): OutletState {
+ value(): Option<OutletState> {
let rootState = this.root.value();
let orphans = rootState.outlets.main.outlets.__ember_orphans__;
@@ -66,12 +66,12 @@ class OrphanedOutletStateReference extends OutletStateReference {
}
}
-class ChildOutletStateReference {
- public parent: any;
+class ChildOutletStateReference implements VersionedPathReference<Option<OutletState>> {
+ public parent: VersionedPathReference<Option<OutletState>>;
public key: string;
- public tag: any;
+ public tag: Tag;
- constructor(parent, key) {
+ constructor(parent: VersionedPathReference<Option<OutletState>>, key: string) {
this.parent = parent;
this.key = key;
this.tag = parent.tag;
@@ -82,32 +82,40 @@ class ChildOutletStateReference {
}
value() {
- return this.parent.value()[this.key];
+ let parent = this.parent.value();
+ return parent && parent[this.key];
}
}
+export interface RenderState {
+ owner: Container | undefined;
+ into: string | undefined;
+ outlet: string;
+ name: string;
+ controller: Opaque;
+ template: OwnedTemplate | undefined;
+}
+
export interface OutletState {
outlets: {
- [name: string]: OutletState;
- };
- render: {
- owner: any | undefined,
- into: string,
- outlet: string,
- name: string,
- controller: any | undefined,
- ViewClass: Function | undefined,
- template: any | undefined,
+ [name: string]: OutletState | undefined;
};
+ render: RenderState | undefined;
+}
+
+export interface BootEnvironment {
+ hasDOM: boolean;
+ isInteractive: boolean;
+ options: any;
}
export default class OutletView {
- private _environment: Environment;
+ private _environment: BootEnvironment;
public renderer: Renderer;
- public owner: any;
- public template: any;
- public outletState: OutletState;
- public _tag: DirtyableTag;
+ public owner: Container;
+ public template: OwnedTemplate;
+ public outletState: Option<OutletState>;
+ public _tag: TagWrapper<DirtyableTag>;
static extend(injections) {
return class extends OutletView {
@@ -131,13 +139,13 @@ export default class OutletView {
return new OutletView(_environment, renderer, owner, template);
}
- constructor(_environment, renderer, owner, template) {
+ constructor(_environment: BootEnvironment, renderer: Renderer, owner: Container, template: OwnedTemplate) {
this._environment = _environment;
this.renderer = renderer;
this.owner = owner;
this.template = template;
this.outletState = null;
- this._tag = new DirtyableTag();
+ this._tag = DirtyableTag.create();
}
appendTo(selector: string | Simple.Element) {
@@ -153,7 +161,7 @@ export default class OutletView {
run.schedule('render', this.renderer, 'appendOutletView', this, target);
}
- rerender() { }
+ rerender() { /**/ }
setOutletState(state: OutletState) {
this.outletState = {
@@ -166,16 +174,15 @@ export default class OutletView {
outlet: 'main',
name: '-top-level',
controller: undefined,
- ViewClass: undefined,
template: undefined,
},
};
- this._tag.dirty();
+ this._tag.inner.dirty();
}
toReference() {
- return new OutletStateReference(this);
+ return new RootOutletStateReference(this);
}
- destroy() { }
+ destroy() { /**/ }
}
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-glimmer/tests/integration/outlet-test.js
|
@@ -19,7 +19,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'application',
controller: undefined,
- ViewClass: undefined,
template: undefined
},
@@ -41,7 +40,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'application',
controller: undefined,
- ViewClass: undefined,
template: undefined
},
@@ -62,7 +60,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'application',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:application')
},
outlets: Object.create(null)
@@ -82,7 +79,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'index',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:index')
},
outlets: Object.create(null)
@@ -102,7 +98,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'application',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:application')
},
outlets: Object.create(null)
@@ -124,7 +119,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'index',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:index')
},
outlets: Object.create(null)
@@ -144,7 +138,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'application',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:application')
},
outlets: Object.create(null)
@@ -166,7 +159,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'special',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:special')
},
outlets: Object.create(null)
@@ -186,7 +178,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'application',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:application')
},
outlets: Object.create(null)
@@ -208,7 +199,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'special',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:special')
},
outlets: Object.create(null)
@@ -229,7 +219,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'application',
controller,
- ViewClass: undefined,
template: this.owner.lookup('template:application')
},
outlets: Object.create(null)
@@ -251,7 +240,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'foo',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:foo')
},
outlets: Object.create(null)
@@ -265,7 +253,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'bar',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:bar')
},
outlets: Object.create(null)
@@ -297,7 +284,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'outer',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:outer')
},
outlets: {
@@ -308,7 +294,6 @@ moduleFor('outlet view', class extends RenderingTest {
outlet: 'main',
name: 'inner',
controller: {},
- ViewClass: undefined,
template: this.owner.lookup('template:inner')
},
outlets: Object.create(null)
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
packages/ember-routing/lib/system/route.js
|
@@ -2178,7 +2178,6 @@ let Route = EmberObject.extend(ActionHandler, Evented, {
name: connection.name,
controller: undefined,
template: undefined,
- ViewClass: undefined
};
run.once(this.router, '_setOutlets');
}
@@ -2283,7 +2282,6 @@ function buildRenderOptions(route, isDefaultRender, _name, options) {
name,
controller,
template: template || route._topLevelViewTemplate,
- ViewClass: undefined
};
if (DEBUG) {
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
tests/node/helpers/component-module.js
|
@@ -74,8 +74,7 @@ function setupComponentTest() {
outlet: 'main',
name: 'application',
controller: module,
- ViewClass: undefined,
- template: OutletTemplate
+ template: OutletTemplate,
},
outlets: { }
@@ -108,7 +107,6 @@ function render(_template) {
outlet: 'main',
name: 'index',
controller: this,
- ViewClass: undefined,
template: this.owner.lookup(templateFullName),
outlets: { }
};
| true |
Other
|
emberjs
|
ember.js
|
809720f8dd5dc305f76becb70d7738de99fcdcde.json
|
add strict null checking
|
tsconfig.json
|
@@ -19,7 +19,7 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
// "allowUnreachableCode": false,
- // "strictNullChecks": true,
+ "strictNullChecks": true,
"noImplicitReturns": true,
"noImplicitThis": true,
| true |
Other
|
emberjs
|
ember.js
|
d3326e56bcaffd35bee39400f180518138b17920.json
|
Add stricter typing
|
packages/ember-glimmer/lib/environment.ts
|
@@ -3,6 +3,8 @@ import {
} from '@glimmer/reference';
import {
AttributeManager,
+ CompilableLayout,
+ CompiledDynamicProgram,
compileLayout,
Environment as GlimmerEnvironment,
getDynamicVar,
@@ -64,12 +66,21 @@ import {
EMBER_MODULE_UNIFICATION,
GLIMMER_CUSTOM_COMPONENT_MANAGER,
} from 'ember/features';
-import { Container } from './template';
+import { Container, OwnedTemplate, WrappedTemplateFactory } from './template';
function instrumentationPayload(name) {
return { object: `component:${name}` };
}
+function isTemplateFactory(template: OwnedTemplate | WrappedTemplateFactory): template is WrappedTemplateFactory {
+ return typeof (template as WrappedTemplateFactory).create === 'function';
+}
+
+export interface CompilerFactory {
+ id: string;
+ new (template: OwnedTemplate): CompilableLayout;
+}
+
export default class Environment extends GlimmerEnvironment {
static create(options) {
return new this(options);
@@ -86,9 +97,16 @@ export default class Environment extends GlimmerEnvironment {
};
public debugStack: typeof DebugStack;
public inTransaction: boolean;
- private _definitionCache: Cache;
- private _templateCache: Cache;
- private _compilerCache: Cache;
+ private _definitionCache: Cache<{
+ name: string;
+ source: string;
+ owner: Container;
+ }, CurlyComponentDefinition | undefined>;
+ private _templateCache: Cache<{
+ Template: WrappedTemplateFactory | OwnedTemplate;
+ owner: Container;
+ }, OwnedTemplate>;
+ private _compilerCache: Cache<CompilerFactory, Cache<OwnedTemplate, CompiledDynamicProgram>>;
constructor(injections: any) {
super(injections);
@@ -102,18 +120,20 @@ export default class Environment extends GlimmerEnvironment {
this._definitionCache = new Cache(2000, ({ name, source, owner }) => {
let { component: componentFactory, layout } = lookupComponent(owner, name, { source });
- let customManager;
+ let customManager: any;
if (componentFactory || layout) {
if (GLIMMER_CUSTOM_COMPONENT_MANAGER) {
let managerId = layout && layout.meta.managerId;
if (managerId) {
- customManager = owner.factoryFor(`component-manager:${managerId}`).class;
+ customManager = owner.factoryFor<any>(`component-manager:${managerId}`).class;
}
}
return new CurlyComponentDefinition(name, componentFactory, layout, undefined, customManager);
}
+
+ return undefined;
}, ({ name, source, owner }) => {
let expandedName = source && this._resolveLocalLookupName(name, source, owner) || name;
@@ -123,7 +143,7 @@ export default class Environment extends GlimmerEnvironment {
});
this._templateCache = new Cache(1000, ({ Template, owner }) => {
- if (Template.create) {
+ if (isTemplateFactory(Template)) {
// we received a factory
return Template.create({ env: this, [OWNER]: owner });
} else {
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.