Nicolò Ribaudo
36a5ac4145
Fix handling of this&co in computed keys in arrows transform ( #14005 )
2021-11-30 22:54:17 +01:00
Bogdan Savluk
0058b7fef4
Migrate Babel from Flow to TypeScript (except Babel parser) ( #11578 )
...
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-11-25 23:09:13 +01:00
Huáng Jùnliàng
14572e1881
Sort module export names ( #13788 )
...
* fix: sort export init statements by name
* update test fixtures
* refactor: reduce memory footprint
* review comments
2021-09-26 10:12:18 -04:00
Nicolò Ribaudo
8fb50429ea
Throw a better error when transforming imported bindings in types ( #13739 )
...
* Throw a better error when transforming imported bindings in types
* Also type casts
* Update error message
2021-09-16 23:14:41 +02:00
Huáng Jùnliàng
614b486780
Use named imports for babel types ( #13685 )
...
* migrate to named babel types imports
* perf: transform babel types import to destructuring
* fix merge errors
* apply plugin to itself
2021-08-18 10:28:40 -04:00
Federico Ciardi
7e50ee2d82
feat: add noIncompleteNsImportDetection assumption to plugin-transform-modules-commonjs ( #13290 )
2021-08-03 23:55:09 +02:00
overlookmotel
5ac5e3572f
Fix const violations in ESM imports when transformed to CJS ( #13258 )
2021-06-22 19:33:46 +02:00
Huáng Jùnliàng
9e241fc180
Better error for export * as ns without the correct plugin ( #13296 )
2021-05-12 00:40:13 +02:00
Sosuke Suzuki
b2d9156cc6
Update to Prettier 2.3 ( #13288 )
2021-05-10 15:34:13 +02:00
Nicolò Ribaudo
be03be1bc3
Implement importInterop: "node" option for module transforms ( #12838 )
2021-04-28 18:22:47 +02:00
Nicolò Ribaudo
8e8954b470
[babel 8] Remove module-specific options from @babel/core ( #12724 )
2021-03-28 01:27:37 +01:00
Bogdan Savluk
6ac07a1647
convert @babel/helper-module-transforms to typescript ( #12928 )
...
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-27 01:40:32 +01:00
Justin Ridgewell
830a93cc97
Remove lodash/chunk ( #13022 )
2021-03-19 15:52:25 +01:00
Nicolò Ribaudo
6ef7b51a11
Implement assumptions defined in the babel/rfcs#5 RFC
...
- `mutableTemplateObject` and `ignoreToPrimitiveHint` (#12408 )
- `setClassMethods` (#12407 )
- `setComputedProperties` (#12490 )
- `ignoreFunctionLength` (#12491 )
- `noDocumentAll` (#12481 )
- `iterableIsArray` and `arrayLikeIsIterable` (#12489 )
- `pureGetters` (#12504 )
- `skipForOfIteratorClosing` (#12496 )
- `objectRestNoSymbols`, `setSpreadProperties` and `pureGetters` (#12505 )
- `noNewArrows` (#12613 , #12793 )
- `setPublicClassFields` and `privateFieldsAsProperties` (#12497 )
- `constantReexports` and `enumerableModuleMeta` (#12618 )
- `constantSuper`, `superIsCallableConstructor` and `noClassCalls` (#12726 )
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
Co-authored-by: Huáng Jùnliàng <JLHwung@users.noreply.github.com>
2021-02-21 17:09:45 +01:00
Huáng Jùnliàng
99130bcfdd
Register binding when transforming TSParameterProperty ( #12796 )
2021-02-17 00:42:01 +01:00
Huáng Jùnliàng
f697e7995d
Transform class static block ( #12143 )
...
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 21:16:24 +02:00
Huáng Jùnliàng
21d7ee2610
String import/export specifier ( #12091 )
...
* feat: parse moduleExportName
* feat: add validators
* Support string specifier name in commonjs transform
* Support string specifier name in export-ns-from
* test: add loose testcases
* test: add testcases for amd and umd
* feat: support systemjs
* test: update fixtures fixed in #12110
* add plugin name typings
* test: rename test layout
* feat: implement under moduleStringNames flag
* chore: add plugin syntax module string names
* feat: support ModuleExportName as ModuleExportName
* test: update test fixtures
* fix flow errors
* docs: update AST spec
* feat: support { "some imports" as "some exports" }
* feat: support { "some imports" as "some exports" } in systemjs
* test: add test on `import { "foo" }`
* Address review comments
* add moduleStringNames to missing plugin helpers
* Apply suggestions from code review
* update test fixtures
* Update packages/babel-parser/src/parser/error-message.js
* update test fixtures
Co-Authored-By: Kai Cataldo <kai@kaicataldo.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 20:01:37 +02:00
Niklas Mischkulnig
a080c82777
[cjs] Skip duplicate reexported bindings in namespace reexports ( #11739 )
2020-09-28 16:22:13 +02:00
Huáng Jùnliàng
8f191ead92
chore: fix typo in codebase ( #11846 )
2020-07-16 16:01:20 -05:00
Huáng Jùnliàng
5dd64ecc4a
Disallow duplicated AST nodes ( #11807 )
2020-07-14 08:32:16 -05:00
Nicolò Ribaudo
a875560c31
Allow defining the moduleIds-related option in the transform p… ( #11194 )
...
* Update "moduleIds" tests
* Allow defining the moduleIds related options in the transform plugins
- moduleIds
- moduleId
- getModuleId
- moduleRoot
* Sort deps
2020-03-16 23:58:04 +01:00
Siddhant N Trivedi
3c6a8ae200
Fix rewriteThis in helper-module-transforms for computed class… ( #11109 )
...
* Fix rewriteThis in helper-module-transforms for computed class elements
* Added test file and corrected the visitor
* Revert .gitignore
* Using skipAllButComputedKey method from plugin-replace-supers
* added tests for class methods
* Added tests for both class properties and methods and fixed skipping computed key for methods
* Fixed condition for class methods
* revised the conditions for class methods
* Added more tests and used else-if in classmethod condition
* Update packages/babel-helper-replace-supers/src/index.js
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-02-12 21:19:10 +01:00
Vedant Roy
dadba01249
Fix export bindings not updated by 'for...in' and 'for...of' ( #11074 )
...
* Correctly transpile export bindings for some for-of loops
* Correctly transform non-destructured for of loops to update exported variables
* Add tests
* Don't replace entire for of loop
* Correctly transform destructured for-of/for-in exports
* Update exported variables in array pattern and more fixes
* Refresh test output
* Update tests and rebase on master
* Refactor ForOf|ForIn visitor
* Don't transform re-declared exported vars
* Generate better name for loop id
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* Idiomatically generate UidIdentifier
* Update scope after replacing loop declaration
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-02-09 11:41:29 +01:00
Huáng Jùnliàng
44f9d85904
add allowTopLevelThis option to transform-modules-systemjs ( #10780 )
...
* feat: expose rewriteThis method
* feat: add allowTopLevelThis option to transform-modules-systemjs
2020-01-10 03:16:26 +01:00
Klaus Meinhardt
b91720c1cc
helper-module-transforms: dereference imported template tag ( #10934 )
...
* Dereference imported template tag
* apply fix for OptionalCallExpression as well
2019-12-28 16:46:20 -05:00
Huáng Jùnliàng
4e774b7264
fix: rewriteBindingInitVisitor should skip on scopable node ( #10764 )
2019-11-26 08:51:11 +01:00
Nicolò Ribaudo
43aa7e262c
Don't throw when destructuring into a var named as an import ( #10628 )
2019-11-04 22:50:36 +01:00
Corey Farrell
f31c72f310
Fix handling of class property value this in module transforms. ( #9857 )
...
Prevent module transforms from rewriting `this` to `void 0` when found in the values of private class properties. Add tests to prevent regressions.
2019-04-15 22:45:10 +02:00
Andrew Anikin
123fdfd314
Fix lazy option of babel-plugin-transform-modules-commonjs ( #9802 )
...
* Fix lazy mode of babel-plugin-transform-modules-commonjs (#9447 )
* Update output snapshots for lazy mode of babel-plugin-transform-modules-commonjs (#9447 )
2019-04-01 07:59:12 +02:00
Daniel Tschinder
f4eec5ca79
Add new flag that indicates if a module has exports ( #9171 )
2018-12-12 21:24:44 -08:00
Yongxu Ren
0fd3da110d
Rewrite Hub as interface #5047
2018-08-20 19:30:29 +02:00
Logan Smyth
935533cff3
Ensure that the wildcard interop is used with re-export + default. ( #8316 )
2018-07-14 12:49:31 -07:00
Willa Wang
73f8059ea0
Fix typo in rewrite-live-references.js ( #7896 ) [skip ci]
2018-05-09 20:30:02 -04:00
Logan Smyth
c662c2ada2
Use strict namespace behavior for mjs files. ( #7545 )
2018-03-15 13:27:01 -07:00
Logan Smyth
62c1046249
Avoid re-traversing inserted references to the namespace binding. ( #7418 )
2018-02-22 23:54:29 -08:00
Logan Smyth
e732ee0c5b
Preserve import binding locations during module rewriting ( #7378 )
...
* Only wrap import references that need it.
* Preserve the import binding location for sourcemaps.
* Add tests.
2018-02-14 10:17:27 -08:00
Mateusz Burzyński
4d164bd8e6
Added babel-helper-split-export-declaration ( #7313 )
2018-02-13 16:44:05 +01:00
Nicolò Ribaudo
63ae923987
Add t.cloneNode and deprecate t.clone and t.cloneDeep ( #7149 )
2018-01-29 22:59:06 +01:00
Logan Smyth
53826aaaa0
Expose a 'lazy' option for the CommonJS transform.
2017-12-17 18:42:35 -08:00
Logan Smyth
b900a3e5c2
Consistently return AST nodes.
2017-12-17 18:33:47 -08:00
Artem Yavorsky
0a2a37c31f
Fix export from assignment order for loose mode. ( #6863 )
...
* Consider reexports for bindingKindLookup.
* Update test cases according to reexports change
* Fix order for assign reexports.
* void 0 assignation to module keys only for loose mode.
* Create buildReexportsFromMeta helper.
* Update umd/amd fixtures.
* Refactor reexports build.
* Hoist template for reexports.
* Use map as a second argument of Array.from.
* Remove unnecessary export.
2017-11-29 11:58:29 -08:00
Brian Ng
d81cca3b5f
Add additional support for loose mode in helper-module-transforms ( #6742 )
2017-11-05 20:54:14 -05:00
Logan Smyth
f230497d08
Use literal-based templates for more stuff.
2017-10-18 13:58:48 -07:00
Henry Zhu
cde0054227
Scoped: change src imports to @babel/ [skip ci]
2017-10-16 22:49:56 -04:00
Logan Smyth
9dfcf0f116
Split the simple-access transforms out of the module transform into a general helper.
2017-09-26 15:43:51 -07:00
Logan Smyth
ec9754bc40
Implement a new utility module for injecting module imports.
2017-09-26 11:28:56 -07:00
Logan Smyth
b115ea5da7
Merge pull request #6280 from loganfsmyth/only-transform-modules
...
Only transform 'this'->'undefined' and inject 'use strict' if module statements are present
2017-09-23 11:24:52 -07:00
Logan Smyth
72da5e1d02
Quick fix for default import that also uses names. ( #6282 )
2017-09-21 22:26:42 -07:00
Logan Smyth
2b88e079ef
Only transform this/use strict if a module.
2017-09-20 10:19:35 -07:00
Henry Zhu
5b9112c794
babel-helper-modules -> babel-helper-module-transforms since package taken [skip ci]
2017-09-19 16:20:03 -04:00