Comparing version 5.0.0-next.207 to 5.0.0-next.208
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.0.0-next.207", | ||
"version": "5.0.0-next.208", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "./types/index.d.ts", |
@@ -1278,3 +1278,3 @@ /* This file is generated by scripts/process-messages/index.js. Do not edit! */ | ||
/** | ||
* Valid values are %list% | ||
* Value must be %list%, if specified | ||
* @param {null | number | NodeLike} node | ||
@@ -1285,3 +1285,3 @@ * @param {string} list | ||
export function svelte_options_invalid_attribute_value(node, list) { | ||
e(node, "svelte_options_invalid_attribute_value", `Valid values are ${list}`); | ||
e(node, "svelte_options_invalid_attribute_value", `Value must be ${list}, if specified`); | ||
} | ||
@@ -1288,0 +1288,0 @@ |
@@ -178,2 +178,13 @@ /** @import { ObjectExpression } from 'estree' */ | ||
} | ||
case 'css': { | ||
const value = get_static_value(attribute); | ||
if (value === 'injected') { | ||
component_options.css = value; | ||
} else { | ||
e.svelte_options_invalid_attribute_value(attribute, `"injected"`); | ||
} | ||
break; | ||
} | ||
case 'immutable': { | ||
@@ -180,0 +191,0 @@ component_options.immutable = get_boolean_value(attribute); |
@@ -60,2 +60,3 @@ /** @import { Node, Program } from 'estree' */ | ||
import { SvelteSelf } from './visitors/SvelteSelf.js'; | ||
import { TaggedTemplateExpression } from './visitors/TaggedTemplateExpression.js'; | ||
import { Text } from './visitors/Text.js'; | ||
@@ -164,2 +165,3 @@ import { TitleElement } from './visitors/TitleElement.js'; | ||
SvelteSelf, | ||
TaggedTemplateExpression, | ||
Text, | ||
@@ -166,0 +168,0 @@ TitleElement, |
@@ -7,3 +7,3 @@ /** @import { CallExpression, VariableDeclarator } from 'estree' */ | ||
import { get_parent, unwrap_optional } from '../../../utils/ast.js'; | ||
import { is_safe_identifier } from './shared/utils.js'; | ||
import { is_known_safe_call, is_safe_identifier } from './shared/utils.js'; | ||
@@ -154,3 +154,3 @@ /** | ||
if (context.state.expression && !is_known_safe_call(node, context)) { | ||
if (context.state.expression && !is_known_safe_call(node.callee, context)) { | ||
context.state.expression.has_call = true; | ||
@@ -187,26 +187,1 @@ context.state.expression.has_state = true; | ||
} | ||
/** | ||
* @param {CallExpression} node | ||
* @param {Context} context | ||
* @returns {boolean} | ||
*/ | ||
function is_known_safe_call(node, context) { | ||
const callee = node.callee; | ||
// String / Number / BigInt / Boolean casting calls | ||
if (callee.type === 'Identifier') { | ||
const name = callee.name; | ||
const binding = context.state.scope.get(name); | ||
if ( | ||
binding === null && | ||
(name === 'BigInt' || name === 'String' || name === 'Number' || name === 'Boolean') | ||
) { | ||
return true; | ||
} | ||
} | ||
// TODO add more cases | ||
return false; | ||
} |
@@ -1,2 +0,2 @@ | ||
/** @import { AssignmentExpression, Expression, Pattern, PrivateIdentifier, Super, UpdateExpression, VariableDeclarator } from 'estree' */ | ||
/** @import { AssignmentExpression, CallExpression, Expression, Pattern, PrivateIdentifier, Super, TaggedTemplateExpression, UpdateExpression, VariableDeclarator } from 'estree' */ | ||
/** @import { Fragment } from '#compiler' */ | ||
@@ -168,1 +168,24 @@ /** @import { AnalysisState, Context } from '../../types' */ | ||
} | ||
/** | ||
* @param {Expression | Super} callee | ||
* @param {Context} context | ||
* @returns {boolean} | ||
*/ | ||
export function is_known_safe_call(callee, context) { | ||
// String / Number / BigInt / Boolean casting calls | ||
if (callee.type === 'Identifier') { | ||
const name = callee.name; | ||
const binding = context.state.scope.get(name); | ||
if ( | ||
binding === null && | ||
(name === 'BigInt' || name === 'String' || name === 'Number' || name === 'Boolean') | ||
) { | ||
return true; | ||
} | ||
} | ||
// TODO add more cases | ||
return false; | ||
} |
@@ -78,2 +78,3 @@ import type { Binding, Css, ExpressionMetadata } from '#compiler'; | ||
namespace?: Namespace; | ||
css?: 'injected'; | ||
customElement?: { | ||
@@ -80,0 +81,0 @@ tag: string; |
@@ -9,3 +9,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.0.0-next.207'; | ||
export const VERSION = '5.0.0-next.208'; | ||
export const PUBLIC_VERSION = '5'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
2197922
345
48617