Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove more bytes from parser#401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
blakeembrey merged 1 commit intomasterfrombe/more-shrinking
Sep 2, 2025
Merged

Conversation

@blakeembrey
Copy link
Member

Realized using the same token type strings would improve compression and found some other small byte savings. At this point the next largest size improvement would be moving to ESM so I think this is the last bump available, but I welcome PRs that remove more bytes in the minified output without affecting readability.

Before: 1.93 kB
After: 1.88 kB

@blakeembreyblakeembrey requested a review froma teamAugust 25, 2025 19:36
@codecov
Copy link

codecovbot commentedAug 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2a7f2a4) to head (77d6189).

Additional details and impacted files
@@            Coverage Diff            @@##            master      #401   +/-   ##=========================================  Coverage   100.00%   100.00%           =========================================  Files            1         1             Lines          378       369    -9       Branches       136       132    -4     =========================================- Hits           378       369    -9

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

if(next.type!=="CHAR"&&next.type!=="ESCAPED")break;
pos++;
path+=next.value;
consttoken=tokens[pos++];
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Surprised me, but removing destructuring helped.

|"wildcard"
|"param"
|"char"
|"escape"
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

"ESCAPED" -> "escape" arguably reads better in an error (Unexpected escape at index 12). That said, I don't think type would ever show in an error anyway, the only unexpected token is "end".

|"param"
|"char"
|"escape"
|"end"
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

All these types are also internal only, never exposed, so renaming them is safe (only the error changes for "Unexpected END").

@blakeembreyblakeembrey merged commit9df2448 intomasterSep 2, 2025
8 checks passed
@blakeembreyblakeembrey deleted the be/more-shrinking branchSeptember 2, 2025 20:51
Szotkowski added a commit to Selecro/Selecro-backend that referenced this pull requestOct 5, 2025
![snyk-top-banner](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)<h3>Snyk has created this PR to upgrade path-to-regexp from 8.2.0 to8.3.0.</h3>:information_source: Keep your dependencies up-to-date. This makes iteasier to fix existing vulnerabilities and to more quickly identify andfix newly disclosed vulnerabilities when they affect your project.<hr/>- The recommended version is **1 version** ahead of your currentversion.- The recommended version was released **25 days ago**.<details><summary><b>Release notes</b></summary><br/>  <details>    <summary>Package name: <b>path-to-regexp</b></summary>    <ul>      <li><b>8.3.0</b> - <ahref="https://redirect.github.com/pillarjs/path-to-regexp/releases/tag/v8.3.0">2025-09-02</a></br><p><strong>Changed</strong></p><ul><li>Add custom error class (<adata-error-text="Failed to load title" data-id="3332530309"data-permission-text="Title is private"data-url="pillarjs/path-to-regexp#398"data-hovercard-type="pull_request"data-hovercard-url="/pillarjs/path-to-regexp/pull/398/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/pull/398">#398</a>)<a data-hovercard-type="commit"data-hovercard-url="https://github.com/pillarjs/path-to-regexp/commit/2a7f2a4e9ba42eee41aa9d7a1a69eddb43b79a61/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/commit/2a7f2a4e9ba42eee41aa9d7a1a69eddb43b79a61"><tt>2a7f2a4</tt></a></li><li>Allow plain objects for <code>TokenData</code> (<a data-error-text="Failed to load title"data-id="3281561483" data-permission-text="Title is private"data-url="pillarjs/path-to-regexp#391"data-hovercard-type="pull_request"data-hovercard-url="/pillarjs/path-to-regexp/pull/391/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/pull/391">#391</a>)<a data-hovercard-type="commit"data-hovercard-url="https://github.com/pillarjs/path-to-regexp/commit/687a9bbc735245b2688c17db7e9fe86013ea0c77/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/commit/687a9bbc735245b2688c17db7e9fe86013ea0c77"><tt>687a9bb</tt></a></li><li>Escape text should escape backslash (<a data-error-text="Failed to load title"data-id="3281489414" data-permission-text="Title is private"data-url="pillarjs/path-to-regexp#390"data-hovercard-type="pull_request"data-hovercard-url="/pillarjs/path-to-regexp/pull/390/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/pull/390">#390</a>)<a data-hovercard-type="commit"data-hovercard-url="https://github.com/pillarjs/path-to-regexp/commit/a4a8552c9fb4449c470fb9ead458df1c89cadb72/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/commit/a4a8552c9fb4449c470fb9ead458df1c89cadb72"><tt>a4a8552</tt></a></li><li>Improved error messages and stack size (<a data-error-text="Failed to load title"data-id="3054423448" data-permission-text="Title is private"data-url="pillarjs/path-to-regexp#363"data-hovercard-type="pull_request"data-hovercard-url="/pillarjs/path-to-regexp/pull/363/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/pull/363">#363</a>)<a data-hovercard-type="commit"data-hovercard-url="https://github.com/pillarjs/path-to-regexp/commit/a6bdf4045f369474e4e580bc6fcadb6bd806e62e/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/commit/a6bdf4045f369474e4e580bc6fcadb6bd806e62e"><tt>a6bdf40</tt></a></li></ul><p><strong>Other</strong></p><ul><li>Minifying the parser<ul><li>PR (<a data-error-text="Failed toload title" data-id="3352988435" data-permission-text="Title is private"data-url="pillarjs/path-to-regexp#401"data-hovercard-type="pull_request"data-hovercard-url="/pillarjs/path-to-regexp/pull/401/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/pull/401">#401</a>)<a data-hovercard-type="commit"data-hovercard-url="https://github.com/pillarjs/path-to-regexp/commit/9df2448fdfca9d2957cf47a1777b5deda9be18cf/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/commit/9df2448fdfca9d2957cf47a1777b5deda9be18cf"><tt>9df2448</tt></a></li><li>PR (<a data-error-text="Failed toload title" data-id="3301895649" data-permission-text="Title is private"data-url="pillarjs/path-to-regexp#395"data-hovercard-type="pull_request"data-hovercard-url="/pillarjs/path-to-regexp/pull/395/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/pull/395">#395</a>)<a data-hovercard-type="commit"data-hovercard-url="https://github.com/pillarjs/path-to-regexp/commit/4a915059a843dfdd122a0c4936837c7fdda2d4ee/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/commit/4a915059a843dfdd122a0c4936837c7fdda2d4ee"><tt>4a91505</tt></a></li><li>Shaving some bytes <adata-hovercard-type="commit"data-hovercard-url="https://github.com/pillarjs/path-to-regexp/commit/d63f44bc54f2c6fe7d35dc77f8515622006bf7cb/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/commit/d63f44bc54f2c6fe7d35dc77f8515622006bf7cb"><tt>d63f44b</tt></a></li><li>Remove optional operator <adata-hovercard-type="commit"data-hovercard-url="https://github.com/pillarjs/path-to-regexp/commit/973d15c262f113c4cb88762971920053fdbd31ff/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/commit/973d15c262f113c4cb88762971920053fdbd31ff"><tt>973d15c</tt></a></li></ul></li></ul><p><ahref="https://redirect.github.com/pillarjs/path-to-regexp/compare/v8.2.0...v8.3.0"><tt>v8.2.0...v8.3.0</tt></a></p>      </li>      <li><b>8.2.0</b> - <ahref="https://redirect.github.com/pillarjs/path-to-regexp/releases/tag/v8.2.0">2024-09-26</a></br><p><strong>Fixed</strong></p><ul><li>Allowing <code>path-to-regexp</code> to run on older browsers bytargeting ES2015<ul><li>Target ES2015 <a data-hovercard-type="commit"data-hovercard-url="https://github.com/pillarjs/path-to-regexp/commit/59690338f2a089f45505718c94b86dcb2d32f29d/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/commit/59690338f2a089f45505718c94b86dcb2d32f29d"><tt>5969033</tt></a><ul><li>Also saved <em>0.22kb</em> (10%!) by removing the private classfield down level</li></ul></li><li>Remove <code>s</code> flag from regexp <adata-hovercard-type="commit"data-hovercard-url="https://github.com/pillarjs/path-to-regexp/commit/51dbd45e00043f082e3cf1857861e856c40a32f0/hovercard"href="https://redirect.github.com/pillarjs/path-to-regexp/commit/51dbd45e00043f082e3cf1857861e856c40a32f0"><tt>51dbd45</tt></a></li></ul></li></ul><p><ahref="https://redirect.github.com/pillarjs/path-to-regexp/compare/v8.1.0...v8.2.0"><tt>v8.1.0...v8.2.0</tt></a></p>      </li>    </ul>from <ahref="https://redirect.github.com/pillarjs/path-to-regexp/releases">path-to-regexpGitHub release notes</a>  </details></details>---> [!IMPORTANT]>> - Check the changes in this PR to ensure they won't cause issues withyour project.> - This PR was automatically created by Snyk using the credentials of areal user.---**Note:** _You are seeing this because you or someone else with accessto this repository has authorized Snyk to open upgrade PRs._**For more information:** <imgsrc="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI2ZjIyMWFhNS01NDQ4LTQwMDgtODEzNy05NjljNmM0MmJiY2IiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjZmMjIxYWE1LTU0NDgtNDAwOC04MTM3LTk2OWM2YzQyYmJjYiJ9fQ=="width="0" height="0"/>> - 🧐 [View latest projectreport](https://app.snyk.io/org/szotkowski/project/36f26f5b-e4bf-4cb8-ae5b-087fbc45bf4d?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)> - 📜 [Customise PRtemplates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template)> - 🛠 [Adjust upgrade PRsettings](https://app.snyk.io/org/szotkowski/project/36f26f5b-e4bf-4cb8-ae5b-087fbc45bf4d/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)> - 🔕 [Ignore this dependency or unsubscribe from future upgradePRs](https://app.snyk.io/org/szotkowski/project/36f26f5b-e4bf-4cb8-ae5b-087fbc45bf4d/settings/integration?pkg&#x3D;path-to-regexp&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)[//]: #'snyk:metadata:{"breakingChangeRiskLevel":null,"FF_showPullRequestBreakingChanges":null,"FF_showPullRequestBreakingChangesWebSearch":null,"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"path-to-regexp","from":"8.2.0","to":"8.3.0"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"6f221aa5-5448-4008-8137-969c6c42bbcb","prPublicId":"6f221aa5-5448-4008-8137-969c6c42bbcb","packageManager":"npm","priorityScoreList":[],"projectPublicId":"36f26f5b-e4bf-4cb8-ae5b-087fbc45bf4d","projectUrl":"https://app.snyk.io/org/szotkowski/project/36f26f5b-e4bf-4cb8-ae5b-087fbc45bf4d?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2025-09-02T21:13:13.739Z"},"vulns":[]}'Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@wesleytoddwesleytoddwesleytodd approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@blakeembrey@wesleytodd

[8]ページ先頭

©2009-2025 Movatter.jp