-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: use proper dual-packaging Support CommonJS & ESM. Previously the ESM build (dist/module) is broken - it's recognized as CommonJS. For more on dual-packaging: https://nodejs.org/api/packages.html#dual-commonjses-module-packages * Fix and add smoke tests --------- Co-authored-by: Bobbie Soedirgo <[email protected]>
- Loading branch information
1 parent
24dcbde
commit 541cd5d
Showing
8 changed files
with
474 additions
and
29 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Check that the ESM build works as expected (namely has the same exports as the CJS build when imported via ESM). | ||
const assert = require("node:assert"); | ||
const postgrestjs = require("@supabase/postgrest-js"); | ||
|
||
assert(typeof postgrestjs.PostgrestClient === "function"); | ||
assert(typeof postgrestjs.PostgrestQueryBuilder === "function"); | ||
assert(typeof postgrestjs.PostgrestFilterBuilder === "function"); | ||
assert(typeof postgrestjs.PostgrestTransformBuilder === "function"); | ||
assert(typeof postgrestjs.PostgrestBuilder === "function"); | ||
assert(typeof postgrestjs.default === "undefined"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Check that the ESM build works as expected (namely has the same exports as the CJS build when imported via ESM). | ||
import assert from "node:assert"; | ||
import * as postgrestjs from "@supabase/postgrest-js"; | ||
|
||
assert(typeof postgrestjs.PostgrestClient === 'function'); | ||
assert(typeof postgrestjs.PostgrestQueryBuilder === 'function'); | ||
assert(typeof postgrestjs.PostgrestFilterBuilder === 'function'); | ||
assert(typeof postgrestjs.PostgrestTransformBuilder === 'function'); | ||
assert(typeof postgrestjs.PostgrestBuilder === 'function'); | ||
assert(typeof postgrestjs.default === 'object'); | ||
assert(typeof postgrestjs.default.PostgrestClient === 'function'); | ||
assert(typeof postgrestjs.default.PostgrestQueryBuilder === 'function'); | ||
assert(typeof postgrestjs.default.PostgrestFilterBuilder === 'function'); | ||
assert(typeof postgrestjs.default.PostgrestTransformBuilder === 'function'); | ||
assert(typeof postgrestjs.default.PostgrestBuilder === 'function') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import index from '../cjs/index.js' | ||
const { | ||
PostgrestClient, | ||
PostgrestQueryBuilder, | ||
PostgrestFilterBuilder, | ||
PostgrestTransformBuilder, | ||
PostgrestBuilder, | ||
} = index | ||
|
||
export { | ||
PostgrestBuilder, | ||
PostgrestClient, | ||
PostgrestFilterBuilder, | ||
PostgrestQueryBuilder, | ||
PostgrestTransformBuilder, | ||
} | ||
|
||
// compatibility with CJS output | ||
export default { | ||
PostgrestClient, | ||
PostgrestQueryBuilder, | ||
PostgrestFilterBuilder, | ||
PostgrestTransformBuilder, | ||
PostgrestBuilder, | ||
} |