@hot-updater/cloudflare 0.29.3 → 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.
- package/dist/iac/index.cjs +6 -6
- package/dist/iac/index.mjs +29 -29
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +14 -14
- package/package.json +8 -8
- package/src/cloudflareWorkerDatabase.ts +2 -2
- package/src/d1Database.spec.ts +1 -0
- package/src/r2Storage.ts +2 -1
- package/src/r2WorkerStorage.ts +2 -2
- package/src/worker/index.ts +6 -6
- package/worker/dist/README.md +1 -1
- package/worker/dist/index.js.map +2 -2
- package/worker/src/getUpdateInfo.ts +6 -12
- package/worker/src/index.integration.spec.ts +2 -1
- package/worker/src/index.ts +1 -0
package/dist/iac/index.cjs
CHANGED
|
@@ -22,10 +22,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
enumerable: true
|
|
23
23
|
}) : target, mod));
|
|
24
24
|
//#endregion
|
|
25
|
-
let _hot_updater_cli_tools = require("@hot-updater/cli-tools");
|
|
26
|
-
let cloudflare = require("cloudflare");
|
|
27
25
|
let crypto = require("crypto");
|
|
28
26
|
crypto = __toESM(crypto);
|
|
27
|
+
let fs_promises = require("fs/promises");
|
|
28
|
+
fs_promises = __toESM(fs_promises);
|
|
29
|
+
let path = require("path");
|
|
30
|
+
path = __toESM(path);
|
|
31
|
+
let _hot_updater_cli_tools = require("@hot-updater/cli-tools");
|
|
32
|
+
let cloudflare = require("cloudflare");
|
|
29
33
|
let node_url = require("node:url");
|
|
30
34
|
let node_child_process = require("node:child_process");
|
|
31
35
|
let node_string_decoder = require("node:string_decoder");
|
|
@@ -36,8 +40,6 @@ let node_tty = require("node:tty");
|
|
|
36
40
|
node_tty = __toESM(node_tty);
|
|
37
41
|
let node_path = require("node:path");
|
|
38
42
|
node_path = __toESM(node_path);
|
|
39
|
-
let path = require("path");
|
|
40
|
-
path = __toESM(path);
|
|
41
43
|
let fs = require("fs");
|
|
42
44
|
fs = __toESM(fs);
|
|
43
45
|
let node_timers_promises = require("node:timers/promises");
|
|
@@ -48,8 +50,6 @@ let node_fs = require("node:fs");
|
|
|
48
50
|
let node_stream_promises = require("node:stream/promises");
|
|
49
51
|
let node_stream = require("node:stream");
|
|
50
52
|
let node_buffer = require("node:buffer");
|
|
51
|
-
let fs_promises = require("fs/promises");
|
|
52
|
-
fs_promises = __toESM(fs_promises);
|
|
53
53
|
let os = require("os");
|
|
54
54
|
os = __toESM(os);
|
|
55
55
|
//#endregion
|
package/dist/iac/index.mjs
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
+
import crypto from "crypto";
|
|
3
|
+
import fs from "fs/promises";
|
|
4
|
+
import path from "path";
|
|
2
5
|
import { ConfigBuilder, copyDirToTmp, getCwd, link, makeEnv, p, transformTemplate } from "@hot-updater/cli-tools";
|
|
3
6
|
import { Cloudflare } from "cloudflare";
|
|
4
|
-
import crypto from "crypto";
|
|
5
7
|
import { fileURLToPath } from "node:url";
|
|
6
8
|
import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
7
9
|
import { StringDecoder } from "node:string_decoder";
|
|
8
10
|
import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
|
|
9
11
|
import process$1, { execArgv, execPath, hrtime, platform } from "node:process";
|
|
10
12
|
import tty from "node:tty";
|
|
11
|
-
import path from "node:path";
|
|
12
|
-
import
|
|
13
|
-
import fs from "fs";
|
|
13
|
+
import path$1 from "node:path";
|
|
14
|
+
import fs$1 from "fs";
|
|
14
15
|
import { scheduler, setImmediate, setTimeout } from "node:timers/promises";
|
|
15
16
|
import { constants } from "node:os";
|
|
16
17
|
import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:events";
|
|
@@ -19,7 +20,6 @@ import { appendFileSync, createReadStream, createWriteStream, readFileSync, stat
|
|
|
19
20
|
import { finished } from "node:stream/promises";
|
|
20
21
|
import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
|
|
21
22
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
22
|
-
import fs$1 from "fs/promises";
|
|
23
23
|
import os from "os";
|
|
24
24
|
//#region \0rolldown/runtime.js
|
|
25
25
|
var __create = Object.create;
|
|
@@ -1512,33 +1512,33 @@ function toPath(urlOrPath) {
|
|
|
1512
1512
|
}
|
|
1513
1513
|
function traversePathUp(startPath) {
|
|
1514
1514
|
return { *[Symbol.iterator]() {
|
|
1515
|
-
let currentPath = path.resolve(toPath(startPath));
|
|
1515
|
+
let currentPath = path$1.resolve(toPath(startPath));
|
|
1516
1516
|
let previousPath;
|
|
1517
1517
|
while (previousPath !== currentPath) {
|
|
1518
1518
|
yield currentPath;
|
|
1519
1519
|
previousPath = currentPath;
|
|
1520
|
-
currentPath = path.resolve(currentPath, "..");
|
|
1520
|
+
currentPath = path$1.resolve(currentPath, "..");
|
|
1521
1521
|
}
|
|
1522
1522
|
} };
|
|
1523
1523
|
}
|
|
1524
1524
|
//#endregion
|
|
1525
1525
|
//#region ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
|
|
1526
1526
|
const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath = process$1.execPath, addExecPath = true } = {}) => {
|
|
1527
|
-
const cwdPath = path.resolve(toPath(cwd));
|
|
1527
|
+
const cwdPath = path$1.resolve(toPath(cwd));
|
|
1528
1528
|
const result = [];
|
|
1529
|
-
const pathParts = pathOption.split(path.delimiter);
|
|
1529
|
+
const pathParts = pathOption.split(path$1.delimiter);
|
|
1530
1530
|
if (preferLocal) applyPreferLocal(result, pathParts, cwdPath);
|
|
1531
1531
|
if (addExecPath) applyExecPath(result, pathParts, execPath, cwdPath);
|
|
1532
|
-
return pathOption === "" || pathOption === path.delimiter ? `${result.join(path.delimiter)}${pathOption}` : [...result, pathOption].join(path.delimiter);
|
|
1532
|
+
return pathOption === "" || pathOption === path$1.delimiter ? `${result.join(path$1.delimiter)}${pathOption}` : [...result, pathOption].join(path$1.delimiter);
|
|
1533
1533
|
};
|
|
1534
1534
|
const applyPreferLocal = (result, pathParts, cwdPath) => {
|
|
1535
1535
|
for (const directory of traversePathUp(cwdPath)) {
|
|
1536
|
-
const pathPart = path.join(directory, "node_modules/.bin");
|
|
1536
|
+
const pathPart = path$1.join(directory, "node_modules/.bin");
|
|
1537
1537
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
1538
1538
|
}
|
|
1539
1539
|
};
|
|
1540
1540
|
const applyExecPath = (result, pathParts, execPath, cwdPath) => {
|
|
1541
|
-
const pathPart = path.resolve(cwdPath, toPath(execPath), "..");
|
|
1541
|
+
const pathPart = path$1.resolve(cwdPath, toPath(execPath), "..");
|
|
1542
1542
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
1543
1543
|
};
|
|
1544
1544
|
const npmRunPathEnv = ({ env = process$1.env, ...options } = {}) => {
|
|
@@ -2548,7 +2548,7 @@ const mapNode = ({ options }) => {
|
|
|
2548
2548
|
const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = false, nodePath = execPath, nodeOptions = execArgv.filter((nodeOption) => !nodeOption.startsWith("--inspect")), cwd, execPath: formerNodePath, ...options }) => {
|
|
2549
2549
|
if (formerNodePath !== void 0) throw new TypeError("The \"execPath\" option has been removed. Please use the \"nodePath\" option instead.");
|
|
2550
2550
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath, "The \"nodePath\" option");
|
|
2551
|
-
const resolvedNodePath = path.resolve(cwd, normalizedNodePath);
|
|
2551
|
+
const resolvedNodePath = path$1.resolve(cwd, normalizedNodePath);
|
|
2552
2552
|
const newOptions = {
|
|
2553
2553
|
...options,
|
|
2554
2554
|
nodePath: resolvedNodePath,
|
|
@@ -2560,7 +2560,7 @@ const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = fal
|
|
|
2560
2560
|
commandArguments,
|
|
2561
2561
|
newOptions
|
|
2562
2562
|
];
|
|
2563
|
-
if (path.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
|
|
2563
|
+
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\".");
|
|
2564
2564
|
return [
|
|
2565
2565
|
resolvedNodePath,
|
|
2566
2566
|
[
|
|
@@ -2644,7 +2644,7 @@ const serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encod
|
|
|
2644
2644
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/arguments/cwd.js
|
|
2645
2645
|
const normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
2646
2646
|
const cwdString = safeNormalizeFileUrl(cwd, "The \"cwd\" option");
|
|
2647
|
-
return path.resolve(cwdString);
|
|
2647
|
+
return path$1.resolve(cwdString);
|
|
2648
2648
|
};
|
|
2649
2649
|
const getDefaultCwd = () => {
|
|
2650
2650
|
try {
|
|
@@ -2682,7 +2682,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
2682
2682
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
2683
2683
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
2684
2684
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
2685
|
-
if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
2685
|
+
if (process$1.platform === "win32" && path$1.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
2686
2686
|
return {
|
|
2687
2687
|
file,
|
|
2688
2688
|
commandArguments,
|
|
@@ -10807,21 +10807,21 @@ var mod_esm_default = (/* @__PURE__ */ __toESM(require_mod_cjs())).default;
|
|
|
10807
10807
|
//#region iac/getWranglerLoginAuthToken.ts
|
|
10808
10808
|
const isDirectory = (configPath) => {
|
|
10809
10809
|
try {
|
|
10810
|
-
return fs.statSync(configPath).isDirectory();
|
|
10810
|
+
return fs$1.statSync(configPath).isDirectory();
|
|
10811
10811
|
} catch {
|
|
10812
10812
|
return false;
|
|
10813
10813
|
}
|
|
10814
10814
|
};
|
|
10815
10815
|
const getGlobalWranglerConfigPath = () => {
|
|
10816
10816
|
const configDir = mod_esm_default(".wrangler").config();
|
|
10817
|
-
const legacyConfigDir = path
|
|
10817
|
+
const legacyConfigDir = path.join(os.homedir(), ".wrangler");
|
|
10818
10818
|
if (isDirectory(legacyConfigDir)) return legacyConfigDir;
|
|
10819
10819
|
return configDir;
|
|
10820
10820
|
};
|
|
10821
10821
|
const getWranglerLoginAuthToken = () => {
|
|
10822
10822
|
try {
|
|
10823
10823
|
const wranglerConfigPath = getGlobalWranglerConfigPath();
|
|
10824
|
-
const wranglerConfig = fs.readFileSync(path
|
|
10824
|
+
const wranglerConfig = fs$1.readFileSync(path.join(wranglerConfigPath, "config", "default.toml"), "utf8");
|
|
10825
10825
|
return import_toml.default.parse(wranglerConfig);
|
|
10826
10826
|
} catch {
|
|
10827
10827
|
return null;
|
|
@@ -10867,10 +10867,10 @@ export default HotUpdater.wrap({
|
|
|
10867
10867
|
const deployWorker = async (oauth_token, accountId, { d1DatabaseId, d1DatabaseName, r2BucketName }) => {
|
|
10868
10868
|
const cwd = getCwd();
|
|
10869
10869
|
const cloudflarePackagePath = __require.resolve("@hot-updater/cloudflare/package.json", { paths: [cwd] });
|
|
10870
|
-
const { tmpDir, removeTmpDir } = await copyDirToTmp(path
|
|
10871
|
-
const workerRoot = path
|
|
10870
|
+
const { tmpDir, removeTmpDir } = await copyDirToTmp(path.dirname(cloudflarePackagePath));
|
|
10871
|
+
const workerRoot = path.join(tmpDir, "worker");
|
|
10872
10872
|
try {
|
|
10873
|
-
const wranglerConfig = JSON.parse(await fs
|
|
10873
|
+
const wranglerConfig = JSON.parse(await fs.readFile(path.join(workerRoot, "wrangler.json"), "utf-8"));
|
|
10874
10874
|
wranglerConfig.d1_databases = [{
|
|
10875
10875
|
binding: "DB",
|
|
10876
10876
|
database_id: d1DatabaseId,
|
|
@@ -10881,19 +10881,19 @@ const deployWorker = async (oauth_token, accountId, { d1DatabaseId, d1DatabaseNa
|
|
|
10881
10881
|
bucket_name: r2BucketName
|
|
10882
10882
|
}];
|
|
10883
10883
|
wranglerConfig.vars = { JWT_SECRET: crypto.randomBytes(32).toString("hex") };
|
|
10884
|
-
await fs
|
|
10884
|
+
await fs.writeFile(path.join(workerRoot, "wrangler.json"), JSON.stringify(wranglerConfig, null, 2));
|
|
10885
10885
|
const wrangler = await createWrangler({
|
|
10886
10886
|
stdio: "inherit",
|
|
10887
10887
|
cloudflareApiToken: oauth_token,
|
|
10888
10888
|
cwd: workerRoot,
|
|
10889
10889
|
accountId
|
|
10890
10890
|
});
|
|
10891
|
-
const migrationPath = await path
|
|
10892
|
-
const migrationFiles = await fs
|
|
10891
|
+
const migrationPath = await path.join(workerRoot, "migrations");
|
|
10892
|
+
const migrationFiles = await fs.readdir(migrationPath);
|
|
10893
10893
|
for (const file of migrationFiles) if (file.endsWith(".sql")) {
|
|
10894
|
-
const filePath = path
|
|
10895
|
-
const content = await fs
|
|
10896
|
-
await fs
|
|
10894
|
+
const filePath = path.join(migrationPath, file);
|
|
10895
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
10896
|
+
await fs.writeFile(filePath, transformTemplate(content, { BUCKET_NAME: r2BucketName }));
|
|
10897
10897
|
}
|
|
10898
10898
|
await wrangler("d1", "migrations", "apply", d1DatabaseName, "--remote");
|
|
10899
10899
|
const workerName = await p.text({
|
|
@@ -11058,7 +11058,7 @@ const runInit = async ({ build }) => {
|
|
|
11058
11058
|
d1DatabaseName,
|
|
11059
11059
|
r2BucketName: selectedBucketName
|
|
11060
11060
|
});
|
|
11061
|
-
await fs
|
|
11061
|
+
await fs.writeFile("hot-updater.config.ts", getConfigTemplate(build));
|
|
11062
11062
|
await makeEnv({
|
|
11063
11063
|
HOT_UPDATER_CLOUDFLARE_API_TOKEN: apiToken,
|
|
11064
11064
|
HOT_UPDATER_CLOUDFLARE_ACCOUNT_ID: accountId,
|
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,8 @@ let _hot_updater_core = require("@hot-updater/core");
|
|
|
26
26
|
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
27
27
|
let cloudflare = require("cloudflare");
|
|
28
28
|
cloudflare = __toESM(cloudflare);
|
|
29
|
+
let path = require("path");
|
|
30
|
+
path = __toESM(path);
|
|
29
31
|
let node_url = require("node:url");
|
|
30
32
|
let node_child_process = require("node:child_process");
|
|
31
33
|
let node_string_decoder = require("node:string_decoder");
|
|
@@ -36,8 +38,6 @@ let node_tty = require("node:tty");
|
|
|
36
38
|
node_tty = __toESM(node_tty);
|
|
37
39
|
let node_path = require("node:path");
|
|
38
40
|
node_path = __toESM(node_path);
|
|
39
|
-
let path = require("path");
|
|
40
|
-
path = __toESM(path);
|
|
41
41
|
let node_timers_promises = require("node:timers/promises");
|
|
42
42
|
let node_os = require("node:os");
|
|
43
43
|
let node_events = require("node:events");
|
package/dist/index.mjs
CHANGED
|
@@ -2,14 +2,14 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { DEFAULT_ROLLOUT_COHORT_COUNT } from "@hot-updater/core";
|
|
3
3
|
import { calculatePagination, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, getContentType, parseStorageUri } from "@hot-updater/plugin-core";
|
|
4
4
|
import Cloudflare from "cloudflare";
|
|
5
|
+
import path from "path";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
7
8
|
import { StringDecoder } from "node:string_decoder";
|
|
8
9
|
import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
|
|
9
10
|
import process$1, { execArgv, execPath, hrtime, platform } from "node:process";
|
|
10
11
|
import tty from "node:tty";
|
|
11
|
-
import path from "node:path";
|
|
12
|
-
import path$1 from "path";
|
|
12
|
+
import path$1 from "node:path";
|
|
13
13
|
import { scheduler, setImmediate, setTimeout } from "node:timers/promises";
|
|
14
14
|
import { constants } from "node:os";
|
|
15
15
|
import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:events";
|
|
@@ -1663,33 +1663,33 @@ function toPath(urlOrPath) {
|
|
|
1663
1663
|
}
|
|
1664
1664
|
function traversePathUp(startPath) {
|
|
1665
1665
|
return { *[Symbol.iterator]() {
|
|
1666
|
-
let currentPath = path.resolve(toPath(startPath));
|
|
1666
|
+
let currentPath = path$1.resolve(toPath(startPath));
|
|
1667
1667
|
let previousPath;
|
|
1668
1668
|
while (previousPath !== currentPath) {
|
|
1669
1669
|
yield currentPath;
|
|
1670
1670
|
previousPath = currentPath;
|
|
1671
|
-
currentPath = path.resolve(currentPath, "..");
|
|
1671
|
+
currentPath = path$1.resolve(currentPath, "..");
|
|
1672
1672
|
}
|
|
1673
1673
|
} };
|
|
1674
1674
|
}
|
|
1675
1675
|
//#endregion
|
|
1676
1676
|
//#region ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
|
|
1677
1677
|
const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath = process$1.execPath, addExecPath = true } = {}) => {
|
|
1678
|
-
const cwdPath = path.resolve(toPath(cwd));
|
|
1678
|
+
const cwdPath = path$1.resolve(toPath(cwd));
|
|
1679
1679
|
const result = [];
|
|
1680
|
-
const pathParts = pathOption.split(path.delimiter);
|
|
1680
|
+
const pathParts = pathOption.split(path$1.delimiter);
|
|
1681
1681
|
if (preferLocal) applyPreferLocal(result, pathParts, cwdPath);
|
|
1682
1682
|
if (addExecPath) applyExecPath(result, pathParts, execPath, cwdPath);
|
|
1683
|
-
return pathOption === "" || pathOption === path.delimiter ? `${result.join(path.delimiter)}${pathOption}` : [...result, pathOption].join(path.delimiter);
|
|
1683
|
+
return pathOption === "" || pathOption === path$1.delimiter ? `${result.join(path$1.delimiter)}${pathOption}` : [...result, pathOption].join(path$1.delimiter);
|
|
1684
1684
|
};
|
|
1685
1685
|
const applyPreferLocal = (result, pathParts, cwdPath) => {
|
|
1686
1686
|
for (const directory of traversePathUp(cwdPath)) {
|
|
1687
|
-
const pathPart = path.join(directory, "node_modules/.bin");
|
|
1687
|
+
const pathPart = path$1.join(directory, "node_modules/.bin");
|
|
1688
1688
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
1689
1689
|
}
|
|
1690
1690
|
};
|
|
1691
1691
|
const applyExecPath = (result, pathParts, execPath, cwdPath) => {
|
|
1692
|
-
const pathPart = path.resolve(cwdPath, toPath(execPath), "..");
|
|
1692
|
+
const pathPart = path$1.resolve(cwdPath, toPath(execPath), "..");
|
|
1693
1693
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
1694
1694
|
};
|
|
1695
1695
|
const npmRunPathEnv = ({ env = process$1.env, ...options } = {}) => {
|
|
@@ -2699,7 +2699,7 @@ const mapNode = ({ options }) => {
|
|
|
2699
2699
|
const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = false, nodePath = execPath, nodeOptions = execArgv.filter((nodeOption) => !nodeOption.startsWith("--inspect")), cwd, execPath: formerNodePath, ...options }) => {
|
|
2700
2700
|
if (formerNodePath !== void 0) throw new TypeError("The \"execPath\" option has been removed. Please use the \"nodePath\" option instead.");
|
|
2701
2701
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath, "The \"nodePath\" option");
|
|
2702
|
-
const resolvedNodePath = path.resolve(cwd, normalizedNodePath);
|
|
2702
|
+
const resolvedNodePath = path$1.resolve(cwd, normalizedNodePath);
|
|
2703
2703
|
const newOptions = {
|
|
2704
2704
|
...options,
|
|
2705
2705
|
nodePath: resolvedNodePath,
|
|
@@ -2711,7 +2711,7 @@ const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = fal
|
|
|
2711
2711
|
commandArguments,
|
|
2712
2712
|
newOptions
|
|
2713
2713
|
];
|
|
2714
|
-
if (path.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
|
|
2714
|
+
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\".");
|
|
2715
2715
|
return [
|
|
2716
2716
|
resolvedNodePath,
|
|
2717
2717
|
[
|
|
@@ -2795,7 +2795,7 @@ const serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encod
|
|
|
2795
2795
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/arguments/cwd.js
|
|
2796
2796
|
const normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
2797
2797
|
const cwdString = safeNormalizeFileUrl(cwd, "The \"cwd\" option");
|
|
2798
|
-
return path.resolve(cwdString);
|
|
2798
|
+
return path$1.resolve(cwdString);
|
|
2799
2799
|
};
|
|
2800
2800
|
const getDefaultCwd = () => {
|
|
2801
2801
|
try {
|
|
@@ -2833,7 +2833,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
2833
2833
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
2834
2834
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
2835
2835
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
2836
|
-
if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
2836
|
+
if (process$1.platform === "win32" && path$1.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
2837
2837
|
return {
|
|
2838
2838
|
file,
|
|
2839
2839
|
commandArguments,
|
|
@@ -6712,7 +6712,7 @@ const r2Storage = createStoragePlugin({
|
|
|
6712
6712
|
},
|
|
6713
6713
|
async upload(key, filePath) {
|
|
6714
6714
|
const contentType = getContentType(filePath);
|
|
6715
|
-
const Key = getStorageKey(key, path
|
|
6715
|
+
const Key = getStorageKey(key, path.basename(filePath));
|
|
6716
6716
|
try {
|
|
6717
6717
|
const { stderr, exitCode } = await wrangler("r2", "object", "put", [bucketName, Key].join("/"), "--file", filePath, "--content-type", contentType, "--remote");
|
|
6718
6718
|
if (exitCode !== 0 && stderr) throw new Error(stderr);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/cloudflare",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.29.
|
|
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",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"cloudflare": "4.2.0",
|
|
51
51
|
"hono": "4.12.9",
|
|
52
52
|
"uuidv7": "^1.0.2",
|
|
53
|
-
"@hot-updater/
|
|
54
|
-
"@hot-updater/
|
|
55
|
-
"@hot-updater/
|
|
56
|
-
"@hot-updater/
|
|
57
|
-
"@hot-updater/
|
|
53
|
+
"@hot-updater/cli-tools": "0.29.4",
|
|
54
|
+
"@hot-updater/core": "0.29.4",
|
|
55
|
+
"@hot-updater/js": "0.29.4",
|
|
56
|
+
"@hot-updater/plugin-core": "0.29.4",
|
|
57
|
+
"@hot-updater/server": "0.29.4"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@cloudflare/vitest-pool-workers": "0.13.0",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"pg-minify": "^1.6.5",
|
|
68
68
|
"semver": "^7.6.3",
|
|
69
69
|
"toml": "^3.0.0",
|
|
70
|
-
"typescript": "^
|
|
70
|
+
"typescript": "^6.0.2",
|
|
71
71
|
"vitest": "4.1.0",
|
|
72
72
|
"wrangler": "^4.5.0",
|
|
73
73
|
"xdg-app-paths": "^8.3.0",
|
|
74
|
-
"@hot-updater/test-utils": "0.29.
|
|
74
|
+
"@hot-updater/test-utils": "0.29.4"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"build": "tsdown && pnpm build:worker",
|
|
@@ -203,8 +203,8 @@ const resolveDbFromContext = (
|
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
export const d1WorkerDatabase = <
|
|
206
|
-
TContext extends
|
|
207
|
-
RequestEnvContext<CloudflareWorkerDatabaseEnv
|
|
206
|
+
TContext extends RequestEnvContext<CloudflareWorkerDatabaseEnv> =
|
|
207
|
+
RequestEnvContext<CloudflareWorkerDatabaseEnv>,
|
|
208
208
|
>() =>
|
|
209
209
|
createDatabasePlugin<CloudflareWorkerDatabaseConfig<TContext>, TContext>({
|
|
210
210
|
name: "d1WorkerDatabase",
|
package/src/d1Database.spec.ts
CHANGED
package/src/r2Storage.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
createStorageKeyBuilder,
|
|
3
5
|
createStoragePlugin,
|
|
@@ -6,7 +8,6 @@ import {
|
|
|
6
8
|
} from "@hot-updater/plugin-core";
|
|
7
9
|
import { ExecaError } from "execa";
|
|
8
10
|
|
|
9
|
-
import path from "path";
|
|
10
11
|
import { createWrangler } from "./utils/createWrangler";
|
|
11
12
|
|
|
12
13
|
export interface R2StorageConfig {
|
package/src/r2WorkerStorage.ts
CHANGED
|
@@ -44,8 +44,8 @@ const resolveJwtSecretFromContext = (
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export const r2WorkerStorage = <
|
|
47
|
-
TContext extends
|
|
48
|
-
RequestEnvContext<CloudflareWorkerStorageEnv
|
|
47
|
+
TContext extends RequestEnvContext<CloudflareWorkerStorageEnv> =
|
|
48
|
+
RequestEnvContext<CloudflareWorkerStorageEnv>,
|
|
49
49
|
>(
|
|
50
50
|
config: CloudflareWorkerStorageConfig<TContext>,
|
|
51
51
|
) => {
|
package/src/worker/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { verifyJwtSignedUrl } from "@hot-updater/js";
|
|
2
2
|
|
|
3
3
|
import type { RequestEnvContext as BaseRequestEnvContext } from "@hot-updater/plugin-core";
|
|
4
|
+
|
|
4
5
|
import {
|
|
5
6
|
type CloudflareWorkerDatabaseEnv,
|
|
6
7
|
d1WorkerDatabase,
|
|
@@ -14,20 +15,19 @@ import {
|
|
|
14
15
|
export type { CloudflareWorkerDatabaseEnv, CloudflareWorkerStorageEnv };
|
|
15
16
|
|
|
16
17
|
export interface CloudflareWorkerRuntimeEnv
|
|
17
|
-
extends CloudflareWorkerDatabaseEnv,
|
|
18
|
-
CloudflareWorkerStorageEnv {}
|
|
18
|
+
extends CloudflareWorkerDatabaseEnv, CloudflareWorkerStorageEnv {}
|
|
19
19
|
|
|
20
20
|
export type RequestEnvContext<TEnv = CloudflareWorkerRuntimeEnv> =
|
|
21
21
|
BaseRequestEnvContext<TEnv>;
|
|
22
22
|
|
|
23
23
|
export const d1Database = <
|
|
24
|
-
TContext extends
|
|
25
|
-
RequestEnvContext<CloudflareWorkerRuntimeEnv
|
|
24
|
+
TContext extends RequestEnvContext<CloudflareWorkerRuntimeEnv> =
|
|
25
|
+
RequestEnvContext<CloudflareWorkerRuntimeEnv>,
|
|
26
26
|
>() => d1WorkerDatabase<TContext>();
|
|
27
27
|
|
|
28
28
|
export const r2Storage = <
|
|
29
|
-
TContext extends
|
|
30
|
-
RequestEnvContext<CloudflareWorkerRuntimeEnv
|
|
29
|
+
TContext extends RequestEnvContext<CloudflareWorkerRuntimeEnv> =
|
|
30
|
+
RequestEnvContext<CloudflareWorkerRuntimeEnv>,
|
|
31
31
|
>(
|
|
32
32
|
config: CloudflareWorkerStorageConfig<TContext>,
|
|
33
33
|
) => r2WorkerStorage<TContext>(config);
|
package/worker/dist/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
This folder contains the built output assets for the worker "hot-updater" generated at 2026-04-
|
|
1
|
+
This folder contains the built output assets for the worker "hot-updater" generated at 2026-04-07T10:08:43.621Z.
|