@pyreon/compiler 0.5.5 → 0.5.7

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.
@@ -5386,7 +5386,7 @@ var drawChart = (function (exports) {
5386
5386
  </script>
5387
5387
  <script>
5388
5388
  /*<!--*/
5389
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"df15a3fb-1","name":"jsx.ts"},{"uid":"df15a3fb-3","name":"project-scanner.ts"},{"uid":"df15a3fb-5","name":"react-intercept.ts"},{"uid":"df15a3fb-7","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"df15a3fb-1":{"renderedLength":24727,"gzipLength":6935,"brotliLength":0,"metaUid":"df15a3fb-0"},"df15a3fb-3":{"renderedLength":4762,"gzipLength":1730,"brotliLength":0,"metaUid":"df15a3fb-2"},"df15a3fb-5":{"renderedLength":27742,"gzipLength":6926,"brotliLength":0,"metaUid":"df15a3fb-4"},"df15a3fb-7":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"df15a3fb-6"}},"nodeMetas":{"df15a3fb-0":{"id":"/src/jsx.ts","moduleParts":{"index.js":"df15a3fb-1"},"imported":[{"uid":"df15a3fb-8"}],"importedBy":[{"uid":"df15a3fb-6"}]},"df15a3fb-2":{"id":"/src/project-scanner.ts","moduleParts":{"index.js":"df15a3fb-3"},"imported":[{"uid":"df15a3fb-9"},{"uid":"df15a3fb-10"}],"importedBy":[{"uid":"df15a3fb-6"}]},"df15a3fb-4":{"id":"/src/react-intercept.ts","moduleParts":{"index.js":"df15a3fb-5"},"imported":[{"uid":"df15a3fb-8"}],"importedBy":[{"uid":"df15a3fb-6"}]},"df15a3fb-6":{"id":"/src/index.ts","moduleParts":{"index.js":"df15a3fb-7"},"imported":[{"uid":"df15a3fb-0"},{"uid":"df15a3fb-2"},{"uid":"df15a3fb-4"}],"importedBy":[],"isEntry":true},"df15a3fb-8":{"id":"typescript","moduleParts":{},"imported":[],"importedBy":[{"uid":"df15a3fb-0"},{"uid":"df15a3fb-4"}]},"df15a3fb-9":{"id":"node:fs","moduleParts":{},"imported":[],"importedBy":[{"uid":"df15a3fb-2"}]},"df15a3fb-10":{"id":"node:path","moduleParts":{},"imported":[],"importedBy":[{"uid":"df15a3fb-2"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
5389
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"03205ca9-1","name":"jsx.ts"},{"uid":"03205ca9-3","name":"project-scanner.ts"},{"uid":"03205ca9-5","name":"react-intercept.ts"},{"uid":"03205ca9-7","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"03205ca9-1":{"renderedLength":24727,"gzipLength":6935,"brotliLength":0,"metaUid":"03205ca9-0"},"03205ca9-3":{"renderedLength":4762,"gzipLength":1730,"brotliLength":0,"metaUid":"03205ca9-2"},"03205ca9-5":{"renderedLength":27692,"gzipLength":6920,"brotliLength":0,"metaUid":"03205ca9-4"},"03205ca9-7":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"03205ca9-6"}},"nodeMetas":{"03205ca9-0":{"id":"/src/jsx.ts","moduleParts":{"index.js":"03205ca9-1"},"imported":[{"uid":"03205ca9-8"}],"importedBy":[{"uid":"03205ca9-6"}]},"03205ca9-2":{"id":"/src/project-scanner.ts","moduleParts":{"index.js":"03205ca9-3"},"imported":[{"uid":"03205ca9-9"},{"uid":"03205ca9-10"}],"importedBy":[{"uid":"03205ca9-6"}]},"03205ca9-4":{"id":"/src/react-intercept.ts","moduleParts":{"index.js":"03205ca9-5"},"imported":[{"uid":"03205ca9-8"}],"importedBy":[{"uid":"03205ca9-6"}]},"03205ca9-6":{"id":"/src/index.ts","moduleParts":{"index.js":"03205ca9-7"},"imported":[{"uid":"03205ca9-0"},{"uid":"03205ca9-2"},{"uid":"03205ca9-4"}],"importedBy":[],"isEntry":true},"03205ca9-8":{"id":"typescript","moduleParts":{},"imported":[],"importedBy":[{"uid":"03205ca9-0"},{"uid":"03205ca9-4"}]},"03205ca9-9":{"id":"node:fs","moduleParts":{},"imported":[],"importedBy":[{"uid":"03205ca9-2"}]},"03205ca9-10":{"id":"node:path","moduleParts":{},"imported":[],"importedBy":[{"uid":"03205ca9-2"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
5390
5390
 
5391
5391
  const run = () => {
5392
5392
  const width = window.innerWidth;
package/lib/index.js CHANGED
@@ -961,7 +961,7 @@ function detectUseEffect(ctx, node) {
961
961
  const callbackArg = node.arguments[0];
962
962
  if (depsArg && ts.isArrayLiteralExpression(depsArg) && depsArg.elements.length === 0) {
963
963
  const hasCleanup = callbackArg ? callbackHasCleanup(callbackArg) : false;
964
- detectDiag(ctx, node, "use-effect-mount", `${hookName} with empty deps [] means "run once on mount". Use onMount() in Pyreon.`, detectGetNodeText(ctx, node), hasCleanup ? "onMount(() => {\n // setup...\n return () => { /* cleanup */ }\n})" : "onMount(() => {\n // setup...\n return undefined\n})", true);
964
+ detectDiag(ctx, node, "use-effect-mount", `${hookName} with empty deps [] means "run once on mount". Use onMount() in Pyreon.`, detectGetNodeText(ctx, node), hasCleanup ? "onMount(() => {\n // setup...\n return () => { /* cleanup */ }\n})" : "onMount(() => {\n // setup...\n})", true);
965
965
  } else if (depsArg && ts.isArrayLiteralExpression(depsArg)) detectDiag(ctx, node, "use-effect-deps", `${hookName} with dependency array. In Pyreon, effect() auto-tracks dependencies — no array needed.`, detectGetNodeText(ctx, node), "effect(() => {\n // reads are auto-tracked\n})", true);
966
966
  else if (!depsArg) detectDiag(ctx, node, "use-effect-no-deps", `${hookName} with no dependency array. In Pyreon, use effect() — it auto-tracks signal reads.`, detectGetNodeText(ctx, node), "effect(() => {\n // runs when accessed signals change\n})", true);
967
967
  }
@@ -1437,9 +1437,9 @@ const ERROR_PATTERNS = [
1437
1437
  {
1438
1438
  pattern: /onMount callback must return/,
1439
1439
  diagnose: () => ({
1440
- cause: "onMount expects a return of CleanupFn | undefined, not void.",
1441
- fix: "Return undefined explicitly, or return a cleanup function.",
1442
- fixCode: "onMount(() => {\n // setup code\n return undefined\n})"
1440
+ cause: "onMount expects a callback that optionally returns a CleanupFn.",
1441
+ fix: "Return a cleanup function, or return nothing.",
1442
+ fixCode: "onMount(() => {\n // setup code\n})"
1443
1443
  })
1444
1444
  },
1445
1445
  {