tldts-utils 6.1.81

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.
Files changed (48) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +3 -0
  3. package/bin/update.js +7 -0
  4. package/dist/cjs/index.js +698 -0
  5. package/dist/cjs/index.js.map +1 -0
  6. package/dist/cjs/src/builders/hashes.js +186 -0
  7. package/dist/cjs/src/builders/hashes.js.map +1 -0
  8. package/dist/cjs/src/builders/trie.js +155 -0
  9. package/dist/cjs/src/builders/trie.js.map +1 -0
  10. package/dist/cjs/src/find-base-dir.js +13 -0
  11. package/dist/cjs/src/find-base-dir.js.map +1 -0
  12. package/dist/cjs/src/list.js +11 -0
  13. package/dist/cjs/src/list.js.map +1 -0
  14. package/dist/cjs/src/parser.js +63 -0
  15. package/dist/cjs/src/parser.js.map +1 -0
  16. package/dist/cjs/src/update.js +23 -0
  17. package/dist/cjs/src/update.js.map +1 -0
  18. package/dist/cjs/tsconfig.tsbuildinfo +1 -0
  19. package/dist/es6/index.js +4 -0
  20. package/dist/es6/index.js.map +1 -0
  21. package/dist/es6/src/builders/hashes.js +184 -0
  22. package/dist/es6/src/builders/hashes.js.map +1 -0
  23. package/dist/es6/src/builders/trie.js +153 -0
  24. package/dist/es6/src/builders/trie.js.map +1 -0
  25. package/dist/es6/src/find-base-dir.js +10 -0
  26. package/dist/es6/src/find-base-dir.js.map +1 -0
  27. package/dist/es6/src/list.js +8 -0
  28. package/dist/es6/src/list.js.map +1 -0
  29. package/dist/es6/src/parser.js +61 -0
  30. package/dist/es6/src/parser.js.map +1 -0
  31. package/dist/es6/src/update.js +20 -0
  32. package/dist/es6/src/update.js.map +1 -0
  33. package/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
  34. package/dist/types/index.d.ts +4 -0
  35. package/dist/types/src/builders/hashes.d.ts +90 -0
  36. package/dist/types/src/builders/trie.d.ts +28 -0
  37. package/dist/types/src/find-base-dir.d.ts +1 -0
  38. package/dist/types/src/list.d.ts +1 -0
  39. package/dist/types/src/parser.d.ts +12 -0
  40. package/dist/types/src/update.d.ts +1 -0
  41. package/index.ts +4 -0
  42. package/package.json +56 -0
  43. package/src/builders/hashes.ts +201 -0
  44. package/src/builders/trie.ts +216 -0
  45. package/src/find-base-dir.ts +11 -0
  46. package/src/list.ts +8 -0
  47. package/src/parser.ts +75 -0
  48. package/src/update.ts +36 -0
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../../node_modules/typescript/lib/lib.scripthost.d.ts","../../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../node_modules/typescript/lib/lib.es2017.full.d.ts","../../../../node_modules/tslib/tslib.d.ts","../../src/find-base-dir.ts","../../src/list.ts","../../../../node_modules/@types/punycode/index.d.ts","../../src/parser.ts","../../src/builders/hashes.ts","../../src/builders/trie.ts","../../src/update.ts","../../index.ts","../../../../node_modules/@types/chai/index.d.ts","../../../../node_modules/@types/command-line-args/index.d.ts","../../../../node_modules/@types/command-line-usage/index.d.ts","../../../../node_modules/@types/estree/index.d.ts","../../../../node_modules/@types/minimatch/index.d.ts","../../../../node_modules/@types/minimist/index.d.ts","../../../../node_modules/@types/mocha/index.d.ts","../../../../node_modules/@types/node/compatibility/disposable.d.ts","../../../../node_modules/@types/node/compatibility/indexable.d.ts","../../../../node_modules/@types/node/compatibility/iterators.d.ts","../../../../node_modules/@types/node/compatibility/index.d.ts","../../../../node_modules/@types/node/globals.typedarray.d.ts","../../../../node_modules/@types/node/buffer.buffer.d.ts","../../../../node_modules/buffer/index.d.ts","../../../../node_modules/undici-types/header.d.ts","../../../../node_modules/undici-types/readable.d.ts","../../../../node_modules/undici-types/file.d.ts","../../../../node_modules/undici-types/fetch.d.ts","../../../../node_modules/undici-types/formdata.d.ts","../../../../node_modules/undici-types/connector.d.ts","../../../../node_modules/undici-types/client.d.ts","../../../../node_modules/undici-types/errors.d.ts","../../../../node_modules/undici-types/dispatcher.d.ts","../../../../node_modules/undici-types/global-dispatcher.d.ts","../../../../node_modules/undici-types/global-origin.d.ts","../../../../node_modules/undici-types/pool-stats.d.ts","../../../../node_modules/undici-types/pool.d.ts","../../../../node_modules/undici-types/handlers.d.ts","../../../../node_modules/undici-types/balanced-pool.d.ts","../../../../node_modules/undici-types/agent.d.ts","../../../../node_modules/undici-types/mock-interceptor.d.ts","../../../../node_modules/undici-types/mock-agent.d.ts","../../../../node_modules/undici-types/mock-client.d.ts","../../../../node_modules/undici-types/mock-pool.d.ts","../../../../node_modules/undici-types/mock-errors.d.ts","../../../../node_modules/undici-types/proxy-agent.d.ts","../../../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../../../node_modules/undici-types/retry-handler.d.ts","../../../../node_modules/undici-types/retry-agent.d.ts","../../../../node_modules/undici-types/api.d.ts","../../../../node_modules/undici-types/interceptors.d.ts","../../../../node_modules/undici-types/util.d.ts","../../../../node_modules/undici-types/cookies.d.ts","../../../../node_modules/undici-types/patch.d.ts","../../../../node_modules/undici-types/websocket.d.ts","../../../../node_modules/undici-types/eventsource.d.ts","../../../../node_modules/undici-types/filereader.d.ts","../../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../../node_modules/undici-types/content-type.d.ts","../../../../node_modules/undici-types/cache.d.ts","../../../../node_modules/undici-types/index.d.ts","../../../../node_modules/@types/node/globals.d.ts","../../../../node_modules/@types/node/assert.d.ts","../../../../node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/@types/node/buffer.d.ts","../../../../node_modules/@types/node/child_process.d.ts","../../../../node_modules/@types/node/cluster.d.ts","../../../../node_modules/@types/node/console.d.ts","../../../../node_modules/@types/node/constants.d.ts","../../../../node_modules/@types/node/crypto.d.ts","../../../../node_modules/@types/node/dgram.d.ts","../../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../../node_modules/@types/node/dns.d.ts","../../../../node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/@types/node/domain.d.ts","../../../../node_modules/@types/node/dom-events.d.ts","../../../../node_modules/@types/node/events.d.ts","../../../../node_modules/@types/node/fs.d.ts","../../../../node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/@types/node/http.d.ts","../../../../node_modules/@types/node/http2.d.ts","../../../../node_modules/@types/node/https.d.ts","../../../../node_modules/@types/node/inspector.d.ts","../../../../node_modules/@types/node/module.d.ts","../../../../node_modules/@types/node/net.d.ts","../../../../node_modules/@types/node/os.d.ts","../../../../node_modules/@types/node/path.d.ts","../../../../node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/@types/node/process.d.ts","../../../../node_modules/@types/node/punycode.d.ts","../../../../node_modules/@types/node/querystring.d.ts","../../../../node_modules/@types/node/readline.d.ts","../../../../node_modules/@types/node/readline/promises.d.ts","../../../../node_modules/@types/node/repl.d.ts","../../../../node_modules/@types/node/sea.d.ts","../../../../node_modules/@types/node/sqlite.d.ts","../../../../node_modules/@types/node/stream.d.ts","../../../../node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/@types/node/stream/consumers.d.ts","../../../../node_modules/@types/node/stream/web.d.ts","../../../../node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/@types/node/test.d.ts","../../../../node_modules/@types/node/timers.d.ts","../../../../node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/@types/node/tls.d.ts","../../../../node_modules/@types/node/trace_events.d.ts","../../../../node_modules/@types/node/tty.d.ts","../../../../node_modules/@types/node/url.d.ts","../../../../node_modules/@types/node/util.d.ts","../../../../node_modules/@types/node/v8.d.ts","../../../../node_modules/@types/node/vm.d.ts","../../../../node_modules/@types/node/wasi.d.ts","../../../../node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/@types/node/zlib.d.ts","../../../../node_modules/@types/node/index.d.ts","../../../../node_modules/@types/normalize-package-data/index.d.ts","../../../../node_modules/@types/parse-json/index.d.ts","../../../../node_modules/@types/resolve/index.d.ts"],"fileIdsList":[[72,115],[72,112,115],[72,114,115],[115],[72,115,120,150],[72,115,116,121,127,128,135,147,158],[72,115,116,117,127,135],[67,68,69,72,115],[72,115,118,159],[72,115,119,120,128,136],[72,115,120,147,155],[72,115,121,123,127,135],[72,114,115,122],[72,115,123,124],[72,115,127],[72,115,125,127],[72,114,115,127],[72,115,127,128,129,147,158],[72,115,127,128,129,142,147,150],[72,110,115,163],[72,110,115,123,127,130,135,147,158],[72,115,127,128,130,131,135,147,155,158],[72,115,130,132,147,155,158],[70,71,72,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164],[72,115,127,133],[72,115,134,158],[72,115,123,127,135,147],[72,115,136],[72,115,137],[72,114,115,138],[72,112,113,114,115,116,117,118,119,120,121,122,123,124,125,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164],[72,115,140],[72,115,141],[72,115,127,142,143],[72,115,142,144,159,161],[72,115,127,147,148,149,150],[72,115,147,149],[72,115,147,148],[72,115,150],[72,115,151],[72,112,115,147],[72,115,127,153,154],[72,115,153,154],[72,115,120,135,147,155],[72,115,156],[72,115,135,157],[72,115,130,141,158],[72,115,120,159],[72,115,147,160],[72,115,134,161],[72,115,162],[72,115,120,127,129,138,147,158,161,163],[72,115,147,164],[72,82,86,115,158],[72,82,115,147,158],[72,77,115],[72,79,82,115,155,158],[72,115,135,155],[72,115,165],[72,77,115,165],[72,79,82,115,135,158],[72,74,75,78,81,115,127,147,158],[72,82,89,115],[72,74,80,115],[72,82,103,104,115],[72,78,82,115,150,158,165],[72,103,115,165],[72,76,77,115,165],[72,82,115],[72,76,77,78,79,80,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,104,105,106,107,108,109,115],[72,82,97,115],[72,82,89,90,115],[72,80,82,90,91,115],[72,81,115],[72,74,77,82,115],[72,82,86,90,91,115],[72,86,115],[72,80,82,85,115,158],[72,74,79,82,89,115],[72,115,147],[72,77,82,103,115,163,165],[51,53,55,58,72,115],[51,55,72,115],[51,72,115,128,137],[51,52,72,115,128],[51,54,72,115],[51,52,53,56,57,72,115,128]],"fileInfos":[{"version":"e41c290ef7dd7dab3493e6cbe5909e0148edf4a8dad0271be08edec368a0f7b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"69e65d976bf166ce4a9e6f6c18f94d2424bf116e90837ace179610dbccad9b42","affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"62bb211266ee48b2d0edf0d8d1b191f0c24fc379a82bd4c1692a082c540bc6b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"f1e2a172204962276504466a6393426d2ca9c54894b1ad0a6c9dad867a65f876","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"1d242d5c24cf285c88bc4fb93c5ff903de8319064e282986edeb6247ba028d5e","impliedFormat":1},{"version":"7a1971efcba559ea9002ada4c4e3c925004fb67a755300d53b5edf9399354900","impliedFormat":1},{"version":"9071b1c70de2551dd2b81cc2251b3f49ed86d5bb129f0d0b84439b58ad2a688a","signature":"adcbacfc2a9c347227d7b1957ba3c0171039fee6095083737a5e4cc3e9a34199"},{"version":"790581648acfc0943af12052b9c987a3af0526112d0a2675e167da9e041f122e","signature":"06b8035ef039184c966e0a64604c7be24b65de47a0cd3c68285be69561952264"},{"version":"2ccea88888048bbfcacbc9531a5596ea48a3e7dcd0a25f531a81bb717903ba4f","impliedFormat":1},{"version":"b410611b6049abb2949353f6007b3399f7b0cc68d14362b9f032cbc0dfd9d61b","signature":"1b7d57ba103f07067287fcebb4ed9cb6ef78184a65588383170696ad12fad42f"},{"version":"9ba7ed5c56a912e5452ab38f888b3e583404836ddce3c0a2dd5fb0fb9a9a4931","signature":"b72645937aa6933bd17953a715749da80347698ccc96371bd5de96995bf07b6b"},{"version":"754b8cc29920cddbef51d8794c1012cd0816a841d5aed9d93737f734df623552","signature":"9a7bfc68277a2e971d97771b328988d9eb2fa880ac84a50c46030c3546e5a4dd"},{"version":"85b5746c7ddd5b0bff3a65495f4ab0d4317319bc492577c34a9860bf1b5cfe0b","signature":"87c3b7246e2d3d81d06e2fb172d316c10de70cd9a61d6722023592f16006172a"},"e328b6004fec2205792a6cd31e029ffb3e757a5fbb4bbb86ed4f4c4011c92193",{"version":"eef204f061321360559bd19235ea32a9d55b3ec22a362cc78d14ef50d4db4490","affectsGlobalScope":true,"impliedFormat":1},{"version":"5b7206ca5f2f6eeaac6daa285664f424e0b728f3e31937da89deb8696c5f1dbc","impliedFormat":1},{"version":"53dd92e141efe47b413a058f3fbcc6e40a84f5afdde16f45de550a476da25d98","impliedFormat":1},{"version":"785b9d575b49124ce01b46f5b9402157c7611e6532effa562ac6aebec0074dfc","impliedFormat":1},{"version":"8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","impliedFormat":1},{"version":"fbca5ffaebf282ec3cdac47b0d1d4a138a8b0bb32105251a38acb235087d3318","impliedFormat":1},{"version":"29f72ec1289ae3aeda78bf14b38086d3d803262ac13904b400422941a26a3636","affectsGlobalScope":true,"impliedFormat":1},{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"030e350db2525514580ed054f712ffb22d273e6bc7eddc1bb7eda1e0ba5d395e","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"a79e62f1e20467e11a904399b8b18b18c0c6eea6b50c1168bf215356d5bebfaf","affectsGlobalScope":true,"impliedFormat":1},{"version":"13af9e8fb6757946c48117315866177b95e554d1e773577bb6ca6e40083b6d73","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"24bd580b5743dc56402c440dc7f9a4f5d592ad7a419f25414d37a7bfe11e342b","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"6bdc71028db658243775263e93a7db2fd2abfce3ca569c3cca5aee6ed5eb186d","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"d2bc987ae352271d0d615a420dcf98cc886aa16b87fb2b569358c1fe0ca0773d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4f0539c58717cbc8b73acb29f9e992ab5ff20adba5f9b57130691c7f9b186a4d","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"76103716ba397bbb61f9fa9c9090dca59f39f9047cb1352b2179c5d8e7f4e8d0","impliedFormat":1},{"version":"53eac70430b30089a3a1959d8306b0f9cfaf0de75224b68ef25243e0b5ad1ca3","affectsGlobalScope":true,"impliedFormat":1},{"version":"4314c7a11517e221f7296b46547dbc4df047115b182f544d072bdccffa57fc72","impliedFormat":1},{"version":"115971d64632ea4742b5b115fb64ed04bcaae2c3c342f13d9ba7e3f9ee39c4e7","impliedFormat":1},{"version":"c2510f124c0293ab80b1777c44d80f812b75612f297b9857406468c0f4dafe29","affectsGlobalScope":true,"impliedFormat":1},{"version":"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb","impliedFormat":1},{"version":"86956cc2eb9dd371d6fab493d326a574afedebf76eef3fa7833b8e0d9b52d6f1","affectsGlobalScope":true,"impliedFormat":1},{"version":"19d5f8d3930e9f99aa2c36258bf95abbe5adf7e889e6181872d1cdba7c9a7dd5","impliedFormat":1},{"version":"e6f5a38687bebe43a4cef426b69d34373ef68be9a6b1538ec0a371e69f309354","impliedFormat":1},{"version":"a6bf63d17324010ca1fbf0389cab83f93389bb0b9a01dc8a346d092f65b3605f","impliedFormat":1},{"version":"e009777bef4b023a999b2e5b9a136ff2cde37dc3f77c744a02840f05b18be8ff","impliedFormat":1},{"version":"1e0d1f8b0adfa0b0330e028c7941b5a98c08b600efe7f14d2d2a00854fb2f393","impliedFormat":1},{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true,"impliedFormat":1},{"version":"88bc59b32d0d5b4e5d9632ac38edea23454057e643684c3c0b94511296f2998c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ff5a53a58e756d2661b73ba60ffe274231a4432d21f7a2d0d9e4f6aa99f4283","impliedFormat":1},{"version":"1e289f30a48126935a5d408a91129a13a59c9b0f8c007a816f9f16ef821e144e","impliedFormat":1},{"version":"2ea254f944dfe131df1264d1fb96e4b1f7d110195b21f1f5dbb68fdd394e5518","impliedFormat":1},{"version":"5135bdd72cc05a8192bd2e92f0914d7fc43ee077d1293dc622a049b7035a0afb","impliedFormat":1},{"version":"4f80de3a11c0d2f1329a72e92c7416b2f7eab14f67e92cac63bb4e8d01c6edc8","impliedFormat":1},{"version":"6d386bc0d7f3afa1d401afc3e00ed6b09205a354a9795196caed937494a713e6","impliedFormat":1},{"version":"b11cb909327c874a4e81bfb390bf0d231e5bf9439052689ab80ba8afa50da17b","affectsGlobalScope":true,"impliedFormat":1},{"version":"23459c1915878a7c1e86e8bdb9c187cddd3aea105b8b1dfce512f093c969bc7e","impliedFormat":1},{"version":"b1b6ee0d012aeebe11d776a155d8979730440082797695fc8e2a5c326285678f","impliedFormat":1},{"version":"45875bcae57270aeb3ebc73a5e3fb4c7b9d91d6b045f107c1d8513c28ece71c0","impliedFormat":1},{"version":"1dc73f8854e5c4506131c4d95b3a6c24d0c80336d3758e95110f4c7b5cb16397","affectsGlobalScope":true,"impliedFormat":1},{"version":"5f6f1d54779d0b9ed152b0516b0958cd34889764c1190434bbf18e7a8bb884cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f16a7e4deafa527ed9995a772bb380eb7d3c2c0fd4ae178c5263ed18394db2c","impliedFormat":1},{"version":"c6b4e0a02545304935ecbf7de7a8e056a31bb50939b5b321c9d50a405b5a0bba","impliedFormat":1},{"version":"fab29e6d649aa074a6b91e3bdf2bff484934a46067f6ee97a30fcd9762ae2213","impliedFormat":1},{"version":"8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","impliedFormat":1},{"version":"e1120271ebbc9952fdc7b2dd3e145560e52e06956345e6fdf91d70ca4886464f","impliedFormat":1},{"version":"814118df420c4e38fe5ae1b9a3bafb6e9c2aa40838e528cde908381867be6466","impliedFormat":1},{"version":"f7b1df115dbd1b8522cba4f404a9f4fdcd5169e2137129187ffeee9d287e4fd1","impliedFormat":1},{"version":"b52d379b4939681f3781d1cfd5b2c3cbb35e7e76f2425172e165782f8a08228c","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","impliedFormat":1},{"version":"745c4240220559bd340c8aeb6e3c5270a709d3565e934dc22a69c304703956bc","affectsGlobalScope":true,"impliedFormat":1},{"version":"2754d8221d77c7b382096651925eb476f1066b3348da4b73fe71ced7801edada","impliedFormat":1},{"version":"993985beef40c7d113f6dd8f0ba26eed63028b691fbfeb6a5b63f26408dd2c6d","affectsGlobalScope":true,"impliedFormat":1},{"version":"bef91efa0baea5d0e0f0f27b574a8bc100ce62a6d7e70220a0d58af6acab5e89","affectsGlobalScope":true,"impliedFormat":1},{"version":"282fd2a1268a25345b830497b4b7bf5037a5e04f6a9c44c840cb605e19fea841","impliedFormat":1},{"version":"5360a27d3ebca11b224d7d3e38e3e2c63f8290cb1fcf6c3610401898f8e68bc3","impliedFormat":1},{"version":"66ba1b2c3e3a3644a1011cd530fb444a96b1b2dfe2f5e837a002d41a1a799e60","impliedFormat":1},{"version":"7e514f5b852fdbc166b539fdd1f4e9114f29911592a5eb10a94bb3a13ccac3c4","impliedFormat":1},{"version":"7d6ff413e198d25639f9f01f16673e7df4e4bd2875a42455afd4ecc02ef156da","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb094bb347d7df3380299eb69836c2c8758626ecf45917577707c03cf816b6f4","affectsGlobalScope":true,"impliedFormat":1},{"version":"f689c4237b70ae6be5f0e4180e8833f34ace40529d1acc0676ab8fb8f70457d7","impliedFormat":1},{"version":"b02784111b3fc9c38590cd4339ff8718f9329a6f4d3fd66e9744a1dcd1d7e191","impliedFormat":1},{"version":"ac5ed35e649cdd8143131964336ab9076937fa91802ec760b3ea63b59175c10a","impliedFormat":1},{"version":"52a8e7e8a1454b6d1b5ad428efae3870ffc56f2c02d923467f2940c454aa9aec","affectsGlobalScope":true,"impliedFormat":1},{"version":"78dc0513cc4f1642906b74dda42146bcbd9df7401717d6e89ea6d72d12ecb539","impliedFormat":1},{"version":"ad90122e1cb599b3bc06a11710eb5489101be678f2920f2322b0ac3e195af78d","impliedFormat":1},{"version":"22293bd6fa12747929f8dfca3ec1684a3fe08638aa18023dd286ab337e88a592","impliedFormat":1},{"version":"916be7d770b0ae0406be9486ac12eb9825f21514961dd050594c4b250617d5a8","impliedFormat":1},{"version":"8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","impliedFormat":1}],"root":[52,53,[55,59]],"options":{"composite":true,"declaration":true,"declarationDir":"../types","emitDeclarationOnly":false,"importHelpers":true,"module":99,"noEmitHelpers":true,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","skipLibCheck":true,"sourceMap":true,"strict":true,"target":4},"referencedMap":[[60,1],[61,1],[62,1],[63,1],[64,1],[65,1],[66,1],[112,2],[113,2],[114,3],[72,4],[115,5],[116,6],[117,7],[67,1],[70,8],[68,1],[69,1],[118,9],[119,10],[120,11],[121,12],[122,13],[123,14],[124,14],[126,15],[125,16],[127,17],[128,18],[129,19],[111,20],[71,1],[130,21],[131,22],[132,23],[165,24],[133,25],[134,26],[135,27],[136,28],[137,29],[138,30],[139,31],[140,32],[141,33],[142,34],[143,34],[144,35],[145,1],[146,1],[147,36],[149,37],[148,38],[150,39],[151,40],[152,41],[153,42],[154,43],[155,44],[156,45],[157,46],[158,47],[159,48],[160,49],[161,50],[162,51],[163,52],[164,53],[166,1],[167,1],[54,1],[168,1],[73,1],[51,1],[48,1],[49,1],[8,1],[9,1],[13,1],[12,1],[2,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[3,1],[22,1],[23,1],[4,1],[24,1],[50,1],[28,1],[25,1],[26,1],[27,1],[29,1],[30,1],[31,1],[5,1],[32,1],[33,1],[34,1],[35,1],[6,1],[39,1],[36,1],[37,1],[38,1],[40,1],[7,1],[41,1],[46,1],[47,1],[42,1],[43,1],[44,1],[45,1],[1,1],[11,1],[10,1],[89,54],[99,55],[88,54],[109,56],[80,57],[79,58],[108,59],[102,60],[107,61],[82,62],[96,63],[81,64],[105,65],[77,66],[76,59],[106,67],[78,68],[83,69],[84,1],[87,69],[74,1],[110,70],[100,71],[91,72],[92,73],[94,74],[90,75],[93,76],[103,59],[85,77],[86,78],[95,79],[75,80],[98,71],[97,69],[101,1],[104,81],[59,82],[56,83],[57,83],[52,84],[53,85],[55,86],[58,87]],"latestChangedDtsFile":"../types/index.d.ts","version":"5.7.3"}
@@ -0,0 +1,4 @@
1
+ export { default as parsePublicSuffixRules } from './src/parser';
2
+ export { default as loadPublicSuffixList } from './src/list';
3
+ export { default as updateInternalDataStructures } from './src/update';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * This builder implements a probabilistic data-structure to store the public
3
+ * suffixes from Mozilla's 'publicsuffix' project. The goals are:
4
+ *
5
+ * 1. Allow storing the parsed rules in a very compact form (<30KB)
6
+ * 2. Allow super fast load time with no parsing required (typed array)
7
+ * 2. Super fast lookup times (~2M+ per second)
8
+ *
9
+ * These are achieved by hashing each available suffix as a 32bits number and
10
+ * storing them in a typed array which is bundled in the library itself. This
11
+ * way the only cost of loading the rules is paid by the JavaScript engine
12
+ * loading the source and the size of the rules is ~29KB. Matching is also
13
+ * extremely fast, at around 2M+ lookups per second.
14
+ *
15
+ * **WARNING**: The drawback of this structure is that, because we use hashes of
16
+ * suffixes instead of their initial values, there can be collisions (think
17
+ * bloom filters). Some future work involves estimating the probability of
18
+ * collisions. Only use this structure if you are fine with this limitation and
19
+ * need the most compact/fast data structure available.
20
+ *
21
+ * Data Structure
22
+ * ==============
23
+ *
24
+ * The basic idea behind the packed hashes structure is that suffixes will be
25
+ * grouped by number of labels then hashed to 32bits integers using a fast
26
+ * hashing function. For examples:
27
+ *
28
+ * 1 label:
29
+ * com -> hash(com)
30
+ * fr -> hash(fr)
31
+ * gov -> hash(gov)
32
+ * 2 labels:
33
+ * co.uk -> hash(co.uk)
34
+ *
35
+ * Then the hashes are organized in a typed array from least number of labels to
36
+ * most number of labels, and in each section, hashes are sorted so that we can
37
+ * perform lookups using a binary search:
38
+ *
39
+ * |#1 length|suffix 1|suffix 2|...|#2 length|suffix 1|suffix 2|...|...
40
+ * ^ ^ number of suffixes with 2 labels
41
+ * | number of suffix with 1 label
42
+ *
43
+ * In the example above:
44
+ *
45
+ * 3|hash(com)|hash(fr)|hash(gov)|1|hash(co.uk)
46
+ * ^ ^ we have on suffix with 2 labels (co.uk)
47
+ * | we have 3 suffixes with one label
48
+ *
49
+ * In practice, the data-structure is slightly more complex as we have to handle
50
+ * the ICANN and PRIVATE sections of the list separately (which allows to pick
51
+ * one or the other at runtime; or both, which is the default) as well as
52
+ * wildcards and exceptions rules. The structure looks more like:
53
+ *
54
+ * |icann exceptions|private exceptions|icann wildcards|private wildcards|icann rules|private rules
55
+ *
56
+ * Still ordered from least number of labels to most number of labels. This
57
+ * allows the matching to be a forward progression from beginning to end,
58
+ * potentially skipping some sections (e.g.: private) by just incrementing the
59
+ * index.
60
+ *
61
+ * Finding a Match
62
+ * ===============
63
+ *
64
+ * Finding a match can be done efficiently, without any string copy and by a
65
+ * single pass over the input (from end to beginning). The algorithm is as
66
+ * follows:
67
+ *
68
+ * - For each character `c` in hostname, from end to start:
69
+ * 1. If `c` is '.' then we reached the end of a label:
70
+ * * Use a binary search in the section containing suffixes of the same
71
+ * size as our current label to check if our hash is there.
72
+ * * Move forward to the next section by incrementing the index by the
73
+ * number of suffixes in this section.
74
+ * 2. Update the hash with the current character
75
+ *
76
+ * This does not account for wildcards and exceptions, but explains the general
77
+ * idea of the matching algorithm. Have a look at the source bellow for more
78
+ * details.
79
+ *
80
+ * Some nice properties of this algorithm:
81
+ * 1. Pretty straight-forward implementation
82
+ * 2. Matching is always going forward in the array
83
+ * 3. Sections can be skipped by just incrementing the index
84
+ * 4. Hash can be computed on-the-fly from end to start without any string copy
85
+ */
86
+ import parse from '../parser';
87
+ /**
88
+ * Compute 32 bits hash of `str` backward.
89
+ */
90
+ function fastHash(str) {
91
+ let hash = 5381;
92
+ for (let j = str.length - 1; j >= 0; j -= 1) {
93
+ hash = (hash * 33) ^ str.charCodeAt(j);
94
+ }
95
+ return hash >>> 0;
96
+ }
97
+ /**
98
+ * Build packed typed array given the raw public list as a string.
99
+ */
100
+ export default (body) => {
101
+ const rules = {
102
+ icann: [],
103
+ priv: [],
104
+ };
105
+ const wildcards = {
106
+ icann: [],
107
+ priv: [],
108
+ };
109
+ const exceptions = {
110
+ icann: [],
111
+ priv: [],
112
+ };
113
+ // Keep track of maximum number of labels seen in a given rule. This allows us
114
+ // to make sure that all sections of the typed array (wildcards, exceptions
115
+ // and normal rules) have the same size and we do not need to check that while
116
+ // matching.
117
+ let maximumNumberOfLabels = 0;
118
+ // Iterate on public suffix rules
119
+ parse(body, ({ rule, isIcann, isException, isWildcard, isNormal }) => {
120
+ // Select correct section to insert the rule
121
+ let hashesPerLabels = null;
122
+ if (isException) {
123
+ hashesPerLabels = isIcann ? exceptions.icann : exceptions.priv;
124
+ }
125
+ else if (isWildcard) {
126
+ hashesPerLabels = isIcann ? wildcards.icann : wildcards.priv;
127
+ // eslint-disable-next-line no-param-reassign
128
+ rule = rule.slice(2);
129
+ }
130
+ else if (isNormal) {
131
+ hashesPerLabels = isIcann ? rules.icann : rules.priv;
132
+ }
133
+ if (hashesPerLabels === null) {
134
+ return;
135
+ }
136
+ // Count number of labels in this suffix
137
+ const numberOfLabels = rule.split('.').length;
138
+ // Experimentally, we start ignoring suffixes with only one label since the
139
+ // fallback to '*' will yield the same result. This helps reduce the size of
140
+ // the bundle further and speed-up matching. One potential side-effect is
141
+ // that we might not accurately return the information about if a suffix is
142
+ // from the ICANN or PRIVATE section.
143
+ if (numberOfLabels === 1 &&
144
+ (hashesPerLabels === rules.icann || hashesPerLabels === rules.priv)) {
145
+ return;
146
+ }
147
+ maximumNumberOfLabels = Math.max(maximumNumberOfLabels, numberOfLabels);
148
+ let hashesForLabel = hashesPerLabels[numberOfLabels];
149
+ if (hashesForLabel === undefined) {
150
+ hashesForLabel = [];
151
+ hashesPerLabels[numberOfLabels] = hashesForLabel;
152
+ }
153
+ hashesForLabel.push(fastHash(rule));
154
+ });
155
+ // Pack everything together
156
+ const chunks = [];
157
+ const pushHashes = (hashes = []) => {
158
+ chunks.push([
159
+ hashes.length,
160
+ ...hashes.sort((a, b) => {
161
+ if (a < b) {
162
+ return -1;
163
+ }
164
+ if (a > b) {
165
+ return 1;
166
+ }
167
+ return 0;
168
+ }),
169
+ ]);
170
+ };
171
+ for (let label = 1; label <= maximumNumberOfLabels; label += 1) {
172
+ pushHashes(exceptions.icann[label]);
173
+ pushHashes(exceptions.priv[label]);
174
+ pushHashes(wildcards.icann[label]);
175
+ pushHashes(wildcards.priv[label]);
176
+ pushHashes(rules.icann[label]);
177
+ pushHashes(rules.priv[label]);
178
+ }
179
+ return new Uint32Array([
180
+ maximumNumberOfLabels,
181
+ ...[].concat(...chunks),
182
+ ]);
183
+ };
184
+ //# sourceMappingURL=hashes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../../../src/builders/hashes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAEH,OAAO,KAAK,MAAM,WAAW,CAAC;AAE9B;;GAEG;AACH,SAAS,QAAQ,CAAC,GAAW;IAC3B,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,CAAC;AACpB,CAAC;AAOD;;GAEG;AACH,eAAe,CAAC,IAAY,EAAE,EAAE;IAC9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CAAC;QACnC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAClC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/B,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,IAAI,WAAW,CAAC;QACrB,qBAAqB;QACrB,GAAI,EAAe,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;KACtC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * This builder implements a fast and compact DAWG data-structure (a.k.a.:
3
+ * direct acyclic word graph, with suffix and prefix compression of the
4
+ * top-level domains) using JavaScript Objects. It is a good trade-off between
5
+ * correctness, speed and space. This is much faster then using a linear scan
6
+ * over all the rules, but slightly slower than the probabilistic
7
+ * data-structure implemented in `bin/builders/hashes.js`.
8
+ *
9
+ * Here is a simple example:
10
+ *
11
+ * co.uk
12
+ * gov.uk
13
+ * fr
14
+ *
15
+ * <root>
16
+ * |_ uk
17
+ * |_ co *
18
+ * |_ gov *
19
+ * |_ fr *
20
+ *
21
+ * Finding a match is then a matter of iterating on labels of a hostname
22
+ * backward and following the branches of the Trie. Whenever we find a terminal
23
+ * node (indicated with a '*' above), we consider this a match.
24
+ */
25
+ import parse from '../parser';
26
+ function convertToCompactTrie(trie) {
27
+ return [
28
+ trie.$,
29
+ Object.fromEntries(Object.entries(trie.succ).map(([label, succ]) => [
30
+ label,
31
+ typeof succ === 'string' ? succ : convertToCompactTrie(succ),
32
+ ])),
33
+ ];
34
+ }
35
+ /**
36
+ * Insert a public suffix rule in the `trie`.
37
+ */
38
+ function insertInTrie({ parts, isIcann, }, trie) {
39
+ let node = trie;
40
+ for (const part of parts) {
41
+ let nextNode = node.succ[part];
42
+ if (nextNode === undefined) {
43
+ nextNode = { $: 0, succ: {} };
44
+ node.succ[part] = nextNode;
45
+ }
46
+ node = nextNode;
47
+ }
48
+ node.$ = isIcann ? 1 : 2;
49
+ return trie;
50
+ }
51
+ let nextId = 0;
52
+ /**
53
+ * Compress the given `trie` into a DAWG (by compressing common suffixes as
54
+ * well as prefixes). This form is very efficient but cannot be dumped as a
55
+ * simple JSON into the file. The solution is to create intermediary variables
56
+ * for each shared sub-tree, which are then used in the main DAWG.
57
+ */
58
+ function compressToDAWG(trie, name) {
59
+ const nodesByHash = new Map();
60
+ const replaceNodes = new Map();
61
+ (function groupNodesByHash(node) {
62
+ // Get a sorted list of next labels from this node
63
+ const nexts = Object.entries(node.succ)
64
+ .filter(([n]) => n !== '$')
65
+ .sort();
66
+ // Create a setter which can be used later to replace the value of a node.
67
+ // Each node is associated with a lambda function accepting one argument:
68
+ // the new value of the node. Because the context of the node (parent and
69
+ // label) is captured in the closure, it allows to just call it later, in a
70
+ // different context, to change the value of a given node in-place.
71
+ nexts.forEach(([n, succ]) => {
72
+ replaceNodes.set(succ, (newNode) => {
73
+ node.succ[n] = newNode;
74
+ });
75
+ });
76
+ // Compute a unique hash for this node recursively.
77
+ const hash = `(${node.$},${[
78
+ ...nexts.map(([c, succ]) => `${c},${groupNodesByHash(succ)}`),
79
+ ].join('|')})`;
80
+ // Keep track of all node's hashes
81
+ let nodes = nodesByHash.get(hash);
82
+ if (nodes === undefined) {
83
+ nodes = [];
84
+ nodesByHash.set(hash, nodes);
85
+ }
86
+ nodes.push(node);
87
+ return hash;
88
+ })(trie);
89
+ // Given `nodesByHash`, which associates a list of nodes to each hash
90
+ // encountered in the previous step, we will detect all the sub-trees being
91
+ // seen more than once and store them in a variable to allow sharing with
92
+ // different parts in the DAWG.
93
+ const variables = [];
94
+ nodesByHash.forEach((nodes) => {
95
+ if (nodes.length > 1) {
96
+ // Dump one of the nodes (they are all the same so it does not matter which one)
97
+ variables.push(`_${nextId}: ITrie = ${JSON.stringify(convertToCompactTrie(nodes[0]))}`);
98
+ // Replace all the other ones by the name of this new variable
99
+ nodes.forEach((node) => {
100
+ var _a;
101
+ // @ts-expect-error
102
+ (_a = replaceNodes.get(node)) === null || _a === void 0 ? void 0 : _a(`_${nextId}`);
103
+ });
104
+ nextId += 1;
105
+ }
106
+ });
107
+ const output = [];
108
+ // Create TypeScript source code to declare all of these variables. Because
109
+ // the value of nodes has been set to a value of the form '"_id"', we need to
110
+ // replace this on the fly to '_id'. We use a RegExp for this.
111
+ if (variables.length !== 0) {
112
+ let variablesSourceCode = `const ${variables.join(',')};`;
113
+ for (let i = 0; i < nextId; i += 1) {
114
+ variablesSourceCode = variablesSourceCode.replace(new RegExp(`"_${i}"`, 'g'), `_${i}`);
115
+ }
116
+ output.push(variablesSourceCode);
117
+ }
118
+ // Dump the root of the DAWG as well, and perform the same replacement of _id
119
+ // parts than for the variables above.
120
+ let serializedTrie = JSON.stringify(convertToCompactTrie(trie));
121
+ for (let i = 0; i < nextId; i += 1) {
122
+ serializedTrie = serializedTrie.replace(new RegExp(`"_${i}"`, 'g'), `_${i}`);
123
+ }
124
+ output.push(`const ${name}: ITrie = ${serializedTrie};`);
125
+ return output.join('\n');
126
+ }
127
+ function convertToTypeScriptSource(rules, exceptions, { includePrivate }) {
128
+ return `
129
+ export type ITrie = [${includePrivate ? '0 | 1 | 2' : '0 | 1'}, { [label: string]: ITrie}];
130
+
131
+ export const exceptions: ITrie = (function() {
132
+ ${compressToDAWG(exceptions, 'exceptions')}
133
+ return exceptions;
134
+ })();
135
+
136
+ export const rules: ITrie = (function() {
137
+ ${compressToDAWG(rules, 'rules')}
138
+ return rules;
139
+ })();
140
+ `;
141
+ }
142
+ export default (body, { includePrivate }) => {
143
+ const exceptions = { $: 0, succ: {} };
144
+ const rules = { $: 0, succ: {} };
145
+ // Iterate on public suffix rules
146
+ parse(body, ({ rule, isIcann, isException }) => {
147
+ if (isIcann || includePrivate) {
148
+ insertInTrie({ isIcann, parts: rule.split('.').reverse() }, isException ? exceptions : rules);
149
+ }
150
+ });
151
+ return convertToTypeScriptSource(rules, exceptions, { includePrivate });
152
+ };
153
+ //# sourceMappingURL=trie.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trie.js","sourceRoot":"","sources":["../../../../src/builders/trie.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,MAAM,WAAW,CAAC;AAS9B,SAAS,oBAAoB,CAAC,IAAW;IACvC,OAAO;QACL,IAAI,CAAC,CAAC;QACN,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;YAC/C,KAAK;YACL,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC;SAC7D,CAAC,CACH;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CACnB,EACE,KAAK,EACL,OAAO,GAIR,EACD,IAAW;IAEX,IAAI,IAAI,GAAU,IAAI,CAAC;IAEvB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;QAC7B,CAAC;QAED,IAAI,GAAG,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzB,OAAO,IAAI,CAAC;AACd,CAAC;AAED,I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CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,EAC7C,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CACjC,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,yBAAyB,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { existsSync } from 'fs';
2
+ import { resolve } from 'path';
3
+ export default function (target) {
4
+ let baseDir = __dirname;
5
+ while (!existsSync(resolve(baseDir, target))) {
6
+ baseDir = resolve(baseDir, '../');
7
+ }
8
+ return resolve(baseDir, target);
9
+ }
10
+ //# sourceMappingURL=find-base-dir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-base-dir.js","sourceRoot":"","sources":["../../../src/find-base-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,CAAC,OAAO,WAAW,MAAc;IACrC,IAAI,OAAO,GAAG,SAAS,CAAC;IACxB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;QAC7C,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import findBaseDir from './find-base-dir';
2
+ import { readFileSync } from 'fs';
3
+ export default function () {
4
+ return readFileSync(findBaseDir('./publicsuffix/public_suffix_list.dat'), {
5
+ encoding: 'utf-8',
6
+ });
7
+ }
8
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/list.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAElC,MAAM,CAAC,OAAO;IACZ,OAAO,YAAY,CAAC,WAAW,CAAC,uCAAuC,CAAC,EAAE;QACxE,QAAQ,EAAE,OAAO;KAClB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { toASCII } from 'punycode/';
2
+ /**
3
+ * Parse public suffix list and invoke callback on each rule.
4
+ */
5
+ export default (body, cb) => {
6
+ const beginPrivateDomains = '// ===begin private domains===';
7
+ let isIcann = true;
8
+ // Iterate on lines and extract public suffix rules
9
+ const lines = body.split('\n');
10
+ for (let line of lines) {
11
+ line = line.trim().toLowerCase();
12
+ // Ignore comments
13
+ if (line.length === 0 || line.startsWith('//')) {
14
+ if (line.startsWith(beginPrivateDomains)) {
15
+ isIcann = false;
16
+ }
17
+ continue;
18
+ }
19
+ let isException = false;
20
+ let isWildcard = false;
21
+ let isNormal = false;
22
+ // Select correct section to insert the rule
23
+ if (line.startsWith('!')) {
24
+ isException = true;
25
+ line = line.slice(1);
26
+ }
27
+ else if (line.startsWith('*.')) {
28
+ isWildcard = true;
29
+ }
30
+ else {
31
+ isNormal = true;
32
+ }
33
+ // Specification says that we should only consider the content of a line up
34
+ // to the first whitespace encountered.
35
+ const spaceIndex = line.indexOf(' ');
36
+ if (spaceIndex !== -1) {
37
+ line = line.substr(0, spaceIndex);
38
+ }
39
+ // If suffix is not ascii, we index the suffix twice so that we support IDNA
40
+ // labels as well. This allows to not have to perform the conversion at
41
+ // runtime.
42
+ const encoded = toASCII(line);
43
+ if (line !== encoded) {
44
+ cb({
45
+ isException,
46
+ isIcann,
47
+ isNormal,
48
+ isWildcard,
49
+ rule: encoded,
50
+ });
51
+ }
52
+ cb({
53
+ isException,
54
+ isIcann,
55
+ isNormal,
56
+ isWildcard,
57
+ rule: line,
58
+ });
59
+ }
60
+ };
61
+ //# sourceMappingURL=parser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C,GAAG,CAAC,CAAC;QACrC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;YACtB,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QACpC,CAAC;QAED,4EAA4E;QAC5E,uEAAuE;QACvE,WAAW;QACX,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACrB,EAAE,CAAC;gBACD,WAAW;gBACX,OAAO;gBACP,QAAQ;gBACR,UAAU;gBACV,IAAI,EAAE,OAAO;aACd,CAAC,CAAC;QACL,CAAC;QAED,EAAE,CAAC;YACD,WAAW;YACX,OAAO;YACP,QAAQ;YACR,UAAU;YACV,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { writeFileSync } from 'fs';
2
+ import findBaseDir from './find-base-dir';
3
+ import loadPublicSuffixList from './list';
4
+ import buildHashes from './builders/hashes';
5
+ import buildTrie from './builders/trie';
6
+ export default function () {
7
+ console.log('Updating rules...');
8
+ const publicSuffixList = loadPublicSuffixList();
9
+ // Build trie and update TypeScript file
10
+ writeFileSync(findBaseDir('./tldts/src/data/trie.ts'), buildTrie(publicSuffixList, { includePrivate: true }), 'utf-8');
11
+ // Build trie and update TypeScript file (ICANN only)
12
+ writeFileSync(findBaseDir('./tldts-icann/src/data/trie.ts'), buildTrie(publicSuffixList, { includePrivate: false }), 'utf-8');
13
+ // Build hashes and update TypeScript file
14
+ const packed = buildHashes(publicSuffixList);
15
+ writeFileSync(findBaseDir('./tldts-experimental/src/data/hashes.ts'), `
16
+ // Code automatically generated using ./bin/builders/hashes.ts
17
+ export default new Uint32Array([${Array.from(packed).toString()}]);
18
+ `, 'utf-8');
19
+ }
20
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAEnC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,oBAAoB,MAAM,QAAQ,CAAC;AAC1C,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,MAAM,CAAC,OAAO;IACZ,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,MAAM,gBAAgB,GAAG,oBAAoB,EAAE,CAAC;IAEhD,wCAAwC;IACxC,aAAa,CACX,WAAW,CAAC,0BAA0B,CAAC,EACvC,SAAS,CAAC,gBAAgB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,EACrD,OAAO,CACR,CAAC;IAEF,qDAAqD;IACrD,aAAa,CACX,WAAW,CAAC,gCAAgC,CAAC,EAC7C,SAAS,CAAC,gBAAgB,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,EACtD,OAAO,CACR,CAAC;IAEF,0CAA0C;IAC1C,MAAM,MAAM,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC7C,aAAa,CACX,WAAW,CAAC,yCAAyC,CAAC,EACtD;;kCAE8B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;CAC9D,EACG,OAAO,CACR,CAAC;AACJ,CAAC"}