-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: integrate babel-plugin-amd-to-esm
- Loading branch information
Showing
8 changed files
with
89 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const babelCore = require("@babel/core"); | ||
const fs = require("fs").promises; | ||
const basePath = process.argv[2]; | ||
|
||
const transformAmdModule = async (filePath) => { | ||
let code = (await fs.readFile(filePath)).toString(); | ||
|
||
code = code.replace(/sap\.ui\.require/g, "require"); | ||
|
||
code = (await babelCore.transformAsync(code, { | ||
plugins: [['babel-plugin-amd-to-esm', {}]] | ||
})).code; | ||
|
||
return fs.writeFile(filePath, code); | ||
} | ||
|
||
const transformAmdModules = async () => { | ||
const { globby } = await import("globby"); | ||
const fileNames = await globby(basePath.replace(/\\/g, "/") + "**/*.js"); | ||
return Promise.all(fileNames.map(transformAmdModule).filter(x => !!x)); | ||
}; | ||
|
||
transformAmdModules().then(() => { | ||
console.log("Success: all amd modules are transformed to es6 modules!"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,27 @@ | |
json5 "^2.2.3" | ||
semver "^6.3.1" | ||
|
||
"@babel/core@^7.23.7": | ||
version "7.23.7" | ||
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.7.tgz#4d8016e06a14b5f92530a13ed0561730b5c6483f" | ||
integrity sha512-+UpDgowcmqe36d4NwqvKsyPMlOLNGMsfMmQ5WGCu+siCe3t3dfe9njrzGfdN4qq+bcNUt0+Vw6haRxBOycs4dw== | ||
dependencies: | ||
"@ampproject/remapping" "^2.2.0" | ||
"@babel/code-frame" "^7.23.5" | ||
"@babel/generator" "^7.23.6" | ||
"@babel/helper-compilation-targets" "^7.23.6" | ||
"@babel/helper-module-transforms" "^7.23.3" | ||
"@babel/helpers" "^7.23.7" | ||
"@babel/parser" "^7.23.6" | ||
"@babel/template" "^7.22.15" | ||
"@babel/traverse" "^7.23.7" | ||
"@babel/types" "^7.23.6" | ||
convert-source-map "^2.0.0" | ||
debug "^4.1.0" | ||
gensync "^1.0.0-beta.2" | ||
json5 "^2.2.3" | ||
semver "^6.3.1" | ||
|
||
"@babel/generator@^7.22.9": | ||
version "7.22.9" | ||
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.9.tgz#572ecfa7a31002fa1de2a9d91621fd895da8493d" | ||
|
@@ -411,6 +432,15 @@ | |
"@babel/traverse" "^7.23.6" | ||
"@babel/types" "^7.23.6" | ||
|
||
"@babel/helpers@^7.23.7": | ||
version "7.23.8" | ||
resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.8.tgz#fc6b2d65b16847fd50adddbd4232c76378959e34" | ||
integrity sha512-KDqYz4PiOWvDFrdHLPhKtCThtIcKVy6avWD2oG4GEvyQ+XDZwHD4YQd+H2vNMnq2rkdxsDkU82T+Vk8U/WXHRQ== | ||
dependencies: | ||
"@babel/template" "^7.22.15" | ||
"@babel/traverse" "^7.23.7" | ||
"@babel/types" "^7.23.6" | ||
|
||
"@babel/highlight@^7.10.4", "@babel/highlight@^7.22.5": | ||
version "7.22.5" | ||
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.5.tgz#aa6c05c5407a67ebce408162b7ede789b4d22031" | ||
|
@@ -1218,6 +1248,22 @@ | |
debug "^4.3.1" | ||
globals "^11.1.0" | ||
|
||
"@babel/traverse@^7.23.7": | ||
version "7.23.7" | ||
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.7.tgz#9a7bf285c928cb99b5ead19c3b1ce5b310c9c305" | ||
integrity sha512-tY3mM8rH9jM0YHFGyfC0/xf+SB5eKUu7HPj7/k3fpi9dAlsMc5YbQvDi0Sh2QTPXqMhyaAtzAr807TIyfQrmyg== | ||
dependencies: | ||
"@babel/code-frame" "^7.23.5" | ||
"@babel/generator" "^7.23.6" | ||
"@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.6" | ||
"@babel/types" "^7.23.6" | ||
debug "^4.3.1" | ||
globals "^11.1.0" | ||
|
||
"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.22.5", "@babel/types@^7.4.4": | ||
version "7.22.5" | ||
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.5.tgz#cd93eeaab025880a3a47ec881f4b096a5b786fbe" | ||
|
@@ -4445,7 +4491,7 @@ JSONStream@^1.0.4: | |
jsonparse "^1.2.0" | ||
through ">=2.2.7 <3" | ||
|
||
abbrev@1, abbrev@^1.0.0: | ||
abbrev@^1.0.0: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" | ||
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== | ||
|
@@ -4482,7 +4528,7 @@ accepts@~1.3.5, accepts@~1.3.8: | |
mime-types "~2.1.34" | ||
negotiator "0.6.3" | ||
|
||
acorn-jsx@^5.0.1, acorn-jsx@^5.3.1: | ||
acorn-jsx@^5.3.1: | ||
version "5.3.2" | ||
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" | ||
integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== | ||
|
@@ -4492,12 +4538,7 @@ acorn-walk@^8.1.1: | |
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" | ||
integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== | ||
|
||
acorn@^6.1.1: | ||
version "6.4.2" | ||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" | ||
integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== | ||
|
||
acorn@^7.1.1, acorn@^7.4.0: | ||
acorn@^7.4.0: | ||
version "7.4.1" | ||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" | ||
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== | ||
|
@@ -4566,19 +4607,6 @@ ajv@^8.0.1, ajv@^8.12.0: | |
require-from-string "^2.0.2" | ||
uri-js "^4.2.2" | ||
|
||
amd-to-es6@^0.2.0: | ||
version "0.2.0" | ||
resolved "https://registry.yarnpkg.com/amd-to-es6/-/amd-to-es6-0.2.0.tgz#3127f3c9166295545dc3edc39bedc6b302049a01" | ||
integrity sha512-M4JzO6LG3wL7CDoxLLd4FQdcoxCOtLEkyAoV8O56nfxJ20tX/gTevrEt6wMKe6el5X3goWuAPAH3LOhfTl6jzQ== | ||
dependencies: | ||
acorn "^6.1.1" | ||
acorn-jsx "^5.0.1" | ||
commander "^2.4.0" | ||
falafel "^2.1.0" | ||
glob "^7.1.3" | ||
js-beautify "~1.5.1" | ||
mkdirp "^0.5.0" | ||
|
||
ansi-align@^3.0.0: | ||
version "3.0.1" | ||
resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.1.tgz#0cdf12e111ace773a86e9a1fad1225c43cb19a59" | ||
|
@@ -4953,6 +4981,11 @@ babel-core@^7.0.0-bridge.0: | |
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" | ||
integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== | ||
|
||
babel-plugin-amd-to-esm@^2.0.3: | ||
version "2.0.3" | ||
resolved "https://registry.yarnpkg.com/babel-plugin-amd-to-esm/-/babel-plugin-amd-to-esm-2.0.3.tgz#879d14e212cca6af05431d52f94aff27da02b66e" | ||
integrity sha512-jPzcPXaMDTzCD68Cn9UVxl0XVHq+6zmbhjCT6TYRr5Wruk8hQMkL46fiJgia44ObgwnrmH3Ni9keBNp/1NgGxA== | ||
|
||
babel-plugin-istanbul@^6.0.0, babel-plugin-istanbul@^6.1.1: | ||
version "6.1.1" | ||
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" | ||
|
@@ -5772,11 +5805,6 @@ command-line-args@^5.1.1: | |
lodash.camelcase "^4.3.0" | ||
typical "^4.0.0" | ||
|
||
commander@^2.4.0: | ||
version "2.20.3" | ||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" | ||
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== | ||
|
||
commander@^6.2.1: | ||
version "6.2.1" | ||
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" | ||
|
@@ -5902,14 +5930,6 @@ [email protected]: | |
ini "^1.3.4" | ||
proto-list "~1.2.1" | ||
|
||
config-chain@~1.1.5: | ||
version "1.1.13" | ||
resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.13.tgz#fad0795aa6a6cdaff9ed1b68e9dff94372c232f4" | ||
integrity sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ== | ||
dependencies: | ||
ini "^1.3.4" | ||
proto-list "~1.2.1" | ||
|
||
configstore@^5.0.1: | ||
version "5.0.1" | ||
resolved "https://registry.yarnpkg.com/configstore/-/configstore-5.0.1.tgz#d365021b5df4b98cdd187d6a3b0e3f6a7cc5ed96" | ||
|
@@ -7311,14 +7331,6 @@ extract-zip@^1.6.6: | |
mkdirp "^0.5.4" | ||
yauzl "^2.10.0" | ||
|
||
falafel@^2.1.0: | ||
version "2.2.5" | ||
resolved "https://registry.yarnpkg.com/falafel/-/falafel-2.2.5.tgz#3ccb4970a09b094e9e54fead2deee64b4a589d56" | ||
integrity sha512-HuC1qF9iTnHDnML9YZAdCDQwT0yKl/U55K4XSUXqGAA2GLoafFgWRqdAbhWJxXaYD4pyoVxAJ8wH670jMpI9DQ== | ||
dependencies: | ||
acorn "^7.1.1" | ||
isarray "^2.0.1" | ||
|
||
fast-deep-equal@^2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" | ||
|
@@ -9002,7 +9014,7 @@ is2@^2.0.6: | |
ip-regex "^4.1.0" | ||
is-url "^1.2.4" | ||
|
||
isarray@^2.0.1, isarray@^2.0.5: | ||
isarray@^2.0.5: | ||
version "2.0.5" | ||
resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" | ||
integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== | ||
|
@@ -9195,15 +9207,6 @@ jpeg-js@^0.4.1: | |
resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.4.4.tgz#a9f1c6f1f9f0fa80cdb3484ed9635054d28936aa" | ||
integrity sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg== | ||
|
||
js-beautify@~1.5.1: | ||
version "1.5.10" | ||
resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.5.10.tgz#4d95371702699344a516ca26bf59f0a27bb75719" | ||
integrity sha512-T7Na5vNK9KtiwRJJEgANosU6E6xt7eBMZl/bSECLb/+Rw9eU3lMDGmkAbkHWvxdgvf2s4fI6eK4MEsBg90tOHA== | ||
dependencies: | ||
config-chain "~1.1.5" | ||
mkdirp "~0.5.0" | ||
nopt "~3.0.1" | ||
|
||
js-library-detector@^6.4.0: | ||
version "6.6.0" | ||
resolved "https://registry.yarnpkg.com/js-library-detector/-/js-library-detector-6.6.0.tgz#b531a4784f8242d87f68f6f3eafc771a0650fb9d" | ||
|
@@ -10807,7 +10810,7 @@ mkdirp-infer-owner@^2.0.0: | |
infer-owner "^1.0.4" | ||
mkdirp "^1.0.3" | ||
|
||
mkdirp@^0.5.0, mkdirp@^0.5.4, mkdirp@~0.5.0: | ||
mkdirp@^0.5.4: | ||
version "0.5.6" | ||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" | ||
integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== | ||
|
@@ -11025,13 +11028,6 @@ nopt@^7.0.0: | |
dependencies: | ||
abbrev "^2.0.0" | ||
|
||
nopt@~3.0.1: | ||
version "3.0.6" | ||
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" | ||
integrity sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg== | ||
dependencies: | ||
abbrev "1" | ||
|
||
normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.5.0: | ||
version "2.5.0" | ||
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" | ||
|