qcobjects 2.5.107-beta → 2.5.109-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 CHANGED
@@ -1 +1 @@
1
- 2.5.107-beta
1
+ 2.5.109-beta
@@ -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 (fs).existsSync(p + "/" + packagename);
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
- module.exports = QCObjects;
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
- // eslint-disable-next-line @typescript-eslint/no-require-imports
16
- r = require(name);
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.107-beta",
3
+ "version": "2.5.109-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",
@@ -9,9 +9,9 @@
9
9
  "types": "public/types/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
+ "types": "./public/types/index.d.ts",
12
13
  "require": "./public/cjs/QCObjects.cjs",
13
- "import": "./public/esm/QCObjects.mjs",
14
- "types": "./public/types/index.d.ts"
14
+ "import": "./public/esm/QCObjects.mjs"
15
15
  },
16
16
  "./types/*": "./types/*",
17
17
  "./package.json": "./package.json",
@@ -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
- r = __require(name2);
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: {} };
@@ -2220,9 +2253,9 @@ var global = (() => {
2220
2253
  } else {
2221
2254
  logger.debug("Loading the component as a local file in server...");
2222
2255
  const _directLoad = /* @__PURE__ */ __name(function() {
2223
- const fs = _require_("fs");
2256
+ const fs2 = _require_("fs");
2224
2257
  logger.debug("SENDING THE NORMAL REQUEST ");
2225
- fs.readFile(component2.url, _componentLoaded);
2258
+ fs2.readFile(component2.url, _componentLoaded);
2226
2259
  }, "_directLoad");
2227
2260
  if (component2.cached) {
2228
2261
  logger.debug("USING CACHE FOR COMPONENT: " + component2.name);
@@ -4271,7 +4304,7 @@ var global = (() => {
4271
4304
  });
4272
4305
 
4273
4306
  // src/findPackageNodePath.ts
4274
- var findPackageNodePath;
4307
+ var import_node_fs, findPackageNodePath;
4275
4308
  var init_findPackageNodePath = __esm({
4276
4309
  "src/findPackageNodePath.ts"() {
4277
4310
  "use strict";
@@ -4279,10 +4312,10 @@ var global = (() => {
4279
4312
  init_Export();
4280
4313
  init_Logger();
4281
4314
  init_platform();
4315
+ import_node_fs = __toESM(__require("node:fs"));
4282
4316
  findPackageNodePath = /* @__PURE__ */ __name(function(packagename) {
4283
4317
  let sdkPath = null;
4284
4318
  if (!isBrowser) {
4285
- const fs = _require_("fs");
4286
4319
  try {
4287
4320
  let sdkPaths = [
4288
4321
  `${CONFIG.get("projectPath")}${CONFIG.get("relativeImportPath")}`,
@@ -4299,7 +4332,7 @@ var global = (() => {
4299
4332
  ""
4300
4333
  ].concat(module.paths);
4301
4334
  sdkPaths = sdkPaths.filter((p) => {
4302
- return fs.existsSync(p + "/" + packagename);
4335
+ return import_node_fs.default.existsSync(p + "/" + packagename);
4303
4336
  });
4304
4337
  if (sdkPaths.length > 0) {
4305
4338
  sdkPath = sdkPaths[0];