@prose-reader/shared 0.0.7 → 0.0.9

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.
@@ -0,0 +1,23 @@
1
+ const r = (e) => {
2
+ var t, n;
3
+ return ((n = (t = e.split(/[#?]/)[0]) == null ? void 0 : t.split(".").pop()) == null ? void 0 : n.trim()) || "";
4
+ }, i = (e) => {
5
+ switch (r(e)) {
6
+ case "png":
7
+ return "image/png";
8
+ case "jpg":
9
+ return "image/jpg";
10
+ case "jpeg":
11
+ return "image/jpeg";
12
+ case "txt":
13
+ return "text/plain";
14
+ case "webp":
15
+ return "image/webp";
16
+ }
17
+ }, p = (e) => e.length ? e.indexOf(";") ? e.substring(0, e.indexOf(";")) : e : void 0;
18
+ export {
19
+ i as detectContentType,
20
+ r as getUrlExtension,
21
+ p as parseContentType
22
+ };
23
+ //# sourceMappingURL=prose-shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prose-shared.js","sources":["../src/url.ts","../src/contentType.ts"],"sourcesContent":["export const getUrlExtension = (url: string) => {\n return url.split(/[#?]/)[0]?.split(`.`).pop()?.trim() || ``\n}\n","import { getUrlExtension } from \"./url\"\n\nexport const detectContentType = (name: string) => {\n const extension = getUrlExtension(name)\n\n switch (extension) {\n case `png`: return `image/png`\n case `jpg`: return `image/jpg`\n case `jpeg`: return `image/jpeg`\n case `txt`: return `text/plain`\n case `webp`: return `image/webp`\n }\n\n return undefined\n}\n\nexport const parseContentType = (str: string) => {\n if (!str.length) return undefined\n\n const cut = str.indexOf(`;`)\n\n return cut ? str.substring(0, str.indexOf(`;`)) : str\n}\n"],"names":["getUrlExtension","url","_a","_b","detectContentType","name","parseContentType","str"],"mappings":"AAAa,MAAAA,IAAkB,CAACC,MAAgB;AAAnC,MAAAC,GAAAC;AACJ,WAAAA,KAAAD,IAAAD,EAAI,MAAM,MAAM,EAAE,OAAlB,gBAAAC,EAAsB,MAAM,KAAK,UAAjC,gBAAAC,EAAwC,WAAU;AAC3D,GCAaC,IAAoB,CAACC,MAAiB;AAGjD,UAFkBL,EAAgBK,CAAI,GAEnB;AAAA,IACjB,KAAK;AAAc,aAAA;AAAA,IACnB,KAAK;AAAc,aAAA;AAAA,IACnB,KAAK;AAAe,aAAA;AAAA,IACpB,KAAK;AAAc,aAAA;AAAA,IACnB,KAAK;AAAe,aAAA;AAAA,EACtB;AAGF,GAEaC,IAAmB,CAACC,MAC1BA,EAAI,SAEGA,EAAI,QAAQ,GAAG,IAEdA,EAAI,UAAU,GAAGA,EAAI,QAAQ,GAAG,CAAC,IAAIA,IAJ1B;"}
@@ -0,0 +1,2 @@
1
+ (function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t["prose-shared"]={}))})(this,function(t){"use strict";const n=e=>{var i,o;return((o=(i=e.split(/[#?]/)[0])==null?void 0:i.split(".").pop())==null?void 0:o.trim())||""},p=e=>{switch(n(e)){case"png":return"image/png";case"jpg":return"image/jpg";case"jpeg":return"image/jpeg";case"txt":return"text/plain";case"webp":return"image/webp"}},s=e=>e.length?e.indexOf(";")?e.substring(0,e.indexOf(";")):e:void 0;t.detectContentType=p,t.getUrlExtension=n,t.parseContentType=s,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=prose-shared.umd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prose-shared.umd.cjs","sources":["../src/url.ts","../src/contentType.ts"],"sourcesContent":["export const getUrlExtension = (url: string) => {\n return url.split(/[#?]/)[0]?.split(`.`).pop()?.trim() || ``\n}\n","import { getUrlExtension } from \"./url\"\n\nexport const detectContentType = (name: string) => {\n const extension = getUrlExtension(name)\n\n switch (extension) {\n case `png`: return `image/png`\n case `jpg`: return `image/jpg`\n case `jpeg`: return `image/jpeg`\n case `txt`: return `text/plain`\n case `webp`: return `image/webp`\n }\n\n return undefined\n}\n\nexport const parseContentType = (str: string) => {\n if (!str.length) return undefined\n\n const cut = str.indexOf(`;`)\n\n return cut ? str.substring(0, str.indexOf(`;`)) : str\n}\n"],"names":["getUrlExtension","url","_b","_a","detectContentType","name","parseContentType","str"],"mappings":"uOAAa,MAAAA,EAAmBC,GAAgB,SACvC,QAAAC,GAAAC,EAAAF,EAAI,MAAM,MAAM,EAAE,KAAlB,YAAAE,EAAsB,MAAM,KAAK,QAAjC,YAAAD,EAAwC,SAAU,EAC3D,ECAaE,EAAqBC,GAAiB,CAGjD,OAFkBL,EAAgBK,CAAI,EAEnB,CACjB,IAAK,MAAc,MAAA,YACnB,IAAK,MAAc,MAAA,YACnB,IAAK,OAAe,MAAA,aACpB,IAAK,MAAc,MAAA,aACnB,IAAK,OAAe,MAAA,YACtB,CAGF,EAEaC,EAAoBC,GAC1BA,EAAI,OAEGA,EAAI,QAAQ,GAAG,EAEdA,EAAI,UAAU,EAAGA,EAAI,QAAQ,GAAG,CAAC,EAAIA,EAJ1B"}
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "@prose-reader/shared",
3
- "version": "0.0.7",
4
- "main": "dist/index.js",
3
+ "version": "0.0.9",
4
+ "type": "module",
5
+ "main": "./dist/prose-shared.umd.cjs",
6
+ "module": "./dist/prose-shared.js",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/prose-shared.js",
10
+ "require": "./dist/prose-shared.umd.cjs"
11
+ }
12
+ },
13
+ "types": "./dist/index.d.ts",
5
14
  "license": "MIT",
6
15
  "files": [
7
16
  "/dist"
8
17
  ],
9
18
  "scripts": {
10
19
  "lint": "echo",
11
- "start": "NODE_ENV=development webpack build --config ./webpack.config.js --watch",
12
- "build": "NODE_ENV=development webpack build --config ./webpack.config.js",
13
- "build:prod": "NODE_ENV=production webpack build --config ./webpack.config.js",
20
+ "start": "vite build --watch --mode development",
21
+ "build": "tsc && vite build",
14
22
  "test": "echo"
15
23
  },
16
- "devDependencies": {
17
- "typescript": "*"
18
- },
19
- "gitHead": "1f28c007ad5b72e6a131e77aa3438b652d0203c2"
24
+ "gitHead": "978abbefaf7754444771d040be68b8e604f28c2b"
20
25
  }
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- (()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{detectContentType:()=>n,getUrlExtension:()=>r,parseContentType:()=>o});const r=e=>{var t,r;return(null===(r=null===(t=e.split(/[#?]/)[0])||void 0===t?void 0:t.split(".").pop())||void 0===r?void 0:r.trim())||""},n=e=>{switch(r(e)){case"png":return"image/png";case"jpg":return"image/jpg";case"jpeg":return"image/jpeg";case"txt":return"text/plain";case"webp":return"image/webp"}},o=e=>{if(e.length)return e.indexOf(";")?e.substring(0,e.indexOf(";")):e};var i=exports;for(var p in t)i[p]=t[p];t.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();