Repository navigation
feat: 200-byte data browser, replace mashlib bundle by default - #8
Merged
Merged
Conversation
The page is the data. JSS already embeds the resource as JSON-LD in <script type="application/ld+json" id="dataisland">. The full mashlib bundle is hundreds of KB just to render that. This change replaces it with a deliberately tiny ES module that: - Finds the data island in the served HTML - Turns every URI into a clickable <a> - Renders into JSS's <div id="mashlib"> slot The data is the UI; the URIs are the navigation. Click any link in the rendered page and you navigate to that Solid resource, which JSS also serves with the data island wrapper, which our module also renders. Pure linked-data philosophy. Files: - data-browser.js (~180 bytes of runtime code + explanatory comments) - data-browser.css (~290 bytes of runtime CSS + comments) — system font, cream background, soft card, hover-underline links Hosting: - Both files are in the npm tarball (files whitelist updated). - jspod passes --mashlib-module https://cdn.jsdelivr.net/npm/jspod@<pkg.version>/data-browser.js to JSS. Version-pinned = cache-immortal per version, so a published release always loads the matching browser code. JSS auto-fetches the .css sibling from moduleUrl.replace(/\.js$/, '.css'). - No new infra; jsdelivr serves npm packages for free. JSS contract verified locally (Python http.server + JSS in single- user mode): /public/ responds with the module-mode HTML wrapper, data island contains the LDP container JSON-LD, all URIs round-trip through the renderer as <a> tags. README adds a "The page is the data" section explaining the philosophy and pointing to the two source files in the package. Bumps jspod to 0.0.11. Refs #1
29 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The page is the data. JSS already embeds each Solid resource as JSON-LD in
<script type="application/ld+json" id="dataisland">— the full mashlib bundle (hundreds of KB) is mostly there to render that. This PR replaces it with a deliberately minimal ES module:data-browser.js— ~180 bytes of runtime code: find the data island, turn every URI into an<a>, render to#mashlibdata-browser.css— ~290 bytes of runtime CSS: system font, cream background, soft card with rounded corners, blue hover-underline linksTogether: well under a kilobyte for the entire "data browser." Click any URI in the rendered page → navigate to that Solid resource → JSS re-serves with the wrapper → our module re-renders. The data is the UI; the URIs are the navigation.
How it works
generateModuleDatabrowserHtmlin JSS (verified atnode_modules/javascript-solid-server/src/mashlib/index.js:306) produces this HTML when--mashlib-module <url>is set:Our module reads
#dataisland, paints#mashlib. Done.Hosting
--mashlib-module https://cdn.jsdelivr.net/npm/jspod@${pkg.version}/data-browser.jsto JSSVerification (local)
End-to-end test using a Python http.server in place of jsdelivr (since 0.0.11 isn't published yet):
GET /public/(Accept: text/html, Sec-Fetch-Dest: document) with the module-mode wrapper ✓<a>:http://www.w3.org/ns/ldp#,http://127.0.0.1:.../public/,http://127.0.0.1:.../public/.acl, etc. ✓Reviewer test plan
Because the jsdelivr URL
https://cdn.jsdelivr.net/npm/jspod@0.0.11/data-browser.jsonly exists once we publish 0.0.11, the easiest end-to-end test is:npx jspod@0.0.11in a clean directoryIf you want to verify before publish, pull the branch and serve the files locally:
What this doesn't try to do
--mashlib-cdnThis is a positioning move as much as a code change — it's jspod saying the data browser shouldn't be a SPA bundle, it should be the page rendering its own data.
Refs #1