rolldown-plugin-dts-snapshot 0.3.1 → 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.
@@ -189,6 +189,12 @@ function walk(ast, { enter, leave }) {
189
189
  return new SyncWalker(enter, leave).visit(ast, null);
190
190
  }
191
191
 
192
+ //#endregion
193
+ //#region src/utils.ts
194
+ function sortObjectKeys(obj) {
195
+ return Object.fromEntries(Object.entries(obj).toSorted(([a], [b]) => a.localeCompare(b)));
196
+ }
197
+
192
198
  //#endregion
193
199
  //#region src/api.ts
194
200
  const multilineCommentsRE = /\/\*.*?\*\//gs;
@@ -230,7 +236,7 @@ function snapshot(code, fileName = "dummy.d.ts", { applyExportRename = true } =
230
236
  if (local !== exported) result[exported] = result[local];
231
237
  }
232
238
  }
233
- return result;
239
+ return sortObjectKeys(result);
234
240
  function nodeToString(node) {
235
241
  return node.type === "Identifier" ? node.name : node.type === "Literal" ? node.value : slice(node);
236
242
  }
@@ -258,4 +264,4 @@ function format(code) {
258
264
  }
259
265
 
260
266
  //#endregion
261
- export { snapshot as t };
267
+ export { sortObjectKeys as n, snapshot as t };
package/dist/api.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as snapshot } from "./api-CwtN2Sj6.mjs";
1
+ import { t as snapshot } from "./api-DMJmjM2B.mjs";
2
2
 
3
3
  export { snapshot };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as snapshot } from "./api-CwtN2Sj6.mjs";
1
+ import { n as sortObjectKeys, t as snapshot } from "./api-DMJmjM2B.mjs";
2
2
  import { writeFile } from "node:fs/promises";
3
3
  import { createFilter } from "unplugin-utils";
4
4
 
@@ -22,7 +22,7 @@ function DtsSnapshot({ include = RE_DTS, exclude, includeNonExport = true, saveT
22
22
  map["#exports"] = chunk.exports;
23
23
  }
24
24
  }
25
- await writeFile(saveTo, `${JSON.stringify(result, null, 2)}\n`);
25
+ await writeFile(saveTo, `${JSON.stringify(sortObjectKeys(result), null, 2)}\n`);
26
26
  }
27
27
  }
28
28
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rolldown-plugin-dts-snapshot",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "description": "DTS snapshot plugin for Rolldown",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",