polen 0.11.0-next.26 → 0.11.0-next.27
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/build/template/components/ReferenceLink.d.ts +1 -0
- package/build/template/components/ReferenceLink.d.ts.map +1 -1
- package/build/template/components/ReferenceLink.js.map +1 -1
- package/build/template/components/graphql/type-link.d.ts.map +1 -1
- package/build/template/components/graphql/type-link.js +7 -6
- package/build/template/components/graphql/type-link.js.map +1 -1
- package/package.json +1 -7
- package/src/template/components/ReferenceLink.tsx +1 -0
- package/src/template/components/graphql/type-link.tsx +21 -9
- package/build/lib/extensible-data/$.d.ts +0 -2
- package/build/lib/extensible-data/$.d.ts.map +0 -1
- package/build/lib/extensible-data/$.js +0 -2
- package/build/lib/extensible-data/$.js.map +0 -1
- package/build/lib/extensible-data/extensible-data.d.ts +0 -17
- package/build/lib/extensible-data/extensible-data.d.ts.map +0 -1
- package/build/lib/extensible-data/extensible-data.js +0 -24
- package/build/lib/extensible-data/extensible-data.js.map +0 -1
- package/build/lib/vite-plugin-reactive-data/$.d.ts +0 -2
- package/build/lib/vite-plugin-reactive-data/$.d.ts.map +0 -1
- package/build/lib/vite-plugin-reactive-data/$.js +0 -2
- package/build/lib/vite-plugin-reactive-data/$.js.map +0 -1
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts +0 -32
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts.map +0 -1
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js +0 -85
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js.map +0 -1
- package/src/lib/extensible-data/$.ts +0 -1
- package/src/lib/extensible-data/extensible-data.ts +0 -38
- package/src/lib/vite-plugin-reactive-data/$.ts +0 -1
- package/src/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.ts +0 -124
@@ -7,6 +7,7 @@ import type { React } from '#dep/react/index';
|
|
7
7
|
* <ReferenceLink type="User" field="name">User.name</ReferenceLink>
|
8
8
|
*/
|
9
9
|
export declare const ReferenceLink: React.ForwardRefExoticComponent<{
|
10
|
+
className?: string;
|
10
11
|
/** The GraphQL type name */
|
11
12
|
type: string;
|
12
13
|
/** Optional field name for field-specific links */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ReferenceLink.d.ts","sourceRoot":"","sources":["../../../src/template/components/ReferenceLink.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAK7C;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;
|
1
|
+
{"version":3,"file":"ReferenceLink.d.ts","sourceRoot":"","sources":["../../../src/template/components/ReferenceLink.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAK7C;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;gBAGV,MAAM;IAClB,4BAA4B;UACtB,MAAM;IACZ,mDAAmD;YAC3C,MAAM;IACd,mBAAmB;cACT,KAAK,CAAC,SAAS;2CAiB3B,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ReferenceLink.js","sourceRoot":"","sources":["../../../src/template/components/ReferenceLink.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,
|
1
|
+
{"version":3,"file":"ReferenceLink.js","sourceRoot":"","sources":["../../../src/template/components/ReferenceLink.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAWrC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC7C,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IAEpC,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAClD,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,SAAS,EAC5C,WAAW,EACX,IAAI,EACJ,KAAK,CACN,CAAA;IAED,OAAO,CACL,KAAC,IAAI,IAAC,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,KAAM,KAAK,YAChC,QAAQ,GACJ,CACR,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,aAAa,CAAC,WAAW,GAAG,eAAe,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"type-link.d.ts","sourceRoot":"","sources":["../../../../src/template/components/graphql/type-link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAA;IACpC,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,
|
1
|
+
{"version":3,"file":"type-link.d.ts","sourceRoot":"","sources":["../../../../src/template/components/graphql/type-link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAA;IACpC,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAkDA,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
2
|
import { Grafaid } from '#lib/grafaid';
|
3
3
|
import { Code, Flex, HoverCard, Text } from '@radix-ui/themes';
|
4
4
|
import React from 'react';
|
@@ -9,11 +9,12 @@ import { typeKindTokensIndex } from './type-kind-tokens.js';
|
|
9
9
|
export const TypeLink = ({ type, showDescription = false }) => {
|
10
10
|
const kind = Grafaid.Schema.typeKindFromClass(type);
|
11
11
|
const hasDescription = type.description && type.description.trim() !== '';
|
12
|
-
const linkContent = (
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
const linkContent = (_jsxs(_Fragment, { children: [_jsx("style", { children: `
|
13
|
+
.type-link-content:hover code:not(:first-child) {
|
14
|
+
text-decoration: underline;
|
15
|
+
text-underline-offset: 2px;
|
16
|
+
}
|
17
|
+
` }), _jsx(ReferenceLink, { type: type.name, className: 'type-link-content', children: _jsxs(Flex, { align: 'center', gap: '1', display: 'inline-flex', children: [_jsx(TypeKindIcon, { kind: kind }), ` `, _jsx(Code, { color: typeKindTokensIndex[kind].color, variant: 'ghost', children: type.name })] }) })] }));
|
17
18
|
// Only show HoverCard if showDescription is true AND description exists
|
18
19
|
if (!showDescription || !hasDescription) {
|
19
20
|
return linkContent;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"type-link.js","sourceRoot":"","sources":["../../../../src/template/components/graphql/type-link.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,IAAI,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AAC,CAAA;IACnD,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,CAAA;IAEzE,MAAM,WAAW,GAAG,CAClB,8BACE,0BACG;;;;;SAKA,GACK,EACR,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAC,mBAAmB,YAC3D,MAAC,IAAI,IACH,KAAK,EAAC,QAAQ,EACd,GAAG,EAAC,GAAG,EACP,OAAO,EAAC,aAAa,aAErB,KAAC,YAAY,IAAC,IAAI,EAAE,IAAI,GAAI,EAC3B,GAAG,EACJ,KAAC,IAAI,IAAC,KAAK,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,EAAC,OAAO,YAAE,IAAI,CAAC,IAAI,GAAQ,IAC3E,GACO,IACf,CACJ,CAAA;IAED,wEAAwE;IACxE,IAAI,CAAC,eAAe,IAAI,CAAC,cAAc,EAAE,CAAC;QACxC,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,OAAO,CACL,MAAC,SAAS,CAAC,IAAI,eACb,KAAC,SAAS,CAAC,OAAO,cACf,WAAW,GACM,EACpB,KAAC,SAAS,CAAC,OAAO,IAChB,IAAI,EAAC,GAAG,EACR,QAAQ,EAAC,OAAO,EAChB,IAAI,EAAC,KAAK,EACV,KAAK,EAAC,QAAQ,YAEd,KAAC,IAAI,IAAC,IAAI,EAAC,GAAG,EAAC,KAAK,EAAC,MAAM,YACzB,KAAC,WAAW,IAAC,IAAI,EAAE,IAAI,GAAI,GACtB,GACW,IACL,CAClB,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "polen",
|
3
|
-
"version": "0.11.0-next.
|
3
|
+
"version": "0.11.0-next.27",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A framework for delightful GraphQL developer portals",
|
6
6
|
"author": {
|
@@ -217,9 +217,6 @@
|
|
217
217
|
"#lib/vite-plugin-mdx": {
|
218
218
|
"default": "./build/lib/vite-plugin-mdx/$.js"
|
219
219
|
},
|
220
|
-
"#lib/vite-plugin-reactive-data": {
|
221
|
-
"default": "./build/lib/vite-plugin-reactive-data/$.js"
|
222
|
-
},
|
223
220
|
"#lib/vite-plugins": {
|
224
221
|
"default": "./build/lib/vite-plugins/$.js"
|
225
222
|
},
|
@@ -298,7 +295,6 @@
|
|
298
295
|
"@vitejs/plugin-react": "^4.7.0",
|
299
296
|
"@vitejs/plugin-react-oxc": "^0.3.0",
|
300
297
|
"@vltpkg/semver": "0.0.0-18",
|
301
|
-
"@vue/reactivity": "^3.5.17",
|
302
298
|
"@wollybeard/kit": "^0.41.0",
|
303
299
|
"@wollybeard/projector": "^0.3.0",
|
304
300
|
"ansis": "^4.1.0",
|
@@ -366,7 +362,6 @@
|
|
366
362
|
"@types/node": "^24.1.0",
|
367
363
|
"@types/react": "^19.1.8",
|
368
364
|
"@types/react-dom": "^19.1.6",
|
369
|
-
"@types/semver": "^7.7.0",
|
370
365
|
"dprint": "^0.50.1",
|
371
366
|
"dripip": "^0.10.0",
|
372
367
|
"fast-check": "^4.2.0",
|
@@ -376,7 +371,6 @@
|
|
376
371
|
"jsdom": "^26.1.0",
|
377
372
|
"playwright": "1.54.1",
|
378
373
|
"publint": "^0.3.12",
|
379
|
-
"semver": "^7.7.2",
|
380
374
|
"strip-ansi": "^7.1.0",
|
381
375
|
"typescript": "^5.8.3",
|
382
376
|
"vite-tsconfig-paths": "^5.1.4",
|
@@ -14,15 +14,27 @@ export const TypeLink: React.FC<{
|
|
14
14
|
const hasDescription = type.description && type.description.trim() !== ''
|
15
15
|
|
16
16
|
const linkContent = (
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
<>
|
18
|
+
<style>
|
19
|
+
{`
|
20
|
+
.type-link-content:hover code:not(:first-child) {
|
21
|
+
text-decoration: underline;
|
22
|
+
text-underline-offset: 2px;
|
23
|
+
}
|
24
|
+
`}
|
25
|
+
</style>
|
26
|
+
<ReferenceLink type={type.name} className='type-link-content'>
|
27
|
+
<Flex
|
28
|
+
align='center'
|
29
|
+
gap='1'
|
30
|
+
display='inline-flex'
|
31
|
+
>
|
32
|
+
<TypeKindIcon kind={kind} />
|
33
|
+
{` `}
|
34
|
+
<Code color={typeKindTokensIndex[kind].color} variant='ghost'>{type.name}</Code>
|
35
|
+
</Flex>
|
36
|
+
</ReferenceLink>
|
37
|
+
</>
|
26
38
|
)
|
27
39
|
|
28
40
|
// Only show HoverCard if showDescription is true AND description exists
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/lib/extensible-data/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.js","sourceRoot":"","sources":["../../../src/lib/extensible-data/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAA"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import type { ComputedRef } from '@vue/reactivity';
|
2
|
-
type Join<$Data> = (chunks: $Data[]) => $Data;
|
3
|
-
type Create<$Data> = () => $Data;
|
4
|
-
interface DataTypeOperations<$Data> {
|
5
|
-
join: Join<$Data>;
|
6
|
-
create: Create<$Data>;
|
7
|
-
}
|
8
|
-
export declare const create: <$Data extends object = object>(dataTypeOperations: DataTypeOperations<$Data>) => ExtensibleData<$Data>;
|
9
|
-
export declare class ExtensibleData<$Data extends object = object> {
|
10
|
-
value: ComputedRef<$Data>;
|
11
|
-
private namespacedReactiveData;
|
12
|
-
private dataTypeOperations;
|
13
|
-
constructor(dataTypeOperations: DataTypeOperations<$Data>);
|
14
|
-
get(namespace: string): $Data;
|
15
|
-
}
|
16
|
-
export {};
|
17
|
-
//# sourceMappingURL=extensible-data.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"extensible-data.d.ts","sourceRoot":"","sources":["../../../src/lib/extensible-data/extensible-data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAA;AAEnE,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,CAAA;AAC7C,KAAK,MAAM,CAAC,KAAK,IAAI,MAAM,KAAK,CAAA;AAEhC,UAAU,kBAAkB,CAAC,KAAK;IAChC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACjB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;CACtB;AAED,eAAO,MAAM,MAAM,GAAI,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,oBAAoB,kBAAkB,CAAC,KAAK,CAAC,0BAElG,CAAA;AAED,qBAAa,cAAc,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM;IAChD,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAI9B;IAEF,OAAO,CAAC,sBAAsB,CAAqC;IAEnE,OAAO,CAAC,kBAAkB,CAA2B;gBAEzC,kBAAkB,EAAE,kBAAkB,CAAC,KAAK,CAAC;IAIzD,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK;CAO9B"}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { computed, reactive } from '@vue/reactivity';
|
2
|
-
export const create = (dataTypeOperations) => {
|
3
|
-
return new ExtensibleData(dataTypeOperations);
|
4
|
-
};
|
5
|
-
export class ExtensibleData {
|
6
|
-
value = computed(() => {
|
7
|
-
const namespacedDataItems = Array.from(this.namespacedReactiveData.values());
|
8
|
-
const data = this.dataTypeOperations.join(namespacedDataItems);
|
9
|
-
return data;
|
10
|
-
});
|
11
|
-
namespacedReactiveData = reactive(new Map());
|
12
|
-
dataTypeOperations;
|
13
|
-
constructor(dataTypeOperations) {
|
14
|
-
this.dataTypeOperations = dataTypeOperations;
|
15
|
-
}
|
16
|
-
get(namespace) {
|
17
|
-
if (!this.namespacedReactiveData.has(namespace)) {
|
18
|
-
const data = this.dataTypeOperations.create();
|
19
|
-
this.namespacedReactiveData.set(namespace, data);
|
20
|
-
}
|
21
|
-
return this.namespacedReactiveData.get(namespace);
|
22
|
-
}
|
23
|
-
}
|
24
|
-
//# sourceMappingURL=extensible-data.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"extensible-data.js","sourceRoot":"","sources":["../../../src/lib/extensible-data/extensible-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAWpD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAgC,kBAA6C,EAAE,EAAE;IACrG,OAAO,IAAI,cAAc,CAAQ,kBAAkB,CAAC,CAAA;AACtD,CAAC,CAAA;AAED,MAAM,OAAO,cAAc;IAClB,KAAK,GAAuB,QAAQ,CAAC,GAAG,EAAE;QAC/C,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,CAAC,CAAA;QAC5E,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,mBAA8B,CAAC,CAAA;QACzE,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;IAEM,sBAAsB,GAAG,QAAQ,CAAC,IAAI,GAAG,EAAiB,CAAC,CAAA;IAE3D,kBAAkB,CAA2B;IAErD,YAAY,kBAA6C;QACvD,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAA;IAC9C,CAAC;IAED,GAAG,CAAC,SAAiB;QACnB,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAA;YAC7C,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,SAAS,EAAE,IAA8B,CAAC,CAAA;QAC5E,CAAC;QACD,OAAO,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAW,CAAA;IAC7D,CAAC;CACF"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/lib/vite-plugin-reactive-data/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,sBAAsB,MAAM,gCAAgC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.js","sourceRoot":"","sources":["../../../src/lib/vite-plugin-reactive-data/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,sBAAsB,MAAM,gCAAgC,CAAA"}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import type { VitePluginJson } from '#lib/vite-plugin-json';
|
2
|
-
import { type ComputedRef } from '@vue/reactivity';
|
3
|
-
import type { Plugin } from 'vite';
|
4
|
-
interface ReactiveDataOptions {
|
5
|
-
/**
|
6
|
-
* Virtual module ID (e.g., 'virtual:polen/navbar') that this data will be exported from.
|
7
|
-
* The appropriate extension will be appended automatically based on moduleType.
|
8
|
-
*/
|
9
|
-
moduleId: string;
|
10
|
-
/**
|
11
|
-
* The reactive data to expose.
|
12
|
-
* Can be either:
|
13
|
-
* - A Vue computed ref (recommended)
|
14
|
-
* - A function that returns reactive data
|
15
|
-
* - A reactive value directly
|
16
|
-
*/
|
17
|
-
data: ComputedRef<object | unknown[]> | (() => object | unknown[]) | object | unknown[];
|
18
|
-
/**
|
19
|
-
* JSON codec to use
|
20
|
-
* Default: JSON
|
21
|
-
* Only used when includeJsonPlugin is true
|
22
|
-
*/
|
23
|
-
codec?: VitePluginJson.Codec;
|
24
|
-
/**
|
25
|
-
* Custom plugin name. Can use to help identify this plugin in logs if using many instances of this plugin.
|
26
|
-
@default 'reactive-data'
|
27
|
-
*/
|
28
|
-
name?: string;
|
29
|
-
}
|
30
|
-
export declare const create: (options: ReactiveDataOptions) => Plugin;
|
31
|
-
export {};
|
32
|
-
//# sourceMappingURL=vite-plugin-reactive-data.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"vite-plugin-reactive-data.d.ts","sourceRoot":"","sources":["../../../src/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,iBAAiB,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAA;AAEjD,UAAU,mBAAmB;IAC3B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;;OAMG;IACH,IAAI,EAAE,WAAW,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC,GAAG,MAAM,GAAG,OAAO,EAAE,CAAA;IACvF;;;;OAIG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,KAAK,CAAA;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAID,eAAO,MAAM,MAAM,GAAI,SAAS,mBAAmB,KAAG,MAyFrD,CAAA"}
|
@@ -1,85 +0,0 @@
|
|
1
|
-
import { debugPolen } from '#singletons/debug';
|
2
|
-
import { effect, isRef } from '@vue/reactivity';
|
3
|
-
const pluginDebug = debugPolen.sub(`vite-reactive-data`);
|
4
|
-
export const create = (options) => {
|
5
|
-
const codec = options.codec ?? JSON;
|
6
|
-
const moduleId = options.moduleId;
|
7
|
-
const name = options.name ?? `reactive-data`;
|
8
|
-
const debug = pluginDebug.sub(name);
|
9
|
-
debug(`constructor`, { moduleId });
|
10
|
-
let $server;
|
11
|
-
let $invalidationScheduled = false;
|
12
|
-
const tryInvalidate = () => {
|
13
|
-
$invalidationScheduled = false;
|
14
|
-
if (!$server)
|
15
|
-
throw new Error(`Server not available yet - this should be impossible`);
|
16
|
-
const moduleNode = $server.moduleGraph.getModuleById(moduleId);
|
17
|
-
if (moduleNode) {
|
18
|
-
debug(`invalidate`, { id: moduleNode.id });
|
19
|
-
$server.moduleGraph.invalidateModule(moduleNode);
|
20
|
-
}
|
21
|
-
else {
|
22
|
-
debug(`cannot invalidate`, {
|
23
|
-
reason: `notInModuleGraph`,
|
24
|
-
moduleId,
|
25
|
-
hint: `maybe it was not loaded yet`,
|
26
|
-
});
|
27
|
-
}
|
28
|
-
};
|
29
|
-
const scheduleInvalidate = () => {
|
30
|
-
if ($invalidationScheduled)
|
31
|
-
return; // already scheduled
|
32
|
-
$invalidationScheduled = true;
|
33
|
-
if (!$server)
|
34
|
-
return; // server will flush when ready
|
35
|
-
tryInvalidate();
|
36
|
-
};
|
37
|
-
// Helper to get the current data value
|
38
|
-
const getData = () => {
|
39
|
-
if (isRef(options.data)) {
|
40
|
-
return options.data.value;
|
41
|
-
}
|
42
|
-
else if (typeof options.data === `function`) {
|
43
|
-
return options.data();
|
44
|
-
}
|
45
|
-
else {
|
46
|
-
return options.data;
|
47
|
-
}
|
48
|
-
};
|
49
|
-
// Set up reactive effect immediately
|
50
|
-
effect(() => {
|
51
|
-
// Access data to track dependencies
|
52
|
-
const data = getData();
|
53
|
-
debug(`effect triggered`, { data });
|
54
|
-
scheduleInvalidate();
|
55
|
-
});
|
56
|
-
return {
|
57
|
-
name,
|
58
|
-
configureServer(_server) {
|
59
|
-
debug(`hook configureServer`);
|
60
|
-
$server = _server;
|
61
|
-
if ($invalidationScheduled) {
|
62
|
-
debug(`try invalidate scheduled before server was ready`);
|
63
|
-
tryInvalidate();
|
64
|
-
}
|
65
|
-
},
|
66
|
-
resolveId(id) {
|
67
|
-
if (id === moduleId) {
|
68
|
-
return moduleId;
|
69
|
-
}
|
70
|
-
},
|
71
|
-
// todo make use of Vite's builtin json plugin
|
72
|
-
// for example, call it here somehow
|
73
|
-
load(id) {
|
74
|
-
if (id !== moduleId)
|
75
|
-
return;
|
76
|
-
const data = getData();
|
77
|
-
debug(`hook load`, { data });
|
78
|
-
return {
|
79
|
-
code: codec.stringify(data),
|
80
|
-
map: null,
|
81
|
-
};
|
82
|
-
},
|
83
|
-
};
|
84
|
-
};
|
85
|
-
//# sourceMappingURL=vite-plugin-reactive-data.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"vite-plugin-reactive-data.js","sourceRoot":"","sources":["../../../src/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAoB,MAAM,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AA8BjE,MAAM,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAA4B,EAAU,EAAE;IAC7D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,CAAA;IACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IACjC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,eAAe,CAAA;IAE5C,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACnC,KAAK,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAElC,IAAI,OAAsB,CAAA;IAC1B,IAAI,sBAAsB,GAAG,KAAK,CAAA;IAElC,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,sBAAsB,GAAG,KAAK,CAAA;QAC9B,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;QACrF,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;QAC9D,IAA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G,OAAO,CAAA;YACjB,IAAI,sBAAsB,EAAE,CAAC;gBAC3B,KAAK,CAAC,kDAAkD,CAAC,CAAA;gBACzD,aAAa,EAAE,CAAA;YACjB,CAAC;QACH,CAAC;QAED,SAAS,CAAC,EAAE;YACV,IAAI,EAAE,KAAK,QAAQ,EAAE,CAAC;gBACpB,OAAO,QAAQ,CAAA;YACjB,CAAC;QACH,CAAC;QAED,8CAA8C;QAC9C,oCAAoC;QACpC,IAAI,CAAC,EAAE;YACL,IAAI,EAAE,KAAK,QAAQ;gBAAE,OAAM;YAE3B,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;YACtB,KAAK,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;YAE5B,OAAO;gBACL,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;gBAC3B,GAAG,EAAE,IAAI;aACV,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export * as ExtensibleData from './extensible-data.js'
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import { computed, reactive } from '@vue/reactivity'
|
2
|
-
import type { ComputedRef, UnwrapRefSimple } from '@vue/reactivity'
|
3
|
-
|
4
|
-
type Join<$Data> = (chunks: $Data[]) => $Data
|
5
|
-
type Create<$Data> = () => $Data
|
6
|
-
|
7
|
-
interface DataTypeOperations<$Data> {
|
8
|
-
join: Join<$Data>
|
9
|
-
create: Create<$Data>
|
10
|
-
}
|
11
|
-
|
12
|
-
export const create = <$Data extends object = object>(dataTypeOperations: DataTypeOperations<$Data>) => {
|
13
|
-
return new ExtensibleData<$Data>(dataTypeOperations)
|
14
|
-
}
|
15
|
-
|
16
|
-
export class ExtensibleData<$Data extends object = object> {
|
17
|
-
public value: ComputedRef<$Data> = computed(() => {
|
18
|
-
const namespacedDataItems = Array.from(this.namespacedReactiveData.values())
|
19
|
-
const data = this.dataTypeOperations.join(namespacedDataItems as $Data[])
|
20
|
-
return data
|
21
|
-
})
|
22
|
-
|
23
|
-
private namespacedReactiveData = reactive(new Map<string, $Data>())
|
24
|
-
|
25
|
-
private dataTypeOperations: DataTypeOperations<$Data>
|
26
|
-
|
27
|
-
constructor(dataTypeOperations: DataTypeOperations<$Data>) {
|
28
|
-
this.dataTypeOperations = dataTypeOperations
|
29
|
-
}
|
30
|
-
|
31
|
-
get(namespace: string): $Data {
|
32
|
-
if (!this.namespacedReactiveData.has(namespace)) {
|
33
|
-
const data = this.dataTypeOperations.create()
|
34
|
-
this.namespacedReactiveData.set(namespace, data as UnwrapRefSimple<$Data>)
|
35
|
-
}
|
36
|
-
return this.namespacedReactiveData.get(namespace)! as $Data
|
37
|
-
}
|
38
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export * as VitePluginReactiveData from './vite-plugin-reactive-data.js'
|
@@ -1,124 +0,0 @@
|
|
1
|
-
import type { VitePluginJson } from '#lib/vite-plugin-json'
|
2
|
-
import { debugPolen } from '#singletons/debug'
|
3
|
-
import { type ComputedRef, effect, isRef } from '@vue/reactivity'
|
4
|
-
import type { Plugin, ViteDevServer } from 'vite'
|
5
|
-
|
6
|
-
interface ReactiveDataOptions {
|
7
|
-
/**
|
8
|
-
* Virtual module ID (e.g., 'virtual:polen/navbar') that this data will be exported from.
|
9
|
-
* The appropriate extension will be appended automatically based on moduleType.
|
10
|
-
*/
|
11
|
-
moduleId: string
|
12
|
-
/**
|
13
|
-
* The reactive data to expose.
|
14
|
-
* Can be either:
|
15
|
-
* - A Vue computed ref (recommended)
|
16
|
-
* - A function that returns reactive data
|
17
|
-
* - A reactive value directly
|
18
|
-
*/
|
19
|
-
data: ComputedRef<object | unknown[]> | (() => object | unknown[]) | object | unknown[]
|
20
|
-
/**
|
21
|
-
* JSON codec to use
|
22
|
-
* Default: JSON
|
23
|
-
* Only used when includeJsonPlugin is true
|
24
|
-
*/
|
25
|
-
codec?: VitePluginJson.Codec
|
26
|
-
/**
|
27
|
-
* Custom plugin name. Can use to help identify this plugin in logs if using many instances of this plugin.
|
28
|
-
@default 'reactive-data'
|
29
|
-
*/
|
30
|
-
name?: string
|
31
|
-
}
|
32
|
-
|
33
|
-
const pluginDebug = debugPolen.sub(`vite-reactive-data`)
|
34
|
-
|
35
|
-
export const create = (options: ReactiveDataOptions): Plugin => {
|
36
|
-
const codec = options.codec ?? JSON
|
37
|
-
const moduleId = options.moduleId
|
38
|
-
const name = options.name ?? `reactive-data`
|
39
|
-
|
40
|
-
const debug = pluginDebug.sub(name)
|
41
|
-
debug(`constructor`, { moduleId })
|
42
|
-
|
43
|
-
let $server: ViteDevServer
|
44
|
-
let $invalidationScheduled = false
|
45
|
-
|
46
|
-
const tryInvalidate = () => {
|
47
|
-
$invalidationScheduled = false
|
48
|
-
if (!$server) throw new Error(`Server not available yet - this should be impossible`)
|
49
|
-
const moduleNode = $server.moduleGraph.getModuleById(moduleId)
|
50
|
-
if (moduleNode) {
|
51
|
-
debug(`invalidate`, { id: moduleNode.id })
|
52
|
-
$server.moduleGraph.invalidateModule(moduleNode)
|
53
|
-
} else {
|
54
|
-
debug(`cannot invalidate`, {
|
55
|
-
reason: `notInModuleGraph`,
|
56
|
-
moduleId,
|
57
|
-
hint: `maybe it was not loaded yet`,
|
58
|
-
})
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
const scheduleInvalidate = () => {
|
63
|
-
if ($invalidationScheduled) return // already scheduled
|
64
|
-
|
65
|
-
$invalidationScheduled = true
|
66
|
-
|
67
|
-
if (!$server) return // server will flush when ready
|
68
|
-
|
69
|
-
tryInvalidate()
|
70
|
-
}
|
71
|
-
|
72
|
-
// Helper to get the current data value
|
73
|
-
const getData = () => {
|
74
|
-
if (isRef(options.data)) {
|
75
|
-
return options.data.value
|
76
|
-
} else if (typeof options.data === `function`) {
|
77
|
-
return options.data()
|
78
|
-
} else {
|
79
|
-
return options.data
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
// Set up reactive effect immediately
|
84
|
-
effect(() => {
|
85
|
-
// Access data to track dependencies
|
86
|
-
const data = getData()
|
87
|
-
debug(`effect triggered`, { data })
|
88
|
-
|
89
|
-
scheduleInvalidate()
|
90
|
-
})
|
91
|
-
|
92
|
-
return {
|
93
|
-
name,
|
94
|
-
|
95
|
-
configureServer(_server) {
|
96
|
-
debug(`hook configureServer`)
|
97
|
-
$server = _server
|
98
|
-
if ($invalidationScheduled) {
|
99
|
-
debug(`try invalidate scheduled before server was ready`)
|
100
|
-
tryInvalidate()
|
101
|
-
}
|
102
|
-
},
|
103
|
-
|
104
|
-
resolveId(id) {
|
105
|
-
if (id === moduleId) {
|
106
|
-
return moduleId
|
107
|
-
}
|
108
|
-
},
|
109
|
-
|
110
|
-
// todo make use of Vite's builtin json plugin
|
111
|
-
// for example, call it here somehow
|
112
|
-
load(id) {
|
113
|
-
if (id !== moduleId) return
|
114
|
-
|
115
|
-
const data = getData()
|
116
|
-
debug(`hook load`, { data })
|
117
|
-
|
118
|
-
return {
|
119
|
-
code: codec.stringify(data),
|
120
|
-
map: null,
|
121
|
-
}
|
122
|
-
},
|
123
|
-
}
|
124
|
-
}
|