@ak2021/store 0.1.0-alpha.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.js +8 -1
- package/dist/{index.esm.js → index.mjs} +5 -0
- package/dist/index.umd.js +5 -0
- package/dist/types/index.d.ts +11 -0
- package/package.json +19 -5
- package/CHANGELOG.md +0 -3
- package/public/index.html +0 -18
- package/rollup.config.js +0 -54
- package/src/index.ts +0 -16
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Shine Shao
|
|
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.
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @ak2021/store v0.1.0
|
|
3
|
+
* Copyright (c) 2025-12-23 ShineShao <xiaoshaoqq@gmail.com>
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
3
10
|
var Store = /*#__PURE__*/ function() {
|
|
4
11
|
function Store(options) {
|
|
5
12
|
if (options === void 0) options = {};
|
|
@@ -12,4 +19,4 @@ var Store = /*#__PURE__*/ function() {
|
|
|
12
19
|
return Store;
|
|
13
20
|
}();
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
exports.default = Store;
|
package/dist/index.umd.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @ak2021/store v0.1.0
|
|
3
|
+
* Copyright (c) 2025-12-23 ShineShao <xiaoshaoqq@gmail.com>
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
1
6
|
(function (global, factory) {
|
|
2
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
8
|
typeof define === 'function' && define.amd ? define(factory) :
|
package/package.json
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ak2021/store",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
6
9
|
"scripts": {
|
|
7
|
-
"dev": "rollup --config rollup.config.
|
|
8
|
-
"build": "npm run clean && cross-env NODE_ENV=production rollup --config rollup.config.
|
|
10
|
+
"dev": "rollup --config rollup.config.mjs --watch",
|
|
11
|
+
"build": "npm run clean && cross-env NODE_ENV=production rollup --config rollup.config.mjs",
|
|
9
12
|
"clean": "rimraf dist",
|
|
10
|
-
"
|
|
13
|
+
"release": "npm public "
|
|
11
14
|
},
|
|
12
15
|
"keywords": [],
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"!dist/**/*.map"
|
|
19
|
+
],
|
|
13
20
|
"author": "ShineShao <xiaoshaoqq@gmail.com>",
|
|
14
|
-
"license": "MIT"
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@config/rollup": "workspace:*"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"gitHead": "d829c927efe4f0d0f9d578c532a916835e4a01b2"
|
|
15
29
|
}
|
package/CHANGELOG.md
DELETED
package/public/index.html
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>pkg2</title>
|
|
7
|
-
<script src="./index.umd.js"></script>
|
|
8
|
-
</head>
|
|
9
|
-
|
|
10
|
-
<body>
|
|
11
|
-
<script>
|
|
12
|
-
(function () {
|
|
13
|
-
const store = new Store({ id: 'app' });
|
|
14
|
-
store.on('event', () => console.log('store'));
|
|
15
|
-
})();
|
|
16
|
-
</script>
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|
package/rollup.config.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
const commonjs = require('@rollup/plugin-commonjs');
|
|
3
|
-
const resolve = require('@rollup/plugin-node-resolve');
|
|
4
|
-
const swc = require('@rollup/plugin-swc');
|
|
5
|
-
const serve = require('rollup-plugin-serve');
|
|
6
|
-
const { upperCamel } = require('@skax/camel');
|
|
7
|
-
const pkg = require('./package.json');
|
|
8
|
-
|
|
9
|
-
const isDev = process.env.NODE_ENV !== 'production';
|
|
10
|
-
|
|
11
|
-
module.exports = {
|
|
12
|
-
input: 'src/index.ts',
|
|
13
|
-
output: [
|
|
14
|
-
{
|
|
15
|
-
file: 'dist/index.umd.js',
|
|
16
|
-
format: 'umd',
|
|
17
|
-
name: upperCamel(pkg.name.split('/')[1]),
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
exports: 'auto',
|
|
21
|
-
// Node 默认的模块规范, 可通过 Webpack 加载
|
|
22
|
-
// https://javascript.ruanyifeng.com/nodejs/module.html
|
|
23
|
-
// https://zh.wikipedia.org/wiki/CommonJS
|
|
24
|
-
file: 'dist/index.js',
|
|
25
|
-
format: 'cjs',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
// ES2015 Module 规范,
|
|
29
|
-
// https://exploringjs.com/es6/ch_modules.html
|
|
30
|
-
exports: 'auto',
|
|
31
|
-
file: 'dist/index.esm.js',
|
|
32
|
-
format: 'esm',
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
plugins: [
|
|
36
|
-
swc({
|
|
37
|
-
// https://swc.rs/docs/configuration/swcrc
|
|
38
|
-
swc: {
|
|
39
|
-
jsc: {
|
|
40
|
-
target: 'es5',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
include: ['**/src/**/*.{ts,js}'],
|
|
44
|
-
}),
|
|
45
|
-
resolve(),
|
|
46
|
-
commonjs({ extensions: ['.js', '.ts'] }),
|
|
47
|
-
isDev
|
|
48
|
-
? serve({
|
|
49
|
-
port: 3000,
|
|
50
|
-
contentBase: ['public', 'dist'],
|
|
51
|
-
})
|
|
52
|
-
: null,
|
|
53
|
-
].filter(Boolean),
|
|
54
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface StoreOptions {
|
|
2
|
-
id?: string;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
class Store {
|
|
6
|
-
options: StoreOptions;
|
|
7
|
-
constructor(options: Partial<StoreOptions> = {}) {
|
|
8
|
-
this.options = options;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
on(type: string, fn: any) {
|
|
12
|
-
console.log(type, fn, this.options);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default Store;
|