Don't use barrel files

This commit is contained in:
Adria Navarro 2024-03-21 16:10:27 +01:00
parent bb87b9943c
commit c679984a99
1 changed files with 19 additions and 13 deletions

View File

@ -1,17 +1,23 @@
import { date, duration } from "./date" import { date, duration } from "./date"
import { // @ts-expect-error
math, import math from "@budibase/handlebars-helpers/lib/math"
array, // @ts-expect-error
number, import array from "@budibase/handlebars-helpers/lib/array"
url, // @ts-expect-error
string, import number from "@budibase/handlebars-helpers/lib/number"
comparison, // @ts-expect-error
object, import url from "@budibase/handlebars-helpers/lib/url"
regex, // @ts-expect-error
uuid, import string from "@budibase/handlebars-helpers/lib/string"
// @ts-expect-error // @ts-expect-error
} from "@budibase/handlebars-helpers" import comparison from "@budibase/handlebars-helpers/lib/comparison"
// @ts-expect-error
import object from "@budibase/handlebars-helpers/lib/object"
// @ts-expect-error
import regex from "@budibase/handlebars-helpers/lib/regex"
// @ts-expect-error
import uuid from "@budibase/handlebars-helpers/lib/uuid"
// https://github.com/evanw/esbuild/issues/56 // https://github.com/evanw/esbuild/issues/56
const externalCollections = { const externalCollections = {
@ -42,7 +48,7 @@ export function getJsHelperList() {
helpers = {} helpers = {}
for (let collection of Object.values(externalCollections)) { for (let collection of Object.values(externalCollections)) {
for (let [key, func] of Object.entries<any>(collection())) { for (let [key, func] of Object.entries<any>(collection)) {
// Handlebars injects the hbs options to the helpers by default. We are adding an empty {} as a last parameter to simulate it // 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, {}) helpers[key] = (...props: any) => func(...props, {})
} }