inline-attacher 0.0.8 → 0.1.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/README.md +24 -0
- package/dist/__tests__/adapters-input.test.d.ts +1 -0
- package/dist/__tests__/core.test.d.ts +1 -0
- package/dist/__tests__/utils.test.d.ts +1 -0
- package/dist/inline-attacher.js +90 -89
- package/dist/inline-attacher.umd.cjs +1 -1
- package/dist/types.d.ts +7 -0
- package/package.json +25 -19
package/README.md
CHANGED
|
@@ -38,3 +38,27 @@ npm i inline-attacher
|
|
|
38
38
|
parent: document.body,
|
|
39
39
|
});
|
|
40
40
|
```
|
|
41
|
+
|
|
42
|
+
- Custom upload handler
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { attach } from "inline-attacher";
|
|
46
|
+
|
|
47
|
+
const textarea = document.querySelector("textarea");
|
|
48
|
+
|
|
49
|
+
attach(textarea, {
|
|
50
|
+
async uploadHandler({ file, filename, formData }) {
|
|
51
|
+
const response = await myUploader.upload({
|
|
52
|
+
file,
|
|
53
|
+
filename,
|
|
54
|
+
formData,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return { url: response.publicUrl };
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The returned object is handled the same way as the built-in upload response:
|
|
63
|
+
`responseUrlKey` is used to read the uploaded file URL before replacing the
|
|
64
|
+
placeholder text.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/inline-attacher.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var o = (n, t, e) => (x(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
-
import { EditorView as V } from "@codemirror/view";
|
|
5
|
-
const E = {
|
|
1
|
+
import { EditorView as w } from "@codemirror/view";
|
|
2
|
+
const m = {
|
|
6
3
|
/**
|
|
7
4
|
* URL where the file will be send
|
|
8
5
|
*/
|
|
@@ -90,7 +87,7 @@ const E = {
|
|
|
90
87
|
onFileUploaded() {
|
|
91
88
|
}
|
|
92
89
|
};
|
|
93
|
-
async function
|
|
90
|
+
async function U({
|
|
94
91
|
url: n,
|
|
95
92
|
...t
|
|
96
93
|
}) {
|
|
@@ -109,60 +106,74 @@ async function D({
|
|
|
109
106
|
};
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
|
-
function
|
|
109
|
+
function x(n) {
|
|
113
110
|
return typeof n == "function";
|
|
114
111
|
}
|
|
115
|
-
function
|
|
116
|
-
const
|
|
117
|
-
let
|
|
118
|
-
for (const
|
|
119
|
-
if (
|
|
120
|
-
|
|
112
|
+
function V(n, t = "", e = "") {
|
|
113
|
+
const i = t.split(".");
|
|
114
|
+
let r = n;
|
|
115
|
+
for (const o of i)
|
|
116
|
+
if (r && typeof r == "object" && o in r)
|
|
117
|
+
r = r[o];
|
|
121
118
|
else
|
|
122
119
|
return e;
|
|
123
|
-
return
|
|
120
|
+
return r !== void 0 ? r : e;
|
|
124
121
|
}
|
|
125
|
-
class
|
|
122
|
+
class E {
|
|
123
|
+
options = m;
|
|
124
|
+
editor;
|
|
125
|
+
filename = "";
|
|
126
|
+
lastValue = "";
|
|
126
127
|
constructor(t, e) {
|
|
127
|
-
|
|
128
|
-
o(this, "editor");
|
|
129
|
-
o(this, "filename", "");
|
|
130
|
-
o(this, "lastValue", "");
|
|
131
|
-
this.editor = t, this.options = { ...E, ...e };
|
|
128
|
+
this.editor = t, this.options = { ...m, ...e };
|
|
132
129
|
}
|
|
133
130
|
/** Uploads file */
|
|
134
131
|
async uploadFile(t) {
|
|
135
132
|
const {
|
|
136
133
|
defaultExtension: e,
|
|
137
|
-
remoteFilename:
|
|
138
|
-
uploadFieldName:
|
|
139
|
-
extraParams:
|
|
140
|
-
extraHeaders:
|
|
141
|
-
uploadUrl:
|
|
142
|
-
uploadMethod:
|
|
143
|
-
beforeFileUpload:
|
|
144
|
-
|
|
134
|
+
remoteFilename: i,
|
|
135
|
+
uploadFieldName: r,
|
|
136
|
+
extraParams: o,
|
|
137
|
+
extraHeaders: a,
|
|
138
|
+
uploadUrl: l,
|
|
139
|
+
uploadMethod: d,
|
|
140
|
+
beforeFileUpload: F,
|
|
141
|
+
uploadHandler: h
|
|
142
|
+
} = this.options, c = new FormData();
|
|
145
143
|
let f = e;
|
|
146
144
|
if (t.name) {
|
|
147
|
-
const [
|
|
148
|
-
|
|
145
|
+
const [s] = t.name.match(/\.(.+)$/) || [];
|
|
146
|
+
s && (f = s);
|
|
149
147
|
}
|
|
150
|
-
const
|
|
151
|
-
if (this.filename =
|
|
152
|
-
|
|
153
|
-
}), !(
|
|
148
|
+
const u = i?.(t) || `image-${Date.now()}.${f}`;
|
|
149
|
+
if (this.filename = u, c.append(r, t, u), Object.keys(o).forEach((s) => {
|
|
150
|
+
c.append(s, o[s]);
|
|
151
|
+
}), !F?.(c)) return;
|
|
152
|
+
if (h) {
|
|
153
|
+
try {
|
|
154
|
+
const s = await h({
|
|
155
|
+
file: t,
|
|
156
|
+
filename: u,
|
|
157
|
+
formData: c,
|
|
158
|
+
options: this.options
|
|
159
|
+
});
|
|
160
|
+
this.onFileUploadSucceed(s);
|
|
161
|
+
} catch (s) {
|
|
162
|
+
this.onFileUploadError(s instanceof Error ? s : new Error(String(s)));
|
|
163
|
+
}
|
|
154
164
|
return;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
}
|
|
166
|
+
const { ok: v, value: g } = await U({
|
|
167
|
+
url: l,
|
|
168
|
+
method: d,
|
|
169
|
+
body: c,
|
|
170
|
+
headers: a
|
|
160
171
|
});
|
|
161
|
-
if (!
|
|
162
|
-
this.onFileUploadError(
|
|
172
|
+
if (!v) {
|
|
173
|
+
this.onFileUploadError(g);
|
|
163
174
|
return;
|
|
164
175
|
}
|
|
165
|
-
this.onFileUploadSucceed(
|
|
176
|
+
this.onFileUploadSucceed(g);
|
|
166
177
|
}
|
|
167
178
|
/**
|
|
168
179
|
* Returns if the given file is allowed to handle
|
|
@@ -175,23 +186,16 @@ class v {
|
|
|
175
186
|
* Handles upload response
|
|
176
187
|
*/
|
|
177
188
|
onFileUploadSucceed(t) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const r = A(t, i) || "unknown URL";
|
|
183
|
-
if (!r)
|
|
184
|
-
return;
|
|
185
|
-
const l = /!\[({[^}]+})]\(([^)]+)\)/, c = T(s) ? s(r, t) : s.replace(s.match(l)[1], this.filename).replace(s.match(l)[2], r), p = this.editor.getValue().replace(this.lastValue, c);
|
|
186
|
-
this.editor.setValue(p), (a = (d = this.options).onFileUploaded) == null || a.call(d, r);
|
|
189
|
+
const { onFileUploadSucceed: e, urlText: i, responseUrlKey: r } = this.options;
|
|
190
|
+
if (!e?.(t) || !this.lastValue) return;
|
|
191
|
+
const o = V(t, r) || "unknown URL", a = /!\[({[^}]+})]\(([^)]+)\)/, l = x(i) ? i(o, t) : i.replace(i.match(a)[1], this.filename).replace(i.match(a)[2], o), d = this.editor.getValue().replace(this.lastValue, l);
|
|
192
|
+
this.editor.setValue(d), this.options.onFileUploaded?.(o);
|
|
187
193
|
}
|
|
188
194
|
/**
|
|
189
195
|
* Called when a file has failed to upload
|
|
190
196
|
*/
|
|
191
197
|
onFileUploadError(t) {
|
|
192
|
-
|
|
193
|
-
if (!((i = (s = this.options).onFileUploadError) != null && i.call(s, t)) || !this.lastValue)
|
|
194
|
-
return;
|
|
198
|
+
if (!this.options.onFileUploadError?.(t) || !this.lastValue) return;
|
|
195
199
|
const e = this.editor.getValue().replace(this.lastValue, this.options.errorText);
|
|
196
200
|
this.editor.setValue(e);
|
|
197
201
|
}
|
|
@@ -199,8 +203,7 @@ class v {
|
|
|
199
203
|
* Called when a file has been inserted, either by drop or paste
|
|
200
204
|
*/
|
|
201
205
|
onFileInserted(t) {
|
|
202
|
-
|
|
203
|
-
(s = (e = this.options).onFileReceived) != null && s.call(e, t) && (this.lastValue = this.options.progressText, this.editor.insertValue(this.lastValue));
|
|
206
|
+
this.options.onFileReceived?.(t) && (this.lastValue = this.options.progressText, this.editor.insertValue(this.lastValue));
|
|
204
207
|
}
|
|
205
208
|
handleFiles(t) {
|
|
206
209
|
Array.from(t).forEach((e) => {
|
|
@@ -211,33 +214,31 @@ class v {
|
|
|
211
214
|
* Called when a paste event occurred
|
|
212
215
|
*/
|
|
213
216
|
onPaste(t) {
|
|
214
|
-
|
|
215
|
-
(e = t.clipboardData) != null && e.files.length && this.handleFiles(t.clipboardData.files);
|
|
217
|
+
t.clipboardData?.files.length && this.handleFiles(t.clipboardData.files);
|
|
216
218
|
}
|
|
217
219
|
/**
|
|
218
220
|
* Called when a drop event occurred
|
|
219
221
|
*/
|
|
220
222
|
onDrop(t) {
|
|
221
|
-
|
|
222
|
-
(e = t.dataTransfer) != null && e.files.length && this.handleFiles(t.dataTransfer.files);
|
|
223
|
+
t.dataTransfer?.files.length && this.handleFiles(t.dataTransfer.files);
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
|
-
function
|
|
226
|
-
const e = n.scrollTop,
|
|
227
|
-
n.value =
|
|
228
|
-
const
|
|
229
|
-
n.selectionStart =
|
|
226
|
+
function D(n, t) {
|
|
227
|
+
const e = n.scrollTop, i = n.selectionStart || 0, { value: r } = n, o = r.slice(0, i), a = r.slice(i, r.length);
|
|
228
|
+
n.value = o + t + a;
|
|
229
|
+
const l = i + t.length;
|
|
230
|
+
n.selectionStart = l, n.selectionEnd = l, n.scrollTop = e, n.focus();
|
|
230
231
|
}
|
|
231
|
-
class
|
|
232
|
+
class T {
|
|
233
|
+
instance;
|
|
232
234
|
constructor(t) {
|
|
233
|
-
o(this, "instance");
|
|
234
235
|
this.instance = t;
|
|
235
236
|
}
|
|
236
237
|
getValue() {
|
|
237
238
|
return this.instance.value;
|
|
238
239
|
}
|
|
239
240
|
insertValue(t) {
|
|
240
|
-
|
|
241
|
+
D(this.instance, t), this.dispatchInputEvent();
|
|
241
242
|
}
|
|
242
243
|
setValue(t) {
|
|
243
244
|
this.instance.value = t, this.dispatchInputEvent();
|
|
@@ -249,9 +250,9 @@ class b {
|
|
|
249
250
|
}));
|
|
250
251
|
}
|
|
251
252
|
}
|
|
252
|
-
class
|
|
253
|
+
class b extends E {
|
|
253
254
|
constructor(t, e = {}) {
|
|
254
|
-
super(new
|
|
255
|
+
super(new T(t), e);
|
|
255
256
|
}
|
|
256
257
|
bind() {
|
|
257
258
|
this.editor.instance.addEventListener(
|
|
@@ -272,12 +273,12 @@ class y extends v {
|
|
|
272
273
|
);
|
|
273
274
|
}
|
|
274
275
|
}
|
|
275
|
-
function
|
|
276
|
-
return new
|
|
276
|
+
function P(...n) {
|
|
277
|
+
return new b(...n).bind();
|
|
277
278
|
}
|
|
278
|
-
class
|
|
279
|
+
class y {
|
|
280
|
+
instance;
|
|
279
281
|
constructor(t) {
|
|
280
|
-
o(this, "instance");
|
|
281
282
|
this.instance = t;
|
|
282
283
|
}
|
|
283
284
|
getValue() {
|
|
@@ -297,9 +298,9 @@ class P {
|
|
|
297
298
|
}), this.instance.dispatch({ selection: { anchor: e } });
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
|
-
class
|
|
301
|
+
class p extends E {
|
|
301
302
|
constructor(t, e = {}) {
|
|
302
|
-
super(new
|
|
303
|
+
super(new y(t), e);
|
|
303
304
|
}
|
|
304
305
|
bind() {
|
|
305
306
|
this.editor.instance.dom.addEventListener(
|
|
@@ -320,16 +321,16 @@ class h extends v {
|
|
|
320
321
|
);
|
|
321
322
|
}
|
|
322
323
|
}
|
|
323
|
-
function
|
|
324
|
-
return new
|
|
324
|
+
function I(...n) {
|
|
325
|
+
return new p(...n).bind();
|
|
325
326
|
}
|
|
326
|
-
function
|
|
327
|
-
return
|
|
327
|
+
function S(n = {}) {
|
|
328
|
+
return w.domEventHandlers({
|
|
328
329
|
paste: (t, e) => {
|
|
329
|
-
new
|
|
330
|
+
new p(e, n).onPaste(t);
|
|
330
331
|
},
|
|
331
332
|
drop: (t, e) => {
|
|
332
|
-
t.stopPropagation(), t.preventDefault(), new
|
|
333
|
+
t.stopPropagation(), t.preventDefault(), new p(e, n).onDrop(t);
|
|
333
334
|
},
|
|
334
335
|
dragenter: (t) => {
|
|
335
336
|
t.stopPropagation(), t.preventDefault();
|
|
@@ -340,11 +341,11 @@ function M(n = {}) {
|
|
|
340
341
|
});
|
|
341
342
|
}
|
|
342
343
|
export {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
344
|
+
p as CodeMirrorInlineAttachmentAdapter,
|
|
345
|
+
m as DEFAULT_OPTIONS,
|
|
346
|
+
E as InlineAttachment,
|
|
347
|
+
b as InputInlineAttachmentAdapter,
|
|
348
|
+
P as attach,
|
|
349
|
+
I as attachCodeMirror,
|
|
350
|
+
S as inlineAttachmentExtension
|
|
350
351
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(o,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("@codemirror/view")):typeof define=="function"&&define.amd?define(["exports","@codemirror/view"],d):(o=typeof globalThis<"u"?globalThis:o||self,d(o.inlineAttacher={},o.CodemirrorView))})(this,(function(o,d){"use strict";const h={uploadUrl:"/upload",uploadMethod:"POST",uploadFieldName:"file",defaultExtension:"png",responseUrlKey:"url",allowedTypes:["image/jpeg","image/png","image/jpg","image/gif"],progressText:"![Uploading file...]()",urlText:"",errorText:"Error uploading file",extraParams:{},extraHeaders:{},beforeFileUpload(){return!0},onFileReceived(){return!0},onFileUploadSucceed(){return!0},onFileUploadError(){return!0},onFileUploaded(){}};async function A({url:n,...t}){try{const e=await fetch(n,t);if(!e.ok)throw new Error(e.statusText);return{ok:!0,value:await e.json()}}catch(e){return{ok:!1,value:e}}}function T(n){return typeof n=="function"}function U(n,t="",e=""){const i=t.split(".");let r=n;for(const s of i)if(r&&typeof r=="object"&&s in r)r=r[s];else return e;return r!==void 0?r:e}class f{options=h;editor;filename="";lastValue="";constructor(t,e){this.editor=t,this.options={...h,...e}}async uploadFile(t){const{defaultExtension:e,remoteFilename:i,uploadFieldName:r,extraParams:s,extraHeaders:l,uploadUrl:c,uploadMethod:m,beforeFileUpload:P,uploadHandler:F}=this.options,u=new FormData;let v=e;if(t.name){const[a]=t.name.match(/\.(.+)$/)||[];a&&(v=a)}const g=i?.(t)||`image-${Date.now()}.${v}`;if(this.filename=g,u.append(r,t,g),Object.keys(s).forEach(a=>{u.append(a,s[a])}),!P?.(u))return;if(F){try{const a=await F({file:t,filename:g,formData:u,options:this.options});this.onFileUploadSucceed(a)}catch(a){this.onFileUploadError(a instanceof Error?a:new Error(String(a)))}return}const{ok:S,value:w}=await A({url:c,method:m,body:u,headers:l});if(!S){this.onFileUploadError(w);return}this.onFileUploadSucceed(w)}isFileAllowed(t){const{allowedTypes:e}=this.options;return e.includes("*")||e.includes(t.type)}onFileUploadSucceed(t){const{onFileUploadSucceed:e,urlText:i,responseUrlKey:r}=this.options;if(!e?.(t)||!this.lastValue)return;const s=U(t,r)||"unknown URL",l=/!\[({[^}]+})]\(([^)]+)\)/,c=T(i)?i(s,t):i.replace(i.match(l)[1],this.filename).replace(i.match(l)[2],s),m=this.editor.getValue().replace(this.lastValue,c);this.editor.setValue(m),this.options.onFileUploaded?.(s)}onFileUploadError(t){if(!this.options.onFileUploadError?.(t)||!this.lastValue)return;const e=this.editor.getValue().replace(this.lastValue,this.options.errorText);this.editor.setValue(e)}onFileInserted(t){this.options.onFileReceived?.(t)&&(this.lastValue=this.options.progressText,this.editor.insertValue(this.lastValue))}handleFiles(t){Array.from(t).forEach(e=>{this.isFileAllowed(e)&&(this.onFileInserted(e),this.uploadFile(e))})}onPaste(t){t.clipboardData?.files.length&&this.handleFiles(t.clipboardData.files)}onDrop(t){t.dataTransfer?.files.length&&this.handleFiles(t.dataTransfer.files)}}function V(n,t){const e=n.scrollTop,i=n.selectionStart||0,{value:r}=n,s=r.slice(0,i),l=r.slice(i,r.length);n.value=s+t+l;const c=i+t.length;n.selectionStart=c,n.selectionEnd=c,n.scrollTop=e,n.focus()}class y{instance;constructor(t){this.instance=t}getValue(){return this.instance.value}insertValue(t){V(this.instance,t),this.dispatchInputEvent()}setValue(t){this.instance.value=t,this.dispatchInputEvent()}dispatchInputEvent(){this.instance.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0}))}}class E extends f{constructor(t,e={}){super(new y(t),e)}bind(){this.editor.instance.addEventListener("paste",t=>{this.onPaste(t)}),this.editor.instance.addEventListener("drop",t=>{t.preventDefault(),this.onDrop(t)}),this.editor.instance.addEventListener("dragover",t=>{t.preventDefault()})}}function b(...n){return new E(...n).bind()}class D{instance;constructor(t){this.instance=t}getValue(){return this.instance.state.doc.toString()}insertValue(t){this.instance.dispatch(this.instance.state.replaceSelection(t))}setValue(t){const e=this.instance.state.selection.main.head;this.instance.dispatch({changes:{from:0,to:this.instance.state.doc.length,insert:t}}),this.instance.dispatch({selection:{anchor:e}})}}class p extends f{constructor(t,e={}){super(new D(t),e)}bind(){this.editor.instance.dom.addEventListener("paste",t=>{this.onPaste(t)}),this.editor.instance.dom.addEventListener("drop",t=>{t.preventDefault(),this.onDrop(t)}),this.editor.instance.dom.addEventListener("dragover",t=>{t.preventDefault()})}}function I(...n){return new p(...n).bind()}function x(n={}){return d.EditorView.domEventHandlers({paste:(t,e)=>{new p(e,n).onPaste(t)},drop:(t,e)=>{t.stopPropagation(),t.preventDefault(),new p(e,n).onDrop(t)},dragenter:t=>{t.stopPropagation(),t.preventDefault()},dragover:t=>{t.stopPropagation(),t.preventDefault()}})}o.CodeMirrorInlineAttachmentAdapter=p,o.DEFAULT_OPTIONS=h,o.InlineAttachment=f,o.InputInlineAttachmentAdapter=E,o.attach=b,o.attachCodeMirror=I,o.inlineAttachmentExtension=x,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export interface UploadHandlerContext {
|
|
2
|
+
file: File;
|
|
3
|
+
filename: string;
|
|
4
|
+
formData: FormData;
|
|
5
|
+
options: InlineAttachmentOptions;
|
|
6
|
+
}
|
|
1
7
|
export interface InlineAttachmentOptions {
|
|
2
8
|
uploadUrl: string;
|
|
3
9
|
uploadMethod: string;
|
|
@@ -15,6 +21,7 @@ export interface InlineAttachmentOptions {
|
|
|
15
21
|
[name: string]: any;
|
|
16
22
|
};
|
|
17
23
|
beforeFileUpload?: (formData: FormData) => boolean;
|
|
24
|
+
uploadHandler?: (context: UploadHandlerContext) => Promise<Record<string, unknown>> | Record<string, unknown>;
|
|
18
25
|
remoteFilename?: (file: File) => string;
|
|
19
26
|
onFileReceived?: (file: File) => boolean;
|
|
20
27
|
onFileUploadSucceed?: (response: Record<string, unknown>) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inline-attacher",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "📎 A modern port from Inline Attachment",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -11,10 +11,23 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
14
15
|
"import": "./dist/inline-attacher.js",
|
|
15
16
|
"require": "./dist/inline-attacher.umd.cjs"
|
|
16
17
|
}
|
|
17
18
|
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "rimraf dist && tsc && vite build",
|
|
22
|
+
"preview": "vite preview",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"playground:dev": "pnpm -C playground dev",
|
|
25
|
+
"playground:deploy": "pnpm -C playground run deploy",
|
|
26
|
+
"lint": "eslint --fix --ext .ts src",
|
|
27
|
+
"prepublishOnly": "pnpm build",
|
|
28
|
+
"release": "pnpx standard-version && git push --follow-tags && pnpm publish",
|
|
29
|
+
"size-check": "pnpx vite-bundle-visualizer"
|
|
30
|
+
},
|
|
18
31
|
"keywords": [
|
|
19
32
|
"inline-attachment",
|
|
20
33
|
"attachment",
|
|
@@ -24,7 +37,7 @@
|
|
|
24
37
|
"image",
|
|
25
38
|
"file"
|
|
26
39
|
],
|
|
27
|
-
"author": "Michael Wang
|
|
40
|
+
"author": "Michael Wang <hi@eastsun.me> (https://github.com/EastSun5566)",
|
|
28
41
|
"license": "MIT",
|
|
29
42
|
"repository": {
|
|
30
43
|
"type": "git",
|
|
@@ -34,36 +47,29 @@
|
|
|
34
47
|
"url": "https://github.com/EastSun5566/inline-attachment/issues/new"
|
|
35
48
|
},
|
|
36
49
|
"homepage": "https://github.com/EastSun5566/inline-attachment",
|
|
50
|
+
"packageManager": "pnpm@10.34.4",
|
|
37
51
|
"engines": {
|
|
38
|
-
"node": ">=
|
|
52
|
+
"node": ">=22"
|
|
39
53
|
},
|
|
40
54
|
"peerDependencies": {
|
|
41
55
|
"@codemirror/view": ">=6.0.0"
|
|
42
56
|
},
|
|
43
57
|
"devDependencies": {
|
|
44
|
-
"@codemirror/state": "^6.
|
|
45
|
-
"@types/node": "^20.
|
|
58
|
+
"@codemirror/state": "^6.7.0",
|
|
59
|
+
"@types/node": "^22.20.0",
|
|
46
60
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
47
61
|
"@typescript-eslint/parser": "^6.21.0",
|
|
48
62
|
"eslint": "^8.57.1",
|
|
49
63
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
50
64
|
"eslint-config-airbnb-typescript": "^17.1.0",
|
|
51
65
|
"eslint-plugin-import": "^2.31.0",
|
|
66
|
+
"happy-dom": "^20.0.2",
|
|
52
67
|
"rimraf": "^5.0.10",
|
|
53
|
-
"typescript": "^
|
|
54
|
-
"vite": "^
|
|
68
|
+
"typescript": "^6.0.2",
|
|
69
|
+
"vite": "^7.3.0",
|
|
70
|
+
"vitest": "^4.0.16"
|
|
55
71
|
},
|
|
56
72
|
"dependencies": {
|
|
57
|
-
"@codemirror/view": "^6.
|
|
58
|
-
},
|
|
59
|
-
"scripts": {
|
|
60
|
-
"dev": "vite",
|
|
61
|
-
"build": "rimraf dist && tsc && vite build",
|
|
62
|
-
"preview": "vite preview",
|
|
63
|
-
"playground:dev": "pnpm -C playground dev",
|
|
64
|
-
"playground:deploy": "pnpm -C playground deploy",
|
|
65
|
-
"lint": "eslint --fix --ext .ts src",
|
|
66
|
-
"release": "pnpx standard-version && git push --follow-tags && pnpm publish && pnpm dlx jsr publish",
|
|
67
|
-
"size-check": "pnpx vite-bundle-visualizer"
|
|
73
|
+
"@codemirror/view": "^6.43.4"
|
|
68
74
|
}
|
|
69
|
-
}
|
|
75
|
+
}
|