@vyriy/create 0.5.2 → 0.5.3

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/preset/library.js CHANGED
@@ -1,11 +1,120 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { dirname, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
1
4
  import packageJson from '../package.json' with { type: 'json' };
2
- import { base } from './base.js';
3
- import { stylelintConfigFile } from './shared.js';
5
+ const presetDir = dirname(fileURLToPath(import.meta.url));
6
+ const agentsPath = [
7
+ resolve(presetDir, '../../../AGENTS.md'),
8
+ resolve(presetDir, '../../../../AGENTS.md'),
9
+ ].find(existsSync) ?? '';
10
+ const agentsContent = agentsPath ? readFileSync(agentsPath, 'utf8') : '';
4
11
  export const library = (options) => {
5
12
  const packageScope = options.scope ?? `@${options.name}`;
6
13
  const packageName = `${packageScope}/${options.name}`;
7
14
  return {
8
- ...base(options),
15
+ 'README.md': `# ${options.name}\n\n${options.description}\n`,
16
+ 'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
17
+ import ReadMe from './README.md?raw';
18
+
19
+ <Meta title="${options.name}" />
20
+
21
+ <Markdown>{ReadMe}</Markdown>
22
+ `,
23
+ 'AGENTS.md': agentsContent,
24
+ '.editorconfig': `# https://editorconfig.org
25
+ root = true
26
+
27
+ [*]
28
+ charset = utf-8
29
+ end_of_line = lf
30
+ insert_final_newline = true
31
+ trim_trailing_whitespace = true
32
+
33
+ indent_style = space
34
+ indent_size = 2
35
+
36
+ max_line_length = 100
37
+
38
+ # Markdown
39
+ [*.md]
40
+ trim_trailing_whitespace = false
41
+ max_line_length = off
42
+
43
+ # YAML / YML
44
+ [*.{yml,yaml}]
45
+ indent_size = 2
46
+
47
+ # JSON
48
+ [*.json]
49
+ indent_size = 2
50
+
51
+ # TypeScript / JavaScript
52
+ [*.{ts,tsx,js,jsx}]
53
+ indent_size = 2
54
+
55
+ # Shell / Bash
56
+ [*.sh]
57
+ indent_size = 2
58
+ `,
59
+ '.gitignore': `.yarn/*
60
+ !.yarn/cache
61
+ !.yarn/patches
62
+ !.yarn/plugins
63
+ !.yarn/releases
64
+ !.yarn/sdks
65
+ !.yarn/versions
66
+
67
+ .DS_Store
68
+ .idea
69
+ node_modules
70
+ coverage
71
+ dist
72
+ storybook-static
73
+ *storybook.log
74
+ consumer
75
+
76
+ cdk.out
77
+ cdk.context.json
78
+
79
+ !/**/.gitkeep
80
+ `,
81
+ '.npmrc': 'engine-strict=true\n',
82
+ '.nvmrc': 'lts/krypton\n',
83
+ '.yarnrc.yml': 'nodeLinker: node-modules\nnpmMinimalAgeGate: 0\n',
84
+ '.husky/commit-msg': '#!/bin/sh\n',
85
+ '.husky/post-checkout': '#!/bin/sh\n\nyarn\n',
86
+ '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
87
+ '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
88
+ '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
89
+ '.storybook/main.ts': `import config from '@vyriy/storybook-config';
90
+ import { path } from '@vyriy/path';
91
+
92
+ export default {
93
+ ...config,
94
+ stories: [
95
+ path('**/*.mdx'),
96
+ path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
97
+ ],
98
+ };
99
+ `,
100
+ '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
101
+ 'yarn.lock': '',
102
+ 'tsconfig.json': JSON.stringify({
103
+ extends: '@vyriy/typescript-config/index.json',
104
+ include: [
105
+ '.storybook/**/*.ts',
106
+ '.storybook/**/*.tsx',
107
+ 'packages/**/*.ts',
108
+ 'packages/**/*.tsx',
109
+ 'workspaces/**/*.ts',
110
+ 'workspaces/**/*.tsx',
111
+ '*.ts',
112
+ ],
113
+ }, null, 2) + '\n',
114
+ 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
115
+ '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
116
+ 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
117
+ 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
9
118
  'package.json': JSON.stringify({
10
119
  name: options.name,
11
120
  version: '0.0.0',
@@ -90,7 +199,7 @@ export const library = (options) => {
90
199
  allowImportingTsExtensions: false,
91
200
  },
92
201
  }, null, 2) + '\n',
93
- ...stylelintConfigFile(),
202
+ 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
94
203
  [`packages/${options.name}/package.json`]: JSON.stringify({
95
204
  name: packageName,
96
205
  version: '0.0.0',
package/preset/mfe.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Preset } from './types.js';
1
+ import type { Preset } from './types.js';
2
2
  export declare const mfe: Preset;
package/preset/mfe.js CHANGED
@@ -1,5 +1,13 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { dirname, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
1
4
  import packageJson from '../package.json' with { type: 'json' };
2
- import { base } from './base.js';
5
+ const presetDir = dirname(fileURLToPath(import.meta.url));
6
+ const agentsPath = [
7
+ resolve(presetDir, '../../../AGENTS.md'),
8
+ resolve(presetDir, '../../../../AGENTS.md'),
9
+ ].find(existsSync) ?? '';
10
+ const agentsContent = agentsPath ? readFileSync(agentsPath, 'utf8') : '';
3
11
  const projectFiles = {
4
12
  '.browserslistrc': '[development]\nextends @vyriy/browserslist-config\n\n[ssr]\nextends @vyriy/browserslist-config\n\n[production]\nextends @vyriy/browserslist-config\n\n[modern]\nextends @vyriy/browserslist-config\n',
5
13
  '.storybook/preview.tsx': "import '../packages/components/styles.scss';\n\nexport { default } from '@vyriy/storybook-config/preview';\n",
@@ -17,6 +25,155 @@ const projectFiles = {
17
25
  'packages/api/semantic.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { semantic } from './semantic.js';\n\ndescribe('semantic', () => {\n it('serializes profile-card props as Schema.org JSON-LD', () => {\n expect(\n JSON.parse(\n semantic({\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n title: 'Mathematician',\n }),\n ),\n ).toEqual({\n '@context': 'https://schema.org',\n '@type': 'Person',\n image: 'https://example.com/avatar.png',\n jobTitle: 'Mathematician',\n name: 'Ada Lovelace',\n });\n });\n});\n",
18
26
  'packages/api/semantic.ts': "import type { Semantic } from './types.js';\n\n/** Serializes profile-card props as Schema.org Person JSON-LD. */\nexport const semantic: Semantic = (params) =>\n JSON.stringify({\n '@context': 'https://schema.org',\n '@type': 'Person',\n name: params.name,\n jobTitle: params.title,\n image: params.avatarUrl,\n });\n",
19
27
  'packages/api/types.ts': "import type { ProfileCard } from '@p/components/profile-card/types.js';\n\n/** Builds the standalone HTML demo document. */\nexport type Demo = () => string;\n\n/** Builds server-rendered custom element markup from profile-card props. */\nexport type Prerender = (props: ProfileCard) => string;\n\n/** Builds semantic JSON-LD from profile-card props. */\nexport type Semantic = (props: ProfileCard) => string;\n\n/** Builds the OpenMFE manifest YAML document. */\nexport type Manifest = () => string;\n",
28
+ 'packages/env/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Env\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
29
+ 'packages/env/env.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { getApi, getCdn, getMode, getTag, getUi } from './env.js';\n\ndescribe('env getters', () => {\n afterEach(() => {\n delete process.env.API;\n delete process.env.CDN;\n delete process.env.MODE;\n delete process.env.TAG;\n delete process.env.UI;\n });\n\n it('reads required environment values', () => {\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n expect(getApi()).toBe('http://localhost:3000');\n expect(getCdn()).toBe('http://localhost:3001');\n expect(getMode()).toBe('open');\n expect(getTag()).toBe('vyriy-profile-card');\n expect(getUi()).toBe('http://localhost:3002');\n });\n\n it('throws when a required environment value is missing', () => {\n expect(() => getUi()).toThrow('Environment variable UI is not defined!');\n });\n});\n",
30
+ 'packages/env/env.ts': "import { getEnv } from '@vyriy/env';\n\n/** Reads the configured custom element tag name. */\nexport const getTag = () => getEnv('TAG');\n\n/** Reads the configured shadow DOM mode. */\nexport const getMode = () => getEnv('MODE');\n\n/** Reads the API origin used for server endpoints. */\nexport const getApi = () => getEnv('API');\n\n/** Reads the CDN origin used for static assets. */\nexport const getCdn = () => getEnv('CDN');\n\n/** Reads the UI origin used for browser assets. */\nexport const getUi = () => getEnv('UI');\n",
31
+ 'packages/env/index.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\nconst ENV_NAMES = [\n 'TAG',\n 'MODE',\n 'API',\n 'CDN',\n 'UI',\n] as const;\n\nconst clearEnv = () => {\n for (const name of ENV_NAMES) {\n delete process.env[name];\n }\n};\n\ndescribe('env public API', () => {\n afterEach(() => {\n clearEnv();\n });\n\n it('exports env getters', () => {\n expect(publicApi.getTag).toBeDefined();\n expect(publicApi.getMode).toBeDefined();\n expect(publicApi.getApi).toBeDefined();\n expect(publicApi.getCdn).toBeDefined();\n expect(publicApi.getUi).toBeDefined();\n });\n\n it('reads environment variables by public getter name', () => {\n process.env.TAG = 'vyriy-profile-card';\n process.env.MODE = 'open';\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.UI = 'http://localhost:3002';\n\n expect(publicApi.getTag()).toBe('vyriy-profile-card');\n expect(publicApi.getMode()).toBe('open');\n expect(publicApi.getApi()).toBe('http://localhost:3000');\n expect(publicApi.getCdn()).toBe('http://localhost:3001');\n expect(publicApi.getUi()).toBe('http://localhost:3002');\n });\n\n it('throws when a required environment variable is missing', () => {\n clearEnv();\n\n expect(() => publicApi.getApi()).toThrow('Environment variable API is not defined!');\n });\n});\n",
32
+ 'packages/env/index.ts': "export * from './env.js';\n",
33
+ 'packages/env/package.json': '{\n "name": "@p/env",\n "type": "module",\n "private": true\n}\n',
34
+ 'packages/env/README.md': '# @p/env\n\nRequired environment readers shared by API and UI workspaces.\n\n## Exports\n\n- `getTag()` reads `TAG`.\n- `getMode()` reads `MODE`.\n- `getApi()` reads `API`.\n- `getCdn()` reads `CDN`.\n- `getUi()` reads `UI`.\n\nEach getter throws when its environment variable is missing.\n',
35
+ 'packages/event/constants.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\n\ndescribe('event constants', () => {\n it('matches the manifest event names', () => {\n expect(PROFILE_CARD_ANALYTICS_EVENT_NAME).toBe('openmfe.analytics');\n expect(PROFILE_CARD_SELECT_EVENT_NAME).toBe('vyriy-profile-card.select');\n });\n});\n",
36
+ 'packages/event/constants.ts': "/** Custom event emitted when the profile card is selected. */\nexport const PROFILE_CARD_SELECT_EVENT_NAME = 'vyriy-profile-card.select';\n\n/** Standard OpenMFE analytics event emitted for profile-card interactions. */\nexport const PROFILE_CARD_ANALYTICS_EVENT_NAME = 'openmfe.analytics';\n",
37
+ 'packages/event/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Event\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
38
+ 'packages/event/index.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('event public API', () => {\n it('exports profile card event helpers', () => {\n expect(publicApi.PROFILE_CARD_ANALYTICS_EVENT_NAME).toBe('openmfe.analytics');\n expect(publicApi.PROFILE_CARD_SELECT_EVENT_NAME).toBe('vyriy-profile-card.select');\n expect(publicApi.dispatchProfileCardAnalyticsEvent).toBeDefined();\n expect(publicApi.dispatchProfileCardSelectEvent).toBeDefined();\n });\n});\n",
39
+ 'packages/event/index.ts': "export { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nexport { dispatchProfileCardAnalyticsEvent } from './profile-card-analytics.js';\nexport { dispatchProfileCardSelectEvent } from './profile-card-select.js';\nexport type { ProfileCardAnalyticsData, ProfileCardSelectDetail } from './types.js';\n",
40
+ 'packages/event/profile-card-analytics.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\n\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME } from './constants.js';\nimport { dispatchProfileCardAnalyticsEvent } from './profile-card-analytics.js';\n\ndescribe('dispatchProfileCardAnalyticsEvent', () => {\n it('dispatches the standard OpenMFE analytics event from the custom element', () => {\n const target = document.createElement('vyriy-profile-card');\n const listener = jest.fn();\n\n target.id = 'profile-card-1';\n target.addEventListener(PROFILE_CARD_ANALYTICS_EVENT_NAME, listener);\n\n const event = dispatchProfileCardAnalyticsEvent(target, {\n avatarUrl: null,\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n\n expect(event.type).toBe(PROFILE_CARD_ANALYTICS_EVENT_NAME);\n expect(event.bubbles).toBe(true);\n expect(event.composed).toBe(true);\n expect(event.detail).toEqual({\n action: 'select',\n category: 'profile-card',\n data: {\n avatarUrl: null,\n name: 'Ada Lovelace',\n role: 'Mathematician',\n },\n id: 'profile-card-1',\n name: 'profile_card_select',\n origin: 'vyriy-profile-card',\n variant: null,\n });\n expect(listener).toHaveBeenCalledWith(event);\n });\n});\n",
41
+ 'packages/event/profile-card-analytics.ts': "import { dispatchAnalyticsEvent } from '@vyriy/event';\n\nimport type { ProfileCardAnalyticsData } from './types.js';\n\n/** Dispatches the standard OpenMFE analytics event for a profile-card selection. */\nexport const dispatchProfileCardAnalyticsEvent = (target: HTMLElement, data: ProfileCardAnalyticsData): CustomEvent => {\n return dispatchAnalyticsEvent(\n target,\n {\n action: 'select',\n category: 'profile-card',\n data,\n name: 'profile_card_select',\n },\n {\n bubbles: true,\n composed: true,\n },\n );\n};\n",
42
+ 'packages/event/profile-card-select.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\n\nimport { PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nimport { dispatchProfileCardSelectEvent } from './profile-card-select.js';\n\ndescribe('dispatchProfileCardSelectEvent', () => {\n it('dispatches the profile card select event from the custom element', () => {\n const target = document.createElement('vyriy-profile-card');\n const listener = jest.fn();\n\n target.addEventListener(PROFILE_CARD_SELECT_EVENT_NAME, listener);\n\n const event = dispatchProfileCardSelectEvent(target, {\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n\n expect(event.type).toBe(PROFILE_CARD_SELECT_EVENT_NAME);\n expect(event.bubbles).toBe(true);\n expect(event.composed).toBe(true);\n expect(event.detail).toEqual({\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n expect(listener).toHaveBeenCalledWith(event);\n });\n});\n",
43
+ 'packages/event/profile-card-select.ts': "import { dispatchCustomEvent } from '@vyriy/event';\n\nimport { PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nimport type { ProfileCardSelectDetail } from './types.js';\n\n/** Dispatches the profile-card select custom event from the web component host. */\nexport const dispatchProfileCardSelectEvent = (\n target: HTMLElement,\n detail: ProfileCardSelectDetail,\n): CustomEvent<ProfileCardSelectDetail> => {\n return dispatchCustomEvent(target, PROFILE_CARD_SELECT_EVENT_NAME, detail, {\n bubbles: true,\n composed: true,\n });\n};\n",
44
+ 'packages/event/README.md': "# @p/event\n\nTyped profile-card event helpers.\n\n## Usage\n\n```ts\nimport { dispatchProfileCardAnalyticsEvent, dispatchProfileCardSelectEvent } from '@p/event';\n\nconst target = document.querySelector('vyriy-profile-card');\n\nif (target instanceof HTMLElement) {\n const detail = {\n name: 'Ada Lovelace',\n role: 'Mathematician',\n avatarUrl: '/avatar.svg',\n };\n\n dispatchProfileCardSelectEvent(target, detail);\n dispatchProfileCardAnalyticsEvent(target, detail);\n}\n```\n\n## Events\n\n- `vyriy-profile-card.select` is emitted when the profile card is selected.\n- `openmfe.analytics` is emitted with the standard OpenMFE analytics payload for the same selection.\n",
45
+ 'packages/event/types.ts': '/** Detail payload for the profile-card select custom event. */\nexport type ProfileCardSelectDetail = {\n name: string;\n role?: string;\n avatarUrl?: string | null;\n};\n\n/** Analytics data payload emitted for profile-card selections. */\nexport type ProfileCardAnalyticsData = ProfileCardSelectDetail;\n',
46
+ 'packages/query/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Query\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
47
+ 'packages/query/index.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('query public API', () => {\n it('exports query parsers', () => {\n expect(publicApi.parseProfileCardQuery).toBeDefined();\n });\n});\n",
48
+ 'packages/query/index.ts': "export * from './profile-card.js';\nexport type * from './types.js';\n",
49
+ 'packages/query/package.json': '{\n "name": "@p/query",\n "type": "module",\n "private": true\n}\n',
50
+ 'packages/query/profile-card.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { parseProfileCardQuery } from './profile-card.js';\n\ndescribe('parseProfileCardQuery', () => {\n it('returns undefined when name is missing', () => {\n expect(parseProfileCardQuery(undefined)).toBeUndefined();\n expect(parseProfileCardQuery({})).toBeUndefined();\n expect(parseProfileCardQuery({ name: '' })).toBeUndefined();\n });\n\n it('parses supported profile card fields', () => {\n expect(\n parseProfileCardQuery({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'Profile description',\n name: 'Name',\n tags: 'one, two,, three ',\n title: 'Title',\n }),\n ).toEqual({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'Profile description',\n name: 'Name',\n tags: ['one', 'two', 'three'],\n title: 'Title',\n });\n });\n\n it('omits tags when the query list is empty after trimming', () => {\n expect(\n parseProfileCardQuery({\n name: 'Name',\n tags: ', , ',\n }),\n ).toEqual({\n name: 'Name',\n tags: undefined,\n });\n });\n});\n",
51
+ 'packages/query/profile-card.ts': "import type { ParseProfileCardQuery, Query } from './types.js';\n\nconst getQueryValue = (query: Query, name: string): string | undefined => {\n const value = query?.[name];\n\n return value === '' ? undefined : value;\n};\n\nconst getQueryList = (query: Query, name: string): string[] | undefined => {\n const value = getQueryValue(query, name);\n\n if (!value) {\n return undefined;\n }\n\n const list = value\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean);\n\n return list.length > 0 ? list : undefined;\n};\n\n/** Parses request query parameters into profile-card props. */\nexport const parseProfileCardQuery: ParseProfileCardQuery = (query) => {\n const name = getQueryValue(query, 'name');\n\n if (!name) {\n return undefined;\n }\n\n return {\n name,\n title: getQueryValue(query, 'title'),\n description: getQueryValue(query, 'description'),\n avatarUrl: getQueryValue(query, 'avatarUrl'),\n tags: getQueryList(query, 'tags'),\n };\n};\n",
52
+ 'packages/query/README.md': "# @p/query\n\nQuery-string parsers for profile-card API endpoints.\n\n## Exports\n\n- `parseProfileCardQuery(query)` converts router query parameters into profile-card props.\n\n## Example\n\n```ts\nimport { parseProfileCardQuery } from '@p/query';\n\nconst props = parseProfileCardQuery({\n name: 'Ada Lovelace',\n title: 'Mathematician',\n tags: 'math, computing',\n});\n```\n",
53
+ 'packages/query/types.ts': "import type { ProfileCard } from '@p/components/profile-card/types.js';\n\n/** Query string values provided by the API router. */\nexport type Query = Record<string, string | undefined> | undefined;\n\n/** Converts query string values into profile-card props or rejects incomplete input. */\nexport type ParseProfileCardQuery = (query: Query) => ProfileCard | undefined;\n",
54
+ 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
55
+ 'workspaces/api/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/api";\n\n. "$PWD/workspaces/env.sh"\n\nNODE_ENV=production \\\nnpx webpack --config $scriptdir/webpack.config.ts\n\ncp $scriptdir/package.json dist/api/package.json\nnpm pkg delete "type" --prefix dist/api\nnpm pkg delete "private" --prefix dist/api\n',
56
+ 'workspaces/api/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/api";\n\n. "$PWD/workspaces/env.sh"\n\necho "Demo:\\n$API/\\n"\necho "Prerender:\\n$API/prerender?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3001/avatar.svg\\n"\necho "Semantic:\\n$API/semantic?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3001/avatar.svg\\n"\necho "Manifest:\\n$API/manifest.yml\\n"\n\nNODE_ENV=production \\\nLOG_LEVEL=info \\\nPORT=$API_PORT \\\ntsx watch $scriptdir/index.ts\n',
57
+ 'workspaces/api/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/API\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
58
+ 'workspaces/api/index.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\nimport type { APIGatewayProxyEvent } from '@vyriy/router';\n\nconst apiMock = jest.fn((handler) => ({\n handler,\n}));\nconst serverMock = jest.fn();\n\njest.mock('@vyriy/handler', () => ({\n api: apiMock,\n}));\n\njest.mock('@vyriy/server', () => ({\n server: serverMock,\n}));\n\ndescribe('workspaces/api/index.ts', () => {\n const getEvent = (\n path: string,\n queryStringParameters: APIGatewayProxyEvent['queryStringParameters'] = null,\n ): APIGatewayProxyEvent =>\n ({\n body: null,\n headers: {},\n httpMethod: 'GET',\n path,\n pathParameters: null,\n queryStringParameters,\n }) as APIGatewayProxyEvent;\n\n it('starts the server with the API router handler', async () => {\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.UI = 'http://localhost:3002';\n\n await import('./index.js');\n\n expect(apiMock).toHaveBeenCalledTimes(1);\n expect(serverMock).toHaveBeenCalledTimes(1);\n expect(serverMock).toHaveBeenCalledWith(apiMock.mock.results[0]?.value);\n\n const handler = apiMock.mock.calls[0]?.[0] as (event: APIGatewayProxyEvent) => Promise<{\n body: string;\n headers?: Record<string, string>;\n statusCode: number;\n }>;\n\n await expect(handler(getEvent('/'))).resolves.toEqual({\n body: expect.stringContaining('<vyriy-profile-card'),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/html; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/prerender'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Query parameter \"name\" is required.',\n }),\n headers: undefined,\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 400,\n });\n\n const prerenderResponse = await handler(\n getEvent('/prerender', {\n description: 'Profile description',\n name: 'Name',\n tags: 'one, two',\n title: 'Title',\n }),\n );\n\n expect(prerenderResponse).toEqual({\n body: expect.stringContaining('Name'),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/html; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n expect(prerenderResponse.body).toContain('shadowrootmode=\"open\"');\n expect(prerenderResponse.body).toContain('http://localhost:3002/main.css');\n\n await expect(handler(getEvent('/semantic', { name: 'Name' }))).resolves.toEqual({\n body: JSON.stringify({\n '@context': 'https://schema.org',\n '@type': 'Person',\n name: 'Name',\n }),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'application/ld+json; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/semantic'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Query parameter \"name\" is required.',\n }),\n headers: undefined,\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 400,\n });\n\n await expect(handler(getEvent('/manifest.yml'))).resolves.toEqual({\n body: expect.stringContaining(\"name: 'Vyriy Profile Card'\"),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/yaml; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/healthcheck'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Not Found',\n }),\n statusCode: 404,\n });\n });\n});\n",
59
+ 'workspaces/api/index.ts': "import { server } from '@vyriy/server';\nimport { api } from '@vyriy/handler';\nimport { createRouter } from '@vyriy/router';\nimport { minify } from '@vyriy/html';\n\nimport { demo, manifest, prerender, semantic } from '@p/api';\nimport { parseProfileCardQuery } from '@p/query';\n\nserver(\n api(async (event) =>\n createRouter()\n .get('/', () => ({\n body: minify(demo()),\n headers: {\n 'content-type': 'text/html; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n }))\n .get('/prerender', ({ query }) => {\n const profileCard = parseProfileCardQuery(query);\n\n if (!profileCard) {\n return {\n statusCode: 400,\n body: JSON.stringify({ message: 'Query parameter \"name\" is required.' }),\n };\n }\n\n return {\n body: minify(prerender(profileCard)),\n headers: {\n 'content-type': 'text/html; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n };\n })\n .get('/semantic', ({ query }) => {\n const profileCard = parseProfileCardQuery(query);\n\n if (!profileCard) {\n return {\n statusCode: 400,\n body: JSON.stringify({ message: 'Query parameter \"name\" is required.' }),\n };\n }\n\n return {\n body: semantic(profileCard),\n headers: {\n 'content-type': 'application/ld+json; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n };\n })\n .get('/manifest.yml', () => ({\n body: manifest(),\n headers: {\n 'content-type': 'text/yaml; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n }))\n .route(event),\n ),\n);\n",
60
+ 'workspaces/api/package.json': '{\n "name": "@w/api",\n "type": "module",\n "private": true\n}\n',
61
+ 'workspaces/api/README.md': '# app API\n\nCalm cloud-ready application\n',
62
+ 'workspaces/api/webpack.config.ts': "import { EnvironmentPlugin } from 'webpack';\nimport { path } from '@vyriy/path';\nimport { ssr, external } from '@vyriy/webpack-config';\n\nexport default ssr(\n '@w/api',\n {\n path: path('dist', 'api'),\n filename: 'index.js',\n library: { type: 'commonjs2' },\n },\n (config) => ({\n ...config,\n externals: [external({ allowlist: [/^@p/, /^@w/, /^@vyriy/] })],\n plugins: [\n ...(config.plugins ?? []),\n new EnvironmentPlugin([\n 'API',\n 'CDN',\n 'MODE',\n 'TAG',\n 'UI',\n ]),\n ],\n }),\n);\n",
63
+ 'workspaces/env.sh': '#!/usr/bin/env sh\n\n: "${API_PORT:=3000}"\n: "${CDN_PORT:=3001}"\n: "${UI_PORT:=3002}"\n: "${API:=http://localhost:$API_PORT}"\n: "${CDN:=http://localhost:$CDN_PORT}"\n: "${UI:=http://localhost:$UI_PORT}"\n: "${TAG:=vyriy-profile-card}"\n: "${MODE:=open}"\n\nexport API_PORT\nexport CDN_PORT\nexport UI_PORT\nexport API\nexport CDN\nexport UI\nexport TAG\nexport MODE\n',
64
+ 'workspaces/static/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/static";\ndistdir="$PWD/dist/cdn";\n\ncp -R $scriptdir/public/* $distdir/\n',
65
+ 'workspaces/static/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/static";\n\n. "$PWD/workspaces/env.sh"\n\nnpx serve --cors -p $CDN_PORT $scriptdir/public\n',
66
+ 'workspaces/static/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/Static\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
67
+ 'workspaces/static/package.json': '{\n "name": "@w/static",\n "type": "module",\n "private": true\n}\n',
68
+ 'workspaces/static/public/avatar.svg': '<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="800">\r\n<rect width="1200" height="800" fill="#0057B7"/>\r\n<rect width="1200" height="400" y="400" fill="#FFD700"/>\r\n</svg>',
69
+ 'workspaces/static/public/icon.svg': '<svg\n width="256"\n height="256"\n viewBox="0 0 256 256"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Vyriy Profile Card icon</title>\n <desc id="description">A calm rounded square icon with a profile card symbol.</desc>\n\n <rect width="256" height="256" rx="56" fill="#111827" />\n <rect x="56" y="48" width="144" height="160" rx="24" fill="#F9FAFB" />\n <circle cx="128" cy="104" r="36" fill="#9CA3AF" />\n <rect x="84" y="156" width="88" height="14" rx="7" fill="#111827" />\n <rect x="96" y="180" width="64" height="10" rx="5" fill="#6B7280" />\n <circle cx="184" cy="184" r="20" fill="#10B981" />\n <path\n d="M175 184L181 190L194 176"\n stroke="white"\n stroke-width="6"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>\n',
70
+ 'workspaces/static/public/screenshots/compact.svg': '<svg\n width="1280"\n height="720"\n viewBox="0 0 1280 720"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Default profile card screenshot</title>\n <desc id="description">A profile card microfrontend rendered in a desktop host page.</desc>\n\n <rect width="1280" height="720" fill="#F3F4F6" />\n <rect x="80" y="72" width="1120" height="576" rx="32" fill="white" />\n\n <rect x="128" y="120" width="360" height="480" rx="28" fill="#F9FAFB" stroke="#E5E7EB" />\n <circle cx="308" cy="244" r="72" fill="#9CA3AF" />\n <rect x="188" y="368" width="240" height="28" rx="14" fill="#111827" />\n <rect x="224" y="420" width="168" height="18" rx="9" fill="#6B7280" />\n <rect x="232" y="492" width="152" height="44" rx="22" fill="#10B981" />\n\n <rect x="560" y="152" width="420" height="40" rx="20" fill="#111827" />\n <rect x="560" y="232" width="520" height="20" rx="10" fill="#6B7280" />\n <rect x="560" y="272" width="460" height="20" rx="10" fill="#9CA3AF" />\n <rect x="560" y="312" width="360" height="20" rx="10" fill="#D1D5DB" />\n <rect x="560" y="420" width="520" height="96" rx="24" fill="#F9FAFB" stroke="#E5E7EB" />\n</svg>\n',
71
+ 'workspaces/static/public/screenshots/default.svg': '<svg\n width="1280"\n height="720"\n viewBox="0 0 1280 720"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Default profile card screenshot</title>\n <desc id="description">A profile card microfrontend rendered in a desktop host page.</desc>\n\n <rect width="1280" height="720" fill="#F3F4F6" />\n <rect x="80" y="72" width="1120" height="576" rx="32" fill="white" />\n\n <rect x="128" y="120" width="360" height="480" rx="28" fill="#F9FAFB" stroke="#E5E7EB" />\n <circle cx="308" cy="244" r="72" fill="#9CA3AF" />\n <rect x="188" y="368" width="240" height="28" rx="14" fill="#111827" />\n <rect x="224" y="420" width="168" height="18" rx="9" fill="#6B7280" />\n <rect x="232" y="492" width="152" height="44" rx="22" fill="#10B981" />\n\n <rect x="560" y="152" width="420" height="40" rx="20" fill="#111827" />\n <rect x="560" y="232" width="520" height="20" rx="10" fill="#6B7280" />\n <rect x="560" y="272" width="460" height="20" rx="10" fill="#9CA3AF" />\n <rect x="560" y="312" width="360" height="20" rx="10" fill="#D1D5DB" />\n <rect x="560" y="420" width="520" height="96" rx="24" fill="#F9FAFB" stroke="#E5E7EB" />\n</svg>\n',
72
+ 'workspaces/static/README.md': '# @w/static\n\nStatic asset workspace for the profile-card microfrontend.\n\n## Assets\n\n- `avatar.svg` is the default demo avatar.\n- `icon.svg` is the manifest icon.\n- `screenshots/default.svg` and `screenshots/compact.svg` document visible profile-card states.\n\nThe workspace is served as the CDN origin during local development.\n',
73
+ 'workspaces/ui/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/ui";\n\n. "$PWD/workspaces/env.sh"\n\nNODE_ENV=production \\\nnpx webpack \\\n--config $scriptdir/webpack.config.ts\n',
74
+ 'workspaces/ui/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/ui";\n\n. "$PWD/workspaces/env.sh"\n\nnpx webpack serve \\\n--open \\\n--config $scriptdir/webpack.config.ts \\\n--port $UI_PORT\n',
75
+ 'workspaces/ui/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/UI\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
76
+ 'workspaces/ui/index.test.tsx': "import { beforeAll, describe, expect, it, jest } from '@jest/globals';\nimport type { ReactElement } from 'react';\n\ntype CustomElementOptions = {\n tag: string;\n elements: () => {\n elements: HTMLElement[];\n root: HTMLElement;\n };\n render: (el: HTMLElement) => ReactElement<{\n onClick: () => void;\n tags?: string[];\n }>;\n};\n\nconst customElementMock = jest.fn();\nconst dispatchProfileCardAnalyticsEventMock = jest.fn();\nconst dispatchProfileCardSelectEventMock = jest.fn();\nlet options: CustomElementOptions;\n\njest.mock('@vyriy/render/custom-element', () => ({\n customElement: customElementMock,\n}));\n\njest.mock('@p/env', () => ({\n getUi: () => 'http://localhost:3002',\n}));\n\njest.mock('@p/event', () => ({\n dispatchProfileCardAnalyticsEvent: dispatchProfileCardAnalyticsEventMock,\n dispatchProfileCardSelectEvent: dispatchProfileCardSelectEventMock,\n}));\n\ndescribe('workspaces/ui/index.tsx', () => {\n beforeAll(async () => {\n await import('./index.js');\n\n [options] = (customElementMock.mock.calls[0] ?? []) as [CustomElementOptions];\n });\n\n it('registers the profile-card custom element with event dispatching', () => {\n const renderElements = options.elements();\n const host = document.createElement('vyriy-profile-card');\n\n host.setAttribute('avatarUrl', 'https://example.com/avatar.png');\n host.setAttribute('description', 'Profile description');\n host.setAttribute('name', 'Ada Lovelace');\n host.setAttribute('tags', '[\"math\",\"computing\"]');\n host.setAttribute('title', 'Mathematician');\n\n const element = options.render(host);\n\n element.props.onClick();\n\n expect(options.tag).toBe('vyriy-profile-card');\n expect(renderElements.root).toBeInstanceOf(HTMLDivElement);\n expect(renderElements.elements[0]).toBeInstanceOf(HTMLLinkElement);\n expect((renderElements.elements[0] as HTMLLinkElement).href).toBe('http://localhost:3002/main.css');\n expect(element.props.tags).toEqual(['math', 'computing']);\n expect(dispatchProfileCardSelectEventMock).toHaveBeenCalledWith(host, {\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n expect(dispatchProfileCardAnalyticsEventMock).toHaveBeenCalledWith(host, {\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n });\n\n it('ignores missing and invalid tags attributes', () => {\n const host = document.createElement('vyriy-profile-card');\n\n expect(options.render(host).props.tags).toBeUndefined();\n\n host.setAttribute('tags', 'not json');\n\n expect(options.render(host).props.tags).toBeUndefined();\n\n host.setAttribute('tags', '{\"tag\":\"math\"}');\n\n expect(options.render(host).props.tags).toBeUndefined();\n });\n\n it('falls back to empty profile values when attributes are missing', () => {\n const host = document.createElement('vyriy-profile-card');\n const element = options.render(host);\n\n element.props.onClick();\n\n expect(dispatchProfileCardSelectEventMock).toHaveBeenLastCalledWith(host, {\n avatarUrl: null,\n name: '',\n role: undefined,\n });\n });\n});\n",
77
+ 'workspaces/ui/index.tsx': "import { customElement } from '@vyriy/render/custom-element';\n\nimport { getUi } from '@p/env';\nimport { dispatchProfileCardAnalyticsEvent, dispatchProfileCardSelectEvent } from '@p/event';\n\nimport { ProfileCard } from '@p/components/profile-card';\nimport '@p/components/styles.scss';\n\nconst parseJsonAttribute = (value: string | null): string[] | undefined => {\n if (!value) {\n return undefined;\n }\n\n try {\n const parsedValue: unknown = JSON.parse(value);\n\n if (Array.isArray(parsedValue) && parsedValue.every((item) => typeof item === 'string')) {\n return parsedValue;\n }\n } catch {\n return undefined;\n }\n\n return undefined;\n};\n\nconst getProfileCardSelectDetail = (el: HTMLElement) => ({\n avatarUrl: el.getAttribute('avatarUrl'),\n name: el.getAttribute('name') ?? '',\n role: el.getAttribute('title') ?? undefined,\n});\n\ncustomElement({\n tag: 'vyriy-profile-card',\n elements: () => {\n const link = document.createElement('link');\n const container = document.createElement('div');\n\n link.rel = 'stylesheet';\n link.href = `${getUi()}/main.css`;\n\n return {\n elements: [link, container],\n root: container,\n };\n },\n render: (el) => (\n <ProfileCard\n avatarUrl={el.getAttribute('avatarUrl') ?? ''}\n description={el.getAttribute('description') ?? ''}\n name={el.getAttribute('name') ?? ''}\n onClick={() => {\n const detail = getProfileCardSelectDetail(el);\n\n dispatchProfileCardSelectEvent(el, detail);\n dispatchProfileCardAnalyticsEvent(el, detail);\n }}\n tags={parseJsonAttribute(el.getAttribute('tags'))}\n title={el.getAttribute('title') ?? ''}\n />\n ),\n});\n",
78
+ 'workspaces/ui/package.json': '{\n "name": "@w/ui",\n "type": "module",\n "private": true\n}\n',
79
+ 'workspaces/ui/README.md': '# @w/ui\n\nDemo entry point.\n',
80
+ 'workspaces/ui/webpack.config.ts': "import { EnvironmentPlugin } from 'webpack';\n\nimport { csr, html } from '@vyriy/webpack-config';\nimport { path } from '@vyriy/path';\n\nexport default csr(\n '@w/ui',\n {\n path: path('dist', 'cdn'),\n filename: 'index.js',\n },\n (config) => ({\n ...config,\n plugins: [\n ...(config.plugins ?? []),\n new EnvironmentPlugin(['API', 'CDN', 'UI']),\n html(\n {\n htmlAttributes: 'lang=\"en\"',\n title: '<title>Demo</title>',\n meta: '<meta charset=\"utf-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />',\n body: '<vyriy-profile-card name=\"Developer\" title=\"Senior IT Professional\" avatarUrl=\"http://localhost:3001/avatar.svg\"></vyriy-profile-card>',\n script: [\n '<script defer=\"defer\" src=\"/index.js\"></script>',\n [\n '<script type=\"module\">',\n \"const card = document.querySelector('vyriy-profile-card');\",\n \"card.addEventListener('vyriy-profile-card.select', (event) => {\",\n \" console.log('UI demo event:', event.detail);\",\n '});',\n '</scr' + 'ipt>',\n ].join(''),\n ].join(''),\n },\n { inject: false },\n ),\n ],\n }),\n);\n",
81
+ };
82
+ export const mfe = (options) => ({
83
+ 'AGENTS.md': agentsContent,
84
+ '.editorconfig': `# https://editorconfig.org
85
+ root = true
86
+
87
+ [*]
88
+ charset = utf-8
89
+ end_of_line = lf
90
+ insert_final_newline = true
91
+ trim_trailing_whitespace = true
92
+
93
+ indent_style = space
94
+ indent_size = 2
95
+
96
+ max_line_length = 100
97
+
98
+ # Markdown
99
+ [*.md]
100
+ trim_trailing_whitespace = false
101
+ max_line_length = off
102
+
103
+ # YAML / YML
104
+ [*.{yml,yaml}]
105
+ indent_size = 2
106
+
107
+ # JSON
108
+ [*.json]
109
+ indent_size = 2
110
+
111
+ # TypeScript / JavaScript
112
+ [*.{ts,tsx,js,jsx}]
113
+ indent_size = 2
114
+
115
+ # Shell / Bash
116
+ [*.sh]
117
+ indent_size = 2
118
+ `,
119
+ '.gitignore': `.yarn/*
120
+ !.yarn/cache
121
+ !.yarn/patches
122
+ !.yarn/plugins
123
+ !.yarn/releases
124
+ !.yarn/sdks
125
+ !.yarn/versions
126
+
127
+ .DS_Store
128
+ .idea
129
+ node_modules
130
+ coverage
131
+ dist
132
+ storybook-static
133
+ *storybook.log
134
+ consumer
135
+
136
+ cdk.out
137
+ cdk.context.json
138
+
139
+ !/**/.gitkeep
140
+ `,
141
+ '.npmrc': 'engine-strict=true\n',
142
+ '.nvmrc': 'lts/krypton\n',
143
+ '.yarnrc.yml': 'nodeLinker: node-modules\nnpmMinimalAgeGate: 0\n',
144
+ '.husky/commit-msg': '#!/bin/sh\n',
145
+ '.husky/post-checkout': '#!/bin/sh\n\nyarn\n',
146
+ '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
147
+ '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
148
+ '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
149
+ '.storybook/main.ts': `import config from '@vyriy/storybook-config';
150
+ import { path } from '@vyriy/path';
151
+
152
+ export default {
153
+ ...config,
154
+ stories: [
155
+ path('**/*.mdx'),
156
+ path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
157
+ ],
158
+ };
159
+ `,
160
+ 'yarn.lock': '',
161
+ 'tsconfig.json': JSON.stringify({
162
+ extends: '@vyriy/typescript-config/index.json',
163
+ include: [
164
+ '.storybook/**/*.ts',
165
+ '.storybook/**/*.tsx',
166
+ 'packages/**/*.ts',
167
+ 'packages/**/*.tsx',
168
+ 'workspaces/**/*.ts',
169
+ 'workspaces/**/*.tsx',
170
+ '*.ts',
171
+ ],
172
+ }, null, 2) + '\n',
173
+ 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
174
+ '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
175
+ 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
176
+ 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
20
177
  'packages/components/avatar/avatar.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { Avatar } from './avatar.js';\nimport avatar from '../../../workspaces/static/public/avatar.svg';\n\nconst meta = {\n title: 'Components/Avatar',\n component: Avatar,\n parameters: { docs: { page: null } },\n args: { name: 'Ada Lovelace', size: 'md' },\n} satisfies Meta<typeof Avatar>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const Image: Story = {\n args: {\n src: avatar,\n alt: 'Profile portrait',\n },\n};\n\nexport const Large: Story = { args: { size: 'lg' } };\n",
21
178
  'packages/components/avatar/avatar.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { Avatar } from './avatar.js';\n\ndescribe('Avatar', () => {\n it('renders an image when src exists', () => {\n render(<Avatar src=\"/avatar.png\" name=\"Ada Lovelace\" />);\n\n expect(screen.getByRole('img', { name: 'Ada Lovelace' })).toBeDefined();\n });\n\n it('uses a generic image alt when name and alt are not provided', () => {\n render(<Avatar src=\"/avatar.png\" />);\n\n expect(screen.getByRole('img', { name: 'Profile avatar' })).toBeDefined();\n });\n\n it('renders initials fallback without exposing decorative text', () => {\n render(<Avatar name=\"Ada Lovelace\" data-testid=\"avatar-root\" />);\n\n expect(screen.getByText('AL')).toBeDefined();\n expect(screen.getByText('AL').getAttribute('aria-hidden')).toBe('true');\n expect(screen.getByTestId('avatar-root')).toBeDefined();\n });\n\n it('renders a stable fallback when name is not provided', () => {\n render(<Avatar />);\n\n expect(screen.getByText('?')).toBeDefined();\n });\n\n it('renders a stable fallback when name has no initials', () => {\n render(<Avatar name=\" \" />);\n\n expect(screen.getByText('?')).toBeDefined();\n });\n});\n",
22
179
  'packages/components/avatar/avatar.tsx': "import { cn } from '@vyriy/cn';\n\nimport type { AvatarType } from './types.js';\n\nconst getInitials = (name?: string) => {\n if (!name) {\n return '?';\n }\n\n const initials = name\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((part) => part[0]?.toUpperCase())\n .join('');\n\n return initials || '?';\n};\n\n/** Renders either a profile image or deterministic initials fallback. */\nexport const Avatar: AvatarType = ({ src, alt, name, size = 'md', className, ...props }) => {\n return (\n <div className={cn('avatar', `avatar--${size}`, className)} {...props}>\n {src ? (\n <img className=\"avatar__image\" alt={alt ?? name ?? 'Profile avatar'} src={src} />\n ) : (\n <span className=\"avatar__initials\" aria-hidden=\"true\">\n {getInitials(name)}\n </span>\n )}\n </div>\n );\n};\n",
@@ -122,62 +279,11 @@ const projectFiles = {
122
279
  'packages/components/README.md': '# @p/components\n\nReusable React primitives for the profile-card microfrontend.\n\n## Exports\n\nThe package exports the public profile-card component set:\n\n- `Avatar`\n- `Badge`\n- `ButtonLink`\n- `Card`\n- `IconLink`\n- `ProfileCard`\n- `ProfileDetails`\n- `ProfileHeader`\n- `ProfileLinks`\n- `ProfileMeta`\n- `ProfileTags`\n\nEach component has a focused README, Storybook docs, stories, and unit tests in its own folder.\n',
123
280
  'packages/components/styles.d.ts': "declare module '*.scss';\ndeclare module '*.scss?inline' {\n const css: string;\n export default css;\n}\ndeclare module '*.svg' {\n const src: string;\n export default src;\n}\n",
124
281
  'packages/components/styles.scss': "@use './avatar/styles' as avatar;\n@use './badge/styles' as badge;\n@use './button-link/styles' as button-link;\n@use './card/styles' as card;\n@use './icon-link/styles' as icon-link;\n@use './profile-card/styles' as profile-card;\n@use './profile-details/styles' as profile-details;\n@use './profile-header/styles' as profile-header;\n@use './profile-links/styles' as profile-links;\n@use './profile-meta/styles' as profile-meta;\n@use './profile-tags/styles' as profile-tags;\n",
125
- 'packages/env/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Env\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
126
- 'packages/env/env.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { getApi, getCdn, getMode, getTag, getUi } from './env.js';\n\ndescribe('env getters', () => {\n afterEach(() => {\n delete process.env.API;\n delete process.env.CDN;\n delete process.env.MODE;\n delete process.env.TAG;\n delete process.env.UI;\n });\n\n it('reads required environment values', () => {\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n expect(getApi()).toBe('http://localhost:3000');\n expect(getCdn()).toBe('http://localhost:3001');\n expect(getMode()).toBe('open');\n expect(getTag()).toBe('vyriy-profile-card');\n expect(getUi()).toBe('http://localhost:3002');\n });\n\n it('throws when a required environment value is missing', () => {\n expect(() => getUi()).toThrow('Environment variable UI is not defined!');\n });\n});\n",
127
- 'packages/env/env.ts': "import { getEnv } from '@vyriy/env';\n\n/** Reads the configured custom element tag name. */\nexport const getTag = () => getEnv('TAG');\n\n/** Reads the configured shadow DOM mode. */\nexport const getMode = () => getEnv('MODE');\n\n/** Reads the API origin used for server endpoints. */\nexport const getApi = () => getEnv('API');\n\n/** Reads the CDN origin used for static assets. */\nexport const getCdn = () => getEnv('CDN');\n\n/** Reads the UI origin used for browser assets. */\nexport const getUi = () => getEnv('UI');\n",
128
- 'packages/env/index.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\nconst ENV_NAMES = [\n 'TAG',\n 'MODE',\n 'API',\n 'CDN',\n 'UI',\n] as const;\n\nconst clearEnv = () => {\n for (const name of ENV_NAMES) {\n delete process.env[name];\n }\n};\n\ndescribe('env public API', () => {\n afterEach(() => {\n clearEnv();\n });\n\n it('exports env getters', () => {\n expect(publicApi.getTag).toBeDefined();\n expect(publicApi.getMode).toBeDefined();\n expect(publicApi.getApi).toBeDefined();\n expect(publicApi.getCdn).toBeDefined();\n expect(publicApi.getUi).toBeDefined();\n });\n\n it('reads environment variables by public getter name', () => {\n process.env.TAG = 'vyriy-profile-card';\n process.env.MODE = 'open';\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.UI = 'http://localhost:3002';\n\n expect(publicApi.getTag()).toBe('vyriy-profile-card');\n expect(publicApi.getMode()).toBe('open');\n expect(publicApi.getApi()).toBe('http://localhost:3000');\n expect(publicApi.getCdn()).toBe('http://localhost:3001');\n expect(publicApi.getUi()).toBe('http://localhost:3002');\n });\n\n it('throws when a required environment variable is missing', () => {\n clearEnv();\n\n expect(() => publicApi.getApi()).toThrow('Environment variable API is not defined!');\n });\n});\n",
129
- 'packages/env/index.ts': "export * from './env.js';\n",
130
- 'packages/env/package.json': '{\n "name": "@p/env",\n "type": "module",\n "private": true\n}\n',
131
- 'packages/env/README.md': '# @p/env\n\nRequired environment readers shared by API and UI workspaces.\n\n## Exports\n\n- `getTag()` reads `TAG`.\n- `getMode()` reads `MODE`.\n- `getApi()` reads `API`.\n- `getCdn()` reads `CDN`.\n- `getUi()` reads `UI`.\n\nEach getter throws when its environment variable is missing.\n',
132
- 'packages/event/constants.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\n\ndescribe('event constants', () => {\n it('matches the manifest event names', () => {\n expect(PROFILE_CARD_ANALYTICS_EVENT_NAME).toBe('openmfe.analytics');\n expect(PROFILE_CARD_SELECT_EVENT_NAME).toBe('vyriy-profile-card.select');\n });\n});\n",
133
- 'packages/event/constants.ts': "/** Custom event emitted when the profile card is selected. */\nexport const PROFILE_CARD_SELECT_EVENT_NAME = 'vyriy-profile-card.select';\n\n/** Standard OpenMFE analytics event emitted for profile-card interactions. */\nexport const PROFILE_CARD_ANALYTICS_EVENT_NAME = 'openmfe.analytics';\n",
134
- 'packages/event/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Event\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
135
- 'packages/event/index.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('event public API', () => {\n it('exports profile card event helpers', () => {\n expect(publicApi.PROFILE_CARD_ANALYTICS_EVENT_NAME).toBe('openmfe.analytics');\n expect(publicApi.PROFILE_CARD_SELECT_EVENT_NAME).toBe('vyriy-profile-card.select');\n expect(publicApi.dispatchProfileCardAnalyticsEvent).toBeDefined();\n expect(publicApi.dispatchProfileCardSelectEvent).toBeDefined();\n });\n});\n",
136
- 'packages/event/index.ts': "export { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nexport { dispatchProfileCardAnalyticsEvent } from './profile-card-analytics.js';\nexport { dispatchProfileCardSelectEvent } from './profile-card-select.js';\nexport type { ProfileCardAnalyticsData, ProfileCardSelectDetail } from './types.js';\n",
137
- 'packages/event/profile-card-analytics.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\n\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME } from './constants.js';\nimport { dispatchProfileCardAnalyticsEvent } from './profile-card-analytics.js';\n\ndescribe('dispatchProfileCardAnalyticsEvent', () => {\n it('dispatches the standard OpenMFE analytics event from the custom element', () => {\n const target = document.createElement('vyriy-profile-card');\n const listener = jest.fn();\n\n target.id = 'profile-card-1';\n target.addEventListener(PROFILE_CARD_ANALYTICS_EVENT_NAME, listener);\n\n const event = dispatchProfileCardAnalyticsEvent(target, {\n avatarUrl: null,\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n\n expect(event.type).toBe(PROFILE_CARD_ANALYTICS_EVENT_NAME);\n expect(event.bubbles).toBe(true);\n expect(event.composed).toBe(true);\n expect(event.detail).toEqual({\n action: 'select',\n category: 'profile-card',\n data: {\n avatarUrl: null,\n name: 'Ada Lovelace',\n role: 'Mathematician',\n },\n id: 'profile-card-1',\n name: 'profile_card_select',\n origin: 'vyriy-profile-card',\n variant: null,\n });\n expect(listener).toHaveBeenCalledWith(event);\n });\n});\n",
138
- 'packages/event/profile-card-analytics.ts': "import { dispatchAnalyticsEvent } from '@vyriy/event';\n\nimport type { ProfileCardAnalyticsData } from './types.js';\n\n/** Dispatches the standard OpenMFE analytics event for a profile-card selection. */\nexport const dispatchProfileCardAnalyticsEvent = (target: HTMLElement, data: ProfileCardAnalyticsData): CustomEvent => {\n return dispatchAnalyticsEvent(\n target,\n {\n action: 'select',\n category: 'profile-card',\n data,\n name: 'profile_card_select',\n },\n {\n bubbles: true,\n composed: true,\n },\n );\n};\n",
139
- 'packages/event/profile-card-select.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\n\nimport { PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nimport { dispatchProfileCardSelectEvent } from './profile-card-select.js';\n\ndescribe('dispatchProfileCardSelectEvent', () => {\n it('dispatches the profile card select event from the custom element', () => {\n const target = document.createElement('vyriy-profile-card');\n const listener = jest.fn();\n\n target.addEventListener(PROFILE_CARD_SELECT_EVENT_NAME, listener);\n\n const event = dispatchProfileCardSelectEvent(target, {\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n\n expect(event.type).toBe(PROFILE_CARD_SELECT_EVENT_NAME);\n expect(event.bubbles).toBe(true);\n expect(event.composed).toBe(true);\n expect(event.detail).toEqual({\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n expect(listener).toHaveBeenCalledWith(event);\n });\n});\n",
140
- 'packages/event/profile-card-select.ts': "import { dispatchCustomEvent } from '@vyriy/event';\n\nimport { PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nimport type { ProfileCardSelectDetail } from './types.js';\n\n/** Dispatches the profile-card select custom event from the web component host. */\nexport const dispatchProfileCardSelectEvent = (\n target: HTMLElement,\n detail: ProfileCardSelectDetail,\n): CustomEvent<ProfileCardSelectDetail> => {\n return dispatchCustomEvent(target, PROFILE_CARD_SELECT_EVENT_NAME, detail, {\n bubbles: true,\n composed: true,\n });\n};\n",
141
- 'packages/event/README.md': "# @p/event\n\nTyped profile-card event helpers.\n\n## Usage\n\n```ts\nimport { dispatchProfileCardAnalyticsEvent, dispatchProfileCardSelectEvent } from '@p/event';\n\nconst target = document.querySelector('vyriy-profile-card');\n\nif (target instanceof HTMLElement) {\n const detail = {\n name: 'Ada Lovelace',\n role: 'Mathematician',\n avatarUrl: '/avatar.svg',\n };\n\n dispatchProfileCardSelectEvent(target, detail);\n dispatchProfileCardAnalyticsEvent(target, detail);\n}\n```\n\n## Events\n\n- `vyriy-profile-card.select` is emitted when the profile card is selected.\n- `openmfe.analytics` is emitted with the standard OpenMFE analytics payload for the same selection.\n",
142
- 'packages/event/types.ts': '/** Detail payload for the profile-card select custom event. */\nexport type ProfileCardSelectDetail = {\n name: string;\n role?: string;\n avatarUrl?: string | null;\n};\n\n/** Analytics data payload emitted for profile-card selections. */\nexport type ProfileCardAnalyticsData = ProfileCardSelectDetail;\n',
143
- 'packages/query/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Query\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
144
- 'packages/query/index.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('query public API', () => {\n it('exports query parsers', () => {\n expect(publicApi.parseProfileCardQuery).toBeDefined();\n });\n});\n",
145
- 'packages/query/index.ts': "export * from './profile-card.js';\nexport type * from './types.js';\n",
146
- 'packages/query/package.json': '{\n "name": "@p/query",\n "type": "module",\n "private": true\n}\n',
147
- 'packages/query/profile-card.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { parseProfileCardQuery } from './profile-card.js';\n\ndescribe('parseProfileCardQuery', () => {\n it('returns undefined when name is missing', () => {\n expect(parseProfileCardQuery(undefined)).toBeUndefined();\n expect(parseProfileCardQuery({})).toBeUndefined();\n expect(parseProfileCardQuery({ name: '' })).toBeUndefined();\n });\n\n it('parses supported profile card fields', () => {\n expect(\n parseProfileCardQuery({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'Profile description',\n name: 'Name',\n tags: 'one, two,, three ',\n title: 'Title',\n }),\n ).toEqual({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'Profile description',\n name: 'Name',\n tags: ['one', 'two', 'three'],\n title: 'Title',\n });\n });\n\n it('omits tags when the query list is empty after trimming', () => {\n expect(\n parseProfileCardQuery({\n name: 'Name',\n tags: ', , ',\n }),\n ).toEqual({\n name: 'Name',\n tags: undefined,\n });\n });\n});\n",
148
- 'packages/query/profile-card.ts': "import type { ParseProfileCardQuery, Query } from './types.js';\n\nconst getQueryValue = (query: Query, name: string): string | undefined => {\n const value = query?.[name];\n\n return value === '' ? undefined : value;\n};\n\nconst getQueryList = (query: Query, name: string): string[] | undefined => {\n const value = getQueryValue(query, name);\n\n if (!value) {\n return undefined;\n }\n\n const list = value\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean);\n\n return list.length > 0 ? list : undefined;\n};\n\n/** Parses request query parameters into profile-card props. */\nexport const parseProfileCardQuery: ParseProfileCardQuery = (query) => {\n const name = getQueryValue(query, 'name');\n\n if (!name) {\n return undefined;\n }\n\n return {\n name,\n title: getQueryValue(query, 'title'),\n description: getQueryValue(query, 'description'),\n avatarUrl: getQueryValue(query, 'avatarUrl'),\n tags: getQueryList(query, 'tags'),\n };\n};\n",
149
- 'packages/query/README.md': "# @p/query\n\nQuery-string parsers for profile-card API endpoints.\n\n## Exports\n\n- `parseProfileCardQuery(query)` converts router query parameters into profile-card props.\n\n## Example\n\n```ts\nimport { parseProfileCardQuery } from '@p/query';\n\nconst props = parseProfileCardQuery({\n name: 'Ada Lovelace',\n title: 'Mathematician',\n tags: 'math, computing',\n});\n```\n",
150
- 'packages/query/types.ts': "import type { ProfileCard } from '@p/components/profile-card/types.js';\n\n/** Query string values provided by the API router. */\nexport type Query = Record<string, string | undefined> | undefined;\n\n/** Converts query string values into profile-card props or rejects incomplete input. */\nexport type ParseProfileCardQuery = (query: Query) => ProfileCard | undefined;\n",
151
- 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
152
- 'workspaces/api/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/api";\n\n. "$PWD/workspaces/env.sh"\n\nNODE_ENV=production \\\nnpx webpack --config $scriptdir/webpack.config.ts\n\ncp $scriptdir/package.json dist/api/package.json\nnpm pkg delete "type" --prefix dist/api\nnpm pkg delete "private" --prefix dist/api\n',
153
- 'workspaces/api/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/api";\n\n. "$PWD/workspaces/env.sh"\n\necho "Demo:\\n$API/\\n"\necho "Prerender:\\n$API/prerender?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3001/avatar.svg\\n"\necho "Semantic:\\n$API/semantic?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3001/avatar.svg\\n"\necho "Manifest:\\n$API/manifest.yml\\n"\n\nNODE_ENV=production \\\nLOG_LEVEL=info \\\nPORT=$API_PORT \\\ntsx watch $scriptdir/index.ts\n',
154
- 'workspaces/api/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/API\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
155
- 'workspaces/api/index.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\nimport type { APIGatewayProxyEvent } from '@vyriy/router';\n\nconst apiMock = jest.fn((handler) => ({\n handler,\n}));\nconst serverMock = jest.fn();\n\njest.mock('@vyriy/handler', () => ({\n api: apiMock,\n}));\n\njest.mock('@vyriy/server', () => ({\n server: serverMock,\n}));\n\ndescribe('workspaces/api/index.ts', () => {\n const getEvent = (\n path: string,\n queryStringParameters: APIGatewayProxyEvent['queryStringParameters'] = null,\n ): APIGatewayProxyEvent =>\n ({\n body: null,\n headers: {},\n httpMethod: 'GET',\n path,\n pathParameters: null,\n queryStringParameters,\n }) as APIGatewayProxyEvent;\n\n it('starts the server with the API router handler', async () => {\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.UI = 'http://localhost:3002';\n\n await import('./index.js');\n\n expect(apiMock).toHaveBeenCalledTimes(1);\n expect(serverMock).toHaveBeenCalledTimes(1);\n expect(serverMock).toHaveBeenCalledWith(apiMock.mock.results[0]?.value);\n\n const handler = apiMock.mock.calls[0]?.[0] as (event: APIGatewayProxyEvent) => Promise<{\n body: string;\n headers?: Record<string, string>;\n statusCode: number;\n }>;\n\n await expect(handler(getEvent('/'))).resolves.toEqual({\n body: expect.stringContaining('<vyriy-profile-card'),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/html; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/prerender'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Query parameter \"name\" is required.',\n }),\n headers: undefined,\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 400,\n });\n\n const prerenderResponse = await handler(\n getEvent('/prerender', {\n description: 'Profile description',\n name: 'Name',\n tags: 'one, two',\n title: 'Title',\n }),\n );\n\n expect(prerenderResponse).toEqual({\n body: expect.stringContaining('Name'),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/html; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n expect(prerenderResponse.body).toContain('shadowrootmode=\"open\"');\n expect(prerenderResponse.body).toContain('http://localhost:3002/main.css');\n\n await expect(handler(getEvent('/semantic', { name: 'Name' }))).resolves.toEqual({\n body: JSON.stringify({\n '@context': 'https://schema.org',\n '@type': 'Person',\n name: 'Name',\n }),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'application/ld+json; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/semantic'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Query parameter \"name\" is required.',\n }),\n headers: undefined,\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 400,\n });\n\n await expect(handler(getEvent('/manifest.yml'))).resolves.toEqual({\n body: expect.stringContaining(\"name: 'Vyriy Profile Card'\"),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/yaml; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/healthcheck'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Not Found',\n }),\n statusCode: 404,\n });\n });\n});\n",
156
- 'workspaces/api/index.ts': "import { server } from '@vyriy/server';\nimport { api } from '@vyriy/handler';\nimport { createRouter } from '@vyriy/router';\nimport { minify } from '@vyriy/html';\n\nimport { demo, manifest, prerender, semantic } from '@p/api';\nimport { parseProfileCardQuery } from '@p/query';\n\nserver(\n api(async (event) =>\n createRouter()\n .get('/', () => ({\n body: minify(demo()),\n headers: {\n 'content-type': 'text/html; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n }))\n .get('/prerender', ({ query }) => {\n const profileCard = parseProfileCardQuery(query);\n\n if (!profileCard) {\n return {\n statusCode: 400,\n body: JSON.stringify({ message: 'Query parameter \"name\" is required.' }),\n };\n }\n\n return {\n body: minify(prerender(profileCard)),\n headers: {\n 'content-type': 'text/html; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n };\n })\n .get('/semantic', ({ query }) => {\n const profileCard = parseProfileCardQuery(query);\n\n if (!profileCard) {\n return {\n statusCode: 400,\n body: JSON.stringify({ message: 'Query parameter \"name\" is required.' }),\n };\n }\n\n return {\n body: semantic(profileCard),\n headers: {\n 'content-type': 'application/ld+json; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n };\n })\n .get('/manifest.yml', () => ({\n body: manifest(),\n headers: {\n 'content-type': 'text/yaml; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n }))\n .route(event),\n ),\n);\n",
157
- 'workspaces/api/package.json': '{\n "name": "@w/api",\n "type": "module",\n "private": true\n}\n',
158
- 'workspaces/api/README.md': '# app API\n\nCalm cloud-ready application\n',
159
- 'workspaces/api/webpack.config.ts': "import { EnvironmentPlugin } from 'webpack';\nimport { path } from '@vyriy/path';\nimport { ssr, external } from '@vyriy/webpack-config';\n\nexport default ssr(\n '@w/api',\n {\n path: path('dist', 'api'),\n filename: 'index.js',\n library: { type: 'commonjs2' },\n },\n (config) => ({\n ...config,\n externals: [external({ allowlist: [/^@p/, /^@w/, /^@vyriy/] })],\n plugins: [\n ...(config.plugins ?? []),\n new EnvironmentPlugin([\n 'API',\n 'CDN',\n 'MODE',\n 'TAG',\n 'UI',\n ]),\n ],\n }),\n);\n",
160
- 'workspaces/env.sh': '#!/usr/bin/env sh\n\n: "${API_PORT:=3000}"\n: "${CDN_PORT:=3001}"\n: "${UI_PORT:=3002}"\n: "${API:=http://localhost:$API_PORT}"\n: "${CDN:=http://localhost:$CDN_PORT}"\n: "${UI:=http://localhost:$UI_PORT}"\n: "${TAG:=vyriy-profile-card}"\n: "${MODE:=open}"\n\nexport API_PORT\nexport CDN_PORT\nexport UI_PORT\nexport API\nexport CDN\nexport UI\nexport TAG\nexport MODE\n',
161
- 'workspaces/static/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/static";\ndistdir="$PWD/dist/cdn";\n\ncp -R $scriptdir/public/* $distdir/\n',
162
- 'workspaces/static/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/static";\n\n. "$PWD/workspaces/env.sh"\n\nnpx serve --cors -p $CDN_PORT $scriptdir/public\n',
163
- 'workspaces/static/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/Static\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
164
- 'workspaces/static/package.json': '{\n "name": "@w/static",\n "type": "module",\n "private": true\n}\n',
165
- 'workspaces/static/public/avatar.svg': '<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="800">\r\n<rect width="1200" height="800" fill="#0057B7"/>\r\n<rect width="1200" height="400" y="400" fill="#FFD700"/>\r\n</svg>',
166
- 'workspaces/static/public/icon.svg': '<svg\n width="256"\n height="256"\n viewBox="0 0 256 256"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Vyriy Profile Card icon</title>\n <desc id="description">A calm rounded square icon with a profile card symbol.</desc>\n\n <rect width="256" height="256" rx="56" fill="#111827" />\n <rect x="56" y="48" width="144" height="160" rx="24" fill="#F9FAFB" />\n <circle cx="128" cy="104" r="36" fill="#9CA3AF" />\n <rect x="84" y="156" width="88" height="14" rx="7" fill="#111827" />\n <rect x="96" y="180" width="64" height="10" rx="5" fill="#6B7280" />\n <circle cx="184" cy="184" r="20" fill="#10B981" />\n <path\n d="M175 184L181 190L194 176"\n stroke="white"\n stroke-width="6"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>\n',
167
- 'workspaces/static/public/screenshots/compact.svg': '<svg\n width="1280"\n height="720"\n viewBox="0 0 1280 720"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Default profile card screenshot</title>\n <desc id="description">A profile card microfrontend rendered in a desktop host page.</desc>\n\n <rect width="1280" height="720" fill="#F3F4F6" />\n <rect x="80" y="72" width="1120" height="576" rx="32" fill="white" />\n\n <rect x="128" y="120" width="360" height="480" rx="28" fill="#F9FAFB" stroke="#E5E7EB" />\n <circle cx="308" cy="244" r="72" fill="#9CA3AF" />\n <rect x="188" y="368" width="240" height="28" rx="14" fill="#111827" />\n <rect x="224" y="420" width="168" height="18" rx="9" fill="#6B7280" />\n <rect x="232" y="492" width="152" height="44" rx="22" fill="#10B981" />\n\n <rect x="560" y="152" width="420" height="40" rx="20" fill="#111827" />\n <rect x="560" y="232" width="520" height="20" rx="10" fill="#6B7280" />\n <rect x="560" y="272" width="460" height="20" rx="10" fill="#9CA3AF" />\n <rect x="560" y="312" width="360" height="20" rx="10" fill="#D1D5DB" />\n <rect x="560" y="420" width="520" height="96" rx="24" fill="#F9FAFB" stroke="#E5E7EB" />\n</svg>\n',
168
- 'workspaces/static/public/screenshots/default.svg': '<svg\n width="1280"\n height="720"\n viewBox="0 0 1280 720"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Default profile card screenshot</title>\n <desc id="description">A profile card microfrontend rendered in a desktop host page.</desc>\n\n <rect width="1280" height="720" fill="#F3F4F6" />\n <rect x="80" y="72" width="1120" height="576" rx="32" fill="white" />\n\n <rect x="128" y="120" width="360" height="480" rx="28" fill="#F9FAFB" stroke="#E5E7EB" />\n <circle cx="308" cy="244" r="72" fill="#9CA3AF" />\n <rect x="188" y="368" width="240" height="28" rx="14" fill="#111827" />\n <rect x="224" y="420" width="168" height="18" rx="9" fill="#6B7280" />\n <rect x="232" y="492" width="152" height="44" rx="22" fill="#10B981" />\n\n <rect x="560" y="152" width="420" height="40" rx="20" fill="#111827" />\n <rect x="560" y="232" width="520" height="20" rx="10" fill="#6B7280" />\n <rect x="560" y="272" width="460" height="20" rx="10" fill="#9CA3AF" />\n <rect x="560" y="312" width="360" height="20" rx="10" fill="#D1D5DB" />\n <rect x="560" y="420" width="520" height="96" rx="24" fill="#F9FAFB" stroke="#E5E7EB" />\n</svg>\n',
169
- 'workspaces/static/README.md': '# @w/static\n\nStatic asset workspace for the profile-card microfrontend.\n\n## Assets\n\n- `avatar.svg` is the default demo avatar.\n- `icon.svg` is the manifest icon.\n- `screenshots/default.svg` and `screenshots/compact.svg` document visible profile-card states.\n\nThe workspace is served as the CDN origin during local development.\n',
170
- 'workspaces/ui/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/ui";\n\n. "$PWD/workspaces/env.sh"\n\nNODE_ENV=production \\\nnpx webpack \\\n--config $scriptdir/webpack.config.ts\n',
171
- 'workspaces/ui/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/ui";\n\n. "$PWD/workspaces/env.sh"\n\nnpx webpack serve \\\n--open \\\n--config $scriptdir/webpack.config.ts \\\n--port $UI_PORT\n',
172
- 'workspaces/ui/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/UI\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
173
- 'workspaces/ui/index.test.tsx': "import { beforeAll, describe, expect, it, jest } from '@jest/globals';\nimport type { ReactElement } from 'react';\n\ntype CustomElementOptions = {\n tag: string;\n elements: () => {\n elements: HTMLElement[];\n root: HTMLElement;\n };\n render: (el: HTMLElement) => ReactElement<{\n onClick: () => void;\n tags?: string[];\n }>;\n};\n\nconst customElementMock = jest.fn();\nconst dispatchProfileCardAnalyticsEventMock = jest.fn();\nconst dispatchProfileCardSelectEventMock = jest.fn();\nlet options: CustomElementOptions;\n\njest.mock('@vyriy/render/custom-element', () => ({\n customElement: customElementMock,\n}));\n\njest.mock('@p/env', () => ({\n getUi: () => 'http://localhost:3002',\n}));\n\njest.mock('@p/event', () => ({\n dispatchProfileCardAnalyticsEvent: dispatchProfileCardAnalyticsEventMock,\n dispatchProfileCardSelectEvent: dispatchProfileCardSelectEventMock,\n}));\n\ndescribe('workspaces/ui/index.tsx', () => {\n beforeAll(async () => {\n await import('./index.js');\n\n [options] = (customElementMock.mock.calls[0] ?? []) as [CustomElementOptions];\n });\n\n it('registers the profile-card custom element with event dispatching', () => {\n const renderElements = options.elements();\n const host = document.createElement('vyriy-profile-card');\n\n host.setAttribute('avatarUrl', 'https://example.com/avatar.png');\n host.setAttribute('description', 'Profile description');\n host.setAttribute('name', 'Ada Lovelace');\n host.setAttribute('tags', '[\"math\",\"computing\"]');\n host.setAttribute('title', 'Mathematician');\n\n const element = options.render(host);\n\n element.props.onClick();\n\n expect(options.tag).toBe('vyriy-profile-card');\n expect(renderElements.root).toBeInstanceOf(HTMLDivElement);\n expect(renderElements.elements[0]).toBeInstanceOf(HTMLLinkElement);\n expect((renderElements.elements[0] as HTMLLinkElement).href).toBe('http://localhost:3002/main.css');\n expect(element.props.tags).toEqual(['math', 'computing']);\n expect(dispatchProfileCardSelectEventMock).toHaveBeenCalledWith(host, {\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n expect(dispatchProfileCardAnalyticsEventMock).toHaveBeenCalledWith(host, {\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n });\n\n it('ignores missing and invalid tags attributes', () => {\n const host = document.createElement('vyriy-profile-card');\n\n expect(options.render(host).props.tags).toBeUndefined();\n\n host.setAttribute('tags', 'not json');\n\n expect(options.render(host).props.tags).toBeUndefined();\n\n host.setAttribute('tags', '{\"tag\":\"math\"}');\n\n expect(options.render(host).props.tags).toBeUndefined();\n });\n\n it('falls back to empty profile values when attributes are missing', () => {\n const host = document.createElement('vyriy-profile-card');\n const element = options.render(host);\n\n element.props.onClick();\n\n expect(dispatchProfileCardSelectEventMock).toHaveBeenLastCalledWith(host, {\n avatarUrl: null,\n name: '',\n role: undefined,\n });\n });\n});\n",
174
- 'workspaces/ui/index.tsx': "import { customElement } from '@vyriy/render/custom-element';\n\nimport { getUi } from '@p/env';\nimport { dispatchProfileCardAnalyticsEvent, dispatchProfileCardSelectEvent } from '@p/event';\n\nimport { ProfileCard } from '@p/components/profile-card';\nimport '@p/components/styles.scss';\n\nconst parseJsonAttribute = (value: string | null): string[] | undefined => {\n if (!value) {\n return undefined;\n }\n\n try {\n const parsedValue: unknown = JSON.parse(value);\n\n if (Array.isArray(parsedValue) && parsedValue.every((item) => typeof item === 'string')) {\n return parsedValue;\n }\n } catch {\n return undefined;\n }\n\n return undefined;\n};\n\nconst getProfileCardSelectDetail = (el: HTMLElement) => ({\n avatarUrl: el.getAttribute('avatarUrl'),\n name: el.getAttribute('name') ?? '',\n role: el.getAttribute('title') ?? undefined,\n});\n\ncustomElement({\n tag: 'vyriy-profile-card',\n elements: () => {\n const link = document.createElement('link');\n const container = document.createElement('div');\n\n link.rel = 'stylesheet';\n link.href = `${getUi()}/main.css`;\n\n return {\n elements: [link, container],\n root: container,\n };\n },\n render: (el) => (\n <ProfileCard\n avatarUrl={el.getAttribute('avatarUrl') ?? ''}\n description={el.getAttribute('description') ?? ''}\n name={el.getAttribute('name') ?? ''}\n onClick={() => {\n const detail = getProfileCardSelectDetail(el);\n\n dispatchProfileCardSelectEvent(el, detail);\n dispatchProfileCardAnalyticsEvent(el, detail);\n }}\n tags={parseJsonAttribute(el.getAttribute('tags'))}\n title={el.getAttribute('title') ?? ''}\n />\n ),\n});\n",
175
- 'workspaces/ui/package.json': '{\n "name": "@w/ui",\n "type": "module",\n "private": true\n}\n',
176
- 'workspaces/ui/README.md': '# @w/ui\n\nDemo entry point.\n',
177
- 'workspaces/ui/webpack.config.ts': "import { EnvironmentPlugin } from 'webpack';\n\nimport { csr, html } from '@vyriy/webpack-config';\nimport { path } from '@vyriy/path';\n\nexport default csr(\n '@w/ui',\n {\n path: path('dist', 'cdn'),\n filename: 'index.js',\n },\n (config) => ({\n ...config,\n plugins: [\n ...(config.plugins ?? []),\n new EnvironmentPlugin(['API', 'CDN', 'UI']),\n html(\n {\n htmlAttributes: 'lang=\"en\"',\n title: '<title>Demo</title>',\n meta: '<meta charset=\"utf-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />',\n body: '<vyriy-profile-card name=\"Developer\" title=\"Senior IT Professional\" avatarUrl=\"http://localhost:3001/avatar.svg\"></vyriy-profile-card>',\n script: [\n '<script defer=\"defer\" src=\"/index.js\"></script>',\n [\n '<script type=\"module\">',\n \"const card = document.querySelector('vyriy-profile-card');\",\n \"card.addEventListener('vyriy-profile-card.select', (event) => {\",\n \" console.log('UI demo event:', event.detail);\",\n '});',\n '</scr' + 'ipt>',\n ].join(''),\n ].join(''),\n },\n { inject: false },\n ),\n ],\n }),\n);\n",
178
- };
179
- export const mfe = (options) => ({
180
- ...base(options),
282
+ 'packages/components/package.json': JSON.stringify({
283
+ name: '@p/components',
284
+ type: 'module',
285
+ private: true,
286
+ }, null, 2) + '\n',
181
287
  ...projectFiles,
182
288
  'package.json': JSON.stringify({
183
289
  name: options.name,
@@ -313,11 +419,6 @@ import ReadMe from './README.md?raw';
313
419
 
314
420
  <Markdown>{ReadMe}</Markdown>
315
421
  `,
316
- 'packages/components/package.json': JSON.stringify({
317
- name: '@p/components',
318
- type: 'module',
319
- private: true,
320
- }, null, 2) + '\n',
321
422
  'packages/event/package.json': JSON.stringify({
322
423
  name: '@p/event',
323
424
  type: 'module',
package/preset/rest.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Preset } from './types.js';
1
+ import type { Preset } from './types.js';
2
2
  export declare const rest: Preset;