@moontra/moonui 6.19.1 → 6.20.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.
@@ -1,103 +0,0 @@
1
- /**
2
- * CDN (IIFE / `.global.js`) build'i KALDIRILDI — karar kilidi. Issue #399.
3
- *
4
- * Ne olmuştu: `tsup.config.ts` ikinci bir tanımda `format: ["iife"]` +
5
- * `globalName: "MoonUI"` ilan ediyordu, ama `package.json`'daki `build:js`
6
- * tsup'ı CLI argümanıyla çağırıyordu (`tsup src/... --format esm,cjs`).
7
- * tsup'ta CLI argümanı config'i EZER → IIFE hiç üretilmedi; `.global.js`
8
- * ADIYLA bir ES modülü yayımlandı. Dosya adı IIFE vaat ettiği için hata
9
- * sessizdi: `window.MoonUI` hiçbir sürümde oluşmadı, buna rağmen her
10
- * tarball 4.7 MB ölü `.global.*` artefaktı taşıdı.
11
- *
12
- * Neden "IIFE'yi gerçekten üretelim" seçilmedi (ölçüm, #399): CLI argümanı
13
- * kaldırılıp gerçek IIFE üretildiğinde `window.MoonUI` oluşuyor, ama React
14
- * bundle'ın içine giriyor (config her şeyi noExternal ile bundle'lıyordu) ve
15
- * dışarı React API'si sunulmuyor → sayfa kendi React'ini yüklemek zorunda,
16
- * yani çift React → hook
17
- * kullanan her component çöküyor (Switch/Tooltip/Accordion: "Cannot read
18
- * properties of null"). Ayrıca CDN için stil artefaktı yok. Gerçek bir CDN
19
- * yolu ayrı bir ürün işidir; o gelene kadar yüzey tamamen kaldırıldı.
20
- *
21
- * Bu test üç katmanı birden kilitler: build config, paket metadata'sı ve
22
- * (varsa) üretilmiş dist. Config + metadata katmanları BUILD GEREKTİRMEZ —
23
- * `.global.*` ancak config onu ilan ederse üretilebileceği için asıl kapı
24
- * onlardır; dist taraması build yapılmışsa çalışan EK doğrulamadır.
25
- */
26
- import * as fs from 'fs';
27
- import * as path from 'path';
28
-
29
- const PACKAGE_ROOT = path.resolve(__dirname, '../..');
30
- const TSUP_CONFIG = path.join(PACKAGE_ROOT, 'tsup.config.ts');
31
- const PACKAGE_JSON = path.join(PACKAGE_ROOT, 'package.json');
32
- const DIST = path.join(PACKAGE_ROOT, 'dist');
33
-
34
- /** dist ağacındaki tüm dosyaları (alt dizinler dahil) paket köküne göreli döndürür. */
35
- function walk(dir: string, base = dir): string[] {
36
- return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
37
- const full = path.join(dir, entry.name);
38
- return entry.isDirectory() ? walk(full, base) : [path.relative(base, full)];
39
- });
40
- }
41
-
42
- describe('CDN/IIFE build yüzeyi kaldırıldı (#399)', () => {
43
- describe('tsup.config.ts — IIFE tanımı geri gelmemeli', () => {
44
- let config = '';
45
- beforeAll(() => {
46
- config = fs.readFileSync(TSUP_CONFIG, 'utf8');
47
- });
48
-
49
- it('hiçbir tanımda `format: ["iife"]` yok', () => {
50
- // Yorum satırlarını ayıkla: karar gerekçesi metninde "iife" kelimesi geçiyor.
51
- const code = config.replace(/\/\/.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '');
52
- expect(code).not.toMatch(/format\s*:\s*\[[^\]]*['"]iife['"]/);
53
- });
54
-
55
- it('`globalName` (window.X ataması) ilan edilmiyor', () => {
56
- const code = config.replace(/\/\/.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '');
57
- expect(code).not.toMatch(/globalName\s*:/);
58
- });
59
-
60
- it('`.global.js` uzantısı üreten outExtension yok', () => {
61
- const code = config.replace(/\/\/.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '');
62
- expect(code).not.toMatch(/\.global\.js/);
63
- });
64
- });
65
-
66
- describe('package.json — CDN metadata ve config-ezen build argümanları yok', () => {
67
- let pkg: Record<string, unknown> = {};
68
- beforeAll(() => {
69
- pkg = JSON.parse(fs.readFileSync(PACKAGE_JSON, 'utf8'));
70
- });
71
-
72
- it.each(['unpkg', 'jsdelivr'])('%s alanı yok (CDN çözümleyicileri ölü dosyaya bakmasın)', (field) => {
73
- expect(pkg).not.toHaveProperty(field);
74
- });
75
-
76
- it('exports/files alanlarında `.global` atfı yok', () => {
77
- expect(JSON.stringify({ exports: pkg.exports, files: pkg.files })).not.toContain('.global');
78
- });
79
-
80
- /**
81
- * Kök nedenin kendisi: CLI argümanı tsup config'ini ezer. build script'leri
82
- * entry/format'ı CLI'dan geçmediği sürece config tek kaynak kalır.
83
- */
84
- it.each(['build:js', 'build:dts'])('%s tsup config\'ini CLI argümanıyla ezmiyor', (script) => {
85
- const scripts = pkg.scripts as Record<string, string>;
86
- const command = scripts[script];
87
- expect(command).toBeDefined();
88
- expect(command).not.toMatch(/--format/);
89
- expect(command).not.toMatch(/\bsrc\//);
90
- });
91
- });
92
-
93
- describe('dist — üretilmiş çıktıda `.global.*` kalmamalı', () => {
94
- const distExists = fs.existsSync(DIST);
95
-
96
- // Build yapılmamışsa bu katman atlanır; asıl kapı yukarıdaki config +
97
- // metadata testleridir (build olmadan da koşar ve regresyonu yakalar).
98
- (distExists ? it : it.skip)('dist ağacında hiçbir `.global.*` dosyası yok', () => {
99
- const globals = walk(DIST).filter((file) => path.basename(file).includes('.global.'));
100
- expect(globals).toEqual([]);
101
- });
102
- });
103
- });