Skip to content

A platform for community discussion. Free, open, simple.

DEV: Add support for class properties in babel (#13189)

Robin Ward2082abbb759b
diff --git a/app/assets/javascripts/discourse/app/routes/groups-index.js b/app/assets/javascripts/discourse/app/routes/groups-index.js
index 41684664ead..a054f348c7f 100644
--- a/app/assets/javascripts/discourse/app/routes/groups-index.js
+++ b/app/assets/javascripts/discourse/app/routes/groups-index.js
@@ -1,24 +1,24 @@
import DiscourseRoute from "discourse/routes/discourse";
import I18n from "I18n";
-export default DiscourseRoute.extend({
+export default class GroupsIndexRoute extends DiscourseRoute {
titleToken() {
return I18n.t("groups.index.title");
- },
+ }
- queryParams: {
+ queryParams = {
order: { refreshModel: true, replace: true },
asc: { refreshModel: true, replace: true },
filter: { refreshModel: true },
type: { refreshModel: true, replace: true },
username: { refreshModel: true },
- },
+ };
model(params) {
return params;
- },
+ }
setupController(controller, params) {
controller.loadGroups(params);
- },
-});
+ }
+}
diff --git a/lib/discourse_js_processor.rb b/lib/discourse_js_processor.rb
index eaa40350a6f..7fd18e136d3 100644
--- a/lib/discourse_js_processor.rb
+++ b/lib/discourse_js_processor.rb
@@ -143,9 +143,9 @@ JS
if opts[:module_name] && !@skip_module
filename = opts[:filename] || 'unknown'
- "Babel.transform(#{js_source}, { moduleId: '#{opts[:module_name]}', filename: '#{filename}', ast: false, presets: ['es2015'], plugins: [['transform-modules-amd', {noInterop: true}], 'proposal-object-rest-spread', 'proposal-optional-chaining', ['proposal-decorators', {legacy: true} ], exports.WidgetHbsCompiler] }).code"
+ "Babel.transform(#{js_source}, { moduleId: '#{opts[:module_name]}', filename: '#{filename}', ast: false, presets: ['es2015'], plugins: [['transform-modules-amd', {noInterop: true}], 'proposal-object-rest-spread', 'proposal-optional-chaining', ['proposal-decorators', {legacy: true} ], 'proposal-class-properties', exports.WidgetHbsCompiler] }).code"
else
- "Babel.transform(#{js_source}, { ast: false, plugins: ['proposal-json-strings', 'proposal-nullish-coalescing-operator', 'proposal-logical-assignment-operators', 'proposal-numeric-separator', 'proposal-optional-catch-binding', 'transform-dotall-regex', 'proposal-unicode-property-regex', 'transform-named-capturing-groups-regex', 'proposal-object-rest-spread', 'proposal-optional-chaining', 'transform-arrow-functions', 'transform-block-scoped-functions', 'transform-block-scoping', 'transform-computed-properties', 'transform-destructuring', 'transform-duplicate-keys', 'transform-for-of', 'transform-function-name', 'transform-literals', 'transform-object-super', 'transform-parameters', 'transform-shorthand-properties', 'transform-spread', 'transform-sticky-regex', 'transform-template-literals', 'transform-typeof-symbol', 'transform-unicode-regex', ['proposal-decorators', {legacy: true}], exports.WidgetHbsCompiler] }).code"
+ "Babel.transform(#{js_source}, { ast: false, plugins: ['proposal-json-strings', 'proposal-nullish-coalescing-operator', 'proposal-logical-assignment-operators', 'proposal-numeric-separator', 'proposal-optional-catch-binding', 'transform-dotall-regex', 'proposal-unicode-property-regex', 'transform-named-capturing-groups-regex', 'proposal-object-rest-spread', 'proposal-optional-chaining', 'transform-arrow-functions', 'transform-block-scoped-functions', 'transform-block-scoping', 'transform-computed-properties', 'transform-destructuring', 'transform-duplicate-keys', 'transform-for-of', 'transform-function-name', 'transform-literals', 'transform-object-super', 'transform-parameters', 'transform-shorthand-properties', 'transform-spread', 'transform-sticky-regex', 'transform-template-literals', 'transform-typeof-symbol', 'transform-unicode-regex', ['proposal-decorators', {legacy: true}], 'proposal-class-properties', exports.WidgetHbsCompiler] }).code"
end
end