mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* refactor(tooling): organize test runtime and maintenance owners * test(tooling): preserve relocated runtime fixture dependency edges * refactor(tooling): preserve xterm routing owner checks * ci(tooling): include routing owner in sparse checkout * test(tooling): preserve copied workflow dependency closures * fix(tooling): normalize hashed JSON assets in release parity * fix(tooling): distinguish asset aliases from literal references * fix(tooling): frame normalized asset reference payloads * fix(tooling): normalize decoded JSON asset references * refactor(tooling): organize build, CI and release owners * fix(tooling): align moved generator and workflow path contracts * fix(tooling): update generated plugin bundle owner banners * test(tooling): create relocated mobile verifier fixture directories * test(tooling): copy headless detector dependency closure * test(tooling): align native batch policy fixtures with owner path * fix(tooling): link moved reliability command to historical evidence * fix(tooling): preserve nested sandbox owners and canonical guide source * fix(tooling): target release version owners in checkout fixture
55 lines
1.8 KiB
JavaScript
55 lines
1.8 KiB
JavaScript
import {
|
|
MOBILE_WEB_BUNDLE_ENTRYPOINT,
|
|
contentTypeForExtension,
|
|
hashedAsset,
|
|
readDesktopVersion,
|
|
readProtocolWindow,
|
|
sha256Hex,
|
|
writeMobileWebBundleTree
|
|
} from './mobile-web-bundle-manifest.mjs'
|
|
|
|
// Use real manifest writer with tiny assets: packaging guard judges manifest/bytes, so full mobile build adds unrelated dependency failures and cost.
|
|
/** A 1x1 transparent PNG, the smallest real image the content-type rule accepts. */
|
|
const PIXEL_PNG = Buffer.from(
|
|
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==',
|
|
'base64'
|
|
)
|
|
|
|
export async function writeMobileWebBundleFixtureTree({ outDir, body = 'fixture' }) {
|
|
const [desktopVersion, protocolWindow] = await Promise.all([
|
|
readDesktopVersion(),
|
|
readProtocolWindow()
|
|
])
|
|
// Provide script/style/image assets used by guard cases; missing type would throw undefined.path instead of testing rule.
|
|
const script = hashedAsset(
|
|
Buffer.from(`globalThis.orca = ${JSON.stringify(body)}\n`, 'utf8'),
|
|
'js'
|
|
)
|
|
const stylesheet = hashedAsset(Buffer.from(`:root{--orca:${body}}\n`, 'utf8'), 'css')
|
|
const image = hashedAsset(PIXEL_PNG, 'png')
|
|
const indexBytes = Buffer.from(
|
|
`<!doctype html><meta charset="utf-8">` +
|
|
`<link rel="stylesheet" href="/${stylesheet.path}">` +
|
|
`<img src="/${image.path}" alt="">` +
|
|
`<script src="/${script.path}"></script>\n`,
|
|
'utf8'
|
|
)
|
|
return writeMobileWebBundleTree({
|
|
outDir,
|
|
written: [
|
|
{
|
|
bytes: indexBytes,
|
|
path: MOBILE_WEB_BUNDLE_ENTRYPOINT,
|
|
sha256: sha256Hex(indexBytes),
|
|
byteLength: indexBytes.byteLength,
|
|
contentType: contentTypeForExtension('html')
|
|
},
|
|
script,
|
|
stylesheet,
|
|
image
|
|
],
|
|
desktopVersion,
|
|
protocolWindow
|
|
})
|
|
}
|