-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
330 additions
and
19 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
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,134 @@ | ||
diff --git a/node_modules/polymer-build/lib/js-transform.js b/node_modules/polymer-build/lib/js-transform.js | ||
index 00b71cb..9af536e 100644 | ||
--- a/node_modules/polymer-build/lib/js-transform.js | ||
+++ b/node_modules/polymer-build/lib/js-transform.js | ||
@@ -66,6 +66,17 @@ const babelTransformEs2018 = [ | ||
require('@babel/plugin-proposal-object-rest-spread'), | ||
require('@babel/plugin-proposal-async-generator-functions'), | ||
]; | ||
+const babelTransformEs2020 = [ | ||
+ require('@babel/plugin-proposal-optional-chaining'), | ||
+ require('@babel/plugin-proposal-nullish-coalescing-operator'), | ||
+ require('@babel/plugin-syntax-optional-catch-binding'), | ||
+]; | ||
+const babelTransformEs2021 = [ | ||
+ require('@babel/plugin-proposal-logical-assignment-operators'), | ||
+]; | ||
+const babelTransformEs2022 = [ | ||
+ require('@babel/plugin-proposal-class-properties'), | ||
+]; | ||
// Loading this plugin removes inlined Babel helpers. | ||
const babelExternalHelpersPlugin = require('@babel/plugin-external-helpers'); | ||
const babelTransformModulesAmd = [ | ||
@@ -136,21 +147,33 @@ function jsTransform(js, options) { | ||
plugins.push(...babelTransformEs2016); | ||
plugins.push(...babelTransformEs2017); | ||
plugins.push(...babelTransformEs2018); | ||
+ plugins.push(...babelTransformEs2020); | ||
+ plugins.push(...babelTransformEs2021); | ||
+ plugins.push(...babelTransformEs2022); | ||
} | ||
else if (options.compile === 'es2015') { | ||
doBabelTransform = true; | ||
plugins.push(...babelTransformEs2016); | ||
plugins.push(...babelTransformEs2017); | ||
plugins.push(...babelTransformEs2018); | ||
+ plugins.push(...babelTransformEs2020); | ||
+ plugins.push(...babelTransformEs2021); | ||
+ plugins.push(...babelTransformEs2022); | ||
} | ||
else if (options.compile === 'es2016') { | ||
doBabelTransform = true; | ||
plugins.push(...babelTransformEs2017); | ||
plugins.push(...babelTransformEs2018); | ||
+ plugins.push(...babelTransformEs2020); | ||
+ plugins.push(...babelTransformEs2021); | ||
+ plugins.push(...babelTransformEs2022); | ||
} | ||
else if (options.compile === 'es2017') { | ||
doBabelTransform = true; | ||
plugins.push(...babelTransformEs2018); | ||
+ plugins.push(...babelTransformEs2020); | ||
+ plugins.push(...babelTransformEs2021); | ||
+ plugins.push(...babelTransformEs2022); | ||
} | ||
if (options.moduleResolution === 'node') { | ||
if (!options.filePath) { | ||
@@ -180,6 +203,10 @@ function jsTransform(js, options) { | ||
// tslint:disable-next-line: no-any | ||
'importMeta', | ||
'objectRestSpread', | ||
+ 'optionalChaining', | ||
+ 'nullishCoalescingOperator', | ||
+ 'classProperties', | ||
+ 'logicalAssignment', | ||
], | ||
}); | ||
} | ||
diff --git a/node_modules/polymer-build/src/js-transform.ts b/node_modules/polymer-build/src/js-transform.ts | ||
index 91e6a8b..cd03e46 100644 | ||
--- a/node_modules/polymer-build/src/js-transform.ts | ||
+++ b/node_modules/polymer-build/src/js-transform.ts | ||
@@ -73,6 +73,20 @@ const babelTransformEs2018 = [ | ||
require('@babel/plugin-proposal-async-generator-functions'), | ||
]; | ||
|
||
+const babelTransformEs2020 = [ | ||
+ require('@babel/plugin-proposal-optional-chaining'), | ||
+ require('@babel/plugin-proposal-nullish-coalescing-operator'), | ||
+ require('@babel/plugin-syntax-optional-catch-binding'), | ||
+]; | ||
+ | ||
+const babelTransformEs2021 = [ | ||
+ require('@babel/plugin-proposal-logical-assignment-operators'), | ||
+]; | ||
+ | ||
+const babelTransformEs2022 = [ | ||
+ require('@babel/plugin-proposal-class-properties'), | ||
+]; | ||
+ | ||
// Loading this plugin removes inlined Babel helpers. | ||
const babelExternalHelpersPlugin = require('@babel/plugin-external-helpers'); | ||
|
||
@@ -207,18 +221,30 @@ export function jsTransform(js: string, options: JsTransformOptions): string { | ||
plugins.push(...babelTransformEs2016); | ||
plugins.push(...babelTransformEs2017); | ||
plugins.push(...babelTransformEs2018); | ||
+ plugins.push(...babelTransformEs2020); | ||
+ plugins.push(...babelTransformEs2021); | ||
+ plugins.push(...babelTransformEs2022); | ||
} else if (options.compile === 'es2015') { | ||
doBabelTransform = true; | ||
plugins.push(...babelTransformEs2016); | ||
plugins.push(...babelTransformEs2017); | ||
plugins.push(...babelTransformEs2018); | ||
+ plugins.push(...babelTransformEs2020); | ||
+ plugins.push(...babelTransformEs2021); | ||
+ plugins.push(...babelTransformEs2022); | ||
} else if (options.compile === 'es2016') { | ||
doBabelTransform = true; | ||
plugins.push(...babelTransformEs2017); | ||
plugins.push(...babelTransformEs2018); | ||
+ plugins.push(...babelTransformEs2020); | ||
+ plugins.push(...babelTransformEs2021); | ||
+ plugins.push(...babelTransformEs2022); | ||
} else if (options.compile === 'es2017') { | ||
doBabelTransform = true; | ||
plugins.push(...babelTransformEs2018); | ||
+ plugins.push(...babelTransformEs2020); | ||
+ plugins.push(...babelTransformEs2021); | ||
+ plugins.push(...babelTransformEs2022); | ||
} | ||
if (options.moduleResolution === 'node') { | ||
if (!options.filePath) { | ||
@@ -258,6 +284,10 @@ export function jsTransform(js: string, options: JsTransformOptions): string { | ||
// tslint:disable-next-line: no-any | ||
'importMeta' as any, | ||
'objectRestSpread', | ||
+ 'optionalChaining', | ||
+ 'nullishCoalescingOperator', | ||
+ 'classProperties', | ||
+ 'logicalAssignment' | ||
], | ||
}); | ||
} catch (e) { |
Oops, something went wrong.