0.15.0 • Published 5 months ago

@module-federation/sdk v0.15.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@module-federation/sdk Documentation

  • This SDK provides utilities and tools to support the implementation of Module Federation in your projects.
  • It contains utility functions for parsing, encoding, and decoding module names, as well as generating 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.

Usage

// 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';

// Parse an entry string into a RemoteEntryInfo object
parseEntry('entryString');

// Encode a module name with a prefix and optional extension
encodeName('moduleName', 'prefix');

// Decode a module name with a prefix and optional extension
decodeName('encodedModuleName', 'prefix');

// Generate a filename for an exposed module
generateExposeFilename('exposeName', true);

// Generate a filename for a shared package
generateShareFilename('packageName', true);

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

// Check if the current environment is a browser
isBrowserEnv();

// Check if the current environment is in debug mode
isDebugMode();

// Get the process environment
getProcessEnv();

// Generate a snapshot from a manifest
generateSnapshotFromManifest(manifest, options);

parseEntry

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

encodeName

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

decodeName

  • Type: decodeName(name: string, prefix?: string, withExt?: boolean)
  • Decodes a name with a prefix and optional extension.

generateExposeFilename

  • Type: generateExposeFilename(exposeName: string, withExt: boolean)
  • Generates a filename for an expose.

generateShareFilename

  • Type: generateShareFilename(pkgName: string, withExt: boolean)
  • Generates a filename for a shared package.

Logger

  • Type: new Logger(identifier?: string)
  • Creates a new logger for debugging.

isBrowserEnv

  • Type: isBrowserEnv()
  • Checks if the current environment is a browser.

isDebugMode

  • Type: isDebugMode()
  • Checks if the current environment is in debug mode.

getProcessEnv

  • Type: getProcessEnv()
  • Gets the process environment.

generateSnapshotFromManifest

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

Testing

The SDK uses Jest for testing. The configuration can be found in jest.config.js. The tests are located in the tests directory.

0.7.2

12 months ago

0.7.1

1 year ago

0.7.3

12 months ago

0.7.0

1 year ago

0.7.6

12 months ago

0.7.5

12 months ago

0.7.7

12 months ago

0.13.0

7 months ago

0.13.1

6 months ago

0.11.0

8 months ago

0.11.1

8 months ago

0.11.2

8 months ago

0.11.3

7 months ago

0.11.4

7 months ago

0.9.0

9 months ago

0.9.1

9 months ago

0.15.0

5 months ago

0.8.9

10 months ago

0.8.8

10 months ago

0.8.5

11 months ago

0.8.4

11 months ago

0.8.7

10 months ago

0.8.6

11 months ago

0.10.0

8 months ago

0.8.1

11 months ago

0.8.0

11 months ago

0.8.3

11 months ago

0.8.2

11 months ago

0.14.0

6 months ago

0.14.1

6 months ago

0.14.2

6 months ago

0.14.3

6 months ago

0.12.0

7 months ago

0.8.12

9 months ago

0.8.11

9 months ago

0.8.10

9 months ago

0.6.16

1 year ago

0.6.15

1 year ago

0.6.14

1 year ago

0.6.13

1 year ago

0.6.12

1 year ago

0.6.11

1 year ago

0.6.7

1 year ago

0.6.9

1 year ago

0.6.8

1 year ago

0.6.10

1 year ago

0.6.6

1 year ago

0.6.5

1 year ago

0.6.4

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.5.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.6.0

1 year ago

0.3.5

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.1.20

1 year ago

0.1.21

1 year ago

0.1.16

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.19

1 year ago

0.4.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.8

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.13

1 year ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.0

2 years ago

0.1.1

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.3

2 years ago

0.0.4

2 years ago

0.3.0

2 years ago

1.1.0-canary.1

2 years ago

1.0.0-canary.3

2 years ago