@rsbuild/plugin-assets-retry 0.3.5 → 0.3.7

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.d.ts CHANGED
@@ -2,14 +2,43 @@ import { RsbuildPlugin } from '@rsbuild/core';
2
2
  import { CrossOrigin } from '@rsbuild/shared';
3
3
 
4
4
  type PluginAssetsRetryOptions = {
5
+ /**
6
+ * The maximum number of retries for a single asset.
7
+ * @default 3
8
+ */
5
9
  max?: number;
10
+ /**
11
+ * Used to specify the HTML tag types that need to be retried.
12
+ * @default ['script', 'link', 'img']
13
+ */
6
14
  type?: string[];
15
+ /**
16
+ * The test function of the asset to be retried.
17
+ */
7
18
  test?: string | ((url: string) => boolean);
19
+ /**
20
+ * Specifies the retry domain when assets fail to load.
21
+ */
8
22
  domain?: string[];
23
+ /**
24
+ * Set the `crossorigin` attribute for tags.
25
+ */
9
26
  crossOrigin?: boolean | CrossOrigin;
27
+ /**
28
+ * Whether to inline the runtime JavaScript code of Assets Retry plugin into the HTML file.
29
+ */
10
30
  inlineScript?: boolean;
31
+ /**
32
+ * The callback function when the asset is failed to be retried.
33
+ */
11
34
  onFail?: (options: AssetsRetryHookContext) => void;
35
+ /**
36
+ * The callback function when the asset is being retried.
37
+ */
12
38
  onRetry?: (options: AssetsRetryHookContext) => void;
39
+ /**
40
+ * The callback function when the asset is successfully retried.
41
+ */
13
42
  onSuccess?: (options: AssetsRetryHookContext) => void;
14
43
  };
15
44
  type AssetsRetryHookContext = {
package/dist/index.js CHANGED
@@ -58,11 +58,11 @@ var AssetsRetryPlugin_exports = {};
58
58
  __export(AssetsRetryPlugin_exports, {
59
59
  AssetsRetryPlugin: () => AssetsRetryPlugin
60
60
  });
61
- var import_path, import_webpack_sources, import_shared, _retryOptions, AssetsRetryPlugin;
61
+ var import_node_path, import_webpack_sources, import_shared, _retryOptions, AssetsRetryPlugin;
62
62
  var init_AssetsRetryPlugin = __esm({
63
63
  "src/AssetsRetryPlugin.ts"() {
64
64
  "use strict";
65
- import_path = __toESM(require("path"));
65
+ import_node_path = __toESM(require("path"));
66
66
  import_webpack_sources = __toESM(require("@rsbuild/shared/webpack-sources"));
67
67
  import_shared = require("@rsbuild/shared");
68
68
  AssetsRetryPlugin = class {
@@ -88,7 +88,7 @@ var init_AssetsRetryPlugin = __esm({
88
88
  }
89
89
  async getRetryCode() {
90
90
  const { default: serialize } = await import("serialize-javascript");
91
- const runtimeFilePath = import_path.default.join(__dirname, "./runtime.js");
91
+ const runtimeFilePath = import_node_path.default.join(__dirname, "./runtime.js");
92
92
  const runtimeCode = await import_shared.fse.readFile(runtimeFilePath, "utf-8");
93
93
  return `(function(){${runtimeCode};init(${serialize(
94
94
  __privateGet(this, _retryOptions)
@@ -96,9 +96,9 @@ var init_AssetsRetryPlugin = __esm({
96
96
  }
97
97
  async getScriptPath() {
98
98
  if (!this.scriptPath) {
99
- this.scriptPath = import_path.default.join(
99
+ this.scriptPath = import_node_path.default.join(
100
100
  this.distDir,
101
- `assets-retry.${"0.3.5"}.js`
101
+ `assets-retry.${"0.3.7"}.js`
102
102
  );
103
103
  }
104
104
  return this.scriptPath;
package/dist/index.mjs CHANGED
@@ -98,7 +98,7 @@ var init_AssetsRetryPlugin = __esm({
98
98
  if (!this.scriptPath) {
99
99
  this.scriptPath = path2.join(
100
100
  this.distDir,
101
- `assets-retry.${"0.3.5"}.js`
101
+ `assets-retry.${"0.3.7"}.js`
102
102
  );
103
103
  }
104
104
  return this.scriptPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-assets-retry",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Assets retry plugin for Rsbuild",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "serialize-javascript": "^6.0.0",
27
- "@rsbuild/shared": "0.3.5"
27
+ "@rsbuild/shared": "0.3.7"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.23.2",
@@ -34,11 +34,11 @@
34
34
  "html-webpack-plugin": "npm:html-rspack-plugin@5.5.7",
35
35
  "terser": "5.27.0",
36
36
  "typescript": "^5.3.0",
37
- "@rsbuild/core": "0.3.5",
38
- "@scripts/test-helper": "0.3.5"
37
+ "@rsbuild/core": "0.3.7",
38
+ "@scripts/test-helper": "0.3.7"
39
39
  },
40
40
  "peerDependencies": {
41
- "@rsbuild/core": "^0.3.5"
41
+ "@rsbuild/core": "^0.3.7"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public",