@symbo.ls/fetch 2.9.7 → 2.10.4

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/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.js
21
+ var fetch_exports = {};
22
+ __export(fetch_exports, {
23
+ fetch: () => fetch,
24
+ fetchRemote: () => fetchRemote
25
+ });
26
+ module.exports = __toCommonJS(fetch_exports);
27
+ var BACKEND_URL = window.location.host.includes("local") ? "localhost:13335" : "api.symbols.app";
28
+ var fetchRemote = async (key, route) => {
29
+ let data = {};
30
+ await window.fetch(`https://${BACKEND_URL}/${route || ""}`, {
31
+ method: "GET",
32
+ headers: { "Content-Type": "application/json", "X-AppKey": key }
33
+ }).then((response) => {
34
+ return response.json().then((d) => data = d);
35
+ });
36
+ return data;
37
+ };
38
+ var fetch = fetchRemote;
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../index.js"],
4
+ "sourcesContent": ["'use strict'\n\nconst BACKEND_URL = window.location\n .host.includes('local')\n ? 'localhost:13335'\n : 'api.symbols.app'\n\nexport const fetchRemote = async (key, route) => {\n let data = {}\n await window.fetch(`https://${BACKEND_URL}/${route || ''}`, {\n method: 'GET',\n headers: { 'Content-Type': 'application/json', 'X-AppKey': key }\n }).then((response) => {\n return response.json().then(d => data = d)\n })\n return data\n}\n\nexport const fetch = fetchRemote\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAM,cAAc,OAAO,SACxB,KAAK,SAAS,OAAO,IACpB,oBACA;AAEG,IAAM,cAAc,OAAO,KAAK,UAAU;AAC/C,MAAI,OAAO,CAAC;AACZ,QAAM,OAAO,MAAM,WAAW,eAAe,SAAS,MAAM;AAAA,IAC1D,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,oBAAoB,YAAY,IAAI;AAAA,EACjE,CAAC,EAAE,KAAK,CAAC,aAAa;AACpB,WAAO,SAAS,KAAK,EAAE,KAAK,OAAK,OAAO,CAAC;AAAA,EAC3C,CAAC;AACD,SAAO;AACT;AAEO,IAAM,QAAQ;",
6
+ "names": []
7
+ }
package/index.js CHANGED
@@ -5,7 +5,7 @@ const BACKEND_URL = window.location
5
5
  ? 'localhost:13335'
6
6
  : 'api.symbols.app'
7
7
 
8
- export const fetch = async (key, route) => {
8
+ export const fetchRemote = async (key, route) => {
9
9
  let data = {}
10
10
  await window.fetch(`https://${BACKEND_URL}/${route || ''}`, {
11
11
  method: 'GET',
@@ -14,4 +14,6 @@ export const fetch = async (key, route) => {
14
14
  return response.json().then(d => data = d)
15
15
  })
16
16
  return data
17
- }
17
+ }
18
+
19
+ export const fetch = fetchRemote
package/package.json CHANGED
@@ -1,8 +1,16 @@
1
1
  {
2
2
  "name": "@symbo.ls/fetch",
3
- "version": "2.9.7",
3
+ "version": "2.10.4",
4
4
  "license": "MIT",
5
- "gitHead": "1d88bf5fa75a5c44f4f2e805fd16a67dc25ad247",
5
+ "gitHead": "d94c95a088b3530ab06dccbfc548d1e322df8426",
6
6
  "source": "index.js",
7
- "main": "index.js"
7
+ "main": "dist/index.js",
8
+ "browser": "dist/index.js",
9
+ "files": [
10
+ "index.js",
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "prepublish": "npx esbuild index.js --target=es2020 --format=cjs --outdir=dist --bundle --sourcemap=external"
15
+ }
8
16
  }
package/.eslintrc.js DELETED
@@ -1,9 +0,0 @@
1
- module.exports = {
2
- "extends": "standard",
3
- "env": {
4
- "es6": true,
5
- "browser": true,
6
- "node": true,
7
- "jest": true
8
- }
9
- }