@unsetsoft/ryunixjs 0.2.37-nightly.3 → 0.2.37-nightly.5

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/Ryunix.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Ryunix = {}));
5
- })(this, (function (exports) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('express'), require('cors')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'express', 'cors'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Ryunix = {}, global.express, global.cors));
5
+ })(this, (function (exports, express, cors) { 'use strict';
6
6
 
7
7
  const vars = {
8
8
  containerRoot: null,
@@ -119,7 +119,7 @@
119
119
  * @param root - The parameter "root" is the id of the HTML element that will serve as the container
120
120
  * for the root element.
121
121
  */
122
- const init = (root) => {
122
+ const init$1 = (root) => {
123
123
  const rootElement = root || "__ryunix";
124
124
  vars.containerRoot = document.getElementById(rootElement);
125
125
  };
@@ -666,7 +666,7 @@
666
666
  var Ryunix = {
667
667
  createElement,
668
668
  render,
669
- init,
669
+ init: init$1,
670
670
  Fragments,
671
671
  Dom,
672
672
  Workers,
@@ -675,11 +675,22 @@
675
675
  Commits,
676
676
  };
677
677
 
678
+ const route = express();
679
+
680
+ const useCors = (config = {}) => app.use(cors(config));
681
+ const init = (port) =>
682
+ route.listen(port, () => {
683
+ console.log("Server is runing at: https://localhost:" + port);
684
+ });
685
+
686
+ var index = { useCors, route, init };
687
+
678
688
  window.Ryunix = Ryunix;
679
689
 
680
690
  exports.Fragments = Fragments;
681
691
  exports.Navigate = Navigate;
682
692
  exports.Router = Router;
693
+ exports.Server = index;
683
694
  exports.createContext = createContext;
684
695
  exports.default = Ryunix;
685
696
  exports.useContext = useContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsetsoft/ryunixjs",
3
- "version": "0.2.37-nightly.3",
3
+ "version": "0.2.37-nightly.5",
4
4
  "license": "MIT",
5
5
  "main": "./dist/Ryunix.js",
6
6
  "private": false,
@@ -29,8 +29,10 @@
29
29
  "@babel/preset-react": "^7.22.5",
30
30
  "@mdx-js/loader": "^2.3.0",
31
31
  "babel-loader": "^9.1.3",
32
+ "cors": "^2.8.5",
32
33
  "crypto": "^1.0.1",
33
34
  "css-loader": "^6.8.1",
35
+ "express": "^4.18.2",
34
36
  "file-loader": "^6.2.0",
35
37
  "glob": "^10.3.7",
36
38
  "html-loader": "^4.2.0",
package/src/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import Ryunix from "./lib/index.js";
2
-
2
+ import Server from "./server/index.js";
3
3
  export {
4
4
  useStore,
5
5
  useEffect,
@@ -12,4 +12,5 @@ export {
12
12
 
13
13
  window.Ryunix = Ryunix;
14
14
 
15
+ export { Server };
15
16
  export default Ryunix;
@@ -0,0 +1,11 @@
1
+ import express from "express";
2
+ import cors from "cors";
3
+ const route = express();
4
+
5
+ const useCors = (config = {}) => app.use(cors(config));
6
+ const init = (port) =>
7
+ route.listen(port, () => {
8
+ console.log("Server is runing at: https://localhost:" + port);
9
+ });
10
+
11
+ export default { useCors, route, init };
@@ -8,7 +8,6 @@ import {
8
8
  resolveApp,
9
9
  } from "./utils/index.mjs";
10
10
  import fs from "fs";
11
- import { testDir } from "./utils/path.cjs";
12
11
  const __filename = fileURLToPath(import.meta.url);
13
12
 
14
13
  const __dirname = dirname(__filename);
@@ -17,12 +16,15 @@ let dir;
17
16
 
18
17
  const manager = getPackageManager();
19
18
  if (manager === "yarn" || manager === "npm" || manager === "bun") {
20
- console.log(testDir("main.ryx"));
21
19
  dir = dirname(join(__dirname, "..", ".."));
22
20
  } else if (manager === "pnpm") {
23
21
  throw new Error(`The manager ${manager} is not supported.`);
24
22
  }
25
23
 
24
+ import config from `${dir}/ryunix.config.js`
25
+
26
+ console.log(config);
27
+
26
28
  export default {
27
29
  mode: "production",
28
30
  entry: join(dir, "src", "main.ryx"),
package/utils/path.cjs DELETED
@@ -1,9 +0,0 @@
1
- const glob = require("glob");
2
- const testDir = (file) =>
3
- glob(__dirname + `/**/${file}`, {}, (err, files) => {
4
- if (err) return err;
5
- return files;
6
- });
7
- module.exports = {
8
- testDir,
9
- };