tutuca 0.9.87 → 0.9.88
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/tutuca-cli.js +25 -1
- package/dist/tutuca-dev.ext.js +20 -0
- package/dist/tutuca-dev.js +20 -0
- package/dist/tutuca-dev.min.js +2 -2
- package/package.json +1 -1
package/dist/tutuca-cli.js
CHANGED
|
@@ -12938,6 +12938,7 @@ function checkComponent(Comp, lx = new LintContext, { wellKnownExtras = EMPTY_SE
|
|
|
12938
12938
|
checkFieldDeclarations(lx, Comp);
|
|
12939
12939
|
checkProvidesAreAddressable(lx, Comp);
|
|
12940
12940
|
checkLookupShapes(lx, Comp);
|
|
12941
|
+
checkHandlersNotAsync(lx, Comp);
|
|
12941
12942
|
const referencedAlters = new Set;
|
|
12942
12943
|
const referencedInputs = new Set;
|
|
12943
12944
|
const referencedDynamics = new Set;
|
|
@@ -13334,6 +13335,19 @@ function checkUnreferencedInputHandlers(lx, Comp, referencedInputs) {
|
|
|
13334
13335
|
}
|
|
13335
13336
|
}
|
|
13336
13337
|
}
|
|
13338
|
+
function checkHandlersNotAsync(lx, Comp) {
|
|
13339
|
+
for (const channel of HANDLER_CHANNELS) {
|
|
13340
|
+
const block = Comp[channel];
|
|
13341
|
+
if (!block)
|
|
13342
|
+
continue;
|
|
13343
|
+
for (const name in block) {
|
|
13344
|
+
const fn = block[name];
|
|
13345
|
+
if (typeof fn === "function" && fn.constructor?.name === "AsyncFunction") {
|
|
13346
|
+
lx.error(ASYNC_HANDLER, { name, channel }, { kind: "rephrase", from: name, text: ASYNC_HANDLER_HELP });
|
|
13347
|
+
}
|
|
13348
|
+
}
|
|
13349
|
+
}
|
|
13350
|
+
}
|
|
13337
13351
|
function checkProvidesAreAddressable(lx, Comp) {
|
|
13338
13352
|
for (const name in Comp._rawProvide) {
|
|
13339
13353
|
if (Comp.provide[name] === undefined) {
|
|
@@ -13410,7 +13424,7 @@ class LintContext {
|
|
|
13410
13424
|
this.reports.push({ id, info, level, context: { ...this.frame }, suggestion });
|
|
13411
13425
|
}
|
|
13412
13426
|
}
|
|
13413
|
-
var KNOWN_COMPONENT_SPEC_KEYS, EMPTY_SET2, KNOWN_DIRECTIVE_NAMES, ALT_HANDLER_NOT_DEFINED = "ALT_HANDLER_NOT_DEFINED", ALT_HANDLER_NOT_REFERENCED = "ALT_HANDLER_NOT_REFERENCED", DYN_VAL_NOT_DEFINED = "DYN_VAL_NOT_DEFINED", DYN_ALIAS_NOT_REFERENCED = "DYN_ALIAS_NOT_REFERENCED", PROVIDE_NOT_ADDRESSABLE = "PROVIDE_NOT_ADDRESSABLE", LOOKUP_BAD_SHAPE = "LOOKUP_BAD_SHAPE", LOOKUP_TARGET_MALFORMED = "LOOKUP_TARGET_MALFORMED", RENDER_IT_OUTSIDE_OF_LOOP = "RENDER_IT_OUTSIDE_OF_LOOP", UNKNOWN_EVENT_MODIFIER = "UNKNOWN_EVENT_MODIFIER", UNKNOWN_HANDLER_ARG_NAME = "UNKNOWN_HANDLER_ARG_NAME", INPUT_HANDLER_NOT_IMPLEMENTED = "INPUT_HANDLER_NOT_IMPLEMENTED", INPUT_HANDLER_NOT_REFERENCED = "INPUT_HANDLER_NOT_REFERENCED", INPUT_HANDLER_METHOD_NOT_IMPLEMENTED = "INPUT_HANDLER_METHOD_NOT_IMPLEMENTED", INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD = "INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD", INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER = "INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER", FIELD_VAL_NOT_DEFINED = "FIELD_VAL_NOT_DEFINED", FIELD_VAL_IS_METHOD = "FIELD_VAL_IS_METHOD", METHOD_VAL_NOT_DEFINED = "METHOD_VAL_NOT_DEFINED", METHOD_VAL_IS_FIELD = "METHOD_VAL_IS_FIELD", DUPLICATE_ATTR_DEFINITION = "DUPLICATE_ATTR_DEFINITION", IF_NO_BRANCH_SET = "IF_NO_BRANCH_SET", UNKNOWN_REQUEST_NAME = "UNKNOWN_REQUEST_NAME", UNKNOWN_COMPONENT_NAME = "UNKNOWN_COMPONENT_NAME", UNKNOWN_MACRO_ARG = "UNKNOWN_MACRO_ARG", UNKNOWN_DIRECTIVE = "UNKNOWN_DIRECTIVE", UNKNOWN_X_OP = "UNKNOWN_X_OP", UNKNOWN_X_ATTR = "UNKNOWN_X_ATTR", MAYBE_DROP_AT_PREFIX = "MAYBE_DROP_AT_PREFIX", MAYBE_ADD_AT_PREFIX = "MAYBE_ADD_AT_PREFIX", BAD_VALUE = "BAD_VALUE", UNSUPPORTED_EXPR_SYNTAX = "UNSUPPORTED_EXPR_SYNTAX", REDUNDANT_TEMPLATE_STRING = "REDUNDANT_TEMPLATE_STRING", PLACEHOLDERLESS_TEMPLATE_STRING = "PLACEHOLDERLESS_TEMPLATE_STRING", UNKNOWN_COMPONENT_SPEC_KEY = "UNKNOWN_COMPONENT_SPEC_KEY", COMP_FIELD_BAD_SHAPE = "COMP_FIELD_BAD_SHAPE", X_KNOWN_OP_NAMES, X_KNOWN_ATTR_NAMES, HOST_DIRECTIVE_ONLY_NAMES, LEVEL_WARN2 = "warn", LEVEL_ERROR2 = "error", LEVEL_HINT = "hint", PARSE_ISSUES, UNSUPPORTED_EXPR_GUIDANCE, HTML_LINT_OPTS, NO_WRAPPERS, KNOWN_HANDLER_NAMES, fixTo = (from, to) => ({ kind: "rewrite", from, to }), ATTR_VAL_CHECKERS, NODE_KIND_TO_CTX, KNOWN_LOOKUP_KEYS, LintParseContext;
|
|
13427
|
+
var KNOWN_COMPONENT_SPEC_KEYS, EMPTY_SET2, KNOWN_DIRECTIVE_NAMES, ALT_HANDLER_NOT_DEFINED = "ALT_HANDLER_NOT_DEFINED", ALT_HANDLER_NOT_REFERENCED = "ALT_HANDLER_NOT_REFERENCED", DYN_VAL_NOT_DEFINED = "DYN_VAL_NOT_DEFINED", DYN_ALIAS_NOT_REFERENCED = "DYN_ALIAS_NOT_REFERENCED", PROVIDE_NOT_ADDRESSABLE = "PROVIDE_NOT_ADDRESSABLE", LOOKUP_BAD_SHAPE = "LOOKUP_BAD_SHAPE", LOOKUP_TARGET_MALFORMED = "LOOKUP_TARGET_MALFORMED", RENDER_IT_OUTSIDE_OF_LOOP = "RENDER_IT_OUTSIDE_OF_LOOP", UNKNOWN_EVENT_MODIFIER = "UNKNOWN_EVENT_MODIFIER", UNKNOWN_HANDLER_ARG_NAME = "UNKNOWN_HANDLER_ARG_NAME", INPUT_HANDLER_NOT_IMPLEMENTED = "INPUT_HANDLER_NOT_IMPLEMENTED", INPUT_HANDLER_NOT_REFERENCED = "INPUT_HANDLER_NOT_REFERENCED", INPUT_HANDLER_METHOD_NOT_IMPLEMENTED = "INPUT_HANDLER_METHOD_NOT_IMPLEMENTED", INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD = "INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD", INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER = "INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER", FIELD_VAL_NOT_DEFINED = "FIELD_VAL_NOT_DEFINED", FIELD_VAL_IS_METHOD = "FIELD_VAL_IS_METHOD", METHOD_VAL_NOT_DEFINED = "METHOD_VAL_NOT_DEFINED", METHOD_VAL_IS_FIELD = "METHOD_VAL_IS_FIELD", DUPLICATE_ATTR_DEFINITION = "DUPLICATE_ATTR_DEFINITION", IF_NO_BRANCH_SET = "IF_NO_BRANCH_SET", UNKNOWN_REQUEST_NAME = "UNKNOWN_REQUEST_NAME", UNKNOWN_COMPONENT_NAME = "UNKNOWN_COMPONENT_NAME", UNKNOWN_MACRO_ARG = "UNKNOWN_MACRO_ARG", UNKNOWN_DIRECTIVE = "UNKNOWN_DIRECTIVE", UNKNOWN_X_OP = "UNKNOWN_X_OP", UNKNOWN_X_ATTR = "UNKNOWN_X_ATTR", MAYBE_DROP_AT_PREFIX = "MAYBE_DROP_AT_PREFIX", MAYBE_ADD_AT_PREFIX = "MAYBE_ADD_AT_PREFIX", BAD_VALUE = "BAD_VALUE", UNSUPPORTED_EXPR_SYNTAX = "UNSUPPORTED_EXPR_SYNTAX", REDUNDANT_TEMPLATE_STRING = "REDUNDANT_TEMPLATE_STRING", PLACEHOLDERLESS_TEMPLATE_STRING = "PLACEHOLDERLESS_TEMPLATE_STRING", UNKNOWN_COMPONENT_SPEC_KEY = "UNKNOWN_COMPONENT_SPEC_KEY", COMP_FIELD_BAD_SHAPE = "COMP_FIELD_BAD_SHAPE", ASYNC_HANDLER = "ASYNC_HANDLER", X_KNOWN_OP_NAMES, X_KNOWN_ATTR_NAMES, HOST_DIRECTIVE_ONLY_NAMES, LEVEL_WARN2 = "warn", LEVEL_ERROR2 = "error", LEVEL_HINT = "hint", PARSE_ISSUES, UNSUPPORTED_EXPR_GUIDANCE, HTML_LINT_OPTS, NO_WRAPPERS, KNOWN_HANDLER_NAMES, fixTo = (from, to) => ({ kind: "rewrite", from, to }), ATTR_VAL_CHECKERS, NODE_KIND_TO_CTX, HANDLER_CHANNELS, ASYNC_HANDLER_HELP, KNOWN_LOOKUP_KEYS, LintParseContext;
|
|
13414
13428
|
var init_lint_check = __esm(() => {
|
|
13415
13429
|
init_anode();
|
|
13416
13430
|
init_htmllinter();
|
|
@@ -13558,6 +13572,8 @@ var init_lint_check = __esm(() => {
|
|
|
13558
13572
|
HideNode: { originAttr: "<x hide>" },
|
|
13559
13573
|
PushViewNameNode: { originAttr: "<x push-view>" }
|
|
13560
13574
|
};
|
|
13575
|
+
HANDLER_CHANNELS = ["input", "receive", "bubble", "response", "alter"];
|
|
13576
|
+
ASYNC_HANDLER_HELP = "Handlers must be synchronous and return the updated state. Move the async " + "work into a request handler and trigger it with ctx.request('name', args), " + "then handle the result in a synchronous response handler. To coordinate other " + "components, keep the handler synchronous and use ctx.send to deliver a message " + "or ctx.bubble to raise an event.";
|
|
13561
13577
|
KNOWN_LOOKUP_KEYS = new Set(["for", "default"]);
|
|
13562
13578
|
LintParseContext = class LintParseContext extends ParseContext {
|
|
13563
13579
|
constructor(document2, Text, Comment) {
|
|
@@ -15039,6 +15055,12 @@ var init_lint_rules = __esm(() => {
|
|
|
15039
15055
|
group: "Component spec",
|
|
15040
15056
|
summary: "`component({...})` has an unrecognized key; its value is ignored at runtime."
|
|
15041
15057
|
},
|
|
15058
|
+
{
|
|
15059
|
+
code: ASYNC_HANDLER,
|
|
15060
|
+
level: "error",
|
|
15061
|
+
group: "Handler effects",
|
|
15062
|
+
summary: "A handler in `input`/`receive`/`bubble`/`response`/`alter` is an async " + "function — handlers must be synchronous; use a request handler, `ctx.send`, " + "or `ctx.bubble` instead."
|
|
15063
|
+
},
|
|
15042
15064
|
{
|
|
15043
15065
|
code: COMP_FIELD_BAD_SHAPE,
|
|
15044
15066
|
level: "error",
|
|
@@ -15232,6 +15254,8 @@ function lintIdToMessage(id, info) {
|
|
|
15232
15254
|
return `SVG attribute '${info.raw}' will be rewritten to '${info.canonical}'${fmtLocationSuffix(info)}`;
|
|
15233
15255
|
case "HTML_MATHML_ATTR_WILL_LOWERCASE":
|
|
15234
15256
|
return `MathML attribute '${info.raw}' will be rewritten to '${info.canonical}'${fmtLocationSuffix(info)}`;
|
|
15257
|
+
case "ASYNC_HANDLER":
|
|
15258
|
+
return `Handler '${info.name}' in '${info.channel}' is an async function — handlers must be synchronous and return the updated state (an async function returns a Promise the framework won't await)`;
|
|
15235
15259
|
case "LINT_ERROR":
|
|
15236
15260
|
return info.message;
|
|
15237
15261
|
default:
|
package/dist/tutuca-dev.ext.js
CHANGED
|
@@ -5020,6 +5020,7 @@ var REDUNDANT_TEMPLATE_STRING = "REDUNDANT_TEMPLATE_STRING";
|
|
|
5020
5020
|
var PLACEHOLDERLESS_TEMPLATE_STRING = "PLACEHOLDERLESS_TEMPLATE_STRING";
|
|
5021
5021
|
var UNKNOWN_COMPONENT_SPEC_KEY = "UNKNOWN_COMPONENT_SPEC_KEY";
|
|
5022
5022
|
var COMP_FIELD_BAD_SHAPE = "COMP_FIELD_BAD_SHAPE";
|
|
5023
|
+
var ASYNC_HANDLER = "ASYNC_HANDLER";
|
|
5023
5024
|
var X_KNOWN_OP_NAMES = new Set([
|
|
5024
5025
|
"slot",
|
|
5025
5026
|
"text",
|
|
@@ -5110,6 +5111,7 @@ function checkComponent(Comp, lx = new LintContext, { wellKnownExtras = EMPTY_SE
|
|
|
5110
5111
|
checkFieldDeclarations(lx, Comp);
|
|
5111
5112
|
checkProvidesAreAddressable(lx, Comp);
|
|
5112
5113
|
checkLookupShapes(lx, Comp);
|
|
5114
|
+
checkHandlersNotAsync(lx, Comp);
|
|
5113
5115
|
const referencedAlters = new Set;
|
|
5114
5116
|
const referencedInputs = new Set;
|
|
5115
5117
|
const referencedDynamics = new Set;
|
|
@@ -5608,6 +5610,21 @@ function checkUnreferencedInputHandlers(lx, Comp, referencedInputs) {
|
|
|
5608
5610
|
}
|
|
5609
5611
|
}
|
|
5610
5612
|
}
|
|
5613
|
+
var HANDLER_CHANNELS = ["input", "receive", "bubble", "response", "alter"];
|
|
5614
|
+
var ASYNC_HANDLER_HELP = "Handlers must be synchronous and return the updated state. Move the async " + "work into a request handler and trigger it with ctx.request('name', args), " + "then handle the result in a synchronous response handler. To coordinate other " + "components, keep the handler synchronous and use ctx.send to deliver a message " + "or ctx.bubble to raise an event.";
|
|
5615
|
+
function checkHandlersNotAsync(lx, Comp) {
|
|
5616
|
+
for (const channel of HANDLER_CHANNELS) {
|
|
5617
|
+
const block = Comp[channel];
|
|
5618
|
+
if (!block)
|
|
5619
|
+
continue;
|
|
5620
|
+
for (const name in block) {
|
|
5621
|
+
const fn = block[name];
|
|
5622
|
+
if (typeof fn === "function" && fn.constructor?.name === "AsyncFunction") {
|
|
5623
|
+
lx.error(ASYNC_HANDLER, { name, channel }, { kind: "rephrase", from: name, text: ASYNC_HANDLER_HELP });
|
|
5624
|
+
}
|
|
5625
|
+
}
|
|
5626
|
+
}
|
|
5627
|
+
}
|
|
5611
5628
|
function checkProvidesAreAddressable(lx, Comp) {
|
|
5612
5629
|
for (const name in Comp._rawProvide) {
|
|
5613
5630
|
if (Comp.provide[name] === undefined) {
|
|
@@ -6322,6 +6339,8 @@ function lintIdToMessage(id, info) {
|
|
|
6322
6339
|
return `SVG attribute '${info.raw}' will be rewritten to '${info.canonical}'${fmtLocationSuffix(info)}`;
|
|
6323
6340
|
case "HTML_MATHML_ATTR_WILL_LOWERCASE":
|
|
6324
6341
|
return `MathML attribute '${info.raw}' will be rewritten to '${info.canonical}'${fmtLocationSuffix(info)}`;
|
|
6342
|
+
case "ASYNC_HANDLER":
|
|
6343
|
+
return `Handler '${info.name}' in '${info.channel}' is an async function — handlers must be synchronous and return the updated state (an async function returns a Promise the framework won't await)`;
|
|
6325
6344
|
case "LINT_ERROR":
|
|
6326
6345
|
return info.message;
|
|
6327
6346
|
default:
|
|
@@ -8208,6 +8227,7 @@ export {
|
|
|
8208
8227
|
Collection,
|
|
8209
8228
|
COMP_FIELD_BAD_SHAPE,
|
|
8210
8229
|
BAD_VALUE,
|
|
8230
|
+
ASYNC_HANDLER,
|
|
8211
8231
|
ALT_HANDLER_NOT_REFERENCED,
|
|
8212
8232
|
ALT_HANDLER_NOT_DEFINED
|
|
8213
8233
|
};
|
package/dist/tutuca-dev.js
CHANGED
|
@@ -12671,6 +12671,7 @@ var REDUNDANT_TEMPLATE_STRING = "REDUNDANT_TEMPLATE_STRING";
|
|
|
12671
12671
|
var PLACEHOLDERLESS_TEMPLATE_STRING = "PLACEHOLDERLESS_TEMPLATE_STRING";
|
|
12672
12672
|
var UNKNOWN_COMPONENT_SPEC_KEY = "UNKNOWN_COMPONENT_SPEC_KEY";
|
|
12673
12673
|
var COMP_FIELD_BAD_SHAPE = "COMP_FIELD_BAD_SHAPE";
|
|
12674
|
+
var ASYNC_HANDLER = "ASYNC_HANDLER";
|
|
12674
12675
|
var X_KNOWN_OP_NAMES = new Set([
|
|
12675
12676
|
"slot",
|
|
12676
12677
|
"text",
|
|
@@ -12761,6 +12762,7 @@ function checkComponent(Comp, lx = new LintContext, { wellKnownExtras = EMPTY_SE
|
|
|
12761
12762
|
checkFieldDeclarations(lx, Comp);
|
|
12762
12763
|
checkProvidesAreAddressable(lx, Comp);
|
|
12763
12764
|
checkLookupShapes(lx, Comp);
|
|
12765
|
+
checkHandlersNotAsync(lx, Comp);
|
|
12764
12766
|
const referencedAlters = new Set;
|
|
12765
12767
|
const referencedInputs = new Set;
|
|
12766
12768
|
const referencedDynamics = new Set;
|
|
@@ -13259,6 +13261,21 @@ function checkUnreferencedInputHandlers(lx, Comp, referencedInputs) {
|
|
|
13259
13261
|
}
|
|
13260
13262
|
}
|
|
13261
13263
|
}
|
|
13264
|
+
var HANDLER_CHANNELS = ["input", "receive", "bubble", "response", "alter"];
|
|
13265
|
+
var ASYNC_HANDLER_HELP = "Handlers must be synchronous and return the updated state. Move the async " + "work into a request handler and trigger it with ctx.request('name', args), " + "then handle the result in a synchronous response handler. To coordinate other " + "components, keep the handler synchronous and use ctx.send to deliver a message " + "or ctx.bubble to raise an event.";
|
|
13266
|
+
function checkHandlersNotAsync(lx, Comp) {
|
|
13267
|
+
for (const channel of HANDLER_CHANNELS) {
|
|
13268
|
+
const block = Comp[channel];
|
|
13269
|
+
if (!block)
|
|
13270
|
+
continue;
|
|
13271
|
+
for (const name in block) {
|
|
13272
|
+
const fn = block[name];
|
|
13273
|
+
if (typeof fn === "function" && fn.constructor?.name === "AsyncFunction") {
|
|
13274
|
+
lx.error(ASYNC_HANDLER, { name, channel }, { kind: "rephrase", from: name, text: ASYNC_HANDLER_HELP });
|
|
13275
|
+
}
|
|
13276
|
+
}
|
|
13277
|
+
}
|
|
13278
|
+
}
|
|
13262
13279
|
function checkProvidesAreAddressable(lx, Comp) {
|
|
13263
13280
|
for (const name in Comp._rawProvide) {
|
|
13264
13281
|
if (Comp.provide[name] === undefined) {
|
|
@@ -13973,6 +13990,8 @@ function lintIdToMessage(id, info) {
|
|
|
13973
13990
|
return `SVG attribute '${info.raw}' will be rewritten to '${info.canonical}'${fmtLocationSuffix(info)}`;
|
|
13974
13991
|
case "HTML_MATHML_ATTR_WILL_LOWERCASE":
|
|
13975
13992
|
return `MathML attribute '${info.raw}' will be rewritten to '${info.canonical}'${fmtLocationSuffix(info)}`;
|
|
13993
|
+
case "ASYNC_HANDLER":
|
|
13994
|
+
return `Handler '${info.name}' in '${info.channel}' is an async function — handlers must be synchronous and return the updated state (an async function returns a Promise the framework won't await)`;
|
|
13976
13995
|
case "LINT_ERROR":
|
|
13977
13996
|
return info.message;
|
|
13978
13997
|
default:
|
|
@@ -15802,6 +15821,7 @@ export {
|
|
|
15802
15821
|
Collection,
|
|
15803
15822
|
COMP_FIELD_BAD_SHAPE,
|
|
15804
15823
|
BAD_VALUE,
|
|
15824
|
+
ASYNC_HANDLER,
|
|
15805
15825
|
ALT_HANDLER_NOT_REFERENCED,
|
|
15806
15826
|
ALT_HANDLER_NOT_DEFINED
|
|
15807
15827
|
};
|