@smithy/util-body-length-browser 4.0.0 → 4.1.0
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-cjs/index.js +6 -9
- package/package.json +5 -4
package/dist-cjs/index.js
CHANGED
|
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
calculateBodyLength: () => calculateBodyLength
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
|
|
27
27
|
// src/calculateBodyLength.ts
|
|
28
28
|
var TEXT_ENCODER = typeof TextEncoder == "function" ? new TextEncoder() : null;
|
|
@@ -34,12 +34,9 @@ var calculateBodyLength = /* @__PURE__ */ __name((body) => {
|
|
|
34
34
|
let len = body.length;
|
|
35
35
|
for (let i = len - 1; i >= 0; i--) {
|
|
36
36
|
const code = body.charCodeAt(i);
|
|
37
|
-
if (code > 127 && code <= 2047)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
len += 2;
|
|
41
|
-
if (code >= 56320 && code <= 57343)
|
|
42
|
-
i--;
|
|
37
|
+
if (code > 127 && code <= 2047) len++;
|
|
38
|
+
else if (code > 2047 && code <= 65535) len += 2;
|
|
39
|
+
if (code >= 56320 && code <= 57343) i--;
|
|
43
40
|
}
|
|
44
41
|
return len;
|
|
45
42
|
} else if (typeof body.byteLength === "number") {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/util-body-length-browser",
|
|
3
3
|
"description": "Determines the length of a request body in browsers",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.1.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
|
7
7
|
"build:cjs": "node ../../scripts/inline util-body-length-browser",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"stage-release": "rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
|
|
12
12
|
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
|
|
13
13
|
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
|
|
14
|
-
"format": "prettier --config ../../prettier.config.js --ignore-path
|
|
14
|
+
"format": "prettier --config ../../prettier.config.js --ignore-path ../../.prettierignore --write \"**/*.{ts,md,json}\"",
|
|
15
15
|
"test": "yarn g:vitest run",
|
|
16
16
|
"test:watch": "yarn g:vitest watch"
|
|
17
17
|
},
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"url": "https://aws.amazon.com/javascript/"
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
|
+
"sideEffects": false,
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"tslib": "^2.6.2"
|
|
28
29
|
},
|
|
@@ -36,10 +37,10 @@
|
|
|
36
37
|
"files": [
|
|
37
38
|
"dist-*/**"
|
|
38
39
|
],
|
|
39
|
-
"homepage": "https://github.com/
|
|
40
|
+
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/util-body-length-browser",
|
|
40
41
|
"repository": {
|
|
41
42
|
"type": "git",
|
|
42
|
-
"url": "https://github.com/
|
|
43
|
+
"url": "https://github.com/smithy-lang/smithy-typescript.git",
|
|
43
44
|
"directory": "packages/util-body-length-browser"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|