pi-better-show 0.1.0 → 0.1.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-show",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Interactive blocks for agent-written Markdown: one vocabulary, text fallback, and answer encoding shared by every host, plus the show_doc extension for pi",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,6 +20,7 @@ const PI_KIT = fileURLToPath(new URL("./client/kit.tsx", import.meta.url));
20
20
  /** A package's folder, found from the package that depends on it. */
21
21
  const packageDir = (name: string, from = import.meta.url): string =>
22
22
  realpathSync(dirname(createRequire(from).resolve(`${name}/package.json`)));
23
+ const REACT = packageDir("pbs-page-react");
23
24
  const REACT_DOM = packageDir("pbs-page-react-dom");
24
25
  /**
25
26
  * The package's own sources and the React it ships: what a page imports by name, and what those import in turn.
@@ -29,7 +30,7 @@ const REACT_DOM = packageDir("pbs-page-react-dom");
29
30
  const PACKAGE_SRC = realpathSync(fileURLToPath(new URL("..", import.meta.url)));
30
31
  const TRUSTED_ROOTS = [
31
32
  PACKAGE_SRC,
32
- packageDir("pbs-page-react"),
33
+ REACT,
33
34
  REACT_DOM,
34
35
  packageDir("yaml"),
35
36
  packageDir("scheduler", `${REACT_DOM}/package.json`),
@@ -158,8 +159,10 @@ export async function bundleReactPage(path: string, canServe: (path: string) =>
158
159
  plugins: [confine(path, canServe)],
159
160
  alias: {
160
161
  "pi-kit": PI_KIT,
161
- react: "pbs-page-react",
162
- "react-dom": "pbs-page-react-dom",
162
+ // By path, not by name: a page's project may hold its own pbs-page-react (any project that depends on
163
+ // this package does), which a name would resolve to first and the confine check would refuse.
164
+ react: REACT,
165
+ "react-dom": REACT_DOM,
163
166
  },
164
167
  define: { "process.env.NODE_ENV": '"production"' },
165
168
  loader: { ".css": "empty" },