Skip to content

Commit b1ec56d

Browse files
committed
feat: initial
1 parent 38d0c7c commit b1ec56d

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) AnyFrame
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

rollup.config.js

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
import { readFileSync } from 'node:fs'
2+
import typescript from '@rollup/plugin-typescript'
3+
import resolve from '@rollup/plugin-node-resolve'
4+
import commonjs from '@rollup/plugin-commonjs'
5+
import terser from '@rollup/plugin-terser'
6+
7+
const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'))
8+
9+
const sourcemap = true
10+
const fileName = 'index'
11+
const name = '__anyframe_core__'
12+
const banner = `/*!
13+
* ${pkg.name} v${pkg.version} | ${pkg.license} License
14+
* Copyright (c) 2025-present ${pkg.author}
15+
*/`
16+
17+
export default {
18+
input: 'src/index.ts',
19+
output: [
20+
{
21+
file: `dist/${fileName}.cjs`,
22+
format: 'cjs',
23+
exports: 'named',
24+
sourcemap,
25+
name,
26+
banner
27+
},
28+
{
29+
file: `dist/${fileName}.min.cjs`,
30+
format: 'cjs',
31+
exports: 'named',
32+
sourcemap,
33+
name,
34+
plugins: [
35+
terser({
36+
format: {
37+
comments: false,
38+
preamble: banner
39+
},
40+
mangle: false,
41+
mangle: true,
42+
compress: {
43+
defaults: true,
44+
passes: 2
45+
}
46+
})
47+
]
48+
},
49+
{
50+
file: `dist/${fileName}.umd.js`,
51+
format: 'umd',
52+
exports: 'named',
53+
sourcemap,
54+
name,
55+
banner
56+
},
57+
{
58+
file: `dist/${fileName}.umd.min.js`,
59+
format: 'umd',
60+
exports: 'named',
61+
sourcemap,
62+
name,
63+
plugins: [
64+
terser({
65+
format: {
66+
comments: false,
67+
preamble: banner
68+
},
69+
mangle: false,
70+
mangle: true,
71+
compress: {
72+
defaults: true,
73+
passes: 2
74+
}
75+
})
76+
]
77+
},
78+
{
79+
file: `dist/${fileName}.esm.js`,
80+
format: 'es',
81+
banner,
82+
sourcemap
83+
},
84+
{
85+
file: `dist/${fileName}.esm.min.js`,
86+
sourcemap,
87+
format: 'es',
88+
plugins: [
89+
terser({
90+
format: {
91+
comments: false,
92+
preamble: banner
93+
},
94+
mangle: true,
95+
compress: {
96+
defaults: true,
97+
passes: 2
98+
}
99+
})
100+
]
101+
}
102+
],
103+
plugins: [typescript(), resolve(), commonjs()]
104+
}

tsconfig.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2017",
4+
"module": "esnext",
5+
"declaration": true,
6+
"outDir": "dist",
7+
"rootDir": "src",
8+
"strict": true,
9+
"esModuleInterop": true,
10+
"noUnusedLocals": true
11+
},
12+
"include": ["src"],
13+
"exclude": ["node_modules", "dist"]
14+
}

0 commit comments

Comments
 (0)