Skip to content

Commit

Permalink
docs(sdk): update README to new createLogger API (#3194)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gehbt authored Nov 8, 2024
1 parent 0898ffe commit 9c81bb6
Showing 1 changed file with 9 additions and 9 deletions.
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

0 comments on commit 9c81bb6

Please sign in to comment.