Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Mar 3, 2024
0 parents commit 3bcdaa3
Show file tree
Hide file tree
Showing 35 changed files with 5,674 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*]
indent_size = 2
end_of_line = lf
insert_final_newline = true
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: sxzz
4 changes: 4 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
extends: ['github>sxzz/renovate-config'],
automerge: true,
}
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release

permissions:
contents: write

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set node
uses: actions/setup-node@v4
with:
node-version: lts/*

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
59 changes: 59 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Unit Test

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Setup
run: npm i -g @antfu/ni

- name: Install
run: nci

- name: Lint
run: nr lint

- name: Typecheck
run: nr typecheck

test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node: [18, 20]
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Set node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Setup
run: npm i -g @antfu/ni

- name: Install
run: nci

- name: Build
run: nr build

- name: Test
run: nr test
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
.DS_Store
dist
*.log
.vercel
.eslintcache
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.formatOnSave": true,
"eslint.experimental.useFlatConfig": true
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright © 2023-PRESENT 三咲智子 (https://github.com/sxzz)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# unplugin-inline-enum [![npm](https://img.shields.io/npm/v/unplugin-inline-enum.svg)](https://npmjs.com/package/unplugin-inline-enum)

[![Unit Test](https://github.com/unplugin/unplugin-inline-enum/actions/workflows/unit-test.yml/badge.svg)](https://github.com/unplugin/unplugin-inline-enum/actions/workflows/unit-test.yml)

Inline enum value to optimize bundle size.

> Working in Progress...
## Installation

```bash
npm i -D unplugin-inline-enum
```

<details>
<summary>Vite</summary><br>

```ts
// vite.config.ts
import InlineEnum from 'unplugin-inline-enum/vite'

export default defineConfig({
plugins: [InlineEnum()],
})
```

<br></details>

<details>
<summary>Rollup</summary><br>

```ts
// rollup.config.js
import InlineEnum from 'unplugin-inline-enum/rollup'

export default {
plugins: [InlineEnum()],
}
```

<br></details>

<details>
<summary>esbuild</summary><br>

```ts
// esbuild.config.js
import { build } from 'esbuild'

build({
plugins: [require('unplugin-inline-enum/esbuild')()],
})
```

<br></details>

<details>
<summary>Webpack</summary><br>

```ts
// webpack.config.js
module.exports = {
/* ... */
plugins: [require('unplugin-inline-enum/webpack')()],
}
```

<br></details>

## Sponsors

<p align="center">
<a href="https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg">
<img src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/>
</a>
</p>

## License

[MIT](./LICENSE) License © 2024-PRESENT [三咲智子](https://github.com/sxzz)
2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const { sxzz } = require('@sxzz/eslint-config')
module.exports = sxzz()
113 changes: 113 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"name": "unplugin-inline-enum",
"version": "0.0.0",
"packageManager": "[email protected]",
"description": "Inline enum value to optimize bundle size.",
"keywords": [
"unplugin",
"rollup",
"vite",
"esbuild",
"webpack"
],
"license": "MIT",
"homepage": "https://github.com/unplugin/unplugin-inline-enum#readme",
"bugs": {
"url": "https://github.com/unplugin/unplugin-inline-enum/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/unplugin/unplugin-inline-enum.git"
},
"author": "三咲智子 <[email protected]>",
"files": [
"dist"
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs"
},
"./vite": {
"require": "./dist/vite.js",
"import": "./dist/vite.mjs"
},
"./webpack": {
"require": "./dist/webpack.js",
"import": "./dist/webpack.mjs"
},
"./rollup": {
"require": "./dist/rollup.js",
"import": "./dist/rollup.mjs"
},
"./esbuild": {
"require": "./dist/esbuild.js",
"import": "./dist/esbuild.mjs"
},
"./api": {
"require": "./dist/api.js",
"import": "./dist/api.mjs"
},
"./*": [
"./*",
"./*.d.ts"
]
},
"typesVersions": {
"*": {
"*": [
"./dist/*",
"./*"
]
}
},
"publishConfig": {
"access": "public"
},
"scripts": {
"lint": "eslint --cache .",
"lint:fix": "pnpm run lint --fix",
"build": "tsup",
"dev": "tsup --watch",
"test": "vitest",
"typecheck": "tsc --noEmit",
"release": "bumpp && pnpm publish",
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@rollup/pluginutils": "^5.1.0",
"ast-kit": "^0.11.3",
"execa": "^8.0.1",
"magic-string": "^0.30.7",
"picomatch": "^4.0.1",
"unplugin": "^1.8.0",
"unplugin-replace": "link:/Users/kevin/Developer/open-source/unplugin-replace"
},
"devDependencies": {
"@babel/types": "^7.24.0",
"@sxzz/eslint-config": "^3.8.1",
"@sxzz/prettier-config": "^2.0.1",
"@types/node": "^20.11.24",
"@types/picomatch": "^2.3.3",
"@vue-macros/test-utils": "^1.4.0",
"bumpp": "^9.3.0",
"esbuild": "^0.20.1",
"eslint": "^8.57.0",
"fast-glob": "^3.3.2",
"prettier": "^3.2.5",
"rollup": "^4.12.0",
"tsup": "^8.0.2",
"tsx": "^4.7.1",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vitest": "^1.3.1",
"webpack": "^5.90.3"
},
"engines": {
"node": ">=16.14.0"
},
"prettier": "@sxzz/prettier-config"
}
Loading

0 comments on commit 3bcdaa3

Please sign in to comment.