discourse/patches/ember-this-fallback+0.4.0+003+exclude-strict-mode.patch
David Taylor 588a79c80c
DEV: Merge root JS packages (#25857)
Before this commit, we had a yarn package set up in the root directory and also in `app/assets/javascripts`. That meant two `yarn install` calls and two `node_modules` directories. This commit merges them both into the root location, and updates references to node_modules.

A previous attempt can be found at https://github.com/discourse/discourse/pull/21172. This commit re-uses that script to merge the `yarn.lock` files.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2024-02-26 13:45:58 +00:00

77 lines
3.1 KiB
Diff

diff --git a/node_modules/ember-this-fallback/lib/this-fallback-plugin.js b/node_modules/ember-this-fallback/lib/this-fallback-plugin.js
index a8ee337..9b144de 100644
--- a/node_modules/ember-this-fallback/lib/this-fallback-plugin.js
+++ b/node_modules/ember-this-fallback/lib/this-fallback-plugin.js
@@ -60,9 +60,15 @@ class ThisFallbackPlugin {
handleBlock() {
return {
enter: (node) => {
+ if (this.env.strictMode) {
+ return;
+ }
this.scopeStack.push(node.blockParams);
},
exit: () => {
+ if (this.env.strictMode) {
+ return;
+ }
this.scopeStack.pop();
},
};
@@ -70,6 +76,9 @@ class ThisFallbackPlugin {
handleAttrNodes() {
return {
enter: (elementNode, elementPath) => {
+ if (this.env.strictMode) {
+ return;
+ }
const ambiguousHeads = new Map();
const blockParamName = (0, scope_stack_1.unusedNameLike)('maybeHelpers', this.scopeStack);
for (const attrNode of elementNode.attributes) {
@@ -119,6 +128,9 @@ class ThisFallbackPlugin {
return {
keys: {
params: (node) => {
+ if (this.env.strictMode) {
+ return;
+ }
const { scopeStack } = this;
node.params = node.params.map((expr) => {
if ((0, fallback_1.needsFallback)(expr, scopeStack)) {
@@ -131,6 +143,9 @@ class ThisFallbackPlugin {
});
},
hash: (node) => {
+ if (this.env.strictMode) {
+ return;
+ }
const { scopeStack } = this;
node.hash.pairs = node.hash.pairs.map((pair) => {
const { key, value: expr, loc } = pair;
@@ -149,6 +164,9 @@ class ThisFallbackPlugin {
handleMustache() {
return {
enter: (node, path) => {
+ if (this.env.strictMode) {
+ return;
+ }
// Alias node to n so that the type of `node` doesn't get narrowed,
// which prevents mutation
const n = node;
@@ -174,9 +192,15 @@ class ThisFallbackPlugin {
handleTemplate() {
return {
enter: (node) => {
+ if (this.env.strictMode) {
+ return;
+ }
this.logger.debug("before: '%s'", (0, string_1.squish)((0, syntax_1.print)(node)));
},
exit: (node, path) => {
+ if (this.env.strictMode) {
+ return;
+ }
this.logger.debug("after_: '%s'", (0, string_1.squish)((0, syntax_1.print)(node)));
if (this.scopeStack.size !== 1) {
throw new Error(`unbalanced ScopeStack push and pop, ScopeStack size is ${this.scopeStack.size}`);