@openclaw/whatsapp 2026.8.1-beta.3 → 2026.8.2
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/{accounts-BX2fZUyR.js → accounts-CeKQbu_s.js} +9 -26
- package/dist/{action-runtime-pM-ExU0l.js → action-runtime-Bw0loEdy.js} +2 -2
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{call-tool-api.js → agent-tools-api.js} +13 -6
- package/dist/{agent-tools-login-BjRpD-JQ.js → agent-tools-login-B-2qZPzc.js} +12 -3
- package/dist/api.js +10 -10
- package/dist/{approval-handler.runtime-CkMMvUjk.js → approval-handler.runtime-DeyPb57-.js} +3 -3
- package/dist/{approval-reactions-Jyr1JaAK.js → approval-reactions-DGDA6hQ7.js} +7 -5
- package/dist/{auth-store-CtpBqH5S.js → auth-store-DTj1H9pv.js} +5 -3
- package/dist/{channel-DRMYRfZ8.js → channel-DxMmDjqK.js} +26 -24
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-CstrR0CT.js → channel-react-action-BUp7Wbfr.js} +3 -3
- package/dist/{channel.runtime-X3JC2gaq.js → channel.runtime-BwSnyXRX.js} +4 -4
- package/dist/{channel.setup-DhBBhbQv.js → channel.setup-aOFLSQyw.js} +1 -1
- package/dist/{config-schema-BQP5YCeK.js → config-schema-BYA6e_Ii.js} +6 -4
- package/dist/{connection-controller-CIYuBJrs.js → connection-controller-BvkxsbWi.js} +2 -2
- package/dist/{constants-HU41RHGI.js → constants-C7m81BNe.js} +1 -1
- package/dist/{directory-config-P7_3U73Z.js → directory-config-LgxYJLWY.js} +3 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/{group-session-key-DmFc_Cqi.js → group-session-key-KUguLmSZ.js} +4 -4
- package/dist/index.js +4 -4
- package/dist/light-runtime-api.js +2 -2
- package/dist/{login-BkpKpndm.js → login-Bk_jiXKD.js} +6 -5
- package/dist/{login-qr-1dpv6jjT.js → login-qr-B3m61NqA.js} +43 -20
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-IzwQKizW.js → monitor-CTsyo-HE.js} +185 -162
- package/dist/{question-reactions-D3eAeB0i.js → question-reactions-B9D6MHXZ.js} +1 -1
- package/dist/runtime-api.js +9 -9
- package/dist/{send-CwvTU4RI.js → send-DiPjiygK.js} +54 -29
- package/dist/{send-api-obOSm2cC.js → send-api-kFcuhSiY.js} +43 -41
- package/dist/{setup-finalize-n4K2I2gJ.js → setup-finalize-CqH5wTK5.js} +7 -6
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-Cwn3zyxK.js → setup-surface-Dm3T6S8t.js} +3 -3
- package/dist/{shared-wg42NKFB.js → shared-DDjonGys.js} +7 -6
- package/dist/{socket-close-2T0_jZTN.js → socket-close-CpkkJZCU.js} +9 -6
- package/dist/{targets-runtime-TMk0lGuy.js → targets-runtime-RBjx3pg_.js} +1 -2
- package/dist/{text-runtime-CaKLhowd.js → text-runtime-DyfmcATV.js} +1 -1
- package/node_modules/baileys/lib/Defaults/index.js +1 -1
- package/node_modules/baileys/lib/Socket/business.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/chats.d.ts +1 -0
- package/node_modules/baileys/lib/Socket/chats.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/chats.js +10 -5
- package/node_modules/baileys/lib/Socket/chats.js.map +1 -1
- package/node_modules/baileys/lib/Socket/communities.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/groups.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/index.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/messages-recv.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/messages-send.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/newsletter.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/socket.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/socket.js +3 -0
- package/node_modules/baileys/lib/Socket/socket.js.map +1 -1
- package/node_modules/baileys/lib/Types/index.d.ts +1 -0
- package/node_modules/baileys/lib/Types/index.d.ts.map +1 -1
- package/node_modules/baileys/lib/Types/index.js.map +1 -1
- package/node_modules/baileys/lib/Utils/browser-utils.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/browser-utils.js +1 -0
- package/node_modules/baileys/lib/Utils/browser-utils.js.map +1 -1
- package/node_modules/baileys/lib/Utils/generics.d.ts +1 -0
- package/node_modules/baileys/lib/Utils/generics.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/generics.js +1 -1
- package/node_modules/baileys/lib/Utils/generics.js.map +1 -1
- package/node_modules/baileys/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/tc-token-utils.js +3 -2
- package/node_modules/baileys/lib/Utils/tc-token-utils.js.map +1 -1
- package/node_modules/baileys/lib/Utils/validate-connection.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/validate-connection.js +9 -2
- package/node_modules/baileys/lib/Utils/validate-connection.js.map +1 -1
- package/node_modules/baileys/node_modules/content-type/README.md +2 -0
- package/node_modules/baileys/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/baileys/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/baileys/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/baileys/node_modules/content-type/package.json +1 -1
- package/node_modules/baileys/node_modules/file-type/package.json +1 -1
- package/node_modules/baileys/node_modules/file-type/readme.md +3 -0
- package/node_modules/baileys/node_modules/file-type/source/detectors/zip.js +6 -1
- package/node_modules/baileys/node_modules/file-type/source/index.d.ts +3 -0
- package/node_modules/baileys/node_modules/file-type/source/index.js +25 -13
- package/node_modules/baileys/node_modules/music-metadata/LICENSE.txt +9 -9
- package/node_modules/baileys/node_modules/music-metadata/README.md +878 -878
- package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -4
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.js +66 -30
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.d.ts +5 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.js +94 -25
- package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfChunk.js +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfParser.js +38 -13
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.js +2 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4Parser.js +34 -7
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +7 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +13 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffChunk.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/package.json +156 -156
- package/node_modules/baileys/node_modules/process-warning/.github/dependabot.yml +42 -2
- package/node_modules/baileys/node_modules/process-warning/.github/workflows/ci.yml +12 -1
- package/node_modules/baileys/node_modules/process-warning/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/baileys/node_modules/process-warning/LICENSE +1 -1
- package/node_modules/baileys/node_modules/process-warning/README.md +41 -2
- package/node_modules/baileys/node_modules/process-warning/index.js +85 -17
- package/node_modules/baileys/node_modules/process-warning/package.json +6 -7
- package/node_modules/baileys/node_modules/process-warning/test/emit-once-only.test.js +3 -3
- package/node_modules/baileys/node_modules/process-warning/test/emit-reset.test.js +4 -4
- package/node_modules/baileys/node_modules/process-warning/test/emit-unlimited.test.js +2 -2
- package/node_modules/baileys/node_modules/process-warning/test/spy-warning.test.js +143 -0
- package/node_modules/baileys/node_modules/process-warning/types/index.d.ts +15 -1
- package/node_modules/baileys/node_modules/process-warning/types/index.tst.ts +48 -0
- package/node_modules/baileys/node_modules/protobufjs/README.md +61 -84
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +66 -45
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js +47 -40
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js +92 -68
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.js +26 -10
- package/node_modules/baileys/node_modules/protobufjs/index.d.ts +3 -0
- package/node_modules/baileys/node_modules/protobufjs/package.json +1 -1
- package/node_modules/baileys/node_modules/protobufjs/src/converter.js +5 -1
- package/node_modules/baileys/node_modules/protobufjs/src/enum.js +5 -2
- package/node_modules/baileys/node_modules/protobufjs/src/field.js +6 -1
- package/node_modules/baileys/node_modules/protobufjs/src/parse.js +26 -23
- package/node_modules/baileys/node_modules/protobufjs/src/reader.js +36 -9
- package/node_modules/baileys/node_modules/protobufjs/src/util/codegen.js +3 -1
- package/node_modules/baileys/node_modules/protobufjs/src/util/utf8.js +2 -28
- package/node_modules/baileys/node_modules/protobufjs/src/writer.js +7 -1
- package/node_modules/baileys/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/baileys/node_modules/ws/package.json +1 -1
- package/node_modules/baileys/package.json +1 -1
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/openclaw.plugin.json +2 -1
- package/package.json +6 -6
- package/node_modules/baileys/node_modules/process-warning/types/index.test-d.ts +0 -36
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -11,6 +11,7 @@ const debug = initDebug('music-metadata:parser:ogg:speex');
|
|
|
11
11
|
export class SpeexStream extends VorbisStream {
|
|
12
12
|
constructor(metadata, options, _tokenizer) {
|
|
13
13
|
super(metadata, options);
|
|
14
|
+
this.commentHeaderParsed = false;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Parse first Speex Ogg page
|
|
@@ -28,4 +29,16 @@ export class SpeexStream extends VorbisStream {
|
|
|
28
29
|
}
|
|
29
30
|
this.metadata.setAudioOnly();
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* The packet following the identification header is the comment header, in
|
|
34
|
+
* Vorbis comment format but without a packet type or magic signature.
|
|
35
|
+
* Ref: https://tools.ietf.org/html/rfc5574#section-3
|
|
36
|
+
*/
|
|
37
|
+
async parseFullPage(pageData) {
|
|
38
|
+
if (this.commentHeaderParsed)
|
|
39
|
+
return;
|
|
40
|
+
this.commentHeaderParsed = true;
|
|
41
|
+
debug('Parse Ogg/Speex comment header');
|
|
42
|
+
await this.parseUserCommentList(pageData, 0);
|
|
43
|
+
}
|
|
31
44
|
}
|
|
@@ -23,6 +23,6 @@ export class ListInfoTagValue {
|
|
|
23
23
|
this.len += this.len & 1; // if it is an odd length, round up to even
|
|
24
24
|
}
|
|
25
25
|
get(buf, off) {
|
|
26
|
-
return new Token.StringType(this.tagHeader.chunkSize, '
|
|
26
|
+
return new Token.StringType(this.tagHeader.chunkSize, 'utf8').get(buf, off);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "music-metadata",
|
|
3
|
-
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
|
|
4
|
-
"version": "11.
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "Borewit",
|
|
7
|
-
"url": "https://github.com/Borewit"
|
|
8
|
-
},
|
|
9
|
-
"funding": [
|
|
10
|
-
{
|
|
11
|
-
"type": "github",
|
|
12
|
-
"url": "https://github.com/sponsors/Borewit"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"type": "buymeacoffee",
|
|
16
|
-
"url": "https://buymeacoffee.com/borewit"
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"sideEffects": false,
|
|
20
|
-
"type": "module",
|
|
21
|
-
"exports": {
|
|
22
|
-
"node": {
|
|
23
|
-
"import": "./lib/index.js",
|
|
24
|
-
"module-sync": "./lib/index.js",
|
|
25
|
-
"types": "./lib/index.d.ts"
|
|
26
|
-
},
|
|
27
|
-
"default": {
|
|
28
|
-
"import": "./lib/core.js",
|
|
29
|
-
"module-sync": "./lib/core.js",
|
|
30
|
-
"types": "./lib/core.d.ts"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"types": "lib/index.d.ts",
|
|
34
|
-
"files": [
|
|
35
|
-
"lib/**/*.js",
|
|
36
|
-
"lib/**/*.d.ts"
|
|
37
|
-
],
|
|
38
|
-
"keywords": [
|
|
39
|
-
"music",
|
|
40
|
-
"metadata",
|
|
41
|
-
"meta",
|
|
42
|
-
"audio",
|
|
43
|
-
"tag",
|
|
44
|
-
"tags",
|
|
45
|
-
"duration",
|
|
46
|
-
"MusicBrainz",
|
|
47
|
-
"Discogs",
|
|
48
|
-
"Picard",
|
|
49
|
-
"ID3",
|
|
50
|
-
"ID3v1",
|
|
51
|
-
"ID3v2",
|
|
52
|
-
"m4a",
|
|
53
|
-
"m4b",
|
|
54
|
-
"mp3",
|
|
55
|
-
"mp4",
|
|
56
|
-
"Vorbis",
|
|
57
|
-
"ogg",
|
|
58
|
-
"flac",
|
|
59
|
-
"Matroska",
|
|
60
|
-
"WebM",
|
|
61
|
-
"EBML",
|
|
62
|
-
"asf",
|
|
63
|
-
"wma",
|
|
64
|
-
"wmv",
|
|
65
|
-
"ape",
|
|
66
|
-
"MonkeyAudio",
|
|
67
|
-
"aiff",
|
|
68
|
-
"wav",
|
|
69
|
-
"WavPack",
|
|
70
|
-
"Opus",
|
|
71
|
-
"speex",
|
|
72
|
-
"musepack",
|
|
73
|
-
"mpc",
|
|
74
|
-
"dsd",
|
|
75
|
-
"dsf",
|
|
76
|
-
"mpc",
|
|
77
|
-
"dff",
|
|
78
|
-
"dsdiff",
|
|
79
|
-
"aac",
|
|
80
|
-
"adts",
|
|
81
|
-
"length",
|
|
82
|
-
"chapter",
|
|
83
|
-
"info",
|
|
84
|
-
"parse",
|
|
85
|
-
"parser",
|
|
86
|
-
"bwf",
|
|
87
|
-
"slt",
|
|
88
|
-
"lyrics",
|
|
89
|
-
"Chapters",
|
|
90
|
-
"ID3v2 Chapters"
|
|
91
|
-
],
|
|
92
|
-
"scripts": {
|
|
93
|
-
"clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'test/**/*.js' 'test/**/*.js.map' 'test/**/*.js' 'test/**/*.js.map' 'doc-gen/**/*.js' 'doc-gen/**/*.js.map'",
|
|
94
|
-
"compile-src:dev": "tsc -p lib/tsconfig.json",
|
|
95
|
-
"compile-src:prod": "tsc -p lib/tsconfig.prod.json",
|
|
96
|
-
"compile-test": "tsc -p test",
|
|
97
|
-
"compile-doc": "tsc -p doc-gen",
|
|
98
|
-
"compile:dev": "yarn run compile-src:dev && yarn compile-test && yarn compile-doc",
|
|
99
|
-
"compile:prod": "yarn run compile-src:prod && yarn compile-test && yarn compile-doc",
|
|
100
|
-
"lint:ts": "biome check",
|
|
101
|
-
"lint:md": "yarn run remark -u remark-preset-lint-consistent .",
|
|
102
|
-
"lint": "yarn run lint:ts && yarn run lint:md",
|
|
103
|
-
"test": "mocha",
|
|
104
|
-
"build:dev": "yarn run clean && yarn compile:dev && yarn run doc-gen",
|
|
105
|
-
"build:prod": "yarn run clean && yarn compile:prod && yarn run doc-gen",
|
|
106
|
-
"build": "yarn run build:prod",
|
|
107
|
-
"prepublishOnly": "yarn run build:prod",
|
|
108
|
-
"test-coverage": "c8 yarn run test",
|
|
109
|
-
"send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
|
|
110
|
-
"doc-gen": "yarn node doc-gen/gen.js",
|
|
111
|
-
"typecheck": "tsc --project ./lib/tsconfig.json --noEmit && tsc --project ./test/tsconfig.json --noEmit",
|
|
112
|
-
"update-biome": "yarn add -D --exact @biomejs/biome && npx @biomejs/biome migrate --write"
|
|
113
|
-
},
|
|
114
|
-
"dependencies": {
|
|
115
|
-
"@borewit/text-codec": "^0.2.2",
|
|
116
|
-
"@tokenizer/token": "^0.3.0",
|
|
117
|
-
"content-type": "^2.
|
|
118
|
-
"debug": "^4.4.3",
|
|
119
|
-
"file-type": "^21.3.4",
|
|
120
|
-
"media-typer": "^2.0.0",
|
|
121
|
-
"strtok3": "^10.3.5",
|
|
122
|
-
"token-types": "^6.1.2",
|
|
123
|
-
"uint8array-extras": "^1.5.0",
|
|
124
|
-
"win-guid": "^0.2.1"
|
|
125
|
-
},
|
|
126
|
-
"devDependencies": {
|
|
127
|
-
"@biomejs/biome": "2.5.
|
|
128
|
-
"@types/chai": "^5.2.3",
|
|
129
|
-
"@types/chai-as-promised": "^8.0.2",
|
|
130
|
-
"@types/content-type": "^2.0.0",
|
|
131
|
-
"@types/debug": "^4.1.13",
|
|
132
|
-
"@types/media-typer": "^1.1.3",
|
|
133
|
-
"@types/mocha": "^10.0.10",
|
|
134
|
-
"@types/node": "^26.
|
|
135
|
-
"c8": "^
|
|
136
|
-
"chai": "^6.2.2",
|
|
137
|
-
"chai-as-promised": "^8.0.2",
|
|
138
|
-
"del-cli": "^7.0.0",
|
|
139
|
-
"mime": "^4.1.0",
|
|
140
|
-
"mocha": "^11.
|
|
141
|
-
"node-readable-to-web-readable-stream": "^0.4.2",
|
|
142
|
-
"remark-cli": "^12.0.1",
|
|
143
|
-
"remark-preset-lint-consistent": "^6.0.1",
|
|
144
|
-
"ts-node": "^10.9.2",
|
|
145
|
-
"typescript": "^
|
|
146
|
-
},
|
|
147
|
-
"engines": {
|
|
148
|
-
"node": ">=18"
|
|
149
|
-
},
|
|
150
|
-
"repository": "github:Borewit/music-metadata",
|
|
151
|
-
"license": "MIT",
|
|
152
|
-
"bugs": {
|
|
153
|
-
"url": "https://github.com/Borewit/music-metadata/issues"
|
|
154
|
-
},
|
|
155
|
-
"packageManager": "yarn@4.9.2"
|
|
156
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "music-metadata",
|
|
3
|
+
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
|
|
4
|
+
"version": "11.15.0",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Borewit",
|
|
7
|
+
"url": "https://github.com/Borewit"
|
|
8
|
+
},
|
|
9
|
+
"funding": [
|
|
10
|
+
{
|
|
11
|
+
"type": "github",
|
|
12
|
+
"url": "https://github.com/sponsors/Borewit"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "buymeacoffee",
|
|
16
|
+
"url": "https://buymeacoffee.com/borewit"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"type": "module",
|
|
21
|
+
"exports": {
|
|
22
|
+
"node": {
|
|
23
|
+
"import": "./lib/index.js",
|
|
24
|
+
"module-sync": "./lib/index.js",
|
|
25
|
+
"types": "./lib/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"default": {
|
|
28
|
+
"import": "./lib/core.js",
|
|
29
|
+
"module-sync": "./lib/core.js",
|
|
30
|
+
"types": "./lib/core.d.ts"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"types": "lib/index.d.ts",
|
|
34
|
+
"files": [
|
|
35
|
+
"lib/**/*.js",
|
|
36
|
+
"lib/**/*.d.ts"
|
|
37
|
+
],
|
|
38
|
+
"keywords": [
|
|
39
|
+
"music",
|
|
40
|
+
"metadata",
|
|
41
|
+
"meta",
|
|
42
|
+
"audio",
|
|
43
|
+
"tag",
|
|
44
|
+
"tags",
|
|
45
|
+
"duration",
|
|
46
|
+
"MusicBrainz",
|
|
47
|
+
"Discogs",
|
|
48
|
+
"Picard",
|
|
49
|
+
"ID3",
|
|
50
|
+
"ID3v1",
|
|
51
|
+
"ID3v2",
|
|
52
|
+
"m4a",
|
|
53
|
+
"m4b",
|
|
54
|
+
"mp3",
|
|
55
|
+
"mp4",
|
|
56
|
+
"Vorbis",
|
|
57
|
+
"ogg",
|
|
58
|
+
"flac",
|
|
59
|
+
"Matroska",
|
|
60
|
+
"WebM",
|
|
61
|
+
"EBML",
|
|
62
|
+
"asf",
|
|
63
|
+
"wma",
|
|
64
|
+
"wmv",
|
|
65
|
+
"ape",
|
|
66
|
+
"MonkeyAudio",
|
|
67
|
+
"aiff",
|
|
68
|
+
"wav",
|
|
69
|
+
"WavPack",
|
|
70
|
+
"Opus",
|
|
71
|
+
"speex",
|
|
72
|
+
"musepack",
|
|
73
|
+
"mpc",
|
|
74
|
+
"dsd",
|
|
75
|
+
"dsf",
|
|
76
|
+
"mpc",
|
|
77
|
+
"dff",
|
|
78
|
+
"dsdiff",
|
|
79
|
+
"aac",
|
|
80
|
+
"adts",
|
|
81
|
+
"length",
|
|
82
|
+
"chapter",
|
|
83
|
+
"info",
|
|
84
|
+
"parse",
|
|
85
|
+
"parser",
|
|
86
|
+
"bwf",
|
|
87
|
+
"slt",
|
|
88
|
+
"lyrics",
|
|
89
|
+
"Chapters",
|
|
90
|
+
"ID3v2 Chapters"
|
|
91
|
+
],
|
|
92
|
+
"scripts": {
|
|
93
|
+
"clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'test/**/*.js' 'test/**/*.js.map' 'test/**/*.js' 'test/**/*.js.map' 'doc-gen/**/*.js' 'doc-gen/**/*.js.map'",
|
|
94
|
+
"compile-src:dev": "tsc -p lib/tsconfig.json",
|
|
95
|
+
"compile-src:prod": "tsc -p lib/tsconfig.prod.json",
|
|
96
|
+
"compile-test": "tsc -p test",
|
|
97
|
+
"compile-doc": "tsc -p doc-gen",
|
|
98
|
+
"compile:dev": "yarn run compile-src:dev && yarn compile-test && yarn compile-doc",
|
|
99
|
+
"compile:prod": "yarn run compile-src:prod && yarn compile-test && yarn compile-doc",
|
|
100
|
+
"lint:ts": "biome check",
|
|
101
|
+
"lint:md": "yarn run remark -u remark-preset-lint-consistent .",
|
|
102
|
+
"lint": "yarn run lint:ts && yarn run lint:md",
|
|
103
|
+
"test": "mocha",
|
|
104
|
+
"build:dev": "yarn run clean && yarn compile:dev && yarn run doc-gen",
|
|
105
|
+
"build:prod": "yarn run clean && yarn compile:prod && yarn run doc-gen",
|
|
106
|
+
"build": "yarn run build:prod",
|
|
107
|
+
"prepublishOnly": "yarn run build:prod",
|
|
108
|
+
"test-coverage": "c8 yarn run test",
|
|
109
|
+
"send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
|
|
110
|
+
"doc-gen": "yarn node doc-gen/gen.js",
|
|
111
|
+
"typecheck": "tsc --project ./lib/tsconfig.json --noEmit && tsc --project ./test/tsconfig.json --noEmit",
|
|
112
|
+
"update-biome": "yarn add -D --exact @biomejs/biome && npx @biomejs/biome migrate --write"
|
|
113
|
+
},
|
|
114
|
+
"dependencies": {
|
|
115
|
+
"@borewit/text-codec": "^0.2.2",
|
|
116
|
+
"@tokenizer/token": "^0.3.0",
|
|
117
|
+
"content-type": "^2.1.0",
|
|
118
|
+
"debug": "^4.4.3",
|
|
119
|
+
"file-type": "^21.3.4",
|
|
120
|
+
"media-typer": "^2.0.0",
|
|
121
|
+
"strtok3": "^10.3.5",
|
|
122
|
+
"token-types": "^6.1.2",
|
|
123
|
+
"uint8array-extras": "^1.5.0",
|
|
124
|
+
"win-guid": "^0.2.1"
|
|
125
|
+
},
|
|
126
|
+
"devDependencies": {
|
|
127
|
+
"@biomejs/biome": "2.5.9",
|
|
128
|
+
"@types/chai": "^5.2.3",
|
|
129
|
+
"@types/chai-as-promised": "^8.0.2",
|
|
130
|
+
"@types/content-type": "^2.0.0",
|
|
131
|
+
"@types/debug": "^4.1.13",
|
|
132
|
+
"@types/media-typer": "^1.1.3",
|
|
133
|
+
"@types/mocha": "^10.0.10",
|
|
134
|
+
"@types/node": "^26.2.0",
|
|
135
|
+
"c8": "^12.0.0",
|
|
136
|
+
"chai": "^6.2.2",
|
|
137
|
+
"chai-as-promised": "^8.0.2",
|
|
138
|
+
"del-cli": "^7.0.0",
|
|
139
|
+
"mime": "^4.1.0",
|
|
140
|
+
"mocha": "^11.8.0",
|
|
141
|
+
"node-readable-to-web-readable-stream": "^0.4.2",
|
|
142
|
+
"remark-cli": "^12.0.1",
|
|
143
|
+
"remark-preset-lint-consistent": "^6.0.1",
|
|
144
|
+
"ts-node": "^10.9.2",
|
|
145
|
+
"typescript": "^6.0.3"
|
|
146
|
+
},
|
|
147
|
+
"engines": {
|
|
148
|
+
"node": ">=18"
|
|
149
|
+
},
|
|
150
|
+
"repository": "github:Borewit/music-metadata",
|
|
151
|
+
"license": "MIT",
|
|
152
|
+
"bugs": {
|
|
153
|
+
"url": "https://github.com/Borewit/music-metadata/issues"
|
|
154
|
+
},
|
|
155
|
+
"packageManager": "yarn@4.9.2"
|
|
156
|
+
}
|
|
@@ -2,12 +2,52 @@ version: 2
|
|
|
2
2
|
updates:
|
|
3
3
|
- package-ecosystem: "github-actions"
|
|
4
4
|
directory: "/"
|
|
5
|
+
commit-message:
|
|
6
|
+
# Prefix all commit messages with "chore: "
|
|
7
|
+
prefix: "chore"
|
|
5
8
|
schedule:
|
|
6
|
-
interval: "
|
|
9
|
+
interval: "weekly"
|
|
10
|
+
cooldown:
|
|
11
|
+
default-days: 7
|
|
12
|
+
allow:
|
|
13
|
+
- dependency-name: "*"
|
|
14
|
+
update-types:
|
|
15
|
+
- "version-update:semver-major"
|
|
7
16
|
open-pull-requests-limit: 10
|
|
8
17
|
|
|
9
18
|
- package-ecosystem: "npm"
|
|
10
19
|
directory: "/"
|
|
20
|
+
commit-message:
|
|
21
|
+
# Prefix all commit messages with "chore: "
|
|
22
|
+
prefix: "chore"
|
|
11
23
|
schedule:
|
|
12
|
-
interval: "
|
|
24
|
+
interval: "weekly"
|
|
25
|
+
cooldown:
|
|
26
|
+
default-days: 7
|
|
27
|
+
versioning-strategy: "increase-if-necessary"
|
|
28
|
+
allow:
|
|
29
|
+
- dependency-name: "*"
|
|
30
|
+
update-types:
|
|
31
|
+
- "version-update:semver-major"
|
|
32
|
+
ignore:
|
|
33
|
+
# TODO: remove ignore until neostandard support ESLint 10
|
|
34
|
+
- dependency-name: "eslint"
|
|
35
|
+
- dependency-name: "neostandard"
|
|
36
|
+
- dependency-name: "@stylistic/*"
|
|
13
37
|
open-pull-requests-limit: 10
|
|
38
|
+
groups:
|
|
39
|
+
# Production dependencies with breaking changes
|
|
40
|
+
dependencies:
|
|
41
|
+
dependency-type: "production"
|
|
42
|
+
# ESLint related dependencies
|
|
43
|
+
dev-dependencies-eslint:
|
|
44
|
+
patterns:
|
|
45
|
+
- "eslint"
|
|
46
|
+
- "neostandard"
|
|
47
|
+
- "@stylistic/*"
|
|
48
|
+
# TypeScript related dependencies
|
|
49
|
+
dev-dependencies-typescript:
|
|
50
|
+
patterns:
|
|
51
|
+
- "@types/*"
|
|
52
|
+
- "tstyche"
|
|
53
|
+
- "typescript"
|
|
@@ -14,9 +14,20 @@ on:
|
|
|
14
14
|
- 'docs/**'
|
|
15
15
|
- '*.md'
|
|
16
16
|
|
|
17
|
+
# This allows a subsequently queued workflow run to interrupt previous runs
|
|
18
|
+
concurrency:
|
|
19
|
+
group: "${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
|
|
20
|
+
cancel-in-progress: true
|
|
21
|
+
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
|
|
17
25
|
jobs:
|
|
18
26
|
test:
|
|
19
|
-
|
|
27
|
+
permissions:
|
|
28
|
+
contents: write
|
|
29
|
+
pull-requests: write
|
|
30
|
+
uses: fastify/workflows/.github/workflows/plugins-ci.yml@2073dc8e1f9e172bf42daa3843c9dbd31af1e8cb # v6.0.0
|
|
20
31
|
with:
|
|
21
32
|
license-check: true
|
|
22
33
|
lint: true
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Lock Threads
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: '0 0 1 * *'
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: lock
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
lock-threads:
|
|
16
|
+
permissions:
|
|
17
|
+
issues: write
|
|
18
|
+
pull-requests: write
|
|
19
|
+
uses: fastify/workflows/.github/workflows/lock-threads.yml@2073dc8e1f9e172bf42daa3843c9dbd31af1e8cb # v6.0.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) Fastify
|
|
3
|
+
Copyright (c) 2020-present The Fastify team <https://github.com/fastify/fastify#team>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/process-warning)
|
|
5
5
|
[](https://github.com/neostandard/neostandard)
|
|
6
6
|
|
|
7
|
-
A small utility for generating consistent warning objects across your codebase.
|
|
7
|
+
A small utility for generating consistent [warning objects](https://nodejs.org/api/process.html#event-warning) across your codebase.
|
|
8
8
|
It also exposes a utility for emitting those warnings, guaranteeing that they are issued only once (unless configured otherwise).
|
|
9
9
|
|
|
10
10
|
_This module is used by the [Fastify](https://fastify.dev) framework and it was called `fastify-warning` prior to version 1.0.0._
|
|
@@ -31,7 +31,7 @@ const warning = createWarning({
|
|
|
31
31
|
message: 'Hello %s',
|
|
32
32
|
unlimited: true
|
|
33
33
|
})
|
|
34
|
-
warning('world')
|
|
34
|
+
const emitted = warning('world')
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
#### Methods
|
|
@@ -101,6 +101,45 @@ FST_ERROR_CODE('world') // will be emitted
|
|
|
101
101
|
FST_ERROR_CODE('world') // will be emitted again
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
#### `spyWarning(warning)`
|
|
105
|
+
|
|
106
|
+
Spy the created warning function for testing purpose.
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
const { test } = require('node:test')
|
|
110
|
+
const { createWarning, spyWarning } = require('process-warning')
|
|
111
|
+
const FST_ERROR_CODE = createWarning({ name: 'MyAppWarning', code: 'FST_ERROR_CODE', message: 'Hello %s' })
|
|
112
|
+
|
|
113
|
+
test('spy warning', t => {
|
|
114
|
+
const spyData = spyWarning(FST_ERROR_CODE)
|
|
115
|
+
|
|
116
|
+
// call after spy
|
|
117
|
+
const emitted = FST_ERROR_CODE('world')
|
|
118
|
+
t.assert.strictEqual(emitted, true)
|
|
119
|
+
|
|
120
|
+
// restore the warning function
|
|
121
|
+
// it must be called when you do not need to spy anymore
|
|
122
|
+
// otherwise, the calls data will accumulates.
|
|
123
|
+
t.after(() => spyData.restore())
|
|
124
|
+
|
|
125
|
+
t.assert.strictEqual(FST_ERROR_CODE.emitted, true)
|
|
126
|
+
// calls return the arguments and result.
|
|
127
|
+
// result indicate whether warning is emitted through process.emitWarning
|
|
128
|
+
console.log(spyData.calls) // [{ arguments: ['world'], result: true }]
|
|
129
|
+
t.assert.deepStrictEqual(spyData.calls[0].arguments, ['world'])
|
|
130
|
+
t.assert.strictEqual(spyData.calls[0].result, true)
|
|
131
|
+
// number of times called the function
|
|
132
|
+
console.log(spyData.callCount()) // 1
|
|
133
|
+
t.assert.strictEqual(spyData.callCount(), 1)
|
|
134
|
+
|
|
135
|
+
// reset the spy stat and warning state
|
|
136
|
+
spyData.reset()
|
|
137
|
+
t.assert.strictEqual(FST_ERROR_CODE.emitted, false)
|
|
138
|
+
t.assert.deepStrictEqual(spyData.calls, [])
|
|
139
|
+
t.assert.strictEqual(spyData.callCount(), 0)
|
|
140
|
+
})
|
|
141
|
+
```
|
|
142
|
+
|
|
104
143
|
#### Suppressing warnings
|
|
105
144
|
|
|
106
145
|
It is possible to suppress warnings by utilizing one of node's built-in warning suppression mechanisms.
|
|
@@ -17,6 +17,7 @@ const { format } = require('node:util')
|
|
|
17
17
|
* @property {string} message - The warning message.
|
|
18
18
|
* @property {boolean} emitted - Indicates if the warning has been emitted.
|
|
19
19
|
* @property {function} format - Formats the warning message.
|
|
20
|
+
* @returns {boolean} emit - Indicates if the warning has been emitted by this call.
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
23
|
/**
|
|
@@ -33,8 +34,69 @@ const { format } = require('node:util')
|
|
|
33
34
|
* @typedef {Object} ProcessWarning
|
|
34
35
|
* @property {function} createWarning - Creates a warning item.
|
|
35
36
|
* @property {function} createDeprecation - Creates a deprecation warning item.
|
|
37
|
+
* @property {function} spyWarning - Spy a warning item.
|
|
36
38
|
*/
|
|
37
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Represents the spy data.
|
|
42
|
+
* @typedef {Object} WarningSpyData
|
|
43
|
+
* @property {object} calls - Arguments of WarningItem calls with.
|
|
44
|
+
* @property {function} callCount - Number of counts called the WarningItem.
|
|
45
|
+
* @property {function} reset - Reset the calls data and state of WarningItem.
|
|
46
|
+
* @property {function} restore - Remove spy from WarningItem.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
const kWarningFn = Symbol('process-warning.fn')
|
|
50
|
+
const kWarningSpyData = Symbol('process-warning.spyData')
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Spy a warning item.
|
|
54
|
+
* @function
|
|
55
|
+
* @memberof processWarning
|
|
56
|
+
* @param {WarningItem} warning - The warning item to spy.
|
|
57
|
+
* @returns {WarningSpyData} The created spy data.
|
|
58
|
+
*/
|
|
59
|
+
function spyWarning (warning) {
|
|
60
|
+
// Do not double spy the same warning
|
|
61
|
+
if (warning[kWarningSpyData] === null) {
|
|
62
|
+
const warningFn = warning[kWarningFn]
|
|
63
|
+
warning[kWarningFn] = function (a, b, c) {
|
|
64
|
+
const args = []
|
|
65
|
+
// since warning always call by fn(a, b, c)
|
|
66
|
+
// it need to remove the trailing undefined arguments
|
|
67
|
+
if (c) {
|
|
68
|
+
args.push(a, b, c)
|
|
69
|
+
} else if (b) {
|
|
70
|
+
args.push(a, b)
|
|
71
|
+
} else if (a) {
|
|
72
|
+
args.push(a)
|
|
73
|
+
}
|
|
74
|
+
warning[kWarningSpyData].calls.push({
|
|
75
|
+
arguments: args,
|
|
76
|
+
result: warningFn(a, b, c)
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
const spyData = {
|
|
80
|
+
calls: [],
|
|
81
|
+
callCount () {
|
|
82
|
+
return spyData.calls.length
|
|
83
|
+
},
|
|
84
|
+
reset () {
|
|
85
|
+
warning.emitted = false
|
|
86
|
+
spyData.calls.length = 0
|
|
87
|
+
},
|
|
88
|
+
restore () {
|
|
89
|
+
spyData.reset()
|
|
90
|
+
warning[kWarningFn] = warningFn
|
|
91
|
+
warning[kWarningSpyData] = null
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
warning[kWarningSpyData] = spyData
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return warning[kWarningSpyData]
|
|
98
|
+
}
|
|
99
|
+
|
|
38
100
|
/**
|
|
39
101
|
* Creates a deprecation warning item.
|
|
40
102
|
* @function
|
|
@@ -62,21 +124,24 @@ function createWarning ({ name, code, message, unlimited = false } = {}) {
|
|
|
62
124
|
|
|
63
125
|
code = code.toUpperCase()
|
|
64
126
|
|
|
65
|
-
|
|
66
|
-
|
|
127
|
+
const warningFn = unlimited === true
|
|
128
|
+
? function (a, b, c) {
|
|
129
|
+
warning.emitted = true
|
|
130
|
+
process.emitWarning(warning.format(a, b, c), warning.name, warning.code)
|
|
131
|
+
return true
|
|
132
|
+
}
|
|
133
|
+
: function (a, b, c) {
|
|
67
134
|
if (warning.emitted === true && warning.unlimited !== true) {
|
|
68
|
-
return
|
|
135
|
+
return false
|
|
69
136
|
}
|
|
70
137
|
warning.emitted = true
|
|
71
138
|
process.emitWarning(warning.format(a, b, c), warning.name, warning.code)
|
|
139
|
+
return true
|
|
72
140
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
[
|
|
77
|
-
warning.emitted = true
|
|
78
|
-
process.emitWarning(warning.format(a, b, c), warning.name, warning.code)
|
|
79
|
-
}
|
|
141
|
+
|
|
142
|
+
const warningContainer = {
|
|
143
|
+
[name]: function (a, b, c) {
|
|
144
|
+
return warning[kWarningFn](a, b, c)
|
|
80
145
|
}
|
|
81
146
|
}
|
|
82
147
|
|
|
@@ -86,14 +151,16 @@ function createWarning ({ name, code, message, unlimited = false } = {}) {
|
|
|
86
151
|
warning.message = message
|
|
87
152
|
warning.unlimited = unlimited
|
|
88
153
|
warning.code = code
|
|
154
|
+
warning[kWarningFn] = warningFn
|
|
155
|
+
warning[kWarningSpyData] = null
|
|
89
156
|
|
|
90
157
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
158
|
+
* Formats the warning message.
|
|
159
|
+
* @param {*} [a] Possible message interpolation value.
|
|
160
|
+
* @param {*} [b] Possible message interpolation value.
|
|
161
|
+
* @param {*} [c] Possible message interpolation value.
|
|
162
|
+
* @returns {string} The formatted warning message.
|
|
163
|
+
*/
|
|
97
164
|
warning.format = function (a, b, c) {
|
|
98
165
|
let formatted
|
|
99
166
|
if (a && b && c) {
|
|
@@ -116,9 +183,10 @@ function createWarning ({ name, code, message, unlimited = false } = {}) {
|
|
|
116
183
|
* @namespace
|
|
117
184
|
* @property {function} createWarning - Creates a warning item.
|
|
118
185
|
* @property {function} createDeprecation - Creates a deprecation warning item.
|
|
186
|
+
* @property {function} spyWarning - Spy a warning item.
|
|
119
187
|
* @property {ProcessWarning} processWarning - Represents the process warning functionality.
|
|
120
188
|
*/
|
|
121
|
-
const out = { createWarning, createDeprecation }
|
|
189
|
+
const out = { createWarning, createDeprecation, spyWarning }
|
|
122
190
|
module.exports = out
|
|
123
191
|
module.exports.default = out
|
|
124
192
|
module.exports.processWarning = out
|