// ── pixelzen/core v2.4.0 ──────────────────────
import type { FramerConfig,
SiteOptions, DeployTarget,
Bundle, BuildResult,
SEOConfig, PageGraph } from '@pixelzen/core'
import { buildConfig, compile,
push, resolveAssets,
optimiseImages,
generateSitemap } from '@pixelzen/compiler'
import { injectSchema,
resolveOpenGraph,
patchCanonicals,
scorePageSpeed } from '@pixelzen/seo'
import { z } from 'zod'
// ── Schema ─────────────────────────────────────
const DeploySchema = z.object({
target : z.enum([ 'production' ,
'staging' , 'preview' ]),
seo : z.object({
injectSchema : z.boolean(),
scoreThreshold : z.number()
.min( 0 ).max( 100 )
}),
assets : z.object({
optimise : z.boolean(),
maxWidth : z.number().default( 1920 ),
format : z.enum([ 'webp' , 'avif' ]).default( 'webp' )
})
})
// ── Types ──────────────────────────────────────
type PipelineStage =
| 'resolve' | 'compile'
| 'optimise' | 'seo'
| 'push' | 'done'
type PipelineEvent = {
stage : PipelineStage
durationMs : number
ok : boolean
error ?: string
}
@injectable ()
@singleton ()
@logPipeline ({ level: 'verbose' , trackDuration: true })
export class PixelZenEngine implements ISiteEngine {
private readonly config : FramerConfig
private readonly cms : FramerCMSAdapter
private log : PipelineEvent [] = []
constructor (opts: SiteOptions , cms: FramerCMSAdapter ) {
this .config = buildConfig (opts)
this .cms = cms
}
async deploy (raw: unknown): Promise < BuildResult > {
const opts = DeploySchema .parse(raw)
const pages = await this .resolvePages()
const bundle = await this .runPipeline(pages, opts)
return { bundle, ok: true , log: this .log,
deployedAt: new Date ().toISOString() }
}
// ── pixelzen/core v2.4.0 ──────────────────────
import type { FramerConfig,
SiteOptions, DeployTarget,
Bundle, BuildResult,
SEOConfig, PageGraph } from '@pixelzen/core'
import { buildConfig, compile,
push, resolveAssets,
optimiseImages,
generateSitemap } from '@pixelzen/compiler'
import { injectSchema,
resolveOpenGraph,
patchCanonicals,
scorePageSpeed } from '@pixelzen/seo'
import { z } from 'zod'
// ── Schema ─────────────────────────────────────
const DeploySchema = z.object({
target : z.enum([ 'production' ,
'staging' , 'preview' ]),
seo : z.object({
injectSchema : z.boolean(),
scoreThreshold : z.number()
.min( 0 ).max( 100 )
}),
assets : z.object({
optimise : z.boolean(),
maxWidth : z.number().default( 1920 ),
format : z.enum([ 'webp' , 'avif' ]).default( 'webp' )
})
})
// ── Types ──────────────────────────────────────
type PipelineStage =
| 'resolve' | 'compile'
| 'optimise' | 'seo'
| 'push' | 'done'
type PipelineEvent = {
stage : PipelineStage
durationMs : number
ok : boolean
error ?: string
}
@injectable ()
@singleton ()
@logPipeline ({ level: 'verbose' , trackDuration: true })
export class PixelZenEngine implements ISiteEngine {
private readonly config : FramerConfig
private readonly cms : FramerCMSAdapter
private log : PipelineEvent [] = []
constructor (opts: SiteOptions , cms: FramerCMSAdapter ) {
this .config = buildConfig (opts)
this .cms = cms
}
async deploy (raw: unknown): Promise < BuildResult > {
const opts = DeploySchema .parse(raw)
const pages = await this .resolvePages()
const bundle = await this .runPipeline(pages, opts)
return { bundle, ok: true , log: this .log,
deployedAt: new Date ().toISOString() }
}
// ── pixelzen/core v2.4.0 ──────────────────────
import type { FramerConfig,
SiteOptions, DeployTarget,
Bundle, BuildResult,
SEOConfig, PageGraph } from '@pixelzen/core'
import { buildConfig, compile,
push, resolveAssets,
optimiseImages,
generateSitemap } from '@pixelzen/compiler'
import { injectSchema,
resolveOpenGraph,
patchCanonicals,
scorePageSpeed } from '@pixelzen/seo'
import { z } from 'zod'
// ── Schema ─────────────────────────────────────
const DeploySchema = z.object({
target : z.enum([ 'production' ,
'staging' , 'preview' ]),
seo : z.object({
injectSchema : z.boolean(),
scoreThreshold : z.number()
.min( 0 ).max( 100 )
}),
assets : z.object({
optimise : z.boolean(),
maxWidth : z.number().default( 1920 ),
format : z.enum([ 'webp' , 'avif' ]).default( 'webp' )
})
})
// ── Types ──────────────────────────────────────
type PipelineStage =
| 'resolve' | 'compile'
| 'optimise' | 'seo'
| 'push' | 'done'
type PipelineEvent = {
stage : PipelineStage
durationMs : number
ok : boolean
error ?: string
}
@injectable ()
@singleton ()
@logPipeline ({ level: 'verbose' , trackDuration: true })
export class PixelZenEngine implements ISiteEngine {
private readonly config : FramerConfig
private readonly cms : FramerCMSAdapter
private log : PipelineEvent [] = []
constructor (opts: SiteOptions , cms: FramerCMSAdapter ) {
this .config = buildConfig (opts)
this .cms = cms
}
async deploy (raw: unknown): Promise < BuildResult > {
const opts = DeploySchema .parse(raw)
const pages = await this .resolvePages()
const bundle = await this .runPipeline(pages, opts)
return { bundle, ok: true , log: this .log,
deployedAt: new Date ().toISOString() }
}
// ── Pipeline ─────────────────────────────────
private async runPipeline (pages: PageGraph , opts: DeployOptions )
: Promise < Bundle > {
const assets = await this .stage('resolve',
() => resolveAssets (pages, this .config))
const compiled = await this .stage('compile',
() => compile ({ pages, assets, config: this .config }))
const optimised = await this .stage('optimise',
() => optimiseImages (compiled, opts.assets))
const withSEO = await this .stage('seo',
() => this .applySEO(optimised, opts.seo))
await this .stage('push',
() => push ({ bundle: withSEO, target: opts.target }))
return withSEO
}
private async stage < T >(name: PipelineStage , fn: () => Promise < T >): Promise < T > {
const t0 = performance.now()
try {
const result = await fn ()
this .log.push({ stage: name, ok: true , durationMs: performance.now() - t0 })
return result
} catch (err) {
this .log.push({ stage: name, ok: false ,
durationMs: performance.now() - t0, error: String (err) })
throw err
}
}
private async applySEO (bundle: Bundle , cfg: SEOConfig ): Promise < Bundle > {
if (cfg.injectSchema) await injectSchema (bundle)
await resolveOpenGraph (bundle, { fallbackImage: '/og-default.png' , siteName: 'PixelZen' })
await patchCanonicals (bundle, { trailingSlash: false , lowerCase: true })
await generateSitemap (bundle, { priority: 0.8 , changefreq: 'weekly' })
const score = await scorePageSpeed (bundle)
if (score < cfg.scoreThreshold) throw new Error (`score ${score} below threshold`)
return bundle
}
private async resolvePages (): Promise < PageGraph > {
const raw = await this .cms.fetchPages()
return raw.filter(p => !p.draft && p.slug !== null )
}
}
// ── Constants ───────────────────────────────────
export const VERSION = '2.4.0' as const
export const MAX_PAGES = 500
export const DEFAULT_THRESHOLD = 85
// ── Factory ─────────────────────────────────────
export function createEngine (opts: SiteOptions , cms: FramerCMSAdapter ): PixelZenEngine {
return new PixelZenEngine (opts, cms)
}
// ── Interface ───────────────────────────────────
export interface ISiteEngine {
deploy (raw: unknown): Promise < BuildResult >
}
// ── Pipeline ─────────────────────────────────
private async runPipeline (pages: PageGraph , opts: DeployOptions )
: Promise < Bundle > {
const assets = await this .stage('resolve',
() => resolveAssets (pages, this .config))
const compiled = await this .stage('compile',
() => compile ({ pages, assets, config: this .config }))
const optimised = await this .stage('optimise',
() => optimiseImages (compiled, opts.assets))
const withSEO = await this .stage('seo',
() => this .applySEO(optimised, opts.seo))
await this .stage('push',
() => push ({ bundle: withSEO, target: opts.target }))
return withSEO
}
private async stage < T >(name: PipelineStage , fn: () => Promise < T >): Promise < T > {
const t0 = performance.now()
try {
const result = await fn ()
this .log.push({ stage: name, ok: true , durationMs: performance.now() - t0 })
return result
} catch (err) {
this .log.push({ stage: name, ok: false ,
durationMs: performance.now() - t0, error: String (err) })
throw err
}
}
private async applySEO (bundle: Bundle , cfg: SEOConfig ): Promise < Bundle > {
if (cfg.injectSchema) await injectSchema (bundle)
await resolveOpenGraph (bundle, { fallbackImage: '/og-default.png' , siteName: 'PixelZen' })
await patchCanonicals (bundle, { trailingSlash: false , lowerCase: true })
await generateSitemap (bundle, { priority: 0.8 , changefreq: 'weekly' })
const score = await scorePageSpeed (bundle)
if (score < cfg.scoreThreshold) throw new Error (`score ${score} below threshold`)
return bundle
}
private async resolvePages (): Promise < PageGraph > {
const raw = await this .cms.fetchPages()
return raw.filter(p => !p.draft && p.slug !== null )
}
}
// ── Constants ───────────────────────────────────
export const VERSION = '2.4.0' as const
export const MAX_PAGES = 500
export const DEFAULT_THRESHOLD = 85
// ── Factory ─────────────────────────────────────
export function createEngine (opts: SiteOptions , cms: FramerCMSAdapter ): PixelZenEngine {
return new PixelZenEngine (opts, cms)
}
// ── Interface ───────────────────────────────────
export interface ISiteEngine {
deploy (raw: unknown): Promise < BuildResult >
}
// ── Pipeline ─────────────────────────────────
private async runPipeline (pages: PageGraph , opts: DeployOptions )
: Promise < Bundle > {
const assets = await this .stage('resolve',
() => resolveAssets (pages, this .config))
const compiled = await this .stage('compile',
() => compile ({ pages, assets, config: this .config }))
const optimised = await this .stage('optimise',
() => optimiseImages (compiled, opts.assets))
const withSEO = await this .stage('seo',
() => this .applySEO(optimised, opts.seo))
await this .stage('push',
() => push ({ bundle: withSEO, target: opts.target }))
return withSEO
}
private async stage < T >(name: PipelineStage , fn: () => Promise < T >): Promise < T > {
const t0 = performance.now()
try {
const result = await fn ()
this .log.push({ stage: name, ok: true , durationMs: performance.now() - t0 })
return result
} catch (err) {
this .log.push({ stage: name, ok: false ,
durationMs: performance.now() - t0, error: String (err) })
throw err
}
}
private async applySEO (bundle: Bundle , cfg: SEOConfig ): Promise < Bundle > {
if (cfg.injectSchema) await injectSchema (bundle)
await resolveOpenGraph (bundle, { fallbackImage: '/og-default.png' , siteName: 'PixelZen' })
await patchCanonicals (bundle, { trailingSlash: false , lowerCase: true })
await generateSitemap (bundle, { priority: 0.8 , changefreq: 'weekly' })
const score = await scorePageSpeed (bundle)
if (score < cfg.scoreThreshold) throw new Error (`score ${score} below threshold`)
return bundle
}
private async resolvePages (): Promise < PageGraph > {
const raw = await this .cms.fetchPages()
return raw.filter(p => !p.draft && p.slug !== null )
}
}
// ── Constants ───────────────────────────────────
export const VERSION = '2.4.0' as const
export const MAX_PAGES = 500
export const DEFAULT_THRESHOLD = 85
// ── Factory ─────────────────────────────────────
export function createEngine (opts: SiteOptions , cms: FramerCMSAdapter ): PixelZenEngine {
return new PixelZenEngine (opts, cms)
}
// ── Interface ───────────────────────────────────
export interface ISiteEngine {
deploy (raw: unknown): Promise < BuildResult >
}
Become A PixelZen Sponsor The Framer Partner Your Business Needs We partner with design and marketing teams to build, migrate, and scale Framer sites — engineered for performance, optimized for search, built to last.
Book A CallFind Your Match