repo stringlengths 5 53 | pr_number int32 1 321k | task_type stringclasses 2
values | issue_text stringlengths 0 81.2k | pr_title stringlengths 1 319 | pr_body stringlengths 0 105k | base_sha stringlengths 40 40 | head_sha stringlengths 40 40 | gold_diff stringlengths 0 202M | changed_files listlengths 0 100 | review_threads listlengths 0 100 | test_patch stringlengths 0 23.4M | merged bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
typicode/husky | 1,338 | issue_to_patch | fix: add scripts field if not present | Fixed an error that occurs on installation if the `scripts` field is not present in package.json.
```
$ npx husky init
Need to install the following packages:
husky@9.0.1
Ok to proceed? (y)
file:///Users/takuya/.npm/_npx/0d92fdd791cc1044/node_modules/husky/bin.js:10
d.scripts.prepare = 'husky'
... | 513c2c95be44966afb0aaf7d96716c52782bcba3 | 1915c3ff6d6cb0e1f48544d98c6ca05444bf304f | diff --git a/bin.js b/bin.js
index ad6e1dd58..3a45f239b 100755
--- a/bin.js
+++ b/bin.js
@@ -7,6 +7,7 @@ let a = process.argv[2]
if (a == 'init') {
let p = process.env.npm_package_json
let d = JSON.parse(f.readFileSync(p))
+ d.scripts ||= {}
d.scripts.prepare = 'husky'
w('package.json', JSON.stringify(d, ... | [
"bin.js"
] | [
{
"comment": "```suggestion\r\n d.scripts ||= {}\r\n```\r\n\r\nIt's a bit shorter",
"path": "bin.js",
"hunk": "@@ -7,6 +7,7 @@ let a = process.argv[2]\n if (a == 'init') {\n let p = process.env.npm_package_json\n let d = JSON.parse(f.readFileSync(p))\n+ if (!d.scripts) { d.scripts = {} }",
"re... | true | ||
typicode/husky | 1,338 | comment_to_fix | fix: add scripts field if not present | ```suggestion
d.scripts ||= {}
```
It's a bit shorter | 513c2c95be44966afb0aaf7d96716c52782bcba3 | 1915c3ff6d6cb0e1f48544d98c6ca05444bf304f | diff --git a/bin.js b/bin.js
index ad6e1dd58..3a45f239b 100755
--- a/bin.js
+++ b/bin.js
@@ -7,6 +7,7 @@ let a = process.argv[2]
if (a == 'init') {
let p = process.env.npm_package_json
let d = JSON.parse(f.readFileSync(p))
+ d.scripts ||= {}
d.scripts.prepare = 'husky'
w('package.json', JSON.stringify(d, ... | [
"bin.js"
] | [
{
"comment": "```suggestion\r\n d.scripts ||= {}\r\n```\r\n\r\nIt's a bit shorter",
"path": "bin.js",
"hunk": "@@ -7,6 +7,7 @@ let a = process.argv[2]\n if (a == 'init') {\n let p = process.env.npm_package_json\n let d = JSON.parse(f.readFileSync(p))\n+ if (!d.scripts) { d.scripts = {} }",
"re... | true | ||
typicode/husky | 1,363 | issue_to_patch | docs: fix example | See #1362
Uses `CI=true` as pointed out by @jerome-benoit | c1bbd9b8583d900171b6c81d751f11e506d12c1e | 7e22b50f6d9050f6b064cf36da8da895bf0d1691 | diff --git a/docs/how-to.md b/docs/how-to.md
index 72ec79d75..2ca15a58b 100644
--- a/docs/how-to.md
+++ b/docs/how-to.md
@@ -68,14 +68,13 @@ Modify the `prepare` script to never fail:
You'll still get a `command not found` error message in your output which may be confusing. To make it silent, create `.husky/install... | [
"docs/how-to.md"
] | [] | true | ||
typicode/husky | 1,357 | issue_to_patch | Cannot run CI compatible install script
The installation scripts compatible with CI need to be modified for these reasons.
### Must indicate ES Modules because it uses top-level await
``` bash
PS C:path\to\directory> npm i
> directory@1.0.0 prepare
> node .husky/install.js
C:path\to\directory\.husky\inst... | docs: update install script to mjs and fix CI checks | close #1356 | 534bfed5139d37f528744b512bd8a9fd10b4f74a | 92849678d18f421d16305d6665ef2a2391406f00 | diff --git a/docs/how-to.md b/docs/how-to.md
index 66f0b870b..72ec79d75 100644
--- a/docs/how-to.md
+++ b/docs/how-to.md
@@ -66,21 +66,23 @@ Modify the `prepare` script to never fail:
"prepare": "husky || true"
```
-You'll still get a `command not found` error message in your output which may be confusing. To make ... | [
"docs/how-to.md"
] | [] | true | |
typicode/husky | 1,355 | issue_to_patch | chore: apply editorconfig to code only | f44635127c946ca1d6a02bc6d3ddb6defefea8a1 | 54a773ce435f93f140b18440aa134517cdeb5f95 | diff --git a/.editorconfig b/.editorconfig
index 62139e0f0..512137b6e 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,5 +1,5 @@
root = true
-[*]
+[*.{json,js,ts,sh}]
end_of_line = lf
indent_style = tab
insert_final_newline = false
| [
".editorconfig"
] | [] | true | |||
typicode/husky | 1,354 | issue_to_patch | docs: add favicon | https://github.com/typicode/husky/pull/1325 | 8314bef03770cfb8f69ac95616f5c325709eacce | 4ae8d09352cef9d9719b06aebfa2d85bd1efafaf | diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts
index 56840856d..0a77bb4b6 100644
--- a/docs/.vitepress/config.mts
+++ b/docs/.vitepress/config.mts
@@ -4,6 +4,9 @@ import { defineConfig } from 'vitepress'
export default defineConfig({
title: "Husky",
description: "Git hooks made easy",
+ he... | [
"docs/.vitepress/config.mts"
] | [] | true | ||
typicode/husky | 1,353 | issue_to_patch | fix: init error | 26697d17647aada4fa13fb993c78899c07403101 | f26f429f8bcfa4015ac41d75936de50464134a4e | diff --git a/bin.js b/bin.js
index 11164946d..13011eb92 100755
--- a/bin.js
+++ b/bin.js
@@ -7,7 +7,7 @@ let a = process.argv[2]
if (a == 'init') {
let p = 'package.json'
let d = JSON.parse(f.readFileSync(p))
- (d.scripts ||= {}).prepare = 'husky'
+ ;(d.scripts ||= {}).prepare = 'husky'
w('package.json', JS... | [
"bin.js",
"test.sh",
"test/7_init.sh",
"test/8_time.sh"
] | [] | diff --git a/test/7_init.sh b/test/7_init.sh
new file mode 100644
index 000000000..7a498cc41
--- /dev/null
+++ b/test/7_init.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+. test/functions.sh
+setup
+install
+
+npx --no-install husky init
\ No newline at end of file
diff --git a/test/7_time.sh b/test/8_time.sh
similarity index 100%
re... | true | ||
typicode/husky | 1,350 | issue_to_patch | docs: update path to startup files | e9526fd5f0579d665c10bce7cdc0cade751c2d63 | de4480e7cf2a15448604a34c5f4e320b50b8d9bc | diff --git a/docs/how-to.md b/docs/how-to.md
index 0443afc7e..66f0b870b 100644
--- a/docs/how-to.md
+++ b/docs/how-to.md
@@ -5,7 +5,7 @@
Husky allows you to execute local commands before running hooks. It reads commands from these files:
- `$XDG_CONFIG_HOME/husky/init.sh`
-- `~/.config/home/init.sh`
+- `~/.config/h... | [
"docs/how-to.md"
] | [] | true | |||
typicode/husky | 1,349 | issue_to_patch | refactor: simplify | 6b5d9df0c852f0f0024a9561b1d9183c1ed27879 | 1b587335157bc59ea98bb78e351b663e1dd845f0 | diff --git a/bin.js b/bin.js
index 5c54f50ec..17fc9030c 100755
--- a/bin.js
+++ b/bin.js
@@ -7,8 +7,7 @@ let a = process.argv[2]
if (a == 'init') {
let p = process.env.npm_package_json
let d = JSON.parse(f.readFileSync(p))
- d.scripts ||= {}
- d.scripts.prepare = 'husky'
+ (d.scripts ||= {}).prepare = 'husky'... | [
"bin.js"
] | [] | true | |||
typicode/husky | 1,346 | issue_to_patch | Husky 9 seems to setup .git/config `hooksPath` incorrectly for Windows
**Context**
- Terminal is Windows Command Prompt, using Git for Windows
- Using husky 9.0.2
When running `husky install` with v8, the .git/config file was correctly modified with:
hooksPath = .husky
When running `husky` with v9, th... | fix: fix git hooks path on windows | this fix #1345 #1344 | 31f21000d2bc486cf5bd3ffc183a00405467c9a0 | cfb65e12a8db70aeb83a4c4a0a5c23e1f4dcdf31 | diff --git a/index.js b/index.js
index 71e4caa9b..66932771b 100644
--- a/index.js
+++ b/index.js
@@ -10,7 +10,7 @@ export default (d = '.husky') => {
if (!f.existsSync('.git')) return `.git can't be found`
let _ = (x = '') => p.join(d, '_', x)
- let { status: s, stderr: e } = c.spawnSync('git', ['config', 'core.h... | [
"index.js"
] | [] | true | |
typicode/husky | 1,339 | issue_to_patch | fix: insert final newline | While it may be controversial, text files are generally preferred to end with a newline. | 513c2c95be44966afb0aaf7d96716c52782bcba3 | 65afc6ddef3f9bb73f0dc9f1fb99a9bd570cfbe4 | diff --git a/bin.js b/bin.js
index ad6e1dd58..b959f8faf 100755
--- a/bin.js
+++ b/bin.js
@@ -8,9 +8,9 @@ if (a == 'init') {
let p = process.env.npm_package_json
let d = JSON.parse(f.readFileSync(p))
d.scripts.prepare = 'husky'
- w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2))
+ w('package.... | [
"bin.js"
] | [] | true | ||
typicode/husky | 1,343 | issue_to_patch | docs: changelog link | e8d415028447f69209cb04b79c3053526ddaa564 | 8725993b355ee3ab585a475ff336128400b7fde9 | diff --git a/.github/README.md b/.github/README.md
index 14e45cee5..f31cedeee 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -6,6 +6,10 @@
Husky improves your commits and more 🐶 _woof!_
+## Changelog
+
+[Check out the v9 changelog](https://github.com/typicode/husky/releases/tag/v9.0.1) to discover all ... | [
".github/README.md",
"docs/index.md"
] | [] | true | |||
typicode/husky | 1,341 | issue_to_patch | chore: fix links in issue template | 08908dc364b86fb102a5dbcae1a23e18ea01617e | bb0cf3282ff35d01a4132f2448c1c1a5472f786c | diff --git a/.github/ISSUE_TEMPLATE/issue.md b/.github/ISSUE_TEMPLATE/issue.md
index 0853cd2fb..28e0d5912 100644
--- a/.github/ISSUE_TEMPLATE/issue.md
+++ b/.github/ISSUE_TEMPLATE/issue.md
@@ -9,10 +9,10 @@ assignees: ''
**Troubleshoot**
- [ ] Before creating an issue, please check:
-https://typicode.github.io/husk... | [
".github/ISSUE_TEMPLATE/issue.md"
] | [] | true | |||
typicode/husky | 1,336 | issue_to_patch | hooks work but the `git commit` command doesn't commit
Minimal Reproduction:
```sh
# Cloning test repository
$ git clone https://github.com/martiliones/husky-bug
$ cd husky-bug
# Installing husky
$ npm i
# Making changes into the test project
$ echo "some changes" > newfile.txt
$ git add .
# Commitin... | fix: exit code | Closes #1335
| 513c2c95be44966afb0aaf7d96716c52782bcba3 | e6febd1953ab514bba8b4e9f978e416c0e643472 | diff --git a/husky.sh b/husky.sh
index fe184c087..2467495b8 100644
--- a/husky.sh
+++ b/husky.sh
@@ -17,4 +17,4 @@ c=$?
[ $c != 0 ] && echo "husky - $h script failed (code $c)"
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
-exit 1
+exit $c
diff --git a/package-lock.json b/package-lock.json
index 41... | [
"husky.sh",
"package-lock.json"
] | [] | true | |
typicode/husky | 1,340 | issue_to_patch | docs: fix link | 36fa2e52042d1932ba6f9b0fb05378c86dff9917 | ff97161ec666f29cb9c20b313474ae2f921f9223 | diff --git a/.github/README.md b/.github/README.md
index 8d8ef6026..14e45cee5 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -19,8 +19,8 @@ Support this project by becoming a sponsor [here](https://github.com/sponsors/ty
### GitHub
<p align="center">
- <a href="./sponsorkit/sponsors.svg">
- <img src=... | [
".github/README.md"
] | [] | true | |||
typicode/husky | 1,337 | issue_to_patch | docs: typo | Just removed an extra space. | 513c2c95be44966afb0aaf7d96716c52782bcba3 | ccec3806ce077f16d3f56eb2ee1fb70a5d9a5af2 | diff --git a/docs/index.md b/docs/index.md
index 2c72c06cc..571ba7f01 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -38,7 +38,7 @@ Support this project by becoming a sponsor [here](https://github.com/sponsors/ty
- Adheres to Git's native hook organization
- Aligns with [npm](https://docs.npmjs.com/cli/v10/using-n... | [
"docs/index.md"
] | [] | true | ||
typicode/husky | 1,290 | issue_to_patch | Add simplified Chinese documentation | * Add simplified Chinese documentation
* Update vitepress to version 1.0.0-bete.6 | 97b149de21017174a2053d0cae7394e6cb875f86 | 78bd21eb4065381d3cdfecc8bd60a2f3840da15e | diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index 7f6a7b3ae..4d3df9212 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -22,4 +22,24 @@ export default defineConfig({
{ text: 'Migrating from v4', link: '/migrating-from-v4' },
],
},
+ locales: {
+ root: {... | [
"docs/.vitepress/config.ts",
"docs/zh/getting-started.md",
"docs/zh/guide.md",
"docs/zh/index.md",
"docs/zh/migrating-from-v4.md",
"docs/zh/troubleshooting.md",
"package-lock.json",
"package.json"
] | [] | true | ||
typicode/husky | 1,253 | issue_to_patch | docs: typo | Change from #1230 | 65b161f6e92ef760c4381a4a5a7091c777c2bc42 | c73440c3e050b1af206ef420b3a0e6ed2ad304f1 | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 44eeaf9ad..48e937ba0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,1 +1,1 @@
-By contributing, you agree to release your modifications under the MIT license (see the file LICENSE-MIT).
+By contributing, you agree to release your modifications under the MIT... | [
"CONTRIBUTING.md"
] | [] | true | ||
typicode/husky | 1,320 | issue_to_patch | Update troubleshooting.md | Having a pre-commit the previous documentation failed with
```shell
$ git commit
.husky/pre-commit: 9: /home/user/.huskyrc: [[: not found
```
Using this patch is compatible with /bin/bash | 6a5290c48cd148cc83f4ad1b07dd2d2cc4ce2a28 | 654bbba90d41b942e713f269e545d3c16327e101 | diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index bfe616fc4..cb1ed6051 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -21,7 +21,7 @@ export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# If you have an .nvmrc file, we use the relevant node version
-... | [
"docs/troubleshooting.md"
] | [] | true | ||
typicode/husky | 1,282 | issue_to_patch | docs: update hook references in migration guide | The migration guide shows mismatched hooks for the before and after examples, which can be confusing. | 97b149de21017174a2053d0cae7394e6cb875f86 | 5f10c4a58eec28acbeca1739238bc250efe65881 | diff --git a/docs/migrating-from-v4.md b/docs/migrating-from-v4.md
index 4db9b42d8..5cc060f71 100644
--- a/docs/migrating-from-v4.md
+++ b/docs/migrating-from-v4.md
@@ -18,7 +18,7 @@ If you were calling `package.json` scripts using `npm` or `yarn`, **you can simp
}
```
-```shell [.husky/commit-msg (v8)]
+```shell [... | [
"docs/migrating-from-v4.md"
] | [] | true | ||
typicode/json-server | 1,738 | issue_to_patch | Fix: Return JSON response for 404 errors instead of plain text | Replace plain text 404 responses with JSON (`{ error: "Not Found" }`) for consistency with other error responses. | 6ad7562b6aba175bec616d342e1319e8dbbad1af | 64be3cb160ea08a2041167b8d0feaf6f178f7432 | diff --git a/src/app.ts b/src/app.ts
index 45bf07302..40a70c046 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -159,7 +159,7 @@ export function createApp(db: Low<Data>, options: AppOptions = {}) {
app.use('/:name', (req, res) => {
const { data } = res.locals
if (data === undefined) {
- res.sendStatus(404... | [
"src/app.test.ts",
"src/app.ts"
] | [] | diff --git a/src/app.test.ts b/src/app.test.ts
index a336b547f..bac286d98 100644
--- a/src/app.test.ts
+++ b/src/app.test.ts
@@ -116,6 +116,10 @@ await test('createApp', async (t) => {
tc.statusCode,
`${response.status} !== ${tc.statusCode} ${tc.method} ${tc.url} failed`,
)
+ if (tc.status... | true | |
typicode/json-server | 1,739 | issue_to_patch | 1.0.0-beta.15 | ## Summary
- bump package version from `1.0.0-beta.14` to `1.0.0-beta.15`
- prepare next prerelease tag metadata in `package.json` | 8d42c4079342acd0a6bbc21c9575219235d4e493 | 1b038e3bc9efd9e05760fd2c253246528c483476 | diff --git a/package.json b/package.json
index 7bab4af7f..a1ac7be2b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "json-server",
- "version": "1.0.0-beta.14",
+ "version": "1.0.0-beta.15",
"description": "",
"keywords": [
"JSON",
| [
"package.json"
] | [] | true | ||
typicode/json-server | 1,737 | issue_to_patch | v1.0.0-beta.14 | 00b7d4c5769a96b04c2d7fe122ab6f49c792c8e4 | aad63f80462c61d87e82b20c0d07977e97456ccb | diff --git a/package.json b/package.json
index 6f7454689..7bab4af7f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "json-server",
- "version": "1.0.0-beta.13",
+ "version": "1.0.0-beta.14",
"description": "",
"keywords": [
"JSON",
| [
"package.json"
] | [] | true | |||
typicode/json-server | 1,735 | issue_to_patch | feat: use base64url random IDs | ## Summary
- switch generated IDs from 4-char hex to 8 random bytes encoded as base64url
- keep IDs short for users while greatly reducing collision risk | 352144e0f6c8227affacd78439b8dfb8647d2b99 | 89a0677d4c0968e21b9ce0be78799519b8cf547b | diff --git a/src/random-id.ts b/src/random-id.ts
index 1e1112436..e457aa031 100644
--- a/src/random-id.ts
+++ b/src/random-id.ts
@@ -1,5 +1,5 @@
import { randomBytes } from 'node:crypto'
export function randomId(): string {
- return randomBytes(2).toString('hex')
+ return randomBytes(8).toString('base64url')
}
| [
"src/random-id.ts"
] | [] | true | ||
typicode/json-server | 1,736 | issue_to_patch | fix: ignore client-provided resource IDs | ## Summary
- ensure created resources always keep a generated `id` even when the request body includes one
- add coverage for rejecting client-provided IDs during create operations | 352144e0f6c8227affacd78439b8dfb8647d2b99 | ede98494297cd413efe437a21177f627932dbcd3 | diff --git a/src/service.ts b/src/service.ts
index 9b5edd224..ad06bfa8f 100644
--- a/src/service.ts
+++ b/src/service.ts
@@ -146,7 +146,7 @@ export class Service {
const items = this.#get(name)
if (items === undefined || !Array.isArray(items)) return
- const item = { id: randomId(), ...data }
+ const ... | [
"src/service.test.ts",
"src/service.ts"
] | [] | diff --git a/src/service.test.ts b/src/service.test.ts
index b83b9ff69..d89e0654e 100644
--- a/src/service.test.ts
+++ b/src/service.test.ts
@@ -101,10 +101,13 @@ await test('find', async (t) => {
await test('create', async () => {
const post = { title: 'new post' }
- const res = await service.create(POSTS, post... | true | |
typicode/json-server | 1,730 | issue_to_patch | chore: update Tower sponsor image URL | ## Summary
- Update the Tower sponsor logo image in the README to use the new `jsonplaceholder.typicode.com` asset URL.
- Keep the existing sponsor link and image dimensions unchanged. | ba0a56ce72847db6725086ce49d650b8b30fd696 | fc039a8d9db8b54d357d98fe9790a4d3c883a2a9 | diff --git a/README.md b/README.md
index 6da48f701..2fc9ded8e 100644
--- a/README.md
+++ b/README.md
@@ -97,7 +97,7 @@ Run `json-server --help` for a list of options
| <a href="https://mockend.com/" target="_blank"><img src="https://jsonplaceholder.typicode.com/mockend.svg" height="100px"></a> ... | [
"README.md"
] | [] | true | ||
typicode/json-server | 1,729 | issue_to_patch | 1.0.0-beta.13 | ## Summary
- bump package version from `1.0.0-beta.12` to `1.0.0-beta.13`
- prepare next prerelease tag metadata in `package.json` | 743b6f36f34a1992af642961507de414814ddc53 | 8bd1949e815df750399f7826328336dd24e655a2 | diff --git a/package.json b/package.json
index f277bbb6e..6f7454689 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "json-server",
- "version": "1.0.0-beta.12",
+ "version": "1.0.0-beta.13",
"description": "",
"keywords": [
"JSON",
| [
"package.json"
] | [] | true | ||
typicode/json-server | 1,728 | issue_to_patch | feat: support system dark mode on index page | ## Summary
- add system-theme aware color tokens to the default index page using `light-dark()`
- enable automatic light/dark adaptation with `color-scheme: light dark`
- keep existing layout and interactions while making accents and chip styles theme-aware | d2b3decc5ea59b4e962be2e4bacaf7d2a476348b | 04b4b7caade742b28dd75290b1c9f95694685405 | diff --git a/views/index.html b/views/index.html
index c872356b6..8c77fa7a1 100644
--- a/views/index.html
+++ b/views/index.html
@@ -6,9 +6,14 @@
<title>JSON Server</title>
<style>
:root {
- --fg: #111;
- --muted: #999;
- --line: #e5e5e5;
+ color-scheme: light dark;
+ ... | [
"views/index.html"
] | [] | true | ||
typicode/json-server | 1,722 | issue_to_patch | fix: return 400 for invalid JSON request bodies | ## Summary
Return `400 Bad Request` instead of `404 Not Found` when POST/PUT/PATCH requests receive an invalid non-object JSON body.
## What changed
- Updated `withBody` in `src/app.ts`
- Updated `withIdAndBody` in `src/app.ts`
- Added tests in `src/app.test.ts` for invalid request bodies
## Why
Previo... | e98d8a02473f59e8a82024cf94181adf3d131ec1 | 503b96970edeb36c3f533acaa478176378b8e7cb | diff --git a/src/app.ts b/src/app.ts
index 78f90e7f7..45bf07302 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -68,9 +68,11 @@ function parseListParams(req: any) {
function withBody(action: (name: string, body: Record<string, unknown>) => Promise<unknown>) {
return async (req: any, res: any, next: any) => {
const... | [
"src/app.test.ts",
"src/app.ts"
] | [] | diff --git a/src/app.test.ts b/src/app.test.ts
index 904ece8ef..a336b547f 100644
--- a/src/app.test.ts
+++ b/src/app.test.ts
@@ -142,4 +142,37 @@ await test('createApp', async (t) => {
const data = await response.json()
assert.deepEqual(data, [{ id: '1', title: 'foo' }])
})
+
+ await t.test('POST /posts w... | true | |
typicode/json-server | 1,723 | issue_to_patch | redesign: cleaner index page | ## Summary
- Switch from monospace to system sans-serif font stack
- Remove custom bold weights, `<code>` tags, and `rel=` attributes
- Replace class-based selectors with structural ones (`header a`, `.topbar a`, `.list a`)
- Merge `.heart` and `.heart-fixed` into a single class
- Vercel-style fixed heart button (blac... | e98d8a02473f59e8a82024cf94181adf3d131ec1 | 6869a03646c56a88c635c7178111da678d587379 | diff --git a/views/index.html b/views/index.html
index ed311c493..c872356b6 100644
--- a/views/index.html
+++ b/views/index.html
@@ -1,95 +1,137 @@
<!doctype html>
-<html>
+<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title... | [
"views/index.html"
] | [] | true | ||
typicode/json-server | 1,718 | issue_to_patch | chore: bump prerelease version to v1.0.0-beta.12 | ## Summary
- bump package version to `1.0.0-beta.12` using `pnpm version prerelease`
- include the generated prerelease version/tag commit on this branch | 037609cc1daddcfb6cebccc194341806a3a3b920 | 6e4cb8957b0fc9191ae2f2decbf105dca88f7d32 | diff --git a/package.json b/package.json
index c73a97746..f277bbb6e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "json-server",
- "version": "1.0.0-beta.10",
+ "version": "1.0.0-beta.12",
"description": "",
"keywords": [
"JSON",
| [
"package.json"
] | [] | true | ||
typicode/json-server | 1,717 | issue_to_patch | Auto-insert `$schema` when missing from DB file on startup | When a DB file lacks a root-level `$schema` property, json-server now automatically inserts the README-documented default path, consistent with the existing id auto-fix behavior.
## Changes
- **`src/service.ts`**: Added `fixSchema(data)` helper that sets `$schema` to `./node_modules/json-server/schema.json` when abse... | da111a2b993aa6a1f56065fd08b4d824cf2de0b3 | 268b1d4fb93234814f2b7f7afafa7fb87ee323d8 | diff --git a/src/adapters/normalized-adapter.ts b/src/adapters/normalized-adapter.ts
new file mode 100644
index 000000000..e2d9e7284
--- /dev/null
+++ b/src/adapters/normalized-adapter.ts
@@ -0,0 +1,47 @@
+import type { Adapter } from 'lowdb'
+
+import { randomId } from '../random-id.ts'
+import type { Data, Item } fro... | [
"src/adapters/normalized-adapter.test.ts",
"src/adapters/normalized-adapter.ts",
"src/adapters/observer.ts",
"src/bin.ts",
"src/random-id.ts",
"src/service.test.ts",
"src/service.ts"
] | [] | diff --git a/src/adapters/normalized-adapter.test.ts b/src/adapters/normalized-adapter.test.ts
new file mode 100644
index 000000000..67f85a3ec
--- /dev/null
+++ b/src/adapters/normalized-adapter.test.ts
@@ -0,0 +1,63 @@
+import assert from 'node:assert/strict'
+import test from 'node:test'
+
+import type { Adapter } fr... | true | |
typicode/json-server | 1,716 | issue_to_patch | chore: prerelease v1.0.0-beta.10 | ## Summary
- bump prerelease version to v1.0.0-beta.10 using pnpm version prerelease
| cc3a31edb814b7046e42c9320382de0fdcb18884 | ff58db92cdf06a6dbf448a7d67090a88580672a5 | diff --git a/package.json b/package.json
index bb801c751..c73a97746 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "json-server",
- "version": "1.0.0-beta.9",
+ "version": "1.0.0-beta.10",
"description": "",
"keywords": [
"JSON",
| [
"package.json"
] | [] | true | ||
typicode/json-server | 1,715 | issue_to_patch | chore: add linting step to Node.js workflow | 9df3716a969a9eb6b188907cbf773e07952bd8fe | 1b1106fa89159e8c8a5900383fef85bd454de7f4 | diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 5bb7aa214..eb9b4230d 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -13,5 +13,6 @@ jobs:
node-version: "22.x"
cache: "pnpm"
- run: pnpm install
+ - run: pnpm run lint
... | [
".github/workflows/node.js.yml"
] | [] | true | |||
typicode/json-server | 1,714 | issue_to_patch | Add `contains`, `startsWith`, `endsWith` string query operators | - [x] Add `contains`, `startsWith`, `endsWith` to `WHERE_OPERATORS` in `where-operators.ts`
- [x] Handle the new operators in `matches-where.ts` (case-insensitive, ignore non-string fields)
- [x] Add tests to `parse-where.test.ts` for parsing
- [x] Add tests to `matches-where.test.ts` for matching behavior (43 tests pa... | 9df3716a969a9eb6b188907cbf773e07952bd8fe | f36465d5b5d73048f5afbe17d1dd0f1b7c2a3dfe | diff --git a/README.md b/README.md
index 78e5133e9..6da48f701 100644
--- a/README.md
+++ b/README.md
@@ -167,6 +167,9 @@ Operators:
- `gt` greater than, `gte` greater than or equal
- `eq` equal, `ne` not equal
- `in` included in comma-separated list
+- `contains` string contains (case-insensitive)
+- `startsWith` st... | [
"README.md",
"src/matches-where.test.ts",
"src/matches-where.ts",
"src/parse-where.test.ts",
"src/where-operators.ts"
] | [] | diff --git a/src/matches-where.test.ts b/src/matches-where.test.ts
index c3fb9e74c..26a2be4a9 100644
--- a/src/matches-where.test.ts
+++ b/src/matches-where.test.ts
@@ -35,6 +35,24 @@ await test('matchesWhere', async (t) => {
[{ a: { foo: 10 } }, true],
[{ a: { foo: 10, eq: 10 } }, true],
[{ missing: { f... | true | |
typicode/json-server | 1,713 | issue_to_patch | Log routes on file recovery after JSON parse error | When the watched db file has a JSON parse error and is subsequently fixed, routes were silently not logged if the endpoints hadn't changed — leaving no confirmation that the server recovered.
## Changes
- **`src/bin.ts`**: Introduce a `hadReadError` boolean flag alongside the existing `writing`/`prevEndpoints` state.... | 977a0bf6011f873cd1b093c24c80b40207548677 | ca4f6894a70bbe2a592fd9a820d538a7641f64b5 | diff --git a/src/bin.ts b/src/bin.ts
index bebe4e0b5..17d4cdd36 100644
--- a/src/bin.ts
+++ b/src/bin.ts
@@ -183,6 +183,7 @@ app.listen(port, () => {
// Watch file for changes
if (process.env["NODE_ENV"] !== "production") {
let writing = false; // true if the file is being written to by the app
+ let hadReadError... | [
"src/bin.ts"
] | [] | true | ||
typicode/json-server | 1,712 | issue_to_patch | Add SerpApi link and image to README | 24b988bdee376314a31975137d280c082d3dde75 | c59ee57beac07111f9282d3244a7929b4851f7e4 | diff --git a/README.md b/README.md
index 72c43ae14..78e5133e9 100644
--- a/README.md
+++ b/README.md
@@ -97,7 +97,9 @@ Run `json-server --help` for a list of options
| <a href="https://mockend.com/" target="_blank"><img src="https://jsonplaceholder.typicode.com/mockend.svg" height="100px"></a> ... | [
"README.md"
] | [] | true | |||
typicode/json-server | 1,708 | issue_to_patch | 1.0.0-beta.9 | d095822cf24c52e5bcd0d479898b1cac81dde738 | 22062bb88833168bacebee54a68d7512500e8b1a | diff --git a/package.json b/package.json
index f8e573537..bb801c751 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "json-server",
- "version": "1.0.0-beta.8",
+ "version": "1.0.0-beta.9",
"description": "",
"keywords": [
"JSON",
| [
"package.json"
] | [] | true | |||
typicode/json-server | 1,706 | issue_to_patch | Update keywords and license in package.json | 3193bd8629eab58b34384390fbf47ceff49304e3 | 122f74969c5c0c85d560ff2e529adcb8a70505ac | diff --git a/package.json b/package.json
index f81e13484..9216246a7 100644
--- a/package.json
+++ b/package.json
@@ -2,8 +2,22 @@
"name": "json-server",
"version": "1.0.0-beta.7",
"description": "",
- "keywords": [],
- "license": "SEE LICENSE IN ./LICENSE",
+ "keywords": [
+ "JSON",
+ "server",
+ "... | [
"package.json"
] | [] | true | |||
typicode/json-server | 1,707 | issue_to_patch | release: v1.0.0-beta.8 | ## Summary
- bump version to v1.0.0-beta.8 using pnpm prerelease | 3193bd8629eab58b34384390fbf47ceff49304e3 | 2124dd93e8973afbce37f4092cb17b8073ff7184 | diff --git a/package.json b/package.json
index f81e13484..ed54d38d5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "json-server",
- "version": "1.0.0-beta.7",
+ "version": "1.0.0-beta.8",
"description": "",
"keywords": [],
"license": "SEE LICENSE IN ./LICENSE",
| [
"package.json"
] | [] | true | ||
typicode/json-server | 1,705 | issue_to_patch | v1.0.0-beta.7 | ## Summary
- Move the `1.0.0-beta.7` version bump commit out of `main` into a dedicated release branch.
- Update `package.json` for the `v1.0.0-beta.7` release. | 7c8213badbc61406e0db83ab2f326b6edf109fa1 | e26929c8c83b159dd9f8e29af032c17c59adefa3 | diff --git a/package.json b/package.json
index 70f168a75..f81e13484 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "json-server",
- "version": "1.0.0-beta.6",
+ "version": "1.0.0-beta.7",
"description": "",
"keywords": [],
"license": "SEE LICENSE IN ./LICENSE",
| [
"package.json"
] | [] | true | ||
typicode/json-server | 1,704 | issue_to_patch | chore: update | e1bf0c7ddd7b3f9d423efc3fb8f78c27dfe9a60b | 32717041707eea7ce7461d7b18c281fdfe293c71 | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index e944bbcce..000000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,21 +0,0 @@
-## Agreement
-
-Thanks for your interest in contributing!
-
-By contributing to this project, you agree to the following:
-
-1. **Relicensing:** To support the project... | [
"CONTRIBUTING.md",
"LICENSE",
"README.md"
] | [] | true | |||
typicode/json-server | 1,703 | issue_to_patch | Fix formatting of JSON Server query examples | 4f21cce799f80eb429977b6260a0e48dab09766b | f949d853421793638eb05a0ac307fd52ecbaa087 | diff --git a/README.md b/README.md
index 835383592..f5fd955be 100644
--- a/README.md
+++ b/README.md
@@ -125,8 +125,8 @@ Run `json-server --help` for a list of options
JSON Server supports advanced querying out of the box:
```http
-GET /posts?views:gt=100 # Filter by condition
-GET /posts?_sort=-v... | [
"README.md"
] | [] | true | |||
typicode/json-server | 1,701 | issue_to_patch | docs: add in operator to conditions docs | ## Summary
- document the `in` query operator in the Conditions operator list
- add a matching `id:in=1,2,3` example alongside existing filter examples | 3306a128c9a26bed254fe315ada28b3f5d315890 | 2896c8176c69f861e398b094ff8e017160ebaff4 | diff --git a/README.md b/README.md
index aa1bb4f61..835383592 100644
--- a/README.md
+++ b/README.md
@@ -171,12 +171,14 @@ Operators:
- `lt` less than, `lte` less than or equal
- `gt` greater than, `gte` greater than or equal
- `eq` equal, `ne` not equal
+- `in` included in comma-separated list
Examples:
```ht... | [
"README.md"
] | [] | true | ||
typicode/json-server | 1,699 | issue_to_patch | docs: improve README clarity and fix formatting inconsistencies | ### Summary
Improves clarity and consistency in the README and fixes a small grammar issue in CONTRIBUTING.md. The updates focus on formatting consistency, clearer section structure, and accurate documentation of pagination behavior.
### What Changed
- Standardized code block language tags (`bash`, `http`, `js... | 62d245dd60704556f2bb938aeff638a58faadb5a | 38abb4bd38f44211fac15fe4fc6b7843ceda0b9a | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bbb830ad5..e944bbcce 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -4,7 +4,7 @@ Thanks for your interest in contributing!
By contributing to this project, you agree to the following:
-1. **Relicensing:** to support the project's sustainability and ensure... | [
"CONTRIBUTING.md",
"README.md"
] | [] | true | ||
typicode/json-server | 1,700 | issue_to_patch | feat: add in operator for where filters | ## Summary
- add `in` to supported where operators for query filtering
- parse comma-separated `:in`/`_in` values into arrays with existing coercion rules
- apply `in` matching in filter evaluation and add parse/matcher coverage tests | 62d245dd60704556f2bb938aeff638a58faadb5a | 96ec9c808beee4be9ef3bbd36aebe4be58761e71 | diff --git a/src/matches-where.ts b/src/matches-where.ts
index 07a7e7d86..8a1da629f 100644
--- a/src/matches-where.ts
+++ b/src/matches-where.ts
@@ -53,6 +53,10 @@ export function matchesWhere(obj: JsonObject, where: JsonObject): boolean {
if (knownOps.includes('gte') && !((field as any) >= (op.gte as any))) r... | [
"src/matches-where.test.ts",
"src/matches-where.ts",
"src/parse-where.test.ts",
"src/parse-where.ts",
"src/where-operators.ts"
] | [] | diff --git a/src/matches-where.test.ts b/src/matches-where.test.ts
index 66f00dc56..c3fb9e74c 100644
--- a/src/matches-where.test.ts
+++ b/src/matches-where.test.ts
@@ -26,6 +26,12 @@ await test('matchesWhere', async (t) => {
[{ or: [{ a: { lt: 0 } }, { b: { gt: 20 } }] }, false],
[{ nested: { a: { eq: 10 } }... | true | |
typicode/json-server | 1,698 | issue_to_patch | 1.0.0-beta.6 | ## Summary
- Bump package version to 1.0.0-beta.6 | ada86ac596867e32f6d609a7fc2191bbf0b47fb5 | 78de4100b1017637a41a1ce234b4299649d214d8 | diff --git a/package.json b/package.json
index 4ebd7b301..70f168a75 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "json-server",
- "version": "1.0.0-beta.5",
+ "version": "1.0.0-beta.6",
"description": "",
"keywords": [],
"license": "SEE LICENSE IN ./LICENSE",
| [
"package.json"
] | [] | true | ||
typicode/json-server | 1,696 | issue_to_patch | feat: add _where filtering, use new op separator, drop _start, _end, _limit | 221f2b855734d65309d09a849955a51db57c96ca | 07a43a16be108a83ce23e567eff3913c7381f18f | diff --git a/README.md b/README.md
index 75e0afe1d..a70782e7f 100644
--- a/README.md
+++ b/README.md
@@ -110,107 +110,108 @@ Run `json-server --help` for a list of options
>
> For more information, FAQs, and the rationale behind this, visit [https://fair.io/](https://fair.io/).
+## Query capabilities overview
+
+``... | [
"README.md",
"src/app.test.ts",
"src/app.ts",
"src/matches-where.test.ts",
"src/matches-where.ts",
"src/observer.ts",
"src/paginate.test.ts",
"src/paginate.ts",
"src/parse-where.test.ts",
"src/parse-where.ts",
"src/service.test.ts",
"src/service.ts",
"src/where-operators.ts"
] | [] | diff --git a/src/app.test.ts b/src/app.test.ts
index 3d4bf4925..904ece8ef 100644
--- a/src/app.test.ts
+++ b/src/app.test.ts
@@ -118,4 +118,28 @@ await test('createApp', async (t) => {
)
})
}
+
+ await t.test('GET /posts?_where=... uses JSON query', async () => {
+ // Reset data since previous tests ... | true | ||
typicode/json-server | 1,697 | issue_to_patch | Restore original README content above Query capabilities overview | Per feedback on #1696, the README introduction was simplified too aggressively. This PR restores the original content from `main` above the "Query capabilities overview" section while preserving the new query documentation.
**Restored sections:**
- Original title: `# JSON-Server` (with hyphen)
- CI badge and callout b... | 3e74640633ee6a8e986935efed24cdd1873f6fba | 64a119253dd86d5b70f2427695e351f8fea89361 | diff --git a/README.md b/README.md
index c1f32d07b..eba6fd7c6 100644
--- a/README.md
+++ b/README.md
@@ -1,53 +1,115 @@
-# JSON Server v1 (Beta)
+# JSON-Server
-Fast mock REST API from a JSON file.
+[](https://github.com/typ... | [
"README.md"
] | [] | true | ||
typicode/json-server | 1,695 | issue_to_patch | Add Git Tower image link to README | a2dbadadc52c8501e3043a7499e9f87271bcd4a9 | 1b0fe3372e2e2a89c51b355468309694006cd613 | diff --git a/README.md b/README.md
index 678bdfa8d..75e0afe1d 100644
--- a/README.md
+++ b/README.md
@@ -87,6 +87,7 @@ Run `json-server --help` for a list of options
| <a href="https://mockend.com/" target="_blank"><img src="https://jsonplaceholder.typicode.com/mockend.svg" height="100px"></a> ... | [
"README.md"
] | [] | true | |||
typicode/json-server | 1,694 | issue_to_patch | Update README with embedding changes | 83fbf30c831c2140a4e094ae00d5b77d86eee4d7 | 3c5617c1a085304cf6c04a388d9d3ad035328e6f | diff --git a/README.md b/README.md
index 9f80c37b0..678bdfa8d 100644
--- a/README.md
+++ b/README.md
@@ -213,4 +213,5 @@ json-server -s ./static -s ./node_modules
- `id` is always a string and will be generated for you if missing
- use `_per_page` with `_page` instead of `_limit`for pagination
+- use `_embed` inste... | [
"README.md"
] | [] | true | |||
typicode/json-server | 1,693 | issue_to_patch | chore: change test command from npm to pnpm | b76af60f77888586211228d12c19e57c73486012 | 61ae44e3e46b4bfd6c3022ebb320be30067473c1 | diff --git a/.husky/pre-commit b/.husky/pre-commit
index 72c4429bc..98475b507 100644
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -1,1 +1,1 @@
-npm test
+pnpm test
| [
".husky/pre-commit"
] | [] | true | |||
typicode/json-server | 1,674 | issue_to_patch | Regenerate package-lock.json to fix npm ci version mismatch | CI failing on PR #1672 due to package.json/package-lock.json version mismatches after dependency updates.
## Changes
- Updated package.json with dependency versions from node-ts branch:
- `@tinyhttp/app`: 2.4.0 → 3.0.1
- `@tinyhttp/logger`: 2.0.0 → 2.1.0
- `@types/node`: 22.5.5 → 25.0.6
- `chokidar`: 4.0.1 ... | 50aae21a4e9da54d0df8906453cea2b3e6a286bb | 17bf30efb3352e2c73a4d21a7e51f5f06351001b | diff --git a/package-lock.json b/package-lock.json
index a353b81ad..e09a1750f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,11 +9,11 @@
"version": "1.0.0-beta.3",
"license": "SEE LICENSE IN ./LICENSE",
"dependencies": {
- "@tinyhttp/app": "^2.4.0",
+ "@tinyhttp/app": "^... | [
"package-lock.json",
"package.json"
] | [] | true | ||
typicode/json-server | 1,670 | issue_to_patch | chore: use oxlint | Migrates linting from ESLint to oxlint, a faster Rust-based linter.
### Changes
- Replaced ESLint dependencies with `oxlint@1.39.0`
- Updated lint script: `eslint src` → `oxlint src`
- Removed `eslint.config.js` (oxlint uses sensible defaults)
### Node version requirement
- Updated from `>=18.3` to `^20.19.0 || >=22.... | f5dfdaff725ecd5384b1f922b37757f023e13b63 | 2b597c98485a8fed51a133e21c76bfbcf6bdc3a2 | diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 6204e5d05..140879d15 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
- node-version: [18.x, 20.x]
+ node-version: [20.x, 22.x]
# ... | [
".github/workflows/node.js.yml",
"eslint.config.js",
"package-lock.json",
"package.json"
] | [] | true | ||
typicode/json-server | 1,692 | issue_to_patch | Update documentation link in README | c5014ea24bd63a2b0b29ec824277cda673cec170 | ae52d88af293231f60f6d21ab77c22cfc15bfb83 | diff --git a/README.md b/README.md
index d4a2158eb..9f80c37b0 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
[](https://github.com/typicode/json-server/actions/workflows/node.js.yml)
> [!IMPORTANT]
-> Viewing beta ... | [
"README.md"
] | [] | true | |||
typicode/json-server | 1,675 | issue_to_patch | chore: update dev script | 193b12960c9621fa9bae41fae96a105b16a0d0b4 | 848216dda580ce418f81b20b72295eab4fe348e4 | diff --git a/package.json b/package.json
index 8a77994eb..c581e08d1 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"node": ">=22.12.0"
},
"scripts": {
- "dev": "node --experimental-strip-types src/bin.ts fixtures/db.json",
+ "dev": "node --watch --experimental-strip-types src/bin.ts fix... | [
"package.json"
] | [] | true | |||
typicode/json-server | 1,681 | issue_to_patch | feat: add JSON Schema | 918080b8df7568db5f4ffb172da2e01039a37574 | f81624323495e097670cd3e26348257d0d4ab3ca | diff --git a/README.md b/README.md
index f153f96de..bbdd20c2f 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,7 @@ Create a `db.json` or `db.json5` file
```json
{
+ "$schema": "./node_modules/json-server/schema.json",
"posts": [
{ "id": "1", "title": "a title", "views": 100 },
{ "id": "2", "title"... | [
"README.md",
"package.json",
"schema.json"
] | [] | true | |||
typicode/json-server | 1,682 | issue_to_patch | chore: update Node.js version to 24.x in publish workflow | 918080b8df7568db5f4ffb172da2e01039a37574 | 6539f38a52ba1a38d3cf1772f16741f9caab741b | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 72f5e12bb..400ad7e16 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -18,7 +18,7 @@ jobs:
version: 10
- uses: actions/setup-node@v6
with:
- node-version: "22.x"
+ ... | [
".github/workflows/publish.yml"
] | [] | true | |||
typicode/json-server | 1,690 | issue_to_patch | v1.0.0-beta.5 | c21fa06c6af0407a96de25a520881ed151f599f5 | c3f9f0acf5cfafc16a80368d7b7ca15137b94064 | diff --git a/package.json b/package.json
index 589f465c8..4ebd7b301 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "json-server",
- "version": "1.0.0-beta.4",
+ "version": "1.0.0-beta.5",
"description": "",
"keywords": [],
"license": "SEE LICENSE IN ./LICENSE",
| [
"package.json"
] | [] | true | |||
typicode/json-server | 1,691 | issue_to_patch | Update README | 58e8b0109925e957ad403373a6459e9dab1edff3 | 77c07ee09c83efae8ba7e6b951243613d7a3834a | diff --git a/README.md b/README.md
index bbdd20c2f..d4a2158eb 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
> Viewing beta v1 documentation – usable but expect breaking changes. For stable version, see [here](https://github.com/typicode/json-server/tree/v0)
> [!NOTE]
-> Using React ⚛️ ? Check my new projec... | [
"README.md"
] | [] | true | |||
typicode/json-server | 1,688 | issue_to_patch | chore: add tag flag for pnpm | 81612f59784d41dd21b2f4fd1c2b47ef92ee916f | 91303c8ef5ecc61abba2784c31f0b656c5a7604d | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 400ad7e16..e37b630d4 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -21,4 +21,4 @@ jobs:
node-version: "24.x"
registry-url: "https://registry.npmjs.org"
- run: pnpm install
- ... | [
".github/workflows/publish.yml"
] | [] | true | |||
typicode/json-server | 1,680 | issue_to_patch | chore: remove NODE_AUTH_TOKEN from publish workflow | Removed NODE_AUTH_TOKEN environment variable from publish step. | 012a5bd834c10ca2b3a9afc2dff061dad70bd53b | f29c741a1d1ad1cd43f4930abfb28b477e17c8f2 | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 0ee1dc13a..72f5e12bb 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -22,5 +22,3 @@ jobs:
registry-url: "https://registry.npmjs.org"
- run: pnpm install
- run: pnpm publish --prove... | [
".github/workflows/publish.yml"
] | [] | true | ||
typicode/json-server | 1,679 | issue_to_patch | chore: update publish.yml to include permissions | Add permissions for OIDC and content access in workflow | c44e0684f5020a1ecb5e0028628ae25f10ae49d7 | 8356c7282cf64ffa7c77f1befdc3b5b6b4033228 | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 385fb9ac5..0ee1dc13a 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -2,6 +2,9 @@ name: Publish Package to npmjs
on:
release:
types: [published]
+permissions:
+ id-token: write # Required for OI... | [
".github/workflows/publish.yml"
] | [] | true | ||
typicode/json-server | 1,678 | issue_to_patch | chore: update package.json version and publish script | ae8bfc0e0940722f8bef98ce95b5eea9139d6df4 | 5d9ed8c029615ae7dee174983189adb62dea4431 | diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/publish.yml
similarity index 87%
rename from .github/workflows/npm-publish.yml
rename to .github/workflows/publish.yml
index 8b47f3446..385fb9ac5 100644
--- a/.github/workflows/npm-publish.yml
+++ b/.github/workflows/publish.yml
@@ -18,6 +18,6 @@ jobs:
... | [
".github/workflows/publish.yml",
"package.json"
] | [] | true | |||
typicode/json-server | 1,677 | issue_to_patch | chore: Update outdated GitHub Actions version | This PR updates an outdated GitHub Action version.
- Updated `actions/setup-node` from `v4` to `v6` in `.github/workflows/npm-publish.yml` | c3afd0fb197bfc5e790bd1a3d2df8dce6f2a4780 | ec6f66c4d722b868ca101896eea7752aa0dd5b3a | diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 2d073a990..5bb7aa214 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -4,11 +4,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v5
+ - uses: actions/checkou... | [
".github/workflows/node.js.yml",
".github/workflows/npm-publish.yml"
] | [] | true | ||
typicode/json-server | 1,676 | issue_to_patch | fix: patch bug | 580a71faa6af7d39f2a9dc52e432f90998d6fb27 | 085548ae68603e95fdc4bec07e152b299800e348 | diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index a6b421c31..2d073a990 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -10,8 +10,8 @@ jobs:
version: 10
- uses: actions/setup-node@v4
with:
- node-version: '22.x'
- ... | [
".github/workflows/node.js.yml",
".github/workflows/npm-publish.yml",
".oxfmtrc.json",
".prettier.config.js",
"README.md",
"fixtures/db.json",
"fixtures/db.json5",
"package.json",
"pnpm-lock.yaml",
"public/test.html",
"src/app.test.ts",
"src/app.ts",
"src/bin.ts",
"src/observer.ts",
"src... | [] | diff --git a/src/app.test.ts b/src/app.test.ts
index 9f15d26a5..3d4bf4925 100644
--- a/src/app.test.ts
+++ b/src/app.test.ts
@@ -1,4 +1,4 @@
-import assert from 'node:assert/strict'
+ import assert from 'node:assert/strict'
import { writeFileSync } from 'node:fs'
import { join } from 'node:path'
import test from '... | true | ||
typicode/json-server | 1,672 | issue_to_patch | use TS natively and switch to pnpm | 89c714c89508e16e1402566dbba51eeaee745ecc | 63ad30f6e857989d7a6a9f32d5264db35b7300fe | diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 59943cef9..a6b421c31 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -1,31 +1,17 @@
-# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tes... | [
".github/workflows/node.js.yml",
".github/workflows/npm-publish.yml",
"package-lock.json",
"package.json",
"pnpm-lock.yaml",
"src/app.test.ts",
"src/app.ts",
"src/bin.ts",
"src/observer.ts",
"src/service.test.ts",
"tsconfig.json"
] | [
{
"comment": "Major version updates for `@tinyhttp/app` (2.4.0 → 3.0.1) and `chokidar` (4.0.1 → 5.0.0) may introduce breaking changes. While these updates are included in the lockfile, ensure that the application has been tested with these new versions and that no breaking changes affect the codebase. Review th... | diff --git a/src/app.test.ts b/src/app.test.ts
index 7faf530a6..9f15d26a5 100644
--- a/src/app.test.ts
+++ b/src/app.test.ts
@@ -7,8 +7,8 @@ import getPort from 'get-port'
import { Low, Memory } from 'lowdb'
import { temporaryDirectory } from 'tempy'
-import { createApp } from './app.js'
-import { Data } from './se... | true | ||
typicode/json-server | 1,671 | issue_to_patch | Drop Node.js 20 support and enforce erasable TypeScript syntax | Requires Node.js 22.12.0+ and restricts codebase to erasable-only TypeScript syntax for compatibility with Node.js native type stripping.
## Changes
- **Node.js version**: Updated from `^20.19.0 || >=22.12.0` to `>=22.12.0` in package.json and CI workflows
- **TypeScript**: Upgraded from 5.6.2 to 5.9.3 for `erasableS... | 03301bce8372a7a70f9dea93465810eea96c44f5 | 50aae21a4e9da54d0df8906453cea2b3e6a286bb | diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 140879d15..59943cef9 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
- node-version: [20.x, 22.x]
+ node-version: [22.x]
# See su... | [
".github/workflows/node.js.yml",
".github/workflows/npm-publish.yml",
"package-lock.json",
"package.json",
"src/service.ts",
"tsconfig.json"
] | [] | true | ||
typicode/json-server | 1,650 | issue_to_patch | Optional Fields are not filtered out with default condition.
### Issue
When querying with the default condition "=" on an optional field, records without this field appear in the result list.
### Expected Result
Only records which contain that optional field and matching its value to the condition appear in the resul... | fix: handle undefined case in filtering logic | # Fix: Optional Fields Filter
## Issue
When querying records with optional fields, records missing those fields were incorrectly included in results.
Example:
```json
// Data
{ "id": "1", "name": "test 1", "optionalField": "A" }
{ "id": "2", "name": "test 2" } // missing optionalField
// Query: GET /reco... | 990e02857c1e54f674d9d3901edba80cde404c0b | 1b87de53013007b1a02cef33a3796ce955f84270 | diff --git a/src/service.ts b/src/service.ts
index 0c1bdd294..bb7a63f3b 100644
--- a/src/service.ts
+++ b/src/service.ts
@@ -305,6 +305,8 @@ export class Service {
return itemValue === paramValue
case 'boolean':
return itemValue === (paramValue === 'true')
+ ... | [
"src/service.ts"
] | [] | true | |
typicode/json-server | 1,639 | issue_to_patch | perf: replace Object.entries/fromEntries with Object.keys for better performance | @typicode 👋
Thank you for providing such a great library. I have created this pull request to give you suggestions to improve the performance of `json-sever`.
We can improve performance by changing `Object.fromEntries + entries + map + filter` to `Object.keys + forEach`.
In my benchmark tests, I verified a pe... | 6d38bc118c53d02dd9ece9d70afdd53800dc6776 | cd5ea186ab15cb9ffa2fae8b1559bfad92ab0ec1 | diff --git a/src/app.ts b/src/app.ts
index b8c5e79e7..c8f6ff849 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -1,7 +1,7 @@
import { dirname, isAbsolute, join } from 'node:path'
import { fileURLToPath } from 'node:url'
-import { App } from '@tinyhttp/app'
+import { App, type Request } from '@tinyhttp/app'
import { co... | [
"src/app.ts"
] | [] | true | ||
typst/typst | 8,499 | issue_to_patch | Grouped Bibliography not working in all styles
### Description
When using multiple bibliographies, bibliographies within the same group (or an omitted group) should not start counting at 1; counting should continue across bibliographies.
For the ACM style, this is broken (did not test other styles).
example document... | Fix shared numbering for bibliography styles that use sorting | Fixes https://github.com/typst/typst/issues/8497#issuecomment-4692154342.
~~Requires https://github.com/typst/hayagriva/pull/487 to be merged and a hayagriva patch release to be cut before being merged.~~ | 8e10e47cb8f25e4195371e43b27b3839dc7470df | 9fd6c4d4c2fcddccae2aeb694209258b266e309e | diff --git a/Cargo.lock b/Cargo.lock
index 31bac6716247..0fffae24cc2a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -959,9 +959,9 @@ dependencies = [
[[package]]
name = "hayagriva"
-version = "0.10.0"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fe5f9b181c35b7aa0c... | [
"Cargo.lock",
"Cargo.toml",
"tests/ref/html/hashes.txt",
"tests/suite/model/bibliography.typ"
] | [] | diff --git a/tests/ref/html/hashes.txt b/tests/ref/html/hashes.txt
index af92a5603fe7..0c5cea546ff4 100644
--- a/tests/ref/html/hashes.txt
+++ b/tests/ref/html/hashes.txt
@@ -12,6 +12,7 @@ dfb3c710d089677eec69861ae5785a31 bibliography-group-mixed-full
c456aecc3b410f0b4f8705fc87e6d499 bibliography-group-mixed-styles
0... | true |
typst/typst | 8,498 | issue_to_patch | Apply percent-encoding to in-bundle cross-page links
### Description
I wish links across pages in a bundle could be [percent-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
Consider the example below.
Typst should create `文.pdf` and `%20.pdf` in the file system, and link to them as `%E6%96%87.pdf` and `%25... | Percent-encode relative paths in cross-link URIs | Fixes https://github.com/typst/typst/issues/8485 by percent encoding relative paths for cross-link URIs in bundles. In this case, it's relative clear that percent encoding is correct: Typst creates the URI in the first place. This makes it rather different from the `link` function where the user supplies the URI and it... | 8e10e47cb8f25e4195371e43b27b3839dc7470df | 5698f6c941e24ecb18ba08602e21ed04abdf31bb | diff --git a/Cargo.lock b/Cargo.lock
index 31bac6716247..6c5e3f40f518 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3366,6 +3366,7 @@ dependencies = [
"memchr",
"moxcms",
"palette",
+ "percent-encoding",
"phf 0.13.1",
"png",
"rayon",
diff --git a/crates/typst-library/Cargo.toml b/crates/typst-library/Cargo.t... | [
"Cargo.lock",
"crates/typst-library/Cargo.toml",
"crates/typst-library/src/model/link.rs",
"tests/ref/bundle/link-bundle-percent-encoding.txt",
"tests/suite/model/link.typ"
] | [] | diff --git a/tests/ref/bundle/link-bundle-percent-encoding.txt b/tests/ref/bundle/link-bundle-percent-encoding.txt
new file mode 100644
index 000000000000..d44d11957065
--- /dev/null
+++ b/tests/ref/bundle/link-bundle-percent-encoding.txt
@@ -0,0 +1,7 @@
+fe1bacaa29ce37eeefc67b852c12aa80 index.pdf
+bf97dd4a76ea0770ad38... | true |
typst/typst | 8,484 | issue_to_patch | Precision of variable font stretch range should be limited
### Description
The current Typst rc supports variable fonts (which is a great new feature!). When listing these fonts with `typst fonts --variants`, stretch ranges are displayed (if this is a variable feature). For certain values 14 decimal digits are displa... | Nicer font variant printing | Resolves #8481. The property is stored as a fixed-point value, so we format that directly now :sparkles:
```diff
Adwaita Mono
└ /usr/share/fonts/Adwaita/AdwaitaMono-Regular.ttf
Style: Normal, Weight: 400, Stretch: 100%
Merriweather 7pt
└ ./Merriweather[opsz,wdth,wght].ttf (Variable)
Sty... | 804b798842082717538b1b529ef625c1a9df54f3 | 9eadf7e3dd233963be7b661e6f47f412bf3e167e | diff --git a/crates/typst-cli/src/fonts.rs b/crates/typst-cli/src/fonts.rs
index 890d233d7d35..fd7c63b6005f 100644
--- a/crates/typst-cli/src/fonts.rs
+++ b/crates/typst-cli/src/fonts.rs
@@ -98,15 +98,16 @@ fn write_variant(
/// Formats a variation axis.
fn write_axis(f: &mut Formatter, axis: &FontAxis) -> fmt::Res... | [
"crates/typst-cli/src/fonts.rs",
"crates/typst-library/src/text/font/variant.rs",
"crates/typst-library/src/text/font/variations.rs"
] | [
{
"comment": "usually we use `typst_utils::round_with_precision` for this\n\nhttps://github.com/typst/typst/blob/380769ca95ae4b7fd713669a426d354cbecdee45/crates/typst-utils/src/round.rs#L26\n\nsee also:\n\nhttps://github.com/typst/typst/blob/380769ca95ae4b7fd713669a426d354cbecdee45/crates/typst-library/src/foun... | true | |
typst/typst | 8,484 | comment_to_fix | Nicer font variant printing | usually we use `typst_utils::round_with_precision` for this
https://github.com/typst/typst/blob/380769ca95ae4b7fd713669a426d354cbecdee45/crates/typst-utils/src/round.rs#L26
see also:
https://github.com/typst/typst/blob/380769ca95ae4b7fd713669a426d354cbecdee45/crates/typst-library/src/foundations/repr.rs#L95 | 804b798842082717538b1b529ef625c1a9df54f3 | 9eadf7e3dd233963be7b661e6f47f412bf3e167e | diff --git a/crates/typst-library/src/text/font/variations.rs b/crates/typst-library/src/text/font/variations.rs
index f53bac7b08da..31f10c9d51ca 100644
--- a/crates/typst-library/src/text/font/variations.rs
+++ b/crates/typst-library/src/text/font/variations.rs
@@ -1,7 +1,9 @@
+use std::fmt::{self, Display, Formatter}... | [
"crates/typst-library/src/text/font/variations.rs"
] | [
{
"comment": "usually we use `typst_utils::round_with_precision` for this\n\nhttps://github.com/typst/typst/blob/380769ca95ae4b7fd713669a426d354cbecdee45/crates/typst-utils/src/round.rs#L26\n\nsee also:\n\nhttps://github.com/typst/typst/blob/380769ca95ae4b7fd713669a426d354cbecdee45/crates/typst-library/src/foun... | true | ||
typst/typst | 8,450 | issue_to_patch | Improve diagnostic printing for `typst eval` | This PR uses `Rangemapper` in the `eval_string` call for the `eval` command so that we get ranges on diagnostics in the evaluated expression.
Doing so required adding a new `ExpressionWorld` to handle the `EXPRESSION_ID` similarly to how `SystemWorld` handles `STDIN_ID` and `EMPTY_ID` in `world.rs:167`.
This scre... | 13eb5cc67c5e56d84dc940e27ed022a00abf9df0 | 79aac6454aeaf1bcd117eeda82772a1f33152560 | diff --git a/crates/typst-cli/src/compile.rs b/crates/typst-cli/src/compile.rs
index 97ace54032ea..f5b69c2066ed 100644
--- a/crates/typst-cli/src/compile.rs
+++ b/crates/typst-cli/src/compile.rs
@@ -14,6 +14,7 @@ use typst::layout::PageRanges;
use typst::syntax::Span;
use typst_bundle::{Bundle, BundleOptions, Virtual... | [
"crates/typst-cli/src/compile.rs",
"crates/typst-cli/src/eval.rs"
] | [
{
"comment": "It's not necessarily a \"document\", could also be a bundle.",
"path": "crates/typst-cli/src/eval.rs",
"hunk": "@@ -35,13 +46,15 @@ pub fn eval(command: &'static EvalCommand) -> HintedStrResult<()> {\n };\n \n match output {\n- // Retrieve and print evaluation results.\n+ ... | true | ||
typst/typst | 8,450 | comment_to_fix | Improve diagnostic printing for `typst eval` | It's not necessarily a "document", could also be a bundle. | 13eb5cc67c5e56d84dc940e27ed022a00abf9df0 | 79aac6454aeaf1bcd117eeda82772a1f33152560 | diff --git a/crates/typst-cli/src/eval.rs b/crates/typst-cli/src/eval.rs
index 5ca87c79dbb7..53d340086111 100644
--- a/crates/typst-cli/src/eval.rs
+++ b/crates/typst-cli/src/eval.rs
@@ -1,21 +1,32 @@
+use std::sync::LazyLock;
+
use comemo::Track;
use ecow::eco_format;
-use typst::diag::{HintedStrResult, SourceResult... | [
"crates/typst-cli/src/eval.rs"
] | [
{
"comment": "It's not necessarily a \"document\", could also be a bundle.",
"path": "crates/typst-cli/src/eval.rs",
"hunk": "@@ -35,13 +46,15 @@ pub fn eval(command: &'static EvalCommand) -> HintedStrResult<()> {\n };\n \n match output {\n- // Retrieve and print evaluation results.\n+ ... | true | ||
typst/typst | 8,450 | comment_to_fix | Improve diagnostic printing for `typst eval` | ```suggestion
"<input-expression>".into()
``` | 13eb5cc67c5e56d84dc940e27ed022a00abf9df0 | 79aac6454aeaf1bcd117eeda82772a1f33152560 | diff --git a/crates/typst-cli/src/eval.rs b/crates/typst-cli/src/eval.rs
index 5ca87c79dbb7..53d340086111 100644
--- a/crates/typst-cli/src/eval.rs
+++ b/crates/typst-cli/src/eval.rs
@@ -1,21 +1,32 @@
+use std::sync::LazyLock;
+
use comemo::Track;
use ecow::eco_format;
-use typst::diag::{HintedStrResult, SourceResult... | [
"crates/typst-cli/src/eval.rs"
] | [
{
"comment": "```suggestion\n \"<input-expression>\".into()\n```",
"path": "crates/typst-cli/src/eval.rs",
"hunk": "@@ -81,23 +94,89 @@ pub fn eval(command: &'static EvalCommand) -> HintedStrResult<()> {\n Ok(())\n }\n \n-/// Evaluates the expression with code syntax mode and no scope.\n+... | true | ||
typst/typst | 8,483 | issue_to_patch | Bibliography with `full: true` breaks numbering offsets
### Description
The new `bibliography` implementation allows for multiple bibliographies.
However, a `bibliography` with `full: true` does not correctly update the numbering offset for consecutive bibliographies:
**Code**
```rust
#bibliography("a.bib", full: tr... | Fix numbering offset for `bibliography` with `full: true` and no citations | Fixes https://github.com/typst/typst/issues/8476
A `bibliography` with `full: true` and no citations pointing at it doesn't
advance its group's shared numbering offset, so the next bibliography starts
over at [1]:
| Before | After |
|--------|-------|
| <img width="350" alt="before" src="https://github.com/u... | 13eb5cc67c5e56d84dc940e27ed022a00abf9df0 | 0219908b7676b446a28cf8aa408a9c68f3ee86e9 | diff --git a/crates/typst-library/src/model/bibliography.rs b/crates/typst-library/src/model/bibliography.rs
index 90d6cf07bc89..f318e3b700bc 100644
--- a/crates/typst-library/src/model/bibliography.rs
+++ b/crates/typst-library/src/model/bibliography.rs
@@ -1093,13 +1093,16 @@ fn render<'a>(
if let Some(offset)... | [
"crates/typst-library/src/model/bibliography.rs",
"tests/ref/html/hashes.txt",
"tests/suite/model/bibliography.typ"
] | [] | diff --git a/tests/ref/html/hashes.txt b/tests/ref/html/hashes.txt
index 6c7dad277073..af92a5603fe7 100644
--- a/tests/ref/html/hashes.txt
+++ b/tests/ref/html/hashes.txt
@@ -4,6 +4,12 @@ a845db3f6f6d466d683136b703f44cf6 basic-table
3f625e61698549ccccf65b72a66b72e7 bibliography-csl-display
74b33b507da27e15d265f3217c8... | true |
typst/typst | 8,480 | issue_to_patch | Additional trait implementations for typst-kit | I went ahead and implemented `FileLoader` for the smart pointer types. Since it's not required to be `Send + Sync + 'static` we could even add the `&[mut] F where F: FileLoader` implementations too. But I left that out since I'm unsure how useful that is in practice.
The other commits fix a typo and add `Clone` to t... | 380769ca95ae4b7fd713669a426d354cbecdee45 | 7c78dbbfa5598182326d23c9babd76d9f12c2595 | diff --git a/crates/typst-kit/src/files.rs b/crates/typst-kit/src/files.rs
index faa5cb20cc4e..076e24df8502 100644
--- a/crates/typst-kit/src/files.rs
+++ b/crates/typst-kit/src/files.rs
@@ -5,6 +5,7 @@ use std::mem;
use std::path::{Path, PathBuf};
use std::str;
use std::str::Utf8Error;
+use std::sync::Arc;
use p... | [
"crates/typst-kit/src/files.rs",
"crates/typst-kit/src/packages.rs"
] | [] | true | ||
typst/typst | 8,477 | issue_to_patch | Mark changelog subheadings as bookmarked | The changelog subheadings are not `outlined` because it's a bit noisy, but having them as bookmarks in the PDF outline is still useful. | 380769ca95ae4b7fd713669a426d354cbecdee45 | 3517734de10f6a3adb6ecc70559ab8aadad58d20 | diff --git a/docs/content/changelog/index.typ b/docs/content/changelog/index.typ
index f268e34c8097..6075330f08a4 100644
--- a/docs/content/changelog/index.typ
+++ b/docs/content/changelog/index.typ
@@ -97,7 +97,7 @@
description: "Changes in Typst " + base-version,
class: "changelog",
context {
- se... | [
"docs/content/changelog/index.typ"
] | [] | true | ||
typst/typst | 7,629 | issue_to_patch | Spot colors | This PR adds spot colors to precisely request a given pigment in a professional print environment.
I have added the new type `spot-colorant`. Once constructed with a colorant name and a fallback color, the type has a single `.tint(Ratio)` method to construct a new spot color. `spot-colorant` accepts the special valu... | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-html/src/css/encode.rs b/crates/typst-html/src/css/encode.rs
index 1d1b281981fc..f728fb4e057f 100644
--- a/crates/typst-html/src/css/encode.rs
+++ b/crates/typst-html/src/css/encode.rs
@@ -6,7 +6,9 @@ use std::ops::Deref;
use ecow::{EcoString, EcoVec, eco_format};
use typst_library::diag::Wa... | [
"crates/typst-html/src/css/encode.rs",
"crates/typst-library/src/foundations/none.rs",
"crates/typst-library/src/visualize/color.rs",
"crates/typst-library/src/visualize/gradient.rs",
"crates/typst-library/src/visualize/paint.rs",
"crates/typst-pdf/src/convert.rs",
"crates/typst-pdf/src/paint.rs",
"cr... | [
{
"comment": "I wonder if we could get `#[scope]` to work across multiple impl blocks so we can split this into `scope_with_color_definitions! { Color, ... }` and `#[scope] impl Color { ... }` for more flexibility (would also allow multiple such macros).\n\nBut that seems complex enough to warrant a separate P... | diff --git a/tests/ref/pdf/hashes.txt b/tests/ref/pdf/hashes.txt
index 95e198b092b5..636e9da1c3c4 100644
--- a/tests/ref/pdf/hashes.txt
+++ b/tests/ref/pdf/hashes.txt
@@ -305,7 +305,7 @@ acd2cb260a6c4a3075a416cde559aa68 gradient-linear-repeat-and-mirror-2
572fc82c1a2d806ac02cd6ee4f7ec8df gradient-linear-sharp-and-repe... | true | |
typst/typst | 7,629 | comment_to_fix | Spot colors | I wonder if we could get `#[scope]` to work across multiple impl blocks so we can split this into `scope_with_color_definitions! { Color, ... }` and `#[scope] impl Color { ... }` for more flexibility (would also allow multiple such macros).
But that seems complex enough to warrant a separate PR, and in the worst case... | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/color.rs b/crates/typst-library/src/visualize/color.rs
index 3042e530588a..b2ffbde2646c 100644
--- a/crates/typst-library/src/visualize/color.rs
+++ b/crates/typst-library/src/visualize/color.rs
@@ -11,10 +11,10 @@ use palette::{
};
use typst_syntax::{Span, Spanned};
... | [
"crates/typst-library/src/visualize/color.rs"
] | [
{
"comment": "I wonder if we could get `#[scope]` to work across multiple impl blocks so we can split this into `scope_with_color_definitions! { Color, ... }` and `#[scope] impl Color { ... }` for more flexibility (would also allow multiple such macros).\n\nBut that seems complex enough to warrant a separate P... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | This probably doesn't matter too much, but it's worth noting that there are some other operations which use the fallback automatically, notably `to_hex` and other `to_` conversions, instead of throwing errors. Not sure if this would be too bad of an inconsistency, but it could be acceptable if we assume that those conv... | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/color.rs b/crates/typst-library/src/visualize/color.rs
index 3042e530588a..b2ffbde2646c 100644
--- a/crates/typst-library/src/visualize/color.rs
+++ b/crates/typst-library/src/visualize/color.rs
@@ -11,10 +11,10 @@ use palette::{
};
use typst_syntax::{Span, Spanned};
... | [
"crates/typst-library/src/visualize/color.rs"
] | [
{
"comment": "This probably doesn't matter too much, but it's worth noting that there are some other operations which use the fallback automatically, notably `to_hex` and other `to_` conversions, instead of throwing errors. Not sure if this would be too bad of an inconsistency, but it could be acceptable if we ... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | It seems like those are the exact same names. Perhaps you meant something like "c" instead of "C"?
```suggestion
/// `{"PANTONE 2221 C"}` and `{"PANTONE 2221 c"}` may be treated as
/// separate colors. Ensure that you are using a consistent naming
``` | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/color.rs b/crates/typst-library/src/visualize/color.rs
index 3042e530588a..b2ffbde2646c 100644
--- a/crates/typst-library/src/visualize/color.rs
+++ b/crates/typst-library/src/visualize/color.rs
@@ -11,10 +11,10 @@ use palette::{
};
use typst_syntax::{Span, Spanned};
... | [
"crates/typst-library/src/visualize/color.rs"
] | [
{
"comment": "It seems like those are the exact same names. Perhaps you meant something like \"c\" instead of \"C\"?\n\n```suggestion\n /// `{\"PANTONE 2221 C\"}` and `{\"PANTONE 2221 c\"}` may be treated as\n /// separate colors. Ensure that you are using a consistent naming\n```",
"path": "c... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | Since there are now multiple color spaces / types without an alpha channel, including any spot colors, perhaps we could list them more prominently within `color` docs, at the top. | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/color.rs b/crates/typst-library/src/visualize/color.rs
index 3042e530588a..b2ffbde2646c 100644
--- a/crates/typst-library/src/visualize/color.rs
+++ b/crates/typst-library/src/visualize/color.rs
@@ -11,10 +11,10 @@ use palette::{
};
use typst_syntax::{Span, Spanned};
... | [
"crates/typst-library/src/visualize/color.rs"
] | [
{
"comment": "Since there are now multiple color spaces / types without an alpha channel, including any spot colors, perhaps we could list them more prominently within `color` docs, at the top.",
"path": "crates/typst-library/src/visualize/color.rs",
"hunk": "@@ -1158,118 +1075,79 @@ impl Color {\n ... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | ```suggestion
"spot colorant `{repr}` appeared with multiple distinct fallback colors";
``` | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-pdf/src/convert.rs b/crates/typst-pdf/src/convert.rs
index 8068539a90a4..2b6eb01230c5 100644
--- a/crates/typst-pdf/src/convert.rs
+++ b/crates/typst-pdf/src/convert.rs
@@ -26,7 +26,7 @@ use typst_library::introspection::{Introspector, Location, PagedPosition, Tag};
use typst_library::layout:... | [
"crates/typst-pdf/src/convert.rs"
] | [
{
"comment": "```suggestion\n \"spot colorant `{repr}` appeared with multiple distinct fallback colors\";\n```",
"path": "crates/typst-pdf/src/convert.rs",
"hunk": "@@ -570,8 +572,13 @@ fn convert_error(\n \"{prefix} the PDF is missing a CMYK profile\";\n hint: \"C... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | this should be moved back | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-pdf/src/paint.rs b/crates/typst-pdf/src/paint.rs
index 45dbbc6670c9..fb81c23f4acf 100644
--- a/crates/typst-pdf/src/paint.rs
+++ b/crates/typst-pdf/src/paint.rs
@@ -2,7 +2,8 @@
use std::f64::consts::PI;
-use krilla::color::{self, cmyk, luma, rgb};
+use krilla::color::separation::Separatio... | [
"crates/typst-pdf/src/paint.rs"
] | [
{
"comment": "this should be moved back",
"path": "crates/typst-pdf/src/paint.rs",
"hunk": "@@ -1,25 +1,27 @@\n //! Convert paint types from Typst to krilla.\n \n-use std::f64::consts::PI;\n-\n-use krilla::color::{self, cmyk, luma, rgb};\n+use krilla::color::separation::SeparationSpace;\n+use krilla::co... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | it looks like this could just use `convert_solid` | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-pdf/src/paint.rs b/crates/typst-pdf/src/paint.rs
index 45dbbc6670c9..fb81c23f4acf 100644
--- a/crates/typst-pdf/src/paint.rs
+++ b/crates/typst-pdf/src/paint.rs
@@ -2,7 +2,8 @@
use std::f64::consts::PI;
-use krilla::color::{self, cmyk, luma, rgb};
+use krilla::color::separation::Separatio... | [
"crates/typst-pdf/src/paint.rs"
] | [
{
"comment": "it looks like this could just use `convert_solid`",
"path": "crates/typst-pdf/src/paint.rs",
"hunk": "@@ -280,7 +302,14 @@ fn convert_gradient_stops(gradient: &Gradient) -> Vec<Stop> {\n let mut stops = vec![];\n \n let mut add_single = |color: &Color, offset: Ratio| {\n- le... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | ```suggestion
match self.to_process() {
``` | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-svg/src/paint.rs b/crates/typst-svg/src/paint.rs
index b6585c952542..20752ab72b0d 100644
--- a/crates/typst-svg/src/paint.rs
+++ b/crates/typst-svg/src/paint.rs
@@ -5,7 +5,7 @@ use typst_library::layout::{
Abs, Angle, Axes, Frame, Point, Quadrant, Ratio, Size, Transform,
};
use typst_li... | [
"crates/typst-svg/src/paint.rs"
] | [
{
"comment": "```suggestion\n match self.to_process() {\n```",
"path": "crates/typst-svg/src/paint.rs",
"hunk": "@@ -436,14 +443,16 @@ impl From<&Gradient> for GradientKind {\n \n impl SvgDisplay for Color {\n fn fmt(&self, f: &mut impl SvgWrite) {\n- match *self {\n- c @ Co... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | this seems incorrect, since it expects the _constructor_ `color.hsv`, but an _instance_ of `color.spot`, yet both are listed here equivalently | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/tests/suite/visualize/color.typ b/tests/suite/visualize/color.typ
index 14ce977e77fe..05b1fd15b206 100644
--- a/tests/suite/visualize/color.typ
+++ b/tests/suite/visualize/color.typ
@@ -38,7 +38,7 @@
#rgb(color.mix(red, blue, white, space: color.hsl))
--- color-conversion eval ---
-// Test color conver... | [
"tests/suite/visualize/color.typ"
] | [
{
"comment": "this seems incorrect, since it expects the _constructor_ `color.hsv`, but an _instance_ of `color.spot`, yet both are listed here equivalently",
"path": "tests/suite/visualize/color.typ",
"hunk": "@@ -220,15 +220,15 @@\n #color.mix((red, 1, 2))\n \n --- color-mix-bad-space-type eval ---\n-... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | Please terminate the comments with full stops | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/tests/suite/visualize/color.typ b/tests/suite/visualize/color.typ
index 14ce977e77fe..05b1fd15b206 100644
--- a/tests/suite/visualize/color.typ
+++ b/tests/suite/visualize/color.typ
@@ -38,7 +38,7 @@
#rgb(color.mix(red, blue, white, space: color.hsl))
--- color-conversion eval ---
-// Test color conver... | [
"tests/suite/visualize/color.typ"
] | [
{
"comment": "Please terminate the comments with full stops",
"path": "tests/suite/visualize/color.typ",
"hunk": "@@ -327,3 +327,75 @@\n // output with a PDF comparison script.\n #rect(fill: red.transparentize(50%))\n #image(\"/assets/images/tiger.jpg\", width: 45pt)\n+\n+--- spot-color-basic paged ---\... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | this test seems to be failing in disguise | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/tests/suite/visualize/gradient.typ b/tests/suite/visualize/gradient.typ
index 49c848510478..55b3bd615dd8 100644
--- a/tests/suite/visualize/gradient.typ
+++ b/tests/suite/visualize/gradient.typ
@@ -634,7 +634,7 @@ $ A = mat(
#test(gradient.linear(red, green, blue).kind(), gradient.linear)
--- gradient-... | [
"tests/suite/visualize/gradient.typ"
] | [
{
"comment": "this test seems to be failing in disguise",
"path": "tests/suite/visualize/gradient.typ",
"hunk": "@@ -634,6 +634,7 @@ $ A = mat(\n #test(gradient.linear(red, green, blue).kind(), gradient.linear)\n \n --- gradient-stops eval ---\n+// Error: 2-90 Assertion failed: (\\n (oklab(65.95%, 0.2,... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | ```suggestion
#[ty(scope, name = "spot", title = "Spot Colorant")]
```
this way, also the long type name becomes (lowercased) "spot colorant" and error messages will say "expected spot colorant, found X" instead "expected spot, found X" | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/color.rs b/crates/typst-library/src/visualize/color.rs
index 3042e530588a..b2ffbde2646c 100644
--- a/crates/typst-library/src/visualize/color.rs
+++ b/crates/typst-library/src/visualize/color.rs
@@ -11,10 +11,10 @@ use palette::{
};
use typst_syntax::{Span, Spanned};
... | [
"crates/typst-library/src/visualize/color.rs"
] | [
{
"comment": "```suggestion\n#[ty(scope, name = \"spot\", title = \"Spot Colorant\")]\n```\nthis way, also the long type name becomes (lowercased) \"spot colorant\" and error messages will say \"expected spot colorant, found X\" instead \"expected spot, found X\"",
"path": "crates/typst-library/src/visualiz... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | this seems either outdated or random | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/color.rs b/crates/typst-library/src/visualize/color.rs
index 3042e530588a..b2ffbde2646c 100644
--- a/crates/typst-library/src/visualize/color.rs
+++ b/crates/typst-library/src/visualize/color.rs
@@ -11,10 +11,10 @@ use palette::{
};
use typst_syntax::{Span, Spanned};
... | [
"crates/typst-library/src/visualize/color.rs"
] | [
{
"comment": "this seems either outdated or random",
"path": "crates/typst-library/src/visualize/color.rs",
"hunk": "@@ -1881,6 +2302,196 @@ impl Cmyk {\n }\n }\n \n+/// A Spot color.\n+#[derive(Debug, Clone, Eq, PartialEq, Hash)]\n+pub struct SpotColor {\n+ /// How much of the colorant to apply ... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | I would at least like to consider dropping `NoColorant` here and renaming `AllColorants` to `All` and then using `None` in the `name` field of `SpotColorant`. Having custom none variants (especially when they map from Typst's `none`) feels a bit like a code smell. | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/color.rs b/crates/typst-library/src/visualize/color.rs
index 3042e530588a..b2ffbde2646c 100644
--- a/crates/typst-library/src/visualize/color.rs
+++ b/crates/typst-library/src/visualize/color.rs
@@ -11,10 +11,10 @@ use palette::{
};
use typst_syntax::{Span, Spanned};
... | [
"crates/typst-library/src/visualize/color.rs"
] | [
{
"comment": "I would at least like to consider dropping `NoColorant` here and renaming `AllColorants` to `All` and then using `None` in the `name` field of `SpotColorant`. Having custom none variants (especially when they map from Typst's `none`) feels a bit like a code smell.",
"path": "crates/typst-libra... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | should we use backticks for the strings here? Also, it's a bit unclear whether "All" is a PDF or Typst name here. | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/color.rs b/crates/typst-library/src/visualize/color.rs
index 3042e530588a..b2ffbde2646c 100644
--- a/crates/typst-library/src/visualize/color.rs
+++ b/crates/typst-library/src/visualize/color.rs
@@ -11,10 +11,10 @@ use palette::{
};
use typst_syntax::{Span, Spanned};
... | [
"crates/typst-library/src/visualize/color.rs"
] | [
{
"comment": "should we use backticks for the strings here? Also, it's a bit unclear whether \"All\" is a PDF or Typst name here.",
"path": "crates/typst-library/src/visualize/color.rs",
"hunk": "@@ -1881,6 +2302,196 @@ impl Cmyk {\n }\n }\n \n+/// A Spot color.\n+#[derive(Debug, Clone, Eq, PartialE... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | ```suggestion
#let html-headings = (html.h1, html.h2, html.h3, html.h4, html.h5, html.h6)
#let html-heading-n(n, ..args) = {
assert(n > 0)
let fn = html-headings.at(n - 1, default: html.h6)
fn(..args)
}
``` | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/docs/components/base.typ b/docs/components/base.typ
index 5293d04d8d50..8015e0404c0d 100644
--- a/docs/components/base.typ
+++ b/docs/components/base.typ
@@ -73,6 +73,13 @@
#let is-short-state = state("is-short", false)
+#let html-headings = (html.h1, html.h2, html.h3, html.h4, html.h5, html.h6)
+#let... | [
"docs/components/base.typ"
] | [
{
"comment": "```suggestion\n#let html-headings = (html.h1, html.h2, html.h3, html.h4, html.h5, html.h6)\n#let html-heading-n(n, ..args) = {\n assert(n > 0)\n let fn = html-headings.at(n - 1, default: html.h6)\n fn(..args)\n}\n```",
"path": "docs/components/base.typ",
"hunk": "@@ -73,6 +73,24 @@\n \n... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | ```suggestion
(!space.span.is_detached()).then_some(space.span);
``` | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/gradient.rs b/crates/typst-library/src/visualize/gradient.rs
index 9cd60df6aa14..d93f17bd6183 100644
--- a/crates/typst-library/src/visualize/gradient.rs
+++ b/crates/typst-library/src/visualize/gradient.rs
@@ -3,16 +3,18 @@ use std::fmt::{self, Debug, Formatter};
use st... | [
"crates/typst-library/src/visualize/gradient.rs"
] | [
{
"comment": "```suggestion\n (!space.span.is_detached()).then_some(space.span);\n```",
"path": "crates/typst-library/src/visualize/gradient.rs",
"hunk": "@@ -1283,16 +1296,115 @@ cast! {\n angle: Angle => Self::Angle(angle),\n }\n \n-/// Pre-processes the stops, checking that they are valid ... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | creating an intermediate `let color = s.v. ....` would make this more readable | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/gradient.rs b/crates/typst-library/src/visualize/gradient.rs
index 9cd60df6aa14..d93f17bd6183 100644
--- a/crates/typst-library/src/visualize/gradient.rs
+++ b/crates/typst-library/src/visualize/gradient.rs
@@ -3,16 +3,18 @@ use std::fmt::{self, Debug, Formatter};
use st... | [
"crates/typst-library/src/visualize/gradient.rs"
] | [
{
"comment": "creating an intermediate `let color = s.v. ....` would make this more readable",
"path": "crates/typst-library/src/visualize/gradient.rs",
"hunk": "@@ -1283,16 +1296,115 @@ cast! {\n angle: Angle => Self::Angle(angle),\n }\n \n-/// Pre-processes the stops, checking that they are valid ... | true | ||
typst/typst | 7,629 | comment_to_fix | Spot colors | ```suggestion
``` | b758c5691a0031b5eb0f7c7ce73a3f356e1fc7a4 | 3e32cb92f14268571eb3113012ff5b83edef1e41 | diff --git a/crates/typst-library/src/visualize/gradient.rs b/crates/typst-library/src/visualize/gradient.rs
index 9cd60df6aa14..d93f17bd6183 100644
--- a/crates/typst-library/src/visualize/gradient.rs
+++ b/crates/typst-library/src/visualize/gradient.rs
@@ -3,16 +3,18 @@ use std::fmt::{self, Debug, Formatter};
use st... | [
"crates/typst-library/src/visualize/gradient.rs"
] | [
{
"comment": "```suggestion\n```",
"path": "crates/typst-library/src/visualize/gradient.rs",
"hunk": "@@ -1310,13 +1422,14 @@ fn process_stops(stops: &[Spanned<GradientStop>]) -> SourceResult<Vec<(Color, Ra\n last_stop = stop.get();\n }\n \n- let out = stops\n- .ite... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.