{"name":"@module-federation/sdk","version":"0.6.7","keywords":["Module Federation","sdk"],"author":{"name":"zhanghang","email":"hanric.zhang@gmail.com"},"license":"MIT","_id":"@module-federation/sdk@0.6.7","dist":{"shasum":"cd6b22e6544a05f1a3a550ca03fe1376e39f7cba","tarball":"http://registry-npm.ywwl.com/@module-federation/sdk/download/@module-federation/sdk-0.6.7.tgz","fileCount":34,"integrity":"sha512-UxqtPADLv2fwSh7BqZv/JCWh+n29LaaRAgMGXw5rREvByv2CoaCEbWf/8tCW+cA4WGwavz1myMoaPIl1FMh9rw==","signatures":[{"sig":"MEUCIEjVtVUyQq+f9wMqQI83v/GbbMg8a6DX+CsF2k24IU5LAiEAiUgeln0MraQhRVgIw064Dwgcy4BfNN6kB1PLqo5J/oI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":101841,"size":16930,"noattachment":false,"key":"/@module-federation/sdk/-/@module-federation/sdk-0.6.7.tgz"},"main":"./dist/index.cjs.js","_from":"file:module-federation-sdk-0.6.7.tgz","types":"./dist/index.cjs.d.ts","module":"./dist/index.esm.js","exports":{".":{"types":"./dist/index.cjs.d.ts","import":"./dist/index.esm.js","require":"./dist/index.cjs.js"},"./normalize-webpack-path":{"types":"./dist/normalize-webpack-path.cjs.d.ts","import":"./dist/normalize-webpack-path.esm.js","require":"./dist/normalize-webpack-path.cjs.js"}},"_npmUser":{"name":"zackljackson","email":"zackary.l.jackson@gmail.com"},"_resolved":"/tmp/353a1f4debe7819fbdbfdeb65fa56c07/module-federation-sdk-0.6.7.tgz","_integrity":"sha512-UxqtPADLv2fwSh7BqZv/JCWh+n29LaaRAgMGXw5rREvByv2CoaCEbWf/8tCW+cA4WGwavz1myMoaPIl1FMh9rw==","_npmVersion":"10.7.0","description":"A sdk for support module federation","directories":{},"sideEffects":false,"_nodeVersion":"18.20.4","publishConfig":{"access":"public"},"typesVersions":{"*":{".":["./dist/index.cjs.d.ts"],"normalize-webpack-path":["./dist/normalize-webpack-path.cjs.d.ts"]}},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sdk_0.6.7_1727571942193_0.7885009197800072","host":"s3://npm-registry-packages"},"readme":"# `@module-federation/sdk` Documentation\n\n- This SDK provides utilities and tools to support the implementation of Module Federation in your projects.\n- It contains utility functions for parsing, encoding, and decoding module names, as well as generating filenames for exposed modules and shared packages.\n- It also includes a logger for debugging and environment detection utilities.\n- Additionally, it provides a function to generate a snapshot from a manifest and environment detection utilities.\n\n## Usage\n\n```javascript\n// The SDK can be used to parse entry strings, encode and decode module names, and generate filenames for exposed modules and shared packages.\n// It also includes a logger for debugging and environment detection utilities.\n// Additionally, it provides a function to generate a snapshot from a manifest and environment detection utilities.\nimport { parseEntry, encodeName, decodeName, generateExposeFilename, generateShareFilename, Logger, isBrowserEnv, isDebugMode, getProcessEnv, generateSnapshotFromManifest } from '@module-federation/sdk';\n\n// Parse an entry string into a RemoteEntryInfo object\nparseEntry('entryString');\n\n// Encode a module name with a prefix and optional extension\nencodeName('moduleName', 'prefix');\n\n// Decode a module name with a prefix and optional extension\ndecodeName('encodedModuleName', 'prefix');\n\n// Generate a filename for an exposed module\ngenerateExposeFilename('exposeName', true);\n\n// Generate a filename for a shared package\ngenerateShareFilename('packageName', true);\n\n// Create a new logger\nconst logger = new Logger('identifier');\n\n// Check if the current environment is a browser\nisBrowserEnv();\n\n// Check if the current environment is in debug mode\nisDebugMode();\n\n// Get the process environment\ngetProcessEnv();\n\n// Generate a snapshot from a manifest\ngenerateSnapshotFromManifest(manifest, options);\n```\n\n### parseEntry\n\n- Type: `parseEntry(str: string, devVerOrUrl?: string)`\n- Parses a string into a RemoteEntryInfo object.\n\n### encodeName\n\n- Type: `encodeName(name: string, prefix = '', withExt = false)`\n- Encodes a name with a prefix and optional extension.\n\n### decodeName\n\n- Type: `decodeName(name: string, prefix?: string, withExt?: boolean)`\n- Decodes a name with a prefix and optional extension.\n\n### generateExposeFilename\n\n- Type: `generateExposeFilename(exposeName: string, withExt: boolean)`\n- Generates a filename for an expose.\n\n### generateShareFilename\n\n- Type: `generateShareFilename(pkgName: string, withExt: boolean)`\n- Generates a filename for a shared package.\n\n### Logger\n\n- Type: `new Logger(identifier?: string)`\n- Creates a new logger for debugging.\n\n### isBrowserEnv\n\n- Type: `isBrowserEnv()`\n- Checks if the current environment is a browser.\n\n### isDebugMode\n\n- Type: `isDebugMode()`\n- Checks if the current environment is in debug mode.\n\n### getProcessEnv\n\n- Type: `getProcessEnv()`\n- Gets the process environment.\n\n### generateSnapshotFromManifest\n\n- Type: `generateSnapshotFromManifest(manifest: Manifest, options: IOptions = {})`\n- Generates a snapshot from a manifest.\n\n## Testing\n\nThe SDK uses Jest for testing. The configuration can be found in `jest.config.js`. The tests are located in the **tests** directory.\n","publish_time":1727571942450,"maintainers":[{"name":"heal","email":"TwoHeal@163.com"},{"name":"valorkin","email":"valorkin@gmail.com"},{"name":"zackarychapple","email":"zackarychapple30@gmail.com"},{"name":"ilteoood","email":"matteopietro.dazzi@gmail.com"},{"name":"gioboa","email":"giorgiob.boa@gmail.com"},{"name":"ranshamay","email":"ranshamay@gmail.com"},{"name":"zackljackson","email":"zackary.l.jackson@gmail.com"},{"name":"tysonrm","email":"tyson.midboe@gmail.com"}],"_cnpm_publish_time":1727571942450,"dist-tags":{"canary":"1.1.0-canary.1","experimental":"0.0.0-feat-node-support-1703050615268","latest":"2.9.3","next":"0.0.0-feat-enhanced-runtime-unification-20261110060527"}}