Skip to content

fix: normalize multiple backslash \\ win path in string#16

Merged
SoonIter merged 1 commit intorstackjs:mainfrom
colinaaa:colin/0605/path-string
Jun 5, 2025
Merged

fix: normalize multiple backslash \\ win path in string#16
SoonIter merged 1 commit intorstackjs:mainfrom
colinaaa:colin/0605/path-string

Conversation

@colinaaa
Copy link
Copy Markdown
Contributor

@colinaaa colinaaa commented Jun 5, 2025

We are using @rspack/test-tools with hot snapshot cases. We are generating the following code:

function App() {
    const value = "content 3";
    return __RenderContent(/*#__PURE__*/ (0,_lynx_js_react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(__snapshot_4953c_00662_1, {
        children: value
    }, void 0, false, {
        fileName: "C:\\Users\\Admin\\colin\\lynx-stack\\packages\\webpack\\react-refresh-webpack-plugin\\test\\hotCases\\jsx\\value\\app.jsx",
        lineNumber: 3,
        columnNumber: 26
    }, this));
}

And the content of it would be placed in another string and normalized by path-serializer. And it become:

function App() {
    const value = "content 3";
    return __RenderContent(/*#__PURE__*/ (0,_lynx_js_react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(__snapshot_4953c_00662_1, {
        children: value
    }, void 0, false, {
        fileName: "/c/\Users\\Admin\\colin\\lynx-stack\\packages\\webpack\\react-refresh-webpack-plugin\\test\\hotCases\\jsx\\value\\app.jsx",
        lineNumber: 3,
        columnNumber: 26
    }, this));
}

@chenjiahan chenjiahan requested a review from SoonIter June 5, 2025 14:57
@SoonIter SoonIter changed the title fix: normalize path in string fix: normalize multiple backslash \\ win path in string Jun 5, 2025
@SoonIter SoonIter merged commit cabec7b into rstackjs:main Jun 5, 2025
2 checks passed
@colinaaa colinaaa deleted the colin/0605/path-string branch June 5, 2025 16:00
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.

2 participants