{"id":278796,"date":"2023-08-09T09:00:26","date_gmt":"2023-08-09T01:00:26","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=278796"},"modified":"2023-07-27T22:20:44","modified_gmt":"2023-07-27T14:20:44","slug":"java-script-linux","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/java-script-linux.html","title":{"rendered":"\u65b0\u578b\u9ad8\u901f JavaScript \u8fd0\u884c\u65f6 Bun 0.7 \u53d1\u5e03"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u8fd1\u65e5\uff0c\u65b0\u578b JavaScript \u8fd0\u884c\u65f6 Bun \u6b63\u5f0f\u53d1\u5e03\u4e86 0.7 \u7248\u672c\uff0c\u5e26\u6765\u4e86\u91cd\u5927\u7684\u5347\u7ea7\u3002\u636e\u6089\uff0cBun \u662f\u4e00\u4e2a\u914d\u5957\u9f50\u5168\u7684 JavaScript \u89e3\u51b3\u65b9\u6848\uff0c\u96c6\u8fd0\u884c\u65f6\u3001\u6253\u5305\u5668\u3001\u8f6c\u8bd1\u5668\u548c\u5305\u7ba1\u7406\u5668\u4e8e\u4e00\u4f53\uff0c\u8ffd\u6c42\u6781\u81f4\u7684\u8fd0\u884c\u901f\u5ea6\u3002\u6b64\u6b21\u66f4\u65b0\u4e3b\u8981\u96c6\u4e2d\u5728\u4e0e Node.js \u7684\u517c\u5bb9\u6027\u63d0\u5347\u548c\u65b0\u529f\u80fd\u652f\u6301\u4e0a\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n \u9996\u5148\uff0cBun \u5ba3\u5e03\u4e0e\u6d41\u884c\u7684\u524d\u7aef\u6253\u5305\u5de5\u5177 Vite \u5b9e\u73b0\u4e86\u521d\u6b65\u517c\u5bb9\u3002\u5f00\u53d1\u8005\u73b0\u5728\u53ef\u4ee5\u4f7f\u7528 Bun \u76f4\u63a5\u8fd0\u884c Vite \u9879\u76ee\uff0c\u4eab\u53d7\u70ed\u66f4\u65b0\u7b49\u65b9\u4fbf\u529f\u80fd\uff0c\u65e0\u9700\u8fdb\u884c\u989d\u5916\u914d\u7f6e\u3002\u4e0d\u8fc7\u7531\u4e8e Bun \u548c Vite \u5185\u90e8\u673a\u5236\u4e0d\u540c\uff0cVite \u76ee\u524d\u4ecd\u672a\u4f7f\u7528 Bun \u7684\u6253\u5305\u548c\u8f6c\u8bd1\u4f18\u52bf\u3002\u4f46\u8fd9\u4e3a\u672a\u6765\u7684\u6df1\u5ea6\u96c6\u6210\u521b\u9020\u4e86\u6761\u4ef6\u3002<\/p>\n \u7136\u540e\uff0cBun \u5b9e\u73b0\u4e86\u6d4f\u89c8\u5668\u73af\u5883\u4e0b\u7684 Worker \u7ebf\u7a0b\u652f\u6301\u3002\u5f00\u53d1\u8005\u73b0\u5728\u53ef\u4ee5\u901a\u8fc7\u65b0\u52a0\u7684 Worker \u7c7b\u521b\u5efa\u5b50\u7ebf\u7a0b\uff0c\u5229\u7528\u591a\u6838 CPU \u63d0\u5347\u8ba1\u7b97\u5bc6\u96c6\u578b\u4efb\u52a1\u7684\u6267\u884c\u6548\u7387\u3002Bun \u7684 Worker \u5929\u751f\u652f\u6301\u6a21\u5757\u5316\u3001TypeScript \u7b49\u7279\u6027\uff0c\u6bd4\u6d4f\u89c8\u5668\u539f\u751f Worker \u7528\u8d77\u6765\u66f4\u987a\u624b\u3002\u503c\u5f97\u4e00\u63d0\u7684\u662f\uff0c\u6d41\u884c\u7684 comlink \u5e93\u4e5f\u53ef\u4ee5\u65e0\u7f1d\u5e94\u7528\u5728 Bun \u7684 Worker \u4e2d\uff0c\u8ba9\u7ebf\u7a0b\u95f4\u901a\u4fe1\u66f4\u52a0\u65b9\u4fbf\u3002<\/p>\n \u6b64\u5916\uff0cBun \u8fd8\u539f\u751f\u652f\u6301\u4e86\u5f02\u6b65\u4e0a\u4e0b\u6587\u5b58\u50a8 AsyncLocalStorage\uff0c\u8fd9\u662f\u8bb8\u591a\u6846\u67b6\u5b9e\u73b0\u5f02\u6b65\u64cd\u4f5c\u8ffd\u8e2a\u7684\u5173\u952e\u3002\u63a5\u4e0b\u6765 Bun \u6709\u671b\u517c\u5bb9 Next.js \u7b49\u6d41\u884c\u6846\u67b6\u3002<\/p>\n \u5728 Node.js \u517c\u5bb9\u6027\u65b9\u9762\uff0cBun \u8ffd\u52a0\u5b9e\u73b0\u4e86\u4e8b\u4ef6\u5faa\u73af\u4e2d\u7684\u5b9a\u65f6\u5668\u56de\u8c03\u4fdd\u8bc1\u5f02\u6b65\u6267\u884c\u7684\u7279\u6027\uff0c\u5bf9\u547d\u4ee4\u884c\u5e94\u7528\u6765\u8bf4\u91cd\u8981\u7684\u6807\u51c6\u8f93\u51fa\u6d41\u4e5f\u589e\u5f3a\u4e86\u7a97\u53e3\u5c3a\u5bf8\u67e5\u8be2\u652f\u6301\u3002\u7279\u522b\u662f\u5728 TLS \u7f51\u7edc\u65b9\u9762\uff0cBun \u6539\u8fdb\u4e86\u5bc6\u94a5\u5bfc\u51fa\u3001\u4f1a\u8bdd\u91cd\u7528\u7b49\u63a5\u53e3\u7684\u5b9e\u73b0\uff0c\u6ee1\u8db3\u4e86\u6d41\u884c\u52a0\u5bc6\u5e93\u7684\u9700\u6c42\u3002<\/p>\n \u5f53\u7136\uff0c\u6b64\u6b21\u66f4\u65b0\u4e5f\u589e\u52a0\u4e86\u5b9e\u7528\u7684\u65b0\u529f\u80fd\u3002\u6bd4\u5982\uff0c\u5f00\u53d1\u8005\u73b0\u5728\u53ef\u4ee5\u66f4\u5bb9\u6613\u5730\u5728\u4e3b\u7ebf\u7a0b\u4e0e Worker \u4e4b\u95f4\u4f20\u9012\u6570\u636e\uff0c\u8fd8\u53ef\u4ee5\u5229\u7528\u7ed3\u6784\u5316\u514b\u9686\u7b97\u6cd5\uff08structuredClone()\uff09\u8fdb\u884c\u9ad8\u6548\u7684\u6df1\u62f7\u8d1d\u3002\u5c06\u53ef\u8bfb\u6d41\u8f6c\u6362\u4e3a FormData \u5bf9\u8c61\u7684 API \u4e5f\u6210\u4e3a\u53ef\u80fd\u3002\u6d4b\u8bd5\u6846\u67b6\u65b9\u9762\uff0c\u65b0\u589e\u4e86\u5728\u7b2c\u4e00\u4e2a\u6d4b\u8bd5\u5931\u8d25\u540e\u7acb\u5373\u7ed3\u675f\u7684 \u201c--bail\u201d \u6a21\u5f0f\uff0c\u63d0\u9ad8\u4e86 CI\/CD \u73af\u5883\u4e0b\u7684\u6548\u7387\u3002WebSocket \u8fde\u63a5\u4e5f\u589e\u5f3a\u4e86 ping\/pong \u76d1\u542c\u652f\u6301\u3002<\/p>\n \u4e00\u4e9b\u68d8\u624b\u7684 Bug \u5bfc\u81f4\u7684\u5185\u5b58\u6cc4\u9732\u548c\u6027\u80fd\u95ee\u9898\u4e5f\u5f97\u5230\u4fee\u590d\u3002\u603b\u4f53\u6765\u770b\uff0cBun 0.7 \u7248\u672c\u5e26\u6765\u7684\u5347\u7ea7\u8ba9\u5176\u5728\u4e0e Node.js \u7684\u7ade\u4e89\u4e2d\u53c8\u8fd1\u4e86\u4e00\u6b65\u3002\u968f\u7740\u517c\u5bb9\u6027\u8fdb\u4e00\u6b65\u63d0\u9ad8\uff0c\u5f00\u53d1\u8005\u53ef\u80fd\u4f1a\u770b\u5230\u8d8a\u6765\u8d8a\u591a\u7684\u9879\u76ee\u8f6c\u5411\u4f7f\u7528 Bun\u3002\u6211\u4eec\u62ed\u76ee\u4ee5\u5f85 Bun \u540e\u7eed\u7684\u8868\u73b0\u3002\u6bd5\u7adf\uff0c\u4e00\u4e2a\u5feb\u901f\u3001\u9ad8\u6548\u3001\u6613\u7528\u7684 JavaScript \u89e3\u51b3\u65b9\u6848\uff0c\u5bf9\u5f00\u53d1\u8005\u7684\u5438\u5f15\u529b\u53ef\u60f3\u800c\u77e5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u9996\u5148\uff0cBun \u5ba3\u5e03\u4e0e\u6d41\u884c\u7684\u524d\u7aef\u6253\u5305\u5de5\u5177 Vite \u5b9e\u73b0\u4e86\u521d\u6b65\u517c\u5bb9\u3002\u5f00\u53d1\u8005\u73b0\u5728\u53ef\u4ee5\u4f7f\u7528 Bun \u76f4\u63a5\u8fd0\u884c Vit […]<\/p>\n","protected":false},"author":1479,"featured_media":30488,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[21],"tags":[],"class_list":["post-278796","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/278796","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=278796"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/278796\/revisions"}],"predecessor-version":[{"id":278952,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/278796\/revisions\/278952"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/30488"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=278796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=278796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=278796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}} |