Merge pull request #13331 from Budibase/BUDI-8113/fix-isolated-vm-bundler
Update isolated-vm bundler
This commit is contained in:
commit
44af74c395
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,5 @@
|
|||
const {
|
||||
getJsHelperList,
|
||||
} = require("../../../../string-templates/src/helpers/list.js")
|
||||
// eslint-disable-next-line local-rules/no-budibase-imports
|
||||
import { getJsHelperList } from "@budibase/string-templates/src/helpers/list"
|
||||
|
||||
export default {
|
||||
...getJsHelperList(),
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
"use strict";var snippets=(()=>{var u=Object.create;var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var l=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),W=(i,e)=>{for(var p in e)n(i,p,{get:e[p],enumerable:!0})},f=(i,e,p,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of h(e))!C.call(i,t)&&t!==p&&n(i,t,{get:()=>e[t],enumerable:!(r=a(e,t))||r.enumerable});return i};var d=(i,e,p)=>(p=i!=null?u(x(i)):{},f(e||!i||!i.__esModule?n(p,"default",{value:i,enumerable:!0}):p,i)),g=i=>f(n({},"__esModule",{value:!0}),i);var s=l((D,o)=>{o.exports.iifeWrapper=i=>`(function(){
|
||||
"use strict";var snippets=(()=>{var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var u=(i,e)=>{for(var n in e)p(i,n,{get:e[n],enumerable:!0})},a=(i,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!c.call(i,t)&&t!==n&&p(i,t,{get:()=>e[t],enumerable:!(r=f(e,t))||r.enumerable});return i};var h=i=>a(p({},"__esModule",{value:!0}),i);var C={};u(C,{default:()=>x});var o=i=>`(function(){
|
||||
${i}
|
||||
})();`});var w={};W(w,{default:()=>v});var c=d(s()),v=new Proxy({},{get:function(i,e){return e in snippetCache||(snippetCache[e]=[eval][0]((0,c.iifeWrapper)(snippetDefinitions[e]))),snippetCache[e]}});return g(w);})();
|
||||
})();`;var x=new Proxy({},{get:function(i,e){return e in snippetCache||(snippetCache[e]=[eval][0](o(snippetDefinitions[e]))),snippetCache[e]}});return h(C);})();
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
"@budibase/backend-core/*": ["../backend-core/*"],
|
||||
"@budibase/shared-core": ["../shared-core/src"],
|
||||
"@budibase/pro": ["../pro/src"],
|
||||
"@budibase/string-templates": ["../string-templates/src"]
|
||||
"@budibase/string-templates": ["../string-templates/src"],
|
||||
"@budibase/string-templates/*": ["../string-templates/*"]
|
||||
},
|
||||
"allowArbitraryExtensions": true
|
||||
},
|
||||
|
|
|
@ -1,17 +1,29 @@
|
|||
import { date, duration } from "./date"
|
||||
|
||||
import {
|
||||
math,
|
||||
array,
|
||||
number,
|
||||
url,
|
||||
string,
|
||||
comparison,
|
||||
object,
|
||||
regex,
|
||||
uuid,
|
||||
// @ts-expect-error
|
||||
} from "@budibase/handlebars-helpers"
|
||||
/*
|
||||
@budibase/handlebars-helpers is not treeshakeable, so we can't use the barrel files.
|
||||
Otherwise, we have issues when generating the isolated-vm bundle because of the treeshaking
|
||||
*/
|
||||
/* eslint-disable local-rules/no-budibase-imports */
|
||||
// @ts-expect-error
|
||||
import math from "@budibase/handlebars-helpers/lib/math"
|
||||
// @ts-expect-error
|
||||
import array from "@budibase/handlebars-helpers/lib/array"
|
||||
// @ts-expect-error
|
||||
import number from "@budibase/handlebars-helpers/lib/number"
|
||||
// @ts-expect-error
|
||||
import url from "@budibase/handlebars-helpers/lib/url"
|
||||
// @ts-expect-error
|
||||
import string from "@budibase/handlebars-helpers/lib/string"
|
||||
// @ts-expect-error
|
||||
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"
|
||||
/* eslint-enable local-rules/no-budibase-imports */
|
||||
|
||||
// https://github.com/evanw/esbuild/issues/56
|
||||
const externalCollections = {
|
||||
|
@ -42,14 +54,14 @@ export function getJsHelperList() {
|
|||
|
||||
helpers = {}
|
||||
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
|
||||
helpers[key] = (...props: any) => func(...props, {})
|
||||
}
|
||||
}
|
||||
helpers = {
|
||||
...helpers,
|
||||
addedHelpers,
|
||||
...addedHelpers,
|
||||
}
|
||||
|
||||
for (const toRemove of helpersToRemoveForJs) {
|
||||
|
|
Loading…
Reference in New Issue