@thorprovider/storefront 0.4.0 → 0.6.0
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 +3 -1
- package/assets/templates/app/app/[[...slug]]/page.tsx +19 -1
- package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +20 -30
- package/assets/templates/app/lib/__STOREFRONT__/composition.ts +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +15 -13
- package/assets/templates/app/lib/__STOREFRONT__/schema.ts +34 -4
- package/assets/templates/app/lib/__STOREFRONT__/shell/props.ts +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +14 -15
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/testimonials.tsx +26 -19
- package/assets/templates/features/checkout/state.ts +0 -5
- package/assets/templates/views/account/content.ts +14 -3
- package/assets/templates/views/account/index.tsx +1 -1
- package/assets/templates/views/account/registry.tsx +135 -104
- package/assets/templates/views/account/schema.ts +26 -6
- package/assets/templates/views/category/assembly/assembly.json +1 -1
- package/assets/templates/views/category/assembly/index.skeleton.tsx +11 -7
- package/assets/templates/views/category/assembly/registry.skeleton.tsx +8 -8
- package/assets/templates/views/category/assembly/slots/filter/CategoryListing/catalog.part +5 -0
- package/assets/templates/views/category/assembly/slots/filter/{CategoryFilter2 → CategoryListing}/element.part +5 -3
- package/assets/templates/views/category/assembly/slots/filter/{CategoryFilter2 → CategoryListing}/registry.part +9 -5
- package/assets/templates/views/category/content.ts +2 -1
- package/assets/templates/views/category/index.tsx +19 -13
- package/assets/templates/views/category/props.ts +1 -1
- package/assets/templates/views/category/registry.tsx +17 -13
- package/assets/templates/views/category/schema.ts +48 -21
- package/assets/templates/views/checkout/content.ts +60 -0
- package/assets/templates/views/checkout/props.ts +4 -5
- package/assets/templates/views/checkout/registry.tsx +10 -6
- package/assets/templates/views/checkout/schema.ts +10 -16
- package/assets/templates/views/home/assembly/index.skeleton.tsx +0 -2
- package/assets/templates/views/home/index.tsx +0 -2
- package/assets/templates/views/product/registry.tsx +112 -14
- package/assets/templates/views/product/schema.ts +42 -7
- package/bin/storefront.js +21 -0
- package/examples/merchandising/category-led.json +1 -1
- package/examples/merchandising/collection-led.json +1 -1
- package/package.json +2 -1
- package/recipes/archetypes.json +27 -27
- package/recipes/catalog.json +43 -105
- package/recipes/features.json +2 -2
- package/recipes/recipes.json +10 -16
- package/recipes/sections.json +2 -2
- package/scripts/candidate.mjs +263 -6
- package/scripts/composers.mjs +2 -2
- package/scripts/logical-controls.mjs +4 -4
- package/scripts/operation-registry.mjs +1 -1
- package/scripts/view-assembly.mjs +2 -2
- package/skills/sf-view-gen/assets/recipes/archetypes.json +27 -27
- package/skills/sf-view-gen/assets/recipes/catalog.json +43 -105
- package/skills/sf-view-gen/assets/recipes/features.json +2 -2
- package/skills/sf-view-gen/assets/recipes/recipes.json +10 -16
- package/skills/sf-view-gen/assets/recipes/sections.json +2 -2
- package/skills/sf-view-gen/assets/templates/views/sections/schema.testimonials.ts +21 -11
- package/skills/sf-view-gen/assets/templates/views/sections/testimonials.client.tsx +2 -8
- package/assets/templates/views/category/assembly/slots/filter/CategoryFilter2/catalog.part +0 -5
package/recipes/recipes.json
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
],
|
|
63
63
|
"defaultVariants": {
|
|
64
64
|
"overview": "ProductOverview",
|
|
65
|
-
"reviews": "
|
|
65
|
+
"reviews": "Reviews",
|
|
66
66
|
"breadcrumb": "Breadcrumb"
|
|
67
67
|
},
|
|
68
68
|
"allowedVariants": {
|
|
@@ -70,8 +70,7 @@
|
|
|
70
70
|
"ProductOverview"
|
|
71
71
|
],
|
|
72
72
|
"reviews": [
|
|
73
|
-
"
|
|
74
|
-
"ReviewRating2"
|
|
73
|
+
"Reviews"
|
|
75
74
|
],
|
|
76
75
|
"breadcrumb": [
|
|
77
76
|
"Breadcrumb"
|
|
@@ -128,15 +127,13 @@
|
|
|
128
127
|
"storeCategories"
|
|
129
128
|
],
|
|
130
129
|
"defaultVariants": {
|
|
131
|
-
"filter": "
|
|
130
|
+
"filter": "CategoryListing",
|
|
132
131
|
"productCard": "ProductGrid",
|
|
133
132
|
"breadcrumb": "Breadcrumb"
|
|
134
133
|
},
|
|
135
134
|
"allowedVariants": {
|
|
136
135
|
"filter": [
|
|
137
|
-
"
|
|
138
|
-
"CategoryFilter2",
|
|
139
|
-
"CategoryFilter4"
|
|
136
|
+
"CategoryListing"
|
|
140
137
|
],
|
|
141
138
|
"productCard": [
|
|
142
139
|
"ProductGrid"
|
|
@@ -171,14 +168,12 @@
|
|
|
171
168
|
"checkoutPaymentMethods"
|
|
172
169
|
],
|
|
173
170
|
"defaultVariants": {
|
|
174
|
-
"checkout": "
|
|
171
|
+
"checkout": "Checkout",
|
|
175
172
|
"confirmation": "CheckoutConfirmation"
|
|
176
173
|
},
|
|
177
174
|
"allowedVariants": {
|
|
178
175
|
"checkout": [
|
|
179
|
-
"
|
|
180
|
-
"CheckoutForm2",
|
|
181
|
-
"CheckoutForm3"
|
|
176
|
+
"Checkout"
|
|
182
177
|
],
|
|
183
178
|
"confirmation": [
|
|
184
179
|
"CheckoutConfirmation"
|
|
@@ -202,20 +197,19 @@
|
|
|
202
197
|
"accountCustomer"
|
|
203
198
|
],
|
|
204
199
|
"defaultVariants": {
|
|
205
|
-
"login": "
|
|
200
|
+
"login": "card",
|
|
206
201
|
"register": "SignUpPage1"
|
|
207
202
|
},
|
|
208
203
|
"allowedVariants": {
|
|
209
204
|
"login": [
|
|
210
|
-
"
|
|
211
|
-
"
|
|
205
|
+
"card",
|
|
206
|
+
"social"
|
|
212
207
|
],
|
|
213
208
|
"register": [
|
|
214
209
|
"SignUpPage1"
|
|
215
210
|
],
|
|
216
211
|
"orders": [
|
|
217
|
-
"
|
|
218
|
-
"OrderHistory2"
|
|
212
|
+
"OrderHistory"
|
|
219
213
|
]
|
|
220
214
|
},
|
|
221
215
|
"optionalSections": [],
|
package/recipes/sections.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"name": "testimonials",
|
|
8
8
|
"description": "Customer testimonials or social proof",
|
|
9
9
|
"elementType": "Testimonials",
|
|
10
|
-
"variants": ["
|
|
11
|
-
"defaultVariant": "
|
|
10
|
+
"variants": ["carousel", "bento"],
|
|
11
|
+
"defaultVariant": "carousel",
|
|
12
12
|
"propsHint": "title, badge, items[] (quote, author, role, avatar)",
|
|
13
13
|
"status": "held",
|
|
14
14
|
"reason": "bounded curation: no verified presentation bridge/provenance in the current composition and no verified backend/data source for the MVP"
|
package/scripts/candidate.mjs
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
// The concrete versions are real (validated against the monorepo's own install
|
|
12
12
|
// and the npm registry); the actual external build is M1 evidence.
|
|
13
13
|
|
|
14
|
-
import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
|
14
|
+
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
15
|
+
import { tmpdir } from 'node:os'
|
|
15
16
|
import { join } from 'node:path'
|
|
16
17
|
import { gunzipSync } from 'node:zlib'
|
|
17
18
|
|
|
@@ -42,10 +43,10 @@ export const CANDIDATE_TOOLSET = Object.freeze({
|
|
|
42
43
|
'@json-render/next': '0.21.0',
|
|
43
44
|
}),
|
|
44
45
|
local: Object.freeze({
|
|
45
|
-
'@thorprovider/blocks': '0.
|
|
46
|
-
'@thorprovider/adapters': '5.0
|
|
47
|
-
'@thorprovider/runtime': '0.
|
|
48
|
-
'@thorprovider/types': '
|
|
46
|
+
'@thorprovider/blocks': '3.0.0',
|
|
47
|
+
'@thorprovider/adapters': '5.2.0',
|
|
48
|
+
'@thorprovider/runtime': '0.4.0',
|
|
49
|
+
'@thorprovider/types': '7.0.0',
|
|
49
50
|
}),
|
|
50
51
|
})
|
|
51
52
|
|
|
@@ -223,7 +224,9 @@ export function verifyPackExports({ tgzPath, innerPath, requiredExports }) {
|
|
|
223
224
|
* compile away and need no runtime symbol).
|
|
224
225
|
*/
|
|
225
226
|
export function parseRuntimeCommerceImports(source) {
|
|
226
|
-
const block = source.match(
|
|
227
|
+
const block = source.match(
|
|
228
|
+
/import\s*\{([^}]*)\}\s*from\s*['"]@thorprovider\/runtime\/commerce['"]/,
|
|
229
|
+
)
|
|
227
230
|
if (!block) return []
|
|
228
231
|
return block[1]
|
|
229
232
|
.replace(/\/\/[^\n]*/g, '')
|
|
@@ -234,3 +237,257 @@ export function parseRuntimeCommerceImports(source) {
|
|
|
234
237
|
.map((entry) => entry.replace(/^type\s+/, '').split(/\s+as\s+/)[0].trim())
|
|
235
238
|
.filter(Boolean)
|
|
236
239
|
}
|
|
240
|
+
|
|
241
|
+
// ---------------------------------------------------------------------------
|
|
242
|
+
// Registry candidate preflight
|
|
243
|
+
// ---------------------------------------------------------------------------
|
|
244
|
+
|
|
245
|
+
export const DEFAULT_REGISTRY = 'https://registry.npmjs.org'
|
|
246
|
+
|
|
247
|
+
function registryFailure(code, message) {
|
|
248
|
+
return { ok: false, code, message }
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** The npm registry metadata URL for one exact package version. */
|
|
252
|
+
export function registryMetadataUrl(name, version, registry = DEFAULT_REGISTRY) {
|
|
253
|
+
return `${registry.replace(/\/+$/, '')}/${encodeURIComponent(name)}/${encodeURIComponent(version)}`
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Concrete (non-wildcard) file targets declared by an `exports` map. */
|
|
257
|
+
export function declaredExportTargets(exportsMap) {
|
|
258
|
+
const targets = new Set()
|
|
259
|
+
const visit = (value) => {
|
|
260
|
+
if (typeof value === 'string') {
|
|
261
|
+
if (!value.includes('*')) targets.add(value.replace(/^\.\//, 'package/'))
|
|
262
|
+
return
|
|
263
|
+
}
|
|
264
|
+
if (Array.isArray(value)) {
|
|
265
|
+
for (const item of value) visit(item)
|
|
266
|
+
return
|
|
267
|
+
}
|
|
268
|
+
if (value && typeof value === 'object') {
|
|
269
|
+
for (const item of Object.values(value)) visit(item)
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (exportsMap) {
|
|
273
|
+
if (typeof exportsMap === 'string' || Array.isArray(exportsMap)) visit(exportsMap)
|
|
274
|
+
else for (const value of Object.values(exportsMap)) visit(value)
|
|
275
|
+
}
|
|
276
|
+
return [...targets]
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** Map a `@thorprovider/blocks/...` specifier to its tarball path. */
|
|
280
|
+
export function blockSpecifierPath(specifier) {
|
|
281
|
+
if (specifier === '@thorprovider/blocks') return 'package/dist/index.mjs'
|
|
282
|
+
if (specifier === '@thorprovider/blocks/contracts') return 'package/dist/lib/contracts.mjs'
|
|
283
|
+
if (specifier === '@thorprovider/blocks/styles.css') return 'package/styles.css'
|
|
284
|
+
if (!specifier.startsWith('@thorprovider/blocks/')) return null
|
|
285
|
+
return `package/dist/${specifier.slice('@thorprovider/blocks/'.length)}.mjs`
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** Scan template sources for blocks specifiers and runtime/commerce symbols. */
|
|
289
|
+
export function collectTemplateSurface(templatesDir) {
|
|
290
|
+
const blockImports = new Set()
|
|
291
|
+
const runtimeImports = new Set()
|
|
292
|
+
const walk = (dir) => {
|
|
293
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
294
|
+
if (entry.name === 'node_modules' || entry.name === '.next' || entry.name === 'dist') continue
|
|
295
|
+
const path = join(dir, entry.name)
|
|
296
|
+
if (entry.isDirectory()) {
|
|
297
|
+
walk(path)
|
|
298
|
+
continue
|
|
299
|
+
}
|
|
300
|
+
if (!entry.isFile() || !/\.(?:[cm]?[jt]sx?)$/.test(entry.name)) continue
|
|
301
|
+
const source = readFileSync(path, 'utf8')
|
|
302
|
+
const blockRegex = /(?:from\s*|import\s*)['"](@thorprovider\/blocks(?:\/[^'"]*)?)['"]/g
|
|
303
|
+
for (const match of source.matchAll(blockRegex)) blockImports.add(match[1])
|
|
304
|
+
for (const symbol of parseRuntimeCommerceImports(source)) runtimeImports.add(symbol)
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (templatesDir && existsSync(templatesDir)) walk(templatesDir)
|
|
308
|
+
return { blockImports: [...blockImports].sort(), runtimeImports: [...runtimeImports].sort() }
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Verify a downloaded artifact exposes the surface the generated host needs.
|
|
313
|
+
* `kind: 'blocks'` checks template deep imports and rejects leaked source;
|
|
314
|
+
* `kind: 'runtime'` checks the commerce symbols the templates import.
|
|
315
|
+
*/
|
|
316
|
+
export function verifyRegistryArtifact({
|
|
317
|
+
tgzPath,
|
|
318
|
+
name,
|
|
319
|
+
version,
|
|
320
|
+
kind,
|
|
321
|
+
blockImports = [],
|
|
322
|
+
runtimeImports = [],
|
|
323
|
+
}) {
|
|
324
|
+
const entries = readPackEntries(tgzPath)
|
|
325
|
+
if (!entries) return registryFailure('E_ARTIFACT_INCOMPLETE', `${name}@${version}: tarball is unreadable`)
|
|
326
|
+
const manifest = readPackManifest(tgzPath)
|
|
327
|
+
if (!manifest) {
|
|
328
|
+
return registryFailure('E_ARTIFACT_INCOMPLETE', `${name}@${version}: tarball has no package.json`)
|
|
329
|
+
}
|
|
330
|
+
if (manifest.name !== name || manifest.version !== version) {
|
|
331
|
+
return registryFailure(
|
|
332
|
+
'E_ARTIFACT_INCOMPLETE',
|
|
333
|
+
`${name}@${version}: tarball declares ${manifest.name}@${manifest.version}`,
|
|
334
|
+
)
|
|
335
|
+
}
|
|
336
|
+
const missing = declaredExportTargets(manifest.exports).filter((target) => !entries[target])
|
|
337
|
+
for (const field of ['main', 'types']) {
|
|
338
|
+
const value = manifest[field]
|
|
339
|
+
if (typeof value !== 'string') continue
|
|
340
|
+
const target = `package/${value.replace(/^\.\//, '')}`
|
|
341
|
+
if (!entries[target]) missing.push(target)
|
|
342
|
+
}
|
|
343
|
+
if (kind === 'blocks') {
|
|
344
|
+
for (const specifier of blockImports) {
|
|
345
|
+
const target = blockSpecifierPath(specifier)
|
|
346
|
+
if (target && !entries[target]) missing.push(target)
|
|
347
|
+
}
|
|
348
|
+
if (Object.keys(entries).some((entry) => entry.startsWith('package/src/'))) {
|
|
349
|
+
missing.push('package/src/ (source must not ship)')
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
if (missing.length > 0) {
|
|
353
|
+
const unique = [...new Set(missing)]
|
|
354
|
+
return registryFailure('E_ARTIFACT_INCOMPLETE', `${name}@${version}: missing ${unique.join(', ')}`)
|
|
355
|
+
}
|
|
356
|
+
if (kind === 'runtime') {
|
|
357
|
+
const commerce = entries['package/dist/commerce/index.mjs']
|
|
358
|
+
if (!commerce) {
|
|
359
|
+
return registryFailure('E_ARTIFACT_INCOMPLETE', `${name}@${version}: missing dist/commerce/index.mjs`)
|
|
360
|
+
}
|
|
361
|
+
const source = commerce.toString('utf8')
|
|
362
|
+
const missingSymbols = runtimeImports.filter((symbol) => !new RegExp(`\\b${symbol}\\b`).test(source))
|
|
363
|
+
if (missingSymbols.length > 0) {
|
|
364
|
+
return registryFailure(
|
|
365
|
+
'E_RUNTIME_SURFACE_MISMATCH',
|
|
366
|
+
`${name}@${version}: missing runtime export(s): ${missingSymbols.join(', ')}`,
|
|
367
|
+
)
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return { ok: true }
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Resolve one exact pin against the registry. Metadata is always checked; the
|
|
375
|
+
* tarball is downloaded only when the caller needs to inspect its surface.
|
|
376
|
+
*/
|
|
377
|
+
export async function resolveRegistryCandidate({
|
|
378
|
+
name,
|
|
379
|
+
version,
|
|
380
|
+
registry = DEFAULT_REGISTRY,
|
|
381
|
+
fetchImpl = globalThis.fetch,
|
|
382
|
+
downloadTarball = false,
|
|
383
|
+
}) {
|
|
384
|
+
const url = registryMetadataUrl(name, version, registry)
|
|
385
|
+
let response
|
|
386
|
+
try {
|
|
387
|
+
response = await fetchImpl(url, { headers: { accept: 'application/json' } })
|
|
388
|
+
} catch (cause) {
|
|
389
|
+
return registryFailure('E_REGISTRY_UNREACHABLE', `${name}@${version}: cannot reach ${url} (${cause.message})`)
|
|
390
|
+
}
|
|
391
|
+
if (response.status === 404) {
|
|
392
|
+
return registryFailure('E_PIN_UNPUBLISHED', `${name}@${version} is not published on ${registry}`)
|
|
393
|
+
}
|
|
394
|
+
if (!response.ok) {
|
|
395
|
+
return registryFailure('E_REGISTRY_UNREACHABLE', `${name}@${version}: registry responded ${response.status}`)
|
|
396
|
+
}
|
|
397
|
+
let metadata
|
|
398
|
+
try {
|
|
399
|
+
metadata = await response.json()
|
|
400
|
+
} catch {
|
|
401
|
+
return registryFailure('E_ARTIFACT_INCOMPLETE', `${name}@${version}: registry metadata is not JSON`)
|
|
402
|
+
}
|
|
403
|
+
if (metadata.name !== name || metadata.version !== version) {
|
|
404
|
+
return registryFailure(
|
|
405
|
+
'E_ARTIFACT_INCOMPLETE',
|
|
406
|
+
`${name}@${version}: registry metadata declares ${metadata.name}@${metadata.version}`,
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
const tarballUrl = metadata.dist?.tarball
|
|
410
|
+
if (!tarballUrl) {
|
|
411
|
+
return registryFailure('E_ARTIFACT_INCOMPLETE', `${name}@${version}: metadata has no dist.tarball`)
|
|
412
|
+
}
|
|
413
|
+
if (!downloadTarball) return { ok: true, name, version, metadata, tarballUrl }
|
|
414
|
+
|
|
415
|
+
let tarballResponse
|
|
416
|
+
try {
|
|
417
|
+
tarballResponse = await fetchImpl(tarballUrl)
|
|
418
|
+
} catch (cause) {
|
|
419
|
+
return registryFailure(
|
|
420
|
+
'E_REGISTRY_UNREACHABLE',
|
|
421
|
+
`${name}@${version}: cannot download ${tarballUrl} (${cause.message})`,
|
|
422
|
+
)
|
|
423
|
+
}
|
|
424
|
+
if (!tarballResponse.ok) {
|
|
425
|
+
return registryFailure(
|
|
426
|
+
'E_ARTIFACT_INCOMPLETE',
|
|
427
|
+
`${name}@${version}: tarball download responded ${tarballResponse.status}`,
|
|
428
|
+
)
|
|
429
|
+
}
|
|
430
|
+
let bytes
|
|
431
|
+
try {
|
|
432
|
+
bytes = Buffer.from(await tarballResponse.arrayBuffer())
|
|
433
|
+
} catch {
|
|
434
|
+
return registryFailure('E_ARTIFACT_INCOMPLETE', `${name}@${version}: tarball body is unreadable`)
|
|
435
|
+
}
|
|
436
|
+
const dir = mkdtempSync(join(tmpdir(), 'thor-registry-candidate-'))
|
|
437
|
+
const tgzPath = join(dir, 'package.tgz')
|
|
438
|
+
writeFileSync(tgzPath, bytes)
|
|
439
|
+
return {
|
|
440
|
+
ok: true,
|
|
441
|
+
name,
|
|
442
|
+
version,
|
|
443
|
+
metadata,
|
|
444
|
+
tarballUrl,
|
|
445
|
+
tgzPath,
|
|
446
|
+
cleanup: () => rmSync(dir, { recursive: true, force: true }),
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Resolve every pin in the candidate toolset. Blocks and runtime are also
|
|
452
|
+
* downloaded and inspected; the other packages only need to exist.
|
|
453
|
+
*/
|
|
454
|
+
export async function verifyRegistryToolset({
|
|
455
|
+
toolset = CANDIDATE_TOOLSET,
|
|
456
|
+
cliVersion,
|
|
457
|
+
templatesDir,
|
|
458
|
+
registry = DEFAULT_REGISTRY,
|
|
459
|
+
fetchImpl = globalThis.fetch,
|
|
460
|
+
}) {
|
|
461
|
+
const { blockImports, runtimeImports } = collectTemplateSurface(templatesDir)
|
|
462
|
+
const pins = { ...toolset.local, ...(cliVersion ? { '@thorprovider/storefront': cliVersion } : {}) }
|
|
463
|
+
const resolved = {}
|
|
464
|
+
const errors = []
|
|
465
|
+
for (const [name, version] of Object.entries(pins)) {
|
|
466
|
+
const inspect = name === '@thorprovider/blocks' || name === '@thorprovider/runtime'
|
|
467
|
+
const result = await resolveRegistryCandidate({
|
|
468
|
+
name,
|
|
469
|
+
version,
|
|
470
|
+
registry,
|
|
471
|
+
fetchImpl,
|
|
472
|
+
downloadTarball: inspect,
|
|
473
|
+
})
|
|
474
|
+
if (!result.ok) {
|
|
475
|
+
errors.push({ code: result.code, message: result.message })
|
|
476
|
+
continue
|
|
477
|
+
}
|
|
478
|
+
resolved[name] = result
|
|
479
|
+
if (!inspect) continue
|
|
480
|
+
const artifact = verifyRegistryArtifact({
|
|
481
|
+
tgzPath: result.tgzPath,
|
|
482
|
+
name,
|
|
483
|
+
version,
|
|
484
|
+
kind: name === '@thorprovider/blocks' ? 'blocks' : 'runtime',
|
|
485
|
+
blockImports,
|
|
486
|
+
runtimeImports,
|
|
487
|
+
})
|
|
488
|
+
if (!artifact.ok) errors.push({ code: artifact.code, message: artifact.message })
|
|
489
|
+
}
|
|
490
|
+
for (const result of Object.values(resolved)) result.cleanup?.()
|
|
491
|
+
return { ok: errors.length === 0, errors }
|
|
492
|
+
}
|
|
493
|
+
|
package/scripts/composers.mjs
CHANGED
|
@@ -78,7 +78,7 @@ function isPlainObject(value) {
|
|
|
78
78
|
* Build the `composition.ts` composer: the installed manifest catalog features
|
|
79
79
|
* in stable order, plus their persisted config. This is the generation seam the
|
|
80
80
|
* catalog URL boundary consumes to reject parameters owned by a feature that is
|
|
81
|
-
* not installed, and the seam the single controlled `
|
|
81
|
+
* not installed, and the seam the single controlled `CategoryListing` reads to
|
|
82
82
|
* select its control visibility/config from the installed manifest only. It is
|
|
83
83
|
* derived from the manifest — never hardcoded as always-mounted.
|
|
84
84
|
*
|
|
@@ -116,7 +116,7 @@ export function buildCompositionComposer(features, views = []) {
|
|
|
116
116
|
`// Installed manifest catalog features, in stable order, with their persisted\n` +
|
|
117
117
|
`// config. This is the generation seam the catalog URL boundary consumes to\n` +
|
|
118
118
|
`// reject parameters owned by a feature that is not installed, and the seam the\n` +
|
|
119
|
-
`// single controlled
|
|
119
|
+
`// single controlled CategoryListing reads to select its control\n` +
|
|
120
120
|
`// visibility/config from the installed manifest only.\n\n` +
|
|
121
121
|
`import type { CatalogFeatureName } from '@thorprovider/runtime/contracts'\n\n` +
|
|
122
122
|
`export const mountedFeatures: readonly CatalogFeatureName[] = [${list}]\n\n` +
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// those mounts (E2 design Decision 2c / the task 6.3 M2 resolution).
|
|
12
12
|
//
|
|
13
13
|
// This is metadata only: no new operation, no block, no element. The base
|
|
14
|
-
// listing (`category.filter` rendering the one controlled `
|
|
14
|
+
// listing (`category.filter` rendering the one controlled `CategoryListing`)
|
|
15
15
|
// stays the view default; these controls only toggle visibility on it.
|
|
16
16
|
//
|
|
17
17
|
// IMPORT-CYCLE NOTE: this module is a LEAF. It deliberately does not import
|
|
@@ -26,14 +26,14 @@ import {
|
|
|
26
26
|
logicalControlFor,
|
|
27
27
|
} from './operation-registry.mjs'
|
|
28
28
|
|
|
29
|
-
/** The two E2 control contributions to the single `
|
|
29
|
+
/** The two E2 control contributions to the single `CategoryListing` listing. */
|
|
30
30
|
export const CATALOG_LOGICAL_CONTROLS = Object.freeze([
|
|
31
31
|
Object.freeze({
|
|
32
32
|
kind: LOGICAL_CONTROL_KIND,
|
|
33
33
|
feature: 'catalog-search',
|
|
34
34
|
host: 'category',
|
|
35
35
|
slot: 'search',
|
|
36
|
-
presentation: '
|
|
36
|
+
presentation: 'CategoryListing',
|
|
37
37
|
capability: 'category.search.apply',
|
|
38
38
|
}),
|
|
39
39
|
Object.freeze({
|
|
@@ -41,7 +41,7 @@ export const CATALOG_LOGICAL_CONTROLS = Object.freeze([
|
|
|
41
41
|
feature: 'category-filters',
|
|
42
42
|
host: 'category',
|
|
43
43
|
slot: 'filters',
|
|
44
|
-
presentation: '
|
|
44
|
+
presentation: 'CategoryListing',
|
|
45
45
|
capability: 'category.filter.apply',
|
|
46
46
|
}),
|
|
47
47
|
])
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// `slot`, `presentation`, optional `capability`). It carries no render-owned
|
|
23
23
|
// field (`block`, `element`), no behavior (`reducer`), and no operation. This
|
|
24
24
|
// is the distinction E2 relies on when it contributes search/filters to the
|
|
25
|
-
// single `
|
|
25
|
+
// single `CategoryListing` listing with no new operation (E2 design; E1
|
|
26
26
|
// Decision 16). Registering a whole view is the catalog's job, not this
|
|
27
27
|
// seam's, so a contribution that tries to carry a render field is rejected.
|
|
28
28
|
|
|
@@ -61,7 +61,7 @@ export function fragmentVariants(templateDir, slot) {
|
|
|
61
61
|
//
|
|
62
62
|
// A slot marked `nested: true` is a presentation slot that is rendered inside
|
|
63
63
|
// its host element (for example the category `productCard` inside the single
|
|
64
|
-
// `
|
|
64
|
+
// `CategoryListing` listing), so it has no top-level fragment and is skipped
|
|
65
65
|
// here: it stays in the ordered composition (it is a core registered slot) but
|
|
66
66
|
// contributes no top-level element, catalog entry, or route id.
|
|
67
67
|
export function resolveViewSelection(templateDir, selection = {}) {
|
|
@@ -209,7 +209,7 @@ function renderDataBoundElement(entry, def) {
|
|
|
209
209
|
* A slot marked `nested: true` (a presentation slot rendered inside its host
|
|
210
210
|
* element) stays in the ordered composition but is skipped at the top level, so
|
|
211
211
|
* it contributes no element, catalog entry, registry binding, or route id — the
|
|
212
|
-
* category `productCard` nested in `
|
|
212
|
+
* category `productCard` nested in `CategoryListing`. The default category
|
|
213
213
|
* composition therefore renders exactly the single `category.filter` element.
|
|
214
214
|
*
|
|
215
215
|
* Returns the raw source (placeholders intact); callers run
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"default": "list",
|
|
80
80
|
"intents": {
|
|
81
81
|
"list": {
|
|
82
|
-
"variant": "
|
|
83
|
-
"when": "A
|
|
82
|
+
"variant": "Reviews",
|
|
83
|
+
"when": "A review collection with the required aggregate summary above it and the reviews in a responsive grid (canonical `presentation: 'list'`)."
|
|
84
84
|
},
|
|
85
|
-
"
|
|
86
|
-
"variant": "
|
|
87
|
-
"when": "
|
|
85
|
+
"carousel": {
|
|
86
|
+
"variant": "Reviews",
|
|
87
|
+
"when": "A review collection with the required aggregate summary above it and the reviews in a carousel (canonical `presentation: 'carousel'`)."
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
},
|
|
@@ -100,34 +100,30 @@
|
|
|
100
100
|
"category.filter": {
|
|
101
101
|
"default": "sidebar",
|
|
102
102
|
"intents": {
|
|
103
|
-
"inline": {
|
|
104
|
-
"variant": "CategoryFilter1",
|
|
105
|
-
"when": "A compact inline filter bar above the product grid."
|
|
106
|
-
},
|
|
107
103
|
"sidebar": {
|
|
108
|
-
"variant": "
|
|
109
|
-
"when": "A left sidebar with
|
|
104
|
+
"variant": "CategoryListing",
|
|
105
|
+
"when": "A persistent left sidebar with filters, price range, and sort controls."
|
|
110
106
|
},
|
|
111
|
-
"
|
|
112
|
-
"variant": "
|
|
113
|
-
"when": "
|
|
107
|
+
"toolbar": {
|
|
108
|
+
"variant": "CategoryListing",
|
|
109
|
+
"when": "A sticky toolbar with a filter drawer, active-filter chips, and a sort sheet."
|
|
114
110
|
}
|
|
115
111
|
}
|
|
116
112
|
},
|
|
117
113
|
"checkout.checkout": {
|
|
118
|
-
"default": "
|
|
114
|
+
"default": "multiStep",
|
|
119
115
|
"intents": {
|
|
120
116
|
"singlePage": {
|
|
121
|
-
"variant": "
|
|
122
|
-
"when": "A single-page checkout
|
|
117
|
+
"variant": "Checkout",
|
|
118
|
+
"when": "A single-page checkout with contact, shipping, and payment sections visible at once (canonical `presentation: 'single-page'`)."
|
|
123
119
|
},
|
|
124
120
|
"multiStep": {
|
|
125
|
-
"variant": "
|
|
126
|
-
"when": "A
|
|
121
|
+
"variant": "Checkout",
|
|
122
|
+
"when": "A step-by-step checkout that shows one step at a time (canonical `presentation: 'stepper'`)."
|
|
127
123
|
},
|
|
128
|
-
"
|
|
129
|
-
"variant": "
|
|
130
|
-
"when": "A
|
|
124
|
+
"reviewStep": {
|
|
125
|
+
"variant": "Checkout",
|
|
126
|
+
"when": "A step-by-step checkout that appends a confirmation review before submission (canonical `presentation: 'stepper'` with `showReviewStep`)."
|
|
131
127
|
}
|
|
132
128
|
}
|
|
133
129
|
},
|
|
@@ -135,7 +131,7 @@
|
|
|
135
131
|
"default": "signIn",
|
|
136
132
|
"intents": {
|
|
137
133
|
"signIn": {
|
|
138
|
-
"variant": "
|
|
134
|
+
"variant": "card",
|
|
139
135
|
"when": "A full sign-in page with email and password and a link to create an account."
|
|
140
136
|
}
|
|
141
137
|
}
|
|
@@ -150,11 +146,15 @@
|
|
|
150
146
|
}
|
|
151
147
|
},
|
|
152
148
|
"account.orders": {
|
|
153
|
-
"default": "
|
|
149
|
+
"default": "cards",
|
|
154
150
|
"intents": {
|
|
155
|
-
"
|
|
156
|
-
"variant": "
|
|
157
|
-
"when": "A signed-in shopper's order history with per
|
|
151
|
+
"cards": {
|
|
152
|
+
"variant": "OrderHistory",
|
|
153
|
+
"when": "A signed-in shopper's order history with one card per order and details on demand (canonical `presentation: 'cards'`)."
|
|
154
|
+
},
|
|
155
|
+
"rows": {
|
|
156
|
+
"variant": "OrderHistory",
|
|
157
|
+
"when": "A compact, list-first order history with one bordered row per order (canonical `presentation: 'rows'`)."
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|