@getforma/core 0.9.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +20 -1
  2. package/dist/chunk-DCTOXHPF.cjs +399 -0
  3. package/dist/chunk-DCTOXHPF.cjs.map +1 -0
  4. package/dist/chunk-OUVOAYIO.js +359 -0
  5. package/dist/chunk-OUVOAYIO.js.map +1 -0
  6. package/dist/{chunk-YMIMKO4W.cjs → chunk-V732ZBCU.cjs} +119 -511
  7. package/dist/chunk-V732ZBCU.cjs.map +1 -0
  8. package/dist/{chunk-N522P3G6.js → chunk-VTPFK5TJ.js} +89 -442
  9. package/dist/chunk-VTPFK5TJ.js.map +1 -0
  10. package/dist/forma-runtime-csp.js +1 -1
  11. package/dist/forma-runtime.js +1 -1
  12. package/dist/formajs-runtime-hardened.global.js +1 -1
  13. package/dist/formajs-runtime-hardened.global.js.map +1 -1
  14. package/dist/formajs-runtime.global.js +1 -1
  15. package/dist/formajs-runtime.global.js.map +1 -1
  16. package/dist/formajs.global.js +1 -1
  17. package/dist/formajs.global.js.map +1 -1
  18. package/dist/http.cjs +225 -0
  19. package/dist/http.cjs.map +1 -0
  20. package/dist/http.d.cts +108 -0
  21. package/dist/http.d.ts +108 -0
  22. package/dist/http.js +220 -0
  23. package/dist/http.js.map +1 -0
  24. package/dist/index.cjs +71 -607
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +4 -458
  27. package/dist/index.d.ts +4 -458
  28. package/dist/index.js +7 -523
  29. package/dist/index.js.map +1 -1
  30. package/dist/resource-Cd0cGOxS.d.ts +62 -0
  31. package/dist/resource-DK98lW5e.d.cts +62 -0
  32. package/dist/runtime-hardened.cjs +3 -111
  33. package/dist/runtime-hardened.cjs.map +1 -1
  34. package/dist/runtime-hardened.js +4 -112
  35. package/dist/runtime-hardened.js.map +1 -1
  36. package/dist/runtime.cjs +23 -22
  37. package/dist/runtime.cjs.map +1 -1
  38. package/dist/runtime.js +2 -1
  39. package/dist/runtime.js.map +1 -1
  40. package/dist/server.cjs +179 -0
  41. package/dist/server.cjs.map +1 -0
  42. package/dist/server.d.cts +217 -0
  43. package/dist/server.d.ts +217 -0
  44. package/dist/server.js +166 -0
  45. package/dist/server.js.map +1 -0
  46. package/dist/{signal-B4_wQJHs.d.cts → signal-YlS1kgfh.d.cts} +1 -1
  47. package/dist/{signal-B4_wQJHs.d.ts → signal-YlS1kgfh.d.ts} +1 -1
  48. package/dist/storage.cjs +151 -0
  49. package/dist/storage.cjs.map +1 -0
  50. package/dist/storage.d.cts +77 -0
  51. package/dist/storage.d.ts +77 -0
  52. package/dist/storage.js +147 -0
  53. package/dist/storage.js.map +1 -0
  54. package/dist/tc39-compat.d.cts +1 -1
  55. package/dist/tc39-compat.d.ts +1 -1
  56. package/package.json +31 -1
  57. package/dist/chunk-N522P3G6.js.map +0 -1
  58. package/dist/chunk-YMIMKO4W.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { signal, computed, effect, startBatch, endBatch, setActiveSub } from 'alien-signals';
1
+ import { signal, computed, effect, setActiveSub, startBatch, endBatch } from 'alien-signals';
2
2
 
3
3
  // src/reactive/signal.ts
4
4
  function applySignalSet(s, v, equals) {
@@ -888,7 +888,7 @@ var UNSAFE_METHOD_NAMES = /* @__PURE__ */ new Set([
888
888
  "eval",
889
889
  "Function"
890
890
  ]);
891
- var BLOCKED_METHOD_REGEXES = (() => {
891
+ (() => {
892
892
  const result = [];
893
893
  for (const name of UNSAFE_METHOD_NAMES) {
894
894
  const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -902,44 +902,6 @@ var BLOCKED_METHOD_REGEXES = (() => {
902
902
  }
903
903
  return result;
904
904
  })();
905
- function findBlockedMethod(expr) {
906
- let cleaned = expr.replace(/\/\*[\s\S]*?\*\//g, "");
907
- cleaned = cleaned.replace(/\/\/[^\n]*/g, "");
908
- cleaned = cleaned.replace(/\s*\.\s*/g, ".");
909
- for (const { name, dotRe, bracketRe } of BLOCKED_METHOD_REGEXES) {
910
- if (dotRe.test(cleaned)) return name;
911
- if (bracketRe.test(cleaned)) return name;
912
- }
913
- if (cleaned.includes("[")) {
914
- const bracketContents = extractBracketContents(cleaned);
915
- for (const content of bracketContents) {
916
- if (!content.includes("+")) continue;
917
- const fragments = content.match(/['"`]([^'"`]*?)['"`]/g);
918
- if (!fragments) continue;
919
- const joined = fragments.map((f) => f.slice(1, -1)).join("");
920
- if (UNSAFE_METHOD_NAMES.has(joined)) return joined;
921
- }
922
- }
923
- return null;
924
- }
925
- function extractBracketContents(expr) {
926
- const results = [];
927
- let depth = 0;
928
- let start = -1;
929
- for (let i = 0; i < expr.length; i++) {
930
- if (expr[i] === "[") {
931
- if (depth === 0) start = i + 1;
932
- depth++;
933
- } else if (expr[i] === "]") {
934
- depth--;
935
- if (depth === 0 && start >= 0) {
936
- results.push(expr.slice(start, i));
937
- start = -1;
938
- }
939
- }
940
- }
941
- return results;
942
- }
943
905
  var TEXT_BINDING_SYM = /* @__PURE__ */ Symbol.for("forma-text-binding-cache");
944
906
  function toTextValue(value2) {
945
907
  if (value2 == null) return "";
@@ -1943,40 +1905,13 @@ function buildEvaluator(expr, scope) {
1943
1905
  cache.set(cleaned, cspFn);
1944
1906
  return cspFn;
1945
1907
  }
1946
- if (!_allowUnsafeEval) {
1908
+ {
1947
1909
  dbg("buildEvaluator: blocked unsafe eval fallback for expression:", cleaned);
1948
1910
  reportDiagnostic("expression-unsupported", cleaned, cspExpressionHint(cleaned));
1949
1911
  const blocked = () => void 0;
1950
1912
  cache.set(cleaned, blocked);
1951
1913
  return blocked;
1952
1914
  }
1953
- const blockedMethod = findBlockedMethod(cleaned);
1954
- if (blockedMethod) {
1955
- const msg = `Blocked unsafe method "${blockedMethod}" in expression`;
1956
- reportDiagnostic("expression-unsupported", cleaned, msg);
1957
- throw new Error(`[FormaJS] ${msg}: ${cleaned}`);
1958
- }
1959
- try {
1960
- const fn = new Function("__scope", `with(__scope) { return (${cleaned}); }`);
1961
- const proxy = new Proxy(/* @__PURE__ */ Object.create(null), {
1962
- has(_, key) {
1963
- return key in scope.getters;
1964
- },
1965
- get(_, key) {
1966
- if (UNSAFE_METHOD_NAMES.has(key)) return void 0;
1967
- const g = scope.getters[key];
1968
- return g ? g() : void 0;
1969
- }
1970
- });
1971
- const unsafe = () => fn(proxy);
1972
- cache.set(cleaned, unsafe);
1973
- return unsafe;
1974
- } catch {
1975
- reportDiagnostic("expression-unsupported", cleaned, "Expression too complex for CSP-safe mode. Enable unsafe-eval via FormaRuntime.unsafeEval = true, or use the standard (non-hardened) build.");
1976
- const failed = () => void 0;
1977
- cache.set(cleaned, failed);
1978
- return failed;
1979
- }
1980
1915
  }
1981
1916
  function parseHandler(expr, scope) {
1982
1917
  const normalized = expr.trim().replace(/;+$/g, "").trim();
@@ -2094,7 +2029,7 @@ function buildHandler(expr, scope) {
2094
2029
  cache.set(cleaned, result);
2095
2030
  return result;
2096
2031
  }
2097
- if (!_allowUnsafeEval) {
2032
+ {
2098
2033
  dbg("buildHandler: blocked unsafe eval fallback for expression:", cleaned);
2099
2034
  reportDiagnostic("handler-unsupported", cleaned, cspExpressionHint(cleaned));
2100
2035
  const result = {
@@ -2105,49 +2040,6 @@ function buildHandler(expr, scope) {
2105
2040
  cache.set(cleaned, result);
2106
2041
  return result;
2107
2042
  }
2108
- const blockedMethod = findBlockedMethod(cleaned);
2109
- if (blockedMethod) {
2110
- const msg = `Blocked unsafe method "${blockedMethod}" in handler`;
2111
- reportDiagnostic("handler-unsupported", cleaned, msg);
2112
- throw new Error(`[FormaJS] ${msg}: ${cleaned}`);
2113
- }
2114
- try {
2115
- const fn = new Function("__scope", "$event", "event", `with(__scope) { ${cleaned} }`);
2116
- const proxy = new Proxy(/* @__PURE__ */ Object.create(null), {
2117
- has(_, key) {
2118
- if (key === "$event" || key === "event") return false;
2119
- return key in scope.getters || key in scope.setters;
2120
- },
2121
- get(_, key) {
2122
- if (UNSAFE_METHOD_NAMES.has(key)) return void 0;
2123
- const g = scope.getters[key];
2124
- return g ? g() : void 0;
2125
- },
2126
- set(_, key, value2) {
2127
- const s = scope.setters[key];
2128
- if (s) s(value2);
2129
- return true;
2130
- }
2131
- });
2132
- const unsafeHandler = (e) => {
2133
- batch(() => fn(proxy, e, e));
2134
- };
2135
- const result = {
2136
- handler: unsafeHandler,
2137
- supported: true
2138
- };
2139
- cache.set(cleaned, result);
2140
- return result;
2141
- } catch {
2142
- reportDiagnostic("handler-unsupported", cleaned, "Expression too complex for CSP-safe mode. Enable unsafe-eval via FormaRuntime.unsafeEval = true, or use the standard (non-hardened) build.");
2143
- const result = {
2144
- handler: () => {
2145
- },
2146
- supported: false
2147
- };
2148
- cache.set(cleaned, result);
2149
- return result;
2150
- }
2151
2043
  }
2152
2044
  var FORBIDDEN_STATE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
2153
2045
  function parseState(raw) {