Skip to content

Commit

Permalink
fix: retry-plugin package.json main, module and types paths (#2931)
Browse files Browse the repository at this point in the history
Co-authored-by: Milan Magudia <m.magudia@cmcmarkets.com>
Co-authored-by: Zack Jackson <25274700+ScriptedAlchemy@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 10, 2024
1 parent e327fbf commit 59758b7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-seals-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/retry-plugin': patch
---

Use correct paths for export
6 changes: 3 additions & 3 deletions packages/retry-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "@module-federation/retry-plugin",
"version": "0.6.1",
"author": "danpeen <dapeen.feng@gmail.com>",
"main": "./dist/index.cjs.js",
"module": "./dist/index.esm.js",
"types": "./dist/index.cjs.d.ts",
"main": "./dist/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/retry-plugin/src/fetch-retry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReqiuredUrl, FetchWithRetryOptions } from './types';
import type { RequiredUrl, FetchWithRetryOptions } from './types';
import { defaultRetries, defaultRetryDelay } from './constant';

async function fetchWithRetry({
Expand All @@ -7,7 +7,7 @@ async function fetchWithRetry({
retryTimes = defaultRetries, // retry times
retryDelay = defaultRetryDelay, // retry delay
fallback, // fallback url
}: ReqiuredUrl<FetchWithRetryOptions>) {
}: RequiredUrl<FetchWithRetryOptions>) {
try {
const response = await fetch(url, options);

Expand Down
4 changes: 2 additions & 2 deletions packages/retry-plugin/src/script-retry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptWithRetryOptions, CreateScriptFunc, ReqiuredUrl } from './types';
import { ScriptWithRetryOptions, CreateScriptFunc, RequiredUrl } from './types';
import { defaultRetries, defaultRetryDelay, loadStatus } from './constant';

export const defaultCreateScript = (
Expand Down Expand Up @@ -96,7 +96,7 @@ function scriptWithRetry({
retryTimes = defaultRetries, // retry times
retryDelay = defaultRetryDelay, // retry delay
customCreateScript, // user script create function
}: ReqiuredUrl<ScriptWithRetryOptions>) {
}: RequiredUrl<ScriptWithRetryOptions>) {
const script = getScript(url, attrs, customCreateScript);
const originOnerror = script.onerror;
const originOnLoad = script.onload;
Expand Down
5 changes: 1 addition & 4 deletions packages/retry-plugin/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ export type RetryPluginParams = {
script?: ScriptWithRetryOptions; // script retry options
};

export type ReqiuredUrl<T extends { url?: string }> = Required<Pick<T, 'url'>> &
Omit<T, 'url'>;

export type CreateScriptFunc = (
url: string,
attrs: Record<string, any>,
) => HTMLScriptElement;

export type ReqiuredUrl<T extends { url?: string }> = Required<Pick<T, 'url'>> &
export type RequiredUrl<T extends { url?: string }> = Required<Pick<T, 'url'>> &
Omit<T, 'url'>;

0 comments on commit 59758b7

Please sign in to comment.