fix: bump `is-reference` dependency to fix `import.meta` bug (#14286)

closes #14234
pull/14287/head
Simon H 1 month ago committed by GitHub
parent 45fa678242
commit 320ebd24d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: bump `is-reference` dependency to fix `import.meta` bug

@ -144,7 +144,7 @@
"axobject-query": "^4.1.0",
"esm-env": "^1.0.0",
"esrap": "^1.2.2",
"is-reference": "^3.0.2",
"is-reference": "^3.0.3",
"locate-character": "^3.0.0",
"magic-string": "^0.30.11",
"zimmerframe": "^1.1.2"

@ -507,6 +507,7 @@ const instance_script = {
for (let specifier of node.specifiers) {
if (
specifier.type === 'ImportSpecifier' &&
specifier.imported.type === 'Identifier' &&
['beforeUpdate', 'afterUpdate'].includes(specifier.imported.name)
) {
const references = state.scope.references.get(specifier.local.name);
@ -544,6 +545,8 @@ const instance_script = {
let count_removed = 0;
for (const specifier of node.specifiers) {
if (specifier.local.type !== 'Identifier') continue;
const binding = state.scope.get(specifier.local.name);
if (binding?.kind === 'bindable_prop') {
state.str.remove(

@ -474,6 +474,10 @@ export function analyze_component(root, source, options) {
}
} else {
for (const specifier of node.specifiers) {
if (specifier.local.type !== 'Identifier' || specifier.exported.type !== 'Identifier') {
continue;
}
const binding = instance.scope.get(specifier.local.name);
if (

@ -60,6 +60,8 @@ export function ExportNamedDeclaration(node, context) {
if (!context.state.ast_type /* .svelte.js module */ || context.state.ast_type === 'module') {
for (const specified of node.specifiers) {
if (specified.local.type !== 'Identifier') continue;
const binding = context.state.scope.get(specified.local.name);
if (!binding) continue;

@ -9,18 +9,25 @@ import * as e from '../../../errors.js';
* @param {Context} context
*/
export function ExportSpecifier(node, context) {
const local_name =
node.local.type === 'Identifier' ? node.local.name : /** @type {string} */ (node.local.value);
const exported_name =
node.exported.type === 'Identifier'
? node.exported.name
: /** @type {string} */ (node.exported.value);
if (context.state.ast_type === 'instance') {
if (context.state.analysis.runes) {
context.state.analysis.exports.push({
name: node.local.name,
alias: node.exported.name
name: local_name,
alias: exported_name
});
const binding = context.state.scope.get(node.local.name);
const binding = context.state.scope.get(local_name);
if (binding) binding.reassigned = binding.updated = true;
}
} else {
validate_export(node, context.state.scope, node.local.name);
validate_export(node, context.state.scope, local_name);
}
}

@ -18,8 +18,9 @@ export function ImportDeclaration(node, context) {
for (const specifier of node.specifiers) {
if (specifier.type === 'ImportSpecifier') {
if (
specifier.imported.name === 'beforeUpdate' ||
specifier.imported.name === 'afterUpdate'
specifier.imported.type === 'Identifier' &&
(specifier.imported.name === 'beforeUpdate' ||
specifier.imported.name === 'afterUpdate')
) {
e.runes_mode_invalid_import(specifier, specifier.imported.name);
}

@ -433,7 +433,11 @@ export function is_simple_expression(node) {
}
if (node.type === 'BinaryExpression' || node.type === 'LogicalExpression') {
return is_simple_expression(node.left) && is_simple_expression(node.right);
return (
node.left.type !== 'PrivateIdentifier' &&
is_simple_expression(node.left) &&
is_simple_expression(node.right)
);
}
return false;
@ -475,7 +479,10 @@ export function is_expression_async(expression) {
case 'AssignmentExpression':
case 'BinaryExpression':
case 'LogicalExpression': {
return is_expression_async(expression.left) || is_expression_async(expression.right);
return (
(expression.left.type !== 'PrivateIdentifier' && is_expression_async(expression.left)) ||
is_expression_async(expression.right)
);
}
case 'CallExpression':
case 'NewExpression': {

@ -350,7 +350,7 @@ export function prop(kind, key, value, computed = false) {
* @returns {ESTree.PropertyDefinition}
*/
export function prop_def(key, value, computed = false, is_static = false) {
return { type: 'PropertyDefinition', key, value, computed, static: is_static, decorators: [] };
return { type: 'PropertyDefinition', key, value, computed, static: is_static };
}
/**
@ -551,8 +551,7 @@ export function method(kind, key, params, body, computed = false, is_static = fa
kind,
value: function_builder(null, params, block(body)),
computed,
static: is_static,
decorators: []
static: is_static
};
}

@ -67,7 +67,7 @@ importers:
version: 1.5.0
'@types/estree':
specifier: ^1.0.5
version: 1.0.5
version: 1.0.6
acorn:
specifier: ^8.12.1
version: 8.12.1
@ -87,8 +87,8 @@ importers:
specifier: ^1.2.2
version: 1.2.2
is-reference:
specifier: ^3.0.2
version: 3.0.2
specifier: ^3.0.3
version: 3.0.3
locate-character:
specifier: ^3.0.0
version: 3.0.0
@ -916,6 +916,9 @@ packages:
'@types/estree@1.0.5':
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
'@types/estree@1.0.6':
resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
'@types/json-schema@7.0.15':
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
@ -1775,8 +1778,8 @@ packages:
is-reference@1.2.1:
resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==}
is-reference@3.0.2:
resolution: {integrity: sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==}
is-reference@3.0.3:
resolution: {integrity: sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==}
is-stream@3.0.0:
resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==}
@ -3468,7 +3471,7 @@ snapshots:
'@rollup/pluginutils@5.1.0(rollup@4.22.4)':
dependencies:
'@types/estree': 1.0.5
'@types/estree': 1.0.6
estree-walker: 2.0.2
picomatch: 2.3.1
optionalDependencies:
@ -3611,11 +3614,13 @@ snapshots:
'@types/eslint@8.56.12':
dependencies:
'@types/estree': 1.0.5
'@types/estree': 1.0.6
'@types/json-schema': 7.0.15
'@types/estree@1.0.5': {}
'@types/estree@1.0.6': {}
'@types/json-schema@7.0.15': {}
'@types/node@12.20.55': {}
@ -4243,7 +4248,7 @@ snapshots:
esrap@1.2.2:
dependencies:
'@jridgewell/sourcemap-codec': 1.5.0
'@types/estree': 1.0.5
'@types/estree': 1.0.6
esrecurse@4.3.0:
dependencies:
@ -4255,7 +4260,7 @@ snapshots:
estree-walker@3.0.3:
dependencies:
'@types/estree': 1.0.5
'@types/estree': 1.0.6
esutils@2.0.3: {}
@ -4556,11 +4561,11 @@ snapshots:
is-reference@1.2.1:
dependencies:
'@types/estree': 1.0.5
'@types/estree': 1.0.6
is-reference@3.0.2:
is-reference@3.0.3:
dependencies:
'@types/estree': 1.0.5
'@types/estree': 1.0.6
is-stream@3.0.0: {}

Loading…
Cancel
Save