Comparing version 5.14.1 to 5.14.2
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.14.1", | ||
"version": "5.14.2", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "./types/index.d.ts", |
@@ -10,5 +10,6 @@ /** @import { Expression } from 'estree' */ | ||
* @param {Parser} parser | ||
* @param {string} [opening_token] | ||
* @returns {Expression} | ||
*/ | ||
export default function read_expression(parser) { | ||
export default function read_expression(parser, opening_token) { | ||
try { | ||
@@ -46,3 +47,3 @@ const node = parse_expression_at(parser.template, parser.ts, parser.index); | ||
// Find the next } and treat it as the end of the expression | ||
const end = find_matching_bracket(parser.template, parser.index, '{'); | ||
const end = find_matching_bracket(parser.template, parser.index, opening_token ?? '{'); | ||
if (end) { | ||
@@ -49,0 +50,0 @@ const start = parser.index; |
@@ -126,4 +126,7 @@ /** @import { Expression } from 'estree' */ | ||
if (!regex_valid_element_name.test(name) && !regex_valid_component_name.test(name)) { | ||
const bounds = { start: start + 1, end: start + 1 + name.length }; | ||
e.tag_invalid_name(bounds); | ||
// <div. -> in the middle of typing -> allow in loose mode | ||
if (!parser.loose || !name.endsWith('.')) { | ||
const bounds = { start: start + 1, end: start + 1 + name.length }; | ||
e.tag_invalid_name(bounds); | ||
} | ||
} | ||
@@ -145,3 +148,3 @@ | ||
? meta_tags.get(name) | ||
: regex_valid_component_name.test(name) | ||
: regex_valid_component_name.test(name) || (parser.loose && name.endsWith('.')) | ||
? 'Component' | ||
@@ -148,0 +151,0 @@ : name === 'title' && parent_is_head(parser.stack) |
@@ -177,3 +177,3 @@ /** @import { ArrowFunctionExpression, Expression, Identifier, Pattern } from 'estree' */ | ||
key = read_expression(parser); | ||
key = read_expression(parser, '('); | ||
parser.allow_whitespace(); | ||
@@ -184,4 +184,21 @@ parser.eat(')', true); | ||
parser.eat('}', true); | ||
const matches = parser.eat('}', true, false); | ||
if (!matches) { | ||
// Parser may have read the `as` as part of the expression (e.g. in `{#each foo. as x}`) | ||
if (parser.template.slice(parser.index - 4, parser.index) === ' as ') { | ||
const prev_index = parser.index; | ||
context = read_pattern(parser); | ||
parser.eat('}', true); | ||
expression = { | ||
type: 'Identifier', | ||
name: '', | ||
start: expression.start, | ||
end: prev_index - 4 | ||
}; | ||
} else { | ||
parser.eat('}', true); // rerun to produce the parser error | ||
} | ||
} | ||
/** @type {AST.EachBlock} */ | ||
@@ -251,3 +268,35 @@ const block = parser.append({ | ||
parser.eat('}', true); | ||
const matches = parser.eat('}', true, false); | ||
// Parser may have read the `then/catch` as part of the expression (e.g. in `{#await foo. then x}`) | ||
if (!matches) { | ||
if (parser.template.slice(parser.index - 6, parser.index) === ' then ') { | ||
const prev_index = parser.index; | ||
block.value = read_pattern(parser); | ||
parser.eat('}', true); | ||
block.expression = { | ||
type: 'Identifier', | ||
name: '', | ||
start: expression.start, | ||
end: prev_index - 6 | ||
}; | ||
block.then = block.pending; | ||
block.pending = null; | ||
} else if (parser.template.slice(parser.index - 7, parser.index) === ' catch ') { | ||
const prev_index = parser.index; | ||
block.error = read_pattern(parser); | ||
parser.eat('}', true); | ||
block.expression = { | ||
type: 'Identifier', | ||
name: '', | ||
start: expression.start, | ||
end: prev_index - 7 | ||
}; | ||
block.catch = block.pending; | ||
block.pending = null; | ||
} else { | ||
parser.eat('}', true); // rerun to produce the parser error | ||
} | ||
} | ||
parser.stack.push(block); | ||
@@ -254,0 +303,0 @@ |
@@ -7,2 +7,4 @@ import full_char_code_at from './full_char_code_at.js'; | ||
const CURLY_BRACKET_CLOSE = '}'.charCodeAt(0); | ||
const PARENTHESES_OPEN = '('.charCodeAt(0); | ||
const PARENTHESES_CLOSE = ')'.charCodeAt(0); | ||
@@ -38,2 +40,5 @@ /** @param {number} code */ | ||
} | ||
if (open === PARENTHESES_OPEN) { | ||
return PARENTHESES_CLOSE; | ||
} | ||
} | ||
@@ -40,0 +45,0 @@ |
@@ -130,4 +130,4 @@ /** @import { ComponentContext, Derived, Effect, Reaction, Signal, Source, Value } from '#client' */ | ||
/** @type {number} Used by sources and deriveds for handling updates to unowned deriveds */ | ||
let current_version = 0; | ||
/** @type {number} Used by sources and deriveds for handling updates to unowned deriveds it starts from 1 to differentiate between a created effect and a run one for tracing */ | ||
let current_version = 1; | ||
@@ -134,0 +134,0 @@ // If we are working with a get() chain that has no active container, |
@@ -9,3 +9,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.14.1'; | ||
export const VERSION = '5.14.2'; | ||
export const PUBLIC_VERSION = '5'; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2459786
54264