Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: define stringified object value will cause panic #1349

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

xusd320
Copy link
Contributor

@xusd320 xusd320 commented Jul 1, 2024

close #1347

Summary by CodeRabbit

  • 新功能

    • 修改了字符串内容作为表达式的解析方式,在特定上下文中进行解析。
    • 增加了新的测试函数 test_stringified_env,用于测试字符串化的环境值。
  • 改进

    • 更新了 get_env_expr 方法中的解析逻辑,通过在解析前将字符串内容用括号包裹。
    • mako.config.json 文件中修改了 define 对象的结构和键值。
    • index.tsx 文件中添加了多种测试用例,确保不同类型值的正确性。
  • 重构

    • expect.js 文件的功能重构,移除了与内容检查相关的断言,专注于注入 Jest 并引入 index.js 文件。

Copy link
Contributor

coderabbitai bot commented Jul 1, 2024

演练

最近的改动涉及改进处理字符串作为表达式的方式,通过在特定上下文中对其进行解析。这包括修正了 get_env_expr 函数中的逻辑,添加了对字符串值的条件检查和转换。此外,还在 env_replacer.rs 文件中引入了新的字符串化环境值处理和测试。

更改

文件路径 变更概要
crates/mako/src/visitors/env_replacer.rs 添加了 FromStr 导入,修改 get_env_expr 函数逻辑,添加字符串值的条件转换,调整字符串内容的解析,并添加新的测试函数 test_stringified_env
e2e/fixtures/config.define/expect.js 对测试文件 expect.js 进行了重构,去掉了内容检查相关的断言,转而注入 Jest 并引入 index.js 文件。
e2e/fixtures/config.define/mako.config.json 修改了 define 对象的结构,更新了多个键值的值,加入了新的键 III
e2e/fixtures/config.define/src/index.tsx index.tsx 文件中添加了多个测试用例,验证不同数据类型(字符串、数字、布尔值、null、数组、计算、复杂对象、字符串化对象)的正确性。

评估vs关联问题

目标 Addressed 解释
解析字符串化对象时防止报错 (#1347)
模仿 webpack 的 define 转换逻辑 (#1347)

诗歌

在代码的丛林里,我们探索新的路,
字符串化对象,无需再畏惧,
调整与改进,让解析更加明晰,
测试与配置,同步走在创新的轨迹。
🐰✨


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 95af4fd and a305044.

Files selected for processing (4)
  • crates/mako/src/visitors/env_replacer.rs (1 hunks)
  • e2e/fixtures/config.define/expect.js (1 hunks)
  • e2e/fixtures/config.define/mako.config.json (1 hunks)
  • e2e/fixtures/config.define/src/index.tsx (1 hunks)
Additional comments not posted (20)
e2e/fixtures/config.define/expect.js (2)

1-2: 更改已批准!

导入更新为 injectSimpleJestdistDir 看起来正确。


4-5: 更改已批准!

添加对 injectSimpleJest 的调用并更新 require 路径以使用 distDir 看起来正确。

e2e/fixtures/config.define/mako.config.json (8)

5-5: 更改已批准!

BBB 的值更新为 1 看起来正确。


6-6: 更改已批准!

CCC 的值更新为 true 看起来正确。


7-7: 更改已批准!

DDD 的值更新为 false 看起来正确。


8-8: 更改已批准!

EEE 的值更新为 null 看起来正确。


9-12: 更改已批准!

FFF 的值更新为数组 [\"a\", 1] 看起来正确。


13-13: 更改已批准!

GGG 的值更新为 "1+1" 看起来正确。


14-25: 更改已批准!

HHH 的值更新为复杂对象看起来正确。


26-26: 更改已批准!

添加新的键 III 并将其值设置为字符串化的对象看起来正确。

e2e/fixtures/config.define/src/index.tsx (9)

3-5: 更改已批准!

添加测试以检查定义的字符串值看起来正确。


6-8: 更改已批准!

添加测试以检查定义的数值看起来正确。


9-11: 更改已批准!

添加测试以检查定义的布尔值 true 看起来正确。


12-14: 更改已批准!

添加测试以检查定义的布尔值 false 看起来正确。


15-17: 更改已批准!

添加测试以检查定义的 null 值看起来正确。


18-20: 更改已批准!

添加测试以检查定义的数组值看起来正确。


21-23: 更改已批准!

添加测试以检查定义的计算值看起来正确。


24-37: 更改已批准!

添加测试以检查定义的复杂对象值看起来正确。


38-40: 更改已批准!

添加测试以检查定义的字符串化对象值看起来正确。

crates/mako/src/visitors/env_replacer.rs (1)

194-198: 更改已批准!

将字符串值用括号包裹起来以确保正确解析看起来正确。

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 95af4fd and a305044.

Files selected for processing (4)
  • crates/mako/src/visitors/env_replacer.rs (1 hunks)
  • e2e/fixtures/config.define/expect.js (1 hunks)
  • e2e/fixtures/config.define/mako.config.json (1 hunks)
  • e2e/fixtures/config.define/src/index.tsx (1 hunks)
Additional comments not posted (21)
e2e/fixtures/config.define/expect.js (4)

1-1: 导入的模块 injectSimpleJest 需要验证。

确保 injectSimpleJest 模块的正确性和必要性。

Verification successful

导入的模块 injectSimpleJest 已验证。

  • injectSimpleJestscripts/test-utils.js 中定义并实现。
  • 它设置了全局的测试函数和 Jest 的 expect 函数。
  • 该模块在多个测试文件中使用,证明其必要性和功能性。
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence and usage of `injectSimpleJest` in the codebase.

# Test: Search for the module definition. Expect: Only relevant module definition.
rg --type js $'injectSimpleJest'

Length of output: 17735



Script:

#!/bin/bash
# Extract the implementation of the `injectSimpleJest` function from `scripts/test-utils.js`.
ast-grep --lang javascript --pattern $'const injectSimpleJest = () => {
  $$$
}' scripts/test-utils.js

Length of output: 1151


4-4: 调用 injectSimpleJest 需要验证其效果。

确保 injectSimpleJest 的调用是必要且正确的。

Verification successful

调用 injectSimpleJest 是必要且正确的。

injectSimpleJest 函数定义了全局的 itexpect 函数,提供了一个简单的 Jest 测试环境。它记录测试结果并处理忽略的测试。这在测试文件中是必需的,使用是合理的。

  • scripts/test-utils.js 中的 injectSimpleJest 实现
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the effects of `injectSimpleJest` in the codebase.

# Test: Search for the function usage. Expect: Only relevant function usage.
rg --type js $'injectSimpleJest'

Length of output: 17735



Script:

#!/bin/bash
# Description: Retrieve the implementation of the `injectSimpleJest` function to understand its purpose and usage.

# Locate and display the implementation of the `injectSimpleJest` function.
ast-grep --lang javascript --pattern 'const injectSimpleJest = () => { $$$ }' scripts/test-utils.js

Length of output: 1149


2-2: 变量名 distDir 需要进一步验证。

确保 distDir 变量的定义和使用是正确的。

Verification successful

变量名 distDir 定义和使用正确。

  • parseBuildResult 函数正确返回包含 distDir 的对象。
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the variable `distDir` in the codebase.

# Test: Search for the variable definition. Expect: Only relevant variable definition.
rg --type js $'distDir'

Length of output: 1403



Script:

#!/bin/bash
# Description: Verify the implementation of `parseBuildResult` to ensure it returns an object with `distDir`.

# Find the implementation of `parseBuildResult`.
rg --type js 'function parseBuildResult'

# Check the content of the file where `parseBuildResult` is implemented.
rg 'parseBuildResult' --files-with-matches | xargs cat

Length of output: 117463


5-5: 确保路径 distDir 的正确性。

验证 path.join(distDir, 'index.js') 的路径是否正确。

e2e/fixtures/config.define/mako.config.json (8)

8-8: 新增 EEE 的值需要验证。

确保新增 EEE 的值为 null 是预期的更改。

Verification successful

新增 EEE 的值为 null 是预期的更改。

  • e2e/fixtures/config.define/mako.config.json: EEE 键的值被正确地设置为 null
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the changes to `EEE` in the codebase.

# Test: Search for the key `EEE`. Expect: Only relevant key usage.
rg --type json $'"EEE"'

Length of output: 85


5-5: 更改 BBB 的值需要验证。

确保将 BBB 从对象更改为 1 是预期的更改。

Verification successful

更改 BBB 的值需要验证。

已验证 BBB 仅在 e2e/fixtures/config.define/mako.config.json 文件中使用。更改为 1 是预期的更改。

  • e2e/fixtures/config.define/mako.config.json: BBB 的值已更改为 1
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the changes to `BBB` in the codebase.

# Test: Search for the key `BBB`. Expect: Only relevant key usage.
rg --type json $'"BBB"'

Length of output: 82


26-26: 新增 III 的值需要验证。

确保新增 III 的值为 {"v": 1} 是预期的更改。

Verification successful

新增 III 的值需要验证。

已确认新增 III 的值为 {"v": 1} 是预期的更改。

  • 位置:
    • e2e/fixtures/config.define/mako.config.json: 第26行
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the changes to `III` in the codebase.

# Test: Search for the key `III`. Expect: Only relevant key usage.
rg --type json $'"III"'

Length of output: 92


6-6: 新增 CCC 的值需要验证。

确保新增 CCC 的值为 true 是预期的更改。

Verification successful

新增 CCC 的值需要验证。

验证结果显示,CCC 的值为 true 是预期的更改。这在 e2e/fixtures/config.define/src/index.tsx 文件中的测试用例中得到了验证。

  • e2e/fixtures/config.define/mako.config.json: "CCC": true
  • e2e/fixtures/config.define/src/index.tsx: expect(CCC).toEqual(true)
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the changes to `CCC` in the codebase.

# Test: Search for the key `CCC`. Expect: Only relevant key usage.
rg --type json $'"CCC"'

Length of output: 85



Script:

#!/bin/bash
# Description: Verify the changes to `CCC` in the codebase.

# Search for references to `CCC` in the codebase to understand its expected value.
rg 'CCC'

Length of output: 203


9-12: 更改 FFF 的值需要验证。

确保将 FFF 的值更改为 ["a", 1] 是预期的更改。

Verification successful

更改 FFF 的值已验证。

确认 FFF 的值更改为 ["a", 1] 是预期的更改。

  • 位置: e2e/fixtures/config.define/mako.config.json 文件中的第 9-12 行
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the changes to `FFF` in the codebase.

# Test: Search for the key `FFF`. Expect: Only relevant key usage.
rg --type json $'"FFF"'

Length of output: 81



Script:

#!/bin/bash
# Display the contents of the JSON file to verify the context of the change to `FFF`.
cat e2e/fixtures/config.define/mako.config.json

Length of output: 442


7-7: 新增 DDD 的值需要验证。

确保新增 DDD 的值为 false 是预期的更改。

Verification successful

新增 DDD 的值需要验证。

已验证 DDD 的值为 false 是预期的更改。

  • e2e/fixtures.umi/config.define/pages/index.tsx: console.log(DDD);
  • e2e/fixtures/config.define/mako.config.json: "DDD": false,
  • e2e/fixtures/config.define/src/index.tsx: expect(DDD).toEqual(false)
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the changes to `DDD` in the codebase.

# Test: Search for the key `DDD`. Expect: Only relevant key usage.
rg --type json $'"DDD"'

Length of output: 86



Script:

#!/bin/bash
# Description: Search for references to `DDD` across the entire codebase to verify its intended usage.

# Test: Search for the key `DDD`. Expect: Find all relevant references.
rg 'DDD'

Length of output: 205


14-25: 更改 HHH 的值需要验证。

确保将 HHH 的值更改为嵌套对象是预期的更改。

Verification successful

更改 HHH 的值已验证。

根据 git 日志的证据和 HHH 的有限使用情况,可以得出结论,此更改是有意的,不需要进一步验证。

  • e2e/fixtures/config.define/mako.config.json
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the changes to `HHH` in the codebase.

# Test: Search for the key `HHH`. Expect: Only relevant key usage.
rg --type json $'"HHH"'

Length of output: 81



Script:

#!/bin/bash
# Description: Check the git history for changes to `e2e/fixtures/config.define/mako.config.json`.

# Fetch the git log for the specific file to understand the context of changes.
git log -p e2e/fixtures/config.define/mako.config.json

Length of output: 2104


13-13: 更改 GGG 的值需要验证。

确保将 GGG 的值更改为 "1+1" 是预期的更改。

e2e/fixtures/config.define/src/index.tsx (8)

24-37: 测试用例 defined complex object value should be right 需要验证。

确保测试用例的预期结果是正确的。


9-11: 测试用例 defined boolean true value should be right 需要验证。

确保测试用例的预期结果是正确的。

Verification successful

测试用例 defined boolean true value should be right 通过验证。

  • CCC 的值在 e2e/fixtures/config.define/mako.config.json 中被正确地设置为 true
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the test case `defined boolean true value should be right` in the codebase.

# Test: Search for the test case. Expect: Only relevant test case.
rg --type tsx $'defined boolean true value should be right'

Length of output: 88



Script:

#!/bin/bash
# Description: Verify the test case `defined boolean true value should be right` in the codebase.

# Test: Search for the test case. Expect: Only relevant test case.
rg $'defined boolean true value should be right'

Length of output: 147



Script:

#!/bin/bash
# Description: Verify the definition of `CCC` to ensure it is set to `true`.

# Search for the definition of `CCC` in the codebase.
rg 'CCC'

Length of output: 203


3-5: 测试用例 defined string value should be right 需要验证。

确保测试用例的预期结果是正确的。

Verification successful

测试用例 defined string value should be right 验证通过。

  • AAAe2e/fixtures/config.define/mako.config.json 中定义为 "aaa",测试用例的预期结果是正确的。
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the test case `defined string value should be right` in the codebase.

# Test: Search for the test case. Expect: Only relevant test case.
rg --type tsx $'defined string value should be right'

Length of output: 82



Script:

#!/bin/bash
# Description: Verify the test case `defined string value should be right` in the codebase.

# Test: Search for the test case. Expect: Only relevant test case.
rg 'defined string value should be right'

Length of output: 135



Script:

#!/bin/bash
# Description: Verify the definition and value of `AAA` in the codebase.

# Test: Search for the definition of `AAA`. Expect: The value should be "aaa".
rg 'AAA'

Length of output: 209


6-8: 测试用例 defined number value should be right 需要验证。

确保测试用例的预期结果是正确的。

Verification successful

测试用例 defined number value should be right 已验证。

测试用例的预期结果是正确的,BBB 的值在 e2e/fixtures/config.define/mako.config.json 中定义为 1

  • e2e/fixtures/config.define/mako.config.json: "BBB": 1
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the test case `defined number value should be right` in the codebase.

# Test: Search for the test case. Expect: Only relevant test case.
rg --type tsx $'defined number value should be right'

Length of output: 82



Script:

#!/bin/bash
# Description: Verify the test case `defined number value should be right` in the codebase.

# Test: Search for the test case in TypeScript files.
rg 'defined number value should be right' --glob '**/*.tsx'

Length of output: 153



Script:

#!/bin/bash
# Description: Verify the value of `BBB` in the test case `defined number value should be right`.

# Search for the definition of `BBB` in the relevant file.
rg 'BBB' e2e/fixtures/config.define/src/index.tsx

Length of output: 74



Script:

#!/bin/bash
# Description: Verify the value of `BBB` in the test case `defined number value should be right`.

# Search for the definition of `BBB` in the entire codebase.
rg 'BBB'

Length of output: 197


38-40: 测试用例 defined stringified object value should be right 需要验证。

确保测试用例的预期结果是正确的。

Verification successful

测试用例 defined stringified object value should be right 的预期结果是正确的。

  • IIIe2e/fixtures/config.define/mako.config.json 中被定义为 {"v": 1},与测试用例中的预期结果一致。
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the test case `defined stringified object value should be right` in the codebase.

# Test: Search for the test case. Expect: Only relevant test case.
rg --type tsx $'defined stringified object value should be right'

Length of output: 94



Script:

#!/bin/bash
# Description: Verify the test case `defined stringified object value should be right` in the codebase.

# Test: Search for the test case. Expect: Only relevant test case.
rg --type ts 'defined stringified object value should be right'

Length of output: 169



Script:

#!/bin/bash
# Description: Locate the definition of `III` in the codebase to verify its value.

# Search for the definition of `III`. Expect: Only relevant definition.
rg --type ts 'const III' 

Length of output: 26



Script:

#!/bin/bash
# Description: Broaden the search for the definition or import of `III` in the relevant file.

# Search for any occurrence of `III` in the relevant file.
rg 'III' e2e/fixtures/config.define/src/index.tsx

Length of output: 81



Script:

#!/bin/bash
# Description: Search for the definition or import of `III` in the entire codebase.

# Search for any occurrence of `III` in the entire codebase.
rg 'III'

Length of output: 149


15-17: 测试用例 defined null value should be right 需要验证。

确保测试用例的预期结果是正确的。

Verification successful

测试用例 defined null value should be right 需要验证。

已验证测试用例的预期结果是正确的,EEEe2e/fixtures/config.define/mako.config.json 文件中被定义为 null

  • e2e/fixtures/config.define/mako.config.json: "EEE": null
  • e2e/fixtures/config.define/src/index.tsx: expect(EEE).toEqual(null)
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the test case `defined null value should be right` in the codebase.

# Test: Search for the test case. Expect: Only relevant test case.
rg --type tsx $'defined null value should be right'

Length of output: 80



Script:

#!/bin/bash
# Description: Verify the test case `defined null value should be right` in the codebase.

# Test: Search for the test case. Expect: Only relevant test case.
rg 'defined null value should be right' --glob '*.tsx'

Length of output: 146



Script:

#!/bin/bash
# Description: Verify the definition of `EEE` in the file `e2e/fixtures/config.define/src/index.tsx`.

# Test: Search for the definition of `EEE`. Expect: `EEE` should be defined as `null`.
rg 'EEE' e2e/fixtures/config.define/src/index.tsx

Length of output: 77



Script:

#!/bin/bash
# Description: Verify the definition of `EEE` in the codebase.

# Test: Search for the definition of `EEE`. Expect: `EEE` should be defined as `null`.
rg 'EEE' --glob '*.tsx'

Length of output: 157



Script:

#!/bin/bash
# Description: Verify the definition of `EEE` in the entire codebase.

# Test: Search for the definition of `EEE`. Expect: `EEE` should be defined as `null`.
rg 'EEE'

Length of output: 483


21-23: 测试用例 defined caculcation value should be right 需要验证。

确保测试用例的预期结果是正确的。


18-20: 测试用例 defined array value should be right 需要验证。

确保测试用例的预期结果是正确的。

crates/mako/src/visitors/env_replacer.rs (1)

194-199: 修改 get_env_expr 函数以解析字符串内容

确保将字符串内容包装在括号中进行解析是正确的更改。

e2e/fixtures/config.define/src/index.tsx Show resolved Hide resolved
@PeachScript PeachScript linked an issue Jul 1, 2024 that may be closed by this pull request
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a305044 and 57ff2c7.

Files selected for processing (1)
  • crates/mako/src/visitors/env_replacer.rs (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • crates/mako/src/visitors/env_replacer.rs

@xusd320 xusd320 changed the title fix: define stringified object value will cause panic [WIP] fix: define stringified object value will cause panic Jul 1, 2024
@xusd320 xusd320 changed the title [WIP] fix: define stringified object value will cause panic fix: define stringified object value will cause panic Jul 1, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 57ff2c7 and 7ba0a94.

Files selected for processing (1)
  • crates/mako/src/visitors/env_replacer.rs (3 hunks)
Additional comments not posted (2)
crates/mako/src/visitors/env_replacer.rs (2)

2-2: 添加 FromStr 导入。

这个导入是为了支持新的逻辑,将字符串值解析为表达式,这与 PR 的目标一致。


372-385: 新增测试函数 test_stringified_env

此测试函数检查字符串化 JSON 对象的正确处理,这与 PR 的目标一致。

crates/mako/src/visitors/env_replacer.rs Show resolved Hide resolved
@sorrycc sorrycc merged commit e6bf32c into master Jul 3, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: parse stringified obj failed from define config
2 participants