@opensea/seadn 1.0.0 → 1.0.2

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 ADDED
@@ -0,0 +1,15 @@
1
+ # SeaDN Javascript SDK
2
+
3
+ ## Installation
4
+
5
+ ```sh
6
+ npm i @opensea/seadn
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ ```js
12
+ import { resizeImage } from '@opensea/seadn';
13
+
14
+ const resized = resizeImage(image, { height: 100, width: 100 });
15
+ ```
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- exports.resizeImage=function(r,t){var e=t.width,i=t.height,n=t.dpr,o=void 0===n?1:n;"string"==typeof r&&(r=new URL(r));var a=new URLSearchParams({auto:"format",dpr:String(o)});return void 0!==e&&a.set("w",String(e)),void 0!==i&&a.set("h",String(i)),r.search=a.toString(),r.toString()};
1
+ exports.isSupportedFormat=function(t){"string"==typeof t&&(t=new URL(t));var e=t.pathname;return e.endsWith(".jpg")||e.endsWith(".jpeg")||e.endsWith(".png")||e.endsWith(".webp")||e.endsWith(".gif")||e.startsWith("/gae/")},exports.resizeImage=function(t,e){var r=e.width,i=e.height,n=e.dpr,s=void 0===n?1:n;"string"==typeof t&&(t=new URL(t));var a=new URLSearchParams({auto:"format",dpr:String(s)});return void 0!==r&&a.set("w",String(r)),void 0!==i&&a.set("h",String(i)),t.search=a.toString(),t.toString()};
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n"],"names":["image","_ref","width","height","_ref$dpr","dpr","URL","params","URLSearchParams","auto","String","undefined","set","search","toString"],"mappings":"oBAM2B,SACzBA,EAAmBC,GACjB,IAAAC,EAAKD,EAALC,MAAOC,EAAMF,EAANE,OAAMC,EAAAH,EAAEI,IAAAA,OAAM,IAAHD,EAAG,EAACA,EAEH,iBAAVJ,IACTA,EAAQ,IAAIM,IAAIN,IAGlB,IAAMO,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNJ,IAAKK,OAAOL,KAWd,YARcM,IAAVT,GACFK,EAAOK,IAAI,IAAKF,OAAOR,SAEVS,IAAXR,GACFI,EAAOK,IAAI,IAAKF,OAAOP,IAGzBH,EAAMa,OAASN,EAAOO,WACfd,EAAMc,UACf"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["image","URL","pathname","endsWith","startsWith","_ref","width","height","_ref$dpr","dpr","params","URLSearchParams","auto","String","undefined","set","search","toString"],"mappings":"0BA8BiC,SAACA,GACX,iBAAVA,IACTA,EAAQ,IAAIC,IAAID,IAGlB,IAAQE,EAAaF,EAAbE,SACR,OACEA,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASE,WAAW,QAExB,sBAtC2B,SACzBJ,EAAmBK,GACjB,IAAAC,EAAKD,EAALC,MAAOC,EAAMF,EAANE,OAAMC,EAAAH,EAAEI,IAAAA,OAAG,IAAAD,EAAG,EAACA,EAEH,iBAAVR,IACTA,EAAQ,IAAIC,IAAID,IAGlB,IAAMU,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNH,IAAKI,OAAOJ,KAWd,YARcK,IAAVR,GACFI,EAAOK,IAAI,IAAKF,OAAOP,SAEVQ,IAAXP,GACFG,EAAOK,IAAI,IAAKF,OAAON,IAGzBP,EAAMgB,OAASN,EAAOO,WACfjB,EAAMiB,UACf"}
package/dist/index.d.ts CHANGED
@@ -5,3 +5,5 @@ export type ResizeParams = {
5
5
  height?: number;
6
6
  };
7
7
  export declare const resizeImage: (image: string | URL, { width, height, dpr }: ResizeParams) => string;
8
+ export declare const isSupportedFormat: (image: string | URL) => boolean;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,WAAW,UACf,MAAM,GAAG,GAAG,0BACS,YAAY,KACvC,MAmBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,MAAM,GAAG,GAAG,YAcpD,CAAC"}
@@ -1,2 +1,2 @@
1
- const t=(t,{width:r,height:n,dpr:e=1})=>{"string"==typeof t&&(t=new URL(t));const i=new URLSearchParams({auto:"format",dpr:String(e)});return void 0!==r&&i.set("w",String(r)),void 0!==n&&i.set("h",String(n)),t.search=i.toString(),t.toString()};export{t as resizeImage};
1
+ const t=(t,{width:e,height:n,dpr:r=1})=>{"string"==typeof t&&(t=new URL(t));const i=new URLSearchParams({auto:"format",dpr:String(r)});return void 0!==e&&i.set("w",String(e)),void 0!==n&&i.set("h",String(n)),t.search=i.toString(),t.toString()},e=t=>{"string"==typeof t&&(t=new URL(t));const{pathname:e}=t;return e.endsWith(".jpg")||e.endsWith(".jpeg")||e.endsWith(".png")||e.endsWith(".webp")||e.endsWith(".gif")||e.startsWith("/gae/")};export{e as isSupportedFormat,t as resizeImage};
2
2
  //# sourceMappingURL=index.modern.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.modern.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n"],"names":["resizeImage","image","width","height","dpr","URL","params","URLSearchParams","auto","String","undefined","set","search","toString"],"mappings":"AAMa,MAAAA,EAAcA,CACzBC,GACEC,QAAOC,SAAQC,IAAAA,EAAM,MAEF,iBAAVH,IACTA,EAAQ,IAAII,IAAIJ,IAGlB,MAAMK,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNJ,IAAKK,OAAOL,KAWd,YARcM,IAAVR,GACFI,EAAOK,IAAI,IAAKF,OAAOP,SAEVQ,IAAXP,GACFG,EAAOK,IAAI,IAAKF,OAAON,IAGzBF,EAAMW,OAASN,EAAOO,WACfZ,EAAMY,UACf"}
1
+ {"version":3,"file":"index.modern.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["resizeImage","image","width","height","dpr","URL","params","URLSearchParams","auto","String","undefined","set","search","toString","isSupportedFormat","pathname","endsWith","startsWith"],"mappings":"AAMa,MAAAA,EAAcA,CACzBC,GACEC,QAAOC,SAAQC,IAAAA,EAAM,MAEF,iBAAVH,IACTA,EAAQ,IAAII,IAAIJ,IAGlB,MAAMK,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNJ,IAAKK,OAAOL,KAWd,YARcM,IAAVR,GACFI,EAAOK,IAAI,IAAKF,OAAOP,SAEVQ,IAAXP,GACFG,EAAOK,IAAI,IAAKF,OAAON,IAGzBF,EAAMW,OAASN,EAAOO,WACfZ,EAAMY,YAGFC,EAAqBb,IACX,iBAAVA,IACTA,EAAQ,IAAII,IAAIJ,IAGlB,MAAMc,SAAEA,GAAad,EACrB,OACEc,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASE,WAAW,QAAO"}
@@ -1,2 +1,2 @@
1
- var r=function(r,t){var i=t.width,n=t.height,e=t.dpr,o=void 0===e?1:e;"string"==typeof r&&(r=new URL(r));var a=new URLSearchParams({auto:"format",dpr:String(o)});return void 0!==i&&a.set("w",String(i)),void 0!==n&&a.set("h",String(n)),r.search=a.toString(),r.toString()};export{r as resizeImage};
1
+ var t=function(t,n){var r=n.width,e=n.height,i=n.dpr,a=void 0===i?1:i;"string"==typeof t&&(t=new URL(t));var g=new URLSearchParams({auto:"format",dpr:String(a)});return void 0!==r&&g.set("w",String(r)),void 0!==e&&g.set("h",String(e)),t.search=g.toString(),t.toString()},n=function(t){"string"==typeof t&&(t=new URL(t));var n=t.pathname;return n.endsWith(".jpg")||n.endsWith(".jpeg")||n.endsWith(".png")||n.endsWith(".webp")||n.endsWith(".gif")||n.startsWith("/gae/")};export{n as isSupportedFormat,t as resizeImage};
2
2
  //# sourceMappingURL=index.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.module.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n"],"names":["resizeImage","image","_ref","width","height","_ref$dpr","dpr","URL","params","URLSearchParams","auto","String","undefined","set","search","toString"],"mappings":"AAMa,IAAAA,EAAc,SACzBC,EAAmBC,GACjB,IAAAC,EAAKD,EAALC,MAAOC,EAAMF,EAANE,OAAMC,EAAAH,EAAEI,IAAAA,OAAM,IAAHD,EAAG,EAACA,EAEH,iBAAVJ,IACTA,EAAQ,IAAIM,IAAIN,IAGlB,IAAMO,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNJ,IAAKK,OAAOL,KAWd,YARcM,IAAVT,GACFK,EAAOK,IAAI,IAAKF,OAAOR,SAEVS,IAAXR,GACFI,EAAOK,IAAI,IAAKF,OAAOP,IAGzBH,EAAMa,OAASN,EAAOO,WACfd,EAAMc,UACf"}
1
+ {"version":3,"file":"index.module.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["resizeImage","image","_ref","width","height","_ref$dpr","dpr","URL","params","URLSearchParams","auto","String","undefined","set","search","toString","isSupportedFormat","pathname","endsWith","startsWith"],"mappings":"AAMa,IAAAA,EAAc,SACzBC,EAAmBC,GACjB,IAAAC,EAAKD,EAALC,MAAOC,EAAMF,EAANE,OAAMC,EAAAH,EAAEI,IAAAA,OAAG,IAAAD,EAAG,EAACA,EAEH,iBAAVJ,IACTA,EAAQ,IAAIM,IAAIN,IAGlB,IAAMO,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNJ,IAAKK,OAAOL,KAWd,YARcM,IAAVT,GACFK,EAAOK,IAAI,IAAKF,OAAOR,SAEVS,IAAXR,GACFI,EAAOK,IAAI,IAAKF,OAAOP,IAGzBH,EAAMa,OAASN,EAAOO,WACfd,EAAMc,UACf,EAEaC,EAAoB,SAACf,GACX,iBAAVA,IACTA,EAAQ,IAAIM,IAAIN,IAGlB,IAAQgB,EAAahB,EAAbgB,SACR,OACEA,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASE,WAAW,QAExB"}
package/dist/index.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).seadn={})}(this,function(e){e.resizeImage=function(e,t){var n=t.width,i=t.height,o=t.dpr,r=void 0===o?1:o;"string"==typeof e&&(e=new URL(e));var d=new URLSearchParams({auto:"format",dpr:String(r)});return void 0!==n&&d.set("w",String(n)),void 0!==i&&d.set("h",String(i)),e.search=d.toString(),e.toString()}});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).seadn={})}(this,function(e){e.isSupportedFormat=function(e){"string"==typeof e&&(e=new URL(e));var t=e.pathname;return t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".png")||t.endsWith(".webp")||t.endsWith(".gif")||t.startsWith("/gae/")},e.resizeImage=function(e,t){var n=t.width,i=t.height,o=t.dpr,r=void 0===o?1:o;"string"==typeof e&&(e=new URL(e));var s=new URLSearchParams({auto:"format",dpr:String(r)});return void 0!==n&&s.set("w",String(n)),void 0!==i&&s.set("h",String(i)),e.search=s.toString(),e.toString()}});
2
2
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n"],"names":["image","_ref","width","height","_ref$dpr","dpr","URL","params","URLSearchParams","auto","String","undefined","set","search","toString"],"mappings":"6OAM2B,SACzBA,EAAmBC,GACjB,IAAAC,EAAKD,EAALC,MAAOC,EAAMF,EAANE,OAAMC,EAAAH,EAAEI,IAAAA,OAAM,IAAHD,EAAG,EAACA,EAEH,iBAAVJ,IACTA,EAAQ,IAAIM,IAAIN,IAGlB,IAAMO,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNJ,IAAKK,OAAOL,KAWd,YARcM,IAAVT,GACFK,EAAOK,IAAI,IAAKF,OAAOR,SAEVS,IAAXR,GACFI,EAAOK,IAAI,IAAKF,OAAOP,IAGzBH,EAAMa,OAASN,EAAOO,WACfd,EAAMc,UACf"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["export type ResizeParams = {\n dpr?: number;\n width?: number;\n height?: number;\n};\n\nexport const resizeImage = (\n image: string | URL,\n { width, height, dpr = 1 }: ResizeParams\n): string => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const params = new URLSearchParams({\n auto: 'format',\n dpr: String(dpr)\n });\n\n if (width !== undefined) {\n params.set('w', String(width));\n }\n if (height !== undefined) {\n params.set('h', String(height));\n }\n\n image.search = params.toString();\n return image.toString();\n};\n\nexport const isSupportedFormat = (image: string | URL) => {\n if (typeof image === 'string') {\n image = new URL(image);\n }\n\n const { pathname } = image;\n return (\n pathname.endsWith('.jpg') ||\n pathname.endsWith('.jpeg') ||\n pathname.endsWith('.png') ||\n pathname.endsWith('.webp') ||\n pathname.endsWith('.gif') ||\n pathname.startsWith('/gae/') // GoogleAppEngine URLs do not contain extensions\n );\n};\n"],"names":["image","URL","pathname","endsWith","startsWith","_ref","width","height","_ref$dpr","dpr","params","URLSearchParams","auto","String","undefined","set","search","toString"],"mappings":"mPA8BiC,SAACA,GACX,iBAAVA,IACTA,EAAQ,IAAIC,IAAID,IAGlB,IAAQE,EAAaF,EAAbE,SACR,OACEA,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASC,SAAS,UAClBD,EAASC,SAAS,SAClBD,EAASE,WAAW,QAExB,gBAtC2B,SACzBJ,EAAmBK,GACjB,IAAAC,EAAKD,EAALC,MAAOC,EAAMF,EAANE,OAAMC,EAAAH,EAAEI,IAAAA,OAAG,IAAAD,EAAG,EAACA,EAEH,iBAAVR,IACTA,EAAQ,IAAIC,IAAID,IAGlB,IAAMU,EAAS,IAAIC,gBAAgB,CACjCC,KAAM,SACNH,IAAKI,OAAOJ,KAWd,YARcK,IAAVR,GACFI,EAAOK,IAAI,IAAKF,OAAOP,SAEVQ,IAAXP,GACFG,EAAOK,IAAI,IAAKF,OAAON,IAGzBP,EAAMgB,OAASN,EAAOO,WACfjB,EAAMiB,UACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensea/seadn",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Javascript SDK to work with SeaDN",
5
5
  "license": "MIT",
6
6
  "author": "OpenSea Developers",
@@ -17,15 +17,18 @@
17
17
  "scripts": {
18
18
  "build": "microbundle",
19
19
  "check-types": "tsc --noEmit",
20
+ "lint": "concurrently \"npm run check-types\" \"npm run prettier:check\" \"npm run prettier:package.json:check\"",
20
21
  "prepare": "husky install",
21
22
  "prettier:check": "prettier --check .",
22
- "prettier:check:package.json": "prettier-package-json --list-different",
23
23
  "prettier:fix": "prettier --write .",
24
+ "prettier:package.json:check": "prettier-package-json --list-different",
24
25
  "test": "vitest"
25
26
  },
26
27
  "sideEffects": false,
27
28
  "types": "./dist/index.d.ts",
28
29
  "devDependencies": {
30
+ "@vitest/coverage-c8": "^0.29.1",
31
+ "concurrently": "^7.6.0",
29
32
  "esbuild": "^0.17.10",
30
33
  "husky": "^8.0.3",
31
34
  "lint-staged": "^13.1.2",