cedro 0.1.21 → 0.1.23
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/README.md +1 -1
- package/package.json +1 -1
- package/src/core/application.builder.tsx +2 -24
- package/src/core/path.import.dev.ts +7 -0
- package/src/core/path.import.release.ts +7 -0
- package/rollup.config.js +0 -35
- package/tsconfig.publish.json +0 -36
- package/vite.publish.config.ts +0 -41
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
<!-- markdownlint-disable-next-line -->
|
|
1
2
|
<div align="center">
|
|
2
3
|
<img src="https://raw.githubusercontent.com/hdrdevs/cedro/main/public/cedro-logo.svg" alt="Cedro" width="170">
|
|
3
4
|
<h1>cedro</h1>
|
|
4
|
-
|
|
5
5
|
</div>
|
|
6
6
|
<h6>Javascript library to build user interfece based on widgets.</h6>
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import { Widget, WidgetAlignTypes } from "../ui";
|
|
|
2
2
|
import { createWidget } from "../ui/widget.builder";
|
|
3
3
|
import Application, { ApplicationProps } from "./application.core";
|
|
4
4
|
import { decode } from "./html.entities";
|
|
5
|
+
import { getAdaptedUrl } from "./path.import.release";
|
|
5
6
|
|
|
6
7
|
function getApplicationProps(content: any): ApplicationProps {
|
|
7
8
|
let props: ApplicationProps = {
|
|
@@ -66,31 +67,8 @@ export function createApplication(content: any): Application {
|
|
|
66
67
|
if (ietmRoute.getAttribute("w-route-path") && ietmRoute.getAttribute("href")) {
|
|
67
68
|
newApp.router.on(decode(ietmRoute.getAttribute("href")), () => {
|
|
68
69
|
const url = decode(ietmRoute.getAttribute("href"));
|
|
69
|
-
const timestamp = new Date().getTime();
|
|
70
70
|
const isProduction = process.env.NODE_ENV === "production";
|
|
71
|
-
|
|
72
|
-
//DEVELOPMENT
|
|
73
|
-
/*
|
|
74
|
-
const pathDev = ".." + url + "?ts=" + timestamp;
|
|
75
|
-
|
|
76
|
-
const pathProduction = `../../assets${decode(
|
|
77
|
-
ietmRoute.getAttribute("href")
|
|
78
|
-
)}/index.js?ts=${timestamp}`;*/
|
|
79
|
-
|
|
80
|
-
//FIN DEVELOPMENT
|
|
81
|
-
|
|
82
|
-
//PUBLISH
|
|
83
|
-
|
|
84
|
-
const pathDev = url + "index.tsx" + "?ts=" + timestamp;
|
|
85
|
-
|
|
86
|
-
const pathProduction = `/assets${decode(
|
|
87
|
-
ietmRoute.getAttribute("href")
|
|
88
|
-
)}index.js?ts=${timestamp}`;
|
|
89
|
-
|
|
90
|
-
//FIN PUBLISH
|
|
91
|
-
|
|
92
|
-
const path = isProduction ? pathProduction : pathDev;
|
|
93
|
-
|
|
71
|
+
const path = getAdaptedUrl(url);
|
|
94
72
|
import(/*@vite-ignore*/ path).then((module) => {
|
|
95
73
|
newApp.clearLoadedModule();
|
|
96
74
|
newApp.setLoadedModule(module.default);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const getAdaptedUrl = (url: string) => {
|
|
2
|
+
const timestamp = new Date().getTime();
|
|
3
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
4
|
+
const pathDev = ".." + url + "?ts=" + timestamp;
|
|
5
|
+
const pathProduction = `../../assets${url}/index.js?ts=${timestamp}`;
|
|
6
|
+
return isProduction ? pathProduction : pathDev;
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const getAdaptedUrl = (url: string) => {
|
|
2
|
+
const timestamp = new Date().getTime();
|
|
3
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
4
|
+
const pathDev = "../../../../src" + url + "?ts=" + timestamp;
|
|
5
|
+
const pathProduction = `/assets${url}index.js?ts=${timestamp}`;
|
|
6
|
+
return isProduction ? pathProduction : pathDev;
|
|
7
|
+
};
|
package/rollup.config.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
-
import typescript from "rollup-plugin-typescript2";
|
|
3
|
-
import postcss from "rollup-plugin-postcss";
|
|
4
|
-
import inject from "@rollup/plugin-inject";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
input: "src/index.ts",
|
|
8
|
-
output: [
|
|
9
|
-
{
|
|
10
|
-
file: "lib/index.js",
|
|
11
|
-
format: "cjs",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
file: "lib/index.esm.js",
|
|
15
|
-
format: "esm",
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
plugins: [
|
|
19
|
-
resolve({
|
|
20
|
-
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
21
|
-
}),
|
|
22
|
-
inject({
|
|
23
|
-
DOMcreateElement: ["@root/core/jsxsupport", "DOMcreateElement"],
|
|
24
|
-
DOMcreateFragment: ["@root/core/jsxsupport", "DOMcreateFragment"],
|
|
25
|
-
}),
|
|
26
|
-
typescript({
|
|
27
|
-
tsconfig: "./tsconfig.json", // Asegúrate de que esta ruta sea correcta
|
|
28
|
-
}),
|
|
29
|
-
postcss({
|
|
30
|
-
extract: true,
|
|
31
|
-
minimize: true,
|
|
32
|
-
}),
|
|
33
|
-
],
|
|
34
|
-
external: ["react", "react-dom"],
|
|
35
|
-
};
|
package/tsconfig.publish.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"jsx": "preserve",
|
|
4
|
-
"jsxFactory": "DOMcreateElement",
|
|
5
|
-
"jsxFragmentFactory": "DOMcreateFragment",
|
|
6
|
-
|
|
7
|
-
"target": "ES2020",
|
|
8
|
-
"sourceMap": true,
|
|
9
|
-
|
|
10
|
-
"useDefineForClassFields": true,
|
|
11
|
-
"module": "ESNext",
|
|
12
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
13
|
-
"outDir": "lib",
|
|
14
|
-
"declaration": true,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
|
|
17
|
-
/* Bundler mode */
|
|
18
|
-
"moduleResolution": "Node",
|
|
19
|
-
"resolveJsonModule": true,
|
|
20
|
-
"isolatedModules": true,
|
|
21
|
-
|
|
22
|
-
/* Linting */
|
|
23
|
-
"strict": true,
|
|
24
|
-
"esModuleInterop": true,
|
|
25
|
-
"noUnusedLocals": true,
|
|
26
|
-
"noUnusedParameters": true,
|
|
27
|
-
"noFallthroughCasesInSwitch": true,
|
|
28
|
-
|
|
29
|
-
"baseUrl": ".",
|
|
30
|
-
"paths": {
|
|
31
|
-
"@root/*": ["src/*"]
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"include": ["src"],
|
|
35
|
-
"exclude": ["node_modules", "src/working"]
|
|
36
|
-
}
|
package/vite.publish.config.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import path, { resolve } from "path";
|
|
2
|
-
import { defineConfig } from "vite";
|
|
3
|
-
import { glob } from "glob";
|
|
4
|
-
|
|
5
|
-
// Encuentra todos los archivos index.tsx dentro de la carpeta 'working'
|
|
6
|
-
const entries = glob.sync("src/**/index.tsx").reduce((acc, file) => {
|
|
7
|
-
const entryName = file.replace("src/", "").replace(".tsx", "");
|
|
8
|
-
acc[entryName] = resolve(__dirname, file);
|
|
9
|
-
return acc;
|
|
10
|
-
}, {});
|
|
11
|
-
|
|
12
|
-
export default defineConfig({
|
|
13
|
-
plugins: [],
|
|
14
|
-
esbuild: {
|
|
15
|
-
jsxFactory: "DOMcreateElement",
|
|
16
|
-
jsxFragment: "DOMcreateFragment",
|
|
17
|
-
jsxInject: "import { DOMcreateElement, DOMcreateFragment } from '@root/core/jsxsupport';",
|
|
18
|
-
},
|
|
19
|
-
build: {
|
|
20
|
-
rollupOptions: {
|
|
21
|
-
input: { ...entries, main: resolve(__dirname, "index.html") },
|
|
22
|
-
output: {
|
|
23
|
-
entryFileNames: (chunkInfo) => {
|
|
24
|
-
// Genera una estructura de nombres de archivo basada en la ubicación original
|
|
25
|
-
const name = chunkInfo.name.replace(/src\//, "");
|
|
26
|
-
return `assets/${name}.js`;
|
|
27
|
-
},
|
|
28
|
-
chunkFileNames: "assets/[name].js",
|
|
29
|
-
assetFileNames: "assets/[name].[ext]",
|
|
30
|
-
preserveModules: true,
|
|
31
|
-
preserveModulesRoot: "src",
|
|
32
|
-
},
|
|
33
|
-
preserveEntrySignatures: "allow-extension",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
resolve: {
|
|
37
|
-
alias: {
|
|
38
|
-
"@root": path.resolve(__dirname, "./src/"),
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
});
|