@symbo.ls/sync 3.5.0 → 3.6.1
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/client.js +1 -3
- package/dist/cjs/client.js +7 -8
- package/dist/esm/client.js +1 -2
- package/dist/iife/index.js +7 -8
- package/dynamic.json +1 -1
- package/package.json +13 -18
- package/server.js +2 -2
package/client.js
CHANGED
package/dist/cjs/client.js
CHANGED
|
@@ -32,18 +32,17 @@ __export(client_exports, {
|
|
|
32
32
|
send: () => send
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(client_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_utils = require("@domql/utils");
|
|
36
36
|
var import_socket = __toESM(require("socket.io-client"), 1);
|
|
37
|
-
const { window, isFunction, isArray } = utils.default || utils;
|
|
38
37
|
const defautlOpts = {};
|
|
39
38
|
let CONNECT_ATTEPT = 0;
|
|
40
39
|
const CONNECT_ATTEPT_MAX_ALLOWED = 1;
|
|
41
40
|
const getIsDev = (options) => {
|
|
42
|
-
return options.development || window && window.location && window.location.host.includes("local") || ENV === "testing" || ENV === "development";
|
|
41
|
+
return options.development || import_utils.window && import_utils.window.location && import_utils.window.location.host.includes("local") || ENV === "testing" || ENV === "development";
|
|
43
42
|
};
|
|
44
43
|
const getSocketUrl = (options, isDev) => {
|
|
45
44
|
const SOCKET_BACKEND_URL = isDev ? "http://localhost:8080/" : "https://api.symbols.app/";
|
|
46
|
-
const socketUrls = isArray(options.socketUrl) ? options.socketUrl : [options.socketUrl || SOCKET_BACKEND_URL];
|
|
45
|
+
const socketUrls = (0, import_utils.isArray)(options.socketUrl) ? options.socketUrl : [options.socketUrl || SOCKET_BACKEND_URL];
|
|
47
46
|
const primaryUrl = socketUrls[0];
|
|
48
47
|
const secondaryUrl = socketUrls[1] || "api.symbols.app";
|
|
49
48
|
return {
|
|
@@ -68,7 +67,7 @@ const connect = (key, options = {}) => {
|
|
|
68
67
|
}
|
|
69
68
|
socket.emit("initConnect", { key, ...options });
|
|
70
69
|
try {
|
|
71
|
-
if (isFunction(options.onConnect)) {
|
|
70
|
+
if ((0, import_utils.isFunction)(options.onConnect)) {
|
|
72
71
|
options.onConnect(socket.id, socket);
|
|
73
72
|
}
|
|
74
73
|
} catch (e) {
|
|
@@ -78,7 +77,7 @@ const connect = (key, options = {}) => {
|
|
|
78
77
|
socket.on("connect_error", (err) => {
|
|
79
78
|
console.log(`event: connect_error | reason: ${err.message}`);
|
|
80
79
|
try {
|
|
81
|
-
if (isFunction(options.onError)) {
|
|
80
|
+
if ((0, import_utils.isFunction)(options.onError)) {
|
|
82
81
|
options.onError(err, socket);
|
|
83
82
|
}
|
|
84
83
|
if (CONNECT_ATTEPT < CONNECT_ATTEPT_MAX_ALLOWED) {
|
|
@@ -101,7 +100,7 @@ const connect = (key, options = {}) => {
|
|
|
101
100
|
socket.on("disconnect", (reason) => {
|
|
102
101
|
console.log(`event: disconnect | reason: ${reason}`);
|
|
103
102
|
try {
|
|
104
|
-
if (isFunction(options.onDisconnect)) {
|
|
103
|
+
if ((0, import_utils.isFunction)(options.onDisconnect)) {
|
|
105
104
|
options.onDisconnect(reason, socket);
|
|
106
105
|
}
|
|
107
106
|
} catch (e) {
|
|
@@ -113,7 +112,7 @@ const connect = (key, options = {}) => {
|
|
|
113
112
|
return;
|
|
114
113
|
}
|
|
115
114
|
try {
|
|
116
|
-
if (isFunction(options.onChange)) {
|
|
115
|
+
if ((0, import_utils.isFunction)(options.onChange)) {
|
|
117
116
|
options.onChange(event, args[0], socket);
|
|
118
117
|
}
|
|
119
118
|
} catch (e) {
|
package/dist/esm/client.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { window, isFunction, isArray } from "@domql/utils";
|
|
2
2
|
import io from "socket.io-client";
|
|
3
|
-
const { window, isFunction, isArray } = utils.default || utils;
|
|
4
3
|
const defautlOpts = {};
|
|
5
4
|
let CONNECT_ATTEPT = 0;
|
|
6
5
|
const CONNECT_ATTEPT_MAX_ALLOWED = 1;
|
package/dist/iife/index.js
CHANGED
|
@@ -45,7 +45,7 @@ var SmblsSync = (() => {
|
|
|
45
45
|
var import_router = __require("@domql/router");
|
|
46
46
|
var import_smbls = __require("smbls");
|
|
47
47
|
var import_socket2 = __require("socket.io-client");
|
|
48
|
-
var
|
|
48
|
+
var import_utils3 = __require("@domql/utils");
|
|
49
49
|
|
|
50
50
|
// SyncNotifications.js
|
|
51
51
|
var NOTIF_COLORS = {
|
|
@@ -125,12 +125,11 @@ var SmblsSync = (() => {
|
|
|
125
125
|
|
|
126
126
|
// Inspect.js
|
|
127
127
|
var smblsUI = __toESM(__require("@symbo.ls/uikit"), 1);
|
|
128
|
-
var
|
|
128
|
+
var import_utils2 = __require("@domql/utils");
|
|
129
129
|
|
|
130
130
|
// client.js
|
|
131
|
-
var
|
|
131
|
+
var import_utils = __require("@domql/utils");
|
|
132
132
|
var import_socket = __toESM(__require("socket.io-client"), 1);
|
|
133
|
-
var { window: window2, isFunction, isArray } = utils.default || utils;
|
|
134
133
|
var defautlOpts = {};
|
|
135
134
|
function send(event = "change", changes, options) {
|
|
136
135
|
this.emit(event, changes, { ...options, ...defautlOpts });
|
|
@@ -138,7 +137,7 @@ var SmblsSync = (() => {
|
|
|
138
137
|
|
|
139
138
|
// Inspect.js
|
|
140
139
|
function returnStringExtend(_extends) {
|
|
141
|
-
return (0,
|
|
140
|
+
return (0, import_utils2.isString)(_extends) ? _extends : (0, import_utils2.isArray)(_extends) ? _extends.find((extItem) => (0, import_utils2.isString)(extItem)) : "";
|
|
142
141
|
}
|
|
143
142
|
function getComponentKey(el) {
|
|
144
143
|
if (!el) return;
|
|
@@ -259,7 +258,7 @@ var SmblsSync = (() => {
|
|
|
259
258
|
},
|
|
260
259
|
onInit: ({ context }) => {
|
|
261
260
|
const { components } = context;
|
|
262
|
-
if ((0,
|
|
261
|
+
if ((0, import_utils2.isObject)(components)) {
|
|
263
262
|
const { Content, ...rest } = components;
|
|
264
263
|
for (const key in rest) {
|
|
265
264
|
if (smblsUI[key]) continue;
|
|
@@ -354,7 +353,7 @@ var SmblsSync = (() => {
|
|
|
354
353
|
var fetchServiceToken = async () => {
|
|
355
354
|
try {
|
|
356
355
|
const urlBase = isLocal ? "http://localhost:8080" : "https://api.symbols.app";
|
|
357
|
-
const res = await
|
|
356
|
+
const res = await import_utils3.window.fetch(`${urlBase}/service-token`, {
|
|
358
357
|
method: "GET"
|
|
359
358
|
});
|
|
360
359
|
let txt;
|
|
@@ -388,7 +387,7 @@ var SmblsSync = (() => {
|
|
|
388
387
|
if (key === "designSystem") {
|
|
389
388
|
(0, import_smbls.init)(val);
|
|
390
389
|
} else {
|
|
391
|
-
(0,
|
|
390
|
+
(0, import_utils3.overwriteShallow)(ctx[key], val);
|
|
392
391
|
}
|
|
393
392
|
} else {
|
|
394
393
|
ctx[key] = val;
|
package/dynamic.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{}
|
|
1
|
+
{}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/sync",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"module": "./index.js",
|
|
6
6
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
@@ -16,32 +16,28 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
18
|
"import": "./index.js",
|
|
19
|
-
"require": "./index.js"
|
|
20
|
-
"browser": "./index.js",
|
|
21
|
-
"default": "./index.js"
|
|
19
|
+
"require": "./index.js"
|
|
22
20
|
},
|
|
23
21
|
"./client": {
|
|
24
22
|
"import": "./client.js",
|
|
25
|
-
"require": "./client.js"
|
|
26
|
-
"default": "./client.js"
|
|
23
|
+
"require": "./client.js"
|
|
27
24
|
},
|
|
28
25
|
"./server": {
|
|
29
|
-
"import": "./server.js"
|
|
30
|
-
"default": "./server.js"
|
|
26
|
+
"import": "./server.js"
|
|
31
27
|
},
|
|
32
28
|
"./*.js": {
|
|
33
29
|
"import": "./dist/esm/*.js",
|
|
34
|
-
"require": "./dist/cjs/*.js"
|
|
35
|
-
"default": "./dist/esm/*.js"
|
|
30
|
+
"require": "./dist/cjs/*.js"
|
|
36
31
|
},
|
|
37
32
|
"./*": {
|
|
38
33
|
"import": "./dist/esm/*.js",
|
|
39
|
-
"require": "./dist/cjs/*.js"
|
|
40
|
-
"default": "./dist/esm/*.js"
|
|
34
|
+
"require": "./dist/cjs/*.js"
|
|
41
35
|
}
|
|
42
36
|
},
|
|
43
37
|
"source": "index.js",
|
|
44
|
-
"publishConfig": {
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
45
41
|
"scripts": {
|
|
46
42
|
"copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
|
|
47
43
|
"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",
|
|
@@ -51,13 +47,12 @@
|
|
|
51
47
|
"prepublish": "npm run build && npm run copy:package:cjs"
|
|
52
48
|
},
|
|
53
49
|
"dependencies": {
|
|
54
|
-
"@domql/router": "^3.
|
|
55
|
-
"@domql/utils": "^3.
|
|
56
|
-
"@symbo.ls/scratch": "^3.
|
|
57
|
-
"@symbo.ls/uikit": "^3.
|
|
50
|
+
"@domql/router": "^3.6.1",
|
|
51
|
+
"@domql/utils": "^3.6.1",
|
|
52
|
+
"@symbo.ls/scratch": "^3.6.1",
|
|
53
|
+
"@symbo.ls/uikit": "^3.6.1",
|
|
58
54
|
"chalk": "^5.4.1",
|
|
59
55
|
"express": "^4.21.2",
|
|
60
|
-
"http": "^0.0.1-security",
|
|
61
56
|
"socket.io": "^4.8.1",
|
|
62
57
|
"socket.io-client": "^4.8.1"
|
|
63
58
|
},
|
package/server.js
CHANGED
|
@@ -9,8 +9,8 @@ import { createRequire } from 'module'
|
|
|
9
9
|
import * as utils from '@domql/utils'
|
|
10
10
|
const { overwriteDeep } = utils.default || utils
|
|
11
11
|
|
|
12
|
-
const require = createRequire(import.meta.url)
|
|
13
|
-
const DES_SYS_DEFAULT_FILE = require('./dynamic.json')
|
|
12
|
+
const require = createRequire(import.meta.url)
|
|
13
|
+
const DES_SYS_DEFAULT_FILE = require('./dynamic.json')
|
|
14
14
|
|
|
15
15
|
const app = express()
|
|
16
16
|
let io
|