Skip to content

Commit

Permalink
no fs
Browse files Browse the repository at this point in the history
  • Loading branch information
juliocesar committed Dec 1, 2022
1 parent d026849 commit 1208726
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
3 changes: 2 additions & 1 deletion cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 1 addition & 14 deletions lib/fetch/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"use strict";
module.exports = fetch;

var asPromise = require("@protobufjs/aspromise"),
inquire = require("@protobufjs/inquire");

var fs = inquire("fs");
var asPromise = require("@protobufjs/aspromise");

/**
* Node-style callback as used by {@link util.fetch}.
Expand Down Expand Up @@ -40,16 +37,6 @@ function fetch(filename, options, callback) {
if (!callback)
return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this

// if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
if (!options.xhr && fs && fs.readFile)
return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
return err && typeof XMLHttpRequest !== "undefined"
? fetch.xhr(filename, options, callback)
: err
? callback(err)
: callback(null, options.binary ? contents : contents.toString("utf8"));
});

// use the XHR version otherwise.
return fetch.xhr(filename, options, callback);
}
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"name": "protobufjs",
"version": "7.1.2",
"name": "@supernormalco/protobufjs",
"version": "7.1.3",
"versionScheme": "~",
"description": "Protocol Buffers for JavaScript (& TypeScript).",
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
"license": "BSD-3-Clause",
"repository": "protobufjs/protobuf.js",
"repository": {
"type": "git",
"url": "git+https://github.com/supernormalco/protobuf.js.git"
},
"bugs": "https://github.com/protobufjs/protobuf.js/issues",
"homepage": "https://protobufjs.github.io/protobuf.js/",
"engines": {
Expand Down

0 comments on commit 1208726

Please sign in to comment.