Lines 1938-2016javascript
1938 state[key] = await resolveServerFunction(def2, state, key, base);
1943 state["$media"] = doc.$media;
1944 } else if (!state["$media"] && Object.keys(_rootMedia).length > 0) {
1945 state["$media"] = _rootMedia;
1949function hasSchemaKeywords(obj) {
1950 for (const k of Object.keys(obj)) {
1951 if (SCHEMA_KEYWORDS2.has(k)) {
1957function evaluateTemplate(str, state) {
1958 const $map = state?.$map;
1959 const fn = new Function("state", "$map", "item", "index", `return \`${str}\``);
1960 return fn(state, $map, $map?.item, $map?.index);
LowEval
Package source references a known benign dynamic code generation pattern.
dist/iframe-entry.jsView on unpkg · L1958 1962var _moduleCache = new Map;
1963async function resolveFunction(def2, state, key, base) {
1964 if (def2.body && def2.$src) {
1965 throw new Error(`Jx: '${key}' declares both body and $src — these are mutually exclusive`);
1967 if (!def2.body && !def2.$src) {
1968 const params = resolveParamNames(def2);
1969 const noop = new Function(...params, "");
1970 Object.defineProperty(noop, "name", {
1972 value: def2.name ?? key
1978 const params = resolveParamNames(def2);
1979 fn = new Function(...params, def2.body);
1980 Object.defineProperty(fn, "name", {
1982 value: def2.name ?? key
1985 const src = def2.$src;
1987 throw new Error(`Jx: '${key}' has neither body nor $src`);
1989 const exportName = def2.$export ?? key;
1991 if (_moduleCache.has(src)) {
1992 mod = _moduleCache.get(src);
1995 const resolvedSrc = new URL(src, base).href;
1997 mod = await import(resolvedSrc);
1998 } catch {
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/iframe-entry.jsView on unpkg · L1996 1999 mod = await import(src);
2002 mod = await import(src);
2004 _moduleCache.set(src, mod);
2006 const candidate = mod[exportName] ?? mod.default?.[exportName];
2007 if (typeof candidate !== "function") {
2008 throw new TypeError(`Jx: export "${exportName}" not found or not a function in "${src}"`);
2012 const hasParams = (def2.parameters ?? def2.arguments ?? []).length > 0;
2013 let isComputed = false;
2016 isComputed = /\breturn\b/.test(def2.body);