openwrangler 0.0.5 → 0.0.8
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/index.mjs +13 -1
- package/package.json +7 -2
package/dist/index.mjs
CHANGED
|
@@ -423,12 +423,24 @@ async function signRequest(params) {
|
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
function encodeS3Key(key) {
|
|
427
|
+
return key.split("").map((char) => {
|
|
428
|
+
if (char === "/") return char;
|
|
429
|
+
if (/[A-Za-z0-9\-_.~]/.test(char)) return char;
|
|
430
|
+
const code = char.charCodeAt(0);
|
|
431
|
+
if (code > 127) {
|
|
432
|
+
return encodeURIComponent(char);
|
|
433
|
+
}
|
|
434
|
+
return "%" + code.toString(16).toUpperCase().padStart(2, "0");
|
|
435
|
+
}).join("");
|
|
436
|
+
}
|
|
437
|
+
|
|
426
438
|
function createR2Binding$1(config, bucketName) {
|
|
427
439
|
const { accountId, r2AccessKeyId, r2SecretAccessKey } = config;
|
|
428
440
|
const baseUrl = `https://${accountId}.r2.cloudflarestorage.com/${bucketName}`;
|
|
429
441
|
async function signedFetch(method, key, options) {
|
|
430
442
|
const queryString = options?.queryParams ? `?${new URLSearchParams(options.queryParams).toString()}` : "";
|
|
431
|
-
const url = `${baseUrl}/${
|
|
443
|
+
const url = `${baseUrl}/${encodeS3Key(key)}${queryString}`;
|
|
432
444
|
let body;
|
|
433
445
|
if (options?.body instanceof ReadableStream) {
|
|
434
446
|
const reader = options.body.getReader();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openwrangler",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.8",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"@antfu/eslint-config": "^6.7.3",
|
|
18
18
|
"@cloudflare/workers-types": "^4.20251231.0",
|
|
19
19
|
"eslint": "^9.39.2",
|
|
20
|
+
"npm-run-all": "^4.1.5",
|
|
20
21
|
"nuxt": "^3.15.0",
|
|
21
22
|
"typescript": "^5.7.2",
|
|
22
23
|
"unbuild": "^3.3.1",
|
|
@@ -27,6 +28,10 @@
|
|
|
27
28
|
"dev": "cd ./playground && pnpm dev",
|
|
28
29
|
"build": "unbuild",
|
|
29
30
|
"lint": "eslint .",
|
|
30
|
-
"lint:fix": "eslint . --fix"
|
|
31
|
+
"lint:fix": "eslint . --fix",
|
|
32
|
+
"deploy": "run-s deploy.patch deploy.build deploy.publish",
|
|
33
|
+
"deploy.patch": "pnpm version patch --no-git-tag-version && pnpm --filter @bino0216/nitro-cloudflare-dev version patch --no-git-tag-version && git add . && git commit -m \"chore: release\"",
|
|
34
|
+
"deploy.build": "pnpm build && pnpm --filter @bino0216/nitro-cloudflare-dev build",
|
|
35
|
+
"deploy.publish": "pnpm publish --no-git-checks && pnpm --filter @bino0216/nitro-cloudflare-dev publish --no-git-checks"
|
|
31
36
|
}
|
|
32
37
|
}
|