rspack icon indicating copy to clipboard operation
rspack copied to clipboard

perf(rspack_core): replace `HASH_PLACEHOLDER_REGEX` with simple string parsing

Open shulaoda opened this issue 1 year ago • 1 comments

Summary

Related to https://github.com/rolldown/rolldown/pull/1496 and https://github.com/oxc-project/oxc/issues/5586

I'm not sure if the hash pattern appears only once. If there are cases where the pattern appears multiple times, such as [hash]-[hash:6].js, I need to optimize further.

Checklist

  • [ ] Tests updated (or not required).
  • [ ] Documentation updated (or not required).

shulaoda avatar Sep 15 '24 13:09 shulaoda

Deploy Preview for rspack canceled.

Built without sensitive environment variables

Name Link
Latest commit a06f078ee77c66f45eeb4a6ac35ee7b57e94eca8
Latest deploy log https://app.netlify.com/sites/rspack/deploys/670640b86100ef0008c9cd22

netlify[bot] avatar Sep 15 '24 13:09 netlify[bot]

@shulaoda can you resolve the conflicts? ❤️

chenjiahan avatar Oct 08 '24 13:10 chenjiahan

Wasn't the issue in the description had been resolved? I think this is necessary.

I'm not sure if the hash pattern appears only once. If there are cases where the pattern appears multiple times, such as [hash]-[hash:6].js, I need to optimize further.

let result = replace_all_hash_pattern("hello-[hash]-[hash:5].js", "[hash]", |n| {
    &"abcdefgh"[..n.unwrap_or(8)]
  });
 assert_eq!(result, Some("hello-abcdefgh-abcde.js".to_string()));

h-a-n-a avatar Oct 10 '24 09:10 h-a-n-a

Wasn't the issue in the description had been resolved? I think this is necessary.

Sorry. This is a PR from a long time ago, and I fixed the issues in the description later. I have revised the description.

shulaoda avatar Oct 10 '24 09:10 shulaoda