Skip to content

Commit

Permalink
Modify build to not run postgres.js though tsup
Browse files Browse the repository at this point in the history
  • Loading branch information
samwillis committed Jul 25, 2024
1 parent a679733 commit cf63a42
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/pglite/scripts/bundle-wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function findAndReplaceInDir(
async function main() {
await fs.copyFile("./release/postgres.wasm", "./dist/postgres.wasm");
await fs.copyFile("./release/postgres.data", "./dist/postgres.data");
// await fs.copyFile("./release/postgres.so", "./dist/postgres.so");
await fs.copyFile("./release/postgres.js", "./dist/postgres.js");
await fs.copyFile("./release/vector.tar.gz", "./dist/vector.tar.gz");
await findAndReplaceInDir(
"./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/pglite/src/extensionUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tinyTar from "tinytar";
import { IN_NODE } from "./utils.js";
import type { PostgresMod } from "./postgres.js";
import type { PostgresMod } from "./postgresMod.js";

export async function loadExtensionBundle(
bundlePath: URL,
Expand Down
2 changes: 1 addition & 1 deletion packages/pglite/src/fs/idbfs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FilesystemBase } from "./types.js";
import type { FS, PostgresMod } from "../postgres.js";
import type { FS, PostgresMod } from "../postgresMod.js";
import { PGDATA } from "./index.js";
import { dumpTar } from "./tarUtils.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/pglite/src/fs/memoryfs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FilesystemBase } from "./types.js";
import type { PostgresMod, FS } from "../postgres.js";
import type { PostgresMod, FS } from "../postgresMod.js";
import { dumpTar } from "./tarUtils.js";

export class MemoryFS extends FilesystemBase {
Expand Down
2 changes: 1 addition & 1 deletion packages/pglite/src/fs/nodefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from "fs";
import * as path from "path";
import { FilesystemBase } from "./types.js";
import { PGDATA } from "./index.js";
import type { PostgresMod, FS } from "../postgres.js";
import type { PostgresMod, FS } from "../postgresMod.js";
import { dumpTar } from "./tarUtils.js";

export class NodeFS extends FilesystemBase {
Expand Down
2 changes: 1 addition & 1 deletion packages/pglite/src/fs/tarUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { tar, untar, type TarFile, REGTYPE, DIRTYPE } from "tinytar";
import { FS } from "../postgres.js";
import { FS } from "../postgresMod.js";
import { PGDATA } from "./index.js";

export async function dumpTar(FS: FS, dbname?: string): Promise<File | Blob> {
Expand Down
2 changes: 1 addition & 1 deletion packages/pglite/src/fs/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PostgresMod, FS } from "../postgres.js";
import type { PostgresMod, FS } from "../postgresMod.js";

export type FsType = "nodefs" | "idbfs" | "memoryfs";

Expand Down
2 changes: 1 addition & 1 deletion packages/pglite/src/pglite.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Mutex } from "async-mutex";
import PostgresModFactory, { type PostgresMod } from "./postgres.js";
import PostgresModFactory, { type PostgresMod } from "./postgresMod.js";
import { type Filesystem, parseDataDir, loadFs } from "./fs/index.js";
import { makeLocateFile } from "./utils.js";
import { parseResults } from "./parse.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ts-ignore
import PostgresModFactory from "../release/postgres.js";
// This file in placed in the build from ../release/postgres.js
import PostgresModFactory from "./postgres.js";

// Uses the types from @types/emscripten

Expand Down
3 changes: 2 additions & 1 deletion packages/pglite/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fileURLToPath } from "url";
const thisFile = fileURLToPath(new URL(import.meta.url));
const root = path.dirname(thisFile);

let replaceAssertPlugin = {
const replaceAssertPlugin = {
name: "replace-assert",
setup(build: any) {
// Resolve `assert` to a blank file
Expand All @@ -31,6 +31,7 @@ export default defineConfig({
},
clean: true,
format: ["esm"],
external: ["./postgres.js"],
esbuildOptions(options, context) {
options.inject = [
"src/polyfills/buffer.ts",
Expand Down
8 changes: 2 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cf63a42

Please sign in to comment.