qcobjects 2.5.108-beta → 2.5.110-beta
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/VERSION +1 -1
- package/build/DOMCreateElement.js +35 -3
- package/build/_import_.js +26 -0
- package/build/findPackageNodePath.js +5 -2
- package/build/index.cjs +25 -2
- package/build/platform.js +8 -2
- package/build-esbuild.js +8 -1
- package/package.json +2 -1
- package/postbuild.js +10 -0
- package/public/browser/QCObjects.js +70 -9
- package/public/browser/QCObjects.js.map +4 -4
- package/public/cjs/QCObjects.cjs +70 -9
- package/public/cjs/QCObjects.cjs.map +4 -4
- package/public/esm/QCObjects.mjs +68 -7
- package/public/esm/QCObjects.mjs.map +4 -4
- package/public/types/index.d.ts +8 -1
- package/src/DOMCreateElement.ts +36 -2
- package/src/_import_.ts +27 -0
- package/src/findPackageNodePath.ts +2 -2
- package/src/platform.ts +9 -2
- package/src/index.cts +0 -2
- package/src/index.mts +0 -2
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.5.
|
|
1
|
+
2.5.110-beta
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._DOMCreateElement = void 0;
|
|
3
|
+
exports._DOMCreateComplexElement = exports._DOMCreateElement = void 0;
|
|
4
4
|
const platform_1 = require("./platform");
|
|
5
|
-
const _DOMCreateElement = function (elementName) {
|
|
5
|
+
const _DOMCreateElement = function (elementName, props, children) {
|
|
6
6
|
let _ret_;
|
|
7
7
|
if (platform_1.isBrowser) {
|
|
8
|
-
_ret_ =
|
|
8
|
+
_ret_ = (0, exports._DOMCreateComplexElement)(elementName, props, children);
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
11
11
|
_ret_ = {};
|
|
@@ -13,3 +13,35 @@ const _DOMCreateElement = function (elementName) {
|
|
|
13
13
|
return _ret_;
|
|
14
14
|
};
|
|
15
15
|
exports._DOMCreateElement = _DOMCreateElement;
|
|
16
|
+
const ComplexTypeCall = (_type, { props, children }) => {
|
|
17
|
+
return _type({ props, children });
|
|
18
|
+
};
|
|
19
|
+
const _DOMCreateComplexElement = (_type, props, children) => {
|
|
20
|
+
if (typeof _type !== "string") {
|
|
21
|
+
return ComplexTypeCall(_type, { props, children });
|
|
22
|
+
}
|
|
23
|
+
const element = document.createElement(_type);
|
|
24
|
+
if (props) {
|
|
25
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
26
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
27
|
+
element.setAttribute(key, value.toString());
|
|
28
|
+
}
|
|
29
|
+
else if (typeof value === "function" && key.toLowerCase().startsWith("on")) {
|
|
30
|
+
element.addEventListener(key.slice(2).toLowerCase(), value.bind(element));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (Array.isArray(children)) {
|
|
35
|
+
children.filter((child => child instanceof Node)).forEach(child => {
|
|
36
|
+
element.appendChild(child);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
else if (children instanceof Node) {
|
|
40
|
+
element.appendChild(children);
|
|
41
|
+
}
|
|
42
|
+
else if (typeof children === "string") {
|
|
43
|
+
element.innerHTML = children;
|
|
44
|
+
}
|
|
45
|
+
return element;
|
|
46
|
+
};
|
|
47
|
+
exports._DOMCreateComplexElement = _DOMCreateComplexElement;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._import_ = _import_;
|
|
4
|
+
const Logger_1 = require("./Logger");
|
|
5
|
+
async function _import_(name) {
|
|
6
|
+
Logger_1.logger.debug(`Importing ${name}...`);
|
|
7
|
+
function isPackage(name) {
|
|
8
|
+
Logger_1.logger.debug(`Validating if ${name} is a package name...`);
|
|
9
|
+
// Simple check to determine if the name is a package
|
|
10
|
+
// This can be enhanced based on your specific needs
|
|
11
|
+
return !name.startsWith(".") && !name.startsWith("/") && !name.includes("/");
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
// Ensure the name has a .js extension if it's not a package
|
|
15
|
+
const hasExtension = /\.[^/\\]+$/.test(name);
|
|
16
|
+
if (!hasExtension && !isPackage(name)) {
|
|
17
|
+
Logger_1.logger.debug(`${name} does not have an extension and is not a package. Adding js extension.`);
|
|
18
|
+
name += ".js";
|
|
19
|
+
}
|
|
20
|
+
const m = await import(name);
|
|
21
|
+
return m;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
Logger_1.logger.warn(`Failed to load module: ${error}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.findPackageNodePath = void 0;
|
|
4
7
|
const CONFIG_1 = require("./CONFIG");
|
|
5
8
|
const Export_1 = require("./Export");
|
|
6
9
|
const Logger_1 = require("./Logger");
|
|
7
10
|
const platform_1 = require("./platform");
|
|
11
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
12
|
const findPackageNodePath = function (packagename) {
|
|
9
13
|
let sdkPath = null;
|
|
10
14
|
if (!platform_1.isBrowser) {
|
|
11
|
-
const fs = (0, platform_1._require_)("fs");
|
|
12
15
|
try {
|
|
13
16
|
let sdkPaths = [
|
|
14
17
|
`${CONFIG_1.CONFIG.get("projectPath")}${CONFIG_1.CONFIG.get("relativeImportPath")}`,
|
|
@@ -25,7 +28,7 @@ const findPackageNodePath = function (packagename) {
|
|
|
25
28
|
""
|
|
26
29
|
].concat(module.paths);
|
|
27
30
|
sdkPaths = sdkPaths.filter(p => {
|
|
28
|
-
return (
|
|
31
|
+
return (node_fs_1.default).existsSync(p + "/" + packagename);
|
|
29
32
|
});
|
|
30
33
|
if (sdkPaths.length > 0) {
|
|
31
34
|
sdkPath = sdkPaths[0];
|
package/build/index.cjs
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const QCObjects = require("./QCObjects.js");
|
|
4
|
-
|
|
26
|
+
const QCObjects = __importStar(require("./QCObjects.js"));
|
|
27
|
+
exports.default = QCObjects;
|
package/build/platform.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.is_phonegap = exports._require_ = exports.deno_require = exports.isNodeCommonJS = exports.isBrowser = exports.isDeno = void 0;
|
|
4
|
+
const _import_1 = require("./_import_");
|
|
4
5
|
const Logger_1 = require("./Logger");
|
|
5
6
|
exports.isDeno = (typeof window !== "undefined" && "Deno" in window);
|
|
6
7
|
exports.isBrowser = (typeof window !== "undefined" && typeof window.self !== "undefined" && window === window.self) && !exports.isDeno;
|
|
@@ -12,8 +13,13 @@ const _require_ = (name) => {
|
|
|
12
13
|
return (exports.isDeno) ? ((0, exports.deno_require)(name)) : (((name) => {
|
|
13
14
|
let r;
|
|
14
15
|
try {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
(0, _import_1._import_)(name)
|
|
17
|
+
.then((m) => {
|
|
18
|
+
r = (m && m.default) || m;
|
|
19
|
+
})
|
|
20
|
+
.catch((e) => {
|
|
21
|
+
Logger_1.logger.warn(`An error ocurred: ${e}`);
|
|
22
|
+
});
|
|
17
23
|
}
|
|
18
24
|
catch (e) {
|
|
19
25
|
Logger_1.logger.debug(`An error ocurred importing module. ${e}`);
|
package/build-esbuild.js
CHANGED
|
@@ -20,7 +20,14 @@ const baseSettings = {
|
|
|
20
20
|
alias({
|
|
21
21
|
"types": path.join(__dirname, "src/types/global/index.d.ts")
|
|
22
22
|
})
|
|
23
|
-
]
|
|
23
|
+
],
|
|
24
|
+
external: ["os", "path", "http", "url",
|
|
25
|
+
"child_process", "events", "fs", "process",
|
|
26
|
+
"node:fs", "node:os", "node:child_process",
|
|
27
|
+
"node:path", "readline", "node:net", "node:repl",
|
|
28
|
+
"node:vm", "http2", "vm", "qcobjects", "qcobjects-sdk"
|
|
29
|
+
]
|
|
30
|
+
|
|
24
31
|
};
|
|
25
32
|
|
|
26
33
|
const cjsSettings = {...baseSettings,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qcobjects",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.110-beta",
|
|
4
4
|
"description": "QCObjects is an Open-source framework that empowers full-stack developers to make micro-services and micro-frontends into an N-Tier architecture.",
|
|
5
5
|
"main": "public/cjs/QCObjects.cjs",
|
|
6
6
|
"module": "public/esm/QCObjects.mjs",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"license": "LGPL-3.0",
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "npm run build:ts-types && npm run build:ts && npm run build:browser",
|
|
25
|
+
"postbuild": "node ./postbuild.js",
|
|
25
26
|
"build:ts": "npm test && npx tsc",
|
|
26
27
|
"build:ts-types": "npx tsc --project tsconfig.d.json",
|
|
27
28
|
"build:browser": "npm run build:esbuild",
|
package/postbuild.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const fs = require('node:fs');
|
|
2
|
+
const path = './public/types/index.d.ts';
|
|
3
|
+
|
|
4
|
+
fs.appendFile(path, '\nexport {};', function (err) {
|
|
5
|
+
if (err) {
|
|
6
|
+
console.error('Failed to append export statement:', err);
|
|
7
|
+
} else {
|
|
8
|
+
console.log('Successfully appended export statement to index.d.ts');
|
|
9
|
+
}
|
|
10
|
+
});
|
|
@@ -85,11 +85,40 @@ var global = (() => {
|
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
+
// src/_import_.ts
|
|
89
|
+
async function _import_(name) {
|
|
90
|
+
logger.debug(`Importing ${name}...`);
|
|
91
|
+
function isPackage(name2) {
|
|
92
|
+
logger.debug(`Validating if ${name2} is a package name...`);
|
|
93
|
+
return !name2.startsWith(".") && !name2.startsWith("/") && !name2.includes("/");
|
|
94
|
+
}
|
|
95
|
+
__name(isPackage, "isPackage");
|
|
96
|
+
try {
|
|
97
|
+
const hasExtension = /\.[^/\\]+$/.test(name);
|
|
98
|
+
if (!hasExtension && !isPackage(name)) {
|
|
99
|
+
logger.debug(`${name} does not have an extension and is not a package. Adding js extension.`);
|
|
100
|
+
name += ".js";
|
|
101
|
+
}
|
|
102
|
+
const m = await import(name);
|
|
103
|
+
return m;
|
|
104
|
+
} catch (error) {
|
|
105
|
+
logger.warn(`Failed to load module: ${error}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
var init_import = __esm({
|
|
109
|
+
"src/_import_.ts"() {
|
|
110
|
+
"use strict";
|
|
111
|
+
init_Logger();
|
|
112
|
+
__name(_import_, "_import_");
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
88
116
|
// src/platform.ts
|
|
89
117
|
var isDeno, isBrowser, isNodeCommonJS, deno_require, _require_, is_phonegap;
|
|
90
118
|
var init_platform = __esm({
|
|
91
119
|
"src/platform.ts"() {
|
|
92
120
|
"use strict";
|
|
121
|
+
init_import();
|
|
93
122
|
init_Logger();
|
|
94
123
|
isDeno = typeof window !== "undefined" && "Deno" in window;
|
|
95
124
|
isBrowser = typeof window !== "undefined" && typeof window.self !== "undefined" && window === window.self && !isDeno;
|
|
@@ -100,7 +129,11 @@ var global = (() => {
|
|
|
100
129
|
return isDeno ? deno_require(name) : ((name2) => {
|
|
101
130
|
let r;
|
|
102
131
|
try {
|
|
103
|
-
|
|
132
|
+
_import_(name2).then((m) => {
|
|
133
|
+
r = m && m.default || m;
|
|
134
|
+
}).catch((e) => {
|
|
135
|
+
logger.warn(`An error ocurred: ${e}`);
|
|
136
|
+
});
|
|
104
137
|
} catch (e) {
|
|
105
138
|
logger.debug(`An error ocurred importing module. ${e}`);
|
|
106
139
|
r = { export: {} };
|
|
@@ -239,20 +272,48 @@ var global = (() => {
|
|
|
239
272
|
});
|
|
240
273
|
|
|
241
274
|
// src/DOMCreateElement.ts
|
|
242
|
-
var _DOMCreateElement;
|
|
275
|
+
var _DOMCreateElement, ComplexTypeCall, _DOMCreateComplexElement;
|
|
243
276
|
var init_DOMCreateElement = __esm({
|
|
244
277
|
"src/DOMCreateElement.ts"() {
|
|
245
278
|
"use strict";
|
|
246
279
|
init_platform();
|
|
247
|
-
_DOMCreateElement = /* @__PURE__ */ __name(function(elementName) {
|
|
280
|
+
_DOMCreateElement = /* @__PURE__ */ __name(function(elementName, props, children) {
|
|
248
281
|
let _ret_;
|
|
249
282
|
if (isBrowser) {
|
|
250
|
-
_ret_ =
|
|
283
|
+
_ret_ = _DOMCreateComplexElement(elementName, props, children);
|
|
251
284
|
} else {
|
|
252
285
|
_ret_ = {};
|
|
253
286
|
}
|
|
254
287
|
return _ret_;
|
|
255
288
|
}, "_DOMCreateElement");
|
|
289
|
+
ComplexTypeCall = /* @__PURE__ */ __name((_type, { props, children }) => {
|
|
290
|
+
return _type({ props, children });
|
|
291
|
+
}, "ComplexTypeCall");
|
|
292
|
+
_DOMCreateComplexElement = /* @__PURE__ */ __name((_type, props, children) => {
|
|
293
|
+
if (typeof _type !== "string") {
|
|
294
|
+
return ComplexTypeCall(_type, { props, children });
|
|
295
|
+
}
|
|
296
|
+
const element = document.createElement(_type);
|
|
297
|
+
if (props) {
|
|
298
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
299
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
300
|
+
element.setAttribute(key, value.toString());
|
|
301
|
+
} else if (typeof value === "function" && key.toLowerCase().startsWith("on")) {
|
|
302
|
+
element.addEventListener(key.slice(2).toLowerCase(), value.bind(element));
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
if (Array.isArray(children)) {
|
|
307
|
+
children.filter((child) => child instanceof Node).forEach((child) => {
|
|
308
|
+
element.appendChild(child);
|
|
309
|
+
});
|
|
310
|
+
} else if (children instanceof Node) {
|
|
311
|
+
element.appendChild(children);
|
|
312
|
+
} else if (typeof children === "string") {
|
|
313
|
+
element.innerHTML = children;
|
|
314
|
+
}
|
|
315
|
+
return element;
|
|
316
|
+
}, "_DOMCreateComplexElement");
|
|
256
317
|
}
|
|
257
318
|
});
|
|
258
319
|
|
|
@@ -2220,9 +2281,9 @@ var global = (() => {
|
|
|
2220
2281
|
} else {
|
|
2221
2282
|
logger.debug("Loading the component as a local file in server...");
|
|
2222
2283
|
const _directLoad = /* @__PURE__ */ __name(function() {
|
|
2223
|
-
const
|
|
2284
|
+
const fs2 = _require_("fs");
|
|
2224
2285
|
logger.debug("SENDING THE NORMAL REQUEST ");
|
|
2225
|
-
|
|
2286
|
+
fs2.readFile(component2.url, _componentLoaded);
|
|
2226
2287
|
}, "_directLoad");
|
|
2227
2288
|
if (component2.cached) {
|
|
2228
2289
|
logger.debug("USING CACHE FOR COMPONENT: " + component2.name);
|
|
@@ -4271,7 +4332,7 @@ var global = (() => {
|
|
|
4271
4332
|
});
|
|
4272
4333
|
|
|
4273
4334
|
// src/findPackageNodePath.ts
|
|
4274
|
-
var findPackageNodePath;
|
|
4335
|
+
var import_node_fs, findPackageNodePath;
|
|
4275
4336
|
var init_findPackageNodePath = __esm({
|
|
4276
4337
|
"src/findPackageNodePath.ts"() {
|
|
4277
4338
|
"use strict";
|
|
@@ -4279,10 +4340,10 @@ var global = (() => {
|
|
|
4279
4340
|
init_Export();
|
|
4280
4341
|
init_Logger();
|
|
4281
4342
|
init_platform();
|
|
4343
|
+
import_node_fs = __toESM(__require("node:fs"));
|
|
4282
4344
|
findPackageNodePath = /* @__PURE__ */ __name(function(packagename) {
|
|
4283
4345
|
let sdkPath = null;
|
|
4284
4346
|
if (!isBrowser) {
|
|
4285
|
-
const fs = _require_("fs");
|
|
4286
4347
|
try {
|
|
4287
4348
|
let sdkPaths = [
|
|
4288
4349
|
`${CONFIG.get("projectPath")}${CONFIG.get("relativeImportPath")}`,
|
|
@@ -4299,7 +4360,7 @@ var global = (() => {
|
|
|
4299
4360
|
""
|
|
4300
4361
|
].concat(module.paths);
|
|
4301
4362
|
sdkPaths = sdkPaths.filter((p) => {
|
|
4302
|
-
return
|
|
4363
|
+
return import_node_fs.default.existsSync(p + "/" + packagename);
|
|
4303
4364
|
});
|
|
4304
4365
|
if (sdkPaths.length > 0) {
|
|
4305
4366
|
sdkPath = sdkPaths[0];
|