@intentius/chant-lexicon-k8s 0.97.0 → 0.98.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.
package/dist/import/parser.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { TemplateParser, TemplateIR } from "@intentius/chant/import/parser"
|
|
|
9
9
|
/**
|
|
10
10
|
* Kubernetes YAML parser implementation.
|
|
11
11
|
*
|
|
12
|
-
* Supports multi-document YAML (split on
|
|
12
|
+
* Supports multi-document YAML (split on `---`, see `splitYAMLDocuments`). Each document is expected
|
|
13
13
|
* to be a standard Kubernetes object with apiVersion, kind, and metadata.
|
|
14
14
|
*/
|
|
15
15
|
export declare class K8sParser implements TemplateParser {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/import/parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAc,MAAM,gCAAgC,CAAC;AAyH7F;;;;;GAKG;AACH,qBAAa,SAAU,YAAW,cAAc;IAC9C,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU;
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/import/parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAc,MAAM,gCAAgC,CAAC;AAyH7F;;;;;GAKG;AACH,qBAAa,SAAU,YAAW,cAAc;IAC9C,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU;IAoClC,OAAO,CAAC,aAAa;CA8BtB"}
|
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "9f1a030dc4c3e8445b98c0fd9bdb6187c0252d6cc392364bb5ce3ac1750bde08",
|
|
5
5
|
"meta.json": "8b999bc142f448b0b627ecdc9e2388bbe672c8a1f7aae5303135624cf2fe65e3",
|
|
6
6
|
"types/index.d.ts": "5f67de738adb455805e72600948940af9c664283785fb68c9fd8f5ea90d42cc3",
|
|
7
7
|
"rules/argo-appset-single-project.ts": "afa9f310753aa2d475f35012b13135b2dfaebed2a35d44edbe185ebc07673674",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"skills/chant-k8s-argo.md": "24c9a85b78a2fc5c6657424baac9cc6d6caff6f47605b8146b2c0082133181cf",
|
|
70
70
|
"skills/chant-k8s-flux.md": "9670efc2e9854bd14686b5adeb707396b9030a4dcaee6529b30abf56efe2c50c"
|
|
71
71
|
},
|
|
72
|
-
"composite": "
|
|
72
|
+
"composite": "73356750d92da8d9fb98a6bcfbe0021c556ea16aa5559b2fa3c84b456fbb3e26"
|
|
73
73
|
}
|
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-k8s",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.98.0",
|
|
4
4
|
"description": "Kubernetes lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@types/js-yaml": "^4.0.9"
|
|
79
79
|
},
|
|
80
80
|
"optionalDependencies": {
|
|
81
|
-
"@intentius/chant-k8s-client": "^0.
|
|
81
|
+
"@intentius/chant-k8s-client": "^0.98.0"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@intentius/chant": "*",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"zod": "^4.3.6",
|
|
89
|
-
"@intentius/chant": "^0.
|
|
89
|
+
"@intentius/chant": "^0.98.0",
|
|
90
90
|
"typescript": "^5.9.3"
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -43,6 +43,24 @@ metadata:
|
|
|
43
43
|
expect(ir.resources.length).toBe(2);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
+
test("multi-doc YAML splits on commented separators and document ends (#2965)", () => {
|
|
47
|
+
const yaml = `--- # the app
|
|
48
|
+
apiVersion: apps/v1
|
|
49
|
+
kind: Deployment
|
|
50
|
+
metadata:
|
|
51
|
+
name: app
|
|
52
|
+
...
|
|
53
|
+
--- # its service
|
|
54
|
+
apiVersion: v1
|
|
55
|
+
kind: Service
|
|
56
|
+
metadata:
|
|
57
|
+
name: svc
|
|
58
|
+
...
|
|
59
|
+
`;
|
|
60
|
+
const ir = parser.parse(yaml);
|
|
61
|
+
expect(ir.resources.map((r) => r.type)).toEqual(["K8s::Apps::Deployment", "K8s::Core::Service"]);
|
|
62
|
+
});
|
|
63
|
+
|
|
46
64
|
test("apiVersion: apps/v1, kind: Deployment → K8s::Apps::Deployment", () => {
|
|
47
65
|
const yaml = `
|
|
48
66
|
apiVersion: apps/v1
|
package/src/import/parser.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { TemplateParser, TemplateIR, ResourceIR } from "@intentius/chant/import/parser";
|
|
10
|
-
import { parseYAML } from "@intentius/chant/yaml";
|
|
10
|
+
import { parseYAML, splitYAMLDocuments } from "@intentius/chant/yaml";
|
|
11
11
|
import { namespaceSegmentForGroup } from "../group-namespace";
|
|
12
12
|
|
|
13
13
|
// ── GVK to type name mapping ───────────────────────────────────────
|
|
@@ -130,7 +130,7 @@ function toLogicalId(kind: string, name: string | undefined): string {
|
|
|
130
130
|
/**
|
|
131
131
|
* Kubernetes YAML parser implementation.
|
|
132
132
|
*
|
|
133
|
-
* Supports multi-document YAML (split on
|
|
133
|
+
* Supports multi-document YAML (split on `---`, see `splitYAMLDocuments`). Each document is expected
|
|
134
134
|
* to be a standard Kubernetes object with apiVersion, kind, and metadata.
|
|
135
135
|
*/
|
|
136
136
|
export class K8sParser implements TemplateParser {
|
|
@@ -138,11 +138,9 @@ export class K8sParser implements TemplateParser {
|
|
|
138
138
|
const resources: ResourceIR[] = [];
|
|
139
139
|
const namespaces = new Set<string>();
|
|
140
140
|
|
|
141
|
-
// Split on
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
.map((d) => d.trim())
|
|
145
|
-
.filter((d) => d.length > 0 && !/^[\s#]*$/.test(d.replace(/#[^\n]*/g, "")));
|
|
141
|
+
// Split into documents on `---` / `...` markers (a trailing `# comment`
|
|
142
|
+
// allowed); empty and comment-only documents are dropped (#2965).
|
|
143
|
+
const documents = splitYAMLDocuments(content);
|
|
146
144
|
|
|
147
145
|
for (const docStr of documents) {
|
|
148
146
|
const doc = parseYAML(docStr);
|