@rsbuild/plugin-assets-retry 0.7.8 → 0.7.9

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.cjs CHANGED
@@ -106,7 +106,7 @@ var init_AssetsRetryPlugin = __esm({
106
106
  if (!this.scriptPath) {
107
107
  this.scriptPath = import_node_path.default.posix.join(
108
108
  this.distDir,
109
- `assets-retry.${"0.7.8"}.js`
109
+ `assets-retry.${"0.7.9"}.js`
110
110
  );
111
111
  }
112
112
  return this.scriptPath;
@@ -137,7 +137,14 @@ var init_AssetsRetryPlugin = __esm({
137
137
  this.HtmlPlugin.getHooks(compilation).alterAssetTagGroups.tapPromise(
138
138
  this.name,
139
139
  async (data) => {
140
- const scriptTag = (0, import_shared.generateScriptTag)();
140
+ const scriptTag = {
141
+ tagName: "script",
142
+ attributes: {
143
+ type: "text/javascript"
144
+ },
145
+ voidTag: false,
146
+ meta: {}
147
+ };
141
148
  if (this.inlineScript) {
142
149
  data.headTags.unshift({
143
150
  ...scriptTag,
@@ -192,6 +199,17 @@ ${appendSource}`, "utf-8");
192
199
  throw err;
193
200
  }
194
201
  }
202
+ function pick(obj, keys) {
203
+ return keys.reduce(
204
+ (ret, key) => {
205
+ if (obj[key] !== void 0) {
206
+ ret[key] = obj[key];
207
+ }
208
+ return ret;
209
+ },
210
+ {}
211
+ );
212
+ }
195
213
  var import_node_path2, import_core2, import_shared2, import_serialize_javascript, AsyncChunkRetryPlugin;
196
214
  var init_AsyncChunkRetryPlugin = __esm({
197
215
  "src/AsyncChunkRetryPlugin.ts"() {
@@ -206,7 +224,7 @@ var init_AsyncChunkRetryPlugin = __esm({
206
224
  __publicField(this, "options");
207
225
  __publicField(this, "runtimeOptions");
208
226
  this.options = options;
209
- this.runtimeOptions = (0, import_shared2.pick)(options, [
227
+ this.runtimeOptions = pick(options, [
210
228
  "domain",
211
229
  "max",
212
230
  "onRetry",
@@ -275,7 +293,7 @@ var pluginAssetsRetry = (options = {}) => ({
275
293
  }
276
294
  const { AssetsRetryPlugin: AssetsRetryPlugin2 } = await Promise.resolve().then(() => (init_AssetsRetryPlugin(), AssetsRetryPlugin_exports));
277
295
  const { AsyncChunkRetryPlugin: AsyncChunkRetryPlugin2 } = await Promise.resolve().then(() => (init_AsyncChunkRetryPlugin(), AsyncChunkRetryPlugin_exports));
278
- const distDir = (0, import_shared3.getDistPath)(config, "js");
296
+ const distDir = config.output.distPath.js;
279
297
  if (options.crossOrigin === void 0) {
280
298
  options.crossOrigin = config.html.crossorigin;
281
299
  }
package/dist/index.js CHANGED
@@ -54,11 +54,7 @@ __export(AssetsRetryPlugin_exports, {
54
54
  });
55
55
  import path2 from "path";
56
56
  import { ensureAssetPrefix } from "@rsbuild/core";
57
- import {
58
- fse,
59
- generateScriptTag,
60
- getPublicPathFromCompiler
61
- } from "@rsbuild/shared";
57
+ import { fse, getPublicPathFromCompiler } from "@rsbuild/shared";
62
58
  var _retryOptions, AssetsRetryPlugin;
63
59
  var init_AssetsRetryPlugin = __esm({
64
60
  "src/AssetsRetryPlugin.ts"() {
@@ -105,7 +101,7 @@ var init_AssetsRetryPlugin = __esm({
105
101
  if (!this.scriptPath) {
106
102
  this.scriptPath = path2.posix.join(
107
103
  this.distDir,
108
- `assets-retry.${"0.7.8"}.js`
104
+ `assets-retry.${"0.7.9"}.js`
109
105
  );
110
106
  }
111
107
  return this.scriptPath;
@@ -136,7 +132,14 @@ var init_AssetsRetryPlugin = __esm({
136
132
  this.HtmlPlugin.getHooks(compilation).alterAssetTagGroups.tapPromise(
137
133
  this.name,
138
134
  async (data) => {
139
- const scriptTag = generateScriptTag();
135
+ const scriptTag = {
136
+ tagName: "script",
137
+ attributes: {
138
+ type: "text/javascript"
139
+ },
140
+ voidTag: false,
141
+ meta: {}
142
+ };
140
143
  if (this.inlineScript) {
141
144
  data.headTags.unshift({
142
145
  ...scriptTag,
@@ -173,7 +176,7 @@ __export(AsyncChunkRetryPlugin_exports, {
173
176
  });
174
177
  import path3 from "path";
175
178
  import { rspack } from "@rsbuild/core";
176
- import { fse as fse2, pick } from "@rsbuild/shared";
179
+ import { fse as fse2 } from "@rsbuild/shared";
177
180
  import serialize from "serialize-javascript";
178
181
  function appendWebpackScript(module, appendSource) {
179
182
  try {
@@ -195,6 +198,17 @@ ${appendSource}`, "utf-8");
195
198
  throw err;
196
199
  }
197
200
  }
201
+ function pick(obj, keys) {
202
+ return keys.reduce(
203
+ (ret, key) => {
204
+ if (obj[key] !== void 0) {
205
+ ret[key] = obj[key];
206
+ }
207
+ return ret;
208
+ },
209
+ {}
210
+ );
211
+ }
198
212
  var AsyncChunkRetryPlugin;
199
213
  var init_AsyncChunkRetryPlugin = __esm({
200
214
  "src/AsyncChunkRetryPlugin.ts"() {
@@ -257,7 +271,7 @@ var init_AsyncChunkRetryPlugin = __esm({
257
271
 
258
272
  // src/index.ts
259
273
  init_esm();
260
- import { getDistPath, isHtmlDisabled } from "@rsbuild/shared";
274
+ import { isHtmlDisabled } from "@rsbuild/shared";
261
275
  var PLUGIN_ASSETS_RETRY_NAME = "rsbuild:assets-retry";
262
276
  var pluginAssetsRetry = (options = {}) => ({
263
277
  name: PLUGIN_ASSETS_RETRY_NAME,
@@ -270,7 +284,7 @@ var pluginAssetsRetry = (options = {}) => ({
270
284
  }
271
285
  const { AssetsRetryPlugin: AssetsRetryPlugin2 } = await Promise.resolve().then(() => (init_AssetsRetryPlugin(), AssetsRetryPlugin_exports));
272
286
  const { AsyncChunkRetryPlugin: AsyncChunkRetryPlugin2 } = await Promise.resolve().then(() => (init_AsyncChunkRetryPlugin(), AsyncChunkRetryPlugin_exports));
273
- const distDir = getDistPath(config, "js");
287
+ const distDir = config.output.distPath.js;
274
288
  if (options.crossOrigin === void 0) {
275
289
  options.crossOrigin = config.html.crossorigin;
276
290
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-assets-retry",
3
- "version": "0.7.8",
3
+ "version": "0.7.9",
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.2",
27
- "@rsbuild/shared": "0.7.8"
27
+ "@rsbuild/shared": "0.7.9"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.24.7",
@@ -34,10 +34,10 @@
34
34
  "html-webpack-plugin": "npm:html-rspack-plugin@5.7.2",
35
35
  "terser": "5.31.1",
36
36
  "typescript": "^5.4.2",
37
- "@rsbuild/core": "0.7.8"
37
+ "@rsbuild/core": "0.7.9"
38
38
  },
39
39
  "peerDependencies": {
40
- "@rsbuild/core": "^0.7.8"
40
+ "@rsbuild/core": "^0.7.9"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public",