@ankhorage/zora 26.1.5 → 27.0.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -13
  3. package/dist/capabilities/index.d.ts.map +1 -1
  4. package/dist/capabilities/index.js +2 -63
  5. package/dist/capabilities/index.js.map +3 -3
  6. package/package.json +5 -103
  7. package/src/capabilities/index.test.ts +4 -7
  8. package/src/capabilities/index.ts +1 -62
  9. package/src/invertedThemeAcceptance.test.tsx +1 -1
  10. package/src/packedWebConsumerAcceptance.test.ts +20 -0
  11. package/src/structureOwnership.test.ts +1 -1
  12. package/src/webPackageExports.test.ts +1 -0
  13. package/dist/cli/commands/create.d.ts +0 -14
  14. package/dist/cli/commands/create.d.ts.map +0 -1
  15. package/dist/cli/commands/create.js +0 -22
  16. package/dist/cli/commands/create.js.map +0 -1
  17. package/dist/cli/commands/sync.d.ts +0 -14
  18. package/dist/cli/commands/sync.d.ts.map +0 -1
  19. package/dist/cli/commands/sync.js +0 -18
  20. package/dist/cli/commands/sync.js.map +0 -1
  21. package/dist/cli/index.d.ts +0 -27
  22. package/dist/cli/index.d.ts.map +0 -1
  23. package/dist/cli/index.js +0 -44
  24. package/dist/cli/index.js.map +0 -1
  25. package/dist/features/web-component-artifact/adapters/outbound/node/createNodeWebComponentArtifactFileSystem.d.ts +0 -4
  26. package/dist/features/web-component-artifact/adapters/outbound/node/createNodeWebComponentArtifactFileSystem.d.ts.map +0 -1
  27. package/dist/features/web-component-artifact/adapters/outbound/node/createNodeWebComponentArtifactFileSystem.js +0 -88
  28. package/dist/features/web-component-artifact/adapters/outbound/node/createNodeWebComponentArtifactFileSystem.js.map +0 -1
  29. package/dist/features/web-component-artifact/adapters/outbound/node/readWebDesiredStateWithNodeAsync.d.ts +0 -5
  30. package/dist/features/web-component-artifact/adapters/outbound/node/readWebDesiredStateWithNodeAsync.d.ts.map +0 -1
  31. package/dist/features/web-component-artifact/adapters/outbound/node/readWebDesiredStateWithNodeAsync.js +0 -24
  32. package/dist/features/web-component-artifact/adapters/outbound/node/readWebDesiredStateWithNodeAsync.js.map +0 -1
  33. package/dist/features/web-component-artifact/application/ports/outbound/WebComponentArtifactFileSystemPort.d.ts +0 -10
  34. package/dist/features/web-component-artifact/application/ports/outbound/WebComponentArtifactFileSystemPort.d.ts.map +0 -1
  35. package/dist/features/web-component-artifact/application/ports/outbound/WebComponentArtifactFileSystemPort.js +0 -2
  36. package/dist/features/web-component-artifact/application/ports/outbound/WebComponentArtifactFileSystemPort.js.map +0 -1
  37. package/dist/features/web-component-artifact/application/use-cases/synchronizeWebComponentArtifactsAsync.d.ts +0 -15
  38. package/dist/features/web-component-artifact/application/use-cases/synchronizeWebComponentArtifactsAsync.d.ts.map +0 -1
  39. package/dist/features/web-component-artifact/application/use-cases/synchronizeWebComponentArtifactsAsync.js +0 -76
  40. package/dist/features/web-component-artifact/application/use-cases/synchronizeWebComponentArtifactsAsync.js.map +0 -1
  41. package/dist/features/web-component-artifact/composition/createWebDesiredStateWithNodeAsync.d.ts +0 -6
  42. package/dist/features/web-component-artifact/composition/createWebDesiredStateWithNodeAsync.d.ts.map +0 -1
  43. package/dist/features/web-component-artifact/composition/createWebDesiredStateWithNodeAsync.js +0 -61
  44. package/dist/features/web-component-artifact/composition/createWebDesiredStateWithNodeAsync.js.map +0 -1
  45. package/dist/features/web-component-artifact/composition/readWebComponentPackageMetadataAsync.d.ts +0 -8
  46. package/dist/features/web-component-artifact/composition/readWebComponentPackageMetadataAsync.d.ts.map +0 -1
  47. package/dist/features/web-component-artifact/composition/readWebComponentPackageMetadataAsync.js +0 -10
  48. package/dist/features/web-component-artifact/composition/readWebComponentPackageMetadataAsync.js.map +0 -1
  49. package/dist/features/web-component-artifact/composition/synchronizeDeclaredWebComponentsWithNodeAsync.d.ts +0 -3
  50. package/dist/features/web-component-artifact/composition/synchronizeDeclaredWebComponentsWithNodeAsync.d.ts.map +0 -1
  51. package/dist/features/web-component-artifact/composition/synchronizeDeclaredWebComponentsWithNodeAsync.js +0 -16
  52. package/dist/features/web-component-artifact/composition/synchronizeDeclaredWebComponentsWithNodeAsync.js.map +0 -1
  53. package/dist/features/web-component-artifact/composition/synchronizeWebComponentArtifactsWithNodeAsync.d.ts +0 -4
  54. package/dist/features/web-component-artifact/composition/synchronizeWebComponentArtifactsWithNodeAsync.d.ts.map +0 -1
  55. package/dist/features/web-component-artifact/composition/synchronizeWebComponentArtifactsWithNodeAsync.js +0 -7
  56. package/dist/features/web-component-artifact/composition/synchronizeWebComponentArtifactsWithNodeAsync.js.map +0 -1
  57. package/src/cli/commands/create.ts +0 -37
  58. package/src/cli/commands/sync.ts +0 -35
  59. package/src/cli/index.test.ts +0 -35
  60. package/src/cli/index.ts +0 -57
  61. package/src/features/web-component-artifact/adapters/outbound/node/createNodeWebComponentArtifactFileSystem.ts +0 -109
  62. package/src/features/web-component-artifact/adapters/outbound/node/readWebDesiredStateWithNodeAsync.ts +0 -29
  63. package/src/features/web-component-artifact/application/ports/outbound/WebComponentArtifactFileSystemPort.ts +0 -9
  64. package/src/features/web-component-artifact/application/use-cases/synchronizeWebComponentArtifactsAsync.test.ts +0 -128
  65. package/src/features/web-component-artifact/application/use-cases/synchronizeWebComponentArtifactsAsync.ts +0 -133
  66. package/src/features/web-component-artifact/composition/createWebDesiredStateWithNodeAsync.ts +0 -60
  67. package/src/features/web-component-artifact/composition/readWebComponentPackageMetadataAsync.ts +0 -18
  68. package/src/features/web-component-artifact/composition/synchronizeDeclaredWebComponentsWithNodeAsync.ts +0 -17
  69. package/src/features/web-component-artifact/composition/synchronizeWebComponentArtifactsWithNodeAsync.ts +0 -16
  70. package/src/webArtifactRuntime.test.ts +0 -14
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/zora",
3
3
  "type": "module",
4
- "version": "26.1.5",
4
+ "version": "27.0.0",
5
5
  "description": "Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.",
6
6
  "homepage": "https://github.com/ankhorage/zora#readme",
7
7
  "bugs": {
@@ -41,14 +41,13 @@
41
41
  "react-native-worklets": "0.10.1"
42
42
  },
43
43
  "dependencies": {
44
- "@ankhorage/ankh": "^0.13.3",
45
44
  "@ankhorage/capability": "^0.2.2",
46
45
  "@ankhorage/color-theory": "^0.3.2",
47
46
  "@ankhorage/contracts": "^26.7.0",
48
47
  "@ankhorage/game": "^0.1.3",
49
48
  "@ankhorage/grid-view": "^0.5.0",
50
49
  "@ankhorage/reader": "^0.1.2",
51
- "@ankhorage/runtime": "^5.3.3",
50
+ "@ankhorage/runtime": "^5.3.4",
52
51
  "@ankhorage/surface": "^9.4.18",
53
52
  "@ankhorage/utility": "^1.10.0",
54
53
  "expo-document-picker": "~57.0.3",
@@ -129,12 +128,7 @@
129
128
  "import": "./web-dist/components/*/index.js",
130
129
  "default": "./web-dist/components/*/index.js"
131
130
  },
132
- "./package.json": "./package.json",
133
- "./cli": {
134
- "types": "./dist/cli/index.d.ts",
135
- "import": "./dist/cli/index.js",
136
- "default": "./dist/cli/index.js"
137
- }
131
+ "./package.json": "./package.json"
138
132
  },
139
133
  "publishConfig": {
140
134
  "access": "public"
@@ -154,6 +148,7 @@
154
148
  "format:check": "ankhorage-prettier --check .",
155
149
  "prepack": "bun run build",
156
150
  "test": "bun run build && bun test src examples/grid-workspaces/time examples/grid-workspaces/plugins --isolate",
151
+ "test:packed-web-consumer": "bun scripts/verify-packed-web-consumer.ts",
157
152
  "test:chess:chromium": "bun scripts/test-chess-chromium.ts",
158
153
  "test:graph-view:chromium": "bun scripts/test-graph-view-chromium.ts",
159
154
  "typecheck": "bun x tsc --noEmit -p tsconfig.json && bun x tsc --noEmit -p tsconfig.scripts.json && bun x tsc -p tsconfig.typecheck.json",
@@ -161,7 +156,7 @@
161
156
  },
162
157
  "devDependencies": {
163
158
  "@ankhorage/devtools": "^2.3.47",
164
- "@ankhorage/paradox": "^0.3.6",
159
+ "@ankhorage/paradox": "^0.3.7",
165
160
  "@react-native-vector-icons/fontawesome": "^14.0.0",
166
161
  "@react-native-vector-icons/fontawesome5": "^14.0.0",
167
162
  "@react-native-vector-icons/fontawesome6": "^14.0.0",
@@ -189,100 +184,7 @@
189
184
  "packageManager": "bun@1.4.2",
190
185
  "ankh": {
191
186
  "category": "zora",
192
- "provider": "./dist/cli/index.js",
193
187
  "capabilities": [
194
- {
195
- "id": "zora.create",
196
- "owner": "@ankhorage/zora",
197
- "access": [
198
- "invoke"
199
- ],
200
- "binding": {
201
- "kind": "action",
202
- "bindableAs": [
203
- "target"
204
- ]
205
- },
206
- "label": "Materialize ZORA web component",
207
- "description": "Materialize a declared ZORA component and reconcile its web runtime.",
208
- "input": {
209
- "schema": {
210
- "type": "object",
211
- "required": [
212
- "component",
213
- "platform"
214
- ],
215
- "properties": {
216
- "component": {
217
- "type": "string"
218
- },
219
- "platform": {
220
- "type": "string",
221
- "const": "web"
222
- }
223
- },
224
- "additionalProperties": false
225
- }
226
- },
227
- "output": {
228
- "schema": {
229
- "type": "object",
230
- "required": [
231
- "exitCode"
232
- ],
233
- "properties": {
234
- "exitCode": {
235
- "type": "integer"
236
- }
237
- },
238
- "additionalProperties": false
239
- }
240
- }
241
- },
242
- {
243
- "id": "zora.sync",
244
- "owner": "@ankhorage/zora",
245
- "access": [
246
- "invoke"
247
- ],
248
- "binding": {
249
- "kind": "action",
250
- "bindableAs": [
251
- "target"
252
- ]
253
- },
254
- "label": "Synchronize ZORA web components",
255
- "description": "Reconcile the web runtime from the declared ZORA component set.",
256
- "input": {
257
- "schema": {
258
- "type": "object",
259
- "required": [
260
- "platform"
261
- ],
262
- "properties": {
263
- "platform": {
264
- "type": "string",
265
- "const": "web"
266
- }
267
- },
268
- "additionalProperties": false
269
- }
270
- },
271
- "output": {
272
- "schema": {
273
- "type": "object",
274
- "required": [
275
- "exitCode"
276
- ],
277
- "properties": {
278
- "exitCode": {
279
- "type": "integer"
280
- }
281
- },
282
- "additionalProperties": false
283
- }
284
- }
285
- },
286
188
  {
287
189
  "id": "authScreen.modeChange",
288
190
  "owner": "@ankhorage/zora",
@@ -93,13 +93,10 @@ test('exports the catalog from the public capabilities subpath', async () => {
93
93
  expect(capabilities.CAPABILITIES).toEqual(CAPABILITIES);
94
94
  });
95
95
 
96
- test('preserves the executable action semantics of ZORA provider capabilities', () => {
97
- const actions = CAPABILITIES.filter((capability) => capability.access.includes('invoke'));
98
- expect(actions.map((capability) => capability.id)).toEqual(['zora.create', 'zora.sync']);
99
- expect(actions.every((capability) => capability.binding.kind === 'action')).toBe(true);
100
- expect(actions.every((capability) => capability.binding.bindableAs.includes('target'))).toBe(
101
- true,
102
- );
96
+ test('publishes event capabilities without consumer-generation actions', () => {
97
+ expect(CAPABILITIES.every((capability) => capability.access.includes('emit'))).toBe(true);
98
+ expect(CAPABILITIES.some((capability) => capability.id === 'zora.create')).toBe(false);
99
+ expect(CAPABILITIES.some((capability) => capability.id === 'zora.sync')).toBe(false);
103
100
  });
104
101
 
105
102
  test('built public capability entrypoint imports under Node ESM', async () => {
@@ -2,65 +2,4 @@ import type { Capability } from '@ankhorage/contracts/capability';
2
2
 
3
3
  import { createEventCapabilities } from '../features/registry/createEventCapabilities.js';
4
4
 
5
- export const CAPABILITIES = [
6
- {
7
- id: 'zora.create',
8
- owner: '@ankhorage/zora',
9
- access: ['invoke'],
10
- binding: {
11
- kind: 'action',
12
- bindableAs: ['target'],
13
- },
14
- label: 'Materialize ZORA web component',
15
- description: 'Materialize a declared ZORA component and reconcile its web runtime.',
16
- input: {
17
- schema: {
18
- type: 'object',
19
- required: ['component', 'platform'],
20
- properties: {
21
- component: { type: 'string' },
22
- platform: { type: 'string', const: 'web' },
23
- },
24
- additionalProperties: false,
25
- },
26
- },
27
- output: {
28
- schema: {
29
- type: 'object',
30
- required: ['exitCode'],
31
- properties: { exitCode: { type: 'integer' } },
32
- additionalProperties: false,
33
- },
34
- },
35
- },
36
- {
37
- id: 'zora.sync',
38
- owner: '@ankhorage/zora',
39
- access: ['invoke'],
40
- binding: {
41
- kind: 'action',
42
- bindableAs: ['target'],
43
- },
44
- label: 'Synchronize ZORA web components',
45
- description: 'Reconcile the web runtime from the declared ZORA component set.',
46
- input: {
47
- schema: {
48
- type: 'object',
49
- required: ['platform'],
50
- properties: {
51
- platform: { type: 'string', const: 'web' },
52
- },
53
- additionalProperties: false,
54
- },
55
- },
56
- output: {
57
- schema: {
58
- type: 'object',
59
- required: ['exitCode'],
60
- properties: { exitCode: { type: 'integer' } },
61
- additionalProperties: false,
62
- },
63
- },
64
- },
65
- ...createEventCapabilities(),
66
- ] satisfies readonly Capability[];
5
+ export const CAPABILITIES = [...createEventCapabilities()] satisfies readonly Capability[];
@@ -21,7 +21,7 @@ import type { Text as TextComponent } from './features/typography/public';
21
21
 
22
22
  const webDist = join(import.meta.dir, '..', 'web-dist');
23
23
 
24
- test('web materialization exposes the public AppHeader component', async () => {
24
+ test('published web artifacts expose the public AppHeader component', async () => {
25
25
  const manifest = (await Bun.file(join(webDist, 'manifest.json')).json()) as {
26
26
  artifacts: readonly { component: string; exportName: string; files: readonly string[] }[];
27
27
  };
@@ -0,0 +1,20 @@
1
+ import { expect, test } from 'bun:test';
2
+
3
+ /** Verifies the published web package in a fresh consumer installation. */
4
+ test(
5
+ 'installs, SSR-renders, hydrates, and interacts through published web entrypoints',
6
+ () => {
7
+ const subprocess = Bun.spawnSync({
8
+ cmd: [process.execPath, 'scripts/verify-packed-web-consumer.ts', '--skip-build'],
9
+ stderr: 'pipe',
10
+ stdout: 'pipe',
11
+ });
12
+ const output = `${subprocess.stdout.toString()}\n${subprocess.stderr.toString()}`;
13
+
14
+ expect(subprocess.exitCode, output).toBe(0);
15
+ expect(output).toContain(
16
+ 'Packed ZORA web consumer SSR, hydration, and Select interaction passed.',
17
+ );
18
+ },
19
+ { timeout: 120_000 },
20
+ );
@@ -9,7 +9,7 @@ describe('src ownership', () => {
9
9
  .map((entry) => entry.name)
10
10
  .sort();
11
11
 
12
- expect(directories).toEqual(['capabilities', 'cli', 'constants', 'features', 'types']);
12
+ expect(directories).toEqual(['capabilities', 'constants', 'features', 'types']);
13
13
  });
14
14
 
15
15
  test('does not reintroduce technical ownership roots', () => {
@@ -27,6 +27,7 @@ test('publishes SSR-safe ordinary UI through canonical web subpaths', async () =
27
27
  import: './web-dist/components/*/index.js',
28
28
  default: './web-dist/components/*/index.js',
29
29
  });
30
+ expect(packageJson.exports['./cli']).toBeUndefined();
30
31
 
31
32
  const temporaryDirectory = await mkdtemp(join(process.cwd(), '.cache-zora-web-entrypoints-'));
32
33
  try {
@@ -1,14 +0,0 @@
1
- interface ZoraCreateCommandRequest {
2
- readonly argv: readonly string[];
3
- readonly context: {
4
- readonly cwd: string;
5
- writeStderr(text: string): void;
6
- writeStdout(text: string): void;
7
- };
8
- }
9
- /*** Add one web component to project desired state and reconcile its shared runtime. */
10
- export declare function create(request: ZoraCreateCommandRequest): Promise<{
11
- readonly exitCode: number;
12
- }>;
13
- export {};
14
- //# sourceMappingURL=create.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/create.ts"],"names":[],"mappings":"AAIA,UAAU,wBAAwB;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAChC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,CAAC;CACH;AAED,wFAAwF;AACxF,wBAAsB,MAAM,CAC1B,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAoBxC"}
@@ -1,22 +0,0 @@
1
- import { resolve } from 'node:path';
2
- import { createWebDesiredStateWithNodeAsync } from '../../features/web-component-artifact/composition/createWebDesiredStateWithNodeAsync';
3
- /*** Add one web component to project desired state and reconcile its shared runtime. */
4
- export async function create(request) {
5
- try {
6
- const [component, platform] = request.argv;
7
- if (request.argv.length !== 2 || component === undefined || platform !== '--web') {
8
- throw new Error('Usage: ankh zora create <component> --web');
9
- }
10
- const result = await createWebDesiredStateWithNodeAsync({
11
- component,
12
- projectRoot: resolve(request.context.cwd),
13
- });
14
- request.context.writeStdout(`Materialized ZORA ${component} with ${result.components.length} web component(s) at ${result.outputDirectory}\n`);
15
- return { exitCode: 0 };
16
- }
17
- catch (error) {
18
- request.context.writeStderr(`ZORA create failed: ${error instanceof Error ? error.message : String(error)}\n`);
19
- return { exitCode: 1 };
20
- }
21
- }
22
- //# sourceMappingURL=create.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/cli/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kCAAkC,EAAE,MAAM,sFAAsF,CAAC;AAW1I,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,OAAiC;IAEjC,IAAI,CAAC;QACH,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;QAC3C,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,KAAK,SAAS,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACjF,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,kCAAkC,CAAC;YACtD,SAAS;YACT,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;SAC1C,CAAC,CAAC;QACH,OAAO,CAAC,OAAO,CAAC,WAAW,CACzB,qBAAqB,SAAS,SAAS,MAAM,CAAC,UAAU,CAAC,MAAM,wBAAwB,MAAM,CAAC,eAAe,IAAI,CAClH,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,OAAO,CAAC,WAAW,CACzB,uBAAuB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAClF,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACzB,CAAC;AACH,CAAC","sourcesContent":["import { resolve } from 'node:path';\n\nimport { createWebDesiredStateWithNodeAsync } from '../../features/web-component-artifact/composition/createWebDesiredStateWithNodeAsync';\n\ninterface ZoraCreateCommandRequest {\n readonly argv: readonly string[];\n readonly context: {\n readonly cwd: string;\n writeStderr(text: string): void;\n writeStdout(text: string): void;\n };\n}\n\n/*** Add one web component to project desired state and reconcile its shared runtime. */\nexport async function create(\n request: ZoraCreateCommandRequest,\n): Promise<{ readonly exitCode: number }> {\n try {\n const [component, platform] = request.argv;\n if (request.argv.length !== 2 || component === undefined || platform !== '--web') {\n throw new Error('Usage: ankh zora create <component> --web');\n }\n const result = await createWebDesiredStateWithNodeAsync({\n component,\n projectRoot: resolve(request.context.cwd),\n });\n request.context.writeStdout(\n `Materialized ZORA ${component} with ${result.components.length} web component(s) at ${result.outputDirectory}\\n`,\n );\n return { exitCode: 0 };\n } catch (error) {\n request.context.writeStderr(\n `ZORA create failed: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n return { exitCode: 1 };\n }\n}\n"]}
@@ -1,14 +0,0 @@
1
- interface ZoraSyncCommandRequest {
2
- readonly argv: readonly string[];
3
- readonly context: {
4
- readonly cwd: string;
5
- writeStderr(text: string): void;
6
- writeStdout(text: string): void;
7
- };
8
- }
9
- /*** Reconcile the declared web component set from the installed ZORA provider. */
10
- export declare function sync(request: ZoraSyncCommandRequest): Promise<{
11
- readonly exitCode: number;
12
- }>;
13
- export {};
14
- //# sourceMappingURL=sync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/sync.ts"],"names":[],"mappings":"AAIA,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAChC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,CAAC;CACH;AAED,kFAAkF;AAClF,wBAAsB,IAAI,CACxB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBxC"}
@@ -1,18 +0,0 @@
1
- import { resolve } from 'node:path';
2
- import { synchronizeDeclaredWebComponentsWithNodeAsync } from '../../features/web-component-artifact/composition/synchronizeDeclaredWebComponentsWithNodeAsync';
3
- /*** Reconcile the declared web component set from the installed ZORA provider. */
4
- export async function sync(request) {
5
- try {
6
- if (request.argv.length !== 1 || request.argv[0] !== '--web') {
7
- throw new Error('Usage: ankh zora sync --web');
8
- }
9
- const result = await synchronizeDeclaredWebComponentsWithNodeAsync(resolve(request.context.cwd));
10
- request.context.writeStdout(`Synchronized ${result.components.length} ZORA web component(s) at ${result.outputDirectory}\n`);
11
- return { exitCode: 0 };
12
- }
13
- catch (error) {
14
- request.context.writeStderr(`ZORA sync failed: ${error instanceof Error ? error.message : String(error)}\n`);
15
- return { exitCode: 1 };
16
- }
17
- }
18
- //# sourceMappingURL=sync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/cli/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,6CAA6C,EAAE,MAAM,iGAAiG,CAAC;AAWhK,kFAAkF;AAClF,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,OAA+B;IAE/B,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;YAC7D,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,6CAA6C,CAChE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAC7B,CAAC;QACF,OAAO,CAAC,OAAO,CAAC,WAAW,CACzB,gBAAgB,MAAM,CAAC,UAAU,CAAC,MAAM,6BAA6B,MAAM,CAAC,eAAe,IAAI,CAChG,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,OAAO,CAAC,WAAW,CACzB,qBAAqB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAChF,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACzB,CAAC;AACH,CAAC","sourcesContent":["import { resolve } from 'node:path';\n\nimport { synchronizeDeclaredWebComponentsWithNodeAsync } from '../../features/web-component-artifact/composition/synchronizeDeclaredWebComponentsWithNodeAsync';\n\ninterface ZoraSyncCommandRequest {\n readonly argv: readonly string[];\n readonly context: {\n readonly cwd: string;\n writeStderr(text: string): void;\n writeStdout(text: string): void;\n };\n}\n\n/*** Reconcile the declared web component set from the installed ZORA provider. */\nexport async function sync(\n request: ZoraSyncCommandRequest,\n): Promise<{ readonly exitCode: number }> {\n try {\n if (request.argv.length !== 1 || request.argv[0] !== '--web') {\n throw new Error('Usage: ankh zora sync --web');\n }\n const result = await synchronizeDeclaredWebComponentsWithNodeAsync(\n resolve(request.context.cwd),\n );\n request.context.writeStdout(\n `Synchronized ${result.components.length} ZORA web component(s) at ${result.outputDirectory}\\n`,\n );\n return { exitCode: 0 };\n } catch (error) {\n request.context.writeStderr(\n `ZORA sync failed: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n return { exitCode: 1 };\n }\n}\n"]}
@@ -1,27 +0,0 @@
1
- import type { Capability } from '@ankhorage/contracts/capability';
2
- import { create } from './commands/create';
3
- import { sync } from './commands/sync';
4
- declare const provider: {
5
- id: string;
6
- category: string;
7
- version: string;
8
- capabilities: Capability[];
9
- commands: ({
10
- readonly path: readonly ["create"];
11
- readonly capability: "zora.create";
12
- readonly summary: "Materialize a canonical ZORA component for a target platform.";
13
- } | {
14
- readonly path: readonly ["sync"];
15
- readonly capability: "zora.sync";
16
- readonly summary: "Regenerate the declared ZORA web materialization.";
17
- })[];
18
- handlers: ({
19
- path: readonly ["create"];
20
- handler: typeof create;
21
- } | {
22
- path: readonly ["sync"];
23
- handler: typeof sync;
24
- })[];
25
- };
26
- export default provider;
27
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAGlE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAgBvC,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;CAgBwB,CAAC;AAEvC,eAAe,QAAQ,CAAC"}
package/dist/cli/index.js DELETED
@@ -1,44 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { dirname, resolve } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- import { CAPABILITIES } from '../capabilities';
5
- import { create } from './commands/create';
6
- import { sync } from './commands/sync';
7
- const CREATE_COMMAND = {
8
- path: ['create'],
9
- capability: 'zora.create',
10
- summary: 'Materialize a canonical ZORA component for a target platform.',
11
- };
12
- const SYNC_COMMAND = {
13
- path: ['sync'],
14
- capability: 'zora.sync',
15
- summary: 'Regenerate the declared ZORA web materialization.',
16
- };
17
- const COMMAND_CAPABILITIES = CAPABILITIES.filter((capability) => capability.access.includes('invoke'));
18
- const provider = {
19
- id: '@ankhorage/zora',
20
- category: 'zora',
21
- version: readPackageVersion(),
22
- capabilities: COMMAND_CAPABILITIES,
23
- commands: [CREATE_COMMAND, SYNC_COMMAND],
24
- handlers: [
25
- {
26
- path: CREATE_COMMAND.path,
27
- handler: create,
28
- },
29
- {
30
- path: SYNC_COMMAND.path,
31
- handler: sync,
32
- },
33
- ],
34
- };
35
- export default provider;
36
- /*** Read the installed ZORA version for the Ankh provider manifest. */
37
- function readPackageVersion() {
38
- const packageJson = JSON.parse(readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json'), 'utf8'));
39
- if (typeof packageJson.version !== 'string' || packageJson.version.trim() === '') {
40
- throw new Error('ZORA package.json must define a non-empty version.');
41
- }
42
- return packageJson.version;
43
- }
44
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,MAAM,cAAc,GAAG;IACrB,IAAI,EAAE,CAAC,Q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';\nimport { fileURLToPath } from 'node:url';\n\nimport type { AnkhRuntimeCommandProvider } from '@ankhorage/ankh';\nimport type { Capability } from '@ankhorage/contracts/capability';\n\nimport { CAPABILITIES } from '../capabilities';\nimport { create } from './commands/create';\nimport { sync } from './commands/sync';\n\nconst CREATE_COMMAND = {\n path: ['create'],\n capability: 'zora.create' satisfies Capability['id'],\n summary: 'Materialize a canonical ZORA component for a target platform.',\n} as const;\nconst SYNC_COMMAND = {\n path: ['sync'],\n capability: 'zora.sync' satisfies Capability['id'],\n summary: 'Regenerate the declared ZORA web materialization.',\n} as const;\nconst COMMAND_CAPABILITIES = CAPABILITIES.filter((capability) =>\n capability.access.includes('invoke'),\n);\n\nconst provider = {\n id: '@ankhorage/zora',\n category: 'zora',\n version: readPackageVersion(),\n capabilities: COMMAND_CAPABILITIES,\n commands: [CREATE_COMMAND, SYNC_COMMAND],\n handlers: [\n {\n path: CREATE_COMMAND.path,\n handler: create,\n },\n {\n path: SYNC_COMMAND.path,\n handler: sync,\n },\n ],\n} satisfies AnkhRuntimeCommandProvider;\n\nexport default provider;\n\n/*** Read the installed ZORA version for the Ankh provider manifest. */\nfunction readPackageVersion(): string {\n const packageJson = JSON.parse(\n readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json'), 'utf8'),\n ) as { readonly version?: unknown };\n\n if (typeof packageJson.version !== 'string' || packageJson.version.trim() === '') {\n throw new Error('ZORA package.json must define a non-empty version.');\n }\n\n return packageJson.version;\n}\n"]}
@@ -1,4 +0,0 @@
1
- import type { WebComponentArtifactFileSystemPort } from '../../../application/ports/outbound/WebComponentArtifactFileSystemPort';
2
- /*** Create the Node filesystem adapter used by ZORA web-component materialization. */
3
- export declare function createNodeWebComponentArtifactFileSystem(platform?: NodeJS.Platform): WebComponentArtifactFileSystemPort;
4
- //# sourceMappingURL=createNodeWebComponentArtifactFileSystem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createNodeWebComponentArtifactFileSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/features/web-component-artifact/adapters/outbound/node/createNodeWebComponentArtifactFileSystem.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,wEAAwE,CAAC;AAEjI,sFAAsF;AACtF,wBAAgB,wCAAwC,CACtD,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,kCAAkC,CA4DpC"}
@@ -1,88 +0,0 @@
1
- import { randomUUID } from 'node:crypto';
2
- import { mkdir, mkdtemp, readFile, readlink, realpath, rename, rm, symlink, writeFile, } from 'node:fs/promises';
3
- import { basename, dirname, join } from 'node:path';
4
- /*** Create the Node filesystem adapter used by ZORA web-component materialization. */
5
- export function createNodeWebComponentArtifactFileSystem(platform = process.platform) {
6
- return {
7
- joinPath(...parts) {
8
- return join(...parts);
9
- },
10
- async createStageDirectoryAsync(outputDirectory) {
11
- const parent = dirname(outputDirectory);
12
- await mkdir(parent, { recursive: true });
13
- return await mkdtemp(join(parent, '.web-gen-'));
14
- },
15
- async commitStageDirectoryAsync(stageDirectory, outputDirectory) {
16
- const parent = dirname(outputDirectory);
17
- const previous = await readlink(outputDirectory).catch((error) => {
18
- if (isMissingFile(error))
19
- return undefined;
20
- throw error;
21
- });
22
- const previousDirectory = previous === undefined ? undefined : await realpath(outputDirectory);
23
- if (previousDirectory !== undefined &&
24
- (dirname(previousDirectory) !== (await realpath(parent)) ||
25
- !isGeneratedDirectoryName(basename(previousDirectory)))) {
26
- throw new Error(`Refusing to replace non-ZORA materialization: ${outputDirectory}`);
27
- }
28
- const temporaryLink = join(parent, `.web-link-${randomUUID()}`);
29
- try {
30
- await symlink(platform === 'win32' ? stageDirectory : basename(stageDirectory), temporaryLink, platform === 'win32' ? 'junction' : 'dir');
31
- if (platform === 'win32' && previousDirectory !== undefined) {
32
- await replaceWindowsJunctionAsync(temporaryLink, outputDirectory);
33
- }
34
- else {
35
- await rename(temporaryLink, outputDirectory);
36
- }
37
- }
38
- finally {
39
- await rm(temporaryLink, { force: true });
40
- }
41
- if (previousDirectory !== undefined &&
42
- previousDirectory !== (await realpath(stageDirectory))) {
43
- await rm(previousDirectory, { force: true, recursive: true }).catch(() => undefined);
44
- }
45
- },
46
- async removeStageDirectoryAsync(stageDirectory) {
47
- await rm(stageDirectory, { force: true, recursive: true });
48
- },
49
- async ensureDirectoryAsync(path) {
50
- await mkdir(path, { recursive: true });
51
- },
52
- async readTextFileAsync(path) {
53
- return await readFile(path, 'utf8');
54
- },
55
- async writeTextFileAsync(path, content) {
56
- await writeFile(path, content, 'utf8');
57
- },
58
- };
59
- }
60
- /*** Swap Windows junctions with rollback because rename cannot replace an occupied destination. */
61
- async function replaceWindowsJunctionAsync(temporaryLink, outputDirectory) {
62
- const previousLink = join(dirname(outputDirectory), `.web-link-${randomUUID()}`);
63
- await rename(outputDirectory, previousLink);
64
- try {
65
- await rename(temporaryLink, outputDirectory);
66
- }
67
- catch (error) {
68
- try {
69
- await rename(previousLink, outputDirectory);
70
- }
71
- catch (rollbackError) {
72
- throw new AggregateError([error, rollbackError], 'ZORA web swap and rollback failed.', {
73
- cause: rollbackError,
74
- });
75
- }
76
- throw error;
77
- }
78
- await rm(previousLink, { force: true });
79
- }
80
- /*** Recognize only the private generation directories written by this adapter. */
81
- function isGeneratedDirectoryName(value) {
82
- return /^\.web-gen-[A-Za-z0-9]+$/u.test(value);
83
- }
84
- /*** Distinguish a missing first-generation link from other filesystem errors. */
85
- function isMissingFile(error) {
86
- return error instanceof Error && 'code' in error && error.code === 'ENOENT';
87
- }
88
- //# sourceMappingURL=createNodeWebComponentArtifactFileSystem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createNodeWebComponentArtifactFileSystem.js","sourceRoot":"","sources":["../../../../../../src/features/web-component-artifact/adapters/outbound/node/createNodeWebComponentArtifactFileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,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AAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9E,CAAC","sourcesContent":["import { randomUUID } from 'node:crypto';\nimport {\n mkdir,\n mkdtemp,\n readFile,\n readlink,\n realpath,\n rename,\n rm,\n symlink,\n writeFile,\n} from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\n\nimport type { WebComponentArtifactFileSystemPort } from '../../../application/ports/outbound/WebComponentArtifactFileSystemPort';\n\n/*** Create the Node filesystem adapter used by ZORA web-component materialization. */\nexport function createNodeWebComponentArtifactFileSystem(\n platform: NodeJS.Platform = process.platform,\n): WebComponentArtifactFileSystemPort {\n return {\n joinPath(...parts) {\n return join(...parts);\n },\n async createStageDirectoryAsync(outputDirectory) {\n const parent = dirname(outputDirectory);\n await mkdir(parent, { recursive: true });\n return await mkdtemp(join(parent, '.web-gen-'));\n },\n async commitStageDirectoryAsync(stageDirectory, outputDirectory) {\n const parent = dirname(outputDirectory);\n const previous = await readlink(outputDirectory).catch((error: unknown) => {\n if (isMissingFile(error)) return undefined;\n throw error;\n });\n const previousDirectory =\n previous === undefined ? undefined : await realpath(outputDirectory);\n if (\n previousDirectory !== undefined &&\n (dirname(previousDirectory) !== (await realpath(parent)) ||\n !isGeneratedDirectoryName(basename(previousDirectory)))\n ) {\n throw new Error(`Refusing to replace non-ZORA materialization: ${outputDirectory}`);\n }\n const temporaryLink = join(parent, `.web-link-${randomUUID()}`);\n try {\n await symlink(\n platform === 'win32' ? stageDirectory : basename(stageDirectory),\n temporaryLink,\n platform === 'win32' ? 'junction' : 'dir',\n );\n if (platform === 'win32' && previousDirectory !== undefined) {\n await replaceWindowsJunctionAsync(temporaryLink, outputDirectory);\n } else {\n await rename(temporaryLink, outputDirectory);\n }\n } finally {\n await rm(temporaryLink, { force: true });\n }\n if (\n previousDirectory !== undefined &&\n previousDirectory !== (await realpath(stageDirectory))\n ) {\n await rm(previousDirectory, { force: true, recursive: true }).catch(() => undefined);\n }\n },\n async removeStageDirectoryAsync(stageDirectory) {\n await rm(stageDirectory, { force: true, recursive: true });\n },\n async ensureDirectoryAsync(path) {\n await mkdir(path, { recursive: true });\n },\n async readTextFileAsync(path) {\n return await readFile(path, 'utf8');\n },\n async writeTextFileAsync(path, content) {\n await writeFile(path, content, 'utf8');\n },\n };\n}\n\n/*** Swap Windows junctions with rollback because rename cannot replace an occupied destination. */\nasync function replaceWindowsJunctionAsync(temporaryLink: string, outputDirectory: string) {\n const previousLink = join(dirname(outputDirectory), `.web-link-${randomUUID()}`);\n await rename(outputDirectory, previousLink);\n try {\n await rename(temporaryLink, outputDirectory);\n } catch (error) {\n try {\n await rename(previousLink, outputDirectory);\n } catch (rollbackError) {\n throw new AggregateError([error, rollbackError], 'ZORA web swap and rollback failed.', {\n cause: rollbackError,\n });\n }\n throw error;\n }\n await rm(previousLink, { force: true });\n}\n\n/*** Recognize only the private generation directories written by this adapter. */\nfunction isGeneratedDirectoryName(value: string): boolean {\n return /^\\.web-gen-[A-Za-z0-9]+$/u.test(value);\n}\n\n/*** Distinguish a missing first-generation link from other filesystem errors. */\nfunction isMissingFile(error: unknown): boolean {\n return error instanceof Error && 'code' in error && error.code === 'ENOENT';\n}\n"]}
@@ -1,5 +0,0 @@
1
- /*** Read the version-controlled desired component set outside generated output. */
2
- export declare function readWebDesiredStateWithNodeAsync(projectRoot: string, allowMissing: boolean): Promise<{
3
- readonly components: readonly string[];
4
- }>;
5
- //# sourceMappingURL=readWebDesiredStateWithNodeAsync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readWebDesiredStateWithNodeAsync.d.ts","sourceRoot":"","sources":["../../../../../../src/features/web-component-artifact/adapters/outbound/node/readWebDesiredStateWithNodeAsync.ts"],"names":[],"mappings":"AAKA,mFAAmF;AACnF,wBAAsB,gCAAgC,CACpD,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,GACpB,OAAO,CAAC;IAAE,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC,CAmBrD"}
@@ -1,24 +0,0 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { resolve } from 'node:path';
3
- import { isRecord } from '@ankhorage/utility/object';
4
- /*** Read the version-controlled desired component set outside generated output. */
5
- export async function readWebDesiredStateWithNodeAsync(projectRoot, allowMissing) {
6
- const path = resolve(projectRoot, 'zora.web.json');
7
- const source = await readFile(path, 'utf8').catch((error) => {
8
- if (allowMissing && error instanceof Error && 'code' in error && error.code === 'ENOENT') {
9
- return undefined;
10
- }
11
- throw error;
12
- });
13
- if (source === undefined)
14
- return { components: [] };
15
- const parsed = JSON.parse(source);
16
- if (!isRecord(parsed) ||
17
- parsed.schemaVersion !== 1 ||
18
- !Array.isArray(parsed.components) ||
19
- !parsed.components.every((component) => typeof component === 'string')) {
20
- throw new Error(`Invalid ZORA web desired state: ${path}`);
21
- }
22
- return { components: parsed.components };
23
- }
24
- //# sourceMappingURL=readWebDesiredStateWithNodeAsync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readWebDesiredStateWithNodeAsync.js","sourceRoot":"","sources":["../../../../../../src/features/web-component-artifact/adapters/outbound/node/readWebDesiredStateWithNodeAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,mFAAmF;AACnF,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,WAAmB,EACnB,YAAqB;IAErB,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACnE,IAAI,YAAY,IAAI,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACzF,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IACpD,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3C,IACE,CAAC,QAAQ,CAAC,MAAM,CAAC;QACjB,MAAM,CAAC,aAAa,KAAK,CAAC;QAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;QACjC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,SAAS,KAAK,QAAQ,CAAC,EACtE,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\n\nimport { isRecord } from '@ankhorage/utility/object';\n\n/*** Read the version-controlled desired component set outside generated output. */\nexport async function readWebDesiredStateWithNodeAsync(\n projectRoot: string,\n allowMissing: boolean,\n): Promise<{ readonly components: readonly string[] }> {\n const path = resolve(projectRoot, 'zora.web.json');\n const source = await readFile(path, 'utf8').catch((error: unknown) => {\n if (allowMissing && error instanceof Error && 'code' in error && error.code === 'ENOENT') {\n return undefined;\n }\n throw error;\n });\n if (source === undefined) return { components: [] };\n const parsed: unknown = JSON.parse(source);\n if (\n !isRecord(parsed) ||\n parsed.schemaVersion !== 1 ||\n !Array.isArray(parsed.components) ||\n !parsed.components.every((component) => typeof component === 'string')\n ) {\n throw new Error(`Invalid ZORA web desired state: ${path}`);\n }\n return { components: parsed.components };\n}\n"]}