feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "babel-preset-current-node-syntax",
"version": "1.0.1",
"version": "1.1.0",
"description": "A Babel preset that enables parsing of proposals supported by the current Node.js version.",
"main": "src/index.js",
"repository": {
@@ -12,30 +12,34 @@
"url": "https://github.com/nicolo-ribaudo"
},
"scripts": {
"test": "node ./test/index.js",
"prepublish": "./scripts/check-yarn-bug.sh"
"test": "node ./test/index.js"
},
"dependencies": {
"@babel/plugin-syntax-async-generators": "^7.8.4",
"@babel/plugin-syntax-bigint": "^7.8.3",
"@babel/plugin-syntax-class-properties": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.8.3",
"@babel/plugin-syntax-class-properties": "^7.12.13",
"@babel/plugin-syntax-class-static-block": "^7.14.5",
"@babel/plugin-syntax-import-attributes": "^7.24.7",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-syntax-json-strings": "^7.8.3",
"@babel/plugin-syntax-logical-assignment-operators": "^7.8.3",
"@babel/plugin-syntax-logical-assignment-operators": "^7.10.4",
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-syntax-numeric-separator": "^7.8.3",
"@babel/plugin-syntax-numeric-separator": "^7.10.4",
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
"@babel/plugin-syntax-optional-catch-binding": "^7.8.3",
"@babel/plugin-syntax-optional-chaining": "^7.8.3",
"@babel/plugin-syntax-top-level-await": "^7.8.3"
"@babel/plugin-syntax-private-property-in-object": "^7.14.5",
"@babel/plugin-syntax-top-level-await": "^7.14.5"
},
"peerDependencies": {
"@babel/core": "^7.0.0"
},
"devDependencies": {
"@babel/core": "7.0.0",
"@babel/core": "7.25.2",
"@babel/parser-7.0.0": "npm:@babel/parser@7.0.0",
"@babel/parser-7.12.0": "npm:@babel/parser@7.12.0",
"@babel/parser-7.22.0": "npm:@babel/parser@7.22.0",
"@babel/parser-7.9.0": "npm:@babel/parser@7.9.0"
},
"license": "MIT"
}
}

View File

@@ -1,5 +0,0 @@
if grep 3155328e5 .yarn/releases/yarn-*.cjs -c; then
echo "Your version of yarn is affected by https://github.com/yarnpkg/berry/issues/1882"
echo "Please run \`sed -i -e \"s/3155328e5/4567890e5/g\" .yarn/releases/yarn-*.cjs\`"
exit 1
fi

View File

@@ -8,19 +8,27 @@ const tests = {
"json-strings": ["'\\u2028'"], // Babel 7.2.0
// ECMAScript 2020
"bigint": ["1n"], // Babel 7.8.0
bigint: ["1n"], // Babel 7.8.0
"optional-chaining": ["a?.b"], // Babel 7.9.0
"nullish-coalescing-operator": ["a ?? b"], // Babel 7.9.0
// import.meta is handled manually
// Stage 3
// ECMAScript 2021
"numeric-separator": ["1_2"],
"logical-assignment-operators": ["a ||= b", "a &&= b", "a ??= c"],
// ECMAScript 2022
"class-properties": [
"(class { x = 1 })",
"(class { #x = 1 })",
"(class { #x() {} })",
],
"logical-assignment-operators": ["a ||= b", "a &&= b", "a ??= c"],
"private-property-in-object": ["(class { #x; m() { #x in y } })"],
"class-static-block": ["(class { static {} })"],
// top-level await is handled manually
// Stage 3
// import attributes is handled manually
};
const plugins = [];
@@ -53,5 +61,12 @@ if (major > 10 || (major === 10 && minor >= 4)) {
if (major > 14 || (major === 14 && minor >= 3)) {
plugins.push(require.resolve("@babel/plugin-syntax-top-level-await"));
}
// Similar for import attributes
if (
major > 20 ||
(major === 20 && minor >= 10) ||
(major === 18 && minor >= 20)
) {
plugins.push(require.resolve("@babel/plugin-syntax-import-attributes"));
}
module.exports = () => ({ plugins });