canvas-free.openapps.xyz

Source

This app’s code and revision history are public. Download a copy or explore the files below.

Public
The app’s code and revision history are public.
Owned app · rev 93fdaafeda16
Run it yourself
Take the whole tree and run it on your own machine. The download needs no account. Cloning needs a sign-in.
Download .zip
bounded clone 788ba0fa01083b300ad50913
A copy you download is not bounded. The guarantees this app runs under - declared egress, proven invariants, writes that fail closed - live in the runtime serving this page, not in the files. What you get is auditable source you can read and run, with no runtime guarantees attached.
← All files
vite.config.ts
import { defineConfig, type Plugin } from "vite";
import react from "@vitejs/plugin-react";
import { templatePages } from "./template-pages";

// Leaves out two parts of Excalidraw that Canvas does not use: its translations (Canvas is in English)
// and its Mermaid importer (several MB of diagram libraries). That keeps the site small enough to
// publish in one piece. Pasted Mermaid text lands on the board as plain text instead.
function leaveOutUnused(): Plugin {
  return {
    name: "canvas-leave-out-unused",
    enforce: "pre",
    resolveId(source, importer) {
      if (source === "@excalidraw/mermaid-to-excalidraw") return "\0canvas-no-mermaid";
      if (importer?.includes("@excalidraw/excalidraw") && /\/locales\/(?!en-|percentages)[a-z]{2,3}(-[A-Z]{2,3})?-[A-Z0-9]+\.js$/.test(source)) return "\0canvas-no-locale";
      return null;
    },
    load(id) {
      if (id === "\0canvas-no-mermaid") return 'export async function parseMermaidToExcalidraw() { throw new Error("Mermaid is not included in Canvas."); }';
      if (id === "\0canvas-no-locale") return "export default {};";
      return null;
    },
  };
}

export default defineConfig({
  plugins: [leaveOutUnused(), react(), templatePages()],
  server: { port: 4342, strictPort: true },
  preview: { port: 4342, strictPort: true },
  build: {
    target: "es2020",
    chunkSizeWarningLimit: 2000,
    rollupOptions: {
      output: {
        // Excalidraw's font-subsetting worker (used when exporting) imports these two small modules;
        // in their own chunk the worker loads without pulling in the page's code, which needs a window.
        manualChunks: (id) => (/@excalidraw\/excalidraw\/dist\/prod\/chunk-(ZUYEQ4TG|SRAX5OIU)\.js$/.test(id) ? "excalidraw-env" : undefined),
      },
    },
  },
  define: { "process.env.IS_PREACT": JSON.stringify("false") },
});

Change history

Point OpenApps links to openapps.free
93fdaafeda · 18 hours ago
Bind AGENT_ADDRESS in policy constants
bf8f43b096 · 20 hours ago
Use functions.openapps.xyz alias, add OpenApp contribution strip
56f1a381b2 · 20 hours ago
Bounded source sync
9ec707aeb8 · 1 day ago
Bounded source sync
5645481c23 · 1 day ago
Bounded source sync
c38fe71874 · 1 day ago
Bounded source sync
28c0350b40 · 1 day ago