Auto-commit 2026-04-29 16:31
This commit is contained in:
26
node_modules/@protobufjs/inquire/LICENSE
generated
vendored
Normal file
26
node_modules/@protobufjs/inquire/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
Copyright (c) 2016, Daniel Wirtz All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of its author, nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
13
node_modules/@protobufjs/inquire/README.md
generated
vendored
Normal file
13
node_modules/@protobufjs/inquire/README.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
@protobufjs/inquire
|
||||
===================
|
||||
[](https://www.npmjs.com/package/@protobufjs/inquire)
|
||||
|
||||
Requires a module only if available and hides the require call from bundlers.
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
* **inquire(moduleName: `string`): `?Object`**<br />
|
||||
Requires a module only if available.
|
||||
|
||||
**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
||||
9
node_modules/@protobufjs/inquire/index.d.ts
generated
vendored
Normal file
9
node_modules/@protobufjs/inquire/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export = inquire;
|
||||
|
||||
/**
|
||||
* Requires a module only if available.
|
||||
* @memberof util
|
||||
* @param {string} moduleName Module to require
|
||||
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
||||
*/
|
||||
declare function inquire(moduleName: string): object;
|
||||
37
node_modules/@protobufjs/inquire/index.js
generated
vendored
Normal file
37
node_modules/@protobufjs/inquire/index.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
module.exports = inquire;
|
||||
|
||||
/**
|
||||
* Requires a module only if available.
|
||||
* @memberof util
|
||||
* @param {string} moduleName Module to require
|
||||
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
||||
*/
|
||||
function inquire(moduleName) {
|
||||
try {
|
||||
if (typeof require !== "function") {
|
||||
return null;
|
||||
}
|
||||
var mod = require(moduleName);
|
||||
if (mod && (mod.length || Object.keys(mod).length)) return mod;
|
||||
return null;
|
||||
} catch (err) {
|
||||
// ignore
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// maybe worth a shot to prevent renaming issues:
|
||||
// see: https://github.com/webpack/webpack/blob/master/lib/dependencies/CommonJsRequireDependencyParserPlugin.js
|
||||
// triggers on:
|
||||
// - expression require.cache
|
||||
// - expression require (???)
|
||||
// - call require
|
||||
// - call require:commonjs:item
|
||||
// - call require:commonjs:context
|
||||
|
||||
Object.defineProperty(Function.prototype, "__self", { get: function() { return this; } });
|
||||
var r = require.__self;
|
||||
delete Function.prototype.__self;
|
||||
*/
|
||||
21
node_modules/@protobufjs/inquire/package.json
generated
vendored
Normal file
21
node_modules/@protobufjs/inquire/package.json
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "@protobufjs/inquire",
|
||||
"description": "Requires a module only if available and hides the require call from bundlers.",
|
||||
"version": "1.1.1",
|
||||
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dcodeIO/protobuf.js.git"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"devDependencies": {
|
||||
"istanbul": "^0.4.5",
|
||||
"tape": "^5.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape tests/*.js",
|
||||
"coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
|
||||
}
|
||||
}
|
||||
1
node_modules/@protobufjs/inquire/tests/data/array.js
generated
vendored
Normal file
1
node_modules/@protobufjs/inquire/tests/data/array.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = [1];
|
||||
1
node_modules/@protobufjs/inquire/tests/data/emptyArray.js
generated
vendored
Normal file
1
node_modules/@protobufjs/inquire/tests/data/emptyArray.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = [];
|
||||
1
node_modules/@protobufjs/inquire/tests/data/emptyObject.js
generated
vendored
Normal file
1
node_modules/@protobufjs/inquire/tests/data/emptyObject.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = {};
|
||||
1
node_modules/@protobufjs/inquire/tests/data/object.js
generated
vendored
Normal file
1
node_modules/@protobufjs/inquire/tests/data/object.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = { a: 1 };
|
||||
20
node_modules/@protobufjs/inquire/tests/index.js
generated
vendored
Normal file
20
node_modules/@protobufjs/inquire/tests/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var tape = require("tape");
|
||||
|
||||
var inquire = require("..");
|
||||
|
||||
tape.test("inquire", function(test) {
|
||||
|
||||
test.equal(inquire("buffer").Buffer, Buffer, "should be able to require \"buffer\"");
|
||||
|
||||
test.equal(inquire("%invalid"), null, "should not be able to require \"%invalid\"");
|
||||
|
||||
test.equal(inquire("./tests/data/emptyObject"), null, "should return null when requiring a module exporting an empty object");
|
||||
|
||||
test.equal(inquire("./tests/data/emptyArray"), null, "should return null when requiring a module exporting an empty array");
|
||||
|
||||
test.same(inquire("./tests/data/object"), { a: 1 }, "should return the object if a non-empty object");
|
||||
|
||||
test.same(inquire("./tests/data/array"), [ 1 ], "should return the module if a non-empty array");
|
||||
|
||||
test.end();
|
||||
});
|
||||
Reference in New Issue
Block a user