master
Augustin AFFOGNON 1 year ago
parent 85fc9bd6d8
commit d626053dc1

@ -1,11 +0,0 @@
import {FETCH_WEATHER} from './constants';
import { Weather } from '../data/stub';
export const setWeatherList = (weathers: Weather[]) => {
return {
type: FETCH_WEATHER,
payload: weathers,
toto : true,
};
}

@ -1 +0,0 @@
export const FETCH_WEATHER = "weathers";

@ -1,21 +0,0 @@
import { WEATHER_DATA } from "../data/stub";
import { FETCH_WEATHER } from "./constants";
import { getWeathersList } from "./thunk/actionListWeather";
const initialState = {
weathers: [],
favoriteWeathers: [],
}
//@ts-ignore
export default appReducer = (state = initialState, action) => { ///action event receved
switch (action.type) {
case FETCH_WEATHER:
// @ts-ignore
return {...state, weathers: action.payload};
default:
return state;
}
}

@ -1,18 +0,0 @@
import {configureStore} from '@reduxjs/toolkit'
import appReducer from './reducer';
// Reference here all your application reducers
const reducer = {
appReducer: appReducer,
}
// @ts-ignore
const store = configureStore({
reducer,
/*middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: false
})*/
},);
export default store;

@ -1,46 +0,0 @@
import { City, Weather } from "../../data/stub";
import { setWeatherList } from "../Action";
export const getWeathersList = () => {
return async dispatch => {
try {
const citiesPromise = await fetch('https://iut-weather-api.azurewebsites.net/cities');
const citiesListJson = await citiesPromise.json();
const citiesList: City[] = citiesListJson.map(elt => new City(elt["name"], elt["latitude"], elt["longitude"]));
let weatherList: Weather[] = [];
for (let index = 0; index < citiesList.length; index++) {
const element = citiesList[index];
const weathersPromise = await fetch('https://iut-weather-api.azurewebsites.net/weather/city/name/' + citiesList[index].name);
const weathersListJson = await weathersPromise.json();
console.log(weathersListJson);
let weatherData = new Weather(
weathersListJson.at,
weathersListJson.visibility,
weathersListJson.weatherType,
weathersListJson.weatherDescription,
weathersListJson.temperature,
weathersListJson.temperatureFeelsLike,
weathersListJson.humidity,
weathersListJson.windSpeed,
weathersListJson.pressure,
citiesList[index]
);
weatherList.push(weatherData)
}
dispatch(setWeatherList(weatherList));
} catch (error) {
console.log('Error---------', error);
}
}
}

@ -1,16 +1,14 @@
import React from 'react'; import React from 'react';
import { Provider, useSelector } from 'react-redux' import { Provider, useSelector } from 'react-redux'
import { SafeAreaView, ScrollView, View} from 'react-native'; import { SafeAreaView, ScrollView, View} from 'react-native';
import store from './Actions/store'; import Navigation from './Components/Navigation';
import Navigation from './Components/Navigation';
import { WeatherCard } from './Components/WeatherCard'; import { WeatherCard } from './Components/WeatherCard';
import { CITIES_DATA, WEATHER_DATA } from './data/stub'; import { CITIES_DATA, WEATHER_DATA } from './data/stub';
import store from './redux/store';
const Card = () => { const Card = () => {
// Get nounours data from the current application state
return ( return (

@ -1,22 +1,42 @@
// Navigation.js // Navigation.js
import { createStackNavigator } from '@react-navigation/stack'; import { createStackNavigator } from '@react-navigation/stack';
import { NavigationContainer } from '@react-navigation/native'; import { NavigationContainer, useNavigation } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import Home from '../Screens/Home'; import Home from '../Screens/Home';
import Ajout from '../Screens/Ajout';
import Details from '../Screens/Details'; import Details from '../Screens/Details';
import React from 'react';
import { Button, Icon } from 'react-native-elements';
import { TouchableHighlight } from 'react-native-gesture-handler';
import Favorite from '../Screens/Favorites';
export default function Navigation() { export default function Navigation() {
const BottomTabNavigator = createBottomTabNavigator(); const BottomTabNavigator = createBottomTabNavigator();
const Stack = createStackNavigator(); const Stack = createStackNavigator();
const navigatiocn = useNavigation;
return ( return (
<NavigationContainer> <NavigationContainer>
<Stack.Navigator initialRouteName="Home" > <Stack.Navigator initialRouteName="Home" >
<Stack.Screen name="Home" component={Home} /> <Stack.Screen name="Home" component={Home} options={{ title : 'Accueil', headerRight: () => (
<Stack.Screen name="Details" component={Ajout}/> <TouchableHighlight >
<Icon name="stars" />
</TouchableHighlight>) }} />
<Stack.Screen name="Details" component={Details} options={{
title: 'Détails',
headerRight: () => (
<TouchableHighlight
>
<Button title={"Favoris"} />
</TouchableHighlight>
)
}}/>
<Stack.Screen name="Favorite" component={Favorite} options={{
title: 'Favoris',
}}/>
</Stack.Navigator> </Stack.Navigator>
</NavigationContainer> </NavigationContainer>
) )

@ -1,6 +1,8 @@
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
import { View, Text, Image, StyleSheet, Dimensions, ImageBackground, TouchableOpacity, Modal } from 'react-native'; import { View, Text, Image, StyleSheet, Dimensions, ImageBackground, TouchableOpacity, Modal } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { useDispatch, useSelector } from 'react-redux';
import { getWeathersIconList } from '../thunk/thunkListWeatherIcon';
import { City, Weather } from '../data/stub'; import { City, Weather } from '../data/stub';
import { getImageSource } from './ImageWeatherType'; import { getImageSource } from './ImageWeatherType';
@ -9,14 +11,23 @@ type MeteoProps = {
weather : Weather weather : Weather
} }
export function WeatherCard(props: MeteoProps) { export function WeatherCard(props: MeteoProps) {
const dispatch = useDispatch();
const data = useSelector(state => state.IconsReducer.weathersIcons);
useEffect(() => {
const loadWeathersIcons = async () => {
dispatch(getWeathersIconList());
};
loadWeathersIcons();
}, [dispatch]);
const hh = data.filter((item) =>
item.name.includes("Dégagé"))
const [showPopup, setShowPopup] = useState(false); //console.log(hh[0]._imageUri);
const togglePopup = () => {
setShowPopup(!showPopup);
};
return ( return (
@ -29,7 +40,9 @@ export function WeatherCard(props: MeteoProps) {
<View style={styles.contentContainer}> <View style={styles.contentContainer}>
<View style={styles.imageContainer}> <View style={styles.imageContainer}>
<Image <Image
source={getImageSource(props.weather.weatherType)} source= {{ uri: data.filter(() =>
props.weather.weatherType
)[0]._imageUri }}
style={styles.image} style={styles.image}
/> />
<Text style={styles.title} > {props.weather.weatherType} </Text> <Text style={styles.title} > {props.weather.weatherType} </Text>
@ -68,14 +81,7 @@ export function WeatherCard(props: MeteoProps) {
</View> </View>
</View> </View>
<Modal visible={showPopup} animationType="fade" >
<View style={styles.popupContainer}>
<Text style={styles.popupText}>Popup content</Text>
<TouchableOpacity onPress={togglePopup} style={styles.closeButton}>
<Icon name="close" style={styles.closeIcon} />
</TouchableOpacity>
</View>
</Modal>
</View> </View>
@ -112,6 +118,7 @@ const styles = StyleSheet.create({
}, },
image: { image: {
width: 80, width: 80,
backgroundColor: 'blue',
height: 80, height: 80,
borderRadius: 15, borderRadius: 15,
}, },
@ -167,3 +174,7 @@ const styles = StyleSheet.create({
}); });
function dispatch(arg0: any) {
throw new Error('Function not implemented.');
}

@ -1,35 +1,39 @@
import React from 'react'; import React from 'react';
import { View, Text, Button } from 'react-native'; import { View, Text, Image, FlatList, Button } from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { TouchableHighlight } from 'react-native-gesture-handler';
import { useNavigation } from '@react-navigation/native';
import { insertFavorite } from '../thunk/favorites/thunkStoreFavorite';
import { useDispatch } from 'react-redux';
const TaskDetailsScreen = ({ route, navigation }) => {
const { taskId } = route.params;
// Fonction de modification du statut de la tâche const Details = ({route}) => {
const toggleTaskStatus = () => { const dispatch = useDispatch();
// Implémentez ici la logique pour modifier le statut de la tâche
// en fonction de l'ID de la tâche taskId const handleAddFavorite = () => {
console.log('Statut de la tâche modifié'); dispatch(insertFavorite(route.params.weather));
};
// Obtenez les détails de la tâche en fonction de l'ID de la tâche taskId
// Vous pouvez utiliser votre propre logique pour récupérer les détails de la tâche
const taskDetails = {
id: taskId,
title: 'Acheter des courses',
description: 'Aliments, produits d\'entretien, etc.',
completed: false,
}; };
const navigation = useNavigation();
return ( return (
<View style={{ flex: 1, padding: 16 }}> <View>
<Text style={{ fontSize: 20, fontWeight: 'bold', marginBottom: 8 }}>{taskDetails.title}</Text> <Text style={{ fontSize: 20, fontWeight: 'bold', textAlign: 'center' }}>{route.params.weather.city.name}</Text>
<Text style={{ fontSize: 16, marginBottom: 16 }}>{taskDetails.description}</Text> <View style={{ flexDirection: 'row', alignItems: 'center' }}>
<Text style={{ fontSize: 16, color: taskDetails.completed ? 'green' : 'red' }}> <TouchableHighlight onPress={() => navigation.navigate("Favorite")}>
{taskDetails.completed ? 'Complétée' : 'Non complétée'} <Button title={"Favoris"} />
</Text> </TouchableHighlight>
<Button title="Modifier le statut" onPress={toggleTaskStatus} /> <TouchableHighlight onPress={handleAddFavorite}>
<Button title={"Add to favorite"} />
</TouchableHighlight>
</View>
</View> </View>
); );
}; };
export default TaskDetailsScreen; export default Details;

@ -0,0 +1,42 @@
import React, { useEffect, useState } from 'react';
import { View, FlatList, TextInput, Button,Text } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import { Weather } from '../data/stub';
import { addToFavorites } from '../redux/actions/ActionFavorites';
import { fetchFavorites } from '../thunk/favorites/thunkListFavorites';
import { insertFavorite } from '../thunk/favorites/thunkStoreFavorite';
const FavoritesComponent = () => {
const [newFavorite,setNewFavorite] = useState('');
const favorites : [Weather] = useSelector(state => state.FavoritesReducer.favorites);
const dispatch = useDispatch();
useEffect(() => {
const loadWeathers = async () => {
dispatch(fetchFavorites());
console.log("le total est : "+ favorites[0]["_city"]["_name"])
};
loadWeathers();
}, [dispatch]);
return (
<View>
<Text>Favorites</Text>
<FlatList
data={favorites}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item }) => <Text>{item["_at"]}</Text>}
/>
<TextInput
value={newFavorite}
onChangeText={text => setNewFavorite(text)}
/>
</View>
);
};
export default FavoritesComponent;

@ -1,43 +1,69 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button, FlatList, ScrollView, StyleSheet, TextInput, TouchableHighlight, View } from 'react-native'; import { Button, FlatList, ActivityIndicator, StyleSheet, TextInput, TouchableHighlight, View, RefreshControl } from 'react-native';
import { WeatherCard } from '../Components/WeatherCard'; import { WeatherCard } from '../Components/WeatherCard';
import { useNavigation } from '@react-navigation/native'; import { useNavigation } from '@react-navigation/native';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { SearchBar } from 'react-native-elements'; import { SearchBar } from 'react-native-elements';
import { getWeathersList } from "../Actions/thunk/actionListWeather"; import { getWeathersIconList } from "../thunk/thunkListWeatherIcon";
import { getWeathersList } from '../thunk/thunkListWeather';
const Home = () => { const Home = () => {
const [search, setSearch] = useState(''); const [search, setSearch] = useState('');
const navigation = useNavigation(); const navigation = useNavigation();
const data = useSelector(state => state.appReducer.weathers); const data = useSelector(state => state.appReducer.weathers);
const dispatch = useDispatch(); const dispatch = useDispatch();
const [isLoading, setIsLoading] = useState(true);
const [refreshing, setRefreshing] = useState(false);
const onRefresh = () => {
setRefreshing(true);
dispatch(getWeathersList());
dispatch(getWeathersIconList());
setRefreshing(false);
};
useEffect(() => { useEffect(() => {
const loadWeathers = async () => { const loadWeathers = async () => {
await dispatch(getWeathersList()); setIsLoading(true);
dispatch(getWeathersList());
setIsLoading(false);
}; };
loadWeathers(); loadWeathers();
const loadWeathersIcons = async () => {
setIsLoading(true);
dispatch(getWeathersIconList());
setIsLoading(false);
};
loadWeathersIcons();
}, [dispatch]); }, [dispatch]);
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View> <View>
<SearchBar <SearchBar
placeholder="Rechercher..." placeholder="Rechercher..."
onChangeText={(text) => setSearch(text)} onChangeText={(text) => setSearch(text)}
value={search} value={search}
/> />
</View> </View>
{isLoading ? (
<ActivityIndicator size="large" color="#0000ff" /> // Indicateur de chargement
) : (
<FlatList
data={data.filter(item => item.city.name.toLowerCase().includes(search.toLowerCase()))}
<FlatList refreshControl={ <RefreshControl refreshing={refreshing} onRefresh={onRefresh} />}
data={data.filter((item: { city: { name: string; }; }) => item.city.name.toLowerCase().includes(search.toLowerCase()))}
renderItem={({ item }) => ( renderItem={({ item }) => (
<TouchableHighlight onPress={() => navigation.navigate("Details", { "weather": item })}> <TouchableHighlight onPress={() => navigation.navigate("Details", { "weather": item })}>
<WeatherCard city={item.city} weather={item} /> <WeatherCard city={item.city} weather={item} />
</TouchableHighlight> </TouchableHighlight>
)} )}
keyExtractor={(item) => item.city.name} keyExtractor={(item) => item.city.name}
/> /> ) }
</View> </View>
); );
}; };

@ -34,6 +34,30 @@ export class City {
} }
} }
export class WeatherIcon {
private _name: string;
public _imageUri: string;
constructor(name: string, uri: string) {
this._name = name;
this._imageUri = uri;
}
get name(): string {
return this._name;
}
set name(value: string) {
this._name = value;
}
get imageUri(): string {
return this._imageUri;
}
}
export class Weather { export class Weather {
private _at: string; private _at: string;
private _visibility: number; private _visibility: number;

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{ {
"name": "@babel/code-frame", "name": "@babel/code-frame",
"version": "7.21.4", "version": "7.22.5",
"description": "Generate errors that contain a code frame that point to source locations.", "description": "Generate errors that contain a code frame that point to source locations.",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-code-frame", "homepage": "https://babel.dev/docs/en/next/babel-code-frame",
@ -16,7 +16,7 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/highlight": "^7.18.6" "@babel/highlight": "^7.22.5"
}, },
"devDependencies": { "devDependencies": {
"strip-ansi": "^4.0.0" "strip-ansi": "^4.0.0"

@ -1,6 +1,6 @@
{ {
"name": "@babel/compat-data", "name": "@babel/compat-data",
"version": "7.22.3", "version": "7.22.5",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",
"description": "", "description": "",

@ -84,6 +84,20 @@ function* resolveAlternativesHelper(type, name) {
if (!(yield standardizeName(oppositeType, name)).error) { if (!(yield standardizeName(oppositeType, name)).error) {
error.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`; error.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;
} }
if (type === "plugin") {
const transformName = standardizedName.replace("-proposal-", "-transform-");
if (transformName !== standardizedName && !(yield transformName).error) {
error.message += `\n- Did you mean "${transformName}"?`;
}
}
error.message += `\n
Make sure that all the Babel plugins and presets you are using
are defined as dependencies or devDependencies in your package.json
file. It's possible that the missing plugin is loaded by a preset
you are using that forgot to add the plugin to its dependencies: you
can workaround this problem by explicitly adding the missing package
to your top-level package.json.
`;
throw error; throw error;
} }
function tryRequireResolve(id, dirname) { function tryRequireResolve(id, dirname) {

File diff suppressed because one or more lines are too long

@ -223,7 +223,7 @@ var _transformFile = require("./transform-file");
var _transformAst = require("./transform-ast"); var _transformAst = require("./transform-ast");
var _parse = require("./parse"); var _parse = require("./parse");
var thisFile = require("./index"); var thisFile = require("./index");
const version = "7.22.1"; const version = "7.22.5";
exports.version = version; exports.version = version;
const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]); const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]);
exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS; exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS;

@ -1,6 +1,6 @@
{ {
"name": "@babel/core", "name": "@babel/core",
"version": "7.22.1", "version": "7.22.5",
"description": "Babel compiler core.", "description": "Babel compiler core.",
"main": "./lib/index.js", "main": "./lib/index.js",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
@ -47,15 +47,15 @@
}, },
"dependencies": { "dependencies": {
"@ampproject/remapping": "^2.2.0", "@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.21.4", "@babel/code-frame": "^7.22.5",
"@babel/generator": "^7.22.0", "@babel/generator": "^7.22.5",
"@babel/helper-compilation-targets": "^7.22.1", "@babel/helper-compilation-targets": "^7.22.5",
"@babel/helper-module-transforms": "^7.22.1", "@babel/helper-module-transforms": "^7.22.5",
"@babel/helpers": "^7.22.0", "@babel/helpers": "^7.22.5",
"@babel/parser": "^7.22.0", "@babel/parser": "^7.22.5",
"@babel/template": "^7.21.9", "@babel/template": "^7.22.5",
"@babel/traverse": "^7.22.1", "@babel/traverse": "^7.22.5",
"@babel/types": "^7.22.0", "@babel/types": "^7.22.5",
"convert-source-map": "^1.7.0", "convert-source-map": "^1.7.0",
"debug": "^4.1.0", "debug": "^4.1.0",
"gensync": "^1.0.0-beta.2", "gensync": "^1.0.0-beta.2",
@ -63,12 +63,12 @@
"semver": "^6.3.0" "semver": "^6.3.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/helper-transform-fixture-test-runner": "^7.22.0", "@babel/helper-transform-fixture-test-runner": "^7.22.5",
"@babel/plugin-syntax-flow": "^7.21.4", "@babel/plugin-syntax-flow": "^7.22.5",
"@babel/plugin-transform-flow-strip-types": "^7.21.0", "@babel/plugin-transform-flow-strip-types": "^7.22.5",
"@babel/plugin-transform-modules-commonjs": "^7.21.5", "@babel/plugin-transform-modules-commonjs": "^7.22.5",
"@babel/preset-env": "^7.22.1", "@babel/preset-env": "^7.22.5",
"@babel/preset-typescript": "^7.21.5", "@babel/preset-typescript": "^7.22.5",
"@jridgewell/trace-mapping": "^0.3.17", "@jridgewell/trace-mapping": "^0.3.17",
"@types/convert-source-map": "^1.5.1", "@types/convert-source-map": "^1.5.1",
"@types/debug": "^4.1.0", "@types/debug": "^4.1.0",

@ -1,6 +1,6 @@
{ {
"name": "@babel/generator", "name": "@babel/generator",
"version": "7.22.3", "version": "7.22.5",
"description": "Turns an AST into code.", "description": "Turns an AST into code.",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",
@ -19,14 +19,14 @@
"lib" "lib"
], ],
"dependencies": { "dependencies": {
"@babel/types": "^7.22.3", "@babel/types": "^7.22.5",
"@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/gen-mapping": "^0.3.2",
"@jridgewell/trace-mapping": "^0.3.17", "@jridgewell/trace-mapping": "^0.3.17",
"jsesc": "^2.5.1" "jsesc": "^2.5.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/helper-fixtures": "^7.21.5", "@babel/helper-fixtures": "^7.22.5",
"@babel/parser": "^7.22.3", "@babel/parser": "^7.22.5",
"@types/jsesc": "^2.5.0", "@types/jsesc": "^2.5.0",
"charcodes": "^0.2.0" "charcodes": "^0.2.0"
}, },

@ -4,24 +4,20 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = annotateAsPure; exports.default = annotateAsPure;
var _t = require("@babel/types"); var _t = require("@babel/types");
const { const {
addComment addComment
} = _t; } = _t;
const PURE_ANNOTATION = "#__PURE__"; const PURE_ANNOTATION = "#__PURE__";
const isPureAnnotated = ({ const isPureAnnotated = ({
leadingComments leadingComments
}) => !!leadingComments && leadingComments.some(comment => /[@#]__PURE__/.test(comment.value)); }) => !!leadingComments && leadingComments.some(comment => /[@#]__PURE__/.test(comment.value));
function annotateAsPure(pathOrNode) { function annotateAsPure(pathOrNode) {
const node = pathOrNode["node"] || pathOrNode; const node = pathOrNode["node"] || pathOrNode;
if (isPureAnnotated(node)) { if (isPureAnnotated(node)) {
return; return;
} }
addComment(node, "leading", PURE_ANNOTATION); addComment(node, "leading", PURE_ANNOTATION);
} }
//# sourceMappingURL=index.js.map

@ -0,0 +1 @@
{"version":3,"names":["_t","require","addComment","PURE_ANNOTATION","isPureAnnotated","leadingComments","some","comment","test","value","annotateAsPure","pathOrNode","node"],"sources":["../src/index.ts"],"sourcesContent":["import { addComment, type Node } from \"@babel/types\";\nimport type { NodePath } from \"@babel/traverse\";\n\nconst PURE_ANNOTATION = \"#__PURE__\";\n\nconst isPureAnnotated = ({ leadingComments }: Node): boolean =>\n !!leadingComments &&\n leadingComments.some(comment => /[@#]__PURE__/.test(comment.value));\n\nexport default function annotateAsPure(pathOrNode: Node | NodePath): void {\n const node =\n // @ts-expect-error Node will not have `node` property\n (pathOrNode[\"node\"] || pathOrNode) as Node;\n if (isPureAnnotated(node)) {\n return;\n }\n addComment(node, \"leading\", PURE_ANNOTATION);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAAqD;EAA5CC;AAAU,IAAAF,EAAA;AAGnB,MAAMG,eAAe,GAAG,WAAW;AAEnC,MAAMC,eAAe,GAAGA,CAAC;EAAEC;AAAsB,CAAC,KAChD,CAAC,CAACA,eAAe,IACjBA,eAAe,CAACC,IAAI,CAACC,OAAO,IAAI,cAAc,CAACC,IAAI,CAACD,OAAO,CAACE,KAAK,CAAC,CAAC;AAEtD,SAASC,cAAcA,CAACC,UAA2B,EAAQ;EACxE,MAAMC,IAAI,GAEPD,UAAU,CAAC,MAAM,CAAC,IAAIA,UAAmB;EAC5C,IAAIP,eAAe,CAACQ,IAAI,CAAC,EAAE;IACzB;EACF;EACAV,UAAU,CAACU,IAAI,EAAE,SAAS,EAAET,eAAe,CAAC;AAC9C"}

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-annotate-as-pure", "name": "@babel/helper-annotate-as-pure",
"version": "7.18.6", "version": "7.22.5",
"description": "Helper function to annotate paths and nodes with #__PURE__ comment", "description": "Helper function to annotate paths and nodes with #__PURE__ comment",
"repository": { "repository": {
"type": "git", "type": "git",
@ -14,7 +14,7 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/types": "^7.18.6" "@babel/types": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-builder-binary-assignment-operator-visitor", "name": "@babel/helper-builder-binary-assignment-operator-visitor",
"version": "7.22.3", "version": "7.22.5",
"description": "Helper function to build binary assignment operator visitors", "description": "Helper function to build binary assignment operator visitors",
"repository": { "repository": {
"type": "git", "type": "git",
@ -14,10 +14,10 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/types": "^7.22.3" "@babel/types": "^7.22.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/traverse": "^7.22.1" "@babel/traverse": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -1 +1 @@
{"version":3,"names":["_semver","require","_pretty","_utils","getInclusionReasons","item","targetVersions","list","minVersions","Object","keys","reduce","result","env","minVersion","getLowestImplementedVersion","targetVersion","prettifyVersion","minIsUnreleased","isUnreleasedVersion","targetIsUnreleased","semver","lt","toString","semverify"],"sources":["../src/debug.ts"],"sourcesContent":["import semver from \"semver\";\nimport { prettifyVersion } from \"./pretty\";\nimport {\n semverify,\n isUnreleasedVersion,\n getLowestImplementedVersion,\n} from \"./utils\";\nimport type { Target, Targets } from \"./types\";\n\nexport function getInclusionReasons(\n item: string,\n targetVersions: Targets,\n list: { [key: string]: Targets },\n) {\n const minVersions = list[item] || {};\n\n return (Object.keys(targetVersions) as Target[]).reduce((result, env) => {\n const minVersion = getLowestImplementedVersion(minVersions, env);\n const targetVersion = targetVersions[env];\n\n if (!minVersion) {\n result[env] = prettifyVersion(targetVersion);\n } else {\n const minIsUnreleased = isUnreleasedVersion(minVersion, env);\n const targetIsUnreleased = isUnreleasedVersion(targetVersion, env);\n\n if (\n !targetIsUnreleased &&\n (minIsUnreleased ||\n semver.lt(targetVersion.toString(), semverify(minVersion)))\n ) {\n result[env] = prettifyVersion(targetVersion);\n }\n }\n\n return result;\n }, {} as Partial<Record<Target, string>>);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAOO,SAASG,mBAAmBA,CACjCC,IAAY,EACZC,cAAuB,EACvBC,IAAgC,EAChC;EACA,MAAMC,WAAW,GAAGD,IAAI,CAACF,IAAI,CAAC,IAAI,CAAC,CAAC;EAEpC,OAAQI,MAAM,CAACC,IAAI,CAACJ,cAAc,CAAC,CAAcK,MAAM,CAAC,CAACC,MAAM,EAAEC,GAAG,KAAK;IACvE,MAAMC,UAAU,GAAG,IAAAC,kCAA2B,EAACP,WAAW,EAAEK,GAAG,CAAC;IAChE,MAAMG,aAAa,GAAGV,cAAc,CAACO,GAAG,CAAC;IAEzC,IAAI,CAACC,UAAU,EAAE;MACfF,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAI,uBAAe,EAACD,aAAa,CAAC;IAC9C,CAAC,MAAM;MACL,MAAME,eAAe,GAAG,IAAAC,0BAAmB,EAACL,UAAU,EAAED,GAAG,CAAC;MAC5D,MAAMO,kBAAkB,GAAG,IAAAD,0BAAmB,EAACH,aAAa,EAAEH,GAAG,CAAC;MAElE,IACE,CAACO,kBAAkB,KAClBF,eAAe,IACdG,OAAM,CAACC,EAAE,CAACN,aAAa,CAACO,QAAQ,CAAC,CAAC,EAAE,IAAAC,gBAAS,EAACV,UAAU,CAAC,CAAC,CAAC,EAC7D;QACAF,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAI,uBAAe,EAACD,aAAa,CAAC;MAC9C;IACF;IAEA,OAAOJ,MAAM;EACf,CAAC,EAAE,CAAC,CAAoC,CAAC;AAC3C"} {"version":3,"names":["_semver","require","_pretty","_utils","getInclusionReasons","item","targetVersions","list","minVersions","Object","keys","reduce","result","env","minVersion","getLowestImplementedVersion","targetVersion","prettifyVersion","minIsUnreleased","isUnreleasedVersion","targetIsUnreleased","semver","lt","toString","semverify"],"sources":["../src/debug.ts"],"sourcesContent":["import semver from \"semver\";\nimport { prettifyVersion } from \"./pretty\";\nimport {\n semverify,\n isUnreleasedVersion,\n getLowestImplementedVersion,\n} from \"./utils\";\nimport type { Target, Targets } from \"./types\";\n\nexport function getInclusionReasons(\n item: string,\n targetVersions: Targets,\n list: { [key: string]: Targets },\n) {\n const minVersions = list[item] || {};\n\n return (Object.keys(targetVersions) as Target[]).reduce(\n (result, env) => {\n const minVersion = getLowestImplementedVersion(minVersions, env);\n const targetVersion = targetVersions[env];\n\n if (!minVersion) {\n result[env] = prettifyVersion(targetVersion);\n } else {\n const minIsUnreleased = isUnreleasedVersion(minVersion, env);\n const targetIsUnreleased = isUnreleasedVersion(targetVersion, env);\n\n if (\n !targetIsUnreleased &&\n (minIsUnreleased ||\n semver.lt(targetVersion.toString(), semverify(minVersion)))\n ) {\n result[env] = prettifyVersion(targetVersion);\n }\n }\n\n return result;\n },\n {} as Partial<Record<Target, string>>,\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAOO,SAASG,mBAAmBA,CACjCC,IAAY,EACZC,cAAuB,EACvBC,IAAgC,EAChC;EACA,MAAMC,WAAW,GAAGD,IAAI,CAACF,IAAI,CAAC,IAAI,CAAC,CAAC;EAEpC,OAAQI,MAAM,CAACC,IAAI,CAACJ,cAAc,CAAC,CAAcK,MAAM,CACrD,CAACC,MAAM,EAAEC,GAAG,KAAK;IACf,MAAMC,UAAU,GAAG,IAAAC,kCAA2B,EAACP,WAAW,EAAEK,GAAG,CAAC;IAChE,MAAMG,aAAa,GAAGV,cAAc,CAACO,GAAG,CAAC;IAEzC,IAAI,CAACC,UAAU,EAAE;MACfF,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAI,uBAAe,EAACD,aAAa,CAAC;IAC9C,CAAC,MAAM;MACL,MAAME,eAAe,GAAG,IAAAC,0BAAmB,EAACL,UAAU,EAAED,GAAG,CAAC;MAC5D,MAAMO,kBAAkB,GAAG,IAAAD,0BAAmB,EAACH,aAAa,EAAEH,GAAG,CAAC;MAElE,IACE,CAACO,kBAAkB,KAClBF,eAAe,IACdG,OAAM,CAACC,EAAE,CAACN,aAAa,CAACO,QAAQ,CAAC,CAAC,EAAE,IAAAC,gBAAS,EAACV,UAAU,CAAC,CAAC,CAAC,EAC7D;QACAF,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAI,uBAAe,EAACD,aAAa,CAAC;MAC9C;IACF;IAEA,OAAOJ,MAAM;EACf,CAAC,EACD,CAAC,CACH,CAAC;AACH"}

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-compilation-targets", "name": "@babel/helper-compilation-targets",
"version": "7.22.1", "version": "7.22.5",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",
"description": "Helper functions on Babel compilation targets", "description": "Helper functions on Babel compilation targets",
@ -22,8 +22,8 @@
"babel-plugin" "babel-plugin"
], ],
"dependencies": { "dependencies": {
"@babel/compat-data": "^7.22.0", "@babel/compat-data": "^7.22.5",
"@babel/helper-validator-option": "^7.21.0", "@babel/helper-validator-option": "^7.22.5",
"browserslist": "^4.21.3", "browserslist": "^4.21.3",
"lru-cache": "^5.1.1", "lru-cache": "^5.1.1",
"semver": "^6.3.0" "semver": "^6.3.0"
@ -32,8 +32,8 @@
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.1", "@babel/core": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.18.6", "@babel/helper-plugin-test-runner": "^7.22.5",
"@types/lru-cache": "^5.1.1", "@types/lru-cache": "^5.1.1",
"@types/semver": "^5.5.0" "@types/semver": "^5.5.0"
}, },

@ -84,19 +84,19 @@ function createClassFeaturePlugin({
(0, _features.enableFeature)(file, feature, loose); (0, _features.enableFeature)(file, feature, loose);
{ {
if (typeof file.get(versionKey) === "number") { if (typeof file.get(versionKey) === "number") {
file.set(versionKey, "7.22.1"); file.set(versionKey, "7.22.5");
return; return;
} }
} }
if (!file.get(versionKey) || _semver.lt(file.get(versionKey), "7.22.1")) { if (!file.get(versionKey) || _semver.lt(file.get(versionKey), "7.22.5")) {
file.set(versionKey, "7.22.1"); file.set(versionKey, "7.22.5");
} }
}, },
visitor: { visitor: {
Class(path, { Class(path, {
file file
}) { }) {
if (file.get(versionKey) !== "7.22.1") return; if (file.get(versionKey) !== "7.22.5") return;
if (!(0, _features.shouldTransform)(path, file)) return; if (!(0, _features.shouldTransform)(path, file)) return;
if (path.isClassDeclaration()) (0, _typescript.assertFieldTransformed)(path); if (path.isClassDeclaration()) (0, _typescript.assertFieldTransformed)(path);
const loose = (0, _features.isLoose)(file, feature); const loose = (0, _features.isLoose)(file, feature);
@ -207,7 +207,7 @@ function createClassFeaturePlugin({
file file
}) { }) {
{ {
if (file.get(versionKey) !== "7.22.1") return; if (file.get(versionKey) !== "7.22.5") return;
const decl = path.get("declaration"); const decl = path.get("declaration");
if (decl.isClassDeclaration() && (0, _decorators.hasDecorators)(decl.node)) { if (decl.isClassDeclaration() && (0, _decorators.hasDecorators)(decl.node)) {
if (decl.node.id) { if (decl.node.id) {

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-create-class-features-plugin", "name": "@babel/helper-create-class-features-plugin",
"version": "7.22.1", "version": "7.22.5",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",
"description": "Compile class public and private fields, private methods and decorators to ES6", "description": "Compile class public and private fields, private methods and decorators to ES6",
@ -18,24 +18,24 @@
"babel-plugin" "babel-plugin"
], ],
"dependencies": { "dependencies": {
"@babel/helper-annotate-as-pure": "^7.18.6", "@babel/helper-annotate-as-pure": "^7.22.5",
"@babel/helper-environment-visitor": "^7.22.1", "@babel/helper-environment-visitor": "^7.22.5",
"@babel/helper-function-name": "^7.21.0", "@babel/helper-function-name": "^7.22.5",
"@babel/helper-member-expression-to-functions": "^7.22.0", "@babel/helper-member-expression-to-functions": "^7.22.5",
"@babel/helper-optimise-call-expression": "^7.18.6", "@babel/helper-optimise-call-expression": "^7.22.5",
"@babel/helper-replace-supers": "^7.22.1", "@babel/helper-replace-supers": "^7.22.5",
"@babel/helper-skip-transparent-expression-wrappers": "^7.20.0", "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.18.6", "@babel/helper-split-export-declaration": "^7.22.5",
"semver": "^6.3.0" "semver": "^6.3.0"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.1", "@babel/core": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.18.6", "@babel/helper-plugin-test-runner": "^7.22.5",
"@babel/plugin-syntax-class-static-block": "^7.14.5", "@babel/plugin-syntax-class-static-block": "^7.14.5",
"@babel/preset-env": "^7.22.1" "@babel/preset-env": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -49,12 +49,12 @@ function createRegExpFeaturePlugin({
} }
{ {
if (typeof file.get(versionKey) === "number") { if (typeof file.get(versionKey) === "number") {
file.set(versionKey, "7.22.1"); file.set(versionKey, "7.22.5");
return; return;
} }
} }
if (!file.get(versionKey) || _semver.lt(file.get(versionKey), "7.22.1")) { if (!file.get(versionKey) || _semver.lt(file.get(versionKey), "7.22.5")) {
file.set(versionKey, "7.22.1"); file.set(versionKey, "7.22.5");
} }
}, },
visitor: { visitor: {

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-create-regexp-features-plugin", "name": "@babel/helper-create-regexp-features-plugin",
"version": "7.22.1", "version": "7.22.5",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",
"description": "Compile ESNext Regular Expressions to ES5", "description": "Compile ESNext Regular Expressions to ES5",
@ -18,7 +18,7 @@
"babel-plugin" "babel-plugin"
], ],
"dependencies": { "dependencies": {
"@babel/helper-annotate-as-pure": "^7.18.6", "@babel/helper-annotate-as-pure": "^7.22.5",
"regexpu-core": "^5.3.1", "regexpu-core": "^5.3.1",
"semver": "^6.3.0" "semver": "^6.3.0"
}, },
@ -26,8 +26,8 @@
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.1", "@babel/core": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.18.6" "@babel/helper-plugin-test-runner": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -9,11 +9,11 @@ See our website [@babel/helper-environment-visitor](https://babeljs.io/docs/en/b
Using npm: Using npm:
```sh ```sh
npm install --save-dev @babel/helper-environment-visitor npm install --save @babel/helper-environment-visitor
``` ```
or using yarn: or using yarn:
```sh ```sh
yarn add @babel/helper-environment-visitor --dev yarn add @babel/helper-environment-visitor
``` ```

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-environment-visitor", "name": "@babel/helper-environment-visitor",
"version": "7.22.1", "version": "7.22.5",
"description": "Helper visitor to only visit nodes in the current 'this' context", "description": "Helper visitor to only visit nodes in the current 'this' context",
"repository": { "repository": {
"type": "git", "type": "git",
@ -18,8 +18,8 @@
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"devDependencies": { "devDependencies": {
"@babel/traverse": "^7.22.1", "@babel/traverse": "^7.22.5",
"@babel/types": "^7.22.0" "@babel/types": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-function-name", "name": "@babel/helper-function-name",
"version": "7.21.0", "version": "7.22.5",
"description": "Helper function to change the property 'name' of every function", "description": "Helper function to change the property 'name' of every function",
"repository": { "repository": {
"type": "git", "type": "git",
@ -14,8 +14,8 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/template": "^7.20.7", "@babel/template": "^7.22.5",
"@babel/types": "^7.21.0" "@babel/types": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = hoistVariables; exports.default = hoistVariables;
var _t = require("@babel/types"); var _t = require("@babel/types");
const { const {
assignmentExpression, assignmentExpression,
expressionStatement, expressionStatement,
@ -16,29 +14,23 @@ const visitor = {
Scope(path, state) { Scope(path, state) {
if (state.kind === "let") path.skip(); if (state.kind === "let") path.skip();
}, },
FunctionParent(path) { FunctionParent(path) {
path.skip(); path.skip();
}, },
VariableDeclaration(path, state) { VariableDeclaration(path, state) {
if (state.kind && path.node.kind !== state.kind) return; if (state.kind && path.node.kind !== state.kind) return;
const nodes = []; const nodes = [];
const declarations = path.get("declarations"); const declarations = path.get("declarations");
let firstId; let firstId;
for (const declar of declarations) { for (const declar of declarations) {
firstId = declar.node.id; firstId = declar.node.id;
if (declar.node.init) { if (declar.node.init) {
nodes.push(expressionStatement(assignmentExpression("=", declar.node.id, declar.node.init))); nodes.push(expressionStatement(assignmentExpression("=", declar.node.id, declar.node.init)));
} }
for (const name of Object.keys(declar.getBindingIdentifiers())) { for (const name of Object.keys(declar.getBindingIdentifiers())) {
state.emit(identifier(name), name, declar.node.init !== null); state.emit(identifier(name), name, declar.node.init !== null);
} }
} }
if (path.parentPath.isFor({ if (path.parentPath.isFor({
left: path.node left: path.node
})) { })) {
@ -47,12 +39,12 @@ const visitor = {
path.replaceWithMultiple(nodes); path.replaceWithMultiple(nodes);
} }
} }
}; };
function hoistVariables(path, emit, kind = "var") { function hoistVariables(path, emit, kind = "var") {
path.traverse(visitor, { path.traverse(visitor, {
kind, kind,
emit emit
}); });
} }
//# sourceMappingURL=index.js.map

@ -0,0 +1 @@
{"version":3,"names":["_t","require","assignmentExpression","expressionStatement","identifier","visitor","Scope","path","state","kind","skip","FunctionParent","VariableDeclaration","node","nodes","declarations","get","firstId","declar","id","init","push","name","Object","keys","getBindingIdentifiers","emit","parentPath","isFor","left","replaceWith","replaceWithMultiple","hoistVariables","traverse"],"sources":["../src/index.ts"],"sourcesContent":["import {\n assignmentExpression,\n expressionStatement,\n identifier,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { NodePath, Visitor } from \"@babel/traverse\";\n\nexport type EmitFunction = (\n id: t.Identifier,\n idName: string,\n hasInit: boolean,\n) => any;\n\ntype State = {\n kind: \"var\" | \"let\";\n emit: EmitFunction;\n};\n\ntype Unpacked<T> = T extends (infer U)[] ? U : T;\n\nconst visitor: Visitor<State> = {\n Scope(path, state) {\n if (state.kind === \"let\") path.skip();\n },\n\n FunctionParent(path) {\n path.skip();\n },\n\n VariableDeclaration(path, state) {\n if (state.kind && path.node.kind !== state.kind) return;\n\n const nodes = [];\n\n const declarations: ReadonlyArray<\n NodePath<Unpacked<t.VariableDeclaration[\"declarations\"]>>\n > = path.get(\"declarations\");\n let firstId;\n\n for (const declar of declarations) {\n firstId = declar.node.id;\n\n if (declar.node.init) {\n nodes.push(\n expressionStatement(\n assignmentExpression(\"=\", declar.node.id, declar.node.init),\n ),\n );\n }\n\n for (const name of Object.keys(declar.getBindingIdentifiers())) {\n state.emit(identifier(name), name, declar.node.init !== null);\n }\n }\n\n // for (var i in test)\n if (path.parentPath.isFor({ left: path.node })) {\n path.replaceWith(firstId);\n } else {\n path.replaceWithMultiple(nodes);\n }\n },\n};\n\nexport default function hoistVariables(\n path: NodePath,\n emit: EmitFunction,\n kind: \"var\" | \"let\" = \"var\",\n) {\n path.traverse(visitor, { kind, emit });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAIsB;EAHpBC,oBAAoB;EACpBC,mBAAmB;EACnBC;AAAU,IAAAJ,EAAA;AAkBZ,MAAMK,OAAuB,GAAG;EAC9BC,KAAKA,CAACC,IAAI,EAAEC,KAAK,EAAE;IACjB,IAAIA,KAAK,CAACC,IAAI,KAAK,KAAK,EAAEF,IAAI,CAACG,IAAI,CAAC,CAAC;EACvC,CAAC;EAEDC,cAAcA,CAACJ,IAAI,EAAE;IACnBA,IAAI,CAACG,IAAI,CAAC,CAAC;EACb,CAAC;EAEDE,mBAAmBA,CAACL,IAAI,EAAEC,KAAK,EAAE;IAC/B,IAAIA,KAAK,CAACC,IAAI,IAAIF,IAAI,CAACM,IAAI,CAACJ,IAAI,KAAKD,KAAK,CAACC,IAAI,EAAE;IAEjD,MAAMK,KAAK,GAAG,EAAE;IAEhB,MAAMC,YAEL,GAAGR,IAAI,CAACS,GAAG,CAAC,cAAc,CAAC;IAC5B,IAAIC,OAAO;IAEX,KAAK,MAAMC,MAAM,IAAIH,YAAY,EAAE;MACjCE,OAAO,GAAGC,MAAM,CAACL,IAAI,CAACM,EAAE;MAExB,IAAID,MAAM,CAACL,IAAI,CAACO,IAAI,EAAE;QACpBN,KAAK,CAACO,IAAI,CACRlB,mBAAmB,CACjBD,oBAAoB,CAAC,GAAG,EAAEgB,MAAM,CAACL,IAAI,CAACM,EAAE,EAAED,MAAM,CAACL,IAAI,CAACO,IAAI,CAC5D,CACF,CAAC;MACH;MAEA,KAAK,MAAME,IAAI,IAAIC,MAAM,CAACC,IAAI,CAACN,MAAM,CAACO,qBAAqB,CAAC,CAAC,CAAC,EAAE;QAC9DjB,KAAK,CAACkB,IAAI,CAACtB,UAAU,CAACkB,IAAI,CAAC,EAAEA,IAAI,EAAEJ,MAAM,CAACL,IAAI,CAACO,IAAI,KAAK,IAAI,CAAC;MAC/D;IACF;IAGA,IAAIb,IAAI,CAACoB,UAAU,CAACC,KAAK,CAAC;MAAEC,IAAI,EAAEtB,IAAI,CAACM;IAAK,CAAC,CAAC,EAAE;MAC9CN,IAAI,CAACuB,WAAW,CAACb,OAAO,CAAC;IAC3B,CAAC,MAAM;MACLV,IAAI,CAACwB,mBAAmB,CAACjB,KAAK,CAAC;IACjC;EACF;AACF,CAAC;AAEc,SAASkB,cAAcA,CACpCzB,IAAc,EACdmB,IAAkB,EAClBjB,IAAmB,GAAG,KAAK,EAC3B;EACAF,IAAI,CAAC0B,QAAQ,CAAC5B,OAAO,EAAE;IAAEI,IAAI;IAAEiB;EAAK,CAAC,CAAC;AACxC"}

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-hoist-variables", "name": "@babel/helper-hoist-variables",
"version": "7.18.6", "version": "7.22.5",
"description": "Helper function to hoist variables", "description": "Helper function to hoist variables",
"repository": { "repository": {
"type": "git", "type": "git",
@ -14,11 +14,11 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/types": "^7.18.6" "@babel/types": "^7.22.5"
}, },
"TODO": "The @babel/traverse dependency is only needed for the NodePath TS type. We can consider exporting it from @babel/core.", "TODO": "The @babel/traverse dependency is only needed for the NodePath TS type. We can consider exporting it from @babel/core.",
"devDependencies": { "devDependencies": {
"@babel/traverse": "^7.18.6" "@babel/traverse": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-member-expression-to-functions", "name": "@babel/helper-member-expression-to-functions",
"version": "7.22.3", "version": "7.22.5",
"description": "Helper function to replace certain member expressions with function calls", "description": "Helper function to replace certain member expressions with function calls",
"repository": { "repository": {
"type": "git", "type": "git",
@ -15,10 +15,10 @@
"main": "./lib/index.js", "main": "./lib/index.js",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"dependencies": { "dependencies": {
"@babel/types": "^7.22.3" "@babel/types": "^7.22.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/traverse": "^7.22.1" "@babel/traverse": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-module-imports", "name": "@babel/helper-module-imports",
"version": "7.21.4", "version": "7.22.5",
"description": "Babel helper functions for inserting module loads", "description": "Babel helper functions for inserting module loads",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-helper-module-imports", "homepage": "https://babel.dev/docs/en/next/babel-helper-module-imports",
@ -15,11 +15,11 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/types": "^7.21.4" "@babel/types": "^7.22.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.21.4", "@babel/core": "^7.22.5",
"@babel/traverse": "^7.21.4" "@babel/traverse": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-module-transforms", "name": "@babel/helper-module-transforms",
"version": "7.22.1", "version": "7.22.5",
"description": "Babel helper functions for implementing ES6 module transformations", "description": "Babel helper functions for implementing ES6 module transformations",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-helper-module-transforms", "homepage": "https://babel.dev/docs/en/next/babel-helper-module-transforms",
@ -15,14 +15,14 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-environment-visitor": "^7.22.1", "@babel/helper-environment-visitor": "^7.22.5",
"@babel/helper-module-imports": "^7.21.4", "@babel/helper-module-imports": "^7.22.5",
"@babel/helper-simple-access": "^7.21.5", "@babel/helper-simple-access": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.18.6", "@babel/helper-split-export-declaration": "^7.22.5",
"@babel/helper-validator-identifier": "^7.19.1", "@babel/helper-validator-identifier": "^7.22.5",
"@babel/template": "^7.21.9", "@babel/template": "^7.22.5",
"@babel/traverse": "^7.22.1", "@babel/traverse": "^7.22.5",
"@babel/types": "^7.22.0" "@babel/types": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = optimiseCallExpression; exports.default = optimiseCallExpression;
var _t = require("@babel/types"); var _t = require("@babel/types");
const { const {
callExpression, callExpression,
identifier, identifier,
@ -16,7 +14,6 @@ const {
optionalCallExpression, optionalCallExpression,
optionalMemberExpression optionalMemberExpression
} = _t; } = _t;
function optimiseCallExpression(callee, thisNode, args, optional) { function optimiseCallExpression(callee, thisNode, args, optional) {
if (args.length === 1 && isSpreadElement(args[0]) && isIdentifier(args[0].argument, { if (args.length === 1 && isSpreadElement(args[0]) && isIdentifier(args[0].argument, {
name: "arguments" name: "arguments"
@ -24,13 +21,13 @@ function optimiseCallExpression(callee, thisNode, args, optional) {
if (optional) { if (optional) {
return optionalCallExpression(optionalMemberExpression(callee, identifier("apply"), false, true), [thisNode, args[0].argument], false); return optionalCallExpression(optionalMemberExpression(callee, identifier("apply"), false, true), [thisNode, args[0].argument], false);
} }
return callExpression(memberExpression(callee, identifier("apply")), [thisNode, args[0].argument]); return callExpression(memberExpression(callee, identifier("apply")), [thisNode, args[0].argument]);
} else { } else {
if (optional) { if (optional) {
return optionalCallExpression(optionalMemberExpression(callee, identifier("call"), false, true), [thisNode, ...args], false); return optionalCallExpression(optionalMemberExpression(callee, identifier("call"), false, true), [thisNode, ...args], false);
} }
return callExpression(memberExpression(callee, identifier("call")), [thisNode, ...args]); return callExpression(memberExpression(callee, identifier("call")), [thisNode, ...args]);
} }
} }
//# sourceMappingURL=index.js.map

@ -0,0 +1 @@
{"version":3,"names":["_t","require","callExpression","identifier","isIdentifier","isSpreadElement","memberExpression","optionalCallExpression","optionalMemberExpression","optimiseCallExpression","callee","thisNode","args","optional","length","argument","name"],"sources":["../src/index.ts"],"sourcesContent":["import {\n callExpression,\n identifier,\n isIdentifier,\n isSpreadElement,\n memberExpression,\n optionalCallExpression,\n optionalMemberExpression,\n} from \"@babel/types\";\nimport type {\n CallExpression,\n Expression,\n OptionalCallExpression,\n} from \"@babel/types\";\n\n/**\n * A helper function that generates a new call expression with given thisNode.\n It will also optimize `(...arguments)` to `.apply(arguments)`\n *\n * @export\n * @param {Expression} callee The callee of call expression\n * @param {Expression} thisNode The desired this of call expression\n * @param {Readonly<CallExpression[\"arguments\"]>} args The arguments of call expression\n * @param {boolean} optional Whether the call expression is optional\n * @returns {CallExpression | OptionalCallExpression} The generated new call expression\n */\nexport default function optimiseCallExpression(\n callee: Expression,\n thisNode: Expression,\n args: Readonly<CallExpression[\"arguments\"]>,\n optional: boolean,\n): CallExpression | OptionalCallExpression {\n if (\n args.length === 1 &&\n isSpreadElement(args[0]) &&\n isIdentifier(args[0].argument, { name: \"arguments\" })\n ) {\n // a.b?.(...arguments);\n if (optional) {\n return optionalCallExpression(\n optionalMemberExpression(callee, identifier(\"apply\"), false, true),\n [thisNode, args[0].argument],\n false,\n );\n }\n // a.b(...arguments);\n return callExpression(memberExpression(callee, identifier(\"apply\")), [\n thisNode,\n args[0].argument,\n ]);\n } else {\n // a.b?.(arg1, arg2)\n if (optional) {\n return optionalCallExpression(\n optionalMemberExpression(callee, identifier(\"call\"), false, true),\n [thisNode, ...args],\n false,\n );\n }\n // a.b(arg1, arg2)\n return callExpression(memberExpression(callee, identifier(\"call\")), [\n thisNode,\n ...args,\n ]);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAQsB;EAPpBC,cAAc;EACdC,UAAU;EACVC,YAAY;EACZC,eAAe;EACfC,gBAAgB;EAChBC,sBAAsB;EACtBC;AAAwB,IAAAR,EAAA;AAmBX,SAASS,sBAAsBA,CAC5CC,MAAkB,EAClBC,QAAoB,EACpBC,IAA2C,EAC3CC,QAAiB,EACwB;EACzC,IACED,IAAI,CAACE,MAAM,KAAK,CAAC,IACjBT,eAAe,CAACO,IAAI,CAAC,CAAC,CAAC,CAAC,IACxBR,YAAY,CAACQ,IAAI,CAAC,CAAC,CAAC,CAACG,QAAQ,EAAE;IAAEC,IAAI,EAAE;EAAY,CAAC,CAAC,EACrD;IAEA,IAAIH,QAAQ,EAAE;MACZ,OAAON,sBAAsB,CAC3BC,wBAAwB,CAACE,MAAM,EAAEP,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAClE,CAACQ,QAAQ,EAAEC,IAAI,CAAC,CAAC,CAAC,CAACG,QAAQ,CAAC,EAC5B,KACF,CAAC;IACH;IAEA,OAAOb,cAAc,CAACI,gBAAgB,CAACI,MAAM,EAAEP,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,CACnEQ,QAAQ,EACRC,IAAI,CAAC,CAAC,CAAC,CAACG,QAAQ,CACjB,CAAC;EACJ,CAAC,MAAM;IAEL,IAAIF,QAAQ,EAAE;MACZ,OAAON,sBAAsB,CAC3BC,wBAAwB,CAACE,MAAM,EAAEP,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EACjE,CAACQ,QAAQ,EAAE,GAAGC,IAAI,CAAC,EACnB,KACF,CAAC;IACH;IAEA,OAAOV,cAAc,CAACI,gBAAgB,CAACI,MAAM,EAAEP,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAClEQ,QAAQ,EACR,GAAGC,IAAI,CACR,CAAC;EACJ;AACF"}

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-optimise-call-expression", "name": "@babel/helper-optimise-call-expression",
"version": "7.18.6", "version": "7.22.5",
"description": "Helper function to optimise call expression", "description": "Helper function to optimise call expression",
"repository": { "repository": {
"type": "git", "type": "git",
@ -14,11 +14,11 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/types": "^7.18.6" "@babel/types": "^7.22.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/generator": "^7.18.6", "@babel/generator": "^7.22.5",
"@babel/parser": "^7.18.6" "@babel/parser": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-plugin-utils", "name": "@babel/helper-plugin-utils",
"version": "7.21.5", "version": "7.22.5",
"description": "General utilities for plugins to use", "description": "General utilities for plugins to use",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-helper-plugin-utils", "homepage": "https://babel.dev/docs/en/next/babel-helper-plugin-utils",

@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = _default; exports.default = _default;
var _helperWrapFunction = require("@babel/helper-wrap-function"); var _helperWrapFunction = require("@babel/helper-wrap-function");
var _helperAnnotateAsPure = require("@babel/helper-annotate-as-pure"); var _helperAnnotateAsPure = require("@babel/helper-annotate-as-pure");
var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor"); var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor");
var _core = require("@babel/core"); var _core = require("@babel/core");
var _t = require("@babel/types"); var _t = require("@babel/types");
const { const {
callExpression, callExpression,
cloneNode, cloneNode,
@ -22,21 +16,17 @@ const {
isThisExpression, isThisExpression,
yieldExpression yieldExpression
} = _t; } = _t;
const awaitVisitor = _core.traverse.visitors.merge([{ const awaitVisitor = _core.traverse.visitors.merge([{
ArrowFunctionExpression(path) { ArrowFunctionExpression(path) {
path.skip(); path.skip();
}, },
AwaitExpression(path, { AwaitExpression(path, {
wrapAwait wrapAwait
}) { }) {
const argument = path.get("argument"); const argument = path.get("argument");
path.replaceWith(yieldExpression(wrapAwait ? callExpression(cloneNode(wrapAwait), [argument.node]) : argument.node)); path.replaceWith(yieldExpression(wrapAwait ? callExpression(cloneNode(wrapAwait), [argument.node]) : argument.node));
} }
}, _helperEnvironmentVisitor.default]); }, _helperEnvironmentVisitor.default]);
function _default(path, helpers, noNewArrows, ignoreFunctionLength) { function _default(path, helpers, noNewArrows, ignoreFunctionLength) {
path.traverse(awaitVisitor, { path.traverse(awaitVisitor, {
wrapAwait: helpers.wrapAwait wrapAwait: helpers.wrapAwait
@ -46,22 +36,18 @@ function _default(path, helpers, noNewArrows, ignoreFunctionLength) {
path.node.generator = true; path.node.generator = true;
(0, _helperWrapFunction.default)(path, cloneNode(helpers.wrapAsync), noNewArrows, ignoreFunctionLength); (0, _helperWrapFunction.default)(path, cloneNode(helpers.wrapAsync), noNewArrows, ignoreFunctionLength);
const isProperty = path.isObjectMethod() || path.isClassMethod() || path.parentPath.isObjectProperty() || path.parentPath.isClassProperty(); const isProperty = path.isObjectMethod() || path.isClassMethod() || path.parentPath.isObjectProperty() || path.parentPath.isClassProperty();
if (!isProperty && !isIIFE && path.isExpression()) { if (!isProperty && !isIIFE && path.isExpression()) {
(0, _helperAnnotateAsPure.default)(path); (0, _helperAnnotateAsPure.default)(path);
} }
function checkIsIIFE(path) { function checkIsIIFE(path) {
if (path.parentPath.isCallExpression({ if (path.parentPath.isCallExpression({
callee: path.node callee: path.node
})) { })) {
return true; return true;
} }
const { const {
parentPath parentPath
} = path; } = path;
if (parentPath.isMemberExpression() && isIdentifier(parentPath.node.property, { if (parentPath.isMemberExpression() && isIdentifier(parentPath.node.property, {
name: "bind" name: "bind"
})) { })) {
@ -72,7 +58,8 @@ function _default(path, helpers, noNewArrows, ignoreFunctionLength) {
callee: bindCall.node callee: bindCall.node
}); });
} }
return false; return false;
} }
} }
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-remap-async-to-generator", "name": "@babel/helper-remap-async-to-generator",
"version": "7.18.9", "version": "7.22.5",
"description": "Helper function to remap async functions to generators", "description": "Helper function to remap async functions to generators",
"repository": { "repository": {
"type": "git", "type": "git",
@ -14,14 +14,14 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-annotate-as-pure": "^7.18.6", "@babel/helper-annotate-as-pure": "^7.22.5",
"@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-environment-visitor": "^7.22.5",
"@babel/helper-wrap-function": "^7.18.9", "@babel/helper-wrap-function": "^7.22.5",
"@babel/types": "^7.18.9" "@babel/types": "^7.22.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.18.9", "@babel/core": "^7.22.5",
"@babel/traverse": "^7.18.9" "@babel/traverse": "^7.22.5"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0"

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-replace-supers", "name": "@babel/helper-replace-supers",
"version": "7.22.1", "version": "7.22.5",
"description": "Helper function to replace supers", "description": "Helper function to replace supers",
"repository": { "repository": {
"type": "git", "type": "git",
@ -14,12 +14,12 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-environment-visitor": "^7.22.1", "@babel/helper-environment-visitor": "^7.22.5",
"@babel/helper-member-expression-to-functions": "^7.22.0", "@babel/helper-member-expression-to-functions": "^7.22.5",
"@babel/helper-optimise-call-expression": "^7.18.6", "@babel/helper-optimise-call-expression": "^7.22.5",
"@babel/template": "^7.21.9", "@babel/template": "^7.22.5",
"@babel/traverse": "^7.22.1", "@babel/traverse": "^7.22.5",
"@babel/types": "^7.22.0" "@babel/types": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-simple-access", "name": "@babel/helper-simple-access",
"version": "7.21.5", "version": "7.22.5",
"description": "Babel helper for ensuring that access to a given value is performed through simple accesses", "description": "Babel helper for ensuring that access to a given value is performed through simple accesses",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-helper-simple-access", "homepage": "https://babel.dev/docs/en/next/babel-helper-simple-access",
@ -15,11 +15,11 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/types": "^7.21.5" "@babel/types": "^7.22.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.21.5", "@babel/core": "^7.22.5",
"@babel/traverse": "^7.21.5" "@babel/traverse": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
exports.isTransparentExprWrapper = isTransparentExprWrapper; exports.isTransparentExprWrapper = isTransparentExprWrapper;
exports.skipTransparentExprWrapperNodes = skipTransparentExprWrapperNodes; exports.skipTransparentExprWrapperNodes = skipTransparentExprWrapperNodes;
exports.skipTransparentExprWrappers = skipTransparentExprWrappers; exports.skipTransparentExprWrappers = skipTransparentExprWrappers;
var _t = require("@babel/types"); var _t = require("@babel/types");
const { const {
isParenthesizedExpression, isParenthesizedExpression,
isTSAsExpression, isTSAsExpression,
@ -17,24 +15,19 @@ const {
isTSTypeAssertion, isTSTypeAssertion,
isTypeCastExpression isTypeCastExpression
} = _t; } = _t;
function isTransparentExprWrapper(node) { function isTransparentExprWrapper(node) {
return isTSAsExpression(node) || isTSSatisfiesExpression(node) || isTSTypeAssertion(node) || isTSNonNullExpression(node) || isTypeCastExpression(node) || isParenthesizedExpression(node); return isTSAsExpression(node) || isTSSatisfiesExpression(node) || isTSTypeAssertion(node) || isTSNonNullExpression(node) || isTypeCastExpression(node) || isParenthesizedExpression(node);
} }
function skipTransparentExprWrappers(path) { function skipTransparentExprWrappers(path) {
while (isTransparentExprWrapper(path.node)) { while (isTransparentExprWrapper(path.node)) {
path = path.get("expression"); path = path.get("expression");
} }
return path; return path;
} }
function skipTransparentExprWrapperNodes(node) { function skipTransparentExprWrapperNodes(node) {
while (isTransparentExprWrapper(node)) { while (isTransparentExprWrapper(node)) {
node = node.expression; node = node.expression;
} }
return node; return node;
} }

@ -1 +1 @@
{"version":3,"names":["isParenthesizedExpression","isTSAsExpression","isTSNonNullExpression","isTSSatisfiesExpression","isTSTypeAssertion","isTypeCastExpression","isTransparentExprWrapper","node","skipTransparentExprWrappers","path","get","skipTransparentExprWrapperNodes","expression"],"sources":["../src/index.ts"],"sourcesContent":["import {\n isParenthesizedExpression,\n isTSAsExpression,\n isTSNonNullExpression,\n isTSSatisfiesExpression,\n isTSTypeAssertion,\n isTypeCastExpression,\n} from \"@babel/types\";\n\nimport type * as t from \"@babel/types\";\nimport type { NodePath } from \"@babel/traverse\";\n\nexport type TransparentExprWrapper =\n | t.TSAsExpression\n | t.TSSatisfiesExpression\n | t.TSTypeAssertion\n | t.TSNonNullExpression\n | t.TypeCastExpression\n | t.ParenthesizedExpression;\n\n// A transparent expression wrapper is an AST node that most plugins will wish\n// to skip, as its presence does not affect the behaviour of the code. This\n// includes expressions used for types, and extra parenthesis. For example, in\n// (a as any)(), this helper can be used to skip the TSAsExpression when\n// determining the callee.\nexport function isTransparentExprWrapper(\n node: t.Node,\n): node is TransparentExprWrapper {\n return (\n isTSAsExpression(node) ||\n isTSSatisfiesExpression(node) ||\n isTSTypeAssertion(node) ||\n isTSNonNullExpression(node) ||\n isTypeCastExpression(node) ||\n isParenthesizedExpression(node)\n );\n}\n\nexport function skipTransparentExprWrappers(\n path: NodePath<t.Expression>,\n): NodePath<t.Expression> {\n while (isTransparentExprWrapper(path.node)) {\n path = path.get(\"expression\");\n }\n return path;\n}\n\nexport function skipTransparentExprWrapperNodes(\n node: t.Expression | t.Super,\n): t.Expression | t.Super {\n while (isTransparentExprWrapper(node)) {\n node = node.expression;\n }\n return node;\n}\n"],"mappings":";;;;;;;;;AAAA;;;EACEA,yB;EACAC,gB;EACAC,qB;EACAC,uB;EACAC,iB;EACAC;;;AAmBK,SAASC,wBAAT,CACLC,IADK,EAE2B;EAChC,OACEN,gBAAgB,CAACM,IAAD,CAAhB,IACAJ,uBAAuB,CAACI,IAAD,CADvB,IAEAH,iBAAiB,CAACG,IAAD,CAFjB,IAGAL,qBAAqB,CAACK,IAAD,CAHrB,IAIAF,oBAAoB,CAACE,IAAD,CAJpB,IAKAP,yBAAyB,CAACO,IAAD,CAN3B;AAQD;;AAEM,SAASC,2BAAT,CACLC,IADK,EAEmB;EACxB,OAAOH,wBAAwB,CAACG,IAAI,CAACF,IAAN,CAA/B,EAA4C;IAC1CE,IAAI,GAAGA,IAAI,CAACC,GAAL,CAAS,YAAT,CAAP;EACD;;EACD,OAAOD,IAAP;AACD;;AAEM,SAASE,+BAAT,CACLJ,IADK,EAEmB;EACxB,OAAOD,wBAAwB,CAACC,IAAD,CAA/B,EAAuC;IACrCA,IAAI,GAAGA,IAAI,CAACK,UAAZ;EACD;;EACD,OAAOL,IAAP;AACD"} {"version":3,"names":["_t","require","isParenthesizedExpression","isTSAsExpression","isTSNonNullExpression","isTSSatisfiesExpression","isTSTypeAssertion","isTypeCastExpression","isTransparentExprWrapper","node","skipTransparentExprWrappers","path","get","skipTransparentExprWrapperNodes","expression"],"sources":["../src/index.ts"],"sourcesContent":["import {\n isParenthesizedExpression,\n isTSAsExpression,\n isTSNonNullExpression,\n isTSSatisfiesExpression,\n isTSTypeAssertion,\n isTypeCastExpression,\n} from \"@babel/types\";\n\nimport type * as t from \"@babel/types\";\nimport type { NodePath } from \"@babel/traverse\";\n\nexport type TransparentExprWrapper =\n | t.TSAsExpression\n | t.TSSatisfiesExpression\n | t.TSTypeAssertion\n | t.TSNonNullExpression\n | t.TypeCastExpression\n | t.ParenthesizedExpression;\n\n// A transparent expression wrapper is an AST node that most plugins will wish\n// to skip, as its presence does not affect the behaviour of the code. This\n// includes expressions used for types, and extra parenthesis. For example, in\n// (a as any)(), this helper can be used to skip the TSAsExpression when\n// determining the callee.\nexport function isTransparentExprWrapper(\n node: t.Node,\n): node is TransparentExprWrapper {\n return (\n isTSAsExpression(node) ||\n isTSSatisfiesExpression(node) ||\n isTSTypeAssertion(node) ||\n isTSNonNullExpression(node) ||\n isTypeCastExpression(node) ||\n isParenthesizedExpression(node)\n );\n}\n\nexport function skipTransparentExprWrappers(\n path: NodePath<t.Expression>,\n): NodePath<t.Expression> {\n while (isTransparentExprWrapper(path.node)) {\n path = path.get(\"expression\");\n }\n return path;\n}\n\nexport function skipTransparentExprWrapperNodes(\n node: t.Expression | t.Super,\n): t.Expression | t.Super {\n while (isTransparentExprWrapper(node)) {\n node = node.expression;\n }\n return node;\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAOsB;EANpBC,yBAAyB;EACzBC,gBAAgB;EAChBC,qBAAqB;EACrBC,uBAAuB;EACvBC,iBAAiB;EACjBC;AAAoB,IAAAP,EAAA;AAmBf,SAASQ,wBAAwBA,CACtCC,IAAY,EACoB;EAChC,OACEN,gBAAgB,CAACM,IAAI,CAAC,IACtBJ,uBAAuB,CAACI,IAAI,CAAC,IAC7BH,iBAAiB,CAACG,IAAI,CAAC,IACvBL,qBAAqB,CAACK,IAAI,CAAC,IAC3BF,oBAAoB,CAACE,IAAI,CAAC,IAC1BP,yBAAyB,CAACO,IAAI,CAAC;AAEnC;AAEO,SAASC,2BAA2BA,CACzCC,IAA4B,EACJ;EACxB,OAAOH,wBAAwB,CAACG,IAAI,CAACF,IAAI,CAAC,EAAE;IAC1CE,IAAI,GAAGA,IAAI,CAACC,GAAG,CAAC,YAAY,CAAC;EAC/B;EACA,OAAOD,IAAI;AACb;AAEO,SAASE,+BAA+BA,CAC7CJ,IAA4B,EACJ;EACxB,OAAOD,wBAAwB,CAACC,IAAI,CAAC,EAAE;IACrCA,IAAI,GAAGA,IAAI,CAACK,UAAU;EACxB;EACA,OAAOL,IAAI;AACb"}

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-skip-transparent-expression-wrappers", "name": "@babel/helper-skip-transparent-expression-wrappers",
"version": "7.20.0", "version": "7.22.5",
"description": "Helper which skips types and parentheses", "description": "Helper which skips types and parentheses",
"repository": { "repository": {
"type": "git", "type": "git",
@ -17,10 +17,10 @@
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"dependencies": { "dependencies": {
"@babel/types": "^7.20.0" "@babel/types": "^7.22.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/traverse": "^7.20.0" "@babel/traverse": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = splitExportDeclaration; exports.default = splitExportDeclaration;
var _t = require("@babel/types"); var _t = require("@babel/types");
const { const {
cloneNode, cloneNode,
exportNamedDeclaration, exportNamedDeclaration,
@ -15,42 +13,34 @@ const {
variableDeclaration, variableDeclaration,
variableDeclarator variableDeclarator
} = _t; } = _t;
function splitExportDeclaration(exportDeclaration) { function splitExportDeclaration(exportDeclaration) {
if (!exportDeclaration.isExportDeclaration() || exportDeclaration.isExportAllDeclaration()) { if (!exportDeclaration.isExportDeclaration() || exportDeclaration.isExportAllDeclaration()) {
throw new Error("Only default and named export declarations can be split."); throw new Error("Only default and named export declarations can be split.");
} }
if (exportDeclaration.isExportDefaultDeclaration()) { if (exportDeclaration.isExportDefaultDeclaration()) {
const declaration = exportDeclaration.get("declaration"); const declaration = exportDeclaration.get("declaration");
const standaloneDeclaration = declaration.isFunctionDeclaration() || declaration.isClassDeclaration(); const standaloneDeclaration = declaration.isFunctionDeclaration() || declaration.isClassDeclaration();
const scope = declaration.isScope() ? declaration.scope.parent : declaration.scope; const scope = declaration.isScope() ? declaration.scope.parent : declaration.scope;
let id = declaration.node.id; let id = declaration.node.id;
let needBindingRegistration = false; let needBindingRegistration = false;
if (!id) { if (!id) {
needBindingRegistration = true; needBindingRegistration = true;
id = scope.generateUidIdentifier("default"); id = scope.generateUidIdentifier("default");
if (standaloneDeclaration || declaration.isFunctionExpression() || declaration.isClassExpression()) { if (standaloneDeclaration || declaration.isFunctionExpression() || declaration.isClassExpression()) {
declaration.node.id = cloneNode(id); declaration.node.id = cloneNode(id);
} }
} }
const updatedDeclaration = standaloneDeclaration ? declaration.node : variableDeclaration("var", [variableDeclarator(cloneNode(id), declaration.node)]); const updatedDeclaration = standaloneDeclaration ? declaration.node : variableDeclaration("var", [variableDeclarator(cloneNode(id), declaration.node)]);
const updatedExportDeclaration = exportNamedDeclaration(null, [exportSpecifier(cloneNode(id), identifier("default"))]); const updatedExportDeclaration = exportNamedDeclaration(null, [exportSpecifier(cloneNode(id), identifier("default"))]);
exportDeclaration.insertAfter(updatedExportDeclaration); exportDeclaration.insertAfter(updatedExportDeclaration);
exportDeclaration.replaceWith(updatedDeclaration); exportDeclaration.replaceWith(updatedDeclaration);
if (needBindingRegistration) { if (needBindingRegistration) {
scope.registerDeclaration(exportDeclaration); scope.registerDeclaration(exportDeclaration);
} }
return exportDeclaration; return exportDeclaration;
} else if (exportDeclaration.get("specifiers").length > 0) { } else if (exportDeclaration.get("specifiers").length > 0) {
throw new Error("It doesn't make sense to split exported specifiers."); throw new Error("It doesn't make sense to split exported specifiers.");
} }
const declaration = exportDeclaration.get("declaration"); const declaration = exportDeclaration.get("declaration");
const bindingIdentifiers = declaration.getOuterBindingIdentifiers(); const bindingIdentifiers = declaration.getOuterBindingIdentifiers();
const specifiers = Object.keys(bindingIdentifiers).map(name => { const specifiers = Object.keys(bindingIdentifiers).map(name => {
@ -61,3 +51,5 @@ function splitExportDeclaration(exportDeclaration) {
exportDeclaration.replaceWith(declaration.node); exportDeclaration.replaceWith(declaration.node);
return exportDeclaration; return exportDeclaration;
} }
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-split-export-declaration", "name": "@babel/helper-split-export-declaration",
"version": "7.18.6", "version": "7.22.5",
"description": "", "description": "",
"repository": { "repository": {
"type": "git", "type": "git",
@ -14,7 +14,7 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/types": "^7.18.6" "@babel/types": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-string-parser", "name": "@babel/helper-string-parser",
"version": "7.21.5", "version": "7.22.5",
"description": "A utility package to parse strings", "description": "A utility package to parse strings",
"repository": { "repository": {
"type": "git", "type": "git",

@ -13,33 +13,26 @@ const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonAS
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191]; const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191];
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
function isInAstralSet(code, set) { function isInAstralSet(code, set) {
let pos = 0x10000; let pos = 0x10000;
for (let i = 0, length = set.length; i < length; i += 2) { for (let i = 0, length = set.length; i < length; i += 2) {
pos += set[i]; pos += set[i];
if (pos > code) return false; if (pos > code) return false;
pos += set[i + 1]; pos += set[i + 1];
if (pos >= code) return true; if (pos >= code) return true;
} }
return false; return false;
} }
function isIdentifierStart(code) { function isIdentifierStart(code) {
if (code < 65) return code === 36; if (code < 65) return code === 36;
if (code <= 90) return true; if (code <= 90) return true;
if (code < 97) return code === 95; if (code < 97) return code === 95;
if (code <= 122) return true; if (code <= 122) return true;
if (code <= 0xffff) { if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
} }
return isInAstralSet(code, astralIdentifierStartCodes); return isInAstralSet(code, astralIdentifierStartCodes);
} }
function isIdentifierChar(code) { function isIdentifierChar(code) {
if (code < 48) return code === 36; if (code < 48) return code === 36;
if (code < 58) return true; if (code < 58) return true;
@ -47,31 +40,23 @@ function isIdentifierChar(code) {
if (code <= 90) return true; if (code <= 90) return true;
if (code < 97) return code === 95; if (code < 97) return code === 95;
if (code <= 122) return true; if (code <= 122) return true;
if (code <= 0xffff) { if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
} }
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
} }
function isIdentifierName(name) { function isIdentifierName(name) {
let isFirst = true; let isFirst = true;
for (let i = 0; i < name.length; i++) { for (let i = 0; i < name.length; i++) {
let cp = name.charCodeAt(i); let cp = name.charCodeAt(i);
if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) { if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) {
const trail = name.charCodeAt(++i); const trail = name.charCodeAt(++i);
if ((trail & 0xfc00) === 0xdc00) { if ((trail & 0xfc00) === 0xdc00) {
cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff); cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
} }
} }
if (isFirst) { if (isFirst) {
isFirst = false; isFirst = false;
if (!isIdentifierStart(cp)) { if (!isIdentifierStart(cp)) {
return false; return false;
} }
@ -79,7 +64,6 @@ function isIdentifierName(name) {
return false; return false;
} }
} }
return !isFirst; return !isFirst;
} }

File diff suppressed because one or more lines are too long

@ -51,9 +51,7 @@ Object.defineProperty(exports, "isStrictReservedWord", {
return _keyword.isStrictReservedWord; return _keyword.isStrictReservedWord;
} }
}); });
var _identifier = require("./identifier"); var _identifier = require("./identifier");
var _keyword = require("./keyword"); var _keyword = require("./keyword");
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map

@ -1 +1 @@
{"version":3,"names":[],"sources":["../src/index.ts"],"sourcesContent":["export {\n isIdentifierName,\n isIdentifierChar,\n isIdentifierStart,\n} from \"./identifier\";\nexport {\n isReservedWord,\n isStrictBindOnlyReservedWord,\n isStrictBindReservedWord,\n isStrictReservedWord,\n isKeyword,\n} from \"./keyword\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA"} {"version":3,"names":["_identifier","require","_keyword"],"sources":["../src/index.ts"],"sourcesContent":["export {\n isIdentifierName,\n isIdentifierChar,\n isIdentifierStart,\n} from \"./identifier\";\nexport {\n isReservedWord,\n isStrictBindOnlyReservedWord,\n isStrictBindReservedWord,\n isStrictReservedWord,\n isKeyword,\n} from \"./keyword\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA"}

@ -16,23 +16,18 @@ const reservedWords = {
const keywords = new Set(reservedWords.keyword); const keywords = new Set(reservedWords.keyword);
const reservedWordsStrictSet = new Set(reservedWords.strict); const reservedWordsStrictSet = new Set(reservedWords.strict);
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind); const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
function isReservedWord(word, inModule) { function isReservedWord(word, inModule) {
return inModule && word === "await" || word === "enum"; return inModule && word === "await" || word === "enum";
} }
function isStrictReservedWord(word, inModule) { function isStrictReservedWord(word, inModule) {
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word); return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
} }
function isStrictBindOnlyReservedWord(word) { function isStrictBindOnlyReservedWord(word) {
return reservedWordsStrictBindSet.has(word); return reservedWordsStrictBindSet.has(word);
} }
function isStrictBindReservedWord(word, inModule) { function isStrictBindReservedWord(word, inModule) {
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word); return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
} }
function isKeyword(word) { function isKeyword(word) {
return keywords.has(word); return keywords.has(word);
} }

@ -1 +1 @@
{"version":3,"names":["reservedWords","keyword","strict","strictBind","keywords","Set","reservedWordsStrictSet","reservedWordsStrictBindSet","isReservedWord","word","inModule","isStrictReservedWord","has","isStrictBindOnlyReservedWord","isStrictBindReservedWord","isKeyword"],"sources":["../src/keyword.ts"],"sourcesContent":["const reservedWords = {\n keyword: [\n \"break\",\n \"case\",\n \"catch\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"do\",\n \"else\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"return\",\n \"switch\",\n \"throw\",\n \"try\",\n \"var\",\n \"const\",\n \"while\",\n \"with\",\n \"new\",\n \"this\",\n \"super\",\n \"class\",\n \"extends\",\n \"export\",\n \"import\",\n \"null\",\n \"true\",\n \"false\",\n \"in\",\n \"instanceof\",\n \"typeof\",\n \"void\",\n \"delete\",\n ],\n strict: [\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n \"yield\",\n ],\n strictBind: [\"eval\", \"arguments\"],\n};\nconst keywords = new Set(reservedWords.keyword);\nconst reservedWordsStrictSet = new Set(reservedWords.strict);\nconst reservedWordsStrictBindSet = new Set(reservedWords.strictBind);\n\n/**\n * Checks if word is a reserved word in non-strict mode\n */\nexport function isReservedWord(word: string, inModule: boolean): boolean {\n return (inModule && word === \"await\") || word === \"enum\";\n}\n\n/**\n * Checks if word is a reserved word in non-binding strict mode\n *\n * Includes non-strict reserved words\n */\nexport function isStrictReservedWord(word: string, inModule: boolean): boolean {\n return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode, but it is allowed as\n * a normal identifier.\n */\nexport function isStrictBindOnlyReservedWord(word: string): boolean {\n return reservedWordsStrictBindSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode\n *\n * Includes non-strict reserved words and non-binding strict reserved words\n */\nexport function isStrictBindReservedWord(\n word: string,\n inModule: boolean,\n): boolean {\n return (\n isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word)\n );\n}\n\nexport function isKeyword(word: string): boolean {\n return keywords.has(word);\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAMA,aAAa,GAAG;EACpBC,OAAO,EAAE,CACP,OADO,EAEP,MAFO,EAGP,OAHO,EAIP,UAJO,EAKP,UALO,EAMP,SANO,EAOP,IAPO,EAQP,MARO,EASP,SATO,EAUP,KAVO,EAWP,UAXO,EAYP,IAZO,EAaP,QAbO,EAcP,QAdO,EAeP,OAfO,EAgBP,KAhBO,EAiBP,KAjBO,EAkBP,OAlBO,EAmBP,OAnBO,EAoBP,MApBO,EAqBP,KArBO,EAsBP,MAtBO,EAuBP,OAvBO,EAwBP,OAxBO,EAyBP,SAzBO,EA0BP,QA1BO,EA2BP,QA3BO,EA4BP,MA5BO,EA6BP,MA7BO,EA8BP,OA9BO,EA+BP,IA/BO,EAgCP,YAhCO,EAiCP,QAjCO,EAkCP,MAlCO,EAmCP,QAnCO,CADW;EAsCpBC,MAAM,EAAE,CACN,YADM,EAEN,WAFM,EAGN,KAHM,EAIN,SAJM,EAKN,SALM,EAMN,WANM,EAON,QAPM,EAQN,QARM,EASN,OATM,CAtCY;EAiDpBC,UAAU,EAAE,CAAC,MAAD,EAAS,WAAT;AAjDQ,CAAtB;AAmDA,MAAMC,QAAQ,GAAG,IAAIC,GAAJ,CAAQL,aAAa,CAACC,OAAtB,CAAjB;AACA,MAAMK,sBAAsB,GAAG,IAAID,GAAJ,CAAQL,aAAa,CAACE,MAAtB,CAA/B;AACA,MAAMK,0BAA0B,GAAG,IAAIF,GAAJ,CAAQL,aAAa,CAACG,UAAtB,CAAnC;;AAKO,SAASK,cAAT,CAAwBC,IAAxB,EAAsCC,QAAtC,EAAkE;EACvE,OAAQA,QAAQ,IAAID,IAAI,KAAK,OAAtB,IAAkCA,IAAI,KAAK,MAAlD;AACD;;AAOM,SAASE,oBAAT,CAA8BF,IAA9B,EAA4CC,QAA5C,EAAwE;EAC7E,OAAOF,cAAc,CAACC,IAAD,EAAOC,QAAP,CAAd,IAAkCJ,sBAAsB,CAACM,GAAvB,CAA2BH,IAA3B,CAAzC;AACD;;AAMM,SAASI,4BAAT,CAAsCJ,IAAtC,EAA6D;EAClE,OAAOF,0BAA0B,CAACK,GAA3B,CAA+BH,IAA/B,CAAP;AACD;;AAOM,SAASK,wBAAT,CACLL,IADK,EAELC,QAFK,EAGI;EACT,OACEC,oBAAoB,CAACF,IAAD,EAAOC,QAAP,CAApB,IAAwCG,4BAA4B,CAACJ,IAAD,CADtE;AAGD;;AAEM,SAASM,SAAT,CAAmBN,IAAnB,EAA0C;EAC/C,OAAOL,QAAQ,CAACQ,GAAT,CAAaH,IAAb,CAAP;AACD"} {"version":3,"names":["reservedWords","keyword","strict","strictBind","keywords","Set","reservedWordsStrictSet","reservedWordsStrictBindSet","isReservedWord","word","inModule","isStrictReservedWord","has","isStrictBindOnlyReservedWord","isStrictBindReservedWord","isKeyword"],"sources":["../src/keyword.ts"],"sourcesContent":["const reservedWords = {\n keyword: [\n \"break\",\n \"case\",\n \"catch\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"do\",\n \"else\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"return\",\n \"switch\",\n \"throw\",\n \"try\",\n \"var\",\n \"const\",\n \"while\",\n \"with\",\n \"new\",\n \"this\",\n \"super\",\n \"class\",\n \"extends\",\n \"export\",\n \"import\",\n \"null\",\n \"true\",\n \"false\",\n \"in\",\n \"instanceof\",\n \"typeof\",\n \"void\",\n \"delete\",\n ],\n strict: [\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n \"yield\",\n ],\n strictBind: [\"eval\", \"arguments\"],\n};\nconst keywords = new Set(reservedWords.keyword);\nconst reservedWordsStrictSet = new Set(reservedWords.strict);\nconst reservedWordsStrictBindSet = new Set(reservedWords.strictBind);\n\n/**\n * Checks if word is a reserved word in non-strict mode\n */\nexport function isReservedWord(word: string, inModule: boolean): boolean {\n return (inModule && word === \"await\") || word === \"enum\";\n}\n\n/**\n * Checks if word is a reserved word in non-binding strict mode\n *\n * Includes non-strict reserved words\n */\nexport function isStrictReservedWord(word: string, inModule: boolean): boolean {\n return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode, but it is allowed as\n * a normal identifier.\n */\nexport function isStrictBindOnlyReservedWord(word: string): boolean {\n return reservedWordsStrictBindSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode\n *\n * Includes non-strict reserved words and non-binding strict reserved words\n */\nexport function isStrictBindReservedWord(\n word: string,\n inModule: boolean,\n): boolean {\n return (\n isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word)\n );\n}\n\nexport function isKeyword(word: string): boolean {\n return keywords.has(word);\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAMA,aAAa,GAAG;EACpBC,OAAO,EAAE,CACP,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,EACT,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,QAAQ,CACT;EACDC,MAAM,EAAE,CACN,YAAY,EACZ,WAAW,EACX,KAAK,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,CACR;EACDC,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW;AAClC,CAAC;AACD,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAACL,aAAa,CAACC,OAAO,CAAC;AAC/C,MAAMK,sBAAsB,GAAG,IAAID,GAAG,CAACL,aAAa,CAACE,MAAM,CAAC;AAC5D,MAAMK,0BAA0B,GAAG,IAAIF,GAAG,CAACL,aAAa,CAACG,UAAU,CAAC;AAK7D,SAASK,cAAcA,CAACC,IAAY,EAAEC,QAAiB,EAAW;EACvE,OAAQA,QAAQ,IAAID,IAAI,KAAK,OAAO,IAAKA,IAAI,KAAK,MAAM;AAC1D;AAOO,SAASE,oBAAoBA,CAACF,IAAY,EAAEC,QAAiB,EAAW;EAC7E,OAAOF,cAAc,CAACC,IAAI,EAAEC,QAAQ,CAAC,IAAIJ,sBAAsB,CAACM,GAAG,CAACH,IAAI,CAAC;AAC3E;AAMO,SAASI,4BAA4BA,CAACJ,IAAY,EAAW;EAClE,OAAOF,0BAA0B,CAACK,GAAG,CAACH,IAAI,CAAC;AAC7C;AAOO,SAASK,wBAAwBA,CACtCL,IAAY,EACZC,QAAiB,EACR;EACT,OACEC,oBAAoB,CAACF,IAAI,EAAEC,QAAQ,CAAC,IAAIG,4BAA4B,CAACJ,IAAI,CAAC;AAE9E;AAEO,SAASM,SAASA,CAACN,IAAY,EAAW;EAC/C,OAAOL,QAAQ,CAACQ,GAAG,CAACH,IAAI,CAAC;AAC3B"}

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-validator-identifier", "name": "@babel/helper-validator-identifier",
"version": "7.19.1", "version": "7.22.5",
"description": "Validate identifier/keywords name", "description": "Validate identifier/keywords name",
"repository": { "repository": {
"type": "git", "type": "git",

@ -1 +1 @@
{"version":3,"names":["min","Math","levenshtein","a","b","t","u","i","j","m","length","n","findSuggestion","str","arr","distances","map","el","indexOf"],"sources":["../src/find-suggestion.ts"],"sourcesContent":["const { min } = Math;\n\n// a minimal leven distance implementation\n// balanced maintainability with code size\n// It is not blazingly fast but should be okay for Babel user case\n// where it will be run for at most tens of time on strings\n// that have less than 20 ASCII characters\n\n// https://rosettacode.org/wiki/Levenshtein_distance#ES5\nfunction levenshtein(a: string, b: string): number {\n let t = [],\n u: number[] = [],\n i,\n j;\n const m = a.length,\n n = b.length;\n if (!m) {\n return n;\n }\n if (!n) {\n return m;\n }\n for (j = 0; j <= n; j++) {\n t[j] = j;\n }\n for (i = 1; i <= m; i++) {\n for (u = [i], j = 1; j <= n; j++) {\n u[j] =\n a[i - 1] === b[j - 1] ? t[j - 1] : min(t[j - 1], t[j], u[j - 1]) + 1;\n }\n t = u;\n }\n return u[n];\n}\n\n/**\n * Given a string `str` and an array of candidates `arr`,\n * return the first of elements in candidates that has minimal\n * Levenshtein distance with `str`.\n * @export\n * @param {string} str\n * @param {string[]} arr\n * @returns {string}\n */\nexport function findSuggestion(str: string, arr: readonly string[]): string {\n const distances = arr.map<number>(el => levenshtein(el, str));\n return arr[distances.indexOf(min(...distances))];\n}\n"],"mappings":";;;;;;AAAA,MAAM;EAAEA;AAAI,CAAC,GAAGC,IAAI;AASpB,SAASC,WAAW,CAACC,CAAS,EAAEC,CAAS,EAAU;EACjD,IAAIC,CAAC,GAAG,EAAE;IACRC,CAAW,GAAG,EAAE;IAChBC,CAAC;IACDC,CAAC;EACH,MAAMC,CAAC,GAAGN,CAAC,CAACO,MAAM;IAChBC,CAAC,GAAGP,CAAC,CAACM,MAAM;EACd,IAAI,CAACD,CAAC,EAAE;IACN,OAAOE,CAAC;EACV;EACA,IAAI,CAACA,CAAC,EAAE;IACN,OAAOF,CAAC;EACV;EACA,KAAKD,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAIG,CAAC,EAAEH,CAAC,EAAE,EAAE;IACvBH,CAAC,CAACG,CAAC,CAAC,GAAGA,CAAC;EACV;EACA,KAAKD,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAIE,CAAC,EAAEF,CAAC,EAAE,EAAE;IACvB,KAAKD,CAAC,GAAG,CAACC,CAAC,CAAC,EAAEC,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAIG,CAAC,EAAEH,CAAC,EAAE,EAAE;MAChCF,CAAC,CAACE,CAAC,CAAC,GACFL,CAAC,CAACI,CAAC,GAAG,CAAC,CAAC,KAAKH,CAAC,CAACI,CAAC,GAAG,CAAC,CAAC,GAAGH,CAAC,CAACG,CAAC,GAAG,CAAC,CAAC,GAAGR,GAAG,CAACK,CAAC,CAACG,CAAC,GAAG,CAAC,CAAC,EAAEH,CAAC,CAACG,CAAC,CAAC,EAAEF,CAAC,CAACE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACxE;IACAH,CAAC,GAAGC,CAAC;EACP;EACA,OAAOA,CAAC,CAACK,CAAC,CAAC;AACb;AAWO,SAASC,cAAc,CAACC,GAAW,EAAEC,GAAsB,EAAU;EAC1E,MAAMC,SAAS,GAAGD,GAAG,CAACE,GAAG,CAASC,EAAE,IAAIf,WAAW,CAACe,EAAE,EAAEJ,GAAG,CAAC,CAAC;EAC7D,OAAOC,GAAG,CAACC,SAAS,CAACG,OAAO,CAAClB,GAAG,CAAC,GAAGe,SAAS,CAAC,CAAC,CAAC;AAClD"} {"version":3,"names":["min","Math","levenshtein","a","b","t","u","i","j","m","length","n","findSuggestion","str","arr","distances","map","el","indexOf"],"sources":["../src/find-suggestion.ts"],"sourcesContent":["const { min } = Math;\n\n// a minimal leven distance implementation\n// balanced maintainability with code size\n// It is not blazingly fast but should be okay for Babel user case\n// where it will be run for at most tens of time on strings\n// that have less than 20 ASCII characters\n\n// https://rosettacode.org/wiki/Levenshtein_distance#ES5\nfunction levenshtein(a: string, b: string): number {\n let t = [],\n u: number[] = [],\n i,\n j;\n const m = a.length,\n n = b.length;\n if (!m) {\n return n;\n }\n if (!n) {\n return m;\n }\n for (j = 0; j <= n; j++) {\n t[j] = j;\n }\n for (i = 1; i <= m; i++) {\n for (u = [i], j = 1; j <= n; j++) {\n u[j] =\n a[i - 1] === b[j - 1] ? t[j - 1] : min(t[j - 1], t[j], u[j - 1]) + 1;\n }\n t = u;\n }\n return u[n];\n}\n\n/**\n * Given a string `str` and an array of candidates `arr`,\n * return the first of elements in candidates that has minimal\n * Levenshtein distance with `str`.\n * @export\n * @param {string} str\n * @param {string[]} arr\n * @returns {string}\n */\nexport function findSuggestion(str: string, arr: readonly string[]): string {\n const distances = arr.map<number>(el => levenshtein(el, str));\n return arr[distances.indexOf(min(...distances))];\n}\n"],"mappings":";;;;;;AAAA,MAAM;EAAEA;AAAI,CAAC,GAAGC,IAAI;AASpB,SAASC,WAAWA,CAACC,CAAS,EAAEC,CAAS,EAAU;EACjD,IAAIC,CAAC,GAAG,EAAE;IACRC,CAAW,GAAG,EAAE;IAChBC,CAAC;IACDC,CAAC;EACH,MAAMC,CAAC,GAAGN,CAAC,CAACO,MAAM;IAChBC,CAAC,GAAGP,CAAC,CAACM,MAAM;EACd,IAAI,CAACD,CAAC,EAAE;IACN,OAAOE,CAAC;EACV;EACA,IAAI,CAACA,CAAC,EAAE;IACN,OAAOF,CAAC;EACV;EACA,KAAKD,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAIG,CAAC,EAAEH,CAAC,EAAE,EAAE;IACvBH,CAAC,CAACG,CAAC,CAAC,GAAGA,CAAC;EACV;EACA,KAAKD,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAIE,CAAC,EAAEF,CAAC,EAAE,EAAE;IACvB,KAAKD,CAAC,GAAG,CAACC,CAAC,CAAC,EAAEC,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAIG,CAAC,EAAEH,CAAC,EAAE,EAAE;MAChCF,CAAC,CAACE,CAAC,CAAC,GACFL,CAAC,CAACI,CAAC,GAAG,CAAC,CAAC,KAAKH,CAAC,CAACI,CAAC,GAAG,CAAC,CAAC,GAAGH,CAAC,CAACG,CAAC,GAAG,CAAC,CAAC,GAAGR,GAAG,CAACK,CAAC,CAACG,CAAC,GAAG,CAAC,CAAC,EAAEH,CAAC,CAACG,CAAC,CAAC,EAAEF,CAAC,CAACE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACxE;IACAH,CAAC,GAAGC,CAAC;EACP;EACA,OAAOA,CAAC,CAACK,CAAC,CAAC;AACb;AAWO,SAASC,cAAcA,CAACC,GAAW,EAAEC,GAAsB,EAAU;EAC1E,MAAMC,SAAS,GAAGD,GAAG,CAACE,GAAG,CAASC,EAAE,IAAIf,WAAW,CAACe,EAAE,EAAEJ,GAAG,CAAC,CAAC;EAC7D,OAAOC,GAAG,CAACC,SAAS,CAACG,OAAO,CAAClB,GAAG,CAAC,GAAGe,SAAS,CAAC,CAAC,CAAC;AAClD"}

@ -1 +1 @@
{"version":3,"names":[],"sources":["../src/index.ts"],"sourcesContent":["export { OptionValidator } from \"./validator\";\nexport { findSuggestion } from \"./find-suggestion\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA"} {"version":3,"names":["_validator","require","_findSuggestion"],"sources":["../src/index.ts"],"sourcesContent":["export { OptionValidator } from \"./validator\";\nexport { findSuggestion } from \"./find-suggestion\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA"}

@ -1 +1 @@
{"version":3,"names":["OptionValidator","constructor","descriptor","validateTopLevelOptions","options","TopLevelOptionShape","validOptionNames","Object","keys","option","includes","Error","formatMessage","findSuggestion","validateBooleanOption","name","value","defaultValue","undefined","invariant","validateStringOption","condition","message"],"sources":["../src/validator.ts"],"sourcesContent":["import { findSuggestion } from \"./find-suggestion\";\n\nexport class OptionValidator {\n declare descriptor: string;\n constructor(descriptor: string) {\n this.descriptor = descriptor;\n }\n\n /**\n * Validate if the given `options` follow the name of keys defined in the `TopLevelOptionShape`\n *\n * @param {Object} options\n * @param {Object} TopLevelOptionShape\n * An object with all the valid key names that `options` should be allowed to have\n * The property values of `TopLevelOptionShape` can be arbitrary\n * @memberof OptionValidator\n */\n validateTopLevelOptions(options: Object, TopLevelOptionShape: Object): void {\n const validOptionNames = Object.keys(TopLevelOptionShape);\n for (const option of Object.keys(options)) {\n if (!validOptionNames.includes(option)) {\n throw new Error(\n this.formatMessage(`'${option}' is not a valid top-level option.\n- Did you mean '${findSuggestion(option, validOptionNames)}'?`),\n );\n }\n }\n }\n\n // note: we do not consider rewrite them to high order functions\n // until we have to support `validateNumberOption`.\n validateBooleanOption<T>(\n name: string,\n value?: boolean,\n defaultValue?: T,\n ): boolean | T {\n if (value === undefined) {\n return defaultValue;\n } else {\n this.invariant(\n typeof value === \"boolean\",\n `'${name}' option must be a boolean.`,\n );\n }\n return value;\n }\n\n validateStringOption<T>(\n name: string,\n value?: string,\n defaultValue?: T,\n ): string | T {\n if (value === undefined) {\n return defaultValue;\n } else {\n this.invariant(\n typeof value === \"string\",\n `'${name}' option must be a string.`,\n );\n }\n return value;\n }\n /**\n * A helper interface copied from the `invariant` npm package.\n * It throws given `message` when `condition` is not met\n *\n * @param {boolean} condition\n * @param {string} message\n * @memberof OptionValidator\n */\n invariant(condition: boolean, message: string): void {\n if (!condition) {\n throw new Error(this.formatMessage(message));\n }\n }\n\n formatMessage(message: string): string {\n return `${this.descriptor}: ${message}`;\n }\n}\n"],"mappings":";;;;;;AAAA;AAEO,MAAMA,eAAe,CAAC;EAE3BC,WAAW,CAACC,UAAkB,EAAE;IAC9B,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;EAWAC,uBAAuB,CAACC,OAAe,EAAEC,mBAA2B,EAAQ;IAC1E,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,IAAI,CAACH,mBAAmB,CAAC;IACzD,KAAK,MAAMI,MAAM,IAAIF,MAAM,CAACC,IAAI,CAACJ,OAAO,CAAC,EAAE;MACzC,IAAI,CAACE,gBAAgB,CAACI,QAAQ,CAACD,MAAM,CAAC,EAAE;QACtC,MAAM,IAAIE,KAAK,CACb,IAAI,CAACC,aAAa,CAAE,IAAGH,MAAO;AACxC,kBAAkB,IAAAI,8BAAc,EAACJ,MAAM,EAAEH,gBAAgB,CAAE,IAAG,CAAC,CACtD;MACH;IACF;EACF;EAIAQ,qBAAqB,CACnBC,IAAY,EACZC,KAAe,EACfC,YAAgB,EACH;IACb,IAAID,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAOD,YAAY;IACrB,CAAC,MAAM;MACL,IAAI,CAACE,SAAS,CACZ,OAAOH,KAAK,KAAK,SAAS,EACzB,IAAGD,IAAK,6BAA4B,CACtC;IACH;IACA,OAAOC,KAAK;EACd;EAEAI,oBAAoB,CAClBL,IAAY,EACZC,KAAc,EACdC,YAAgB,EACJ;IACZ,IAAID,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAOD,YAAY;IACrB,CAAC,MAAM;MACL,IAAI,CAACE,SAAS,CACZ,OAAOH,KAAK,KAAK,QAAQ,EACxB,IAAGD,IAAK,4BAA2B,CACrC;IACH;IACA,OAAOC,KAAK;EACd;EASAG,SAAS,CAACE,SAAkB,EAAEC,OAAe,EAAQ;IACnD,IAAI,CAACD,SAAS,EAAE;MACd,MAAM,IAAIV,KAAK,CAAC,IAAI,CAACC,aAAa,CAACU,OAAO,CAAC,CAAC;IAC9C;EACF;EAEAV,aAAa,CAACU,OAAe,EAAU;IACrC,OAAQ,GAAE,IAAI,CAACpB,UAAW,KAAIoB,OAAQ,EAAC;EACzC;AACF;AAAC"} {"version":3,"names":["_findSuggestion","require","OptionValidator","constructor","descriptor","validateTopLevelOptions","options","TopLevelOptionShape","validOptionNames","Object","keys","option","includes","Error","formatMessage","findSuggestion","validateBooleanOption","name","value","defaultValue","undefined","invariant","validateStringOption","condition","message","exports"],"sources":["../src/validator.ts"],"sourcesContent":["import { findSuggestion } from \"./find-suggestion\";\n\nexport class OptionValidator {\n declare descriptor: string;\n constructor(descriptor: string) {\n this.descriptor = descriptor;\n }\n\n /**\n * Validate if the given `options` follow the name of keys defined in the `TopLevelOptionShape`\n *\n * @param {Object} options\n * @param {Object} TopLevelOptionShape\n * An object with all the valid key names that `options` should be allowed to have\n * The property values of `TopLevelOptionShape` can be arbitrary\n * @memberof OptionValidator\n */\n validateTopLevelOptions(options: Object, TopLevelOptionShape: Object): void {\n const validOptionNames = Object.keys(TopLevelOptionShape);\n for (const option of Object.keys(options)) {\n if (!validOptionNames.includes(option)) {\n throw new Error(\n this.formatMessage(`'${option}' is not a valid top-level option.\n- Did you mean '${findSuggestion(option, validOptionNames)}'?`),\n );\n }\n }\n }\n\n // note: we do not consider rewrite them to high order functions\n // until we have to support `validateNumberOption`.\n validateBooleanOption<T>(\n name: string,\n value?: boolean,\n defaultValue?: T,\n ): boolean | T {\n if (value === undefined) {\n return defaultValue;\n } else {\n this.invariant(\n typeof value === \"boolean\",\n `'${name}' option must be a boolean.`,\n );\n }\n return value;\n }\n\n validateStringOption<T>(\n name: string,\n value?: string,\n defaultValue?: T,\n ): string | T {\n if (value === undefined) {\n return defaultValue;\n } else {\n this.invariant(\n typeof value === \"string\",\n `'${name}' option must be a string.`,\n );\n }\n return value;\n }\n /**\n * A helper interface copied from the `invariant` npm package.\n * It throws given `message` when `condition` is not met\n *\n * @param {boolean} condition\n * @param {string} message\n * @memberof OptionValidator\n */\n invariant(condition: boolean, message: string): void {\n if (!condition) {\n throw new Error(this.formatMessage(message));\n }\n }\n\n formatMessage(message: string): string {\n return `${this.descriptor}: ${message}`;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEO,MAAMC,eAAe,CAAC;EAE3BC,WAAWA,CAACC,UAAkB,EAAE;IAC9B,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;EAWAC,uBAAuBA,CAACC,OAAe,EAAEC,mBAA2B,EAAQ;IAC1E,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,IAAI,CAACH,mBAAmB,CAAC;IACzD,KAAK,MAAMI,MAAM,IAAIF,MAAM,CAACC,IAAI,CAACJ,OAAO,CAAC,EAAE;MACzC,IAAI,CAACE,gBAAgB,CAACI,QAAQ,CAACD,MAAM,CAAC,EAAE;QACtC,MAAM,IAAIE,KAAK,CACb,IAAI,CAACC,aAAa,CAAE,IAAGH,MAAO;AACxC,kBAAkB,IAAAI,8BAAc,EAACJ,MAAM,EAAEH,gBAAgB,CAAE,IAAG,CACtD,CAAC;MACH;IACF;EACF;EAIAQ,qBAAqBA,CACnBC,IAAY,EACZC,KAAe,EACfC,YAAgB,EACH;IACb,IAAID,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAOD,YAAY;IACrB,CAAC,MAAM;MACL,IAAI,CAACE,SAAS,CACZ,OAAOH,KAAK,KAAK,SAAS,EACzB,IAAGD,IAAK,6BACX,CAAC;IACH;IACA,OAAOC,KAAK;EACd;EAEAI,oBAAoBA,CAClBL,IAAY,EACZC,KAAc,EACdC,YAAgB,EACJ;IACZ,IAAID,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAOD,YAAY;IACrB,CAAC,MAAM;MACL,IAAI,CAACE,SAAS,CACZ,OAAOH,KAAK,KAAK,QAAQ,EACxB,IAAGD,IAAK,4BACX,CAAC;IACH;IACA,OAAOC,KAAK;EACd;EASAG,SAASA,CAACE,SAAkB,EAAEC,OAAe,EAAQ;IACnD,IAAI,CAACD,SAAS,EAAE;MACd,MAAM,IAAIV,KAAK,CAAC,IAAI,CAACC,aAAa,CAACU,OAAO,CAAC,CAAC;IAC9C;EACF;EAEAV,aAAaA,CAACU,OAAe,EAAU;IACrC,OAAQ,GAAE,IAAI,CAACpB,UAAW,KAAIoB,OAAQ,EAAC;EACzC;AACF;AAACC,OAAA,CAAAvB,eAAA,GAAAA,eAAA"}

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-validator-option", "name": "@babel/helper-validator-option",
"version": "7.21.0", "version": "7.22.5",
"description": "Validate plugin/preset options", "description": "Validate plugin/preset options",
"repository": { "repository": {
"type": "git", "type": "git",

@ -46,10 +46,8 @@ function classOrObjectMethod(path, callId) {
const body = node.body; const body = node.body;
const container = functionExpression(null, [], blockStatement(body.body), true); const container = functionExpression(null, [], blockStatement(body.body), true);
body.body = [returnStatement(callExpression(callExpression(callId, [container]), []))]; body.body = [returnStatement(callExpression(callExpression(callId, [container]), []))];
node.async = false; node.async = false;
node.generator = false; node.generator = false;
path.get("body.body.0.argument.callee.arguments.0").unwrapFunctionEnvironment(); path.get("body.body.0.argument.callee.arguments.0").unwrapFunctionEnvironment();
} }
function plainFunction(inPath, callId, noNewArrows, ignoreFunctionLength) { function plainFunction(inPath, callId, noNewArrows, ignoreFunctionLength) {
@ -114,8 +112,7 @@ function plainFunction(inPath, callId, noNewArrows, ignoreFunctionLength) {
} }
} }
} }
function wrapFunction(path, callId, function wrapFunction(path, callId, noNewArrows = true, ignoreFunctionLength = false) {
noNewArrows = true, ignoreFunctionLength = false) {
if (path.isMethod()) { if (path.isMethod()) {
classOrObjectMethod(path, callId); classOrObjectMethod(path, callId);
} else { } else {

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-wrap-function", "name": "@babel/helper-wrap-function",
"version": "7.20.5", "version": "7.22.5",
"description": "Helper to wrap functions inside a function call.", "description": "Helper to wrap functions inside a function call.",
"repository": { "repository": {
"type": "git", "type": "git",
@ -14,10 +14,10 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-function-name": "^7.19.0", "@babel/helper-function-name": "^7.22.5",
"@babel/template": "^7.18.10", "@babel/template": "^7.22.5",
"@babel/traverse": "^7.20.5", "@babel/traverse": "^7.22.5",
"@babel/types": "^7.20.5" "@babel/types": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -1,6 +1,6 @@
{ {
"name": "@babel/helpers", "name": "@babel/helpers",
"version": "7.22.3", "version": "7.22.5",
"description": "Collection of helper functions used by Babel transforms.", "description": "Collection of helper functions used by Babel transforms.",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-helpers", "homepage": "https://babel.dev/docs/en/next/babel-helpers",
@ -15,14 +15,14 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/template": "^7.21.9", "@babel/template": "^7.22.5",
"@babel/traverse": "^7.22.1", "@babel/traverse": "^7.22.5",
"@babel/types": "^7.22.3" "@babel/types": "^7.22.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/generator": "^7.22.3", "@babel/generator": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.18.6", "@babel/helper-plugin-test-runner": "^7.22.5",
"@babel/parser": "^7.22.3", "@babel/parser": "^7.22.5",
"regenerator-runtime": "^0.13.11", "regenerator-runtime": "^0.13.11",
"terser": "^5.9.0" "terser": "^5.9.0"
}, },

@ -6,14 +6,13 @@ import { createRequire } from "module";
const [parse, generate] = await Promise.all([ const [parse, generate] = await Promise.all([
import("@babel/parser").then(ns => ns.parse), import("@babel/parser").then(ns => ns.parse),
import("@babel/generator").then(ns => ns.default.default || ns.default), import("@babel/generator").then(ns => ns.default.default || ns.default),
]).catch(error => ]).catch(error => {
Promise.reject( console.error(error);
new Error( throw new Error(
"Before running generate-helpers.js you must compile @babel/parser and @babel/generator.", "Before running generate-helpers.js you must compile @babel/parser and @babel/generator.",
{ cause: error } { cause: error }
) );
) });
);
const REGENERATOR_RUNTIME_IN_FILE = fs.readFileSync( const REGENERATOR_RUNTIME_IN_FILE = fs.readFileSync(
createRequire(import.meta.url).resolve("regenerator-runtime"), createRequire(import.meta.url).resolve("regenerator-runtime"),

@ -6,15 +6,10 @@ Object.defineProperty(exports, "__esModule", {
exports.default = highlight; exports.default = highlight;
exports.getChalk = getChalk; exports.getChalk = getChalk;
exports.shouldHighlight = shouldHighlight; exports.shouldHighlight = shouldHighlight;
var _jsTokens = require("js-tokens"); var _jsTokens = require("js-tokens");
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier"); var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
var _chalk = require("chalk"); var _chalk = require("chalk");
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]); const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
function getDefs(chalk) { function getDefs(chalk) {
return { return {
keyword: chalk.cyan, keyword: chalk.cyan,
@ -28,45 +23,35 @@ function getDefs(chalk) {
invalid: chalk.white.bgRed.bold invalid: chalk.white.bgRed.bold
}; };
} }
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
const BRACKET = /^[()[\]{}]$/; const BRACKET = /^[()[\]{}]$/;
let tokenize; let tokenize;
{ {
const JSX_TAG = /^[a-z][\w-]*$/i; const JSX_TAG = /^[a-z][\w-]*$/i;
const getTokenType = function (token, offset, text) { const getTokenType = function (token, offset, text) {
if (token.type === "name") { if (token.type === "name") {
if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) { if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
return "keyword"; return "keyword";
} }
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == "</")) { if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == "</")) {
return "jsxIdentifier"; return "jsxIdentifier";
} }
if (token.value[0] !== token.value[0].toLowerCase()) { if (token.value[0] !== token.value[0].toLowerCase()) {
return "capitalized"; return "capitalized";
} }
} }
if (token.type === "punctuator" && BRACKET.test(token.value)) { if (token.type === "punctuator" && BRACKET.test(token.value)) {
return "bracket"; return "bracket";
} }
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) { if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
return "punctuator"; return "punctuator";
} }
return token.type; return token.type;
}; };
tokenize = function* (text) { tokenize = function* (text) {
let match; let match;
while (match = _jsTokens.default.exec(text)) { while (match = _jsTokens.default.exec(text)) {
const token = _jsTokens.matchToToken(match); const token = _jsTokens.matchToToken(match);
yield { yield {
type: getTokenType(token, match.index, text), type: getTokenType(token, match.index, text),
value: token.value value: token.value
@ -74,37 +59,30 @@ let tokenize;
} }
}; };
} }
function highlightTokens(defs, text) { function highlightTokens(defs, text) {
let highlighted = ""; let highlighted = "";
for (const { for (const {
type, type,
value value
} of tokenize(text)) { } of tokenize(text)) {
const colorize = defs[type]; const colorize = defs[type];
if (colorize) { if (colorize) {
highlighted += value.split(NEWLINE).map(str => colorize(str)).join("\n"); highlighted += value.split(NEWLINE).map(str => colorize(str)).join("\n");
} else { } else {
highlighted += value; highlighted += value;
} }
} }
return highlighted; return highlighted;
} }
function shouldHighlight(options) { function shouldHighlight(options) {
return !!_chalk.supportsColor || options.forceColor; return !!_chalk.supportsColor || options.forceColor;
} }
function getChalk(options) { function getChalk(options) {
return options.forceColor ? new _chalk.constructor({ return options.forceColor ? new _chalk.constructor({
enabled: true, enabled: true,
level: 1 level: 1
}) : _chalk; }) : _chalk;
} }
function highlight(code, options = {}) { function highlight(code, options = {}) {
if (code !== "" && shouldHighlight(options)) { if (code !== "" && shouldHighlight(options)) {
const chalk = getChalk(options); const chalk = getChalk(options);
@ -114,3 +92,5 @@ function highlight(code, options = {}) {
return code; return code;
} }
} }
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@babel/highlight", "name": "@babel/highlight",
"version": "7.18.6", "version": "7.22.5",
"description": "Syntax highlight JavaScript strings for output in terminals.", "description": "Syntax highlight JavaScript strings for output in terminals.",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-highlight", "homepage": "https://babel.dev/docs/en/next/babel-highlight",
@ -15,7 +15,7 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-validator-identifier": "^7.18.6", "@babel/helper-validator-identifier": "^7.22.5",
"chalk": "^2.0.0", "chalk": "^2.0.0",
"js-tokens": "^4.0.0" "js-tokens": "^4.0.0"
}, },

@ -1,6 +1,6 @@
{ {
"name": "@babel/parser", "name": "@babel/parser",
"version": "7.22.4", "version": "7.22.5",
"description": "A JavaScript parser", "description": "A JavaScript parser",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-parser", "homepage": "https://babel.dev/docs/en/next/babel-parser",
@ -34,11 +34,11 @@
"node": ">=6.0.0" "node": ">=6.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/code-frame": "^7.21.4", "@babel/code-frame": "^7.22.5",
"@babel/helper-check-duplicate-nodes": "^7.18.6", "@babel/helper-check-duplicate-nodes": "^7.22.5",
"@babel/helper-fixtures": "^7.21.5", "@babel/helper-fixtures": "^7.22.5",
"@babel/helper-string-parser": "^7.21.5", "@babel/helper-string-parser": "^7.22.5",
"@babel/helper-validator-identifier": "^7.19.1", "@babel/helper-validator-identifier": "^7.22.5",
"charcodes": "^0.2.0" "charcodes": "^0.2.0"
}, },
"bin": "./bin/babel-parser.js", "bin": "./bin/babel-parser.js",

@ -12,19 +12,15 @@ function shouldTransform(path) {
if (!functionId) return false; if (!functionId) return false;
const name = functionId.name; const name = functionId.name;
const paramNameBinding = path.scope.getOwnBinding(name); const paramNameBinding = path.scope.getOwnBinding(name);
if (paramNameBinding === undefined) { if (paramNameBinding === undefined) {
return false; return false;
} }
if (paramNameBinding.kind !== "param") { if (paramNameBinding.kind !== "param") {
return false; return false;
} }
if (paramNameBinding.identifier === paramNameBinding.path.node) { if (paramNameBinding.identifier === paramNameBinding.path.node) {
return false; return false;
} }
return name; return name;
} }
@ -35,7 +31,6 @@ var index = helperPluginUtils.declare(api => {
visitor: { visitor: {
FunctionExpression(path) { FunctionExpression(path) {
const name = shouldTransform(path); const name = shouldTransform(path);
if (name) { if (name) {
const { const {
scope scope
@ -44,7 +39,6 @@ var index = helperPluginUtils.declare(api => {
scope.rename(name, newParamName); scope.rename(name, newParamName);
} }
} }
} }
}; };
}); });

@ -1 +1 @@
{"version":3,"file":"index.js","sources":["../src/util.ts","../src/index.ts"],"sourcesContent":["import type { FunctionExpression } from \"@babel/types\";\nimport type { NodePath } from \"@babel/traverse\";\n\n/**\n * Check whether a function expression can be affected by\n * https://bugs.webkit.org/show_bug.cgi?id=220517\n * @param path The function expression NodePath\n * @returns the name of function id if it should be transformed, otherwise returns false\n */\nexport function shouldTransform(\n path: NodePath<FunctionExpression>,\n): string | false {\n const { node } = path;\n const functionId = node.id;\n if (!functionId) return false;\n\n const name = functionId.name;\n // On collision, `getOwnBinding` returns the param binding\n // with the id binding be registered as constant violation\n const paramNameBinding = path.scope.getOwnBinding(name);\n if (paramNameBinding === undefined) {\n // Case 1: the function id is injected by babel-helper-name-function, which\n // assigns `NOT_LOCAL_BINDING` to the `functionId` and thus not registering id\n // in scope tracking\n // Case 2: the function id is injected by a third party plugin which does not update the\n // scope info\n return false;\n }\n if (paramNameBinding.kind !== \"param\") {\n // the function id does not reproduce in params\n return false;\n }\n\n if (paramNameBinding.identifier === paramNameBinding.path.node) {\n // the param binding is a simple parameter\n // e.g. (function a(a) {})\n return false;\n }\n\n return name;\n}\n","import { declare } from \"@babel/helper-plugin-utils\";\nimport { shouldTransform } from \"./util\";\n\nexport default declare(api => {\n api.assertVersion(\"^7.16.0\");\n\n return {\n name: \"plugin-bugfix-safari-id-destructuring-collision-in-function-expression\",\n\n visitor: {\n FunctionExpression(path) {\n const name = shouldTransform(path);\n if (name) {\n // Now we have (function a([a]) {})\n const { scope } = path;\n // invariant: path.node.id is always an Identifier here\n const newParamName = scope.generateUid(name);\n scope.rename(name, newParamName);\n }\n },\n },\n };\n});\n"],"names":["shouldTransform","path","node","functionId","id","name","paramNameBinding","scope","getOwnBinding","undefined","kind","identifier","declare","api","assertVersion","visitor","FunctionExpression","newParamName","generateUid","rename"],"mappings":";;;;;;AASO,SAASA,eAAT,CACLC,IADK,EAEW;EAChB,MAAM;AAAEC,IAAAA,IAAAA;AAAF,GAAA,GAAWD,IAAjB,CAAA;AACA,EAAA,MAAME,UAAU,GAAGD,IAAI,CAACE,EAAxB,CAAA;AACA,EAAA,IAAI,CAACD,UAAL,EAAiB,OAAO,KAAP,CAAA;AAEjB,EAAA,MAAME,IAAI,GAAGF,UAAU,CAACE,IAAxB,CAAA;EAGA,MAAMC,gBAAgB,GAAGL,IAAI,CAACM,KAAL,CAAWC,aAAX,CAAyBH,IAAzB,CAAzB,CAAA;;EACA,IAAIC,gBAAgB,KAAKG,SAAzB,EAAoC;AAMlC,IAAA,OAAO,KAAP,CAAA;AACD,GAAA;;AACD,EAAA,IAAIH,gBAAgB,CAACI,IAAjB,KAA0B,OAA9B,EAAuC;AAErC,IAAA,OAAO,KAAP,CAAA;AACD,GAAA;;EAED,IAAIJ,gBAAgB,CAACK,UAAjB,KAAgCL,gBAAgB,CAACL,IAAjB,CAAsBC,IAA1D,EAAgE;AAG9D,IAAA,OAAO,KAAP,CAAA;AACD,GAAA;;AAED,EAAA,OAAOG,IAAP,CAAA;AACD;;ACrCD,YAAeO,yBAAO,CAACC,GAAG,IAAI;EAC5BA,GAAG,CAACC,aAAJ,CAAkB,SAAlB,CAAA,CAAA;EAEA,OAAO;AACLT,IAAAA,IAAI,EAAE,wEADD;AAGLU,IAAAA,OAAO,EAAE;MACPC,kBAAkB,CAACf,IAAD,EAAO;AACvB,QAAA,MAAMI,IAAI,GAAGL,eAAe,CAACC,IAAD,CAA5B,CAAA;;AACA,QAAA,IAAII,IAAJ,EAAU;UAER,MAAM;AAAEE,YAAAA,KAAAA;AAAF,WAAA,GAAYN,IAAlB,CAAA;AAEA,UAAA,MAAMgB,YAAY,GAAGV,KAAK,CAACW,WAAN,CAAkBb,IAAlB,CAArB,CAAA;AACAE,UAAAA,KAAK,CAACY,MAAN,CAAad,IAAb,EAAmBY,YAAnB,CAAA,CAAA;AACD,SAAA;AACF,OAAA;;AAVM,KAAA;GAHX,CAAA;AAgBD,CAnBqB,CAAtB;;;;"} {"version":3,"file":"index.js","sources":["../src/util.ts","../src/index.ts"],"sourcesContent":["import type { FunctionExpression } from \"@babel/types\";\nimport type { NodePath } from \"@babel/traverse\";\n\n/**\n * Check whether a function expression can be affected by\n * https://bugs.webkit.org/show_bug.cgi?id=220517\n * @param path The function expression NodePath\n * @returns the name of function id if it should be transformed, otherwise returns false\n */\nexport function shouldTransform(\n path: NodePath<FunctionExpression>,\n): string | false {\n const { node } = path;\n const functionId = node.id;\n if (!functionId) return false;\n\n const name = functionId.name;\n // On collision, `getOwnBinding` returns the param binding\n // with the id binding be registered as constant violation\n const paramNameBinding = path.scope.getOwnBinding(name);\n if (paramNameBinding === undefined) {\n // Case 1: the function id is injected by babel-helper-name-function, which\n // assigns `NOT_LOCAL_BINDING` to the `functionId` and thus not registering id\n // in scope tracking\n // Case 2: the function id is injected by a third party plugin which does not update the\n // scope info\n return false;\n }\n if (paramNameBinding.kind !== \"param\") {\n // the function id does not reproduce in params\n return false;\n }\n\n if (paramNameBinding.identifier === paramNameBinding.path.node) {\n // the param binding is a simple parameter\n // e.g. (function a(a) {})\n return false;\n }\n\n return name;\n}\n","import { declare } from \"@babel/helper-plugin-utils\";\nimport { shouldTransform } from \"./util\";\n\nexport default declare(api => {\n api.assertVersion(\"^7.16.0\");\n\n return {\n name: \"plugin-bugfix-safari-id-destructuring-collision-in-function-expression\",\n\n visitor: {\n FunctionExpression(path) {\n const name = shouldTransform(path);\n if (name) {\n // Now we have (function a([a]) {})\n const { scope } = path;\n // invariant: path.node.id is always an Identifier here\n const newParamName = scope.generateUid(name);\n scope.rename(name, newParamName);\n }\n },\n },\n };\n});\n"],"names":["shouldTransform","path","node","functionId","id","name","paramNameBinding","scope","getOwnBinding","undefined","kind","identifier","declare","api","assertVersion","visitor","FunctionExpression","newParamName","generateUid","rename"],"mappings":";;;;;;AASO,SAASA,eAAeA,CAC7BC,IAAkC,EAClB;EAChB,MAAM;AAAEC,IAAAA,IAAAA;AAAK,GAAC,GAAGD,IAAI,CAAA;AACrB,EAAA,MAAME,UAAU,GAAGD,IAAI,CAACE,EAAE,CAAA;AAC1B,EAAA,IAAI,CAACD,UAAU,EAAE,OAAO,KAAK,CAAA;AAE7B,EAAA,MAAME,IAAI,GAAGF,UAAU,CAACE,IAAI,CAAA;EAG5B,MAAMC,gBAAgB,GAAGL,IAAI,CAACM,KAAK,CAACC,aAAa,CAACH,IAAI,CAAC,CAAA;EACvD,IAAIC,gBAAgB,KAAKG,SAAS,EAAE;AAMlC,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AACA,EAAA,IAAIH,gBAAgB,CAACI,IAAI,KAAK,OAAO,EAAE;AAErC,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;EAEA,IAAIJ,gBAAgB,CAACK,UAAU,KAAKL,gBAAgB,CAACL,IAAI,CAACC,IAAI,EAAE;AAG9D,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,OAAOG,IAAI,CAAA;AACb;;ACrCA,YAAeO,yBAAO,CAACC,GAAG,IAAI;AAC5BA,EAAAA,GAAG,CAACC,aAAa,CAAC,SAAS,CAAC,CAAA;EAE5B,OAAO;AACLT,IAAAA,IAAI,EAAE,wEAAwE;AAE9EU,IAAAA,OAAO,EAAE;MACPC,kBAAkBA,CAACf,IAAI,EAAE;AACvB,QAAA,MAAMI,IAAI,GAAGL,eAAe,CAACC,IAAI,CAAC,CAAA;AAClC,QAAA,IAAII,IAAI,EAAE;UAER,MAAM;AAAEE,YAAAA,KAAAA;AAAM,WAAC,GAAGN,IAAI,CAAA;AAEtB,UAAA,MAAMgB,YAAY,GAAGV,KAAK,CAACW,WAAW,CAACb,IAAI,CAAC,CAAA;AAC5CE,UAAAA,KAAK,CAACY,MAAM,CAACd,IAAI,EAAEY,YAAY,CAAC,CAAA;AAClC,SAAA;AACF,OAAA;AACF,KAAA;GACD,CAAA;AACH,CAAC,CAAC;;;;"}

@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.shouldTransform = shouldTransform;
function shouldTransform(path) {
const {
node
} = path;
const functionId = node.id;
if (!functionId) return false;
const name = functionId.name;
const paramNameBinding = path.scope.getOwnBinding(name);
if (paramNameBinding === undefined) {
return false;
}
if (paramNameBinding.kind !== "param") {
return false;
}
if (paramNameBinding.identifier === paramNameBinding.path.node) {
return false;
}
return name;
}
//# sourceMappingURL=util.js.map

@ -0,0 +1 @@
{"version":3,"names":["shouldTransform","path","node","functionId","id","name","paramNameBinding","scope","getOwnBinding","undefined","kind","identifier"],"sources":["../src/util.ts"],"sourcesContent":["import type { FunctionExpression } from \"@babel/types\";\nimport type { NodePath } from \"@babel/traverse\";\n\n/**\n * Check whether a function expression can be affected by\n * https://bugs.webkit.org/show_bug.cgi?id=220517\n * @param path The function expression NodePath\n * @returns the name of function id if it should be transformed, otherwise returns false\n */\nexport function shouldTransform(\n path: NodePath<FunctionExpression>,\n): string | false {\n const { node } = path;\n const functionId = node.id;\n if (!functionId) return false;\n\n const name = functionId.name;\n // On collision, `getOwnBinding` returns the param binding\n // with the id binding be registered as constant violation\n const paramNameBinding = path.scope.getOwnBinding(name);\n if (paramNameBinding === undefined) {\n // Case 1: the function id is injected by babel-helper-name-function, which\n // assigns `NOT_LOCAL_BINDING` to the `functionId` and thus not registering id\n // in scope tracking\n // Case 2: the function id is injected by a third party plugin which does not update the\n // scope info\n return false;\n }\n if (paramNameBinding.kind !== \"param\") {\n // the function id does not reproduce in params\n return false;\n }\n\n if (paramNameBinding.identifier === paramNameBinding.path.node) {\n // the param binding is a simple parameter\n // e.g. (function a(a) {})\n return false;\n }\n\n return name;\n}\n"],"mappings":";;;;;;AASO,SAASA,eAAeA,CAC7BC,IAAkC,EAClB;EAChB,MAAM;IAAEC;EAAK,CAAC,GAAGD,IAAI;EACrB,MAAME,UAAU,GAAGD,IAAI,CAACE,EAAE;EAC1B,IAAI,CAACD,UAAU,EAAE,OAAO,KAAK;EAE7B,MAAME,IAAI,GAAGF,UAAU,CAACE,IAAI;EAG5B,MAAMC,gBAAgB,GAAGL,IAAI,CAACM,KAAK,CAACC,aAAa,CAACH,IAAI,CAAC;EACvD,IAAIC,gBAAgB,KAAKG,SAAS,EAAE;IAMlC,OAAO,KAAK;EACd;EACA,IAAIH,gBAAgB,CAACI,IAAI,KAAK,OAAO,EAAE;IAErC,OAAO,KAAK;EACd;EAEA,IAAIJ,gBAAgB,CAACK,UAAU,KAAKL,gBAAgB,CAACL,IAAI,CAACC,IAAI,EAAE;IAG9D,OAAO,KAAK;EACd;EAEA,OAAOG,IAAI;AACb"}

@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression", "name": "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression",
"version": "7.18.6", "version": "7.22.5",
"description": "Rename destructuring parameter to workaround https://bugs.webkit.org/show_bug.cgi?id=220517", "description": "Rename destructuring parameter to workaround https://bugs.webkit.org/show_bug.cgi?id=220517",
"repository": { "repository": {
"type": "git", "type": "git",
@ -22,16 +22,16 @@
"bugfix" "bugfix"
], ],
"dependencies": { "dependencies": {
"@babel/helper-plugin-utils": "^7.18.6" "@babel/helper-plugin-utils": "^7.22.5"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.18.6", "@babel/core": "^7.22.5",
"@babel/helper-function-name": "^7.18.6", "@babel/helper-function-name": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.18.6", "@babel/helper-plugin-test-runner": "^7.22.5",
"@babel/traverse": "^7.18.6" "@babel/traverse": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining", "name": "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining",
"version": "7.22.3", "version": "7.22.5",
"description": "Transform optional chaining operators to workaround https://crbug.com/v8/11558", "description": "Transform optional chaining operators to workaround https://crbug.com/v8/11558",
"repository": { "repository": {
"type": "git", "type": "git",
@ -22,17 +22,17 @@
"bugfix" "bugfix"
], ],
"dependencies": { "dependencies": {
"@babel/helper-plugin-utils": "^7.21.5", "@babel/helper-plugin-utils": "^7.22.5",
"@babel/helper-skip-transparent-expression-wrappers": "^7.20.0", "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5",
"@babel/plugin-transform-optional-chaining": "^7.22.3" "@babel/plugin-transform-optional-chaining": "^7.22.5"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.13.0" "@babel/core": "^7.13.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.1", "@babel/core": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.18.6", "@babel/helper-plugin-test-runner": "^7.22.5",
"@babel/traverse": "^7.22.1" "@babel/traverse": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-proposal-decorators", "name": "@babel/plugin-proposal-decorators",
"version": "7.22.3", "version": "7.22.5",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",
"publishConfig": { "publishConfig": {
@ -20,19 +20,19 @@
"decorators" "decorators"
], ],
"dependencies": { "dependencies": {
"@babel/helper-create-class-features-plugin": "^7.22.1", "@babel/helper-create-class-features-plugin": "^7.22.5",
"@babel/helper-plugin-utils": "^7.21.5", "@babel/helper-plugin-utils": "^7.22.5",
"@babel/helper-replace-supers": "^7.22.1", "@babel/helper-replace-supers": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.18.6", "@babel/helper-split-export-declaration": "^7.22.5",
"@babel/plugin-syntax-decorators": "^7.22.3" "@babel/plugin-syntax-decorators": "^7.22.5"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.1", "@babel/core": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.18.6", "@babel/helper-plugin-test-runner": "^7.22.5",
"@babel/traverse": "^7.22.1", "@babel/traverse": "^7.22.5",
"@types/charcodes": "^0.2.0", "@types/charcodes": "^0.2.0",
"array.prototype.concat": "^1.0.2", "array.prototype.concat": "^1.0.2",
"babel-plugin-polyfill-es-shims": "^0.9.0", "babel-plugin-polyfill-es-shims": "^0.9.0",

@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = void 0; exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils"); var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _pluginSyntaxExportDefaultFrom = require("@babel/plugin-syntax-export-default-from"); var _pluginSyntaxExportDefaultFrom = require("@babel/plugin-syntax-export-default-from");
var _core = require("@babel/core"); var _core = require("@babel/core");
var _default = (0, _helperPluginUtils.declare)(api => { var _default = (0, _helperPluginUtils.declare)(api => {
api.assertVersion(7); api.assertVersion(7);
return { return {
@ -29,23 +25,19 @@ var _default = (0, _helperPluginUtils.declare)(api => {
const { const {
exported exported
} = specifiers.shift(); } = specifiers.shift();
if (specifiers.every(s => _core.types.isExportSpecifier(s))) { if (specifiers.every(s => _core.types.isExportSpecifier(s))) {
specifiers.unshift(_core.types.exportSpecifier(_core.types.identifier("default"), exported)); specifiers.unshift(_core.types.exportSpecifier(_core.types.identifier("default"), exported));
return; return;
} }
const nodes = [_core.types.exportNamedDeclaration(null, [_core.types.exportSpecifier(_core.types.identifier("default"), exported)], _core.types.cloneNode(source))]; const nodes = [_core.types.exportNamedDeclaration(null, [_core.types.exportSpecifier(_core.types.identifier("default"), exported)], _core.types.cloneNode(source))];
if (specifiers.length >= 1) { if (specifiers.length >= 1) {
nodes.push(node); nodes.push(node);
} }
path.replaceWithMultiple(nodes); path.replaceWithMultiple(nodes);
} }
} }
}; };
}); });
exports.default = _default; exports.default = _default;
//# sourceMappingURL=index.js.map

@ -0,0 +1 @@
{"version":3,"names":["_helperPluginUtils","require","_pluginSyntaxExportDefaultFrom","_core","_default","declare","api","assertVersion","name","inherits","syntaxExportDefaultFrom","visitor","ExportNamedDeclaration","path","node","specifiers","source","t","isExportDefaultSpecifier","exported","shift","every","s","isExportSpecifier","unshift","exportSpecifier","identifier","nodes","exportNamedDeclaration","cloneNode","length","push","replaceWithMultiple","exports","default"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport syntaxExportDefaultFrom from \"@babel/plugin-syntax-export-default-from\";\nimport { types as t } from \"@babel/core\";\n\nexport default declare(api => {\n api.assertVersion(7);\n\n return {\n name: \"proposal-export-default-from\",\n inherits: syntaxExportDefaultFrom,\n\n visitor: {\n ExportNamedDeclaration(path) {\n const { node } = path;\n const { specifiers, source } = node;\n if (!t.isExportDefaultSpecifier(specifiers[0])) return;\n\n const { exported } = specifiers.shift();\n\n if (specifiers.every(s => t.isExportSpecifier(s))) {\n specifiers.unshift(\n t.exportSpecifier(t.identifier(\"default\"), exported),\n );\n return;\n }\n\n const nodes = [\n t.exportNamedDeclaration(\n null,\n [t.exportSpecifier(t.identifier(\"default\"), exported)],\n t.cloneNode(source),\n ),\n ];\n\n if (specifiers.length >= 1) {\n nodes.push(node);\n }\n\n path.replaceWithMultiple(nodes);\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAAyC,IAAAG,QAAA,GAE1B,IAAAC,0BAAO,EAACC,GAAG,IAAI;EAC5BA,GAAG,CAACC,aAAa,CAAC,CAAC,CAAC;EAEpB,OAAO;IACLC,IAAI,EAAE,8BAA8B;IACpCC,QAAQ,EAAEC,sCAAuB;IAEjCC,OAAO,EAAE;MACPC,sBAAsBA,CAACC,IAAI,EAAE;QAC3B,MAAM;UAAEC;QAAK,CAAC,GAAGD,IAAI;QACrB,MAAM;UAAEE,UAAU;UAAEC;QAAO,CAAC,GAAGF,IAAI;QACnC,IAAI,CAACG,WAAC,CAACC,wBAAwB,CAACH,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE;QAEhD,MAAM;UAAEI;QAAS,CAAC,GAAGJ,UAAU,CAACK,KAAK,CAAC,CAAC;QAEvC,IAAIL,UAAU,CAACM,KAAK,CAACC,CAAC,IAAIL,WAAC,CAACM,iBAAiB,CAACD,CAAC,CAAC,CAAC,EAAE;UACjDP,UAAU,CAACS,OAAO,CAChBP,WAAC,CAACQ,eAAe,CAACR,WAAC,CAACS,UAAU,CAAC,SAAS,CAAC,EAAEP,QAAQ,CACrD,CAAC;UACD;QACF;QAEA,MAAMQ,KAAK,GAAG,CACZV,WAAC,CAACW,sBAAsB,CACtB,IAAI,EACJ,CAACX,WAAC,CAACQ,eAAe,CAACR,WAAC,CAACS,UAAU,CAAC,SAAS,CAAC,EAAEP,QAAQ,CAAC,CAAC,EACtDF,WAAC,CAACY,SAAS,CAACb,MAAM,CACpB,CAAC,CACF;QAED,IAAID,UAAU,CAACe,MAAM,IAAI,CAAC,EAAE;UAC1BH,KAAK,CAACI,IAAI,CAACjB,IAAI,CAAC;QAClB;QAEAD,IAAI,CAACmB,mBAAmB,CAACL,KAAK,CAAC;MACjC;IACF;EACF,CAAC;AACH,CAAC,CAAC;AAAAM,OAAA,CAAAC,OAAA,GAAA9B,QAAA"}

@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-proposal-export-default-from", "name": "@babel/plugin-proposal-export-default-from",
"version": "7.18.10", "version": "7.22.5",
"description": "Compile export default to ES2015", "description": "Compile export default to ES2015",
"repository": { "repository": {
"type": "git", "type": "git",
@ -17,15 +17,15 @@
"babel-plugin" "babel-plugin"
], ],
"dependencies": { "dependencies": {
"@babel/helper-plugin-utils": "^7.18.9", "@babel/helper-plugin-utils": "^7.22.5",
"@babel/plugin-syntax-export-default-from": "^7.18.6" "@babel/plugin-syntax-export-default-from": "^7.22.5"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.18.10", "@babel/core": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.18.6" "@babel/helper-plugin-test-runner": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -1,5 +1,9 @@
# @babel/plugin-proposal-private-property-in-object # @babel/plugin-proposal-private-property-in-object
> ⚠️ This version of the package (`v7.21.0-placeholder-for-preset-env.1`) is not meant to
> be imported. Use any other version of this plugin or, even better, the
> [@babel/plugin-transform-private-property-in-object](https://babeljs.io/docs/en/babel-plugin-transform-private-property-in-object) package.
> This plugin transforms checks for a private property in an object > This plugin transforms checks for a private property in an object
See our website [@babel/plugin-proposal-private-property-in-object](https://babeljs.io/docs/en/babel-plugin-proposal-private-property-in-object) for more information. See our website [@babel/plugin-proposal-private-property-in-object](https://babeljs.io/docs/en/babel-plugin-proposal-private-property-in-object) for more information.

@ -1,128 +1,36 @@
"use strict"; maybeWarn: try {
var stackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = Infinity;
var stack = new Error().stack;
Error.stackTraceLimit = stackTraceLimit;
if (!stack.includes("babel-preset-react-app")) break maybeWarn;
Object.defineProperty(exports, "__esModule", { // Try this as a fallback, in case it's available in node_modules
value: true module.exports = require("@babel/plugin-transform-private-property-in-object");
});
exports.default = void 0; setTimeout(console.warn, 2500, `\
var _helperPluginUtils = require("@babel/helper-plugin-utils"); \x1B[0;33mOne of your dependencies, babel-preset-react-app, is importing the
var _pluginSyntaxPrivatePropertyInObject = require("@babel/plugin-syntax-private-property-in-object"); "@babel/plugin-proposal-private-property-in-object" package without
var _helperCreateClassFeaturesPlugin = require("@babel/helper-create-class-features-plugin"); declaring it in its dependencies. This is currently working because
var _helperAnnotateAsPure = require("@babel/helper-annotate-as-pure"); "@babel/plugin-proposal-private-property-in-object" is already in your
var _default = (0, _helperPluginUtils.declare)((api, opt) => { node_modules folder for unrelated reasons, but it \x1B[1mmay break at any time\x1B[0;33m.
api.assertVersion(7);
const { babel-preset-react-app is part of the create-react-app project, \x1B[1mwhich
types: t, is not maintianed anymore\x1B[0;33m. It is thus unlikely that this bug will
template ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
} = api; your devDependencies to work around this error. This will make this message
const { go away.\x1B[0m
loose
} = opt;
const classWeakSets = new WeakMap();
const fieldsWeakSets = new WeakMap();
function unshadow(name, targetScope, scope) {
while (scope !== targetScope) {
if (scope.hasOwnBinding(name)) scope.rename(name);
scope = scope.parent;
}
}
function injectToFieldInit(fieldPath, expr, before = false) {
if (fieldPath.node.value) {
const value = fieldPath.get("value");
if (before) {
value.insertBefore(expr);
} else {
value.insertAfter(expr);
}
} else {
fieldPath.set("value", t.unaryExpression("void", expr));
}
}
function injectInitialization(classPath, init) {
let firstFieldPath;
let constructorPath;
for (const el of classPath.get("body.body")) {
if ((el.isClassProperty() || el.isClassPrivateProperty()) && !el.node.static) {
firstFieldPath = el;
break;
}
if (!constructorPath && el.isClassMethod({
kind: "constructor"
})) {
constructorPath = el;
}
}
if (firstFieldPath) {
injectToFieldInit(firstFieldPath, init, true);
} else {
(0, _helperCreateClassFeaturesPlugin.injectInitialization)(classPath, constructorPath, [t.expressionStatement(init)]);
}
}
function getWeakSetId(weakSets, outerClass, reference, name = "", inject) {
let id = weakSets.get(reference.node);
if (!id) {
id = outerClass.scope.generateUidIdentifier(`${name || ""} brandCheck`);
weakSets.set(reference.node, id);
inject(reference, template.expression.ast`${t.cloneNode(id)}.add(this)`);
const newExpr = t.newExpression(t.identifier("WeakSet"), []);
(0, _helperAnnotateAsPure.default)(newExpr);
outerClass.insertBefore(template.ast`var ${id} = ${newExpr}`);
}
return t.cloneNode(id);
}
return {
name: "proposal-private-property-in-object",
inherits: _pluginSyntaxPrivatePropertyInObject.default,
pre() {
(0, _helperCreateClassFeaturesPlugin.enableFeature)(this.file, _helperCreateClassFeaturesPlugin.FEATURES.privateIn, loose);
},
visitor: {
BinaryExpression(path, state) {
const {
node
} = path;
const {
file
} = state;
if (node.operator !== "in") return;
if (!t.isPrivateName(node.left)) return;
const {
name
} = node.left.id;
let privateElement;
const outerClass = path.findParent(path => {
if (!path.isClass()) return false;
privateElement = path.get("body.body").find(({
node
}) => t.isPrivate(node) && node.key.id.name === name);
return !!privateElement;
});
if (outerClass.parentPath.scope.path.isPattern()) {
outerClass.replaceWith(template.ast`(() => ${outerClass.node})()`);
return;
}
if (privateElement.node.type === "ClassPrivateMethod") {
if (privateElement.node.static) {
if (outerClass.node.id) {
unshadow(outerClass.node.id.name, outerClass.scope, path.scope);
} else {
outerClass.set("id", path.scope.generateUidIdentifier("class"));
}
path.replaceWith(template.expression.ast`
${t.cloneNode(outerClass.node.id)} === ${(0, _helperCreateClassFeaturesPlugin.buildCheckInRHS)(node.right, file)}
`); `);
} else {
var _outerClass$node$id;
const id = getWeakSetId(classWeakSets, outerClass, outerClass, (_outerClass$node$id = outerClass.node.id) == null ? void 0 : _outerClass$node$id.name, injectInitialization);
path.replaceWith(template.expression.ast`${id}.has(${(0, _helperCreateClassFeaturesPlugin.buildCheckInRHS)(node.right, file)})`);
}
} else {
const id = getWeakSetId(fieldsWeakSets, outerClass, privateElement, privateElement.node.key.id.name, injectToFieldInit);
path.replaceWith(template.expression.ast`${id}.has(${(0, _helperCreateClassFeaturesPlugin.buildCheckInRHS)(node.right, file)})`);
}
}
}
};
});
exports.default = _default;
//# sourceMappingURL=index.js.map return;
} catch (e) {}
throw new Error(`\
--- PLACEHOLDER PACKAGE ---
This @babel/plugin-proposal-private-property-in-object version is not meant to
be imported. Something is importing
@babel/plugin-proposal-private-property-in-object without declaring it in its
dependencies (or devDependencies) in the package.json file.
Add "@babel/plugin-proposal-private-property-in-object" to your devDependencies
to work around this error. This will make this message go away.
`);

@ -1,11 +1,10 @@
{ {
"name": "@babel/plugin-proposal-private-property-in-object", "name": "@babel/plugin-proposal-private-property-in-object",
"version": "7.21.0", "version": "7.21.0-placeholder-for-preset-env.2",
"description": "This plugin transforms checks for a private property in an object", "description": "This plugin transforms checks for a private property in an object",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/babel/babel.git", "url": "https://github.com/babel/babel-plugin-proposal-private-property-in-object.git"
"directory": "packages/babel-plugin-proposal-private-property-in-object"
}, },
"homepage": "https://babel.dev/docs/en/next/babel-plugin-proposal-private-property-in-object", "homepage": "https://babel.dev/docs/en/next/babel-plugin-proposal-private-property-in-object",
"license": "MIT", "license": "MIT",
@ -16,19 +15,10 @@
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"
], ],
"dependencies": {
"@babel/helper-annotate-as-pure": "^7.18.6",
"@babel/helper-create-class-features-plugin": "^7.21.0",
"@babel/helper-plugin-utils": "^7.20.2",
"@babel/plugin-syntax-private-property-in-object": "^7.14.5"
},
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {},
"@babel/core": "^7.21.0",
"@babel/helper-plugin-test-runner": "^7.18.6"
},
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
}, },

@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-syntax-decorators", "name": "@babel/plugin-syntax-decorators",
"version": "7.22.3", "version": "7.22.5",
"description": "Allow parsing of decorators", "description": "Allow parsing of decorators",
"repository": { "repository": {
"type": "git", "type": "git",
@ -17,13 +17,13 @@
"babel-plugin" "babel-plugin"
], ],
"dependencies": { "dependencies": {
"@babel/helper-plugin-utils": "^7.21.5" "@babel/helper-plugin-utils": "^7.22.5"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.1" "@babel/core": "^7.22.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

@ -4,19 +4,16 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = void 0; exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils"); var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _default = (0, _helperPluginUtils.declare)(api => { var _default = (0, _helperPluginUtils.declare)(api => {
api.assertVersion(7); api.assertVersion(7);
return { return {
name: "syntax-export-default-from", name: "syntax-export-default-from",
manipulateOptions(opts, parserOpts) { manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("exportDefaultFrom"); parserOpts.plugins.push("exportDefaultFrom");
} }
}; };
}); });
exports.default = _default; exports.default = _default;
//# sourceMappingURL=index.js.map

@ -0,0 +1 @@
{"version":3,"names":["_helperPluginUtils","require","_default","declare","api","assertVersion","name","manipulateOptions","opts","parserOpts","plugins","push","exports","default"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\n\nexport default declare(api => {\n api.assertVersion(7);\n\n return {\n name: \"syntax-export-default-from\",\n\n manipulateOptions(opts, parserOpts) {\n parserOpts.plugins.push(\"exportDefaultFrom\");\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAAqD,IAAAC,QAAA,GAEtC,IAAAC,0BAAO,EAACC,GAAG,IAAI;EAC5BA,GAAG,CAACC,aAAa,CAAC,CAAC,CAAC;EAEpB,OAAO;IACLC,IAAI,EAAE,4BAA4B;IAElCC,iBAAiBA,CAACC,IAAI,EAAEC,UAAU,EAAE;MAClCA,UAAU,CAACC,OAAO,CAACC,IAAI,CAAC,mBAAmB,CAAC;IAC9C;EACF,CAAC;AACH,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAX,QAAA"}

@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-syntax-export-default-from", "name": "@babel/plugin-syntax-export-default-from",
"version": "7.18.6", "version": "7.22.5",
"description": "Allow parsing of export default from", "description": "Allow parsing of export default from",
"repository": { "repository": {
"type": "git", "type": "git",
@ -16,13 +16,13 @@
"babel-plugin" "babel-plugin"
], ],
"dependencies": { "dependencies": {
"@babel/helper-plugin-utils": "^7.18.6" "@babel/helper-plugin-utils": "^7.22.5"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.18.6" "@babel/core": "^7.22.5"
}, },
"homepage": "https://babel.dev/docs/en/next/babel-plugin-syntax-export-default-from", "homepage": "https://babel.dev/docs/en/next/babel-plugin-syntax-export-default-from",
"engines": { "engines": {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save