@scrabble-solver/scrabble-solver 2.12.5 → 2.13.1

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 (50) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +4 -4
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/eslint/.cache_8dgz12 +1 -1
  5. package/.next/cache/next-server.js.nft.json +1 -1
  6. package/.next/cache/webpack/client-production/0.pack +0 -0
  7. package/.next/cache/webpack/client-production/index.pack +0 -0
  8. package/.next/cache/webpack/edge-server-production/0.pack +0 -0
  9. package/.next/cache/webpack/edge-server-production/index.pack +0 -0
  10. package/.next/cache/webpack/server-production/0.pack +0 -0
  11. package/.next/cache/webpack/server-production/index.pack +0 -0
  12. package/.next/next-server.js.nft.json +1 -1
  13. package/.next/prerender-manifest.json +1 -1
  14. package/.next/routes-manifest.json +1 -1
  15. package/.next/server/chunks/277.js +129 -39
  16. package/.next/server/chunks/44.js +75 -31
  17. package/.next/server/chunks/865.js +16 -4
  18. package/.next/server/chunks/{131.js → 907.js} +924 -2
  19. package/.next/server/chunks/911.js +48 -1
  20. package/.next/server/middleware-build-manifest.js +1 -1
  21. package/.next/server/pages/404.html +1 -1
  22. package/.next/server/pages/404.js.nft.json +1 -1
  23. package/.next/server/pages/500.html +1 -1
  24. package/.next/server/pages/_app.js.nft.json +1 -1
  25. package/.next/server/pages/_document.js.nft.json +1 -1
  26. package/.next/server/pages/api/dictionary/[locale]/[word].js +49 -2
  27. package/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
  28. package/.next/server/pages/api/dictionary/[locale].js +1 -1
  29. package/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
  30. package/.next/server/pages/api/solve.js +9 -5
  31. package/.next/server/pages/api/solve.js.nft.json +1 -1
  32. package/.next/server/pages/api/verify.js +1 -1
  33. package/.next/server/pages/api/verify.js.nft.json +1 -1
  34. package/.next/server/pages/index.html +1 -1
  35. package/.next/server/pages/index.js +9 -9
  36. package/.next/server/pages/index.js.nft.json +1 -1
  37. package/.next/server/pages/index.json +1 -1
  38. package/.next/static/{aKRf05U1XHnDU2-82b9mQ → RJ5_dKU0dHcryeTVO6SSX}/_buildManifest.js +1 -1
  39. package/.next/static/chunks/pages/_app-b92880dde164b954.js +32 -0
  40. package/.next/static/chunks/pages/{index-82b2939158c7729f.js → index-f56eaa969a831c70.js} +1 -1
  41. package/.next/trace +51 -51
  42. package/package.json +9 -9
  43. package/src/i18n/constants.ts +12 -1
  44. package/src/i18n/i18n.ts +2 -0
  45. package/src/i18n/ro.json +70 -0
  46. package/src/icons/FlagRo.svg +5 -0
  47. package/src/icons/index.ts +1 -0
  48. package/src/lib/detectLocale.ts +10 -4
  49. package/.next/static/chunks/pages/_app-e7f3d1c9c09c8f91.js +0 -32
  50. /package/.next/static/{aKRf05U1XHnDU2-82b9mQ → RJ5_dKU0dHcryeTVO6SSX}/_ssgManifest.js +0 -0
@@ -921,6 +921,7 @@ var Locale;
921
921
  Locale["FA_IR"] = "fa-IR";
922
922
  Locale["FR_FR"] = "fr-FR";
923
923
  Locale["PL_PL"] = "pl-PL";
924
+ Locale["RO_RO"] = "ro-RO";
924
925
  })(Locale || (Locale = {}));
925
926
  const locales = Object.values(Locale);
926
927
  const isLocale = (locale) => locales.includes(locale);
@@ -1367,20 +1368,24 @@ exports["default"] = getEnUsWordList;
1367
1368
  /***/ }),
1368
1369
 
1369
1370
  /***/ 87537:
1370
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1371
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1371
1372
 
1372
1373
 
1374
+ var __importDefault = (this && this.__importDefault) || function (mod) {
1375
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1376
+ };
1373
1377
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1374
1378
  const types_1 = __webpack_require__(46452);
1379
+ const latinize_1 = __importDefault(__webpack_require__(66761));
1375
1380
  const lib_1 = __webpack_require__(60337);
1376
- const FILE_URL = 'https://raw.githubusercontent.com/kamilmielnik/fise-2/master/fise-2.txt';
1381
+ const FILE_URL = 'https://raw.githubusercontent.com/kamilmielnik/scrabble-dictionaries/master/spanish/fise-2.txt';
1382
+ const N_PLACEHOLDER = '---n---';
1377
1383
  const getEsEsWordList = async () => {
1378
1384
  const words = await (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.ES_ES);
1379
- return words.map(normalizeWord);
1380
- };
1381
- const normalizeWord = (word) => {
1382
- // normalization from https://stackoverflow.com/a/37511463
1383
- return word.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
1385
+ return words
1386
+ .map((word) => word.replaceAll('ñ', N_PLACEHOLDER))
1387
+ .map(latinize_1.default)
1388
+ .map((word) => word.replaceAll(N_PLACEHOLDER, 'ñ'));
1384
1389
  };
1385
1390
  exports["default"] = getEsEsWordList;
1386
1391
 
@@ -1404,20 +1409,20 @@ exports["default"] = getFaIrWordList;
1404
1409
  /***/ }),
1405
1410
 
1406
1411
  /***/ 27098:
1407
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1412
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1408
1413
 
1409
1414
 
1415
+ var __importDefault = (this && this.__importDefault) || function (mod) {
1416
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1417
+ };
1410
1418
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1411
1419
  const types_1 = __webpack_require__(46452);
1420
+ const latinize_1 = __importDefault(__webpack_require__(66761));
1412
1421
  const lib_1 = __webpack_require__(60337);
1413
1422
  const FILE_URL = 'https://raw.githubusercontent.com/Thecoolsim/French-Scrabble-ODS8/main/French%20ODS%20dictionary.txt';
1414
1423
  const getFrFrWordList = async () => {
1415
1424
  const words = await (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.FR_FR);
1416
- return words.map(normalizeWord);
1417
- };
1418
- const normalizeWord = (word) => {
1419
- // normalization from https://stackoverflow.com/a/37511463
1420
- return word.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
1425
+ return words.map(latinize_1.default);
1421
1426
  };
1422
1427
  exports["default"] = getFrFrWordList;
1423
1428
 
@@ -1434,7 +1439,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1434
1439
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1435
1440
  const cheerio_1 = __webpack_require__(55473);
1436
1441
  const fs_1 = __importDefault(__webpack_require__(57147));
1437
- const unzipper_1 = __importDefault(__webpack_require__(23428));
1438
1442
  const url_1 = __webpack_require__(57310);
1439
1443
  const lib_1 = __webpack_require__(60337);
1440
1444
  const PAGE_URL = 'https://sjp.pl/sl/growy/';
@@ -1443,7 +1447,7 @@ const getPlPlWordList = async () => {
1443
1447
  const tempFilepath = (0, lib_1.getTempFilepath)();
1444
1448
  const zipUrl = await fetchZipUrl(PAGE_URL);
1445
1449
  const zipTempFilename = await (0, lib_1.downloadFile)(zipUrl);
1446
- await unzip(zipTempFilename, tempFilepath);
1450
+ await (0, lib_1.unzip)(zipTempFilename, FILE_TO_EXTRACT_FROM_ZIP, tempFilepath);
1447
1451
  fs_1.default.unlinkSync(zipTempFilename);
1448
1452
  const file = fs_1.default.readFileSync(tempFilepath, 'utf-8');
1449
1453
  fs_1.default.unlinkSync(tempFilepath);
@@ -1468,24 +1472,30 @@ const parseZipContainingPage = (html) => {
1468
1472
  }
1469
1473
  return zipFilename;
1470
1474
  };
1471
- const unzip = (zipFilename, outputFilename) => {
1472
- return fs_1.default
1473
- .createReadStream(zipFilename)
1474
- .pipe(unzipper_1.default.Parse())
1475
- .on('entry', (entry) => {
1476
- const fileName = entry.path;
1477
- if (fileName === FILE_TO_EXTRACT_FROM_ZIP) {
1478
- entry.pipe(fs_1.default.createWriteStream(outputFilename));
1479
- }
1480
- else {
1481
- entry.autodrain();
1482
- }
1483
- })
1484
- .promise();
1485
- };
1486
1475
  exports["default"] = getPlPlWordList;
1487
1476
 
1488
1477
 
1478
+ /***/ }),
1479
+
1480
+ /***/ 73691:
1481
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1482
+
1483
+
1484
+ var __importDefault = (this && this.__importDefault) || function (mod) {
1485
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1486
+ };
1487
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1488
+ const types_1 = __webpack_require__(46452);
1489
+ const latinize_1 = __importDefault(__webpack_require__(66761));
1490
+ const lib_1 = __webpack_require__(60337);
1491
+ const FILE_URL = 'https://raw.githubusercontent.com/kamilmielnik/scrabble-dictionaries/master/romanian/loc-5.0.txt';
1492
+ const getRoRoWordList = async () => {
1493
+ const words = await (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.RO_RO);
1494
+ return words.map(latinize_1.default);
1495
+ };
1496
+ exports["default"] = getRoRoWordList;
1497
+
1498
+
1489
1499
  /***/ }),
1490
1500
 
1491
1501
  /***/ 8769:
@@ -1504,6 +1514,7 @@ const getEsEsWordList_1 = __importDefault(__webpack_require__(87537));
1504
1514
  const getFaIrWordList_1 = __importDefault(__webpack_require__(29596));
1505
1515
  const getFrFrWordList_1 = __importDefault(__webpack_require__(27098));
1506
1516
  const getPlPlWordList_1 = __importDefault(__webpack_require__(9385));
1517
+ const getRoRoWordList_1 = __importDefault(__webpack_require__(73691));
1507
1518
  const localeMap = {
1508
1519
  [types_1.Locale.DE_DE]: getDeDeWordList_1.default,
1509
1520
  [types_1.Locale.EN_GB]: getEnGbWordList_1.default,
@@ -1512,6 +1523,7 @@ const localeMap = {
1512
1523
  [types_1.Locale.FA_IR]: getFaIrWordList_1.default,
1513
1524
  [types_1.Locale.FR_FR]: getFrFrWordList_1.default,
1514
1525
  [types_1.Locale.PL_PL]: getPlPlWordList_1.default,
1526
+ [types_1.Locale.RO_RO]: getRoRoWordList_1.default,
1515
1527
  };
1516
1528
  const getWordList = (locale) => localeMap[locale]();
1517
1529
  exports["default"] = getWordList;
@@ -1746,7 +1758,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1746
1758
  return (mod && mod.__esModule) ? mod : { "default": mod };
1747
1759
  };
1748
1760
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1749
- exports.getTxtWordList = exports.getTempFilepath = exports.getHash = exports.findFirstWordIndex = exports.extractWords = exports.downloadHtml = exports.downloadFile = void 0;
1761
+ exports.unzip = exports.getTxtWordList = exports.getTempFilepath = exports.getHash = exports.findFirstWordIndex = exports.extractWords = exports.downloadHtml = exports.downloadFile = void 0;
1750
1762
  var downloadFile_1 = __webpack_require__(920);
1751
1763
  Object.defineProperty(exports, "downloadFile", ({ enumerable: true, get: function () { return __importDefault(downloadFile_1).default; } }));
1752
1764
  var downloadHtml_1 = __webpack_require__(78015);
@@ -1761,6 +1773,38 @@ var getTempFilepath_1 = __webpack_require__(5026);
1761
1773
  Object.defineProperty(exports, "getTempFilepath", ({ enumerable: true, get: function () { return __importDefault(getTempFilepath_1).default; } }));
1762
1774
  var getTxtWordList_1 = __webpack_require__(78029);
1763
1775
  Object.defineProperty(exports, "getTxtWordList", ({ enumerable: true, get: function () { return __importDefault(getTxtWordList_1).default; } }));
1776
+ var unzip_1 = __webpack_require__(76987);
1777
+ Object.defineProperty(exports, "unzip", ({ enumerable: true, get: function () { return __importDefault(unzip_1).default; } }));
1778
+
1779
+
1780
+ /***/ }),
1781
+
1782
+ /***/ 76987:
1783
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1784
+
1785
+
1786
+ var __importDefault = (this && this.__importDefault) || function (mod) {
1787
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1788
+ };
1789
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1790
+ const fs_1 = __importDefault(__webpack_require__(57147));
1791
+ const unzipper_1 = __importDefault(__webpack_require__(23428));
1792
+ const unzip = (zipFilename, extractFilename, outputFilename) => {
1793
+ return fs_1.default
1794
+ .createReadStream(zipFilename)
1795
+ .pipe(unzipper_1.default.Parse())
1796
+ .on('entry', (entry) => {
1797
+ const fileName = entry.path;
1798
+ if (fileName === extractFilename) {
1799
+ entry.pipe(fs_1.default.createWriteStream(outputFilename));
1800
+ }
1801
+ else {
1802
+ entry.autodrain();
1803
+ }
1804
+ })
1805
+ .promise();
1806
+ };
1807
+ exports["default"] = unzip;
1764
1808
 
1765
1809
 
1766
1810
  /***/ })
@@ -9232,6 +9232,9 @@ var WriteAfterEndError = createErrorType(
9232
9232
  "write after end"
9233
9233
  );
9234
9234
 
9235
+ // istanbul ignore next
9236
+ var destroy = Writable.prototype.destroy || noop;
9237
+
9235
9238
  // An HTTP(S) request that can be redirected
9236
9239
  function RedirectableRequest(options, responseCallback) {
9237
9240
  // Initialize the request
@@ -9262,10 +9265,17 @@ function RedirectableRequest(options, responseCallback) {
9262
9265
  RedirectableRequest.prototype = Object.create(Writable.prototype);
9263
9266
 
9264
9267
  RedirectableRequest.prototype.abort = function () {
9265
- abortRequest(this._currentRequest);
9268
+ destroyRequest(this._currentRequest);
9269
+ this._currentRequest.abort();
9266
9270
  this.emit("abort");
9267
9271
  };
9268
9272
 
9273
+ RedirectableRequest.prototype.destroy = function (error) {
9274
+ destroyRequest(this._currentRequest, error);
9275
+ destroy.call(this, error);
9276
+ return this;
9277
+ };
9278
+
9269
9279
  // Writes buffered data to the current native request
9270
9280
  RedirectableRequest.prototype.write = function (data, encoding, callback) {
9271
9281
  // Writing is not allowed if end has been called
@@ -9378,6 +9388,7 @@ RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
9378
9388
  self.removeListener("abort", clearTimer);
9379
9389
  self.removeListener("error", clearTimer);
9380
9390
  self.removeListener("response", clearTimer);
9391
+ self.removeListener("close", clearTimer);
9381
9392
  if (callback) {
9382
9393
  self.removeListener("timeout", callback);
9383
9394
  }
@@ -9404,6 +9415,7 @@ RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
9404
9415
  this.on("abort", clearTimer);
9405
9416
  this.on("error", clearTimer);
9406
9417
  this.on("response", clearTimer);
9418
+ this.on("close", clearTimer);
9407
9419
 
9408
9420
  return this;
9409
9421
  };
@@ -9555,7 +9567,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
9555
9567
  }
9556
9568
 
9557
9569
  // The response is a redirect, so abort the current request
9558
- abortRequest(this._currentRequest);
9570
+ destroyRequest(this._currentRequest);
9559
9571
  // Discard the remainder of the response to avoid waiting for data
9560
9572
  response.destroy();
9561
9573
 
@@ -9784,12 +9796,12 @@ function createErrorType(code, message, baseClass) {
9784
9796
  return CustomError;
9785
9797
  }
9786
9798
 
9787
- function abortRequest(request) {
9799
+ function destroyRequest(request, error) {
9788
9800
  for (var event of events) {
9789
9801
  request.removeListener(event, eventHandlers[event]);
9790
9802
  }
9791
9803
  request.on("error", noop);
9792
- request.abort();
9804
+ request.destroy(error);
9793
9805
  }
9794
9806
 
9795
9807
  function isSubdomain(subdomain, domain) {