@proveanything/smartlinks 2.0.11 → 2.0.12
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/dist/docs/API_SUMMARY.md +1 -1
- package/dist/docs/app-manifest.md +702 -702
- package/dist/docs/host-dependency-contract.md +20 -9
- package/dist/shared-dependencies.d.ts +3 -3
- package/dist/shared-dependencies.js +15 -7
- package/dist/types/appManifest.d.ts +1 -1
- package/docs/API_SUMMARY.md +1 -1
- package/docs/app-manifest.md +702 -702
- package/docs/host-dependency-contract.md +20 -9
- package/package.json +3 -2
- package/scripts/doctor.mjs +4 -19
|
@@ -32,7 +32,8 @@ export default defineConfig({
|
|
|
32
32
|
'react', 'react-dom', 'react/jsx-runtime',
|
|
33
33
|
'@proveanything/smartlinks',
|
|
34
34
|
'react-router-dom', '@tanstack/react-query',
|
|
35
|
-
'lucide-react', 'date-fns', 'liquidjs', 'marked', '
|
|
35
|
+
'lucide-react', 'date-fns', 'liquidjs', 'marked', 'dompurify', 'clsx', 'tailwind-merge',
|
|
36
|
+
'class-variance-authority',
|
|
36
37
|
'@radix-ui/react-slot', '@radix-ui/react-dialog', '@radix-ui/react-popover',
|
|
37
38
|
'@radix-ui/react-tooltip', '@radix-ui/react-tabs', '@radix-ui/react-accordion',
|
|
38
39
|
'@radix-ui/react-select', '@radix-ui/react-scroll-area', '@radix-ui/react-label',
|
|
@@ -44,7 +45,8 @@ export default defineConfig({
|
|
|
44
45
|
'@proveanything/smartlinks': 'SL',
|
|
45
46
|
'react-router-dom': 'ReactRouterDOM', '@tanstack/react-query': 'ReactQuery',
|
|
46
47
|
'lucide-react': 'LucideReact', 'date-fns': 'dateFns', 'liquidjs': 'LiquidJS',
|
|
47
|
-
'marked': 'marked', '
|
|
48
|
+
'marked': 'marked', 'dompurify': 'DOMPurify', 'clsx': 'clsx',
|
|
49
|
+
'tailwind-merge': 'tailwindMerge', 'class-variance-authority': 'CVA',
|
|
48
50
|
'@radix-ui/react-slot': 'RadixSlot', '@radix-ui/react-dialog': 'RadixDialog',
|
|
49
51
|
'@radix-ui/react-popover': 'RadixPopover', '@radix-ui/react-tooltip': 'RadixTooltip',
|
|
50
52
|
'@radix-ui/react-tabs': 'RadixTabs', '@radix-ui/react-accordion': 'RadixAccordion',
|
|
@@ -72,6 +74,9 @@ export default defineConfig({
|
|
|
72
74
|
| `date-fns` | `dateFns` | 4.4 |
|
|
73
75
|
| `liquidjs` | `LiquidJS` | 10.27+ |
|
|
74
76
|
| `marked` | `marked` | 12+ |
|
|
77
|
+
| `dompurify` | `DOMPurify` | 3+ |
|
|
78
|
+
| `clsx` | `clsx` | 2+ |
|
|
79
|
+
| `tailwind-merge` | `tailwindMerge` | 3+ |
|
|
75
80
|
| `class-variance-authority` | `CVA` | 0.7 |
|
|
76
81
|
| `@radix-ui/react-slot` | `RadixSlot` | 1.2.4 |
|
|
77
82
|
| `@radix-ui/react-dialog` | `RadixDialog` | 1.1.23 |
|
|
@@ -86,10 +91,15 @@ export default defineConfig({
|
|
|
86
91
|
| `@radix-ui/react-progress` | `RadixProgress` | 1.1.8 |
|
|
87
92
|
| `@radix-ui/react-avatar` | `RadixAvatar` | 1.1.11 |
|
|
88
93
|
|
|
89
|
-
`liquidjs` and `
|
|
90
|
-
(frequently missed). `marked`
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
`liquidjs`, `marked`, `dompurify`, `clsx` and `tailwind-merge` are **host-provided** — externalise
|
|
95
|
+
them, don't ship a second copy (frequently missed). `marked` arrived in **v6**; `dompurify`, `clsx`
|
|
96
|
+
and `tailwind-merge` in **v7**. The portal and hub render markdown in the container, so use the
|
|
97
|
+
host's `marked` rather than bundling your own. `marked` does not sanitise HTML — pair it with the
|
|
98
|
+
shared `dompurify`: `el.innerHTML = DOMPurify.sanitize(marked.parse(md))`. `window.DOMPurify` is the
|
|
99
|
+
**configured instance** (callable, `.sanitize()`), so `import DOMPurify from 'dompurify'` behaves
|
|
100
|
+
exactly like a bundled default import. `clsx` + `tailwind-merge` are the standard `cn()` pair
|
|
101
|
+
(`import { clsx } from 'clsx'; import { twMerge } from 'tailwind-merge'`) — keep your local `cn()`
|
|
102
|
+
helper if you like, it just stops paying the bundle cost.
|
|
93
103
|
|
|
94
104
|
## Backwards compatibility
|
|
95
105
|
|
|
@@ -115,7 +125,8 @@ app ships the Tailwind 4 CSS-first layout as the default; see its README.)
|
|
|
115
125
|
|
|
116
126
|
React **19.3** · Vite **8.3** · react-router-dom **7.18** · Tailwind **4.3** (CSS-first) ·
|
|
117
127
|
TypeScript **6.0** · ESLint **10.11** · `@proveanything/smartlinks` **2.0.5** ·
|
|
118
|
-
`@proveanything/smartlinks-utils-ui` **1.16.4** · liquidjs **10.29** · marked **12
|
|
128
|
+
`@proveanything/smartlinks-utils-ui` **1.16.4** · liquidjs **10.29** · marked **12+** ·
|
|
129
|
+
dompurify **3+** · clsx **2+** · tailwind-merge **3+**.
|
|
119
130
|
|
|
120
131
|
> **TypeScript 7** (the native/Go compiler) is **deliberately deferred** — tooling hasn't settled.
|
|
121
132
|
> Target **TS 6** for R5; it compiles existing code with no source changes.
|
|
@@ -142,8 +153,8 @@ never drift:
|
|
|
142
153
|
|
|
143
154
|
```ts
|
|
144
155
|
import {
|
|
145
|
-
SHARED_DEPENDENCY_CONTRACT_VERSION, // '
|
|
146
|
-
SHARED_DEPENDENCIES, // [{ specifier, globalName, minVersion, importMapPath }, …] (
|
|
156
|
+
SHARED_DEPENDENCY_CONTRACT_VERSION, // 'v7'
|
|
157
|
+
SHARED_DEPENDENCIES, // [{ specifier, globalName, minVersion, importMapPath }, …] (29)
|
|
147
158
|
SHARED_DEPENDENCY_SPECIFIERS, // bare specifiers — drop straight into a bundler `external` list
|
|
148
159
|
getHostSharedDependencies, // what the live host advertises at runtime, or null
|
|
149
160
|
} from '@proveanything/smartlinks'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proveanything/smartlinks",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.12",
|
|
4
4
|
"description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"tag": "next"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"cross-fetch": "^3.1.5"
|
|
65
|
+
"cross-fetch": "^3.1.5",
|
|
66
|
+
"es-module-lexer": "^1.7.0"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
69
|
"ts-node": "^10.9.1",
|
package/scripts/doctor.mjs
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import { readFileSync, existsSync } from 'node:fs';
|
|
20
20
|
import { resolve, dirname, join } from 'node:path';
|
|
21
21
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
22
|
+
import { bareImportsOf } from './lib/bare-imports.mjs';
|
|
22
23
|
|
|
23
24
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
24
25
|
|
|
@@ -75,25 +76,9 @@ if (meta.sharedDependencies && meta.sharedDependencies !== SHARED_DEPENDENCY_CON
|
|
|
75
76
|
warnings.push(`built against contract ${meta.sharedDependencies}, but this SDK ships ${SHARED_DEPENDENCY_CONTRACT_VERSION} — host may not serve a matching import map.`);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
//
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const patterns = [
|
|
82
|
-
/\bfrom\s*["']([^"']+)["']/g, // static import/export ... from "x"
|
|
83
|
-
/\bimport\s*["']([^"']+)["']/g, // side-effect import "x"
|
|
84
|
-
/\bimport\(\s*["']([^"']+)["']\s*\)/g, // dynamic import("x")
|
|
85
|
-
];
|
|
86
|
-
for (const re of patterns) {
|
|
87
|
-
let m;
|
|
88
|
-
while ((m = re.exec(code))) {
|
|
89
|
-
const spec = m[1];
|
|
90
|
-
if (spec.startsWith('.') || spec.startsWith('/')) continue; // internal/relative
|
|
91
|
-
if (/^https?:/.test(spec)) continue; // absolute URL import
|
|
92
|
-
specs.add(spec);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return [...specs];
|
|
96
|
-
}
|
|
79
|
+
// bareImportsOf (scripts/lib/bare-imports.mjs) LEXES the bundle for real import
|
|
80
|
+
// statements — so bundled data containing the word `from` (e.g. tailwind-merge's class
|
|
81
|
+
// map) is not mistaken for an import.
|
|
97
82
|
|
|
98
83
|
// Resolve a manifest-relative bundle path against the likely roots (dist paths
|
|
99
84
|
// are sometimes relative to the app root, sometimes to the manifest dir).
|