@cocreate/text 1.28.2 → 1.28.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 CHANGED
@@ -1,3 +1,14 @@
1
+ ## [1.28.3](https://github.com/CoCreate-app/CoCreate-text/compare/v1.28.2...v1.28.3) (2025-04-30)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added css-loader ([64e8d78](https://github.com/CoCreate-app/CoCreate-text/commit/64e8d784b7c67496f84ba24908f5517cdf0ffa00))
7
+ * attributeObserver ([9c5db7e](https://github.com/CoCreate-app/CoCreate-text/commit/9c5db7e591e475bc2d31f3052a47855f6ed49f5b))
8
+ * update query attributes ([2223d0b](https://github.com/CoCreate-app/CoCreate-text/commit/2223d0b38389e4d0753323af65d556ceac222a6d))
9
+ * updated cocreate modules versions ([3f3c272](https://github.com/CoCreate-app/CoCreate-text/commit/3f3c272fd68e99e8c508cbe5cec9057e8265a2b7))
10
+ * webpack.config and devdependencies ([f3cfc60](https://github.com/CoCreate-app/CoCreate-text/commit/f3cfc60c793a3c74ed44f6bfdb3a625ea2d71213))
11
+
1
12
  ## [1.28.2](https://github.com/CoCreate-app/CoCreate-text/compare/v1.28.1...v1.28.2) (2025-04-11)
2
13
 
3
14
 
package/docs/index.html CHANGED
@@ -1,261 +1,261 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
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-text 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 HTML5 attributes or Javscript api 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
- <meta
21
- property="og:image"
22
- content="https://cdn.cocreate.app/docs/boilerplate.png" />
23
- <link
24
- rel="stylesheet"
25
- href="../index.css"
26
- array="files"
27
- object="60888216117c640e7596303f"
28
- key="src"
29
- type="text/css"
30
- save="true" />
31
- <link rel="manifest" href="/manifest.webmanifest" />
32
- </head>
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-text 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 HTML5 attributes or Javscript api 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
+ <meta
21
+ property="og:image"
22
+ content="https://cdn.cocreate.app/docs/boilerplate.png" />
23
+ <link
24
+ rel="stylesheet"
25
+ href="../index.css"
26
+ array="files"
27
+ object="60888216117c640e7596303f"
28
+ key="src"
29
+ type="text/css"
30
+ save="true" />
31
+ <link rel="manifest" href="/manifest.webmanifest" />
32
+ </head>
33
33
 
34
- <body>
35
- <!-- Navbar -->
36
- <nav
37
- class="width:100% display:flex align-items:center background:transparent padding-top:10px padding-bottom:10px"
38
- content_id="content"
39
- scroll="sticky-nav,"
40
- scroll-up="5"
41
- scroll-down="5"
42
- path="../"
43
- src="../components/navbar.html"></nav>
44
- <sidenav
45
- id="menuL"
46
- class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
47
- resizable
48
- resize-selector="[content_id='content']"
49
- resize-property="margin-left"
50
- resize-value="width">
51
- <menu
52
- array="files"
53
- object="603717b07de7fb350ae9fec8"
54
- key="src"></menu>
55
- <div resize="right"></div>
56
- </sidenav>
57
- <main
58
- class="padding-top:15px padding:15px@lg@xl"
59
- content_id="content"
60
- id="cocreate-text">
61
- <div
62
- class="display:flex flex-wrap:wrap justify-content:space-between">
63
- <div class="display:flex align-items:center">
64
- <h2>CoCreate-text</h2>
65
- </div>
66
- <div
67
- class="display:flex align-items:center font-size:20px"
68
- share-height="600"
69
- share-width="500"
70
- share-media="https://via.placeholder.com/300/09f/fff.png">
71
- <a
72
- href="https://github.com/CoCreate-app/CoCreate-text"
73
- target="_blank"
74
- class="margin-right:15px"
75
- ><i src="/assets/svg/github.svg"></i
76
- ></a>
77
- <a
78
- class="margin-right:15px share"
79
- share-network="twitter"
80
- title="Share on twitter"
81
- ><i src="/assets/svg/twitter.svg"></i
82
- ></a>
83
- <a
84
- class="margin-right:15px share"
85
- share-network="facebook"
86
- title="Share on Facebook"
87
- ><i src="/assets/svg/facebook.svg"></i
88
- ></a>
89
- <a
90
- class="margin-right:15px share"
91
- share-network="instagram"
92
- title="Share on instagram"
93
- ><i src="/assets/svg/instagram.svg"></i
94
- ></a>
95
- <a
96
- class="margin-right:15px share"
97
- share-network="share"
98
- title="Share on share"
99
- ><i src="/assets/svg/share-alt.svg"></i
100
- ></a>
101
- </div>
102
- </div>
103
- <h1 class="max-width:500px margin:20px_0px">
104
- A headless vinilla javascript micro component. Easy
105
- configuration using HTML5 attributes or Javscript api.
106
- </h1>
107
- <div id="text-section" class="display:flex flex-wrap:wrap">
108
- <div
109
- class="flex-grow:1 width:300px padding:0px_10px margin:20px_0px">
110
- <h2
111
- class="border-bottom:1px_solid_lightgrey padding:5px_0px">
112
- Install
113
- </h2>
114
- <pre><code class="language-javascript">npm install cocreate-text</code></pre>
115
- <p class="padding:10px_0px">Or you can use cdn link:</p>
116
- <pre><code class="language-javascript">https://cdn.cocreate.app/CoCreate-text.min.js</code></pre>
34
+ <body>
35
+ <!-- Navbar -->
36
+ <nav
37
+ class="width:100% display:flex align-items:center background:transparent padding-top:10px padding-bottom:10px"
38
+ content_id="content"
39
+ scroll="sticky-nav,"
40
+ scroll-up="5"
41
+ scroll-down="5"
42
+ path="../"
43
+ src="../components/navbar.html"></nav>
44
+ <sidenav
45
+ id="menuL"
46
+ class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
47
+ resizable
48
+ resize-query="[content_id='content']"
49
+ resize-property="margin-left"
50
+ resize-value="width">
51
+ <menu
52
+ array="files"
53
+ object="603717b07de7fb350ae9fec8"
54
+ key="src"></menu>
55
+ <div resize="right"></div>
56
+ </sidenav>
57
+ <main
58
+ class="padding-top:15px padding:15px@lg@xl"
59
+ content_id="content"
60
+ id="cocreate-text">
61
+ <div
62
+ class="display:flex flex-wrap:wrap justify-content:space-between">
63
+ <div class="display:flex align-items:center">
64
+ <h2>CoCreate-text</h2>
65
+ </div>
66
+ <div
67
+ class="display:flex align-items:center font-size:20px"
68
+ share-height="600"
69
+ share-width="500"
70
+ share-media="https://via.placeholder.com/300/09f/fff.png">
71
+ <a
72
+ href="https://github.com/CoCreate-app/CoCreate-text"
73
+ target="_blank"
74
+ class="margin-right:15px"
75
+ ><i src="/assets/svg/github.svg"></i
76
+ ></a>
77
+ <a
78
+ class="margin-right:15px share"
79
+ share-network="twitter"
80
+ title="Share on twitter"
81
+ ><i src="/assets/svg/twitter.svg"></i
82
+ ></a>
83
+ <a
84
+ class="margin-right:15px share"
85
+ share-network="facebook"
86
+ title="Share on Facebook"
87
+ ><i src="/assets/svg/facebook.svg"></i
88
+ ></a>
89
+ <a
90
+ class="margin-right:15px share"
91
+ share-network="instagram"
92
+ title="Share on instagram"
93
+ ><i src="/assets/svg/instagram.svg"></i
94
+ ></a>
95
+ <a
96
+ class="margin-right:15px share"
97
+ share-network="share"
98
+ title="Share on share"
99
+ ><i src="/assets/svg/share-alt.svg"></i
100
+ ></a>
101
+ </div>
102
+ </div>
103
+ <h1 class="max-width:500px margin:20px_0px">
104
+ A headless vinilla javascript micro component. Easy
105
+ configuration using HTML5 attributes or Javscript api.
106
+ </h1>
107
+ <div id="text-section" class="display:flex flex-wrap:wrap">
108
+ <div
109
+ class="flex-grow:1 width:300px padding:0px_10px margin:20px_0px">
110
+ <h2
111
+ class="border-bottom:1px_solid_lightgrey padding:5px_0px">
112
+ Install
113
+ </h2>
114
+ <pre><code class="language-javascript">npm install cocreate-text</code></pre>
115
+ <p class="padding:10px_0px">Or you can use cdn link:</p>
116
+ <pre><code class="language-javascript">https://cdn.cocreate.app/CoCreate-text.min.js</code></pre>
117
117
 
118
- <h2
119
- class="border-bottom:1px_solid_lightgrey margin-top:80px padding:5px_0px">
120
- Usage
121
- </h2>
122
- <div class="">
123
- <p class="padding:10px_0px">This is text reference</p>
118
+ <h2
119
+ class="border-bottom:1px_solid_lightgrey margin-top:80px padding:5px_0px">
120
+ Usage
121
+ </h2>
122
+ <div class="">
123
+ <p class="padding:10px_0px">This is text reference</p>
124
124
 
125
- <div class="flex-grow:1 min-width:300px width:100%">
126
- <pre>
125
+ <div class="flex-grow:1 min-width:300px width:100%">
126
+ <pre>
127
127
  <code>&lt;div&gt;&lt;/div&gt;</code>
128
128
  </pre>
129
- </div>
130
- <p class="padding:10px_0px">This is text reference</p>
131
- <p class="padding:10px_0px">This is text reference</p>
132
- </div>
133
- <h2
134
- class="border-bottom:1px_solid_lightgrey padding:5px_0px">
135
- Attributes
136
- </h2>
137
- <ul class="list-style-type:none">
138
- <li
139
- class="padding:15px_0px border-bottom:1px_solid_lightgrey">
140
- <h4>
141
- <span>text</span>
142
- <span class="cocreate-badge success"
143
- >string</span
144
- >
145
- <span class="cocreate-badge warning"
146
- >optional</span
147
- >
148
- </h4>
149
- <p>text-attribute</p>
150
- </li>
151
- <li
152
- class="padding:15px_0px border-bottom:1px_solid_lightgrey">
153
- <h4>
154
- <span>text</span>
155
- <span class="cocreate-badge success"
156
- >string</span
157
- >
158
- <span class="cocreate-badge warning"
159
- >optional</span
160
- >
161
- </h4>
162
- <p>text-attribute</p>
163
- </li>
164
- </ul>
165
- </div>
129
+ </div>
130
+ <p class="padding:10px_0px">This is text reference</p>
131
+ <p class="padding:10px_0px">This is text reference</p>
132
+ </div>
133
+ <h2
134
+ class="border-bottom:1px_solid_lightgrey padding:5px_0px">
135
+ Attributes
136
+ </h2>
137
+ <ul class="list-style-type:none">
138
+ <li
139
+ class="padding:15px_0px border-bottom:1px_solid_lightgrey">
140
+ <h4>
141
+ <span>text</span>
142
+ <span class="cocreate-badge success"
143
+ >string</span
144
+ >
145
+ <span class="cocreate-badge warning"
146
+ >optional</span
147
+ >
148
+ </h4>
149
+ <p>text-attribute</p>
150
+ </li>
151
+ <li
152
+ class="padding:15px_0px border-bottom:1px_solid_lightgrey">
153
+ <h4>
154
+ <span>text</span>
155
+ <span class="cocreate-badge success"
156
+ >string</span
157
+ >
158
+ <span class="cocreate-badge warning"
159
+ >optional</span
160
+ >
161
+ </h4>
162
+ <p>text-attribute</p>
163
+ </li>
164
+ </ul>
165
+ </div>
166
166
 
167
- <div
168
- class="flex-grow:1 width:300px padding:0px_10px margin:20px_0px border-bottom:1px_solid_lightgrey">
169
- <!-- SandBox -->
170
- <h2
171
- class="border-bottom:1px_solid_lightgrey padding:5px_0px">
172
- Demo
173
- </h2>
174
- <div
175
- class="position:sticky top:0 padding:15px_0px height:100vh">
176
- <!-- SandBox -->
177
- <div
178
- class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px"
179
- id="playground">
180
- <div
181
- id="demo-code"
182
- resizable
183
- class="position:relative height:50%">
184
- <textarea
185
- type="code"
186
- lang="html"
187
- array="demos"
188
- object=""
189
- key="demo"
190
- save="false"
191
- id="demo"
192
- input-selector=".demopreview"
193
- input-attribute="value"
194
- input-events="input, onload"
195
- class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
196
- <div
197
- resize="bottom"
198
- class="background:lightgrey"></div>
199
- </div>
167
+ <div
168
+ class="flex-grow:1 width:300px padding:0px_10px margin:20px_0px border-bottom:1px_solid_lightgrey">
169
+ <!-- SandBox -->
170
+ <h2
171
+ class="border-bottom:1px_solid_lightgrey padding:5px_0px">
172
+ Demo
173
+ </h2>
174
+ <div
175
+ class="position:sticky top:0 padding:15px_0px height:100vh">
176
+ <!-- SandBox -->
177
+ <div
178
+ class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px"
179
+ id="playground">
180
+ <div
181
+ id="demo-code"
182
+ resizable
183
+ class="position:relative height:50%">
184
+ <textarea
185
+ type="code"
186
+ lang="html"
187
+ array="demos"
188
+ object=""
189
+ key="demo"
190
+ save="false"
191
+ id="demo"
192
+ input-query=".demopreview"
193
+ input-attribute="value"
194
+ input-events="input, onload"
195
+ class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
196
+ <div
197
+ resize="bottom"
198
+ class="background:lightgrey"></div>
199
+ </div>
200
200
 
201
- <div
202
- id="demo-preview"
203
- class="position:relative overflow:auto background-color:white">
204
- <div class="demopreview padding:20px"></div>
205
- </div>
201
+ <div
202
+ id="demo-preview"
203
+ class="position:relative overflow:auto background-color:white">
204
+ <div class="demopreview padding:20px"></div>
205
+ </div>
206
206
 
207
- <div
208
- class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
209
- <a
210
- class="margin-right:10px"
211
- id="eye"
212
- show="#eye-slash"
213
- hide="#eye, #demo-preview"
214
- toggle="code-height"
215
- toggle-selector="#demo-code"
216
- ><i
217
- class="height:18px"
218
- src="/assets/svg/eye.svg"></i
219
- ></a>
220
- <a
221
- class="margin-right:10px"
222
- hidden
223
- id="eye-slash"
224
- show="#eye, #demo-preview"
225
- hide="#eye-slash"
226
- toggle="code-height"
227
- toggle-selector="#demo-code"
228
- ><i src="/assets/svg/eye-slash.svg"></i
229
- ></a>
230
- <a
231
- class="margin-right:10px"
232
- id="code"
233
- show="#code-slash"
234
- hide="#code, #demo-code"
235
- ><i src="/assets/svg/code.svg"></i
236
- ></a>
237
- <a
238
- class="margin-right:10px"
239
- hidden
240
- id="code-slash"
241
- show="#code, #demo-code"
242
- hide="#code-slash"
243
- ><i
244
- class="height:18px"
245
- src="/assets/svg/code.svg"></i
246
- ></a>
247
- <a
248
- class="margin-right:5px"
249
- fullscreen
250
- fullscreen-selector="#playground"></a>
251
- </div>
252
- </div>
253
- <!-- End SandBox -->
254
- </div>
255
- </div>
256
- </div>
257
- </main>
207
+ <div
208
+ class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
209
+ <a
210
+ class="margin-right:10px"
211
+ id="eye"
212
+ show="#eye-slash"
213
+ hide="#eye, #demo-preview"
214
+ toggle="code-height"
215
+ toggle-query="#demo-code"
216
+ ><i
217
+ class="height:18px"
218
+ src="/assets/svg/eye.svg"></i
219
+ ></a>
220
+ <a
221
+ class="margin-right:10px"
222
+ hidden
223
+ id="eye-slash"
224
+ show="#eye, #demo-preview"
225
+ hide="#eye-slash"
226
+ toggle="code-height"
227
+ toggle-query="#demo-code"
228
+ ><i src="/assets/svg/eye-slash.svg"></i
229
+ ></a>
230
+ <a
231
+ class="margin-right:10px"
232
+ id="code"
233
+ show="#code-slash"
234
+ hide="#code, #demo-code"
235
+ ><i src="/assets/svg/code.svg"></i
236
+ ></a>
237
+ <a
238
+ class="margin-right:10px"
239
+ hidden
240
+ id="code-slash"
241
+ show="#code, #demo-code"
242
+ hide="#code-slash"
243
+ ><i
244
+ class="height:18px"
245
+ src="/assets/svg/code.svg"></i
246
+ ></a>
247
+ <a
248
+ class="margin-right:5px"
249
+ fullscreen
250
+ fullscreen-query="#playground"></a>
251
+ </div>
252
+ </div>
253
+ <!-- End SandBox -->
254
+ </div>
255
+ </div>
256
+ </div>
257
+ </main>
258
258
 
259
- <script src="https://CoCreate.app/dist/CoCreate.js"></script>
260
- </body>
259
+ <script src="https://CoCreate.app/dist/CoCreate.js"></script>
260
+ </body>
261
261
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/text",
3
- "version": "1.28.2",
3
+ "version": "1.28.3",
4
4
  "description": "A simple text component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "text",
@@ -45,25 +45,21 @@
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "devDependencies": {
48
- "@babel/core": "^7.9.6",
49
- "@babel/preset-env": "^7.9.6",
50
- "babel-loader": "^8.1.0",
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/actions": "^1.18.2",
62
- "@cocreate/crdt": "^1.27.4",
63
- "@cocreate/cursors": "^1.23.4",
64
- "@cocreate/observer": "^1.16.1",
65
- "@cocreate/selection": "^1.12.2",
66
- "@cocreate/utils": "^1.33.7",
67
- "@cocreate/uuid": "^1.11.2"
57
+ "@cocreate/actions": "^1.21.0",
58
+ "@cocreate/crdt": "^1.28.0",
59
+ "@cocreate/cursors": "^1.24.1",
60
+ "@cocreate/observer": "^1.18.0",
61
+ "@cocreate/selection": "^1.14.0",
62
+ "@cocreate/utils": "^1.38.0",
63
+ "@cocreate/uuid": "^1.12.0"
68
64
  }
69
65
  }
package/src/index.js CHANGED
@@ -606,10 +606,7 @@ observer.init({
606
606
  observer.init({
607
607
  name: "CoCreateTextAttribtes",
608
608
  types: ["attributes"],
609
- attributeFilter: [
610
- ...getAttributeNames(["array", "object", "key"]),
611
- "contenteditable"
612
- ],
609
+ attributeFilter: ["array", "object", "key"],
613
610
  selector: selectors,
614
611
  callback(mutation) {
615
612
  let _id = mutation.target.getAttribute("object");
package/webpack.config.js CHANGED
@@ -1,88 +1,65 @@
1
- const path = require("path")
2
- const TerserPlugin = require("terser-webpack-plugin")
3
- const MiniCssExtractPlugin = require("mini-css-extract-plugin")
4
- const { CleanWebpackPlugin } = require("clean-webpack-plugin")
5
-
6
- module.exports = (env, argv) => {
7
- let isProduction = false
8
- if (argv.mode === 'production')
9
- isProduction = true
10
-
11
- const config = {
12
- entry: {
13
- "CoCreate-text": "./src/index.js",
14
- },
15
- output: {
16
- path: path.resolve(__dirname, "dist"),
17
- filename: isProduction ? "[name].min.js" : "[name].js",
18
- libraryTarget: "umd",
19
- libraryExport: "default",
20
- library: ["CoCreate", "text"],
21
- globalObject: "this",
22
- },
23
-
24
- plugins: [
25
- new CleanWebpackPlugin(),
26
- new MiniCssExtractPlugin({
27
- filename: "[name].css",
28
- }),
29
- ],
30
- // Default mode for Webpack is production.
31
- // Depending on mode Webpack will apply different things
32
- // on final bundle. For now we don't need production's JavaScript
33
- // minifying and other thing so let's set mode to development
34
- mode: isProduction ? "production" : "development",
35
- module: {
36
- rules: [
37
- {
38
- test: /.js$/,
39
- exclude: /(node_modules)/,
40
- use: {
41
- loader: "babel-loader",
42
- options: {
43
- plugins: ["@babel/plugin-transform-modules-commonjs"],
44
- },
45
- },
46
- },
47
- {
48
- test: /.css$/i,
49
- use: [
50
- { loader: "style-loader", options: { injectType: "linkTag" } },
51
- "file-loader",
52
- ],
53
- },
54
- ],
55
- },
56
-
57
- // add source map
58
- ...(isProduction ? {} : { devtool: "eval-source-map" }),
59
-
60
- // optimization: {
61
- // minimize: true,
62
- // minimizer: [
63
- // new TerserPlugin({
64
- // extractComments: true,
65
- // // cache: true,
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
- }
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-text": "./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", "text"],
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
+ };