Added submodule babel
This commit is contained in:
parent
ac163abd9d
commit
19b4b86e20
10 changed files with 463 additions and 319 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "babel"]
|
||||
path = babel
|
||||
url = git@github.com:polsevev/babel.git
|
1
babel
Submodule
1
babel
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 3f66d23229dd68dfe18cc0edd92e46f30dd4f4f7
|
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
424
package-lock.json
generated
424
package-lock.json
generated
|
@ -6,18 +6,185 @@
|
|||
"packages": {
|
||||
"": {
|
||||
"name": "didactic-chainsaw",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/generator": "^7.23.0",
|
||||
"@babel/parser": "^7.23.0",
|
||||
"@babel/traverse": "^7.23.0",
|
||||
"babel": "^6.23.0",
|
||||
"bun": "^1.0.4",
|
||||
"ts-node": "^10.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.83",
|
||||
"@types/node": "^20.5.9",
|
||||
"bun-types": "latest",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
"version": "7.22.13",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz",
|
||||
"integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==",
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.22.13",
|
||||
"chalk": "^2.4.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/generator": {
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz",
|
||||
"integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.23.0",
|
||||
"@jridgewell/gen-mapping": "^0.3.2",
|
||||
"@jridgewell/trace-mapping": "^0.3.17",
|
||||
"jsesc": "^2.5.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/generator/node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.19",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz",
|
||||
"integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==",
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-environment-visitor": {
|
||||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz",
|
||||
"integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-function-name": {
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz",
|
||||
"integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==",
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.22.15",
|
||||
"@babel/types": "^7.23.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-hoist-variables": {
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz",
|
||||
"integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.22.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-split-export-declaration": {
|
||||
"version": "7.22.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz",
|
||||
"integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.22.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz",
|
||||
"integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-validator-identifier": {
|
||||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz",
|
||||
"integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight": {
|
||||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz",
|
||||
"integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==",
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
"chalk": "^2.4.2",
|
||||
"js-tokens": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz",
|
||||
"integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==",
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/template": {
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz",
|
||||
"integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.22.13",
|
||||
"@babel/parser": "^7.22.15",
|
||||
"@babel/types": "^7.22.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/traverse": {
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz",
|
||||
"integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.22.13",
|
||||
"@babel/generator": "^7.23.0",
|
||||
"@babel/helper-environment-visitor": "^7.22.20",
|
||||
"@babel/helper-function-name": "^7.23.0",
|
||||
"@babel/helper-hoist-variables": "^7.22.5",
|
||||
"@babel/helper-split-export-declaration": "^7.22.6",
|
||||
"@babel/parser": "^7.23.0",
|
||||
"@babel/types": "^7.23.0",
|
||||
"debug": "^4.1.0",
|
||||
"globals": "^11.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz",
|
||||
"integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==",
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.22.5",
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@cspotcode/source-map-support": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
|
@ -29,6 +196,19 @@
|
|||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
|
||||
"integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
|
||||
"dependencies": {
|
||||
"@jridgewell/set-array": "^1.0.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
|
||||
|
@ -37,6 +217,14 @@
|
|||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/set-array": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
||||
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
||||
|
@ -105,6 +293,78 @@
|
|||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/@oven/bun-darwin-aarch64": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.0.4.tgz",
|
||||
"integrity": "sha512-HCfN2Uanf2eUU/CUbEJJFaeHoBgo/YGukt5V5keDRFSKALvdcITRbAPTZ1JjdRtul/ntue0oDMppJoHJEmzx+Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
"node_modules/@oven/bun-darwin-x64": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.0.4.tgz",
|
||||
"integrity": "sha512-nER/1gBJL/e4D4woGDq+GwPDhzVs3oaoVZ7I4jlKv/LGHWJE5RAjH3qT4gbh/zwHlHaHi5RQw1pbRFgdN7n9EQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
"node_modules/@oven/bun-darwin-x64-baseline": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.0.4.tgz",
|
||||
"integrity": "sha512-+BSZ9EdfyIH+0zk48zm8fb0TvSdr1fxdPLV4wvofp+HNlkzPHt4745ibSLNGbOev/y6lwHrMNfbGoY9elCOtkw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
"node_modules/@oven/bun-linux-aarch64": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.0.4.tgz",
|
||||
"integrity": "sha512-tnZN2CTDqeHh0OdXpraKKzmidNidVrdZocLfppMZklvHpmsvr/MdK96lcj2o5LzrjwhVGJKOUol8N32B/C8MBQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@oven/bun-linux-x64": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.0.4.tgz",
|
||||
"integrity": "sha512-yHk/ZALZR6Y7xgBW2Dhm6s+6NZ/HdhgByOPJmKbgFAt5ocuNpDRlEEhlLdaaxWwAL+RsG969OpV+bSzC9suCMw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@oven/bun-linux-x64-baseline": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.0.4.tgz",
|
||||
"integrity": "sha512-OURqmY2Ln760KecV8I0taBMA/0LcmeMVGQXMh1hv5NZSfB9d6O/2LrHKv1zZfLRJm9hPjpPxxuqKWc46p95xZA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@sindresorhus/is": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||
|
@ -449,6 +709,17 @@
|
|||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/arch": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz",
|
||||
|
@ -474,6 +745,17 @@
|
|||
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
|
||||
},
|
||||
"node_modules/babel": {
|
||||
"version": "6.23.0",
|
||||
"resolved": "https://registry.npmjs.org/babel/-/babel-6.23.0.tgz",
|
||||
"integrity": "sha512-ZDcCaI8Vlct8PJ3DvmyqUz+5X2Ylz3ZuuItBe/74yXosk2dwyVo/aN7MCJ8HJzhnnJ+6yP4o+lDgG9MBe91DLA==",
|
||||
"deprecated": "In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers",
|
||||
"bin": {
|
||||
"babel": "lib/cli.js",
|
||||
"babel-external-helpers": "lib/cli.js",
|
||||
"babel-node": "lib/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/bin-check": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bin-check/-/bin-check-4.1.0.tgz",
|
||||
|
@ -650,6 +932,38 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/bun": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/bun/-/bun-1.0.4.tgz",
|
||||
"integrity": "sha512-gzMDYkfGYe8KWKUBZJKCFTHUlf1QJRSLyIiryi0atf/4tqPzMq3QDwAmBd/4CWjU5pWCJvPZxLPsAWxeQDayxw==",
|
||||
"cpu": [
|
||||
"arm64",
|
||||
"x64"
|
||||
],
|
||||
"hasInstallScript": true,
|
||||
"os": [
|
||||
"darwin",
|
||||
"linux"
|
||||
],
|
||||
"bin": {
|
||||
"bun": "bin/bun",
|
||||
"bunx": "bin/bun"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@oven/bun-darwin-aarch64": "1.0.4",
|
||||
"@oven/bun-darwin-x64": "1.0.4",
|
||||
"@oven/bun-darwin-x64-baseline": "1.0.4",
|
||||
"@oven/bun-linux-aarch64": "1.0.4",
|
||||
"@oven/bun-linux-x64": "1.0.4",
|
||||
"@oven/bun-linux-x64-baseline": "1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/bun-types": {
|
||||
"version": "1.0.5-canary.20231009T140142",
|
||||
"resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.0.5-canary.20231009T140142.tgz",
|
||||
"integrity": "sha512-5hT8WBXZ2ozdJt6s0nnnh4iQXn6xp9a7spbRYjapNxKjR3ckS5U2V347H3+XpaMVzc/a7D2I2KnKqIPO1R82kg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/cacheable-lookup": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz",
|
||||
|
@ -692,6 +1006,27 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk/node_modules/escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/clone-response": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz",
|
||||
|
@ -704,6 +1039,19 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
|
||||
|
@ -741,6 +1089,22 @@
|
|||
"which": "^1.2.9"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/decompress-response": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
|
||||
|
@ -980,6 +1344,14 @@
|
|||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/globals": {
|
||||
"version": "11.12.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
|
||||
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/got": {
|
||||
"version": "11.8.6",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz",
|
||||
|
@ -1005,6 +1377,14 @@
|
|||
"url": "https://github.com/sindresorhus/got?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/http-cache-semantics": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
|
||||
|
@ -1113,6 +1493,22 @@
|
|||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
|
||||
},
|
||||
"node_modules/jsesc": {
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
|
||||
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
|
||||
"bin": {
|
||||
"jsesc": "bin/jsesc"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/json-buffer": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
|
||||
|
@ -1207,6 +1603,11 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node_modules/normalize-url": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz",
|
||||
|
@ -1662,6 +2063,25 @@
|
|||
"url": "https://github.com/sponsors/Borewit"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-color": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dependencies": {
|
||||
"has-flag": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/to-fast-properties": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
||||
"integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/to-regex-range": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"bun-types": "latest",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.83",
|
||||
"@types/node": "^20.5.9",
|
||||
"bun-types": "latest",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -14,6 +13,7 @@
|
|||
"@babel/parser": "^7.23.0",
|
||||
"@babel/traverse": "^7.23.0",
|
||||
"babel": "^6.23.0",
|
||||
"bun": "^1.0.4",
|
||||
"ts-node": "^10.9.1"
|
||||
}
|
||||
}
|
||||
|
|
35
src/index.js
Normal file
35
src/index.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
import * as babelparser from "../babel/packages/babel-parser/lib";
|
||||
import traverse from "@babel/traverse";
|
||||
import generate from "@babel/generator";
|
||||
|
||||
const main = () => {
|
||||
|
||||
let code_To_Insert = "697 + 457";
|
||||
|
||||
let code = "1 + 1;";
|
||||
let ast = babelparser.parse(code);
|
||||
console.log(ast);
|
||||
let insert_ast = babelparser.parse(code);
|
||||
|
||||
|
||||
traverse(ast, {
|
||||
enter(path){
|
||||
if (path.isBinaryExpression({operator: "+"})){
|
||||
path.node.operator="@@@";
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
console.log(JSON.stringify(ast, null, 4));
|
||||
const out = generate(ast, {}, code);
|
||||
console.log("input: " + code);
|
||||
console.log("output: " + out.code);
|
||||
let inout = babelparser.parse(out.code);
|
||||
console.log(inout);
|
||||
console.log(generate(inout, {}, code));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
main();
|
84
src/index.ts
84
src/index.ts
|
@ -1,84 +0,0 @@
|
|||
import swc, { printSync } from "@swc/core";
|
||||
import { MatchScript } from "./types";
|
||||
import { from, to } from "./patterns/patterns";
|
||||
|
||||
const PATTERN_PATH = "src/patterns/test.json";
|
||||
|
||||
const main = async () => {
|
||||
console.log(Bun.version);
|
||||
|
||||
let inputFile = await Bun.file("src/test_files/simple.js").text();
|
||||
console.log("Hello!");
|
||||
|
||||
const hello = "lol";
|
||||
|
||||
console.log(
|
||||
"=====================\nCurrent file to be transformed : \n" +
|
||||
inputFile +
|
||||
"\n====================",
|
||||
);
|
||||
swc.parseFile("src/test_files/simple.js", {
|
||||
syntax: "ecmascript",
|
||||
jsx: false,
|
||||
|
||||
target: "es2022",
|
||||
|
||||
isModule: false,
|
||||
}).then((module) => {
|
||||
//console.log(module);
|
||||
// swc.print(module).then((o: swc.Output) => {
|
||||
// console.log(o);
|
||||
// });
|
||||
|
||||
// console.log(module.body);
|
||||
|
||||
matchStatements(module).then((a) => {
|
||||
console.log(
|
||||
"================\nOutput code: \n" +
|
||||
a +
|
||||
"\n========================",
|
||||
);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const matchStatements = async (module: swc.Script) => {
|
||||
let fromLocal = from;
|
||||
let toLocal = to;
|
||||
let key: "body" = "body";
|
||||
module[key]
|
||||
return match(fromLocal, toLocal, module.body);
|
||||
};
|
||||
|
||||
enum MatchingResults{
|
||||
FULL,
|
||||
PARTIAL,
|
||||
SINGLE,
|
||||
NONE
|
||||
}
|
||||
|
||||
const match = (from: any, to: any, module: swc.Statement[]): any => {
|
||||
|
||||
let curMatchType = MatchingResults.NONE;
|
||||
|
||||
for (const [key, value] of Object.entries(module)){
|
||||
if (from[key] && key != "span"){
|
||||
console.log(from[key] + " == " + value);
|
||||
if (from[key as any] == value){
|
||||
console.log("Found valid key with " + key);
|
||||
|
||||
let matchRes = match(from[key], to, value);
|
||||
if (matchRes == MatchingResults.FULL){
|
||||
curMatchType = MatchingResults.FULL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return curMatchType;
|
||||
};
|
||||
|
||||
|
||||
|
||||
main();
|
|
@ -1,47 +0,0 @@
|
|||
import * as babelparser from "@babel/parser";
|
||||
import traverse from "@babel/traverse";
|
||||
import generate from "@babel/generator";
|
||||
|
||||
const main = () => {
|
||||
|
||||
let code_To_Insert = "697 + 457";
|
||||
|
||||
let code = "let n = 1 - 1;";
|
||||
let ast:babelparser.ParseResult<File> = babelparser.parse(code);
|
||||
console.log(ast);
|
||||
let insert_ast = babelparser.parse(code);
|
||||
|
||||
traverse(ast, {
|
||||
enter(path:any) {
|
||||
|
||||
if (path.isBinaryExpression({operator: "+"})){
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
traverse(ast, {
|
||||
enter(path:any){
|
||||
if (path.isBinaryExpression({operator: "+"})){
|
||||
path.node.operator="@@@";
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
console.log(ast)
|
||||
const output = generate(ast, {}, code);
|
||||
console.log("input: " + code);
|
||||
console.log("output: " + output.code);
|
||||
//let inout = babelparser.parse(output.code);
|
||||
//console.log(inout);
|
||||
|
||||
let awaitex = babelparser.parse("async function a(){let b = await c();}async function c(){return 1; }");
|
||||
console.log(JSON.stringify(awaitex));
|
||||
|
||||
traverse(awaitex, {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
main();
|
|
@ -1,76 +0,0 @@
|
|||
import { Statement, VariableDeclarator } from "@swc/types";
|
||||
import { MatchStatement, WildCardType } from "../types";
|
||||
|
||||
export const from: MatchStatement = {
|
||||
type: "VariableDeclaration",
|
||||
span: {
|
||||
start: 1,
|
||||
end: 13,
|
||||
ctxt: 0,
|
||||
},
|
||||
kind: WildCardType.ANYTHING,
|
||||
declare: false,
|
||||
declarations: [
|
||||
{
|
||||
type: "VariableDeclarator",
|
||||
span: {
|
||||
start: 5,
|
||||
end: 12,
|
||||
ctxt: 0,
|
||||
},
|
||||
id: {
|
||||
type: "Identifier",
|
||||
span: {
|
||||
start: 5,
|
||||
end: 6,
|
||||
ctxt: 2,
|
||||
},
|
||||
value: "a",
|
||||
optional: false,
|
||||
},
|
||||
init: {
|
||||
type: "NumericLiteral",
|
||||
span: {
|
||||
start: 9,
|
||||
end: 12,
|
||||
ctxt: 0,
|
||||
},
|
||||
value: 100,
|
||||
raw: "100",
|
||||
},
|
||||
definite: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const to: VariableDeclarator[] = [
|
||||
{
|
||||
type: "VariableDeclarator",
|
||||
span: {
|
||||
start: 5,
|
||||
end: 12,
|
||||
ctxt: 0,
|
||||
},
|
||||
id: {
|
||||
type: "Identifier",
|
||||
span: {
|
||||
start: 5,
|
||||
end: 6,
|
||||
ctxt: 2,
|
||||
},
|
||||
value: "Inserted_By_Program",
|
||||
optional: false,
|
||||
},
|
||||
init: {
|
||||
type: "NumericLiteral",
|
||||
span: {
|
||||
start: 9,
|
||||
end: 12,
|
||||
ctxt: 0,
|
||||
},
|
||||
value: 100,
|
||||
raw: "InsertedValue!",
|
||||
},
|
||||
definite: false,
|
||||
},
|
||||
];
|
108
src/types.ts
108
src/types.ts
|
@ -1,108 +0,0 @@
|
|||
import {
|
||||
BinaryExpression,
|
||||
BlockStatement,
|
||||
BreakStatement,
|
||||
ClassDeclaration,
|
||||
ContinueStatement,
|
||||
DebuggerStatement,
|
||||
Declaration,
|
||||
DoWhileStatement,
|
||||
EmptyStatement,
|
||||
Expression,
|
||||
ExpressionStatement,
|
||||
ForInStatement,
|
||||
ForOfStatement,
|
||||
ForStatement,
|
||||
FunctionDeclaration,
|
||||
IfStatement,
|
||||
LabeledStatement,
|
||||
ReturnStatement,
|
||||
Script,
|
||||
SwitchStatement,
|
||||
ThrowStatement,
|
||||
TryStatement,
|
||||
VariableDeclaration,
|
||||
VariableDeclarationKind,
|
||||
WhileStatement,
|
||||
WithStatement,
|
||||
} from "@swc/core";
|
||||
|
||||
export type MatchStatement =
|
||||
| MatchBlockSatement
|
||||
| MatchEmptyStatement
|
||||
| MatchDebuggerStatement
|
||||
| MatchWithStatement
|
||||
| MatchReturnStatement
|
||||
| MatchLabeledStatement
|
||||
| MatchBreakStatement
|
||||
| MatchContinueStatement
|
||||
| matchIfStatement
|
||||
| MatchSwitchStatement
|
||||
| MatchThrowStatement
|
||||
| MatchTryStatement
|
||||
| MatchWhileStatement
|
||||
| MatchDoWhileStatement
|
||||
| MatchForInStatement
|
||||
| MatchForStatement
|
||||
| MatchForOfStatement
|
||||
| MatchDeclaration
|
||||
| MatchExpressionStatement;
|
||||
|
||||
type MatchDeclaration =
|
||||
| MatchClassDeclaration
|
||||
| MatchFunctionDeclaration
|
||||
| MatchVariableDeclaration;
|
||||
|
||||
export enum WildCardType {
|
||||
ANYTHING,
|
||||
}
|
||||
|
||||
export interface MatchScript extends Script {}
|
||||
|
||||
export interface MatchBlockSatement extends BlockStatement {}
|
||||
|
||||
export interface MatchEmptyStatement extends EmptyStatement {}
|
||||
|
||||
export interface MatchDebuggerStatement extends DebuggerStatement {}
|
||||
|
||||
export interface MatchWithStatement extends WithStatement {}
|
||||
|
||||
export interface MatchReturnStatement extends ReturnStatement {}
|
||||
|
||||
export interface MatchLabeledStatement extends LabeledStatement {}
|
||||
|
||||
export interface MatchBreakStatement extends BreakStatement {}
|
||||
|
||||
export interface MatchContinueStatement extends ContinueStatement {}
|
||||
|
||||
export interface MatchSwitchStatement extends SwitchStatement {}
|
||||
|
||||
export interface MatchThrowStatement extends ThrowStatement {}
|
||||
|
||||
export interface MatchTryStatement extends TryStatement {}
|
||||
|
||||
export interface MatchWhileStatement extends WhileStatement {}
|
||||
|
||||
export interface MatchDoWhileStatement extends DoWhileStatement {}
|
||||
|
||||
export interface MatchForStatement extends ForStatement {}
|
||||
|
||||
export interface MatchForInStatement extends ForInStatement {}
|
||||
|
||||
export interface MatchForOfStatement extends ForOfStatement {}
|
||||
|
||||
export interface MatchExpressionStatement extends ExpressionStatement {}
|
||||
|
||||
export interface matchIfStatement extends IfStatement {}
|
||||
|
||||
export interface matchBinaryExpression extends BlockStatement {
|
||||
__stmts: WildCardType;
|
||||
}
|
||||
|
||||
export interface MatchClassDeclaration extends ClassDeclaration {}
|
||||
|
||||
export interface MatchFunctionDeclaration extends FunctionDeclaration {}
|
||||
|
||||
export interface MatchVariableDeclaration extends Omit<VariableDeclaration, "kind"> {
|
||||
kind : VariableDeclarationKind | WildCardType
|
||||
}
|
Loading…
Reference in a new issue