fix prod
This commit is contained in:
parent
bfd22ae55b
commit
06a3c9fbdc
|
|
@ -278,7 +278,7 @@ export const _ = {
|
||||||
const src_path = dir.path(`/app/srv/core/${pathname}`);
|
const src_path = dir.path(`/app/srv/core/${pathname}`);
|
||||||
|
|
||||||
if (!g.main_cache) g.main_cache = {};
|
if (!g.main_cache) g.main_cache = {};
|
||||||
if (!g.main_cache[src_path]) {
|
if (!g.main_cache[src_path] && g.mode === "prod") {
|
||||||
if (!g.br) {
|
if (!g.br) {
|
||||||
g.br = await brotliPromise;
|
g.br = await brotliPromise;
|
||||||
}
|
}
|
||||||
|
|
@ -294,6 +294,7 @@ export const _ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
g.mode === "prod" &&
|
||||||
req.headers.get("accept-encoding")?.includes("br") &&
|
req.headers.get("accept-encoding")?.includes("br") &&
|
||||||
g.main_cache[src_path]
|
g.main_cache[src_path]
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -25,6 +25,7 @@ export const ViScript: FC<{
|
||||||
viEvalProps(vi, meta, is_layout, _pass, depth, parent_key);
|
viEvalProps(vi, meta, is_layout, _pass, depth, parent_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (meta.item.adv?.html) {
|
if (meta.item.adv?.html) {
|
||||||
return (
|
return (
|
||||||
<ViChild
|
<ViChild
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ export const viEvalProps = (
|
||||||
|
|
||||||
const js = prop.valueBuilt || "";
|
const js = prop.valueBuilt || "";
|
||||||
const src = replaceWithObject(js, replacement) || "";
|
const src = replaceWithObject(js, replacement) || "";
|
||||||
|
|
||||||
const fn = new Function(
|
const fn = new Function(
|
||||||
...Object.keys(arg),
|
...Object.keys(arg),
|
||||||
`// [${meta.item.name}] ${name}: ${meta.item.id}
|
`// [${meta.item.name}] ${name}: ${meta.item.id}
|
||||||
|
|
@ -151,9 +152,16 @@ export const viEvalProps = (
|
||||||
let val = fn(...Object.values(arg));
|
let val = fn(...Object.values(arg));
|
||||||
|
|
||||||
if (typeof val === "function") {
|
if (typeof val === "function") {
|
||||||
script.props[name].fn = val;
|
|
||||||
val = (...args: any[]) => {
|
val = (...args: any[]) => {
|
||||||
return meta.item.script?.props?.[name].fn(...args);
|
const definer = new Function(
|
||||||
|
...Object.keys(arg),
|
||||||
|
`// [${meta.item.name}] ${name}: ${meta.item.id}
|
||||||
|
return ${src}
|
||||||
|
`
|
||||||
|
);
|
||||||
|
|
||||||
|
const fn = definer(...Object.values(arg));
|
||||||
|
return fn(...args);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export const createViPassProp = (
|
||||||
}
|
}
|
||||||
|
|
||||||
let script = meta.item.script;
|
let script = meta.item.script;
|
||||||
if (internal_key) {
|
if (typeof internal_key !== "undefined") {
|
||||||
if (!meta.item.script_keyed) {
|
if (!meta.item.script_keyed) {
|
||||||
meta.item.script_keyed = {};
|
meta.item.script_keyed = {};
|
||||||
}
|
}
|
||||||
|
|
@ -37,18 +37,27 @@ export const createViPassProp = (
|
||||||
script.passprop = {};
|
script.passprop = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const script_pass: any = {};
|
const filtered_args: any = {};
|
||||||
if (script.passprop) {
|
|
||||||
let is_changed = false;
|
let is_changed = false;
|
||||||
for (const [k, v] of Object.entries(arg)) {
|
for (const [k, v] of Object.entries(arg)) {
|
||||||
if (!["children", "key"].includes(k)) {
|
if (!["children", "key"].includes(k)) {
|
||||||
is_changed = true;
|
is_changed = true;
|
||||||
script_pass[k] = v;
|
filtered_args[k] = v;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const _pass = { ...passprop, ...script_pass };
|
let _pass = { ...passprop, ...filtered_args };
|
||||||
|
|
||||||
|
if (typeof internal_key !== "undefined") {
|
||||||
|
if (typeof script.passprop.internal_key === "undefined") {
|
||||||
|
script.passprop = _pass;
|
||||||
|
} else if (internal_key === script.passprop.internal_key) {
|
||||||
|
script.passprop = _pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
_pass = script.passprop;
|
||||||
|
}
|
||||||
|
|
||||||
meta.editor_props = _pass;
|
meta.editor_props = _pass;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue