Skip to content

Commit

Permalink
various compiler fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pygy committed Jan 30, 2024
1 parent 4b17500 commit 52345f9
Show file tree
Hide file tree
Showing 11 changed files with 1,529 additions and 784 deletions.
2,281 changes: 1,511 additions & 770 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pieces.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// lib/* is generated from src/* at compile-time
export {keyed} from "./lib/keyed.js"
export {ref} from "./lib/ref.js"
export {boot} from "./lib/render.js"
export {S} from "./lib/S.js"
export {V, v} from "./lib/v.js"
export {keyed} from "./lib/src/keyed.js"
export {ref} from "./lib/src/ref.js"
export {boot} from "./lib/src/render.js"
export {S} from "./lib/src/S.js"
export {V, v} from "./lib/src/v.js"

2 changes: 1 addition & 1 deletion src/S.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {DataSignal, default as S, S as SInterface} from "../vendor/s-js/dist/es/S.js"
import {DataSignal, default as S, S as SInterface} from "../vendor/s-js/src/S.js"
export {S_ as S, DataSignal}

function map<T, U>(this: DataSignal<T>, cb: (x: T) => U) {
Expand Down
2 changes: 1 addition & 1 deletion src/attrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {DataSignal, S} from "./S.js"
import {Skippable, hasOwn, skippable} from "./util.js"
import type {NameSpace} from "./env.js"
import type {Node} from "../vendor/s-js/dist/es/S.js"
import type {Node} from "../vendor/s-js/src/S"
import {Nullish} from "./types.js"

export {AttrsItem, ElementAttrs, parseAndSetAttrs, setAttrs}
Expand Down
5 changes: 4 additions & 1 deletion src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,14 @@ function emit(node: Emitable) {
else emitDynamic(node)
} else {
//TODO: workaround for making actual DOM fragments permanent
if ((node as Node).nodeType) insert(node as Node)
if (isNode(node)) insert(node)
else insert(doc.createTextNode(String(node)))
}
}

function isNode(node:any): node is Node {
return !!node?.nodeType
}

//stubs

Expand Down
2 changes: 1 addition & 1 deletion tests/render/test-boot.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import o from "ospec"

import {setWindow as setVellaWindow} from "../../lib/env.js"
import {setWindow as setVellaWindow} from "../../lib/src/env.js"
import {S, boot, v} from "../../pieces.js"
import {matchError} from "../../test-util/matchError.js"
import {e, matchDOM, setWindow as setMDWindow} from "../../test-util/matchDOM.js"
Expand Down
4 changes: 2 additions & 2 deletions tests/render/test-hyperscript.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import o from "ospec"
import {setWindow as setVellaWindow} from "../../lib/env.js"
import {setWindow as setVellaWindow} from "../../lib/src/env.js"
import {S, V, v} from "../../pieces.js"
import {cacheDelay} from "../../lib/v.js"
import {cacheDelay} from "../../lib/src/v.js"
import {e, matchDOM, setWindow as setMDWindow} from "../../test-util/matchDOM.js"
import {refreshWindow, win} from "../test-setup.js"

Expand Down
2 changes: 1 addition & 1 deletion tests/render/test-keyed.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import o from "ospec"

import {setWindow as setVellaWindow} from "../../lib/env.js"
import {setWindow as setVellaWindow} from "../../lib/src/env.js"
import {S, keyed, ref, v} from "../../pieces.js"
// import {matchError} from "../../test-util/matchError.js"
import {e, matchDOM, setWindow as setMDWindow} from "../../test-util/matchDOM.js"
Expand Down
2 changes: 1 addition & 1 deletion tests/render/test-ref.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import o from "ospec"

import {setWindow as setVellaWindow} from "../../lib/env.js"
import {setWindow as setVellaWindow} from "../../lib/src/env.js"
import {S, ref, v} from "../../pieces.js"
// import {matchError} from "../../test-util/matchError.js"
import {e, matchDOM, setWindow as setMDWindow} from "../../test-util/matchDOM.js"
Expand Down
2 changes: 1 addition & 1 deletion tests/render/test-updates.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import o from "ospec"

import {setWindow as setVellaWindow} from "../../lib/env.js"
import {setWindow as setVellaWindow} from "../../lib/src/env.js"
import {S, V} from "../../pieces.js"
// import {matchError} from "../../test-util/matchError.js"
import {e, matchDOM, setWindow as setMDWindow} from "../../test-util/matchDOM.js"
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
// "allowImportingTsExtensions": true,
"declaration": true,
"module": "es2020",
"outDir": "lib",
Expand Down

0 comments on commit 52345f9

Please sign in to comment.