New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@farmfe/runtime

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@farmfe/runtime - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

7

CHANGELOG.md
# @farmfe/runtime
## 0.9.2
### Patch Changes
- 0ab4edf9: Fix failed to load external cjs require when output esm
- 0ab4edf9: throw error when dynamic load fail. close #836
## 0.9.1

@@ -4,0 +11,0 @@

2

package.json
{
"name": "@farmfe/runtime",
"version": "0.9.1",
"version": "0.9.2",
"description": "Runtime of Farm",

@@ -5,0 +5,0 @@ "author": {

@@ -79,3 +79,3 @@ import { Module } from './module';

// TODO require should be async as we support `top level await`, This feature requires Node 16 and higher
require(moduleId: string): any {
require(moduleId: string, isCJS = false): any {
if (INTERNAL_MODULE_MAP[moduleId]) {

@@ -102,6 +102,11 @@ return INTERNAL_MODULE_MAP[moduleId];

if (!initializer) {
// TODO: fix `const assert = require('assert');` when assert is external. This leads to `assert is not a function` error caused by default export different from esm and cjs
// TODO: we may need to add `@swc/helpers/_/_interop_require_default` for external modules, replace `const assert = require('assert');` to `const assert = _interop_require_default(require('assert'));`
if (this.externalModules[moduleId]) {
return this.externalModules[moduleId];
const exports = this.externalModules[moduleId];
// fix `const assert = require('assert');` when assert is external. This leads to `assert is not a function` error caused by default export different from esm and cjs
if (isCJS) {
return exports.default || exports;
}
return exports;
}

@@ -169,2 +174,8 @@ // try node require if target Env is node

.then(() => {
if (!this.modules[moduleId]) {
throw new Error(
`Dynamic imported module "${moduleId}" is not registered.`
);
}
const result = this.require(moduleId);

@@ -171,0 +182,0 @@ // if the module is async, return the default export, the default export should be a promise

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc