@conloca/astro-cms 0.1.14 → 0.1.16
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/README.md +65 -5
- package/dist/collections-Bd7EME4b.mjs +129 -0
- package/dist/collections-Bd7EME4b.mjs.map +1 -0
- package/dist/collections.d.mts +3 -3
- package/dist/collections.d.mts.map +1 -1
- package/dist/collections.mjs +2 -56
- package/dist/components.d.mts +6 -31
- package/dist/components.d.mts.map +1 -1
- package/dist/components.mjs +100 -45
- package/dist/components.mjs.map +1 -1
- package/dist/hydration.d.mts +2 -2
- package/dist/hydration.mjs +2 -3
- package/dist/index.d.mts +12 -88
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +19 -797
- package/dist/index.mjs.map +1 -1
- package/dist/internal/acorn-default.mjs +29 -0
- package/dist/{cms-handler.d.mts → internal/cms-handler.d.mts} +0 -1
- package/dist/internal/cms-handler.d.mts.map +1 -0
- package/dist/{cms-handler.mjs → internal/cms-handler.mjs} +57 -8
- package/dist/internal/cms-handler.mjs.map +1 -0
- package/dist/internal/page-handler.astro +541 -0
- package/dist/lib/hydration-script.d.mts +1 -2
- package/dist/lib/hydration-script.d.mts.map +1 -1
- package/dist/lib/hydration-script.mjs +1 -2
- package/dist/lib/hydration-script.mjs.map +1 -1
- package/dist/locales-helpers-BvYYqnJ5.d.mts +64 -0
- package/dist/locales-helpers-BvYYqnJ5.d.mts.map +1 -0
- package/dist/locales-helpers-qiwh7nxS.mjs +54 -0
- package/dist/locales-helpers-qiwh7nxS.mjs.map +1 -0
- package/dist/node/content.d.mts +18 -0
- package/dist/node/content.d.mts.map +1 -0
- package/dist/node/content.d.ts +3 -0
- package/dist/node/content.d.ts.map +1 -0
- package/dist/node/content.js +2 -0
- package/dist/node/content.mjs +2 -0
- package/dist/node/index.d.mts +200 -0
- package/dist/node/index.d.mts.map +1 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +3 -0
- package/dist/node/index.mjs +2513 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/{serialize-props-DqfDQeFl.mjs → serialize-props-BHoNpzH6.mjs} +4 -5
- package/dist/{serialize-props-DqfDQeFl.mjs.map → serialize-props-BHoNpzH6.mjs.map} +1 -1
- package/dist/src/cms-handler.d.ts +19 -0
- package/dist/src/cms-handler.d.ts.map +1 -0
- package/dist/src/cms-handler.js +366 -0
- package/dist/src/collections.d.ts +32 -0
- package/dist/src/collections.d.ts.map +1 -0
- package/dist/src/collections.js +50 -0
- package/dist/src/components/HydrationWrapper.d.ts +18 -0
- package/dist/src/components/HydrationWrapper.d.ts.map +1 -0
- package/dist/src/components/HydrationWrapper.js +21 -0
- package/dist/src/components/RenderWithBlocks.d.ts +23 -0
- package/dist/src/components/RenderWithBlocks.d.ts.map +1 -0
- package/dist/src/components/RenderWithBlocks.js +129 -0
- package/dist/src/components/RenderWithHydration.d.ts +17 -0
- package/dist/src/components/RenderWithHydration.d.ts.map +1 -0
- package/dist/src/components/RenderWithHydration.js +36 -0
- package/dist/src/components.d.ts +4 -0
- package/dist/src/components.d.ts.map +1 -0
- package/dist/src/components.js +3 -0
- package/dist/src/discovery/astro-frontmatter.d.ts +18 -0
- package/dist/src/discovery/astro-frontmatter.d.ts.map +1 -0
- package/dist/src/discovery/astro-frontmatter.js +24 -0
- package/dist/src/discovery/extract-props-ts.d.ts +41 -0
- package/dist/src/discovery/extract-props-ts.d.ts.map +1 -0
- package/dist/src/discovery/extract-props-ts.js +231 -0
- package/dist/src/discovery/merge-registry.d.ts +58 -0
- package/dist/src/discovery/merge-registry.d.ts.map +1 -0
- package/dist/src/discovery/merge-registry.js +332 -0
- package/dist/src/discovery/registry-endpoint.d.ts +42 -0
- package/dist/src/discovery/registry-endpoint.d.ts.map +1 -0
- package/dist/src/discovery/registry-endpoint.js +81 -0
- package/dist/src/discovery/scan-components.d.ts +98 -0
- package/dist/src/discovery/scan-components.d.ts.map +1 -0
- package/dist/src/discovery/scan-components.js +399 -0
- package/dist/src/discovery/scan-mdx.d.ts +63 -0
- package/dist/src/discovery/scan-mdx.d.ts.map +1 -0
- package/dist/src/discovery/scan-mdx.js +112 -0
- package/dist/src/discovery/scan-overrides.d.ts +71 -0
- package/dist/src/discovery/scan-overrides.d.ts.map +1 -0
- package/dist/src/discovery/scan-overrides.js +33 -0
- package/dist/src/hydration.d.ts +4 -0
- package/dist/src/hydration.d.ts.map +1 -0
- package/dist/src/hydration.js +4 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +25 -0
- package/dist/src/lib/hydration-scanner.d.ts +47 -0
- package/dist/src/lib/hydration-scanner.d.ts.map +1 -0
- package/dist/src/lib/hydration-scanner.js +135 -0
- package/dist/src/lib/hydration-script.d.ts +28 -0
- package/dist/src/lib/hydration-script.d.ts.map +1 -0
- package/dist/src/lib/hydration-script.js +88 -0
- package/dist/src/lib/hydration-utils.d.ts +51 -0
- package/dist/src/lib/hydration-utils.d.ts.map +1 -0
- package/dist/src/lib/hydration-utils.js +83 -0
- package/dist/src/lib/page-api.d.ts +77 -0
- package/dist/src/lib/page-api.d.ts.map +1 -0
- package/dist/src/lib/page-api.js +121 -0
- package/dist/src/lib/route-utils.d.ts +41 -0
- package/dist/src/lib/route-utils.d.ts.map +1 -0
- package/dist/src/lib/route-utils.js +78 -0
- package/dist/src/lib/routing-config.d.ts +32 -0
- package/dist/src/lib/routing-config.d.ts.map +1 -0
- package/dist/src/lib/routing-config.js +93 -0
- package/dist/src/lib/serialize-props.d.ts +6 -0
- package/dist/src/lib/serialize-props.d.ts.map +1 -0
- package/dist/src/lib/serialize-props.js +7 -0
- package/dist/src/lib/virtual-module-generators.d.ts +57 -0
- package/dist/src/lib/virtual-module-generators.d.ts.map +1 -0
- package/dist/src/lib/virtual-module-generators.js +263 -0
- package/dist/src/lib/withHydration.d.ts +51 -0
- package/dist/src/lib/withHydration.d.ts.map +1 -0
- package/dist/src/lib/withHydration.js +49 -0
- package/dist/src/loader.d.ts +14 -0
- package/dist/src/loader.d.ts.map +1 -0
- package/dist/src/loader.js +89 -0
- package/dist/src/locales-helpers.d.ts +61 -0
- package/dist/src/locales-helpers.d.ts.map +1 -0
- package/dist/src/locales-helpers.js +49 -0
- package/dist/src/mime-types.d.ts +3 -0
- package/dist/src/mime-types.d.ts.map +1 -0
- package/dist/src/mime-types.js +19 -0
- package/dist/src/path-validation.d.ts +8 -0
- package/dist/src/path-validation.d.ts.map +1 -0
- package/dist/src/path-validation.js +12 -0
- package/dist/src/plugin-spa.d.ts +164 -0
- package/dist/src/plugin-spa.d.ts.map +1 -0
- package/dist/src/plugin-spa.js +972 -0
- package/dist/src/safe-json-stringify.d.ts +13 -0
- package/dist/src/safe-json-stringify.d.ts.map +1 -0
- package/dist/src/safe-json-stringify.js +6 -0
- package/dist/src/site-styles/content-wrapper-endpoint.d.ts +76 -0
- package/dist/src/site-styles/content-wrapper-endpoint.d.ts.map +1 -0
- package/dist/src/site-styles/content-wrapper-endpoint.js +227 -0
- package/dist/src/site-styles/render-endpoint.d.ts +55 -0
- package/dist/src/site-styles/render-endpoint.d.ts.map +1 -0
- package/dist/src/site-styles/render-endpoint.js +263 -0
- package/dist/src/site-styles/styles-endpoint.d.ts +61 -0
- package/dist/src/site-styles/styles-endpoint.d.ts.map +1 -0
- package/dist/src/site-styles/styles-endpoint.js +158 -0
- package/dist/src/types.d.ts +627 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +1 -0
- package/dist/{types-Bsd_qENn.d.mts → types-CS9neadI.d.mts} +193 -3
- package/dist/types-CS9neadI.d.mts.map +1 -0
- package/dist/virtual-modules.d.ts +155 -0
- package/dist/{withHydration-692fMySA.mjs → withHydration-C256ox_6.mjs} +6 -2
- package/dist/withHydration-C256ox_6.mjs.map +1 -0
- package/dist/{withHydration-BGgQDE-H.d.mts → withHydration-DkKpkmzJ.d.mts} +5 -2
- package/dist/withHydration-DkKpkmzJ.d.mts.map +1 -0
- package/package.json +106 -40
- package/dist/cms-handler.d.mts.map +0 -1
- package/dist/cms-handler.mjs.map +0 -1
- package/dist/collections.mjs.map +0 -1
- package/dist/handlers/page-handler.astro +0 -299
- package/dist/loader-W3i9kf3p.mjs +0 -61
- package/dist/loader-W3i9kf3p.mjs.map +0 -1
- package/dist/types-Bsd_qENn.d.mts.map +0 -1
- package/dist/withHydration-692fMySA.mjs.map +0 -1
- package/dist/withHydration-BGgQDE-H.d.mts.map +0 -1
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate the virtual:conloca-routing-config module.
|
|
3
|
+
*
|
|
4
|
+
* Returns a module that exports the resolved routing configuration as default.
|
|
5
|
+
*
|
|
6
|
+
* @param config - Resolved routing configuration with all defaults applied
|
|
7
|
+
* @returns JavaScript module code as a string
|
|
8
|
+
*/
|
|
9
|
+
export function generateRoutingConfigModule(config) {
|
|
10
|
+
return `export default ${JSON.stringify(config, null, 2)};`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Generate the virtual:conloca-layout module.
|
|
14
|
+
*
|
|
15
|
+
* Returns a module that re-exports the layout component or exports undefined
|
|
16
|
+
* if no layout is configured.
|
|
17
|
+
*
|
|
18
|
+
* Currently uses the first route's layout. Multi-layout support is future work.
|
|
19
|
+
*
|
|
20
|
+
* @param routing - Routing configuration (may be undefined if routing disabled)
|
|
21
|
+
* @returns JavaScript module code as a string
|
|
22
|
+
*/
|
|
23
|
+
export function generateLayoutModule(routing) {
|
|
24
|
+
// Get layout from first route (for now - multi-layout is future work)
|
|
25
|
+
const routes = routing?.routes || {};
|
|
26
|
+
const firstRoute = Object.values(routes)[0];
|
|
27
|
+
const layoutPath = firstRoute?.layout;
|
|
28
|
+
if (layoutPath) {
|
|
29
|
+
// Convert relative path to absolute for Vite resolution
|
|
30
|
+
// ./src/... -> /src/...
|
|
31
|
+
const absolutePath = layoutPath.startsWith('.') ? `/${layoutPath.slice(2)}` : layoutPath;
|
|
32
|
+
return `export { default } from '${absolutePath}';`;
|
|
33
|
+
}
|
|
34
|
+
return 'export default undefined;';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generate the virtual:conloca-page-api module.
|
|
38
|
+
*
|
|
39
|
+
* Returns a module that provides page loading functions wrapping ContentAPI:
|
|
40
|
+
* - getAllPages(collection?) - For getStaticPaths()
|
|
41
|
+
* - getPage(pathname, collection?) - For page data loading
|
|
42
|
+
* - pageExists(pathname, collection?) - For 404 checks
|
|
43
|
+
* - contentOptions - Configuration for ContentAPI (for MDX evaluation)
|
|
44
|
+
*
|
|
45
|
+
* @param options - Configuration for ContentAPI initialization
|
|
46
|
+
* @returns JavaScript module code as a string
|
|
47
|
+
*/
|
|
48
|
+
export function generatePageApiModule(options) {
|
|
49
|
+
return `
|
|
50
|
+
import { createContentAPI } from '@conloca/content-api/reader';
|
|
51
|
+
|
|
52
|
+
// Export content options for MDX evaluation and other ContentAPI uses
|
|
53
|
+
export const contentOptions = {
|
|
54
|
+
contentRoot: '${options.contentRoot}',
|
|
55
|
+
canvasDir: '${options.canvasDir}',
|
|
56
|
+
siteName: '${options.siteName}',
|
|
57
|
+
locale: '${options.locale}',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Initialize ContentAPI with configured paths
|
|
61
|
+
const contentApi = await createContentAPI({
|
|
62
|
+
contentRoot: contentOptions.contentRoot,
|
|
63
|
+
canvasDir: contentOptions.canvasDir,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Get site instance for page operations (configured via routing.siteName)
|
|
67
|
+
const site = contentApi.getSite(contentOptions.siteName);
|
|
68
|
+
const locale = contentOptions.locale; // Configured via routing.locale
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Get all pages for static path generation.
|
|
72
|
+
* @param collection - Optional collection filter
|
|
73
|
+
*/
|
|
74
|
+
export async function getAllPages(collection) {
|
|
75
|
+
const pages = [];
|
|
76
|
+
|
|
77
|
+
// listPages is a generator that yields ContentManifest objects
|
|
78
|
+
for (const manifest of site.listPages(locale)) {
|
|
79
|
+
// Get the localized data for pathname/title
|
|
80
|
+
const localeData = manifest.locales[locale];
|
|
81
|
+
if (!localeData) continue;
|
|
82
|
+
|
|
83
|
+
const pathname = localeData.pathname || '/' + manifest.id.replace(/^index$/, '');
|
|
84
|
+
|
|
85
|
+
// Collection resolution: explicit collection in manifest, or default 'pages'
|
|
86
|
+
const resolvedCollection = manifest.collection || 'pages';
|
|
87
|
+
|
|
88
|
+
// Filter by requested collection
|
|
89
|
+
if (collection && resolvedCollection !== collection) continue;
|
|
90
|
+
|
|
91
|
+
pages.push({
|
|
92
|
+
id: manifest.id,
|
|
93
|
+
pathname: pathname,
|
|
94
|
+
title: localeData.meta?.title || manifest.id,
|
|
95
|
+
collection: resolvedCollection,
|
|
96
|
+
meta: localeData.meta || {},
|
|
97
|
+
timestamps: {
|
|
98
|
+
created: localeData.created,
|
|
99
|
+
modified: localeData.modified,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return pages;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get pages matching a path prefix.
|
|
109
|
+
* @param prefix - Path prefix to match (e.g., '/blog/')
|
|
110
|
+
* @param options - Optional sort and limit settings
|
|
111
|
+
* @returns Array of PageReference objects
|
|
112
|
+
*/
|
|
113
|
+
export async function getPagesByPrefix(prefix, options = {}) {
|
|
114
|
+
const allPages = await getAllPages();
|
|
115
|
+
|
|
116
|
+
let filtered = allPages.filter(page =>
|
|
117
|
+
page.pathname.startsWith(prefix) &&
|
|
118
|
+
page.pathname !== prefix && // Exclude the listing page itself
|
|
119
|
+
page.pathname !== prefix.slice(0, -1) // Exclude without trailing slash
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
// Sort by date (newest first by default)
|
|
123
|
+
if (options.sort === 'date-desc' || !options.sort) {
|
|
124
|
+
filtered.sort((a, b) => {
|
|
125
|
+
const dateA = a.timestamps?.modified || a.timestamps?.created || new Date(0);
|
|
126
|
+
const dateB = b.timestamps?.modified || b.timestamps?.created || new Date(0);
|
|
127
|
+
return new Date(dateB).getTime() - new Date(dateA).getTime();
|
|
128
|
+
});
|
|
129
|
+
} else if (options.sort === 'date-asc') {
|
|
130
|
+
filtered.sort((a, b) => {
|
|
131
|
+
const dateA = a.timestamps?.modified || a.timestamps?.created || new Date(0);
|
|
132
|
+
const dateB = b.timestamps?.modified || b.timestamps?.created || new Date(0);
|
|
133
|
+
return new Date(dateA).getTime() - new Date(dateB).getTime();
|
|
134
|
+
});
|
|
135
|
+
} else if (options.sort === 'title') {
|
|
136
|
+
filtered.sort((a, b) => (a.title || '').localeCompare(b.title || ''));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (options.limit && options.limit > 0) {
|
|
140
|
+
filtered = filtered.slice(0, options.limit);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return filtered;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Load full page data for rendering.
|
|
148
|
+
* @param pathname - URL pathname (e.g., '/about')
|
|
149
|
+
* @param collection - Optional collection to search in
|
|
150
|
+
*/
|
|
151
|
+
export async function getPage(pathname, collection) {
|
|
152
|
+
// Use site.getByPathname which returns ContentManifest (metadata only)
|
|
153
|
+
const manifest = site.getByPathname(pathname, locale);
|
|
154
|
+
|
|
155
|
+
if (!manifest) {
|
|
156
|
+
const error = new Error(\`Page not found: \${pathname}\`);
|
|
157
|
+
error.code = 'PAGE_NOT_FOUND';
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Optionally filter by collection
|
|
162
|
+
if (collection && manifest.collection !== collection) {
|
|
163
|
+
const error = new Error(\`Page not found: \${pathname}\`);
|
|
164
|
+
error.code = 'PAGE_NOT_FOUND';
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Get the full content with locale data
|
|
169
|
+
const content = await contentApi.getLocalized(manifest.id, locale);
|
|
170
|
+
|
|
171
|
+
if (!content) {
|
|
172
|
+
const error = new Error(\`Page not found: \${pathname}\`);
|
|
173
|
+
error.code = 'PAGE_NOT_FOUND';
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const localeData = content.localized;
|
|
178
|
+
const meta = localeData.meta || {};
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
id: manifest.id,
|
|
182
|
+
title: meta.title || manifest.id,
|
|
183
|
+
description: meta.description,
|
|
184
|
+
pathname: pathname,
|
|
185
|
+
puckData: localeData.content?.puckData,
|
|
186
|
+
collection: manifest.collection || collection || 'pages',
|
|
187
|
+
route: {
|
|
188
|
+
name: 'pages', // Will be set by caller
|
|
189
|
+
pattern: '/[...slug]',
|
|
190
|
+
meta: {},
|
|
191
|
+
},
|
|
192
|
+
meta: meta,
|
|
193
|
+
timestamps: {
|
|
194
|
+
created: localeData.created,
|
|
195
|
+
modified: localeData.modified,
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Check if a page exists without loading full data.
|
|
202
|
+
* @param pathname - URL pathname
|
|
203
|
+
* @param collection - Optional collection filter
|
|
204
|
+
*/
|
|
205
|
+
export function pageExists(pathname, collection) {
|
|
206
|
+
// getByPathname is synchronous - returns ContentManifest | null
|
|
207
|
+
const manifest = site.getByPathname(pathname, locale);
|
|
208
|
+
|
|
209
|
+
if (!manifest) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// If collection filter specified, verify it matches
|
|
214
|
+
if (collection && manifest.collection !== collection) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Get all entries from a data collection.
|
|
223
|
+
* @param collection - Data collection name
|
|
224
|
+
* @param localeOverride - Optional locale override (defaults to configured locale)
|
|
225
|
+
* @returns Array of DataCollectionEntry objects
|
|
226
|
+
*/
|
|
227
|
+
export async function getDataCollection(collection, localeOverride) {
|
|
228
|
+
const targetLocale = localeOverride || locale;
|
|
229
|
+
const entries = [];
|
|
230
|
+
|
|
231
|
+
// List all manifests in the collection
|
|
232
|
+
for (const manifest of contentApi.data.listContent({ collection })) {
|
|
233
|
+
// Get localized data for each entry
|
|
234
|
+
const localized = await contentApi.getLocalized(manifest.id, targetLocale);
|
|
235
|
+
if (localized) {
|
|
236
|
+
entries.push({
|
|
237
|
+
id: manifest.id,
|
|
238
|
+
name: manifest.name,
|
|
239
|
+
data: localized.content?.data || {},
|
|
240
|
+
meta: manifest.meta || {},
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return entries;
|
|
246
|
+
}
|
|
247
|
+
`;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Generate the virtual:conloca-puck-config module.
|
|
251
|
+
*
|
|
252
|
+
* Returns a module that re-exports the Puck configuration.
|
|
253
|
+
* This is separate from the HMR-enabled puck-entry.js used by the CMS SPA.
|
|
254
|
+
*
|
|
255
|
+
* @param puckConfigPath - Path to the puck config module
|
|
256
|
+
* @returns JavaScript module code as a string
|
|
257
|
+
*/
|
|
258
|
+
export function generatePuckConfigModule(puckConfigPath) {
|
|
259
|
+
// Convert relative path to absolute for Vite resolution
|
|
260
|
+
// ./src/... -> /src/...
|
|
261
|
+
const absolutePath = puckConfigPath.startsWith('.') ? `/${puckConfigPath.slice(2)}` : puckConfigPath;
|
|
262
|
+
return `export { default } from '${absolutePath}';`;
|
|
263
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Metadata attached to components marked for hydration.
|
|
4
|
+
* Used by the build-time scanner and runtime hydration system.
|
|
5
|
+
*/
|
|
6
|
+
export interface HydrationMeta {
|
|
7
|
+
strategy: 'load' | 'visible' | 'idle';
|
|
8
|
+
__isHydratable: true;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Hydration strategy for the withHydration wrapper.
|
|
12
|
+
* Does not include 'none' since wrapping implies hydration is desired.
|
|
13
|
+
*/
|
|
14
|
+
export type WithHydrationStrategy = 'load' | 'visible' | 'idle';
|
|
15
|
+
/**
|
|
16
|
+
* Marks a component's render function for client-side hydration.
|
|
17
|
+
*
|
|
18
|
+
* This wrapper attaches metadata to the component function, enabling:
|
|
19
|
+
* 1. Build-time discovery via static analysis of source files
|
|
20
|
+
* 2. Runtime hydration strategy determination
|
|
21
|
+
*
|
|
22
|
+
* The wrapper does NOT create a new component or add runtime overhead.
|
|
23
|
+
* It simply attaches a `__hydration` property to the existing function.
|
|
24
|
+
*
|
|
25
|
+
* **Constraint:** Hydratable components must not use `puck.renderDropZone`,
|
|
26
|
+
* `puck.isEditing`, or `puck.metadata` — the `puck` prop is stripped during
|
|
27
|
+
* serialization and not available at hydration time.
|
|
28
|
+
*
|
|
29
|
+
* @param Component - The React component to mark for hydration
|
|
30
|
+
* @param strategy - When to hydrate: 'load', 'visible', or 'idle'
|
|
31
|
+
* @returns The same component with hydration metadata attached
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // In a Puck component file (e.g., TestimonialGrid.tsx)
|
|
36
|
+
* import { withHydration } from '@conloca/astro-cms'
|
|
37
|
+
*
|
|
38
|
+
* const TestimonialGridComponent = ({ title, testimonials }) => {
|
|
39
|
+
* const [currentPage, setCurrentPage] = useState(0)
|
|
40
|
+
* // ... interactive logic
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* export const TestimonialGrid: ComponentConfig<Props> = {
|
|
44
|
+
* fields: { ... },
|
|
45
|
+
* defaultProps: { ... },
|
|
46
|
+
* render: withHydration(TestimonialGridComponent, 'visible'),
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function withHydration<T extends (props: any) => React.ReactNode>(Component: T, strategy: WithHydrationStrategy): T;
|
|
51
|
+
//# sourceMappingURL=withHydration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withHydration.d.ts","sourceRoot":"","sources":["../../../src/lib/withHydration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,cAAc,EAAE,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,SAAS,EACrE,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,qBAAqB,GAC9B,CAAC,CAeH"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks a component's render function for client-side hydration.
|
|
3
|
+
*
|
|
4
|
+
* This wrapper attaches metadata to the component function, enabling:
|
|
5
|
+
* 1. Build-time discovery via static analysis of source files
|
|
6
|
+
* 2. Runtime hydration strategy determination
|
|
7
|
+
*
|
|
8
|
+
* The wrapper does NOT create a new component or add runtime overhead.
|
|
9
|
+
* It simply attaches a `__hydration` property to the existing function.
|
|
10
|
+
*
|
|
11
|
+
* **Constraint:** Hydratable components must not use `puck.renderDropZone`,
|
|
12
|
+
* `puck.isEditing`, or `puck.metadata` — the `puck` prop is stripped during
|
|
13
|
+
* serialization and not available at hydration time.
|
|
14
|
+
*
|
|
15
|
+
* @param Component - The React component to mark for hydration
|
|
16
|
+
* @param strategy - When to hydrate: 'load', 'visible', or 'idle'
|
|
17
|
+
* @returns The same component with hydration metadata attached
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // In a Puck component file (e.g., TestimonialGrid.tsx)
|
|
22
|
+
* import { withHydration } from '@conloca/astro-cms'
|
|
23
|
+
*
|
|
24
|
+
* const TestimonialGridComponent = ({ title, testimonials }) => {
|
|
25
|
+
* const [currentPage, setCurrentPage] = useState(0)
|
|
26
|
+
* // ... interactive logic
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* export const TestimonialGrid: ComponentConfig<Props> = {
|
|
30
|
+
* fields: { ... },
|
|
31
|
+
* defaultProps: { ... },
|
|
32
|
+
* render: withHydration(TestimonialGridComponent, 'visible'),
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function withHydration(Component, strategy) {
|
|
37
|
+
// Environment variable escape hatch for debugging
|
|
38
|
+
if (typeof process !== 'undefined' && process.env?.CONLOCA_DISABLE_HYDRATION === 'true') {
|
|
39
|
+
return Component;
|
|
40
|
+
}
|
|
41
|
+
// Attach metadata directly to the function object
|
|
42
|
+
// This avoids creating a wrapper component and keeps bundle size minimal
|
|
43
|
+
const HydratableComponent = Component;
|
|
44
|
+
HydratableComponent.__hydration = {
|
|
45
|
+
strategy,
|
|
46
|
+
__isHydratable: true,
|
|
47
|
+
};
|
|
48
|
+
return HydratableComponent;
|
|
49
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Loader } from 'astro/loaders';
|
|
2
|
+
export interface ConlocaLoaderOptions {
|
|
3
|
+
collection?: string;
|
|
4
|
+
contentRoot: string;
|
|
5
|
+
site?: string;
|
|
6
|
+
/** Collection kind. If not provided, defaults to 'block' for 'blocks' collection, 'page' otherwise. */
|
|
7
|
+
kind?: 'page' | 'block' | 'data';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Custom Astro content loader for Conloca CMS.
|
|
11
|
+
* Loads content from the Conloca content directory into Astro collections.
|
|
12
|
+
*/
|
|
13
|
+
export declare function conlocaLoader(options: ConlocaLoaderOptions): Loader;
|
|
14
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uGAAuG;IACvG,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAgGnE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createContentAPI } from '@conloca/content-api/reader';
|
|
2
|
+
/**
|
|
3
|
+
* Custom Astro content loader for Conloca CMS.
|
|
4
|
+
* Loads content from the Conloca content directory into Astro collections.
|
|
5
|
+
*/
|
|
6
|
+
export function conlocaLoader(options) {
|
|
7
|
+
return {
|
|
8
|
+
name: 'conloca-loader',
|
|
9
|
+
async load(context) {
|
|
10
|
+
const { store, parseData, generateDigest, logger } = context;
|
|
11
|
+
// Create content API instance
|
|
12
|
+
const api = await createContentAPI({ contentRoot: options.contentRoot });
|
|
13
|
+
// Use provided kind, or fall back to inferring from collection name
|
|
14
|
+
const kind = options.kind ?? (options.collection === 'blocks' ? 'block' : 'page');
|
|
15
|
+
// List all content for this collection
|
|
16
|
+
// Note: blocks and data don't have a site, so only pass site for pages
|
|
17
|
+
const content = Array.from(api.listAllContent({
|
|
18
|
+
collection: options.collection,
|
|
19
|
+
kind,
|
|
20
|
+
site: kind === 'page' ? options.site : undefined,
|
|
21
|
+
}));
|
|
22
|
+
store.clear();
|
|
23
|
+
for (const manifest of content) {
|
|
24
|
+
// Skip type:'mdx' pages — they're owned by an external renderer
|
|
25
|
+
// (any Astro loader reading from a site's `mdxPages` path in
|
|
26
|
+
// sites.json, such as Starlight's stock docsLoader) and would
|
|
27
|
+
// otherwise collide with the puck-page route handler.
|
|
28
|
+
if (kind === 'page' && manifest.type === 'mdx')
|
|
29
|
+
continue;
|
|
30
|
+
for (const [locale, localeVersion] of Object.entries(manifest.locales)) {
|
|
31
|
+
if (!localeVersion)
|
|
32
|
+
continue;
|
|
33
|
+
const entryId = `${manifest.id}/${locale}`;
|
|
34
|
+
// For data and page collections, fetch full content to get the actual content fields
|
|
35
|
+
let dataContent;
|
|
36
|
+
let mdxContent;
|
|
37
|
+
let puckData;
|
|
38
|
+
if (kind === 'data') {
|
|
39
|
+
const fullContent = await api.getLocalized(manifest.id, locale);
|
|
40
|
+
if (fullContent?.localized.content?.data) {
|
|
41
|
+
dataContent = fullContent.localized.content.data;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else if (kind === 'block') {
|
|
45
|
+
const fullContent = await api.getLocalized(manifest.id, locale);
|
|
46
|
+
if (fullContent?.localized.content?.mdx) {
|
|
47
|
+
mdxContent = fullContent.localized.content.mdx;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (kind === 'page') {
|
|
51
|
+
// For page collections, fetch full content to get puckData
|
|
52
|
+
// This enables getCollection('pages') to return entries with puckData included
|
|
53
|
+
const fullContent = await api.getLocalized(manifest.id, locale);
|
|
54
|
+
if (fullContent?.localized.content?.puckData) {
|
|
55
|
+
puckData = fullContent.localized.content.puckData;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const data = {
|
|
59
|
+
id: manifest.id,
|
|
60
|
+
locale,
|
|
61
|
+
...(localeVersion.pathname && { pathname: localeVersion.pathname }),
|
|
62
|
+
...(localeVersion.name && { name: localeVersion.name }),
|
|
63
|
+
...localeVersion.meta,
|
|
64
|
+
created: localeVersion.created,
|
|
65
|
+
modified: localeVersion.modified,
|
|
66
|
+
publishAt: localeVersion.publishAt,
|
|
67
|
+
unpublishAt: localeVersion.unpublishAt,
|
|
68
|
+
// Include the data content for data collections
|
|
69
|
+
...(dataContent && { data: dataContent }),
|
|
70
|
+
};
|
|
71
|
+
if (mdxContent !== undefined) {
|
|
72
|
+
data.mdx = mdxContent;
|
|
73
|
+
}
|
|
74
|
+
// Include puckData for page collections (added separately to avoid spread type issues)
|
|
75
|
+
if (puckData !== undefined) {
|
|
76
|
+
data.puckData = puckData;
|
|
77
|
+
}
|
|
78
|
+
const parsedData = await parseData({ id: entryId, data });
|
|
79
|
+
store.set({
|
|
80
|
+
id: entryId,
|
|
81
|
+
data: parsedData,
|
|
82
|
+
digest: generateDigest(localeVersion.etag),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
logger.info(`Loaded ${store.keys().length} entries from ${options.collection || `${kind} content`}`);
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conloca's view of a site's locales.
|
|
3
|
+
*
|
|
4
|
+
* `list` is the full set of locales the site supports; `defaultLocale`
|
|
5
|
+
* is the one that lives at the root in the `'directory'` mdx-pages
|
|
6
|
+
* strategy. Pass this shape into `conlocaCMS({ locales })`.
|
|
7
|
+
*/
|
|
8
|
+
export interface ConlocaLocales {
|
|
9
|
+
list: string[];
|
|
10
|
+
defaultLocale: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Translate Astro's native `i18n` config into Conloca's locale shape.
|
|
14
|
+
*
|
|
15
|
+
* Astro 4+ accepts both bare strings and `{ codes, path }` objects in
|
|
16
|
+
* its `locales` array — this helper flattens both forms.
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { conlocaCMS, localesFromAstroI18n } from '@conloca/astro-cms/node';
|
|
21
|
+
* const i18n = { defaultLocale: 'en', locales: ['en', 'de'] };
|
|
22
|
+
* defineConfig({
|
|
23
|
+
* i18n,
|
|
24
|
+
* integrations: [conlocaCMS({ locales: localesFromAstroI18n(i18n) })],
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function localesFromAstroI18n(i18n: {
|
|
29
|
+
defaultLocale: string;
|
|
30
|
+
locales: ReadonlyArray<string | {
|
|
31
|
+
codes: string[];
|
|
32
|
+
path: string;
|
|
33
|
+
}>;
|
|
34
|
+
}): ConlocaLocales;
|
|
35
|
+
/**
|
|
36
|
+
* Translate Starlight's i18n config into Conloca's locale shape.
|
|
37
|
+
*
|
|
38
|
+
* Starlight shape: `{ defaultLocale: 'en', locales: { en: { label, lang? }, de: { ... } } }`.
|
|
39
|
+
* The default locale falls back to the first key in `locales` if unset,
|
|
40
|
+
* then to `'en'`.
|
|
41
|
+
*
|
|
42
|
+
* Usage:
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { conlocaCMS, localesFromStarlight } from '@conloca/astro-cms/node';
|
|
45
|
+
* const starlightConfig = { defaultLocale: 'en', locales: { en: { label: 'English' } } };
|
|
46
|
+
* defineConfig({
|
|
47
|
+
* integrations: [
|
|
48
|
+
* starlight(starlightConfig),
|
|
49
|
+
* conlocaCMS({ locales: localesFromStarlight(starlightConfig) }),
|
|
50
|
+
* ],
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function localesFromStarlight(starlight: {
|
|
55
|
+
defaultLocale?: string;
|
|
56
|
+
locales?: Record<string, {
|
|
57
|
+
label?: string;
|
|
58
|
+
lang?: string;
|
|
59
|
+
}>;
|
|
60
|
+
}): ConlocaLocales;
|
|
61
|
+
//# sourceMappingURL=locales-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales-helpers.d.ts","sourceRoot":"","sources":["../../src/locales-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,aAAa,CAAC,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE,GAAG,cAAc,CAKjB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7D,GAAG,cAAc,CAOjB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translate Astro's native `i18n` config into Conloca's locale shape.
|
|
3
|
+
*
|
|
4
|
+
* Astro 4+ accepts both bare strings and `{ codes, path }` objects in
|
|
5
|
+
* its `locales` array — this helper flattens both forms.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { conlocaCMS, localesFromAstroI18n } from '@conloca/astro-cms/node';
|
|
10
|
+
* const i18n = { defaultLocale: 'en', locales: ['en', 'de'] };
|
|
11
|
+
* defineConfig({
|
|
12
|
+
* i18n,
|
|
13
|
+
* integrations: [conlocaCMS({ locales: localesFromAstroI18n(i18n) })],
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function localesFromAstroI18n(i18n) {
|
|
18
|
+
return {
|
|
19
|
+
defaultLocale: i18n.defaultLocale,
|
|
20
|
+
list: i18n.locales.flatMap((l) => (typeof l === 'string' ? [l] : l.codes)),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Translate Starlight's i18n config into Conloca's locale shape.
|
|
25
|
+
*
|
|
26
|
+
* Starlight shape: `{ defaultLocale: 'en', locales: { en: { label, lang? }, de: { ... } } }`.
|
|
27
|
+
* The default locale falls back to the first key in `locales` if unset,
|
|
28
|
+
* then to `'en'`.
|
|
29
|
+
*
|
|
30
|
+
* Usage:
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { conlocaCMS, localesFromStarlight } from '@conloca/astro-cms/node';
|
|
33
|
+
* const starlightConfig = { defaultLocale: 'en', locales: { en: { label: 'English' } } };
|
|
34
|
+
* defineConfig({
|
|
35
|
+
* integrations: [
|
|
36
|
+
* starlight(starlightConfig),
|
|
37
|
+
* conlocaCMS({ locales: localesFromStarlight(starlightConfig) }),
|
|
38
|
+
* ],
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function localesFromStarlight(starlight) {
|
|
43
|
+
const list = Object.keys(starlight.locales ?? {});
|
|
44
|
+
const fallback = starlight.defaultLocale ?? list[0] ?? 'en';
|
|
45
|
+
return {
|
|
46
|
+
defaultLocale: fallback,
|
|
47
|
+
list: list.length > 0 ? list : [fallback],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime-types.d.ts","sourceRoot":"","sources":["../../src/mime-types.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiBjD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** MIME types for SPA static asset serving. Covers all file types produced by the cms-spa build. */
|
|
2
|
+
export const SPA_MIME_TYPES = {
|
|
3
|
+
'.js': 'application/javascript',
|
|
4
|
+
'.mjs': 'application/javascript',
|
|
5
|
+
'.css': 'text/css',
|
|
6
|
+
'.html': 'text/html',
|
|
7
|
+
'.json': 'application/json',
|
|
8
|
+
'.svg': 'image/svg+xml',
|
|
9
|
+
'.png': 'image/png',
|
|
10
|
+
'.jpg': 'image/jpeg',
|
|
11
|
+
'.jpeg': 'image/jpeg',
|
|
12
|
+
'.gif': 'image/gif',
|
|
13
|
+
'.webp': 'image/webp',
|
|
14
|
+
'.woff': 'font/woff',
|
|
15
|
+
'.woff2': 'font/woff2',
|
|
16
|
+
'.ttf': 'font/ttf',
|
|
17
|
+
'.map': 'application/json',
|
|
18
|
+
'.ico': 'image/x-icon',
|
|
19
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates that a target path resolves within a base directory.
|
|
3
|
+
* Prevents path traversal attacks by canonicalizing both paths
|
|
4
|
+
* and checking that the target starts with the base path + separator
|
|
5
|
+
* (or is exactly the base path).
|
|
6
|
+
*/
|
|
7
|
+
export declare function isPathWithinBase(basePath: string, targetPath: string): boolean;
|
|
8
|
+
//# sourceMappingURL=path-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-validation.d.ts","sourceRoot":"","sources":["../../src/path-validation.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAI9E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { resolve, sep } from 'node:path';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that a target path resolves within a base directory.
|
|
4
|
+
* Prevents path traversal attacks by canonicalizing both paths
|
|
5
|
+
* and checking that the target starts with the base path + separator
|
|
6
|
+
* (or is exactly the base path).
|
|
7
|
+
*/
|
|
8
|
+
export function isPathWithinBase(basePath, targetPath) {
|
|
9
|
+
const resolvedBase = resolve(basePath);
|
|
10
|
+
const resolvedTarget = resolve(targetPath);
|
|
11
|
+
return resolvedTarget === resolvedBase || resolvedTarget.startsWith(resolvedBase + sep);
|
|
12
|
+
}
|