@cocreate/indexeddb 1.23.1 → 1.23.3
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/CHANGELOG.md +18 -0
- package/docs/index.html +217 -217
- package/package.json +5 -9
- package/src/index.js +4 -0
- package/webpack.config.js +65 -90
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [1.23.3](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.23.2...v1.23.3) (2025-05-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update [@cocreate](https://github.com/cocreate) dependencies ([83859cc](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/83859cc877528c7626f49fbcb2c2618346bf80af))
|
|
7
|
+
|
|
8
|
+
## [1.23.2](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.23.1...v1.23.2) (2025-04-30)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* added css-loader ([e4d034d](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/e4d034df917477f594ee0da932fc3001f2c080f3))
|
|
14
|
+
* array.read ([2e54944](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/2e54944fe4ece8b821681ee882f1337e04818128))
|
|
15
|
+
* update query attributes ([b56afaf](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/b56afaf182f83ea437af96434551434d7145493c))
|
|
16
|
+
* updated cocreate modules versions ([4bf0cc5](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/4bf0cc512d8c943c02b7ff2422c5b9431c70774a))
|
|
17
|
+
* webpack.config and devdependencies ([c529858](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/c5298587d681230f26cc60aa7a417d655a49b1ea))
|
|
18
|
+
|
|
1
19
|
## [1.23.1](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.23.0...v1.23.1) (2024-12-14)
|
|
2
20
|
|
|
3
21
|
|
package/docs/index.html
CHANGED
|
@@ -1,230 +1,230 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<title>CoCreate-indexeddb Documentation | CoCreateJS</title>
|
|
8
|
+
<link
|
|
9
|
+
rel="icon"
|
|
10
|
+
type="image/png"
|
|
11
|
+
sizes="32x32"
|
|
12
|
+
href="https://cocreate.app/images/favicon.ico" />
|
|
13
|
+
<meta
|
|
14
|
+
name="description"
|
|
15
|
+
content="A simple HTML5 and pure javascript component. Easy configuration using data-attributes and highly styleable." />
|
|
16
|
+
<meta
|
|
17
|
+
name="keywords"
|
|
18
|
+
content="helper classes, utility classes, css framework, css library, inline style classes" />
|
|
19
|
+
<meta name="robots" content="index,follow" />
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
<!-- CoCreate CSS CDN -->
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
<link rel="manifest" href="/manifest.webmanifest" />
|
|
24
|
+
</head>
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
26
|
+
<body>
|
|
27
|
+
<div array="" object="" key="" id="cocreate-indexeddb">
|
|
28
|
+
<div
|
|
29
|
+
class="display:flex flex-wrap:wrap justify-content:space-between margin:10px">
|
|
30
|
+
<div class="display:flex align-items:center">
|
|
31
|
+
<h2>CoCreate-indexeddb</h2>
|
|
32
|
+
</div>
|
|
33
|
+
<div
|
|
34
|
+
class="display:flex align-items:center font-size:20px"
|
|
35
|
+
share-height="600"
|
|
36
|
+
share-width="500"
|
|
37
|
+
share-media="https://via.placeholder.com/300/09f/fff.png">
|
|
38
|
+
<a
|
|
39
|
+
href="https://github.com/CoCreate-app/CoCreate-indexeddb"
|
|
40
|
+
target="_blank"
|
|
41
|
+
class="margin-right:15px"
|
|
42
|
+
><i src="/assets/svg/github.svg"></i
|
|
43
|
+
></a>
|
|
44
|
+
<a
|
|
45
|
+
class="margin-right:15px share"
|
|
46
|
+
share-network="twitter"
|
|
47
|
+
title="Share on twitter"
|
|
48
|
+
><i src="/assets/svg/twitter.svg"></i
|
|
49
|
+
></a>
|
|
50
|
+
<a
|
|
51
|
+
class="margin-right:15px share"
|
|
52
|
+
share-network="facebook"
|
|
53
|
+
title="Share on Facebook"
|
|
54
|
+
><i src="/assets/svg/facebook.svg"></i
|
|
55
|
+
></a>
|
|
56
|
+
<a
|
|
57
|
+
class="margin-right:15px share"
|
|
58
|
+
share-network="instagram"
|
|
59
|
+
title="Share on instagram"
|
|
60
|
+
><i src="/assets/svg/instagram.svg"></i
|
|
61
|
+
></a>
|
|
62
|
+
<a
|
|
63
|
+
class="margin-right:15px share"
|
|
64
|
+
share-network="share"
|
|
65
|
+
title="Share on share"
|
|
66
|
+
><i src="/assets/svg/share-alt.svg"></i
|
|
67
|
+
></a>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<h1 class="max-width:500px margin:20px_10px">
|
|
71
|
+
A simple HTML5, CSS and pure javascript component. Easy
|
|
72
|
+
configuration using data-attributes and highly styleable.
|
|
73
|
+
</h1>
|
|
74
|
+
<div id="indexeddb-section" class="display:flex flex-wrap:wrap">
|
|
75
|
+
<div class="flex-grow:1 width:300px padding:20px_10px">
|
|
76
|
+
<h2
|
|
77
|
+
class="border-bottom:1px_solid_lightgrey padding:5px_0px">
|
|
78
|
+
Install
|
|
79
|
+
</h2>
|
|
80
|
+
<pre
|
|
81
|
+
class="margin-top:15px"><code class="language-javascript">npm install cocreate-indexeddb</code></pre>
|
|
82
|
+
<p class="padding:10px_0px">Or you can use cdn link:</p>
|
|
83
|
+
<pre><code class="language-javascript">https://cdn.cocreate.app/js/CoCreate-indexeddb.min.js</code></pre>
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
<h2
|
|
86
|
+
class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
|
|
87
|
+
Usage
|
|
88
|
+
</h2>
|
|
89
|
+
<p class="padding:10px_0px">indexeddb usage content</p>
|
|
90
|
+
<pre><code class="language-html"><div></div></code></pre>
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
<h2
|
|
93
|
+
class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
|
|
94
|
+
Reference
|
|
95
|
+
</h2>
|
|
96
|
+
<p class="padding:10px_0px">
|
|
97
|
+
This is indexeddb reference content
|
|
98
|
+
</p>
|
|
99
|
+
<pre><code class="language-javascript"><div></div></code></pre>
|
|
100
|
+
<p class="padding:10px_0px">
|
|
101
|
+
This is indexeddb reference content
|
|
102
|
+
</p>
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
104
|
+
<h2
|
|
105
|
+
class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
|
|
106
|
+
Attributes
|
|
107
|
+
</h2>
|
|
108
|
+
<ul class="list-style-type:none">
|
|
109
|
+
<li
|
|
110
|
+
class="padding:15px_0px border-bottom:1px_solid_lightgrey">
|
|
111
|
+
<h4>
|
|
112
|
+
<span>indexeddb</span>
|
|
113
|
+
<span class="cocreate-badge success"
|
|
114
|
+
>string</span
|
|
115
|
+
>
|
|
116
|
+
<span class="cocreate-badge warning"
|
|
117
|
+
>optional</span
|
|
118
|
+
>
|
|
119
|
+
</h4>
|
|
120
|
+
<p>indexeddb-attribute</p>
|
|
121
|
+
</li>
|
|
122
|
+
<li
|
|
123
|
+
class="padding:15px_0px border-bottom:1px_solid_lightgrey">
|
|
124
|
+
<h4>
|
|
125
|
+
<span>indexeddb</span>
|
|
126
|
+
<span class="cocreate-badge success"
|
|
127
|
+
>string</span
|
|
128
|
+
>
|
|
129
|
+
<span class="cocreate-badge warning"
|
|
130
|
+
>optional</span
|
|
131
|
+
>
|
|
132
|
+
</h4>
|
|
133
|
+
<p>indexeddb-attribute</p>
|
|
134
|
+
</li>
|
|
135
|
+
</ul>
|
|
136
|
+
</div>
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
138
|
+
<div
|
|
139
|
+
class="flex-grow:1 width:300px padding:0px_10px margin:20px_0px border-bottom:1px_solid_lightgrey">
|
|
140
|
+
<!-- SandBox -->
|
|
141
|
+
<h2
|
|
142
|
+
class="border-bottom:1px_solid_lightgrey padding:5px_0px">
|
|
143
|
+
Demo
|
|
144
|
+
</h2>
|
|
145
|
+
<div
|
|
146
|
+
class="position:sticky top:0 padding:10px_0px height:100vh">
|
|
147
|
+
<!-- SandBox -->
|
|
148
|
+
<div
|
|
149
|
+
class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px"
|
|
150
|
+
id="playground">
|
|
151
|
+
<div
|
|
152
|
+
id="demo-code"
|
|
153
|
+
resizable
|
|
154
|
+
class="position:relative height:50%">
|
|
155
|
+
<textarea
|
|
156
|
+
type="code"
|
|
157
|
+
lang="html"
|
|
158
|
+
array="demos"
|
|
159
|
+
object=""
|
|
160
|
+
key="demo"
|
|
161
|
+
save="false"
|
|
162
|
+
id="demo"
|
|
163
|
+
class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
|
|
164
|
+
<div
|
|
165
|
+
resize="bottom"
|
|
166
|
+
class="background:lightgrey"></div>
|
|
167
|
+
</div>
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
<div
|
|
170
|
+
id="demo-preview"
|
|
171
|
+
class="position:relative overflow:auto background-color:white">
|
|
172
|
+
<div class="demopreview padding:20px"></div>
|
|
173
|
+
</div>
|
|
174
174
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
175
|
+
<div
|
|
176
|
+
class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
|
|
177
|
+
<a
|
|
178
|
+
class="margin-right:10px"
|
|
179
|
+
id="eye"
|
|
180
|
+
show="#eye-slash"
|
|
181
|
+
hide="#eye, #demo-preview"
|
|
182
|
+
toggle="code-height"
|
|
183
|
+
toggle-query="#demo-code"
|
|
184
|
+
><i
|
|
185
|
+
class="height:18px"
|
|
186
|
+
src="/assets/svg/eye.svg"></i
|
|
187
|
+
></a>
|
|
188
|
+
<a
|
|
189
|
+
class="margin-right:10px"
|
|
190
|
+
hidden
|
|
191
|
+
id="eye-slash"
|
|
192
|
+
show="#eye, #demo-preview"
|
|
193
|
+
hide="#eye-slash"
|
|
194
|
+
toggle="code-height"
|
|
195
|
+
toggle-query="#demo-code"
|
|
196
|
+
><i src="/assets/svg/eye-slash.svg"></i
|
|
197
|
+
></a>
|
|
198
|
+
<a
|
|
199
|
+
class="margin-right:10px"
|
|
200
|
+
id="code"
|
|
201
|
+
show="#code-slash"
|
|
202
|
+
hide="#code, #demo-code"
|
|
203
|
+
><i src="/assets/svg/code.svg"></i
|
|
204
|
+
></a>
|
|
205
|
+
<a
|
|
206
|
+
class="margin-right:10px"
|
|
207
|
+
hidden
|
|
208
|
+
id="code-slash"
|
|
209
|
+
show="#code, #demo-code"
|
|
210
|
+
hide="#code-slash"
|
|
211
|
+
><i
|
|
212
|
+
class="height:18px"
|
|
213
|
+
src="/assets/svg/code.svg"></i
|
|
214
|
+
></a>
|
|
215
|
+
<a
|
|
216
|
+
class="margin-right:5px"
|
|
217
|
+
fullscreen
|
|
218
|
+
fullscreen-query="#playground"></a>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
<!-- End SandBox -->
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
<!--CoCreateJS-->
|
|
228
|
+
<script src="https://CoCreate.app/dist/CoCreate.js"></script>
|
|
229
|
+
</body>
|
|
230
230
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/indexeddb",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.3",
|
|
4
4
|
"description": "A simple indexeddb component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"indexeddb",
|
|
@@ -45,19 +45,15 @@
|
|
|
45
45
|
},
|
|
46
46
|
"main": "./src/index.js",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"clean-webpack-plugin": "^3.0.0",
|
|
52
|
-
"file-loader": "^6.2.0",
|
|
48
|
+
"css-loader": "^5.1.3",
|
|
49
|
+
"esbuild": "^0.25.2",
|
|
50
|
+
"esbuild-loader": "^4.3.0",
|
|
53
51
|
"mini-css-extract-plugin": "^1.5.0",
|
|
54
|
-
"style-loader": "^3.3.1",
|
|
55
|
-
"terser-webpack-plugin": "^5.1.1",
|
|
56
52
|
"webpack": "^5.24.4",
|
|
57
53
|
"webpack-cli": "^4.5.0",
|
|
58
54
|
"webpack-log": "^3.0.1"
|
|
59
55
|
},
|
|
60
56
|
"dependencies": {
|
|
61
|
-
"@cocreate/utils": "^1.
|
|
57
|
+
"@cocreate/utils": "^1.39.0"
|
|
62
58
|
}
|
|
63
59
|
}
|
package/src/index.js
CHANGED
|
@@ -314,6 +314,10 @@ async function processArray(data, newData, database, type) {
|
|
|
314
314
|
if (data.method == "array.read") {
|
|
315
315
|
if (!data[type]) data[type] = [];
|
|
316
316
|
|
|
317
|
+
if (!Array.isArray(data[type])) {
|
|
318
|
+
data[type] = [data[type]];
|
|
319
|
+
}
|
|
320
|
+
|
|
317
321
|
for (let i = 0; i < objectStoreNames.length; i++) {
|
|
318
322
|
if (data.$filter && data.$filter.query) {
|
|
319
323
|
let isFilter = queryData(
|
package/webpack.config.js
CHANGED
|
@@ -1,90 +1,65 @@
|
|
|
1
|
-
const path = require("path")
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const {
|
|
5
|
-
|
|
6
|
-
module.exports = (env, argv) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
parallel: true,
|
|
67
|
-
// sourceMap: true, // Must be set to true if using source-maps in production
|
|
68
|
-
terserOptions: {
|
|
69
|
-
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
|
|
70
|
-
// extractComments: 'all',
|
|
71
|
-
compress: {
|
|
72
|
-
drop_console: true,
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
}),
|
|
76
|
-
],
|
|
77
|
-
splitChunks: {
|
|
78
|
-
chunks: "all",
|
|
79
|
-
minSize: 200,
|
|
80
|
-
// maxSize: 99999,
|
|
81
|
-
//minChunks: 1,
|
|
82
|
-
|
|
83
|
-
cacheGroups: {
|
|
84
|
-
defaultVendors: false,
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
}
|
|
89
|
-
return config
|
|
90
|
-
}
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
3
|
+
const { EsbuildPlugin } = require("esbuild-loader");
|
|
4
|
+
const { FileUploader } = require("@cocreate/webpack");
|
|
5
|
+
|
|
6
|
+
module.exports = async (env, argv) => {
|
|
7
|
+
const isProduction = argv && argv.mode === "production";
|
|
8
|
+
const config = {
|
|
9
|
+
entry: {
|
|
10
|
+
"CoCreate-indexeddb": "./src/index.js"
|
|
11
|
+
},
|
|
12
|
+
output: {
|
|
13
|
+
path: path.resolve(__dirname, "dist"),
|
|
14
|
+
filename: isProduction ? "[name].min.js" : "[name].js",
|
|
15
|
+
libraryExport: "default",
|
|
16
|
+
library: ["CoCreate", "indexeddb"],
|
|
17
|
+
clean: true
|
|
18
|
+
},
|
|
19
|
+
plugins: [
|
|
20
|
+
new MiniCssExtractPlugin({
|
|
21
|
+
filename: isProduction ? "[name].min.css" : "[name].css"
|
|
22
|
+
}),
|
|
23
|
+
new FileUploader(env, argv)
|
|
24
|
+
],
|
|
25
|
+
mode: isProduction ? "production" : "development",
|
|
26
|
+
devtool: isProduction ? "source-map" : "eval-source-map",
|
|
27
|
+
module: {
|
|
28
|
+
rules: [
|
|
29
|
+
{
|
|
30
|
+
test: /.js$/,
|
|
31
|
+
exclude: /node_modules/,
|
|
32
|
+
use: {
|
|
33
|
+
loader: "esbuild-loader",
|
|
34
|
+
options: {
|
|
35
|
+
loader: "js",
|
|
36
|
+
target: "es2017"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
test: /.css$/i,
|
|
42
|
+
use: [MiniCssExtractPlugin.loader, "css-loader"]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
optimization: {
|
|
47
|
+
minimize: isProduction,
|
|
48
|
+
minimizer: [
|
|
49
|
+
new EsbuildPlugin({
|
|
50
|
+
target: "es2017",
|
|
51
|
+
css: true
|
|
52
|
+
})
|
|
53
|
+
],
|
|
54
|
+
splitChunks: {
|
|
55
|
+
cacheGroups: {
|
|
56
|
+
defaultVendors: false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
performance: {
|
|
61
|
+
hints: isProduction ? "warning" : false
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return config;
|
|
65
|
+
};
|