@hot-updater/supabase 0.29.2 → 0.29.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  enumerable: true
23
23
  }) : target, mod));
24
24
  //#endregion
25
+ let fs_promises = require("fs/promises");
26
+ fs_promises = __toESM(fs_promises);
25
27
  let node_module = require("node:module");
28
+ let path = require("path");
29
+ path = __toESM(path);
26
30
  let _hot_updater_cli_tools = require("@hot-updater/cli-tools");
27
31
  let node_url = require("node:url");
28
32
  let node_child_process = require("node:child_process");
@@ -34,8 +38,6 @@ let node_tty = require("node:tty");
34
38
  node_tty = __toESM(node_tty);
35
39
  let node_path = require("node:path");
36
40
  node_path = __toESM(node_path);
37
- let path = require("path");
38
- path = __toESM(path);
39
41
  let node_timers_promises = require("node:timers/promises");
40
42
  let node_os = require("node:os");
41
43
  let node_events = require("node:events");
@@ -44,8 +46,6 @@ let node_fs = require("node:fs");
44
46
  let node_stream_promises = require("node:stream/promises");
45
47
  let node_stream = require("node:stream");
46
48
  let node_buffer = require("node:buffer");
47
- let fs_promises = require("fs/promises");
48
- fs_promises = __toESM(fs_promises);
49
49
  let _supabase_supabase_js = require("@supabase/supabase-js");
50
50
  //#region ../../node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/error/AbortError.mjs
51
51
  var AbortError = class extends Error {
@@ -1,4 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
+ import fs from "fs/promises";
3
+ import path from "path";
2
4
  import { ConfigBuilder, copyDirToTmp, link, makeEnv, p, resolvePackageVersion, transformEnv, transformTemplate } from "@hot-updater/cli-tools";
3
5
  import { fileURLToPath } from "node:url";
4
6
  import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
@@ -6,8 +8,7 @@ import { StringDecoder } from "node:string_decoder";
6
8
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
7
9
  import process$1, { execArgv, execPath, hrtime, platform } from "node:process";
8
10
  import tty from "node:tty";
9
- import path from "node:path";
10
- import path$1 from "path";
11
+ import path$1 from "node:path";
11
12
  import { scheduler, setImmediate, setTimeout as setTimeout$1 } from "node:timers/promises";
12
13
  import { constants } from "node:os";
13
14
  import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:events";
@@ -16,7 +17,6 @@ import { appendFileSync, createReadStream, createWriteStream, readFileSync, stat
16
17
  import { finished } from "node:stream/promises";
17
18
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
18
19
  import { Buffer as Buffer$1 } from "node:buffer";
19
- import fs from "fs/promises";
20
20
  import { createClient } from "@supabase/supabase-js";
21
21
  //#region \0rolldown/runtime.js
22
22
  var __create = Object.create;
@@ -1240,33 +1240,33 @@ function toPath(urlOrPath) {
1240
1240
  }
1241
1241
  function traversePathUp(startPath) {
1242
1242
  return { *[Symbol.iterator]() {
1243
- let currentPath = path.resolve(toPath(startPath));
1243
+ let currentPath = path$1.resolve(toPath(startPath));
1244
1244
  let previousPath;
1245
1245
  while (previousPath !== currentPath) {
1246
1246
  yield currentPath;
1247
1247
  previousPath = currentPath;
1248
- currentPath = path.resolve(currentPath, "..");
1248
+ currentPath = path$1.resolve(currentPath, "..");
1249
1249
  }
1250
1250
  } };
1251
1251
  }
1252
1252
  //#endregion
1253
1253
  //#region ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
1254
1254
  const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath = process$1.execPath, addExecPath = true } = {}) => {
1255
- const cwdPath = path.resolve(toPath(cwd));
1255
+ const cwdPath = path$1.resolve(toPath(cwd));
1256
1256
  const result = [];
1257
- const pathParts = pathOption.split(path.delimiter);
1257
+ const pathParts = pathOption.split(path$1.delimiter);
1258
1258
  if (preferLocal) applyPreferLocal(result, pathParts, cwdPath);
1259
1259
  if (addExecPath) applyExecPath(result, pathParts, execPath, cwdPath);
1260
- return pathOption === "" || pathOption === path.delimiter ? `${result.join(path.delimiter)}${pathOption}` : [...result, pathOption].join(path.delimiter);
1260
+ return pathOption === "" || pathOption === path$1.delimiter ? `${result.join(path$1.delimiter)}${pathOption}` : [...result, pathOption].join(path$1.delimiter);
1261
1261
  };
1262
1262
  const applyPreferLocal = (result, pathParts, cwdPath) => {
1263
1263
  for (const directory of traversePathUp(cwdPath)) {
1264
- const pathPart = path.join(directory, "node_modules/.bin");
1264
+ const pathPart = path$1.join(directory, "node_modules/.bin");
1265
1265
  if (!pathParts.includes(pathPart)) result.push(pathPart);
1266
1266
  }
1267
1267
  };
1268
1268
  const applyExecPath = (result, pathParts, execPath, cwdPath) => {
1269
- const pathPart = path.resolve(cwdPath, toPath(execPath), "..");
1269
+ const pathPart = path$1.resolve(cwdPath, toPath(execPath), "..");
1270
1270
  if (!pathParts.includes(pathPart)) result.push(pathPart);
1271
1271
  };
1272
1272
  const npmRunPathEnv = ({ env = process$1.env, ...options } = {}) => {
@@ -2276,7 +2276,7 @@ const mapNode = ({ options }) => {
2276
2276
  const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = false, nodePath = execPath, nodeOptions = execArgv.filter((nodeOption) => !nodeOption.startsWith("--inspect")), cwd, execPath: formerNodePath, ...options }) => {
2277
2277
  if (formerNodePath !== void 0) throw new TypeError("The \"execPath\" option has been removed. Please use the \"nodePath\" option instead.");
2278
2278
  const normalizedNodePath = safeNormalizeFileUrl(nodePath, "The \"nodePath\" option");
2279
- const resolvedNodePath = path.resolve(cwd, normalizedNodePath);
2279
+ const resolvedNodePath = path$1.resolve(cwd, normalizedNodePath);
2280
2280
  const newOptions = {
2281
2281
  ...options,
2282
2282
  nodePath: resolvedNodePath,
@@ -2288,7 +2288,7 @@ const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = fal
2288
2288
  commandArguments,
2289
2289
  newOptions
2290
2290
  ];
2291
- if (path.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
2291
+ if (path$1.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
2292
2292
  return [
2293
2293
  resolvedNodePath,
2294
2294
  [
@@ -2372,7 +2372,7 @@ const serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encod
2372
2372
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/arguments/cwd.js
2373
2373
  const normalizeCwd = (cwd = getDefaultCwd()) => {
2374
2374
  const cwdString = safeNormalizeFileUrl(cwd, "The \"cwd\" option");
2375
- return path.resolve(cwdString);
2375
+ return path$1.resolve(cwdString);
2376
2376
  };
2377
2377
  const getDefaultCwd = () => {
2378
2378
  try {
@@ -2410,7 +2410,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
2410
2410
  options.killSignal = normalizeKillSignal(options.killSignal);
2411
2411
  options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
2412
2412
  options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
2413
- if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
2413
+ if (process$1.platform === "win32" && path$1.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
2414
2414
  return {
2415
2415
  file,
2416
2416
  commandArguments,
@@ -6299,10 +6299,10 @@ const resolvePackageExportPath = async (packageName, exportName) => {
6299
6299
  const exportTarget = JSON.parse(await fs.readFile(packageJsonPath, "utf-8")).exports?.[exportName];
6300
6300
  const relativePath = typeof exportTarget === "string" ? exportTarget : exportTarget?.import ?? exportTarget?.default ?? exportTarget?.require;
6301
6301
  if (!relativePath) throw new Error(`Could not resolve ${exportName} export for package ${packageName}`);
6302
- return path$1.resolve(path$1.dirname(packageJsonPath), relativePath);
6302
+ return path.resolve(path.dirname(packageJsonPath), relativePath);
6303
6303
  };
6304
6304
  const toImportMapPath = (fromDir, toPath) => {
6305
- const relativePath = path$1.relative(fromDir, toPath).split(path$1.sep).join("/");
6305
+ const relativePath = path.relative(fromDir, toPath).split(path.sep).join("/");
6306
6306
  return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
6307
6307
  };
6308
6308
  const pathExists = async (targetPath) => {
@@ -6314,13 +6314,13 @@ const pathExists = async (targetPath) => {
6314
6314
  }
6315
6315
  };
6316
6316
  const resolveLocalModulePath = async (fromFile, specifier) => {
6317
- const basePath = path$1.resolve(path$1.dirname(fromFile), specifier);
6317
+ const basePath = path.resolve(path.dirname(fromFile), specifier);
6318
6318
  const candidates = [
6319
6319
  basePath,
6320
6320
  `${basePath}.mjs`,
6321
6321
  `${basePath}.js`,
6322
- path$1.join(basePath, "index.mjs"),
6323
- path$1.join(basePath, "index.js")
6322
+ path.join(basePath, "index.mjs"),
6323
+ path.join(basePath, "index.js")
6324
6324
  ];
6325
6325
  for (const candidate of candidates) if (await pathExists(candidate)) return candidate;
6326
6326
  return null;
@@ -6351,24 +6351,24 @@ const collectBareImportSpecifiers = async (entryPath) => {
6351
6351
  const toVendorDirName = (packageName) => packageName.replace(/^@/, "").replaceAll("/", "-");
6352
6352
  const prepareVendoredPackageImport = async ({ targetDir, packageName, exportName }) => {
6353
6353
  const packageJsonPath = require$1.resolve(`${packageName}/package.json`);
6354
- const packageRoot = path$1.dirname(packageJsonPath);
6354
+ const packageRoot = path.dirname(packageJsonPath);
6355
6355
  const exportPath = await resolvePackageExportPath(packageName, exportName);
6356
- const [sourceRootDir, ...restPath] = path$1.relative(packageRoot, exportPath).split(path$1.sep);
6356
+ const [sourceRootDir, ...restPath] = path.relative(packageRoot, exportPath).split(path.sep);
6357
6357
  if (!sourceRootDir || restPath.length === 0) throw new Error(`Could not determine vendored import layout for ${packageName}${exportName}`);
6358
6358
  const vendorDirName = toVendorDirName(packageName);
6359
- const sourceRootPath = path$1.join(packageRoot, sourceRootDir);
6360
- const vendoredRootPath = path$1.join(targetDir, EDGE_VENDOR_DIR, vendorDirName, sourceRootDir);
6361
- await fs.rm(path$1.join(targetDir, EDGE_VENDOR_DIR, vendorDirName), {
6359
+ const sourceRootPath = path.join(packageRoot, sourceRootDir);
6360
+ const vendoredRootPath = path.join(targetDir, EDGE_VENDOR_DIR, vendorDirName, sourceRootDir);
6361
+ await fs.rm(path.join(targetDir, EDGE_VENDOR_DIR, vendorDirName), {
6362
6362
  recursive: true,
6363
6363
  force: true
6364
6364
  });
6365
- await fs.mkdir(path$1.dirname(vendoredRootPath), { recursive: true });
6365
+ await fs.mkdir(path.dirname(vendoredRootPath), { recursive: true });
6366
6366
  await fs.cp(sourceRootPath, vendoredRootPath, {
6367
6367
  recursive: true,
6368
6368
  force: true
6369
6369
  });
6370
6370
  return {
6371
- importMapPath: toImportMapPath(targetDir, path$1.join(vendoredRootPath, ...restPath)),
6371
+ importMapPath: toImportMapPath(targetDir, path.join(vendoredRootPath, ...restPath)),
6372
6372
  packageRoot,
6373
6373
  sourceEntryPath: exportPath
6374
6374
  };
@@ -6527,7 +6527,7 @@ const selectBucket = async (api) => {
6527
6527
  const linkSupabase = async (workdir, { projectId, dbPassword }) => {
6528
6528
  const spinner = p.spinner();
6529
6529
  try {
6530
- await fs.writeFile(path$1.join(workdir, "supabase", "config.toml"), transformTemplate(SUPABASE_CONFIG_TEMPLATE, { projectId }));
6530
+ await fs.writeFile(path.join(workdir, "supabase", "config.toml"), transformTemplate(SUPABASE_CONFIG_TEMPLATE, { projectId }));
6531
6531
  spinner.start("Linking Supabase...");
6532
6532
  await execa("npx", [
6533
6533
  "supabase",
@@ -6582,14 +6582,14 @@ const deployEdgeFunction = async (workdir, projectId) => {
6582
6582
  placeholder: "update-server"
6583
6583
  });
6584
6584
  if (p.isCancel(functionName)) process.exit(0);
6585
- const edgeFunctionsLibPath = path$1.join(workdir, "supabase", "edge-functions");
6586
- const edgeFunctionsCode = transformEnv(path$1.join(edgeFunctionsLibPath, "index.ts"), { FUNCTION_NAME: functionName });
6587
- const targetDir = path$1.join(workdir, "supabase", "functions", functionName);
6585
+ const edgeFunctionsLibPath = path.join(workdir, "supabase", "edge-functions");
6586
+ const edgeFunctionsCode = transformEnv(path.join(edgeFunctionsLibPath, "index.ts"), { FUNCTION_NAME: functionName });
6587
+ const targetDir = path.join(workdir, "supabase", "functions", functionName);
6588
6588
  await fs.mkdir(targetDir, { recursive: true });
6589
6589
  const denoConfig = await resolveEdgeFunctionDenoConfig(targetDir);
6590
- const targetPath = path$1.join(targetDir, "index.ts");
6590
+ const targetPath = path.join(targetDir, "index.ts");
6591
6591
  await fs.writeFile(targetPath, edgeFunctionsCode);
6592
- await fs.writeFile(path$1.join(targetDir, "deno.json"), `${JSON.stringify(denoConfig, null, 2)}\n`);
6592
+ await fs.writeFile(path.join(targetDir, "deno.json"), `${JSON.stringify(denoConfig, null, 2)}\n`);
6593
6593
  await p.tasks([{
6594
6594
  title: "Supabase edge function deploy. This may take a few minutes.",
6595
6595
  task: async () => {
@@ -6639,11 +6639,11 @@ const runInit = async ({ build }) => {
6639
6639
  const serviceRoleKey = apiKeys.find((key) => key.name === "service_role");
6640
6640
  if (!serviceRoleKey) throw new Error("Service role key not found, is your project paused?");
6641
6641
  const bucket = await selectBucket(supabaseApi(`https://${project.id}.supabase.co`, serviceRoleKey.api_key));
6642
- const { tmpDir, removeTmpDir } = await copyDirToTmp(path$1.dirname(path$1.resolve(require$1.resolve("@hot-updater/supabase/scaffold"))), "supabase");
6643
- const migrationPath = await path$1.join(tmpDir, "supabase", "migrations");
6642
+ const { tmpDir, removeTmpDir } = await copyDirToTmp(path.dirname(path.resolve(require$1.resolve("@hot-updater/supabase/scaffold"))), "supabase");
6643
+ const migrationPath = await path.join(tmpDir, "supabase", "migrations");
6644
6644
  const migrationFiles = await fs.readdir(migrationPath);
6645
6645
  for (const file of migrationFiles) if (file.endsWith(".sql")) {
6646
- const filePath = path$1.join(migrationPath, file);
6646
+ const filePath = path.join(migrationPath, file);
6647
6647
  const content = await fs.readFile(filePath, "utf-8");
6648
6648
  await fs.writeFile(filePath, transformTemplate(content, { BUCKET_NAME: bucket.name }));
6649
6649
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/supabase",
3
3
  "type": "module",
4
- "version": "0.29.2",
4
+ "version": "0.29.4",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -47,10 +47,10 @@
47
47
  "@supabase/supabase-js": "^2.76.1",
48
48
  "hono": "4.12.9",
49
49
  "uuidv7": "^1.0.2",
50
- "@hot-updater/core": "0.29.2",
51
- "@hot-updater/cli-tools": "0.29.2",
52
- "@hot-updater/server": "0.29.2",
53
- "@hot-updater/plugin-core": "0.29.2"
50
+ "@hot-updater/core": "0.29.4",
51
+ "@hot-updater/cli-tools": "0.29.4",
52
+ "@hot-updater/plugin-core": "0.29.4",
53
+ "@hot-updater/server": "0.29.4"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@electric-sql/pglite": "^0.2.15",
@@ -60,10 +60,10 @@
60
60
  "execa": "9.5.2",
61
61
  "@types/node": "^20",
62
62
  "mime": "^4.0.4",
63
- "@hot-updater/js": "0.29.2",
64
- "@hot-updater/mock": "0.29.2",
65
- "@hot-updater/postgres": "0.29.2",
66
- "@hot-updater/test-utils": "0.29.2"
63
+ "@hot-updater/js": "0.29.4",
64
+ "@hot-updater/mock": "0.29.4",
65
+ "@hot-updater/test-utils": "0.29.4",
66
+ "@hot-updater/postgres": "0.29.4"
67
67
  },
68
68
  "scripts": {
69
69
  "build": "tsdown",
@@ -1,10 +1,10 @@
1
1
  import "jsr:@supabase/functions-js/edge-runtime.d.ts";
2
- import { Hono } from "npm:hono";
3
2
  import { createHotUpdater } from "@hot-updater/server/runtime";
4
3
  import {
5
4
  supabaseEdgeFunctionDatabase,
6
5
  supabaseEdgeFunctionStorage,
7
6
  } from "@hot-updater/supabase";
7
+ import { Hono } from "npm:hono";
8
8
 
9
9
  declare global {
10
10
  var HotUpdater: {
@@ -12,12 +12,14 @@ import {
12
12
  } from "node:fs/promises";
13
13
  import path from "node:path";
14
14
  import { fileURLToPath, pathToFileURL } from "node:url";
15
+
15
16
  import { transformEnv } from "@hot-updater/cli-tools";
16
17
  import { type Bundle, type GetBundlesArgs, NIL_UUID } from "@hot-updater/core";
17
18
  import { createHotUpdater } from "@hot-updater/server/runtime";
18
19
  import { setupGetUpdateInfoTestSuite } from "@hot-updater/test-utils";
19
20
  import { createClient } from "@supabase/supabase-js";
20
21
  import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
22
+
21
23
  import {
22
24
  assertDockerComposeAvailable,
23
25
  findOpenPort,