@zalkera/client 0.24.3 → 0.24.4

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.
@@ -2969,15 +2969,52 @@ function checkSectionCoverage() {
2969
2969
  const src = readSafe(rendererPath, "섹션 렌더러 계약 검사");
2970
2970
  if (src === null) return;
2971
2971
  const cases = new Set([...src.matchAll(/case\s+"([A-Z_]+)"/g)].map((m) => m[1]));
2972
- const missing = contract.map((c) => c.type).filter((t) => !cases.has(t));
2972
+
2973
+ // ⚠ **계약 전량이 아니라 「이 사이트가 실제로 쓰는 타입」을 잰다.**
2974
+ //
2975
+ // 전량을 재면 **계약에 타입이 하나 추가되는 순간** 그것을 안 그리는 기존 사이트가 전부
2976
+ // 관문에서 막힌다(`servingSink` 는 관문 모드에서 error 다). 계약이 약속한 「타입 추가는
2977
+ // 구 스토어프론트를 깨지 않는다」와 정면으로 어긋나고, 실제로 막히는 시점은 그 사이트가
2978
+ // 새 client 를 받는 때라 원인을 되짚기도 어렵다.
2979
+ //
2980
+ // 여기서 잡아야 하는 사고는 「콘솔에서 넣었는데 화면에 안 나온다」이고, 그것은 **콘텐츠가
2981
+ // 그 타입을 쓸 때만** 성립한다. 어휘 전량 커버는 팩 정본이 자기 시험으로 지킬 일이다.
2982
+ const known = new Set(contract.map((c) => c.type));
2983
+ const used = usedSectionTypes(repoRootDir).filter((t) => known.has(t));
2984
+ const missing = [...new Set(used)].filter((t) => !cases.has(t));
2973
2985
  if (missing.length > 0) {
2974
2986
  servingSink().push(
2975
- `[C2] SectionRenderer 가 계약의 ${missing.join("·")} 를 안 그린다 — 미지 타입은 조용히 스킵되므로 ` +
2976
- `콘솔에서 넣어도 화면에 안 나온다. case 를 추가하거나, 의도적 미지원이면 그 사유를 커밋에 남겨라.`,
2987
+ `[C2] SectionRenderer 가 콘텐츠가 쓰는 ${missing.join("·")} 를 안 그린다 — 미지 타입은 조용히 ` +
2988
+ `스킵되므로 콘솔에서 넣어도 화면에 안 나온다. case 를 추가하거나, 의도적 미지원이면 그 사유를 커밋에 남겨라.`,
2977
2989
  );
2978
2990
  }
2979
2991
  }
2980
2992
 
2993
+ /**
2994
+ * `content/pages/*.json` 이 실제로 쓰는 섹션 타입.
2995
+ *
2996
+ * 못 읽거나 깨진 파일은 **여기서 말하지 않는다** — N2·N4 가 그 일을 한다. 이 함수는 「무엇을
2997
+ * 쓰는가」만 답하고, 모르면 조용히 뺀다(모르는 것을 「쓴다」고 세면 없는 결함을 만든다).
2998
+ */
2999
+ function usedSectionTypes(repoRoot) {
3000
+ const out = [];
3001
+ for (const file of contentPageFiles(repoRoot)) {
3002
+ let page;
3003
+ try {
3004
+ page = JSON.parse(readFileSync(file, "utf8"));
3005
+ } catch {
3006
+ continue;
3007
+ }
3008
+ const sections = page?.sections;
3009
+ if (!Array.isArray(sections)) continue;
3010
+ for (const section of sections) {
3011
+ const type = section?.type;
3012
+ if (typeof type === "string" && type.trim() !== "") out.push(type.trim());
3013
+ }
3014
+ }
3015
+ return out;
3016
+ }
3017
+
2981
3018
  /*
2982
3019
  * ── N1~N5 : 콘텐츠 파일 계약 ────────────────────────────────────────────────
2983
3020
  *
package/package.json CHANGED
@@ -1,75 +1,75 @@
1
1
  {
2
- "name": "@zalkera/client",
3
- "version": "0.24.3",
4
- "description": "zalkera 헤드리스 CMS 공개 API 클라이언트 (테넌트 사이트용)",
5
- "license": "MIT",
6
- "author": "Credium Co., Ltd.",
7
- "type": "module",
8
- "publishConfig": {
9
- "access": "public"
2
+ "name": "@zalkera/client",
3
+ "version": "0.24.4",
4
+ "description": "zalkera 헤드리스 CMS 공개 API 클라이언트 (테넌트 사이트용)",
5
+ "license": "MIT",
6
+ "author": "Credium Co., Ltd.",
7
+ "type": "module",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "keywords": [
12
+ "zalkera",
13
+ "headless",
14
+ "commerce",
15
+ "cms",
16
+ "api-client",
17
+ "sdk"
18
+ ],
19
+ "homepage": "https://zalkera.com",
20
+ "files": [
21
+ "dist",
22
+ "llms.txt",
23
+ "contracts",
24
+ "bin/validate-storefront.mjs",
25
+ "bin/check-aeo-surfaces.mjs",
26
+ "lib",
27
+ "!dist/*.map"
28
+ ],
29
+ "main": "./dist/index.cjs",
30
+ "module": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "bin": {
33
+ "zalkera-aeo-check": "./bin/check-aeo-surfaces.mjs",
34
+ "zalkera-validate": "./bin/validate-storefront.mjs"
35
+ },
36
+ "exports": {
37
+ ".": {
38
+ "import": {
39
+ "types": "./dist/index.d.ts",
40
+ "default": "./dist/index.js"
41
+ },
42
+ "require": {
43
+ "types": "./dist/index.d.cts",
44
+ "default": "./dist/index.cjs"
45
+ }
10
46
  },
11
- "keywords": [
12
- "zalkera",
13
- "headless",
14
- "commerce",
15
- "cms",
16
- "api-client",
17
- "sdk"
18
- ],
19
- "homepage": "https://zalkera.com",
20
- "files": [
21
- "dist",
22
- "llms.txt",
23
- "contracts",
24
- "bin/validate-storefront.mjs",
25
- "bin/check-aeo-surfaces.mjs",
26
- "lib",
27
- "!dist/*.map"
28
- ],
29
- "main": "./dist/index.cjs",
30
- "module": "./dist/index.js",
31
- "types": "./dist/index.d.ts",
32
- "bin": {
33
- "zalkera-aeo-check": "./bin/check-aeo-surfaces.mjs",
34
- "zalkera-validate": "./bin/validate-storefront.mjs"
35
- },
36
- "exports": {
37
- ".": {
38
- "import": {
39
- "types": "./dist/index.d.ts",
40
- "default": "./dist/index.js"
41
- },
42
- "require": {
43
- "types": "./dist/index.d.cts",
44
- "default": "./dist/index.cjs"
45
- }
46
- },
47
- "./contracts/aeo-surface-guarantees.json": "./contracts/aeo-surface-guarantees.json",
48
- "./bin/check-aeo-surfaces.mjs": "./bin/check-aeo-surfaces.mjs",
49
- "./bin/validate-storefront.mjs": "./bin/validate-storefront.mjs",
50
- "./lib/site-crawl.mjs": "./lib/site-crawl.mjs"
51
- },
52
- "scripts": {
53
- "build": "tsup",
54
- "dev": "tsup --watch",
55
- "typecheck": "tsc --noEmit",
56
- "test": "vitest run",
57
- "test:watch": "vitest",
58
- "prepublishOnly": "npm run build && npm run check:tarball && npm run format:check && npm run typecheck && npm test && npm run check:published",
59
- "check:published": "node scripts/check-published-drift.mjs",
60
- "format": "prettier --write \"src/**/*.ts\" \"scripts/**/*.mjs\" \"bin/**/*.mjs\"",
61
- "format:check": "prettier --check \"src/**/*.ts\" \"scripts/**/*.mjs\" \"bin/**/*.mjs\"",
62
- "check:tarball": "node scripts/check-tarball.mjs"
63
- },
64
- "engines": {
65
- "node": ">=18"
66
- },
67
- "devDependencies": {
68
- "@types/node": "^22.10.2",
69
- "prettier": "^3.9.6",
70
- "tsup": "^8.3.5",
71
- "typescript": "^5.7.2",
72
- "vitest": "^2.1.8"
73
- },
74
- "sideEffects": false
47
+ "./contracts/aeo-surface-guarantees.json": "./contracts/aeo-surface-guarantees.json",
48
+ "./bin/check-aeo-surfaces.mjs": "./bin/check-aeo-surfaces.mjs",
49
+ "./bin/validate-storefront.mjs": "./bin/validate-storefront.mjs",
50
+ "./lib/site-crawl.mjs": "./lib/site-crawl.mjs"
51
+ },
52
+ "scripts": {
53
+ "build": "tsup",
54
+ "dev": "tsup --watch",
55
+ "typecheck": "tsc --noEmit",
56
+ "test": "vitest run",
57
+ "test:watch": "vitest",
58
+ "prepublishOnly": "npm run build && npm run check:tarball && npm run format:check && npm run typecheck && npm test && npm run check:published",
59
+ "check:published": "node scripts/check-published-drift.mjs",
60
+ "format": "prettier --write \"src/**/*.ts\" \"scripts/**/*.mjs\" \"bin/**/*.mjs\"",
61
+ "format:check": "prettier --check \"src/**/*.ts\" \"scripts/**/*.mjs\" \"bin/**/*.mjs\"",
62
+ "check:tarball": "node scripts/check-tarball.mjs"
63
+ },
64
+ "engines": {
65
+ "node": ">=18"
66
+ },
67
+ "devDependencies": {
68
+ "@types/node": "^22.10.2",
69
+ "prettier": "^3.9.6",
70
+ "tsup": "^8.3.5",
71
+ "typescript": "^5.7.2",
72
+ "vitest": "^2.1.8"
73
+ },
74
+ "sideEffects": false
75
75
  }