From 525cfcbe0e49c3b945cd9f53b7970a24d75edf04 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 12 Oct 2023 11:08:57 +0100 Subject: [PATCH] FIX: Ensure nested ember components can be used with mustache syntax (#23912) We run the ember-this-fallback transformation on plugin and theme code so that they can continue omitting `this.` in `.hbs` templates. A bug in the implementation meant that it was incorrectly transforming things like `{{dir/some-component}}` into `` (rather than ``). This commit uses patch-package to apply the fix from https://github.com/tildeio/ember-this-fallback/pull/56 --- ...-fallback+0.3.1+003+fix-nested-components.patch | 14 ++++++++++++++ app/models/theme.rb | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 app/assets/javascripts/patches/ember-this-fallback+0.3.1+003+fix-nested-components.patch diff --git a/app/assets/javascripts/patches/ember-this-fallback+0.3.1+003+fix-nested-components.patch b/app/assets/javascripts/patches/ember-this-fallback+0.3.1+003+fix-nested-components.patch new file mode 100644 index 00000000000..821ebfcef4f --- /dev/null +++ b/app/assets/javascripts/patches/ember-this-fallback+0.3.1+003+fix-nested-components.patch @@ -0,0 +1,14 @@ +diff --git a/node_modules/ember-this-fallback/lib/helpers/string.js b/node_modules/ember-this-fallback/lib/helpers/string.js +index c6f4e65..91ed2af 100644 +--- a/node_modules/ember-this-fallback/lib/helpers/string.js ++++ b/node_modules/ember-this-fallback/lib/helpers/string.js +@@ -21,6 +21,8 @@ function squish(str) { + } + exports.squish = squish; + function classify(str) { +- return (0, lodash_1.upperFirst)((0, lodash_1.camelCase)(str)); ++ const parts = str.split('/'); ++ const classifiedParts = parts.map((p) => (0, lodash_1.upperFirst)((0, lodash_1.camelCase)(p))); ++ return classifiedParts.join('::'); + } + exports.classify = classify; diff --git a/app/models/theme.rb b/app/models/theme.rb index 71395e67d6b..87b566c3073 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -6,7 +6,7 @@ require "json_schemer" class Theme < ActiveRecord::Base include GlobalPath - BASE_COMPILER_VERSION = 76 + BASE_COMPILER_VERSION = 77 attr_accessor :child_components