tutuca 0.9.70 → 0.9.72
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/chai.js +3389 -0
- package/dist/immutable.js +4333 -0
- package/dist/tutuca-cli.js +141 -2
- package/dist/tutuca-dev.ext.js +113 -3392
- package/dist/tutuca-dev.js +25 -0
- package/dist/tutuca-dev.min.js +2 -2
- package/package.json +9 -1
- package/skill/tutuca/cli.md +11 -9
- package/skill/tutuca/core.md +32 -3
- package/skill/tutuca/testing.md +16 -10
package/dist/tutuca-dev.js
CHANGED
|
@@ -12324,6 +12324,7 @@ var UNKNOWN_DIRECTIVE = "UNKNOWN_DIRECTIVE";
|
|
|
12324
12324
|
var UNKNOWN_X_OP = "UNKNOWN_X_OP";
|
|
12325
12325
|
var UNKNOWN_X_ATTR = "UNKNOWN_X_ATTR";
|
|
12326
12326
|
var MAYBE_DROP_AT_PREFIX = "MAYBE_DROP_AT_PREFIX";
|
|
12327
|
+
var MAYBE_ADD_AT_PREFIX = "MAYBE_ADD_AT_PREFIX";
|
|
12327
12328
|
var BAD_VALUE = "BAD_VALUE";
|
|
12328
12329
|
var UNSUPPORTED_EXPR_SYNTAX = "UNSUPPORTED_EXPR_SYNTAX";
|
|
12329
12330
|
var REDUNDANT_TEMPLATE_STRING = "REDUNDANT_TEMPLATE_STRING";
|
|
@@ -12340,6 +12341,7 @@ var X_KNOWN_OP_NAMES = new Set([
|
|
|
12340
12341
|
"hide"
|
|
12341
12342
|
]);
|
|
12342
12343
|
var X_KNOWN_ATTR_NAMES = new Set(["as", "when", "loop-with", "show", "hide"]);
|
|
12344
|
+
var HOST_DIRECTIVE_ONLY_NAMES = new Set(["when", "enrich-with", "loop-with", "show", "hide"]);
|
|
12343
12345
|
var LEVEL_WARN2 = "warn";
|
|
12344
12346
|
var LEVEL_ERROR2 = "error";
|
|
12345
12347
|
var LEVEL_HINT = "hint";
|
|
@@ -12741,6 +12743,23 @@ function attrOriginAttr(attr) {
|
|
|
12741
12743
|
return "@dangerouslysetinnerhtml";
|
|
12742
12744
|
return `:${attr.name}`;
|
|
12743
12745
|
}
|
|
12746
|
+
function checkHostBareDirectives(lx, attrs, tag, isMacroCall) {
|
|
12747
|
+
if (isMacroCall || !attrs)
|
|
12748
|
+
return;
|
|
12749
|
+
const kind = attrs.constructor.name;
|
|
12750
|
+
let names;
|
|
12751
|
+
if (kind === "ConstAttrs")
|
|
12752
|
+
names = Object.keys(attrs.items);
|
|
12753
|
+
else if (kind === "DynAttrs")
|
|
12754
|
+
names = attrs.items.map((a) => a?.name);
|
|
12755
|
+
else
|
|
12756
|
+
return;
|
|
12757
|
+
for (const name of names) {
|
|
12758
|
+
if (HOST_DIRECTIVE_ONLY_NAMES.has(name)) {
|
|
12759
|
+
lx.hint(MAYBE_ADD_AT_PREFIX, { name, tag, suggestion: `@${name}` }, { kind: "add-prefix", from: name, to: `@${name}` });
|
|
12760
|
+
}
|
|
12761
|
+
}
|
|
12762
|
+
}
|
|
12744
12763
|
function checkConsistentAttrs(lx, Comp, referencedAlters, referencedDynamics) {
|
|
12745
12764
|
const { views } = Comp;
|
|
12746
12765
|
const env = mkAttrValEnv(Comp, referencedAlters, referencedDynamics);
|
|
@@ -12749,6 +12768,7 @@ function checkConsistentAttrs(lx, Comp, referencedAlters, referencedDynamics) {
|
|
|
12749
12768
|
const view = views[viewName];
|
|
12750
12769
|
for (const entry of view.ctx.attrs) {
|
|
12751
12770
|
const { attrs, wrapperAttrs, textChild, isMacroCall, tag } = entry;
|
|
12771
|
+
checkHostBareDirectives(lx, attrs, tag, isMacroCall);
|
|
12752
12772
|
if (attrs?.constructor.name === "DynAttrs") {
|
|
12753
12773
|
const sourcesByName = new Map;
|
|
12754
12774
|
for (const attr of attrs.items) {
|
|
@@ -13507,6 +13527,8 @@ function lintIdToMessage(id, info) {
|
|
|
13507
13527
|
const written = info.value !== undefined ? `${info.name}=${JSON.stringify(info.value)}` : info.name;
|
|
13508
13528
|
return `'${written}' on <x> looks like a directive but is actually an x op/attr written with a leading '@'`;
|
|
13509
13529
|
}
|
|
13530
|
+
case "MAYBE_ADD_AT_PREFIX":
|
|
13531
|
+
return `'${info.name}' on <${(info.tag ?? "").toLowerCase()}> is a plain attribute, but '@${info.name}' is a directive — add the leading '@'`;
|
|
13510
13532
|
case "BAD_VALUE":
|
|
13511
13533
|
return `${badValueMessage(info)}${fmtTagSuffix(info)}`;
|
|
13512
13534
|
case "UNSUPPORTED_EXPR_SYNTAX":
|
|
@@ -13517,6 +13539,8 @@ function lintIdToMessage(id, info) {
|
|
|
13517
13539
|
return `Template string has no dynamic parts — use the string literal ${info.literal} instead${fmtOriginSuffix(info)}`;
|
|
13518
13540
|
case "UNKNOWN_COMPONENT_SPEC_KEY":
|
|
13519
13541
|
return `Unknown component spec key '${info.key}' — value will be ignored at runtime`;
|
|
13542
|
+
case "COMP_FIELD_BAD_SHAPE":
|
|
13543
|
+
return info.kind === "args-not-object" ? `Field '${info.fieldName}': in { component, args }, 'args' must be a plain object, got ${info.got}` : `Field '${info.fieldName}': in { component, args }, 'component' must be the component name as a string, got ${info.gotName ? `the ${info.gotName} class` : info.got}`;
|
|
13520
13544
|
case "HTML_TAG_NAME_HAS_UPPERCASE":
|
|
13521
13545
|
return `Tag <${info.raw}> will be lowercased to <${info.lowercased}>${fmtLocationSuffix(info)}`;
|
|
13522
13546
|
case "HTML_SVG_TAG_WILL_LOWERCASE":
|
|
@@ -15646,6 +15670,7 @@ export {
|
|
|
15646
15670
|
METHOD_VAL_NOT_DEFINED,
|
|
15647
15671
|
METHOD_VAL_IS_FIELD,
|
|
15648
15672
|
MAYBE_DROP_AT_PREFIX,
|
|
15673
|
+
MAYBE_ADD_AT_PREFIX,
|
|
15649
15674
|
List,
|
|
15650
15675
|
LintReport,
|
|
15651
15676
|
LintParseContext,
|