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
|
d3326e56bcaffd35bee39400f180518138b17920.json
|
Add stricter typing
|
packages/ember-glimmer/lib/template.ts
|
@@ -7,18 +7,20 @@ import { OWNER } from 'ember-utils';
export interface Container {
lookup<T>(name: string): T;
+ factoryFor<T>(name: string): T;
}
export type OwnedTemplate = Template<{
moduleName: string;
owner: Container;
}>;
-class WrappedTemplateFactory {
+export class WrappedTemplateFactory {
id: string;
meta: {
moduleName: string;
};
+
constructor(public factory: TemplateFactory<{
moduleName: string;
}, {
| true |
Other
|
emberjs
|
ember.js
|
d3326e56bcaffd35bee39400f180518138b17920.json
|
Add stricter typing
|
packages/ember-metal/lib/index.d.ts
|
@@ -41,7 +41,7 @@ export function watchKey(obj: any, keyName: string, meta?: any): void;
export function isProxy(value: any): boolean;
-export class Cache {
- constructor(limit: number, func: (obj: any) => any, key: any, store?: any)
- get(obj): any
-}
\ No newline at end of file
+export class Cache<T, V> {
+ constructor(limit: number, func: (obj: T) => V, key?: (obj: T) => string, store?: any)
+ get(obj: T): V
+}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/component-managers/abstract.ts
|
@@ -2,7 +2,6 @@ import { ProgramSymbolTable } from '@glimmer/interfaces';
import { Tag, VersionedPathReference } from '@glimmer/reference';
import {
Bounds,
- CompiledDynamicProgram,
CompiledDynamicTemplate,
ComponentDefinition,
ComponentManager,
@@ -12,23 +11,24 @@ import {
PreparedArguments,
} from '@glimmer/runtime';
import { IArguments } from '@glimmer/runtime/dist/types/lib/vm/arguments';
-import { Destroyable, Opaque, Option } from '@glimmer/util';
+import { Destroyable, Option } from '@glimmer/util';
import { DEBUG } from 'ember-env-flags';
+import DebugStack from '../utils/debug-stack';
// implements the ComponentManager interface as defined in glimmer:
// 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> {
- public debugStack: any;
+ public debugStack: typeof DebugStack;
public _pushToDebugStack: (name: string, environment: any) => void;
public _pushEngineToDebugStack: (name: string, environment: any) => void;
constructor() {
this.debugStack = undefined;
}
- prepareArgs(definition: ComponentDefinition<T>, args: IArguments): Option<PreparedArguments> {
+ prepareArgs(_definition: ComponentDefinition<T>, _args: IArguments): Option<PreparedArguments> {
return null;
}
@@ -44,41 +44,43 @@ export default abstract class AbstractManager<T> implements ComponentManager<T>
caller: VersionedPathReference<void | {}>,
hasDefaultBlock: boolean): T;
abstract layoutFor(
- definition: ComponentDefinition<T>, component: T, env: Environment): CompiledDynamicTemplate<ProgramSymbolTable>;
+ definition: ComponentDefinition<T>,
+ component: T,
+ env: Environment): CompiledDynamicTemplate<ProgramSymbolTable>;
abstract getSelf(component: T): VersionedPathReference<void | {}>;
- didCreateElement(component: T, element: Element, operations: ElementOperations): void {
+ didCreateElement(_component: T, _element: Element, _operations: ElementOperations): void {
// noop
}
// inheritors should also call `this.debugStack.pop()` to
// ensure the rerendering assertion messages are properly
// maintained
- didRenderLayout(component: T, bounds: Bounds): void {
+ didRenderLayout(_component: T, _bounds: Bounds): void {
// noop
}
- didCreate(bucket: T): void {
+ didCreate(_bucket: T): void {
// noop
}
- getTag(bucket: T): Option<Tag> { return null; }
+ getTag(_bucket: T): Option<Tag> { return null; }
// inheritors should also call `this._pushToDebugStack`
// to ensure the rerendering assertion messages are
// properly maintained
- update(bucket: T, dynamicScope: DynamicScope): void {
+ update(_bucket: T, _dynamicScope: DynamicScope): void {
// noop
}
// inheritors should also call `this.debugStack.pop()` to
// ensure the rerendering assertion messages are properly
// maintained
- didUpdateLayout(bucket: T, bounds: Bounds): void {
+ didUpdateLayout(_bucket: T, _bounds: Bounds): void {
// noop
}
- didUpdate(bucket: T): void {
+ didUpdate(_bucket: T): void {
// noop
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/component-managers/mount.ts
|
@@ -23,7 +23,7 @@ interface EngineBucket {
}
class MountManager extends AbstractManager<EngineBucket> {
- create(environment, { name }, args, dynamicScope) {
+ create(environment, { name }, args) {
if (DEBUG) {
this._pushEngineToDebugStack(`engine:${name}`, environment);
}
@@ -41,7 +41,7 @@ class MountManager extends AbstractManager<EngineBucket> {
return bucket;
}
- layoutFor(definition, { engine }, env) {
+ layoutFor(_definition, { engine }, env) {
let template = engine.lookup(`template:application`);
return env.getCompiledBlock(OutletLayoutCompiler, template);
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/component-managers/outlet.ts
|
@@ -42,7 +42,7 @@ 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);
}
@@ -53,38 +53,38 @@ class OutletComponentManager extends AbstractManager<StateBucket> {
return new StateBucket(outletState);
}
- layoutFor(definition, bucket, env) {
+ layoutFor(definition, _bucket, env: Environment) {
return env.getCompiledBlock(OutletLayoutCompiler, definition.template);
}
getSelf({ outletState }) {
return new RootReference(outletState.render.controller);
}
- didRenderLayout(bucket) {
+ didRenderLayout(bucket: StateBucket) {
bucket.finalize();
if (DEBUG) {
this.debugStack.pop();
}
}
- getDestructor(bucket: StateBucket): Option<Destroyable> {
+ getDestructor(): Option<Destroyable> {
return null;
}
}
const MANAGER = new OutletComponentManager();
class TopLevelOutletComponentManager extends OutletComponentManager {
- create(environment, definition, args, dynamicScope) {
+ create(environment, definition, _args, dynamicScope) {
if (DEBUG) {
this._pushToDebugStack(`template:${definition.template.meta.moduleName}`, environment);
}
return new StateBucket(dynamicScope.outletState.value());
}
- layoutFor(definition, bucket, env) {
+ layoutFor(definition, _bucket, env) {
return env.getCompiledBlock(TopLevelOutletLayoutCompiler, definition.template);
}
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/component-managers/render.ts
|
@@ -1,13 +1,9 @@
-import {
- VersionedPathReference,
-} from '@glimmer/reference';
import {
ComponentDefinition,
} from '@glimmer/runtime';
import { IArguments } from '@glimmer/runtime/dist/types/lib/vm/arguments';
import { Destroyable } from '@glimmer/util';
-import { assert } from 'ember-debug';
import { DEBUG } from 'ember-env-flags';
import { generateController, generateControllerFactory } from 'ember-routing';
import Environment from '../environment';
@@ -17,7 +13,7 @@ import AbstractManager from './abstract';
import { OutletLayoutCompiler } from './outlet';
export abstract class AbstractRenderManager extends AbstractManager<RenderState> {
- layoutFor(definition, bucket, env) {
+ layoutFor(definition: RenderDefinition, _bucket, env) {
return env.getCompiledBlock(OutletLayoutCompiler, definition.template);
}
@@ -37,7 +33,10 @@ export interface RenderState {
}
class SingletonRenderManager extends AbstractRenderManager {
- create(env: Environment, definition: ComponentDefinition<RenderState>, args: IArguments, dynamicScope: DynamicScope) {
+ create(env: Environment,
+ definition: ComponentDefinition<RenderState>,
+ _args: IArguments,
+ dynamicScope: DynamicScope) {
let { name } = definition;
let controller = env.owner.lookup(`controller:${name}`) || generateController(env.owner, name);
@@ -79,7 +78,7 @@ class NonSingletonRenderManager extends AbstractRenderManager {
return { controller, model: modelRef };
}
- update({ controller, model }, dynamicScope) {
+ update({ controller, model }) {
controller.set('model', model.value());
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/component-managers/root.ts
|
@@ -1,9 +1,6 @@
import {
ComponentDefinition,
} from '@glimmer/runtime';
-import {
- assert,
-} from 'ember-debug';
import { DEBUG } from 'ember-env-flags';
import {
_instrumentStart,
@@ -15,7 +12,7 @@ import CurlyComponentManager, {
} from './curly';
class RootComponentManager extends CurlyComponentManager {
- create(environment, definition, args, dynamicScope, currentScope, hasBlock) {
+ create(environment, definition, args, dynamicScope) {
let component = definition.ComponentClass.create();
if (DEBUG) {
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/components/link-to.ts
|
@@ -543,10 +543,10 @@ const LinkComponent = EmberComponent.extend({
@private
*/
disabled: computed({
- get(key, value) {
+ get(_key) {
return false;
},
- set(key, value) {
+ set(_key, value) {
if (value !== undefined) { this.set('_isDisabled', value); }
return value ? get(this, 'disabledClass') : false;
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/components/text_field.ts
|
@@ -103,7 +103,7 @@ export default Component.extend(TextSupport, {
return 'text';
},
- set(key, value) {
+ set(_key, value) {
let type = 'text';
if (canSetTypeOfInput(value)) {
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/environment.ts
|
@@ -1,11 +1,9 @@
-/// <reference path="../externs.d.ts"/>
import {
Reference,
} from '@glimmer/reference';
import {
AttributeManager,
compileLayout,
- DOMTreeConstruction,
Environment as GlimmerEnvironment,
getDynamicVar,
isSafeString,
@@ -14,7 +12,7 @@ import {
import {
Destroyable, Opaque,
} from '@glimmer/util';
-import { assert, warn } from 'ember-debug';
+import { warn } from 'ember-debug';
import { DEBUG } from 'ember-env-flags';
import { _instrumentStart, Cache } from 'ember-metal';
import { guidFor, OWNER } from 'ember-utils';
@@ -62,7 +60,6 @@ import { default as unbound } from './helpers/unbound';
import { default as ActionModifierManager } from './modifiers/action';
import installPlatformSpecificProtocolForURL from './protocol-for-url';
-import { DOMChanges } from '@glimmer/runtime/dist/types/lib/dom/helper';
import {
EMBER_MODULE_UNIFICATION,
GLIMMER_CUSTOM_COMPONENT_MANAGER,
@@ -95,8 +92,8 @@ export default class Environment extends GlimmerEnvironment {
constructor(injections: any) {
super(injections);
- let owner = this.owner = injections[OWNER];
- this.isInteractive = owner.lookup('-environment:main').isInteractive;
+ this.owner = injections[OWNER];
+ this.isInteractive = this.owner.lookup<any>('-environment:main').isInteractive;
// can be removed once https://github.com/tildeio/glimmer/pull/305 lands
this.destroyedComponents = [];
@@ -262,7 +259,7 @@ export default class Environment extends GlimmerEnvironment {
// TODO: try to unify this into a consistent protocol to avoid wasteful closure allocations
if (helperFactory.class.isHelperInstance) {
- return (vm, args) => SimpleHelperReference.create(helperFactory.class.compute, args.capture());
+ return (_vm, args) => SimpleHelperReference.create(helperFactory.class.compute, args.capture());
} else if (helperFactory.class.isHelperFactory) {
return (vm, args) => ClassBasedHelperReference.create(helperFactory, vm, args.capture());
} else {
@@ -355,7 +352,7 @@ if (DEBUG) {
let STYLE_ATTRIBUTE_MANANGER = new StyleAttributeManager('style');
- Environment.prototype.attributeFor = function(element, attribute, isTrusting, namespace) {
+ Environment.prototype.attributeFor = function(element, attribute, isTrusting) {
if (attribute === 'style' && !isTrusting) {
return STYLE_ATTRIBUTE_MANANGER;
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/-class.ts
|
@@ -23,6 +23,6 @@ function classHelper({ positional }) {
return value;
}
-export default function(vm, args) {
+export default function(_vm, args) {
return new InternalHelperReference(classHelper, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/-html-safe.ts
|
@@ -6,6 +6,6 @@ function htmlSafe({ positional }) {
return new SafeString(path.value());
}
-export default function(vm, args) {
+export default function(_vm, args) {
return new InternalHelperReference(htmlSafe, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/-input-type.ts
|
@@ -1,13 +1,13 @@
import { InternalHelperReference } from '../utils/references';
-function inputTypeHelper({ positional, named }) {
+function inputTypeHelper({ positional }) {
let type = positional.at(0).value();
if (type === 'checkbox') {
return '-checkbox';
}
return '-text-field';
}
-export default function(vm, args) {
+export default function(_vm, args) {
return new InternalHelperReference(inputTypeHelper, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/-normalize-class.ts
|
@@ -1,7 +1,7 @@
import { String as StringUtils } from 'ember-runtime';
import { InternalHelperReference } from '../utils/references';
-function normalizeClass({ positional, named }) {
+function normalizeClass({ positional }) {
let classNameParts = positional.at(0).value().split('.');
let className = classNameParts[classNameParts.length - 1];
let value = positional.at(1).value();
@@ -15,6 +15,6 @@ function normalizeClass({ positional, named }) {
}
}
-export default function(vm, args) {
+export default function(_vm, args) {
return new InternalHelperReference(normalizeClass, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/action.ts
|
@@ -270,7 +270,7 @@ export const ACTION = symbol('ACTION');
@for Ember.Templates.helpers
@public
*/
-export default function(vm, args): UnboundReference {
+export default function(_vm, args): UnboundReference {
let { named, positional } = args;
let capturedArgs = positional.capture();
@@ -308,15 +308,15 @@ function makeArgsProcessor(valuePathRef, actionArgsRef) {
let mergeArgs = null;
if (actionArgsRef.length > 0) {
- mergeArgs = function(args) {
+ mergeArgs = (args) => {
return actionArgsRef.map((ref) => ref.value()).concat(args);
};
}
let readValue = null;
if (valuePathRef) {
- readValue = function(args) {
+ readValue = (args) => {
let valuePath = valuePathRef.value();
if (valuePath && args.length > 0) {
@@ -328,7 +328,7 @@ function makeArgsProcessor(valuePathRef, actionArgsRef) {
}
if (mergeArgs && readValue) {
- return function(args) {
+ return (args) => {
return readValue(mergeArgs(args));
};
} else {
@@ -342,13 +342,14 @@ function makeDynamicClosureAction(context, targetRef, actionRef, processArgs, de
makeClosureAction(context, targetRef.value(), actionRef.value(), processArgs, debugKey);
}
- return function(...args) {
+ return (...args) => {
return makeClosureAction(context, targetRef.value(), actionRef.value(), processArgs, debugKey)(...args);
};
}
function makeClosureAction(context, target, action, processArgs, debugKey) {
- let self, fn;
+ let self;
+ let fn;
assert(`Action passed is null or undefined in (action) from ${target}.`, !isNone(action));
@@ -367,11 +368,12 @@ function makeClosureAction(context, target, action, processArgs, debugKey) {
self = context;
fn = action;
} else {
+ // tslint:disable-next-line:max-line-length
assert(`An action could not be made for \`${debugKey || action}\` in ${target}. Please confirm that you are using either a quoted action name (i.e. \`(action '${debugKey || 'myAction'}')\`) or a function available in ${target}.`, false);
}
}
- return function(...args) {
+ return (...args) => {
let payload = { target: self, args, label: '@glimmer/closure-action' };
return flaggedInstrument('interaction.ember-action', payload, () => {
return run.join(self, fn, ...processArgs(args));
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/component.ts
|
@@ -144,6 +144,10 @@ import { CachedReference } from '../utils/references';
@public
*/
export class ClosureComponentReference extends CachedReference {
+ static create(args, meta, env) {
+ return new ClosureComponentReference(args, meta, env);
+ }
+
public defRef: any;
public tag: any;
public args: any;
@@ -152,10 +156,6 @@ export class ClosureComponentReference extends CachedReference {
public lastDefinition: any;
public lastName: string;
- static create(args, meta, env) {
- return new ClosureComponentReference(args, meta, env);
- }
-
constructor(args, meta, env) {
super();
@@ -184,9 +184,14 @@ export class ClosureComponentReference extends CachedReference {
this.lastName = nameOrDef;
if (typeof nameOrDef === 'string') {
+ // tslint:disable-next-line:max-line-length
assert('You cannot use the input helper as a contextual helper. Please extend TextField or Checkbox to use it as a contextual component.', nameOrDef !== 'input');
+ // tslint:disable-next-line:max-line-length
assert('You cannot use the textarea helper as a contextual helper. Please extend TextArea to use it as a contextual component.', nameOrDef !== 'textarea');
+
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);
} else if (isComponentDefinition(nameOrDef)) {
definition = nameOrDef;
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/concat.ts
|
@@ -25,6 +25,6 @@ function concat({ positional }) {
return positional.value().map(normalizeTextValue).join('');
}
-export default function(vm, args) {
+export default function(_vm, args) {
return new InternalHelperReference(concat, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/each-in.ts
|
@@ -115,7 +115,7 @@ export function isEachIn(ref): boolean {
return ref && ref[EACH_IN_REFERENCE];
}
-export default function(vm, args) {
+export default function(_vm, args) {
let ref = Object.create(args.positional.at(0));
ref[EACH_IN_REFERENCE] = true;
return ref;
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/get.ts
|
@@ -60,7 +60,7 @@ import { CachedReference, UPDATE } from '../utils/references';
@since 2.1.0
*/
-export default function(vm, args) {
+export default function(_vm, args) {
return GetHelperReference.create(args.positional.at(0), args.positional.at(1));
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/hash.ts
|
@@ -41,6 +41,6 @@
@public
*/
-export default function(vm, args) {
+export default function(_vm, args) {
return args.named.capture();
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/if-unless.ts
|
@@ -133,7 +133,7 @@ class ConditionalHelperReference extends CachedReference {
@for Ember.Templates.helpers
@public
*/
-export function inlineIf(vm, { positional }) {
+export function inlineIf(_vm, { positional }) {
assert(
'The inline form of the `if` helper expects two or three arguments, e.g. ' +
'`{{if trialExpired "Expired" expiryDate}}`.',
@@ -162,7 +162,7 @@ export function inlineIf(vm, { positional }) {
@for Ember.Templates.helpers
@public
*/
-export function inlineUnless(vm, { positional }) {
+export function inlineUnless(_vm, { positional }) {
assert(
'The inline form of the `unless` helper expects two or three arguments, e.g. ' +
'`{{unless isFirstLogin "Welcome back!"}}`.',
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/loc.ts
|
@@ -41,6 +41,6 @@ function locHelper({ positional }) {
return StringUtils.loc.apply(null, positional.value());
}
-export default function(vm, args) {
+export default function(_vm, args) {
return new InternalHelperReference(locHelper, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/log.ts
|
@@ -22,6 +22,6 @@ function log({ positional }) {
Logger.log.apply(null, positional.value());
}
-export default function(vm, args) {
+export default function(_vm, args) {
return new InternalHelperReference(log, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/mut.ts
|
@@ -86,7 +86,7 @@ export function unMut(ref) {
return ref[SOURCE] || ref;
}
-export default function(vm, args) {
+export default function(_vm, args) {
let rawRef = args.positional.at(0);
if (isMut(rawRef)) {
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/query-param.ts
|
@@ -23,13 +23,14 @@ import { InternalHelperReference } from '../utils/references';
@public
*/
function queryParams({ positional, named }) {
+ // 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);
return QueryParams.create({
values: assign({}, named.value()),
});
}
-export default function(vm, args) {
+export default function(_vm, args) {
return new InternalHelperReference(queryParams, args.capture());
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/readonly.ts
|
@@ -102,7 +102,7 @@ import { unMut } from './mut';
@for Ember.Templates.helpers
@private
*/
-export default function(vm, args) {
+export default function(_vm, args) {
let ref = unMut(args.positional.at(0));
let wrapped = Object.create(ref);
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/helpers/unbound.ts
|
@@ -33,7 +33,7 @@ import { UnboundReference } from '../utils/references';
@public
*/
-export default function(vm, args) {
+export default function(_vm, args) {
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
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/modifiers/action.ts
|
@@ -164,7 +164,7 @@ export class ActionState {
// implements ModifierManager<Action>
export default class ActionModifierManager {
- create(element, args, dynamicScope, dom) {
+ create(element, args, _dynamicScope, dom) {
let { named, positional } = args.capture();
let implicitTarget;
let actionName;
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/renderer.ts
|
@@ -1,7 +1,3 @@
-interface FreeformObject {
- [key: string]: any;
-}
-
import { Simple } from '@glimmer/interfaces';
import { CURRENT_TAG, VersionedPathReference } from '@glimmer/reference';
import { IteratorResult } from '@glimmer/runtime';
@@ -174,7 +170,7 @@ function loopBegin() {
function K() { /* noop */ }
let loops = 0;
-function loopEnd(current, next) {
+function loopEnd() {
for (let i = 0; i < renderers.length; i++) {
if (!renderers[i]._isValid()) {
if (loops > 10) {
@@ -193,7 +189,7 @@ function loopEnd(current, next) {
backburner.on('begin', loopBegin);
backburner.on('end', loopEnd);
-export class Renderer {
+export abstract class Renderer {
private _env: Environment;
private _rootTemplate: any;
private _viewRegistry: {
@@ -223,9 +219,8 @@ export class Renderer {
appendOutletView(view: OutletView, target: Simple.Element) {
let definition = new TopLevelOutletComponentDefinition(view);
let outletStateReference = view.toReference();
- let targetObject = view.outletState.render.controller;
- this._appendDefinition(view, definition, target, outletStateReference, targetObject);
+ this._appendDefinition(view, definition, target, outletStateReference);
}
appendTo(view: Opaque, target: Simple.Element) {
@@ -238,8 +233,7 @@ export class Renderer {
root: Opaque,
definition: ComponentDefinition<Opaque>,
target: Simple.Element,
- outletStateReference?: OutletStateReference,
- targetObject: Opaque = null) {
+ outletStateReference?: OutletStateReference) {
let self = new RootReference(definition);
let dynamicScope = new DynamicScope(null, outletStateReference, outletStateReference);
let rootState = new RootState(root, this._env, this._rootTemplate, self, target, dynamicScope);
@@ -303,9 +297,7 @@ export class Renderer {
this._clearAllRoots();
}
- getElement(view) {
- // overridden in the subclasses
- }
+ abstract getElement(view: Opaque): Simple.Element | undefined;
getBounds(view) {
let bounds = view[BOUNDS];
@@ -335,7 +327,8 @@ export class Renderer {
_renderRoots() {
let { _roots: roots, _env: env, _removedRoots: removedRoots } = this;
- let globalShouldReflush, initialRootsLength;
+ let globalShouldReflush: boolean;
+ let initialRootsLength: number;
do {
env.begin();
@@ -453,7 +446,7 @@ export class InertRenderer extends Renderer {
return new this(env, rootTemplate, _viewRegistry, false);
}
- getElement(view) {
+ getElement(_view: Opaque): Simple.Element | undefined {
throw new Error('Accessing `this.element` is not allowed in non-interactive environments (such as FastBoot).');
}
}
@@ -463,7 +456,7 @@ export class InteractiveRenderer extends Renderer {
return new this(env, rootTemplate, _viewRegistry, true);
}
- getElement(view) {
+ getElement(view: Opaque): Simple.Element | undefined {
return getViewElement(view);
}
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/syntax/-text-area.ts
|
@@ -1,7 +1,7 @@
import { wrapComponentClassAttribute } from '../utils/bindings';
import { hashToArgs } from './utils';
-export function textAreaMacro(name, params, hash, builder) {
+export function textAreaMacro(_name, params, hash, builder) {
let definition = builder.env.getComponentDefinition('-text-area', builder.meta.templateMeta);
wrapComponentClassAttribute(hash);
builder.component.static(definition, [params, hashToArgs(hash), null, null]);
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/syntax/dynamic-component.ts
|
@@ -11,7 +11,7 @@ function dynamicComponentFor(vm, args, meta) {
return new DynamicComponentReference({ nameRef, env, meta, args: null });
}
-export function dynamicComponentMacro(params, hash, _default, inverse, builder) {
+export function dynamicComponentMacro(params, hash, _default, _inverse, builder) {
let definitionArgs = [params.slice(0, 1), null, null, null];
let args = [params.slice(1), hashToArgs(hash), null, null];
builder.component.dynamic(definitionArgs, dynamicComponentFor, args);
@@ -25,7 +25,7 @@ export function blockComponentMacro(params, hash, _default, inverse, builder) {
return true;
}
-export function inlineComponentMacro(name, params, hash, builder) {
+export function inlineComponentMacro(_name, params, hash, builder) {
let definitionArgs = [params.slice(0, 1), null, null, null];
let args = [params.slice(1), hashToArgs(hash), null, null];
builder.component.dynamic(definitionArgs, dynamicComponentFor, args);
@@ -54,6 +54,7 @@ class DynamicComponentReference {
if (typeof nameOrDef === 'string') {
let definition = env.getComponentDefinition(nameOrDef, meta);
+ // tslint:disable-next-line:max-line-length
assert(`Could not find component named "${nameOrDef}" (no component or template with that name was found)`, definition);
return definition;
@@ -64,6 +65,5 @@ class DynamicComponentReference {
}
}
- get() {
- }
+ get() { /* NOOP */ }
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/syntax/input.ts
|
@@ -148,7 +148,7 @@ function buildSyntax(type, params, hash, builder) {
@public
*/
-export function inputMacro(name, params, hash, builder) {
+export function inputMacro(_name, params, hash, builder) {
let keys;
let values;
let typeIndex = -1;
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/syntax/mount.ts
|
@@ -2,7 +2,6 @@
@module ember
*/
import { assert } from 'ember-debug';
-import { DEBUG } from 'ember-env-flags';
import { EMBER_ENGINES_MOUNT_PARAMS } from 'ember/features';
import { MountDefinition } from '../component-managers/mount';
import { hashToArgs } from './utils';
@@ -55,7 +54,7 @@ function dynamicEngineFor(vm, args, meta) {
@category ember-application-engines
@public
*/
-export function mountMacro(name, params, hash, builder) {
+export function mountMacro(_name, params, hash, builder) {
if (EMBER_ENGINES_MOUNT_PARAMS) {
assert(
'You can only pass a single positional argument to the {{mount}} helper, e.g. {{mount "chat-engine"}}.',
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/syntax/outlet.ts
|
@@ -128,7 +128,7 @@ function outletComponentFor(vm, args) {
@for Ember.Templates.helpers
@public
*/
-export function outletMacro(name, params, hash, builder) {
+export function outletMacro(_name, params, _hash, builder) {
if (!params) {
params = [];
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/syntax/render.ts
|
@@ -16,10 +16,12 @@ function makeComponentDefinition(vm, args) {
let nameRef = args.positional.at(0);
assert(`The first argument of {{render}} must be quoted, e.g. {{render "sidebar"}}.`, isConst(nameRef));
+ // tslint:disable-next-line:max-line-length
assert(`The second argument of {{render}} must be a path, e.g. {{render "post" post}}.`, args.positional.length === 1 || !isConst(args.positional.at(1)));
let templateName = nameRef.value();
+ // tslint:disable-next-line:max-line-length
assert(`You used \`{{render '${templateName}'}}\`, but '${templateName}' can not be found as a template.`, env.owner.hasRegistration(`template:${templateName}`));
let template = env.owner.lookup(`template:${templateName}`);
@@ -29,10 +31,12 @@ function makeComponentDefinition(vm, args) {
if (args.named.has('controller')) {
let controllerNameRef = args.named.get('controller');
+ // tslint:disable-next-line:max-line-length
assert(`The controller argument for {{render}} must be quoted, e.g. {{render "sidebar" controller="foo"}}.`, isConst(controllerNameRef));
controllerName = controllerNameRef.value();
+ // tslint:disable-next-line:max-line-length
assert(`The controller name you supplied '${controllerName}' did not resolve to a controller.`, env.owner.hasRegistration(`controller:${controllerName}`));
} else {
controllerName = templateName;
@@ -117,7 +121,7 @@ function makeComponentDefinition(vm, args) {
@public
@deprecated Use a component instead
*/
-export function renderMacro(name, params, hash, builder) {
+export function renderMacro(_name, params, hash, builder) {
if (!params) {
params = [];
}
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/utils/iterable.ts
|
@@ -54,8 +54,8 @@ function keyForArray(keyPath) {
}
}
-function index(item, index) {
- return String(index);
+function index(_item, i) {
+ return String(i);
}
function identity(item) {
@@ -249,7 +249,7 @@ class ArrayIterable {
return get(iterable, 'length') > 0 ? new EmberArrayIterator(iterable, keyFor) : EMPTY_ITERATOR;
} else if (typeof iterable.forEach === 'function') {
let array: any[] = [];
- iterable.forEach(function(item) {
+ iterable.forEach((item) => {
array.push(item);
});
return array.length > 0 ? new ArrayIterator(array, keyFor) : EMPTY_ITERATOR;
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
packages/ember-glimmer/lib/utils/references.ts
|
@@ -6,7 +6,6 @@ import {
isConst,
TagWrapper,
UpdatableTag,
- VersionedPathReference,
} from '@glimmer/reference';
import {
ConditionalReference as GlimmerConditionalReference,
@@ -24,7 +23,6 @@ import {
} from 'ember-metal';
import {
HAS_NATIVE_WEAKMAP,
- Opaque,
symbol,
} from 'ember-utils';
import {
@@ -76,7 +74,7 @@ export class CachedReference extends EmberPathReference {
this._lastValue = null;
}
- compute() {}
+ compute() { /* NOOP */ }
value() {
let { tag, _lastRevision, _lastValue } = this;
| true |
Other
|
emberjs
|
ember.js
|
3c74b385a7d0e2b1ee7ec75b52723e87173fb82a.json
|
add more strictness and few more types.
|
tsconfig.json
|
@@ -16,8 +16,8 @@
// Enhance Strictness
// "noImplicitAny": true,
// "suppressImplicitAnyIndexErrors": true,
- // "noUnusedLocals": true,
- // "noUnusedParameters": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
// "allowUnreachableCode": false,
// "strictNullChecks": true,
// "noImplicitReturns": true,
@@ -33,7 +33,7 @@
},
"files": [
+ "packages/ember-glimmer/externs.d.ts",
"packages/ember-glimmer/lib/index.ts"
]
-
}
| true |
Other
|
emberjs
|
ember.js
|
2757794e4a8f80767e228fd2882c254c1b872e68.json
|
Fix ESLint errors
|
packages/loader/lib/index.js
|
@@ -1,45 +1,8 @@
+/*global process */
var enifed, requireModule, Ember;
var mainContext = this; // Used in ember-environment/lib/global.js
(function() {
- var isNode = typeof window === 'undefined' &&
- typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
-
- if (!isNode) {
- Ember = this.Ember = this.Ember || {};
- }
-
- if (typeof Ember === 'undefined') { Ember = {}; }
-
- if (typeof Ember.__loader === 'undefined') {
- var registry = {};
- var seen = {};
-
- enifed = function(name, deps, callback) {
- var value = { };
-
- if (!callback) {
- value.deps = [];
- value.callback = deps;
- } else {
- value.deps = deps;
- value.callback = callback;
- }
-
- registry[name] = value;
- };
-
- requireModule = function(name) {
- return internalRequire(name, null);
- };
-
- // setup `require` module
- requireModule['default'] = requireModule;
-
- requireModule.has = function registryHas(moduleName) {
- return !!registry[moduleName] || !!registry[moduleName + '/index'];
- };
-
function missingModule(name, referrerName) {
if (referrerName) {
throw new Error('Could not find module ' + name + ' required by: ' + referrerName);
@@ -88,6 +51,44 @@ var mainContext = this; // Used in ember-environment/lib/global.js
return exports;
}
+ var isNode = typeof window === 'undefined' &&
+ typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
+
+ if (!isNode) {
+ Ember = this.Ember = this.Ember || {};
+ }
+
+ if (typeof Ember === 'undefined') { Ember = {}; }
+
+ if (typeof Ember.__loader === 'undefined') {
+ var registry = {};
+ var seen = {};
+
+ enifed = function(name, deps, callback) {
+ var value = { };
+
+ if (!callback) {
+ value.deps = [];
+ value.callback = deps;
+ } else {
+ value.deps = deps;
+ value.callback = callback;
+ }
+
+ registry[name] = value;
+ };
+
+ requireModule = function(name) {
+ return internalRequire(name, null);
+ };
+
+ // setup `require` module
+ requireModule['default'] = requireModule;
+
+ requireModule.has = function registryHas(moduleName) {
+ return !!registry[moduleName] || !!registry[moduleName + '/index'];
+ };
+
requireModule._eak_seen = registry;
Ember.__loader = {
| true |
Other
|
emberjs
|
ember.js
|
2757794e4a8f80767e228fd2882c254c1b872e68.json
|
Fix ESLint errors
|
packages/node-module/lib/node-module.js
|
@@ -1,3 +1,4 @@
+/*global enifed */
enifed('node-module', ['exports'], function(_exports) {
var IS_NODE = typeof module === 'object' && typeof module.require === 'function';
if (IS_NODE) {
| true |
Other
|
emberjs
|
ember.js
|
42eb72a8038fa5de532e1c098521d8f8a4fcffa4.json
|
fix last type errors
|
packages/ember-glimmer/lib/environment.ts
|
@@ -17,7 +17,9 @@ import {
AttributeManager,
isSafeString,
compileLayout,
- getDynamicVar
+ getDynamicVar,
+ DOMTreeConstruction,
+ PartialDefinition
} from '@glimmer/runtime';
import {
Opaque
@@ -64,6 +66,7 @@ import {
GLIMMER_CUSTOM_COMPONENT_MANAGER,
EMBER_MODULE_UNIFICATION
} from 'ember/features';
+import { DOMChanges } from "@glimmer/runtime/dist/types/lib/dom/helper";
function instrumentationPayload(name) {
return { object: `component:${name}` };
@@ -85,9 +88,9 @@ export default class Environment extends GlimmerEnvironment {
private _templateCache: Cache;
private _compilerCache: Cache;
- constructor({ [OWNER]: owner }) {
- super(...arguments);
- this.owner = owner;
+ constructor(injections: any) {
+ super(injections);
+ let owner = this.owner = injections[OWNER];
this.isInteractive = owner.lookup('-environment:main').isInteractive;
// can be removed once https://github.com/tildeio/glimmer/pull/305 lands
@@ -167,6 +170,12 @@ export default class Environment extends GlimmerEnvironment {
}
}
+ // this gets clobbered by installPlatformSpecificProtocolForURL
+ // it really should just delegate to a platform specific injection
+ protocolForURL(s): string {
+ return s;
+ }
+
_resolveLocalLookupName(name, source, owner) {
return EMBER_MODULE_UNIFICATION ? `${source}:${name}`
: owner._resolveLocalLookupName(name, source);
@@ -203,13 +212,14 @@ export default class Environment extends GlimmerEnvironment {
return compilerCache.get(template);
}
- hasPartial(name: string, { owner }) {
- return hasPartial(name, owner);
+ hasPartial(partialName: string, meta: any): boolean {
+ return hasPartial(name, meta.owner);
}
- lookupPartial(name, { owner }) {
+ lookupPartial(PartialName: string, meta: any): PartialDefinition<any> {
let partial = {
- template: lookupPartial(name, owner)
+ name,
+ template: lookupPartial(name, meta.owner)
};
if (partial.template) {
| false |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-debug/lib/index.d.ts
|
@@ -1,3 +1,5 @@
-export function assert(message: string, test: boolean): void;
+export function assert(message: string, test?: boolean): void;
-export function warn(message: string, test: boolean, options?: any): void;
\ No newline at end of file
+export function warn(message: string, test: boolean, options?: any): void;
+
+export function deprecate(message: string, test: boolean, options?: any): void;
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/externs.d.ts
|
@@ -1,3 +1,12 @@
+declare module 'ember/features' {
+ export const EMBER_MODULE_UNIFICATION: any;
+ export const GLIMMER_CUSTOM_COMPONENT_MANAGER: any;
+ export const EMBER_ENGINES_MOUNT_PARAMS: any;
+ export const EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER: any;
+ export const EMBER_GLIMMER_ALLOW_BACKTRACKING_RERENDER: any;
+ export const MANDATORY_SETTER: any;
+}
+
declare module 'ember-env-flags' {
export const DEBUG: boolean;
}
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/component-managers/abstract.ts
|
@@ -4,11 +4,15 @@ import { DEBUG } from 'ember-env-flags';
// https://github.com/glimmerjs/glimmer-vm/blob/v0.24.0-beta.4/packages/%40glimmer/runtime/lib/component/interfaces.ts#L21
export default class AbstractManager {
+ public debugStack: any;
+ public _pushToDebugStack: (name: string, environment: any) => void;
+ public _pushEngineToDebugStack: (name: string, environment: any) => void;
+
constructor() {
this.debugStack = undefined;
}
- prepareArgs(definition, args) {
+ prepareArgs(definition, args): any | null {
return null;
}
@@ -43,7 +47,7 @@ export default class AbstractManager {
// inheritors should also call `this._pushToDebugStack`
// to ensure the rerendering assertion messages are
// properly maintained
- update(bucket, dynamicScope) { }
+ update(bucket, dynamicScope?) { }
// inheritors should also call `this.debugStack.pop()` to
// ensure the rerendering assertion messages are properly
@@ -56,12 +60,12 @@ export default class AbstractManager {
}
if (DEBUG) {
- AbstractManager.prototype._pushToDebugStack = function(name, environment) {
+ AbstractManager.prototype._pushToDebugStack = function(name: string, environment) {
this.debugStack = environment.debugStack;
this.debugStack.push(name);
};
- AbstractManager.prototype._pushEngineToDebugStack = function(name, environment) {
+ AbstractManager.prototype._pushEngineToDebugStack = function(name: string, environment) {
this.debugStack = environment.debugStack;
this.debugStack.pushEngine(name);
};
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/component-managers/curly.ts
|
@@ -1,4 +1,8 @@
-import { OWNER, assign } from 'ember-utils';
+import {
+ Opaque,
+ OWNER,
+ assign
+} from 'ember-utils';
import { combineTagged } from '@glimmer/reference';
import {
PrimitiveReference,
@@ -41,15 +45,15 @@ function aliasIdToElementId(args, props) {
}
// We must traverse the attributeBindings in reverse keeping track of
-// what has already been applied. This is essentially refining the concated
+// what has already been applied. This is essentially refining the concatenated
// properties applying right to left.
function applyAttributeBindings(element, attributeBindings, component, operations) {
- let seen = [];
+ let seen: Array<string> = [];
let i = attributeBindings.length - 1;
while (i !== -1) {
let binding = attributeBindings[i];
- let parsed = AttributeBinding.parse(binding);
+ let parsed: Array<string> = AttributeBinding.parse(binding);
let attribute = parsed[1];
if (seen.indexOf(attribute) === -1) {
@@ -80,6 +84,9 @@ function ariaRole(vm) {
}
class CurlyComponentLayoutCompiler {
+ static id: string;
+ public template: any;
+
constructor(template) {
this.template = template;
}
@@ -95,6 +102,9 @@ class CurlyComponentLayoutCompiler {
CurlyComponentLayoutCompiler.id = 'curly';
export class PositionalArgumentReference {
+ public tag: any;
+ private _references: any;
+
constructor(references) {
this.tag = combineTagged(references);
this._references = references;
@@ -303,7 +313,7 @@ export default class CurlyComponentManager extends AbstractManager {
}
}
- update(bucket, _, dynamicScope) {
+ update(bucket) {
let { component, args, argsRevision, environment } = bucket;
if (DEBUG) {
@@ -416,8 +426,11 @@ export function rerenderInstrumentDetails(component) {
const MANAGER = new CurlyComponentManager();
-export class CurlyComponentDefinition extends ComponentDefinition {
- constructor(name, ComponentClass, template, args, customManager) {
+export class CurlyComponentDefinition extends ComponentDefinition<Opaque> {
+ public template: any;
+ public args: any;
+
+ constructor(name, ComponentClass, template, args, customManager?) {
super(name, customManager || MANAGER, ComponentClass);
this.template = template;
this.args = args;
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/component-managers/mount.ts
|
@@ -2,6 +2,9 @@ import {
ComponentDefinition
} from '@glimmer/runtime';
import { UNDEFINED_REFERENCE } from '@glimmer/reference';
+import {
+ Opaque
+} from '@glimmer/util';
import { DEBUG } from 'ember-env-flags';
import { RootReference } from '../utils/references';
@@ -10,6 +13,17 @@ import AbstractManager from './abstract';
import { generateControllerFactory } from 'ember-routing';
import { EMBER_ENGINES_MOUNT_PARAMS } from 'ember/features';
+//TODO: remove these stubbed interfaces when better typing is in place
+interface engineType {
+ boot(): void;
+};
+
+interface bucketType {
+ modelReference?: any;
+ engine: engineType;
+};
+
+
class MountManager extends AbstractManager {
prepareArgs(definition, args) {
return null;
@@ -22,11 +36,11 @@ class MountManager extends AbstractManager {
dynamicScope.outletState = UNDEFINED_REFERENCE;
- let engine = environment.owner.buildChildEngineInstance(name);
+ let engine: engineType = environment.owner.buildChildEngineInstance(name);
engine.boot();
- let bucket = { engine };
+ let bucket: bucketType = { engine };
if (EMBER_ENGINES_MOUNT_PARAMS) {
bucket.modelReference = args.named.get('model');
@@ -81,7 +95,7 @@ class MountManager extends AbstractManager {
const MOUNT_MANAGER = new MountManager();
-export class MountDefinition extends ComponentDefinition {
+export class MountDefinition extends ComponentDefinition<Opaque> {
constructor(name) {
super(name, MOUNT_MANAGER, null);
}
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/component-managers/outlet.ts
|
@@ -14,6 +14,9 @@ function instrumentationPayload({ render: { name, outlet } }) {
function NOOP() {}
class StateBucket {
+ public outletState: any;
+ public finalizer: any;
+
constructor(outletState) {
this.outletState = outletState;
this.instrument();
@@ -76,7 +79,8 @@ class TopLevelOutletComponentManager extends OutletComponentManager {
const TOP_LEVEL_MANAGER = new TopLevelOutletComponentManager();
-export class TopLevelOutletComponentDefinition extends ComponentDefinition {
+export class TopLevelOutletComponentDefinition extends ComponentDefinition<any> {
+ public template: any;
constructor(instance) {
super('outlet', TOP_LEVEL_MANAGER, instance);
this.template = instance.template;
@@ -85,6 +89,8 @@ export class TopLevelOutletComponentDefinition extends ComponentDefinition {
}
class TopLevelOutletLayoutCompiler {
+ static id: string;
+ public template: any;
constructor(template) {
this.template = template;
}
@@ -99,7 +105,10 @@ class TopLevelOutletLayoutCompiler {
TopLevelOutletLayoutCompiler.id = 'top-level-outlet';
-export class OutletComponentDefinition extends ComponentDefinition {
+export class OutletComponentDefinition extends ComponentDefinition<any> {
+ public outletName: string;
+ public template: any;
+
constructor(outletName, template) {
super('outlet', MANAGER, null);
this.outletName = outletName;
@@ -109,6 +118,8 @@ export class OutletComponentDefinition extends ComponentDefinition {
}
export class OutletLayoutCompiler {
+ static id: string;
+ public template: any;
constructor(template) {
this.template = template;
}
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/component-managers/render.ts
|
@@ -74,7 +74,11 @@ class NonSingletonRenderManager extends AbstractRenderManager {
export const NON_SINGLETON_RENDER_MANAGER = new NonSingletonRenderManager();
-export class RenderDefinition extends ComponentDefinition {
+export class RenderDefinition extends ComponentDefinition<any> {
+ public name: string;
+ public template: any;
+ public env: any;
+
constructor(name, template, env, manager) {
super('render', manager, null);
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/component-managers/root.ts
|
@@ -49,7 +49,9 @@ class RootComponentManager extends CurlyComponentManager {
const ROOT_MANAGER = new RootComponentManager();
-export class RootComponentDefinition extends ComponentDefinition {
+export class RootComponentDefinition extends ComponentDefinition<any> {
+ public template: any;
+ public args: any;
constructor(instance) {
super('-root', ROOT_MANAGER, {
class: instance.constructor,
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/environment.ts
|
@@ -1,7 +1,7 @@
+/// <reference path="../externs.d.ts"/>
import { guidFor, OWNER } from 'ember-utils';
import { Cache, _instrumentStart } from 'ember-metal';
import { assert, warn } from 'ember-debug';
-import { EMBER_MODULE_UNIFICATION } from 'ember/features';
import { DEBUG } from 'ember-env-flags';
import {
lookupPartial,
@@ -61,7 +61,8 @@ import installPlatformSpecificProtocolForURL from './protocol-for-url';
import { default as ActionModifierManager } from './modifiers/action';
import {
- GLIMMER_CUSTOM_COMPONENT_MANAGER
+ GLIMMER_CUSTOM_COMPONENT_MANAGER,
+ EMBER_MODULE_UNIFICATION
} from 'ember/features';
function instrumentationPayload(name) {
@@ -79,6 +80,7 @@ export default class Environment extends GlimmerEnvironment {
public builtInModifiers: any;
public builtInHelpers: any;
public debugStack: any;
+ public inTransaction: boolean;
private _definitionCache: Cache;
private _templateCache: Cache;
private _compilerCache: Cache;
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/helpers/action.ts
|
@@ -270,7 +270,7 @@ export const ACTION = symbol('ACTION');
@for Ember.Templates.helpers
@public
*/
-export default function(vm, args) {
+export default function(vm, args): UnboundReference {
let { named, positional } = args;
let capturedArgs = positional.capture();
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/helpers/component.ts
|
@@ -144,6 +144,14 @@ import { assert } from 'ember-debug';
@public
*/
export class ClosureComponentReference extends CachedReference {
+ public defRef: any;
+ public tag: any;
+ public args: any;
+ public meta: any;
+ public env: any;
+ public lastDefinition: any;
+ public lastName: string;
+
static create(args, meta, env) {
return new ClosureComponentReference(args, meta, env);
}
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/helpers/get.ts
|
@@ -65,6 +65,13 @@ export default function(vm, args) {
}
class GetHelperReference extends CachedReference {
+ public sourceReference: any;
+ public pathReference: any;
+ public lastPath: any;
+ public innerReference: any;
+ public innerTag: UpdatableTag;
+ public tag: any;
+
static create(sourceReference, pathReference) {
if (isConst(pathReference)) {
let parts = pathReference.value().split('.');
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/helpers/if-unless.ts
|
@@ -15,6 +15,12 @@ import {
} from '@glimmer/reference';
class ConditionalHelperReference extends CachedReference {
+ public branchTag: UpdatableTag;
+ public tag: any;
+ public cond: any;
+ public truthy: any;
+ public falsy: any;
+
static create(_condRef, truthyRef, falsyRef) {
let condRef = ConditionalReference.create(_condRef);
if (isConst(condRef)) {
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/modifiers/action.ts
|
@@ -53,6 +53,16 @@ export let ActionHelper = {
};
export class ActionState {
+ public element: HTMLElement;
+ public actionId: any;
+ public actionName: any;
+ public actionArgs: any;
+ public namedArgs: any;
+ public positional: any;
+ public implicitTarget: any;
+ public dom: any;
+ public eventName: any;
+
constructor(element, actionId, actionName, actionArgs, namedArgs, positionalArgs, implicitTarget, dom) {
this.element = element;
this.actionId = actionId;
@@ -115,7 +125,8 @@ export class ActionState {
let args = this.getActionArgs();
let payload = {
args,
- target
+ target,
+ name: null
};
if (typeof actionName[INVOKE] === 'function') {
flaggedInstrument('interaction.ember-action', payload, () => {
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/syntax.ts
|
@@ -53,7 +53,7 @@ function refineBlockSyntax(name, params, hash, _default, inverse, builder) {
return false;
}
-export const experimentalMacros = [];
+export const experimentalMacros: Array<any> = [];
// This is a private API to allow for experimental macros
// to be created in user space. Registering a macro should
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/syntax/dynamic-component.ts
|
@@ -9,7 +9,7 @@ function dynamicComponentFor(vm, args, meta) {
let env = vm.env;
let nameRef = args.positional.at(0);
- return new DynamicComponentReference({ nameRef, env, meta });
+ return new DynamicComponentReference({ nameRef, env, meta, args: null });
}
export function dynamicComponentMacro(params, hash, _default, inverse, builder) {
@@ -34,6 +34,12 @@ export function inlineComponentMacro(name, params, hash, builder) {
}
class DynamicComponentReference {
+ public tag: any;
+ public nameRef: any;
+ public env: any;
+ public meta: any;
+ public args: any;
+
constructor({ nameRef, env, meta, args }) {
this.tag = nameRef.tag;
this.nameRef = nameRef;
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/syntax/mount.ts
|
@@ -75,6 +75,12 @@ export function mountMacro(name, params, hash, builder) {
}
class DynamicEngineReference {
+ public tag: any;
+ public nameRef: any;
+ public env: any;
+ public meta: any;
+ private _lastName: any;
+ private _lastDef: any;
constructor({ nameRef, env, meta }) {
this.tag = nameRef.tag;
this.nameRef = nameRef;
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/syntax/outlet.ts
|
@@ -6,6 +6,13 @@ import {
import { OutletComponentDefinition } from '../component-managers/outlet';
class OutletComponentReference {
+ public outletNameRef: any;
+ public parentOutletStateRef: any;
+ public definition: any;
+ public lastState: any;
+ public outletStateTag: UpdatableTag;
+ public tag: any;
+
constructor(outletNameRef, parentOutletStateRef) {
this.outletNameRef = outletNameRef;
this.parentOutletStateRef = parentOutletStateRef;
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/utils/bindings.ts
|
@@ -14,7 +14,7 @@ import { assert } from 'ember-debug';
import { get } from 'ember-metal';
import { String as StringUtils } from 'ember-runtime';
import { ROOT_REF } from '../component';
-import { htmlSafe, isHTMLSafe } from './string';
+import { htmlSafe, isHTMLSafe, SafeString } from './string';
function referenceForKey(component, key) {
return component[ROOT_REF].get(key);
@@ -103,15 +103,15 @@ export const AttributeBinding = {
const DISPLAY_NONE = 'display: none;';
const SAFE_DISPLAY_NONE = htmlSafe(DISPLAY_NONE);
-class StyleBindingReference extends CachedReference<string> {
+class StyleBindingReference extends CachedReference<string | SafeString> {
public tag: Tag;
constructor(private inner: Reference<string>, private isVisible: Reference<Opaque>) {
super();
this.tag = combine([inner.tag, isVisible.tag]);
}
- compute(): string {
+ compute(): string | SafeString {
let value = this.inner.value();
let isVisible = this.isVisible.value();
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/utils/curly-component-state-bucket.ts
|
@@ -24,7 +24,7 @@ function NOOP() {}
@private
*/
export default class ComponentStateBucket {
- private classRef: Opaque = null;
+ public classRef: Opaque = null;
private argsRevision: Revision;
constructor(private environment: Environment, private component: Component, private args: Tagged, private finalizer: Finalizer) {
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/utils/process-args.ts
|
@@ -38,6 +38,7 @@ export function processComponentArgs(namedArgs) {
const REF = symbol('REF');
class MutableCell {
+ public value: any;
constructor(ref, value) {
this[MUTABLE_CELL] = true;
this[REF] = ref;
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/utils/references.ts
|
@@ -57,19 +57,25 @@ class EmberPathReference {
// @abstract get tag()
// @abstract value()
- get(key) {
+ get(key?): any {
return PropertyReference.create(this, key);
}
}
// @abstract
export class CachedReference extends EmberPathReference {
+ private _lastRevision: any;
+ private _lastValue: any;
+ public tag: any;
+
constructor() {
super();
this._lastRevision = null;
this._lastValue = null;
}
+ compute() {}
+
value() {
let { tag, _lastRevision, _lastValue } = this;
@@ -85,7 +91,8 @@ export class CachedReference extends EmberPathReference {
}
// @implements PathReference
-export class RootReference extends ConstReference {
+export class RootReference extends ConstReference<any> {
+ public children: any;
constructor(value) {
super(value);
this.children = Object.create(null);
@@ -107,6 +114,11 @@ let TwoWayFlushDetectionTag;
if (EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER ||
EMBER_GLIMMER_ALLOW_BACKTRACKING_RERENDER) {
TwoWayFlushDetectionTag = class {
+ public tag: any;
+ public parent: any;
+ public key: any;
+ public ref: any;
+
constructor(tag, key, ref) {
this.tag = tag;
this.parent = null;
@@ -152,6 +164,9 @@ export class PropertyReference extends CachedReference {
}
export class RootPropertyReference extends PropertyReference {
+ private _parentValue: any;
+ private _propertyKey: any;
+
constructor(parentValue, propertyKey) {
super();
@@ -187,6 +202,10 @@ export class RootPropertyReference extends PropertyReference {
}
export class NestedPropertyReference extends PropertyReference {
+ private _parentReference: any;
+ private _parentObjectTag: any;
+ private _propertyKey: any;
+
constructor(parentReference, propertyKey) {
super();
@@ -242,6 +261,9 @@ export class NestedPropertyReference extends PropertyReference {
}
export class UpdatableReference extends EmberPathReference {
+ public tag: DirtyableTag;
+ private _value: any;
+
constructor(value) {
super();
@@ -270,6 +292,7 @@ export class UpdatablePrimitiveReference extends UpdatableReference {
}
export class ConditionalReference extends GlimmerConditionalReference {
+ public objectTag: UpdatableTag;
static create(reference) {
if (isConst(reference)) {
let value = reference.value();
@@ -303,6 +326,9 @@ export class ConditionalReference extends GlimmerConditionalReference {
}
export class SimpleHelperReference extends CachedReference {
+ public helper: any;
+ public args: any;
+
static create(helper, args) {
if (isConst(args)) {
let { positional, named } = args;
@@ -351,6 +377,9 @@ export class SimpleHelperReference extends CachedReference {
}
export class ClassBasedHelperReference extends CachedReference {
+ public instance: any;
+ public args: any;
+
static create(helperClass, vm, args) {
let instance = helperClass.create();
vm.newDestroyable(instance);
@@ -381,6 +410,9 @@ export class ClassBasedHelperReference extends CachedReference {
}
export class InternalHelperReference extends CachedReference {
+ public helper: any;
+ public args: any;
+
constructor(helper, args) {
super();
@@ -396,7 +428,7 @@ export class InternalHelperReference extends CachedReference {
}
// @implements PathReference
-export class UnboundReference extends ConstReference {
+export class UnboundReference extends ConstReference<any> {
static create(value) {
if (typeof value === 'object' && value !== null) {
return new UnboundReference(value);
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/utils/string.ts
|
@@ -5,6 +5,8 @@
import { deprecate } from 'ember-debug';
export class SafeString {
+ public string: string;
+
constructor(string) {
this.string = string;
}
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-glimmer/lib/views/outlet.ts
|
@@ -5,6 +5,9 @@ import { OWNER } from 'ember-utils';
import { run } from 'ember-metal';
class OutletStateReference {
+ public outletView: any;
+ public tag: any;
+
constructor(outletView) {
this.outletView = outletView;
this.tag = outletView._tag;
@@ -31,6 +34,9 @@ class OutletStateReference {
// in 3.0. Preferably it is deprecated in the release that
// follows the Glimmer release.
class OrphanedOutletStateReference extends OutletStateReference {
+ public root: any;
+ public name: string;
+
constructor(root, name) {
super(root.outletView);
this.root = root;
@@ -60,6 +66,10 @@ class OrphanedOutletStateReference extends OutletStateReference {
}
class ChildOutletStateReference {
+ public parent: any;
+ public key: string;
+ public tag: any;
+
constructor(parent, key) {
this.parent = parent;
this.key = key;
@@ -76,6 +86,13 @@ class ChildOutletStateReference {
}
export default class OutletView {
+ private _environment: any;
+ public renderer: any;
+ public owner: any;
+ public template: any;
+ public outletState: any;
+ private _tag: any;
+
static extend(injections) {
return class extends OutletView {
static create(options) {
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/ember-metal/lib/index.d.ts
|
@@ -1,21 +1,47 @@
-declare module 'ember-metal' {
- export const run: { [key: string]: any };
+interface IBackburner {
+ join(...args: any[]): void;
+ on(...args: any[]): void;
+ scheduleOnce(...args: any[]): void;
+}
+interface IRun {
+ (...args: any[]): any;
+ schedule(...args: any[]): void;
+ later(...args: any[]): void;
+ join(...args: any[]): void;
+ backburner: IBackburner
+}
- export function setHasViews(fn: () => boolean): null;
+export const run: IRun;
- export function runInTransaction(context: any, methodName: string): any;
+export const PROPERTY_DID_CHANGE: symbol;
- export function _instrumentStart(name: string, _payload: (_payloadParam: any) => any, _payloadParam: any): () => void;
+export const flaggedInstrument: any;
- export function get(obj: any, keyName: string): any;
+export function setHasViews(fn: () => boolean): null;
- export function tagForProperty(object: any, propertyKey: string, _meta?: any): any;
+export function runInTransaction(context: any, methodName: string): any;
- export function tagFor(object: any, _meta?: any): any;
+export function _instrumentStart(name: string, _payload: (_payloadParam: any) => any, _payloadParam: any): () => void;
- export function isProxy(value: any): boolean;
+export function get(obj: any, keyName: string): any;
- export class Cache {
- constructor(limit: number, func: (obj: any) => any, key: any, store?: any)
- }
+export function set(obj: any, keyName: string, value: any, tolerant?: boolean): void;
+
+export function computed(...args: Array<any>): any;
+
+export function didRender(object: any, key: string, reference: any): boolean;
+
+export function isNone(obj: any): boolean;
+
+export function tagForProperty(object: any, propertyKey: string, _meta?: any): any;
+
+export function tagFor(object: any, _meta?: any): any;
+
+export function watchKey(obj: any, keyName: string, meta?: any): void;
+
+export function isProxy(value: any): boolean;
+
+export class Cache {
+ constructor(limit: number, func: (obj: any) => any, key: any, store?: any)
+ get(obj): any
}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
74b2679634955f54bc424c486a64d44c93c13b42.json
|
Fix missing property and other minor TS errors
|
packages/node-module/lib/index.d.ts
|
@@ -0,0 +1,3 @@
+export const IS_NODE: boolean;
+
+export function require(url: string): string;
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
3d32cc0e8aea7b5664f697dd3ca1f9e3cc2e7a18.json
|
Modify build to handle typescript
|
broccoli/glimmer-template-compiler.js
|
@@ -21,7 +21,7 @@ function GlimmerTemplatePrecompiler (inputTree, options) {
}
GlimmerTemplatePrecompiler.prototype.extensions = ['hbs'];
-GlimmerTemplatePrecompiler.prototype.targetExtension = 'ts';
+GlimmerTemplatePrecompiler.prototype.targetExtension = 'js';
GlimmerTemplatePrecompiler.prototype.baseDir = function() {
return __dirname;
| true |
Other
|
emberjs
|
ember.js
|
3d32cc0e8aea7b5664f697dd3ca1f9e3cc2e7a18.json
|
Modify build to handle typescript
|
broccoli/packages.js
|
@@ -7,6 +7,7 @@ const Funnel = require('broccoli-funnel');
const filterTypeScript = require('broccoli-typescript-compiler').filterTypeScript;
const TypeScriptPlugin = require('broccoli-typescript-compiler').TypeScriptPlugin;
const BroccoliDebug = require('broccoli-debug');
+const MergeTrees = require('broccoli-merge-trees');
const findLib = require('./find-lib');
const funnelLib = require('./funnel-lib');
const { VERSION } = require('./version');
@@ -63,7 +64,7 @@ module.exports.qunit = function _qunit() {
module.exports.emberGlimmerES = function _emberGlimmerES() {
let input = new Funnel('packages/ember-glimmer/lib', {
- destDir: 'packages/ember-glimmer'
+ destDir: 'packages/ember-glimmer/lib'
});
let debuggedInput = debugTree(input, 'ember-glimmer:input');
@@ -76,11 +77,15 @@ module.exports.emberGlimmerES = function _emberGlimmerES() {
let debuggedCompiledTemplatesAndTypeScript = debugTree(compiledTemplatesAndTypescript, 'ember-glimmer:templates-output');
- let typescriptCompiled = new TypeScriptPlugin(debuggedCompiledTemplatesAndTypeScript, {
- compilerOptions: { allowJs: true }
+ let typescriptCompiled = filterTypeScript(debuggedCompiledTemplatesAndTypeScript);
+
+ let funneled = new Funnel(typescriptCompiled, {
+ getDestinationPath(path) {
+ return path.replace('/lib/', '/').replace('packages/', '/');
+ }
});
- return debugTree(typescriptCompiled, 'ember-glimmer:output');
+ return debugTree(funneled, 'ember-glimmer:output');
}
module.exports.handlebarsES = function _handlebars() {
| true |
Other
|
emberjs
|
ember.js
|
3d32cc0e8aea7b5664f697dd3ca1f9e3cc2e7a18.json
|
Modify build to handle typescript
|
ember-cli-build.js
|
@@ -73,7 +73,10 @@ module.exports = function(options) {
let inlineParser = toES5(handlebarsES(), { annotation: 'handlebars' });
let tokenizer = toES5(simpleHTMLTokenizerES(), { annotation: 'tokenizer' });
let rsvp = toES5(rsvpES(), { annotation: 'rsvp' });
- let emberMetal = new Funnel('packages/ember-metal/lib', { destDir: '/' });
+ let emberMetal = new Funnel('packages/ember-metal/lib', {
+ destDir: '/',
+ include: ['**/*.js']
+ });
let emberMetalES5 = rollupEmberMetal(emberMetal);
let emberConsole = emberPkgES('ember-console', SHOULD_ROLLUP, ['ember-environment']);
let emberConsoleES5 = toES5(emberConsole, { annotation: 'ember-console' });
| true |
Other
|
emberjs
|
ember.js
|
3d32cc0e8aea7b5664f697dd3ca1f9e3cc2e7a18.json
|
Modify build to handle typescript
|
tsconfig.json
|
@@ -19,29 +19,21 @@
// "noUnusedLocals": true,
// "noUnusedParameters": true,
// "allowUnreachableCode": false,
- "strictNullChecks": true,
+ // "strictNullChecks": true,
// "noImplicitReturns": true,
// "noImplicitThis": true,
"newLine": "LF",
- "noEmit": false,
- "allowJs": true,
+ "noEmit": true,
+ "allowJs": false,
"paths": {
"*": ["*/lib"]
}
},
- "include": [
- "packages/**/*.ts",
- "packages/**/*.js"
- ],
-
- "exclude": [
- "dist",
- "demos",
- "tmp",
- "node_modules",
- ".vscode"
+ "files": [
+ "packages/ember-glimmer/lib/index.ts"
]
+
}
| true |
Other
|
emberjs
|
ember.js
|
26f30a5e4cdd94896e8dde3ffaa9d6f456edfc95.json
|
Change some util files into TS
|
packages/ember-debug/lib/index.d.ts
|
@@ -0,0 +1 @@
+export function assert(message: string, test: boolean): void;
| true |
Other
|
emberjs
|
ember.js
|
26f30a5e4cdd94896e8dde3ffaa9d6f456edfc95.json
|
Change some util files into TS
|
packages/ember-glimmer/externs.d.ts
|
@@ -0,0 +1,3 @@
+declare module 'ember-env-flags' {
+ export const DEBUG: boolean;
+}
| true |
Other
|
emberjs
|
ember.js
|
26f30a5e4cdd94896e8dde3ffaa9d6f456edfc95.json
|
Change some util files into TS
|
packages/ember-glimmer/lib/renderer.js
|
@@ -161,7 +161,7 @@ function loopEnd(current, next) {
backburner.on('begin', loopBegin);
backburner.on('end', loopEnd);
-class Renderer {
+export class Renderer {
constructor(env, rootTemplate, _viewRegistry = fallbackViewRegistry, destinedForDOM = false) {
this._env = env;
this._rootTemplate = rootTemplate;
| true |
Other
|
emberjs
|
ember.js
|
26f30a5e4cdd94896e8dde3ffaa9d6f456edfc95.json
|
Change some util files into TS
|
packages/ember-glimmer/lib/templates/root.d.ts
|
@@ -0,0 +1,2 @@
+declare const TEMPLATE: any;
+export default TEMPLATE;
| true |
Other
|
emberjs
|
ember.js
|
26f30a5e4cdd94896e8dde3ffaa9d6f456edfc95.json
|
Change some util files into TS
|
packages/ember-glimmer/lib/utils/bindings.ts
|
@@ -2,8 +2,11 @@ import {
CachedReference,
combine,
map,
- referenceFromParts
+ referenceFromParts,
+ Reference,
+ Tag
} from '@glimmer/reference';
+import { Opaque, Option } from '@glimmer/interfaces';
import {
Ops
} from '@glimmer/wire-format';
@@ -100,22 +103,21 @@ export const AttributeBinding = {
const DISPLAY_NONE = 'display: none;';
const SAFE_DISPLAY_NONE = htmlSafe(DISPLAY_NONE);
-class StyleBindingReference extends CachedReference {
- constructor(inner, isVisible) {
+class StyleBindingReference extends CachedReference<string> {
+ public tag: Tag;
+ constructor(private inner: Reference<string>, private isVisible: Reference<Opaque>) {
super();
this.tag = combine([inner.tag, isVisible.tag]);
- this.inner = inner;
- this.isVisible = isVisible;
}
- compute() {
+ compute(): string {
let value = this.inner.value();
let isVisible = this.isVisible.value();
if (isVisible !== false) {
return value;
- } else if (!value && value !== 0) {
+ } else if (!value) {
return SAFE_DISPLAY_NONE;
} else {
let style = value + ' ' + DISPLAY_NONE;
@@ -158,8 +160,11 @@ export const ClassNameBinding = {
}
};
-class SimpleClassNameBindingReference extends CachedReference {
- constructor(inner, path) {
+class SimpleClassNameBindingReference extends CachedReference<Option<string>> {
+ public tag: Tag;
+ private dasherizedPath: Option<string>;
+
+ constructor(private inner: Reference<Opaque | number>, private path: string) {
super();
this.tag = inner.tag;
@@ -168,31 +173,30 @@ class SimpleClassNameBindingReference extends CachedReference {
this.dasherizedPath = null;
}
- compute() {
+ compute(): Option<string> {
let value = this.inner.value();
if (value === true) {
let { path, dasherizedPath } = this;
return dasherizedPath || (this.dasherizedPath = StringUtils.dasherize(path));
} else if (value || value === 0) {
- return value;
+ return String(value);
} else {
return null;
}
}
}
-class ColonClassNameBindingReference extends CachedReference {
- constructor(inner, truthy, falsy) {
+class ColonClassNameBindingReference extends CachedReference<Option<string>> {
+ public tag: Tag;
+
+ constructor(private inner: Reference<Opaque>, private truthy: Option<string> = null, private falsy: Option<string> = null) {
super();
this.tag = inner.tag;
- this.inner = inner;
- this.truthy = truthy || null;
- this.falsy = falsy || null;
}
- compute() {
+ compute(): Option<string> {
let { inner, truthy, falsy } = this;
return inner.value() ? truthy : falsy;
}
| true |
Other
|
emberjs
|
ember.js
|
26f30a5e4cdd94896e8dde3ffaa9d6f456edfc95.json
|
Change some util files into TS
|
packages/ember-glimmer/lib/utils/curly-component-state-bucket.ts
|
@@ -1,3 +1,16 @@
+import { Opaque } from '@glimmer/interfaces';
+import { Revision, Tagged } from '@glimmer/reference';
+
+interface Environment {
+ isInteractive: boolean;
+ destroyedComponents: Component[];
+}
+
+interface Component {
+ trigger(event: string);
+}
+
+type Finalizer = () => void;
function NOOP() {}
/**
@@ -11,13 +24,12 @@ function NOOP() {}
@private
*/
export default class ComponentStateBucket {
- constructor(environment, component, args, finalizer) {
- this.environment = environment;
- this.component = component;
+ private classRef: Opaque = null;
+ private argsRevision: Revision;
+
+ constructor(private environment: Environment, private component: Component, private args: Tagged, private finalizer: Finalizer) {
this.classRef = null;
- this.args = args;
this.argsRevision = args.tag.value();
- this.finalizer = finalizer;
}
destroy() {
| true |
Other
|
emberjs
|
ember.js
|
26f30a5e4cdd94896e8dde3ffaa9d6f456edfc95.json
|
Change some util files into TS
|
packages/ember-glimmer/lib/utils/debug-stack.ts
|
@@ -1,21 +1,20 @@
+// @ts-check
+
import { DEBUG } from 'ember-env-flags';
let DebugStack;
if (DEBUG) {
class Element {
- constructor(name) {
- this.name = name;
+ constructor(public name: string) {
}
}
class TemplateElement extends Element { }
class EngineElement extends Element { }
DebugStack = class DebugStack {
- constructor() {
- this._stack = [];
- }
+ private _stack: TemplateElement[] = [];
push(name) {
this._stack.push(new TemplateElement(name));
| true |
Other
|
emberjs
|
ember.js
|
d23a1ccbe9f50f304805fcb4cd6ffb0d3b66b012.json
|
Remove .d.ts files
|
packages/ember-debug/lib/ember-env-flags.d.ts
|
@@ -1,3 +0,0 @@
-declare module 'ember-env-flags' {
- export const DEBUG: boolean;
-}
| true |
Other
|
emberjs
|
ember.js
|
d23a1ccbe9f50f304805fcb4cd6ffb0d3b66b012.json
|
Remove .d.ts files
|
packages/ember-debug/lib/index.d.ts
|
@@ -1 +0,0 @@
-export function assert(message: string, test: boolean): void;
| true |
Other
|
emberjs
|
ember.js
|
039dee9d9478ceaeab44e5daa7efb6a99f088202.json
|
Enable typescript for ember-glimmer.
|
.gitignore
|
@@ -39,3 +39,4 @@ publish_to_bower/
bower_components/
npm-debug.log
.ember-cli
+DEBUG/
| true |
Other
|
emberjs
|
ember.js
|
039dee9d9478ceaeab44e5daa7efb6a99f088202.json
|
Enable typescript for ember-glimmer.
|
broccoli/glimmer-template-compiler.js
|
@@ -21,7 +21,7 @@ function GlimmerTemplatePrecompiler (inputTree, options) {
}
GlimmerTemplatePrecompiler.prototype.extensions = ['hbs'];
-GlimmerTemplatePrecompiler.prototype.targetExtension = 'js';
+GlimmerTemplatePrecompiler.prototype.targetExtension = 'ts';
GlimmerTemplatePrecompiler.prototype.baseDir = function() {
return __dirname;
@@ -35,4 +35,4 @@ GlimmerTemplatePrecompiler.prototype.processString = function(content, relativeP
`;
};
-module.exports = GlimmerTemplatePrecompiler;
\ No newline at end of file
+module.exports = GlimmerTemplatePrecompiler;
| true |
Other
|
emberjs
|
ember.js
|
039dee9d9478ceaeab44e5daa7efb6a99f088202.json
|
Enable typescript for ember-glimmer.
|
broccoli/packages.js
|
@@ -4,6 +4,9 @@ const { readFileSync } = require('fs');
const path = require('path');
const Rollup = require('broccoli-rollup');
const Funnel = require('broccoli-funnel');
+const filterTypeScript = require('broccoli-typescript-compiler').filterTypeScript;
+const TypeScriptPlugin = require('broccoli-typescript-compiler').TypeScriptPlugin;
+const BroccoliDebug = require('broccoli-debug');
const findLib = require('./find-lib');
const funnelLib = require('./funnel-lib');
const { VERSION } = require('./version');
@@ -15,6 +18,8 @@ const VERSION_PLACEHOLDER = /VERSION_STRING_PLACEHOLDER/g;
const { stripIndent } = require('common-tags');
const toES5 = require('./to-es5');
+const debugTree = BroccoliDebug.buildDebugCallback('ember-source');
+
module.exports.routerES = function _routerES() {
return new Rollup(findLib('router_js'), {
rollup: {
@@ -57,16 +62,24 @@ module.exports.qunit = function _qunit() {
}
module.exports.emberGlimmerES = function _emberGlimmerES() {
- let pkg = new Funnel('packages/ember-glimmer/lib', {
- include: ['**/*.js', '**/*.hbs'],
- destDir: 'ember-glimmer'
+ let input = new Funnel('packages/ember-glimmer', {
+ include: ['lib/**/*', 'index.*'],
+ destDir: 'packages/ember-glimmer'
});
- return new GlimmerTemplatePrecompiler(pkg, {
+ let debuggedInput = debugTree(input, 'ember-glimmer:input');
+
+ let compiledTemplatesAndTypescript = new GlimmerTemplatePrecompiler(debuggedInput, {
persist: true,
glimmer: require('@glimmer/compiler'),
annotation: 'ember-glimmer es'
});
+
+ let debuggedCompiledTemplatesAndTypeScript = debugTree(compiledTemplatesAndTypescript, 'ember-glimmer:templates-output');
+
+ let typescriptCompiled = new TypeScriptPlugin(debuggedCompiledTemplatesAndTypeScript);
+
+ return debugTree(typescriptCompiled, 'ember-glimmer:output');
}
module.exports.handlebarsES = function _handlebars() {
| true |
Other
|
emberjs
|
ember.js
|
039dee9d9478ceaeab44e5daa7efb6a99f088202.json
|
Enable typescript for ember-glimmer.
|
ember-cli-build.js
|
@@ -1,6 +1,12 @@
'use strict';
/* eslint-env node */
+// To create fast production builds (without ES3 support, minification, derequire, or JSHint)
+// run the following:
+//
+// DISABLE_ES3=true DISABLE_JSCS=true DISABLE_JSHINT=true DISABLE_MIN=true DISABLE_DEREQUIRE=true ember serve --environment=production
+
+const UnwatchedDir = require('broccoli-source').UnwatchedDir;
const MergeTrees = require('broccoli-merge-trees');
const Funnel = require('broccoli-funnel');
const babelHelpers = require('./broccoli/babel-helpers');
@@ -89,8 +95,7 @@ module.exports = function(options) {
let backburner = toES5(backburnerES());
// Linting
- let emberTestsLinted = emberTests.map(lint);
- let emberLinted = emberCoreES6.map(lint);
+ let linting = lint(new UnwatchedDir('packages'));
// ES5
let dependenciesES5 = dependenciesES6().map(toES5);
@@ -101,8 +106,7 @@ module.exports = function(options) {
// Bundling
let emberTestsBundle = new MergeTrees([
...emberTestsES5,
- ...emberTestsLinted,
- ...emberLinted,
+ linting,
loader,
nodeModule,
license,
| true |
Other
|
emberjs
|
ember.js
|
039dee9d9478ceaeab44e5daa7efb6a99f088202.json
|
Enable typescript for ember-glimmer.
|
package.json
|
@@ -85,9 +85,11 @@
"backburner.js": "^1.2.2",
"broccoli-babel-transpiler": "next",
"broccoli-concat": "^3.2.2",
+ "broccoli-debug": "^0.6.3",
"broccoli-file-creator": "^1.1.1",
"broccoli-lint-eslint": "^3.2.1",
"broccoli-rollup": "^1.2.0",
+ "broccoli-source": "^1.1.0",
"broccoli-string-replace": "^0.1.2",
"broccoli-typescript-compiler": "^2.0.1",
"broccoli-uglify-js": "^0.2.0",
| true |
Other
|
emberjs
|
ember.js
|
039dee9d9478ceaeab44e5daa7efb6a99f088202.json
|
Enable typescript for ember-glimmer.
|
packages/ember-glimmer/index.js
|
@@ -259,37 +259,37 @@
@public
*/
-export { INVOKE } from './helpers/action';
-export { default as RootTemplate } from './templates/root';
-export { default as template } from './template';
-export { default as Checkbox } from './components/checkbox';
-export { default as TextField } from './components/text_field';
-export { default as TextArea } from './components/text_area';
-export { default as LinkComponent } from './components/link-to';
-export { default as Component } from './component';
-export { default as Helper, helper } from './helper';
-export { default as Environment } from './environment';
+export { INVOKE } from './lib/helpers/action';
+export { default as RootTemplate } from './lib/templates/root';
+export { default as template } from './lib/template';
+export { default as Checkbox } from './lib/components/checkbox';
+export { default as TextField } from './lib/components/text_field';
+export { default as TextArea } from './lib/components/text_area';
+export { default as LinkComponent } from './lib/components/link-to';
+export { default as Component } from './lib/component';
+export { default as Helper, helper } from './lib/helper';
+export { default as Environment } from './lib/environment';
export {
SafeString,
escapeExpression,
htmlSafe,
isHTMLSafe,
getSafeString as _getSafeString
-} from './utils/string';
+} from './lib/utils/string';
export {
Renderer,
InertRenderer,
InteractiveRenderer,
_resetRenderers
-} from './renderer';
+} from './lib/renderer';
export {
getTemplate,
setTemplate,
hasTemplate,
getTemplates,
setTemplates
-} from './template_registry';
-export { setupEngineRegistry, setupApplicationRegistry } from './setup-registry';
-export { DOMChanges, NodeDOMTreeConstruction, DOMTreeConstruction } from './dom';
-export { registerMacros as _registerMacros, experimentalMacros as _experimentalMacros } from './syntax';
-export { default as AbstractComponentManager } from './component-managers/abstract';
+} from './lib/template_registry';
+export { setupEngineRegistry, setupApplicationRegistry } from './lib/setup-registry';
+export { DOMChanges, NodeDOMTreeConstruction, DOMTreeConstruction } from './lib/dom';
+export { registerMacros as _registerMacros, experimentalMacros as _experimentalMacros } from './lib/syntax';
+export { default as AbstractComponentManager } from './lib/component-managers/abstract';
| true |
Other
|
emberjs
|
ember.js
|
039dee9d9478ceaeab44e5daa7efb6a99f088202.json
|
Enable typescript for ember-glimmer.
|
tsconfig.json
|
@@ -0,0 +1,37 @@
+{
+ "compilerOptions": {
+ // Compilation Configuration
+ "target": "es5",
+ "module": "es2015",
+ "inlineSources": true,
+ "inlineSourceMap": true,
+ "outDir": "dist",
+ "baseUrl" : "packages",
+ "rootDir": "packages",
+
+ // Environment Configuration
+ "experimentalDecorators": true,
+ "moduleResolution": "node",
+
+ // Enhance Strictness
+ "noImplicitAny": true,
+ "suppressImplicitAnyIndexErrors": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "allowUnreachableCode": false,
+ "strictNullChecks": true,
+ "noImplicitReturns": true,
+ "noImplicitThis": true,
+
+ "newLine": "LF",
+ "noEmit": false,
+ "allowJs": true
+ },
+ "exclude": [
+ "dist",
+ "demos",
+ "tmp",
+ "node_modules",
+ ".vscode"
+ ]
+}
| true |
Other
|
emberjs
|
ember.js
|
039dee9d9478ceaeab44e5daa7efb6a99f088202.json
|
Enable typescript for ember-glimmer.
|
yarn.lock
|
@@ -1128,6 +1128,18 @@ broccoli-debug@^0.6.1:
symlink-or-copy "^1.1.8"
tree-sync "^1.2.2"
+broccoli-debug@^0.6.3:
+ version "0.6.3"
+ resolved "https://registry.yarnpkg.com/broccoli-debug/-/broccoli-debug-0.6.3.tgz#1f33bb0eacb5db81366f0492524c82b1217eb578"
+ dependencies:
+ broccoli-plugin "^1.2.1"
+ fs-tree-diff "^0.5.2"
+ heimdalljs "^0.2.1"
+ heimdalljs-logger "^0.1.7"
+ minimatch "^3.0.3"
+ symlink-or-copy "^1.1.8"
+ tree-sync "^1.2.2"
+
broccoli-file-creator@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/broccoli-file-creator/-/broccoli-file-creator-1.1.1.tgz#1b35b67d215abdfadd8d49eeb69493c39e6c3450"
| true |
Other
|
emberjs
|
ember.js
|
448c29120b2e0a11e8b8d26a2645cf55bb8a83c7.json
|
Make observer static
|
packages/ember-metal/lib/mixin.js
|
@@ -743,6 +743,7 @@ export function aliasMethod(methodName) {
@param {Function} func
@return func
@public
+ @static
*/
export function observer(...args) {
let _paths, func;
@@ -776,7 +777,7 @@ export function observer(...args) {
```javascript
import EmberObject from '@ember/object';
-
+
EmberObject.extend({
valueObserver: Ember.immediateObserver('value', function() {
// Executes whenever the "value" property changes
| false |
Other
|
emberjs
|
ember.js
|
32b09dcb339861b9a6a9208ec2aa292682366670.json
|
Fix various oversights with initial 176 deploy
|
packages/ember-debug/lib/deprecate.js
|
@@ -7,7 +7,10 @@ import Logger from 'ember-console';
import { ENV } from 'ember-environment';
import { registerHandler as genericRegisterHandler, invoke } from './handlers';
-
+/**
+ @module @ember/debug
+ @public
+*/
/**
Allows for runtime registration of handler functions that override the default deprecation behavior.
Deprecations are invoked by calls to [Ember.deprecate](https://emberjs.com/api/classes/Ember.html#method_deprecate).
@@ -37,7 +40,6 @@ import { registerHandler as genericRegisterHandler, invoke } from './handlers';
<li> <code>next</code> - A function that calls into the previously registered handler.</li>
</ul>
- @module @ember/debug
@public
@static
@method registerDeprecationHandler
@@ -128,15 +130,17 @@ if (DEBUG) {
'`options` should include `id` and `until` properties.';
missingOptionsIdDeprecation = 'When calling `Ember.deprecate` you must provide `id` in options.';
missingOptionsUntilDeprecation = 'When calling `Ember.deprecate` you must provide `until` in options.';
-
+ /**
+ @module @ember/application
+ @public
+ */
/**
Display a deprecation warning with the provided message and a stack trace
(Chrome and Firefox only).
* In a production build, this method is defined as an empty function (NOP).
Uses of this method in Ember itself are stripped from the ember.prod.js build.
- @module @ember/application
@method deprecate
@for @ember/application/deprecations
@param {String} message A description of the deprecation.
| true |
Other
|
emberjs
|
ember.js
|
32b09dcb339861b9a6a9208ec2aa292682366670.json
|
Fix various oversights with initial 176 deploy
|
packages/ember-runtime/lib/system/core_object.js
|
@@ -739,6 +739,8 @@ let ClassMixinProps = {
see `reopenClass`
@method reopen
+ @for @ember/object
+ @static
@public
*/
reopen() {
@@ -800,6 +802,8 @@ let ClassMixinProps = {
see `reopen`
@method reopenClass
+ @for @ember/object
+ @static
@public
*/
reopenClass() {
| true |
Other
|
emberjs
|
ember.js
|
32b09dcb339861b9a6a9208ec2aa292682366670.json
|
Fix various oversights with initial 176 deploy
|
packages/ember-runtime/lib/system/native_array.js
|
@@ -1,5 +1,5 @@
/**
-@module @ember/array
+@module ember
*/
import Ember, { // Ember.A circular
replace,
@@ -29,9 +29,9 @@ import copy from '../copy';
false, this will be applied automatically. Otherwise you can apply the mixin
at anytime by calling `Ember.NativeArray.apply(Array.prototype)`.
- @class EmberArray
+ @class Ember.EmberArray
@uses MutableArray
- @uses @ember/object/observable
+ @uses Observable
@uses Ember.Copyable
@public
*/
| true |
Other
|
emberjs
|
ember.js
|
32b09dcb339861b9a6a9208ec2aa292682366670.json
|
Fix various oversights with initial 176 deploy
|
packages/ember-runtime/lib/system/object.js
|
@@ -19,7 +19,7 @@ let OVERRIDE_OWNER = symbol('OVERRIDE_OWNER');
@class EmberObject
@extends CoreObject
- @uses Ember.Observable
+ @uses Observable
@public
*/
const EmberObject = CoreObject.extend(Observable, {
| true |
Other
|
emberjs
|
ember.js
|
32b09dcb339861b9a6a9208ec2aa292682366670.json
|
Fix various oversights with initial 176 deploy
|
packages/ember-utils/lib/assign.js
|
@@ -17,6 +17,7 @@
@param {Object} ...args The objects to copy properties from
@return {Object}
@public
+ @static
*/
export function assign(original) {
for (let i = 1; i < arguments.length; i++) {
| true |
Other
|
emberjs
|
ember.js
|
d7d40fcc3a8fa4be3310bcff0c6d14eac084a422.json
|
convert `Registry` to es6 class
|
packages/container/lib/registry.js
|
@@ -19,39 +19,36 @@ const VALID_FULL_NAME_REGEXP = /^[^:]+:[^:]+$/;
@class Registry
@since 1.11.0
*/
-export default function Registry(options = {}) {
- this.fallback = options.fallback || null;
+export default class Registry {
+ constructor(options = {}) {
+ this.fallback = options.fallback || null;
+ this.resolver = options.resolver || null;
- if (options.resolver) {
- this.resolver = options.resolver;
if (typeof this.resolver === 'function') {
deprecateResolverFunction(this);
}
- }
- this.registrations = dictionary(options.registrations || null);
+ this.registrations = dictionary(options.registrations || null);
- this._typeInjections = dictionary(null);
- this._injections = dictionary(null);
+ this._typeInjections = dictionary(null);
+ this._injections = dictionary(null);
- this._localLookupCache = Object.create(null);
- this._normalizeCache = dictionary(null);
- this._resolveCache = dictionary(null);
- this._failCache = dictionary(null);
+ this._localLookupCache = Object.create(null);
+ this._normalizeCache = dictionary(null);
+ this._resolveCache = dictionary(null);
+ this._failCache = dictionary(null);
- this._options = dictionary(null);
- this._typeOptions = dictionary(null);
-}
+ this._options = dictionary(null);
+ this._typeOptions = dictionary(null);
+ }
-Registry.prototype = {
/**
A backup registry for resolving registrations when no matches can be found.
@private
@property fallback
@type Registry
*/
- fallback: null,
/**
An object that has a `resolve` method that resolves a name.
@@ -60,62 +57,54 @@ Registry.prototype = {
@property resolver
@type Resolver
*/
- resolver: null,
/**
@private
@property registrations
@type InheritingDict
*/
- registrations: null,
/**
@private
@property _typeInjections
@type InheritingDict
*/
- _typeInjections: null,
/**
@private
@property _injections
@type InheritingDict
*/
- _injections: null,
/**
@private
@property _normalizeCache
@type InheritingDict
*/
- _normalizeCache: null,
/**
@private
@property _resolveCache
@type InheritingDict
*/
- _resolveCache: null,
/**
@private
@property _options
@type InheritingDict
*/
- _options: null,
/**
@private
@property _typeOptions
@type InheritingDict
*/
- _typeOptions: null,
/**
Creates a container based on this registry.
@@ -127,7 +116,7 @@ Registry.prototype = {
*/
container(options) {
return new Container(this, options);
- },
+ }
/**
Registers a factory for later injection.
@@ -164,7 +153,7 @@ Registry.prototype = {
delete this._failCache[normalizedName];
this.registrations[normalizedName] = factory;
this._options[normalizedName] = options;
- },
+ }
/**
Unregister a fullName
@@ -194,7 +183,7 @@ Registry.prototype = {
delete this._resolveCache[normalizedName];
delete this._failCache[normalizedName];
delete this._options[normalizedName];
- },
+ }
/**
Given a fullName return the corresponding factory.
@@ -238,7 +227,7 @@ Registry.prototype = {
factory = this.fallback.resolve(...arguments);
}
return factory;
- },
+ }
/**
A hook that can be used to describe how the resolver will
@@ -261,7 +250,7 @@ Registry.prototype = {
} else {
return fullName;
}
- },
+ }
/**
A hook to enable custom fullName normalization behavior
@@ -279,7 +268,7 @@ Registry.prototype = {
} else {
return fullName;
}
- },
+ }
/**
Normalize a fullName based on the application's conventions
@@ -293,7 +282,7 @@ Registry.prototype = {
return this._normalizeCache[fullName] || (
(this._normalizeCache[fullName] = this.normalizeFullName(fullName))
);
- },
+ }
/**
@method makeToString
@@ -311,7 +300,7 @@ Registry.prototype = {
} else {
return factory.toString();
}
- },
+ }
/**
Given a fullName check if the container is aware of its factory
@@ -332,7 +321,7 @@ Registry.prototype = {
let source = options && options.source && this.normalize(options.source);
return has(this, this.normalize(fullName), source);
- },
+ }
/**
Allow registering options for all factories of a type.
@@ -365,15 +354,15 @@ Registry.prototype = {
*/
optionsForType(type, options) {
this._typeOptions[type] = options;
- },
+ }
getOptionsForType(type) {
let optionsForType = this._typeOptions[type];
if (optionsForType === undefined && this.fallback) {
optionsForType = this.fallback.getOptionsForType(type);
}
return optionsForType;
- },
+ }
/**
@private
@@ -384,7 +373,7 @@ Registry.prototype = {
options(fullName, options = {}) {
let normalizedName = this.normalize(fullName);
this._options[normalizedName] = options;
- },
+ }
getOptions(fullName) {
let normalizedName = this.normalize(fullName);
@@ -394,7 +383,7 @@ Registry.prototype = {
options = this.fallback.getOptions(fullName);
}
return options;
- },
+ }
getOption(fullName, optionName) {
let options = this._options[fullName];
@@ -411,7 +400,7 @@ Registry.prototype = {
} else if (this.fallback) {
return this.fallback.getOption(fullName, optionName);
}
- },
+ }
/**
Used only via `injection`.
@@ -461,7 +450,7 @@ Registry.prototype = {
(this._typeInjections[type] = []);
injections.push({ property, fullName });
- },
+ }
/**
Defines injection rules.
@@ -524,7 +513,7 @@ Registry.prototype = {
(this._injections[normalizedName] = []);
injections.push({ property, fullName: normalizedInjectionName });
- },
+ }
/**
@private
@@ -554,43 +543,43 @@ Registry.prototype = {
}
return assign({}, fallbackKnown, localKnown, resolverKnown);
- },
+ }
validateFullName(fullName) {
if (!this.isValidFullName(fullName)) {
throw new TypeError(`Invalid Fullname, expected: 'type:name' got: ${fullName}`);
}
return true;
- },
+ }
isValidFullName(fullName) {
return VALID_FULL_NAME_REGEXP.test(fullName);
- },
+ }
getInjections(fullName) {
let injections = this._injections[fullName] || [];
if (this.fallback) {
injections = injections.concat(this.fallback.getInjections(fullName));
}
return injections;
- },
+ }
getTypeInjections(type) {
let injections = this._typeInjections[type] || [];
if (this.fallback) {
injections = injections.concat(this.fallback.getTypeInjections(type));
}
return injections;
- },
+ }
resolverCacheKey(name, options) {
if (!EMBER_MODULE_UNIFICATION) {
return name;
}
return (options && options.source) ? `${options.source}:${name}` : name;
- },
+ }
/**
Given a fullName and a source fullName returns the fully resolved
@@ -626,15 +615,15 @@ Registry.prototype = {
return null;
}
}
-};
+}
function deprecateResolverFunction(registry) {
- deprecate('Passing a `resolver` function into a Registry is deprecated. Please pass in a Resolver object with a `resolve` method.',
- false,
- { id: 'ember-application.registry-resolver-as-function', until: '3.0.0', url: 'https://emberjs.com/deprecations/v2.x#toc_registry-resolver-as-function' });
- registry.resolver = {
- resolve: registry.resolver
- };
+ deprecate(
+ 'Passing a `resolver` function into a Registry is deprecated. Please pass in a Resolver object with a `resolve` method.',
+ false,
+ { id: 'ember-application.registry-resolver-as-function', until: '3.0.0', url: 'https://emberjs.com/deprecations/v2.x#toc_registry-resolver-as-function' }
+ );
+ registry.resolver = { resolve: registry.resolver };
}
if (DEBUG) {
| false |
Other
|
emberjs
|
ember.js
|
0c62821a2f773457b57f1218ffede3f19e9b426d.json
|
convert `Container` to es6 class
|
packages/container/lib/container.js
|
@@ -26,20 +26,20 @@ const CONTAINER_OVERRIDE = symbol('CONTAINER_OVERRIDE');
@private
@class Container
*/
-export default function Container(registry, options = {}) {
- this.registry = registry;
- this.owner = options.owner || null;
- this.cache = dictionary(options.cache || null);
- this.factoryManagerCache = dictionary(options.factoryManagerCache || null);
- this[CONTAINER_OVERRIDE] = undefined;
- this.isDestroyed = false;
-
- if (DEBUG) {
- this.validationCache = dictionary(options.validationCache || null);
+export default class Container {
+ constructor(registry, options = {}) {
+ this.registry = registry;
+ this.owner = options.owner || null;
+ this.cache = dictionary(options.cache || null);
+ this.factoryManagerCache = dictionary(options.factoryManagerCache || null);
+ this[CONTAINER_OVERRIDE] = undefined;
+ this.isDestroyed = false;
+
+ if (DEBUG) {
+ this.validationCache = dictionary(options.validationCache || null);
+ }
}
-}
-Container.prototype = {
/**
@private
@property registry
@@ -94,7 +94,7 @@ Container.prototype = {
lookup(fullName, options) {
assert('fullName must be a proper full name', this.registry.validateFullName(fullName));
return lookup(this, this.registry.normalize(fullName), options);
- },
+ }
/**
A depth first traversal, destroying the container, its descendant containers and all
@@ -105,7 +105,7 @@ Container.prototype = {
destroy() {
destroyDestroyables(this);
this.isDestroyed = true;
- },
+ }
/**
Clear either the entire cache or just the cache for a particular key.
@@ -120,7 +120,7 @@ Container.prototype = {
} else {
resetMember(this, this.registry.normalize(fullName));
}
- },
+ }
/**
Returns an object that can be used to provide an owner to a
@@ -131,11 +131,11 @@ Container.prototype = {
*/
ownerInjection() {
return { [OWNER]: this.owner };
- },
+ }
_resolverCacheKey(name, options) {
return this.registry.resolverCacheKey(name, options);
- },
+ }
/**
Given a fullName, return the corresponding factory. The consumer of the factory
@@ -195,8 +195,7 @@ Container.prototype = {
this.factoryManagerCache[cacheKey] = manager;
return manager;
}
-};
-
+}
/*
* Wrap a factory manager in a proxy which will not permit properties to be
* set on the manager.
| false |
Other
|
emberjs
|
ember.js
|
99b43dc699bede8be3c371b41ca4f1074196ffde.json
|
Update Changelog for 2.17.0-beta.3
[ci skip]
(cherry picked from commit 2131f66c85888d8a74eb555334886e45d856787b)
|
CHANGELOG.md
|
@@ -1,5 +1,10 @@
# Ember Changelog
+### 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
+- [#15710](https://github.com/emberjs/ember.js/pull/15710) [BUGFIX] Correctly reset container cache
+
### 2.17.0-beta.2 (October 17, 2017)
- [#15613](https://github.com/emberjs/ember.js/pull/15613) [BUGFIX] Don't throw an error, when not all query params are passed to routerService.transitionTo
- [#15707](https://github.com/emberjs/ember.js/pull/15707) [BUGFIX] Fix `canInvoke` for edge cases
| false |
Other
|
emberjs
|
ember.js
|
1ee77481bbb6edfcc0d32806c2913447e7815708.json
|
remove fs-extra dependency
|
node-tests/blueprints/route-test.js
|
@@ -1,9 +1,6 @@
'use strict';
-var fs = require('fs-extra');
-var path = require('path');
-var RSVP = require('rsvp');
-var remove = RSVP.denodeify(fs.remove);
+var path = require('path');
var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers');
var setupTestHooks = blueprintHelpers.setupTestHooks;
@@ -150,7 +147,6 @@ describe('Acceptance: ember generate and destroy route', function() {
var args = ['route', 'application'];
return emberNew()
- .then(() => remove(path.resolve('app/templates/application.hbs')))
.then(() => emberGenerate(args))
.then(() => expect(file('app/router.js')).to.not.contain('this.route(\'application\')'));
});
@@ -395,7 +391,6 @@ describe('Acceptance: ember generate and destroy route', function() {
var args = ['route', 'application', '--pod'];
return emberNew()
- .then(() => remove(path.resolve('app/templates/application.hbs')))
.then(() => emberGenerate(args))
.then(() => expect(file('app/application/route.js')).to.exist)
.then(() => expect(file('app/application/template.hbs')).to.exist)
| true |
Other
|
emberjs
|
ember.js
|
1ee77481bbb6edfcc0d32806c2913447e7815708.json
|
remove fs-extra dependency
|
package.json
|
@@ -55,7 +55,6 @@
"ember-cli-valid-component-name": "^1.0.0",
"ember-cli-version-checker": "^1.3.1",
"ember-router-generator": "^1.2.3",
- "fs-extra": "^4.0.1",
"inflection": "^1.12.0",
"jquery": "^3.2.1",
"resolve": "^1.3.3",
| true |
Other
|
emberjs
|
ember.js
|
1ee77481bbb6edfcc0d32806c2913447e7815708.json
|
remove fs-extra dependency
|
yarn.lock
|
@@ -2905,14 +2905,6 @@ fs-extra@^2.0.0:
graceful-fs "^4.1.2"
jsonfile "^2.1.0"
-fs-extra@^4.0.1:
- version "4.0.1"
- resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.1.tgz#7fc0c6c8957f983f57f306a24e5b9ddd8d0dd880"
- dependencies:
- graceful-fs "^4.1.2"
- jsonfile "^3.0.0"
- universalify "^0.1.0"
-
fs-readdir-recursive@^0.1.0:
version "0.1.2"
resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-0.1.2.tgz#315b4fb8c1ca5b8c47defef319d073dad3568059"
@@ -3755,12 +3747,6 @@ jsonfile@^2.1.0:
optionalDependencies:
graceful-fs "^4.1.6"
-jsonfile@^3.0.0:
- version "3.0.1"
- resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66"
- optionalDependencies:
- graceful-fs "^4.1.6"
-
jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
@@ -6070,10 +6056,6 @@ unique-slug@^2.0.0:
dependencies:
imurmurhash "^0.1.4"
-universalify@^0.1.0:
- version "0.1.1"
- resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7"
-
unpipe@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.