{"name":"@module-federation/sdk","version":"0.18.2","keywords":["Module Federation","sdk"],"author":{"name":"zhanghang","email":"hanric.zhang@gmail.com"},"license":"MIT","_id":"@module-federation/sdk@0.18.2","maintainers":[{"name":"zackljackson","email":"zackary.l.jackson@gmail.com"},{"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":"shawzhou","email":"codingzx@gmail.com"},{"name":"gioboa","email":"giorgiob.boa@gmail.com"}],"homepage":"https://github.com/module-federation/core#readme","bugs":{"url":"https://github.com/module-federation/core/issues"},"dist":{"shasum":"55b4b8314229694e3bf63608b40a125d6d981b21","tarball":"http://registry-npm.ywwl.com/@module-federation/sdk/download/@module-federation/sdk-0.18.2.tgz","fileCount":36,"integrity":"sha512-sfvC43L1nA4U5HHQsLXeEenuE/0AMgHOEzHCICNZYvxvtHz3Pau6NK4hcQR5hGGpuIPweQilbQ0oAN8ZryvLdw==","signatures":[{"sig":"MEUCIQC36xdYjrSu37DYiFpzCB5nwkeHZG5bauxZ9Q0dzBcnVAIgMOX9bFIRy7NWuwTeH5uCYLa9WIp+KPviPpHQOZhbh/0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":109380,"size":23804,"noattachment":false,"key":"/@module-federation/sdk/-/@module-federation/sdk-0.18.2.tgz"},"main":"./dist/index.cjs.cjs","type":"module","_from":"file:module-federation-sdk-0.18.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.esm.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.esm.js"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.cjs.cjs"}},"./normalize-webpack-path":{"import":{"types":"./dist/normalize-webpack-path.d.ts","default":"./dist/normalize-webpack-path.esm.js"},"require":{"types":"./dist/normalize-webpack-path.d.ts","default":"./dist/normalize-webpack-path.cjs.cjs"}}},"_npmUser":{"name":"shawzhou","email":"codingzx@gmail.com"},"_resolved":"/tmp/7e38b06156ed27c1bcef4faca60c49bf/module-federation-sdk-0.18.2.tgz","_integrity":"sha512-sfvC43L1nA4U5HHQsLXeEenuE/0AMgHOEzHCICNZYvxvtHz3Pau6NK4hcQR5hGGpuIPweQilbQ0oAN8ZryvLdw==","repository":{"url":"git+https://github.com/module-federation/core.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.8.2","description":"A sdk for support module federation","directories":{},"sideEffects":false,"_nodeVersion":"18.20.8","publishConfig":{"access":"public"},"typesVersions":{"*":{".":["./dist/index.d.ts"],"normalize-webpack-path":["./dist/normalize-webpack-path.d.ts"]}},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sdk_0.18.2_1755249993256_0.15306319245162725","host":"s3://npm-registry-packages-npm-production"},"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, createLogger, isBrowserEnv, isBrowserEnvValue, 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 logger\nconst logger = createLogger('identifier');\n\n// Check if the current environment is a browser\nconst inBrowser = isBrowserEnv();\nconst inBrowserStatic = isBrowserEnvValue;\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, separator?: string) `\n- Parses a string into a RemoteEntryInfo object.\n\n### encodeName\n\n- Type: `encodeName(name: string, prefix?: string, withExt?: boolean)`\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### createLogger\n\n- Type: `createLogger(prefix: string)`\n- Creates a logger for debugging.\n\n### isBrowserEnv\n\n- Type: `isBrowserEnv(): boolean`\n- Checks if the current environment is a browser.\n\n### isBrowserEnvValue\n\n- Type: `isBrowserEnvValue: boolean`\n- Static browser environment flag (tree-shakable when ENV_TARGET is defined).\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":1755249993430,"_cnpm_publish_time":1755249993430,"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"}}