@webority/canvas-kit 0.149.0 → 0.150.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 CHANGED
@@ -70,7 +70,7 @@ A meta module imports only `defineMeta` from `@webority/canvas-kit/meta` and exp
70
70
  | `marker` | The `data-wui` value the component renders, or `null`. |
71
71
  | `platforms` | `web`, `phone` or both. |
72
72
  | `acceptsChildren` | `true` or `false`. |
73
- | `props` | Each prop has a `type`, one of `string`, `number`, `stringOrNumber`, `boolean`, `enum`, `enumOrNumber`, `url`, `icon`, `node`, `array`, `object` or `any`, and a `description`. An enum or enumOrNumber lists its `values`; numbers are allowed in an enum, and an enumOrNumber lists its named values only and also takes any number. Optional `default` (never on a required prop), `required`, `fields` on an object and `itemFields` on an array of objects. |
73
+ | `props` | Each prop has a `type`, one of `string`, `number`, `stringOrNumber`, `boolean`, `enum`, `enumOrNumber`, `url`, `icon`, `node`, `array`, `object` or `any`, and a `description`. An enum or enumOrNumber lists its `values`; numbers are allowed in an enum, and an enumOrNumber lists its named values only and also takes any number, or a number written as text ("24"). Optional `default` (never on a required prop), `required`, `fields` on an object and `itemFields` on an array of objects. |
74
74
  | `omit` | Optional. Design props deliberately not described. |
75
75
  | `actions` | Optional, web only. Handler name to action stand-in prop name, such as `{ onConfirm: "confirmAction" }`. The manifest lists each stand-in as an object prop with no fields and names it in `takesAction`. |
76
76
  | `role` | Optional. `title` or `navigation`: the part's role in the manifest. |
@@ -158,9 +158,9 @@ Production). It returns the stamp plugin in every environment except Production,
158
158
  other value, or none, throws. Never pass `NODE_ENV`.
159
159
 
160
160
  Web portal (Vite 8 with `@vitejs/plugin-react` 6, which has no Babel option): add `@rolldown/plugin-babel` 0.2.4 and
161
- `@babel/core` 7.29.7 as exact dev dependencies, then in `vite.config.js`:
161
+ `@babel/core` 7.29.7 as exact dev dependencies, then in `vite.config.ts`:
162
162
 
163
- ```js
163
+ ```ts
164
164
  import { readFileSync } from "node:fs";
165
165
  import babel from "@rolldown/plugin-babel";
166
166
  import react from "@vitejs/plugin-react";
@@ -0,0 +1,26 @@
1
+ type FetchLike = (url: string) => Promise<Response>;
2
+ interface KitExport {
3
+ components: Readonly<Record<string, unknown>>;
4
+ markers: Readonly<Record<string, unknown>>;
5
+ tokenValues: unknown;
6
+ manifest: unknown;
7
+ }
8
+ export interface KitModule {
9
+ default?: KitExport | undefined;
10
+ }
11
+ export interface LoadedKit {
12
+ components: Readonly<Record<string, unknown>>;
13
+ markers: Readonly<Record<string, unknown>>;
14
+ tokenValues: unknown;
15
+ manifest: unknown;
16
+ kitStyles: string;
17
+ }
18
+ export interface LoadKitOptions {
19
+ kitKey: string;
20
+ version: string;
21
+ baseUrl: string;
22
+ fetch?: FetchLike | undefined;
23
+ importScript?: ((text: string) => Promise<KitModule>) | undefined;
24
+ }
25
+ export declare function loadKit({ kitKey, version, baseUrl, fetch, importScript, }: LoadKitOptions): Promise<LoadedKit>;
26
+ export {};
package/dist/browser.js CHANGED
@@ -1 +1 @@
1
- import"./kitModule.js";import{RELEASE_CONTENT as e,RELEASE_FILE as t,changedMessage as n,checkStampFiles as r}from"./releaseStamp.js";var i=e=>new TextDecoder().decode(e);async function a(e){let t=await globalThis.crypto.subtle.digest(`SHA-256`,e);return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}async function o(e,t){let n=await t(e);if(!n.ok)throw Error(`${e} could not be loaded (HTTP ${n.status}).`);return new Uint8Array(await n.arrayBuffer())}async function s(e){let t=URL.createObjectURL(new Blob([e],{type:`text/javascript`}));try{return await import(t)}finally{URL.revokeObjectURL(t)}}async function c({kitKey:c,version:l,baseUrl:u,fetch:d=globalThis.fetch,importScript:f=s}){if([c,l,u].some(e=>typeof e!=`string`||e===``))throw Error(`loadKit needs the kit key, the version and the base URL, each a non-empty string.`);let p=`${u.replace(/\/+$/,``)}/${encodeURIComponent(c)}/${encodeURIComponent(l)}`,m=`the release ${c} ${l}`,h=JSON.parse(i(await o(`${p}/${t}`,d)));if(h?.kitModuleVersion!==2)throw Error(`Release ${c} ${l} was built for kit module version ${h?.kitModuleVersion}; this renderer reads version 2. Rebuild the release with the @webority/canvas-kit that reads version 2.`);if(r(h,m),h.name!==c||h.version!==l)throw Error(`${t} in ${p} names ${h.name} ${h.version}, not ${c} ${l}.`);let g=Object.fromEntries(await Promise.all(e.map(async e=>{let t=await o(`${p}/${e}`,d),r=h.files[e];if(await a(t)!==r.sha256||t.byteLength!==r.bytes)throw Error(n(e,m));return[e,t]}))),_=JSON.parse(i(g[`manifest.json`])),v=(await f(i(g[`kit.js`])))?.default;if(typeof v!=`object`||!v)throw Error(`The kit bundle of ${m} has no default export; rebuild the release.`);if(JSON.stringify(v.manifest)!==JSON.stringify(_))throw Error(`The kit bundle of ${m} does not carry its manifest.json; rebuild the release.`);return{components:v.components,markers:v.markers,tokenValues:v.tokenValues,manifest:_,kitStyles:i(g[`kit.css`])}}export{c as loadKit};
1
+ import"./kitModule.js";import{RELEASE_CONTENT as e,RELEASE_FILE as t,changedMessage as n,checkStampFiles as r}from"./releaseStamp.js";var i=e=>new TextDecoder().decode(e);async function a(e){let t=await globalThis.crypto.subtle.digest(`SHA-256`,e);return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}async function o(e,t){let n=await t(e);if(!n.ok)throw Error(`${e} could not be loaded (HTTP ${n.status}).`);return new Uint8Array(await n.arrayBuffer())}async function s(e){let t=URL.createObjectURL(new Blob([e],{type:`text/javascript`}));try{return await import(t)}finally{URL.revokeObjectURL(t)}}async function c({kitKey:c,version:l,baseUrl:u,fetch:d=globalThis.fetch,importScript:f=s}){if([c,l,u].some(e=>typeof e!=`string`||e===``))throw Error(`loadKit needs the kit key, the version and the base URL, each a non-empty string.`);let p=`${u.replace(/\/+$/,``)}/${encodeURIComponent(c)}/${encodeURIComponent(l)}`,m=`the release ${c} ${l}`,h=JSON.parse(i(await o(`${p}/${t}`,d)));if(h?.kitModuleVersion!==2)throw Error(`Release ${c} ${l} was built for kit module version ${h?.kitModuleVersion}; this renderer reads version 2. Rebuild the release with the @webority/canvas-kit that reads version 2.`);if(r(h,m),h.name!==c||h.version!==l)throw Error(`${t} in ${p} names ${h.name} ${h.version}, not ${c} ${l}.`);let g=Object.fromEntries(await Promise.all(e.map(async e=>{let r=await o(`${p}/${e}`,d),i=h.files[e];if(i===void 0)throw Error(`canvas-kit: the stamp of ${e} is missing from ${t}.`);if(await a(r)!==i.sha256||r.byteLength!==i.bytes)throw Error(n(e,m));return[e,r]}))),_=g[`manifest.json`];if(_===void 0)throw Error(`canvas-kit: manifest.json is missing from the release.`);let v=g[`kit.js`];if(v===void 0)throw Error(`canvas-kit: kit.js is missing from the release.`);let y=g[`kit.css`];if(y===void 0)throw Error(`canvas-kit: kit.css is missing from the release.`);let b=JSON.parse(i(_)),x=(await f(i(v)))?.default;if(typeof x!=`object`||!x)throw Error(`The kit bundle of ${m} has no default export; rebuild the release.`);if(JSON.stringify(x.manifest)!==JSON.stringify(b))throw Error(`The kit bundle of ${m} does not carry its manifest.json; rebuild the release.`);return{components:x.components,markers:x.markers,tokenValues:x.tokenValues,manifest:b,kitStyles:i(y)}}export{c as loadKit};
@@ -0,0 +1,42 @@
1
+ import { readManifest } from "./manifest.ts";
2
+ import { digest } from "./release.ts";
3
+ type ManifestResult = Awaited<ReturnType<typeof readManifest>>;
4
+ type KitManifest = ManifestResult["manifest"];
5
+ type KitConfig = {
6
+ kit: string;
7
+ platform: "Web" | "Phone";
8
+ libraryPackage: string;
9
+ components: string;
10
+ tokens: string;
11
+ rolesFile?: string | undefined;
12
+ styles?: string[] | undefined;
13
+ rendererProtocolVersion: number;
14
+ renames?: string | undefined;
15
+ };
16
+ export interface BuildKitReleaseOptions {
17
+ configFile: string;
18
+ outDir: string;
19
+ styleKeysFile?: string | undefined;
20
+ phoneRendererSupportFile?: string | undefined;
21
+ }
22
+ export interface BuildKitReleaseResult {
23
+ outDir: string;
24
+ release: {
25
+ name: string;
26
+ version: string;
27
+ platform: "Web" | "Phone";
28
+ kitModuleVersion: number;
29
+ rendererProtocolVersion: number;
30
+ library: KitManifest["library"];
31
+ files: {
32
+ "manifest.json": ReturnType<typeof digest>;
33
+ "kit.js": ReturnType<typeof digest>;
34
+ "kit.css": ReturnType<typeof digest>;
35
+ };
36
+ };
37
+ manifest: KitManifest;
38
+ warnings: ManifestResult["warnings"];
39
+ }
40
+ export declare function readConfig(configFile: string): KitConfig;
41
+ export declare function buildKitRelease({ configFile, outDir, styleKeysFile, phoneRendererSupportFile, }: BuildKitReleaseOptions): Promise<BuildKitReleaseResult>;
42
+ export {};
package/dist/build.js CHANGED
@@ -1,3 +1,3 @@
1
- import{findPackageDir as e,readJson as t,toPosix as n}from"./files.js";import{KIT_MODULE_EXTERNALS as r}from"./kitModule.js";import{libraryFiles as i,readManifest as a}from"./manifest.js";import{digest as o,writeReleaseFolder as s}from"./release.js";import{existsSync as c,realpathSync as l}from"node:fs";import{dirname as u,join as d,resolve as f}from"node:path";import{fileURLToPath as p}from"node:url";import{build as m}from"vite";var h=19,g=[`react-redux`,`react-router-dom`,`axios`],_=[`kit`,`platform`,`libraryPackage`,`components`,`tokens`,`rolesFile`,`styles`,`rendererProtocolVersion`,`renames`],v=[`kit`,`platform`,`libraryPackage`,`components`,`tokens`,`rendererProtocolVersion`],y=`canvas-kit:entry`,b=`\0${y}`,x=d(u(p(import.meta.url)),`kitModule.js`),S={"process.env.NODE_ENV":JSON.stringify(`production`),"process.env":`{}`,__DEV__:`false`},C=/(?<![\w$."'`])(process\.env|__DEV__)(?![\w$])/;function w(e){let n=t(e);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`${e} must be a JSON object.`);if(n.entry!==void 0)throw Error(`${e}: A kit lists its components with components, a glob of .meta.js files; entry is retired.`);for(let t of Object.keys(n))if(!_.includes(t))throw Error(`${e} has the unknown key ${t}. The keys are ${_.join(`, `)}.`);for(let t of v)if(n[t]===void 0)throw Error(`${e} needs the key ${t}.`);for(let t of[`kit`,`platform`,`libraryPackage`,`components`,`tokens`])if(typeof n[t]!=`string`)throw Error(`${e}: ${t} must be a string.`);for(let t of[`rolesFile`])if(n[t]!==void 0&&typeof n[t]!=`string`)throw Error(`${e}: ${t} must be a string path.`);if(n.styles!==void 0){if(!Array.isArray(n.styles)||n.styles.some(e=>typeof e!=`string`||e===``))throw Error(`${e}: styles must be a list of style file paths.`);for(let t of n.styles){if(!/\.(css|scss)$/.test(t))throw Error(`${e}: styles names ${t}, which is not a .css or .scss file.`);if(!c(f(u(e),t)))throw Error(`${e}: styles names ${t}, which does not exist.`)}}return n}function T(n){let r=e(n,`react`);if(!r)throw Error(`react is not installed for ${n}. Run pnpm install there.`);let{version:i}=t(d(r,`package.json`));if(Number(String(i).split(`.`)[0])!==h)throw Error(`The product uses React ${i}; the Canvas renderer runs React ${h}. Pin react to ${h}.x and rebuild.`)}function E(e){let{version:n}=t(d(e,`package.json`));if(!n)throw Error(`${d(e,`package.json`)} needs a version; the release is stamped with it.`);return n}function D({styleFiles:e,libraryFile:t,libraryPackage:r,chromeFile:i,manifest:a,libraryNames:o,chromeNames:s,productModules:c}){let l=[...c],u=[...o.map(({fixedProps:e})=>e),...l.map(([,{fixedProps:e}])=>e)].some(e=>e!==void 0),d=e.map(e=>`import ${JSON.stringify(n(e))};`);u&&d.push(`import { createElement } from "react";`),d.push(`import { ${u?`defineKit, withFixedProps`:`defineKit`} } from ${JSON.stringify(n(x))};`),l.forEach(([,{module:e,exportName:t}],r)=>{d.push(`import { ${t} as product${r} } from ${JSON.stringify(n(e))};`)});let f=a.platform===`Phone`,p=f&&r===`@webority/mobile-ui`,m=[...new Set(o.map(({exportName:e})=>e))];p&&!m.includes(`KitThemeBridge`)&&m.push(`KitThemeBridge`),m.length>0&&d.push(`import { ${m.join(`, `)} } from ${JSON.stringify(n(t))};`),s.length>0&&d.push(`import { ${s.join(`, `)} } from ${JSON.stringify(n(i))};`),f&&!p&&d.push(`import { KitThemeBridge } from "@webority/mobile-ui";`);let h=(e,t,n)=>n===void 0?e===t?e:`${e}: ${t}`:`${e}: withFixedProps(createElement, ${t}, ${JSON.stringify(n)}, ${JSON.stringify(e)})`,g=[...o.map(({name:e,exportName:t,fixedProps:n})=>h(e,t,n)),...s,...l.map(([e,{fixedProps:t}],n)=>h(e,`product${n}`,t))],_=Object.fromEntries(a.components.filter(({marker:e})=>e!==null).map(({name:e,marker:t})=>[e,t])),v=f?`, themeBridge: KitThemeBridge`:``;return d.push(`export default defineKit({ components: { ${g.join(`, `)} }, markers: ${JSON.stringify(_)}, tokenValues: ${JSON.stringify(a.tokenValues)}, manifest: ${JSON.stringify(a)}${v} });`,``),d.join(`
2
- `)}function O(e){return{name:`canvas-kit-entry`,resolveId(e){return e===y?b:null},load(t){return t===b?e:null}}}function k(e){let t=`${n(d(e,`src`,`services`))}/`;return{name:`canvas-kit-banned-imports`,transform(e,r){let i=n(r.split(`?`)[0]),a=g.find(e=>i.includes(`/node_modules/${e}/`));if(a)throw Error(`The kit imports ${a} (${i}). A kit draws from its props only; the container that renders it holds the state and the calls.`);if(i.startsWith(t))throw Error(`The kit imports ${i}, which is in src/services. A kit draws from its props only; move the call into the container.`);return null}}}async function A({root:e,kit:t,platform:n,styleFiles:i,libraryFile:a,libraryPackage:o,chromeFile:s,libraryNames:c,chromeNames:l,productModules:u,manifest:d}){let f=r[n],p=await m({configFile:!1,root:e,logLevel:`warn`,publicDir:!1,envDir:!1,define:S,plugins:[O(D({styleFiles:i,libraryFile:a,libraryPackage:o,chromeFile:s,manifest:d,libraryNames:c,chromeNames:l,productModules:u})),k(e)],esbuild:{jsx:`automatic`,jsxImportSource:`react`,include:/\.[cm]?[jt]sx?$/},build:{write:!1,minify:!0,target:`es2022`,cssCodeSplit:!1,lib:{entry:y,formats:[`es`],fileName:()=>`kit.js`},rollupOptions:{input:y,external:e=>f.some(t=>e===t||e.startsWith(`${t}/`)),output:{codeSplitting:!1}}}}),h=(Array.isArray(p)?p:[p]).flatMap(e=>e.output),g=h.find(e=>e.type===`chunk`&&e.isEntry);if(!g)throw Error(`The bundle of ${t} has no entry module.`);let _=C.exec(g.code);if(_)throw Error(`The bundle of ${t} still reads ${_[1]}, which the renderer does not define.`);let v=h.filter(e=>e.type===`chunk`&&!e.isEntry);if(v.length>0)throw Error(`The bundle of ${t} split ${v.map(e=>e.fileName).join(`, `)} out of kit.js; a kit must be one file.`);let b=h.filter(e=>e.type===`asset`&&e.fileName.endsWith(`.css`)).map(e=>typeof e.source==`string`?e.source:Buffer.from(e.source).toString(`utf8`)).join(`
3
- `);return{script:g.code,styles:b}}async function j({configFile:e,outDir:t,styleKeysFile:n,phoneRendererSupportFile:r}){let d=f(e),p=f(t);if(c(p))throw Error(`${p} already exists. A release folder is never overwritten; choose a new folder.`);let m=w(d),h=l(u(d));if(m.platform!==`Phone`&&r!==void 0)throw Error(`Only a Phone kit reads --phone-renderer-support; a Web kit takes no phone support file.`);T(h);let g=m.rolesFile===void 0?void 0:f(h,m.rolesFile),{manifest:_,warnings:v,phoneChromeNames:y,productModules:b}=await a({projectRoot:h,kit:m.kit,platform:m.platform,components:m.components,tokens:m.tokens,libraryPackage:m.libraryPackage,rolesFile:g,rendererProtocolVersion:m.rendererProtocolVersion,phoneRendererSupportFile:r===void 0?void 0:f(r),styleKeysFile:n===void 0?void 0:f(n),renamesDir:m.renames===void 0?void 0:f(h,m.renames)}),x=i(h,m.libraryPackage),S=E(h),C=_.components.filter(({source:e,name:t})=>e===m.libraryPackage&&!y.includes(t)).map(({name:e,component:t,fixedProps:n})=>({name:e,exportName:t??e,...n===void 0?{}:{fixedProps:n}})),{script:D,styles:O}=await A({root:h,kit:m.kit,platform:m.platform,styleFiles:(m.styles??[]).map(e=>f(h,e)),libraryFile:x.entryFile,libraryPackage:m.libraryPackage,chromeFile:x.canvasKitFile,libraryNames:C,chromeNames:y,productModules:b,manifest:_}),k={"manifest.json":`${JSON.stringify(_,null,2)}\n`,"kit.js":D,"kit.css":O},j={name:m.kit,version:S,platform:m.platform,kitModuleVersion:2,rendererProtocolVersion:m.rendererProtocolVersion,library:_.library,files:Object.fromEntries(Object.entries(k).map(([e,t])=>[e,o(t)]))};return s(p,k,j),{outDir:p,release:j,manifest:_,warnings:v}}export{j as buildKitRelease,w as readConfig};
1
+ import{findPackageDir as e,readJson as t,toPosix as n}from"./files.js";import{KIT_MODULE_EXTERNALS as r}from"./kitModule.js";import{libraryFiles as i,readManifest as a}from"./manifest.js";import{digest as o,writeReleaseFolder as s}from"./release.js";import{existsSync as c,realpathSync as l}from"node:fs";import{dirname as u,join as d,resolve as f}from"node:path";import{fileURLToPath as p}from"node:url";import{build as m}from"vite";var h=19,g=[`react-redux`,`react-router-dom`,`axios`],_=[`kit`,`platform`,`libraryPackage`,`components`,`tokens`,`rolesFile`,`styles`,`rendererProtocolVersion`,`renames`],v=[`kit`,`platform`,`libraryPackage`,`components`,`tokens`,`rendererProtocolVersion`],y=`canvas-kit:entry`,b=`\0${y}`,x=d(u(p(import.meta.url)),`kitModule.js`),S={"process.env.NODE_ENV":JSON.stringify(`production`),"process.env":`{}`,__DEV__:`false`},C=/(?<![\w$."'`])(process\.env|__DEV__)(?![\w$])/;function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T(e,t,n){let r=t[n];if(typeof r!=`string`)throw Error(`${e}: ${n} must be a string.`);return r}function E(e,t,n){let r=t[n];if(r!==void 0&&typeof r!=`string`)throw Error(`${e}: ${n} must be a string path.`);return r}function D(e,t){if(t===void 0)return;if(!Array.isArray(t))throw Error(`${e}: styles must be a list of style file paths.`);let n=t,r=[];for(let t of n){if(typeof t!=`string`||t===``)throw Error(`${e}: styles must be a list of style file paths.`);r.push(t)}for(let t of r){if(!/\.(css|scss)$/.test(t))throw Error(`${e}: styles names ${t}, which is not a .css or .scss file.`);if(!c(f(u(e),t)))throw Error(`${e}: styles names ${t}, which does not exist.`)}return r}function O(e){let n=t(e);if(!w(n))throw Error(`${e} must be a JSON object.`);if(n.entry!==void 0)throw Error(`${e}: A kit lists its components with components, a glob of .meta.js files; entry is retired.`);for(let t of Object.keys(n))if(!_.includes(t))throw Error(`${e} has the unknown key ${t}. The keys are ${_.join(`, `)}.`);for(let t of v)if(n[t]===void 0)throw Error(`${e} needs the key ${t}.`);let r=T(e,n,`platform`);if(r!==`Web`&&r!==`Phone`)throw Error(`${e}: platform must be Web or Phone.`);let i=n.rendererProtocolVersion;if(typeof i!=`number`)throw Error(`${e}: rendererProtocolVersion must be a number.`);return{kit:T(e,n,`kit`),platform:r,libraryPackage:T(e,n,`libraryPackage`),components:T(e,n,`components`),tokens:T(e,n,`tokens`),rolesFile:E(e,n,`rolesFile`),styles:D(e,n.styles),rendererProtocolVersion:i,renames:E(e,n,`renames`)}}function k(e){let n=t(e);if(!w(n))throw Error(`${e} must be a JSON object.`);let r=n.version;if(r!==void 0&&typeof r!=`string`)throw Error(`${e}: version must be a string.`);return r}function A(t){let n=e(t,`react`);if(!n)throw Error(`react is not installed for ${t}. Run pnpm install there.`);let r=k(d(n,`package.json`));if(Number(String(r).split(`.`)[0])!==h)throw Error(`The product uses React ${r}; the Canvas renderer runs React ${h}. Pin react to ${h}.x and rebuild.`)}function j(e){let t=d(e,`package.json`),n=k(t);if(!n)throw Error(`${t} needs a version; the release is stamped with it.`);return n}function M({styleFiles:e,libraryFile:t,libraryPackage:r,chromeFile:i,manifest:a,libraryNames:o,chromeNames:s,productModules:c}){let l=[...c],u=[...o.map(({fixedProps:e})=>e),...l.map(([,{fixedProps:e}])=>e)].some(e=>e!==void 0),d=e.map(e=>`import ${JSON.stringify(n(e))};`);u&&d.push(`import { createElement } from "react";`),d.push(`import { ${u?`defineKit, withFixedProps`:`defineKit`} } from ${JSON.stringify(n(x))};`),l.forEach(([,{module:e,exportName:t}],r)=>{d.push(`import { ${t} as product${r} } from ${JSON.stringify(n(e))};`)});let f=a.platform===`Phone`,p=f&&r===`@webority/mobile-ui`,m=[...new Set(o.map(({exportName:e})=>e))];if(p&&!m.includes(`KitThemeBridge`)&&m.push(`KitThemeBridge`),m.length>0&&d.push(`import { ${m.join(`, `)} } from ${JSON.stringify(n(t))};`),s.length>0){if(i===null)throw Error(`canvas-kit: the kit names phone chrome entries but no chrome file.`);d.push(`import { ${s.join(`, `)} } from ${JSON.stringify(n(i))};`)}f&&!p&&d.push(`import { KitThemeBridge } from "@webority/mobile-ui";`);let h=(e,t,n)=>n===void 0?e===t?e:`${e}: ${t}`:`${e}: withFixedProps(createElement, ${t}, ${JSON.stringify(n)}, ${JSON.stringify(e)})`,g=[...o.map(({name:e,exportName:t,fixedProps:n})=>h(e,t,n)),...s,...l.map(([e,{fixedProps:t}],n)=>h(e,`product${n}`,t))],_=Object.fromEntries(a.components.filter(({marker:e})=>e!==null).map(({name:e,marker:t})=>[e,t])),v=f?`, themeBridge: KitThemeBridge`:``;return d.push(`export default defineKit({ components: { ${g.join(`, `)} }, markers: ${JSON.stringify(_)}, tokenValues: ${JSON.stringify(a.tokenValues)}, manifest: ${JSON.stringify(a)}${v} });`,``),d.join(`
2
+ `)}function N(e){return{name:`canvas-kit-entry`,resolveId(e){return e===y?b:null},load(t){return t===b?e:null}}}function P(e){let t=`${n(d(e,`src`,`services`))}/`;return{name:`canvas-kit-banned-imports`,transform(e,r){let i=n(r.split(`?`)[0]??``),a=g.find(e=>i.includes(`/node_modules/${e}/`));if(a)throw Error(`The kit imports ${a} (${i}). A kit draws from its props only; the container that renders it holds the state and the calls.`);if(i.startsWith(t))throw Error(`The kit imports ${i}, which is in src/services. A kit draws from its props only; move the call into the container.`);return null}}}async function F({root:e,kit:t,platform:n,styleFiles:i,libraryFile:a,libraryPackage:o,chromeFile:s,libraryNames:c,chromeNames:l,productModules:u,manifest:d}){let f=r[n],p=await m({configFile:!1,root:e,logLevel:`warn`,publicDir:!1,envDir:!1,define:S,plugins:[N(M({styleFiles:i,libraryFile:a,libraryPackage:o,chromeFile:s,manifest:d,libraryNames:c,chromeNames:l,productModules:u})),P(e)],esbuild:{jsx:`automatic`,jsxImportSource:`react`,include:/\.[cm]?[jt]sx?$/},build:{write:!1,minify:!0,target:`es2022`,cssCodeSplit:!1,lib:{entry:y,formats:[`es`],fileName:()=>`kit.js`},rollupOptions:{input:y,external:e=>f.some(t=>e===t||e.startsWith(`${t}/`)),output:{codeSplitting:!1,minify:!0,comments:{annotation:!1}}}}}),h=(Array.isArray(p)?p:[p]).flatMap(e=>{if(!(`output`in e))throw Error(`canvas-kit: vite build returned a watcher instead of its output.`);return e.output}),g=h.find(e=>e.type===`chunk`&&e.isEntry);if(g?.type!==`chunk`)throw Error(`The bundle of ${t} has no entry module.`);let _=C.exec(g.code);if(_)throw Error(`The bundle of ${t} still reads ${_[1]}, which the renderer does not define.`);let v=h.filter(e=>e.type===`chunk`&&!e.isEntry);if(v.length>0)throw Error(`The bundle of ${t} split ${v.map(e=>e.fileName).join(`, `)} out of kit.js; a kit must be one file.`);let b=h.flatMap(e=>e.type!==`asset`||!e.fileName.endsWith(`.css`)?[]:[typeof e.source==`string`?e.source:Buffer.from(e.source).toString(`utf8`)]).join(`
3
+ `);return{script:g.code,styles:b}}async function I({configFile:e,outDir:t,styleKeysFile:n,phoneRendererSupportFile:r}){let d=f(e),p=f(t);if(c(p))throw Error(`${p} already exists. A release folder is never overwritten; choose a new folder.`);let m=O(d),h=l(u(d));if(m.platform!==`Phone`&&r!==void 0)throw Error(`Only a Phone kit reads --phone-renderer-support; a Web kit takes no phone support file.`);A(h);let g=m.rolesFile===void 0?void 0:f(h,m.rolesFile),{manifest:_,warnings:v,phoneChromeNames:y,productModules:b}=await a({projectRoot:h,kit:m.kit,platform:m.platform,components:m.components,tokens:m.tokens,libraryPackage:m.libraryPackage,rolesFile:g,rendererProtocolVersion:m.rendererProtocolVersion,phoneRendererSupportFile:r===void 0?void 0:f(r),styleKeysFile:n===void 0?void 0:f(n),renamesDir:m.renames===void 0?void 0:f(h,m.renames)}),x=i(h,m.libraryPackage),S=j(h),C=_.components.filter(({source:e,name:t})=>e===m.libraryPackage&&!y.includes(t)).map(({name:e,component:t,fixedProps:n})=>({name:e,exportName:t??e,...n===void 0?{}:{fixedProps:n}})),{script:w,styles:T}=await F({root:h,kit:m.kit,platform:m.platform,styleFiles:(m.styles??[]).map(e=>f(h,e)),libraryFile:x.entryFile,libraryPackage:m.libraryPackage,chromeFile:x.canvasKitFile,libraryNames:C,chromeNames:y,productModules:b,manifest:_}),E={"manifest.json":`${JSON.stringify(_,null,2)}\n`,"kit.js":w,"kit.css":T},D={name:m.kit,version:S,platform:m.platform,kitModuleVersion:2,rendererProtocolVersion:m.rendererProtocolVersion,library:_.library,files:{"manifest.json":o(E[`manifest.json`]),"kit.js":o(E[`kit.js`]),"kit.css":o(E[`kit.css`])}};return s(p,E,D),{outDir:p,release:D,manifest:_,warnings:v}}export{I as buildKitRelease,O as readConfig};
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js CHANGED
@@ -8,4 +8,4 @@ build: builds a kit release into <dir>: kit.js, kit.css, manifest.json and relea
8
8
  --style-keys: the style key table the renderer draws from. Optional.
9
9
  --phone-renderer-support: the phone renderer's support file. A Phone product kit needs it; a phone library's own kit release builds without it.
10
10
  guidance: writes the usage guidance of every component the config's components glob lists to <file> (webority-guidance/1), replacing it.
11
- Flag paths are relative to the working directory; the paths in the config are relative to the config file.`,a=new Set([`--config`,`--out`,`--style-keys`,`--phone-renderer-support`]);function o(e){if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return{help:!0};let[t,...n]=e;if(t===`ids`){let e,r=!1;for(let t of n)if(t===`--write`)r=!0;else if(e===void 0&&!t.startsWith(`--`))e=t;else throw Error(`Unknown argument ${t}.`);return{command:t,options:{folder:e,write:r}}}let r={};for(let e=0;e<n.length;e+=1){let t=n[e];if(!a.has(t))throw Error(`Unknown argument ${t}.`);let i=n[e+1];if(i===void 0||i.startsWith(`--`))throw Error(`${t} needs a value.`);r[t.slice(2)]=i,e+=1}return{command:t,options:r}}async function s(a){let s=o(a);if(s.help){process.stdout.write(`${i}\n`);return}if(s.command!==`build`&&s.command!==`guidance`&&s.command!==`ids`)throw Error(`Unknown command ${s.command}. The commands are build, guidance and ids.`);if(s.command===`ids`){if(s.options.folder===void 0)throw Error(`ids needs a folder.`);let e=await n(r(s.options.folder),{write:s.options.write});for(let t of e.proposals)process.stdout.write(`${t.file}:${t.line} ${t.element} ${t.key}\n`);for(let t of e.noKey)process.stdout.write(`${t.file}:${t.line} ${t.element} no record key\n`);process.stdout.write(`${e.proposals.length} keys proposed, ${e.written} written, ${e.noKey.length} list items have no record key.\n`);return}if(s.command===`guidance`){if(!s.options.config||!s.options.out)throw Error(`guidance needs --config and --out.`);if(s.options[`style-keys`]!==void 0||s.options[`phone-renderer-support`]!==void 0)throw Error(`guidance takes only --config and --out.`);let e=await t({configFile:r(s.options.config),outFile:r(s.options.out)});process.stdout.write(`Guidance for ${e.components.length} components written to ${r(s.options.out)}.\n`);return}if(!s.options.config||!s.options.out)throw Error(`build needs --config and --out.`);let c=s.options[`style-keys`],l=s.options[`phone-renderer-support`],u=await e({configFile:r(s.options.config),outDir:r(s.options.out),styleKeysFile:c===void 0?void 0:r(c),phoneRendererSupportFile:l===void 0?void 0:r(l)});for(let e of u.warnings)process.stderr.write(`warning: ${e}\n`);process.stdout.write(`Built ${u.release.name} (${u.release.platform}): ${u.manifest.components.length} components. Release written to ${u.outDir}.\n`)}s(process.argv.slice(2)).catch(e=>{process.stderr.write(`canvas-kit: ${e.message}\n`),process.exitCode=1});export{};
11
+ Flag paths are relative to the working directory; the paths in the config are relative to the config file.`,a=new Set([`--config`,`--out`,`--style-keys`,`--phone-renderer-support`]);function o(e){return e.command===`ids`}function s(e){if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return{help:!0};let[t,...n]=e;if(t===`ids`){let e,r=!1;for(let t of n)if(t===`--write`)r=!0;else if(e===void 0&&!t.startsWith(`--`))e=t;else throw Error(`Unknown argument ${t}.`);return{command:t,options:{folder:e,write:r}}}let r={};for(let e=0;e<n.length;e+=1){let t=n[e];if(t===void 0||!a.has(t))throw Error(`Unknown argument ${t}.`);let i=n[e+1];if(i===void 0||i.startsWith(`--`))throw Error(`${t} needs a value.`);r[t.slice(2)]=i,e+=1}return{command:t,options:r}}async function c(a){let c=s(a);if(c.help){process.stdout.write(`${i}\n`);return}if(c.command!==`build`&&c.command!==`guidance`&&c.command!==`ids`)throw Error(`Unknown command ${c.command}. The commands are build, guidance and ids.`);if(o(c)){if(c.options.folder===void 0)throw Error(`ids needs a folder.`);let e=await n(r(c.options.folder),{write:c.options.write});for(let t of e.proposals)process.stdout.write(`${t.file}:${t.line} ${t.element} ${t.key}\n`);for(let t of e.noKey)process.stdout.write(`${t.file}:${t.line} ${t.element} no record key\n`);process.stdout.write(`${e.proposals.length} keys proposed, ${e.written} written, ${e.noKey.length} list items have no record key.\n`);return}if(c.command===`guidance`){if(!c.options.config||!c.options.out)throw Error(`guidance needs --config and --out.`);if(c.options[`style-keys`]!==void 0||c.options[`phone-renderer-support`]!==void 0)throw Error(`guidance takes only --config and --out.`);let e=await t({configFile:r(c.options.config),outFile:r(c.options.out)});process.stdout.write(`Guidance for ${e.components.length} components written to ${r(c.options.out)}.\n`);return}if(!c.options.config||!c.options.out)throw Error(`build needs --config and --out.`);let l=c.options[`style-keys`],u=c.options[`phone-renderer-support`],d=await e({configFile:r(c.options.config),outDir:r(c.options.out),styleKeysFile:l===void 0?void 0:r(l),phoneRendererSupportFile:u===void 0?void 0:r(u)});for(let e of d.warnings)process.stderr.write(`warning: ${e}\n`);process.stdout.write(`Built ${d.release.name} (${d.release.platform}): ${d.manifest.components.length} components. Release written to ${d.outDir}.\n`)}c(process.argv.slice(2)).catch(e=>{process.stderr.write(`canvas-kit: ${e.message}\n`),process.exitCode=1});export{};
@@ -0,0 +1,17 @@
1
+ export declare const NOT_DRAWN_FILE: "src/components/not-drawn.json";
2
+ type DrawnName = {
3
+ name: string;
4
+ component: string;
5
+ };
6
+ export declare function componentExports({ root, typesFile }: {
7
+ root: string;
8
+ typesFile: string;
9
+ }): string[];
10
+ export declare function readNotDrawn(file: string): Record<string, unknown>;
11
+ export declare function checkDrawn({ libraryPackage, exported, drawnNames, notDrawn, }: {
12
+ libraryPackage: string;
13
+ exported: string[];
14
+ drawnNames: DrawnName[];
15
+ notDrawn: Record<string, unknown>;
16
+ }): void;
17
+ export {};
package/dist/drawn.js CHANGED
@@ -1,4 +1,4 @@
1
- import{readJson as e,toPosix as t}from"./files.js";import{TSC as n,specifierOf as r}from"./metaCheck.js";import{existsSync as i,mkdirSync as a,realpathSync as o,rmSync as s,writeFileSync as c}from"node:fs";import{join as l}from"node:path";import{execFileSync as u}from"node:child_process";var d=`src/components/not-drawn.json`;function f({root:e,typesFile:i}){let d=l(o(e),`node_modules`,`.canvas-kit-exports-${process.pid}`);try{a(d,{recursive:!0});let e=[`import type * as L from "${r(i)}";`,`type IsComponent<T> = 0 extends 1 & T ? true : T extends (...args: never[]) => unknown ? true : T extends abstract new (...args: never[]) => unknown ? true : T extends { $$typeof: symbol } ? true : false;`,`type Named<K> = K extends string ? (K extends Capitalize<K> ? (K extends Uncapitalize<K> ? never : K) : never) : never;`,`type Components = { [K in keyof typeof L]: Named<K> extends never ? never : IsComponent<(typeof L)[K]> extends true ? K : never }[keyof typeof L];`,`export const components: never = null as unknown as { [K in Components]: K };`];c(l(d,`check.ts`),`${e.join(`
2
- `)}\n`),c(l(d,`tsconfig.json`),JSON.stringify({compilerOptions:{strict:!0,noEmit:!0,allowJs:!0,checkJs:!1,jsx:`react-jsx`,module:`esnext`,moduleResolution:`bundler`,target:`es2022`,skipLibCheck:!0,noErrorTruncation:!0,types:[]},files:[`check.ts`]}));let o=``;try{u(process.execPath,[n,`-p`,l(d,`tsconfig.json`),`--pretty`,`false`],{cwd:d,encoding:`utf8`,stdio:`pipe`})}catch(e){o=String(e.stdout??``)+String(e.stderr??``)}let s=o.split(/\r?\n/).find(e=>/^check\.ts\(5,\d+\): error TS2322: /.test(e)),f=s&&/Type '(\{[^']*\})' is not assignable to type 'never'/.exec(s);if(!f)throw Error(`tsc could not list the components ${t(i)} exports: ${o.split(/\r?\n/).slice(0,20).join(`
3
- `)}`);return[...new Set([...f[1].matchAll(/(\w+): "\w+"/g)].map(e=>e[1]))].sort()}finally{s(d,{recursive:!0,force:!0})}}function p(t){if(!i(t))return{};let n=e(t);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`${t} must be an object from component name to the reason the kit does not draw it.`);let r=Object.entries(n).filter(([,e])=>typeof e!=`string`||e.trim()===``).map(([e])=>e);if(r.length>0)throw Error(`${t}: ${r.join(`, `)} need a reason the kit does not draw them.`);return n}function m({libraryPackage:e,exported:t,drawnNames:n,notDrawn:r}){let i=new Set(t),a=[...new Map(n.map(e=>[`${e.name} ${e.component}`,e])).values()],o=new Set(a.map(({component:e})=>e)),s=Object.keys(r),c=[],l=t.filter(e=>!o.has(e)&&!(e in r));l.length>0&&c.push(`${e} exports ${l.join(`, `)} with no meta. Write a meta for each, or list it in ${d} with the reason the kit does not draw it.`);let u=s.filter(e=>o.has(e));u.length>0&&c.push(`${d} lists ${u.join(`, `)}, which have a meta. A component is drawn or not drawn; remove one.`);let f=s.filter(e=>!i.has(e));f.length>0&&c.push(`${d} lists ${f.join(`, `)}, which ${e} does not export as components. Remove them.`);let p=a.filter(({component:e})=>!i.has(e));if(p.length>0){let t=p.map(({name:e,component:t})=>e===t?e:`${e} (draws ${t})`);c.push(`${t.join(`, `)} have a meta, but ${e} does not export them as components.`)}if(c.length>0)throw Error(c.join(`
4
- `))}export{d as NOT_DRAWN_FILE,m as checkDrawn,f as componentExports,p as readNotDrawn};
1
+ import{isRecord as e,readJson as t,toPosix as n}from"./files.js";import{TSC as r,specifierOf as i}from"./metaCheck.js";import{existsSync as a,mkdirSync as o,realpathSync as s,rmSync as c,writeFileSync as l}from"node:fs";import{join as u}from"node:path";import{execFileSync as d}from"node:child_process";var f=`src/components/not-drawn.json`;function p({root:e,typesFile:t}){let a=u(s(e),`node_modules`,`.canvas-kit-exports-${process.pid}`);try{o(a,{recursive:!0});let e=[`import type * as L from "${i(t)}";`,`type IsComponent<T> = 0 extends 1 & T ? true : T extends (...args: never[]) => unknown ? true : T extends abstract new (...args: never[]) => unknown ? true : T extends { $$typeof: symbol } ? true : false;`,`type Named<K> = K extends string ? (K extends Capitalize<K> ? (K extends Uncapitalize<K> ? never : K) : never) : never;`,`type Components = { [K in keyof typeof L]: Named<K> extends never ? never : IsComponent<(typeof L)[K]> extends true ? K : never }[keyof typeof L];`,`export const components: never = null as unknown as { [K in Components]: K };`];l(u(a,`check.ts`),`${e.join(`
2
+ `)}\n`),l(u(a,`tsconfig.json`),JSON.stringify({compilerOptions:{strict:!0,noEmit:!0,allowJs:!0,checkJs:!1,jsx:`react-jsx`,module:`esnext`,moduleResolution:`bundler`,target:`es2022`,skipLibCheck:!0,noErrorTruncation:!0,types:[]},files:[`check.ts`]}));let s=``;try{d(process.execPath,[r,`-p`,u(a,`tsconfig.json`),`--pretty`,`false`],{cwd:a,encoding:`utf8`,stdio:`pipe`})}catch(e){s=m(e)}let c=s.split(/\r?\n/).find(e=>/^check\.ts\(5,\d+\): error TS2322: /.test(e)),f=c&&/Type '(\{[^']*\})' is not assignable to type 'never'/.exec(c);if(!f||f[1]===void 0)throw Error(`tsc could not list the components ${n(t)} exports: ${s.split(/\r?\n/).slice(0,20).join(`
3
+ `)}`);let p=[...f[1].matchAll(/(\w+): "\w+"/g)].map(e=>e[1]).filter(e=>e!==void 0);return[...new Set(p)].sort()}finally{c(a,{recursive:!0,force:!0})}}function m(e){return typeof e!=`object`||!e?``:(`stdout`in e?String(e.stdout??``):``)+(`stderr`in e?String(e.stderr??``):``)}function h(t,n){if(!e(t))throw Error(`${n} must be an object from component name to the reason the kit does not draw it.`);return t}function g(e){if(!a(e))return{};let n=h(t(e),e),r=Object.entries(n).filter(([,e])=>typeof e!=`string`||e.trim()===``).map(([e])=>e);if(r.length>0)throw Error(`${e}: ${r.join(`, `)} need a reason the kit does not draw them.`);return n}function _({libraryPackage:e,exported:t,drawnNames:n,notDrawn:r}){let i=new Set(t),a=[...new Map(n.map(e=>[`${e.name} ${e.component}`,e])).values()],o=new Set(a.map(({component:e})=>e)),s=Object.keys(r),c=[],l=t.filter(e=>!o.has(e)&&!(e in r));l.length>0&&c.push(`${e} exports ${l.join(`, `)} with no meta. Write a meta for each, or list it in ${f} with the reason the kit does not draw it.`);let u=s.filter(e=>o.has(e));u.length>0&&c.push(`${f} lists ${u.join(`, `)}, which have a meta. A component is drawn or not drawn; remove one.`);let d=s.filter(e=>!i.has(e));d.length>0&&c.push(`${f} lists ${d.join(`, `)}, which ${e} does not export as components. Remove them.`);let p=a.filter(({component:e})=>!i.has(e));if(p.length>0){let t=p.map(({name:e,component:t})=>e===t?e:`${e} (draws ${t})`);c.push(`${t.join(`, `)} have a meta, but ${e} does not export them as components.`)}if(c.length>0)throw Error(c.join(`
4
+ `))}export{f as NOT_DRAWN_FILE,_ as checkDrawn,p as componentExports,g as readNotDrawn};
@@ -0,0 +1,5 @@
1
+ export declare function readText(file: string): string;
2
+ export declare function readJson(file: string): unknown;
3
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
4
+ export declare function toPosix(path: string): string;
5
+ export declare function findPackageDir(start: string, name: string): string | null;
package/dist/files.js CHANGED
@@ -1 +1 @@
1
- import{existsSync as e,readFileSync as t}from"node:fs";import{dirname as n,join as r}from"node:path";function i(n){if(!e(n))throw Error(`Missing ${n}. Run pnpm install in the product first.`);return t(n,`utf8`)}function a(e){return JSON.parse(i(e))}function o(e){return e.replace(/\\/g,`/`)}function s(t,i){let a=t;for(;;){let t=r(a,`node_modules`,...i.split(`/`));if(e(r(t,`package.json`)))return t;let o=n(a);if(o===a)return null;a=o}}export{s as findPackageDir,a as readJson,i as readText,o as toPosix};
1
+ import{existsSync as e,readFileSync as t}from"node:fs";import{dirname as n,join as r}from"node:path";function i(n){if(!e(n))throw Error(`Missing ${n}. Run pnpm install in the product first.`);return t(n,`utf8`)}function a(e){return JSON.parse(i(e))}function o(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function s(e){return e.replace(/\\/g,`/`)}function c(t,i){let a=t;for(;;){let t=r(a,`node_modules`,...i.split(`/`));if(e(r(t,`package.json`)))return t;let o=n(a);if(o===a)return null;a=o}}export{c as findPackageDir,o as isRecord,a as readJson,i as readText,s as toPosix};
@@ -1,10 +1,22 @@
1
- import type { ComponentMeta, ComponentUsage } from "./meta.js";
2
-
1
+ import type { ComponentMeta, ComponentUsage } from "./meta.ts";
3
2
  export interface GuidanceFile {
4
3
  format: "webority-guidance/1";
5
- package: { name: string; version: string };
6
- components: { name: string; usage: ComponentUsage }[];
4
+ package: {
5
+ name: string;
6
+ version: string;
7
+ };
8
+ components: {
9
+ name: string;
10
+ usage: ComponentUsage;
11
+ }[];
7
12
  }
8
-
9
- export declare function guidanceOf(metas: { meta: ComponentMeta }[], pkg: { name: string; version: string }): GuidanceFile;
10
- export declare function writeGuidance(options: { configFile: string; outFile: string }): Promise<GuidanceFile>;
13
+ export declare function guidanceOf(metas: {
14
+ meta: ComponentMeta;
15
+ }[], pkg: {
16
+ name: string;
17
+ version: string;
18
+ }): GuidanceFile;
19
+ export declare function writeGuidance({ configFile, outFile }: {
20
+ configFile: string;
21
+ outFile: string;
22
+ }): Promise<GuidanceFile>;
package/dist/guidance.js CHANGED
@@ -1 +1 @@
1
- import{findPackageDir as e,readJson as t}from"./files.js";import{readMetas as n}from"./metas.js";import{mkdirSync as r,writeFileSync as i}from"node:fs";import{dirname as a,join as o,resolve as s}from"node:path";function c(e){return typeof e==`string`&&e.length>0}function l(e,t){return e.name<t.name?-1:+(e.name>t.name)}function u(e,t){return{format:`webority-guidance/1`,package:{name:t.name,version:t.version},components:e.map(({meta:e})=>({name:e.name,usage:e.usage})).sort(l)}}function d(n,r){let i=[];for(let a of Object.keys({...r.dependencies,...r.peerDependencies})){let r=e(n,a);if(!r)continue;let s=t(o(r,`package.json`)).exports?.[`./guidance.json`];typeof s==`string`&&i.push(...t(o(r,s)).components.map(e=>e.name))}return i}async function f({configFile:e,outFile:l}){let f=t(s(e));if(typeof f!=`object`||!f||!c(f.components))throw Error(`${e} needs the key components, a glob of .meta.js files.`);let p=a(s(e)),m=o(p,`package.json`),h=t(m);if(typeof h!=`object`||!h||!c(h.name)||!c(h.version))throw Error(`${m} needs a name and a version; the guidance file is stamped with them.`);let g=u(await n({root:p,components:f.components,knownNames:d(p,h)}),{name:h.name,version:h.version});return r(a(s(l)),{recursive:!0}),i(s(l),`${JSON.stringify(g,null,2)}\n`),g}export{u as guidanceOf,f as writeGuidance};
1
+ import{findPackageDir as e,isRecord as t,readJson as n}from"./files.js";import{readMetas as r}from"./metas.js";import{mkdirSync as i,writeFileSync as a}from"node:fs";import{dirname as o,join as s,resolve as c}from"node:path";function l(e){return typeof e==`string`&&e.length>0}function u(e,t){return e.name<t.name?-1:+(e.name>t.name)}function d(e,t){return{format:`webority-guidance/1`,package:{name:t.name,version:t.version},components:e.map(({meta:e})=>({name:e.name,usage:e.usage})).sort(u)}}function f(e,n){if(!t(e))throw Error(`${n} must be a JSON object.`);let r=e.exports;if(r!==void 0){if(!t(r))throw Error(`${n}: exports must be an object.`);return r[`./guidance.json`]}}function p(e,n){if(!t(e))throw Error(`${n} must be a JSON object.`);let r=e.components;if(!Array.isArray(r))throw Error(`${n}: components must be a list of objects with a name.`);return r.map((e,r)=>{let i=t(e)?e.name:void 0;if(typeof i!=`string`)throw Error(`${n}: components[${r}].name must be a string.`);return i})}function m(e,n){if(e===null)return null;if(!t(e))throw Error(`${n} must be a JSON object.`);return{components:e.components}}function h(e,n,r){if(e===void 0)return;if(!t(e))throw Error(`${n}: ${r} must be an object of strings.`);let i={};for(let[t,a]of Object.entries(e)){if(typeof a!=`string`)throw Error(`${n}: ${r}.${t} must be a string.`);i[t]=a}return i}function g(e,n){if(e===null)return null;if(!t(e))throw Error(`${n} must be a JSON object.`);return{name:e.name,version:e.version,dependencies:h(e.dependencies,n,`dependencies`),peerDependencies:h(e.peerDependencies,n,`peerDependencies`)}}function _(t,r){let i=[];for(let a of Object.keys({...r.dependencies,...r.peerDependencies})){let r=e(t,a);if(!r)continue;let o=s(r,`package.json`),c=f(n(o),o);if(typeof c!=`string`)continue;let l=s(r,c);i.push(...p(n(l),l))}return i}async function v({configFile:e,outFile:t}){let u=m(n(c(e)),e);if(typeof u!=`object`||!u||!l(u.components))throw Error(`${e} needs the key components, a glob of .meta.js files.`);let f=o(c(e)),p=s(f,`package.json`),h=g(n(p),p);if(typeof h!=`object`||!h||!l(h.name)||!l(h.version))throw Error(`${p} needs a name and a version; the guidance file is stamped with them.`);let v=d(await r({root:f,components:u.components,knownNames:_(f,h)}),{name:h.name,version:h.version});return i(o(c(t)),{recursive:!0}),a(c(t),`${JSON.stringify(v,null,2)}\n`),v}export{d as guidanceOf,v as writeGuidance};
package/dist/ids.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ interface Proposal {
2
+ file: string;
3
+ line: number;
4
+ element: string;
5
+ key: string;
6
+ }
7
+ interface NoKeyEntry {
8
+ file: string;
9
+ line: number;
10
+ element: string;
11
+ }
12
+ export declare function proposeCanvasKeys(folder: string, { write }?: {
13
+ write?: boolean | undefined;
14
+ }): Promise<{
15
+ proposals: Proposal[];
16
+ noKey: NoKeyEntry[];
17
+ written: number;
18
+ }>;
19
+ export {};
package/dist/ids.js CHANGED
@@ -1 +1 @@
1
- import{basename as e,dirname as t,extname as n,join as r,relative as i,sep as a}from"node:path";import o from"@babel/parser";import{readFile as s,readdir as c,writeFile as l}from"node:fs/promises";var u=new Set([`node_modules`,`dist`,`build`]),d=new Set([`.jsx`,`.tsx`,`.js`]),f=[`react-native`,`@webority/mobile-ui`],p=new Set([`@webority/ui-react`,`@webority/mobile-ui`]),m=new Set([`section`,`form`,`header`,`nav`,`main`,`aside`,`article`,`fieldset`]),h=[`aria-label`,`name`,`id`,`title`,`label`,`placeholder`],g=new Set([`ArrowFunctionExpression`,`FunctionExpression`,`FunctionDeclaration`,`ObjectMethod`,`ClassMethod`]),_=new Set([`loc`,`start`,`end`,`comments`,`leadingComments`,`trailingComments`,`innerComments`,`tokens`,`extra`,`errors`]),v=40,y=new Set([`Fragment`,`React.Fragment`]);async function b(e,{write:t=!1}={}){let n=[],r=[],o=[],c=new Map;for(let t of await C(e)){let l=i(e,t).split(a).join(`/`),u=await s(t,`utf8`),d=w({source:u,file:t,label:l,phone:await x(t,c)});n.push(...d.proposals),r.push(...d.noKey),d.insertions.length>0&&o.push({file:t,source:u,insertions:d.insertions})}let u=0;if(t)for(let e of o){let t=e.source;for(let n of[...e.insertions].sort((e,t)=>t.offset-e.offset))t=`${t.slice(0,n.offset)}${n.text}${t.slice(n.offset)}`;await l(e.file,t,`utf8`),u+=e.insertions.length}return{proposals:n,noKey:r,written:u}}async function x(e,n){let i=[],a=t(e),o;for(;;){if(n.has(a)){o=n.get(a);break}i.push(a);let s=await S(r(a,`package.json`));if(s!==null){o=f.some(e=>s.dependencies?.[e]||s.peerDependencies?.[e]);break}let c=t(a);if(c===a)throw Error(`no package.json above ${e}`);a=c}for(let e of i)n.set(e,o);return o}async function S(e){try{return JSON.parse(await s(e,`utf8`))}catch(e){if(e.code===`ENOENT`)return null;throw e}}async function C(e){let t=await c(e,{withFileTypes:!0});t.sort((e,t)=>e.name<t.name?-1:1);let i=[];for(let a of t){let t=r(e,a.name);a.isDirectory()?u.has(a.name)||i.push(...await C(t)):a.isFile()&&d.has(n(a.name))&&!a.name.includes(`.test.`)&&i.push(t)}return i}function w({source:e,file:t,label:n,phone:r}){let i;try{i=o.parse(e,{sourceType:`module`,plugins:[`jsx`,`typescript`]})}catch(e){throw Error(`${n}: ${e.message}`)}let a=new Set;for(let e of i.program.body){if(e.type!==`ImportDeclaration`)continue;let t=e.source.value;if(p.has(t))for(let t of e.specifiers)t.type===`ImportSpecifier`&&a.add(t.local.name)}let s=r?`testID`:`data-canvas`,c=new Map,l=[];T(i.program,null,c,l);let u=L(t),d=t=>e.slice(t.start,t.end),f=new Map,m=[],h=[];for(let e of l){let t=e.openingElement,r=P(t,s),i=j(t,a),o=E(e,c);if(i!==null&&o===null&&A(f,e,i,r,c),!r){if(o!==null){let r=t.attributes.find(e=>e.type===`JSXAttribute`&&e.name.type===`JSXIdentifier`&&e.name.name===`key`)?.value,i=r?.type===`JSXExpressionContainer`?r.expression:null,a=o.params[1]?.type===`Identifier`?o.params[1].name:null,c=y.has(d(t.name))?D(e,d):e;c===null||i===null||i.type===`JSXEmptyExpression`||V(i)||i.type===`Identifier`&&i.name===a?h.push({start:e.start,entry:{file:n,line:e.loc.start.line,element:d(t.name)}}):c!==e&&P(c.openingElement,s)||m.push({element:c,kind:`list`,keyExpression:i})}else i===null&&M(t)&&m.push({element:e,kind:`block`})}}for(let e of f.values())for(let t of e.values())if(t.length>1&&t.some(e=>e.conditional))for(let e of t)e.skipped||m.push({element:e.element,kind:`sibling`});m.sort((e,t)=>e.element.start-t.element.start);let g=new Set,_=[],v=[];for(let e of m){let{element:t,kind:r}=e,i=t.openingElement,o=d(i.name),c=j(i,a),l=`${u}.${I(t,c===null?o:R(c))}`,f=r===`list`?`${l}.\${${d(e.keyExpression)}}`:l,p=f;if(g.has(p)){let e=2;for(;g.has(`${f}-${e}`);)e+=1;p=`${f}-${e}`}g.add(p);let m=r===`list`?` ${s}={\`${p}\`}`:` ${s}="${p}"`;_.push({file:n,line:t.loc.start.line,element:o,key:p}),v.push({offset:i.name.end,text:m})}return{proposals:_,noKey:h.sort((e,t)=>e.start-t.start).map(e=>e.entry),insertions:v}}function T(e,t,n,r){t!==null&&n.set(e,t),e.type===`JSXElement`&&r.push(e);for(let t of Object.keys(e)){if(_.has(t))continue;let i=e[t];for(let t of Array.isArray(i)?i:[i])typeof t==`object`&&t&&typeof t.type==`string`&&T(t,e,n,r)}}function E(e,t){let n=t.get(e),r=null;if(n?.type===`ArrowFunctionExpression`&&n.body===e)r=n;else if(n?.type===`ReturnStatement`){let e=t.get(n),i=t.get(e);e?.type===`BlockStatement`&&g.has(i?.type)&&i.body===e&&(r=i)}if(r===null)return null;let i=t.get(r);return i?.type===`CallExpression`&&i.arguments[0]===r&&i.callee.type===`MemberExpression`&&!i.callee.computed&&i.callee.property.type===`Identifier`&&i.callee.property.name===`map`?r:null}function D(e,t){for(let n of e.children)if(n.type===`JSXFragment`||n.type===`JSXElement`&&y.has(t(n.openingElement.name))){let e=D(n,t);if(e!==null)return e}else if(n.type===`JSXElement`)return n;return null}function O(e,t){for(let n=t.get(e);n!==void 0;n=t.get(n)){if(n.type===`JSXElement`||n.type===`JSXFragment`)return n;if(g.has(n.type))return null}return null}function k(e,t,n){for(let r=n.get(e);r!==t;r=n.get(r))if(r.type===`ConditionalExpression`||r.type===`LogicalExpression`&&r.operator===`&&`)return!0;return!1}function A(e,t,n,r,i){let a=O(t,i);if(a===null)return;e.has(a)||e.set(a,new Map);let o=e.get(a);o.has(n)||o.set(n,[]),o.get(n).push({element:t,skipped:r,conditional:k(t,a,i)})}function j(e,t){return e.name.type===`JSXIdentifier`&&t.has(e.name.name)?e.name.name:null}function M(e){if(e.name.type!==`JSXIdentifier`)return!1;let t=e.name.name;return m.has(t)||t===`div`&&(N(e,`id`)||N(e,`aria-label`))}function N(e,t){return e.attributes.some(e=>e.type===`JSXAttribute`&&e.name.type===`JSXIdentifier`&&e.name.name===t)}function P(e,t){return e.attributes.some(e=>e.type===`JSXSpreadAttribute`)||N(e,t)}function F(e,t){let n=e.attributes.find(e=>e.type===`JSXAttribute`&&e.name.type===`JSXIdentifier`&&e.name.name===t)?.value;if(n){if(n.type===`StringLiteral`)return n.value;if(n.type===`JSXExpressionContainer`){let e=n.expression;if(e.type===`StringLiteral`)return e.value;if(e.type===`TemplateLiteral`&&e.expressions.length===0)return e.quasis[0].value.cooked??void 0}}}function I(e,t){for(let t of h){let n=F(e.openingElement,t),r=n===void 0?``:B(z(n));if(r!==``)return r}let n=e.children.filter(e=>e.type===`JSXText`&&e.value.trim()!==``);if(n.length===1){let e=B(z(n[0].value));if(e!==``)return e}return B(z(t))}function L(t){return z(e(t,n(t))).replace(/-(screen|page)$/,``)}function R(e){return e.replace(/^App(?=[A-Z])/,``)}function z(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function B(e){if(e.length<=v)return e;let t=e.slice(0,41).lastIndexOf(`-`);return t>0?e.slice(0,t):e.slice(0,v)}function V(e){return e.type===`TemplateLiteral`?e.expressions.length===0:/Literal$/.test(e.type)}export{b as proposeCanvasKeys};
1
+ import{basename as e,dirname as t,extname as n,join as r,relative as i,sep as a}from"node:path";import o from"@babel/parser";import{readFile as s,readdir as c,writeFile as l}from"node:fs/promises";var u=new Set([`node_modules`,`dist`,`build`]),d=new Set([`.jsx`,`.tsx`,`.js`]),f=[`react-native`,`@webority/mobile-ui`],p=new Set([`@webority/ui-react`,`@webority/mobile-ui`]),m=new Set([`section`,`form`,`header`,`nav`,`main`,`aside`,`article`,`fieldset`]),h=[`aria-label`,`name`,`id`,`title`,`label`,`placeholder`],g=new Set([`ArrowFunctionExpression`,`FunctionExpression`,`FunctionDeclaration`,`ObjectMethod`,`ClassMethod`]),_=new Set([`loc`,`start`,`end`,`comments`,`leadingComments`,`trailingComments`,`innerComments`,`tokens`,`extra`,`errors`]),v=40,y=new Set([`Fragment`,`React.Fragment`]);async function b(e,{write:t=!1}={}){let n=[],r=[],o=[],c=new Map;for(let t of await E(e)){let l=i(e,t).split(a).join(`/`),u=await s(t,`utf8`),d=A({source:u,file:t,label:l,phone:await x(t,c)});n.push(...d.proposals),r.push(...d.noKey),d.insertions.length>0&&o.push({file:t,source:u,insertions:d.insertions})}let u=0;if(t)for(let e of o){let t=e.source;for(let n of[...e.insertions].sort((e,t)=>t.offset-e.offset))t=`${t.slice(0,n.offset)}${n.text}${t.slice(n.offset)}`;await l(e.file,t,`utf8`),u+=e.insertions.length}return{proposals:n,noKey:r,written:u}}async function x(e,n){let i=[],a=t(e),o;for(;;){let s=n.get(a);if(s!==void 0){o=s;break}i.push(a);let c=await S(r(a,`package.json`));if(c!==null){o=f.some(e=>!!(c.dependencies?.[e]||c.peerDependencies?.[e]));break}let l=t(a);if(l===a)throw Error(`no package.json above ${e}`);a=l}for(let e of i)n.set(e,o);return o}async function S(e){try{return C(JSON.parse(await s(e,`utf8`)),e)}catch(e){if(T(e)&&e.code===`ENOENT`)return null;throw e}}function C(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`canvas-kit: ${t} is not a JSON object.`);let n=new Map(Object.entries(e));return{dependencies:w(n.get(`dependencies`),`dependencies`,t),peerDependencies:w(n.get(`peerDependencies`),`peerDependencies`,t)}}function w(e,t,n){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`canvas-kit: ${n} has a ${t} that is not an object.`);let r={};for(let[i,a]of Object.entries(e)){if(typeof a!=`string`)throw Error(`canvas-kit: ${n} lists ${i} under ${t} with a version that is not text.`);r[i]=a}return r}function T(e){return e instanceof Error&&`code`in e}async function E(e){let t=await c(e,{withFileTypes:!0});t.sort((e,t)=>e.name<t.name?-1:1);let i=[];for(let a of t){let t=r(e,a.name);a.isDirectory()?u.has(a.name)||i.push(...await E(t)):a.isFile()&&d.has(n(a.name))&&!a.name.includes(`.test.`)&&i.push(t)}return i}function D(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function O(e){return e!=null&&g.has(e.type)}function k(e){return e?.type===`JSXElement`}function A({source:e,file:t,label:n,phone:r}){let i;try{i=o.parse(e,{sourceType:`module`,plugins:[`jsx`,`typescript`]})}catch(e){throw Error(`${n}: ${e instanceof Error?e.message:String(e)}`)}let a=new Set;for(let e of i.program.body){if(e.type!==`ImportDeclaration`)continue;let t=e.source.value;if(p.has(t))for(let t of e.specifiers)t.type===`ImportSpecifier`&&a.add(t.local.name)}let s=r?`testID`:`data-canvas`,c=new Map,l=[];j(i.program,null,c,l);let u=U(t),d=t=>e.slice(t.start??0,t.end??0),f=new Map,m=[],h=[];for(let e of l){let t=e.openingElement,r=B(t,s),i=L(t,a),o=M(e,c);if(i!==null&&o===null&&I(f,e,i,r,c),!r){if(o!==null){let r=t.attributes.find(e=>e.type===`JSXAttribute`&&e.name.type===`JSXIdentifier`&&e.name.name===`key`)?.value,i=r?.type===`JSXExpressionContainer`?r.expression:null,a=o.params[1],c=a?.type===`Identifier`?a.name:null,l=y.has(d(t.name))?N(e,d):e;l===null||i===null||i.type===`JSXEmptyExpression`||q(i)||i.type===`Identifier`&&i.name===c?h.push({start:e.start??0,entry:{file:n,line:e.loc?.start.line??0,element:d(t.name)}}):l!==e&&B(l.openingElement,s)||m.push({element:l,kind:`list`,keyExpression:i})}else i===null&&R(t)&&m.push({element:e,kind:`block`})}}for(let e of f.values())for(let t of e.values())if(t.length>1&&t.some(e=>e.conditional))for(let e of t)e.skipped||m.push({element:e.element,kind:`sibling`});m.sort((e,t)=>(e.element.start??0)-(t.element.start??0));let g=new Set,_=[],v=[];for(let e of m){let{element:t,kind:r}=e,i=t.openingElement,o=d(i.name),c=L(i,a),l=`${u}.${H(t,c===null?o:W(c))}`,f=r===`list`&&e.keyExpression?`${l}.\${${d(e.keyExpression)}}`:l,p=f;if(g.has(p)){let e=2;for(;g.has(`${f}-${e}`);)e+=1;p=`${f}-${e}`}g.add(p);let m=r===`list`?` ${s}={\`${p}\`}`:` ${s}="${p}"`;_.push({file:n,line:t.loc?.start.line??0,element:o,key:p}),v.push({offset:i.name.end??0,text:m})}return{proposals:_,noKey:h.sort((e,t)=>e.start-t.start).map(e=>e.entry),insertions:v}}function j(e,t,n,r){t!==null&&n.set(e,t),e.type===`JSXElement`&&r.push(e);let i=Object.entries(e);for(let[t,a]of i){if(_.has(t))continue;let i=Array.isArray(a)?a:[a];for(let t of i)D(t)&&j(t,e,n,r)}}function M(e,t){let n=t.get(e),r=null;if(O(n)&&n.type===`ArrowFunctionExpression`&&n.body===e)r=n;else if(n?.type===`ReturnStatement`){let e=t.get(n),i=e?t.get(e):void 0;e?.type===`BlockStatement`&&O(i)&&i.body===e&&(r=i)}if(r===null)return null;let i=t.get(r);return i?.type===`CallExpression`&&i.arguments[0]===r&&i.callee.type===`MemberExpression`&&!i.callee.computed&&i.callee.property.type===`Identifier`&&i.callee.property.name===`map`?r:null}function N(e,t){for(let n of e.children)if(n.type===`JSXFragment`||k(n)&&y.has(t(n.openingElement.name))){let e=N(n,t);if(e!==null)return e}else if(k(n))return n;return null}function P(e,t,n){for(let r=n.get(e);r!==void 0&&r!==t;r=n.get(r))if(r.type===`ConditionalExpression`||r.type===`LogicalExpression`&&r.operator===`&&`)return!0;return!1}function F(e,t){for(let n=t.get(e);n!==void 0;n=t.get(n)){if(n.type===`JSXElement`||n.type===`JSXFragment`)return n;if(g.has(n.type))return null}return null}function I(e,t,n,r,i){let a=F(t,i);if(a===null)return;e.has(a)||e.set(a,new Map);let o=e.get(a);if(o===void 0)throw Error(`canvas-kit: the element group of a JSX parent is missing.`);o.has(n)||o.set(n,[]);let s=o.get(n);if(s===void 0)throw Error(`canvas-kit: the members of ${n} are missing.`);s.push({element:t,skipped:r,conditional:P(t,a,i)})}function L(e,t){return e.name.type===`JSXIdentifier`&&t.has(e.name.name)?e.name.name:null}function R(e){if(e.name.type!==`JSXIdentifier`)return!1;let t=e.name.name;return m.has(t)||t===`div`&&(z(e,`id`)||z(e,`aria-label`))}function z(e,t){return e.attributes.some(e=>e.type===`JSXAttribute`&&e.name.type===`JSXIdentifier`&&e.name.name===t)}function B(e,t){return e.attributes.some(e=>e.type===`JSXSpreadAttribute`)||z(e,t)}function V(e,t){let n=e.attributes.find(e=>e.type===`JSXAttribute`&&e.name.type===`JSXIdentifier`&&e.name.name===t)?.value;if(n){if(n.type===`StringLiteral`)return n.value;if(n.type===`JSXExpressionContainer`){let e=n.expression;if(e.type===`StringLiteral`)return e.value;if(e.type===`TemplateLiteral`&&e.expressions.length===0){let t=e.quasis[0];if(t===void 0)throw Error(`canvas-kit: the text of a template literal is missing.`);return t.value.cooked??void 0}}}}function H(e,t){for(let t of h){let n=V(e.openingElement,t),r=n===void 0?``:K(G(n));if(r!==``)return r}let n=e.children.filter(e=>e.type===`JSXText`&&e.value.trim()!==``);if(n.length===1){let e=n[0],t=e?.type===`JSXText`?K(G(e.value)):``;if(t!==``)return t}return K(G(t))}function U(t){return G(e(t,n(t))).replace(/-(screen|page)$/,``)}function W(e){return e.replace(/^App(?=[A-Z])/,``)}function G(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function K(e){if(e.length<=v)return e;let t=e.slice(0,41).lastIndexOf(`-`);return t>0?e.slice(0,t):e.slice(0,v)}function q(e){return e.type===`TemplateLiteral`?e.expressions.length===0:/Literal$/.test(e.type)}export{b as proposeCanvasKeys};
@@ -0,0 +1,8 @@
1
+ export { buildKitRelease, readConfig } from "./build.ts";
2
+ export { guidanceOf, writeGuidance } from "./guidance.ts";
3
+ export { defineKit, KIT_MODULE_EXTERNALS, kitModuleVersion } from "./kitModule.ts";
4
+ export { readManifest } from "./manifest.ts";
5
+ export { checkMetaTypes } from "./metaCheck.ts";
6
+ export { checkMetas, HTML_TAGS, readMetas } from "./metas.ts";
7
+ export { readReleaseManifest } from "./release.ts";
8
+ export { readRenames, renamesBetween } from "./renames.ts";
@@ -0,0 +1,25 @@
1
+ export declare const kitModuleVersion: 2;
2
+ type KitPlatform = "Web" | "Phone";
3
+ type TokenValues = Record<string, unknown>;
4
+ type KitManifest = {
5
+ platform: string;
6
+ };
7
+ type FixedComponent = ((props: Record<string, unknown>) => unknown) & {
8
+ displayName: string;
9
+ };
10
+ export declare const KIT_MODULE_EXTERNALS: Readonly<Record<KitPlatform, readonly string[]>>;
11
+ export declare function withFixedProps(createElement: (type: unknown, props: Record<string, unknown>) => unknown, component: unknown, fixedProps: Record<string, unknown>, name: string): FixedComponent;
12
+ export declare function defineKit({ components, markers, tokenValues, manifest, themeBridge, }: {
13
+ components: Record<string, unknown>;
14
+ markers: Record<string, unknown>;
15
+ tokenValues: TokenValues | null | undefined;
16
+ manifest: KitManifest | null;
17
+ themeBridge?: unknown;
18
+ }): {
19
+ components: Readonly<Record<string, unknown>>;
20
+ markers: Readonly<Record<string, unknown>>;
21
+ tokenValues: TokenValues | null;
22
+ manifest: KitManifest;
23
+ themeBridge: unknown;
24
+ };
25
+ export {};