path-serializer 0.3.0 → 0.3.2

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.
@@ -48,7 +48,7 @@ declare interface Features {
48
48
  /**
49
49
  * \u001b[1mBold Text\u001b[0m
50
50
  * -> <CLR=BOLD>Bold Text<CLR=0>
51
- * @default false
51
+ * @default true
52
52
  */
53
53
  transformCLR?: boolean;
54
54
  }
package/dist/cjs/index.js CHANGED
@@ -871,10 +871,12 @@ function __webpack_require__(moduleId) {
871
871
  const normalizeCodeToPosix = (code)=>code.replace(// ignore http, https, file
872
872
  /(?<![a-zA-Z])([a-zA-Z]:[\\/])([-\u4e00-\u9fa5\w\s.()~!@#$%^&()\[\]{}+=]+[\\/])*/g, (match, _diskName)=>normalizePathToPosix(match));
873
873
  const normalizeCLR = (str)=>str.replace(/\u001b\[1m\u001b\[([0-9;]*)m/g, '<CLR=$1,BOLD>').replace(/\u001b\[1m/g, '<CLR=BOLD>').replace(/\u001b\[39m\u001b\[22m/g, '</CLR>').replace(/\u001b\[([0-9;]*)m/g, '<CLR=$1>') // CHANGE: The time unit display in Rspack is second
874
- .replace(/[.0-9]+(<\/CLR>)?(\s?s)/g, 'X$1$2');
874
+ // CHANGE2: avoid a bad case "./react/assets.svg" -> "./react/assetsXsvg"
875
+ // modified based on https://github.com/webpack/webpack/blob/001cab14692eb9a833c6b56709edbab547e291a1/test/StatsTestCases.basictest.js#L199
876
+ .replace(/[0-9]+[.0-9]*(<\/CLR>)?(\s?s)/g, 'X$1$2');
875
877
  function createSnapshotSerializer(options) {
876
878
  const { root = process.cwd(), workspace = '', replace: customMatchers = [], replacePost: customPostMatchers = [], features = {} } = options || {};
877
- const { replaceRoot = true, replaceWorkspace = true, replacePnpmInner = true, replaceTmpDir = true, replaceHomeDir = true, addDoubleQuotes = true, transformWin32Path = true, escapeDoubleQuotes = true, escapeEOL = true, transformCLR = false } = features;
879
+ const { replaceRoot = true, replaceWorkspace = true, replacePnpmInner = true, replaceTmpDir = true, replaceHomeDir = true, addDoubleQuotes = true, transformWin32Path = true, escapeDoubleQuotes = true, escapeEOL = true, transformCLR = true } = features;
878
880
  function createPathMatchers() {
879
881
  const pathMatchers = [];
880
882
  pathMatchers.push(...customMatchers);
@@ -48,7 +48,7 @@ declare interface Features {
48
48
  /**
49
49
  * \u001b[1mBold Text\u001b[0m
50
50
  * -> <CLR=BOLD>Bold Text<CLR=0>
51
- * @default false
51
+ * @default true
52
52
  */
53
53
  transformCLR?: boolean;
54
54
  }
@@ -846,10 +846,12 @@ const normalizePathToPosix = (p)=>upath_default().normalizeSafe(__WEBPACK_EXTERN
846
846
  const normalizeCodeToPosix = (code)=>code.replace(// ignore http, https, file
847
847
  /(?<![a-zA-Z])([a-zA-Z]:[\\/])([-\u4e00-\u9fa5\w\s.()~!@#$%^&()\[\]{}+=]+[\\/])*/g, (match, _diskName)=>normalizePathToPosix(match));
848
848
  const normalizeCLR = (str)=>str.replace(/\u001b\[1m\u001b\[([0-9;]*)m/g, '<CLR=$1,BOLD>').replace(/\u001b\[1m/g, '<CLR=BOLD>').replace(/\u001b\[39m\u001b\[22m/g, '</CLR>').replace(/\u001b\[([0-9;]*)m/g, '<CLR=$1>') // CHANGE: The time unit display in Rspack is second
849
- .replace(/[.0-9]+(<\/CLR>)?(\s?s)/g, 'X$1$2');
849
+ // CHANGE2: avoid a bad case "./react/assets.svg" -> "./react/assetsXsvg"
850
+ // modified based on https://github.com/webpack/webpack/blob/001cab14692eb9a833c6b56709edbab547e291a1/test/StatsTestCases.basictest.js#L199
851
+ .replace(/[0-9]+[.0-9]*(<\/CLR>)?(\s?s)/g, 'X$1$2');
850
852
  function createSnapshotSerializer(options) {
851
853
  const { root = process.cwd(), workspace = '', replace: customMatchers = [], replacePost: customPostMatchers = [], features = {} } = options || {};
852
- const { replaceRoot = true, replaceWorkspace = true, replacePnpmInner = true, replaceTmpDir = true, replaceHomeDir = true, addDoubleQuotes = true, transformWin32Path = true, escapeDoubleQuotes = true, escapeEOL = true, transformCLR = false } = features;
854
+ const { replaceRoot = true, replaceWorkspace = true, replacePnpmInner = true, replaceTmpDir = true, replaceHomeDir = true, addDoubleQuotes = true, transformWin32Path = true, escapeDoubleQuotes = true, escapeEOL = true, transformCLR = true } = features;
853
855
  function createPathMatchers() {
854
856
  const pathMatchers = [];
855
857
  pathMatchers.push(...customMatchers);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "path-serializer",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "path-serializer",
5
5
  "keywords": [
6
6
  "snapshot",