Skip to content

Commit

Permalink
fix: github action workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Nov 27, 2024
1 parent 878e89a commit ef2d355
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 63 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"release": "bumpp package.json packages/**/package.json --commit \"release: v\" --push --tag",
"serve": "serve",
"test": "vitest run",
"typecheck": "vue-tsc -p .",
"typecheck": "vue-tsc -p tsconfig.vue-tsc.json",
"watch:unplugin": "pnpm run --filter=./packages/unplugin-svelte watch"
},
"devDependencies": {
Expand Down Expand Up @@ -79,7 +79,7 @@
"prettier-plugin-svelte": "^3.2.6",
"prettier-plugin-toml": "^2.0.1",
"serve": "^14.2.3",
"typescript": "^5.7.2",
"typescript": "5.6.2",
"typescript-eslint": "^8.16.0",
"vitest": "^2.1.6",
"vue-tsc": "^2.1.2"
Expand Down
13 changes: 11 additions & 2 deletions packages/jsx-compiler/src/transforms/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,24 @@ import type {
RootIRNode as VaporRootIRNode
} from '@vue-vapor/compiler-vapor'
import type { CompilerOptions } from '../compile.ts'
import type { JSXElement, JSXFragment, RootNode } from '../ir/index.ts'
import type { JSXElement, JSXFragment, RootIRNode, RootNode } from '../ir/index.ts'

export const DEFAULT_OPTIONS: CompilerOptions = {
prefixIdentifiers: true
}
export const DEFAULT_VAPOR_COMPILER_OPTIONS = DEFAULT_OPTIONS as VaporCompilerOptions

export function makeCompile(options: CompilerOptions = {}) {
return (source: string, overrideOptions: CompilerOptions = {}) => {
return (
source: string,
overrideOptions: CompilerOptions = {}
): {
ast: RootNode
ir: RootIRNode
code: string
helpers: Set<string>
vaporHelpers: Set<string>
} => {
const {
body: [statement]
} = parse(source, {
Expand Down
4 changes: 4 additions & 0 deletions packages/jsx-compiler/src/transforms/on.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,20 @@ export const transformVOn: DirectiveTransform = (dir, node, context) => {

const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(
arg.isStatic ? `on${nameString}` : arg,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore -- TODO: fix this
modifiers,
null, // eslint-disable-line unicorn/no-null
resolveLocation(loc, context)
)

let keyOverride: KeyOverride | undefined

const isStaticClick = arg.isStatic && arg.content.toLowerCase() === 'click'
const delegate = arg.isStatic && eventOptionModifiers.length === 0 && delegatedEvents(arg.content)

// normalize click.right and click.middle since they don't actually fire

if (nonKeyModifiers.includes('middle')) {
if (keyOverride) {
// TODO: error here
Expand Down
2 changes: 1 addition & 1 deletion packages/react-vapor-hooks/src/useState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { describe, expect, test } from 'vitest'
import { delegate, delegateEvents, nextTick, renderEffect, setText, template } from 'vue/vapor'
import { makeRender, triggerEvent } from './_helper.ts'
import { makeRender, triggerEvent } from './_helper/index.ts'
import { useState } from './useState.ts'

const define = makeRender()
Expand Down
5 changes: 3 additions & 2 deletions packages/svelte-template-compiler/src/transforms/bind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const transformVBind: DirectiveTransform = (dir, _node, context) => {
const { loc, modifiers } = dir
let { exp } = dir
let arg = dir.arg!
const modifiersString = new Set(modifiers.map(s => s.content))

if (!exp) {
exp = normalizeBindShorthand(arg, context)
Expand All @@ -58,7 +59,7 @@ export const transformVBind: DirectiveTransform = (dir, _node, context) => {
}

let camel = false
if (modifiers.includes('camel')) {
if (modifiersString.has('camel')) {
if (arg.isStatic) {
arg = extend({}, arg, { content: camelize(arg.content) })
} else {
Expand All @@ -71,6 +72,6 @@ export const transformVBind: DirectiveTransform = (dir, _node, context) => {
value: exp,
loc,
runtimeCamelize: camel,
modifier: modifiers.includes('prop') ? '.' : modifiers.includes('attr') ? '^' : undefined
modifier: modifiersString.has('prop') ? '.' : modifiersString.has('attr') ? '^' : undefined
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function makeRender<Component = ObjectComponent | SetupFn>(
return define
}

export function triggerEvent(type: string, el: Element) {
export function triggerEvent(type: string, el: Element): void {
const event = new Event(type, { bubbles: true })
el.dispatchEvent(event)
}
2 changes: 1 addition & 1 deletion packages/svelte-vapor-runtime/src/lifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
setText,
template
} from 'vue/vapor'
import { makeRender, triggerEvent } from './_helper.ts'
import { makeRender, triggerEvent } from './_helper/index.ts'
import {
afterUpdate,
beforeUpdate,
Expand Down
11 changes: 9 additions & 2 deletions packages/svelte-vapor-runtime/src/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ export function createEventDispatcher<
parameter: Record<string, any> | null | undefined,
{ cancelable = false }: DispatchOptions = {}
): boolean {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore -- TODO: fix this
return dispatch(instance!, type, parameter, cancelable)
}

Expand Down Expand Up @@ -204,6 +206,8 @@ function invokeHandle(
event: CustomEvent
): boolean {
let fired = false
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore -- TODO: fix this
const el: Element = (instance.container as Element) || document
// eslint-disable-next-line @typescript-eslint/no-explicit-any,
const cleanEvent = addEventListener(el, type, fn as (...args: any) => any)
Expand Down Expand Up @@ -352,8 +356,11 @@ export function getAllContexts<T extends Map<any, any> = Map<any, any>>(): T {
const provides = instance.provides
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const contexts = new Map<any, any>()
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
Object.keys(Object.assign({}, provides, Object.getPrototypeOf(provides))).forEach(key => {

Object.keys(
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
Object.assign(Object.create(null), provides, Object.getPrototypeOf(provides))
).forEach(key => {
contexts.set(key, provides[key])
})
return contexts as T
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-vapor-runtime/src/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { describe, expect, test, vi } from 'vitest'
import { delegate, delegateEvents, nextTick, renderEffect, setText, template } from 'vue/vapor'
import { makeRender, triggerEvent } from './_helper.ts'
import { makeRender, triggerEvent } from './_helper/index.ts'
import {
derived,
get,
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte-vapor-runtime/src/transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export function draw(
* */
export function crossfade({
fallback,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- IGNORE
// @ts-ignore -- IGNORE
..._defaults
}: CrossfadeParams & {
fallback?:
Expand Down
Loading

0 comments on commit ef2d355

Please sign in to comment.