Skip to content

Commit 6ddee5e

Browse files
committed
Switch to new style imports.
1 parent 9fb56c7 commit 6ddee5e

13 files changed

+33
-30
lines changed

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
"dist",
1515
"src"
1616
],
17-
"main": "dist/main/index.js",
18-
"module": "dist/module/index.js",
19-
"types": "dist/module/index.d.ts",
17+
"type": "module",
18+
"exports": {
19+
"require": "./dist/main/index.js",
20+
"import": "./dist/module/index.js",
21+
"types": "./dist/module/index.d.ts"
22+
},
2023
"repository": "supabase/postgrest-js",
2124
"scripts": {
2225
"clean": "rimraf dist docs/v2",

src/PostgrestBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import crossFetch from 'cross-fetch'
22

3-
import type { Fetch, PostgrestSingleResponse } from './types'
3+
import type { Fetch, PostgrestSingleResponse } from './types.js'
44

55
export default abstract class PostgrestBuilder<Result>
66
implements PromiseLike<PostgrestSingleResponse<Result>>

src/PostgrestClient.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import PostgrestQueryBuilder from './PostgrestQueryBuilder'
2-
import PostgrestFilterBuilder from './PostgrestFilterBuilder'
3-
import PostgrestBuilder from './PostgrestBuilder'
4-
import { DEFAULT_HEADERS } from './constants'
5-
import { Fetch, GenericSchema } from './types'
1+
import PostgrestQueryBuilder from './PostgrestQueryBuilder.js'
2+
import PostgrestFilterBuilder from './PostgrestFilterBuilder.js'
3+
import PostgrestBuilder from './PostgrestBuilder.js'
4+
import { DEFAULT_HEADERS } from './constants.js'
5+
import { Fetch, GenericSchema } from './types.js'
66

77
/**
88
* PostgREST client.

src/PostgrestFilterBuilder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import PostgrestTransformBuilder from './PostgrestTransformBuilder'
2-
import { GenericSchema } from './types'
1+
import PostgrestTransformBuilder from './PostgrestTransformBuilder.js'
2+
import { GenericSchema } from './types.js'
33

44
type FilterOperator =
55
| 'eq'

src/PostgrestQueryBuilder.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import PostgrestBuilder from './PostgrestBuilder'
2-
import PostgrestFilterBuilder from './PostgrestFilterBuilder'
3-
import { GetResult } from './select-query-parser'
4-
import { Fetch, GenericSchema, GenericTable, GenericView } from './types'
1+
import PostgrestBuilder from './PostgrestBuilder.js'
2+
import PostgrestFilterBuilder from './PostgrestFilterBuilder.js'
3+
import { GetResult } from './select-query-parser.js'
4+
import { Fetch, GenericSchema, GenericTable, GenericView } from './types.js'
55

66
export default class PostgrestQueryBuilder<
77
Schema extends GenericSchema,

src/PostgrestTransformBuilder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import PostgrestBuilder from './PostgrestBuilder'
2-
import { GetResult } from './select-query-parser'
3-
import { GenericSchema } from './types'
1+
import PostgrestBuilder from './PostgrestBuilder.js'
2+
import { GetResult } from './select-query-parser.js'
3+
import { GenericSchema } from './types.js'
44

55
export default class PostgrestTransformBuilder<
66
Schema extends GenericSchema,

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import { version } from './version'
1+
import { version } from './version.js'
22
export const DEFAULT_HEADERS = { 'X-Client-Info': `postgrest-js/${version}` }

src/select-query-parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Credits to @bnjmnt4n (https://www.npmjs.com/package/postgrest-query)
22

3-
import { GenericSchema, Prettify } from './types'
3+
import { GenericSchema, Prettify } from './types.js'
44

55
type Whitespace = ' ' | '\n' | '\t'
66

test/basic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { PostgrestClient } from '../src/index'
2-
import { Database } from './types'
1+
import { PostgrestClient } from '../src/index.js'
2+
import { Database } from './types.js'
33

44
const REST_URL = 'http://localhost:3000'
55
const postgrest = new PostgrestClient<Database>(REST_URL)

test/filters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { PostgrestClient } from '../src/index'
2-
import { Database } from './types'
1+
import { PostgrestClient } from '../src/index.js'
2+
import { Database } from './types.js'
33

44
const postgrest = new PostgrestClient<Database>('http://localhost:3000')
55

0 commit comments

Comments
 (0)