convex 1.42.2-alpha.0 → 1.42.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/browser.bundle.js +1 -1
  3. package/dist/browser.bundle.js.map +1 -1
  4. package/dist/cjs/cli/codegen_templates/common.js +6 -0
  5. package/dist/cjs/cli/codegen_templates/common.js.map +2 -2
  6. package/dist/cjs/cli/lib/codegen.js +2 -1
  7. package/dist/cjs/cli/lib/codegen.js.map +2 -2
  8. package/dist/cjs/index.js +1 -1
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/server/meta.js.map +1 -1
  11. package/dist/cjs-types/cli/codegen_templates/common.d.ts +12 -0
  12. package/dist/cjs-types/cli/codegen_templates/common.d.ts.map +1 -1
  13. package/dist/cjs-types/cli/codegen_templates/common.test.d.ts +2 -0
  14. package/dist/cjs-types/cli/codegen_templates/common.test.d.ts.map +1 -0
  15. package/dist/cjs-types/cli/lib/codegen.d.ts.map +1 -1
  16. package/dist/cjs-types/index.d.ts +1 -1
  17. package/dist/cjs-types/index.d.ts.map +1 -1
  18. package/dist/cjs-types/server/meta.d.ts +8 -0
  19. package/dist/cjs-types/server/meta.d.ts.map +1 -1
  20. package/dist/cli.bundle.cjs +7 -2
  21. package/dist/cli.bundle.cjs.map +2 -2
  22. package/dist/esm/cli/codegen_templates/common.js +5 -0
  23. package/dist/esm/cli/codegen_templates/common.js.map +2 -2
  24. package/dist/esm/cli/lib/codegen.js +2 -1
  25. package/dist/esm/cli/lib/codegen.js.map +2 -2
  26. package/dist/esm/index.js +1 -1
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm-types/cli/codegen_templates/common.d.ts +12 -0
  29. package/dist/esm-types/cli/codegen_templates/common.d.ts.map +1 -1
  30. package/dist/esm-types/cli/codegen_templates/common.test.d.ts +2 -0
  31. package/dist/esm-types/cli/codegen_templates/common.test.d.ts.map +1 -0
  32. package/dist/esm-types/cli/lib/codegen.d.ts.map +1 -1
  33. package/dist/esm-types/index.d.ts +1 -1
  34. package/dist/esm-types/index.d.ts.map +1 -1
  35. package/dist/esm-types/server/meta.d.ts +8 -0
  36. package/dist/esm-types/server/meta.d.ts.map +1 -1
  37. package/dist/react.bundle.js +1 -1
  38. package/dist/react.bundle.js.map +1 -1
  39. package/package.json +1 -1
  40. package/src/cli/codegen_templates/common.test.ts +52 -0
  41. package/src/cli/codegen_templates/common.ts +17 -0
  42. package/src/cli/lib/codegen.ts +2 -1
  43. package/src/index.ts +1 -1
  44. package/src/server/meta.ts +0 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "convex",
3
3
  "description": "Client for the Convex Cloud",
4
- "version": "1.42.2-alpha.0",
4
+ "version": "1.42.2",
5
5
  "author": "Convex, Inc. <no-reply@convex.dev>",
6
6
  "homepage": "https://convex.dev",
7
7
  "repository": {
@@ -0,0 +1,52 @@
1
+ import { describe, test, expect } from "vitest";
2
+ import { compareModulePaths } from "./common.js";
3
+
4
+ describe("compareModulePaths", () => {
5
+ test("matches default sort order for forward slash paths", () => {
6
+ const paths = ["fooBaz.ts", "foo/bar.ts", "foo.ts"];
7
+ expect([...paths].sort(compareModulePaths)).toEqual([...paths].sort());
8
+ });
9
+
10
+ test("orders Windows paths identically to their POSIX equivalents", () => {
11
+ const posixPaths = ["fooBaz.ts", "foo/bar.ts", "foo.ts"];
12
+ const windowsPaths = posixPaths.map((p) => p.replace(/\//g, "\\"));
13
+
14
+ const sortedPosix = [...posixPaths].sort(compareModulePaths);
15
+ const sortedWindows = [...windowsPaths].sort(compareModulePaths);
16
+
17
+ expect(sortedPosix).toEqual(["foo.ts", "foo/bar.ts", "fooBaz.ts"]);
18
+ expect(sortedWindows.map((p) => p.replace(/\\/g, "/"))).toEqual(
19
+ sortedPosix,
20
+ );
21
+ });
22
+
23
+ test("default sort diverges on this input, demonstrating the bug", () => {
24
+ // "/" (0x2F) sorts before letters while "\" (0x5C) sorts after them,
25
+ // so the OS-native forms of the same file set sort differently.
26
+ const windowsPaths = ["fooBaz.ts", "foo\\bar.ts", "foo.ts"];
27
+ expect([...windowsPaths].sort()).toEqual([
28
+ "foo.ts",
29
+ "fooBaz.ts",
30
+ "foo\\bar.ts",
31
+ ]);
32
+ expect([...windowsPaths].sort(compareModulePaths)).toEqual([
33
+ "foo.ts",
34
+ "foo\\bar.ts",
35
+ "fooBaz.ts",
36
+ ]);
37
+ });
38
+
39
+ test("sorts nested directories before longer sibling file names", () => {
40
+ const paths = ["a/b/c.ts", "aZ.ts", "a.ts", "a/b.ts"];
41
+ expect([...paths].sort(compareModulePaths)).toEqual([
42
+ "a.ts",
43
+ "a/b.ts",
44
+ "a/b/c.ts",
45
+ "aZ.ts",
46
+ ]);
47
+ const windows = paths.map((p) => p.replace(/\//g, "\\"));
48
+ expect(
49
+ [...windows].sort(compareModulePaths).map((p) => p.replace(/\\/g, "/")),
50
+ ).toEqual(["a.ts", "a/b.ts", "a/b/c.ts", "aZ.ts"]);
51
+ });
52
+ });
@@ -43,3 +43,20 @@ const collator = new Intl.Collator("en-US", {
43
43
  export function compareStrings(a: string, b: string): number {
44
44
  return collator.compare(a, b);
45
45
  }
46
+
47
+ /**
48
+ * Comparison function for sorting module paths in codegen output.
49
+ *
50
+ * Compares the forward slash normalized form of each path so the resulting
51
+ * order is identical on every platform. Sorting OS-native paths directly
52
+ * diverges on Windows because "\" (0x5C) sorts after letters while "/"
53
+ * (0x2F) sorts before them. Uses plain code unit comparison to match the
54
+ * default Array.prototype.sort() order these paths sorted with on POSIX.
55
+ *
56
+ * Usage: modulePaths.sort(compareModulePaths)
57
+ */
58
+ export function compareModulePaths(a: string, b: string): number {
59
+ const aNormalized = a.replace(/\\/g, "/");
60
+ const bNormalized = b.replace(/\\/g, "/");
61
+ return aNormalized < bNormalized ? -1 : aNormalized > bNormalized ? 1 : 0;
62
+ }
@@ -4,6 +4,7 @@ import { withTmpDir, TempDir } from "../../bundler/fs.js";
4
4
  import { entryPoints } from "../../bundler/index.js";
5
5
  import { apiCodegen } from "../codegen_templates/api.js";
6
6
  import { apiCjsCodegen } from "../codegen_templates/api_cjs.js";
7
+ import { compareModulePaths } from "../codegen_templates/common.js";
7
8
  import {
8
9
  dynamicDataModelDTS,
9
10
  dynamicDataModelTS,
@@ -846,7 +847,7 @@ async function doApiCodegen(
846
847
  const absModulePaths = await entryPoints(ctx, functionsDir);
847
848
  const modulePaths = absModulePaths
848
849
  .map((p) => path.relative(functionsDir, p))
849
- .sort();
850
+ .sort(compareModulePaths);
850
851
 
851
852
  const writtenFiles: string[] = [];
852
853
 
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export const version = "1.42.2-alpha.0";
1
+ export const version = "1.42.2";
@@ -120,8 +120,6 @@ export type RequestMetadata = {
120
120
  *
121
121
  * This is the same token that `ctx.auth.getUserIdentity()` derives its
122
122
  * attributes from.
123
- *
124
- * @internal
125
123
  */
126
124
  authToken: string | null;
127
125
  };