Allow excluding js helpers
This commit is contained in:
parent
e5d5dea5e6
commit
cd4fccbd6e
|
@ -1,4 +1,4 @@
|
|||
import { getManifest } from "@budibase/string-templates"
|
||||
import { getManifest, helpersToRemoveForJs } from "@budibase/string-templates"
|
||||
|
||||
export function handlebarsCompletions() {
|
||||
const manifest = getManifest()
|
||||
|
@ -11,7 +11,9 @@ export function handlebarsCompletions() {
|
|||
label: helperName,
|
||||
displayText: helperName,
|
||||
description: helperConfig.description,
|
||||
allowsJs: !helperConfig.requiresBlock,
|
||||
allowsJs:
|
||||
!helperConfig.requiresBlock &&
|
||||
!helpersToRemoveForJs.includes(helperName),
|
||||
}))
|
||||
)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@ const helperList = require("@budibase/handlebars-helpers")
|
|||
|
||||
let helpers = undefined
|
||||
|
||||
const helpersToRemove = ["sortBy"]
|
||||
const helpersToRemoveForJs = ["sortBy"]
|
||||
module.exports.helpersToRemoveForJs = helpersToRemoveForJs
|
||||
|
||||
module.exports.getJsHelperList = () => {
|
||||
if (helpers) {
|
||||
|
@ -25,7 +26,7 @@ module.exports.getJsHelperList = () => {
|
|||
helpers[key] = externalHandlebars.addedHelpers[key]
|
||||
}
|
||||
|
||||
for (const toRemove of helpersToRemove) {
|
||||
for (const toRemove of helpersToRemoveForJs) {
|
||||
delete helpers[toRemove]
|
||||
}
|
||||
Object.freeze(helpers)
|
||||
|
|
|
@ -20,6 +20,7 @@ module.exports.findHBSBlocks = templates.findHBSBlocks
|
|||
module.exports.convertToJS = templates.convertToJS
|
||||
module.exports.setJSRunner = templates.setJSRunner
|
||||
module.exports.FIND_ANY_HBS_REGEX = templates.FIND_ANY_HBS_REGEX
|
||||
module.exports.helpersToRemoveForJs = templates.helpersToRemoveForJs
|
||||
|
||||
if (!process.env.NO_JS) {
|
||||
const { VM } = require("vm2")
|
||||
|
|
|
@ -10,6 +10,7 @@ const {
|
|||
} = require("./utilities")
|
||||
const { convertHBSBlock } = require("./conversion")
|
||||
const javascript = require("./helpers/javascript")
|
||||
const { helpersToRemoveForJs } = require("./helpers/list")
|
||||
|
||||
const hbsInstance = handlebars.create()
|
||||
registerAll(hbsInstance)
|
||||
|
@ -394,3 +395,4 @@ module.exports.convertToJS = hbs => {
|
|||
}
|
||||
|
||||
module.exports.FIND_ANY_HBS_REGEX = FIND_ANY_HBS_REGEX
|
||||
module.exports.helpersToRemoveForJs = helpersToRemoveForJs
|
||||
|
|
|
@ -21,6 +21,7 @@ export const findHBSBlocks = templates.findHBSBlocks
|
|||
export const convertToJS = templates.convertToJS
|
||||
export const setJSRunner = templates.setJSRunner
|
||||
export const FIND_ANY_HBS_REGEX = templates.FIND_ANY_HBS_REGEX
|
||||
export const helpersToRemoveForJs = templates.helpersToRemoveForJs
|
||||
|
||||
if (process && !process.env.NO_JS) {
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue