Skip to content

Commit 2c7de4d

Browse files
authored
fix: commonjs types, add module-sync entry (#41)
1 parent 3f85c28 commit 2c7de4d

File tree

9 files changed

+84
-18
lines changed

9 files changed

+84
-18
lines changed

.changeset/thin-boxes-appear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"ab64": patch
3+
---
4+
5+
fix: commonjs types, add `module-sync` entry

.github/workflows/autofix.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: autofix.ci # For security reasons, the workflow in which the autofix.ci action is used must be named "autofix.ci".
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
autofix:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout Repo
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
19+
20+
- name: Setup pnpm
21+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4
22+
23+
- name: Setup Node.js LTS
24+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
25+
with:
26+
node-version: lts/*
27+
cache: pnpm
28+
29+
- name: Install Dependencies
30+
run: pnpm i --frozen-lockfile
31+
32+
- name: Format Codes
33+
run: pnpm format
34+
35+
- name: Apply autofix.ci
36+
uses: autofix-ci/action@2891949f3779a1cafafae1523058501de3d4e944 # v1
37+
with:
38+
fail-fast: false

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
coverage
22
dist
3+
/auto-imports.d.ts
34
/src/mini-app.ts
45
/pnpm-lock.yaml

.stylelintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ coverage
22
dist
33
lib
44
LICENSE
5+
*.cts
56
*.js
67
*.json
78
*.log

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# ab64
22

3-
[![GitHub Actions](https://github.com/un-ts/ab64/workflows/CI/badge.svg)](https://github.com/un-ts/ab64/actions/workflows/ci.yml)
3+
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/un-ts/ab64/ci.yml?branch=main)](https://github.com/un-ts/ab64/actions/workflows/ci.yml?query=branch%3Amain)
44
[![Codecov](https://img.shields.io/codecov/c/github/un-ts/ab64.svg)](https://codecov.io/gh/un-ts/ab64)
55
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Fab64%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
6+
[![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/un-ts/ab64)](https://coderabbit.ai)
67
[![npm](https://img.shields.io/npm/v/ab64.svg)](https://www.npmjs.com/package/ab64)
78
[![GitHub Release](https://img.shields.io/github/release/un-ts/ab64)](https://github.com/un-ts/ab64/releases)
89

index.d.cts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import * as ab64 from './lib/index.js'
2+
3+
export = ab64

package.json

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"./ponyfill": "./src/ponyfill.ts"
1717
},
1818
"files": [
19+
"index.d.cts",
1920
"lib",
2021
"!**/*.tsbuildinfo"
2122
],
@@ -36,6 +37,7 @@
3637
"dev": "vitest",
3738
"docs:build": "vite build",
3839
"docs:dev": "vite dev",
40+
"format": "prettier -w .",
3941
"lint": "run-p lint:*",
4042
"lint:es": "eslint . --cache --max-warnings 10",
4143
"lint:style": "stylelint . --cache",
@@ -49,9 +51,6 @@
4951
"vercel-build": "pnpm docs:build",
5052
"version": "changeset version && pnpm i --no-frozen-lockfile"
5153
},
52-
"dependencies": {
53-
"tslib": "^2.8.1"
54-
},
5554
"devDependencies": {
5655
"@1stg/app-config": "^11.1.0",
5756
"@1stg/lib-config": "^13.0.1",
@@ -74,6 +73,7 @@
7473
"github-markdown-css": "^5.8.1",
7574
"lint-staged": "^15.5.0",
7675
"npm-run-all2": "^7.0.2",
76+
"prettier": "^3.5.3",
7777
"react": "^19.0.0",
7878
"react-dom": "^19.0.0",
7979
"react-router-dom": "^7.4.0",
@@ -94,14 +94,35 @@
9494
"module": "./lib/index.js",
9595
"exports": {
9696
".": {
97-
"types": "./lib/index.d.ts",
98-
"browser": "./lib/browser.js",
99-
"import": "./lib/index.js",
100-
"require": "./lib/index.cjs"
97+
"import": {
98+
"types": "./lib/index.d.ts",
99+
"default": "./lib/index.js"
100+
},
101+
"browser": {
102+
"types": "./lib/browser.d.ts",
103+
"default": "./lib/browser.js"
104+
},
105+
"module-sync": {
106+
"types": "./lib/index.d.ts",
107+
"default": "./lib/index.js"
108+
},
109+
"require": {
110+
"types": "./index.d.cts",
111+
"default": "./lib/index.cjs"
112+
}
113+
},
114+
"./mini-app": {
115+
"types": "./lib/mini-app.d.ts",
116+
"default": "./lib/mini-app.js"
117+
},
118+
"./polyfill": {
119+
"types": "./lib/polyfill.d.ts",
120+
"default": "./lib/polyfill.js"
101121
},
102-
"./mini-app": "./lib/mini-app.js",
103-
"./polyfill": "./lib/polyfill.js",
104-
"./ponyfill": "./lib/ponyfill.js"
122+
"./ponyfill": {
123+
"types": "./lib/ponyfill.d.ts",
124+
"default": "./lib/ponyfill.js"
125+
}
105126
},
106127
"types": "./lib/index.d.ts"
107128
},

pnpm-lock.yaml

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/browser.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ export const decodeUrl = (val: string) => {
3434
output += '='
3535
break
3636
}
37-
default: {
38-
break
39-
}
4037
}
4138
return decode(output)
4239
}

0 commit comments

Comments
 (0)