From a6d38401414953a72ee42b0bd40826ea7a256cfa Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 21 Mar 2024 11:28:06 +0100 Subject: [PATCH 1/3] Fix bundling --- packages/string-templates/src/helpers/list.ts | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/packages/string-templates/src/helpers/list.ts b/packages/string-templates/src/helpers/list.ts index 361558e04d..082d0e255b 100644 --- a/packages/string-templates/src/helpers/list.ts +++ b/packages/string-templates/src/helpers/list.ts @@ -1,17 +1,30 @@ import { date, duration } from "./date" +import { + math, + array, + number, + url, + string, + comparison, + object, + regex, + uuid, + // @ts-expect-error +} from "@budibase/handlebars-helpers" + // https://github.com/evanw/esbuild/issues/56 -const getExternalCollections = (): Record any> => ({ - math: require("@budibase/handlebars-helpers/lib/math"), - array: require("@budibase/handlebars-helpers/lib/array"), - number: require("@budibase/handlebars-helpers/lib/number"), - url: require("@budibase/handlebars-helpers/lib/url"), - string: require("@budibase/handlebars-helpers/lib/string"), - comparison: require("@budibase/handlebars-helpers/lib/comparison"), - object: require("@budibase/handlebars-helpers/lib/object"), - regex: require("@budibase/handlebars-helpers/lib/regex"), - uuid: require("@budibase/handlebars-helpers/lib/uuid"), -}) +const externalCollections = { + math, + array, + number, + url, + string, + comparison, + object, + regex, + uuid, +} export const helpersToRemoveForJs = ["sortBy"] @@ -28,8 +41,8 @@ export function getJsHelperList() { } helpers = {} - for (let collection of Object.values(getExternalCollections())) { - for (let [key, func] of Object.entries(collection)) { + for (let collection of Object.values(externalCollections)) { + for (let [key, func] of Object.entries(collection)) { // Handlebars injects the hbs options to the helpers by default. We are adding an empty {} as a last parameter to simulate it helpers[key] = (...props: any) => func(...props, {}) } From 1a8510358b80835809eea3529c0519c51cc28690 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 21 Mar 2024 11:43:50 +0100 Subject: [PATCH 2/3] Fix test --- packages/string-templates/src/helpers/list.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/string-templates/src/helpers/list.ts b/packages/string-templates/src/helpers/list.ts index 082d0e255b..5852bc9127 100644 --- a/packages/string-templates/src/helpers/list.ts +++ b/packages/string-templates/src/helpers/list.ts @@ -42,7 +42,7 @@ export function getJsHelperList() { helpers = {} for (let collection of Object.values(externalCollections)) { - for (let [key, func] of Object.entries(collection)) { + for (let [key, func] of Object.entries(collection())) { // Handlebars injects the hbs options to the helpers by default. We are adding an empty {} as a last parameter to simulate it helpers[key] = (...props: any) => func(...props, {}) } From 08cf877565ee8f46a62b538af7a9340e93460049 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 21 Mar 2024 11:02:04 +0000 Subject: [PATCH 3/3] Bump version to 2.22.8 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 3a92bc6d9a..ec64523dff 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.22.7", + "version": "2.22.8", "npmClient": "yarn", "packages": [ "packages/*",