Skip to content

Commit e17f58c

Browse files
committed
work
1 parent c18a003 commit e17f58c

36 files changed

Lines changed: 514 additions & 260 deletions

File tree

dist/build/build.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7631,7 +7631,12 @@ const getDirectoryContentItems = ({
76317631
fileUrls.push(fileUrlObject);
76327632
}
76337633
}
7634-
fileUrls.sort(compareFileUrls);
7634+
// Not the default numeric order: what is drawn here is a directory as a human
7635+
// reads it, so a leading number is part of the name ("10_a" right after
7636+
// "1_a") the way the filesystem and the editor next to this browser show it.
7637+
fileUrls.sort((leftUrl, rightUrl) =>
7638+
compareFileUrls(leftUrl, rightUrl, { numeric: false }),
7639+
);
76357640

76367641
const items = [];
76377642
for (const fileUrl of fileUrls) {

dist/build/jsenv_core_packages.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,7 +2620,25 @@ const assertAndNormalizeFileUrl = (
26202620
return value;
26212621
};
26222622

2623-
const comparePathnames = (leftPathame, rightPathname) => {
2623+
/*
2624+
* Which of two pathnames comes first: directories before what is under them,
2625+
* deeper before shallower, then the names themselves.
2626+
*
2627+
* How a leading number reads is the caller's call, because the two readings are
2628+
* both right somewhere:
2629+
* - numeric (the default), where the number is a quantity: "9_x" then "10_x" —
2630+
* what a generated list wants, so a story numbered by hand stays in the order
2631+
* it happens;
2632+
* - { numeric: false }, where the number is part of the name: "10_x" right
2633+
* after "1_x" — the order the filesystem itself gives, and the one every file
2634+
* explorer above it shows, so a human reading a directory finds it in the
2635+
* order their editor already shows.
2636+
*/
2637+
const comparePathnames = (
2638+
leftPathame,
2639+
rightPathname,
2640+
{ numeric = true } = {},
2641+
) => {
26242642
const leftPartArray = leftPathame.split("/");
26252643
const rightPartArray = rightPathname.split("/");
26262644

@@ -2656,7 +2674,7 @@ const comparePathnames = (leftPathame, rightPathname) => {
26562674
i++;
26572675
// local comparison comes first
26582676
const comparison = leftPart.localeCompare(rightPart, undefined, {
2659-
numeric: true,
2677+
numeric,
26602678
sensitivity: "base",
26612679
});
26622680
if (comparison !== 0) {
@@ -2673,8 +2691,8 @@ const comparePathnames = (leftPathame, rightPathname) => {
26732691
return 0;
26742692
};
26752693

2676-
const compareFileUrls = (a, b) => {
2677-
return comparePathnames(new URL(a).pathname, new URL(b).pathname);
2694+
const compareFileUrls = (a, b, options) => {
2695+
return comparePathnames(new URL(a).pathname, new URL(b).pathname, options);
26782696
};
26792697

26802698
const isWindows$3 = process.platform === "win32";

dist/start_dev_server/jsenv_core_packages.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,25 @@ const assertAndNormalizeFileUrl = (
19211921
return value;
19221922
};
19231923

1924-
const comparePathnames = (leftPathame, rightPathname) => {
1924+
/*
1925+
* Which of two pathnames comes first: directories before what is under them,
1926+
* deeper before shallower, then the names themselves.
1927+
*
1928+
* How a leading number reads is the caller's call, because the two readings are
1929+
* both right somewhere:
1930+
* - numeric (the default), where the number is a quantity: "9_x" then "10_x" —
1931+
* what a generated list wants, so a story numbered by hand stays in the order
1932+
* it happens;
1933+
* - { numeric: false }, where the number is part of the name: "10_x" right
1934+
* after "1_x" — the order the filesystem itself gives, and the one every file
1935+
* explorer above it shows, so a human reading a directory finds it in the
1936+
* order their editor already shows.
1937+
*/
1938+
const comparePathnames = (
1939+
leftPathame,
1940+
rightPathname,
1941+
{ numeric = true } = {},
1942+
) => {
19251943
const leftPartArray = leftPathame.split("/");
19261944
const rightPartArray = rightPathname.split("/");
19271945

@@ -1957,7 +1975,7 @@ const comparePathnames = (leftPathame, rightPathname) => {
19571975
i++;
19581976
// local comparison comes first
19591977
const comparison = leftPart.localeCompare(rightPart, undefined, {
1960-
numeric: true,
1978+
numeric,
19611979
sensitivity: "base",
19621980
});
19631981
if (comparison !== 0) {
@@ -1974,8 +1992,8 @@ const comparePathnames = (leftPathame, rightPathname) => {
19741992
return 0;
19751993
};
19761994

1977-
const compareFileUrls = (a, b) => {
1978-
return comparePathnames(new URL(a).pathname, new URL(b).pathname);
1995+
const compareFileUrls = (a, b, options) => {
1996+
return comparePathnames(new URL(a).pathname, new URL(b).pathname, options);
19791997
};
19801998

19811999
const isWindows$3 = process.platform === "win32";

dist/start_dev_server/start_dev_server.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4363,7 +4363,12 @@ const getDirectoryContentItems = ({
43634363
fileUrls.push(fileUrlObject);
43644364
}
43654365
}
4366-
fileUrls.sort(compareFileUrls);
4366+
// Not the default numeric order: what is drawn here is a directory as a human
4367+
// reads it, so a leading number is part of the name ("10_a" right after
4368+
// "1_a") the way the filesystem and the editor next to this browser show it.
4369+
fileUrls.sort((leftUrl, rightUrl) =>
4370+
compareFileUrls(leftUrl, rightUrl, { numeric: false }),
4371+
);
43674372

43684373
const items = [];
43694374
for (const fileUrl of fileUrls) {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jsenv/core",
3-
"version": "41.5.13",
3+
"version": "41.5.14",
44
"type": "module",
55
"description": "Tool to develop, test and build js projects",
66
"repository": {
@@ -75,7 +75,7 @@
7575
"dependencies": {
7676
"@jsenv/ast": "6.10.3",
7777
"@jsenv/js-module-fallback": "1.6.7",
78-
"@jsenv/plugin-bundling": "2.10.26",
78+
"@jsenv/plugin-bundling": "2.10.27",
7979
"@jsenv/plugin-minification": "1.7.20",
8080
"@jsenv/plugin-supervisor": "1.8.22",
8181
"@jsenv/plugin-transpilation": "1.7.7",

packages/backend/database-manager/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"prepublishOnly": "npm run build"
3030
},
3131
"dependencies": {
32-
"@jsenv/database": "0.0.18",
32+
"@jsenv/database": "0.0.19",
3333
"@jsenv/server": "17.6.4",
3434
"@jsenv/urls": "2.9.12",
3535
"@tanstack/table-core": "8.21.3",

packages/backend/database/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jsenv/database",
3-
"version": "0.0.18",
3+
"version": "0.0.19",
44
"type": "module",
55
"description": "TODO",
66
"repository": {
@@ -29,7 +29,7 @@
2929
"database:setup": "npx @jsenv/database setup"
3030
},
3131
"dependencies": {
32-
"@jsenv/filesystem": "4.15.22",
32+
"@jsenv/filesystem": "4.15.23",
3333
"@jsenv/humanize": "1.8.1",
3434
"@jsenv/url-meta": "8.5.8",
3535
"@jsenv/urls": "2.9.12",

packages/frontend/dom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jsenv/dom",
3-
"version": "0.17.59",
3+
"version": "0.17.60",
44
"type": "module",
55
"description": "DOM utilities for writing frontend code",
66
"repository": {

0 commit comments

Comments
 (0)