diff --git a/blog/2024-09-18-kcl-0.10.0-release/index.md b/blog/2024-09-18-kcl-0.10.0-release/index.md index acbecd5c..176af3fb 100644 --- a/blog/2024-09-18-kcl-0.10.0-release/index.md +++ b/blog/2024-09-18-kcl-0.10.0-release/index.md @@ -19,7 +19,7 @@ WIP **We would like to extend our heartfelt thanks to all 120 community contributors who participated in the iteration from version v0.9 to v0.10 over the past 120 days. The following list is in no particular order.** -WIP +_@eshepelyuk, @haarchri, @liangyuanpeng, @logo749, @bilalba, @borgius, @patrick-hermann-sva, @ovk, @east4ming, @wmcnamee-coreweave, @steeling, @sschne, @Jacob Colvin, @Richard Holmes, @Christopher Haar, @Yvan da Silva, @Uladzislau Maher, @Sergey Ryabin, @Lukáš Kubín, @Alexander Fuchs, @Divyansh Choukse, @Vishalk91-4, @DavidChevallier, @dennybaa, @bozaro, @vietanhtwdk, @hoangndst, @patpicos, @metacoma, @karlderkaefer, @kukacz, @Matthew Hodgkins, @Gao Jun, @Zack Zhang, @briheet, @Moulick, @stmcginnis, @Manoramsharma, @NishantBansal2003, @varshith257, @Harsh4902, @Gmin2, @shishir-11, @RehanChalana, @Shruti78, @jianzs, @vinayakjaas, @ChrisK, @Lan Liang, @Endre Karlson, @suin, @v3xro, @soubinan, @juanzolotoochin, @mnacharov, @ron1, @vfarcic, @phisco, @juanique, @zackzhangverkada, @warmuuh, @novohool, @officialasishkumar, @cx2c, @yonas, @shruti2522, @nwmcsween, @trogowski, @johnallen3d, @riven-blade, @gesmit74, @prakhar479, @Peter Boat, @Stéphane Este-Gracias, @Josh West, @Brandon Nason, @Anany, @dansrogers, @diefans, @DrummyFloyd_ ## 📚 Key Updates @@ -27,43 +27,376 @@ WIP #### Language -WIP +- Supports both **attribute access** and **index access** in assignment statements. + +Now you can change the content of the assigned object through **index access**. + +```kcl +_a = [0, 1] * 2 +_a[0] = 2 +_a[1] += 2 +a = _a +``` + +After compilation, you will get the following result + +```kcl +a: +- 2 +- 3 +``` + +Or you can change the content of the assigned object through **attribute access**. + +```kcl +_a = [{key1.key2 = [0] * 2}, {key3.key4 = [0] * 2}] +_a[0].key1.key2[0] = 1 +_a[1].key3.key4[1] += 1 +a = _a +``` + +After compilation, you will get the following result: + +```kcl +a: +- key1: + key2: + - 1 + - 0 +- key3: + key4: + - 0 + - 1 +``` + +- For single constant schema properties, the default value can be omitted. + +```kcl +schema Deployment: + apiVersion: "apps/v1" = "apps/v1" +``` + +```kcl +schema Deployment: + apiVersion: "apps/v1" # "apps/v1" is the default value +``` + +- Fixed the issue of semantic check time being too long when nesting multiple config blocks in KCL. +- Removed the `unwrap()` statement in the semantic parser to reduce panic issues. +- Fixed the calculation error of the field merge operation with a list index. +- Fixed the type conversion error when the `as` keyword exists in an external package. +- Fixed the type check error when the `config` is converted to the `schema` in a lambda function. +- Optimized the type inference and check of the `Dict` return value of the optimization function parameter call, which can omit the schema name to simplify the configuration writing. +- Supported the syntax of `_config["key"] = "value"` or `_config.key = "value"` to modify the configuration in place in the assignment statement. +- Optimized the type check of the configuration merge operator, which can find more type errors at compile time. +- Fixed the issue of the `datetime` date format in the built-in API. +- Fixed the Schema configuration merge parameter parsing error. +- Optimized the error message. +- Fixed the unexpected error caused by the circular dependency in the Schema inheritance. +- Fixed the issue of the automatic merge of the configuration being invalid. +- KCL optimized the error message of the circular dependency in the Schema inheritance. +- KCL refactored the code in the compilation entry. +- KCL added the release of the library under the windows mingw environment. +- KCL fixed the CI error in the windows environment. +- Optimized the KCL runtime error message and added some test cases. #### Toolchain -WIP +- Added the `kcl test` tool to support the `print` function output in test cases. + +You can use the `print` function to output logs in test cases. + +```kcl +test_print = lambda { + print("Test Begin ...") +} +``` + +By running the `kcl test` command to run the test case, you can see the corresponding log: + +```kcl +test_print: PASS (9ms) +Test Begin ... + +-------------------------------------------------------------------------------- +PASS: 1/1 +``` + +- kcl import tool supports importing JSON Schema with AllOf validation fields into KCL Schema. + +For JSON Schema containing AllOf validation fields: + +```json +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://example.com/schemas/config", + "description": "Schema for representing a config information.", + "type": "object", + "properties": { + "name": { + "type": "string", + "allOf": [ + { + "pattern": "198.160" + }, + { + "pattern": "198.161" + }, + { + "pattern": "198.162" + } + ] + }, + "price": { + "type": "number", + "minimum": 0 + } + }, + "required": [ + "name" + ] +} +``` + +It will generate the corresponding KCL Schema: + +```kcl +""" +This file was generated by the KCL auto-gen tool. DO NOT EDIT. +Editing this file might prove futile when you re-run the KCL auto-gen generate command. +""" +import regex + +schema Config: + r""" + Schema for representing a config information. + + Attributes + ---------- + name : str, required + price : float, optional + """ + + name: str + price?: float + + check: + regex.match(name, r"198.160") + regex.match(name, r"198.161") + regex.match(name, r"198.162") + price >= 0 if price +``` + +- KCL package management tool supports adding a KCL package from a Git repository subdirectory as a third-party library. + +By the following command, the KCL package management tool supports adding a KCL package from a Git repository subdirectory as a third-party library. + +```shell +kcl mod add --git --commit +``` + +Taking as an example, add the KCL package named `cc` in the subdirectory of this repository as a dependency: + +```shell +kcl mod add cc --git https://github.com/kcl-lang/flask-demo-kcl-manifests.git --commit 8308200 +``` + +- The kcl-playground based on the wasm backend is online. + +[kclplayground](/img/blog/2024-09-18-kcl-0.10.0-release/kclplayground.png) + +- kcl import tool supports importing the entire Go Package and converting all Go struct definitions into KCL Schema definitions. +- Fixed the compilation error of kcl import when importing Kubernetes CRD and OpenAPI Schema. +- Optimized the output format of `kcl mod init`. +- `kcl fmt` tool supports retaining the blank lines between multiple code snippets, which will not delete all of them. +- Fixed the issue of the package management tool not recognizing the package relative path `${KCL_MOD}` in the compilation entry. +- The package management tool adjusts the plainHttp option to be optional. +- The package management tool fixes the compilation entry recognition error caused by the wrong root directory. +- The package management tool adds a cache for login credentials to reduce security risks. +- The package management tool fixes the compilation failure caused by the virtual compilation entry. +- The package management tool fixes the missing default dependencies in the kcl.mod. +- The package management tool fixes the calculation error of the vendor path, which causes the third-party library to be re-downloaded. +- The package management tool fixes the failure to push the OCI registry with the https protocol. +- The package management tool fixes the compilation failure when compiling multiple *.k files. +- The package management added more test cases. +- The package management tool fixed the circular dependency issue caused by adding the git subpackage multiple times as a dependency. +- The package management tool fixed the missing dependencies path when use the `kcl mod metadata` command. +- The package management tool preloads the MVS version management algorithm in the Add, Update command, controlled by the environment variable SupportMVS=true. +- KCL tree-sitter adds sequence operations and selector support. +- KCL tree-sitter optimizes some syntax rules and adds more test cases. +- Fixed the issue of the kcl fmt tool formatting the Schema index signature comment error. +- Fixed the issue of kcl import importing the Kubernetes CRD setting the -o parameter to an unexpected error. +- Fixed the issue of kcl import importing an empty Go struct outputting an unexpected KCL Schema error. +- Optimized the code structure and document structure of kcl-openapi. +- Added more test cases and optimized the code structure of kcl-playground. +- krm-kcl function fixed some errors in the tests and documents. +- krm-kcl function fixed the issue of dependency download failure. +- kcl-operator updated and fixed some document content, optimized some code structures. +- kcl-operator added some test cases and optimized the release process. +- kcl-operator added automatic authentication when initializing containers. +- kcl fmt tool provides C API. +- kcl fmt tool removes redundant blank lines in if blocks. #### IDE -WIP +- The IDE adds hints for the schema parameter. + +![schemaargshint](/img/blog/2024-09-18-kcl-0.10.0-release/schemaargshint.png) + +- Fixed the semantic highlighting of the schema index signature key. +- Supported the use of the kcl.work configuration file to divide the IDE workspace. +- Fixed the issue of the IDE not recognizing the schema instantiation parameters. +- Fixed auto-complete errors in the IDE schema doc. +- Fixed the issue of auto-complete failure in the IDE unification attributes. +- Supported the fine-grained completion of distinguishing attribute and value semantics when instantiating the Schema. +- KCL vim plugin updates the installation document. +- KCL vscode plugin removes the response to yaml files. +- KCL vscode plugin adds Apache 2.0 License. +- Fix the use of ':' in the Schema merge operator definition attribute instantiation completion. +- Fixed the unexpected completion in the Schema Doc. +- Fixed the kcl-language-server command-line version display issue. +- Supported the IDE to disable the save formatting configuration for NeoVim, VS Code, and other plugins. +- Removed the default key bindings of the KCL NeoVim plugin and supported user customization. +- Fixed the code highlighting failure of the first line and first column. +- Fixed the dead lock issue of the IDE. +- IDE adds more output logs. +- IDE optimizes the find ref function. +- IDE fixed the failure when update kcl.mod. +- IDE fixed the failure of finding reference. +- IDE fixed the failure of code highlighting when opening a file. +- LSD restructured some code structures and adjusted some API scopes. +- IDE fixed the issue of the IDE does not synchronize after updating dependencies with kpm. +- IDE fixed the panic caused by circular dependencies. +- IDE fixed the issue of auto-completion failure in the if expression. +- IDE fixed the failure of code highlighting for the Schema member with an index signature. +- KCL intellij IDE plugin supports LSP4IJ. #### API -WIP +- OverrideFile API supports using the `:` merge operator to automatically merge and modify configurations at compile time. +- Refactored the error message of the override_file API. +- Fixed the unexpected data formatting error of the KCL C API. +- Kotlin API complete test and case update, see https://www.kcl-lang.io/docs/reference/xlang-api/kotlin-api +- Lua API the mvs version, welcome to contribute, see https://github.com/kcl-lang/lib/tree/main/lua +- kcl-go API supports importing jsonschema. +- Added kcl_version API support for WASM host. ### 📦️ Standard Libraries and Third-Party Libraries #### Standard Libraries -WIP +- Added the file.current() function to get the full path of the current running KCL file. + +```kcl +import file + +a = file.current() +``` + +After compiling, you can get the following result: + +```kcl +a: /Users/xxx/xxx/main.k +``` + +- KCL added some built-in APIs parameters to support the encoding parameter. + +```kcl +sha512(value: str, encoding: str = "utf-8") -> str +``` + +- KCL has added a new built-in API, crypto.blake3, to support the use of the Blake algorithm for hashing. + +```kcl +import crypto +blake3 = crypto.blake3("ABCDEF") +``` + +- KCL has added a new built-in API, isnullish, to support determining whether a field is empty. + +```kcl +a = [100, 10, 100] +A = isnullish(a) +e = None +E = isnullish(e) +``` + +- KCL has added a new built-in API, datetime.validate, to support validating date content. + +```kcl +import datetime +assert datetime.validate("2024-08-26", "%Y-%m-%d") +``` #### Third-Party Libraries -WIP +- cluster-api-provider-azure updated to v1.16.0 +- cluster-api updated to v1.7.4 +- konfig updated to v0.6.0 +- karmada updated to v0.1.1 +- k8s updated to 1.31 +- gateway-api updated to 0.2.0 +- karpenter updated to 0.2.0 +- crossplane updated to 1.16.0 +- cilium updated to 0.3.0 +- external-secrets updated to 0.1.2 +- The New Modles List +- - fluxcd-kcl-controller +- - fluxcd-kustomize-controller +- - fluxcd-helm-controller +- - fluxcd-source-controller +- - fluxcd-image-reflector-controller +- - fluxcd-image-automation-controller +- - fluxcd-notification-controller +- - kwok +- - crossplane-provider-vault 1.0.0 +- - outdent 0.1.0 +- - kcl_lib 0.1.0 ### ☸️ Ecosystem Integration -WIP +- Flux KCL Controller released v0.4.0 version, aligning with most of the Flux Kustomize Controller functions to meet the needs of directly using KCL to replace Kustomize for Flux GitOps. +- KRM KCL Specification released v0.10.0 beta version, adding private Git repository pull and ignore TLS check functions. +- KCL Nix Package released v0.9.8 version. +- Crossplane KCL Function released v0.9.4 version, see https://github.com/crossplane-contrib/function-kcl +- KCL Bazel Rules updated to KCL v0.10.0 beta version, see https://github.com/kcl-lang/rules_kcl +- KCL Flux Controller passed the parameter optimization, added more test cases, and a more complete release and test process. ### 🧩 Multi-Language SDKs and Plugins #### Multi-Language SDKs -WIP +- KCL Go SDK supports interacting with the KCL core Rust API in RPC mode or CGO mode through build tags, with CGO mode enabled by default and RPC mode enabled by -tags rpc. +- New KCL C/C++ language SDK. +- Added Go, Java, Python, Rust, .NET, C/C++ and other multi-language API Specs, related documents, test cases, and use cases. +- Added KCL Kotlin and Swift language SDKs, which have not yet officially released dependency packages. Contributions are welcome. +- Added KCL WASM lib support for node.js and browser integration. +- Refactored and optimized the KCL Python/Go/Java code. +- KCL wasm SDK fixed the issue caused by the '\0' escape character. +- KCL lib supports cross-platform compilation. +- KCL wasm SDK adds some test cases. #### Multi-Language Plugins -WIP +- KCL Plugin supports development through Rust. +- Add more test cases for the KCL Plugin. + +### 📖 Documentation Updates + +- Added Python, Java, Node.js, Rust, Wasm, .NET, C/C++ and other multi-language API documents. +- Updated the IDE Quick Start document. +- New Blog "A Comparative Overview of Jsonnet and KCL". +- Updated the crd in "Adapt From Kubernetes CRD Resources" in the documentation. +- Added the KCL review article at kubecon 2024. +- Added the document for built-in API. +- Added the document for the integration of the package management tool with OCI registry and Git Repo. +- Added the document for `include` and `exclude` fields in the kcl.mod. +- Added FAQ about the `docker-credential-desktop not found` solution. +- Added reference documents for some resources in the konfig. +- Add API documentation for KCL wasm. +- Added API documentation for KCL Rust Plugin Development. +- Add FAQ document about the `mixin` and `protocol`. +- Fixed some document errors. ## 🌐 Other Resources diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2024-09-05-newsletter/index.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2024-09-05-newsletter/index.md index 5b04ec26..07c01c76 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-blog/2024-09-05-newsletter/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2024-09-05-newsletter/index.md @@ -74,7 +74,7 @@ assert datetime.validate("2024-08-26", "%Y-%m-%d") - 修复了第一行第一列代码高亮失效的问题。 - 修复了 IDE 偶发死锁的问题。 - IDE 增加了更多输出日志。 -- 优化了 scehma index signature key 的语义高亮。 +- 优化了 schema index signature key 的语义高亮。 - IDE find ref 功能优化。 - IDE 修复了更新 kcl.mod 失效的问题。 - IDE 修复了 find ref 错误。 diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2024-09-18-kcl-0.10.0-release/index.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2024-09-18-kcl-0.10.0-release/index.md index 68d99d6f..6097220d 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-blog/2024-09-18-kcl-0.10.0-release/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2024-09-18-kcl-0.10.0-release/index.md @@ -1,6 +1,6 @@ --- slug: 2024-07-05-kcl-0.10.0-release -title: KCL v0.10.0 重磅发布 - WIP +title: KCL v0.10.0 重磅发布 - 更稳定流畅的工具链和 IDE 体验,全新的 KCL Playground ! authors: name: KCL Team title: KCL Team @@ -11,7 +11,9 @@ tags: [Release Blog, KCL] KCL 团队很高兴地宣布 **KCL v0.10.0 新版本现在已经可用**!本次发布为大家带来了三方面的重点更新 -WIP +- _使用功能更完善和错误更少的 KCL 语言、工具链和 IDE 提升代码编写体验和效率_ +- _更加全面丰富的标准库、三方库以及社区生态集成,涵盖不同应用场景和需求_ +- _Wasm SDK 支持无缝的浏览器运行与全新的 KCL Playground_ [KCL](https://github.com/kcl-lang) 是一个 CNCF 基金会托管的基于约束的记录及函数语言,期望通过成熟的编程语言技术和实践来改进对大量繁杂配置比如云原生 Kubernetes 配置场景的编写,致力于构建围绕配置的更好的模块化、扩展性和稳定性,更简单的逻辑编写,以及更简单的自动化和生态工具集成。 @@ -19,7 +21,7 @@ WIP **感谢 KCL 在 v0.9 - v0.10 版本迭代过去 120 天中所有 120 位社区参与者,以下排名不分先后** -WIP +_@eshepelyuk, @haarchri, @liangyuanpeng, @logo749, @bilalba, @borgius, @patrick-hermann-sva, @ovk, @east4ming, @wmcnamee-coreweave, @steeling, @sschne, @Jacob Colvin, @Richard Holmes, @Christopher Haar, @Yvan da Silva, @Uladzislau Maher, @Sergey Ryabin, @Lukáš Kubín, @Alexander Fuchs, @Divyansh Choukse, @Vishalk91-4, @DavidChevallier, @dennybaa, @bozaro, @vietanhtwdk, @hoangndst, @patpicos, @metacoma, @karlderkaefer, @kukacz, @Matthew Hodgkins, @Gao Jun, @Zack Zhang, @briheet, @Moulick, @stmcginnis, @Manoramsharma, @NishantBansal2003, @varshith257, @Harsh4902, @Gmin2, @shishir-11, @RehanChalana, @Shruti78, @jianzs, @vinayakjaas, @ChrisK, @Lan Liang, @Endre Karlson, @suin, @v3xro, @soubinan, @juanzolotoochin, @mnacharov, @ron1, @vfarcic, @phisco, @juanique, @zackzhangverkada, @warmuuh, @novohool, @officialasishkumar, @cx2c, @yonas, @shruti2522, @nwmcsween, @trogowski, @johnallen3d, @riven-blade, @gesmit74, @prakhar479, @Peter Boat, @Stéphane Este-Gracias, @Josh West, @Brandon Nason, @Anany, @dansrogers, @diefans, @DrummyFloyd_ ## 📚 重点更新内容 @@ -27,43 +29,378 @@ WIP #### 语言 -WIP +- 赋值语句中被赋值对象支持属性访问和索引访问。 + +现在,你可以通过**索引访问**的方式对被赋值对象的内容进行更改。 + +```kcl +_a = [0, 1] * 2 +_a[0] = 2 +_a[1] += 2 +a = _a +``` + +通过编译,你将可以得到如下结果 + +```kcl +a: +- 2 +- 3 +``` + +你也可以通过**属性访问**的方式对被赋值对象的内容进行更改。 + +```kcl +_a = [{key1.key2 = [0] * 2}, {key3.key4 = [0] * 2}] +_a[0].key1.key2[0] = 1 +_a[1].key3.key4[1] += 1 +a = _a +``` + +通过编译,你可以得到如下结果: + +```kcl +a: +- key1: + key2: + - 1 + - 0 +- key3: + key4: + - 0 + - 1 +``` + +- 对类型为单子面值常量 Schema 属性支持省略默认值 + +```kcl +schema Deployment: + apiVersion: "apps/v1" = "apps/v1" +``` + +```kcl +schema Deployment: + apiVersion: "apps/v1" # 类型值与默认值相同,可以省略默认值 +``` + +- 修复了 KCL 嵌套多层 config 块语义检查时间过长的问题。 +- 去掉了语义解析器中的 unwrap() 语句, 减少 panic 的问题。 +- 修复了带有 list index 的字段合并运算的计算错误。 +- 修复 as 关键字在外部包存在时类型转换的错误 +- 修复在 lambda 函数中 config 到 schema 的类型检查错误 +- 优化函数参数调用/返回值 Dict 转 Schema 类型推导和检查,可以省略 Schema 名称简化配置书写 +- 赋值语句支持形如 _config["key"] = "value" 或 _config.key = "value"的语法对配置进行原地修改 +- 优化配置合并运算符的类型检查,可以在编译时发现更多类型错误 +- 修复了 built-in API datetime 中日期格式的问题。 +- 修复了 Schema 配置合并参数解析错误的问题。 +- 优化了 KCL 部分报错信息。 +- KCL 修复了 Schema 继承中循环依赖导致的异常错误。 +- KCL 修复了配置自动合并失效的问题。 +- KCL 优化了 Schema 继承中循环依赖的错误信息。 +- KCL 对编译入口部分代码进行了重构。 +- KCL 新增了 windows mingw 环境下链接库的 release。 +- KCL 修复了 windows 环境下的 CI 错误。 +- 优化了 KCL 运行时错误信息并且新增了部分测试用例。 #### 工具链 -WIP +- kcl test 测试工具支持测试用例中的 print 函数输出 + +你可以在测试用例中使用 `print` 输出日志 + +```kcl +test_print = lambda { + print("Test Begin ...") +} +``` + +通过 `kcl test` 命令运行测试用例,你可以看到对应日志: + +```kcl +test_print: PASS (9ms) +Test Begin ... + +-------------------------------------------------------------------------------- +PASS: 1/1 +``` + +- kcl import 工具新增对包含 AllOf 验证字段的 JSON Schema 格式导入为 KCL Schema 的支持 + +对于如下包含 AllOf 验证字段的 JSON Schema: + +```json +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://example.com/schemas/config", + "description": "Schema for representing a config information.", + "type": "object", + "properties": { + "name": { + "type": "string", + "allOf": [ + { + "pattern": "198.160" + }, + { + "pattern": "198.161" + }, + { + "pattern": "198.162" + } + ] + }, + "price": { + "type": "number", + "minimum": 0 + } + }, + "required": [ + "name" + ] +} +``` + +将会生成对应 KCL Schema: + +```kcl +""" +This file was generated by the KCL auto-gen tool. DO NOT EDIT. +Editing this file might prove futile when you re-run the KCL auto-gen generate command. +""" +import regex + +schema Config: + r""" + Schema for representing a config information. + + Attributes + ---------- + name : str, required + price : float, optional + """ + + name: str + price?: float + + check: + regex.match(name, r"198.160") + regex.match(name, r"198.161") + regex.match(name, r"198.162") + price >= 0 if price +``` + +- 包管理工具支持添加 Git 仓库中子包作为三方库。 + +通过如下命令,KCL 包管理工具支持添加 git 仓库中的某个子目录下的 KCL Package 作为三方库。 + +```shell +kcl mod add --git --commit +``` + +以 为例,添加这个仓库中的子目录中名为 cc 的 KCL package 作为依赖: + +```shell +kcl mod add cc --git https://github.com/kcl-lang/flask-demo-kcl-manifests.git --commit 8308200 +``` + +- 基于 wasm 后端的 kcl-playground 上线。 + +[kclplayground](/img/blog/2024-09-18-kcl-0.10.0-release/kclplayground.png) + +- kcl import 工具支持导入整个 Go Package 并将其中所有的 Go 结构体定义转换为 KCL Schema 定义 +- 修复 kcl import 在 Kubernetes CRD 和 OpenAPI 导入 Schema 的编译错误 +- 优化 kcl mod init 的输出格式 +- kcl fmt 工具支持保留用户在多个代码片段之间的空行,不会全部删除 +- 包管理工具修复了编译入口无法识别包相对路径 ${KCL_MOD} 的问题。 +- 包管理工具将 plainHttp 选项调整为可选。 +- 包管理工具修复了编译入口识别错误根目录的问题。 +- 包管理工具添加登录凭证的缓存,以降低安全风险。 +- 包管理工具修复了由于虚拟编译入口导致的编译失败问题。 +- 包管理工具修复了默认依赖在 kcl.mod 中的缺失。 +- 包管理工具修复了 vendor path 计算错误导致的三方库重新下载的问题。 +- 包管理工具修复了 push https 协议 OCI registry 失败的问题。 +- 包管理工具修复了多次添加 git 子包作为依赖时导致的循环依赖问题。 +- 包管理工具修复了 metadata 中三方库依赖路径丢失的问题。 +- 包管理工具 Add, Update 命令预载了 MVS 版本管理算法,通过环境变量 SupportMVS=true 控制开启。 +- 包管理工具修复了编译多个 *.k 文件失败的 bug。 +- 包管理工具新增部分测试用例。 +- KCL tree-sitter 新增 sequence operations, selector 支持。 +- KCL tree-sitter 优化了部分语法规则,添加了更多测试用例。 +- 修复 kcl fmt 工具对 Schema 索引签名注释错误的格式化位置 +- 修复 kcl import 导入 Kubernetes CRD 时设置 -o 参数非预期的报错 +- 修复 kcl import 导入空 Go 结构体输出非预期的 KCL Schema 错误 +- kcl-openapi 对代码结构和文档结构进行了优化和调整。 +- kcl-playground 添加了更多的测试用例,对工程结构体进行了优化和升级。 +- krm-kcl function 修复了部分测试和文档中的错误。 +- krm-kcl function 修复了依赖下载失败的问题。 +- kcl-operator 更新和修复了部分文档内容,优化了部分代码结构。 +- kcl-operator 新增部分测试用例,优化了发布流程。 +- kcl-operator 新增了初始化容器时的自动鉴权。 +- KCL fmt 工具提供了 C api。 +- KCL fmt 工具移除了 if 块中多余的空行。 #### IDE -WIP +- IDE 新增了对 schema 参数的 hints。 + +![schemaargshint](/img/blog/2024-09-18-kcl-0.10.0-release/schemaargshint.png) + +- 修正了 schema index signature key 的语义高亮。 +- 支持使用 kcl.work 配置文件划分 IDE 工作空间 +- 修复 Schema 示例化参数无法显示语义信息的问题 +- 修复了 IDE 中 schema doc 的错误补全。 +- 修复了 IDE 中 unification 块中定义的属性无法自动补全的问题。 +- 支持 Schema 实例化时区分属性和值语义的细粒度补全。 +- KCL vim 插件更新安装文档。 +- KCL vscode 插件移除了 yaml 文件的响应。 +- KCL vscode 插件补充了 Apache 2.0 License +- 修复 Schema 使用 : 合并运算符定义属性实例化时的补全 +- 修复在 Schema Doc 中非预期的补全 +- 修复 kcl-language-server 命令行版本显示问题 +- 支持 NeoVim, VS Code 等插件禁用保存时格式化配置 +- KCL NeoVim 插件移除默认的 key bindings, 支持用户自定义 +- 修复了第一行第一列代码高亮失效的问题。 +- 修复了 IDE 偶发死锁的问题。 +- IDE 增加了更多输出日志。 +- IDE find ref 功能优化。 +- IDE 修复了更新 kcl.mod 失效的问题。 +- IDE 修复了 find ref 错误。 +- IDE 修复了打开文件时代码高亮失败。 +- LSP 部分代码结构重构,调整了部分 API 的作用域。 +- IDE 修复了 kpm 更新依赖后,IDE 没有同步更新的问题。 +- IDE 修复了由循环依赖导致的崩溃。 +- IDE 修复了 find reference 在 minin 结构中的错误。 +- IDE 修复了 if 表达式中自动补全失效的问题。 +- IDE 修复了带有索引签名的 Schema 成员高亮失效的问题。 +- KCL intellij IDE 插件支持 LSP4IJ。 #### API -WIP +- OverrideFile API 支持使用 : 合并运算符在编译时对配置进行自动合并修改 +- 重构了 override_file API 的错误信息。 +- 修复 KCL C API 非预期的数据格式化错误。 +- Kotlin API 完整测试和用例更新,详见 https://www.kcl-lang.io/docs/reference/xlang-api/kotlin-api +- Lua API 产出初步版本,欢迎贡献,详见 https://github.com/kcl-lang/lib/tree/main/lua +- kcl-go API 支持 jsonschema 的导入。 +- 新增 kcl_version API 支持 WASM host。 ### 📦️ 标准库及三方库 #### 标准库 -WIP +- 新增 file.current() 函数用以获取当前运行 KCL 文件的全路径。 + +```kcl +import file + +a = file.current() +``` + +通过编译,你可以得到如下结果: + +```kcl +a: /Users/xxx/xxx/main.k # 当前编译的文件路径 +``` + +- 加密标准库新增参数,支持对参数传入参数进行编码。 + +```kcl +sha512(value: str, encoding: str = "utf-8") -> str +``` + +- 新增 built-in API crypto.blake3 支持使用 Blake 算法进行哈希加密。 + +```kcl +import crypto +blake3 = crypto.blake3("ABCDEF") +``` + +- 新增 built-in API isnullish 支持判断字段是否为空。 + +```kcl +a = [100, 10, 100] +A = isnullish(a) +e = None +E = isnullish(e) +``` + +- 新增 built-in API datetime.validate 支持验证日期内容。 + +```kcl +import datetime +assert datetime.validate("2024-08-26", "%Y-%m-%d") +``` #### 三方库 -WIP +- cluster-api-provider-azure 更新至 v1.16.0 +- cluster-api 更新至 v1.7.4 +- konfig 更新至 v0.6.0 +- karmada 更新至 v0.1.1 +- k8s 更新至 1.31 +- gateway-api 更新至 0.2.0 +- karpenter 更新至 0.2.0 +- crossplane 更新至 1.16.0 +- cilium 更新至 0.3.0 +- external-secrets 更新至 0.1.2 +- 新增模型列表 +- - fluxcd-kcl-controller +- - fluxcd-kustomize-controller +- - fluxcd-helm-controller +- - fluxcd-source-controller +- - fluxcd-image-reflector-controller +- - fluxcd-image-automation-controller +- - fluxcd-notification-controller +- - kwok +- - crossplane-provider-vault 1.0.0 +- - outdent 0.1.0 +- - kcl_lib 0.1.0 ### ☸️ 生态集成 -WIP +- Flux KCL Controller 发布 v0.4.0 版本,对齐绝大部份 Flux Kustomize Controller 功能,满足直接使用 KCL 代替 Kustomize 作 Flux GitOps 的需求 +- KRM KCL 规范发布 v0.10.0 beta 版本,新增私有 Git 仓库拉取和忽略 TLS 检查等功能 +- KCL Nix Package 发布 v0.9.8 版本 +- Crossplane KCL Function 发布 v0.9.4 版本,具体内容详见 https://github.com/crossplane-contrib/function-kcl +- KCL Bazel Rules 更新 KCL v0.10.0 beta 版本,具体内容详见 https://github.com/kcl-lang/rules_kcl +- Flux KCL Controller 传入参数优化, 新增更多的测试用例,更加完整的 release 和测试流程。 ### 🧩 多语言 SDK 和插件 #### 多语言 SDK -WIP +- KCL Go SDK 支持通过 build tags 区分以 RPC 模式还是 CGO 模式与 KCL 核心 Rust API 进行交互,默认为 CGO 模式,可以通过 -tags rpc 开启 RPC 模式 +- 新增 KCL C/C++ 语言 SDK。 +- 新增了 Go, Java, Python, Rust, .NET, C/C++ 等多语言 API Spec,相关文档,测试用例和使用案例。 +- 代码结构调整,go 相关代码移动的 go 文件目录中。 +- 新增 KCL Kotlin 和 Swift 语言初版 SDK,尚未正式发布依赖包,欢迎参与贡献 +- 新增 KCL wasm lib 支持 node.js 和 浏览器集成。 +- 重构优化了 KCL python/Go/Java 的部分代码。 +- KCL wasm SDK 修复了 '\0' 转义符号导致的问题。 +- KCL lib 支持跨平台编译。 +- KCL wasm SDK 增加部分测试用例。 #### 多语言插件更新 -WIP +- KCL Plugin 支持通过 Rust 开发。 +- 新增部分插件开发测试用例。 + +### 📖 文档更新 + +- 新增 Python, Java, Node.js, Rust, Wasm, .NET, C/C++ 等多语言 API 文档。 +- 更新了 IDE Quick Start 文档。 +- 新增博客 A Comparative Overview of Jsonnet and KCL +- 更新文档 Adapt From Kubernetes中的 crd 资源。 +- 新增了 KCL 在 kubecon 2024 的回顾文章。 +- 文档中增加了新增 built-in API 相关的文档。 +- 调整了文档中包管理工具与 OCI registry 和 Git Repo 部分集成的文档。 +- 新增了文档中关于 kcl.mod include 和 exclude 字段的描述。 +- 新增了关于 docker-credential-desktop not found 的解决方案。 +- 新增了 konfig 库部分资源的参考文档。 +- 新增了关于 KCL wasm 相关的 API 文档。 +- 新增了关于 Rust 开发 KCL 插件相关的 API。 +- 新增了关于 mixin 和 protocol 相关的 FAQ 文档。 +- 修复了部分文档错误。 ## 🌐 其他资源 diff --git a/static/img/blog/2024-09-18-kcl-0.10.0-release/kclplayground.png b/static/img/blog/2024-09-18-kcl-0.10.0-release/kclplayground.png new file mode 100644 index 00000000..33252c0f Binary files /dev/null and b/static/img/blog/2024-09-18-kcl-0.10.0-release/kclplayground.png differ diff --git a/static/img/blog/2024-09-18-kcl-0.10.0-release/schemaargshint.png b/static/img/blog/2024-09-18-kcl-0.10.0-release/schemaargshint.png new file mode 100644 index 00000000..ef6e6451 Binary files /dev/null and b/static/img/blog/2024-09-18-kcl-0.10.0-release/schemaargshint.png differ