wrec 0.35.4 → 0.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{wrec-BugZmj1G.js → wrec-CPzbCpSN.js} +7 -2
- package/dist/wrec-ssr.es.js +1 -1
- package/dist/wrec.es.js +1 -1
- package/package.json +1 -1
- package/scripts/lint.js +50 -25
|
@@ -252,7 +252,7 @@ function K(e, t, n) {
|
|
|
252
252
|
}
|
|
253
253
|
function q(e, t, n) {
|
|
254
254
|
let [r] = t.split(":");
|
|
255
|
-
e instanceof CSSStyleRule ? e.style.setProperty(r, n) : (K(e, r, n), r === "value" && V(e) && (e.value = n));
|
|
255
|
+
e instanceof CSSStyleRule ? e.style.getPropertyValue(r) !== n && e.style.setProperty(r, n) : (K(e, r, n), r === "value" && V(e) && e.value !== n && (e.value = n));
|
|
256
256
|
}
|
|
257
257
|
var J = (e) => typeof e == "string" ? [e] : e;
|
|
258
258
|
async function Y(e) {
|
|
@@ -755,7 +755,12 @@ var X = class e extends m {
|
|
|
755
755
|
let r = typeof t;
|
|
756
756
|
r !== "string" && r !== "number" && this.#V(e, void 0, " computed content is not a string or number");
|
|
757
757
|
let i = String(t);
|
|
758
|
-
e instanceof HTMLElement && B(e)
|
|
758
|
+
if (e instanceof HTMLElement && B(e)) e.value !== i && (e.value = i);
|
|
759
|
+
else if (n && r === "string" && i.trim().startsWith("<")) {
|
|
760
|
+
let t = d(i);
|
|
761
|
+
if (e.innerHTML === t) return;
|
|
762
|
+
e.innerHTML = t, this.#te(e), this.#M(e);
|
|
763
|
+
} else n && e.textContent !== i && (e.textContent = i);
|
|
759
764
|
}
|
|
760
765
|
#J(e, t) {
|
|
761
766
|
let n = this.#c.get(e);
|
package/dist/wrec-ssr.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "./wrec-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./wrec-CPzbCpSN.js";
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var a = Object.defineProperty, o = Object.getOwnPropertyDescriptor, s = Object.getOwnPropertyNames, c = Object.prototype.hasOwnProperty, l = (e, t) => () => (e && (t = e(e = 0)), t), u = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), d = (e, t) => {
|
|
4
4
|
let n = {};
|
package/dist/wrec.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "./wrec-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./wrec-CPzbCpSN.js";
|
|
2
2
|
export { i as Wrec, e as WrecState, n as createElement, r as css, t as html };
|
package/package.json
CHANGED
package/scripts/lint.js
CHANGED
|
@@ -842,7 +842,7 @@ function formatReport(
|
|
|
842
842
|
findings.invalidUsedByReferences.length > 0 ||
|
|
843
843
|
findings.invalidUseStateMaps.length > 0 ||
|
|
844
844
|
findings.invalidValuesConfigurations.length > 0 ||
|
|
845
|
-
findings.
|
|
845
|
+
findings.missingRequiredMembers.length > 0 ||
|
|
846
846
|
findings.missingTypeProperties.length > 0 ||
|
|
847
847
|
findings.reservedProperties.length > 0 ||
|
|
848
848
|
findings.typeErrors.length > 0 ||
|
|
@@ -985,9 +985,9 @@ function formatReport(
|
|
|
985
985
|
);
|
|
986
986
|
}
|
|
987
987
|
|
|
988
|
-
if (findings.
|
|
989
|
-
lines.push('missing
|
|
990
|
-
findings.
|
|
988
|
+
if (findings.missingRequiredMembers.length > 0) {
|
|
989
|
+
lines.push('missing required members:');
|
|
990
|
+
findings.missingRequiredMembers.forEach(message =>
|
|
991
991
|
lines.push(` ${message}`)
|
|
992
992
|
);
|
|
993
993
|
}
|
|
@@ -1287,6 +1287,16 @@ function getTypeSyntaxText(sourceFile, expression) {
|
|
|
1287
1287
|
return undefined;
|
|
1288
1288
|
}
|
|
1289
1289
|
|
|
1290
|
+
// Returns whether a component class defines its own static html property.
|
|
1291
|
+
function hasStaticHtmlDefinition(classNode) {
|
|
1292
|
+
for (const member of classNode.members) {
|
|
1293
|
+
if (!hasStaticModifier(member)) continue;
|
|
1294
|
+
if (!ts.isPropertyDeclaration(member)) continue;
|
|
1295
|
+
if (getMemberName(member) === 'html') return true;
|
|
1296
|
+
}
|
|
1297
|
+
return false;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1290
1300
|
// Returns whether a token kind is one of the supported arithmetic operators.
|
|
1291
1301
|
function isArithmeticOperator(kind) {
|
|
1292
1302
|
return (
|
|
@@ -1329,6 +1339,27 @@ function isImportLikeDeclaration(node) {
|
|
|
1329
1339
|
);
|
|
1330
1340
|
}
|
|
1331
1341
|
|
|
1342
|
+
// Returns whether a type represents an object-like value other than an array.
|
|
1343
|
+
function isNonArrayObjectLikeType(checker, type) {
|
|
1344
|
+
if (type.isUnion()) {
|
|
1345
|
+
return type.types.every(member =>
|
|
1346
|
+
isNonArrayObjectLikeType(checker, member)
|
|
1347
|
+
);
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
if (type.isIntersection()) {
|
|
1351
|
+
return type.types.every(member =>
|
|
1352
|
+
isNonArrayObjectLikeType(checker, member)
|
|
1353
|
+
);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
return (
|
|
1357
|
+
Boolean(type.flags & (ts.TypeFlags.Object | ts.TypeFlags.NonPrimitive)) &&
|
|
1358
|
+
!checker.isArrayType(type) &&
|
|
1359
|
+
!checker.isTupleType(type)
|
|
1360
|
+
);
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1332
1363
|
// Returns whether a type is fully numeric or any-like for arithmetic checks.
|
|
1333
1364
|
function isNumericLikeType(type) {
|
|
1334
1365
|
const parts = type.isUnion() ? type.types : [type];
|
|
@@ -1420,7 +1451,7 @@ export function lintSource(filePath, sourceText, options = {}) {
|
|
|
1420
1451
|
invalidUsedByReferences: [],
|
|
1421
1452
|
invalidUseStateMaps: [],
|
|
1422
1453
|
invalidValuesConfigurations: [],
|
|
1423
|
-
|
|
1454
|
+
missingRequiredMembers: [],
|
|
1424
1455
|
missingTypeProperties: [],
|
|
1425
1456
|
reservedProperties,
|
|
1426
1457
|
typeErrors: [],
|
|
@@ -1445,10 +1476,15 @@ export function lintSource(filePath, sourceText, options = {}) {
|
|
|
1445
1476
|
}));
|
|
1446
1477
|
|
|
1447
1478
|
if (allMethods.has('formAssociatedCallback') && !formAssociated) {
|
|
1448
|
-
findings.
|
|
1479
|
+
findings.missingRequiredMembers.push(
|
|
1449
1480
|
'formAssociatedCallback is defined, but static formAssociated is not true'
|
|
1450
1481
|
);
|
|
1451
1482
|
}
|
|
1483
|
+
if (!hasStaticHtmlDefinition(classNode)) {
|
|
1484
|
+
findings.missingRequiredMembers.push(
|
|
1485
|
+
'static html property must be defined'
|
|
1486
|
+
);
|
|
1487
|
+
}
|
|
1452
1488
|
|
|
1453
1489
|
const augmentedSource = buildAugmentedSource(
|
|
1454
1490
|
sourceFile,
|
|
@@ -1528,7 +1564,7 @@ export function lintSource(filePath, sourceText, options = {}) {
|
|
|
1528
1564
|
findings.invalidUsedByReferences.sort();
|
|
1529
1565
|
findings.invalidUseStateMaps.sort();
|
|
1530
1566
|
findings.invalidValuesConfigurations.sort();
|
|
1531
|
-
findings.
|
|
1567
|
+
findings.missingRequiredMembers.sort();
|
|
1532
1568
|
findings.missingTypeProperties.sort();
|
|
1533
1569
|
findings.reservedProperties.sort();
|
|
1534
1570
|
findings.typeErrors.sort((a, b) => a.expression.localeCompare(b.expression));
|
|
@@ -1602,23 +1638,6 @@ function requiresContextFunction(symbol, sourceFile) {
|
|
|
1602
1638
|
});
|
|
1603
1639
|
}
|
|
1604
1640
|
|
|
1605
|
-
// Returns whether a type represents an object-like value other than an array.
|
|
1606
|
-
function isNonArrayObjectLikeType(checker, type) {
|
|
1607
|
-
if (type.isUnion()) {
|
|
1608
|
-
return type.types.every(member => isNonArrayObjectLikeType(checker, member));
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
if (type.isIntersection()) {
|
|
1612
|
-
return type.types.every(member => isNonArrayObjectLikeType(checker, member));
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
return (
|
|
1616
|
-
Boolean(type.flags & (ts.TypeFlags.Object | ts.TypeFlags.NonPrimitive)) &&
|
|
1617
|
-
!checker.isArrayType(type) &&
|
|
1618
|
-
!checker.isTupleType(type)
|
|
1619
|
-
);
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
1641
|
// Resolves a relative import path to an existing source file.
|
|
1623
1642
|
function resolveImportPath(baseDir, importPath) {
|
|
1624
1643
|
if (!importPath.startsWith('.')) return undefined;
|
|
@@ -1971,7 +1990,13 @@ function validatePropertyConfigs(
|
|
|
1971
1990
|
'Boolean, Number, String, Object, or Array'
|
|
1972
1991
|
);
|
|
1973
1992
|
} else if (declaredTypeNode) {
|
|
1974
|
-
if (
|
|
1993
|
+
if (
|
|
1994
|
+
!typeExpressionMatchesDeclaredType(
|
|
1995
|
+
checker,
|
|
1996
|
+
typeExpression,
|
|
1997
|
+
declaredTypeNode
|
|
1998
|
+
)
|
|
1999
|
+
) {
|
|
1975
2000
|
findings.incompatibleDeclareTypes.push(
|
|
1976
2001
|
`property "${propName}" declare type ` +
|
|
1977
2002
|
`"${getPropertyTypeTextFromNode(sourceFile, declaredTypeNode)}" ` +
|