@scrabble-solver/scrabble-solver 2.9.2 → 2.10.0
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +11 -11
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/{429.js → 131.js} +2 -3652
- package/.next/server/chunks/413.js +367 -185
- package/.next/server/chunks/44.js +71 -45
- package/.next/server/chunks/515.js +1135 -504
- package/.next/server/chunks/911.js +96 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +2 -2
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale]/[word].js +48 -10
- package/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale].js +1 -8
- package/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
- package/.next/server/pages/api/solve.js +62 -49
- package/.next/server/pages/api/solve.js.nft.json +1 -1
- package/.next/server/pages/api/verify.js +2 -9
- package/.next/server/pages/api/verify.js.nft.json +1 -1
- package/.next/server/pages/index.html +4 -8
- package/.next/server/pages/index.js +43 -36
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/server/pages-manifest.json +2 -2
- package/.next/static/chunks/368-d423e70be6c0c473.js +1 -0
- package/.next/static/chunks/pages/{404-7082923654d5996f.js → 404-932294135c3206dd.js} +1 -1
- package/.next/static/chunks/pages/_app-3f5508a5f544d9eb.js +1 -0
- package/.next/static/chunks/pages/index-8af7a9d7a2cd98a7.js +1 -0
- package/.next/static/css/6b1833fd19d3a74a.css +1 -0
- package/.next/static/css/a6154e4ca046ca13.css +1 -0
- package/.next/static/css/bad53af6f8616677.css +1 -0
- package/.next/static/vscqn7BEtAxJteWSwNnas/_buildManifest.js +1 -0
- package/.next/static/{Ntg-ilwD7GqTIFwRpSaTQ → vscqn7BEtAxJteWSwNnas}/_ssgManifest.js +0 -0
- package/.next/trace +52 -52
- package/package.json +9 -9
- package/src/components/Board/components/Cell/Cell.module.scss +45 -9
- package/src/components/Board/hooks/useGrid.ts +4 -2
- package/src/components/Dictionary/Dictionary.module.scss +8 -1
- package/src/components/EmptyState/EmptyState.tsx +6 -2
- package/src/components/Loading/Loading.tsx +13 -2
- package/src/components/Logo/Logo.svg +62 -0
- package/src/components/Logo/index.ts +1 -1
- package/src/components/NavButtons/NavButtons.module.scss +8 -7
- package/src/components/NavButtons/NavButtons.tsx +35 -28
- package/src/components/PlainTiles/PlainTiles.tsx +7 -1
- package/src/components/PlainTiles/Tile.tsx +4 -3
- package/src/components/Rack/Rack.tsx +4 -2
- package/src/components/Radio/Radio.module.scss +1 -1
- package/src/components/RemainingTiles/Character.tsx +7 -2
- package/src/components/RemainingTiles/RemainingTiles.tsx +28 -20
- package/src/components/Results/Cell.tsx +5 -3
- package/src/components/Results/Result.tsx +8 -3
- package/src/components/Results/Results.module.scss +31 -9
- package/src/components/Results/Results.tsx +6 -2
- package/src/components/Results/getColumns.ts +58 -0
- package/src/components/Settings/components/ConfigSetting/ConfigSetting.module.scss +1 -0
- package/src/components/Settings/components/LocaleSetting/LocaleSetting.module.scss +12 -1
- package/src/components/Settings/components/LocaleSetting/LocaleSetting.tsx +1 -1
- package/src/components/Settings/components/LocaleSetting/options.ts +7 -1
- package/src/components/Sidebar/Sidebar.module.scss +42 -8
- package/src/components/SvgFontCss/SvgFontCss.tsx +8 -7
- package/src/components/SvgFontCss/createCss.ts +11 -0
- package/src/components/SvgFontCss/createStyle.ts +9 -0
- package/src/components/SvgFontCss/createSvg.ts +10 -0
- package/src/components/SvgFontFix/SvgFontFix.module.scss +5 -0
- package/src/components/SvgFontFix/SvgFontFix.tsx +21 -0
- package/src/components/SvgFontFix/index.ts +1 -0
- package/src/components/Tile/Tile.module.scss +10 -2
- package/src/components/Tile/Tile.tsx +4 -0
- package/src/components/Tile/TilePure.tsx +3 -1
- package/src/components/Words/Words.tsx +4 -3
- package/src/components/index.ts +1 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useDirection.ts +22 -0
- package/src/hooks/useLanguage.ts +22 -0
- package/src/i18n/constants.ts +53 -0
- package/src/i18n/fa.json +56 -0
- package/src/i18n/i18n.ts +22 -0
- package/src/i18n/index.ts +2 -20
- package/src/icons/FlagFa.svg +95 -0
- package/src/icons/index.ts +1 -0
- package/src/lib/createComparator.ts +22 -0
- package/src/lib/createKeyComparator.ts +4 -2
- package/src/lib/createStringComparator.ts +5 -0
- package/src/lib/detectLocale.ts +4 -0
- package/src/lib/getRemainingTiles.ts +4 -2
- package/src/lib/getRemainingTilesGroups.ts +48 -23
- package/src/lib/index.ts +2 -2
- package/src/lib/sortResults.ts +11 -9
- package/src/lib/unorderedArraysEqual.ts +3 -2
- package/src/pages/api/verify.ts +1 -1
- package/src/pages/index.module.scss +7 -18
- package/src/pages/index.tsx +10 -2
- package/src/service-worker/routeVerifyRequests.ts +1 -1
- package/src/state/selectors.ts +5 -5
- package/src/styles/global.scss +6 -1
- package/.next/static/Ntg-ilwD7GqTIFwRpSaTQ/_buildManifest.js +0 -1
- package/.next/static/chunks/317-5e5334962dd7c681.js +0 -1
- package/.next/static/chunks/pages/_app-183f598b1d4d480b.js +0 -1
- package/.next/static/chunks/pages/index-b1ffeaddd9fb64b5.js +0 -1
- package/.next/static/css/751e8a14776d05d8.css +0 -1
- package/.next/static/css/ad2a08918868cad8.css +0 -1
- package/.next/static/css/e8de67ad5ea35427.css +0 -1
- package/src/components/Results/constants.ts +0 -42
- package/src/lib/comparator.ts +0 -16
- package/src/lib/stringComparator.ts +0 -5
|
@@ -869,6 +869,7 @@ var Locale;
|
|
|
869
869
|
Locale["EN_GB"] = "en-GB";
|
|
870
870
|
Locale["EN_US"] = "en-US";
|
|
871
871
|
Locale["ES_ES"] = "es-ES";
|
|
872
|
+
Locale["FA_IR"] = "fa-IR";
|
|
872
873
|
Locale["FR_FR"] = "fr-FR";
|
|
873
874
|
Locale["PL_PL"] = "pl-PL";
|
|
874
875
|
})(Locale || (Locale = {}));
|
|
@@ -958,7 +959,6 @@ class Result {
|
|
|
958
959
|
this.points = points;
|
|
959
960
|
this.pointsRatio = getPointsRatio(tiles, points);
|
|
960
961
|
this.tiles = tiles;
|
|
961
|
-
this.tilesCharacters = getTilesCharacters(tiles);
|
|
962
962
|
this.tilesCount = tiles.length;
|
|
963
963
|
this.vowelsCount = getVowels(tiles).length;
|
|
964
964
|
this.word = getWord(cells);
|
|
@@ -982,15 +982,11 @@ class Result {
|
|
|
982
982
|
};
|
|
983
983
|
}
|
|
984
984
|
}
|
|
985
|
-
const charactersComparator = (a, b) => a.localeCompare(b);
|
|
986
985
|
const getBlanks = (tiles) => tiles.filter(({ isBlank }) => isBlank);
|
|
987
986
|
const getConsonants = (tiles) => tiles.filter(isConsonant);
|
|
988
987
|
const getVowels = (tiles) => tiles.filter(isVowel);
|
|
989
|
-
const getNonBlankCharacters = (tiles) => getNonBlanks(tiles).map(({ character }) => character);
|
|
990
|
-
const getNonBlanks = (tiles) => tiles.filter(({ isBlank }) => !isBlank);
|
|
991
988
|
const getPointsRatio = (tiles, points) => points / tiles.length;
|
|
992
989
|
const getTiles = (cells) => cells.filter(({ isEmpty }) => isEmpty).map(({ tile }) => tile);
|
|
993
|
-
const getTilesCharacters = (tiles) => getNonBlankCharacters(tiles).sort(charactersComparator).join('');
|
|
994
990
|
// eslint-disable-next-line prefer-template
|
|
995
991
|
const getWord = (cells) => cells.reduce((word, cell) => word + cell.toString(), '');
|
|
996
992
|
const getWords = (cells, collisions) => [cells, ...collisions].map(getWord);
|
|
@@ -1275,10 +1271,11 @@ exports["default"] = isObject;
|
|
|
1275
1271
|
|
|
1276
1272
|
|
|
1277
1273
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1274
|
+
const types_1 = __webpack_require__(46452);
|
|
1278
1275
|
const lib_1 = __webpack_require__(60337);
|
|
1279
1276
|
const FILE_URL = 'https://raw.githubusercontent.com/hippler/german-wordlist/master/words.txt';
|
|
1280
1277
|
const getDeDeWordList = async () => {
|
|
1281
|
-
return (0, lib_1.getTxtWordList)(FILE_URL);
|
|
1278
|
+
return (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.DE_DE);
|
|
1282
1279
|
};
|
|
1283
1280
|
exports["default"] = getDeDeWordList;
|
|
1284
1281
|
|
|
@@ -1290,10 +1287,11 @@ exports["default"] = getDeDeWordList;
|
|
|
1290
1287
|
|
|
1291
1288
|
|
|
1292
1289
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1290
|
+
const types_1 = __webpack_require__(46452);
|
|
1293
1291
|
const lib_1 = __webpack_require__(60337);
|
|
1294
1292
|
const FILE_URL = 'https://www.wordgamedictionary.com/sowpods/download/sowpods.txt';
|
|
1295
1293
|
const getEnGbWordList = async () => {
|
|
1296
|
-
return (0, lib_1.getTxtWordList)(FILE_URL);
|
|
1294
|
+
return (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.EN_GB);
|
|
1297
1295
|
};
|
|
1298
1296
|
exports["default"] = getEnGbWordList;
|
|
1299
1297
|
|
|
@@ -1305,10 +1303,11 @@ exports["default"] = getEnGbWordList;
|
|
|
1305
1303
|
|
|
1306
1304
|
|
|
1307
1305
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1306
|
+
const types_1 = __webpack_require__(46452);
|
|
1308
1307
|
const lib_1 = __webpack_require__(60337);
|
|
1309
1308
|
const FILE_URL = 'https://www.wordgamedictionary.com/twl06/download/twl06.txt';
|
|
1310
1309
|
const getEnUsWordList = async () => {
|
|
1311
|
-
return (0, lib_1.getTxtWordList)(FILE_URL);
|
|
1310
|
+
return (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.EN_US);
|
|
1312
1311
|
};
|
|
1313
1312
|
exports["default"] = getEnUsWordList;
|
|
1314
1313
|
|
|
@@ -1320,10 +1319,11 @@ exports["default"] = getEnUsWordList;
|
|
|
1320
1319
|
|
|
1321
1320
|
|
|
1322
1321
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1322
|
+
const types_1 = __webpack_require__(46452);
|
|
1323
1323
|
const lib_1 = __webpack_require__(60337);
|
|
1324
1324
|
const FILE_URL = 'https://raw.githubusercontent.com/kamilmielnik/fise-2/master/fise-2.txt';
|
|
1325
1325
|
const getEsEsWordList = async () => {
|
|
1326
|
-
const words = await (0, lib_1.getTxtWordList)(FILE_URL);
|
|
1326
|
+
const words = await (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.ES_ES);
|
|
1327
1327
|
return words.map(normalizeWord);
|
|
1328
1328
|
};
|
|
1329
1329
|
const normalizeWord = (word) => {
|
|
@@ -1333,6 +1333,22 @@ const normalizeWord = (word) => {
|
|
|
1333
1333
|
exports["default"] = getEsEsWordList;
|
|
1334
1334
|
|
|
1335
1335
|
|
|
1336
|
+
/***/ }),
|
|
1337
|
+
|
|
1338
|
+
/***/ 29596:
|
|
1339
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1343
|
+
const types_1 = __webpack_require__(46452);
|
|
1344
|
+
const lib_1 = __webpack_require__(60337);
|
|
1345
|
+
const FILE_URL = 'https://raw.githubusercontent.com/MansourM/persian-to-persian-dictionary/main/moein/words.txt';
|
|
1346
|
+
const getFaIrWordList = async () => {
|
|
1347
|
+
return (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.FA_IR);
|
|
1348
|
+
};
|
|
1349
|
+
exports["default"] = getFaIrWordList;
|
|
1350
|
+
|
|
1351
|
+
|
|
1336
1352
|
/***/ }),
|
|
1337
1353
|
|
|
1338
1354
|
/***/ 27098:
|
|
@@ -1340,12 +1356,13 @@ exports["default"] = getEsEsWordList;
|
|
|
1340
1356
|
|
|
1341
1357
|
|
|
1342
1358
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1359
|
+
const types_1 = __webpack_require__(46452);
|
|
1343
1360
|
const lib_1 = __webpack_require__(60337);
|
|
1344
1361
|
const FILE_URL =
|
|
1345
1362
|
// eslint-disable-next-line max-len
|
|
1346
1363
|
'https://raw.githubusercontent.com/hbenbel/French-Dictionary/a573eab10cc798d7d5da7daab4d2ac0259bb46a3/dictionary/dictionary.txt';
|
|
1347
1364
|
const getFrFrWordList = async () => {
|
|
1348
|
-
const words = await (0, lib_1.getTxtWordList)(FILE_URL);
|
|
1365
|
+
const words = await (0, lib_1.getTxtWordList)(FILE_URL, types_1.Locale.FR_FR);
|
|
1349
1366
|
return words.map(normalizeWord);
|
|
1350
1367
|
};
|
|
1351
1368
|
const normalizeWord = (word) => {
|
|
@@ -1366,21 +1383,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1366
1383
|
};
|
|
1367
1384
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1368
1385
|
const cheerio_1 = __webpack_require__(55473);
|
|
1369
|
-
const
|
|
1386
|
+
const fs_1 = __importDefault(__webpack_require__(57147));
|
|
1370
1387
|
const unzipper_1 = __importDefault(__webpack_require__(23428));
|
|
1371
1388
|
const url_1 = __webpack_require__(57310);
|
|
1372
1389
|
const lib_1 = __webpack_require__(60337);
|
|
1373
1390
|
const PAGE_URL = 'https://sjp.pl/sl/growy/';
|
|
1374
1391
|
const FILE_TO_EXTRACT_FROM_ZIP = 'slowa.txt';
|
|
1375
1392
|
const getPlPlWordList = async () => {
|
|
1376
|
-
const
|
|
1393
|
+
const tempFilepath = (0, lib_1.getTempFilepath)();
|
|
1377
1394
|
const zipUrl = await fetchZipUrl(PAGE_URL);
|
|
1378
1395
|
const zipTempFilename = await (0, lib_1.downloadFile)(zipUrl);
|
|
1379
|
-
await unzip(zipTempFilename,
|
|
1380
|
-
|
|
1381
|
-
const file =
|
|
1382
|
-
|
|
1383
|
-
const words = (0, lib_1.extractWords)(file.toLocaleString());
|
|
1396
|
+
await unzip(zipTempFilename, tempFilepath);
|
|
1397
|
+
fs_1.default.unlinkSync(zipTempFilename);
|
|
1398
|
+
const file = fs_1.default.readFileSync(tempFilepath, 'utf-8');
|
|
1399
|
+
fs_1.default.unlinkSync(tempFilepath);
|
|
1400
|
+
const words = (0, lib_1.extractWords)(file.toLocaleString(), 'pl-PL');
|
|
1384
1401
|
return words;
|
|
1385
1402
|
};
|
|
1386
1403
|
const fetchZipUrl = async (url) => {
|
|
@@ -1402,13 +1419,13 @@ const parseZipContainingPage = (html) => {
|
|
|
1402
1419
|
return zipFilename;
|
|
1403
1420
|
};
|
|
1404
1421
|
const unzip = (zipFilename, outputFilename) => {
|
|
1405
|
-
return
|
|
1422
|
+
return fs_1.default
|
|
1406
1423
|
.createReadStream(zipFilename)
|
|
1407
1424
|
.pipe(unzipper_1.default.Parse())
|
|
1408
1425
|
.on('entry', (entry) => {
|
|
1409
1426
|
const fileName = entry.path;
|
|
1410
1427
|
if (fileName === FILE_TO_EXTRACT_FROM_ZIP) {
|
|
1411
|
-
entry.pipe(
|
|
1428
|
+
entry.pipe(fs_1.default.createWriteStream(outputFilename));
|
|
1412
1429
|
}
|
|
1413
1430
|
else {
|
|
1414
1431
|
entry.autodrain();
|
|
@@ -1434,6 +1451,7 @@ const getDeDeWordList_1 = __importDefault(__webpack_require__(61704));
|
|
|
1434
1451
|
const getEnGbWordList_1 = __importDefault(__webpack_require__(3284));
|
|
1435
1452
|
const getEnUsWordList_1 = __importDefault(__webpack_require__(163));
|
|
1436
1453
|
const getEsEsWordList_1 = __importDefault(__webpack_require__(87537));
|
|
1454
|
+
const getFaIrWordList_1 = __importDefault(__webpack_require__(29596));
|
|
1437
1455
|
const getFrFrWordList_1 = __importDefault(__webpack_require__(27098));
|
|
1438
1456
|
const getPlPlWordList_1 = __importDefault(__webpack_require__(81848));
|
|
1439
1457
|
const localeMap = {
|
|
@@ -1441,6 +1459,7 @@ const localeMap = {
|
|
|
1441
1459
|
[types_1.Locale.EN_GB]: getEnGbWordList_1.default,
|
|
1442
1460
|
[types_1.Locale.EN_US]: getEnUsWordList_1.default,
|
|
1443
1461
|
[types_1.Locale.ES_ES]: getEsEsWordList_1.default,
|
|
1462
|
+
[types_1.Locale.FA_IR]: getFaIrWordList_1.default,
|
|
1444
1463
|
[types_1.Locale.FR_FR]: getFrFrWordList_1.default,
|
|
1445
1464
|
[types_1.Locale.PL_PL]: getPlPlWordList_1.default,
|
|
1446
1465
|
};
|
|
@@ -1499,13 +1518,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1499
1518
|
};
|
|
1500
1519
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1501
1520
|
const follow_redirects_1 = __webpack_require__(24396);
|
|
1502
|
-
const
|
|
1503
|
-
const
|
|
1521
|
+
const fs_1 = __importDefault(__webpack_require__(57147));
|
|
1522
|
+
const getTempFilepath_1 = __importDefault(__webpack_require__(5026));
|
|
1504
1523
|
const downloadFile = (url) => {
|
|
1505
1524
|
return new Promise((resolve, reject) => {
|
|
1506
|
-
const
|
|
1525
|
+
const tempFilepath = (0, getTempFilepath_1.default)();
|
|
1507
1526
|
const protocol = url.startsWith('https') ? follow_redirects_1.https : follow_redirects_1.http;
|
|
1508
|
-
const writeStream =
|
|
1527
|
+
const writeStream = fs_1.default.createWriteStream(tempFilepath);
|
|
1509
1528
|
const request = protocol.get(url, (response) => {
|
|
1510
1529
|
if (typeof response.statusCode === 'undefined' || response.statusCode >= 400) {
|
|
1511
1530
|
reject(new Error(`Cannot download file: ${url}`));
|
|
@@ -1518,7 +1537,7 @@ const downloadFile = (url) => {
|
|
|
1518
1537
|
response.on('end', () => {
|
|
1519
1538
|
writeStream.on('finish', () => {
|
|
1520
1539
|
writeStream.close();
|
|
1521
|
-
resolve(
|
|
1540
|
+
resolve(tempFilepath);
|
|
1522
1541
|
});
|
|
1523
1542
|
});
|
|
1524
1543
|
response.pipe(writeStream);
|
|
@@ -1570,13 +1589,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1570
1589
|
};
|
|
1571
1590
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1572
1591
|
const findFirstWordIndex_1 = __importDefault(__webpack_require__(47669));
|
|
1573
|
-
const extractWords = (file) => {
|
|
1574
|
-
const lines = file.
|
|
1575
|
-
const firstWordIndex = (0, findFirstWordIndex_1.default)(lines);
|
|
1576
|
-
const words =
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
.
|
|
1592
|
+
const extractWords = (file, locale) => {
|
|
1593
|
+
const lines = file.split(/\r?\n/g);
|
|
1594
|
+
const firstWordIndex = (0, findFirstWordIndex_1.default)(lines, locale);
|
|
1595
|
+
const words = [];
|
|
1596
|
+
for (let i = firstWordIndex; i < lines.length; ++i) {
|
|
1597
|
+
const trimmed = lines[i].trim();
|
|
1598
|
+
if (trimmed.length > 0) {
|
|
1599
|
+
words.push(trimmed.toLocaleLowerCase());
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1580
1602
|
return words;
|
|
1581
1603
|
};
|
|
1582
1604
|
exports["default"] = extractWords;
|
|
@@ -1589,10 +1611,10 @@ exports["default"] = extractWords;
|
|
|
1589
1611
|
|
|
1590
1612
|
|
|
1591
1613
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1592
|
-
const findFirstWordIndex = (lines) => {
|
|
1614
|
+
const findFirstWordIndex = (lines, locale) => {
|
|
1593
1615
|
const firstWordIndex = lines.findIndex((line, index) => {
|
|
1594
1616
|
const nextLine = line[index + 1] || '';
|
|
1595
|
-
const isNextLineInOrder = line.localeCompare(nextLine)
|
|
1617
|
+
const isNextLineInOrder = line.localeCompare(nextLine, locale) > 0;
|
|
1596
1618
|
const hasWhitespace = Boolean(line.match(/\s/));
|
|
1597
1619
|
const isEmpty = line.trim().length === 0;
|
|
1598
1620
|
return !isEmpty && !hasWhitespace && isNextLineInOrder;
|
|
@@ -1622,7 +1644,7 @@ exports["default"] = getHash;
|
|
|
1622
1644
|
|
|
1623
1645
|
/***/ }),
|
|
1624
1646
|
|
|
1625
|
-
/***/
|
|
1647
|
+
/***/ 5026:
|
|
1626
1648
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1627
1649
|
|
|
1628
1650
|
|
|
@@ -1630,11 +1652,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1630
1652
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1631
1653
|
};
|
|
1632
1654
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1655
|
+
const os_1 = __importDefault(__webpack_require__(22037));
|
|
1656
|
+
const path_1 = __importDefault(__webpack_require__(71017));
|
|
1633
1657
|
const getHash_1 = __importDefault(__webpack_require__(93938));
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1658
|
+
const OUTPUT_DIRECTORY = path_1.default.resolve(os_1.default.homedir(), '.scrabble-solver');
|
|
1659
|
+
const getTempFilepath = () => {
|
|
1660
|
+
const filename = `${(0, getHash_1.default)()}.txt`;
|
|
1661
|
+
return path_1.default.join(OUTPUT_DIRECTORY, filename);
|
|
1636
1662
|
};
|
|
1637
|
-
exports["default"] =
|
|
1663
|
+
exports["default"] = getTempFilepath;
|
|
1638
1664
|
|
|
1639
1665
|
|
|
1640
1666
|
/***/ }),
|
|
@@ -1647,14 +1673,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1647
1673
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1648
1674
|
};
|
|
1649
1675
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1650
|
-
const
|
|
1676
|
+
const fs_1 = __importDefault(__webpack_require__(57147));
|
|
1651
1677
|
const downloadFile_1 = __importDefault(__webpack_require__(920));
|
|
1652
1678
|
const extractWords_1 = __importDefault(__webpack_require__(39759));
|
|
1653
|
-
const getTxtWordList = async (url) => {
|
|
1679
|
+
const getTxtWordList = async (url, locale) => {
|
|
1654
1680
|
const tempFilename = await (0, downloadFile_1.default)(url);
|
|
1655
|
-
const file =
|
|
1656
|
-
const words = (0, extractWords_1.default)(file.toLocaleString());
|
|
1657
|
-
|
|
1681
|
+
const file = fs_1.default.readFileSync(tempFilename, 'utf-8');
|
|
1682
|
+
const words = (0, extractWords_1.default)(file.toLocaleString(), locale);
|
|
1683
|
+
fs_1.default.unlinkSync(tempFilename);
|
|
1658
1684
|
return words;
|
|
1659
1685
|
};
|
|
1660
1686
|
exports["default"] = getTxtWordList;
|
|
@@ -1670,7 +1696,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1670
1696
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1671
1697
|
};
|
|
1672
1698
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1673
|
-
exports.getTxtWordList = exports.
|
|
1699
|
+
exports.getTxtWordList = exports.getTempFilepath = exports.getHash = exports.findFirstWordIndex = exports.extractWords = exports.downloadHtml = exports.downloadFile = void 0;
|
|
1674
1700
|
var downloadFile_1 = __webpack_require__(920);
|
|
1675
1701
|
Object.defineProperty(exports, "downloadFile", ({ enumerable: true, get: function () { return __importDefault(downloadFile_1).default; } }));
|
|
1676
1702
|
var downloadHtml_1 = __webpack_require__(78015);
|
|
@@ -1681,8 +1707,8 @@ var findFirstWordIndex_1 = __webpack_require__(47669);
|
|
|
1681
1707
|
Object.defineProperty(exports, "findFirstWordIndex", ({ enumerable: true, get: function () { return __importDefault(findFirstWordIndex_1).default; } }));
|
|
1682
1708
|
var getHash_1 = __webpack_require__(93938);
|
|
1683
1709
|
Object.defineProperty(exports, "getHash", ({ enumerable: true, get: function () { return __importDefault(getHash_1).default; } }));
|
|
1684
|
-
var
|
|
1685
|
-
Object.defineProperty(exports, "
|
|
1710
|
+
var getTempFilepath_1 = __webpack_require__(5026);
|
|
1711
|
+
Object.defineProperty(exports, "getTempFilepath", ({ enumerable: true, get: function () { return __importDefault(getTempFilepath_1).default; } }));
|
|
1686
1712
|
var getTxtWordList_1 = __webpack_require__(78029);
|
|
1687
1713
|
Object.defineProperty(exports, "getTxtWordList", ({ enumerable: true, get: function () { return __importDefault(getTxtWordList_1).default; } }));
|
|
1688
1714
|
|