-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading data files from an npm package shouldn't require allow-read permssions #18607
Comments
Is anyone currently working on this? I was curious about how deno was loading NPM packages prior, correct me if I am wrong here about anything. The npm package utilizing https://www.npmjs.com/package/gpt-3-encoder?activeTab=code The npm package is utilizing What is the ideal solution here? Is there another readably available option besides Deno.readFileSync to use when utilizing this polyfill? Or can we pass a flag that disables the |
It seems that while iterating over the files within the npm package any files with the extension Module._extensions[".js"] = function (module, filename) {
const content = ops.op_require_read_file(filename);
if (StringPrototypeEndsWith(filename, ".js")) {
const pkg = ops.op_require_read_package_scope(filename);
if (pkg && pkg.exists && pkg.typ == "module") {
let message = `Trying to import ESM module: ${filename}`;
if (module.parent) {
message += ` from ${module.parent.filename}`;
}
message += ` using require()`;
throw new Error(message);
}
}
module._compile(content, filename);
}; There is a method in place for .json which I am assuming is being used for package.json. However the .json within this package never calls this method. Module._extensions[".json"] = function (module, filename) {
const content = ops.op_require_read_file(filename);
try {
module.exports = JSONParse(stripBOM(content));
} catch (err) {
err.message = filename + ": " + err.message;
throw err;
}
}; |
This npm module reads from a data file:
Ideally this could run without any permissions.
The text was updated successfully, but these errors were encountered: