@joycostudio/iris 0.0.0-stage → 0.0.1
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/LICENSE +15 -0
- package/README.md +137 -2
- package/dist/browser.cjs +466 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +69 -0
- package/dist/browser.d.ts +69 -0
- package/dist/browser.js +439 -0
- package/dist/browser.js.map +1 -0
- package/dist/cli.cjs +681 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +658 -0
- package/dist/cli.js.map +1 -0
- package/dist/core.cjs +355 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +8 -0
- package/dist/core.d.ts +8 -0
- package/dist/core.js +328 -0
- package/dist/core.js.map +1 -0
- package/dist/next.cjs +380 -0
- package/dist/next.cjs.map +1 -0
- package/dist/next.d.cts +16 -0
- package/dist/next.d.ts +16 -0
- package/dist/next.js +352 -0
- package/dist/next.js.map +1 -0
- package/dist/node.cjs +580 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +47 -0
- package/dist/node.d.ts +47 -0
- package/dist/node.js +542 -0
- package/dist/node.js.map +1 -0
- package/dist/policy-types-LoD2Ldcl.d.cts +147 -0
- package/dist/policy-types-LoD2Ldcl.d.ts +147 -0
- package/dist/react.cjs +628 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +42 -0
- package/dist/react.d.ts +42 -0
- package/dist/react.js +611 -0
- package/dist/react.js.map +1 -0
- package/dist/types-Dv3DS4OX.d.cts +17 -0
- package/dist/types-Dv3DS4OX.d.ts +17 -0
- package/package.json +102 -4
- package/skills/iris-audit/SKILL.md +77 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../packages/node/index.ts","../packages/node/generate.ts","../packages/node/discover.ts","../packages/node/prepare.ts","../packages/core/policy.ts"],"sourcesContent":["export { generateIris } from \"./generate\"\nexport type { IrisGenerateResult } from \"./generate\"\nexport type { IrisGenerateOptions, IrisGenerateSource } from \"./types\"\nexport { prepareIrisAssets } from \"./prepare\"\n","import { mkdir, readFile, realpath, rename, writeFile } from \"node:fs/promises\"\nimport path from \"node:path\"\nimport sharp from \"sharp\"\nimport type { IrisCatalogAsset, IrisPolicy } from \"../core\"\nimport type { IrisGenerateOptions, IrisGenerateSource } from \"./types\"\nimport { discoverIrisSources } from \"./discover\"\nimport { prepareIrisAssets } from \"./prepare\"\n\nexport type IrisGenerateResult = {\n stale: boolean\n placeholders: number\n inspected: number\n skipped: number\n}\n\nexport async function generateIris<Custom>({\n iris,\n generation,\n rootDir = process.cwd(),\n configFile = \"iris.config.ts\",\n allowStale = false,\n fetch: fetcher = fetch,\n}: {\n iris: IrisPolicy<Custom>\n generation: IrisGenerateOptions\n rootDir?: string\n configFile?: string\n allowStale?: boolean\n fetch?: typeof fetch\n}): Promise<IrisGenerateResult> {\n if (!generation.output?.trim())\n throw new Error(\"Iris requires an output directory\")\n const directory = path.resolve(rootDir, generation.output)\n const publicDir = path.resolve(rootDir, generation.publicDir ?? \"public\")\n const adapter = generation.adapter !== false\n try {\n const sources = await discoverIrisSources(\n {\n ...generation,\n sources: [...iris.assets, ...(generation.sources ?? [])],\n },\n rootDir\n )\n const entries = new Map<string, Exclude<IrisGenerateSource, string>>()\n for (const value of sources) {\n const source = typeof value === \"string\" ? { src: value } : value\n const previous = entries.get(source.src)\n entries.set(source.src, {\n ...previous,\n ...source,\n optional: Boolean(\n previous\n ? \"optional\" in previous &&\n previous.optional &&\n \"optional\" in source &&\n source.optional\n : \"optional\" in source && source.optional\n ),\n })\n }\n const catalog: Record<string, IrisCatalogAsset> = {}\n const placeholders: Record<string, string> = {}\n const queue = [...entries.values()]\n let skipped = 0\n let cursor = 0\n async function worker() {\n while (cursor < queue.length) {\n const source = queue[cursor++]\n // Providers may already supply a complete catalog (e.g. Chopper).\n if (\"width\" in source) {\n const prepared = await prepareIrisAssets({\n iris: { assets: [source] },\n rootDir,\n publicDir,\n fetch: fetcher,\n })\n if (!prepared.ok) throw new Error(prepared.error.message)\n catalog[source.src] = prepared.data[0]\n if (source.placeholder) placeholders[source.src] = source.placeholder\n continue\n }\n let bytes: Buffer\n if (/^https?:\\/\\//i.test(source.src)) {\n const response = await fetcher(source.src, {\n signal: AbortSignal.timeout(30_000),\n })\n if (source.optional && response.status === 404) {\n skipped++\n continue\n }\n if (!response.ok)\n throw new Error(`${response.status} fetching ${source.src}`)\n bytes = Buffer.from(await response.arrayBuffer())\n } else {\n const pathname = decodeURIComponent(\n source.src.split(/[?#]/, 1)[0]\n ).replace(/^\\/+/, \"\")\n const file = path.resolve(publicDir, pathname)\n for (const relative of [\n path.relative(publicDir, file),\n path.relative(await realpath(publicDir), await realpath(file)),\n ]) {\n if (\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n )\n throw new Error(\n `Iris local source escapes publicDir: ${source.src}`\n )\n }\n bytes = await readFile(file)\n }\n const meta = await sharp(bytes, { animated: true }).metadata()\n const swapped = (meta.orientation ?? 1) >= 5\n const width = swapped ? meta.height : meta.width\n const height = swapped ? meta.width : (meta.pageHeight ?? meta.height)\n if (!width || !height)\n throw new Error(`Cannot inspect dimensions of ${source.src}`)\n const placeholderOptions = source.placeholderOptions ?? {}\n const format = placeholderOptions.format ?? \"webp\"\n const size = placeholderOptions.width ?? 10\n const quality = placeholderOptions.quality ?? 40\n async function encodePlaceholder({\n width,\n quality,\n }: {\n width: number\n quality: number\n }) {\n const buffer = await sharp(bytes, { page: 0, pages: 1 })\n .rotate()\n .resize({\n width,\n height: width,\n fit: \"inside\",\n withoutEnlargement: true,\n })\n .toFormat(format, { quality })\n .toBuffer()\n return `data:image/${format};base64,${buffer.toString(\"base64\")}`\n }\n const placeholder =\n source.placeholder ??\n (await encodePlaceholder({ width: size, quality }))\n placeholders[source.src] = placeholder\n if (source.placeholderOnly) continue\n const preparedPlaceholders = [...(source.placeholders ?? [])]\n for (const request of iris.placeholderRequests) {\n if (\n preparedPlaceholders.some(\n (item) =>\n item.width === request.width && item.quality === request.quality\n )\n )\n continue\n const url =\n request.width === size && request.quality === quality\n ? placeholder\n : await encodePlaceholder(request)\n preparedPlaceholders.push({ ...request, url })\n }\n const animated = (meta.pages ?? 1) > 1\n const alpha = Boolean(\n meta.hasAlpha && (animated || !(await sharp(bytes).stats()).isOpaque)\n )\n const metadata: IrisCatalogAsset = {\n src: source.src,\n id: source.id,\n width,\n height,\n bytes: bytes.length,\n format: meta.format,\n alpha,\n animated,\n progressive: meta.isProgressive ?? false,\n placeholder,\n placeholders: preparedPlaceholders,\n variants: [],\n }\n if (source.variants?.length) {\n const prepared = await prepareIrisAssets({\n iris: {\n assets: [\n { ...metadata, variants: [] },\n ...source.variants.filter(\n (item): item is string => typeof item === \"string\"\n ),\n ],\n },\n rootDir,\n publicDir,\n fetch: fetcher,\n })\n if (!prepared.ok) throw new Error(prepared.error.message)\n metadata.variants = [\n ...metadata.variants!,\n ...source.variants.map((variant) => {\n if (typeof variant !== \"string\") return variant\n const asset = prepared.data.find((item) => item.src === variant)!\n return { ...asset, url: asset.src }\n }),\n ]\n }\n catalog[source.src] = metadata\n }\n }\n const concurrency = generation.concurrency ?? 4\n if (!Number.isSafeInteger(concurrency) || concurrency < 1)\n throw new Error(\"concurrency must be a positive integer\")\n await Promise.all(Array.from({ length: concurrency }, worker))\n const sorted = (data: object) =>\n Object.fromEntries(\n Object.entries(data).sort(([a], [b]) => a.localeCompare(b))\n )\n const files: [string, unknown][] = [\n [\"catalog.json\", sorted(catalog)],\n [\"placeholders.json\", sorted(placeholders)],\n ]\n if (generation.report)\n files.push([\n \"report.json\",\n {\n inspected: Object.keys(catalog).length,\n skipped,\n assets: Object.values(catalog).map((asset) => ({\n src: asset.src,\n result: iris.resolve({ asset }),\n })),\n },\n ])\n await mkdir(directory, { recursive: true })\n for (const [name, data] of files)\n await atomicWrite(\n path.join(directory, name),\n JSON.stringify(data, null, 2) + \"\\n\"\n )\n if (adapter) {\n let configImport = path\n .relative(directory, path.resolve(rootDir, configFile))\n .split(path.sep)\n .join(\"/\")\n .replace(/\\.[cm]?[jt]s$/, \"\")\n if (!configImport.startsWith(\".\")) configImport = `./${configImport}`\n await atomicWrite(\n path.join(directory, \"image.tsx\"),\n `\"use client\"\\n\\n// Generated by Iris. Do not edit.\\nimport { createIrisNextImage } from \"@joycostudio/iris/next\"\\nimport iris from ${JSON.stringify(configImport)}\\nimport catalog from \"./catalog.json\"\\n\\nexport const IrisImage = createIrisNextImage({ iris, catalog })\\n`\n )\n }\n return {\n stale: false,\n placeholders: Object.keys(placeholders).length,\n inspected: Object.keys(catalog).length,\n skipped,\n }\n } catch (error) {\n if (allowStale && (await usableOutput({ directory, adapter }))) {\n console.warn(\"Iris generation failed; keeping existing files:\", error)\n return { stale: true, placeholders: 0, inspected: 0, skipped: 0 }\n }\n throw error\n }\n}\n\nasync function atomicWrite(file: string, content: string) {\n await writeFile(`${file}.tmp`, content)\n await rename(`${file}.tmp`, file)\n}\nasync function usableOutput({\n directory,\n adapter,\n}: {\n directory: string\n adapter: boolean\n}) {\n try {\n const catalog: Record<string, IrisCatalogAsset> = JSON.parse(\n await readFile(path.join(directory, \"catalog.json\"), \"utf8\")\n )\n const placeholders = JSON.parse(\n await readFile(path.join(directory, \"placeholders.json\"), \"utf8\")\n )\n if (\n !catalog ||\n Array.isArray(catalog) ||\n !Object.keys(catalog).length ||\n !placeholders ||\n Array.isArray(placeholders)\n )\n return false\n if (\n adapter &&\n !(await readFile(path.join(directory, \"image.tsx\"), \"utf8\")).includes(\n \"createIrisNextImage\"\n )\n )\n return false\n return true\n } catch {\n return false\n }\n}\n","import { readFile } from \"node:fs/promises\"\nimport path from \"node:path\"\nimport { parse } from \"@babel/parser\"\nimport fg from \"fast-glob\"\nimport { minimatch } from \"minimatch\"\nimport { type IrisGenerateOptions, type IrisGenerateSource } from \"./types\"\n\nconst ignored = [\n \"**/node_modules/**\",\n \"**/.next/**\",\n \"**/.git/**\",\n \"**/dist/**\",\n \"**/coverage/**\",\n \"**/generated/**\",\n \"**/*.generated.*\",\n]\nconst codeFile = /\\.(?:[cm]?[jt]s|[jt]sx)$/i\nconst imageFile = /\\.(?:png|jpe?g|webp|avif|gif)$/i\n\n/** Resolve local globs and literal image strings without executing consumer code. */\nexport async function discoverIrisSources(\n options: IrisGenerateOptions,\n rootDir: string\n): Promise<IrisGenerateSource[]> {\n const publicDir = path.resolve(rootDir, options.publicDir ?? \"public\")\n const exclude = options.exclude ?? []\n const outputDir = path.resolve(rootDir, options.output)\n const explicit: IrisGenerateSource[] = []\n const patterns: string[] = []\n const found = new Set<string>()\n for (const source of options.sources ?? []) {\n if (\n typeof source === \"string\" &&\n !/^(?:https?:\\/\\/|\\/)/i.test(source) &&\n fg.isDynamicPattern(source)\n )\n patterns.push(source)\n else explicit.push(source)\n }\n const globOptions = {\n cwd: rootDir,\n onlyFiles: true,\n followSymbolicLinks: false,\n ignore: [...ignored, ...exclude],\n }\n for (const file of await fg(patterns, globOptions)) {\n if (!imageFile.test(file)) continue\n const relative = path.relative(publicDir, path.resolve(rootDir, file))\n if (\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n ) {\n throw new Error(\n `Iris source pattern matched ${file} outside publicDir. Image globs must stay inside ${publicDir}.`\n )\n }\n found.add(`/${relative.split(path.sep).map(encodeURIComponent).join(\"/\")}`)\n }\n for (const file of (await fg(options.scan ?? [], globOptions)).sort()) {\n if (\n !codeFile.test(file) ||\n /\\.d\\.[cm]?ts$/i.test(file) ||\n path.resolve(rootDir, file).startsWith(outputDir + path.sep)\n )\n continue\n const code = await readFile(path.resolve(rootDir, file), \"utf8\")\n try {\n for (const source of scanImageLiterals(code, file)) found.add(source)\n } catch (error) {\n throw new Error(\n `Iris could not scan ${file}: ${error instanceof Error ? error.message : String(error)}`\n )\n }\n }\n const explicitUrls = new Set(\n explicit.map((source) => (typeof source === \"string\" ? source : source.src))\n )\n const excluded = (src: string) =>\n exclude.some(\n (pattern) =>\n src === pattern ||\n minimatch(src, pattern, { dot: true, nonegate: true, nocomment: true })\n )\n return [\n ...[...found]\n .sort()\n .filter((src) => !explicitUrls.has(src) && !excluded(src)),\n ...explicit.filter(\n (source) => !excluded(typeof source === \"string\" ? source : source.src)\n ),\n ]\n}\n\n/** Read literals, not comments, JSX text, interpolated templates or concatenations. */\nexport function scanImageLiterals(code: string, filename: string): string[] {\n const ast = parse(code, {\n sourceType: \"unambiguous\",\n sourceFilename: filename,\n attachComment: false,\n plugins: [\n ...(/\\.[cm]?tsx?$/i.test(filename) ? [\"typescript\" as const] : []),\n ...(/\\.[jt]sx$|\\.[cm]?js$/i.test(filename) ? [\"jsx\" as const] : []),\n ],\n })\n const literals: string[] = []\n function walk(value: unknown) {\n if (!value || typeof value !== \"object\") return\n if (Array.isArray(value)) {\n value.forEach(walk)\n return\n }\n const node = value as Record<string, unknown>\n if (typeof node.type !== \"string\") return\n if (\n node.type.startsWith(\"Comment\") ||\n node.type === \"BinaryExpression\" ||\n node.type === \"TaggedTemplateExpression\" ||\n node.type === \"ImportDeclaration\" ||\n node.type === \"ExportAllDeclaration\" ||\n node.type === \"TSLiteralType\"\n )\n return\n if (node.type === \"StringLiteral\") {\n if (typeof node.value === \"string\") literals.push(node.value)\n return\n }\n if (node.type === \"TemplateLiteral\") {\n const template = node as unknown as {\n expressions: unknown[]\n quasis: { value: { cooked: string | null } }[]\n }\n if (template.expressions.length === 0 && template.quasis[0]?.value.cooked)\n literals.push(template.quasis[0].value.cooked)\n return\n }\n for (const [key, child] of Object.entries(node)) {\n if (\n ![\n \"comments\",\n \"leadingComments\",\n \"trailingComments\",\n \"innerComments\",\n \"loc\",\n \"extra\",\n ].includes(key)\n )\n walk(child)\n }\n }\n walk(ast.program)\n return [\n ...new Set(\n literals.filter((value) =>\n /^(?:https?:\\/\\/|\\/).+\\.(?:png|jpe?g|webp|avif|gif)(?:[?#].*)?$/i.test(\n value\n )\n )\n ),\n ].sort()\n}\n","import { readFile, realpath } from \"node:fs/promises\"\nimport path from \"node:path\"\nimport fg from \"fast-glob\"\nimport sharp from \"sharp\"\nimport type {\n IrisAssetInput,\n IrisCatalogAsset,\n IrisPolicy,\n IrisResult,\n IrisVariant,\n} from \"../core\"\nimport { irisFailure, validVariant } from \"../core/policy\"\n\n/** Discover and inspect only. This adapter does not encode or invent variants. */\nexport async function prepareIrisAssets<Custom>({\n iris,\n rootDir = process.cwd(),\n publicDir = \"public\",\n fetch: fetcher = fetch,\n}: {\n iris: Pick<IrisPolicy<Custom>, \"assets\">\n rootDir?: string\n publicDir?: string\n fetch?: typeof fetch\n}): Promise<IrisResult<IrisCatalogAsset[]>> {\n const publicRoot = path.resolve(rootDir, publicDir)\n try {\n const entries = new Map<string, IrisAssetInput | IrisCatalogAsset>()\n const explicit: (IrisAssetInput | IrisCatalogAsset)[] = []\n for (const input of iris.assets) {\n const src = typeof input === \"string\" ? input : input.src\n if (/^https?:\\/\\//i.test(src)) {\n if (fg.isDynamicPattern(new URL(src).pathname))\n return irisFailure(\n \"remote_pattern\",\n \"Remote URLs must be explicit; a glob cannot enumerate a bucket\"\n )\n explicit.push(input)\n } else if (\n typeof input === \"string\" &&\n fg.isDynamicPattern(src.startsWith(\"/\") ? src.split(/[?#]/, 1)[0] : src)\n ) {\n const files = await fg(\n src.startsWith(\"/\") ? src.split(/[?#]/, 1)[0].slice(1) : src,\n {\n cwd: src.startsWith(\"/\") ? publicRoot : rootDir,\n onlyFiles: true,\n followSymbolicLinks: false,\n ignore: [\"**/node_modules/**\", \"**/.git/**\", \"**/.next/**\"],\n }\n )\n for (const file of files.sort()) {\n const full = path.resolve(\n src.startsWith(\"/\") ? publicRoot : rootDir,\n file\n )\n const relative = within(publicRoot, full)\n const url = `/${relative.split(path.sep).map(encodeURIComponent).join(\"/\")}`\n entries.set(url, url)\n }\n } else explicit.push(input)\n }\n for (const input of explicit) {\n const src = typeof input === \"string\" ? input : input.src\n entries.set(src, input)\n }\n const inspected = new Map<string, Promise<IrisVariant>>()\n function inspect(src: string) {\n let pending = inspected.get(src)\n if (!pending) {\n pending = (async () => {\n let bytes: Buffer\n if (/^https?:\\/\\//i.test(src)) {\n const response = await fetcher(src, {\n signal: AbortSignal.timeout(30_000),\n })\n if (!response.ok)\n throw new Error(`Cannot inspect ${src}: HTTP ${response.status}`)\n bytes = Buffer.from(await response.arrayBuffer())\n } else {\n const pathname = decodeURIComponent(\n src.split(/[?#]/, 1)[0]\n ).replace(/^\\/+/, \"\")\n const file = path.resolve(publicRoot, pathname)\n within(publicRoot, file)\n within(await realpath(publicRoot), await realpath(file))\n bytes = await readFile(file)\n }\n const meta = await sharp(bytes, { animated: true }).metadata()\n const swapped = (meta.orientation ?? 1) >= 5\n const width = swapped ? meta.height : meta.width\n const height = swapped ? meta.width : (meta.pageHeight ?? meta.height)\n if (!width || !height)\n throw new Error(`Cannot inspect dimensions of ${src}`)\n return {\n url: src,\n width,\n height,\n bytes: bytes.length,\n format: meta.format,\n progressive: meta.isProgressive ?? false,\n alpha: Boolean(\n meta.hasAlpha &&\n ((meta.pages ?? 1) > 1 || !(await sharp(bytes).stats()).isOpaque)\n ),\n animated: (meta.pages ?? 1) > 1,\n }\n })()\n inspected.set(src, pending)\n }\n return pending\n }\n const catalog: IrisCatalogAsset[] = []\n const identities = new Set<string>()\n for (const input of entries.values()) {\n const entry = typeof input === \"string\" ? { src: input } : input\n const metadata =\n \"width\" in entry\n ? (entry as IrisCatalogAsset)\n : await inspect(entry.src)\n const { width, height, bytes, format, progressive, alpha, animated } =\n metadata\n const variants = await Promise.all(\n (entry.variants ?? []).map((variant) =>\n typeof variant === \"string\" ? inspect(variant) : variant\n )\n )\n if (\n !validVariant({ url: entry.src, width, height, bytes }) ||\n !variants.every(validVariant)\n )\n return irisFailure(\"invalid_asset\", `Invalid metadata for ${entry.src}`)\n for (const identity of new Set([entry.src, entry.id ?? entry.src])) {\n if (identities.has(identity))\n return irisFailure(\n \"duplicate_asset\",\n `Ambiguous asset identity: ${identity}`\n )\n identities.add(identity)\n }\n catalog.push({\n src: entry.src,\n id: entry.id,\n width,\n height,\n bytes,\n format,\n progressive,\n alpha,\n animated,\n variants,\n placeholder: entry.placeholder,\n placeholders: entry.placeholders,\n })\n }\n return { ok: true, data: catalog }\n } catch (error) {\n return irisFailure(\n \"prepare_failed\",\n error instanceof Error ? error.message : String(error)\n )\n }\n}\n\nfunction within(root: string, file: string) {\n const relative = path.relative(root, file)\n if (\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n ) {\n throw new Error(`Image source escapes publicDir: ${file}`)\n }\n return relative\n}\n","import { minimatch } from \"minimatch\"\nimport { placeholderSettings, resolvePlaceholder } from \"./placeholder\"\nimport type {\n IrisCatalogAsset,\n IrisConditions,\n IrisMatcher,\n IrisPolicy,\n IrisPolicyContext,\n IrisPolicyOptions,\n IrisPolicyDiagnostic,\n IrisRange,\n IrisRecipe,\n IrisRecipeSelection,\n IrisResult,\n IrisVariant,\n} from \"./policy-types\"\n\nexport function irisFailure(code: string, message: string): IrisResult<never> {\n return { ok: false, error: { code, message } }\n}\n\n/** First matching rule wins. Construction is synchronous and performs no I/O. */\nexport function createIris<Custom = Record<string, unknown>>(\n options: IrisPolicyOptions<Custom>\n): IrisPolicy<Custom> {\n const recipes = { ...options.recipes }\n const rules = [...(options.rules ?? [])]\n const assets = [...(options.assets ?? [])]\n for (const name of [options.fallback, ...rules.map((rule) => rule.recipe)]) {\n if (!Object.hasOwn(recipes, name))\n throw new Error(`Unknown Iris recipe: ${name}`)\n }\n for (const recipe of Object.values(recipes)) {\n if (typeof recipe !== \"function\") validateRecipe(recipe)\n }\n for (const rule of rules) {\n if (rule.when && typeof rule.when !== \"function\")\n validateConditions(rule.when)\n }\n function selectRecipe(\n context: IrisPolicyContext<Custom>,\n override?: string\n ): IrisResult<IrisRecipeSelection> {\n let ruleIndex: number | null = null\n let name = override ?? options.fallback\n try {\n if (override === undefined) {\n const index = rules.findIndex(\n (rule) =>\n (rule.include === undefined || matches(rule.include, context)) &&\n (rule.exclude === undefined || !matches(rule.exclude, context)) &&\n (rule.when === undefined ||\n (typeof rule.when === \"function\"\n ? predicate(rule.when(context))\n : conditionsMatch(rule.when, context)))\n )\n if (index !== -1) {\n ruleIndex = index\n name = rules[index].recipe\n }\n }\n if (!Object.hasOwn(recipes, name))\n return irisFailure(\"unknown_recipe\", `Unknown Iris recipe: ${name}`)\n const registered = recipes[name]\n const recipe =\n typeof registered === \"function\" ? registered(context) : registered\n validateRecipe(recipe)\n return { ok: true, data: { recipe, name, ruleIndex } }\n } catch (error) {\n return irisFailure(\n \"invalid_policy\",\n error instanceof Error ? error.message : String(error)\n )\n }\n }\n return {\n assets,\n placeholderRequests: [\n ...new Map(\n [\n placeholderSettings(\"blur\")!,\n ...Object.values(recipes).flatMap((recipe) => {\n const settings =\n typeof recipe === \"function\"\n ? null\n : placeholderSettings(recipe.placeholder)\n return settings ? [settings] : []\n }),\n ].map(({ width, quality }) => [\n `${width}:${quality}`,\n { width, quality },\n ])\n ).values(),\n ],\n select({ asset, usage = {}, recipe }) {\n if (!validVariant({ ...asset, url: asset.src }))\n return irisFailure(\"invalid_asset\", \"Invalid asset metadata\")\n if (\n (usage.width !== undefined && !positive(usage.width)) ||\n (usage.dpr !== undefined && !positive(usage.dpr))\n )\n return irisFailure(\n \"invalid_usage\",\n \"Usage width and DPR must be positive finite numbers\"\n )\n return selectRecipe(\n {\n src: asset.src,\n asset,\n variants: [...(asset.variants ?? []), { ...asset, url: asset.src }],\n usage,\n },\n recipe\n )\n },\n resolve({ asset: input, catalog, usage = {}, recipe: override }) {\n const asset =\n typeof input === \"string\"\n ? ([...(catalog ?? []), ...assets].find(\n (item) =>\n typeof item !== \"string\" &&\n (item.src === input || item.id === input) &&\n \"width\" in item\n ) as IrisCatalogAsset | undefined)\n : input\n if (!asset)\n return irisFailure(\n \"asset_unprepared\",\n `Prepare or supply metadata for ${String(input)} before resolving`\n )\n if (!validVariant({ ...asset, url: asset.src }))\n return irisFailure(\n \"invalid_asset\",\n \"Asset metadata must contain a URL, positive dimensions and non-negative bytes\"\n )\n if (\n (usage.width !== undefined && !positive(usage.width)) ||\n (usage.dpr !== undefined && !positive(usage.dpr))\n ) {\n return irisFailure(\n \"invalid_usage\",\n \"Usage width and DPR must be positive finite numbers\"\n )\n }\n const original: IrisVariant = {\n url: asset.src,\n width: asset.width,\n height: asset.height,\n bytes: asset.bytes,\n format: asset.format,\n progressive: asset.progressive,\n alpha: asset.alpha,\n animated: asset.animated,\n }\n const variants = [...(asset.variants ?? []), original]\n if (!variants.every(validVariant))\n return irisFailure(\n \"invalid_variant\",\n \"Prepare variant metadata before resolving\"\n )\n // Preserve original metadata for its URL and avoid duplicate downloads.\n const unique = [\n ...new Map(\n variants.map((variant) => [variant.url, { ...variant }])\n ).values(),\n ]\n const context: IrisPolicyContext<Custom> = {\n src: asset.src,\n asset,\n variants: unique,\n usage,\n }\n try {\n const selection = selectRecipe(context, override)\n if (!selection.ok) return selection\n const { recipe, name, ruleIndex } = selection.data\n const target =\n usage.width === undefined\n ? null\n : Math.ceil(usage.width * (usage.dpr ?? 1))\n if (target !== null && !positive(target))\n return irisFailure(\"invalid_usage\", \"Target width overflow\")\n const diagnostics: IrisPolicyDiagnostic[] = []\n const note = (code: IrisPolicyDiagnostic[\"code\"], message: string) =>\n diagnostics.push({ code, message })\n // Unknown layout preserves source resolution rather than guessing a thumbnail.\n const width = target ?? asset.width\n if (target === null)\n note(\n \"unknown_target\",\n \"Layout width is unknown; selecting for original width\"\n )\n const compatible = unique.filter(\n (item) =>\n (asset.alpha !== true || item.alpha === true) &&\n (asset.animated !== true || item.animated === true)\n )\n const final = choose(compatible, width)\n if (final.width < width)\n note(\n \"undersized_final\",\n \"The selected final is smaller than the requested resolution\"\n )\n let preview: IrisVariant | null = null\n if (recipe.preview && recipe.preview !== \"none\") {\n const selection = recipe.preview\n const previewWidth =\n selection.ratio === undefined\n ? (selection.maxWidth ?? (selection.url ? Infinity : 640))\n : Math.min(\n Math.floor(width * selection.ratio),\n selection.maxWidth ?? Infinity\n )\n const candidates = compatible.filter(\n (item) =>\n item.url !== final.url &&\n item.width <= previewWidth &&\n item.bytes < final.bytes\n )\n preview = recipe.preview.url\n ? (candidates.find(\n (item) => item.url === (recipe.preview as { url?: string }).url\n ) ?? null)\n : (candidates.sort(\n (a, b) =>\n b.width - a.width ||\n a.bytes - b.bytes ||\n a.url.localeCompare(b.url)\n )[0] ?? null)\n if (!preview)\n note(\n \"missing_preview\",\n \"No distinct smaller preview exists; delivering final directly\"\n )\n }\n const placeholder = resolvePlaceholder({\n asset,\n placeholder: recipe.placeholder,\n })\n if (recipe.placeholder && recipe.placeholder !== \"none\" && !placeholder)\n note(\n \"missing_placeholder\",\n \"No placeholder supplied; continuing without blur\"\n )\n return {\n ok: true,\n data: {\n src: asset.src,\n recipe: name,\n ruleIndex,\n targetWidth: target,\n placeholder: final.progressive ? null : placeholder,\n preview: final.progressive ? null : preview,\n final,\n diagnostics,\n },\n }\n } catch (error) {\n return irisFailure(\n \"invalid_policy\",\n error instanceof Error ? error.message : String(error)\n )\n }\n },\n }\n}\n\nfunction positive(value: number) {\n return Number.isFinite(value) && value > 0\n}\nexport function validVariant(value: IrisVariant) {\n return (\n value &&\n typeof value.url === \"string\" &&\n !!value.url &&\n positive(value.width) &&\n positive(value.height) &&\n Number.isFinite(value.bytes) &&\n value.bytes >= 0\n )\n}\nfunction choose(variants: IrisVariant[], target: number) {\n const adequate = variants.filter((item) => item.width >= target)\n if (adequate.length)\n return adequate.sort(\n (a, b) =>\n a.bytes - b.bytes || a.width - b.width || a.url.localeCompare(b.url)\n )[0]\n return [...variants].sort(\n (a, b) =>\n b.width - a.width || a.bytes - b.bytes || a.url.localeCompare(b.url)\n )[0]\n}\nfunction predicate(value: unknown): boolean {\n if (typeof value !== \"boolean\")\n throw new Error(\"Iris predicates must return a synchronous boolean\")\n return value\n}\nfunction matches<T>(\n input: IrisMatcher<T> | readonly IrisMatcher<T>[],\n context: IrisPolicyContext<T>\n): boolean {\n const matchers = Array.isArray(input) ? input : [input as IrisMatcher<T>]\n return matchers.some((matcher) => {\n if (typeof matcher === \"function\") return predicate(matcher(context))\n if (matcher instanceof RegExp)\n return new RegExp(matcher.source, matcher.flags).test(context.src)\n if (context.src === matcher) return true\n // Globs ignore query/hash; regexes and callbacks receive the original URL.\n return minimatch(context.src.split(/[?#]/, 1)[0], matcher, {\n dot: true,\n nonegate: true,\n nocomment: true,\n })\n })\n}\nfunction conditionsMatch<T>(\n when: IrisConditions,\n context: IrisPolicyContext<T>\n) {\n const { asset, usage } = context\n const values = {\n sourceBytes: asset.bytes,\n sourceWidth: asset.width,\n renderedWidth: usage.width,\n targetWidth:\n usage.width === undefined ? undefined : usage.width * (usage.dpr ?? 1),\n }\n for (const key of Object.keys(values) as (keyof typeof values)[]) {\n const range = when[key]\n const value = values[key]\n if (\n range &&\n (value === undefined ||\n (range.min !== undefined && value < range.min) ||\n (range.max !== undefined && value > range.max))\n )\n return false\n }\n return (\n (when.alpha === undefined || when.alpha === asset.alpha) &&\n (when.priority === undefined ||\n when.priority === (usage.priority ?? false)) &&\n (when.format === undefined || when.format === asset.format)\n )\n}\nfunction validateConditions(when: IrisConditions) {\n const supported = [\n \"sourceBytes\",\n \"sourceWidth\",\n \"renderedWidth\",\n \"targetWidth\",\n \"alpha\",\n \"priority\",\n \"format\",\n ]\n for (const [key, value] of Object.entries(when)) {\n if (!supported.includes(key))\n throw new Error(`Unknown Iris condition: ${key}`)\n if (key === \"alpha\" || key === \"priority\") {\n if (typeof value !== \"boolean\") throw new Error(`${key} must be boolean`)\n continue\n }\n if (key === \"format\") {\n if (typeof value !== \"string\") throw new Error(\"format must be a string\")\n continue\n }\n const range = value as IrisRange\n if (\n !range ||\n typeof range !== \"object\" ||\n Object.keys(range).some((key) => ![\"min\", \"max\"].includes(key)) ||\n Object.values(range).some(\n (value) => !Number.isFinite(value) || value < 0\n ) ||\n (range.min !== undefined &&\n range.max !== undefined &&\n range.min > range.max)\n )\n throw new Error(`Invalid Iris range: ${key}`)\n }\n}\nfunction validateRecipe(recipe: IrisRecipe) {\n if (!recipe || typeof recipe !== \"object\" || \"then\" in recipe)\n throw new Error(\"Recipes must return synchronous objects\")\n if (\n Object.keys(recipe).some((key) => ![\"placeholder\", \"preview\"].includes(key))\n )\n throw new Error(\"Unknown recipe field\")\n const placeholder = recipe.placeholder\n if (\n placeholder !== undefined &&\n placeholder !== \"none\" &&\n placeholder !== \"blur\"\n ) {\n if (\n !placeholder ||\n typeof placeholder !== \"object\" ||\n Object.keys(placeholder).some(\n (key) => ![\"blur\", \"width\", \"quality\"].includes(key)\n ) ||\n (placeholder.blur !== undefined &&\n (!Number.isFinite(placeholder.blur) || placeholder.blur < 0)) ||\n (placeholder.width !== undefined &&\n (!Number.isSafeInteger(placeholder.width) || placeholder.width < 1)) ||\n (placeholder.quality !== undefined &&\n (!Number.isInteger(placeholder.quality) ||\n placeholder.quality < 1 ||\n placeholder.quality > 100))\n )\n throw new Error(\"Invalid placeholder settings\")\n }\n const preview = recipe.preview\n if (\n preview !== undefined &&\n preview !== \"none\" &&\n (!preview ||\n typeof preview !== \"object\" ||\n Object.keys(preview).some(\n (key) => ![\"url\", \"maxWidth\", \"ratio\", \"quality\", \"loadFirst\", \"minDisplayMs\"].includes(key)\n ) ||\n (preview.maxWidth !== undefined && !positive(preview.maxWidth)) ||\n (preview.quality !== undefined &&\n (!Number.isInteger(preview.quality) || preview.quality < 1 || preview.quality > 100)) ||\n (preview.ratio !== undefined &&\n (!positive(preview.ratio) || preview.ratio >= 1)) ||\n (preview.url !== undefined && typeof preview.url !== \"string\") ||\n (preview.loadFirst !== undefined && typeof preview.loadFirst !== \"boolean\") ||\n (preview.minDisplayMs !== undefined &&\n (!Number.isFinite(preview.minDisplayMs) || preview.minDisplayMs < 0)))\n )\n throw new Error(\"Invalid preview\")\n}\n"],"mappings":";;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AAA;AAAA;AAAA;AAAA,mBAAsI,KAAK,UAAU,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,MACpK;AAAA,IACF;AACA,WAAO;AAAA,MACL,OAAO;AAAA,MACP,cAAc,OAAO,KAAK,YAAY,EAAE;AAAA,MACxC,WAAW,OAAO,KAAK,OAAO,EAAE;AAAA,MAChC;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,QAAI,cAAe,MAAM,aAAa,EAAE,WAAW,QAAQ,CAAC,GAAI;AAC9D,cAAQ,KAAK,mDAAmD,KAAK;AACrE,aAAO,EAAE,OAAO,MAAM,cAAc,GAAG,WAAW,GAAG,SAAS,EAAE;AAAA,IAClE;AACA,UAAM;AAAA,EACR;AACF;AAEA,eAAe,YAAY,MAAc,SAAiB;AACxD,YAAM,4BAAU,GAAG,IAAI,QAAQ,OAAO;AACtC,YAAM,yBAAO,GAAG,IAAI,QAAQ,IAAI;AAClC;AACA,eAAe,aAAa;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,MAAI;AACF,UAAM,UAA4C,KAAK;AAAA,MACrD,UAAM,2BAAS,kBAAAA,QAAK,KAAK,WAAW,cAAc,GAAG,MAAM;AAAA,IAC7D;AACA,UAAM,eAAe,KAAK;AAAA,MACxB,UAAM,2BAAS,kBAAAA,QAAK,KAAK,WAAW,mBAAmB,GAAG,MAAM;AAAA,IAClE;AACA,QACE,CAAC,WACD,MAAM,QAAQ,OAAO,KACrB,CAAC,OAAO,KAAK,OAAO,EAAE,UACtB,CAAC,gBACD,MAAM,QAAQ,YAAY;AAE1B,aAAO;AACT,QACE,WACA,EAAE,UAAM,2BAAS,kBAAAA,QAAK,KAAK,WAAW,WAAW,GAAG,MAAM,GAAG;AAAA,MAC3D;AAAA,IACF;AAEA,aAAO;AACT,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":["import_promises","import_node_path","import_sharp","path","fg","import_promises","import_node_path","import_fast_glob","import_minimatch","path","inspect","sharp","fg","path","sharp","width","quality"]}
|
package/dist/node.d.cts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { b as IrisAssetInput, c as IrisCatalogAsset, a as IrisPolicy, q as IrisResult } from './policy-types-LoD2Ldcl.cjs';
|
|
2
|
+
|
|
3
|
+
type IrisGenerateSource = string | (Exclude<IrisAssetInput, string> & {
|
|
4
|
+
optional?: boolean;
|
|
5
|
+
placeholderOnly?: boolean;
|
|
6
|
+
placeholderOptions?: {
|
|
7
|
+
width?: number;
|
|
8
|
+
quality?: number;
|
|
9
|
+
format?: "webp" | "avif" | "jpeg" | "png";
|
|
10
|
+
};
|
|
11
|
+
}) | IrisCatalogAsset;
|
|
12
|
+
/** Preparation only: loading behavior always comes from createIris recipes. */
|
|
13
|
+
type IrisGenerateOptions = {
|
|
14
|
+
sources?: IrisGenerateSource[];
|
|
15
|
+
scan?: string[];
|
|
16
|
+
exclude?: string[];
|
|
17
|
+
publicDir?: string;
|
|
18
|
+
concurrency?: number;
|
|
19
|
+
output: string;
|
|
20
|
+
report?: boolean;
|
|
21
|
+
adapter?: "next" | false;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type IrisGenerateResult = {
|
|
25
|
+
stale: boolean;
|
|
26
|
+
placeholders: number;
|
|
27
|
+
inspected: number;
|
|
28
|
+
skipped: number;
|
|
29
|
+
};
|
|
30
|
+
declare function generateIris<Custom>({ iris, generation, rootDir, configFile, allowStale, fetch: fetcher, }: {
|
|
31
|
+
iris: IrisPolicy<Custom>;
|
|
32
|
+
generation: IrisGenerateOptions;
|
|
33
|
+
rootDir?: string;
|
|
34
|
+
configFile?: string;
|
|
35
|
+
allowStale?: boolean;
|
|
36
|
+
fetch?: typeof fetch;
|
|
37
|
+
}): Promise<IrisGenerateResult>;
|
|
38
|
+
|
|
39
|
+
/** Discover and inspect only. This adapter does not encode or invent variants. */
|
|
40
|
+
declare function prepareIrisAssets<Custom>({ iris, rootDir, publicDir, fetch: fetcher, }: {
|
|
41
|
+
iris: Pick<IrisPolicy<Custom>, "assets">;
|
|
42
|
+
rootDir?: string;
|
|
43
|
+
publicDir?: string;
|
|
44
|
+
fetch?: typeof fetch;
|
|
45
|
+
}): Promise<IrisResult<IrisCatalogAsset[]>>;
|
|
46
|
+
|
|
47
|
+
export { type IrisGenerateOptions, type IrisGenerateResult, type IrisGenerateSource, generateIris, prepareIrisAssets };
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { b as IrisAssetInput, c as IrisCatalogAsset, a as IrisPolicy, q as IrisResult } from './policy-types-LoD2Ldcl.js';
|
|
2
|
+
|
|
3
|
+
type IrisGenerateSource = string | (Exclude<IrisAssetInput, string> & {
|
|
4
|
+
optional?: boolean;
|
|
5
|
+
placeholderOnly?: boolean;
|
|
6
|
+
placeholderOptions?: {
|
|
7
|
+
width?: number;
|
|
8
|
+
quality?: number;
|
|
9
|
+
format?: "webp" | "avif" | "jpeg" | "png";
|
|
10
|
+
};
|
|
11
|
+
}) | IrisCatalogAsset;
|
|
12
|
+
/** Preparation only: loading behavior always comes from createIris recipes. */
|
|
13
|
+
type IrisGenerateOptions = {
|
|
14
|
+
sources?: IrisGenerateSource[];
|
|
15
|
+
scan?: string[];
|
|
16
|
+
exclude?: string[];
|
|
17
|
+
publicDir?: string;
|
|
18
|
+
concurrency?: number;
|
|
19
|
+
output: string;
|
|
20
|
+
report?: boolean;
|
|
21
|
+
adapter?: "next" | false;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type IrisGenerateResult = {
|
|
25
|
+
stale: boolean;
|
|
26
|
+
placeholders: number;
|
|
27
|
+
inspected: number;
|
|
28
|
+
skipped: number;
|
|
29
|
+
};
|
|
30
|
+
declare function generateIris<Custom>({ iris, generation, rootDir, configFile, allowStale, fetch: fetcher, }: {
|
|
31
|
+
iris: IrisPolicy<Custom>;
|
|
32
|
+
generation: IrisGenerateOptions;
|
|
33
|
+
rootDir?: string;
|
|
34
|
+
configFile?: string;
|
|
35
|
+
allowStale?: boolean;
|
|
36
|
+
fetch?: typeof fetch;
|
|
37
|
+
}): Promise<IrisGenerateResult>;
|
|
38
|
+
|
|
39
|
+
/** Discover and inspect only. This adapter does not encode or invent variants. */
|
|
40
|
+
declare function prepareIrisAssets<Custom>({ iris, rootDir, publicDir, fetch: fetcher, }: {
|
|
41
|
+
iris: Pick<IrisPolicy<Custom>, "assets">;
|
|
42
|
+
rootDir?: string;
|
|
43
|
+
publicDir?: string;
|
|
44
|
+
fetch?: typeof fetch;
|
|
45
|
+
}): Promise<IrisResult<IrisCatalogAsset[]>>;
|
|
46
|
+
|
|
47
|
+
export { type IrisGenerateOptions, type IrisGenerateResult, type IrisGenerateSource, generateIris, prepareIrisAssets };
|