@openclaw/feishu 2026.6.8 → 2026.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +79 -24
- package/dist/{channel-DwygSth-.js → channel-DF8jqwhL.js} +4 -4
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-CrqKcXaU.js → channel.runtime-C4eAoxAR.js} +5 -5
- package/dist/{client-BhMNZBJD.js → client-BwgAJuvo.js} +14 -9
- package/dist/{drive-8o3Omlnd.js → drive-djUl8IRC.js} +16 -3
- package/dist/{monitor-_1eNsUVp.js → monitor-UZJ1bdoG.js} +2 -2
- package/dist/{monitor.account-BhoLA1Y0.js → monitor.account-Bc_8o_b6.js} +95 -51
- package/dist/{monitor.state-QV66eUNA.js → monitor.state-CGL1occz.js} +1 -1
- package/dist/{probe-BjKRV7em.js → probe-EyeJQb3C.js} +1 -1
- package/dist/{send-B3kteMF8.js → send-CMyK8JGr.js} +33 -25
- package/dist/setup-api.js +1 -1
- package/node_modules/@protobufjs/aspromise/LICENSE +26 -0
- package/node_modules/@protobufjs/aspromise/README.md +13 -0
- package/node_modules/{protobufjs/src/util/aspromise.d.ts → @protobufjs/aspromise/index.d.ts} +13 -13
- package/node_modules/{protobufjs/src/util/aspromise.js → @protobufjs/aspromise/index.js} +52 -52
- package/node_modules/@protobufjs/aspromise/package.json +21 -0
- package/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
- package/node_modules/@protobufjs/base64/LICENSE +26 -0
- package/node_modules/@protobufjs/base64/README.md +19 -0
- package/node_modules/{protobufjs/src/util/base64.d.ts → @protobufjs/base64/index.d.ts} +32 -32
- package/node_modules/{protobufjs/src/util/base64.js → @protobufjs/base64/index.js} +139 -146
- package/node_modules/@protobufjs/base64/package.json +21 -0
- package/node_modules/@protobufjs/base64/tests/index.js +46 -0
- package/node_modules/@protobufjs/codegen/LICENSE +26 -0
- package/node_modules/@protobufjs/codegen/README.md +49 -0
- package/node_modules/{protobufjs/src/util/codegen.d.ts → @protobufjs/codegen/index.d.ts} +31 -31
- package/node_modules/{protobufjs/src/util/codegen.js → @protobufjs/codegen/index.js} +112 -113
- package/node_modules/@protobufjs/codegen/package.json +13 -0
- package/node_modules/@protobufjs/codegen/tests/index.js +13 -0
- package/node_modules/@protobufjs/eventemitter/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
- package/node_modules/@protobufjs/eventemitter/README.md +22 -0
- package/node_modules/{protobufjs/src/util/eventemitter.d.ts → @protobufjs/eventemitter/index.d.ts} +45 -45
- package/node_modules/{protobufjs/src/util/eventemitter.js → @protobufjs/eventemitter/index.js} +86 -86
- package/node_modules/@protobufjs/eventemitter/package.json +21 -0
- package/node_modules/@protobufjs/eventemitter/tests/index.js +83 -0
- package/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/fetch/LICENSE +26 -0
- package/node_modules/@protobufjs/fetch/README.md +13 -0
- package/node_modules/{protobufjs/src/util/fetch.d.ts → @protobufjs/fetch/index.d.ts} +56 -56
- package/node_modules/{protobufjs/src/util/fetch.js → @protobufjs/fetch/index.js} +112 -112
- package/node_modules/@protobufjs/fetch/package.json +27 -0
- package/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
- package/node_modules/@protobufjs/fetch/tests/index.js +158 -0
- package/node_modules/@protobufjs/fetch/util/fs.js +11 -0
- package/node_modules/@protobufjs/float/LICENSE +26 -0
- package/node_modules/@protobufjs/float/README.md +102 -0
- package/node_modules/@protobufjs/float/bench/index.js +87 -0
- package/node_modules/@protobufjs/float/bench/suite.js +46 -0
- package/node_modules/{protobufjs/src/util/float.js → @protobufjs/float/index.js} +335 -335
- package/node_modules/@protobufjs/float/package.json +26 -0
- package/node_modules/@protobufjs/float/tests/index.js +100 -0
- package/node_modules/@protobufjs/inquire/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/inquire/LICENSE +26 -0
- package/node_modules/@protobufjs/inquire/README.md +13 -0
- package/node_modules/{protobufjs/src/util/inquire.d.ts → @protobufjs/inquire/index.d.ts} +10 -10
- package/node_modules/{protobufjs/src/util/inquire.js → @protobufjs/inquire/index.js} +38 -38
- package/node_modules/@protobufjs/inquire/package.json +21 -0
- package/node_modules/@protobufjs/inquire/tests/data/array.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/data/object.js +1 -0
- package/node_modules/@protobufjs/inquire/tests/index.js +20 -0
- package/node_modules/@protobufjs/path/LICENSE +26 -0
- package/node_modules/@protobufjs/path/README.md +19 -0
- package/node_modules/{protobufjs/src/util/path.d.ts → @protobufjs/path/index.d.ts} +22 -22
- package/node_modules/{protobufjs/src/util/path.js → @protobufjs/path/index.js} +65 -72
- package/node_modules/@protobufjs/path/package.json +21 -0
- package/node_modules/@protobufjs/path/tests/index.js +60 -0
- package/node_modules/@protobufjs/pool/.npmignore +3 -0
- package/node_modules/@protobufjs/pool/LICENSE +26 -0
- package/node_modules/@protobufjs/pool/README.md +13 -0
- package/node_modules/{protobufjs/src/util/pool.d.ts → @protobufjs/pool/index.d.ts} +32 -32
- package/node_modules/{protobufjs/src/util/pool.js → @protobufjs/pool/index.js} +48 -48
- package/node_modules/@protobufjs/pool/package.json +21 -0
- package/node_modules/@protobufjs/pool/tests/index.js +33 -0
- package/node_modules/@protobufjs/utf8/LICENSE +26 -0
- package/node_modules/@protobufjs/utf8/README.md +20 -0
- package/node_modules/{protobufjs/src/util/utf8.d.ts → @protobufjs/utf8/index.d.ts} +24 -24
- package/node_modules/{protobufjs/src/util/utf8.js → @protobufjs/utf8/index.js} +104 -130
- package/node_modules/@protobufjs/utf8/package.json +21 -0
- package/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +207 -0
- package/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
- package/node_modules/@protobufjs/utf8/tests/index.js +74 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +15 -0
- package/node_modules/@types/node/assert/strict.d.ts +59 -0
- package/node_modules/@types/node/assert.d.ts +950 -0
- package/node_modules/@types/node/async_hooks.d.ts +711 -0
- package/node_modules/@types/node/buffer.buffer.d.ts +466 -0
- package/node_modules/@types/node/buffer.d.ts +1765 -0
- package/node_modules/@types/node/child_process.d.ts +1366 -0
- package/node_modules/@types/node/cluster.d.ts +432 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/node/console.d.ts +93 -0
- package/node_modules/@types/node/constants.d.ts +14 -0
- package/node_modules/@types/node/crypto.d.ts +4058 -0
- package/node_modules/@types/node/dgram.d.ts +537 -0
- package/node_modules/@types/node/diagnostics_channel.d.ts +552 -0
- package/node_modules/@types/node/dns/promises.d.ts +497 -0
- package/node_modules/@types/node/dns.d.ts +876 -0
- package/node_modules/@types/node/domain.d.ts +150 -0
- package/node_modules/@types/node/events.d.ts +1008 -0
- package/node_modules/@types/node/fs/promises.d.ts +1468 -0
- package/node_modules/@types/node/fs.d.ts +4780 -0
- package/node_modules/@types/node/globals.d.ts +150 -0
- package/node_modules/@types/node/globals.typedarray.d.ts +101 -0
- package/node_modules/@types/node/http.d.ts +2147 -0
- package/node_modules/@types/node/http2.d.ts +2485 -0
- package/node_modules/@types/node/https.d.ts +400 -0
- package/node_modules/@types/node/index.d.ts +117 -0
- package/node_modules/@types/node/inspector/promises.d.ts +35 -0
- package/node_modules/@types/node/inspector.d.ts +264 -0
- package/node_modules/@types/node/inspector.generated.d.ts +4406 -0
- package/node_modules/@types/node/module.d.ts +755 -0
- package/node_modules/@types/node/net.d.ts +970 -0
- package/node_modules/@types/node/os.d.ts +498 -0
- package/node_modules/@types/node/package.json +155 -0
- package/node_modules/@types/node/path/posix.d.ts +8 -0
- package/node_modules/@types/node/path/win32.d.ts +8 -0
- package/node_modules/@types/node/path.d.ts +178 -0
- package/node_modules/@types/node/perf_hooks.d.ts +612 -0
- package/node_modules/@types/node/process.d.ts +2204 -0
- package/node_modules/@types/node/punycode.d.ts +89 -0
- package/node_modules/@types/node/querystring.d.ts +139 -0
- package/node_modules/@types/node/quic.d.ts +897 -0
- package/node_modules/@types/node/readline/promises.d.ts +158 -0
- package/node_modules/@types/node/readline.d.ts +507 -0
- package/node_modules/@types/node/repl.d.ts +420 -0
- package/node_modules/@types/node/sea.d.ts +47 -0
- package/node_modules/@types/node/sqlite.d.ts +1068 -0
- package/node_modules/@types/node/stream/consumers.d.ts +114 -0
- package/node_modules/@types/node/stream/iter.d.ts +301 -0
- package/node_modules/@types/node/stream/promises.d.ts +211 -0
- package/node_modules/@types/node/stream/web.d.ts +300 -0
- package/node_modules/@types/node/stream.d.ts +1774 -0
- package/node_modules/@types/node/string_decoder.d.ts +27 -0
- package/node_modules/@types/node/test/reporters.d.ts +59 -0
- package/node_modules/@types/node/test.d.ts +2279 -0
- package/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/node_modules/@types/node/timers.d.ts +149 -0
- package/node_modules/@types/node/tls.d.ts +1193 -0
- package/node_modules/@types/node/trace_events.d.ts +103 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +119 -0
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +119 -0
- package/node_modules/@types/node/tty.d.ts +225 -0
- package/node_modules/@types/node/url.d.ts +556 -0
- package/node_modules/@types/node/util/types.d.ts +558 -0
- package/node_modules/@types/node/util.d.ts +1677 -0
- package/node_modules/@types/node/v8.d.ts +980 -0
- package/node_modules/@types/node/vm.d.ts +1136 -0
- package/node_modules/@types/node/wasi.d.ts +131 -0
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
- package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
- package/node_modules/@types/node/web-globals/console.d.ts +9 -0
- package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
- package/node_modules/@types/node/web-globals/events.d.ts +106 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
- package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
- package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +115 -0
- package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
- package/node_modules/@types/node/web-globals/url.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +671 -0
- package/node_modules/@types/node/zlib/iter.d.ts +131 -0
- package/node_modules/@types/node/zlib.d.ts +589 -0
- package/node_modules/protobufjs/README.md +556 -263
- package/node_modules/protobufjs/dist/light/protobuf.js +1569 -1919
- package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.js +906 -1132
- package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.js +1576 -1993
- package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/ext/descriptor/README.md +70 -3
- package/node_modules/protobufjs/ext/descriptor/index.d.ts +193 -0
- package/node_modules/protobufjs/ext/descriptor/index.js +1185 -1
- package/node_modules/protobufjs/ext/descriptor/test.js +54 -0
- package/node_modules/protobufjs/index.d.ts +720 -834
- package/node_modules/protobufjs/package.json +44 -20
- package/node_modules/protobufjs/src/converter.js +36 -60
- package/node_modules/protobufjs/src/decoder.js +53 -124
- package/node_modules/protobufjs/src/encoder.js +2 -10
- package/node_modules/protobufjs/src/enum.js +3 -8
- package/node_modules/protobufjs/src/field.js +11 -13
- package/node_modules/protobufjs/src/index-light.js +1 -1
- package/node_modules/protobufjs/src/mapfield.js +0 -1
- package/node_modules/protobufjs/src/message.js +11 -5
- package/node_modules/protobufjs/src/method.js +4 -5
- package/node_modules/protobufjs/src/namespace.js +3 -10
- package/node_modules/protobufjs/src/object.js +20 -20
- package/node_modules/protobufjs/src/oneof.js +0 -3
- package/node_modules/protobufjs/src/parse.js +16 -78
- package/node_modules/protobufjs/src/reader.js +31 -136
- package/node_modules/protobufjs/src/reader_buffer.js +3 -24
- package/node_modules/protobufjs/src/root.js +3 -7
- package/node_modules/protobufjs/src/roots.js +1 -1
- package/node_modules/protobufjs/src/service.js +6 -13
- package/node_modules/protobufjs/src/tokenize.js +1 -6
- package/node_modules/protobufjs/src/type.js +30 -44
- package/node_modules/protobufjs/src/typescript.jsdoc +15 -0
- package/node_modules/protobufjs/src/util/minimal.js +12 -36
- package/node_modules/protobufjs/src/util.js +17 -6
- package/node_modules/protobufjs/src/verifier.js +6 -6
- package/node_modules/protobufjs/src/wrappers.js +1 -0
- package/node_modules/protobufjs/src/writer.js +16 -42
- package/node_modules/protobufjs/src/writer_buffer.js +1 -18
- package/node_modules/protobufjs/tsconfig.json +5 -3
- package/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/undici-types/README.md +6 -0
- package/node_modules/undici-types/agent.d.ts +32 -0
- package/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/undici-types/balanced-pool.d.ts +30 -0
- package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
- package/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/undici-types/client.d.ts +123 -0
- package/node_modules/undici-types/connector.d.ts +36 -0
- package/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/undici-types/cookies.d.ts +30 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
- package/node_modules/undici-types/dispatcher.d.ts +279 -0
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici-types/errors.d.ts +177 -0
- package/node_modules/undici-types/eventsource.d.ts +66 -0
- package/node_modules/undici-types/fetch.d.ts +211 -0
- package/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/node_modules/undici-types/handlers.d.ts +15 -0
- package/node_modules/undici-types/header.d.ts +160 -0
- package/node_modules/undici-types/index.d.ts +91 -0
- package/node_modules/undici-types/interceptors.d.ts +80 -0
- package/node_modules/undici-types/mock-agent.d.ts +68 -0
- package/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/node_modules/undici-types/mock-client.d.ts +27 -0
- package/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
- package/node_modules/undici-types/mock-pool.d.ts +27 -0
- package/node_modules/undici-types/package.json +55 -0
- package/node_modules/undici-types/patch.d.ts +29 -0
- package/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/undici-types/pool.d.ts +41 -0
- package/node_modules/undici-types/proxy-agent.d.ts +29 -0
- package/node_modules/undici-types/readable.d.ts +68 -0
- package/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/undici-types/retry-handler.d.ts +125 -0
- package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
- package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/undici-types/utility.d.ts +7 -0
- package/node_modules/undici-types/webidl.d.ts +347 -0
- package/node_modules/undici-types/websocket.d.ts +188 -0
- package/npm-shrinkwrap.json +95 -6
- package/package.json +4 -4
- package/skills/feishu-wiki/SKILL.md +10 -1
- package/node_modules/protobufjs/ext/README.md +0 -81
- package/node_modules/protobufjs/ext/descriptor.d.ts +0 -86
- package/node_modules/protobufjs/ext/descriptor.generated.d.ts +0 -409
- package/node_modules/protobufjs/ext/descriptor.js +0 -1266
- package/node_modules/protobufjs/ext/textformat.d.ts +0 -19
- package/node_modules/protobufjs/ext/textformat.generated.d.ts +0 -11
- package/node_modules/protobufjs/ext/textformat.js +0 -1235
- package/node_modules/protobufjs/google/protobuf/compiler/plugin.json +0 -126
- package/node_modules/protobufjs/google/protobuf/compiler/plugin.proto +0 -47
- package/node_modules/protobufjs/src/typescript.js +0 -25
- /package/node_modules/{protobufjs/src/util/float.d.ts → @protobufjs/float/index.d.ts} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@protobufjs/float",
|
|
3
|
+
"description": "Reads / writes floats / doubles from / to buffers in both modern and ancient browsers.",
|
|
4
|
+
"version": "1.0.2",
|
|
5
|
+
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/dcodeIO/protobuf.js.git"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {},
|
|
11
|
+
"license": "BSD-3-Clause",
|
|
12
|
+
"main": "index.js",
|
|
13
|
+
"types": "index.d.ts",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"benchmark": "^2.1.4",
|
|
16
|
+
"chalk": "^1.1.3",
|
|
17
|
+
"ieee754": "^1.1.8",
|
|
18
|
+
"istanbul": "^0.4.5",
|
|
19
|
+
"tape": "^4.6.3"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "tape tests/*.js",
|
|
23
|
+
"coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js",
|
|
24
|
+
"bench": "node bench"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
var tape = require("tape");
|
|
2
|
+
|
|
3
|
+
var float = require("..");
|
|
4
|
+
|
|
5
|
+
tape.test("float", function(test) {
|
|
6
|
+
|
|
7
|
+
// default
|
|
8
|
+
test.test(test.name + " - typed array", function(test) {
|
|
9
|
+
runTest(float, test);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// ieee754
|
|
13
|
+
test.test(test.name + " - fallback", function(test) {
|
|
14
|
+
var F32 = global.Float32Array,
|
|
15
|
+
F64 = global.Float64Array;
|
|
16
|
+
delete global.Float32Array;
|
|
17
|
+
delete global.Float64Array;
|
|
18
|
+
runTest(float({}), test);
|
|
19
|
+
global.Float32Array = F32;
|
|
20
|
+
global.Float64Array = F64;
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
function runTest(float, test) {
|
|
25
|
+
|
|
26
|
+
var common = [
|
|
27
|
+
0,
|
|
28
|
+
-0,
|
|
29
|
+
Infinity,
|
|
30
|
+
-Infinity,
|
|
31
|
+
0.125,
|
|
32
|
+
1024.5,
|
|
33
|
+
-4096.5,
|
|
34
|
+
NaN
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
test.test(test.name + " - using 32 bits", function(test) {
|
|
38
|
+
common.concat([
|
|
39
|
+
3.4028234663852886e+38,
|
|
40
|
+
1.1754943508222875e-38,
|
|
41
|
+
1.1754946310819804e-39
|
|
42
|
+
])
|
|
43
|
+
.forEach(function(value) {
|
|
44
|
+
var strval = value === 0 && 1 / value < 0 ? "-0" : value.toString();
|
|
45
|
+
test.ok(
|
|
46
|
+
checkValue(value, 4, float.readFloatLE, float.writeFloatLE, Buffer.prototype.writeFloatLE),
|
|
47
|
+
"should write and read back " + strval + " (32 bit LE)"
|
|
48
|
+
);
|
|
49
|
+
test.ok(
|
|
50
|
+
checkValue(value, 4, float.readFloatBE, float.writeFloatBE, Buffer.prototype.writeFloatBE),
|
|
51
|
+
"should write and read back " + strval + " (32 bit BE)"
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
test.end();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test.test(test.name + " - using 64 bits", function(test) {
|
|
58
|
+
common.concat([
|
|
59
|
+
1.7976931348623157e+308,
|
|
60
|
+
2.2250738585072014e-308,
|
|
61
|
+
2.2250738585072014e-309
|
|
62
|
+
])
|
|
63
|
+
.forEach(function(value) {
|
|
64
|
+
var strval = value === 0 && 1 / value < 0 ? "-0" : value.toString();
|
|
65
|
+
test.ok(
|
|
66
|
+
checkValue(value, 8, float.readDoubleLE, float.writeDoubleLE, Buffer.prototype.writeDoubleLE),
|
|
67
|
+
"should write and read back " + strval + " (64 bit LE)"
|
|
68
|
+
);
|
|
69
|
+
test.ok(
|
|
70
|
+
checkValue(value, 8, float.readDoubleBE, float.writeDoubleBE, Buffer.prototype.writeDoubleBE),
|
|
71
|
+
"should write and read back " + strval + " (64 bit BE)"
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
test.end();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test.end();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function checkValue(value, size, read, write, write_comp) {
|
|
81
|
+
var buffer = new Buffer(size);
|
|
82
|
+
write(value, buffer, 0);
|
|
83
|
+
var value_comp = read(buffer, 0);
|
|
84
|
+
var strval = value === 0 && 1 / value < 0 ? "-0" : value.toString();
|
|
85
|
+
if (value !== value) {
|
|
86
|
+
if (value_comp === value_comp)
|
|
87
|
+
return false;
|
|
88
|
+
} else if (value_comp !== value)
|
|
89
|
+
return false;
|
|
90
|
+
|
|
91
|
+
var buffer_comp = new Buffer(size);
|
|
92
|
+
write_comp.call(buffer_comp, value, 0);
|
|
93
|
+
for (var i = 0; i < size; ++i)
|
|
94
|
+
if (buffer[i] !== buffer_comp[i]) {
|
|
95
|
+
console.error(">", buffer, buffer_comp);
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.1.2](https://github.com/protobufjs/protobuf.js/compare/inquire-v1.1.1...inquire-v1.1.2) (2026-05-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Backport bundler-safe optional module lookups ([#2254](https://github.com/protobufjs/protobuf.js/issues/2254)) ([0853a62](https://github.com/protobufjs/protobuf.js/commit/0853a625680f9247596b84ef48082b8f4e554797))
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Copyright (c) 2016, Daniel Wirtz All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are
|
|
5
|
+
met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright
|
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer in the
|
|
11
|
+
documentation and/or other materials provided with the distribution.
|
|
12
|
+
* Neither the name of its author, nor the names of its contributors
|
|
13
|
+
may be used to endorse or promote products derived from this software
|
|
14
|
+
without specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
17
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
18
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
19
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
20
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
21
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
23
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
24
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
25
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@protobufjs/inquire
|
|
2
|
+
===================
|
|
3
|
+
[](https://www.npmjs.com/package/@protobufjs/inquire)
|
|
4
|
+
|
|
5
|
+
Requires a module only if available and hides the require call from bundlers.
|
|
6
|
+
|
|
7
|
+
API
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
* **inquire(moduleName: `string`): `?Object`**<br />
|
|
11
|
+
Requires a module only if available.
|
|
12
|
+
|
|
13
|
+
**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export = inquire;
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Requires a module only if available.
|
|
5
|
-
* @memberof util
|
|
6
|
-
* @param {string} moduleName Module to require
|
|
7
|
-
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
|
8
|
-
* @deprecated Legacy optional require helper. Will be removed in a future release.
|
|
9
|
-
*/
|
|
10
|
-
declare function inquire(moduleName: string): object;
|
|
1
|
+
export = inquire;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Requires a module only if available.
|
|
5
|
+
* @memberof util
|
|
6
|
+
* @param {string} moduleName Module to require
|
|
7
|
+
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
|
8
|
+
* @deprecated Legacy optional require helper. Will be removed in a future release.
|
|
9
|
+
*/
|
|
10
|
+
declare function inquire(moduleName: string): object;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
module.exports = inquire;
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Requires a module only if available.
|
|
6
|
-
* @memberof util
|
|
7
|
-
* @param {string} moduleName Module to require
|
|
8
|
-
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
|
9
|
-
* @deprecated Legacy optional require helper. Will be removed in a future release.
|
|
10
|
-
*/
|
|
11
|
-
function inquire(moduleName) {
|
|
12
|
-
try {
|
|
13
|
-
if (typeof require !== "function") {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
var mod = require(moduleName);
|
|
17
|
-
if (mod && (mod.length || Object.keys(mod).length)) return mod;
|
|
18
|
-
return null;
|
|
19
|
-
} catch (err) {
|
|
20
|
-
// ignore
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
// maybe worth a shot to prevent renaming issues:
|
|
27
|
-
// see: https://github.com/webpack/webpack/blob/master/lib/dependencies/CommonJsRequireDependencyParserPlugin.js
|
|
28
|
-
// triggers on:
|
|
29
|
-
// - expression require.cache
|
|
30
|
-
// - expression require (???)
|
|
31
|
-
// - call require
|
|
32
|
-
// - call require:commonjs:item
|
|
33
|
-
// - call require:commonjs:context
|
|
34
|
-
|
|
35
|
-
Object.defineProperty(Function.prototype, "__self", { get: function() { return this; } });
|
|
36
|
-
var r = require.__self;
|
|
37
|
-
delete Function.prototype.__self;
|
|
38
|
-
*/
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = inquire;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Requires a module only if available.
|
|
6
|
+
* @memberof util
|
|
7
|
+
* @param {string} moduleName Module to require
|
|
8
|
+
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
|
9
|
+
* @deprecated Legacy optional require helper. Will be removed in a future release.
|
|
10
|
+
*/
|
|
11
|
+
function inquire(moduleName) {
|
|
12
|
+
try {
|
|
13
|
+
if (typeof require !== "function") {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
var mod = require(moduleName);
|
|
17
|
+
if (mod && (mod.length || Object.keys(mod).length)) return mod;
|
|
18
|
+
return null;
|
|
19
|
+
} catch (err) {
|
|
20
|
+
// ignore
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
// maybe worth a shot to prevent renaming issues:
|
|
27
|
+
// see: https://github.com/webpack/webpack/blob/master/lib/dependencies/CommonJsRequireDependencyParserPlugin.js
|
|
28
|
+
// triggers on:
|
|
29
|
+
// - expression require.cache
|
|
30
|
+
// - expression require (???)
|
|
31
|
+
// - call require
|
|
32
|
+
// - call require:commonjs:item
|
|
33
|
+
// - call require:commonjs:context
|
|
34
|
+
|
|
35
|
+
Object.defineProperty(Function.prototype, "__self", { get: function() { return this; } });
|
|
36
|
+
var r = require.__self;
|
|
37
|
+
delete Function.prototype.__self;
|
|
38
|
+
*/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@protobufjs/inquire",
|
|
3
|
+
"description": "Requires a module only if available and hides the require call from bundlers.",
|
|
4
|
+
"version": "1.1.2",
|
|
5
|
+
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/dcodeIO/protobuf.js.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "BSD-3-Clause",
|
|
11
|
+
"main": "index.js",
|
|
12
|
+
"types": "index.d.ts",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"istanbul": "^0.4.5",
|
|
15
|
+
"tape": "^5.0.0"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "tape tests/*.js",
|
|
19
|
+
"coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = [1];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = { a: 1 };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var tape = require("tape");
|
|
2
|
+
|
|
3
|
+
var inquire = require("..");
|
|
4
|
+
|
|
5
|
+
tape.test("inquire", function(test) {
|
|
6
|
+
|
|
7
|
+
test.equal(inquire("buffer").Buffer, Buffer, "should be able to require \"buffer\"");
|
|
8
|
+
|
|
9
|
+
test.equal(inquire("%invalid"), null, "should not be able to require \"%invalid\"");
|
|
10
|
+
|
|
11
|
+
test.equal(inquire("./tests/data/emptyObject"), null, "should return null when requiring a module exporting an empty object");
|
|
12
|
+
|
|
13
|
+
test.equal(inquire("./tests/data/emptyArray"), null, "should return null when requiring a module exporting an empty array");
|
|
14
|
+
|
|
15
|
+
test.same(inquire("./tests/data/object"), { a: 1 }, "should return the object if a non-empty object");
|
|
16
|
+
|
|
17
|
+
test.same(inquire("./tests/data/array"), [ 1 ], "should return the module if a non-empty array");
|
|
18
|
+
|
|
19
|
+
test.end();
|
|
20
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Copyright (c) 2016, Daniel Wirtz All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are
|
|
5
|
+
met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright
|
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer in the
|
|
11
|
+
documentation and/or other materials provided with the distribution.
|
|
12
|
+
* Neither the name of its author, nor the names of its contributors
|
|
13
|
+
may be used to endorse or promote products derived from this software
|
|
14
|
+
without specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
17
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
18
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
19
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
20
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
21
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
23
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
24
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
25
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@protobufjs/path
|
|
2
|
+
================
|
|
3
|
+
[](https://www.npmjs.com/package/@protobufjs/path)
|
|
4
|
+
|
|
5
|
+
A minimal path module to resolve Unix, Windows and URL paths alike.
|
|
6
|
+
|
|
7
|
+
API
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
* **path.isAbsolute(path: `string`): `boolean`**<br />
|
|
11
|
+
Tests if the specified path is absolute.
|
|
12
|
+
|
|
13
|
+
* **path.normalize(path: `string`): `string`**<br />
|
|
14
|
+
Normalizes the specified path.
|
|
15
|
+
|
|
16
|
+
* **path.resolve(originPath: `string`, includePath: `string`, [alreadyNormalized=false: `boolean`]): `string`**<br />
|
|
17
|
+
Resolves the specified include path against the specified origin path.
|
|
18
|
+
|
|
19
|
+
**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests if the specified path is absolute.
|
|
3
|
-
* @param {string} path Path to test
|
|
4
|
-
* @returns {boolean} `true` if path is absolute
|
|
5
|
-
*/
|
|
6
|
-
export function isAbsolute(path: string): boolean;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Normalizes the specified path.
|
|
10
|
-
* @param {string} path Path to normalize
|
|
11
|
-
* @returns {string} Normalized path
|
|
12
|
-
*/
|
|
13
|
-
export function normalize(path: string): string;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Resolves the specified include path against the specified origin path.
|
|
17
|
-
* @param {string} originPath Path to the origin file
|
|
18
|
-
* @param {string} includePath Include path relative to origin path
|
|
19
|
-
* @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
|
|
20
|
-
* @returns {string} Path to the include file
|
|
21
|
-
*/
|
|
22
|
-
export function resolve(originPath: string, includePath: string, alreadyNormalized?: boolean): string;
|
|
1
|
+
/**
|
|
2
|
+
* Tests if the specified path is absolute.
|
|
3
|
+
* @param {string} path Path to test
|
|
4
|
+
* @returns {boolean} `true` if path is absolute
|
|
5
|
+
*/
|
|
6
|
+
export function isAbsolute(path: string): boolean;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Normalizes the specified path.
|
|
10
|
+
* @param {string} path Path to normalize
|
|
11
|
+
* @returns {string} Normalized path
|
|
12
|
+
*/
|
|
13
|
+
export function normalize(path: string): string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the specified include path against the specified origin path.
|
|
17
|
+
* @param {string} originPath Path to the origin file
|
|
18
|
+
* @param {string} includePath Include path relative to origin path
|
|
19
|
+
* @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
|
|
20
|
+
* @returns {string} Path to the include file
|
|
21
|
+
*/
|
|
22
|
+
export function resolve(originPath: string, includePath: string, alreadyNormalized?: boolean): string;
|
|
@@ -1,72 +1,65 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A minimal path module to resolve Unix, Windows and URL paths alike.
|
|
5
|
-
* @memberof util
|
|
6
|
-
* @namespace
|
|
7
|
-
*/
|
|
8
|
-
var path = exports;
|
|
9
|
-
|
|
10
|
-
var isAbsolute =
|
|
11
|
-
/**
|
|
12
|
-
* Tests if the specified path is absolute.
|
|
13
|
-
* @param {string} path Path to test
|
|
14
|
-
* @returns {boolean} `true` if path is absolute
|
|
15
|
-
*/
|
|
16
|
-
path.isAbsolute = function isAbsolute(path) {
|
|
17
|
-
return /^(?:\/|\w
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
var normalize =
|
|
21
|
-
/**
|
|
22
|
-
* Normalizes the specified path.
|
|
23
|
-
* @param {string} path Path to normalize
|
|
24
|
-
* @returns {string} Normalized path
|
|
25
|
-
*/
|
|
26
|
-
path.normalize = function normalize(path) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (parts[i] === "
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
includePath = normalize(includePath);
|
|
67
|
-
if (isAbsolute(includePath))
|
|
68
|
-
return includePath;
|
|
69
|
-
if (!alreadyNormalized)
|
|
70
|
-
originPath = normalize(originPath);
|
|
71
|
-
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
|
|
72
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A minimal path module to resolve Unix, Windows and URL paths alike.
|
|
5
|
+
* @memberof util
|
|
6
|
+
* @namespace
|
|
7
|
+
*/
|
|
8
|
+
var path = exports;
|
|
9
|
+
|
|
10
|
+
var isAbsolute =
|
|
11
|
+
/**
|
|
12
|
+
* Tests if the specified path is absolute.
|
|
13
|
+
* @param {string} path Path to test
|
|
14
|
+
* @returns {boolean} `true` if path is absolute
|
|
15
|
+
*/
|
|
16
|
+
path.isAbsolute = function isAbsolute(path) {
|
|
17
|
+
return /^(?:\/|\w+:)/.test(path);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var normalize =
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes the specified path.
|
|
23
|
+
* @param {string} path Path to normalize
|
|
24
|
+
* @returns {string} Normalized path
|
|
25
|
+
*/
|
|
26
|
+
path.normalize = function normalize(path) {
|
|
27
|
+
path = path.replace(/\\/g, "/")
|
|
28
|
+
.replace(/\/{2,}/g, "/");
|
|
29
|
+
var parts = path.split("/"),
|
|
30
|
+
absolute = isAbsolute(path),
|
|
31
|
+
prefix = "";
|
|
32
|
+
if (absolute)
|
|
33
|
+
prefix = parts.shift() + "/";
|
|
34
|
+
for (var i = 0; i < parts.length;) {
|
|
35
|
+
if (parts[i] === "..") {
|
|
36
|
+
if (i > 0 && parts[i - 1] !== "..")
|
|
37
|
+
parts.splice(--i, 2);
|
|
38
|
+
else if (absolute)
|
|
39
|
+
parts.splice(i, 1);
|
|
40
|
+
else
|
|
41
|
+
++i;
|
|
42
|
+
} else if (parts[i] === ".")
|
|
43
|
+
parts.splice(i, 1);
|
|
44
|
+
else
|
|
45
|
+
++i;
|
|
46
|
+
}
|
|
47
|
+
return prefix + parts.join("/");
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Resolves the specified include path against the specified origin path.
|
|
52
|
+
* @param {string} originPath Path to the origin file
|
|
53
|
+
* @param {string} includePath Include path relative to origin path
|
|
54
|
+
* @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
|
|
55
|
+
* @returns {string} Path to the include file
|
|
56
|
+
*/
|
|
57
|
+
path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
|
58
|
+
if (!alreadyNormalized)
|
|
59
|
+
includePath = normalize(includePath);
|
|
60
|
+
if (isAbsolute(includePath))
|
|
61
|
+
return includePath;
|
|
62
|
+
if (!alreadyNormalized)
|
|
63
|
+
originPath = normalize(originPath);
|
|
64
|
+
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
|
|
65
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@protobufjs/path",
|
|
3
|
+
"description": "A minimal path module to resolve Unix, Windows and URL paths alike.",
|
|
4
|
+
"version": "1.1.2",
|
|
5
|
+
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/dcodeIO/protobuf.js.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "BSD-3-Clause",
|
|
11
|
+
"main": "index.js",
|
|
12
|
+
"types": "index.d.ts",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"istanbul": "^0.4.5",
|
|
15
|
+
"tape": "^4.6.3"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "tape tests/*.js",
|
|
19
|
+
"coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var tape = require("tape");
|
|
2
|
+
|
|
3
|
+
var path = require("..");
|
|
4
|
+
|
|
5
|
+
tape.test("path", function(test) {
|
|
6
|
+
|
|
7
|
+
test.ok(path.isAbsolute("X:\\some\\path\\file.js"), "should identify absolute windows paths");
|
|
8
|
+
test.ok(path.isAbsolute("/some/path/file.js"), "should identify absolute unix paths");
|
|
9
|
+
|
|
10
|
+
test.notOk(path.isAbsolute("some\\path\\file.js"), "should identify relative windows paths");
|
|
11
|
+
test.notOk(path.isAbsolute("some/path/file.js"), "should identify relative unix paths");
|
|
12
|
+
|
|
13
|
+
var paths = [
|
|
14
|
+
{
|
|
15
|
+
actual: "X:\\some\\..\\.\\path\\\\file.js",
|
|
16
|
+
normal: "X:/path/file.js",
|
|
17
|
+
resolve: {
|
|
18
|
+
origin: "X:/path/origin.js",
|
|
19
|
+
expected: "X:/path/file.js"
|
|
20
|
+
}
|
|
21
|
+
}, {
|
|
22
|
+
actual: "some\\..\\.\\path\\\\file.js",
|
|
23
|
+
normal: "path/file.js",
|
|
24
|
+
resolve: {
|
|
25
|
+
origin: "X:/path/origin.js",
|
|
26
|
+
expected: "X:/path/path/file.js"
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
actual: "/some/.././path//file.js",
|
|
30
|
+
normal: "/path/file.js",
|
|
31
|
+
resolve: {
|
|
32
|
+
origin: "/path/origin.js",
|
|
33
|
+
expected: "/path/file.js"
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
actual: "some/.././path//file.js",
|
|
37
|
+
normal: "path/file.js",
|
|
38
|
+
resolve: {
|
|
39
|
+
origin: "",
|
|
40
|
+
expected: "path/file.js"
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
actual: ".././path//file.js",
|
|
44
|
+
normal: "../path/file.js"
|
|
45
|
+
}, {
|
|
46
|
+
actual: "/.././path//file.js",
|
|
47
|
+
normal: "/path/file.js"
|
|
48
|
+
}
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
paths.forEach(function(p) {
|
|
52
|
+
test.equal(path.normalize(p.actual), p.normal, "should normalize " + p.actual);
|
|
53
|
+
if (p.resolve) {
|
|
54
|
+
test.equal(path.resolve(p.resolve.origin, p.actual), p.resolve.expected, "should resolve " + p.actual);
|
|
55
|
+
test.equal(path.resolve(p.resolve.origin, p.normal, true), p.resolve.expected, "should resolve " + p.normal + " (already normalized)");
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test.end();
|
|
60
|
+
});
|