Skip to content

Deno v2 node imports #1080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deno/polyfills.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global Deno */

import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import { isIP } from 'https://deno.land/std@0.132.0/node/net.ts'
import { Buffer } from 'node:buffer'
import { isIP } from 'node:net'

const events = () => ({ data: [], error: [], drain: [], connect: [], secureConnect: [], close: [] })

Expand Down
2 changes: 1 addition & 1 deletion deno/src/bytes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import { Buffer } from 'node:buffer'
const size = 256
let buffer = Buffer.allocUnsafe(size)

Expand Down
6 changes: 3 additions & 3 deletions deno/src/connection.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { HmacSha256 } from 'https://deno.land/std@0.132.0/hash/sha256.ts'
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import { Buffer } from 'node:buffer'
import { setImmediate, clearImmediate } from '../polyfills.js'
import { net } from '../polyfills.js'
import { tls } from '../polyfills.js'
import crypto from 'https://deno.land/std@0.132.0/node/crypto.ts'
import Stream from 'https://deno.land/std@0.132.0/node/stream.ts'
import crypto from 'node:crypto'
import Stream from 'node:stream'


import { stringify, handleValue, arrayParser, arraySerializer } from './types.js'
Expand Down
6 changes: 3 additions & 3 deletions deno/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import process from 'https://deno.land/std@0.132.0/node/process.ts'
import os from 'https://deno.land/std@0.132.0/node/os.ts'
import fs from 'https://deno.land/std@0.132.0/node/fs.ts'
import process from 'node:process'
import os from 'node:os'
import fs from 'node:fs'

import {
mergeUserTypes,
Expand Down
2 changes: 1 addition & 1 deletion deno/src/large.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Stream from 'https://deno.land/std@0.132.0/node/stream.ts'
import Stream from 'node:stream'

export default function largeObject(sql, oid, mode = 0x00020000 | 0x00040000) {
return new Promise(async(resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion deno/src/subscribe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import { Buffer } from 'node:buffer'
const noop = () => { /* noop */ }

export default function Subscribe(postgres, options) {
Expand Down
2 changes: 1 addition & 1 deletion deno/src/types.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import { Buffer } from 'node:buffer'
import { Query } from './query.js'
import { Errors } from './errors.js'

Expand Down
2 changes: 1 addition & 1 deletion deno/tests/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { spawn } from 'https://deno.land/std@0.132.0/node/child_process.ts'
import { spawn } from 'node:child_process'

await exec('dropdb', ['postgres_js_test'])

Expand Down
8 changes: 4 additions & 4 deletions deno/tests/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import process from 'https://deno.land/std@0.132.0/node/process.ts'
import { Buffer } from 'node:buffer'
import process from 'node:process'
import { exec } from './bootstrap.js'

import { t, nt, ot } from './test.js' // eslint-disable-line
import { net } from '../polyfills.js'
import fs from 'https://deno.land/std@0.132.0/node/fs.ts'
import crypto from 'https://deno.land/std@0.132.0/node/crypto.ts'
import fs from 'node:fs'
import crypto from 'node:crypto'

import postgres from '../src/index.js'
const delay = ms => new Promise(r => setTimeout(r, ms))
Expand Down
4 changes: 2 additions & 2 deletions deno/tests/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import process from 'https://deno.land/std@0.132.0/node/process.ts'
import process from 'node:process'
/* eslint no-console: 0 */

import util from 'https://deno.land/std@0.132.0/node/util.ts'
import util from 'node:util'

let done = 0
let only = false
Expand Down
6 changes: 3 additions & 3 deletions deno/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import process from 'https://deno.land/std@0.132.0/node/process.ts'
import { Readable, Writable } from 'https://deno.land/std@0.132.0/node/stream.ts'
import { Buffer } from 'node:buffer'
import process from 'node:process'
import { Readable, Writable } from 'node:stream'

/**
* Establish a connection to a PostgreSQL server.
Expand Down