Skip to content

Commit f8ab6a2

Browse files
authored
Merge pull request #643 from SolidOS/esmFix
fixed esm bundles and example
2 parents 3b5b121 + ae6a4c1 commit f8ab6a2

File tree

5 files changed

+144
-70
lines changed

5 files changed

+144
-70
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ Use modern JavaScript modules with `import` statements.
132132
<script type="module">
133133
// Import from CDN (esm.sh, unpkg, or jsdelivr)
134134
import * as $rdf from 'https://esm.sh/rdflib'
135-
import * as SolidLogic from 'https://esm.sh/solid-logic'
136-
import * as UI from 'https://esm.sh/solid-ui'
135+
import * as SolidLogic from 'https://esm.sh/solid-logic@4.0.1'
136+
import * as UI from 'https://esm.sh/solid-ui@3.0.1'
137137
138138
// Get the logged-in user
139139
const webId = SolidLogic.authn.currentUser()
@@ -196,8 +196,8 @@ Use import maps for cleaner module specifiers:
196196
{
197197
"imports": {
198198
"rdflib": "https://esm.sh/rdflib",
199-
"solid-logic": "https://esm.sh/solid-logic",
200-
"solid-ui": "https://esm.sh/solid-ui"
199+
"solid-logic": "https://esm.sh/solid-logic@4.0.1",
200+
"solid-ui": "https://esm.sh/solid-ui@3.0.1"
201201
}
202202
}
203203
</script>

package-lock.json

Lines changed: 52 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "solid-ui",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "UI library for Solid applications",
55
"main": "dist/solid-ui.js",
66
"types": "dist/index.d.ts",
@@ -68,14 +68,14 @@
6868
"@noble/curves": "^1.9.6",
6969
"@noble/hashes": "^1.8.0",
7070
"escape-html": "^1.0.3",
71-
"mime-types": "^3.0.1",
71+
"mime-types": "^3.0.2",
7272
"pane-registry": "^3.0.0",
7373
"solid-namespace": "^0.5.4",
7474
"uuid": "^11.1.0"
7575
},
7676
"peerDependencies": {
7777
"rdflib": "^2.3.0",
78-
"solid-logic": "^4.0.0"
78+
"solid-logic": "^4.0.1"
7979
},
8080
"devDependencies": {
8181
"@babel/cli": "^7.28.3",
@@ -84,7 +84,6 @@
8484
"@babel/preset-env": "^7.28.0",
8585
"@babel/preset-typescript": "^7.27.1",
8686
"@babel/runtime": "^7.28.2",
87-
"@eslint/eslintrc": "^3.3.1",
8887
"@eslint/js": "^9.32.0",
8988
"@mdx-js/react": "^3.1.0",
9089
"@storybook/addon-actions": "7.6.20",
@@ -98,13 +97,13 @@
9897
"@types/jest": "^30.0.0",
9998
"@types/jsdom": "^21.1.7",
10099
"@types/node": "^24.2.0",
101-
"@typescript-eslint/parser": "^8.39.0",
100+
"@typescript-eslint/parser": "^8.48.1",
102101
"babel-jest": "^30.1.2",
103102
"babel-loader": "^10.0.0",
104103
"eslint": "^9.32.0",
105104
"eslint-import-resolver-typescript": "^4.4.4",
106105
"eslint-plugin-import": "^2.32.0",
107-
"eslint-plugin-jest": "^29.0.1",
106+
"eslint-plugin-jest": "^29.2.1",
108107
"eslint-plugin-n": "^17.21.3",
109108
"eslint-plugin-promise": "^7.2.1",
110109
"get-random-values": "^4.0.0",
@@ -119,12 +118,12 @@
119118
"react": "^17.0.2",
120119
"react-dom": "^17.0.2",
121120
"react-is": "^17.0.2",
122-
"solid-logic": "^4.0.0",
121+
"solid-logic": "^4.0.1",
123122
"storybook": "^7.6.20",
124-
"terser-webpack-plugin": "^5.3.14",
123+
"terser-webpack-plugin": "^5.3.15",
125124
"typedoc": "^0.28.9",
126125
"typescript": "^5.9.2",
127-
"webpack": "^5.101.0",
126+
"webpack": "^5.103.0",
128127
"webpack-cli": "^6.0.1"
129128
},
130129
"optionalDependencies": {

test/testBundles/test-bundle.html

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Solid-UI ESM with Import Maps</title>
5+
</head>
6+
<body>
7+
<div id="app"></div>
8+
9+
<!-- Define import map for bare specifiers -->
10+
<script type="importmap">
11+
{
12+
"imports": {
13+
"rdflib": "https://esm.sh/rdflib",
14+
"solid-logic": "https://esm.sh/solid-logic@4.0.1",
15+
"solid-ui": "https://esm.sh/solid-ui@3.0.1"
16+
}
17+
}
18+
</script>
19+
20+
<script type="module">
21+
// Use clean bare specifiers
22+
import * as $rdf from 'rdflib'
23+
import * as SolidLogic from 'solid-logic'
24+
import * as UI from 'solid-ui'
25+
26+
const app = document.getElementById('app')
27+
28+
// Create a profile button for logged-in user
29+
async function createUserButton() {
30+
const webId = SolidLogic.authn.currentUser()
31+
32+
if (!webId) {
33+
const loginBtn = UI.widgets.button(
34+
document,
35+
'https://solidproject.org/assets/img/solid-emblem.svg',
36+
'Login',
37+
() => SolidLogic.authn.checkUser()
38+
)
39+
app.appendChild(loginBtn)
40+
return
41+
}
42+
43+
// Fetch user profile
44+
try {
45+
await SolidLogic.store.fetcher.load(webId.doc())
46+
const name = SolidLogic.store.any(
47+
webId,
48+
$rdf.sym('http://xmlns.com/foaf/0.1/name')
49+
)
50+
51+
const profileBtn = UI.widgets.button(
52+
document,
53+
'https://solidproject.org/assets/img/solid-emblem.svg',
54+
name ? name.value : 'My Profile',
55+
() => {
56+
alert(`WebID: ${webId.value}\nName: ${name ? name.value : 'Not set'}`)
57+
}
58+
)
59+
app.appendChild(profileBtn)
60+
} catch (error) {
61+
console.error('Error loading profile:', error)
62+
}
63+
}
64+
65+
createUserButton()
66+
</script>
67+
</body>
68+
</html>

0 commit comments

Comments
 (0)