@canopy-iiif/app 0.6.28 → 0.7.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.
- package/lib/build/assets.js +30 -0
- package/lib/build/build.js +184 -0
- package/lib/{dev.js → build/dev.js} +5 -5
- package/lib/build/facets.js +19 -0
- package/lib/{iiif.js → build/iiif.js} +222 -373
- package/lib/{mdx.js → build/mdx.js} +13 -10
- package/lib/build/pages.js +141 -0
- package/lib/build/runtimes.js +58 -0
- package/lib/build/search-index.js +42 -0
- package/lib/build/search.js +219 -0
- package/lib/build/styles.js +99 -0
- package/lib/{thumbnail.js → iiif/thumbnail.js} +0 -1
- package/lib/index.js +2 -3
- package/lib/{search.js → search/search.js} +8 -8
- package/package.json +1 -1
- package/lib/build.js +0 -762
- package/lib/components/IIIFCard.js +0 -102
- package/lib/runtime/command-entry.jsx +0 -44
- /package/lib/{devtoast.config.json → build/devtoast.config.json} +0 -0
- /package/lib/{devtoast.css → build/devtoast.css} +0 -0
- /package/lib/{log.js → build/log.js} +0 -0
- /package/lib/{search-app.jsx → search/search-app.jsx} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const React = require('react');
|
|
2
2
|
const ReactDOMServer = require('react-dom/server');
|
|
3
3
|
const crypto = require('crypto');
|
|
4
|
-
const { path, withBase } = require('
|
|
5
|
-
const { ensureDirSync, OUT_DIR, htmlShell, fsp } = require('
|
|
4
|
+
const { path, withBase } = require('../common');
|
|
5
|
+
const { ensureDirSync, OUT_DIR, htmlShell, fsp } = require('../common');
|
|
6
6
|
|
|
7
7
|
const FALLBACK_SEARCH_APP = `import React, { useEffect, useMemo, useSyncExternalStore, useState } from 'react';
|
|
8
8
|
import { createRoot } from 'react-dom/client';
|
|
@@ -200,10 +200,10 @@ if (typeof document !== 'undefined') {
|
|
|
200
200
|
`;
|
|
201
201
|
|
|
202
202
|
async function ensureSearchRuntime() {
|
|
203
|
-
const { fs, path } = require('
|
|
203
|
+
const { fs, path } = require('../common');
|
|
204
204
|
ensureDirSync(OUT_DIR);
|
|
205
205
|
let esbuild = null;
|
|
206
|
-
try { esbuild = require('
|
|
206
|
+
try { esbuild = require('../../ui/node_modules/esbuild'); } catch (_) { try { esbuild = require('esbuild'); } catch (_) {} }
|
|
207
207
|
if (!esbuild) { console.warn('Search: skipped bundling (no esbuild)'); return; }
|
|
208
208
|
const entry = path.join(__dirname, 'search-app.jsx');
|
|
209
209
|
const scriptsDir = path.join(OUT_DIR, 'scripts');
|
|
@@ -327,7 +327,7 @@ async function ensureSearchRuntime() {
|
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
329
329
|
try {
|
|
330
|
-
const { logLine } = require('
|
|
330
|
+
const { logLine } = require('../build/log');
|
|
331
331
|
let size = 0; try { const st = fs.statSync(outFile); size = st.size || 0; } catch (_) {}
|
|
332
332
|
const kb = size ? ` (${(size/1024).toFixed(1)} KB)` : '';
|
|
333
333
|
const rel = path.relative(process.cwd(), outFile).split(path.sep).join('/');
|
|
@@ -343,9 +343,9 @@ async function buildSearchPage() {
|
|
|
343
343
|
const searchLayoutPath = path.join(path.resolve('content'), 'search', '_layout.mdx');
|
|
344
344
|
let body = '';
|
|
345
345
|
let head = '';
|
|
346
|
-
if (require('
|
|
346
|
+
if (require('../common').fs.existsSync(searchLayoutPath)) {
|
|
347
347
|
try {
|
|
348
|
-
const mdx = require('
|
|
348
|
+
const mdx = require('../build/mdx');
|
|
349
349
|
const rendered = await mdx.compileMdxFile(searchLayoutPath, outPath, {});
|
|
350
350
|
body = rendered && rendered.body ? rendered.body : '';
|
|
351
351
|
head = rendered && rendered.head ? rendered.head : '';
|
|
@@ -361,7 +361,7 @@ async function buildSearchPage() {
|
|
|
361
361
|
React.createElement('h1', null, 'Search'),
|
|
362
362
|
React.createElement('div', { id: 'search-root' })
|
|
363
363
|
);
|
|
364
|
-
const { loadAppWrapper } = require('
|
|
364
|
+
const { loadAppWrapper } = require('../build/mdx');
|
|
365
365
|
const app = await loadAppWrapper();
|
|
366
366
|
const wrappedApp = app && app.App ? React.createElement(app.App, null, content) : content;
|
|
367
367
|
body = ReactDOMServer.renderToStaticMarkup(wrappedApp);
|