Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeart committed Jan 31, 2024
1 parent 9a093c4 commit e51ceef
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions plugins/decorator-transforms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import type * as Babel from '@babel/core';
import type { types as t, NodePath } from '@babel/core';
import { ImportUtil } from 'babel-import-util';
import * as util from 'babel-import-util';
export const globalId = `dt7948`;
// @ts-expect-error
import * as decorators from '@babel/plugin-syntax-decorators';
Expand Down Expand Up @@ -35,7 +35,7 @@ export default function legacyDecoratorCompat(
runtime: 'globals',
...state.opts,
};
let importUtil = new ImportUtil(t, path);
let importUtil = new util.ImportUtil(t, path);
state.runtime = (target: NodePath<t.Node>, fnName: string) => {
const { runtime } = state.optsWithDefaults;
if (runtime === 'globals') {
Expand Down
2 changes: 1 addition & 1 deletion plugins/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function resolvePath(str: string) {
} else if (str === 'helper') {
str = SYMBOLS.$_helper;
} else if (str === 'modifier') {
str = SYMBOLS.$_modifier;
// str = SYMBOLS.$_modifier;
}
return toSafeJSPath(
toOptionalChaining(str)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function classify(str) {
export default function classify(str: string) {
return str
.split('.')
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
Expand Down
1 change: 1 addition & 0 deletions src/ember-compat/ember__component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function setComponentTemplate(tpl: any, cmp: any) {

export default class EmberComponent extends Component {
constructor() {
// @ts-expect-error
super(...arguments);
console.log('EmberComponent', ...arguments);
}
Expand Down
3 changes: 3 additions & 0 deletions src/ember-compat/ember__object.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// @ts-expect-error unused args
export function action(klass, field, descriptor) {
// console.log('action', klass, field, descriptor);
// if (field === 'hideToolTip') {
// debugger;
// }
// @ts-expect-error
let bindedValue = null;
return {
get() {
// @ts-expect-error
if (!bindedValue) {
bindedValue = descriptor.value.bind(this);
}
Expand Down
1 change: 1 addition & 0 deletions src/ember-compat/embroider__macros.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-expect-error unknown module
import * as gt from '@glimmer/tracking';
export function dependencySatisfies() {
return true;
Expand Down
2 changes: 2 additions & 0 deletions src/ember-compat/glimmer__tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const symbolEmpty = Symbol('empty');

// let cnt = 0;
export function cached(
// @ts-expect-error unused
target: any,
// @ts-expect-error unused
key: string,
descriptor: PropertyDescriptor,
) {
Expand Down
16 changes: 14 additions & 2 deletions src/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,12 +618,17 @@ function component(
if (IS_DEV_MODE) {
let ErrorOverlayClass = customElements.get('vite-error-overlay');
let errorOverlay!: Element;
// @ts-expect-error
let msg = e.message;
const key = originalLabel.replace('t', '');
// @ts-expect-error
if (globalThis.rawTemplates.has(key)) {
// @ts-expect-error
msg = `${globalThis.rawTemplates.get(key)}\n${msg}`;
}
// @ts-expect-error
if (globalThis.compiledTemplate.has(key)) {
// @ts-expect-error
msg = `${globalThis.compiledTemplate.get(key)}\n${msg}`;
}
// @ts-expect-error message may not exit
Expand Down Expand Up @@ -658,7 +663,6 @@ function component(
}
}
} else {
// @ts-expect-error uniqSymbol as index
const fw = args[$PROPS_SYMBOL] as unknown as FwType;
return _component(comp, args, fw, ctx);
}
Expand All @@ -684,7 +688,9 @@ function _component(

try {
let instance: any;
// @ts-expect-error
if (comp.componentType === 'glimmer-component') {
// @ts-expect-error
instance = new (comp as unknown as Component<any>)(
{},
args,
Expand All @@ -696,6 +702,7 @@ function _component(
}
});
} else {
// @ts-expect-error
instance = new (comp as unknown as Component<any>)(
args,
fw,
Expand Down Expand Up @@ -758,6 +765,7 @@ function _component(
return {
ctx: null,
[$nodes]: [
// @ts-expect-error e may not have message
$_text(`Unable to create ComponentInstance: ${e.message}`, []),
],
};
Expand Down Expand Up @@ -1114,8 +1122,11 @@ export const $_maybeModifier = (
modifier: any,
element: HTMLElement,
props: any[],
hashArgs,
hashArgs: Record<string, unknown>
) => {
if (modifierManagers.has(modifier)) {
debugger;
}
if ('emberModifier' in modifier) {
const instance = new modifier();
instance.modify = instance.modify.bind(instance);
Expand Down Expand Up @@ -1150,6 +1161,7 @@ export const $_maybeModifier = (
enumerable: true,
get() {
if (typeof args[key] === 'function') {
// @ts-expect-error
return args[key]();
} else {
return args[key];
Expand Down

0 comments on commit e51ceef

Please sign in to comment.