@rsbuild/plugin-assets-retry 1.5.0 → 1.5.1
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/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -410,7 +410,7 @@ pluginAssetsRetry({
|
|
|
410
410
|
|
|
411
411
|
## Notes
|
|
412
412
|
|
|
413
|
-
When you use Assets Retry plugin, the Rsbuild injects some runtime code into the HTML and [Rspack Runtime](https://rspack.
|
|
413
|
+
When you use Assets Retry plugin, the Rsbuild injects some runtime code into the HTML and [Rspack Runtime](https://rspack.rs/misc/glossary#runtime), then serializes the Assets Retry plugin config, inserting it into the runtime code. Therefore, you need to be aware of the following:
|
|
414
414
|
|
|
415
415
|
- Avoid configuring sensitive information in Assets Retry plugin, such as internal tokens.
|
|
416
416
|
- Avoid referencing variables or methods outside of `onRetry`, `onSuccess`, and `onFail`.
|
|
@@ -454,7 +454,7 @@ If you need to retry assets in micro-frontend scenarios, please contact the deve
|
|
|
454
454
|
|
|
455
455
|
Assets Retry plugin listens to the page error event to know whether the current resource fails to load and needs to be retried. Therefore, if the resource in the custom template is executed earlier than Assets Retry plugin, then Assets Retry plugin cannot listen to the event that the resource fails to load, so it will not be retried.
|
|
456
456
|
|
|
457
|
-
If you want Assets Retry plugin to work on resources in custom templates, you can refer to [Custom Insertion Example](https://github.com/
|
|
457
|
+
If you want Assets Retry plugin to work on resources in custom templates, you can refer to [Custom Insertion Example](https://github.com/rstackjs/html-rspack-plugin/tree/main/examples/custom-insertion-position) to modify [html.inject](/config/html/inject) configuration and custom template.
|
|
458
458
|
|
|
459
459
|
```diff
|
|
460
460
|
<!DOCTYPE html>
|
package/README.zh-CN.md
CHANGED
|
@@ -408,7 +408,7 @@ pluginAssetsRetry({
|
|
|
408
408
|
|
|
409
409
|
## 注意事项
|
|
410
410
|
|
|
411
|
-
当你使用 Assets Retry 插件时,Rsbuild 会分别向 HTML 和 [Rspack Runtime](https://rspack.
|
|
411
|
+
当你使用 Assets Retry 插件时,Rsbuild 会分别向 HTML 和 [Rspack Runtime](https://rspack.rs/zh/misc/glossary#runtime) 中注入运行时代码,并将 Assets Retry 插件配置的内容序列化后插入到这些代码中,因此你需要注意:
|
|
412
412
|
|
|
413
413
|
- 避免在 Assets Retry 插件中配置敏感信息,比如内部使用的 token。
|
|
414
414
|
- 避免在 `onRetry`,`onSuccess`,`onFail` 中引用函数外部的变量或方法。
|
|
@@ -452,7 +452,7 @@ pluginAssetsRetry({
|
|
|
452
452
|
|
|
453
453
|
Assets Retry 插件通过监听页面 error 事件来获悉当前资源是否加载失败需要重试。因此,如果自定义模版中的资源执行早于 Assets Retry 插件,那 Assets Retry 插件无法监听到该资源加载失败的事件,retry 无法对其生效。
|
|
454
454
|
|
|
455
|
-
如果想要 Assets Retry 插件对自定义模版中的资源生效,可参考 [自定义插入示例](https://github.com/
|
|
455
|
+
如果想要 Assets Retry 插件对自定义模版中的资源生效,可参考 [自定义插入示例](https://github.com/rstackjs/html-rspack-plugin/tree/main/examples/custom-insertion-position) 来修改 [html.inject](/config/html/inject) 配置和自定义模版。
|
|
456
456
|
|
|
457
457
|
```diff
|
|
458
458
|
<!DOCTYPE html>
|
package/dist/index.cjs
CHANGED
|
@@ -297,7 +297,7 @@ var __webpack_exports__ = {};
|
|
|
297
297
|
const { inlineScript = true } = userOptions;
|
|
298
298
|
const getScriptPath = (environment)=>{
|
|
299
299
|
const distDir = environment.config.output.distPath.js;
|
|
300
|
-
return external_node_path_default().posix.join(distDir, "assets-retry.1-5-
|
|
300
|
+
return external_node_path_default().posix.join(distDir, "assets-retry.1-5-1.js");
|
|
301
301
|
};
|
|
302
302
|
const getDefaultValueFromRsbuildConfig = (config)=>{
|
|
303
303
|
const minify = 'boolean' == typeof config.output.minify ? config.output.minify : config.output.minify?.js;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as __rspack_external_crypto from "crypto";
|
|
2
2
|
import node_fs from "node:fs";
|
|
3
3
|
import node_path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -121,7 +121,7 @@ var __webpack_modules__ = {
|
|
|
121
121
|
};
|
|
122
122
|
},
|
|
123
123
|
crypto: function(module) {
|
|
124
|
-
module.exports =
|
|
124
|
+
module.exports = __rspack_external_crypto;
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
var __webpack_module_cache__ = {};
|
|
@@ -272,7 +272,7 @@ const pluginAssetsRetry = (userOptions = {})=>({
|
|
|
272
272
|
const { inlineScript = true } = userOptions;
|
|
273
273
|
const getScriptPath = (environment)=>{
|
|
274
274
|
const distDir = environment.config.output.distPath.js;
|
|
275
|
-
return node_path.posix.join(distDir, "assets-retry.1-5-
|
|
275
|
+
return node_path.posix.join(distDir, "assets-retry.1-5-1.js");
|
|
276
276
|
};
|
|
277
277
|
const getDefaultValueFromRsbuildConfig = (config)=>{
|
|
278
278
|
const minify = 'boolean' == typeof config.output.minify ? config.output.minify : config.output.minify?.js;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-assets-retry",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "An Rsbuild plugin to automatically resend requests when static assets fail to load.",
|
|
5
|
-
"repository": "https://github.com/
|
|
5
|
+
"repository": "https://github.com/rstackjs/rsbuild-plugin-assets-retry",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@biomejs/biome": "^1.9.4",
|
|
33
|
-
"@microsoft/api-extractor": "^7.
|
|
34
|
-
"@playwright/test": "^1.
|
|
35
|
-
"@rsbuild/core": "^1.6.
|
|
36
|
-
"@rsbuild/plugin-react": "^1.4.
|
|
37
|
-
"@rslib/core": "^0.
|
|
38
|
-
"@swc/core": "^1.
|
|
39
|
-
"@types/node": "^
|
|
40
|
-
"@types/react": "^19.2.
|
|
41
|
-
"@types/react-dom": "^19.2.
|
|
33
|
+
"@microsoft/api-extractor": "^7.55.1",
|
|
34
|
+
"@playwright/test": "^1.57.0",
|
|
35
|
+
"@rsbuild/core": "^1.6.10",
|
|
36
|
+
"@rsbuild/plugin-react": "^1.4.2",
|
|
37
|
+
"@rslib/core": "^0.18.2",
|
|
38
|
+
"@swc/core": "^1.15.3",
|
|
39
|
+
"@types/node": "^24.10.1",
|
|
40
|
+
"@types/react": "^19.2.7",
|
|
41
|
+
"@types/react-dom": "^19.2.3",
|
|
42
42
|
"@types/serialize-javascript": "^5.0.4",
|
|
43
|
-
"playwright": "^1.
|
|
43
|
+
"playwright": "^1.57.0",
|
|
44
44
|
"react": "^19.2.0",
|
|
45
45
|
"react-dom": "^19.2.0",
|
|
46
46
|
"serialize-javascript": "^6.0.2",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"typescript": "^5.9.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@rsbuild/core": "1.
|
|
51
|
+
"@rsbuild/core": "^1.0.0 || ^2.0.0-0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
54
|
"@rsbuild/core": {
|
|
55
55
|
"optional": true
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
|
-
"packageManager": "pnpm@10.
|
|
58
|
+
"packageManager": "pnpm@10.24.0",
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public",
|
|
61
61
|
"registry": "https://registry.npmjs.org/"
|