feat: добавить поддержку 20 framework exact modes

Добавлены exact modes:
- vue@vite и vue@webpack
- nuxt@vite и nuxt@webpack
- svelte@vite, svelte@webpack и sveltekit@vite
- angular@application и angular@webpack
- astro@vite
- solid@vite, solid@webpack и solid-start@vite
- preact@vite и preact@webpack
- qwik@vite
- lit@vite и lit@webpack
- alpine@vite и alpine@webpack

Для каждого mode реализованы изолированный adapter, нативный
framework-компонент, declarations, manifest, CSS и внешний asset URL.

Добавлены production integration-стенды с генерацией, typecheck,
сборкой и Playwright-проверкой рендера спрайта и Viewer.

Обновлены Viewer, RU/EN-гайды, README, technical reference и AI skills.
Итоговая матрица включает 29 exact modes.

Проверки:
- 48 unit-тестов
- 29 integration E2E-тестов
This commit is contained in:
2026-07-15 16:56:44 +03:00
parent e54ab4991c
commit 8b3365f957
378 changed files with 21188 additions and 650 deletions

View File

@@ -0,0 +1,62 @@
import assert from 'node:assert/strict'
import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'
import test from 'node:test'
import { generateSprite, isSpriteMode } from '../dist/index.js'
const GENERATED_FILES = [
'icon-data.d.ts',
'icon-data.js',
'index.d.ts',
'index.js',
'sprite.svg',
'svg-sprite.manifest.d.ts',
'svg-sprite.manifest.js',
'vue',
]
test('generates the isolated Vue Vite contract', async () => {
const rootDir = fs.mkdtempSync(path.join(os.tmpdir(), 'svg-sprites-vue-vite-'))
const iconsDir = path.join(rootDir, 'icons')
fs.mkdirSync(iconsDir)
fs.writeFileSync(
path.join(iconsDir, 'check.svg'),
'<svg viewBox="0 0 24 24"><path fill="#16a34a" d="M2 12l6 6L22 4" /></svg>',
)
assert.equal(isSpriteMode('vue@vite'), true)
const result = await generateSprite(rootDir, {
mode: 'vue@vite',
name: 'app',
generatedNotice: false,
})
const generatedDir = path.join(rootDir, '.svg-sprite')
assert.equal(result.mode, 'vue@vite')
assert.equal(result.target, 'vite')
assert.equal(result.iconCount, 1)
assert.deepEqual(fs.readdirSync(generatedDir).sort(), GENERATED_FILES)
assert.deepEqual(fs.readdirSync(path.join(generatedDir, 'vue')).sort(), [
'vue-component.d.ts',
'vue-component.js',
'vue-component.module.css',
])
const component = fs.readFileSync(path.join(generatedDir, 'vue', 'vue-component.js'), 'utf8')
const componentTypes = fs.readFileSync(path.join(generatedDir, 'vue', 'vue-component.d.ts'), 'utf8')
const manifest = fs.readFileSync(result.manifestPath, 'utf8')
const manifestTypes = fs.readFileSync(path.join(generatedDir, 'svg-sprite.manifest.d.ts'), 'utf8')
assert.match(component, /import \{ defineComponent, h \} from 'vue'/)
assert.match(component, /export const AppIcon = defineComponent/)
assert.match(component, /sprite\.svg\?no-inline/)
assert.match(componentTypes, /DefineComponent<AppIconProps>/)
assert.match(componentTypes, /--icon-color-/)
assert.match(manifest, /"framework": "vue"/)
assert.match(manifest, /"componentName": "AppIcon"/)
assert.match(manifest, /"mode": "vue@vite"/)
assert.match(manifestTypes, /mode: 'vue@vite'/)
assert.doesNotMatch(component, /from '@gromlab\/svg-sprites/)
})