{"name":"@module-federation/sdk","version":"2.3.2","keywords":["Module Federation","sdk"],"author":{"name":"zhanghang","email":"hanric.zhang@gmail.com"},"license":"MIT","_id":"@module-federation/sdk@2.3.2","maintainers":[{"name":"zackljackson","email":"zackary.l.jackson@gmail.com"},{"name":"heal","email":"TwoHeal@163.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":"b93b5133503488d8c6ddd8bb205532de12bcb396","tarball":"http://registry-npm.ywwl.com/@module-federation/sdk/download/@module-federation/sdk-2.3.2.tgz","fileCount":96,"integrity":"sha512-EKiZpLnD2ogy7OcnuU+vkGO5vhh3J25PHwtEzgVGIAsMis3JHYPpY7L1Ue7i0zVrdmI23dVJPBtfGV/Pg7THPA==","signatures":[{"sig":"MEUCIQDUMr0jj8KWfGQ2OLH4mNJlvM38xMxKJ9RVViHH6Q5JnwIgBHqNIAL+WNVDM2QmG1vaK5MsQOsHgQ1eVQAQNMUYDpw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@module-federation%2fsdk@2.3.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":304478,"size":58514,"noattachment":false,"key":"/@module-federation/sdk/-/@module-federation/sdk-2.3.2.tgz"},"main":"./dist/index.cjs","type":"module","_from":"file:module-federation-sdk-2.3.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","browser":{"url":false},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.cjs"}},"./normalize-webpack-path":{"import":{"types":"./dist/normalize-webpack-path.d.ts","default":"./dist/normalize-webpack-path.js"},"require":{"types":"./dist/normalize-webpack-path.d.ts","default":"./dist/normalize-webpack-path.cjs"}}},"scripts":{"lint":"ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"","test":"pnpm exec jest --config jest.config.cjs --passWithNoTests","build":"tsdown --config tsdown.config.ts","test:ci":"pnpm exec jest --config jest.config.cjs --passWithNoTests --ci --coverage","pre-release":"pnpm run test && pnpm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e6f5134a-6174-49b8-9736-ec90dc569fd0"}},"_resolved":"/tmp/5663524b8442249ef61d444a2693209e/module-federation-sdk-2.3.2.tgz","_integrity":"sha512-EKiZpLnD2ogy7OcnuU+vkGO5vhh3J25PHwtEzgVGIAsMis3JHYPpY7L1Ue7i0zVrdmI23dVJPBtfGV/Pg7THPA==","repository":{"url":"git+https://github.com/module-federation/core.git","type":"git","directory":"packages/sdk"},"_npmVersion":"11.12.1","description":"A sdk for support module federation","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"typesVersions":{"*":{".":["./dist/index.d.ts"],"normalize-webpack-path":["./dist/normalize-webpack-path.d.ts"]}},"_hasShrinkwrap":false,"devDependencies":{"webpack":"^5.0.0","@jest/globals":"29.7.0"},"peerDependencies":{"node-fetch":"^3.3.2"},"peerDependenciesMeta":{"node-fetch":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_2.3.2_1776061900076_0.8459847418326765","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":1776061900242,"_cnpm_publish_time":1776061900242,"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"}}