From e577923015821a8217deb409a181f4c2abbae025 Mon Sep 17 00:00:00 2001 From: A1lo Date: Fri, 24 Nov 2023 13:34:34 +0800 Subject: [PATCH 1/2] chore(deps): replace "fs-extra" with "node:fs/promise" (#16911) --- package.json | 1 - scripts/check-document-locale.js | 2 +- scripts/check-url-locale.js | 2 +- scripts/get-sourceCommit.js | 3 +-- yarn.lock | 28 ---------------------------- 5 files changed, 3 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 8a323379c4af83..8604e6bb060996 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "cld": "^2.9.1", "fdir": "^6.1.1", "front-matter": "^4.0.2", - "fs-extra": "^11.1.1", "husky": "8.0.3", "lint-staged": "15.1.0", "markdown-it": "^13.0.2", diff --git a/scripts/check-document-locale.js b/scripts/check-document-locale.js index c541974b62dce6..1fa1134e903ff2 100644 --- a/scripts/check-document-locale.js +++ b/scripts/check-document-locale.js @@ -6,7 +6,7 @@ // // Written by Queen Vinyl Da.i'gyu-Kazotetsu (@queengooborg, https://www.queengoob.org) -import fs from "fs-extra"; +import fs from "node:fs/promises"; import cld from "cld"; import { fdir } from "fdir"; import MarkdownIt from "markdown-it"; diff --git a/scripts/check-url-locale.js b/scripts/check-url-locale.js index 7fbc3b80174183..956afd5fa9469d 100644 --- a/scripts/check-url-locale.js +++ b/scripts/check-url-locale.js @@ -9,7 +9,7 @@ "use strict"; -import fs from "fs-extra"; +import fs from "node:fs/promises"; import * as path from "node:path"; import { fdir } from "fdir"; import ora from "ora"; diff --git a/scripts/get-sourceCommit.js b/scripts/get-sourceCommit.js index 2c77968cbdf9a5..ed5e1c688eaf4f 100644 --- a/scripts/get-sourceCommit.js +++ b/scripts/get-sourceCommit.js @@ -6,8 +6,7 @@ // // Written by Queen Vinyl Da.i'gyu-Kazotetsu (@queengooborg, https://www.queengoob.org) -import fs from "fs-extra"; -import cld from "cld"; +import fs from "node:fs/promises"; import { fdir } from "fdir"; import fm from "front-matter"; import ora from "ora"; diff --git a/yarn.lock b/yarn.lock index 0ac7cb667e7873..33577f56b6c3b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -339,15 +339,6 @@ front-matter@^4.0.2: dependencies: js-yaml "^3.13.1" -fs-extra@^11.1.1: - version "11.1.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.1.tgz#da69f7c39f3b002378b0954bb6ae7efdc0876e2d" - integrity sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ== - dependencies: - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -393,11 +384,6 @@ globby@13.2.2: merge2 "^1.4.1" slash "^4.0.0" -graceful-fs@^4.1.6, graceful-fs@^4.2.0: - version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" - integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== - human-signals@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28" @@ -486,15 +472,6 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -jsonfile@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" - integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== - dependencies: - universalify "^2.0.0" - optionalDependencies: - graceful-fs "^4.1.6" - lilconfig@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" @@ -1184,11 +1161,6 @@ unist-util-visit@^5.0.0: unist-util-is "^6.0.0" unist-util-visit-parents "^6.0.0" -universalify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" - integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== - util-deprecate@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" From 597a975658a4ad1bf4ef8afccceac245879939e7 Mon Sep 17 00:00:00 2001 From: Jason Lam Date: Fri, 24 Nov 2023 13:47:59 +0800 Subject: [PATCH 2/2] [zh-cn]: add the translation of ArrayBuffer.resizable (#17084) --- .../arraybuffer/resizable/index.md | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 files/zh-cn/web/javascript/reference/global_objects/arraybuffer/resizable/index.md diff --git a/files/zh-cn/web/javascript/reference/global_objects/arraybuffer/resizable/index.md b/files/zh-cn/web/javascript/reference/global_objects/arraybuffer/resizable/index.md new file mode 100644 index 00000000000000..809caa92f3d5c7 --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/arraybuffer/resizable/index.md @@ -0,0 +1,43 @@ +--- +title: ArrayBuffer.prototype.resizable +slug: Web/JavaScript/Reference/Global_Objects/ArrayBuffer/resizable +--- + +{{JSRef}} + +{{jsxref("ArrayBuffer")}} 实例的 **`resizable`** 访问器属性返回此数组缓冲区是否可以调整大小。 + +{{EmbedInteractiveExample("pages/js/arraybuffer-resizable.html")}} + +## 描述 + +`resizable` 是一个访问器属性,其 set 访问器函数是 `undefined`,这意味着你只能读取该属性。该属性的值在数组创建时就确定了。如果在构造函数中设置了 `maxByteLength` 选项,`resizable` 将返回 `true`;否则,它将返回 `false`。 + +## 示例 + +### 使用 resizable + +在这个示例中,我们创建了一个 8 字节缓冲区,该缓冲区可调整到的最大长度为 16 字节,然后检查它的 `resizable` 属性,如果 `resizable` 返回 `true` 则调整它的大小: + +```js +const buffer = new ArrayBuffer(8, { maxByteLength: 16 }); + +if (buffer.resizable) { + console.log("缓冲区可以调整大小!"); + buffer.resize(12); +} +``` + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} + +## 参见 + +- {{jsxref("ArrayBuffer")}} +- {{jsxref("ArrayBuffer.prototype.maxByteLength")}} +- {{jsxref("ArrayBuffer.prototype.resize()")}}