@tsed/barrels 6.5.0 → 6.6.0

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.
@@ -4,6 +4,16 @@ import {join as joinPosix} from "node:path/posix";
4
4
 
5
5
  import {globby} from "globby";
6
6
 
7
+ function preprocess(str) {
8
+ return str.replace(/\./g, "\u0001").replace(/\//g, "\u0002");
9
+ }
10
+
11
+ function compare(a, b) {
12
+ const pa = preprocess(a);
13
+ const pb = preprocess(b);
14
+ return pa < pb ? -1 : pa > pb ? 1 : 0;
15
+ }
16
+
7
17
  async function generateIndex(directory, {cwd, excluded, noSemicolon, singleQuotes}) {
8
18
  const baseIndex = join(cwd, directory?.path ?? directory);
9
19
 
@@ -13,7 +23,7 @@ async function generateIndex(directory, {cwd, excluded, noSemicolon, singleQuote
13
23
  const quote = singleQuotes ? "'" : '"';
14
24
 
15
25
  const exports = files
16
- .sort((a, b) => a.localeCompare(b))
26
+ .sort((a, b) => compare(a, b))
17
27
  .map((file) => {
18
28
  // TODO set .js after all configuration are ok to resolve .js
19
29
  return `export * from ${quote}./${file.replace(".ts", ".js")}${quote}${noSemicolon ? "" : ";"}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsed/barrels",
3
3
  "description": "A simple tool to generate barrels for your TypeScript project",
4
- "version": "6.5.0",
4
+ "version": "6.6.0",
5
5
  "type": "module",
6
6
  "bin": "bin/barrels.js",
7
7
  "keywords": [