@symbo.ls/fetch 3.1.2 → 3.2.7

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/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  'use strict'
2
2
 
3
3
  import * as utils from '@domql/utils'
4
- const { window, overwriteDeep, deepDestringify } = utils
4
+ const { window, overwriteDeep, deepDestringifyFunctions } = utils
5
5
 
6
6
  const IS_DEVELOPMENT =
7
7
  window && window.location
8
8
  ? window.location.host.includes('dev.')
9
- : process.env.NODE_ENV === 'development'
9
+ : utils.isDevelopment()
10
10
 
11
11
  const SERVER_URL = IS_DEVELOPMENT
12
- ? 'http://localhost:13335/get'
12
+ ? 'http://localhost:8080/get'
13
13
  : 'https://api.symbols.app/get'
14
14
 
15
15
  const defaultOptions = {
@@ -30,7 +30,11 @@ export const fetchRemote = async (key, options = defaultOptions) => {
30
30
  try {
31
31
  response = await fetch(baseUrl + '/' + '?' + route, {
32
32
  method: 'GET',
33
- headers: { 'Content-Type': 'application/json', 'X-AppKey': key, 'X-Metadata': options.metadata }
33
+ headers: {
34
+ 'Content-Type': 'application/json',
35
+ 'X-AppKey': key,
36
+ 'X-Metadata': options.metadata
37
+ }
34
38
  })
35
39
 
36
40
  return await response.json()
@@ -45,9 +49,10 @@ export const fetchProject = async (key, options) => {
45
49
 
46
50
  if (editor && editor.remote) {
47
51
  const data = await fetchRemote(key, editor)
48
- const evalData = (IS_DEVELOPMENT || options.isDevelopment)
49
- ? deepDestringify(data)
50
- : deepDestringify(data.releases[0])
52
+ const evalData =
53
+ IS_DEVELOPMENT || options.isDevelopment
54
+ ? deepDestringifyFunctions(data)
55
+ : deepDestringifyFunctions(data.releases[0])
51
56
 
52
57
  if (editor.serviceRoute) {
53
58
  if (utils.isArray(editor.serviceRoute)) {
@@ -58,7 +63,7 @@ export const fetchProject = async (key, options) => {
58
63
  overwriteDeep(options[editor.serviceRoute], evalData)
59
64
  }
60
65
  } else {
61
- [
66
+ ;[
62
67
  'state',
63
68
  'designSystem',
64
69
  'components',
@@ -82,9 +87,10 @@ export const fetchProjectAsync = async (key, options, callback) => {
82
87
 
83
88
  if (editor && editor.remote) {
84
89
  const data = await fetchRemote(key, editor)
85
- const evalData = (IS_DEVELOPMENT || options.isDevelopment)
86
- ? deepDestringify(data)
87
- : deepDestringify(data.releases[0])
90
+ const evalData =
91
+ IS_DEVELOPMENT || options.isDevelopment
92
+ ? deepDestringifyFunctions(data)
93
+ : deepDestringifyFunctions(data.releases[0])
88
94
  callback(evalData)
89
95
  }
90
96
  }
package/package.json CHANGED
@@ -1,34 +1,37 @@
1
1
  {
2
2
  "name": "@symbo.ls/fetch",
3
- "version": "3.1.2",
3
+ "version": "3.2.7",
4
4
  "license": "MIT",
5
- "gitHead": "429b36616aa04c8587a26ce3c129815115e35897",
5
+ "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
6
6
  "type": "module",
7
- "module": "index.js",
8
- "main": "index.js",
9
- "unpkg": "dist/iife/index.js",
10
- "jsdelivr": "dist/iife/index.js",
7
+ "module": "./index.js",
8
+ "main": "./index.js",
9
+ "unpkg": "./dist/iife/index.js",
10
+ "jsdelivr": "./dist/iife/index.js",
11
11
  "exports": {
12
12
  ".": {
13
- "default": "./dist/esm/index.js",
14
- "import": "./dist/esm/index.js",
15
- "require": "./dist/cjs/index.js"
13
+ "import": "./index.js",
14
+ "require": "./index.js",
15
+ "browser": "./index.js",
16
+ "default": "./index.js"
16
17
  }
17
18
  },
18
19
  "source": "index.js",
19
20
  "files": [
20
- "*.js",
21
- "dist"
21
+ "dist",
22
+ "*.js"
22
23
  ],
23
24
  "scripts": {
24
25
  "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
25
- "build:esm": "npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm",
26
- "build:cjs": "npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs",
27
- "build:iife": "npx esbuild *.js --target=node16 --format=iife --outdir=dist/iife",
28
- "build": "rimraf -I dist; npm run build:cjs; npm run build:esm",
29
- "prepublish": "npm run build; npm run copy:package:cjs"
26
+ "build:esm": "cross-env NODE_ENV=$NODE_ENV esbuild *.js --target=es2020 --format=esm --outdir=dist/esm --define:process.env.NODE_ENV=process.env.NODE_ENV",
27
+ "build:cjs": "cross-env NODE_ENV=$NODE_ENV esbuild *.js --target=node18 --format=cjs --outdir=dist/cjs --define:process.env.NODE_ENV=process.env.NODE_ENV",
28
+ "build:iife": "cross-env NODE_ENV=$NODE_ENV esbuild index.js --bundle --target=es2020 --format=iife --global-name=SmblsFetch --outfile=dist/iife/index.js --define:process.env.NODE_ENV=process.env.NODE_ENV",
29
+ "build": "node ../../build/build.js",
30
+ "prepublish": "npm run build && npm run copy:package:cjs"
30
31
  },
31
32
  "dependencies": {
32
- "@domql/utils": "^3.1.2"
33
- }
33
+ "@domql/utils": "^3.2.3"
34
+ },
35
+ "browser": "./dist/iife/index.js",
36
+ "sideEffects": false
34
37
  }
@@ -1,4 +0,0 @@
1
- {
2
- "type": "commonjs",
3
- "main": "index.js"
4
- }