Lines 171-211javascript
174 return PackageLoader.PeersSDK || _require("../index");
176 return PackageLoader.Zod || _require("zod");
178 // TODO: Add a permissions system for packages — packages should declare which
179 // external Node modules they need (e.g. child_process, os, path), and the loader
180 // should verify they are allowed before granting access. For now we pass through
181 // to the underlying require and log a warning so usages remain visible.
182 if (!isNodeEnvironment && NODE_ONLY_MODULES.has(moduleId)) {
183 // Throw a plain JS Error so the surrounding try/catch can handle it
184 // gracefully instead of letting RN's require trigger a native fatal.
185 throw new Error(`[PackageLoader] Package "${pkg.name}" required Node.js-only module "${moduleId}" which is not available in this environment`);
187 console.warn(`Package ${pkg.name} is requiring a module ${moduleId}, which is not provided by the package loader.`);
188 return _require(moduleId);
192 const bundleFunction = new Function("module", "exports", "require", bundleCode);
193 bundleFunction(module, moduleExports, customRequire);
LowEval
Package source references a known benign dynamic code generation pattern.
dist/package-loader/package-loader.jsView on unpkg · L191 194 const bundleExports = module.exports;
195 // Check for contract-based package definition (new path)
196 const packageDefinition = (0, contract_package_loader_1.extractPackageDefinition)(bundleExports);
197 if (packageDefinition) {
198 if (packageDefinition.packageId !== pkg.packageId) {
199 console.warn(`[PackageLoader] packageId mismatch: definition has "${packageDefinition.packageId}" but DB record has "${pkg.packageId}"`);
201 await (0, contract_package_loader_1.installContractPackage)(this.dataContext, packageDefinition);
202 this.contractInstalledPackages.add(packageDefinition.packageId);
203 this.correctPackageVersion(pkg, packageDefinition);
204 // Build a proper IPeersPackage from the contract definition so callers
205 // (e.g. package-installer) can read appNavs, assistants, etc.
206 const contractPackageInstance = {
207 packageId: packageDefinition.packageId,
208 appNavs: packageDefinition.appNavs,
209 assistants: packageDefinition.assistants,
210 toolInstances: packageDefinition.toolInstances,
211 tableDefinitions: packageDefinition.tableDefinitions,