mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
Add tests for connection-string and fix cloudflare module type and esm compat
This commit is contained in:
parent
0cb8fd4216
commit
0a0e298e06
@ -1,6 +0,0 @@
|
||||
// ESM wrapper for pg-cloudflare
|
||||
import module from '../dist/empty.js'
|
||||
|
||||
// Re-export any named exports and the default
|
||||
export const CloudflareSocket = module.CloudflareSocket
|
||||
export default module
|
||||
@ -1,6 +0,0 @@
|
||||
// ESM wrapper for pg-cloudflare in Cloudflare Workers
|
||||
import module from '../dist/index.js'
|
||||
|
||||
// Re-export CloudflareSocket and the default
|
||||
export const CloudflareSocket = module.CloudflareSocket
|
||||
export default module
|
||||
@ -4,23 +4,12 @@
|
||||
"description": "A socket implementation that can run on Cloudflare Workers using native TCP connections.",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"ts-node": "^8.5.4",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./esm/worker.js",
|
||||
"require": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"./worker": {
|
||||
"import": "./esm/worker.js",
|
||||
"require": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build:watch": "tsc --watch",
|
||||
|
||||
@ -3,6 +3,5 @@ import connectionString from '../index.js'
|
||||
|
||||
// Re-export the parse function
|
||||
export const parse = connectionString.parse
|
||||
|
||||
// Re-export the default
|
||||
export default connectionString
|
||||
export const toClientConfig = connectionString.toClientConfig
|
||||
export const parseIntoClientConfig = connectionString.parseIntoClientConfig
|
||||
@ -7,7 +7,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./esm/index.js",
|
||||
"import": "./esm/index.mjs",
|
||||
"require": "./index.js",
|
||||
"default": "./index.js"
|
||||
}
|
||||
|
||||
@ -13,10 +13,11 @@
|
||||
"esm",
|
||||
"test"
|
||||
],
|
||||
"dependencies": {
|
||||
"devDependencies": {
|
||||
"pg": "^8.14.1",
|
||||
"pg-pool": "^3.8.0",
|
||||
"pg-native": "^3.3.0"
|
||||
"pg-native": "^3.3.0",
|
||||
"pg-cloudflare": "^1.1.1"
|
||||
},
|
||||
"author": "Brian M. Carlson <brian.m.carlson@gmail.com>",
|
||||
"license": "MIT"
|
||||
|
||||
9
packages/pg-esm-test/pg-cloudflare.test.js
Normal file
9
packages/pg-esm-test/pg-cloudflare.test.js
Normal file
@ -0,0 +1,9 @@
|
||||
import assert from 'node:assert'
|
||||
import { describe, it } from 'node:test'
|
||||
import { CloudflareSocket } from 'pg-cloudflare'
|
||||
|
||||
describe('pg-pool', () => {
|
||||
it('should export CloudflareSocket constructor', () => {
|
||||
assert.ok(new CloudflareSocket())
|
||||
})
|
||||
})
|
||||
17
packages/pg-esm-test/pg-connection-string.test.js
Normal file
17
packages/pg-esm-test/pg-connection-string.test.js
Normal file
@ -0,0 +1,17 @@
|
||||
import assert from 'node:assert'
|
||||
import { describe, it } from 'node:test'
|
||||
import { parse, toClientConfig, parseIntoClientConfig } from 'pg-connection-string'
|
||||
|
||||
describe('pg-connection-string', () => {
|
||||
it('should export parse function', () => {
|
||||
assert.strictEqual(typeof parse, 'function')
|
||||
})
|
||||
|
||||
it('should export toClientConfig function', () => {
|
||||
assert.strictEqual(typeof toClientConfig, 'function')
|
||||
})
|
||||
|
||||
it('should export parseIntoClientConfig function', () => {
|
||||
assert.strictEqual(typeof parseIntoClientConfig, 'function')
|
||||
})
|
||||
})
|
||||
@ -1,4 +1,3 @@
|
||||
// test/my-module.test.js
|
||||
import assert from 'node:assert'
|
||||
import { describe, it } from 'node:test'
|
||||
import Client from 'pg-native'
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// test/my-module.test.js
|
||||
import assert from 'node:assert'
|
||||
import { describe, it } from 'node:test'
|
||||
import Pool from 'pg-pool'
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// test/my-module.test.js
|
||||
import assert from 'node:assert'
|
||||
import { describe, it } from 'node:test'
|
||||
import pg, { Client, Pool } from 'pg'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user