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,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;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -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 +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
File diff suppressed because one or more lines are too long
@ -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"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
7
Meteo/node_modules/@babel/helper-skip-transparent-expression-wrappers/lib/index.js
generated
vendored
7
Meteo/node_modules/@babel/helper-skip-transparent-expression-wrappers/lib/index.js
generated
vendored
@ -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"}
|
6
Meteo/node_modules/@babel/helper-skip-transparent-expression-wrappers/package.json
generated
vendored
6
Meteo/node_modules/@babel/helper-skip-transparent-expression-wrappers/package.json
generated
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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"}
|
@ -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 +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"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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"}
|
@ -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"}
|
158
Meteo/node_modules/@babel/plugin-proposal-private-property-in-object/lib/index.js
generated
vendored
158
Meteo/node_modules/@babel/plugin-proposal-private-property-in-object/lib/index.js
generated
vendored
@ -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.
|
||||||
|
`);
|
||||||
|
16
Meteo/node_modules/@babel/plugin-proposal-private-property-in-object/package.json
generated
vendored
16
Meteo/node_modules/@babel/plugin-proposal-private-property-in-object/package.json
generated
vendored
@ -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"}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue