Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(sdk): update README to new createLogger API #3194

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// The SDK can be used to parse entry strings, encode and decode module names, and generate filenames for exposed modules and shared packages.
// It also includes a logger for debugging and environment detection utilities.
// Additionally, it provides a function to generate a snapshot from a manifest and environment detection utilities.
import { parseEntry, encodeName, decodeName, generateExposeFilename, generateShareFilename, Logger, isBrowserEnv, isDebugMode, getProcessEnv, generateSnapshotFromManifest } from '@module-federation/sdk';
import { parseEntry, encodeName, decodeName, generateExposeFilename, generateShareFilename, createLogger, isBrowserEnv, isDebugMode, getProcessEnv, generateSnapshotFromManifest } from '@module-federation/sdk';

// Parse an entry string into a RemoteEntryInfo object
parseEntry('entryString');
Expand All @@ -28,8 +28,8 @@ generateExposeFilename('exposeName', true);
// Generate a filename for a shared package
generateShareFilename('packageName', true);

// Create a new logger
const logger = new Logger('identifier');
// Create a logger
const logger = createLogger('identifier');

// Check if the current environment is a browser
isBrowserEnv();
Expand All @@ -46,12 +46,12 @@ generateSnapshotFromManifest(manifest, options);

### parseEntry

- Type: `parseEntry(str: string, devVerOrUrl?: string)`
- Type: `parseEntry(str: string, devVerOrUrl?: string, separator?: string) `
- Parses a string into a RemoteEntryInfo object.

### encodeName

- Type: `encodeName(name: string, prefix = '', withExt = false)`
- Type: `encodeName(name: string, prefix?: string, withExt?: boolean)`
- Encodes a name with a prefix and optional extension.

### decodeName
Expand All @@ -69,10 +69,10 @@ generateSnapshotFromManifest(manifest, options);
- Type: `generateShareFilename(pkgName: string, withExt: boolean)`
- Generates a filename for a shared package.

### Logger
### createLogger

- Type: `new Logger(identifier?: string)`
- Creates a new logger for debugging.
- Type: `createLogger(prefix: string)`
- Creates a logger for debugging.

### isBrowserEnv

Expand All @@ -91,7 +91,7 @@ generateSnapshotFromManifest(manifest, options);

### generateSnapshotFromManifest

- Type: `generateSnapshotFromManifest(manifest: Manifest, options: IOptions = {})`
- Type: `generateSnapshotFromManifest(manifest: Manifest, options?: IOptions)`
- Generates a snapshot from a manifest.

## Testing
Expand Down
Loading