@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'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Current contract revision. Bumped when the entry list or host versions change. */
|
|
2
|
-
export declare const SHARED_DEPENDENCY_CONTRACT_VERSION: "
|
|
2
|
+
export declare const SHARED_DEPENDENCY_CONTRACT_VERSION: "v7";
|
|
3
3
|
export interface SharedDependency {
|
|
4
4
|
/** Bare import specifier the app writes, e.g. `react-dom/client`. */
|
|
5
5
|
specifier: string;
|
|
@@ -13,8 +13,8 @@ export interface SharedDependency {
|
|
|
13
13
|
/**
|
|
14
14
|
* Canonical import-map path for a specifier: drop the leading `@` scope marker and
|
|
15
15
|
* turn every `/` into `-`.
|
|
16
|
-
* 'react-dom/client' -> '/sl-shared/
|
|
17
|
-
* '@radix-ui/react-slot' -> '/sl-shared/
|
|
16
|
+
* 'react-dom/client' -> '/sl-shared/v7/react-dom-client.js'
|
|
17
|
+
* '@radix-ui/react-slot' -> '/sl-shared/v7/radix-ui-react-slot.js'
|
|
18
18
|
* Hosts MUST serve shims at these paths so the map the SDK advertises resolves.
|
|
19
19
|
*/
|
|
20
20
|
export declare function importMapPathFor(specifier: string, version?: string): string;
|
|
@@ -11,22 +11,24 @@
|
|
|
11
11
|
//
|
|
12
12
|
// See docs/host-dependency-contract.md.
|
|
13
13
|
/** Current contract revision. Bumped when the entry list or host versions change. */
|
|
14
|
-
export const SHARED_DEPENDENCY_CONTRACT_VERSION = '
|
|
14
|
+
export const SHARED_DEPENDENCY_CONTRACT_VERSION = 'v7';
|
|
15
15
|
/**
|
|
16
16
|
* Canonical import-map path for a specifier: drop the leading `@` scope marker and
|
|
17
17
|
* turn every `/` into `-`.
|
|
18
|
-
* 'react-dom/client' -> '/sl-shared/
|
|
19
|
-
* '@radix-ui/react-slot' -> '/sl-shared/
|
|
18
|
+
* 'react-dom/client' -> '/sl-shared/v7/react-dom-client.js'
|
|
19
|
+
* '@radix-ui/react-slot' -> '/sl-shared/v7/radix-ui-react-slot.js'
|
|
20
20
|
* Hosts MUST serve shims at these paths so the map the SDK advertises resolves.
|
|
21
21
|
*/
|
|
22
22
|
export function importMapPathFor(specifier, version = SHARED_DEPENDENCY_CONTRACT_VERSION) {
|
|
23
23
|
const slug = specifier.replace(/^@/, '').replace(/\//g, '-');
|
|
24
24
|
return `/sl-shared/${version}/${slug}.js`;
|
|
25
25
|
}
|
|
26
|
-
// The
|
|
27
|
-
//
|
|
28
|
-
// the
|
|
29
|
-
//
|
|
26
|
+
// The 29-entry v7 contract: the v6 set plus `dompurify` (HTML sanitizer — pairs with
|
|
27
|
+
// the shared `marked` so output apps sanitize instead of each bundling their own),
|
|
28
|
+
// `clsx` + `tailwind-merge` (the standard `cn()` pair the portal/hub already ship, now
|
|
29
|
+
// exposed to apps). All small, version-stable, ubiquitous — apps stop bundling copies.
|
|
30
|
+
// minVersion follows the R5 host baseline (React 19, Router 7.18.4 security floor,
|
|
31
|
+
// LiquidJS 10.27+, current Radix majors).
|
|
30
32
|
const CONTRACT = [
|
|
31
33
|
{ specifier: 'react', globalName: 'React', minVersion: '19.0.0' },
|
|
32
34
|
{ specifier: 'react-dom', globalName: 'ReactDOM', minVersion: '19.0.0' },
|
|
@@ -41,6 +43,12 @@ const CONTRACT = [
|
|
|
41
43
|
{ specifier: 'date-fns', globalName: 'dateFns', minVersion: '4.0.0' },
|
|
42
44
|
{ specifier: 'liquidjs', globalName: 'LiquidJS', minVersion: '10.27.0' },
|
|
43
45
|
{ specifier: 'marked', globalName: 'marked', minVersion: '12.0.0' },
|
|
46
|
+
// `window.DOMPurify` is the CONFIGURED instance (callable, `.sanitize()`), exactly as
|
|
47
|
+
// dompurify's own UMD build exposes it — so `import DOMPurify from 'dompurify'`
|
|
48
|
+
// resolves to the same instance a bundled default import would.
|
|
49
|
+
{ specifier: 'dompurify', globalName: 'DOMPurify', minVersion: '3.0.0' },
|
|
50
|
+
{ specifier: 'clsx', globalName: 'clsx', minVersion: '2.0.0' },
|
|
51
|
+
{ specifier: 'tailwind-merge', globalName: 'tailwindMerge', minVersion: '3.0.0' },
|
|
44
52
|
{ specifier: 'class-variance-authority', globalName: 'CVA', minVersion: '0.7.0' },
|
|
45
53
|
{ specifier: '@radix-ui/react-slot', globalName: 'RadixSlot', minVersion: '1.2.0' },
|
|
46
54
|
{ specifier: '@radix-ui/react-dialog', globalName: 'RadixDialog', minVersion: '1.1.0' },
|
|
@@ -417,7 +417,7 @@ export interface AppManifest {
|
|
|
417
417
|
*/
|
|
418
418
|
moduleFormat?: 'umd' | 'esm' | 'dual';
|
|
419
419
|
/**
|
|
420
|
-
* Shared-dependency contract version this bundle was built against, e.g. `"
|
|
420
|
+
* Shared-dependency contract version this bundle was built against, e.g. `"v7"`
|
|
421
421
|
* (see `SHARED_DEPENDENCY_CONTRACT_VERSION`). The host uses it to select a
|
|
422
422
|
* compatible import map for the ESM load path.
|
|
423
423
|
*/
|