diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 598e6d30..6566827a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v4 with: - version: 9.5.0 + version: 9.12.3 run_install: false - name: Install Node.js diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 30e74e9a..1d50881f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -21,7 +21,7 @@ jobs: - uses: pnpm/action-setup@v4 name: Install pnpm with: - version: 9.5.0 + version: 9.12.3 run_install: false - name: Install Node.js diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index f35f758e..192647e4 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -57,8 +57,6 @@ jobs: - name: Run tests and collect coverage run: pnpm run test::coverage - - run: pnpm build - - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 with: diff --git a/.vscode/launch.json b/.vscode/launch.json index ee86ac84..6e380c16 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,23 +5,34 @@ "type": "node", "request": "launch", "name": "ts-fsrs debug", - "skipFiles": ["/**"], + "skipFiles": [ + "/**", + "${workspaceFolder}/node_modules/**" + ], "env": { // "DEBUG": "*", }, "outputCapture": "std", - "runtimeExecutable": "nodemon", + "runtimeExecutable": "tsx", "restart": true, "console": "integratedTerminal", "cwd": "${workspaceFolder}", - "args": ["${workspaceFolder}/debug/index.ts"] + "args": ["watch","${workspaceFolder}/debug/index.ts"] }, { "type": "node", "request": "attach", "name": "Node: Nodemon", "processId": "${command:PickProcess}", - "restart": true + "restart": true, + "port": 9229, + "skipFiles": [ + // Node.js internal core modules + "/**", + + // Ignore all dependencies (optional) + "${workspaceFolder}/node_modules/**" + ] } ] } diff --git a/LICENSE b/LICENSE index 0a2e802b..8203e4e6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Open Spaced Repetition +Copyright (c) 2025 Open Spaced Repetition Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/debug/long-term.ts b/debug/long-term.ts index 58f3ca9a..7fc050ab 100644 --- a/debug/long-term.ts +++ b/debug/long-term.ts @@ -35,22 +35,34 @@ function test1() { assert.deepStrictEqual( ivl_history, - [3, 11, 36, 105, 277, 669, 13, 2, 4, 8, 15, 28, 51] + [ + 3, 11, 35, 101, 269, 669, + 12, 2, 5, 12, 26, 55, + 112 + ] ) assert.deepStrictEqual( s_history, [ - 3.1262, 11.38843914, 36.39366698, 105.18699429, 276.69089439, - 669.22510555, 12.54444945, 2.41539727, 4.33950844, 8.07463145, - 15.26080938, 28.22186641, 51.42879844, + 3.173, 10.73892592, + 34.57762416, 100.74831139, + 269.283835, 669.30934162, + 11.89873732, 2.23603312, + 5.20013908, 11.89928679, + 26.49170577, 55.49486382, + 111.97264222 ] ) assert.deepStrictEqual( d_history, [ - 5.31457783, 5.26703555, 5.22060576, 5.17526243, 5.13098013, 5.08773404, - 7.12585323, 9.11628043, 8.97977831, 8.84647034, 8.71628178, 8.58913963, - 8.4649726, + 5.28243442, 5.27296793, + 5.26354498, 5.25416538, + 5.24482893, 5.23553542, + 6.76539959, 7.79401833, + 7.77299855, 7.75207546, + 7.73124862, 7.71051758, + 7.68988191 ] ) } diff --git a/debug/short-term.ts b/debug/short-term.ts index 7c122e60..2d2ec078 100644 --- a/debug/short-term.ts +++ b/debug/short-term.ts @@ -35,22 +35,34 @@ function test1() { assert.deepStrictEqual( ivl_history, - [0, 4, 15, 48, 136, 351, 0, 0, 7, 13, 24, 43, 77] + [ + 0, 4, 14, 44, 125, 328, + 0, 0, 7, 16, 34, 71, + 142 + ] ) assert.deepStrictEqual( s_history, [ - 3.1262, 4.35097949, 14.94870008, 47.78790366, 136.29251941, 351.35118365, - 9.99090459, 5.08074507, 7.07127426, 13.09253023, 23.92805755, 43.23645988, - 76.59611345, + 3.173, 4.46685806, + 14.21728391, 43.7250927, + 124.79655286, 328.47343304, + 9.25594883, 4.63749438, + 6.5285311, 15.55546765, + 34.36241506, 71.10191819, + 141.83400645 ] ) assert.deepStrictEqual( d_history, [ - 5.31457783, 5.26703555, 5.22060576, 5.17526243, 5.13098013, 5.08773404, - 7.12585323, 9.11628043, 8.97977831, 8.84647034, 8.71628178, 8.58913963, - 8.4649726, + 5.28243442, 5.27296793, + 5.26354498, 5.25416538, + 5.24482893, 5.23553542, + 6.76539959, 7.79401833, + 7.77299855, 7.75207546, + 7.73124862, 7.71051758, + 7.68988191 ] ) } diff --git a/digrams/algorithm.pu b/digrams/algorithm.pu deleted file mode 100644 index 9ee4dccf..00000000 --- a/digrams/algorithm.pu +++ /dev/null @@ -1,16 +0,0 @@ -@startuml FSRSAlgorithmFunctionCalls - -FSRSAlgorithm -down-> init_ds -init_ds -down-> init_difficulty -init_ds -down-> init_stability -FSRSAlgorithm -down-> next_ds -FSRSAlgorithm -down-> current_retrievability -FSRSAlgorithm -down-> next_interval -next_interval -down-> apply_fuzz -next_ds -down-> next_difficulty -next_ds -down-> next_forget_stability -next_ds -down-> next_recall_stability -next_difficulty -down-> constrain_difficulty -next_difficulty -down-> mean_reversion - -@enduml diff --git a/digrams/cardState.pu b/digrams/cardState.pu deleted file mode 100644 index 919a2771..00000000 --- a/digrams/cardState.pu +++ /dev/null @@ -1,49 +0,0 @@ -@startuml cardStateTransition - -state New { - New : - again_due: scheduler(1) - New : - hard_due: scheduler(5) - New : - good_due: scheduler(10) - New : - easy_interval: next_interval(easy.stability) -} - -state Learning { - Learning : - hard_interval: 0 - Learning : - good_interval: next_interval(good.stability) - Learning : - easy_interval: should be at least 1 day more than good_interval -} - -state Relearning { - Relearning : Same scheduling as Learning. -} - -state Review { - Review : - generate card next DS,next_ds(s, last_d, last_s, retrievability) - Review : - hard_interval: next_interval(s.hard.stability); - Review : - good_interval: should be at least 1 day more than hard_interval - Review : - easy_interval: should be at least 1 day more than good_interval -} - - - -' 定义状态转换 -[*] --> New -New -d-> Learning : again, hard, good -New -d-> Review : easy - -Relearning --> Relearning : again, hard -Relearning -u-> Review : good, easy -Learning --> Learning : again, hard -Learning -u-> Review : good, easy - - -Review --> Relearning : again -Review --> Review : hard, good, easy - - - -' 使用hidden语法来帮助布局 -' New -[hidden]-> Relearning -Learning -[hidden]l-> Relearning - -@enduml diff --git a/digrams/class.pu b/digrams/class.pu deleted file mode 100644 index 9142814a..00000000 --- a/digrams/class.pu +++ /dev/null @@ -1,118 +0,0 @@ -@startuml class_diagram.png - -class FSRSAlgorithm { - - param: FSRSParameters - - intervalModifier - - seed? - + constructor(param: Partial) - + init_ds(s: SchedulingCard): void - + next_ds(s: SchedulingCard, last_d: number, last_s: number, retrievability: number): void - + init_stability(g: number): number - + init_difficulty(g: number): number - + apply_fuzz(ivl: number) - + next_interval(s: number): int - + next_difficulty(d: number, g: number): number - + constrain_difficulty(difficulty: number) - + mean_reversion(init: number, current: number): number - + next_recall_stability(d: number, s: number, r: number, g: Rating): number - + next_forget_stability(d: number, s: number, r: number): number - + current_retrievability(t: number, s: number): number -} - -' 定义枚举类型 -enum StateType { - New - Learning - Review - Relearning -} - -enum RatingType { - Again - Hard - Good - Easy -} - -' 定义类 -interface Rating { - + Again: RatingType = 1 - + Hard: RatingType - + Good: RatingType - + Easy: RatingType -} - -interface State { - + New: StateType = 0 - + Learning: StateType - + Review: StateType - + Relearning: StateType -} - -interface ReviewLog { - + rating: Rating - + state: State - + elapsed_days: number - + scheduled_days: number - + review: Date -} - -interface RecordLogItem{ - card: Card, log: ReviewLog -} -interface RecordLog { - + Again: RecordLogItem - + Hard: RecordLogItem - + Good: RecordLogItem - + Easy: RecordLogItem -} - -interface Card { - + due: Date - + stability: number - + difficulty: number - + elapsed_days: number - + scheduled_days: number - + reps: number - + lapses: number - + state: State - + last_review?: Date -} - -interface CardInput { - + due: Date - + stability: number - + difficulty: number - + elapsed_days: number - + scheduled_days: number - + reps: number - + lapses: number - + state: StateType | State - + last_review?: Date -} - -interface DateInput { - + value: Date | number | string -} - -interface FSRSParameters { - + request_retention: number - + maximum_interval: number - + w: number[] - + enable_fuzz: boolean -} - -' 关联关系 -State -- StateType -Rating -- RatingType -Card <|-- CardInput -RecordLogItem --> ReviewLog -RecordLogItem --> Card -RecordLog --> RecordLogItem -ReviewLog --> Rating -ReviewLog --> State -DateInput --|> Date - - - -@enduml diff --git a/digrams/models.pu b/digrams/models.pu deleted file mode 100644 index 500559a0..00000000 --- a/digrams/models.pu +++ /dev/null @@ -1,93 +0,0 @@ -@startuml models - -' 定义枚举类型 -enum StateType { - New - Learning - Review - Relearning -} - -enum RatingType { - Again - Hard - Good - Easy -} - -' 定义类 -interface Rating { - + Again: RatingType = 1 - + Hard: RatingType - + Good: RatingType - + Easy: RatingType -} - -interface State { - + New: StateType = 0 - + Learning: StateType - + Review: StateType - + Relearning: StateType -} - -interface ReviewLog { - + rating: Rating - + state: State - + elapsed_days: number - + scheduled_days: number - + review: Date -} - -interface RecordLog { - + Again: { card: Card, log: ReviewLog } - + Hard: { card: Card, log: ReviewLog } - + Good: { card: Card, log: ReviewLog } - + Easy: { card: Card, log: ReviewLog } -} - -interface Card { - + due: Date - + stability: number - + difficulty: number - + elapsed_days: number - + scheduled_days: number - + reps: number - + lapses: number - + state: State - + last_review?: Date -} - -interface CardInput { - + due: Date - + stability: number - + difficulty: number - + elapsed_days: number - + scheduled_days: number - + reps: number - + lapses: number - + state: StateType | State - + last_review?: Date -} - -interface DateInput { - + value: Date | number | string -} - -interface FSRSParameters { - + request_retention: number - + maximum_interval: number - + w: number[] - + enable_fuzz: boolean -} - -' 关联关系 -State -- StateType -Rating -- RatingType -Card <|-- CardInput -RecordLog --> ReviewLog -RecordLog --> Card -ReviewLog --> Rating -ReviewLog --> State -DateInput --|> Date - -@enduml diff --git a/nodemon.json b/nodemon.json deleted file mode 100644 index 51d5cdc3..00000000 --- a/nodemon.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "watch": ["./src/..","./debug/.."], - "ext": "ts", - "ignore": ["src/**/*.spec.ts"], - "exec": "npx ts-node --project ./tsconfig.json ./debug/index.ts" - } \ No newline at end of file diff --git a/package.json b/package.json index 2dc8fa0a..cf018936 100644 --- a/package.json +++ b/package.json @@ -14,21 +14,17 @@ "test::coverage": "jest --config=jest.config.js --coverage", "test::publish": "yalc publish", "prebuild": "rimraf ./dist", - "build": "rollup -c rollup.config.ts --configPlugin esbuild", + "prepare": "rollup -c rollup.config.ts --configPlugin esbuild", "build:types": "tsc --project ./tsconfig.json --declaration true", - "major": "npm version major", - "minor": "npm version minor", - "patch": "npm version patch", "predocs": "rimraf ./docs", - "docs": "typedoc", - "clean": "rimraf ./dist ./docs" + "docs": "typedoc" }, "devDependencies": { "@rollup/plugin-commonjs": "^26.0.1", + "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^15.2.3", "@types/jest": "^29.5.12", "@types/node": "^20.14.10", - "@types/seedrandom": "^3.0.8", "@typescript-eslint/eslint-plugin": "^8.0.0", "@typescript-eslint/parser": "^8.0.0", "decimal.js": "^10.4.3", @@ -43,6 +39,7 @@ "rollup-plugin-esbuild": "^6.1.1", "ts-jest": "^29.2.1", "tslib": "^2.6.3", + "tsx": "^4.19.2", "typedoc": "^0.26.4", "typedoc-plugin-extras": "^3.1.0", "typedoc-plugin-katex": "^0.1.2", @@ -76,4 +73,4 @@ "is-core-module": "npm:@nolyfill/is-core-module@^1" } } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7e823d34..0be2ce52 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@rollup/plugin-commonjs': specifier: ^26.0.1 version: 26.0.1(rollup@4.22.4) + '@rollup/plugin-json': + specifier: ^6.1.0 + version: 6.1.0(rollup@4.22.4) '@rollup/plugin-node-resolve': specifier: ^15.2.3 version: 15.2.3(rollup@4.22.4) @@ -23,9 +26,6 @@ importers: '@types/node': specifier: ^20.14.10 version: 20.14.10 - '@types/seedrandom': - specifier: ^3.0.8 - version: 3.0.8 '@typescript-eslint/eslint-plugin': specifier: ^8.0.0 version: 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.6.0)(typescript@5.5.3))(eslint@9.6.0)(typescript@5.5.3) @@ -61,13 +61,16 @@ importers: version: 6.1.1(rollup@4.22.4)(typescript@5.5.3) rollup-plugin-esbuild: specifier: ^6.1.1 - version: 6.1.1(esbuild@0.19.10)(rollup@4.22.4) + version: 6.1.1(esbuild@0.23.1)(rollup@4.22.4) ts-jest: specifier: ^29.2.1 - version: 29.2.1(@babel/core@7.23.6)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.23.6))(esbuild@0.19.10)(jest@29.7.0(@types/node@20.14.10))(typescript@5.5.3) + version: 29.2.1(@babel/core@7.23.6)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.23.6))(esbuild@0.23.1)(jest@29.7.0(@types/node@20.14.10))(typescript@5.5.3) tslib: specifier: ^2.6.3 version: 2.6.3 + tsx: + specifier: ^4.19.2 + version: 4.19.2 typedoc: specifier: ^0.26.4 version: 0.26.4(typescript@5.5.3) @@ -270,141 +273,147 @@ packages: '@bcoe/v8-coverage@0.2.3': resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} - '@esbuild/aix-ppc64@0.19.10': - resolution: {integrity: sha512-Q+mk96KJ+FZ30h9fsJl+67IjNJm3x2eX+GBWGmocAKgzp27cowCOOqSdscX80s0SpdFXZnIv/+1xD1EctFx96Q==} - engines: {node: '>=12'} + '@esbuild/aix-ppc64@0.23.1': + resolution: {integrity: sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==} + engines: {node: '>=18'} cpu: [ppc64] os: [aix] - '@esbuild/android-arm64@0.19.10': - resolution: {integrity: sha512-1X4CClKhDgC3by7k8aOWZeBXQX8dHT5QAMCAQDArCLaYfkppoARvh0fit3X2Qs+MXDngKcHv6XXyQCpY0hkK1Q==} - engines: {node: '>=12'} + '@esbuild/android-arm64@0.23.1': + resolution: {integrity: sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==} + engines: {node: '>=18'} cpu: [arm64] os: [android] - '@esbuild/android-arm@0.19.10': - resolution: {integrity: sha512-7W0bK7qfkw1fc2viBfrtAEkDKHatYfHzr/jKAHNr9BvkYDXPcC6bodtm8AyLJNNuqClLNaeTLuwURt4PRT9d7w==} - engines: {node: '>=12'} + '@esbuild/android-arm@0.23.1': + resolution: {integrity: sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==} + engines: {node: '>=18'} cpu: [arm] os: [android] - '@esbuild/android-x64@0.19.10': - resolution: {integrity: sha512-O/nO/g+/7NlitUxETkUv/IvADKuZXyH4BHf/g/7laqKC4i/7whLpB0gvpPc2zpF0q9Q6FXS3TS75QHac9MvVWw==} - engines: {node: '>=12'} + '@esbuild/android-x64@0.23.1': + resolution: {integrity: sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==} + engines: {node: '>=18'} cpu: [x64] os: [android] - '@esbuild/darwin-arm64@0.19.10': - resolution: {integrity: sha512-YSRRs2zOpwypck+6GL3wGXx2gNP7DXzetmo5pHXLrY/VIMsS59yKfjPizQ4lLt5vEI80M41gjm2BxrGZ5U+VMA==} - engines: {node: '>=12'} + '@esbuild/darwin-arm64@0.23.1': + resolution: {integrity: sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==} + engines: {node: '>=18'} cpu: [arm64] os: [darwin] - '@esbuild/darwin-x64@0.19.10': - resolution: {integrity: sha512-alfGtT+IEICKtNE54hbvPg13xGBe4GkVxyGWtzr+yHO7HIiRJppPDhOKq3zstTcVf8msXb/t4eavW3jCDpMSmA==} - engines: {node: '>=12'} + '@esbuild/darwin-x64@0.23.1': + resolution: {integrity: sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==} + engines: {node: '>=18'} cpu: [x64] os: [darwin] - '@esbuild/freebsd-arm64@0.19.10': - resolution: {integrity: sha512-dMtk1wc7FSH8CCkE854GyGuNKCewlh+7heYP/sclpOG6Cectzk14qdUIY5CrKDbkA/OczXq9WesqnPl09mj5dg==} - engines: {node: '>=12'} + '@esbuild/freebsd-arm64@0.23.1': + resolution: {integrity: sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==} + engines: {node: '>=18'} cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-x64@0.19.10': - resolution: {integrity: sha512-G5UPPspryHu1T3uX8WiOEUa6q6OlQh6gNl4CO4Iw5PS+Kg5bVggVFehzXBJY6X6RSOMS8iXDv2330VzaObm4Ag==} - engines: {node: '>=12'} + '@esbuild/freebsd-x64@0.23.1': + resolution: {integrity: sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==} + engines: {node: '>=18'} cpu: [x64] os: [freebsd] - '@esbuild/linux-arm64@0.19.10': - resolution: {integrity: sha512-QxaouHWZ+2KWEj7cGJmvTIHVALfhpGxo3WLmlYfJ+dA5fJB6lDEIg+oe/0//FuyVHuS3l79/wyBxbHr0NgtxJQ==} - engines: {node: '>=12'} + '@esbuild/linux-arm64@0.23.1': + resolution: {integrity: sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==} + engines: {node: '>=18'} cpu: [arm64] os: [linux] - '@esbuild/linux-arm@0.19.10': - resolution: {integrity: sha512-j6gUW5aAaPgD416Hk9FHxn27On28H4eVI9rJ4az7oCGTFW48+LcgNDBN+9f8rKZz7EEowo889CPKyeaD0iw9Kg==} - engines: {node: '>=12'} + '@esbuild/linux-arm@0.23.1': + resolution: {integrity: sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==} + engines: {node: '>=18'} cpu: [arm] os: [linux] - '@esbuild/linux-ia32@0.19.10': - resolution: {integrity: sha512-4ub1YwXxYjj9h1UIZs2hYbnTZBtenPw5NfXCRgEkGb0b6OJ2gpkMvDqRDYIDRjRdWSe/TBiZltm3Y3Q8SN1xNg==} - engines: {node: '>=12'} + '@esbuild/linux-ia32@0.23.1': + resolution: {integrity: sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==} + engines: {node: '>=18'} cpu: [ia32] os: [linux] - '@esbuild/linux-loong64@0.19.10': - resolution: {integrity: sha512-lo3I9k+mbEKoxtoIbM0yC/MZ1i2wM0cIeOejlVdZ3D86LAcFXFRdeuZmh91QJvUTW51bOK5W2BznGNIl4+mDaA==} - engines: {node: '>=12'} + '@esbuild/linux-loong64@0.23.1': + resolution: {integrity: sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==} + engines: {node: '>=18'} cpu: [loong64] os: [linux] - '@esbuild/linux-mips64el@0.19.10': - resolution: {integrity: sha512-J4gH3zhHNbdZN0Bcr1QUGVNkHTdpijgx5VMxeetSk6ntdt+vR1DqGmHxQYHRmNb77tP6GVvD+K0NyO4xjd7y4A==} - engines: {node: '>=12'} + '@esbuild/linux-mips64el@0.23.1': + resolution: {integrity: sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==} + engines: {node: '>=18'} cpu: [mips64el] os: [linux] - '@esbuild/linux-ppc64@0.19.10': - resolution: {integrity: sha512-tgT/7u+QhV6ge8wFMzaklOY7KqiyitgT1AUHMApau32ZlvTB/+efeCtMk4eXS+uEymYK249JsoiklZN64xt6oQ==} - engines: {node: '>=12'} + '@esbuild/linux-ppc64@0.23.1': + resolution: {integrity: sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==} + engines: {node: '>=18'} cpu: [ppc64] os: [linux] - '@esbuild/linux-riscv64@0.19.10': - resolution: {integrity: sha512-0f/spw0PfBMZBNqtKe5FLzBDGo0SKZKvMl5PHYQr3+eiSscfJ96XEknCe+JoOayybWUFQbcJTrk946i3j9uYZA==} - engines: {node: '>=12'} + '@esbuild/linux-riscv64@0.23.1': + resolution: {integrity: sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==} + engines: {node: '>=18'} cpu: [riscv64] os: [linux] - '@esbuild/linux-s390x@0.19.10': - resolution: {integrity: sha512-pZFe0OeskMHzHa9U38g+z8Yx5FNCLFtUnJtQMpwhS+r4S566aK2ci3t4NCP4tjt6d5j5uo4h7tExZMjeKoehAA==} - engines: {node: '>=12'} + '@esbuild/linux-s390x@0.23.1': + resolution: {integrity: sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==} + engines: {node: '>=18'} cpu: [s390x] os: [linux] - '@esbuild/linux-x64@0.19.10': - resolution: {integrity: sha512-SpYNEqg/6pZYoc+1zLCjVOYvxfZVZj6w0KROZ3Fje/QrM3nfvT2llI+wmKSrWuX6wmZeTapbarvuNNK/qepSgA==} - engines: {node: '>=12'} + '@esbuild/linux-x64@0.23.1': + resolution: {integrity: sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==} + engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/netbsd-x64@0.19.10': - resolution: {integrity: sha512-ACbZ0vXy9zksNArWlk2c38NdKg25+L9pr/mVaj9SUq6lHZu/35nx2xnQVRGLrC1KKQqJKRIB0q8GspiHI3J80Q==} - engines: {node: '>=12'} + '@esbuild/netbsd-x64@0.23.1': + resolution: {integrity: sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==} + engines: {node: '>=18'} cpu: [x64] os: [netbsd] - '@esbuild/openbsd-x64@0.19.10': - resolution: {integrity: sha512-PxcgvjdSjtgPMiPQrM3pwSaG4kGphP+bLSb+cihuP0LYdZv1epbAIecHVl5sD3npkfYBZ0ZnOjR878I7MdJDFg==} - engines: {node: '>=12'} + '@esbuild/openbsd-arm64@0.23.1': + resolution: {integrity: sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.23.1': + resolution: {integrity: sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==} + engines: {node: '>=18'} cpu: [x64] os: [openbsd] - '@esbuild/sunos-x64@0.19.10': - resolution: {integrity: sha512-ZkIOtrRL8SEJjr+VHjmW0znkPs+oJXhlJbNwfI37rvgeMtk3sxOQevXPXjmAPZPigVTncvFqLMd+uV0IBSEzqA==} - engines: {node: '>=12'} + '@esbuild/sunos-x64@0.23.1': + resolution: {integrity: sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==} + engines: {node: '>=18'} cpu: [x64] os: [sunos] - '@esbuild/win32-arm64@0.19.10': - resolution: {integrity: sha512-+Sa4oTDbpBfGpl3Hn3XiUe4f8TU2JF7aX8cOfqFYMMjXp6ma6NJDztl5FDG8Ezx0OjwGikIHw+iA54YLDNNVfw==} - engines: {node: '>=12'} + '@esbuild/win32-arm64@0.23.1': + resolution: {integrity: sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==} + engines: {node: '>=18'} cpu: [arm64] os: [win32] - '@esbuild/win32-ia32@0.19.10': - resolution: {integrity: sha512-EOGVLK1oWMBXgfttJdPHDTiivYSjX6jDNaATeNOaCOFEVcfMjtbx7WVQwPSE1eIfCp/CaSF2nSrDtzc4I9f8TQ==} - engines: {node: '>=12'} + '@esbuild/win32-ia32@0.23.1': + resolution: {integrity: sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==} + engines: {node: '>=18'} cpu: [ia32] os: [win32] - '@esbuild/win32-x64@0.19.10': - resolution: {integrity: sha512-whqLG6Sc70AbU73fFYvuYzaE4MNMBIlR1Y/IrUeOXFrWHxBEjjbZaQ3IXIQS8wJdAzue2GwYZCjOrgrU1oUHoA==} - engines: {node: '>=12'} + '@esbuild/win32-x64@0.23.1': + resolution: {integrity: sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==} + engines: {node: '>=18'} cpu: [x64] os: [win32] @@ -567,6 +576,15 @@ packages: rollup: optional: true + '@rollup/plugin-json@6.1.0': + resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + '@rollup/plugin-node-resolve@15.2.3': resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} engines: {node: '>=14.0.0'} @@ -716,9 +734,6 @@ packages: '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} - '@types/seedrandom@3.0.8': - resolution: {integrity: sha512-TY1eezMU2zH2ozQoAFAQFOPpvP15g+ZgSfTZt31AUUH/Rxtnz3H+A/Sv1Snw2/amp//omibc+AEkTaA8KUeOLQ==} - '@types/stack-utils@2.0.3': resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} @@ -1049,9 +1064,9 @@ packages: es-module-lexer@1.4.1: resolution: {integrity: sha512-cXLGjP0c4T3flZJKQSuziYoq7MlT+rnvfZjfp7h+I7K9BNX54kP9nyWvdbwjQ4u1iWbOL4u96fgeZLToQlZC7w==} - esbuild@0.19.10: - resolution: {integrity: sha512-S1Y27QGt/snkNYrRcswgRFqZjaTG5a5xM3EQo97uNBnH505pdzSNe/HLBq1v0RO7iK/ngdbhJB6mDAp0OK+iUA==} - engines: {node: '>=12'} + esbuild@0.23.1: + resolution: {integrity: sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==} + engines: {node: '>=18'} hasBin: true escalade@3.1.1: @@ -1209,6 +1224,9 @@ packages: get-tsconfig@4.7.2: resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} + get-tsconfig@4.8.1: + resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==} + glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -1996,6 +2014,11 @@ packages: tslib@2.6.3: resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} + tsx@4.19.2: + resolution: {integrity: sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==} + engines: {node: '>=18.0.0'} + hasBin: true + type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -2322,73 +2345,76 @@ snapshots: '@bcoe/v8-coverage@0.2.3': {} - '@esbuild/aix-ppc64@0.19.10': + '@esbuild/aix-ppc64@0.23.1': + optional: true + + '@esbuild/android-arm64@0.23.1': optional: true - '@esbuild/android-arm64@0.19.10': + '@esbuild/android-arm@0.23.1': optional: true - '@esbuild/android-arm@0.19.10': + '@esbuild/android-x64@0.23.1': optional: true - '@esbuild/android-x64@0.19.10': + '@esbuild/darwin-arm64@0.23.1': optional: true - '@esbuild/darwin-arm64@0.19.10': + '@esbuild/darwin-x64@0.23.1': optional: true - '@esbuild/darwin-x64@0.19.10': + '@esbuild/freebsd-arm64@0.23.1': optional: true - '@esbuild/freebsd-arm64@0.19.10': + '@esbuild/freebsd-x64@0.23.1': optional: true - '@esbuild/freebsd-x64@0.19.10': + '@esbuild/linux-arm64@0.23.1': optional: true - '@esbuild/linux-arm64@0.19.10': + '@esbuild/linux-arm@0.23.1': optional: true - '@esbuild/linux-arm@0.19.10': + '@esbuild/linux-ia32@0.23.1': optional: true - '@esbuild/linux-ia32@0.19.10': + '@esbuild/linux-loong64@0.23.1': optional: true - '@esbuild/linux-loong64@0.19.10': + '@esbuild/linux-mips64el@0.23.1': optional: true - '@esbuild/linux-mips64el@0.19.10': + '@esbuild/linux-ppc64@0.23.1': optional: true - '@esbuild/linux-ppc64@0.19.10': + '@esbuild/linux-riscv64@0.23.1': optional: true - '@esbuild/linux-riscv64@0.19.10': + '@esbuild/linux-s390x@0.23.1': optional: true - '@esbuild/linux-s390x@0.19.10': + '@esbuild/linux-x64@0.23.1': optional: true - '@esbuild/linux-x64@0.19.10': + '@esbuild/netbsd-x64@0.23.1': optional: true - '@esbuild/netbsd-x64@0.19.10': + '@esbuild/openbsd-arm64@0.23.1': optional: true - '@esbuild/openbsd-x64@0.19.10': + '@esbuild/openbsd-x64@0.23.1': optional: true - '@esbuild/sunos-x64@0.19.10': + '@esbuild/sunos-x64@0.23.1': optional: true - '@esbuild/win32-arm64@0.19.10': + '@esbuild/win32-arm64@0.23.1': optional: true - '@esbuild/win32-ia32@0.19.10': + '@esbuild/win32-ia32@0.23.1': optional: true - '@esbuild/win32-x64@0.19.10': + '@esbuild/win32-x64@0.23.1': optional: true '@eslint-community/eslint-utils@4.4.0(eslint@9.6.0)': @@ -2654,6 +2680,12 @@ snapshots: optionalDependencies: rollup: 4.22.4 + '@rollup/plugin-json@6.1.0(rollup@4.22.4)': + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@4.22.4) + optionalDependencies: + rollup: 4.22.4 + '@rollup/plugin-node-resolve@15.2.3(rollup@4.22.4)': dependencies: '@rollup/pluginutils': 5.1.0(rollup@4.22.4) @@ -2787,8 +2819,6 @@ snapshots: '@types/resolve@1.20.2': {} - '@types/seedrandom@3.0.8': {} - '@types/stack-utils@2.0.3': {} '@types/unist@3.0.2': {} @@ -3130,31 +3160,32 @@ snapshots: es-module-lexer@1.4.1: {} - esbuild@0.19.10: + esbuild@0.23.1: optionalDependencies: - '@esbuild/aix-ppc64': 0.19.10 - '@esbuild/android-arm': 0.19.10 - '@esbuild/android-arm64': 0.19.10 - '@esbuild/android-x64': 0.19.10 - '@esbuild/darwin-arm64': 0.19.10 - '@esbuild/darwin-x64': 0.19.10 - '@esbuild/freebsd-arm64': 0.19.10 - '@esbuild/freebsd-x64': 0.19.10 - '@esbuild/linux-arm': 0.19.10 - '@esbuild/linux-arm64': 0.19.10 - '@esbuild/linux-ia32': 0.19.10 - '@esbuild/linux-loong64': 0.19.10 - '@esbuild/linux-mips64el': 0.19.10 - '@esbuild/linux-ppc64': 0.19.10 - '@esbuild/linux-riscv64': 0.19.10 - '@esbuild/linux-s390x': 0.19.10 - '@esbuild/linux-x64': 0.19.10 - '@esbuild/netbsd-x64': 0.19.10 - '@esbuild/openbsd-x64': 0.19.10 - '@esbuild/sunos-x64': 0.19.10 - '@esbuild/win32-arm64': 0.19.10 - '@esbuild/win32-ia32': 0.19.10 - '@esbuild/win32-x64': 0.19.10 + '@esbuild/aix-ppc64': 0.23.1 + '@esbuild/android-arm': 0.23.1 + '@esbuild/android-arm64': 0.23.1 + '@esbuild/android-x64': 0.23.1 + '@esbuild/darwin-arm64': 0.23.1 + '@esbuild/darwin-x64': 0.23.1 + '@esbuild/freebsd-arm64': 0.23.1 + '@esbuild/freebsd-x64': 0.23.1 + '@esbuild/linux-arm': 0.23.1 + '@esbuild/linux-arm64': 0.23.1 + '@esbuild/linux-ia32': 0.23.1 + '@esbuild/linux-loong64': 0.23.1 + '@esbuild/linux-mips64el': 0.23.1 + '@esbuild/linux-ppc64': 0.23.1 + '@esbuild/linux-riscv64': 0.23.1 + '@esbuild/linux-s390x': 0.23.1 + '@esbuild/linux-x64': 0.23.1 + '@esbuild/netbsd-x64': 0.23.1 + '@esbuild/openbsd-arm64': 0.23.1 + '@esbuild/openbsd-x64': 0.23.1 + '@esbuild/sunos-x64': 0.23.1 + '@esbuild/win32-arm64': 0.23.1 + '@esbuild/win32-ia32': 0.23.1 + '@esbuild/win32-x64': 0.23.1 escalade@3.1.1: {} @@ -3333,6 +3364,10 @@ snapshots: dependencies: resolve-pkg-maps: 1.0.0 + get-tsconfig@4.8.1: + dependencies: + resolve-pkg-maps: 1.0.0 + glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -4093,12 +4128,12 @@ snapshots: optionalDependencies: '@babel/code-frame': 7.24.7 - rollup-plugin-esbuild@6.1.1(esbuild@0.19.10)(rollup@4.22.4): + rollup-plugin-esbuild@6.1.1(esbuild@0.23.1)(rollup@4.22.4): dependencies: '@rollup/pluginutils': 5.1.0(rollup@4.22.4) debug: 4.3.4 es-module-lexer: 1.4.1 - esbuild: 0.19.10 + esbuild: 0.23.1 get-tsconfig: 4.7.2 rollup: 4.22.4 transitivePeerDependencies: @@ -4235,7 +4270,7 @@ snapshots: dependencies: typescript: 5.5.3 - ts-jest@29.2.1(@babel/core@7.23.6)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.23.6))(esbuild@0.19.10)(jest@29.7.0(@types/node@20.14.10))(typescript@5.5.3): + ts-jest@29.2.1(@babel/core@7.23.6)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.23.6))(esbuild@0.23.1)(jest@29.7.0(@types/node@20.14.10))(typescript@5.5.3): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 @@ -4253,10 +4288,17 @@ snapshots: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 babel-jest: 29.7.0(@babel/core@7.23.6) - esbuild: 0.19.10 + esbuild: 0.23.1 tslib@2.6.3: {} + tsx@4.19.2: + dependencies: + esbuild: 0.23.1 + get-tsconfig: 4.8.1 + optionalDependencies: + fsevents: 2.3.3 + type-check@0.4.0: dependencies: prelude-ls: 1.2.1 diff --git a/rollup.config.ts b/rollup.config.ts index c7ae3ac5..8973957f 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,76 +1,88 @@ -import {defineConfig} from 'rollup'; -import resolve from '@rollup/plugin-node-resolve'; -import esbuild from 'rollup-plugin-esbuild'; -import commonjs from '@rollup/plugin-commonjs'; -import dts from 'rollup-plugin-dts'; +import { defineConfig } from 'rollup' +import json from '@rollup/plugin-json' +import resolve from '@rollup/plugin-node-resolve' +import esbuild from 'rollup-plugin-esbuild' +import commonjs from '@rollup/plugin-commonjs' +import dts from 'rollup-plugin-dts' + +const isDev = process.env.NODE_ENV === 'development' +const minify = isDev ? false : true export default defineConfig([ - { - input: { - index: 'src/fsrs/index.ts', - }, - output: [ - { - dir: 'dist', - entryFileNames: '[name].cjs', - format: 'cjs', - sourcemap: true, - exports: 'named', - footer: ({exports}) => - exports.length > 0 - ? 'module.exports = Object.assign(exports.default || {}, exports)' - : '', - }, - { - dir: 'dist', - entryFileNames: '[name].mjs', - format: 'esm', - sourcemap: true, - }, - ], - plugins: [ - resolve({preferBuiltins: true}), - esbuild({ - target: 'node18.0', - sourceMap: true, - minify: true, - }), - commonjs(), - ], - external: [], - }, - { - input: 'src/fsrs/index.ts', - output: { - file: 'dist/index.umd.js', - format: 'umd', - name: 'FSRS', - sourcemap: true, - }, - plugins: [ - resolve(), - esbuild({ - target: 'es2017', - minify: true, - sourceMap: true, - }), - commonjs(), - ], - external: [], + { + input: { + index: 'src/fsrs/index.ts', + }, + output: [ + { + dir: 'dist', + entryFileNames: '[name].cjs', + format: 'cjs', + sourcemap: true, + exports: 'named', + footer: ({ exports }) => + exports.length > 0 + ? 'module.exports = Object.assign(exports.default || {}, exports)' + : '', + }, + { + dir: 'dist', + entryFileNames: '[name].mjs', + format: 'esm', + sourcemap: true, + }, + ], + plugins: [ + json({ + preferConst: true, + compact: true, + }), + resolve({ preferBuiltins: true }), + esbuild({ + target: 'node18.0', + sourceMap: true, + minify: minify, + }), + commonjs(), + ], + external: [], + }, + { + input: 'src/fsrs/index.ts', + output: { + file: 'dist/index.umd.js', + format: 'umd', + name: 'FSRS', + sourcemap: true, }, - { - input: 'src/fsrs/index.ts', - output: { - file: 'dist/index.d.ts', - format: 'esm' - }, - plugins: [ - dts({ - // https://github.com/Swatinem/rollup-plugin-dts/issues/143 - compilerOptions: {preserveSymlinks: false}, - respectExternal: true, - }), - ], - external: [], + plugins: [ + json({ + preferConst: true, + compact: true, + }), + resolve(), + esbuild({ + target: 'es2017', + minify: minify, + sourceMap: true, + }), + commonjs(), + ], + external: [], + }, + { + input: 'src/fsrs/index.ts', + output: { + file: 'dist/index.d.ts', + format: 'esm', }, -]); + plugins: [ + dts({ + // https://github.com/Swatinem/rollup-plugin-dts/issues/143 + compilerOptions: { preserveSymlinks: false }, + respectExternal: true, + }), + ], + external: [], + }, +]) diff --git a/src/fsrs/default.ts b/src/fsrs/default.ts index bfa96d30..04af6ce0 100644 --- a/src/fsrs/default.ts +++ b/src/fsrs/default.ts @@ -1,5 +1,6 @@ import { Card, DateInput, FSRSParameters, State } from './models' import { TypeConvert } from './convert' +import { version } from '../../package.json'; export const default_request_retention = 0.9 export const default_maximum_interval = 36500 @@ -11,7 +12,7 @@ export const default_w = [ export const default_enable_fuzz = false export const default_enable_short_term = true -export const FSRSVersion: string = 'v4.6.0 using FSRS-5.0' +export const FSRSVersion: string = `v${version} using FSRS-5.0` export const generatorParameters = ( props?: Partial diff --git a/tsconfig.json b/tsconfig.json index 7685f890..3b44553b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,8 +11,10 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - "lib": ["esnext", "dom", "dom.iterable"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "lib": [ + "esnext" + ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ @@ -25,31 +27,31 @@ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "ESNext", /* Specify what module code is generated. */ + "module": "ESNext" /* Specify what module code is generated. */, // "rootDir": "./", /* Specify the root folder within your source files. */ - "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */, // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + "allowUmdGlobalAccess": true /* Allow accessing UMD globals from modules. */, // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ + "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ /* JavaScript Support */ - "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */, + "checkJs": true /* Enable error reporting in type-checked JavaScript files. */, // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ /* Emit */ - "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - "declarationMap": true, /* Create sourcemaps for d.ts files. */ - "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, + "declarationMap": true /* Create sourcemaps for d.ts files. */, + "emitDeclarationOnly": true /* Only output d.ts files and not JavaScript files. */, + "sourceMap": true /* Create source map files for emitted JavaScript files. */, // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./dist", /* Specify an output folder for all emitted files. */ + "outDir": "./dist" /* Specify an output folder for all emitted files. */, // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ @@ -70,13 +72,13 @@ /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */, + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ + "strict": true /* Enable all strict type-checking options. */, // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ @@ -98,16 +100,9 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": false /* Skip type checking all .d.ts files. */ }, "include": ["src"], "exclude": ["node_modules", "**/__tests__/*"], - "detectCycles": true, - "ts-node": { - "experimentalSpecifierResolution": "node", - "transpileOnly": true, // you can specify ts-node options here - "compilerOptions": { - "module": "commonjs" // you can also override compilerOptions. Only ts-node will use these overrides - } - }, + "detectCycles": true }