awslabs / llrt

LLRT (Low Latency Runtime) is an experimental, lightweight JavaScript runtime designed to address the growing demand for fast and efficient Serverless applications.
Apache License 2.0
7.74k stars 342 forks source link

Fix: Removed several module offerings #439

Closed nabetti1720 closed 3 days ago

nabetti1720 commented 3 days ago

Description of changes

Currently, the following functions are provided as modules in LLRT.

This is a module that is not compatible with node.js (or has a name that does not exist) and should stop being offered as a module before it is misused.

In fact, the following code will result in a MODULE_NOT_FOUND error in node.js.

% node -e "const a = require('navigator');"  
node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module 'navigator'
Require stack:
- /Users/shinya/Workspaces/llrt-test/[eval]
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at [eval]:1:11
    at runScriptInThisContext (node:internal/vm:209:10)
    at node:internal/process/execution:118:14
    at [eval]-wrapper:6:24
    at runScript (node:internal/process/execution:101:62)
    at evalScript (node:internal/process/execution:133:3) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/shinya/Workspaces/llrt-test/[eval]' ]
}

Node.js v20.13.1

In addition, it is necessary to continue to provide these functions from globalThis.

% ./llrt -e "console.log(globalThis.navigator.userAgent);"
llrt 0.1.15-beta

Checklist

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.