diff --git a/package-lock.json b/package-lock.json index 1730d5251..093746852 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@thegetty/quire", - "version": "1.0.0-rc.33", + "version": "1.0.0-rc.34", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@thegetty/quire", - "version": "1.0.0-rc.33", + "version": "1.0.0-rc.34", "license": "SEE LICENSE IN https://github.com/thegetty/quire/blob/main/LICENSE", "workspaces": [ "packages/*" @@ -2132,6 +2132,90 @@ "node": ">= 8" } }, + "node_modules/@pagefind/darwin-arm64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/darwin-arm64/-/darwin-arm64-1.4.0.tgz", + "integrity": "sha512-2vMqkbv3lbx1Awea90gTaBsvpzgRs7MuSgKDxW0m9oV1GPZCZbZBJg/qL83GIUEN2BFlY46dtUZi54pwH+/pTQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@pagefind/darwin-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/darwin-x64/-/darwin-x64-1.4.0.tgz", + "integrity": "sha512-e7JPIS6L9/cJfow+/IAqknsGqEPjJnVXGjpGm25bnq+NPdoD3c/7fAwr1OXkG4Ocjx6ZGSCijXEV4ryMcH2E3A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@pagefind/freebsd-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/freebsd-x64/-/freebsd-x64-1.4.0.tgz", + "integrity": "sha512-WcJVypXSZ+9HpiqZjFXMUobfFfZZ6NzIYtkhQ9eOhZrQpeY5uQFqNWLCk7w9RkMUwBv1HAMDW3YJQl/8OqsV0Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@pagefind/linux-arm64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/linux-arm64/-/linux-arm64-1.4.0.tgz", + "integrity": "sha512-PIt8dkqt4W06KGmQjONw7EZbhDF+uXI7i0XtRLN1vjCUxM9vGPdtJc2mUyVPevjomrGz5M86M8bqTr6cgDp1Uw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pagefind/linux-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/linux-x64/-/linux-x64-1.4.0.tgz", + "integrity": "sha512-z4oddcWwQ0UHrTHR8psLnVlz6USGJ/eOlDPTDYZ4cI8TK8PgwRUPQZp9D2iJPNIPcS6Qx/E4TebjuGJOyK8Mmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pagefind/windows-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/windows-x64/-/windows-x64-1.4.0.tgz", + "integrity": "sha512-NkT+YAdgS2FPCn8mIA9bQhiBs+xmniMGq1LFPDhcFn0+2yIUEiIG06t7bsZlhdjknEQRTSdT7YitP6fC5qwP0g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@parcel/watcher": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz", @@ -10567,12 +10651,6 @@ "node": ">=12" } }, - "node_modules/lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", - "license": "MIT" - }, "node_modules/luxon": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.6.1.tgz", @@ -12090,6 +12168,24 @@ "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", "license": "CC0-1.0" }, + "node_modules/pagefind": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/pagefind/-/pagefind-1.4.0.tgz", + "integrity": "sha512-z2kY1mQlL4J8q5EIsQkLzQjilovKzfNVhX8De6oyE6uHpfFtyBaqUpcl/XzJC/4fjD8vBDyh1zolimIcVrCn9g==", + "dev": true, + "license": "MIT", + "bin": { + "pagefind": "lib/runner/bin.cjs" + }, + "optionalDependencies": { + "@pagefind/darwin-arm64": "1.4.0", + "@pagefind/darwin-x64": "1.4.0", + "@pagefind/freebsd-x64": "1.4.0", + "@pagefind/linux-arm64": "1.4.0", + "@pagefind/linux-x64": "1.4.0", + "@pagefind/windows-x64": "1.4.0" + } + }, "node_modules/pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", @@ -16526,7 +16622,6 @@ "fs-extra": "^11.2.0", "iiif-builder": "^1.0.7", "lit": "^3.1.2", - "lunr": "^2.3.9", "template-polyfill": "^2.0.0", "vite": "^6.3.6" }, @@ -16581,6 +16676,7 @@ "markdown-it-footnote": "^4.0.0", "mime-types": "^2.1.35", "module-alias": "^2.2.2", + "pagefind": "^1.4.0", "path": "^0.12.7", "prettier": "^3.2.5", "remove-markdown": "^0.5.0", @@ -16588,12 +16684,23 @@ "rollup-plugin-scss": "^3.0.0", "sass": "^1.70.0", "sharp": "^0.33.2", + "sinon": "^21.0.0", "toml": "^3.0.0" }, "engines": { "node": ">=22" } }, + "packages/11ty/node_modules/@sinonjs/fake-timers": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-15.1.0.tgz", + "integrity": "sha512-cqfapCxwTGsrR80FEgOoPsTonoefMBY7dnUEbQ+GRcved0jvkJLzvX6F4WtN+HBqbPX/SiFsIRUp+IrCW/2I2w==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.1" + } + }, "packages/11ty/node_modules/cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -16613,6 +16720,16 @@ "yarn": ">=1" } }, + "packages/11ty/node_modules/diff": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz", + "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, "packages/11ty/node_modules/jsdom": { "version": "24.1.3", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-24.1.3.tgz", @@ -16661,6 +16778,24 @@ "dev": true, "license": "MIT" }, + "packages/11ty/node_modules/sinon": { + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-21.0.1.tgz", + "integrity": "sha512-Z0NVCW45W8Mg5oC/27/+fCqIHFnW8kpkFOq0j9XJIev4Ld0mKmERaZv5DMLAb9fGCevjKwaEeIQz5+MBXfZcDw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.1", + "@sinonjs/fake-timers": "^15.1.0", + "@sinonjs/samsam": "^8.0.3", + "diff": "^8.0.2", + "supports-color": "^7.2.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/sinon" + } + }, "packages/cli": { "name": "@thegetty/quire-cli", "version": "1.0.0-rc.33", @@ -16694,6 +16829,7 @@ "quire": "bin/cli.js" }, "devDependencies": { + "ava": "^6.2.0", "eslint": "^8.32.0", "esmock": "^2.7.3", "jsdoc-to-markdown": "^9.1.1", @@ -18018,6 +18154,48 @@ "fastq": "^1.6.0" } }, + "@pagefind/darwin-arm64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/darwin-arm64/-/darwin-arm64-1.4.0.tgz", + "integrity": "sha512-2vMqkbv3lbx1Awea90gTaBsvpzgRs7MuSgKDxW0m9oV1GPZCZbZBJg/qL83GIUEN2BFlY46dtUZi54pwH+/pTQ==", + "dev": true, + "optional": true + }, + "@pagefind/darwin-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/darwin-x64/-/darwin-x64-1.4.0.tgz", + "integrity": "sha512-e7JPIS6L9/cJfow+/IAqknsGqEPjJnVXGjpGm25bnq+NPdoD3c/7fAwr1OXkG4Ocjx6ZGSCijXEV4ryMcH2E3A==", + "dev": true, + "optional": true + }, + "@pagefind/freebsd-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/freebsd-x64/-/freebsd-x64-1.4.0.tgz", + "integrity": "sha512-WcJVypXSZ+9HpiqZjFXMUobfFfZZ6NzIYtkhQ9eOhZrQpeY5uQFqNWLCk7w9RkMUwBv1HAMDW3YJQl/8OqsV0Q==", + "dev": true, + "optional": true + }, + "@pagefind/linux-arm64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/linux-arm64/-/linux-arm64-1.4.0.tgz", + "integrity": "sha512-PIt8dkqt4W06KGmQjONw7EZbhDF+uXI7i0XtRLN1vjCUxM9vGPdtJc2mUyVPevjomrGz5M86M8bqTr6cgDp1Uw==", + "dev": true, + "optional": true + }, + "@pagefind/linux-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/linux-x64/-/linux-x64-1.4.0.tgz", + "integrity": "sha512-z4oddcWwQ0UHrTHR8psLnVlz6USGJ/eOlDPTDYZ4cI8TK8PgwRUPQZp9D2iJPNIPcS6Qx/E4TebjuGJOyK8Mmg==", + "dev": true, + "optional": true + }, + "@pagefind/windows-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/windows-x64/-/windows-x64-1.4.0.tgz", + "integrity": "sha512-NkT+YAdgS2FPCn8mIA9bQhiBs+xmniMGq1LFPDhcFn0+2yIUEiIG06t7bsZlhdjknEQRTSdT7YitP6fC5qwP0g==", + "dev": true, + "optional": true + }, "@parcel/watcher": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz", @@ -18524,7 +18702,6 @@ "lit": "^3.1.2", "locale-en-us": "^0.0.2", "loglevel": "^1.9.1", - "lunr": "^2.3.9", "markdown-it": "^14.0.0", "markdown-it-anchor": "^8.6.7", "markdown-it-attrs": "^4.1.6", @@ -18533,6 +18710,7 @@ "markdown-it-footnote": "^4.0.0", "mime-types": "^2.1.35", "module-alias": "^2.2.2", + "pagefind": "^1.4.0", "path": "^0.12.7", "prettier": "^3.2.5", "remove-markdown": "^0.5.0", @@ -18540,11 +18718,21 @@ "rollup-plugin-scss": "^3.0.0", "sass": "^1.70.0", "sharp": "^0.33.2", + "sinon": "^21.0.0", "template-polyfill": "^2.0.0", "toml": "^3.0.0", "vite": "^6.3.6" }, "dependencies": { + "@sinonjs/fake-timers": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-15.1.0.tgz", + "integrity": "sha512-cqfapCxwTGsrR80FEgOoPsTonoefMBY7dnUEbQ+GRcved0jvkJLzvX6F4WtN+HBqbPX/SiFsIRUp+IrCW/2I2w==", + "dev": true, + "requires": { + "@sinonjs/commons": "^3.0.1" + } + }, "cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -18554,6 +18742,12 @@ "cross-spawn": "^7.0.1" } }, + "diff": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz", + "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==", + "dev": true + }, "jsdom": { "version": "24.1.3", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-24.1.3.tgz", @@ -18588,6 +18782,19 @@ "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz", "integrity": "sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==", "dev": true + }, + "sinon": { + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-21.0.1.tgz", + "integrity": "sha512-Z0NVCW45W8Mg5oC/27/+fCqIHFnW8kpkFOq0j9XJIev4Ld0mKmERaZv5DMLAb9fGCevjKwaEeIQz5+MBXfZcDw==", + "dev": true, + "requires": { + "@sinonjs/commons": "^3.0.1", + "@sinonjs/fake-timers": "^15.1.0", + "@sinonjs/samsam": "^8.0.3", + "diff": "^8.0.2", + "supports-color": "^7.2.0" + } } } }, @@ -18595,6 +18802,7 @@ "version": "file:packages/cli", "requires": { "ajv": "^8.16.0", + "ava": "^6.2.0", "boxen": "^7.0.1", "chalk": "^5.2.0", "commander": "^12.1.0", @@ -23601,11 +23809,6 @@ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==" }, - "lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==" - }, "luxon": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.6.1.tgz", @@ -24554,6 +24757,20 @@ } } }, + "pagefind": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/pagefind/-/pagefind-1.4.0.tgz", + "integrity": "sha512-z2kY1mQlL4J8q5EIsQkLzQjilovKzfNVhX8De6oyE6uHpfFtyBaqUpcl/XzJC/4fjD8vBDyh1zolimIcVrCn9g==", + "dev": true, + "requires": { + "@pagefind/darwin-arm64": "1.4.0", + "@pagefind/darwin-x64": "1.4.0", + "@pagefind/freebsd-x64": "1.4.0", + "@pagefind/linux-arm64": "1.4.0", + "@pagefind/linux-x64": "1.4.0", + "@pagefind/windows-x64": "1.4.0" + } + }, "pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", diff --git a/package.json b/package.json index 55876374b..a57e7a3b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@thegetty/quire", - "version": "1.0.0-rc.33", + "version": "1.0.0-rc.34", "private": true, "description": "a multi-format book publishing framework", "author": "Getty Digital", diff --git a/packages/11ty/_includes/components/head-tags/pagefind.js b/packages/11ty/_includes/components/head-tags/pagefind.js new file mode 100644 index 000000000..d49c5780b --- /dev/null +++ b/packages/11ty/_includes/components/head-tags/pagefind.js @@ -0,0 +1,37 @@ +/* eslint-disable camelcase */ +import { html } from 'common-tags' + +/** + * Renders
data tags for PageFind search + * + * @param {Object} eleventyConfig + * + * @return {String} HTML meta elements + */ +export default function (eleventyConfig) { + const contributors = eleventyConfig.getFilter('contributors') + const removeHTML = eleventyConfig.getFilter('removeHTML') + + return function ({ page, layout }) { + if (!page) { + return + } + + const meta = [ + { + property: 'type', + content: layout + } + ] + + if (page.contributor) { + const contributorContent = contributors({ context: page.contributor, format: 'string', type: 'primary' }) + meta.push({ + property: 'contributors', + content: removeHTML(contributorContent) + }) + } + + return html`${meta.map(({ property, content }) => ``)}` + } +} diff --git a/packages/11ty/_includes/components/head.js b/packages/11ty/_includes/components/head.js index b6568d75d..f5b0920b5 100644 --- a/packages/11ty/_includes/components/head.js +++ b/packages/11ty/_includes/components/head.js @@ -12,6 +12,7 @@ export default function (eleventyConfig) { const opengraph = eleventyConfig.getFilter('opengraph') const removeHTML = eleventyConfig.getFilter('removeHTML') const twitterCard = eleventyConfig.getFilter('twitterCard') + const pagefind = eleventyConfig.getFilter('pagefind') const { application, publication } = eleventyConfig.globalData @@ -70,6 +71,8 @@ export default function (eleventyConfig) { ${twitterCard({ abstract, cover, layout })} + ${pagefind({ page, layout })} + diff --git a/packages/11ty/_includes/components/index.js b/packages/11ty/_includes/components/index.js index b17b444db..d12facfcf 100644 --- a/packages/11ty/_includes/components/index.js +++ b/packages/11ty/_includes/components/index.js @@ -54,6 +54,7 @@ export { default as modal } from './modal/index.js' export { default as navigation } from './navigation.js' export { default as opengraph } from './head-tags/opengraph.js' export { default as pageButtons } from './page-buttons.js' +export { default as pagefind } from './head-tags/pagefind.js' export { default as pageHeader } from './page-header.js' export { default as pageTitle } from './page-title.js' export { default as search } from './search.js' diff --git a/packages/11ty/_includes/components/search.js b/packages/11ty/_includes/components/search.js index 33839054c..7c2c5efab 100644 --- a/packages/11ty/_includes/components/search.js +++ b/packages/11ty/_includes/components/search.js @@ -9,8 +9,6 @@ import { html } from '#lib/common-tags/index.js' export default function (eleventyConfig) { const icon = eleventyConfig.getFilter('icon') return (params) => { - const { url } = params.publication - const searchIndex = new URL('search-index.json', url) return html`This is a test page.
', + inputPath: 'path/to/page1.html', + outputPath: '_site/page1.html' + }, + { + url: 'https://example.com/test-publication/page2/', + content: 'This is another test page.
', + inputPath: 'path/to/page2.html', + outputPath: '_site/page2.html' + } +] + +const collections = { + html: [ + { + path: 'page-1.md', + outputPath: 'page-1.html', + data: { + canonicalURL: 'https://example.com/test-publication/page1/index.html', + page: { + figures: [ + stubData.config.figures.figure_list[0] + ] + }, + title: 'Test Page 1', + label: 'A', + subtitle: 'subtitle' + } + }, + { + path: 'page-2.md', + outputPath: 'page-2.html', + data: { + canonicalURL: 'https://example.com/test-publication/page2/index.html', + page: { } + } + }, + { + path: 'page-3.md', + outputPath: 'page-3.html', + data: { + search: false, + page: { + canonicalURL: 'https://example.com/test-publication/page3/index.html', + figures: [ + stubData.config.figures.figure_list[0] + ] + }, + title: 'Test Page 2', + label: '', + subtitle: '' + } + } + ] +} + +const figureRecords = [ + { + content: 'This is a test figure.', + language: 'en-us', + meta: { + credit: 'John Doe', + image: '/_assets/images/figure1.jpg', + image_alt: 'A photo of a tree', + pageTitle: 'A|Test Page 1: subtitle', + title: 'Figure 1', + type: 'image' + }, + url: 'https://example.com/test-publication/page1/index.html#fig1' + } +] + +function FakePagefindIndex (sandbox) { + return { + addHTMLFile: sandbox.stub().resolves(), + addCustomRecord: sandbox.stub().resolves(), + writeFiles: sandbox.stub().resolves() + } +} + +// Initialize Eleventy and pass into test context +test.before('Stub the eleventy environment', async (t) => { + const eleventy = await initEleventyEnvironment(stubData) + + t.context.eleventy = eleventy + // Build the site + await eleventy.toJSON() +}) + +test('Validate page records added to PageFind index', async (t) => { + const sandbox = sinon.createSandbox() + + const { eleventy } = t.context + + const eleventyConfig = eleventy.writer.userConfig + + const search = new SearchIndex(eleventyConfig, { dirName: '_search' }) + // Stub out the index + search.index = FakePagefindIndex(sandbox) + + // Check we can use an 11ty result like we get from eleventy.after to add page records, + // and check that the stubs are working. + await Promise.all( + results.map(async ({ url, content }) => { + await search.addPageRecord({ url, content }) + }) + ) + + t.is(search.index.addHTMLFile.callCount, results.length, 'All HTML files were indexed') + results.forEach((result, index) => { + const { url, content } = result + t.assert( + search.index.addHTMLFile.getCall(index).calledWith({ url, content }) + ) + }) + + // Make sure the index can be written. + const outputPath = '_site/_search' + await search.write(outputPath) + t.deepEqual( + search.index.writeFiles.getCall(0).args[0], + { outputPath } + ) +}) + +test('Validate figure records added to PageFind index', async (t) => { + const sandbox = sinon.createSandbox() + + const { eleventy } = t.context + + // Build the site + await eleventy.toJSON() + const eleventyConfig = eleventy.writer.userConfig + + const search = new SearchIndex(eleventyConfig, { indexFigures: true }) + // Stub out the index + search.index = FakePagefindIndex(sandbox) + + await Promise.all(collections.html.map(async ({ data }) => { + await search.addFiguresFromPage(data) + })) + + t.is( + search.index.addCustomRecord.callCount, figureRecords.length, + 'Only figures from pages with search enabled were indexed' + ) + + figureRecords.forEach((record, index) => { + t.deepEqual( + search.index.addCustomRecord.getCall(index).args[0], + record + ) + }) +}) diff --git a/packages/11ty/content/_assets/javascript/application/index.js b/packages/11ty/content/_assets/javascript/application/index.js index 0ab72e125..d6ab22fb1 100644 --- a/packages/11ty/content/_assets/javascript/application/index.js +++ b/packages/11ty/content/_assets/javascript/application/index.js @@ -17,7 +17,6 @@ import '../../styles/custom.css' import './soundcloud-api.min.js' import { goToFigureState, setUpUIEventHandlers } from './canvas-panel.js' import Accordion from './accordion.js' -import Search from '../../../../_plugins/search/search.js' import scrollToHash from './scroll-to-hash.js' /** @@ -66,37 +65,51 @@ window.toggleSearch = () => { /** * search - * @description makes a search query using Lunr + * @description makes a search query using Pagefind */ -window.search = () => { +window.search = async () => { const searchInput = document.getElementById('js-search-input') const searchQuery = searchInput.value + if (window._searchResults) { + await window._searchResults + } + window._searchResults = updateSearchResults(searchQuery) +} + +/** + * updateSearchResults + * @description fetch and display search results from Pagefind + * @param {string} query The search query string + */ +async function updateSearchResults (query) { const searchInstance = window.QUIRE_SEARCH + const searchResults = await searchInstance.search(query) + await displaySearchResults(searchResults) + window._searchResults = undefined +} + +/** + * displaySearchResults + * @description add search results items to the results container + * @param {object} pageFindResults The search results object from Pagefind + */ +async function displaySearchResults ({ results }) { const resultsContainer = document.getElementById('js-search-results-list') const resultsTemplate = document.getElementById('js-search-results-template') - if (searchQuery.length >= 3) { - const searchResults = searchInstance.search(searchQuery) - displayResults(searchResults) - } - - function clearResults () { - resultsContainer.innerText = '' - } + resultsContainer.innerText = '' - function displayResults (results) { - clearResults() - results.forEach(result => { - const clone = document.importNode(resultsTemplate.content, true) - const item = clone.querySelector('.js-search-results-item') - const title = clone.querySelector('.js-search-results-item-title') - const type = clone.querySelector('.js-search-results-item-type') - const length = clone.querySelector('.js-search-results-item-length') - item.href = result.url - title.textContent = result.title - type.textContent = result.type - length.textContent = result.length - resultsContainer.appendChild(clone) - }) + for (const rawResult of results) { + const result = await rawResult.data() + const clone = document.importNode(resultsTemplate.content, true) + const item = clone.querySelector('.js-search-results-item') + const title = clone.querySelector('.js-search-results-item-title') + const type = clone.querySelector('.js-search-results-item-type') + const length = clone.querySelector('.js-search-results-item-length') + item.href = result.url + title.textContent = result.meta.title + type.textContent = result.meta.type + length.textContent = result.word_count + resultsContainer.appendChild(clone) } } @@ -155,22 +168,10 @@ function globalSetup () { * @description Load full-text index data from the specified URL * and pass it to the search module. */ -function loadSearchData () { - // Grab search data - const dataURL = document.getElementById('js-search').dataset.searchIndex - if (!dataURL) { - console.warn('Search data url is undefined') - return - } - fetch(dataURL).then(async (response) => { - const { ok, statusText, url } = response - if (!ok) { - console.warn(`Search data ${statusText.toLowerCase()} at ${url}`) - return - } - const data = await response.json() - window.QUIRE_SEARCH = new Search(data) - }) +async function loadSearchData () { + // Import path must exactly match the string in rollupOptions.external + const pagefind = await import('../../../_search/pagefind.js') + window.QUIRE_SEARCH = pagefind } /** diff --git a/packages/11ty/eslint.config.js b/packages/11ty/eslint.config.js index b52ba7746..f083e9b9b 100644 --- a/packages/11ty/eslint.config.js +++ b/packages/11ty/eslint.config.js @@ -17,6 +17,9 @@ export default [ { files: ['**/*.js'] }, + { + ignores: ['**/pagefind*.js'] + }, { languageOptions: { globals: { diff --git a/packages/11ty/package-lock.json b/packages/11ty/package-lock.json index 895c67b34..93b3b0cfa 100644 --- a/packages/11ty/package-lock.json +++ b/packages/11ty/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "@thegetty/quire-11ty", - "version": "1.0.0-rc.35", + "version": "1.0.0-rc.37", "license": "SEE LICENSE IN https://github.com/thegetty/quire/blob/main/LICENSE", "dependencies": { "@iiif/helpers": "^1.3.1", @@ -15,11 +15,11 @@ "fs-extra": "^11.2.0", "iiif-builder": "^1.0.7", "lit": "^3.1.2", - "lunr": "^2.3.9", - "template-polyfill": "^2.0.0" + "template-polyfill": "^2.0.0", + "vite": "^6.3.6" }, "devDependencies": { - "@11ty/eleventy": "<=3.1.0", + "@11ty/eleventy": "<=3.1.2", "@11ty/eleventy-fetch": "^5.1.0", "@11ty/eleventy-img": "^6.0.1", "@11ty/eleventy-navigation": "^1.0.1", @@ -45,6 +45,7 @@ "cpy-cli": "^5.0.0", "cross-env": "^7.0.3", "del-cli": "^5.1.0", + "esbuild": "<=0.25.9", "eslint": "^8.57.0", "eslint-config-standard": "^17.1.0", "eslint-plugin-import": "^2.29.1", @@ -68,6 +69,7 @@ "markdown-it-footnote": "^4.0.0", "mime-types": "^2.1.35", "module-alias": "^2.2.2", + "pagefind": "^1.4.0", "path": "^0.12.7", "prettier": "^3.2.5", "remove-markdown": "^0.5.0", @@ -75,10 +77,11 @@ "rollup-plugin-scss": "^3.0.0", "sass": "^1.70.0", "sharp": "^0.33.2", + "sinon": "^21.0.0", "toml": "^3.0.0" }, "engines": { - "node": ">=20.1.0" + "node": ">=22" } }, "node_modules/@11ty/dependency-tree": { @@ -833,7 +836,6 @@ "cpu": [ "ppc64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -850,7 +852,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -867,7 +868,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -884,7 +884,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -901,7 +900,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -918,7 +916,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -935,7 +932,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -952,7 +948,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -969,7 +964,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -986,7 +980,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1003,7 +996,6 @@ "cpu": [ "ia32" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1020,7 +1012,6 @@ "cpu": [ "loong64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1037,7 +1028,6 @@ "cpu": [ "mips64el" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1054,7 +1044,6 @@ "cpu": [ "ppc64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1071,7 +1060,6 @@ "cpu": [ "riscv64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1088,7 +1076,6 @@ "cpu": [ "s390x" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1105,7 +1092,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1122,7 +1108,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1139,7 +1124,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1156,7 +1140,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1173,7 +1156,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1190,7 +1172,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1207,7 +1188,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1224,7 +1204,6 @@ "cpu": [ "ia32" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1241,7 +1220,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1964,6 +1942,90 @@ "node": ">= 8" } }, + "node_modules/@pagefind/darwin-arm64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/darwin-arm64/-/darwin-arm64-1.4.0.tgz", + "integrity": "sha512-2vMqkbv3lbx1Awea90gTaBsvpzgRs7MuSgKDxW0m9oV1GPZCZbZBJg/qL83GIUEN2BFlY46dtUZi54pwH+/pTQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@pagefind/darwin-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/darwin-x64/-/darwin-x64-1.4.0.tgz", + "integrity": "sha512-e7JPIS6L9/cJfow+/IAqknsGqEPjJnVXGjpGm25bnq+NPdoD3c/7fAwr1OXkG4Ocjx6ZGSCijXEV4ryMcH2E3A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@pagefind/freebsd-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/freebsd-x64/-/freebsd-x64-1.4.0.tgz", + "integrity": "sha512-WcJVypXSZ+9HpiqZjFXMUobfFfZZ6NzIYtkhQ9eOhZrQpeY5uQFqNWLCk7w9RkMUwBv1HAMDW3YJQl/8OqsV0Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@pagefind/linux-arm64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/linux-arm64/-/linux-arm64-1.4.0.tgz", + "integrity": "sha512-PIt8dkqt4W06KGmQjONw7EZbhDF+uXI7i0XtRLN1vjCUxM9vGPdtJc2mUyVPevjomrGz5M86M8bqTr6cgDp1Uw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pagefind/linux-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/linux-x64/-/linux-x64-1.4.0.tgz", + "integrity": "sha512-z4oddcWwQ0UHrTHR8psLnVlz6USGJ/eOlDPTDYZ4cI8TK8PgwRUPQZp9D2iJPNIPcS6Qx/E4TebjuGJOyK8Mmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@pagefind/windows-x64": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@pagefind/windows-x64/-/windows-x64-1.4.0.tgz", + "integrity": "sha512-NkT+YAdgS2FPCn8mIA9bQhiBs+xmniMGq1LFPDhcFn0+2yIUEiIG06t7bsZlhdjknEQRTSdT7YitP6fC5qwP0g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@parcel/watcher": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.0.tgz", @@ -2069,7 +2131,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2083,7 +2144,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2097,7 +2157,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2111,7 +2170,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2125,7 +2183,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2139,7 +2196,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2153,7 +2209,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2167,7 +2222,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2181,7 +2235,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2195,7 +2248,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2209,7 +2261,6 @@ "cpu": [ "loong64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2223,7 +2274,6 @@ "cpu": [ "ppc64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2237,7 +2287,6 @@ "cpu": [ "riscv64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2251,7 +2300,6 @@ "cpu": [ "riscv64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2265,7 +2313,6 @@ "cpu": [ "s390x" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2279,7 +2326,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2293,7 +2339,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2307,7 +2352,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2321,7 +2365,6 @@ "cpu": [ "ia32" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2335,7 +2378,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2404,11 +2446,51 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "13.0.5", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz", + "integrity": "sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.1" + } + }, + "node_modules/@sinonjs/samsam": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.3.tgz", + "integrity": "sha512-hw6HbX+GyVZzmaYNh82Ecj1vdGZrqVIn/keDTg63IgAwiQPO+xCz99uG6Woqgb4tM0mUiFENKZ4cqd7IX94AXQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.1", + "type-detect": "^4.1.0" + } + }, + "node_modules/@sinonjs/samsam/node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", - "dev": true, "license": "MIT" }, "node_modules/@types/fs-extra": { @@ -2482,7 +2564,7 @@ "version": "22.8.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.7.tgz", "integrity": "sha512-LidcG+2UeYIWcMuMUpBKOnryBWG/rnmOHQR5apjn8myTQcx3rinFRn7DcIFhMnS0PPFSC6OafdIKEad0lj6U0Q==", - "dev": true, + "devOptional": true, "dependencies": { "undici-types": "~6.19.8" } @@ -3673,6 +3755,16 @@ "node": ">=0.10" } }, + "node_modules/diff": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -3916,7 +4008,6 @@ "version": "0.25.1", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.1.tgz", "integrity": "sha512-BGO5LtrGC7vxnqucAe/rmvKdJllfGaYWdyABvyMoXQlfYMb2bbRuReWR5tEGE//4LcNJj9XrkovTqNYRFZHAMQ==", - "dev": true, "hasInstallScript": true, "license": "MIT", "bin": { @@ -4849,7 +4940,6 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -5400,7 +5490,7 @@ "version": "4.3.7", "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.7.tgz", "integrity": "sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==", - "dev": true + "devOptional": true }, "node_modules/import-fresh": { "version": "3.3.0", @@ -6274,11 +6364,6 @@ "node": ">=12" } }, - "node_modules/lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==" - }, "node_modules/luxon": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.7.1.tgz", @@ -7039,6 +7124,24 @@ "node": ">=8" } }, + "node_modules/pagefind": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/pagefind/-/pagefind-1.4.0.tgz", + "integrity": "sha512-z2kY1mQlL4J8q5EIsQkLzQjilovKzfNVhX8De6oyE6uHpfFtyBaqUpcl/XzJC/4fjD8vBDyh1zolimIcVrCn9g==", + "dev": true, + "license": "MIT", + "bin": { + "pagefind": "lib/runner/bin.cjs" + }, + "optionalDependencies": { + "@pagefind/darwin-arm64": "1.4.0", + "@pagefind/darwin-x64": "1.4.0", + "@pagefind/freebsd-x64": "1.4.0", + "@pagefind/linux-arm64": "1.4.0", + "@pagefind/linux-x64": "1.4.0", + "@pagefind/windows-x64": "1.4.0" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -7159,8 +7262,7 @@ "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -7197,7 +7299,6 @@ "version": "8.5.3", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", - "dev": true, "funding": [ { "type": "opencollective", @@ -7226,7 +7327,6 @@ "version": "3.3.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", - "dev": true, "funding": [ { "type": "github", @@ -7875,7 +7975,6 @@ "version": "4.37.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.37.0.tgz", "integrity": "sha512-iAtQy/L4QFU+rTJ1YUjXqJOJzuwEghqWzCEYD2FEghT7Gsy1VdABntrO4CLopA5IkflTyqNiLNwPcOJ3S7UKLg==", - "dev": true, "license": "MIT", "dependencies": { "@types/estree": "1.0.6" @@ -8080,7 +8179,7 @@ "version": "1.80.6", "resolved": "https://registry.npmjs.org/sass/-/sass-1.80.6.tgz", "integrity": "sha512-ccZgdHNiBF1NHBsWvacvT5rju3y1d/Eu+8Ex6c21nHp2lZGLBEtuwc415QfiI1PJa1TpCo3iXwwSRjRpn2Ckjg==", - "dev": true, + "devOptional": true, "dependencies": { "chokidar": "^4.0.0", "immutable": "^4.0.0", @@ -8100,7 +8199,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", "integrity": "sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==", - "dev": true, + "devOptional": true, "dependencies": { "readdirp": "^4.0.1" }, @@ -8115,7 +8214,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz", "integrity": "sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==", - "dev": true, + "devOptional": true, "engines": { "node": ">= 14.16.0" }, @@ -8426,6 +8525,24 @@ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", "dev": true }, + "node_modules/sinon": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-21.0.0.tgz", + "integrity": "sha512-TOgRcwFPbfGtpqvZw+hyqJDvqfapr1qUlOizROIk4bBLjlsjlB00Pg6wMFXNtJRpu+eCZuVOaLatG7M8105kAw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.1", + "@sinonjs/fake-timers": "^13.0.5", + "@sinonjs/samsam": "^8.0.1", + "diff": "^7.0.0", + "supports-color": "^7.2.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/sinon" + } + }, "node_modules/sitemap": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/sitemap/-/sitemap-6.4.0.tgz", @@ -8478,7 +8595,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -8736,7 +8852,6 @@ "version": "0.2.14", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", - "dev": true, "license": "MIT", "dependencies": { "fdir": "^6.4.4", @@ -8753,7 +8868,6 @@ "version": "6.4.6", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", - "dev": true, "license": "MIT", "peerDependencies": { "picomatch": "^3 || ^4" @@ -8768,7 +8882,6 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -8896,6 +9009,16 @@ "node": ">= 0.8.0" } }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/type-fest": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", @@ -9031,7 +9154,7 @@ "version": "6.19.8", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true + "devOptional": true }, "node_modules/universalify": { "version": "2.0.1", @@ -9112,15 +9235,17 @@ } }, "node_modules/vite": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.3.tgz", - "integrity": "sha512-IzwM54g4y9JA/xAeBPNaDXiBF8Jsgl3VBQ2YQ/wOY6fyW3xMdSoltIV3Bo59DErdqdE6RxUfv8W69DvUorE4Eg==", - "dev": true, + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", + "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", "license": "MIT", "dependencies": { "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", "postcss": "^8.5.3", - "rollup": "^4.30.1" + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" }, "bin": { "vite": "bin/vite.js" @@ -9183,6 +9308,35 @@ } } }, + "node_modules/vite/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/void-elements": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", diff --git a/packages/11ty/package.json b/packages/11ty/package.json index bf9c374f9..5fe3b474d 100644 --- a/packages/11ty/package.json +++ b/packages/11ty/package.json @@ -54,7 +54,6 @@ "fs-extra": "^11.2.0", "iiif-builder": "^1.0.7", "lit": "^3.1.2", - "lunr": "^2.3.9", "template-polyfill": "^2.0.0", "vite": "^6.3.6" }, @@ -109,6 +108,7 @@ "markdown-it-footnote": "^4.0.0", "mime-types": "^2.1.35", "module-alias": "^2.2.2", + "pagefind": "^1.4.0", "path": "^0.12.7", "prettier": "^3.2.5", "remove-markdown": "^0.5.0", @@ -116,6 +116,7 @@ "rollup-plugin-scss": "^3.0.0", "sass": "^1.70.0", "sharp": "^0.33.2", + "sinon": "^21.0.0", "toml": "^3.0.0" }, "engines": {